components/curl/patches/008-curl-url-sanitize.patch
author Mike Sullivan <Mike.Sullivan@Oracle.COM>
Mon, 11 Mar 2013 10:38:09 -0700
branchs11-update
changeset 2520 ceec631e74d1
parent 677 07b064828047
permissions -rw-r--r--
Close of build 10.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
677
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     1
--- lib/escape.c	2010-10-01 13:48:39.000000000 -0700
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     2
+++ lib/escape.c	2012-01-26 10:54:22.962290288 -0800
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     3
@@ -88,7 +88,7 @@
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     4
   char *testing_ptr = NULL;
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     5
   unsigned char in; /* we need to treat the characters unsigned */
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     6
   size_t newlen = alloc;
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     7
-  int strindex=0;
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     8
+  size_t strindex=0;
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     9
   size_t length;
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    10
 
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    11
 #ifndef CURL_DOES_CONVERSIONS
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    12
@@ -143,26 +143,25 @@
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    13
 }
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    14
 
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    15
 /*
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    16
- * Unescapes the given URL escaped string of given length. Returns a
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    17
- * pointer to a malloced string with length given in *olen.
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    18
- * If length == 0, the length is assumed to be strlen(string).
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    19
- * If olen == NULL, no output length is stored.
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    20
+ * Curl_urldecode() URL decodes the given string.
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    21
+ *
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    22
+ * Optionally detects control characters (byte codes lower than 32) in the
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    23
+ * *olen. If length == 0, the length is assumed to be strlen(string).
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    24
  */
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    25
-char *curl_easy_unescape(CURL *handle, const char *string, int length,
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    26
-                         int *olen)
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    27
+CURLcode Curl_urldecode(struct SessionHandle *data,
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    28
+                        const char *string, size_t length,
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    29
+			char **ostring, size_t *olen,
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    30
+			bool reject_ctrl)
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    31
 {
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    32
-  int alloc = (length?length:(int)strlen(string))+1;
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    33
+  size_t alloc = (length?length:strlen(string))+1;
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    34
   char *ns = malloc(alloc);
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    35
   unsigned char in;
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    36
-  int strindex=0;
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    37
+  size_t strindex=0;
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    38
   unsigned long hex;
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    39
+  CURLcode res;
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    40
 
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    41
-#ifndef CURL_DOES_CONVERSIONS
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    42
-  /* avoid compiler warnings */
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    43
-  (void)handle;
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    44
-#endif
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    45
   if( !ns )
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    46
-    return NULL;
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    47
+      return CURLE_OUT_OF_MEMORY;
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    48
 
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    49
   while(--alloc > 0) {
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    50
     in = *string;
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    51
@@ -180,17 +179,21 @@
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    52
 
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    53
 #ifdef CURL_DOES_CONVERSIONS
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    54
 /* escape sequences are always in ASCII so convert them on non-ASCII hosts */
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    55
-      if(!handle ||
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    56
-          (Curl_convert_from_network(handle, &in, 1) != CURLE_OK)) {
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    57
+	  res = Curl_convert_from_network(data, &in, 1);
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    58
+	  if(res) {
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    59
         /* Curl_convert_from_network calls failf if unsuccessful */
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    60
         free(ns);
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    61
-        return NULL;
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    62
+	      return res;
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    63
       }
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    64
 #endif /* CURL_DOES_CONVERSIONS */
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    65
 
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    66
       string+=2;
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    67
       alloc-=2;
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    68
     }
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    69
+      if(reject_ctrl && (in < 0x20)) {
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    70
+	  free(ns);
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    71
+	  return CURLE_URL_MALFORMAT;
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    72
+      }
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    73
 
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    74
     ns[strindex++] = in;
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    75
     string++;
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    76
@@ -200,7 +203,34 @@
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    77
   if(olen)
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    78
     /* store output size */
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    79
     *olen = strindex;
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    80
-  return ns;
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    81
+
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    82
+  if(ostring)
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    83
+      /* store output string */
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    84
+      *ostring = ns;
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    85
+
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    86
+  return CURLE_OK;
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    87
+}
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    88
+
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    89
+
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    90
+/*
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    91
+ * Unescapes the given URL escaped string of given length. Returns a
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    92
+ * pointer to a malloced string with length given in *olen.
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    93
+ * If length == 0, the length is assumed to be strlen(string).
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    94
+ * If olen == NULL, no output length is stored.
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    95
+ */
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    96
+char *curl_easy_unescape(CURL *handle, const char *string, int length,
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    97
+                         int *olen)
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    98
+{
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    99
+  char *str = NULL;
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   100
+  size_t inputlen = length;
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   101
+  size_t outputlen;
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   102
+  CURLcode res = Curl_urldecode(handle, string, inputlen, &str, &outputlen,
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   103
+	  FALSE);
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   104
+  if(res)
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   105
+      return NULL;
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   106
+  if(olen)
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   107
+      *olen = curlx_uztosi(outputlen);
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   108
+  return str;
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   109
 }
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   110
 
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   111
 /* For operating systems/environments that use different malloc/free
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   112
--- lib/escape.h	2010-09-18 14:00:21.000000000 -0700
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   113
+++ lib/escape.h	2012-01-26 09:42:20.936213952 -0800
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   114
@@ -1,5 +1,5 @@
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   115
-#ifndef __ESCAPE_H
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   116
-#define __ESCAPE_H
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   117
+#ifndef HEADER_CURL_ESCAPE_H
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   118
+#define HEADER_CURL_ESCAPE_H
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   119
 
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   120
 /***************************************************************************
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   121
  *                                  _   _ ____  _
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   122
@@ -8,7 +8,7 @@
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   123
  *                            | (__| |_| |  _ <| |___
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   124
  *                             \___|\___/|_| \_\_____|
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   125
  *
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   126
- * Copyright (C) 1998 - 2006, Daniel Stenberg, <[email protected]>, et al.
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   127
+ * Copyright (C) 1998 - 2011, Daniel Stenberg, <[email protected]>, et al.
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   128
  *
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   129
  * This software is licensed as described in the file COPYING, which
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   130
  * you should have received as part of this distribution. The terms
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   131
@@ -25,5 +25,9 @@
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   132
 /* Escape and unescape URL encoding in strings. The functions return a new
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   133
  * allocated string or NULL if an error occurred.  */
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   134
 
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   135
+CURLcode Curl_urldecode(struct SessionHandle *data,
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   136
+                        const char *string, size_t length,
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   137
+			char **ostring, size_t *olen,
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   138
+			bool reject_crlf);
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   139
 
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   140
 #endif
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   141
--- lib/imap.c	2010-09-18 14:00:21.000000000 -0700
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   142
+++ lib/imap.c	2012-01-26 09:35:07.180464878 -0800
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   143
@@ -906,17 +906,12 @@
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   144
   struct imap_conn *imapc = &conn->proto.imapc;
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   145
   struct SessionHandle *data = conn->data;
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   146
   const char *path = data->state.path;
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   147
-  int len;
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   148
 
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   149
   if(!*path)
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   150
     path = "INBOX";
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   151
 
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   152
   /* url decode the path and use this mailbox */
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   153
-  imapc->mailbox = curl_easy_unescape(data, path, 0, &len);
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   154
-  if(!imapc->mailbox)
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   155
-    return CURLE_OUT_OF_MEMORY;
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   156
-
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   157
-  return CURLE_OK;
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   158
+  return Curl_urldecode(data, path, 0, &imapc->mailbox, NULL, TRUE);
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   159
 }
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   160
 
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   161
 /* call this when the DO phase has completed */
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   162
--- lib/pop3.c	2010-09-18 14:00:21.000000000 -0700
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   163
+++ lib/pop3.c	2012-01-26 09:35:47.059691860 -0800
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   164
@@ -852,11 +852,7 @@
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   165
   const char *path = data->state.path;
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   166
 
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   167
   /* url decode the path and use this mailbox */
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   168
-  pop3c->mailbox = curl_easy_unescape(data, path, 0, NULL);
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   169
-  if (!pop3c->mailbox)
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   170
-    return CURLE_OUT_OF_MEMORY;
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   171
-
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   172
-  return CURLE_OK;
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   173
+  return Curl_urldecode(data, path, 0, &pop3c->mailbox, NULL, TRUE);
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   174
 }
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   175
 
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   176
 /* call this when the DO phase has completed */
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   177
--- lib/smtp.c	2010-10-12 13:56:21.000000000 -0700
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   178
+++ lib/smtp.c	2012-01-26 09:38:03.856720962 -0800
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   179
@@ -1045,7 +1045,6 @@
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   180
   struct SessionHandle *data=conn->data;
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   181
   struct pingpong *pp=&smtpc->pp;
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   182
   const char *path = conn->data->state.path;
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   183
-  int len;
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   184
   char localhost[1024 + 1];
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   185
 
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   186
   *done = FALSE; /* default to not done yet */
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   187
@@ -1119,9 +1118,9 @@
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   188
   }
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   189
 
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   190
   /* url decode the path and use it as domain with EHLO */
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   191
-  smtpc->domain = curl_easy_unescape(conn->data, path, 0, &len);
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   192
-  if(!smtpc->domain)
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   193
-    return CURLE_OUT_OF_MEMORY;
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   194
+  result = Curl_urldecode(conn->data, path, 0, &smtpc->domain, NULL, TRUE);
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   195
+  if(result)
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   196
+    return result;
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   197
 
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   198
   /* When we connect, we start in the state where we await the server greeting
07b064828047 7141450 Problem with library/curl
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   199
    */