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/winbindd/idmap_nss.c

    r414 r745  
    22   Unix SMB/CIFS implementation.
    33
    4    idmap PASSDB backend
     4   idmap NSS backend
    55
    66   Copyright (C) Simo Sorce 2006
    7    
     7
    88   This program is free software; you can redistribute it and/or modify
    99   it under the terms of the GNU General Public License as published by
    1010   the Free Software Foundation; either version 3 of the License, or
    1111   (at your option) any later version.
    12    
     12
    1313   This program is distributed in the hope that it will be useful,
    1414   but WITHOUT ANY WARRANTY; without even the implied warranty of
    1515   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1616   GNU General Public License for more details.
    17    
     17
    1818   You should have received a copy of the GNU General Public License
    1919   along with this program.  If not, see <http://www.gnu.org/licenses/>.
     
    2121
    2222#include "includes.h"
     23#include "system/passwd.h"
    2324#include "winbindd.h"
     25#include "nsswitch/winbind_client.h"
     26#include "idmap.h"
     27#include "lib/winbind_util.h"
    2428
    2529#undef DBGC_CLASS
     
    3034*****************************/
    3135
    32 static NTSTATUS idmap_nss_int_init(struct idmap_domain *dom,
    33                                    const char *params)
     36static NTSTATUS idmap_nss_int_init(struct idmap_domain *dom)
    3437{       
    3538        return NT_STATUS_OK;
     
    4245static NTSTATUS idmap_nss_unixids_to_sids(struct idmap_domain *dom, struct id_map **ids)
    4346{
    44         TALLOC_CTX *ctx;
    4547        int i;
    4648
     
    4850        for (i = 0; ids[i]; i++) {
    4951                ids[i]->status = ID_UNKNOWN;
    50         }
    51        
    52         ctx = talloc_new(dom);
    53         if ( ! ctx) {
    54                 DEBUG(0, ("Out of memory!\n"));
    55                 return NT_STATUS_NO_MEMORY;
    5652        }
    5753
     
    6258                enum lsa_SidType type;
    6359                bool ret;
    64                
     60
    6561                switch (ids[i]->xid.type) {
    6662                case ID_TYPE_UID:
     
    121117                }
    122118        }
    123 
    124 
    125         talloc_free(ctx);
    126119        return NT_STATUS_OK;
    127120}
     
    133126static NTSTATUS idmap_nss_sids_to_unixids(struct idmap_domain *dom, struct id_map **ids)
    134127{
    135         TALLOC_CTX *ctx;
    136128        int i;
    137129
     
    139131        for (i = 0; ids[i]; i++) {
    140132                ids[i]->status = ID_UNKNOWN;
    141         }
    142        
    143         ctx = talloc_new(dom);
    144         if ( ! ctx) {
    145                 DEBUG(0, ("Out of memory!\n"));
    146                 return NT_STATUS_NO_MEMORY;
    147133        }
    148134
     
    150136                struct group *gr;
    151137                enum lsa_SidType type;
    152                 const char *dom_name = NULL;
    153                 const char *name = NULL;
     138                char *name = NULL;
    154139                bool ret;
    155140
     
    157142                   the following call will not recurse so this is safe */
    158143                (void)winbind_on();
    159                 ret = winbind_lookup_sid(ctx, ids[i]->sid, &dom_name, &name, &type);
     144                ret = winbind_lookup_sid(talloc_tos(), ids[i]->sid, NULL,
     145                                         (const char **)&name, &type);
    160146                (void)winbind_off();
    161147
     
    199185                        break;
    200186                }
    201         }
    202 
    203         talloc_free(ctx);
     187                TALLOC_FREE(name);
     188        }
    204189        return NT_STATUS_OK;
    205190}
     
    209194**********************************/
    210195
    211 static NTSTATUS idmap_nss_close(struct idmap_domain *dom)
    212 {
    213         return NT_STATUS_OK;
    214 }
    215 
    216196static struct idmap_methods nss_methods = {
    217197
     
    219199        .unixids_to_sids = idmap_nss_unixids_to_sids,
    220200        .sids_to_unixids = idmap_nss_sids_to_unixids,
    221         .close_fn = idmap_nss_close
    222201};
    223202
Note: See TracChangeset for help on using the changeset viewer.