From 97c28a0ee28e813de33041296d8d143285fa9eca Mon Sep 17 00:00:00 2001 From: Ezra Peisach Date: Mon, 30 Mar 1998 21:47:45 +0000 Subject: [PATCH] * kdb5_verify.c: Declare main() as int instead of void. Add parentheses around assignements in conditionals. More gcc -Wall cleanups git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@10508 dc483132-0cff-0310-8789-dd5450dbe970 --- src/tests/verify/ChangeLog | 5 +++ src/tests/verify/kdb5_verify.c | 61 ++++++++++++++++++---------------- 2 files changed, 37 insertions(+), 29 deletions(-) diff --git a/src/tests/verify/ChangeLog b/src/tests/verify/ChangeLog index 5a059f2fb..bb9397a44 100644 --- a/src/tests/verify/ChangeLog +++ b/src/tests/verify/ChangeLog @@ -1,3 +1,8 @@ +Mon Mar 30 16:46:20 1998 Ezra Peisach + + * kdb5_verify.c: Declare main() as int instead of void. + Add parentheses around assignements in conditionals. + Wed Feb 18 16:30:59 1998 Tom Yu * Makefile.in: Remove trailing slash from thisconfigdir. Fix up diff --git a/src/tests/verify/kdb5_verify.c b/src/tests/verify/kdb5_verify.c index aeb778199..5ef38d6d6 100644 --- a/src/tests/verify/kdb5_verify.c +++ b/src/tests/verify/kdb5_verify.c @@ -90,7 +90,7 @@ quit(context) int check_princ PROTOTYPE((krb5_context, char *)); -void +int main(argc, argv) int argc; char *argv[]; @@ -174,12 +174,12 @@ char *argv[]; dbname = DEFAULT_KDB_FILE; /* XXX? */ if (!cur_realm) { - if (retval = krb5_get_default_realm(context, &cur_realm)) { + if ((retval = krb5_get_default_realm(context, &cur_realm))) { com_err(progname, retval, "while retrieving default realm name"); exit(1); } } - if (retval = set_dbname_help(context, progname, dbname)) + if ((retval = set_dbname_help(context, progname, dbname))) exit(retval); errors = 0; @@ -233,14 +233,14 @@ check_princ(context, str_princ) krb5_principal princ; krb5_boolean more; int nprincs = 1; - char *str_mod_name; + /* char *str_mod_name; */ char princ_name[4096]; sprintf(princ_name, "%s@%s", str_princ, cur_realm); fprintf(stderr, "\t%s ...\n", princ_name); - if (retval = krb5_parse_name(context, princ_name, &princ)) { + if ((retval = krb5_parse_name(context, princ_name, &princ))) { com_err(progname, retval, "while parsing '%s'", princ_name); goto out; } @@ -248,19 +248,20 @@ check_princ(context, str_princ) pwd.data = princ_name; /* must be able to regenerate */ pwd.length = strlen(princ_name); - if (retval = krb5_principal2salt(context, princ, &salt)) { + if ((retval = krb5_principal2salt(context, princ, &salt))) { com_err(progname, retval, "while converting principal to salt for '%s'", princ_name); goto out; } - if (retval = krb5_string_to_key(context, &master_encblock, - &pwd_key, &pwd, &salt)) { + if ((retval = krb5_string_to_key(context, &master_encblock, + &pwd_key, &pwd, &salt))) { com_err(progname, retval, "while converting password to key for '%s'", princ_name); goto out; } - if (retval = krb5_db_get_principal(context,princ, &kdbe, &nprincs, &more)) { + if ((retval = krb5_db_get_principal(context, princ, &kdbe, + &nprincs, &more))) { com_err(progname, retval, "while attempting to verify principal's existence"); goto out; } @@ -271,8 +272,8 @@ check_princ(context, str_princ) goto errout; } - if (retval = krb5_dbekd_decrypt_key_data(context, &master_encblock, - kdbe.key_data, &db_key, NULL)) { + if ((retval = krb5_dbekd_decrypt_key_data(context, &master_encblock, + kdbe.key_data, &db_key, NULL))) { com_err(progname, retval, "while decrypting key for '%s'", princ_name); goto errout; } @@ -321,7 +322,7 @@ errout: } /* - if (retval = krb5_unparse_name(context, kdbe.mod_name, &str_mod_name)) + if ((retval = krb5_unparse_name(context, kdbe.mod_name, &str_mod_name))) com_err(progname, retval, "while unparsing mode name"); else { if (strcmp(str_mod_name, str_master_princ) != 0) { @@ -357,15 +358,15 @@ set_dbname_help(context, pname, dbname) krb5_boolean more; krb5_data pwd, scratch; - if (retval = krb5_db_set_name(context, dbname)) { + if ((retval = krb5_db_set_name(context, dbname))) { com_err(pname, retval, "while setting active database to '%s'", dbname); return(1); } /* assemble & parse the master key name */ - if (retval = krb5_db_setup_mkey_name(context, mkey_name, cur_realm, 0, - &master_princ)) { + if ((retval = krb5_db_setup_mkey_name(context, mkey_name, cur_realm, 0, + &master_princ))) { com_err(pname, retval, "while setting up master key name"); return(1); } @@ -377,34 +378,35 @@ set_dbname_help(context, pname, dbname) com_err(pname, retval, "while calculated master key salt"); return(1); } - if (retval = krb5_string_to_key(context, &master_encblock, - &master_keyblock, &pwd, &scratch)) { + if ((retval = krb5_string_to_key(context, &master_encblock, + &master_keyblock, &pwd, &scratch))) { com_err(pname, retval, "while transforming master key from password"); return(1); } free(scratch.data); } else { - if (retval = krb5_db_fetch_mkey(context, master_princ, &master_encblock, + if ((retval = krb5_db_fetch_mkey(context, master_princ, &master_encblock, manual_mkey, FALSE, (char *) NULL, 0, - &master_keyblock)) { + &master_keyblock))) { com_err(pname, retval, "while reading master key"); return(1); } } - if (retval = krb5_db_init(context )) { + if ((retval = krb5_db_init(context ))) { com_err(pname, retval, "while initializing database"); return(1); } - if (retval = krb5_db_verify_master_key(context, master_princ, - &master_keyblock,&master_encblock)) { + if ((retval = krb5_db_verify_master_key(context, master_princ, + &master_keyblock, + &master_encblock))) { com_err(pname, retval, "while verifying master key"); (void) krb5_db_fini(context); return(1); } nentries = 1; - if (retval = krb5_db_get_principal(context, master_princ, &master_entry, - &nentries, &more)) { + if ((retval = krb5_db_get_principal(context, master_princ, &master_entry, + &nentries, &more))) { com_err(pname, retval, "while retrieving master entry"); (void) krb5_db_fini(context); return(1); @@ -419,21 +421,22 @@ set_dbname_help(context, pname, dbname) return(1); } - if (retval = krb5_unparse_name(context, master_princ, &str_master_princ)) { + if ((retval = krb5_unparse_name(context, master_princ, + &str_master_princ))) { com_err(pname, retval, "while unparsing master principal"); krb5_db_fini(context); return(1); } - if (retval = krb5_process_key(context, - &master_encblock, &master_keyblock)) { + if ((retval = krb5_process_key(context, + &master_encblock, &master_keyblock))) { com_err(pname, retval, "while processing master key"); (void) krb5_db_fini(context); return(1); } - if (retval = krb5_init_random_key(context, + if ((retval = krb5_init_random_key(context, &master_encblock, &master_keyblock, - &master_random)) { + &master_random))) { com_err(pname, retval, "while initializing random key generator"); krb5_finish_key(context, &master_encblock); (void) krb5_db_fini(context); -- 2.26.2