1
0
mirror of https://github.com/samba-team/samba.git synced 2025-07-23 20:59:10 +03:00

Remove the unix token info from "struct user_struct"

This commit is contained in:
Volker Lendecke
2008-04-29 13:43:10 +02:00
parent 51d5d512f2
commit aa2299d42a
6 changed files with 19 additions and 42 deletions

View File

@ -1777,18 +1777,11 @@ struct pending_auth_data {
typedef struct user_struct {
struct user_struct *next, *prev;
uint16 vuid; /* Tag for this entry. */
uid_t uid; /* uid of a validated user */
gid_t gid; /* gid of a validated user */
userdom_struct user;
bool guest;
/* following groups stuff added by ih */
/* This groups info is needed for when we become_user() for this uid */
int n_groups;
gid_t *groups;
DATA_BLOB session_key;
char *session_keystr; /* used by utmp and pam session code.

View File

@ -3338,8 +3338,9 @@ static bool api_RNetUserGetInfo(connection_struct *conn, uint16 vuid,
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->user.unix_name));
DEBUG(3,(" Username of UID %d is %s\n",
(int)vuser->server_info->uid,
vuser->user.unix_name));
}
if (!str1 || !str2 || !UserName || !p) {
@ -3589,8 +3590,9 @@ static bool api_WWkstaUserLogon(connection_struct *conn,uint16 vuid,
}
if(vuser != NULL) {
DEBUG(3,(" Username of UID %d is %s\n", (int)vuser->uid,
vuser->user.unix_name));
DEBUG(3,(" Username of UID %d is %s\n",
(int)vuser->server_info->uid,
vuser->user.unix_name));
}
uLevel = get_safe_SVAL(param,tpscnt,p,0,-1);

View File

@ -269,24 +269,6 @@ int register_existing_vuid(uint16 vuid,
talloc_steal(vuser, vuser->server_info);
/* the next functions should be done by a SID mapping system (SMS) as
* the new real sam db won't have reference to unix uids or gids
*/
vuser->uid = server_info->uid;
vuser->gid = server_info->gid;
vuser->n_groups = server_info->n_groups;
if (vuser->n_groups) {
if (!(vuser->groups = (gid_t *)talloc_memdup(vuser,
server_info->groups,
sizeof(gid_t)*vuser->n_groups))) {
DEBUG(0,("register_existing_vuid: "
"failed to talloc_memdup vuser->groups\n"));
goto fail;
}
}
vuser->guest = server_info->guest;
fstrcpy(vuser->user.unix_name, server_info->unix_name);
@ -301,8 +283,8 @@ int register_existing_vuid(uint16 vuid,
vuser->session_key = session_key;
DEBUG(10,("register_existing_vuid: (%u,%u) %s %s %s guest=%d\n",
(unsigned int)vuser->uid,
(unsigned int)vuser->gid,
(unsigned int)vuser->server_info->uid,
(unsigned int)vuser->server_info->gid,
vuser->user.unix_name, vuser->user.smb_name,
vuser->user.domain, vuser->guest ));
@ -317,8 +299,8 @@ int register_existing_vuid(uint16 vuid,
}
DEBUG(3,("register_existing_vuid: UNIX uid %d is UNIX user %s, "
"and will be vuid %u\n",
(int)vuser->uid,vuser->user.unix_name, vuser->vuid));
"and will be vuid %u\n", (int)vuser->server_info->uid,
vuser->user.unix_name, vuser->vuid));
next_vuid++;
num_validated_vuids++;

View File

@ -736,8 +736,8 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser,
}
}
conn->vuid = vuser->vuid;
conn->uid = vuser->uid;
conn->gid = vuser->gid;
conn->uid = vuser->server_info->uid;
conn->gid = vuser->server_info->gid;
string_set(&conn->user,vuser->user.unix_name);
fstrcpy(user,vuser->user.unix_name);
guest = vuser->guest;

View File

@ -168,8 +168,8 @@ bool session_claim(user_struct *vuser)
fstrcpy(sessionid.hostname, hostname);
sessionid.id_num = i; /* Only valid for utmp sessions */
sessionid.pid = pid;
sessionid.uid = vuser->uid;
sessionid.gid = vuser->gid;
sessionid.uid = vuser->server_info->uid;
sessionid.gid = vuser->server_info->gid;
fstrcpy(sessionid.remote_machine, get_remote_machine_name());
fstrcpy(sessionid.ip_addr_str,
client_addr(get_client_fd(),addr,sizeof(addr)));

View File

@ -177,7 +177,7 @@ bool change_to_user(connection_struct *conn, uint16 vuid)
return(True);
} else if ((current_user.conn == conn) &&
(vuser != 0) && (current_user.vuid == vuid) &&
(current_user.ut.uid == vuser->uid)) {
(current_user.ut.uid == vuser->server_info->uid)) {
DEBUG(4,("change_to_user: Skipping user change - already "
"user\n"));
return(True);
@ -200,10 +200,10 @@ bool change_to_user(connection_struct *conn, uint16 vuid)
num_groups = conn->ngroups;
token = conn->nt_user_token;
} else if (vuser) {
uid = conn->admin_user ? 0 : vuser->uid;
gid = vuser->gid;
num_groups = vuser->n_groups;
group_list = vuser->groups;
uid = conn->admin_user ? 0 : vuser->server_info->uid;
gid = vuser->server_info->gid;
num_groups = vuser->server_info->n_groups;
group_list = vuser->server_info->groups;
token = vuser->server_info->ptok;
} else {
DEBUG(2,("change_to_user: Invalid vuid used %d in accessing "