From: Theodore Tso Date: Fri, 8 Nov 1996 22:27:23 +0000 (+0000) Subject: Check the error return from krb5_init_context(), and print an error X-Git-Tag: krb5-1.0-freeze1~81 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b7d0fdf7d891d191918de379194842d3f9837d48;p=krb5.git Check the error return from krb5_init_context(), and print an error message if necessary. Clean up gcc -Wall warnings. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@9344 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/krb524/ChangeLog b/src/krb524/ChangeLog index 1b1121283..5e850418a 100644 --- a/src/krb524/ChangeLog +++ b/src/krb524/ChangeLog @@ -1,3 +1,12 @@ +Thu Nov 7 15:45:16 1996 Theodore Ts'o + + * test.c (main): + * krb524d.c (main): + * k524init.c (main): + * getcred.c (main): Check the error return from + krb5_init_context(), and print an error message if + necessary. + Wed Jul 24 02:18:02 1996 Sam Hartman * test.c (krb4_print_ticket): s/KRB4_INT4/krb5_ui_4 so we work diff --git a/src/krb524/getcred.c b/src/krb524/getcred.c index 21dd80882..09ba7f391 100644 --- a/src/krb524/getcred.c +++ b/src/krb524/getcred.c @@ -34,9 +34,13 @@ main(argc, argv) CREDENTIALS v4creds; int i, ret; krb5_context context; + krb5_error_code retval; - krb5_init_context(&context); - krb524_init_ets(context); + retval = krb5_init_context(&context); + if (retval) { + com_err(argv[0], retval, "while initializing krb5"); + exit(1); + } if (ret = krb5_parse_name(argv[1], &client)) { com_err("getcred", ret, "parsing client name"); diff --git a/src/krb524/k524init.c b/src/krb524/k524init.c index 79651f521..cfce77e72 100644 --- a/src/krb524/k524init.c +++ b/src/krb524/k524init.c @@ -53,8 +53,13 @@ int main(argc, argv) int nodelete = 0; int lose = 0; krb5_context context; + krb5_error_code retval; - krb5_init_context(&context); + retval = krb5_init_context(&context); + if (retval) { + com_err(argv[0], retval, "while initializing krb5"); + exit(1); + } while(((option = getopt(argc, argv, "p:n")) != EOF)) { switch(option) { diff --git a/src/krb524/krb524d.c b/src/krb524/krb524d.c index c765ab7ad..5961b32d3 100644 --- a/src/krb524/krb524d.c +++ b/src/krb524/krb524d.c @@ -91,9 +91,13 @@ int main(argc, argv) int ret, s; fd_set rfds; krb5_context context; + krb5_error_code retval; - krb5_init_context(&context); - krb524_init_ets(context); + retval = krb5_init_context(&context); + if (retval) { + com_err(argv[0], retval, "while initializing krb5"); + exit(1); + } whoami = ((whoami = strrchr(argv[0], '/')) ? whoami + 1 : argv[0]); @@ -216,9 +220,9 @@ void init_master(context, params) int ret; use_master = 0; - if (ret = kadm5_init(whoami, NULL, KADM5_ADMIN_SERVICE, params, - KADM5_STRUCT_VERSION, KADM5_API_VERSION_2, - &handle)) { + if ((ret = kadm5_init(whoami, NULL, KADM5_ADMIN_SERVICE, params, + KADM5_STRUCT_VERSION, KADM5_API_VERSION_2, + &handle))) { com_err(whoami, ret, "initializing kadm5 library"); cleanup_and_exit(1, context); } @@ -377,8 +381,8 @@ krb5_error_code kdc_get_server_key(context, service, key, kvno, ktype) krb5_error_code ret; kadm5_principal_ent_rec server; - if (ret = kadm5_get_principal(handle, service, &server, - KADM5_KEY_DATA)) + if ((ret = kadm5_get_principal(handle, service, &server, + KADM5_KEY_DATA))) return ret; /* diff --git a/src/krb524/test.c b/src/krb524/test.c index 98e330ac7..4a7911580 100644 --- a/src/krb524/test.c +++ b/src/krb524/test.c @@ -210,10 +210,15 @@ int main(argc, argv) int i, ret, local; char *remote; krb5_context context; + krb5_error_code retval; krb524_debug = 1; - krb5_init_context(&context); + retval = krb5_init_context(&context); + if (retval) { + com_err(argv[0], retval, "while initializing krb5"); + exit(1); + } krb524_init_ets(context);