bug-wget
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-wget] [PATCH] MinGW compatibility fixes


From: Ray Satiro
Subject: [Bug-wget] [PATCH] MinGW compatibility fixes
Date: Tue, 21 May 2013 18:06:25 -0400

src/ChangeLog
src/http.c
src/url.c

@ src/http.c:

- (create_authorization_line)
Fix syntax error in calls to NTLM functions.

@ src/url.c:

- (url_file_name)
Use MAX_PATH in Windows.
---
 src/ChangeLog |  6 ++++++
 src/http.c    | 12 +++++-------
 src/url.c     | 19 +++++++++++++++++++
 3 files changed, 30 insertions(+), 7 deletions(-)

diff --git a/src/ChangeLog b/src/ChangeLog
index eaa82ae..1738e76 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
+2013-05-21  Ray Satiro  <address@hidden>
+
+       * http.c (create_authorization_line): Fix syntax error in calls to NTLM
+       functions.
+       * url.c (url_file_name): Use MAX_PATH in Windows.
+
 2013-05-19  Giuseppe Scrivano  <address@hidden>
 
        * Makefile.am (EXTRA_DIST): Add iri.c multi.c multi.h metalink.c 
metalink.h.
diff --git a/src/http.c b/src/http.c
index afc89b3..fba66e2 100644
--- a/src/http.c
+++ b/src/http.c
@@ -4186,22 +4186,20 @@ create_authorization_line (const char *au, const char 
*user,
 
 #if defined ENABLE_NTLM && defined ENABLE_THREADS
     case 'N':                   /* NTLM */
-      if (!ntlm_input (&pconn.ntlm, au))
+      if (!ntlm_input (&pconn->ntlm, au))
         {
           *finished = true;
           return NULL;
         }
-      return ntlm_output (&pconn.ntlm, user, passwd, finished);
-#endif
-
-#ifdef ENABLE_NTLM
+      return ntlm_output (&pconn->ntlm, user, passwd, finished);
+#elif defined ENABLE_NTLM
     case 'N':                   /* NTLM */
-      if (!ntlm_input (&pconn->ntlm, au))
+      if (!ntlm_input (&pconn.ntlm, au))
         {
           *finished = true;
           return NULL;
         }
-      return ntlm_output (&pconn->ntlm, user, passwd, finished);
+      return ntlm_output (&pconn.ntlm, user, passwd, finished);
 #endif
     default:
       /* We shouldn't get here -- this function should be only called
diff --git a/src/url.c b/src/url.c
index f200467..36a9630 100644
--- a/src/url.c
+++ b/src/url.c
@@ -1618,7 +1618,26 @@ url_file_name (const struct url *u, char 
*replaced_filename)
   append_char ('\0', &temp_fnres);
 
   /* Check that the length of the file name is acceptable. */
+#ifdef WINDOWS
+  if (MAX_PATH > (fnres.tail + CHOMP_BUFFER + 2))
+    {
+      max_length = MAX_PATH - (fnres.tail + CHOMP_BUFFER + 2);
+      /* FIXME: In Windows a filename is usually limited to 255 characters.
+      To really be accurate you could call GetVolumeInformation() to get
+      lpMaximumComponentLength
+      */
+      if (max_length > 255)
+        {
+          max_length = 255;
+        }
+    }
+  else
+    {
+      max_length = 0;
+    }
+#else
   max_length = get_max_length (fnres.base, fnres.tail, _PC_NAME_MAX) - 
CHOMP_BUFFER;
+#endif
   if (max_length > 0 && strlen (temp_fnres.base) > max_length)
     {
       logprintf (LOG_NOTQUIET, "The name is too long, %lu chars total.\n",
-- 
1.8.1.msysgit.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]