mirror of
https://github.com/samba-team/samba.git
synced 2024-12-24 21:34:56 +03:00
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 commit is contained in:
parent
a85ae6e0ae
commit
ee8546342d
@ -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 */
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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 */
|
||||
|
@ -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);
|
||||
|
@ -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 */
|
||||
|
@ -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, "<Full Name>\0");
|
||||
fstrcpy(vuser->user.real_name, "<Full 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;
|
||||
|
@ -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? */
|
||||
|
@ -140,7 +140,7 @@ static BOOL check_user_ok(connection_struct *conn, user_struct *vuser,int snum)
|
||||
for (i=0;i<conn->uid_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;
|
||||
|
Loading…
Reference in New Issue
Block a user