Ignore:
Timestamp:
May 26, 2009, 9:44:50 AM (16 years ago)
Author:
Herwig Bauernfeind
Message:

Update 3.2 branch to 3.2.6

Location:
branches/samba-3.2.x/source/rpc_server
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/samba-3.2.x/source/rpc_server/srv_eventlog_lib.c

    r133 r228  
    141141********************************************************************/
    142142
    143 static bool make_way_for_eventlogs( TDB_CONTEXT * the_tdb, int32 needed,
     143static bool make_way_for_eventlogs( TDB_CONTEXT * the_tdb, int32_t needed,
    144144                                    bool whack_by_date )
    145145{
    146         int start_record, i, new_start;
    147         int end_record;
    148         int nbytes, reclen, len, Retention, MaxSize;
    149         int tresv1, trecnum, timegen, timewr;
     146        int32_t start_record, i, new_start;
     147        int32_t end_record;
     148        int32_t reclen, tresv1, trecnum, timegen, timewr;
     149        int nbytes, len, Retention, MaxSize;
    150150        TDB_DATA key, ret;
    151151        time_t current_time, exp_time;
     
    174174
    175175        DEBUG( 3,
    176                ( "MaxSize [%d] Retention [%d] Current Time [%d]  exp_time [%d]\n",
    177                  MaxSize, Retention, (uint32)current_time, (uint32)exp_time ) );
     176               ( "MaxSize [%d] Retention [%d] Current Time [%u]  exp_time [%u]\n",
     177                 MaxSize, Retention, (unsigned int)current_time, (unsigned int)exp_time ) );
    178178        DEBUG( 3,
    179                ( "Start Record [%d] End Record [%d]\n", start_record,
    180                  end_record ) );
     179               ( "Start Record [%u] End Record [%u]\n",
     180                (unsigned int)start_record,
     181                (unsigned int)end_record ));
    181182
    182183        for ( i = start_record; i < end_record; i++ ) {
    183184                /* read a record, add the amt to nbytes */
    184                 key.dsize = sizeof( int32 );
    185                 key.dptr = ( uint8 * ) ( int32 * ) & i;
     185                key.dsize = sizeof(int32_t);
     186                key.dptr = (unsigned char *)&i;
    186187                ret = tdb_fetch( the_tdb, key );
    187188                if ( ret.dsize == 0 ) {
     
    199200                        DEBUG( 10,("make_way_for_eventlogs: tdb_unpack failed.\n"));
    200201                        tdb_unlock_bystring( the_tdb, EVT_NEXT_RECORD );
     202                        SAFE_FREE( ret.dptr );
    201203                        return False;
    202204                }
    203205
    204206                DEBUG( 8,
    205                        ( "read record %d, record size is [%d], total so far [%d]\n",
    206                          i, reclen, nbytes ) );
     207                       ( "read record %u, record size is [%d], total so far [%d]\n",
     208                         (unsigned int)i, reclen, nbytes ) );
    207209
    208210                SAFE_FREE( ret.dptr );
     
    221223
    222224        DEBUG( 3,
    223                ( "nbytes [%d] needed [%d] start_record is [%d], should be set to [%d]\n",
    224                  nbytes, needed, start_record, i ) );
     225               ( "nbytes [%d] needed [%d] start_record is [%u], should be set to [%u]\n",
     226                 nbytes, needed, (unsigned int)start_record, (unsigned int)i ) );
    225227        /* todo - remove eventlog entries here and set starting record to start_record... */
    226228        new_start = i;
    227229        if ( start_record != new_start ) {
    228230                for ( i = start_record; i < new_start; i++ ) {
    229                         key.dsize = sizeof( int32 );
    230                         key.dptr = ( uint8 * ) ( int32 * ) & i;
     231                        key.dsize = sizeof(int32_t);
     232                        key.dptr = (unsigned char *)&i;
    231233                        tdb_delete( the_tdb, key );
    232234                }
     
    268270********************************************************************/
    269271
    270 bool can_write_to_eventlog( TDB_CONTEXT * tdb, int32 needed )
     272bool can_write_to_eventlog( TDB_CONTEXT * tdb, int32_t needed )
    271273{
    272274        int calcd_size;
     
    314316{
    315317        TDB_CONTEXT *tdb = NULL;
    316         uint32 vers_id;
     318        uint32_t vers_id;
    317319        ELOG_TDB *ptr;
    318320        char *tdbpath = NULL;
     
    455457        TALLOC_CTX *mem_ctx = NULL;
    456458        TDB_DATA kbuf, ebuf;
    457         uint32 n_packed;
     459        uint32_t n_packed;
    458460
    459461        if ( !ee )
  • branches/samba-3.2.x/source/rpc_server/srv_eventlog_nt.c

    r133 r228  
    8181       
    8282        sec_desc = get_nt_acl_no_snum( info, tdbname );
    83         SAFE_FREE( tdbname );
     83        TALLOC_FREE( tdbname );
    8484       
    8585        if ( !sec_desc ) {
     
    292292        TDB_DATA ret, key;
    293293
    294         int srecno;
    295         int reclen;
     294        int32_t srecno;
     295        int32_t reclen;
    296296        int len;
    297297
     
    302302        char *puserdata = NULL;
    303303
    304         key.dsize = sizeof(int32);
     304        key.dsize = sizeof(int32_t);
    305305
    306306        srecno = recno;
    307         key.dptr = ( uint8 * ) &srecno;
     307        key.dptr = (unsigned char *)&srecno;
    308308
    309309        ret = tdb_fetch( tdb, key );
     
    428428        WERROR wresult;
    429429        char *elogname = info->logname;
    430         TALLOC_CTX *ctx = talloc_tos();
     430        TALLOC_CTX *ctx = talloc_stackframe();
    431431        bool ret = false;
    432432
     
    435435        if ( !info->etdb ) {
    436436                DEBUG( 4, ( "No open tdb! (%s)\n", info->logname ) );
    437                 return False;
     437                goto done;
    438438        }
    439439        /* set resonable defaults.  512Kb on size and 1 week on time */
     
    449449        path = talloc_asprintf(ctx, "%s/%s", KEY_EVENTLOG, elogname );
    450450        if (!path) {
    451                 return false;
     451                goto done;
    452452        }
    453453
     
    459459                       ( "sync_eventlog_params: Failed to open key [%s] (%s)\n",
    460460                         path, dos_errstr( wresult ) ) );
    461                 return false;
     461                goto done;
    462462        }
    463463
     
    466466                DEBUG(4, ("Failed to query value \"Retention\": %s\n",
    467467                          dos_errstr(wresult)));
    468                 ret = false;
    469468                goto done;
    470469        }
     
    475474                DEBUG(4, ("Failed to query value \"MaxSize\": %s\n",
    476475                          dos_errstr(wresult)));
    477                 ret = false;
    478476                goto done;
    479477        }
  • branches/samba-3.2.x/source/rpc_server/srv_lsa_nt.c

    r138 r228  
    435435
    436436        if(!se_access_check(psd, p->pipe_user.nt_user_token, des_access, &acc_granted, &status)) {
    437                 if (geteuid() != 0) {
     437                if (p->pipe_user.ut.uid != sec_initial_uid()) {
    438438                        return status;
    439439                }
     
    15311531           account_pol.tdb was already opened as root, this is all we have */
    15321532
    1533         if ( !nt_token_check_domain_rid( p->pipe_user.nt_user_token, DOMAIN_GROUP_RID_ADMINS ) )
     1533        if ( p->pipe_user.ut.uid != sec_initial_uid()
     1534                && !nt_token_check_domain_rid( p->pipe_user.nt_user_token, DOMAIN_GROUP_RID_ADMINS ) )
    15341535                return NT_STATUS_ACCESS_DENIED;
    15351536
     
    16171618                return NT_STATUS_INVALID_HANDLE;
    16181619
     1620        if (!(info->access & LSA_POLICY_VIEW_LOCAL_INFORMATION))
     1621                return NT_STATUS_ACCESS_DENIED;
     1622
    16191623        if ( !get_privileges_for_sids( &mask, &info->sid, 1 ) )
    16201624                return NT_STATUS_OBJECT_NAME_NOT_FOUND;
     
    16771681                return NT_STATUS_INVALID_HANDLE;
    16781682
     1683        if (!(info->access & LSA_POLICY_VIEW_LOCAL_INFORMATION))
     1684                return NT_STATUS_ACCESS_DENIED;
     1685
    16791686        if (!lookup_sid(p->mem_ctx, &info->sid, NULL, NULL, NULL))
    16801687                return NT_STATUS_ACCESS_DENIED;
     
    17111718           account_pol.tdb was already opened as root, this is all we have */
    17121719
    1713         if ( !nt_token_check_domain_rid( p->pipe_user.nt_user_token, DOMAIN_GROUP_RID_ADMINS ) )
     1720        if ( p->pipe_user.ut.uid != sec_initial_uid()
     1721                && !nt_token_check_domain_rid( p->pipe_user.nt_user_token, DOMAIN_GROUP_RID_ADMINS ) )
    17141722                return NT_STATUS_ACCESS_DENIED;
    17151723
     
    18201828        if (!(handle->access & LSA_POLICY_VIEW_LOCAL_INFORMATION))
    18211829                return NT_STATUS_ACCESS_DENIED;
    1822 
    18231830
    18241831        switch (r->in.sec_info) {
     
    20792086                return NT_STATUS_INVALID_HANDLE;
    20802087
     2088        if (!(info->access & LSA_POLICY_VIEW_LOCAL_INFORMATION))
     2089                return NT_STATUS_ACCESS_DENIED;
     2090
    20812091        /* according to an NT4 PDC, you can add privileges to SIDs even without
    20822092           call_lsa_create_account() first.  And you can use any arbitrary SID. */
     
    21202130        if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
    21212131                return NT_STATUS_INVALID_HANDLE;
     2132
     2133        if (!(info->access & LSA_POLICY_VIEW_LOCAL_INFORMATION))
     2134                return NT_STATUS_ACCESS_DENIED;
    21222135
    21232136        name = r->in.name->string;
  • branches/samba-3.2.x/source/rpc_server/srv_samr_nt.c

    r136 r228  
    66 *  Copyright (C) Paul Ashton                       1997,
    77 *  Copyright (C) Marc Jacobsen                     1999,
    8  *  Copyright (C) Jeremy Allison                    2001-2005,
     8 *  Copyright (C) Jeremy Allison                    2001-2008,
    99 *  Copyright (C) Jean François Micouleau           1998-2001,
    1010 *  Copyright (C) Jim McDonough <jmcd@us.ibm.com>   2002,
     
    250250
    251251/*******************************************************************
     252 Map any MAXIMUM_ALLOWED_ACCESS request to a valid access set.
     253********************************************************************/
     254
     255static void map_max_allowed_access(const NT_USER_TOKEN *token,
     256                                        uint32_t *pacc_requested)
     257{
     258        if (!((*pacc_requested) & MAXIMUM_ALLOWED_ACCESS)) {
     259                return;
     260        }
     261        *pacc_requested &= ~MAXIMUM_ALLOWED_ACCESS;
     262
     263        /* At least try for generic read. */
     264        *pacc_requested = GENERIC_READ_ACCESS;
     265
     266        /* root gets anything. */
     267        if (geteuid() == sec_initial_uid()) {
     268                *pacc_requested |= GENERIC_ALL_ACCESS;
     269                return;
     270        }
     271
     272        /* Full Access for 'BUILTIN\Administrators' and 'BUILTIN\Account Operators */
     273
     274        if (is_sid_in_token(token, &global_sid_Builtin_Administrators) ||
     275                        is_sid_in_token(token, &global_sid_Builtin_Account_Operators)) {
     276                *pacc_requested |= GENERIC_ALL_ACCESS;
     277                return;
     278        }
     279
     280        /* Full access for DOMAIN\Domain Admins. */
     281        if ( IS_DC ) {
     282                DOM_SID domadmin_sid;
     283                sid_copy( &domadmin_sid, get_global_sam_sid() );
     284                sid_append_rid( &domadmin_sid, DOMAIN_GROUP_RID_ADMINS );
     285                if (is_sid_in_token(token, &domadmin_sid)) {
     286                        *pacc_requested |= GENERIC_ALL_ACCESS;
     287                        return;
     288                }
     289        }
     290        /* TODO ! Check privileges. */
     291}
     292
     293/*******************************************************************
    252294 Fetch or create a dispinfo struct.
    253295********************************************************************/
     
    587629
    588630        /*check if access can be granted as requested by client. */
     631        map_max_allowed_access(p->pipe_user.nt_user_token, &des_access);
    589632
    590633        make_samr_object_sd( p->mem_ctx, &psd, &sd_size, &dom_generic_mapping, NULL, 0 );
     
    826869        DEBUG(10,("_samr_QuerySecurity: querying security on SID: %s\n",
    827870                  sid_string_dbg(&pol_sid)));
     871
     872        status = access_check_samr_function(acc_granted,
     873                                            STD_RIGHT_READ_CONTROL_ACCESS,
     874                                            "_samr_QuerySecurity");
     875        if (!NT_STATUS_IS_OK(status)) {
     876                return status;
     877        }
    828878
    829879        /* Check what typ of SID is beeing queried (e.g Domain SID, User SID, Group SID) */
     
    11551205                return NT_STATUS_INVALID_HANDLE;
    11561206
     1207        DEBUG(5,("_samr_EnumDomainAliases: sid %s\n",
     1208                 sid_string_dbg(&info->sid)));
     1209
    11571210        status = access_check_samr_function(info->acc_granted,
    11581211                                            SA_RIGHT_DOMAIN_ENUM_ACCOUNTS,
     
    11611214                return status;
    11621215        }
    1163 
    1164         DEBUG(5,("_samr_EnumDomainAliases: sid %s\n",
    1165                  sid_string_dbg(&info->sid)));
    11661216
    11671217        samr_array = TALLOC_ZERO_P(p->mem_ctx, struct samr_SamArray);
     
    14301480        if (!find_policy_by_hnd(p, r->in.domain_handle, (void **)(void *)&info))
    14311481                return NT_STATUS_INVALID_HANDLE;
     1482
     1483        status = access_check_samr_function(info->acc_granted,
     1484                                            SA_RIGHT_DOMAIN_ENUM_ACCOUNTS,
     1485                                            "_samr_QueryDisplayInfo");
     1486        if (!NT_STATUS_IS_OK(status)) {
     1487                return status;
     1488        }
    14321489
    14331490        /*
     
    15921649        total_data_size=num_account*struct_size;
    15931650
    1594         if (num_account) {
     1651        if (max_entries <= num_account) {
    15951652                status = STATUS_MORE_ENTRIES;
    15961653        } else {
     
    17941851        uint32  acc_granted;
    17951852        struct samr_Ids rids, types;
     1853        uint32_t num_mapped = 0;
    17961854
    17971855        DEBUG(5,("_samr_LookupNames: %d\n", __LINE__));
     
    18411899
    18421900                if (type[i] != SID_NAME_UNKNOWN) {
    1843                         status = NT_STATUS_OK;
     1901                        num_mapped++;
    18441902                }
     1903        }
     1904
     1905        if (num_mapped == num_rids) {
     1906                status = NT_STATUS_OK;
     1907        } else if (num_mapped == 0) {
     1908                status = NT_STATUS_NONE_MAPPED;
     1909        } else {
     1910                status = STATUS_SOME_UNMAPPED;
    18451911        }
    18461912
     
    20632129        if (!get_lsa_policy_samr_sid(p, r->in.domain_handle, &pol_sid, &acc_granted, NULL))
    20642130                return NT_STATUS_INVALID_HANDLE;
     2131
     2132        status = access_check_samr_function(acc_granted,
     2133                                            SA_RIGHT_DOMAIN_ENUM_ACCOUNTS,
     2134                                            "_samr__LookupRids");
     2135        if (!NT_STATUS_IS_OK(status)) {
     2136                return status;
     2137        }
    20652138
    20662139        if (num_rids > 1000) {
     
    21582231
    21592232        /* check if access can be granted as requested by client. */
     2233
     2234        map_max_allowed_access(p->pipe_user.nt_user_token, &des_access);
    21602235
    21612236        make_samr_object_sd(p->mem_ctx, &psd, &sd_size, &usr_generic_mapping, &sid, SAMR_USR_RIGHTS_WRITE_PW);
     
    26342709                return NT_STATUS_INVALID_HANDLE;
    26352710
     2711        status = access_check_samr_function(info->acc_granted,
     2712                                            SA_RIGHT_DOMAIN_OPEN_ACCOUNT,
     2713                                            "_samr_QueryUserInfo");
     2714        if (!NT_STATUS_IS_OK(status)) {
     2715                return status;
     2716        }
     2717
    26362718        domain_sid = info->sid;
    26372719
     
    28392921
    28402922/*******************************************************************
    2841  samr_QueryDomainInfo_internal
     2923 _samr_QueryDomainInfo
    28422924 ********************************************************************/
    28432925
    2844 static NTSTATUS samr_QueryDomainInfo_internal(const char *fn_name,
    2845                                               pipes_struct *p,
    2846                                               struct policy_handle *handle,
    2847                                               uint32_t level,
    2848                                               union samr_DomainInfo **dom_info_ptr)
     2926NTSTATUS _samr_QueryDomainInfo(pipes_struct *p,
     2927                               struct samr_QueryDomainInfo *r)
    28492928{
    28502929        NTSTATUS status = NT_STATUS_OK;
     
    28682947        uint32 num_users=0, num_groups=0, num_aliases=0;
    28692948
    2870         DEBUG(5,("%s: %d\n", fn_name, __LINE__));
     2949        DEBUG(5,("_samr_QueryDomainInfo: %d\n", __LINE__));
    28712950
    28722951        dom_info = TALLOC_ZERO_P(p->mem_ctx, union samr_DomainInfo);
     
    28752954        }
    28762955
    2877         *dom_info_ptr = dom_info;
    2878 
    28792956        /* find the policy handle.  open a policy on it. */
    2880         if (!find_policy_by_hnd(p, handle, (void **)(void *)&info)) {
     2957        if (!find_policy_by_hnd(p, r->in.domain_handle, (void **)(void *)&info)) {
    28812958                return NT_STATUS_INVALID_HANDLE;
    28822959        }
    28832960
    2884         switch (level) {
     2961        status = access_check_samr_function(info->acc_granted,
     2962                                            SA_RIGHT_SAM_OPEN_DOMAIN,
     2963                                            "_samr_QueryDomainInfo" );
     2964
     2965        if ( !NT_STATUS_IS_OK(status) )
     2966                return status;
     2967
     2968        switch (r->in.level) {
    28852969                case 0x01:
    28862970
     
    29102994                        unix_to_nt_time_abs(&nt_expire, u_expire);
    29112995                        unix_to_nt_time_abs(&nt_min_age, u_min_age);
     2996
     2997                        if (lp_check_password_script() && *lp_check_password_script()) {
     2998                                password_properties |= DOMAIN_PASSWORD_COMPLEX;
     2999                        }
    29123000
    29133001                        init_samr_DomInfo1(&dom_info->info1,
     
    30543142        }
    30553143
    3056         DEBUG(5,("%s: %d\n", fn_name, __LINE__));
     3144        *r->out.info = dom_info;
     3145
     3146        DEBUG(5,("_samr_QueryDomainInfo: %d\n", __LINE__));
    30573147
    30583148        return status;
    3059 }
    3060 
    3061 /*******************************************************************
    3062  _samr_QueryDomainInfo
    3063  ********************************************************************/
    3064 
    3065 NTSTATUS _samr_QueryDomainInfo(pipes_struct *p,
    3066                                struct samr_QueryDomainInfo *r)
    3067 {
    3068         return samr_QueryDomainInfo_internal("_samr_QueryDomainInfo",
    3069                                              p,
    3070                                              r->in.domain_handle,
    3071                                              r->in.level,
    3072                                              r->out.info);
    30733149}
    30743150
     
    32183294        sid_compose(&sid, get_global_sam_sid(), *r->out.rid);
    32193295
     3296        map_max_allowed_access(p->pipe_user.nt_user_token, &des_access);
     3297
    32203298        make_samr_object_sd(p->mem_ctx, &psd, &sd_size, &usr_generic_mapping,
    32213299                            &sid, SAMR_USR_RIGHTS_WRITE_PW);
     
    32793357           user level access control on shares)   --jerry */
    32803358
    3281         if (des_access == MAXIMUM_ALLOWED_ACCESS) {
    3282                 /* Map to max possible knowing we're filtered below. */
    3283                 des_access = GENERIC_ALL_ACCESS;
    3284         }
     3359        map_max_allowed_access(p->pipe_user.nt_user_token, &des_access);
    32853360
    32863361        se_map_generic( &des_access, &sam_generic_mapping );
     
    33183393        }
    33193394
     3395        map_max_allowed_access(p->pipe_user.nt_user_token, &des_access);
     3396
    33203397        make_samr_object_sd(p->mem_ctx, &psd, &sd_size, &sam_generic_mapping, NULL, 0);
    33213398        se_map_generic(&des_access, &sam_generic_mapping);
     
    33663443                return NT_STATUS_ACCESS_DENIED;
    33673444        }
     3445
     3446        map_max_allowed_access(p->pipe_user.nt_user_token, &des_access);
    33683447
    33693448        make_samr_object_sd(p->mem_ctx, &psd, &sd_size, &sam_generic_mapping, NULL, 0);
     
    34153494                return NT_STATUS_ACCESS_DENIED;
    34163495        }
     3496
     3497        map_max_allowed_access(p->pipe_user.nt_user_token, &des_access);
    34173498
    34183499        make_samr_object_sd(p->mem_ctx, &psd, &sd_size, &sam_generic_mapping, NULL, 0);
     
    35823663
    35833664        /*check if access can be granted as requested by client. */
     3665
     3666        map_max_allowed_access(p->pipe_user.nt_user_token, &des_access);
    35843667
    35853668        make_samr_object_sd(p->mem_ctx, &psd, &sd_size, &ali_generic_mapping, NULL, 0);
     
    40684151
    40694152/*******************************************************************
    4070  samr_SetUserInfo_internal
     4153 samr_SetUserInfo
    40714154 ********************************************************************/
    40724155
    4073 static NTSTATUS samr_SetUserInfo_internal(const char *fn_name,
    4074                                           pipes_struct *p,
    4075                                           struct policy_handle *user_handle,
    4076                                           uint16_t level,
    4077                                           union samr_UserInfo *info)
     4156NTSTATUS _samr_SetUserInfo(pipes_struct *p,
     4157                           struct samr_SetUserInfo *r)
    40784158{
    40794159        NTSTATUS status;
    40804160        struct samu *pwd = NULL;
    40814161        DOM_SID sid;
    4082         POLICY_HND *pol = user_handle;
    4083         uint16_t switch_value = level;
     4162        POLICY_HND *pol = r->in.user_handle;
     4163        union samr_UserInfo *info = r->in.info;
     4164        uint16_t switch_value = r->in.level;
    40844165        uint32_t acc_granted;
    40854166        uint32_t acc_required;
     
    40894170        DISP_INFO *disp_info = NULL;
    40904171
    4091         DEBUG(5,("%s: %d\n", fn_name, __LINE__));
     4172        DEBUG(5,("_samr_SetUserInfo: %d\n", __LINE__));
    40924173
    40934174        /* find the policy handle.  open a policy on it. */
     
    41194200        status = access_check_samr_function(acc_granted,
    41204201                                            acc_required,
    4121                                             fn_name);
     4202                                            "_samr_SetUserInfo");
    41224203        if (!NT_STATUS_IS_OK(status)) {
    41234204                return status;
    41244205        }
    41254206
    4126         DEBUG(5, ("%s: sid:%s, level:%d\n",
    4127                   fn_name, sid_string_dbg(&sid), switch_value));
     4207        DEBUG(5, ("_samr_SetUserInfo: sid:%s, level:%d\n",
     4208                  sid_string_dbg(&sid), switch_value));
    41284209
    41294210        if (info == NULL) {
    4130                 DEBUG(5, ("%s: NULL info level\n", fn_name));
     4211                DEBUG(5, ("_samr_SetUserInfo: NULL info level\n"));
    41314212                return NT_STATUS_INVALID_INFO_CLASS;
    41324213        }
     
    41624243        }
    41634244
    4164         DEBUG(5, ("%s: %s does%s possess sufficient rights\n",
    4165                   fn_name,
     4245        DEBUG(5, ("_samr_SetUserInfo: %s does%s possess sufficient rights\n",
    41664246                  uidtoname(p->pipe_user.ut.uid),
    41674247                  has_enough_rights ? "" : " not"));
     
    42904370
    42914371/*******************************************************************
    4292  _samr_SetUserInfo
    4293  ********************************************************************/
    4294 
    4295 NTSTATUS _samr_SetUserInfo(pipes_struct *p,
    4296                            struct samr_SetUserInfo *r)
    4297 {
    4298         return samr_SetUserInfo_internal("_samr_SetUserInfo",
    4299                                          p,
    4300                                          r->in.user_handle,
    4301                                          r->in.level,
    4302                                          r->in.info);
    4303 }
    4304 
    4305 /*******************************************************************
    43064372 _samr_SetUserInfo2
    43074373 ********************************************************************/
     
    43104376                            struct samr_SetUserInfo2 *r)
    43114377{
    4312         return samr_SetUserInfo_internal("_samr_SetUserInfo2",
    4313                                          p,
    4314                                          r->in.user_handle,
    4315                                          r->in.level,
    4316                                          r->in.info);
     4378        struct samr_SetUserInfo q;
     4379
     4380        q.in.user_handle        = r->in.user_handle;
     4381        q.in.level              = r->in.level;
     4382        q.in.info               = r->in.info;
     4383
     4384        return _samr_SetUserInfo(p, &q);
    43174385}
    43184386
     
    48164884        if (!close_policy_hnd(p, r->in.user_handle))
    48174885                return NT_STATUS_OBJECT_NAME_INVALID;
     4886
     4887        ZERO_STRUCTP(r->out.user_handle);
    48184888
    48194889        force_flush_samr_cache(disp_info);
     
    54755545
    54765546        /*check if access can be granted as requested by client. */
     5547        map_max_allowed_access(p->pipe_user.nt_user_token, &des_access);
     5548
    54775549        make_samr_object_sd(p->mem_ctx, &psd, &sd_size, &grp_generic_mapping, NULL, 0);
    54785550        se_map_generic(&des_access,&grp_generic_mapping);
     
    55875659                                struct samr_QueryDomainInfo2 *r)
    55885660{
    5589         return samr_QueryDomainInfo_internal("_samr_QueryDomainInfo2",
    5590                                              p,
    5591                                              r->in.domain_handle,
    5592                                              r->in.level,
    5593                                              r->out.info);
     5661        struct samr_QueryDomainInfo q;
     5662
     5663        q.in.domain_handle      = r->in.domain_handle;
     5664        q.in.level              = r->in.level;
     5665
     5666        q.out.info              = r->out.info;
     5667
     5668        return _samr_QueryDomainInfo(p, &q);
    55945669}
    55955670
     
    56015676                             struct samr_SetDomainInfo *r)
    56025677{
     5678        struct samr_info *info = NULL;
    56035679        time_t u_expire, u_min_age;
    56045680        time_t u_logout;
    56055681        time_t u_lock_duration, u_reset_time;
     5682        NTSTATUS result;
    56065683
    56075684        DEBUG(5,("_samr_SetDomainInfo: %d\n", __LINE__));
    56085685
    56095686        /* find the policy handle.  open a policy on it. */
    5610         if (!find_policy_by_hnd(p, r->in.domain_handle, NULL))
     5687        if (!find_policy_by_hnd(p, r->in.domain_handle, (void **)(void *)&info))
    56115688                return NT_STATUS_INVALID_HANDLE;
     5689
     5690        /* We do have different access bits for info
     5691         * levels here, but we're really just looking for
     5692         * GENERIC_RIGHTS_DOMAIN_WRITE access. Unfortunately
     5693         * this maps to different specific bits. So
     5694         * assume if we have SA_RIGHT_DOMAIN_SET_INFO_1
     5695         * set we are ok. */
     5696
     5697        result = access_check_samr_function(info->acc_granted,
     5698                                            SA_RIGHT_DOMAIN_SET_INFO_1,
     5699                                            "_samr_SetDomainInfo");
     5700
     5701        if (!NT_STATUS_IS_OK(result))
     5702                return result;
    56125703
    56135704        DEBUG(5,("_samr_SetDomainInfo: level: %d\n", r->in.level));
     
    56685759        uint32_t num_account = 0;
    56695760        struct samr_displayentry *entries = NULL;
     5761        NTSTATUS status;
    56705762
    56715763        DEBUG(5,("_samr_GetDisplayEnumerationIndex: %d\n", __LINE__));
     
    56745766        if (!find_policy_by_hnd(p, r->in.domain_handle, (void **)(void *)&info)) {
    56755767                return NT_STATUS_INVALID_HANDLE;
     5768        }
     5769
     5770        status = access_check_samr_function(info->acc_granted,
     5771                                            SA_RIGHT_DOMAIN_ENUM_ACCOUNTS,
     5772                                            "_samr_GetDisplayEnumerationIndex");
     5773        if (!NT_STATUS_IS_OK(status)) {
     5774                return status;
    56765775        }
    56775776
  • branches/samba-3.2.x/source/rpc_server/srv_srvsvc_nt.c

    r137 r228  
    16901690        DEBUG(5,("_srvsvc_NetShareAdd: %d\n", __LINE__));
    16911691
    1692         *r->out.parm_error = 0;
     1692        if (r->out.parm_error) {
     1693                *r->out.parm_error = 0;
     1694        }
    16931695
    16941696        get_current_user(&user,p);
Note: See TracChangeset for help on using the changeset viewer.