Print this page
MFV: illumos-gate@62f63298eba531d48f87aa8c2089298cb7821962
9881 smbd terminated by SIGABRT after smb_account_free()
Reviewed by: Gordon Ross <gordon.w.ross@gmail.com>
Reviewed by: Jason King <jason.brian.king@gmail.com>
Approved by: Dan McDonald <danmcd@joyent.com>
Author: Vitaliy Gusev <gusev.vitaliy@gmail.com>
Conflicts:
usr/src/lib/smbsrv/libsmb/common/smb_sam.c
NEX-15052 Need a way to add appliance local user/group ACE from Windows
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
NEX-15052 Need a way to add appliance local user/group ACE from Windows
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
SMB-50 User-mode SMB server
Includes work by these authors:
Thomas Keiser <thomas.keiser@nexenta.com>
Albert Lee <trisk@nexenta.com>
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/lib/smbsrv/libsmb/common/smb_sam.c
+++ new/usr/src/lib/smbsrv/libsmb/common/smb_sam.c
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
↓ open down ↓ |
14 lines elided |
↑ open up ↑ |
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
23 23 * Use is subject to license terms.
24 24 *
25 - * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
25 + * Copyright 2017 Nexenta Systems, Inc. All rights reserved.
26 + * Copyright 2018 RackTop Systems.
26 27 */
27 28
28 29 #include <strings.h>
29 30 #include <smbsrv/libsmb.h>
30 31
31 32 extern int smb_pwd_num(void);
32 33 extern int smb_lgrp_numbydomain(smb_domain_type_t, int *);
33 34
34 35 static uint32_t smb_sam_lookup_user(char *, smb_sid_t **);
35 36 static uint32_t smb_sam_lookup_group(char *, smb_sid_t **);
36 37
37 38 /*
38 39 * Local well-known accounts data structure table and prototypes
39 40 */
40 41 typedef struct smb_lwka {
41 42 uint32_t lwka_rid;
42 43 char *lwka_name;
43 44 uint16_t lwka_type;
44 45 } smb_lwka_t;
45 46
46 47 static smb_lwka_t lwka_tbl[] = {
47 48 { 500, "Administrator", SidTypeUser },
48 49 { 501, "Guest", SidTypeUser },
49 50 { 502, "KRBTGT", SidTypeUser },
50 51 { 512, "Domain Admins", SidTypeGroup },
51 52 { 513, "Domain Users", SidTypeGroup },
52 53 { 514, "Domain Guests", SidTypeGroup },
53 54 { 516, "Domain Controllers", SidTypeGroup },
54 55 { 517, "Cert Publishers", SidTypeGroup },
55 56 { 518, "Schema Admins", SidTypeGroup },
56 57 { 519, "Enterprise Admins", SidTypeGroup },
57 58 { 520, "Global Policy Creator Owners", SidTypeGroup },
58 59 { 533, "RAS and IAS Servers", SidTypeGroup }
59 60 };
60 61
61 62 #define SMB_LWKA_NUM (sizeof (lwka_tbl)/sizeof (lwka_tbl[0]))
62 63
63 64 static smb_lwka_t *smb_lwka_lookup_name(char *);
64 65 static smb_lwka_t *smb_lwka_lookup_sid(smb_sid_t *);
65 66
66 67 /*
67 68 * Looks up the given name in local account databases:
68 69 *
69 70 * SMB Local users are looked up in /var/smb/smbpasswd
70 71 * SMB Local groups are looked up in /var/smb/smbgroup.db
71 72 *
72 73 * If the account is found, its information is populated
73 74 * in the passed smb_account_t structure. Caller must free
74 75 * allocated memories by calling smb_account_free() upon
75 76 * successful return.
76 77 *
77 78 * The type of account is specified by 'type', which can be user,
78 79 * alias (local group) or unknown. If the caller doesn't know
79 80 * whether the name is a user or group name then SidTypeUnknown
80 81 * should be passed.
81 82 *
82 83 * If a local user and group have the same name, the user will
83 84 * always be picked. Note that this situation cannot happen on
|
↓ open down ↓ |
48 lines elided |
↑ open up ↑ |
84 85 * Windows systems.
85 86 *
86 87 * If a SMB local user/group is found but it turns out that
87 88 * it'll be mapped to a domain user/group the lookup is considered
88 89 * failed and NT_STATUS_NONE_MAPPED is returned.
89 90 *
90 91 * Return status:
91 92 *
92 93 * NT_STATUS_NOT_FOUND This is not a local account
93 94 * NT_STATUS_NONE_MAPPED It's a local account but cannot be
94 - * translated.
95 + * translated.
95 96 * other error status codes.
96 97 */
97 98 uint32_t
98 99 smb_sam_lookup_name(char *domain, char *name, uint16_t type,
99 100 smb_account_t *account)
100 101 {
101 102 smb_domain_t di;
102 103 smb_sid_t *sid;
103 104 uint32_t status;
104 105 smb_lwka_t *lwka;
105 106
106 107 bzero(account, sizeof (smb_account_t));
107 108
108 109 if (domain != NULL) {
109 110 if (!smb_domain_lookup_name(domain, &di) ||
110 111 (di.di_type != SMB_DOMAIN_LOCAL))
111 112 return (NT_STATUS_NOT_FOUND);
112 113
113 114 /* Only Netbios hostname is accepted */
114 115 if (smb_strcasecmp(domain, di.di_nbname, 0) != 0)
115 116 return (NT_STATUS_NONE_MAPPED);
116 117 } else {
117 118 if (!smb_domain_lookup_type(SMB_DOMAIN_LOCAL, &di))
118 119 return (NT_STATUS_CANT_ACCESS_DOMAIN_INFO);
119 120 }
120 121
121 122 if (smb_strcasecmp(name, di.di_nbname, 0) == 0) {
122 123 /* This is the local domain name */
123 124 account->a_type = SidTypeDomain;
124 125 account->a_name = strdup("");
125 126 account->a_domain = strdup(di.di_nbname);
126 127 account->a_sid = smb_sid_dup(di.di_binsid);
127 128 account->a_domsid = smb_sid_dup(di.di_binsid);
128 129 account->a_rid = (uint32_t)-1;
129 130
130 131 if (!smb_account_validate(account)) {
131 132 smb_account_free(account);
132 133 return (NT_STATUS_NO_MEMORY);
133 134 }
134 135
135 136 return (NT_STATUS_SUCCESS);
136 137 }
137 138
138 139 if ((lwka = smb_lwka_lookup_name(name)) != NULL) {
139 140 sid = smb_sid_splice(di.di_binsid, lwka->lwka_rid);
140 141 type = lwka->lwka_type;
141 142 } else {
142 143 switch (type) {
143 144 case SidTypeUser:
144 145 status = smb_sam_lookup_user(name, &sid);
145 146 if (status != NT_STATUS_SUCCESS)
146 147 return (status);
147 148 break;
148 149
149 150 case SidTypeAlias:
150 151 status = smb_sam_lookup_group(name, &sid);
151 152 if (status != NT_STATUS_SUCCESS)
152 153 return (status);
153 154 break;
154 155
155 156 case SidTypeUnknown:
156 157 type = SidTypeUser;
157 158 status = smb_sam_lookup_user(name, &sid);
158 159 if (status == NT_STATUS_SUCCESS)
159 160 break;
160 161
161 162 if (status == NT_STATUS_NONE_MAPPED)
162 163 return (status);
163 164
164 165 type = SidTypeAlias;
165 166 status = smb_sam_lookup_group(name, &sid);
166 167 if (status != NT_STATUS_SUCCESS)
167 168 return (status);
168 169 break;
169 170
170 171 default:
171 172 return (NT_STATUS_INVALID_PARAMETER);
172 173 }
173 174 }
174 175
175 176 account->a_name = strdup(name);
176 177 account->a_sid = sid;
177 178 account->a_domain = strdup(di.di_nbname);
178 179 account->a_domsid = smb_sid_split(sid, &account->a_rid);
179 180 account->a_type = type;
180 181
181 182 if (!smb_account_validate(account)) {
182 183 smb_account_free(account);
183 184 return (NT_STATUS_NO_MEMORY);
184 185 }
185 186
186 187 return (NT_STATUS_SUCCESS);
187 188 }
188 189
189 190 /*
190 191 * Looks up the given SID in local account databases:
191 192 *
192 193 * SMB Local users are looked up in /var/smb/smbpasswd
193 194 * SMB Local groups are looked up in /var/smb/smbgroup.db
|
↓ open down ↓ |
89 lines elided |
↑ open up ↑ |
194 195 *
195 196 * If the account is found, its information is populated
196 197 * in the passed smb_account_t structure. Caller must free
197 198 * allocated memories by calling smb_account_free() upon
198 199 * successful return.
199 200 *
200 201 * Return status:
201 202 *
202 203 * NT_STATUS_NOT_FOUND This is not a local account
203 204 * NT_STATUS_NONE_MAPPED It's a local account but cannot be
204 - * translated.
205 + * translated.
205 206 * other error status codes.
206 207 */
207 208 uint32_t
208 209 smb_sam_lookup_sid(smb_sid_t *sid, smb_account_t *account)
209 210 {
210 211 char hostname[MAXHOSTNAMELEN];
211 212 smb_passwd_t smbpw;
212 213 smb_group_t grp;
213 214 smb_lwka_t *lwka;
214 215 smb_domain_t di;
215 216 uint32_t rid;
216 217 uid_t id;
217 218 int id_type;
218 219 int rc;
219 220
220 221 bzero(account, sizeof (smb_account_t));
221 222
222 223 if (!smb_domain_lookup_type(SMB_DOMAIN_LOCAL, &di))
223 224 return (NT_STATUS_CANT_ACCESS_DOMAIN_INFO);
224 225
225 226 if (smb_sid_cmp(sid, di.di_binsid)) {
226 227 /* This is the local domain SID */
227 228 account->a_type = SidTypeDomain;
228 229 account->a_name = strdup("");
229 230 account->a_domain = strdup(di.di_nbname);
230 231 account->a_sid = smb_sid_dup(sid);
231 232 account->a_domsid = smb_sid_dup(sid);
232 233 account->a_rid = (uint32_t)-1;
233 234
234 235 if (!smb_account_validate(account)) {
235 236 smb_account_free(account);
236 237 return (NT_STATUS_NO_MEMORY);
237 238 }
238 239
239 240 return (NT_STATUS_SUCCESS);
240 241 }
241 242
242 243 if (!smb_sid_indomain(di.di_binsid, sid)) {
243 244 /* This is not a local SID */
244 245 return (NT_STATUS_NOT_FOUND);
245 246 }
246 247
247 248 if ((lwka = smb_lwka_lookup_sid(sid)) != NULL) {
248 249 account->a_type = lwka->lwka_type;
249 250 account->a_name = strdup(lwka->lwka_name);
250 251 } else {
251 252 id_type = SMB_IDMAP_UNKNOWN;
|
↓ open down ↓ |
37 lines elided |
↑ open up ↑ |
252 253 if (smb_idmap_getid(sid, &id, &id_type) != IDMAP_SUCCESS)
253 254 return (NT_STATUS_NONE_MAPPED);
254 255
255 256 switch (id_type) {
256 257 case SMB_IDMAP_USER:
257 258 account->a_type = SidTypeUser;
258 259 if (smb_pwd_getpwuid(id, &smbpw) == NULL)
259 260 return (NT_STATUS_NO_SUCH_USER);
260 261
261 262 account->a_name = strdup(smbpw.pw_name);
263 + account->a_flags = smbpw.pw_flags;
262 264 break;
263 265
264 266 case SMB_IDMAP_GROUP:
265 267 account->a_type = SidTypeAlias;
266 268 (void) smb_sid_getrid(sid, &rid);
267 269 rc = smb_lgrp_getbyrid(rid, SMB_DOMAIN_LOCAL, &grp);
268 270 if (rc != SMB_LGRP_SUCCESS)
269 271 return (NT_STATUS_NO_SUCH_ALIAS);
270 272
271 273 account->a_name = strdup(grp.sg_name);
272 274 smb_lgrp_free(&grp);
273 275 break;
274 276
275 277 default:
276 278 return (NT_STATUS_NONE_MAPPED);
277 279 }
278 280 }
279 281
280 282 if (smb_getnetbiosname(hostname, MAXHOSTNAMELEN) == 0)
281 283 account->a_domain = strdup(hostname);
282 284 account->a_sid = smb_sid_dup(sid);
283 285 account->a_domsid = smb_sid_split(sid, &account->a_rid);
284 286
285 287 if (!smb_account_validate(account)) {
286 288 smb_account_free(account);
287 289 return (NT_STATUS_NO_MEMORY);
288 290 }
289 291
290 292 return (NT_STATUS_SUCCESS);
291 293 }
292 294
293 295 /*
294 296 * Returns number of SMB users, i.e. users who have entry
295 297 * in /var/smb/smbpasswd
296 298 */
297 299 int
298 300 smb_sam_usr_cnt(void)
299 301 {
300 302 return (smb_pwd_num());
301 303 }
302 304
303 305 /*
304 306 * Updates a list of groups in which the given user is a member
305 307 * by adding any local (SAM) groups.
306 308 *
307 309 * We are a member of local groups where the local group
308 310 * contains either the user's primary SID, or any of their
309 311 * other SIDs such as from domain groups, SID history, etc.
310 312 * We can have indirect membership via domain groups.
311 313 */
312 314 uint32_t
313 315 smb_sam_usr_groups(smb_sid_t *user_sid, smb_ids_t *gids)
314 316 {
315 317 smb_ids_t new_gids;
316 318 smb_id_t *ids, *new_ids;
317 319 smb_giter_t gi;
318 320 smb_group_t lgrp;
319 321 int i, gcnt, total_cnt;
320 322 uint32_t ret;
321 323 boolean_t member;
322 324
323 325 /*
324 326 * First pass: count groups to be added (gcnt)
325 327 */
326 328 gcnt = 0;
327 329 if (smb_lgrp_iteropen(&gi) != SMB_LGRP_SUCCESS)
328 330 return (NT_STATUS_INTERNAL_ERROR);
329 331
330 332 while (smb_lgrp_iterate(&gi, &lgrp) == SMB_LGRP_SUCCESS) {
331 333 member = B_FALSE;
332 334 if (smb_lgrp_is_member(&lgrp, user_sid))
333 335 member = B_TRUE;
334 336 else for (i = 0, ids = gids->i_ids;
335 337 i < gids->i_cnt; i++, ids++) {
336 338 if (smb_lgrp_is_member(&lgrp, ids->i_sid)) {
337 339 member = B_TRUE;
338 340 break;
339 341 }
340 342 }
341 343 /* Careful: only count lgrp once */
342 344 if (member)
343 345 gcnt++;
344 346 smb_lgrp_free(&lgrp);
345 347 }
346 348 smb_lgrp_iterclose(&gi);
347 349
348 350 if (gcnt == 0)
349 351 return (NT_STATUS_SUCCESS);
350 352
351 353 /*
352 354 * Second pass: add to groups list.
353 355 * Do not modify gcnt after here.
354 356 */
355 357 if (smb_lgrp_iteropen(&gi) != SMB_LGRP_SUCCESS)
356 358 return (NT_STATUS_INTERNAL_ERROR);
357 359
358 360 /*
359 361 * Expand the list (copy to a new, larger one)
360 362 * Note: were're copying pointers from the old
361 363 * array to the new (larger) array, and then
362 364 * adding new pointers after what we copied.
363 365 */
364 366 ret = 0;
365 367 new_gids.i_cnt = gids->i_cnt;
366 368 total_cnt = gids->i_cnt + gcnt;
367 369 new_gids.i_ids = malloc(total_cnt * sizeof (smb_id_t));
368 370 if (new_gids.i_ids == NULL) {
369 371 ret = NT_STATUS_NO_MEMORY;
370 372 goto out;
371 373 }
372 374 (void) memcpy(new_gids.i_ids, gids->i_ids,
373 375 gids->i_cnt * sizeof (smb_id_t));
374 376 new_ids = new_gids.i_ids + gids->i_cnt;
375 377 (void) memset(new_ids, 0, gcnt * sizeof (smb_id_t));
376 378
377 379 /*
378 380 * Add group SIDs starting at the end of the
379 381 * previous list. (new_ids)
380 382 */
381 383 while (smb_lgrp_iterate(&gi, &lgrp) == SMB_LGRP_SUCCESS) {
382 384 member = B_FALSE;
383 385 if (smb_lgrp_is_member(&lgrp, user_sid))
384 386 member = B_TRUE;
385 387 else for (i = 0, ids = gids->i_ids;
386 388 i < gids->i_cnt; i++, ids++) {
387 389 if (smb_lgrp_is_member(&lgrp, ids->i_sid)) {
388 390 member = B_TRUE;
389 391 break;
390 392 }
391 393 }
392 394 if (member && (new_gids.i_cnt < (gids->i_cnt + gcnt))) {
393 395 new_ids->i_sid = smb_sid_dup(lgrp.sg_id.gs_sid);
394 396 if (new_ids->i_sid == NULL) {
395 397 smb_lgrp_free(&lgrp);
396 398 ret = NT_STATUS_NO_MEMORY;
397 399 goto out;
398 400 }
399 401 new_ids->i_attrs = lgrp.sg_attr;
400 402 new_ids++;
401 403 new_gids.i_cnt++;
402 404 }
403 405 smb_lgrp_free(&lgrp);
404 406 }
405 407
406 408 out:
407 409 smb_lgrp_iterclose(&gi);
408 410
409 411 if (ret != 0) {
410 412 if (new_gids.i_ids != NULL) {
411 413 /*
412 414 * Free only the new sids we added.
413 415 * The old ones were copied ptrs.
414 416 */
415 417 ids = new_gids.i_ids + gids->i_cnt;
416 418 for (i = 0; i < gcnt; i++, ids++) {
417 419 smb_sid_free(ids->i_sid);
418 420 }
419 421 free(new_gids.i_ids);
420 422 }
421 423 return (ret);
422 424 }
423 425
424 426 /*
425 427 * Success! Update passed gids and
426 428 * free the old array.
427 429 */
428 430 free(gids->i_ids);
429 431 *gids = new_gids;
430 432
431 433 return (NT_STATUS_SUCCESS);
432 434 }
433 435
434 436 /*
435 437 * Returns the number of built-in or local groups stored
436 438 * in /var/smb/smbgroup.db
437 439 */
438 440 int
439 441 smb_sam_grp_cnt(smb_domain_type_t dtype)
440 442 {
441 443 int grpcnt;
442 444 int rc;
443 445
444 446 switch (dtype) {
445 447 case SMB_DOMAIN_BUILTIN:
446 448 rc = smb_lgrp_numbydomain(SMB_DOMAIN_BUILTIN, &grpcnt);
447 449 break;
448 450
449 451 case SMB_DOMAIN_LOCAL:
450 452 rc = smb_lgrp_numbydomain(SMB_DOMAIN_LOCAL, &grpcnt);
451 453 break;
452 454
453 455 default:
454 456 rc = SMB_LGRP_INVALID_ARG;
455 457 }
456 458
457 459 return ((rc == SMB_LGRP_SUCCESS) ? grpcnt : 0);
458 460 }
459 461
460 462 /*
461 463 * Determines whether the given SID is a member of the group
462 464 * specified by gname.
463 465 */
464 466 boolean_t
465 467 smb_sam_grp_ismember(const char *gname, smb_sid_t *sid)
466 468 {
467 469 smb_group_t grp;
468 470 boolean_t ismember = B_FALSE;
469 471
|
↓ open down ↓ |
198 lines elided |
↑ open up ↑ |
470 472 if (smb_lgrp_getbyname((char *)gname, &grp) == SMB_LGRP_SUCCESS) {
471 473 ismember = smb_lgrp_is_member(&grp, sid);
472 474 smb_lgrp_free(&grp);
473 475 }
474 476
475 477 return (ismember);
476 478 }
477 479
478 480 /*
479 481 * Frees memories allocated for the passed account fields.
482 + * Initializes @account after all.
480 483 */
481 484 void
482 485 smb_account_free(smb_account_t *account)
483 486 {
484 487 free(account->a_name);
485 488 free(account->a_domain);
486 489 smb_sid_free(account->a_sid);
487 490 smb_sid_free(account->a_domsid);
491 +
492 + bzero(account, sizeof (smb_account_t));
488 493 }
489 494
490 495 /*
491 496 * Validates the given account.
492 497 */
493 498 boolean_t
494 499 smb_account_validate(smb_account_t *account)
495 500 {
496 501 return ((account->a_name != NULL) && (account->a_sid != NULL) &&
497 502 (account->a_domain != NULL) && (account->a_domsid != NULL));
498 503 }
499 504
500 505 /*
501 506 * Lookup local SMB user account database (/var/smb/smbpasswd)
502 507 * if there's a match query its SID from idmap service and make
503 508 * sure the SID is a local SID.
504 509 *
505 510 * The memory for the returned SID must be freed by the caller.
506 511 */
507 512 static uint32_t
508 513 smb_sam_lookup_user(char *name, smb_sid_t **sid)
509 514 {
510 515 smb_passwd_t smbpw;
511 516
512 517 if (smb_pwd_getpwnam(name, &smbpw) == NULL)
513 518 return (NT_STATUS_NO_SUCH_USER);
514 519
515 520 if (smb_idmap_getsid(smbpw.pw_uid, SMB_IDMAP_USER, sid)
516 521 != IDMAP_SUCCESS)
517 522 return (NT_STATUS_NONE_MAPPED);
518 523
519 524 if (!smb_sid_islocal(*sid)) {
520 525 smb_sid_free(*sid);
521 526 return (NT_STATUS_NONE_MAPPED);
522 527 }
523 528
524 529 return (NT_STATUS_SUCCESS);
525 530 }
526 531
527 532 /*
528 533 * Lookup local SMB group account database (/var/smb/smbgroup.db)
529 534 * The memory for the returned SID must be freed by the caller.
530 535 */
531 536 static uint32_t
532 537 smb_sam_lookup_group(char *name, smb_sid_t **sid)
533 538 {
534 539 smb_group_t grp;
535 540
536 541 if (smb_lgrp_getbyname(name, &grp) != SMB_LGRP_SUCCESS)
537 542 return (NT_STATUS_NO_SUCH_ALIAS);
538 543
539 544 *sid = smb_sid_dup(grp.sg_id.gs_sid);
540 545 smb_lgrp_free(&grp);
541 546
542 547 return ((*sid == NULL) ? NT_STATUS_NO_MEMORY : NT_STATUS_SUCCESS);
543 548 }
544 549
545 550 static smb_lwka_t *
546 551 smb_lwka_lookup_name(char *name)
547 552 {
548 553 int i;
549 554
550 555 for (i = 0; i < SMB_LWKA_NUM; i++) {
551 556 if (smb_strcasecmp(name, lwka_tbl[i].lwka_name, 0) == 0)
552 557 return (&lwka_tbl[i]);
553 558 }
554 559
555 560 return (NULL);
556 561 }
557 562
558 563 static smb_lwka_t *
559 564 smb_lwka_lookup_sid(smb_sid_t *sid)
560 565 {
561 566 uint32_t rid;
562 567 int i;
563 568
564 569 (void) smb_sid_getrid(sid, &rid);
565 570 if (rid > 999)
566 571 return (NULL);
567 572
568 573 for (i = 0; i < SMB_LWKA_NUM; i++) {
569 574 if (rid == lwka_tbl[i].lwka_rid)
570 575 return (&lwka_tbl[i]);
571 576 }
572 577
573 578 return (NULL);
574 579 }
575 580
576 581 /*
577 582 * smb_sid_islocal
578 583 *
579 584 * Check a SID to see if it belongs to the local domain.
580 585 */
581 586 boolean_t
582 587 smb_sid_islocal(smb_sid_t *sid)
583 588 {
584 589 smb_domain_t di;
585 590 boolean_t islocal = B_FALSE;
586 591
587 592 if (smb_domain_lookup_type(SMB_DOMAIN_LOCAL, &di))
588 593 islocal = smb_sid_indomain(di.di_binsid, sid);
589 594
590 595 return (islocal);
591 596 }
592 597
593 598 void
594 599 smb_ids_free(smb_ids_t *ids)
595 600 {
596 601 smb_id_t *id;
597 602 int i;
598 603
599 604 if ((ids != NULL) && (ids->i_ids != NULL)) {
600 605 id = ids->i_ids;
601 606 for (i = 0; i < ids->i_cnt; i++, id++)
602 607 smb_sid_free(id->i_sid);
603 608
604 609 free(ids->i_ids);
605 610 }
606 611 }
|
↓ open down ↓ |
109 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX