]> rtime.felk.cvut.cz Git - frescor/forb.git/commitdiff
proto_unix: Set socket permission rw-rw-rw
authorMichal Sojka <sojkam1@fel.cvut.cz>
Sun, 10 May 2009 11:09:55 +0000 (13:09 +0200)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Sun, 10 May 2009 11:09:55 +0000 (13:09 +0200)
This allows processes of different users to communicates each with the
other.

src/proto_unix.c

index d8b386dfd9044fc7852aa2accf8b98c7a9f98954..edf8fbb9b36b3b1963a9cabe830646a54d42753f 100644 (file)
@@ -51,6 +51,7 @@
 #include <sys/socket.h>
 #include <sys/types.h>
 #include <sys/un.h>
+#include <sys/stat.h>
 
 /**
  * @file   proto_unix.c
@@ -212,6 +213,7 @@ forb_unix_port_init(struct forb_port_desc *port_desc, const forb_server_id *serv
        unix_server_to_addr(&pd->addr, server);
        /* unlink(pd->addr.sun_path); */ /* TODO: What to do when the socket already exist? */
        ret = bind(pd->socket, (struct sockaddr*)&pd->addr, sizeof(pd->addr));
+       chmod(pd->addr.sun_path, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH);
        if (ret == -1) goto err;
 
        port_desc->proto = &proto_unix;