*/
#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[] = {
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));
-}
+ }