[Samba] patch to fix silly bug in 3.0.0beta2

Gerald (Jerry) Carter jerry at samba.org
Thu Jul 3 04:07:58 GMT 2003


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

For those interested in trust relationships on Samba PDC's:

Here's a patch to fix a silly bug when running winbindd on a Samba PDC
and logging onto a windows client in the Samba domain as a trusted
user.  This fixes problems browing from one client or server to another in 
the domains.

I thought this was going to be harder to fix or else we would have delayed 
the beta2 release the 10 minutes it took to fix.



cheers, jerry
 ----------------------------------------------------------------------
 Hewlett-Packard            ------------------------- http://www.hp.com
 SAMBA Team                 ---------------------- http://www.samba.org
 GnuPG Key                  ---- http://www.plainjoe.org/gpg_public.asc
 "You can never go home again, Oatman, but I guess you can shop there."  
                            --John Cusack - "Grosse Point Blank" (1997)

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.0 (GNU/Linux)
Comment: For info see http://quantumlab.net/pine_privacy_guard/

iD4DBQE/A6wjIR7qMdg1EfYRAkK0AJ4zZ3jhD5oMGw6djxLctON65arHAQCYkozP
z/zFour43t+YFhwYLBU+Xw==
=/r5F
-----END PGP SIGNATURE-----
-------------- next part --------------
Index: rpc_parse/parse_net.c
===================================================================
RCS file: /data/cvs/samba/source/rpc_parse/parse_net.c,v
retrieving revision 1.85.2.11
diff -u -r1.85.2.11 parse_net.c
--- rpc_parse/parse_net.c	26 May 2003 06:59:38 -0000	1.85.2.11
+++ rpc_parse/parse_net.c	3 Jul 2003 03:49:09 -0000
@@ -1283,6 +1283,7 @@
 	/* need to count the number of space-delimited sids */
 	unsigned int i;
 	int num_other_sids = 0;
+	char *username;
 	
 	NTTIME 		logon_time, logoff_time, kickoff_time,
 			pass_last_set_time, pass_can_change_time,
@@ -1294,7 +1295,21 @@
 	int len_logon_srv    = strlen(logon_srv);
 	int len_logon_dom    = strlen(logon_dom);
 
-	len_user_name    = strlen(user_name   );
+
+	/* do some cleanup on the user name here to deal with users from a 
+	   trusted domain logging onto a client in our domain.  If we are running 
+	   winbindd, the trusted users will be of the form DOMAIN\user so strip 
+	   out the domain portion.  I noticed then when looking at an SMBsessionsetup&X.
+	   The client was sending GLASS\Administrator as the username and GLASS as the 
+	   domain name -- jerry */
+	   
+	if ( (username = strchr( user_name, *lp_winbind_separator() )) != NULL )
+		username++;
+	else
+		username = user_name;
+		
+		
+	len_user_name    = strlen(username    );
 	len_full_name    = strlen(full_name   );
 	len_home_dir     = strlen(home_dir    );
 	len_dir_drive    = strlen(dir_drive   );
@@ -1306,6 +1321,7 @@
 
 	usr->ptr_user_info = 1; /* yes, we're bothering to put USER_INFO data here */
 
+	
 
 	/* Create NTTIME structs */
 	unix_to_nt_time (&logon_time, 		 unix_logon_time);
@@ -1356,7 +1372,7 @@
 	usr->num_other_sids = num_other_sids;
 	usr->buffer_other_sids = (num_other_sids != 0) ? 1 : 0; 
 	
-	init_unistr2(&usr->uni_user_name, user_name, len_user_name);
+	init_unistr2(&usr->uni_user_name, username, len_user_name);
 	init_unistr2(&usr->uni_full_name, full_name, len_full_name);
 	init_unistr2(&usr->uni_logon_script, logon_script, len_logon_script);
 	init_unistr2(&usr->uni_profile_path, profile_path, len_profile_path);


More information about the samba mailing list