]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
Windows: use krb5_get_error_message to translate krb5 errors in afskfw library
authorJeffrey Altman <jaltman@your-file-system.com>
Fri, 5 Mar 2010 14:47:43 +0000 (09:47 -0500)
committerJeffrey Altman <jaltman@openafs.org>
Sat, 6 Mar 2010 03:04:43 +0000 (19:04 -0800)
Use krb5_get_error_message to translate krb5 errors to strings
in the afskfw library.  This provides error translations to afscreds
and afslogon.dll.

LICENSE MIT

Change-Id: Idd4c15b3719be517a79947f6af52a4bdf50b1155
Reviewed-on: http://gerrit.openafs.org/1519
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
src/WINNT/afsd/afskfw.c

index 974a27cceaa6790c9b5c092be93b59581dbddddd..bca0ec22935e1572e4035e969f1964cad8de527f 100644 (file)
@@ -180,6 +180,8 @@ DECL_FUNC_PTR(krb5_get_host_realm);
 DECL_FUNC_PTR(krb5_free_host_realm);
 DECL_FUNC_PTR(krb5_free_addresses);
 DECL_FUNC_PTR(krb5_c_random_make_octets);
+DECL_FUNC_PTR(krb5_get_error_message);
+DECL_FUNC_PTR(krb5_free_error_message);
 
 #ifdef USE_KRB524
 // Krb524 functions
@@ -318,6 +320,8 @@ FUNC_INFO k5_fi[] = {
     MAKE_FUNC_INFO(krb5_free_host_realm),
     MAKE_FUNC_INFO(krb5_free_addresses),
     MAKE_FUNC_INFO(krb5_c_random_make_octets),
+    MAKE_FUNC_INFO(krb5_get_error_message),
+    MAKE_FUNC_INFO(krb5_free_error_message),
     END_FUNC_INFO
 };
 
@@ -652,12 +656,13 @@ KRB5_error(krb5_error_code rc, LPCSTR FailedFunctionName,
     }
     */
         
-    errText = perror_message(rc);   
+    errText = pkrb5_get_error_message(ctx, rc);
     _snprintf(message, sizeof(message), 
               "%s\n(Kerberos error %ld)\n\n%s failed", 
               errText, 
               krb5Error, 
               FailedFunctionName);
+    pkrb5_free_error_message(ctx, errText);
 
     if ( IsDebuggerPresent() )
         OutputDebugString(message);
@@ -1491,7 +1496,9 @@ KFW_AFS_get_cred( char * username,
         free(cellconfig.linkedCell);
 
     if ( code && reasonP ) {
-        *reasonP = (char *)perror_message(code);
+        char *msg = pkrb5_get_error_message(ctx, code);
+        *reasonP = strdup(msg);
+        pkrb5_free_error_message(ctx, msg);
     }
     return(code);
 }