PSARC 2012/252 curl 7.26.0
7161374 Update curl to latest version.
--- a/components/curl/Makefile Wed Aug 29 11:06:55 2012 -0700
+++ b/components/curl/Makefile Wed Aug 29 12:43:34 2012 -0700
@@ -23,12 +23,12 @@
include ../../make-rules/shared-macros.mk
COMPONENT_NAME = curl
-COMPONENT_VERSION= 7.21.2
+COMPONENT_VERSION= 7.26.0
COMPONENT_SRC= $(COMPONENT_NAME)-$(COMPONENT_VERSION)
COMPONENT_PROJECT_URL= http://curl.haxx.se/
COMPONENT_ARCHIVE= $(COMPONENT_SRC).tar.gz
COMPONENT_ARCHIVE_HASH= \
- sha256:d8e0ce964b75b99efa2e6c58e6523027fe2fa56305cc180ecacda6ced636e2bf
+ sha256:79ccce9edb8aee17d20ad4d75e1f83a789f8c2e71e68f468e1bf8abf8933193f
COMPONENT_ARCHIVE_URL= $(COMPONENT_PROJECT_URL)download/$(COMPONENT_ARCHIVE)
include ../../make-rules/prep.mk
--- a/components/curl/curl.license Wed Aug 29 11:06:55 2012 -0700
+++ b/components/curl/curl.license Wed Aug 29 12:43:34 2012 -0700
@@ -1,6 +1,12 @@
+---------------
+- curl 7.26.0 -
+---------------
+
+Oracle Internal Tracking Number 8339
+
COPYRIGHT AND PERMISSION NOTICE
-Copyright (c) 1996 - 2010, Daniel Stenberg, <[email protected]>.
+Copyright (c) 1996 - 2012, Daniel Stenberg, <[email protected]>.
All rights reserved.
--- a/components/curl/curl.p5m Wed Aug 29 11:06:55 2012 -0700
+++ b/components/curl/curl.p5m Wed Aug 29 12:43:34 2012 -0700
@@ -18,13 +18,13 @@
#
# CDDL HEADER END
#
-# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
#
<transform file path=usr.*/man/.+ -> default mangler.man.stability uncommitted>
<transform file path=usr/share/doc/curl/html/(.+)$ -> \
- set action.hash curl-7.21.2/docs/%<\1> >
+ set action.hash curl-7.26.0/docs/%<\1> >
<transform file path=usr/share/doc/libcurl/html/(.+)$ -> \
- set action.hash curl-7.21.2/docs/libcurl/%<\1> >
+ set action.hash curl-7.26.0/docs/libcurl/%<\1> >
set name=pkg.fmri value=pkg:/web/curl@$(IPS_COMPONENT_VERSION),$(BUILD_VERSION)
set name=pkg.summary value="The CURL Network Utility and Library"
@@ -33,7 +33,8 @@
set name=info.upstream-url value=$(COMPONENT_PROJECT_URL)
set name=info.source-url value=$(COMPONENT_ARCHIVE_URL)
set name=org.opensolaris.arc-caseid \
- value=PSARC/2007/165
+ value=PSARC/2007/165 \
+ value=PSARC/2012/252
set name=org.opensolaris.consolidation value=$(CONSOLIDATION)
#
dir path=usr
@@ -57,6 +58,7 @@
#
file path=usr/bin/curl
file path=usr/bin/curl-config
+file path=usr/bin/$(MACH64)/curl
file path=usr/bin/$(MACH64)/curl-config
file path=usr/include/curl/curlbuild.h
file path=usr/include/curl/curl.h
@@ -67,9 +69,8 @@
file path=usr/include/curl/multi.h
file path=usr/include/curl/stdcheaders.h
file path=usr/include/curl/typecheck-gcc.h
-file path=usr/include/curl/types.h
-file path=usr/lib/libcurl.so.3.0.0
-file path=usr/lib/$(MACH64)/libcurl.so.3.0.0
+file path=usr/lib/libcurl.so.4.2.0
+file path=usr/lib/$(MACH64)/libcurl.so.4.2.0
file path=usr/lib/llib-lcurl
file path=usr/lib/llib-lcurl.ln
file path=usr/lib/$(MACH64)/llib-lcurl.ln
@@ -83,8 +84,11 @@
file path=usr/share/doc/libcurl/html/curl_easy_escape.html
file path=usr/share/doc/libcurl/html/curl_easy_getinfo.html
file path=usr/share/doc/libcurl/html/curl_easy_init.html
+file path=usr/share/doc/libcurl/html/curl_easy_pause.html
file path=usr/share/doc/libcurl/html/curl_easy_perform.html
+file path=usr/share/doc/libcurl/html/curl_easy_recv.html
file path=usr/share/doc/libcurl/html/curl_easy_reset.html
+file path=usr/share/doc/libcurl/html/curl_easy_send.html
file path=usr/share/doc/libcurl/html/curl_easy_setopt.html
file path=usr/share/doc/libcurl/html/curl_easy_strerror.html
file path=usr/share/doc/libcurl/html/curl_easy_unescape.html
@@ -108,6 +112,7 @@
file path=usr/share/doc/libcurl/html/curl_multi_perform.html
file path=usr/share/doc/libcurl/html/curl_multi_remove_handle.html
file path=usr/share/doc/libcurl/html/curl_multi_setopt.html
+file path=usr/share/doc/libcurl/html/curl_multi_socket_action.html
file path=usr/share/doc/libcurl/html/curl_multi_socket.html
file path=usr/share/doc/libcurl/html/curl_multi_strerror.html
file path=usr/share/doc/libcurl/html/curl_multi_timeout.html
@@ -130,13 +135,17 @@
file path=usr/share/doc/libcurl/html/libcurl.html
file path=usr/share/man/man1/curl.1
file path=usr/share/man/man1/curl-config.1
+file path=usr/share/man/man1/mk-ca-bundle.1
file path=usr/share/man/man3/curl_easy_cleanup.3
file path=usr/share/man/man3/curl_easy_duphandle.3
file path=usr/share/man/man3/curl_easy_escape.3
file path=usr/share/man/man3/curl_easy_getinfo.3
file path=usr/share/man/man3/curl_easy_init.3
+file path=usr/share/man/man3/curl_easy_pause.3
file path=usr/share/man/man3/curl_easy_perform.3
+file path=usr/share/man/man3/curl_easy_recv.3
file path=usr/share/man/man3/curl_easy_reset.3
+file path=usr/share/man/man3/curl_easy_send.3
file path=usr/share/man/man3/curl_easy_setopt.3
file path=usr/share/man/man3/curl_easy_strerror.3
file path=usr/share/man/man3/curl_easy_unescape.3
@@ -161,6 +170,7 @@
file path=usr/share/man/man3/curl_multi_remove_handle.3
file path=usr/share/man/man3/curl_multi_setopt.3
file path=usr/share/man/man3/curl_multi_socket.3
+file path=usr/share/man/man3/curl_multi_socket_action.3
file path=usr/share/man/man3/curl_multi_strerror.3
file path=usr/share/man/man3/curl_multi_timeout.3
file path=usr/share/man/man3/curl_share_cleanup.3
@@ -180,9 +190,11 @@
file path=usr/share/man/man3/libcurl-tutorial.3
file path=usr/share/man/man3/libcurl.3
#
-link path=usr/lib/libcurl.so.3 target=libcurl.so.3.0.0
-link path=usr/lib/libcurl.so target=libcurl.so.3.0.0
-link path=usr/lib/$(MACH64)/libcurl.so.3 target=libcurl.so.3.0.0
-link path=usr/lib/$(MACH64)/libcurl.so target=libcurl.so.3.0.0
+link path=usr/lib/libcurl.so.3 target=libcurl.so.4.2.0
+link path=usr/lib/libcurl.so.4 target=libcurl.so.4.2.0
+link path=usr/lib/libcurl.so target=libcurl.so.4.2.0
+link path=usr/lib/$(MACH64)/libcurl.so.3 target=libcurl.so.4.2.0
+link path=usr/lib/$(MACH64)/libcurl.so.4 target=libcurl.so.4.2.0
+link path=usr/lib/$(MACH64)/libcurl.so target=libcurl.so.4.2.0
#
license curl.license license="CURL"
--- a/components/curl/patches/000-configure.patch Wed Aug 29 11:06:55 2012 -0700
+++ b/components/curl/patches/000-configure.patch Wed Aug 29 12:43:34 2012 -0700
@@ -1,131 +1,15 @@
---- configure 2010-10-01 13:49:17.000000000 -0700
-+++ configure 2010-10-18 08:18:56.838791104 -0700
-@@ -1,4 +1,4 @@
--#! /bin/sh
-+#! /bin/ksh93
- # Guess values for system-dependent variables and create Makefiles.
- # Generated by GNU Autoconf 2.67 for curl -.
- #
-@@ -274,7 +274,7 @@
- fi
- fi
- fi
--SHELL=${CONFIG_SHELL-/bin/sh}
-+SHELL=${CONFIG_SHELL-/bin/ksh93}
- export SHELL
- # Unset more variables known to interfere with behavior of common tools.
- CLICOLOR_FORCE= GREP_OPTIONS=
-@@ -565,7 +565,7 @@
-
-
- # Check that we are running under the correct shell.
--SHELL=${CONFIG_SHELL-/bin/sh}
-+SHELL=${CONFIG_SHELL-/bin/ksh93}
-
- case X$lt_ECHO in
- X*--fallback-echo)
-@@ -649,7 +649,7 @@
- elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } &&
- test "X$CONFIG_SHELL" != X/bin/ksh; then
- # If we have ksh, try running configure again with it.
-- ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
-+ ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/ksh93}
- export ORIGINAL_CONFIG_SHELL
- CONFIG_SHELL=/bin/ksh
- export CONFIG_SHELL
-@@ -691,7 +691,7 @@
- if test "$prev" != 'sed 50q "$0"'; then
- echo_test_string=`eval $prev`
- export echo_test_string
-- exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"}
-+ exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/ksh93}} "$0" ${1+"$@"}
- else
- # Oops. We lost completely, so just stick with echo.
- ECHO=echo
-@@ -2001,6 +2001,13 @@
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
- /* end confdefs.h. */
- $4
-+#include <stdio.h>
-+#include <stdlib.h>
-+#include <limits.h>
-+#include <sys/types.h>
-+#include <stdint.h>
-+#include <inttypes.h>
-+#include <sys/socket.h>
- int main (void)
- {
- static int test_array [1 - 2 * !(($2) >= 0)];
-@@ -2041,6 +2048,13 @@
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
- /* end confdefs.h. */
- $4
-+#include <stdio.h>
-+#include <stdlib.h>
-+#include <limits.h>
-+#include <sys/types.h>
-+#include <stdint.h>
-+#include <inttypes.h>
-+#include <sys/socket.h>
- int main (void)
- {
- static int test_array [1 - 2 * !(($2) < 0)];
-@@ -2056,6 +2070,13 @@
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
- /* end confdefs.h. */
- $4
-+#include <stdio.h>
-+#include <stdlib.h>
-+#include <limits.h>
-+#include <sys/types.h>
-+#include <stdint.h>
-+#include <inttypes.h>
-+#include <sys/socket.h>
- int main (void)
- {
- static int test_array [1 - 2 * !(($2) >= $ac_mid)];
-@@ -2089,6 +2110,13 @@
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
- /* end confdefs.h. */
- $4
-+#include <stdio.h>
-+#include <stdlib.h>
-+#include <limits.h>
-+#include <sys/types.h>
-+#include <stdint.h>
-+#include <inttypes.h>
-+#include <sys/socket.h>
- int main (void)
- {
- static int test_array [1 - 2 * !(($2) <= $ac_mid)];
-@@ -2113,10 +2141,15 @@
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
- /* end confdefs.h. */
- $4
--static long int longval () { return $2; }
--static unsigned long int ulongval () { return $2; }
- #include <stdio.h>
- #include <stdlib.h>
-+#include <limits.h>
-+#include <sys/types.h>
-+#include <stdint.h>
-+#include <inttypes.h>
-+#include <sys/socket.h>
-+static long int longval () { return $2; }
-+static unsigned long int ulongval () { return $2; }
- int main (void)
- {
-
-@@ -2797,7 +2830,7 @@
+--- configure.orig 2012-05-29 06:47:27.467999971 -0700
++++ configure 2012-05-29 06:59:52.994079022 -0700
+@@ -2708,7 +2708,7 @@
--ac_config_headers="$ac_config_headers lib/curl_config.h src/curl_config.h include/curl/curlbuild.h"
-+ac_config_headers="$ac_config_headers lib/curl_config.h src/curl_config.h"
+-ac_config_headers="$ac_config_headers lib/curl_config.h include/curl/curlbuild.h"
++ac_config_headers="$ac_config_headers lib/curl_config.h"
+ :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
- $as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; }
-@@ -3263,12 +3296,6 @@
+@@ -3207,12 +3207,6 @@
fi
@@ -135,57 +19,10 @@
- rm -f ${srcdir}/include/curl/curlbuild.h
-fi
-
- VERSION=`$SED -ne 's/^#define LIBCURL_VERSION "\(.*\)"/\1/p' ${srcdir}/include/curl/curlver.h`
+ CURLVERSION=`$SED -ne 's/^#define LIBCURL_VERSION "\(.*\)"/\1/p' ${srcdir}/include/curl/curlver.h`
am__api_version="1.9"
ac_aux_dir=
-@@ -3538,7 +3565,7 @@
- $as_echo_n "(cached) " >&6
- else
- cat >conftest.make <<\_ACEOF
--SHELL = /bin/sh
-+SHELL = /bin/ksh93
- all:
- @echo '@@@%%%=$(MAKE)=@@@%%%'
- _ACEOF
-@@ -4734,7 +4761,7 @@
- for i in 1 2 3 4 5 6; do
- echo '#include "conftst'$i'.h"' >> sub/conftest.c
- # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
-- # Solaris 8's {/usr,}/bin/sh.
-+ # Solaris 8's {/usr,}/bin/ksh93.
- touch sub/conftst$i.h
- done
- echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
-@@ -8029,7 +8056,7 @@
- for i in 1 2 3 4 5 6 7 8 ; do
- teststring=$teststring$teststring
- done
-- SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
-+ SHELL=${SHELL-${CONFIG_SHELL-/bin/ksh93}}
- # If test is not a shell built-in, we'll probably end up computing a
- # maximum length that is only half of the actual maximum length, but
- # we can't tell.
-@@ -9261,8 +9288,8 @@
- case $lt_cv_prog_gnu_ld in
- yes*) LD="${LD-ld} -m elf64_sparc" ;;
- *)
-- if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
-- LD="${LD-ld} -64"
-+ if ${LD-ld} -r -o conftest2.o conftest.o >/dev/null 2>&1; then
-+ LD="${LD-ld}"
- fi
- ;;
- esac
-@@ -13653,7 +13680,7 @@
- $as_echo_n "(cached) " >&6
- else
- cat >conftest.make <<\_ACEOF
--SHELL = /bin/sh
-+SHELL = /bin/ksh93
- all:
- @echo '@@@%%%=$(MAKE)=@@@%%%'
- _ACEOF
-@@ -19176,15 +19203,15 @@
+@@ -20377,15 +20371,15 @@
LIBS="$LIBS $gss_libs"
elif test "$GSSAPI_ROOT" != "yes"; then
LDFLAGS="$LDFLAGS -L$GSSAPI_ROOT/lib$libsuff"
@@ -204,7 +41,7 @@
fi
else
CPPFLAGS="$save_CPPFLAGS"
-@@ -19210,7 +19237,7 @@
+@@ -20411,7 +20405,7 @@
if test x$cross_compiling != xyes; then
PKGTEST="yes"
fi
@@ -213,7 +50,7 @@
LIB_OPENSSL="$PREFIX_OPENSSL/lib$libsuff"
;;
off)
-@@ -22731,20 +22758,13 @@
+@@ -25375,20 +25369,13 @@
@@ -236,10 +73,10 @@
for arg1 in int SOCKET; do
for arg2 in 'struct sockaddr' void; do
for t in socklen_t int size_t 'unsigned int' long 'unsigned long' void; do
-@@ -35751,7 +35771,6 @@
+@@ -39129,7 +39116,6 @@
+ do
case $ac_config_target in
"lib/curl_config.h") CONFIG_HEADERS="$CONFIG_HEADERS lib/curl_config.h" ;;
- "src/curl_config.h") CONFIG_HEADERS="$CONFIG_HEADERS src/curl_config.h" ;;
- "include/curl/curlbuild.h") CONFIG_HEADERS="$CONFIG_HEADERS include/curl/curlbuild.h" ;;
"depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
"libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
--- a/components/curl/patches/001-Makefile.in.patch Wed Aug 29 11:06:55 2012 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
---- lib/Makefile.in 2010-10-01 13:49:18.000000000 -0700
-+++ lib/Makefile.in 2010-10-18 08:05:00.803406622 -0700
-@@ -364,7 +364,7 @@
- @USE_EMBEDDED_ARES_TRUE@ -I$(top_builddir)/ares \
- @USE_EMBEDDED_ARES_TRUE@ -I$(top_srcdir)/ares
-
--@SONAME_BUMP_FALSE@VERSIONINFO = -version-info 6:0:2
-+@SONAME_BUMP_FALSE@VERSIONINFO = -version-info 3:0:0
-
- #
- # Bumping of SONAME conditionally may seem like a weird thing to do, and yeah
-@@ -375,7 +375,7 @@
- #
- # This conditional soname bump SHOULD be removed at next "proper" bump.
- #
--@SONAME_BUMP_TRUE@VERSIONINFO = -version-info 7:0:2
-+@SONAME_BUMP_TRUE@VERSIONINFO = -version-info 3:0:0
-
- # This flag accepts an argument of the form current[:revision[:age]]. So,
- # passing -version-info 3:12:1 sets current to 3, revision to 12, and age to
--- a/components/curl/patches/004-Makefile.in.patch Wed Aug 29 11:06:55 2012 -0700
+++ b/components/curl/patches/004-Makefile.in.patch Wed Aug 29 12:43:34 2012 -0700
@@ -1,22 +1,22 @@
---- include/curl/Makefile.in 2010-10-01 13:49:18.000000000 -0700
-+++ include/curl/Makefile.in 2011-03-31 11:29:48.945604347 -0700
-@@ -306,18 +306,8 @@
+--- include/curl/Makefile.in.orig 2012-05-29 07:03:55.726717894 -0700
++++ include/curl/Makefile.in 2012-05-29 07:05:20.365485875 -0700
+@@ -349,18 +349,8 @@
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
--curlbuild.h: stamp-h3
+-curlbuild.h: stamp-h2
- @if test ! -f $@; then \
-- rm -f stamp-h3; \
-- $(MAKE) stamp-h3; \
+- rm -f stamp-h2; \
+- $(MAKE) stamp-h2; \
- else :; fi
-
--stamp-h3: $(srcdir)/curlbuild.h.in $(top_builddir)/config.status
-+stamp-h3:
- @rm -f stamp-h3
+-stamp-h2: $(srcdir)/curlbuild.h.in $(top_builddir)/config.status
++stamp-h2:
+ @rm -f stamp-h2
- cd $(top_builddir) && $(SHELL) ./config.status include/curl/curlbuild.h
-$(srcdir)/curlbuild.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
- cd $(top_srcdir) && $(AUTOHEADER)
-- rm -f stamp-h3
+- rm -f stamp-h2
touch $@
distclean-hdr:
--- a/components/curl/patches/006-curl-gssapi-delegation.patch Wed Aug 29 11:06:55 2012 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
---- lib/http_negotiate.c 2010-09-18 14:00:21.000000000 -0700
-+++ lib/http_negotiate.c 2011-07-05 08:16:14.333605202 -0700
-@@ -242,7 +242,7 @@
- &neg_ctx->context,
- neg_ctx->server_name,
- GSS_C_NO_OID,
-- GSS_C_DELEG_FLAG,
-+ 0,
- 0,
- GSS_C_NO_CHANNEL_BINDINGS,
- &input_token,
--- a/components/curl/patches/007-curl-dont-insert-empty-fragments.patch Wed Aug 29 11:06:55 2012 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
---- lib/ssluse.c 2010-09-18 14:00:21.000000000 -0700
-+++ lib/ssluse.c 2012-01-24 07:43:28.989624080 -0800
-@@ -1428,6 +1428,7 @@
- X509_LOOKUP *lookup=NULL;
- curl_socket_t sockfd = conn->sock[sockindex];
- struct ssl_connect_data *connssl = &conn->ssl[sockindex];
-+ long ctx_options;
- #ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME
- bool sni;
- #ifdef ENABLE_IPV6
-@@ -1507,16 +1508,27 @@
- If someone writes an application with libcurl and openssl who wants to
- enable the feature, one can do this in the SSL callback.
-
-+ OpenSSL added a work-around for a SSL 3.0/TLS 1.0 CBC vulnerability
-+ (http://www.openssl.org/~bodo/tls-cbc.txt). In 0.9.6e they added a bit to
-+ SSL_OP_ALL that _disables_ that work-around despite the fact that
-+ SSL_OP_ALL is documented to do "rather harmless" workarounds. In order to
-+ keep the secure work-around, the SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS bit
-+ must not be set.
-+
- */
-+
-+ ctx_options = SSL_OP_ALL;
-+
- #ifdef SSL_OP_NO_TICKET
- /* expect older openssl releases to not have this define so only use it if
- present */
--#define CURL_CTX_OPTIONS SSL_OP_ALL|SSL_OP_NO_TICKET
--#else
--#define CURL_CTX_OPTIONS SSL_OP_ALL
-+ ctx_options |= SSL_OP_NO_TICKET;
-+#endif
-+#ifdef SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS
-+ ctx_options &= ~SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS;
- #endif
-
-- SSL_CTX_set_options(connssl->ctx, CURL_CTX_OPTIONS);
-+ SSL_CTX_set_options(connssl->ctx, ctx_options);
-
- /* disable SSLv2 in the default case (i.e. allow SSLv3 and TLSv1) */
- if(data->set.ssl.version == CURL_SSLVERSION_DEFAULT)
--- a/components/curl/patches/008-curl-url-sanitize.patch Wed Aug 29 11:06:55 2012 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,199 +0,0 @@
---- lib/escape.c 2010-10-01 13:48:39.000000000 -0700
-+++ lib/escape.c 2012-01-26 10:54:22.962290288 -0800
-@@ -88,7 +88,7 @@
- char *testing_ptr = NULL;
- unsigned char in; /* we need to treat the characters unsigned */
- size_t newlen = alloc;
-- int strindex=0;
-+ size_t strindex=0;
- size_t length;
-
- #ifndef CURL_DOES_CONVERSIONS
-@@ -143,26 +143,25 @@
- }
-
- /*
-- * Unescapes the given URL escaped string of given length. Returns a
-- * pointer to a malloced string with length given in *olen.
-- * If length == 0, the length is assumed to be strlen(string).
-- * If olen == NULL, no output length is stored.
-+ * Curl_urldecode() URL decodes the given string.
-+ *
-+ * Optionally detects control characters (byte codes lower than 32) in the
-+ * *olen. If length == 0, the length is assumed to be strlen(string).
- */
--char *curl_easy_unescape(CURL *handle, const char *string, int length,
-- int *olen)
-+CURLcode Curl_urldecode(struct SessionHandle *data,
-+ const char *string, size_t length,
-+ char **ostring, size_t *olen,
-+ bool reject_ctrl)
- {
-- int alloc = (length?length:(int)strlen(string))+1;
-+ size_t alloc = (length?length:strlen(string))+1;
- char *ns = malloc(alloc);
- unsigned char in;
-- int strindex=0;
-+ size_t strindex=0;
- unsigned long hex;
-+ CURLcode res;
-
--#ifndef CURL_DOES_CONVERSIONS
-- /* avoid compiler warnings */
-- (void)handle;
--#endif
- if( !ns )
-- return NULL;
-+ return CURLE_OUT_OF_MEMORY;
-
- while(--alloc > 0) {
- in = *string;
-@@ -180,17 +179,21 @@
-
- #ifdef CURL_DOES_CONVERSIONS
- /* escape sequences are always in ASCII so convert them on non-ASCII hosts */
-- if(!handle ||
-- (Curl_convert_from_network(handle, &in, 1) != CURLE_OK)) {
-+ res = Curl_convert_from_network(data, &in, 1);
-+ if(res) {
- /* Curl_convert_from_network calls failf if unsuccessful */
- free(ns);
-- return NULL;
-+ return res;
- }
- #endif /* CURL_DOES_CONVERSIONS */
-
- string+=2;
- alloc-=2;
- }
-+ if(reject_ctrl && (in < 0x20)) {
-+ free(ns);
-+ return CURLE_URL_MALFORMAT;
-+ }
-
- ns[strindex++] = in;
- string++;
-@@ -200,7 +203,34 @@
- if(olen)
- /* store output size */
- *olen = strindex;
-- return ns;
-+
-+ if(ostring)
-+ /* store output string */
-+ *ostring = ns;
-+
-+ return CURLE_OK;
-+}
-+
-+
-+/*
-+ * Unescapes the given URL escaped string of given length. Returns a
-+ * pointer to a malloced string with length given in *olen.
-+ * If length == 0, the length is assumed to be strlen(string).
-+ * If olen == NULL, no output length is stored.
-+ */
-+char *curl_easy_unescape(CURL *handle, const char *string, int length,
-+ int *olen)
-+{
-+ char *str = NULL;
-+ size_t inputlen = length;
-+ size_t outputlen;
-+ CURLcode res = Curl_urldecode(handle, string, inputlen, &str, &outputlen,
-+ FALSE);
-+ if(res)
-+ return NULL;
-+ if(olen)
-+ *olen = curlx_uztosi(outputlen);
-+ return str;
- }
-
- /* For operating systems/environments that use different malloc/free
---- lib/escape.h 2010-09-18 14:00:21.000000000 -0700
-+++ lib/escape.h 2012-01-26 09:42:20.936213952 -0800
-@@ -1,5 +1,5 @@
--#ifndef __ESCAPE_H
--#define __ESCAPE_H
-+#ifndef HEADER_CURL_ESCAPE_H
-+#define HEADER_CURL_ESCAPE_H
-
- /***************************************************************************
- * _ _ ____ _
-@@ -8,7 +8,7 @@
- * | (__| |_| | _ <| |___
- * \___|\___/|_| \_\_____|
- *
-- * Copyright (C) 1998 - 2006, Daniel Stenberg, <[email protected]>, et al.
-+ * Copyright (C) 1998 - 2011, 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
-@@ -25,5 +25,9 @@
- /* Escape and unescape URL encoding in strings. The functions return a new
- * allocated string or NULL if an error occurred. */
-
-+CURLcode Curl_urldecode(struct SessionHandle *data,
-+ const char *string, size_t length,
-+ char **ostring, size_t *olen,
-+ bool reject_crlf);
-
- #endif
---- lib/imap.c 2010-09-18 14:00:21.000000000 -0700
-+++ lib/imap.c 2012-01-26 09:35:07.180464878 -0800
-@@ -906,17 +906,12 @@
- struct imap_conn *imapc = &conn->proto.imapc;
- struct SessionHandle *data = conn->data;
- const char *path = data->state.path;
-- int len;
-
- if(!*path)
- path = "INBOX";
-
- /* url decode the path and use this mailbox */
-- imapc->mailbox = curl_easy_unescape(data, path, 0, &len);
-- if(!imapc->mailbox)
-- return CURLE_OUT_OF_MEMORY;
--
-- return CURLE_OK;
-+ return Curl_urldecode(data, path, 0, &imapc->mailbox, NULL, TRUE);
- }
-
- /* call this when the DO phase has completed */
---- lib/pop3.c 2010-09-18 14:00:21.000000000 -0700
-+++ lib/pop3.c 2012-01-26 09:35:47.059691860 -0800
-@@ -852,11 +852,7 @@
- const char *path = data->state.path;
-
- /* url decode the path and use this mailbox */
-- pop3c->mailbox = curl_easy_unescape(data, path, 0, NULL);
-- if (!pop3c->mailbox)
-- return CURLE_OUT_OF_MEMORY;
--
-- return CURLE_OK;
-+ return Curl_urldecode(data, path, 0, &pop3c->mailbox, NULL, TRUE);
- }
-
- /* call this when the DO phase has completed */
---- lib/smtp.c 2010-10-12 13:56:21.000000000 -0700
-+++ lib/smtp.c 2012-01-26 09:38:03.856720962 -0800
-@@ -1045,7 +1045,6 @@
- struct SessionHandle *data=conn->data;
- struct pingpong *pp=&smtpc->pp;
- const char *path = conn->data->state.path;
-- int len;
- char localhost[1024 + 1];
-
- *done = FALSE; /* default to not done yet */
-@@ -1119,9 +1118,9 @@
- }
-
- /* url decode the path and use it as domain with EHLO */
-- smtpc->domain = curl_easy_unescape(conn->data, path, 0, &len);
-- if(!smtpc->domain)
-- return CURLE_OUT_OF_MEMORY;
-+ result = Curl_urldecode(conn->data, path, 0, &smtpc->domain, NULL, TRUE);
-+ if(result)
-+ return result;
-
- /* When we connect, we start in the state where we await the server greeting
- */