[SCM] Samba Shared Repository - branch master updated -
release-4-0-0alpha7-138-g35f4ea2
Jeremy Allison
jra at samba.org
Wed Mar 4 00:11:08 GMT 2009
The branch, master has been updated
via 35f4ea221e75ebb4101cbacc6bc24bd1a3604f0f (commit)
from 243d4e8a0846f9b873573ec504fb2f811be7d25c (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 35f4ea221e75ebb4101cbacc6bc24bd1a3604f0f
Author: Jeremy Allison <jra at samba.org>
Date: Tue Mar 3 16:08:56 2009 -0800
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.
-----------------------------------------------------------------------
Summary of changes:
source3/include/smb.h | 6 ++++++
source3/smbd/conn.c | 1 +
source3/smbd/service.c | 8 ++++++++
source3/smbd/uid.c | 11 ++++++++---
4 files changed, 23 insertions(+), 3 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/include/smb.h b/source3/include/smb.h
index 59c3c32..a0140fe 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -573,6 +573,12 @@ typedef struct connection_struct {
*/
struct auth_serversupplied_info *server_info;
+ /*
+ * If the "force group" parameter is set, this is the primary gid that
+ * may be used in the users token, depending on the vuid using this tid.
+ */
+ gid_t force_group_gid;
+
char client_address[INET6_ADDRSTRLEN]; /* String version of client IP address. */
uint16 vuid; /* vuid of user who *opened* this connection, or UID_FIELD_INVALID */
diff --git a/source3/smbd/conn.c b/source3/smbd/conn.c
index 4b467b0..a52f2d2 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 dcdd69f..eb16a26 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 4f059bd..f8c55b1 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);
}
--
Samba Shared Repository
More information about the samba-cvs
mailing list