diff options
author | Lucas Eckels <eckels@google.com> | 2012-08-06 15:07:02 -0700 |
---|---|---|
committer | Lucas Eckels <eckels@google.com> | 2012-08-08 09:28:48 -0700 |
commit | 9bd90e6e25f1e55f50201c87a1b5837de7e5b64a (patch) | |
tree | d2061a00d7d0ee884170bc955fceeed2d0edf284 /lib | |
parent | e6f2b03027b5feb92b30f5d47801ec3fabe9fd95 (diff) | |
download | external_curl-9bd90e6e25f1e55f50201c87a1b5837de7e5b64a.tar.gz external_curl-9bd90e6e25f1e55f50201c87a1b5837de7e5b64a.tar.bz2 external_curl-9bd90e6e25f1e55f50201c87a1b5837de7e5b64a.zip |
Add Music Manager's curl 7.21.2 source.
Change-Id: I259a43fa52d581524a5ce8ae1711467acb1d9d50
Diffstat (limited to 'lib')
134 files changed, 20646 insertions, 2005 deletions
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt new file mode 100644 index 00000000..aec1a3c5 --- /dev/null +++ b/lib/CMakeLists.txt @@ -0,0 +1,124 @@ +set(LIB_NAME libcurl) + +configure_file(${CURL_SOURCE_DIR}/include/curl/curlbuild.h.cmake + ${CURL_BINARY_DIR}/include/curl/curlbuild.h) +configure_file(curl_config.h.cmake + ${CMAKE_CURRENT_BINARY_DIR}/curl_config.h) + +transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake") +include(${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake) + +list(APPEND HHEADERS + ${CMAKE_CURRENT_BINARY_DIR}/curl_config.h + ${CURL_BINARY_DIR}/include/curl/curlbuild.h + ) + +if(MSVC) + list(APPEND CSOURCES libcurl.rc) +endif() + +# SET(CSOURCES +# # memdebug.c -not used +# # nwlib.c - Not used +# # strtok.c - specify later +# # strtoofft.c - specify later +# ) + +# # if we have Kerberos 4, right now this is never on +# #OPTION(CURL_KRB4 "Use Kerberos 4" OFF) +# IF(CURL_KRB4) +# SET(CSOURCES ${CSOURCES} +# krb4.c +# security.c +# ) +# ENDIF(CURL_KRB4) + +# #OPTION(CURL_MALLOC_DEBUG "Debug mallocs in Curl" OFF) +# MARK_AS_ADVANCED(CURL_MALLOC_DEBUG) +# IF(CURL_MALLOC_DEBUG) +# SET(CSOURCES ${CSOURCES} +# memdebug.c +# ) +# ENDIF(CURL_MALLOC_DEBUG) + +# # only build compat strtoofft if we need to +# IF(NOT HAVE_STRTOLL AND NOT HAVE__STRTOI64) +# SET(CSOURCES ${CSOURCES} +# strtoofft.c +# ) +# ENDIF(NOT HAVE_STRTOLL AND NOT HAVE__STRTOI64) + +if(HAVE_FEATURES_H) + set_source_files_properties( + cookie.c + easy.c + formdata.c + getenv.c + nonblock.c + hash.c + http.c + if2ip.c + mprintf.c + multi.c + sendf.c + telnet.c + transfer.c + url.c + COMPILE_FLAGS -D_BSD_SOURCE) +endif(HAVE_FEATURES_H) + + +# The rest of the build + +include_directories(${CMAKE_CURRENT_BINARY_DIR}/../include) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../include) +include_directories(${CMAKE_CURRENT_BINARY_DIR}/..) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) +include_directories(${CMAKE_CURRENT_BINARY_DIR}) +if(CURL_USE_ARES) + include_directories(${CARES_INCLUDE_DIR}) +endif() + +if(CURL_STATICLIB) + # Static lib + set(CURL_USER_DEFINED_DYNAMIC_OR_STATIC STATIC) +else() + # DLL / so dynamic lib + set(CURL_USER_DEFINED_DYNAMIC_OR_STATIC SHARED) +endif() + +add_library( + ${LIB_NAME} + ${CURL_USER_DEFINED_DYNAMIC_OR_STATIC} + ${HHEADERS} ${CSOURCES} + ) + +target_link_libraries(${LIB_NAME} ${CURL_LIBS}) + +if(WIN32) + add_definitions( -D_USRDLL ) +endif() + +set_target_properties(${LIB_NAME} PROPERTIES COMPILE_DEFINITIONS BUILDING_LIBCURL) + +setup_curl_dependencies(${LIB_NAME}) + +# Remove the "lib" prefix since the library is already named "libcurl". +set_target_properties(${LIB_NAME} PROPERTIES PREFIX "") +set_target_properties(${LIB_NAME} PROPERTIES IMPORT_PREFIX "") + +if(MSVC) + if(NOT BUILD_RELEASE_DEBUG_DIRS) + # Ugly workaround to remove the "/debug" or "/release" in each output + set_target_properties(${LIB_NAME} PROPERTIES PREFIX "../") + set_target_properties(${LIB_NAME} PROPERTIES IMPORT_PREFIX "../") + endif() +endif() + +if(WIN32) + if(NOT CURL_STATICLIB) + # Add "_imp" as a suffix before the extension to avoid conflicting with the statically linked "libcurl.lib" + set_target_properties(${LIB_NAME} PROPERTIES IMPORT_SUFFIX "_imp.lib") + endif() +endif() diff --git a/lib/Makefile.Watcom b/lib/Makefile.Watcom new file mode 100644 index 00000000..a611be60 --- /dev/null +++ b/lib/Makefile.Watcom @@ -0,0 +1,222 @@ +# +# Watcom / OpenWatcom / Win32 makefile for libcurl. +# G. Vanem <gvanem@broadpark.no> +# + +!ifndef %watcom +!error WATCOM environment variable not set! +!else +SYS_INCL = -I$(%watcom)\h\nt -I$(%watcom)\h +SYS_LIBS = $(%watcom)\lib386\nt;$(%watcom)\lib386 +!endif + +!ifdef %libname +LIBNAME = $(%libname) +!else +LIBNAME = libcurl +!endif +TARGETS = $(LIBNAME).dll $(LIBNAME)_imp.lib $(LIBNAME).lib + +CC = wcc386 +LD = wlink +AR = wlib +RC = wrc + +!ifdef __LOADDLL__ +! loaddll wcc386 wccd386 +! loaddll wpp386 wppd386 +! loaddll wlib wlibd +! if $(__VERSION__) > 1270 +! loaddll wlink wlinkd +! else +! loaddll wlink wlink +! endif +!endif + +!if $(__VERSION__) < 1250 +RM = del /q /f 2>NUL +!else +RM = rm -f +!endif +MD = mkdir +RD = rmdir /q /s 2>NUL +CP = copy + +CFLAGS = -3r -mf -hc -zff -zgf -zq -zm -zc -s -fr=con -w2 -fpi -oilrtfm & + -wcd=201 -bt=nt -d+ -dWIN32 -dCURL_WANTS_CA_BUNDLE_ENV & + -dBUILDING_LIBCURL -dHAVE_SPNEGO=1 -I. -I..\include $(SYS_INCL) + +!ifdef %debug +DEBUG = -dDEBUG=1 -dDEBUGBUILD +CFLAGS += -d3 $(DEBUG) +!else +CFLAGS += -d0 +!endif + +!ifdef %use_ipv6 +CFLAGS += -d_WIN32_WINNT=0x0501 -dENABLE_IPV6 +!endif + +!ifdef %use_sspi +CFLAGS += -dUSE_WINDOWS_SSPI +!endif + +# +# Change to suite. +# +!ifdef %zlib_root +ZLIB_ROOT = $(%zlib_root) +!else +ZLIB_ROOT = ..\..\zlib-1.2.5 +!endif + +!ifdef %libssh2_root +LIBSSH2_ROOT = $(%libssh2_root) +!else +LIBSSH2_ROOT = ..\..\libssh2-1.2.7 +!endif + +!ifdef %librtmp_root +LIBRTMP_ROOT = $(%librtmp_root) +!else +LIBRTMP_ROOT = ..\..\librtmp-2.3 +!endif + +!ifdef %openssl_root +OPENSSL_ROOT = $(%openssl_root) +!else +OPENSSL_ROOT = ..\..\openssl-0.9.8o +!endif + +!ifdef %ares_root +ARES_ROOT = $(%ares_root) +!else +ARES_ROOT = ..\ares +!endif + +!ifdef %use_zlib +CFLAGS += -dHAVE_ZLIB_H -dHAVE_LIBZ -I$(ZLIB_ROOT) +!endif + +!ifdef %use_rtmp +CFLAGS += -dUSE_LIBRTMP -I$(LIBRTMP_ROOT) +!endif + +!ifdef %use_ssh2 +CFLAGS += -DUSE_LIBSSH2 -DHAVE_LIBSSH2_H -I$(LIBSSH2_ROOT)\include -I$(LIBSSH2_ROOT)\win32 +!endif + +!ifdef %use_ssl +CFLAGS += -wcd=138 -dUSE_OPENSSL -dUSE_SSLEAY -I$(OPENSSL_ROOT)\inc32 +!endif + +!ifdef %use_ares +CFLAGS += -dUSE_ARES -I$(ARES_ROOT) +!endif + +!ifdef %use_watt32 +CFLAGS += -dUSE_WATT32 -I$(%watt_root)\inc +!endif + +OBJ_BASE = WC_Win32.obj +LINK_ARG = $(OBJ_BASE)\dyn\wlink.arg +LIB_ARG = $(OBJ_BASE)\stat\wlib.arg + +# In order to process Makefile.inc wmake must be called with -u switch! +!ifndef %MAKEFLAGS +!error You MUST call wmake with the -u switch! +!else +!include Makefile.inc +!endif + +OBJS = $(CSOURCES:.c=.obj) +OBJS = $OBJ_DIR\$(OBJS: = $OBJ_DIR\) + +# +# Use $(OBJS) as a template to generate $(OBJS_STAT) and $(OBJS_DYN). +# +OBJ_DIR = $(OBJ_BASE)\stat +OBJS_STAT = $+ $(OBJS) $- + +OBJ_DIR = $(OBJ_BASE)\dyn +OBJS_DYN = $+ $(OBJS) $- + +CURLBUILDH = ..\include\curl\curlbuild.h +RESOURCE = $(OBJ_BASE)\dyn\libcurl.res + +all: $(CURLBUILDH) $(OBJ_BASE) $(TARGETS) .SYMBOLIC + @echo Welcome to libcurl + +clean: .SYMBOLIC + -$(RM) $(OBJS_STAT) + -$(RM) $(OBJS_DYN) + -$(RM) $(RESOURCE) $(LINK_ARG) $(LIB_ARG) + +vclean distclean: clean .SYMBOLIC + -$(RM) $(TARGETS) $(LIBNAME).map $(LIBNAME).sym + -$(RD) $(OBJ_BASE)\stat + -$(RD) $(OBJ_BASE)\dyn + -$(RD) $(OBJ_BASE) + +$(OBJ_BASE): + -$(MD) $^@ + -$(MD) $^@\stat + -$(MD) $^@\dyn + +$(CURLBUILDH): .EXISTSONLY + $(CP) $^@.dist $^@ + +$(LIBNAME).dll: $(OBJS_DYN) $(RESOURCE) $(LINK_ARG) + $(LD) name $^@ @$]@ + +$(LIBNAME).lib: $(OBJS_STAT) $(LIB_ARG) + $(AR) -q -b -c $^@ @$]@ + +.ERASE +$(RESOURCE): libcurl.rc + $(RC) $(DEBUG) -q -r -zm -I..\include $(SYS_INCL) $[@ -fo=$^@ + +.ERASE +.c{$(OBJ_BASE)\dyn}.obj: + $(CC) $(CFLAGS) -bd -br $[@ -fo=$^@ + +.ERASE +.c{$(OBJ_BASE)\stat}.obj: + $(CC) $(CFLAGS) -DCURL_STATICLIB $[@ -fo=$^@ + +$(LINK_ARG): $(__MAKEFILES__) + %create $^@ + @%append $^@ system nt dll + @%append $^@ file { $(OBJS_DYN) } +!ifdef %debug + @%append $^@ debug all + @%append $^@ option symfile +!endif + @%append $^@ option quiet, map, caseexact, eliminate, implib=$(LIBNAME)_imp.lib, + @%append $^@ res=$(RESOURCE) libpath $(SYS_LIBS) + @%append $^@ library wldap32.lib +!ifdef %use_watt32 + @%append $^@ library $(%watt_root)\lib\wattcpw_imp.lib +!else + @%append $^@ library ws2_32.lib +!endif +!ifdef %use_zlib + @%append $^@ library $(ZLIB_ROOT)\zlib.lib +!endif +!ifdef %use_rtmp + @%append $^@ library $(LIBRTMP_ROOT)\librtmp\librtmp.lib +!endif +!ifdef %use_ssh2 + @%append $^@ library $(LIBSSH2_ROOT)\win32\libssh2.lib +!endif +!ifdef %use_ssl + @%append $^@ library $(OPENSSL_ROOT)\out32\libeay32.lib, $(OPENSSL_ROOT)\out32\ssleay32.lib +!endif +!ifdef %use_ares + @%append $^@ library $(ARES_ROOT)\cares.lib +!endif + +$(LIB_ARG): $(__MAKEFILES__) + %create $^@ + @for %f in ($(OBJS_STAT)) do @%append $^@ +- %f + diff --git a/lib/Makefile.am b/lib/Makefile.am new file mode 100644 index 00000000..9a603320 --- /dev/null +++ b/lib/Makefile.am @@ -0,0 +1,175 @@ +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, 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. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### +AUTOMAKE_OPTIONS = foreign nostdinc + +DSP = vc6libcurl.dsp +VCPROJ = libcurl.vcproj + +DOCS = README.encoding README.memoryleak README.ares README.curlx \ + README.hostip README.multi_socket README.httpauth README.pipelining \ + README.curl_off_t README.pingpong + +CMAKE_DIST = CMakeLists.txt curl_config.h.cmake + +EXTRA_DIST = Makefile.b32 Makefile.m32 Makefile.vc6 Makefile.riscos $(DSP) \ + vc6libcurl.dsw config-win32.h config-win32ce.h config-riscos.h \ + config-mac.h curl_config.h.in makefile.dj config.dos libcurl.plist \ + libcurl.rc config-amigaos.h amigaos.c amigaos.h makefile.amiga \ + Makefile.netware nwlib.c nwos.c libcurl.imp msvcproj.head msvcproj.foot \ + config-win32ce.h config-os400.h setup-os400.h config-symbian.h \ + Makefile.Watcom config-tpf.h $(DOCS) $(VCPROJ) mk-ca-bundle.pl \ + mk-ca-bundle.vbs firefox-db2pem.sh $(CMAKE_DIST) config-vxworks.h \ + Makefile.vxworks + +CLEANFILES = $(DSP) $(VCPROJ) + +lib_LTLIBRARIES = libcurl.la +LIBCURL_LIBS = @LIBCURL_LIBS@ + +# This might hold -Werror +CFLAGS += @CURL_CFLAG_EXTRAS@ + +# Specify our include paths here, and do it relative to $(top_srcdir) and +# $(top_builddir), to ensure that these paths which belong to the library +# being currently built and tested are searched before the library which +# might possibly already be installed in the system. +# +# $(top_builddir)/include/curl for generated curlbuild.h included from curl.h +# $(top_builddir)/include for generated curlbuild.h included from lib/setup.h +# $(top_srcdir)/include is for libcurl's external include files +# $(top_builddir)/lib is for libcurl's generated lib/curl_config.h file +# $(top_srcdir)/lib is for libcurl's lib/setup.h and other "private" files +# $(top_builddir)/ares is for in-tree c-ares's generated ares_build.h file +# $(top_srcdir)/ares is for in-tree c-ares's external include files + +if USE_EMBEDDED_ARES +INCLUDES = -I$(top_builddir)/include/curl \ + -I$(top_builddir)/include \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/lib \ + -I$(top_srcdir)/lib \ + -I$(top_builddir)/ares \ + -I$(top_srcdir)/ares +else +INCLUDES = -I$(top_builddir)/include/curl \ + -I$(top_builddir)/include \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/lib \ + -I$(top_srcdir)/lib +endif + +if SONAME_BUMP +# +# Bumping of SONAME conditionally may seem like a weird thing to do, and yeah +# it is. The problem is that we try to avoid the bump as hard as possible, but +# yet it is still necessary for a few rare situations. The configure script will +# attempt to figure out these situations, and it can be forced to consider this +# to be such a case! See README.curl_off_t for further details. +# +# This conditional soname bump SHOULD be removed at next "proper" bump. +# +VERSIONINFO=-version-info 7:0:2 +else +VERSIONINFO=-version-info 6:0:2 +endif + +# 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 +# 1. +# +# Here's the simplified rule guide on how to change -version-info: +# (current version is C:R:A) +# +# 1. if there are only source changes, use C:R+1:A +# 2. if interfaces were added use C+1:0:A+1 +# 3. if interfaces were removed, then use C+1:0:0 +# +# For the full guide on libcurl ABI rules, see docs/libcurl/ABI + +if NO_UNDEFINED +# The -no-undefined flag is CRUCIAL for this to build fine on Cygwin. +UNDEF = -no-undefined +endif + +if MIMPURE +# This is for gcc on Solaris (8+ ?) to avoid "relocations remain against +# allocatable but non-writable sections" problems. +MIMPURE = -mimpure-text +endif + +libcurl_la_LDFLAGS = $(UNDEF) $(VERSIONINFO) $(MIMPURE) $(LIBCURL_LIBS) + +# Makefile.inc provides the CSOURCES and HHEADERS defines +include Makefile.inc + +libcurl_la_SOURCES = $(CSOURCES) $(HHEADERS) + +WIN32SOURCES = $(CSOURCES) +WIN32HEADERS = $(HHEADERS) config-win32.h + +DSPOUT = | awk '{printf("%s\r\n", $$0)}' >> $(DSP) +VCPROJOUT = | awk '{printf("%s\r\n", $$0)}' >> $(VCPROJ) + +$(DSP): msvcproj.head msvcproj.foot Makefile.am + echo "creating $(DSP)" + @(cp $(srcdir)/msvcproj.head $(DSP); \ + echo "# Begin Group \"Source Files\"" $(DSPOUT); \ + echo "" $(DSPOUT); \ + echo "# PROP Default_Filter \"\"" $(DSPOUT); \ + win32_srcs='$(WIN32SOURCES)'; \ + sorted_srcs=`for file in $$win32_srcs; do echo $$file; done | sort`; \ + for file in $$sorted_srcs; do \ + echo "# Begin Source File" $(DSPOUT); \ + echo "" $(DSPOUT); \ + echo "SOURCE=.\\"$$file $(DSPOUT); \ + echo "# End Source File" $(DSPOUT); \ + done; \ + echo "# End Group" $(DSPOUT); \ + echo "# Begin Group \"Header Files\"" $(DSPOUT); \ + echo "" $(DSPOUT); \ + echo "# PROP Default_Filter \"\"" $(DSPOUT); \ + win32_hdrs='$(WIN32HEADERS)'; \ + sorted_hdrs=`for file in $$win32_hdrs; do echo $$file; done | sort`; \ + for file in $$sorted_hdrs; do \ + echo "# Begin Source File" $(DSPOUT); \ + echo "" $(DSPOUT); \ + echo "SOURCE=.\\"$$file $(DSPOUT); \ + echo "# End Source File" $(DSPOUT); \ + done; \ + echo "# End Group" $(DSPOUT); \ + cat $(srcdir)/msvcproj.foot $(DSPOUT) ) + +$(VCPROJ): vc8proj.head vc8proj.foot Makefile.am + echo "creating $(VCPROJ)" + @(cp $(srcdir)/vc8proj.head $(VCPROJ); \ + win32_srcs='$(WIN32SOURCES)'; \ + sorted_srcs=`for file in $$win32_srcs; do echo $$file; done | sort`; \ + for file in $$sorted_srcs; do \ + echo "<File RelativePath=\""$$file"\"></File>" $(VCPROJOUT); \ + done; \ + echo "</Filter><Filter Name=\"Header Files\">" $(VCPROJOUT); \ + win32_hdrs='$(WIN32HEADERS)'; \ + sorted_hdrs=`for file in $$win32_hdrs; do echo $$file; done | sort`; \ + for file in $$sorted_hdrs; do \ + echo "<File RelativePath=\""$$file"\"></File>" $(VCPROJOUT); \ + done; \ + cat $(srcdir)/vc8proj.foot $(VCPROJOUT) ) diff --git a/lib/Makefile.b32 b/lib/Makefile.b32 new file mode 100644 index 00000000..509ae270 --- /dev/null +++ b/lib/Makefile.b32 @@ -0,0 +1,89 @@ +############################################################ +# +# Makefile.b32 - Borland's C++ Compiler 5.X +# +# 'lib' directory +# +# 'BCCDIR' has to be set up to point to the base directory +# of the compiler, i.e. SET BCCDIR = c:\Borland\BCC55 +# where c:\Borland\BCC55 is the compiler is installed +# +# Written by Jaepil Kim, pit@paradise.net.nz +############################################################ + +# Edit the path below to point to the base of your Zlib sources. +!ifndef ZLIB_PATH +ZLIB_PATH = ../../zlib-1.2.1 +!endif + +# Edit the path below to point to the base of your OpenSSL package. +!ifndef OPENSSL_PATH +OPENSSL_PATH = ../../openssl-0.9.7d +!endif + +# Set libcurl static lib, dll and import lib +LIBCURL_LIB = libcurl.lib +LIBCURL_DLL = libcurl.dll +LIBCURL_IMPLIB = libcurl_imp.lib + +# Setup environment +CXX = bcc32 +LD = bcc32 +CP = copy +RM = del +LIB = tlib +IMPLIB = implib + +CXXFLAGS = -q -5 -O2 -w-aus -w-ccc -w-csu -w-par -w-pia -w-rch -w-inl -w-ngu -w-pro -tWM +LIBFLAGS = /C /P32 +LDFLAGS = -q -lq -laa -tWD + +INCDIRS = -I.;../include +LINKLIB = $(BCCDIR)/lib/cw32mt.lib + +# If you build with SSL support, set WITH_SSL=1 +DEFINES = -DNDEBUG -DWIN32 -D_CONSOLE -D_MBCS -DBUILDING_LIBCURL + +!ifdef WITH_ZLIB +DEFINES = $(DEFINES) -DHAVE_LIBZ -DHAVE_ZLIB_H +INCDIRS = $(INCDIRS);$(ZLIB_PATH) +LINKLIB = $(LINKLIB) $(ZLIB_PATH)/zlib.lib +!endif + +!ifdef WITH_SSL +DEFINES = $(DEFINES) -DUSE_SSLEAY +INCDIRS = $(INCDIRS);$(OPENSSL_PATH)/inc32;$(OPENSSL_PATH)/inc32/openssl +LINKLIB = $(LINKLIB) $(OPENSSL_PATH)/out32/ssleay32.lib $(OPENSSL_PATH)/out32/libeay32.lib +!endif + +.autodepend + +# Makefile.inc provides the CSOURCES and HHEADERS defines +!include Makefile.inc + +OBJECTS = $(CSOURCES:.c=.obj) + +.c.obj: + $(CXX) -c $(INCDIRS) $(CXXFLAGS) $(DEFINES) $< + +all: $(LIBCURL_LIB) $(LIBCURL_DLL) + +clean: + -$(RM) $(LIBCURL_LIB) + -$(RM) $(LIBCURL_IMPLIB) + -$(RM) libcurl.tds + -$(RM) *.obj + +$(LIBCURL_LIB): $(OBJECTS) + @-$(RM) $@ + $(LIB) $(LIBFLAGS) $@ @&&! ++$(**: = &^ ++) +! + +$(LIBCURL_DLL) $(LIBCURL_IMPLIB): $(OBJECTS) $(LINKLIB) + @-$(RM) $(LIBCURL_DLL) + @-$(RM) $(LIBCURL_IMPLIB) + $(LD) $(LDFLAGS) -e$(LIBCURL_DLL) $** + $(IMPLIB) $(LIBCURL_IMPLIB) $(LIBCURL_DLL) + diff --git a/lib/Makefile.in b/lib/Makefile.in new file mode 100644 index 00000000..a4beebe8 --- /dev/null +++ b/lib/Makefile.in @@ -0,0 +1,865 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# ./lib/Makefile.inc +# Using the backslash as line continuation character might be problematic +# with some make flavours, as Watcom's wmake showed us already. If we +# ever want to change this in a portable manner then we should consider +# this idea (posted to the libcurl list by Adam Kellas): +# CSRC1 = file1.c file2.c file3.c +# CSRC2 = file4.c file5.c file6.c +# CSOURCES = $(CSRC1) $(CSRC2) + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/Makefile.inc $(srcdir)/curl_config.h.in +subdir = lib +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/curl-compilers.m4 \ + $(top_srcdir)/m4/curl-confopts.m4 \ + $(top_srcdir)/m4/curl-functions.m4 \ + $(top_srcdir)/m4/curl-override.m4 \ + $(top_srcdir)/m4/curl-reentrant.m4 \ + $(top_srcdir)/m4/curl-system.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = curl_config.h $(top_builddir)/src/curl_config.h \ + $(top_builddir)/include/curl/curlbuild.h +CONFIG_CLEAN_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(libdir)" +libLTLIBRARIES_INSTALL = $(INSTALL) +LTLIBRARIES = $(lib_LTLIBRARIES) +libcurl_la_LIBADD = +am__objects_1 = file.lo timeval.lo base64.lo hostip.lo progress.lo \ + formdata.lo cookie.lo http.lo sendf.lo ftp.lo url.lo dict.lo \ + if2ip.lo speedcheck.lo ldap.lo ssluse.lo version.lo getenv.lo \ + escape.lo mprintf.lo telnet.lo netrc.lo getinfo.lo transfer.lo \ + strequal.lo easy.lo security.lo krb4.lo curl_fnmatch.lo \ + fileinfo.lo ftplistparser.lo wildcard.lo krb5.lo memdebug.lo \ + http_chunks.lo strtok.lo connect.lo llist.lo hash.lo multi.lo \ + content_encoding.lo share.lo http_digest.lo md4.lo md5.lo \ + curl_rand.lo http_negotiate.lo http_ntlm.lo inet_pton.lo \ + strtoofft.lo strerror.lo hostares.lo hostasyn.lo hostip4.lo \ + hostip6.lo hostsyn.lo hostthre.lo inet_ntop.lo parsedate.lo \ + select.lo gtls.lo sslgen.lo tftp.lo splay.lo strdup.lo \ + socks.lo ssh.lo nss.lo qssl.lo rawstr.lo curl_addrinfo.lo \ + socks_gssapi.lo socks_sspi.lo curl_sspi.lo slist.lo \ + nonblock.lo curl_memrchr.lo imap.lo pop3.lo smtp.lo \ + pingpong.lo rtsp.lo curl_threads.lo warnless.lo hmac.lo \ + polarssl.lo curl_rtmp.lo openldap.lo curl_gethostname.lo \ + gopher.lo +am__objects_2 = +am_libcurl_la_OBJECTS = $(am__objects_1) $(am__objects_2) +libcurl_la_OBJECTS = $(am_libcurl_la_OBJECTS) +DEFAULT_INCLUDES = +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libcurl_la_SOURCES) +DIST_SOURCES = $(libcurl_la_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BUILD_LIBHOSTNAME_FALSE = @BUILD_LIBHOSTNAME_FALSE@ +BUILD_LIBHOSTNAME_TRUE = @BUILD_LIBHOSTNAME_TRUE@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ + +# This might hold -Werror +CFLAGS = @CFLAGS@ @CURL_CFLAG_EXTRAS@ +CONFIGURE_OPTIONS = @CONFIGURE_OPTIONS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CROSSCOMPILING_FALSE = @CROSSCOMPILING_FALSE@ +CROSSCOMPILING_TRUE = @CROSSCOMPILING_TRUE@ +CURLDEBUG_FALSE = @CURLDEBUG_FALSE@ +CURLDEBUG_TRUE = @CURLDEBUG_TRUE@ +CURL_CA_BUNDLE = @CURL_CA_BUNDLE@ +CURL_CFLAG_EXTRAS = @CURL_CFLAG_EXTRAS@ +CURL_DISABLE_DICT = @CURL_DISABLE_DICT@ +CURL_DISABLE_FILE = @CURL_DISABLE_FILE@ +CURL_DISABLE_FTP = @CURL_DISABLE_FTP@ +CURL_DISABLE_GOPHER = @CURL_DISABLE_GOPHER@ +CURL_DISABLE_HTTP = @CURL_DISABLE_HTTP@ +CURL_DISABLE_IMAP = @CURL_DISABLE_IMAP@ +CURL_DISABLE_LDAP = @CURL_DISABLE_LDAP@ +CURL_DISABLE_LDAPS = @CURL_DISABLE_LDAPS@ +CURL_DISABLE_POP3 = @CURL_DISABLE_POP3@ +CURL_DISABLE_PROXY = @CURL_DISABLE_PROXY@ +CURL_DISABLE_RTSP = @CURL_DISABLE_RTSP@ +CURL_DISABLE_SMTP = @CURL_DISABLE_SMTP@ +CURL_DISABLE_TELNET = @CURL_DISABLE_TELNET@ +CURL_DISABLE_TFTP = @CURL_DISABLE_TFTP@ +CURL_LIBS = @CURL_LIBS@ +CURL_NETWORK_LIBS = @CURL_NETWORK_LIBS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_SHARED = @ENABLE_SHARED@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +HAVE_LDAP_SSL = @HAVE_LDAP_SSL@ +HAVE_LIBZ = @HAVE_LIBZ@ +HAVE_LIBZ_FALSE = @HAVE_LIBZ_FALSE@ +HAVE_LIBZ_TRUE = @HAVE_LIBZ_TRUE@ +HAVE_PK11_CREATEGENERICOBJECT = @HAVE_PK11_CREATEGENERICOBJECT@ +IDN_ENABLED = @IDN_ENABLED@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +IPV6_ENABLED = @IPV6_ENABLED@ +KRB4_ENABLED = @KRB4_ENABLED@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBCURL_LIBS = @LIBCURL_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +MANOPT = @MANOPT@ +MIMPURE_FALSE = @MIMPURE_FALSE@ +MIMPURE_TRUE = @MIMPURE_TRUE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NO_UNDEFINED_FALSE = @NO_UNDEFINED_FALSE@ +NO_UNDEFINED_TRUE = @NO_UNDEFINED_TRUE@ +NROFF = @NROFF@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH = @PATH@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +PKGADD_NAME = @PKGADD_NAME@ +PKGADD_PKG = @PKGADD_PKG@ +PKGADD_VENDOR = @PKGADD_VENDOR@ +PKGCONFIG = @PKGCONFIG@ +RANDOM_FILE = @RANDOM_FILE@ +RANLIB = @RANLIB@ +REQUIRE_LIB_DEPS = @REQUIRE_LIB_DEPS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SONAME_BUMP_FALSE = @SONAME_BUMP_FALSE@ +SONAME_BUMP_TRUE = @SONAME_BUMP_TRUE@ +SSL_ENABLED = @SSL_ENABLED@ +STATICLIB_FALSE = @STATICLIB_FALSE@ +STATICLIB_TRUE = @STATICLIB_TRUE@ +STRIP = @STRIP@ +SUPPORT_FEATURES = @SUPPORT_FEATURES@ +SUPPORT_PROTOCOLS = @SUPPORT_PROTOCOLS@ +TEST_SERVER_LIBS = @TEST_SERVER_LIBS@ +USE_ARES = @USE_ARES@ +USE_EMBEDDED_ARES_FALSE = @USE_EMBEDDED_ARES_FALSE@ +USE_EMBEDDED_ARES_TRUE = @USE_EMBEDDED_ARES_TRUE@ +USE_GNUTLS = @USE_GNUTLS@ +USE_LIBRTMP = @USE_LIBRTMP@ +USE_LIBSSH2 = @USE_LIBSSH2@ +USE_MANUAL_FALSE = @USE_MANUAL_FALSE@ +USE_MANUAL_TRUE = @USE_MANUAL_TRUE@ +USE_NSS = @USE_NSS@ +USE_OPENLDAP = @USE_OPENLDAP@ +USE_POLARSSL = @USE_POLARSSL@ +USE_SSLEAY = @USE_SSLEAY@ +USE_WINDOWS_SSPI = @USE_WINDOWS_SSPI@ +VERSION = @VERSION@ +VERSIONNUM = @VERSIONNUM@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +libext = @libext@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +subdirs = @subdirs@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ + +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, 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. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### +AUTOMAKE_OPTIONS = foreign nostdinc +DSP = vc6libcurl.dsp +VCPROJ = libcurl.vcproj +DOCS = README.encoding README.memoryleak README.ares README.curlx \ + README.hostip README.multi_socket README.httpauth README.pipelining \ + README.curl_off_t README.pingpong + +CMAKE_DIST = CMakeLists.txt curl_config.h.cmake +EXTRA_DIST = Makefile.b32 Makefile.m32 Makefile.vc6 Makefile.riscos $(DSP) \ + vc6libcurl.dsw config-win32.h config-win32ce.h config-riscos.h \ + config-mac.h curl_config.h.in makefile.dj config.dos libcurl.plist \ + libcurl.rc config-amigaos.h amigaos.c amigaos.h makefile.amiga \ + Makefile.netware nwlib.c nwos.c libcurl.imp msvcproj.head msvcproj.foot \ + config-win32ce.h config-os400.h setup-os400.h config-symbian.h \ + Makefile.Watcom config-tpf.h $(DOCS) $(VCPROJ) mk-ca-bundle.pl \ + mk-ca-bundle.vbs firefox-db2pem.sh $(CMAKE_DIST) config-vxworks.h \ + Makefile.vxworks + +CLEANFILES = $(DSP) $(VCPROJ) +lib_LTLIBRARIES = libcurl.la +@USE_EMBEDDED_ARES_FALSE@INCLUDES = -I$(top_builddir)/include/curl \ +@USE_EMBEDDED_ARES_FALSE@ -I$(top_builddir)/include \ +@USE_EMBEDDED_ARES_FALSE@ -I$(top_srcdir)/include \ +@USE_EMBEDDED_ARES_FALSE@ -I$(top_builddir)/lib \ +@USE_EMBEDDED_ARES_FALSE@ -I$(top_srcdir)/lib + + +# Specify our include paths here, and do it relative to $(top_srcdir) and +# $(top_builddir), to ensure that these paths which belong to the library +# being currently built and tested are searched before the library which +# might possibly already be installed in the system. +# +# $(top_builddir)/include/curl for generated curlbuild.h included from curl.h +# $(top_builddir)/include for generated curlbuild.h included from lib/setup.h +# $(top_srcdir)/include is for libcurl's external include files +# $(top_builddir)/lib is for libcurl's generated lib/curl_config.h file +# $(top_srcdir)/lib is for libcurl's lib/setup.h and other "private" files +# $(top_builddir)/ares is for in-tree c-ares's generated ares_build.h file +# $(top_srcdir)/ares is for in-tree c-ares's external include files +@USE_EMBEDDED_ARES_TRUE@INCLUDES = -I$(top_builddir)/include/curl \ +@USE_EMBEDDED_ARES_TRUE@ -I$(top_builddir)/include \ +@USE_EMBEDDED_ARES_TRUE@ -I$(top_srcdir)/include \ +@USE_EMBEDDED_ARES_TRUE@ -I$(top_builddir)/lib \ +@USE_EMBEDDED_ARES_TRUE@ -I$(top_srcdir)/lib \ +@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 + +# +# Bumping of SONAME conditionally may seem like a weird thing to do, and yeah +# it is. The problem is that we try to avoid the bump as hard as possible, but +# yet it is still necessary for a few rare situations. The configure script will +# attempt to figure out these situations, and it can be forced to consider this +# to be such a case! See README.curl_off_t for further details. +# +# This conditional soname bump SHOULD be removed at next "proper" bump. +# +@SONAME_BUMP_TRUE@VERSIONINFO = -version-info 7:0:2 + +# 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 +# 1. +# +# Here's the simplified rule guide on how to change -version-info: +# (current version is C:R:A) +# +# 1. if there are only source changes, use C:R+1:A +# 2. if interfaces were added use C+1:0:A+1 +# 3. if interfaces were removed, then use C+1:0:0 +# +# For the full guide on libcurl ABI rules, see docs/libcurl/ABI + +# The -no-undefined flag is CRUCIAL for this to build fine on Cygwin. +@NO_UNDEFINED_TRUE@UNDEF = -no-undefined + +# This is for gcc on Solaris (8+ ?) to avoid "relocations remain against +# allocatable but non-writable sections" problems. +@MIMPURE_TRUE@MIMPURE = -mimpure-text +libcurl_la_LDFLAGS = $(UNDEF) $(VERSIONINFO) $(MIMPURE) $(LIBCURL_LIBS) +CSOURCES = file.c timeval.c base64.c hostip.c progress.c formdata.c \ + cookie.c http.c sendf.c ftp.c url.c dict.c if2ip.c speedcheck.c \ + ldap.c ssluse.c version.c getenv.c escape.c mprintf.c telnet.c \ + netrc.c getinfo.c transfer.c strequal.c easy.c security.c krb4.c \ + curl_fnmatch.c fileinfo.c ftplistparser.c wildcard.c krb5.c \ + memdebug.c http_chunks.c strtok.c connect.c llist.c hash.c multi.c \ + content_encoding.c share.c http_digest.c md4.c md5.c curl_rand.c \ + http_negotiate.c http_ntlm.c inet_pton.c strtoofft.c strerror.c \ + hostares.c hostasyn.c hostip4.c hostip6.c hostsyn.c hostthre.c \ + inet_ntop.c parsedate.c select.c gtls.c sslgen.c tftp.c splay.c \ + strdup.c socks.c ssh.c nss.c qssl.c rawstr.c curl_addrinfo.c \ + socks_gssapi.c socks_sspi.c curl_sspi.c slist.c nonblock.c \ + curl_memrchr.c imap.c pop3.c smtp.c pingpong.c rtsp.c curl_threads.c \ + warnless.c hmac.c polarssl.c curl_rtmp.c openldap.c curl_gethostname.c\ + gopher.c + +HHEADERS = arpa_telnet.h netrc.h file.h timeval.h qssl.h hostip.h \ + progress.h formdata.h cookie.h http.h sendf.h ftp.h url.h dict.h \ + if2ip.h speedcheck.h urldata.h curl_ldap.h ssluse.h escape.h telnet.h \ + getinfo.h strequal.h krb4.h memdebug.h http_chunks.h curl_rand.h \ + curl_fnmatch.h wildcard.h fileinfo.h ftplistparser.h strtok.h \ + connect.h llist.h hash.h content_encoding.h share.h curl_md4.h \ + curl_md5.h http_digest.h http_negotiate.h http_ntlm.h inet_pton.h \ + strtoofft.h strerror.h inet_ntop.h curlx.h curl_memory.h setup.h \ + transfer.h select.h easyif.h multiif.h parsedate.h sslgen.h gtls.h \ + tftp.h sockaddr.h splay.h strdup.h setup_once.h socks.h ssh.h nssg.h \ + curl_base64.h rawstr.h curl_addrinfo.h curl_sspi.h slist.h nonblock.h \ + curl_memrchr.h imap.h pop3.h smtp.h pingpong.h rtsp.h curl_threads.h \ + warnless.h curl_hmac.h polarssl.h curl_rtmp.h curl_gethostname.h \ + gopher.h + + +# Makefile.inc provides the CSOURCES and HHEADERS defines +libcurl_la_SOURCES = $(CSOURCES) $(HHEADERS) +WIN32SOURCES = $(CSOURCES) +WIN32HEADERS = $(HHEADERS) config-win32.h +DSPOUT = | awk '{printf("%s\r\n", $$0)}' >> $(DSP) +VCPROJOUT = | awk '{printf("%s\r\n", $$0)}' >> $(VCPROJ) +all: curl_config.h + $(MAKE) $(AM_MAKEFLAGS) all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/Makefile.inc $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign lib/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign lib/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +curl_config.h: stamp-h1 + @if test ! -f $@; then \ + rm -f stamp-h1; \ + $(MAKE) stamp-h1; \ + else :; fi + +stamp-h1: $(srcdir)/curl_config.h.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status lib/curl_config.h +$(srcdir)/curl_config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_srcdir) && $(AUTOHEADER) + rm -f stamp-h1 + touch $@ + +distclean-hdr: + -rm -f curl_config.h stamp-h1 +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ + else :; fi; \ + done + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ + $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libcurl.la: $(libcurl_la_OBJECTS) $(libcurl_la_DEPENDENCIES) + $(LINK) -rpath $(libdir) $(libcurl_la_LDFLAGS) $(libcurl_la_OBJECTS) $(libcurl_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/base64.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/connect.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/content_encoding.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cookie.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/curl_addrinfo.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/curl_fnmatch.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/curl_gethostname.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/curl_memrchr.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/curl_rand.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/curl_rtmp.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/curl_sspi.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/curl_threads.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dict.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/easy.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/escape.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fileinfo.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/formdata.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftp.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftplistparser.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getenv.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getinfo.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gopher.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gtls.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hash.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hmac.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hostares.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hostasyn.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hostip.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hostip4.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hostip6.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hostsyn.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hostthre.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/http.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/http_chunks.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/http_digest.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/http_negotiate.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/http_ntlm.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/if2ip.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/imap.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/inet_ntop.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/inet_pton.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/krb4.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/krb5.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ldap.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/llist.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/md4.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/md5.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memdebug.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mprintf.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/multi.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/netrc.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nonblock.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nss.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/openldap.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parsedate.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pingpong.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/polarssl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pop3.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/progress.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qssl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rawstr.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rtsp.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/security.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/select.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sendf.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/share.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/slist.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smtp.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/socks.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/socks_gssapi.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/socks_sspi.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/speedcheck.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/splay.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssh.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sslgen.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssluse.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strdup.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strequal.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strerror.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strtok.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strtoofft.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/telnet.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tftp.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timeval.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/transfer.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/url.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/version.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/warnless.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wildcard.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) curl_config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) curl_config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) curl_config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) curl_config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) curl_config.h +installdirs: + for dir in "$(DESTDIR)$(libdir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-hdr distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: install-libLTLIBRARIES + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool ctags distclean \ + distclean-compile distclean-generic distclean-hdr \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-libLTLIBRARIES install-man \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-info-am uninstall-libLTLIBRARIES + + +$(DSP): msvcproj.head msvcproj.foot Makefile.am + echo "creating $(DSP)" + @(cp $(srcdir)/msvcproj.head $(DSP); \ + echo "# Begin Group \"Source Files\"" $(DSPOUT); \ + echo "" $(DSPOUT); \ + echo "# PROP Default_Filter \"\"" $(DSPOUT); \ + win32_srcs='$(WIN32SOURCES)'; \ + sorted_srcs=`for file in $$win32_srcs; do echo $$file; done | sort`; \ + for file in $$sorted_srcs; do \ + echo "# Begin Source File" $(DSPOUT); \ + echo "" $(DSPOUT); \ + echo "SOURCE=.\\"$$file $(DSPOUT); \ + echo "# End Source File" $(DSPOUT); \ + done; \ + echo "# End Group" $(DSPOUT); \ + echo "# Begin Group \"Header Files\"" $(DSPOUT); \ + echo "" $(DSPOUT); \ + echo "# PROP Default_Filter \"\"" $(DSPOUT); \ + win32_hdrs='$(WIN32HEADERS)'; \ + sorted_hdrs=`for file in $$win32_hdrs; do echo $$file; done | sort`; \ + for file in $$sorted_hdrs; do \ + echo "# Begin Source File" $(DSPOUT); \ + echo "" $(DSPOUT); \ + echo "SOURCE=.\\"$$file $(DSPOUT); \ + echo "# End Source File" $(DSPOUT); \ + done; \ + echo "# End Group" $(DSPOUT); \ + cat $(srcdir)/msvcproj.foot $(DSPOUT) ) + +$(VCPROJ): vc8proj.head vc8proj.foot Makefile.am + echo "creating $(VCPROJ)" + @(cp $(srcdir)/vc8proj.head $(VCPROJ); \ + win32_srcs='$(WIN32SOURCES)'; \ + sorted_srcs=`for file in $$win32_srcs; do echo $$file; done | sort`; \ + for file in $$sorted_srcs; do \ + echo "<File RelativePath=\""$$file"\"></File>" $(VCPROJOUT); \ + done; \ + echo "</Filter><Filter Name=\"Header Files\">" $(VCPROJOUT); \ + win32_hdrs='$(WIN32HEADERS)'; \ + sorted_hdrs=`for file in $$win32_hdrs; do echo $$file; done | sort`; \ + for file in $$sorted_hdrs; do \ + echo "<File RelativePath=\""$$file"\"></File>" $(VCPROJOUT); \ + done; \ + cat $(srcdir)/vc8proj.foot $(VCPROJOUT) ) +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/lib/Makefile.inc b/lib/Makefile.inc index 9803c8c1..41ab8277 100644 --- a/lib/Makefile.inc +++ b/lib/Makefile.inc @@ -1,28 +1,40 @@ # ./lib/Makefile.inc +# Using the backslash as line continuation character might be problematic +# with some make flavours, as Watcom's wmake showed us already. If we +# ever want to change this in a portable manner then we should consider +# this idea (posted to the libcurl list by Adam Kellas): +# CSRC1 = file1.c file2.c file3.c +# CSRC2 = file4.c file5.c file6.c +# CSOURCES = $(CSRC1) $(CSRC2) CSOURCES = file.c timeval.c base64.c hostip.c progress.c formdata.c \ cookie.c http.c sendf.c ftp.c url.c dict.c if2ip.c speedcheck.c \ ldap.c ssluse.c version.c getenv.c escape.c mprintf.c telnet.c \ netrc.c getinfo.c transfer.c strequal.c easy.c security.c krb4.c \ - krb5.c memdebug.c http_chunks.c strtok.c connect.c llist.c hash.c \ - multi.c content_encoding.c share.c http_digest.c md5.c curl_rand.c \ + curl_fnmatch.c fileinfo.c ftplistparser.c wildcard.c krb5.c \ + memdebug.c http_chunks.c strtok.c connect.c llist.c hash.c multi.c \ + content_encoding.c share.c http_digest.c md4.c md5.c curl_rand.c \ http_negotiate.c http_ntlm.c inet_pton.c strtoofft.c strerror.c \ hostares.c hostasyn.c hostip4.c hostip6.c hostsyn.c hostthre.c \ inet_ntop.c parsedate.c select.c gtls.c sslgen.c tftp.c splay.c \ - strdup.c socks.c ssh.c nss.c qssl.c rawstr.c curl_addrinfo.c \ + strdup.c socks.c ssh.c nss.c qssl.c rawstr.c curl_addrinfo.c \ socks_gssapi.c socks_sspi.c curl_sspi.c slist.c nonblock.c \ curl_memrchr.c imap.c pop3.c smtp.c pingpong.c rtsp.c curl_threads.c \ - warnless.c + warnless.c hmac.c polarssl.c curl_rtmp.c openldap.c curl_gethostname.c\ + gopher.c HHEADERS = arpa_telnet.h netrc.h file.h timeval.h qssl.h hostip.h \ progress.h formdata.h cookie.h http.h sendf.h ftp.h url.h dict.h \ if2ip.h speedcheck.h urldata.h curl_ldap.h ssluse.h escape.h telnet.h \ getinfo.h strequal.h krb4.h memdebug.h http_chunks.h curl_rand.h \ - strtok.h connect.h llist.h hash.h content_encoding.h share.h \ + curl_fnmatch.h wildcard.h fileinfo.h ftplistparser.h strtok.h \ + connect.h llist.h hash.h content_encoding.h share.h curl_md4.h \ curl_md5.h http_digest.h http_negotiate.h http_ntlm.h inet_pton.h \ strtoofft.h strerror.h inet_ntop.h curlx.h curl_memory.h setup.h \ transfer.h select.h easyif.h multiif.h parsedate.h sslgen.h gtls.h \ tftp.h sockaddr.h splay.h strdup.h setup_once.h socks.h ssh.h nssg.h \ curl_base64.h rawstr.h curl_addrinfo.h curl_sspi.h slist.h nonblock.h \ curl_memrchr.h imap.h pop3.h smtp.h pingpong.h rtsp.h curl_threads.h \ - warnless.h + warnless.h curl_hmac.h polarssl.h curl_rtmp.h curl_gethostname.h \ + gopher.h + diff --git a/lib/Makefile.m32 b/lib/Makefile.m32 new file mode 100644 index 00000000..08b665b8 --- /dev/null +++ b/lib/Makefile.m32 @@ -0,0 +1,167 @@ +######################################################################### +# +## Makefile for building libcurl.a with MingW32 (GCC-3.2 or later) +## and optionally OpenSSL (0.9.8), libssh2 (1.2), zlib (1.2.5) +## +## Usage: +## mingw32-make -f Makefile.m32 [SSL=1] [SSH2=1] [ZLIB=1] [IDN=1] [SSPI=1] [IPV6=1] [LDAPS=1] [RTMP=1] [DYN=1] +## +## Hint: you can also set environment vars to control the build, f.e.: +## set ZLIB_PATH=c:/zlib-1.2.5 +## set ZLIB=1 +## +## Comments to: Troy Engel <tengel@sonic.net> or +## Joern Hartroth <hartroth@acm.org> +######################################################################### + +# Edit the path below to point to the base of your Zlib sources. +ifndef ZLIB_PATH +ZLIB_PATH = ../../zlib-1.2.5 +endif +# Edit the path below to point to the base of your OpenSSL package. +ifndef OPENSSL_PATH +OPENSSL_PATH = ../../openssl-0.9.8o +endif +# Edit the path below to point to the base of your LibSSH2 package. +ifndef LIBSSH2_PATH +LIBSSH2_PATH = ../../libssh2-1.2.7 +endif +# Edit the path below to point to the base of your libidn package. +ifndef LIBIDN_PATH +LIBIDN_PATH = ../../libidn-1.18 +endif +# Edit the path below to point to the base of your librtmp package. +ifndef LIBRTMP_PATH +LIBRTMP_PATH = ../../librtmp-2.3 +endif +# Edit the path below to point to the base of your Novell LDAP NDK. +ifndef LDAP_SDK +LDAP_SDK = c:/novell/ndk/cldapsdk/win32 +endif + +# Edit the path below to point to the base of your c-ares package. +ifndef LIBCARES_PATH +LIBCARES_PATH = ../ares +endif + +CC = gcc +AR = ar +# comment LDFLAGS below to keep debug info +LDFLAGS = -s +RANLIB = ranlib +RC = windres +RCFLAGS = --include-dir=../include -DDEBUGBUILD=0 -O COFF -i +RM = del /q /f 2>NUL +STRIP = strip -g + +######################################################## +## Nothing more to do below this line! + +INCLUDES = -I. -I../include +CFLAGS = -g -O2 -DBUILDING_LIBCURL +ifdef ARES + INCLUDES += -I$(LIBCARES_PATH) + CFLAGS += -DUSE_ARES + DLL_LIBS += -L$(LIBCARES_PATH) -lcares + libcurl_dll_DEPENDENCIES = $(LIBCARES_PATH)/libcares.a +endif +ifdef RTMP + INCLUDES += -I"$(LIBRTMP_PATH)" + CFLAGS += -DUSE_LIBRTMP + DLL_LIBS += -L"$(LIBRTMP_PATH)/librtmp" -lrtmp -lwinmm +endif +ifdef SSH2 + INCLUDES += -I"$(LIBSSH2_PATH)/include" -I"$(LIBSSH2_PATH)/win32" + CFLAGS += -DUSE_LIBSSH2 -DHAVE_LIBSSH2_H + DLL_LIBS += -L$(LIBSSH2_PATH)/win32 -lssh2 +endif +ifdef SSL + INCLUDES += -I"$(OPENSSL_PATH)/outinc" -I"$(OPENSSL_PATH)/outinc/openssl" + CFLAGS += -DUSE_SSLEAY -DUSE_OPENSSL -DHAVE_OPENSSL_ENGINE_H -DHAVE_OPENSSL_PKCS12_H \ + -DHAVE_ENGINE_LOAD_BUILTIN_ENGINES -DOPENSSL_NO_KRB5 \ + -DCURL_WANTS_CA_BUNDLE_ENV + DLL_LIBS += -L$(OPENSSL_PATH)/out -leay32 -lssl32 +endif +ifdef ZLIB + INCLUDES += -I"$(ZLIB_PATH)" + CFLAGS += -DHAVE_LIBZ -DHAVE_ZLIB_H + DLL_LIBS += -L$(ZLIB_PATH) -lz +endif +ifdef IDN + INCLUDES += -I"$(LIBIDN_PATH)/include" + CFLAGS += -DUSE_LIBIDN + DLL_LIBS += -L$(LIBIDN_PATH)/lib -lidn +endif +ifdef SSPI + CFLAGS += -DUSE_WINDOWS_SSPI +endif +ifdef IPV6 + CFLAGS += -DENABLE_IPV6 +endif +ifdef LDAPS + CFLAGS += -DHAVE_LDAP_SSL +endif +ifdef USE_LDAP_NOVELL + INCLUDES += -I"$(LDAP_SDK)/inc" + CFLAGS += -DCURL_HAS_NOVELL_LDAPSDK + DLL_LIBS += -L"$(LDAP_SDK)/lib/mscvc" -lldapsdk -lldapssl -lldapx +endif +ifdef USE_LDAP_OPENLDAP + INCLUDES += -I"$(LDAP_SDK)/include" + CFLAGS += -DCURL_HAS_OPENLDAP_LDAPSDK + DLL_LIBS += -L"$(LDAP_SDK)/lib" -lldap -llber +endif +ifndef USE_LDAP_NOVELL +ifndef USE_LDAP_OPENLDAP +DLL_LIBS += -lwldap32 +endif +endif +DLL_LIBS += -lws2_32 +COMPILE = $(CC) $(INCLUDES) $(CFLAGS) + +# Makefile.inc provides the CSOURCES and HHEADERS defines +include Makefile.inc + +libcurl_dll_LIBRARY = libcurl.dll +libcurl_dll_a_LIBRARY = libcurldll.a +libcurl_a_LIBRARY = libcurl.a + +libcurl_a_OBJECTS := $(patsubst %.c,%.o,$(strip $(CSOURCES))) +libcurl_a_DEPENDENCIES := $(strip $(CSOURCES) $(HHEADERS)) + +RESOURCE = libcurl.res + +.SUFFIXES: .rc .res + +all: $(libcurl_a_LIBRARY) $(libcurl_dll_LIBRARY) + +$(libcurl_a_LIBRARY): $(libcurl_a_OBJECTS) $(libcurl_a_DEPENDENCIES) + -$(RM) $@ + $(AR) cru $@ $(libcurl_a_OBJECTS) + $(RANLIB) $@ + $(STRIP) $@ + +# remove the last line above to keep debug info + +$(libcurl_dll_LIBRARY): $(libcurl_a_OBJECTS) $(RESOURCE) $(libcurl_dll_DEPENDENCIES) + -$(RM) $@ + $(CC) $(LDFLAGS) -shared -Wl,--out-implib,$(libcurl_dll_a_LIBRARY) \ + -o $@ $(libcurl_a_OBJECTS) $(RESOURCE) $(DLL_LIBS) + +.c.o: + $(COMPILE) -c $< + +.rc.res: + $(RC) $(RCFLAGS) $< -o $@ + +clean: + -$(RM) $(libcurl_a_OBJECTS) $(RESOURCE) + +distclean vclean: clean + -$(RM) $(libcurl_a_LIBRARY) $(libcurl_dll_LIBRARY) $(libcurl_dll_a_LIBRARY) + +FORCE: ; + +$(LIBCARES_PATH)/libcares.a: + $(MAKE) -C $(LIBCARES_PATH) -f Makefile.m32 + diff --git a/lib/Makefile.netware b/lib/Makefile.netware new file mode 100644 index 00000000..655c7e3e --- /dev/null +++ b/lib/Makefile.netware @@ -0,0 +1,667 @@ +################################################################# +# +## Makefile for building libcurl.nlm (NetWare version - gnu make) +## Use: make -f Makefile.netware +## +## Comments to: Guenter Knauf http://www.gknw.net/phpbb +# +################################################################# + +# Edit the path below to point to the base of your Novell NDK. +ifndef NDKBASE +NDKBASE = c:/novell +endif + +# Edit the path below to point to the base of your Zlib sources. +ifndef ZLIB_PATH +ZLIB_PATH = ../../zlib-1.2.5 +endif + +# Edit the path below to point to the base of your OpenSSL package. +ifndef OPENSSL_PATH +OPENSSL_PATH = ../../openssl-0.9.8o +endif + +# Edit the path below to point to the base of your LibSSH2 package. +ifndef LIBSSH2_PATH +LIBSSH2_PATH = ../../libssh2-1.2.7 +endif + +# Edit the path below to point to the base of your libidn package. +ifndef LIBIDN_PATH +LIBIDN_PATH = ../../libidn-1.18 +endif + +# Edit the path below to point to the base of your librtmp package. +ifndef LIBRTMP_PATH +LIBRTMP_PATH = ../../librtmp-2.3 +endif + +# Edit the path below to point to the base of your c-ares package. +ifndef LIBCARES_PATH +LIBCARES_PATH = ../ares +endif + +ifndef INSTDIR +INSTDIR = ..$(DS)curl-$(LIBCURL_VERSION_STR)-bin-nw +endif + +# Edit the vars below to change NLM target settings. +TARGET = libcurl +VERSION = $(LIBCURL_VERSION) +COPYR = Copyright (C) $(LIBCURL_COPYRIGHT_STR) +DESCR = cURL libcurl $(LIBCURL_VERSION_STR) ($(LIBARCH)) - http://curl.haxx.se +MTSAFE = YES +STACK = 64000 +SCREEN = none +EXPORTS = @libcurl.imp + +# Uncomment the next line to enable linking with POSIX semantics. +# POSIXFL = 1 + +# Edit the var below to point to your lib architecture. +ifndef LIBARCH +LIBARCH = LIBC +endif + +# must be equal to NDEBUG or DEBUG, CURLDEBUG +ifndef DB +DB = NDEBUG +endif +# Optimization: -O<n> or debugging: -g +ifeq ($(DB),NDEBUG) + OPT = -O2 + OBJDIR = release +else + OPT = -g + OBJDIR = debug +endif + +# The following lines defines your compiler. +ifdef CWFolder + METROWERKS = $(CWFolder) +endif +ifdef METROWERKS + # MWCW_PATH = $(subst \,/,$(METROWERKS))/Novell Support + MWCW_PATH = $(subst \,/,$(METROWERKS))/Novell Support/Metrowerks Support + CC = mwccnlm +else + CC = gcc +endif +PERL = perl +# Here you can find a native Win32 binary of the original awk: +# http://www.gknw.net/development/prgtools/awk-20070501.zip +AWK = awk +CP = cp -afv +MKDIR = mkdir +# RM = rm -f +# If you want to mark the target as MTSAFE you will need a tool for +# generating the xdc data for the linker; here's a minimal tool: +# http://www.gknw.net/development/prgtools/mkxdc.zip +MPKXDC = mkxdc + +# LIBARCH_U = $(shell $(AWK) 'BEGIN {print toupper(ARGV[1])}' $(LIBARCH)) +LIBARCH_L = $(shell $(AWK) 'BEGIN {print tolower(ARGV[1])}' $(LIBARCH)) + +# Include the version info retrieved from curlver.h +-include $(OBJDIR)/version.inc + +# Global flags for all compilers +CFLAGS += $(OPT) -D$(DB) -DNETWARE -DHAVE_CONFIG_H -nostdinc + +ifeq ($(CC),mwccnlm) +LD = mwldnlm +LDFLAGS = -nostdlib $(PRELUDE) $(OBJL) -o $@ -commandfile +AR = mwldnlm +ARFLAGS = -nostdlib -type library -o +LIBEXT = lib +#RANLIB = +CFLAGS += -msgstyle gcc -gccinc -inline off -opt nointrinsics -proc 586 +CFLAGS += -relax_pointers +#CFLAGS += -w on +ifeq ($(LIBARCH),LIBC) +ifeq ($(POSIXFL),1) + PRELUDE = $(NDK_LIBC)/imports/posixpre.o +else + PRELUDE = $(NDK_LIBC)/imports/libcpre.o +endif + CFLAGS += -align 4 +else + # PRELUDE = $(NDK_CLIB)/imports/clibpre.o + # to avoid the __init_* / __deinit_* whoes dont use prelude from NDK + PRELUDE = "$(MWCW_PATH)/libraries/runtime/prelude.obj" + # CFLAGS += -include "$(MWCW_PATH)/headers/nlm_clib_prefix.h" + CFLAGS += -align 1 +endif +else +LD = nlmconv +LDFLAGS = -T +AR = ar +ARFLAGS = -cq +LIBEXT = a +RANLIB = ranlib +CFLAGS += -fno-builtin -fpcc-struct-return -fno-strict-aliasing +CFLAGS += -Wall # -pedantic +ifeq ($(LIBARCH),LIBC) +ifeq ($(POSIXFL),1) + PRELUDE = $(NDK_LIBC)/imports/posixpre.gcc.o +else + PRELUDE = $(NDK_LIBC)/imports/libcpre.gcc.o +endif +else + PRELUDE = $(NDK_CLIB)/imports/clibpre.gcc.o + # to avoid the __init_* / __deinit_* whoes dont use prelude from NDK + # http://www.gknw.net/development/mk_nlm/gcc_pre.zip + # PRELUDE = $(NDK_ROOT)/pre/prelude.o + CFLAGS += -include $(NDKBASE)/nlmconv/genlm.h +endif +endif + +NDK_ROOT = $(NDKBASE)/ndk +ifndef NDK_CLIB +NDK_CLIB = $(NDK_ROOT)/nwsdk +endif +ifndef NDK_LIBC +NDK_LIBC = $(NDK_ROOT)/libc +endif +ifndef NDK_LDAP +NDK_LDAP = $(NDK_ROOT)/cldapsdk/netware +endif +CURL_INC = ../include +CURL_LIB = ../lib + +INCLUDES = -I$(CURL_INC) -I$(CURL_LIB) + +ifdef WITH_ARES + INCLUDES += -I$(LIBCARES_PATH) + LDLIBS += $(LIBCARES_PATH)/libcares.$(LIBEXT) +endif +ifdef WITH_SSH2 + INCLUDES += -I$(LIBSSH2_PATH)/include +ifdef LINK_STATIC + LDLIBS += $(LIBSSH2_PATH)/nw/libssh2.$(LIBEXT) +else + MODULES += libssh2.nlm + IMPORTS += @$(LIBSSH2_PATH)/nw/libssh2.imp +endif +endif +ifdef WITH_RTMP + INCLUDES += -I$(LIBRTMP_PATH) + LDLIBS += $(LIBRTMP_PATH)/librtmp/librtmp.$(LIBEXT) +endif +ifdef WITH_SSL + INCLUDES += -I$(OPENSSL_PATH)/outinc_nw_$(LIBARCH_L) + LDLIBS += $(OPENSSL_PATH)/out_nw_$(LIBARCH_L)/ssl.$(LIBEXT) + LDLIBS += $(OPENSSL_PATH)/out_nw_$(LIBARCH_L)/crypto.$(LIBEXT) + IMPORTS += GetProcessSwitchCount RunningProcess + INSTDEP += ca-bundle.crt +endif +ifdef WITH_ZLIB + INCLUDES += -I$(ZLIB_PATH) +ifdef LINK_STATIC + LDLIBS += $(ZLIB_PATH)/nw/$(LIBARCH)/libz.$(LIBEXT) +else + MODULES += libz.nlm + IMPORTS += @$(ZLIB_PATH)/nw/$(LIBARCH)/libz.imp +endif +endif +ifdef WITH_IDN + INCLUDES += -I$(LIBIDN_PATH)/include + LDLIBS += $(LIBIDN_PATH)/lib/libidn.$(LIBEXT) +endif + +ifeq ($(LIBARCH),LIBC) + INCLUDES += -I$(NDK_LIBC)/include + # INCLUDES += -I$(NDK_LIBC)/include/nks + # INCLUDES += -I$(NDK_LIBC)/include/winsock + CFLAGS += -D_POSIX_SOURCE +else + INCLUDES += -I$(NDK_CLIB)/include/nlm + # INCLUDES += -I$(NDK_CLIB)/include/nlm/obsolete + # INCLUDES += -I$(NDK_CLIB)/include +endif +ifndef DISABLE_LDAP + INCLUDES += -I$(NDK_LDAP)/$(LIBARCH_L)/inc +endif +CFLAGS += $(INCLUDES) + +ifeq ($(MTSAFE),YES) + XDCOPT = -n +endif +ifeq ($(MTSAFE),NO) + XDCOPT = -u +endif +ifdef XDCOPT + XDCDATA = $(OBJDIR)/$(TARGET).xdc +endif + +ifeq ($(findstring /sh,$(SHELL)),/sh) +DL = ' +DS = / +PCT = % +#-include $(NDKBASE)/nlmconv/ncpfs.inc +else +DS = \\ +PCT = %% +endif + +# Makefile.inc provides the CSOURCES and HHEADERS defines +include Makefile.inc + +OBJS := $(patsubst %.c,$(OBJDIR)/%.o,$(strip $(CSOURCES))) $(OBJDIR)/nwos.o + +OBJL = $(OBJS) $(OBJDIR)/nwlib.o $(LDLIBS) + +all: lib nlm + +nlm: prebuild $(TARGET).nlm + +lib: prebuild $(TARGET).$(LIBEXT) + +prebuild: $(OBJDIR) $(CURL_INC)/curl/curlbuild.h $(OBJDIR)/version.inc curl_config.h + +$(OBJDIR)/%.o: %.c +# @echo Compiling $< + $(CC) $(CFLAGS) -c $< -o $@ + +$(OBJDIR)/version.inc: ../include/curl/curlver.h $(OBJDIR) + @echo Creating $@ + @$(AWK) -f ../packages/NetWare/get_ver.awk $< > $@ + +install: $(INSTDIR) all $(INSTDEP) + @$(CP) $(TARGET).nlm $(INSTDIR) + @$(CP) $(TARGET).$(LIBEXT) $(INSTDIR) + @$(CP) ../CHANGES $(INSTDIR) + @$(CP) ../COPYING $(INSTDIR) + @$(CP) ../README $(INSTDIR) + @$(CP) ../RELEASE-NOTES $(INSTDIR) +ifdef WITH_SSL + @-$(CP) ca-bundle.crt $(INSTDIR)/ca-bundle.crt +endif + +clean: + -$(RM) curl_config.h + -$(RM) -r $(OBJDIR) + +distclean vclean: clean + -$(RM) $(TARGET).$(LIBEXT) $(TARGET).nlm + -$(RM) certdata.txt ca-bundle.crt + +$(OBJDIR) $(INSTDIR): + @$(MKDIR) $@ + +$(TARGET).$(LIBEXT): $(OBJS) + @echo Creating $@ + @-$(RM) $@ + @$(AR) $(ARFLAGS) $@ $^ +ifdef RANLIB + @$(RANLIB) $@ +endif + +$(TARGET).nlm: $(OBJDIR)/$(TARGET).def $(OBJL) $(XDCDATA) + @echo Linking $@ + @-$(RM) $@ + @$(LD) $(LDFLAGS) $< + +$(OBJDIR)/%.xdc: Makefile.netware + @echo Creating $@ + @$(MPKXDC) $(XDCOPT) $@ + +$(OBJDIR)/%.def: Makefile.netware + @echo $(DL)# DEF file for linking with $(LD)$(DL) > $@ + @echo $(DL)# Do not edit this file - it is created by make!$(DL) >> $@ + @echo $(DL)# All your changes will be lost!!$(DL) >> $@ + @echo $(DL)#$(DL) >> $@ + @echo $(DL)copyright "$(COPYR)"$(DL) >> $@ + @echo $(DL)description "$(DESCR)"$(DL) >> $@ + @echo $(DL)version $(VERSION)$(DL) >> $@ +ifdef NLMTYPE + @echo $(DL)type $(NLMTYPE)$(DL) >> $@ +endif +ifdef STACK + @echo $(DL)stack $(STACK)$(DL) >> $@ +endif +ifdef SCREEN + @echo $(DL)screenname "$(SCREEN)"$(DL) >> $@ +else + @echo $(DL)screenname "DEFAULT"$(DL) >> $@ +endif +ifneq ($(DB),NDEBUG) + @echo $(DL)debug$(DL) >> $@ +endif + @echo $(DL)threadname "$(TARGET)"$(DL) >> $@ +ifdef XDCDATA + @echo $(DL)xdcdata $(XDCDATA)$(DL) >> $@ +endif + @echo $(DL)flag_on 64$(DL) >> $@ +ifeq ($(LIBARCH),CLIB) + @echo $(DL)start _Prelude$(DL) >> $@ + @echo $(DL)exit _Stop$(DL) >> $@ + @echo $(DL)import @$(NDK_CLIB)/imports/clib.imp$(DL) >> $@ + @echo $(DL)import @$(NDK_CLIB)/imports/threads.imp$(DL) >> $@ + @echo $(DL)import @$(NDK_CLIB)/imports/nlmlib.imp$(DL) >> $@ + @echo $(DL)import @$(NDK_CLIB)/imports/socklib.imp$(DL) >> $@ + @echo $(DL)module clib$(DL) >> $@ +ifndef DISABLE_LDAP + @echo $(DL)import @$(NDK_LDAP)/clib/imports/ldapsdk.imp$(DL) >> $@ + @echo $(DL)import @$(NDK_LDAP)/clib/imports/ldapssl.imp$(DL) >> $@ +# @echo $(DL)import @$(NDK_LDAP)/clib/imports/ldapx.imp$(DL) >> $@ + @echo $(DL)module ldapsdk ldapssl$(DL) >> $@ +endif +else +ifeq ($(POSIXFL),1) + @echo $(DL)flag_on 4194304$(DL) >> $@ +endif + @echo $(DL)pseudopreemption$(DL) >> $@ +ifeq ($(findstring posixpre,$(PRELUDE)),posixpre) + @echo $(DL)start POSIX_Start$(DL) >> $@ + @echo $(DL)exit POSIX_Stop$(DL) >> $@ + @echo $(DL)check POSIX_CheckUnload$(DL) >> $@ +else + @echo $(DL)start _LibCPrelude$(DL) >> $@ + @echo $(DL)exit _LibCPostlude$(DL) >> $@ + @echo $(DL)check _LibCCheckUnload$(DL) >> $@ +endif + @echo $(DL)import @$(NDK_LIBC)/imports/libc.imp$(DL) >> $@ + @echo $(DL)import @$(NDK_LIBC)/imports/netware.imp$(DL) >> $@ + @echo $(DL)module libc$(DL) >> $@ +ifndef DISABLE_LDAP + @echo $(DL)import @$(NDK_LDAP)/libc/imports/lldapsdk.imp$(DL) >> $@ + @echo $(DL)import @$(NDK_LDAP)/libc/imports/lldapssl.imp$(DL) >> $@ +# @echo $(DL)import @$(NDK_LDAP)/libc/imports/lldapx.imp$(DL) >> $@ + @echo $(DL)module lldapsdk lldapssl$(DL) >> $@ +endif +endif +ifdef MODULES + @echo $(DL)module $(MODULES)$(DL) >> $@ +endif +ifdef EXPORTS + @echo $(DL)export $(EXPORTS)$(DL) >> $@ +endif +ifdef IMPORTS + @echo $(DL)import $(IMPORTS)$(DL) >> $@ +endif +ifeq ($(findstring nlmconv,$(LD)),nlmconv) + @echo $(DL)input $(PRELUDE)$(DL) >> $@ + @echo $(DL)input $(OBJL)$(DL) >> $@ +#ifdef LDLIBS +# @echo $(DL)input $(LDLIBS)$(DL) >> $@ +#endif + @echo $(DL)output $(TARGET).nlm$(DL) >> $@ +endif + +curl_config.h: Makefile.netware + @echo Creating $@ + @echo $(DL)/* $@ for NetWare target.$(DL) > $@ + @echo $(DL)** Do not edit this file - it is created by make!$(DL) >> $@ + @echo $(DL)** All your changes will be lost!!$(DL) >> $@ + @echo $(DL)*/$(DL) >> $@ + @echo $(DL)#ifndef NETWARE$(DL) >> $@ + @echo $(DL)#error This $(notdir $@) is created for NetWare platform!$(DL) >> $@ + @echo $(DL)#endif$(DL) >> $@ + @echo $(DL)#define VERSION "$(LIBCURL_VERSION_STR)"$(DL) >> $@ + @echo $(DL)#define PACKAGE_BUGREPORT "a suitable curl mailing list => http://curl.haxx.se/mail/"$(DL) >> $@ +ifeq ($(LIBARCH),CLIB) + @echo $(DL)#define OS "i586-pc-clib-NetWare"$(DL) >> $@ + @echo $(DL)#define NETDB_USE_INTERNET 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRICMP 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRNICMP 1$(DL) >> $@ + @echo $(DL)#define RECV_TYPE_ARG1 int$(DL) >> $@ + @echo $(DL)#define RECV_TYPE_ARG2 char *$(DL) >> $@ + @echo $(DL)#define RECV_TYPE_ARG3 int$(DL) >> $@ + @echo $(DL)#define RECV_TYPE_ARG4 int$(DL) >> $@ + @echo $(DL)#define RECV_TYPE_RETV int$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG1 int$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG2 char$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG3 int$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG4 int$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG5 struct sockaddr$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG6 int$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_RETV int$(DL) >> $@ + @echo $(DL)#define SEND_QUAL_ARG2$(DL) >> $@ + @echo $(DL)#define SEND_TYPE_ARG1 int$(DL) >> $@ + @echo $(DL)#define SEND_TYPE_ARG2 char *$(DL) >> $@ + @echo $(DL)#define SEND_TYPE_ARG3 int$(DL) >> $@ + @echo $(DL)#define SEND_TYPE_ARG4 int$(DL) >> $@ + @echo $(DL)#define SEND_TYPE_RETV int$(DL) >> $@ + @echo $(DL)#define pressanykey PressAnyKeyToContinue$(DL) >> $@ +else + @echo $(DL)#define OS "i586-pc-libc-NetWare"$(DL) >> $@ + @echo $(DL)#define HAVE_FTRUNCATE 1$(DL) >> $@ + @echo $(DL)#define HAVE_GETTIMEOFDAY 1$(DL) >> $@ + @echo $(DL)#define HAVE_INTTYPES_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_LONGLONG 1$(DL) >> $@ + @echo $(DL)#define HAVE_STDINT_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRCASECMP 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRLCAT 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRLCPY 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRTOLL 1$(DL) >> $@ + @echo $(DL)#define HAVE_SYS_PARAM_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_SYS_SELECT_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_TERMIOS_H 1$(DL) >> $@ + @echo $(DL)#define RECV_TYPE_ARG1 int$(DL) >> $@ + @echo $(DL)#define RECV_TYPE_ARG2 void *$(DL) >> $@ + @echo $(DL)#define RECV_TYPE_ARG3 size_t$(DL) >> $@ + @echo $(DL)#define RECV_TYPE_ARG4 int$(DL) >> $@ + @echo $(DL)#define RECV_TYPE_RETV ssize_t$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG1 int$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG2 void$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG3 size_t$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG4 int$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG5 struct sockaddr$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG6 size_t$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_RETV ssize_t$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG2_IS_VOID 1$(DL) >> $@ + @echo $(DL)#define SEND_QUAL_ARG2$(DL) >> $@ + @echo $(DL)#define SEND_TYPE_ARG1 int$(DL) >> $@ + @echo $(DL)#define SEND_TYPE_ARG2 void *$(DL) >> $@ + @echo $(DL)#define SEND_TYPE_ARG3 size_t$(DL) >> $@ + @echo $(DL)#define SEND_TYPE_ARG4 int$(DL) >> $@ + @echo $(DL)#define SEND_TYPE_RETV ssize_t$(DL) >> $@ + @echo $(DL)#define SIZEOF_OFF_T 8$(DL) >> $@ + @echo $(DL)#define _LARGEFILE 1$(DL) >> $@ +ifdef ENABLE_IPV6 + @echo $(DL)#define ENABLE_IPV6 1$(DL) >> $@ + @echo $(DL)#define HAVE_AF_INET6 1$(DL) >> $@ + @echo $(DL)#define HAVE_PF_INET6 1$(DL) >> $@ + @echo $(DL)#define HAVE_FREEADDRINFO 1$(DL) >> $@ + @echo $(DL)#define HAVE_GETADDRINFO 1$(DL) >> $@ + @echo $(DL)#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRUCT_ADDRINFO 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRUCT_IN6_ADDR 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRUCT_SOCKADDR_IN6 1$(DL) >> $@ + @echo $(DL)#define SIZEOF_STRUCT_IN6_ADDR 16$(DL) >> $@ +endif +endif + @echo $(DL)#define USE_MANUAL 1$(DL) >> $@ + @echo $(DL)#define HAVE_ARPA_INET_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_ASSERT_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_ERR_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_FCNTL_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_GETHOSTBYADDR 1$(DL) >> $@ + @echo $(DL)#define HAVE_GETHOSTBYNAME 1$(DL) >> $@ + @echo $(DL)#define HAVE_GETPROTOBYNAME 1$(DL) >> $@ + @echo $(DL)#define HAVE_GMTIME_R 1$(DL) >> $@ + @echo $(DL)#define HAVE_INET_ADDR 1$(DL) >> $@ + @echo $(DL)#define HAVE_IOCTL 1$(DL) >> $@ + @echo $(DL)#define HAVE_IOCTL_FIONBIO 1$(DL) >> $@ + @echo $(DL)#define HAVE_LIMITS_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_LL 1$(DL) >> $@ + @echo $(DL)#define HAVE_LOCALE_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_LOCALTIME_R 1$(DL) >> $@ + @echo $(DL)#define HAVE_MALLOC_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_NETINET_IN_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_RECV 1$(DL) >> $@ + @echo $(DL)#define HAVE_RECVFROM 1$(DL) >> $@ + @echo $(DL)#define HAVE_SELECT 1$(DL) >> $@ + @echo $(DL)#define HAVE_SEND 1$(DL) >> $@ + @echo $(DL)#define HAVE_SETJMP_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_SETLOCALE 1$(DL) >> $@ + @echo $(DL)#define HAVE_SIGNAL 1$(DL) >> $@ + @echo $(DL)#define HAVE_SIGNAL_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_SIG_ATOMIC_T 1$(DL) >> $@ + @echo $(DL)#define HAVE_SOCKET 1$(DL) >> $@ + @echo $(DL)#define HAVE_STDLIB_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRDUP 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRFTIME 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRING_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRSTR 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRUCT_TIMEVAL 1$(DL) >> $@ + @echo $(DL)#define HAVE_SYS_IOCTL_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_SYS_STAT_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_SYS_TIME_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_TIME_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_UNAME 1$(DL) >> $@ + @echo $(DL)#define HAVE_UNISTD_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_UTIME 1$(DL) >> $@ + @echo $(DL)#define HAVE_UTIME_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_WRITEV 1$(DL) >> $@ + @echo $(DL)#define RETSIGTYPE void$(DL) >> $@ + @echo $(DL)#define SIZEOF_INT 4$(DL) >> $@ + @echo $(DL)#define SIZEOF_SHORT 2$(DL) >> $@ + @echo $(DL)#define SIZEOF_STRUCT_IN_ADDR 4$(DL) >> $@ + @echo $(DL)#define STDC_HEADERS 1$(DL) >> $@ + @echo $(DL)#define TIME_WITH_SYS_TIME 1$(DL) >> $@ +ifdef DISABLE_LDAP + @echo $(DL)#define CURL_DISABLE_LDAP 1$(DL) >> $@ +else + @echo $(DL)#define CURL_HAS_NOVELL_LDAPSDK 1$(DL) >> $@ +ifndef DISABLE_LDAPS + @echo $(DL)#define HAVE_LDAP_SSL 1$(DL) >> $@ +endif + @echo $(DL)#define HAVE_LDAP_SSL_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_LDAP_URL_PARSE 1$(DL) >> $@ +endif +ifdef NW_WINSOCK + @echo $(DL)#define HAVE_CLOSESOCKET 1$(DL) >> $@ +else + @echo $(DL)#define USE_BSD_SOCKETS 1$(DL) >> $@ + @echo $(DL)#define HAVE_SYS_TYPES_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_SYS_SOCKET_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_SYS_SOCKIO_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_NETDB_H 1$(DL) >> $@ +endif +ifdef WITH_ARES + @echo $(DL)#define USE_ARES 1$(DL) >> $@ +endif +ifdef WITH_ZLIB + @echo $(DL)#define HAVE_ZLIB_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_LIBZ 1$(DL) >> $@ +endif +ifdef WITH_SSL + @echo $(DL)#define USE_SSLEAY 1$(DL) >> $@ + @echo $(DL)#define USE_OPENSSL 1$(DL) >> $@ + @echo $(DL)#define HAVE_OPENSSL_X509_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_OPENSSL_SSL_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_OPENSSL_RSA_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_OPENSSL_PEM_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_OPENSSL_ERR_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_OPENSSL_CRYPTO_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_OPENSSL_ENGINE_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_LIBSSL 1$(DL) >> $@ + @echo $(DL)#define HAVE_LIBCRYPTO 1$(DL) >> $@ + @echo $(DL)#define OPENSSL_NO_KRB5 1$(DL) >> $@ +endif +ifdef WITH_SSH2 + @echo $(DL)#define USE_LIBSSH2 1$(DL) >> $@ + @echo $(DL)#define HAVE_LIBSSH2_H 1$(DL) >> $@ +endif +ifdef WITH_IDN + @echo $(DL)#define HAVE_LIBIDN 1$(DL) >> $@ + @echo $(DL)#define HAVE_TLD_H 1$(DL) >> $@ +endif +ifdef WITH_RTMP + @echo $(DL)#define USE_LIBRTMP 1$(DL) >> $@ +endif + @echo $(DL)#ifdef __GNUC__$(DL) >> $@ + @echo $(DL)#define HAVE_VARIADIC_MACROS_GCC 1$(DL) >> $@ + @echo $(DL)#else$(DL) >> $@ + @echo $(DL)#define HAVE_VARIADIC_MACROS_C99 1$(DL) >> $@ + @echo $(DL)#endif$(DL) >> $@ +ifdef CABUNDLE + @echo $(DL)#define CURL_CA_BUNDLE "$(CABUNDLE)"$(DL) >> $@ +else + @echo $(DL)#define CURL_CA_BUNDLE getenv("CURL_CA_BUNDLE")$(DL) >> $@ +endif + +FORCE: ; + +info: $(OBJDIR)/version.inc + @echo Configured to build $(TARGET) with these options: + @echo libarchitecture: $(LIBARCH) + @echo curl version: $(LIBCURL_VERSION_STR) + @echo compiler/linker: $(CC) / $(LD) +ifdef CABUNDLE + @echo ca-bundle path: $(CABUNDLE) +endif +ifdef WITH_SSL + @echo SSL support: enabled (OpenSSL) +else + @echo SSL support: no +endif +ifdef WITH_SSH2 + @echo SSH2 support: enabled (libssh2) +else + @echo SSH2 support: no +endif +ifdef WITH_ZLIB + @echo zlib support: enabled +else + @echo zlib support: no +endif +ifdef WITH_ARES + @echo c-ares support: enabled +else + @echo c-ares support: no +endif +ifdef ENABLE_IPV6 + @echo ipv6 support: enabled +else + @echo ipv6 support: no +endif + +$(LIBCARES_PATH)/libcares.$(LIBEXT): + $(MAKE) -C $(LIBCARES_PATH) -f Makefile.netware lib + +ca-bundle.crt: mk-ca-bundle.pl + @echo Creating $@ + @-$(PERL) $< -b -n $@ + +$(CURL_INC)/curl/curlbuild.h: Makefile.netware FORCE + @echo Creating $@ + @echo $(DL)/* $@ intended for NetWare target.$(DL) > $@ + @echo $(DL)** Do not edit this file - it is created by make!$(DL) >> $@ + @echo $(DL)** All your changes will be lost!!$(DL) >> $@ + @echo $(DL)*/$(DL) >> $@ + @echo $(DL)#ifndef NETWARE$(DL) >> $@ + @echo $(DL)#error This $(notdir $@) is created for NetWare platform!$(DL) >> $@ + @echo $(DL)#endif$(DL) >> $@ + @echo $(DL)#ifndef __CURL_CURLBUILD_H$(DL) >> $@ + @echo $(DL)#define __CURL_CURLBUILD_H$(DL) >> $@ +ifeq ($(LIBARCH),LIBC) + @echo $(DL)#define CURL_SIZEOF_LONG 4$(DL) >> $@ + @echo $(DL)#define CURL_TYPEOF_CURL_SOCKLEN_T unsigned int$(DL) >> $@ + @echo $(DL)#define CURL_SIZEOF_CURL_SOCKLEN_T 4$(DL) >> $@ + @echo $(DL)#define CURL_TYPEOF_CURL_OFF_T long long$(DL) >> $@ + @echo $(DL)#define CURL_FORMAT_CURL_OFF_T "lld"$(DL) >> $@ + @echo $(DL)#define CURL_FORMAT_CURL_OFF_TU "llu"$(DL) >> $@ + @echo $(DL)#define CURL_FORMAT_OFF_T "$(PCT)lld"$(DL) >> $@ + @echo $(DL)#define CURL_SIZEOF_CURL_OFF_T 8$(DL) >> $@ + @echo $(DL)#define CURL_SUFFIX_CURL_OFF_T LL$(DL) >> $@ + @echo $(DL)#define CURL_SUFFIX_CURL_OFF_TU ULL$(DL) >> $@ +else + @echo $(DL)#define CURL_SIZEOF_LONG 4$(DL) >> $@ + @echo $(DL)#define CURL_TYPEOF_CURL_SOCKLEN_T int$(DL) >> $@ + @echo $(DL)#define CURL_SIZEOF_CURL_SOCKLEN_T 4$(DL) >> $@ + @echo $(DL)#define CURL_TYPEOF_CURL_OFF_T long$(DL) >> $@ + @echo $(DL)#define CURL_FORMAT_CURL_OFF_T "ld"$(DL) >> $@ + @echo $(DL)#define CURL_FORMAT_CURL_OFF_TU "lu"$(DL) >> $@ + @echo $(DL)#define CURL_FORMAT_OFF_T "$(PCT)ld"$(DL) >> $@ + @echo $(DL)#define CURL_SIZEOF_CURL_OFF_T 4$(DL) >> $@ + @echo $(DL)#define CURL_SUFFIX_CURL_OFF_T L$(DL) >> $@ + @echo $(DL)#define CURL_SUFFIX_CURL_OFF_TU UL$(DL) >> $@ +endif + @echo $(DL)typedef CURL_TYPEOF_CURL_SOCKLEN_T curl_socklen_t;$(DL) >> $@ + @echo $(DL)typedef CURL_TYPEOF_CURL_OFF_T curl_off_t;$(DL) >> $@ + @echo $(DL)#endif /* __CURL_CURLBUILD_H */$(DL) >> $@ + diff --git a/lib/Makefile.riscos b/lib/Makefile.riscos new file mode 100644 index 00000000..8c919878 --- /dev/null +++ b/lib/Makefile.riscos @@ -0,0 +1,232 @@ +# Makefile for project libcurl + +# Project objects: +objs = o.base64 o.connect o.cookie o.dict \ + o.dllinit o.easy o.escape o.file \ + o.formdata o.ftp o.getenv o.gopher \ + o.getinfo o.getpass o.hostip \ + o.hostip4 o.hostsyn o.http \ + o.http_chunks o.inet_ntop o.inet_pton o.if2ip o.krb4 o.ldap \ + o.curl_fnmatch o.fileinfo o.ftplistparser o.wildcard \ + o.memdebug o.mprintf o.netrc o.parsedate o.progress \ + o.security o.select o.sendf o.speedcheck o.ssluse \ + o.strequal o.strtok o.telnet o.timeval \ + o.transfer o.url o.version o.strtoofft o.sslgen o.gtls \ + o.rawstr o.curl_addrinfo o.slist o.nonblock o.curl_rand \ + o.curl_memrchr o.imap o.pop3 o.smtp o.pingpong o.rtsp \ + o.curl_threads o.warnless o.hmac o.md5 o.curl_rtmp \ + o.openldap o.polarssl o.md4 o.curl_gethostname + + +# Compile options: +linkopts = -o libcurl +compileropts = -mpoke-function-name -IUtilLib: -mthrowback + +# Project target: +libcurl: $(objs) + makealf $(linkopts) $(objs) + +# Static dependancies: +o.base64: c.base64 + gcc $(compileropts) -c -o base64.o c.base64 + +o.connect: c.connect + gcc $(compileropts) -c -o connect.o c.connect + +o.cookie: c.cookie + gcc $(compileropts) -c -o cookie.o c.cookie + +o.curl_addrinfo: c.curl_addrinfo + gcc $(compileropts) -c -o curl_addrinfo.o c.curl_addrinfo + +o.curl_gethostname: c.curl_gethostname + gcc $(compileropts) -c -o curl_gethostname.o c.curl_gethostname + +o.curl_memrchr: c.curl_memrchr + gcc $(compileropts) -c -o curl_memrchr.o c.curl_memrchr + +o.curl_rand: c.curl_rand + gcc $(compileropts) -c -o curl_rand.o c.curl_rand + +o.curl_rtmp: c.curl_rtmp + gcc $(compileropts) -c -o curl_rtmp.o c.curl_rtmp + +o.curl_threads: c.curl_threads + gcc $(compileropts) -c -o curl_threads.o c.curl_threads + +o.dict: c.dict + gcc $(compileropts) -c -o dict.o c.dict + +o.dllinit: c.dllinit + gcc $(compileropts) -c -o dllinit.o c.dllinit + +o.easy: c.easy + gcc $(compileropts) -c -o easy.o c.easy + +o.escape: c.escape + gcc $(compileropts) -c -o escape.o c.escape + +o.file: c.file + gcc $(compileropts) -c -o file.o c.file + +o.formdata: c.formdata + gcc $(compileropts) -c -o formdata.o c.formdata + +o.ftp: c.ftp + gcc $(compileropts) -c -o ftp.o c.ftp + +o.getenv: c.getenv + gcc $(compileropts) -c -o getenv.o c.getenv + +o.getinfo: c.getinfo + gcc $(compileropts) -c -o getinfo.o c.getinfo + +o.getpass: c.getpass + gcc $(compileropts) -c -o getpass.o c.getpass + +o.gopher: c.gopher + gcc $(compileropts) -c -o gopher.o c.gopher + +o.hmac: c.hmac + gcc $(compileropts) -c -o hmac.o c.hmac + +o.hostip: c.hostip + gcc $(compileropts) -c -o hostip.o c.hostip + +o.hostip4: c.hostip4 + gcc $(compileropts) -c -o hostip4.o c.hostip4 + +o.hostsyn: c.hostsyn + gcc $(compileropts) -c -o hostsyn.o c.hostsyn + +o.http: c.http + gcc $(compileropts) -c -o http.o c.http + +o.http_chunks: c.http_chunks + gcc $(compileropts) -c -o http_chunks.o c.http_chunks + +o.if2ip: c.if2ip + gcc $(compileropts) -c -o if2ip.o c.if2ip + +o.imap: c.imap + gcc $(compileropts) -c -o imap.o c.imap + +o.inet_ntop: c.inet_ntop + gcc $(compileropts) -c -o inet_ntop.o c.inet_ntop + +o.inet_pton: c.inet_pton + gcc $(compileropts) -c -o inet_pton.o c.inet_pton + +o.krb4: c.krb4 + gcc $(compileropts) -c -o krb4.o c.krb4 + +o.ldap: c.ldap + gcc $(compileropts) -IOpenLDAP: -c -o ldap.o c.ldap + +o.md4: c.md4 + gcc $(compileropts) -c -o md4.o c.md4 + +o.md5: c.md5 + gcc $(compileropts) -c -o md5.o c.md5 + +o.memdebug: c.memdebug + gcc $(compileropts) -c -o memdebug.o c.memdebug + +o.mprintf: c.mprintf + gcc $(compileropts) -c -o mprintf.o c.mprintf + +o.netrc: c.netrc + gcc $(compileropts) -c -o netrc.o c.netrc + +o.openldap: c.openldap + gcc $(compileropts) -c -o openldap.o c.openldap + +o.parsedate: c.parsedate + gcc $(compileropts) -c -o parsedate.o c.parsedate + +o.pingpong: c.pingpong + gcc $(compileropts) -c -o pingpong.o c.pingpong + +o.polarssl: c.polarssl + gcc $(compileropts) -c -o polarssl.o c.polarssl + +o.pop3: c.pop3 + gcc $(compileropts) -c -o pop3.o c.pop3 + +o.progress: c.progress + gcc $(compileropts) -c -o progress.o c.progress + +o.rtsp: c.rtsp + gcc $(compileropts) -c -o rtsp.o c.rtsp + +o.security: c.security + gcc $(compileropts) -c -o security.o c.security + +o.select: c.select + gcc $(compileropts) -c -o select.o c.select + +o.sendf: c.sendf + gcc $(compileropts) -c -o sendf.o c.sendf + +o.slist: c.slist + gcc $(compileropts) -c -o slist.o c.slist + +o.smtp: c.smtp + gcc $(compileropts) -c -o smtp.o c.smtp + +o.speedcheck: c.speedcheck + gcc $(compileropts) -c -o speedcheck.o c.speedcheck + +o.gtls: c.gtls + gcc $(compileropts) -c -o gtls.o c.gtls + +o.sslgen: c.sslgen + gcc $(compileropts) -c -o sslgen.o c.sslgen + +o.ssluse: c.ssluse + gcc $(compileropts) -c -o ssluse.o c.ssluse + +o.nonblock: c.nonblock + gcc $(compileropts) -c -o nonblock.o c.nonblock + +o.rawstr: c.rawstr + gcc $(compileropts) -c -o rawstr.o c.rawstr + +o.strequal: c.strequal + gcc $(compileropts) -c -o strequal.o c.strequal + +o.strtok: c.strtok + gcc $(compileropts) -c -o strtok.o c.strtok + +o.strtoofft: c.strtoofft + gcc $(compileropts) -c -o strtoofft.o c.strtoofft + +o.telnet: c.telnet + gcc $(compileropts) -c -o telnet.o c.telnet + +o.timeval: c.timeval + gcc $(compileropts) -c -o timeval.o c.timeval + +o.transfer: c.transfer + gcc $(compileropts) -c -o transfer.o c.transfer + +o.url: c.url + gcc $(compileropts) -c -o url.o c.url + +o.version: c.version + gcc $(compileropts) -c -o version.o c.version + +o.warnless: c.warnless + gcc $(compileropts) -c -o warnless.o c.warnless + +o.curl_fnmatch: c.curl_fnmatch + gcc $(compileropts) -c -o curl_fnmatch.o c.curl_fnmatch + +o.fileinfo: c.fileinfo + gcc $(compileropts) -c -o fileinfo.o c.fileinfo + +o.ftplistparser: c.ftplistparser + gcc $(compileropts) -c -o ftplistparser.o c.ftplistparser + +o.wildcard: c.wildcard + gcc $(compileropts) -c -o wildcard.o c.wildcard diff --git a/lib/Makefile.vc10 b/lib/Makefile.vc10 new file mode 100644 index 00000000..96005279 --- /dev/null +++ b/lib/Makefile.vc10 @@ -0,0 +1,571 @@ +#***************************************************************************
+# _ _ ____ _
+# Project ___| | | | _ \| |
+# / __| | | | |_) | |
+# | (__| |_| | _ <| |___
+# \___|\___/|_| \_\_____|
+#
+# Copyright (C) 1999 - 2010, Daniel Stenberg, <daniel@haxx.se>, 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.
+#
+# You may opt to use, copy, modify, merge, publish, distribute and/or sell
+# copies of the Software, and permit persons to whom the Software is
+# furnished to do so, under the terms of the COPYING file.
+#
+# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+# KIND, either express or implied.
+#
+###########################################################################
+#
+# Makefile for building libcurl with MSVC10
+#
+# Usage: see usage message below
+# Should be invoked from \lib directory
+# Edit the paths and desired library name
+# SSL path is only required if you intend compiling
+# with SSL.
+#
+# This make file leaves the result either a .lib or .dll file
+# in the \lib directory. It should be called from the \lib
+# directory.
+#
+# An option would have been to allow the source directory to
+# be specified, but I saw no requirement.
+#
+# Another option would have been to leave the .lib and .dll
+# files in the "cfg" directory, but then the make file
+# in \src would need to be changed.
+#
+##############################################################
+
+#
+# Stem for static libs and DLLs
+#
+LIB_NAME = libcurl
+LIB_NAME_DEBUG = libcurld
+
+#
+# Stem for DLL import libs
+#
+IMPLIB_NAME = libcurl_imp
+IMPLIB_NAME_DEBUG = libcurld_imp
+
+!IFNDEF OPENSSL_PATH
+OPENSSL_PATH = ../../openssl-0.9.8o
+!ENDIF
+
+!IFNDEF ZLIB_PATH
+ZLIB_PATH = ../../zlib-1.2.5
+!ENDIF
+
+!IFNDEF MACHINE
+MACHINE = X86
+!ENDIF
+
+# USE_WINDOWS_SSPI uses windows libraries to allow NTLM authentication
+# without an openssl installation and offers the ability to authenticate
+# using the "current logged in user". Since at least with MSVC10 the sspi.h
+# header is broken it is either required to install the Windows SDK,
+# or to fix sspi.h with adding this define at the beginning of sspi.h:
+# #define FreeCredentialHandle FreeCredentialsHandle
+#
+# If, for some reason the Windows SDK is installed but not installed
+# in the default location, you can specify WINDOWS_SDK_PATH.
+# It can be downloaded from:
+# http://www.microsoft.com/msdownload/platformsdk/sdkupdate/
+
+# WINDOWS_SSPI = 1
+
+!IFDEF WINDOWS_SSPI
+!IFNDEF WINDOWS_SDK_PATH
+WINDOWS_SDK_PATH = "C:\Program Files\Microsoft SDK"
+!ENDIF
+!ENDIF
+
+#############################################################
+## Nothing more to do below this line!
+
+CCNODBG = cl.exe /O2 /DNDEBUG
+CCDEBUG = cl.exe /Od /Gm /Zi /D_DEBUG /RTC1
+CFLAGSSSL = /DUSE_SSLEAY /I "$(OPENSSL_PATH)/inc32" /I "$(OPENSSL_PATH)/inc32/openssl"
+CFLAGSZLIB = /DHAVE_ZLIB_H /DHAVE_ZLIB /DHAVE_LIBZ /I "$(ZLIB_PATH)"
+CFLAGS = /I. /I../include /nologo /W3 /EHsc /DWIN32 /FD /c /DBUILDING_LIBCURL
+CFLAGSLIB = /DCURL_STATICLIB
+LNKDLL = link.exe /DLL
+LNKLIB = link.exe /lib
+LFLAGS = /nologo /machine:$(MACHINE)
+SSLLIBS = libeay32.lib ssleay32.lib
+ZLIBLIBSDLL= zdll.lib
+ZLIBLIBS = zlib.lib
+WINLIBS = ws2_32.lib wldap32.lib
+CFLAGS = $(CFLAGS)
+
+CFGSET = FALSE
+
+!IFDEF WINDOWS_SSPI
+CFLAGS = $(CFLAGS) /DUSE_WINDOWS_SSPI /I$(WINDOWS_SDK_PATH)\include
+!ENDIF
+
+!IFDEF USE_IPV6
+CFLAGS = $(CFLAGS) /DUSE_IPV6
+!ENDIF
+
+##############################################################
+# Runtime library configuration
+
+RTLIB = /MD
+RTLIBD = /MDd
+
+!IF "$(RTLIBCFG)" == "static"
+RTLIB = /MT
+RTLIBD = /MTd
+!ENDIF
+
+
+######################
+# release
+
+!IF "$(CFG)" == "release"
+TARGET = $(LIB_NAME).lib
+DIROBJ = $(CFG)
+LNK = $(LNKLIB) /out:$(DIROBJ)\$(TARGET)
+CC = $(CCNODBG) $(RTLIB) $(CFLAGSLIB)
+CFGSET = TRUE
+!ENDIF
+
+######################
+# release-zlib
+
+!IF "$(CFG)" == "release-zlib"
+TARGET = $(LIB_NAME).lib
+DIROBJ = $(CFG)
+LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
+LNK = $(LNKLIB) $(ZLIBLIBS) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET)
+CC = $(CCNODBG) $(RTLIB) $(CFLAGSZLIB) $(CFLAGSLIB)
+CFGSET = TRUE
+!ENDIF
+
+######################
+# release-dll
+
+!IF "$(CFG)" == "release-dll"
+TARGET = $(LIB_NAME).dll
+DIROBJ = $(CFG)
+LNK = $(LNKDLL) $(WINLIBS) /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME).lib
+CC = $(CCNODBG) $(RTLIB)
+CFGSET = TRUE
+RESOURCE = $(DIROBJ)\libcurl.res
+!ENDIF
+
+######################
+# release-ssl
+
+!IF "$(CFG)" == "release-ssl"
+TARGET = $(LIB_NAME).lib
+DIROBJ = $(CFG)
+LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32"
+LNK = $(LNKLIB) $(LFLAGSSSL) /out:$(DIROBJ)\$(TARGET)
+CC = $(CCNODBG) $(RTLIB) $(CFLAGSSSL) $(CFLAGSLIB)
+CFGSET = TRUE
+!ENDIF
+
+######################
+# release-ssl-dll
+
+!IF "$(CFG)" == "release-ssl-dll"
+TARGET = $(LIB_NAME).lib
+DIROBJ = $(CFG)
+LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll"
+LNK = $(LNKLIB) $(WINLIBS) $(SSLLIBS) $(LFLAGSSSL) /out:$(DIROBJ)\$(TARGET)
+CC = $(CCNODBG) $(RTLIB) $(CFLAGSSSL) $(CFLAGSLIB)
+CFGSET = TRUE
+!ENDIF
+
+######################
+# release-ssl-zlib
+
+!IF "$(CFG)" == "release-ssl-zlib"
+TARGET = $(LIB_NAME).lib
+DIROBJ = $(CFG)
+LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32"
+LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
+LNK = $(LNKLIB) $(LFLAGSSSL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET)
+CC = $(CCNODBG) $(RTLIB) $(CFLAGSSSL) $(CFLAGSZLIB) $(CFLAGSLIB)
+CFGSET = TRUE
+!ENDIF
+
+######################
+# release-dll-ssl-dll
+
+!IF "$(CFG)" == "release-dll-ssl-dll"
+TARGET = $(LIB_NAME).dll
+DIROBJ = $(CFG)
+LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll"
+LNK = $(LNKDLL) $(WINLIBS) $(SSLLIBS) $(LFLAGSSSL) /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME).lib
+CC = $(CCNODBG) $(RTLIB) $(CFLAGSSSL)
+CFGSET = TRUE
+RESOURCE = $(DIROBJ)\libcurl.res
+!ENDIF
+
+######################
+# release-zlib-dll
+
+!IF "$(CFG)" == "release-zlib-dll"
+TARGET = $(LIB_NAME).lib
+DIROBJ = $(CFG)
+LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
+LNK = $(LNKLIB) $(WINLIBS) $(ZLIBLIBSDLL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET)
+CC = $(CCNODBG) $(RTLIB) $(CFLAGSZLIB) $(CFLAGSLIB)
+CFGSET = TRUE
+!ENDIF
+
+######################
+# release-ssl-dll-zlib-dll
+
+!IF "$(CFG)" == "release-ssl-dll-zlib-dll"
+TARGET = $(LIB_NAME).lib
+DIROBJ = $(CFG)
+LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
+LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll"
+LNK = $(LNKLIB) $(WINLIBS) $(SSLLIBS) $(ZLIBLIBSDLL) $(LFLAGSSSL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET)
+CC = $(CCNODBG) $(RTLIB) $(CFLAGSSSL) $(CFLAGSZLIB) $(CFLAGSLIB)
+CFGSET = TRUE
+!ENDIF
+
+######################
+# release-dll-zlib-dll
+
+!IF "$(CFG)" == "release-dll-zlib-dll"
+TARGET = $(LIB_NAME).dll
+DIROBJ = $(CFG)
+LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
+LNK = $(LNKDLL) $(WINLIBS) $(ZLIBLIBSDLL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME).lib
+CC = $(CCNODBG) $(RTLIB) $(CFLAGSZLIB)
+CFGSET = TRUE
+RESOURCE = $(DIROBJ)\libcurl.res
+!ENDIF
+
+######################
+# release-dll-ssl-dll-zlib-dll
+
+!IF "$(CFG)" == "release-dll-ssl-dll-zlib-dll"
+TARGET = $(LIB_NAME).dll
+DIROBJ = $(CFG)
+LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
+LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll"
+LNK = $(LNKDLL) $(WINLIBS) $(SSLLIBS) $(ZLIBLIBSDLL) $(LFLAGSSSL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME).lib
+CC = $(CCNODBG) $(RTLIB) $(CFLAGSSSL) $(CFLAGSZLIB)
+CFGSET = TRUE
+RESOURCE = $(DIROBJ)\libcurl.res
+!ENDIF
+
+######################
+# debug
+
+!IF "$(CFG)" == "debug"
+TARGET = $(LIB_NAME_DEBUG).lib
+DIROBJ = $(CFG)
+LNK = $(LNKLIB) /out:$(DIROBJ)\$(TARGET)
+CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSLIB)
+CFGSET = TRUE
+!ENDIF
+
+######################
+# debug-ssl
+
+!IF "$(CFG)" == "debug-ssl"
+TARGET = $(LIB_NAME_DEBUG).lib
+DIROBJ = $(CFG)
+LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32"
+LNK = $(LNKLIB) $(LFLAGSSSL) /out:$(DIROBJ)\$(TARGET)
+CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSSSL) $(CFLAGSLIB)
+CFGSET = TRUE
+!ENDIF
+
+######################
+# debug-zlib
+
+!IF "$(CFG)" == "debug-zlib"
+TARGET = $(LIB_NAME_DEBUG).lib
+DIROBJ = $(CFG)
+LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
+LNK = $(LNKLIB) $(ZLIBLIBS) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET)
+CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSZLIB) $(CFLAGSLIB)
+CFGSET = TRUE
+!ENDIF
+
+######################
+# debug-ssl-dll
+
+!IF "$(CFG)" == "debug-ssl-dll"
+TARGET = $(LIB_NAME_DEBUG).lib
+DIROBJ = $(CFG)
+LFLAGSSSL = /LIBPATH:$(OPENSSL_PATH)\out32dll
+LNK = $(LNKLIB) $(WINLIBS) $(SSLLIBS) $(LFLAGSSSL) /out:$(DIROBJ)\$(TARGET)
+CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSSSL) $(CFLAGSLIB)
+CFGSET = TRUE
+!ENDIF
+
+######################
+# debug-ssl-zlib
+
+!IF "$(CFG)" == "debug-ssl-zlib"
+TARGET = $(LIB_NAME_DEBUG).lib
+DIROBJ = $(CFG)
+LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
+LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32"
+LNK = $(LNKLIB) $(ZLIBLIBS) $(LFLAGSSSL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET)
+CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSSSL) $(CFLAGSZLIB) $(CFLAGSLIB)
+CFGSET = TRUE
+!ENDIF
+
+######################
+# debug-zlib-dll
+
+!IF "$(CFG)" == "debug-zlib-dll"
+TARGET = $(LIB_NAME_DEBUG).lib
+DIROBJ = $(CFG)
+LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
+LNK = $(LNKLIB) $(WINLIBS) $(ZLIBLIBSDLL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET)
+CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSZLIB) $(CFLAGSLIB)
+CFGSET = TRUE
+!ENDIF
+
+######################
+# debug-ssl-dll-zlib-dll
+
+!IF "$(CFG)" == "debug-ssl-dll-zlib-dll"
+TARGET = $(LIB_NAME_DEBUG).lib
+DIROBJ = $(CFG)
+LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
+LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll"
+LNK = $(LNKLIB) $(WINLIBS) $(SSLLIBS) $(ZLIBLIBSDLL) $(LFLAGSSSL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET)
+CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSSSL) $(CFLAGSZLIB) $(CFLAGSLIB)
+CFGSET = TRUE
+!ENDIF
+
+######################
+# debug-dll
+
+!IF "$(CFG)" == "debug-dll"
+TARGET = $(LIB_NAME_DEBUG).dll
+DIROBJ = $(CFG)
+LNK = $(LNKDLL) $(WINLIBS) /DEBUG /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).lib /PDB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).pdb
+CC = $(CCDEBUG) $(RTLIBD)
+CFGSET = TRUE
+RESOURCE = $(DIROBJ)\libcurl.res
+!ENDIF
+
+######################
+# debug-dll-ssl-dll
+
+!IF "$(CFG)" == "debug-dll-ssl-dll"
+TARGET = $(LIB_NAME_DEBUG).dll
+DIROBJ = $(CFG)
+LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll"
+LNK = $(LNKDLL) $(WINLIBS) $(SSLLIBS) $(LFLAGSSSL) /DEBUG /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).lib /PDB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).pdb
+CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSSSL)
+CFGSET = TRUE
+RESOURCE = $(DIROBJ)\libcurl.res
+!ENDIF
+
+######################
+# debug-dll-zlib-dll
+
+!IF "$(CFG)" == "debug-dll-zlib-dll"
+TARGET = $(LIB_NAME_DEBUG).dll
+DIROBJ = $(CFG)
+LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
+LNK = $(LNKDLL) $(WINLIBS) $(ZLIBLIBSDLL) $(LFLAGSZLIB) /DEBUG /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).lib /PDB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).pdb
+CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSZLIB)
+CFGSET = TRUE
+RESOURCE = $(DIROBJ)\libcurl.res
+!ENDIF
+
+######################
+# debug-dll-ssl-dll-zlib-dll
+
+!IF "$(CFG)" == "debug-dll-ssl-dll-zlib-dll"
+TARGET = $(LIB_NAME_DEBUG).dll
+DIROBJ = $(CFG)
+LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
+LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll"
+LNK = $(LNKDLL) $(WINLIBS) $(SSLLIBS) $(ZLIBLIBSDLL) $(LFLAGSSSL) $(LFLAGSZLIB) /DEBUG /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).lib /PDB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).pdb
+CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSSSL) $(CFLAGSZLIB)
+CFGSET = TRUE
+RESOURCE = $(DIROBJ)\libcurl.res
+!ENDIF
+
+#######################
+# Usage
+#
+!IF "$(CFGSET)" == "FALSE" && "$(CFG)" != ""
+!MESSAGE Usage: nmake /f makefile.vc10 CFG=<config> <target>
+!MESSAGE where <config> is one of:
+!MESSAGE release - release static library
+!MESSAGE release-ssl - release static library with ssl
+!MESSAGE release-zlib - release static library with zlib
+!MESSAGE release-ssl-zlib - release static library with ssl and zlib
+!MESSAGE release-ssl-dll - release static library with dynamic ssl
+!MESSAGE release-zlib-dll - release static library with dynamic zlib
+!MESSAGE release-ssl-dll-zlib-dll - release static library with dynamic ssl and dynamic zlib
+!MESSAGE release-dll - release dynamic library
+!MESSAGE release-dll-ssl-dll - release dynamic library with dynamic ssl
+!MESSAGE release-dll-zlib-dll - release dynamic library with dynamic zlib
+!MESSAGE release-dll-ssl-dll-zlib-dll - release dynamic library with dynamic ssl and dynamic zlib
+!MESSAGE debug - debug static library
+!MESSAGE debug-ssl - debug static library with ssl
+!MESSAGE debug-zlib - debug static library with zlib
+!MESSAGE debug-ssl-zlib - debug static library with ssl and zlib
+!MESSAGE debug-ssl-dll - debug static library with dynamic ssl
+!MESSAGE debug-zlib-dll - debug static library with dynamic zlib
+!MESSAGE debug-ssl-dll-zlib-dll - debug static library with dynamic ssl and dynamic zlib
+!MESSAGE debug-dll - debug dynamic library
+!MESSAGE debug-dll-ssl-dll - debug dynamic library with dynamic ssl
+!MESSAGE debug-dll-zlib-dll - debug dynamic library with dynamic zlib1
+!MESSAGE debug-dll-ssl-dll-zlib-dll - debug dynamic library with dynamic ssl and dynamic zlib
+!MESSAGE <target> can be left blank in which case all is assumed
+!ERROR please choose a valid configuration "$(CFG)"
+!ENDIF
+
+#######################
+# Only the clean target can be used if a config was not provided.
+#
+!IF "$(CFGSET)" == "FALSE"
+clean:
+ @-erase /s *.dll 2> NUL
+ @-erase /s *.exp 2> NUL
+ @-erase /s *.idb 2> NUL
+ @-erase /s *.lib 2> NUL
+ @-erase /s *.obj 2> NUL
+ @-erase /s *.pch 2> NUL
+ @-erase /s *.pdb 2> NUL
+ @-erase /s *.res 2> NUL
+!ELSE
+# A config was provided, so the library can be built.
+#
+X_OBJS= \
+ $(DIROBJ)\base64.obj \
+ $(DIROBJ)\connect.obj \
+ $(DIROBJ)\content_encoding.obj \
+ $(DIROBJ)\cookie.obj \
+ $(DIROBJ)\curl_addrinfo.obj \
+ $(DIROBJ)\curl_fnmatch.obj \
+ $(DIROBJ)\curl_gethostname.obj \
+ $(DIROBJ)\curl_memrchr.obj \
+ $(DIROBJ)\curl_rand.obj \
+ $(DIROBJ)\curl_rtmp.obj \
+ $(DIROBJ)\curl_sspi.obj \
+ $(DIROBJ)\curl_threads.obj \
+ $(DIROBJ)\dict.obj \
+ $(DIROBJ)\easy.obj \
+ $(DIROBJ)\escape.obj \
+ $(DIROBJ)\fileinfo.obj \
+ $(DIROBJ)\file.obj \
+ $(DIROBJ)\formdata.obj \
+ $(DIROBJ)\ftplistparser.obj \
+ $(DIROBJ)\ftp.obj \
+ $(DIROBJ)\getenv.obj \
+ $(DIROBJ)\getinfo.obj \
+ $(DIROBJ)\gtls.obj \
+ $(DIROBJ)\gopher.obj \
+ $(DIROBJ)\hash.obj \
+ $(DIROBJ)\hmac.obj \
+ $(DIROBJ)\hostares.obj \
+ $(DIROBJ)\hostasyn.obj \
+ $(DIROBJ)\hostip4.obj \
+ $(DIROBJ)\hostip6.obj \
+ $(DIROBJ)\hostip.obj \
+ $(DIROBJ)\hostsyn.obj \
+ $(DIROBJ)\hostthre.obj \
+ $(DIROBJ)\http_chunks.obj \
+ $(DIROBJ)\http_digest.obj \
+ $(DIROBJ)\http_negotiate.obj \
+ $(DIROBJ)\http_ntlm.obj \
+ $(DIROBJ)\http.obj \
+ $(DIROBJ)\if2ip.obj \
+ $(DIROBJ)\imap.obj \
+ $(DIROBJ)\inet_ntop.obj \
+ $(DIROBJ)\inet_pton.obj \
+ $(DIROBJ)\ldap.obj \
+ $(DIROBJ)\llist.obj \
+ $(DIROBJ)\md4.obj \
+ $(DIROBJ)\md5.obj \
+ $(DIROBJ)\memdebug.obj \
+ $(DIROBJ)\mprintf.obj \
+ $(DIROBJ)\multi.obj \
+ $(DIROBJ)\netrc.obj \
+ $(DIROBJ)\nonblock.obj \
+ $(DIROBJ)\openldap.obj \
+ $(DIROBJ)\parsedate.obj \
+ $(DIROBJ)\pingpong.obj \
+ $(DIROBJ)\polarssl.obj \
+ $(DIROBJ)\pop3.obj \
+ $(DIROBJ)\progress.obj \
+ $(DIROBJ)\rawstr.obj \
+ $(DIROBJ)\rtsp.obj \
+ $(DIROBJ)\select.obj \
+ $(DIROBJ)\sendf.obj \
+ $(DIROBJ)\share.obj \
+ $(DIROBJ)\slist.obj \
+ $(DIROBJ)\smtp.obj \
+ $(DIROBJ)\socks_gssapi.obj \
+ $(DIROBJ)\socks.obj \
+ $(DIROBJ)\socks_sspi.obj \
+ $(DIROBJ)\speedcheck.obj \
+ $(DIROBJ)\splay.obj \
+ $(DIROBJ)\ssh.obj \
+ $(DIROBJ)\sslgen.obj \
+ $(DIROBJ)\ssluse.obj \
+ $(DIROBJ)\strequal.obj \
+ $(DIROBJ)\strerror.obj \
+ $(DIROBJ)\strtok.obj \
+ $(DIROBJ)\strtoofft.obj \
+ $(DIROBJ)\telnet.obj \
+ $(DIROBJ)\tftp.obj \
+ $(DIROBJ)\timeval.obj \
+ $(DIROBJ)\transfer.obj \
+ $(DIROBJ)\url.obj \
+ $(DIROBJ)\version.obj \
+ $(DIROBJ)\warnless.obj \
+ $(DIROBJ)\wildcard.obj \
+ $(RESOURCE)
+
+all : $(TARGET)
+
+$(TARGET): $(X_OBJS)
+ $(LNK) $(LFLAGS) $(X_OBJS)
+ -xcopy $(DIROBJ)\$(LIB_NAME).dll . /y
+ -xcopy $(DIROBJ)\$(LIB_NAME).lib . /y
+ -xcopy $(DIROBJ)\$(LIB_NAME_DEBUG).dll . /y
+ -xcopy $(DIROBJ)\$(LIB_NAME_DEBUG).lib . /y
+ -xcopy $(DIROBJ)\$(IMPLIB_NAME).lib . /y
+ -xcopy $(DIROBJ)\$(IMPLIB_NAME_DEBUG).lib . /y
+ -xcopy $(DIROBJ)\*.exp . /y
+ -xcopy $(DIROBJ)\*.pdb . /y
+
+$(X_OBJS): $(DIROBJ)
+
+$(DIROBJ):
+ @if not exist "$(DIROBJ)" mkdir $(DIROBJ)
+
+.SUFFIXES: .c .obj .res
+
+{.\}.c{$(DIROBJ)\}.obj:
+ $(CC) $(CFLAGS) /Fo"$@" $<
+
+debug-dll\libcurl.res \
+debug-dll-ssl-dll\libcurl.res \
+debug-dll-zlib-dll\libcurl.res \
+debug-dll-ssl-dll-zlib-dll\libcurl.res: libcurl.rc
+ rc /dDEBUGBUILD=1 /Fo $@ libcurl.rc
+
+release-dll\libcurl.res \
+release-dll-ssl-dll\libcurl.res \
+release-dll-zlib-dll\libcurl.res \
+release-dll-ssl-dll-zlib-dll\libcurl.res: libcurl.rc
+ rc /dDEBUGBUILD=0 /Fo $@ libcurl.rc
+!ENDIF # End of case where a config was provided.
diff --git a/lib/Makefile.vc6 b/lib/Makefile.vc6 new file mode 100644 index 00000000..2e18e145 --- /dev/null +++ b/lib/Makefile.vc6 @@ -0,0 +1,571 @@ +#***************************************************************************
+# _ _ ____ _
+# Project ___| | | | _ \| |
+# / __| | | | |_) | |
+# | (__| |_| | _ <| |___
+# \___|\___/|_| \_\_____|
+#
+# Copyright (C) 1999 - 2010, Daniel Stenberg, <daniel@haxx.se>, 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.
+#
+# You may opt to use, copy, modify, merge, publish, distribute and/or sell
+# copies of the Software, and permit persons to whom the Software is
+# furnished to do so, under the terms of the COPYING file.
+#
+# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+# KIND, either express or implied.
+#
+###########################################################################
+#
+# Makefile for building libcurl with MSVC6
+#
+# Usage: see usage message below
+# Should be invoked from \lib directory
+# Edit the paths and desired library name
+# SSL path is only required if you intend compiling
+# with SSL.
+#
+# This make file leaves the result either a .lib or .dll file
+# in the \lib directory. It should be called from the \lib
+# directory.
+#
+# An option would have been to allow the source directory to
+# be specified, but I saw no requirement.
+#
+# Another option would have been to leave the .lib and .dll
+# files in the "cfg" directory, but then the make file
+# in \src would need to be changed.
+#
+##############################################################
+
+#
+# Stem for static libs and DLLs
+#
+LIB_NAME = libcurl
+LIB_NAME_DEBUG = libcurld
+
+#
+# Stem for DLL import libs
+#
+IMPLIB_NAME = libcurl_imp
+IMPLIB_NAME_DEBUG = libcurld_imp
+
+!IFNDEF OPENSSL_PATH
+OPENSSL_PATH = ../../openssl-0.9.8o
+!ENDIF
+
+!IFNDEF ZLIB_PATH
+ZLIB_PATH = ../../zlib-1.2.5
+!ENDIF
+
+!IFNDEF MACHINE
+MACHINE = X86
+!ENDIF
+
+# USE_WINDOWS_SSPI uses windows libraries to allow NTLM authentication
+# without an openssl installation and offers the ability to authenticate
+# using the "current logged in user". Since at least with MSVC6 the sspi.h
+# header is broken it is either required to install the Windows SDK,
+# or to fix sspi.h with adding this define at the beginning of sspi.h:
+# #define FreeCredentialHandle FreeCredentialsHandle
+#
+# If, for some reason the Windows SDK is installed but not installed
+# in the default location, you can specify WINDOWS_SDK_PATH.
+# It can be downloaded from:
+# http://www.microsoft.com/msdownload/platformsdk/sdkupdate/
+
+# WINDOWS_SSPI = 1
+
+!IFDEF WINDOWS_SSPI
+!IFNDEF WINDOWS_SDK_PATH
+WINDOWS_SDK_PATH = "C:\Program Files\Microsoft SDK"
+!ENDIF
+!ENDIF
+
+#############################################################
+## Nothing more to do below this line!
+
+CCNODBG = cl.exe /O2 /DNDEBUG
+CCDEBUG = cl.exe /Od /Gm /Zi /D_DEBUG /GZ
+CFLAGSSSL = /DUSE_SSLEAY /I "$(OPENSSL_PATH)/inc32" /I "$(OPENSSL_PATH)/inc32/openssl"
+CFLAGSZLIB = /DHAVE_ZLIB_H /DHAVE_ZLIB /DHAVE_LIBZ /I "$(ZLIB_PATH)"
+CFLAGS = /I. /I../include /nologo /W3 /GX /DWIN32 /YX /FD /c /DBUILDING_LIBCURL
+CFLAGSLIB = /DCURL_STATICLIB
+LNKDLL = link.exe /DLL
+LNKLIB = link.exe /lib
+LFLAGS = /nologo /machine:$(MACHINE)
+SSLLIBS = libeay32.lib ssleay32.lib
+ZLIBLIBSDLL= zdll.lib
+ZLIBLIBS = zlib.lib
+WINLIBS = ws2_32.lib wldap32.lib
+CFLAGS = $(CFLAGS)
+
+CFGSET = FALSE
+
+!IFDEF WINDOWS_SSPI
+CFLAGS = $(CFLAGS) /DUSE_WINDOWS_SSPI /I$(WINDOWS_SDK_PATH)\include
+!ENDIF
+
+!IFDEF USE_IPV6
+CFLAGS = $(CFLAGS) /DUSE_IPV6
+!ENDIF
+
+##############################################################
+# Runtime library configuration
+
+RTLIB = /MD
+RTLIBD = /MDd
+
+!IF "$(RTLIBCFG)" == "static"
+RTLIB = /MT
+RTLIBD = /MTd
+!ENDIF
+
+
+######################
+# release
+
+!IF "$(CFG)" == "release"
+TARGET = $(LIB_NAME).lib
+DIROBJ = $(CFG)
+LNK = $(LNKLIB) /out:$(DIROBJ)\$(TARGET)
+CC = $(CCNODBG) $(RTLIB) $(CFLAGSLIB)
+CFGSET = TRUE
+!ENDIF
+
+######################
+# release-zlib
+
+!IF "$(CFG)" == "release-zlib"
+TARGET = $(LIB_NAME).lib
+DIROBJ = $(CFG)
+LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
+LNK = $(LNKLIB) $(ZLIBLIBS) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET)
+CC = $(CCNODBG) $(RTLIB) $(CFLAGSZLIB) $(CFLAGSLIB)
+CFGSET = TRUE
+!ENDIF
+
+######################
+# release-dll
+
+!IF "$(CFG)" == "release-dll"
+TARGET = $(LIB_NAME).dll
+DIROBJ = $(CFG)
+LNK = $(LNKDLL) $(WINLIBS) /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME).lib
+CC = $(CCNODBG) $(RTLIB)
+CFGSET = TRUE
+RESOURCE = $(DIROBJ)\libcurl.res
+!ENDIF
+
+######################
+# release-ssl
+
+!IF "$(CFG)" == "release-ssl"
+TARGET = $(LIB_NAME).lib
+DIROBJ = $(CFG)
+LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32"
+LNK = $(LNKLIB) $(LFLAGSSSL) /out:$(DIROBJ)\$(TARGET)
+CC = $(CCNODBG) $(RTLIB) $(CFLAGSSSL) $(CFLAGSLIB)
+CFGSET = TRUE
+!ENDIF
+
+######################
+# release-ssl-dll
+
+!IF "$(CFG)" == "release-ssl-dll"
+TARGET = $(LIB_NAME).lib
+DIROBJ = $(CFG)
+LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll"
+LNK = $(LNKLIB) $(WINLIBS) $(SSLLIBS) $(LFLAGSSSL) /out:$(DIROBJ)\$(TARGET)
+CC = $(CCNODBG) $(RTLIB) $(CFLAGSSSL) $(CFLAGSLIB)
+CFGSET = TRUE
+!ENDIF
+
+######################
+# release-ssl-zlib
+
+!IF "$(CFG)" == "release-ssl-zlib"
+TARGET = $(LIB_NAME).lib
+DIROBJ = $(CFG)
+LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32"
+LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
+LNK = $(LNKLIB) $(LFLAGSSSL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET)
+CC = $(CCNODBG) $(RTLIB) $(CFLAGSSSL) $(CFLAGSZLIB) $(CFLAGSLIB)
+CFGSET = TRUE
+!ENDIF
+
+######################
+# release-dll-ssl-dll
+
+!IF "$(CFG)" == "release-dll-ssl-dll"
+TARGET = $(LIB_NAME).dll
+DIROBJ = $(CFG)
+LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll"
+LNK = $(LNKDLL) $(WINLIBS) $(SSLLIBS) $(LFLAGSSSL) /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME).lib
+CC = $(CCNODBG) $(RTLIB) $(CFLAGSSSL)
+CFGSET = TRUE
+RESOURCE = $(DIROBJ)\libcurl.res
+!ENDIF
+
+######################
+# release-zlib-dll
+
+!IF "$(CFG)" == "release-zlib-dll"
+TARGET = $(LIB_NAME).lib
+DIROBJ = $(CFG)
+LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
+LNK = $(LNKLIB) $(WINLIBS) $(ZLIBLIBSDLL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET)
+CC = $(CCNODBG) $(RTLIB) $(CFLAGSZLIB) $(CFLAGSLIB)
+CFGSET = TRUE
+!ENDIF
+
+######################
+# release-ssl-dll-zlib-dll
+
+!IF "$(CFG)" == "release-ssl-dll-zlib-dll"
+TARGET = $(LIB_NAME).lib
+DIROBJ = $(CFG)
+LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
+LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll"
+LNK = $(LNKLIB) $(WINLIBS) $(SSLLIBS) $(ZLIBLIBSDLL) $(LFLAGSSSL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET)
+CC = $(CCNODBG) $(RTLIB) $(CFLAGSSSL) $(CFLAGSZLIB) $(CFLAGSLIB)
+CFGSET = TRUE
+!ENDIF
+
+######################
+# release-dll-zlib-dll
+
+!IF "$(CFG)" == "release-dll-zlib-dll"
+TARGET = $(LIB_NAME).dll
+DIROBJ = $(CFG)
+LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
+LNK = $(LNKDLL) $(WINLIBS) $(ZLIBLIBSDLL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME).lib
+CC = $(CCNODBG) $(RTLIB) $(CFLAGSZLIB)
+CFGSET = TRUE
+RESOURCE = $(DIROBJ)\libcurl.res
+!ENDIF
+
+######################
+# release-dll-ssl-dll-zlib-dll
+
+!IF "$(CFG)" == "release-dll-ssl-dll-zlib-dll"
+TARGET = $(LIB_NAME).dll
+DIROBJ = $(CFG)
+LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
+LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll"
+LNK = $(LNKDLL) $(WINLIBS) $(SSLLIBS) $(ZLIBLIBSDLL) $(LFLAGSSSL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME).lib
+CC = $(CCNODBG) $(RTLIB) $(CFLAGSSSL) $(CFLAGSZLIB)
+CFGSET = TRUE
+RESOURCE = $(DIROBJ)\libcurl.res
+!ENDIF
+
+######################
+# debug
+
+!IF "$(CFG)" == "debug"
+TARGET = $(LIB_NAME_DEBUG).lib
+DIROBJ = $(CFG)
+LNK = $(LNKLIB) /out:$(DIROBJ)\$(TARGET)
+CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSLIB)
+CFGSET = TRUE
+!ENDIF
+
+######################
+# debug-ssl
+
+!IF "$(CFG)" == "debug-ssl"
+TARGET = $(LIB_NAME_DEBUG).lib
+DIROBJ = $(CFG)
+LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32"
+LNK = $(LNKLIB) $(LFLAGSSSL) /out:$(DIROBJ)\$(TARGET)
+CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSSSL) $(CFLAGSLIB)
+CFGSET = TRUE
+!ENDIF
+
+######################
+# debug-zlib
+
+!IF "$(CFG)" == "debug-zlib"
+TARGET = $(LIB_NAME_DEBUG).lib
+DIROBJ = $(CFG)
+LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
+LNK = $(LNKLIB) $(ZLIBLIBS) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET)
+CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSZLIB) $(CFLAGSLIB)
+CFGSET = TRUE
+!ENDIF
+
+######################
+# debug-ssl-dll
+
+!IF "$(CFG)" == "debug-ssl-dll"
+TARGET = $(LIB_NAME_DEBUG).lib
+DIROBJ = $(CFG)
+LFLAGSSSL = /LIBPATH:$(OPENSSL_PATH)\out32dll
+LNK = $(LNKLIB) $(WINLIBS) $(SSLLIBS) $(LFLAGSSSL) /out:$(DIROBJ)\$(TARGET)
+CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSSSL) $(CFLAGSLIB)
+CFGSET = TRUE
+!ENDIF
+
+######################
+# debug-ssl-zlib
+
+!IF "$(CFG)" == "debug-ssl-zlib"
+TARGET = $(LIB_NAME_DEBUG).lib
+DIROBJ = $(CFG)
+LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
+LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32"
+LNK = $(LNKLIB) $(ZLIBLIBS) $(LFLAGSSSL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET)
+CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSSSL) $(CFLAGSZLIB) $(CFLAGSLIB)
+CFGSET = TRUE
+!ENDIF
+
+######################
+# debug-zlib-dll
+
+!IF "$(CFG)" == "debug-zlib-dll"
+TARGET = $(LIB_NAME_DEBUG).lib
+DIROBJ = $(CFG)
+LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
+LNK = $(LNKLIB) $(WINLIBS) $(ZLIBLIBSDLL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET)
+CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSZLIB) $(CFLAGSLIB)
+CFGSET = TRUE
+!ENDIF
+
+######################
+# debug-ssl-dll-zlib-dll
+
+!IF "$(CFG)" == "debug-ssl-dll-zlib-dll"
+TARGET = $(LIB_NAME_DEBUG).lib
+DIROBJ = $(CFG)
+LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
+LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll"
+LNK = $(LNKLIB) $(WINLIBS) $(SSLLIBS) $(ZLIBLIBSDLL) $(LFLAGSSSL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET)
+CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSSSL) $(CFLAGSZLIB) $(CFLAGSLIB)
+CFGSET = TRUE
+!ENDIF
+
+######################
+# debug-dll
+
+!IF "$(CFG)" == "debug-dll"
+TARGET = $(LIB_NAME_DEBUG).dll
+DIROBJ = $(CFG)
+LNK = $(LNKDLL) $(WINLIBS) /DEBUG /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).lib /PDB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).pdb
+CC = $(CCDEBUG) $(RTLIBD)
+CFGSET = TRUE
+RESOURCE = $(DIROBJ)\libcurl.res
+!ENDIF
+
+######################
+# debug-dll-ssl-dll
+
+!IF "$(CFG)" == "debug-dll-ssl-dll"
+TARGET = $(LIB_NAME_DEBUG).dll
+DIROBJ = $(CFG)
+LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll"
+LNK = $(LNKDLL) $(WINLIBS) $(SSLLIBS) $(LFLAGSSSL) /DEBUG /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).lib /PDB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).pdb
+CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSSSL)
+CFGSET = TRUE
+RESOURCE = $(DIROBJ)\libcurl.res
+!ENDIF
+
+######################
+# debug-dll-zlib-dll
+
+!IF "$(CFG)" == "debug-dll-zlib-dll"
+TARGET = $(LIB_NAME_DEBUG).dll
+DIROBJ = $(CFG)
+LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
+LNK = $(LNKDLL) $(WINLIBS) $(ZLIBLIBSDLL) $(LFLAGSZLIB) /DEBUG /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).lib /PDB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).pdb
+CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSZLIB)
+CFGSET = TRUE
+RESOURCE = $(DIROBJ)\libcurl.res
+!ENDIF
+
+######################
+# debug-dll-ssl-dll-zlib-dll
+
+!IF "$(CFG)" == "debug-dll-ssl-dll-zlib-dll"
+TARGET = $(LIB_NAME_DEBUG).dll
+DIROBJ = $(CFG)
+LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
+LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll"
+LNK = $(LNKDLL) $(WINLIBS) $(SSLLIBS) $(ZLIBLIBSDLL) $(LFLAGSSSL) $(LFLAGSZLIB) /DEBUG /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).lib /PDB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).pdb
+CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSSSL) $(CFLAGSZLIB)
+CFGSET = TRUE
+RESOURCE = $(DIROBJ)\libcurl.res
+!ENDIF
+
+#######################
+# Usage
+#
+!IF "$(CFGSET)" == "FALSE" && "$(CFG)" != ""
+!MESSAGE Usage: nmake /f makefile.vc6 CFG=<config> <target>
+!MESSAGE where <config> is one of:
+!MESSAGE release - release static library
+!MESSAGE release-ssl - release static library with ssl
+!MESSAGE release-zlib - release static library with zlib
+!MESSAGE release-ssl-zlib - release static library with ssl and zlib
+!MESSAGE release-ssl-dll - release static library with dynamic ssl
+!MESSAGE release-zlib-dll - release static library with dynamic zlib
+!MESSAGE release-ssl-dll-zlib-dll - release static library with dynamic ssl and dynamic zlib
+!MESSAGE release-dll - release dynamic library
+!MESSAGE release-dll-ssl-dll - release dynamic library with dynamic ssl
+!MESSAGE release-dll-zlib-dll - release dynamic library with dynamic zlib
+!MESSAGE release-dll-ssl-dll-zlib-dll - release dynamic library with dynamic ssl and dynamic zlib
+!MESSAGE debug - debug static library
+!MESSAGE debug-ssl - debug static library with ssl
+!MESSAGE debug-zlib - debug static library with zlib
+!MESSAGE debug-ssl-zlib - debug static library with ssl and zlib
+!MESSAGE debug-ssl-dll - debug static library with dynamic ssl
+!MESSAGE debug-zlib-dll - debug static library with dynamic zlib
+!MESSAGE debug-ssl-dll-zlib-dll - debug static library with dynamic ssl and dynamic zlib
+!MESSAGE debug-dll - debug dynamic library
+!MESSAGE debug-dll-ssl-dll - debug dynamic library with dynamic ssl
+!MESSAGE debug-dll-zlib-dll - debug dynamic library with dynamic zlib1
+!MESSAGE debug-dll-ssl-dll-zlib-dll - debug dynamic library with dynamic ssl and dynamic zlib
+!MESSAGE <target> can be left blank in which case all is assumed
+!ERROR please choose a valid configuration "$(CFG)"
+!ENDIF
+
+#######################
+# Only the clean target can be used if a config was not provided.
+#
+!IF "$(CFGSET)" == "FALSE"
+clean:
+ @-erase /s *.dll 2> NUL
+ @-erase /s *.exp 2> NUL
+ @-erase /s *.idb 2> NUL
+ @-erase /s *.lib 2> NUL
+ @-erase /s *.obj 2> NUL
+ @-erase /s *.pch 2> NUL
+ @-erase /s *.pdb 2> NUL
+ @-erase /s *.res 2> NUL
+!ELSE
+# A config was provided, so the library can be built.
+#
+X_OBJS= \
+ $(DIROBJ)\base64.obj \
+ $(DIROBJ)\connect.obj \
+ $(DIROBJ)\content_encoding.obj \
+ $(DIROBJ)\cookie.obj \
+ $(DIROBJ)\curl_addrinfo.obj \
+ $(DIROBJ)\curl_fnmatch.obj \
+ $(DIROBJ)\curl_gethostname.obj \
+ $(DIROBJ)\curl_memrchr.obj \
+ $(DIROBJ)\curl_rand.obj \
+ $(DIROBJ)\curl_rtmp.obj \
+ $(DIROBJ)\curl_sspi.obj \
+ $(DIROBJ)\curl_threads.obj \
+ $(DIROBJ)\dict.obj \
+ $(DIROBJ)\easy.obj \
+ $(DIROBJ)\escape.obj \
+ $(DIROBJ)\fileinfo.obj \
+ $(DIROBJ)\file.obj \
+ $(DIROBJ)\formdata.obj \
+ $(DIROBJ)\ftplistparser.obj \
+ $(DIROBJ)\ftp.obj \
+ $(DIROBJ)\getenv.obj \
+ $(DIROBJ)\getinfo.obj \
+ $(DIROBJ)\gtls.obj \
+ $(DIROBJ)\gopher.obj \
+ $(DIROBJ)\hash.obj \
+ $(DIROBJ)\hmac.obj \
+ $(DIROBJ)\hostares.obj \
+ $(DIROBJ)\hostasyn.obj \
+ $(DIROBJ)\hostip4.obj \
+ $(DIROBJ)\hostip6.obj \
+ $(DIROBJ)\hostip.obj \
+ $(DIROBJ)\hostsyn.obj \
+ $(DIROBJ)\hostthre.obj \
+ $(DIROBJ)\http_chunks.obj \
+ $(DIROBJ)\http_digest.obj \
+ $(DIROBJ)\http_negotiate.obj \
+ $(DIROBJ)\http_ntlm.obj \
+ $(DIROBJ)\http.obj \
+ $(DIROBJ)\if2ip.obj \
+ $(DIROBJ)\imap.obj \
+ $(DIROBJ)\inet_ntop.obj \
+ $(DIROBJ)\inet_pton.obj \
+ $(DIROBJ)\ldap.obj \
+ $(DIROBJ)\llist.obj \
+ $(DIROBJ)\md4.obj \
+ $(DIROBJ)\md5.obj \
+ $(DIROBJ)\memdebug.obj \
+ $(DIROBJ)\mprintf.obj \
+ $(DIROBJ)\multi.obj \
+ $(DIROBJ)\netrc.obj \
+ $(DIROBJ)\nonblock.obj \
+ $(DIROBJ)\openldap.obj \
+ $(DIROBJ)\parsedate.obj \
+ $(DIROBJ)\pingpong.obj \
+ $(DIROBJ)\polarssl.obj \
+ $(DIROBJ)\pop3.obj \
+ $(DIROBJ)\progress.obj \
+ $(DIROBJ)\rawstr.obj \
+ $(DIROBJ)\rtsp.obj \
+ $(DIROBJ)\select.obj \
+ $(DIROBJ)\sendf.obj \
+ $(DIROBJ)\share.obj \
+ $(DIROBJ)\slist.obj \
+ $(DIROBJ)\smtp.obj \
+ $(DIROBJ)\socks_gssapi.obj \
+ $(DIROBJ)\socks.obj \
+ $(DIROBJ)\socks_sspi.obj \
+ $(DIROBJ)\speedcheck.obj \
+ $(DIROBJ)\splay.obj \
+ $(DIROBJ)\ssh.obj \
+ $(DIROBJ)\sslgen.obj \
+ $(DIROBJ)\ssluse.obj \
+ $(DIROBJ)\strequal.obj \
+ $(DIROBJ)\strerror.obj \
+ $(DIROBJ)\strtok.obj \
+ $(DIROBJ)\strtoofft.obj \
+ $(DIROBJ)\telnet.obj \
+ $(DIROBJ)\tftp.obj \
+ $(DIROBJ)\timeval.obj \
+ $(DIROBJ)\transfer.obj \
+ $(DIROBJ)\url.obj \
+ $(DIROBJ)\version.obj \
+ $(DIROBJ)\warnless.obj \
+ $(DIROBJ)\wildcard.obj \
+ $(RESOURCE)
+
+all : $(TARGET)
+
+$(TARGET): $(X_OBJS)
+ $(LNK) $(LFLAGS) $(X_OBJS)
+ -xcopy $(DIROBJ)\$(LIB_NAME).dll . /y
+ -xcopy $(DIROBJ)\$(LIB_NAME).lib . /y
+ -xcopy $(DIROBJ)\$(LIB_NAME_DEBUG).dll . /y
+ -xcopy $(DIROBJ)\$(LIB_NAME_DEBUG).lib . /y
+ -xcopy $(DIROBJ)\$(IMPLIB_NAME).lib . /y
+ -xcopy $(DIROBJ)\$(IMPLIB_NAME_DEBUG).lib . /y
+ -xcopy $(DIROBJ)\*.exp . /y
+ -xcopy $(DIROBJ)\*.pdb . /y
+
+$(X_OBJS): $(DIROBJ)
+
+$(DIROBJ):
+ @if not exist "$(DIROBJ)" mkdir $(DIROBJ)
+
+.SUFFIXES: .c .obj .res
+
+{.\}.c{$(DIROBJ)\}.obj:
+ $(CC) $(CFLAGS) /Fo"$@" $<
+
+debug-dll\libcurl.res \
+debug-dll-ssl-dll\libcurl.res \
+debug-dll-zlib-dll\libcurl.res \
+debug-dll-ssl-dll-zlib-dll\libcurl.res: libcurl.rc
+ rc /dDEBUGBUILD=1 /Fo $@ libcurl.rc
+
+release-dll\libcurl.res \
+release-dll-ssl-dll\libcurl.res \
+release-dll-zlib-dll\libcurl.res \
+release-dll-ssl-dll-zlib-dll\libcurl.res: libcurl.rc
+ rc /dDEBUGBUILD=0 /Fo $@ libcurl.rc
+!ENDIF # End of case where a config was provided.
diff --git a/lib/Makefile.vc8 b/lib/Makefile.vc8 new file mode 100644 index 00000000..af6fbf07 --- /dev/null +++ b/lib/Makefile.vc8 @@ -0,0 +1,571 @@ +#***************************************************************************
+# _ _ ____ _
+# Project ___| | | | _ \| |
+# / __| | | | |_) | |
+# | (__| |_| | _ <| |___
+# \___|\___/|_| \_\_____|
+#
+# Copyright (C) 1999 - 2010, Daniel Stenberg, <daniel@haxx.se>, 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.
+#
+# You may opt to use, copy, modify, merge, publish, distribute and/or sell
+# copies of the Software, and permit persons to whom the Software is
+# furnished to do so, under the terms of the COPYING file.
+#
+# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+# KIND, either express or implied.
+#
+###########################################################################
+#
+# Makefile for building libcurl with MSVC8
+#
+# Usage: see usage message below
+# Should be invoked from \lib directory
+# Edit the paths and desired library name
+# SSL path is only required if you intend compiling
+# with SSL.
+#
+# This make file leaves the result either a .lib or .dll file
+# in the \lib directory. It should be called from the \lib
+# directory.
+#
+# An option would have been to allow the source directory to
+# be specified, but I saw no requirement.
+#
+# Another option would have been to leave the .lib and .dll
+# files in the "cfg" directory, but then the make file
+# in \src would need to be changed.
+#
+##############################################################
+
+#
+# Stem for static libs and DLLs
+#
+LIB_NAME = libcurl
+LIB_NAME_DEBUG = libcurld
+
+#
+# Stem for DLL import libs
+#
+IMPLIB_NAME = libcurl_imp
+IMPLIB_NAME_DEBUG = libcurld_imp
+
+!IFNDEF OPENSSL_PATH
+OPENSSL_PATH = ../../openssl-0.9.8o
+!ENDIF
+
+!IFNDEF ZLIB_PATH
+ZLIB_PATH = ../../zlib-1.2.5
+!ENDIF
+
+!IFNDEF MACHINE
+MACHINE = X86
+!ENDIF
+
+# USE_WINDOWS_SSPI uses windows libraries to allow NTLM authentication
+# without an openssl installation and offers the ability to authenticate
+# using the "current logged in user". Since at least with MSVC8 the sspi.h
+# header is broken it is either required to install the Windows SDK,
+# or to fix sspi.h with adding this define at the beginning of sspi.h:
+# #define FreeCredentialHandle FreeCredentialsHandle
+#
+# If, for some reason the Windows SDK is installed but not installed
+# in the default location, you can specify WINDOWS_SDK_PATH.
+# It can be downloaded from:
+# http://www.microsoft.com/msdownload/platformsdk/sdkupdate/
+
+# WINDOWS_SSPI = 1
+
+!IFDEF WINDOWS_SSPI
+!IFNDEF WINDOWS_SDK_PATH
+WINDOWS_SDK_PATH = "C:\Program Files\Microsoft SDK"
+!ENDIF
+!ENDIF
+
+#############################################################
+## Nothing more to do below this line!
+
+CCNODBG = cl.exe /O2 /DNDEBUG
+CCDEBUG = cl.exe /Od /Gm /Zi /D_DEBUG /RTC1
+CFLAGSSSL = /DUSE_SSLEAY /I "$(OPENSSL_PATH)/inc32" /I "$(OPENSSL_PATH)/inc32/openssl"
+CFLAGSZLIB = /DHAVE_ZLIB_H /DHAVE_ZLIB /DHAVE_LIBZ /I "$(ZLIB_PATH)"
+CFLAGS = /I. /I../include /nologo /W3 /EHsc /DWIN32 /FD /c /DBUILDING_LIBCURL
+CFLAGSLIB = /DCURL_STATICLIB
+LNKDLL = link.exe /DLL
+LNKLIB = link.exe /lib
+LFLAGS = /nologo /machine:$(MACHINE)
+SSLLIBS = libeay32.lib ssleay32.lib
+ZLIBLIBSDLL= zdll.lib
+ZLIBLIBS = zlib.lib
+WINLIBS = ws2_32.lib bufferoverflowu.lib wldap32.lib
+CFLAGS = $(CFLAGS)
+
+CFGSET = FALSE
+
+!IFDEF WINDOWS_SSPI
+CFLAGS = $(CFLAGS) /DUSE_WINDOWS_SSPI /I$(WINDOWS_SDK_PATH)\include
+!ENDIF
+
+!IFDEF USE_IPV6
+CFLAGS = $(CFLAGS) /DUSE_IPV6
+!ENDIF
+
+##############################################################
+# Runtime library configuration
+
+RTLIB = /MD
+RTLIBD = /MDd
+
+!IF "$(RTLIBCFG)" == "static"
+RTLIB = /MT
+RTLIBD = /MTd
+!ENDIF
+
+
+######################
+# release
+
+!IF "$(CFG)" == "release"
+TARGET = $(LIB_NAME).lib
+DIROBJ = $(CFG)
+LNK = $(LNKLIB) /out:$(DIROBJ)\$(TARGET)
+CC = $(CCNODBG) $(RTLIB) $(CFLAGSLIB)
+CFGSET = TRUE
+!ENDIF
+
+######################
+# release-zlib
+
+!IF "$(CFG)" == "release-zlib"
+TARGET = $(LIB_NAME).lib
+DIROBJ = $(CFG)
+LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
+LNK = $(LNKLIB) $(ZLIBLIBS) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET)
+CC = $(CCNODBG) $(RTLIB) $(CFLAGSZLIB) $(CFLAGSLIB)
+CFGSET = TRUE
+!ENDIF
+
+######################
+# release-dll
+
+!IF "$(CFG)" == "release-dll"
+TARGET = $(LIB_NAME).dll
+DIROBJ = $(CFG)
+LNK = $(LNKDLL) $(WINLIBS) /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME).lib
+CC = $(CCNODBG) $(RTLIB)
+CFGSET = TRUE
+RESOURCE = $(DIROBJ)\libcurl.res
+!ENDIF
+
+######################
+# release-ssl
+
+!IF "$(CFG)" == "release-ssl"
+TARGET = $(LIB_NAME).lib
+DIROBJ = $(CFG)
+LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32"
+LNK = $(LNKLIB) $(LFLAGSSSL) /out:$(DIROBJ)\$(TARGET)
+CC = $(CCNODBG) $(RTLIB) $(CFLAGSSSL) $(CFLAGSLIB)
+CFGSET = TRUE
+!ENDIF
+
+######################
+# release-ssl-dll
+
+!IF "$(CFG)" == "release-ssl-dll"
+TARGET = $(LIB_NAME).lib
+DIROBJ = $(CFG)
+LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll"
+LNK = $(LNKLIB) $(WINLIBS) $(SSLLIBS) $(LFLAGSSSL) /out:$(DIROBJ)\$(TARGET)
+CC = $(CCNODBG) $(RTLIB) $(CFLAGSSSL) $(CFLAGSLIB)
+CFGSET = TRUE
+!ENDIF
+
+######################
+# release-ssl-zlib
+
+!IF "$(CFG)" == "release-ssl-zlib"
+TARGET = $(LIB_NAME).lib
+DIROBJ = $(CFG)
+LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32"
+LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
+LNK = $(LNKLIB) $(LFLAGSSSL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET)
+CC = $(CCNODBG) $(RTLIB) $(CFLAGSSSL) $(CFLAGSZLIB) $(CFLAGSLIB)
+CFGSET = TRUE
+!ENDIF
+
+######################
+# release-dll-ssl-dll
+
+!IF "$(CFG)" == "release-dll-ssl-dll"
+TARGET = $(LIB_NAME).dll
+DIROBJ = $(CFG)
+LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll"
+LNK = $(LNKDLL) $(WINLIBS) $(SSLLIBS) $(LFLAGSSSL) /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME).lib
+CC = $(CCNODBG) $(RTLIB) $(CFLAGSSSL)
+CFGSET = TRUE
+RESOURCE = $(DIROBJ)\libcurl.res
+!ENDIF
+
+######################
+# release-zlib-dll
+
+!IF "$(CFG)" == "release-zlib-dll"
+TARGET = $(LIB_NAME).lib
+DIROBJ = $(CFG)
+LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
+LNK = $(LNKLIB) $(WINLIBS) $(ZLIBLIBSDLL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET)
+CC = $(CCNODBG) $(RTLIB) $(CFLAGSZLIB) $(CFLAGSLIB)
+CFGSET = TRUE
+!ENDIF
+
+######################
+# release-ssl-dll-zlib-dll
+
+!IF "$(CFG)" == "release-ssl-dll-zlib-dll"
+TARGET = $(LIB_NAME).lib
+DIROBJ = $(CFG)
+LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
+LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll"
+LNK = $(LNKLIB) $(WINLIBS) $(SSLLIBS) $(ZLIBLIBSDLL) $(LFLAGSSSL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET)
+CC = $(CCNODBG) $(RTLIB) $(CFLAGSSSL) $(CFLAGSZLIB) $(CFLAGSLIB)
+CFGSET = TRUE
+!ENDIF
+
+######################
+# release-dll-zlib-dll
+
+!IF "$(CFG)" == "release-dll-zlib-dll"
+TARGET = $(LIB_NAME).dll
+DIROBJ = $(CFG)
+LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
+LNK = $(LNKDLL) $(WINLIBS) $(ZLIBLIBSDLL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME).lib
+CC = $(CCNODBG) $(RTLIB) $(CFLAGSZLIB)
+CFGSET = TRUE
+RESOURCE = $(DIROBJ)\libcurl.res
+!ENDIF
+
+######################
+# release-dll-ssl-dll-zlib-dll
+
+!IF "$(CFG)" == "release-dll-ssl-dll-zlib-dll"
+TARGET = $(LIB_NAME).dll
+DIROBJ = $(CFG)
+LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
+LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll"
+LNK = $(LNKDLL) $(WINLIBS) $(SSLLIBS) $(ZLIBLIBSDLL) $(LFLAGSSSL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME).lib
+CC = $(CCNODBG) $(RTLIB) $(CFLAGSSSL) $(CFLAGSZLIB)
+CFGSET = TRUE
+RESOURCE = $(DIROBJ)\libcurl.res
+!ENDIF
+
+######################
+# debug
+
+!IF "$(CFG)" == "debug"
+TARGET = $(LIB_NAME_DEBUG).lib
+DIROBJ = $(CFG)
+LNK = $(LNKLIB) /out:$(DIROBJ)\$(TARGET)
+CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSLIB)
+CFGSET = TRUE
+!ENDIF
+
+######################
+# debug-ssl
+
+!IF "$(CFG)" == "debug-ssl"
+TARGET = $(LIB_NAME_DEBUG).lib
+DIROBJ = $(CFG)
+LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32"
+LNK = $(LNKLIB) $(LFLAGSSSL) /out:$(DIROBJ)\$(TARGET)
+CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSSSL) $(CFLAGSLIB)
+CFGSET = TRUE
+!ENDIF
+
+######################
+# debug-zlib
+
+!IF "$(CFG)" == "debug-zlib"
+TARGET = $(LIB_NAME_DEBUG).lib
+DIROBJ = $(CFG)
+LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
+LNK = $(LNKLIB) $(ZLIBLIBS) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET)
+CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSZLIB) $(CFLAGSLIB)
+CFGSET = TRUE
+!ENDIF
+
+######################
+# debug-ssl-dll
+
+!IF "$(CFG)" == "debug-ssl-dll"
+TARGET = $(LIB_NAME_DEBUG).lib
+DIROBJ = $(CFG)
+LFLAGSSSL = /LIBPATH:$(OPENSSL_PATH)\out32dll
+LNK = $(LNKLIB) $(WINLIBS) $(SSLLIBS) $(LFLAGSSSL) /out:$(DIROBJ)\$(TARGET)
+CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSSSL) $(CFLAGSLIB)
+CFGSET = TRUE
+!ENDIF
+
+######################
+# debug-ssl-zlib
+
+!IF "$(CFG)" == "debug-ssl-zlib"
+TARGET = $(LIB_NAME_DEBUG).lib
+DIROBJ = $(CFG)
+LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
+LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32"
+LNK = $(LNKLIB) $(ZLIBLIBS) $(LFLAGSSSL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET)
+CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSSSL) $(CFLAGSZLIB) $(CFLAGSLIB)
+CFGSET = TRUE
+!ENDIF
+
+######################
+# debug-zlib-dll
+
+!IF "$(CFG)" == "debug-zlib-dll"
+TARGET = $(LIB_NAME_DEBUG).lib
+DIROBJ = $(CFG)
+LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
+LNK = $(LNKLIB) $(WINLIBS) $(ZLIBLIBSDLL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET)
+CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSZLIB) $(CFLAGSLIB)
+CFGSET = TRUE
+!ENDIF
+
+######################
+# debug-ssl-dll-zlib-dll
+
+!IF "$(CFG)" == "debug-ssl-dll-zlib-dll"
+TARGET = $(LIB_NAME_DEBUG).lib
+DIROBJ = $(CFG)
+LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
+LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll"
+LNK = $(LNKLIB) $(WINLIBS) $(SSLLIBS) $(ZLIBLIBSDLL) $(LFLAGSSSL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET)
+CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSSSL) $(CFLAGSZLIB) $(CFLAGSLIB)
+CFGSET = TRUE
+!ENDIF
+
+######################
+# debug-dll
+
+!IF "$(CFG)" == "debug-dll"
+TARGET = $(LIB_NAME_DEBUG).dll
+DIROBJ = $(CFG)
+LNK = $(LNKDLL) $(WINLIBS) /DEBUG /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).lib /PDB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).pdb
+CC = $(CCDEBUG) $(RTLIBD)
+CFGSET = TRUE
+RESOURCE = $(DIROBJ)\libcurl.res
+!ENDIF
+
+######################
+# debug-dll-ssl-dll
+
+!IF "$(CFG)" == "debug-dll-ssl-dll"
+TARGET = $(LIB_NAME_DEBUG).dll
+DIROBJ = $(CFG)
+LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll"
+LNK = $(LNKDLL) $(WINLIBS) $(SSLLIBS) $(LFLAGSSSL) /DEBUG /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).lib /PDB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).pdb
+CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSSSL)
+CFGSET = TRUE
+RESOURCE = $(DIROBJ)\libcurl.res
+!ENDIF
+
+######################
+# debug-dll-zlib-dll
+
+!IF "$(CFG)" == "debug-dll-zlib-dll"
+TARGET = $(LIB_NAME_DEBUG).dll
+DIROBJ = $(CFG)
+LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
+LNK = $(LNKDLL) $(WINLIBS) $(ZLIBLIBSDLL) $(LFLAGSZLIB) /DEBUG /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).lib /PDB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).pdb
+CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSZLIB)
+CFGSET = TRUE
+RESOURCE = $(DIROBJ)\libcurl.res
+!ENDIF
+
+######################
+# debug-dll-ssl-dll-zlib-dll
+
+!IF "$(CFG)" == "debug-dll-ssl-dll-zlib-dll"
+TARGET = $(LIB_NAME_DEBUG).dll
+DIROBJ = $(CFG)
+LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
+LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll"
+LNK = $(LNKDLL) $(WINLIBS) $(SSLLIBS) $(ZLIBLIBSDLL) $(LFLAGSSSL) $(LFLAGSZLIB) /DEBUG /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).lib /PDB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).pdb
+CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSSSL) $(CFLAGSZLIB)
+CFGSET = TRUE
+RESOURCE = $(DIROBJ)\libcurl.res
+!ENDIF
+
+#######################
+# Usage
+#
+!IF "$(CFGSET)" == "FALSE" && "$(CFG)" != ""
+!MESSAGE Usage: nmake /f makefile.vc6 CFG=<config> <target>
+!MESSAGE where <config> is one of:
+!MESSAGE release - release static library
+!MESSAGE release-ssl - release static library with ssl
+!MESSAGE release-zlib - release static library with zlib
+!MESSAGE release-ssl-zlib - release static library with ssl and zlib
+!MESSAGE release-ssl-dll - release static library with dynamic ssl
+!MESSAGE release-zlib-dll - release static library with dynamic zlib
+!MESSAGE release-ssl-dll-zlib-dll - release static library with dynamic ssl and dynamic zlib
+!MESSAGE release-dll - release dynamic library
+!MESSAGE release-dll-ssl-dll - release dynamic library with dynamic ssl
+!MESSAGE release-dll-zlib-dll - release dynamic library with dynamic zlib
+!MESSAGE release-dll-ssl-dll-zlib-dll - release dynamic library with dynamic ssl and dynamic zlib
+!MESSAGE debug - debug static library
+!MESSAGE debug-ssl - debug static library with ssl
+!MESSAGE debug-zlib - debug static library with zlib
+!MESSAGE debug-ssl-zlib - debug static library with ssl and zlib
+!MESSAGE debug-ssl-dll - debug static library with dynamic ssl
+!MESSAGE debug-zlib-dll - debug static library with dynamic zlib
+!MESSAGE debug-ssl-dll-zlib-dll - debug static library with dynamic ssl and dynamic zlib
+!MESSAGE debug-dll - debug dynamic library
+!MESSAGE debug-dll-ssl-dll - debug dynamic library with dynamic ssl
+!MESSAGE debug-dll-zlib-dll - debug dynamic library with dynamic zlib1
+!MESSAGE debug-dll-ssl-dll-zlib-dll - debug dynamic library with dynamic ssl and dynamic zlib
+!MESSAGE <target> can be left blank in which case all is assumed
+!ERROR please choose a valid configuration "$(CFG)"
+!ENDIF
+
+#######################
+# Only the clean target can be used if a config was not provided.
+#
+!IF "$(CFGSET)" == "FALSE"
+clean:
+ @-erase /s *.dll 2> NUL
+ @-erase /s *.exp 2> NUL
+ @-erase /s *.idb 2> NUL
+ @-erase /s *.lib 2> NUL
+ @-erase /s *.obj 2> NUL
+ @-erase /s *.pch 2> NUL
+ @-erase /s *.pdb 2> NUL
+ @-erase /s *.res 2> NUL
+!ELSE
+# A config was provided, so the library can be built.
+#
+X_OBJS= \
+ $(DIROBJ)\base64.obj \
+ $(DIROBJ)\connect.obj \
+ $(DIROBJ)\content_encoding.obj \
+ $(DIROBJ)\cookie.obj \
+ $(DIROBJ)\curl_addrinfo.obj \
+ $(DIROBJ)\curl_fnmatch.obj \
+ $(DIROBJ)\curl_gethostname.obj \
+ $(DIROBJ)\curl_memrchr.obj \
+ $(DIROBJ)\curl_rand.obj \
+ $(DIROBJ)\curl_rtmp.obj \
+ $(DIROBJ)\curl_sspi.obj \
+ $(DIROBJ)\curl_threads.obj \
+ $(DIROBJ)\dict.obj \
+ $(DIROBJ)\easy.obj \
+ $(DIROBJ)\escape.obj \
+ $(DIROBJ)\fileinfo.obj \
+ $(DIROBJ)\file.obj \
+ $(DIROBJ)\formdata.obj \
+ $(DIROBJ)\ftplistparser.obj \
+ $(DIROBJ)\ftp.obj \
+ $(DIROBJ)\getenv.obj \
+ $(DIROBJ)\getinfo.obj \
+ $(DIROBJ)\gtls.obj \
+ $(DIROBJ)\gopher.obj \
+ $(DIROBJ)\hash.obj \
+ $(DIROBJ)\hmac.obj \
+ $(DIROBJ)\hostares.obj \
+ $(DIROBJ)\hostasyn.obj \
+ $(DIROBJ)\hostip4.obj \
+ $(DIROBJ)\hostip6.obj \
+ $(DIROBJ)\hostip.obj \
+ $(DIROBJ)\hostsyn.obj \
+ $(DIROBJ)\hostthre.obj \
+ $(DIROBJ)\http_chunks.obj \
+ $(DIROBJ)\http_digest.obj \
+ $(DIROBJ)\http_negotiate.obj \
+ $(DIROBJ)\http_ntlm.obj \
+ $(DIROBJ)\http.obj \
+ $(DIROBJ)\if2ip.obj \
+ $(DIROBJ)\imap.obj \
+ $(DIROBJ)\inet_ntop.obj \
+ $(DIROBJ)\inet_pton.obj \
+ $(DIROBJ)\ldap.obj \
+ $(DIROBJ)\llist.obj \
+ $(DIROBJ)\md4.obj \
+ $(DIROBJ)\md5.obj \
+ $(DIROBJ)\memdebug.obj \
+ $(DIROBJ)\mprintf.obj \
+ $(DIROBJ)\multi.obj \
+ $(DIROBJ)\netrc.obj \
+ $(DIROBJ)\nonblock.obj \
+ $(DIROBJ)\openldap.obj \
+ $(DIROBJ)\parsedate.obj \
+ $(DIROBJ)\pingpong.obj \
+ $(DIROBJ)\polarssl.obj \
+ $(DIROBJ)\pop3.obj \
+ $(DIROBJ)\progress.obj \
+ $(DIROBJ)\rawstr.obj \
+ $(DIROBJ)\rtsp.obj \
+ $(DIROBJ)\select.obj \
+ $(DIROBJ)\sendf.obj \
+ $(DIROBJ)\share.obj \
+ $(DIROBJ)\slist.obj \
+ $(DIROBJ)\smtp.obj \
+ $(DIROBJ)\socks_gssapi.obj \
+ $(DIROBJ)\socks.obj \
+ $(DIROBJ)\socks_sspi.obj \
+ $(DIROBJ)\speedcheck.obj \
+ $(DIROBJ)\splay.obj \
+ $(DIROBJ)\ssh.obj \
+ $(DIROBJ)\sslgen.obj \
+ $(DIROBJ)\ssluse.obj \
+ $(DIROBJ)\strequal.obj \
+ $(DIROBJ)\strerror.obj \
+ $(DIROBJ)\strtok.obj \
+ $(DIROBJ)\strtoofft.obj \
+ $(DIROBJ)\telnet.obj \
+ $(DIROBJ)\tftp.obj \
+ $(DIROBJ)\timeval.obj \
+ $(DIROBJ)\transfer.obj \
+ $(DIROBJ)\url.obj \
+ $(DIROBJ)\version.obj \
+ $(DIROBJ)\warnless.obj \
+ $(DIROBJ)\wildcard.obj \
+ $(RESOURCE)
+
+all : $(TARGET)
+
+$(TARGET): $(X_OBJS)
+ $(LNK) $(LFLAGS) $(X_OBJS)
+ -xcopy $(DIROBJ)\$(LIB_NAME).dll . /y
+ -xcopy $(DIROBJ)\$(LIB_NAME).lib . /y
+ -xcopy $(DIROBJ)\$(LIB_NAME_DEBUG).dll . /y
+ -xcopy $(DIROBJ)\$(LIB_NAME_DEBUG).lib . /y
+ -xcopy $(DIROBJ)\$(IMPLIB_NAME).lib . /y
+ -xcopy $(DIROBJ)\$(IMPLIB_NAME_DEBUG).lib . /y
+ -xcopy $(DIROBJ)\*.exp . /y
+ -xcopy $(DIROBJ)\*.pdb . /y
+
+$(X_OBJS): $(DIROBJ)
+
+$(DIROBJ):
+ @if not exist "$(DIROBJ)" mkdir $(DIROBJ)
+
+.SUFFIXES: .c .obj .res
+
+{.\}.c{$(DIROBJ)\}.obj:
+ $(CC) $(CFLAGS) /Fo"$@" $<
+
+debug-dll\libcurl.res \
+debug-dll-ssl-dll\libcurl.res \
+debug-dll-zlib-dll\libcurl.res \
+debug-dll-ssl-dll-zlib-dll\libcurl.res: libcurl.rc
+ rc /dDEBUGBUILD=1 /Fo $@ libcurl.rc
+
+release-dll\libcurl.res \
+release-dll-ssl-dll\libcurl.res \
+release-dll-zlib-dll\libcurl.res \
+release-dll-ssl-dll-zlib-dll\libcurl.res: libcurl.rc
+ rc /dDEBUGBUILD=0 /Fo $@ libcurl.rc
+!ENDIF # End of case where a config was provided.
diff --git a/lib/Makefile.vc9 b/lib/Makefile.vc9 new file mode 100644 index 00000000..7d5eb2fb --- /dev/null +++ b/lib/Makefile.vc9 @@ -0,0 +1,571 @@ +#***************************************************************************
+# _ _ ____ _
+# Project ___| | | | _ \| |
+# / __| | | | |_) | |
+# | (__| |_| | _ <| |___
+# \___|\___/|_| \_\_____|
+#
+# Copyright (C) 1999 - 2010, Daniel Stenberg, <daniel@haxx.se>, 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.
+#
+# You may opt to use, copy, modify, merge, publish, distribute and/or sell
+# copies of the Software, and permit persons to whom the Software is
+# furnished to do so, under the terms of the COPYING file.
+#
+# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+# KIND, either express or implied.
+#
+###########################################################################
+#
+# Makefile for building libcurl with MSVC9
+#
+# Usage: see usage message below
+# Should be invoked from \lib directory
+# Edit the paths and desired library name
+# SSL path is only required if you intend compiling
+# with SSL.
+#
+# This make file leaves the result either a .lib or .dll file
+# in the \lib directory. It should be called from the \lib
+# directory.
+#
+# An option would have been to allow the source directory to
+# be specified, but I saw no requirement.
+#
+# Another option would have been to leave the .lib and .dll
+# files in the "cfg" directory, but then the make file
+# in \src would need to be changed.
+#
+##############################################################
+
+#
+# Stem for static libs and DLLs
+#
+LIB_NAME = libcurl
+LIB_NAME_DEBUG = libcurld
+
+#
+# Stem for DLL import libs
+#
+IMPLIB_NAME = libcurl_imp
+IMPLIB_NAME_DEBUG = libcurld_imp
+
+!IFNDEF OPENSSL_PATH
+OPENSSL_PATH = ../../openssl-0.9.8o
+!ENDIF
+
+!IFNDEF ZLIB_PATH
+ZLIB_PATH = ../../zlib-1.2.5
+!ENDIF
+
+!IFNDEF MACHINE
+MACHINE = X86
+!ENDIF
+
+# USE_WINDOWS_SSPI uses windows libraries to allow NTLM authentication
+# without an openssl installation and offers the ability to authenticate
+# using the "current logged in user". Since at least with MSVC9 the sspi.h
+# header is broken it is either required to install the Windows SDK,
+# or to fix sspi.h with adding this define at the beginning of sspi.h:
+# #define FreeCredentialHandle FreeCredentialsHandle
+#
+# If, for some reason the Windows SDK is installed but not installed
+# in the default location, you can specify WINDOWS_SDK_PATH.
+# It can be downloaded from:
+# http://www.microsoft.com/msdownload/platformsdk/sdkupdate/
+
+# WINDOWS_SSPI = 1
+
+!IFDEF WINDOWS_SSPI
+!IFNDEF WINDOWS_SDK_PATH
+WINDOWS_SDK_PATH = "C:\Program Files\Microsoft SDK"
+!ENDIF
+!ENDIF
+
+#############################################################
+## Nothing more to do below this line!
+
+CCNODBG = cl.exe /O2 /DNDEBUG
+CCDEBUG = cl.exe /Od /Gm /Zi /D_DEBUG /RTC1
+CFLAGSSSL = /DUSE_SSLEAY /I "$(OPENSSL_PATH)/inc32" /I "$(OPENSSL_PATH)/inc32/openssl"
+CFLAGSZLIB = /DHAVE_ZLIB_H /DHAVE_ZLIB /DHAVE_LIBZ /I "$(ZLIB_PATH)"
+CFLAGS = /I. /I../include /nologo /W3 /EHsc /DWIN32 /FD /c /DBUILDING_LIBCURL
+CFLAGSLIB = /DCURL_STATICLIB
+LNKDLL = link.exe /DLL
+LNKLIB = link.exe /lib
+LFLAGS = /nologo /machine:$(MACHINE)
+SSLLIBS = libeay32.lib ssleay32.lib
+ZLIBLIBSDLL= zdll.lib
+ZLIBLIBS = zlib.lib
+WINLIBS = ws2_32.lib wldap32.lib
+CFLAGS = $(CFLAGS)
+
+CFGSET = FALSE
+
+!IFDEF WINDOWS_SSPI
+CFLAGS = $(CFLAGS) /DUSE_WINDOWS_SSPI /I$(WINDOWS_SDK_PATH)\include
+!ENDIF
+
+!IFDEF USE_IPV6
+CFLAGS = $(CFLAGS) /DUSE_IPV6
+!ENDIF
+
+##############################################################
+# Runtime library configuration
+
+RTLIB = /MD
+RTLIBD = /MDd
+
+!IF "$(RTLIBCFG)" == "static"
+RTLIB = /MT
+RTLIBD = /MTd
+!ENDIF
+
+
+######################
+# release
+
+!IF "$(CFG)" == "release"
+TARGET = $(LIB_NAME).lib
+DIROBJ = $(CFG)
+LNK = $(LNKLIB) /out:$(DIROBJ)\$(TARGET)
+CC = $(CCNODBG) $(RTLIB) $(CFLAGSLIB)
+CFGSET = TRUE
+!ENDIF
+
+######################
+# release-zlib
+
+!IF "$(CFG)" == "release-zlib"
+TARGET = $(LIB_NAME).lib
+DIROBJ = $(CFG)
+LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
+LNK = $(LNKLIB) $(ZLIBLIBS) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET)
+CC = $(CCNODBG) $(RTLIB) $(CFLAGSZLIB) $(CFLAGSLIB)
+CFGSET = TRUE
+!ENDIF
+
+######################
+# release-dll
+
+!IF "$(CFG)" == "release-dll"
+TARGET = $(LIB_NAME).dll
+DIROBJ = $(CFG)
+LNK = $(LNKDLL) $(WINLIBS) /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME).lib
+CC = $(CCNODBG) $(RTLIB)
+CFGSET = TRUE
+RESOURCE = $(DIROBJ)\libcurl.res
+!ENDIF
+
+######################
+# release-ssl
+
+!IF "$(CFG)" == "release-ssl"
+TARGET = $(LIB_NAME).lib
+DIROBJ = $(CFG)
+LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32"
+LNK = $(LNKLIB) $(LFLAGSSSL) /out:$(DIROBJ)\$(TARGET)
+CC = $(CCNODBG) $(RTLIB) $(CFLAGSSSL) $(CFLAGSLIB)
+CFGSET = TRUE
+!ENDIF
+
+######################
+# release-ssl-dll
+
+!IF "$(CFG)" == "release-ssl-dll"
+TARGET = $(LIB_NAME).lib
+DIROBJ = $(CFG)
+LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll"
+LNK = $(LNKLIB) $(WINLIBS) $(SSLLIBS) $(LFLAGSSSL) /out:$(DIROBJ)\$(TARGET)
+CC = $(CCNODBG) $(RTLIB) $(CFLAGSSSL) $(CFLAGSLIB)
+CFGSET = TRUE
+!ENDIF
+
+######################
+# release-ssl-zlib
+
+!IF "$(CFG)" == "release-ssl-zlib"
+TARGET = $(LIB_NAME).lib
+DIROBJ = $(CFG)
+LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32"
+LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
+LNK = $(LNKLIB) $(LFLAGSSSL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET)
+CC = $(CCNODBG) $(RTLIB) $(CFLAGSSSL) $(CFLAGSZLIB) $(CFLAGSLIB)
+CFGSET = TRUE
+!ENDIF
+
+######################
+# release-dll-ssl-dll
+
+!IF "$(CFG)" == "release-dll-ssl-dll"
+TARGET = $(LIB_NAME).dll
+DIROBJ = $(CFG)
+LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll"
+LNK = $(LNKDLL) $(WINLIBS) $(SSLLIBS) $(LFLAGSSSL) /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME).lib
+CC = $(CCNODBG) $(RTLIB) $(CFLAGSSSL)
+CFGSET = TRUE
+RESOURCE = $(DIROBJ)\libcurl.res
+!ENDIF
+
+######################
+# release-zlib-dll
+
+!IF "$(CFG)" == "release-zlib-dll"
+TARGET = $(LIB_NAME).lib
+DIROBJ = $(CFG)
+LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
+LNK = $(LNKLIB) $(WINLIBS) $(ZLIBLIBSDLL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET)
+CC = $(CCNODBG) $(RTLIB) $(CFLAGSZLIB) $(CFLAGSLIB)
+CFGSET = TRUE
+!ENDIF
+
+######################
+# release-ssl-dll-zlib-dll
+
+!IF "$(CFG)" == "release-ssl-dll-zlib-dll"
+TARGET = $(LIB_NAME).lib
+DIROBJ = $(CFG)
+LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
+LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll"
+LNK = $(LNKLIB) $(WINLIBS) $(SSLLIBS) $(ZLIBLIBSDLL) $(LFLAGSSSL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET)
+CC = $(CCNODBG) $(RTLIB) $(CFLAGSSSL) $(CFLAGSZLIB) $(CFLAGSLIB)
+CFGSET = TRUE
+!ENDIF
+
+######################
+# release-dll-zlib-dll
+
+!IF "$(CFG)" == "release-dll-zlib-dll"
+TARGET = $(LIB_NAME).dll
+DIROBJ = $(CFG)
+LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
+LNK = $(LNKDLL) $(WINLIBS) $(ZLIBLIBSDLL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME).lib
+CC = $(CCNODBG) $(RTLIB) $(CFLAGSZLIB)
+CFGSET = TRUE
+RESOURCE = $(DIROBJ)\libcurl.res
+!ENDIF
+
+######################
+# release-dll-ssl-dll-zlib-dll
+
+!IF "$(CFG)" == "release-dll-ssl-dll-zlib-dll"
+TARGET = $(LIB_NAME).dll
+DIROBJ = $(CFG)
+LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
+LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll"
+LNK = $(LNKDLL) $(WINLIBS) $(SSLLIBS) $(ZLIBLIBSDLL) $(LFLAGSSSL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME).lib
+CC = $(CCNODBG) $(RTLIB) $(CFLAGSSSL) $(CFLAGSZLIB)
+CFGSET = TRUE
+RESOURCE = $(DIROBJ)\libcurl.res
+!ENDIF
+
+######################
+# debug
+
+!IF "$(CFG)" == "debug"
+TARGET = $(LIB_NAME_DEBUG).lib
+DIROBJ = $(CFG)
+LNK = $(LNKLIB) /out:$(DIROBJ)\$(TARGET)
+CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSLIB)
+CFGSET = TRUE
+!ENDIF
+
+######################
+# debug-ssl
+
+!IF "$(CFG)" == "debug-ssl"
+TARGET = $(LIB_NAME_DEBUG).lib
+DIROBJ = $(CFG)
+LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32"
+LNK = $(LNKLIB) $(LFLAGSSSL) /out:$(DIROBJ)\$(TARGET)
+CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSSSL) $(CFLAGSLIB)
+CFGSET = TRUE
+!ENDIF
+
+######################
+# debug-zlib
+
+!IF "$(CFG)" == "debug-zlib"
+TARGET = $(LIB_NAME_DEBUG).lib
+DIROBJ = $(CFG)
+LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
+LNK = $(LNKLIB) $(ZLIBLIBS) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET)
+CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSZLIB) $(CFLAGSLIB)
+CFGSET = TRUE
+!ENDIF
+
+######################
+# debug-ssl-dll
+
+!IF "$(CFG)" == "debug-ssl-dll"
+TARGET = $(LIB_NAME_DEBUG).lib
+DIROBJ = $(CFG)
+LFLAGSSSL = /LIBPATH:$(OPENSSL_PATH)\out32dll
+LNK = $(LNKLIB) $(WINLIBS) $(SSLLIBS) $(LFLAGSSSL) /out:$(DIROBJ)\$(TARGET)
+CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSSSL) $(CFLAGSLIB)
+CFGSET = TRUE
+!ENDIF
+
+######################
+# debug-ssl-zlib
+
+!IF "$(CFG)" == "debug-ssl-zlib"
+TARGET = $(LIB_NAME_DEBUG).lib
+DIROBJ = $(CFG)
+LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
+LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32"
+LNK = $(LNKLIB) $(ZLIBLIBS) $(LFLAGSSSL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET)
+CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSSSL) $(CFLAGSZLIB) $(CFLAGSLIB)
+CFGSET = TRUE
+!ENDIF
+
+######################
+# debug-zlib-dll
+
+!IF "$(CFG)" == "debug-zlib-dll"
+TARGET = $(LIB_NAME_DEBUG).lib
+DIROBJ = $(CFG)
+LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
+LNK = $(LNKLIB) $(WINLIBS) $(ZLIBLIBSDLL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET)
+CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSZLIB) $(CFLAGSLIB)
+CFGSET = TRUE
+!ENDIF
+
+######################
+# debug-ssl-dll-zlib-dll
+
+!IF "$(CFG)" == "debug-ssl-dll-zlib-dll"
+TARGET = $(LIB_NAME_DEBUG).lib
+DIROBJ = $(CFG)
+LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
+LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll"
+LNK = $(LNKLIB) $(WINLIBS) $(SSLLIBS) $(ZLIBLIBSDLL) $(LFLAGSSSL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET)
+CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSSSL) $(CFLAGSZLIB) $(CFLAGSLIB)
+CFGSET = TRUE
+!ENDIF
+
+######################
+# debug-dll
+
+!IF "$(CFG)" == "debug-dll"
+TARGET = $(LIB_NAME_DEBUG).dll
+DIROBJ = $(CFG)
+LNK = $(LNKDLL) $(WINLIBS) /DEBUG /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).lib /PDB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).pdb
+CC = $(CCDEBUG) $(RTLIBD)
+CFGSET = TRUE
+RESOURCE = $(DIROBJ)\libcurl.res
+!ENDIF
+
+######################
+# debug-dll-ssl-dll
+
+!IF "$(CFG)" == "debug-dll-ssl-dll"
+TARGET = $(LIB_NAME_DEBUG).dll
+DIROBJ = $(CFG)
+LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll"
+LNK = $(LNKDLL) $(WINLIBS) $(SSLLIBS) $(LFLAGSSSL) /DEBUG /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).lib /PDB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).pdb
+CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSSSL)
+CFGSET = TRUE
+RESOURCE = $(DIROBJ)\libcurl.res
+!ENDIF
+
+######################
+# debug-dll-zlib-dll
+
+!IF "$(CFG)" == "debug-dll-zlib-dll"
+TARGET = $(LIB_NAME_DEBUG).dll
+DIROBJ = $(CFG)
+LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
+LNK = $(LNKDLL) $(WINLIBS) $(ZLIBLIBSDLL) $(LFLAGSZLIB) /DEBUG /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).lib /PDB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).pdb
+CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSZLIB)
+CFGSET = TRUE
+RESOURCE = $(DIROBJ)\libcurl.res
+!ENDIF
+
+######################
+# debug-dll-ssl-dll-zlib-dll
+
+!IF "$(CFG)" == "debug-dll-ssl-dll-zlib-dll"
+TARGET = $(LIB_NAME_DEBUG).dll
+DIROBJ = $(CFG)
+LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)"
+LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll"
+LNK = $(LNKDLL) $(WINLIBS) $(SSLLIBS) $(ZLIBLIBSDLL) $(LFLAGSSSL) $(LFLAGSZLIB) /DEBUG /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).lib /PDB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).pdb
+CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSSSL) $(CFLAGSZLIB)
+CFGSET = TRUE
+RESOURCE = $(DIROBJ)\libcurl.res
+!ENDIF
+
+#######################
+# Usage
+#
+!IF "$(CFGSET)" == "FALSE" && "$(CFG)" != ""
+!MESSAGE Usage: nmake /f makefile.vc9 CFG=<config> <target>
+!MESSAGE where <config> is one of:
+!MESSAGE release - release static library
+!MESSAGE release-ssl - release static library with ssl
+!MESSAGE release-zlib - release static library with zlib
+!MESSAGE release-ssl-zlib - release static library with ssl and zlib
+!MESSAGE release-ssl-dll - release static library with dynamic ssl
+!MESSAGE release-zlib-dll - release static library with dynamic zlib
+!MESSAGE release-ssl-dll-zlib-dll - release static library with dynamic ssl and dynamic zlib
+!MESSAGE release-dll - release dynamic library
+!MESSAGE release-dll-ssl-dll - release dynamic library with dynamic ssl
+!MESSAGE release-dll-zlib-dll - release dynamic library with dynamic zlib
+!MESSAGE release-dll-ssl-dll-zlib-dll - release dynamic library with dynamic ssl and dynamic zlib
+!MESSAGE debug - debug static library
+!MESSAGE debug-ssl - debug static library with ssl
+!MESSAGE debug-zlib - debug static library with zlib
+!MESSAGE debug-ssl-zlib - debug static library with ssl and zlib
+!MESSAGE debug-ssl-dll - debug static library with dynamic ssl
+!MESSAGE debug-zlib-dll - debug static library with dynamic zlib
+!MESSAGE debug-ssl-dll-zlib-dll - debug static library with dynamic ssl and dynamic zlib
+!MESSAGE debug-dll - debug dynamic library
+!MESSAGE debug-dll-ssl-dll - debug dynamic library with dynamic ssl
+!MESSAGE debug-dll-zlib-dll - debug dynamic library with dynamic zlib1
+!MESSAGE debug-dll-ssl-dll-zlib-dll - debug dynamic library with dynamic ssl and dynamic zlib
+!MESSAGE <target> can be left blank in which case all is assumed
+!ERROR please choose a valid configuration "$(CFG)"
+!ENDIF
+
+#######################
+# Only the clean target can be used if a config was not provided.
+#
+!IF "$(CFGSET)" == "FALSE"
+clean:
+ @-erase /s *.dll 2> NUL
+ @-erase /s *.exp 2> NUL
+ @-erase /s *.idb 2> NUL
+ @-erase /s *.lib 2> NUL
+ @-erase /s *.obj 2> NUL
+ @-erase /s *.pch 2> NUL
+ @-erase /s *.pdb 2> NUL
+ @-erase /s *.res 2> NUL
+!ELSE
+# A config was provided, so the library can be built.
+#
+X_OBJS= \
+ $(DIROBJ)\base64.obj \
+ $(DIROBJ)\connect.obj \
+ $(DIROBJ)\content_encoding.obj \
+ $(DIROBJ)\cookie.obj \
+ $(DIROBJ)\curl_addrinfo.obj \
+ $(DIROBJ)\curl_fnmatch.obj \
+ $(DIROBJ)\curl_gethostname.obj \
+ $(DIROBJ)\curl_memrchr.obj \
+ $(DIROBJ)\curl_rand.obj \
+ $(DIROBJ)\curl_rtmp.obj \
+ $(DIROBJ)\curl_sspi.obj \
+ $(DIROBJ)\curl_threads.obj \
+ $(DIROBJ)\dict.obj \
+ $(DIROBJ)\easy.obj \
+ $(DIROBJ)\escape.obj \
+ $(DIROBJ)\fileinfo.obj \
+ $(DIROBJ)\file.obj \
+ $(DIROBJ)\formdata.obj \
+ $(DIROBJ)\ftplistparser.obj \
+ $(DIROBJ)\ftp.obj \
+ $(DIROBJ)\getenv.obj \
+ $(DIROBJ)\getinfo.obj \
+ $(DIROBJ)\gtls.obj \
+ $(DIROBJ)\gopher.obj \
+ $(DIROBJ)\hash.obj \
+ $(DIROBJ)\hmac.obj \
+ $(DIROBJ)\hostares.obj \
+ $(DIROBJ)\hostasyn.obj \
+ $(DIROBJ)\hostip4.obj \
+ $(DIROBJ)\hostip6.obj \
+ $(DIROBJ)\hostip.obj \
+ $(DIROBJ)\hostsyn.obj \
+ $(DIROBJ)\hostthre.obj \
+ $(DIROBJ)\http_chunks.obj \
+ $(DIROBJ)\http_digest.obj \
+ $(DIROBJ)\http_negotiate.obj \
+ $(DIROBJ)\http_ntlm.obj \
+ $(DIROBJ)\http.obj \
+ $(DIROBJ)\if2ip.obj \
+ $(DIROBJ)\imap.obj \
+ $(DIROBJ)\inet_ntop.obj \
+ $(DIROBJ)\inet_pton.obj \
+ $(DIROBJ)\ldap.obj \
+ $(DIROBJ)\llist.obj \
+ $(DIROBJ)\md4.obj \
+ $(DIROBJ)\md5.obj \
+ $(DIROBJ)\memdebug.obj \
+ $(DIROBJ)\mprintf.obj \
+ $(DIROBJ)\multi.obj \
+ $(DIROBJ)\netrc.obj \
+ $(DIROBJ)\nonblock.obj \
+ $(DIROBJ)\openldap.obj \
+ $(DIROBJ)\parsedate.obj \
+ $(DIROBJ)\pingpong.obj \
+ $(DIROBJ)\polarssl.obj \
+ $(DIROBJ)\pop3.obj \
+ $(DIROBJ)\progress.obj \
+ $(DIROBJ)\rawstr.obj \
+ $(DIROBJ)\rtsp.obj \
+ $(DIROBJ)\select.obj \
+ $(DIROBJ)\sendf.obj \
+ $(DIROBJ)\share.obj \
+ $(DIROBJ)\slist.obj \
+ $(DIROBJ)\smtp.obj \
+ $(DIROBJ)\socks_gssapi.obj \
+ $(DIROBJ)\socks.obj \
+ $(DIROBJ)\socks_sspi.obj \
+ $(DIROBJ)\speedcheck.obj \
+ $(DIROBJ)\splay.obj \
+ $(DIROBJ)\ssh.obj \
+ $(DIROBJ)\sslgen.obj \
+ $(DIROBJ)\ssluse.obj \
+ $(DIROBJ)\strequal.obj \
+ $(DIROBJ)\strerror.obj \
+ $(DIROBJ)\strtok.obj \
+ $(DIROBJ)\strtoofft.obj \
+ $(DIROBJ)\telnet.obj \
+ $(DIROBJ)\tftp.obj \
+ $(DIROBJ)\timeval.obj \
+ $(DIROBJ)\transfer.obj \
+ $(DIROBJ)\url.obj \
+ $(DIROBJ)\version.obj \
+ $(DIROBJ)\warnless.obj \
+ $(DIROBJ)\wildcard.obj \
+ $(RESOURCE)
+
+all : $(TARGET)
+
+$(TARGET): $(X_OBJS)
+ $(LNK) $(LFLAGS) $(X_OBJS)
+ -xcopy $(DIROBJ)\$(LIB_NAME).dll . /y
+ -xcopy $(DIROBJ)\$(LIB_NAME).lib . /y
+ -xcopy $(DIROBJ)\$(LIB_NAME_DEBUG).dll . /y
+ -xcopy $(DIROBJ)\$(LIB_NAME_DEBUG).lib . /y
+ -xcopy $(DIROBJ)\$(IMPLIB_NAME).lib . /y
+ -xcopy $(DIROBJ)\$(IMPLIB_NAME_DEBUG).lib . /y
+ -xcopy $(DIROBJ)\*.exp . /y
+ -xcopy $(DIROBJ)\*.pdb . /y
+
+$(X_OBJS): $(DIROBJ)
+
+$(DIROBJ):
+ @if not exist "$(DIROBJ)" mkdir $(DIROBJ)
+
+.SUFFIXES: .c .obj .res
+
+{.\}.c{$(DIROBJ)\}.obj:
+ $(CC) $(CFLAGS) /Fo"$@" $<
+
+debug-dll\libcurl.res \
+debug-dll-ssl-dll\libcurl.res \
+debug-dll-zlib-dll\libcurl.res \
+debug-dll-ssl-dll-zlib-dll\libcurl.res: libcurl.rc
+ rc /dDEBUGBUILD=1 /Fo $@ libcurl.rc
+
+release-dll\libcurl.res \
+release-dll-ssl-dll\libcurl.res \
+release-dll-zlib-dll\libcurl.res \
+release-dll-ssl-dll-zlib-dll\libcurl.res: libcurl.rc
+ rc /dDEBUGBUILD=0 /Fo $@ libcurl.rc
+!ENDIF # End of case where a config was provided.
diff --git a/lib/Makefile.vxworks b/lib/Makefile.vxworks new file mode 100644 index 00000000..796d1605 --- /dev/null +++ b/lib/Makefile.vxworks @@ -0,0 +1,177 @@ +#***************************************************************************** +# +# +#Filename : Makefile.vxworks +#Description: makefile to be used in order to compile libcurl for VxWoorks 6.3. +# +#How to use: +# 1. Adjust environment variables at the file begining +# 2. Open the Command Prompt window and change directory ('cd') +# into the 'lib' folder +# 3. Add <CYGWIN>/bin folder to the PATH environment variable +# For example type 'set PATH=C:/embedded/cygwin/bin;%PATH%' +# 4. Build the library by typing 'make -f ./Makefile.vxworks' +# As a result the libcurl.a should be created in the 'lib' folder. +# To clean package use 'make -f ./Makefile.vxworks clean' +#Requirements: +# 1. WinXP machine +# 2. Full CYGWIN installation (open source) with GNU make version +# v3.78 or higher +# 3. WindRiver Workbench with vxWorks 6.3 (commercial) +#***************************************************************************** + +# ---------------------------------------------------------------------- +# Environment +# ---------------------------------------------------------------------- + +export WIND_HOME := C:/embedded/Workbench2.5.0.1 +export WIND_BASE := $(WIND_HOME)/vxworks-6.3 +export WIND_HOST_TYPE := x86-win32 + +# BUILD_TYE:= <debug>|<release> (build with debugging info or optimized) +BUILD_TYPE := debug +USER_CFLAGS:= + +# directories where to seek for includes and libraries +OPENSSL_INC := D:/libraries/openssl/openssl-0.9.8a-vxWorks6.3/include +OPENSSL_LIB := D:/libraries/openssl/openssl-0.9.8a-vxWorks6.3 +ZLIB_INC := D:/libraries/zlib/zlib-1.2.3-VxWorks6.3/zlib-1.2.3 +ZLIB_LIB := D:/libraries/zlib/zlib-1.2.3-VxWorks6.3/binaries/vxworks_3.1_gnu/Debug/lib +ARES_INC := +ARES_LIB := + + +# ---------------------------------------------------------------------- +# Compiler +# ---------------------------------------------------------------------- + +CC := ccppc +AR := arppc +LINK := ccppc +CFLAGS := -D__GNUC__ -D__ppc__ -msoft-float -fno-builtin -mcpu=604 -mlongcall -DCPU=PPC604 -D_GNU_TOOL -Wall -W -Winline $(USER_CFLAGS) +LDFLAGS := -nostdlib -Wl,-i -Wl,-X +INCLUDE_FLAG := -I +C_DEBUGFLAG := -g +C_OPTFLAG := -O2 +COMPILE_ONLY_FLAG := -c +OBJ_EXTENSION := .o +CC_OBJ_OUTPUT = -o $@ +ARFLAGS := -rc +LIBS_FLAG := -l +LIBS_DIRFLAG:= -L +LD_DEBUGFLAG := $(C_DEBUGFLAG) +EXECUTE_EXTENSION := .out +TOOL_CHAIN_BIN := $(WIND_HOME)/gnu/3.4.4-vxworks-6.3/$(WIND_HOST_TYPE)/bin/ + +# ---------------------------------------------------------------------- + +# Add -DINET6 if the OS kernel image was built with IPv6 support +# CFLAGS += -DINET6 + +# Set up compiler and linker flags for debug or optimization +ifeq ($(BUILD_TYPE), debug) +CFLAGS += $(C_DEBUGFLAG) +LDFLAGS += $(LD_DEBUGFLAG) +else +CFLAGS += $(C_OPTFLAG) +endif + +# ---------------------------------------------------------------------- + +# Main Makefile and possible sub-make files +MAKEFILES := Makefile.vxworks + +# List of external include directories +#----- +# IMPORTANT: include OPENSSL directories before system +# in order to prevent WindRiver OpenSSL to be used. +#----- +INCLUDE_DIRS := ../include $(OPENSSL_INC) $(ZLIB_INC) $(ARES_INC) $(WIND_BASE)/target/h $(WIND_BASE)/target/h/wrn/coreip + +# List of external libraries and their directories +LIBS_LIST := . +LIB_DIRS := . +ifneq ($(OPENSSL_LIB), ) +LIBS_LIST += crypto ssl +LIB_DIRS += $(OPENSSL_LIB) +endif +ifneq ($(ZLIB_LIB), ) +LIBS_LIST += z +LIB_DIRS += $(ZLIB_LIB) +endif +ifneq ($(ARES_LIB), ) +LIBS_LIST += ares +LIB_DIRS += $(ARES_LIB) +endif + +# Add include and library directories and libraries +CFLAGS += $(INCLUDE_DIRS:%=$(INCLUDE_FLAG)%) +LDFLAGS += $(LIB_DIRS:%=$(LIBS_DIRFLAG)%) + +# List of targets to make for libs target +LIBS_TARGET_LIST := libcurl.a + +# List of execuatble applications to make in addition to libs for all target +EXE_TARGET_LIST := + +# Support for echoing rules +# If ECHORULES variable was set (for example, using 'make' command line) +# some shell commands in the rules will be echoed +ifneq ($(strip $(findstring $(ECHORULES), yes YES 1 true TRUE)),) +_@_ := +else +_@_ := @ +endif + +# Directory to hold compilation intermediate files +TMP_DIR := tmp + +# Get sources and headers to be compiled +include Makefile.inc + +# List of headers +INCLUDE_FILES := $(HHEADERS) +INCLUDE_FILES += $(shell find ../include -name \*.h) + +# List of sources +OBJLIST := $(CSOURCES:%.c=$(TMP_DIR)/%$(OBJ_EXTENSION)) + + +# ---------------------------------------------------------------------- + +#### default rule +# It should be first rule in this file +.PHONY: default +default: libcurl.a + +#### Compiling C files +$(TMP_DIR)/%$(OBJ_EXTENSION): %.c $(MAKEFILES) + @echo Compiling C file $< $(ECHO_STDOUT) + @[ -d $(@D) ] || mkdir -p $(@D) + $(_@_) $(TOOL_CHAIN_BIN)$(CC) $(COMPILE_ONLY_FLAG) $(CFLAGS) $< $(CC_OBJ_OUTPUT) + +#### Creating library +$(LIBS_TARGET_LIST): $(INCLUDE_FILES) $(MAKEFILES) $(OBJLIST) + @echo Creating library $@ $(ECHO_STDOUT) + $(_@_) [ -d $(@D) ] || mkdir -p $(@D) + $(_@_) rm -f $@ + $(_@_) $(TOOL_CHAIN_BIN)$(AR) $(ARFLAGS) $@ $(filter %$(OBJ_EXTENSION), $^) + +#### Creating application +$(EXE_TARGET_LIST): $(INCLUDE_FILES) $(MAKEFILES) $(LIBS_TARGET_LIST) + @echo Creating application $@ + @[ -d $(@D) ] || mkdir -p $(@D) + $(_@_) $(TOOL_CHAIN_BIN)$(LINK) $(CC_OBJ_OUTPUT) $($(@)_EXE_OBJ_LIST) $(LDFLAGS) $($(@)_EXE_LIBS_NEEDED:%=$(LIBS_FLAG)%) $(LIBS_LIST:%=$(LIBS_FLAG)%) $(USER_LIBS_LIST) $(USER_LIBS_LIST) + +#### Master Targets +libs: $(LIBS_TARGET_LIST) + @echo All libs made. + +all: $(LIBS_TARGET_LIST) $(EXE_TARGET_LIST) $(INCLUDE_TARGET_LIST) + @echo All targets made. + +# Clean up +.PHONY: clean +clean: + $(_@_) rm -rf $(TMP_DIR) + @echo libcurl was cleaned. diff --git a/lib/NOTICE b/lib/NOTICE deleted file mode 100644 index 163b299a..00000000 --- a/lib/NOTICE +++ /dev/null @@ -1,21 +0,0 @@ -COPYRIGHT AND PERMISSION NOTICE - -Copyright (c) 1996 - 2010, Daniel Stenberg, <daniel@haxx.se>. - -All rights reserved. - -Permission to use, copy, modify, and distribute this software for any purpose -with or without fee is hereby granted, provided that the above copyright -notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN -NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE -OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of a copyright holder shall not -be used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization of the copyright holder. diff --git a/lib/README.ares b/lib/README.ares index d3ee24bc..8c77937e 100644 --- a/lib/README.ares +++ b/lib/README.ares @@ -11,7 +11,7 @@ c-ares: http://c-ares.haxx.se/ NOTE - The latest libcurl version requires c-ares 1.4.0 or later. + The latest libcurl version requires c-ares 1.6.0 or later. Once upon the time libcurl built fine with the "original" ares. That is no longer true. You need to use c-ares. diff --git a/lib/config-amigaos.h b/lib/config-amigaos.h new file mode 100644 index 00000000..a9fd5677 --- /dev/null +++ b/lib/config-amigaos.h @@ -0,0 +1,151 @@ +#ifndef LIBCURL_CONFIG_AMIGAOS_H +#define LIBCURL_CONFIG_AMIGAOS_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, 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. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#ifdef __AMIGA__ /* Any AmigaOS flavour */ + +#define HAVE_ARPA_INET_H 1 +#define HAVE_CLOSESOCKET_CAMEL 1 +#define HAVE_GETHOSTBYADDR 1 +#define HAVE_INET_ADDR 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_IOCTLSOCKET_CAMEL 1 +#define HAVE_IOCTLSOCKET_CAMEL_FIONBIO 1 +#define HAVE_LIBCRYPTO 1 +#define HAVE_LIBSSL 1 +#define HAVE_LIBZ 1 +#define HAVE_LONGLONG 1 +#define HAVE_MALLOC_H 1 +#define HAVE_MEMORY_H 1 +#define HAVE_NETDB_H 1 +#define HAVE_NETINET_IN_H 1 +#define HAVE_NET_IF_H 1 +#define HAVE_OPENSSL_CRYPTO_H 1 +#define HAVE_OPENSSL_ERR_H 1 +#define HAVE_OPENSSL_PEM_H 1 +#define HAVE_OPENSSL_RSA_H 1 +#define HAVE_OPENSSL_SSL_H 1 +#define HAVE_OPENSSL_X509_H 1 +#define HAVE_PERROR 1 +#define HAVE_PWD_H 1 +#define HAVE_RAND_EGD 1 +#define HAVE_RAND_STATUS 1 +#define HAVE_SELECT 1 +#define HAVE_SETJMP_H 1 +#define HAVE_SGTTY_H 1 +#define HAVE_SIGNAL 1 +#define HAVE_SIGNAL_H 1 +#define HAVE_SIG_ATOMIC_T 1 +#define HAVE_SOCKET 1 +#define HAVE_STRCASECMP 1 +#define HAVE_STRDUP 1 +#define HAVE_STRFTIME 1 +#define HAVE_STRICMP 1 +#define HAVE_STRINGS_H 1 +#define HAVE_STRING_H 1 +#define HAVE_STRSTR 1 +#define HAVE_STRUCT_TIMEVAL 1 +#define HAVE_SYS_PARAM_H 1 +#define HAVE_SYS_SOCKET_H 1 +#define HAVE_SYS_SOCKIO_H 1 +#define HAVE_SYS_STAT_H 1 +#define HAVE_SYS_TIME_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_TERMIOS_H 1 +#define HAVE_TERMIO_H 1 +#define HAVE_TIME_H 1 +#define HAVE_UNAME 1 +#define HAVE_UNISTD_H 1 +#define HAVE_UTIME 1 +#define HAVE_UTIME_H 1 +#define HAVE_WRITABLE_ARGV 1 +#define HAVE_ZLIB_H 1 +#define HAVE_SYS_IOCTL_H 1 + +#define NEED_MALLOC_H 1 + +#define SIZEOF_INT 4 +#define SIZEOF_SHORT 2 + +#define USE_OPENSSL 1 +#define USE_SSLEAY 1 +#define CURL_DISABLE_LDAP 1 + + +#define OS "AmigaOS" + +#define PACKAGE "curl" +#define PACKAGE_BUGREPORT "curl-bug@haxx.se" +#define PACKAGE_NAME "curl" +#define PACKAGE_STRING "curl -" +#define PACKAGE_TARNAME "curl" +#define PACKAGE_VERSION "-" +#define CURL_CA_BUNDLE "s:curl-ca-bundle.crt" + +#define RETSIGTYPE void +#define SELECT_TYPE_ARG1 int +#define SELECT_TYPE_ARG234 (fd_set *) +#define SELECT_TYPE_ARG5 (struct timeval *) + +#define STDC_HEADERS 1 +#define TIME_WITH_SYS_TIME 1 + +#define in_addr_t int + +#ifndef O_RDONLY +# define O_RDONLY 0x0000 +#endif + +#define HAVE_GETNAMEINFO 1 +#define GETNAMEINFO_QUAL_ARG1 const +#define GETNAMEINFO_TYPE_ARG1 struct sockaddr * +#define GETNAMEINFO_TYPE_ARG2 int +#define GETNAMEINFO_TYPE_ARG46 size_t +#define GETNAMEINFO_TYPE_ARG7 int + +#define HAVE_RECV 1 +#define RECV_TYPE_ARG1 long +#define RECV_TYPE_ARG2 char * +#define RECV_TYPE_ARG3 long +#define RECV_TYPE_ARG4 long +#define RECV_TYPE_RETV long + +#define HAVE_RECVFROM 1 +#define RECVFROM_TYPE_ARG1 long +#define RECVFROM_TYPE_ARG2 char +#define RECVFROM_TYPE_ARG3 long +#define RECVFROM_TYPE_ARG4 long +#define RECVFROM_TYPE_ARG5 struct sockaddr +#define RECVFROM_TYPE_ARG6 long +#define RECVFROM_TYPE_RETV long + +#define HAVE_SEND 1 +#define SEND_TYPE_ARG1 int +#define SEND_QUAL_ARG2 const +#define SEND_TYPE_ARG2 char * +#define SEND_TYPE_ARG3 int +#define SEND_TYPE_ARG4 int +#define SEND_TYPE_RETV int + +#endif /* __AMIGA__ */ +#endif /* LIBCURL_CONFIG_AMIGAOS_H */ diff --git a/lib/config-mac.h b/lib/config-mac.h new file mode 100644 index 00000000..740f1d97 --- /dev/null +++ b/lib/config-mac.h @@ -0,0 +1,100 @@ +#ifndef __LIB_CONFIG_MAC_H +#define __LIB_CONFIG_MAC_H + +/* =================================================================== */ +/* lib/config-mac.h - Hand crafted config file for Mac OS 9 */ +/* =================================================================== */ +/* On Mac OS X you must run configure to generate curl_config.h file */ +/* =================================================================== */ + +#define OS "mac" + +#define HAVE_NETINET_IN_H 1 +#define HAVE_SYS_SOCKET_H 1 +#define HAVE_SYS_SELECT_H 1 +#define HAVE_NETDB_H 1 +#define HAVE_ARPA_INET_H 1 +#define HAVE_UNISTD_H 1 +#define HAVE_NET_IF_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_GETTIMEOFDAY 1 +#define HAVE_FCNTL_H 1 +#define HAVE_SYS_STAT_H 1 +#define HAVE_ALLOCA_H 1 +#define HAVE_TIME_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_UTIME_H 1 +#define HAVE_SYS_TIME_H 1 + +#define TIME_WITH_SYS_TIME 1 + +#define HAVE_ALARM 1 +#define HAVE_STRDUP 1 +#define HAVE_UTIME 1 +#define HAVE_SETVBUF 1 +#define HAVE_STRFTIME 1 +#define HAVE_INET_ADDR 1 +#define HAVE_MEMCPY 1 +#define HAVE_SELECT 1 +#define HAVE_SOCKET 1 +#define HAVE_STRUCT_TIMEVAL 1 + +//#define HAVE_STRICMP 1 +#define HAVE_SIGACTION 1 +#define HAVE_SIGNAL_H 1 +#define HAVE_SIG_ATOMIC_T 1 + +#ifdef MACOS_SSL_SUPPORT +# define USE_SSLEAY 1 +# define USE_OPENSSL 1 +#endif + +#define CURL_DISABLE_LDAP 1 + +#define HAVE_RAND_STATUS 1 +#define HAVE_RAND_EGD 1 + +#define HAVE_IOCTL 1 +#define HAVE_IOCTL_FIONBIO 1 + +#define RETSIGTYPE void + +#define SIZEOF_INT 4 +#define SIZEOF_SHORT 2 + +#define HAVE_GETNAMEINFO 1 +#define GETNAMEINFO_QUAL_ARG1 const +#define GETNAMEINFO_TYPE_ARG1 struct sockaddr * +#define GETNAMEINFO_TYPE_ARG2 socklen_t +#define GETNAMEINFO_TYPE_ARG46 size_t +#define GETNAMEINFO_TYPE_ARG7 int + +#define HAVE_RECV 1 +#define RECV_TYPE_ARG1 int +#define RECV_TYPE_ARG2 void * +#define RECV_TYPE_ARG3 size_t +#define RECV_TYPE_ARG4 int +#define RECV_TYPE_RETV ssize_t + +#define HAVE_RECVFROM 1 +#define RECVFROM_TYPE_ARG1 int +#define RECVFROM_TYPE_ARG2 void +#define RECVFROM_TYPE_ARG3 size_t +#define RECVFROM_TYPE_ARG4 int +#define RECVFROM_TYPE_ARG5 struct sockaddr +#define RECVFROM_TYPE_ARG6 int +#define RECVFROM_TYPE_RETV ssize_t +#define RECVFROM_TYPE_ARG2_IS_VOID 1 + +#define HAVE_SEND 1 +#define SEND_TYPE_ARG1 int +#define SEND_QUAL_ARG2 const +#define SEND_TYPE_ARG2 void * +#define SEND_TYPE_ARG3 size_T +#define SEND_TYPE_ARG4 int +#define SEND_TYPE_RETV ssize_t + +#define HAVE_EXTRA_STRICMP_H 1 +#define HAVE_EXTRA_STRDUP_H 1 + +#endif /* __LIB_CONFIG_MAC_H */ diff --git a/lib/config-os400.h b/lib/config-os400.h new file mode 100644 index 00000000..dad4d0c3 --- /dev/null +++ b/lib/config-os400.h @@ -0,0 +1,517 @@ +/* ================================================================ */ +/* lib/config-os400.h - Hand crafted config file for OS/400 */ +/* ================================================================ */ + +#pragma enum(int) + +#undef PACKAGE + +/* Version number of this archive. */ +#undef VERSION + +/* Define if you have the getpass function. */ +#undef HAVE_GETPASS + +/* Define cpu-machine-OS */ +#define OS "OS/400" + +/* Define if you have the gethostbyaddr_r() function with 5 arguments */ +#define HAVE_GETHOSTBYADDR_R_5 + +/* Define if you have the gethostbyaddr_r() function with 7 arguments */ +#undef HAVE_GETHOSTBYADDR_R_7 + +/* Define if you have the gethostbyaddr_r() function with 8 arguments */ +#undef HAVE_GETHOSTBYADDR_R_8 + +/* OS400 supports a 3-argument ASCII version of gethostbyaddr_r(), but its + * prototype is incompatible with the "standard" one (1st argument is not + * const). However, getaddrinfo() is supported (ASCII version defined as + * a local wrapper in setup-os400.h) in a threadsafe way: we can then + * configure getaddrinfo() as such and get rid of gethostbyname_r() without + * loss of threadsafeness. */ +#undef HAVE_GETHOSTBYNAME_R +#undef HAVE_GETHOSTBYNAME_R_3 +#undef HAVE_GETHOSTBYNAME_R_5 +#undef HAVE_GETHOSTBYNAME_R_6 +#define HAVE_GETADDRINFO +#define HAVE_GETADDRINFO_THREADSAFE + +/* Define if you need the _REENTRANT define for some functions */ +#undef NEED_REENTRANT + +/* Define if you have the Kerberos4 libraries (including -ldes) */ +#undef HAVE_KRB4 + +/* Define if you want to enable IPv6 support */ +#define ENABLE_IPV6 + +/* Define if struct sockaddr_in6 has the sin6_scope_id member */ +#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1 + +/* Define this to 'int' if ssize_t is not an available typedefed type */ +#undef ssize_t + +/* Define this as a suitable file to read random data from */ +#undef RANDOM_FILE + +/* Define this to your Entropy Gathering Daemon socket pathname */ +#undef EGD_SOCKET + +/* Define to 1 if you have the alarm function. */ +#define HAVE_ALARM 1 + +/* Define if you have the <alloca.h> header file. */ +#undef HAVE_ALLOCA_H + +/* Define if you have the <arpa/inet.h> header file. */ +#define HAVE_ARPA_INET_H + +/* Define if you have the `closesocket' function. */ +#undef HAVE_CLOSESOCKET + +/* Define if you have the <crypto.h> header file. */ +#undef HAVE_CRYPTO_H + +/* Define if you have the <des.h> header file. */ +#undef HAVE_DES_H + +/* Define if you have the <err.h> header file. */ +#undef HAVE_ERR_H + +/* Define if you have the <fcntl.h> header file. */ +#define HAVE_FCNTL_H + +/* Define if you have the `geteuid' function. */ +#define HAVE_GETEUID + +/* Define if you have the `gethostbyaddr' function. */ +#define HAVE_GETHOSTBYADDR + +/* Define if you have the `gethostbyaddr_r' function. */ +#define HAVE_GETHOSTBYADDR_R + +/* Define if you have the `gethostname' function. */ +#define HAVE_GETHOSTNAME + +/* Define if you have the <getopt.h> header file. */ +#undef HAVE_GETOPT_H + +/* Define if you have the `getpass_r' function. */ +#undef HAVE_GETPASS_R + +/* Define if you have the `getpwuid' function. */ +#define HAVE_GETPWUID + +/* Define if you have the `getservbyname' function. */ +#define HAVE_GETSERVBYNAME + +/* Define if you have the `gettimeofday' function. */ +#define HAVE_GETTIMEOFDAY + +/* Define if you have the `timeval' struct. */ +#define HAVE_STRUCT_TIMEVAL + +/* Define if you have the `inet_addr' function. */ +#define HAVE_INET_ADDR + +/* Define if you have the <inttypes.h> header file. */ +#define HAVE_INTTYPES_H + +/* Define if you have the <io.h> header file. */ +#undef HAVE_IO_H + +/* Define if you have the `krb_get_our_ip_for_realm' function. */ +#undef HAVE_KRB_GET_OUR_IP_FOR_REALM + +/* Define if you have the <krb.h> header file. */ +#undef HAVE_KRB_H + +/* Define if you have the `crypto' library (-lcrypto). */ +#undef HAVE_LIBCRYPTO + +/* Define if you have the `nsl' library (-lnsl). */ +#undef HAVE_LIBNSL + +/* Define if you have the `resolv' library (-lresolv). */ +#undef HAVE_LIBRESOLV + +/* Define if you have the `resolve' library (-lresolve). */ +#undef HAVE_LIBRESOLVE + +/* Define if you have the `socket' library (-lsocket). */ +#undef HAVE_LIBSOCKET + +/* Define if you have the `ssl' library (-lssl). */ +#undef HAVE_LIBSSL + +/* Define if you have GSS API. */ +#define HAVE_GSSAPI + +/* Define if you have the `ucb' library (-lucb). */ +#undef HAVE_LIBUCB + +/* Define if you have the `localtime_r' function. */ +#define HAVE_LOCALTIME_R + +/* Define if you have the <malloc.h> header file. */ +#define HAVE_MALLOC_H + +/* Define if you need the malloc.h header file even with stdlib.h */ +/* #define NEED_MALLOC_H 1 */ + +/* Define if you have the <memory.h> header file. */ +#undef HAVE_MEMORY_H + +/* Define if you have the <netdb.h> header file. */ +#define HAVE_NETDB_H + +/* Define if you have the <netinet/if_ether.h> header file. */ +#undef HAVE_NETINET_IF_ETHER_H + +/* Define if you have the <netinet/in.h> header file. */ +#define HAVE_NETINET_IN_H + +/* Define if you have the <net/if.h> header file. */ +#define HAVE_NET_IF_H + +/* Define if you have the <openssl/crypto.h> header file. */ +#undef HAVE_OPENSSL_CRYPTO_H + +/* Define if you have the <openssl/err.h> header file. */ +#undef HAVE_OPENSSL_ERR_H + +/* Define if you have the <openssl/pem.h> header file. */ +#undef HAVE_OPENSSL_PEM_H + +/* Define if you have the <openssl/rsa.h> header file. */ +#undef HAVE_OPENSSL_RSA_H + +/* Define if you have the <openssl/ssl.h> header file. */ +#undef HAVE_OPENSSL_SSL_H + +/* Define if you have the <openssl/x509.h> header file. */ +#undef HAVE_OPENSSL_X509_H + +/* Define if you have the <pem.h> header file. */ +#undef HAVE_PEM_H + +/* Define if you have the `perror' function. */ +#define HAVE_PERROR + +/* Define if you have the <pwd.h> header file. */ +#define HAVE_PWD_H + +/* Define if you have the `RAND_egd' function. */ +#undef HAVE_RAND_EGD + +/* Define if you have the `RAND_screen' function. */ +#undef HAVE_RAND_SCREEN + +/* Define if you have the `RAND_status' function. */ +#undef HAVE_RAND_STATUS + +/* Define if you have the <rsa.h> header file. */ +#undef HAVE_RSA_H + +/* Define if you have the `select' function. */ +#define HAVE_SELECT + +/* Define if you have the `setvbuf' function. */ +#define HAVE_SETVBUF + +/* Define if you have the <sgtty.h> header file. */ +#undef HAVE_SGTTY_H + +/* Define if you have the `sigaction' function. */ +#define HAVE_SIGACTION + +/* Define if you have the `signal' function. */ +#undef HAVE_SIGNAL + +/* Define if you have the <signal.h> header file. */ +#define HAVE_SIGNAL_H + +/* Define if sig_atomic_t is an available typedef. */ +#define HAVE_SIG_ATOMIC_T + +/* Define if sig_atomic_t is already defined as volatile. */ +#undef HAVE_SIG_ATOMIC_T_VOLATILE + +/* Define if you have the `socket' function. */ +#define HAVE_SOCKET + +/* Define if you have the <ssl.h> header file. */ +#undef HAVE_SSL_H + +/* Define if you have the <stdint.h> header file. */ +#undef HAVE_STDINT_H + +/* Define if you have the <stdlib.h> header file. */ +#define HAVE_STDLIB_H + +/* Define if you have the `strcasecmp' function. */ +#undef HAVE_STRCASECMP + +/* Define if you have the `strcmpi' function. */ +#undef HAVE_STRCMPI + +/* Define if you have the `strdup' function. */ +#undef HAVE_STRDUP + +/* Define if you have the `strftime' function. */ +#define HAVE_STRFTIME + +/* Define if you have the `stricmp' function. */ +#undef HAVE_STRICMP + +/* Define if you have the <strings.h> header file. */ +#define HAVE_STRINGS_H + +/* Define if you have the <string.h> header file. */ +#define HAVE_STRING_H + +/* Define if you have the `strlcat' function. */ +#undef HAVE_STRLCAT + +/* Define if you have the `strlcpy' function. */ +#undef HAVE_STRLCPY + +/* Define if you have the <stropts.h> header file. */ +#undef HAVE_STROPTS_H + +/* Define if you have the `strstr' function. */ +#define HAVE_STRSTR + +/* Define if you have the `strtok_r' function. */ +#define HAVE_STRTOK_R + +/* Define if you have the `strtoll' function. */ +#undef HAVE_STRTOLL /* Allows ASCII compile on V5R1. */ + +/* Define if you have the <sys/param.h> header file. */ +#define HAVE_SYS_PARAM_H + +/* Define if you have the <sys/select.h> header file. */ +#undef HAVE_SYS_SELECT_H + +/* Define if you have the <sys/socket.h> header file. */ +#define HAVE_SYS_SOCKET_H + +/* Define if you have the <sys/sockio.h> header file. */ +#undef HAVE_SYS_SOCKIO_H + +/* Define if you have the <sys/stat.h> header file. */ +#define HAVE_SYS_STAT_H + +/* Define if you have the <sys/time.h> header file. */ +#define HAVE_SYS_TIME_H + +/* Define if you have the <sys/types.h> header file. */ +#define HAVE_SYS_TYPES_H + +/* Define if you have the <sys/un.h> header file. */ +#define HAVE_SYS_UN_H + +/* Define if you have the <sys/ioctl.h> header file. */ +#define HAVE_SYS_IOCTL_H + +/* Define if you have the `tcgetattr' function. */ +#undef HAVE_TCGETATTR + +/* Define if you have the `tcsetattr' function. */ +#undef HAVE_TCSETATTR + +/* Define if you have the <termios.h> header file. */ +#undef HAVE_TERMIOS_H + +/* Define if you have the <termio.h> header file. */ +#undef HAVE_TERMIO_H + +/* Define if you have the <time.h> header file. */ +#define HAVE_TIME_H + +/* Define if you have the `uname' function. */ +#undef HAVE_UNAME + +/* Define if you have the <unistd.h> header file. */ +#define HAVE_UNISTD_H + +/* Define if you have the <winsock.h> header file. */ +#undef HAVE_WINSOCK_H + +/* Define if you have the <x509.h> header file. */ +#undef HAVE_X509_H + +/* Name of package */ +#undef PACKAGE + +/* Define as the return type of signal handlers (`int' or `void'). */ +#define RETSIGTYPE void + +/* The size of `int', as computed by sizeof. */ +#define SIZEOF_INT 4 + +/* The size of a `long double', as computed by sizeof. */ +#define SIZEOF_LONG_DOUBLE 8 + +/* Define if the compiler supports the 'long long' data type. */ +#define HAVE_LONGLONG + +/* The size of a `long long', as computed by sizeof. */ +#define SIZEOF_LONG_LONG 8 + +/* The size of `short', as computed by sizeof. */ +#define SIZEOF_SHORT 2 + +/* Whether long long constants must be suffixed by LL. */ + +#define HAVE_LL + +/* Define this if you have struct sockaddr_storage */ +#define HAVE_STRUCT_SOCKADDR_STORAGE + +/* Define if you have the ANSI C header files. */ +#define STDC_HEADERS + +/* Define if you can safely include both <sys/time.h> and <time.h>. */ +#define TIME_WITH_SYS_TIME + +/* Version number of package */ +#undef VERSION + +/* Number of bits in a file offset, on hosts where this is settable. */ +#undef _FILE_OFFSET_BITS + +/* Define for large files, on AIX-style hosts. */ +#define _LARGE_FILES + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* type to use in place of in_addr_t if not defined */ +#define in_addr_t unsigned long + +/* Define to `unsigned' if <sys/types.h> does not define. */ +#undef size_t + +/* Define if you have the ioctl function. */ +#define HAVE_IOCTL + +/* Define if you have a working ioctl FIONBIO function. */ +#define HAVE_IOCTL_FIONBIO + +/* Define if you have a working ioctl SIOCGIFADDR function. */ +#define HAVE_IOCTL_SIOCGIFADDR + +/* To disable LDAP */ +#undef CURL_DISABLE_LDAP + +/* To avoid external use of library hidden symbols */ +#define CURL_HIDDEN_SYMBOLS + +/* External symbols need no special keyword. */ +#define CURL_EXTERN_SYMBOL + +/* Define if you have the ldap_url_parse procedure. */ +/* #define HAVE_LDAP_URL_PARSE */ /* Disabled because of an IBM bug. */ + +/* Define if you have the getnameinfo function. */ +/* OS400 has no ASCII version of this procedure: wrapped in setup-os400.h. */ +#define HAVE_GETNAMEINFO + +/* Define to the type qualifier of arg 1 for getnameinfo. */ +#define GETNAMEINFO_QUAL_ARG1 const + +/* Define to the type of arg 1 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG1 struct sockaddr * + +/* Define to the type of arg 2 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG2 socklen_t + +/* Define to the type of args 4 and 6 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG46 socklen_t + +/* Define to the type of arg 7 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG7 int + +/* Define if you have the recv function. */ +#define HAVE_RECV + +/* Define to the type of arg 1 for recv. */ +#define RECV_TYPE_ARG1 int + +/* Define to the type of arg 2 for recv. */ +#define RECV_TYPE_ARG2 char * + +/* Define to the type of arg 3 for recv. */ +#define RECV_TYPE_ARG3 int + +/* Define to the type of arg 4 for recv. */ +#define RECV_TYPE_ARG4 int + +/* Define to the function return type for recv. */ +#define RECV_TYPE_RETV int + +/* Define if you have the recvfrom function. */ +#define HAVE_RECVFROM + +/* Define to the type of arg 1 for recvfrom. */ +#define RECVFROM_TYPE_ARG1 int + +/* Define to the type pointed by arg 2 for recvfrom. */ +#define RECVFROM_TYPE_ARG2 char + +/* Define to the type of arg 3 for recvfrom. */ +#define RECVFROM_TYPE_ARG3 int + +/* Define to the type of arg 4 for recvfrom. */ +#define RECVFROM_TYPE_ARG4 int + +/* Define to the type pointed by arg 5 for recvfrom. */ +#define RECVFROM_TYPE_ARG5 struct sockaddr + +/* Define to the type pointed by arg 6 for recvfrom. */ +#define RECVFROM_TYPE_ARG6 int + +/* Define to the function return type for recvfrom. */ +#define RECVFROM_TYPE_RETV int + +/* Define if you have the send function. */ +#define HAVE_SEND + +/* Define to the type of arg 1 for send. */ +#define SEND_TYPE_ARG1 int + +/* Define to the type qualifier of arg 2 for send. */ +#define SEND_QUAL_ARG2 + +/* Define to the type of arg 2 for send. */ +#define SEND_TYPE_ARG2 char * + +/* Define to the type of arg 3 for send. */ +#define SEND_TYPE_ARG3 int + +/* Define to the type of arg 4 for send. */ +#define SEND_TYPE_ARG4 int + +/* Define to the function return type for send. */ +#define SEND_TYPE_RETV int + +/* Define to use the QsoSSL package. */ +#define USE_QSOSSL + +/* Use the system keyring as the default CA bundle. */ +#define CURL_CA_BUNDLE "/QIBM/UserData/ICSS/Cert/Server/DEFAULT.KDB" + +/* ---------------------------------------------------------------- */ +/* ADDITIONAL DEFINITIONS */ +/* ---------------------------------------------------------------- */ + +/* The following must be defined BEFORE system header files inclusion. */ + +#define __ptr128 /* No teraspace. */ +#define qadrt_use_fputc_inline /* Generate fputc() wrapper inline. */ +#define qadrt_use_fread_inline /* Generate fread() wrapper inline. */ +#define qadrt_use_fwrite_inline /* Generate fwrite() wrapper inline. */ + diff --git a/lib/config-riscos.h b/lib/config-riscos.h new file mode 100644 index 00000000..98bb7880 --- /dev/null +++ b/lib/config-riscos.h @@ -0,0 +1,475 @@ +/* curl_config.h.in. Generated automatically from configure.in by autoheader. */ +/* Name of this package! */ +#undef PACKAGE + +/* Version number of this archive. */ +#undef VERSION + +/* Define if you have the getpass function. */ +#undef HAVE_GETPASS + +/* Define cpu-machine-OS */ +#define OS "ARM-RISC OS" + +/* Define if you have the gethostbyaddr_r() function with 5 arguments */ +#undef HAVE_GETHOSTBYADDR_R_5 + +/* Define if you have the gethostbyaddr_r() function with 7 arguments */ +#undef HAVE_GETHOSTBYADDR_R_7 + +/* Define if you have the gethostbyaddr_r() function with 8 arguments */ +#undef HAVE_GETHOSTBYADDR_R_8 + +/* Define if you have the gethostbyname_r() function with 3 arguments */ +#undef HAVE_GETHOSTBYNAME_R_3 + +/* Define if you have the gethostbyname_r() function with 5 arguments */ +#undef HAVE_GETHOSTBYNAME_R_5 + +/* Define if you have the gethostbyname_r() function with 6 arguments */ +#undef HAVE_GETHOSTBYNAME_R_6 + +/* Define if you need the _REENTRANT define for some functions */ +#undef NEED_REENTRANT + +/* Define if you have the Kerberos4 libraries (including -ldes) */ +#undef HAVE_KRB4 + +/* Define if you want to enable IPv6 support */ +#undef ENABLE_IPV6 + +/* Define if struct sockaddr_in6 has the sin6_scope_id member */ +#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1 + +/* Define this to 'int' if ssize_t is not an available typedefed type */ +#undef ssize_t + +/* Define this as a suitable file to read random data from */ +#undef RANDOM_FILE + +/* Define this to your Entropy Gathering Daemon socket pathname */ +#undef EGD_SOCKET + +/* Define if you want to enable IPv6 support */ +#undef ENABLE_IPV6 + +/* Define to 1 if you have the alarm function. */ +#define HAVE_ALARM 1 + +/* Define if you have the <alloca.h> header file. */ +#define HAVE_ALLOCA_H + +/* Define if you have the <arpa/inet.h> header file. */ +#define HAVE_ARPA_INET_H + +/* Define if you have the `closesocket' function. */ +#undef HAVE_CLOSESOCKET + +/* Define if you have the <crypto.h> header file. */ +#undef HAVE_CRYPTO_H + +/* Define if you have the <des.h> header file. */ +#undef HAVE_DES_H + +/* Define if you have the <err.h> header file. */ +#undef HAVE_ERR_H + +/* Define if you have the <fcntl.h> header file. */ +#define HAVE_FCNTL_H + +/* Define if getaddrinfo exists and works */ +#define HAVE_GETADDRINFO + +/* Define if you have the `geteuid' function. */ +#undef HAVE_GETEUID + +/* Define if you have the `gethostbyaddr' function. */ +#define HAVE_GETHOSTBYADDR + +/* Define if you have the `gethostbyaddr_r' function. */ +#undef HAVE_GETHOSTBYADDR_R + +/* Define if you have the `gethostbyname_r' function. */ +#undef HAVE_GETHOSTBYNAME_R + +/* Define if you have the `gethostname' function. */ +#define HAVE_GETHOSTNAME + +/* Define if you have the <getopt.h> header file. */ +#define HAVE_GETOPT_H + +/* Define if you have the `getpass_r' function. */ +#undef HAVE_GETPASS_R + +/* Define if you have the `getpwuid' function. */ +#undef HAVE_GETPWUID + +/* Define if you have the `getservbyname' function. */ +#undef HAVE_GETSERVBYNAME + +/* Define if you have the `gettimeofday' function. */ +#define HAVE_GETTIMEOFDAY + +/* Define if you have the `timeval' struct. */ +#define HAVE_STRUCT_TIMEVAL + +/* Define if you have the `inet_addr' function. */ +#undef HAVE_INET_ADDR + +/* Define if you have the <inttypes.h> header file. */ +#define HAVE_INTTYPES_H + +/* Define if you have the <io.h> header file. */ +#define HAVE_IO_H + +/* Define if you have the `krb_get_our_ip_for_realm' function. */ +#undef HAVE_KRB_GET_OUR_IP_FOR_REALM + +/* Define if you have the <krb.h> header file. */ +#undef HAVE_KRB_H + +/* Define if you have the `crypto' library (-lcrypto). */ +#undef HAVE_LIBCRYPTO + +/* Define if you have the `nsl' library (-lnsl). */ +#undef HAVE_LIBNSL + +/* Define if you have the `resolv' library (-lresolv). */ +#undef HAVE_LIBRESOLV + +/* Define if you have the `resolve' library (-lresolve). */ +#undef HAVE_LIBRESOLVE + +/* Define if you have the `socket' library (-lsocket). */ +#undef HAVE_LIBSOCKET + +/* Define if you have the `ssl' library (-lssl). */ +#undef HAVE_LIBSSL + +/* Define if you have the `ucb' library (-lucb). */ +#undef HAVE_LIBUCB + +/* Define if you have the `localtime_r' function. */ +#undef HAVE_LOCALTIME_R + +/* Define if you have the <malloc.h> header file. */ +#define HAVE_MALLOC_H + +/* Define if you need the malloc.h header file even with stdlib.h */ +/* #define NEED_MALLOC_H 1 */ + +/* Define if you have the <memory.h> header file. */ +#undef HAVE_MEMORY_H + +/* Define if you have the <netdb.h> header file. */ +#define HAVE_NETDB_H + +/* Define if you have the <netinet/if_ether.h> header file. */ +#undef HAVE_NETINET_IF_ETHER_H + +/* Define if you have the <netinet/in.h> header file. */ +#define HAVE_NETINET_IN_H + +/* Define if you have the <net/if.h> header file. */ +#define HAVE_NET_IF_H + +/* Define if you have the <openssl/crypto.h> header file. */ +#undef HAVE_OPENSSL_CRYPTO_H + +/* Define if you have the <openssl/err.h> header file. */ +#undef HAVE_OPENSSL_ERR_H + +/* Define if you have the <openssl/pem.h> header file. */ +#undef HAVE_OPENSSL_PEM_H + +/* Define if you have the <openssl/rsa.h> header file. */ +#undef HAVE_OPENSSL_RSA_H + +/* Define if you have the <openssl/ssl.h> header file. */ +#undef HAVE_OPENSSL_SSL_H + +/* Define if you have the <openssl/x509.h> header file. */ +#undef HAVE_OPENSSL_X509_H + +/* Define if you have the <pem.h> header file. */ +#undef HAVE_PEM_H + +/* Define if you have the `perror' function. */ +#undef HAVE_PERROR + +/* Define if you have the <pwd.h> header file. */ +#undef HAVE_PWD_H + +/* Define if you have the `RAND_egd' function. */ +#undef HAVE_RAND_EGD + +/* Define if you have the `RAND_screen' function. */ +#undef HAVE_RAND_SCREEN + +/* Define if you have the `RAND_status' function. */ +#undef HAVE_RAND_STATUS + +/* Define if you have the <rsa.h> header file. */ +#undef HAVE_RSA_H + +/* Define if you have the `select' function. */ +#define HAVE_SELECT + +/* Define if you have the `setvbuf' function. */ +#undef HAVE_SETVBUF + +/* Define if you have the <sgtty.h> header file. */ +#define HAVE_SGTTY_H + +/* Define if you have the `sigaction' function. */ +#undef HAVE_SIGACTION + +/* Define if you have the `signal' function. */ +#define HAVE_SIGNAL + +/* Define if you have the <signal.h> header file. */ +#define HAVE_SIGNAL_H + +/* Define if sig_atomic_t is an available typedef. */ +#define HAVE_SIG_ATOMIC_T + +/* Define if sig_atomic_t is already defined as volatile. */ +#undef HAVE_SIG_ATOMIC_T_VOLATILE + +/* Define if you have the `socket' function. */ +#define HAVE_SOCKET + +/* Define if you have the <ssl.h> header file. */ +#undef HAVE_SSL_H + +/* Define if you have the <stdint.h> header file. */ +#undef HAVE_STDINT_H + +/* Define if you have the <stdlib.h> header file. */ +#define HAVE_STDLIB_H + +/* Define if you have the `strcasecmp' function. */ +#undef HAVE_STRCASECMP + +/* Define if you have the `strcmpi' function. */ +#undef HAVE_STRCMPI + +/* Define if you have the `strdup' function. */ +#define HAVE_STRDUP + +/* Define if you have the `strftime' function. */ +#define HAVE_STRFTIME + +/* Define if you have the `stricmp' function. */ +#define HAVE_STRICMP + +/* Define if you have the <strings.h> header file. */ +#undef HAVE_STRINGS_H + +/* Define if you have the <string.h> header file. */ +#define HAVE_STRING_H + +/* Define if you have the `strlcat' function. */ +#undef HAVE_STRLCAT + +/* Define if you have the `strlcpy' function. */ +#undef HAVE_STRLCPY + +/* Define if you have the `strstr' function. */ +#define HAVE_STRSTR + +/* Define if you have the `strtok_r' function. */ +#undef HAVE_STRTOK_R + +/* Define if you have the `strtoll' function. */ +#undef HAVE_STRTOLL + +/* Define if you have the <sys/param.h> header file. */ +#undef HAVE_SYS_PARAM_H + +/* Define if you have the <sys/select.h> header file. */ +#undef HAVE_SYS_SELECT_H + +/* Define if you have the <sys/socket.h> header file. */ +#define HAVE_SYS_SOCKET_H + +/* Define if you have the <sys/sockio.h> header file. */ +#undef HAVE_SYS_SOCKIO_H + +/* Define if you have the <sys/stat.h> header file. */ +#undef HAVE_SYS_STAT_H + +/* Define if you have the <sys/time.h> header file. */ +#define HAVE_SYS_TIME_H + +/* Define if you have the <sys/types.h> header file. */ +#define HAVE_SYS_TYPES_H + +/* Define if you have the `tcgetattr' function. */ +#define HAVE_TCGETATTR + +/* Define if you have the `tcsetattr' function. */ +#define HAVE_TCSETATTR + +/* Define if you have the <termios.h> header file. */ +#define HAVE_TERMIOS_H + +/* Define if you have the <termio.h> header file. */ +#undef HAVE_TERMIO_H + +/* Define if you have the <time.h> header file. */ +#undef HAVE_TIME_H + +/* Define if you have the `uname' function. */ +#define HAVE_UNAME + +/* Define if you have the <unistd.h> header file. */ +#define HAVE_UNISTD_H + +/* Define if you have the <winsock.h> header file. */ +#undef HAVE_WINSOCK_H + +/* Define if you have the <x509.h> header file. */ +#undef HAVE_X509_H + +/* Name of package */ +#undef PACKAGE + +/* Define as the return type of signal handlers (`int' or `void'). */ +#define RETSIGTYPE void + +/* The size of `int', as computed by sizeof. */ +#define SIZEOF_INT 4 + +/* The size of `long double', as computed by sizeof. */ +#undef SIZEOF_LONG_DOUBLE + +/* The size of `long long', as computed by sizeof. */ +#undef SIZEOF_LONG_LONG + +/* The size of `short', as computed by sizeof. */ +#define SIZEOF_SHORT 2 + +/* Define if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define if you can safely include both <sys/time.h> and <time.h>. */ +#undef TIME_WITH_SYS_TIME + +/* Version number of package */ +#undef VERSION + +/* Define if on AIX 3. + System headers sometimes define this. + We just want to avoid a redefinition error message. */ +#ifndef _ALL_SOURCE +# undef _ALL_SOURCE +#endif + +/* Number of bits in a file offset, on hosts where this is settable. */ +#undef _FILE_OFFSET_BITS + +/* Define for large files, on AIX-style hosts. */ +#undef _LARGE_FILES + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* Define to `unsigned' if <sys/types.h> does not define. */ +#undef size_t + +/* Define to `int' if <sys/types.h> does not define. */ +#undef ssize_t + +/* Define if you have the ioctl function. */ +#define HAVE_IOCTL + +/* Define if you have a working ioctl FIONBIO function. */ +#define HAVE_IOCTL_FIONBIO + +/* to disable LDAP */ +#define CURL_DISABLE_LDAP + +/* Define if you have the getnameinfo function. */ +#define HAVE_GETNAMEINFO 1 + +/* Define to the type qualifier of arg 1 for getnameinfo. */ +#define GETNAMEINFO_QUAL_ARG1 const + +/* Define to the type of arg 1 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG1 struct sockaddr * + +/* Define to the type of arg 2 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG2 socklen_t + +/* Define to the type of args 4 and 6 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG46 size_t + +/* Define to the type of arg 7 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG7 int + +/* Define if you have the recv function. */ +#define HAVE_RECV 1 + +/* Define to the type of arg 1 for recv. */ +#define RECV_TYPE_ARG1 int + +/* Define to the type of arg 2 for recv. */ +#define RECV_TYPE_ARG2 void * + +/* Define to the type of arg 3 for recv. */ +#define RECV_TYPE_ARG3 size_t + +/* Define to the type of arg 4 for recv. */ +#define RECV_TYPE_ARG4 int + +/* Define to the function return type for recv. */ +#define RECV_TYPE_RETV ssize_t + +/* Define 1 if you have the recvfrom function. */ +#define HAVE_RECVFROM 1 + +/* Define to the type of arg 1 for recvfrom. */ +#define RECVFROM_TYPE_ARG1 int + +/* Define to the type pointed by arg 2 for recvfrom. */ +#define RECVFROM_TYPE_ARG2 void + +/* Define to 1 if the type pointed by arg 2 for recvfrom is void. */ +#define RECVFROM_TYPE_ARG2_IS_VOID 1 + +/* Define to the type of arg 3 for recvfrom. */ +#define RECVFROM_TYPE_ARG3 size_t + +/* Define to the type of arg 4 for recvfrom. */ +#define RECVFROM_TYPE_ARG4 int + +/* Define to the type pointed by arg 5 for recvfrom. */ +#define RECVFROM_TYPE_ARG5 struct sockaddr + +/* Define to the type pointed by arg 6 for recvfrom. */ +#define RECVFROM_TYPE_ARG6 int + +/* Define to the function return type for recvfrom. */ +#define RECVFROM_TYPE_RETV ssize_t + +/* Define if you have the send function. */ +#define HAVE_SEND 1 + +/* Define to the type of arg 1 for send. */ +#define SEND_TYPE_ARG1 int + +/* Define to the type qualifier of arg 2 for send. */ +#define SEND_QUAL_ARG2 const + +/* Define to the type of arg 2 for send. */ +#define SEND_TYPE_ARG2 void * + +/* Define to the type of arg 3 for send. */ +#define SEND_TYPE_ARG3 size_t + +/* Define to the type of arg 4 for send. */ +#define SEND_TYPE_ARG4 int + +/* Define to the function return type for send. */ +#define SEND_TYPE_RETV ssize_t diff --git a/lib/config-symbian.h b/lib/config-symbian.h new file mode 100644 index 00000000..9f8b74a5 --- /dev/null +++ b/lib/config-symbian.h @@ -0,0 +1,811 @@ +/* config-symbian.h. Manually generated. */ + +/* when building libcurl itself */ +/* #undef BUILDING_LIBCURL */ + +/* Location of default ca bundle */ +/* #define CURL_CA_BUNDLE "/etc/pki/tls/certs/ca-bundle.crt"*/ + +/* Location of default ca path */ +/* #undef CURL_CA_PATH */ + +/* to disable cookies support */ +/* #undef CURL_DISABLE_COOKIES */ + +/* to disable cryptographic authentication */ +/* #undef CURL_DISABLE_CRYPTO_AUTH */ + +/* to disable DICT */ +/* #undef CURL_DISABLE_DICT */ + +/* to disable FILE */ +/* #undef CURL_DISABLE_FILE */ + +/* to disable FTP */ +/* #undef CURL_DISABLE_FTP */ + +/* to disable HTTP */ +/* #undef CURL_DISABLE_HTTP */ + +/* to disable LDAP */ +#define CURL_DISABLE_LDAP 1 + +/* to disable LDAPS */ +#define CURL_DISABLE_LDAPS 1 + +/* to disable TELNET */ +/* #undef CURL_DISABLE_TELNET */ + +/* to disable TFTP */ +/* #undef CURL_DISABLE_TFTP */ + +/* to disable verbose strings */ +/* #define CURL_DISABLE_VERBOSE_STRINGS 1*/ + +/* to make a symbol visible */ +/*#define CURL_EXTERN_SYMBOL __declspec(dllexport)*/ + +/* to enable hidden symbols */ +/*#define CURL_HIDDEN_SYMBOLS 1*/ + +/* Use Windows LDAP implementation */ +/* #undef CURL_LDAP_WIN */ + +/* when not building a shared library */ +/* #undef CURL_STATICLIB */ + +/* your Entropy Gathering Daemon socket pathname */ +/* #undef EGD_SOCKET */ + +/* Define if you want to enable IPv6 support */ +#define ENABLE_IPV6 1 + +/* Define if struct sockaddr_in6 has the sin6_scope_id member */ +#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1 + +/* Define to the type qualifier of arg 1 for getnameinfo. */ +#define GETNAMEINFO_QUAL_ARG1 const + +/* Define to the type of arg 1 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG1 struct sockaddr * + +/* Define to the type of arg 2 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG2 socklen_t + +/* Define to the type of args 4 and 6 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG46 size_t + +/* Define to the type of arg 7 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG7 int + +/* Define to 1 if you have the <alloca.h> header file. */ +/*#define HAVE_ALLOCA_H 1*/ + +/* Define to 1 if you have the <arpa/inet.h> header file. */ +#define HAVE_ARPA_INET_H 1 + +/* Define to 1 if you have the <arpa/tftp.h> header file. */ +/*#define HAVE_ARPA_TFTP_H 1*/ + +/* Define to 1 if you have the <assert.h> header file. */ +#define HAVE_ASSERT_H 1 + +/* Define to 1 if you have the `basename' function. */ +/*#define HAVE_BASENAME 1*/ + +/* Define to 1 if bool is an available type. */ +/*#define HAVE_BOOL_T 1*/ + +/* Define to 1 if you have the `closesocket' function. */ +/* #undef HAVE_CLOSESOCKET */ + +/* Define to 1 if you have the `CRYPTO_cleanup_all_ex_data' function. */ +/*#define HAVE_CRYPTO_CLEANUP_ALL_EX_DATA 1*/ + +/* Define to 1 if you have the <crypto.h> header file. */ +/* #undef HAVE_CRYPTO_H */ + +/* Define to 1 if you have the <des.h> header file. */ +/* #undef HAVE_DES_H */ + +/* Define to 1 if you have the <dlfcn.h> header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if you have the `ENGINE_load_builtin_engines' function. */ +/*#define HAVE_ENGINE_LOAD_BUILTIN_ENGINES 1*/ + +/* Define to 1 if you have the <errno.h> header file. */ +#define HAVE_ERRNO_H 1 + +/* Define to 1 if you have the <err.h> header file. */ +#define HAVE_ERR_H 1 + +/* Define to 1 if you have the <fcntl.h> header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if you have the fcntl function. */ +#define HAVE_FCNTL 1 + +/* Define to 1 if you have a working fcntl O_NONBLOCK function. */ +#define HAVE_FCNTL_O_NONBLOCK 1 + +/* Define to 1 if you have the `fork' function. */ +/*#define HAVE_FORK 1*/ + +/* Define to 1 if you have the `ftruncate' function. */ +#define HAVE_FTRUNCATE 1 + +/* Define if getaddrinfo exists and works */ +#define HAVE_GETADDRINFO 1 + +/* Define to 1 if you have the `geteuid' function. */ +#define HAVE_GETEUID 1 + +/* Define to 1 if you have the `gethostbyaddr' function. */ +#define HAVE_GETHOSTBYADDR 1 + +/* If you have gethostbyname */ +#define HAVE_GETHOSTBYNAME 1 + +/* Define to 1 if you have the `gethostbyname_r' function. */ +/* #undef HAVE_GETHOSTBYNAME_R */ + +/* gethostbyname_r() takes 3 args */ +/* #undef HAVE_GETHOSTBYNAME_R_3 */ + +/* gethostbyname_r() takes 5 args */ +/* #undef HAVE_GETHOSTBYNAME_R_5 */ + +/* gethostbyname_r() takes 6 args */ +/* #undef HAVE_GETHOSTBYNAME_R_6 */ + +/* Define to 1 if you have the getnameinfo function. */ +#define HAVE_GETNAMEINFO 1 + +/* Define to 1 if you have the `getpass_r' function. */ +/* #undef HAVE_GETPASS_R */ + +/* Define to 1 if you have the `getppid' function. */ +#define HAVE_GETPPID 1 + +/* Define to 1 if you have the `getprotobyname' function. */ +#define HAVE_GETPROTOBYNAME 1 + +/* Define to 1 if you have the `getpwuid' function. */ +#define HAVE_GETPWUID 1 + +/* Define to 1 if you have the `getrlimit' function. */ +/*#define HAVE_GETRLIMIT 1*/ + +/* Define to 1 if you have the `gettimeofday' function. */ +#define HAVE_GETTIMEOFDAY 1 + +/* we have a glibc-style strerror_r() */ +/* #undef HAVE_GLIBC_STRERROR_R */ + +/* Define to 1 if you have the `gmtime_r' function. */ +#define HAVE_GMTIME_R 1 + +/* if you have the gssapi libraries */ +/* #undef HAVE_GSSAPI */ + +/* Define to 1 if you have the <gssapi/gssapi_generic.h> header file. */ +/* #undef HAVE_GSSAPI_GSSAPI_GENERIC_H */ + +/* Define to 1 if you have the <gssapi/gssapi.h> header file. */ +/* #undef HAVE_GSSAPI_GSSAPI_H */ + +/* Define to 1 if you have the <gssapi/gssapi_krb5.h> header file. */ +/* #undef HAVE_GSSAPI_GSSAPI_KRB5_H */ + +/* if you have the GNU gssapi libraries */ +/* #undef HAVE_GSSGNU */ + +/* if you have the Heimdal gssapi libraries */ +/* #undef HAVE_GSSHEIMDAL */ + +/* if you have the MIT gssapi libraries */ +/* #undef HAVE_GSSMIT */ + +/* Define to 1 if you have the `idna_strerror' function. */ +/*#define HAVE_IDNA_STRERROR 1*/ + +/* Define to 1 if you have the `idn_free' function. */ +/*#define HAVE_IDN_FREE 1*/ + +/* Define to 1 if you have the <idn-free.h> header file. */ +/*#define HAVE_IDN_FREE_H 1*/ + +/* Define to 1 if you have the `inet_addr' function. */ +/*#define HAVE_INET_ADDR 1*/ + +/* Define to 1 if you have a IPv6 capable working inet_ntop function. */ +/*#define HAVE_INET_NTOP 1*/ + +/* Define to 1 if you have a IPv6 capable working inet_pton function. */ +/*#define HAVE_INET_PTON 1*/ + +/* Define to 1 if you have the <inttypes.h> header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the ioctl function. */ +#define HAVE_IOCTL 1 + +/* Define to 1 if you have a working ioctl FIONBIO function. */ +#define HAVE_IOCTL_FIONBIO 1 + +/* Define to 1 if you have the ioctlsocket function. */ +/* #undef HAVE_IOCTLSOCKET */ + +/* Define to 1 if you have a working ioctlsocket FIONBIO function. */ +/* #undef HAVE_IOCTLSOCKET_FIONBIO */ + +/* Define to 1 if you have the IoctlSocket camel case function. */ +/* #undef HAVE_IOCTLSOCKET_CAMEL */ + +/* Define to 1 if you have a working IoctlSocket camel case FIONBIO function. */ +/* #undef HAVE_IOCTLSOCKET_CAMEL_FIONBIO */ + +/* Define to 1 if you have the <io.h> header file. */ +/* #undef HAVE_IO_H */ + +/* if you have the Kerberos4 libraries (including -ldes) */ +/* #undef HAVE_KRB4 */ + +/* Define to 1 if you have the `krb_get_our_ip_for_realm' function. */ +/* #undef HAVE_KRB_GET_OUR_IP_FOR_REALM */ + +/* Define to 1 if you have the <krb.h> header file. */ +/* #undef HAVE_KRB_H */ + +/* Define to 1 if you have the lber.h header file. */ +/*#define HAVE_LBER_H 1*/ + +/* Define to 1 if you have the ldapssl.h header file. */ +/* #undef HAVE_LDAPSSL_H */ + +/* Define to 1 if you have the ldap.h header file. */ +/*#define HAVE_LDAP_H 1*/ + +/* Use LDAPS implementation */ +/*#define HAVE_LDAP_SSL 1*/ + +/* Define to 1 if you have the ldap_ssl.h header file. */ +/* #undef HAVE_LDAP_SSL_H */ + +/* Define to 1 if you have the `ldap_url_parse' function. */ +/*#define HAVE_LDAP_URL_PARSE 1*/ + +/* Define to 1 if you have the <libgen.h> header file. */ +/*#define HAVE_LIBGEN_H 1*/ + +/* Define to 1 if you have the `idn' library (-lidn). */ +/*#define HAVE_LIBIDN 1*/ + +/* Define to 1 if you have the `resolv' library (-lresolv). */ +/* #undef HAVE_LIBRESOLV */ + +/* Define to 1 if you have the `resolve' library (-lresolve). */ +/* #undef HAVE_LIBRESOLVE */ + +/* Define to 1 if you have the `socket' library (-lsocket). */ +/* #undef HAVE_LIBSOCKET */ + +/* Define to 1 if you have the `ssh2' library (-lssh2). */ +/*#define HAVE_LIBSSH2 1*/ + +/* Define to 1 if you have the <libssh2.h> header file. */ +/*#define HAVE_LIBSSH2_H 1*/ + +/* Define to 1 if you have the `ssl' library (-lssl). */ +/*#define HAVE_LIBSSL 1*/ + +/* Define to 1 if you have the <limits.h> header file. */ +#define HAVE_LIMITS_H 1 + +/* if your compiler supports LL */ +#define HAVE_LL 1 + +/* Define to 1 if you have the <locale.h> header file. */ +#define HAVE_LOCALE_H 1 + +/* Define to 1 if you have the `localtime_r' function. */ +#define HAVE_LOCALTIME_R 1 + +/* Define to 1 if the compiler supports the 'long long' data type. */ +#define HAVE_LONGLONG 1 + +/* Define to 1 if you have the malloc.h header file. */ +/*#define HAVE_MALLOC_H 1*/ + +/* Define to 1 if you have the <memory.h> header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the MSG_NOSIGNAL flag. */ +/*#define HAVE_MSG_NOSIGNAL 1*/ + +/* Define to 1 if you have the <netdb.h> header file. */ +#define HAVE_NETDB_H 1 + +/* Define to 1 if you have the <netinet/in.h> header file. */ +#define HAVE_NETINET_IN_H 1 + +/* Define to 1 if you have the <netinet/tcp.h> header file. */ +/*#define HAVE_NETINET_TCP_H 1*/ + +/* Define to 1 if you have the <net/if.h> header file. */ +#define HAVE_NET_IF_H 1 + +/* Define to 1 if NI_WITHSCOPEID exists and works. */ +/*#define HAVE_NI_WITHSCOPEID 1*/ + +/* we have no strerror_r() proto */ +/* #undef HAVE_NO_STRERROR_R_DECL */ + +/* if you have an old MIT gssapi library, lacking GSS_C_NT_HOSTBASED_SERVICE + */ +/* #undef HAVE_OLD_GSSMIT */ + +/* Define to 1 if you have the <openssl/crypto.h> header file. */ +/*#define HAVE_OPENSSL_CRYPTO_H 1*/ + +/* Define to 1 if you have the <openssl/engine.h> header file. */ +/*#define HAVE_OPENSSL_ENGINE_H 1*/ + +/* Define to 1 if you have the <openssl/err.h> header file. */ +/*#define HAVE_OPENSSL_ERR_H 1*/ + +/* Define to 1 if you have the <openssl/pem.h> header file. */ +/*#define HAVE_OPENSSL_PEM_H 1*/ + +/* Define to 1 if you have the <openssl/pkcs12.h> header file. */ +/*#define HAVE_OPENSSL_PKCS12_H 1*/ + +/* Define to 1 if you have the <openssl/rsa.h> header file. */ +/*#define HAVE_OPENSSL_RSA_H 1*/ + +/* Define to 1 if you have the <openssl/ssl.h> header file. */ +/*#define HAVE_OPENSSL_SSL_H 1*/ + +/* Define to 1 if you have the <openssl/x509.h> header file. */ +/*#define HAVE_OPENSSL_X509_H 1*/ + +/* Define to 1 if you have the <pem.h> header file. */ +/* #undef HAVE_PEM_H */ + +/* Define to 1 if you have the `perror' function. */ +#define HAVE_PERROR 1 + +/* Define to 1 if you have the `pipe' function. */ +#define HAVE_PIPE 1 + +/* if you have the function PK11_CreateGenericObject */ +/* #undef HAVE_PK11_CREATEGENERICOBJECT */ + +/* Define to 1 if you have the `poll' function. */ +/*#define HAVE_POLL 1*/ + +/* If you have a fine poll */ +/*#define HAVE_POLL_FINE 1*/ + +/* Define to 1 if you have the <poll.h> header file. */ +/*#define HAVE_POLL_H 1*/ + +/* we have a POSIX-style strerror_r() */ +#define HAVE_POSIX_STRERROR_R 1 + +/* Define to 1 if you have the <pwd.h> header file. */ +#define HAVE_PWD_H 1 + +/* Define to 1 if you have the `RAND_egd' function. */ +#define HAVE_RAND_EGD 1 + +/* Define to 1 if you have the `RAND_screen' function. */ +/* #undef HAVE_RAND_SCREEN */ + +/* Define to 1 if you have the `RAND_status' function. */ +/*#define HAVE_RAND_STATUS 1*/ + +/* Define to 1 if you have the recv function. */ +#define HAVE_RECV 1 + +/* Define to 1 if you have the recvfrom function. */ +#define HAVE_RECVFROM 1 + +/* Define to 1 if you have the <rsa.h> header file. */ +/* #undef HAVE_RSA_H */ + +/* Define to 1 if you have the select function. */ +#define HAVE_SELECT 1 + +/* Define to 1 if you have the send function. */ +#define HAVE_SEND 1 + +/* Define to 1 if you have the <setjmp.h> header file. */ +#define HAVE_SETJMP_H 1 + +/* Define to 1 if you have the `setlocale' function. */ +#define HAVE_SETLOCALE 1 + +/* Define to 1 if you have the `setmode' function. */ +/* #undef HAVE_SETMODE */ + +/* Define to 1 if you have the `setrlimit' function. */ +/*#define HAVE_SETRLIMIT 1*/ + +/* Define to 1 if you have the setsockopt function. */ +/* #undef HAVE_SETSOCKOPT */ + +/* Define to 1 if you have a working setsockopt SO_NONBLOCK function. */ +/* #undef HAVE_SETSOCKOPT_SO_NONBLOCK */ + +/* Define to 1 if you have the <sgtty.h> header file. */ +/*#define HAVE_SGTTY_H 1*/ + +/* Define to 1 if you have the `sigaction' function. */ +/*#define HAVE_SIGACTION 1*/ + +/* Define to 1 if you have the `siginterrupt' function. */ +/*#define HAVE_SIGINTERRUPT 1*/ + +/* Define to 1 if you have the `signal' function. */ +/*#define HAVE_SIGNAL 1*/ + +/* Define to 1 if you have the <signal.h> header file. */ +#define HAVE_SIGNAL_H 1 + +/* If you have sigsetjmp */ +/*#define HAVE_SIGSETJMP 1*/ + +/* Define to 1 if sig_atomic_t is an available typedef. */ +/*#define HAVE_SIG_ATOMIC_T 1*/ + +/* Define to 1 if sig_atomic_t is already defined as volatile. */ +/* #undef HAVE_SIG_ATOMIC_T_VOLATILE */ + +/* Define to 1 if you have the `socket' function. */ +#define HAVE_SOCKET 1 + +/* Define this if you have the SPNEGO library fbopenssl */ +/* #undef HAVE_SPNEGO */ + +/* Define to 1 if you have the `SSL_get_shutdown' function. */ +/*#define HAVE_SSL_GET_SHUTDOWN 1*/ + +/* Define to 1 if you have the <ssl.h> header file. */ +/* #undef HAVE_SSL_H */ + +/* Define to 1 if you have the <stdbool.h> header file. */ +#define HAVE_STDBOOL_H 1 + +/* Define to 1 if you have the <stdint.h> header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the <stdio.h> header file. */ +#define HAVE_STDIO_H 1 + +/* Define to 1 if you have the <stdlib.h> header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `strcasecmp' function. */ +#define HAVE_STRCASECMP 1 + +/* Define to 1 if you have the `strcasestr' function. */ +#define HAVE_STRCASESTR 1 + +/* Define to 1 if you have the `strcmpi' function. */ +/* #undef HAVE_STRCMPI */ + +/* Define to 1 if you have the `strdup' function. */ +#define HAVE_STRDUP 1 + +/* Define to 1 if you have the `strerror_r' function. */ +#define HAVE_STRERROR_R 1 + +/* Define to 1 if you have the `stricmp' function. */ +/* #undef HAVE_STRICMP */ + +/* Define to 1 if you have the <strings.h> header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the <string.h> header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strlcat' function. */ +#define HAVE_STRLCAT 1 + +/* Define to 1 if you have the `strlcpy' function. */ +#define HAVE_STRLCPY 1 + +/* Define to 1 if you have the `strstr' function. */ +#define HAVE_STRSTR 1 + +/* Define to 1 if you have the `strtok_r' function. */ +#define HAVE_STRTOK_R 1 + +/* Define to 1 if you have the `strtoll' function. */ +#define HAVE_STRTOLL 1 + +/* if struct sockaddr_storage is defined */ +#define HAVE_STRUCT_SOCKADDR_STORAGE 1 + +/* Define to 1 if you have the timeval struct. */ +#define HAVE_STRUCT_TIMEVAL 1 + +/* Define to 1 if you have the <sys/filio.h> header file. */ +#define HAVE_SYS_FILIO_H 1 + +/* Define to 1 if you have the <sys/ioctl.h> header file. */ +#define HAVE_SYS_IOCTL_H 1 + +/* Define to 1 if you have the <sys/param.h> header file. */ +#define HAVE_SYS_PARAM_H 1 + +/* Define to 1 if you have the <sys/poll.h> header file. */ +/*#define HAVE_SYS_POLL_H 1*/ + +/* Define to 1 if you have the <sys/resource.h> header file. */ +#define HAVE_SYS_RESOURCE_H 1 + +/* Define to 1 if you have the <sys/select.h> header file. */ +#define HAVE_SYS_SELECT_H 1 + +/* Define to 1 if you have the <sys/socket.h> header file. */ +#define HAVE_SYS_SOCKET_H 1 + +/* Define to 1 if you have the <sys/sockio.h> header file. */ +#define HAVE_SYS_SOCKIO_H 1 + +/* Define to 1 if you have the <sys/stat.h> header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the <sys/time.h> header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the <sys/types.h> header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the <sys/utime.h> header file. */ +/* #undef HAVE_SYS_UTIME_H */ + +/* Define to 1 if you have the <termios.h> header file. */ +/*#define HAVE_TERMIOS_H 1*/ + +/* Define to 1 if you have the <termio.h> header file. */ +/*#define HAVE_TERMIO_H 1*/ + +/* Define to 1 if you have the <time.h> header file. */ +#define HAVE_TIME_H 1 + +/* Define to 1 if you have the <tld.h> header file. */ +/*#define HAVE_TLD_H 1*/ + +/* Define to 1 if you have the `tld_strerror' function. */ +/*#define HAVE_TLD_STRERROR 1*/ + +/* Define to 1 if you have the `uname' function. */ +#define HAVE_UNAME 1 + +/* Define to 1 if you have the <unistd.h> header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the `utime' function. */ +#define HAVE_UTIME 1 + +/* Define to 1 if you have the <utime.h> header file. */ +#define HAVE_UTIME_H 1 + +/* Define to 1 if compiler supports C99 variadic macro style. */ +#define HAVE_VARIADIC_MACROS_C99 1 + +/* Define to 1 if compiler supports old gcc variadic macro style. */ +/*#define HAVE_VARIADIC_MACROS_GCC 1*/ + +/* Define to 1 if you have the winber.h header file. */ +/* #undef HAVE_WINBER_H */ + +/* Define to 1 if you have the windows.h header file. */ +/* #undef HAVE_WINDOWS_H */ + +/* Define to 1 if you have the winldap.h header file. */ +/* #undef HAVE_WINLDAP_H */ + +/* Define to 1 if you have the winsock2.h header file. */ +/* #undef HAVE_WINSOCK2_H */ + +/* Define to 1 if you have the winsock.h header file. */ +/* #undef HAVE_WINSOCK_H */ + +/* Define this symbol if your OS supports changing the contents of argv */ +/*#define HAVE_WRITABLE_ARGV 1*/ + +/* Define to 1 if you have the ws2tcpip.h header file. */ +/* #undef HAVE_WS2TCPIP_H */ + +/* Define to 1 if you have the <x509.h> header file. */ +/* #undef HAVE_X509_H */ + +/* Define to 1 if you are building a native Windows target. */ +/* #undef NATIVE_WINDOWS */ + +/* Define to 1 if you need the lber.h header file even with ldap.h */ +/* #undef NEED_LBER_H */ + +/* Define to 1 if you need the malloc.h header file even with stdlib.h */ +/* #undef NEED_MALLOC_H */ + +/* Define to 1 if _REENTRANT preprocessor symbol must be defined. */ +/* #undef NEED_REENTRANT */ + +/* Define to 1 if _THREAD_SAFE preprocessor symbol must be defined. */ +/* #undef NEED_THREAD_SAFE */ + +/* cpu-machine-OS */ +#ifdef __WINS__ +#define OS "i386-pc-epoc32" +#elif __MARM__ +#define OS "arm-unknown-epoc32" +#else +/* This won't happen on any current Symbian version */ +#define OS "unknown-unknown-epoc32" +#endif + +/* Name of package */ +/*#define PACKAGE "curl"*/ + +/* Define to the address where bug reports for this package should be sent. */ +/*#define PACKAGE_BUGREPORT "a suitable curl mailing list => http://curl.haxx.se/mail/"*/ + +/* Define to the full name of this package. */ +/*#define PACKAGE_NAME "curl"*/ + +/* Define to the full name and version of this package. */ +/*#define PACKAGE_STRING "curl -"*/ + +/* Define to the one symbol short name of this package. */ +/*#define PACKAGE_TARNAME "curl"*/ + +/* Define to the version of this package. */ +/*#define PACKAGE_VERSION "-"*/ + +/* a suitable file to read random data from */ +/*#define RANDOM_FILE "/dev/urandom"*/ + +#define RECV_TYPE_ARG1 int +#define RECV_TYPE_ARG2 void* +#define RECV_TYPE_ARG3 size_t +#define RECV_TYPE_ARG4 int +#define RECV_TYPE_RETV ssize_t + +#define RECVFROM_TYPE_ARG1 int +#define RECVFROM_TYPE_ARG2 void +#define RECVFROM_TYPE_ARG3 size_t +#define RECVFROM_TYPE_ARG4 int +#define RECVFROM_TYPE_ARG5 struct sockaddr +#define RECVFROM_TYPE_ARG6 size_t +#define RECVFROM_TYPE_RETV ssize_t +#define RECVFROM_TYPE_ARG2_IS_VOID 1 + +#define SEND_TYPE_ARG1 int +#define SEND_QUAL_ARG2 const +#define SEND_TYPE_ARG2 void* +#define SEND_TYPE_ARG3 size_t +#define SEND_TYPE_ARG4 int +#define SEND_TYPE_RETV ssize_t + + +/* Define as the return type of signal handlers (`int' or `void'). */ +/*#define RETSIGTYPE void*/ + +/* Define to the type of arg 1 for `select'. */ +#define SELECT_TYPE_ARG1 int + +/* Define to the type of args 2, 3 and 4 for `select'. */ +#define SELECT_TYPE_ARG234 (fd_set *) + +/* Define to the type of arg 5 for `select'. */ +#define SELECT_TYPE_ARG5 (struct timeval *) + +/* The size of `int', as computed by sizeof. */ +#define SIZEOF_INT 4 + +/* The size of `off_t', as computed by sizeof. */ +#define SIZEOF_OFF_T 8 + +/* The size of `short', as computed by sizeof. */ +#define SIZEOF_SHORT 2 + +/* The size of `size_t', as computed by sizeof. */ +#define SIZEOF_SIZE_T 4 + +/* The size of `time_t', as computed by sizeof. */ +#define SIZEOF_TIME_T 4 + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ +#define TIME_WITH_SYS_TIME 1 + +/* Define if you want to enable c-ares support */ +/* #undef USE_ARES */ + +/* Define to disable non-blocking sockets */ +/* #undef USE_BLOCKING_SOCKETS */ + +/* if GnuTLS is enabled */ +/* #undef USE_GNUTLS */ + +/* if libSSH2 is in use */ +/*#define USE_LIBSSH2 1*/ + +/* If you want to build curl with the built-in manual */ +/*#define USE_MANUAL 1*/ + +/* if NSS is enabled */ +/* #undef USE_NSS */ + +/* to enable SSPI support */ +/* #undef USE_WINDOWS_SSPI */ + +/* Define to 1 if using yaSSL in OpenSSL compatibility mode. */ +/* #undef USE_YASSLEMUL */ + +/* Version number of package */ +/*#define VERSION "7.18.2-CVS"*/ + +/* Define to avoid automatic inclusion of winsock.h */ +/* #undef WIN32_LEAN_AND_MEAN */ + +/* Define to 1 if on AIX 3. + System headers sometimes define this. + We just want to avoid a redefinition error message. */ +#ifndef _ALL_SOURCE +/* # undef _ALL_SOURCE */ +#endif + +/* Number of bits in a file offset, on hosts where this is settable. */ +#define _FILE_OFFSET_BITS 64 + +/* Define for large files, on AIX-style hosts. */ +/* #undef _LARGE_FILES */ + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* type to use in place of in_addr_t if not defined */ +/* #undef in_addr_t */ + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +/* #undef inline */ +#endif + +/* Define to `unsigned int' if <sys/types.h> does not define. */ +/* #undef size_t */ + +/* the signed version of size_t */ +/* #undef ssize_t */ + +/* Enabling curl debug mode when building in Symbian debug mode would work */ +/* except that debug mode introduces new exports that must be frozen. */ +#ifdef _DEBUG +/* #define CURLDEBUG */ +#endif + +/* sys/cdefs.h fails to define this for WINSCW prior to Symbian OS ver. 9.4 */ +#ifndef __LONG_LONG_SUPPORTED +#define __LONG_LONG_SUPPORTED +#endif + +/* Enable appropriate header only when zlib support is enabled */ +#ifdef HAVE_LIBZ +#define HAVE_ZLIB_H 1 +#endif + +/* Enable appropriate definitions only when OpenSSL support is enabled */ +#ifdef USE_SSLEAY +/* if OpenSSL is in use */ +#define USE_OPENSSL +#endif diff --git a/lib/config-tpf.h b/lib/config-tpf.h new file mode 100644 index 00000000..3e494f7c --- /dev/null +++ b/lib/config-tpf.h @@ -0,0 +1,761 @@ +#ifndef __LIBCONFIGTPF_H +#define __LIBCONFIGTPF_H + +/* ================================================================ */ +/* lib/config-tpf.h - Hand crafted config file for TPF */ +/* ================================================================ */ + +/* ---------------------------------------------------------------- */ +/* FEATURES, FUNCTIONS, and DEFINITIONS */ +/* ---------------------------------------------------------------- */ + +/* NOTE: Refer also to the .mak file for some of the flags below */ + +/* when building libcurl itself */ +/* #undef BUILDING_LIBCURL */ + +/* to disable cookies support */ +/* #undef CURL_DISABLE_COOKIES */ + +/* to disable cryptographic authentication */ +/* #undef CURL_DISABLE_CRYPTO_AUTH */ + +/* to disable DICT */ +/* #undef CURL_DISABLE_DICT */ + +/* to disable FILE */ +/* #undef CURL_DISABLE_FILE */ + +/* to disable FTP */ +/* #undef CURL_DISABLE_FTP */ + +/* to disable HTTP */ +/* #undef CURL_DISABLE_HTTP */ + +/* to disable LDAP */ +/* #undef CURL_DISABLE_LDAP */ + +/* to disable TELNET */ +/* #undef CURL_DISABLE_TELNET */ + +/* to disable TFTP */ +/* #undef CURL_DISABLE_TFTP */ + +/* to disable verbose strings */ +/* #undef CURL_DISABLE_VERBOSE_STRINGS */ + +/* when not building a shared library */ +/* #undef CURL_STATICLIB */ + +/* lber dynamic library file */ +/* #undef DL_LBER_FILE */ + +/* ldap dynamic library file */ +/* #undef DL_LDAP_FILE */ + +/* your Entropy Gathering Daemon socket pathname */ +/* #undef EGD_SOCKET */ + +/* Define if you want to enable IPv6 support */ +/* #undef ENABLE_IPV6 */ + +/* Define if struct sockaddr_in6 has the sin6_scope_id member */ +/* #undef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID */ + +/* Define to the type of arg 1 for getnameinfo. */ +/* #undef GETNAMEINFO_TYPE_ARG1 */ + +/* Define to the type of arg 2 for getnameinfo. */ +/* #undef GETNAMEINFO_TYPE_ARG2 */ + +/* Define to the type of args 4 and 6 for getnameinfo. */ +/* #undef GETNAMEINFO_TYPE_ARG46 */ + +/* Define to the type of arg 7 for getnameinfo. */ +/* #undef GETNAMEINFO_TYPE_ARG7 */ + +/* Define to 1 if you have the alarm function. */ +#define HAVE_ALARM 1 + +/* Define to 1 if you have the <arpa/inet.h> header file. */ +#define HAVE_ARPA_INET_H 1 + +/* Define to 1 if you have the <arpa/tftp.h> header file. */ +/* #undef HAVE_ARPA_TFTP_H */ + +/* Define to 1 if you have the <assert.h> header file. */ +#define HAVE_ASSERT_H 1 + +/* Define to 1 if you have the `basename' function. */ +#define HAVE_BASENAME 1 + +/* Define to 1 if you have the `closesocket' function. */ +/* #undef HAVE_CLOSESOCKET */ + +/* Define to 1 if you have the `CRYPTO_cleanup_all_ex_data' function. */ +/* #undef HAVE_CRYPTO_CLEANUP_ALL_EX_DATA */ +#define HAVE_CRYPTO_CLEANUP_ALL_EX_DATA 1 + +/* Define to 1 if you have the <crypto.h> header file. */ +/* #undef HAVE_CRYPTO_H */ +#define HAVE_CRYPTO_H 1 + +/* Define to 1 if you have the <des.h> header file. */ +/* #undef HAVE_DES_H */ +#define HAVE_DES_H 1 + +/* Define to 1 if you have the `ENGINE_load_builtin_engines' function. */ +/* #undef HAVE_ENGINE_LOAD_BUILTIN_ENGINES */ +#define HAVE_ENGINE_LOAD_BUILTIN_ENGINES 1 + +/* Define to 1 if you have the <errno.h> header file. */ +#define HAVE_ERRNO_H 1 + +/* Define to 1 if you have the <err.h> header file. */ +/* #undef HAVE_ERR_H */ +#define HAVE_ERR_H 1 + +/* Define to 1 if you have the <fcntl.h> header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if you have the fcntl function. */ +#define HAVE_FCNTL 1 + +/* Define to 1 if you have a working fcntl O_NONBLOCK function. */ +#define HAVE_FCNTL_O_NONBLOCK 1 + +/* Define to 1 if you have the `fork' function. */ +/* #undef HAVE_FORK */ +#define HAVE_FORK 1 + +/* Define to 1 if you have the `ftruncate' function. */ +#define HAVE_FTRUNCATE 1 + +/* Define if getaddrinfo exists and works */ +/* #undef HAVE_GETADDRINFO */ + +/* Define to 1 if you have the `geteuid' function. */ +#define HAVE_GETEUID 1 + +/* Define to 1 if you have the `gethostbyaddr' function. */ +#define HAVE_GETHOSTBYADDR 1 + +/* If you have gethostbyname */ +#define HAVE_GETHOSTBYNAME 1 + +/* Define to 1 if you have the `gethostbyname_r' function. */ +/* #undef HAVE_GETHOSTBYNAME_R */ + +/* gethostbyname_r() takes 3 args */ +/* #undef HAVE_GETHOSTBYNAME_R_3 */ + +/* gethostbyname_r() takes 5 args */ +/* #undef HAVE_GETHOSTBYNAME_R_5 */ + +/* gethostbyname_r() takes 6 args */ +/* #undef HAVE_GETHOSTBYNAME_R_6 1 */ + +/* Define to 1 if you have the getnameinfo function. */ +/* #undef HAVE_GETNAMEINFO */ + +/* Define to 1 if you have the `getpass_r' function. */ +/* #undef HAVE_GETPASS_R */ + +/* Define to 1 if you have the `getprotobyname' function. */ +/* #undef HAVE_GETPROTOBYNAME */ + +/* Define to 1 if you have the `getpwuid' function. */ +#define HAVE_GETPWUID 1 + +/* Define to 1 if you have the `getrlimit' function. */ +/* #undef HAVE_GETRLIMIT */ + +/* Define to 1 if you have the `gettimeofday' function. */ +#define HAVE_GETTIMEOFDAY 1 + +/* we have a glibc-style strerror_r() */ +/* #undef HAVE_GLIBC_STRERROR_R */ +#define HAVE_GLIBC_STRERROR_R 1 + +/* Define to 1 if you have the `gmtime_r' function. */ +#define HAVE_GMTIME_R 1 + +/* if you have the gssapi libraries */ +/* #undef HAVE_GSSAPI */ + +/* if you have the GNU gssapi libraries */ +/* #undef HAVE_GSSGNU */ + +/* if you have the Heimdal gssapi libraries */ +/* #undef HAVE_GSSHEIMDAL */ + +/* if you have the MIT gssapi libraries */ +/* #undef HAVE_GSSMIT */ + +/* Define to 1 if you have the `iconv' functions. */ +#define HAVE_ICONV 1 + +/* Define to 1 if you have the `idna_strerror' function. */ +/* #undef HAVE_IDNA_STRERROR */ + +/* Define to 1 if you have the `idn_free' function. */ +/* #undef HAVE_IDN_FREE */ + +/* Define to 1 if you have the <idn-free.h> header file. */ +/* #undef HAVE_IDN_FREE_H */ + +/* Define to 1 if you have the `inet_addr' function. */ +#define HAVE_INET_ADDR 1 + +/* Define to 1 if you have a IPv6 capable working inet_ntop function. */ +/* #undef HAVE_INET_NTOP */ + +/* Define to 1 if you have a IPv6 capable working inet_pton function. */ +/* #undef HAVE_INET_PTON */ + +/* Define to 1 if you have the <inttypes.h> header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the ioctl function. */ +#define HAVE_IOCTL 1 + +/* Define to 1 if you have a working ioctl FIONBIO function. */ +#define HAVE_IOCTL_FIONBIO 1 + +/* Define to 1 if you have the ioctlsocket function. */ +/* #undef HAVE_IOCTLSOCKET */ + +/* Define to 1 if you have a working ioctlsocket FIONBIO function. */ +/* #undef HAVE_IOCTLSOCKET_FIONBIO */ + +/* Define to 1 if you have the IoctlSocket camel case function. */ +/* #undef HAVE_IOCTLSOCKET_CAMEL */ + +/* Define to 1 if you have a working IoctlSocket camel case FIONBIO function. */ +/* #undef HAVE_IOCTLSOCKET_CAMEL_FIONBIO */ + +/* Define to 1 if you have the <io.h> header file. */ +/* #undef HAVE_IO_H */ + +/* if you have the Kerberos4 libraries (including -ldes) */ +/* #undef HAVE_KRB4 */ + +/* Define to 1 if you have the `krb_get_our_ip_for_realm' function. */ +/* #undef HAVE_KRB_GET_OUR_IP_FOR_REALM */ + +/* Define to 1 if you have the <krb.h> header file. */ +/* #undef HAVE_KRB_H */ + +/* Define to 1 if you have the <libgen.h> header file. */ +/* #undef HAVE_LIBGEN_H 1 */ + +/* Define to 1 if you have the `idn' library (-lidn). */ +/* #undef HAVE_LIBIDN */ + +/* Define to 1 if you have the `resolv' library (-lresolv). */ +/* #undef HAVE_LIBRESOLV */ + +/* Define to 1 if you have the `resolve' library (-lresolve). */ +/* #undef HAVE_LIBRESOLVE */ + +/* Define to 1 if you have the `socket' library (-lsocket). */ +/* #undef HAVE_LIBSOCKET */ + +/* Define to 1 if you have the `ssl' library (-lssl). */ +/* #undef HAVE_LIBSSL */ +#define HAVE_LIBSSL 1 + +/* if zlib is available */ +/* #undef HAVE_LIBZ */ + +/* Define to 1 if you have the <limits.h> header file. */ +#define HAVE_LIMITS_H 1 + +/* if your compiler supports LL */ +#define HAVE_LL 1 + +/* Define to 1 if you have the <locale.h> header file. */ +#define HAVE_LOCALE_H 1 + +/* Define to 1 if you have the `localtime_r' function. */ +#define HAVE_LOCALTIME_R 1 + +/* Define to 1 if the compiler supports the 'long long' data type. */ +#define HAVE_LONGLONG 1 + +/* Define to 1 if you need the malloc.h header file even with stdlib.h */ +/* #undef NEED_MALLOC_H */ + +/* Define to 1 if you have the <memory.h> header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the <netdb.h> header file. */ +#define HAVE_NETDB_H 1 + +/* Define to 1 if you have the <netinet/in.h> header file. */ +#define HAVE_NETINET_IN_H 1 + +/* Define to 1 if you have the <netinet/tcp.h> header file. */ +/* undef HAVE_NETINET_TCP_H */ + +/* Define to 1 if you have the <net/if.h> header file. */ +#define HAVE_NET_IF_H 1 + +/* Define if NI_WITHSCOPEID exists and works */ +/* #undef HAVE_NI_WITHSCOPEID */ + +/* we have no strerror_r() proto */ +/* #undef HAVE_NO_STRERROR_R_DECL */ + +/* Define to 1 if you have the <openssl/crypto.h> header file. */ +/* #undef HAVE_OPENSSL_CRYPTO_H */ +#define HAVE_OPENSSL_CRYPTO_H 1 + +/* Define to 1 if you have the <openssl/engine.h> header file. */ +/* #undef HAVE_OPENSSL_ENGINE_H */ +#define HAVE_OPENSSL_ENGINE_H 1 + +/* Define to 1 if you have the <openssl/err.h> header file. */ +/* #undef HAVE_OPENSSL_ERR_H */ +#define HAVE_OPENSSL_ERR_H 1 + +/* Define to 1 if you have the <openssl/pem.h> header file. */ +/* #undef HAVE_OPENSSL_PEM_H */ +#define HAVE_OPENSSL_PEM_H 1 + +/* Define to 1 if you have the <openssl/pkcs12.h> header file. */ +/* #undef HAVE_OPENSSL_PKCS12_H */ +#define HAVE_OPENSSL_PKCS12_H 1 + +/* Define to 1 if you have the <openssl/rsa.h> header file. */ +/* #undef HAVE_OPENSSL_RSA_H */ +#define HAVE_OPENSSL_RSA_H 1 + +/* Define to 1 if you have the <openssl/ssl.h> header file. */ +/* #undef HAVE_OPENSSL_SSL_H */ +#define HAVE_OPENSSL_SSL_H 1 + +/* Define to 1 if you have the <openssl/x509.h> header file. */ +/* #undef HAVE_OPENSSL_X509_H */ +#define HAVE_OPENSSL_X509_H 1 + +/* Define to 1 if you have the <pem.h> header file. */ +/* #undef HAVE_PEM_H */ +#define HAVE_PEM_H 1 + +/* Define to 1 if you have the `perror' function. */ +#define HAVE_PERROR 1 + +/* Define to 1 if you have the `pipe' function. */ +#define HAVE_PIPE 1 + +/* Define to 1 if you have the `poll' function. */ +/* #undef HAVE_POLL */ + +/* If you have a fine poll */ +/* #undef HAVE_POLL_FINE */ + +/* we have a POSIX-style strerror_r() */ +/* #undef HAVE_POSIX_STRERROR_R */ + +/* Define to 1 if you have the <pwd.h> header file. */ +#define HAVE_PWD_H 1 + +/* Define to 1 if you have the `RAND_egd' function. */ +/* #undef HAVE_RAND_EGD */ +#define HAVE_RAND_EGD 1 + +/* Define to 1 if you have the `RAND_screen' function. */ +/* #undef HAVE_RAND_SCREEN */ + +/* Define to 1 if you have the `RAND_status' function. */ +/* #undef HAVE_RAND_STATUS */ +#define HAVE_RAND_STATUS 1 + +/* Define to 1 if you have the <rsa.h> header file. */ +/* #undef HAVE_RSA_H */ +#define HAVE_RSA_H 1 + +/* Define to 1 if you have the `select' function. */ +#define HAVE_SELECT 1 + +/* Define to 1 if you have the <setjmp.h> header file. */ +#define HAVE_SETJMP_H 1 + +/* Define to 1 if you have the `setlocale' function. */ +#define HAVE_SETLOCALE 1 + +/* Define to 1 if you have the `setrlimit' function. */ +#define HAVE_SETRLIMIT 1 + +/* Define to 1 if you have the setsockopt function. */ +/* #undef HAVE_SETSOCKOPT */ + +/* Define to 1 if you have a working setsockopt SO_NONBLOCK function. */ +/* #undef HAVE_SETSOCKOPT_SO_NONBLOCK */ + +/* Define to 1 if you have the <sgtty.h> header file. */ +/* #undef HAVE_SGTTY_H 1 */ + +/* Define to 1 if you have the `sigaction' function. */ +#define HAVE_SIGACTION 1 + +/* Define to 1 if you have the `siginterrupt' function. */ +/* #undef HAVE_SIGINTERRUPT */ + +/* Define to 1 if you have the `signal' function. */ +#define HAVE_SIGNAL 1 + +/* Define to 1 if you have the <signal.h> header file. */ +#define HAVE_SIGNAL_H 1 + +/* Define to 1 if sig_atomic_t is an available typedef. */ +#define HAVE_SIG_ATOMIC_T 1 + +/* Define to 1 if sig_atomic_t is already defined as volatile. */ +/* #undef HAVE_SIG_ATOMIC_T_VOLATILE */ + +/* If you have sigsetjmp */ +/* #undef HAVE_SIGSETJMP */ + +/* Define to 1 if you have the `socket' function. */ +#define HAVE_SOCKET 1 + +/* Define this if you have the SPNEGO library fbopenssl */ +/* #undef HAVE_SPNEGO */ + +/* Define to 1 if you have the <ssl.h> header file. */ +/* #undef HAVE_SSL_H */ +#define HAVE_SSL_H 1 + +/* Define to 1 if you have the <stdint.h> header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the <stdlib.h> header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `strcasecmp' function. */ +#define HAVE_STRCASECMP 1 + +/* Define to 1 if you have the `strcmpi' function. */ +/* #undef HAVE_STRCMPI */ + +/* Define to 1 if you have the `strdup' function. */ +#define HAVE_STRDUP 1 + +/* Define to 1 if you have the `strerror_r' function. */ +#define HAVE_STRERROR_R 1 + +/* Define to 1 if you have the `stricmp' function. */ +/* #undef HAVE_STRICMP */ +#define HAVE_STRICMP 1 + +/* Define to 1 if you have the <strings.h> header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the <string.h> header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strlcat' function. */ +/* #undef HAVE_STRLCAT */ + +/* Define to 1 if you have the `strlcpy' function. */ +/* #undef HAVE_STRLCPY */ + +/* Define to 1 if you have the `strstr' function. */ +#define HAVE_STRSTR 1 + +/* Define to 1 if you have the `strtok_r' function. */ +#define HAVE_STRTOK_R 1 + +/* Define to 1 if you have the `strtoll' function. */ +#define HAVE_STRTOLL 1 + +/* if struct sockaddr_storage is defined */ +/* #undef HAVE_STRUCT_SOCKADDR_STORAGE */ + +/* Define this if you have struct timeval */ +#define HAVE_STRUCT_TIMEVAL 1 + +/* Define to 1 if you have the <sys/filio.h> header file. */ +#define HAVE_SYS_FILIO_H 1 + +/* Define to 1 if you have the <sys/ioctl.h> header file. */ +#define HAVE_SYS_IOCTL_H 1 + +/* Define to 1 if you have the <sys/param.h> header file. */ +#define HAVE_SYS_PARAM_H 1 + +/* Define to 1 if you have the <sys/poll.h> header file. */ +/* #undef HAVE_SYS_POLL_H */ + +/* Define to 1 if you have the <sys/resource.h> header file. */ +#define HAVE_SYS_RESOURCE_H 1 + +/* Define to 1 if you have the <sys/select.h> header file. */ +#define HAVE_SYS_SELECT_H 1 + +/* Define to 1 if you have the <sys/socket.h> header file. */ +#define HAVE_SYS_SOCKET_H 1 + +/* Define to 1 if you have the <sys/sockio.h> header file. */ +/* #undef HAVE_SYS_SOCKIO_H */ +#define HAVE_SYS_SOCKIO_H 1 + +/* Define to 1 if you have the <sys/stat.h> header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the <sys/time.h> header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the <sys/types.h> header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the <sys/utime.h> header file. */ +/* #undef HAVE_SYS_UTIME_H */ + +/* Define to 1 if you have the <termios.h> header file. */ +/* #undef HAVE_TERMIOS_H */ + +/* Define to 1 if you have the <termio.h> header file. */ +/* #undef HAVE_TERMIO_H */ + +/* Define to 1 if you have the <time.h> header file. */ +#define HAVE_TIME_H 1 + +/* Define to 1 if you have the <tld.h> header file. */ +/* #undef HAVE_TLD_H */ + +/* Define to 1 if you have the `tld_strerror' function. */ +/* #undef HAVE_TLD_STRERROR */ + +/* Define to 1 if you have the <unistd.h> header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the `utime' function. */ +#define HAVE_UTIME 1 + +/* Define to 1 if you have the <utime.h> header file. */ +#define HAVE_UTIME_H 1 + +/* Define to 1 if you have the <winsock2.h> header file. */ +/* #undef HAVE_WINSOCK2_H */ + +/* Define to 1 if you have the <winsock.h> header file. */ +/* #undef HAVE_WINSOCK_H */ + +/* Define this symbol if your OS supports changing the contents of argv */ +/* #undef HAVE_WRITABLE_ARGV */ + +/* Define to 1 if you have the ws2tcpip.h header file. */ +/* #undef HAVE_WS2TCPIP_H */ + +/* Define to 1 if you have the <x509.h> header file. */ +/* #undef HAVE_X509_H */ + +/* if you have the zlib.h header file */ +/* #undef HAVE_ZLIB_H */ + +/* Define to 1 if _REENTRANT preprocessor symbol must be defined. */ +/* #undef NEED_REENTRANT */ + +/* Define to 1 if _THREAD_SAFE preprocessor symbol must be defined. */ +/* #undef NEED_THREAD_SAFE */ + +/* cpu-machine-OS */ +#define OS "s390x-ibm-tpf" + +/* Name of package */ +#define PACKAGE "curl" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "a suitable curl mailing list => http://curl.haxx.se/mail/" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "curl" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "curl -" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "curl" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "-" + +/* a suitable file to read random data from */ +/* #undef RANDOM_FILE */ + +/* Define as the return type of signal handlers (`int' or `void'). */ +#define RETSIGTYPE void + +/* Define to the type of arg 1 for `select'. */ +#define SELECT_TYPE_ARG1 int + +/* Define to the type of args 2, 3 and 4 for `select'. */ +#define SELECT_TYPE_ARG234 (fd_set *) + +/* Define to the type of arg 5 for `select'. */ +#define SELECT_TYPE_ARG5 (struct timeval *) + +/* The size of `int', as computed by sizeof. */ +#define SIZEOF_INT 4 + +/* The size of `off_t', as computed by sizeof. */ +#define SIZEOF_OFF_T 8 + +/* The size of `short', as computed by sizeof. */ +#define SIZEOF_SHORT 2 + +/* The size of `size_t', as computed by sizeof. */ +#define SIZEOF_SIZE_T 8 + +/* The size of `time_t', as computed by sizeof. */ +#define SIZEOF_TIME_T 8 + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ +#define TIME_WITH_SYS_TIME 1 + +/* Define if you want to enable ares support */ +/* #undef USE_ARES */ + +/* Define to disable non-blocking sockets */ +/* #undef USE_BLOCKING_SOCKETS */ + +/* if GnuTLS is enabled */ +/* #undef USE_GNUTLS */ + +/* If you want to build curl with the built-in manual */ +/* #undef USE_MANUAL */ + +/* if OpenSSL is in use */ +/* #undef USE_OPENSSL */ + +/* if SSL is enabled */ +/* #undef USE_SSLEAY */ + +/* to enable SSPI support */ +/* #undef USE_WINDOWS_SSPI */ + +/* Version number of package */ +#define VERSION "not-used" + +/* Define to avoid automatic inclusion of winsock.h */ +/* #undef WIN32_LEAN_AND_MEAN */ + +/* Define to 1 if on AIX 3. + System headers sometimes define this. + We just want to avoid a redefinition error message. */ +#ifndef _ALL_SOURCE +/* # undef _ALL_SOURCE */ +#endif + +/* Number of bits in a file offset, on hosts where this is settable. */ +/* #undef _FILE_OFFSET_BITS */ + +/* Define for large files, on AIX-style hosts. */ +/* #undef _LARGE_FILES */ + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* type to use in place of in_addr_t if not defined */ +/* #undef in_addr_t */ + +/* Define to `unsigned' if <sys/types.h> does not define. */ +/* #undef size_t */ + +/* the signed version of size_t */ +/* #undef ssize_t */ + +/* Define to 1 if you have the getnameinfo function. */ +/* #undef HAVE_GETNAMEINFO 1 */ + +/* Define to the type qualifier of arg 1 for getnameinfo. */ +/* #undef GETNAMEINFO_QUAL_ARG1 const */ + +/* Define to the type of arg 1 for getnameinfo. */ +/* #undef GETNAMEINFO_TYPE_ARG1 struct sockaddr * */ + +/* Define to the type of arg 2 for getnameinfo. */ +/* #undef GETNAMEINFO_TYPE_ARG2 socklen_t */ + +/* Define to the type of args 4 and 6 for getnameinfo. */ +/* #undef GETNAMEINFO_TYPE_ARG46 size_t */ + +/* Define to the type of arg 7 for getnameinfo. */ +/* #undef GETNAMEINFO_TYPE_ARG7 int */ + +/* Define to 1 if you have the recv function. */ +#define HAVE_RECV 1 + +/* Define to the type of arg 1 for recv. */ +#define RECV_TYPE_ARG1 int + +/* Define to the type of arg 2 for recv. */ +#define RECV_TYPE_ARG2 char * + +/* Define to the type of arg 3 for recv. */ +#define RECV_TYPE_ARG3 int + +/* Define to the type of arg 4 for recv. */ +#define RECV_TYPE_ARG4 int + +/* Define to the function return type for recv. */ +#define RECV_TYPE_RETV int + +/* Define to 1 if you have the recvfrom function. */ +#define HAVE_RECVFROM 1 + +/* Define to the type of arg 1 for recvfrom. */ +#define RECVFROM_TYPE_ARG1 int + +/* Define to the type pointed by arg 2 for recvfrom. */ +#define RECVFROM_TYPE_ARG2 char + +/* Define to the type of arg 3 for recvfrom. */ +#define RECVFROM_TYPE_ARG3 int + +/* Define to the type of arg 4 for recvfrom. */ +#define RECVFROM_TYPE_ARG4 int + +/* Define to the type pointed by arg 5 for recvfrom. */ +#define RECVFROM_TYPE_ARG5 struct sockaddr + +/* Define to the type pointed by arg 6 for recvfrom. */ +#define RECVFROM_TYPE_ARG6 int + +/* Define to the function return type for recvfrom. */ +#define RECVFROM_TYPE_RETV int + +/* Define to 1 if you have the send function. */ +#define HAVE_SEND 1 + +/* Define to the type of arg 1 for send. */ +#define SEND_TYPE_ARG1 int + +/* Define to the type qualifier of arg 2 for send. */ +#define SEND_QUAL_ARG2 const + +/* Define to the type of arg 2 for send. */ +#define SEND_TYPE_ARG2 char * + +/* Define to the type of arg 3 for send. */ +#define SEND_TYPE_ARG3 int + +/* Define to the type of arg 4 for send. */ +#define SEND_TYPE_ARG4 int + +/* Define to the function return type for send. */ +#define SEND_TYPE_RETV int + +#define CURL_DOES_CONVERSIONS +#ifndef CURL_ICONV_CODESET_OF_HOST +#define CURL_ICONV_CODESET_OF_HOST "IBM-1047" +#endif + + +#endif /* __LIBCONFIGTPF_H */ diff --git a/lib/curl_config.h b/lib/config-vxworks.h index 0a0e6260..f7797fd0 100644 --- a/lib/curl_config.h +++ b/lib/config-vxworks.h @@ -1,11 +1,15 @@ -/* lib/curl_config.h. Generated from curl_config.h.in by configure. */ -/* lib/curl_config.h.in. Generated from configure.ac by autoheader. */ +#ifndef __LIB_CONFIG_VXWORKS_H +#define __LIB_CONFIG_VXWORKS_H + +/* =============================================================== */ +/* lib/config-vxworks.h - Hand crafted config file for VxWorks */ +/* =============================================================== */ /* when building libcurl itself */ /* #undef BUILDING_LIBCURL */ /* Location of default ca bundle */ -#define CURL_CA_BUNDLE "/etc/ssl/certs/ca-certificates.crt" +/* #undef CURL_CA_BUNDLE */ /* Location of default ca path */ /* #undef CURL_CA_PATH */ @@ -23,37 +27,28 @@ /* #undef CURL_DISABLE_FILE */ /* to disable FTP */ -/* #undef CURL_DISABLE_FTP */ +#define CURL_DISABLE_FTP 1 /* to disable HTTP */ /* #undef CURL_DISABLE_HTTP */ -/* to disable IMAP */ -/* #undef CURL_DISABLE_IMAP */ - /* to disable LDAP */ #define CURL_DISABLE_LDAP 1 /* to disable LDAPS */ #define CURL_DISABLE_LDAPS 1 -/* to disable POP3 */ -/* #undef CURL_DISABLE_POP3 */ +/* to disable NTLM authentication */ +#define CURL_DISABLE_NTLM 1 /* to disable proxies */ /* #undef CURL_DISABLE_PROXY */ -/* to disable RTSP */ -/* #undef CURL_DISABLE_RTSP */ - -/* to disable SMTP */ -/* #undef CURL_DISABLE_SMTP */ - /* to disable TELNET */ -/* #undef CURL_DISABLE_TELNET */ +#define CURL_DISABLE_TELNET 1 /* to disable TFTP */ -/* #undef CURL_DISABLE_TFTP */ +#define CURL_DISABLE_TFTP 1 /* to disable verbose strings */ /* #undef CURL_DISABLE_VERBOSE_STRINGS */ @@ -64,10 +59,7 @@ /* to enable hidden symbols */ /* #undef CURL_HIDDEN_SYMBOLS */ -/* W$ LDAP with non-W$ compiler */ -/* #undef CURL_LDAP_HYBRID */ - -/* Use W$ LDAP implementation */ +/* Use Windows LDAP implementation */ /* #undef CURL_LDAP_WIN */ /* when not building a shared library */ @@ -89,7 +81,7 @@ #define GETNAMEINFO_TYPE_ARG2 socklen_t /* Define to the type of args 4 and 6 for getnameinfo. */ -#define GETNAMEINFO_TYPE_ARG46 socklen_t +#define GETNAMEINFO_TYPE_ARG46 size_t /* Define to the type of arg 7 for getnameinfo. */ #define GETNAMEINFO_TYPE_ARG7 unsigned int @@ -110,29 +102,23 @@ #define HAVE_ARPA_INET_H 1 /* Define to 1 if you have the <arpa/tftp.h> header file. */ -#define HAVE_ARPA_TFTP_H 1 +/* #undef HAVE_ARPA_TFTP_H */ /* Define to 1 if you have the <assert.h> header file. */ #define HAVE_ASSERT_H 1 -/* Define to 1 if you have the basename function. */ -#define HAVE_BASENAME 1 +/* Define to 1 if you have the `basename' function. */ +/* #undef HAVE_BASENAME */ /* Define to 1 if bool is an available type. */ #define HAVE_BOOL_T 1 /* Define to 1 if you have the clock_gettime function and monotonic timer. */ -#define HAVE_CLOCK_GETTIME_MONOTONIC 1 +/* #undef HAVE_CLOCK_GETTIME_MONOTONIC */ -/* Define to 1 if you have the closesocket function. */ +/* Define to 1 if you have the `closesocket' function. */ /* #undef HAVE_CLOSESOCKET */ -/* Define to 1 if you have the CloseSocket camel case function. */ -/* #undef HAVE_CLOSESOCKET_CAMEL */ - -/* Define to 1 if you have the connect function. */ -#define HAVE_CONNECT 1 - /* Define to 1 if you have the `CRYPTO_cleanup_all_ex_data' function. */ #define HAVE_CRYPTO_CLEANUP_ALL_EX_DATA 1 @@ -145,11 +131,8 @@ /* Define to 1 if you have the <dlfcn.h> header file. */ #define HAVE_DLFCN_H 1 -/* Define to 1 if you have the `ENGINE_cleanup' function. */ -//#define HAVE_ENGINE_CLEANUP 1 - /* Define to 1 if you have the `ENGINE_load_builtin_engines' function. */ -//#define HAVE_ENGINE_LOAD_BUILTIN_ENGINES 1 +#define HAVE_ENGINE_LOAD_BUILTIN_ENGINES 1 /* Define to 1 if you have the <errno.h> header file. */ #define HAVE_ERRNO_H 1 @@ -176,8 +159,7 @@ #define HAVE_FREEADDRINFO 1 /* Define to 1 if you have the freeifaddrs function. */ -// not in bionic -//#define HAVE_FREEIFADDRS 1 +#define HAVE_FREEIFADDRS 1 /* Define to 1 if you have the ftruncate function. */ #define HAVE_FTRUNCATE 1 @@ -185,11 +167,8 @@ /* Define to 1 if you have a working getaddrinfo function. */ #define HAVE_GETADDRINFO 1 -/* Define to 1 if the getaddrinfo function is threadsafe. */ -#define HAVE_GETADDRINFO_THREADSAFE 1 - /* Define to 1 if you have the `geteuid' function. */ -#define HAVE_GETEUID 1 +/* #undef HAVE_GETEUID */ /* Define to 1 if you have the gethostbyaddr function. */ #define HAVE_GETHOSTBYADDR 1 @@ -210,7 +189,7 @@ #define HAVE_GETHOSTBYNAME 1 /* Define to 1 if you have the gethostbyname_r function. */ -#define HAVE_GETHOSTBYNAME_R 1 +/* #undef HAVE_GETHOSTBYNAME_R */ /* gethostbyname_r() takes 3 args */ /* #undef HAVE_GETHOSTBYNAME_R_3 */ @@ -219,14 +198,13 @@ /* #undef HAVE_GETHOSTBYNAME_R_5 */ /* gethostbyname_r() takes 6 args */ -#define HAVE_GETHOSTBYNAME_R_6 1 +/* #undef HAVE_GETHOSTBYNAME_R_6 */ /* Define to 1 if you have the gethostname function. */ #define HAVE_GETHOSTNAME 1 /* Define to 1 if you have a working getifaddrs function. */ -// not in bionic -//#define HAVE_GETIFADDRS 1 +/* #undef HAVE_GETIFADDRS */ /* Define to 1 if you have the getnameinfo function. */ #define HAVE_GETNAMEINFO 1 @@ -241,16 +219,16 @@ #define HAVE_GETPROTOBYNAME 1 /* Define to 1 if you have the `getpwuid' function. */ -#define HAVE_GETPWUID 1 +/* #undef HAVE_GETPWUID */ /* Define to 1 if you have the `getrlimit' function. */ #define HAVE_GETRLIMIT 1 /* Define to 1 if you have the getservbyport_r function. */ -#define HAVE_GETSERVBYPORT_R 1 +/* #undef HAVE_GETSERVBYPORT_R */ /* Define to 1 if you have the `gettimeofday' function. */ -#define HAVE_GETTIMEOFDAY 1 +/* #undef HAVE_GETTIMEOFDAY */ /* Define to 1 if you have a working glibc-style strerror_r function. */ /* #undef HAVE_GLIBC_STRERROR_R */ @@ -289,8 +267,7 @@ /* #undef HAVE_IDN_FREE_H */ /* Define to 1 if you have the <ifaddrs.h> header file. */ -// not in bionic -// #define HAVE_IFADDRS_H 1 +/* #undef HAVE_IFADDRS_H */ /* Define to 1 if you have the `inet_addr' function. */ #define HAVE_INET_ADDR 1 @@ -305,17 +282,15 @@ /* #undef HAVE_INET_NTOA_R_3 */ /* Define to 1 if you have a IPv6 capable working inet_ntop function. */ -#define HAVE_INET_NTOP 1 +/* #undef HAVE_INET_NTOP */ /* Define to 1 if you have a IPv6 capable working inet_pton function. */ -#define HAVE_INET_PTON 1 +/* #undef HAVE_INET_PTON */ /* Define to 1 if you have the <inttypes.h> header file. */ #define HAVE_INTTYPES_H 1 /* Define to 1 if you have the ioctl function. */ -// Defined by AndroidConfig.h that is automticaly included in builds -#undef HAVE_IOCTL #define HAVE_IOCTL 1 /* Define to 1 if you have the ioctlsocket function. */ @@ -338,7 +313,7 @@ #define HAVE_IOCTL_SIOCGIFADDR 1 /* Define to 1 if you have the <io.h> header file. */ -/* #undef HAVE_IO_H */ +#define HAVE_IO_H 1 /* if you have the Kerberos4 libraries (including -ldes) */ /* #undef HAVE_KRB4 */ @@ -368,7 +343,7 @@ /* #undef HAVE_LDAP_URL_PARSE */ /* Define to 1 if you have the <libgen.h> header file. */ -#define HAVE_LIBGEN_H 1 +/* #undef HAVE_LIBGEN_H */ /* Define to 1 if you have the `idn' library (-lidn). */ /* #undef HAVE_LIBIDN */ @@ -379,6 +354,9 @@ /* Define to 1 if you have the `resolve' library (-lresolve). */ /* #undef HAVE_LIBRESOLVE */ +/* Define to 1 if you have the `socket' library (-lsocket). */ +/* #undef HAVE_LIBSOCKET */ + /* Define to 1 if you have the `ssh2' library (-lssh2). */ /* #undef HAVE_LIBSSH2 */ @@ -410,18 +388,13 @@ #define HAVE_LONGLONG 1 /* Define to 1 if you have the malloc.h header file. */ -// Defined by AndroidConfig.h that is automticaly included in builds -#undef HAVE_MALLOC_H #define HAVE_MALLOC_H 1 /* Define to 1 if you have the memory.h header file. */ #define HAVE_MEMORY_H 1 -/* Define to 1 if you have the memrchr function or macro. */ -/* #undef HAVE_MEMRCHR */ - /* Define to 1 if you have the MSG_NOSIGNAL flag. */ -#define HAVE_MSG_NOSIGNAL 1 +/* #undef HAVE_MSG_NOSIGNAL */ /* Define to 1 if you have the <netdb.h> header file. */ #define HAVE_NETDB_H 1 @@ -446,7 +419,7 @@ #define HAVE_OPENSSL_CRYPTO_H 1 /* Define to 1 if you have the <openssl/engine.h> header file. */ -//#define HAVE_OPENSSL_ENGINE_H 1 +#define HAVE_OPENSSL_ENGINE_H 1 /* Define to 1 if you have the <openssl/err.h> header file. */ #define HAVE_OPENSSL_ERR_H 1 @@ -479,19 +452,19 @@ /* #undef HAVE_PK11_CREATEGENERICOBJECT */ /* Define to 1 if you have a working poll function. */ -#define HAVE_POLL 1 +/* #undef HAVE_POLL */ /* If you have a fine poll */ -#define HAVE_POLL_FINE 1 +/* #undef HAVE_POLL_FINE */ /* Define to 1 if you have the <poll.h> header file. */ -#define HAVE_POLL_H 1 +/* #undef HAVE_POLL_H */ /* Define to 1 if you have a working POSIX-style strerror_r function. */ -#define HAVE_POSIX_STRERROR_R 1 +/* #undef HAVE_POSIX_STRERROR_R */ /* Define to 1 if you have the <pwd.h> header file. */ -#define HAVE_PWD_H 1 +/* #undef HAVE_PWD_H */ /* Define to 1 if you have the `RAND_egd' function. */ #define HAVE_RAND_EGD 1 @@ -524,7 +497,7 @@ #define HAVE_SETLOCALE 1 /* Define to 1 if you have the `setmode' function. */ -/* #undef HAVE_SETMODE */ +#define HAVE_SETMODE 1 /* Define to 1 if you have the `setrlimit' function. */ #define HAVE_SETRLIMIT 1 @@ -536,7 +509,7 @@ /* #undef HAVE_SETSOCKOPT_SO_NONBLOCK */ /* Define to 1 if you have the <sgtty.h> header file. */ -#define HAVE_SGTTY_H 1 +/* #undef HAVE_SGTTY_H */ /* Define to 1 if you have the sigaction function. */ #define HAVE_SIGACTION 1 @@ -551,7 +524,7 @@ #define HAVE_SIGNAL_H 1 /* Define to 1 if you have the sigsetjmp function or macro. */ -#define HAVE_SIGSETJMP 1 +/* #undef HAVE_SIGSETJMP */ /* Define to 1 if sig_atomic_t is an available typedef. */ #define HAVE_SIG_ATOMIC_T 1 @@ -562,12 +535,9 @@ /* Define to 1 if struct sockaddr_in6 has the sin6_scope_id member */ #define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1 -/* Define to 1 if you have the socket function. */ +/* Define to 1 if you have the `socket' function. */ #define HAVE_SOCKET 1 -/* Define to 1 if you have the <socket.h> header file. */ -/* #undef HAVE_SOCKET_H */ - /* Define this if you have the SPNEGO library fbopenssl */ /* #undef HAVE_SPNEGO */ @@ -581,7 +551,7 @@ #define HAVE_STDBOOL_H 1 /* Define to 1 if you have the <stdint.h> header file. */ -#define HAVE_STDINT_H 1 +/* #undef HAVE_STDINT_H */ /* Define to 1 if you have the <stdio.h> header file. */ #define HAVE_STDIO_H 1 @@ -629,8 +599,7 @@ /* #undef HAVE_STRNICMP */ /* Define to 1 if you have the <stropts.h> header file. */ -// not in bionic -//#define HAVE_STROPTS_H 1 +/* #undef HAVE_STROPTS_H */ /* Define to 1 if you have the strstr function. */ #define HAVE_STRSTR 1 @@ -639,7 +608,7 @@ #define HAVE_STRTOK_R 1 /* Define to 1 if you have the strtoll function. */ -#define HAVE_STRTOLL 1 +/* #undef HAVE_STRTOLL */ /* if struct sockaddr_storage is defined */ #define HAVE_STRUCT_SOCKADDR_STORAGE 1 @@ -654,16 +623,16 @@ #define HAVE_SYS_IOCTL_H 1 /* Define to 1 if you have the <sys/param.h> header file. */ -#define HAVE_SYS_PARAM_H 1 +/* #undef HAVE_SYS_PARAM_H */ /* Define to 1 if you have the <sys/poll.h> header file. */ -#define HAVE_SYS_POLL_H 1 +/* #undef HAVE_SYS_POLL_H */ /* Define to 1 if you have the <sys/resource.h> header file. */ #define HAVE_SYS_RESOURCE_H 1 /* Define to 1 if you have the <sys/select.h> header file. */ -#define HAVE_SYS_SELECT_H 1 +/* #undef HAVE_SYS_SELECT_H */ /* Define to 1 if you have the <sys/socket.h> header file. */ #define HAVE_SYS_SOCKET_H 1 @@ -675,28 +644,24 @@ #define HAVE_SYS_STAT_H 1 /* Define to 1 if you have the <sys/time.h> header file. */ -#define HAVE_SYS_TIME_H 1 +/* #undef HAVE_SYS_TIME_H */ /* Define to 1 if you have the <sys/types.h> header file. */ #define HAVE_SYS_TYPES_H 1 /* Define to 1 if you have the <sys/uio.h> header file. */ -// Defined by AndroidConfig.h that is automticaly included in builds -#undef HAVE_SYS_UIO_H #define HAVE_SYS_UIO_H 1 /* Define to 1 if you have the <sys/un.h> header file. */ #define HAVE_SYS_UN_H 1 /* Define to 1 if you have the <sys/utime.h> header file. */ -/* #undef HAVE_SYS_UTIME_H */ +#define HAVE_SYS_UTIME_H 1 /* Define to 1 if you have the <termios.h> header file. */ #define HAVE_TERMIOS_H 1 /* Define to 1 if you have the <termio.h> header file. */ -// Defined by AndroidConfig.h that is automticaly included in builds -#undef HAVE_TERMIO_H #define HAVE_TERMIO_H 1 /* Define to 1 if you have the <time.h> header file. */ @@ -726,6 +691,9 @@ /* Define to 1 if compiler supports old gcc variadic macro style. */ #define HAVE_VARIADIC_MACROS_GCC 1 +/* Define to 1 if you have a working vxworks-style strerror_r function. */ +#define HAVE_VXWORKS_STRERROR_R 1 + /* Define to 1 if you have the winber.h header file. */ /* #undef HAVE_WINBER_H */ @@ -756,10 +724,6 @@ /* if you have the zlib.h header file */ #define HAVE_ZLIB_H 1 -/* Define to the sub-directory in which libtool stores uninstalled libraries. - */ -#define LT_OBJDIR ".libs/" - /* Define to 1 if you are building a native Windows target. */ /* #undef NATIVE_WINDOWS */ @@ -778,30 +742,15 @@ /* Define to 1 if _THREAD_SAFE preprocessor symbol must be defined. */ /* #undef NEED_THREAD_SAFE */ +/* Define to 1 if the open function requires three arguments. */ +#define OPEN_NEEDS_ARG3 1 + /* cpu-machine-OS */ -#define OS "arm-unknown-eabi" +#define OS "unknown-unknown-vxworks" /* Name of package */ #define PACKAGE "curl" -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "a suitable curl mailing list => http://curl.haxx.se/mail/" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "curl" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "curl -" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "curl" - -/* Define to the home page for this package. */ -#define PACKAGE_URL "" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "-" - /* a suitable file to read random data from */ #define RANDOM_FILE "/dev/urandom" @@ -833,7 +782,7 @@ /* #undef RECVFROM_TYPE_ARG6_IS_VOID */ /* Define to the function return type for recvfrom. */ -#define RECVFROM_TYPE_RETV ssize_t +#define RECVFROM_TYPE_RETV int /* Define to the type of arg 1 for recv. */ #define RECV_TYPE_ARG1 int @@ -848,13 +797,13 @@ #define RECV_TYPE_ARG4 int /* Define to the function return type for recv. */ -#define RECV_TYPE_RETV ssize_t +#define RECV_TYPE_RETV int /* Define as the return type of signal handlers (`int' or `void'). */ #define RETSIGTYPE void /* Define to the type qualifier of arg 5 for select. */ -#define SELECT_QUAL_ARG5 +#define SELECT_QUAL_ARG5 /* Define to the type of arg 1 for select. */ #define SELECT_TYPE_ARG1 int @@ -884,13 +833,13 @@ #define SEND_TYPE_ARG4 int /* Define to the function return type for send. */ -#define SEND_TYPE_RETV ssize_t +#define SEND_TYPE_RETV int /* The size of `int', as computed by sizeof. */ #define SIZEOF_INT 4 /* The size of `long', as computed by sizeof. */ -#define SIZEOF_LONG 8 +#define SIZEOF_LONG 4 /* The size of `off_t', as computed by sizeof. */ #define SIZEOF_OFF_T 8 @@ -899,24 +848,24 @@ #define SIZEOF_SHORT 2 /* The size of `size_t', as computed by sizeof. */ -#define SIZEOF_SIZE_T 8 +#define SIZEOF_SIZE_T 4 /* The size of `time_t', as computed by sizeof. */ -#define SIZEOF_TIME_T 8 +#define SIZEOF_TIME_T 4 /* The size of `void*', as computed by sizeof. */ -#define SIZEOF_VOIDP 8 +#define SIZEOF_VOIDP 4 /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 /* Define to the type of arg 3 for strerror_r. */ -#define STRERROR_R_TYPE_ARG3 size_t +/* #undef STRERROR_R_TYPE_ARG3 */ /* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ -#define TIME_WITH_SYS_TIME 1 +/* #undef TIME_WITH_SYS_TIME */ -/* Define to enable c-ares support */ +/* Define if you want to enable c-ares support */ /* #undef USE_ARES */ /* Define to disable non-blocking sockets. */ @@ -950,9 +899,6 @@ /* Define to 1 if using yaSSL in OpenSSL compatibility mode. */ /* #undef USE_YASSLEMUL */ -/* Version number of package */ -#define VERSION "7.20.1" - /* Define to avoid automatic inclusion of winsock.h */ /* #undef WIN32_LEAN_AND_MEAN */ @@ -984,3 +930,5 @@ /* the signed version of size_t */ /* #undef ssize_t */ + +#endif /* __LIB_CONFIG_VXWORKS_H */ diff --git a/lib/config-win32.h b/lib/config-win32.h new file mode 100644 index 00000000..5ee76065 --- /dev/null +++ b/lib/config-win32.h @@ -0,0 +1,587 @@ +#ifndef __LIB_CONFIG_WIN32_H +#define __LIB_CONFIG_WIN32_H + +/* ================================================================ */ +/* lib/config-win32.h - Hand crafted config file for Windows */ +/* ================================================================ */ + +/* ---------------------------------------------------------------- */ +/* HEADER FILES */ +/* ---------------------------------------------------------------- */ + +/* Define if you have the <arpa/inet.h> header file. */ +/* #define HAVE_ARPA_INET_H 1 */ + +/* Define if you have the <assert.h> header file. */ +#define HAVE_ASSERT_H 1 + +/* Define if you have the <crypto.h> header file. */ +/* #define HAVE_CRYPTO_H 1 */ + +/* Define if you have the <err.h> header file. */ +/* #define HAVE_ERR_H 1 */ + +/* Define if you have the <fcntl.h> header file. */ +#define HAVE_FCNTL_H 1 + +/* Define if you have the <getopt.h> header file. */ +/* #define HAVE_GETOPT_H 1 */ + +/* Define if you have the <io.h> header file. */ +#define HAVE_IO_H 1 + +/* Define if you have the <limits.h> header file. */ +#define HAVE_LIMITS_H 1 + +/* Define if you need the malloc.h header file even with stdlib.h */ +#if !defined(__SALFORDC__) && !defined(__POCC__) +#define NEED_MALLOC_H 1 +#endif + +/* Define if you have the <netdb.h> header file. */ +/* #define HAVE_NETDB_H 1 */ + +/* Define if you have the <netinet/in.h> header file. */ +/* #define HAVE_NETINET_IN_H 1 */ + +/* Define if you have the <process.h> header file. */ +#ifndef __SALFORDC__ +#define HAVE_PROCESS_H 1 +#endif + +/* Define if you have the <signal.h> header file. */ +#define HAVE_SIGNAL_H 1 + +/* Define if you have the <sgtty.h> header file. */ +/* #define HAVE_SGTTY_H 1 */ + +/* Define if you have the <ssl.h> header file. */ +/* #define HAVE_SSL_H 1 */ + +/* Define if you have the <stdlib.h> header file. */ +#define HAVE_STDLIB_H 1 + +/* Define if you have the <sys/param.h> header file. */ +/* #define HAVE_SYS_PARAM_H 1 */ + +/* Define if you have the <sys/select.h> header file. */ +/* #define HAVE_SYS_SELECT_H 1 */ + +/* Define if you have the <sys/socket.h> header file. */ +/* #define HAVE_SYS_SOCKET_H 1 */ + +/* Define if you have the <sys/sockio.h> header file. */ +/* #define HAVE_SYS_SOCKIO_H 1 */ + +/* Define if you have the <sys/stat.h> header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define if you have the <sys/time.h> header file */ +/* #define HAVE_SYS_TIME_H 1 */ + +/* Define if you have the <sys/types.h> header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define if you have the <sys/utime.h> header file. */ +#ifndef __BORLANDC__ +#define HAVE_SYS_UTIME_H 1 +#endif + +/* Define if you have the <termio.h> header file. */ +/* #define HAVE_TERMIO_H 1 */ + +/* Define if you have the <termios.h> header file. */ +/* #define HAVE_TERMIOS_H 1 */ + +/* Define if you have the <time.h> header file. */ +#define HAVE_TIME_H 1 + +/* Define if you have the <unistd.h> header file. */ +#if defined(__MINGW32__) || defined(__WATCOMC__) || defined(__LCC__) || \ + defined(__POCC__) +#define HAVE_UNISTD_H 1 +#endif + +/* Define if you have the <windows.h> header file. */ +#define HAVE_WINDOWS_H 1 + +/* Define if you have the <winsock.h> header file. */ +#define HAVE_WINSOCK_H 1 + +/* Define if you have the <winsock2.h> header file. */ +#ifndef __SALFORDC__ +#define HAVE_WINSOCK2_H 1 +#endif + +/* Define if you have the <ws2tcpip.h> header file. */ +#ifndef __SALFORDC__ +#define HAVE_WS2TCPIP_H 1 +#endif + +/* ---------------------------------------------------------------- */ +/* OTHER HEADER INFO */ +/* ---------------------------------------------------------------- */ + +/* Define if sig_atomic_t is an available typedef. */ +#define HAVE_SIG_ATOMIC_T 1 + +/* Define if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define if you can safely include both <sys/time.h> and <time.h>. */ +/* #define TIME_WITH_SYS_TIME 1 */ + +/* ---------------------------------------------------------------- */ +/* FUNCTIONS */ +/* ---------------------------------------------------------------- */ + +/* Define if you have the closesocket function. */ +#define HAVE_CLOSESOCKET 1 + +/* Define if you don't have vprintf but do have _doprnt. */ +/* #define HAVE_DOPRNT 1 */ + +/* Define if you have the gethostbyaddr function. */ +#define HAVE_GETHOSTBYADDR 1 + +/* Define if you have the gethostname function. */ +#define HAVE_GETHOSTNAME 1 + +/* Define if you have the getpass function. */ +/* #define HAVE_GETPASS 1 */ + +/* Define if you have the getservbyname function. */ +#define HAVE_GETSERVBYNAME 1 + +/* Define if you have the getprotobyname function. */ +#define HAVE_GETPROTOBYNAME + +/* Define if you have the gettimeofday function. */ +/* #define HAVE_GETTIMEOFDAY 1 */ + +/* Define if you have the inet_addr function. */ +#define HAVE_INET_ADDR 1 + +/* Define if you have the ioctlsocket function. */ +#define HAVE_IOCTLSOCKET 1 + +/* Define if you have a working ioctlsocket FIONBIO function. */ +#define HAVE_IOCTLSOCKET_FIONBIO 1 + +/* Define if you have the perror function. */ +#define HAVE_PERROR 1 + +/* Define if you have the RAND_screen function when using SSL */ +#define HAVE_RAND_SCREEN 1 + +/* Define if you have the `RAND_status' function when using SSL. */ +#define HAVE_RAND_STATUS 1 + +/* Define to 1 if you have the `CRYPTO_cleanup_all_ex_data' function. + This is present in OpenSSL versions after 0.9.6b */ +#define HAVE_CRYPTO_CLEANUP_ALL_EX_DATA 1 + +/* Define if you have the select function. */ +#define HAVE_SELECT 1 + +/* Define if you have the setvbuf function. */ +#define HAVE_SETVBUF 1 + +/* Define if you have the socket function. */ +#define HAVE_SOCKET 1 + +/* Define if you have the strcasecmp function. */ +/* #define HAVE_STRCASECMP 1 */ + +/* Define if you have the strdup function. */ +#define HAVE_STRDUP 1 + +/* Define if you have the strftime function. */ +#define HAVE_STRFTIME 1 + +/* Define if you have the stricmp function. */ +#define HAVE_STRICMP 1 + +/* Define if you have the strncasecmp function. */ +/* #define HAVE_STRNCASECMP 1 */ + +/* Define if you have the strnicmp function. */ +#define HAVE_STRNICMP 1 + +/* Define if you have the strstr function. */ +#define HAVE_STRSTR 1 + +/* Define if you have the strtoll function. */ +#if defined(__MINGW32__) || defined(__WATCOMC__) || defined(__POCC__) +#define HAVE_STRTOLL 1 +#endif + +/* Define if you have the tcgetattr function. */ +/* #define HAVE_TCGETATTR 1 */ + +/* Define if you have the tcsetattr function. */ +/* #define HAVE_TCSETATTR 1 */ + +/* Define if you have the utime function */ +#ifndef __BORLANDC__ +#define HAVE_UTIME 1 +#endif + +/* Define to the type qualifier of arg 1 for getnameinfo. */ +#define GETNAMEINFO_QUAL_ARG1 const + +/* Define to the type of arg 1 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG1 struct sockaddr * + +/* Define to the type of arg 2 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG2 socklen_t + +/* Define to the type of args 4 and 6 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG46 DWORD + +/* Define to the type of arg 7 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG7 int + +/* Define if you have the recv function. */ +#define HAVE_RECV 1 + +/* Define to the type of arg 1 for recv. */ +#define RECV_TYPE_ARG1 SOCKET + +/* Define to the type of arg 2 for recv. */ +#define RECV_TYPE_ARG2 char * + +/* Define to the type of arg 3 for recv. */ +#define RECV_TYPE_ARG3 int + +/* Define to the type of arg 4 for recv. */ +#define RECV_TYPE_ARG4 int + +/* Define to the function return type for recv. */ +#define RECV_TYPE_RETV int + +/* Define if you have the recvfrom function. */ +#define HAVE_RECVFROM 1 + +/* Define to the type of arg 1 for recvfrom. */ +#define RECVFROM_TYPE_ARG1 SOCKET + +/* Define to the type pointed by arg 2 for recvfrom. */ +#define RECVFROM_TYPE_ARG2 char + +/* Define to the type of arg 3 for recvfrom. */ +#define RECVFROM_TYPE_ARG3 int + +/* Define to the type of arg 4 for recvfrom. */ +#define RECVFROM_TYPE_ARG4 int + +/* Define to the type pointed by arg 5 for recvfrom. */ +#define RECVFROM_TYPE_ARG5 struct sockaddr + +/* Define to the type pointed by arg 6 for recvfrom. */ +#define RECVFROM_TYPE_ARG6 int + +/* Define to the function return type for recvfrom. */ +#define RECVFROM_TYPE_RETV int + +/* Define if you have the send function. */ +#define HAVE_SEND 1 + +/* Define to the type of arg 1 for send. */ +#define SEND_TYPE_ARG1 SOCKET + +/* Define to the type qualifier of arg 2 for send. */ +#define SEND_QUAL_ARG2 const + +/* Define to the type of arg 2 for send. */ +#define SEND_TYPE_ARG2 char * + +/* Define to the type of arg 3 for send. */ +#define SEND_TYPE_ARG3 int + +/* Define to the type of arg 4 for send. */ +#define SEND_TYPE_ARG4 int + +/* Define to the function return type for send. */ +#define SEND_TYPE_RETV int + +/* ---------------------------------------------------------------- */ +/* TYPEDEF REPLACEMENTS */ +/* ---------------------------------------------------------------- */ + +/* Define this if in_addr_t is not an available 'typedefed' type */ +#define in_addr_t unsigned long + +/* Define as the return type of signal handlers (int or void). */ +#define RETSIGTYPE void + +/* Define ssize_t if it is not an available 'typedefed' type */ +#ifndef _SSIZE_T_DEFINED +# if (defined(__WATCOMC__) && (__WATCOMC__ >= 1240)) || \ + defined(__POCC__) || \ + defined(__MINGW32__) +# elif defined(_WIN64) +# define _SSIZE_T_DEFINED +# define ssize_t __int64 +# else +# define _SSIZE_T_DEFINED +# define ssize_t int +# endif +#endif + +/* ---------------------------------------------------------------- */ +/* TYPE SIZES */ +/* ---------------------------------------------------------------- */ + +/* The size of `int', as computed by sizeof. */ +#define SIZEOF_INT 4 + +/* The size of `long double', as computed by sizeof. */ +#define SIZEOF_LONG_DOUBLE 16 + +/* The size of `long long', as computed by sizeof. */ +/* #define SIZEOF_LONG_LONG 8 */ + +/* The size of `short', as computed by sizeof. */ +#define SIZEOF_SHORT 2 + +/* ---------------------------------------------------------------- */ +/* STRUCT RELATED */ +/* ---------------------------------------------------------------- */ + +/* Define this if you have struct sockaddr_storage */ +#ifndef __SALFORDC__ +#define HAVE_STRUCT_SOCKADDR_STORAGE 1 +#endif + +/* Define this if you have struct timeval */ +#define HAVE_STRUCT_TIMEVAL 1 + +/* ---------------------------------------------------------------- */ +/* Watt-32 tcp/ip SPECIFIC */ +/* ---------------------------------------------------------------- */ + +#ifdef USE_WATT32 + #include <tcp.h> + #undef byte + #undef word + #undef USE_WINSOCK + #undef HAVE_WINSOCK_H + #undef HAVE_WINSOCK2_H + #undef HAVE_WS2TCPIP_H + #define HAVE_GETADDRINFO + #define HAVE_GETNAMEINFO + #define HAVE_SYS_IOCTL_H + #define HAVE_SYS_SOCKET_H + #define HAVE_NETINET_IN_H + #define HAVE_NETDB_H + #define HAVE_ARPA_INET_H + #define HAVE_FREEADDRINFO + #define SOCKET int +#endif + + +/* ---------------------------------------------------------------- */ +/* COMPILER SPECIFIC */ +/* ---------------------------------------------------------------- */ + +/* Undef keyword 'const' if it does not work. */ +/* #undef const */ + +/* Windows should not have HAVE_GMTIME_R defined */ +/* #undef HAVE_GMTIME_R */ + +/* Define if the compiler supports C99 variadic macro style. */ +#if defined(_MSC_VER) && (_MSC_VER >= 1400) +#define HAVE_VARIADIC_MACROS_C99 1 +#endif + +/* Define if the compiler supports the 'long long' data type. */ +#if defined(__MINGW32__) || defined(__WATCOMC__) +#define HAVE_LONGLONG 1 +#endif + +/* Define to avoid VS2005 complaining about portable C functions */ +#if defined(_MSC_VER) && (_MSC_VER >= 1400) +#define _CRT_SECURE_NO_DEPRECATE 1 +#define _CRT_NONSTDC_NO_DEPRECATE 1 +#endif + +/* VS2005 and later dafault size for time_t is 64-bit, unless */ +/* _USE_32BIT_TIME_T has been defined to get a 32-bit time_t. */ +#if defined(_MSC_VER) && (_MSC_VER >= 1400) +# ifndef _USE_32BIT_TIME_T +# define SIZEOF_TIME_T 8 +# else +# define SIZEOF_TIME_T 4 +# endif +#endif + +/* Officially, Microsoft's Windows SDK versions 6.X do not support Windows + 2000 as a supported build target. VS2008 default installations provide an + embedded Windows SDK v6.0A along with the claim that Windows 2000 is a + valid build target for VS2008. Popular belief is that binaries built using + Windows SDK versions 6.X and Windows 2000 as a build target are functional */ +#if defined(_MSC_VER) && (_MSC_VER >= 1500) +# define VS2008_MINIMUM_TARGET 0x0500 +#endif + +/* When no build target is specified VS2008 default build target is Windows + Vista, which leaves out even Winsows XP. If no build target has been given + for VS2008 we will target the minimum Officially supported build target, + which happens to be Windows XP. */ +#if defined(_MSC_VER) && (_MSC_VER >= 1500) +# define VS2008_DEFAULT_TARGET 0x0501 +#endif + +/* VS2008 default target settings and minimum build target check */ +#if defined(_MSC_VER) && (_MSC_VER >= 1500) +# ifndef _WIN32_WINNT +# define _WIN32_WINNT VS2008_DEFAULT_TARGET +# endif +# ifndef WINVER +# define WINVER VS2008_DEFAULT_TARGET +# endif +# if (_WIN32_WINNT < VS2008_MINIMUM_TARGET) || (WINVER < VS2008_MINIMUM_TARGET) +# error VS2008 does not support Windows build targets prior to Windows 2000 +# endif +#endif + +/* When no build target is specified Pelles C 5.00 and later default build + target is Windows Vista. We override default target to be Windows 2000. */ +#if defined(__POCC__) && (__POCC__ >= 500) +# ifndef _WIN32_WINNT +# define _WIN32_WINNT 0x0500 +# endif +# ifndef WINVER +# define WINVER 0x0500 +# endif +#endif + +/* Availability of freeaddrinfo, getaddrinfo and getnameinfo functions is + quite convoluted, compiler dependent and even build target dependent. */ +#if defined(HAVE_WS2TCPIP_H) +# if defined(__POCC__) +# define HAVE_FREEADDRINFO 1 +# define HAVE_GETADDRINFO 1 +# define HAVE_GETADDRINFO_THREADSAFE 1 +# define HAVE_GETNAMEINFO 1 +# elif defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0501) +# define HAVE_FREEADDRINFO 1 +# define HAVE_GETADDRINFO 1 +# define HAVE_GETADDRINFO_THREADSAFE 1 +# define HAVE_GETNAMEINFO 1 +# elif defined(_MSC_VER) && (_MSC_VER >= 1200) +# define HAVE_FREEADDRINFO 1 +# define HAVE_GETADDRINFO 1 +# define HAVE_GETADDRINFO_THREADSAFE 1 +# define HAVE_GETNAMEINFO 1 +# endif +#endif + +#if defined(__POCC__) +# ifndef _MSC_VER +# error Microsoft extensions /Ze compiler option is required +# endif +# ifndef __POCC__OLDNAMES +# error Compatibility names /Go compiler option is required +# endif +#endif + +/* ---------------------------------------------------------------- */ +/* LARGE FILE SUPPORT */ +/* ---------------------------------------------------------------- */ + +#if defined(_MSC_VER) && !defined(_WIN32_WCE) +# if (_MSC_VER >= 900) && (_INTEGRAL_MAX_BITS >= 64) +# define USE_WIN32_LARGE_FILES +# else +# define USE_WIN32_SMALL_FILES +# endif +#endif + +#if defined(__MINGW32__) && !defined(USE_WIN32_LARGE_FILES) +# define USE_WIN32_LARGE_FILES +#endif + +#if defined(__WATCOMC__) && !defined(USE_WIN32_LARGE_FILES) +# define USE_WIN32_LARGE_FILES +#endif + +#if defined(__POCC__) +# undef USE_WIN32_LARGE_FILES +#endif + +#if !defined(USE_WIN32_LARGE_FILES) && !defined(USE_WIN32_SMALL_FILES) +# define USE_WIN32_SMALL_FILES +#endif + +/* ---------------------------------------------------------------- */ +/* DNS RESOLVER SPECIALTY */ +/* ---------------------------------------------------------------- */ + +/* + * Undefine both USE_ARES and USE_THREADS_WIN32 for synchronous DNS + */ + +/* Define USE_ARES to enable c-ares asynchronous DNS lookups */ +/* #define USE_ARES 1 */ + +/* Define USE_THREADS_WIN32 to enable threaded asynchronous DNS lookups */ +#define USE_THREADS_WIN32 1 + +#if defined(USE_ARES) && defined(USE_THREADS_WIN32) +# error "Only one DNS lookup specialty may be defined at most" +#endif + +/* ---------------------------------------------------------------- */ +/* LDAP SUPPORT */ +/* ---------------------------------------------------------------- */ + +#if defined(CURL_HAS_NOVELL_LDAPSDK) || defined(CURL_HAS_MOZILLA_LDAPSDK) +#undef CURL_LDAP_WIN +#define HAVE_LDAP_SSL_H 1 +#define HAVE_LDAP_URL_PARSE 1 +#elif defined(CURL_HAS_OPENLDAP_LDAPSDK) +#undef CURL_LDAP_WIN +#define HAVE_LDAP_URL_PARSE 1 +#else +#undef HAVE_LDAP_URL_PARSE +#define CURL_LDAP_WIN 1 +#endif + +#if defined(__WATCOMC__) && defined(CURL_LDAP_WIN) +#if __WATCOMC__ < 1280 +#define WINBERAPI __declspec(cdecl) +#define WINLDAPAPI __declspec(cdecl) +#endif +#endif + +#if defined(__POCC__) && defined(CURL_LDAP_WIN) +# define CURL_DISABLE_LDAP 1 +#endif + +/* ---------------------------------------------------------------- */ +/* ADDITIONAL DEFINITIONS */ +/* ---------------------------------------------------------------- */ + +/* Define cpu-machine-OS */ +#undef OS +#if defined(_M_IX86) || defined(__i386__) /* x86 (MSVC or gcc) */ +#define OS "i386-pc-win32" +#elif defined(_M_IA64) /* Itanium */ +#define OS "ia64-pc-win32" +#elif defined(_M_X64) /* AMD64/EM64T - Not defined until MSVC 2005 */ +#define OS "amd64-pc-win32" +#else +#define OS "unknown-pc-win32" +#endif + +/* Name of package */ +#define PACKAGE "curl" + +#if defined(__POCC__) || (USE_IPV6) +# define ENABLE_IPV6 1 +#endif + +#endif /* __LIB_CONFIG_WIN32_H */ diff --git a/lib/config-win32ce.h b/lib/config-win32ce.h new file mode 100644 index 00000000..1f417825 --- /dev/null +++ b/lib/config-win32ce.h @@ -0,0 +1,409 @@ +#ifndef __LIB_CONFIG_WIN32CE_H +#define __LIB_CONFIG_WIN32CE_H + +/* ================================================================ */ +/* lib/config-win32ce.h - Hand crafted config file for windows ce */ +/* ================================================================ */ + +/* ---------------------------------------------------------------- */ +/* HEADER FILES */ +/* ---------------------------------------------------------------- */ + +/* Define if you have the <arpa/inet.h> header file. */ +/* #define HAVE_ARPA_INET_H 1 */ + +/* Define if you have the <assert.h> header file. */ +/* #define HAVE_ASSERT_H 1 */ + +/* Define if you have the <crypto.h> header file. */ +/* #define HAVE_CRYPTO_H 1 */ + +/* Define if you have the <err.h> header file. */ +/* #define HAVE_ERR_H 1 */ + +/* Define if you have the <fcntl.h> header file. */ +#define HAVE_FCNTL_H 1 + +/* Define if you have the <getopt.h> header file. */ +/* #define HAVE_GETOPT_H 1 */ + +/* Define if you have the <io.h> header file. */ +#define HAVE_IO_H 1 + +/* Define if you have the <limits.h> header file. */ +#define HAVE_LIMITS_H 1 + +/* Define if you need the malloc.h header header file even with stdlib.h */ +#define NEED_MALLOC_H 1 + +/* Define if you have the <netdb.h> header file. */ +/* #define HAVE_NETDB_H 1 */ + +/* Define if you have the <netinet/in.h> header file. */ +/* #define HAVE_NETINET_IN_H 1 */ + +/* Define if you have the <signal.h> header file. */ +#define HAVE_SIGNAL_H 1 + +/* Define if you have the <sgtty.h> header file. */ +/* #define HAVE_SGTTY_H 1 */ + +/* Define if you have the <ssl.h> header file. */ +/* #define HAVE_SSL_H 1 */ + +/* Define if you have the <stdlib.h> header file. */ +#define HAVE_STDLIB_H 1 + +/* Define if you have the <process.h> header file. */ +#define HAVE_PROCESS_H 1 + +/* Define if you have the <sys/param.h> header file. */ +/* #define HAVE_SYS_PARAM_H 1 */ + +/* Define if you have the <sys/select.h> header file. */ +/* #define HAVE_SYS_SELECT_H 1 */ + +/* Define if you have the <sys/socket.h> header file. */ +/* #define HAVE_SYS_SOCKET_H 1 */ + +/* Define if you have the <sys/sockio.h> header file. */ +/* #define HAVE_SYS_SOCKIO_H 1 */ + +/* Define if you have the <sys/stat.h> header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define if you have the <sys/time.h> header file */ +/* #define HAVE_SYS_TIME_H 1 */ + +/* Define if you have the <sys/types.h> header file. */ +/* #define HAVE_SYS_TYPES_H 1 */ + +/* Define if you have the <sys/utime.h> header file */ +#define HAVE_SYS_UTIME_H 1 + +/* Define if you have the <termio.h> header file. */ +/* #define HAVE_TERMIO_H 1 */ + +/* Define if you have the <termios.h> header file. */ +/* #define HAVE_TERMIOS_H 1 */ + +/* Define if you have the <time.h> header file. */ +#define HAVE_TIME_H 1 + +/* Define if you have the <unistd.h> header file. */ +#if defined(__MINGW32__) || defined(__WATCOMC__) || defined(__LCC__) +#define HAVE_UNISTD_H 1 +#endif + +/* Define if you have the <windows.h> header file. */ +#define HAVE_WINDOWS_H 1 + +/* Define if you have the <winsock.h> header file. */ +#define HAVE_WINSOCK_H 1 + +/* Define if you have the <winsock2.h> header file. */ +/* #define HAVE_WINSOCK2_H 1 */ + +/* Define if you have the <ws2tcpip.h> header file. */ +/* #define HAVE_WS2TCPIP_H 1 */ + +/* ---------------------------------------------------------------- */ +/* OTHER HEADER INFO */ +/* ---------------------------------------------------------------- */ + +/* Define if sig_atomic_t is an available typedef. */ +#define HAVE_SIG_ATOMIC_T 1 + +/* Define if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define if you can safely include both <sys/time.h> and <time.h>. */ +/* #define TIME_WITH_SYS_TIME 1 */ + +/* ---------------------------------------------------------------- */ +/* FUNCTIONS */ +/* ---------------------------------------------------------------- */ + +/* Define if you have the closesocket function. */ +#define HAVE_CLOSESOCKET 1 + +/* Define if you don't have vprintf but do have _doprnt. */ +/* #define HAVE_DOPRNT 1 */ + +/* Define if you have the gethostbyaddr function. */ +#define HAVE_GETHOSTBYADDR 1 + +/* Define if you have the gethostname function. */ +#define HAVE_GETHOSTNAME 1 + +/* Define if you have the getpass function. */ +/* #define HAVE_GETPASS 1 */ + +/* Define if you have the getservbyname function. */ +#define HAVE_GETSERVBYNAME 1 + +/* Define if you have the gettimeofday function. */ +/* #define HAVE_GETTIMEOFDAY 1 */ + +/* Define if you have the inet_addr function. */ +#define HAVE_INET_ADDR 1 + +/* Define if you have the ioctlsocket function. */ +#define HAVE_IOCTLSOCKET 1 + +/* Define if you have a working ioctlsocket FIONBIO function. */ +#define HAVE_IOCTLSOCKET_FIONBIO 1 + +/* Define if you have the perror function. */ +#define HAVE_PERROR 1 + +/* Define if you have the RAND_screen function when using SSL */ +#define HAVE_RAND_SCREEN 1 + +/* Define if you have the `RAND_status' function when using SSL. */ +#define HAVE_RAND_STATUS 1 + +/* Define if you have the select function. */ +#define HAVE_SELECT 1 + +/* Define if you have the setvbuf function. */ +#define HAVE_SETVBUF 1 + +/* Define if you have the socket function. */ +#define HAVE_SOCKET 1 + +/* Define if you have the strcasecmp function. */ +/* #define HAVE_STRCASECMP 1 */ + +/* Define if you have the strdup function. */ +/* #define HAVE_STRDUP 1 */ + +/* Define if you have the strftime function. */ +/* #define HAVE_STRFTIME 1 */ + +/* Define if you have the stricmp function. */ +/* #define HAVE_STRICMP 1 */ + +/* Define if you have the strncasecmp function. */ +/* #define HAVE_STRNCASECMP 1 */ + +/* Define if you have the strnicmp function. */ +/* #define HAVE_STRNICMP 1 */ + +/* Define if you have the strstr function. */ +#define HAVE_STRSTR 1 + +/* Define if you have the strtoll function. */ +#if defined(__MINGW32__) || defined(__WATCOMC__) +#define HAVE_STRTOLL 1 +#endif + +/* Define if you have the tcgetattr function. */ +/* #define HAVE_TCGETATTR 1 */ + +/* Define if you have the tcsetattr function. */ +/* #define HAVE_TCSETATTR 1 */ + +/* Define if you have the utime function */ +#define HAVE_UTIME 1 + +/* Define if you have the getnameinfo function. */ +#define HAVE_GETNAMEINFO 1 + +/* Define to the type qualifier of arg 1 for getnameinfo. */ +#define GETNAMEINFO_QUAL_ARG1 const + +/* Define to the type of arg 1 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG1 struct sockaddr * + +/* Define to the type of arg 2 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG2 socklen_t + +/* Define to the type of args 4 and 6 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG46 DWORD + +/* Define to the type of arg 7 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG7 int + +/* Define if you have the recv function. */ +#define HAVE_RECV 1 + +/* Define to the type of arg 1 for recv. */ +#define RECV_TYPE_ARG1 SOCKET + +/* Define to the type of arg 2 for recv. */ +#define RECV_TYPE_ARG2 char * + +/* Define to the type of arg 3 for recv. */ +#define RECV_TYPE_ARG3 int + +/* Define to the type of arg 4 for recv. */ +#define RECV_TYPE_ARG4 int + +/* Define to the function return type for recv. */ +#define RECV_TYPE_RETV int + +/* Define if you have the recvfrom function. */ +#define HAVE_RECVFROM 1 + +/* Define to the type of arg 1 for recvfrom. */ +#define RECVFROM_TYPE_ARG1 SOCKET + +/* Define to the type pointed by arg 2 for recvfrom. */ +#define RECVFROM_TYPE_ARG2 char + +/* Define to the type of arg 3 for recvfrom. */ +#define RECVFROM_TYPE_ARG3 int + +/* Define to the type of arg 4 for recvfrom. */ +#define RECVFROM_TYPE_ARG4 int + +/* Define to the type pointed by arg 5 for recvfrom. */ +#define RECVFROM_TYPE_ARG5 struct sockaddr + +/* Define to the type pointed by arg 6 for recvfrom. */ +#define RECVFROM_TYPE_ARG6 int + +/* Define to the function return type for recvfrom. */ +#define RECVFROM_TYPE_RETV int + +/* Define if you have the send function. */ +#define HAVE_SEND 1 + +/* Define to the type of arg 1 for send. */ +#define SEND_TYPE_ARG1 SOCKET + +/* Define to the type qualifier of arg 2 for send. */ +#define SEND_QUAL_ARG2 const + +/* Define to the type of arg 2 for send. */ +#define SEND_TYPE_ARG2 char * + +/* Define to the type of arg 3 for send. */ +#define SEND_TYPE_ARG3 int + +/* Define to the type of arg 4 for send. */ +#define SEND_TYPE_ARG4 int + +/* Define to the function return type for send. */ +#define SEND_TYPE_RETV int + +/* ---------------------------------------------------------------- */ +/* TYPEDEF REPLACEMENTS */ +/* ---------------------------------------------------------------- */ + +/* Define this if in_addr_t is not an available 'typedefed' type */ +#define in_addr_t unsigned long + +/* Define as the return type of signal handlers (int or void). */ +#define RETSIGTYPE void + +/* Define ssize_t if it is not an available 'typedefed' type */ +#if (defined(__WATCOMC__) && (__WATCOMC__ >= 1240)) || defined(__POCC__) +#elif defined(_WIN64) +#define ssize_t __int64 +#else +#define ssize_t int +#endif + +/* ---------------------------------------------------------------- */ +/* TYPE SIZES */ +/* ---------------------------------------------------------------- */ + +/* The size of `int', as computed by sizeof. */ +#define SIZEOF_INT 4 + +/* The size of `long double', as computed by sizeof. */ +#define SIZEOF_LONG_DOUBLE 16 + +/* The size of `long long', as computed by sizeof. */ +/* #define SIZEOF_LONG_LONG 8 */ + +/* The size of `short', as computed by sizeof. */ +#define SIZEOF_SHORT 2 + +/* ---------------------------------------------------------------- */ +/* STRUCT RELATED */ +/* ---------------------------------------------------------------- */ + +/* Define this if you have struct sockaddr_storage */ +/* #define HAVE_STRUCT_SOCKADDR_STORAGE 1 */ + +/* Define this if you have struct timeval */ +#define HAVE_STRUCT_TIMEVAL 1 + +/* Define this if struct sockaddr_in6 has the sin6_scope_id member */ +#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1 + +/* ---------------------------------------------------------------- */ +/* COMPILER SPECIFIC */ +/* ---------------------------------------------------------------- */ + +/* Undef keyword 'const' if it does not work. */ +/* #undef const */ + +/* Define to avoid VS2005 complaining about portable C functions */ +#if defined(_MSC_VER) && (_MSC_VER >= 1400) +#define _CRT_SECURE_NO_DEPRECATE 1 +#define _CRT_NONSTDC_NO_DEPRECATE 1 +#endif + +/* VS2005 and later dafault size for time_t is 64-bit, unless */ +/* _USE_32BIT_TIME_T has been defined to get a 32-bit time_t. */ +#if defined(_MSC_VER) && (_MSC_VER >= 1400) +# ifndef _USE_32BIT_TIME_T +# define SIZEOF_TIME_T 8 +# else +# define SIZEOF_TIME_T 4 +# endif +#endif + +/* ---------------------------------------------------------------- */ +/* LARGE FILE SUPPORT */ +/* ---------------------------------------------------------------- */ + +#if defined(_MSC_VER) && !defined(_WIN32_WCE) +# if (_MSC_VER >= 900) && (_INTEGRAL_MAX_BITS >= 64) +# define USE_WIN32_LARGE_FILES +# else +# define USE_WIN32_SMALL_FILES +# endif +#endif + +#if !defined(USE_WIN32_LARGE_FILES) && !defined(USE_WIN32_SMALL_FILES) +# define USE_WIN32_SMALL_FILES +#endif + +/* ---------------------------------------------------------------- */ +/* LDAP SUPPORT */ +/* ---------------------------------------------------------------- */ + +#define CURL_LDAP_WIN 1 +#undef HAVE_LDAP_URL_PARSE + +/* ---------------------------------------------------------------- */ +/* ADDITIONAL DEFINITIONS */ +/* ---------------------------------------------------------------- */ + +/* Define cpu-machine-OS */ +#undef OS +#define OS "i386-pc-win32ce" + +/* Name of package */ +#define PACKAGE "curl" + +/* ---------------------------------------------------------------- */ +/* WinCE */ +/* ---------------------------------------------------------------- */ + +#define CURL_DISABLE_FILE 1 +#define CURL_DISABLE_TELNET 1 +#define CURL_DISABLE_LDAP 1 + +#define ENOSPC 1 +#define ENOMEM 2 +#define EAGAIN 3 + +extern int stat(const char *path,struct stat *buffer ); + +#endif /* __LIB_CONFIG_WIN32CE_H */ diff --git a/lib/config.dos b/lib/config.dos new file mode 100644 index 00000000..78f0c6b6 --- /dev/null +++ b/lib/config.dos @@ -0,0 +1,169 @@ +#ifndef HEADER_CONFIG_DOS_H +#define HEADER_CONFIG_DOS_H + + +/* ================================================================ */ +/* lib/config.dos - Hand crafted config file for DOS */ +/* ================================================================ */ + +#if defined(DJGPP) + #define OS "MSDOS/djgpp" +#elif defined(__HIGHC__) + #define OS "MSDOS/HighC" +#elif defined(__WATCOMC__) + #define OS "MSDOS/Watcom" +#else + #define OS "MSDOS/?" +#endif + +#define PACKAGE "curl" + +#define HAVE_ARPA_INET_H 1 +#define HAVE_FCNTL_H 1 +#define HAVE_GETADDRINFO 1 +#define HAVE_GETNAMEINFO 1 +#define HAVE_GETPROTOBYNAME 1 +#define HAVE_GETTIMEOFDAY 1 +#define HAVE_IO_H 1 +#define HAVE_IOCTL 1 +#define HAVE_IOCTL_FIONBIO 1 +#define HAVE_IOCTLSOCKET 1 +#define HAVE_IOCTLSOCKET_FIONBIO 1 +#define HAVE_LIMITS_H 1 +#define HAVE_LOCALE_H 1 +#define HAVE_LONGLONG 1 +#define HAVE_MEMORY_H 1 +#define HAVE_NETDB_H 1 +#define HAVE_NETINET_IN_H 1 +#define HAVE_NETINET_TCP_H 1 +#define HAVE_NET_IF_H 1 +#define HAVE_PROCESS_H 1 +#define HAVE_RECV 1 +#define HAVE_RECVFROM 1 +#define HAVE_SELECT 1 +#define HAVE_SEND 1 +#define HAVE_SETJMP_H 1 +#define HAVE_SETLOCALE 1 +#define HAVE_SETMODE 1 +#define HAVE_SIGNAL 1 +#define HAVE_SOCKET 1 +#define HAVE_SPNEGO 1 +#define HAVE_STRDUP 1 +#define HAVE_STRICMP 1 +#define HAVE_STRTOLL 1 +#define HAVE_STRUCT_TIMEVAL 1 +#define HAVE_STRUCT_IN6_ADDR 1 +#define HAVE_SYS_IOCTL_H 1 +#define HAVE_SYS_SOCKET_H 1 +#define HAVE_SYS_STAT_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_TERMIOS_H 1 +#define HAVE_TIME_H 1 +#define HAVE_UNISTD_H 1 + +#define NEED_MALLOC_H 1 + +#define RETSIGTYPE void +#define SIZEOF_INT 4 +#define SIZEOF_LONG_DOUBLE 16 +#define SIZEOF_SHORT 2 +#define STDC_HEADERS 1 +#define TIME_WITH_SYS_TIME 1 + +/* Qualifiers for send(), recv(), recvfrom() and getnameinfo(). */ + +#define SEND_TYPE_ARG1 int +#define SEND_QUAL_ARG2 const +#define SEND_TYPE_ARG2 void * +#define SEND_TYPE_ARG3 int +#define SEND_TYPE_ARG4 int +#define SEND_TYPE_RETV int + +#define RECV_TYPE_ARG1 int +#define RECV_TYPE_ARG2 void * +#define RECV_TYPE_ARG3 int +#define RECV_TYPE_ARG4 int +#define RECV_TYPE_RETV int + +#define RECVFROM_TYPE_ARG1 int +#define RECVFROM_TYPE_ARG2 void +#define RECVFROM_TYPE_ARG3 int +#define RECVFROM_TYPE_ARG4 int +#define RECVFROM_TYPE_ARG5 struct sockaddr +#define RECVFROM_TYPE_ARG6 int +#define RECVFROM_TYPE_RETV int +#define RECVFROM_TYPE_ARG2_IS_VOID 1 + +#define GETNAMEINFO_QUAL_ARG1 const +#define GETNAMEINFO_TYPE_ARG1 struct sockaddr * +#define GETNAMEINFO_TYPE_ARG2 int +#define GETNAMEINFO_TYPE_ARG46 int +#define GETNAMEINFO_TYPE_ARG7 int + +#define BSD + +/* CURLDEBUG definition enables memory tracking */ +/* #define CURLDEBUG */ + +/* USE_ZLIB on cmd-line */ +#ifdef USE_ZLIB + #define HAVE_ZLIB_H 1 + #define HAVE_LIBZ 1 +#endif + +/* USE_SSLEAY on cmd-line */ +#ifdef USE_SSLEAY + #define HAVE_CRYPTO_CLEANUP_ALL_EX_DATA 1 + #define HAVE_OPENSSL_ENGINE_H 1 + #define OPENSSL_NO_KRB5 1 + #define USE_OPENSSL 1 +#endif + +/* to disable LDAP */ +#define CURL_DISABLE_LDAP 1 + +#define in_addr_t u_long + +#if defined(__HIGHC__) || \ + (defined(__GNUC__) && (__GNUC__ < 4)) +#define ssize_t int +#endif + +#define CURL_CA_BUNDLE getenv("CURL_CA_BUNDLE") + +/* Target HAVE_x section */ + +#if defined(DJGPP) + #define HAVE_BASENAME 1 + #define HAVE_STRCASECMP 1 + #define HAVE_SIGACTION 1 + #define HAVE_SIGSETJMP 1 + #define HAVE_SYS_TIME_H 1 + #define HAVE_VARIADIC_MACROS_GCC 1 + + #if (DJGPP_MINOR >= 4) + #define HAVE_STRLCAT 1 + #endif + + /* Because djgpp <= 2.03 doesn't have snprintf() etc. */ + #if (DJGPP_MINOR < 4) + #define _MPRINTF_REPLACE + #endif + +#elif defined(__WATCOMC__) + #define HAVE_STRCASECMP 1 + +#elif defined(__HIGHC__) + #define HAVE_SYS_TIME_H 1 +#endif + +#ifdef MSDOS /* Watt-32 */ + #define HAVE_CLOSESOCKET_CAMEL 1 + #define CloseSocket(s) close_s((s)) +#endif + +#undef word +#undef byte + +#endif /* HEADER_CONFIG_DOS_H */ + diff --git a/lib/connect.c b/lib/connect.c index eb6df71d..e178633d 100644 --- a/lib/connect.c +++ b/lib/connect.c @@ -112,10 +112,11 @@ struct Curl_sockaddr_ex { static bool verifyconnect(curl_socket_t sockfd, int *error); -static curl_socket_t +static CURLcode singleipconnect(struct connectdata *conn, const Curl_addrinfo *ai, /* start connecting to this */ long timeout_ms, + curl_socket_t *sock, bool *connected); /* @@ -173,6 +174,9 @@ long Curl_timeleft(struct connectdata *conn, /* substract elapsed time */ timeout_ms -= Curl_tvdiff(*nowp, data->progress.t_startsingle); + if(!timeout_ms) + /* avoid returning 0 as that means no timeout! */ + return -1; return timeout_ms; } @@ -180,16 +184,13 @@ long Curl_timeleft(struct connectdata *conn, /* * waitconnect() waits for a TCP connect on the given socket for the specified * number if milliseconds. It returns: - * 0 fine connect - * -1 select() error - * 1 select() timeout - * 2 select() returned with an error condition fd_set */ #define WAITCONN_CONNECTED 0 #define WAITCONN_SELECT_ERROR -1 #define WAITCONN_TIMEOUT 1 #define WAITCONN_FDSET_ERROR 2 +#define WAITCONN_ABORTED 3 static int waitconnect(struct connectdata *conn, @@ -209,9 +210,8 @@ int waitconnect(struct connectdata *conn, /* now select() until we get connect or timeout */ rc = Curl_socket_ready(CURL_SOCKET_BAD, sockfd, (int)(timeout_msec>1000? 1000:timeout_msec)); - if(Curl_pgrsUpdate(conn)) - return CURLE_ABORTED_BY_CALLBACK; + return WAITCONN_ABORTED; if(-1 == rc) /* error, no connect here, try next */ @@ -492,37 +492,130 @@ static bool verifyconnect(curl_socket_t sockfd, int *error) /* Used within the multi interface. Try next IP address, return TRUE if no more address exists or error */ -static bool trynextip(struct connectdata *conn, - int sockindex, - bool *connected) +static CURLcode trynextip(struct connectdata *conn, + int sockindex, + bool *connected) { curl_socket_t sockfd; Curl_addrinfo *ai; - /* first close the failed socket */ - sclose(conn->sock[sockindex]); + /* First clean up after the failed socket. + Don't close it yet to ensure that the next IP's socket gets a different + file descriptor, which can prevent bugs when the curl_multi_socket_action + interface is used with certain select() replacements such as kqueue. */ + curl_socket_t fd_to_close = conn->sock[sockindex]; conn->sock[sockindex] = CURL_SOCKET_BAD; *connected = FALSE; - if(sockindex != FIRSTSOCKET) - return TRUE; /* no next */ + if(sockindex != FIRSTSOCKET) { + sclose(fd_to_close); + return CURLE_COULDNT_CONNECT; /* no next */ + } /* try the next address */ ai = conn->ip_addr->ai_next; while(ai) { - sockfd = singleipconnect(conn, ai, 0L, connected); + CURLcode res = singleipconnect(conn, ai, 0L, &sockfd, connected); + if(res) + return res; if(sockfd != CURL_SOCKET_BAD) { /* store the new socket descriptor */ conn->sock[sockindex] = sockfd; conn->ip_addr = ai; - return FALSE; + sclose(fd_to_close); + return CURLE_OK; } ai = ai->ai_next; } + sclose(fd_to_close); + return CURLE_COULDNT_CONNECT; +} + +/* retrieves ip address and port from a sockaddr structure */ +static bool getaddressinfo(struct sockaddr* sa, char* addr, + long* port) +{ + unsigned short us_port; + struct sockaddr_in* si = NULL; +#ifdef ENABLE_IPV6 + struct sockaddr_in6* si6 = NULL; +#endif + + switch (sa->sa_family) { + case AF_INET: + si = (struct sockaddr_in*) sa; + if(Curl_inet_ntop(sa->sa_family, &si->sin_addr, + addr, MAX_IPADR_LEN) == NULL) + return FALSE; + us_port = ntohs(si->sin_port); + *port = us_port; + break; +#ifdef ENABLE_IPV6 + case AF_INET6: + si6 = (struct sockaddr_in6*)sa; + if(Curl_inet_ntop(sa->sa_family, &si6->sin6_addr, + addr, MAX_IPADR_LEN) == NULL) + return FALSE; + us_port = ntohs(si6->sin6_port); + *port = us_port; + break; +#endif + default: + addr[0] = '\0'; + *port = 0; + } return TRUE; } +/* retrieves the start/end point information of a socket of an established + connection */ +void Curl_updateconninfo(struct connectdata *conn, curl_socket_t sockfd) +{ + int error; + curl_socklen_t len; + struct Curl_sockaddr_storage ssrem; + struct Curl_sockaddr_storage ssloc; + struct SessionHandle *data = conn->data; + struct PureInfo *info = &conn->data->info; + + if(conn->bits.reuse) + /* reusing same connection */ + return; + + len = sizeof(struct Curl_sockaddr_storage); + if(getpeername(sockfd, (struct sockaddr*) &ssrem, &len)) { + error = SOCKERRNO; + failf(data, "getpeername() failed with errno %d: %s", + error, Curl_strerror(conn, error)); + return; + } + + len = sizeof(struct Curl_sockaddr_storage); + if(getsockname(sockfd, (struct sockaddr*) &ssloc, &len)) { + error = SOCKERRNO; + failf(data, "getsockname() failed with errno %d: %s", + error, Curl_strerror(conn, error)); + return; + } + + if(!getaddressinfo((struct sockaddr*)&ssrem, + info->ip, &info->port)) { + error = ERRNO; + failf(data, "ssrem inet_ntop() failed with errno %d: %s", + error, Curl_strerror(conn, error)); + return; + } + + if(!getaddressinfo((struct sockaddr*)&ssloc, + info->localip, &info->localport)) { + error = ERRNO; + failf(data, "ssloc inet_ntop() failed with errno %d: %s", + error, Curl_strerror(conn, error)); + return; + } +} + /* * Curl_is_connected() is used from the multi interface to check if the * firstsocket has connected. @@ -537,6 +630,7 @@ CURLcode Curl_is_connected(struct connectdata *conn, CURLcode code = CURLE_OK; curl_socket_t sockfd = conn->sock[sockindex]; long allow = DEFAULT_CONNECT_TIMEOUT; + int error = 0; DEBUGASSERT(sockindex >= FIRSTSOCKET && sockindex <= SECONDARYSOCKET); @@ -544,13 +638,6 @@ CURLcode Curl_is_connected(struct connectdata *conn, if(conn->bits.tcpconnect) { /* we are connected already! */ - long allow_total = 0; - - /* subtract the most strict timeout of the ones */ - if(data->set.timeout) - allow_total = data->set.timeout; - - Curl_expire(data, allow_total); *connected = TRUE; return CURLE_OK; } @@ -564,52 +651,52 @@ CURLcode Curl_is_connected(struct connectdata *conn, return CURLE_OPERATION_TIMEDOUT; } - Curl_expire(data, allow); - /* check for connect without timeout as we want to return immediately */ rc = waitconnect(conn, sockfd, 0); + if(WAITCONN_TIMEOUT == rc) + /* not an error, but also no connection yet */ + return code; if(WAITCONN_CONNECTED == rc) { - int error; if(verifyconnect(sockfd, &error)) { /* we are connected, awesome! */ conn->bits.tcpconnect = TRUE; *connected = TRUE; + Curl_pgrsTime(data, TIMER_CONNECT); /* connect done */ + Curl_verboseconnect(conn); + Curl_updateconninfo(conn, sockfd); + return CURLE_OK; } /* nope, not connected for real */ - data->state.os_errno = error; - infof(data, "Connection failed\n"); - if(trynextip(conn, sockindex, connected)) { - failf(data, "Failed connect to %s:%ld; %s", - conn->host.name, conn->port, Curl_strerror(conn, error)); - code = CURLE_COULDNT_CONNECT; - } } - else if(WAITCONN_TIMEOUT != rc) { - int error = 0; - + else { /* nope, not connected */ if(WAITCONN_FDSET_ERROR == rc) { (void)verifyconnect(sockfd, &error); - data->state.os_errno = error; - infof(data, "%s\n",Curl_strerror(conn,error)); + infof(data, "%s\n",Curl_strerror(conn, error)); } else infof(data, "Connection failed\n"); - - if(trynextip(conn, sockindex, connected)) { - error = SOCKERRNO; - data->state.os_errno = error; - failf(data, "Failed connect to %s:%ld; %s", - conn->host.name, conn->port, Curl_strerror(conn, error)); - code = CURLE_COULDNT_CONNECT; - } } + /* - * If the connection failed here, we should attempt to connect to the "next - * address" for the given host. + * The connection failed here, we should attempt to connect to the "next + * address" for the given host. But first remember the latest error. */ + if(error) { + data->state.os_errno = error; + SET_SOCKERRNO(error); + } + + code = trynextip(conn, sockindex, connected); + + if(code) { + error = SOCKERRNO; + data->state.os_errno = error; + failf(data, "Failed connect to %s:%ld; %s", + conn->host.name, conn->port, Curl_strerror(conn, error)); + } return code; } @@ -691,12 +778,20 @@ void Curl_sndbufset(curl_socket_t sockfd) #endif -/* singleipconnect() connects to the given IP only, and it may return without - having connected if used from the multi interface. */ -static curl_socket_t +/* + * singleipconnect() + * + * Note that even on connect fail it returns CURLE_OK, but with 'sock' set to + * CURL_SOCKET_BAD. Other errors will however return proper errors. + * + * singleipconnect() connects to the given IP only, and it may return without + * having connected if used from the multi interface. + */ +static CURLcode singleipconnect(struct connectdata *conn, const Curl_addrinfo *ai, long timeout_ms, + curl_socket_t *sockp, bool *connected) { struct Curl_sockaddr_ex addr; @@ -706,13 +801,15 @@ singleipconnect(struct connectdata *conn, bool isconnected; struct SessionHandle *data = conn->data; curl_socket_t sockfd; - CURLcode res; + CURLcode res = CURLE_OK; const void *iptoprint; struct sockaddr_in * const sa4 = (void *)&addr.sa_addr; #ifdef ENABLE_IPV6 struct sockaddr_in6 * const sa6 = (void *)&addr.sa_addr; #endif + *sockp = CURL_SOCKET_BAD; + /* * The Curl_sockaddr_ex structure is basically libcurl's external API * curl_sockaddr structure with enough space available to directly hold @@ -751,7 +848,7 @@ singleipconnect(struct connectdata *conn, if(sockfd == CURL_SOCKET_BAD) /* no socket, no connection */ - return CURL_SOCKET_BAD; + return CURLE_OK; #if defined(ENABLE_IPV6) && defined(HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID) if (conn->scope && (addr.family == AF_INET6)) @@ -804,7 +901,7 @@ singleipconnect(struct connectdata *conn, CURLSOCKTYPE_IPCXN); if(error) { sclose(sockfd); /* close the socket and bail out */ - return CURL_SOCKET_BAD; + return res; } } @@ -812,7 +909,7 @@ singleipconnect(struct connectdata *conn, res = bindlocal(conn, sockfd, addr.family); if(res) { sclose(sockfd); /* close socket and bail out */ - return CURL_SOCKET_BAD; + return res; } /* set socket non-blocking */ @@ -840,6 +937,10 @@ singleipconnect(struct connectdata *conn, #endif #endif rc = waitconnect(conn, sockfd, timeout_ms); + if(WAITCONN_ABORTED == rc) { + sclose(sockfd); + return CURLE_ABORTED_BY_CALLBACK; + } break; default: /* unknown error, fallthrough and try another address! */ @@ -855,7 +956,8 @@ singleipconnect(struct connectdata *conn, if((WAITCONN_TIMEOUT == rc) && (data->state.used_interface == Curl_if_multi)) { /* Timeout when running the multi interface */ - return sockfd; + *sockp = sockfd; + return CURLE_OK; } isconnected = verifyconnect(sockfd, &error); @@ -864,7 +966,9 @@ singleipconnect(struct connectdata *conn, /* we are connected, awesome! */ *connected = TRUE; /* this is a true connect */ infof(data, "connected\n"); - return sockfd; + Curl_updateconninfo(conn, sockfd); + *sockp = sockfd; + return CURLE_OK; } else if(WAITCONN_TIMEOUT == rc) infof(data, "Timeout\n"); @@ -876,7 +980,7 @@ singleipconnect(struct connectdata *conn, /* connect failed or timed out */ sclose(sockfd); - return CURL_SOCKET_BAD; + return CURLE_OK; } /* @@ -918,7 +1022,6 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */ failf(data, "Connection time-out"); return CURLE_OPERATION_TIMEDOUT; } - Curl_expire(data, timeout_ms); /* Max time for each address */ num_addr = Curl_num_addresses(remotehost->addr); @@ -941,7 +1044,11 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */ curr_addr = curr_addr->ai_next, aliasindex++) { /* start connecting to the IP curr_addr points to */ - sockfd = singleipconnect(conn, curr_addr, timeout_per_addr, connected); + CURLcode res = + singleipconnect(conn, curr_addr, timeout_per_addr, &sockfd, connected); + + if(res) + return res; if(sockfd != CURL_SOCKET_BAD) break; @@ -979,12 +1086,12 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */ * Used to extract socket and connectdata struct for the most recent * transfer on the given SessionHandle. * - * The socket 'long' will be -1 in case of failure! + * The returned socket will be CURL_SOCKET_BAD in case of failure! */ -CURLcode Curl_getconnectinfo(struct SessionHandle *data, - long *param_longp, - struct connectdata **connp) +curl_socket_t Curl_getconnectinfo(struct SessionHandle *data, + struct connectdata **connp) { + curl_socket_t sockfd; if((data->state.lastconnect != -1) && (data->state.connc->connects[data->state.lastconnect] != NULL)) { struct connectdata *c = @@ -992,13 +1099,13 @@ CURLcode Curl_getconnectinfo(struct SessionHandle *data, if(connp) /* only store this if the caller cares for it */ *connp = c; - *param_longp = c->sock[FIRSTSOCKET]; + sockfd = c->sock[FIRSTSOCKET]; /* we have a socket connected, let's determine if the server shut down */ /* determine if ssl */ if(c->ssl[FIRSTSOCKET].use) { /* use the SSL context */ if(!Curl_ssl_check_cxn(c)) - *param_longp = -1; /* FIN received */ + return CURL_SOCKET_BAD; /* FIN received */ } /* Minix 3.1 doesn't support any flags on recv; just assume socket is OK */ #ifdef MSG_PEEK @@ -1007,13 +1114,13 @@ CURLcode Curl_getconnectinfo(struct SessionHandle *data, char buf; if(recv((RECV_TYPE_ARG1)c->sock[FIRSTSOCKET], (RECV_TYPE_ARG2)&buf, (RECV_TYPE_ARG3)1, (RECV_TYPE_ARG4)MSG_PEEK) == 0) { - *param_longp = -1; /* FIN received */ + return CURL_SOCKET_BAD; /* FIN received */ } } #endif } else - *param_longp = -1; + return CURL_SOCKET_BAD; - return CURLE_OK; + return sockfd; } diff --git a/lib/connect.h b/lib/connect.h index 36ea4f63..2c6b10a3 100644 --- a/lib/connect.h +++ b/lib/connect.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -47,11 +47,10 @@ long Curl_timeleft(struct connectdata *conn, * Used to extract socket and connectdata struct for the most recent * transfer on the given SessionHandle. * - * The socket 'long' will be -1 in case of failure! + * The returned socket will be CURL_SOCKET_BAD in case of failure! */ -CURLcode Curl_getconnectinfo(struct SessionHandle *data, - long *param_longp, - struct connectdata **connp); +curl_socket_t Curl_getconnectinfo(struct SessionHandle *data, + struct connectdata **connp); #ifdef WIN32 /* When you run a program that uses the Windows Sockets API, you may @@ -68,4 +67,6 @@ void Curl_sndbufset(curl_socket_t sockfd); #define Curl_sndbufset(y) #endif +void Curl_updateconninfo(struct connectdata *conn, curl_socket_t sockfd); + #endif diff --git a/lib/content_encoding.c b/lib/content_encoding.c index 69aa7bcc..6fb7c8d3 100644 --- a/lib/content_encoding.c +++ b/lib/content_encoding.c @@ -103,7 +103,7 @@ inflate_stream(struct connectdata *conn, status = inflate(z, Z_SYNC_FLUSH); if(status == Z_OK || status == Z_STREAM_END) { allow_restart = 0; - if(DSIZ - z->avail_out) { + if((DSIZ - z->avail_out) && (!k->ignorebody)) { result = Curl_client_write(conn, CLIENTWRITE_BODY, decomp, DSIZ - z->avail_out); /* if !CURLE_OK, clean up, return */ @@ -123,7 +123,9 @@ inflate_stream(struct connectdata *conn, } /* Done with these bytes, exit */ - if(status == Z_OK && z->avail_in == 0) { + + /* status is always Z_OK at this point! */ + if(z->avail_in == 0) { free(decomp); return result; } @@ -247,7 +249,6 @@ static enum { /* Skip over the NUL */ --len; - ++data; } if(flags & HEAD_CRC) { @@ -255,7 +256,6 @@ static enum { return GZIP_UNDERFLOW; len -= 2; - data += 2; } *headerlen = totallen - len; diff --git a/lib/curl_addrinfo.c b/lib/curl_addrinfo.c index c38a1ed2..5098fa43 100644 --- a/lib/curl_addrinfo.c +++ b/lib/curl_addrinfo.c @@ -151,7 +151,10 @@ Curl_getaddrinfo_ex(const char *nodename, ca->ai_next = NULL; if((ai->ai_addrlen > 0) && (ai->ai_addr != NULL)) { - ca->ai_addrlen = ai->ai_addrlen; + /* typecast below avoid warning on at least win64: + conversion from 'size_t' to 'curl_socklen_t', possible loss of data + */ + ca->ai_addrlen = (curl_socklen_t)ai->ai_addrlen; if((ca->ai_addr = malloc(ca->ai_addrlen)) == NULL) { error = EAI_MEMORY; free(ca); diff --git a/lib/curl_config.h.cmake b/lib/curl_config.h.cmake index fd6b32aa..deebe71d 100644 --- a/lib/curl_config.h.cmake +++ b/lib/curl_config.h.cmake @@ -58,10 +58,7 @@ /* to enable hidden symbols */ #cmakedefine CURL_HIDDEN_SYMBOLS ${CURL_HIDDEN_SYMBOLS} -/* W$ LDAP with non-W$ compiler */ -#cmakedefine CURL_LDAP_HYBRID ${CURL_LDAP_HYBRID} - -/* Use W$ LDAP implementation */ +/* Use Windows LDAP implementation */ #cmakedefine CURL_LDAP_WIN ${CURL_LDAP_WIN} /* when not building a shared library */ @@ -889,6 +886,9 @@ /* if GnuTLS is enabled */ #cmakedefine USE_GNUTLS ${USE_GNUTLS} +/* if PolarSSL is enabled */ +#cmakedefine USE_POLARSSL ${USE_POLARSSL} + /* if libSSH2 is in use */ #cmakedefine USE_LIBSSH2 ${USE_LIBSSH2} diff --git a/lib/curl_config.h.in b/lib/curl_config.h.in index 846fb27f..15ea387f 100644 --- a/lib/curl_config.h.in +++ b/lib/curl_config.h.in @@ -24,6 +24,9 @@ /* to disable FTP */ #undef CURL_DISABLE_FTP +/* to disable Gopher */ +#undef CURL_DISABLE_GOPHER + /* to disable HTTP */ #undef CURL_DISABLE_HTTP @@ -63,10 +66,7 @@ /* to enable hidden symbols */ #undef CURL_HIDDEN_SYMBOLS -/* W$ LDAP with non-W$ compiler */ -#undef CURL_LDAP_HYBRID - -/* Use W$ LDAP implementation */ +/* Use Windows LDAP implementation */ #undef CURL_LDAP_WIN /* when not building a shared library */ @@ -352,6 +352,9 @@ /* Define to 1 if you have the ldap.h header file. */ #undef HAVE_LDAP_H +/* Define to 1 if you have the `ldap_init_fd' function. */ +#undef HAVE_LDAP_INIT_FD + /* Use LDAPS implementation */ #undef HAVE_LDAP_SSL @@ -361,6 +364,9 @@ /* Define to 1 if you have the `ldap_url_parse' function. */ #undef HAVE_LDAP_URL_PARSE +/* Define to 1 if you have the `gcrypt' library (-lgcrypt). */ +#undef HAVE_LIBGCRYPT + /* Define to 1 if you have the <libgen.h> header file. */ #undef HAVE_LIBGEN_H @@ -373,12 +379,24 @@ /* Define to 1 if you have the `resolve' library (-lresolve). */ #undef HAVE_LIBRESOLVE +/* Define to 1 if you have the <librtmp/rtmp.h> header file. */ +#undef HAVE_LIBRTMP_RTMP_H + /* Define to 1 if you have the `ssh2' library (-lssh2). */ #undef HAVE_LIBSSH2 +/* Define to 1 if you have the `libssh2_exit' function. */ +#undef HAVE_LIBSSH2_EXIT + /* Define to 1 if you have the <libssh2.h> header file. */ #undef HAVE_LIBSSH2_H +/* Define to 1 if you have the `libssh2_init' function. */ +#undef HAVE_LIBSSH2_INIT + +/* Define to 1 if you have the `libssh2_scp_send64' function. */ +#undef HAVE_LIBSSH2_SCP_SEND64 + /* Define to 1 if you have the `libssh2_version' function. */ #undef HAVE_LIBSSH2_VERSION @@ -482,6 +500,9 @@ /* Define to 1 if you have a working POSIX-style strerror_r function. */ #undef HAVE_POSIX_STRERROR_R +/* if you have <pthread.h> */ +#undef HAVE_PTHREAD_H + /* Define to 1 if you have the <pwd.h> header file. */ #undef HAVE_PWD_H @@ -912,6 +933,9 @@ /* if GnuTLS is enabled */ #undef USE_GNUTLS +/* if librtmp is in use */ +#undef USE_LIBRTMP + /* if libSSH2 is in use */ #undef USE_LIBSSH2 @@ -921,12 +945,21 @@ /* if NSS is enabled */ #undef USE_NSS +/* Use OpenLDAP-specific code */ +#undef USE_OPENLDAP + /* if OpenSSL is in use */ #undef USE_OPENSSL +/* if PolarSSL is enabled */ +#undef USE_POLARSSL + /* if SSL is enabled */ #undef USE_SSLEAY +/* if you want POSIX threaded DNS lookup */ +#undef USE_THREADS_POSIX + /* Define to 1 if you are building a Windows target without large file support. */ #undef USE_WIN32_LARGE_FILES diff --git a/lib/curl_fnmatch.c b/lib/curl_fnmatch.c new file mode 100644 index 00000000..ad4ec187 --- /dev/null +++ b/lib/curl_fnmatch.c @@ -0,0 +1,424 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, 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. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#include "curl_fnmatch.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include <curl/mprintf.h> + +#include "curl_memory.h" +/* The last #include file should be: */ +#include "memdebug.h" + +#define CURLFNM_CHARSET_LEN (sizeof(char) * 256) +#define CURLFNM_CHSET_SIZE (CURLFNM_CHARSET_LEN + 15) + +#define CURLFNM_NEGATE CURLFNM_CHARSET_LEN + +#define CURLFNM_ALNUM (CURLFNM_CHARSET_LEN + 1) +#define CURLFNM_DIGIT (CURLFNM_CHARSET_LEN + 2) +#define CURLFNM_XDIGIT (CURLFNM_CHARSET_LEN + 3) +#define CURLFNM_ALPHA (CURLFNM_CHARSET_LEN + 4) +#define CURLFNM_PRINT (CURLFNM_CHARSET_LEN + 5) +#define CURLFNM_BLANK (CURLFNM_CHARSET_LEN + 6) +#define CURLFNM_LOWER (CURLFNM_CHARSET_LEN + 7) +#define CURLFNM_GRAPH (CURLFNM_CHARSET_LEN + 8) +#define CURLFNM_SPACE (CURLFNM_CHARSET_LEN + 9) +#define CURLFNM_UPPER (CURLFNM_CHARSET_LEN + 10) + +typedef enum { + CURLFNM_LOOP_DEFAULT = 0, + CURLFNM_LOOP_BACKSLASH +} loop_state; + +typedef enum { + CURLFNM_SCHS_DEFAULT = 0, + CURLFNM_SCHS_MAYRANGE, + CURLFNM_SCHS_MAYRANGE2, + CURLFNM_SCHS_RIGHTBR, + CURLFNM_SCHS_RIGHTBRLEFTBR +} setcharset_state; + +typedef enum { + CURLFNM_PKW_INIT = 0, + CURLFNM_PKW_DDOT +} parsekey_state; + +#define SETCHARSET_OK 1 +#define SETCHARSET_FAIL 0 + +static int parsekeyword(unsigned char **pattern, unsigned char *charset) +{ + parsekey_state state = CURLFNM_PKW_INIT; +#define KEYLEN 10 + char keyword[KEYLEN] = { 0 }; + int found = FALSE; + int i; + unsigned char *p = *pattern; + for(i = 0; !found; i++) { + char c = *p++; + if(i >= KEYLEN) + return SETCHARSET_FAIL; + switch(state) { + case CURLFNM_PKW_INIT: + if(ISALPHA(c) && ISLOWER(c)) + keyword[i] = c; + else if(c == ':') + state = CURLFNM_PKW_DDOT; + else + return 0; + break; + case CURLFNM_PKW_DDOT: + if(c == ']') + found = TRUE; + else + return SETCHARSET_FAIL; + } + } +#undef KEYLEN + + *pattern = p; /* move caller's pattern pointer */ + if(strcmp(keyword, "digit") == 0) + charset[CURLFNM_DIGIT] = 1; + else if(strcmp(keyword, "alnum") == 0) + charset[CURLFNM_ALNUM] = 1; + else if(strcmp(keyword, "alpha") == 0) + charset[CURLFNM_ALPHA] = 1; + else if(strcmp(keyword, "xdigit") == 0) + charset[CURLFNM_XDIGIT] = 1; + else if(strcmp(keyword, "print") == 0) + charset[CURLFNM_PRINT] = 1; + else if(strcmp(keyword, "graph") == 0) + charset[CURLFNM_GRAPH] = 1; + else if(strcmp(keyword, "space") == 0) + charset[CURLFNM_SPACE] = 1; + else if(strcmp(keyword, "blank") == 0) + charset[CURLFNM_BLANK] = 1; + else if(strcmp(keyword, "upper") == 0) + charset[CURLFNM_UPPER] = 1; + else if(strcmp(keyword, "lower") == 0) + charset[CURLFNM_LOWER] = 1; + else + return SETCHARSET_FAIL; + return SETCHARSET_OK; +} + +/* returns 1 (true) if pattern is OK, 0 if is bad ("p" is pattern pointer) */ +static int setcharset(unsigned char **p, unsigned char *charset) +{ + setcharset_state state = CURLFNM_SCHS_DEFAULT; + unsigned char rangestart = 0; + unsigned char lastchar = 0; + bool something_found = FALSE; + unsigned char c; + for(;;) { + c = **p; + switch(state) { + case CURLFNM_SCHS_DEFAULT: + if(ISALNUM(c)) { /* ASCII value */ + rangestart = c; + charset[c] = 1; + (*p)++; + state = CURLFNM_SCHS_MAYRANGE; + something_found = TRUE; + } + else if(c == ']') { + if(something_found) + return SETCHARSET_OK; + else + something_found = TRUE; + state = CURLFNM_SCHS_RIGHTBR; + charset[c] = 1; + (*p)++; + } + else if(c == '[') { + char c2 = *((*p)+1); + if(c2 == ':') { /* there has to be a keyword */ + (*p) += 2; + if(parsekeyword(p, charset)) { + state = CURLFNM_SCHS_DEFAULT; + } + else + return SETCHARSET_FAIL; + } + else { + charset[c] = 1; + (*p)++; + } + something_found = TRUE; + } + else if(c == '?' || c == '*') { + something_found = TRUE; + charset[c] = 1; + (*p)++; + } + else if(c == '^' || c == '!') { + if(!something_found) { + if(charset[CURLFNM_NEGATE]) { + charset[c] = 1; + something_found = TRUE; + } + else + charset[CURLFNM_NEGATE] = 1; /* negate charset */ + } + else + charset[c] = 1; + (*p)++; + } + else if(c == '\\') { + c = *(++(*p)); + if(ISPRINT((c))) { + something_found = TRUE; + state = CURLFNM_SCHS_MAYRANGE; + charset[c] = 1; + rangestart = c; + (*p)++; + } + else + return SETCHARSET_FAIL; + } + else if(c == '\0') { + return SETCHARSET_FAIL; + } + else { + charset[c] = 1; + (*p)++; + something_found = TRUE; + } + break; + case CURLFNM_SCHS_MAYRANGE: + if(c == '-') { + charset[c] = 1; + (*p)++; + lastchar = '-'; + state = CURLFNM_SCHS_MAYRANGE2; + } + else if(c == '[') { + state = CURLFNM_SCHS_DEFAULT; + } + else if(ISALNUM(c)) { + charset[c] = 1; + (*p)++; + } + else if(c == '\\') { + c = *(++(*p)); + if(ISPRINT(c)) { + charset[c] = 1; + (*p)++; + } + else + return SETCHARSET_FAIL; + } + else if(c == ']') { + return SETCHARSET_OK; + } + else + return SETCHARSET_FAIL; + break; + case CURLFNM_SCHS_MAYRANGE2: + if(c == '\\') { + c = *(++(*p)); + if(!ISPRINT(c)) + return SETCHARSET_FAIL; + } + if(c == ']') { + return SETCHARSET_OK; + } + else if(c == '\\') { + c = *(++(*p)); + if(ISPRINT(c)) { + charset[c] = 1; + state = CURLFNM_SCHS_DEFAULT; + (*p)++; + } + else + return SETCHARSET_FAIL; + } + if(c >= rangestart) { + if((ISLOWER(c) && ISLOWER(rangestart)) || + (ISDIGIT(c) && ISDIGIT(rangestart)) || + (ISUPPER(c) && ISUPPER(rangestart))) { + charset[lastchar] = 0; + rangestart++; + while(rangestart++ <= c) + charset[rangestart-1] = 1; + (*p)++; + state = CURLFNM_SCHS_DEFAULT; + } + else + return SETCHARSET_FAIL; + } + break; + case CURLFNM_SCHS_RIGHTBR: + if(c == '[') { + state = CURLFNM_SCHS_RIGHTBRLEFTBR; + charset[c] = 1; + (*p)++; + } + else if(c == ']') { + return SETCHARSET_OK; + } + else if(c == '\0') { + return SETCHARSET_FAIL; + } + else if(ISPRINT(c)) { + charset[c] = 1; + (*p)++; + state = CURLFNM_SCHS_DEFAULT; + } + else + /* used 'goto fail' instead of 'return SETCHARSET_FAIL' to avoid a + * nonsense warning 'statement not reached' at end of the fnc when + * compiling on Solaris */ + goto fail; + break; + case CURLFNM_SCHS_RIGHTBRLEFTBR: + if(c == ']') { + return SETCHARSET_OK; + } + else { + state = CURLFNM_SCHS_DEFAULT; + charset[c] = 1; + (*p)++; + } + break; + } + } +fail: + return SETCHARSET_FAIL; +} + +static int loop(const unsigned char *pattern, const unsigned char *string) +{ + loop_state state = CURLFNM_LOOP_DEFAULT; + unsigned char *p = (unsigned char *)pattern; + unsigned char *s = (unsigned char *)string; + unsigned char charset[CURLFNM_CHSET_SIZE] = { 0 }; + int rc = 0; + + for (;;) { + switch(state) { + case CURLFNM_LOOP_DEFAULT: + if(*p == '*') { + while(*(p+1) == '*') /* eliminate multiple stars */ + p++; + if(*s == '\0' && *(p+1) == '\0') + return CURL_FNMATCH_MATCH; + rc = loop(p + 1, s); /* *.txt matches .txt <=> .txt matches .txt */ + if(rc == CURL_FNMATCH_MATCH) + return CURL_FNMATCH_MATCH; + if(*s) /* let the star eat up one character */ + s++; + else + return CURL_FNMATCH_NOMATCH; + } + else if(*p == '?') { + if(ISPRINT(*s)) { + s++; + p++; + } + else if(*s == '\0') + return CURL_FNMATCH_NOMATCH; + else + return CURL_FNMATCH_FAIL; /* cannot deal with other character */ + } + else if(*p == '\0') { + if(*s == '\0') + return CURL_FNMATCH_MATCH; + else + return CURL_FNMATCH_NOMATCH; + } + else if(*p == '\\') { + state = CURLFNM_LOOP_BACKSLASH; + p++; + } + else if(*p == '[') { + unsigned char *pp = p+1; /* cannot handle with pointer to register */ + if(setcharset(&pp, charset)) { + int found = FALSE; + if(charset[(unsigned int)*s]) + found = TRUE; + else if(charset[CURLFNM_ALNUM]) + found = ISALNUM(*s); + else if(charset[CURLFNM_ALPHA]) + found = ISALPHA(*s); + else if(charset[CURLFNM_DIGIT]) + found = ISDIGIT(*s); + else if(charset[CURLFNM_XDIGIT]) + found = ISXDIGIT(*s); + else if(charset[CURLFNM_PRINT]) + found = ISPRINT(*s); + else if(charset[CURLFNM_SPACE]) + found = ISSPACE(*s); + else if(charset[CURLFNM_UPPER]) + found = ISUPPER(*s); + else if(charset[CURLFNM_LOWER]) + found = ISLOWER(*s); + else if(charset[CURLFNM_BLANK]) + found = ISBLANK(*s); + else if(charset[CURLFNM_GRAPH]) + found = ISGRAPH(*s); + + if(charset[CURLFNM_NEGATE]) + found = !found; + + if(found) { + p = pp+1; + s++; + memset(charset, 0, CURLFNM_CHSET_SIZE); + } + else + return CURL_FNMATCH_NOMATCH; + } + else + return CURL_FNMATCH_FAIL; + } + else { + if(*p++ != *s++) + return CURL_FNMATCH_NOMATCH; + } + break; + case CURLFNM_LOOP_BACKSLASH: + if(ISPRINT(*p)) { + if(*p++ == *s++) + state = CURLFNM_LOOP_DEFAULT; + else + return CURL_FNMATCH_NOMATCH; + } + else + return CURL_FNMATCH_FAIL; + break; + } + } +} + +int Curl_fnmatch(void *ptr, const char *pattern, const char *string) +{ + (void)ptr; /* the argument is specified by the curl_fnmatch_callback + prototype, but not used by Curl_fnmatch() */ + if(!pattern || !string) { + return CURL_FNMATCH_FAIL; + } + return loop((unsigned char *)pattern, (unsigned char *)string); +} diff --git a/lib/curl_fnmatch.h b/lib/curl_fnmatch.h new file mode 100644 index 00000000..6335d031 --- /dev/null +++ b/lib/curl_fnmatch.h @@ -0,0 +1,44 @@ +#ifndef HEADER_CURL_FNMATCH_H +#define HEADER_CURL_FNMATCH_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, 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. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#define CURL_FNMATCH_MATCH 0 +#define CURL_FNMATCH_NOMATCH 1 +#define CURL_FNMATCH_FAIL 2 + +/* default pattern matching function + * ================================= + * Implemented with recursive backtracking, if you want to use Curl_fnmatch, + * please note that there is not implemented UTF/UNICODE support. + * + * Implemented features: + * '?' notation, does not match UTF characters + * '*' can also work with UTF string + * [a-zA-Z0-9] enumeration support + * + * keywords: alnum, digit, xdigit, alpha, print, blank, lower, graph, space + * and upper (use as "[[:alnum:]]") + */ +int Curl_fnmatch(void *ptr, const char *pattern, const char *string); + +#endif /* HEADER_CURL_FNMATCH_H */ diff --git a/lib/curl_gethostname.c b/lib/curl_gethostname.c new file mode 100644 index 00000000..7f0bfed5 --- /dev/null +++ b/lib/curl_gethostname.c @@ -0,0 +1,81 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, 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. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#ifdef HAVE_UNISTD_H +# include <unistd.h> +#endif + +#include "curl_gethostname.h" + +/* + * Curl_gethostname() is a wrapper around gethostname() which allows + * overriding the host name that the function would normally return. + * This capability is used by the test suite to verify exact matching + * of NTLM authentication, which exercises libcurl's MD4 and DES code. + * + * For libcurl debug enabled builds host name overriding takes place + * when environment variable CURL_GETHOSTNAME is set, using the value + * held by the variable to override returned host name. + * + * For libcurl shared library release builds the test suite preloads + * another shared library named libhostname using the LD_PRELOAD + * mechanism which intercepts, and might override, the gethostname() + * function call. In this case a given platform must support the + * LD_PRELOAD mechanism and additionally have environment variable + * CURL_GETHOSTNAME set in order to override the returned host name. + * + * For libcurl static library release builds no overriding takes place. + */ + +int Curl_gethostname(char *name, GETHOSTNAME_TYPE_ARG2 namelen) { + +#ifndef HAVE_GETHOSTNAME + + /* Allow compilation and return failure when unavailable */ + (void) name; + (void) namelen; + return -1; + +#else + +#ifdef DEBUGBUILD + + /* Override host name when environment variable CURL_GETHOSTNAME is set */ + const char *force_hostname = getenv("CURL_GETHOSTNAME"); + if(force_hostname) { + strncpy(name, force_hostname, namelen); + name[namelen-1] = '\0'; + return 0; + } + +#endif /* DEBUGBUILD */ + + /* The call to system's gethostname() might get intercepted by the + libhostname library when libcurl is built as a non-debug shared + library when running the test suite. */ + return gethostname(name, namelen); + +#endif + +} diff --git a/lib/curl_gethostname.h b/lib/curl_gethostname.h new file mode 100644 index 00000000..b8ecf88d --- /dev/null +++ b/lib/curl_gethostname.h @@ -0,0 +1,27 @@ +#ifndef HEADER_CURL_GETHOSTNAME_H +#define HEADER_CURL_GETHOSTNAME_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, 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. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +int Curl_gethostname(char *name, GETHOSTNAME_TYPE_ARG2 namelen); + +#endif /* HEADER_CURL_GETHOSTNAME_H */ diff --git a/lib/curl_hmac.h b/lib/curl_hmac.h new file mode 100644 index 00000000..9b65c8c2 --- /dev/null +++ b/lib/curl_hmac.h @@ -0,0 +1,67 @@ +#ifndef HEADER_CURL_HMAC_H +#define HEADER_CURL_HMAC_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, 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. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#ifndef CURL_DISABLE_CRYPTO_AUTH + +typedef void (* HMAC_hinit_func)(void * context); +typedef void (* HMAC_hupdate_func)(void * context, + const unsigned char * data, + unsigned int len); +typedef void (* HMAC_hfinal_func)(unsigned char * result, void * context); + + +/* Per-hash function HMAC parameters. */ + +typedef struct { + HMAC_hinit_func hmac_hinit; /* Initialize context procedure. */ + HMAC_hupdate_func hmac_hupdate; /* Update context with data. */ + HMAC_hfinal_func hmac_hfinal; /* Get final result procedure. */ + unsigned int hmac_ctxtsize; /* Context structure size. */ + unsigned int hmac_maxkeylen; /* Maximum key length (bytes). */ + unsigned int hmac_resultlen; /* Result length (bytes). */ +} HMAC_params; + + +/* HMAC computation context. */ + +typedef struct { + const HMAC_params * hmac_hash; /* Hash function definition. */ + void * hmac_hashctxt1; /* Hash function context 1. */ + void * hmac_hashctxt2; /* Hash function context 2. */ +} HMAC_context; + + +/* Prototypes. */ + +HMAC_context * Curl_HMAC_init(const HMAC_params * hashparams, + const unsigned char * key, + unsigned int keylen); +int Curl_HMAC_update(HMAC_context * context, + const unsigned char * data, + unsigned int len); +int Curl_HMAC_final(HMAC_context * context, unsigned char * result); + +#endif + +#endif /* HEADER_CURL_HMAC_H */ diff --git a/lib/curl_ldap.h b/lib/curl_ldap.h index 1f28afee..3cce4bf7 100644 --- a/lib/curl_ldap.h +++ b/lib/curl_ldap.h @@ -8,7 +8,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, 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,7 +25,8 @@ #ifndef CURL_DISABLE_LDAP extern const struct Curl_handler Curl_handler_ldap; -#ifdef HAVE_LDAP_SSL +#if (defined(USE_OPENLDAP) && defined(USE_SSL)) || \ + (!defined(USE_OPENLDAP) && defined(HAVE_LDAP_SSL)) extern const struct Curl_handler Curl_handler_ldaps; #endif diff --git a/lib/curl_md4.h b/lib/curl_md4.h new file mode 100644 index 00000000..6b6c16e1 --- /dev/null +++ b/lib/curl_md4.h @@ -0,0 +1,33 @@ +#ifndef HEADER_CURL_MD4_H +#define HEADER_CURL_MD4_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, 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. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +/* NSS crypto library does not provide the MD4 hash algorithm, so that we have + * a local implementation of it */ +#ifdef USE_NSS +void Curl_md4it(unsigned char *output, const unsigned char *input, size_t len); +#endif /* USE_NSS */ + +#endif /* HEADER_CURL_MD4_H */ diff --git a/lib/curl_md5.h b/lib/curl_md5.h index cab9915c..ddc61e3e 100644 --- a/lib/curl_md5.h +++ b/lib/curl_md5.h @@ -22,7 +22,13 @@ * ***************************************************************************/ +#ifndef CURL_DISABLE_CRYPTO_AUTH +#include "curl_hmac.h" + +extern const HMAC_params Curl_HMAC_MD5[1]; + void Curl_md5it(unsigned char *output, const unsigned char *input); +#endif #endif /* HEADER_CURL_MD5_H */ diff --git a/lib/curl_rtmp.c b/lib/curl_rtmp.c new file mode 100644 index 00000000..df30dc1f --- /dev/null +++ b/lib/curl_rtmp.c @@ -0,0 +1,284 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 2010, Howard Chu, <hyc@highlandsun.com> + * + * 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. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#ifdef USE_LIBRTMP + +#include "urldata.h" +#include "nonblock.h" /* for curlx_nonblock */ +#include "progress.h" /* for Curl_pgrsSetUploadSize */ +#include "transfer.h" +#include <curl/curl.h> +#include <librtmp/rtmp.h> + +#define _MPRINTF_REPLACE /* use our functions only */ +#include <curl/mprintf.h> + +#include "curl_memory.h" +/* The last #include file should be: */ +#include "memdebug.h" + +#ifdef _WIN32 +#define setsockopt(a,b,c,d,e) (setsockopt)(a,b,c,(const char *)d,(int)e) +#define SET_RCVTIMEO(tv,s) int tv = s*1000 +#else +#define SET_RCVTIMEO(tv,s) struct timeval tv = {s,0} +#endif + +#define DEF_BUFTIME (2*60*60*1000) /* 2 hours */ + +static CURLcode rtmp_setup(struct connectdata *conn); +static CURLcode rtmp_do(struct connectdata *conn, bool *done); +static CURLcode rtmp_done(struct connectdata *conn, CURLcode, bool premature); +static CURLcode rtmp_connect(struct connectdata *conn, bool *done); +static CURLcode rtmp_disconnect(struct connectdata *conn); + +static Curl_recv rtmp_recv; +static Curl_send rtmp_send; + +/* + * RTMP protocol handler.h, based on http://rtmpdump.mplayerhq.hu + */ + +const struct Curl_handler Curl_handler_rtmp = { + "RTMP", /* scheme */ + rtmp_setup, /* setup_connection */ + rtmp_do, /* do_it */ + rtmp_done, /* done */ + ZERO_NULL, /* do_more */ + rtmp_connect, /* connect_it */ + ZERO_NULL, /* connecting */ + ZERO_NULL, /* doing */ + ZERO_NULL, /* proto_getsock */ + ZERO_NULL, /* doing_getsock */ + ZERO_NULL, /* perform_getsock */ + rtmp_disconnect, /* disconnect */ + PORT_RTMP, /* defport */ + PROT_RTMP /* protocol */ +}; + +const struct Curl_handler Curl_handler_rtmpt = { + "RTMPT", /* scheme */ + rtmp_setup, /* setup_connection */ + rtmp_do, /* do_it */ + rtmp_done, /* done */ + ZERO_NULL, /* do_more */ + rtmp_connect, /* connect_it */ + ZERO_NULL, /* connecting */ + ZERO_NULL, /* doing */ + ZERO_NULL, /* proto_getsock */ + ZERO_NULL, /* doing_getsock */ + ZERO_NULL, /* perform_getsock */ + rtmp_disconnect, /* disconnect */ + PORT_RTMPT, /* defport */ + PROT_RTMPT /* protocol */ +}; + +const struct Curl_handler Curl_handler_rtmpe = { + "RTMPE", /* scheme */ + rtmp_setup, /* setup_connection */ + rtmp_do, /* do_it */ + rtmp_done, /* done */ + ZERO_NULL, /* do_more */ + rtmp_connect, /* connect_it */ + ZERO_NULL, /* connecting */ + ZERO_NULL, /* doing */ + ZERO_NULL, /* proto_getsock */ + ZERO_NULL, /* doing_getsock */ + ZERO_NULL, /* perform_getsock */ + rtmp_disconnect, /* disconnect */ + PORT_RTMP, /* defport */ + PROT_RTMPE /* protocol */ +}; + +const struct Curl_handler Curl_handler_rtmpte = { + "RTMPTE", /* scheme */ + rtmp_setup, /* setup_connection */ + rtmp_do, /* do_it */ + rtmp_done, /* done */ + ZERO_NULL, /* do_more */ + rtmp_connect, /* connect_it */ + ZERO_NULL, /* connecting */ + ZERO_NULL, /* doing */ + ZERO_NULL, /* proto_getsock */ + ZERO_NULL, /* doing_getsock */ + ZERO_NULL, /* perform_getsock */ + rtmp_disconnect, /* disconnect */ + PORT_RTMPT, /* defport */ + PROT_RTMPTE /* protocol */ +}; + +const struct Curl_handler Curl_handler_rtmps = { + "RTMPS", /* scheme */ + rtmp_setup, /* setup_connection */ + rtmp_do, /* do_it */ + rtmp_done, /* done */ + ZERO_NULL, /* do_more */ + rtmp_connect, /* connect_it */ + ZERO_NULL, /* connecting */ + ZERO_NULL, /* doing */ + ZERO_NULL, /* proto_getsock */ + ZERO_NULL, /* doing_getsock */ + ZERO_NULL, /* perform_getsock */ + rtmp_disconnect, /* disconnect */ + PORT_RTMPS, /* defport */ + PROT_RTMPS /* protocol */ +}; +const struct Curl_handler Curl_handler_rtmpts = { + "RTMPTS", /* scheme */ + rtmp_setup, /* setup_connection */ + rtmp_do, /* do_it */ + rtmp_done, /* done */ + ZERO_NULL, /* do_more */ + rtmp_connect, /* connect_it */ + ZERO_NULL, /* connecting */ + ZERO_NULL, /* doing */ + ZERO_NULL, /* proto_getsock */ + ZERO_NULL, /* doing_getsock */ + ZERO_NULL, /* perform_getsock */ + rtmp_disconnect, /* disconnect */ + PORT_RTMPS, /* defport */ + PROT_RTMPTS /* protocol */ +}; + +static CURLcode rtmp_setup(struct connectdata *conn) +{ + RTMP *r = RTMP_Alloc(); + + if (!r) + return CURLE_OUT_OF_MEMORY; + + RTMP_Init(r); + RTMP_SetBufferMS(r, DEF_BUFTIME); + if (!RTMP_SetupURL(r, conn->data->change.url)) { + RTMP_Free(r); + return CURLE_URL_MALFORMAT; + } + conn->proto.generic = r; + return CURLE_OK; +} + +static CURLcode rtmp_connect(struct connectdata *conn, bool *done) +{ + RTMP *r = conn->proto.generic; + SET_RCVTIMEO(tv,10); + + r->m_sb.sb_socket = conn->sock[FIRSTSOCKET]; + + /* We have to know if it's a write before we send the + * connect request packet + */ + if (conn->data->set.upload) + r->Link.protocol |= RTMP_FEATURE_WRITE; + + /* For plain streams, use the buffer toggle trick to keep data flowing */ + if (!(r->Link.lFlags & RTMP_LF_LIVE) && !(r->Link.protocol & RTMP_FEATURE_HTTP)) + r->Link.lFlags |= RTMP_LF_BUFX; + + curlx_nonblock(r->m_sb.sb_socket, FALSE); + setsockopt(r->m_sb.sb_socket, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof(tv)); + + if (!RTMP_Connect1(r, NULL)) + return CURLE_FAILED_INIT; + + /* Clients must send a periodic BytesReceived report to the server */ + r->m_bSendCounter = true; + + *done = TRUE; + conn->recv[FIRSTSOCKET] = rtmp_recv; + conn->send[FIRSTSOCKET] = rtmp_send; + return CURLE_OK; +} + +static CURLcode rtmp_do(struct connectdata *conn, bool *done) +{ + RTMP *r = conn->proto.generic; + + if (!RTMP_ConnectStream(r, 0)) + return CURLE_FAILED_INIT; + + if (conn->data->set.upload) { + Curl_pgrsSetUploadSize(conn->data, conn->data->set.infilesize); + Curl_setup_transfer(conn, -1, -1, FALSE, NULL, FIRSTSOCKET, NULL); + } else + Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, NULL, -1, NULL); + *done = TRUE; + return CURLE_OK; +} + +static CURLcode rtmp_done(struct connectdata *conn, CURLcode status, + bool premature) +{ + (void)conn; /* unused */ + (void)status; /* unused */ + (void)premature; /* unused */ + + return CURLE_OK; +} + +static CURLcode rtmp_disconnect(struct connectdata *conn) +{ + RTMP *r = conn->proto.generic; + if (r) { + conn->proto.generic = NULL; + RTMP_Close(r); + RTMP_Free(r); + } + return CURLE_OK; +} + +static ssize_t rtmp_recv(struct connectdata *conn, int sockindex, char *buf, + size_t len, CURLcode *err) +{ + RTMP *r = conn->proto.generic; + ssize_t nread; + + (void)sockindex; /* unused */ + + nread = RTMP_Read(r, buf, len); + if (nread < 0) { + if (r->m_read.status == RTMP_READ_COMPLETE || + r->m_read.status == RTMP_READ_EOF) { + conn->data->req.size = conn->data->req.bytecount; + nread = 0; + } else + *err = CURLE_RECV_ERROR; + } + return nread; +} + +static ssize_t rtmp_send(struct connectdata *conn, int sockindex, + const void *buf, size_t len, CURLcode *err) +{ + RTMP *r = conn->proto.generic; + ssize_t num; + + (void)sockindex; /* unused */ + + num = RTMP_Write(r, (char *)buf, len); + if (num < 0) { + *err = CURLE_SEND_ERROR; + } + return num; +} +#endif /* USE_LIBRTMP */ diff --git a/lib/curl_rtmp.h b/lib/curl_rtmp.h new file mode 100644 index 00000000..4a9e9e60 --- /dev/null +++ b/lib/curl_rtmp.h @@ -0,0 +1,33 @@ +#ifndef HEADER_CURL_RTMP_H +#define HEADER_CURL_RTMP_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 2010, Howard Chu, <hyc@highlandsun.com> + * + * 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. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#ifdef USE_LIBRTMP +extern const struct Curl_handler Curl_handler_rtmp; +extern const struct Curl_handler Curl_handler_rtmpt; +extern const struct Curl_handler Curl_handler_rtmpe; +extern const struct Curl_handler Curl_handler_rtmpte; +extern const struct Curl_handler Curl_handler_rtmps; +extern const struct Curl_handler Curl_handler_rtmpts; +#endif + +#endif /* HEADER_CURL_RTMP_H */ diff --git a/lib/curl_sspi.c b/lib/curl_sspi.c index 6b19b47c..b985dbce 100644 --- a/lib/curl_sspi.c +++ b/lib/curl_sspi.c @@ -36,6 +36,9 @@ #include "memdebug.h" +/* We use our own typedef here since some headers might lack these */ +typedef PSecurityFunctionTableA (APIENTRY *INITSECURITYINTERFACE_FN_A)(VOID); + /* Handle of security.dll or secur32.dll, depending on Windows version */ HMODULE s_hSecDll = NULL; @@ -59,7 +62,7 @@ CURLcode Curl_sspi_global_init(void) { OSVERSIONINFO osver; - INIT_SECURITY_INTERFACE_A pInitSecurityInterface; + INITSECURITYINTERFACE_FN_A pInitSecurityInterface; /* If security interface is not yet initialized try to do this */ if(s_hSecDll == NULL) { @@ -84,7 +87,7 @@ Curl_sspi_global_init(void) return CURLE_FAILED_INIT; /* Get address of the InitSecurityInterfaceA function from the SSPI dll */ - pInitSecurityInterface = (INIT_SECURITY_INTERFACE_A) + pInitSecurityInterface = (INITSECURITYINTERFACE_FN_A) GetProcAddress(s_hSecDll, "InitSecurityInterfaceA"); if(! pInitSecurityInterface) return CURLE_FAILED_INIT; @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -217,13 +217,12 @@ static CURLcode dict_do(struct connectdata *conn, bool *done) free(eword); - if(result) + if(result) { failf(data, "Failed sending DICT request"); - else - result = Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, bytecount, - -1, NULL); /* no upload */ - if(result) return result; + } + Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, bytecount, + -1, NULL); /* no upload */ } else if(Curl_raw_nequal(path, DICT_DEFINE, sizeof(DICT_DEFINE)-1) || Curl_raw_nequal(path, DICT_DEFINE2, sizeof(DICT_DEFINE2)-1) || @@ -265,15 +264,12 @@ static CURLcode dict_do(struct connectdata *conn, bool *done) free(eword); - if(result) + if(result) { failf(data, "Failed sending DICT request"); - else - result = Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, bytecount, - -1, NULL); /* no upload */ - - if(result) return result; - + } + Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, bytecount, + -1, NULL); /* no upload */ } else { @@ -290,13 +286,12 @@ static CURLcode dict_do(struct connectdata *conn, bool *done) "CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\r\n" "%s\r\n" "QUIT\r\n", ppath); - if(result) + if(result) { failf(data, "Failed sending DICT request"); - else - result = Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, bytecount, - -1, NULL); - if(result) return result; + } + + Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, bytecount, -1, NULL); } } @@ -287,6 +287,13 @@ CURLcode curl_global_init(long flags) } #endif +#if defined(USE_LIBSSH2) && defined(HAVE_LIBSSH2_INIT) + if(libssh2_init(0)) { + DEBUGF(fprintf(stderr, "Error: libssh2_init failed\n")); + return CURLE_FAILED_INIT; + } +#endif + init_flags = flags; /* Preset pseudo-random number sequence. */ @@ -355,6 +362,10 @@ void curl_global_cleanup(void) amiga_cleanup(); #endif +#if defined(USE_LIBSSH2) && defined(HAVE_LIBSSH2_EXIT) + (void)libssh2_exit(); +#endif + init_flags = 0; } @@ -689,8 +700,9 @@ CURL *curl_easy_duphandle(CURL *incurl) } #ifdef USE_ARES - /* If we use ares, we setup a new ares channel for the new handle */ - if(ARES_SUCCESS != ares_init(&outcurl->state.areschannel)) + /* If we use ares, we clone the ares channel for the new handle */ + if(ARES_SUCCESS != ares_dup(&outcurl->state.areschannel, + data->state.areschannel)) break; #endif @@ -1061,9 +1073,6 @@ static CURLcode easy_connection(struct SessionHandle *data, curl_socket_t *sfd, struct connectdata **connp) { - CURLcode ret; - long sockfd; - if(data == NULL) return CURLE_BAD_FUNCTION_ARGUMENT; @@ -1073,18 +1082,13 @@ static CURLcode easy_connection(struct SessionHandle *data, return CURLE_UNSUPPORTED_PROTOCOL; } - ret = Curl_getconnectinfo(data, &sockfd, connp); - if(ret != CURLE_OK) - return ret; + *sfd = Curl_getconnectinfo(data, connp); - if(sockfd == -1) { + if(*sfd == CURL_SOCKET_BAD) { failf(data, "Failed to get recent socket"); return CURLE_UNSUPPORTED_PROTOCOL; } - *sfd = (curl_socket_t)sockfd; /* we know that this is actually a socket - descriptor so the typecast is fine here */ - return CURLE_OK; } @@ -1097,7 +1101,6 @@ CURLcode curl_easy_recv(CURL *curl, void *buffer, size_t buflen, size_t *n) { curl_socket_t sfd; CURLcode ret; - int ret1; ssize_t n1; struct connectdata *c; struct SessionHandle *data = (struct SessionHandle *)curl; @@ -1107,13 +1110,10 @@ CURLcode curl_easy_recv(CURL *curl, void *buffer, size_t buflen, size_t *n) return ret; *n = 0; - ret1 = Curl_read(c, sfd, buffer, buflen, &n1); + ret = Curl_read(c, sfd, buffer, buflen, &n1); - if(ret1 == -1) - return CURLE_AGAIN; - - if(ret1 != CURLE_OK) - return (CURLcode)ret1; + if(ret != CURLE_OK) + return ret; *n = (size_t)n1; diff --git a/lib/escape.c b/lib/escape.c index 37d21e79..735e1d8a 100644 --- a/lib/escape.c +++ b/lib/escape.c @@ -43,8 +43,10 @@ #include "memdebug.h" /* Portable character check (remember EBCDIC). Do not use isalnum() because -its behavior is altered by the current locale. */ -static bool Curl_isalnum(unsigned char in) + its behavior is altered by the current locale. + See http://tools.ietf.org/html/rfc3986#section-2.3 +*/ +static bool Curl_isunreserved(unsigned char in) { switch (in) { case '0': case '1': case '2': case '3': case '4': @@ -59,6 +61,7 @@ static bool Curl_isalnum(unsigned char in) case 'K': case 'L': case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': case 'Y': case 'Z': + case '-': case '.': case '_': case '~': return TRUE; default: break; @@ -100,7 +103,7 @@ char *curl_easy_escape(CURL *handle, const char *string, int inlength) while(length--) { in = *string; - if (Curl_isalnum(in)) { + if (Curl_isunreserved(in)) { /* just copy this */ ns[strindex++]=in; } @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -146,7 +146,7 @@ static CURLcode file_range(struct connectdata *conn) if(data->state.use_range && data->state.range) { from=curlx_strtoofft(data->state.range, &ptr, 0); - while(ptr && *ptr && (isspace((int)*ptr) || (*ptr=='-'))) + while(*ptr && (isspace((int)*ptr) || (*ptr=='-'))) ptr++; to=curlx_strtoofft(ptr, &ptr2, 0); if(ptr == ptr2) { @@ -161,11 +161,10 @@ static CURLcode file_range(struct connectdata *conn) } else if(from < 0) { /* -Y */ - totalsize = -from; data->req.maxdownload = -from; data->state.resume_from = from; DEBUGF(infof(data, "RANGE the last %" FORMAT_OFF_T " bytes\n", - totalsize)); + -from)); } else { /* X-Y */ diff --git a/lib/fileinfo.c b/lib/fileinfo.c new file mode 100644 index 00000000..f5dbfce4 --- /dev/null +++ b/lib/fileinfo.c @@ -0,0 +1,75 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 2010, Daniel Stenberg, <daniel@haxx.se>, 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. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#include <stdlib.h> +#include "strdup.h" +#include "fileinfo.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include <curl/mprintf.h> + +#include "curl_memory.h" +/* The last #include file should be: */ +#include "memdebug.h" + +struct curl_fileinfo *Curl_fileinfo_alloc(void) +{ + struct curl_fileinfo *tmp = malloc(sizeof(struct curl_fileinfo)); + if(!tmp) + return NULL; + memset(tmp, 0, sizeof(struct curl_fileinfo)); + return tmp; +} + +void Curl_fileinfo_dtor(void *user, void *element) +{ + struct curl_fileinfo *finfo = element; + (void) user; + if(!finfo) + return; + + if(finfo->b_data){ + free(finfo->b_data); + } + + free(finfo); +} + +struct curl_fileinfo *Curl_fileinfo_dup(const struct curl_fileinfo *src) +{ + struct curl_fileinfo *ptr = malloc(sizeof(struct curl_fileinfo)); + if(!ptr) + return NULL; + *ptr = *src; + + ptr->b_data = malloc(src->b_size); + if(!ptr->b_data) { + free(ptr); + return NULL; + } + else { + memcpy(ptr->b_data, src->b_data, src->b_size); + return ptr; + } +} diff --git a/lib/fileinfo.h b/lib/fileinfo.h new file mode 100644 index 00000000..b0e5e59e --- /dev/null +++ b/lib/fileinfo.h @@ -0,0 +1,33 @@ +#ifndef HEADER_CURL_FILEINFO_H +#define HEADER_CURL_FILEINFO_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 2010, Daniel Stenberg, <daniel@haxx.se>, 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. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include <curl/curl.h> + +struct curl_fileinfo *Curl_fileinfo_alloc(void); + +void Curl_fileinfo_dtor(void *, void *); + +struct curl_fileinfo *Curl_fileinfo_dup(const struct curl_fileinfo *src); + +#endif /* HEADER_CURL_FILEINFO_H */ diff --git a/lib/firefox-db2pem.sh b/lib/firefox-db2pem.sh new file mode 100644 index 00000000..14ac5760 --- /dev/null +++ b/lib/firefox-db2pem.sh @@ -0,0 +1,54 @@ +#!/bin/sh +# *************************************************************************** +# * _ _ ____ _ +# * Project ___| | | | _ \| | +# * / __| | | | |_) | | +# * | (__| |_| | _ <| |___ +# * \___|\___/|_| \_\_____| +# * +# * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, 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. +# * +# * You may opt to use, copy, modify, merge, publish, distribute and/or sell +# * copies of the Software, and permit persons to whom the Software is +# * furnished to do so, under the terms of the COPYING file. +# * +# * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# * KIND, either express or implied. +# * +# *************************************************************************** +# This shell script creates a fresh ca-bundle.crt file for use with libcurl. +# It extracts all ca certs it finds in the local Firefox database and converts +# them all into PEM format. +# +db=`ls -1d $HOME/.mozilla/firefox/*default` +out=$1 + +if test -z "$out"; then + out="ca-bundle.crt" # use a sensible default +fi + +currentdate=`date` + +cat >$out <<EOF +## +## Bundle of CA Root Certificates +## +## Converted at: ${currentdate} +## These were converted from the local Firefox directory by the db2pem script. +## +EOF + + +certutil -L -h 'Builtin Object Token' -d $db | \ +grep ' *[CcGTPpu]*,[CcGTPpu]*,[CcGTPpu]* *$' | \ +sed -e 's/ *[CcGTPpu]*,[CcGTPpu]*,[CcGTPpu]* *$//' -e 's/\(.*\)/"\1"/' | \ +sort | \ +while read nickname; \ + do echo $nickname | sed -e "s/Builtin Object Token://g"; \ +eval certutil -d $db -L -n "$nickname" -a ; \ +done >> $out + @@ -71,6 +71,8 @@ #include "http.h" /* for HTTP proxy tunnel stuff */ #include "socks.h" #include "ftp.h" +#include "fileinfo.h" +#include "ftplistparser.h" #if defined(HAVE_KRB4) || defined(HAVE_GSSAPI) #include "krb4.h" @@ -144,6 +146,14 @@ static CURLcode ftp_doing(struct connectdata *conn, bool *dophase_done); static CURLcode ftp_setup_connection(struct connectdata * conn); +static CURLcode init_wc_data(struct connectdata *conn); +static CURLcode wc_statemach(struct connectdata *conn); + +static void wc_data_dtor(void *ptr); + +static CURLcode ftp_state_post_retr_size(struct connectdata *conn, + curl_off_t filesize); + /* easy-to-use macro: */ #define FTPSENDF(x,y,z) if((result = Curl_ftpsendf(x,y,z)) != CURLE_OK) \ return result @@ -314,7 +324,7 @@ static CURLcode AllowServerConnect(struct connectdata *conn) for(;;) { timeout_ms = Curl_timeleft(conn, NULL, TRUE); - if(timeout_ms <= 0) { + if(timeout_ms < 0) { /* if a timeout was already reached, bail out */ failf(data, "Timeout while waiting for server connect"); return CURLE_OPERATION_TIMEDOUT; @@ -820,7 +830,7 @@ static CURLcode ftp_state_use_port(struct connectdata *conn, /* resolv ip/host to ip */ rc = Curl_resolv(conn, host, 0, &h); if(rc == CURLRESOLV_PENDING) - rc = Curl_wait_for_resolv(conn, &h); + (void)Curl_wait_for_resolv(conn, &h); if(h) { res = h->addr; /* when we return from this function, we can forget about this entry @@ -1378,7 +1388,7 @@ static CURLcode ftp_state_ul_setup(struct connectdata *conn, infof(data, "File already completely uploaded\n"); /* no data to transfer */ - result=Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL); + Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL); /* Set ->transfer so that we won't get any error in * ftp_done() because we didn't transfer anything! */ @@ -1469,8 +1479,14 @@ static CURLcode ftp_state_quote(struct connectdata *conn, if(ftp->transfer != FTPTRANSFER_BODY) state(conn, FTP_STOP); else { - PPSENDF(&ftpc->pp, "SIZE %s", ftpc->file); - state(conn, FTP_RETR_SIZE); + if(ftpc->known_filesize != -1) { + Curl_pgrsSetDownloadSize(data, ftpc->known_filesize); + result = ftp_state_post_retr_size(conn, ftpc->known_filesize); + } + else { + PPSENDF(&ftpc->pp, "SIZE %s", ftpc->file); + state(conn, FTP_RETR_SIZE); + } } break; case FTP_STOR_PREQUOTE: @@ -1630,8 +1646,9 @@ static CURLcode ftp_state_pasv_resp(struct connectdata *conn, */ rc = Curl_resolv(conn, conn->proxy.name, (int)conn->port, &addr); if(rc == CURLRESOLV_PENDING) - /* BLOCKING */ - rc = Curl_wait_for_resolv(conn, &addr); + /* BLOCKING, ignores the return code but 'addr' will be NULL in + case of failure */ + (void)Curl_wait_for_resolv(conn, &addr); connectport = (unsigned short)conn->port; /* we connect to the proxy's port */ @@ -1647,7 +1664,7 @@ static CURLcode ftp_state_pasv_resp(struct connectdata *conn, rc = Curl_resolv(conn, newhost, newport, &addr); if(rc == CURLRESOLV_PENDING) /* BLOCKING */ - rc = Curl_wait_for_resolv(conn, &addr); + (void)Curl_wait_for_resolv(conn, &addr); connectport = newport; /* we connect to the remote port */ @@ -1973,7 +1990,7 @@ static CURLcode ftp_state_post_retr_size(struct connectdata *conn, if(ftp->downloadsize == 0) { /* no data to transfer */ - result = Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL); + Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL); infof(data, "File already completely downloaded\n"); /* Set ->transfer so that we won't get any error in ftp_done() @@ -2115,8 +2132,8 @@ static CURLcode ftp_state_stor_resp(struct connectdata *conn, /* set the SO_SNDBUF for the secondary socket for those who need it */ Curl_sndbufset(conn->sock[SECONDARYSOCKET]); - result = Curl_setup_transfer(conn, -1, -1, FALSE, NULL, /* no download */ - SECONDARYSOCKET, ftp->bytecountp); + Curl_setup_transfer(conn, -1, -1, FALSE, NULL, /* no download */ + SECONDARYSOCKET, ftp->bytecountp); state(conn, FTP_STOP); conn->proto.ftpc.pp.pending_resp = TRUE; /* expect a server response */ @@ -2229,11 +2246,8 @@ static CURLcode ftp_state_get_resp(struct connectdata *conn, infof(data, "Getting file with size: %" FORMAT_OFF_T "\n", size); /* FTP download: */ - result=Curl_setup_transfer(conn, SECONDARYSOCKET, size, FALSE, - ftp->bytecountp, - -1, NULL); /* no upload here */ - if(result) - return result; + Curl_setup_transfer(conn, SECONDARYSOCKET, size, FALSE, + ftp->bytecountp, -1, NULL); /* no upload here */ conn->proto.ftpc.pp.pending_resp = TRUE; /* expect server response */ state(conn, FTP_STOP); @@ -2410,7 +2424,7 @@ static CURLcode ftp_statemach_act(struct connectdata *conn) set a valid level */ Curl_sec_request_prot(conn, data->set.str[STRING_KRB_LEVEL]); - if(Curl_sec_login(conn) != 0) + if(Curl_sec_login(conn) != CURLE_OK) infof(data, "Logging in with password in cleartext!\n"); else infof(data, "Authentication successful\n"); @@ -2857,6 +2871,8 @@ static CURLcode ftp_init(struct connectdata *conn) if(TRUE == isBadFtpString(ftp->passwd)) return CURLE_URL_MALFORMAT; + conn->proto.ftpc.known_filesize = -1; /* unknown size for now */ + return CURLE_OK; } @@ -3020,6 +3036,13 @@ static CURLcode ftp_done(struct connectdata *conn, CURLcode status, if(ftpc->prevpath) free(ftpc->prevpath); + if(data->set.wildcardmatch) { + if(data->set.chunk_end && ftpc->file) { + data->set.chunk_end(data->wildcard.customptr); + } + ftpc->known_filesize = -1; + } + /* get the "raw" path */ path = curl_easy_unescape(data, path_to_use, 0, NULL); if(!path) { @@ -3053,10 +3076,6 @@ static CURLcode ftp_done(struct connectdata *conn, CURLcode status, /* free the dir tree and file parts */ freedirs(ftpc); -#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI) - Curl_sec_fflush_fd(conn, conn->sock[SECONDARYSOCKET]); -#endif - /* shut down the socket to inform the server we're done */ #ifdef _WIN32_WCE @@ -3180,6 +3199,8 @@ CURLcode ftp_sendquote(struct connectdata *conn, struct curl_slist *quote) ssize_t nread; int ftpcode; CURLcode result; + struct ftp_conn *ftpc = &conn->proto.ftpc; + struct pingpong *pp = &ftpc->pp; item = quote; while(item) { @@ -3199,6 +3220,8 @@ CURLcode ftp_sendquote(struct connectdata *conn, struct curl_slist *quote) FTPSENDF(conn, "%s", cmd); + pp->response = Curl_tvnow(); /* timeout relative now */ + result = Curl_GetFTPResponse(&nread, conn, &ftpcode); if(result) return result; @@ -3285,7 +3308,6 @@ ftp_pasv_verbose(struct connectdata *conn, static CURLcode ftp_range(struct connectdata *conn) { curl_off_t from, to; - curl_off_t totalsize=-1; char *ptr; char *ptr2; struct SessionHandle *data = conn->data; @@ -3293,7 +3315,7 @@ static CURLcode ftp_range(struct connectdata *conn) if(data->state.use_range && data->state.range) { from=curlx_strtoofft(data->state.range, &ptr, 0); - while(ptr && *ptr && (ISSPACE(*ptr) || (*ptr=='-'))) + while(*ptr && (ISSPACE(*ptr) || (*ptr=='-'))) ptr++; to=curlx_strtoofft(ptr, &ptr2, 0); if(ptr == ptr2) { @@ -3308,16 +3330,14 @@ static CURLcode ftp_range(struct connectdata *conn) } else if(from < 0) { /* -Y */ - totalsize = -from; data->req.maxdownload = -from; data->state.resume_from = from; DEBUGF(infof(conn->data, "FTP RANGE the last %" FORMAT_OFF_T " bytes\n", - totalsize)); + -from)); } else { /* X-Y */ - totalsize = to-from; - data->req.maxdownload = totalsize+1; /* include last byte */ + data->req.maxdownload = (to-from)+1; /* include last byte */ data->state.resume_from = from; DEBUGF(infof(conn->data, "FTP RANGE from %" FORMAT_OFF_T " getting %" FORMAT_OFF_T " bytes\n", @@ -3393,7 +3413,7 @@ static CURLcode ftp_nextconnect(struct connectdata *conn) if((result == CURLE_OK) && (ftp->transfer != FTPTRANSFER_BODY)) /* no data to transfer. FIX: it feels like a kludge to have this here too! */ - result = Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL); + Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL); /* end of transfer */ DEBUGF(infof(data, "DO-MORE phase ends with %d\n", (int)result)); @@ -3450,6 +3470,221 @@ CURLcode ftp_perform(struct connectdata *conn, return result; } +static void wc_data_dtor(void *ptr) +{ + struct ftp_wc_tmpdata *tmp = ptr; + if(tmp) + Curl_ftp_parselist_data_free(&tmp->parser); + Curl_safefree(tmp); +} + +static CURLcode init_wc_data(struct connectdata *conn) +{ + char *last_slash; + char *path = conn->data->state.path; + struct WildcardData *wildcard = &(conn->data->wildcard); + CURLcode ret = CURLE_OK; + struct ftp_wc_tmpdata *ftp_tmp; + + last_slash = strrchr(conn->data->state.path, '/'); + if(last_slash) { + last_slash++; + if(last_slash[0] == '\0') { + wildcard->state = CURLWC_CLEAN; + ret = ftp_parse_url_path(conn); + return ret; + } + else { + wildcard->pattern = strdup(last_slash); + if (!wildcard->pattern) + return CURLE_OUT_OF_MEMORY; + last_slash[0] = '\0'; /* cut file from path */ + } + } + else { /* there is only 'wildcard pattern' or nothing */ + if(path[0]) { + wildcard->pattern = strdup(path); + if (!wildcard->pattern) + return CURLE_OUT_OF_MEMORY; + path[0] = '\0'; + } + else { /* only list */ + wildcard->state = CURLWC_CLEAN; + ret = ftp_parse_url_path(conn); + return ret; + } + } + + /* program continues only if URL is not ending with slash, allocate needed + resources for wildcard transfer */ + + /* allocate ftp protocol specific temporary wildcard data */ + ftp_tmp = malloc(sizeof(struct ftp_wc_tmpdata)); + if(!ftp_tmp) { + return CURLE_OUT_OF_MEMORY; + } + + /* INITIALIZE parselist structure */ + ftp_tmp->parser = Curl_ftp_parselist_data_alloc(); + if(!ftp_tmp->parser) { + free(ftp_tmp); + return CURLE_OUT_OF_MEMORY; + } + + wildcard->tmp = ftp_tmp; /* put it to the WildcardData tmp pointer */ + wildcard->tmp_dtor = wc_data_dtor; + + /* wildcard does not support NOCWD option (assert it?) */ + if(conn->data->set.ftp_filemethod == FTPFILE_NOCWD) + conn->data->set.ftp_filemethod = FTPFILE_MULTICWD; + + /* try to parse ftp url */ + ret = ftp_parse_url_path(conn); + if(ret) { + return ret; + } + + /* backup old write_function */ + ftp_tmp->backup.write_function = conn->data->set.fwrite_func; + /* parsing write function (callback included directly from ftplistparser.c) */ + conn->data->set.fwrite_func = Curl_ftp_parselist; + /* backup old file descriptor */ + ftp_tmp->backup.file_descriptor = conn->data->set.out; + /* let the writefunc callback know what curl pointer is working with */ + conn->data->set.out = conn; + + wildcard->path = strdup(conn->data->state.path); + if(!wildcard->path) { + return CURLE_OUT_OF_MEMORY; + } + + infof(conn->data, "Wildcard - Parsing started\n"); + return CURLE_OK; +} + +static CURLcode wc_statemach(struct connectdata *conn) +{ + struct ftp_conn *ftpc = &conn->proto.ftpc; + struct WildcardData *wildcard = &(conn->data->wildcard); + struct ftp_wc_tmpdata *ftp_tmp = wildcard->tmp; + char *tmp_path; + CURLcode ret = CURLE_OK; + long userresponse = 0; + switch (wildcard->state) { + case CURLWC_INIT: + ret = init_wc_data(conn); + if(wildcard->state == CURLWC_CLEAN) + /* only listing! */ + break; + else + wildcard->state = ret ? CURLWC_ERROR : CURLWC_MATCHING; + break; + + case CURLWC_MATCHING: + /* In this state is LIST response successfully parsed, so lets restore + previous WRITEFUNCTION callback and WRITEDATA pointer */ + ftp_tmp = wildcard->tmp; + conn->data->set.fwrite_func = ftp_tmp->backup.write_function; + conn->data->set.out = ftp_tmp->backup.file_descriptor; + wildcard->state = CURLWC_DOWNLOADING; + + if(Curl_ftp_parselist_geterror(ftp_tmp->parser)) { + /* error found in LIST parsing */ + wildcard->state = CURLWC_CLEAN; + return wc_statemach(conn); + } + else if(wildcard->filelist->size == 0) { + /* no corresponding file */ + wildcard->state = CURLWC_CLEAN; + return CURLE_REMOTE_FILE_NOT_FOUND; + } + ret = wc_statemach(conn); + break; + + case CURLWC_DOWNLOADING: { + /* filelist has at least one file, lets get first one */ + struct curl_fileinfo *finfo = wildcard->filelist->head->ptr; + tmp_path = malloc(strlen(conn->data->state.path) + + strlen(finfo->filename) + 1); + if(!tmp_path) { + return CURLE_OUT_OF_MEMORY; + } + + tmp_path[0] = 0; + /* make full path to matched file */ + strcat(tmp_path, wildcard->path); + strcat(tmp_path, finfo->filename); + /* switch default "state.pathbuffer" and tmp_path, good to see + ftp_parse_url_path function to understand this trick */ + if(conn->data->state.pathbuffer) + free(conn->data->state.pathbuffer); + conn->data->state.pathbuffer = tmp_path; + conn->data->state.path = tmp_path; + + infof(conn->data, "Wildcard - START of \"%s\"\n", finfo->filename); + if(conn->data->set.chunk_bgn) { + userresponse = conn->data->set.chunk_bgn( + finfo, wildcard->customptr, (int)wildcard->filelist->size); + switch(userresponse) { + case CURL_CHUNK_BGN_FUNC_SKIP: + infof(conn->data, "Wildcard - \"%s\" skipped by user\n", + finfo->filename); + wildcard->state = CURLWC_SKIP; + return wc_statemach(conn); + case CURL_CHUNK_BGN_FUNC_FAIL: + return CURLE_CHUNK_FAILED; + } + } + + if(finfo->filetype != CURLFILETYPE_FILE) { + wildcard->state = CURLWC_SKIP; + return wc_statemach(conn); + } + + if(finfo->flags & CURLFINFOFLAG_KNOWN_SIZE) + ftpc->known_filesize = finfo->size; + + ret = ftp_parse_url_path(conn); + if(ret) { + return ret; + } + + /* we don't need the Curl_fileinfo of first file anymore */ + Curl_llist_remove(wildcard->filelist, wildcard->filelist->head, NULL); + + if(wildcard->filelist->size == 0) { /* remains only one file to down. */ + wildcard->state = CURLWC_CLEAN; + /* after that will be ftp_do called once again and no transfer + will be done because of CURLWC_CLEAN state */ + return CURLE_OK; + } + } break; + + case CURLWC_SKIP: { + if(conn->data->set.chunk_end) + conn->data->set.chunk_end(conn->data->wildcard.customptr); + Curl_llist_remove(wildcard->filelist, wildcard->filelist->head, NULL); + wildcard->state = (wildcard->filelist->size == 0) ? + CURLWC_CLEAN : CURLWC_DOWNLOADING; + ret = wc_statemach(conn); + } break; + + case CURLWC_CLEAN: + ret = CURLE_OK; + if(ftp_tmp) { + ret = Curl_ftp_parselist_geterror(ftp_tmp->parser); + } + wildcard->state = ret ? CURLWC_ERROR : CURLWC_DONE; + break; + + case CURLWC_DONE: + case CURLWC_ERROR: + break; + } + + return ret; +} + /*********************************************************************** * * ftp_do() @@ -3476,9 +3711,21 @@ static CURLcode ftp_do(struct connectdata *conn, bool *done) if(retcode) return retcode; - retcode = ftp_parse_url_path(conn); - if(retcode) - return retcode; + if(conn->data->set.wildcardmatch) { + retcode = wc_statemach(conn); + if(conn->data->wildcard.state == CURLWC_SKIP || + conn->data->wildcard.state == CURLWC_DONE) { + /* do not call ftp_regular_transfer */ + return CURLE_OK; + } + if(retcode) /* error, loop or skipping the file */ + return retcode; + } + else { /* no wildcard FSM needed */ + retcode = ftp_parse_url_path(conn); + if(retcode) + return retcode; + } retcode = ftp_regular_transfer(conn, done); @@ -3613,6 +3860,10 @@ static CURLcode ftp_disconnect(struct connectdata *conn) Curl_pp_disconnect(pp); +#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI) + Curl_sec_end(conn); +#endif + return CURLE_OK; } @@ -3820,7 +4071,7 @@ static CURLcode ftp_dophase_done(struct connectdata *conn, if(ftp->transfer != FTPTRANSFER_BODY) /* no data to transfer */ - result=Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL); + Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL); else if(!connected) /* since we didn't connect now, we want do_more to get called */ conn->bits.do_more = TRUE; @@ -3927,6 +4178,7 @@ static CURLcode ftp_setup_connection(struct connectdata * conn) } data->state.path++; /* don't include the initial slash */ + data->state.slash_removed = TRUE; /* we've skipped the slash */ /* FTP URLs support an extension like ";type=<typecode>" that * we'll try to get now! */ @@ -3938,6 +4190,7 @@ static CURLcode ftp_setup_connection(struct connectdata * conn) if(type) { *type = 0; /* it was in the middle of the hostname */ command = Curl_raw_toupper(type[6]); + conn->bits.type_set = TRUE; switch (command) { case 'A': /* ASCII mode */ @@ -79,6 +79,17 @@ typedef enum { FTP_LAST /* never used */ } ftpstate; +struct ftp_parselist_data; /* defined later in ftplistparser.c */ + +struct ftp_wc_tmpdata { + struct ftp_parselist_data *parser; + + struct { + curl_write_callback write_function; + FILE *file_descriptor; + } backup; +}; + typedef enum { FTPFILE_MULTICWD = 1, /* as defined by RFC1738 */ FTPFILE_NOCWD = 2, /* use SIZE / RETR / STOR on the full path */ @@ -135,6 +146,8 @@ struct ftp_conn { int count3; /* general purpose counter for the state machine */ ftpstate state; /* always use ftp.c:state() to change state! */ char * server_os; /* The target server operating system. */ + curl_off_t known_filesize; /* file size is different from -1, if wildcard + LIST parsing was done and wc_statemach set it */ }; #endif /* HEADER_CURL_FTP_H */ diff --git a/lib/ftplistparser.c b/lib/ftplistparser.c new file mode 100644 index 00000000..c59ea7e1 --- /dev/null +++ b/lib/ftplistparser.c @@ -0,0 +1,1045 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, 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. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +/** + * Now implemented: + * + * 1) UNIX version 1 + * drwxr-xr-x 1 user01 ftp 512 Jan 29 23:32 prog + * 2) UNIX version 2 + * drwxr-xr-x 1 user01 ftp 512 Jan 29 1997 prog + * 3) UNIX version 3 + * drwxr-xr-x 1 1 1 512 Jan 29 23:32 prog + * 4) UNIX symlink + * lrwxr-xr-x 1 user01 ftp 512 Jan 29 23:32 prog -> prog2000 + * 5) DOS style + * 01-29-97 11:32PM <DIR> prog + */ + +#include "setup.h" + +#include <time.h> + +#include "ftplistparser.h" +#include "curl_fnmatch.h" + +#include "urldata.h" +#include "ftp.h" +#include "fileinfo.h" +#include "llist.h" +#include "strtoofft.h" +#include "rawstr.h" +#include "ftp.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include <curl/mprintf.h> + +#include "curl_memory.h" +/* The last #include file should be: */ +#include "memdebug.h" + +/* allocs buffer which will contain one line of LIST command response */ +#define FTP_BUFFER_ALLOCSIZE 160 + +typedef enum { + PL_UNIX_TOTALSIZE = 0, + PL_UNIX_FILETYPE, + PL_UNIX_PERMISSION, + PL_UNIX_HLINKS, + PL_UNIX_USER, + PL_UNIX_GROUP, + PL_UNIX_SIZE, + PL_UNIX_TIME, + PL_UNIX_FILENAME, + PL_UNIX_SYMLINK +} pl_unix_mainstate; + +typedef union { + enum { + PL_UNIX_TOTALSIZE_INIT = 0, + PL_UNIX_TOTALSIZE_READING + } total_dirsize; + + enum { + PL_UNIX_HLINKS_PRESPACE = 0, + PL_UNIX_HLINKS_NUMBER + } hlinks; + + enum { + PL_UNIX_USER_PRESPACE = 0, + PL_UNIX_USER_PARSING + } user; + + enum { + PL_UNIX_GROUP_PRESPACE = 0, + PL_UNIX_GROUP_NAME + } group; + + enum { + PL_UNIX_SIZE_PRESPACE = 0, + PL_UNIX_SIZE_NUMBER + } size; + + enum { + PL_UNIX_TIME_PREPART1 = 0, + PL_UNIX_TIME_PART1, + PL_UNIX_TIME_PREPART2, + PL_UNIX_TIME_PART2, + PL_UNIX_TIME_PREPART3, + PL_UNIX_TIME_PART3 + } time; + + enum { + PL_UNIX_FILENAME_PRESPACE = 0, + PL_UNIX_FILENAME_NAME, + PL_UNIX_FILENAME_WINDOWSEOL + } filename; + + enum { + PL_UNIX_SYMLINK_PRESPACE = 0, + PL_UNIX_SYMLINK_NAME, + PL_UNIX_SYMLINK_PRETARGET1, + PL_UNIX_SYMLINK_PRETARGET2, + PL_UNIX_SYMLINK_PRETARGET3, + PL_UNIX_SYMLINK_PRETARGET4, + PL_UNIX_SYMLINK_TARGET, + PL_UNIX_SYMLINK_WINDOWSEOL + } symlink; +} pl_unix_substate; + +typedef enum { + PL_WINNT_DATE = 0, + PL_WINNT_TIME, + PL_WINNT_DIRORSIZE, + PL_WINNT_FILENAME +} pl_winNT_mainstate; + +typedef union { + enum { + PL_WINNT_TIME_PRESPACE = 0, + PL_WINNT_TIME_TIME + } time; + enum { + PL_WINNT_DIRORSIZE_PRESPACE = 0, + PL_WINNT_DIRORSIZE_CONTENT + } dirorsize; + enum { + PL_WINNT_FILENAME_PRESPACE = 0, + PL_WINNT_FILENAME_CONTENT, + PL_WINNT_FILENAME_WINEOL + } filename; +} pl_winNT_substate; + +/* This struct is used in wildcard downloading - for parsing LIST response */ +struct ftp_parselist_data { + enum { + OS_TYPE_UNKNOWN = 0, + OS_TYPE_UNIX, + OS_TYPE_WIN_NT + } os_type; + + union { + struct { + pl_unix_mainstate main; + pl_unix_substate sub; + } UNIX; + + struct { + pl_winNT_mainstate main; + pl_winNT_substate sub; + } NT; + } state; + + CURLcode error; + struct curl_fileinfo *file_data; + unsigned int item_length; + size_t item_offset; + struct { + size_t filename; + size_t user; + size_t group; + size_t time; + size_t perm; + size_t symlink_target; + } offsets; +}; + +struct ftp_parselist_data *Curl_ftp_parselist_data_alloc(void) +{ + return calloc(1, sizeof(struct ftp_parselist_data)); +} + + +void Curl_ftp_parselist_data_free(struct ftp_parselist_data **pl_data) +{ + if(*pl_data) + free(*pl_data); + *pl_data = NULL; +} + + +CURLcode Curl_ftp_parselist_geterror(struct ftp_parselist_data *pl_data) +{ + return pl_data->error; +} + + +#define FTP_LP_MALFORMATED_PERM 0x01000000 + +static int ftp_pl_get_permission(const char *str) +{ + int permissions = 0; + /* USER */ + if(str[0] == 'r') + permissions |= 1 << 8; + else if(str[0] != '-') + permissions |= FTP_LP_MALFORMATED_PERM; + if(str[1] == 'w') + permissions |= 1 << 7; + else if(str[1] != '-') + permissions |= FTP_LP_MALFORMATED_PERM; + + if(str[2] == 'x') + permissions |= 1 << 6; + else if(str[2] == 's') { + permissions |= 1 << 6; + permissions |= 1 << 11; + } + else if(str[2] == 'S') + permissions |= 1 << 11; + else if(str[2] != '-') + permissions |= FTP_LP_MALFORMATED_PERM; + /* GROUP */ + if(str[3] == 'r') + permissions |= 1 << 5; + else if(str[3] != '-') + permissions |= FTP_LP_MALFORMATED_PERM; + if(str[4] == 'w') + permissions |= 1 << 4; + else if(str[4] != '-') + permissions |= FTP_LP_MALFORMATED_PERM; + if(str[5] == 'x') + permissions |= 1 << 3; + else if(str[5] == 's') { + permissions |= 1 << 3; + permissions |= 1 << 10; + } + else if(str[5] == 'S') + permissions |= 1 << 10; + else if(str[5] != '-') + permissions |= FTP_LP_MALFORMATED_PERM; + /* others */ + if(str[6] == 'r') + permissions |= 1 << 2; + else if(str[6] != '-') + permissions |= FTP_LP_MALFORMATED_PERM; + if(str[7] == 'w') + permissions |= 1 << 1; + else if(str[7] != '-') + permissions |= FTP_LP_MALFORMATED_PERM; + if(str[8] == 'x') + permissions |= 1; + else if(str[8] == 't') { + permissions |= 1; + permissions |= 1 << 9; + } + else if(str[8] == 'T') + permissions |= 1 << 9; + else if(str[8] != '-') + permissions |= FTP_LP_MALFORMATED_PERM; + + return permissions; +} + +static void PL_ERROR(struct connectdata *conn, CURLcode err) +{ + struct ftp_wc_tmpdata *tmpdata = conn->data->wildcard.tmp; + struct ftp_parselist_data *parser = tmpdata->parser; + if(parser->file_data) + Curl_fileinfo_dtor(NULL, parser->file_data); + parser->file_data = NULL; + parser->error = err; +} + +static bool ftp_pl_gettime(struct ftp_parselist_data *parser, char *string) +{ + (void)parser; + (void)string; + /* TODO + * There could be possible parse timestamp from server. Leaving unimplemented + * for now. + * If you want implement this, please add CURLFINFOFLAG_KNOWN_TIME flag to + * parser->file_data->flags + * + * Ftp servers are giving usually these formats: + * Apr 11 1998 (unknown time.. set it to 00:00:00?) + * Apr 11 12:21 (unknown year -> set it to NOW() time?) + * 08-05-09 02:49PM (ms-dos format) + * 20100421092538 -> for MLST/MLSD response + */ + + return FALSE; +} + +static CURLcode ftp_pl_insert_finfo(struct connectdata *conn, + struct curl_fileinfo *finfo) +{ + curl_fnmatch_callback compare; + struct WildcardData *wc = &conn->data->wildcard; + struct ftp_wc_tmpdata *tmpdata = wc->tmp; + struct curl_llist *llist = wc->filelist; + struct ftp_parselist_data *parser = tmpdata->parser; + bool add = TRUE; + + /* move finfo pointers to b_data */ + char *str = finfo->b_data; + finfo->filename = str + parser->offsets.filename; + finfo->strings.group = parser->offsets.group ? + str + parser->offsets.group : NULL; + finfo->strings.perm = parser->offsets.perm ? + str + parser->offsets.perm : NULL; + finfo->strings.target = parser->offsets.symlink_target ? + str + parser->offsets.symlink_target : NULL; + finfo->strings.time = str + parser->offsets.time; + finfo->strings.user = parser->offsets.user ? + str + parser->offsets.user : NULL; + + /* get correct fnmatch callback */ + compare = conn->data->set.fnmatch; + if(!compare) + compare = Curl_fnmatch; + + /* filter pattern-corresponding filenames */ + if(compare(conn->data->set.fnmatch_data, wc->pattern, finfo->filename) == 0) { + /* discard symlink which is containing multiple " -> " */ + if((finfo->filetype == CURLFILETYPE_SYMLINK) && finfo->strings.target && + (strstr(finfo->strings.target, " -> "))) { + add = FALSE; + } + } + else { + add = FALSE; + } + + if(add) { + if(!Curl_llist_insert_next(llist, llist->tail, finfo)) { + Curl_fileinfo_dtor(NULL, finfo); + tmpdata->parser->file_data = NULL; + return CURLE_OUT_OF_MEMORY; + } + } + else { + Curl_fileinfo_dtor(NULL, finfo); + } + + tmpdata->parser->file_data = NULL; + return CURLE_OK; +} + +size_t Curl_ftp_parselist(char *buffer, size_t size, size_t nmemb, + void *connptr) +{ + size_t bufflen = size*nmemb; + struct connectdata *conn = (struct connectdata *)connptr; + struct ftp_wc_tmpdata *tmpdata = conn->data->wildcard.tmp; + struct ftp_parselist_data *parser = tmpdata->parser; + struct curl_fileinfo *finfo; + unsigned long i = 0; + CURLcode rc; + + if(parser->error) { /* error in previous call */ + /* scenario: + * 1. call => OK.. + * 2. call => OUT_OF_MEMORY (or other error) + * 3. (last) call => is skipped RIGHT HERE and the error is hadled later + * in wc_statemach() + */ + return bufflen; + } + + if(parser->os_type == OS_TYPE_UNKNOWN && bufflen > 0) { + /* considering info about FILE response format */ + parser->os_type = (buffer[0] >= '0' && buffer[0] <= '9') ? + OS_TYPE_WIN_NT : OS_TYPE_UNIX; + } + + while(i < bufflen) { /* FSM */ + + char c = buffer[i]; + if(!parser->file_data) { /* tmp file data is not allocated yet */ + parser->file_data = Curl_fileinfo_alloc(); + if(!parser->file_data) { + parser->error = CURLE_OUT_OF_MEMORY; + return bufflen; + } + parser->file_data->b_data = malloc(FTP_BUFFER_ALLOCSIZE); + if(!parser->file_data->b_data) { + PL_ERROR(conn, CURLE_OUT_OF_MEMORY); + return bufflen; + } + parser->file_data->b_size = FTP_BUFFER_ALLOCSIZE; + parser->item_offset = 0; + parser->item_length = 0; + } + + finfo = parser->file_data; + finfo->b_data[finfo->b_used++] = c; + + if(finfo->b_used >= finfo->b_size - 1) { + /* if it is important, extend buffer space for file data */ + char *tmp = realloc(finfo->b_data, + finfo->b_size + FTP_BUFFER_ALLOCSIZE); + if(tmp) { + finfo->b_size += FTP_BUFFER_ALLOCSIZE; + finfo->b_data = tmp; + } + else { + Curl_fileinfo_dtor(NULL, parser->file_data); + parser->file_data = NULL; + parser->error = CURLE_OUT_OF_MEMORY; + PL_ERROR(conn, CURLE_OUT_OF_MEMORY); + return bufflen; + } + } + + switch (parser->os_type) { + case OS_TYPE_UNIX: + switch (parser->state.UNIX.main) { + case PL_UNIX_TOTALSIZE: + switch(parser->state.UNIX.sub.total_dirsize) { + case PL_UNIX_TOTALSIZE_INIT: + if(c == 't') { + parser->state.UNIX.sub.total_dirsize = PL_UNIX_TOTALSIZE_READING; + parser->item_length++; + } + else { + parser->state.UNIX.main = PL_UNIX_FILETYPE; + /* start FSM again not considering size of directory */ + finfo->b_used = 0; + i--; + } + break; + case PL_UNIX_TOTALSIZE_READING: + parser->item_length++; + if(c == '\r') { + parser->item_length--; + finfo->b_used--; + } + else if(c == '\n') { + finfo->b_data[parser->item_length - 1] = 0; + if(strncmp("total ", finfo->b_data, 6) == 0) { + char *endptr = NULL; + /* here we can deal with directory size */ + curlx_strtoofft(finfo->b_data+6, &endptr, 10); + if(*endptr != 0) { + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + else { + parser->state.UNIX.main = PL_UNIX_FILETYPE; + finfo->b_used = 0; + } + } + else { + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + } + break; + } + break; + case PL_UNIX_FILETYPE: + switch (c) { + case '-': + finfo->filetype = CURLFILETYPE_FILE; + break; + case 'd': + finfo->filetype = CURLFILETYPE_DIRECTORY; + break; + case 'l': + finfo->filetype = CURLFILETYPE_SYMLINK; + break; + case 'p': + finfo->filetype = CURLFILETYPE_NAMEDPIPE; + break; + case 's': + finfo->filetype = CURLFILETYPE_SOCKET; + break; + case 'c': + finfo->filetype = CURLFILETYPE_DEVICE_CHAR; + break; + case 'b': + finfo->filetype = CURLFILETYPE_DEVICE_BLOCK; + break; + case 'D': + finfo->filetype = CURLFILETYPE_DOOR; + break; + default: + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + parser->state.UNIX.main = PL_UNIX_PERMISSION; + parser->item_length = 0; + parser->item_offset = 1; + break; + case PL_UNIX_PERMISSION: + parser->item_length++; + if(parser->item_length <= 9) { + if(!strchr("rwx-tTsS", c)) { + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + } + else if(parser->item_length == 10) { + unsigned int perm; + if(c != ' ') { + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + finfo->b_data[10] = 0; /* terminate permissions */ + perm = ftp_pl_get_permission(finfo->b_data + parser->item_offset); + if(perm & FTP_LP_MALFORMATED_PERM) { + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + parser->file_data->flags |= CURLFINFOFLAG_KNOWN_PERM; + parser->file_data->perm = perm; + parser->offsets.perm = parser->item_offset; + + parser->item_length = 0; + parser->state.UNIX.main = PL_UNIX_HLINKS; + parser->state.UNIX.sub.hlinks = PL_UNIX_HLINKS_PRESPACE; + } + break; + case PL_UNIX_HLINKS: + switch(parser->state.UNIX.sub.hlinks) { + case PL_UNIX_HLINKS_PRESPACE: + if(c != ' ') { + if(c >= '0' && c <= '9') { + parser->item_offset = finfo->b_used - 1; + parser->item_length = 1; + parser->state.UNIX.sub.hlinks = PL_UNIX_HLINKS_NUMBER; + } + else { + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + } + break; + case PL_UNIX_HLINKS_NUMBER: + parser->item_length ++; + if(c == ' ') { + char *p; + long int hlinks; + finfo->b_data[parser->item_offset + parser->item_length - 1] = 0; + hlinks = strtol(finfo->b_data + parser->item_offset, &p, 10); + if(p[0] == '\0' && hlinks != LONG_MAX && hlinks != LONG_MIN) { + parser->file_data->flags |= CURLFINFOFLAG_KNOWN_HLINKCOUNT; + parser->file_data->hardlinks = hlinks; + } + parser->item_length = 0; + parser->item_offset = 0; + parser->state.UNIX.main = PL_UNIX_USER; + parser->state.UNIX.sub.user = PL_UNIX_USER_PRESPACE; + } + else if(c < '0' || c > '9') { + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + break; + } + break; + case PL_UNIX_USER: + switch(parser->state.UNIX.sub.user) { + case PL_UNIX_USER_PRESPACE: + if(c != ' ') { + parser->item_offset = finfo->b_used - 1; + parser->item_length = 1; + parser->state.UNIX.sub.user = PL_UNIX_USER_PARSING; + } + break; + case PL_UNIX_USER_PARSING: + parser->item_length++; + if(c == ' ') { + finfo->b_data[parser->item_offset + parser->item_length - 1] = 0; + parser->offsets.user = parser->item_offset; + parser->state.UNIX.main = PL_UNIX_GROUP; + parser->state.UNIX.sub.group = PL_UNIX_GROUP_PRESPACE; + parser->item_offset = 0; + parser->item_length = 0; + } + break; + } + break; + case PL_UNIX_GROUP: + switch(parser->state.UNIX.sub.group) { + case PL_UNIX_GROUP_PRESPACE: + if(c != ' ') { + parser->item_offset = finfo->b_used - 1; + parser->item_length = 1; + parser->state.UNIX.sub.group = PL_UNIX_GROUP_NAME; + } + break; + case PL_UNIX_GROUP_NAME: + parser->item_length++; + if(c == ' ') { + finfo->b_data[parser->item_offset + parser->item_length - 1] = 0; + parser->offsets.group = parser->item_offset; + parser->state.UNIX.main = PL_UNIX_SIZE; + parser->state.UNIX.sub.size = PL_UNIX_SIZE_PRESPACE; + parser->item_offset = 0; + parser->item_length = 0; + } + break; + } + break; + case PL_UNIX_SIZE: + switch(parser->state.UNIX.sub.size) { + case PL_UNIX_SIZE_PRESPACE: + if(c != ' ') { + if(c >= '0' && c <= '9') { + parser->item_offset = finfo->b_used - 1; + parser->item_length = 1; + parser->state.UNIX.sub.size = PL_UNIX_SIZE_NUMBER; + } + else { + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + } + break; + case PL_UNIX_SIZE_NUMBER: + parser->item_length++; + if(c == ' ') { + char *p; + curl_off_t fsize; + finfo->b_data[parser->item_offset + parser->item_length - 1] = 0; + fsize = curlx_strtoofft(finfo->b_data+parser->item_offset, &p, 10); + if(p[0] == '\0' && fsize != CURL_OFF_T_MAX && + fsize != CURL_OFF_T_MIN) { + parser->file_data->flags |= CURLFINFOFLAG_KNOWN_SIZE; + parser->file_data->size = fsize; + } + parser->item_length = 0; + parser->item_offset = 0; + parser->state.UNIX.main = PL_UNIX_TIME; + parser->state.UNIX.sub.time = PL_UNIX_TIME_PREPART1; + } + else if (!ISDIGIT(c)) { + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + break; + } + break; + case PL_UNIX_TIME: + switch(parser->state.UNIX.sub.time) { + case PL_UNIX_TIME_PREPART1: + if(c != ' ') { + if(ISALNUM(c)) { + parser->item_offset = finfo->b_used -1; + parser->item_length = 1; + parser->state.UNIX.sub.time = PL_UNIX_TIME_PART1; + } + else { + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + } + break; + case PL_UNIX_TIME_PART1: + parser->item_length++; + if(c == ' ') { + parser->state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; + } + else if(!ISALNUM(c) && c != '.') { + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + break; + case PL_UNIX_TIME_PREPART2: + parser->item_length++; + if(c != ' ') { + if(ISALNUM(c)) { + parser->state.UNIX.sub.time = PL_UNIX_TIME_PART2; + } + else { + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + } + break; + case PL_UNIX_TIME_PART2: + parser->item_length++; + if(c == ' ') { + parser->state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; + } + else if(!ISALNUM(c) && c != '.') { + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + break; + case PL_UNIX_TIME_PREPART3: + parser->item_length++; + if(c != ' ') { + if(ISALNUM(c)) { + parser->state.UNIX.sub.time = PL_UNIX_TIME_PART3; + } + else { + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + } + break; + case PL_UNIX_TIME_PART3: + parser->item_length++; + if(c == ' ') { + finfo->b_data[parser->item_offset + parser->item_length -1] = 0; + parser->offsets.time = parser->item_offset; + if(ftp_pl_gettime(parser, finfo->b_data + parser->item_offset)) { + parser->file_data->flags |= CURLFINFOFLAG_KNOWN_TIME; + } + if(finfo->filetype == CURLFILETYPE_SYMLINK) { + parser->state.UNIX.main = PL_UNIX_SYMLINK; + parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; + } + else { + parser->state.UNIX.main = PL_UNIX_FILENAME; + parser->state.UNIX.sub.filename = PL_UNIX_FILENAME_PRESPACE; + } + } + else if(!ISALNUM(c) && c != '.' && c != ':') { + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + break; + } + break; + case PL_UNIX_FILENAME: + switch(parser->state.UNIX.sub.filename) { + case PL_UNIX_FILENAME_PRESPACE: + if(c != ' ') { + parser->item_offset = finfo->b_used - 1; + parser->item_length = 1; + parser->state.UNIX.sub.filename = PL_UNIX_FILENAME_NAME; + } + break; + case PL_UNIX_FILENAME_NAME: + parser->item_length++; + if(c == '\r') { + parser->item_length--; + parser->state.UNIX.sub.filename = PL_UNIX_FILENAME_WINDOWSEOL; + } + else if(c == '\n') { + finfo->b_data[parser->item_offset + parser->item_length - 1] = 0; + parser->offsets.filename = parser->item_offset; + parser->state.UNIX.main = PL_UNIX_FILETYPE; + rc = ftp_pl_insert_finfo(conn, finfo); + if(rc) { + PL_ERROR(conn, rc); + return bufflen; + } + } + break; + case PL_UNIX_FILENAME_WINDOWSEOL: + if(c == '\n') { + finfo->b_data[parser->item_offset + parser->item_length] = 0; + parser->offsets.filename = parser->item_offset; + parser->state.UNIX.main = PL_UNIX_FILETYPE; + rc = ftp_pl_insert_finfo(conn, finfo); + if(rc) { + PL_ERROR(conn, rc); + return bufflen; + } + } + else { + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + break; + } + break; + case PL_UNIX_SYMLINK: + switch(parser->state.UNIX.sub.symlink) { + case PL_UNIX_SYMLINK_PRESPACE: + if(c != ' ') { + parser->item_offset = finfo->b_used - 1; + parser->item_length = 1; + parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; + } + break; + case PL_UNIX_SYMLINK_NAME: + parser->item_length++; + if(c == ' ') { + parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRETARGET1; + } + else if(c == '\r' || c == '\n') { + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + break; + case PL_UNIX_SYMLINK_PRETARGET1: + parser->item_length++; + if(c == '-') { + parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRETARGET2; + } + else if(c == '\r' || c == '\n') { + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + else { + parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; + } + break; + case PL_UNIX_SYMLINK_PRETARGET2: + parser->item_length++; + if(c == '>') { + parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRETARGET3; + } + else if(c == '\r' || c == '\n') { + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + else { + parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; + } + break; + case PL_UNIX_SYMLINK_PRETARGET3: + parser->item_length++; + if(c == ' ') { + parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRETARGET4; + /* now place where is symlink following */ + finfo->b_data[parser->item_offset + parser->item_length - 4] = 0; + parser->offsets.filename = parser->item_offset; + parser->item_length = 0; + parser->item_offset = 0; + } + else if(c == '\r' || c == '\n') { + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + else { + parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; + } + break; + case PL_UNIX_SYMLINK_PRETARGET4: + if(c != '\r' && c != '\n') { + parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; + parser->item_offset = finfo->b_used - 1; + parser->item_length = 1; + } + else { + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + break; + case PL_UNIX_SYMLINK_TARGET: + parser->item_length ++; + if(c == '\r') { + parser->item_length --; + parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_WINDOWSEOL; + } + else if(c == '\n') { + finfo->b_data[parser->item_offset + parser->item_length - 1] = 0; + parser->offsets.symlink_target = parser->item_offset; + rc = ftp_pl_insert_finfo(conn, finfo); + if(rc) { + PL_ERROR(conn, rc); + return bufflen; + } + parser->state.UNIX.main = PL_UNIX_FILETYPE; + } + break; + case PL_UNIX_SYMLINK_WINDOWSEOL: + if(c == '\n') { + finfo->b_data[parser->item_offset + parser->item_length - 1] = 0; + parser->offsets.symlink_target = parser->item_offset; + rc = ftp_pl_insert_finfo(conn, finfo); + if(rc) { + PL_ERROR(conn, rc); + return bufflen; + } + parser->state.UNIX.main = PL_UNIX_FILETYPE; + } + else { + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + break; + } + break; + } + break; + case OS_TYPE_WIN_NT: + switch(parser->state.NT.main) { + case PL_WINNT_DATE: + parser->item_length++; + if(parser->item_length < 9) { + if(!strchr("0123456789-", c)) { /* only simple control */ + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + } + else if(parser->item_length == 9) { + if(c == ' ') { + parser->state.NT.main = PL_WINNT_TIME; + parser->state.NT.sub.time = PL_WINNT_TIME_PRESPACE; + } + else { + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + } + else { + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + break; + case PL_WINNT_TIME: + parser->item_length++; + switch(parser->state.NT.sub.time) { + case PL_WINNT_TIME_PRESPACE: + if(!ISSPACE(c)) { + parser->state.NT.sub.time = PL_WINNT_TIME_TIME; + } + break; + case PL_WINNT_TIME_TIME: + if(c == ' ') { + parser->offsets.time = parser->item_offset; + finfo->b_data[parser->item_offset + parser->item_length -1] = 0; + parser->state.NT.main = PL_WINNT_DIRORSIZE; + parser->state.NT.sub.dirorsize = PL_WINNT_DIRORSIZE_PRESPACE; + parser->item_length = 0; + } + else if(!strchr("APM0123456789:", c)) { + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + break; + } + break; + case PL_WINNT_DIRORSIZE: + switch(parser->state.NT.sub.dirorsize) { + case PL_WINNT_DIRORSIZE_PRESPACE: + if(c == ' ') { + + } + else { + parser->item_offset = finfo->b_used - 1; + parser->item_length = 1; + parser->state.NT.sub.dirorsize = PL_WINNT_DIRORSIZE_CONTENT; + } + break; + case PL_WINNT_DIRORSIZE_CONTENT: + parser->item_length ++; + if(c == ' ') { + finfo->b_data[parser->item_offset + parser->item_length - 1] = 0; + if(strcmp("<DIR>", finfo->b_data + parser->item_offset) == 0) { + finfo->filetype = CURLFILETYPE_DIRECTORY; + finfo->size = 0; + } + else { + char *endptr; + finfo->size = curlx_strtoofft(finfo->b_data + parser->item_offset, + &endptr, 10); + if(!*endptr) { + if(finfo->size == CURL_OFF_T_MAX || + finfo->size == CURL_OFF_T_MIN) { + if(errno == ERANGE) { + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + } + } + else { + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + /* correct file type */ + parser->file_data->filetype = CURLFILETYPE_FILE; + } + + parser->file_data->flags |= CURLFINFOFLAG_KNOWN_SIZE; + parser->item_length = 0; + parser->state.NT.main = PL_WINNT_FILENAME; + parser->state.NT.sub.filename = PL_WINNT_FILENAME_PRESPACE; + } + break; + } + break; + case PL_WINNT_FILENAME: + switch (parser->state.NT.sub.filename) { + case PL_WINNT_FILENAME_PRESPACE: + if(c != ' ') { + parser->item_offset = finfo->b_used -1; + parser->item_length = 1; + parser->state.NT.sub.filename = PL_WINNT_FILENAME_CONTENT; + } + break; + case PL_WINNT_FILENAME_CONTENT: + parser->item_length++; + if(c == '\r') { + parser->state.NT.sub.filename = PL_WINNT_FILENAME_WINEOL; + finfo->b_data[finfo->b_used - 1] = 0; + } + else if(c == '\n') { + parser->offsets.filename = parser->item_offset; + finfo->b_data[finfo->b_used - 1] = 0; + parser->offsets.filename = parser->item_offset; + rc = ftp_pl_insert_finfo(conn, finfo); + if(rc) { + PL_ERROR(conn, rc); + return bufflen; + } + parser->state.NT.main = PL_WINNT_DATE; + parser->state.NT.sub.filename = PL_WINNT_FILENAME_PRESPACE; + } + break; + case PL_WINNT_FILENAME_WINEOL: + if(c == '\n') { + parser->offsets.filename = parser->item_offset; + rc = ftp_pl_insert_finfo(conn, finfo); + if(rc) { + PL_ERROR(conn, rc); + return bufflen; + } + parser->state.NT.main = PL_WINNT_DATE; + parser->state.NT.sub.filename = PL_WINNT_FILENAME_PRESPACE; + } + else { + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + break; + } + break; + } + break; + default: + return bufflen+1; + } + + i++; + } + + return bufflen; +} diff --git a/lib/ftplistparser.h b/lib/ftplistparser.h new file mode 100644 index 00000000..67a06c29 --- /dev/null +++ b/lib/ftplistparser.h @@ -0,0 +1,39 @@ +#ifndef HEADER_CURL_FTPLISTPARSER_H +#define HEADER_CURL_FTPLISTPARSER_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, 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. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include <curl/curl.h> + +/* WRITEFUNCTION callback for parsing LIST responses */ +size_t Curl_ftp_parselist(char *buffer, size_t size, size_t nmemb, + void *connptr); + +struct ftp_parselist_data; /* defined inside ftplibparser.c */ + +CURLcode Curl_ftp_parselist_geterror(struct ftp_parselist_data *pl_data); + +struct ftp_parselist_data *Curl_ftp_parselist_data_alloc(void); + +void Curl_ftp_parselist_data_free(struct ftp_parselist_data **pl_data); + +#endif /* HEADER_CURL_FTPLISTPARSER_H */ diff --git a/lib/getinfo.c b/lib/getinfo.c index 7a0ed71a..c00e675e 100644 --- a/lib/getinfo.c +++ b/lib/getinfo.c @@ -66,6 +66,12 @@ CURLcode Curl_initinfo(struct SessionHandle *data) info->header_size = 0; info->request_size = 0; info->numconnects = 0; + + info->ip[0] = 0; + info->port = 0; + info->localip[0] = 0; + info->localport = 0; + return CURLE_OK; } @@ -77,6 +83,7 @@ CURLcode Curl_getinfo(struct SessionHandle *data, CURLINFO info, ...) char **param_charp=NULL; struct curl_slist **param_slistp=NULL; int type; + curl_socket_t sockfd; union { struct curl_certinfo * to_certinfo; @@ -213,7 +220,16 @@ CURLcode Curl_getinfo(struct SessionHandle *data, CURLINFO info, ...) *param_charp = data->state.most_recent_ftp_entrypath; break; case CURLINFO_LASTSOCKET: - (void)Curl_getconnectinfo(data, param_longp, NULL); + sockfd = Curl_getconnectinfo(data, NULL); + + /* note: this is not a good conversion for systems with 64 bit sockets and + 32 bit longs */ + if(sockfd != CURL_SOCKET_BAD) + *param_longp = (long)sockfd; + else + /* this interface is documented to return -1 in case of badness, which + may not be the same as the CURL_SOCKET_BAD value */ + *param_longp = -1; break; case CURLINFO_REDIRECT_URL: /* Return the URL this request would have been redirected to if that @@ -224,6 +240,19 @@ CURLcode Curl_getinfo(struct SessionHandle *data, CURLINFO info, ...) /* Return the ip address of the most recent (primary) connection */ *param_charp = data->info.ip; break; + case CURLINFO_PRIMARY_PORT: + /* Return the (remote) port of the most recent (primary) connection */ + *param_longp = data->info.port; + break; + case CURLINFO_LOCAL_IP: + /* Return the source/local ip address of the most recent (primary) + connection */ + *param_charp = data->info.localip; + break; + case CURLINFO_LOCAL_PORT: + /* Return the local port of the most recent (primary) connection */ + *param_longp = data->info.localport; + break; case CURLINFO_CERTINFO: /* Return the a pointer to the certinfo struct. Not really an slist pointer but we can pretend it is here */ diff --git a/lib/gopher.c b/lib/gopher.c new file mode 100644 index 00000000..aa9c45b0 --- /dev/null +++ b/lib/gopher.c @@ -0,0 +1,208 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, 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. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#ifndef CURL_DISABLE_GOPHER + +/* -- WIN32 approved -- */ +#include <stdio.h> +#include <string.h> +#include <stdarg.h> +#include <stdlib.h> +#include <ctype.h> + +#ifdef WIN32 +#include <time.h> +#include <io.h> +#else +#ifdef HAVE_SYS_SOCKET_H +#include <sys/socket.h> +#endif +#include <netinet/in.h> +#ifdef HAVE_SYS_TIME_H +#include <sys/time.h> +#endif +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif +#include <netdb.h> +#ifdef HAVE_ARPA_INET_H +#include <arpa/inet.h> +#endif +#ifdef HAVE_NET_IF_H +#include <net/if.h> +#endif +#ifdef HAVE_SYS_IOCTL_H +#include <sys/ioctl.h> +#endif + +#ifdef HAVE_SYS_PARAM_H +#include <sys/param.h> +#endif + +#ifdef HAVE_SYS_SELECT_H +#include <sys/select.h> +#endif + + +#endif + +#include "urldata.h" +#include <curl/curl.h> +#include "transfer.h" +#include "sendf.h" + +#include "progress.h" +#include "strequal.h" +#include "gopher.h" +#include "rawstr.h" +#include "select.h" +#include "url.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include <curl/mprintf.h> + +/* The last #include file should be: */ +#include "memdebug.h" + + +/* + * Forward declarations. + */ + +static CURLcode gopher_do(struct connectdata *conn, bool *done); + +/* + * Gopher protocol handler. + * This is also a nice simple template to build off for simple + * connect-command-download protocols. + */ + +const struct Curl_handler Curl_handler_gopher = { + "GOPHER", /* scheme */ + ZERO_NULL, /* setup_connection */ + gopher_do, /* do_it */ + ZERO_NULL, /* done */ + ZERO_NULL, /* do_more */ + ZERO_NULL, /* connect_it */ + ZERO_NULL, /* connecting */ + ZERO_NULL, /* doing */ + ZERO_NULL, /* proto_getsock */ + ZERO_NULL, /* doing_getsock */ + ZERO_NULL, /* perform_getsock */ + ZERO_NULL, /* disconnect */ + PORT_GOPHER, /* defport */ + PROT_GOPHER /* protocol */ +}; + +static CURLcode gopher_do(struct connectdata *conn, bool *done) +{ + CURLcode result=CURLE_OK; + struct SessionHandle *data=conn->data; + curl_socket_t sockfd = conn->sock[FIRSTSOCKET]; + + curl_off_t *bytecount = &data->req.bytecount; + char *path = data->state.path; + char *sel; + char *sel_org = NULL; + ssize_t amount, k; + + *done = TRUE; /* unconditionally */ + + /* Create selector. Degenerate cases: / and /1 => convert to "" */ + if (strlen(path) <= 2) + sel = (char *)""; + else { + char *newp; + size_t j, i; + int len; + + /* Otherwise, drop / and the first character (i.e., item type) ... */ + newp = path; + newp+=2; + + /* ... then turn ? into TAB for search servers, Veronica, etc. ... */ + j = strlen(newp); + for(i=0; i<j; i++) + if(newp[i] == '?') + newp[i] = '\x09'; + + /* ... and finally unescape */ + sel = curl_easy_unescape(data, newp, 0, &len); + if (!sel) + return CURLE_OUT_OF_MEMORY; + sel_org = sel; + } + + /* We use Curl_write instead of Curl_sendf to make sure the entire buffer is + sent, which could be sizeable with long selectors. */ + k = strlen(sel); + + for(;;) { + result = Curl_write(conn, sockfd, sel, k, &amount); + if (CURLE_OK == result) { /* Which may not have written it all! */ + result = Curl_client_write(conn, CLIENTWRITE_HEADER, sel, amount); + if(result) { + Curl_safefree(sel_org); + return result; + } + k -= amount; + sel += amount; + if (k < 1) + break; /* but it did write it all */ + } + else { + failf(data, "Failed sending Gopher request"); + Curl_safefree(sel_org); + return result; + } + /* Don't busyloop. The entire loop thing is a work-around as it causes a + BLOCKING behavior which is a NO-NO. This function should rather be + split up in a do and a doing piece where the pieces that aren't + possible to send now will be sent in the doing function repeatedly + until the entire request is sent. + + Wait a while for the socket to be writable. Note that this doesn't + acknowledge the timeout. + */ + Curl_socket_ready(CURL_SOCKET_BAD, sockfd, 100); + } + + Curl_safefree(sel_org); + + /* We can use Curl_sendf to send the terminal \r\n relatively safely and + save allocing another string/doing another _write loop. */ + result = Curl_sendf(sockfd, conn, "\r\n"); + if (result != CURLE_OK) { + failf(data, "Failed sending Gopher request"); + return result; + } + result = Curl_client_write(conn, CLIENTWRITE_HEADER, (char *)"\r\n", 2); + if(result) + return result; + + Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, bytecount, + -1, NULL); /* no upload */ + return CURLE_OK; +} +#endif /*CURL_DISABLE_GOPHER*/ diff --git a/lib/gopher.h b/lib/gopher.h new file mode 100644 index 00000000..38bbc4b7 --- /dev/null +++ b/lib/gopher.h @@ -0,0 +1,29 @@ +#ifndef HEADER_CURL_GOPHER_H +#define HEADER_CURL_GOPHER_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, 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. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#ifndef CURL_DISABLE_GOPHER +extern const struct Curl_handler Curl_handler_gopher; +#endif + +#endif /* HEADER_CURL_GOPHER_H */ @@ -182,54 +182,76 @@ static void unload_file(gnutls_datum data) { } -/* this function does a BLOCKING SSL/TLS (re-)handshake */ +/* this function does a SSL/TLS (re-)handshake */ static CURLcode handshake(struct connectdata *conn, - gnutls_session session, int sockindex, - bool duringconnect) + bool duringconnect, + bool nonblocking) { struct SessionHandle *data = conn->data; + struct ssl_connect_data *connssl = &conn->ssl[sockindex]; + gnutls_session session = conn->ssl[sockindex].session; + curl_socket_t sockfd = conn->sock[sockindex]; + long timeout_ms; int rc; - if(!gtls_inited) - Curl_gtls_init(); - do { - rc = gnutls_handshake(session); + int what; - if((rc == GNUTLS_E_AGAIN) || (rc == GNUTLS_E_INTERRUPTED)) { - long timeout_ms = Curl_timeleft(conn, NULL, duringconnect); + while(1) { + /* check allowed time left */ + timeout_ms = Curl_timeleft(conn, NULL, duringconnect); - if(timeout_ms < 0) { - /* a precaution, no need to continue if time already is up */ - failf(data, "SSL connection timeout"); - return CURLE_OPERATION_TIMEDOUT; - } + if(timeout_ms < 0) { + /* no need to continue if time already is up */ + failf(data, "SSL connection timeout"); + return CURLE_OPERATION_TIMEDOUT; + } - rc = Curl_socket_ready(conn->sock[sockindex], - conn->sock[sockindex], (int)timeout_ms); - if(rc > 0) - /* reabable or writable, go loop*/ - continue; - else if(0 == rc) { - /* timeout */ - failf(data, "SSL connection timeout"); - return CURLE_OPERATION_TIMEDOUT; - } - else { - /* anything that gets here is fatally bad */ + /* if ssl is expecting something, check if it's available. */ + if(connssl->connecting_state == ssl_connect_2_reading + || connssl->connecting_state == ssl_connect_2_writing) { + + curl_socket_t writefd = ssl_connect_2_writing== + connssl->connecting_state?sockfd:CURL_SOCKET_BAD; + curl_socket_t readfd = ssl_connect_2_reading== + connssl->connecting_state?sockfd:CURL_SOCKET_BAD; + + what = Curl_socket_ready(readfd, writefd, + nonblocking?0:(int)timeout_ms); + if(what < 0) { + /* fatal error */ failf(data, "select/poll on SSL socket, errno: %d", SOCKERRNO); return CURLE_SSL_CONNECT_ERROR; } + else if(0 == what) { + if(nonblocking) { + return CURLE_OK; + } + else { + /* timeout */ + failf(data, "SSL connection timeout"); + return CURLE_OPERATION_TIMEDOUT; + } + } + /* socket is readable or writable */ } - else - break; - } while(1); - if(rc < 0) { - failf(data, "gnutls_handshake() failed: %s", gnutls_strerror(rc)); - return CURLE_SSL_CONNECT_ERROR; - } + rc = gnutls_handshake(session); - return CURLE_OK; + if((rc == GNUTLS_E_AGAIN) || (rc == GNUTLS_E_INTERRUPTED)) { + connssl->connecting_state = + gnutls_record_get_direction(session)? + ssl_connect_2_writing:ssl_connect_2_reading; + if(nonblocking) { + return CURLE_OK; + } + } else if (rc < 0) { + failf(data, "gnutls_handshake() failed: %s", gnutls_strerror(rc)); + } else { + /* Reset our connect state machine */ + connssl->connecting_state = ssl_connect_1; + return CURLE_OK; + } + } } static gnutls_x509_crt_fmt do_file_type(const char *type) @@ -243,31 +265,14 @@ static gnutls_x509_crt_fmt do_file_type(const char *type) return -1; } - -/* - * This function is called after the TCP connect has completed. Setup the TLS - * layer and do all necessary magic. - */ -CURLcode -Curl_gtls_connect(struct connectdata *conn, - int sockindex) - +static CURLcode +gtls_connect_step1(struct connectdata *conn, + int sockindex) { static const int cert_type_priority[] = { GNUTLS_CRT_X509, 0 }; struct SessionHandle *data = conn->data; gnutls_session session; int rc; - unsigned int cert_list_size; - const gnutls_datum *chainp; - unsigned int verify_status; - gnutls_x509_crt x509_cert,x509_issuer; - gnutls_datum issuerp; - char certbuf[256]; /* big enough? */ - size_t size; - unsigned int algo; - unsigned int bits; - time_t certclock; - const char *ptr; void *ssl_sessionid; size_t ssl_idsize; bool sni = TRUE; /* default is SNI enabled */ @@ -411,10 +416,32 @@ Curl_gtls_connect(struct connectdata *conn, infof (data, "SSL re-using session ID\n"); } - rc = handshake(conn, session, sockindex, TRUE); - if(rc) - /* handshake() sets its own error message with failf() */ - return rc; + return CURLE_OK; +} + +static Curl_recv gtls_recv; +static Curl_send gtls_send; + +static CURLcode +gtls_connect_step3(struct connectdata *conn, + int sockindex) +{ + unsigned int cert_list_size; + const gnutls_datum *chainp; + unsigned int verify_status; + gnutls_x509_crt x509_cert,x509_issuer; + gnutls_datum issuerp; + char certbuf[256]; /* big enough? */ + size_t size; + unsigned int algo; + unsigned int bits; + time_t certclock; + const char *ptr; + struct SessionHandle *data = conn->data; + gnutls_session session = conn->ssl[sockindex].session; + int rc; + int incache; + void *ssl_sessionid; /* This function will return the peer's raw certificate (chain) as sent by the peer. These certificates are in raw format (DER encoded for @@ -606,6 +633,8 @@ Curl_gtls_connect(struct connectdata *conn, infof(data, "\t MAC: %s\n", ptr); conn->ssl[sockindex].state = ssl_connection_complete; + conn->recv[sockindex] = gtls_recv; + conn->send[sockindex] = gtls_send; { /* we always unconditionally get the session id here, as even if we @@ -623,33 +652,100 @@ Curl_gtls_connect(struct connectdata *conn, /* extract session ID to the allocated buffer */ gnutls_session_get_data(session, connect_sessionid, &connect_idsize); - if(ssl_sessionid) + incache = !(Curl_ssl_getsessionid(conn, &ssl_sessionid, NULL)); + if (incache) { /* there was one before in the cache, so instead of risking that the previous one was rejected, we just kill that and store the new */ Curl_ssl_delsessionid(conn, ssl_sessionid); + } /* store this session id */ return Curl_ssl_addsessionid(conn, connect_sessionid, connect_idsize); } + } + + return CURLE_OK; +} + + +/* + * This function is called after the TCP connect has completed. Setup the TLS + * layer and do all necessary magic. + */ +/* We use connssl->connecting_state to keep track of the connection status; + there are three states: 'ssl_connect_1' (not started yet or complete), + 'ssl_connect_2_reading' (waiting for data from server), and + 'ssl_connect_2_writing' (waiting to be able to write). + */ +static CURLcode +gtls_connect_common(struct connectdata *conn, + int sockindex, + bool nonblocking, + bool *done) +{ + int rc; + struct ssl_connect_data *connssl = &conn->ssl[sockindex]; + /* Initiate the connection, if not already done */ + if(ssl_connect_1==connssl->connecting_state) { + rc = gtls_connect_step1 (conn, sockindex); + if(rc) + return rc; + } + + rc = handshake(conn, sockindex, TRUE, nonblocking); + if(rc) + /* handshake() sets its own error message with failf() */ + return rc; + + /* Finish connecting once the handshake is done */ + if(ssl_connect_1==connssl->connecting_state) { + rc = gtls_connect_step3(conn, sockindex); + if(rc) + return rc; } + *done = ssl_connect_1==connssl->connecting_state; + return CURLE_OK; } +CURLcode +Curl_gtls_connect_nonblocking(struct connectdata *conn, + int sockindex, + bool *done) +{ + return gtls_connect_common(conn, sockindex, TRUE, done); +} + +CURLcode +Curl_gtls_connect(struct connectdata *conn, + int sockindex) -/* for documentation see Curl_ssl_send() in sslgen.h */ -ssize_t Curl_gtls_send(struct connectdata *conn, - int sockindex, - const void *mem, - size_t len, - int *curlcode) +{ + CURLcode retcode; + bool done = FALSE; + + retcode = gtls_connect_common(conn, sockindex, FALSE, &done); + if(retcode) + return retcode; + + DEBUGASSERT(done); + + return CURLE_OK; +} + +static ssize_t gtls_send(struct connectdata *conn, + int sockindex, + const void *mem, + size_t len, + CURLcode *curlcode) { ssize_t rc = gnutls_record_send(conn->ssl[sockindex].session, mem, len); if(rc < 0 ) { *curlcode = (rc == GNUTLS_E_AGAIN) - ? /* EWOULDBLOCK */ -1 + ? CURLE_AGAIN : CURLE_SEND_ERROR; rc = -1; @@ -751,36 +847,29 @@ int Curl_gtls_shutdown(struct connectdata *conn, int sockindex) return retval; } -/* for documentation see Curl_ssl_recv() in sslgen.h */ -ssize_t Curl_gtls_recv(struct connectdata *conn, /* connection data */ - int num, /* socketindex */ - char *buf, /* store read data here */ - size_t buffersize, /* max amount to read */ - int *curlcode) +static ssize_t gtls_recv(struct connectdata *conn, /* connection data */ + int num, /* socketindex */ + char *buf, /* store read data here */ + size_t buffersize, /* max amount to read */ + CURLcode *curlcode) { ssize_t ret; ret = gnutls_record_recv(conn->ssl[num].session, buf, buffersize); if((ret == GNUTLS_E_AGAIN) || (ret == GNUTLS_E_INTERRUPTED)) { - *curlcode = -1; + *curlcode = CURLE_AGAIN; return -1; } if(ret == GNUTLS_E_REHANDSHAKE) { /* BLOCKING call, this is bad but a work-around for now. Fixing this "the proper way" takes a whole lot of work. */ - CURLcode rc = handshake(conn, conn->ssl[num].session, num, FALSE); + CURLcode rc = handshake(conn, num, FALSE, FALSE); if(rc) /* handshake() writes error message on its own */ *curlcode = rc; else - *curlcode = -1; /* then return as if this was a wouldblock */ - return -1; - } - - if(!ret) { - failf(conn->data, "Peer closed the TLS connection"); - *curlcode = CURLE_RECV_ERROR; + *curlcode = CURLE_AGAIN; /* then return as if this was a wouldblock */ return -1; } @@ -27,6 +27,9 @@ int Curl_gtls_init(void); int Curl_gtls_cleanup(void); CURLcode Curl_gtls_connect(struct connectdata *conn, int sockindex); +CURLcode Curl_gtls_connect_nonblocking(struct connectdata *conn, + int sockindex, + bool *done); /* tell GnuTLS to close down all open information regarding connections (and thus session ID caching etc) */ @@ -35,14 +38,6 @@ void Curl_gtls_close_all(struct SessionHandle *data); /* close a SSL connection */ void Curl_gtls_close(struct connectdata *conn, int sockindex); -/* for documentation see Curl_ssl_send() in sslgen.h */ -ssize_t Curl_gtls_send(struct connectdata *conn, int sockindex, - const void *mem, size_t len, int *curlcode); - -/* for documentation see Curl_ssl_recv() in sslgen.h */ -ssize_t Curl_gtls_recv(struct connectdata *conn, int num, char *buf, - size_t buffersize, int *curlcode); - void Curl_gtls_session_free(void *ptr); size_t Curl_gtls_version(char *buffer, size_t size); int Curl_gtls_shutdown(struct connectdata *conn, int sockindex); @@ -52,6 +47,7 @@ int Curl_gtls_seed(struct SessionHandle *data); #define curlssl_init Curl_gtls_init #define curlssl_cleanup Curl_gtls_cleanup #define curlssl_connect Curl_gtls_connect +#define curlssl_connect_nonblocking Curl_gtls_connect_nonblocking #define curlssl_session_free(x) Curl_gtls_session_free(x) #define curlssl_close_all Curl_gtls_close_all #define curlssl_close Curl_gtls_close @@ -59,8 +55,6 @@ int Curl_gtls_seed(struct SessionHandle *data); #define curlssl_set_engine(x,y) (x=x, y=y, CURLE_FAILED_INIT) #define curlssl_set_engine_default(x) (x=x, CURLE_FAILED_INIT) #define curlssl_engines_list(x) (x=x, (struct curl_slist *)NULL) -#define curlssl_send Curl_gtls_send -#define curlssl_recv Curl_gtls_recv #define curlssl_version Curl_gtls_version #define curlssl_check_cxn(x) (x=x, -1) #define curlssl_data_pending(x,y) (x=x, y=y, 0) diff --git a/lib/hmac.c b/lib/hmac.c new file mode 100644 index 00000000..0c01d118 --- /dev/null +++ b/lib/hmac.c @@ -0,0 +1,131 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, 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. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * RFC2104 Keyed-Hashing for Message Authentication + * + ***************************************************************************/ + +#include "setup.h" + +#ifndef CURL_DISABLE_CRYPTO_AUTH + +#include "curl_hmac.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include <curl/mprintf.h> + +#include "curl_memory.h" +/* The last #include file should be: */ +#include "memdebug.h" + +/* + * Generic HMAC algorithm. + * + * This module computes HMAC digests based on any hash function. Parameters + * and computing procedures are set-up dynamically at HMAC computation + * context initialisation. + */ + +static const unsigned char hmac_ipad = 0x36; +static const unsigned char hmac_opad = 0x5C; + + + +HMAC_context * +Curl_HMAC_init(const HMAC_params * hashparams, + const unsigned char * key, + unsigned int keylen) +{ + size_t i; + HMAC_context * ctxt; + unsigned char * hkey; + unsigned char b; + + /* Create HMAC context. */ + i = sizeof *ctxt + 2 * hashparams->hmac_ctxtsize + hashparams->hmac_resultlen; + ctxt = (HMAC_context *) malloc(i); + + if(!ctxt) + return ctxt; + + ctxt->hmac_hash = hashparams; + ctxt->hmac_hashctxt1 = (void *) (ctxt + 1); + ctxt->hmac_hashctxt2 = (void *) ((char *) ctxt->hmac_hashctxt1 + + hashparams->hmac_ctxtsize); + + /* If the key is too long, replace it by its hash digest. */ + if(keylen > hashparams->hmac_maxkeylen) { + (*hashparams->hmac_hinit)(ctxt->hmac_hashctxt1); + (*hashparams->hmac_hupdate)(ctxt->hmac_hashctxt1, key, keylen); + hkey = (unsigned char *) ctxt->hmac_hashctxt2 + hashparams->hmac_ctxtsize; + (*hashparams->hmac_hfinal)(hkey, ctxt->hmac_hashctxt1); + key = hkey; + keylen = hashparams->hmac_resultlen; + } + + /* Prime the two hash contexts with the modified key. */ + (*hashparams->hmac_hinit)(ctxt->hmac_hashctxt1); + (*hashparams->hmac_hinit)(ctxt->hmac_hashctxt2); + + for (i = 0; i < keylen; i++) { + b = *key ^ hmac_ipad; + (*hashparams->hmac_hupdate)(ctxt->hmac_hashctxt1, &b, 1); + b = *key++ ^ hmac_opad; + (*hashparams->hmac_hupdate)(ctxt->hmac_hashctxt2, &b, 1); + } + + for (; i < hashparams->hmac_maxkeylen; i++) { + (*hashparams->hmac_hupdate)(ctxt->hmac_hashctxt1, &hmac_ipad, 1); + (*hashparams->hmac_hupdate)(ctxt->hmac_hashctxt2, &hmac_opad, 1); + } + + /* Done, return pointer to HMAC context. */ + return ctxt; +} + +int Curl_HMAC_update(HMAC_context * ctxt, + const unsigned char * data, + unsigned int len) +{ + /* Update first hash calculation. */ + (*ctxt->hmac_hash->hmac_hupdate)(ctxt->hmac_hashctxt1, data, len); + return 0; +} + + +int Curl_HMAC_final(HMAC_context * ctxt, unsigned char * result) +{ + const HMAC_params * hashparams = ctxt->hmac_hash; + + /* Do not get result if called with a null parameter: only release storage. */ + + if(!result) + result = (unsigned char *) ctxt->hmac_hashctxt2 + + ctxt->hmac_hash->hmac_ctxtsize; + + (*hashparams->hmac_hfinal)(result, ctxt->hmac_hashctxt1); + (*hashparams->hmac_hupdate)(ctxt->hmac_hashctxt2, + result, hashparams->hmac_resultlen); + (*hashparams->hmac_hfinal)(result, ctxt->hmac_hashctxt2); + free((char *) ctxt); + return 0; +} + +#endif /* CURL_DISABLE_CRYPTO_AUTH */ diff --git a/lib/hostares.c b/lib/hostares.c index 01b21429..a00fefa0 100644 --- a/lib/hostares.c +++ b/lib/hostares.c @@ -251,7 +251,7 @@ CURLcode Curl_wait_for_resolv(struct connectdata *conn, second is left, otherwise just use 1000ms to make sure the progress callback gets called frequent enough */ if(!tvp->tv_sec) - timeout_ms = tvp->tv_usec/1000; + timeout_ms = (int)(tvp->tv_usec/1000); else timeout_ms = 1000; diff --git a/lib/hostip.c b/lib/hostip.c index 8f6a52e4..6185c132 100644 --- a/lib/hostip.c +++ b/lib/hostip.c @@ -78,7 +78,9 @@ #if defined(CURLRES_SYNCH) && \ defined(HAVE_ALARM) && defined(SIGALRM) && defined(HAVE_SIGSETJMP) /* alarm-based timeouts can only be used with all the dependencies satisfied */ -#define USE_ALARM_TIMEOUT +// Disable this timeout, as there are a *lot* of crashes that seem to happen in +// this code on Mac, but not on Windows +// #define USE_ALARM_TIMEOUT #endif /* @@ -719,5 +721,3 @@ struct curl_hash *Curl_mk_dnscache(void) { return Curl_hash_alloc(7, Curl_hash_str, Curl_str_key_compare, freednsentry); } - - diff --git a/lib/hostip4.c b/lib/hostip4.c index fbc7d49b..05dd73e0 100644 --- a/lib/hostip4.c +++ b/lib/hostip4.c @@ -160,7 +160,7 @@ Curl_addrinfo *Curl_ipv4_resolve_r(const char *hostname, snprintf(sbuf, sizeof(sbuf), "%d", port); sbufptr = sbuf; } - hints.ai_flags = AI_CANONNAME; + (void)Curl_getaddrinfo_ex(hostname, sbufptr, &hints, &ai); #elif defined(HAVE_GETHOSTBYNAME_R) diff --git a/lib/hostip6.c b/lib/hostip6.c index fb3ad0c0..7d0a9122 100644 --- a/lib/hostip6.c +++ b/lib/hostip6.c @@ -213,11 +213,6 @@ Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn, /* the given address is numerical only, prevent a reverse lookup */ hints.ai_flags = AI_NUMERICHOST; } -#ifdef HAVE_GSSAPI - if(conn->data->set.krb) - /* if krb is used, we (might) need the canonical host name */ - hints.ai_flags |= AI_CANONNAME; -#endif if(port) { snprintf(sbuf, sizeof(sbuf), "%d", port); diff --git a/lib/hostthre.c b/lib/hostthre.c index 1e4845e2..e8dfa540 100644 --- a/lib/hostthre.c +++ b/lib/hostthre.c @@ -419,8 +419,6 @@ CURLcode Curl_is_resolved(struct connectdata *conn, if (done) { getaddrinfo_complete(conn); - if (td->poll_interval != 0) - Curl_expire(conn->data, 0); Curl_destroy_thread_data(&conn->async); if(!conn->async.dns) { @@ -431,26 +429,21 @@ CURLcode Curl_is_resolved(struct connectdata *conn, *entry = conn->async.dns; } else { /* poll for name lookup done with exponential backoff up to 250ms */ - int elapsed; - - elapsed = Curl_tvdiff(Curl_tvnow(), data->progress.t_startsingle); - if (elapsed < 0) { + int elapsed = Curl_tvdiff(Curl_tvnow(), data->progress.t_startsingle); + if (elapsed < 0) elapsed = 0; - } - if (td->poll_interval == 0) { + if (td->poll_interval == 0) /* Start at 1ms poll interval */ td->poll_interval = 1; - } else if (elapsed >= td->interval_end) { + else if (elapsed >= td->interval_end) /* Back-off exponentially if last interval expired */ td->poll_interval *= 2; - } if (td->poll_interval > 250) td->poll_interval = 250; td->interval_end = elapsed + td->poll_interval; - Curl_expire(conn->data, td->poll_interval); } @@ -484,8 +477,6 @@ Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn, int port, int *waitp) { - struct hostent *h = NULL; - struct SessionHandle *data = conn->data; struct in_addr in; *waitp = 0; /* default to synchronous response */ @@ -561,9 +552,7 @@ Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn, memset(&hints, 0, sizeof(hints)); hints.ai_family = pf; hints.ai_socktype = conn->socktype; -#if 0 /* removed nov 8 2005 before 7.15.1 */ - hints.ai_flags = AI_CANONNAME; -#endif + snprintf(sbuf, sizeof(sbuf), "%d", port); /* fire up a new resolver thread! */ @@ -977,12 +977,15 @@ Curl_send_buffer *Curl_add_buffer_init(void) * Returns CURLcode */ CURLcode Curl_add_buffer_send(Curl_send_buffer *in, - struct connectdata *conn, - long *bytes_written, /* add the number of sent bytes - to this counter */ - size_t included_body_bytes, /* how much of the buffer - contains body data */ - int socketindex) + struct connectdata *conn, + + /* add the number of sent bytes to this + counter */ + long *bytes_written, + + /* how much of the buffer contains body data */ + size_t included_body_bytes, + int socketindex) { ssize_t amount; @@ -1069,7 +1072,10 @@ CURLcode Curl_add_buffer_send(Curl_send_buffer *in, accordingly */ http->writebytecount += bodylen; - *bytes_written += amount; + /* 'amount' can never be a very large value here so typecasting it so a + signed 31 bit value should not cause problems even if ssize_t is + 64bit */ + *bytes_written += (long)amount; if(http) { if((size_t)amount != size) { @@ -1283,7 +1289,6 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn, struct SessionHandle *data=conn->data; struct SingleRequest *k = &data->req; CURLcode result; - int res; long timeout = data->set.timeout?data->set.timeout:PROXY_TIMEOUT; /* in milliseconds */ curl_socket_t tunnelsocket = conn->sock[sockindex]; @@ -1381,7 +1386,7 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn, if(CURLE_OK == result) { /* Now send off the request */ result = Curl_add_buffer_send(req_buffer, conn, - &data->info.request_size, 0, sockindex); + &data->info.request_size, 0, sockindex); } req_buffer = NULL; if(result) @@ -1467,11 +1472,10 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn, break; default: DEBUGASSERT(ptr+BUFSIZE-nread <= data->state.buffer+BUFSIZE+1); - res = Curl_read(conn, tunnelsocket, ptr, BUFSIZE-nread, &gotbytes); - if(res< 0) - /* EWOULDBLOCK */ + result = Curl_read(conn, tunnelsocket, ptr, BUFSIZE-nread, &gotbytes); + if(result==CURLE_AGAIN) continue; /* go loop yourself */ - else if(res) + else if(result) keepon = FALSE; else if(gotbytes <= 0) { keepon = FALSE; @@ -1817,9 +1821,9 @@ static CURLcode https_connecting(struct connectdata *conn, bool *done) } #endif -#ifdef USE_SSLEAY -/* This function is OpenSSL-specific. It should be made to query the generic - SSL layer instead. */ +#if defined(USE_SSLEAY) || defined(USE_GNUTLS) +/* This function is for OpenSSL and GnuTLS only. It should be made to query + the generic SSL layer instead. */ static int https_getsock(struct connectdata *conn, curl_socket_t *socks, int numsocks) @@ -1844,7 +1848,7 @@ static int https_getsock(struct connectdata *conn, return CURLE_OK; } #else -#ifdef USE_GNUTLS +#ifdef USE_NSS static int https_getsock(struct connectdata *conn, curl_socket_t *socks, int numsocks) @@ -1855,7 +1859,7 @@ static int https_getsock(struct connectdata *conn, return GETSOCK_BLANK; } #else -#ifdef USE_NSS +#ifdef USE_QSOSSL static int https_getsock(struct connectdata *conn, curl_socket_t *socks, int numsocks) @@ -1866,7 +1870,7 @@ static int https_getsock(struct connectdata *conn, return GETSOCK_BLANK; } #else -#ifdef USE_QSOSSL +#ifdef USE_POLARSSL static int https_getsock(struct connectdata *conn, curl_socket_t *socks, int numsocks) @@ -2224,7 +2228,10 @@ CURLcode Curl_http(struct connectdata *conn, bool *done) if((conn->protocol&PROT_HTTP) && data->set.upload && (data->set.infilesize == -1)) { - if (use_http_1_1(data, conn)) { + if(conn->bits.authneg) + /* don't enable chunked during auth neg */ + ; + else if(use_http_1_1(data, conn)) { /* HTTP, upload, unknown file size and not HTTP 1.0 */ data->req.upload_chunky = TRUE; } @@ -2529,7 +2536,8 @@ CURLcode Curl_http(struct connectdata *conn, bool *done) /* url */ if (paste_ftp_userpwd) result = Curl_add_bufferf(req_buffer, "ftp://%s:%s@%s", - conn->user, conn->passwd, ppath + sizeof("ftp://") - 1); + conn->user, conn->passwd, + ppath + sizeof("ftp://") - 1); else result = Curl_add_buffer(req_buffer, ppath, strlen(ppath)); if (result) @@ -2665,14 +2673,13 @@ CURLcode Curl_http(struct connectdata *conn, bool *done) return result; result = Curl_add_buffer_send(req_buffer, conn, - &data->info.request_size, 0, FIRSTSOCKET); + &data->info.request_size, 0, FIRSTSOCKET); if(result) failf(data, "Failed sending POST request"); else /* setup variables for the upcoming transfer */ - result = Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE, - &http->readbytecount, - -1, NULL); + Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE, &http->readbytecount, + -1, NULL); break; } @@ -2735,15 +2742,14 @@ CURLcode Curl_http(struct connectdata *conn, bool *done) /* fire away the whole request to the server */ result = Curl_add_buffer_send(req_buffer, conn, - &data->info.request_size, 0, FIRSTSOCKET); + &data->info.request_size, 0, FIRSTSOCKET); if(result) failf(data, "Failed sending POST request"); else /* setup variables for the upcoming transfer */ - result = Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE, - &http->readbytecount, - FIRSTSOCKET, - &http->writebytecount); + Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE, + &http->readbytecount, FIRSTSOCKET, + &http->writebytecount); if(result) { Curl_formclean(&http->sendit); /* free that whole lot */ @@ -2788,15 +2794,14 @@ CURLcode Curl_http(struct connectdata *conn, bool *done) /* this sends the buffer and frees all the buffer resources */ result = Curl_add_buffer_send(req_buffer, conn, - &data->info.request_size, 0, FIRSTSOCKET); + &data->info.request_size, 0, FIRSTSOCKET); if(result) failf(data, "Failed sending PUT request"); else /* prepare for transfer */ - result = Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE, - &http->readbytecount, - postsize?FIRSTSOCKET:-1, - postsize?&http->writebytecount:NULL); + Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE, + &http->readbytecount, postsize?FIRSTSOCKET:-1, + postsize?&http->writebytecount:NULL); if(result) return result; break; @@ -2889,6 +2894,8 @@ CURLcode Curl_http(struct connectdata *conn, bool *done) } if(result) return result; + /* Make sure the progress information is accurate */ + Curl_pgrsSetUploadSize(data, postsize); } else { /* A huge POST coming up, do data separate from the request */ @@ -2938,16 +2945,14 @@ CURLcode Curl_http(struct connectdata *conn, bool *done) } /* issue the request */ result = Curl_add_buffer_send(req_buffer, conn, &data->info.request_size, - (size_t)included_body, FIRSTSOCKET); + (size_t)included_body, FIRSTSOCKET); if(result) failf(data, "Failed sending HTTP POST request"); else - result = - Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE, - &http->readbytecount, - http->postdata?FIRSTSOCKET:-1, - http->postdata?&http->writebytecount:NULL); + Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE, + &http->readbytecount, http->postdata?FIRSTSOCKET:-1, + http->postdata?&http->writebytecount:NULL); break; default: @@ -2957,16 +2962,15 @@ CURLcode Curl_http(struct connectdata *conn, bool *done) /* issue the request */ result = Curl_add_buffer_send(req_buffer, conn, - &data->info.request_size, 0, FIRSTSOCKET); + &data->info.request_size, 0, FIRSTSOCKET); if(result) failf(data, "Failed sending HTTP request"); else /* HTTP GET/HEAD download: */ - result = Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE, - &http->readbytecount, - http->postdata?FIRSTSOCKET:-1, - http->postdata?&http->writebytecount:NULL); + Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE, &http->readbytecount, + http->postdata?FIRSTSOCKET:-1, + http->postdata?&http->writebytecount:NULL); } if(result) return result; @@ -3289,13 +3293,6 @@ CURLcode Curl_http_readwrite_headers(struct SessionHandle *data, data->req.deductheadercount = (100 <= k->httpcode && 199 >= k->httpcode)?data->req.headerbytecount:0; - if(data->state.resume_from && - (data->set.httpreq==HTTPREQ_GET) && - (k->httpcode == 416)) { - /* "Requested Range Not Satisfiable" */ - *stop_reading = TRUE; - } - if(!*stop_reading) { /* Curl_http_auth_act() checks what authentication methods * that are available and decides which one (if any) to @@ -3508,9 +3505,6 @@ CURLcode Curl_http_readwrite_headers(struct SessionHandle *data, * message-body, and thus is always terminated by the first * empty line after the header fields. */ /* FALLTHROUGH */ - case 416: /* Requested Range Not Satisfiable, it has the - Content-Length: set as the "real" document but no - actual response is sent. */ case 304: /* (quote from RFC2616, section 10.3.5): The 304 response * MUST NOT contain a message-body, and thus is always @@ -3542,10 +3536,7 @@ CURLcode Curl_http_readwrite_headers(struct SessionHandle *data, /* Curl_convert_from_network calls failf if unsuccessful */ #endif /* CURL_DOES_CONVERSIONS */ - /* Check for Content-Length: header lines to get size. Ignore - the header completely if we get a 416 response as then we're - resuming a document that we don't get, and this header contains - info about the true size of the document we didn't get now. */ + /* Check for Content-Length: header lines to get size */ if(!k->ignorecl && !data->set.ignorecl && checkprefix("Content-Length:", k->p)) { curl_off_t contentlength = curlx_strtoofft(k->p+15, NULL, 10); @@ -3643,20 +3634,6 @@ CURLcode Curl_http_readwrite_headers(struct SessionHandle *data, /* init our chunky engine */ Curl_httpchunk_init(conn); } - - else if(checkprefix("Trailer:", k->p) || - checkprefix("Trailers:", k->p)) { - /* - * This test helps Curl_httpchunk_read() to determine to look - * for well formed trailers after the zero chunksize record. In - * this case a CRLF is required after the zero chunksize record - * when no trailers are sent, or after the last trailer record. - * - * It seems both Trailer: and Trailers: occur in the wild. - */ - k->trailerhdrpresent = TRUE; - } - else if(checkprefix("Content-Encoding:", k->p) && data->set.str[STRING_ENCODING]) { /* @@ -56,11 +56,10 @@ Curl_send_buffer *Curl_add_buffer_init(void); CURLcode Curl_add_bufferf(Curl_send_buffer *in, const char *fmt, ...); CURLcode Curl_add_buffer(Curl_send_buffer *in, const void *inptr, size_t size); CURLcode Curl_add_buffer_send(Curl_send_buffer *in, - struct connectdata *conn, - long *bytes_written, - size_t included_body_bytes, - int socketindex); - + struct connectdata *conn, + long *bytes_written, + size_t included_body_bytes, + int socketindex); CURLcode Curl_add_timecondition(struct SessionHandle *data, Curl_send_buffer *buf); diff --git a/lib/http_chunks.c b/lib/http_chunks.c index a66f8721..0d41979a 100644 --- a/lib/http_chunks.c +++ b/lib/http_chunks.c @@ -184,22 +184,8 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn, if(*datap == 0x0a) { /* we're now expecting data to come, unless size was zero! */ if(0 == ch->datasize) { - if(k->trailerhdrpresent!=TRUE) { - /* No Trailer: header found - revert to original Curl processing */ - ch->state = CHUNK_STOPCR; - - /* We need to increment the datap here since we bypass the - increment below with the immediate break */ - length--; - datap++; - - /* This is the final byte, continue to read the final CRLF */ - break; - } - else { - ch->state = CHUNK_TRAILER; /* attempt to read trailers */ - conn->trlPos=0; - } + ch->state = CHUNK_TRAILER; /* now check for trailers */ + conn->trlPos=0; } else { ch->state = CHUNK_DATA; @@ -280,9 +266,9 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn, datap++; length--; } - else { + else return CHUNKE_BAD_CHUNK; - } + break; case CHUNK_POSTLF: @@ -295,80 +281,32 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn, datap++; length--; } - else { + else return CHUNKE_BAD_CHUNK; - } break; case CHUNK_TRAILER: - /* conn->trailer is assumed to be freed in url.c on a - connection basis */ - if(conn->trlPos >= conn->trlMax) { - /* in this logic we always allocate one byte more than trlMax - contains, just because CHUNK_TRAILER_POSTCR will append two bytes - so we need to make sure we have room for an extra byte */ - char *ptr; - if(conn->trlMax) { - conn->trlMax *= 2; - ptr = realloc(conn->trailer, conn->trlMax + 1); - } - else { - conn->trlMax=128; - ptr = malloc(conn->trlMax + 1); - } - if(!ptr) - return CHUNKE_OUT_OF_MEMORY; - conn->trailer = ptr; - } - conn->trailer[conn->trlPos++]=*datap; - - if(*datap == 0x0d) - ch->state = CHUNK_TRAILER_CR; - else { - datap++; - length--; - } - break; - - case CHUNK_TRAILER_CR: if(*datap == 0x0d) { - ch->state = CHUNK_TRAILER_POSTCR; - datap++; - length--; - } - else - return CHUNKE_BAD_CHUNK; - break; - - case CHUNK_TRAILER_POSTCR: - if(*datap == 0x0a) { - conn->trailer[conn->trlPos++]=0x0a; - conn->trailer[conn->trlPos]=0; - if(conn->trlPos==2) { - ch->state = CHUNK_STOP; - length--; + /* this is the end of a trailer, but if the trailer was zero bytes + there was no trailer and we move on */ - /* - * Note that this case skips over the final STOP states since we've - * already read the final CRLF and need to return - */ + if(conn->trlPos) { + /* we allocate trailer with 3 bytes extra room to fit this */ + conn->trailer[conn->trlPos++]=0x0d; + conn->trailer[conn->trlPos++]=0x0a; + conn->trailer[conn->trlPos]=0; - ch->dataleft = length; - - return CHUNKE_STOP; /* return stop */ - } - else { #ifdef CURL_DOES_CONVERSIONS /* Convert to host encoding before calling Curl_client_write */ result = Curl_convert_from_network(conn->data, conn->trailer, conn->trlPos); - if(result != CURLE_OK) { + if(result != CURLE_OK) /* Curl_convert_from_network calls failf if unsuccessful */ /* Treat it as a bad chunk */ - return(CHUNKE_BAD_CHUNK); - } + return CHUNKE_BAD_CHUNK; + #endif /* CURL_DOES_CONVERSIONS */ if(!data->set.http_te_skip) { result = Curl_client_write(conn, CLIENTWRITE_HEADER, @@ -376,9 +314,44 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn, if(result) return CHUNKE_WRITE_ERROR; } + conn->trlPos=0; + ch->state = CHUNK_TRAILER_CR; } - ch->state = CHUNK_TRAILER; - conn->trlPos=0; + else { + /* no trailer, we're on the final CRLF pair */ + ch->state = CHUNK_TRAILER_POSTCR; + break; /* don't advance the pointer */ + } + } + else { + /* conn->trailer is assumed to be freed in url.c on a + connection basis */ + if(conn->trlPos >= conn->trlMax) { + /* we always allocate three extra bytes, just because when the full + header has been received we append CRLF\0 */ + char *ptr; + if(conn->trlMax) { + conn->trlMax *= 2; + ptr = realloc(conn->trailer, conn->trlMax + 3); + } + else { + conn->trlMax=128; + ptr = malloc(conn->trlMax + 3); + } + if(!ptr) + return CHUNKE_OUT_OF_MEMORY; + conn->trailer = ptr; + } + fprintf(stderr, "MOO: %c\n", *datap); + conn->trailer[conn->trlPos++]=*datap; + } + datap++; + length--; + break; + + case CHUNK_TRAILER_CR: + if(*datap == 0x0a) { + ch->state = CHUNK_TRAILER_POSTCR; datap++; length--; } @@ -386,6 +359,20 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn, return CHUNKE_BAD_CHUNK; break; + case CHUNK_TRAILER_POSTCR: + /* We enter this state when a CR should arrive so we expect to + have to first pass a CR before we wait for LF */ + if(*datap != 0x0d) { + /* not a CR then it must be another header in the trailer */ + ch->state = CHUNK_TRAILER; + break; + } + datap++; + length--; + /* now wait for the final LF */ + ch->state = CHUNK_STOP; + break; + case CHUNK_STOPCR: /* Read the final CRLF that ends all chunk bodies */ @@ -394,9 +381,8 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn, datap++; length--; } - else { + else return CHUNKE_BAD_CHUNK; - } break; case CHUNK_STOP: @@ -409,9 +395,8 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn, ch->dataleft = length; return CHUNKE_STOP; /* return stop */ } - else { + else return CHUNKE_BAD_CHUNK; - } default: return CHUNKE_STATE_ERROR; diff --git a/lib/http_digest.c b/lib/http_digest.c index ff3871c9..be40fc7f 100644 --- a/lib/http_digest.c +++ b/lib/http_digest.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -129,7 +129,6 @@ CURLdigest Curl_input_digest(struct connectdata *conn, const char *header) /* rest of the *-authenticate: header */ { - bool more = TRUE; char *token = NULL; char *tmp = NULL; bool foundAuth = FALSE; @@ -159,7 +158,7 @@ CURLdigest Curl_input_digest(struct connectdata *conn, /* clear off any former leftovers and init to defaults */ Curl_digest_cleanup_one(d); - while(more) { + while(1) { char value[MAX_VALUE_LENGTH]; char content[MAX_CONTENT_LENGTH]; diff --git a/lib/http_negotiate.c b/lib/http_negotiate.c index 956f7342..80b0b507 100644 --- a/lib/http_negotiate.c +++ b/lib/http_negotiate.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -277,6 +277,7 @@ CURLcode Curl_output_negotiate(struct connectdata *conn, bool proxy) &conn->data->state.negotiate; char *encoded = NULL; size_t len; + char *userp; #ifdef HAVE_SPNEGO /* Handle SPNEGO */ if(checkprefix("Negotiate", neg_ctx->protocol)) { @@ -305,9 +306,15 @@ CURLcode Curl_output_negotiate(struct connectdata *conn, bool proxy) infof(conn->data, "Make SPNEGO Initial Token failed\n"); } else { - free(neg_ctx->output_token.value); + free(responseToken); responseToken = NULL; + free(neg_ctx->output_token.value); neg_ctx->output_token.value = malloc(spnegoTokenLength); + if(neg_ctx->output_token.value == NULL) { + free(spnegoToken); + spnegoToken = NULL; + return CURLE_OUT_OF_MEMORY; + } memcpy(neg_ctx->output_token.value, spnegoToken,spnegoTokenLength); neg_ctx->output_token.length = spnegoTokenLength; free(spnegoToken); @@ -324,12 +331,16 @@ CURLcode Curl_output_negotiate(struct connectdata *conn, bool proxy) if(len == 0) return CURLE_OUT_OF_MEMORY; - conn->allocptr.userpwd = - aprintf("%sAuthorization: %s %s\r\n", proxy ? "Proxy-" : "", - neg_ctx->protocol, encoded); + userp = aprintf("%sAuthorization: %s %s\r\n", proxy ? "Proxy-" : "", + neg_ctx->protocol, encoded); + + if(proxy) + conn->allocptr.proxyuserpwd = userp; + else + conn->allocptr.userpwd = userp; free(encoded); Curl_cleanup_negotiate (conn->data); - return (conn->allocptr.userpwd == NULL) ? CURLE_OUT_OF_MEMORY : CURLE_OK; + return (userp == NULL) ? CURLE_OUT_OF_MEMORY : CURLE_OK; } static void cleanup(struct negotiatedata *neg_ctx) diff --git a/lib/http_ntlm.c b/lib/http_ntlm.c index 36e538ea..f5b696a6 100644 --- a/lib/http_ntlm.c +++ b/lib/http_ntlm.c @@ -58,6 +58,7 @@ #include "curl_base64.h" #include "http_ntlm.h" #include "url.h" +#include "curl_gethostname.h" #include "curl_memory.h" #define _MPRINTF_REPLACE /* use our functions only */ @@ -116,6 +117,15 @@ #define MD5_DIGEST_LENGTH 16 #define MD4_DIGEST_LENGTH 16 +#elif defined(USE_NSS) + +#include "curl_md4.h" +#include "nssg.h" +#include <nss.h> +#include <pk11pub.h> +#include <hasht.h> +#define MD5_DIGEST_LENGTH MD5_LENGTH + #elif defined(USE_WINDOWS_SSPI) #include "curl_sspi.h" @@ -250,6 +260,11 @@ CURLntlm Curl_input_ntlm(struct connectdata *conn, static const char type2_marker[] = { 0x02, 0x00, 0x00, 0x00 }; #endif +#ifdef USE_NSS + if(CURLE_OK != Curl_nss_force_init(conn->data)) + return CURLNTLM_BAD; +#endif + ntlm = proxy?&conn->proxyntlm:&conn->ntlm; /* skip initial whitespaces */ @@ -351,16 +366,14 @@ static void setup_des_key(const unsigned char *key_56, DES_set_odd_parity(&key); DES_set_key(&key, ks); } -#elif defined(USE_GNUTLS) + +#else /* defined(USE_SSLEAY) */ /* - * Turns a 56 bit key into the 64 bit, odd parity key and sets the key. + * Turns a 56 bit key into the 64 bit, odd parity key. Used by GnuTLS and NSS. */ -static void setup_des_key(const unsigned char *key_56, - gcry_cipher_hd_t *des) +static void extend_key_56_to_64(const unsigned char *key_56, char *key) { - char key[8]; - key[0] = key_56[0]; key[1] = (unsigned char)(((key_56[0] << 7) & 0xFF) | (key_56[1] >> 1)); key[2] = (unsigned char)(((key_56[1] << 6) & 0xFF) | (key_56[2] >> 2)); @@ -369,10 +382,84 @@ static void setup_des_key(const unsigned char *key_56, key[5] = (unsigned char)(((key_56[4] << 3) & 0xFF) | (key_56[5] >> 5)); key[6] = (unsigned char)(((key_56[5] << 2) & 0xFF) | (key_56[6] >> 6)); key[7] = (unsigned char) ((key_56[6] << 1) & 0xFF); +} + +#if defined(USE_GNUTLS) +/* + * Turns a 56 bit key into the 64 bit, odd parity key and sets the key. + */ +static void setup_des_key(const unsigned char *key_56, + gcry_cipher_hd_t *des) +{ + char key[8]; + extend_key_56_to_64(key_56, key); gcry_cipher_setkey(*des, key, 8); } -#endif + +#elif defined(USE_NSS) + +/* + * Expands a 56 bit key KEY_56 to 64 bit and encrypts 64 bit of data, using + * the expanded key. The caller is responsible for giving 64 bit of valid + * data is IN and (at least) 64 bit large buffer as OUT. + */ +static bool encrypt_des(const unsigned char *in, unsigned char *out, + const unsigned char *key_56) +{ + const CK_MECHANISM_TYPE mech = CKM_DES_ECB; /* DES cipher in ECB mode */ + PK11SlotInfo *slot = NULL; + char key[8]; /* expanded 64 bit key */ + SECItem key_item; + PK11SymKey *symkey = NULL; + SECItem *param = NULL; + PK11Context *ctx = NULL; + int out_len; /* not used, required by NSS */ + bool rv = FALSE; + + /* use internal slot for DES encryption (requires NSS to be initialized) */ + slot = PK11_GetInternalKeySlot(); + if(!slot) + return FALSE; + + /* expand the 56 bit key to 64 bit and wrap by NSS */ + extend_key_56_to_64(key_56, key); + key_item.data = (unsigned char *)key; + key_item.len = /* hard-wired */ 8; + symkey = PK11_ImportSymKey(slot, mech, PK11_OriginUnwrap, CKA_ENCRYPT, + &key_item, NULL); + if(!symkey) + goto fail; + + /* create DES encryption context */ + param = PK11_ParamFromIV(mech, /* no IV in ECB mode */ NULL); + if(!param) + goto fail; + ctx = PK11_CreateContextBySymKey(mech, CKA_ENCRYPT, symkey, param); + if(!ctx) + goto fail; + + /* perform the encryption */ + if(SECSuccess == PK11_CipherOp(ctx, out, &out_len, /* outbuflen */ 8, + (unsigned char *)in, /* inbuflen */ 8) + && SECSuccess == PK11_Finalize(ctx)) + rv = /* all OK */ TRUE; + +fail: + /* cleanup */ + if(ctx) + PK11_DestroyContext(ctx, PR_TRUE); + if(symkey) + PK11_FreeSymKey(symkey); + if(param) + SECITEM_FreeItem(param, PR_TRUE); + PK11_FreeSlot(slot); + return rv; +} + +#endif /* defined(USE_NSS) */ + +#endif /* defined(USE_SSLEAY) */ /* * takes a 21 byte array and treats it as 3 56-bit DES keys. The @@ -414,6 +501,10 @@ static void lm_resp(const unsigned char *keys, setup_des_key(keys+14, &des); gcry_cipher_encrypt(des, results+16, 8, plaintext, 8); gcry_cipher_close(des); +#elif defined(USE_NSS) + encrypt_des(plaintext, results, keys); + encrypt_des(plaintext, results+8, keys+7); + encrypt_des(plaintext, results+16, keys+14); #endif } @@ -470,11 +561,14 @@ static void mk_lm_hash(struct SessionHandle *data, setup_des_key(pw+7, &des); gcry_cipher_encrypt(des, lmbuffer+8, 8, magic, 8); gcry_cipher_close(des); +#elif defined(USE_NSS) + encrypt_des(magic, lmbuffer, pw); + encrypt_des(magic, lmbuffer+8, pw+7); #endif memset(lmbuffer + 16, 0, 21 - 16); } - } +} #if USE_NTRESPONSES static void ascii_to_unicode_le(unsigned char *dest, const char *src, @@ -525,6 +619,8 @@ static CURLcode mk_nt_hash(struct SessionHandle *data, gcry_md_write(MD4pw, pw, 2*len); memcpy (ntbuffer, gcry_md_read (MD4pw, 0), MD4_DIGEST_LENGTH); gcry_md_close(MD4pw); +#elif defined(USE_NSS) + Curl_md4it(ntbuffer, pw, 2*len); #endif memset(ntbuffer + 16, 0, 21 - 16); @@ -599,6 +695,11 @@ CURLcode Curl_output_ntlm(struct connectdata *conn, DEBUGASSERT(conn); DEBUGASSERT(conn->data); +#ifdef USE_NSS + if(CURLE_OK != Curl_nss_force_init(conn->data)) + return CURLE_OUT_OF_MEMORY; +#endif + if(proxy) { allocuserpwd = &conn->allocptr.proxyuserpwd; userp = conn->proxyuser; @@ -894,7 +995,7 @@ CURLcode Curl_output_ntlm(struct connectdata *conn, user = userp; userlen = strlen(user); - if(gethostname(host, HOSTNAME_MAX)) { + if(Curl_gethostname(host, HOSTNAME_MAX)) { infof(conn->data, "gethostname() failed, continuing without!"); hostlen = 0; } @@ -926,6 +1027,11 @@ CURLcode Curl_output_ntlm(struct connectdata *conn, gcry_md_hd_t MD5pw; Curl_gtls_seed(conn->data); /* Initiate the seed if not already done */ gcry_randomize(entropy, 8, GCRY_STRONG_RANDOM); +#elif defined(USE_NSS) + PK11Context *MD5pw; + unsigned int outlen; + Curl_nss_seed(conn->data); /* Initiate the seed if not already done */ + PK11_GenerateRandom(entropy, 8); #endif /* 8 bytes random data as challenge in lmresp */ @@ -946,6 +1052,11 @@ CURLcode Curl_output_ntlm(struct connectdata *conn, gcry_md_write(MD5pw, tmp, MD5_DIGEST_LENGTH); memcpy(md5sum, gcry_md_read (MD5pw, 0), MD5_DIGEST_LENGTH); gcry_md_close(MD5pw); +#elif defined(USE_NSS) + MD5pw = PK11_CreateDigestContext(SEC_OID_MD5); + PK11_DigestOp(MD5pw, tmp, 16); + PK11_DigestFinal(MD5pw, md5sum, &outlen, MD5_DIGEST_LENGTH); + PK11_DestroyContext(MD5pw, PR_TRUE); #endif /* We shall only use the first 8 bytes of md5sum, @@ -436,12 +436,11 @@ static CURLcode imap_state_fetch_resp(struct connectdata *conn, if(!filesize) /* the entire data is already transfered! */ - result=Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL); + Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL); else /* IMAP download */ - result=Curl_setup_transfer(conn, FIRSTSOCKET, filesize, FALSE, - imap->bytecountp, - -1, NULL); /* no upload here */ + Curl_setup_transfer(conn, FIRSTSOCKET, filesize, FALSE, + imap->bytecountp, -1, NULL); /* no upload here */ data->req.maxdownload = filesize; } @@ -924,15 +923,14 @@ static CURLcode imap_parse_url_path(struct connectdata *conn) static CURLcode imap_dophase_done(struct connectdata *conn, bool connected) { - CURLcode result = CURLE_OK; struct FTP *imap = conn->data->state.proto.imap; (void)connected; if(imap->transfer != FTPTRANSFER_BODY) /* no data to transfer */ - result=Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL); + Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL); - return result; + return CURLE_OK; } /* called from multi.c while DOing */ diff --git a/lib/inet_pton.c b/lib/inet_pton.c index 9189ce67..db4f3930 100644 --- a/lib/inet_pton.c +++ b/lib/inet_pton.c @@ -159,7 +159,7 @@ inet_pton6(const char *src, unsigned char *dst) unsigned char tmp[IN6ADDRSZ], *tp, *endp, *colonp; const char *xdigits, *curtok; int ch, saw_xdigit; - unsigned int val; + size_t val; memset((tp = tmp), 0, IN6ADDRSZ); endp = tp + IN6ADDRSZ; @@ -218,8 +218,8 @@ inet_pton6(const char *src, unsigned char *dst) * Since some memmove()'s erroneously fail to handle * overlapping regions, we'll do the shift by hand. */ - const long n = tp - colonp; - long i; + const size_t n = tp - colonp; + size_t i; if(tp == endp) return (0); @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2006, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -47,24 +47,20 @@ extern struct Curl_sec_client_mech Curl_krb5_client_mech; #endif CURLcode Curl_krb_kauth(struct connectdata *conn); -int Curl_sec_fflush_fd(struct connectdata *conn, int fd); int Curl_sec_fprintf (struct connectdata *, FILE *, const char *, ...); int Curl_sec_getc (struct connectdata *conn, FILE *); int Curl_sec_putc (struct connectdata *conn, int, FILE *); -int Curl_sec_read (struct connectdata *conn, int, void *, int); int Curl_sec_read_msg (struct connectdata *conn, char *, int); int Curl_sec_vfprintf(struct connectdata *, FILE *, const char *, va_list); int Curl_sec_fprintf2(struct connectdata *conn, FILE *f, const char *fmt, ...); int Curl_sec_vfprintf2(struct connectdata *conn, FILE *, const char *, va_list); -ssize_t Curl_sec_send(struct connectdata *conn, int, const char *, int); -int Curl_sec_write(struct connectdata *conn, int, const char *, int); void Curl_sec_end (struct connectdata *); -int Curl_sec_login (struct connectdata *); +CURLcode Curl_sec_login (struct connectdata *); void Curl_sec_prot (int, char **); int Curl_sec_request_prot (struct connectdata *conn, const char *level); -void Curl_sec_set_protection_level(struct connectdata *conn); +int Curl_sec_set_protection_level(struct connectdata *conn); void Curl_sec_status (void); enum protection_level Curl_set_command_prot(struct connectdata *, @@ -1,6 +1,6 @@ /* GSSAPI/krb5 support for FTP - loosely based on old krb4.c * - * Copyright (c) 1995, 1996, 1997, 1998, 1999 Kungliga Tekniska Högskolan + * Copyright (c) 1995, 1996, 1997, 1998, 1999, 2010 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * Copyright (c) 2004 - 2009 Daniel Stenberg * All rights reserved. @@ -76,9 +76,18 @@ #define REMOTE_ADDR conn->ip_addr->ai_addr static int +krb5_init(void *app_data) +{ + gss_ctx_id_t *context = app_data; + /* Make sure our context is initialized for krb5_end. */ + *context = GSS_C_NO_CONTEXT; + return 0; +} + +static int krb5_check_prot(void *app_data, int level) { - app_data = NULL; /* prevent compiler warning */ + (void)app_data; /* unused */ if(level == prot_confidential) return -1; return 0; @@ -161,15 +170,15 @@ krb5_encode(void *app_data, const void *from, int length, int level, void **to, static int krb5_auth(void *app_data, struct connectdata *conn) { - int ret; + int ret = AUTH_OK; char *p; - const char *host = conn->dns_entry->addr->ai_canonname; + const char *host = conn->host.name; ssize_t nread; curl_socklen_t l = sizeof(conn->local_addr); struct SessionHandle *data = conn->data; CURLcode result; const char *service = "ftp", *srv_host = "host"; - gss_buffer_desc gssbuf, _gssresp, *gssresp; + gss_buffer_desc input_buffer, output_buffer, _gssresp, *gssresp; OM_uint32 maj, min; gss_name_t gssname; gss_ctx_id_t *context = app_data; @@ -205,28 +214,31 @@ krb5_auth(void *app_data, struct connectdata *conn) return -1; } - gssbuf.value = data->state.buffer; - gssbuf.length = snprintf(gssbuf.value, BUFSIZE, "%s@%s", service, host); - maj = gss_import_name(&min, &gssbuf, GSS_C_NT_HOSTBASED_SERVICE, &gssname); + input_buffer.value = data->state.buffer; + input_buffer.length = snprintf(input_buffer.value, BUFSIZE, "%s@%s", + service, host); + maj = gss_import_name(&min, &input_buffer, GSS_C_NT_HOSTBASED_SERVICE, + &gssname); if(maj != GSS_S_COMPLETE) { gss_release_name(&min, &gssname); if(service == srv_host) { - Curl_failf(data, "Error importing service name %s", gssbuf.value); + Curl_failf(data, "Error importing service name %s", input_buffer.value); return AUTH_ERROR; } service = srv_host; continue; } - { - gss_OID t; - gss_display_name(&min, gssname, &gssbuf, &t); - Curl_infof(data, "Trying against %s\n", gssbuf.value); - gss_release_buffer(&min, &gssbuf); - } + /* We pass NULL as |output_name_type| to avoid a leak. */ + gss_display_name(&min, gssname, &output_buffer, NULL); + Curl_infof(data, "Trying against %s\n", output_buffer.value); gssresp = GSS_C_NO_BUFFER; *context = GSS_C_NO_CONTEXT; do { + /* Release the buffer at each iteration to avoid leaking: the first time + we are releasing the memory from gss_display_name. The last item is + taken care by a final gss_release_buffer. */ + gss_release_buffer(&min, &output_buffer); ret = AUTH_OK; maj = gss_init_sec_context(&min, GSS_C_NO_CREDENTIAL, @@ -238,7 +250,7 @@ krb5_auth(void *app_data, struct connectdata *conn) &chan, gssresp, NULL, - &gssbuf, + &output_buffer, NULL, NULL); @@ -253,9 +265,9 @@ krb5_auth(void *app_data, struct connectdata *conn) break; } - if(gssbuf.length != 0) { - if(Curl_base64_encode(data, (char *)gssbuf.value, gssbuf.length, &p) - < 1) { + if(output_buffer.length != 0) { + if(Curl_base64_encode(data, (char *)output_buffer.value, + output_buffer.length, &p) < 1) { Curl_infof(data, "Out of memory base64-encoding"); ret = AUTH_CONTINUE; break; @@ -298,6 +310,7 @@ krb5_auth(void *app_data, struct connectdata *conn) } while(maj == GSS_S_CONTINUE_NEEDED); gss_release_name(&min, &gssname); + gss_release_buffer(&min, &output_buffer); if(gssresp) free(_gssresp.value); @@ -307,14 +320,25 @@ krb5_auth(void *app_data, struct connectdata *conn) service = srv_host; } + return ret; +} + +static void krb5_end(void *app_data) +{ + OM_uint32 maj, min; + gss_ctx_id_t *context = app_data; + if (*context != GSS_C_NO_CONTEXT) { + maj = gss_delete_sec_context(&min, context, GSS_C_NO_BUFFER); + DEBUGASSERT(maj == GSS_S_COMPLETE); + } } struct Curl_sec_client_mech Curl_krb5_client_mech = { "GSSAPI", sizeof(gss_ctx_id_t), - NULL, /* init */ + krb5_init, krb5_auth, - NULL, /* end */ + krb5_end, krb5_check_prot, krb5_overhead, krb5_encode, @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -22,7 +22,19 @@ #include "setup.h" -#ifndef CURL_DISABLE_LDAP +#if !defined(CURL_DISABLE_LDAP) && !defined(USE_OPENLDAP) + +/* + * Notice that USE_OPENLDAP is only a source code selection switch. When + * libcurl is built with USE_OPENLDAP defined the libcurl source code that + * gets compiled is the code from openldap.c, otherwise the code that gets + * compiled is the code from ldap.c. + * + * When USE_OPENLDAP is defined a recent version of the OpenLDAP library + * might be required for compilation and runtime. In order to use ancient + * OpenLDAP library versions, USE_OPENLDAP shall not be defined. + */ + /* -- WIN32 approved -- */ #include <stdio.h> #include <string.h> @@ -31,15 +43,7 @@ #include <ctype.h> #include <errno.h> -#ifdef CURL_LDAP_HYBRID /* If W$ definitions are needed. */ -# include <windows.h> - /* Remember we are NOT in a W$ compiler! */ -# undef WIN32 -# undef _WIN32 -# undef __WIN32__ -#endif - -#ifdef CURL_LDAP_WIN /* Use W$ LDAP implementation. */ +#ifdef CURL_LDAP_WIN /* Use Windows LDAP implementation. */ # include <winldap.h> # ifndef LDAP_VENDOR_NAME # error Your Platform SDK is NOT sufficient for LDAP support! Update your Platform SDK, or disable LDAP support! @@ -47,14 +51,14 @@ # include <winber.h> # endif #else -#define LDAP_DEPRECATED 1 /* Be sure ldap_init() is defined. */ -#ifdef HAVE_LBER_H -# include <lber.h> -#endif +# define LDAP_DEPRECATED 1 /* Be sure ldap_init() is defined. */ +# ifdef HAVE_LBER_H +# include <lber.h> +# endif # include <ldap.h> -#if (defined(HAVE_LDAP_SSL) && defined(HAVE_LDAP_SSL_H)) -# include <ldap_ssl.h> -#endif /* HAVE_LDAP_SSL && HAVE_LDAP_SSL_H */ +# if (defined(HAVE_LDAP_SSL) && defined(HAVE_LDAP_SSL_H)) +# include <ldap_ssl.h> +# endif /* HAVE_LDAP_SSL && HAVE_LDAP_SSL_H */ #endif #ifdef HAVE_UNISTD_H @@ -715,4 +719,4 @@ static void _ldap_free_urldesc (LDAPURLDesc *ludp) free (ludp); } #endif /* !HAVE_LDAP_URL_PARSE */ -#endif /* CURL_DISABLE_LDAP */ +#endif /* !CURL_DISABLE_LDAP && !USE_OPENLDAP */ diff --git a/lib/libcurl.imp b/lib/libcurl.imp new file mode 100644 index 00000000..74943afa --- /dev/null +++ b/lib/libcurl.imp @@ -0,0 +1,51 @@ +# +# Definition file for the NLM version of the LIBCURL library from curl +# +# (LIBCURL) + curl_easy_cleanup, + curl_easy_escape, + curl_easy_unescape, + curl_easy_getinfo, + curl_easy_init, + curl_easy_pause, + curl_easy_perform, + curl_easy_setopt, + curl_escape, + curl_unescape, + curl_formfree, + curl_getdate, + curl_getenv, + curl_global_cleanup, + curl_global_init, + curl_slist_append, + curl_slist_free_all, + curl_version, + curl_maprintf, + curl_mfprintf, + curl_mprintf, + curl_msprintf, + curl_msnprintf, + curl_mvfprintf, + curl_mvsnprintf, + curl_strequal, + curl_strnequal, + curl_easy_duphandle, + curl_formadd, + curl_multi_init, + curl_multi_add_handle, + curl_multi_remove_handle, + curl_multi_fdset, + curl_multi_perform, + curl_multi_cleanup, + curl_multi_info_read, + curl_free, + curl_version_info, + curl_share_init, + curl_share_setopt, + curl_share_cleanup, + curl_global_init_mem, + curl_easy_strerror, + curl_multi_strerror, + curl_share_strerror, + curl_easy_reset + diff --git a/lib/libcurl.plist b/lib/libcurl.plist new file mode 100644 index 00000000..0ea606f6 --- /dev/null +++ b/lib/libcurl.plist @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd"> +<plist version="0.9"> +<dict> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + + <key>CFBundleDevelopmentRegion</key> + <string>English</string> + + <key>CFBundleExecutable</key> + <string>curl</string> + + <key>CFBundleIdentifier</key> + <string>com.libcurl.libcurl</string> + + <key>CFBundleVersion</key> + <string>7.21.2</string> + + <key>CFBundleName</key> + <string>libcurl</string> + + <key>CFBundlePackageType</key> + <string>FMWK</string> + + <key>CFBundleSignature</key> + <string>????</string> + + <key>CFBundleShortVersionString</key> + <string>libcurl 7.21.2</string> + + <key>CFBundleGetInfoString</key> + <string>libcurl.plist 7.21.2</string> +</dict> +</plist>
\ No newline at end of file diff --git a/lib/libcurl.rc b/lib/libcurl.rc new file mode 100644 index 00000000..47b944ac --- /dev/null +++ b/lib/libcurl.rc @@ -0,0 +1,63 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, 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. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#include <winver.h> +#include "../include/curl/curlver.h" + +LANGUAGE 0x09,0x01 + +#define RC_VERSION LIBCURL_VERSION_MAJOR, LIBCURL_VERSION_MINOR, LIBCURL_VERSION_PATCH, 0 + +VS_VERSION_INFO VERSIONINFO + FILEVERSION RC_VERSION + PRODUCTVERSION RC_VERSION + FILEFLAGSMASK 0x3fL +#if defined(DEBUGBUILD) || defined(_DEBUG) + FILEFLAGS 1 +#else + FILEFLAGS 0 +#endif + FILEOS VOS__WINDOWS32 + FILETYPE VFT_DLL + FILESUBTYPE 0x0L + +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", "The cURL library, http://curl.haxx.se/\0" + VALUE "FileDescription", "libcurl Shared Library\0" + VALUE "FileVersion", LIBCURL_VERSION "\0" + VALUE "InternalName", "libcurl\0" + VALUE "OriginalFilename", "libcurl.dll\0" + VALUE "ProductName", "The cURL library\0" + VALUE "ProductVersion", LIBCURL_VERSION "\0" + VALUE "LegalCopyright", "© " LIBCURL_COPYRIGHT "\0" + VALUE "License", "http://curl.haxx.se/docs/copyright.html\0" + END + END + + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END diff --git a/lib/libcurl.vcproj b/lib/libcurl.vcproj new file mode 100755 index 00000000..bbd2995f --- /dev/null +++ b/lib/libcurl.vcproj @@ -0,0 +1,2515 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="libcurl"
+ ProjectGUID="{F6829817-CDBC-4BBE-B629-3BD21F4A797D}"
+ RootNamespace="libcurl"
+ TargetFrameworkVersion="0"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="4"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ EnableManagedIncrementalBuild="0"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=".;..\include;"..\..\openssl-0.9.8h\Win32\include";"..\..\zlib-1.2.3""
+ PreprocessorDefinitions="WIN32;_DEBUG;BUILDING_LIBCURL;CURL_STATICLIB;CURL_DISABLE_LDAP;USE_SSLEAY;USE_OPENSSL;HAVE_ZLIB_H"
+ MinimalRebuild="true"
+ RuntimeLibrary="3"
+ EnableEnhancedInstructionSet="1"
+ PrecompiledHeaderFile=""
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="4"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ EnableManagedIncrementalBuild="0"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories=".;..\include;"..\..\openssl-0.9.8h\Win32\include";"..\..\zlib-1.2.3""
+ PreprocessorDefinitions="WIN32;NDEBUG;BUILDING_LIBCURL;CURL_STATICLIB;CURL_DISABLE_LDAP;USE_SSLEAY;USE_OPENSSL;HAVE_ZLIB_H"
+ StringPooling="true"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ EnableEnhancedInstructionSet="1"
+ PrecompiledHeaderFile=""
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ >
+ <File
+ RelativePath="base64.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="connect.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="content_encoding.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="cookie.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="curl_addrinfo.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="curl_fnmatch.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="curl_gethostname.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="curl_memrchr.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="curl_rand.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="curl_rtmp.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="curl_sspi.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="curl_threads.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="dict.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="easy.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="escape.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="file.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="fileinfo.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="formdata.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="ftp.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="ftplistparser.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="getenv.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="getinfo.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="gopher.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="gtls.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="hash.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="hmac.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="hostares.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="hostasyn.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="hostip.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="hostip4.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="hostip6.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="hostsyn.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="hostthre.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="http.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="http_chunks.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="http_digest.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="http_negotiate.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="http_ntlm.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="if2ip.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="imap.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="inet_ntop.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="inet_pton.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="krb4.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="krb5.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="ldap.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="llist.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="md4.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="md5.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="memdebug.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="mprintf.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="multi.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="netrc.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="nonblock.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="nss.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="openldap.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="parsedate.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="pingpong.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="polarssl.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="pop3.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="progress.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="qssl.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="rawstr.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="rtsp.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="security.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="select.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="sendf.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="share.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="slist.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="smtp.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="socks.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="socks_gssapi.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="socks_sspi.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="speedcheck.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="splay.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="ssh.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="sslgen.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="ssluse.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="strdup.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="strequal.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="strerror.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="strtok.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="strtoofft.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="telnet.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="tftp.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="timeval.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="transfer.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="url.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="version.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="warnless.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="wildcard.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ >
+ <File
+ RelativePath="arpa_telnet.h"
+ >
+ </File>
+ <File
+ RelativePath="config-win32.h"
+ >
+ </File>
+ <File
+ RelativePath="connect.h"
+ >
+ </File>
+ <File
+ RelativePath="content_encoding.h"
+ >
+ </File>
+ <File
+ RelativePath="cookie.h"
+ >
+ </File>
+ <File
+ RelativePath="curl_addrinfo.h"
+ >
+ </File>
+ <File
+ RelativePath="curl_base64.h"
+ >
+ </File>
+ <File
+ RelativePath="curl_fnmatch.h"
+ >
+ </File>
+ <File
+ RelativePath="curl_gethostname.h"
+ >
+ </File>
+ <File
+ RelativePath="curl_hmac.h"
+ >
+ </File>
+ <File
+ RelativePath="curl_ldap.h"
+ >
+ </File>
+ <File
+ RelativePath="curl_md4.h"
+ >
+ </File>
+ <File
+ RelativePath="curl_md5.h"
+ >
+ </File>
+ <File
+ RelativePath="curl_memory.h"
+ >
+ </File>
+ <File
+ RelativePath="curl_memrchr.h"
+ >
+ </File>
+ <File
+ RelativePath="curl_rand.h"
+ >
+ </File>
+ <File
+ RelativePath="curl_rtmp.h"
+ >
+ </File>
+ <File
+ RelativePath="curl_sspi.h"
+ >
+ </File>
+ <File
+ RelativePath="curl_threads.h"
+ >
+ </File>
+ <File
+ RelativePath="curlx.h"
+ >
+ </File>
+ <File
+ RelativePath="dict.h"
+ >
+ </File>
+ <File
+ RelativePath="easyif.h"
+ >
+ </File>
+ <File
+ RelativePath="escape.h"
+ >
+ </File>
+ <File
+ RelativePath="file.h"
+ >
+ </File>
+ <File
+ RelativePath="fileinfo.h"
+ >
+ </File>
+ <File
+ RelativePath="formdata.h"
+ >
+ </File>
+ <File
+ RelativePath="ftp.h"
+ >
+ </File>
+ <File
+ RelativePath="ftplistparser.h"
+ >
+ </File>
+ <File
+ RelativePath="getinfo.h"
+ >
+ </File>
+ <File
+ RelativePath="gopher.h"
+ >
+ </File>
+ <File
+ RelativePath="gtls.h"
+ >
+ </File>
+ <File
+ RelativePath="hash.h"
+ >
+ </File>
+ <File
+ RelativePath="hostip.h"
+ >
+ </File>
+ <File
+ RelativePath="http.h"
+ >
+ </File>
+ <File
+ RelativePath="http_chunks.h"
+ >
+ </File>
+ <File
+ RelativePath="http_digest.h"
+ >
+ </File>
+ <File
+ RelativePath="http_negotiate.h"
+ >
+ </File>
+ <File
+ RelativePath="http_ntlm.h"
+ >
+ </File>
+ <File
+ RelativePath="if2ip.h"
+ >
+ </File>
+ <File
+ RelativePath="imap.h"
+ >
+ </File>
+ <File
+ RelativePath="inet_ntop.h"
+ >
+ </File>
+ <File
+ RelativePath="inet_pton.h"
+ >
+ </File>
+ <File
+ RelativePath="krb4.h"
+ >
+ </File>
+ <File
+ RelativePath="llist.h"
+ >
+ </File>
+ <File
+ RelativePath="memdebug.h"
+ >
+ </File>
+ <File
+ RelativePath="multiif.h"
+ >
+ </File>
+ <File
+ RelativePath="netrc.h"
+ >
+ </File>
+ <File
+ RelativePath="nonblock.h"
+ >
+ </File>
+ <File
+ RelativePath="nssg.h"
+ >
+ </File>
+ <File
+ RelativePath="parsedate.h"
+ >
+ </File>
+ <File
+ RelativePath="pingpong.h"
+ >
+ </File>
+ <File
+ RelativePath="polarssl.h"
+ >
+ </File>
+ <File
+ RelativePath="pop3.h"
+ >
+ </File>
+ <File
+ RelativePath="progress.h"
+ >
+ </File>
+ <File
+ RelativePath="qssl.h"
+ >
+ </File>
+ <File
+ RelativePath="rawstr.h"
+ >
+ </File>
+ <File
+ RelativePath="rtsp.h"
+ >
+ </File>
+ <File
+ RelativePath="select.h"
+ >
+ </File>
+ <File
+ RelativePath="sendf.h"
+ >
+ </File>
+ <File
+ RelativePath="setup.h"
+ >
+ </File>
+ <File
+ RelativePath="setup_once.h"
+ >
+ </File>
+ <File
+ RelativePath="share.h"
+ >
+ </File>
+ <File
+ RelativePath="slist.h"
+ >
+ </File>
+ <File
+ RelativePath="smtp.h"
+ >
+ </File>
+ <File
+ RelativePath="sockaddr.h"
+ >
+ </File>
+ <File
+ RelativePath="socks.h"
+ >
+ </File>
+ <File
+ RelativePath="speedcheck.h"
+ >
+ </File>
+ <File
+ RelativePath="splay.h"
+ >
+ </File>
+ <File
+ RelativePath="ssh.h"
+ >
+ </File>
+ <File
+ RelativePath="sslgen.h"
+ >
+ </File>
+ <File
+ RelativePath="ssluse.h"
+ >
+ </File>
+ <File
+ RelativePath="strdup.h"
+ >
+ </File>
+ <File
+ RelativePath="strequal.h"
+ >
+ </File>
+ <File
+ RelativePath="strerror.h"
+ >
+ </File>
+ <File
+ RelativePath="strtok.h"
+ >
+ </File>
+ <File
+ RelativePath="strtoofft.h"
+ >
+ </File>
+ <File
+ RelativePath="telnet.h"
+ >
+ </File>
+ <File
+ RelativePath="tftp.h"
+ >
+ </File>
+ <File
+ RelativePath="timeval.h"
+ >
+ </File>
+ <File
+ RelativePath="transfer.h"
+ >
+ </File>
+ <File
+ RelativePath="url.h"
+ >
+ </File>
+ <File
+ RelativePath="urldata.h"
+ >
+ </File>
+ <File
+ RelativePath="warnless.h"
+ >
+ </File>
+ <File
+ RelativePath="wildcard.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ >
+ <File
+ RelativePath="libcurl.rc"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/lib/llist.c b/lib/llist.c index a121c603..71238fa7 100644 --- a/lib/llist.c +++ b/lib/llist.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -31,8 +31,8 @@ /* this must be the last include file */ #include "memdebug.h" -void -Curl_llist_init(struct curl_llist *l, curl_llist_dtor dtor) +static void +llist_init(struct curl_llist *l, curl_llist_dtor dtor) { l->size = 0; l->dtor = dtor; @@ -49,13 +49,19 @@ Curl_llist_alloc(curl_llist_dtor dtor) if(NULL == list) return NULL; - Curl_llist_init(list, dtor); + llist_init(list, dtor); return list; } /* - * Curl_llist_insert_next() returns 1 on success and 0 on failure. + * Curl_llist_insert_next() + * + * Inserts a new list element after the given one 'e'. If the given existing + * entry is NULL and the list already has elements, the new one will be + * inserted first in the list. + * + * Returns: 1 on success and 0 on failure. */ int Curl_llist_insert_next(struct curl_llist *list, struct curl_llist_element *e, @@ -73,15 +79,21 @@ Curl_llist_insert_next(struct curl_llist *list, struct curl_llist_element *e, list->tail = ne; } else { - ne->next = e->next; + /* if 'e' is NULL here, we insert the new element first in the list */ + ne->next = e?e->next:list->head; ne->prev = e; - if(e->next) { + if(!e) { + list->head->prev = ne; + list->head = ne; + } + else if(e->next) { e->next->prev = ne; } else { list->tail = ne; } - e->next = ne; + if(e) + e->next = ne; } ++list->size; diff --git a/lib/llist.h b/lib/llist.h index 358d3d68..c33912a4 100644 --- a/lib/llist.h +++ b/lib/llist.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -43,16 +43,11 @@ struct curl_llist { size_t size; }; -void Curl_llist_init(struct curl_llist *, curl_llist_dtor); struct curl_llist *Curl_llist_alloc(curl_llist_dtor); int Curl_llist_insert_next(struct curl_llist *, struct curl_llist_element *, const void *); -int Curl_llist_insert_prev(struct curl_llist *, struct curl_llist_element *, - const void *); int Curl_llist_remove(struct curl_llist *, struct curl_llist_element *, void *); -int Curl_llist_remove_next(struct curl_llist *, struct curl_llist_element *, - void *); size_t Curl_llist_count(struct curl_llist *); void Curl_llist_destroy(struct curl_llist *, void *); int Curl_llist_move(struct curl_llist *, struct curl_llist_element *, diff --git a/lib/makefile.amiga b/lib/makefile.amiga new file mode 100644 index 00000000..7b7fa8fa --- /dev/null +++ b/lib/makefile.amiga @@ -0,0 +1,22 @@ +# +# libcurl Makefile for AmigaOS ... +# + +# change the follow to where you have the AmiTCP SDK v4.3 includes: + +ATCPSDKI= /GG/netinclude + + +CC = m68k-amigaos-gcc +CFLAGS = -I$(ATCPSDKI) -m68020-60 -O2 -msoft-float -noixemul -g -I. -I../include -W -Wall + +include Makefile.inc +CSOURCES += amigaos.c +OBJS = $(CSOURCES:.c=.o) + +all: $(OBJS) + ar cru libcurl.a $(OBJS) + ranlib libcurl.a + +install: + $(INSTALL) -c ./libcurl.a /lib/libcurl.a diff --git a/lib/makefile.dj b/lib/makefile.dj new file mode 100644 index 00000000..90faf337 --- /dev/null +++ b/lib/makefile.dj @@ -0,0 +1,49 @@ +# +# Adapted for djgpp2 / Watt-32 / DOS by +# Gisle Vanem <giva@bgnett.no> +# + +DEPEND_PREREQ = curl_config.h +TOPDIR = .. + +include ../packages/DOS/common.dj +include Makefile.inc + +OBJECTS := $(patsubst %.c,$(OBJ_DIR)/%.o,$(strip $(CSOURCES))) + +CURL_LIB = libcurl.a + +# NOTE: if ../include/curl/curlbuild.h is missing, you're probably building +# this from a git checkout and then you need to run buildconf.bat first. + +all: $(OBJ_DIR) curl_config.h $(CURL_LIB) + +$(CURL_LIB): $(OBJECTS) + ar rs $@ $? + +curl_config.h: config.dos + $(COPY) $^ $@ + +# clean generated files +# +genclean: + - $(DELETE) curl_config.h + +# clean object files and subdir +# +objclean: genclean + - $(DELETE) $(OBJ_DIR)$(DS)*.o + - $(RMDIR) $(OBJ_DIR) + +# clean without removing built library +# +clean: objclean + - $(DELETE) depend.dj + +# clean everything +# +realclean vclean: clean + - $(DELETE) $(CURL_LIB) + +-include depend.dj + diff --git a/lib/md4.c b/lib/md4.c new file mode 100644 index 00000000..ecf3bfcd --- /dev/null +++ b/lib/md4.c @@ -0,0 +1,281 @@ +/*- + Copyright (C) 1990-2, RSA Data Security, Inc. All rights reserved. + + License to copy and use this software is granted provided that it + is identified as the "RSA Data Security, Inc. MD4 Message-Digest + Algorithm" in all material mentioning or referencing this software + or this function. + + License is also granted to make and use derivative works provided + that such works are identified as "derived from the RSA Data + Security, Inc. MD4 Message-Digest Algorithm" in all material + mentioning or referencing the derived work. + + RSA Data Security, Inc. makes no representations concerning either + the merchantability of this software or the suitability of this + software for any particular purpose. It is provided "as is" + without express or implied warranty of any kind. + + These notices must be retained in any copies of any part of this + documentation and/or software. + */ + +#include "setup.h" + +/* NSS crypto library does not provide the MD4 hash algorithm, so that we have + * a local implementation of it */ +#ifdef USE_NSS + +#include "curl_md4.h" +#include <string.h> + +typedef unsigned int UINT4; + +typedef struct MD4Context { + UINT4 state[4]; /* state (ABCD) */ + UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */ + unsigned char buffer[64]; /* input buffer */ +} MD4_CTX; + +/* Constants for MD4Transform routine. + */ +#define S11 3 +#define S12 7 +#define S13 11 +#define S14 19 +#define S21 3 +#define S22 5 +#define S23 9 +#define S24 13 +#define S31 3 +#define S32 9 +#define S33 11 +#define S34 15 + +static void MD4Transform(UINT4 [4], const unsigned char [64]); +static void Encode(unsigned char *, UINT4 *, unsigned int); +static void Decode(UINT4 *, const unsigned char *, unsigned int); + +static unsigned char PADDING[64] = { + 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +/* F, G and H are basic MD4 functions. + */ +#define F(x, y, z) (((x) & (y)) | ((~x) & (z))) +#define G(x, y, z) (((x) & (y)) | ((x) & (z)) | ((y) & (z))) +#define H(x, y, z) ((x) ^ (y) ^ (z)) + +/* ROTATE_LEFT rotates x left n bits. + */ +#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n)))) + +/* FF, GG and HH are transformations for rounds 1, 2 and 3 */ +/* Rotation is separate from addition to prevent recomputation */ +#define FF(a, b, c, d, x, s) { \ + (a) += F ((b), (c), (d)) + (x); \ + (a) = ROTATE_LEFT ((a), (s)); \ + } +#define GG(a, b, c, d, x, s) { \ + (a) += G ((b), (c), (d)) + (x) + (UINT4)0x5a827999; \ + (a) = ROTATE_LEFT ((a), (s)); \ + } +#define HH(a, b, c, d, x, s) { \ + (a) += H ((b), (c), (d)) + (x) + (UINT4)0x6ed9eba1; \ + (a) = ROTATE_LEFT ((a), (s)); \ + } + +/* MD4 initialization. Begins an MD4 operation, writing a new context. + */ +static void MD4Init(MD4_CTX *context) +{ + context->count[0] = context->count[1] = 0; + + /* Load magic initialization constants. + */ + context->state[0] = 0x67452301; + context->state[1] = 0xefcdab89; + context->state[2] = 0x98badcfe; + context->state[3] = 0x10325476; +} + +/* MD4 block update operation. Continues an MD4 message-digest + operation, processing another message block, and updating the + context. + */ +static void MD4Update(MD4_CTX *context, const unsigned char *input, + unsigned int inputLen) +{ + unsigned int i, bufindex, partLen; + + /* Compute number of bytes mod 64 */ + bufindex = (unsigned int)((context->count[0] >> 3) & 0x3F); + /* Update number of bits */ + if ((context->count[0] += ((UINT4)inputLen << 3)) + < ((UINT4)inputLen << 3)) + context->count[1]++; + context->count[1] += ((UINT4)inputLen >> 29); + + partLen = 64 - bufindex; + /* Transform as many times as possible. + */ + if (inputLen >= partLen) { + memcpy(&context->buffer[bufindex], input, partLen); + MD4Transform (context->state, context->buffer); + + for (i = partLen; i + 63 < inputLen; i += 64) + MD4Transform (context->state, &input[i]); + + bufindex = 0; + } + else + i = 0; + + /* Buffer remaining input */ + memcpy(&context->buffer[bufindex], &input[i], inputLen-i); +} + +/* MD4 padding. */ +static void MD4Pad(MD4_CTX *context) +{ + unsigned char bits[8]; + unsigned int bufindex, padLen; + + /* Save number of bits */ + Encode (bits, context->count, 8); + + /* Pad out to 56 mod 64. + */ + bufindex = (unsigned int)((context->count[0] >> 3) & 0x3f); + padLen = (bufindex < 56) ? (56 - bufindex) : (120 - bufindex); + MD4Update (context, PADDING, padLen); + + /* Append length (before padding) */ + MD4Update (context, bits, 8); +} + +/* MD4 finalization. Ends an MD4 message-digest operation, writing the + the message digest and zeroizing the context. + */ +static void MD4Final (unsigned char digest[16], MD4_CTX *context) +{ + /* Do padding */ + MD4Pad (context); + + /* Store state in digest */ + Encode (digest, context->state, 16); + + /* Zeroize sensitive information. + */ + memset(context, 0, sizeof(*context)); +} + +/* MD4 basic transformation. Transforms state based on block. + */ +static void MD4Transform (UINT4 state[4], const unsigned char block[64]) +{ + UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16]; + + Decode (x, block, 64); + + /* Round 1 */ + FF (a, b, c, d, x[ 0], S11); /* 1 */ + FF (d, a, b, c, x[ 1], S12); /* 2 */ + FF (c, d, a, b, x[ 2], S13); /* 3 */ + FF (b, c, d, a, x[ 3], S14); /* 4 */ + FF (a, b, c, d, x[ 4], S11); /* 5 */ + FF (d, a, b, c, x[ 5], S12); /* 6 */ + FF (c, d, a, b, x[ 6], S13); /* 7 */ + FF (b, c, d, a, x[ 7], S14); /* 8 */ + FF (a, b, c, d, x[ 8], S11); /* 9 */ + FF (d, a, b, c, x[ 9], S12); /* 10 */ + FF (c, d, a, b, x[10], S13); /* 11 */ + FF (b, c, d, a, x[11], S14); /* 12 */ + FF (a, b, c, d, x[12], S11); /* 13 */ + FF (d, a, b, c, x[13], S12); /* 14 */ + FF (c, d, a, b, x[14], S13); /* 15 */ + FF (b, c, d, a, x[15], S14); /* 16 */ + + /* Round 2 */ + GG (a, b, c, d, x[ 0], S21); /* 17 */ + GG (d, a, b, c, x[ 4], S22); /* 18 */ + GG (c, d, a, b, x[ 8], S23); /* 19 */ + GG (b, c, d, a, x[12], S24); /* 20 */ + GG (a, b, c, d, x[ 1], S21); /* 21 */ + GG (d, a, b, c, x[ 5], S22); /* 22 */ + GG (c, d, a, b, x[ 9], S23); /* 23 */ + GG (b, c, d, a, x[13], S24); /* 24 */ + GG (a, b, c, d, x[ 2], S21); /* 25 */ + GG (d, a, b, c, x[ 6], S22); /* 26 */ + GG (c, d, a, b, x[10], S23); /* 27 */ + GG (b, c, d, a, x[14], S24); /* 28 */ + GG (a, b, c, d, x[ 3], S21); /* 29 */ + GG (d, a, b, c, x[ 7], S22); /* 30 */ + GG (c, d, a, b, x[11], S23); /* 31 */ + GG (b, c, d, a, x[15], S24); /* 32 */ + + /* Round 3 */ + HH (a, b, c, d, x[ 0], S31); /* 33 */ + HH (d, a, b, c, x[ 8], S32); /* 34 */ + HH (c, d, a, b, x[ 4], S33); /* 35 */ + HH (b, c, d, a, x[12], S34); /* 36 */ + HH (a, b, c, d, x[ 2], S31); /* 37 */ + HH (d, a, b, c, x[10], S32); /* 38 */ + HH (c, d, a, b, x[ 6], S33); /* 39 */ + HH (b, c, d, a, x[14], S34); /* 40 */ + HH (a, b, c, d, x[ 1], S31); /* 41 */ + HH (d, a, b, c, x[ 9], S32); /* 42 */ + HH (c, d, a, b, x[ 5], S33); /* 43 */ + HH (b, c, d, a, x[13], S34); /* 44 */ + HH (a, b, c, d, x[ 3], S31); /* 45 */ + HH (d, a, b, c, x[11], S32); /* 46 */ + HH (c, d, a, b, x[ 7], S33); /* 47 */ + HH (b, c, d, a, x[15], S34); /* 48 */ + + state[0] += a; + state[1] += b; + state[2] += c; + state[3] += d; + + /* Zeroize sensitive information. + */ + memset(x, 0, sizeof(x)); +} + +/* Encodes input (UINT4) into output (unsigned char). Assumes len is + a multiple of 4. + */ +static void Encode(unsigned char *output, UINT4 *input, unsigned int len) +{ + unsigned int i, j; + + for (i = 0, j = 0; j < len; i++, j += 4) { + output[j] = (unsigned char)(input[i] & 0xff); + output[j+1] = (unsigned char)((input[i] >> 8) & 0xff); + output[j+2] = (unsigned char)((input[i] >> 16) & 0xff); + output[j+3] = (unsigned char)((input[i] >> 24) & 0xff); + } +} + +/* Decodes input (unsigned char) into output (UINT4). Assumes len is + a multiple of 4. + */ +static void Decode (UINT4 *output, const unsigned char *input, unsigned int len) +{ + unsigned int i, j; + + for (i = 0, j = 0; j < len; i++, j += 4) + output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) | + (((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24); +} + +void Curl_md4it(unsigned char *output, const unsigned char *input, size_t len) +{ + MD4_CTX ctx; + MD4Init(&ctx); + MD4Update(&ctx, input, (unsigned int)len); + MD4Final(output, &ctx); +} +#endif /* USE_NSS */ @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -27,19 +27,30 @@ #include <string.h> #include "curl_md5.h" +#include "curl_hmac.h" #ifdef USE_GNUTLS #include <gcrypt.h> -void Curl_md5it(unsigned char *outbuffer, /* 16 bytes */ - const unsigned char *input) +typedef gcry_md_hd_t MD5_CTX; + +static void MD5_Init(MD5_CTX * ctx) +{ + gcry_md_open(ctx, GCRY_MD_MD5, 0); +} + +static void MD5_Update(MD5_CTX * ctx, + const unsigned char * input, + unsigned int inputLen) +{ + gcry_md_write(*ctx, input, inputLen); +} + +static void MD5_Final(unsigned char digest[16], MD5_CTX * ctx) { - gcry_md_hd_t ctx; - gcry_md_open(&ctx, GCRY_MD_MD5, 0); - gcry_md_write(ctx, input, (unsigned int)strlen((char *)input)); - memcpy (outbuffer, gcry_md_read (ctx, 0), 16); - gcry_md_close(ctx); + memcpy(digest, gcry_md_read(*ctx, 0), 16); + gcry_md_close(*ctx); } #else @@ -194,7 +205,7 @@ static void MD5_Update (struct md5_ctx *context, /* context */ /* Transform as many times as possible. */ if(inputLen >= partLen) { - memcpy((void *)&context->buffer[bufindex], (void *)input, partLen); + memcpy(&context->buffer[bufindex], input, partLen); MD5Transform(context->state, context->buffer); for (i = partLen; i + 63 < inputLen; i += 64) @@ -206,7 +217,7 @@ static void MD5_Update (struct md5_ctx *context, /* context */ i = 0; /* Buffer remaining input */ - memcpy((void *)&context->buffer[bufindex], (void *)&input[i], inputLen-i); + memcpy(&context->buffer[bufindex], &input[i], inputLen-i); } /* MD5 finalization. Ends an MD5 message-digest operation, writing the @@ -358,6 +369,20 @@ static void Decode (UINT4 *output, #endif /* USE_SSLEAY */ +#endif /* USE_GNUTLS */ + +const HMAC_params Curl_HMAC_MD5[] = { + { + (HMAC_hinit_func) MD5_Init, /* Hash initialization function. */ + (HMAC_hupdate_func) MD5_Update, /* Hash update function. */ + (HMAC_hfinal_func) MD5_Final, /* Hash computation end function. */ + sizeof(MD5_CTX), /* Size of hash context structure. */ + 64, /* Maximum key length. */ + 16 /* Result size. */ + } +}; + + void Curl_md5it(unsigned char *outbuffer, /* 16 bytes */ const unsigned char *input) { @@ -367,6 +392,4 @@ void Curl_md5it(unsigned char *outbuffer, /* 16 bytes */ MD5_Final(outbuffer, &ctx); } -#endif /* USE_GNUTLS */ - #endif /* CURL_DISABLE_CRYPTO_AUTH */ diff --git a/lib/mk-ca-bundle.pl b/lib/mk-ca-bundle.pl index 8d461d0b..3586dc46 100755 --- a/lib/mk-ca-bundle.pl +++ b/lib/mk-ca-bundle.pl @@ -40,7 +40,7 @@ my $url = 'http://mxr.mozilla.org/seamonkey/source/security/nss/lib/ckfw/builtin # If the OpenSSL commandline is not in search path you can configure it here! my $openssl = 'openssl'; -my $version = $1 if ('$Revision$' =~ /\s(\d+\.\d+)\s/); +my $version = '1.14'; getopts('bhilnqtuv'); diff --git a/lib/mk-ca-bundle.vbs b/lib/mk-ca-bundle.vbs new file mode 100755 index 00000000..5a4b4ed9 --- /dev/null +++ b/lib/mk-ca-bundle.vbs @@ -0,0 +1,271 @@ +'***************************************************************************
+'* _ _ ____ _
+'* Project ___| | | | _ \| |
+'* / __| | | | |_) | |
+'* | (__| |_| | _ <| |___
+'* \___|\___/|_| \_\_____|
+'*
+'* Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, 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.
+'*
+'* You may opt to use, copy, modify, merge, publish, distribute and/or sell
+'* copies of the Software, and permit persons to whom the Software is
+'* furnished to do so, under the terms of the COPYING file.
+'*
+'* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+'* KIND, either express or implied.
+'*
+'***************************************************************************
+'* Script to fetch certdata.txt from Mozilla.org site and create a
+'* ca-bundle.crt for use with OpenSSL / libcurl / libcurl bindings
+'* Requires WinHttp.WinHttpRequest.5.1 and ADODB.Stream which are part of
+'* W2000 SP3 or later, WXP SP1 or later, W2003 Server SP1 or later.
+'* Hacked by Guenter Knauf
+'***************************************************************************
+Option Explicit
+Const myVersion = "0.3.5"
+
+Const myUrl = "http://mxr.mozilla.org/firefox/source/security/nss/lib/ckfw/builtins/certdata.txt?raw=1"
+
+Const myOpenssl = "openssl.exe"
+
+Const myCdSavF = FALSE ' Flag: save downloaded data to file certdata.txt
+Const myCaBakF = TRUE ' Flag: backup existing ca-bundle certificate
+Const myAskLiF = TRUE ' Flag: display certdata.txt license agreement
+Const myAskTiF = TRUE ' Flag: ask to include certificate text info
+
+'******************* Nothing to configure below! *******************
+Dim objShell, objNetwork, objFSO, objHttp
+Dim myBase, mySelf, myFh, myTmpFh, myCdData, myCdFile, myCaFile, myTmpName, myBakNum, myOptTxt, i
+Set objNetwork = WScript.CreateObject("WScript.Network")
+Set objShell = WScript.CreateObject("WScript.Shell")
+Set objFSO = WScript.CreateObject("Scripting.FileSystemObject")
+Set objHttp = WScript.CreateObject("WinHttp.WinHttpRequest.5.1")
+If objHttp Is Nothing Then Set objHttp = WScript.CreateObject("WinHttp.WinHttpRequest")
+myBase = Left(WScript.ScriptFullName, InstrRev(WScript.ScriptFullName, "\"))
+mySelf = Left(WScript.ScriptName, InstrRev(WScript.ScriptName, ".") - 1) & " " & myVersion
+myCdFile = Mid(myUrl, InstrRev(myUrl, "/") + 1, InstrRev(myUrl, "?") - InstrRev(myUrl, "/") - 1)
+myCaFile = "ca-bundle.crt"
+myTmpName = InputBox("Enter output filename:", mySelf, myCaFile)
+If Not (myTmpName = "") Then
+ myCaFile = myTmpName
+End If
+' Lets ignore SSL invalid cert errors
+objHttp.Option(4) = 256 + 512 + 4096 + 8192
+objHttp.SetTimeouts 0, 5000, 10000, 10000
+objHttp.Open "GET", myUrl, FALSE
+objHttp.setRequestHeader "User-Agent", WScript.ScriptName & "/" & myVersion
+objHttp.Send ""
+If Not (objHttp.statusText = "OK") Then
+ MsgBox("Failed to download '" & myCdFile & "': " & objHttp.statusText), vbCritical, mySelf
+ WScript.Quit 1
+End If
+' Convert data from ResponseBody instead of using ResponseText because of UTF-8
+myCdData = ConvertBinaryData(objHttp.ResponseBody)
+Set objHttp = Nothing
+' Write received data to file if enabled
+If (myCdSavF = TRUE) Then
+ Set myFh = objFSO.OpenTextFile(myCdFile, 2, TRUE)
+ myFh.Write myCdData
+ myFh.Close
+End If
+' Backup exitsing ca-bundle certificate file
+If (myCaBakF = TRUE) Then
+ If objFSO.FileExists(myCaFile) Then
+ Dim myBakFile, b
+ b = 1
+ myBakFile = myCaFile & ".~" & b & "~"
+ While objFSO.FileExists(myBakFile)
+ b = b + 1
+ myBakFile = myCaFile & ".~" & b & "~"
+ Wend
+ Set myTmpFh = objFSO.GetFile(myCaFile)
+ myTmpFh.Move myBakFile
+ End If
+End If
+If (myAskTiF = TRUE) Then
+ If (6 = objShell.PopUp("Do you want to include text information about each certificate?" & vbLf & _
+ "(requires OpenSSL commandline in current directory or in search path)",, _
+ mySelf, vbQuestion + vbYesNo + vbDefaultButton2)) Then
+ myOptTxt = TRUE
+ Else
+ myOptTxt = FALSE
+ End If
+End If
+' Process the received data
+Dim myLines, myPattern, myInsideCert, myInsideLicense, myLicenseText, myNumCerts
+Dim myLabel, myOctets, myData, myPem, myRev, j
+myData = ""
+myLines = Split(myCdData, vbLf, -1)
+Set myFh = objFSO.OpenTextFile(myCaFile, 2, TRUE)
+myFh.Write "##" & vbLf
+myFh.Write "## " & myCaFile & " -- Bundle of CA Root Certificates" & vbLf
+myFh.Write "##" & vbLf
+myFh.Write "## Converted at: " & Now & vbLf
+myFh.Write "##" & vbLf
+myFh.Write "## This is a bundle of X.509 certificates of public Certificate Authorities" & vbLf
+myFh.Write "## (CA). These were automatically extracted from Mozilla's root certificates" & vbLf
+myFh.Write "## file (certdata.txt). This file can be found in the mozilla source tree:" & vbLf
+myFh.Write "## '/mozilla/security/nss/lib/ckfw/builtins/certdata.txt'" & vbLf
+myFh.Write "##" & vbLf
+myFh.Write "## It contains the certificates in PEM format and therefore" & vbLf
+myFh.Write "## can be directly used with curl / libcurl / php_curl, or with" & vbLf
+myFh.Write "## an Apache+mod_ssl webserver for SSL client authentication." & vbLf
+myFh.Write "## Just configure this file as the SSLCACertificateFile." & vbLf
+myFh.Write "##" & vbLf
+myFh.Write vbLf
+For i = 0 To UBound(myLines)
+ If InstrRev(myLines(i), "CKA_LABEL ") Then
+ myPattern = "^CKA_LABEL\s+[A-Z0-9]+\s+""(.+?)"""
+ myLabel = RegExprFirst(myPattern, myLines(i))
+ End If
+ If (myInsideCert = TRUE) Then
+ If InstrRev(myLines(i), "END") Then
+ myInsideCert = FALSE
+ myFh.Write myLabel & vbLf
+ myFh.Write String(Len(myLabel), "=") & vbLf
+ myPem = "-----BEGIN CERTIFICATE-----" & vbLf & _
+ Base64Encode(myData) & vbLf & _
+ "-----END CERTIFICATE-----" & vbLf
+ If (myOptTxt = FALSE) Then
+ myFh.Write myPem & vbLf
+ Else
+ Dim myCmd, myRval, myTmpIn, myTmpOut
+ myTmpIn = objFSO.GetSpecialFolder(2).Path & "\" & objFSO.GetTempName
+ myTmpOut = objFSO.GetSpecialFolder(2).Path & "\" & objFSO.GetTempName
+ Set myTmpFh = objFSO.OpenTextFile(myTmpIn, 2, TRUE)
+ myTmpFh.Write myPem
+ myTmpFh.Close
+ myCmd = myOpenssl & " x509 -md5 -fingerprint -text -inform PEM" & _
+ " -in " & myTmpIn & " -out " & myTmpOut
+ myRval = objShell.Run (myCmd, 0, TRUE)
+ objFSO.DeleteFile myTmpIn, TRUE
+ If Not (myRval = 0) Then
+ MsgBox("Failed to process PEM cert with OpenSSL commandline!"), vbCritical, mySelf
+ objFSO.DeleteFile myTmpOut, TRUE
+ WScript.Quit 3
+ End If
+ Set myTmpFh = objFSO.OpenTextFile(myTmpOut, 1)
+ myFh.Write myTmpFh.ReadAll & vbLf
+ myTmpFh.Close
+ objFSO.DeleteFile myTmpOut, TRUE
+ End If
+ myData = ""
+ myNumCerts = myNumCerts + 1
+ Else
+ myOctets = Split(myLines(i), "\")
+ For j = 1 To UBound(myOctets)
+ myData = myData & Chr(CByte("&o" & myOctets(j)))
+ Next
+ End If
+ End If
+ If InstrRev(myLines(i), "CVS_ID ") Then
+ myPattern = "^CVS_ID\s+""(.+?)"""
+ myRev = RegExprFirst(myPattern, myLines(i))
+ myFh.Write "# " & myRev & vbLf & vbLf
+ End If
+ If InstrRev(myLines(i), "CKA_VALUE MULTILINE_OCTAL") Then
+ myInsideCert = TRUE
+ End If
+ If InstrRev(myLines(i), "***** BEGIN LICENSE BLOCK *****") Then
+ myInsideLicense = TRUE
+ End If
+ If (myInsideLicense = TRUE) Then
+ myFh.Write myLines(i) & vbLf
+ myLicenseText = myLicenseText & Mid(myLines(i), 2) & vbLf
+ End If
+ If InstrRev(myLines(i), "***** END LICENSE BLOCK *****") Then
+ myInsideLicense = FALSE
+ If (myAskLiF = TRUE) Then
+ If Not (6 = objShell.PopUp(myLicenseText & vbLf & _
+ "Do you agree to the license shown above (required to proceed) ?",, _
+ mySelf, vbQuestion + vbYesNo + vbDefaultButton1)) Then
+ myFh.Close
+ objFSO.DeleteFile myCaFile, TRUE
+ WScript.Quit 2
+ End If
+ End If
+ End If
+Next
+myFh.Close
+objShell.PopUp "Done (" & myNumCerts & " CA certs processed).", 20, mySelf, vbInformation
+WScript.Quit 0
+
+Function ConvertBinaryData(arrBytes)
+ Dim objStream
+ Set objStream = CreateObject("ADODB.Stream")
+ objStream.Open
+ objStream.Type = 1
+ objStream.Write arrBytes
+ objStream.Position = 0
+ objStream.Type = 2
+ objStream.Charset = "ascii"
+ ConvertBinaryData = objStream.ReadText
+ Set objStream = Nothing
+End Function
+
+Function RegExprFirst(SearchPattern, TheString)
+ Dim objRegExp, Matches ' create variables.
+ Set objRegExp = New RegExp ' create a regular expression.
+ objRegExp.Pattern = SearchPattern ' sets the search pattern.
+ objRegExp.IgnoreCase = TRUE ' set to ignores case.
+ objRegExp.Global = TRUE ' set to gloabal search.
+ Set Matches = objRegExp.Execute(TheString) ' do the search.
+ If (Matches.Count) Then
+ RegExprFirst = Matches(0).SubMatches(0) ' return first match.
+ Else
+ RegExprFirst = ""
+ End If
+ Set objRegExp = Nothing
+End Function
+
+Function Base64Encode(inData)
+ Const Base64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
+ Dim cOut, sOut, I
+
+ 'For each group of 3 bytes
+ For I = 1 To Len(inData) Step 3
+ Dim nGroup, pOut, sGroup
+
+ 'Create one long from this 3 bytes.
+ nGroup = &H10000 * Asc(Mid(inData, I, 1)) + _
+ &H100 * MyASC(Mid(inData, I + 1, 1)) + _
+ MyASC(Mid(inData, I + 2, 1))
+
+ 'Oct splits the long To 8 groups with 3 bits
+ nGroup = Oct(nGroup)
+
+ 'Add leading zeros
+ nGroup = String(8 - Len(nGroup), "0") & nGroup
+
+ 'Convert To base64
+ pOut = Mid(Base64, CLng("&o" & Mid(nGroup, 1, 2)) + 1, 1) & _
+ Mid(Base64, CLng("&o" & Mid(nGroup, 3, 2)) + 1, 1) & _
+ Mid(Base64, CLng("&o" & Mid(nGroup, 5, 2)) + 1, 1) & _
+ Mid(Base64, CLng("&o" & Mid(nGroup, 7, 2)) + 1, 1)
+
+ 'Add the part To OutPut string
+ sOut = sOut + pOut
+
+ 'Add a new line For Each 76 chars In dest (76*3/4 = 57)
+ If (I < Len(inData) - 2) Then
+ If (I + 2) Mod 57 = 0 Then sOut = sOut & vbLf
+ End If
+ Next
+ Select Case Len(inData) Mod 3
+ Case 1: '8 bit final
+ sOut = Left(sOut, Len(sOut) - 2) & "=="
+ Case 2: '16 bit final
+ sOut = Left(sOut, Len(sOut) - 1) & "="
+ End Select
+ Base64Encode = sOut
+End Function
+
+Function MyASC(OneChar)
+ If OneChar = "" Then MyASC = 0 Else MyASC = Asc(OneChar)
+End Function
+
+
diff --git a/lib/mprintf.c b/lib/mprintf.c index 1d93c582..536c0c24 100644 --- a/lib/mprintf.c +++ b/lib/mprintf.c @@ -963,7 +963,6 @@ static int dprintf_formatf( /* RECURSIVE USAGE */ len = curl_msnprintf(fptr, left, ".%ld", prec); fptr += len; - left -= len; } if(p->flags & FLAGS_LONG) *fptr++ = 'l'; diff --git a/lib/multi.c b/lib/multi.c index 476cb813..875e136e 100644 --- a/lib/multi.c +++ b/lib/multi.c @@ -61,7 +61,6 @@ struct Curl_message { /* the 'CURLMsg' is the part that is visible to the external user */ struct CURLMsg extmsg; - struct Curl_message *next; }; /* NOTE: if you add a state here, add the name to the statename[] array as @@ -84,7 +83,7 @@ typedef enum { CURLM_STATE_TOOFAST, /* wait because limit-rate exceeded */ CURLM_STATE_DONE, /* post data transfer operation */ CURLM_STATE_COMPLETED, /* operation complete */ - + CURLM_STATE_MSGSENT, /* the operation complete message is sent */ CURLM_STATE_LAST /* not a true state, never use this */ } CURLMstate; @@ -110,12 +109,7 @@ struct Curl_one_easy { CURLMstate state; /* the handle's state */ CURLcode result; /* previous result */ - struct Curl_message *msg; /* A pointer to one single posted message. - Cleanup should be done on this pointer NOT on - the linked list in Curl_multi. This message - will be deleted when this handle is removed - from the multi-handle */ - int msg_num; /* number of messages left in 'msg' to return */ + struct Curl_message msg; /* A single posted message. */ /* Array with the plain socket numbers this handle takes care of, in no particular order. Note that all sockets are added to the sockhash, where @@ -142,10 +136,11 @@ struct Curl_multi { struct Curl_one_easy easy; int num_easy; /* amount of entries in the linked list above. */ - int num_msgs; /* amount of messages in the easy handles */ int num_alive; /* amount of easy handles that are added but have not yet reached COMPLETE state */ + struct curl_llist *msglist; /* a list of messages from completed transfers */ + /* callback function and user data pointer for the *socket() API */ curl_socket_callback socket_cb; void *socket_userp; @@ -197,6 +192,9 @@ static void moveHandleFromRecvToDonePipeline(struct SessionHandle *handle, struct connectdata *conn); static bool isHandleAtHead(struct SessionHandle *handle, struct curl_llist *pipeline); +static CURLMcode add_next_timeout(struct timeval now, + struct Curl_multi *multi, + struct SessionHandle *d); #ifdef DEBUGBUILD static const char * const statename[]={ @@ -216,9 +214,12 @@ static const char * const statename[]={ "TOOFAST", "DONE", "COMPLETED", + "MSGSENT", }; #endif +static void multi_freetimeout(void *a, void *b); + /* always use this function to change state, to make debugging easier */ static void multistate(struct Curl_one_easy *easy, CURLMstate state) { @@ -360,6 +361,33 @@ static struct curl_hash *sh_init(void) sh_freeentry); } +/* + * multi_addmsg() + * + * Called when a transfer is completed. Adds the given msg pointer to + * the list kept in the multi handle. + */ +static CURLMcode multi_addmsg(struct Curl_multi *multi, + struct Curl_message *msg) +{ + if(!Curl_llist_insert_next(multi->msglist, multi->msglist->tail, msg)) + return CURLM_OUT_OF_MEMORY; + + return CURLM_OK; +} + +/* + * multi_freeamsg() + * + * Callback used by the llist system when a single list entry is destroyed. + */ +static void multi_freeamsg(void *a, void *b) +{ + (void)a; + (void)b; +} + + CURLM *curl_multi_init(void) { struct Curl_multi *multi = calloc(1, sizeof(struct Curl_multi)); @@ -370,27 +398,20 @@ CURLM *curl_multi_init(void) multi->type = CURL_MULTI_HANDLE; multi->hostcache = Curl_mk_dnscache(); - if(!multi->hostcache) { - /* failure, free mem and bail out */ - free(multi); - return NULL; - } + if(!multi->hostcache) + goto error; multi->sockhash = sh_init(); - if(!multi->sockhash) { - /* failure, free mem and bail out */ - Curl_hash_destroy(multi->hostcache); - free(multi); - return NULL; - } + if(!multi->sockhash) + goto error; multi->connc = Curl_mk_connc(CONNCACHE_MULTI, -1L); - if(!multi->connc) { - Curl_hash_destroy(multi->sockhash); - Curl_hash_destroy(multi->hostcache); - free(multi); - return NULL; - } + if(!multi->connc) + goto error; + + multi->msglist = Curl_llist_alloc(multi_freeamsg); + if(!multi->msglist) + goto error; /* Let's make the doubly-linked list a circular list. This makes the linked list code simpler and allows inserting at the end @@ -399,6 +420,17 @@ CURLM *curl_multi_init(void) multi->easy.prev = &multi->easy; return (CURLM *) multi; + + error: + if(multi->sockhash) + Curl_hash_destroy(multi->sockhash); + if(multi->hostcache) + Curl_hash_destroy(multi->hostcache); + if(multi->connc) + Curl_rm_connc(multi->connc); + + free(multi); + return NULL; } CURLMcode curl_multi_add_handle(CURLM *multi_handle, @@ -408,6 +440,7 @@ CURLMcode curl_multi_add_handle(CURLM *multi_handle, struct Curl_one_easy *easy; struct closure *cl; struct closure *prev=NULL; + struct SessionHandle *data = easy_handle; /* First, make some basic checks that the CURLM handle is a good handle */ if(!GOOD_MULTI_HANDLE(multi)) @@ -422,6 +455,10 @@ CURLMcode curl_multi_add_handle(CURLM *multi_handle, /* possibly we should create a new unique error code for this condition */ return CURLM_BAD_EASY_HANDLE; + data->state.timeoutlist = Curl_llist_alloc(multi_freetimeout); + if(!data->state.timeoutlist) + return CURLM_OUT_OF_MEMORY; + /* Now, time to add an easy handle to the multi stack */ easy = calloc(1, sizeof(struct Curl_one_easy)); if(!easy) @@ -575,6 +612,7 @@ CURLMcode curl_multi_remove_handle(CURLM *multi_handle, { struct Curl_multi *multi=(struct Curl_multi *)multi_handle; struct Curl_one_easy *easy; + struct SessionHandle *data = curl_handle; /* First, make some basic checks that the CURLM handle is a good handle */ if(!GOOD_MULTI_HANDLE(multi)) @@ -585,10 +623,10 @@ CURLMcode curl_multi_remove_handle(CURLM *multi_handle, return CURLM_BAD_EASY_HANDLE; /* pick-up from the 'curl_handle' the kept position in the list */ - easy = ((struct SessionHandle *)curl_handle)->multi_pos; + easy = data->multi_pos; if(easy) { - bool premature = (bool)(easy->state != CURLM_STATE_COMPLETED); + bool premature = (bool)(easy->state < CURLM_STATE_COMPLETED); bool easy_owns_conn = (bool)(easy->easy_conn && (easy->easy_conn->data == easy->easy_handle)); @@ -618,6 +656,12 @@ CURLMcode curl_multi_remove_handle(CURLM *multi_handle, curl_easy_cleanup is called. */ Curl_expire(easy->easy_handle, 0); + /* destroy the timeout list that is held in the easy handle */ + if(data->state.timeoutlist) { + Curl_llist_destroy(data->state.timeoutlist, NULL); + data->state.timeoutlist = NULL; + } + if(easy->easy_handle->dns.hostcachetype == HCACHE_MULTI) { /* clear out the usage of the shared DNS cache */ easy->easy_handle->dns.hostcache = NULL; @@ -656,6 +700,10 @@ CURLMcode curl_multi_remove_handle(CURLM *multi_handle, to that since we're not part of that handle anymore */ easy->easy_handle->state.connc = NULL; + /* Since we return the connection back to the communal connection pool + we mark the last connection as inaccessible */ + easy->easy_handle->state.lastconnect = -1; + /* Modify the connectindex since this handle can't point to the connection cache anymore. @@ -679,6 +727,22 @@ CURLMcode curl_multi_remove_handle(CURLM *multi_handle, Curl_easy_addmulti(easy->easy_handle, NULL); /* clear the association to this multi handle */ + { + /* make sure there's no pending message in the queue sent from this easy + handle */ + struct curl_llist_element *e; + + for(e = multi->msglist->head; e; e = e->next) { + struct Curl_message *msg = e->ptr; + + if(msg->extmsg.easy_handle == easy->easy_handle) { + Curl_llist_remove(multi->msglist, e, NULL); + /* there can only be one from this specific handle */ + break; + } + } + } + /* make the previous node point to our next */ if(easy->prev) easy->prev->next = easy->next; @@ -693,8 +757,6 @@ CURLMcode curl_multi_remove_handle(CURLM *multi_handle, /* NOTE NOTE NOTE We do not touch the easy handle here! */ - if(easy->msg) - free(easy->msg); free(easy); multi->num_easy--; /* one less to care about now */ @@ -779,6 +841,7 @@ static int multi_getsock(struct Curl_one_easy *easy, to be present */ case CURLM_STATE_TOOFAST: /* returns 0, so will not select. */ case CURLM_STATE_COMPLETED: + case CURLM_STATE_MSGSENT: case CURLM_STATE_INIT: case CURLM_STATE_CONNECT: case CURLM_STATE_WAITDO: @@ -866,6 +929,7 @@ CURLMcode curl_multi_fdset(CURLM *multi_handle, } static CURLMcode multi_runsingle(struct Curl_multi *multi, + struct timeval now, struct Curl_one_easy *easy) { struct Curl_message *msg = NULL; @@ -876,10 +940,14 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, bool done = FALSE; CURLMcode result = CURLM_OK; struct SingleRequest *k; + struct SessionHandle *data; + long timeout_ms; if(!GOOD_EASY_HANDLE(easy->easy_handle)) return CURLM_BAD_EASY_HANDLE; + data = easy->easy_handle; + do { /* this is a do-while loop just to allow a break to skip to the end of it */ @@ -887,18 +955,18 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, /* Handle the case when the pipe breaks, i.e., the connection we're using gets cleaned up and we're left with nothing. */ - if(easy->easy_handle->state.pipe_broke) { - infof(easy->easy_handle, "Pipe broke: handle 0x%p, url = %s\n", - easy, easy->easy_handle->state.path); + if(data->state.pipe_broke) { + infof(data, "Pipe broke: handle 0x%p, url = %s\n", + easy, data->state.path); - if(easy->state != CURLM_STATE_COMPLETED) { + if(easy->state < CURLM_STATE_COMPLETED) { /* Head back to the CONNECT state */ multistate(easy, CURLM_STATE_CONNECT); result = CURLM_CALL_MULTI_PERFORM; easy->result = CURLE_OK; } - easy->easy_handle->state.pipe_broke = FALSE; + data->state.pipe_broke = FALSE; easy->easy_conn = NULL; break; } @@ -906,31 +974,59 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, if(easy->easy_conn && easy->state > CURLM_STATE_CONNECT && easy->state < CURLM_STATE_COMPLETED) /* Make sure we set the connection's current owner */ - easy->easy_conn->data = easy->easy_handle; + easy->easy_conn->data = data; + + if(easy->easy_conn && (easy->state >= CURLM_STATE_CONNECT)) { + /* we need to wait for the connect state as only then is the + start time stored */ + + timeout_ms = Curl_timeleft(easy->easy_conn, &now, + easy->state <= CURLM_STATE_WAITDO); + + if(timeout_ms < 0) { + /* Handle timed out */ + if(easy->state == CURLM_STATE_WAITRESOLVE) + failf(data, "Resolving timed out after %ld milliseconds", + Curl_tvdiff(now, data->progress.t_startsingle)); + else if(easy->state == CURLM_STATE_WAITCONNECT) + failf(data, "Connection timed out after %ld milliseconds", + Curl_tvdiff(now, data->progress.t_startsingle)); + else { + k = &data->req; + failf(data, "Operation timed out after %ld milliseconds with %" + FORMAT_OFF_T " out of %" FORMAT_OFF_T " bytes received", + Curl_tvdiff(now, data->progress.t_startsingle), k->bytecount, + k->size); + } + easy->result = CURLE_OPERATION_TIMEDOUT; + multistate(easy, CURLM_STATE_COMPLETED); + break; + } + } switch(easy->state) { case CURLM_STATE_INIT: /* init this transfer. */ - easy->result=Curl_pretransfer(easy->easy_handle); + easy->result=Curl_pretransfer(data); if(CURLE_OK == easy->result) { /* after init, go CONNECT */ multistate(easy, CURLM_STATE_CONNECT); result = CURLM_CALL_MULTI_PERFORM; - easy->easy_handle->state.used_interface = Curl_if_multi; + data->state.used_interface = Curl_if_multi; } break; case CURLM_STATE_CONNECT: /* Connect. We get a connection identifier filled in. */ - Curl_pgrsTime(easy->easy_handle, TIMER_STARTSINGLE); - easy->result = Curl_connect(easy->easy_handle, &easy->easy_conn, + Curl_pgrsTime(data, TIMER_STARTSINGLE); + easy->result = Curl_connect(data, &easy->easy_conn, &async, &protocol_connect); if(CURLE_OK == easy->result) { /* Add this handle to the send or pend pipeline */ - easy->result = addHandleToSendOrPendPipeline(easy->easy_handle, + easy->result = addHandleToSendOrPendPipeline(data, easy->easy_conn); if(CURLE_OK == easy->result) { if(async) @@ -1013,9 +1109,9 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, if(easy->easy_conn->bits.proxy_connect_closed) { /* reset the error buffer */ - if(easy->easy_handle->set.errorbuffer) - easy->easy_handle->set.errorbuffer[0] = '\0'; - easy->easy_handle->state.errorbuf = FALSE; + if(data->set.errorbuffer) + data->set.errorbuffer[0] = '\0'; + data->state.errorbuf = FALSE; easy->result = CURLE_OK; result = CURLM_CALL_MULTI_PERFORM; @@ -1087,7 +1183,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, } else if(easy->result) { /* failure detected */ - Curl_posttransfer(easy->easy_handle); + Curl_posttransfer(data); Curl_done(&easy->easy_conn, easy->result, FALSE); disconnect_conn = TRUE; } @@ -1096,15 +1192,15 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, case CURLM_STATE_WAITDO: /* Wait for our turn to DO when we're pipelining requests */ #ifdef DEBUGBUILD - infof(easy->easy_handle, "Conn %ld send pipe %zu inuse %d athead %d\n", + infof(data, "Conn %ld send pipe %zu inuse %d athead %d\n", easy->easy_conn->connectindex, easy->easy_conn->send_pipe->size, easy->easy_conn->writechannel_inuse?1:0, - isHandleAtHead(easy->easy_handle, + isHandleAtHead(data, easy->easy_conn->send_pipe)?1:0); #endif if(!easy->easy_conn->writechannel_inuse && - isHandleAtHead(easy->easy_handle, + isHandleAtHead(data, easy->easy_conn->send_pipe)) { /* Grab the channel */ easy->easy_conn->writechannel_inuse = TRUE; @@ -1114,7 +1210,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, break; case CURLM_STATE_DO: - if(easy->easy_handle->set.connect_only) { + if(data->set.connect_only) { /* keep connection open for application to use the socket */ easy->easy_conn->bits.close = FALSE; multistate(easy, CURLM_STATE_DONE); @@ -1128,6 +1224,17 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, if(CURLE_OK == easy->result) { if(!dophase_done) { + /* some steps needed for wildcard matching */ + if(data->set.wildcardmatch) { + struct WildcardData *wc = &data->wildcard; + if(wc->state == CURLWC_DONE || wc->state == CURLWC_SKIP) { + /* skip some states if it is important */ + Curl_done(&easy->easy_conn, CURLE_OK, FALSE); + multistate(easy, CURLM_STATE_DONE); + result = CURLM_CALL_MULTI_PERFORM; + break; + } + } /* DO was not completed in one function call, we must continue DOING... */ multistate(easy, CURLM_STATE_DOING); @@ -1168,7 +1275,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, else retry = (bool)(newurl?TRUE:FALSE); - Curl_posttransfer(easy->easy_handle); + Curl_posttransfer(data); drc = Curl_done(&easy->easy_conn, easy->result, FALSE); /* When set to retry the connection, we must to go back to @@ -1176,7 +1283,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, if(retry) { if ((drc == CURLE_OK) || (drc == CURLE_SEND_ERROR)) { follow = FOLLOW_RETRY; - drc = Curl_follow(easy->easy_handle, newurl, follow); + drc = Curl_follow(data, newurl, follow); if(drc == CURLE_OK) { multistate(easy, CURLM_STATE_CONNECT); result = CURLM_CALL_MULTI_PERFORM; @@ -1201,7 +1308,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, } else { /* failure detected */ - Curl_posttransfer(easy->easy_handle); + Curl_posttransfer(data); Curl_done(&easy->easy_conn, easy->result, FALSE); disconnect_conn = TRUE; } @@ -1230,7 +1337,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, } else { /* failure detected */ - Curl_posttransfer(easy->easy_handle); + Curl_posttransfer(data); Curl_done(&easy->easy_conn, easy->result, FALSE); disconnect_conn = TRUE; } @@ -1256,7 +1363,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, } else { /* failure detected */ - Curl_posttransfer(easy->easy_handle); + Curl_posttransfer(data); Curl_done(&easy->easy_conn, easy->result, FALSE); disconnect_conn = TRUE; } @@ -1265,7 +1372,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, case CURLM_STATE_DO_DONE: /* Move ourselves from the send to recv pipeline */ - moveHandleFromSendToRecvPipeline(easy->easy_handle, easy->easy_conn); + moveHandleFromSendToRecvPipeline(data, easy->easy_conn); /* Check if we can move pending requests to send pipe */ checkPendPipeline(easy->easy_conn); multistate(easy, CURLM_STATE_WAITPERFORM); @@ -1275,7 +1382,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, case CURLM_STATE_WAITPERFORM: /* Wait for our turn to PERFORM */ if(!easy->easy_conn->readchannel_inuse && - isHandleAtHead(easy->easy_handle, + isHandleAtHead(data, easy->easy_conn->recv_pipe)) { /* Grab the channel */ easy->easy_conn->readchannel_inuse = TRUE; @@ -1284,11 +1391,11 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, } #ifdef DEBUGBUILD else { - infof(easy->easy_handle, "Conn %ld recv pipe %zu inuse %d athead %d\n", + infof(data, "Conn %ld recv pipe %zu inuse %d athead %d\n", easy->easy_conn->connectindex, easy->easy_conn->recv_pipe->size, easy->easy_conn->readchannel_inuse?1:0, - isHandleAtHead(easy->easy_handle, + isHandleAtHead(data, easy->easy_conn->recv_pipe)?1:0); } #endif @@ -1296,37 +1403,50 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, case CURLM_STATE_TOOFAST: /* limit-rate exceeded in either direction */ /* if both rates are within spec, resume transfer */ - Curl_pgrsUpdate(easy->easy_conn); - if( ( ( easy->easy_handle->set.max_send_speed == 0 ) || - ( easy->easy_handle->progress.ulspeed < - easy->easy_handle->set.max_send_speed ) ) && - ( ( easy->easy_handle->set.max_recv_speed == 0 ) || - ( easy->easy_handle->progress.dlspeed < - easy->easy_handle->set.max_recv_speed ) ) - ) + if( ( (data->set.max_send_speed == 0) || + (data->progress.ulspeed < data->set.max_send_speed )) && + ( (data->set.max_recv_speed == 0) || + (data->progress.dlspeed < data->set.max_recv_speed) ) ) multistate(easy, CURLM_STATE_PERFORM); break; case CURLM_STATE_PERFORM: - /* check if over speed */ - if( ( ( easy->easy_handle->set.max_send_speed > 0 ) && - ( easy->easy_handle->progress.ulspeed > - easy->easy_handle->set.max_send_speed ) ) || - ( ( easy->easy_handle->set.max_recv_speed > 0 ) && - ( easy->easy_handle->progress.dlspeed > - easy->easy_handle->set.max_recv_speed ) ) - ) { - /* Transfer is over the speed limit. Change state. TODO: Call - * Curl_expire() with the time left until we're targeted to be below - * the speed limit again. */ - multistate(easy, CURLM_STATE_TOOFAST ); + /* check if over send speed */ + if( (data->set.max_send_speed > 0) && + (data->progress.ulspeed > data->set.max_send_speed) ) { + int buffersize; + + multistate(easy, CURLM_STATE_TOOFAST); + + /* calculate upload rate-limitation timeout. */ + buffersize = (int)(data->set.buffer_size ? + data->set.buffer_size : BUFSIZE); + timeout_ms = Curl_sleep_time(data->set.max_send_speed, + data->progress.ulspeed, buffersize); + Curl_expire(data, timeout_ms); + break; + } + + /* check if over recv speed */ + if( (data->set.max_recv_speed > 0) && + (data->progress.dlspeed > data->set.max_recv_speed) ) { + int buffersize; + + multistate(easy, CURLM_STATE_TOOFAST); + + /* Calculate download rate-limitation timeout. */ + buffersize = (int)(data->set.buffer_size ? + data->set.buffer_size : BUFSIZE); + timeout_ms = Curl_sleep_time(data->set.max_recv_speed, + data->progress.dlspeed, buffersize); + Curl_expire(data, timeout_ms); break; } /* read/write data if it is ready to do so */ easy->result = Curl_readwrite(easy->easy_conn, &done); - k = &easy->easy_handle->req; + k = &data->req; if(!(k->keepon & KEEP_RECV)) { /* We're done receiving */ @@ -1338,7 +1458,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, easy->easy_conn->writechannel_inuse = FALSE; } - if(easy->result) { + if(easy->result) { /* The transfer phase returned error, we mark the connection to get * closed to prevent being re-used. This is because we can't possibly * know if the connection is in a good shape or not now. Unless it is @@ -1348,7 +1468,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, if(!(easy->easy_conn->protocol & PROT_DUALCHANNEL)) easy->easy_conn->bits.close = TRUE; - Curl_posttransfer(easy->easy_handle); + Curl_posttransfer(data); Curl_done(&easy->easy_conn, easy->result, FALSE); } else if(TRUE == done) { @@ -1361,10 +1481,10 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, retry = (bool)(newurl?TRUE:FALSE); /* call this even if the readwrite function returned error */ - Curl_posttransfer(easy->easy_handle); + Curl_posttransfer(data); /* we're no longer receving */ - moveHandleFromRecvToDonePipeline(easy->easy_handle, + moveHandleFromRecvToDonePipeline(data, easy->easy_conn); /* expire the new receiving pipeline head */ @@ -1376,19 +1496,19 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, /* When we follow redirects or is set to retry the connection, we must to go back to the CONNECT state */ - if(easy->easy_handle->req.newurl || retry) { + if(data->req.newurl || retry) { if(!retry) { /* if the URL is a follow-location and not just a retried request then figure out the URL here */ - newurl = easy->easy_handle->req.newurl; - easy->easy_handle->req.newurl = NULL; + newurl = data->req.newurl; + data->req.newurl = NULL; follow = FOLLOW_REDIR; } else follow = FOLLOW_RETRY; easy->result = Curl_done(&easy->easy_conn, CURLE_OK, FALSE); if(easy->result == CURLE_OK) - easy->result = Curl_follow(easy->easy_handle, newurl, follow); + easy->result = Curl_follow(data, newurl, follow); if(CURLE_OK == easy->result) { multistate(easy, CURLM_STATE_CONNECT); result = CURLM_CALL_MULTI_PERFORM; @@ -1403,10 +1523,10 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, /* but first check to see if we got a location info even though we're not following redirects */ - if (easy->easy_handle->req.location) { - newurl = easy->easy_handle->req.location; - easy->easy_handle->req.location = NULL; - easy->result = Curl_follow(easy->easy_handle, newurl, FOLLOW_FAKE); + if (data->req.location) { + newurl = data->req.location; + data->req.location = NULL; + easy->result = Curl_follow(data, newurl, FOLLOW_FAKE); if (easy->result) free(newurl); } @@ -1423,9 +1543,9 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, if(easy->easy_conn) { /* Remove ourselves from the receive and done pipelines. Handle should be on one of these lists, depending upon how we got here. */ - Curl_removeHandleFromPipeline(easy->easy_handle, + Curl_removeHandleFromPipeline(data, easy->easy_conn->recv_pipe); - Curl_removeHandleFromPipeline(easy->easy_handle, + Curl_removeHandleFromPipeline(data, easy->easy_conn->done_pipe); /* Check if we can move pending requests to send pipe */ checkPendPipeline(easy->easy_conn); @@ -1449,6 +1569,16 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, easy->easy_conn = NULL; } + if(data->set.wildcardmatch) { + if(data->wildcard.state != CURLWC_DONE) { + /* if a wildcard is set and we are not ending -> lets start again + with CURLM_STATE_INIT */ + result = CURLM_CALL_MULTI_PERFORM; + multistate(easy, CURLM_STATE_INIT); + break; + } + } + /* after we have DONE what we're supposed to do, go COMPLETED, and it doesn't matter what the Curl_done() returned! */ multistate(easy, CURLM_STATE_COMPLETED); @@ -1464,13 +1594,18 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, /* Important: reset the conn pointer so that we don't point to memory that could be freed anytime */ easy->easy_conn = NULL; + + Curl_expire(data, 0); /* stop all timers */ break; + case CURLM_STATE_MSGSENT: + return CURLM_OK; /* do nothing */ + default: return CURLM_INTERNAL_ERROR; } - if(CURLM_STATE_COMPLETED != easy->state) { + if(CURLM_STATE_COMPLETED > easy->state) { if(CURLE_OK != easy->result) { /* * If an error was returned, and we aren't in completed state now, @@ -1480,17 +1615,17 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, /* NOTE: no attempt to disconnect connections must be made in the case blocks above - cleanup happens only here */ - easy->easy_handle->state.pipe_broke = FALSE; + data->state.pipe_broke = FALSE; if(easy->easy_conn) { /* if this has a connection, unsubscribe from the pipelines */ easy->easy_conn->writechannel_inuse = FALSE; easy->easy_conn->readchannel_inuse = FALSE; - Curl_removeHandleFromPipeline(easy->easy_handle, + Curl_removeHandleFromPipeline(data, easy->easy_conn->send_pipe); - Curl_removeHandleFromPipeline(easy->easy_handle, + Curl_removeHandleFromPipeline(data, easy->easy_conn->recv_pipe); - Curl_removeHandleFromPipeline(easy->easy_handle, + Curl_removeHandleFromPipeline(data, easy->easy_conn->done_pipe); /* Check if we can move pending requests to send pipe */ checkPendPipeline(easy->easy_conn); @@ -1507,30 +1642,29 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, multistate(easy, CURLM_STATE_COMPLETED); } + /* if there's still a connection to use, call the progress function */ + else if(easy->easy_conn && Curl_pgrsUpdate(easy->easy_conn)) + easy->result = CURLE_ABORTED_BY_CALLBACK; } } while(0); - if((CURLM_STATE_COMPLETED == easy->state) && !easy->msg) { - if(easy->easy_handle->dns.hostcachetype == HCACHE_MULTI) { + + if(CURLM_STATE_COMPLETED == easy->state) { + if(data->dns.hostcachetype == HCACHE_MULTI) { /* clear out the usage of the shared DNS cache */ - easy->easy_handle->dns.hostcache = NULL; - easy->easy_handle->dns.hostcachetype = HCACHE_NONE; + data->dns.hostcache = NULL; + data->dns.hostcachetype = HCACHE_NONE; } - /* now add a node to the Curl_message linked list with this info */ - msg = malloc(sizeof(struct Curl_message)); - - if(!msg) - return CURLM_OUT_OF_MEMORY; + /* now fill in the Curl_message with this info */ + msg = &easy->msg; msg->extmsg.msg = CURLMSG_DONE; - msg->extmsg.easy_handle = easy->easy_handle; + msg->extmsg.easy_handle = data; msg->extmsg.data.result = easy->result; - msg->next = NULL; - easy->msg = msg; - easy->msg_num = 1; /* there is one unread message here */ + result = multi_addmsg(multi, msg); - multi->num_msgs++; /* increase message counter */ + multistate(easy, CURLM_STATE_MSGSENT); } return result; @@ -1543,6 +1677,7 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles) struct Curl_one_easy *easy; CURLMcode returncode=CURLM_OK; struct Curl_tree *t; + struct timeval now = Curl_tvnow(); if(!GOOD_MULTI_HANDLE(multi)) return CURLM_BAD_HANDLE; @@ -1550,11 +1685,26 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles) easy=multi->easy.next; while(easy != &multi->easy) { CURLMcode result; + struct WildcardData *wc = &easy->easy_handle->wildcard; + + if(easy->easy_handle->set.wildcardmatch) { + if(!wc->filelist) { + CURLcode ret = Curl_wildcard_init(wc); /* init wildcard structures */ + if(ret) + return CURLM_OUT_OF_MEMORY; + } + } do - result = multi_runsingle(multi, easy); + result = multi_runsingle(multi, now, easy); while (CURLM_CALL_MULTI_PERFORM == result); + if(easy->easy_handle->set.wildcardmatch) { + /* destruct wildcard structures if it is needed */ + if(wc->state == CURLWC_DONE || result) + Curl_wildcard_dtor(wc); + } + if(result) returncode = result; @@ -1565,20 +1715,17 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles) * Simply remove all expired timers from the splay since handles are dealt * with unconditionally by this function and curl_multi_timeout() requires * that already passed/handled expire times are removed from the splay. + * + * It is important that the 'now' value is set at the entry of this function + * and not for the current time as it may have ticked a little while since + * then and then we risk this loop to remove timers that actually have not + * been handled! */ do { - struct timeval now = Curl_tvnow(); - multi->timetree = Curl_splaygetbest(now, multi->timetree, &t); - if(t) { - struct SessionHandle *d = t->payload; - struct timeval* tv = &d->state.expiretime; - - /* clear the expire times within the handles that we remove from the - splay tree */ - tv->tv_sec = 0; - tv->tv_usec = 0; - } + if(t) + /* the removed may have another timeout in queue */ + (void)add_next_timeout(now, multi, t->payload); } while(t); @@ -1590,14 +1737,6 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles) return returncode; } -/* This is called when an easy handle is cleanup'ed that is part of a multi - handle */ -void Curl_multi_rmeasy(void *multi_handle, CURL *easy_handle) -{ - curl_multi_remove_handle(multi_handle, easy_handle); -} - - CURLMcode curl_multi_cleanup(CURLM *multi_handle) { struct Curl_multi *multi=(struct Curl_multi *)multi_handle; @@ -1638,6 +1777,9 @@ CURLMcode curl_multi_cleanup(CURLM *multi_handle) Curl_rm_connc(multi->connc); + /* remove the pending list of messages */ + Curl_llist_destroy(multi->msglist, NULL); + /* remove all easy handles */ easy = multi->easy.next; while(easy != &multi->easy) { @@ -1653,8 +1795,6 @@ CURLMcode curl_multi_cleanup(CURLM *multi_handle) Curl_easy_addmulti(easy->easy_handle, NULL); /* clear the association */ - if(easy->msg) - free(easy->msg); free(easy); easy = nexteasy; } @@ -1667,33 +1807,38 @@ CURLMcode curl_multi_cleanup(CURLM *multi_handle) return CURLM_BAD_HANDLE; } +/* + * curl_multi_info_read() + * + * This function is the primary way for a multi/multi_socket application to + * figure out if a transfer has ended. We MUST make this function as fast as + * possible as it will be polled frequently and we MUST NOT scan any lists in + * here to figure out things. We must scale fine to thousands of handles and + * beyond. The current design is fully O(1). + */ + CURLMsg *curl_multi_info_read(CURLM *multi_handle, int *msgs_in_queue) { struct Curl_multi *multi=(struct Curl_multi *)multi_handle; + struct Curl_message *msg; *msgs_in_queue = 0; /* default to none */ - if(GOOD_MULTI_HANDLE(multi)) { - struct Curl_one_easy *easy; + if(GOOD_MULTI_HANDLE(multi) && Curl_llist_count(multi->msglist)) { + /* there is one or more messages in the list */ + struct curl_llist_element *e; - if(!multi->num_msgs) - return NULL; /* no messages left to return */ + /* extract the head of the list to return */ + e = multi->msglist->head; - easy=multi->easy.next; - while(easy != &multi->easy) { - if(easy->msg_num) { - easy->msg_num--; - break; - } - easy = easy->next; - } - if(!easy) - return NULL; /* this means internal count confusion really */ + msg = e->ptr; - multi->num_msgs--; - *msgs_in_queue = multi->num_msgs; + /* remove the extracted entry */ + Curl_llist_remove(multi->msglist, e, NULL); - return &easy->msg->extmsg; + *msgs_in_queue = (int)Curl_llist_count(multi->msglist); + + return &msg->extmsg; } else return NULL; @@ -1757,11 +1902,12 @@ static void singlesocket(struct Curl_multi *multi, return; } + /* we know (entry != NULL) at this point, see the logic above */ multi->socket_cb(easy->easy_handle, s, action, multi->socket_userp, - entry ? entry->socketp : NULL); + entry->socketp); entry->action = action; /* store the current action state */ } @@ -1851,6 +1997,62 @@ static void singlesocket(struct Curl_multi *multi, easy->numsocks = num; } +/* + * add_next_timeout() + * + * Each SessionHandle has a list of timeouts. The add_next_timeout() is called + * when it has just been removed from the splay tree because the timeout has + * expired. This function is then to advance in the list to pick the next + * timeout to use (skip the already expired ones) and add this node back to + * the splay tree again. + * + * The splay tree only has each sessionhandle as a single node and the nearest + * timeout is used to sort it on. + */ +static CURLMcode add_next_timeout(struct timeval now, + struct Curl_multi *multi, + struct SessionHandle *d) +{ + struct timeval *tv = &d->state.expiretime; + struct curl_llist *list = d->state.timeoutlist; + struct curl_llist_element *e; + + /* move over the timeout list for this specific handle and remove all + timeouts that are now passed tense and store the next pending + timeout in *tv */ + for(e = list->head; e; ) { + struct curl_llist_element *n = e->next; + long diff = curlx_tvdiff(*(struct timeval *)e->ptr, now); + if(diff <= 0) + /* remove outdated entry */ + Curl_llist_remove(list, e, NULL); + else + /* the list is sorted so get out on the first mismatch */ + break; + e = n; + } + if(!list->size) { + /* clear the expire times within the handles that we remove from the + splay tree */ + tv->tv_sec = 0; + tv->tv_usec = 0; + } + else { + e = list->head; + /* copy the first entry to 'tv' */ + memcpy(tv, e->ptr, sizeof(*tv)); + + /* remove first entry from list */ + Curl_llist_remove(list, e, NULL); + + /* insert this node again into the splay */ + multi->timetree = Curl_splayinsert(*tv, multi->timetree, + &d->state.timenode); + } + return CURLM_OK; +} + + static CURLMcode multi_socket(struct Curl_multi *multi, bool checkall, curl_socket_t s, @@ -1860,6 +2062,7 @@ static CURLMcode multi_socket(struct Curl_multi *multi, CURLMcode result = CURLM_OK; struct SessionHandle *data = NULL; struct Curl_tree *t; + struct timeval now = Curl_tvnow(); if(checkall) { struct Curl_one_easy *easyp; @@ -1914,7 +2117,7 @@ static CURLMcode multi_socket(struct Curl_multi *multi, data->set.one_easy->easy_conn->cselect_bits = ev_bitmask; do - result = multi_runsingle(multi, data->set.one_easy); + result = multi_runsingle(multi, now, data->set.one_easy); while (CURLM_CALL_MULTI_PERFORM == result); if(data->set.one_easy->easy_conn) @@ -1934,18 +2137,23 @@ static CURLMcode multi_socket(struct Curl_multi *multi, } } + now.tv_usec += 40000; /* compensate for bad precision timers that might've + triggered too early */ + if(now.tv_usec > 1000000) { + now.tv_sec++; + now.tv_usec -= 1000000; + } + /* * The loop following here will go on as long as there are expire-times left * to process in the splay and 'data' will be re-assigned for every expired * handle we deal with. */ do { - struct timeval now; - /* the first loop lap 'data' can be NULL */ if(data) { do - result = multi_runsingle(multi, data->set.one_easy); + result = multi_runsingle(multi, now, data->set.one_easy); while (CURLM_CALL_MULTI_PERFORM == result); if(CURLM_OK >= result) @@ -1957,20 +2165,10 @@ static CURLMcode multi_socket(struct Curl_multi *multi, /* Check if there's one (more) expired timer to deal with! This function extracts a matching node if there is one */ - now = Curl_tvnow(); - now.tv_usec += 1000; /* to compensate for the truncating of 999us to 0ms, - we always add time here to make the comparison - below better */ - multi->timetree = Curl_splaygetbest(now, multi->timetree, &t); if(t) { - /* assign 'data' to be the easy handle we just removed from the splay - tree */ - data = t->payload; - /* clear the expire time within the handle we removed from the - splay tree */ - data->state.expiretime.tv_sec = 0; - data->state.expiretime.tv_usec = 0; + data = t->payload; /* assign this for next loop */ + (void)add_next_timeout(now, multi, t->payload); } } while(t); @@ -2106,12 +2304,22 @@ CURLMcode curl_multi_timeout(CURLM *multi_handle, static int update_timer(struct Curl_multi *multi) { long timeout_ms; + if(!multi->timer_cb) return 0; - if( multi_timeout(multi, &timeout_ms) != CURLM_OK ) + if(multi_timeout(multi, &timeout_ms)) { return -1; - if( timeout_ms < 0 ) + } + if( timeout_ms < 0 ) { + static const struct timeval none={0,0}; + if(Curl_splaycomparekeys(none, multi->timer_lastcall)) { + multi->timer_lastcall = none; + /* there's no timeout now but there was one previously, tell the app to + disable it */ + return multi->timer_cb((CURLM*)multi, -1, multi->timer_userp); + } return 0; + } /* When multi_timeout() is done, multi->timetree points to the node with the * timeout we got the (relative) time-out time for. We can thus easily check @@ -2129,7 +2337,9 @@ static CURLcode addHandleToSendOrPendPipeline(struct SessionHandle *handle, struct connectdata *conn) { size_t pipeLen = conn->send_pipe->size + conn->recv_pipe->size; + struct curl_llist_element *sendhead = conn->send_pipe->head; struct curl_llist *pipeline; + CURLcode rc; if(!Curl_isPipeliningEnabled(handle) || pipeLen == 0) @@ -2142,7 +2352,17 @@ static CURLcode addHandleToSendOrPendPipeline(struct SessionHandle *handle, pipeline = conn->pend_pipe; } - return Curl_addHandleToPipeline(handle, pipeline); + rc = Curl_addHandleToPipeline(handle, pipeline); + + if (pipeline == conn->send_pipe && sendhead != conn->send_pipe->head) { + /* this is a new one as head, expire it */ + conn->writechannel_inuse = FALSE; /* not in use yet */ + infof(conn->data, "%p is at send pipe head!\n", + conn->send_pipe->head->ptr); + Curl_expire(conn->send_pipe->head->ptr, 1); + } + + return rc; } static int checkPendPipeline(struct connectdata *conn) @@ -2242,10 +2462,74 @@ static bool isHandleAtHead(struct SessionHandle *handle, return FALSE; } -/* given a number of milliseconds from now to use to set the 'act before - this'-time for the transfer, to be extracted by curl_multi_timeout() +/* + * multi_freetimeout() + * + * Callback used by the llist system when a single timeout list entry is + * destroyed. + */ +static void multi_freetimeout(void *user, void *entryptr) +{ + (void)user; + + /* the entry was plain malloc()'ed */ + free(entryptr); +} + +/* + * multi_addtimeout() + * + * Add a timestamp to the list of timeouts. Keep the list sorted so that head + * of list is always the timeout nearest in time. + * + */ +static CURLMcode +multi_addtimeout(struct curl_llist *timeoutlist, + struct timeval *stamp) +{ + struct curl_llist_element *e; + struct timeval *timedup; + struct curl_llist_element *prev = NULL; + + timedup = malloc(sizeof(*timedup)); + if(!timedup) + return CURLM_OUT_OF_MEMORY; + + /* copy the timestamp */ + memcpy(timedup, stamp, sizeof(*timedup)); + + if(Curl_llist_count(timeoutlist)) { + /* find the correct spot in the list */ + for(e = timeoutlist->head; e; e = e->next) { + struct timeval *checktime = e->ptr; + long diff = curlx_tvdiff(*checktime, *timedup); + if(diff > 0) + break; + prev = e; + } + + } + /* else + this is the first timeout on the list */ - Pass zero to clear the timeout value for this handle. + if(!Curl_llist_insert_next(timeoutlist, prev, timedup)) { + free(timedup); + return CURLM_OUT_OF_MEMORY; + } + + return CURLM_OK; +} + +/* + * Curl_expire() + * + * given a number of milliseconds from now to use to set the 'act before + * this'-time for the transfer, to be extracted by curl_multi_timeout() + * + * Note that the timeout will be added to a queue of timeouts if it defines a + * moment in time that is later than the current head of queue. + * + * Pass zero to clear all timeout values for this handle. */ void Curl_expire(struct SessionHandle *data, long milli) { @@ -2263,11 +2547,18 @@ void Curl_expire(struct SessionHandle *data, long milli) if(nowp->tv_sec || nowp->tv_usec) { /* Since this is an cleared time, we must remove the previous entry from the splay tree */ + struct curl_llist *list = data->state.timeoutlist; + rc = Curl_splayremovebyaddr(multi->timetree, &data->state.timenode, &multi->timetree); if(rc) infof(data, "Internal error clearing splay node = %d\n", rc); + + /* flush the timeout list too */ + while(list->size > 0) + Curl_llist_remove(list, list->tail, NULL); + infof(data, "Expire cleared\n"); nowp->tv_sec = 0; nowp->tv_usec = 0; @@ -2293,9 +2584,16 @@ void Curl_expire(struct SessionHandle *data, long milli) Compare if the new time is earlier, and only remove-old/add-new if it is. */ long diff = curlx_tvdiff(set, *nowp); - if(diff > 0) - /* the new expire time was later so we don't change this */ + if(diff > 0) { + /* the new expire time was later so just add it to the queue + and get out */ + multi_addtimeout(data->state.timeoutlist, &set); return; + } + + /* the new time is newer than the presently set one, so add the current + to the queue and update the head */ + multi_addtimeout(data->state.timeoutlist, nowp); /* Since this is an updated time, we must remove the previous entry from the splay tree first and then re-add the new value */ @@ -2307,10 +2605,6 @@ void Curl_expire(struct SessionHandle *data, long milli) } *nowp = set; -#if 0 - infof(data, "Expire at %ld / %ld (%ldms) %p\n", - (long)nowp->tv_sec, (long)nowp->tv_usec, milli, data); -#endif data->state.timenode.payload = data; multi->timetree = Curl_splayinsert(*nowp, multi->timetree, @@ -2462,7 +2756,7 @@ void Curl_multi_dump(const struct Curl_multi *multi_handle) fprintf(stderr, "* Multi status: %d handles, %d alive\n", multi->num_easy, multi->num_alive); for(easy=multi->easy.next; easy != &multi->easy; easy = easy->next) { - if(easy->state != CURLM_STATE_COMPLETED) { + if(easy->state < CURLM_STATE_COMPLETED) { /* only display handles that are not completed */ fprintf(stderr, "handle %p, state %s, %d sockets\n", (void *)easy->easy_handle, diff --git a/lib/multiif.h b/lib/multiif.h index 798544e0..76918181 100644 --- a/lib/multiif.h +++ b/lib/multiif.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -27,8 +27,6 @@ */ void Curl_expire(struct SessionHandle *data, long milli); -void Curl_multi_rmeasy(void *multi, CURL *data); - bool Curl_multi_canPipeline(const struct Curl_multi* multi); void Curl_multi_handlePipeBreak(struct SessionHandle *data); @@ -63,6 +63,7 @@ #include <secport.h> #include <certdb.h> #include <base64.h> +#include <cert.h> #include "curl_memory.h" #include "rawstr.h" @@ -79,6 +80,7 @@ PRFileDesc *PR_ImportTCPSocket(PRInt32 osfd); PRLock * nss_initlock = NULL; +PRLock * nss_crllock = NULL; volatile int initialized = 0; @@ -411,78 +413,90 @@ static int nss_load_cert(struct ssl_connect_data *ssl, return 1; } -static int nss_load_crl(const char* crlfilename, PRBool ascii) +/* add given CRL to cache if it is not already there */ +static SECStatus nss_cache_crl(SECItem *crlDER) { - PRFileDesc *infile; - PRStatus prstat; - PRFileInfo info; - PRInt32 nb; - int rv; - SECItem crlDER; - CERTSignedCrl *crl=NULL; - PK11SlotInfo *slot=NULL; - - infile = PR_Open(crlfilename,PR_RDONLY,0); - if (!infile) { - return 0; + CERTCertDBHandle *db = CERT_GetDefaultCertDB(); + CERTSignedCrl *crl = SEC_FindCrlByDERCert(db, crlDER, 0); + if(crl) { + /* CRL already cached */ + SEC_DestroyCrl(crl); + SECITEM_FreeItem(crlDER, PR_FALSE); + return SECSuccess; } - crlDER.data = NULL; - prstat = PR_GetOpenFileInfo(infile,&info); - if (prstat!=PR_SUCCESS) - return 0; - if (ascii) { - SECItem filedata; - char *asc,*body; - filedata.data = NULL; - if (!SECITEM_AllocItem(NULL,&filedata,info.size)) - return 0; - nb = PR_Read(infile,filedata.data,info.size); - if (nb!=info.size) - return 0; - asc = (char*)filedata.data; - if (!asc) - return 0; - body=strstr(asc,"-----BEGIN"); - if (body != NULL) { - char *trailer=NULL; - asc = body; - body = PORT_Strchr(asc,'\n'); - if (!body) - body = PORT_Strchr(asc,'\r'); - if (body) - trailer = strstr(++body,"-----END"); - if (trailer!=NULL) - *trailer='\0'; - else - return 0; - } - else { - body = asc; - } - rv = ATOB_ConvertAsciiToItem(&crlDER,body); - PORT_Free(filedata.data); - if (rv) - return 0; + /* acquire lock before call of CERT_CacheCRL() */ + PR_Lock(nss_crllock); + if(SECSuccess != CERT_CacheCRL(db, crlDER)) { + /* unable to cache CRL */ + PR_Unlock(nss_crllock); + SECITEM_FreeItem(crlDER, PR_FALSE); + return SECFailure; } - else { - if (!SECITEM_AllocItem(NULL,&crlDER,info.size)) - return 0; - nb = PR_Read(infile,crlDER.data,info.size); - if (nb!=info.size) - return 0; + + /* we need to clear session cache, so that the CRL could take effect */ + SSL_ClearSessionCache(); + PR_Unlock(nss_crllock); + return SECSuccess; +} + +static SECStatus nss_load_crl(const char* crlfilename) +{ + PRFileDesc *infile; + PRFileInfo info; + SECItem filedata = { 0, NULL, 0 }; + SECItem crlDER = { 0, NULL, 0 }; + char *body; + + infile = PR_Open(crlfilename, PR_RDONLY, 0); + if(!infile) + return SECFailure; + + if(PR_SUCCESS != PR_GetOpenFileInfo(infile, &info)) + goto fail; + + if(!SECITEM_AllocItem(NULL, &filedata, info.size + /* zero ended */ 1)) + goto fail; + + if(info.size != PR_Read(infile, filedata.data, info.size)) + goto fail; + + /* place a trailing zero right after the visible data */ + body = (char*)filedata.data; + body[--filedata.len] = '\0'; + + body = strstr(body, "-----BEGIN"); + if(body) { + /* assume ASCII */ + char *trailer; + char *begin = PORT_Strchr(body, '\n'); + if(!begin) + begin = PORT_Strchr(body, '\r'); + if(!begin) + goto fail; + + trailer = strstr(++begin, "-----END"); + if(!trailer) + goto fail; + + /* retrieve DER from ASCII */ + *trailer = '\0'; + if(ATOB_ConvertAsciiToItem(&crlDER, begin)) + goto fail; + + SECITEM_FreeItem(&filedata, PR_FALSE); } + else + /* assume DER */ + crlDER = filedata; - slot = PK11_GetInternalKeySlot(); - crl = PK11_ImportCRL(slot,&crlDER, - NULL,SEC_CRL_TYPE, - NULL,CRL_IMPORT_DEFAULT_OPTIONS, - NULL,(CRL_DECODE_DEFAULT_OPTIONS| - CRL_DECODE_DONT_COPY_DER)); - if (slot) PK11_FreeSlot(slot); - if (!crl) return 0; - SEC_DestroyCrl(crl); - return 1; + PR_Close(infile); + return nss_cache_crl(&crlDER); + +fail: + PR_Close(infile); + SECITEM_FreeItem(&filedata, PR_FALSE); + return SECFailure; } static int nss_load_key(struct connectdata *conn, int sockindex, @@ -877,6 +891,57 @@ isTLSIntoleranceError(PRInt32 err) } } +static CURLcode init_nss(struct SessionHandle *data) +{ + char *cert_dir; + struct_stat st; + if(initialized) + return CURLE_OK; + + /* First we check if $SSL_DIR points to a valid dir */ + cert_dir = getenv("SSL_DIR"); + if(cert_dir) { + if((stat(cert_dir, &st) != 0) || + (!S_ISDIR(st.st_mode))) { + cert_dir = NULL; + } + } + + /* Now we check if the default location is a valid dir */ + if(!cert_dir) { + if((stat(SSL_DIR, &st) == 0) && + (S_ISDIR(st.st_mode))) { + cert_dir = (char *)SSL_DIR; + } + } + + if(!NSS_IsInitialized()) { + SECStatus rv; + initialized = 1; + infof(data, "Initializing NSS with certpath: %s\n", + cert_dir ? cert_dir : "none"); + if(!cert_dir) { + rv = NSS_NoDB_Init(NULL); + } + else { + char *certpath = + PR_smprintf("%s%s", NSS_VersionCheck("3.12.0") ? "sql:" : "", cert_dir); + rv = NSS_Initialize(certpath, "", "", "", NSS_INIT_READONLY); + PR_smprintf_free(certpath); + } + if(rv != SECSuccess) { + infof(data, "Unable to initialize NSS database\n"); + initialized = 0; + return CURLE_SSL_CACERT_BADFILE; + } + } + + if(num_enabled_ciphers() == 0) + NSS_SetDomesticPolicy(); + + return CURLE_OK; +} + /** * Global SSL init * @@ -889,6 +954,7 @@ int Curl_nss_init(void) if (nss_initlock == NULL) { PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 256); nss_initlock = PR_NewLock(); + nss_crllock = PR_NewLock(); } /* We will actually initialize NSS later */ @@ -896,6 +962,21 @@ int Curl_nss_init(void) return 1; } +CURLcode Curl_nss_force_init(struct SessionHandle *data) +{ + CURLcode rv; + if(!nss_initlock) { + failf(data, "unable to initialize NSS, curl_global_init() should have been " + "called with CURL_GLOBAL_SSL or CURL_GLOBAL_ALL"); + return CURLE_OUT_OF_MEMORY; + } + + PR_Lock(nss_initlock); + rv = init_nss(data); + PR_Unlock(nss_initlock); + return rv; +} + /* Global cleanup */ void Curl_nss_cleanup(void) { @@ -918,6 +999,7 @@ void Curl_nss_cleanup(void) PR_Unlock(nss_initlock); PR_DestroyLock(nss_initlock); + PR_DestroyLock(nss_crllock); nss_initlock = NULL; initialized = 0; @@ -1010,6 +1092,9 @@ static bool handle_cc_error(PRInt32 err, struct SessionHandle *data) } } +static Curl_recv nss_recv; +static Curl_send nss_send; + CURLcode Curl_nss_connect(struct connectdata *conn, int sockindex) { PRInt32 err; @@ -1020,15 +1105,12 @@ CURLcode Curl_nss_connect(struct connectdata *conn, int sockindex) struct SessionHandle *data = conn->data; curl_socket_t sockfd = conn->sock[sockindex]; struct ssl_connect_data *connssl = &conn->ssl[sockindex]; - SECStatus rv; - char *certDir = NULL; int curlerr; const int *cipher_to_enable; PRSocketOptionData sock_opt; + long time_left; PRUint32 timeout; - curlerr = CURLE_SSL_CONNECT_ERROR; - if (connssl->state == ssl_connection_complete) return CURLE_OK; @@ -1042,76 +1124,36 @@ CURLcode Curl_nss_connect(struct connectdata *conn, int sockindex) /* FIXME. NSS doesn't support multiple databases open at the same time. */ PR_Lock(nss_initlock); - if(!initialized) { - struct_stat st; - - /* First we check if $SSL_DIR points to a valid dir */ - certDir = getenv("SSL_DIR"); - if(certDir) { - if((stat(certDir, &st) != 0) || - (!S_ISDIR(st.st_mode))) { - certDir = NULL; - } - } - - /* Now we check if the default location is a valid dir */ - if(!certDir) { - if((stat(SSL_DIR, &st) == 0) && - (S_ISDIR(st.st_mode))) { - certDir = (char *)SSL_DIR; - } - } - - if (!NSS_IsInitialized()) { - initialized = 1; - infof(conn->data, "Initializing NSS with certpath: %s\n", - certDir ? certDir : "none"); - if(!certDir) { - rv = NSS_NoDB_Init(NULL); - } - else { - char *certpath = PR_smprintf("%s%s", - NSS_VersionCheck("3.12.0") ? "sql:" : "", - certDir); - rv = NSS_Initialize(certpath, "", "", "", NSS_INIT_READONLY); - PR_smprintf_free(certpath); - } - if(rv != SECSuccess) { - infof(conn->data, "Unable to initialize NSS database\n"); - curlerr = CURLE_SSL_CACERT_BADFILE; - initialized = 0; - PR_Unlock(nss_initlock); - goto error; - } - } + curlerr = init_nss(conn->data); + if(CURLE_OK != curlerr) { + PR_Unlock(nss_initlock); + goto error; + } - if(num_enabled_ciphers() == 0) - NSS_SetDomesticPolicy(); + curlerr = CURLE_SSL_CONNECT_ERROR; #ifdef HAVE_PK11_CREATEGENERICOBJECT - if(!mod) { - char *configstring = aprintf("library=%s name=PEM", pem_library); - if(!configstring) { - PR_Unlock(nss_initlock); - goto error; - } - mod = SECMOD_LoadUserModule(configstring, NULL, PR_FALSE); - free(configstring); + if(!mod) { + char *configstring = aprintf("library=%s name=PEM", pem_library); + if(!configstring) { + PR_Unlock(nss_initlock); + goto error; + } + mod = SECMOD_LoadUserModule(configstring, NULL, PR_FALSE); + free(configstring); - if(!mod || !mod->loaded) { - if(mod) { - SECMOD_DestroyModule(mod); - mod = NULL; - } - infof(data, "WARNING: failed to load NSS PEM library %s. Using " - "OpenSSL PEM certificates will not work.\n", pem_library); + if(!mod || !mod->loaded) { + if(mod) { + SECMOD_DestroyModule(mod); + mod = NULL; } + infof(data, "WARNING: failed to load NSS PEM library %s. Using " + "OpenSSL PEM certificates will not work.\n", pem_library); } + } #endif - PK11_SetPasswordFunc(nss_get_password); - - } + PK11_SetPasswordFunc(nss_get_password); PR_Unlock(nss_initlock); model = PR_NewTCPSocket(); @@ -1243,8 +1285,7 @@ CURLcode Curl_nss_connect(struct connectdata *conn, int sockindex) data->set.ssl.CApath ? data->set.ssl.CApath : "none"); if (data->set.ssl.CRLfile) { - int rc = nss_load_crl(data->set.ssl.CRLfile, PR_FALSE); - if (!rc) { + if(SECSuccess != nss_load_crl(data->set.ssl.CRLfile)) { curlerr = CURLE_SSL_CRL_BADFILE; goto error; } @@ -1302,8 +1343,15 @@ CURLcode Curl_nss_connect(struct connectdata *conn, int sockindex) SSL_SetURL(connssl->handle, conn->host.name); + /* check timeout situation */ + time_left = Curl_timeleft(conn, NULL, TRUE); + if(time_left < 0L) { + failf(data, "timed out before SSL handshake"); + goto error; + } + timeout = PR_MillisecondsToInterval((PRUint32) time_left); + /* Force the handshake now */ - timeout = PR_MillisecondsToInterval((PRUint32)Curl_timeleft(conn, NULL, TRUE)); if(SSL_ForceHandshakeWithTimeout(connssl->handle, timeout) != SECSuccess) { if(conn->data->set.ssl.certverifyresult == SSL_ERROR_BAD_CERT_DOMAIN) curlerr = CURLE_PEER_FAILED_VERIFICATION; @@ -1313,6 +1361,8 @@ CURLcode Curl_nss_connect(struct connectdata *conn, int sockindex) } connssl->state = ssl_connection_complete; + conn->recv[sockindex] = nss_recv; + conn->send[sockindex] = nss_send; display_conn_info(conn, connssl->handle); @@ -1365,12 +1415,11 @@ CURLcode Curl_nss_connect(struct connectdata *conn, int sockindex) return curlerr; } -/* for documentation see Curl_ssl_send() in sslgen.h */ -int Curl_nss_send(struct connectdata *conn, /* connection data */ - int sockindex, /* socketindex */ - const void *mem, /* send this data */ - size_t len, /* amount to write */ - int *curlcode) +static ssize_t nss_send(struct connectdata *conn, /* connection data */ + int sockindex, /* socketindex */ + const void *mem, /* send this data */ + size_t len, /* amount to write */ + CURLcode *curlcode) { int rc; @@ -1379,7 +1428,7 @@ int Curl_nss_send(struct connectdata *conn, /* connection data */ if(rc < 0) { PRInt32 err = PR_GetError(); if(err == PR_WOULD_BLOCK_ERROR) - *curlcode = -1; /* EWOULDBLOCK */ + *curlcode = CURLE_AGAIN; else if(handle_cc_error(err, conn->data)) *curlcode = CURLE_SSL_CERTPROBLEM; else { @@ -1391,12 +1440,11 @@ int Curl_nss_send(struct connectdata *conn, /* connection data */ return rc; /* number of bytes */ } -/* for documentation see Curl_ssl_recv() in sslgen.h */ -ssize_t Curl_nss_recv(struct connectdata * conn, /* connection data */ - int num, /* socketindex */ - char *buf, /* store read data here */ - size_t buffersize, /* max amount to read */ - int *curlcode) +static ssize_t nss_recv(struct connectdata * conn, /* connection data */ + int num, /* socketindex */ + char *buf, /* store read data here */ + size_t buffersize, /* max amount to read */ + CURLcode *curlcode) { ssize_t nread; @@ -1406,7 +1454,7 @@ ssize_t Curl_nss_recv(struct connectdata * conn, /* connection data */ PRInt32 err = PR_GetError(); if(err == PR_WOULD_BLOCK_ERROR) - *curlcode = -1; /* EWOULDBLOCK */ + *curlcode = CURLE_AGAIN; else if(handle_cc_error(err, conn->data)) *curlcode = CURLE_SSL_CERTPROBLEM; else { @@ -1422,4 +1470,12 @@ size_t Curl_nss_version(char *buffer, size_t size) { return snprintf(buffer, size, "NSS/%s", NSS_VERSION); } + +int Curl_nss_seed(struct SessionHandle *data) +{ + /* TODO: implement? */ + (void) data; + return 0; +} + #endif /* USE_NSS */ @@ -42,24 +42,13 @@ int Curl_nss_close_all(struct SessionHandle *data); int Curl_nss_init(void); void Curl_nss_cleanup(void); -/* for documentation see Curl_ssl_send() in sslgen.h */ -int Curl_nss_send(struct connectdata *conn, - int sockindex, - const void *mem, - size_t len, - int *curlcode); - -/* for documentation see Curl_ssl_recv() in sslgen.h */ -ssize_t Curl_nss_recv(struct connectdata *conn, /* connection data */ - int num, /* socketindex */ - char *buf, /* store read data here */ - size_t buffersize, /* max amount to read */ - int *curlcode); - size_t Curl_nss_version(char *buffer, size_t size); int Curl_nss_check_cxn(struct connectdata *cxn); int Curl_nss_seed(struct SessionHandle *data); +/* initialize NSS library if not already */ +CURLcode Curl_nss_force_init(struct SessionHandle *data); + /* API setup for NSS */ #define curlssl_init Curl_nss_init #define curlssl_cleanup Curl_nss_cleanup @@ -74,8 +63,6 @@ int Curl_nss_seed(struct SessionHandle *data); #define curlssl_set_engine(x,y) (x=x, y=y, CURLE_FAILED_INIT) #define curlssl_set_engine_default(x) (x=x, CURLE_FAILED_INIT) #define curlssl_engines_list(x) (x=x, (struct curl_slist *)NULL) -#define curlssl_send Curl_nss_send -#define curlssl_recv Curl_nss_recv #define curlssl_version Curl_nss_version #define curlssl_check_cxn(x) Curl_nss_check_cxn(x) #define curlssl_data_pending(x,y) (x=x, y=y, 0) diff --git a/lib/openldap.c b/lib/openldap.c new file mode 100644 index 00000000..4d5db4a5 --- /dev/null +++ b/lib/openldap.c @@ -0,0 +1,635 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 2010, Howard Chu, <hyc@openldap.org> + * + * 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. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#if !defined(CURL_DISABLE_LDAP) && defined(USE_OPENLDAP) + +/* + * Notice that USE_OPENLDAP is only a source code selection switch. When + * libcurl is built with USE_OPENLDAP defined the libcurl source code that + * gets compiled is the code from openldap.c, otherwise the code that gets + * compiled is the code from ldap.c. + * + * When USE_OPENLDAP is defined a recent version of the OpenLDAP library + * might be required for compilation and runtime. In order to use ancient + * OpenLDAP library versions, USE_OPENLDAP shall not be defined. + */ + +#include <ldap.h> + +#include "urldata.h" +#include <curl/curl.h> +#include "sendf.h" +#include "sslgen.h" +#include "transfer.h" +#include "curl_ldap.h" +#include "curl_memory.h" +#include "curl_base64.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include <curl/mprintf.h> + +#include "memdebug.h" + +#ifndef _LDAP_PVT_H +extern int ldap_pvt_url_scheme2proto(const char *); +extern int ldap_init_fd(ber_socket_t fd, int proto, const char *url, LDAP **ld); +#endif + +static CURLcode ldap_setup(struct connectdata *conn); +static CURLcode ldap_do(struct connectdata *conn, bool *done); +static CURLcode ldap_done(struct connectdata *conn, CURLcode, bool); +static CURLcode ldap_connect(struct connectdata *conn, bool *done); +static CURLcode ldap_connecting(struct connectdata *conn, bool *done); +static CURLcode ldap_disconnect(struct connectdata *conn); + +static Curl_recv ldap_recv; + +/* + * LDAP protocol handler. + */ + +const struct Curl_handler Curl_handler_ldap = { + "LDAP", /* scheme */ + ldap_setup, /* setup_connection */ + ldap_do, /* do_it */ + ldap_done, /* done */ + ZERO_NULL, /* do_more */ + ldap_connect, /* connect_it */ + ldap_connecting, /* connecting */ + ZERO_NULL, /* doing */ + ZERO_NULL, /* proto_getsock */ + ZERO_NULL, /* doing_getsock */ + ZERO_NULL, /* perform_getsock */ + ldap_disconnect, /* disconnect */ + PORT_LDAP, /* defport */ + PROT_LDAP /* protocol */ +}; + +#ifdef USE_SSL +/* + * LDAPS protocol handler. + */ + +const struct Curl_handler Curl_handler_ldaps = { + "LDAPS", /* scheme */ + ldap_setup, /* setup_connection */ + ldap_do, /* do_it */ + ldap_done, /* done */ + ZERO_NULL, /* do_more */ + ldap_connect, /* connect_it */ + ldap_connecting, /* connecting */ + ZERO_NULL, /* doing */ + ZERO_NULL, /* proto_getsock */ + ZERO_NULL, /* doing_getsock */ + ZERO_NULL, /* perform_getsock */ + ldap_disconnect, /* disconnect */ + PORT_LDAPS, /* defport */ + PROT_LDAP | PROT_SSL /* protocol */ +}; +#endif + +static const char *url_errs[] = { + "success", + "out of memory", + "bad parameter", + "unrecognized scheme", + "unbalanced delimiter", + "bad URL", + "bad host or port", + "bad or missing attributes", + "bad or missing scope", + "bad or missing filter", + "bad or missing extensions" +}; + +typedef struct ldapconninfo { + LDAP *ld; + Curl_recv *recv; /* for stacking SSL handler */ + Curl_send *send; + int proto; + int msgid; + bool ssldone; + bool sslinst; + bool didbind; +} ldapconninfo; + +typedef struct ldapreqinfo { + int msgid; + int nument; +} ldapreqinfo; + +static CURLcode ldap_setup(struct connectdata *conn) +{ + ldapconninfo *li; + LDAPURLDesc *lud; + struct SessionHandle *data=conn->data; + int rc, proto; + CURLcode status; + + rc = ldap_url_parse(data->change.url, &lud); + if (rc != LDAP_URL_SUCCESS) { + const char *msg = "url parsing problem"; + status = CURLE_URL_MALFORMAT; + if (rc > LDAP_URL_SUCCESS && rc <= LDAP_URL_ERR_BADEXTS) { + if (rc == LDAP_URL_ERR_MEM) + status = CURLE_OUT_OF_MEMORY; + msg = url_errs[rc]; + } + failf(conn->data, "LDAP local: %s", msg); + return status; + } + proto = ldap_pvt_url_scheme2proto(lud->lud_scheme); + ldap_free_urldesc(lud); + + li = calloc(1, sizeof(ldapconninfo)); + li->proto = proto; + conn->proto.generic = li; + conn->bits.close = FALSE; + /* TODO: + * - provide option to choose SASL Binds instead of Simple + */ + return CURLE_OK; +} + +#ifdef USE_SSL +static Sockbuf_IO ldapsb_tls; +#endif + +static CURLcode ldap_connect(struct connectdata *conn, bool *done) +{ + ldapconninfo *li = conn->proto.generic; + struct SessionHandle *data=conn->data; + int rc, proto = LDAP_VERSION3; + char hosturl[1024], *ptr; + + strcpy(hosturl, "ldap"); + ptr = hosturl+4; + if (conn->protocol & PROT_SSL) + *ptr++ = 's'; + snprintf(ptr, sizeof(hosturl)-(ptr-hosturl), "://%s:%d", + conn->host.name, conn->port); + + rc = ldap_init_fd(conn->sock[FIRSTSOCKET], li->proto, hosturl, &li->ld); + if (rc) { + failf(data, "LDAP local: Cannot connect to %s, %s", + hosturl, ldap_err2string(rc)); + return CURLE_COULDNT_CONNECT; + } + + ldap_set_option(li->ld, LDAP_OPT_PROTOCOL_VERSION, &proto); + +#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_PROXY) + if(conn->bits.tunnel_proxy && conn->bits.httpproxy) { + /* for LDAP over HTTP proxy */ + struct HTTP http_proxy; + ldapconninfo *li_save; + CURLcode result; + + /* BLOCKING */ + /* We want "seamless" LDAP operations through HTTP proxy tunnel */ + + /* Curl_proxyCONNECT is based on a pointer to a struct HTTP at the member + * conn->proto.http; we want LDAP through HTTP and we have to change the + * member temporarily for connecting to the HTTP proxy. After + * Curl_proxyCONNECT we have to set back the member to the original struct + * LDAP pointer + */ + li_save = data->state.proto.generic; + memset(&http_proxy, 0, sizeof(http_proxy)); + data->state.proto.http = &http_proxy; + result = Curl_proxyCONNECT(conn, FIRSTSOCKET, + conn->host.name, conn->remote_port); + + data->state.proto.generic = li_save; + + if(CURLE_OK != result) + return result; + } +#endif /* !CURL_DISABLE_HTTP && !CURL_DISABLE_PROXY */ + +#ifdef USE_SSL + if (conn->protocol & PROT_SSL) { + CURLcode res; + if (data->state.used_interface == Curl_if_easy) { + res = Curl_ssl_connect(conn, FIRSTSOCKET); + if (res) + return res; + li->ssldone = TRUE; + } else { + res = Curl_ssl_connect_nonblocking(conn, FIRSTSOCKET, &li->ssldone); + if (res) + return res; + } + } +#endif + + if (data->state.used_interface == Curl_if_easy) + return ldap_connecting(conn, done); + + return CURLE_OK; +} + +static CURLcode ldap_connecting(struct connectdata *conn, bool *done) +{ + ldapconninfo *li = conn->proto.generic; + struct SessionHandle *data=conn->data; + LDAPMessage *result = NULL; + struct timeval tv = {0,1}, *tvp; + int rc, err; + char *info = NULL; + +#ifdef USE_SSL + if (conn->protocol & PROT_SSL) { + /* Is the SSL handshake complete yet? */ + if (!li->ssldone) { + CURLcode res = Curl_ssl_connect_nonblocking(conn, FIRSTSOCKET, &li->ssldone); + if (res || !li->ssldone) + return res; + } + /* Have we installed the libcurl SSL handlers into the sockbuf yet? */ + if (!li->sslinst) { + Sockbuf *sb; + ldap_get_option(li->ld, LDAP_OPT_SOCKBUF, &sb); + ber_sockbuf_add_io(sb, &ldapsb_tls, LBER_SBIOD_LEVEL_TRANSPORT, conn); + li->sslinst = TRUE; + li->recv = conn->recv[FIRSTSOCKET]; + li->send = conn->send[FIRSTSOCKET]; + } + } +#endif + + if (data->state.used_interface == Curl_if_easy) + tvp = NULL; /* let ldap_result block indefinitely */ + else + tvp = &tv; + +retry: + if (!li->didbind) { + char *binddn; + struct berval passwd; + + if (conn->bits.user_passwd) { + binddn = conn->user; + passwd.bv_val = conn->passwd; + passwd.bv_len = strlen(passwd.bv_val); + } else { + binddn = NULL; + passwd.bv_val = NULL; + passwd.bv_len = 0; + } + rc = ldap_sasl_bind(li->ld, binddn, LDAP_SASL_SIMPLE, &passwd, + NULL, NULL, &li->msgid); + if (rc) + return CURLE_LDAP_CANNOT_BIND; + li->didbind = TRUE; + if (tvp) + return CURLE_OK; + } + + rc = ldap_result(li->ld, li->msgid, LDAP_MSG_ONE, tvp, &result); + if (rc < 0) { + failf(data, "LDAP local: bind ldap_result %s", ldap_err2string(rc)); + return CURLE_LDAP_CANNOT_BIND; + } + if (rc == 0) { + /* timed out */ + return CURLE_OK; + } + rc = ldap_parse_result(li->ld, result, &err, NULL, &info, NULL, NULL, 1); + if (rc) { + failf(data, "LDAP local: bind ldap_parse_result %s", ldap_err2string(rc)); + return CURLE_LDAP_CANNOT_BIND; + } + /* Try to fallback to LDAPv2? */ + if (err == LDAP_PROTOCOL_ERROR) { + int proto; + ldap_get_option(li->ld, LDAP_OPT_PROTOCOL_VERSION, &proto); + if (proto == LDAP_VERSION3) { + ldap_memfree(info); + proto = LDAP_VERSION2; + ldap_set_option(li->ld, LDAP_OPT_PROTOCOL_VERSION, &proto); + li->didbind = FALSE; + goto retry; + } + } + + if (err) { + failf(data, "LDAP remote: bind failed %s %s", ldap_err2string(rc), + info ? info : ""); + return CURLE_LOGIN_DENIED; + } + conn->recv[FIRSTSOCKET] = ldap_recv; + *done = TRUE; + return CURLE_OK; +} + +static CURLcode ldap_disconnect(struct connectdata *conn) +{ + ldapconninfo *li = conn->proto.generic; + + if (li) { + if (li->ld) { + ldap_unbind_ext(li->ld, NULL, NULL); + li->ld = NULL; + } + conn->proto.generic = NULL; + free(li); + } + return CURLE_OK; +} + +static CURLcode ldap_do(struct connectdata *conn, bool *done) +{ + ldapconninfo *li = conn->proto.generic; + ldapreqinfo *lr; + CURLcode status = CURLE_OK; + int rc = 0; + LDAPURLDesc *ludp = NULL; + int msgid; + struct SessionHandle *data=conn->data; + + conn->bits.close = FALSE; + + infof(data, "LDAP local: %s\n", data->change.url); + + rc = ldap_url_parse(data->change.url, &ludp); + if (rc != LDAP_URL_SUCCESS) { + const char *msg = "url parsing problem"; + status = CURLE_URL_MALFORMAT; + if (rc > LDAP_URL_SUCCESS && rc <= LDAP_URL_ERR_BADEXTS) { + if (rc == LDAP_URL_ERR_MEM) + status = CURLE_OUT_OF_MEMORY; + msg = url_errs[rc]; + } + failf(conn->data, "LDAP local: %s", msg); + return status; + } + + rc = ldap_search_ext(li->ld, ludp->lud_dn, ludp->lud_scope, + ludp->lud_filter, ludp->lud_attrs, 0, + NULL, NULL, NULL, 0, &msgid); + ldap_free_urldesc(ludp); + if (rc != LDAP_SUCCESS) { + failf(data, "LDAP local: ldap_search_ext %s", ldap_err2string(rc)); + return CURLE_LDAP_SEARCH_FAILED; + } + lr = calloc(1,sizeof(ldapreqinfo)); + lr->msgid = msgid; + data->state.proto.generic = lr; + Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, NULL, -1, NULL); + *done = TRUE; + return CURLE_OK; +} + +static CURLcode ldap_done(struct connectdata *conn, CURLcode res, + bool premature) +{ + ldapreqinfo *lr = conn->data->state.proto.generic; + (void)res; + (void)premature; + + if (lr) { + /* if there was a search in progress, abandon it */ + if (lr->msgid) { + ldapconninfo *li = conn->proto.generic; + ldap_abandon_ext(li->ld, lr->msgid, NULL, NULL); + lr->msgid = 0; + } + conn->data->state.proto.generic = NULL; + free(lr); + } + return CURLE_OK; +} + +static ssize_t ldap_recv(struct connectdata *conn, int sockindex, char *buf, + size_t len, CURLcode *err) +{ + ldapconninfo *li = conn->proto.generic; + struct SessionHandle *data=conn->data; + ldapreqinfo *lr = data->state.proto.generic; + int rc, ret; + LDAPMessage *result = NULL; + LDAPMessage *ent; + BerElement *ber = NULL; + struct timeval tv = {0,1}; + (void)len; + (void)buf; + (void)sockindex; + + rc = ldap_result(li->ld, lr->msgid, LDAP_MSG_RECEIVED, &tv, &result); + if (rc < 0) { + failf(data, "LDAP local: search ldap_result %s", ldap_err2string(rc)); + *err = CURLE_RECV_ERROR; + return -1; + } + + *err = CURLE_AGAIN; + ret = -1; + + /* timed out */ + if (result == NULL) + return ret; + + for (ent = ldap_first_message(li->ld, result); ent; + ent = ldap_next_message(li->ld, ent)) { + struct berval bv, *bvals, **bvp = &bvals; + int binary = 0, msgtype; + + msgtype = ldap_msgtype(ent); + if (msgtype == LDAP_RES_SEARCH_RESULT) { + int code; + char *info = NULL; + rc = ldap_parse_result(li->ld, ent, &code, NULL, &info, NULL, NULL, 0); + if (rc) { + failf(data, "LDAP local: search ldap_parse_result %s", ldap_err2string(rc)); + *err = CURLE_LDAP_SEARCH_FAILED; + } else if (code && code != LDAP_SIZELIMIT_EXCEEDED) { + failf(data, "LDAP remote: search failed %s %s", ldap_err2string(rc), + info ? info : ""); + *err = CURLE_LDAP_SEARCH_FAILED; + } else { + /* successful */ + if (code == LDAP_SIZELIMIT_EXCEEDED) + infof(data, "There are more than %d entries\n", lr->nument); + data->req.size = data->req.bytecount; + *err = CURLE_OK; + ret = 0; + } + lr->msgid = 0; + ldap_memfree(info); + break; + } else if (msgtype != LDAP_RES_SEARCH_ENTRY) { + continue; + } + + lr->nument++; + rc = ldap_get_dn_ber(li->ld, ent, &ber, &bv); + Curl_client_write(conn, CLIENTWRITE_BODY, (char *)"DN: ", 4); + Curl_client_write(conn, CLIENTWRITE_BODY, (char *)bv.bv_val, bv.bv_len); + Curl_client_write(conn, CLIENTWRITE_BODY, (char *)"\n", 1); + data->req.bytecount += bv.bv_len + 5; + + for (rc = ldap_get_attribute_ber(li->ld, ent, ber, &bv, bvp); + rc == LDAP_SUCCESS; + rc = ldap_get_attribute_ber(li->ld, ent, ber, &bv, bvp)) { + int i; + + if (bv.bv_val == NULL) break; + + if (bv.bv_len > 7 && !strncmp(bv.bv_val + bv.bv_len - 7, ";binary", 7)) + binary = 1; + + for (i=0; bvals[i].bv_val != NULL; i++) { + int binval = 0; + Curl_client_write(conn, CLIENTWRITE_BODY, (char *)"\t", 1); + Curl_client_write(conn, CLIENTWRITE_BODY, (char *)bv.bv_val, bv.bv_len); + Curl_client_write(conn, CLIENTWRITE_BODY, (char *)":", 1); + data->req.bytecount += bv.bv_len + 2; + + if (!binary) { + /* check for leading or trailing whitespace */ + if (isspace(bvals[i].bv_val[0]) || + isspace(bvals[i].bv_val[bvals[i].bv_len-1])) { + binval = 1; + } else { + /* check for unprintable characters */ + unsigned int j; + for (j=0; j<bvals[i].bv_len; j++) + if (!isprint(bvals[i].bv_val[j])) { + binval = 1; + break; + } + } + } + if (binary || binval) { + char *val_b64; + /* Binary value, encode to base64. */ + size_t val_b64_sz = Curl_base64_encode(data, + bvals[i].bv_val, + bvals[i].bv_len, + &val_b64); + Curl_client_write(conn, CLIENTWRITE_BODY, (char *)": ", 2); + data->req.bytecount += 2; + if(val_b64_sz > 0) { + Curl_client_write(conn, CLIENTWRITE_BODY, val_b64, val_b64_sz); + free(val_b64); + data->req.bytecount += val_b64_sz; + } + } else { + Curl_client_write(conn, CLIENTWRITE_BODY, (char *)" ", 1); + Curl_client_write(conn, CLIENTWRITE_BODY, bvals[i].bv_val, + bvals[i].bv_len); + data->req.bytecount += bvals[i].bv_len + 1; + } + Curl_client_write(conn, CLIENTWRITE_BODY, (char *)"\n", 0); + data->req.bytecount++; + } + ber_memfree(bvals); + Curl_client_write(conn, CLIENTWRITE_BODY, (char *)"\n", 0); + data->req.bytecount++; + } + Curl_client_write(conn, CLIENTWRITE_BODY, (char *)"\n", 0); + data->req.bytecount++; + ber_free(ber, 0); + } + ldap_msgfree(result); + return ret; +} + +#ifdef USE_SSL +static int +ldapsb_tls_setup(Sockbuf_IO_Desc *sbiod, void *arg) +{ + sbiod->sbiod_pvt = arg; + return 0; +} + +static int +ldapsb_tls_remove(Sockbuf_IO_Desc *sbiod) +{ + sbiod->sbiod_pvt = NULL; + return 0; +} + +/* We don't need to do anything because libcurl does it already */ +static int +ldapsb_tls_close(Sockbuf_IO_Desc *sbiod) +{ + (void)sbiod; + return 0; +} + +static int +ldapsb_tls_ctrl(Sockbuf_IO_Desc *sbiod, int opt, void *arg) +{ + (void)arg; + if (opt == LBER_SB_OPT_DATA_READY) { + struct connectdata *conn = sbiod->sbiod_pvt; + return Curl_ssl_data_pending(conn, FIRSTSOCKET); + } + return 0; +} + +static ber_slen_t +ldapsb_tls_read(Sockbuf_IO_Desc *sbiod, void *buf, ber_len_t len) +{ + struct connectdata *conn = sbiod->sbiod_pvt; + ldapconninfo *li = conn->proto.generic; + ber_slen_t ret; + CURLcode err = CURLE_RECV_ERROR; + + ret = li->recv(conn, FIRSTSOCKET, buf, len, &err); + if (ret < 0 && err == CURLE_AGAIN) { + SET_SOCKERRNO(EWOULDBLOCK); + } + return ret; +} + +static ber_slen_t +ldapsb_tls_write(Sockbuf_IO_Desc *sbiod, void *buf, ber_len_t len) +{ + struct connectdata *conn = sbiod->sbiod_pvt; + ldapconninfo *li = conn->proto.generic; + ber_slen_t ret; + CURLcode err = CURLE_SEND_ERROR; + + ret = li->send(conn, FIRSTSOCKET, buf, len, &err); + if (ret < 0 && err == CURLE_AGAIN) { + SET_SOCKERRNO(EWOULDBLOCK); + } + return ret; +} + +static Sockbuf_IO ldapsb_tls = +{ + ldapsb_tls_setup, + ldapsb_tls_remove, + ldapsb_tls_ctrl, + ldapsb_tls_read, + ldapsb_tls_write, + ldapsb_tls_close +}; +#endif /* USE_SSL */ + +#endif /* !CURL_DISABLE_LDAP && USE_OPENLDAP */ diff --git a/lib/parsedate.c b/lib/parsedate.c index 8e26f1c7..5d8af269 100644 --- a/lib/parsedate.c +++ b/lib/parsedate.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -370,7 +370,12 @@ int Curl_parsedate(const char *date, time_t *output) (3 == sscanf(date, "%02d:%02d:%02d", &hournum, &minnum, &secnum))) { /* time stamp! */ date += 8; - found = TRUE; + } + else if((secnum == -1) && + (2 == sscanf(date, "%02d:%02d", &hournum, &minnum))) { + /* time stamp without seconds */ + date += 5; + secnum = 0; } else { val = (int)strtol(date, &end, 10); diff --git a/lib/pingpong.c b/lib/pingpong.c index c6b6f2fb..876a6a21 100644 --- a/lib/pingpong.c +++ b/lib/pingpong.c @@ -322,7 +322,7 @@ CURLcode Curl_pp_readresp(curl_socket_t sockfd, */ DEBUGASSERT((ptr+pp->cache_size) <= (buf+BUFSIZE+1)); memcpy(ptr, pp->cache, pp->cache_size); - gotbytes = pp->cache_size; + gotbytes = (ssize_t)pp->cache_size; free(pp->cache); /* free the cache */ pp->cache = NULL; /* clear the pointer */ pp->cache_size = 0; /* zero the size just in case */ @@ -340,8 +340,7 @@ CURLcode Curl_pp_readresp(curl_socket_t sockfd, #if defined(HAVE_KRB4) || defined(HAVE_GSSAPI) conn->data_prot = prot; #endif - if(res < 0) - /* EWOULDBLOCK */ + if(res == CURLE_AGAIN) return CURLE_OK; /* return */ #ifdef CURL_DOES_CONVERSIONS @@ -387,8 +386,8 @@ CURLcode Curl_pp_readresp(curl_socket_t sockfd, if(!conn->sec_complete) #endif if(data->set.verbose) - Curl_debug(data, CURLINFO_HEADER_IN, - pp->linestart_resp, (size_t)perline, conn); + Curl_debug(data, CURLINFO_HEADER_IN, + pp->linestart_resp, (size_t)perline, conn); /* * We pass all response-lines to the callback function registered diff --git a/lib/pingpong.h b/lib/pingpong.h index a629aeee..cbbff8f3 100644 --- a/lib/pingpong.h +++ b/lib/pingpong.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2007, 2009, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -56,7 +56,7 @@ struct pingpong { struct timeval response; /* set to Curl_tvnow() when a command has been sent off, used to time-out response reading */ long response_time; /* When no timeout is given, this is the amount of - seconds we await for a server response. */ + milliseconds we await for a server response. */ struct connectdata *conn; /* points to the connectdata struct that this belongs to */ diff --git a/lib/polarssl.c b/lib/polarssl.c new file mode 100644 index 00000000..e81e6609 --- /dev/null +++ b/lib/polarssl.c @@ -0,0 +1,375 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 2010, Hoi-Ho Chan, <hoiho.chan@gmail.com> + * + * 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. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +/* + * Source file for all PolarSSL-specific code for the TLS/SSL layer. No code + * but sslgen.c should ever call or use these functions. + * + */ + +#include "setup.h" +#ifdef USE_POLARSSL + +#include <string.h> +#include <stdlib.h> +#include <ctype.h> +#ifdef HAVE_SYS_SOCKET_H +#include <sys/socket.h> +#endif + +#include <polarssl/net.h> +#include <polarssl/ssl.h> +#include <polarssl/havege.h> +#include <polarssl/certs.h> +#include <polarssl/x509.h> + +#include "urldata.h" +#include "sendf.h" +#include "inet_pton.h" +#include "polarssl.h" +#include "sslgen.h" +#include "parsedate.h" +#include "connect.h" /* for the connect timeout */ +#include "select.h" +#include "rawstr.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include <curl/mprintf.h> +#include "curl_memory.h" +/* The last #include file should be: */ +#include "memdebug.h" + +/* Define this to enable lots of debugging for PolarSSL */ +#undef POLARSSL_DEBUG + +#ifdef POLARSSL_DEBUG +static void polarssl_debug(void *context, int level, char *line) +{ + struct SessionHandle *data = NULL; + + if(!context) + return; + + data = (struct SessionHandle *)context; + + infof(data, "%s", line); +} +#else +#endif + +static Curl_recv polarssl_recv; +static Curl_send polarssl_send; + +/* + * This function loads all the client/CA certificates and CRLs. Setup the TLS + * layer and do all necessary magic. + */ +CURLcode +Curl_polarssl_connect(struct connectdata *conn, + int sockindex) +{ + struct SessionHandle *data = conn->data; + bool sni = TRUE; /* default is SNI enabled */ + int ret = -1; +#ifdef ENABLE_IPV6 + struct in6_addr addr; +#else + struct in_addr addr; +#endif + void *old_session = NULL; + size_t old_session_size = 0; + char buffer[1024]; + + if(conn->ssl[sockindex].state == ssl_connection_complete) + return CURLE_OK; + + /* PolarSSL only supports SSLv3 and TLSv1 */ + if(data->set.ssl.version == CURL_SSLVERSION_SSLv2) { + failf(data, "PolarSSL does not support SSLv2"); + return CURLE_SSL_CONNECT_ERROR; + } else if(data->set.ssl.version == CURL_SSLVERSION_SSLv3) { + sni = FALSE; /* SSLv3 has no SNI */ + } + + havege_init(&conn->ssl[sockindex].hs); + + /* Load the trusted CA */ + memset(&conn->ssl[sockindex].cacert, 0, sizeof(x509_cert)); + + if(data->set.str[STRING_SSL_CAFILE]) { + ret = x509parse_crtfile(&conn->ssl[sockindex].cacert, + data->set.str[STRING_SSL_CAFILE]); + + if(ret) { + failf(data, "Error reading ca cert file %s: -0x%04X", + data->set.str[STRING_SSL_CAFILE], -ret); + + if(data->set.ssl.verifypeer) + return CURLE_SSL_CACERT_BADFILE; + } + } + + /* Load the client certificate */ + memset(&conn->ssl[sockindex].clicert, 0, sizeof(x509_cert)); + + if(data->set.str[STRING_CERT]) { + ret = x509parse_crtfile(&conn->ssl[sockindex].clicert, + data->set.str[STRING_CERT]); + + if(ret) { + failf(data, "Error reading client cert file %s: -0x%04X", + data->set.str[STRING_CERT], -ret); + return CURLE_SSL_CERTPROBLEM; + } + } + + /* Load the client private key */ + if(data->set.str[STRING_KEY]) { + ret = x509parse_keyfile(&conn->ssl[sockindex].rsa, + data->set.str[STRING_KEY], + data->set.str[STRING_KEY_PASSWD]); + + if(ret) { + failf(data, "Error reading private key %s: -0x%04X", + data->set.str[STRING_KEY], -ret); + return CURLE_SSL_CERTPROBLEM; + } + } + + /* Load the CRL */ + memset(&conn->ssl[sockindex].crl, 0, sizeof(x509_crl)); + + if(data->set.str[STRING_SSL_CRLFILE]) { + ret = x509parse_crlfile(&conn->ssl[sockindex].crl, + data->set.str[STRING_SSL_CRLFILE]); + + if(ret) { + failf(data, "Error reading CRL file %s: -0x%04X", + data->set.str[STRING_SSL_CRLFILE], -ret); + return CURLE_SSL_CRL_BADFILE; + } + } + + infof(data, "PolarSSL: Connected to %s:%d\n", + conn->host.name, conn->remote_port); + + havege_init(&conn->ssl[sockindex].hs); + + if(ssl_init(&conn->ssl[sockindex].ssl)) { + failf(data, "PolarSSL: ssl_init failed"); + return CURLE_SSL_CONNECT_ERROR; + } + + ssl_set_endpoint(&conn->ssl[sockindex].ssl, SSL_IS_CLIENT); + ssl_set_authmode(&conn->ssl[sockindex].ssl, SSL_VERIFY_OPTIONAL); + + ssl_set_rng(&conn->ssl[sockindex].ssl, havege_rand, + &conn->ssl[sockindex].hs); + ssl_set_bio(&conn->ssl[sockindex].ssl, + net_recv, &conn->sock[sockindex], + net_send, &conn->sock[sockindex]); + + ssl_set_ciphers(&conn->ssl[sockindex].ssl, ssl_default_ciphers); + + if(!Curl_ssl_getsessionid(conn, &old_session, &old_session_size)) { + memcpy(&conn->ssl[sockindex].ssn, old_session, old_session_size); + infof(data, "PolarSSL re-using session\n"); + } + + ssl_set_session(&conn->ssl[sockindex].ssl, 1, 600, + &conn->ssl[sockindex].ssn); + + ssl_set_ca_chain(&conn->ssl[sockindex].ssl, + &conn->ssl[sockindex].cacert, + &conn->ssl[sockindex].crl, + conn->host.name); + + ssl_set_own_cert(&conn->ssl[sockindex].ssl, + &conn->ssl[sockindex].clicert, &conn->ssl[sockindex].rsa); + + if(!Curl_inet_pton(AF_INET, conn->host.name, &addr) && +#ifdef ENABLE_IPV6 + !Curl_inet_pton(AF_INET6, conn->host.name, &addr) && +#endif + sni && ssl_set_hostname(&conn->ssl[sockindex].ssl, conn->host.name)) { + infof(data, "WARNING: failed to configure " + "server name indication (SNI) TLS extension\n"); + } + + infof(data, "PolarSSL: performing SSL/TLS handshake...\n"); + +#ifdef POLARSSL_DEBUG + ssl_set_dbg(&conn->ssl[sockindex].ssl, polarssl_debug, data); +#endif + + do { + if (!(ret = ssl_handshake(&conn->ssl[sockindex].ssl))) { + break; + } else if(ret != POLARSSL_ERR_NET_TRY_AGAIN) { + failf(data, "ssl_handshake returned -0x%04X", -ret); + return CURLE_SSL_CONNECT_ERROR; + } else { + /* wait for data from server... */ + long timeout_ms = Curl_timeleft(conn, NULL, TRUE); + + if(timeout_ms < 0) { + failf(data, "SSL connection timeout"); + return CURLE_OPERATION_TIMEDOUT; + } + + switch(Curl_socket_ready(conn->sock[sockindex], + CURL_SOCKET_BAD, timeout_ms)) { + case 0: + failf(data, "SSL handshake timeout"); + return CURLE_OPERATION_TIMEDOUT; + break; + case CURL_CSELECT_IN: + continue; + break; + default: + return CURLE_SSL_CONNECT_ERROR; + break; + } + } + } while (1); + + infof(data, "PolarSSL: Handshake complete, cipher is %s\n", + ssl_get_cipher(&conn->ssl[sockindex].ssl)); + + ret = ssl_get_verify_result(&conn->ssl[sockindex].ssl); + + if(ret && data->set.ssl.verifypeer) { + if(ret & BADCERT_EXPIRED) + failf(data, "Cert verify failed: BADCERT_EXPIRED\n"); + + if(ret & BADCERT_REVOKED) + failf(data, "Cert verify failed: BADCERT_REVOKED"); + + if(ret & BADCERT_CN_MISMATCH) + failf(data, "Cert verify failed: BADCERT_CN_MISMATCH"); + + if(ret & BADCERT_NOT_TRUSTED) + failf(data, "Cert verify failed: BADCERT_NOT_TRUSTED"); + + return CURLE_SSL_CACERT; + } + + if(conn->ssl[sockindex].ssl.peer_cert) { + /* If the session was resumed, there will be no peer certs */ + memset(buffer, 0, sizeof(buffer)); + + if(x509parse_cert_info(buffer, sizeof(buffer), (char *)"* ", + conn->ssl[sockindex].ssl.peer_cert) != -1) + infof(data, "Dumping cert info:\n%s\n", buffer); + } + + conn->ssl[sockindex].state = ssl_connection_complete; + conn->recv[sockindex] = polarssl_recv; + conn->send[sockindex] = polarssl_send; + + /* Save the current session data for possible re-use */ + { + void *new_session = malloc(sizeof(conn->ssl[sockindex].ssn)); + + if(new_session) { + memcpy(new_session, &conn->ssl[sockindex].ssn, + sizeof(conn->ssl[sockindex].ssn)); + + if(old_session) + Curl_ssl_delsessionid(conn, old_session); + + return Curl_ssl_addsessionid(conn, new_session, + sizeof(conn->ssl[sockindex].ssn)); + } + } + + return CURLE_OK; +} + +static ssize_t polarssl_send(struct connectdata *conn, + int sockindex, + const void *mem, + size_t len, + CURLcode *curlcode) +{ + int ret = -1; + + ret = ssl_write(&conn->ssl[sockindex].ssl, + (unsigned char *)mem, len); + + if(ret < 0) { + *curlcode = (ret == POLARSSL_ERR_NET_TRY_AGAIN) ? + CURLE_AGAIN : CURLE_SEND_ERROR; + ret = -1; + } + + return ret; +} + +void Curl_polarssl_close_all(struct SessionHandle *data) +{ + (void)data; +} + +void Curl_polarssl_close(struct connectdata *conn, int sockindex) +{ + rsa_free(&conn->ssl[sockindex].rsa); + x509_free(&conn->ssl[sockindex].clicert); + x509_free(&conn->ssl[sockindex].cacert); + x509_crl_free(&conn->ssl[sockindex].crl); + ssl_free(&conn->ssl[sockindex].ssl); +} + +static ssize_t polarssl_recv(struct connectdata *conn, + int num, + char *buf, + size_t buffersize, + CURLcode *curlcode) +{ + int ret = -1; + ssize_t len = -1; + + memset(buf, 0, buffersize); + ret = ssl_read(&conn->ssl[num].ssl, (unsigned char *)buf, buffersize); + + if(ret <= 0) { + *curlcode = (ret == POLARSSL_ERR_NET_TRY_AGAIN) ? + CURLE_AGAIN : CURLE_RECV_ERROR; + return -1; + } + + len = ret; + + return len; +} + +void Curl_polarssl_session_free(void *ptr) +{ + free(ptr); +} + +size_t Curl_polarssl_version(char *buffer, size_t size) +{ + return snprintf(buffer, size, "PolarSSL"); +} + +#endif diff --git a/lib/polarssl.h b/lib/polarssl.h new file mode 100644 index 00000000..964af172 --- /dev/null +++ b/lib/polarssl.h @@ -0,0 +1,57 @@ +#ifndef HEADER_CURL_POLARSSL_H +#define HEADER_CURL_POLARSSL_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 2010, Hoi-Ho Chan, <hoiho.chan@gmail.com> + * + * 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. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * $Id: polarssl.h,v 1.10 2009-02-12 20:48:43 danf Exp $ + ***************************************************************************/ + +#ifdef USE_POLARSSL + +CURLcode Curl_polarssl_connect(struct connectdata *conn, int sockindex); + +/* tell PolarSSL to close down all open information regarding connections (and + thus session ID caching etc) */ +void Curl_polarssl_close_all(struct SessionHandle *data); + + /* close a SSL connection */ +void Curl_polarssl_close(struct connectdata *conn, int sockindex); + +void Curl_polarssl_session_free(void *ptr); +size_t Curl_polarssl_version(char *buffer, size_t size); +int Curl_polarssl_shutdown(struct connectdata *conn, int sockindex); + +/* API setup for PolarSSL */ +#define curlssl_init() (1) +#define curlssl_cleanup() +#define curlssl_connect Curl_polarssl_connect +#define curlssl_session_free(x) Curl_polarssl_session_free(x) +#define curlssl_close_all Curl_polarssl_close_all +#define curlssl_close Curl_polarssl_close +#define curlssl_shutdown(x,y) 0 +#define curlssl_set_engine(x,y) (x=x, y=y, CURLE_FAILED_INIT) +#define curlssl_set_engine_default(x) (x=x, CURLE_FAILED_INIT) +#define curlssl_engines_list(x) (x=x, (struct curl_slist *)NULL) +#define curlssl_version Curl_polarssl_version +#define curlssl_check_cxn(x) (x=x, -1) +#define curlssl_data_pending(x,y) (x=x, y=y, 0) + +#endif /* USE_POLARSSL */ +#endif /* HEADER_CURL_POLARSSL_H */ @@ -311,10 +311,10 @@ static CURLcode pop3_state_user_resp(struct connectdata *conn, failf(data, "Access denied. %c", pop3code); result = CURLE_LOGIN_DENIED; } - - /* send PASS */ - result = Curl_pp_sendf(&conn->proto.pop3c.pp, "PASS %s", - pop3->passwd?pop3->passwd:""); + else + /* send PASS */ + result = Curl_pp_sendf(&conn->proto.pop3c.pp, "PASS %s", + pop3->passwd?pop3->passwd:""); if(result) return result; @@ -359,9 +359,8 @@ static CURLcode pop3_state_retr_resp(struct connectdata *conn, } /* POP3 download */ - result=Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, - pop3->bytecountp, - -1, NULL); /* no upload here */ + Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, + pop3->bytecountp, -1, NULL); /* no upload here */ if(pp->cache) { /* At this point there is a bunch of data in the header "cache" that is @@ -403,9 +402,8 @@ static CURLcode pop3_state_list_resp(struct connectdata *conn, } /* POP3 download */ - result=Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, - pop3->bytecountp, - -1, NULL); /* no upload here */ + Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, pop3->bytecountp, + -1, NULL); /* no upload here */ if(pp->cache) { /* cache holds the email ID listing */ @@ -830,7 +828,8 @@ static CURLcode pop3_disconnect(struct connectdata *conn) /* The POP3 session may or may not have been allocated/setup at this point! */ - (void)pop3_quit(conn); /* ignore errors on the LOGOUT */ + if(pop3c->pp.conn) + (void)pop3_quit(conn); /* ignore errors on the LOGOUT */ Curl_pp_disconnect(&pop3c->pp); @@ -851,10 +850,11 @@ static CURLcode pop3_parse_url_path(struct connectdata *conn) struct pop3_conn *pop3c = &conn->proto.pop3c; struct SessionHandle *data = conn->data; const char *path = data->state.path; - int len; /* url decode the path and use this mailbox */ - pop3c->mailbox = curl_easy_unescape(data, path, 0, &len); + pop3c->mailbox = curl_easy_unescape(data, path, 0, NULL); + if (!pop3c->mailbox) + return CURLE_OUT_OF_MEMORY; return CURLE_OK; } @@ -863,18 +863,17 @@ static CURLcode pop3_parse_url_path(struct connectdata *conn) static CURLcode pop3_dophase_done(struct connectdata *conn, bool connected) { - CURLcode result = CURLE_OK; struct FTP *pop3 = conn->data->state.proto.pop3; struct pop3_conn *pop3c = &conn->proto.pop3c; - (void)connected; + (void)connected; if(pop3->transfer != FTPTRANSFER_BODY) /* no data to transfer */ - result=Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL); + Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL); free(pop3c->mailbox); - return result; + return CURLE_OK; } /* called from multi.c while DOing */ @@ -242,6 +242,9 @@ static CURLcode Curl_qsossl_handshake(struct connectdata * conn, int sockindex) } +static Curl_recv qsossl_recv; +static Curl_send qsossl_send; + CURLcode Curl_qsossl_connect(struct connectdata * conn, int sockindex) { @@ -263,8 +266,11 @@ CURLcode Curl_qsossl_connect(struct connectdata * conn, int sockindex) connssl->state = ssl_connection_none; } } - if (rc == CURLE_OK) + if (rc == CURLE_OK) { connssl->state = ssl_connection_complete; + conn->recv[sockindex] = qsossl_recv; + conn->send[sockindex] = qsossl_send; + } return rc; } @@ -374,9 +380,8 @@ int Curl_qsossl_shutdown(struct connectdata * conn, int sockindex) } -/* for documentation see Curl_ssl_send() in sslgen.h */ -ssize_t Curl_qsossl_send(struct connectdata * conn, int sockindex, - const void * mem, size_t len, int * curlcode) +static ssize_t qsossl_send(struct connectdata * conn, int sockindex, + const void * mem, size_t len, CURLcode * curlcode) { /* SSL_Write() is said to return 'int' while write() and send() returns @@ -392,14 +397,14 @@ ssize_t Curl_qsossl_send(struct connectdata * conn, int sockindex, /* The operation did not complete; the same SSL I/O function should be called again later. This is basicly an EWOULDBLOCK equivalent. */ - *curlcode = -1; /* EWOULDBLOCK */ + *curlcode = CURLE_AGAIN; return -1; case SSL_ERROR_IO: switch (errno) { case EWOULDBLOCK: case EINTR: - *curlcode = -1; /* EWOULDBLOCK */ + *curlcode = CURLE_AGAIN; return -1; } @@ -419,9 +424,8 @@ ssize_t Curl_qsossl_send(struct connectdata * conn, int sockindex, } -/* for documentation see Curl_ssl_recv() in sslgen.h */ -ssize_t Curl_qsossl_recv(struct connectdata * conn, int num, char * buf, - size_t buffersize, int * curlcode) +static ssize_t qsossl_recv(struct connectdata * conn, int num, char * buf, + size_t buffersize, CURLcode * curlcode) { char error_buffer[120]; /* OpenSSL documents that this must be at @@ -440,13 +444,13 @@ ssize_t Curl_qsossl_recv(struct connectdata * conn, int num, char * buf, case SSL_ERROR_BAD_STATE: /* there's data pending, re-invoke SSL_Read(). */ - *curlcode = -1; /* EWOULDBLOCK */ + *curlcode = CURLE_AGAIN; return -1; case SSL_ERROR_IO: switch (errno) { case EWOULDBLOCK: - *curlcode = -1; /* EWOULDBLOCK */ + *curlcode = CURLE_AGAIN; return -1; } @@ -36,20 +36,6 @@ void Curl_qsossl_close(struct connectdata *conn, int sockindex); int Curl_qsossl_close_all(struct SessionHandle * data); int Curl_qsossl_shutdown(struct connectdata * conn, int sockindex); -/* for documentation see Curl_ssl_send() in sslgen.h */ -ssize_t Curl_qsossl_send(struct connectdata * conn, - int sockindex, - const void * mem, - size_t len, - int * curlcode); - -/* for documentation see Curl_ssl_recv() in sslgen.h */ -ssize_t Curl_qsossl_recv(struct connectdata * conn, /* connection data */ - int num, /* socketindex */ - char * buf, /* store read data here */ - size_t buffersize, /* max amount to read */ - int * curlcode); - size_t Curl_qsossl_version(char * buffer, size_t size); int Curl_qsossl_check_cxn(struct connectdata * cxn); @@ -66,8 +52,6 @@ int Curl_qsossl_check_cxn(struct connectdata * cxn); #define curlssl_set_engine(x,y) CURLE_FAILED_INIT #define curlssl_set_engine_default(x) CURLE_FAILED_INIT #define curlssl_engines_list(x) NULL -#define curlssl_send Curl_qsossl_send -#define curlssl_recv Curl_qsossl_recv #define curlssl_version Curl_qsossl_version #define curlssl_check_cxn(x) Curl_qsossl_check_cxn(x) #define curlssl_data_pending(x,y) 0 @@ -254,8 +254,8 @@ CURLcode Curl_rtsp(struct connectdata *conn, bool *done) } if(rtspreq == RTSPREQ_RECEIVE) { - result = Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE, - &http->readbytecount, -1, NULL); + Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE, + &http->readbytecount, -1, NULL); return result; } @@ -503,15 +503,9 @@ CURLcode Curl_rtsp(struct connectdata *conn, bool *done) return result; } - result = Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE, - &http->readbytecount, - putsize?FIRSTSOCKET:-1, - putsize?&http->writebytecount:NULL); - - if(result) { - failf(data, "Failed RTSP transfer"); - return result; - } + Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE, &http->readbytecount, + putsize?FIRSTSOCKET:-1, + putsize?&http->writebytecount:NULL); /* Increment the CSeq on success */ data->state.rtsp_next_client_CSeq++; @@ -715,7 +709,7 @@ CURLcode Curl_rtsp_parseheader(struct connectdata *conn, while(*start && ISSPACE(*start)) start++; - if(!start) { + if(!*start) { failf(data, "Got a blank Session ID"); } else if(data->set.str[STRING_RTSP_SESSION_ID]) { diff --git a/lib/security.c b/lib/security.c index 03fc6796..73a55401 100644 --- a/lib/security.c +++ b/lib/security.c @@ -10,7 +10,7 @@ * Copyright (c) 1998, 1999 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * - * Copyright (C) 2001 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 2001 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al. * * All rights reserved. * @@ -46,10 +46,7 @@ #ifndef CURL_DISABLE_FTP #if defined(HAVE_KRB4) || defined(HAVE_GSSAPI) -#define _MPRINTF_REPLACE /* we want curl-functions instead of native ones */ -#include <curl/mprintf.h> - -#include <stdlib.h> +#include <stdarg.h> #include <string.h> #ifdef HAVE_NETDB_H @@ -61,11 +58,11 @@ #endif #include "urldata.h" -#include "krb4.h" #include "curl_base64.h" -#include "sendf.h" -#include "ftp.h" #include "curl_memory.h" +#include "krb4.h" +#include "ftp.h" +#include "sendf.h" #include "rawstr.h" /* The last #include file should be: */ @@ -91,92 +88,142 @@ name_to_level(const char *name) return (enum protection_level)-1; } +/* Convert a protocol |level| to its char representation. + We take an int to catch programming mistakes. */ +static char level_to_char(int level) { + switch(level) { + case prot_clear: + return 'C'; + case prot_safe: + return 'S'; + case prot_confidential: + return 'E'; + case prot_private: + return 'P'; + case prot_cmd: + /* Fall through */ + default: + /* Those 2 cases should not be reached! */ + break; + } + DEBUGASSERT(0); + /* Default to the most secure alternative. */ + return 'P'; +} + static const struct Curl_sec_client_mech * const mechs[] = { -#ifdef HAVE_GSSAPI +#if defined(HAVE_GSSAPI) &Curl_krb5_client_mech, #endif -#ifdef HAVE_KRB4 +#if defined(HAVE_KRB4) &Curl_krb4_client_mech, #endif NULL }; -/* TODO: This function isn't actually used anywhere and should be removed */ -int -Curl_sec_getc(struct connectdata *conn, FILE *F) +/* Send an FTP command defined by |message| and the optional arguments. The + function returns the ftp_code. If an error occurs, -1 is returned. */ +static int ftp_send_command(struct connectdata *conn, const char *message, ...) { - if(conn->sec_complete && conn->data_prot) { - char c; - if(Curl_sec_read(conn, fileno(F), &c, 1) <= 0) - return EOF; - return c; + int ftp_code; + ssize_t nread; + va_list args; + char print_buffer[50]; + + va_start(args, message); + vsnprintf(print_buffer, sizeof(print_buffer), message, args); + va_end(args); + + if(Curl_ftpsendf(conn, print_buffer) != CURLE_OK) { + ftp_code = -1; + } + else { + if(Curl_GetFTPResponse(&nread, conn, &ftp_code) != CURLE_OK) + ftp_code = -1; } - else - return getc(F); + + (void)nread; /* Unused */ + return ftp_code; } -static int -block_read(int fd, void *buf, size_t len) +/* Read |len| from the socket |fd| and store it in |to|. Return a CURLcode + saying whether an error occured or CURLE_OK if |len| was read. */ +static CURLcode +socket_read(curl_socket_t fd, void *to, size_t len) { - unsigned char *p = buf; - int b; - while(len) { - b = read(fd, p, len); - if(b == 0) - return 0; - else if(b < 0 && (errno == EINTR || errno == EAGAIN)) - /* TODO: this will busy loop in the EAGAIN case */ - continue; - else if(b < 0) - return -1; - len -= b; - p += b; + char *to_p = to; + CURLcode code; + ssize_t nread; + + while(len > 0) { + code = Curl_read_plain(fd, to_p, len, &nread); + if(code == CURLE_OK) { + len -= nread; + to_p += nread; + } + else { + /* FIXME: We are doing a busy wait */ + if(code == CURLE_AGAIN) + continue; + return code; + } } - return p - (unsigned char*)buf; + return CURLE_OK; } -static int -block_write(int fd, const void *buf, size_t len) + +/* Write |len| bytes from the buffer |to| to the socket |fd|. Return a + CURLcode saying whether an error occured or CURLE_OK if |len| was + written. */ +static CURLcode +socket_write(struct connectdata *conn, curl_socket_t fd, const void *to, + size_t len) { - const unsigned char *p = buf; - int b; - while(len) { - b = write(fd, p, len); - if(b < 0 && (errno == EINTR || errno == EAGAIN)) - continue; - else if(b < 0) - return -1; - len -= b; - p += b; + const char *to_p = to; + CURLcode code; + ssize_t written; + + while(len > 0) { + code = Curl_write_plain(conn, fd, to_p, len, &written); + if(code == CURLE_OK) { + len -= written; + to_p += written; + } + else { + /* FIXME: We are doing a busy wait */ + if(code == CURLE_AGAIN) + continue; + return code; + } } - return p - (unsigned char*)buf; + return CURLE_OK; } -static int -sec_get_data(struct connectdata *conn, - int fd, struct krb4buffer *buf) +static CURLcode read_data(struct connectdata *conn, + curl_socket_t fd, + struct krb4buffer *buf) { int len; - int b; + void* tmp; + CURLcode ret; + + ret = socket_read(fd, &len, sizeof(len)); + if (ret != CURLE_OK) + return ret; - b = block_read(fd, &len, sizeof(len)); - if(b == 0) - return 0; - else if(b < 0) - return -1; len = ntohl(len); - /* TODO: This realloc will cause a memory leak in an out of memory - * condition */ - buf->data = realloc(buf->data, len); - b = buf->data ? block_read(fd, buf->data, len) : -1; - if(b == 0) - return 0; - else if(b < 0) - return -1; - buf->size = (conn->mech->decode)(conn->app_data, buf->data, len, - conn->data_prot, conn); + tmp = realloc(buf->data, len); + if (tmp == NULL) + return CURLE_OUT_OF_MEMORY; + + buf->data = tmp; + ret = socket_read(fd, buf->data, len); + if (ret != CURLE_OK) + return ret; + buf->size = conn->mech->decode(conn->app_data, buf->data, len, + conn->data_prot, conn); buf->index = 0; - return 0; + return CURLE_OK; } static size_t @@ -189,131 +236,109 @@ buffer_read(struct krb4buffer *buf, void *data, size_t len) return len; } -static size_t -buffer_write(struct krb4buffer *buf, void *data, size_t len) +/* Matches Curl_recv signature */ +static ssize_t sec_recv(struct connectdata *conn, int sockindex, + char *buffer, size_t len, CURLcode *err) { - if(buf->index + len > buf->size) { - void *tmp; - if(buf->data == NULL) - tmp = malloc(1024); - else - tmp = realloc(buf->data, buf->index + len); - if(tmp == NULL) - return -1; - buf->data = tmp; - buf->size = buf->index + len; - } - memcpy((char*)buf->data + buf->index, data, len); - buf->index += len; - return len; -} + size_t bytes_read; + size_t total_read = 0; + curl_socket_t fd = conn->sock[sockindex]; -int -Curl_sec_read(struct connectdata *conn, int fd, void *buffer, int length) -{ - size_t len; - int rx = 0; + *err = CURLE_OK; - if(conn->sec_complete == 0 || conn->data_prot == 0) - return read(fd, buffer, length); + /* Handle clear text response. */ + if(conn->sec_complete == 0 || conn->data_prot == prot_clear) + return read(fd, buffer, len); - if(conn->in_buffer.eof_flag){ + if(conn->in_buffer.eof_flag) { conn->in_buffer.eof_flag = 0; return 0; } - len = buffer_read(&conn->in_buffer, buffer, length); - length -= len; - rx += len; - buffer = (char*)buffer + len; + bytes_read = buffer_read(&conn->in_buffer, buffer, len); + len -= bytes_read; + total_read += bytes_read; + buffer += bytes_read; - while(length) { - if(sec_get_data(conn, fd, &conn->in_buffer) < 0) + while(len > 0) { + if(read_data(conn, fd, &conn->in_buffer) != CURLE_OK) return -1; if(conn->in_buffer.size == 0) { - if(rx) + if(bytes_read > 0) conn->in_buffer.eof_flag = 1; - return rx; + return bytes_read; } - len = buffer_read(&conn->in_buffer, buffer, length); - length -= len; - rx += len; - buffer = (char*)buffer + len; + bytes_read = buffer_read(&conn->in_buffer, buffer, len); + len -= bytes_read; + total_read += bytes_read; + buffer += bytes_read; } - return rx; + /* FIXME: Check for overflow */ + return total_read; } -static int -sec_send(struct connectdata *conn, int fd, const char *from, int length) +/* Send |length| bytes from |from| to the |fd| socket taking care of encoding + and negociating with the server. |from| can be NULL. */ +/* FIXME: We don't check for errors nor report any! */ +static void do_sec_send(struct connectdata *conn, curl_socket_t fd, + const char *from, int length) { - int bytes; - void *buf; - enum protection_level protlevel = conn->data_prot; - int iscmd = protlevel == prot_cmd; + size_t bytes; + size_t htonl_bytes; + char *buffer; + char *cmd_buffer; + enum protection_level prot_level = conn->data_prot; + bool iscmd = prot_level == prot_cmd; if(iscmd) { if(!strncmp(from, "PASS ", 5) || !strncmp(from, "ACCT ", 5)) - protlevel = prot_private; + prot_level = prot_private; else - protlevel = conn->command_prot; + prot_level = conn->command_prot; } - bytes = (conn->mech->encode)(conn->app_data, from, length, protlevel, - &buf, conn); + bytes = conn->mech->encode(conn->app_data, from, length, prot_level, + (void**)&buffer, conn); if(iscmd) { - char *cmdbuf; - - bytes = Curl_base64_encode(conn->data, (char *)buf, bytes, &cmdbuf); + bytes = Curl_base64_encode(conn->data, buffer, bytes, &cmd_buffer); if(bytes > 0) { - if(protlevel == prot_private) - block_write(fd, "ENC ", 4); + static const char *enc = "ENC "; + static const char *mic = "MIC "; + if(prot_level == prot_private) + socket_write(conn, fd, enc, 4); else - block_write(fd, "MIC ", 4); - block_write(fd, cmdbuf, bytes); - block_write(fd, "\r\n", 2); - Curl_infof(conn->data, "%s %s\n", - protlevel == prot_private ? "ENC" : "MIC", cmdbuf); - free(cmdbuf); + socket_write(conn, fd, mic, 4); + + socket_write(conn, fd, cmd_buffer, bytes); + socket_write(conn, fd, "\r\n", 2); + infof(conn->data, "Send: %s%s\n", prot_level == prot_private?enc:mic, + cmd_buffer); + free(cmd_buffer); } } else { - bytes = htonl(bytes); - block_write(fd, &bytes, sizeof(bytes)); - block_write(fd, buf, ntohl(bytes)); - } - free(buf); - return length; -} - -int -Curl_sec_fflush_fd(struct connectdata *conn, int fd) -{ - if(conn->data_prot != prot_clear) { - if(conn->out_buffer.index > 0){ - Curl_sec_write(conn, fd, - conn->out_buffer.data, conn->out_buffer.index); - conn->out_buffer.index = 0; - } - sec_send(conn, fd, NULL, 0); + htonl_bytes = htonl(bytes); + socket_write(conn, fd, &htonl_bytes, sizeof(htonl_bytes)); + socket_write(conn, fd, buffer, bytes); } - return 0; + free(buffer); } -int -Curl_sec_write(struct connectdata *conn, int fd, const char *buffer, int length) +static ssize_t sec_write(struct connectdata *conn, curl_socket_t fd, + const char *buffer, size_t length) { - int len = conn->buffer_size; + /* FIXME: Check for overflow */ + ssize_t len = conn->buffer_size; int tx = 0; - if(conn->data_prot == prot_clear) - return write(fd, buffer, length); - - len -= (conn->mech->overhead)(conn->app_data, conn->data_prot, len); + len -= conn->mech->overhead(conn->app_data, conn->data_prot, len); if(len <= 0) len = length; - while(length){ - if(length < len) + while(length) { + if(len >= 0 || length < (size_t)len) { + /* FIXME: Check for overflow. */ len = length; - sec_send(conn, fd, buffer, len); + } + do_sec_send(conn, fd, buffer, len); length -= len; buffer += len; tx += len; @@ -321,63 +346,57 @@ Curl_sec_write(struct connectdata *conn, int fd, const char *buffer, int length) return tx; } -ssize_t -Curl_sec_send(struct connectdata *conn, int num, const char *buffer, int length) -{ - curl_socket_t fd = conn->sock[num]; - return (ssize_t)Curl_sec_write(conn, fd, buffer, length); -} - -int -Curl_sec_putc(struct connectdata *conn, int c, FILE *F) +/* Matches Curl_send signature */ +static ssize_t sec_send(struct connectdata *conn, int sockindex, + const void *buffer, size_t len, CURLcode *err) { - char ch = (char)c; - if(conn->data_prot == prot_clear) - return putc(c, F); - - buffer_write(&conn->out_buffer, &ch, 1); - if(c == '\n' || conn->out_buffer.index >= 1024 /* XXX */) { - Curl_sec_write(conn, fileno(F), conn->out_buffer.data, - conn->out_buffer.index); - conn->out_buffer.index = 0; - } - return c; + curl_socket_t fd = conn->sock[sockindex]; + *err = CURLE_OK; + return sec_write(conn, fd, buffer, len); } -int -Curl_sec_read_msg(struct connectdata *conn, char *s, int level) +/* FIXME: |level| should not be an int but a struct protection_level */ +int Curl_sec_read_msg(struct connectdata *conn, char *buffer, int level) { - int len; - unsigned char *buf; - int code; - - len = Curl_base64_decode(s + 4, &buf); /* XXX */ - if(len > 0) - len = (conn->mech->decode)(conn->app_data, buf, len, level, conn); - else + /* decoded_len should be size_t or ssize_t but conn->mech->decode returns an + int */ + int decoded_len; + char *buf; + int ret_code; + + decoded_len = Curl_base64_decode(buffer + 4, (unsigned char **)&buf); + if(decoded_len <= 0) { + free(buf); return -1; + } - if(len < 0) { + decoded_len = conn->mech->decode(conn->app_data, buf, decoded_len, + level, conn); + if(decoded_len <= 0) { free(buf); return -1; } if(conn->data->set.verbose) { - buf[len] = '\n'; - Curl_debug(conn->data, CURLINFO_HEADER_IN, (char *)buf, len + 1, conn); + buf[decoded_len] = '\n'; + Curl_debug(conn->data, CURLINFO_HEADER_IN, buf, decoded_len + 1, conn); } - buf[len] = '\0'; - + buf[decoded_len] = '\0'; + DEBUGASSERT(decoded_len > 3); if(buf[3] == '-') - code = 0; - else - sscanf((char *)buf, "%d", &code); - if(buf[len-1] == '\n') - buf[len-1] = '\0'; - strcpy(s, (char *)buf); + ret_code = 0; + else { + /* Check for error? */ + sscanf(buf, "%d", &ret_code); + } + + if(buf[decoded_len - 1] == '\n') + buf[decoded_len - 1] = '\0'; + /* FIXME: Is |buffer| length always greater than |decoded_len|? */ + strcpy(buffer, buf); free(buf); - return code; + return ret_code; } enum protection_level @@ -388,64 +407,62 @@ Curl_set_command_prot(struct connectdata *conn, enum protection_level level) return old; } -static int -sec_prot_internal(struct connectdata *conn, int level) +/* FIXME: The error code returned here is never checked. */ +int Curl_sec_set_protection_level(struct connectdata *conn) { - char *p; - unsigned int s = 1048576; - ssize_t nread; + int code; + char* pbsz; + static unsigned int buffer_size = 1 << 20; /* 1048576 */ + enum protection_level level = conn->request_data_prot; - if(!conn->sec_complete){ - infof(conn->data, "No security data exchange has taken place.\n"); + if(!conn->sec_complete) { + infof(conn->data, "Trying to change the protection level after the" + "completion of the data exchange.\n"); return -1; } - if(level){ - int code; - if(Curl_ftpsendf(conn, "PBSZ %u", s)) - return -1; + /* Bail out if we try to set up the same level */ + if(conn->data_prot == level) + return 0; - if(Curl_GetFTPResponse(&nread, conn, &code)) + if(level) { + code = ftp_send_command(conn, "PBSZ %u", buffer_size); + if(code < 0) return -1; - if(code/100 != 2){ - failf(conn->data, "Failed to set protection buffer size."); + if(code/100 != 2) { + failf(conn->data, "Failed to set the protection's buffer size."); return -1; } - conn->buffer_size = s; - - p = strstr(conn->data->state.buffer, "PBSZ="); - if(p) - sscanf(p, "PBSZ=%u", &s); - if(s < conn->buffer_size) - conn->buffer_size = s; + conn->buffer_size = buffer_size; + + pbsz = strstr(conn->data->state.buffer, "PBSZ="); + if(pbsz) { + /* FIXME: Checks for errors in sscanf? */ + sscanf(pbsz, "PBSZ=%u", &buffer_size); + if(buffer_size < conn->buffer_size) + conn->buffer_size = buffer_size; + } } - if(Curl_ftpsendf(conn, "PROT %c", level["CSEP"])) - return -1; + /* Now try to negiociate the protection level. */ + code = ftp_send_command(conn, "PROT %c", level_to_char(level)); - if(Curl_GetFTPResponse(&nread, conn, NULL)) + if(code < 0) return -1; - if(conn->data->state.buffer[0] != '2'){ - failf(conn->data, "Failed to set protection level."); + if(code/100 != 2) { + failf(conn->data, "Failed to set the protection level."); return -1; } - conn->data_prot = (enum protection_level)level; + conn->data_prot = level; if(level == prot_private) - conn->command_prot = (enum protection_level)level; - return 0; -} + conn->command_prot = level; -void -Curl_sec_set_protection_level(struct connectdata *conn) -{ - if(conn->sec_complete && conn->data_prot != conn->request_data_prot) - sec_prot_internal(conn, conn->request_data_prot); + return 0; } - int Curl_sec_request_prot(struct connectdata *conn, const char *level) { @@ -456,67 +473,81 @@ Curl_sec_request_prot(struct connectdata *conn, const char *level) return 0; } -int -Curl_sec_login(struct connectdata *conn) +static CURLcode choose_mech(struct connectdata *conn) { int ret; - const struct Curl_sec_client_mech * const *m; - ssize_t nread; - struct SessionHandle *data=conn->data; - int ftpcode; - - for(m = mechs; *m && (*m)->name; m++) { - void *tmp; - - tmp = realloc(conn->app_data, (*m)->size); - if(tmp == NULL) { - failf (data, "realloc %u failed", (*m)->size); - return -1; - } - conn->app_data = tmp; - - if((*m)->init && (*(*m)->init)(conn->app_data) != 0) { - infof(data, "Skipping %s...\n", (*m)->name); + struct SessionHandle *data = conn->data; + const struct Curl_sec_client_mech * const *mech; + void *tmp_allocation; + const char *mech_name; + + for(mech = mechs; (*mech); ++mech) { + mech_name = (*mech)->name; + /* We have no mechanism with a NULL name but keep this check */ + DEBUGASSERT(mech_name != NULL); + if(mech_name == NULL) { + infof(data, "Skipping mechanism with empty name (%p)\n", mech); continue; } - infof(data, "Trying %s...\n", (*m)->name); + tmp_allocation = realloc(conn->app_data, (*mech)->size); + if(tmp_allocation == NULL) { + failf(data, "Failed realloc of size %u", (*mech)->size); + mech = NULL; + return CURLE_OUT_OF_MEMORY; + } + conn->app_data = tmp_allocation; - if(Curl_ftpsendf(conn, "AUTH %s", (*m)->name)) - return -1; + if((*mech)->init) { + ret = (*mech)->init(conn); + if(ret != 0) { + infof(data, "Failed initialization for %s. Skipping it.\n", mech_name); + continue; + } + } - if(Curl_GetFTPResponse(&nread, conn, &ftpcode)) - return -1; + infof(data, "Trying mechanism %s...\n", mech_name); + ret = ftp_send_command(conn, "AUTH %s", mech_name); + if(ret < 0) + /* FIXME: This error is too generic but it is OK for now. */ + return CURLE_COULDNT_CONNECT; - if(conn->data->state.buffer[0] != '3'){ - switch(ftpcode) { + if(ret/100 != 3) { + switch(ret) { case 504: - infof(data, - "%s is not supported by the server.\n", (*m)->name); + infof(data, "Mechanism %s is not supported by the server (server " + "returned ftp code: 504).\n", mech_name); break; case 534: - infof(data, "%s rejected as security mechanism.\n", (*m)->name); + infof(data, "Mechanism %s was rejected by the server (server returned " + "ftp code: 534).\n", mech_name); break; default: - if(conn->data->state.buffer[0] == '5') { - infof(data, "The server doesn't support the FTP " - "security extensions.\n"); - return -1; + if(ret/100 == 5) { + infof(data, "The server does not support the security extensions.\n"); + return CURLE_USE_SSL_FAILED; } break; } continue; } - ret = (*(*m)->auth)(conn->app_data, conn); + /* Authenticate */ + ret = (*mech)->auth(conn->app_data, conn); if(ret == AUTH_CONTINUE) continue; - else if(ret != AUTH_OK){ - /* mechanism is supposed to output error string */ + else if(ret != AUTH_OK) { + /* Mechanism has dumped the error to stderr, don't error here. */ return -1; } - conn->mech = *m; + DEBUGASSERT(ret == AUTH_OK); + + conn->mech = *mech; conn->sec_complete = 1; + conn->recv[FIRSTSOCKET] = sec_recv; + conn->send[FIRSTSOCKET] = sec_send; + conn->recv[SECONDARYSOCKET] = sec_recv; + conn->send[SECONDARYSOCKET] = sec_send; conn->command_prot = prot_safe; /* Set the requested protection level */ /* BLOCKING */ @@ -524,23 +555,38 @@ Curl_sec_login(struct connectdata *conn) break; } - return *m == NULL; + return mech != NULL ? CURLE_OK : CURLE_FAILED_INIT; } +CURLcode +Curl_sec_login(struct connectdata *conn) +{ + return choose_mech(conn); +} + + void Curl_sec_end(struct connectdata *conn) { - if(conn->mech != NULL) { - if(conn->mech->end) - (conn->mech->end)(conn->app_data); - memset(conn->app_data, 0, conn->mech->size); + if(conn->mech != NULL && conn->mech->end) + conn->mech->end(conn->app_data); + if(conn->app_data) { free(conn->app_data); conn->app_data = NULL; } + if(conn->in_buffer.data) { + free(conn->in_buffer.data); + conn->in_buffer.data = NULL; + conn->in_buffer.size = 0; + conn->in_buffer.index = 0; + /* FIXME: Is this really needed? */ + conn->in_buffer.eof_flag = 0; + } conn->sec_complete = 0; conn->data_prot = (enum protection_level)0; - conn->mech=NULL; + conn->mech = NULL; } -#endif /* HAVE_KRB4 */ +#endif /* HAVE_KRB4 || HAVE_GSSAPI */ + #endif /* CURL_DISABLE_FTP */ diff --git a/lib/sendf.c b/lib/sendf.c index ff4aee30..b73c2243 100644 --- a/lib/sendf.c +++ b/lib/sendf.c @@ -234,42 +234,11 @@ CURLcode Curl_sendf(curl_socket_t sockfd, struct connectdata *conn, return res; } -static ssize_t send_plain(struct connectdata *conn, - int num, - const void *mem, - size_t len) -{ - curl_socket_t sockfd = conn->sock[num]; - ssize_t bytes_written = swrite(sockfd, mem, len); - - if(-1 == bytes_written) { - int err = SOCKERRNO; - - if( -#ifdef WSAEWOULDBLOCK - /* This is how Windows does it */ - (WSAEWOULDBLOCK == err) -#else - /* errno may be EWOULDBLOCK or on some systems EAGAIN when it returned - due to its inability to send off data without blocking. We therefor - treat both error codes the same here */ - (EWOULDBLOCK == err) || (EAGAIN == err) || (EINTR == err) -#endif - ) - /* this is just a case of EWOULDBLOCK */ - bytes_written=0; - else - failf(conn->data, "Send failure: %s", - Curl_strerror(conn, err)); - } - return bytes_written; -} - /* * Curl_write() is an internal write function that sends data to the * server. Works with plain sockets, SCP, SSL or kerberos. * - * If the write would block (EWOULDBLOCK), we return CURLE_OK and + * If the write would block (CURLE_AGAIN), we return CURLE_OK and * (*written == 0). Otherwise we return regular CURLcode value. */ CURLcode Curl_write(struct connectdata *conn, @@ -279,29 +248,20 @@ CURLcode Curl_write(struct connectdata *conn, ssize_t *written) { ssize_t bytes_written; - int curlcode = CURLE_OK; + CURLcode curlcode = CURLE_OK; int num = (sockfd == conn->sock[SECONDARYSOCKET]); - if(conn->ssl[num].state == ssl_connection_complete) - bytes_written = Curl_ssl_send(conn, num, mem, len, &curlcode); - else if(Curl_ssh_enabled(conn, PROT_SCP)) - bytes_written = Curl_scp_send(conn, num, mem, len); - else if(Curl_ssh_enabled(conn, PROT_SFTP)) - bytes_written = Curl_sftp_send(conn, num, mem, len); - else if(conn->sec_complete) - bytes_written = Curl_sec_send(conn, num, mem, len); - else - bytes_written = send_plain(conn, num, mem, len); + bytes_written = conn->send[num](conn, num, mem, len, &curlcode); *written = bytes_written; - if(-1 != bytes_written) - /* we completely ignore the curlcode value when -1 is not returned */ + if(bytes_written >= 0) + /* we completely ignore the curlcode value when subzero is not returned */ return CURLE_OK; - /* handle EWOULDBLOCK or a send failure */ + /* handle CURLE_AGAIN or a send failure */ switch(curlcode) { - case /* EWOULDBLOCK */ -1: - *written = /* EWOULDBLOCK */ 0; + case CURLE_AGAIN: + *written = 0; return CURLE_OK; case CURLE_OK: @@ -314,6 +274,39 @@ CURLcode Curl_write(struct connectdata *conn, } } +ssize_t Curl_send_plain(struct connectdata *conn, int num, + const void *mem, size_t len, CURLcode *code) +{ + curl_socket_t sockfd = conn->sock[num]; + ssize_t bytes_written = swrite(sockfd, mem, len); + + *code = CURLE_OK; + if(-1 == bytes_written) { + int err = SOCKERRNO; + + if( +#ifdef WSAEWOULDBLOCK + /* This is how Windows does it */ + (WSAEWOULDBLOCK == err) +#else + /* errno may be EWOULDBLOCK or on some systems EAGAIN when it returned + due to its inability to send off data without blocking. We therefor + treat both error codes the same here */ + (EWOULDBLOCK == err) || (EAGAIN == err) || (EINTR == err) +#endif + ) { + /* this is just a case of EWOULDBLOCK */ + bytes_written=0; + *code = CURLE_AGAIN; + } else { + failf(conn->data, "Send failure: %s", + Curl_strerror(conn, err)); + *code = CURLE_SEND_ERROR; + } + } + return bytes_written; +} + /* * Curl_write_plain() is an internal write function that sends data to the * server using plain sockets only. Otherwise meant to have the exact same @@ -329,14 +322,45 @@ CURLcode Curl_write_plain(struct connectdata *conn, CURLcode retcode; int num = (sockfd == conn->sock[SECONDARYSOCKET]); - bytes_written = send_plain(conn, num, mem, len); + bytes_written = Curl_send_plain(conn, num, mem, len, &retcode); *written = bytes_written; - retcode = (-1 != bytes_written)?CURLE_OK:CURLE_SEND_ERROR; return retcode; } +ssize_t Curl_recv_plain(struct connectdata *conn, int num, char *buf, + size_t len, CURLcode *code) +{ + curl_socket_t sockfd = conn->sock[num]; + ssize_t nread = sread(sockfd, buf, len); + + *code = CURLE_OK; + if(-1 == nread) { + int err = SOCKERRNO; + + if( +#ifdef WSAEWOULDBLOCK + /* This is how Windows does it */ + (WSAEWOULDBLOCK == err) +#else + /* errno may be EWOULDBLOCK or on some systems EAGAIN when it returned + due to its inability to send off data without blocking. We therefor + treat both error codes the same here */ + (EWOULDBLOCK == err) || (EAGAIN == err) || (EINTR == err) +#endif + ) { + /* this is just a case of EWOULDBLOCK */ + *code = CURLE_AGAIN; + } else { + failf(conn->data, "Recv failure: %s", + Curl_strerror(conn, err)); + *code = CURLE_RECV_ERROR; + } + } + return nread; +} + static CURLcode pausewrite(struct SessionHandle *data, int type, /* what type of data */ const char *ptr, @@ -476,7 +500,7 @@ CURLcode Curl_client_write(struct connectdata *conn, return CURLE_OK; } -int Curl_read_plain(curl_socket_t sockfd, +CURLcode Curl_read_plain(curl_socket_t sockfd, char *buf, size_t bytesfromsocket, ssize_t *n) @@ -490,7 +514,7 @@ int Curl_read_plain(curl_socket_t sockfd, #else if((EWOULDBLOCK == err) || (EAGAIN == err) || (EINTR == err)) #endif - return -1; + return CURLE_AGAIN; else return CURLE_RECV_ERROR; } @@ -504,15 +528,15 @@ int Curl_read_plain(curl_socket_t sockfd, * Internal read-from-socket function. This is meant to deal with plain * sockets, SSL sockets and kerberos sockets. * - * If the read would block (EWOULDBLOCK) we return -1. Otherwise we return - * a regular CURLcode value. + * Returns a regular CURLcode value. */ -int Curl_read(struct connectdata *conn, /* connection data */ +CURLcode Curl_read(struct connectdata *conn, /* connection data */ curl_socket_t sockfd, /* read from this socket */ char *buf, /* store read data here */ size_t sizerequested, /* max amount to read */ ssize_t *n) /* amount bytes read */ { + CURLcode curlcode = CURLE_RECV_ERROR; ssize_t nread = 0; size_t bytesfromsocket = 0; char *buffertofill = NULL; @@ -552,50 +576,17 @@ int Curl_read(struct connectdata *conn, /* connection data */ buffertofill = buf; } - if(conn->ssl[num].state == ssl_connection_complete) { - int curlcode = CURLE_RECV_ERROR; - nread = Curl_ssl_recv(conn, num, buffertofill, bytesfromsocket, &curlcode); + nread = conn->recv[num](conn, num, buffertofill, bytesfromsocket, &curlcode); + if(nread < 0) + return curlcode; - if(nread == -1) - return curlcode; - } - else if(Curl_ssh_enabled(conn, (PROT_SCP|PROT_SFTP))) { - if(conn->protocol & PROT_SCP) - nread = Curl_scp_recv(conn, num, buffertofill, bytesfromsocket); - else if(conn->protocol & PROT_SFTP) - nread = Curl_sftp_recv(conn, num, buffertofill, bytesfromsocket); -#ifdef LIBSSH2CHANNEL_EAGAIN - if(nread == LIBSSH2CHANNEL_EAGAIN) - /* EWOULDBLOCK */ - return -1; -#endif - if(nread < 0) - /* since it is negative and not EAGAIN, it was a protocol-layer error */ - return CURLE_RECV_ERROR; - } - else { - if(conn->sec_complete) - nread = Curl_sec_read(conn, sockfd, buffertofill, - bytesfromsocket); - /* TODO: Need to handle EAGAIN here somehow, similar to how it - * is done in Curl_read_plain, either right here or in Curl_sec_read - * itself. */ - else { - int ret = Curl_read_plain(sockfd, buffertofill, bytesfromsocket, - &nread); - if(ret) - return ret; - } + if(pipelining) { + memcpy(buf, conn->master_buffer, nread); + conn->buf_len = nread; + conn->read_pos = nread; } - if(nread >= 0) { - if(pipelining) { - memcpy(buf, conn->master_buffer, nread); - conn->buf_len = nread; - conn->read_pos = nread; - } - *n += nread; - } + *n += nread; return CURLE_OK; } diff --git a/lib/sendf.h b/lib/sendf.h index 5732a0ba..8f0ea24d 100644 --- a/lib/sendf.h +++ b/lib/sendf.h @@ -55,15 +55,20 @@ CURLcode Curl_client_write(struct connectdata *conn, int type, char *ptr, size_t len); /* internal read-function, does plain socket only */ -int Curl_read_plain(curl_socket_t sockfd, - char *buf, - size_t bytesfromsocket, - ssize_t *n); +CURLcode Curl_read_plain(curl_socket_t sockfd, + char *buf, + size_t bytesfromsocket, + ssize_t *n); + +ssize_t Curl_recv_plain(struct connectdata *conn, int num, char *buf, + size_t len, CURLcode *code); +ssize_t Curl_send_plain(struct connectdata *conn, int num, + const void *mem, size_t len, CURLcode *code); /* internal read-function, does plain socket, SSL and krb4 */ -int Curl_read(struct connectdata *conn, curl_socket_t sockfd, - char *buf, size_t buffersize, - ssize_t *n); +CURLcode Curl_read(struct connectdata *conn, curl_socket_t sockfd, + char *buf, size_t buffersize, + ssize_t *n); /* internal write-function, does plain socket, SSL, SCP, SFTP and krb4 */ CURLcode Curl_write(struct connectdata *conn, curl_socket_t sockfd, diff --git a/lib/setup.h b/lib/setup.h index ca98ad7e..cc016c9c 100644 --- a/lib/setup.h +++ b/lib/setup.h @@ -356,6 +356,18 @@ # endif #endif +/* + * Arg 2 type for gethostname in case it hasn't been defined in config file. + */ + +#ifndef GETHOSTNAME_TYPE_ARG2 +# ifdef USE_WINSOCK +# define GETHOSTNAME_TYPE_ARG2 int +# else +# define GETHOSTNAME_TYPE_ARG2 size_t +# endif +#endif + /* Below we define some functions. They should 4. set the SIGALRM signal timeout @@ -497,7 +509,7 @@ #if defined(_MSC_VER) && !defined(__POCC__) # if !defined(HAVE_WINDOWS_H) || ((_MSC_VER < 1300) && !defined(_FILETIME_)) # if !defined(ALLOW_MSVC6_WITHOUT_PSDK) -# error MSVC 6.0 requires 'February 2003 Platform SDK' a.k.a. 'Windows Server 2003 PSDK' +# error MSVC 6.0 requires "February 2003 Platform SDK" a.k.a. "Windows Server 2003 PSDK" # else # define CURL_DISABLE_LDAP 1 # endif @@ -525,12 +537,12 @@ int netware_init(void); #define LIBIDN_REQUIRED_VERSION "0.4.1" -#if defined(USE_GNUTLS) || defined(USE_SSLEAY) || defined(USE_NSS) || defined(USE_QSOSSL) +#if defined(USE_GNUTLS) || defined(USE_SSLEAY) || defined(USE_NSS) || defined(USE_QSOSSL) || defined(USE_POLARSSL) #define USE_SSL /* SSL support has been enabled */ #endif #if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_NTLM) -#if defined(USE_SSLEAY) || defined(USE_WINDOWS_SSPI) || defined(USE_GNUTLS) +#if defined(USE_SSLEAY) || defined(USE_WINDOWS_SSPI) || defined(USE_GNUTLS) || defined(USE_NSS) #define USE_NTLM #endif #endif @@ -540,6 +552,11 @@ int netware_init(void); #define CURL_CA_BUNDLE getenv("CURL_CA_BUNDLE") #endif +/* Define S_ISREG if not defined by system headers, f.e. MSVC */ +#if !defined(S_ISREG) && defined(S_IFMT) && defined(S_IFREG) +#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) +#endif + /* * Include macros and defines that should only be processed once. */ diff --git a/lib/setup_once.h b/lib/setup_once.h index 473eef2b..85e78e8d 100644 --- a/lib/setup_once.h +++ b/lib/setup_once.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -261,24 +261,42 @@ struct timeval { /* - * Typedef to 'unsigned char' if bool is not an available 'typedefed' type. + * 'bool' exists on platforms with <stdbool.h>, i.e. C99 platforms. + * On non-C99 platforms there's no bool, so define an enum for that. + * On C99 platforms 'false' and 'true' also exist. Enum uses a + * global namespace though, so use bool_false and bool_true. */ #ifndef HAVE_BOOL_T -typedef unsigned char bool; -#define HAVE_BOOL_T + typedef enum { + bool_false = 0, + bool_true = 1 + } bool; + +/* + * Use a define to let 'true' and 'false' use those enums. There + * are currently no use of true and false in libcurl proper, but + * there are some in the examples. This will cater for any later + * code happening to use true and false. + */ +# define false bool_false +# define true bool_true +# define HAVE_BOOL_T #endif /* - * Default definition of uppercase TRUE and FALSE. + * Redefine TRUE and FALSE too, to catch current use. With this + * change, 'bool found = 1' will give a warning on MIPSPro, but + * 'bool found = TRUE' will not. Change tested on IRIX/MIPSPro, + * AIX 5.1/Xlc, Tru64 5.1/cc, w/make test too. */ #ifndef TRUE -#define TRUE 1 +#define TRUE true #endif #ifndef FALSE -#define FALSE 0 +#define FALSE false #endif @@ -373,38 +391,63 @@ typedef int sig_atomic_t; #define EINTR WSAEINTR #undef EINVAL /* override definition in errno.h */ #define EINVAL WSAEINVAL +#undef EWOULDBLOCK /* override definition in errno.h */ #define EWOULDBLOCK WSAEWOULDBLOCK +#undef EINPROGRESS /* override definition in errno.h */ #define EINPROGRESS WSAEINPROGRESS +#undef EALREADY /* override definition in errno.h */ #define EALREADY WSAEALREADY +#undef ENOTSOCK /* override definition in errno.h */ #define ENOTSOCK WSAENOTSOCK +#undef EDESTADDRREQ /* override definition in errno.h */ #define EDESTADDRREQ WSAEDESTADDRREQ +#undef EMSGSIZE /* override definition in errno.h */ #define EMSGSIZE WSAEMSGSIZE +#undef EPROTOTYPE /* override definition in errno.h */ #define EPROTOTYPE WSAEPROTOTYPE +#undef ENOPROTOOPT /* override definition in errno.h */ #define ENOPROTOOPT WSAENOPROTOOPT +#undef EPROTONOSUPPORT /* override definition in errno.h */ #define EPROTONOSUPPORT WSAEPROTONOSUPPORT #define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT +#undef EOPNOTSUPP /* override definition in errno.h */ #define EOPNOTSUPP WSAEOPNOTSUPP #define EPFNOSUPPORT WSAEPFNOSUPPORT +#undef EAFNOSUPPORT /* override definition in errno.h */ #define EAFNOSUPPORT WSAEAFNOSUPPORT +#undef EADDRINUSE /* override definition in errno.h */ #define EADDRINUSE WSAEADDRINUSE +#undef EADDRNOTAVAIL /* override definition in errno.h */ #define EADDRNOTAVAIL WSAEADDRNOTAVAIL +#undef ENETDOWN /* override definition in errno.h */ #define ENETDOWN WSAENETDOWN +#undef ENETUNREACH /* override definition in errno.h */ #define ENETUNREACH WSAENETUNREACH +#undef ENETRESET /* override definition in errno.h */ #define ENETRESET WSAENETRESET +#undef ECONNABORTED /* override definition in errno.h */ #define ECONNABORTED WSAECONNABORTED +#undef ECONNRESET /* override definition in errno.h */ #define ECONNRESET WSAECONNRESET +#undef ENOBUFS /* override definition in errno.h */ #define ENOBUFS WSAENOBUFS +#undef EISCONN /* override definition in errno.h */ #define EISCONN WSAEISCONN +#undef ENOTCONN /* override definition in errno.h */ #define ENOTCONN WSAENOTCONN #define ESHUTDOWN WSAESHUTDOWN #define ETOOMANYREFS WSAETOOMANYREFS +#undef ETIMEDOUT /* override definition in errno.h */ #define ETIMEDOUT WSAETIMEDOUT +#undef ECONNREFUSED /* override definition in errno.h */ #define ECONNREFUSED WSAECONNREFUSED +#undef ELOOP /* override definition in errno.h */ #define ELOOP WSAELOOP #ifndef ENAMETOOLONG /* possible previous definition in errno.h */ #define ENAMETOOLONG WSAENAMETOOLONG #endif #define EHOSTDOWN WSAEHOSTDOWN +#undef EHOSTUNREACH /* override definition in errno.h */ #define EHOSTUNREACH WSAEHOSTUNREACH #ifndef ENOTEMPTY /* possible previous definition in errno.h */ #define ENOTEMPTY WSAENOTEMPTY @@ -20,6 +20,9 @@ * * RFC2821 SMTP protocol * RFC3207 SMTP over TLS + * RFC4954 SMTP Authentication + * RFC2195 CRAM-MD5 authentication + * RFC4616 PLAIN authentication * ***************************************************************************/ @@ -85,6 +88,10 @@ #include "url.h" #include "rawstr.h" #include "strtoofft.h" +#include "curl_base64.h" +#include "curl_md5.h" +#include "curl_hmac.h" +#include "curl_gethostname.h" #define _MPRINTF_REPLACE /* use our functions only */ #include <curl/mprintf.h> @@ -202,26 +209,74 @@ static const struct Curl_handler Curl_handler_smtps_proxy = { #endif -/* fucntion that checks for an ending smtp status code at the start of the - given string */ +/* Function that checks for an ending smtp status code at the start of the + given string. + As a side effect, it also flags allowed authentication mechanisms according + to EHLO AUTH response. */ static int smtp_endofresp(struct pingpong *pp, int *resp) { char *line = pp->linestart_resp; size_t len = pp->nread_resp; + struct connectdata *conn = pp->conn; + struct smtp_conn *smtpc = &conn->proto.smtpc; + int result; + size_t wordlen; + + if(len < 4 || !ISDIGIT(line[0]) || !ISDIGIT(line[1]) || !ISDIGIT(line[2])) + return FALSE; /* Nothing for us. */ + + if((result = line[3] == ' ')) + *resp = atoi(line); + + line += 4; + len -= 4; + + if(smtpc->state == SMTP_EHLO && len >= 5 && !memcmp(line, "AUTH ", 5)) { + line += 5; + len -= 5; + + for (;;) { + while (len && + (*line == ' ' || *line == '\t' || + *line == '\r' || *line == '\n')) { + line++; + len--; + } - if( (len >= 4) && (' ' == line[3]) && - ISDIGIT(line[0]) && ISDIGIT(line[1]) && ISDIGIT(line[2])) { - *resp=atoi(line); - return TRUE; + if(!len) + break; + + for (wordlen = 0; wordlen < len && line[wordlen] != ' ' && + line[wordlen] != '\t' && line[wordlen] != '\r' && + line[wordlen] != '\n';) + wordlen++; + + if(wordlen == 5 && !memcmp(line, "LOGIN", 5)) + smtpc->authmechs |= SMTP_AUTH_LOGIN; + else if(wordlen == 5 && !memcmp(line, "PLAIN", 5)) + smtpc->authmechs |= SMTP_AUTH_PLAIN; + else if(wordlen == 8 && !memcmp(line, "CRAM-MD5", 8)) + smtpc->authmechs |= SMTP_AUTH_CRAM_MD5; + else if(wordlen == 10 && !memcmp(line, "DIGEST-MD5", 10)) + smtpc->authmechs |= SMTP_AUTH_DIGEST_MD5; + else if(wordlen == 6 && !memcmp(line, "GSSAPI", 6)) + smtpc->authmechs |= SMTP_AUTH_GSSAPI; + else if(wordlen == 8 && !memcmp(line, "EXTERNAL", 8)) + smtpc->authmechs |= SMTP_AUTH_EXTERNAL; + + line += wordlen; + len -= wordlen; + } } - return FALSE; /* nothing for us */ + return result; } /* This is the ONLY way to change SMTP state! */ static void state(struct connectdata *conn, smtpstate newstate) { + struct smtp_conn *smtpc = &conn->proto.smtpc; #if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) /* for debug purposes */ static const char * const names[]={ @@ -230,6 +285,11 @@ static void state(struct connectdata *conn, "EHLO", "HELO", "STARTTLS", + "AUTHPLAIN", + "AUTHLOGIN", + "AUTHPASSWD", + "AUTHCRAM", + "AUTH", "MAIL", "RCPT", "DATA", @@ -237,9 +297,6 @@ static void state(struct connectdata *conn, "QUIT", /* LAST */ }; -#endif - struct smtp_conn *smtpc = &conn->proto.smtpc; -#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) if(smtpc->state != newstate) infof(conn->data, "SMTP %p state change from %s to %s\n", smtpc, names[smtpc->state], names[newstate]); @@ -252,8 +309,10 @@ static CURLcode smtp_state_ehlo(struct connectdata *conn) CURLcode result; struct smtp_conn *smtpc = &conn->proto.smtpc; + smtpc->authmechs = 0; /* No known authentication mechanisms yet. */ + /* send EHLO */ - result = Curl_pp_sendf(&conn->proto.smtpc.pp, "EHLO %s", smtpc->domain); + result = Curl_pp_sendf(&smtpc->pp, "EHLO %s", smtpc->domain); if(result) return result; @@ -268,7 +327,7 @@ static CURLcode smtp_state_helo(struct connectdata *conn) struct smtp_conn *smtpc = &conn->proto.smtpc; /* send HELO */ - result = Curl_pp_sendf(&conn->proto.smtpc.pp, "HELO %s", smtpc->domain); + result = Curl_pp_sendf(&smtpc->pp, "HELO %s", smtpc->domain); if(result) return result; @@ -277,6 +336,111 @@ static CURLcode smtp_state_helo(struct connectdata *conn) return CURLE_OK; } +static size_t smtp_auth_plain_data(struct connectdata * conn, char * * outptr) +{ + char plainauth[2 * MAX_CURL_USER_LENGTH + MAX_CURL_PASSWORD_LENGTH]; + size_t ulen; + size_t plen; + + ulen = strlen(conn->user); + plen = strlen(conn->passwd); + + if(2 * ulen + plen + 2 > sizeof plainauth) + return 0; + + memcpy(plainauth, conn->user, ulen); + plainauth[ulen] = '\0'; + memcpy(plainauth + ulen + 1, conn->user, ulen); + plainauth[2 * ulen + 1] = '\0'; + memcpy(plainauth + 2 * ulen + 2, conn->passwd, plen); + return Curl_base64_encode(conn->data, plainauth, 2 * ulen + plen + 2, outptr); +} + +static size_t smtp_auth_login_user(struct connectdata * conn, char * * outptr) +{ + size_t ulen; + + ulen = strlen(conn->user); + + if(!ulen) { + *outptr = strdup("="); + return *outptr? 1: 0; + } + + return Curl_base64_encode(conn->data, conn->user, ulen, outptr); +} + +static CURLcode smtp_authenticate(struct connectdata *conn) +{ + CURLcode result = CURLE_OK; + struct smtp_conn *smtpc = &conn->proto.smtpc; + char * initresp; + const char * mech; + size_t l; + smtpstate state1; + smtpstate state2; + + if(!conn->bits.user_passwd) + state(conn, SMTP_STOP); /* End of connect phase. */ + else { + initresp = (char *) NULL; + l = 1; + + /* Check supported authentication mechanisms by decreasing order of + preference. */ + mech = (const char *) NULL; /* Avoid compiler warnings. */ + state1 = SMTP_STOP; + state2 = SMTP_STOP; + +#ifndef CURL_DISABLE_CRYPTO_AUTH + if(smtpc->authmechs & SMTP_AUTH_CRAM_MD5) { + mech = "CRAM-MD5"; + state1 = SMTP_AUTHCRAM; + } + else +#endif + if(smtpc->authmechs & SMTP_AUTH_PLAIN) { + mech = "PLAIN"; + state1 = SMTP_AUTHPLAIN; + state2 = SMTP_AUTH; + l = smtp_auth_plain_data(conn, &initresp); + } + else if(smtpc->authmechs & SMTP_AUTH_LOGIN) { + mech = "LOGIN"; + state1 = SMTP_AUTHLOGIN; + state2 = SMTP_AUTHPASSWD; + l = smtp_auth_login_user(conn, &initresp); + } + else { + infof(conn->data, "No known auth mechanisms supported!\n"); + result = CURLE_LOGIN_DENIED; /* Other mechanisms not supported. */ + } + + if(!result) { + if(!l) + result = CURLE_OUT_OF_MEMORY; + else if(initresp && + l + strlen(mech) <= 512 - 8) { /* AUTH <mech> ...<crlf> */ + result = Curl_pp_sendf(&smtpc->pp, "AUTH %s %s", mech, initresp); + free(initresp); + + if(!result) + state(conn, state2); + } + else { + Curl_safefree(initresp); + + result = Curl_pp_sendf(&smtpc->pp, "AUTH %s", mech); + + if(!result) + state(conn, state1); + } + } + } + + return result; +} + /* For the SMTP "protocol connect" and "doing" phases only */ static int smtp_getsock(struct connectdata *conn, curl_socket_t *socks, @@ -295,12 +459,12 @@ static CURLcode smtp_state_starttls_resp(struct connectdata *conn, (void)instate; /* no use for this yet */ if(smtpcode != 220) { - if(data->set.ftp_ssl == CURLUSESSL_TRY) - state(conn, SMTP_STOP); - else { + if(data->set.ftp_ssl != CURLUSESSL_TRY) { failf(data, "STARTTLS denied. %c", smtpcode); result = CURLE_LOGIN_DENIED; } + else + result = smtp_authenticate(conn); } else { /* Curl_ssl_connect is BLOCKING */ @@ -324,23 +488,23 @@ static CURLcode smtp_state_ehlo_resp(struct connectdata *conn, (void)instate; /* no use for this yet */ if(smtpcode/100 != 2) { - if(data->set.ftp_ssl <= CURLUSESSL_TRY) + if((data->set.ftp_ssl <= CURLUSESSL_TRY || conn->ssl[FIRSTSOCKET].use) && + !conn->bits.user_passwd) result = smtp_state_helo(conn); else { failf(data, "Access denied: %d", smtpcode); result = CURLE_LOGIN_DENIED; } - } + } else if(data->set.ftp_ssl && !conn->ssl[FIRSTSOCKET].use) { /* We don't have a SSL/TLS connection yet, but SSL is requested. Switch to TLS connection now */ - result = Curl_pp_sendf(&conn->proto.smtpc.pp, "STARTTLS", NULL); + result = Curl_pp_sendf(&conn->proto.smtpc.pp, "STARTTLS"); state(conn, SMTP_STARTTLS); } - else { - /* end the connect phase */ - state(conn, SMTP_STOP); - } + else + result = smtp_authenticate(conn); + return result; } @@ -357,7 +521,7 @@ static CURLcode smtp_state_helo_resp(struct connectdata *conn, if(smtpcode/100 != 2) { failf(data, "Access denied: %d", smtpcode); result = CURLE_LOGIN_DENIED; - } + } else { /* end the connect phase */ state(conn, SMTP_STOP); @@ -365,6 +529,223 @@ static CURLcode smtp_state_helo_resp(struct connectdata *conn, return result; } +/* for AUTH PLAIN (without initial response) responses */ +static CURLcode smtp_state_authplain_resp(struct connectdata *conn, + int smtpcode, + smtpstate instate) +{ + CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; + size_t l; + char * plainauth; + + (void)instate; /* no use for this yet */ + + if(smtpcode != 334) { + failf(data, "Access denied: %d", smtpcode); + result = CURLE_LOGIN_DENIED; + } + else { + l = smtp_auth_plain_data(conn, &plainauth); + + if(!l) + result = CURLE_OUT_OF_MEMORY; + else { + result = Curl_pp_sendf(&conn->proto.smtpc.pp, "%s", plainauth); + free(plainauth); + + if(!result) + state(conn, SMTP_AUTH); + } + } + + return result; +} + +/* for AUTH LOGIN (without initial response) responses */ +static CURLcode smtp_state_authlogin_resp(struct connectdata *conn, + int smtpcode, + smtpstate instate) +{ + CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; + size_t l; + char * authuser; + + (void)instate; /* no use for this yet */ + + if(smtpcode != 334) { + failf(data, "Access denied: %d", smtpcode); + result = CURLE_LOGIN_DENIED; + } + else { + l = smtp_auth_login_user(conn, &authuser); + + if(!l) + result = CURLE_OUT_OF_MEMORY; + else { + result = Curl_pp_sendf(&conn->proto.smtpc.pp, "%s", authuser); + free(authuser); + + if(!result) + state(conn, SMTP_AUTHPASSWD); + } + } + + return result; +} + +/* for responses to user entry of AUTH LOGIN. */ +static CURLcode smtp_state_authpasswd_resp(struct connectdata *conn, + int smtpcode, + smtpstate instate) +{ + CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; + size_t plen; + size_t l; + char *authpasswd; + + (void)instate; /* no use for this yet */ + + if(smtpcode != 334) { + failf(data, "Access denied: %d", smtpcode); + result = CURLE_LOGIN_DENIED; + } + else { + plen = strlen(conn->passwd); + + if(!plen) + result = Curl_pp_sendf(&conn->proto.smtpc.pp, "="); + else { + l = Curl_base64_encode(data, conn->passwd, plen, &authpasswd); + + if(!l) + result = CURLE_OUT_OF_MEMORY; + else { + result = Curl_pp_sendf(&conn->proto.smtpc.pp, "%s", authpasswd); + free(authpasswd); + + if(!result) + state(conn, SMTP_AUTH); + } + } + } + + return result; +} + +#ifndef CURL_DISABLE_CRYPTO_AUTH + +/* for AUTH CRAM-MD5 responses. */ +static CURLcode smtp_state_authcram_resp(struct connectdata *conn, + int smtpcode, + smtpstate instate) +{ + CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; + char * chlg64 = data->state.buffer; + unsigned char * chlg; + size_t chlglen; + size_t l; + char * rplyb64; + HMAC_context * ctxt; + unsigned char digest[16]; + char reply[MAX_CURL_USER_LENGTH + 32 /* 2 * size of MD5 digest */ + 1]; + + (void)instate; /* no use for this yet */ + + if(smtpcode != 334) { + failf(data, "Access denied: %d", smtpcode); + return CURLE_LOGIN_DENIED; + } + + /* Get the challenge. */ + for (chlg64 += 4; *chlg64 == ' ' || *chlg64 == '\t'; chlg64++) + ; + + chlg = (unsigned char *) NULL; + chlglen = 0; + + if(*chlg64 != '=') { + for (l = strlen(chlg64); l--;) + if(chlg64[l] != '\r' && chlg64[l] != '\n' && chlg64[l] != ' ' && + chlg64[l] != '\t') + break; + + if(++l) { + chlg64[l] = '\0'; + + if(!(chlglen = Curl_base64_decode(chlg64, &chlg))) + return CURLE_OUT_OF_MEMORY; + } + } + + /* Compute digest. */ + ctxt = Curl_HMAC_init(Curl_HMAC_MD5, + (const unsigned char *) conn->passwd, + (unsigned int)(strlen(conn->passwd))); + + if(!ctxt) { + if(chlg) + free(chlg); + + return CURLE_OUT_OF_MEMORY; + } + + if(chlglen > 0) + Curl_HMAC_update(ctxt, chlg, (unsigned int)(chlglen)); + + if(chlg) + free(chlg); + + Curl_HMAC_final(ctxt, digest); + + /* Prepare the reply. */ + snprintf(reply, sizeof reply, + "%s %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", + conn->user, digest[0], digest[1], digest[2], digest[3], digest[4], digest[5], + digest[6], digest[7], digest[8], digest[9], digest[10], digest[11], + digest[12], digest[13], digest[14], digest[15]); + + /* Encode it to base64 and send it. */ + l = Curl_base64_encode(data, reply, 0, &rplyb64); + + if(!l) + result = CURLE_OUT_OF_MEMORY; + else { + result = Curl_pp_sendf(&conn->proto.smtpc.pp, "%s", rplyb64); + free(rplyb64); + + if(!result) + state(conn, SMTP_AUTH); + } + + return result; +} + +#endif + +/* for final responses to AUTH sequences. */ +static CURLcode smtp_state_auth_resp(struct connectdata *conn, + int smtpcode, + smtpstate instate) +{ + CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; + + (void)instate; /* no use for this yet */ + + if(smtpcode != 235) { + failf(data, "Authentication failed: %d", smtpcode); + result = CURLE_LOGIN_DENIED; + } + else + state(conn, SMTP_STOP); /* End of connect phase. */ + + return result; +} + /* start the DO phase */ static CURLcode smtp_mail(struct connectdata *conn) { @@ -451,7 +832,7 @@ static CURLcode smtp_state_rcpt_resp(struct connectdata *conn, } /* send DATA */ - result = Curl_pp_sendf(&conn->proto.smtpc.pp, "DATA", ""); + result = Curl_pp_sendf(&conn->proto.smtpc.pp, "DATA"); if(result) return result; @@ -465,7 +846,6 @@ static CURLcode smtp_state_data_resp(struct connectdata *conn, int smtpcode, smtpstate instate) { - CURLcode result = CURLE_OK; struct SessionHandle *data = conn->data; struct FTP *smtp = data->state.proto.smtp; @@ -477,11 +857,11 @@ static CURLcode smtp_state_data_resp(struct connectdata *conn, } /* SMTP upload */ - result = Curl_setup_transfer(conn, -1, -1, FALSE, NULL, /* no download */ - FIRSTSOCKET, smtp->bytecountp); + Curl_setup_transfer(conn, -1, -1, FALSE, NULL, /* no download */ + FIRSTSOCKET, smtp->bytecountp); state(conn, SMTP_STOP); - return result; + return CURLE_OK; } /* for the POSTDATA response, which is received after the entire DATA @@ -542,6 +922,32 @@ static CURLcode smtp_statemach_act(struct connectdata *conn) result = smtp_state_helo_resp(conn, smtpcode, smtpc->state); break; + case SMTP_STARTTLS: + result = smtp_state_starttls_resp(conn, smtpcode, smtpc->state); + break; + + case SMTP_AUTHPLAIN: + result = smtp_state_authplain_resp(conn, smtpcode, smtpc->state); + break; + + case SMTP_AUTHLOGIN: + result = smtp_state_authlogin_resp(conn, smtpcode, smtpc->state); + break; + + case SMTP_AUTHPASSWD: + result = smtp_state_authpasswd_resp(conn, smtpcode, smtpc->state); + break; + +#ifndef CURL_DISABLE_CRYPTO_AUTH + case SMTP_AUTHCRAM: + result = smtp_state_authcram_resp(conn, smtpcode, smtpc->state); + break; +#endif + + case SMTP_AUTH: + result = smtp_state_auth_resp(conn, smtpcode, smtpc->state); + break; + case SMTP_MAIL: result = smtp_state_mail_resp(conn, smtpcode, smtpc->state); break; @@ -550,10 +956,6 @@ static CURLcode smtp_statemach_act(struct connectdata *conn) result = smtp_state_rcpt_resp(conn, smtpcode, smtpc->state); break; - case SMTP_STARTTLS: - result = smtp_state_starttls_resp(conn, smtpcode, smtpc->state); - break; - case SMTP_DATA: result = smtp_state_data_resp(conn, smtpcode, smtpc->state); break; @@ -644,10 +1046,7 @@ static CURLcode smtp_connect(struct connectdata *conn, struct pingpong *pp=&smtpc->pp; const char *path = conn->data->state.path; int len; - -#ifdef HAVE_GETHOSTNAME - char localhost[1024 + 1]; -#endif + char localhost[1024 + 1]; *done = FALSE; /* default to not done yet */ @@ -713,17 +1112,15 @@ static CURLcode smtp_connect(struct connectdata *conn, pp->conn = conn; if(!*path) { -#ifdef HAVE_GETHOSTNAME - if(!gethostname(localhost, sizeof localhost)) + if(!Curl_gethostname(localhost, sizeof localhost)) path = localhost; else -#endif - path = "localhost"; + path = "localhost"; } /* url decode the path and use it as domain with EHLO */ smtpc->domain = curl_easy_unescape(conn->data, path, 0, &len); - if (!smtpc->domain) + if(!smtpc->domain) return CURLE_OUT_OF_MEMORY; /* When we connect, we start in the state where we await the server greeting @@ -894,7 +1291,7 @@ static CURLcode smtp_quit(struct connectdata *conn) { CURLcode result = CURLE_OK; - result = Curl_pp_sendf(&conn->proto.smtpc.pp, "QUIT", NULL); + result = Curl_pp_sendf(&conn->proto.smtpc.pp, "QUIT"); if(result) return result; state(conn, SMTP_QUIT); @@ -922,11 +1319,15 @@ static CURLcode smtp_disconnect(struct connectdata *conn) /* The SMTP session may or may not have been allocated/setup at this point! */ - if (smtpc->pp.conn) + if(smtpc->pp.conn) (void)smtp_quit(conn); /* ignore errors on the LOGOUT */ Curl_pp_disconnect(&smtpc->pp); + /* This won't already be freed in some error cases */ + Curl_safefree(smtpc->domain); + smtpc->domain = NULL; + return CURLE_OK; } @@ -934,18 +1335,18 @@ static CURLcode smtp_disconnect(struct connectdata *conn) static CURLcode smtp_dophase_done(struct connectdata *conn, bool connected) { - CURLcode result = CURLE_OK; struct FTP *smtp = conn->data->state.proto.smtp; struct smtp_conn *smtpc= &conn->proto.smtpc; (void)connected; if(smtp->transfer != FTPTRANSFER_BODY) /* no data to transfer */ - result=Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL); + Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL); free(smtpc->domain); + smtpc->domain = NULL; - return result; + return CURLE_OK; } /* called from multi.c while DOing */ @@ -34,6 +34,11 @@ typedef enum { SMTP_EHLO, SMTP_HELO, SMTP_STARTTLS, + SMTP_AUTHPLAIN, + SMTP_AUTHLOGIN, + SMTP_AUTHPASSWD, + SMTP_AUTHCRAM, + SMTP_AUTH, SMTP_MAIL, /* MAIL FROM */ SMTP_RCPT, /* RCPT TO */ SMTP_DATA, @@ -49,10 +54,19 @@ struct smtp_conn { char *domain; /* what to send in the EHLO */ size_t eob; /* number of bytes of the EOB (End Of Body) that has been received thus far */ + unsigned int authmechs; /* Accepted authentication methods. */ smtpstate state; /* always use smtp.c:state() to change state! */ struct curl_slist *rcpt; }; +/* Authentication mechanism flags. */ +#define SMTP_AUTH_LOGIN 0x0001 +#define SMTP_AUTH_PLAIN 0x0002 +#define SMTP_AUTH_CRAM_MD5 0x0004 +#define SMTP_AUTH_DIGEST_MD5 0x0008 +#define SMTP_AUTH_GSSAPI 0x0010 +#define SMTP_AUTH_EXTERNAL 0x0020 + extern const struct Curl_handler Curl_handler_smtp; extern const struct Curl_handler Curl_handler_smtps; diff --git a/lib/socks.c b/lib/socks.c index eb795679..7b5740be 100644 --- a/lib/socks.c +++ b/lib/socks.c @@ -77,7 +77,7 @@ int Curl_blockread_all(struct connectdata *conn, /* connection data */ conntime = Curl_tvdiff(tvnow, conn->created); if(conntime > conn_timeout) { /* we already got the timeout */ - result = ~CURLE_OK; + result = CURLE_OPERATION_TIMEDOUT; break; } if(Curl_socket_ready(sockfd, CURL_SOCKET_BAD, @@ -86,7 +86,9 @@ int Curl_blockread_all(struct connectdata *conn, /* connection data */ break; } result = Curl_read_plain(sockfd, buf, buffersize, &nread); - if(result) + if(CURLE_AGAIN == result) + continue; + else if(result) break; if(buffersize == nread) { @@ -172,8 +174,8 @@ CURLcode Curl_SOCKS4(const char *proxy_name, return CURLE_COULDNT_RESOLVE_PROXY; if(rc == CURLRESOLV_PENDING) - /* this requires that we're in "wait for resolve" state */ - rc = Curl_wait_for_resolv(conn, &dns); + /* ignores the return code, but 'dns' remains NULL on failure */ + (void)Curl_wait_for_resolv(conn, &dns); /* * We cannot use 'hostent' as a struct that Curl_resolv() returns. It @@ -511,11 +513,13 @@ CURLcode Curl_SOCKS5(const char *proxy_name, */ len = 0; socksreq[len++] = 1; /* username/pw subnegotiation version */ - socksreq[len++] = (char) userlen; - memcpy(socksreq + len, proxy_name, userlen); + socksreq[len++] = (unsigned char) userlen; + if(proxy_name && userlen) + memcpy(socksreq + len, proxy_name, userlen); len += (int)userlen; - socksreq[len++] = (char) pwlen; - memcpy(socksreq + len, proxy_password, pwlen); + socksreq[len++] = (unsigned char) pwlen; + if(proxy_password && pwlen) + memcpy(socksreq + len, proxy_password, pwlen); len += (int)pwlen; code = Curl_write_plain(conn, sock, (char *)socksreq, len, &written); @@ -597,9 +601,12 @@ CURLcode Curl_SOCKS5(const char *proxy_name, if(rc == CURLRESOLV_ERROR) return CURLE_COULDNT_RESOLVE_HOST; - if(rc == CURLRESOLV_PENDING) + if(rc == CURLRESOLV_PENDING) { /* this requires that we're in "wait for resolve" state */ - rc = Curl_wait_for_resolv(conn, &dns); + code = Curl_wait_for_resolv(conn, &dns); + if(code != CURLE_OK) + return code; + } /* * We cannot use 'hostent' as a struct that Curl_resolv() returns. It diff --git a/lib/splay.c b/lib/splay.c index db3dbeaf..dcc42cf2 100644 --- a/lib/splay.c +++ b/lib/splay.c @@ -394,6 +394,10 @@ int main(int argc, argv_item_t argv[]) for (i = 0; i < MAX; i++) { struct timeval key; ptrs[i] = t = malloc(sizeof(struct Curl_tree)); + if(!t) { + puts("out of memory!"); + return 0; + } key.tv_sec = 0; #ifdef TEST2 @@ -405,10 +409,6 @@ int main(int argc, argv_item_t argv[]) #endif t->payload = (void *)key.tv_usec; /* for simplicity */ - if(!t) { - puts("out of memory!"); - return 0; - } root = Curl_splayinsert(key, root, t); } @@ -486,6 +486,17 @@ static int sshkeycallback(CURL *easy, #endif /* + * Earlier libssh2 versions didn't do SCP properly beyond 32bit sizes on 32bit + * architectures so we check of the necessary function is present. + */ +#ifndef HAVE_LIBSSH2_SCP_SEND64 +#define SCP_SEND(a,b,c,d) libssh2_scp_send_ex(a, b, (int)(c), (size_t)d, 0, 0) +#else +#define SCP_SEND(a,b,c,d) libssh2_scp_send64(a, b, (int)(c), \ + (libssh2_uint64_t)d, 0, 0) +#endif + +/* * ssh_statemach_act() runs the SSH state machine as far as it can without * blocking and without reaching the end. The data the pointer 'block' points * to will be set to TRUE if the libssh2 function returns LIBSSH2_ERROR_EAGAIN @@ -1431,6 +1442,11 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block) data->state.resume_from = 0; } else { + curl_off_t size = attrs.filesize; + if(size < 0) { + failf(data, "Bad file size (%" FORMAT_OFF_T ")", size); + return CURLE_BAD_DOWNLOAD_RESUME; + } data->state.resume_from = attrs.filesize; } } @@ -1556,8 +1572,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block) Curl_pgrsSetUploadSize(data, data->set.infilesize); } /* upload data */ - result = Curl_setup_transfer(conn, -1, -1, FALSE, NULL, - FIRSTSOCKET, NULL); + Curl_setup_transfer(conn, -1, -1, FALSE, NULL, FIRSTSOCKET, NULL); /* not set by Curl_setup_transfer to preserve keepon bits */ conn->sockfd = conn->writesockfd; @@ -1850,7 +1865,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block) sshc->readdir_longentry = NULL; /* no data to transfer */ - result = Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL); + Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL); state(conn, SSH_STOP); break; @@ -1901,16 +1916,19 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block) data->req.maxdownload = -1; } else { - curl_off_t size; + curl_off_t size = attrs.filesize; - size = attrs.filesize; + if(size < 0) { + failf(data, "Bad file size (%" FORMAT_OFF_T ")", size); + return CURLE_BAD_DOWNLOAD_RESUME; + } if(conn->data->state.use_range) { curl_off_t from, to; char *ptr; char *ptr2; from=curlx_strtoofft(conn->data->state.range, &ptr, 0); - while(ptr && *ptr && (isspace((int)*ptr) || (*ptr=='-'))) + while(*ptr && (isspace((int)*ptr) || (*ptr=='-'))) ptr++; to=curlx_strtoofft(ptr, &ptr2, 0); if((ptr == ptr2) /* no "to" value given */ @@ -1975,14 +1993,14 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block) /* Setup the actual download */ if(data->req.size == 0) { /* no data to transfer */ - result = Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL); + Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL); infof(data, "File already completely downloaded\n"); state(conn, SSH_STOP); break; } else { - result = Curl_setup_transfer(conn, FIRSTSOCKET, data->req.size, - FALSE, NULL, -1, NULL); + Curl_setup_transfer(conn, FIRSTSOCKET, data->req.size, + FALSE, NULL, -1, NULL); /* not set by Curl_setup_transfer to preserve keepon bits */ conn->writesockfd = conn->sockfd; @@ -2084,9 +2102,8 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block) * directory in the path. */ sshc->ssh_channel = - libssh2_scp_send_ex(sshc->ssh_session, sftp_scp->path, - (int)(data->set.new_file_perms), - (size_t)data->set.infilesize, 0, 0); + SCP_SEND(sshc->ssh_session, sftp_scp->path, data->set.new_file_perms, + data->set.infilesize); if(!sshc->ssh_channel) { if(libssh2_session_last_errno(sshc->ssh_session) == LIBSSH2_ERROR_EAGAIN) { @@ -2107,8 +2124,8 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block) } /* upload data */ - result = Curl_setup_transfer(conn, -1, data->req.size, FALSE, NULL, - FIRSTSOCKET, NULL); + Curl_setup_transfer(conn, -1, data->req.size, FALSE, NULL, + FIRSTSOCKET, NULL); /* not set by Curl_setup_transfer to preserve keepon bits */ conn->sockfd = conn->writesockfd; @@ -2159,8 +2176,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block) /* download data */ bytecount = (curl_off_t)sb.st_size; data->req.maxdownload = (curl_off_t)sb.st_size; - result = Curl_setup_transfer(conn, FIRSTSOCKET, - bytecount, FALSE, NULL, -1, NULL); + Curl_setup_transfer(conn, FIRSTSOCKET, bytecount, FALSE, NULL, -1, NULL); /* not set by Curl_setup_transfer to preserve keepon bits */ conn->writesockfd = conn->sockfd; @@ -2410,15 +2426,28 @@ static CURLcode ssh_multi_statemach(struct connectdata *conn, bool *done) return result; } -static CURLcode ssh_easy_statemach(struct connectdata *conn) +static CURLcode ssh_easy_statemach(struct connectdata *conn, + bool duringconnect) { struct ssh_conn *sshc = &conn->proto.sshc; CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; while((sshc->state != SSH_STOP) && !result) { bool block; + long left; + result = ssh_statemach_act(conn, &block); + if(Curl_pgrsUpdate(conn)) + return CURLE_ABORTED_BY_CALLBACK; + + left = Curl_timeleft(conn, NULL, duringconnect); + if(left < 0) { + failf(data, "Operation timed out\n"); + return CURLE_OPERATION_TIMEDOUT; + } + #ifdef HAVE_LIBSSH2_SESSION_BLOCK_DIRECTION if((CURLE_OK == result) && block) { int dir = libssh2_session_block_directions(sshc->ssh_session); @@ -2432,7 +2461,8 @@ static CURLcode ssh_easy_statemach(struct connectdata *conn) fd_write = sock; } /* wait for the socket to become ready */ - Curl_socket_ready(fd_read, fd_write, 1000); /* ignore result */ + Curl_socket_ready(fd_read, fd_write, + (int)(left>1000?1000:left)); /* ignore result */ } #endif @@ -2466,6 +2496,9 @@ static CURLcode ssh_init(struct connectdata *conn) return CURLE_OK; } +static Curl_recv scp_recv, sftp_recv; +static Curl_send scp_send, sftp_send; + /* * Curl_ssh_connect() gets called from Curl_protocol_connect() to allow us to * do protocol-specific actions at connect-time. @@ -2491,6 +2524,13 @@ static CURLcode ssh_connect(struct connectdata *conn, bool *done) if(result) return result; + if(conn->protocol & PROT_SCP) { + conn->recv[FIRSTSOCKET] = scp_recv; + conn->send[FIRSTSOCKET] = scp_send; + } else { + conn->recv[FIRSTSOCKET] = sftp_recv; + conn->send[FIRSTSOCKET] = sftp_send; + } ssh = &conn->proto.sshc; #ifdef CURL_LIBSSH2_DEBUG @@ -2540,7 +2580,7 @@ static CURLcode ssh_connect(struct connectdata *conn, bool *done) if(data->state.used_interface == Curl_if_multi) result = ssh_multi_statemach(conn, done); else { - result = ssh_easy_statemach(conn); + result = ssh_easy_statemach(conn, TRUE); if(!result) *done = TRUE; } @@ -2576,7 +2616,7 @@ CURLcode scp_perform(struct connectdata *conn, result = ssh_multi_statemach(conn, dophase_done); } else { - result = ssh_easy_statemach(conn); + result = ssh_easy_statemach(conn, FALSE); *dophase_done = TRUE; /* with the easy interface we are done here */ } *connected = conn->bits.tcpconnect; @@ -2657,7 +2697,7 @@ static CURLcode scp_disconnect(struct connectdata *conn) state(conn, SSH_SESSION_DISCONNECT); - result = ssh_easy_statemach(conn); + result = ssh_easy_statemach(conn, FALSE); } return result; @@ -2678,7 +2718,7 @@ static CURLcode ssh_done(struct connectdata *conn, CURLcode status) non-blocking DONE operations, not in the multi state machine and with Curl_done() invokes on several places in the code! */ - result = ssh_easy_statemach(conn); + result = ssh_easy_statemach(conn, FALSE); } else result = status; @@ -2705,8 +2745,8 @@ static CURLcode scp_done(struct connectdata *conn, CURLcode status, } /* return number of received (decrypted) bytes */ -ssize_t Curl_scp_send(struct connectdata *conn, int sockindex, - const void *mem, size_t len) +static ssize_t scp_send(struct connectdata *conn, int sockindex, + const void *mem, size_t len, CURLcode *err) { ssize_t nwrite; (void)sockindex; /* we only support SCP on the fixed known primary socket */ @@ -2717,8 +2757,10 @@ ssize_t Curl_scp_send(struct connectdata *conn, int sockindex, ssh_block2waitfor(conn, (nwrite == LIBSSH2_ERROR_EAGAIN)?TRUE:FALSE); - if(nwrite == LIBSSH2_ERROR_EAGAIN) - return 0; + if(nwrite == LIBSSH2_ERROR_EAGAIN) { + *err = CURLE_AGAIN; + nwrite = 0; + } return nwrite; } @@ -2727,8 +2769,8 @@ ssize_t Curl_scp_send(struct connectdata *conn, int sockindex, * If the read would block (EWOULDBLOCK) we return -1. Otherwise we return * a regular CURLcode value. */ -ssize_t Curl_scp_recv(struct connectdata *conn, int sockindex, - char *mem, size_t len) +static ssize_t scp_recv(struct connectdata *conn, int sockindex, + char *mem, size_t len, CURLcode *err) { ssize_t nread; (void)sockindex; /* we only support SCP on the fixed known primary socket */ @@ -2738,6 +2780,10 @@ ssize_t Curl_scp_recv(struct connectdata *conn, int sockindex, libssh2_channel_read(conn->proto.sshc.ssh_channel, mem, len); ssh_block2waitfor(conn, (nread == LIBSSH2_ERROR_EAGAIN)?TRUE:FALSE); + if (nread == LIBSSH2_ERROR_EAGAIN) { + *err = CURLE_AGAIN; + nread = -1; + } return nread; } @@ -2774,7 +2820,7 @@ CURLcode sftp_perform(struct connectdata *conn, result = ssh_multi_statemach(conn, dophase_done); } else { - result = ssh_easy_statemach(conn); + result = ssh_easy_statemach(conn, FALSE); *dophase_done = TRUE; /* with the easy interface we are done here */ } *connected = conn->bits.tcpconnect; @@ -2814,7 +2860,7 @@ static CURLcode sftp_disconnect(struct connectdata *conn) if(conn->proto.sshc.ssh_session) { /* only if there's a session still around to use! */ state(conn, SSH_SFTP_SHUTDOWN); - result = ssh_easy_statemach(conn); + result = ssh_easy_statemach(conn, FALSE); } DEBUGF(infof(conn->data, "SSH DISCONNECT is done\n")); @@ -2842,8 +2888,8 @@ static CURLcode sftp_done(struct connectdata *conn, CURLcode status, } /* return number of sent bytes */ -ssize_t Curl_sftp_send(struct connectdata *conn, int sockindex, - const void *mem, size_t len) +static ssize_t sftp_send(struct connectdata *conn, int sockindex, + const void *mem, size_t len, CURLcode *err) { ssize_t nwrite; /* libssh2_sftp_write() used to return size_t in 0.14 but is changed to ssize_t in 0.15. These days we don't @@ -2854,8 +2900,10 @@ ssize_t Curl_sftp_send(struct connectdata *conn, int sockindex, ssh_block2waitfor(conn, (nwrite == LIBSSH2_ERROR_EAGAIN)?TRUE:FALSE); - if(nwrite == LIBSSH2_ERROR_EAGAIN) - return 0; + if(nwrite == LIBSSH2_ERROR_EAGAIN) { + *err = CURLE_AGAIN; + nwrite = 0; + } return nwrite; } @@ -2863,8 +2911,8 @@ ssize_t Curl_sftp_send(struct connectdata *conn, int sockindex, /* * Return number of received (decrypted) bytes */ -ssize_t Curl_sftp_recv(struct connectdata *conn, int sockindex, - char *mem, size_t len) +static ssize_t sftp_recv(struct connectdata *conn, int sockindex, + char *mem, size_t len, CURLcode *err) { ssize_t nread; (void)sockindex; @@ -2873,6 +2921,10 @@ ssize_t Curl_sftp_recv(struct connectdata *conn, int sockindex, ssh_block2waitfor(conn, (nread == LIBSSH2_ERROR_EAGAIN)?TRUE:FALSE); + if(nread == LIBSSH2_ERROR_EAGAIN) { + *err = CURLE_AGAIN; + nread = -1; + } return nread; } @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -151,37 +151,21 @@ struct ssh_conn { #endif #if defined(LIBSSH2_VERSION_NUM) && (LIBSSH2_VERSION_NUM >= 0x010000) -/* libssh2_sftp_seek64() has only ever been provided by libssh2 1.0 or - later */ # define HAVE_LIBSSH2_SFTP_SEEK64 1 #else # undef HAVE_LIBSSH2_SFTP_SEEK64 #endif +#if defined(LIBSSH2_VERSION_NUM) && (LIBSSH2_VERSION_NUM >= 0x010206) +# define HAVE_LIBSSH2_SCP_SEND64 1 +#else +# undef HAVE_LIBSSH2_SCP_SEND64 +#endif + extern const struct Curl_handler Curl_handler_scp; extern const struct Curl_handler Curl_handler_sftp; -ssize_t Curl_scp_send(struct connectdata *conn, int sockindex, - const void *mem, size_t len); -ssize_t Curl_scp_recv(struct connectdata *conn, int sockindex, - char *mem, size_t len); - -ssize_t Curl_sftp_send(struct connectdata *conn, int sockindex, - const void *mem, size_t len); -ssize_t Curl_sftp_recv(struct connectdata *conn, int sockindex, - char *mem, size_t len); - -#define Curl_ssh_enabled(conn,prot) (conn->protocol & prot) - -#else /* USE_LIBSSH2 */ - -#define Curl_ssh_enabled(x,y) 0 -#define Curl_scp_send(a,b,c,d) 0 -#define Curl_sftp_send(a,b,c,d) 0 -#define Curl_scp_recv(a,b,c,d) 0 -#define Curl_sftp_recv(a,b,c,d) 0 - #endif /* USE_LIBSSH2 */ #endif /* HEADER_CURL_SSH_H */ diff --git a/lib/sslgen.c b/lib/sslgen.c index df2a4075..bd8dc172 100644 --- a/lib/sslgen.c +++ b/lib/sslgen.c @@ -31,6 +31,7 @@ Curl_ossl_ - prefix for OpenSSL ones Curl_gtls_ - prefix for GnuTLS ones Curl_nss_ - prefix for NSS ones + Curl_polarssl_ - prefix for PolarSSL ones Note that this source code uses curlssl_* functions, and they are all defines/macros #defined by the lib-specific header files. @@ -55,6 +56,7 @@ #include "gtls.h" /* GnuTLS versions */ #include "nssg.h" /* NSS versions */ #include "qssl.h" /* QSOSSL versions */ +#include "polarssl.h" /* PolarSSL versions */ #include "sendf.h" #include "rawstr.h" #include "url.h" @@ -408,25 +410,6 @@ struct curl_slist *Curl_ssl_engines_list(struct SessionHandle *data) return curlssl_engines_list(data); } -ssize_t Curl_ssl_send(struct connectdata *conn, - int sockindex, - const void *mem, - size_t len, - int *curlcode) -{ - return curlssl_send(conn, sockindex, mem, len, curlcode); -} - -ssize_t Curl_ssl_recv(struct connectdata *conn, - int sockindex, - char *mem, - size_t len, - int *curlcode) -{ - return curlssl_recv(conn, sockindex, mem, len, curlcode); -} - - /* * This sets up a session ID cache to the specified size. Make sure this code * is agnostic to what underlying SSL technology we use. diff --git a/lib/sslgen.h b/lib/sslgen.h index c56265e0..997e30d3 100644 --- a/lib/sslgen.h +++ b/lib/sslgen.h @@ -45,28 +45,6 @@ CURLcode Curl_ssl_set_engine(struct SessionHandle *data, const char *engine); CURLcode Curl_ssl_set_engine_default(struct SessionHandle *data); struct curl_slist *Curl_ssl_engines_list(struct SessionHandle *data); -/* If the write would block (EWOULDBLOCK) or fail, we we return -1. - * The error or -1 (for EWOULDBLOCK) is then stored in *curlcode. - * Otherwise we return the count of (non-SSL) bytes transfered. - */ -ssize_t Curl_ssl_send(struct connectdata *conn, /* connection data */ - int sockindex, /* socketindex */ - const void *mem, /* data to write */ - size_t len, /* max amount to write */ - int *curlcode); /* error to return, - -1 means EWOULDBLOCK */ - -/* If the read would block (EWOULDBLOCK) or fail, we we return -1. - * The error or -1 (for EWOULDBLOCK) is then stored in *curlcode. - * Otherwise we return the count of (non-SSL) bytes transfered. - */ -ssize_t Curl_ssl_recv(struct connectdata *conn, /* connection data */ - int sockindex, /* socketindex */ - char *mem, /* store read data here */ - size_t len, /* max amount to read */ - int *curlcode); /* error to return, - -1 means EWOULDBLOCK */ - /* init the SSL session ID cache */ CURLcode Curl_ssl_initsessions(struct SessionHandle *, long); size_t Curl_ssl_version(char *buffer, size_t size); diff --git a/lib/ssluse.c b/lib/ssluse.c index d9cf3829..474bc9a3 100644 --- a/lib/ssluse.c +++ b/lib/ssluse.c @@ -64,6 +64,7 @@ #include <openssl/x509v3.h> #include <openssl/dsa.h> #include <openssl/dh.h> +#include <openssl/err.h> #else #include <rand.h> #include <x509v3.h> @@ -882,6 +883,8 @@ int Curl_ossl_shutdown(struct connectdata *conn, int sockindex) int what = Curl_socket_ready(conn->sock[sockindex], CURL_SOCKET_BAD, SSL_SHUTDOWN_TIMEOUT); if(what > 0) { + ERR_clear_error(); + /* Something to read, let's do it and hope that it is the close notify alert from the server */ nread = (ssize_t)SSL_read(conn->ssl[sockindex].handle, buf, @@ -1592,10 +1595,8 @@ ossl_connect_step1(struct connectdata *conn, if ( !lookup || (!X509_load_crl_file(lookup,data->set.str[STRING_SSL_CRLFILE], X509_FILETYPE_PEM)) ) { - failf(data,"error loading CRL file :\n" - " CRLfile: %s\n", - data->set.str[STRING_SSL_CRLFILE]? - data->set.str[STRING_SSL_CRLFILE]: "none"); + failf(data,"error loading CRL file: %s\n", + data->set.str[STRING_SSL_CRLFILE]); return CURLE_SSL_CRL_BADFILE; } else { @@ -1684,6 +1685,8 @@ ossl_connect_step2(struct connectdata *conn, int sockindex) || ssl_connect_2_reading == connssl->connecting_state || ssl_connect_2_writing == connssl->connecting_state); + ERR_clear_error(); + err = SSL_connect(connssl->handle); /* 1 is fine @@ -2352,6 +2355,9 @@ ossl_connect_step3(struct connectdata *conn, return retcode; } +static Curl_recv ossl_recv; +static Curl_send ossl_send; + static CURLcode ossl_connect_common(struct connectdata *conn, int sockindex, @@ -2422,8 +2428,17 @@ ossl_connect_common(struct connectdata *conn, /* socket is readable or writable */ } + /* Run transaction, and return to the caller if it failed or if this + * connection is done nonblocking and this loop would execute again. This + * permits the owner of a multi handle to abort a connection attempt + * before step2 has completed while ensuring that a client using select() + * or epoll() will always have a valid fdset to wait on. + */ retcode = ossl_connect_step2(conn, sockindex); - if(retcode || (data->state.used_interface == Curl_if_multi)) + if(retcode || (nonblocking && + (ssl_connect_2 == connssl->connecting_state || + ssl_connect_2_reading == connssl->connecting_state || + ssl_connect_2_writing == connssl->connecting_state))) return retcode; } /* repeat step2 until all transactions are done. */ @@ -2437,6 +2452,8 @@ ossl_connect_common(struct connectdata *conn, if(ssl_connect_done==connssl->connecting_state) { connssl->state = ssl_connection_complete; + conn->recv[sockindex] = ossl_recv; + conn->send[sockindex] = ossl_send; *done = TRUE; } else @@ -2482,12 +2499,11 @@ bool Curl_ossl_data_pending(const struct connectdata *conn, return FALSE; } -/* for documentation see Curl_ssl_send() in sslgen.h */ -ssize_t Curl_ossl_send(struct connectdata *conn, - int sockindex, - const void *mem, - size_t len, - int *curlcode) +static ssize_t ossl_send(struct connectdata *conn, + int sockindex, + const void *mem, + size_t len, + CURLcode *curlcode) { /* SSL_write() is said to return 'int' while write() and send() returns 'size_t' */ @@ -2498,6 +2514,8 @@ ssize_t Curl_ossl_send(struct connectdata *conn, int memlen; int rc; + ERR_clear_error(); + memlen = (len > (size_t)INT_MAX) ? INT_MAX : (int)len; rc = SSL_write(conn->ssl[sockindex].handle, mem, memlen); @@ -2510,7 +2528,7 @@ ssize_t Curl_ossl_send(struct connectdata *conn, /* The operation did not complete; the same TLS/SSL I/O function should be called again later. This is basicly an EWOULDBLOCK equivalent. */ - *curlcode = /* EWOULDBLOCK */ -1; + *curlcode = CURLE_AGAIN; return -1; case SSL_ERROR_SYSCALL: failf(conn->data, "SSL_write() returned SYSCALL, errno = %d", @@ -2534,12 +2552,11 @@ ssize_t Curl_ossl_send(struct connectdata *conn, return (ssize_t)rc; /* number of bytes */ } -/* for documentation see Curl_ssl_recv() in sslgen.h */ -ssize_t Curl_ossl_recv(struct connectdata *conn, /* connection data */ - int num, /* socketindex */ - char *buf, /* store read data here */ - size_t buffersize, /* max amount to read */ - int *curlcode) +static ssize_t ossl_recv(struct connectdata *conn, /* connection data */ + int num, /* socketindex */ + char *buf, /* store read data here */ + size_t buffersize, /* max amount to read */ + CURLcode *curlcode) { char error_buffer[120]; /* OpenSSL documents that this must be at least 120 bytes long. */ @@ -2547,6 +2564,8 @@ ssize_t Curl_ossl_recv(struct connectdata *conn, /* connection data */ ssize_t nread; int buffsize; + ERR_clear_error(); + buffsize = (buffersize > (size_t)INT_MAX) ? INT_MAX : (int)buffersize; nread = (ssize_t)SSL_read(conn->ssl[num].handle, buf, buffsize); if(nread < 0) { @@ -2560,7 +2579,7 @@ ssize_t Curl_ossl_recv(struct connectdata *conn, /* connection data */ case SSL_ERROR_WANT_READ: case SSL_ERROR_WANT_WRITE: /* there's data pending, re-invoke SSL_read() */ - *curlcode = -1; /* EWOULDBLOCK */ + *curlcode = CURLE_AGAIN; return -1; default: /* openssl/ssl.h says "look at error stack/return value/errno" */ diff --git a/lib/ssluse.h b/lib/ssluse.h index 00357afc..2ac0ad2e 100644 --- a/lib/ssluse.h +++ b/lib/ssluse.h @@ -56,20 +56,6 @@ struct curl_slist *Curl_ossl_engines_list(struct SessionHandle *data); int Curl_ossl_init(void); void Curl_ossl_cleanup(void); -/* for documentation see Curl_ssl_send() in sslgen.h */ -ssize_t Curl_ossl_send(struct connectdata *conn, - int sockindex, - const void *mem, - size_t len, - int *curlcode); - -/* for documentation see Curl_ssl_recv() in sslgen.h */ -ssize_t Curl_ossl_recv(struct connectdata *conn, /* connection data */ - int num, /* socketindex */ - char *buf, /* store read data here */ - size_t buffersize, /* max amount to read */ - int *curlcode); - size_t Curl_ossl_version(char *buffer, size_t size); int Curl_ossl_check_cxn(struct connectdata *cxn); int Curl_ossl_seed(struct SessionHandle *data); @@ -90,8 +76,6 @@ bool Curl_ossl_data_pending(const struct connectdata *conn, #define curlssl_set_engine(x,y) Curl_ossl_set_engine(x,y) #define curlssl_set_engine_default(x) Curl_ossl_set_engine_default(x) #define curlssl_engines_list(x) Curl_ossl_engines_list(x) -#define curlssl_send Curl_ossl_send -#define curlssl_recv Curl_ossl_recv #define curlssl_version Curl_ossl_version #define curlssl_check_cxn Curl_ossl_check_cxn #define curlssl_data_pending(x,y) Curl_ossl_data_pending(x,y) diff --git a/lib/stamp-h1 b/lib/stamp-h1 deleted file mode 100644 index 8f5adb6e..00000000 --- a/lib/stamp-h1 +++ /dev/null @@ -1 +0,0 @@ -timestamp for lib/curl_config.h diff --git a/lib/strerror.c b/lib/strerror.c index 673e89c1..e8ecea59 100644 --- a/lib/strerror.c +++ b/lib/strerror.c @@ -275,6 +275,12 @@ curl_easy_strerror(CURLcode error) case CURLE_RTSP_SESSION_ERROR: return "RTSP session error"; + case CURLE_FTP_BAD_FILE_LIST: + return "Unable to parse FTP file list"; + + case CURLE_CHUNK_FAILED: + return "Chunk callback failed"; + /* error codes not used by current libcurl */ case CURLE_OBSOLETE4: case CURLE_OBSOLETE10: diff --git a/lib/strtoofft.c b/lib/strtoofft.c index f75eb8a4..61ff05be 100644 --- a/lib/strtoofft.c +++ b/lib/strtoofft.c @@ -131,9 +131,9 @@ curlx_strtoll(const char *nptr, char **endptr, int base) } else { if(is_negative) - value = CURL_LLONG_MIN; + value = CURL_OFF_T_MIN; else - value = CURL_LLONG_MAX; + value = CURL_OFF_T_MAX; SET_ERRNO(ERANGE); } diff --git a/lib/strtoofft.h b/lib/strtoofft.h index bf27a173..8208e87f 100644 --- a/lib/strtoofft.h +++ b/lib/strtoofft.h @@ -57,7 +57,12 @@ # define curlx_strtoofft strtol #endif -#define CURL_LLONG_MAX CURL_OFF_T_C(0x7FFFFFFFFFFFFFFF) -#define CURL_LLONG_MIN (-CURL_LLONG_MAX - CURL_OFF_T_C(1)) +#if (CURL_SIZEOF_CURL_OFF_T == 4) +# define CURL_OFF_T_MAX CURL_OFF_T_C(0x7FFFFFFF) +#else + /* assume CURL_SIZEOF_CURL_OFF_T == 8 */ +# define CURL_OFF_T_MAX CURL_OFF_T_C(0x7FFFFFFFFFFFFFFF) +#endif +#define CURL_OFF_T_MIN (-CURL_OFF_T_MAX - CURL_OFF_T_C(1)) #endif /* HEADER_CURL_STRTOOFFT_H */ diff --git a/lib/telnet.c b/lib/telnet.c index 9409f495..1a5683d4 100644 --- a/lib/telnet.c +++ b/lib/telnet.c @@ -67,6 +67,7 @@ #include "sendf.h" #include "telnet.h" #include "connect.h" +#include "progress.h" #define _MPRINTF_REPLACE /* use our functions only */ #include <curl/mprintf.h> @@ -962,16 +963,16 @@ CURLcode telrcv(struct connectdata *conn, struct SessionHandle *data = conn->data; struct TELNET *tn = (struct TELNET *)data->state.proto.telnet; -#define startskipping() \ - if(startwrite >= 0) { \ - result = Curl_client_write(conn, \ - CLIENTWRITE_BODY, \ - (char *)&inbuf[startwrite], \ - in-startwrite); \ - if(result != CURLE_OK) \ - return result; \ - } \ - startwrite = -1 +#define startskipping() \ + if(startwrite >= 0) { \ + result = Curl_client_write(conn, \ + CLIENTWRITE_BODY, \ + (char *)&inbuf[startwrite], \ + in-startwrite); \ + if(result != CURLE_OK) \ + return result; \ + } \ + startwrite = -1 #define writebyte() \ if(startwrite < 0) \ @@ -1206,8 +1207,10 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done) #else int interval_ms; struct pollfd pfd[2]; + int poll_cnt; + curl_off_t total_dl = 0; + curl_off_t total_ul = 0; #endif - int ret; ssize_t nread; struct timeval now; bool keepon = TRUE; @@ -1379,14 +1382,13 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done) } if(events.lNetworkEvents & FD_READ) { /* read data from network */ - ret = Curl_read(conn, sockfd, buf, BUFSIZE - 1, &nread); - /* returned sub-zero, this would've blocked. Loop again */ - if(ret < 0) + code = Curl_read(conn, sockfd, buf, BUFSIZE - 1, &nread); + /* read would've blocked. Loop again */ + if(code == CURLE_AGAIN) break; /* returned not-zero, this an error */ - else if(ret) { + else if(code) { keepon = FALSE; - code = (CURLcode)ret; break; } /* returned zero but actually received 0 or less here, @@ -1402,8 +1404,6 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done) break; } - fflush(stdout); - /* Negotiate if the peer has started negotiating, otherwise don't. We don't want to speak telnet with non-telnet servers, like POP or SMTP. */ @@ -1446,37 +1446,37 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done) #else pfd[0].fd = sockfd; pfd[0].events = POLLIN; - pfd[1].fd = 0; - pfd[1].events = POLLIN; - interval_ms = 1 * 1000; + + if (data->set.is_fread_set) { + poll_cnt = 1; + interval_ms = 100; /* poll user-supplied read function */ + } + else { + pfd[1].fd = 0; + pfd[1].events = POLLIN; + poll_cnt = 2; + interval_ms = 1 * 1000; + } while(keepon) { - switch (Curl_poll(pfd, 2, interval_ms)) { + switch (Curl_poll(pfd, poll_cnt, interval_ms)) { case -1: /* error, stop reading */ keepon = FALSE; continue; case 0: /* timeout */ - break; + pfd[0].revents = 0; + pfd[1].revents = 0; + /* fall through */ default: /* read! */ - if(pfd[1].revents & POLLIN) { /* read from stdin */ - nread = read(0, buf, 255); - code = send_telnet_data(conn, buf, nread); - if(code) { - keepon = FALSE; - break; - } - } - if(pfd[0].revents & POLLIN) { /* read data from network */ - ret = Curl_read(conn, sockfd, buf, BUFSIZE - 1, &nread); - /* returned sub-zero, this would've blocked. Loop again */ - if(ret < 0) + code = Curl_read(conn, sockfd, buf, BUFSIZE - 1, &nread); + /* read would've blocked. Loop again */ + if(code == CURLE_AGAIN) break; /* returned not-zero, this an error */ - else if(ret) { + else if(code) { keepon = FALSE; - code = (CURLcode)ret; break; } /* returned zero but actually received 0 or less here, @@ -1486,6 +1486,8 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done) break; } + total_dl += nread; + Curl_pgrsSetDownloadCounter(data, total_dl); code = telrcv(conn, (unsigned char *)buf, nread); if(code) { keepon = FALSE; @@ -1500,7 +1502,39 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done) tn->already_negotiated = 1; } } - } + + nread = 0; + if (poll_cnt == 2) { + if(pfd[1].revents & POLLIN) { /* read from stdin */ + nread = read(0, buf, BUFSIZE - 1); + } + } + else { + /* read from user-supplied method */ + nread = (int)conn->fread_func(buf, 1, BUFSIZE - 1, conn->fread_in); + if (nread == CURL_READFUNC_ABORT) { + keepon = FALSE; + break; + } + if (nread == CURL_READFUNC_PAUSE) + break; + } + + if (nread > 0) { + code = send_telnet_data(conn, buf, nread); + if(code) { + keepon = FALSE; + break; + } + total_ul += nread; + Curl_pgrsSetUploadCounter(data, total_ul); + } + else if (nread < 0) + keepon = FALSE; + + break; + } /* poll switch statement */ + if(data->set.timeout) { now = Curl_tvnow(); if(Curl_tvdiff(now, conn->created) >= data->set.timeout) { @@ -1509,6 +1543,11 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done) keepon = FALSE; } } + + if(Curl_pgrsUpdate(conn)) { + code = CURLE_ABORTED_BY_CALLBACK; + break; + } } #endif /* mark this as "no further transfer wanted" */ @@ -87,8 +87,10 @@ #define TFTP_BLKSIZE_MIN 8 #define TFTP_BLKSIZE_MAX 65464 #define TFTP_OPTION_BLKSIZE "blksize" -#define TFTP_OPTION_TSIZE "tsize" -#define TFTP_OPTION_INTERVAL "interval" + +/* from RFC2349: */ +#define TFTP_OPTION_TSIZE "tsize" +#define TFTP_OPTION_INTERVAL "timeout" typedef enum { TFTP_MODE_NETASCII=0, @@ -167,7 +169,7 @@ static CURLcode tftp_connect(struct connectdata *conn, bool *done); static CURLcode tftp_disconnect(struct connectdata *conn); static CURLcode tftp_do(struct connectdata *conn, bool *done); static CURLcode tftp_done(struct connectdata *conn, - CURLcode, bool premature); + CURLcode, bool premature); static CURLcode tftp_setup_connection(struct connectdata * conn); static CURLcode tftp_multi_statemach(struct connectdata *conn, bool *done); static CURLcode tftp_doing(struct connectdata *conn, bool *dophase_done); @@ -372,12 +374,12 @@ static CURLcode tftp_parse_option_ack(tftp_state_data_t *state, } else if(blksize > TFTP_BLKSIZE_MAX) { failf(data, "%s (%d)", "blksize is larger than max supported", - TFTP_BLKSIZE_MAX); + TFTP_BLKSIZE_MAX); return CURLE_TFTP_ILLEGAL; } else if(blksize < TFTP_BLKSIZE_MIN) { failf(data, "%s (%d)", "blksize is smaller than min supported", - TFTP_BLKSIZE_MIN); + TFTP_BLKSIZE_MIN); return CURLE_TFTP_ILLEGAL; } else if (blksize > state->requested_blksize) { @@ -385,13 +387,13 @@ static CURLcode tftp_parse_option_ack(tftp_state_data_t *state, * support for the server requesting a bigger blksize than the client * requests */ failf(data, "%s (%ld)", - "server requested blksize larger than allocated", blksize); + "server requested blksize larger than allocated", blksize); return CURLE_TFTP_ILLEGAL; } state->blksize = (int)blksize; infof(data, "%s (%d) %s (%d)\n", "blksize parsed from OACK", - state->blksize, "requested", state->requested_blksize); + state->blksize, "requested", state->requested_blksize); } else if(checkprefix(option, TFTP_OPTION_TSIZE)) { long tsize = 0; @@ -524,18 +526,21 @@ static CURLcode tftp_send_first(tftp_state_data_t *state, tftp_event_t event) TFTP_OPTION_BLKSIZE); sbytes += tftp_option_add(state, sbytes, (char *)state->spacket.data+sbytes, buf ); - /* add timeout option, this is the max time the session may live */ - snprintf( buf, sizeof(buf), "%d", state->retry_time*state->retry_max ); + + /* add timeout option */ + snprintf( buf, sizeof(buf), "%d", state->retry_time); sbytes += tftp_option_add(state, sbytes, (char *)state->spacket.data+sbytes, TFTP_OPTION_INTERVAL); sbytes += tftp_option_add(state, sbytes, (char *)state->spacket.data+sbytes, buf ); + /* the typecase for the 3rd argument is mostly for systems that do + not have a size_t argument, like older unixes that want an 'int' */ senddata = sendto(state->sockfd, (void *)state->spacket.data, - sbytes, 0, - state->conn->ip_addr->ai_addr, - state->conn->ip_addr->ai_addrlen); + (SEND_TYPE_ARG3)sbytes, 0, + state->conn->ip_addr->ai_addr, + state->conn->ip_addr->ai_addrlen); if(senddata != (ssize_t)sbytes) { failf(data, "%s", Curl_strerror(state->conn, SOCKERRNO)); } @@ -570,6 +575,10 @@ static CURLcode tftp_send_first(tftp_state_data_t *state, tftp_event_t event) return res; } +/* the next blocknum is x + 1 but it needs to wrap at an unsigned 16bit + boundary */ +#define NEXT_BLOCKNUM(x) (((x)+1)&0xffff) + /********************************************************** * * tftp_rx @@ -588,16 +597,17 @@ static CURLcode tftp_rx(tftp_state_data_t *state, tftp_event_t event) case TFTP_EVENT_DATA: /* Is this the block we expect? */ rblock = getrpacketblock(&state->rpacket); - if((state->block+1) != rblock) { + if(NEXT_BLOCKNUM(state->block) != rblock) { /* No, log it, up the retry count and fail if over the limit */ infof(data, "Received unexpected DATA packet block %d\n", rblock); state->retries++; - if(state->retries>state->retry_max) { + if(state->retries > state->retry_max) { failf(data, "tftp_rx: giving up waiting for block %d", - state->block+1); + NEXT_BLOCKNUM(state->block)); return CURLE_TFTP_ILLEGAL; } + break; } /* This is the expected block. Reset counters and ACK it. */ state->block = (unsigned short)rblock; @@ -648,7 +658,7 @@ static CURLcode tftp_rx(tftp_state_data_t *state, tftp_event_t event) state->retries++; infof(data, "Timeout waiting for block %d ACK. Retries = %d\n", - state->block+1, state->retries); + NEXT_BLOCKNUM(state->block), state->retries); if(state->retries > state->retry_max) { state->error = TFTP_ERR_TIMEOUT; state->state = TFTP_STATE_FIN; @@ -659,7 +669,6 @@ static CURLcode tftp_rx(tftp_state_data_t *state, tftp_event_t event) 4, SEND_4TH_ARG, (struct sockaddr *)&state->remote_addr, state->remote_addrlen); - /* Check all sbytes were sent */ if(sbytes<0) { failf(data, "%s", Curl_strerror(state->conn, SOCKERRNO)); return CURLE_SEND_ERROR; @@ -670,10 +679,10 @@ static CURLcode tftp_rx(tftp_state_data_t *state, tftp_event_t event) case TFTP_EVENT_ERROR: setpacketevent(&state->spacket, TFTP_EVENT_ERROR); setpacketblock(&state->spacket, state->block); - sbytes = sendto(state->sockfd, (void *)state->spacket.data, - 4, SEND_4TH_ARG, - (struct sockaddr *)&state->remote_addr, - state->remote_addrlen); + (void)sendto(state->sockfd, (void *)state->spacket.data, + 4, SEND_4TH_ARG, + (struct sockaddr *)&state->remote_addr, + state->remote_addrlen); /* don't bother with the return code, but if the socket is still up we * should be a good TFTP client and let the server know we're done */ state->state = TFTP_STATE_FIN; @@ -707,42 +716,48 @@ static CURLcode tftp_tx(tftp_state_data_t *state, tftp_event_t event) case TFTP_EVENT_ACK: case TFTP_EVENT_OACK: if (event == TFTP_EVENT_ACK) { - /* Ack the packet */ - rblock = getrpacketblock(&state->rpacket); - - if(rblock != state->block) { - /* This isn't the expected block. Log it and up the retry counter */ - infof(data, "Received ACK for block %d, expecting %d\n", - rblock, state->block); - state->retries++; - /* Bail out if over the maximum */ - if(state->retries>state->retry_max) { - failf(data, "tftp_tx: giving up waiting for block %d ack", - state->block); - res = CURLE_SEND_ERROR; - } - else { - /* Re-send the data packet */ - sbytes = sendto(state->sockfd, (void *)&state->spacket, - 4+state->sbytes, SEND_4TH_ARG, - (struct sockaddr *)&state->remote_addr, - state->remote_addrlen); - /* Check all sbytes were sent */ - if(sbytes<0) { - failf(data, "%s", Curl_strerror(state->conn, SOCKERRNO)); - res = CURLE_SEND_ERROR; - } + /* Ack the packet */ + rblock = getrpacketblock(&state->rpacket); + + if(rblock != state->block && + /* There's a bug in tftpd-hpa that causes it to send us an ack for + * 65535 when the block number wraps to 0. So when we're expecting + * 0, also accept 65535. See + * http://syslinux.zytor.com/archives/2010-September/015253.html + * */ + !(state->block == 0 && rblock == 65535)) { + /* This isn't the expected block. Log it and up the retry counter */ + infof(data, "Received ACK for block %d, expecting %d\n", + rblock, state->block); + state->retries++; + /* Bail out if over the maximum */ + if(state->retries>state->retry_max) { + failf(data, "tftp_tx: giving up waiting for block %d ack", + state->block); + res = CURLE_SEND_ERROR; + } + else { + /* Re-send the data packet */ + sbytes = sendto(state->sockfd, (void *)&state->spacket, + 4+state->sbytes, SEND_4TH_ARG, + (struct sockaddr *)&state->remote_addr, + state->remote_addrlen); + /* Check all sbytes were sent */ + if(sbytes<0) { + failf(data, "%s", Curl_strerror(state->conn, SOCKERRNO)); + res = CURLE_SEND_ERROR; } - return res; - } - /* This is the expected packet. Reset the counters and send the next - block */ - time(&state->rx_time); - state->block++; - } - else { - state->block = 1; /* first data block is 1 when using OACK */ + } + return res; + } + /* This is the expected packet. Reset the counters and send the next + block */ + time(&state->rx_time); + state->block++; } + else + state->block = 1; /* first data block is 1 when using OACK */ + state->retries = 0; setpacketevent(&state->spacket, TFTP_EVENT_DATA); setpacketblock(&state->spacket, state->block); @@ -750,8 +765,7 @@ static CURLcode tftp_tx(tftp_state_data_t *state, tftp_event_t event) state->state = TFTP_STATE_FIN; return CURLE_OK; } - res = Curl_fillreadbuffer(state->conn, (size_t)state->blksize, - &state->sbytes); + res = Curl_fillreadbuffer(state->conn, state->blksize, &state->sbytes); if(res) return res; sbytes = sendto(state->sockfd, (void *)state->spacket.data, @@ -772,7 +786,7 @@ static CURLcode tftp_tx(tftp_state_data_t *state, tftp_event_t event) /* Increment the retry counter and log the timeout */ state->retries++; infof(data, "Timeout waiting for block %d ACK. " - " Retries = %d\n", state->block+1, state->retries); + " Retries = %d\n", NEXT_BLOCKNUM(state->block), state->retries); /* Decide if we've had enough */ if(state->retries > state->retry_max) { state->error = TFTP_ERR_TIMEOUT; @@ -798,10 +812,9 @@ static CURLcode tftp_tx(tftp_state_data_t *state, tftp_event_t event) state->state = TFTP_STATE_FIN; setpacketevent(&state->spacket, TFTP_EVENT_ERROR); setpacketblock(&state->spacket, state->block); - sbytes = sendto(state->sockfd, (void *)state->spacket.data, - 4, SEND_4TH_ARG, - (struct sockaddr *)&state->remote_addr, - state->remote_addrlen); + (void)sendto(state->sockfd, (void *)state->spacket.data, 4, SEND_4TH_ARG, + (struct sockaddr *)&state->remote_addr, + state->remote_addrlen); /* don't bother with the return code, but if the socket is still up we * should be a good TFTP client and let the server know we're done */ state->state = TFTP_STATE_FIN; @@ -1025,7 +1038,7 @@ static CURLcode tftp_connect(struct connectdata *conn, bool *done) * **********************************************************/ static CURLcode tftp_done(struct connectdata *conn, CURLcode status, - bool premature) + bool premature) { CURLcode code = CURLE_OK; tftp_state_data_t *state = (tftp_state_data_t *)conn->proto.tftpc; @@ -1049,7 +1062,7 @@ static CURLcode tftp_done(struct connectdata *conn, CURLcode status, * **********************************************************/ static int tftp_getsock(struct connectdata *conn, curl_socket_t *socks, - int numsocks) + int numsocks) { if(!numsocks) return GETSOCK_BLANK; @@ -1078,11 +1091,11 @@ static CURLcode tftp_receive_packet(struct connectdata *conn) /* Receive the packet */ fromlen = sizeof(fromaddr); state->rbytes = (int)recvfrom(state->sockfd, - (void *)state->rpacket.data, - state->blksize+4, - 0, - (struct sockaddr *)&fromaddr, - &fromlen); + (void *)state->rpacket.data, + state->blksize+4, + 0, + (struct sockaddr *)&fromaddr, + &fromlen); if(state->remote_addrlen==0) { memcpy(&state->remote_addr, &fromaddr, fromlen); state->remote_addrlen = fromlen; @@ -1102,10 +1115,10 @@ static CURLcode tftp_receive_packet(struct connectdata *conn) case TFTP_EVENT_DATA: /* Don't pass to the client empty or retransmitted packets */ if(state->rbytes > 4 && - ((state->block+1) == getrpacketblock(&state->rpacket))) { + (NEXT_BLOCKNUM(state->block) == getrpacketblock(&state->rpacket))) { result = Curl_client_write(conn, CLIENTWRITE_BODY, - (char *)state->rpacket.data+4, - state->rbytes-4); + (char *)state->rpacket.data+4, + state->rbytes-4); if(result) { tftp_state_machine(state, TFTP_EVENT_ERROR); return result; @@ -1122,8 +1135,8 @@ static CURLcode tftp_receive_packet(struct connectdata *conn) break; case TFTP_EVENT_OACK: result = tftp_parse_option_ack(state, - (const char *)state->rpacket.data+2, - state->rbytes-2); + (const char *)state->rpacket.data+2, + state->rbytes-2); if(result) return result; break; @@ -1164,17 +1177,18 @@ static long tftp_state_timeout(struct connectdata *conn, tftp_event_t *event) (long)current, (long)state->max_time)); state->error = TFTP_ERR_TIMEOUT; state->state = TFTP_STATE_FIN; - return(0); + return 0; } else if (current > state->rx_time+state->retry_time) { if (event) *event = TFTP_EVENT_TIMEOUT; time(&state->rx_time); /* update even though we received nothing */ - return(state->max_time-current); - } - else { - return(state->max_time-current); } + + /* there's a typecast below here since 'time_t' may in fact be larger than + 'long', but we estimate that a 'long' will still be able to hold number + of seconds even if "only" 32 bit */ + return (long)(state->max_time - current); } @@ -1192,7 +1206,7 @@ static CURLcode tftp_easy_statemach(struct connectdata *conn) CURLcode result = CURLE_OK; struct SessionHandle *data = conn->data; tftp_state_data_t *state = (tftp_state_data_t *)conn->proto.tftpc; - int fd_read; + curl_socket_t fd_read; long timeout_ms; struct SingleRequest *k = &data->req; struct timeval transaction_start = Curl_tvnow(); @@ -1244,11 +1258,11 @@ static CURLcode tftp_easy_statemach(struct connectdata *conn) /* Force a progress callback if it's been too long */ if (Curl_tvdiff(k->now, k->start) >= data->set.timeout) { - if(Curl_pgrsUpdate(conn)) { - tftp_state_machine(state, TFTP_EVENT_ERROR); - return CURLE_ABORTED_BY_CALLBACK; - } - k->start = k->now; + if(Curl_pgrsUpdate(conn)) { + tftp_state_machine(state, TFTP_EVENT_ERROR); + return CURLE_ABORTED_BY_CALLBACK; + } + k->start = k->now; } if(rc == -1) { @@ -1275,7 +1289,7 @@ static CURLcode tftp_easy_statemach(struct connectdata *conn) else { result = tftp_receive_packet(conn); if (result == CURLE_OK) - transaction_start = Curl_tvnow(); + transaction_start = Curl_tvnow(); if(k->bytecountp) *k->bytecountp = k->bytecount; /* read count */ @@ -1296,7 +1310,7 @@ static CURLcode tftp_easy_statemach(struct connectdata *conn) } /* Tell curl we're done */ - result = Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL); + Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL); return(result); } @@ -1330,7 +1344,7 @@ static CURLcode tftp_multi_statemach(struct connectdata *conn, bool *done) *done = (bool)(state->state == TFTP_STATE_FIN); if(*done) /* Tell curl we're done */ - result = Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL); + Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL); } else { /* no timeouts to handle, check our socket */ @@ -1352,7 +1366,7 @@ static CURLcode tftp_multi_statemach(struct connectdata *conn, bool *done) *done = (bool)(state->state == TFTP_STATE_FIN); if(*done) /* Tell curl we're done */ - result = Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL); + Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL); } /* if rc == 0, then select() timed out */ } @@ -1447,7 +1461,7 @@ static CURLcode tftp_do(struct connectdata *conn, bool *done) /* If tftp_perform() returned an error, use that for return code. If it was OK, see if tftp_translate_code() has an error. */ - if (code == CURLE_OK) + if (code == CURLE_OK) /* If we have encountered an internal tftp error, translate it. */ code = tftp_translate_code(state->error); diff --git a/lib/transfer.c b/lib/transfer.c index 2d504050..78bd7f19 100644 --- a/lib/transfer.c +++ b/lib/transfer.c @@ -103,6 +103,7 @@ #include "multiif.h" #include "easyif.h" /* for Curl_convert_to_network prototype */ #include "rtsp.h" +#include "connect.h" #define _MPRINTF_REPLACE /* use our functions only */ #include <curl/mprintf.h> @@ -194,7 +195,8 @@ CURLcode Curl_fillreadbuffer(struct connectdata *conn, int bytes, int *nreadp) /* \n will become \r\n later on */ endofline_native = "\n"; endofline_network = "\x0a"; - } else { + } + else { endofline_native = "\r\n"; endofline_network = "\x0d\x0a"; } @@ -219,21 +221,20 @@ CURLcode Curl_fillreadbuffer(struct connectdata *conn, int bytes, int *nreadp) if(data->set.prefer_ascii) { /* translate the protocol and data */ length = nread; - } else { + } + else { /* just translate the protocol portion */ length = strlen(hexbuffer); } res = Curl_convert_to_network(data, data->req.upload_fromhere, length); /* Curl_convert_to_network calls failf if unsuccessful */ - if(res != CURLE_OK) { + if(res) return(res); - } #endif /* CURL_DOES_CONVERSIONS */ - if((nread - hexlen) == 0) { + if((nread - hexlen) == 0) /* mark this as done once this chunk is transfered */ data->req.upload_done = TRUE; - } nread+=(int)strlen(endofline_native); /* for the added end of line */ } @@ -340,11 +341,11 @@ static void read_rewind(struct connectdata *conn, show = CURLMIN(conn->buf_len - conn->read_pos, sizeof(buf)-1); if(conn->master_buffer) { - memcpy(buf, conn->master_buffer + conn->read_pos, show); - buf[show] = '\0'; + memcpy(buf, conn->master_buffer + conn->read_pos, show); + buf[show] = '\0'; } else { - buf[0] = '\0'; + buf[0] = '\0'; } DEBUGF(infof(conn->data, @@ -376,12 +377,11 @@ static CURLcode readwrite_data(struct SessionHandle *data, *done = FALSE; /* This is where we loop until we have read everything there is to - read or we get a EWOULDBLOCK */ + read or we get a CURLE_AGAIN */ do { size_t buffersize = data->set.buffer_size? data->set.buffer_size : BUFSIZE; size_t bytestoread = buffersize; - int readrc; if(k->size != -1 && !k->header) { /* make sure we don't read "too much" if we can help it since we @@ -394,15 +394,12 @@ static CURLcode readwrite_data(struct SessionHandle *data, if(bytestoread) { /* receive data from the network! */ - readrc = Curl_read(conn, conn->sockfd, k->buf, bytestoread, &nread); + result = Curl_read(conn, conn->sockfd, k->buf, bytestoread, &nread); - /* subzero, this would've blocked */ - if(0 > readrc) + /* read would've blocked */ + if(CURLE_AGAIN == result) break; /* get out of loop */ - /* get the CURLcode from the int */ - result = (CURLcode)readrc; - if(result>0) return result; } @@ -598,9 +595,12 @@ static CURLcode readwrite_data(struct SessionHandle *data, dataleft = conn->chunk.dataleft; if(dataleft != 0) { - infof(conn->data, "Leftovers after chunking. " - " Rewinding %zu bytes\n",dataleft); - read_rewind(conn, dataleft); + infof(conn->data, "Leftovers after chunking: %zu bytes", dataleft); + if(conn->data->multi && Curl_multi_canPipeline(conn->data->multi)) { + /* only attempt the rewind if we truly are pipelining */ + infof(conn->data, "Rewinding %zu bytes\n",dataleft); + read_rewind(conn, dataleft); + } } } /* If it returned OK, we just keep going */ @@ -623,22 +623,22 @@ static CURLcode readwrite_data(struct SessionHandle *data, /* The 'excess' amount below can't be more than BUFSIZE which always will fit in a size_t */ infof(data, - "Rewinding stream by : %zu" - " bytes on url %s (size = %" FORMAT_OFF_T - ", maxdownload = %" FORMAT_OFF_T - ", bytecount = %" FORMAT_OFF_T ", nread = %zd)\n", - excess, data->state.path, - k->size, k->maxdownload, k->bytecount, nread); + "Rewinding stream by : %zu" + " bytes on url %s (size = %" FORMAT_OFF_T + ", maxdownload = %" FORMAT_OFF_T + ", bytecount = %" FORMAT_OFF_T ", nread = %zd)\n", + excess, data->state.path, + k->size, k->maxdownload, k->bytecount, nread); read_rewind(conn, excess); } else { infof(data, - "Excess found in a non pipelined read:" - " excess = %zu" - ", size = %" FORMAT_OFF_T - ", maxdownload = %" FORMAT_OFF_T - ", bytecount = %" FORMAT_OFF_T "\n", - excess, k->size, k->maxdownload, k->bytecount); + "Excess found in a non pipelined read:" + " excess = %zu" + ", size = %" FORMAT_OFF_T + ", maxdownload = %" FORMAT_OFF_T + ", bytecount = %" FORMAT_OFF_T "\n", + excess, k->size, k->maxdownload, k->bytecount); } } @@ -738,7 +738,7 @@ static CURLcode readwrite_data(struct SessionHandle *data, /* Parse the excess data */ k->str += nread; - nread = excess; + nread = (ssize_t)excess; result = Curl_rtsp_rtp_readwrite(data, conn, &nread, &readmore); if(result) @@ -815,6 +815,9 @@ static CURLcode readwrite_upload(struct SessionHandle *data, k->keepon &= ~KEEP_SEND; /* disable writing */ k->start100 = Curl_tvnow(); /* timeout count starts now */ *didwhat &= ~KEEP_SEND; /* we didn't write anything actually */ + + /* set a timeout for the multi interface */ + Curl_expire(data, CURL_TIMEOUT_EXPECT_100); break; } @@ -994,7 +997,7 @@ CURLcode Curl_readwrite(struct connectdata *conn, status is not known. */ select_res = Curl_socket_ready(fd_read, fd_write, 0); - if(select_res == CURL_CSELECT_ERR) { + if(select_res & CURL_CSELECT_ERR) { failf(data, "select/poll returned error"); return CURLE_SEND_ERROR; } @@ -1061,16 +1064,17 @@ CURLcode Curl_readwrite(struct connectdata *conn, return result; if(k->keepon) { - if(data->set.timeout && - (Curl_tvdiff(k->now, k->start) >= data->set.timeout)) { + if(0 > Curl_timeleft(conn, &k->now, FALSE)) { if(k->size != -1) { failf(data, "Operation timed out after %ld milliseconds with %" FORMAT_OFF_T " out of %" FORMAT_OFF_T " bytes received", - Curl_tvdiff(k->now, k->start), k->bytecount, k->size); - } else { + Curl_tvdiff(k->now, data->progress.t_startsingle), k->bytecount, + k->size); + } + else { failf(data, "Operation timed out after %ld milliseconds with %" FORMAT_OFF_T " bytes received", - Curl_tvdiff(k->now, k->start), k->bytecount); + Curl_tvdiff(k->now, data->progress.t_startsingle), k->bytecount); } return CURLE_OPERATION_TIMEDOUT; } @@ -1225,7 +1229,7 @@ long Curl_sleep_time(curl_off_t rate_bps, curl_off_t cur_rate_bps, */ if(rv > 0x7fffffff) rv = 0x7fffffff; - + return (long)rv; } @@ -1343,12 +1347,10 @@ Transfer(struct connectdata *conn) to work with, skip the timeout */ timeout_ms = 0; else { - if(data->set.timeout) { - totmp = (int)(data->set.timeout - Curl_tvdiff(k->now, k->start)); - if(totmp < 0) - return CURLE_OPERATION_TIMEDOUT; - } - else + totmp = Curl_timeleft(conn, &k->now, FALSE); + if(totmp < 0) + return CURLE_OPERATION_TIMEDOUT; + else if(!totmp) totmp = 1000; if (totmp < timeout_ms) @@ -1433,6 +1435,12 @@ CURLcode Curl_pretransfer(struct SessionHandle *data) Curl_initinfo(data); /* reset session-specific information "variables" */ Curl_pgrsStartNow(data); + if(data->set.timeout) + Curl_expire(data, data->set.timeout); + + if(data->set.connecttimeout) + Curl_expire(data, data->set.connecttimeout); + return CURLE_OK; } @@ -2009,12 +2017,7 @@ CURLcode Curl_retry_request(struct connectdata *conn, return CURLE_OK; } -/* - * Curl_perform() is the internal high-level function that gets called by the - * external curl_easy_perform() function. It inits, performs and cleans up a - * single file transfer. - */ -CURLcode Curl_perform(struct SessionHandle *data) +static CURLcode Curl_do_perform(struct SessionHandle *data) { CURLcode res; CURLcode res2; @@ -2049,6 +2052,15 @@ CURLcode Curl_perform(struct SessionHandle *data) res = Curl_do(&conn, &do_done); if(res == CURLE_OK) { + if(conn->data->set.wildcardmatch) { + if(conn->data->wildcard.state == CURLWC_DONE || + conn->data->wildcard.state == CURLWC_SKIP) { + /* keep connection open for application to use the socket */ + conn->bits.close = FALSE; + res = Curl_done(&conn, CURLE_OK, FALSE); + break; + } + } res = Transfer(conn); /* now fetch that URL please */ if((res == CURLE_OK) || (res == CURLE_RECV_ERROR)) { bool retry = FALSE; @@ -2056,13 +2068,12 @@ CURLcode Curl_perform(struct SessionHandle *data) if(rc) res = rc; else - retry = (bool)(newurl?TRUE:FALSE); + retry = (newurl?TRUE:FALSE); if(retry) { + /* we know (newurl != NULL) at this point */ res = CURLE_OK; follow = FOLLOW_RETRY; - if (!newurl) - res = CURLE_OUT_OF_MEMORY; } else if (res == CURLE_OK) { /* @@ -2113,9 +2124,9 @@ CURLcode Curl_perform(struct SessionHandle *data) /* Curl_do() failed, clean up left-overs in the done-call, but note that at some cases the conn pointer is NULL when Curl_do() failed and the connection cache is very small so only call Curl_done() if - conn is still "alive". - */ - res2 = Curl_done(&conn, res, FALSE); + conn is still "alive". */ + /* ignore return code since we already have an error to return */ + (void)Curl_done(&conn, res, FALSE); /* * Important: 'conn' cannot be used here, since it may have been closed @@ -2166,10 +2177,43 @@ CURLcode Curl_perform(struct SessionHandle *data) } /* + * Curl_perform() is the internal high-level function that gets called by the + * external curl_easy_perform() function. It inits, performs and cleans up a + * single file transfer. + */ +CURLcode Curl_perform(struct SessionHandle *data) +{ + CURLcode res; + if(!data->set.wildcardmatch) + return Curl_do_perform(data); + + /* init main wildcard structures */ + res = Curl_wildcard_init(&data->wildcard); + if(res) + return res; + + res = Curl_do_perform(data); + if(res) { + Curl_wildcard_dtor(&data->wildcard); + return res; + } + + /* wildcard loop */ + while(!res && data->wildcard.state != CURLWC_DONE) + res = Curl_do_perform(data); + + Curl_wildcard_dtor(&data->wildcard); + + /* wildcard download finished or failed */ + data->wildcard.state = CURLWC_INIT; + return res; +} + +/* * Curl_setup_transfer() is called to setup some basic properties for the * upcoming transfer. */ -CURLcode +void Curl_setup_transfer( struct connectdata *conn, /* connection data */ int sockindex, /* socket index to read from or -1 */ @@ -2214,9 +2258,8 @@ Curl_setup_transfer( /* we want header and/or body, if neither then don't do this! */ if(k->getheader || !data->set.opt_no_body) { - if(conn->sockfd != CURL_SOCKET_BAD) { + if(conn->sockfd != CURL_SOCKET_BAD) k->keepon |= KEEP_RECV; - } if(conn->writesockfd != CURL_SOCKET_BAD) { /* HTTP 1.1 magic: @@ -2233,6 +2276,9 @@ Curl_setup_transfer( /* wait with write until we either got 100-continue or a timeout */ k->exp100 = EXP100_AWAITING_CONTINUE; k->start100 = k->start; + + /* set a timeout for the multi interface */ + Curl_expire(data, CURL_TIMEOUT_EXPECT_100); } else { if(data->state.expect100header) @@ -2246,5 +2292,4 @@ Curl_setup_transfer( } /* if(conn->writesockfd != CURL_SOCKET_BAD) */ } /* if(k->getheader || !data->set.opt_no_body) */ - return CURLE_OK; } diff --git a/lib/transfer.h b/lib/transfer.h index 4c2bc9e0..790e1e3e 100644 --- a/lib/transfer.h +++ b/lib/transfer.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -49,7 +49,7 @@ CURLcode Curl_reconnect_request(struct connectdata **connp); CURLcode Curl_retry_request(struct connectdata *conn, char **url); /* This sets up a forthcoming transfer */ -CURLcode +void Curl_setup_transfer (struct connectdata *data, int sockindex, /* socket index to read from or -1 */ curl_off_t size, /* -1 if unknown at this point */ @@ -137,6 +137,8 @@ void idn_free (void *ptr); /* prototype from idn-free.h, not provided by #include "http_ntlm.h" #include "socks.h" #include "rtsp.h" +#include "curl_rtmp.h" +#include "gopher.h" #define _MPRINTF_REPLACE /* use our functions only */ #include <curl/mprintf.h> @@ -150,11 +152,6 @@ static long ConnectionKillOne(struct SessionHandle *data); static void conn_free(struct connectdata *conn); static void signalPipeClose(struct curl_llist *pipeline, bool pipe_broke); -#ifdef CURL_DISABLE_VERBOSE_STRINGS -#define verboseconnect(x) do { } while (0) -#endif - - /* * Protocol table. */ @@ -187,11 +184,11 @@ static const struct Curl_handler * const protocols[] = { #ifndef CURL_DISABLE_LDAP &Curl_handler_ldap, -#endif - -#if !defined(CURL_DISABLE_LDAP) && defined(HAVE_LDAP_SSL) +#if (defined(USE_OPENLDAP) && defined(USE_SSL)) || \ + (!defined(USE_OPENLDAP) && defined(HAVE_LDAP_SSL)) &Curl_handler_ldaps, #endif +#endif #ifndef CURL_DISABLE_FILE &Curl_handler_file, @@ -231,6 +228,19 @@ static const struct Curl_handler * const protocols[] = { &Curl_handler_rtsp, #endif +#ifndef CURL_DISABLE_GOPHER + &Curl_handler_gopher, +#endif + +#ifdef USE_LIBRTMP + &Curl_handler_rtmp, + &Curl_handler_rtmpt, + &Curl_handler_rtmpe, + &Curl_handler_rtmpte, + &Curl_handler_rtmps, + &Curl_handler_rtmpts, +#endif + (struct Curl_handler *) NULL }; @@ -471,10 +481,20 @@ CURLcode Curl_close(struct SessionHandle *data) } #endif + Curl_expire(data, 0); /* shut off timers */ + if(m) /* This handle is still part of a multi handle, take care of this first and detach this handle from there. */ - Curl_multi_rmeasy(data->multi, data); + curl_multi_remove_handle(data->multi, data); + + /* Destroy the timeout list that is held in the easy handle. It is + /normally/ done by curl_multi_remove_handle() but this is "just in + case" */ + if(data->state.timeoutlist) { + Curl_llist_destroy(data->state.timeoutlist, NULL); + data->state.timeoutlist = NULL; + } data->magic = 0; /* force a clear AFTER the possibly enforced removal from the multi handle, since that function uses the magic @@ -690,6 +710,8 @@ CURLcode Curl_init_userdefined(struct UserDefined *set) /* use fread as default function to read input */ set->fread_func = (curl_read_callback)fread; + set->is_fread_set = 0; + set->is_fwrite_set = 0; set->seek_func = ZERO_NULL; set->seek_client = ZERO_NULL; @@ -763,6 +785,10 @@ CURLcode Curl_init_userdefined(struct UserDefined *set) res = setstropt(&set->str[STRING_SSL_CAPATH], (char *) CURL_CA_PATH); #endif + set->wildcardmatch = FALSE; + set->chunk_bgn = ZERO_NULL; + set->chunk_end = ZERO_NULL; + return res; } @@ -831,6 +857,9 @@ CURLcode Curl_open(struct SessionHandle **curl) data->progress.flags |= PGRS_HIDE; data->state.current_speed = -1; /* init to negative == impossible */ + data->wildcard.state = CURLWC_INIT; + data->wildcard.filelist = NULL; + data->set.fnmatch = ZERO_NULL; /* This no longer creates a connection cache here. It is instead made on the first call to curl_easy_perform() or when the handle is added to a multi stack. */ @@ -1390,19 +1419,6 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, data->set.httpversion = va_arg(param, long); break; - case CURLOPT_CUSTOMREQUEST: - /* - * Set a custom string to use as request - */ - result = setstropt(&data->set.str[STRING_CUSTOMREQUEST], - va_arg(param, char *)); - - /* we don't set - data->set.httpreq = HTTPREQ_CUSTOM; - here, we continue as if we were using the already set type - and this just changes the actual request keyword */ - break; - case CURLOPT_HTTPAUTH: /* * Set HTTP Authentication type BITMASK. @@ -1434,6 +1450,21 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, } break; +#endif /* CURL_DISABLE_HTTP */ + + case CURLOPT_CUSTOMREQUEST: + /* + * Set a custom string to use as request + */ + result = setstropt(&data->set.str[STRING_CUSTOMREQUEST], + va_arg(param, char *)); + + /* we don't set + data->set.httpreq = HTTPREQ_CUSTOM; + here, we continue as if we were using the already set type + and this just changes the actual request keyword */ + break; + #ifndef CURL_DISABLE_PROXY case CURLOPT_HTTPPROXYTUNNEL: /* @@ -1478,7 +1509,6 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, data->set.proxyauth = auth; } break; -#endif /* CURL_DISABLE_HTTP */ case CURLOPT_PROXY: /* @@ -1518,7 +1548,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, break; } break; -#endif +#endif /* CURL_DISABLE_PROXY */ #if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI) case CURLOPT_SOCKS5_GSSAPI_SERVICE: @@ -1825,18 +1855,26 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, * Set data write callback */ data->set.fwrite_func = va_arg(param, curl_write_callback); - if(!data->set.fwrite_func) + if(!data->set.fwrite_func) { + data->set.is_fwrite_set = 0; /* When set to NULL, reset to our internal default function */ data->set.fwrite_func = (curl_write_callback)fwrite; + } + else + data->set.is_fwrite_set = 1; break; case CURLOPT_READFUNCTION: /* * Read data callback */ data->set.fread_func = va_arg(param, curl_read_callback); - if(!data->set.fread_func) + if(!data->set.fread_func) { + data->set.is_fread_set = 0; /* When set to NULL, reset to our internal default function */ data->set.fread_func = (curl_read_callback)fread; + } + else + data->set.is_fread_set = 1; break; case CURLOPT_SEEKFUNCTION: /* @@ -2440,6 +2478,25 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, /* Set the user defined RTP write function */ data->set.fwrite_rtp = va_arg(param, curl_write_callback); break; + + case CURLOPT_WILDCARDMATCH: + data->set.wildcardmatch = (bool)(0 != va_arg(param, long)); + break; + case CURLOPT_CHUNK_BGN_FUNCTION: + data->set.chunk_bgn = va_arg(param, curl_chunk_bgn_callback); + break; + case CURLOPT_CHUNK_END_FUNCTION: + data->set.chunk_end = va_arg(param, curl_chunk_end_callback); + break; + case CURLOPT_FNMATCH_FUNCTION: + data->set.fnmatch = va_arg(param, curl_fnmatch_callback); + break; + case CURLOPT_CHUNK_DATA: + data->wildcard.customptr = va_arg(param, void *); + break; + case CURLOPT_FNMATCH_DATA: + data->set.fnmatch_data = va_arg(param, void *); + break; default: /* unknown tag and its companion, just ignore: */ result = CURLE_FAILED_INIT; /* correct this */ @@ -2524,7 +2581,6 @@ CURLcode Curl_disconnect(struct connectdata *conn) NULL, Curl_scan_cache_used); #endif - Curl_expire(data, 0); /* shut off timers */ Curl_hostcache_prune(data); /* kill old DNS cache entries */ { @@ -2643,11 +2699,10 @@ static bool RTSPConnIsDead(struct connectdata *check) } else if (sval & CURL_CSELECT_IN) { /* readable with no error. could be closed or could be alive */ - long connectinfo = 0; - Curl_getconnectinfo(check->data, &connectinfo, &check); - if(connectinfo != -1) { + curl_socket_t connectinfo = + Curl_getconnectinfo(check->data, &check); + if(connectinfo != CURL_SOCKET_BAD) ret_val = FALSE; - } } return ret_val; @@ -3085,7 +3140,7 @@ ConnectionStore(struct SessionHandle *data, /* after a TCP connection to the proxy has been verified, this function does the next magic step. - Note: this function (and its sub-functions) calls failf() + Note: this function's sub-functions call failf() */ CURLcode Curl_connected_proxy(struct connectdata *conn) @@ -3093,12 +3148,6 @@ CURLcode Curl_connected_proxy(struct connectdata *conn) CURLcode result = CURLE_OK; struct SessionHandle *data = conn->data; - if(conn->bits.tcpconnect) - /* allow this to get called again from the multi interface when TCP is - found connected in the state machine, even though it has already been - called if the connection happened "instantly" */ - return CURLE_OK; - switch(data->set.proxytype) { #ifndef CURL_DISABLE_PROXY case CURLPROXY_SOCKS5: @@ -3169,11 +3218,12 @@ static CURLcode ConnectPlease(struct SessionHandle *data, * verboseconnect() displays verbose information after a connect */ #ifndef CURL_DISABLE_VERBOSE_STRINGS -static void verboseconnect(struct connectdata *conn) +void Curl_verboseconnect(struct connectdata *conn) { - infof(conn->data, "Connected to %s (%s) port %ld (#%ld)\n", - conn->bits.proxy ? conn->proxy.dispname : conn->host.dispname, - conn->ip_addr_str, conn->port, conn->connectindex); + if(conn->data->set.verbose) + infof(conn->data, "Connected to %s (%s) port %ld (#%ld)\n", + conn->bits.proxy ? conn->proxy.dispname : conn->host.dispname, + conn->ip_addr_str, conn->port, conn->connectindex); } #endif @@ -3264,9 +3314,7 @@ CURLcode Curl_protocol_connect(struct connectdata *conn, if(!conn->bits.tcpconnect) { Curl_pgrsTime(data, TIMER_CONNECT); /* connect done */ - - if(data->set.verbose) - verboseconnect(conn); + Curl_verboseconnect(conn); } if(!conn->bits.protoconnstart) { @@ -4133,7 +4181,7 @@ static CURLcode parse_url_userpass(struct SessionHandle *data, * set user/passwd, but doing that first adds more cases here :-( */ - conn->bits.userpwd_in_url = 1; + conn->bits.userpwd_in_url = TRUE; if(data->set.use_netrc != CURL_NETRC_REQUIRED) { /* We could use the one in the URL */ @@ -4224,18 +4272,23 @@ static CURLcode parse_remote_port(struct SessionHandle *data, if(conn->bits.httpproxy) { /* we need to create new URL with the new port number */ char *url; - /* FTPS connections have the FTP bit set too, so they match as well */ - bool isftp = (bool)(0 != (conn->protocol & PROT_FTP)); + char type[12]=""; + + if(conn->bits.type_set) + snprintf(type, sizeof(type), ";type=%c", + data->set.prefer_ascii?'A': + (data->set.ftp_list_only?'D':'I')); /* - * This synthesized URL isn't always right--suffixes like ;type=A - * are stripped off. It would be better to work directly from the - * original URL and simply replace the port part of it. + * This synthesized URL isn't always right--suffixes like ;type=A are + * stripped off. It would be better to work directly from the original + * URL and simply replace the port part of it. */ - url = aprintf("%s://%s%s%s:%hu%s%s", conn->handler->scheme, + url = aprintf("%s://%s%s%s:%hu%s%s%s", conn->handler->scheme, conn->bits.ipv6_ip?"[":"", conn->host.name, conn->bits.ipv6_ip?"]":"", conn->remote_port, - isftp?"/":"", data->state.path); + data->state.slash_removed?"/":"", data->state.path, + type); if(!url) return CURLE_OUT_OF_MEMORY; @@ -4267,6 +4320,11 @@ static CURLcode parse_remote_port(struct SessionHandle *data, *portptr = '\0'; /* cut off the name there */ conn->remote_port = curlx_ultous(port); } + else if(!port) + /* Browser behavior adaptation. If there's a colon with no digits after, + just cut off the name there which makes us ignore the colon and just + use the default port. Firefox and Chrome both do that. */ + *portptr = '\0'; } return CURLE_OK; } @@ -4347,30 +4405,7 @@ static CURLcode resolve_server(struct SessionHandle *data, bool *async) { CURLcode result=CURLE_OK; - long shortest = 0; /* default to no timeout */ - - /************************************************************* - * Set timeout if that is being used - *************************************************************/ - if(data->set.timeout || data->set.connecttimeout) { - - /* We set the timeout on the name resolving phase first, separately from - * the download/upload part to allow a maximum time on everything. This is - * a signal-based timeout, why it won't work and shouldn't be used in - * multi-threaded environments. */ - - shortest = data->set.timeout; /* default to this timeout value */ - if(shortest && data->set.connecttimeout && - (data->set.connecttimeout < shortest)) - /* if both are set, pick the shortest */ - shortest = data->set.connecttimeout; - else if(!shortest) - /* if timeout is not set, use the connect timeout */ - shortest = data->set.connecttimeout; - /* We can expect the conn->created time to be "now", as that was just - recently set in the beginning of this function and nothing slow - has been done since then until now. */ - } + long timeout_ms = Curl_timeleft(conn, NULL, TRUE); /************************************************************* * Resolve the name of the server or proxy @@ -4397,7 +4432,7 @@ static CURLcode resolve_server(struct SessionHandle *data, /* Resolve target host right on */ rc = Curl_resolv_timeout(conn, conn->host.name, (int)conn->port, - &hostaddr, shortest); + &hostaddr, timeout_ms); if(rc == CURLRESOLV_PENDING) *async = TRUE; @@ -4418,7 +4453,7 @@ static CURLcode resolve_server(struct SessionHandle *data, /* resolve proxy */ rc = Curl_resolv_timeout(conn, conn->proxy.name, (int)conn->port, - &hostaddr, shortest); + &hostaddr, timeout_ms); if(rc == CURLRESOLV_PENDING) *async = TRUE; @@ -4707,7 +4742,7 @@ static CURLcode create_conn(struct SessionHandle *data, proxy = NULL; } /* proxy must be freed later unless NULL */ - if(proxy && *proxy) { + if(proxy) { long bits = conn->protocol & (PROT_HTTPS|PROT_SSL); if((conn->proxytype == CURLPROXY_HTTP) || @@ -4750,6 +4785,11 @@ static CURLcode create_conn(struct SessionHandle *data, return result; } + conn->recv[FIRSTSOCKET] = Curl_recv_plain; + conn->send[FIRSTSOCKET] = Curl_send_plain; + conn->recv[SECONDARYSOCKET] = Curl_recv_plain; + conn->send[SECONDARYSOCKET] = Curl_send_plain; + /*********************************************************************** * file: is a special case in that it doesn't need a network connection ***********************************************************************/ @@ -4779,9 +4819,8 @@ static CURLcode create_conn(struct SessionHandle *data, return result; } - result = Curl_setup_transfer(conn, -1, -1, FALSE, - NULL, /* no download */ - -1, NULL); /* no upload */ + Curl_setup_transfer(conn, -1, -1, FALSE, NULL, /* no download */ + -1, NULL); /* no upload */ } return result; @@ -4986,8 +5025,8 @@ static CURLcode setup_conn(struct connectdata *conn, Curl_pgrsTime(data, TIMER_APPCONNECT); /* we're connected already */ conn->bits.tcpconnect = TRUE; *protocol_done = TRUE; - if(data->set.verbose) - verboseconnect(conn); + Curl_verboseconnect(conn); + Curl_updateconninfo(conn, conn->sock[FIRSTSOCKET]); } /* Stop the loop now */ break; @@ -5093,8 +5132,6 @@ CURLcode Curl_done(struct connectdata **connp, conn = *connp; data = conn->data; - Curl_expire(data, 0); /* stop timer */ - if(conn->bits.done) /* Stop if Curl_done() has already been called */ return CURLE_OK; @@ -5248,10 +5285,8 @@ static CURLcode do_init(struct connectdata *conn) static void do_complete(struct connectdata *conn) { conn->data->req.chunk=FALSE; - conn->data->req.trailerhdrpresent=FALSE; - conn->data->req.maxfd = (conn->sockfd>conn->writesockfd? - conn->sockfd:conn->writesockfd)+1; + conn->sockfd:conn->writesockfd)+1; } CURLcode Curl_do(struct connectdata **connp, bool *done) @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -86,4 +86,11 @@ void Curl_reset_reqproto(struct connectdata *conn); CURLcode Curl_connected_proxy(struct connectdata *conn); +#ifdef CURL_DISABLE_VERBOSE_STRINGS +#define Curl_verboseconnect(x) do { } while (0) +#else +void Curl_verboseconnect(struct connectdata *conn); +#endif + + #endif diff --git a/lib/urldata.h b/lib/urldata.h index ad172d66..4d605915 100644 --- a/lib/urldata.h +++ b/lib/urldata.h @@ -43,6 +43,10 @@ #define PORT_SMTP 25 #define PORT_SMTPS 465 /* sometimes called SSMTP */ #define PORT_RTSP 554 +#define PORT_RTMP 1935 +#define PORT_RTMPT PORT_HTTP +#define PORT_RTMPS PORT_HTTPS +#define PORT_GOPHER 70 #define DICT_MATCH "/MATCH:" #define DICT_MATCH2 "/M:" @@ -102,6 +106,11 @@ #include <gnutls/gnutls.h> #endif +#ifdef USE_POLARSSL +#include <polarssl/havege.h> +#include <polarssl/ssl.h> +#endif + #ifdef USE_NSS #include <nspr.h> #include <pk11pub.h> @@ -148,6 +157,7 @@ #include "ssh.h" #include "http.h" #include "rtsp.h" +#include "wildcard.h" #ifdef HAVE_GSSAPI # ifdef HAVE_GSSGNU @@ -231,7 +241,18 @@ struct ssl_connect_data { #ifdef USE_GNUTLS gnutls_session session; gnutls_certificate_credentials cred; + ssl_connect_state connecting_state; #endif /* USE_GNUTLS */ +#ifdef USE_POLARSSL + havege_state hs; + ssl_context ssl; + ssl_session ssn; + int server_fd; + x509_cert cacert; + x509_cert clicert; + x509_crl crl; + rsa_context rsa; +#endif /* USE_POLARSSL */ #ifdef USE_NSS PRFileDesc *handle; char *client_nickname; @@ -398,6 +419,7 @@ struct ConnectBits { that libcurl should reconnect and continue. */ bool bound; /* set true if bind() has already been done on this socket/ connection */ + bool type_set; /* type= was used in the URL */ }; struct hostname { @@ -567,9 +589,6 @@ struct SingleRequest { bool forbidchunk; /* used only to explicitly forbid chunk-upload for specific upload buffers. See readmoredata() in http.c for details. */ - bool trailerhdrpresent; /* Set when Trailer: header found in HTTP response. - Required to determine whether to look for trailers - in case of Transfer-Encoding: chunking */ }; /* @@ -632,6 +651,20 @@ struct Curl_handler { long protocol; /* PROT_* flags concerning the protocol set */ }; +/* return the count of bytes sent, or -1 on error */ +typedef ssize_t (Curl_send)(struct connectdata *conn, /* connection data */ + int sockindex, /* socketindex */ + const void *buf, /* data to write */ + size_t len, /* max amount to write */ + CURLcode *err); /* error to return */ + +/* return the count of bytes read, or -1 on error */ +typedef ssize_t (Curl_recv)(struct connectdata *conn, /* connection data */ + int sockindex, /* socketindex */ + char *buf, /* store data here */ + size_t len, /* max amount to read */ + CURLcode *err); /* error to return */ + /* * The connectdata struct contains all fields and variables that should be * unique for an entire connection. @@ -674,13 +707,21 @@ struct connectdata { #define PROT_SMTP CURLPROTO_SMTP #define PROT_SMTPS CURLPROTO_SMTPS #define PROT_RTSP CURLPROTO_RTSP +#define PROT_RTMP CURLPROTO_RTMP +#define PROT_RTMPT CURLPROTO_RTMPT +#define PROT_RTMPE CURLPROTO_RTMPE +#define PROT_RTMPTE CURLPROTO_RTMPTE +#define PROT_RTMPS CURLPROTO_RTMPS +#define PROT_RTMPTS CURLPROTO_RTMPTS +#define PROT_GOPHER CURLPROTO_GOPHER -/* (1<<18) is currently the highest used bit in the public bitmask. We make - sure we use "private bits" above the public ones to make things easier. */ +/* (1<<25) is currently the highest used bit in the public bitmask. We make + sure we use "private bits" above the public ones to make things easier; + Gopher will not conflict with the current bit 25. */ -#define PROT_EXTMASK 0xfffff +#define PROT_EXTMASK 0x03ffffff -#define PROT_SSL (1<<25) /* protocol requires SSL */ +#define PROT_SSL (1<<29) /* protocol requires SSL */ /* these ones need action before socket close */ #define PROT_CLOSEACTION (PROT_FTP | PROT_IMAP | PROT_POP3) @@ -728,6 +769,9 @@ struct connectdata { curl_socket_t sock[2]; /* two sockets, the second is used for the data transfer when doing FTP */ + Curl_recv *recv[2]; + Curl_send *send[2]; + struct ssl_connect_data ssl[2]; /* this is for ssl-stuff */ struct ssl_config_data ssl_config; @@ -762,7 +806,7 @@ struct connectdata { enum protection_level data_prot; enum protection_level request_data_prot; size_t buffer_size; - struct krb4buffer in_buffer, out_buffer; + struct krb4buffer in_buffer; void *app_data; const struct Curl_sec_client_mech *mech; struct sockaddr_in local_addr; @@ -829,6 +873,7 @@ struct connectdata { struct pop3_conn pop3c; struct smtp_conn smtpc; struct rtsp_conn rtspc; + void *generic; } proto; int cselect_bits; /* bitmask of socket events */ @@ -867,6 +912,12 @@ struct PureInfo { char ip[MAX_IPADR_LEN]; /* this buffer gets the numerical ip version stored at the connect *attempt* so it will get the last tried connect IP even on failures */ + long port; /* the remote port the last connection was established to */ + char localip[MAX_IPADR_LEN]; /* this buffer gets the numerical (local) ip + stored from where the last connection was + established */ + long localport; /* the local (src) port the last connection + originated from */ struct curl_certinfo certs; /* info about the certs, only populated in OpenSSL builds. Asked for with CURLOPT_CERTINFO / CURLINFO_CERTINFO */ @@ -1043,6 +1094,7 @@ struct UrlState { #endif /* USE_SSLEAY */ struct timeval expiretime; /* set this with Curl_expire() only */ struct Curl_tree timenode; /* for the splay stuff */ + struct curl_llist *timeoutlist; /* list of pending timeouts */ /* a place to store the most recently set FTP entrypath */ char *most_recent_ftp_entrypath; @@ -1077,7 +1129,8 @@ struct UrlState { char *pathbuffer;/* allocated buffer to store the URL's path part in */ char *path; /* path to use, points to somewhere within the pathbuffer area */ - + bool slash_removed; /* set TRUE if the 'path' points to a path where the + initial URL slash separator has been taken off */ bool use_range; bool rangestringalloc; /* the range string is malloc()'ed */ @@ -1234,6 +1287,8 @@ struct UserDefined { curl_write_callback fwrite_header; /* function that stores headers */ curl_write_callback fwrite_rtp; /* function that stores interleaved RTP */ curl_read_callback fread_func; /* function that reads the input */ + int is_fread_set; /* boolean, has read callback been set to non-NULL? */ + int is_fwrite_set; /* boolean, has write callback been set to non-NULL? */ curl_progress_callback fprogress; /* function for progress information */ curl_debug_callback fdebug; /* function that write informational data */ curl_ioctl_callback ioctl_func; /* function for I/O control */ @@ -1372,6 +1427,13 @@ struct UserDefined { /* Common RTSP header options */ Curl_RtspReq rtspreq; /* RTSP request type */ long rtspversion; /* like httpversion, for RTSP */ + bool wildcardmatch; /* enable wildcard matching */ + curl_chunk_bgn_callback chunk_bgn; /* called before part of transfer starts */ + curl_chunk_end_callback chunk_end; /* called after part transferring + stopped */ + curl_fnmatch_callback fnmatch; /* callback to decide which file corresponds + to pattern (e.g. if WILDCARDMATCH is on) */ + void *fnmatch_data; }; struct Names { @@ -1413,6 +1475,7 @@ struct SessionHandle { struct Progress progress; /* for all the progress meter data */ struct UrlState state; /* struct for fields used for state info and other dynamic purposes */ + struct WildcardData wildcard; /* wildcard download state info */ struct PureInfo info; /* stats, reports and info data */ #if defined(CURL_DOES_CONVERSIONS) && defined(HAVE_ICONV) iconv_t outbound_cd; /* for translating to the network encoding */ diff --git a/lib/vc6libcurl.dsp b/lib/vc6libcurl.dsp new file mode 100644 index 00000000..ee8f6f14 --- /dev/null +++ b/lib/vc6libcurl.dsp @@ -0,0 +1,862 @@ +# Microsoft Developer Studio Project File - Name="libcurl" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+# TARGTYPE "Win32 (x86) Static Library" 0x0104
+
+CFG=libcurl - Win32 LIB Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "libcurl.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "libcurl.mak" CFG="libcurl - Win32 LIB Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "libcurl - Win32 DLL Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "libcurl - Win32 DLL Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "libcurl - Win32 LIB Debug" (based on "Win32 (x86) Static Library")
+!MESSAGE "libcurl - Win32 LIB Release" (based on "Win32 (x86) Static Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+
+!IF "$(CFG)" == "libcurl - Win32 DLL Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "DLL-Debug"
+# PROP BASE Intermediate_Dir "DLL-Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "DLL-Debug"
+# PROP Intermediate_Dir "DLL-Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+CPP=cl.exe
+# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /I "..\include" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "BUILDING_LIBCURL" /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "." /I "..\include" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "BUILDING_LIBCURL" /FD /GZ /c
+MTL=midl.exe
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+RSC=rc.exe
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib ws2_32.lib wldap32.lib /nologo /dll /incremental:no /map /debug /machine:I386 /out:"DLL-Debug/libcurld.dll" /implib:"DLL-Debug/libcurld_imp.lib" /pdbtype:sept
+# ADD LINK32 kernel32.lib ws2_32.lib wldap32.lib /nologo /dll /incremental:no /map /debug /machine:I386 /out:"DLL-Debug/libcurld.dll" /implib:"DLL-Debug/libcurld_imp.lib" /pdbtype:sept
+
+!ELSEIF "$(CFG)" == "libcurl - Win32 DLL Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "DLL-Release"
+# PROP BASE Intermediate_Dir "DLL-Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "DLL-Release"
+# PROP Intermediate_Dir "DLL-Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+CPP=cl.exe
+# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /I "..\include" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "BUILDING_LIBCURL" /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "..\include" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "BUILDING_LIBCURL" /FD /c
+MTL=midl.exe
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+RSC=rc.exe
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib ws2_32.lib wldap32.lib /nologo /dll /pdb:none /machine:I386 /out:"DLL-Release/libcurl.dll" /implib:"DLL-Release/libcurl_imp.lib"
+# ADD LINK32 kernel32.lib ws2_32.lib wldap32.lib /nologo /dll /pdb:none /machine:I386 /out:"DLL-Release/libcurl.dll" /implib:"DLL-Release/libcurl_imp.lib"
+
+!ELSEIF "$(CFG)" == "libcurl - Win32 LIB Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "LIB-Debug"
+# PROP BASE Intermediate_Dir "LIB-Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "LIB-Debug"
+# PROP Intermediate_Dir "LIB-Debug"
+# PROP Target_Dir ""
+CPP=cl.exe
+# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /I "..\include" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "BUILDING_LIBCURL" /D "CURL_STATICLIB" /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "." /I "..\include" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "BUILDING_LIBCURL" /D "CURL_STATICLIB" /FD /GZ /c
+RSC=rc.exe
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo /out:"LIB-Debug/libcurld.lib" /machine:I386
+# ADD LIB32 /nologo /out:"LIB-Debug/libcurld.lib" /machine:I386
+
+!ELSEIF "$(CFG)" == "libcurl - Win32 LIB Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "LIB-Release"
+# PROP BASE Intermediate_Dir "LIB-Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "LIB-Release"
+# PROP Intermediate_Dir "LIB-Release"
+# PROP Target_Dir ""
+CPP=cl.exe
+# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /I "..\include" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "BUILDING_LIBCURL" /D "CURL_STATICLIB" /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "..\include" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "BUILDING_LIBCURL" /D "CURL_STATICLIB" /FD /c
+RSC=rc.exe
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo /out:"LIB-Release/libcurl.lib" /machine:I386
+# ADD LIB32 /nologo /out:"LIB-Release/libcurl.lib" /machine:I386
+
+!ENDIF
+
+# Begin Target
+
+# Name "libcurl - Win32 DLL Debug"
+# Name "libcurl - Win32 DLL Release"
+# Name "libcurl - Win32 LIB Debug"
+# Name "libcurl - Win32 LIB Release"
+# Begin Group "Source Files"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\base64.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\connect.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\content_encoding.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\cookie.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\curl_addrinfo.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\curl_fnmatch.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\curl_gethostname.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\curl_memrchr.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\curl_rand.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\curl_rtmp.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\curl_sspi.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\curl_threads.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\dict.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\easy.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\escape.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\file.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\fileinfo.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\formdata.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\ftp.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\ftplistparser.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\getenv.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\getinfo.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\gopher.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\gtls.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\hash.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\hmac.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\hostares.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\hostasyn.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\hostip4.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\hostip6.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\hostip.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\hostsyn.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\hostthre.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\http.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\http_chunks.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\http_digest.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\http_negotiate.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\http_ntlm.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\if2ip.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\imap.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\inet_ntop.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\inet_pton.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\krb4.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\krb5.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\ldap.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\llist.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\md4.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\md5.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\memdebug.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\mprintf.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\multi.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\netrc.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\nonblock.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\nss.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\openldap.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\parsedate.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\pingpong.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\polarssl.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\pop3.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\progress.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\qssl.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\rawstr.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\rtsp.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\security.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\select.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\sendf.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\share.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\slist.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\smtp.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\socks.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\socks_gssapi.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\socks_sspi.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\speedcheck.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\splay.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\ssh.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\sslgen.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\ssluse.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\strdup.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\strequal.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\strerror.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\strtok.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\strtoofft.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\telnet.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\tftp.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\timeval.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\transfer.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\url.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\version.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\warnless.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\wildcard.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\arpa_telnet.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\config-win32.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\connect.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\content_encoding.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\cookie.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\curl_addrinfo.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\curl_base64.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\curl_fnmatch.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\curl_gethostname.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\curl_hmac.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\curl_ldap.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\curl_md4.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\curl_md5.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\curl_memory.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\curl_memrchr.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\curl_rand.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\curl_rtmp.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\curl_sspi.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\curl_threads.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\curlx.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\dict.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\easyif.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\escape.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\file.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\fileinfo.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\formdata.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ftp.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ftplistparser.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\getinfo.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\gopher.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\gtls.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\hash.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\hostip.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\http_chunks.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\http_digest.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\http.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\http_negotiate.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\http_ntlm.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\if2ip.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\imap.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\inet_ntop.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\inet_pton.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\krb4.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\llist.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\memdebug.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\multiif.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\netrc.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\nonblock.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\nssg.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\parsedate.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\pingpong.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\polarssl.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\pop3.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\progress.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\qssl.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\rawstr.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\rtsp.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\select.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sendf.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\setup.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\setup_once.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\share.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\slist.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\smtp.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sockaddr.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\socks.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\speedcheck.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\splay.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ssh.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sslgen.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ssluse.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\strdup.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\strequal.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\strerror.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\strtok.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\strtoofft.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\telnet.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\tftp.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\timeval.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\transfer.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\urldata.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\url.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\warnless.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\wildcard.h
+# End Source File
+# End Group
+
+# Begin Group "Resource Files"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\libcurl.rc
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/lib/vc6libcurl.dsw b/lib/vc6libcurl.dsw new file mode 100644 index 00000000..1fa8814a --- /dev/null +++ b/lib/vc6libcurl.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "libcurl"=".\vc6libcurl.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/lib/version.c b/lib/version.c index aa86e390..9ba2e33c 100644 --- a/lib/version.c +++ b/lib/version.c @@ -44,6 +44,10 @@ #include <iconv.h> #endif +#ifdef USE_LIBRTMP +#include <librtmp/rtmp.h> +#endif + #ifdef USE_LIBSSH2 #include <libssh2.h> #endif @@ -111,6 +115,26 @@ char *curl_version(void) left -= len; ptr += len; #endif +#ifdef USE_LIBRTMP + { + char suff[2]; + if (RTMP_LIB_VERSION & 0xff) { + suff[0] = (RTMP_LIB_VERSION & 0xff) + 'a' - 1; + suff[1] = '\0'; + } else { + suff[0] = '\0'; + } + len = snprintf(ptr, left, " librtmp/%d.%d%s", + RTMP_LIB_VERSION >> 16, (RTMP_LIB_VERSION >> 8) & 0xff, suff); +/* + If another lib version is added below this one, this code would + also have to do: + + left -= len; + ptr += len; +*/ + } +#endif return version; } @@ -134,6 +158,9 @@ static const char * const protocols[] = { #if defined(USE_SSL) && !defined(CURL_DISABLE_FTP) "ftps", #endif +#ifndef CURL_DISABLE_GOPHER + "gopher", +#endif #ifndef CURL_DISABLE_HTTP "http", #endif @@ -148,16 +175,20 @@ static const char * const protocols[] = { #endif #ifndef CURL_DISABLE_LDAP "ldap", -#endif -#if defined(HAVE_LDAP_SSL) && !defined(CURL_DISABLE_LDAP) +#if (defined(USE_OPENLDAP) && defined(USE_SSL)) || \ + (!defined(USE_OPENLDAP) && defined(HAVE_LDAP_SSL)) "ldaps", #endif +#endif #ifndef CURL_DISABLE_POP3 "pop3", #endif #if defined(USE_SSL) && !defined(CURL_DISABLE_POP3) "pop3s", #endif +#ifdef USE_LIBRTMP + "rtmp", +#endif #ifndef CURL_DISABLE_RTSP "rtsp", #endif diff --git a/lib/wildcard.c b/lib/wildcard.c new file mode 100644 index 00000000..9fe5d513 --- /dev/null +++ b/lib/wildcard.c @@ -0,0 +1,76 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, 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. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" +#include "wildcard.h" +#include "llist.h" +#include "fileinfo.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include <curl/mprintf.h> + +#include "curl_memory.h" +/* The last #include file should be: */ +#include "memdebug.h" + +CURLcode Curl_wildcard_init(struct WildcardData *wc) +{ + DEBUGASSERT(wc->filelist == NULL); + /* now allocate only wc->filelist, everything else + will be allocated if it is needed. */ + wc->filelist = Curl_llist_alloc(Curl_fileinfo_dtor); + if(!wc->filelist) {; + return CURLE_OUT_OF_MEMORY; + } + return CURLE_OK; +} + +void Curl_wildcard_dtor(struct WildcardData *wc) +{ + if(!wc) + return; + + if(wc->tmp_dtor) { + wc->tmp_dtor(wc->tmp); + wc->tmp_dtor = ZERO_NULL; + wc->tmp = NULL; + } + DEBUGASSERT(wc->tmp == NULL); + + if(wc->filelist) { + Curl_llist_destroy(wc->filelist, NULL); + wc->filelist = NULL; + } + + if(wc->path) { + free(wc->path); + wc->path = NULL; + } + + if(wc->pattern) { + free(wc->pattern); + wc->pattern = NULL; + } + + wc->customptr = NULL; + wc->state = CURLWC_INIT; +} diff --git a/lib/wildcard.h b/lib/wildcard.h new file mode 100644 index 00000000..8f732d10 --- /dev/null +++ b/lib/wildcard.h @@ -0,0 +1,58 @@ +#ifndef HEADER_CURL_WILDCARD_H +#define HEADER_CURL_WILDCARD_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 2010, Daniel Stenberg, <daniel@haxx.se>, 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. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include <curl/curl.h> + +/* list of wildcard process states */ +typedef enum { + CURLWC_INIT = 0, + CURLWC_MATCHING, /* library is trying to get list of addresses for + downloading */ + CURLWC_DOWNLOADING, + CURLWC_CLEAN, /* deallocate resources and reset settings */ + CURLWC_SKIP, /* skip over concrete file */ + CURLWC_ERROR, /* error cases */ + CURLWC_DONE /* if is wildcard->state == CURLWC_DONE wildcard loop in + Curl_perform() will end */ +} curl_wildcard_states; + +typedef void (*curl_wildcard_tmp_dtor)(void *ptr); + +/* struct keeping information about wildcard download process */ +struct WildcardData { + curl_wildcard_states state; + char *path; /* path to the directory, where we trying wildcard-match */ + char *pattern; /* wildcard pattern */ + struct curl_llist *filelist; /* llist with struct Curl_fileinfo */ + void *tmp; /* pointer to protocol specific temporary data */ + curl_wildcard_tmp_dtor tmp_dtor; + void *customptr; /* for CURLOPT_CHUNK_DATA pointer */ +}; + +CURLcode Curl_wildcard_init(struct WildcardData *wc); +void Curl_wildcard_dtor(struct WildcardData *wc); + +struct SessionHandle; + +#endif /* HEADER_CURL_WILDCARD_H */ |