hdb: Fix coverity warnings

This commit is contained in:
Nicolas Williams
2022-01-17 17:32:24 -06:00
parent b9a915c163
commit 2e729a9aa2
4 changed files with 42 additions and 37 deletions

View File

@@ -793,7 +793,7 @@ hdb_create(krb5_context context, HDB **db, const char *filename)
return ret;
}
for (cb_ctx.h = methods; cb_ctx.h->prefix != NULL; cb_ctx.h++) {
if (cb_ctx.h->is_file_based && !pathish)
if (cb_ctx.h->is_file_based)
continue;
if (!cb_ctx.h->can_taste)
continue;
@@ -819,12 +819,14 @@ hdb_create(krb5_context context, HDB **db, const char *filename)
for (cb_ctx.h = methods; cb_ctx.h->prefix != NULL; cb_ctx.h++)
if (strcmp(cb_ctx.h->prefix, HDB_DEFAULT_DB_TYPE) == 0)
break;
if (cb_ctx.h->prefix == NULL)
cb_ctx.h = NULL;
}
#endif
if (cb_ctx.h == NULL || cb_ctx.h->prefix == NULL)
/* Last resort default */
cb_ctx.h = &default_dbmethod;
if (cb_ctx.h == NULL || cb_ctx.h->prefix == NULL) {
if (cb_ctx.h->prefix == NULL) {
krb5_set_error_message(context, ENOTSUP,
"Could not determine default DB backend for %s",
filename);