From: Ken Raeburn Date: Tue, 4 Oct 2005 20:24:14 +0000 (+0000) Subject: * create/kdb5_mkdums.c (set_dbname_help): Set default realm and construct an X-Git-Tag: ms-bug-test-20060525~132 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=5a825c5619994246ed94127b57acd9d823ec8762;p=krb5.git * create/kdb5_mkdums.c (set_dbname_help): Set default realm and construct an argument vector describing the database pathname, before calling krb5_db_open. * verify/kdb5_verify.c (set_dbname_help): Likewise. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17401 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/tests/create/ChangeLog b/src/tests/create/ChangeLog index 1d329dd45..0d0395d00 100644 --- a/src/tests/create/ChangeLog +++ b/src/tests/create/ChangeLog @@ -1,3 +1,9 @@ +2005-10-04 Ken Raeburn + + * kdb5_mkdums.c (set_dbname_help): Set default realm and construct + an argument vector describing the database pathname, before + calling krb5_db_open. + 2005-06-20 Ken Raeburn * Makefile.in (KDB5_DEP_LIB): Use DL_LIB and THREAD_LINKOPTS diff --git a/src/tests/create/kdb5_mkdums.c b/src/tests/create/kdb5_mkdums.c index 9d1799cfc..aa5f487ac 100644 --- a/src/tests/create/kdb5_mkdums.c +++ b/src/tests/create/kdb5_mkdums.c @@ -339,14 +339,8 @@ char *dbname; int nentries; krb5_boolean more; krb5_data pwd, scratch; + char *args[2]; -#if 0 - if ((retval = krb5_db_set_name(test_context, dbname))) { - com_err(pname, retval, "while setting active database to '%s'", - dbname); - return(1); - } -#endif /* assemble & parse the master key name */ if ((retval = krb5_db_setup_mkey_name(test_context, mkey_name, cur_realm, @@ -380,10 +374,23 @@ char *dbname; return(1); } } -#if 0 - if ((retval = krb5_db_init(test_context))) { -#endif - if ((retval = krb5_db_open(test_context, NULL, KRB5_KDB_OPEN_RO))) { + + /* Ick! Current DAL interface requires that the default_realm + field be set in the krb5_context. */ + if ((retval = krb5_set_default_realm(test_context, cur_realm))) { + com_err(pname, retval, "setting default realm"); + return 1; + } + /* Pathname is passed to db2 via 'args' parameter. */ + args[1] = NULL; + args[0] = malloc(sizeof("dbname=") + strlen(dbname)); + if (args[0] == NULL) { + com_err(pname, errno, "while setting up db parameters"); + return 1; + } + sprintf(args[0], "dbname=%s", dbname); + + if ((retval = krb5_db_open(test_context, args, KRB5_KDB_OPEN_RO))) { com_err(pname, retval, "while initializing database"); return(1); } diff --git a/src/tests/verify/ChangeLog b/src/tests/verify/ChangeLog index 0fec8083b..039cd2fe2 100644 --- a/src/tests/verify/ChangeLog +++ b/src/tests/verify/ChangeLog @@ -1,3 +1,9 @@ +2005-10-04 Ken Raeburn + + * kdb5_verify.c (set_dbname_help): Set default realm and construct + argument vector describing database location, before calling + krb5_db_open. + 2005-06-20 Ken Raeburn * Makefile.in (KDB5_DEP_LIB): Use DL_LIB and THREAD_LINKOPTS diff --git a/src/tests/verify/kdb5_verify.c b/src/tests/verify/kdb5_verify.c index 60c082f46..10661edd5 100644 --- a/src/tests/verify/kdb5_verify.c +++ b/src/tests/verify/kdb5_verify.c @@ -360,14 +360,7 @@ set_dbname_help(context, pname, dbname) int nentries; krb5_boolean more; krb5_data pwd, scratch; - -#if 0 - if ((retval = krb5_db_set_name(context, dbname))) { - com_err(pname, retval, "while setting active database to '%s'", - dbname); - return(1); - } -#endif + char *args[2]; /* assemble & parse the master key name */ @@ -400,7 +393,23 @@ set_dbname_help(context, pname, dbname) return(1); } } - if ((retval = krb5_db_open(context, NULL, KRB5_KDB_OPEN_RO))) { + + /* Ick! Current DAL interface requires that the default_realm + field be set in the krb5_context. */ + if ((retval = krb5_set_default_realm(context, cur_realm))) { + com_err(pname, retval, "setting default realm"); + return 1; + } + /* Pathname is passed to db2 via 'args' parameter. */ + args[1] = NULL; + args[0] = malloc(sizeof("dbname=") + strlen(dbname)); + if (args[0] == NULL) { + com_err(pname, errno, "while setting up db parameters"); + return 1; + } + sprintf(args[0], "dbname=%s", dbname); + + if ((retval = krb5_db_open(context, args, KRB5_KDB_OPEN_RO))) { com_err(pname, retval, "while initializing database"); return(1); }