Changeset 274 for branches/samba-3.3.x/source/winbindd
- Timestamp:
- Jun 17, 2009, 2:19:52 PM (16 years ago)
- Location:
- branches/samba-3.3.x/source/winbindd
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/samba-3.3.x/source/winbindd/idmap_ldap.c
r222 r274 766 766 struct idmap_ldap_context *ctx = NULL; 767 767 char *config_option = NULL; 768 const char *range = NULL;769 768 const char *tmp = NULL; 770 769 … … 780 779 } 781 780 782 config_option = talloc_asprintf(ctx, "idmap config %s", dom->name); 783 if ( ! config_option) { 784 DEBUG(0, ("Out of memory!\n")); 785 ret = NT_STATUS_NO_MEMORY; 786 goto done; 787 } 788 789 /* load ranges */ 790 range = lp_parm_const_string(-1, config_option, "range", NULL); 791 if (range && range[0]) { 792 if ((sscanf(range, "%u - %u", &ctx->filter_low_id, 793 &ctx->filter_high_id) != 2) || 794 (ctx->filter_low_id > ctx->filter_high_id)) { 795 DEBUG(1, ("ERROR: invalid filter range [%s]", range)); 796 ctx->filter_low_id = 0; 797 ctx->filter_high_id = 0; 798 } 781 if (strequal(dom->name, "*")) { 782 uid_t low_uid = 0; 783 uid_t high_uid = 0; 784 gid_t low_gid = 0; 785 gid_t high_gid = 0; 786 787 ctx->filter_low_id = 0; 788 ctx->filter_high_id = 0; 789 790 if (lp_idmap_uid(&low_uid, &high_uid)) { 791 ctx->filter_low_id = low_uid; 792 ctx->filter_high_id = high_uid; 793 } else { 794 DEBUG(3, ("Warning: 'idmap uid' not set!\n")); 795 } 796 797 if (lp_idmap_gid(&low_gid, &high_gid)) { 798 if ((low_gid != low_uid) || (high_gid != high_uid)) { 799 DEBUG(1, ("Warning: 'idmap uid' and 'idmap gid'" 800 " ranges do not agree -- building " 801 "intersection\n")); 802 ctx->filter_low_id = MAX(ctx->filter_low_id, 803 low_gid); 804 ctx->filter_high_id = MIN(ctx->filter_high_id, 805 high_gid); 806 } 807 } else { 808 DEBUG(3, ("Warning: 'idmap gid' not set!\n")); 809 } 810 } else { 811 const char *range = NULL; 812 813 config_option = talloc_asprintf(ctx, "idmap config %s", dom->name); 814 if ( ! config_option) { 815 DEBUG(0, ("Out of memory!\n")); 816 ret = NT_STATUS_NO_MEMORY; 817 goto done; 818 } 819 820 /* load ranges */ 821 range = lp_parm_const_string(-1, config_option, "range", NULL); 822 if (range && range[0]) { 823 if ((sscanf(range, "%u - %u", &ctx->filter_low_id, 824 &ctx->filter_high_id) != 2)) 825 { 826 DEBUG(1, ("ERROR: invalid filter range [%s]", range)); 827 ctx->filter_low_id = 0; 828 ctx->filter_high_id = 0; 829 } 830 } 831 } 832 833 if (ctx->filter_low_id > ctx->filter_high_id) { 834 DEBUG(1, ("ERROR: invalid filter range [%u-%u]", 835 ctx->filter_low_id, ctx->filter_high_id)); 836 ctx->filter_low_id = 0; 837 ctx->filter_high_id = 0; 799 838 } 800 839 -
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 -
branches/samba-3.3.x/source/winbindd/idmap_tdb2.c
r222 r274 343 343 NTSTATUS ret; 344 344 struct idmap_tdb2_context *ctx; 345 char *config_option = NULL;346 const char *range;347 345 NTSTATUS status; 348 346 … … 356 354 } 357 355 358 config_option = talloc_asprintf(ctx, "idmap config %s", dom->name); 359 if ( ! config_option) { 360 DEBUG(0, ("Out of memory!\n")); 361 ret = NT_STATUS_NO_MEMORY; 362 goto failed; 363 } 364 365 range = lp_parm_const_string(-1, config_option, "range", NULL); 366 if (( ! range) || 367 (sscanf(range, "%u - %u", &ctx->filter_low_id, &ctx->filter_high_id) != 2) || 368 (ctx->filter_low_id > ctx->filter_high_id)) { 356 if (strequal(dom->name, "*")) { 357 uid_t low_uid = 0; 358 uid_t high_uid = 0; 359 gid_t low_gid = 0; 360 gid_t high_gid = 0; 361 369 362 ctx->filter_low_id = 0; 370 363 ctx->filter_high_id = 0; 364 365 if (lp_idmap_uid(&low_uid, &high_uid)) { 366 ctx->filter_low_id = low_uid; 367 ctx->filter_high_id = high_uid; 368 } else { 369 DEBUG(3, ("Warning: 'idmap uid' not set!\n")); 370 } 371 372 if (lp_idmap_gid(&low_gid, &high_gid)) { 373 if ((low_gid != low_uid) || (high_gid != high_uid)) { 374 DEBUG(1, ("Warning: 'idmap uid' and 'idmap gid'" 375 " ranges do not agree -- building " 376 "intersection\n")); 377 ctx->filter_low_id = MAX(ctx->filter_low_id, 378 low_gid); 379 ctx->filter_high_id = MIN(ctx->filter_high_id, 380 high_gid); 381 } 382 } else { 383 DEBUG(3, ("Warning: 'idmap gid' not set!\n")); 384 } 385 } else { 386 char *config_option = NULL; 387 const char *range; 388 config_option = talloc_asprintf(ctx, "idmap config %s", dom->name); 389 if ( ! config_option) { 390 DEBUG(0, ("Out of memory!\n")); 391 ret = NT_STATUS_NO_MEMORY; 392 goto failed; 393 } 394 395 range = lp_parm_const_string(-1, config_option, "range", NULL); 396 if (( ! range) || 397 (sscanf(range, "%u - %u", &ctx->filter_low_id, &ctx->filter_high_id) != 2)) 398 { 399 ctx->filter_low_id = 0; 400 ctx->filter_high_id = 0; 401 } 402 403 talloc_free(config_option); 404 } 405 406 if (ctx->filter_low_id > ctx->filter_high_id) { 407 ctx->filter_low_id = 0; 408 ctx->filter_high_id = 0; 371 409 } 372 410 373 411 dom->private_data = ctx; 374 412 375 talloc_free(config_option);376 413 return NT_STATUS_OK; 377 414 -
branches/samba-3.3.x/source/winbindd/winbindd.c
r222 r274 779 779 for (state = winbindd_client_list(); state; state = state->next) { 780 780 if (state->response.result != WINBINDD_PENDING && 781 state->fd_event.flags == EVENT_FD_READ && 781 782 !state->getpwent_state && !state->getgrent_state) { 782 783 nidle++;
Note:
See TracChangeset
for help on using the changeset viewer.