Changeset 274 for branches/samba-3.3.x/source/winbindd/idmap_tdb.c
- Timestamp:
- Jun 17, 2009, 2:19:52 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/samba-3.3.x/source/winbindd/idmap_tdb.c
r222 r274 570 570 NTSTATUS ret; 571 571 struct idmap_tdb_context *ctx; 572 char *config_option = NULL;573 const char *range;574 572 575 573 ctx = talloc(dom, struct idmap_tdb_context); … … 579 577 } 580 578 581 config_option = talloc_asprintf(ctx, "idmap config %s", dom->name); 582 if ( ! config_option) { 583 DEBUG(0, ("Out of memory!\n")); 584 ret = NT_STATUS_NO_MEMORY; 585 goto failed; 586 } 579 if (strequal(dom->name, "*")) { 580 uid_t low_uid = 0; 581 uid_t high_uid = 0; 582 gid_t low_gid = 0; 583 gid_t high_gid = 0; 584 585 ctx->filter_low_id = 0; 586 ctx->filter_high_id = 0; 587 588 if (lp_idmap_uid(&low_uid, &high_uid)) { 589 ctx->filter_low_id = low_uid; 590 ctx->filter_high_id = high_uid; 591 } else { 592 DEBUG(3, ("Warning: 'idmap uid' not set!\n")); 593 } 594 595 if (lp_idmap_gid(&low_gid, &high_gid)) { 596 if ((low_gid != low_uid) || (high_gid != high_uid)) { 597 DEBUG(1, ("Warning: 'idmap uid' and 'idmap gid'" 598 " ranges do not agree -- building " 599 "intersection\n")); 600 ctx->filter_low_id = MAX(ctx->filter_low_id, 601 low_gid); 602 ctx->filter_high_id = MIN(ctx->filter_high_id, 603 high_gid); 604 } 605 } else { 606 DEBUG(3, ("Warning: 'idmap gid' not set!\n")); 607 } 608 } else { 609 char *config_option = NULL; 610 const char *range; 611 612 config_option = talloc_asprintf(ctx, "idmap config %s", dom->name); 613 if ( ! config_option) { 614 DEBUG(0, ("Out of memory!\n")); 615 ret = NT_STATUS_NO_MEMORY; 616 goto failed; 617 } 618 619 range = lp_parm_const_string(-1, config_option, "range", NULL); 620 if (( ! range) || 621 (sscanf(range, "%u - %u", &ctx->filter_low_id, &ctx->filter_high_id) != 2)) 622 { 623 ctx->filter_low_id = 0; 624 ctx->filter_high_id = 0; 625 } 626 627 talloc_free(config_option); 628 } 629 630 if (ctx->filter_low_id > ctx->filter_high_id) { 631 ctx->filter_low_id = 0; 632 ctx->filter_high_id = 0; 633 } 634 635 DEBUG(10, ("idmap_tdb_db_init: filter range %u-%u loaded for domain " 636 "'%s'\n", ctx->filter_low_id, ctx->filter_high_id, dom->name)); 587 637 588 638 ret = idmap_tdb_open_db(ctx, &ctx->tdb); … … 591 641 } 592 642 593 range = lp_parm_const_string(-1, config_option, "range", NULL);594 if (( ! range) ||595 (sscanf(range, "%u - %u", &ctx->filter_low_id, &ctx->filter_high_id) != 2) ||596 (ctx->filter_low_id > ctx->filter_high_id)) {597 ctx->filter_low_id = 0;598 ctx->filter_high_id = 0;599 }600 601 643 dom->private_data = ctx; 602 644 603 talloc_free(config_option);604 645 return NT_STATUS_OK; 605 646
Note:
See TracChangeset
for help on using the changeset viewer.