Changeset 745 for trunk/server/source3/lib/util_nttoken.c
- Timestamp:
- Nov 27, 2012, 4:43:17 PM (13 years ago)
- Location:
- trunk/server
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/server
- Property svn:mergeinfo changed
/vendor/current merged: 581,587,591,594,597,600,615,618,740
- Property svn:mergeinfo changed
-
trunk/server/source3/lib/util_nttoken.c
r414 r745 27 27 28 28 #include "includes.h" 29 #include "../libcli/security/security.h" 29 30 30 31 /**************************************************************************** … … 32 33 ****************************************************************************/ 33 34 34 NT_USER_TOKEN *dup_nt_token(TALLOC_CTX *mem_ctx, const NT_USER_TOKEN*ptoken)35 struct security_token *dup_nt_token(TALLOC_CTX *mem_ctx, const struct security_token *ptoken) 35 36 { 36 NT_USER_TOKEN*token;37 struct security_token *token; 37 38 38 39 if (!ptoken) 39 40 return NULL; 40 41 41 token = TALLOC_ZERO_P(mem_ctx, NT_USER_TOKEN);42 token = TALLOC_ZERO_P(mem_ctx, struct security_token); 42 43 if (token == NULL) { 43 44 DEBUG(0, ("talloc failed\n")); … … 45 46 } 46 47 47 if (ptoken-> user_sids && ptoken->num_sids) {48 token-> user_sids = (DOM_SID*)talloc_memdup(49 token, ptoken-> user_sids, sizeof(DOM_SID) * ptoken->num_sids );48 if (ptoken->sids && ptoken->num_sids) { 49 token->sids = (struct dom_sid *)talloc_memdup( 50 token, ptoken->sids, sizeof(struct dom_sid) * ptoken->num_sids ); 50 51 51 if (token-> user_sids == NULL) {52 if (token->sids == NULL) { 52 53 DEBUG(0, ("talloc_memdup failed\n")); 53 54 TALLOC_FREE(token); … … 57 58 } 58 59 59 /* copy the privileges; don't consider failure to be critical here */ 60 61 if ( !se_priv_copy( &token->privileges, &ptoken->privileges ) ) { 62 DEBUG(0,("dup_nt_token: Failure to copy SE_PRIV!. " 63 "Continuing with 0 privileges assigned.\n")); 64 } 60 token->privilege_mask = ptoken->privilege_mask; 61 token->rights_mask = ptoken->rights_mask; 65 62 66 63 return token; … … 72 69 73 70 NTSTATUS merge_nt_token(TALLOC_CTX *mem_ctx, 74 const struct nt_user_token *token_1,75 const struct nt_user_token *token_2,76 struct nt_user_token **token_out)71 const struct security_token *token_1, 72 const struct security_token *token_2, 73 struct security_token **token_out) 77 74 { 78 struct nt_user_token *token = NULL;75 struct security_token *token = NULL; 79 76 NTSTATUS status; 80 77 int i; … … 84 81 } 85 82 86 token = TALLOC_ZERO_P(mem_ctx, struct nt_user_token);83 token = TALLOC_ZERO_P(mem_ctx, struct security_token); 87 84 NT_STATUS_HAVE_NO_MEMORY(token); 88 85 89 86 for (i=0; i < token_1->num_sids; i++) { 90 87 status = add_sid_to_array_unique(mem_ctx, 91 &token_1-> user_sids[i],92 &token-> user_sids,88 &token_1->sids[i], 89 &token->sids, 93 90 &token->num_sids); 94 91 if (!NT_STATUS_IS_OK(status)) { … … 100 97 for (i=0; i < token_2->num_sids; i++) { 101 98 status = add_sid_to_array_unique(mem_ctx, 102 &token_2-> user_sids[i],103 &token-> user_sids,99 &token_2->sids[i], 100 &token->sids, 104 101 &token->num_sids); 105 102 if (!NT_STATUS_IS_OK(status)) { … … 109 106 } 110 107 111 se_priv_add(&token->privileges, &token_1->privileges); 112 se_priv_add(&token->privileges, &token_2->privileges); 108 token->privilege_mask |= token_1->privilege_mask; 109 token->privilege_mask |= token_2->privilege_mask; 110 111 token->rights_mask |= token_1->rights_mask; 112 token->rights_mask |= token_2->rights_mask; 113 113 114 114 *token_out = token; … … 118 118 119 119 /******************************************************************* 120 Check if this ACEhas a SID in common with the token.120 Check if this struct security_ace has a SID in common with the token. 121 121 ********************************************************************/ 122 122 123 bool token_sid_in_ace(const NT_USER_TOKEN*token, const struct security_ace *ace)123 bool token_sid_in_ace(const struct security_token *token, const struct security_ace *ace) 124 124 { 125 125 size_t i; 126 126 127 127 for (i = 0; i < token->num_sids; i++) { 128 if ( sid_equal(&ace->trustee, &token->user_sids[i]))128 if (dom_sid_equal(&ace->trustee, &token->sids[i])) 129 129 return true; 130 130 }
Note:
See TracChangeset
for help on using the changeset viewer.