The branch, master has been updated via 5c4772e Re-add umask(0) code removed by commit 3a7c2777ee0de37d758fe81d67d6836a8354825e via fcc43cf Fix xx_path() - return check from mkdir() is incorrect. from d924da9 docs/vfs_catia: rework man page
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 5c4772ec1d562a4547391e1dd4956c43e3d635a7 Author: Jeremy Allison <j...@samba.org> Date: Mon Jun 17 17:02:56 2013 -0700 Re-add umask(0) code removed by commit 3a7c2777ee0de37d758fe81d67d6836a8354825e Without the umask code the pipe permissions are affected by the umask of the calling process. As only smbd currently sets its umask to zero (nmbd and winbindd should do the same) this causes the winbindd pipe to be unavailable to the nss library code unless winbindd is run from an init process that explicitly sets umask to zero. When testing from the command line this can be hard to track down :-). Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ira Cooper <i...@samba.org> Autobuild-User(master): Jeremy Allison <j...@samba.org> Autobuild-Date(master): Tue Jun 18 04:31:27 CEST 2013 on sn-devel-104 commit fcc43cfbe34f3e8039c5e1364fc327f3d7b88b12 Author: Jeremy Allison <j...@samba.org> Date: Mon Jun 17 16:16:31 2013 -0700 Fix xx_path() - return check from mkdir() is incorrect. This is very old code, but mkdir() fails with -1, not 0. Only print the error message is mkdir failed with anything other than EEXIST. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ira Cooper <i...@samba.org> ----------------------------------------------------------------------- Summary of changes: source3/lib/util.c | 11 ++++++++--- source3/lib/util_sock.c | 9 +++++++-- 2 files changed, 15 insertions(+), 5 deletions(-) Changeset truncated at 500 lines: diff --git a/source3/lib/util.c b/source3/lib/util.c index d21c730..93aab3c 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -1517,9 +1517,14 @@ static char *xx_path(const char *name, const char *rootpath) trim_string(fname,"","/"); if (!directory_exist(fname)) { - if (!mkdir(fname,0755)) - DEBUG(1, ("Unable to create directory %s for file %s. " - "Error was %s\n", fname, name, strerror(errno))); + if (mkdir(fname,0755) == -1) { + /* Did someone else win the race ? */ + if (errno != EEXIST) { + DEBUG(1, ("Unable to create directory %s for file %s. " + "Error was %s\n", fname, name, strerror(errno))); + return NULL; + } + } } return talloc_asprintf_append(fname, "/%s", name); diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c index eb38055..54286b3 100644 --- a/source3/lib/util_sock.c +++ b/source3/lib/util_sock.c @@ -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 -- Samba Shared Repository