summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/connection.c4
-rw-r--r--source3/smbd/fake_file.c2
-rw-r--r--source3/smbd/file_access.c8
-rw-r--r--source3/smbd/lanman.c12
-rw-r--r--source3/smbd/open.c7
-rw-r--r--source3/smbd/password.c6
-rw-r--r--source3/smbd/sec_ctx.c2
-rw-r--r--source3/smbd/service.c12
-rw-r--r--source3/smbd/session.c4
-rw-r--r--source3/smbd/uid.c27
10 files changed, 43 insertions, 41 deletions
diff --git a/source3/smbd/connection.c b/source3/smbd/connection.c
index 97f36971c8..8dd5964f5f 100644
--- a/source3/smbd/connection.c
+++ b/source3/smbd/connection.c
@@ -152,8 +152,8 @@ bool claim_connection(connection_struct *conn, const char *name,
crec.pid = procid_self();
crec.cnum = conn?conn->cnum:-1;
if (conn) {
- crec.uid = conn->server_info->uid;
- crec.gid = conn->server_info->gid;
+ crec.uid = conn->server_info->utok.uid;
+ crec.gid = conn->server_info->utok.gid;
strlcpy(crec.servicename, lp_servicename(SNUM(conn)),
sizeof(crec.servicename));
}
diff --git a/source3/smbd/fake_file.c b/source3/smbd/fake_file.c
index 47982d4f00..8dd9abee1a 100644
--- a/source3/smbd/fake_file.c
+++ b/source3/smbd/fake_file.c
@@ -109,7 +109,7 @@ NTSTATUS open_fake_file(connection_struct *conn,
NTSTATUS status;
/* access check */
- if (conn->server_info->uid != 0) {
+ if (conn->server_info->utok.uid != 0) {
DEBUG(3, ("open_fake_file_shared: access_denied to "
"service[%s] file[%s] user[%s]\n",
lp_servicename(SNUM(conn)), fname,
diff --git a/source3/smbd/file_access.c b/source3/smbd/file_access.c
index e61a8c3a5a..84c993d06b 100644
--- a/source3/smbd/file_access.c
+++ b/source3/smbd/file_access.c
@@ -82,7 +82,7 @@ bool can_delete_file_in_directory(connection_struct *conn, const char *fname)
if (!S_ISDIR(sbuf.st_mode)) {
return False;
}
- if (conn->server_info->uid == 0 || conn->admin_user) {
+ if (conn->server_info->utok.uid == 0 || conn->admin_user) {
/* I'm sorry sir, I didn't know you were root... */
return True;
}
@@ -104,7 +104,7 @@ bool can_delete_file_in_directory(connection_struct *conn, const char *fname)
* for bug #3348. Don't assume owning sticky bit
* directory means write access allowed.
*/
- if (conn->server_info->uid != sbuf_file.st_uid) {
+ if (conn->server_info->utok.uid != sbuf_file.st_uid) {
return False;
}
}
@@ -147,7 +147,7 @@ bool can_access_file_data(connection_struct *conn, const char *fname, SMB_STRUCT
DEBUG(10,("can_access_file_data: requesting 0x%x on file %s\n",
(unsigned int)access_mask, fname ));
- if (conn->server_info->uid == 0 || conn->admin_user) {
+ if (conn->server_info->utok.uid == 0 || conn->admin_user) {
/* I'm sorry sir, I didn't know you were root... */
return True;
}
@@ -160,7 +160,7 @@ bool can_access_file_data(connection_struct *conn, const char *fname, SMB_STRUCT
}
/* Check primary owner access. */
- if (conn->server_info->uid == psbuf->st_uid) {
+ if (conn->server_info->utok.uid == psbuf->st_uid) {
switch (access_mask) {
case FILE_READ_DATA:
return (psbuf->st_mode & S_IRUSR) ? True : False;
diff --git a/source3/smbd/lanman.c b/source3/smbd/lanman.c
index 31d4a39842..226e0d5789 100644
--- a/source3/smbd/lanman.c
+++ b/source3/smbd/lanman.c
@@ -102,7 +102,7 @@ static int CopyExpanded(connection_struct *conn,
lp_servicename(SNUM(conn)),
conn->server_info->unix_name,
conn->connectpath,
- conn->server_info->gid,
+ conn->server_info->utok.gid,
conn->server_info->sanitized_username,
pdb_get_domain(conn->server_info->sam_account),
buf);
@@ -153,7 +153,7 @@ static int StrlenExpanded(connection_struct *conn, int snum, char *s)
lp_servicename(SNUM(conn)),
conn->server_info->unix_name,
conn->connectpath,
- conn->server_info->gid,
+ conn->server_info->utok.gid,
conn->server_info->sanitized_username,
pdb_get_domain(conn->server_info->sam_account),
buf);
@@ -183,7 +183,7 @@ static char *Expand(connection_struct *conn, int snum, char *s)
lp_servicename(SNUM(conn)),
conn->server_info->unix_name,
conn->connectpath,
- conn->server_info->gid,
+ conn->server_info->utok.gid,
conn->server_info->sanitized_username,
pdb_get_domain(conn->server_info->sam_account),
buf);
@@ -3009,7 +3009,7 @@ static bool api_RNetServerGetInfo(connection_struct *conn,uint16 vuid,
lp_servicename(SNUM(conn)),
conn->server_info->unix_name,
conn->connectpath,
- conn->server_info->gid,
+ conn->server_info->utok.gid,
conn->server_info->sanitized_username,
pdb_get_domain(conn->server_info->sam_account),
comment);
@@ -3346,7 +3346,7 @@ static bool api_RNetUserGetInfo(connection_struct *conn, uint16 vuid,
user_struct *vuser = get_valid_user_struct(vuid);
if(vuser != NULL) {
DEBUG(3,(" Username of UID %d is %s\n",
- (int)vuser->server_info->uid,
+ (int)vuser->server_info->utok.uid,
vuser->server_info->unix_name));
}
@@ -3602,7 +3602,7 @@ static bool api_WWkstaUserLogon(connection_struct *conn,uint16 vuid,
if(vuser != NULL) {
DEBUG(3,(" Username of UID %d is %s\n",
- (int)vuser->server_info->uid,
+ (int)vuser->server_info->utok.uid,
vuser->server_info->unix_name));
}
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 5a1af42638..3cec80c6df 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -1847,8 +1847,8 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
new_file_created = True;
}
- set_share_mode(lck, fsp, conn->server_info->uid, 0, fsp->oplock_type,
- new_file_created);
+ set_share_mode(lck, fsp, conn->server_info->utok.uid, 0,
+ fsp->oplock_type, new_file_created);
/* Handle strange delete on close create semantics. */
if ((create_options & FILE_DELETE_ON_CLOSE)
@@ -2247,7 +2247,8 @@ NTSTATUS open_directory(connection_struct *conn,
return status;
}
- set_share_mode(lck, fsp, conn->server_info->uid, 0, NO_OPLOCK, True);
+ set_share_mode(lck, fsp, conn->server_info->utok.uid, 0, NO_OPLOCK,
+ True);
/* For directories the delete on close bit at open time seems
always to be honored on close... See test 19 in Samba4 BASE-DELETE. */
diff --git a/source3/smbd/password.c b/source3/smbd/password.c
index ebc72350b5..1d3514429f 100644
--- a/source3/smbd/password.c
+++ b/source3/smbd/password.c
@@ -271,8 +271,8 @@ int register_existing_vuid(uint16 vuid,
vuser->server_info, tmp);
DEBUG(10,("register_existing_vuid: (%u,%u) %s %s %s guest=%d\n",
- (unsigned int)vuser->server_info->uid,
- (unsigned int)vuser->server_info->gid,
+ (unsigned int)vuser->server_info->utok.uid,
+ (unsigned int)vuser->server_info->utok.gid,
vuser->server_info->unix_name,
vuser->server_info->sanitized_username,
pdb_get_domain(vuser->server_info->sam_account),
@@ -289,7 +289,7 @@ 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->server_info->uid,
+ "and will be vuid %u\n", (int)vuser->server_info->utok.uid,
vuser->server_info->unix_name, vuser->vuid));
next_vuid++;
diff --git a/source3/smbd/sec_ctx.c b/source3/smbd/sec_ctx.c
index 0f307f6a64..a618f06e6b 100644
--- a/source3/smbd/sec_ctx.c
+++ b/source3/smbd/sec_ctx.c
@@ -145,7 +145,7 @@ static void gain_root(void)
Get the list of current groups.
****************************************************************************/
-static int get_current_groups(gid_t gid, int *p_ngroups, gid_t **p_groups)
+static int get_current_groups(gid_t gid, size_t *p_ngroups, gid_t **p_groups)
{
int i;
gid_t grp;
diff --git a/source3/smbd/service.c b/source3/smbd/service.c
index ac233a97b7..1ad48451ff 100644
--- a/source3/smbd/service.c
+++ b/source3/smbd/service.c
@@ -823,7 +823,7 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser,
status = find_forced_group(
conn->force_user, snum, conn->server_info->unix_name,
&conn->server_info->ptok->user_sids[1],
- &conn->server_info->gid);
+ &conn->server_info->utok.gid);
if (!NT_STATUS_IS_OK(status)) {
conn_free(conn);
@@ -839,7 +839,7 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser,
lp_servicename(SNUM(conn)),
conn->server_info->unix_name,
conn->connectpath,
- conn->server_info->gid,
+ conn->server_info->utok.gid,
conn->server_info->sanitized_username,
pdb_get_domain(conn->server_info->sam_account),
lp_pathname(snum));
@@ -961,7 +961,7 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser,
lp_servicename(SNUM(conn)),
conn->server_info->unix_name,
conn->connectpath,
- conn->server_info->gid,
+ conn->server_info->utok.gid,
conn->server_info->sanitized_username,
pdb_get_domain(conn->server_info->sam_account),
lp_rootpreexec(snum));
@@ -1000,7 +1000,7 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser,
lp_servicename(SNUM(conn)),
conn->server_info->unix_name,
conn->connectpath,
- conn->server_info->gid,
+ conn->server_info->utok.gid,
conn->server_info->sanitized_username,
pdb_get_domain(conn->server_info->sam_account),
lp_preexec(snum));
@@ -1325,7 +1325,7 @@ void close_cnum(connection_struct *conn, uint16 vuid)
lp_servicename(SNUM(conn)),
conn->server_info->unix_name,
conn->connectpath,
- conn->server_info->gid,
+ conn->server_info->utok.gid,
conn->server_info->sanitized_username,
pdb_get_domain(conn->server_info->sam_account),
lp_postexec(SNUM(conn)));
@@ -1341,7 +1341,7 @@ void close_cnum(connection_struct *conn, uint16 vuid)
lp_servicename(SNUM(conn)),
conn->server_info->unix_name,
conn->connectpath,
- conn->server_info->gid,
+ conn->server_info->utok.gid,
conn->server_info->sanitized_username,
pdb_get_domain(conn->server_info->sam_account),
lp_rootpostexec(SNUM(conn)));
diff --git a/source3/smbd/session.c b/source3/smbd/session.c
index 5e5a184efa..3b431a19be 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->server_info->uid;
- sessionid.gid = vuser->server_info->gid;
+ sessionid.uid = vuser->server_info->utok.uid;
+ sessionid.gid = vuser->server_info->utok.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 2bc5595661..8998f6a371 100644
--- a/source3/smbd/uid.c
+++ b/source3/smbd/uid.c
@@ -192,13 +192,13 @@ bool change_to_user(connection_struct *conn, uint16 vuid)
*/
if((lp_security() == SEC_SHARE) && (current_user.conn == conn) &&
- (current_user.ut.uid == conn->server_info->uid)) {
+ (current_user.ut.uid == conn->server_info->utok.uid)) {
DEBUG(4,("change_to_user: Skipping user change - already "
"user\n"));
return(True);
} else if ((current_user.conn == conn) &&
(vuser != NULL) && (current_user.vuid == vuid) &&
- (current_user.ut.uid == vuser->server_info->uid)) {
+ (current_user.ut.uid == vuser->server_info->utok.uid)) {
DEBUG(4,("change_to_user: Skipping user change - already "
"user\n"));
return(True);
@@ -221,15 +221,15 @@ bool change_to_user(connection_struct *conn, uint16 vuid)
*/
if (conn->force_user) /* security = share sets this too */ {
- uid = conn->server_info->uid;
- gid = conn->server_info->gid;
- group_list = conn->server_info->groups;
- num_groups = conn->server_info->n_groups;
+ uid = conn->server_info->utok.uid;
+ gid = conn->server_info->utok.gid;
+ group_list = conn->server_info->utok.groups;
+ num_groups = conn->server_info->utok.ngroups;
} else if (vuser) {
- uid = conn->admin_user ? 0 : vuser->server_info->uid;
- gid = conn->server_info->gid;
- num_groups = conn->server_info->n_groups;
- group_list = conn->server_info->groups;
+ uid = conn->admin_user ? 0 : vuser->server_info->utok.uid;
+ gid = conn->server_info->utok.gid;
+ num_groups = conn->server_info->utok.ngroups;
+ group_list = conn->server_info->utok.groups;
} else {
DEBUG(2,("change_to_user: Invalid vuid used %d in accessing "
"share %s.\n",vuid, lp_servicename(snum) ));
@@ -255,15 +255,16 @@ 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->gid) {
- gid = conn->server_info->gid;
+ if (group_list[i]
+ == conn->server_info->utok.gid) {
+ gid = conn->server_info->utok.gid;
gid_to_sid(&conn->server_info->ptok
->user_sids[1], gid);
break;
}
}
} else {
- gid = conn->server_info->gid;
+ gid = conn->server_info->utok.gid;
gid_to_sid(&conn->server_info->ptok->user_sids[1],
gid);
}