]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Because there is only one realm field in the kdc request, the KDC
authorSam Hartman <hartmans@mit.edu>
Wed, 23 Dec 2009 21:09:56 +0000 (21:09 +0000)
committerSam Hartman <hartmans@mit.edu>
Wed, 23 Dec 2009 21:09:56 +0000 (21:09 +0000)
remaps WELLKNOWN/ANONYMOUS@realm to
WELLKNOWN/ANONYMOUS@WELLKNOWN:ANONYMOUS.

In the client pkinit plugin, do not require that the anonymous realm be used for the anonymous principal.

git-svn-id: svn://anonsvn.mit.edu/krb5/branches/anonymous@23494 dc483132-0cff-0310-8789-dd5450dbe970

src/kdc/do_as_req.c
src/plugins/preauth/pkinit/pkinit_identity.c

index 23f1ddcb83808fd367965ee97fab1b9c6dbb35d6..4a845ce5b535cda577633cfaf05ceebd6a561aa9 100644 (file)
@@ -389,6 +389,22 @@ process_as_req(krb5_kdc_req *request, krb5_data *req_pkt,
     enc_tkt_reply.caddrs = request->addresses;
     enc_tkt_reply.authorization_data = 0;
 
+    /* If anonymous requests are being used, adjust the realm of the client principal*/
+    if (request->kdc_options & KDC_OPT_REQUEST_ANONYMOUS) {
+        if (!krb5_principal_compare_any_realm(kdc_context, request->client,
+                                              krb5_anonymous_principal())) {
+            errcode = KRB5KDC_ERR_BADOPTION;
+            status = "Anonymous requested but anonymous principal not used.";
+            goto errout;
+        }
+        krb5_free_principal(kdc_context, request->client);
+        errcode = krb5_copy_principal(kdc_context, krb5_anonymous_principal(),
+                                      &request->client);
+        if (errcode) {
+            status = "Copying anonymous principal";
+            goto errout;
+        }
+    }
     /*
      * Check the preauthentication if it is there.
      */
index dfb9dd71ee2a6bfd4a8c3a1af8043c08e556baeb..0ab214cf08c82b22aed90376685a23f05baa4a6f 100644 (file)
@@ -505,7 +505,7 @@ pkinit_identity_initialize(krb5_context context,
     int i;
 
     pkiDebug("%s: %p %p %p\n", __FUNCTION__, context, idopts, id_cryptoctx);
-    if (!krb5_principal_compare (context, princ, krb5_anonymous_principal())) {
+    if (!krb5_principal_compare_any_realm (context, princ, krb5_anonymous_principal())) {
         if (idopts == NULL || id_cryptoctx == NULL)
             goto errout;