aboutsummaryrefslogtreecommitdiff
path: root/client/wallet.c
diff options
context:
space:
mode:
authorRuss Allbery <rra@stanford.edu>2008-01-19 01:20:38 +0000
committerRuss Allbery <rra@stanford.edu>2008-01-19 01:20:38 +0000
commitcf71c7dac06561b14c8be3383fdb2ca4f3a318d9 (patch)
treed6b05a005c67710a6d2831abba193923f2070f93 /client/wallet.c
parentb4f2b5bf10e32777b1fcfa8417aa190755247815 (diff)
The wallet client now supports a -u option, saying to obtain Kerberos
credentials for the given user and use those for authentication rather than using an existing ticket cache.
Diffstat (limited to 'client/wallet.c')
-rw-r--r--client/wallet.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/client/wallet.c b/client/wallet.c
index 9dc97c2..8ce7ae0 100644
--- a/client/wallet.c
+++ b/client/wallet.c
@@ -26,6 +26,7 @@ struct options {
char *type;
char *server;
char *principal;
+ char *user;
int port;
};
@@ -114,6 +115,7 @@ set_defaults(krb5_context ctx, struct options *options)
default_string(ctx, "wallet_server", WALLET_SERVER, &options->server);
default_string(ctx, "wallet_principal", NULL, &options->principal);
default_number(ctx, "wallet_port", WALLET_PORT, &options->port);
+ options->user = NULL;
}
@@ -144,7 +146,7 @@ main(int argc, char *argv[])
die_krb5(ctx, retval, "cannot initialize Kerberos");
set_defaults(ctx, &options);
- while ((option = getopt(argc, argv, "c:f:k:hp:S:s:v")) != EOF) {
+ while ((option = getopt(argc, argv, "c:f:k:hp:S:s:u:v")) != EOF) {
switch (option) {
case 'c':
options.type = optarg;
@@ -171,6 +173,9 @@ main(int argc, char *argv[])
case 's':
options.server = optarg;
break;
+ case 'u':
+ options.user = optarg;
+ break;
case 'v':
printf("%s\n", PACKAGE_STRING);
exit(0);
@@ -200,6 +205,10 @@ main(int argc, char *argv[])
if (options.server == NULL)
die("no server specified in krb5.conf or with -s");
+ /* If a user was specified, obtain Kerberos tickets. */
+ if (options.user != NULL)
+ kinit(ctx, options.user);
+
/* Open a remctl connection. */
r = remctl_new();
if (r == NULL)