diff options
author | Andrew Bartlett <abartlet@samba.org> | 2011-07-15 14:59:14 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2011-07-20 09:17:10 +1000 |
commit | 6d741e918f145c6ec62c22358aabc8162db108fd (patch) | |
tree | 4d562524b2ff71892911331d707e23045984b0d3 /source3/rpc_server | |
parent | f16d8f4eb86ecc4741c25e5ed87b2ea4c6717a31 (diff) | |
download | samba-6d741e918f145c6ec62c22358aabc8162db108fd.tar.gz samba-6d741e918f145c6ec62c22358aabc8162db108fd.tar.bz2 samba-6d741e918f145c6ec62c22358aabc8162db108fd.zip |
s3-auth Use *unix_token rather than utok in struct auth3_session_info
This brings this structure one step closer to the struct auth_session_info.
A few SMB_ASSERT calls are added in some key places to ensure that
this pointer is initialised, to make tracing any bugs here easier in
future.
NOTE: Many of the users of this structure should be reviewed, as unix
and NT access checks are mixed in a way that should just be done using
the NT ACL. This patch has not changed this behaviour however.
Andrew Bartlett
Signed-off-by: Andrew Tridgell <tridge@samba.org>
Diffstat (limited to 'source3/rpc_server')
-rw-r--r-- | source3/rpc_server/dfs/srv_dfs_nt.c | 4 | ||||
-rw-r--r-- | source3/rpc_server/epmapper/srv_epmapper.c | 2 | ||||
-rw-r--r-- | source3/rpc_server/lsa/srv_lsa_nt.c | 12 | ||||
-rw-r--r-- | source3/rpc_server/samr/srv_samr_nt.c | 16 | ||||
-rw-r--r-- | source3/rpc_server/spoolss/srv_spoolss_nt.c | 26 | ||||
-rw-r--r-- | source3/rpc_server/srvsvc/srv_srvsvc_nt.c | 24 |
6 files changed, 42 insertions, 42 deletions
diff --git a/source3/rpc_server/dfs/srv_dfs_nt.c b/source3/rpc_server/dfs/srv_dfs_nt.c index 5b4e423393..d77989db2f 100644 --- a/source3/rpc_server/dfs/srv_dfs_nt.c +++ b/source3/rpc_server/dfs/srv_dfs_nt.c @@ -54,7 +54,7 @@ WERROR _dfs_Add(struct pipes_struct *p, struct dfs_Add *r) NTSTATUS status; TALLOC_CTX *ctx = talloc_tos(); - if (p->session_info->utok.uid != sec_initial_uid()) { + if (p->session_info->unix_token->uid != sec_initial_uid()) { DEBUG(10,("_dfs_add: uid != 0. Access denied.\n")); return WERR_ACCESS_DENIED; } @@ -119,7 +119,7 @@ WERROR _dfs_Remove(struct pipes_struct *p, struct dfs_Remove *r) TALLOC_CTX *ctx = talloc_tos(); char *altpath = NULL; - if (p->session_info->utok.uid != sec_initial_uid()) { + if (p->session_info->unix_token->uid != sec_initial_uid()) { DEBUG(10,("_dfs_remove: uid != 0. Access denied.\n")); return WERR_ACCESS_DENIED; } diff --git a/source3/rpc_server/epmapper/srv_epmapper.c b/source3/rpc_server/epmapper/srv_epmapper.c index 8e049fcb24..8ee7cb53f0 100644 --- a/source3/rpc_server/epmapper/srv_epmapper.c +++ b/source3/rpc_server/epmapper/srv_epmapper.c @@ -234,7 +234,7 @@ static uint32_t build_ep_list(TALLOC_CTX *mem_ctx, static bool is_priviledged_pipe(struct auth3_session_info *info) { /* If the user is not root, or has the system token, fail */ - if ((info->utok.uid != sec_initial_uid()) && + if ((info->unix_token->uid != sec_initial_uid()) && !security_token_is_system(info->security_token)) { return false; } diff --git a/source3/rpc_server/lsa/srv_lsa_nt.c b/source3/rpc_server/lsa/srv_lsa_nt.c index 2342a0e8aa..fa018b424f 100644 --- a/source3/rpc_server/lsa/srv_lsa_nt.c +++ b/source3/rpc_server/lsa/srv_lsa_nt.c @@ -434,7 +434,7 @@ NTSTATUS _lsa_OpenPolicy2(struct pipes_struct *p, /* Work out max allowed. */ map_max_allowed_access(p->session_info->security_token, - &p->session_info->utok, + p->session_info->unix_token, &des_access); /* map the generic bits to the lsa policy ones */ @@ -1504,7 +1504,7 @@ static NTSTATUS _lsa_OpenTrustedDomain_base(struct pipes_struct *p, /* Work out max allowed. */ map_max_allowed_access(p->session_info->security_token, - &p->session_info->utok, + p->session_info->unix_token, &access_mask); /* map the generic bits to the lsa account ones */ @@ -1701,14 +1701,14 @@ NTSTATUS _lsa_CreateTrustedDomainEx2(struct pipes_struct *p, return NT_STATUS_ACCESS_DENIED; } - if (p->session_info->utok.uid != sec_initial_uid() && + if (p->session_info->unix_token->uid != sec_initial_uid() && !nt_token_check_domain_rid(p->session_info->security_token, DOMAIN_RID_ADMINS)) { return NT_STATUS_ACCESS_DENIED; } /* Work out max allowed. */ map_max_allowed_access(p->session_info->security_token, - &p->session_info->utok, + p->session_info->unix_token, &r->in.access_mask); /* map the generic bits to the lsa policy ones */ @@ -2466,7 +2466,7 @@ NTSTATUS _lsa_CreateAccount(struct pipes_struct *p, /* Work out max allowed. */ map_max_allowed_access(p->session_info->security_token, - &p->session_info->utok, + p->session_info->unix_token, &r->in.access_mask); /* map the generic bits to the lsa policy ones */ @@ -2530,7 +2530,7 @@ NTSTATUS _lsa_OpenAccount(struct pipes_struct *p, /* Work out max allowed. */ map_max_allowed_access(p->session_info->security_token, - &p->session_info->utok, + p->session_info->unix_token, &des_access); /* map the generic bits to the lsa account ones */ diff --git a/source3/rpc_server/samr/srv_samr_nt.c b/source3/rpc_server/samr/srv_samr_nt.c index 9b91ef3d2b..b9bf4b0790 100644 --- a/source3/rpc_server/samr/srv_samr_nt.c +++ b/source3/rpc_server/samr/srv_samr_nt.c @@ -454,7 +454,7 @@ NTSTATUS _samr_OpenDomain(struct pipes_struct *p, /*check if access can be granted as requested by client. */ map_max_allowed_access(p->session_info->security_token, - &p->session_info->utok, + p->session_info->unix_token, &des_access); make_samr_object_sd( p->mem_ctx, &psd, &sd_size, &dom_generic_mapping, NULL, 0 ); @@ -2210,7 +2210,7 @@ NTSTATUS _samr_OpenUser(struct pipes_struct *p, /* check if access can be granted as requested by client. */ map_max_allowed_access(p->session_info->security_token, - &p->session_info->utok, + p->session_info->unix_token, &des_access); make_samr_object_sd(p->mem_ctx, &psd, &sd_size, &usr_generic_mapping, &sid, SAMR_USR_RIGHTS_WRITE_PW); @@ -3790,7 +3790,7 @@ NTSTATUS _samr_CreateUser2(struct pipes_struct *p, } DEBUG(5, ("_samr_CreateUser2: %s can add this account : %s\n", - uidtoname(p->session_info->utok.uid), + uidtoname(p->session_info->unix_token->uid), can_add_account ? "True":"False" )); if (!can_add_account) { @@ -3816,7 +3816,7 @@ NTSTATUS _samr_CreateUser2(struct pipes_struct *p, sid_compose(&sid, get_global_sam_sid(), *r->out.rid); map_max_allowed_access(p->session_info->security_token, - &p->session_info->utok, + p->session_info->unix_token, &des_access); make_samr_object_sd(p->mem_ctx, &psd, &sd_size, &usr_generic_mapping, @@ -3899,7 +3899,7 @@ NTSTATUS _samr_Connect(struct pipes_struct *p, user level access control on shares) --jerry */ map_max_allowed_access(p->session_info->security_token, - &p->session_info->utok, + p->session_info->unix_token, &des_access); se_map_generic( &des_access, &sam_generic_mapping ); @@ -3961,7 +3961,7 @@ NTSTATUS _samr_Connect2(struct pipes_struct *p, } map_max_allowed_access(p->session_info->security_token, - &p->session_info->utok, + p->session_info->unix_token, &des_access); make_samr_object_sd(p->mem_ctx, &psd, &sd_size, &sam_generic_mapping, NULL, 0); @@ -4176,7 +4176,7 @@ NTSTATUS _samr_OpenAlias(struct pipes_struct *p, /*check if access can be granted as requested by client. */ map_max_allowed_access(p->session_info->security_token, - &p->session_info->utok, + p->session_info->unix_token, &des_access); make_samr_object_sd(p->mem_ctx, &psd, &sd_size, &ali_generic_mapping, NULL, 0); @@ -6257,7 +6257,7 @@ NTSTATUS _samr_OpenGroup(struct pipes_struct *p, /*check if access can be granted as requested by client. */ map_max_allowed_access(p->session_info->security_token, - &p->session_info->utok, + p->session_info->unix_token, &des_access); make_samr_object_sd(p->mem_ctx, &psd, &sd_size, &grp_generic_mapping, NULL, 0); diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c index 6d62bcb526..12dcc27615 100644 --- a/source3/rpc_server/spoolss/srv_spoolss_nt.c +++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c @@ -1827,11 +1827,11 @@ WERROR _spoolss_OpenPrinterEx(struct pipes_struct *p, /* if the user is not root, doesn't have SE_PRINT_OPERATOR privilege, and not a printer admin, then fail */ - if ((p->session_info->utok.uid != sec_initial_uid()) && + if ((p->session_info->unix_token->uid != sec_initial_uid()) && !security_token_has_privilege(p->session_info->security_token, SEC_PRIV_PRINT_OPERATOR) && !nt_token_check_sid(&global_sid_Builtin_Print_Operators, p->session_info->security_token) && !token_contains_name_in_list( - uidtoname(p->session_info->utok.uid), + uidtoname(p->session_info->unix_token->uid), p->session_info->info3->base.domain.string, NULL, p->session_info->security_token, @@ -1914,7 +1914,7 @@ WERROR _spoolss_OpenPrinterEx(struct pipes_struct *p, return WERR_ACCESS_DENIED; } - if (!user_ok_token(uidtoname(p->session_info->utok.uid), NULL, + if (!user_ok_token(uidtoname(p->session_info->unix_token->uid), NULL, p->session_info->security_token, snum) || !print_access_check(p->session_info, p->msg_ctx, @@ -2091,10 +2091,10 @@ WERROR _spoolss_DeletePrinterDriver(struct pipes_struct *p, /* if the user is not root, doesn't have SE_PRINT_OPERATOR privilege, and not a printer admin, then fail */ - if ( (p->session_info->utok.uid != sec_initial_uid()) + if ( (p->session_info->unix_token->uid != sec_initial_uid()) && !security_token_has_privilege(p->session_info->security_token, SEC_PRIV_PRINT_OPERATOR) && !token_contains_name_in_list( - uidtoname(p->session_info->utok.uid), + uidtoname(p->session_info->unix_token->uid), p->session_info->info3->base.domain.string, NULL, p->session_info->security_token, @@ -2195,10 +2195,10 @@ WERROR _spoolss_DeletePrinterDriverEx(struct pipes_struct *p, /* if the user is not root, doesn't have SE_PRINT_OPERATOR privilege, and not a printer admin, then fail */ - if ( (p->session_info->utok.uid != sec_initial_uid()) + if ( (p->session_info->unix_token->uid != sec_initial_uid()) && !security_token_has_privilege(p->session_info->security_token, SEC_PRIV_PRINT_OPERATOR) && !token_contains_name_in_list( - uidtoname(p->session_info->utok.uid), + uidtoname(p->session_info->unix_token->uid), p->session_info->info3->base.domain.string, NULL, p->session_info->security_token, lp_printer_admin(-1)) ) @@ -8550,9 +8550,9 @@ WERROR _spoolss_AddForm(struct pipes_struct *p, /* if the user is not root, doesn't have SE_PRINT_OPERATOR privilege, and not a printer admin, then fail */ - if ((p->session_info->utok.uid != sec_initial_uid()) && + if ((p->session_info->unix_token->uid != sec_initial_uid()) && !security_token_has_privilege(p->session_info->security_token, SEC_PRIV_PRINT_OPERATOR) && - !token_contains_name_in_list(uidtoname(p->session_info->utok.uid), + !token_contains_name_in_list(uidtoname(p->session_info->unix_token->uid), p->session_info->info3->base.domain.string, NULL, p->session_info->security_token, @@ -8623,9 +8623,9 @@ WERROR _spoolss_DeleteForm(struct pipes_struct *p, return WERR_BADFID; } - if ((p->session_info->utok.uid != sec_initial_uid()) && + if ((p->session_info->unix_token->uid != sec_initial_uid()) && !security_token_has_privilege(p->session_info->security_token, SEC_PRIV_PRINT_OPERATOR) && - !token_contains_name_in_list(uidtoname(p->session_info->utok.uid), + !token_contains_name_in_list(uidtoname(p->session_info->unix_token->uid), p->session_info->info3->base.domain.string, NULL, p->session_info->security_token, @@ -8692,9 +8692,9 @@ WERROR _spoolss_SetForm(struct pipes_struct *p, /* if the user is not root, doesn't have SE_PRINT_OPERATOR privilege, and not a printer admin, then fail */ - if ((p->session_info->utok.uid != sec_initial_uid()) && + if ((p->session_info->unix_token->uid != sec_initial_uid()) && !security_token_has_privilege(p->session_info->security_token, SEC_PRIV_PRINT_OPERATOR) && - !token_contains_name_in_list(uidtoname(p->session_info->utok.uid), + !token_contains_name_in_list(uidtoname(p->session_info->unix_token->uid), p->session_info->info3->base.domain.string, NULL, p->session_info->security_token, diff --git a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c index 7d52a761b6..4766573f62 100644 --- a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c +++ b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c @@ -288,7 +288,7 @@ static void init_srv_share_info_1(struct pipes_struct *p, remark = talloc_sub_advanced( p->mem_ctx, lp_servicename(snum), get_current_username(), lp_pathname(snum), - p->session_info->utok.uid, get_current_username(), + p->session_info->unix_token->uid, get_current_username(), "", remark); } @@ -316,7 +316,7 @@ static void init_srv_share_info_2(struct pipes_struct *p, remark = talloc_sub_advanced( p->mem_ctx, lp_servicename(snum), get_current_username(), lp_pathname(snum), - p->session_info->utok.uid, get_current_username(), + p->session_info->unix_token->uid, get_current_username(), "", remark); } path = talloc_asprintf(p->mem_ctx, @@ -381,7 +381,7 @@ static void init_srv_share_info_501(struct pipes_struct *p, remark = talloc_sub_advanced( p->mem_ctx, lp_servicename(snum), get_current_username(), lp_pathname(snum), - p->session_info->utok.uid, get_current_username(), + p->session_info->unix_token->uid, get_current_username(), "", remark); } @@ -410,7 +410,7 @@ static void init_srv_share_info_502(struct pipes_struct *p, remark = talloc_sub_advanced( p->mem_ctx, lp_servicename(snum), get_current_username(), lp_pathname(snum), - p->session_info->utok.uid, get_current_username(), + p->session_info->unix_token->uid, get_current_username(), "", remark); } path = talloc_asprintf(ctx, "C:%s", lp_pathname(snum)); @@ -451,7 +451,7 @@ static void init_srv_share_info_1004(struct pipes_struct *p, remark = talloc_sub_advanced( p->mem_ctx, lp_servicename(snum), get_current_username(), lp_pathname(snum), - p->session_info->utok.uid, get_current_username(), + p->session_info->unix_token->uid, get_current_username(), "", remark); } @@ -1333,7 +1333,7 @@ WERROR _srvsvc_NetSessDel(struct pipes_struct *p, /* fail out now if you are not root or not a domain admin */ - if ((p->session_info->utok.uid != sec_initial_uid()) && + if ((p->session_info->unix_token->uid != sec_initial_uid()) && ( ! nt_token_check_domain_rid(p->session_info->security_token, DOMAIN_RID_ADMINS))) { @@ -1347,7 +1347,7 @@ WERROR _srvsvc_NetSessDel(struct pipes_struct *p, NTSTATUS ntstat; - if (p->session_info->utok.uid != sec_initial_uid()) { + if (p->session_info->unix_token->uid != sec_initial_uid()) { not_root = True; become_root(); } @@ -1572,11 +1572,11 @@ WERROR _srvsvc_NetShareSetInfo(struct pipes_struct *p, /* fail out now if you are not root and not a disk op */ - if ( p->session_info->utok.uid != sec_initial_uid() && !is_disk_op ) { + if ( p->session_info->unix_token->uid != sec_initial_uid() && !is_disk_op ) { DEBUG(2,("_srvsvc_NetShareSetInfo: uid %u doesn't have the " "SeDiskOperatorPrivilege privilege needed to modify " "share %s\n", - (unsigned int)p->session_info->utok.uid, + (unsigned int)p->session_info->unix_token->uid, share_name )); return WERR_ACCESS_DENIED; } @@ -1773,7 +1773,7 @@ WERROR _srvsvc_NetShareAdd(struct pipes_struct *p, is_disk_op = security_token_has_privilege(p->session_info->security_token, SEC_PRIV_DISK_OPERATOR); - if (p->session_info->utok.uid != sec_initial_uid() && !is_disk_op ) + if (p->session_info->unix_token->uid != sec_initial_uid() && !is_disk_op ) return WERR_ACCESS_DENIED; if (!lp_add_share_cmd() || !*lp_add_share_cmd()) { @@ -1979,7 +1979,7 @@ WERROR _srvsvc_NetShareDel(struct pipes_struct *p, is_disk_op = security_token_has_privilege(p->session_info->security_token, SEC_PRIV_DISK_OPERATOR); - if (p->session_info->utok.uid != sec_initial_uid() && !is_disk_op ) + if (p->session_info->unix_token->uid != sec_initial_uid() && !is_disk_op ) return WERR_ACCESS_DENIED; if (!lp_delete_share_cmd() || !*lp_delete_share_cmd()) { @@ -2549,7 +2549,7 @@ WERROR _srvsvc_NetFileClose(struct pipes_struct *p, is_disk_op = security_token_has_privilege(p->session_info->security_token, SEC_PRIV_DISK_OPERATOR); - if (p->session_info->utok.uid != sec_initial_uid() && !is_disk_op) { + if (p->session_info->unix_token->uid != sec_initial_uid() && !is_disk_op) { return WERR_ACCESS_DENIED; } |