Skip to content

Commit

Permalink
confdb: avoid syslog message when no domains are enabled
Browse files Browse the repository at this point in the history
This syslog message would also appear when calling other tools like
sss_cache which is confusing. We return specific error code instead
and let the error be syslogged in the monitor in monitor.c:main (this
is already implemented).

Resolves: #6387

:fixes: A regression when running sss_cache when no SSSD domain is
  enabled would produce a syslog critical message was fixed.

Reviewed-by: Alejandro López <allopez@redhat.com>
Reviewed-by: Sumit Bose <sbose@redhat.com>
  • Loading branch information
pbrezina committed Oct 13, 2022
1 parent a5403f7 commit b38fdc8
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/confdb/confdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1800,10 +1800,10 @@ int confdb_get_domains(struct confdb_ctx *cdb,
ret = confdb_get_enabled_domain_list(cdb, tmp_ctx, &domlist);
if (ret == ENOENT) {
DEBUG(SSSDBG_FATAL_FAILURE, "No domains configured, fatal error!\n");
sss_log(SSS_LOG_CRIT, "No domains configured, fatal error!\n");
ret = ERR_NO_DOMAIN_ENABLED;
goto done;
}
if (ret != EOK ) {
if (ret != EOK) {
DEBUG(SSSDBG_FATAL_FAILURE, "Fatal error retrieving domains list!\n");
goto done;
}
Expand Down Expand Up @@ -2472,9 +2472,9 @@ int confdb_expand_app_domains(struct confdb_ctx *cdb)
ret = confdb_get_enabled_domain_list(cdb, tmp_ctx, &domlist);
if (ret == ENOENT) {
DEBUG(SSSDBG_FATAL_FAILURE, "No domains configured, fatal error!\n");
sss_log(SSS_LOG_CRIT, "No domains configured, fatal error!\n");
ret = ERR_NO_DOMAIN_ENABLED;
goto done;
} else if (ret != EOK ) {
} else if (ret != EOK) {
DEBUG(SSSDBG_FATAL_FAILURE, "Fatal error retrieving domains list!\n");
goto done;
}
Expand Down
2 changes: 1 addition & 1 deletion src/monitor/monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -2566,7 +2566,7 @@ int main(int argc, const char *argv[])
"SSSD couldn't load the configuration database.\n");
sss_log(SSS_LOG_CRIT,
"SSSD couldn't load the configuration database [%d]: %s.\n",
ret, strerror(ret));
ret, sss_strerror(ret));
break;
}
return 4;
Expand Down
1 change: 1 addition & 0 deletions src/util/util_errors.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ struct err_string error_to_str[] = {
{ "Cannot parse input" }, /* ERR_INPUT_PARSE */
{ "Entry not found" }, /* ERR_NOT_FOUND */
{ "Domain not found" }, /* ERR_DOMAIN_NOT_FOUND */
{ "No domain is enabled" }, /* ERR_NO_DOMAIN_ENABLED */
{ "Malformed search filter" }, /* ERR_INVALID_FILTER, */
{ "No POSIX attributes detected" }, /* ERR_NO_POSIX */
{ "Extra attribute is a duplicate" }, /* ERR_DUP_EXTRA_ATTR */
Expand Down
1 change: 1 addition & 0 deletions src/util/util_errors.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ enum sssd_errors {
ERR_INPUT_PARSE,
ERR_NOT_FOUND,
ERR_DOMAIN_NOT_FOUND,
ERR_NO_DOMAIN_ENABLED,
ERR_INVALID_FILTER,
ERR_NO_POSIX,
ERR_DUP_EXTRA_ATTR,
Expand Down

0 comments on commit b38fdc8

Please sign in to comment.