Changeset 274 for branches/samba-3.3.x/source/winbindd/idmap_tdb2.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_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
Note:
See TracChangeset
for help on using the changeset viewer.