Use new getarg.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@2438 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -38,6 +38,19 @@
|
|||||||
|
|
||||||
#include "kuser_locl.h"
|
#include "kuser_locl.h"
|
||||||
RCSID("$Id$");
|
RCSID("$Id$");
|
||||||
|
#include <getarg.h>
|
||||||
|
|
||||||
|
int forwardable;
|
||||||
|
int preauth = 1;
|
||||||
|
int renewable;
|
||||||
|
int version_flag = 0;
|
||||||
|
|
||||||
|
struct getargs args[] = {
|
||||||
|
{ "forwardable", 'f', arg_flag, &forwardable, NULL },
|
||||||
|
{ "preauthentication", 'p', arg_negative_flag, &preauth, NULL },
|
||||||
|
{ "renewable", 'r', arg_flag, &renewable, NULL },
|
||||||
|
{ "version", 0, arg_flag, &version_flag, NULL }
|
||||||
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
usage (void)
|
usage (void)
|
||||||
@@ -57,31 +70,30 @@ main (int argc, char **argv)
|
|||||||
krb5_preauthtype pre_auth_types[] = {KRB5_PADATA_ENC_TIMESTAMP};
|
krb5_preauthtype pre_auth_types[] = {KRB5_PADATA_ENC_TIMESTAMP};
|
||||||
int c;
|
int c;
|
||||||
char *realm;
|
char *realm;
|
||||||
int preauth = 1;
|
|
||||||
|
|
||||||
union {
|
union {
|
||||||
krb5_flags i;
|
krb5_flags i;
|
||||||
KDCOptions f;
|
KDCOptions f;
|
||||||
}options;
|
}options;
|
||||||
|
int optind = 0;
|
||||||
|
|
||||||
set_progname (argv[0]);
|
set_progname (argv[0]);
|
||||||
memset(&cred, 0, sizeof(cred));
|
memset(&cred, 0, sizeof(cred));
|
||||||
options.i = 0;
|
options.i = 0;
|
||||||
while ((c = getopt (argc, argv, "frp")) != EOF) {
|
|
||||||
switch (c) {
|
while(getarg(args, sizeof(args) / sizeof(args[0]), argc, argv, &optind))
|
||||||
case 'f':
|
usage();
|
||||||
options.f.forwardable = 1;
|
|
||||||
break;
|
if(version_flag){
|
||||||
case 'p':
|
printf("%s (%s-%s)\n", __progname, PACKAGE, VERSION);
|
||||||
preauth = 0;
|
exit(0);
|
||||||
break;
|
}
|
||||||
case 'r':
|
|
||||||
options.f.renewable = 1;
|
options.f.forwardable = forwardable;
|
||||||
cred.times.renew_till = 1 << 30;
|
|
||||||
break;
|
if(renewable){
|
||||||
default:
|
options.f.renewable = 1;
|
||||||
usage ();
|
cred.times.renew_till = 1 << 30;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
argc -= optind;
|
argc -= optind;
|
||||||
argv += optind;
|
argv += optind;
|
||||||
|
Reference in New Issue
Block a user