lib/util: move memcache.[ch] to the toplevel 'samba-util' library
[samba.git] / source3 / lib / util_sock.c
index 8f212e5d851efc7412f076d3d595626ff96b6292..22ba764d13c7c9b153be1b1e83e3d300f9226be2 100644 (file)
@@ -21,7 +21,7 @@
 
 #include "includes.h"
 #include "system/filesys.h"
-#include "memcache.h"
+#include "../lib/util/memcache.h"
 #include "../lib/async_req/async_sock.h"
 #include "../lib/util/select.h"
 #include "lib/socket/interfaces.h"
@@ -586,7 +586,7 @@ struct tevent_req *open_socket_out_send(TALLOC_CTX *mem_ctx,
 
        subreq = async_connect_send(state, state->ev, state->fd,
                                    (struct sockaddr *)&state->ss,
-                                   state->salen);
+                                   state->salen, NULL, NULL, NULL);
        if ((subreq == NULL)
            || !tevent_req_set_endtime(
                    subreq, state->ev,
@@ -638,7 +638,7 @@ static void open_socket_out_connected(struct tevent_req *subreq)
 
                subreq = async_connect_send(state, state->ev, state->fd,
                                            (struct sockaddr *)&state->ss,
-                                           state->salen);
+                                           state->salen, NULL, NULL, NULL);
                if (tevent_req_nomem(subreq, req)) {
                        return;
                }
@@ -1237,14 +1237,17 @@ int create_pipe_sock(const char *socket_dir,
 #ifdef HAVE_UNIXSOCKET
        struct sockaddr_un sunaddr;
        bool ok;
-       int sock;
+       int sock = -1;
+       mode_t old_umask;
        char *path = NULL;
 
+       old_umask = umask(0);
+
        ok = directory_create_or_exist_strict(socket_dir,
                                              sec_initial_uid(),
                                              dir_perms);
        if (!ok) {
-               return -1;
+               goto out_close;
        }
 
        /* Create the socket file */
@@ -1273,6 +1276,7 @@ int create_pipe_sock(const char *socket_dir,
 
        SAFE_FREE(path);
 
+       umask(old_umask);
        return sock;
 
 out_close:
@@ -1280,6 +1284,7 @@ out_close:
        if (sock != -1)
                close(sock);
 
+       umask(old_umask);
        return -1;
 
 #else