Ignore:
Timestamp:
Nov 27, 2012, 4:43:17 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: updated trunk to 3.6.0

Location:
trunk/server
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/server

  • trunk/server/source3/lib/util_nttoken.c

    r414 r745  
    2727
    2828#include "includes.h"
     29#include "../libcli/security/security.h"
    2930
    3031/****************************************************************************
     
    3233****************************************************************************/
    3334
    34 NT_USER_TOKEN *dup_nt_token(TALLOC_CTX *mem_ctx, const NT_USER_TOKEN *ptoken)
     35struct security_token *dup_nt_token(TALLOC_CTX *mem_ctx, const struct security_token *ptoken)
    3536{
    36         NT_USER_TOKEN *token;
     37        struct security_token *token;
    3738
    3839        if (!ptoken)
    3940                return NULL;
    4041
    41         token = TALLOC_ZERO_P(mem_ctx, NT_USER_TOKEN);
     42        token = TALLOC_ZERO_P(mem_ctx, struct security_token);
    4243        if (token == NULL) {
    4344                DEBUG(0, ("talloc failed\n"));
     
    4546        }
    4647
    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 );
    5051
    51                 if (token->user_sids == NULL) {
     52                if (token->sids == NULL) {
    5253                        DEBUG(0, ("talloc_memdup failed\n"));
    5354                        TALLOC_FREE(token);
     
    5758        }
    5859       
    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;
    6562
    6663        return token;
     
    7269
    7370NTSTATUS 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)
    7774{
    78         struct nt_user_token *token = NULL;
     75        struct security_token *token = NULL;
    7976        NTSTATUS status;
    8077        int i;
     
    8481        }
    8582
    86         token = TALLOC_ZERO_P(mem_ctx, struct nt_user_token);
     83        token = TALLOC_ZERO_P(mem_ctx, struct security_token);
    8784        NT_STATUS_HAVE_NO_MEMORY(token);
    8885
    8986        for (i=0; i < token_1->num_sids; i++) {
    9087                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,
    9390                                                 &token->num_sids);
    9491                if (!NT_STATUS_IS_OK(status)) {
     
    10097        for (i=0; i < token_2->num_sids; i++) {
    10198                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,
    104101                                                 &token->num_sids);
    105102                if (!NT_STATUS_IS_OK(status)) {
     
    109106        }
    110107
    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;
    113113
    114114        *token_out = token;
     
    118118
    119119/*******************************************************************
    120  Check if this ACE has a SID in common with the token.
     120 Check if this struct security_ace has a SID in common with the token.
    121121********************************************************************/
    122122
    123 bool token_sid_in_ace(const NT_USER_TOKEN *token, const struct security_ace *ace)
     123bool token_sid_in_ace(const struct security_token *token, const struct security_ace *ace)
    124124{
    125125        size_t i;
    126126
    127127        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]))
    129129                        return true;
    130130        }
Note: See TracChangeset for help on using the changeset viewer.