From c2708f0443f260b9c8b34ec335371f253137e857 Mon Sep 17 00:00:00 2001
From: Daniel Stenberg <daniel@haxx.se>
Date: Wed, 13 Jul 2011 22:54:54 +0200
Subject: [PATCH] gssapi: rename our files to avoid conflicts

gssapi.h is used as a header name by Heimdal-style GSSAPI so it would
conflict with a private header using that name, and while renaming the
header I figured we should name the .c file accordingly as well.

Bug: http://curl.haxx.se/mail/lib-2011-07/0071.html
Reported by: Ben Greear
cherry-picked from commit 44b58472378097faf9632d0dd9b4e478fb3433ed
---
 lib/Makefile.inc     |    4 ++--
 lib/curl_gssapi.c    |   48 ++++++++++++++++++++++++++++++++++++++++++++++++
 lib/curl_gssapi.h    |   47 +++++++++++++++++++++++++++++++++++++++++++++++
 lib/gssapi.c         |   48 ------------------------------------------------
 lib/gssapi.h         |   47 -----------------------------------------------
 lib/http_negotiate.c |    2 +-
 lib/krb5.c           |    2 +-
 lib/socks_gssapi.c   |    2 +-
 8 files changed, 100 insertions(+), 100 deletions(-)
 create mode 100644 lib/curl_gssapi.c
 create mode 100644 lib/curl_gssapi.h
 delete mode 100644 lib/gssapi.c
 delete mode 100644 lib/gssapi.h

diff --git a/lib/Makefile.inc b/lib/Makefile.inc
index 343095e..215be1d 100644
--- a/lib/Makefile.inc
+++ b/lib/Makefile.inc
@@ -11,7 +11,7 @@ CSOURCES = file.c timeval.c base64.c hostip.c progress.c formdata.c	\
   inet_ntop.c parsedate.c select.c gtls.c sslgen.c tftp.c splay.c	\
   strdup.c socks.c ssh.c nss.c qssl.c rawstr.c curl_addrinfo.c          \
   socks_gssapi.c socks_sspi.c curl_sspi.c slist.c nonblock.c		\
-  curl_memrchr.c gssapi.c
+  curl_memrchr.c curl_gssapi.c
 
 HHEADERS = arpa_telnet.h netrc.h file.h timeval.h qssl.h hostip.h	\
   progress.h formdata.h cookie.h http.h sendf.h ftp.h url.h dict.h	\
@@ -23,5 +23,5 @@ HHEADERS = arpa_telnet.h netrc.h file.h timeval.h qssl.h hostip.h	\
   transfer.h select.h easyif.h multiif.h parsedate.h sslgen.h gtls.h	\
   tftp.h sockaddr.h splay.h strdup.h setup_once.h socks.h ssh.h nssg.h	\
   curl_base64.h rawstr.h curl_addrinfo.h curl_sspi.h slist.h nonblock.h	\
-  curl_memrchr.h gssapi.h
+  curl_memrchr.h curl_gssapi.h
 
diff --git a/lib/curl_gssapi.c b/lib/curl_gssapi.c
new file mode 100644
index 0000000..69c3c88
--- /dev/null
+++ b/lib/curl_gssapi.c
@@ -0,0 +1,48 @@
+/***************************************************************************
+ *                                  _   _ ____  _
+ *  Project                     ___| | | |  _ \| |
+ *                             / __| | | | |_) | |
+ *                            | (__| |_| |  _ <| |___
+ *                             \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
+
+#include "curl_gssapi.h"
+
+OM_uint32 Curl_gss_init_sec_context(
+    OM_uint32 * minor_status,
+    gss_ctx_id_t * context,
+    gss_name_t target_name,
+    gss_channel_bindings_t input_chan_bindings,
+    gss_buffer_t input_token,
+    gss_buffer_t output_token,
+    OM_uint32 * ret_flags)
+{
+  return gss_init_sec_context(minor_status,
+                              GSS_C_NO_CREDENTIAL, /* cred_handle */
+                              context,
+                              target_name,
+                              GSS_C_NO_OID, /* mech_type */
+                              /* req_flags */
+                              GSS_C_MUTUAL_FLAG | GSS_C_REPLAY_FLAG,
+                              0, /* time_req */
+                              input_chan_bindings,
+                              input_token,
+                              NULL, /* actual_mech_type */
+                              output_token,
+                              ret_flags,
+                              NULL /* time_rec */);
+}
diff --git a/lib/curl_gssapi.h b/lib/curl_gssapi.h
new file mode 100644
index 0000000..c5b58db
--- /dev/null
+++ b/lib/curl_gssapi.h
@@ -0,0 +1,47 @@
+/***************************************************************************
+ *                                  _   _ ____  _
+ *  Project                     ___| | | |  _ \| |
+ *                             / __| | | | |_) | |
+ *                            | (__| |_| |  _ <| |___
+ *                             \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
+
+#include "setup.h"
+
+#ifdef HAVE_GSSGNU
+#  include <gss.h>
+#elif defined HAVE_GSSMIT
+   /* MIT style */
+#  include <gssapi/gssapi.h>
+#  include <gssapi/gssapi_generic.h>
+#  include <gssapi/gssapi_krb5.h>
+#else
+   /* Heimdal-style */
+#  include <gssapi.h>
+#endif
+
+
+/* Common method for using gss api */
+
+OM_uint32 Curl_gss_init_sec_context(
+    OM_uint32 * minor_status,
+    gss_ctx_id_t * context,
+    gss_name_t target_name,
+    gss_channel_bindings_t input_chan_bindings,
+    gss_buffer_t input_token,
+    gss_buffer_t output_token,
+    OM_uint32 * ret_flags);
diff --git a/lib/gssapi.c b/lib/gssapi.c
deleted file mode 100644
index 8911f5f..0000000
--- a/lib/gssapi.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/***************************************************************************
- *                                  _   _ ____  _
- *  Project                     ___| | | |  _ \| |
- *                             / __| | | | |_) | |
- *                            | (__| |_| |  _ <| |___
- *                             \___|\___/|_| \_\_____|
- *
- * Copyright (C) 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
- *
- * This software is licensed as described in the file COPYING, which
- * you should have received as part of this distribution. The terms
- * are also available at http://curl.haxx.se/docs/copyright.html.
- *
- * You may opt to use, copy, modify, merge, publish, distribute and/or sell
- * copies of the Software, and permit persons to whom the Software is
- * furnished to do so, under the terms of the COPYING file.
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- * KIND, either express or implied.
- *
- ***************************************************************************/
-
-#include "gssapi.h"
-
-OM_uint32 Curl_gss_init_sec_context(
-    OM_uint32 * minor_status,
-    gss_ctx_id_t * context,
-    gss_name_t target_name,
-    gss_channel_bindings_t input_chan_bindings,
-    gss_buffer_t input_token,
-    gss_buffer_t output_token,
-    OM_uint32 * ret_flags)
-{
-  return gss_init_sec_context(minor_status,
-                              GSS_C_NO_CREDENTIAL, /* cred_handle */
-                              context,
-                              target_name,
-                              GSS_C_NO_OID, /* mech_type */
-                              /* req_flags */
-                              GSS_C_MUTUAL_FLAG | GSS_C_REPLAY_FLAG,
-                              0, /* time_req */
-                              input_chan_bindings,
-                              input_token,
-                              NULL, /* actual_mech_type */
-                              output_token,
-                              ret_flags,
-                              NULL /* time_rec */);
-}
diff --git a/lib/gssapi.h b/lib/gssapi.h
deleted file mode 100644
index c5b58db..0000000
--- a/lib/gssapi.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/***************************************************************************
- *                                  _   _ ____  _
- *  Project                     ___| | | |  _ \| |
- *                             / __| | | | |_) | |
- *                            | (__| |_| |  _ <| |___
- *                             \___|\___/|_| \_\_____|
- *
- * Copyright (C) 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
- *
- * This software is licensed as described in the file COPYING, which
- * you should have received as part of this distribution. The terms
- * are also available at http://curl.haxx.se/docs/copyright.html.
- *
- * You may opt to use, copy, modify, merge, publish, distribute and/or sell
- * copies of the Software, and permit persons to whom the Software is
- * furnished to do so, under the terms of the COPYING file.
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- * KIND, either express or implied.
- *
- ***************************************************************************/
-
-#include "setup.h"
-
-#ifdef HAVE_GSSGNU
-#  include <gss.h>
-#elif defined HAVE_GSSMIT
-   /* MIT style */
-#  include <gssapi/gssapi.h>
-#  include <gssapi/gssapi_generic.h>
-#  include <gssapi/gssapi_krb5.h>
-#else
-   /* Heimdal-style */
-#  include <gssapi.h>
-#endif
-
-
-/* Common method for using gss api */
-
-OM_uint32 Curl_gss_init_sec_context(
-    OM_uint32 * minor_status,
-    gss_ctx_id_t * context,
-    gss_name_t target_name,
-    gss_channel_bindings_t input_chan_bindings,
-    gss_buffer_t input_token,
-    gss_buffer_t output_token,
-    OM_uint32 * ret_flags);
diff --git a/lib/http_negotiate.c b/lib/http_negotiate.c
index 36baec4..28152b1 100644
--- a/lib/http_negotiate.c
+++ b/lib/http_negotiate.c
@@ -37,7 +37,7 @@
 
 #include "urldata.h"
 #include "sendf.h"
-#include "gssapi.h"
+#include "curl_gssapi.h"
 #include "rawstr.h"
 #include "curl_base64.h"
 #include "http_negotiate.h"
diff --git a/lib/krb5.c b/lib/krb5.c
index 7d4804d..68fd9e3 100644
--- a/lib/krb5.c
+++ b/lib/krb5.c
@@ -50,7 +50,7 @@
 #include "urldata.h"
 #include "curl_base64.h"
 #include "ftp.h"
-#include "gssapi.h"
+#include "curl_gssapi.h"
 #include "sendf.h"
 #include "krb4.h"
 #include "curl_memory.h"
diff --git a/lib/socks_gssapi.c b/lib/socks_gssapi.c
index 802df35..e2c88ed 100644
--- a/lib/socks_gssapi.c
+++ b/lib/socks_gssapi.c
@@ -38,7 +38,7 @@
 #include <stdlib.h>
 #endif
 
-#include "gssapi.h"
+#include "curl_gssapi.h"
 #include "urldata.h"
 #include "sendf.h"
 #include "connect.h"
-- 
1.7.6.1

