Changeset 745 for trunk/server/source3/winbindd/idmap_nss.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/winbindd/idmap_nss.c
r414 r745 2 2 Unix SMB/CIFS implementation. 3 3 4 idmap PASSDBbackend4 idmap NSS backend 5 5 6 6 Copyright (C) Simo Sorce 2006 7 7 8 8 This program is free software; you can redistribute it and/or modify 9 9 it under the terms of the GNU General Public License as published by 10 10 the Free Software Foundation; either version 3 of the License, or 11 11 (at your option) any later version. 12 12 13 13 This program is distributed in the hope that it will be useful, 14 14 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 16 GNU General Public License for more details. 17 17 18 18 You should have received a copy of the GNU General Public License 19 19 along with this program. If not, see <http://www.gnu.org/licenses/>. … … 21 21 22 22 #include "includes.h" 23 #include "system/passwd.h" 23 24 #include "winbindd.h" 25 #include "nsswitch/winbind_client.h" 26 #include "idmap.h" 27 #include "lib/winbind_util.h" 24 28 25 29 #undef DBGC_CLASS … … 30 34 *****************************/ 31 35 32 static NTSTATUS idmap_nss_int_init(struct idmap_domain *dom, 33 const char *params) 36 static NTSTATUS idmap_nss_int_init(struct idmap_domain *dom) 34 37 { 35 38 return NT_STATUS_OK; … … 42 45 static NTSTATUS idmap_nss_unixids_to_sids(struct idmap_domain *dom, struct id_map **ids) 43 46 { 44 TALLOC_CTX *ctx;45 47 int i; 46 48 … … 48 50 for (i = 0; ids[i]; i++) { 49 51 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;56 52 } 57 53 … … 62 58 enum lsa_SidType type; 63 59 bool ret; 64 60 65 61 switch (ids[i]->xid.type) { 66 62 case ID_TYPE_UID: … … 121 117 } 122 118 } 123 124 125 talloc_free(ctx);126 119 return NT_STATUS_OK; 127 120 } … … 133 126 static NTSTATUS idmap_nss_sids_to_unixids(struct idmap_domain *dom, struct id_map **ids) 134 127 { 135 TALLOC_CTX *ctx;136 128 int i; 137 129 … … 139 131 for (i = 0; ids[i]; i++) { 140 132 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;147 133 } 148 134 … … 150 136 struct group *gr; 151 137 enum lsa_SidType type; 152 const char *dom_name = NULL; 153 const char *name = NULL; 138 char *name = NULL; 154 139 bool ret; 155 140 … … 157 142 the following call will not recurse so this is safe */ 158 143 (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); 160 146 (void)winbind_off(); 161 147 … … 199 185 break; 200 186 } 201 } 202 203 talloc_free(ctx); 187 TALLOC_FREE(name); 188 } 204 189 return NT_STATUS_OK; 205 190 } … … 209 194 **********************************/ 210 195 211 static NTSTATUS idmap_nss_close(struct idmap_domain *dom)212 {213 return NT_STATUS_OK;214 }215 216 196 static struct idmap_methods nss_methods = { 217 197 … … 219 199 .unixids_to_sids = idmap_nss_unixids_to_sids, 220 200 .sids_to_unixids = idmap_nss_sids_to_unixids, 221 .close_fn = idmap_nss_close222 201 }; 223 202
Note:
See TracChangeset
for help on using the changeset viewer.