svn commit: samba r14457 - branches/SAMBA_3_0/source/groupdb branches/SAMBA_3_0/source/passdb trunk/source/groupdb trunk/source/passdb

jerry at samba.org jerry at samba.org
Wed Mar 15 17:40:29 GMT 2006


Author: jerry
Date: 2006-03-15 17:40:28 +0000 (Wed, 15 Mar 2006)
New Revision: 14457

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

Log:
Add a few more special cases for RID 513 in the samr code.
Now that I know what all the requirements for this group are
I can generalize the code some more and make it cleaner.
But at least this is working with lusrmgr.msc on XP and 2k now.


Modified:
   branches/SAMBA_3_0/source/groupdb/mapping.c
   branches/SAMBA_3_0/source/passdb/passdb.c
   branches/SAMBA_3_0/source/passdb/pdb_interface.c
   trunk/source/groupdb/mapping.c
   trunk/source/passdb/passdb.c
   trunk/source/passdb/pdb_interface.c


Changeset:
Modified: branches/SAMBA_3_0/source/groupdb/mapping.c
===================================================================
--- branches/SAMBA_3_0/source/groupdb/mapping.c	2006-03-15 17:28:46 UTC (rev 14456)
+++ branches/SAMBA_3_0/source/groupdb/mapping.c	2006-03-15 17:40:28 UTC (rev 14457)
@@ -814,8 +814,24 @@
 	ret = pdb_getgrsid(map, sid);
 	unbecome_root();
 	
-	if ( !ret ) 
+	/* special case check for rid 513 */
+	
+	if ( !ret ) {
+		uint32 rid;
+		
+		sid_peek_rid( &sid, &rid );
+		
+		if ( rid == DOMAIN_GROUP_RID_USERS ) {
+			fstrcpy( map->nt_name, "None" );
+			fstrcpy( map->comment, "Ordinary Users" );
+			sid_copy( &map->sid, &sid );
+			map->sid_name_use = SID_NAME_DOM_GRP;
+			
+			return True;
+		}
+		
 		return False;
+	}
 
 	DEBUG(10, ("get_domain_group_from_sid: SID found in the TDB\n"));
 

Modified: branches/SAMBA_3_0/source/passdb/passdb.c
===================================================================
--- branches/SAMBA_3_0/source/passdb/passdb.c	2006-03-15 17:28:46 UTC (rev 14456)
+++ branches/SAMBA_3_0/source/passdb/passdb.c	2006-03-15 17:40:28 UTC (rev 14457)
@@ -548,6 +548,18 @@
 {
 	GROUP_MAP map;
 	BOOL ret;
+	
+	/* Windows treats "MACHINE\None" as a special name for 
+	   rid 513 on non-DCs.  You cannot create a user or group
+	   name "None" on Windows.  You will get an error that 
+	   the group already exists. */
+	   
+	if ( strequal( user, "None" ) ) {
+		*rid = DOMAIN_GROUP_RID_USERS;
+		*type = SID_NAME_DOM_GRP;
+		
+		return True;
+	}
 
 	/* LOOKUP_NAME_GROUP is a hack to allow valid users = @foo to work
 	 * correctly in the case where foo also exists as a user. If the flag

Modified: branches/SAMBA_3_0/source/passdb/pdb_interface.c
===================================================================
--- branches/SAMBA_3_0/source/passdb/pdb_interface.c	2006-03-15 17:28:46 UTC (rev 14456)
+++ branches/SAMBA_3_0/source/passdb/pdb_interface.c	2006-03-15 17:40:28 UTC (rev 14457)
@@ -734,13 +734,31 @@
 				size_t *p_num_members)
 {
 	struct pdb_methods *pdb = pdb_get_methods();
+	NTSTATUS result;
 
 	if ( !pdb ) {
 		return NT_STATUS_UNSUCCESSFUL;
 	}
 
-	return pdb->enum_group_members(pdb, mem_ctx, sid, 
-						   pp_member_rids, p_num_members);
+	result = pdb->enum_group_members(pdb, mem_ctx, 
+			sid, pp_member_rids, p_num_members);
+		
+	/* special check for rid 513 */
+		
+	if ( !NT_STATUS_IS_OK( result ) ) {
+		uint32 rid;
+		
+		sid_peek_rid( sid, &rid );
+		
+		if ( rid == DOMAIN_GROUP_RID_USERS ) {
+			*p_num_members = 0;
+			*pp_member_rids = NULL;
+			
+			return NT_STATUS_OK;
+		}
+	}
+	
+	return result;
 }
 
 NTSTATUS pdb_enum_group_memberships(TALLOC_CTX *mem_ctx, struct samu *user,

Modified: trunk/source/groupdb/mapping.c
===================================================================
--- trunk/source/groupdb/mapping.c	2006-03-15 17:28:46 UTC (rev 14456)
+++ trunk/source/groupdb/mapping.c	2006-03-15 17:40:28 UTC (rev 14457)
@@ -814,8 +814,24 @@
 	ret = pdb_getgrsid(map, sid);
 	unbecome_root();
 	
-	if ( !ret ) 
+	/* special case check for rid 513 */
+	
+	if ( !ret ) {
+		uint32 rid;
+		
+		sid_peek_rid( &sid, &rid );
+		
+		if ( rid == DOMAIN_GROUP_RID_USERS ) {
+			fstrcpy( map->nt_name, "None" );
+			fstrcpy( map->comment, "Ordinary Users" );
+			sid_copy( &map->sid, &sid );
+			map->sid_name_use = SID_NAME_DOM_GRP;
+			
+			return True;
+		}
+		
 		return False;
+	}
 
 	DEBUG(10, ("get_domain_group_from_sid: SID found in the TDB\n"));
 

Modified: trunk/source/passdb/passdb.c
===================================================================
--- trunk/source/passdb/passdb.c	2006-03-15 17:28:46 UTC (rev 14456)
+++ trunk/source/passdb/passdb.c	2006-03-15 17:40:28 UTC (rev 14457)
@@ -548,6 +548,18 @@
 {
 	GROUP_MAP map;
 	BOOL ret;
+	
+	/* Windows treats "MACHINE\None" as a special name for 
+	   rid 513 on non-DCs.  You cannot create a user or group
+	   name "None" on Windows.  You will get an error that 
+	   the group already exists. */
+	   
+	if ( strequal( user, "None" ) ) {
+		*rid = DOMAIN_GROUP_RID_USERS;
+		*type = SID_NAME_DOM_GRP;
+		
+		return True;
+	}
 
 	/* LOOKUP_NAME_GROUP is a hack to allow valid users = @foo to work
 	 * correctly in the case where foo also exists as a user. If the flag

Modified: trunk/source/passdb/pdb_interface.c
===================================================================
--- trunk/source/passdb/pdb_interface.c	2006-03-15 17:28:46 UTC (rev 14456)
+++ trunk/source/passdb/pdb_interface.c	2006-03-15 17:40:28 UTC (rev 14457)
@@ -734,13 +734,31 @@
 				size_t *p_num_members)
 {
 	struct pdb_methods *pdb = pdb_get_methods();
+	NTSTATUS result;
 
 	if ( !pdb ) {
 		return NT_STATUS_UNSUCCESSFUL;
 	}
 
-	return pdb->enum_group_members(pdb, mem_ctx, sid, 
-						   pp_member_rids, p_num_members);
+	result = pdb->enum_group_members(pdb, mem_ctx, 
+			sid, pp_member_rids, p_num_members);
+		
+	/* special check for rid 513 */
+		
+	if ( !NT_STATUS_IS_OK( result ) ) {
+		uint32 rid;
+		
+		sid_peek_rid( sid, &rid );
+		
+		if ( rid == DOMAIN_GROUP_RID_USERS ) {
+			*p_num_members = 0;
+			*pp_member_rids = NULL;
+			
+			return NT_STATUS_OK;
+		}
+	}
+	
+	return result;
 }
 
 NTSTATUS pdb_enum_group_memberships(TALLOC_CTX *mem_ctx, struct samu *user,



More information about the samba-cvs mailing list