diff options
author | Jeremy Allison <jra@samba.org> | 2009-03-03 16:08:56 -0800 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2009-03-03 16:08:56 -0800 |
commit | 35f4ea221e75ebb4101cbacc6bc24bd1a3604f0f (patch) | |
tree | 8e05a69ae8d2a4e306393eeb1e8501ba0c9c1614 /source3/smbd | |
parent | 243d4e8a0846f9b873573ec504fb2f811be7d25c (diff) | |
download | samba-35f4ea221e75ebb4101cbacc6bc24bd1a3604f0f.tar.gz samba-35f4ea221e75ebb4101cbacc6bc24bd1a3604f0f.tar.bz2 samba-35f4ea221e75ebb4101cbacc6bc24bd1a3604f0f.zip |
Fix bug #6155 - "force group" is no longer working as expected.
We need to store the "force group" uid separately from the
conn->server_info token as we need to apply it separately also.
Volker PLEASE CHECK !
Jeremy.
Diffstat (limited to 'source3/smbd')
-rw-r--r-- | source3/smbd/conn.c | 1 | ||||
-rw-r--r-- | source3/smbd/service.c | 8 | ||||
-rw-r--r-- | source3/smbd/uid.c | 11 |
3 files changed, 17 insertions, 3 deletions
diff --git a/source3/smbd/conn.c b/source3/smbd/conn.c index 4b467b0312..a52f2d2e96 100644 --- a/source3/smbd/conn.c +++ b/source3/smbd/conn.c @@ -140,6 +140,7 @@ find_again: return NULL; } conn->cnum = i; + conn->force_group_gid = (gid_t)-1; bitmap_set(bmap, i); diff --git a/source3/smbd/service.c b/source3/smbd/service.c index dcdd69f997..eb16a2601e 100644 --- a/source3/smbd/service.c +++ b/source3/smbd/service.c @@ -833,6 +833,14 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser, *pstatus = status; return NULL; } + + /* + * We need to cache this gid, to use within + * change_to_user() separately from the conn->server_info + * struct. We only use conn->server_info directly if + * "force_user" was set. + */ + conn->force_group_gid = conn->server_info->utok.gid; } conn->vuid = (vuser != NULL) ? vuser->vuid : UID_FIELD_INVALID; diff --git a/source3/smbd/uid.c b/source3/smbd/uid.c index 4f059bdb59..f8c55b1b8f 100644 --- a/source3/smbd/uid.c +++ b/source3/smbd/uid.c @@ -254,6 +254,8 @@ bool change_to_user(connection_struct *conn, uint16 vuid) if((group_c = *lp_force_group(snum))) { + SMB_ASSERT(conn->force_group_gid != (gid_t)-1); + if(group_c == '+') { /* @@ -266,15 +268,18 @@ bool change_to_user(connection_struct *conn, uint16 vuid) int i; for (i = 0; i < num_groups; i++) { if (group_list[i] - == conn->server_info->utok.gid) { - gid = conn->server_info->utok.gid; + == conn->force_group_gid) { + conn->server_info->utok.gid = + conn->force_group_gid; + gid = conn->force_group_gid; gid_to_sid(&conn->server_info->ptok ->user_sids[1], gid); break; } } } else { - gid = conn->server_info->utok.gid; + conn->server_info->utok.gid = conn->force_group_gid; + gid = conn->force_group_gid; gid_to_sid(&conn->server_info->ptok->user_sids[1], gid); } |