Fixed a domain functionality problem where NT clients would start
[samba.git] / source3 / passdb / sampassdb.c
index bcd2764abcf1961f7fe8a19a90656e8243a2cd91..25be7b9ec5bae1105e0b90e605825d2b12d49fcb 100644 (file)
@@ -290,12 +290,13 @@ void pwdb_init_sam(struct sam_passwd *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;
@@ -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;
-       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;
 }
@@ -511,6 +517,10 @@ you will get this warning only once (for all trust accounts)\n", unix_name));
 
        if (!sid_front_equal(&global_sam_sid, &gmep.sid))
        {
+               fstring sid_str;
+               sid_to_string(sid_str, &gmep.sid);
+               DEBUG(0,("UNIX User %s Primary Group is in the wrong domain! %s\n",
+                         sam->unix_name, sid_str));
                return NULL;
        }