diff options
| author | Jeffrey Altman <jaltman@secure-endpoints.com> | 2004-09-02 00:42:50 +0000 |
|---|---|---|
| committer | Jeffrey Altman <jaltman@secure-endpoints.com> | 2004-09-02 00:42:50 +0000 |
| commit | bb55b1f4e530efc5af24d79ca9705e8d7549676f (patch) | |
| tree | d55f9c50b47955bc394f9c3996e6c0c3ee4bf884 /src/windows/ms2mit/ms2mit.c | |
| parent | 610a42ad49d9873172cb98004d3f54e169b0a1d3 (diff) | |
| download | krb5-bb55b1f4e530efc5af24d79ca9705e8d7549676f.tar.gz krb5-bb55b1f4e530efc5af24d79ca9705e8d7549676f.tar.xz krb5-bb55b1f4e530efc5af24d79ca9705e8d7549676f.zip | |
* ms2mit.c: add -c ccache command line option
* mit2ms.c: new command. Copies contents of the mit ccache
to the MSLSA: ccache
ticket: new
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16713 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/windows/ms2mit/ms2mit.c')
| -rw-r--r-- | src/windows/ms2mit/ms2mit.c | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/src/windows/ms2mit/ms2mit.c b/src/windows/ms2mit/ms2mit.c index eba52e793..3a7f7d5a2 100644 --- a/src/windows/ms2mit/ms2mit.c +++ b/src/windows/ms2mit/ms2mit.c @@ -29,6 +29,19 @@ #include "krb5.h" #include <stdio.h> +#include <string.h> + +extern int optind; +extern char *optarg; + +static char *prog; + +static void +xusage(void) +{ + fprintf(stderr, "xusage: %s [-c ccache]\n", prog); + exit(1); +} void main( @@ -44,7 +57,24 @@ main( krb5_creds creds; krb5_principal princ; int initial_ticket = 0; + int option; + char * ccachestr = 0; + prog = strrchr(argv[0], '/'); + prog = prog ? (prog + 1) : argv[0]; + + while ((option = getopt(argc, argv, "c:h")) != -1) { + switch (option) { + case 'c': + ccachestr = optarg; + break; + case 'h': + default: + xusage(); + break; + } + } + if (code = krb5_init_context(&kcontext)) { com_err(argv[0], code, "while initializing kerberos library"); exit(1); @@ -90,7 +120,11 @@ main( exit(1); } - if (code = krb5_cc_default(kcontext, &ccache)) { + if (ccachestr) + code = krb5_cc_resolve(kcontext, ccachestr, &ccache); + else + code = krb5_cc_default(kcontext, &ccache); + if (code) { com_err(argv[0], code, "while getting default ccache"); krb5_free_principal(kcontext, princ); krb5_cc_close(kcontext, mslsa_ccache); |
