From c6d209f8342d56adc52a6c8ab99a4a2e17d409b2 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 29 Apr 2008 13:43:10 +0200 Subject: Remove the unix token info from "struct user_struct" (This used to be commit aa2299d42adf4d27e707ac755e07be70d0af1bb4) --- source3/include/smb.h | 7 ------- source3/smbd/lanman.c | 10 ++++++---- source3/smbd/password.c | 26 ++++---------------------- source3/smbd/service.c | 4 ++-- source3/smbd/session.c | 4 ++-- source3/smbd/uid.c | 10 +++++----- 6 files changed, 19 insertions(+), 42 deletions(-) (limited to 'source3') diff --git a/source3/include/smb.h b/source3/include/smb.h index bad5857520..c3f8fbddce 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -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. diff --git a/source3/smbd/lanman.c b/source3/smbd/lanman.c index 39d49334e0..7ba4b64477 100644 --- a/source3/smbd/lanman.c +++ b/source3/smbd/lanman.c @@ -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); diff --git a/source3/smbd/password.c b/source3/smbd/password.c index 2636438d5d..c5c0245444 100644 --- a/source3/smbd/password.c +++ b/source3/smbd/password.c @@ -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++; diff --git a/source3/smbd/service.c b/source3/smbd/service.c index a286e561c7..43f8699e29 100644 --- a/source3/smbd/service.c +++ b/source3/smbd/service.c @@ -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; diff --git a/source3/smbd/session.c b/source3/smbd/session.c index 000b2f5d9c..adfc4e300f 100644 --- a/source3/smbd/session.c +++ b/source3/smbd/session.c @@ -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))); diff --git a/source3/smbd/uid.c b/source3/smbd/uid.c index 866f954436..0b87b93636 100644 --- a/source3/smbd/uid.c +++ b/source3/smbd/uid.c @@ -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 " -- cgit