From: zacheiss Date: Mon, 19 Aug 2002 18:23:50 +0000 (+0000) Subject: Only check the return value of krb5_init_context if we actually called X-Git-Url: http://andersk.mit.edu/gitweb/moira.git/commitdiff_plain/a20694771a1a74a88e077264f0f045cc43c2156d Only check the return value of krb5_init_context if we actually called it. Use krb5_error_code everywhere for sanity reasons. --- diff --git a/lib/mr_auth.c b/lib/mr_auth.c index fccf5f51..9c7641bb 100644 --- a/lib/mr_auth.c +++ b/lib/mr_auth.c @@ -95,21 +95,20 @@ int mr_proxy(char *principal, char *orig_authtype) int mr_krb5_auth(char *prog) { - int status; mr_params params, reply; char host[BUFSIZ], *p; char *args[2]; int argl[2]; krb5_ccache ccache = NULL; krb5_data auth; - krb5_error_code problem; + krb5_error_code problem = 0; CHECK_CONNECTED; memset(&auth, 0, sizeof(auth)); - if ((status = mr_host(host, sizeof(host) - 1))) - return status; + if ((problem = mr_host(host, sizeof(host) - 1))) + return problem; for (p = host; *p && *p != '.'; p++) { @@ -119,9 +118,11 @@ int mr_krb5_auth(char *prog) *p = '\0'; if (!context) - problem = krb5_init_context(&context); - if (problem) - goto out; + { + problem = krb5_init_context(&context); + if (problem) + goto out; + } problem = krb5_auth_con_init(context, &auth_con); if (problem) @@ -145,8 +146,8 @@ int mr_krb5_auth(char *prog) params.mr_argv[1] = prog; params.mr_argl[1] = strlen(prog) + 1; - if ((status = mr_do_call(¶ms, &reply)) == MR_SUCCESS) - status = reply.u.mr_status; + if ((problem = mr_do_call(¶ms, &reply)) == MR_SUCCESS) + problem = reply.u.mr_status; mr_destroy_reply(reply); @@ -158,6 +159,6 @@ int mr_krb5_auth(char *prog) krb5_auth_con_free(context, auth_con); auth_con = NULL; - return status; + return problem; }