pwdb_smb_to_sam was not returning NULL for nt name so that
authorLuke Leighton <lkcl@samba.org>
Tue, 9 Feb 1999 16:01:28 +0000 (16:01 +0000)
committerLuke Leighton <lkcl@samba.org>
Tue, 9 Feb 1999 16:01:28 +0000 (16:01 +0000)
pwdb_sam_map_names() was using a "blank" static string instead of
a NULL pointer for nt names.  NULL means over-ride, so the nt name
got left as "blank".

this causes nt clients to terminate with extreme prejudice.
(This used to be commit ddd350198202d6a1d2c715b3dce7db3a5d76a63a)

source3/passdb/sampassdb.c
source3/rpc_server/srv_netlog.c

index 25be7b9ec5bae1105e0b90e605825d2b12d49fcb..45fc07daf80cd03cd8de2df4dd4c23bf9f439976 100644 (file)
@@ -337,10 +337,16 @@ struct smb_passwd *pwdb_sam_to_smb(struct sam_passwd *user)
 
        pwdb_init_smb(&pw_buf);
 
-       fstrcpy(nt_name  , user->nt_name);
-       fstrcpy(unix_name, user->unix_name);
-       pw_buf.nt_name            = nt_name;
-       pw_buf.unix_name          = unix_name;
+       if (user->nt_name != NULL)
+       {
+               fstrcpy(nt_name  , user->nt_name);
+               pw_buf.nt_name = nt_name;
+       }
+       if (user->unix_name != NULL)
+       {
+               fstrcpy(unix_name, user->unix_name);
+               pw_buf.unix_name = unix_name;
+       }
        pw_buf.unix_uid           = user->unix_uid;
        pw_buf.user_rid           = user->user_rid;
        pw_buf.smb_passwd         = user->smb_passwd;
@@ -366,10 +372,16 @@ struct sam_passwd *pwdb_smb_to_sam(struct smb_passwd *user)
 
        pwdb_init_sam(&pw_buf);
 
-       fstrcpy(nt_name  , user->nt_name);
-       fstrcpy(unix_name, user->unix_name);
-       pw_buf.nt_name            = nt_name;
-       pw_buf.unix_name          = unix_name;
+       if (user->nt_name != NULL)
+       {
+               fstrcpy(nt_name  , user->nt_name);
+               pw_buf.nt_name = nt_name;
+       }
+       if (user->unix_name != NULL)
+       {
+               fstrcpy(unix_name, user->unix_name);
+               pw_buf.unix_name = unix_name;
+       }
        pw_buf.unix_uid           = user->unix_uid;
        pw_buf.user_rid           = user->user_rid;
        pw_buf.smb_passwd         = user->smb_passwd;
index c3810a09e589f57a36ad7d9e63a9f732399028eb..33eb889ff2ed6a0da4786550fd0f87e14c442277 100644 (file)
@@ -288,8 +288,7 @@ static void api_net_req_chal( uint16 vuid,
        /* grab the challenge... */
        net_io_q_req_chal("", &q_r, data, 0);
 
-       fstrcpy(mach_acct, unistrn2(q_r.uni_logon_clnt.buffer,
-                                   q_r.uni_logon_clnt.uni_str_len));
+       fstrcpy(mach_acct, unistr2_to_str(&q_r.uni_logon_clnt));
 
        fstrcpy(mach_name, mach_acct);
        strlower(mach_name);
@@ -400,8 +399,7 @@ static void api_net_srv_pwset( uint16 vuid,
 
                DEBUG(5,("api_net_srv_pwset: %d\n", __LINE__));
 
-               pstrcpy(mach_acct, unistrn2(q_a.clnt_id.login.uni_acct_name.buffer,
-                                           q_a.clnt_id.login.uni_acct_name.uni_str_len));
+               fstrcpy(mach_acct, unistr2_to_str(&q_a.clnt_id.login.uni_acct_name));
 
                DEBUG(3,("Server Password Set Wksta:[%s]\n", mach_acct));
 
@@ -609,6 +607,7 @@ static void api_net_sam_logon( uint16 vuid,
        NTTIME pass_can_change_time ;
        NTTIME pass_must_change_time;
 
+       fstring nt_name     ;
        fstring full_name   ;
        fstring logon_script;
        fstring profile_path;
@@ -705,6 +704,7 @@ static void api_net_sam_logon( uint16 vuid,
                pass_can_change_time  = sam_pass->pass_can_change_time;
                pass_must_change_time = sam_pass->pass_must_change_time;
 
+               fstrcpy(nt_name     , sam_pass->nt_name);
                fstrcpy(full_name   , sam_pass->full_name);
                fstrcpy(logon_script, sam_pass->logon_script);
                fstrcpy(profile_path, sam_pass->profile_path);
@@ -769,7 +769,7 @@ static void api_net_sam_logon( uint16 vuid,
                                &pass_can_change_time,
                                &pass_must_change_time,
 
-                               nt_username     , /* user_name */
+                               nt_name         , /* user_name */
                                full_name       , /* full_name */
                                logon_script    , /* logon_script */
                                profile_path    , /* profile_path */