diff options
| author | Theodore Tso <tytso@mit.edu> | 1992-09-24 23:23:25 +0000 |
|---|---|---|
| committer | Theodore Tso <tytso@mit.edu> | 1992-09-24 23:23:25 +0000 |
| commit | 825b7f6cc96bb0f89d826500b6b6741eb701d1bf (patch) | |
| tree | bf951dcfef46061f6579c1e1f6b51ac9edd32e9e /src/lib | |
| parent | af6d38fcf7ba2a84bfb657762523c0c4a8c2899e (diff) | |
Made the conversion process more flexible by allowing making the realm
conversion optional on a per-service basis.
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@2398 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/krb5/krb/conv_princ.c | 97 |
1 files changed, 55 insertions, 42 deletions
diff --git a/src/lib/krb5/krb/conv_princ.c b/src/lib/krb5/krb/conv_princ.c index 340ec4894..0edb170f5 100644 --- a/src/lib/krb5/krb/conv_princ.c +++ b/src/lib/krb5/krb/conv_princ.c @@ -32,21 +32,32 @@ */ #include <krb5/krb5.h> +#include <string.h> struct krb_convert { char *v4_str; char *v5_str; + int flags; }; +#define DO_REALM_CONVERSION 0x00000001 + +/* + * Kadmin doesn't do realm conversion because it's currently + * kadmin/REALM.NAME. It should be kadmin/kerberos.master.host, but + * we'll fix that in the next release. + */ static struct krb_convert sconv_list[] = { - "rcmd", "host", - "discuss", "discuss", - "rvdsrv", "rvdsrv", - "olc", "olc", - "pop", "pop", - "sis", "sis", - "rfs", "rfs", - 0, 0, + "kadmin", "kadmin", 0, + "rcmd", "host", DO_REALM_CONVERSION, + "discuss", "discuss", DO_REALM_CONVERSION, + "rvdsrv", "rvdsrv", DO_REALM_CONVERSION, + "sample", "sample", DO_REALM_CONVERSION, + "olc", "olc", DO_REALM_CONVERSION, + "pop", "pop", DO_REALM_CONVERSION, + "sis", "sis", DO_REALM_CONVERSION, + "rfs", "rfs", DO_REALM_CONVERSION, + 0, 0, }; static struct krb_convert rconv_list[] = { @@ -56,43 +67,45 @@ static struct krb_convert rconv_list[] = { krb5_error_code krb5_425_conv_principal(name, instance, realm, princ) - const char *name; - const char *instance; - const char *realm; - krb5_principal *princ; + const char *name; + const char *instance; + const char *realm; + krb5_principal *princ; { - struct krb_convert *p; - char buf[256]; /* V4 instances are limited to 40 characters */ + struct krb_convert *p; + char buf[256]; /* V4 instances are limited to 40 characters */ - if (instance) { - if (instance[0] == '\0') { - instance = 0; - goto not_service; - } - p = sconv_list; - while (1) { - if (!p->v4_str) - goto not_service; - if (!strcmp(p->v4_str, name)) - break; - p++; - } - name = p->v5_str; - strcpy(buf, instance); - p = rconv_list; - while (1) { - if (!p->v4_str) - break; - if (!strcmp(p->v4_str, realm)) - break; - p++; - } - if (p->v5_str) - strcat(buf, p->v5_str); - instance = buf; + if (instance) { + if (instance[0] == '\0') { + instance = 0; + goto not_service; + } + p = sconv_list; + while (1) { + if (!p->v4_str) + goto not_service; + if (!strcmp(p->v4_str, name)) + break; + p++; + } + 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++; + } + if (p->v5_str) + strcat(buf, p->v5_str); + instance = buf; + } } -not_service: + not_service: return(krb5_build_principal(princ, strlen(realm), realm, name, instance, 0)); -} + } |
