svn commit: samba r12888 - in trunk/source/utils: .

jerry at samba.org jerry at samba.org
Fri Jan 13 03:06:46 GMT 2006


Author: jerry
Date: 2006-01-13 03:06:46 +0000 (Fri, 13 Jan 2006)
New Revision: 12888

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

Log:
checking in some work on the sharesec tool for generating an initial machine SID
Modified:
   trunk/source/utils/sharesec.c


Changeset:
Modified: trunk/source/utils/sharesec.c
===================================================================
--- trunk/source/utils/sharesec.c	2006-01-13 02:59:08 UTC (rev 12887)
+++ trunk/source/utils/sharesec.c	2006-01-13 03:06:46 UTC (rev 12888)
@@ -271,6 +271,7 @@
 	int snum;
 	poptContext pc;
 	TALLOC_CTX *ctx;
+	BOOL initialize_sid = False;
 	struct poptOption long_options[] = {
 		POPT_AUTOHELP
 #if 0
@@ -279,7 +280,8 @@
 		{ "add", 'a', POPT_ARG_STRING, NULL, 'a', "Add an ACE", "ACL" },
 #endif
 		{ "replace", 'R', POPT_ARG_STRING, NULL, 'R', "Set share mission ACL", "ACLS" },
-		{ "view", 'v', POPT_ARG_NONE, NULL, 'v', "View current share permissions", "ACLS" },
+		{ "view", 'v', POPT_ARG_NONE, NULL, 'v', "View current share permissions" },
+		{ "machine-sid", 'M', POPT_ARG_NONE, NULL, 'M', "Initialize the machine SID" },
 		{ "force", 'F', POPT_ARG_NONE, NULL, 'F', "Force storing the ACL", "ACLS" },
 		POPT_COMMON_SAMBA
 		{ NULL }
@@ -336,8 +338,26 @@
 		case 'F':
 			force_acl = True;
 			break;
+			
+		case 'M':
+			initialize_sid = True;
+			break;
 		}
 	}
+	
+	/* check for initializing secrets.tdb first */
+	
+	if ( initialize_sid ) {
+		DOM_SID *sid = get_global_sam_sid();
+		
+		if ( !sid ) {
+			fprintf( stderr, "Failed to retrieve Machine SID!\n");
+			return 3;
+		}
+		
+		printf ("%s\n", sid_string_static( sid ) );
+		return 0;
+	}
 
 	if ( mode == SMB_ACL_VIEW && force_acl ) {
 		fprintf( stderr, "Invalid combination of -F and -v\n");



More information about the samba-cvs mailing list