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:
@@ -271,5 +271,21 @@ hdb_db_dir(krb5_context context)
|
||||
const char *
|
||||
hdb_default_db(krb5_context context)
|
||||
{
|
||||
return HDB_DEFAULT_DB;
|
||||
static char *default_hdb = NULL;
|
||||
struct hdb_dbinfo *dbinfo = NULL;
|
||||
struct hdb_dbinfo *d = NULL;
|
||||
const char *s;
|
||||
|
||||
if (default_hdb)
|
||||
return default_hdb;
|
||||
|
||||
(void) hdb_get_dbinfo(context, &dbinfo);
|
||||
while ((d = hdb_dbinfo_get_next(dbinfo, d)) != NULL) {
|
||||
if ((s = hdb_dbinfo_get_dbname(context, d)) &&
|
||||
(default_hdb = strdup(s)))
|
||||
break;
|
||||
}
|
||||
|
||||
hdb_free_dbinfo(context, &dbinfo);
|
||||
return default_hdb ? default_hdb : HDB_DEFAULT_DB;
|
||||
}
|
||||
|
Reference in New Issue
Block a user