[Bug 222632] connect(2) not available in capability mode

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Sun Oct 15 15:06:19 UTC 2017


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=222632

Jan Kokemüller <jan.kokemueller at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jan.kokemueller at gmail.com

--- Comment #13 from Jan Kokemüller <jan.kokemueller at gmail.com> ---
I've noticed that connectat(AT_FDCWD, ...) will even work on AF_INET sockets
created in capabilities mode. Surely this is not intended to work? Am I missing
something? bindat(AT_FDCWD, ...) also works.


        if (cap_enter() < 0) {
                err(1, "cap_enter");
        }

        int sock = socket(AF_INET, SOCK_STREAM, 0);
        if (sock < 0) {
                err(1, "socket");
        }

        struct sockaddr_in sin;
        sin.sin_family = AF_INET;
        sin.sin_port = htons(22);
        sin.sin_addr.s_addr = htonl(0x7F000001);

        if (connectat(AT_FDCWD, sock, (struct sockaddr *)(&sin),
                sizeof(struct sockaddr_in)) < 0) {
                err(1, "connect");
        }

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list