Fixed a domain functionality problem where NT clients would start
[samba.git] / source3 / passdb / sampassdb.c
index 13b1279b2b78f3d3e429c0e14a5a75d978b96c2f..25be7b9ec5bae1105e0b90e605825d2b12d49fcb 100644 (file)
@@ -290,12 +290,13 @@ void pwdb_init_sam(struct sam_passwd *user)
 {
        if (user == NULL) return;
        bzero(user, sizeof(*user));
 {
        if (user == NULL) return;
        bzero(user, sizeof(*user));
-       unix_to_nt_time(&user->logon_time            , (time_t)-1);
-       unix_to_nt_time(&user->logoff_time           , (time_t)-1);
-       unix_to_nt_time(&user->kickoff_time          , (time_t)-1);
-       unix_to_nt_time(&user->pass_last_set_time    , (time_t)-1);
-       unix_to_nt_time(&user->pass_can_change_time  , (time_t)-1);
-       unix_to_nt_time(&user->pass_must_change_time , (time_t)-1);
+
+       init_nt_time(&user->logon_time);
+       init_nt_time(&user->logoff_time);
+       init_nt_time(&user->kickoff_time);
+       init_nt_time(&user->pass_last_set_time);
+       init_nt_time(&user->pass_can_change_time);
+       init_nt_time(&user->pass_must_change_time);
 
        user->unix_uid = (uid_t)-1;
        user->unix_gid = (gid_t)-1;
 
        user->unix_uid = (uid_t)-1;
        user->unix_gid = (gid_t)-1;
@@ -374,7 +375,12 @@ struct sam_passwd *pwdb_smb_to_sam(struct smb_passwd *user)
        pw_buf.smb_passwd         = user->smb_passwd;
        pw_buf.smb_nt_passwd      = user->smb_nt_passwd;
        pw_buf.acct_ctrl          = user->acct_ctrl;
        pw_buf.smb_passwd         = user->smb_passwd;
        pw_buf.smb_nt_passwd      = user->smb_nt_passwd;
        pw_buf.acct_ctrl          = user->acct_ctrl;
-       unix_to_nt_time(&pw_buf.pass_last_set_time, user->pass_last_set_time);
+
+        if ( user->pass_last_set_time != (time_t)-1 )
+        {
+               unix_to_nt_time(&pw_buf.pass_last_set_time, user->pass_last_set_time);
+               unix_to_nt_time(&pw_buf.pass_can_change_time, user->pass_last_set_time);
+       }
 
        return &pw_buf;
 }
 
        return &pw_buf;
 }