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/passdb/machine_sid.c

    r414 r745  
    66   Copyright (C) Gerald (Jerry) Carter          2000
    77   Copyright (C) Stefan (metze) Metzmacher      2002
    8      
     8
    99   This program is free software; you can redistribute it and/or modify
    1010   it under the terms of the GNU General Public License as published by
    1111   the Free Software Foundation; either version 3 of the License, or
    1212   (at your option) any later version.
    13    
     13
    1414   This program is distributed in the hope that it will be useful,
    1515   but WITHOUT ANY WARRANTY; without even the implied warranty of
    1616   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1717   GNU General Public License for more details.
    18    
     18
    1919   You should have received a copy of the GNU General Public License
    2020   along with this program.  If not, see <http://www.gnu.org/licenses/>.
     
    2222
    2323#include "includes.h"
     24#include "passdb.h"
     25#include "secrets.h"
     26#include "dbwrap.h"
     27#include "../libcli/security/security.h"
    2428
    2529/* NOTE! the global_sam_sid is the SID of our local SAM. This is only
    2630   equal to the domain SID when we are a DC, otherwise its our
    2731   workstation SID */
    28 static DOM_SID *global_sam_sid=NULL;
     32static struct dom_sid *global_sam_sid=NULL;
    2933
    3034#undef DBGC_CLASS
     
    3640****************************************************************************/
    3741
    38 static bool read_sid_from_file(const char *fname, DOM_SID *sid)
     42static bool read_sid_from_file(const char *fname, struct dom_sid *sid)
    3943{
    4044        char **lines;
     
    4347
    4448        lines = file_lines_load(fname, &numlines,0, NULL);
    45        
     49
    4650        if (!lines || numlines < 1) {
    47                 if (lines) TALLOC_FREE(lines);
     51                TALLOC_FREE(lines);
    4852                return False;
    4953        }
    50        
     54
    5155        ret = string_to_sid(sid, lines[0]);
    5256        TALLOC_FREE(lines);
     
    5761  generate a random sid - used to build our own sid if we don't have one
    5862*/
    59 static void generate_random_sid(DOM_SID *sid)
     63static void generate_random_sid(struct dom_sid *sid)
    6064{
    6165        int i;
    6266        uchar raw_sid_data[12];
    6367
    64         memset((char *)sid, '\0', sizeof(*sid));
     68        ZERO_STRUCTP(sid);
     69
    6570        sid->sid_rev_num = 1;
    6671        sid->id_auth[5] = 5;
     
    7782****************************************************************************/
    7883
    79 static DOM_SID *pdb_generate_sam_sid(void)
    80 {
    81         DOM_SID domain_sid;
     84static struct dom_sid *pdb_generate_sam_sid(void)
     85{
     86        struct dom_sid domain_sid;
    8287        char *fname = NULL;
    83         DOM_SID *sam_sid;
    84        
    85         if(!(sam_sid=SMB_MALLOC_P(DOM_SID)))
     88        struct dom_sid *sam_sid;
     89
     90        if(!(sam_sid=SMB_MALLOC_P(struct dom_sid)))
    8691                return NULL;
    8792
     
    111116                }
    112117
    113                 if (!sid_equal(&domain_sid, sam_sid)) {
     118                if (!dom_sid_equal(&domain_sid, sam_sid)) {
    114119
    115120                        /* Domain name sid doesn't match global sam sid. Re-store domain sid as 'local' sid. */
     
    125130
    126131                return sam_sid;
    127                
    128132        }
    129133
     
    180184
    181185/* return our global_sam_sid */
    182 DOM_SID *get_global_sam_sid(void)
     186struct dom_sid *get_global_sam_sid(void)
    183187{
    184188        struct db_context *db;
     
    186190        if (global_sam_sid != NULL)
    187191                return global_sam_sid;
    188        
     192
    189193        /*
    190194         * memory for global_sam_sid is allocated in
     
    229233*****************************************************************/ 
    230234
    231 bool sid_check_is_domain(const DOM_SID *sid)
    232 {
    233         return sid_equal(sid, get_global_sam_sid());
     235bool sid_check_is_domain(const struct dom_sid *sid)
     236{
     237        return dom_sid_equal(sid, get_global_sam_sid());
    234238}
    235239
     
    238242*****************************************************************/ 
    239243
    240 bool sid_check_is_in_our_domain(const DOM_SID *sid)
    241 {
    242         DOM_SID dom_sid;
    243         uint32 rid;
     244bool sid_check_is_in_our_domain(const struct dom_sid *sid)
     245{
     246        struct dom_sid dom_sid;
    244247
    245248        sid_copy(&dom_sid, sid);
    246         sid_split_rid(&dom_sid, &rid);
     249        sid_split_rid(&dom_sid, NULL);
    247250        return sid_check_is_domain(&dom_sid);
    248251}
Note: See TracChangeset for help on using the changeset viewer.