svn commit: samba r19874 - in branches/SAMBA_3_0_24/source/smbd: .

jpeach at samba.org jpeach at samba.org
Fri Nov 24 07:10:01 GMT 2006


Author: jpeach
Date: 2006-11-24 07:10:01 +0000 (Fri, 24 Nov 2006)
New Revision: 19874

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=19874

Log:
merge -r19872:19873 svn+ssh://svn.samba.org/data/svn/samba/branches/SAMBA_3_0

Make sure we are privileged when doing DMAPI operations on systems
that don't have capability support. Patch by J Raynor <raynorj at mn.rr.com>.

Modified:
   branches/SAMBA_3_0_24/source/smbd/dmapi.c


Changeset:
Modified: branches/SAMBA_3_0_24/source/smbd/dmapi.c
===================================================================
--- branches/SAMBA_3_0_24/source/smbd/dmapi.c	2006-11-24 05:35:05 UTC (rev 19873)
+++ branches/SAMBA_3_0_24/source/smbd/dmapi.c	2006-11-24 07:10:01 UTC (rev 19874)
@@ -240,6 +240,13 @@
 		}
 	}
 
+	/* 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 @@
 			    path, strerror(errno)));
 
 		if (errno != EPERM) {
-			return 0;
+			goto done;
 		}
 
 		/* Linux capabilities are broken in that changing our
@@ -265,7 +272,7 @@
 			DEBUG(DMAPI_TRACE,
 			    ("retrying dm_path_to_handle(%s): %s\n",
 			    path, strerror(errno)));
-			return 0;
+			goto done;
 		}
 	}
 
@@ -275,7 +282,7 @@
 		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 @@
 		DEBUG(DMAPI_TRACE, ("%s is OFFLINE\n", path));
 	}
 
+done:
+
+#ifndef HAVE_POSIX_CAPABILITIES
+	unbecome_root();
+#endif
+
 	return flags;
 }
 



More information about the samba-cvs mailing list