cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: probs. building libcurl w/gssapi on win32

From: David Rosenstrauch <darose_at_darose.net>
Date: Wed, 21 May 2008 16:34:56 -0400

David Rosenstrauch wrote:
> Hey, well good news: I was finally able to get libcurl built with
> GSSAPI/SPNEGO support on Windows ... and the SPNEGO functionality seems
> to be working great too!
>
> I did have to tweak the code in a few spots to get it to compile,
> though. Will submit you a patch with my tweaks when I get a spare moment.
>
> Thanks again for your help earlier.
>
> DR

As promised, here's my patch of tweaks required for building libcurl
with SPNEGO support on Windows Visual C++. Although I initially did
this work for libcurl 7.15.4, which we're still using here at work, I
ported my fixes to the latest CVS for the patch I'm sending.

The Kerberos implementation I built against was MIT Kerberos For Windows
(KFW) v3.2.2. (I don't think it's possible to use Heimdal anyway, as I
don't think Heimdal can be built on Windows with Visual C++.) As you
can see, there's a bunch of tweaks required to get this to build with
the current MIT Kerberos. I guess the GSSAPI/SPNEGO code must have
fallen out of sync with MIT, due to lack of people building for it.

Any questions/issues, please let me know.

DR

diff -uarw -x '*.dsp' -x '*.vcproj' curl-7.18.2-CVS/lib/config-win32.h curl-7.18.2-CVS-work/lib/config-win32.h
--- curl-7.18.2-CVS/lib/config-win32.h 2008-05-20 11:38:48.000000000 -0400
+++ curl-7.18.2-CVS-work/lib/config-win32.h 2008-05-20 12:09:37.258864400 -0400
@@ -40,6 +40,9 @@
 
 /* Define if you have the <netinet/in.h> header file. */
 /* #define HAVE_NETINET_IN_H 1 */
+#ifdef HAVE_GSSMIT
+#define OVERRIDE_GSSMIT_NETINET_IN_H 1
+#endif
 
 /* Define if you have the <process.h> header file. */
 #ifndef __SALFORDC__
@@ -56,7 +59,9 @@
 /* #define HAVE_SSL_H 1 */
 
 /* Define if you have the <stdlib.h> header file. */
+#ifndef HAVE_GSSMIT
 #define HAVE_STDLIB_H 1
+#endif
 
 /* Define if you have the <sys/param.h> header file. */
 /* #define HAVE_SYS_PARAM_H 1 */
@@ -77,7 +82,9 @@
 /* #define HAVE_SYS_TIME_H 1 */
 
 /* Define if you have the <sys/types.h> header file. */
+#ifndef HAVE_GSSMIT
 #define HAVE_SYS_TYPES_H 1
+#endif
 
 /* Define if you have the <sys/utime.h> header file */
 #ifndef __BORLANDC__
@@ -188,7 +195,9 @@
 #define HAVE_STRICMP 1
 
 /* Define if you have the strdup function. */
+#ifndef HAVE_GSSMIT
 #define HAVE_STRDUP 1
+#endif
 
 /* Define if you have the strftime function. */
 #define HAVE_STRFTIME 1
@@ -213,7 +222,9 @@
 #endif
 
 /* Define if you have the getnameinfo function. */
+#ifndef HAVE_GSSMIT
 #define HAVE_GETNAMEINFO 1
+#endif
 
 /* Define to the type qualifier of arg 1 for getnameinfo. */
 #define GETNAMEINFO_QUAL_ARG1 const
@@ -288,6 +299,7 @@
 #define ssize_t int
 #endif
 #define _SSIZE_T_DEFINED
+#define SSIZE_T_DEFINED
 #endif
 
 /* ---------------------------------------------------------------- */
Only in curl-7.18.2-CVS-work/lib: curllib.ncb
Only in curl-7.18.2-CVS-work/lib: curllib.opt
Only in curl-7.18.2-CVS-work/lib: curllib.plg
Only in curl-7.18.2-CVS-work/lib: curllib.sln
Only in curl-7.18.2-CVS-work/lib: curllib.suo
Only in curl-7.18.2-CVS-work/lib: curllib.vcproj.orig
diff -uarw -x '*.dsp' -x '*.vcproj' curl-7.18.2-CVS/lib/file.c curl-7.18.2-CVS-work/lib/file.c
--- curl-7.18.2-CVS/lib/file.c 2008-05-20 11:38:48.000000000 -0400
+++ curl-7.18.2-CVS-work/lib/file.c 2008-05-20 12:05:38.106555600 -0400
@@ -90,7 +90,7 @@
 /* The last #include file should be: */
 #include "memdebug.h"
 
-#if defined(WIN32) || defined(MSDOS) || defined(__EMX__) || defined(__SYMBIAN32__)
+#if (defined(WIN32) || defined(MSDOS) || defined(__EMX__) || defined(__SYMBIAN32__)) && !defined(HAVE_GSSMIT)
 #define MSDOS_FILESYSTEM 1
 #endif
 
diff -uarw -x '*.dsp' -x '*.vcproj' curl-7.18.2-CVS/lib/http_negotiate.c curl-7.18.2-CVS-work/lib/http_negotiate.c
--- curl-7.18.2-CVS/lib/http_negotiate.c 2008-05-20 11:38:48.000000000 -0400
+++ curl-7.18.2-CVS-work/lib/http_negotiate.c 2008-05-20 12:19:29.040963600 -0400
@@ -27,6 +27,11 @@
 #define GSS_C_NT_HOSTBASED_SERVICE gss_nt_service_name
 #endif
 
+#ifdef HAVE_SPNEGO
+#include <spnegohelp.h>
+#include <openssl/objects.h>
+#endif
+
 #ifndef CURL_DISABLE_HTTP
  /* -- WIN32 approved -- */
 #include <stdio.h>
diff -uarw -x '*.dsp' -x '*.vcproj' curl-7.18.2-CVS/lib/krb5.c curl-7.18.2-CVS-work/lib/krb5.c
--- curl-7.18.2-CVS/lib/krb5.c 2008-05-20 11:38:48.000000000 -0400
+++ curl-7.18.2-CVS-work/lib/krb5.c 2008-05-20 12:14:57.513370000 -0400
@@ -50,11 +50,17 @@
 #include <gssapi/gssapi.h>
 #include <gssapi/gssapi_generic.h>
 #include <gssapi/gssapi_krb5.h>
+#ifdef OVERRIDE_GSSMIT_NETINET_IN_H
+#undef HAVE_NETINET_IN_H
+#endif
 #else
 /* Heimdal-style */
 #include <gssapi.h>
 #endif
 
+#define _MPRINTF_REPLACE /* without this on windows OS we get undefined reference to snprintf */
+#include <curl/mprintf.h>
+
 #include "urldata.h"
 #include "base64.h"
 #include "ftp.h"
diff -uarw -x '*.dsp' -x '*.vcproj' curl-7.18.2-CVS/lib/security.c curl-7.18.2-CVS-work/lib/security.c
--- curl-7.18.2-CVS/lib/security.c 2008-05-20 11:38:48.000000000 -0400
+++ curl-7.18.2-CVS-work/lib/security.c 2008-05-20 12:07:11.484186000 -0400
@@ -51,7 +51,10 @@
 
 #include <stdlib.h>
 #include <string.h>
+
+#ifdef HAVE_NETDB_H
 #include <netdb.h>
+#endif
 
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
Received on 2008-05-21