+Mon Feb 26 15:01:27 2001 Ezra Peisach <epeisach@mit.edu>
+
+ * loadv4.c, ovload.c, kdb5_util.h, kdb5_util.c, kadm5_create.c,
+ dumpv4.c, dump.c: Compiler warning cleanup including prototypes,
+ assignments in conditionals, unused variables, varaibles shadowing
+ one-another.
+
2001-02-08 Tom Yu <tlyu@mit.edu>
* loadv4.c: Remove references to KRB_NEVERDATE.
/*
* Needed for master key conversion.
*/
-extern krb5_keyblock master_keyblock;
-extern krb5_principal master_princ;
-extern int valid_master_key;
-extern void usage();
static int mkey_convert;
static krb5_keyblock new_master_keyblock;
/*
* Re-encrypt the key_data with the new master key...
*/
-krb5_error_code master_key_convert(context, db_entry)
+static krb5_error_code master_key_convert(context, db_entry)
krb5_context context;
krb5_db_entry * db_entry;
{
return(ENOENT);
}
+#if 0
/*
* dump_k5beta_header() - Make a dump header that is recognizable by Kerberos
* Version 5 Beta 5 and previous releases.
fprintf(arglist->ofile, k5beta_dump_header);
return(0);
}
+#endif
/*
* dump_k5beta_iterator() - Dump an entry in a format that is usable
entry->policy_refcnt);
}
-void print_key_data(FILE *f, krb5_key_data *key_data)
+static void print_key_data(FILE *f, krb5_key_data *key_data)
{
int c;
return(retval);
}
-int process_k5beta7_policy(fname, kcontext, filep, verbose, linenop, pol_db)
+static int
+process_k5beta7_policy(fname, kcontext, filep, verbose, linenop, pol_db)
char *fname;
krb5_context kcontext;
FILE *filep;
char *realm;
};
-extern krb5_keyblock master_keyblock;
-extern krb5_principal master_princ;
-extern krb5_boolean dbactive;
-extern int exit_status;
-extern krb5_context util_context;
-extern kadm5_config_params global_params;
void update_ok_file();
static char *v4_mkeyfile = "/.k";
static int shortlife;
+static krb5_error_code handle_one_key(struct dump_record *arg,
+ krb5_keyblock *v5mkey,
+ krb5_key_data *v5key,
+ des_cblock v4key);
+static int handle_keys(struct dump_record *arg);
static int
v4init(arg, manual)
return 0;
}
+static void
v4_print_time(file, timeval)
FILE *file;
unsigned long timeval;
-krb5_error_code
+static krb5_error_code
dump_v4_iterator(ptr, entry)
krb5_pointer ptr;
krb5_db_entry *entry;
strcpy(principal->instance, "*");
/* Now move to mod princ */
- if (retval = krb5_dbe_lookup_mod_princ_data(util_context,entry,
- &mod_time, &mod_princ)){
+ if ((retval = krb5_dbe_lookup_mod_princ_data(util_context,entry,
+ &mod_time, &mod_princ))){
com_err(arg->comerr_name, retval, "while unparsing db entry");
exit_status++;
return retval;
/* special handling for K.M since it isn't preserved */
{
des_cblock v4key;
- int i;
+ int i2;
/* assume:
max lifetime (255)
ENCRYPT);
#endif /* KDB4_DISABLE */
- for (i=0; i<8; i++) {
- fprintf(f, "%02x", ((unsigned char*)v4key)[i]);
- if (i == 3) fputc(' ', f);
+ for (i2=0; i2<8; i2++) {
+ fprintf(f, "%02x", ((unsigned char*)v4key)[i2]);
+ if (i2 == 3) fputc(' ', f);
}
fprintf(f," 200001010459 197001020000 db_creation *\n");
}
update_ok_file(outname);
}
-int handle_keys(arg)
+static int handle_keys(arg)
struct dump_record *arg;
{
krb5_error_code retval;
char *defrealm;
char *mkey_name = 0;
char *mkey_fullname;
- krb5_principal master_princ;
+ krb5_principal l_master_princ;
- if (retval = krb5_get_default_realm(util_context, &defrealm)) {
+ if ((retval = krb5_get_default_realm(util_context, &defrealm))) {
com_err(arg->comerr_name, retval,
"while retrieving default realm name");
exit(1);
/* assemble & parse the master key name */
- if (retval = krb5_db_setup_mkey_name(util_context, mkey_name, arg->realm,
- &mkey_fullname, &master_princ)) {
+ if ((retval = krb5_db_setup_mkey_name(util_context, mkey_name, arg->realm,
+ &mkey_fullname, &l_master_princ))) {
com_err(arg->comerr_name, retval, "while setting up master key name");
exit(1);
}
- if (retval = krb5_db_fetch_mkey(util_context, master_princ,
- master_keyblock.enctype, 0,
- 0, global_params.stash_file, 0,
- &master_keyblock)) {
+ if ((retval = krb5_db_fetch_mkey(util_context, l_master_princ,
+ master_keyblock.enctype, 0,
+ 0, global_params.stash_file, 0,
+ &master_keyblock))) {
com_err(arg->comerr_name, retval, "while reading master key");
exit(1);
}
return(0);
}
+static krb5_error_code
handle_one_key(arg, v5mkey, v5key, v4key)
struct dump_record *arg;
krb5_keyblock *v5mkey;
{
krb5_error_code retval;
- krb5_keyblock v4v5key;
krb5_keyblock v5plainkey;
/* v4key is the actual v4 key from the file. */
- if (retval = krb5_dbekd_decrypt_key_data(util_context, v5mkey, v5key,
- &v5plainkey, NULL))
+ retval = krb5_dbekd_decrypt_key_data(util_context, v5mkey, v5key,
+ &v5plainkey, NULL);
+ if (retval)
return retval;
- /* v4v5key.contents = (krb5_octet *)v4key; */
- /* v4v5key.enctype = ENCTYPE_DES; */
- /* v4v5key.length = sizeof(v4key); */
-
memcpy(v4key, v5plainkey.contents, sizeof(des_cblock));
#ifndef KDB4_DISABLE
kdb_encrypt_key (v4key, v4key,
#include <string.h>
#include <kadm5/adb.h>
#include <kadm5/admin.h>
+#include <krb5/adm_proto.h>
+
#include <krb5.h>
#include <krb5/kdb.h>
+#include "kdb5_util.h"
-int add_admin_princ(void *handle, krb5_context context,
+static int add_admin_princ(void *handle, krb5_context context,
char *name, char *realm, int attrs, int lifetime);
#define ERR 1
#define ADMIN_LIFETIME 60*60*3 /* 3 hours */
#define CHANGEPW_LIFETIME 60*5 /* 5 minutes */
-extern char *progname;
-
-extern krb5_keyblock master_keyblock;
-extern krb5_db_entry master_db;
-
/*
* Function: kadm5_create
*
int kadm5_create(kadm5_config_params *params)
{
int retval;
- void *handle;
krb5_context context;
- FILE *f;
kadm5_config_params lparams;
- if (retval = krb5_init_context(&context))
+ if ((retval = krb5_init_context(&context)))
exit(ERR);
/*
* The lock file has to exist before calling kadm5_init, but
* params->admin_lockfile may not be set yet...
*/
- if (retval = kadm5_get_config_params(context, NULL, NULL,
- params, &lparams)) {
+ if ((retval = kadm5_get_config_params(context, NULL, NULL,
+ params, &lparams))) {
com_err(progname, retval, str_INITING_KCONTEXT);
return 1;
}
- if (retval = osa_adb_create_policy_db(&lparams)) {
+ if ((retval = osa_adb_create_policy_db(&lparams))) {
com_err(progname, retval, str_CREATING_POLICY_DB);
return 1;
}
}
int kadm5_create_magic_princs(kadm5_config_params *params,
- krb5_context *context)
+ krb5_context context)
{
int retval;
void *handle;
return retval;
}
- retval = add_admin_princs(handle, context, params->realm);
+ retval = add_admin_princs(handle, &context, params->realm);
kadm5_destroy(handle);
* printed. If any of these existing principal do not have the proper
* attributes, a warning message is printed.
*/
-int add_admin_princs(void *handle, krb5_context context, char *realm)
+static int add_admin_princs(void *handle, krb5_context context, char *realm)
{
krb5_error_code ret = 0;
#include <stdio.h>
#include <k5-int.h>
#include <kadm5/admin.h>
+#include <krb5/adm_proto.h>
#include <kadm5/adb.h>
#include <time.h>
#include "kdb5_util.h"
osa_adb_policy_t policy_db;
kadm5_config_params global_params;
-usage()
+void usage()
{
fprintf(stderr, "Usage: "
"kdb5_util cmd [-r realm] [-d dbname] [-k mkeytype] [-M mkeyname]\n"
krb5_boolean manual_mkey = FALSE;
krb5_boolean dbactive = FALSE;
-int kdb5_create(int, char **);
-int kdb5_destroy(int, char **);
-int kdb5_stash(int, char **);
-int dump_db(int, char **);
-int load_db(int, char **);
-int dump_v4db(int, char **);
-int load_v4db(int, char **);
-int open_db_and_mkey();
-int add_random_key(int, char **);
+static int open_db_and_mkey(void);
+
+static void add_random_key(int, char **);
-typedef int (*cmd_func)(int, char **);
+typedef void (*cmd_func)(int, char **);
struct _cmd_table {
char *name;
cmd_func func;
int opendb;
} cmd_table[] = {
- "create", kdb5_create, 0,
- "destroy", kdb5_destroy, 1,
- "stash", kdb5_stash, 1,
- "dump", dump_db, 1,
- "load", load_db, 0,
- "dump_v4", dump_v4db, 1,
- "load_v4", load_v4db, 0,
- "ark", add_random_key, 1,
- NULL, NULL, 0,
+ {"create", kdb5_create, 0},
+ {"destroy", kdb5_destroy, 1},
+ {"stash", kdb5_stash, 1},
+ {"dump", dump_db, 1},
+ {"load", load_db, 0},
+ {"dump_v4", dump_v4db, 1},
+ {"load_v4", load_v4db, 0},
+ {"ark", add_random_key, 1},
+ {NULL, NULL, 0},
};
-struct _cmd_table *cmd_lookup(name)
+static struct _cmd_table *cmd_lookup(name)
char *name;
{
struct _cmd_table *cmd = cmd_table;
if (cmd_argv[0] == NULL)
usage();
- if (retval = kadm5_get_config_params(util_context, NULL, NULL,
- &global_params, &global_params)) {
+ retval = kadm5_get_config_params(util_context, NULL, NULL,
+ &global_params, &global_params);
+ if (retval) {
com_err(argv[0], retval, "while retreiving configuration parameters");
exit(1);
}
* cannot be fetched (the master key stash file may not exist when the
* program is run).
*/
-int open_db_and_mkey()
+static int open_db_and_mkey()
{
krb5_error_code retval;
int nentries;
exit_status++;
return(1);
}
- if (retval = osa_adb_open_policy(&policy_db, &global_params)) {
- com_err(progname, retval, "opening policy database");
- exit_status++;
- return (1);
+ if ((retval = osa_adb_open_policy(&policy_db, &global_params))) {
+ com_err(progname, retval, "opening policy database");
+ exit_status++;
+ return (1);
}
/* assemble & parse the master key name */
return 0;
}
-int
+static void
add_random_key(argc, argv)
int argc;
char **argv;
krb5_error_code ret;
krb5_principal princ;
krb5_db_entry dbent;
- int n, i;
+ int n;
krb5_boolean more;
krb5_timestamp now;
ret = krb5_parse_name(util_context, pr_str, &princ);
if (ret) {
com_err(me, ret, "while parsing principal name %s", pr_str);
- return 1;
+ exit_status++;
+ return;
}
n = 1;
ret = krb5_db_get_principal(util_context, princ, &dbent,
&n, &more);
if (ret) {
com_err(me, ret, "while fetching principal %s", pr_str);
- return 1;
+ exit_status++;
+ return;
}
if (n != 1) {
fprintf(stderr, "principal %s not found\n", pr_str);
- return 1;
+ exit_status++;
+ return;
}
if (more) {
fprintf(stderr, "principal %s not unique\n", pr_str);
krb5_dbe_free_contents(util_context, &dbent);
- return 1;
+ exit_status++;
+ return;
}
ret = krb5_string_to_keysalts(ks_str,
", \t", ":.-", 0,
&num_keysalts);
if (ret) {
com_err(me, ret, "while parsing keysalts %s", ks_str);
- return 1;
+ exit_status++;
+ return;
}
if (!num_keysalts || keysalts == NULL) {
num_keysalts = global_params.num_keysalts;
if (ret) {
com_err(me, ret, "while randomizing principal %s", pr_str);
krb5_dbe_free_contents(util_context, &dbent);
- return 1;
+ exit_status++;
+ return;
}
dbent.attributes &= ~KRB5_KDB_REQUIRES_PWCHANGE;
ret = krb5_timeofday(util_context, &now);
if (ret) {
com_err(me, ret, "while getting time");
krb5_dbe_free_contents(util_context, &dbent);
- return 1;
+ exit_status++;
+ return;
}
ret = krb5_dbe_update_last_pwd_change(util_context, &dbent, now);
if (ret) {
com_err(me, ret, "while setting changetime");
krb5_dbe_free_contents(util_context, &dbent);
- return 1;
+ exit_status++;
+ return;
}
ret = krb5_db_put_principal(util_context, &dbent, &n);
krb5_dbe_free_contents(util_context, &dbent);
if (ret) {
com_err(me, ret, "while saving principal %s", pr_str);
- return 1;
+ exit_status++;
+ return;
}
printf("%s changed\n", pr_str);
- return 0;
}
extern char *progname;
extern char *Err_no_database;
+#ifndef V4_DECLARES_STATIC
+extern krb5_keyblock master_keyblock;
+extern krb5_principal master_princ;
+#endif
+extern krb5_boolean dbactive;
+extern int exit_status;
+extern krb5_context util_context;
+extern kadm5_config_params global_params;
+extern int valid_master_key;
+extern krb5_db_entry master_db;
-void add_key
+extern void usage(void);
+
+extern void add_key
PROTOTYPE((char const *, char const *,
krb5_const_principal, const krb5_keyblock *,
krb5_kvno, krb5_keysalt *));
-int set_dbname_help
+extern int set_dbname_help
PROTOTYPE((char *, char *));
-char *kdb5_util_Init PROTOTYPE((int, char **));
+extern char *kdb5_util_Init PROTOTYPE((int, char **));
-int quit();
+extern int quit PROTOTYPE((void));
-int check_for_match
+extern int check_for_match
PROTOTYPE((char *, int, krb5_db_entry *, int, int));
-void parse_token
+extern void parse_token
PROTOTYPE((char *, int *, int *, char *));
-int create_db_entry
- PROTOTYPE((krb5_principal, krb5_db_entry *));
+extern int create_db_entry PROTOTYPE((krb5_principal, krb5_db_entry *));
+
+extern int kadm5_create_magic_princs PROTOTYPE((kadm5_config_params *params,
+ krb5_context context));
+
+extern int process_ov_principal PROTOTYPE((char *fname, krb5_context kcontext,
+ FILE *filep, int verbose,
+ int *linenop,
+ void *pol_db));
+
+extern void load_db PROTOTYPE((int argc, char **argv));
+extern void dump_db PROTOTYPE((int argc, char **argv));
+extern void load_v4db PROTOTYPE((int argc, char **argv));
+extern void dump_v4db PROTOTYPE((int argc, char **argv));
+extern void kdb5_create PROTOTYPE((int argc, char **argv));
+extern void kdb5_destroy PROTOTYPE((int argc, char **argv));
+extern void kdb5_stash PROTOTYPE((int argc, char **argv));
+
+extern void update_ok_file PROTOTYPE((char *file_name));
+
+extern int kadm5_create PROTOTYPE((kadm5_config_params *params));
static C_Block master_key;
static Key_schedule master_key_schedule;
-static long master_key_version;
static char *v4_mkeyfile = "/.k";
#include "com_err.h"
#include <kadm5/admin.h>
#include <stdio.h>
-
+/* Define to make certain blocks private */
+#define V4_DECLARES_STATIC
+#include "kdb5_util.h"
+#include "kadm5/adb.h" /* osa_adb_create_policy_db */
#include <netinet/in.h> /* ntohl */
#define PROGNAME argv[0]
char *mkey_fullname;
char *defrealm;
int v4manual = 0;
- int read_mkey = 0;
+ krb5_boolean read_mkey = 0;
int tempdb = 0;
char *tempdbname;
krb5_context context;
}
tempdbname = dbname;
} else {
- int dbnamelen = strlen(dbname);
+ size_t dbnamelen = strlen(dbname);
tempdbname = malloc(dbnamelen + 2);
if (tempdbname == 0) {
com_err(PROGNAME, ENOMEM, "allocating temporary filename");
if (!realm) {
- if (retval = krb5_get_default_realm(context, &defrealm)) {
+ retval = krb5_get_default_realm(context, &defrealm);
+ if (retval) {
com_err(PROGNAME, retval, "while retrieving default realm name");
krb5_free_context(context);
return;
}
/* assemble & parse the master key name */
-
- if (retval = krb5_db_setup_mkey_name(context, mkey_name, realm,
- &mkey_fullname, &master_princ)) {
+
+ retval = krb5_db_setup_mkey_name(context, mkey_name, realm,
+ &mkey_fullname, &master_princ);
+ if (retval) {
com_err(PROGNAME, retval, "while setting up master key name");
krb5_free_context(context);
return;
fflush(stdout);
}
- if (retval = krb5_db_fetch_mkey(context, master_princ,
- master_keyblock.enctype,
- read_mkey, read_mkey, stash_file, 0,
- &master_keyblock)) {
+
+ retval = krb5_db_fetch_mkey(context, master_princ,
+ master_keyblock.enctype,
+ read_mkey, read_mkey, stash_file, 0,
+ &master_keyblock);
+ if (retval) {
com_err(PROGNAME, retval, "while reading master key");
krb5_free_context(context);
return;
seed.length = master_keyblock.length;
seed.data = master_keyblock.contents;
- if (retval = krb5_c_random_seed(context, &seed)) {
+ retval = krb5_c_random_seed(context, &seed);
+ if (retval) {
com_err(PROGNAME, retval, "while initializing random key generator");
krb5_free_context(context);
return;
}
- if (retval = krb5_db_create(context, tempdbname, crflags)) {
+
+ retval = krb5_db_create(context, tempdbname, crflags);
+ if (retval) {
com_err(PROGNAME, retval, "while creating %sdatabase '%s'",
tempdb ? "temporary " : "", tempdbname);
krb5_free_context(context);
return;
}
- if (retval = krb5_db_set_name(context, tempdbname)) {
+
+ retval = krb5_db_set_name(context, tempdbname);
+ if (retval) {
(void) krb5_db_destroy(context, tempdbname);
com_err(PROGNAME, retval, "while setting active database to '%s'",
tempdbname);
return;
}
- if (retval = add_principal(context, master_princ, MASTER_KEY, &rblock)) {
+ retval = add_principal(context, master_princ, MASTER_KEY, &rblock);
+ if (retval) {
(void) krb5_db_fini(context);
(void) krb5_db_destroy(context, tempdbname);
com_err(PROGNAME, retval, "while adding K/M to the database");
/* clean up; rename temporary database if there were no errors */
if (retval == 0) {
- if (retval = krb5_db_fini (context))
+ retval = krb5_db_fini (context);
+ if (retval)
com_err(PROGNAME, retval, "while shutting down database");
else if (tempdb && (retval = krb5_db_rename(context, tempdbname,
- dbname)))
+ dbname)))
com_err(PROGNAME, retval, "while renaming temporary database");
} else {
(void) krb5_db_fini (context);
if (tempdb)
- (void) krb5_db_destroy (context, tempdbname);
+ (void) krb5_db_destroy (context, tempdbname);
}
memset((char *)master_keyblock.contents, 0, master_keyblock.length);
/*
* Create the magic principals in the database.
*/
- if (retval = kadm5_create_magic_princs(&newparams, context)) {
+ retval = kadm5_create_magic_princs(&newparams, context);
+ if (retval) {
com_err(PROGNAME, retval, "while creating KADM5 principals");
krb5_free_context(context);
return;
return 0;
}
memset((char *) &entry, 0, sizeof(entry));
- if (retval = krb5_425_conv_principal(context, princ->name, princ->instance,
- realm, &entry.princ))
+ retval = krb5_425_conv_principal(context, princ->name, princ->instance,
+ realm, &entry.princ);
+ if (retval)
return retval;
if (verbose) {
- if (retval = krb5_unparse_name(context, entry.princ, &name))
+ retval = krb5_unparse_name(context, entry.princ, &name);
+ if (retval)
name = strdup("<not unparsable name!>");
if (verbose)
printf("\ntranslating %s...", name);
free(name);
}
- if (retval = krb5_build_principal(context, &mod_princ,
- strlen(realm),
- realm, princ->mod_name,
- princ->mod_instance[0] ? princ->mod_instance : 0,
- 0)) {
+ retval = krb5_build_principal(context, &mod_princ,
+ strlen(realm), realm, princ->mod_name,
+ princ->mod_instance[0] ?
+ princ->mod_instance : 0,
+ 0);
+ if (retval) {
krb5_free_principal(context, entry.princ);
return retval;
}
if (!retval && !strcmp(princ->name, "krbtgt") &&
strcmp(princ->instance, realm) && princ->instance[0]) {
krb5_free_principal(context, entry.princ);
- if (retval = krb5_build_principal(context, &entry.princ,
- strlen(princ->instance),
- princ->instance,
- "krbtgt", realm, 0))
+ retval = krb5_build_principal(context, &entry.princ,
+ strlen(princ->instance),
+ princ->instance,
+ "krbtgt", realm, 0);
+ if (retval)
return retval;
retval = krb5_db_put_principal(context, &entry, &nentries);
}
krb5_keyblock rkey;
int nentries = 1;
krb5_timestamp mod_time;
- krb5_principal mod_princ;
memset((char *) &entry, 0, sizeof(entry));
- if (retval = krb5_copy_principal(context, princ, &entry.princ))
+ retval = krb5_copy_principal(context, princ, &entry.princ);
+ if (retval)
return(retval);
entry.max_life = pblock->max_life;
entry.max_renewable_life = pblock->max_rlife;
entry.len = KRB5_KDB_V1_BASE_LENGTH;
entry.expiration = pblock->expiration;
- if ((retval = krb5_timeofday(context, &mod_time))) {
+ retval = krb5_timeofday(context, &mod_time);
+ if (retval) {
krb5_db_free_principal(context, &entry, 1);
return retval;
}
entry.attributes = pblock->flags;
- if (retval = krb5_dbe_create_key_data(context, &entry)) {
+ retval = krb5_dbe_create_key_data(context, &entry);
+ if (retval) {
krb5_db_free_principal(context, &entry, 1);
return(retval);
}
switch (op) {
case MASTER_KEY:
entry.attributes |= KRB5_KDB_DISALLOW_ALL_TIX;
- if (retval = krb5_dbekd_encrypt_key_data(context, pblock->key,
- &master_keyblock,
- (krb5_keysalt *) NULL, 1,
- &entry.key_data[0])) {
+ retval = krb5_dbekd_encrypt_key_data(context, pblock->key,
+ &master_keyblock,
+ (krb5_keysalt *) NULL, 1,
+ &entry.key_data[0]);
+ if (retval) {
krb5_db_free_principal(context, &entry, 1);
return retval;
}
break;
case RANDOM_KEY:
- if (retval = krb5_c_make_random_key(context, pblock->key->enctype,
- &rkey)) {
+ retval = krb5_c_make_random_key(context, pblock->key->enctype,
+ &rkey);
+ if (retval) {
krb5_db_free_principal(context, &entry, 1);
return retval;
}
- if (retval = krb5_dbekd_encrypt_key_data(context, pblock->key,
- &rkey,
- (krb5_keysalt *) NULL, 1,
- &entry.key_data[0])) {
+ retval = krb5_dbekd_encrypt_key_data(context, pblock->key,
+ &rkey, (krb5_keysalt *) NULL,
+ 1, &entry.key_data[0]);
+ if (retval) {
krb5_db_free_principal(context, &entry, 1);
return(retval);
}
char exp_date_str[50];
char mod_date_str[50];
int temp1, temp2, temp3;
- long time_explode();
input_file = fopen(dumpfile, "r");
if (!input_file)
memset((char *)&aprinc, 0, sizeof(aprinc));
nread = fscanf(input_file,
- "%s %s %d %d %d %hd %x %x %s %s %s %s\n",
+ "%s %s %d %d %d %hd %lx %lx %s %s %s %s\n",
aprinc.name,
aprinc.instance,
&temp1,
aprinc.mod_name[0] = '\0';
if (aprinc.mod_instance[0] == '*')
aprinc.mod_instance[0] = '\0';
- if (retval = enter_in_v5_db(context, realm, &aprinc))
+ retval = enter_in_v5_db(context, realm, &aprinc);
+ if (retval)
break;
}
(void) fclose(input_file);
char exp_date_str[50];
char mod_date_str[50];
int temp1, temp2, temp3;
- long time_explode();
long foundtime, guess1, guess2;
/* kdb_init is usually the only thing to touch the time in the
memset((char *)&aprinc, 0, sizeof(aprinc));
nread = fscanf(input_file,
- "%s %s %d %d %d %hd %x %x %s %s %s %s\n",
+ "%s %s %d %d %d %hd %lx %lx %s %s %s %s\n",
aprinc.name,
aprinc.instance,
&temp1,
} else if (foundtime == guess2) {
printf("Cygnus CNS post 96q1 value (2009)");
} else {
- printf("non-default start time (%d,%s)",
+ printf("non-default start time (%ld,%s)",
foundtime, exp_date_str);
}
}
int nprincs;
krb5_boolean more;
+
nprincs = 1;
- if (retval = krb5_db_get_principal(context, &tgt_princ, &entry,
- &nprincs, &more))
+ retval = krb5_db_get_principal(context, &tgt_princ, &entry,
+ &nprincs, &more);
+ if (retval)
return retval;
if (nprincs == 0)
#include <kadm5/adb.h>
#include "import_err.h"
+#include "kdb5_util.h"
char *nstrtok();
#define LINESIZE 32768 /* XXX */
#define PLURAL(count) (((count) == 1) ? error_message(IMPORT_SINGLE_RECORD) : error_message(IMPORT_PLURAL_RECORDS))
-int parse_pw_hist_ent(current, hist)
+static int parse_pw_hist_ent(current, hist)
char *current;
osa_pw_hist_ent *hist;
{
krb5_db_entry kdb;
char *current;
char *cp;
- int tmp, x, i, one;
+ int x, one;
krb5_boolean more;
char line[LINESIZE];
tl_data.tl_data_contents = (krb5_octet *) xdralloc_getdata(&xdrs);
one = 1;
- ret = krb5_db_get_principal(kcontext, princ, &kdb, &one,
- &more);
+ ret = krb5_db_get_principal(kcontext, princ, &kdb, &one, &more);
if (ret)
goto done;
- if (ret = krb5_dbe_update_tl_data(kcontext, &kdb,
- &tl_data))
+ ret = krb5_dbe_update_tl_data(kcontext, &kdb, &tl_data);
+ if (ret)
goto done;
- if (ret = krb5_db_put_principal(kcontext, &kdb, &one))
+ ret = krb5_db_put_principal(kcontext, &kdb, &one);
+ if (ret)
goto done;
xdr_destroy(&xdrs);