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 <jra@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Jun 18 04:31:27 CEST 2013 on sn-devel-104
#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 */
SAFE_FREE(path);
+ umask(old_umask);
return sock;
out_close:
if (sock != -1)
close(sock);
+ umask(old_umask);
return -1;
#else