Makefile.in: Link wsock32.lib (win32)
authorRichard Basch <probe@mit.edu>
Thu, 13 Feb 1997 20:39:42 +0000 (20:39 +0000)
committerRichard Basch <probe@mit.edu>
Thu, 13 Feb 1997 20:39:42 +0000 (20:39 +0000)
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
src/clients/kinit/Makefile.in
src/clients/kinit/kinit.c

index 6e73a858301b5c051e0d3250be387a53fe040ea0..e2d0abc1be46b6279b81354e01f1906debc90531 100644 (file)
@@ -1,6 +1,11 @@
 Thu Feb 13 14:27:41 1997  Richard Basch  <basch@lehman.com>
 
-       * 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  <basch@lehman.com>
 
index 2a5c84afcca3234ca868695fb8116f29a12690e3..14f8be84aed5bfffbcbc8c98602b31bfb909fc8d 100644 (file)
@@ -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::
index 0cf45da382abb3c7f79e9dbe7a6e3cd0b7c9d54e..fe4ae3266d8ca2d74acc1462befaeea54ad1b03b 100644 (file)
@@ -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;