From: Andrew Tridgell Date: Tue, 2 May 2000 13:55:42 +0000 (+0000) Subject: split the username in the vuser structure into a separate X-Git-Tag: samba-4.0.0alpha6~801^2~19958 X-Git-Url: http://git.samba.org/samba.git/?a=commitdiff_plain;h=32d5416b6a777a7874fec8518ec44e750560d882;p=sfrench%2Fsamba-autobuild%2F.git split the username in the vuser structure into a separate userdom_struct. As the name implies this also contains a domain (unused at the moment). This will be important shortly, as operation in appliance mode needs the domain to be always carried with the username. (This used to be commit ee8546342d5be90e730372b985710d764564b124) --- diff --git a/source3/include/smb.h b/source3/include/smb.h index f61c8cbbadc..a03d7a0bcb9 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -603,14 +603,19 @@ struct dcinfo }; +typedef struct { + fstring smb_name; /* user name from the client */ + fstring unix_name; /* unix user name of a validated user */ + fstring real_name; /* to store real name from password file - simeon */ + fstring domain; /* domain that the client specified */ +} userdom_struct; + typedef struct { uid_t uid; /* uid of a validated user */ gid_t gid; /* gid of a validated user */ - fstring requested_name; /* user name from the client */ - fstring name; /* unix user name of a validated user */ - fstring real_name; /* to store real name from password file - simeon */ + userdom_struct user; BOOL guest; /* following groups stuff added by ih */ diff --git a/source3/lib/substitute.c b/source3/lib/substitute.c index 2a575f0c382..a23f613814e 100644 --- a/source3/lib/substitute.c +++ b/source3/lib/substitute.c @@ -280,7 +280,7 @@ void standard_sub_snum(int snum, char *str) ********************************************************************/ void standard_sub_vuser(char *str, user_struct *vuser) { - standard_sub_advanced(-1, vuser->name, "", -1, str); + standard_sub_advanced(-1, vuser->user.unix_name, "", -1, str); } /******************************************************************* @@ -288,6 +288,6 @@ void standard_sub_vuser(char *str, user_struct *vuser) ********************************************************************/ void standard_sub_vsnum(char *str, user_struct *vuser, int snum) { - standard_sub_advanced(snum, vuser->name, "", -1, str); + standard_sub_advanced(snum, vuser->user.unix_name, "", -1, str); } diff --git a/source3/locking/posix.c b/source3/locking/posix.c index 094cb87bc8f..ab58607172a 100644 --- a/source3/locking/posix.c +++ b/source3/locking/posix.c @@ -611,10 +611,10 @@ static BOOL posix_lock_in_range(SMB_OFF_T *offset_out, SMB_OFF_T *count_out, return True; } +#if defined(LARGE_SMB_OFF_T) /**************************************************************************** Pathetically try and map a 64 bit lock offset into 31 bits. I hate Windows :-). ****************************************************************************/ - static uint32 map_lock_offset(uint32 high, uint32 low) { unsigned int i; @@ -642,6 +642,7 @@ static uint32 map_lock_offset(uint32 high, uint32 low) return (high|low); } +#endif /**************************************************************************** Actual function that does POSIX locks. Copes with 64 -> 32 bit cruft and diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index ff19f34a0e9..1294eda45cd 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -995,7 +995,7 @@ static void init_globals(void) Globals.shmem_size = SHMEM_SIZE; Globals.stat_cache_size = 50; /* Number of stat translations we'll keep */ Globals.announce_as = ANNOUNCE_AS_NT_SERVER; - Globals.bUnixRealname = False; + Globals.bUnixRealname = True; #if (defined(HAVE_NETGROUP) && defined(WITH_AUTOMOUNT)) Globals.bNISHomeMap = False; #ifdef WITH_NISPLUS_HOME diff --git a/source3/rpc_server/srv_netlog.c b/source3/rpc_server/srv_netlog.c index a198b6b98a5..82573f7952f 100644 --- a/source3/rpc_server/srv_netlog.c +++ b/source3/rpc_server/srv_netlog.c @@ -808,7 +808,7 @@ static BOOL api_net_sam_logon(prs_struct *data, prs_struct *rdata) &dummy_time, /* pass_must_change_time */ nt_username , /* user_name */ - vuser->real_name, /* full_name */ + vuser->user.real_name, /* full_name */ logon_script , /* logon_script */ profile_path , /* profile_path */ home_dir , /* home_dir */ diff --git a/source3/rpc_server/srv_pipe_hnd.c b/source3/rpc_server/srv_pipe_hnd.c index 7110342383f..35fb0423a5e 100644 --- a/source3/rpc_server/srv_pipe_hnd.c +++ b/source3/rpc_server/srv_pipe_hnd.c @@ -120,8 +120,8 @@ static void attempt_remote_rpc_connect(pipes_struct *p) ZERO_STRUCT(usr); /* set up unix credentials from the smb side, to feed over the pipe */ - make_creds_unix(&usr.uxc, vuser->name, vuser->requested_name, - vuser->real_name, vuser->guest); + make_creds_unix(&usr.uxc, vuser->user.unix_name, vuser->user.smb_name, + vuser->user.real_name, vuser->guest); usr.ptr_uxc = 1; make_creds_unix_sec(&usr.uxs, vuser->uid, vuser->gid, vuser->n_groups, vuser->groups); diff --git a/source3/smbd/lanman.c b/source3/smbd/lanman.c index 9774305fc92..2ec08ddbf94 100644 --- a/source3/smbd/lanman.c +++ b/source3/smbd/lanman.c @@ -2285,7 +2285,8 @@ static BOOL api_RNetUserGetInfo(connection_struct *conn,uint16 vuid, char *param Don't depend on vuser being non-null !!. JRA */ user_struct *vuser = get_valid_user_struct(vuid); if(vuser != NULL) - DEBUG(3,(" Username of UID %d is %s\n", (int)vuser->uid, vuser->name)); + DEBUG(3,(" Username of UID %d is %s\n", (int)vuser->uid, + vuser->user.unix_name)); *rparam_len = 6; *rparam = REALLOC(*rparam,*rparam_len); @@ -2335,7 +2336,7 @@ static BOOL api_RNetUserGetInfo(connection_struct *conn,uint16 vuid, char *param /* EEK! the cifsrap.txt doesn't have this in!!!! */ SIVAL(p,usri11_full_name,PTR_DIFF(p2,p)); /* full name */ - pstrcpy(p2,((vuser != NULL) ? vuser->real_name : UserName)); + pstrcpy(p2,((vuser != NULL) ? vuser->user.real_name : UserName)); p2 = skip_string(p2,1); } @@ -2394,7 +2395,7 @@ static BOOL api_RNetUserGetInfo(connection_struct *conn,uint16 vuid, char *param { SIVAL(p,60,0); /* auth_flags */ SIVAL(p,64,PTR_DIFF(p2,*rdata)); /* full_name */ - pstrcpy(p2,((vuser != NULL) ? vuser->real_name : UserName)); + pstrcpy(p2,((vuser != NULL) ? vuser->user.real_name : UserName)); p2 = skip_string(p2,1); SIVAL(p,68,0); /* urs_comment */ SIVAL(p,72,PTR_DIFF(p2,*rdata)); /* parms */ diff --git a/source3/smbd/password.c b/source3/smbd/password.c index a8b9050030f..cff47c0a943 100644 --- a/source3/smbd/password.c +++ b/source3/smbd/password.c @@ -140,7 +140,7 @@ char *validated_username(uint16 vuid) user_struct *vuser = get_valid_user_struct(vuid); if (vuser == NULL) return 0; - return(vuser->name); + return(vuser->user.unix_name); } @@ -246,8 +246,8 @@ uint16 register_vuid(uid_t uid,gid_t gid, char *unix_name, char *requested_name, vuser->uid = uid; vuser->gid = gid; vuser->guest = guest; - fstrcpy(vuser->name,unix_name); - fstrcpy(vuser->requested_name,requested_name); + fstrcpy(vuser->user.unix_name,unix_name); + fstrcpy(vuser->user.smb_name,requested_name); vuser->n_groups = 0; vuser->groups = NULL; @@ -261,12 +261,12 @@ uint16 register_vuid(uid_t uid,gid_t gid, char *unix_name, char *requested_name, DEBUG(3,("uid %d registered to name %s\n",(int)uid,unix_name)); DEBUG(3, ("Clearing default real name\n")); - fstrcpy(vuser->real_name, "\0"); + fstrcpy(vuser->user.real_name, ""); if (lp_unix_realname()) { - if ((pwfile=sys_getpwnam(vuser->name))!= NULL) + if ((pwfile=sys_getpwnam(vuser->user.unix_name))!= NULL) { - DEBUG(3, ("User name: %s\tReal name: %s\n",vuser->name,pwfile->pw_gecos)); - fstrcpy(vuser->real_name, pwfile->pw_gecos); + DEBUG(3, ("User name: %s\tReal name: %s\n",vuser->user.unix_name,pwfile->pw_gecos)); + fstrcpy(vuser->user.real_name, pwfile->pw_gecos); } } @@ -707,9 +707,9 @@ BOOL authorise_login(int snum,char *user,char *password, int pwlen, /* check for a previously registered guest username */ if (!ok && (vuser != 0) && vuser->guest) { - if (user_ok(vuser->name,snum) && - password_ok(vuser->name, password, pwlen, NULL)) { - fstrcpy(user, vuser->name); + if (user_ok(vuser->user.unix_name,snum) && + password_ok(vuser->user.unix_name, password, pwlen, NULL)) { + fstrcpy(user, vuser->user.unix_name); vuser->guest = False; DEBUG(3,("ACCEPTED: given password with registered user %s\n", user)); ok = True; @@ -744,8 +744,8 @@ BOOL authorise_login(int snum,char *user,char *password, int pwlen, /* check for a previously validated username/password pair */ if (!ok && (!lp_revalidate(snum) || lp_security() > SEC_SHARE) && (vuser != 0) && !vuser->guest && - user_ok(vuser->name,snum)) { - fstrcpy(user,vuser->name); + user_ok(vuser->user.unix_name,snum)) { + fstrcpy(user,vuser->user.unix_name); *guest = False; DEBUG(3,("ACCEPTED: validated uid ok as non-guest\n")); ok = True; diff --git a/source3/smbd/process.c b/source3/smbd/process.c index 1eb58996678..6482ccd5389 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -495,7 +495,7 @@ static int switch_message(int type,char *inbuf,char *outbuf,int size,int bufsize if(session_tag != UID_FIELD_INVALID) vuser = get_valid_user_struct(session_tag); if(vuser != NULL) - pstrcpy( sesssetup_user, vuser->requested_name); + pstrcpy( sesssetup_user, vuser->user.smb_name); } /* does this protocol need to be run as root? */ diff --git a/source3/smbd/uid.c b/source3/smbd/uid.c index ce0631e418a..28d2fb71f60 100644 --- a/source3/smbd/uid.c +++ b/source3/smbd/uid.c @@ -140,7 +140,7 @@ static BOOL check_user_ok(connection_struct *conn, user_struct *vuser,int snum) for (i=0;iuid_cache.entries;i++) if (conn->uid_cache.list[i] == vuser->uid) return(True); - if (!user_ok(vuser->name,snum)) return(False); + if (!user_ok(vuser->user.unix_name,snum)) return(False); i = conn->uid_cache.entries % UID_CACHE_SIZE; conn->uid_cache.list[i] = vuser->uid;