From: Ezra Peisach Date: Thu, 12 Oct 2000 18:58:26 +0000 (+0000) Subject: * lock-test.c (main): Cleanup assignments in conditionals. If X-Git-Tag: krb5-1.3-alpha1~1839 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b797c63c78249988f0cfa834f7d46bdb1304673a;p=krb5.git * lock-test.c (main): Cleanup assignments in conditionals. If USE_KADM5_API_VERSION is 1, set to 2. This program uses the V2 api (kadm5_get_config_params). * setkey-test.c: Declare main() as int. Enclose initialization of elements of arrays in '{', '}'. Use krb5_enctype type instead of unsigned int. Break out assignments in conditionals. * destroy-test.c, handle-test.c, init-test.c, iter-test.c, randkey-test.c: Declare main() as int. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@12755 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/kadm5/unit-test/ChangeLog b/src/lib/kadm5/unit-test/ChangeLog index 5a952b784..659aff870 100644 --- a/src/lib/kadm5/unit-test/ChangeLog +++ b/src/lib/kadm5/unit-test/ChangeLog @@ -1,3 +1,16 @@ +2000-10-12 Ezra Peisach + + * lock-test.c (main): Cleanup assignments in conditionals. If + USE_KADM5_API_VERSION is 1, set to 2. This program uses the V2 api + (kadm5_get_config_params). + + * setkey-test.c: Declare main() as int. Enclose initialization of + elements of arrays in '{', '}'. Use krb5_enctype type instead of + unsigned int. Break out assignments in conditionals. + + * destroy-test.c, handle-test.c, init-test.c, iter-test.c, + randkey-test.c: Declare main() as int. + 2000-06-28 Ezra Peisach * iter-test.c (main): Code was using ovsec_kadm_ret_t in place of diff --git a/src/lib/kadm5/unit-test/destroy-test.c b/src/lib/kadm5/unit-test/destroy-test.c index 0db69c3a1..02bfb7ec9 100644 --- a/src/lib/kadm5/unit-test/destroy-test.c +++ b/src/lib/kadm5/unit-test/destroy-test.c @@ -11,11 +11,11 @@ #define TEST_NUM 25 -main() +int main() { ovsec_kadm_ret_t ret; char *cp; - int x, i; + int x; void *server_handle; kadm5_server_handle_t handle; diff --git a/src/lib/kadm5/unit-test/handle-test.c b/src/lib/kadm5/unit-test/handle-test.c index ced1d183d..aa71df483 100644 --- a/src/lib/kadm5/unit-test/handle-test.c +++ b/src/lib/kadm5/unit-test/handle-test.c @@ -9,7 +9,7 @@ #include -main(int argc, char *argv[]) +int main(int argc, char *argv[]) { ovsec_kadm_ret_t ret; void *server_handle; @@ -20,7 +20,6 @@ main(int argc, char *argv[]) krb5_keyblock *key; krb5_principal tprinc; krb5_context context; - int *p; krb5_init_context(&context); diff --git a/src/lib/kadm5/unit-test/init-test.c b/src/lib/kadm5/unit-test/init-test.c index 823dd222b..5389caf71 100644 --- a/src/lib/kadm5/unit-test/init-test.c +++ b/src/lib/kadm5/unit-test/init-test.c @@ -3,7 +3,7 @@ #include #include -main() +int main() { ovsec_kadm_ret_t ret; void *server_handle; diff --git a/src/lib/kadm5/unit-test/iter-test.c b/src/lib/kadm5/unit-test/iter-test.c index f7740c74f..4c85fe763 100644 --- a/src/lib/kadm5/unit-test/iter-test.c +++ b/src/lib/kadm5/unit-test/iter-test.c @@ -1,7 +1,7 @@ #include #include -main(int argc, char **argv) +int main(int argc, char **argv) { ovsec_kadm_ret_t ret; void *server_handle; diff --git a/src/lib/kadm5/unit-test/lock-test.c b/src/lib/kadm5/unit-test/lock-test.c index 417f6c145..256954c85 100644 --- a/src/lib/kadm5/unit-test/lock-test.c +++ b/src/lib/kadm5/unit-test/lock-test.c @@ -1,3 +1,8 @@ +#if USE_KADM5_API_VERSION == 1 +#undef USE_KADM5_API_VERSION +#define USE_KADM5_API_VERSION 2 +#endif + #include #include #include @@ -5,7 +10,7 @@ char *whoami; -void usage() +static void usage() { fprintf(stderr, "Usage: %s {shared|exclusive|permanent|release|" @@ -13,7 +18,7 @@ void usage() exit(1); } -main(int argc, char **argv) +int main(int argc, char **argv) { osa_adb_ret_t ret; osa_adb_policy_t policy_db; @@ -35,8 +40,9 @@ main(int argc, char **argv) initialize_ovku_error_table(); params.mask = 0; - if (ret = kadm5_get_config_params(context, NULL, NULL, ¶ms, - ¶ms)) { + ret = kadm5_get_config_params(context, NULL, NULL, ¶ms, + ¶ms); + if (ret) { com_err(whoami, ret, "while retrieving configuration parameters"); exit(1); } diff --git a/src/lib/kadm5/unit-test/randkey-test.c b/src/lib/kadm5/unit-test/randkey-test.c index 8d7e2fece..cddc165df 100644 --- a/src/lib/kadm5/unit-test/randkey-test.c +++ b/src/lib/kadm5/unit-test/randkey-test.c @@ -7,7 +7,7 @@ #define TEST_NUM 1000 -main() +int main() { ovsec_kadm_ret_t ret; krb5_keyblock *keys[TEST_NUM]; diff --git a/src/lib/kadm5/unit-test/setkey-test.c b/src/lib/kadm5/unit-test/setkey-test.c index fed4e0e74..5b791d8f3 100644 --- a/src/lib/kadm5/unit-test/setkey-test.c +++ b/src/lib/kadm5/unit-test/setkey-test.c @@ -19,28 +19,30 @@ need a random number generator #endif /* no random */ krb5_keyblock test1[] = { - 0, ENCTYPE_DES_CBC_CRC, 0, 0, - -1, + {0, ENCTYPE_DES_CBC_CRC, 0, 0}, + {-1}, }; krb5_keyblock test2[] = { - 0, ENCTYPE_DES_CBC_RAW, 0, 0, - -1, + {0, ENCTYPE_DES_CBC_RAW, 0, 0}, + {-1}, }; krb5_keyblock test3[] = { - 0, ENCTYPE_DES_CBC_MD5, 0, 0, - -1, + {0, ENCTYPE_DES_CBC_MD5, 0, 0}, + {-1}, }; krb5_keyblock *tests[] = { test1, test2, test3, NULL }; +#if 0 int keyblocks_equal(krb5_keyblock *kb1, krb5_keyblock *kb2) { return (kb1->enctype == kb2->enctype && kb1->length == kb2->length && memcmp(kb1->contents, kb2->contents, kb1->length) == 0); } +#endif krb5_data tgtname = { 0, @@ -48,10 +50,11 @@ krb5_data tgtname = { KRB5_TGS_NAME }; -unsigned int ktypes[] = { 0, 0 }; +krb5_enctype ktypes[] = { 0, 0 }; extern krb5_kt_ops krb5_ktf_writable_ops; +int main(int argc, char **argv) { krb5_context context; @@ -102,7 +105,8 @@ main(int argc, char **argv) } /* register the WRFILE keytab type */ - if (ret = krb5_kt_register(context, &krb5_ktf_writable_ops)) { + ret = krb5_kt_register(context, &krb5_ktf_writable_ops); + if (ret) { com_err(whoami, ret, "while registering writable key table functions"); exit(1); @@ -146,8 +150,9 @@ main(int argc, char **argv) pw[i] = (RAND() % 26) + '0'; /* XXX */ krb5_use_enctype(context, &eblock, testp[encnum].enctype); - if (ret = krb5_string_to_key(context, &eblock, &testp[encnum], - &pwdata, NULL)) { + ret = krb5_string_to_key(context, &eblock, &testp[encnum], + &pwdata, NULL); + if (ret) { com_err(whoami, ret, "while converting string to key"); exit(1); }