Provide more detailed error message for 'client not found in kdb'
authorKen Raeburn <raeburn@mit.edu>
Fri, 13 Apr 2007 05:31:24 +0000 (05:31 +0000)
committerKen Raeburn <raeburn@mit.edu>
Fri, 13 Apr 2007 05:31:24 +0000 (05:31 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@19455 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/krb/get_in_tkt.c

index 81f97dac8cd1d747ccfc346d6de9c13b9a922075..a4e2b013103cad1663bfa254249aae7700923ea9 100644 (file)
@@ -1282,6 +1282,23 @@ krb5_get_init_creds(krb5_context context,
     ret = 0;
 
 cleanup:
+    if (ret != 0) {
+       char *client_name;
+       /* See if we can produce a more detailed error message.  */
+       switch (ret) {
+       case KRB5KDC_ERR_C_PRINCIPAL_UNKNOWN:
+           client_name = NULL;
+           if (krb5_unparse_name(context, client, &client_name) == 0) {
+               krb5_set_error_message(context, ret,
+                                      "Client '%s' not found in Kerberos database",
+                                      client_name);
+               free(client_name);
+           }
+           break;
+       default:
+           break;
+       }
+    }
     krb5_preauth_request_context_fini(context);
     if (encoded_previous_request != NULL) {
        krb5_free_data(context, encoded_previous_request);