neon mixes up proxy and target host when using SSPI on Windows

Joe Orton joe at manyfish.co.uk
Tue Sep 13 06:29:28 EDT 2011


On Tue, Sep 13, 2011 at 11:17:23AM +0200, Mario Brandt wrote:
> That patch which was attached to the mail breaks the build from libneon.lib
> 
> 11>ne_auth.c
> 11>src\ne_auth.c(635) : error C2065: 'ahs' : undeclared identifier
> 11>src\ne_auth.c(635) : error C2223: left of '->sspi_host' must point

Ah, sorry, I'm "flying blind" here... can you try this?  Thanks a lot 
for offering to create binaries.

Index: src/ne_auth.c
===================================================================
--- src/ne_auth.c	(revision 1853)
+++ src/ne_auth.c	(working copy)
@@ -181,6 +181,7 @@
     /* This is used for SSPI (Negotiate/NTLM) auth */
     char *sspi_token;
     void *sspi_context;
+    char *sspi_host;
 #endif
 #ifdef HAVE_NTLM
      /* This is used for NTLM auth */
@@ -299,6 +300,8 @@
     sess->sspi_token = NULL;
     ne_sspi_destroy_context(sess->sspi_context);
     sess->sspi_context = NULL;
+    if (sess->sspi_host) ne_free(sess->sspi_host);
+    sess->sspi_host = NULL;
 #endif
 #ifdef HAVE_NTLM
     if (sess->ntlm_context) {
@@ -627,14 +630,7 @@
     NE_DEBUG(NE_DBG_HTTPAUTH, "auth: SSPI challenge.\n");
     
     if (!sess->sspi_context) {
-        ne_uri uri = {0};
-
-        ne_fill_server_uri(sess->sess, &uri);
-
-        status = ne_sspi_create_context(&sess->sspi_context, uri.host, ntlm);
-
-        ne_uri_free(&uri);
-
+        status = ne_sspi_create_context(&sess->sspi_context, sess->sspi_host, ntlm);
         if (status) {
             return status;
         }
@@ -1652,7 +1648,22 @@
         ne_uri_free(&uri);
     }
 #endif
+#ifdef HAVE_SSPI
+    if ((protomask & (NE_AUTH_NTLM|NE_AUTH_GSSAPI)) && !ahs->sspi_host) {
+        ne_uri uri = {0};
+        
+        if (isproxy)
+            ne_fill_proxy_uri(sess, &uri);
+        else
+            ne_fill_server_uri(sess, &uri);
 
+        ahs->sspi_host = uri.host;
+        uri.host = NULL;
+
+        ne_uri_free(&uri);
+    }
+#endif        
+
     /* Find the end of the handler list, and add a new one. */
     hdl = &ahs->handlers;
     while (*hdl)



More information about the neon mailing list