[PATCH] Various Netlogon stuff

Andrew Bartlett abartlet at pcug.org.au
Mon Apr 9 12:33:38 GMT 2001


The attached patch (not particularly tested, but it compiles) is part of
the result from the manual code inspection I did on the weekend.

It fixes some of the indentation that made me have to look twice,
changes some of the 0x0s for the way cool constant
'NT_STATUS_NOPROBLEMO'.  It also makes samba use the information it
already has for filling in the User info, ie from the getsam functions.

Andrew Bartlett
-- 
Andrew Bartlett
abartlet at pcug.org.au
-------------- next part --------------
Index: source/passdb/smbpass.c
===================================================================
RCS file: /cvsroot/samba/source/passdb/Attic/smbpass.c,v
retrieving revision 1.102.4.4
diff -u -d -r1.102.4.4 smbpass.c
--- source/passdb/smbpass.c	2001/03/27 00:05:25	1.102.4.4
+++ source/passdb/smbpass.c	2001/04/09 12:01:25
@@ -472,6 +526,14 @@
 		user.group_rid = pdb_gid_to_group_rid(user.smb_grpid );
 
 		pstrcpy(full_name    , pwfile->pw_gecos        );
+
+		if (lp_unix_realname())
+		{
+		  fstrcpy(full_name, strtok(full_name, ","));
+		} else {
+		  fstrcpy(full_name, "<Full Name>");
+		}
+
 		pstrcpy(logon_script , lp_logon_script       ());
 		pstrcpy(profile_path , lp_logon_path         ());
 		pstrcpy(home_drive   , lp_logon_drive        ());
Index: source/rpc_server/srv_netlog_nt.c
===================================================================
RCS file: /cvsroot/samba/source/rpc_server/srv_netlog_nt.c,v
retrieving revision 1.1.2.6
diff -u -d -r1.1.2.6 srv_netlog_nt.c
--- source/rpc_server/srv_netlog_nt.c	2001/04/07 05:05:23	1.1.2.6
+++ source/rpc_server/srv_netlog_nt.c	2001/04/09 12:01:25
@@ -421,7 +499,7 @@
 		if(smb_password_check((char *)id2->nt_chal_resp.buffer,
 		                   smb_pass->smb_nt_passwd,
                            id2->lm_chal)) 
-			return 0x0;
+			return NT_STATUS_NOPROBLEMO;
 		else
 			return NT_STATUS_WRONG_PASSWORD;
 	}
@@ -439,10 +517,9 @@
 		                   smb_pass->smb_passwd,
 		                   id2->lm_chal))
 	{
-		return 0x0;
+		return NT_STATUS_NOPROBLEMO;
 	}
 
-
 	/* oops! neither password check succeeded */
 
 	return NT_STATUS_WRONG_PASSWORD;
@@ -561,16 +634,11 @@
 		DOM_GID *gids = NULL;
 		int num_gids = 0;
 		NTTIME dummy_time;
-		pstring logon_script;
-		pstring profile_path;
-		pstring home_dir;
-		pstring home_drive;
 		pstring my_name;
 		pstring my_workgroup;
 		pstring domain_groups;
 		uint32 r_uid;
 		uint32 r_gid;
-		fstring full_name;
 	
 		/* set up pointer indicating user/password failed to be found */
 		usr_info->ptr_user_info = 0;
@@ -578,35 +646,9 @@
 		dummy_time.low  = 0xffffffff;
 		dummy_time.high = 0x7fffffff;
         
-		/* XXXX hack to get standard_sub_basic() to use sam logon username */
-		/* possibly a better way would be to do a become_user() call */
-		sam_logon_in_ssb = True;
-		pstrcpy(samlogon_user, nt_username);
-
-		pstrcpy(logon_script, sam_pass->logon_script);
-		standard_sub_advanced(-1, nt_username, "", pw->pw_gid, logon_script);
-	
-		pstrcpy(profile_path, sam_pass->profile_path);
-		standard_sub_advanced(-1, nt_username, "", pw->pw_gid, profile_path);
-        
-		pstrcpy(my_workgroup, lp_workgroup());
-        
-		pstrcpy(home_drive, sam_pass->dir_drive);
-		standard_sub_advanced(-1, nt_username, "", pw->pw_gid, home_drive);
-
-		pstrcpy(home_dir, sam_pass->home_dir);
-		standard_sub_advanced(-1, nt_username, "", pw->pw_gid, home_dir);
-        
 		pstrcpy(my_name, global_myname);
 		strupper(my_name);
 
-		pstrcpy(full_name, sam_pass->full_name );
-		if( !*full_name ) {
-			fstrcpy(full_name, "<Full Name>");
-			if (lp_unix_realname())
-				fstrcpy(full_name, strtok(pw->pw_gecos, ","));
-		}
-        
 		/*
 		 * This is the point at which we get the group
 		 * database - we should be getting the gid_t list
@@ -635,11 +677,11 @@
 								&dummy_time, /* pass_must_change_time */
                                 
 								nt_username , /* user_name */
-								full_name,	/* full_name */
-								logon_script    , /* logon_script */
-								profile_path    , /* profile_path */
-								home_dir        , /* home_dir */
-								home_drive      , /* dir_drive */
+								sam_pass->full_name,	/* full_name */
+								sam_pass->logon_script    , /* logon_script */
+								sam_pass->profile_path    , /* profile_path */
+								sam_pass->home_dir        , /* home_dir */
+								sam_pass->dir_drive      , /* dir_drive */
                                 
 								0, /* logon_count */
 								0, /* bad_pw_count */
@@ -664,3 +706,8 @@
 
     return status;
 }
+
+
+
+
+
Index: source/rpc_server/srv_samr_nt.c
===================================================================
RCS file: /cvsroot/samba/source/rpc_server/srv_samr_nt.c,v
retrieving revision 1.1.2.29
diff -u -d -r1.1.2.29 srv_samr_nt.c
--- source/rpc_server/srv_samr_nt.c	2001/03/23 02:05:22	1.1.2.29
+++ source/rpc_server/srv_samr_nt.c	2001/04/09 12:01:28
@@ -1382,7 +1382,7 @@
     if (sam_pass == NULL)
         return NT_STATUS_NO_SUCH_USER;
 
-	samr_clear_sam_passwd(sam_pass);
+    samr_clear_sam_passwd(sam_pass);
 
     /* Get the domain SID stored in the domain policy */
     if(!get_lsa_policy_samr_sid(p, &domain_pol, &sid))
@@ -1672,7 +1672,7 @@
     if (sam_pass == NULL)
         return NT_STATUS_NO_SUCH_USER;
 
-	samr_clear_sam_passwd(sam_pass);
+    samr_clear_sam_passwd(sam_pass);
 
     get_domain_user_groups(groups, sam_pass->smb_name);
     gids = NULL;







More information about the samba-technical mailing list