aix krb5 error message handling
authorDerrick Brashear <shadow@dementia.org>
Sun, 21 Mar 2010 16:49:34 +0000 (12:49 -0400)
committerDerrick Brashear <shadow@dementia.org>
Sun, 21 Mar 2010 16:51:55 +0000 (09:51 -0700)
handle krb5 error messages for aix in aklog and lam plugin

Change-Id: Iac96dc62e7889d375db111d5c96d86cf09715ab6
Reviewed-on: http://gerrit.openafs.org/1609
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

src/aklog/aklog.c
src/cf/kerberos.m4
src/tsm41/aix_aklog.c

index 2caed07..9525cc7 100644 (file)
@@ -332,10 +332,17 @@ redirect_errors(const char *who, afs_int32 code, const char *fmt, va_list ap)
     if (code) {
        const char *str = afs_error_message(code);
        if (strncmp(str, "unknown", strlen("unknown")) == 0) {
+#ifdef HAVE_KRB5_SVC_GET_MSG
+           krb5_svc_get_msg(code,&str);
+#else
            str = error_message(code);
+#endif
        }
        fputs(str, stderr);
        fputs(" ", stderr);
+#ifdef HAVE_KRB5_SVC_GET_MSG
+       krb5_free_string(str);
+#endif
     }
     if (fmt) {
        vfprintf(stderr, fmt, ap);
index caaaf44..2b01a2a 100644 (file)
@@ -65,7 +65,7 @@ if test X$conf_krb5 = XYES; then
        CPPFLAGS="$CPPFLAGS $KRB5CFLAGS"
        save_LIBS="$LIBS"
        LIBS="$LIBS $KRB5LIBS"
-       AC_CHECK_FUNCS([add_to_error_table add_error_table krb5_princ_size krb5_principal_get_comp_string encode_krb5_enc_tkt_part encode_krb5_ticket krb5_c_encrypt krb5_decode_ticket krb5_get_prompt_types krb5_allow_weak_crypto krb5_enctype_enable])
+       AC_CHECK_FUNCS([add_to_error_table add_error_table krb5_princ_size krb5_principal_get_comp_string encode_krb5_enc_tkt_part encode_krb5_ticket krb5_c_encrypt krb5_decode_ticket krb5_get_prompt_types krb5_allow_weak_crypto krb5_enctype_enable krb5_svc_get_msg])
        AC_CHECK_FUNCS([krb5_524_convert_creds], ,
            [AC_CHECK_FUNCS([krb524_convert_creds_kdc], ,
                [AC_CHECK_LIB([krb524], [krb524_convert_creds_kdc],
index b6fba8a..9c1e919 100644 (file)
@@ -156,9 +156,18 @@ aklog_authenticate(char *userName, char *response, int *reenter, char **message)
     status = auth_to_cell(context, userName, NULL, NULL);
     
     if (status) {
+       char *str = afs_error_message(status);
        *message = (char *)malloc(1024);
-       sprintf(*message, "Unable to obtain AFS tokens: %s.\n",
-               afs_error_message(status));
+#ifdef HAVE_KRB5_SVC_GET_MSG
+       if (strncmp(str, "unknown", strlen("unknown")) == 0) {
+           krb5_svc_get_msg(status,&str);
+           sprintf(*message, "Unable to obtain AFS tokens: %s.\n",
+                    str);
+           krb5_free_string(str);
+       } else
+#endif
+           sprintf(*message, "Unable to obtain AFS tokens: %s.\n",
+                   str);
        return AUTH_FAILURE; /* NOTFOUND? */
     }