cURL / Mailing Lists / curl-users / Single Mail

curl-users

[PATCH] Support for GNU GSS

From: Simon Josefsson <jas_at_extundo.com>
Date: Fri, 26 Aug 2005 13:40:31 +0200

Hello.

The patch below make curl use GNU GSS [1] if it is installed. In
fact, if GNU GSS is installed, it will be preferred over MIT/Heimdal,
but I reckon this is preferable; I doubt anyone that doesn't want GNU
GSS has it installed. The same problem exists now with MIT vs
Heimdal; if both MIT and Heimdal are installed, you get Heimdal.

I have not tested this, since I don't have a HTTP+GSS server.
However, any problems are likely to be in my library, and not in curl,
so with this, people can test the combination.

[1] http://josefsson.org/gss/

Thanks,
Simon

Index: configure.ac
===================================================================
RCS file: /cvsroot/curl/curl/configure.ac,v
retrieving revision 1.158
diff -u -p -r1.158 configure.ac
--- configure.ac 21 Aug 2005 21:15:07 -0000 1.158
+++ configure.ac 26 Aug 2005 11:33:10 -0000
@@ -687,7 +687,7 @@ AC_ARG_WITH(gssapi-includes,
 AC_ARG_WITH(gssapi-libs,
   AC_HELP_STRING([--with-gssapi-libs=DIR],
                    [Specify location of GSSAPI libs]),
- [ GSSAPI_LIBS="-L$withval -lgssapi"
+ [ GSSAPI_LIBS="-L$withval"
     want_gss="yes" ]
 )
 
@@ -702,6 +702,8 @@ AC_ARG_WITH(gssapi,
 
 AC_MSG_CHECKING([if GSSAPI support is requested])
 if test x"$want_gss" = xyes; then
+ AC_MSG_RESULT(yes)
+
   if test -z "$GSSAPI_INCS"; then
      if test -f "$GSSAPI_ROOT/bin/krb5-config"; then
         GSSAPI_INCS=`$GSSAPI_ROOT/bin/krb5-config --cflags gssapi`
@@ -709,9 +711,51 @@ if test x"$want_gss" = xyes; then
         GSSAPI_INCS="-I$GSSAPI_ROOT/include"
      fi
   fi
+ save_CPPFLAGS="$CPPFLAGS"
   CPPFLAGS="$CPPFLAGS $GSSAPI_INCS"
-
- if test -z "$GSSAPI_LIB_DIR"; then
+
+ AC_CHECK_HEADER(gss.h,
+ [
+ dnl found in the given dirs
+ AC_DEFINE(HAVE_GSSGNU, 1, [if you have the GNU gssapi libraries])
+ gnu_gss=yes
+ ],
+ [
+ dnl not found, check Heimdal
+ AC_CHECK_HEADER(gssapi.h,
+ [
+ dnl found in the given dirs
+ AC_DEFINE(HAVE_GSSHEIMDAL, 1, [if you have the Heimdal gssapi libraries])
+ ],
+ [
+ dnl not found, check in gssapi/ subdir
+ AC_CHECK_HEADER(gssapi/gssapi.h,
+ [
+ dnl found
+ AC_DEFINE(HAVE_GSSMIT, 1, [if you have the MIT gssapi libraries])
+ ],
+ [
+ dnl no header found, disabling GSS
+ want_gss=no
+ AC_MSG_WARN(disabling GSSAPI since no header files was found)
+ ]
+ )
+ ]
+ )
+ ]
+ )
+else
+ AC_MSG_RESULT(no)
+fi
+if test x"$want_gss" = xyes; then
+ AC_DEFINE(HAVE_GSSAPI, 1, [if you have the gssapi libraries])
+
+ curl_gss_msg="enabled (MIT/Heimdal)"
+
+ if test -n "$gnu_gss"; then
+ curl_gss_msg="enabled (GNU GSS)"
+ LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR -lgss"
+ elif test -z "$GSSAPI_LIB_DIR"; then
      if test -f "$GSSAPI_ROOT/bin/krb5-config"; then
         gss_ldflags=`$GSSAPI_ROOT/bin/krb5-config --libs gssapi`
         LDFLAGS="$LDFLAGS $gss_ldflags"
@@ -721,31 +765,10 @@ if test x"$want_gss" = xyes; then
         LDFLAGS="$LDFLAGS -lgssapi"
      fi
   else
- LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR"
+ LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR -lgssapi"
   fi
-
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_GSSAPI, 1, [if you have the gssapi libraries])
-
- curl_gss_msg="enabled"
-
- AC_CHECK_HEADER(gssapi.h,
- [
- dnl found in the given dirs
- AC_DEFINE(HAVE_GSSHEIMDAL, 1, [if you have the Heimdal gssapi libraries])
- ],
- [
- dnl not found, check in gssapi/ subdir
- AC_CHECK_HEADER(gssapi/gssapi.h,
- dnl found
- AC_DEFINE(HAVE_GSSMIT, 1, [if you have the MIT gssapi libraries])
- )
-
- ]
- )
-
 else
- AC_MSG_RESULT(no)
+ CPPFLAGS="$save_CPPFLAGS"
 fi
   
 dnl **********************************************************************
Index: lib/urldata.h
===================================================================
RCS file: /cvsroot/curl/curl/lib/urldata.h,v
retrieving revision 1.269
diff -u -p -r1.269 urldata.h
--- lib/urldata.h 24 Aug 2005 10:57:29 -0000 1.269
+++ lib/urldata.h 26 Aug 2005 11:33:10 -0000
@@ -98,12 +98,14 @@
 #include "hash.h"
 
 #ifdef HAVE_GSSAPI
-#ifdef HAVE_GSSMIT
-#include <gssapi/gssapi.h>
-#include <gssapi/gssapi_generic.h>
-#else
-#include <gssapi.h>
-#endif
+# ifdef HAVE_GSSGNU
+# include <gss.h>
+# elif defined HAVE_GSSMIT
+# include <gssapi/gssapi.h>
+# include <gssapi/gssapi_generic.h>
+# else
+# include <gssapi.h>
+# endif
 #endif
 
 /* Download buffer size, keep it fairly big for speed reasons */
Received on 2005-08-29