[PATCH] better handling of copy_id2X...

Stefan (metze) Metzmacher metze at metzemix.de
Wed Sep 25 13:53:00 GMT 2002


Hi Andrew,

here're the copy_id2X patches.

copy_id21-02.diff from the last patch

then copy_id2X-06.diff  remove warnings.

it should fix this problem (it's not perfect but it handles it MUCH better 
now!):

the current code of copy_id2* is bad!:
if you use usrmgr.exe and watch the properties of a user and click 'ok' 
after it samba
overwrites all times (pass must change, lastchange ...)
and do some other stupid things.




metze
-----------------------------------------------------------------------------
Stefan "metze" Metzmacher <metze at metzemix.de>
-------------- next part --------------
diff -Npur --exclude=CVS --exclude=*.bak --exclude=*.o --exclude=*.po --exclude=.#* HEAD/source/lib/time.c HEAD-fix/source/lib/time.c
--- HEAD/source/lib/time.c	Sat Aug 31 15:36:28 2002
+++ HEAD-fix/source/lib/time.c	Sat Aug 31 15:47:25 2002
@@ -1,8 +1,8 @@
 /* 
    Unix SMB/CIFS implementation.
    time handling functions
-   Copyright (C) Andrew Tridgell 1992-1998
-   
+   Copyright (C) Andrew Tridgell 		1992-1998
+   Copyright (C) Stefan (metze) Metzmacher	2002   
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
@@ -748,3 +748,13 @@ void init_nt_time(NTTIME *nt)
 	nt->high = 0x7FFFFFFF;
 	nt->low = 0xFFFFFFFF;
 }
+
+/****************************************************************************
+check if NTTIME is 0
+****************************************************************************/
+BOOL nt_time_is_zero(NTTIME *nt)
+{
+	if(nt->high==0) 
+		return True;
+	return False;
+}
diff -Npur --exclude=CVS --exclude=*.bak --exclude=*.o --exclude=*.po --exclude=.#* HEAD/source/rpc_server/srv_samr_util.c HEAD-fix/source/rpc_server/srv_samr_util.c
--- HEAD/source/rpc_server/srv_samr_util.c	Wed Jul  3 09:37:54 2002
+++ HEAD-fix/source/rpc_server/srv_samr_util.c	Wed Sep 25 15:43:47 2002
@@ -1,10 +1,11 @@
 /* 
    Unix SMB/CIFS implementation.
    SAMR Pipe utility functions.
-   Copyright (C) Jeremy Allison 		1996-2001
+   
    Copyright (C) Luke Kenneth Casson Leighton 	1996-1998
    Copyright (C) Gerald (Jerry) Carter		2000-2001
    Copyright (C) Andrew Bartlett		2001-2002
+   Copyright (C) Stefan (metze) Metzmacher	2002
       
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -32,55 +33,185 @@
 
 void copy_id23_to_sam_passwd(SAM_ACCOUNT *to, SAM_USER_INFO_23 *from)
 {
+	time_t unix_time;
 
 	if (from == NULL || to == NULL) 
 		return;
-
-	pdb_set_logon_time(to,nt_time_to_unix(&from->logon_time), True);
-	pdb_set_logoff_time(to,nt_time_to_unix(&from->logoff_time), True);
-	pdb_set_kickoff_time(to, nt_time_to_unix(&from->kickoff_time), True);
-	pdb_set_pass_can_change_time(to, nt_time_to_unix(&from->pass_can_change_time), True);
-	pdb_set_pass_must_change_time(to, nt_time_to_unix(&from->pass_must_change_time), True);
-
-	pdb_set_pass_last_set_time(to, nt_time_to_unix(&from->pass_last_set_time));
-
-	if (from->uni_user_name.buffer)
+	if (!nt_time_is_zero(&from->logon_time)) {
+		unix_time=nt_time_to_unix(&from->logon_time);
+		DEBUG(10,("INFO_23 LOGON_TIME: %lu -> %lu\n",(long unsigned int)pdb_get_logon_time(to), (long unsigned int)unix_time));
+		pdb_set_logon_time(to, unix_time, True);
+	}	
+	if (!nt_time_is_zero(&from->logoff_time)) {
+		unix_time=nt_time_to_unix(&from->logoff_time);
+		DEBUG(10,("INFO_23 LOGOFF_TIME: %lu -> %lu\n",(long unsigned int)pdb_get_logoff_time(to), (long unsigned int)unix_time));
+		pdb_set_logoff_time(to, unix_time, True);
+	}
+	
+	if (!nt_time_is_zero(&from->kickoff_time)) {
+		unix_time=nt_time_to_unix(&from->kickoff_time);
+		DEBUG(10,("INFO_23 KICKOFF_TIME: %lu -> %lu\n",(long unsigned int)pdb_get_kickoff_time(to), (long unsigned int)unix_time));
+		pdb_set_kickoff_time(to, unix_time , True);
+	}	
+#if 0
+	/* doesn't work here, 
+	   usrmgr.exe doesn't send it!
+	   --metze*/
+	else  {
+		DEBUG(10,("INFO_23 KICKOFF_TIME: %lu -> %lu\n",(long unsigned int)pdb_get_kickoff_time(to),(long unsigned int)get_time_t_max()));
+		pdb_set_kickoff_time(to, get_time_t_max() , True);
+	}
+#endif
+
+	if (!nt_time_is_zero(&from->pass_can_change_time)) {
+		unix_time=nt_time_to_unix(&from->pass_can_change_time);
+		DEBUG(10,("INFO_23 PASS_CAN_CH: %lu -> %lu\n",(long unsigned int)pdb_get_pass_can_change_time(to), (long unsigned int)unix_time));
+		pdb_set_pass_can_change_time(to, unix_time, True);
+	}
+	if (!nt_time_is_zero(&from->pass_last_set_time)) {
+		unix_time=nt_time_to_unix(&from->pass_last_set_time);
+		DEBUG(10,("INFO_23 PASS_LAST_SET: %lu -> %lu\n",(long unsigned int)pdb_get_pass_last_set_time(to), (long unsigned int)unix_time));
+		pdb_set_pass_last_set_time(to, unix_time);
+	}
+
+	/* I'm not sure about pass_must_change_time,
+	   because there's no differenz when the 
+	   MustChangePassword at next Logon is checked or not:
+	   nt_time_to_unix == 0 in any case :-( metze
+	*/   		
+	/* In INFO_23 the passwd is changed by the admin:
+	   -> we rely on the value catched from usrmgr.exe
+	*/   
+	
+	unix_time=nt_time_to_unix(&from->pass_must_change_time);
+	DEBUG(10,("INFO_23 PASS_MUST_CH: %lu -> %lu\n",(long unsigned int)pdb_get_pass_must_change_time(to), (long unsigned int)unix_time));
+	pdb_set_pass_must_change_time(to, unix_time, True);
+	
+	/* TODO: check if the new user name doesn't exist */ 
+	if (from->uni_user_name.buffer) {
+		DEBUG(10,("INFO_23 UNI_USER_NAME: %s -> %s\n",pdb_get_username(to),pdb_unistr2_convert(&from->uni_user_name)));
 		pdb_set_username(to      , pdb_unistr2_convert(&from->uni_user_name   ));
-	if (from->uni_full_name.buffer)
+	}
+
+	/* TODO: updating the empty string should be handle by the pdb backend 
+	*/
+	if (from->uni_full_name.buffer) {
+		DEBUG(10,("INFO_23 UNI_FULL_NAME: %s -> %s\n",pdb_get_fullname(to),pdb_unistr2_convert(&from->uni_user_name)));
 		pdb_set_fullname(to      , pdb_unistr2_convert(&from->uni_full_name   ));
-	if (from->uni_home_dir.buffer)
+	} else{ 
+		DEBUG(10,("INFO_23 UNI_FULL_NAME: %s -> %s\n",pdb_get_fullname(to),""));
+		pdb_set_fullname(to       , "");   
+	}
+	
+	if (from->uni_home_dir.buffer) {
+		DEBUG(10,("INFO_23 UNI_HOME_DIR: %s -> %s\n",pdb_get_homedir(to),pdb_unistr2_convert(&from->uni_home_dir)));
 		pdb_set_homedir(to       , pdb_unistr2_convert(&from->uni_home_dir    ), True);
-	if (from->uni_dir_drive.buffer)
+	} else{ 
+		DEBUG(10,("INFO_23 UNI_HOME_DIR: %s -> %s\n",pdb_get_homedir(to),""));
+		pdb_set_homedir(to       , "", True);   
+	}
+
+	if (from->uni_dir_drive.buffer) {
+		DEBUG(10,("INFO_23 UNI_DIR_DRIVE: %s -> %s\n",pdb_get_dir_drive(to),pdb_unistr2_convert(&from->uni_dir_drive)));
 		pdb_set_dir_drive(to     , pdb_unistr2_convert(&from->uni_dir_drive   ), True);
-	if (from->uni_logon_script.buffer)
+	} else {
+		DEBUG(10,("INFO_23 UNI_DIR_DRIVE: %s -> %s\n",pdb_get_dir_drive(to),""));
+		pdb_set_dir_drive(to       , "", True);   
+	}
+
+	if (from->uni_logon_script.buffer) {
+		DEBUG(10,("INFO_23 UNI_LOGON_SCRIPT: %s -> %s\n",pdb_get_logon_script(to),pdb_unistr2_convert(&from->uni_logon_script)));
 		pdb_set_logon_script(to  , pdb_unistr2_convert(&from->uni_logon_script), True);
-	if (from->uni_profile_path.buffer)
+	} else {
+		DEBUG(10,("INFO_23 UNI_LOGON_SCRIPT: %s -> %s\n",pdb_get_logon_script(to),""));
+		pdb_set_logon_script(to       , "", True);   
+	}
+
+	if (from->uni_profile_path.buffer) {
+		DEBUG(10,("INFO_23 UNI_PROFILE_PATH: %s -> %s\n",pdb_get_profile_path(to),pdb_unistr2_convert(&from->uni_profile_path)));
 		pdb_set_profile_path(to  , pdb_unistr2_convert(&from->uni_profile_path), True);
-	if (from->uni_acct_desc.buffer)
+	} else {
+		DEBUG(10,("INFO_23 UNI_PROFILE_PATH: %s -> %s\n",pdb_get_profile_path(to),""));
+		pdb_set_profile_path(to       , "", True);   
+	}
+	
+	if (from->uni_acct_desc.buffer) {
+		DEBUG(10,("INFO_23 UNI_ACCT_DESC: %s -> %s\n",pdb_get_acct_desc(to),pdb_unistr2_convert(&from->uni_acct_desc)));
 		pdb_set_acct_desc(to     , pdb_unistr2_convert(&from->uni_acct_desc   ));
-	if (from->uni_workstations.buffer)
+	} else {
+		DEBUG(10,("INFO_23 UNI_ACCT_DESC: %s -> %s\n",pdb_get_acct_desc(to),""));
+		pdb_set_acct_desc(to       , "");   
+	}
+	
+	if (from->uni_workstations.buffer) {
+		DEBUG(10,("INFO_23 UNI_WORKSTATIONS: %s -> %s\n",pdb_get_workstations(to),pdb_unistr2_convert(&from->uni_workstations)));
 		pdb_set_workstations(to  , pdb_unistr2_convert(&from->uni_workstations));
-	if (from->uni_unknown_str.buffer)
+	} else {
+		DEBUG(10,("INFO_23 UNI_WORKSTATIONS: %s -> %s\n",pdb_get_workstations(to),""));
+		pdb_set_workstations(to       , "");   
+	}
+
+	if (from->uni_unknown_str.buffer) {
+		DEBUG(10,("INFO_23 UNI_UNKNOWN_STR: %s -> %s\n",pdb_get_unknown_str(to),pdb_unistr2_convert(&from->uni_unknown_str)));
 		pdb_set_unknown_str(to   , pdb_unistr2_convert(&from->uni_unknown_str ));
-	if (from->uni_munged_dial.buffer)
+	} else {
+		DEBUG(10,("INFO_23 UNI_UNKNOWN_STR: %s -> %s\n",pdb_get_unknown_str(to),""));
+		pdb_set_unknown_str(to       , "");   
+	}
+	
+	if (from->uni_munged_dial.buffer) {
+		DEBUG(10,("INFO_23 UNI_MUNGED_DIAL: %s -> %s\n",pdb_get_munged_dial(to),pdb_unistr2_convert(&from->uni_munged_dial)));
 		pdb_set_munged_dial(to   , pdb_unistr2_convert(&from->uni_munged_dial ));
-
-	if (from->user_rid)
-		pdb_set_user_sid_from_rid(to, from->user_rid);
-	if (from->group_rid)
+	} else {
+		DEBUG(10,("INFO_23 UNI_MUNGED_DIAL: %s -> %s\n",pdb_get_munged_dial(to),""));
+		pdb_set_munged_dial(to       , "");   
+	}
+	
+	if (from->user_rid) {
+		DEBUG(10,("INFO_23 USER_RID: %u -> %u NOT UPDATED!\n",pdb_get_user_rid(to),from->user_rid));
+		/* we really allow this ??? metze */
+		/* pdb_set_user_sid_from_rid(to, from->user_rid);*/
+	}
+	
+	if (from->group_rid) {
+		DEBUG(10,("INFO_23 GROUP_RID: %u -> %u\n",pdb_get_group_rid(to),from->group_rid));
 		pdb_set_group_sid_from_rid(to, from->group_rid);
-
+	}
+	
+	DEBUG(10,("INFO_23 ACCT_CTRL: %08X -> %08X\n",pdb_get_acct_ctrl(to),from->acb_info));
 	pdb_set_acct_ctrl(to, from->acb_info);
+
+	DEBUG(10,("INFO_23 UNKOWN_3: %08X -> %08X\n",pdb_get_unknown3(to),from->unknown_3));
 	pdb_set_unknown_3(to, from->unknown_3);
+	
 
+	DEBUG(15,("INFO_23 LOGON_DIVS: %08X -> %08X\n",pdb_get_logon_divs(to),from->logon_divs));
 	pdb_set_logon_divs(to, from->logon_divs);
+
+	DEBUG(15,("INFO_23 LOGON_HRS.LEN: %08X -> %08X\n",pdb_get_hours_len(to),from->logon_hrs.len));
 	pdb_set_hours_len(to, from->logon_hrs.len);
+	DEBUG(15,("INFO_23 LOGON_HRS.HOURS: %s -> %s\n",pdb_get_hours(to),from->logon_hrs.hours));
 	pdb_set_hours(to, from->logon_hrs.hours);
 
+	DEBUG(10,("INFO_23 UNKOWN_5: %08X -> %08X\n",pdb_get_unknown5(to),from->unknown_5));
 	pdb_set_unknown_5(to, from->unknown_5);
+
+	DEBUG(10,("INFO_23 UNKOWN_6: %08X -> %08X\n",pdb_get_unknown6(to),from->unknown_6));
 	pdb_set_unknown_6(to, from->unknown_6);
-}
 
+#if 0
+	DEBUG(10,("INFO_23 PADDING1 %02X %02X %02X %02X %02X %02X %02X %02X\n",
+		from->padding1[0],
+		from->padding1[1],
+		from->padding1[2],
+		from->padding1[3],
+		from->padding1[4],
+		from->padding1[5],
+		from->padding1[6],
+		from->padding1[7]));
+	DEBUG(10,("INFO_23 PADDING_4: %08X\n",from->padding4));
+#endif
+}
 
 /*************************************************************
  Copies a sam passwd.
@@ -88,56 +219,187 @@ void copy_id23_to_sam_passwd(SAM_ACCOUNT
 
 void copy_id21_to_sam_passwd(SAM_ACCOUNT *to, SAM_USER_INFO_21 *from)
 {
+	time_t unix_time;
+
 	if (from == NULL || to == NULL) 
 		return;
 
-	pdb_set_logon_time(to,nt_time_to_unix(&from->logon_time), True);
-	pdb_set_logoff_time(to,nt_time_to_unix(&from->logoff_time), True);
-	pdb_set_kickoff_time(to, nt_time_to_unix(&from->kickoff_time), True);
-	pdb_set_pass_can_change_time(to, nt_time_to_unix(&from->pass_can_change_time), True);
-	pdb_set_pass_must_change_time(to, nt_time_to_unix(&from->pass_must_change_time), True);
-
-	pdb_set_pass_last_set_time(to, nt_time_to_unix(&from->pass_last_set_time));
-
-	if (from->uni_user_name.buffer)
+	if (!nt_time_is_zero(&from->logon_time)) {
+		unix_time=nt_time_to_unix(&from->logon_time);
+		DEBUG(10,("INFO_21 LOGON_TIME: %lu -> %lu\n",(long unsigned int)pdb_get_logon_time(to), (long unsigned int)unix_time));
+		pdb_set_logon_time(to, unix_time, True);
+	}	
+	if (!nt_time_is_zero(&from->logoff_time)) {
+		unix_time=nt_time_to_unix(&from->logoff_time);
+		DEBUG(10,("INFO_21 LOGOFF_TIME: %lu -> %lu\n",(long unsigned int)pdb_get_logoff_time(to), (long unsigned int)unix_time));
+		pdb_set_logoff_time(to, unix_time, True);
+	}
+	if (!nt_time_is_zero(&from->kickoff_time)) {
+		unix_time=nt_time_to_unix(&from->kickoff_time);
+		DEBUG(10,("INFO_21 KICKOFF_TIME: %lu -> %lu\n",(long unsigned int)pdb_get_kickoff_time(to), (long unsigned int)unix_time));
+		pdb_set_kickoff_time(to,unix_time , True);
+	} else {
+		DEBUG(10,("INFO_21 KICKOFF_TIME: %lu -> %lu\n",(long unsigned int)pdb_get_kickoff_time(to), (long unsigned int)get_time_t_max()));
+		pdb_set_kickoff_time(to, get_time_t_max() , True);
+	}
+
+	if (!nt_time_is_zero(&from->pass_can_change_time)) {
+		unix_time=nt_time_to_unix(&from->pass_can_change_time);
+		DEBUG(10,("INFO_21 PASS_CAN_CH: %lu -> %lu\n",(long unsigned int)pdb_get_pass_can_change_time(to), (long unsigned int)unix_time));
+		pdb_set_pass_can_change_time(to, unix_time, True);
+	}
+
+	if (from->passmustchange==PASS_MUST_CHANGE_AT_NEXT_LOGON) {
+		DEBUG(10,("INFO_21 PASS_MUST_CHANGE_AT_NEXT_LOGON: %02X\n",from->passmustchange));
+		pdb_set_pass_must_change_time(to,0, True);		
+	} else if (from->passmustchange==PASS_DONT_CHANGE_AT_NEXT_LOGON && pdb_get_pass_must_change_time(to)==0) {
+		int expire;
+		account_policy_get(AP_MAX_PASSWORD_AGE,&expire);
+		if (expire==(uint32)-1) {
+			pdb_set_pass_must_change_time(to,get_time_t_max(),True);
+		} else {
+			pdb_set_pass_must_change_time(to,
+				pdb_get_pass_last_set_time(to)+expire,True);
+		}
+	}
+	
+	if (!nt_time_is_zero(&from->pass_must_change_time)) {
+		unix_time=nt_time_to_unix(&from->pass_must_change_time); 
+		DEBUG(10,("INFO_21 PASS_MUST_CH: %lu -> %lu\n",(long unsigned int)pdb_get_pass_must_change_time(to), (long unsigned int)unix_time));
+		pdb_set_pass_must_change_time(to, unix_time, True);
+	}
+	if (!nt_time_is_zero(&from->pass_last_set_time)) {
+		unix_time=nt_time_to_unix(&from->pass_last_set_time);
+		DEBUG(10,("INFO_21 PASS_LAST_SET: %lu -> %lu\n",(long unsigned int)pdb_get_pass_last_set_time(to), (long unsigned int)unix_time));
+		pdb_set_pass_last_set_time(to, unix_time);
+	}
+	/* TODO: check if the new user name doesn't exist */ 
+	if (from->uni_user_name.buffer) {
+		DEBUG(10,("INFO_21 UNI_USER_NAME: %s -> %s\n",pdb_get_username(to),pdb_unistr2_convert(&from->uni_user_name)));
 		pdb_set_username(to      , pdb_unistr2_convert(&from->uni_user_name   ));
-	if (from->uni_full_name.buffer)
+	}
+
+	/* TODO: updating the empty string should be handle by the pdb backend 
+	*/
+	if (from->uni_full_name.buffer) {
+		DEBUG(10,("INFO_21 UNI_FULL_NAME: %s -> %s\n",pdb_get_fullname(to),pdb_unistr2_convert(&from->uni_user_name)));
 		pdb_set_fullname(to      , pdb_unistr2_convert(&from->uni_full_name   ));
-	if (from->uni_home_dir.buffer)
+	} else{ 
+		DEBUG(10,("INFO_21 UNI_FULL_NAME: %s -> %s\n",pdb_get_fullname(to),""));
+		pdb_set_fullname(to       , "");   
+	}
+	
+	if (from->uni_home_dir.buffer) {
+		DEBUG(10,("INFO_21 UNI_HOME_DIR: %s -> %s\n",pdb_get_homedir(to),pdb_unistr2_convert(&from->uni_home_dir)));
 		pdb_set_homedir(to       , pdb_unistr2_convert(&from->uni_home_dir    ), True);
-	if (from->uni_dir_drive.buffer)
+	} else{ 
+		DEBUG(10,("INFO_21 UNI_HOME_DIR: %s -> %s\n",pdb_get_homedir(to),""));
+		pdb_set_homedir(to       , "", True);   
+	}
+
+	if (from->uni_dir_drive.buffer) {
+		DEBUG(10,("INFO_21 UNI_DIR_DRIVE: %s -> %s\n",pdb_get_dir_drive(to),pdb_unistr2_convert(&from->uni_dir_drive)));
 		pdb_set_dir_drive(to     , pdb_unistr2_convert(&from->uni_dir_drive   ), True);
-	if (from->uni_logon_script.buffer)
+	} else {
+		DEBUG(10,("INFO_21 UNI_DIR_DRIVE: %s -> %s\n",pdb_get_dir_drive(to),""));
+		pdb_set_dir_drive(to       , "", True);   
+	}
+
+	if (from->uni_logon_script.buffer) {
+		DEBUG(10,("INFO_21 UNI_LOGON_SCRIPT: %s -> %s\n",pdb_get_logon_script(to),pdb_unistr2_convert(&from->uni_logon_script)));
 		pdb_set_logon_script(to  , pdb_unistr2_convert(&from->uni_logon_script), True);
-	if (from->uni_profile_path.buffer)
+	} else {
+		DEBUG(10,("INFO_21 UNI_LOGON_SCRIPT: %s -> %s\n",pdb_get_logon_script(to),""));
+		pdb_set_logon_script(to       , "", True);   
+	}
+
+	if (from->uni_profile_path.buffer) {
+		DEBUG(10,("INFO_21 UNI_PROFILE_PATH: %s -> %s\n",pdb_get_profile_path(to),pdb_unistr2_convert(&from->uni_profile_path)));
 		pdb_set_profile_path(to  , pdb_unistr2_convert(&from->uni_profile_path), True);
-	if (from->uni_acct_desc.buffer)
+	} else {
+		DEBUG(10,("INFO_21 UNI_PROFILE_PATH: %s -> %s\n",pdb_get_profile_path(to),""));
+		pdb_set_profile_path(to       , "", True);   
+	}
+	
+	if (from->uni_acct_desc.buffer) {
+		DEBUG(10,("INFO_21 UNI_ACCT_DESC: %s -> %s\n",pdb_get_acct_desc(to),pdb_unistr2_convert(&from->uni_acct_desc)));
 		pdb_set_acct_desc(to     , pdb_unistr2_convert(&from->uni_acct_desc   ));
-	if (from->uni_workstations.buffer)
+	} else {
+		DEBUG(10,("INFO_21 UNI_ACCT_DESC: %s -> %s\n",pdb_get_acct_desc(to),""));
+		pdb_set_acct_desc(to       , "");   
+	}
+	
+	if (from->uni_workstations.buffer) {
+		DEBUG(10,("INFO_21 UNI_WORKSTATIONS: %s -> %s\n",pdb_get_workstations(to),pdb_unistr2_convert(&from->uni_workstations)));
 		pdb_set_workstations(to  , pdb_unistr2_convert(&from->uni_workstations));
-	if (from->uni_unknown_str.buffer)
+	} else {
+		DEBUG(10,("INFO_21 UNI_WORKSTATIONS: %s -> %s\n",pdb_get_workstations(to),""));
+		pdb_set_workstations(to       , "");   
+	}
+
+	if (from->uni_unknown_str.buffer) {
+		DEBUG(10,("INFO_21 UNI_UNKNOWN_STR: %s -> %s\n",pdb_get_unknown_str(to),pdb_unistr2_convert(&from->uni_unknown_str)));
 		pdb_set_unknown_str(to   , pdb_unistr2_convert(&from->uni_unknown_str ));
-	if (from->uni_munged_dial.buffer)
+	} else {
+		DEBUG(10,("INFO_21 UNI_UNKNOWN_STR: %s -> %s\n",pdb_get_unknown_str(to),""));
+		pdb_set_unknown_str(to       , "");   
+	}
+	
+	if (from->uni_munged_dial.buffer) {
+		DEBUG(10,("INFO_21 UNI_MUNGED_DIAL: %s -> %s\n",pdb_get_munged_dial(to),pdb_unistr2_convert(&from->uni_munged_dial)));
 		pdb_set_munged_dial(to   , pdb_unistr2_convert(&from->uni_munged_dial ));
-
-	if (from->user_rid)
-		pdb_set_user_sid_from_rid(to, from->user_rid);
-	if (from->group_rid)
+	} else {
+		DEBUG(10,("INFO_21 UNI_MUNGED_DIAL: %s -> %s\n",pdb_get_munged_dial(to),""));
+		pdb_set_munged_dial(to       , "\0");   
+	}
+	
+	if (from->user_rid) {
+		DEBUG(10,("INFO_21 USER_RID: %u -> %u NOT UPDATED!\n",pdb_get_user_rid(to),from->user_rid));
+		/* shouls we really allow this ??? metze */
+		/* pdb_set_user_sid_from_rid(to, from->user_rid);*/
+	}
+	
+	if (from->group_rid) {
+		DEBUG(10,("INFO_21 GROUP_RID: %u -> %u\n",pdb_get_group_rid(to),from->group_rid));
 		pdb_set_group_sid_from_rid(to, from->group_rid);
-
-	/* FIXME!!  Do we need to copy the passwords here as well?
-	   I don't know.  Need to figure this out   --jerry */
-
-	/* Passwords dealt with in caller --abartlet */
-
+	}
+	
+	DEBUG(10,("INFO_21 ACCT_CTRL: %08X -> %08X\n",pdb_get_acct_ctrl(to),from->acb_info));
 	pdb_set_acct_ctrl(to, from->acb_info);
+
+	DEBUG(10,("INFO_21 UNKOWN_3: %08X -> %08X\n",pdb_get_unknown3(to),from->unknown_3));
 	pdb_set_unknown_3(to, from->unknown_3);
+	
 
+	DEBUG(10,("INFO_21 LOGON_DIVS: %08X -> %08X\n",pdb_get_logon_divs(to),from->logon_divs));
 	pdb_set_logon_divs(to, from->logon_divs);
+
+	DEBUG(10,("INFO_21 LOGON_HRS.LEN: %08X -> %08X\n",pdb_get_hours_len(to),from->logon_hrs.len));
 	pdb_set_hours_len(to, from->logon_hrs.len);
+	DEBUG(10,("INFO_21 LOGON_HRS.HOURS: %s -> %s\n",pdb_get_hours(to),from->logon_hrs.hours));
 	pdb_set_hours(to, from->logon_hrs.hours);
 
+	DEBUG(10,("INFO_21 UNKOWN_5: %08X -> %08X\n",pdb_get_unknown5(to),from->unknown_5));
 	pdb_set_unknown_5(to, from->unknown_5);
+
+	DEBUG(10,("INFO_21 UNKOWN_6: %08X -> %08X\n",pdb_get_unknown6(to),from->unknown_6));
 	pdb_set_unknown_6(to, from->unknown_6);
-}
 
+	/* FIXME!!  Do we need to copy the passwords here as well?
+	   I don't know.  Need to figure this out   --jerry */
+
+	/* Passwords dealt with in caller --abartlet */
+#if 0
+	DEBUG(10,("INFO_21 PADDING1 %02X %02X %02X %02X %02X %02X\n",
+		from->padding1[0],
+		from->padding1[1],
+		from->padding1[2],
+		from->padding1[3],
+		from->padding1[4],
+		from->padding1[5]));
+
+	DEBUG(10,("INFO_21 PADDING_2: %02X\n",from->padding2));
+
+	DEBUG(10,("INFO_21 PADDING_4: %08X\n",from->padding4));
+#endif
+}


More information about the samba-technical mailing list