Fix walk_realm_tree handling of null realms
authorSam Hartman <hartmans@mit.edu>
Thu, 14 Mar 2002 15:16:16 +0000 (15:16 +0000)
committerSam Hartman <hartmans@mit.edu>
Thu, 14 Mar 2002 15:16:16 +0000 (15:16 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@14273 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/krb/ChangeLog
src/lib/krb5/krb/walk_rtree.c

index 1ac426e4d2ab98216d35521e46a23bc8c2ea6d01..b594d2306fae8957b46b136d96840aa4f3e913cc 100644 (file)
@@ -1,3 +1,7 @@
+2002-03-14  Sam Hartman  <hartmans@mit.edu>
+
+       * walk_rtree.c (krb5_walk_realm_tree):  Fix handling of null client or server realm
+
 2002-03-06  Ken Raeburn  <raeburn@mit.edu>
 
        * ser_actx.c (krb5_auth_context_externalize): Do bounds checking
index b8160fdcc45f00430b020fe3b185a4d4d39c3a1d..86e1a33d43b07c129bdfe6778e7e2e648bb2e842 100644 (file)
 #define max(x,y) ((x) > (y) ? (x) : (y))
 #endif
 
+/*
+ * xxx The following function is very confusing to read and probably
+ * is buggy.  It should be documented better.  Here is what I've
+ * learned about it doing a quick bug fixing walk through.  The
+ * function takes a client and server realm name and returns the set
+ * of realms (in a field called tree) that you need to get tickets in
+ * in order to get from the source realm to the destination realm.  It
+ * takes a realm separater character (normally ., but presumably there
+ * for all those X.500 realms) .  There are two modes it runs in: the
+ * ANL krb5.confmode and the hierarchy mode.  The ANL mode is
+ * fairly obvious.  The hierarchy mode looks for common components in
+ * both the client and server realms.  In general, the pointer scp and
+ * ccp are used to walk through the client and server realms.  The
+ * com_sdot and com_cdot pointers point to (I think) the beginning of
+ * the common part of the realm names.  I.E. strcmp(com_cdot,
+ * com_sdot) ==0 is roughly an invarient.  However, there are cases
+ * where com_sdot and com_cdot are set to point before the start of
+ * the client or server strings.  I think this only happens when there
+ * are no common components.  --hartmans 2002/03/14
+ */
+
 krb5_error_code
 krb5_walk_realm_tree(context, client, server, tree, realm_branch_char)
     krb5_context context;
@@ -115,6 +136,10 @@ krb5_walk_realm_tree(context, client, server, tree, realm_branch_char)
     char *cap_client, *cap_server;
     char **cap_nodes;
     krb5_error_code cap_code;
+#endif
+    if (!(client->data &&server->data))
+      return KRB5_NO_TKT_IN_RLM;
+#ifdef CONFIGURABLE_AUTHENTICATION_PATH
     if ((cap_client = (char *)malloc(client->length + 1)) == NULL)
        return ENOMEM;
     strncpy(cap_client, client->data, client->length);