+Wed Feb 19 14:21:12 1997 Theodore Y. Ts'o <tytso@mit.edu>
+
+ * t_kerb.c (test_set_realm): New function used to test
+ krb5_set_principal_realm(). Called by using the new "set_realm"
+ command to t_kerb.
+
+ * set_realm.c (krb5_set_principal_realm): New function which sets
+ the realm of a principal.
+
Thu Feb 13 14:17:00 1997 Richard Basch <basch@lehman.com>
* get_in_tkt.c (krb5_get_in_tkt): Initialize as_reply; if
ser_key.o \
ser_princ.o \
serialize.o \
+ set_realm.o \
srv_rcache.o \
str_conv.o \
tgtname.o \
ser_key.$(OBJEXT) \
ser_princ.$(OBJEXT) \
serialize.$(OBJEXT) \
+ set_realm.$(OBJEXT) \
srv_rcache.$(OBJEXT) \
str_conv.$(OBJEXT) \
tgtname.$(OBJEXT) \
$(srcdir)/ser_key.c \
$(srcdir)/ser_princ.c \
$(srcdir)/serialize.c \
+ $(srcdir)/set_realm.c \
$(srcdir)/srv_rcache.c \
$(srcdir)/str_conv.c \
$(srcdir)/tgtname.c \
T_WALK_RTREE_OBJS= t_walk_rtree.o walk_rtree.o tgtname.o unparse.o \
free_rtree.o bld_pr_ext.o
-T_KERB_OBJS= t_kerb.o conv_princ.o unparse.o
+T_KERB_OBJS= t_kerb.o conv_princ.o unparse.o set_realm.o
T_SER_OBJS= t_ser.o ser_actx.o ser_adata.o ser_addr.o ser_auth.o ser_cksum.o \
ser_ctx.o ser_eblk.o ser_key.o ser_princ.o serialize.o
425_conv_principal rcmd uunet UU.NET \
425_conv_principal zephyr zephyr ATHENA.MIT.EDU \
425_conv_principal kadmin ATHENA.MIT.EDU ATHENA.MIT.EDU \
+ set_realm marc@MIT.EDU CYGNUS.COM \
> test.out
cmp test.out $(srcdir)/t_ref_kerb.out
$(RM) test.out
krb5_free_principal(ctx, princ2);
}
+void test_set_realm(ctx, name, realm)
+ krb5_context ctx;
+ const char *name;
+ const char *realm;
+{
+ krb5_error_code retval;
+ krb5_principal princ = 0;
+ char *outname = 0;
+
+ retval = krb5_parse_name(ctx, name, &princ);
+ if (retval) {
+ com_err("krb5_parse_name", retval, 0);
+ goto fail;
+ }
+ retval = krb5_set_principal_realm(ctx, princ, realm);
+ if (retval) {
+ com_err("krb5_set_principal_realm", retval, 0);
+ goto fail;
+ }
+ retval = krb5_unparse_name(ctx, princ, &outname);
+ if (retval) {
+ com_err("krb5_unparse_name", retval, 0);
+ goto fail;
+ }
+ printf("old principal: %s, modified principal: %s\n", name,
+ outname);
+fail:
+ if (outname)
+ free(outname);
+ if (princ)
+ krb5_free_principal(ctx, princ);
+}
+
void usage(progname)
char *progname;
{
fprintf(stderr, "%s: Usage: %s 425_conv_principal <name> <inst> <realm\n",
progname, progname);
fprintf(stderr, "\t%s parse_name <name>\n", progname);
+ fprintf(stderr, "\t%s set_realm <name> <realm>\n", progname);
exit(1);
}
if (!argc) usage(progname);
name = *argv;
test_parse_name(ctx, name);
+ } else if (strcmp(*argv, "set_realm") == 0) {
+ argc--; argv++;
+ if (!argc) usage(progname);
+ name = *argv;
+ argc--; argv++;
+ if (!argc) usage(progname);
+ realm = *argv;
+ test_set_realm(ctx, name, realm);
}
else
usage(progname);
425_converted principal(rcmd, uunet, UU.NET): 'host/uunet.uu.net@UU.NET'
425_converted principal(zephyr, zephyr, ATHENA.MIT.EDU): 'zephyr/zephyr@ATHENA.MIT.EDU'
425_converted principal(kadmin, ATHENA.MIT.EDU, ATHENA.MIT.EDU): 'kadmin/ATHENA.MIT.EDU@ATHENA.MIT.EDU'
+old principal: marc@MIT.EDU, modified principal: marc@CYGNUS.COM