diff options
Diffstat (limited to 'source3/smbd')
-rw-r--r-- | source3/smbd/close.c | 2 | ||||
-rw-r--r-- | source3/smbd/connection.c | 4 | ||||
-rw-r--r-- | source3/smbd/fake_file.c | 2 | ||||
-rw-r--r-- | source3/smbd/globals.h | 2 | ||||
-rw-r--r-- | source3/smbd/lanman.c | 74 | ||||
-rw-r--r-- | source3/smbd/msdfs.c | 10 | ||||
-rw-r--r-- | source3/smbd/nttrans.c | 8 | ||||
-rw-r--r-- | source3/smbd/open.c | 2 | ||||
-rw-r--r-- | source3/smbd/password.c | 52 | ||||
-rw-r--r-- | source3/smbd/pipes.c | 2 | ||||
-rw-r--r-- | source3/smbd/process.c | 6 | ||||
-rw-r--r-- | source3/smbd/reply.c | 6 | ||||
-rw-r--r-- | source3/smbd/server_reload.c | 16 | ||||
-rw-r--r-- | source3/smbd/service.c | 80 | ||||
-rw-r--r-- | source3/smbd/session.c | 8 | ||||
-rw-r--r-- | source3/smbd/sesssetup.c | 14 | ||||
-rw-r--r-- | source3/smbd/smb2_sesssetup.c | 68 | ||||
-rw-r--r-- | source3/smbd/smb2_tcon.c | 2 | ||||
-rw-r--r-- | source3/smbd/trans2.c | 40 | ||||
-rw-r--r-- | source3/smbd/uid.c | 120 |
20 files changed, 259 insertions, 259 deletions
diff --git a/source3/smbd/close.c b/source3/smbd/close.c index d5a824f868f..0efa36f9a98 100644 --- a/source3/smbd/close.c +++ b/source3/smbd/close.c @@ -674,7 +674,7 @@ static NTSTATUS close_normal_file(struct smb_request *req, files_struct *fsp, status = ntstatus_keeperror(status, tmp); DEBUG(2,("%s closed file %s (numopen=%d) %s\n", - conn->server_info->unix_name, fsp_str_dbg(fsp), + conn->session_info->unix_name, fsp_str_dbg(fsp), conn->num_files_open - 1, nt_errstr(status) )); diff --git a/source3/smbd/connection.c b/source3/smbd/connection.c index 9653723e13f..cfbc80ef9f2 100644 --- a/source3/smbd/connection.c +++ b/source3/smbd/connection.c @@ -141,8 +141,8 @@ bool claim_connection(connection_struct *conn, const char *name) crec.magic = 0x280267; crec.pid = sconn_server_id(conn->sconn); crec.cnum = conn->cnum; - crec.uid = conn->server_info->utok.uid; - crec.gid = conn->server_info->utok.gid; + crec.uid = conn->session_info->utok.uid; + crec.gid = conn->session_info->utok.gid; strlcpy(crec.servicename, lp_servicename(SNUM(conn)), sizeof(crec.servicename)); crec.start = time(NULL); diff --git a/source3/smbd/fake_file.c b/source3/smbd/fake_file.c index d844261efb7..0c796faf450 100644 --- a/source3/smbd/fake_file.c +++ b/source3/smbd/fake_file.c @@ -132,7 +132,7 @@ NTSTATUS open_fake_file(struct smb_request *req, connection_struct *conn, "service[%s] file[%s] user[%s]\n", lp_servicename(SNUM(conn)), smb_fname_str_dbg(smb_fname), - conn->server_info->unix_name)); + conn->session_info->unix_name)); return NT_STATUS_ACCESS_DENIED; } diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h index 7771049bded..c3268468252 100644 --- a/source3/smbd/globals.h +++ b/source3/smbd/globals.h @@ -417,7 +417,7 @@ struct smbd_smb2_session { NTSTATUS status; uint64_t vuid; struct auth_ntlmssp_state *auth_ntlmssp_state; - struct auth_serversupplied_info *server_info; + struct auth_serversupplied_info *session_info; DATA_BLOB session_key; bool do_signing; diff --git a/source3/smbd/lanman.c b/source3/smbd/lanman.c index 491808ad571..259da3dc46b 100644 --- a/source3/smbd/lanman.c +++ b/source3/smbd/lanman.c @@ -114,11 +114,11 @@ static int CopyExpanded(connection_struct *conn, } buf = talloc_sub_advanced(ctx, lp_servicename(SNUM(conn)), - conn->server_info->unix_name, + conn->session_info->unix_name, conn->connectpath, - conn->server_info->utok.gid, - conn->server_info->sanitized_username, - conn->server_info->info3->base.domain.string, + conn->session_info->utok.gid, + conn->session_info->sanitized_username, + conn->session_info->info3->base.domain.string, buf); if (!buf) { *p_space_remaining = 0; @@ -165,11 +165,11 @@ static int StrlenExpanded(connection_struct *conn, int snum, char *s) } buf = talloc_sub_advanced(ctx, lp_servicename(SNUM(conn)), - conn->server_info->unix_name, + conn->session_info->unix_name, conn->connectpath, - conn->server_info->utok.gid, - conn->server_info->sanitized_username, - conn->server_info->info3->base.domain.string, + conn->session_info->utok.gid, + conn->session_info->sanitized_username, + conn->session_info->info3->base.domain.string, buf); if (!buf) { return 0; @@ -830,7 +830,7 @@ static bool api_DosPrintQGetInfo(struct smbd_server_connection *sconn, status = rpc_pipe_open_interface(conn, &ndr_table_spoolss.syntax_id, - conn->server_info, + conn->session_info, &conn->sconn->client_id, conn->sconn->msg_ctx, &cli); @@ -1027,7 +1027,7 @@ static bool api_DosPrintQEnum(struct smbd_server_connection *sconn, status = rpc_pipe_open_interface(conn, &ndr_table_spoolss.syntax_id, - conn->server_info, + conn->session_info, &conn->sconn->client_id, conn->sconn->msg_ctx, &cli); @@ -1184,7 +1184,7 @@ static bool api_DosPrintQEnum(struct smbd_server_connection *sconn, Get info level for a server list query. ****************************************************************************/ -static bool check_server_info(int uLevel, char* id) +static bool check_session_info(int uLevel, char* id) { switch( uLevel ) { case 0: @@ -1216,7 +1216,7 @@ struct srv_info_struct { number of entries. ******************************************************************/ -static int get_server_info(uint32 servertype, +static int get_session_info(uint32 servertype, struct srv_info_struct **servers, const char *domain) { @@ -1257,7 +1257,7 @@ static int get_server_info(uint32 servertype, alloced += 10; *servers = SMB_REALLOC_ARRAY(*servers,struct srv_info_struct, alloced); if (!*servers) { - DEBUG(0,("get_server_info: failed to enlarge servers info struct!\n")); + DEBUG(0,("get_session_info: failed to enlarge servers info struct!\n")); TALLOC_FREE(lines); return 0; } @@ -1487,7 +1487,7 @@ static bool api_RNetServerEnum2(struct smbd_server_connection *sconn, if (!prefix_ok(str1,"WrLehD")) { return False; } - if (!check_server_info(uLevel,str2)) { + if (!check_session_info(uLevel,str2)) { return False; } @@ -1507,7 +1507,7 @@ static bool api_RNetServerEnum2(struct smbd_server_connection *sconn, DEBUG(4, ("domain [%s]\n", domain)); if (lp_browse_list()) { - total = get_server_info(servertype,&servers,domain); + total = get_session_info(servertype,&servers,domain); } data_len = fixed_len = string_len = 0; @@ -1658,7 +1658,7 @@ static bool api_RNetServerEnum3(struct smbd_server_connection *sconn, if (strcmp(str1, "WrLehDzz") != 0) { return false; } - if (!check_server_info(uLevel,str2)) { + if (!check_session_info(uLevel,str2)) { return False; } @@ -1683,7 +1683,7 @@ static bool api_RNetServerEnum3(struct smbd_server_connection *sconn, domain, first_name)); if (lp_browse_list()) { - total = get_server_info(servertype,&servers,domain); + total = get_session_info(servertype,&servers,domain); } data_len = fixed_len = string_len = 0; @@ -2254,7 +2254,7 @@ static bool api_RNetShareAdd(struct smbd_server_connection *sconn, } status = rpc_pipe_open_internal(mem_ctx, &ndr_table_srvsvc.syntax_id, - conn->server_info, + conn->session_info, &conn->sconn->client_id, conn->sconn->msg_ctx, &cli); @@ -2366,7 +2366,7 @@ static bool api_RNetGroupEnum(struct smbd_server_connection *sconn, status = rpc_pipe_open_internal( talloc_tos(), &ndr_table_samr.syntax_id, - conn->server_info, &conn->sconn->client_id, + conn->session_info, &conn->sconn->client_id, conn->sconn->msg_ctx, &samr_pipe); if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("api_RNetUserEnum: Could not connect to samr: %s\n", @@ -2572,7 +2572,7 @@ static bool api_NetUserGetGroups(struct smbd_server_connection *sconn, status = rpc_pipe_open_internal( talloc_tos(), &ndr_table_samr.syntax_id, - conn->server_info, &conn->sconn->client_id, + conn->session_info, &conn->sconn->client_id, conn->sconn->msg_ctx, &samr_pipe); if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("api_RNetUserEnum: Could not connect to samr: %s\n", @@ -2764,7 +2764,7 @@ static bool api_RNetUserEnum(struct smbd_server_connection *sconn, status = rpc_pipe_open_internal( talloc_tos(), &ndr_table_samr.syntax_id, - conn->server_info, &conn->sconn->client_id, + conn->session_info, &conn->sconn->client_id, conn->sconn->msg_ctx, &samr_pipe); if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("api_RNetUserEnum: Could not connect to samr: %s\n", @@ -3029,7 +3029,7 @@ static bool api_SetUserPassword(struct smbd_server_connection *sconn, ZERO_STRUCT(user_handle); status = rpc_pipe_open_internal(mem_ctx, &ndr_table_samr.syntax_id, - conn->server_info, + conn->session_info, &conn->sconn->client_id, conn->sconn->msg_ctx, &cli); @@ -3280,7 +3280,7 @@ static bool api_SamOEMChangePassword(struct smbd_server_connection *sconn, memcpy(hash.hash, data+516, 16); status = rpc_pipe_open_internal(mem_ctx, &ndr_table_samr.syntax_id, - conn->server_info, + conn->session_info, &conn->sconn->client_id, conn->sconn->msg_ctx, &cli); @@ -3377,7 +3377,7 @@ static bool api_RDosPrintJobDel(struct smbd_server_connection *sconn, status = rpc_pipe_open_interface(conn, &ndr_table_spoolss.syntax_id, - conn->server_info, + conn->session_info, &conn->sconn->client_id, conn->sconn->msg_ctx, &cli); @@ -3505,7 +3505,7 @@ static bool api_WPrintQueueCtrl(struct smbd_server_connection *sconn, status = rpc_pipe_open_interface(conn, &ndr_table_spoolss.syntax_id, - conn->server_info, + conn->session_info, &conn->sconn->client_id, conn->sconn->msg_ctx, &cli); @@ -3687,7 +3687,7 @@ static bool api_PrintJobInfo(struct smbd_server_connection *sconn, status = rpc_pipe_open_interface(conn, &ndr_table_spoolss.syntax_id, - conn->server_info, + conn->session_info, &conn->sconn->client_id, conn->sconn->msg_ctx, &cli); @@ -3864,7 +3864,7 @@ static bool api_RNetServerGetInfo(struct smbd_server_connection *sconn, p2 = p + struct_len; status = rpc_pipe_open_internal(mem_ctx, &ndr_table_srvsvc.syntax_id, - conn->server_info, + conn->session_info, &conn->sconn->client_id, conn->sconn->msg_ctx, &cli); @@ -4010,7 +4010,7 @@ static bool api_NetWkstaGetInfo(struct smbd_server_connection *sconn, p += 4; SIVAL(p,0,PTR_DIFF(p2,*rdata)); - strlcpy(p2,conn->server_info->sanitized_username,PTR_DIFF(endp,p2)); + strlcpy(p2,conn->session_info->sanitized_username,PTR_DIFF(endp,p2)); p2 = skip_string(*rdata,*rdata_len,p2); if (!p2) { return False; @@ -4291,7 +4291,7 @@ static bool api_RNetUserGetInfo(struct smbd_server_connection *sconn, ZERO_STRUCT(user_handle); status = rpc_pipe_open_internal(mem_ctx, &ndr_table_samr.syntax_id, - conn->server_info, + conn->session_info, &conn->sconn->client_id, conn->sconn->msg_ctx, &cli); @@ -4634,8 +4634,8 @@ static bool api_WWkstaUserLogon(struct smbd_server_connection *sconn, if(vuser != NULL) { DEBUG(3,(" Username of UID %d is %s\n", - (int)vuser->server_info->utok.uid, - vuser->server_info->unix_name)); + (int)vuser->session_info->utok.uid, + vuser->session_info->unix_name)); } uLevel = get_safe_SVAL(param,tpscnt,p,0,-1); @@ -4695,7 +4695,7 @@ static bool api_WWkstaUserLogon(struct smbd_server_connection *sconn, PACKS(&desc,"z",lp_workgroup());/* domain */ PACKS(&desc,"z", vuser ? - vuser->server_info->info3->base.logon_script.string + vuser->session_info->info3->base.logon_script.string : ""); /* script path */ PACKI(&desc,"D",0x00000000); /* reserved */ } @@ -4818,7 +4818,7 @@ static bool api_WPrintJobGetInfo(struct smbd_server_connection *sconn, status = rpc_pipe_open_interface(conn, &ndr_table_spoolss.syntax_id, - conn->server_info, + conn->session_info, &conn->sconn->client_id, conn->sconn->msg_ctx, &cli); @@ -4960,7 +4960,7 @@ static bool api_WPrintJobEnumerate(struct smbd_server_connection *sconn, status = rpc_pipe_open_interface(conn, &ndr_table_spoolss.syntax_id, - conn->server_info, + conn->session_info, &conn->sconn->client_id, conn->sconn->msg_ctx, &cli); @@ -5160,7 +5160,7 @@ static bool api_WPrintDestGetInfo(struct smbd_server_connection *sconn, status = rpc_pipe_open_interface(conn, &ndr_table_spoolss.syntax_id, - conn->server_info, + conn->session_info, &conn->sconn->client_id, conn->sconn->msg_ctx, &cli); @@ -5292,7 +5292,7 @@ static bool api_WPrintDestEnum(struct smbd_server_connection *sconn, status = rpc_pipe_open_interface(conn, &ndr_table_spoolss.syntax_id, - conn->server_info, + conn->session_info, &conn->sconn->client_id, conn->sconn->msg_ctx, &cli); @@ -5803,7 +5803,7 @@ void api_reply(connection_struct *conn, uint16 vuid, if (api_commands[i].auth_user && lp_restrict_anonymous()) { user_struct *user = get_valid_user_struct(req->sconn, vuid); - if (!user || user->server_info->guest) { + if (!user || user->session_info->guest) { reply_nterror(req, NT_STATUS_ACCESS_DENIED); return; } diff --git a/source3/smbd/msdfs.c b/source3/smbd/msdfs.c index 165e802a82c..07b09330313 100644 --- a/source3/smbd/msdfs.c +++ b/source3/smbd/msdfs.c @@ -219,7 +219,7 @@ NTSTATUS create_conn_struct(TALLOC_CTX *ctx, connection_struct **pconn, int snum, const char *path, - const struct auth_serversupplied_info *server_info, + const struct auth_serversupplied_info *session_info, char **poldcwd) { connection_struct *conn; @@ -258,9 +258,9 @@ NTSTATUS create_conn_struct(TALLOC_CTX *ctx, conn->sconn = smbd_server_conn; conn->sconn->num_tcons_open++; - if (server_info != NULL) { - conn->server_info = copy_serverinfo(conn, server_info); - if (conn->server_info == NULL) { + if (session_info != NULL) { + conn->session_info = copy_serverinfo(conn, session_info); + if (conn->session_info == NULL) { DEBUG(0, ("copy_serverinfo failed\n")); TALLOC_FREE(conn); return NT_STATUS_NO_MEMORY; @@ -726,7 +726,7 @@ static NTSTATUS dfs_redirect(TALLOC_CTX *ctx, if (!( strequal(pdp->servicename, lp_servicename(SNUM(conn))) || (strequal(pdp->servicename, HOMES_NAME) && strequal(lp_servicename(SNUM(conn)), - conn->server_info->sanitized_username) )) ) { + conn->session_info->sanitized_username) )) ) { /* The given sharename doesn't match this connection. */ TALLOC_FREE(pdp); diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c index b63f37f0fd3..afc4f54cf29 100644 --- a/source3/smbd/nttrans.c +++ b/source3/smbd/nttrans.c @@ -2507,10 +2507,10 @@ static void call_nt_transact_get_user_quota(connection_struct *conn, ZERO_STRUCT(qt); /* access check */ - if (conn->server_info->utok.uid != 0) { + if (conn->session_info->utok.uid != 0) { DEBUG(1,("get_user_quota: access_denied service [%s] user " "[%s]\n", lp_servicename(SNUM(conn)), - conn->server_info->unix_name)); + conn->session_info->unix_name)); reply_nterror(req, NT_STATUS_ACCESS_DENIED); return; } @@ -2777,10 +2777,10 @@ static void call_nt_transact_set_user_quota(connection_struct *conn, ZERO_STRUCT(qt); /* access check */ - if (conn->server_info->utok.uid != 0) { + if (conn->session_info->utok.uid != 0) { DEBUG(1,("set_user_quota: access_denied service [%s] user " "[%s]\n", lp_servicename(SNUM(conn)), - conn->server_info->unix_name)); + conn->session_info->unix_name)); reply_nterror(req, NT_STATUS_ACCESS_DENIED); return; } diff --git a/source3/smbd/open.c b/source3/smbd/open.c index b6a75bb16f7..2c7764ab14d 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -619,7 +619,7 @@ 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", - conn->server_info->unix_name, + conn->session_info->unix_name, smb_fname_str_dbg(smb_fname), BOOLSTR(fsp->can_read), BOOLSTR(fsp->can_write), conn->num_files_open)); diff --git a/source3/smbd/password.c b/source3/smbd/password.c index 9c343badd20..15277d04b4a 100644 --- a/source3/smbd/password.c +++ b/source3/smbd/password.c @@ -53,12 +53,12 @@ static user_struct *get_valid_user_struct_internal( if (vuid == usp->vuid) { switch (server_allocated) { case SERVER_ALLOCATED_REQUIRED_YES: - if (usp->server_info == NULL) { + if (usp->session_info == NULL) { continue; } break; case SERVER_ALLOCATED_REQUIRED_NO: - if (usp->server_info != NULL) { + if (usp->session_info != NULL) { continue; } case SERVER_ALLOCATED_REQUIRED_ANY: @@ -242,7 +242,7 @@ int register_homes_share(const char *username) /** * register that a valid login has been performed, establish 'session'. - * @param server_info The token returned from the authentication process. + * @param session_info The token returned from the authentication process. * (now 'owned' by register_existing_vuid) * * @param session_key The User session key for the login session (now also @@ -260,7 +260,7 @@ int register_homes_share(const char *username) int register_existing_vuid(struct smbd_server_connection *sconn, uint16 vuid, - struct auth_serversupplied_info *server_info, + struct auth_serversupplied_info *session_info, DATA_BLOB response_blob, const char *smb_name) { @@ -273,35 +273,35 @@ int register_existing_vuid(struct smbd_server_connection *sconn, } /* Use this to keep tabs on all our info from the authentication */ - vuser->server_info = talloc_move(vuser, &server_info); + vuser->session_info = talloc_move(vuser, &session_info); /* This is a potentially untrusted username */ alpha_strcpy(tmp, smb_name, ". _-$", sizeof(tmp)); - vuser->server_info->sanitized_username = talloc_strdup( - vuser->server_info, tmp); + vuser->session_info->sanitized_username = talloc_strdup( + vuser->session_info, tmp); DEBUG(10,("register_existing_vuid: (%u,%u) %s %s %s guest=%d\n", - (unsigned int)vuser->server_info->utok.uid, - (unsigned int)vuser->server_info->utok.gid, - vuser->server_info->unix_name, - vuser->server_info->sanitized_username, - vuser->server_info->info3->base.domain.string, - vuser->server_info->guest )); + (unsigned int)vuser->session_info->utok.uid, + (unsigned int)vuser->session_info->utok.gid, + vuser->session_info->unix_name, + vuser->session_info->sanitized_username, + vuser->session_info->info3->base.domain.string, + vuser->session_info->guest )); DEBUG(3, ("register_existing_vuid: User name: %s\t" - "Real name: %s\n", vuser->server_info->unix_name, - vuser->server_info->info3->base.full_name.string)); + "Real name: %s\n", vuser->session_info->unix_name, + vuser->session_info->info3->base.full_name.string)); - if (!vuser->server_info->security_token) { - DEBUG(1, ("register_existing_vuid: server_info does not " + if (!vuser->session_info->security_token) { + DEBUG(1, ("register_existing_vuid: session_info does not " "contain a user_token - cannot continue\n")); goto fail; } DEBUG(3,("register_existing_vuid: UNIX uid %d is UNIX user %s, " - "and will be vuid %u\n", (int)vuser->server_info->utok.uid, - vuser->server_info->unix_name, vuser->vuid)); + "and will be vuid %u\n", (int)vuser->session_info->utok.uid, + vuser->session_info->unix_name, vuser->vuid)); if (!session_claim(sconn, vuser)) { DEBUG(1, ("register_existing_vuid: Failed to claim session " @@ -318,25 +318,25 @@ int register_existing_vuid(struct smbd_server_connection *sconn, vuser->homes_snum = -1; - if (!vuser->server_info->guest) { + if (!vuser->session_info->guest) { vuser->homes_snum = register_homes_share( - vuser->server_info->unix_name); + vuser->session_info->unix_name); } if (srv_is_signing_negotiated(sconn) && - !vuser->server_info->guest) { + !vuser->session_info->guest) { /* Try and turn on server signing on the first non-guest * sessionsetup. */ srv_set_signing(sconn, - vuser->server_info->user_session_key, + vuser->session_info->user_session_key, response_blob); } /* fill in the current_user_info struct */ set_current_user_info( - vuser->server_info->sanitized_username, - vuser->server_info->unix_name, - vuser->server_info->info3->base.domain.string); + vuser->session_info->sanitized_username, + vuser->session_info->unix_name, + vuser->session_info->info3->base.domain.string); return vuser->vuid; diff --git a/source3/smbd/pipes.c b/source3/smbd/pipes.c index 9f31abe569c..73398abcd81 100644 --- a/source3/smbd/pipes.c +++ b/source3/smbd/pipes.c @@ -71,7 +71,7 @@ NTSTATUS open_np_file(struct smb_request *smb_req, const char *name, conn->sconn->local_address, conn->sconn->remote_address, &conn->sconn->client_id, - conn->server_info, + conn->session_info, conn->sconn->msg_ctx, &fsp->fake_file_handle); if (!NT_STATUS_IS_OK(status)) { diff --git a/source3/smbd/process.c b/source3/smbd/process.c index 20569d858c4..6ba41a3b8df 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -1477,9 +1477,9 @@ static connection_struct *switch_message(uint8 type, struct smb_request *req, in vuser = get_valid_user_struct(sconn, session_tag); if (vuser) { set_current_user_info( - vuser->server_info->sanitized_username, - vuser->server_info->unix_name, - vuser->server_info->info3->base.domain.string); + vuser->session_info->sanitized_username, + vuser->session_info->unix_name, + vuser->session_info->info3->base.domain.string); } } } diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index dea265f6793..561281f9ed2 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -2531,7 +2531,7 @@ static NTSTATUS do_unlink(connection_struct *conn, } /* The set is across all open files on this dev/inode pair. */ - if (!set_delete_on_close(fsp, True, &conn->server_info->utok)) { + if (!set_delete_on_close(fsp, True, &conn->session_info->utok)) { close_file(req, fsp, NORMAL_CLOSE); return NT_STATUS_ACCESS_DENIED; } @@ -5333,7 +5333,7 @@ void reply_printqueue(struct smb_request *req) status = rpc_pipe_open_interface(conn, &ndr_table_spoolss.syntax_id, - conn->server_info, + conn->session_info, &conn->sconn->client_id, conn->sconn->msg_ctx, &cli); @@ -5649,7 +5649,7 @@ void reply_rmdir(struct smb_request *req) goto out; } - if (!set_delete_on_close(fsp, true, &conn->server_info->utok)) { + if (!set_delete_on_close(fsp, true, &conn->session_info->utok)) { close_file(req, fsp, ERROR_CLOSE); reply_nterror(req, NT_STATUS_ACCESS_DENIED); goto out; diff --git a/source3/smbd/server_reload.c b/source3/smbd/server_reload.c index bdca29d0bf9..f60130bd11e 100644 --- a/source3/smbd/server_reload.c +++ b/source3/smbd/server_reload.c @@ -33,7 +33,7 @@ void reload_printers(struct tevent_context *ev, struct messaging_context *msg_ctx) { - struct auth_serversupplied_info *server_info = NULL; + struct auth_serversupplied_info *session_info = NULL; struct spoolss_PrinterInfo2 *pinfo2 = NULL; int snum; int n_services = lp_numservices(); @@ -45,10 +45,10 @@ void reload_printers(struct tevent_context *ev, SMB_ASSERT(pcap_cache_loaded()); DEBUG(10, ("reloading printer services from pcap cache\n")); - status = make_server_info_system(talloc_tos(), &server_info); + status = make_session_info_system(talloc_tos(), &session_info); if (!NT_STATUS_IS_OK(status)) { DEBUG(3, ("reload_printers: " - "Could not create system server_info\n")); + "Could not create system session_info\n")); /* can't remove stale printers before we * are fully initilized */ skip = true; @@ -65,18 +65,18 @@ void reload_printers(struct tevent_context *ev, if (!pcap_printername_ok(pname)) { DEBUG(3, ("removing stale printer %s\n", pname)); - if (is_printer_published(server_info, server_info, + if (is_printer_published(session_info, session_info, msg_ctx, NULL, lp_servicename(snum), NULL, &pinfo2)) { - nt_printer_publish(server_info, - server_info, + nt_printer_publish(session_info, + session_info, msg_ctx, pinfo2, DSPRINT_UNPUBLISH); TALLOC_FREE(pinfo2); } - nt_printer_remove(server_info, server_info, msg_ctx, + nt_printer_remove(session_info, session_info, msg_ctx, pname); lp_killservice(snum); } @@ -84,7 +84,7 @@ void reload_printers(struct tevent_context *ev, load_printers(ev, msg_ctx); - TALLOC_FREE(server_info); + TALLOC_FREE(session_info); } /**************************************************************************** diff --git a/source3/smbd/service.c b/source3/smbd/service.c index dfe2c2141ff..41e31dc0d14 100644 --- a/source3/smbd/service.c +++ b/source3/smbd/service.c @@ -585,7 +585,7 @@ static NTSTATUS find_forced_group(bool force_user, Create an auth_serversupplied_info structure for a connection_struct ****************************************************************************/ -static NTSTATUS create_connection_server_info(struct smbd_server_connection *sconn, +static NTSTATUS create_connection_session_info(struct smbd_server_connection *sconn, TALLOC_CTX *mem_ctx, int snum, struct auth_serversupplied_info *vuid_serverinfo, DATA_BLOB password, @@ -696,12 +696,12 @@ connection_struct *make_connection_snum(struct smbd_server_connection *sconn, conn->params->service = snum; - status = create_connection_server_info(sconn, - conn, snum, vuser ? vuser->server_info : NULL, password, - &conn->server_info); + status = create_connection_session_info(sconn, + conn, snum, vuser ? vuser->session_info : NULL, password, + &conn->session_info); if (!NT_STATUS_IS_OK(status)) { - DEBUG(1, ("create_connection_server_info failed: %s\n", + DEBUG(1, ("create_connection_session_info failed: %s\n", nt_errstr(status))); *pstatus = status; goto err_root_exit; @@ -711,7 +711,7 @@ connection_struct *make_connection_snum(struct smbd_server_connection *sconn, conn->force_user = true; } - add_session_user(sconn, conn->server_info->unix_name); + add_session_user(sconn, conn->session_info->unix_name); conn->num_files_open = 0; conn->lastused = conn->lastused_count = time(NULL); @@ -744,7 +744,7 @@ connection_struct *make_connection_snum(struct smbd_server_connection *sconn, if (*lp_force_user(snum)) { /* - * Replace conn->server_info with a completely faked up one + * Replace conn->session_info with a completely faked up one * from the username we are forced into :-) */ @@ -759,15 +759,15 @@ connection_struct *make_connection_snum(struct smbd_server_connection *sconn, } status = make_serverinfo_from_username( - conn, fuser, conn->server_info->guest, + conn, fuser, conn->session_info->guest, &forced_serverinfo); if (!NT_STATUS_IS_OK(status)) { *pstatus = status; goto err_root_exit; } - TALLOC_FREE(conn->server_info); - conn->server_info = forced_serverinfo; + TALLOC_FREE(conn->session_info); + conn->session_info = forced_serverinfo; conn->force_user = True; DEBUG(3,("Forced user %s\n", fuser)); @@ -781,9 +781,9 @@ connection_struct *make_connection_snum(struct smbd_server_connection *sconn, if (*lp_force_group(snum)) { status = find_forced_group( - conn->force_user, snum, conn->server_info->unix_name, - &conn->server_info->security_token->sids[1], - &conn->server_info->utok.gid); + conn->force_user, snum, conn->session_info->unix_name, + &conn->session_info->security_token->sids[1], + &conn->session_info->utok.gid); if (!NT_STATUS_IS_OK(status)) { *pstatus = status; @@ -792,11 +792,11 @@ connection_struct *make_connection_snum(struct smbd_server_connection *sconn, /* * 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 + * change_to_user() separately from the conn->session_info + * struct. We only use conn->session_info directly if * "force_user" was set. */ - conn->force_group_gid = conn->server_info->utok.gid; + conn->force_group_gid = conn->session_info->utok.gid; } conn->vuid = (vuser != NULL) ? vuser->vuid : UID_FIELD_INVALID; @@ -804,11 +804,11 @@ connection_struct *make_connection_snum(struct smbd_server_connection *sconn, { char *s = talloc_sub_advanced(talloc_tos(), lp_servicename(SNUM(conn)), - conn->server_info->unix_name, + conn->session_info->unix_name, conn->connectpath, - conn->server_info->utok.gid, - conn->server_info->sanitized_username, - conn->server_info->info3->base.domain.string, + conn->session_info->utok.gid, + conn->session_info->sanitized_username, + conn->session_info->info3->base.domain.string, lp_pathname(snum)); if (!s) { *pstatus = NT_STATUS_NO_MEMORY; @@ -835,12 +835,12 @@ connection_struct *make_connection_snum(struct smbd_server_connection *sconn, { bool can_write = False; - can_write = share_access_check(conn->server_info->security_token, + can_write = share_access_check(conn->session_info->security_token, lp_servicename(snum), FILE_WRITE_DATA); if (!can_write) { - if (!share_access_check(conn->server_info->security_token, + if (!share_access_check(conn->session_info->security_token, lp_servicename(snum), FILE_READ_DATA)) { /* No access, read or write. */ @@ -897,7 +897,7 @@ connection_struct *make_connection_snum(struct smbd_server_connection *sconn, filesystem operation that we do. */ if (SMB_VFS_CONNECT(conn, lp_servicename(snum), - conn->server_info->unix_name) < 0) { + conn->session_info->unix_name) < 0) { DEBUG(0,("make_connection: VFS make connection failed!\n")); *pstatus = NT_STATUS_UNSUCCESSFUL; goto err_root_exit; @@ -932,11 +932,11 @@ connection_struct *make_connection_snum(struct smbd_server_connection *sconn, if (*lp_rootpreexec(snum)) { char *cmd = talloc_sub_advanced(talloc_tos(), lp_servicename(SNUM(conn)), - conn->server_info->unix_name, + conn->session_info->unix_name, conn->connectpath, - conn->server_info->utok.gid, - conn->server_info->sanitized_username, - conn->server_info->info3->base.domain.string, + conn->session_info->utok.gid, + conn->session_info->sanitized_username, + conn->session_info->info3->base.domain.string, lp_rootpreexec(snum)); DEBUG(5,("cmd=%s\n",cmd)); ret = smbrun(cmd,NULL); @@ -970,11 +970,11 @@ connection_struct *make_connection_snum(struct smbd_server_connection *sconn, if (*lp_preexec(snum)) { char *cmd = talloc_sub_advanced(talloc_tos(), lp_servicename(SNUM(conn)), - conn->server_info->unix_name, + conn->session_info->unix_name, conn->connectpath, - conn->server_info->utok.gid, - conn->server_info->sanitized_username, - conn->server_info->info3->base.domain.string, + conn->session_info->utok.gid, + conn->session_info->sanitized_username, + conn->session_info->info3->base.domain.string, lp_preexec(snum)); ret = smbrun(cmd,NULL); TALLOC_FREE(cmd); @@ -1077,7 +1077,7 @@ connection_struct *make_connection_snum(struct smbd_server_connection *sconn, dbgtext( "%s", srv_is_signing_active(sconn) ? "signed " : ""); dbgtext( "connect to service %s ", lp_servicename(snum) ); dbgtext( "initially as user %s ", - conn->server_info->unix_name ); + conn->session_info->unix_name ); dbgtext( "(uid=%d, gid=%d) ", (int)effuid, (int)effgid ); dbgtext( "(pid %d)\n", (int)sys_getpid() ); } @@ -1288,11 +1288,11 @@ void close_cnum(connection_struct *conn, uint16 vuid) change_to_user(conn, vuid)) { char *cmd = talloc_sub_advanced(talloc_tos(), lp_servicename(SNUM(conn)), - conn->server_info->unix_name, + conn->session_info->unix_name, conn->connectpath, - conn->server_info->utok.gid, - conn->server_info->sanitized_username, - conn->server_info->info3->base.domain.string, + conn->session_info->utok.gid, + conn->session_info->sanitized_username, + conn->session_info->info3->base.domain.string, lp_postexec(SNUM(conn))); smbrun(cmd,NULL); TALLOC_FREE(cmd); @@ -1304,11 +1304,11 @@ void close_cnum(connection_struct *conn, uint16 vuid) if (*lp_rootpostexec(SNUM(conn))) { char *cmd = talloc_sub_advanced(talloc_tos(), lp_servicename(SNUM(conn)), - conn->server_info->unix_name, + conn->session_info->unix_name, conn->connectpath, - conn->server_info->utok.gid, - conn->server_info->sanitized_username, - conn->server_info->info3->base.domain.string, + conn->session_info->utok.gid, + conn->session_info->sanitized_username, + conn->session_info->info3->base.domain.string, lp_rootpostexec(SNUM(conn))); smbrun(cmd,NULL); TALLOC_FREE(cmd); diff --git a/source3/smbd/session.c b/source3/smbd/session.c index 185ba800bec..93cfba3b05f 100644 --- a/source3/smbd/session.c +++ b/source3/smbd/session.c @@ -48,7 +48,7 @@ bool session_claim(struct smbd_server_connection *sconn, user_struct *vuser) /* don't register sessions for the guest user - its just too expensive to go through pam session code for browsing etc */ - if (vuser->server_info->guest) { + if (vuser->session_info->guest) { return True; } @@ -131,12 +131,12 @@ bool session_claim(struct smbd_server_connection *sconn, user_struct *vuser) client_name() handles this case internally. */ - fstrcpy(sessionid.username, vuser->server_info->unix_name); + fstrcpy(sessionid.username, vuser->session_info->unix_name); fstrcpy(sessionid.hostname, sconn->client_id.name); sessionid.id_num = i; /* Only valid for utmp sessions */ sessionid.pid = pid; - sessionid.uid = vuser->server_info->utok.uid; - sessionid.gid = vuser->server_info->utok.gid; + sessionid.uid = vuser->session_info->utok.uid; + sessionid.gid = vuser->session_info->utok.gid; fstrcpy(sessionid.remote_machine, get_remote_machine_name()); fstrcpy(sessionid.ip_addr_str, sconn->client_id.addr); sessionid.connect_start = time(NULL); diff --git a/source3/smbd/sesssetup.c b/source3/smbd/sesssetup.c index 5a1776e6986..d9333502b87 100644 --- a/source3/smbd/sesssetup.c +++ b/source3/smbd/sesssetup.c @@ -474,19 +474,19 @@ static void reply_spnego_ntlmssp(struct smb_request *req, { bool do_invalidate = true; DATA_BLOB response; - struct auth_serversupplied_info *server_info = NULL; + struct auth_serversupplied_info *session_info = NULL; struct smbd_server_connection *sconn = req->sconn; if (NT_STATUS_IS_OK(nt_status)) { - nt_status = auth_ntlmssp_steal_server_info(talloc_tos(), - (*auth_ntlmssp_state), &server_info); + nt_status = auth_ntlmssp_steal_session_info(talloc_tos(), + (*auth_ntlmssp_state), &session_info); } else { - /* Note that this server_info won't have a session + /* Note that this session_info won't have a session * key. But for map to guest, that's exactly the right * thing - we can't reasonably guess the key the * client wants, as the password was wrong */ nt_status = do_map_to_guest(nt_status, - &server_info, + &session_info, auth_ntlmssp_get_username(*auth_ntlmssp_state), auth_ntlmssp_get_domain(*auth_ntlmssp_state)); } @@ -505,7 +505,7 @@ static void reply_spnego_ntlmssp(struct smb_request *req, /* register_existing_vuid keeps the server info */ if (register_existing_vuid(sconn, vuid, - server_info, nullblob, + session_info, nullblob, auth_ntlmssp_get_username(*auth_ntlmssp_state)) != vuid) { /* The problem is, *auth_ntlmssp_state points @@ -522,7 +522,7 @@ static void reply_spnego_ntlmssp(struct smb_request *req, SSVAL(req->outbuf, smb_vwv3, 0); - if (server_info->guest) { + if (session_info->guest) { SSVAL(req->outbuf,smb_vwv2,1); } } diff --git a/source3/smbd/smb2_sesssetup.c b/source3/smbd/smb2_sesssetup.c index 7d029151bca..d1ebe9b673a 100644 --- a/source3/smbd/smb2_sesssetup.c +++ b/source3/smbd/smb2_sesssetup.c @@ -146,20 +146,20 @@ static int smbd_smb2_session_destructor(struct smbd_smb2_session *session) return 0; } -static NTSTATUS setup_ntlmssp_server_info(struct smbd_smb2_session *session, +static NTSTATUS setup_ntlmssp_session_info(struct smbd_smb2_session *session, NTSTATUS status) { if (NT_STATUS_IS_OK(status)) { - status = auth_ntlmssp_steal_server_info(session, + status = auth_ntlmssp_steal_session_info(session, session->auth_ntlmssp_state, - &session->server_info); + &session->session_info); } else { - /* Note that this server_info won't have a session + /* Note that this session_info won't have a session * key. But for map to guest, that's exactly the right * thing - we can't reasonably guess the key the * client wants, as the password was wrong */ status = do_map_to_guest(status, - &session->server_info, + &session->session_info, auth_ntlmssp_get_username(session->auth_ntlmssp_state), auth_ntlmssp_get_domain(session->auth_ntlmssp_state)); } @@ -236,20 +236,20 @@ static NTSTATUS smbd_smb2_session_setup_krb5(struct smbd_smb2_session *session, status = make_server_info_krb5(session, user, domain, real_username, pw, logon_info, map_domainuser_to_guest, - &session->server_info); + &session->session_info); if (!NT_STATUS_IS_OK(status)) { DEBUG(1, ("smb2: make_server_info_krb5 failed\n")); goto fail; } - session->server_info->nss_token |= username_was_mapped; + session->session_info->nss_token |= username_was_mapped; - /* we need to build the token for the user. make_server_info_guest() + /* we need to build the token for the user. make_session_info_guest() already does this */ - if (!session->server_info->security_token ) { - status = create_local_token(session->server_info); + if (!session->session_info->security_token ) { + status = create_local_token(session->session_info); if (!NT_STATUS_IS_OK(status)) { DEBUG(10,("smb2: failed to create local token: %s\n", nt_errstr(status))); @@ -262,7 +262,7 @@ static NTSTATUS smbd_smb2_session_setup_krb5(struct smbd_smb2_session *session, session->do_signing = true; } - if (session->server_info->guest) { + if (session->session_info->guest) { /* we map anonymous to guest internally */ *out_session_flags |= SMB2_SESSION_FLAG_IS_GUEST; *out_session_flags |= SMB2_SESSION_FLAG_IS_NULL; @@ -270,19 +270,19 @@ static NTSTATUS smbd_smb2_session_setup_krb5(struct smbd_smb2_session *session, session->do_signing = false; } - data_blob_free(&session->server_info->user_session_key); - session->server_info->user_session_key = + data_blob_free(&session->session_info->user_session_key); + session->session_info->user_session_key = data_blob_talloc( - session->server_info, + session->session_info, session_key.data, session_key.length); if (session_key.length > 0) { - if (session->server_info->user_session_key.data == NULL) { + if (session->session_info->user_session_key.data == NULL) { status = NT_STATUS_NO_MEMORY; goto fail; } } - session->session_key = session->server_info->user_session_key; + session->session_key = session->session_info->user_session_key; session->compat_vuser = talloc_zero(session, user_struct); if (session->compat_vuser == NULL) { @@ -291,19 +291,19 @@ static NTSTATUS smbd_smb2_session_setup_krb5(struct smbd_smb2_session *session, } session->compat_vuser->auth_ntlmssp_state = NULL; session->compat_vuser->homes_snum = -1; - session->compat_vuser->server_info = session->server_info; + session->compat_vuser->session_info = session->session_info; session->compat_vuser->session_keystr = NULL; session->compat_vuser->vuid = session->vuid; DLIST_ADD(session->sconn->smb1.sessions.validated_users, session->compat_vuser); /* This is a potentially untrusted username */ alpha_strcpy(tmp, user, ". _-$", sizeof(tmp)); - session->server_info->sanitized_username = - talloc_strdup(session->server_info, tmp); + session->session_info->sanitized_username = + talloc_strdup(session->session_info, tmp); - if (!session->server_info->guest) { + if (!session->session_info->guest) { session->compat_vuser->homes_snum = - register_homes_share(session->server_info->unix_name); + register_homes_share(session->session_info->unix_name); } if (!session_claim(session->sconn, session->compat_vuser)) { @@ -480,7 +480,7 @@ static NTSTATUS smbd_smb2_common_ntlmssp_auth_return(struct smbd_smb2_session *s session->do_signing = true; } - if (session->server_info->guest) { + if (session->session_info->guest) { /* we map anonymous to guest internally */ *out_session_flags |= SMB2_SESSION_FLAG_IS_GUEST; *out_session_flags |= SMB2_SESSION_FLAG_IS_NULL; @@ -488,7 +488,7 @@ static NTSTATUS smbd_smb2_common_ntlmssp_auth_return(struct smbd_smb2_session *s session->do_signing = false; } - session->session_key = session->server_info->user_session_key; + session->session_key = session->session_info->user_session_key; session->compat_vuser = talloc_zero(session, user_struct); if (session->compat_vuser == NULL) { @@ -498,7 +498,7 @@ static NTSTATUS smbd_smb2_common_ntlmssp_auth_return(struct smbd_smb2_session *s } session->compat_vuser->auth_ntlmssp_state = session->auth_ntlmssp_state; session->compat_vuser->homes_snum = -1; - session->compat_vuser->server_info = session->server_info; + session->compat_vuser->session_info = session->session_info; session->compat_vuser->session_keystr = NULL; session->compat_vuser->vuid = session->vuid; DLIST_ADD(session->sconn->smb1.sessions.validated_users, session->compat_vuser); @@ -508,12 +508,12 @@ static NTSTATUS smbd_smb2_common_ntlmssp_auth_return(struct smbd_smb2_session *s auth_ntlmssp_get_username(session->auth_ntlmssp_state), ". _-$", sizeof(tmp)); - session->server_info->sanitized_username = talloc_strdup( - session->server_info, tmp); + session->session_info->sanitized_username = talloc_strdup( + session->session_info, tmp); - if (!session->compat_vuser->server_info->guest) { + if (!session->compat_vuser->session_info->guest) { session->compat_vuser->homes_snum = - register_homes_share(session->server_info->unix_name); + register_homes_share(session->session_info->unix_name); } if (!session_claim(session->sconn, session->compat_vuser)) { @@ -624,11 +624,11 @@ static NTSTATUS smbd_smb2_spnego_auth(struct smbd_smb2_session *session, status = auth_ntlmssp_update(session->auth_ntlmssp_state, auth, &auth_out); - /* We need to call setup_ntlmssp_server_info() if status==NT_STATUS_OK, + /* We need to call setup_ntlmssp_session_info() if status==NT_STATUS_OK, or if status is anything except NT_STATUS_MORE_PROCESSING_REQUIRED, as this can trigger map to guest. */ if (!NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED)) { - status = setup_ntlmssp_server_info(session, status); + status = setup_ntlmssp_session_info(session, status); } if (!NT_STATUS_IS_OK(status) && @@ -706,7 +706,7 @@ static NTSTATUS smbd_smb2_raw_ntlmssp_auth(struct smbd_smb2_session *session, return status; } - status = setup_ntlmssp_server_info(session, status); + status = setup_ntlmssp_session_info(session, status); if (!NT_STATUS_IS_OK(status)) { TALLOC_FREE(session->auth_ntlmssp_state); @@ -857,9 +857,9 @@ NTSTATUS smbd_smb2_request_check_session(struct smbd_smb2_request *req) return NT_STATUS_ACCESS_DENIED; } - set_current_user_info(session->server_info->sanitized_username, - session->server_info->unix_name, - session->server_info->info3->base.domain.string); + set_current_user_info(session->session_info->sanitized_username, + session->session_info->unix_name, + session->session_info->info3->base.domain.string); req->session = session; diff --git a/source3/smbd/smb2_tcon.c b/source3/smbd/smb2_tcon.c index 82d9a280842..01c7e01c65e 100644 --- a/source3/smbd/smb2_tcon.c +++ b/source3/smbd/smb2_tcon.c @@ -183,7 +183,7 @@ static NTSTATUS smbd_smb2_tree_connect(struct smbd_smb2_request *req, "user %s because it was not found " "or created at session setup " "time\n", - compat_vuser->server_info->unix_name)); + compat_vuser->session_info->unix_name)); return NT_STATUS_BAD_NETWORK_NAME; } snum = compat_vuser->homes_snum; diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 32c557826ed..12cbc3b9e9e 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -3199,11 +3199,11 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned fsp.fnum = -1; /* access check */ - if (conn->server_info->utok.uid != sec_initial_uid()) { + if (conn->session_info->utok.uid != sec_initial_uid()) { DEBUG(0,("set_user_quota: access_denied " "service [%s] user [%s]\n", lp_servicename(SNUM(conn)), - conn->server_info->unix_name)); + conn->session_info->unix_name)); return NT_STATUS_ACCESS_DENIED; } @@ -3356,7 +3356,7 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned * in our list of SIDs. */ if (nt_token_check_sid(&global_sid_Builtin_Guests, - conn->server_info->security_token)) { + conn->session_info->security_token)) { flags |= SMB_WHOAMI_GUEST; } @@ -3364,7 +3364,7 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned * is in our list of SIDs. */ if (nt_token_check_sid(&global_sid_Authenticated_Users, - conn->server_info->security_token)) { + conn->session_info->security_token)) { flags &= ~SMB_WHOAMI_GUEST; } @@ -3380,18 +3380,18 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned + 4 /* num_sids */ + 4 /* SID bytes */ + 4 /* pad/reserved */ - + (conn->server_info->utok.ngroups * 8) + + (conn->session_info->utok.ngroups * 8) /* groups list */ - + (conn->server_info->security_token->num_sids * + + (conn->session_info->security_token->num_sids * SID_MAX_SIZE) /* SID list */; SIVAL(pdata, 0, flags); SIVAL(pdata, 4, SMB_WHOAMI_MASK); SBIG_UINT(pdata, 8, - (uint64_t)conn->server_info->utok.uid); + (uint64_t)conn->session_info->utok.uid); SBIG_UINT(pdata, 16, - (uint64_t)conn->server_info->utok.gid); + (uint64_t)conn->session_info->utok.gid); if (data_len >= max_data_bytes) { @@ -3406,17 +3406,17 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned break; } - SIVAL(pdata, 24, conn->server_info->utok.ngroups); - SIVAL(pdata, 28, conn->server_info->security_token->num_sids); + SIVAL(pdata, 24, conn->session_info->utok.ngroups); + SIVAL(pdata, 28, conn->session_info->security_token->num_sids); /* We walk the SID list twice, but this call is fairly * infrequent, and I don't expect that it's performance * sensitive -- jpeach */ for (i = 0, sid_bytes = 0; - i < conn->server_info->security_token->num_sids; ++i) { + i < conn->session_info->security_token->num_sids; ++i) { sid_bytes += ndr_size_dom_sid( - &conn->server_info->security_token->sids[i], + &conn->session_info->security_token->sids[i], 0); } @@ -3428,21 +3428,21 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned data_len = 40; /* GID list */ - for (i = 0; i < conn->server_info->utok.ngroups; ++i) { + for (i = 0; i < conn->session_info->utok.ngroups; ++i) { SBIG_UINT(pdata, data_len, - (uint64_t)conn->server_info->utok.groups[i]); + (uint64_t)conn->session_info->utok.groups[i]); data_len += 8; } /* SID list */ for (i = 0; - i < conn->server_info->security_token->num_sids; ++i) { + i < conn->session_info->security_token->num_sids; ++i) { int sid_len = ndr_size_dom_sid( - &conn->server_info->security_token->sids[i], + &conn->session_info->security_token->sids[i], 0); sid_linearize(pdata + data_len, sid_len, - &conn->server_info->security_token->sids[i]); + &conn->session_info->security_token->sids[i]); data_len += sid_len; } @@ -3694,11 +3694,11 @@ cap_low = 0x%x, cap_high = 0x%x\n", ZERO_STRUCT(quotas); /* access check */ - if ((conn->server_info->utok.uid != sec_initial_uid()) + if ((conn->session_info->utok.uid != sec_initial_uid()) ||!CAN_WRITE(conn)) { DEBUG(0,("set_user_quota: access_denied service [%s] user [%s]\n", lp_servicename(SNUM(conn)), - conn->server_info->unix_name)); + conn->session_info->unix_name)); reply_nterror(req, NT_STATUS_ACCESS_DENIED); return; } @@ -5838,7 +5838,7 @@ static NTSTATUS smb_set_file_disposition_info(connection_struct *conn, /* The set is across all open files on this dev/inode pair. */ if (!set_delete_on_close(fsp, delete_on_close, - &conn->server_info->utok)) { + &conn->session_info->utok)) { return NT_STATUS_ACCESS_DENIED; } return NT_STATUS_OK; diff --git a/source3/smbd/uid.c b/source3/smbd/uid.c index 87d85eff832..0890ae698cf 100644 --- a/source3/smbd/uid.c +++ b/source3/smbd/uid.c @@ -55,10 +55,10 @@ bool change_to_guest(void) } /**************************************************************************** - talloc free the conn->server_info if not used in the vuid cache. + talloc free the conn->session_info if not used in the vuid cache. ****************************************************************************/ -static void free_conn_server_info_if_unused(connection_struct *conn) +static void free_conn_session_info_if_unused(connection_struct *conn) { unsigned int i; @@ -66,24 +66,24 @@ static void free_conn_server_info_if_unused(connection_struct *conn) struct vuid_cache_entry *ent; ent = &conn->vuid_cache.array[i]; if (ent->vuid != UID_FIELD_INVALID && - conn->server_info == ent->server_info) { + conn->session_info == ent->session_info) { return; } } /* Not used, safe to free. */ - TALLOC_FREE(conn->server_info); + TALLOC_FREE(conn->session_info); } /******************************************************************* Check if a username is OK. - This sets up conn->server_info with a copy related to this vuser that + This sets up conn->session_info with a copy related to this vuser that later code can then mess with. ********************************************************************/ static bool check_user_ok(connection_struct *conn, uint16_t vuid, - const struct auth_serversupplied_info *server_info, + const struct auth_serversupplied_info *session_info, int snum) { bool valid_vuid = (vuid != UID_FIELD_INVALID); @@ -97,27 +97,27 @@ static bool check_user_ok(connection_struct *conn, for (i=0; i<VUID_CACHE_SIZE; i++) { ent = &conn->vuid_cache.array[i]; if (ent->vuid == vuid) { - free_conn_server_info_if_unused(conn); - conn->server_info = ent->server_info; + free_conn_session_info_if_unused(conn); + conn->session_info = ent->session_info; conn->read_only = ent->read_only; return(True); } } } - if (!user_ok_token(server_info->unix_name, - server_info->info3->base.domain.string, - server_info->security_token, snum)) + if (!user_ok_token(session_info->unix_name, + session_info->info3->base.domain.string, + session_info->security_token, snum)) return(False); readonly_share = is_share_read_only_for_token( - server_info->unix_name, - server_info->info3->base.domain.string, - server_info->security_token, + session_info->unix_name, + session_info->info3->base.domain.string, + session_info->security_token, conn); if (!readonly_share && - !share_access_check(server_info->security_token, lp_servicename(snum), + !share_access_check(session_info->security_token, lp_servicename(snum), FILE_WRITE_DATA)) { /* smb.conf allows r/w, but the security descriptor denies * write. Fall back to looking at readonly. */ @@ -126,16 +126,16 @@ static bool check_user_ok(connection_struct *conn, "security descriptor\n")); } - if (!share_access_check(server_info->security_token, lp_servicename(snum), + if (!share_access_check(session_info->security_token, lp_servicename(snum), readonly_share ? FILE_READ_DATA : FILE_WRITE_DATA)) { return False; } admin_user = token_contains_name_in_list( - server_info->unix_name, - server_info->info3->base.domain.string, - NULL, server_info->security_token, lp_admin_users(snum)); + session_info->unix_name, + session_info->info3->base.domain.string, + NULL, session_info->security_token, lp_admin_users(snum)); if (valid_vuid) { struct vuid_cache_entry *ent = @@ -144,34 +144,34 @@ static bool check_user_ok(connection_struct *conn, conn->vuid_cache.next_entry = (conn->vuid_cache.next_entry + 1) % VUID_CACHE_SIZE; - TALLOC_FREE(ent->server_info); + TALLOC_FREE(ent->session_info); /* - * If force_user was set, all server_info's are based on the same + * If force_user was set, all session_info's are based on the same * username-based faked one. */ - ent->server_info = copy_serverinfo( - conn, conn->force_user ? conn->server_info : server_info); + ent->session_info = copy_serverinfo( + conn, conn->force_user ? conn->session_info : session_info); - if (ent->server_info == NULL) { + if (ent->session_info == NULL) { ent->vuid = UID_FIELD_INVALID; return false; } ent->vuid = vuid; ent->read_only = readonly_share; - free_conn_server_info_if_unused(conn); - conn->server_info = ent->server_info; + free_conn_session_info_if_unused(conn); + conn->session_info = ent->session_info; } conn->read_only = readonly_share; if (admin_user) { DEBUG(2,("check_user_ok: user %s is an admin user. " "Setting uid as %d\n", - conn->server_info->unix_name, + conn->session_info->unix_name, sec_initial_uid() )); - conn->server_info->utok.uid = sec_initial_uid(); + conn->session_info->utok.uid = sec_initial_uid(); } return(True); @@ -194,27 +194,27 @@ void conn_clear_vuid_cache(connection_struct *conn, uint16_t vuid) if (ent->vuid == vuid) { ent->vuid = UID_FIELD_INVALID; /* - * We need to keep conn->server_info around - * if it's equal to ent->server_info as a SMBulogoff + * We need to keep conn->session_info around + * if it's equal to ent->session_info as a SMBulogoff * is often followed by a SMBtdis (with an invalid * vuid). The debug code (or regular code in * vfs_full_audit) wants to refer to the - * conn->server_info pointer to print debug + * conn->session_info pointer to print debug * statements. Theoretically this is a bug, - * as once the vuid is gone the server_info + * as once the vuid is gone the session_info * on the conn struct isn't valid any more, * but there's enough code that assumes - * conn->server_info is never null that + * conn->session_info is never null that * it's easier to hold onto the old pointer * until we get a new sessionsetupX. * As everything is hung off the * conn pointer as a talloc context we're not * leaking memory here. See bug #6315. JRA. */ - if (conn->server_info == ent->server_info) { - ent->server_info = NULL; + if (conn->session_info == ent->session_info) { + ent->session_info = NULL; } else { - TALLOC_FREE(ent->server_info); + TALLOC_FREE(ent->session_info); } ent->read_only = False; } @@ -228,7 +228,7 @@ void conn_clear_vuid_cache(connection_struct *conn, uint16_t vuid) bool change_to_user(connection_struct *conn, uint16 vuid) { - const struct auth_serversupplied_info *server_info = NULL; + const struct auth_serversupplied_info *session_info = NULL; user_struct *vuser; int snum; gid_t gid; @@ -252,13 +252,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->utok.uid)) { + (current_user.ut.uid == conn->session_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->utok.uid)) { + (current_user.ut.uid == vuser->session_info->utok.uid)) { DEBUG(4,("change_to_user: Skipping user change - already " "user\n")); return(True); @@ -266,20 +266,20 @@ bool change_to_user(connection_struct *conn, uint16 vuid) snum = SNUM(conn); - server_info = vuser ? vuser->server_info : conn->server_info; + session_info = vuser ? vuser->session_info : conn->session_info; - if (!server_info) { + if (!session_info) { /* Invalid vuid sent - even with security = share. */ DEBUG(2,("change_to_user: Invalid vuid %d used on " "share %s.\n",vuid, lp_servicename(snum) )); return false; } - if (!check_user_ok(conn, vuid, server_info, snum)) { + if (!check_user_ok(conn, vuid, session_info, snum)) { DEBUG(2,("change_to_user: SMB user %s (unix user %s, vuid %d) " "not permitted access to share %s.\n", - server_info->sanitized_username, - server_info->unix_name, vuid, + session_info->sanitized_username, + session_info->unix_name, vuid, lp_servicename(snum))); return false; } @@ -292,14 +292,14 @@ bool change_to_user(connection_struct *conn, uint16 vuid) } /* - * conn->server_info is now correctly set up with a copy we can mess + * conn->session_info is now correctly set up with a copy we can mess * with for force_group etc. */ - uid = conn->server_info->utok.uid; - gid = conn->server_info->utok.gid; - num_groups = conn->server_info->utok.ngroups; - group_list = conn->server_info->utok.groups; + uid = conn->session_info->utok.uid; + gid = conn->session_info->utok.gid; + num_groups = conn->session_info->utok.ngroups; + group_list = conn->session_info->utok.groups; /* * See if we should force group for this service. @@ -324,18 +324,18 @@ bool change_to_user(connection_struct *conn, uint16 vuid) for (i = 0; i < num_groups; i++) { if (group_list[i] == conn->force_group_gid) { - conn->server_info->utok.gid = + conn->session_info->utok.gid = conn->force_group_gid; gid = conn->force_group_gid; - gid_to_sid(&conn->server_info->security_token + gid_to_sid(&conn->session_info->security_token ->sids[1], gid); break; } } } else { - conn->server_info->utok.gid = conn->force_group_gid; + conn->session_info->utok.gid = conn->force_group_gid; gid = conn->force_group_gid; - gid_to_sid(&conn->server_info->security_token->sids[1], + gid_to_sid(&conn->session_info->security_token->sids[1], gid); } } @@ -347,7 +347,7 @@ bool change_to_user(connection_struct *conn, uint16 vuid) current_user.ut.groups = group_list; set_sec_ctx(uid, gid, current_user.ut.ngroups, current_user.ut.groups, - conn->server_info->security_token); + conn->session_info->security_token); current_user.conn = conn; current_user.vuid = vuid; @@ -387,9 +387,9 @@ bool become_authenticated_pipe_user(struct pipes_struct *p) if (!push_sec_ctx()) return False; - set_sec_ctx(p->server_info->utok.uid, p->server_info->utok.gid, - p->server_info->utok.ngroups, p->server_info->utok.groups, - p->server_info->security_token); + set_sec_ctx(p->session_info->utok.uid, p->session_info->utok.gid, + p->session_info->utok.ngroups, p->session_info->utok.groups, + p->session_info->security_token); return True; } @@ -510,7 +510,7 @@ bool unbecome_user(void) /**************************************************************************** Return the current user we are running effectively as on this connection. - I'd like to make this return conn->server_info->utok.uid, but become_root() + I'd like to make this return conn->session_info->utok.uid, but become_root() doesn't alter this value. ****************************************************************************/ @@ -521,7 +521,7 @@ uid_t get_current_uid(connection_struct *conn) /**************************************************************************** Return the current group we are running effectively as on this connection. - I'd like to make this return conn->server_info->utok.gid, but become_root() + I'd like to make this return conn->session_info->utok.gid, but become_root() doesn't alter this value. ****************************************************************************/ @@ -532,7 +532,7 @@ gid_t get_current_gid(connection_struct *conn) /**************************************************************************** Return the UNIX token we are running effectively as on this connection. - I'd like to make this return &conn->server_info->utok, but become_root() + I'd like to make this return &conn->session_info->utok, but become_root() doesn't alter this value. ****************************************************************************/ |