Users unable to create file sockets as of 2.3.50

From: Chris Buchanan (cbuchana@navtechinc.com)
Date: Sun Mar 12 2000 - 16:21:15 EST


The following code, when run as a non-root user, stopped working as
of 2.3.50 (at least for me).

#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>

int main(void) {
    struct sockaddr_un sock_struct = {AF_UNIX, "/tmp/blah.socket"};
    int sd;

    if ((sd = socket(PF_UNIX, SOCK_STREAM, 0)) == -1) {
                printf ("Failed to create socket\n");
                return -1;
    }

    unlink (sock_struct.sun_path);
    if (bind(sd, &sock_struct, SUN_LEN(&sock_struct))) {
                printf ("Failed to bind to socket\n");
                return -1;
    }

    printf ("All successful\n");
    unlink (sock_struct.sun_path);

    return 0;
}

-- 
Chris Buchanan
Intermediate Software Developer
Navtech Inc., Waterloo, Ontario, Canada

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Mar 15 2000 - 21:00:22 EST