summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2011-05-08 10:28:03 +0200
committerAndrew Bartlett <abartlet@samba.org>2011-05-08 10:56:28 +0200
commitf946668b7ad1ecc1990fa8ee0499c63c4aac6ea6 (patch)
tree38a8000c9b323352444619101a27278a7b0e6798
parent8b2ba64d603dd1ef1afde621f594dc46f2133708 (diff)
downloadsamba-f946668b7ad1ecc1990fa8ee0499c63c4aac6ea6.tar.gz
samba-f946668b7ad1ecc1990fa8ee0499c63c4aac6ea6.tar.bz2
samba-f946668b7ad1ecc1990fa8ee0499c63c4aac6ea6.zip
Improve debug messages when creating socket directories
This makes clear what the permissions error and directory name actually is Andrew Bartlett
-rw-r--r--lib/util/util.c3
-rw-r--r--source3/lib/util_sock.c17
-rw-r--r--source4/smbd/service_named_pipe.c2
3 files changed, 15 insertions, 7 deletions
diff --git a/lib/util/util.c b/lib/util/util.c
index d4a936fae9..7f30d436e8 100644
--- a/lib/util/util.c
+++ b/lib/util/util.c
@@ -152,7 +152,8 @@ _PUBLIC_ bool directory_create_or_exist(const char *dname, uid_t uid,
}
if ((st.st_mode & 0777) != dir_perms) {
DEBUG(0, ("invalid permissions on directory "
- "%s\n", dname));
+ "'%s': has 0%o should be 0%o\n", dname,
+ (st.st_mode & 0777), dir_perms));
umask(old_umask);
return false;
}
diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c
index ca355c2709..922213d8f6 100644
--- a/source3/lib/util_sock.c
+++ b/source3/lib/util_sock.c
@@ -1166,14 +1166,21 @@ int create_pipe_sock(const char *socket_dir,
} else {
/* Check ownership and permission on existing directory */
if (!S_ISDIR(st.st_mode)) {
- DEBUG(0, ("socket directory %s isn't a directory\n",
+ DEBUG(0, ("socket directory '%s' isn't a directory\n",
socket_dir));
goto out_umask;
}
- if ((st.st_uid != sec_initial_uid()) ||
- ((st.st_mode & 0777) != dir_perms)) {
- DEBUG(0, ("invalid permissions on socket directory "
- "%s\n", socket_dir));
+ if (st.st_uid != sec_initial_uid()) {
+ DEBUG(0, ("invalid ownership on directory "
+ "'%s'\n", socket_dir));
+ umask(old_umask);
+ goto out_umask;
+ }
+ if ((st.st_mode & 0777) != dir_perms) {
+ DEBUG(0, ("invalid permissions on directory "
+ "'%s': has 0%o should be 0%o\n", socket_dir,
+ (st.st_mode & 0777), dir_perms));
+ umask(old_umask);
goto out_umask;
}
}
diff --git a/source4/smbd/service_named_pipe.c b/source4/smbd/service_named_pipe.c
index 086a037b69..fc221c1c7e 100644
--- a/source4/smbd/service_named_pipe.c
+++ b/source4/smbd/service_named_pipe.c
@@ -207,7 +207,7 @@ NTSTATUS tstream_setup_named_pipe(TALLOC_CTX *mem_ctx,
if (!directory_create_or_exist(dirname, geteuid(), 0700)) {
status = map_nt_error_from_unix(errno);
- DEBUG(0,(__location__ ": Failed to create stream pipe directory %s - %s\n",
+ DEBUG(0,(__location__ ": Failed to create stream pipe directory '%s' - %s\n",
dirname, nt_errstr(status)));
goto fail;
}