From ca2580028744c8c9301487ffee87befdd94be383 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 7 May 2008 12:42:36 +0200 Subject: Simplify make_connection_snum: Copy connection_struct info from server_info (This used to be commit 5aa3cdf355c179d89c2703f528919194ab084337) --- source3/smbd/service.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'source3') diff --git a/source3/smbd/service.c b/source3/smbd/service.c index 974af83932..a95f756132 100644 --- a/source3/smbd/service.c +++ b/source3/smbd/service.c @@ -762,20 +762,16 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser, return NULL; } - if (lp_guest_only(snum)) { - string_set(&conn->user, conn->server_info->unix_name); + if ((lp_guest_only(snum)) || (lp_security() == SEC_SHARE)) { conn->force_user = true; - DEBUG(3,("Guest only user %s\n", conn->user)); - } else if (vuser) { - conn->vuid = vuser->vuid; - conn->uid = vuser->server_info->uid; - conn->gid = vuser->server_info->gid; - string_set(&conn->user,vuser->server_info->unix_name); - } else if (lp_security() == SEC_SHARE) { - string_set(&conn->user, conn->server_info->unix_name); - conn->force_user = True; } + conn->vuid = (vuser != NULL) ? vuser->vuid : UID_FIELD_INVALID; + + conn->uid = conn->server_info->uid; + conn->gid = conn->server_info->gid; + string_set(&conn->user, conn->server_info->unix_name); + add_session_user(conn->user); safe_strcpy(conn->client_address, @@ -819,16 +815,18 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser, */ if (*lp_force_user(snum)) { + fstring tmp; + fstrcpy(tmp, conn->user); status = find_forced_user(conn, (vuser != NULL) && vuser->server_info->guest, - conn->user); + tmp); if (!NT_STATUS_IS_OK(status)) { conn_free(conn); *pstatus = status; return NULL; } conn->force_user = True; - DEBUG(3,("Forced user %s\n",conn->user)); + DEBUG(3,("Forced user %s\n",tmp)); } /* -- cgit