Blame SOURCES/Add-the-client_name-kdcpreauth-callback.patch

963210
From aa153bb60c4fdc05adbc88cca578612fce6c8ce0 Mon Sep 17 00:00:00 2001
963210
From: Matt Rogers <mrogers@redhat.com>
963210
Date: Tue, 4 Apr 2017 16:54:56 -0400
963210
Subject: [PATCH] Add the client_name() kdcpreauth callback
963210
963210
Add a kdcpreauth callback to returns the canonicalized client principal.
963210
963210
ticket: 8570 (new)
963210
(cherry picked from commit a84f39ec30f3deeda7836da6e8b3d8dcf7a045b1)
963210
---
963210
 src/include/krb5/kdcpreauth_plugin.h | 6 ++++++
963210
 src/kdc/kdc_preauth.c                | 9 ++++++++-
963210
 2 files changed, 14 insertions(+), 1 deletion(-)
963210
963210
diff --git a/src/include/krb5/kdcpreauth_plugin.h b/src/include/krb5/kdcpreauth_plugin.h
963210
index 92aa5a5a5..fa4436b83 100644
963210
--- a/src/include/krb5/kdcpreauth_plugin.h
963210
+++ b/src/include/krb5/kdcpreauth_plugin.h
963210
@@ -232,6 +232,12 @@ typedef struct krb5_kdcpreauth_callbacks_st {
963210
                                  krb5_kdcpreauth_rock rock,
963210
                                  krb5_principal princ);
963210
 
963210
+    /*
963210
+     * Get an alias to the client DB entry principal (possibly canonicalized).
963210
+     */
963210
+    krb5_principal (*client_name)(krb5_context context,
963210
+                                  krb5_kdcpreauth_rock rock);
963210
+
963210
     /* End of version 4 kdcpreauth callbacks. */
963210
 
963210
 } *krb5_kdcpreauth_callbacks;
963210
diff --git a/src/kdc/kdc_preauth.c b/src/kdc/kdc_preauth.c
963210
index 0ce79c667..81d0b8cff 100644
963210
--- a/src/kdc/kdc_preauth.c
963210
+++ b/src/kdc/kdc_preauth.c
963210
@@ -591,6 +591,12 @@ match_client(krb5_context context, krb5_kdcpreauth_rock rock,
963210
     return match;
963210
 }
963210
 
963210
+static krb5_principal
963210
+client_name(krb5_context context, krb5_kdcpreauth_rock rock)
963210
+{
963210
+    return rock->client->princ;
963210
+}
963210
+
963210
 static struct krb5_kdcpreauth_callbacks_st callbacks = {
963210
     4,
963210
     max_time_skew,
963210
@@ -607,7 +613,8 @@ static struct krb5_kdcpreauth_callbacks_st callbacks = {
963210
     add_auth_indicator,
963210
     get_cookie,
963210
     set_cookie,
963210
-    match_client
963210
+    match_client,
963210
+    client_name
963210
 };
963210
 
963210
 static krb5_error_code