+2001-06-04 Ezra Peisach <epeisach@mit.edu>
+
+ * kadm5_create.c: Add prototype for static
+ add_admin_princs(). Cleanup calling of add_admin_princs() to be
+ consistant with prototype.
+
+ * kdb5_create.c, kdb5_stash.c, kdb5_destroy.c: Cleanup assignments
+ in conditionals.
+
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,
static int add_admin_princ(void *handle, krb5_context context,
char *name, char *realm, int attrs, int lifetime);
+static int add_admin_princs(void *handle, krb5_context context, char *realm);
#define ERR 1
#define OK 0
return retval;
}
- retval = add_admin_princs(handle, &context, params->realm);
+ retval = add_admin_princs(handle, context, params->realm);
kadm5_destroy(handle);
char *name, char *realm, int attrs, int lifetime)
{
char *fullname;
- int nprincs;
krb5_error_code ret;
kadm5_principal_ent_rec ent;
memset(&ent, 0, sizeof(ent));
fullname = build_name_with_realm(name, realm);
- if (ret = krb5_parse_name(context, fullname, &ent.principal)) {
+ ret = krb5_parse_name(context, fullname, &ent.principal);
+ if (ret) {
com_err(progname, ret, str_PARSE_NAME);
return(ERR);
}
ent.max_life = lifetime;
ent.attributes = attrs | KRB5_KDB_DISALLOW_ALL_TIX;
- if (ret = kadm5_create_principal(handle, &ent,
- (KADM5_PRINCIPAL |
- KADM5_MAX_LIFE |
- KADM5_ATTRIBUTES),
- "to-be-random")) {
+ ret = kadm5_create_principal(handle, &ent,
+ (KADM5_PRINCIPAL | KADM5_MAX_LIFE |
+ KADM5_ATTRIBUTES),
+ "to-be-random");
+ if (ret) {
if (ret != KADM5_DUP) {
com_err(progname, ret, str_PUT_PRINC, fullname);
krb5_free_principal(context, ent.principal);
com_err(argv[0], retval, "while calculated master key salt");
exit_status++; return;
}
- if (retval = krb5_c_string_to_key(util_context, master_keyblock.enctype,
- &pwd, &master_salt, &master_keyblock)) {
+
+ retval = krb5_c_string_to_key(util_context, master_keyblock.enctype,
+ &pwd, &master_salt, &master_keyblock);
+ if (retval) {
com_err(argv[0], retval, "while transforming master key from password");
exit_status++; return;
}
global_params.dbname);
exit_status++; return;
}
- if (retval = krb5_db_fini(util_context)) {
+ if ((retval = krb5_db_fini(util_context))) {
com_err(argv[0], retval, "while closing current database");
exit_status++; return;
}
* it; delete the file below if it was not requested. DO NOT EXIT
* BEFORE DELETING THE KEYFILE if do_stash is not set.
*/
- if (retval = krb5_db_store_mkey(util_context,
- global_params.stash_file,
- master_princ,
- &master_keyblock)) {
+ retval = krb5_db_store_mkey(util_context,
+ global_params.stash_file,
+ master_princ,
+ &master_keyblock);
+ if (retval) {
com_err(argv[0], errno, "while storing key");
printf("Warning: couldn't stash master key.\n");
}
struct iterate_args *iargs;
krb5_keyblock key;
krb5_int32 ind;
- krb5_pointer rseed;
krb5_data pwd;
iargs = (struct iterate_args *) ptr;
*/
pwd.data = mkey_password;
pwd.length = strlen(mkey_password);
- if (kret = krb5_c_random_seed(context, &pwd))
+ kret = krb5_c_random_seed(context, &pwd);
+ if (kret)
return kret;
if (!(kret = krb5_dbe_create_key_data(iargs->ctx, iargs->dbentp))) {
int optchar;
char *dbname;
char buf[5];
- char dbfilename[MAXPATHLEN];
krb5_error_code retval, retval1, retval2;
krb5_context context;
int force = 0;
printf("OK, deleting database '%s'...\n", dbname);
}
- if (retval = krb5_db_set_name(context, dbname)) {
+ retval = krb5_db_set_name(context, dbname);
+ if (retval) {
com_err(argv[0], retval, "'%s'",dbname);
exit_status++; return;
}
char *keyfile = 0;
krb5_context context;
- int enctypedone = 0;
-
if (strrchr(argv[0], '/'))
argv[0] = strrchr(argv[0], '/')+1;
exit_status++; return;
}
- if (retval = krb5_db_set_name(context, dbname)) {
+ retval = krb5_db_set_name(context, dbname);
+ if (retval) {
com_err(argv[0], retval, "while setting active database to '%s'",
dbname);
exit_status++; 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(argv[0], retval, "while setting up master key name");
exit_status++; return;
}
- if (retval = krb5_db_init(context)) {
+ retval = krb5_db_init(context);
+ if (retval) {
com_err(argv[0], retval, "while initializing the database '%s'",
dbname);
exit_status++; return;
}
/* TRUE here means read the keyboard, but only once */
- if (retval = krb5_db_fetch_mkey(context, master_princ,
- master_keyblock.enctype,
- TRUE, FALSE, (char *) NULL,
- 0, &master_keyblock)) {
+ retval = krb5_db_fetch_mkey(context, master_princ,
+ master_keyblock.enctype,
+ TRUE, FALSE, (char *) NULL,
+ 0, &master_keyblock);
+ if (retval) {
com_err(argv[0], retval, "while reading master key");
(void) krb5_db_fini(context);
exit_status++; return;
}
- if (retval = krb5_db_verify_master_key(context, master_princ,
- &master_keyblock)) {
+
+ retval = krb5_db_verify_master_key(context, master_princ,
+ &master_keyblock);
+ if (retval) {
com_err(argv[0], retval, "while verifying master key");
(void) krb5_db_fini(context);
exit_status++; return;
}
- if (retval = krb5_db_store_mkey(context, keyfile, master_princ,
- &master_keyblock)) {
+
+ retval = krb5_db_store_mkey(context, keyfile, master_princ,
+ &master_keyblock);
+ if (retval) {
com_err(argv[0], errno, "while storing key");
memset((char *)master_keyblock.contents, 0, master_keyblock.length);
(void) krb5_db_fini(context);
exit_status++; return;
}
memset((char *)master_keyblock.contents, 0, master_keyblock.length);
- if (retval = krb5_db_fini(context)) {
+
+ retval = krb5_db_fini(context);
+ if (retval) {
com_err(argv[0], retval, "closing database '%s'", dbname);
exit_status++; return;
}