svn commit: samba r19194 - in branches/tmp/vl-messaging/source/lib:
.
ab at samba.org
ab at samba.org
Mon Oct 9 08:39:13 GMT 2006
Author: ab
Date: 2006-10-09 08:39:13 +0000 (Mon, 09 Oct 2006)
New Revision: 19194
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=19194
Log:
Next step in lockd. Remove unneeded privileges
Modified:
branches/tmp/vl-messaging/source/lib/messages_stream.c
Changeset:
Modified: branches/tmp/vl-messaging/source/lib/messages_stream.c
===================================================================
--- branches/tmp/vl-messaging/source/lib/messages_stream.c 2006-10-09 08:32:51 UTC (rev 19193)
+++ branches/tmp/vl-messaging/source/lib/messages_stream.c 2006-10-09 08:39:13 UTC (rev 19194)
@@ -1076,15 +1076,14 @@
if (fd < 0) {
DEBUG(0, ("Can't create unix stream socket\n"));
- exit(1);
+ goto finish;
}
#ifdef CLUSTER_SUPPORT
tcp_fd = open_remote_listener();
if (tcp_fd < 0) {
DEBUG(0, ("Can't create tcp socket\n"));
- close(fd);
- exit(1);
+ goto finish;
}
#endif /* CLUSTER_SUPPORT */
@@ -1104,15 +1103,41 @@
is_lockd = True;
#endif /* CLUSTER_SUPPORT */
+ if(!is_lockd) {
+
+ /* messaging daemon could be run without root permissions
+ but lockd still needs root (e.g. for access to locks_dir) */
+
+ struct passwd *pass;
+
+ pass = getpwnam_alloc(NULL, GUEST_ACCOUNT);
+ if (pass == NULL) {
+ DEBUG(0, ("Can't obtain %s account information\n",
+ GUEST_ACCOUNT));
+ goto finish;
+ }
+
+ DEBUG(10, ("Changing effective uid to %s (%d)\n", GUEST_ACCOUNT, pass->pw_uid));
+ set_effective_uid(pass->pw_uid);
+
+ TALLOC_FREE(pass);
+ }
+
while (parent_pipe >= 0) {
dispatch_loop(&parent_pipe, fd, tcp_fd, is_lockd, &lockd_pid);
}
+finish:
+ if(parent_pipe >= 0) {
+ close(parent_pipe);
+ parent_pipe = -1;
+ }
+
shutdown_stream_sockets();
-
- close(fd);
+
+ if(fd >= 0) close(fd);
#ifdef CLUSTER_SUPPORT
- close(tcp_fd);
+ if(tcp_fd >= 0) close(tcp_fd);
#endif
/*
More information about the samba-cvs
mailing list