summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorJames Peach <jpeach@samba.org>2006-11-24 05:35:05 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:16:03 -0500
commit60936146d0b74315ff872da047a970fe87d0f1d3 (patch)
tree0a62fba407c3af1abfc58ac1da91385ba3a81f8a /source3/smbd
parent015534e254797eb114f1a3bc747b666d8bd65a2e (diff)
downloadsamba-60936146d0b74315ff872da047a970fe87d0f1d3.tar.gz
samba-60936146d0b74315ff872da047a970fe87d0f1d3.tar.bz2
samba-60936146d0b74315ff872da047a970fe87d0f1d3.zip
r19873: Make sure we are privileged when doing DMAPI operations on systems
that don't have capability support. Patch by J Raynor <raynorj@mn.rr.com>. (This used to be commit 53fe047f35534afc4b56fcbaf135a3ca13df65bd)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/dmapi.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/source3/smbd/dmapi.c b/source3/smbd/dmapi.c
index a9d83c782b..b42b7d51f0 100644
--- a/source3/smbd/dmapi.c
+++ b/source3/smbd/dmapi.c
@@ -240,6 +240,13 @@ uint32 dmapi_file_flags(const char * const path)
}
}
+ /* AIX has DMAPI but no POSIX capablities support. In this case,
+ * we need to be root to do DMAPI manipulations.
+ */
+#ifndef HAVE_POSIX_CAPABILITIES
+ become_root();
+#endif
+
err = dm_path_to_handle(CONST_DISCARD(char *, path),
&dm_handle, &dm_handle_len);
if (err < 0) {
@@ -247,7 +254,7 @@ uint32 dmapi_file_flags(const char * const path)
path, strerror(errno)));
if (errno != EPERM) {
- return 0;
+ goto done;
}
/* Linux capabilities are broken in that changing our
@@ -265,7 +272,7 @@ uint32 dmapi_file_flags(const char * const path)
DEBUG(DMAPI_TRACE,
("retrying dm_path_to_handle(%s): %s\n",
path, strerror(errno)));
- return 0;
+ goto done;
}
}
@@ -275,7 +282,7 @@ uint32 dmapi_file_flags(const char * const path)
DEBUG(DMAPI_TRACE, ("dm_get_eventlist(%s): %s\n",
path, strerror(errno)));
dm_handle_free(dm_handle, dm_handle_len);
- return 0;
+ goto done;
}
/* We figure that the only reason a DMAPI application would be
@@ -294,6 +301,12 @@ uint32 dmapi_file_flags(const char * const path)
DEBUG(DMAPI_TRACE, ("%s is OFFLINE\n", path));
}
+done:
+
+#ifndef HAVE_POSIX_CAPABILITIES
+ unbecome_root();
+#endif
+
return flags;
}