using get_realm_domain() now instead of rconv cruft
authorTom Yu <tlyu@mit.edu>
Thu, 9 Jun 1994 07:20:06 +0000 (07:20 +0000)
committerTom Yu <tlyu@mit.edu>
Thu, 9 Jun 1994 07:20:06 +0000 (07:20 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@3684 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/krb/conv_princ.c

index 2d28428171ed075f8864f5813ba09ed6996eea4e..98189aab443496cda198e7b62d6d1590b74568e4 100644 (file)
@@ -67,11 +67,6 @@ static struct krb_convert sconv_list[] = {
     0,         0,
 };
 
-static struct krb_convert rconv_list[] = {
-       "ATHENA.MIT.EDU",       ".mit.edu",
-       0,                      0
-};
-
 /*
  * char *strnchr(s, c, n)
  *   char *s;
@@ -178,6 +173,8 @@ krb5_error_code krb5_425_conv_principal(name, instance, realm, princ)
 {
      struct krb_convert *p;
      char buf[256];            /* V4 instances are limited to 40 characters */
+     krb5_error_code retval;
+     char *domain, *cp;
      
      if (instance) {
          if (instance[0] == '\0') {
@@ -195,16 +192,16 @@ krb5_error_code krb5_425_conv_principal(name, instance, realm, princ)
          name = p->v5_str;
          if (p->flags & DO_REALM_CONVERSION) {
               strcpy(buf, instance);
-              p = rconv_list;
-              while (1) {
-                   if (!p->v4_str)
-                        break;
-                   if (!strcmp(p->v4_str, realm))
-                        break;
-                   p++;
+              retval = krb5_get_realm_domain(realm, &domain);
+              if (retval)
+                  return retval;
+              if (domain) {
+                  for (cp = domain; *cp; cp++)
+                      if (isupper(*cp))
+                          *cp = tolower(*cp);
+                  strcat(buf, domain);
+                  krb5_xfree(domain);
               }
-              if (p->v5_str)
-                   strcat(buf, p->v5_str);
               instance = buf;
          }
      }