321static errno_t lookup_netgr_step(struct setent_step_ctx *step_ctx) 322{ 323 errno_t ret; 324 struct sss_domain_info *dom = step_ctx->dctx->domain; Declaring variable "netgr" without initializer. 325 struct getent_ctx *netgr; 326 struct sysdb_ctx *sysdb; 327 struct timeval tv; 328 struct tevent_timer *te; 329 330 /* Check each domain for this netgroup name */ At conditional (1): "dom" taking the true branch. At conditional (17): "dom" taking the true branch. At conditional (30): "dom" taking the true branch. At conditional (43): "dom" taking the false branch. 331 while (dom) { 332 /* if it is a domainless search, skip domains that require fully 333 * qualified names instead */ At conditional (2): "dom" taking the true branch. At conditional (3): "step_ctx->check_next" taking the true branch. At conditional (4): "dom->fqnames" taking the true branch. At conditional (5): "dom" taking the true branch. At conditional (6): "step_ctx->check_next" taking the true branch. At conditional (7): "dom->fqnames" taking the false branch. At conditional (18): "dom" taking the true branch. At conditional (19): "step_ctx->check_next" taking the true branch. At conditional (20): "dom->fqnames" taking the false branch. At conditional (31): "dom" taking the true branch. At conditional (32): "step_ctx->check_next" taking the true branch. At conditional (33): "dom->fqnames" taking the false branch. 334 while (dom && step_ctx->check_next && dom->fqnames) { 335 dom = dom->next; 336 } 337 338 /* No domains left to search */ At conditional (8): "!dom" taking the false branch. At conditional (21): "!dom" taking the false branch. At conditional (34): "!dom" taking the false branch. 339 if (!dom) break; 340 At conditional (9): "dom != step_ctx->dctx->domain" taking the true branch. At conditional (22): "dom != step_ctx->dctx->domain" taking the true branch. At conditional (35): "dom != step_ctx->dctx->domain" taking the true branch. 341 if (dom != step_ctx->dctx->domain) { 342 /* make sure we reset the check_provider flag when we check 343 * a new domain */ At conditional (10): "dom->provider != NULL" taking the true branch. At conditional (11): "strcmp(dom->provider, &"local") != 0" taking the true branch. At conditional (12): "dom->provider != NULL && strcmp(dom->provider, &"local") != 0" taking the true branch. At conditional (23): "dom->provider != NULL" taking the true branch. At conditional (24): "strcmp(dom->provider, &"local") != 0" taking the true branch. At conditional (25): "dom->provider != NULL && strcmp(dom->provider, &"local") != 0" taking the true branch. At conditional (36): "dom->provider != NULL" taking the true branch. At conditional (37): "strcmp(dom->provider, &"local") != 0" taking the true branch. At conditional (38): "dom->provider != NULL && strcmp(dom->provider, &"local") != 0" taking the true branch. 344 step_ctx->dctx->check_provider = 345 NEED_CHECK_PROVIDER(dom->provider); 346 } 347 348 /* make sure to update the dctx if we changed domain */ 349 step_ctx->dctx->domain = dom; 350 351 /* verify this netgroup has not yet been negatively cached */ 352 ret = sss_ncache_check_netgr(step_ctx->nctx->ncache, 353 step_ctx->nctx->neg_timeout, 354 dom->name, step_ctx->name); 355 356 /* if neg cached, return we didn't find it */ At conditional (13): "ret == 17" taking the true branch. At conditional (26): "ret == 17" taking the true branch. At conditional (39): "ret == 17" taking the true branch. 357 if (ret == EEXIST) { At conditional (14): "2 <= debug_level" taking the true branch. At conditional (15): "debug_timestamps" taking the true branch. At conditional (27): "2 <= debug_level" taking the true branch. At conditional (28): "debug_timestamps" taking the true branch. At conditional (40): "2 <= debug_level" taking the true branch. At conditional (41): "debug_timestamps" taking the false branch. 358 DEBUG(2, ("Netgroup [%s] does not exist! (negative cache)\n", 359 step_ctx->name)); 360 /* if a multidomain search, try with next */ At conditional (16): "step_ctx->check_next" taking the true branch. At conditional (29): "step_ctx->check_next" taking the true branch. At conditional (42): "step_ctx->check_next" taking the true branch. 361 if (step_ctx->check_next) { 362 dom = dom->next; 363 continue; 364 } 365 } 366 367 DEBUG(4, ("Requesting info for [%s@%s]\n", 368 step_ctx->name, dom->name)); 369 ret = sysdb_get_ctx_from_list(step_ctx->rctx->db_list, dom, &sysdb); 370 if (ret != EOK) { 371 DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n")); 372 return EIO; 373 } 374 375 /* Look up the netgroup in the cache */ 376 ret = sysdb_getnetgr(step_ctx->dctx, sysdb, dom, 377 step_ctx->name, 378 &step_ctx->dctx->res); 379 if (ret == ENOENT) { 380 /* This netgroup was not found in this domain */ 381 if (!step_ctx->dctx->check_provider) { 382 if (step_ctx->check_next) { 383 dom = dom->next; 384 continue; 385 } 386 else break; 387 } 388 ret = EOK; 389 } 390 391 if (ret != EOK) { 392 DEBUG(1, ("Failed to make request to our cache!\n")); 393 return EIO; 394 } 395 396 ret = get_netgroup_entry(step_ctx->nctx, step_ctx->name, 397 &netgr); 398 if (ret != EOK) { 399 /* Something really bad happened! */ 400 DEBUG(0, ("Netgroup entry was lost!\n")); 401 return ret; 402 } 403 404 /* Convert the result to a list of entries */ 405 ret = sysdb_netgr_to_entries(netgr, step_ctx->dctx->res, 406 &netgr->entries); 407 if (ret == ENOENT) { 408 /* This netgroup was not found in this domain */ 409 if (!step_ctx->dctx->check_provider) { 410 if (step_ctx->check_next) { 411 dom = dom->next; 412 continue; 413 } 414 else break; 415 } 416 ret = EOK; 417 } 418 419 if (ret != EOK) { 420 DEBUG(1, ("Failed to convert results into entries\n")); 421 return EIO; 422 } 423 424 /* if this is a caching provider (or if we haven't checked the cache 425 * yet) then verify that the cache is uptodate */ 426 if (step_ctx->dctx->check_provider) { 427 ret = check_cache(step_ctx->dctx, 428 step_ctx->nctx, 429 step_ctx->dctx->res, 430 SSS_DP_NETGR, 431 step_ctx->name, 0, 432 lookup_netgr_dp_callback, 433 step_ctx); 434 if (ret != EOK) { 435 /* May return EAGAIN legitimately to indicate that 436 * we need to reenter the mainloop 437 */ 438 return ret; 439 } 440 } 441 442 /* Results found */ 443 DEBUG(6, ("Returning info for netgroup [%s@%s]\n", 444 step_ctx->name, dom->name)); 445 netgr->ready = true; 446 447 /* Set up a lifetime timer for this result object 448 * We don't want this result object to outlive the 449 * entry cache refresh timeout 450 */ 451 tv = tevent_timeval_current_ofs(dom->entry_cache_timeout, 0); 452 te = tevent_add_timer(step_ctx->nctx->rctx->ev, 453 step_ctx->nctx->gctx, tv, 454 setnetgrent_result_timeout, 455 netgr); 456 if (!te) { 457 DEBUG(0, ("Could not set up life timer for setnetgrent result object. " 458 "Entries may become stale.\n")); 459 } 460 461 return EOK; 462 } 463 464 /* If we've gotten here, then no domain contained this netgroup */ At conditional (44): "2 <= debug_level" taking the true branch. At conditional (45): "debug_timestamps" taking the false branch. 465 DEBUG(2, ("No matching domain found for [%s], fail!\n", 466 step_ctx->name)); Using uninitialized value "netgr". 467 netgr->ready = true; 468 netgr->entries = NULL; 469 return ENOENT; 470}
This will almost certainly break if there is ever a configuration of SSSD that contains no domains with netgroup support.
Fields changed
milestone: NEEDS_TRIAGE => SSSD 1.5.0
coverity: => 10023
Resolved by 7bbc283307171cc325de7b380a3af9bf7e7bdc57
resolution: => fixed status: new => closed
rhbz: => 0
Metadata Update from @sgallagh: - Issue assigned to sbose - Issue set to the milestone: SSSD 1.5.0
SSSD is moving from Pagure to Github. This means that new issues and pull requests will be accepted only in SSSD's github repository.
This issue has been cloned to Github and is available here: - https://github.com/SSSD/sssd/issues/1769
If you want to receive further updates on the issue, please navigate to the github issue and click on subscribe button.
subscribe
Thank you for understanding. We apologize for all inconvenience.