iprop: Fix default dbname choice on initial prop

If a DB does not already exist, ipropd-slave will use the compiled
default, which is not necessarily what is desired or configured in
`[kdc]`.

This change makes `hdb_default_db()` return the first dbanme in the
`[kdc]` configuration, falling back on `HDB_DEFAULT_DB`.

Also, this adds a `--database` option to `ipropd-slave`.
This commit is contained in:
Nicolas Williams
2021-05-03 15:00:36 -05:00
parent e609e61f21
commit 0c1cd18e03
3 changed files with 26 additions and 1 deletions

View File

@@ -676,6 +676,7 @@ is_up_to_date(krb5_context context, const char *file,
(unsigned long)server_context->log_context.version, buf);
}
static char *database;
static char *status_file;
static char *config_file;
static int version_flag;
@@ -688,6 +689,7 @@ static int daemon_child = -1;
static struct getargs args[] = {
{ "config-file", 'c', arg_string, &config_file, NULL, NULL },
{ "realm", 'r', arg_string, &realm, NULL, NULL },
{ "database", 'd', arg_string, &database, "database", "file"},
{ "keytab", 'k', arg_string, &keytab_str,
"keytab to get authentication from", "kspec" },
{ "time-lost", 0, arg_string, &server_time_lost,
@@ -813,6 +815,10 @@ main(int argc, char **argv)
conf.mask |= KADM5_CONFIG_REALM;
conf.realm = realm;
}
if (database) {
conf.mask |= KADM5_CONFIG_DBNAME;
conf.dbname = database;
}
ret = kadm5_init_with_password_ctx (context,
KADM5_ADMIN_SERVICE,
NULL,