From c349bccd43e0fad8b63d795ec45c0c3c918abb8b Mon Sep 17 00:00:00 2001 From: Richard Basch Date: Thu, 13 Feb 1997 20:39:42 +0000 Subject: [PATCH] Makefile.in: Link wsock32.lib (win32) kinit.c: Initialize winsock library (win32) Removed unused variables; declared internal routines as static. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@9862 dc483132-0cff-0310-8789-dd5450dbe970 --- src/clients/kinit/ChangeLog | 7 +++++- src/clients/kinit/Makefile.in | 2 +- src/clients/kinit/kinit.c | 45 +++++++++++++++++++++++++++++------ 3 files changed, 45 insertions(+), 9 deletions(-) diff --git a/src/clients/kinit/ChangeLog b/src/clients/kinit/ChangeLog index 6e73a8583..e2d0abc1b 100644 --- a/src/clients/kinit/ChangeLog +++ b/src/clients/kinit/ChangeLog @@ -1,6 +1,11 @@ Thu Feb 13 14:27:41 1997 Richard Basch - * kinit.c: Added krb5_read_password implementation for win32 console. + * Makefile.in: + Link wsock32 library (win32) + + * kinit.c: + Added krb5_read_password implementation for win32 console. + Initialize Winsock library (win32) Sat Feb 8 15:37:39 1997 Richard Basch diff --git a/src/clients/kinit/Makefile.in b/src/clients/kinit/Makefile.in index 2a5c84afc..14f8be84a 100644 --- a/src/clients/kinit/Makefile.in +++ b/src/clients/kinit/Makefile.in @@ -18,7 +18,7 @@ kinit: kinit.o $(KRB5_BASE_DEPLIBS) ##WIN32##all-windows:: kinit.exe ##WIN32##kinit.exe: kinit.obj ##WIN32## link /nologo /out:$@ $*.obj \ -##WIN32## $(BUILDTOP)\util\windows\getopt.obj $(KLIB) +##WIN32## $(BUILDTOP)\util\windows\getopt.obj $(KLIB) wsock32.lib clean-unix:: diff --git a/src/clients/kinit/kinit.c b/src/clients/kinit/kinit.c index 0cf45da38..fe4ae3266 100644 --- a/src/clients/kinit/kinit.c +++ b/src/clients/kinit/kinit.c @@ -45,6 +45,17 @@ krb5_data tgtname = { KRB5_TGS_NAME }; +/* Internal prototypes */ +static krb5_error_code krb5_validate_tgt + KRB5_PROTOTYPE((krb5_context, krb5_ccache, + krb5_principal, krb5_data *)); +static krb5_error_code krb5_renew_tgt + KRB5_PROTOTYPE((krb5_context, krb5_ccache, + krb5_principal, krb5_data *)); +static krb5_error_code krb5_tgt_gen + KRB5_PROTOTYPE((krb5_context, krb5_ccache, + krb5_principal, krb5_data *, int opt)); + /* * Try no preauthentication first; then try the encrypted timestamp */ @@ -80,6 +91,26 @@ main(argc, argv) int pwsize; char password[255], *client_name, prompt[255]; +#ifdef _WIN32 + { + WORD version = 0x0101; + WSADATA wsadata; + int rc; + + rc = WSAStartup(version, &wsadata); + if (rc) { + fprintf(stderr, "%s: Couldn't initialize Winsock library\n", + argv[0]); + exit(1); + } + if (version != wsadata.wVersion) { + fprintf(stderr, "%s: Winsock version 1.1 not available\n", + argv[0]); + exit(1); + } + } +#endif + code = krb5_init_context(&kcontext); if (code) { com_err(argv[0], code, "while initializing krb5"); @@ -370,6 +401,10 @@ main(argc, argv) krb5_free_context(kcontext); +#ifdef _WIN32 + WSACleanup(); +#endif + exit(0); } @@ -377,7 +412,7 @@ main(argc, argv) #define RENEW 1 /* stripped down version of krb5_mk_req */ -krb5_error_code krb5_validate_tgt(context, ccache, server, outbuf) +static krb5_error_code krb5_validate_tgt(context, ccache, server, outbuf) krb5_context context; krb5_ccache ccache; krb5_principal server; /* tgtname */ @@ -387,7 +422,7 @@ krb5_error_code krb5_validate_tgt(context, ccache, server, outbuf) } /* stripped down version of krb5_mk_req */ -krb5_error_code krb5_renew_tgt(context, ccache, server, outbuf) +static krb5_error_code krb5_renew_tgt(context, ccache, server, outbuf) krb5_context context; krb5_ccache ccache; krb5_principal server; /* tgtname */ @@ -398,17 +433,13 @@ krb5_error_code krb5_renew_tgt(context, ccache, server, outbuf) /* stripped down version of krb5_mk_req */ -krb5_error_code krb5_tgt_gen(context, ccache, server, outbuf, opt) +static krb5_error_code krb5_tgt_gen(context, ccache, server, outbuf, opt) krb5_context context; krb5_ccache ccache; krb5_principal server; /* tgtname */ krb5_data *outbuf; int opt; { - krb5_auth_context * auth_context = 0; - const krb5_flags ap_req_options; - krb5_data * in_data; - krb5_error_code retval; krb5_creds * credsp; krb5_creds creds; -- 2.26.2