mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
Remove "user" from connection_struct
This commit is contained in:
parent
35438a9407
commit
368454a27c
@ -630,7 +630,6 @@ typedef struct connection_struct {
|
||||
*/
|
||||
struct auth_serversupplied_info *server_info;
|
||||
|
||||
char *user; /* name of user who *opened* this connection */
|
||||
char client_address[INET6_ADDRSTRLEN]; /* String version of client IP address. */
|
||||
|
||||
uint16 vuid; /* vuid of user who *opened* this connection, or UID_FIELD_INVALID */
|
||||
|
@ -905,7 +905,7 @@ char *standard_sub_conn(TALLOC_CTX *ctx, connection_struct *conn, const char *st
|
||||
{
|
||||
return talloc_sub_advanced(ctx,
|
||||
lp_servicename(SNUM(conn)),
|
||||
conn->user,
|
||||
conn->server_info->unix_name,
|
||||
conn->connectpath,
|
||||
conn->server_info->gid,
|
||||
get_smb_user_name(),
|
||||
|
@ -145,7 +145,7 @@ static char *expand_msdfs_target(TALLOC_CTX *ctx,
|
||||
|
||||
targethost = talloc_sub_advanced(ctx,
|
||||
lp_servicename(SNUM(conn)),
|
||||
conn->user,
|
||||
conn->server_info->unix_name,
|
||||
conn->connectpath,
|
||||
conn->server_info->gid,
|
||||
get_current_username(),
|
||||
|
@ -693,7 +693,8 @@ static char *audit_prefix(TALLOC_CTX *ctx, connection_struct *conn)
|
||||
return NULL;
|
||||
}
|
||||
return talloc_sub_advanced(ctx,
|
||||
lp_servicename(SNUM(conn)), conn->user,
|
||||
lp_servicename(SNUM(conn)),
|
||||
conn->server_info->unix_name,
|
||||
conn->connectpath,
|
||||
conn->server_info->gid,
|
||||
get_current_username(),
|
||||
|
@ -432,7 +432,7 @@ static int recycle_unlink(vfs_handle_struct *handle, const char *file_name)
|
||||
int rc = -1;
|
||||
|
||||
repository = talloc_sub_advanced(NULL, lp_servicename(SNUM(conn)),
|
||||
conn->user,
|
||||
conn->server_info->unix_name,
|
||||
conn->connectpath,
|
||||
conn->server_info->gid,
|
||||
get_current_username(),
|
||||
|
@ -581,7 +581,7 @@ static NTSTATUS close_normal_file(files_struct *fsp, enum file_close_type close_
|
||||
}
|
||||
|
||||
DEBUG(2,("%s closed file %s (numopen=%d) %s\n",
|
||||
conn->user,fsp->fsp_name,
|
||||
conn->server_info->unix_name,fsp->fsp_name,
|
||||
conn->num_files_open,
|
||||
nt_errstr(status) ));
|
||||
|
||||
|
@ -151,7 +151,6 @@ find_again:
|
||||
|
||||
num_open++;
|
||||
|
||||
string_set(&conn->user,"");
|
||||
string_set(&conn->dirpath,"");
|
||||
string_set(&conn->connectpath,"");
|
||||
string_set(&conn->origpath,"");
|
||||
@ -283,7 +282,6 @@ void conn_free_internal(connection_struct *conn)
|
||||
free_namearray(conn->veto_oplock_list);
|
||||
free_namearray(conn->aio_write_behind_list);
|
||||
|
||||
string_free(&conn->user);
|
||||
string_free(&conn->dirpath);
|
||||
string_free(&conn->connectpath);
|
||||
string_free(&conn->origpath);
|
||||
|
@ -113,7 +113,8 @@ NTSTATUS open_fake_file(connection_struct *conn,
|
||||
if (current_user.ut.uid != 0) {
|
||||
DEBUG(3, ("open_fake_file_shared: access_denied to "
|
||||
"service[%s] file[%s] user[%s]\n",
|
||||
lp_servicename(SNUM(conn)),fname,conn->user));
|
||||
lp_servicename(SNUM(conn)), fname,
|
||||
conn->server_info->unix_name));
|
||||
return NT_STATUS_ACCESS_DENIED;
|
||||
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ static int CopyExpanded(connection_struct *conn,
|
||||
}
|
||||
buf = talloc_sub_advanced(ctx,
|
||||
lp_servicename(SNUM(conn)),
|
||||
conn->user,
|
||||
conn->server_info->unix_name,
|
||||
conn->connectpath,
|
||||
conn->server_info->gid,
|
||||
get_current_username(),
|
||||
@ -152,7 +152,7 @@ static int StrlenExpanded(connection_struct *conn, int snum, char *s)
|
||||
}
|
||||
buf = talloc_sub_advanced(ctx,
|
||||
lp_servicename(SNUM(conn)),
|
||||
conn->user,
|
||||
conn->server_info->unix_name,
|
||||
conn->connectpath,
|
||||
conn->server_info->gid,
|
||||
get_current_username(),
|
||||
@ -182,7 +182,7 @@ static char *Expand(connection_struct *conn, int snum, char *s)
|
||||
}
|
||||
return talloc_sub_advanced(ctx,
|
||||
lp_servicename(SNUM(conn)),
|
||||
conn->user,
|
||||
conn->server_info->unix_name,
|
||||
conn->connectpath,
|
||||
conn->server_info->gid,
|
||||
get_current_username(),
|
||||
@ -3000,7 +3000,7 @@ static bool api_RNetServerGetInfo(connection_struct *conn,uint16 vuid,
|
||||
SIVAL(p,6,PTR_DIFF(p2,*rdata));
|
||||
comment = talloc_sub_advanced(ctx,
|
||||
lp_servicename(SNUM(conn)),
|
||||
conn->user,
|
||||
conn->server_info->unix_name,
|
||||
conn->connectpath,
|
||||
conn->server_info->gid,
|
||||
get_current_username(),
|
||||
|
@ -2037,8 +2037,9 @@ static void call_nt_transact_get_user_quota(connection_struct *conn,
|
||||
|
||||
/* access check */
|
||||
if (current_user.ut.uid != 0) {
|
||||
DEBUG(1,("get_user_quota: access_denied service [%s] user [%s]\n",
|
||||
lp_servicename(SNUM(conn)),conn->user));
|
||||
DEBUG(1,("get_user_quota: access_denied service [%s] user "
|
||||
"[%s]\n", lp_servicename(SNUM(conn)),
|
||||
conn->server_info->unix_name));
|
||||
reply_doserror(req, ERRDOS, ERRnoaccess);
|
||||
return;
|
||||
}
|
||||
@ -2303,8 +2304,9 @@ static void call_nt_transact_set_user_quota(connection_struct *conn,
|
||||
|
||||
/* access check */
|
||||
if (current_user.ut.uid != 0) {
|
||||
DEBUG(1,("set_user_quota: access_denied service [%s] user [%s]\n",
|
||||
lp_servicename(SNUM(conn)),conn->user));
|
||||
DEBUG(1,("set_user_quota: access_denied service [%s] user "
|
||||
"[%s]\n", lp_servicename(SNUM(conn)),
|
||||
conn->server_info->unix_name));
|
||||
reply_doserror(req, ERRDOS, ERRnoaccess);
|
||||
return;
|
||||
}
|
||||
|
@ -400,8 +400,9 @@ static NTSTATUS open_file(files_struct *fsp,
|
||||
fsp->wcp = NULL; /* Write cache pointer. */
|
||||
|
||||
DEBUG(2,("%s opened file %s read=%s write=%s (numopen=%d)\n",
|
||||
*current_user_info.smb_name ?
|
||||
current_user_info.smb_name : conn->user,fsp->fsp_name,
|
||||
*current_user_info.smb_name
|
||||
? current_user_info.smb_name : conn->server_info->unix_name,
|
||||
fsp->fsp_name,
|
||||
BOOLSTR(fsp->can_read), BOOLSTR(fsp->can_write),
|
||||
conn->num_files_open + 1));
|
||||
|
||||
|
@ -820,7 +820,7 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser,
|
||||
if (*lp_force_group(snum)) {
|
||||
|
||||
status = find_forced_group(
|
||||
conn->force_user, snum, conn->user,
|
||||
conn->force_user, snum, conn->server_info->unix_name,
|
||||
&conn->server_info->ptok->user_sids[1],
|
||||
&conn->server_info->gid);
|
||||
|
||||
@ -833,11 +833,10 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser,
|
||||
|
||||
conn->vuid = (vuser != NULL) ? vuser->vuid : UID_FIELD_INVALID;
|
||||
|
||||
string_set(&conn->user, conn->server_info->unix_name);
|
||||
|
||||
{
|
||||
char *s = talloc_sub_advanced(talloc_tos(),
|
||||
lp_servicename(SNUM(conn)), conn->user,
|
||||
lp_servicename(SNUM(conn)),
|
||||
conn->server_info->unix_name,
|
||||
conn->connectpath,
|
||||
conn->server_info->gid,
|
||||
get_current_username(),
|
||||
@ -958,7 +957,8 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser,
|
||||
/* execute any "root preexec = " line */
|
||||
if (*lp_rootpreexec(snum)) {
|
||||
char *cmd = talloc_sub_advanced(talloc_tos(),
|
||||
lp_servicename(SNUM(conn)), conn->user,
|
||||
lp_servicename(SNUM(conn)),
|
||||
conn->server_info->unix_name,
|
||||
conn->connectpath,
|
||||
conn->server_info->gid,
|
||||
get_current_username(),
|
||||
@ -996,7 +996,8 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser,
|
||||
/* execute any "preexec = " line */
|
||||
if (*lp_preexec(snum)) {
|
||||
char *cmd = talloc_sub_advanced(talloc_tos(),
|
||||
lp_servicename(SNUM(conn)), conn->user,
|
||||
lp_servicename(SNUM(conn)),
|
||||
conn->server_info->unix_name,
|
||||
conn->connectpath,
|
||||
conn->server_info->gid,
|
||||
get_current_username(),
|
||||
@ -1029,7 +1030,8 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser,
|
||||
to allow any filesystems needing user credentials to initialize
|
||||
themselves. */
|
||||
|
||||
if (SMB_VFS_CONNECT(conn, lp_servicename(snum), conn->user) < 0) {
|
||||
if (SMB_VFS_CONNECT(conn, lp_servicename(snum),
|
||||
conn->server_info->unix_name) < 0) {
|
||||
DEBUG(0,("make_connection: VFS make connection failed!\n"));
|
||||
*pstatus = NT_STATUS_UNSUCCESSFUL;
|
||||
goto err_root_exit;
|
||||
@ -1096,7 +1098,8 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser,
|
||||
conn->client_address );
|
||||
dbgtext( "%s", srv_is_signing_active() ? "signed " : "");
|
||||
dbgtext( "connect to service %s ", lp_servicename(snum) );
|
||||
dbgtext( "initially as user %s ", conn->user );
|
||||
dbgtext( "initially as user %s ",
|
||||
conn->server_info->unix_name );
|
||||
dbgtext( "(uid=%d, gid=%d) ", (int)geteuid(), (int)getegid() );
|
||||
dbgtext( "(pid %d)\n", (int)sys_getpid() );
|
||||
}
|
||||
@ -1316,7 +1319,8 @@ void close_cnum(connection_struct *conn, uint16 vuid)
|
||||
if (*lp_postexec(SNUM(conn)) &&
|
||||
change_to_user(conn, vuid)) {
|
||||
char *cmd = talloc_sub_advanced(talloc_tos(),
|
||||
lp_servicename(SNUM(conn)), conn->user,
|
||||
lp_servicename(SNUM(conn)),
|
||||
conn->server_info->unix_name,
|
||||
conn->connectpath,
|
||||
conn->server_info->gid,
|
||||
get_current_username(),
|
||||
@ -1331,7 +1335,8 @@ void close_cnum(connection_struct *conn, uint16 vuid)
|
||||
/* execute any "root postexec = " line */
|
||||
if (*lp_rootpostexec(SNUM(conn))) {
|
||||
char *cmd = talloc_sub_advanced(talloc_tos(),
|
||||
lp_servicename(SNUM(conn)), conn->user,
|
||||
lp_servicename(SNUM(conn)),
|
||||
conn->server_info->unix_name,
|
||||
conn->connectpath,
|
||||
conn->server_info->gid,
|
||||
get_current_username(),
|
||||
|
@ -2826,8 +2826,10 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned
|
||||
|
||||
/* access check */
|
||||
if (current_user.ut.uid != 0) {
|
||||
DEBUG(0,("set_user_quota: access_denied service [%s] user [%s]\n",
|
||||
lp_servicename(SNUM(conn)),conn->user));
|
||||
DEBUG(0,("set_user_quota: access_denied "
|
||||
"service [%s] user [%s]\n",
|
||||
lp_servicename(SNUM(conn)),
|
||||
conn->server_info->unix_name));
|
||||
reply_doserror(req, ERRDOS, ERRnoaccess);
|
||||
return;
|
||||
}
|
||||
@ -3267,7 +3269,8 @@ cap_low = 0x%x, cap_high = 0x%x\n",
|
||||
/* access check */
|
||||
if ((current_user.ut.uid != 0)||!CAN_WRITE(conn)) {
|
||||
DEBUG(0,("set_user_quota: access_denied service [%s] user [%s]\n",
|
||||
lp_servicename(SNUM(conn)),conn->user));
|
||||
lp_servicename(SNUM(conn)),
|
||||
conn->server_info->unix_name));
|
||||
reply_doserror(req, ERRSRV, ERRaccess);
|
||||
return;
|
||||
}
|
||||
|
@ -563,7 +563,6 @@ int main(int argc, char *argv[])
|
||||
sec_init();
|
||||
conn_init();
|
||||
vfs.conn = conn_new();
|
||||
string_set(&vfs.conn->user,"vfstest");
|
||||
for (i=0; i < 1024; i++)
|
||||
vfs.files[i] = NULL;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user