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

jra at samba.org jra at samba.org
Mon Dec 19 04:44:18 GMT 2005


Author: jra
Date: 2005-12-19 04:44:17 +0000 (Mon, 19 Dec 2005)
New Revision: 12356

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

Log:
Make usershare info work.
Jeremy.

Modified:
   trunk/source/utils/net_usershare.c


Changeset:
Modified: trunk/source/utils/net_usershare.c
===================================================================
--- trunk/source/utils/net_usershare.c	2005-12-19 04:34:04 UTC (rev 12355)
+++ trunk/source/utils/net_usershare.c	2005-12-19 04:44:17 UTC (rev 12356)
@@ -259,8 +259,13 @@
 	pstring basepath;
 	pstring sharepath;
 	pstring comment;
+	pstring acl_str;
 	int num_aces;
+	char sep_str[2];
 
+	sep_str[0] = *lp_winbind_separator();
+	sep_str[1] = '\0';
+
 	get_basepath(basepath);
 	pstrcat(basepath, "/");
 	pstrcat(basepath, fl->pathname);
@@ -309,22 +314,46 @@
 		return -1;
 	}
 
+	pstrcpy(acl_str, "usershare_acl=");
+
 	for (num_aces = 0; num_aces < psd->dacl->num_aces; num_aces++) {
+		char access_str[2];
 		const char *domain;
 		const char *name;
 
+		access_str[1] = '\0';
+
 		if (net_lookup_name_from_sid(ctx, &psd->dacl->ace[num_aces].trustee, &domain, &name)) {
-			d_printf("domain = %s, name = %s\n", domain, name );
+			if (*domain) {
+				pstrcat(acl_str, domain);
+				pstrcat(acl_str, sep_str);
+			}
+			pstrcat(acl_str,name);
+		} else {
+			fstring sidstr;
+			sid_to_string(sidstr, &psd->dacl->ace[num_aces].trustee);
+			pstrcat(acl_str,sidstr);
 		}
+		pstrcat(acl_str, ":");
+
+		if (psd->dacl->ace[num_aces].type == SEC_ACE_TYPE_ACCESS_DENIED) {
+			pstrcat(acl_str, "D,");
+		} else {
+			if (psd->dacl->ace[num_aces].info.mask & GENERIC_ALL_ACCESS) {
+				pstrcat(acl_str, "F,");
+			} else {
+				pstrcat(acl_str, "R,");
+			}
+		}
 	}
 
+	acl_str[strlen(acl_str)-1] = '\0';
+
 	d_printf("[%s]\n", fl->pathname );
 	d_printf("path=%s\n", sharepath );
 	d_printf("comment=%s\n", comment);
+	d_printf("%s\n\n", acl_str);
 
-	/* TODO - sid to uid.... */
-	d_printf("usershare_acl=%s\n\n", &lines[3][14]);
-
 	return 0;
 }
 



More information about the samba-cvs mailing list