Patch from Matt Crawford to allow matching on realm in cross-realm
authorSam Hartman <hartmans@mit.edu>
Fri, 7 May 2004 19:18:17 +0000 (19:18 +0000)
committerSam Hartman <hartmans@mit.edu>
Fri, 7 May 2004 19:18:17 +0000 (19:18 +0000)
authentication for krb5_aname_to_lname.

Ticket: 957

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16321 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/os/ChangeLog
src/lib/krb5/os/an_to_ln.c

index 431bbd4752780f21e620c681f97fc67cf98d80e7..59c24dc0d5a7471822429916c96d024dfd549f0d 100644 (file)
@@ -1,3 +1,8 @@
+2004-05-07  Sam Hartman  <hartmans@mit.edu>
+
+       * an_to_ln.c: Patch from Matt Crawford  to allow matching on
+       realms of cross-realm principals.
+
 2004-05-05  Ken Raeburn  <raeburn@mit.edu>
 
        * localaddr.c: Incorporate foreach_localaddr implementation.
index c42b821428947f7a6c7964a02eb64798713d24fb..41a5bde3130489364f79dabee551caaa1fd63f03 100644 (file)
@@ -460,7 +460,7 @@ rule_an_to_ln(krb5_context context, char *rule, krb5_const_principal aname, cons
     char               *selstring = 0;
     int                        num_comps, compind;
     char               *cout;
-    krb5_data          *datap;
+    krb5_const krb5_data *datap;
     char               *outstring;
 
     /*
@@ -493,9 +493,11 @@ rule_an_to_ln(krb5_context context, char *rule, krb5_const_principal aname, cons
                            if (*current == '$') {
                                if ((sscanf(current+1, "%d", &compind) == 1) &&
                                    (compind <= num_comps) &&
-                                   (datap = krb5_princ_component(context,
-                                                                 aname,
-                                                                 compind-1))
+                                   (datap =
+                                    (compind > 0)
+                                    ? krb5_princ_component(context, aname,
+                                                           compind-1)
+                                    : krb5_princ_realm(context, aname))
                                    ) {
                                    strncpy(cout,
                                            datap->data,