diff options
| author | Theodore Tso <tytso@mit.edu> | 1992-08-18 23:18:19 +0000 |
|---|---|---|
| committer | Theodore Tso <tytso@mit.edu> | 1992-08-18 23:18:19 +0000 |
| commit | a7d52d373e6a114f791939e982d928059503e735 (patch) | |
| tree | b46068823b3793df9239c366cee6f3f71f7729ab /src/lib | |
| parent | 96ba0e578537639fe1d3cc97aef440b792cd272b (diff) | |
Initial revision
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@2327 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/krb5/krb/conv_princ.c | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/src/lib/krb5/krb/conv_princ.c b/src/lib/krb5/krb/conv_princ.c new file mode 100644 index 000000000..340ec4894 --- /dev/null +++ b/src/lib/krb5/krb/conv_princ.c @@ -0,0 +1,98 @@ +/* + * $Source$ + * $Author$ + * + * Copyright 1992 by the Massachusetts Institute of Technology. + * All Rights Reserved. + * + * Export of this software from the United States of America is assumed + * to require a specific license from the United States Government. + * It is the responsibility of any person or organization contemplating + * export to obtain such a license before exporting. + * + * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and + * distribute this software and its documentation for any purpose and + * without fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright notice and + * this permission notice appear in supporting documentation, and that + * the name of M.I.T. not be used in advertising or publicity pertaining + * to distribution of the software without specific, written prior + * permission. M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" without express + * or implied warranty. + * + * + * Build a principal from a V4 specification + * + * NOTE: This is highly site specific, and is only really necessary + * for sites who need to convert from V4 to V5. It is used by both + * the KDC and the kdb5_convert program. Since its use is highly + * specialized, the necesary information is just going to be + * hard-coded in this file. + */ + +#include <krb5/krb5.h> + +struct krb_convert { + char *v4_str; + char *v5_str; +}; + +static struct krb_convert sconv_list[] = { + "rcmd", "host", + "discuss", "discuss", + "rvdsrv", "rvdsrv", + "olc", "olc", + "pop", "pop", + "sis", "sis", + "rfs", "rfs", + 0, 0, +}; + +static struct krb_convert rconv_list[] = { + "ATHENA.MIT.EDU", ".mit.edu", + 0, 0 +}; + +krb5_error_code +krb5_425_conv_principal(name, instance, realm, 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 */ + + 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; + } + +not_service: + return(krb5_build_principal(princ, strlen(realm), realm, name, + instance, 0)); +} |
