Skip to content

Commit

Permalink
2000-06-17 Miro Jurisic <meeroh@mit.edu> * conv_princ.c (krb5_425_con…
Browse files Browse the repository at this point in the history
…v_principal): Fixed v4->v5 realm name conversion

git-svn-id: svn://anonsvn.mit.edu/krb5/branches/krb5-1-2@12400 dc483132-0cff-0310-8789-dd5450dbe970
  • Loading branch information
meeroh committed Jun 18, 2000
1 parent ac7f32a commit 72aaf5e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
5 changes: 5 additions & 0 deletions src/lib/krb5/krb/ChangeLog
@@ -1,3 +1,8 @@
2000-06-17 Miro Jurisic <meeroh@mit.edu>

* conv_princ.c (krb5_425_conv_principal): Fixed v4->v5 realm
name conversion

2000-06-17 Miro Jurisic <meeroh@mit.edu>

* conv_princ.c (krb5_425_conv_principal): Honor v4/v5 realm name
Expand Down
17 changes: 8 additions & 9 deletions src/lib/krb5/krb/conv_princ.c
Expand Up @@ -244,6 +244,8 @@ krb5_425_conv_principal(context, name, instance, realm, princ)
const char *names[5];
void* iterator = NULL;
char** v4realms = NULL;
char* realm_name = NULL;
char* dummy_value = NULL;

/* First, convert the realm, since the v4 realm is not necessarily the same as the v5 realm
To do that, iterate over all the realms in the config file, looking for a matching
Expand All @@ -252,20 +254,16 @@ krb5_425_conv_principal(context, name, instance, realm, princ)
names [1] = NULL;
retval = profile_iterator_create (context -> profile, names, PROFILE_ITER_LIST_SECTION | PROFILE_ITER_SECTIONS_ONLY, &iterator);
while (retval == 0) {
char* realm_name = NULL;
char* dummy = NULL;
retval = profile_iterator (&iterator, &realm_name, &dummy);
retval = profile_iterator (&iterator, &realm_name, &dummy_value);
if ((retval == 0) && (realm_name != NULL)) {
names [0] = "realms";
names [1] = realm_name;
names [2] = "v4_realm";
names [3] = NULL;

retval = profile_get_values (context -> profile, names, &v4realms);
profile_release_string (realm_name);
profile_release_string (dummy);
if ((retval == 0) && (v4realms != NULL) && (v4realms [0] != NULL)) {
realm = v4realms [0];
if ((retval == 0) && (v4realms != NULL) && (v4realms [0] != NULL) && (strcmp (v4realms [0], realm) == 0)) {
realm = realm_name;
break;
} else if (retval == PROF_NO_RELATION) {
/* If it's not found, just keep going */
Expand All @@ -276,8 +274,6 @@ krb5_425_conv_principal(context, name, instance, realm, princ)
}
}

profile_iterator_free (&iterator);

if (instance) {
if (instance[0] == '\0') {
instance = 0;
Expand Down Expand Up @@ -323,7 +319,10 @@ krb5_425_conv_principal(context, name, instance, realm, princ)
not_service:
retval = krb5_build_principal(context, princ, strlen(realm), realm, name,
instance, 0);
profile_iterator_free (&iterator);
profile_free_list(full_name);
profile_free_list(v4realms);
profile_release_string (realm_name);
profile_release_string (dummy_value);
return retval;
}

0 comments on commit 72aaf5e

Please sign in to comment.