From: Geoffrey King Date: Fri, 17 Jul 1998 08:18:37 +0000 (+0000) Subject: * krb524d.c (main): Accept a -r command line option to specify X-Git-Tag: krb5-1.1-beta1~644 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=3cbe348badd4ef95deabb5aa0a4975135aaf963d;p=krb5.git * krb524d.c (main): Accept a -r command line option to specify a realm other than the default one. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@10651 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/krb524/ChangeLog b/src/krb524/ChangeLog index ef7375c56..4bb96657f 100644 --- a/src/krb524/ChangeLog +++ b/src/krb524/ChangeLog @@ -1,3 +1,8 @@ +Fri Jul 17 04:11:47 1998 Geoffrey King + + * krb524d.c (main): Accept a -r command line option to specify + a realm other than the default one. + Wed Jun 17 16:35:37 1998 Tom Yu * cnv_tkt_skey.c (krb524_convert_tkt_skey): Handle null address diff --git a/src/krb524/krb524d.c b/src/krb524/krb524d.c index f03651605..ae77e55c8 100644 --- a/src/krb524/krb524d.c +++ b/src/krb524/krb524d.c @@ -47,7 +47,7 @@ int signalled = 0; static int debug = 0; void *handle; -int use_keytab, use_master; +int use_keytab, use_master, use_other_realm; char *keytab = NULL; krb5_keytab kt; @@ -57,7 +57,7 @@ krb5_error_code do_connection(), lookup_service_key(), kdc_get_server_key(); void usage(context) krb5_context context; { - fprintf(stderr, "Usage: %s [-m[aster]] [-k[eytab]]\n", whoami); + fprintf(stderr, "Usage: %s [-k[eytab]] [-m[aster] [-r realm]]\n", whoami); cleanup_and_exit(1, context); } @@ -90,6 +90,7 @@ int main(argc, argv) fd_set rfds; krb5_context context; krb5_error_code retval; + kadm5_config_params config_params; retval = krb5_init_context(&context); if (retval) { @@ -100,19 +101,30 @@ int main(argc, argv) whoami = ((whoami = strrchr(argv[0], '/')) ? whoami + 1 : argv[0]); argv++; argc--; - use_master = use_keytab = 0; + use_master = use_keytab = use_other_realm = 0; + config_params.mask = 0; + while (argc) { if (strncmp(*argv, "-k", 2) == 0) use_keytab = 1; else if (strncmp(*argv, "-m", 2) == 0) use_master = 1; + else if (strcmp(*argv, "-r") == 0) { + use_other_realm = 1; + argv++; argc--; + if (argc == 0 || !use_master) + usage(context); + config_params.mask |= KADM5_CONFIG_REALM; + config_params.realm = *argv; + } else break; argv++; argc--; } if (argc || use_keytab + use_master > 1 || + use_keytab + use_other_realm > 1 || use_keytab + use_master == 0) { - use_keytab = use_master = 0; + use_keytab = use_master = use_other_realm = 0; usage(context); } @@ -123,8 +135,7 @@ int main(argc, argv) if (use_keytab) init_keytab(context); if (use_master) - /* someday maybe there will be some config param options */ - init_master(context, NULL); + init_master(context, &config_params); memset((char *) &saddr, 0, sizeof(struct sockaddr_in)); saddr.sin_family = AF_INET;