On Wed, 23 Jul 2014, Patrick Monnerat wrote:

No, they are used through SPNEGO_MECHANISM and KRB5_MECHANISM defines
in krb5.c, http_negotiate.c and socks_gssapi.c...

Fixed. Export for private use only.

Yeah, but I would also prefer the unnecessary defines to go away. Like in this patch.

--

 / daniel.haxx.se
From 8fd4f8e4bc1dc140d8c6a788334cc233ede0a890 Mon Sep 17 00:00:00 2001
From: Daniel Stenberg <[email protected]>
Date: Wed, 23 Jul 2014 17:56:42 +0200
Subject: [PATCH] gssapi: use private name space for private globals

... and avoid extra macros
---
 lib/curl_gssapi.c    |  4 ++--
 lib/curl_gssapi.h    | 12 +++---------
 lib/http_negotiate.c |  2 +-
 lib/krb5.c           |  4 ++--
 lib/socks_gssapi.c   |  4 ++--
 5 files changed, 10 insertions(+), 16 deletions(-)

diff --git a/lib/curl_gssapi.c b/lib/curl_gssapi.c
index 7a2f84a..a1a76a3 100644
--- a/lib/curl_gssapi.c
+++ b/lib/curl_gssapi.c
@@ -26,13 +26,13 @@
 
 #include "curl_gssapi.h"
 #include "sendf.h"
 
 static const char spengo_oid_bytes[] = "\x2b\x06\x01\x05\x05\x02";
-gss_OID_desc spnego_mech_oid = { 6, &spengo_oid_bytes };
+gss_OID_desc Curl_spnego_mech_oid = { 6, &spengo_oid_bytes };
 static const char krb5_oid_bytes[] = "\x2a\x86\x48\x86\xf7\x12\x01\x02\x02";
-gss_OID_desc krb5_mech_oid = { 9, &krb5_oid_bytes };
+gss_OID_desc Curl_krb5_mech_oid = { 9, &krb5_oid_bytes };
 
 OM_uint32 Curl_gss_init_sec_context(
     struct SessionHandle *data,
     OM_uint32 *minor_status,
     gss_ctx_id_t *context,
diff --git a/lib/curl_gssapi.h b/lib/curl_gssapi.h
index ff752d5..dfe65a8 100644
--- a/lib/curl_gssapi.h
+++ b/lib/curl_gssapi.h
@@ -5,11 +5,11 @@
  *  Project                     ___| | | |  _ \| |
  *                             / __| | | | |_) | |
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 2011, Daniel Stenberg, <[email protected]>, et al.
+ * Copyright (C) 2011 - 2014, Daniel Stenberg, <[email protected]>, 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.
  *
@@ -37,18 +37,12 @@
 #else
    /* Heimdal-style */
 #  include <gssapi.h>
 #endif
 
-#ifndef SPNEGO_MECHANISM
-CURL_EXTERN gss_OID_desc spnego_mech_oid;
-#define SPNEGO_MECHANISM &spnego_mech_oid
-#endif
-#ifndef KRB5_MECHANISM
-CURL_EXTERN gss_OID_desc krb5_mech_oid;
-#define KRB5_MECHANISM &krb5_mech_oid
-#endif
+gss_OID_desc Curl_spnego_mech_oid;
+gss_OID_desc Curl_krb5_mech_oid;
 
 /* Common method for using GSS-API */
 
 OM_uint32 Curl_gss_init_sec_context(
     struct SessionHandle *data,
diff --git a/lib/http_negotiate.c b/lib/http_negotiate.c
index 4b657cf..c8bfa29 100644
--- a/lib/http_negotiate.c
+++ b/lib/http_negotiate.c
@@ -145,11 +145,11 @@ int Curl_input_negotiate(struct connectdata *conn, bool proxy,
 
   major_status = Curl_gss_init_sec_context(data,
                                            &minor_status,
                                            &neg_ctx->context,
                                            neg_ctx->server_name,
-                                           SPNEGO_MECHANISM,
+                                           &Curl_spnego_mech_oid,
                                            GSS_C_NO_CHANNEL_BINDINGS,
                                            &input_token,
                                            &output_token,
                                            NULL);
   Curl_safefree(input_token.value);
diff --git a/lib/krb5.c b/lib/krb5.c
index 10a79aa..2891a00 100644
--- a/lib/krb5.c
+++ b/lib/krb5.c
@@ -1,10 +1,10 @@
 /* GSSAPI/krb5 support for FTP - loosely based on old krb4.c
  *
  * Copyright (c) 1995, 1996, 1997, 1998, 1999, 2013 Kungliga Tekniska Högskolan
  * (Royal Institute of Technology, Stockholm, Sweden).
- * Copyright (c) 2004 - 2012 Daniel Stenberg
+ * Copyright (c) 2004 - 2014 Daniel Stenberg
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -234,11 +234,11 @@ krb5_auth(void *app_data, struct connectdata *conn)
       ret = AUTH_OK;
       maj = Curl_gss_init_sec_context(data,
                                       &min,
                                       context,
                                       gssname,
-                                      KRB5_MECHANISM,
+                                      &Curl_krb5_mech_oid,
                                       &chan,
                                       gssresp,
                                       &output_buffer,
                                       NULL);
 
diff --git a/lib/socks_gssapi.c b/lib/socks_gssapi.c
index 228688e..74e4399 100644
--- a/lib/socks_gssapi.c
+++ b/lib/socks_gssapi.c
@@ -4,11 +4,11 @@
  *                             / __| | | | |_) | |
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
  * Copyright (C) 2009, 2011, Markus Moeller, <[email protected]>
- * Copyright (C) 2012, Daniel Stenberg, <[email protected]>, et al.
+ * Copyright (C) 2012 - 2014, Daniel Stenberg, <[email protected]>, 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.
  *
@@ -179,11 +179,11 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
   for(;;) {
     gss_major_status = Curl_gss_init_sec_context(data,
                                                  &gss_minor_status,
                                                  &gss_context,
                                                  server,
-                                                 KRB5_MECHANISM,
+                                                 &Curl_krb5_mech_oid,
                                                  NULL,
                                                  gss_token,
                                                  &gss_send_token,
                                                  &gss_ret_flags);
 
-- 
2.0.1

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Reply via email to