Compare commits
104 Commits
curl-7_17_
...
curl-7_17_
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3bc11344de | ||
|
|
3dbe708308 | ||
|
|
621709c623 | ||
|
|
9e241864e3 | ||
|
|
cf613fdba4 | ||
|
|
e6addcf624 | ||
|
|
9e88343a17 | ||
|
|
1ce732e9d6 | ||
|
|
cc618e761c | ||
|
|
24db40de7c | ||
|
|
7350f9851a | ||
|
|
d030dfa6e2 | ||
|
|
14d6db0873 | ||
|
|
0ff311aa1a | ||
|
|
8147c3659d | ||
|
|
73e91ce20c | ||
|
|
8780ff879c | ||
|
|
6fd1cfeab1 | ||
|
|
9d0533056c | ||
|
|
6c4f317f7f | ||
|
|
21ed69b51e | ||
|
|
3b819b3064 | ||
|
|
3fa60164af | ||
|
|
ac6e0501c6 | ||
|
|
4f17c58315 | ||
|
|
f6251734fc | ||
|
|
9f44a95522 | ||
|
|
4b60c3e9d3 | ||
|
|
5d4c981e13 | ||
|
|
da4a776758 | ||
|
|
1b66c1da6c | ||
|
|
5cb2ee878c | ||
|
|
8cf0814a14 | ||
|
|
523767660c | ||
|
|
327c0d6b1c | ||
|
|
870842ccee | ||
|
|
68b215157f | ||
|
|
a892cf2c12 | ||
|
|
7cba40b218 | ||
|
|
d994fcf2b1 | ||
|
|
975fafdc49 | ||
|
|
9537580ba2 | ||
|
|
bc0adcef1f | ||
|
|
7ffae92daf | ||
|
|
abca03cf36 | ||
|
|
374f0214b6 | ||
|
|
4945b2454d | ||
|
|
a5cb022407 | ||
|
|
feb63efc31 | ||
|
|
4cf3ad07e5 | ||
|
|
557cc55f6f | ||
|
|
2d8dba388b | ||
|
|
91fd2c3bcd | ||
|
|
d38891c950 | ||
|
|
381e372939 | ||
|
|
c347db2e0a | ||
|
|
232a4553b8 | ||
|
|
014f1bea9a | ||
|
|
5b4f50857a | ||
|
|
6f10a718e4 | ||
|
|
658de40930 | ||
|
|
2c06e7f8ef | ||
|
|
fa1c916943 | ||
|
|
b132e865b9 | ||
|
|
77431568d2 | ||
|
|
e16c1b8e28 | ||
|
|
1a8d8aa227 | ||
|
|
d4c4fd6272 | ||
|
|
acb905231d | ||
|
|
c915eac93c | ||
|
|
72e675caee | ||
|
|
e347cff0e4 | ||
|
|
d79fdbc46e | ||
|
|
ab13c2f814 | ||
|
|
138ca334f9 | ||
|
|
1aa82decea | ||
|
|
014fe6971e | ||
|
|
3217809294 | ||
|
|
f3c7adcb54 | ||
|
|
dcf698dc74 | ||
|
|
54117be639 | ||
|
|
5a79532aee | ||
|
|
29ac001aa6 | ||
|
|
ccba0d10b6 | ||
|
|
7f7e42732d | ||
|
|
ca410ec2ca | ||
|
|
e5d8693865 | ||
|
|
46c92c0b80 | ||
|
|
7b5d148b1f | ||
|
|
f4bc326670 | ||
|
|
327598e7b4 | ||
|
|
11caaad5f9 | ||
|
|
3e0845e182 | ||
|
|
a2c7abea6c | ||
|
|
2f8f12e82e | ||
|
|
5cdcc2b3aa | ||
|
|
652e2cf57c | ||
|
|
8ee5e95ab1 | ||
|
|
22c61d8da6 | ||
|
|
1b88990cbb | ||
|
|
df3e8e19c1 | ||
|
|
44dc36cc8f | ||
|
|
6d3701318d | ||
|
|
d0edb47896 |
159
CHANGES
159
CHANGES
@@ -6,6 +6,165 @@
|
||||
|
||||
Changelog
|
||||
|
||||
Version 7.17.0 (13 September 2007)
|
||||
|
||||
Daniel S (12 September 2007)
|
||||
- Bug report #1792649 (http://curl.haxx.se/bug/view.cgi?id=1792649) pointed
|
||||
out a problem with doing an empty upload over FTP on a re-used connection.
|
||||
I added test case 541 to reproduce it and to verify the fix.
|
||||
|
||||
- I noticed while writing test 541 that the FTP code wrongly did a CWD on the
|
||||
second transfer as it didn't store and remember the "" path from the
|
||||
previous transfer so it would instead CWD to the entry path as stored. This
|
||||
worked, but did a superfluous command. Thus, test case 541 now also verifies
|
||||
this fix.
|
||||
|
||||
Dan F (5 September 2007)
|
||||
- Added test case 1007 to test permission problem when uploading with TFTP
|
||||
(to validate bug #1790403).
|
||||
|
||||
- TFTP now reports the "not defined" TFTP error code 0 as an error,
|
||||
not success.
|
||||
|
||||
Daniel S (5 September 2007)
|
||||
- Continued the work on a fix for #1779054
|
||||
(http://curl.haxx.se/bug/view.cgi?id=1779054). My previous fix from August
|
||||
24 was not complete (either) but could accidentally "forget" parts of a
|
||||
server response which led to faulty server response time-out errors.
|
||||
|
||||
Dan F (5 September 2007)
|
||||
- Minix doesn't support getsockopt on UDP sockets or send/recv on TCP
|
||||
sockets.
|
||||
|
||||
Dan F (31 August 2007)
|
||||
- Made some of the error strings returned by the *strerror functions more
|
||||
generic, and more consistent with each other.
|
||||
|
||||
- Renamed the curl_ftpssl enum to curl_usessl and its enumerated constants,
|
||||
creating macros for backward compatibility:
|
||||
|
||||
CURLFTPSSL_NONE => CURLUSESSL_NONE
|
||||
CURLFTPSSL_TRY => CURLUSESSL_TRY
|
||||
CURLFTPSSL_CONTROL => CURLUSESSL_CONTROL
|
||||
CURLFTPSSL_ALL => CURLUSESSL_ALL
|
||||
CURLFTPSSL_LAST => CURLUSESSL_LAST
|
||||
|
||||
Dan F (30 August 2007)
|
||||
- Renamed several libcurl error codes and options to make them more general
|
||||
and allow reuse by multiple protocols. Several unused error codes were
|
||||
removed. In all cases, macros were added to preserve source (and binary)
|
||||
compatibility with the old names. These macros are subject to removal at
|
||||
a future date, but probably not before 2009. An application can be
|
||||
tested to see if it is using any obsolete code by compiling it with the
|
||||
CURL_NO_OLDIES macro defined.
|
||||
|
||||
The following unused error codes were removed:
|
||||
|
||||
CURLE_BAD_CALLING_ORDER
|
||||
CURLE_BAD_PASSWORD_ENTERED
|
||||
CURLE_FTP_CANT_RECONNECT
|
||||
CURLE_FTP_COULDNT_GET_SIZE
|
||||
CURLE_FTP_COULDNT_SET_ASCII
|
||||
CURLE_FTP_USER_PASSWORD_INCORRECT
|
||||
CURLE_FTP_WEIRD_USER_REPLY
|
||||
CURLE_FTP_WRITE_ERROR
|
||||
CURLE_LIBRARY_NOT_FOUND
|
||||
CURLE_MALFORMAT_USER
|
||||
CURLE_OBSOLETE
|
||||
CURLE_SHARE_IN_USE
|
||||
CURLE_URL_MALFORMAT_USER
|
||||
|
||||
The following error codes were renamed:
|
||||
|
||||
CURLE_FTP_ACCESS_DENIED => CURLE_REMOTE_ACCESS_DENIED
|
||||
CURLE_FTP_COULDNT_SET_BINARY => CURLE_FTP_COULDNT_SET_TYPE
|
||||
CURLE_FTP_SSL_FAILED => CURLE_USE_SSL_FAILED
|
||||
CURLE_FTP_QUOTE_ERROR => CURLE_QUOTE_ERROR
|
||||
CURLE_TFTP_DISKFULL => CURLE_REMOTE_DISK_FULL
|
||||
CURLE_TFTP_EXISTS => CURLE_REMOTE_FILE_EXISTS
|
||||
CURLE_HTTP_RANGE_ERROR => CURLE_RANGE_ERROR
|
||||
|
||||
The following options were renamed:
|
||||
|
||||
CURLOPT_SSLKEYPASSWD => CURLOPT_KEYPASSWD
|
||||
CURLOPT_FTPAPPEND => CURLOPT_APPEND
|
||||
CURLOPT_FTPLISTONLY => CURLOPT_DIRLISTONLY
|
||||
CURLOPT_FTP_SSL => CURLOPT_USE_SSL
|
||||
|
||||
A few more changes will take place with the next SONAME bump of the
|
||||
library. These are documented in docs/TODO
|
||||
|
||||
- Documented some newer error codes in libcurl-error(3)
|
||||
|
||||
- Added more accurate error code returns from SFTP operations. Added test
|
||||
case 615 to test an SFTP upload failure.
|
||||
|
||||
Dan F (28 August 2007)
|
||||
- Some minor internal type and const changes based on a splint scan.
|
||||
|
||||
Daniel S (24 August 2007)
|
||||
- Bug report #1779054 (http://curl.haxx.se/bug/view.cgi?id=1779054) pointed
|
||||
out that libcurl didn't deal with large responses from server commands, when
|
||||
the single response was consisting of multiple lines but of a total size of
|
||||
16KB or more. Dan Fandrich improved the ftp test script and provided test
|
||||
case 1006 to repeat the problem, and I fixed the code to make sure this new
|
||||
test case runs fine.
|
||||
|
||||
Patrick M (23 August 2007)
|
||||
- OS/400 port: new files lib/config-os400.h lib/setup-os400.h packages/OS400/*.
|
||||
See packages/OS400/README.OS400.
|
||||
|
||||
Daniel S (23 August 2007)
|
||||
- Bug report #1779751 (http://curl.haxx.se/bug/view.cgi?id=1779751) pointed
|
||||
out that doing first a file:// upload and then an FTP upload crashed libcurl
|
||||
or at best caused furious valgrind complaints. Fixed now!
|
||||
|
||||
Daniel S (22 August 2007)
|
||||
- Bug report #1779054 (http://curl.haxx.se/bug/view.cgi?id=1779054) pointed
|
||||
out that libcurl didn't deal with very long (>16K) FTP server response lines
|
||||
properly. Starting now, libcurl will chop them off (thus the client app will
|
||||
not get the full line) but survive and deal with them fine otherwise. Test
|
||||
case 1003 was added to verify this.
|
||||
|
||||
Daniel S (20 August 2007)
|
||||
- Based on a patch by Christian Vogt, the FTP code now sets the upcoming
|
||||
download transfer size much earlier to be possible to get read with
|
||||
CURLINFO_CONTENT_LENGTH_DOWNLOAD as soon as possible. This is very much in a
|
||||
similar spirit to the HTTP size change from August 11 2007.
|
||||
|
||||
Daniel S (18 August 2007)
|
||||
- Robson Braga Araujo filed bug report #1776232
|
||||
(http://curl.haxx.se/bug/view.cgi?id=1776232) about libcurl calling
|
||||
Curl_client_write(), passing on a const string that the caller may not
|
||||
modify and yet it does (on some platforms).
|
||||
|
||||
- Robson Braga Araujo filed bug report #1776235
|
||||
(http://curl.haxx.se/bug/view.cgi?id=1776235) about ftp requests with NOBODY
|
||||
on a directory would do a "SIZE (null)" request. This is now fixed and test
|
||||
case 1000 was added to verify.
|
||||
|
||||
Daniel S (17 August 2007)
|
||||
- Song Ma provided a patch that cures a problem libcurl has when doing resume
|
||||
HTTP PUT using Digest authentication. Test case 5320 and 5322 were also
|
||||
added to verify the functionality.
|
||||
|
||||
Daniel S (14 August 2007)
|
||||
- Andrew Wansink provided an NTLM bugfix: in the case the server sets the flag
|
||||
NTLMFLAG_NEGOTIATE_UNICODE, we need to filter it off because libcurl doesn't
|
||||
UNICODE encode the strings it packs into the NTLM authenticate packet.
|
||||
|
||||
Daniel S (11 August 2007)
|
||||
- Allen Pulsifer provided a patch that makes libcurl set the expected download
|
||||
size earlier when doing HTTP downloads, so that applications and the
|
||||
progress meter etc know get the info earlier in the flow than before.
|
||||
|
||||
- Patrick Monnerat modified the LDAP code and approach in curl. Starting now,
|
||||
the configure script checks for openldap and friends and we link with those
|
||||
libs just like we link all other third party libraries, and we no longer
|
||||
dlopen() those libraries. Our private header file lib/ldap.h was renamed to
|
||||
lib/curl_ldap.h due to this. I set a tag in CVS (curl-7_17_0-preldapfix)
|
||||
just before this commit, just in case.
|
||||
|
||||
Dan F (8 August 2007)
|
||||
- Song Ma noted a zlib memory leak in the illegal compressed header
|
||||
countermeasures code path.
|
||||
|
||||
@@ -5,8 +5,8 @@ Curl and libcurl 7.17.0
|
||||
Available command line options: 118
|
||||
Available curl_easy_setopt() options: 143
|
||||
Number of public functions in libcurl: 55
|
||||
Amount of public web site mirrors: 41
|
||||
Number of known libcurl bindings: 35
|
||||
Amount of public web site mirrors: 42
|
||||
Number of known libcurl bindings: 36
|
||||
Number of contributors: 572
|
||||
|
||||
This release includes the following changes:
|
||||
@@ -14,6 +14,13 @@ This release includes the following changes:
|
||||
o support for OS/400 Secure Sockets Layer library
|
||||
o curl_easy_setopt() now allocates strings passed to it
|
||||
o SCP and SFTP support now requires libssh2 0.16 or later
|
||||
o LDAP libraries are now linked "regularly" and not with dlopen
|
||||
o HTTP transfers have the download size info "available" earlier
|
||||
o FTP transfers have the download size info "available" earlier
|
||||
o builds and runs on OS/400
|
||||
o several error codes and options were marked as obsolete and subject to
|
||||
future removal (set CURL_NO_OLDIES to see if your application is using them)
|
||||
o SFTP errors can return more specific error codes
|
||||
|
||||
This release includes the following bugfixes:
|
||||
|
||||
@@ -34,8 +41,18 @@ This release includes the following bugfixes:
|
||||
o AIX 4 and 5 get to use non-blocking sockets
|
||||
o small POST with NTLM
|
||||
o resumed file:// transfers
|
||||
o CURLOPT_DNS_CACHE_TIMEOUT and CURLOPT_DNS_USE_GLOBAL_CACHE are 64 bit "clean"
|
||||
o CURLOPT_DNS_CACHE_TIMEOUT and CURLOPT_DNS_USE_GLOBAL_CACHE are 64 bit
|
||||
"clean"
|
||||
o memory leak when handling compressed data streams from broken servers
|
||||
o no NTLM unicode response
|
||||
o resume HTTP PUT using Digest authentication
|
||||
o FTP NOBODY requests on directories sent "SIZE (null)"
|
||||
o FTP NOBODY request on file crash
|
||||
o excessively long FTP server responses and response lines
|
||||
o file:// upload then FTP:// upload crash
|
||||
o TFTP error 0 is no longer treated as success
|
||||
o uploading empty file over FTP on re-used connection
|
||||
o superfluous CWD command on re-used FTP connections without subdirs used
|
||||
|
||||
This release includes the following known bugs:
|
||||
|
||||
@@ -46,11 +63,17 @@ Other curl-related news:
|
||||
o pycurl 7.16.4 was released http://pycurl.sf.net
|
||||
o TclCurl 7.16.4 was released
|
||||
http://personal1.iddeo.es/andresgarci/tclcurl/english/
|
||||
o curlpp 0.7.1 was released
|
||||
http://rrette.com/textpattern/index.php?s=cURLpp
|
||||
o A brand new binding for SP-Forth was written by ygrek:
|
||||
http://www.forth.org.ru/~ac/lib/lin/curl/
|
||||
|
||||
New curl mirrors:
|
||||
|
||||
o http://curl.freeby.pctools.cl is a new mirror in Santiago, Chile
|
||||
o http://curl.site2nd.org is a new mirror in Dallas, Texas, USA
|
||||
o http://curl.cheap.co.il is a new mirror in Tel-Aviv, Israel
|
||||
o http://curl.digimirror.nl is a new mirror in Amsterdam, the Netherlands
|
||||
|
||||
This release would not have looked like this without help, code, reports and
|
||||
advice from friends like these:
|
||||
@@ -59,6 +82,7 @@ advice from friends like these:
|
||||
Daniel Cater, Colin Hogben, Jofell Gallardo, Daniel Johnson,
|
||||
Ralf S. Engelschall, James Housley, Chris Flerackers, Patrick Monnerat,
|
||||
Jayesh A Shah, Greg Zavertnik, Peter O'Gorman, Greg Morse, Dmitriy Sergeyev,
|
||||
Scott Cantor
|
||||
Scott Cantor, Allen Pulsifer, Andrew Wansink, Robson Braga Araujo,
|
||||
Christian Vogt
|
||||
|
||||
Thanks! (and sorry if I forgot to mention someone)
|
||||
|
||||
75
acinclude.m4
75
acinclude.m4
@@ -1830,81 +1830,6 @@ AC_DEFUN([CURL_CC_DEBUG_OPTS],
|
||||
|
||||
]) dnl end of AC_DEFUN()
|
||||
|
||||
|
||||
dnl Determine the name of the library to pass to dlopen() based on the name
|
||||
dnl that would normally be given to AC_CHECK_LIB. The preprocessor symbol
|
||||
dnl given is set to the quoted library file name.
|
||||
dnl The standard dynamic library file name is first generated, based on the
|
||||
dnl current system type, then a search is performed for that file on the
|
||||
dnl standard dynamic library path. If it is a symbolic link, the destination
|
||||
dnl of the link is used as the file name, after stripping off any minor
|
||||
dnl version numbers. If a library file can't be found, a guess is made.
|
||||
dnl This macro assumes AC_PROG_LIBTOOL has been called and requires perl
|
||||
dnl to be available in the PATH, or $PERL to be set to its location.
|
||||
dnl
|
||||
dnl CURL_DLLIB_NAME(VARIABLE, library_name)
|
||||
dnl e.g. CURL_DLLIB_NAME(LDAP_NAME, ldap) on a Linux system might result
|
||||
dnl in LDAP_NAME holding the string "libldap.so.2".
|
||||
|
||||
AC_DEFUN([CURL_DLLIB_NAME],
|
||||
[
|
||||
AC_MSG_CHECKING([name of dynamic library $2])
|
||||
dnl The shared library extension variable name changes from version to
|
||||
dnl version of libtool. Try a few names then just set one statically.
|
||||
test -z "$shared_ext" && eval shared_ext=\"$shrext_cmds\"
|
||||
test -z "$shared_ext" && shared_ext="$std_shrext"
|
||||
test -z "$shared_ext" && shared_ext="$shrext"
|
||||
test -z "$shared_ext" && shared_ext=".so"
|
||||
|
||||
dnl Create the library link name of the correct form for this platform
|
||||
LIBNAME_LINK_SPEC=`echo "$library_names_spec" | $SED 's/^.* //'`
|
||||
DLGUESSLIB=`name=$2 eval echo "$libname_spec"`
|
||||
DLGUESSFILE=`libname="$DLGUESSLIB" release="" major="" versuffix="" eval echo "$LIBNAME_LINK_SPEC"`
|
||||
dnl Last resort in case libtool knows nothing about shared libs on this platform
|
||||
test -z "$DLGUESSFILE" && DLGUESSFILE="$DLGUESSLIB$shared_ext"
|
||||
|
||||
dnl Synthesize a likely dynamic library name in case we can't find an actual one
|
||||
SO_NAME_SPEC="$soname_spec"
|
||||
dnl soname_spec undefined when identical to the 1st entry in library_names_spec
|
||||
test -z "$SO_NAME_SPEC" && SO_NAME_SPEC=`echo "$library_names_spec" | $SED 's/ .*$//'`
|
||||
DLGUESSSOFILE=`libname="$DLGUESSLIB" release="" major="" versuffix="" eval echo "$SO_NAME_SPEC"`
|
||||
dnl Last resort in case libtool knows nothing about shared libs on this platform
|
||||
test -z "$DLGUESSSOFILE" && DLGUESSSOFILE="$DLGUESSFILE"
|
||||
|
||||
if test "$cross_compiling" = yes; then
|
||||
dnl Can't look at filesystem when cross-compiling
|
||||
AC_DEFINE_UNQUOTED($1, "$DLGUESSSOFILE", [$2 dynamic library file])
|
||||
AC_MSG_RESULT([$DLGUESSSOFILE (guess while cross-compiling)])
|
||||
else
|
||||
|
||||
DLFOUNDFILE=""
|
||||
if test "$sys_lib_dlsearch_path_spec" ; then
|
||||
dnl Search for the link library name and see what it points to.
|
||||
for direc in $sys_lib_dlsearch_path_spec ; do
|
||||
DLTRYFILE="$direc/$DLGUESSFILE"
|
||||
dnl Find where the symbolic link for this name points
|
||||
changequote(<<, >>)dnl
|
||||
<<
|
||||
DLFOUNDFILE=`${PERL:-perl} -e 'use File::Basename; (basename(readlink($ARGV[0])) =~ /^(.*[^\d]\.\d+)[\d\.]*$/ && print ${1}) || exit 1;' "$DLTRYFILE" 2>&5`
|
||||
>>
|
||||
changequote([, ])dnl
|
||||
if test "$?" -eq "0"; then
|
||||
dnl Found the file link
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if test -z "$DLFOUNDFILE" ; then
|
||||
dnl Couldn't find a link library, so guess at a name.
|
||||
DLFOUNDFILE="$DLGUESSSOFILE"
|
||||
fi
|
||||
|
||||
AC_DEFINE_UNQUOTED($1, "$DLFOUNDFILE", [$2 dynamic library file])
|
||||
AC_MSG_RESULT($DLFOUNDFILE)
|
||||
fi
|
||||
])
|
||||
|
||||
# This is only a temporary fix. This macro is here to replace the broken one
|
||||
# delivered by the automake project (including the 1.9.6 release). As soon as
|
||||
# they ship a working version we SHOULD remove this work-around.
|
||||
|
||||
233
configure.ac
233
configure.ac
@@ -29,7 +29,7 @@ AC_INIT(curl, [-], [a suitable curl mailing list => http://curl.haxx.se/mail/])
|
||||
|
||||
dnl configure script copyright
|
||||
AC_COPYRIGHT([Copyright (c) 1998 - 2006 Daniel Stenberg, <daniel@haxx.se>
|
||||
This configure script may be copied, distributed and modified under the
|
||||
This configure script may be copied, distributed and modified under the
|
||||
terms of the curl license; see COPYING for more details])
|
||||
|
||||
AC_CONFIG_SRCDIR([lib/urldata.h])
|
||||
@@ -89,6 +89,8 @@ dnl initialize all the info variables
|
||||
curl_manual_msg="no (--enable-manual)"
|
||||
curl_verbose_msg="enabled (--disable-verbose)"
|
||||
curl_sspi_msg="no (--enable-sspi)"
|
||||
curl_ldap_msg="no (--enable-ldap / --with-ldap-lib / --with-lber-lib)"
|
||||
curl_ldaps_msg="no (--enable-ldaps)"
|
||||
|
||||
dnl
|
||||
dnl Save anything in $LIBS for later
|
||||
@@ -208,8 +210,8 @@ dnl check if there's a way to force code inline
|
||||
AC_C_INLINE
|
||||
|
||||
dnl **********************************************************************
|
||||
dnl Make sure that our checks for headers windows.h winsock.h winsock2.h
|
||||
dnl and ws2tcpip.h take precedence over any other further checks which
|
||||
dnl Make sure that our checks for headers windows.h winsock.h winsock2.h
|
||||
dnl and ws2tcpip.h take precedence over any other further checks which
|
||||
dnl could be done later using AC_CHECK_HEADER or AC_CHECK_HEADERS for
|
||||
dnl this specific header files. And do them before its results are used.
|
||||
dnl **********************************************************************
|
||||
@@ -284,6 +286,32 @@ AC_HELP_STRING([--disable-ldap],[Disable LDAP support]),
|
||||
esac ],
|
||||
AC_MSG_RESULT(yes)
|
||||
)
|
||||
AC_MSG_CHECKING([whether to support ldaps])
|
||||
AC_ARG_ENABLE(ldaps,
|
||||
AC_HELP_STRING([--enable-ldaps],[Enable LDAPS support])
|
||||
AC_HELP_STRING([--disable-ldaps],[Disable LDAPS support]),
|
||||
[ case "$enableval" in
|
||||
no)
|
||||
AC_MSG_RESULT(no)
|
||||
AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
|
||||
AC_SUBST(CURL_DISABLE_LDAPS, [1])
|
||||
;;
|
||||
*) if test x$CURL_DISABLE_LDAP = x1 ; then
|
||||
AC_MSG_RESULT(LDAP support needs to be enabled in order to enable LDAPS support!)
|
||||
AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
|
||||
AC_SUBST(CURL_DISABLE_LDAPS, [1])
|
||||
else
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_LDAP_SSL, 1, [Use LDAPS implementation])
|
||||
curl_ldaps_msg="enabled"
|
||||
fi
|
||||
;;
|
||||
esac ],
|
||||
AC_MSG_RESULT(no)
|
||||
AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
|
||||
AC_SUBST(CURL_DISABLE_LDAPS, [1])
|
||||
)
|
||||
|
||||
AC_MSG_CHECKING([whether to support dict])
|
||||
AC_ARG_ENABLE(dict,
|
||||
AC_HELP_STRING([--enable-dict],[Enable DICT support])
|
||||
@@ -500,55 +528,79 @@ AC_HELP_STRING([--enable-libgcc],[use libgcc when linking]),
|
||||
AC_MSG_RESULT(no)
|
||||
)
|
||||
|
||||
dnl dl lib?
|
||||
AC_CHECK_FUNC(dlclose, , [ AC_CHECK_LIB(dl, dlopen) ])
|
||||
|
||||
dnl **********************************************************************
|
||||
dnl Check for the name of dynamic OpenLDAP libraries
|
||||
dnl Check for LDAP
|
||||
dnl **********************************************************************
|
||||
|
||||
LDAPLIBNAME=""
|
||||
AC_ARG_WITH(ldap-lib,
|
||||
AC_HELP_STRING([--with-ldap-lib=libname],[Specify name of dynamic ldap lib file]),
|
||||
AC_HELP_STRING([--with-ldap-lib=libname],[Specify name of ldap lib file]),
|
||||
[LDAPLIBNAME="$withval"])
|
||||
|
||||
LBERLIBNAME=""
|
||||
AC_ARG_WITH(lber-lib,
|
||||
AC_HELP_STRING([--with-lber-lib=libname],[Specify name of dynamic lber lib file]),
|
||||
AC_HELP_STRING([--with-lber-lib=libname],[Specify name of lber lib file]),
|
||||
[LBERLIBNAME="$withval"])
|
||||
|
||||
if test x$CURL_DISABLE_LDAP != x1 ; then
|
||||
|
||||
if test -z "$LDAPLIBNAME" ; then
|
||||
case $host in
|
||||
*-*-cygwin | *-*-mingw* | *-*-pw32*)
|
||||
*-*-cygwin* | *-*-mingw* | *-*-pw32*)
|
||||
dnl Windows uses a single and unique OpenLDAP DLL name
|
||||
LDAPLIBNAME="wldap32.dll"
|
||||
LDAPLIBNAME="wldap32"
|
||||
LBERLIBNAME="no"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if test "$LDAPLIBNAME" ; then
|
||||
AC_DEFINE_UNQUOTED(DL_LDAP_FILE, "$LDAPLIBNAME")
|
||||
AC_MSG_CHECKING([name of dynamic library ldap])
|
||||
AC_MSG_RESULT($LDAPLIBNAME)
|
||||
AC_CHECK_LIB("$LDAPLIBNAME", ldap_init,, [
|
||||
AC_MSG_WARN(["$LDAPLIBNAME" is not an LDAP library: LDAP disabled])
|
||||
AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
|
||||
AC_SUBST(CURL_DISABLE_LDAP, [1])])
|
||||
else
|
||||
dnl Try to find the right ldap library name for this system
|
||||
CURL_DLLIB_NAME(DL_LDAP_FILE, ldap)
|
||||
AC_SEARCH_LIBS(ldap_init, [ldap],, [
|
||||
AC_MSG_WARN([Cannot find LDAP library: LDAP disabled])
|
||||
AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
|
||||
AC_SUBST(CURL_DISABLE_LDAP, [1])])
|
||||
fi
|
||||
fi
|
||||
|
||||
if test x$CURL_DISABLE_LDAP != x1 ; then
|
||||
|
||||
if test "$LBERLIBNAME" ; then
|
||||
dnl If name is "no" then don't define this variable at all
|
||||
dnl If name is "no" then don't define this library at all
|
||||
dnl (it's only needed if libldap.so's dependencies are broken).
|
||||
if test "$LBERLIBNAME" != "no" ; then
|
||||
AC_DEFINE_UNQUOTED(DL_LBER_FILE, "$LBERLIBNAME")
|
||||
if test "$LBERLIBNAME" != "no" ; then
|
||||
AC_CHECK_LIB("$LBERLIBNAME", ber_free,, [
|
||||
AC_MSG_WARN(["$LBERLIBNAME" is not an LBER library: LDAP disabled])
|
||||
AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
|
||||
AC_SUBST(CURL_DISABLE_LDAP, [1])])
|
||||
fi
|
||||
AC_MSG_CHECKING([name of dynamic library lber])
|
||||
AC_MSG_RESULT($LBERLIBNAME)
|
||||
else
|
||||
dnl Try to find the right lber library name for this system
|
||||
CURL_DLLIB_NAME(DL_LBER_FILE, lber)
|
||||
AC_SEARCH_LIBS(ber_free, [lber],, [
|
||||
AC_MSG_WARN([Cannot find a library defining ber_free(): LDAP disabled])
|
||||
AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
|
||||
AC_SUBST(CURL_DISABLE_LDAP, [1])])
|
||||
fi
|
||||
fi
|
||||
|
||||
if test x$CURL_DISABLE_LDAP != x1 ; then
|
||||
AC_CHECK_FUNCS([ldap_url_parse])
|
||||
|
||||
if test "$LDAPLIBNAME" = "wldap32"; then
|
||||
curl_ldap_msg="enabled (winldap)"
|
||||
AC_DEFINE(CURL_LDAP_WIN, 1, [Use W$ LDAP implementation])
|
||||
case $host in
|
||||
*-*-cygwin* | *-*-pw32*)
|
||||
AC_DEFINE(CURL_LDAP_HYBRID, 1, [W$ LDAP with non-W$ compiler])
|
||||
;;
|
||||
esac
|
||||
else
|
||||
curl_ldap_msg="enabled (OpenLDAP)"
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -650,26 +702,26 @@ AC_MSG_CHECKING([if argv can be written to])
|
||||
AC_CACHE_VAL(curl_cv_writable_argv, [
|
||||
AC_RUN_IFELSE([[
|
||||
int main(int argc, char ** argv) {
|
||||
argv[0][0] = ' ';
|
||||
return (argv[0][0] == ' ')?0:1;
|
||||
argv[0][0] = ' ';
|
||||
return (argv[0][0] == ' ')?0:1;
|
||||
}
|
||||
]],
|
||||
curl_cv_writable_argv=yes,
|
||||
curl_cv_writable_argv=no,
|
||||
curl_cv_writable_argv=cross)
|
||||
]],
|
||||
curl_cv_writable_argv=yes,
|
||||
curl_cv_writable_argv=no,
|
||||
curl_cv_writable_argv=cross)
|
||||
])
|
||||
case $curl_cv_writable_argv in
|
||||
yes)
|
||||
AC_DEFINE(HAVE_WRITABLE_ARGV, 1, [Define this symbol if your OS supports changing the contents of argv])
|
||||
AC_MSG_RESULT(yes)
|
||||
;;
|
||||
AC_DEFINE(HAVE_WRITABLE_ARGV, 1, [Define this symbol if your OS supports changing the contents of argv])
|
||||
AC_MSG_RESULT(yes)
|
||||
;;
|
||||
no)
|
||||
AC_MSG_RESULT(no)
|
||||
;;
|
||||
AC_MSG_RESULT(no)
|
||||
;;
|
||||
*)
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_WARN([the previous check could not be made default was used])
|
||||
;;
|
||||
;;
|
||||
esac
|
||||
|
||||
dnl **********************************************************************
|
||||
@@ -792,7 +844,7 @@ if test x"$want_spnego" = xyes; then
|
||||
else
|
||||
LDFLAGS="$LDFLAGS $SPNEGO_LIB_DIR"
|
||||
fi
|
||||
|
||||
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_SPNEGO, 1,
|
||||
[Define this if you have the SPNEGO library fbopenssl])
|
||||
@@ -809,13 +861,13 @@ dnl **********************************************************************
|
||||
AC_ARG_WITH(gssapi-includes,
|
||||
AC_HELP_STRING([--with-gssapi-includes=DIR],
|
||||
[Specify location of GSSAPI header]),
|
||||
[ GSSAPI_INCS="-I$withval"
|
||||
[ GSSAPI_INCS="-I$withval"
|
||||
want_gss="yes" ]
|
||||
)
|
||||
|
||||
AC_ARG_WITH(gssapi-libs,
|
||||
AC_HELP_STRING([--with-gssapi-libs=DIR],
|
||||
[Specify location of GSSAPI libs]),
|
||||
[Specify location of GSSAPI libs]),
|
||||
[ GSSAPI_LIB_DIR="-L$withval"
|
||||
want_gss="yes" ]
|
||||
)
|
||||
@@ -825,7 +877,7 @@ AC_ARG_WITH(gssapi,
|
||||
[Where to look for GSSAPI]), [
|
||||
GSSAPI_ROOT="$withval"
|
||||
if test x"$GSSAPI_ROOT" != xno; then
|
||||
want_gss="yes"
|
||||
want_gss="yes"
|
||||
fi
|
||||
])
|
||||
|
||||
@@ -857,10 +909,10 @@ if test x"$want_gss" = xyes; then
|
||||
AC_DEFINE(HAVE_GSSHEIMDAL, 1, [if you have the Heimdal gssapi libraries])
|
||||
],
|
||||
[
|
||||
dnl not found, check in gssapi/ subdir
|
||||
dnl not found, check in gssapi/ subdir
|
||||
AC_CHECK_HEADER(gssapi/gssapi.h,
|
||||
[
|
||||
dnl found
|
||||
dnl found
|
||||
AC_DEFINE(HAVE_GSSMIT, 1, [if you have the MIT gssapi libraries])
|
||||
],
|
||||
[
|
||||
@@ -870,7 +922,7 @@ if test x"$want_gss" = xyes; then
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
)
|
||||
]
|
||||
)
|
||||
else
|
||||
@@ -887,7 +939,7 @@ if test x"$want_gss" = xyes; then
|
||||
elif test -z "$GSSAPI_LIB_DIR"; then
|
||||
if test -f "$GSSAPI_ROOT/bin/krb5-config"; then
|
||||
gss_ldflags=`$GSSAPI_ROOT/bin/krb5-config --libs gssapi`
|
||||
LDFLAGS="$LDFLAGS $gss_ldflags"
|
||||
LDFLAGS="$LDFLAGS $gss_ldflags"
|
||||
elif test "$GSSAPI_ROOT" != "yes"; then
|
||||
LDFLAGS="$LDFLAGS -L$GSSAPI_ROOT/lib$libsuff -lgssapi"
|
||||
else
|
||||
@@ -899,7 +951,7 @@ if test x"$want_gss" = xyes; then
|
||||
else
|
||||
CPPFLAGS="$save_CPPFLAGS"
|
||||
fi
|
||||
|
||||
|
||||
dnl **********************************************************************
|
||||
dnl Check for the presence of SSL libraries and headers
|
||||
dnl **********************************************************************
|
||||
@@ -965,7 +1017,7 @@ if test X"$OPT_SSL" != Xno; then
|
||||
SSL_LDFLAGS=`$PKGCONFIG --libs-only-L openssl 2>/dev/null`
|
||||
SSL_CPPFLAGS=`$PKGCONFIG --cflags-only-I openssl 2>/dev/null`
|
||||
|
||||
LIB_OPENSSL=`echo $SSL_LDFLAGS | sed -e 's/-L//g'`
|
||||
LIB_OPENSSL=`echo $SSL_LDFLAGS | sed -e 's/-L//g'`
|
||||
|
||||
dnl use the values pkg-config reported
|
||||
LIBS="$LIBS $SSL_LIBS"
|
||||
@@ -979,7 +1031,7 @@ if test X"$OPT_SSL" != Xno; then
|
||||
fi
|
||||
|
||||
dnl This is for Msys/Mingw
|
||||
case $host in
|
||||
case $host in
|
||||
*-*-cygwin*)
|
||||
dnl Under Cygwin this is extraneous and causes an unnecessary -lgdi32
|
||||
dnl to be added to LIBS and recorded in the .la file.
|
||||
@@ -1051,7 +1103,7 @@ if test X"$OPT_SSL" != Xno; then
|
||||
dnl name
|
||||
AC_CHECK_HEADERS(x509.h rsa.h crypto.h pem.h ssl.h err.h)
|
||||
|
||||
if test $ac_cv_header_x509_h = yes &&
|
||||
if test $ac_cv_header_x509_h = yes &&
|
||||
test $ac_cv_header_crypto_h = yes &&
|
||||
test $ac_cv_header_ssl_h = yes; then
|
||||
dnl three matches
|
||||
@@ -1111,7 +1163,7 @@ if test X"$OPT_SSL" != Xno; then
|
||||
#else
|
||||
Not the yaSSL OpenSSL compatibility header.
|
||||
#endif
|
||||
],[
|
||||
],[
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_DEFINE_UNQUOTED(USE_YASSLEMUL, 1,
|
||||
[Define to 1 if using yaSSL in OpenSSL compatibility mode.])
|
||||
@@ -1257,7 +1309,7 @@ if test X"$OPT_LIBSSH2" != Xno; then
|
||||
esac
|
||||
|
||||
AC_CHECK_LIB(ssh2, libssh2_channel_open_ex)
|
||||
|
||||
|
||||
AC_CHECK_HEADERS(libssh2.h,
|
||||
curl_ssh_msg="enabled (libSSH2)"
|
||||
LIBSSH2_ENABLED=1
|
||||
@@ -1282,7 +1334,7 @@ if test X"$OPT_LIBSSH2" != Xno; then
|
||||
fi
|
||||
|
||||
dnl **********************************************************************
|
||||
dnl Check for the random seed preferences
|
||||
dnl Check for the random seed preferences
|
||||
dnl **********************************************************************
|
||||
|
||||
if test X"$OPENSSL_ENABLED" = X"1"; then
|
||||
@@ -1349,12 +1401,12 @@ if test "$OPENSSL_ENABLED" != "1"; then
|
||||
|
||||
CLEANLIBS="$LIBS"
|
||||
CLEANCPPFLAGS="$CPPFLAGS"
|
||||
|
||||
|
||||
LIBS="$LIBS $addlib"
|
||||
if test "$addcflags" != "-I/usr/include"; then
|
||||
CPPFLAGS="$CPPFLAGS $addcflags"
|
||||
fi
|
||||
|
||||
|
||||
AC_CHECK_LIB(gnutls, gnutls_check_version,
|
||||
[
|
||||
AC_DEFINE(USE_GNUTLS, 1, [if GnuTLS is enabled])
|
||||
@@ -1367,7 +1419,7 @@ if test "$OPENSSL_ENABLED" != "1"; then
|
||||
LIBS="$CLEANLIBS"
|
||||
CPPFLAGS="$CLEANCPPFLAGS"
|
||||
])
|
||||
|
||||
|
||||
if test "x$USE_GNUTLS" = "xyes"; then
|
||||
AC_MSG_NOTICE([detected GnuTLS version $version])
|
||||
|
||||
@@ -1413,7 +1465,7 @@ if test "$OPENSSL_ENABLED" != "1" -a "$GNUTLS_ENABLED" != "1"; then
|
||||
else
|
||||
# Without pkg-config, we'll kludge in some defaults
|
||||
addlib="-lssl3 -lsmime3 -lnss3 -lplds4 -lplc4 -lnspr4 -lpthread -ldl"
|
||||
addcflags="-I$OPT_NSS/include"
|
||||
addcflags="-I$OPT_NSS/include"
|
||||
version="unknown"
|
||||
gtlsprefix=$OPT_GNUTLS
|
||||
fi
|
||||
@@ -1421,12 +1473,12 @@ if test "$OPENSSL_ENABLED" != "1" -a "$GNUTLS_ENABLED" != "1"; then
|
||||
|
||||
CLEANLIBS="$LIBS"
|
||||
CLEANCPPFLAGS="$CPPFLAGS"
|
||||
|
||||
|
||||
LIBS="$LIBS $addlib"
|
||||
if test "$addcflags" != "-I/usr/include"; then
|
||||
CPPFLAGS="$CPPFLAGS $addcflags"
|
||||
fi
|
||||
|
||||
|
||||
AC_CHECK_LIB(nss3, NSS_Initialize,
|
||||
[
|
||||
AC_DEFINE(USE_NSS, 1, [if NSS is enabled])
|
||||
@@ -1439,7 +1491,7 @@ if test "$OPENSSL_ENABLED" != "1" -a "$GNUTLS_ENABLED" != "1"; then
|
||||
LIBS="$CLEANLIBS"
|
||||
CPPFLAGS="$CLEANCPPFLAGS"
|
||||
])
|
||||
|
||||
|
||||
if test "x$USE_NSS" = "xyes"; then
|
||||
AC_MSG_NOTICE([detected NSS version $version])
|
||||
|
||||
@@ -1486,7 +1538,7 @@ AC_HELP_STRING([--without-ca-bundle], [Don't install the CA bundle]),
|
||||
|
||||
if test "x$ca" != "xno"; then
|
||||
CURL_CA_BUNDLE='"'$ca'"'
|
||||
AC_SUBST(CURL_CA_BUNDLE)
|
||||
AC_SUBST(CURL_CA_BUNDLE)
|
||||
fi
|
||||
AC_MSG_RESULT([$ca])
|
||||
fi dnl only done if some kind of SSL was enabled
|
||||
@@ -1539,8 +1591,8 @@ case "$LIBIDN" in
|
||||
AC_CHECK_FUNCS( idn_free idna_strerror tld_strerror)
|
||||
AC_CHECK_HEADERS( idn-free.h tld.h )
|
||||
fi
|
||||
|
||||
;;
|
||||
|
||||
;;
|
||||
esac
|
||||
|
||||
dnl Default is to try the thread-safe versions of a few functions
|
||||
@@ -1703,6 +1755,7 @@ AC_CHECK_HEADERS(
|
||||
assert.h \
|
||||
unistd.h \
|
||||
stdlib.h \
|
||||
ldap_ssl.h \
|
||||
limits.h \
|
||||
arpa/inet.h \
|
||||
net/if.h \
|
||||
@@ -1716,7 +1769,6 @@ AC_CHECK_HEADERS(
|
||||
termio.h \
|
||||
sgtty.h \
|
||||
fcntl.h \
|
||||
dlfcn.h \
|
||||
alloca.h \
|
||||
time.h \
|
||||
io.h \
|
||||
@@ -1774,7 +1826,7 @@ AC_CHECK_SIZEOF(time_t)
|
||||
|
||||
AC_CHECK_TYPE(long long,
|
||||
[AC_DEFINE(HAVE_LONGLONG, 1, [if your compiler supports long long])]
|
||||
longlong="yes"
|
||||
longlong="yes"
|
||||
)
|
||||
|
||||
if test "xyes" = "x$longlong"; then
|
||||
@@ -1858,7 +1910,6 @@ AC_CHECK_FUNCS( strtoll \
|
||||
strlcat \
|
||||
getpwuid \
|
||||
geteuid \
|
||||
dlopen \
|
||||
utime \
|
||||
sigsetjmp \
|
||||
basename \
|
||||
@@ -1910,7 +1961,7 @@ if test "$ac_cv_func_select" = "no"; then
|
||||
#endif
|
||||
],[
|
||||
select(0,(fd_set *)NULL,(fd_set *)NULL,(fd_set *)NULL,(struct timeval *)NULL);
|
||||
],[
|
||||
],[
|
||||
AC_MSG_RESULT([yes])
|
||||
HAVE_SELECT="1"
|
||||
AC_DEFINE_UNQUOTED(HAVE_SELECT, 1,
|
||||
@@ -2003,11 +2054,11 @@ if test "$disable_poll" = "no"; then
|
||||
fi dnl poll()-check is not disabled
|
||||
|
||||
|
||||
AC_PATH_PROG( PERL, perl, ,
|
||||
AC_PATH_PROG( PERL, perl, ,
|
||||
$PATH:/usr/local/bin/perl:/usr/bin/:/usr/local/bin )
|
||||
AC_SUBST(PERL)
|
||||
|
||||
AC_PATH_PROGS( NROFF, gnroff nroff, ,
|
||||
AC_PATH_PROGS( NROFF, gnroff nroff, ,
|
||||
$PATH:/usr/bin/:/usr/local/bin )
|
||||
AC_SUBST(NROFF)
|
||||
|
||||
@@ -2251,29 +2302,29 @@ AC_HELP_STRING([--disable-hidden-symbols],[Leave all symbols with default visibi
|
||||
no)
|
||||
AC_MSG_RESULT(no)
|
||||
;;
|
||||
*)
|
||||
*)
|
||||
AC_MSG_CHECKING([whether $CC supports it])
|
||||
if test "$GCC" = yes ; then
|
||||
if $CC --help --verbose 2>&1 | grep fvisibility= > /dev/null ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(CURL_HIDDEN_SYMBOLS, 1, [to enable hidden symbols])
|
||||
AC_SUBST(CURL_HIDDEN_SYMBOLS)
|
||||
AC_DEFINE(CURL_EXTERN_SYMBOL, [__attribute__ ((visibility ("default")))], [to make a symbol visible])
|
||||
AC_SUBST(CURL_EXTERN_SYMBOL)
|
||||
CFLAGS="$CFLAGS -fvisibility=hidden"
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(CURL_HIDDEN_SYMBOLS, 1, [to enable hidden symbols])
|
||||
AC_SUBST(CURL_HIDDEN_SYMBOLS)
|
||||
AC_DEFINE(CURL_EXTERN_SYMBOL, [__attribute__ ((visibility ("default")))], [to make a symbol visible])
|
||||
AC_SUBST(CURL_EXTERN_SYMBOL)
|
||||
CFLAGS="$CFLAGS -fvisibility=hidden"
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
|
||||
else
|
||||
dnl Test for SunPro cc
|
||||
if $CC 2>&1 | grep flags >/dev/null && $CC -flags | grep xldscope= >/dev/null ; then
|
||||
dnl Test for SunPro cc
|
||||
if $CC 2>&1 | grep flags >/dev/null && $CC -flags | grep xldscope= >/dev/null ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(CURL_HIDDEN_SYMBOLS, 1, [to enable hidden symbols])
|
||||
AC_SUBST(CURL_HIDDEN_SYMBOLS)
|
||||
AC_DEFINE(CURL_EXTERN_SYMBOL, [__global], [to make a symbol visible])
|
||||
AC_SUBST(CURL_EXTERN_SYMBOL)
|
||||
CFLAGS="$CFLAGS -xldscope=hidden"
|
||||
AC_DEFINE(CURL_HIDDEN_SYMBOLS, 1, [to enable hidden symbols])
|
||||
AC_SUBST(CURL_HIDDEN_SYMBOLS)
|
||||
AC_DEFINE(CURL_EXTERN_SYMBOL, [__global], [to make a symbol visible])
|
||||
AC_SUBST(CURL_EXTERN_SYMBOL)
|
||||
CFLAGS="$CFLAGS -xldscope=hidden"
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
@@ -2312,24 +2363,24 @@ LIBS=$ALL_LIBS dnl LIBS is a magic variable that's used for every link
|
||||
AM_CONDITIONAL(CROSSCOMPILING, test x$cross_compiling = xyes)
|
||||
|
||||
AC_CONFIG_FILES([Makefile \
|
||||
docs/Makefile \
|
||||
docs/Makefile \
|
||||
docs/examples/Makefile \
|
||||
docs/libcurl/Makefile \
|
||||
include/Makefile \
|
||||
include/curl/Makefile \
|
||||
src/Makefile \
|
||||
include/Makefile \
|
||||
include/curl/Makefile \
|
||||
src/Makefile \
|
||||
lib/Makefile \
|
||||
tests/Makefile \
|
||||
tests/data/Makefile \
|
||||
tests/server/Makefile \
|
||||
tests/libtest/Makefile \
|
||||
packages/Makefile \
|
||||
packages/Win32/Makefile \
|
||||
packages/Win32/cygwin/Makefile \
|
||||
packages/Linux/Makefile \
|
||||
packages/Linux/RPM/Makefile \
|
||||
packages/Linux/RPM/curl.spec \
|
||||
packages/Linux/RPM/curl-ssl.spec \
|
||||
packages/Makefile \
|
||||
packages/Win32/Makefile \
|
||||
packages/Win32/cygwin/Makefile \
|
||||
packages/Linux/Makefile \
|
||||
packages/Linux/RPM/Makefile \
|
||||
packages/Linux/RPM/curl.spec \
|
||||
packages/Linux/RPM/curl-ssl.spec \
|
||||
packages/Solaris/Makefile \
|
||||
packages/DOS/Makefile \
|
||||
packages/EPM/curl.list \
|
||||
@@ -2358,9 +2409,11 @@ AC_MSG_NOTICE([Configured to build curl/libcurl:
|
||||
c-ares support: ${curl_ares_msg}
|
||||
ipv6 support: ${curl_ipv6_msg}
|
||||
IDN support: ${curl_idn_msg}
|
||||
Build libcurl: Shared=${enable_shared}, Static=${enable_static}
|
||||
Build libcurl: Shared=${enable_shared}, Static=${enable_static}
|
||||
Built-in manual: ${curl_manual_msg}
|
||||
Verbose errors: ${curl_verbose_msg}
|
||||
SSPI support: ${curl_sspi_msg}
|
||||
ca cert path: ${ca}
|
||||
LDAP support: ${curl_ldap_msg}
|
||||
LDAPS support: ${curl_ldaps_msg}
|
||||
])
|
||||
|
||||
@@ -160,6 +160,10 @@ Smalltalk
|
||||
Smalltalk binding written by Danil Osipchuk
|
||||
http://www.squeaksource.com/CurlPlugin/
|
||||
|
||||
SP-Forth
|
||||
SP-Forth binding by ygrek
|
||||
http://www.forth.org.ru/~ac/lib/lin/curl/
|
||||
|
||||
SPL
|
||||
|
||||
SPL binding written by Clifford Wolf
|
||||
|
||||
110
docs/INSTALL
110
docs/INSTALL
@@ -170,15 +170,17 @@ Win32
|
||||
MingW32
|
||||
-------
|
||||
|
||||
MinGW32 does not provide a batch script to set environment variables
|
||||
automatically. Make sure that MinGW32's bin dir is in PATH and then
|
||||
run 'mingw32-make mingw32' in the root dir. There are other make
|
||||
targets available to build libcurl with more features, use:
|
||||
Make sure that MinGW32's bin dir is in the search path, for example:
|
||||
|
||||
set PATH=c:\mingw32\bin;%PATH%
|
||||
|
||||
then run 'mingw32-make mingw32' in the root dir. There are other
|
||||
make targets available to build libcurl with more features, use:
|
||||
'mingw32-make mingw32-zlib' to build with Zlib support;
|
||||
'mingw32-make mingw32-ssl-zlib' to build with SSL and Zlib enabled;
|
||||
'mingw32-make mingw32-ssh2-ssl-zlib' to build with SSH2, SSL, Zlib;
|
||||
'mingw32-make mingw32-ssh2-ssl-sspi-zlib' to build with SSH2, SSL, Zlib
|
||||
and SSPI.
|
||||
and SSPI support.
|
||||
|
||||
If you have any problems linking libraries or finding header files, be sure
|
||||
to verify that the provided "Makefile.m32" files use the proper paths, and
|
||||
@@ -187,18 +189,37 @@ Win32
|
||||
|
||||
set ZLIB_PATH=c:\zlib-1.2.3
|
||||
set OPENSSL_PATH=c:\openssl-0.9.8e
|
||||
set LIBSSH2_PATH=c:\libssh2-0.16
|
||||
set LIBSSH2_PATH=c:\libssh2-0.17
|
||||
|
||||
ATTENTION: if you want to build with libssh2 support you have to use latest
|
||||
sources fetched from CVS - the current 0.15 release will NOT work!
|
||||
version 0.17 - previous versions will NOT work with 7.17.0 and later!
|
||||
Use 'mingw32-make mingw32-ssh2-ssl-zlib' to build with SSH2 and SSL enabled.
|
||||
|
||||
It is now also possible to build with other LDAP SDKs than MS LDAP;
|
||||
currently it is possible to build with native Win32 OpenLDAP, or with the
|
||||
Novell CLDAP SDK. If you want to use these you need to set these vars:
|
||||
|
||||
set LDAP_SDK=c:\openldap
|
||||
set USE_LDAP_OPENLDAP=1
|
||||
|
||||
or for using the Novell SDK:
|
||||
|
||||
set USE_LDAP_NOVELL=1
|
||||
|
||||
If you want to enable LDAPS support then set LDAPS=1.
|
||||
|
||||
- optional MingW32-built OpenlDAP SDK available from:
|
||||
http://www.gknw.net/mirror/openldap/
|
||||
- optional recent Novell CLDAP SDK available from:
|
||||
http://developer.novell.com/ndk/cldap.htm
|
||||
|
||||
|
||||
Cygwin
|
||||
------
|
||||
|
||||
Almost identical to the unix installation. Run the configure script in the
|
||||
curl root with 'sh configure'. Make sure you have the sh executable in
|
||||
/bin/ or you'll see the configure fail towards the end.
|
||||
/bin/ or you'll see the configure fail toward the end.
|
||||
|
||||
Run 'make'
|
||||
|
||||
@@ -236,7 +257,7 @@ Win32
|
||||
Before running nmake define the OPENSSL_PATH environment variable with
|
||||
the root/base directory of OpenSSL, for example:
|
||||
|
||||
set OPENSSL_PATH=c:\openssl-0.9.8d
|
||||
set OPENSSL_PATH=c:\openssl-0.9.8e
|
||||
|
||||
Then run 'nmake vc-ssl' or 'nmake vc-ssl-dll' in curl's root
|
||||
directory. 'nmake vc-ssl' will create a libcurl static and dynamic
|
||||
@@ -403,7 +424,7 @@ VMS
|
||||
|
||||
Facility - basically the program ID. A code assigned to the program
|
||||
the name can be fetched from external or internal message libraries
|
||||
Errorcode - the errodes assigned by the application
|
||||
Error code - the err codes assigned by the application
|
||||
Sev. - severity: Even = error, off = non error
|
||||
0 = Warning
|
||||
1 = Success
|
||||
@@ -413,7 +434,7 @@ VMS
|
||||
<5-7> reserved.
|
||||
|
||||
This all presents itself with:
|
||||
%<FACILITY>-<SeV>-<Errorname>, <Error message>
|
||||
%<FACILITY>-<Sev>-<Errorname>, <Error message>
|
||||
|
||||
See also the src/curlmsg.msg file, it has the source for the messages In
|
||||
src/main.c a section is devoted to message status values, the globalvalues
|
||||
@@ -490,25 +511,31 @@ NetWare
|
||||
http://developer.novell.com/ndk/libc.htm
|
||||
- or recent Novell CLib SDK available from:
|
||||
http://developer.novell.com/ndk/clib.htm
|
||||
- optional recent Novell CLDAP SDK available from:
|
||||
http://developer.novell.com/ndk/cldap.htm
|
||||
- optional zlib sources (static or dynamic linking with zlib.imp);
|
||||
sources with NetWare Makefile can be obtained from:
|
||||
http://www.gknw.net/mirror/zlib/
|
||||
- optional OpenSSL sources (version 0.9.8 or later build with BSD sockets);
|
||||
you can find precompiled packages at:
|
||||
http://www.gknw.net/development/ossl/netware/
|
||||
for CLIB-based builds OpenSSL needs to be extended to build with BSD
|
||||
sockets (currently only a winsock-based CLIB build is supported);
|
||||
- optional SSH2 sources (version 0.15 or later);
|
||||
for CLIB-based builds OpenSSL needs to be patched to build with BSD
|
||||
sockets (currently only a winsock-based CLIB build is supported):
|
||||
http://www.gknw.net/development/ossl/netware/patches/v_0.9.8e/openssl-0.9.8e.diff
|
||||
- optional SSH2 sources (version 0.17 or later);
|
||||
|
||||
Set a search path to your compiler, linker and tools; on Linux make
|
||||
sure that the var OSTYPE contains the string 'linux'; set the var
|
||||
NDKBASE to point to the base of your Novell NDK; and then type
|
||||
'make netware' from the top source directory; other tagets available
|
||||
'make netware' from the top source directory; other targets available
|
||||
are 'netware-ssl', 'netware-ssl-zlib', 'netware-zlib' and 'netware-ares';
|
||||
if you need other combinations you can control the build with the
|
||||
environment variables WITH_SSL, WITH_ZLIB, WITH_ARES, WITH_SSH2, and
|
||||
ENABLE_IPV6; you can set LINK_STATIC=1 to link curl.nlm statically.
|
||||
I found on some Linux systems (RH9) that OS detection didnt work although
|
||||
By default LDAP support is enabled, however currently you will need a patch
|
||||
in order to use the CLDAP NDK with BSD sockets (Novell Bug 300237):
|
||||
http://www.gknw.net/test/curl/cldap_ndk/ldap_ndk.diff
|
||||
I found on some Linux systems (RH9) that OS detection didn't work although
|
||||
a 'set | grep OSTYPE' shows the var present and set; I simply overwrote it
|
||||
with 'OSTYPE=linux-rh9-gnu' and the detection in the Makefile worked...
|
||||
Any help in testing appreciated!
|
||||
@@ -591,29 +618,40 @@ eCos
|
||||
Minix
|
||||
=====
|
||||
curl can be compiled on Minix 3 using gcc or ACK (starting with
|
||||
ver. 3.1.3). The gcc and bash packages must be installed first.
|
||||
The default heap size allocated to bash is inadequate for running
|
||||
configure and will result in out of memory errors. Increase it with
|
||||
the command:
|
||||
|
||||
chmem =2048000 /usr/local/bin/bash
|
||||
|
||||
Make sure gcc and bash are in the PATH with the command:
|
||||
ver. 3.1.3). The default heap size allocated to several required
|
||||
programs is inadequate for configuring and compiling curl and will
|
||||
result in strange errors unless fixed (which only needs to be done
|
||||
once).
|
||||
|
||||
export PATH=/usr/gnu/bin:$PATH
|
||||
|
||||
then configure curl with a command like this:
|
||||
|
||||
./configure CC=gcc GREP=grep AR=/usr/gnu/bin/gar --disable-ldap
|
||||
|
||||
Then simply run 'make'.
|
||||
|
||||
To compile with the ACK C compiler:
|
||||
ACK
|
||||
---
|
||||
Increase heap sizes with the commands:
|
||||
|
||||
chmem =1024000 /usr/lib/em_cemcom.ansi
|
||||
chmem =512000 /usr/lib/i386/as
|
||||
./configure CC=cc LD=cc GREP=grep CPPFLAGS=-D_POSIX_SOURCE=1 \
|
||||
--disable-ldap
|
||||
|
||||
If you have bash installed:
|
||||
|
||||
chmem =2048000 /usr/local/bin/bash
|
||||
|
||||
Configure and compile with:
|
||||
|
||||
./configure CC=cc LD=cc GREP=grep CPPFLAGS=-D_POSIX_SOURCE=1
|
||||
make
|
||||
|
||||
GCC
|
||||
---
|
||||
If you have bash installed:
|
||||
|
||||
chmem =2048000 /usr/local/bin/bash
|
||||
|
||||
Make sure gcc is in your PATH with the command:
|
||||
|
||||
export PATH=/usr/gnu/bin:$PATH
|
||||
|
||||
then configure and compile curl with:
|
||||
|
||||
./configure CC=gcc GREP=grep AR=/usr/gnu/bin/gar
|
||||
make
|
||||
|
||||
|
||||
@@ -729,6 +767,7 @@ PORTS
|
||||
- HP3000 MPE/iX
|
||||
- MIPS IRIX 6.2, 6.5
|
||||
- MIPS Linux
|
||||
- OS/400
|
||||
- Pocket PC/Win CE 3.0
|
||||
- Power AIX 3.2.5, 4.2, 4.3.1, 4.3.2, 5.1, 5.2
|
||||
- PowerPC Darwin 1.0
|
||||
@@ -743,6 +782,7 @@ PORTS
|
||||
- StrongARM (and other ARM) RISC OS 3.1, 4.02
|
||||
- StrongARM/ARM7/ARM9 Linux 2.4, 2.6
|
||||
- StrongARM NetBSD 1.4.1
|
||||
- TPF
|
||||
- Ultrix 4.3a
|
||||
- UNICOS 9.0
|
||||
- i386 BeOS
|
||||
|
||||
@@ -3,6 +3,13 @@ join in and help us correct one or more of these! Also be sure to check the
|
||||
changelog of the current development status, as one or more of these problems
|
||||
may have been fixed since this was written!
|
||||
|
||||
47. If a CONNECT response is larger than BUFSIZE when the connection is meant
|
||||
to be kept alive, the function will return prematurely and will confuse the
|
||||
rest of the HTTP protocol code.
|
||||
|
||||
46. If a CONNECT response is chunked-encoded, the function may return
|
||||
prematurely and will confuse the rest of the HTTP protocol code.
|
||||
|
||||
45. libcurl built to support ipv6 uses getaddrinfo() to resolve host names.
|
||||
getaddrinfo() sorts the response list which effectively kills how libcurl
|
||||
deals with round-robin DNS entries. All details:
|
||||
@@ -63,7 +70,7 @@ may have been fixed since this was written!
|
||||
IPv6 numerical addresses in URLs.
|
||||
|
||||
29. IPv6 URLs with zone ID is not supported.
|
||||
http://www.ietf.org/internet-drafts/draft-fenner-literal-zone-02.txt
|
||||
http://www.ietf.org/internet-drafts/draft-fenner-literal-zone-02.txt (expired)
|
||||
specifies the use of a plus sign instead of a percent when specifying zone
|
||||
IDs in URLs to get around the problem of percent signs being
|
||||
special. According to the reporter, Firefox deals with the URL _with_ a
|
||||
@@ -78,7 +85,6 @@ may have been fixed since this was written!
|
||||
23. SOCKS-related problems:
|
||||
A) libcurl doesn't support SOCKS for IPv6.
|
||||
B) libcurl doesn't support FTPS over a SOCKS proxy.
|
||||
C) We don't have any test cases for SOCKS proxy.
|
||||
E) libcurl doesn't support active FTP over a SOCKS proxy
|
||||
|
||||
We probably have even more bugs and lack of features when a SOCKS proxy is
|
||||
|
||||
64
docs/TODO
64
docs/TODO
@@ -76,12 +76,32 @@ TODO
|
||||
internally use and assume the multi interface. The select()-loop should use
|
||||
curl_multi_socket().
|
||||
|
||||
* curl_multi_handle_control() - this can control the easy handle (while)
|
||||
added to a multi handle in various ways:
|
||||
o RESTART, unconditionally restart this easy handle's transfer from the
|
||||
start, re-init the state
|
||||
o RESTART_COMPLETED, restart this easy handle's transfer but only if the
|
||||
existing transfer has already completed and it is in a "finished state".
|
||||
o STOP, just stop this transfer and consider it completed
|
||||
o PAUSE?
|
||||
o RESUME?
|
||||
|
||||
DOCUMENTATION
|
||||
|
||||
* More and better
|
||||
|
||||
FTP
|
||||
|
||||
* PRET is a command that primarily "drftpd" supports, which could be useful
|
||||
when using libcurl against such a server. It is a non-standard and a rather
|
||||
oddly designed command, but...
|
||||
http://curl.haxx.se/bug/feature.cgi?id=1729967
|
||||
|
||||
* When trying to connect passively to a server which only supports active
|
||||
connections, libcurl returns CURLE_FTP_WEIRD_PASV_REPLY and closes the
|
||||
connection. There could be a way to fallback to an active connection (and
|
||||
vice versa). http://curl.haxx.se/bug/feature.cgi?id=1754793
|
||||
|
||||
* Make the detection of (bad) %0d and %0a codes in FTP url parts earlier in
|
||||
the process to avoid doing a resolve and connect in vain.
|
||||
|
||||
@@ -96,6 +116,7 @@ TODO
|
||||
|
||||
* Make CURLOPT_FTPPORT support an additional port number on the IP/if/name,
|
||||
like "blabla:[port]" or possibly even "blabla:[portfirst]-[portsecond]".
|
||||
http://curl.haxx.se/bug/feature.cgi?id=1505166
|
||||
|
||||
* FTP ASCII transfers do not follow RFC959. They don't convert the data
|
||||
accordingly.
|
||||
@@ -115,6 +136,9 @@ TODO
|
||||
never been reported as causing trouble to anyone, but should be considered
|
||||
to use the HTTP version the user has chosen.
|
||||
|
||||
* "Better" support for persistent connections over HTTP 1.0
|
||||
http://curl.haxx.se/bug/feature.cgi?id=1089001
|
||||
|
||||
TELNET
|
||||
|
||||
* Reading input (to send to the remote server) on stdin is a crappy solution
|
||||
@@ -127,6 +151,9 @@ TODO
|
||||
|
||||
SSL
|
||||
|
||||
* Provide an option that allows for disabling specific SSL versions, such as
|
||||
SSLv2 http://curl.haxx.se/bug/feature.cgi?id=1767276
|
||||
|
||||
* Provide a libcurl API for setting mutex callbacks in the underlying SSL
|
||||
library, so that the same application code can use mutex-locking
|
||||
independently of OpenSSL or GnutTLS being used.
|
||||
@@ -198,6 +225,11 @@ TODO
|
||||
|
||||
CLIENT
|
||||
|
||||
* Add option that is similar to -O but that takes the output file name from
|
||||
the Content-Disposition: header, and/or uses the local file name used in
|
||||
redirections for the cases the server bounces the request further to a
|
||||
different file (name): http://curl.haxx.se/bug/feature.cgi?id=1364676
|
||||
|
||||
* "curl --sync http://example.com/feed[1-100].rss" or
|
||||
"curl --sync http://example.net/{index,calendar,history}.html"
|
||||
|
||||
@@ -217,10 +249,10 @@ TODO
|
||||
|
||||
* "curl ftp://site.com/*.txt"
|
||||
|
||||
* The client could be told to use maximum N simultaneous transfers and then
|
||||
just make sure that happens. It should of course not make more than one
|
||||
connection to the same remote host. This would require the client to use
|
||||
the multi interface.
|
||||
* The client could be told to use maximum N simultaneous parallel transfers
|
||||
and then just make sure that happens. It should of course not make more
|
||||
than one connection to the same remote host. This would require the client
|
||||
to use the multi interface. http://curl.haxx.se/bug/feature.cgi?id=1558595
|
||||
|
||||
* Extending the capabilities of the multipart formposting. How about leaving
|
||||
the ';type=foo' syntax as it is and adding an extra tag (headers) which
|
||||
@@ -265,9 +297,6 @@ TODO
|
||||
and FTP-SSL tests without the stunnel dependency, and it could allow us to
|
||||
provide test tools built with either OpenSSL or GnuTLS
|
||||
|
||||
* Make the test servers able to serve multiple running test suites. Like if
|
||||
two users run 'make test' at once.
|
||||
|
||||
* If perl wasn't found by the configure script, don't attempt to run the
|
||||
tests but explain something nice why it doesn't.
|
||||
|
||||
@@ -277,6 +306,27 @@ TODO
|
||||
* Make the test suite work on more platforms. OpenBSD and Mac OS. Remove
|
||||
fork()s and it should become even more portable.
|
||||
|
||||
NEXT soname bump
|
||||
|
||||
* #undef CURL_FTP_HTTPSTYLE_HEAD in lib/ftp.c to remove the HTTP-style headers
|
||||
from being output in NOBODY requests over ftp
|
||||
|
||||
* Combine some of the error codes to remove duplicates. The original
|
||||
numbering should not be changed, and the old identifiers would be
|
||||
macroed to the new ones in an CURL_NO_OLDIES section to help with
|
||||
backward compatibility.
|
||||
|
||||
Candidates for removal and their replacements:
|
||||
|
||||
CURLE_FILE_COULDNT_READ_FILE => CURLE_REMOTE_FILE_NOT_FOUND
|
||||
CURLE_FTP_COULDNT_RETR_FILE => CURLE_REMOTE_FILE_NOT_FOUND
|
||||
CURLE_FTP_COULDNT_USE_REST => CURLE_RANGE_ERROR
|
||||
CURLE_FUNCTION_NOT_FOUND => CURLE_FAILED_INIT
|
||||
CURLE_LDAP_INVALID_URL => CURLE_URL_MALFORMAT
|
||||
CURLE_TFTP_NOSUCHUSER => CURLE_TFTP_ILLEGAL
|
||||
CURLE_TFTP_NOTFOUND => CURLE_REMOTE_FILE_NOT_FOUND
|
||||
CURLE_TFTP_PERM => CURLE_REMOTE_ACCESS_DENIED
|
||||
|
||||
NEXT MAJOR RELEASE
|
||||
|
||||
* curl_easy_cleanup() returns void, but curl_multi_cleanup() returns a
|
||||
|
||||
@@ -659,6 +659,10 @@ Append this option to any ordinary curl command line, and you will get a
|
||||
libcurl-using source code written to the file that does the equivalent
|
||||
operation of what your command line operation does!
|
||||
|
||||
NOTE: this does not properly support -F and the sending of multipart
|
||||
formposts, so in those cases the output program will be missing necessary
|
||||
calls to \fIcurl_formadd(3)\fP, and possibly more.
|
||||
|
||||
If this option is used several times, the last given file name will be used.
|
||||
.IP "--limit-rate <speed>"
|
||||
Specify the maximum transfer rate you want curl to use. This feature is useful
|
||||
|
||||
@@ -1,2 +1,30 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
.deps
|
||||
.libs
|
||||
10-at-a-time
|
||||
anyauthput
|
||||
cookie_interface
|
||||
debug
|
||||
fileupload
|
||||
fopen
|
||||
ftpget
|
||||
ftpgetresp
|
||||
ftpupload
|
||||
getinfo
|
||||
getinmemory
|
||||
http-post
|
||||
httpput
|
||||
https
|
||||
multi-app
|
||||
multi-debugcallback
|
||||
multi-double
|
||||
multi-post
|
||||
multi-single
|
||||
persistant
|
||||
post-callback
|
||||
postit2
|
||||
sepheaders
|
||||
simple
|
||||
simplepost
|
||||
simplessl
|
||||
|
||||
@@ -29,9 +29,8 @@ LDFLAGS = -L/home/dast/lib -L/usr/local/ssl/lib
|
||||
# We need -lcurl for the curl stuff
|
||||
# We need -lsocket and -lnsl when on Solaris
|
||||
# We need -lssl and -lcrypto when using libcurl with SSL support
|
||||
# We need -ldl for dlopen() if that is in libdl
|
||||
# We need -lpthread for the pthread example
|
||||
LIBS = -lcurl -lsocket -lnsl -lssl -lcrypto -dl
|
||||
LIBS = -lcurl -lsocket -lnsl -lssl -lcrypto
|
||||
|
||||
# Link the target with all objects and libraries
|
||||
$(TARGET) : $(OBJS)
|
||||
|
||||
@@ -122,10 +122,10 @@ int upload(CURL *curlhandle, const char * remotepath, const char * localpath,
|
||||
|
||||
fseek(f, uploaded_len, SEEK_SET);
|
||||
|
||||
curl_easy_setopt(curlhandle, CURLOPT_FTPAPPEND, 1);
|
||||
curl_easy_setopt(curlhandle, CURLOPT_APPEND, 1);
|
||||
}
|
||||
else { /* no */
|
||||
curl_easy_setopt(curlhandle, CURLOPT_FTPAPPEND, 0);
|
||||
curl_easy_setopt(curlhandle, CURLOPT_APPEND, 0);
|
||||
}
|
||||
|
||||
r = curl_easy_perform(curlhandle);
|
||||
|
||||
@@ -95,7 +95,7 @@ int main(int argc, char **argv)
|
||||
/* sorry, for engine we must set the passphrase
|
||||
(if the key has one...) */
|
||||
if (pPassphrase)
|
||||
curl_easy_setopt(curl,CURLOPT_SSLKEYPASSWD,pPassphrase);
|
||||
curl_easy_setopt(curl,CURLOPT_KEYPASSWD,pPassphrase);
|
||||
|
||||
/* if we use a key stored in a crypto engine,
|
||||
we must set the key type to "ENG" */
|
||||
|
||||
@@ -1,8 +1,27 @@
|
||||
.\" You can view this file with:
|
||||
.\" nroff -man [file]
|
||||
.\" $Id$
|
||||
.\" **************************************************************************
|
||||
.\" * _ _ ____ _
|
||||
.\" * Project ___| | | | _ \| |
|
||||
.\" * / __| | | | |_) | |
|
||||
.\" * | (__| |_| | _ <| |___
|
||||
.\" * \___|\___/|_| \_\_____|
|
||||
.\" *
|
||||
.\" * Copyright (C) 1998 - 2007, 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.
|
||||
.\" *
|
||||
.\" * $Id$
|
||||
.\" **************************************************************************
|
||||
.\"
|
||||
.TH curl_easy_cleanup 3 "12 Oct 2006" "libcurl 7.7" "libcurl Manual"
|
||||
.TH curl_easy_cleanup 3 "22 aug 2007" "libcurl 7.17.0" "libcurl Manual"
|
||||
.SH NAME
|
||||
curl_easy_cleanup - End a libcurl easy session
|
||||
.SH SYNOPSIS
|
||||
@@ -19,11 +38,12 @@ This will effectively close all connections this handle has used and possibly
|
||||
has kept open until now. Don't call this function if you intend to transfer
|
||||
more files.
|
||||
|
||||
When you've called this, you can safely remove all the strings you've
|
||||
previously told libcurl to use, as it won't use them anymore now.
|
||||
|
||||
Any uses of the \fBhandle\fP after this function has been called are
|
||||
illegal. This kills the handle and all memory associated with it!
|
||||
|
||||
With libcurl versions prior to 7.17.: when you've called this, you can safely
|
||||
remove all the strings you've previously told libcurl to use, as it won't use
|
||||
them anymore now.
|
||||
.SH RETURN VALUE
|
||||
None
|
||||
.SH "SEE ALSO"
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
.\" * $Id$
|
||||
.\" **************************************************************************
|
||||
.\"
|
||||
.TH curl_easy_setopt 3 "1 Aug 2007" "libcurl 7.17.0" "libcurl Manual"
|
||||
.TH curl_easy_setopt 3 "30 Aug 2007" "libcurl 7.17.0" "libcurl Manual"
|
||||
.SH NAME
|
||||
curl_easy_setopt \- set options for a curl easy handle
|
||||
.SH SYNOPSIS
|
||||
@@ -764,7 +764,7 @@ multiple cookies in one string like this: "name1=content1; name2=content2;"
|
||||
etc.
|
||||
|
||||
Using this option multiple times will only make the latest string override the
|
||||
previously ones.
|
||||
previous ones.
|
||||
.IP CURLOPT_COOKIEFILE
|
||||
Pass a pointer to a zero terminated string as parameter. It should contain the
|
||||
name of your file holding cookie data to read. The cookie data may be in
|
||||
@@ -875,17 +875,21 @@ struct curl_slist structs properly filled in as described for
|
||||
\fICURLOPT_QUOTE\fP. Disable this operation again by setting a NULL to this
|
||||
option. Before version 7.15.6, if you also set \fICURLOPT_NOBODY\fP non-zero,
|
||||
this option didn't work.
|
||||
.IP CURLOPT_FTPLISTONLY
|
||||
A non-zero parameter tells the library to just list the names of an ftp
|
||||
.IP CURLOPT_DIRLISTONLY
|
||||
A non-zero parameter tells the library to just list the names of files in a
|
||||
directory, instead of doing a full directory listing that would include file
|
||||
sizes, dates etc.
|
||||
sizes, dates etc. This works for FTP and SFTP URLs.
|
||||
|
||||
This causes an FTP NLST command to be sent. Beware that some FTP servers list
|
||||
only files in their response to NLST; they might not include subdirectories
|
||||
and symbolic links.
|
||||
.IP CURLOPT_FTPAPPEND
|
||||
This causes an FTP NLST command to be sent on an FTP server. Beware
|
||||
that some FTP servers list only files in their response to NLST; they
|
||||
might not include subdirectories and symbolic links.
|
||||
|
||||
(This option was known as CURLOPT_FTPLISTONLY up to 7.16.4)
|
||||
.IP CURLOPT_APPEND
|
||||
A non-zero parameter tells the library to append to the remote file instead of
|
||||
overwrite it. This is only useful when uploading to an ftp site.
|
||||
|
||||
(This option was known as CURLOPT_FTPAPPEND up to 7.16.4)
|
||||
.IP CURLOPT_FTP_USE_EPRT
|
||||
Pass a long. If the value is non-zero, it tells curl to use the EPRT (and
|
||||
LPRT) command when doing active FTP downloads (which is enabled by
|
||||
@@ -932,18 +936,21 @@ same IP address it already uses for the control connection. But it will use
|
||||
the port number from the 227-response. (Added in 7.14.2)
|
||||
|
||||
This option has no effect if PORT, EPRT or EPSV is used instead of PASV.
|
||||
.IP CURLOPT_FTP_SSL
|
||||
.IP CURLOPT_USE_SSL
|
||||
Pass a long using one of the values from below, to make libcurl use your
|
||||
desired level of SSL for the ftp transfer. (Added in 7.11.0)
|
||||
|
||||
(This option was known as CURLOPT_FTP_SSL up to 7.16.4, and the constants
|
||||
were known as CURLFTPSSL_*)
|
||||
.RS
|
||||
.IP CURLFTPSSL_NONE
|
||||
.IP CURLUSESSL_NONE
|
||||
Don't attempt to use SSL.
|
||||
.IP CURLFTPSSL_TRY
|
||||
.IP CURLUSESSL_TRY
|
||||
Try using SSL, proceed as normal otherwise.
|
||||
.IP CURLFTPSSL_CONTROL
|
||||
Require SSL for the control connection or fail with \fICURLE_FTP_SSL_FAILED\fP.
|
||||
.IP CURLFTPSSL_ALL
|
||||
Require SSL for all communication or fail with \fICURLE_FTP_SSL_FAILED\fP.
|
||||
.IP CURLUSESSL_CONTROL
|
||||
Require SSL for the control connection or fail with \fICURLE_USE_SSL_FAILED\fP.
|
||||
.IP CURLUSESSL_ALL
|
||||
Require SSL for all communication or fail with \fICURLE_USE_SSL_FAILED\fP.
|
||||
.RE
|
||||
.IP CURLOPT_FTPSSLAUTH
|
||||
Pass a long using one of the values from below, to alter how libcurl issues
|
||||
@@ -1225,13 +1232,6 @@ with.
|
||||
Pass a pointer to a zero terminated string as parameter. The string should be
|
||||
the format of your certificate. Supported formats are "PEM" and "DER". (Added
|
||||
in 7.9.3)
|
||||
.IP CURLOPT_SSLCERTPASSWD
|
||||
Pass a pointer to a zero terminated string as parameter. It will be used as
|
||||
the password required to use the \fICURLOPT_SSLCERT\fP certificate.
|
||||
|
||||
This option is replaced by \fICURLOPT_SSLKEYPASSWD\fP and should only be used
|
||||
for backward compatibility. You never needed a pass phrase to load a
|
||||
certificate but you need one to load your private key.
|
||||
.IP CURLOPT_SSLKEY
|
||||
Pass a pointer to a zero terminated string as parameter. The string should be
|
||||
the file name of your private key. The default format is "PEM" and can be
|
||||
@@ -1244,10 +1244,15 @@ The format "ENG" enables you to load the private key from a crypto engine. In
|
||||
this case \fICURLOPT_SSLKEY\fP is used as an identifier passed to the
|
||||
engine. You have to set the crypto engine with \fICURLOPT_SSLENGINE\fP.
|
||||
\&"DER" format key file currently does not work because of a bug in OpenSSL.
|
||||
.IP CURLOPT_SSLKEYPASSWD
|
||||
.IP CURLOPT_KEYPASSWD
|
||||
Pass a pointer to a zero terminated string as parameter. It will be used as
|
||||
the password required to use the \fICURLOPT_SSLKEY\fP or
|
||||
\fICURLOPT_SSH_PRIVATE_KEYFILE\fP private key.
|
||||
You never needed a pass phrase to load a certificate but you need one to
|
||||
load your private key.
|
||||
|
||||
(This option was known as CURLOPT_SSLKEYPASSWD up to 7.16.4 and
|
||||
CURLOPT_SSLCERTPASSWD up to 7.9.2)
|
||||
.IP CURLOPT_SSLENGINE
|
||||
Pass a pointer to a zero terminated string as parameter. It will be used as
|
||||
the identifier for the crypto engine you want to use for your private
|
||||
@@ -1406,7 +1411,7 @@ libcurl defaults to using \fB~/.ssh/id_dsa.pub\fP.
|
||||
.IP CURLOPT_SSH_PRIVATE_KEYFILE
|
||||
Pass a char * pointing to a file name for your private key. If not used,
|
||||
libcurl defaults to using \fB~/.ssh/id_dsa\fP.
|
||||
If the file is password-protected, set the password with \fICURLOPT_SSLKEYPASSWD\fP.
|
||||
If the file is password-protected, set the password with \fICURLOPT_KEYPASSWD\fP.
|
||||
(Added in 7.16.1)
|
||||
.SH OTHER OPTIONS
|
||||
.IP CURLOPT_PRIVATE
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
.\" * $Id$
|
||||
.\" **************************************************************************
|
||||
.\"
|
||||
.TH libcurl-errors 3 "8 May 2007" "libcurl 7.16.3" "libcurl errors"
|
||||
.TH libcurl-errors 3 "30 Aug 2007" "libcurl 7.17.0" "libcurl errors"
|
||||
.SH NAME
|
||||
libcurl-errors \- error codes in libcurl
|
||||
.SH DESCRIPTION
|
||||
@@ -48,8 +48,6 @@ Very early initialization code failed. This is likely to be an internal error
|
||||
or problem.
|
||||
.IP "CURLE_URL_MALFORMAT (3)"
|
||||
The URL was not properly formatted.
|
||||
.IP "CURLE_URL_MALFORMAT_USER (4)"
|
||||
This is never returned by current libcurl.
|
||||
.IP "CURLE_COULDNT_RESOLVE_PROXY (5)"
|
||||
Couldn't resolve proxy. The given proxy host could not be resolved.
|
||||
.IP "CURLE_COULDNT_RESOLVE_HOST (6)"
|
||||
@@ -60,17 +58,12 @@ Failed to connect() to host or proxy.
|
||||
After connecting to an FTP server, libcurl expects to get a certain reply
|
||||
back. This error code implies that it got a strange or bad reply. The given
|
||||
remote server is probably not an OK FTP server.
|
||||
.IP "CURLE_FTP_ACCESS_DENIED (9)"
|
||||
We were denied access when trying to login to an FTP server or when trying to
|
||||
change working directory to the one given in the URL.
|
||||
.IP "CURLE_FTP_USER_PASSWORD_INCORRECT (10)"
|
||||
This is never returned by current libcurl.
|
||||
.IP "CURLE_REMOTE_ACCESS_DENIED (9)"
|
||||
We were denied access to the resource given in the URL. For FTP, this occurs
|
||||
while trying to change to the remote directory.
|
||||
.IP "CURLE_FTP_WEIRD_PASS_REPLY (11)"
|
||||
After having sent the FTP password to the server, libcurl expects a proper
|
||||
reply. This error code indicates that an unexpected code was returned.
|
||||
.IP "CURLE_FTP_WEIRD_USER_REPLY (12)"
|
||||
After having sent user name to the FTP server, libcurl expects a proper
|
||||
reply. This error code indicates that an unexpected code was returned.
|
||||
.IP "CURLE_FTP_WEIRD_PASV_REPLY (13)"
|
||||
libcurl failed to get a sensible result back from the server as a response to
|
||||
either a PASV or a EPSV command. The server is flawed.
|
||||
@@ -79,11 +72,8 @@ FTP servers return a 227-line as a response to a PASV command. If libcurl
|
||||
fails to parse that line, this return code is passed back.
|
||||
.IP "CURLE_FTP_CANT_GET_HOST (15)"
|
||||
An internal failure to lookup the host used for the new connection.
|
||||
.IP "CURLE_FTP_CANT_RECONNECT (16)"
|
||||
A bad return code on either PASV or EPSV was sent by the FTP server,
|
||||
preventing libcurl from being able to continue.
|
||||
.IP "CURLE_FTP_COULDNT_SET_BINARY (17)"
|
||||
Received an error when trying to set the transfer mode to binary.
|
||||
.IP "CURLE_FTP_COULDNT_SET_TYPE (17)"
|
||||
Received an error when trying to set the transfer mode to binary or ascii.
|
||||
.IP "CURLE_PARTIAL_FILE (18)"
|
||||
A file transfer was shorter or larger than expected. This happens when the
|
||||
server first reports an expected transfer size, and then delivers data that
|
||||
@@ -91,12 +81,10 @@ doesn't match the previously given size.
|
||||
.IP "CURLE_FTP_COULDNT_RETR_FILE (19)"
|
||||
This was either a weird reply to a 'RETR' command or a zero byte transfer
|
||||
complete.
|
||||
.IP "CURLE_FTP_WRITE_ERROR (20)"
|
||||
After a completed file transfer, the FTP server did not respond a proper
|
||||
\"transfer successful\" code.
|
||||
.IP "CURLE_FTP_QUOTE_ERROR (21)"
|
||||
.IP "CURLE_QUOTE_ERROR (21)"
|
||||
When sending custom "QUOTE" commands to the remote server, one of the commands
|
||||
returned an error code that was 400 or higher.
|
||||
returned an error code that was 400 or higher (for FTP) or otherwise
|
||||
indicated unsuccessful completion of the command.
|
||||
.IP "CURLE_HTTP_RETURNED_ERROR (22)"
|
||||
This is returned if CURLOPT_FAILONERROR is set TRUE and the HTTP server
|
||||
returns an error code that is >= 400. (This error code was formerly known as
|
||||
@@ -104,34 +92,27 @@ CURLE_HTTP_NOT_FOUND.)
|
||||
.IP "CURLE_WRITE_ERROR (23)"
|
||||
An error occurred when writing received data to a local file, or an error was
|
||||
returned to libcurl from a write callback.
|
||||
.IP "CURLE_MALFORMAT_USER (24)"
|
||||
This is never returned by current libcurl.
|
||||
.IP "CURLE_UPLOAD_FAILED (25)"
|
||||
Failed starting the upload. For FTP, the server typcially denied the STOR
|
||||
Failed starting the upload. For FTP, the server typically denied the STOR
|
||||
command. The error buffer usually contains the server's explanation to this.
|
||||
(This error code was formerly known as CURLE_FTP_COULDNT_STOR_FILE.)
|
||||
.IP "CURLE_READ_ERROR (26)"
|
||||
There was a problem reading a local file or an error returned by the read
|
||||
callback.
|
||||
.IP "CURLE_OUT_OF_MEMORY (27)"
|
||||
Out of memory. A memory allocation request failed. This is serious badness and
|
||||
A memory allocation request failed. This is serious badness and
|
||||
things are severely screwed up if this ever occur.
|
||||
.IP "CURLE_OPERATION_TIMEOUTED (28)"
|
||||
.IP "CURLE_OPERATION_TIMEDOUT (28)"
|
||||
Operation timeout. The specified time-out period was reached according to the
|
||||
conditions.
|
||||
.IP "CURLE_FTP_COULDNT_SET_ASCII (29)"
|
||||
libcurl failed to set ASCII transfer type (TYPE A).
|
||||
.IP "CURLE_FTP_PORT_FAILED (30)"
|
||||
The FTP PORT command returned error. This mostly happen when you haven't
|
||||
specified a good enough address for libcurl to use. See \fICURLOPT_FTPPORT\fP.
|
||||
.IP "CURLE_FTP_COULDNT_USE_REST (31)"
|
||||
The FTP REST command returned error. This should never happen if the server is
|
||||
sane.
|
||||
.IP "CURLE_FTP_COULDNT_GET_SIZE (32)"
|
||||
The FTP SIZE command returned error. SIZE is not a kosher FTP command, it is
|
||||
an extension and not all servers support it. This is not a surprising error.
|
||||
.IP "CURLE_HTTP_RANGE_ERROR (33)"
|
||||
The HTTP server does not support or accept range requests.
|
||||
.IP "CURLE_RANGE_ERROR (33)"
|
||||
The server does not support or accept range requests.
|
||||
.IP "CURLE_HTTP_POST_ERROR (34)"
|
||||
This is an odd error that mainly occurs due to internal confusion.
|
||||
.IP "CURLE_SSL_CONNECT_ERROR (35)"
|
||||
@@ -148,23 +129,17 @@ path doesn't identify an existing file. Did you check file permissions?
|
||||
LDAP cannot bind. LDAP bind operation failed.
|
||||
.IP "CURLE_LDAP_SEARCH_FAILED (39)"
|
||||
LDAP search failed.
|
||||
.IP "CURLE_LIBRARY_NOT_FOUND (40)"
|
||||
Library not found. The LDAP library was not found.
|
||||
.IP "CURLE_FUNCTION_NOT_FOUND (41)"
|
||||
Function not found. A required LDAP function was not found.
|
||||
Function not found. A required zlib function was not found.
|
||||
.IP "CURLE_ABORTED_BY_CALLBACK (42)"
|
||||
Aborted by callback. A callback returned "abort" to libcurl.
|
||||
.IP "CURLE_BAD_FUNCTION_ARGUMENT (43)"
|
||||
Internal error. A function was called with a bad parameter.
|
||||
.IP "CURLE_BAD_CALLING_ORDER (44)"
|
||||
This is never returned by current libcurl.
|
||||
.IP "CURLE_INTERFACE_FAILED (45)"
|
||||
Interface error. A specified outgoing interface could not be used. Set which
|
||||
interface to use for outgoing connections' source IP address with
|
||||
CURLOPT_INTERFACE. (This error code was formerly known as
|
||||
CURLE_HTTP_PORT_FAILED.)
|
||||
.IP "CURLE_BAD_PASSWORD_ENTERED (46)"
|
||||
This is never returned by current libcurl.
|
||||
.IP "CURLE_TOO_MANY_REDIRECTS (47)"
|
||||
Too many redirects. When following redirects, libcurl hit the maximum amount.
|
||||
Set your limit with CURLOPT_MAXREDIRS.
|
||||
@@ -173,9 +148,6 @@ An option set with CURLOPT_TELNETOPTIONS was not recognized/known. Refer to
|
||||
the appropriate documentation.
|
||||
.IP "CURLE_TELNET_OPTION_SYNTAX (49)"
|
||||
A telnet option string was Illegally formatted.
|
||||
.IP "CURLE_OBSOLETE (50)"
|
||||
This is not an error. This used to be another error code in an old libcurl
|
||||
version and is currently unused.
|
||||
.IP "CURLE_SSL_PEER_CERTIFICATE (51)"
|
||||
The remote server's SSL certificate was deemed not OK.
|
||||
.IP "CURLE_GOT_NOTHING (52)"
|
||||
@@ -189,21 +161,19 @@ Failed setting the selected SSL crypto engine as default!
|
||||
Failed sending network data.
|
||||
.IP "CURLE_RECV_ERROR (56)"
|
||||
Failure with receiving network data.
|
||||
.IP "CURLE_SHARE_IN_USE (57)"
|
||||
Share is in use
|
||||
.IP "CURLE_SSL_CERTPROBLEM (58)"
|
||||
problem with the local client certificate
|
||||
.IP "CURLE_SSL_CIPHER (59)"
|
||||
couldn't use specified cipher
|
||||
Couldn't use specified cipher
|
||||
.IP "CURLE_SSL_CACERT (60)"
|
||||
peer certificate cannot be authenticated with known CA certificates
|
||||
Peer certificate cannot be authenticated with known CA certificates
|
||||
.IP "CURLE_BAD_CONTENT_ENCODING (61)"
|
||||
Unrecognized transfer encoding
|
||||
.IP "CURLE_LDAP_INVALID_URL (62)"
|
||||
Invalid LDAP URL
|
||||
.IP "CURLE_FILESIZE_EXCEEDED (63)"
|
||||
Maximum file size exceeded
|
||||
.IP "CURLE_FTP_SSL_FAILED (64)"
|
||||
.IP "CURLE_USE_SSL_FAILED (64)"
|
||||
Requested FTP SSL level failed
|
||||
.IP "CURLE_SEND_FAIL_REWIND (65)"
|
||||
When doing a send operation curl had to rewind the data to retransmit, but the
|
||||
@@ -214,24 +184,33 @@ Initiating the SSL Engine failed
|
||||
The remote server denied curl to login (Added in 7.13.1)
|
||||
.IP "CURLE_TFTP_NOTFOUND (68)"
|
||||
File not found on TFTP server
|
||||
.IP "CURLE_TFTP_PERM (69"
|
||||
.IP "CURLE_TFTP_PERM (69)"
|
||||
Permission problem on TFTP server
|
||||
.IP "CURLE_TFTP_DISKFULL (70)"
|
||||
Out of disk space on TFTP server
|
||||
.IP "CURLE_REMOTE_DISK_FULL (70)"
|
||||
Out of disk space on the server
|
||||
.IP "CURLE_TFTP_ILLEGAL (71)"
|
||||
Illegal TFTP operation
|
||||
.IP "CURLE_TFTP_UNKNOWNID (72)"
|
||||
Unknown TFTP transfer ID
|
||||
.IP "CURLE_TFTP_EXISTS (73)"
|
||||
TFTP File already exists
|
||||
.IP "CURLE_REMOTE_FILE_EXISTS (73)"
|
||||
File already exists and will not be overwritten
|
||||
.IP "CURLE_TFTP_NOSUCHUSER (74)"
|
||||
No such TFTP user
|
||||
This error should never be returned by a properly functioning TFTP server
|
||||
.IP "CURLE_CONV_FAILED (75)"
|
||||
Character conversion failed
|
||||
.IP "CURLE_CONV_REQD (76)"
|
||||
Caller must register conversion callbacks
|
||||
.IP "CURLE_SSL_CACERT_BADFILE (77)"
|
||||
Problem with reading the SSL CA cert (path? access rights?)
|
||||
.IP "CURLE_REMOTE_FILE_NOT_FOUND (78)"
|
||||
The resource referenced in the URL does not exist
|
||||
.IP "CURLE_SSH (79)"
|
||||
An unspecified error occurred during the SSH session
|
||||
.IP "CURLE_SSL_SHUTDOWN_FAILED (80)"
|
||||
Failed to shut down the SSL connection
|
||||
.IP "CURLE_OBSOLETE*"
|
||||
These error codes will never be returned. They used to be used in an old libcurl
|
||||
version and are currently unused.
|
||||
.SH "CURLMcode"
|
||||
This is the generic return code used by functions in the libcurl multi
|
||||
interface. Also consider \fIcurl_multi_strerror(3)\fP.
|
||||
@@ -253,6 +232,9 @@ This can only be returned if libcurl bugs. Please report it to us!
|
||||
.IP "CURLM_BAD_SOCKET (5)"
|
||||
The passed-in socket is not a valid one that libcurl already knows about.
|
||||
(Added in 7.15.4)
|
||||
.IP "CURLM_UNKNOWN_OPTION (6)"
|
||||
curl_multi_setopt() with unsupported option
|
||||
(Added in 7.15.4)
|
||||
.SH "CURLSHcode"
|
||||
The "share" interface will return a CURLSHcode to indicate when an error has
|
||||
occurred. Also consider \fIcurl_share_strerror(3)\fP.
|
||||
@@ -264,4 +246,6 @@ An invalid option was passed to the function.
|
||||
The share object is currently in use.
|
||||
.IP "CURLSHE_INVALID (3)"
|
||||
An invalid share object was passed to the function.
|
||||
|
||||
.IP "CURLSHE_NOMEM (4)"
|
||||
Not enough memory was available.
|
||||
(Added in 7.12.0)
|
||||
|
||||
@@ -415,7 +415,7 @@ you're using an SSL private key for secure transfers.
|
||||
|
||||
To pass the known private key password to libcurl:
|
||||
|
||||
curl_easy_setopt(easyhandle, CURLOPT_SSLKEYPASSWD, "keypassword");
|
||||
curl_easy_setopt(easyhandle, CURLOPT_KEYPASSWD, "keypassword");
|
||||
|
||||
.SH "HTTP Authentication"
|
||||
The previous chapter showed how to set user name and password for getting
|
||||
@@ -931,7 +931,7 @@ would instead be called CURLOPT_POSTQUOTE and used the exact same way.
|
||||
The custom FTP command will be issued to the server in the same order they are
|
||||
added to the list, and if a command gets an error code returned back from the
|
||||
server, no more commands will be issued and libcurl will bail out with an
|
||||
error code (CURLE_FTP_QUOTE_ERROR). Note that if you use CURLOPT_QUOTE to send
|
||||
error code (CURLE_QUOTE_ERROR). Note that if you use CURLOPT_QUOTE to send
|
||||
commands before a transfer, no transfer will actually take place when a quote
|
||||
command has failed.
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# During dev at least, we use a static libcurl.
|
||||
#
|
||||
|
||||
LDFLAGS = -lcrypt -lidn -lssl -lcrypto -ldl -lz -lresolv -L../ares/.libs \
|
||||
LDFLAGS = -lcrypt -lidn -lssl -lcrypto -lz -lresolv -L../ares/.libs \
|
||||
-lcares
|
||||
LIBCURL = -L../lib/.libs/ -lcurl
|
||||
CFLAGS = -I../include -g
|
||||
|
||||
@@ -95,6 +95,11 @@ extern "C" {
|
||||
typedef long long curl_off_t;
|
||||
#define CURL_FORMAT_OFF_T "%I64d"
|
||||
#else /* GCC or Watcom on Windows */
|
||||
#if defined(__ILEC400__)
|
||||
/* OS400 C compiler. */
|
||||
typedef long long curl_off_t;
|
||||
#define CURL_FORMAT_OFF_T "%lld"
|
||||
#else /* OS400 C compiler. */
|
||||
|
||||
/* "normal" POSIX approach, do note that this does not necessarily mean that
|
||||
the type is >32 bits, see the SIZEOF_CURL_OFF_T define for that! */
|
||||
@@ -120,6 +125,7 @@ extern "C" {
|
||||
#else /* LARGE_FILE support */
|
||||
#define CURL_FORMAT_OFF_T "%ld"
|
||||
#endif
|
||||
#endif /* OS400 C compiler. */
|
||||
#endif /* GCC or Watcom on Windows */
|
||||
#endif /* (_MSC_VER && !__POCC__) || (__LCC__ && WIN32) */
|
||||
|
||||
@@ -308,29 +314,29 @@ typedef enum {
|
||||
CURLE_UNSUPPORTED_PROTOCOL, /* 1 */
|
||||
CURLE_FAILED_INIT, /* 2 */
|
||||
CURLE_URL_MALFORMAT, /* 3 */
|
||||
CURLE_URL_MALFORMAT_USER, /* 4 - NOT USED */
|
||||
CURLE_OBSOLETE4, /* 4 - NOT USED */
|
||||
CURLE_COULDNT_RESOLVE_PROXY, /* 5 */
|
||||
CURLE_COULDNT_RESOLVE_HOST, /* 6 */
|
||||
CURLE_COULDNT_CONNECT, /* 7 */
|
||||
CURLE_FTP_WEIRD_SERVER_REPLY, /* 8 */
|
||||
CURLE_FTP_ACCESS_DENIED, /* 9 a service was denied by the FTP server
|
||||
CURLE_REMOTE_ACCESS_DENIED, /* 9 a service was denied by the server
|
||||
due to lack of access - when login fails
|
||||
this is not returned. */
|
||||
CURLE_FTP_USER_PASSWORD_INCORRECT, /* 10 - NOT USED */
|
||||
CURLE_OBSOLETE10, /* 10 - NOT USED */
|
||||
CURLE_FTP_WEIRD_PASS_REPLY, /* 11 */
|
||||
CURLE_FTP_WEIRD_USER_REPLY, /* 12 */
|
||||
CURLE_OBSOLETE12, /* 12 - NOT USED */
|
||||
CURLE_FTP_WEIRD_PASV_REPLY, /* 13 */
|
||||
CURLE_FTP_WEIRD_227_FORMAT, /* 14 */
|
||||
CURLE_FTP_CANT_GET_HOST, /* 15 */
|
||||
CURLE_FTP_CANT_RECONNECT, /* 16 */
|
||||
CURLE_FTP_COULDNT_SET_BINARY, /* 17 */
|
||||
CURLE_OBSOLETE16, /* 16 - NOT USED */
|
||||
CURLE_FTP_COULDNT_SET_TYPE, /* 17 */
|
||||
CURLE_PARTIAL_FILE, /* 18 */
|
||||
CURLE_FTP_COULDNT_RETR_FILE, /* 19 */
|
||||
CURLE_FTP_WRITE_ERROR, /* 20 */
|
||||
CURLE_FTP_QUOTE_ERROR, /* 21 */
|
||||
CURLE_OBSOLETE20, /* 20 - NOT USED */
|
||||
CURLE_QUOTE_ERROR, /* 21 - quote command failure */
|
||||
CURLE_HTTP_RETURNED_ERROR, /* 22 */
|
||||
CURLE_WRITE_ERROR, /* 23 */
|
||||
CURLE_MALFORMAT_USER, /* 24 - NOT USED */
|
||||
CURLE_OBSOLETE24, /* 24 - NOT USED */
|
||||
CURLE_UPLOAD_FAILED, /* 25 - failed upload "command" */
|
||||
CURLE_READ_ERROR, /* 26 - could open/read from file */
|
||||
CURLE_OUT_OF_MEMORY, /* 27 */
|
||||
@@ -338,29 +344,29 @@ typedef enum {
|
||||
instead of a memory allocation error if CURL_DOES_CONVERSIONS
|
||||
is defined
|
||||
*/
|
||||
CURLE_OPERATION_TIMEOUTED, /* 28 - the timeout time was reached */
|
||||
CURLE_FTP_COULDNT_SET_ASCII, /* 29 - TYPE A failed */
|
||||
CURLE_OPERATION_TIMEDOUT, /* 28 - the timeout time was reached */
|
||||
CURLE_OBSOLETE29, /* 29 - NOT USED */
|
||||
CURLE_FTP_PORT_FAILED, /* 30 - FTP PORT operation failed */
|
||||
CURLE_FTP_COULDNT_USE_REST, /* 31 - the REST command failed */
|
||||
CURLE_FTP_COULDNT_GET_SIZE, /* 32 - the SIZE command failed */
|
||||
CURLE_HTTP_RANGE_ERROR, /* 33 - RANGE "command" didn't work */
|
||||
CURLE_OBSOLETE32, /* 32 - NOT USED */
|
||||
CURLE_RANGE_ERROR, /* 33 - RANGE "command" didn't work */
|
||||
CURLE_HTTP_POST_ERROR, /* 34 */
|
||||
CURLE_SSL_CONNECT_ERROR, /* 35 - wrong when connecting with SSL */
|
||||
CURLE_BAD_DOWNLOAD_RESUME, /* 36 - couldn't resume download */
|
||||
CURLE_FILE_COULDNT_READ_FILE, /* 37 */
|
||||
CURLE_LDAP_CANNOT_BIND, /* 38 */
|
||||
CURLE_LDAP_SEARCH_FAILED, /* 39 */
|
||||
CURLE_LIBRARY_NOT_FOUND, /* 40 */
|
||||
CURLE_OBSOLETE40, /* 40 - NOT USED */
|
||||
CURLE_FUNCTION_NOT_FOUND, /* 41 */
|
||||
CURLE_ABORTED_BY_CALLBACK, /* 42 */
|
||||
CURLE_BAD_FUNCTION_ARGUMENT, /* 43 */
|
||||
CURLE_BAD_CALLING_ORDER, /* 44 - NOT USED */
|
||||
CURLE_OBSOLETE44, /* 44 - NOT USED */
|
||||
CURLE_INTERFACE_FAILED, /* 45 - CURLOPT_INTERFACE failed */
|
||||
CURLE_BAD_PASSWORD_ENTERED, /* 46 - NOT USED */
|
||||
CURLE_OBSOLETE46, /* 46 - NOT USED */
|
||||
CURLE_TOO_MANY_REDIRECTS , /* 47 - catch endless re-direct loops */
|
||||
CURLE_UNKNOWN_TELNET_OPTION, /* 48 - User specified an unknown option */
|
||||
CURLE_TELNET_OPTION_SYNTAX , /* 49 - Malformed telnet option */
|
||||
CURLE_OBSOLETE, /* 50 - NOT USED */
|
||||
CURLE_OBSOLETE50, /* 50 - NOT USED */
|
||||
CURLE_SSL_PEER_CERTIFICATE, /* 51 - peer's certificate wasn't ok */
|
||||
CURLE_GOT_NOTHING, /* 52 - when this is a specific error */
|
||||
CURLE_SSL_ENGINE_NOTFOUND, /* 53 - SSL crypto engine not found */
|
||||
@@ -368,14 +374,14 @@ typedef enum {
|
||||
default */
|
||||
CURLE_SEND_ERROR, /* 55 - failed sending network data */
|
||||
CURLE_RECV_ERROR, /* 56 - failure in receiving network data */
|
||||
CURLE_SHARE_IN_USE, /* 57 - share is in use */
|
||||
CURLE_OBSOLETE57, /* 57 - NOT IN USE */
|
||||
CURLE_SSL_CERTPROBLEM, /* 58 - problem with the local certificate */
|
||||
CURLE_SSL_CIPHER, /* 59 - couldn't use specified cipher */
|
||||
CURLE_SSL_CACERT, /* 60 - problem with the CA cert (path?) */
|
||||
CURLE_BAD_CONTENT_ENCODING, /* 61 - Unrecognized transfer encoding */
|
||||
CURLE_LDAP_INVALID_URL, /* 62 - Invalid LDAP URL */
|
||||
CURLE_FILESIZE_EXCEEDED, /* 63 - Maximum file size exceeded */
|
||||
CURLE_FTP_SSL_FAILED, /* 64 - Requested FTP SSL level failed */
|
||||
CURLE_USE_SSL_FAILED, /* 64 - Requested FTP SSL level failed */
|
||||
CURLE_SEND_FAIL_REWIND, /* 65 - Sending the data requires a rewind
|
||||
that failed */
|
||||
CURLE_SSL_ENGINE_INITFAILED, /* 66 - failed to initialise ENGINE */
|
||||
@@ -383,10 +389,10 @@ typedef enum {
|
||||
accepted and we failed to login */
|
||||
CURLE_TFTP_NOTFOUND, /* 68 - file not found on server */
|
||||
CURLE_TFTP_PERM, /* 69 - permission problem on server */
|
||||
CURLE_TFTP_DISKFULL, /* 70 - out of disk space on server */
|
||||
CURLE_REMOTE_DISK_FULL, /* 70 - out of disk space on server */
|
||||
CURLE_TFTP_ILLEGAL, /* 71 - Illegal TFTP operation */
|
||||
CURLE_TFTP_UNKNOWNID, /* 72 - Unknown transfer ID */
|
||||
CURLE_TFTP_EXISTS, /* 73 - File already exists */
|
||||
CURLE_REMOTE_FILE_EXISTS, /* 73 - File already exists */
|
||||
CURLE_TFTP_NOSUCHUSER, /* 74 - No such user */
|
||||
CURLE_CONV_FAILED, /* 75 - conversion failed */
|
||||
CURLE_CONV_REQD, /* 76 - caller must register conversion
|
||||
@@ -406,6 +412,53 @@ typedef enum {
|
||||
CURL_LAST /* never use! */
|
||||
} CURLcode;
|
||||
|
||||
#ifndef CURL_NO_OLDIES /* define this to test if your app builds with all
|
||||
the obsolete stuff removed! */
|
||||
|
||||
/* Backwards compatibility with older names */
|
||||
/* These are scheduled to disappear by 2009 */
|
||||
|
||||
/* The following were added in 7.17.0 */
|
||||
#define CURLE_OBSOLETE CURLE_OBSOLETE50 /* noone should be using this! */
|
||||
#define CURLE_BAD_PASSWORD_ENTERED CURLE_OBSOLETE46
|
||||
#define CURLE_BAD_CALLING_ORDER CURLE_OBSOLETE44
|
||||
#define CURLE_FTP_USER_PASSWORD_INCORRECT CURLE_OBSOLETE10
|
||||
#define CURLE_FTP_CANT_RECONNECT CURLE_OBSOLETE16
|
||||
#define CURLE_FTP_COULDNT_GET_SIZE CURLE_OBSOLETE32
|
||||
#define CURLE_FTP_COULDNT_SET_ASCII CURLE_OBSOLETE29
|
||||
#define CURLE_FTP_WEIRD_USER_REPLY CURLE_OBSOLETE12
|
||||
#define CURLE_FTP_WRITE_ERROR CURLE_OBSOLETE20
|
||||
#define CURLE_LIBRARY_NOT_FOUND CURLE_OBSOLETE40
|
||||
#define CURLE_MALFORMAT_USER CURLE_OBSOLETE24
|
||||
#define CURLE_SHARE_IN_USE CURLE_OBSOLETE57
|
||||
#define CURLE_URL_MALFORMAT_USER CURLE_OBSOLETE4
|
||||
|
||||
#define CURLE_FTP_ACCESS_DENIED CURLE_REMOTE_ACCESS_DENIED
|
||||
#define CURLE_FTP_COULDNT_SET_BINARY CURLE_FTP_COULDNT_SET_TYPE
|
||||
#define CURLE_FTP_QUOTE_ERROR CURLE_QUOTE_ERROR
|
||||
#define CURLE_TFTP_DISKFULL CURLE_REMOTE_DISK_FULL
|
||||
#define CURLE_TFTP_EXISTS CURLE_REMOTE_FILE_EXISTS
|
||||
#define CURLE_HTTP_RANGE_ERROR CURLE_RANGE_ERROR
|
||||
#define CURLE_FTP_SSL_FAILED CURLE_USE_SSL_FAILED
|
||||
|
||||
/* The following were added earlier */
|
||||
|
||||
#define CURLE_OPERATION_TIMEOUTED CURLE_OPERATION_TIMEDOUT
|
||||
|
||||
#define CURLE_HTTP_NOT_FOUND CURLE_HTTP_RETURNED_ERROR
|
||||
#define CURLE_HTTP_PORT_FAILED CURLE_INTERFACE_FAILED
|
||||
#define CURLE_FTP_COULDNT_STOR_FILE CURLE_UPLOAD_FAILED
|
||||
|
||||
#define CURLE_FTP_PARTIAL_FILE CURLE_PARTIAL_FILE
|
||||
#define CURLE_FTP_BAD_DOWNLOAD_RESUME CURLE_BAD_DOWNLOAD_RESUME
|
||||
|
||||
/* This was the error code 50 in 7.7.3 and a few earlier versions, this
|
||||
is no longer used by libcurl but is instead #defined here only to not
|
||||
make programs break */
|
||||
#define CURLE_ALREADY_COMPLETE 99999
|
||||
|
||||
#endif /*!CURL_NO_OLDIES*/
|
||||
|
||||
/* This prototype applies to all conversion callbacks */
|
||||
typedef CURLcode (*curl_conv_callback)(char *buffer, size_t length);
|
||||
|
||||
@@ -414,17 +467,6 @@ typedef CURLcode (*curl_ssl_ctx_callback)(CURL *curl, /* easy handle */
|
||||
OpenSSL SSL_CTX */
|
||||
void *userptr);
|
||||
|
||||
/* Make a spelling correction for the operation timed-out define */
|
||||
#define CURLE_OPERATION_TIMEDOUT CURLE_OPERATION_TIMEOUTED
|
||||
|
||||
#ifndef CURL_NO_OLDIES /* define this to test if your app builds with all
|
||||
the obsolete stuff removed! */
|
||||
/* backwards compatibility with older names */
|
||||
#define CURLE_HTTP_NOT_FOUND CURLE_HTTP_RETURNED_ERROR
|
||||
#define CURLE_HTTP_PORT_FAILED CURLE_INTERFACE_FAILED
|
||||
#define CURLE_FTP_COULDNT_STOR_FILE CURLE_UPLOAD_FAILED
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
CURLPROXY_HTTP = 0,
|
||||
CURLPROXY_SOCKS4 = 4,
|
||||
@@ -447,28 +489,30 @@ typedef enum {
|
||||
#define CURLSSH_AUTH_KEYBOARD (1<<3) /* keyboard interactive */
|
||||
#define CURLSSH_AUTH_DEFAULT CURLSSH_AUTH_ANY
|
||||
|
||||
#ifndef CURL_NO_OLDIES /* define this to test if your app builds with all
|
||||
the obsolete stuff removed! */
|
||||
/* this was the error code 50 in 7.7.3 and a few earlier versions, this
|
||||
is no longer used by libcurl but is instead #defined here only to not
|
||||
make programs break */
|
||||
#define CURLE_ALREADY_COMPLETE 99999
|
||||
|
||||
/* These are just to make older programs not break: */
|
||||
#define CURLE_FTP_PARTIAL_FILE CURLE_PARTIAL_FILE
|
||||
#define CURLE_FTP_BAD_DOWNLOAD_RESUME CURLE_BAD_DOWNLOAD_RESUME
|
||||
#endif
|
||||
|
||||
#define CURL_ERROR_SIZE 256
|
||||
|
||||
/* parameter for the CURLOPT_FTP_SSL option */
|
||||
/* parameter for the CURLOPT_USE_SSL option */
|
||||
typedef enum {
|
||||
CURLFTPSSL_NONE, /* do not attempt to use SSL */
|
||||
CURLFTPSSL_TRY, /* try using SSL, proceed anyway otherwise */
|
||||
CURLFTPSSL_CONTROL, /* SSL for the control connection or fail */
|
||||
CURLFTPSSL_ALL, /* SSL for all communication or fail */
|
||||
CURLFTPSSL_LAST /* not an option, never use */
|
||||
} curl_ftpssl;
|
||||
CURLUSESSL_NONE, /* do not attempt to use SSL */
|
||||
CURLUSESSL_TRY, /* try using SSL, proceed anyway otherwise */
|
||||
CURLUSESSL_CONTROL, /* SSL for the control connection or fail */
|
||||
CURLUSESSL_ALL, /* SSL for all communication or fail */
|
||||
CURLUSESSL_LAST /* not an option, never use */
|
||||
} curl_usessl;
|
||||
|
||||
#ifndef CURL_NO_OLDIES /* define this to test if your app builds with all
|
||||
the obsolete stuff removed! */
|
||||
|
||||
/* Backwards compatibility with older names */
|
||||
/* These are scheduled to disappear by 2009 */
|
||||
|
||||
#define CURLFTPSSL_NONE CURLUSESSL_NONE
|
||||
#define CURLFTPSSL_TRY CURLUSESSL_TRY
|
||||
#define CURLFTPSSL_CONTROL CURLUSESSL_CONTROL
|
||||
#define CURLFTPSSL_ALL CURLUSESSL_ALL
|
||||
#define CURLFTPSSL_LAST CURLUSESSL_LAST
|
||||
#define curl_ftpssl curl_usessl
|
||||
#endif /*!CURL_NO_OLDIES*/
|
||||
|
||||
/* parameter for the CURLOPT_FTP_SSL_CCC option */
|
||||
typedef enum {
|
||||
@@ -517,7 +561,8 @@ typedef enum {
|
||||
*/
|
||||
#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) || \
|
||||
defined(__HP_aCC) || defined(__BORLANDC__) || defined(__LCC__) || \
|
||||
defined(__POCC__) || defined(__SALFORDC__) || defined(__HIGHC__)
|
||||
defined(__POCC__) || defined(__SALFORDC__) || defined(__HIGHC__) || \
|
||||
defined(__ILEC400__)
|
||||
/* This compiler is believed to have an ISO compatible preprocessor */
|
||||
#define CURL_ISOCPP
|
||||
#else
|
||||
@@ -615,7 +660,7 @@ typedef enum {
|
||||
*/
|
||||
|
||||
/* Set the "low speed limit" */
|
||||
CINIT(LOW_SPEED_LIMIT, LONG , 19),
|
||||
CINIT(LOW_SPEED_LIMIT, LONG, 19),
|
||||
|
||||
/* Set the "low speed time" */
|
||||
CINIT(LOW_SPEED_TIME, LONG, 20),
|
||||
@@ -640,10 +685,8 @@ typedef enum {
|
||||
/* name of the file keeping your private SSL-certificate */
|
||||
CINIT(SSLCERT, OBJECTPOINT, 25),
|
||||
|
||||
/* password for the SSL-private key, keep this for compatibility */
|
||||
CINIT(SSLCERTPASSWD, OBJECTPOINT, 26),
|
||||
/* password for the SSL private key */
|
||||
CINIT(SSLKEYPASSWD, OBJECTPOINT, 26),
|
||||
/* password for the SSL or SSH private key */
|
||||
CINIT(KEYPASSWD, OBJECTPOINT, 26),
|
||||
|
||||
/* send TYPE parameter? */
|
||||
CINIT(CRLF, LONG, 27),
|
||||
@@ -697,9 +740,9 @@ typedef enum {
|
||||
CINIT(FAILONERROR, LONG, 45), /* no output on http error codes >= 300 */
|
||||
CINIT(UPLOAD, LONG, 46), /* this is an upload */
|
||||
CINIT(POST, LONG, 47), /* HTTP POST method */
|
||||
CINIT(FTPLISTONLY, LONG, 48), /* Use NLST when listing ftp dir */
|
||||
CINIT(DIRLISTONLY, LONG, 48), /* return bare names when listing directories */
|
||||
|
||||
CINIT(FTPAPPEND, LONG, 50), /* Append instead of overwrite on upload! */
|
||||
CINIT(APPEND, LONG, 50), /* Append instead of overwrite on upload! */
|
||||
|
||||
/* Specify whether to read the user+password from the .netrc or the URL.
|
||||
* This must be one of the CURL_NETRC_* enums below. */
|
||||
@@ -740,8 +783,6 @@ typedef enum {
|
||||
* is a string, 'clear', 'safe', 'confidential' or 'private'. If the string
|
||||
* is set but doesn't match one of these, 'private' will be used. */
|
||||
CINIT(KRBLEVEL, OBJECTPOINT, 63),
|
||||
/* This is for compatibility with older curl releases */
|
||||
#define CURLOPT_KRB4LEVEL CURLOPT_KRBLEVEL
|
||||
|
||||
/* Set if we should verify the peer in ssl handshake, set 1 to verify. */
|
||||
CINIT(SSL_VERIFYPEER, LONG, 64),
|
||||
@@ -842,7 +883,7 @@ typedef enum {
|
||||
CINIT(SSLENGINE_DEFAULT, LONG, 90),
|
||||
|
||||
/* Non-zero value means to use the global dns cache */
|
||||
CINIT(DNS_USE_GLOBAL_CACHE, LONG, 91), /* To becomeO BSOLETE soon */
|
||||
CINIT(DNS_USE_GLOBAL_CACHE, LONG, 91), /* To become OBSOLETE soon */
|
||||
|
||||
/* DNS cache timeout */
|
||||
CINIT(DNS_CACHE_TIMEOUT, LONG, 92),
|
||||
@@ -924,7 +965,7 @@ typedef enum {
|
||||
getting a response. This is different from transfer timeout time and
|
||||
essentially places a demand on the FTP server to acknowledge commands
|
||||
in a timely manner. */
|
||||
CINIT(FTP_RESPONSE_TIMEOUT, LONG , 112),
|
||||
CINIT(FTP_RESPONSE_TIMEOUT, LONG, 112),
|
||||
|
||||
/* Set this option to one of the CURL_IPRESOLVE_* defines (see below) to
|
||||
tell libcurl to resolve names to those IP versions only. This only has
|
||||
@@ -964,7 +1005,7 @@ typedef enum {
|
||||
CURLFTPSSL_CONTROL - SSL for the control connection or fail
|
||||
CURLFTPSSL_ALL - SSL for all communication or fail
|
||||
*/
|
||||
CINIT(FTP_SSL, LONG, 119),
|
||||
CINIT(USE_SSL, LONG, 119),
|
||||
|
||||
/* The _LARGE version of the standard POSTFIELDSIZE option */
|
||||
CINIT(POSTFIELDSIZE_LARGE, OFF_T, 120),
|
||||
@@ -980,7 +1021,7 @@ typedef enum {
|
||||
/* 127 OBSOLETE. Gone in 7.16.0 */
|
||||
/* 128 OBSOLETE. Gone in 7.16.0 */
|
||||
|
||||
/* When FTP over SSL/TLS is selected (with CURLOPT_FTP_SSL), this option
|
||||
/* When FTP over SSL/TLS is selected (with CURLOPT_USE_SSL), this option
|
||||
can be used to change libcurl's default action which is to first try
|
||||
"AUTH SSL" and then "AUTH TLS" in this order, and proceed when a OK
|
||||
response has been received.
|
||||
@@ -1086,6 +1127,29 @@ typedef enum {
|
||||
CURLOPT_LASTENTRY /* the last unused */
|
||||
} CURLoption;
|
||||
|
||||
#ifndef CURL_NO_OLDIES /* define this to test if your app builds with all
|
||||
the obsolete stuff removed! */
|
||||
|
||||
/* Backwards compatibility with older names */
|
||||
/* These are scheduled to disappear by 2009 */
|
||||
|
||||
/* The following were added in 7.17.0 */
|
||||
#define CURLOPT_SSLKEYPASSWD CURLOPT_KEYPASSWD
|
||||
#define CURLOPT_FTPAPPEND CURLOPT_APPEND
|
||||
#define CURLOPT_FTPLISTONLY CURLOPT_DIRLISTONLY
|
||||
#define CURLOPT_FTP_SSL CURLOPT_USE_SSL
|
||||
|
||||
/* The following were added earlier */
|
||||
|
||||
#define CURLOPT_SSLCERTPASSWD CURLOPT_KEYPASSWD
|
||||
#define CURLOPT_KRB4LEVEL CURLOPT_KRBLEVEL
|
||||
|
||||
#else
|
||||
/* This is set if CURL_NO_OLDIES is defined at compile-time */
|
||||
#undef CURLOPT_DNS_USE_GLOBAL_CACHE /* soon obsolete */
|
||||
#endif
|
||||
|
||||
|
||||
/* Below here follows defines for the CURLOPT_IPRESOLVE option. If a host
|
||||
name resolves addresses using more than one IP protocol version, this
|
||||
option might be handy to force libcurl to use a specific IP version. */
|
||||
@@ -1099,14 +1163,6 @@ typedef enum {
|
||||
#define CURLOPT_READDATA CURLOPT_INFILE
|
||||
#define CURLOPT_HEADERDATA CURLOPT_WRITEHEADER
|
||||
|
||||
#ifndef CURL_NO_OLDIES /* define this to test if your app builds with all
|
||||
the obsolete stuff removed! */
|
||||
#else
|
||||
/* This is set if CURL_NO_OLDIES is defined at compile-time */
|
||||
#undef CURLOPT_DNS_USE_GLOBAL_CACHE /* soon obsolete */
|
||||
#endif
|
||||
|
||||
|
||||
/* These enums are for use with the CURLOPT_HTTP_VERSION option. */
|
||||
enum {
|
||||
CURL_HTTP_VERSION_NONE, /* setting this means we don't care, and that we'd
|
||||
|
||||
@@ -154,7 +154,7 @@ $(OBJ_DIR)\url.obj: url.c setup.h config-win32.h setup_once.h urldata.h cookie.h
|
||||
http_chunks.h hostip.h hash.h llist.h splay.h netrc.h base64.h sslgen.h &
|
||||
transfer.h sendf.h progress.h strequal.h strerror.h escape.h strtok.h &
|
||||
share.h content_encoding.h http_digest.h http_negotiate.h select.h &
|
||||
multiif.h ftp.h dict.h telnet.h tftp.h http.h file.h ldap.h url.h &
|
||||
multiif.h ftp.h dict.h telnet.h tftp.h http.h file.h curl_ldap.h url.h &
|
||||
connect.h inet_ntop.h http_ntlm.h .\ca-bundle.h &
|
||||
..\include\curl\mprintf.h memory.h memdebug.h .\memory.h
|
||||
$(OBJ_DIR)\dict.obj: dict.c setup.h config-win32.h setup_once.h urldata.h cookie.h &
|
||||
|
||||
@@ -34,6 +34,7 @@ EXTRA_DIST = Makefile.b32 Makefile.m32 Makefile.vc6 Makefile.riscos \
|
||||
libcurl.framework.make 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 \
|
||||
Makefile.Watcom config-tpf.h $(DOCS) $(VCPROJ)
|
||||
|
||||
CLEANFILES = $(DSP) $(VCPROJ)
|
||||
|
||||
@@ -13,7 +13,7 @@ CSOURCES = file.c timeval.c base64.c hostip.c progress.c formdata.c \
|
||||
|
||||
HHEADERS = arpa_telnet.h netrc.h file.h timeval.h base64.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 ldap.h ssluse.h escape.h telnet.h \
|
||||
if2ip.h speedcheck.h urldata.h curl_ldap.h ssluse.h escape.h telnet.h \
|
||||
getinfo.h strequal.h krb4.h memdebug.h inet_ntoa_r.h http_chunks.h \
|
||||
strtok.h connect.h llist.h hash.h content_encoding.h share.h md5.h \
|
||||
http_digest.h http_negotiate.h http_ntlm.h ca-bundle.h inet_pton.h \
|
||||
|
||||
@@ -1,22 +1,35 @@
|
||||
#############################################################
|
||||
#########################################################################
|
||||
# $Id$
|
||||
#
|
||||
## Makefile for building libcurl.a with MingW32 (GCC-3.2) and
|
||||
## optionally OpenSSL (0.9.8)
|
||||
## optionally OpenSSL (0.9.8), libssh2 (0.17), zlib (1.2.3)
|
||||
##
|
||||
## Use: mingw32-make -f Makefile.m32 [SSL=1] [SSH2=1] [DYN=1]
|
||||
## Usage:
|
||||
## mingw32-make -f Makefile.m32 [SSL=1] [SSH2=1] [ZLIB=1] [SSPI=1] [IPV6=1] [DYN=1]
|
||||
##
|
||||
## Hint: you can also set environment vars to control the build, f.e.:
|
||||
## set ZLIB_PATH=c:/zlib-1.2.3
|
||||
## 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.3
|
||||
endif
|
||||
# Edit the path below to point to the base of your OpenSSL package.
|
||||
ifndef OPENSSL_PATH
|
||||
OPENSSL_PATH = ../../openssl-0.9.8e
|
||||
endif
|
||||
# Edit the path below to point to the base of your LibSSH2 package.
|
||||
ifndef LIBSSH2_PATH
|
||||
LIBSSH2_PATH = ../../libssh2-0.16
|
||||
LIBSSH2_PATH = ../../libssh2-0.17
|
||||
endif
|
||||
ifndef ZLIB_PATH
|
||||
ZLIB_PATH = ../../zlib-1.2.3
|
||||
# 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
|
||||
|
||||
ARES_LIB = ../ares
|
||||
@@ -40,6 +53,7 @@ ifdef ARES
|
||||
INCLUDES += -I$(ARES_LIB)
|
||||
CFLAGS += -DUSE_ARES
|
||||
DLL_LIBS += -L$(ARES_LIB) -lcares
|
||||
libcurl_dll_DEPENDENCIES = $(ARES_LIB)/libcares.a
|
||||
endif
|
||||
ifdef SSH2
|
||||
INCLUDES += -I"$(LIBSSH2_PATH)/include" -I"$(LIBSSH2_PATH)/win32"
|
||||
@@ -64,35 +78,55 @@ 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 -lwinmm
|
||||
COMPILE = $(CC) $(INCLUDES) $(CFLAGS)
|
||||
|
||||
# Makefile.inc provides the CSOURCES and HHEADERS defines
|
||||
include Makefile.inc
|
||||
|
||||
libcurl_a_OBJECTS := $(patsubst %.c,%.o,$(strip $(CSOURCES)))
|
||||
libcurl_dll_LIBRARY = libcurl.dll
|
||||
libcurl_dll_a_LIBRARY = libcurldll.a
|
||||
libcurl_a_LIBRARY = libcurl.a
|
||||
|
||||
libcurl_a_LIBRARIES = libcurl.a
|
||||
libcurl_a_DEPENDENCIES = $(strip $(CSOURCES) $(HHEADERS))
|
||||
libcurl_a_OBJECTS := $(patsubst %.c,%.o,$(strip $(CSOURCES)))
|
||||
libcurl_a_DEPENDENCIES := $(strip $(CSOURCES) $(HHEADERS))
|
||||
|
||||
RESOURCE = libcurl.res
|
||||
|
||||
.SUFFIXES: .rc .res
|
||||
|
||||
all: libcurl.a libcurl.dll libcurldll.a
|
||||
all: ca-bundle.h $(libcurl_a_LIBRARY) $(libcurl_dll_LIBRARY)
|
||||
|
||||
libcurl.a: $(libcurl_a_OBJECTS) $(libcurl_a_DEPENDENCIES)
|
||||
$(RM) libcurl.a
|
||||
$(AR) cru libcurl.a $(libcurl_a_OBJECTS)
|
||||
$(RANLIB) libcurl.a
|
||||
$(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 libcurldll.a: $(libcurl_a_OBJECTS) $(RESOURCE)
|
||||
$(RM) $@
|
||||
$(CC) $(LDFLAGS) -shared -Wl,--out-implib,libcurldll.a -o libcurl.dll \
|
||||
$(libcurl_a_OBJECTS) $(RESOURCE) $(DLL_LIBS)
|
||||
$(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 $<
|
||||
@@ -101,8 +135,19 @@ libcurl.dll libcurldll.a: $(libcurl_a_OBJECTS) $(RESOURCE)
|
||||
$(RC) $(RCFLAGS) $< -o $@
|
||||
|
||||
clean:
|
||||
$(RM) $(libcurl_a_OBJECTS) $(RESOURCE)
|
||||
-$(RM) $(libcurl_a_OBJECTS) $(RESOURCE) ca-bundle.h
|
||||
|
||||
distrib: clean
|
||||
$(RM) $(libcurl_a_LIBRARIES)
|
||||
-$(RM) $(libcurl_a_LIBRARY) $(libcurl_dll_LIBRARY) $(libcurl_dll_a_LIBRARY)
|
||||
|
||||
FORCE: ;
|
||||
|
||||
ca-bundle.h: FORCE Makefile.m32
|
||||
@echo Creating $@
|
||||
@echo $(DL)/* Do not edit this file - it is created by make!$(DL) > $@
|
||||
@echo $(DL)*/$(DL) >> $@
|
||||
|
||||
$(ARES_LIB)/libcares.a:
|
||||
$(MAKE) -C $(ARES_LIB) -f Makefile.m32
|
||||
|
||||
|
||||
|
||||
@@ -174,15 +174,14 @@ ifeq ($(LIBARCH),LIBC)
|
||||
INCLUDES += -I$(SDK_LIBC)/include
|
||||
# INCLUDES += -I$(SDK_LIBC)/include/nks
|
||||
# INCLUDES += -I$(SDK_LIBC)/include/winsock
|
||||
# INCLUDES += -I$(SDK_LDAP)/libc/inc
|
||||
CFLAGS += -D_POSIX_SOURCE
|
||||
else
|
||||
INCLUDES += -I$(SDK_CLIB)/include/nlm
|
||||
# INCLUDES += -I$(SDK_CLIB)/include/nlm/obsolete
|
||||
# INCLUDES += -I$(SDK_CLIB)/include
|
||||
# INCLUDES += -I$(SDK_LDAP)/clib/inc
|
||||
# for now disable LDAP unless we have coded a CLIB dynaloader.
|
||||
DISABLE_LDAP = 1
|
||||
endif
|
||||
ifndef DISABLE_LDAP
|
||||
INCLUDES += -I$(SDK_LDAP)/$(LIBARCH_L)/inc
|
||||
endif
|
||||
CFLAGS += $(INCLUDES)
|
||||
|
||||
@@ -306,9 +305,12 @@ ifeq ($(LIBARCH),CLIB)
|
||||
@echo $(DL)import @$(SDK_CLIB)/imports/threads.imp$(DL) >> $@
|
||||
@echo $(DL)import @$(SDK_CLIB)/imports/nlmlib.imp$(DL) >> $@
|
||||
@echo $(DL)import @$(SDK_CLIB)/imports/socklib.imp$(DL) >> $@
|
||||
# @echo $(DL)import @$(SDK_LDAP)/clib/imports/ldapsdk.imp$(DL) >> $@
|
||||
# @echo $(DL)import @$(SDK_LDAP)/clib/imports/ldapssl.imp$(DL) >> $@
|
||||
# @echo $(DL)import @$(SDK_LDAP)/clib/imports/ldapx.imp$(DL) >> $@
|
||||
ifndef DISABLE_LDAP
|
||||
@echo $(DL)import @$(SDK_LDAP)/clib/imports/ldapsdk.imp$(DL) >> $@
|
||||
@echo $(DL)import @$(SDK_LDAP)/clib/imports/ldapssl.imp$(DL) >> $@
|
||||
@echo $(DL)import @$(SDK_LDAP)/clib/imports/ldapx.imp$(DL) >> $@
|
||||
@echo $(DL)module ldapsdk$(DL) >> $@
|
||||
endif
|
||||
@echo $(DL)module clib$(DL) >> $@
|
||||
else
|
||||
@echo $(DL)pseudopreemption$(DL) >> $@
|
||||
@@ -317,9 +319,12 @@ else
|
||||
@echo $(DL)check _LibCCheckUnload$(DL) >> $@
|
||||
@echo $(DL)import @$(SDK_LIBC)/imports/libc.imp$(DL) >> $@
|
||||
@echo $(DL)import @$(SDK_LIBC)/imports/netware.imp$(DL) >> $@
|
||||
# @echo $(DL)import @$(SDK_LDAP)/libc/imports/lldapsdk.imp$(DL) >> $@
|
||||
# @echo $(DL)import @$(SDK_LDAP)/libc/imports/lldapssl.imp$(DL) >> $@
|
||||
# @echo $(DL)import @$(SDK_LDAP)/libc/imports/lldapx.imp$(DL) >> $@
|
||||
ifndef DISABLE_LDAP
|
||||
@echo $(DL)import @$(SDK_LDAP)/libc/imports/lldapsdk.imp$(DL) >> $@
|
||||
@echo $(DL)import @$(SDK_LDAP)/libc/imports/lldapssl.imp$(DL) >> $@
|
||||
@echo $(DL)import @$(SDK_LDAP)/libc/imports/lldapx.imp$(DL) >> $@
|
||||
@echo $(DL)module lldapsdk$(DL) >> $@
|
||||
endif
|
||||
@echo $(DL)module libc$(DL) >> $@
|
||||
endif
|
||||
ifdef MODULES
|
||||
@@ -370,8 +375,6 @@ ifeq ($(LIBARCH),CLIB)
|
||||
@echo $(DL)#define DL_LDAP_FILE "ldapsdk.nlm"$(DL) >> $@
|
||||
else
|
||||
@echo $(DL)#define OS "i586-pc-libc-NetWare"$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_DLFCN_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_DLOPEN 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_FTRUNCATE 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_GETTIMEOFDAY 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_INET_PTON 1$(DL) >> $@
|
||||
@@ -452,10 +455,18 @@ endif
|
||||
@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) >> $@
|
||||
|
||||
@@ -137,7 +137,7 @@ size_t Curl_base64_decode(const char *src, unsigned char **outptr)
|
||||
*
|
||||
* Returns the length of the newly created base64 string. The third argument
|
||||
* is a pointer to an allocated area holding the base64 data. If something
|
||||
* went wrong, -1 is returned.
|
||||
* went wrong, 0 is returned.
|
||||
*
|
||||
*/
|
||||
size_t Curl_base64_encode(struct SessionHandle *data,
|
||||
@@ -265,7 +265,7 @@ int main(int argc, argv_item_t argv[], char **envp)
|
||||
handle = curl_easy_init();
|
||||
if(handle == NULL) {
|
||||
fprintf(stderr, "Error: curl_easy_init failed\n");
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
data = (unsigned char *)suck(&dataLen);
|
||||
@@ -305,7 +305,7 @@ int main(int argc, argv_item_t argv[], char **envp)
|
||||
struct SessionHandle *handle = curl_easy_init();
|
||||
if(handle == NULL) {
|
||||
fprintf(stderr, "Error: curl_easy_init failed\n");
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
475
lib/config-os400.h
Normal file
475
lib/config-os400.h
Normal file
@@ -0,0 +1,475 @@
|
||||
/* ================================================================ */
|
||||
/* 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
|
||||
|
||||
/* Define if you have the gethostbyname_r() function with 3 arguments */
|
||||
#define 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 have the inet_ntoa_r function declared. */
|
||||
#define HAVE_INET_NTOA_R_DECL
|
||||
|
||||
/* Define if the inet_ntoa_r function returns an int. */
|
||||
#define HAVE_INT_INET_NTOA_R
|
||||
|
||||
/* 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 this to 'int' if ssize_t is not an available typedefed type */
|
||||
#undef ssize_t
|
||||
|
||||
/* Define this to 'int' if socklen_t is not an available typedefed type */
|
||||
#undef socklen_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
|
||||
|
||||
/* Set to explicitly specify we don't want to use thread-safe functions */
|
||||
#undef DISABLED_THREADSAFE
|
||||
|
||||
/* 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 getaddrinfo exists and works */
|
||||
/* OS400 has no ASCII version of this procedure. */
|
||||
#undef HAVE_GETADDRINFO
|
||||
|
||||
/* 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 `gethostbyname_r' function. */
|
||||
#define HAVE_GETHOSTBYNAME_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 `inet_ntoa' function. */
|
||||
#define HAVE_INET_NTOA
|
||||
|
||||
/* Define if you have the `inet_ntoa_r' function. */
|
||||
#define HAVE_INET_NTOA_R
|
||||
|
||||
/* 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 `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/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 a `long double', as computed by sizeof. */
|
||||
#define SIZEOF_LONG_DOUBLE 8
|
||||
|
||||
/* The size of a `long long', as computed by sizeof. */
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
|
||||
/* Whether long long constants must be suffixed by LL. */
|
||||
|
||||
#define HAVE_LL
|
||||
|
||||
/* The size of `curl_off_t', as computed by sizeof. */
|
||||
|
||||
#ifndef _LARGE_FILES
|
||||
#define _LARGE_FILES
|
||||
#endif
|
||||
|
||||
#define SIZEOF_CURL_OFF_T 8
|
||||
|
||||
/* 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. */
|
||||
#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 */
|
||||
#define in_addr_t unsigned long
|
||||
|
||||
/* Define to `unsigned' if <sys/types.h> does not define. */
|
||||
#undef size_t
|
||||
|
||||
#define IOCTL_3_ARGS
|
||||
|
||||
#define HAVE_FIONBIO
|
||||
|
||||
/* to disable LDAP */
|
||||
#undef CURL_DISABLE_LDAP
|
||||
|
||||
/* 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. */
|
||||
#undef 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 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"
|
||||
@@ -74,12 +74,6 @@
|
||||
/* Define if you have the <des.h> header file. */
|
||||
#undef HAVE_DES_H
|
||||
|
||||
/* Define if you have the <dlfcn.h> header file. */
|
||||
#undef HAVE_DLFCN_H
|
||||
|
||||
/* Define if you have the `dlopen' function. */
|
||||
#undef HAVE_DLOPEN
|
||||
|
||||
/* Define if you have the <err.h> header file. */
|
||||
#undef HAVE_ERR_H
|
||||
|
||||
@@ -146,9 +140,6 @@
|
||||
/* Define if you have the `crypto' library (-lcrypto). */
|
||||
#undef HAVE_LIBCRYPTO
|
||||
|
||||
/* Define if you have the `dl' library (-ldl). */
|
||||
#undef HAVE_LIBDL
|
||||
|
||||
/* Define if you have the `nsl' library (-lnsl). */
|
||||
#undef HAVE_LIBNSL
|
||||
|
||||
|
||||
@@ -104,12 +104,6 @@
|
||||
/* disabled non-blocking sockets */
|
||||
/* #undef HAVE_DISABLED_NONBLOCKING */
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#define HAVE_DLFCN_H 1
|
||||
|
||||
/* Define to 1 if you have the `dlopen' function. */
|
||||
#define HAVE_DLOPEN 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
|
||||
@@ -244,9 +238,6 @@
|
||||
/* Define to 1 if you have the <krb.h> header file. */
|
||||
/* #undef HAVE_KRB_H */
|
||||
|
||||
/* Define to 1 if you have the `dl' library (-ldl). */
|
||||
#define HAVE_LIBDL 1
|
||||
|
||||
/* Define to 1 if you have the <libgen.h> header file. */
|
||||
/* #undef HAVE_LIBGEN_H 1 */
|
||||
|
||||
|
||||
@@ -18,9 +18,6 @@
|
||||
/* Define if you have the <crypto.h> header file. */
|
||||
/* #define HAVE_CRYPTO_H 1 */
|
||||
|
||||
/* Define if you have the <dlfcn.h> header file. */
|
||||
/* #define HAVE_DLFCN_H 1 */
|
||||
|
||||
/* Define if you have the <err.h> header file. */
|
||||
/* #define HAVE_ERR_H 1 */
|
||||
|
||||
@@ -353,14 +350,23 @@
|
||||
#endif
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* LDAP LIBRARY FILES */
|
||||
/* LDAP SUPPORT */
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
/* lber dynamic library file */
|
||||
/* #define DL_LBER_FILE */
|
||||
|
||||
/* ldap dynamic library file */
|
||||
#define DL_LDAP_FILE "wldap32.dll"
|
||||
#if defined(CURL_HAS_NOVELL_LDAPSDK) || defined(CURL_HAS_MOZILLA_LDAPSDK)
|
||||
#undef CURL_LDAP_HYBRID
|
||||
#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_HYBRID
|
||||
#undef CURL_LDAP_WIN
|
||||
#define HAVE_LDAP_URL_PARSE 1
|
||||
#else
|
||||
#undef CURL_LDAP_HYBRID
|
||||
#undef HAVE_LDAP_URL_PARSE
|
||||
#define CURL_LDAP_WIN 1
|
||||
#endif
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* ADDITIONAL DEFINITIONS */
|
||||
|
||||
@@ -18,9 +18,6 @@
|
||||
/* Define if you have the <crypto.h> header file. */
|
||||
/* #define HAVE_CRYPTO_H 1 */
|
||||
|
||||
/* Define if you have the <dlfcn.h> header file. */
|
||||
/* #define HAVE_DLFCN_H 1 */
|
||||
|
||||
/* Define if you have the <err.h> header file. */
|
||||
/* #define HAVE_ERR_H 1 */
|
||||
|
||||
@@ -317,14 +314,12 @@
|
||||
/* #undef const */
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* LDAP LIBRARY FILES */
|
||||
/* LDAP SUPPORT */
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
/* lber dynamic library file */
|
||||
/* #define DL_LBER_FILE */
|
||||
|
||||
/* ldap dynamic library file */
|
||||
/* #define DL_LDAP_FILE "wldap32.dll" */
|
||||
#define CURL_LDAP_WIN 1
|
||||
#undef CURL_LDAP_HYBRID
|
||||
#undef HAVE_LDAP_URL_PARSE
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* ADDITIONAL DEFINITIONS */
|
||||
|
||||
@@ -440,6 +440,13 @@ static bool verifyconnect(curl_socket_t sockfd, int *error)
|
||||
SET_SOCKERRNO(0);
|
||||
err = 0;
|
||||
}
|
||||
#endif
|
||||
#ifdef __minix
|
||||
/* Minix 3.1.x doesn't support getsockopt on UDP sockets */
|
||||
if (EBADIOCTL == err) {
|
||||
SET_SOCKERRNO(0);
|
||||
err = 0;
|
||||
}
|
||||
#endif
|
||||
if ((0 == err) || (EISCONN == err))
|
||||
/* we are connected, awesome! */
|
||||
@@ -552,7 +559,7 @@ CURLcode Curl_is_connected(struct connectdata *conn,
|
||||
if(has_passed > allow ) {
|
||||
/* time-out, bail out, go home */
|
||||
failf(data, "Connection time-out after %ld ms", has_passed);
|
||||
return CURLE_OPERATION_TIMEOUTED;
|
||||
return CURLE_OPERATION_TIMEDOUT;
|
||||
}
|
||||
if(conn->bits.tcpconnect) {
|
||||
/* we are connected already! */
|
||||
@@ -827,7 +834,7 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
|
||||
if(timeout_ms < 0) {
|
||||
/* a precaution, no need to continue if time already is up */
|
||||
failf(data, "Connection time-out");
|
||||
return CURLE_OPERATION_TIMEOUTED;
|
||||
return CURLE_OPERATION_TIMEDOUT;
|
||||
}
|
||||
}
|
||||
Curl_expire(data, timeout_ms);
|
||||
@@ -863,7 +870,7 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
|
||||
timeout_ms -= Curl_tvdiff(after, before);
|
||||
if(timeout_ms < 0) {
|
||||
failf(data, "connect() timed out!");
|
||||
return CURLE_OPERATION_TIMEOUTED;
|
||||
return CURLE_OPERATION_TIMEDOUT;
|
||||
}
|
||||
before = after;
|
||||
} /* end of connect-to-each-address loop */
|
||||
|
||||
22
lib/cookie.c
22
lib/cookie.c
@@ -172,16 +172,13 @@ Curl_cookie_add(struct SessionHandle *data,
|
||||
struct CookieInfo *c,
|
||||
bool httpheader, /* TRUE if HTTP header-style line */
|
||||
char *lineptr, /* first character of the line */
|
||||
char *domain, /* default domain */
|
||||
char *path) /* full path used when this cookie is set,
|
||||
const char *domain, /* default domain */
|
||||
const char *path) /* full path used when this cookie is set,
|
||||
used to get default path for the cookie
|
||||
unless set */
|
||||
{
|
||||
struct Cookie *clist;
|
||||
char *what;
|
||||
char name[MAX_NAME];
|
||||
char *ptr;
|
||||
char *semiptr;
|
||||
struct Cookie *co;
|
||||
struct Cookie *lastc=NULL;
|
||||
time_t now = time(NULL);
|
||||
@@ -199,7 +196,10 @@ Curl_cookie_add(struct SessionHandle *data,
|
||||
|
||||
if(httpheader) {
|
||||
/* This line was read off a HTTP-header */
|
||||
char *sep;
|
||||
const char *ptr;
|
||||
const char *sep;
|
||||
const char *semiptr;
|
||||
char *what;
|
||||
|
||||
what = malloc(MAX_COOKIE_LINE);
|
||||
if(!what) {
|
||||
@@ -228,7 +228,7 @@ Curl_cookie_add(struct SessionHandle *data,
|
||||
name, what)) {
|
||||
/* this is a <name>=<what> pair */
|
||||
|
||||
char *whatptr;
|
||||
const char *whatptr;
|
||||
|
||||
/* Strip off trailing whitespace from the 'what' */
|
||||
size_t len=strlen(what);
|
||||
@@ -428,6 +428,7 @@ Curl_cookie_add(struct SessionHandle *data,
|
||||
else {
|
||||
/* This line is NOT a HTTP header style line, we do offer support for
|
||||
reading the odd netscape cookies-file format here */
|
||||
char *ptr;
|
||||
char *firstptr;
|
||||
char *tok_buf;
|
||||
int fields;
|
||||
@@ -655,7 +656,7 @@ Curl_cookie_add(struct SessionHandle *data,
|
||||
*
|
||||
****************************************************************************/
|
||||
struct CookieInfo *Curl_cookie_init(struct SessionHandle *data,
|
||||
char *file,
|
||||
const char *file,
|
||||
struct CookieInfo *inc,
|
||||
bool newsession)
|
||||
{
|
||||
@@ -734,7 +735,8 @@ struct CookieInfo *Curl_cookie_init(struct SessionHandle *data,
|
||||
****************************************************************************/
|
||||
|
||||
struct Cookie *Curl_cookie_getlist(struct CookieInfo *c,
|
||||
char *host, char *path, bool secure)
|
||||
const char *host, const char *path,
|
||||
bool secure)
|
||||
{
|
||||
struct Cookie *newco;
|
||||
struct Cookie *co;
|
||||
@@ -937,7 +939,7 @@ static char *get_netscape_format(const struct Cookie *co)
|
||||
*
|
||||
* The function returns non-zero on write failure.
|
||||
*/
|
||||
int Curl_cookie_output(struct CookieInfo *c, char *dumphere)
|
||||
int Curl_cookie_output(struct CookieInfo *c, const char *dumphere)
|
||||
{
|
||||
struct Cookie *co;
|
||||
FILE *out;
|
||||
|
||||
11
lib/cookie.h
11
lib/cookie.h
@@ -84,17 +84,18 @@ struct SessionHandle;
|
||||
*/
|
||||
|
||||
struct Cookie *Curl_cookie_add(struct SessionHandle *data,
|
||||
struct CookieInfo *, bool header, char *line,
|
||||
char *domain, char *path);
|
||||
struct CookieInfo *, bool header, char *lineptr,
|
||||
const char *domain, const char *path);
|
||||
|
||||
struct CookieInfo *Curl_cookie_init(struct SessionHandle *data,
|
||||
char *, struct CookieInfo *, bool);
|
||||
struct Cookie *Curl_cookie_getlist(struct CookieInfo *, char *, char *, bool);
|
||||
const char *, struct CookieInfo *, bool);
|
||||
struct Cookie *Curl_cookie_getlist(struct CookieInfo *, const char *,
|
||||
const char *, bool);
|
||||
void Curl_cookie_freelist(struct Cookie *);
|
||||
void Curl_cookie_clearall(struct CookieInfo *cookies);
|
||||
void Curl_cookie_clearsess(struct CookieInfo *cookies);
|
||||
void Curl_cookie_cleanup(struct CookieInfo *);
|
||||
int Curl_cookie_output(struct CookieInfo *, char *);
|
||||
int Curl_cookie_output(struct CookieInfo *, const char *);
|
||||
|
||||
#if defined(CURL_DISABLE_HTTP) || defined(CURL_DISABLE_COOKIES)
|
||||
#define Curl_cookie_list(x) NULL
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef __LDAP_H
|
||||
#define __LDAP_H
|
||||
#ifndef __CURL_LDAP_H
|
||||
#define __CURL_LDAP_H
|
||||
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
@@ -8,7 +8,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2007, 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
|
||||
@@ -26,4 +26,4 @@
|
||||
#ifndef CURL_DISABLE_LDAP
|
||||
CURLcode Curl_ldap(struct connectdata *conn, bool *done);
|
||||
#endif
|
||||
#endif /* __LDAP_H */
|
||||
#endif /* __CURL_LDAP_H */
|
||||
@@ -82,13 +82,13 @@
|
||||
/* The last #include file should be: */
|
||||
#include "memdebug.h"
|
||||
|
||||
static char *unescape_word(struct SessionHandle *data, char *inp)
|
||||
static char *unescape_word(struct SessionHandle *data, const char *inp)
|
||||
{
|
||||
char *newp;
|
||||
char *dictp;
|
||||
char *ptr;
|
||||
int len;
|
||||
unsigned char byte;
|
||||
char byte;
|
||||
int olen=0;
|
||||
|
||||
newp = curl_easy_unescape(data, inp, 0, &len);
|
||||
@@ -100,7 +100,7 @@ static char *unescape_word(struct SessionHandle *data, char *inp)
|
||||
/* According to RFC2229 section 2.2, these letters need to be escaped with
|
||||
\[letter] */
|
||||
for(ptr = newp;
|
||||
(byte = (unsigned char)*ptr) != 0;
|
||||
(byte = *ptr) != 0;
|
||||
ptr++) {
|
||||
if ((byte <= 32) || (byte == 127) ||
|
||||
(byte == '\'') || (byte == '\"') || (byte == '\\')) {
|
||||
|
||||
@@ -886,7 +886,8 @@ CURLcode Curl_convert_from_utf8(struct SessionHandle *data,
|
||||
} else {
|
||||
#ifdef HAVE_ICONV
|
||||
/* do the translation ourselves */
|
||||
char *input_ptr, *output_ptr;
|
||||
const char *input_ptr;
|
||||
char *output_ptr;
|
||||
size_t in_bytes, out_bytes, rc;
|
||||
int error;
|
||||
|
||||
@@ -907,7 +908,7 @@ CURLcode Curl_convert_from_utf8(struct SessionHandle *data,
|
||||
/* call iconv */
|
||||
input_ptr = output_ptr = buffer;
|
||||
in_bytes = out_bytes = length;
|
||||
rc = iconv(data->utf8_cd, (const char**)&input_ptr, &in_bytes,
|
||||
rc = iconv(data->utf8_cd, &input_ptr, &in_bytes,
|
||||
&output_ptr, &out_bytes);
|
||||
if ((rc == ICONV_ERROR) || (in_bytes != 0)) {
|
||||
error = ERRNO;
|
||||
|
||||
@@ -59,7 +59,7 @@ char *curl_easy_escape(CURL *handle, const char *string, int inlength)
|
||||
size_t alloc = (inlength?(size_t)inlength:strlen(string))+1;
|
||||
char *ns;
|
||||
char *testing_ptr = NULL;
|
||||
unsigned char in;
|
||||
char in;
|
||||
size_t newlen = alloc;
|
||||
int strindex=0;
|
||||
size_t length;
|
||||
|
||||
17
lib/file.c
17
lib/file.c
@@ -96,7 +96,8 @@
|
||||
*/
|
||||
CURLcode Curl_file_connect(struct connectdata *conn)
|
||||
{
|
||||
char *real_path = curl_easy_unescape(conn->data, conn->data->reqdata.path, 0, NULL);
|
||||
char *real_path = curl_easy_unescape(conn->data, conn->data->reqdata.path, 0,
|
||||
NULL);
|
||||
struct FILEPROTO *file;
|
||||
int fd;
|
||||
#if defined(WIN32) || defined(MSDOS) || defined(__EMX__)
|
||||
@@ -113,9 +114,8 @@ CURLcode Curl_file_connect(struct connectdata *conn)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
if (conn->data->reqdata.proto.file) {
|
||||
if (conn->data->reqdata.proto.file)
|
||||
free(conn->data->reqdata.proto.file);
|
||||
}
|
||||
|
||||
conn->data->reqdata.proto.file = file;
|
||||
|
||||
@@ -177,6 +177,9 @@ CURLcode Curl_file_done(struct connectdata *conn,
|
||||
if(file->fd != -1)
|
||||
close(file->fd);
|
||||
|
||||
free(file);
|
||||
conn->data->reqdata.proto.file= NULL; /* clear it! */
|
||||
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
@@ -189,7 +192,7 @@ CURLcode Curl_file_done(struct connectdata *conn,
|
||||
static CURLcode file_upload(struct connectdata *conn)
|
||||
{
|
||||
struct FILEPROTO *file = conn->data->reqdata.proto.file;
|
||||
char *dir = strchr(file->path, DIRSEP);
|
||||
const char *dir = strchr(file->path, DIRSEP);
|
||||
FILE *fp;
|
||||
CURLcode res=CURLE_OK;
|
||||
struct SessionHandle *data = conn->data;
|
||||
@@ -199,7 +202,7 @@ static CURLcode file_upload(struct connectdata *conn)
|
||||
curl_off_t bytecount = 0;
|
||||
struct timeval now = Curl_tvnow();
|
||||
struct_stat file_stat;
|
||||
char* buf2;
|
||||
const char* buf2;
|
||||
|
||||
/*
|
||||
* Since FILE: doesn't do the full init, we need to provide some extra
|
||||
@@ -369,11 +372,11 @@ CURLcode Curl_file(struct connectdata *conn, bool *done)
|
||||
return result;
|
||||
|
||||
if(fstated) {
|
||||
struct tm *tm;
|
||||
const struct tm *tm;
|
||||
time_t clock = (time_t)statbuf.st_mtime;
|
||||
#ifdef HAVE_GMTIME_R
|
||||
struct tm buffer;
|
||||
tm = (struct tm *)gmtime_r(&clock, &buffer);
|
||||
tm = (const struct tm *)gmtime_r(&clock, &buffer);
|
||||
#else
|
||||
tm = gmtime(&clock);
|
||||
#endif
|
||||
|
||||
@@ -481,7 +481,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
|
||||
return_value = CURL_FORMADD_OPTION_TWICE;
|
||||
else
|
||||
current_form->namelength =
|
||||
array_state?(long)array_value:(long)va_arg(params, long);
|
||||
array_state?(size_t)array_value:(size_t)va_arg(params, long);
|
||||
break;
|
||||
|
||||
/*
|
||||
@@ -506,7 +506,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
|
||||
return_value = CURL_FORMADD_OPTION_TWICE;
|
||||
else
|
||||
current_form->contentslength =
|
||||
array_state?(long)array_value:va_arg(params, long);
|
||||
array_state?(size_t)array_value:(size_t)va_arg(params, long);
|
||||
break;
|
||||
|
||||
/* Get contents from a given file name */
|
||||
@@ -514,7 +514,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
|
||||
if (current_form->flags != 0)
|
||||
return_value = CURL_FORMADD_OPTION_TWICE;
|
||||
else {
|
||||
char *filename = array_state?
|
||||
const char *filename = array_state?
|
||||
array_value:va_arg(params, char *);
|
||||
if (filename) {
|
||||
current_form->value = strdup(filename);
|
||||
@@ -533,7 +533,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
|
||||
/* We upload a file */
|
||||
case CURLFORM_FILE:
|
||||
{
|
||||
char *filename = array_state?array_value:
|
||||
const char *filename = array_state?array_value:
|
||||
va_arg(params, char *);
|
||||
|
||||
if (current_form->value) {
|
||||
@@ -567,7 +567,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
|
||||
|
||||
case CURLFORM_BUFFER:
|
||||
{
|
||||
char *filename = array_state?array_value:
|
||||
const char *filename = array_state?array_value:
|
||||
va_arg(params, char *);
|
||||
|
||||
if (current_form->value) {
|
||||
@@ -615,12 +615,12 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
|
||||
return_value = CURL_FORMADD_OPTION_TWICE;
|
||||
else
|
||||
current_form->bufferlength =
|
||||
array_state?(long)array_value:va_arg(params, long);
|
||||
array_state?(size_t)array_value:(size_t)va_arg(params, long);
|
||||
break;
|
||||
|
||||
case CURLFORM_CONTENTTYPE:
|
||||
{
|
||||
char *contenttype =
|
||||
const char *contenttype =
|
||||
array_state?array_value:va_arg(params, char *);
|
||||
if (current_form->contenttype) {
|
||||
if (current_form->flags & HTTPPOST_FILENAME) {
|
||||
@@ -666,7 +666,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
|
||||
}
|
||||
case CURLFORM_FILENAME:
|
||||
{
|
||||
char *filename = array_state?array_value:
|
||||
const char *filename = array_state?array_value:
|
||||
va_arg(params, char *);
|
||||
if( current_form->showfilename )
|
||||
return_value = CURL_FORMADD_OPTION_TWICE;
|
||||
@@ -1055,7 +1055,7 @@ static char *basename(char *path)
|
||||
}
|
||||
#endif
|
||||
|
||||
static char *strippath(char *fullfile)
|
||||
static char *strippath(const char *fullfile)
|
||||
{
|
||||
char *filename;
|
||||
char *base;
|
||||
|
||||
384
lib/ftp.c
384
lib/ftp.c
@@ -140,6 +140,19 @@ static int ftp_need_type(struct connectdata *conn,
|
||||
#define NBFTPSENDF(x,y,z) if ((result = Curl_nbftpsendf(x,y,z)) != CURLE_OK) \
|
||||
return result
|
||||
|
||||
|
||||
/*
|
||||
* NOTE: back in the old days, we added code in the FTP code that made NOBODY
|
||||
* requests on files respond with headers passed to the client/stdout that
|
||||
* looked like HTTP ones.
|
||||
*
|
||||
* This approach is not very elegant, it causes confusion and is error-prone.
|
||||
* It is subject for removal at the next (or at least a future) soname bump.
|
||||
* Until then you can test the effects of the removal by undefining the
|
||||
* following define named CURL_FTP_HTTPSTYLE_HEAD.
|
||||
*/
|
||||
#define CURL_FTP_HTTPSTYLE_HEAD 1
|
||||
|
||||
static void freedirs(struct connectdata *conn)
|
||||
{
|
||||
struct ftp_conn *ftpc = &conn->proto.ftpc;
|
||||
@@ -274,9 +287,13 @@ static void ftp_respinit(struct connectdata *conn)
|
||||
ftpc->linestart_resp = conn->data->state.buffer;
|
||||
}
|
||||
|
||||
/* macro to check for a three-digit ftp status code at the start of the
|
||||
given string */
|
||||
#define STATUSCODE(line) (ISDIGIT(line[0]) && ISDIGIT(line[1]) && \
|
||||
ISDIGIT(line[2]))
|
||||
|
||||
/* macro to check for the last line in an FTP server response */
|
||||
#define lastline(line) (ISDIGIT(line[0]) && ISDIGIT(line[1]) && \
|
||||
ISDIGIT(line[2]) && (' ' == line[3]))
|
||||
#define LASTLINE(line) (STATUSCODE(line) && (' ' == line[3]))
|
||||
|
||||
static CURLcode ftp_readresp(curl_socket_t sockfd,
|
||||
struct connectdata *conn,
|
||||
@@ -326,7 +343,7 @@ static CURLcode ftp_readresp(curl_socket_t sockfd,
|
||||
conn->data_prot = 0;
|
||||
#endif
|
||||
res = Curl_read(conn, sockfd, ptr, BUFSIZE-ftpc->nread_resp,
|
||||
&gotbytes);
|
||||
&gotbytes);
|
||||
#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)
|
||||
conn->data_prot = prot;
|
||||
#endif
|
||||
@@ -357,7 +374,9 @@ static CURLcode ftp_readresp(curl_socket_t sockfd,
|
||||
/* we got a whole chunk of data, which can be anything from one
|
||||
* byte to a set of lines and possible just a piece of the last
|
||||
* line */
|
||||
int i;
|
||||
ssize_t i;
|
||||
int clipamount = 0;
|
||||
bool restart = FALSE;
|
||||
|
||||
data->reqdata.keep.headerbytecount += gotbytes;
|
||||
|
||||
@@ -370,7 +389,7 @@ static CURLcode ftp_readresp(curl_socket_t sockfd,
|
||||
|
||||
/* output debug output if that is requested */
|
||||
#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)
|
||||
if(!conn->sec_complete)
|
||||
if(!conn->sec_complete)
|
||||
#endif
|
||||
if(data->set.verbose)
|
||||
Curl_debug(data, CURLINFO_HEADER_IN,
|
||||
@@ -386,7 +405,7 @@ static CURLcode ftp_readresp(curl_socket_t sockfd,
|
||||
if(result)
|
||||
return result;
|
||||
|
||||
if(perline>3 && lastline(ftpc->linestart_resp)) {
|
||||
if(perline>3 && LASTLINE(ftpc->linestart_resp)) {
|
||||
/* This is the end of the last line, copy the last line to the
|
||||
start of the buffer and zero terminate, for old times sake (and
|
||||
krb4)! */
|
||||
@@ -407,18 +426,56 @@ static CURLcode ftp_readresp(curl_socket_t sockfd,
|
||||
ftpc->linestart_resp = ptr+1;
|
||||
}
|
||||
}
|
||||
|
||||
if(!keepon && (i != gotbytes)) {
|
||||
/* We found the end of the response lines, but we didn't parse the
|
||||
full chunk of data we have read from the server. We therefore need
|
||||
to store the rest of the data to be checked on the next invoke as
|
||||
it may actually contain another end of response already! */
|
||||
ftpc->cache_size = gotbytes - i;
|
||||
clipamount = gotbytes - i;
|
||||
restart = TRUE;
|
||||
}
|
||||
else if(keepon) {
|
||||
|
||||
if((perline == gotbytes) && (gotbytes > BUFSIZE/2)) {
|
||||
/* We got an excessive line without newlines and we need to deal
|
||||
with it. First, check if it seems to start with a valid status
|
||||
code and then we keep just that in the line cache. Then throw
|
||||
away the rest. */
|
||||
infof(data, "Excessive FTP response line length received, %zd bytes."
|
||||
" Stripping\n", gotbytes);
|
||||
restart = TRUE;
|
||||
if(STATUSCODE(ftpc->linestart_resp))
|
||||
/* we copy 4 bytes since after the three-digit number there is a
|
||||
dash or a space and it is significant */
|
||||
clipamount = 4;
|
||||
}
|
||||
else if(perline && (ftpc->nread_resp > BUFSIZE/2)) {
|
||||
/* We got a large chunk of data and there's still trailing data to
|
||||
take care of, so we put that part in the "cache" and restart */
|
||||
clipamount = perline;
|
||||
restart = TRUE;
|
||||
}
|
||||
}
|
||||
else if(i == gotbytes)
|
||||
restart = TRUE;
|
||||
|
||||
if(clipamount) {
|
||||
ftpc->cache_size = clipamount;
|
||||
ftpc->cache = (char *)malloc((int)ftpc->cache_size);
|
||||
if(ftpc->cache)
|
||||
memcpy(ftpc->cache, ftpc->linestart_resp, (int)ftpc->cache_size);
|
||||
else
|
||||
return CURLE_OUT_OF_MEMORY; /**BANG**/
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
}
|
||||
if(restart) {
|
||||
/* now reset a few variables to start over nicely from the start of
|
||||
the big buffer */
|
||||
ftpc->nread_resp = 0; /* start over from scratch in the buffer */
|
||||
ptr = ftpc->linestart_resp = buf;
|
||||
perline = 0;
|
||||
}
|
||||
|
||||
} /* there was data */
|
||||
|
||||
} /* while there's buffer left and loop is requested */
|
||||
@@ -456,9 +513,9 @@ static CURLcode ftp_readresp(curl_socket_t sockfd,
|
||||
/* --- parse FTP server responses --- */
|
||||
|
||||
/*
|
||||
* Curl_GetFTPResponse() is supposed to be invoked after each command sent to
|
||||
* a remote FTP server. This function will wait and read all lines of the
|
||||
* response and extract the relevant return code for the invoking function.
|
||||
* Curl_GetFTPResponse() is a BLOCKING function to read the full response
|
||||
* from a server after a command.
|
||||
*
|
||||
*/
|
||||
|
||||
CURLcode Curl_GetFTPResponse(ssize_t *nreadp, /* return number of bytes read */
|
||||
@@ -473,31 +530,21 @@ CURLcode Curl_GetFTPResponse(ssize_t *nreadp, /* return number of bytes read */
|
||||
* line in a response or continue reading. */
|
||||
|
||||
curl_socket_t sockfd = conn->sock[FIRSTSOCKET];
|
||||
int perline; /* count bytes per line */
|
||||
bool keepon=TRUE;
|
||||
ssize_t gotbytes;
|
||||
char *ptr;
|
||||
long timeout; /* timeout in milliseconds */
|
||||
long interval_ms;
|
||||
struct SessionHandle *data = conn->data;
|
||||
char *line_start;
|
||||
int code=0; /* default ftp "error code" to return */
|
||||
char *buf = data->state.buffer;
|
||||
CURLcode result = CURLE_OK;
|
||||
struct ftp_conn *ftpc = &conn->proto.ftpc;
|
||||
struct timeval now = Curl_tvnow();
|
||||
size_t nread;
|
||||
int cache_skip=0;
|
||||
|
||||
if (ftpcode)
|
||||
*ftpcode = 0; /* 0 for errors */
|
||||
|
||||
ptr=buf;
|
||||
line_start = buf;
|
||||
|
||||
*nreadp=0;
|
||||
perline=0;
|
||||
keepon=TRUE;
|
||||
|
||||
while((*nreadp<BUFSIZE) && (keepon && !result)) {
|
||||
while(!*ftpcode && !result) {
|
||||
/* check and reset timeout value every lap */
|
||||
if(data->set.ftp_response_timeout )
|
||||
/* if CURLOPT_FTP_RESPONSE_TIMEOUT is set, use that to determine
|
||||
@@ -522,180 +569,65 @@ CURLcode Curl_GetFTPResponse(ssize_t *nreadp, /* return number of bytes read */
|
||||
return CURLE_OPERATION_TIMEDOUT; /* already too little time */
|
||||
}
|
||||
|
||||
if(!ftpc->cache) {
|
||||
interval_ms = 1 * 1000; /* use 1 second timeout intervals */
|
||||
if(timeout < interval_ms)
|
||||
interval_ms = timeout;
|
||||
interval_ms = 1 * 1000; /* use 1 second timeout intervals */
|
||||
if(timeout < interval_ms)
|
||||
interval_ms = timeout;
|
||||
|
||||
/*
|
||||
* Since this function is blocking, we need to wait here for input on the
|
||||
* connection and only then we call the response reading function. We do
|
||||
* timeout at least every second to make the timeout check run.
|
||||
*
|
||||
* A caution here is that the ftp_readresp() function has a cache that may
|
||||
* contain pieces of a response from the previous invoke and we need to
|
||||
* make sure we don't just wait for input while there is unhandled data in
|
||||
* that cache. But also, if the cache is there, we call ftp_readresp() and
|
||||
* the cache wasn't good enough to continue we must not just busy-loop
|
||||
* around this function.
|
||||
*
|
||||
*/
|
||||
|
||||
if(ftpc->cache && (cache_skip < 2)) {
|
||||
/*
|
||||
* There's a cache left since before. We then skipping the wait for
|
||||
* socket action, unless this is the same cache like the previous round
|
||||
* as then the cache was deemed not enough to act on and we then need to
|
||||
* wait for more data anyway.
|
||||
*/
|
||||
}
|
||||
else {
|
||||
switch (Curl_socket_ready(sockfd, CURL_SOCKET_BAD, (int)interval_ms)) {
|
||||
case -1: /* select() error, stop reading */
|
||||
result = CURLE_RECV_ERROR;
|
||||
failf(data, "FTP response aborted due to select/poll error: %d",
|
||||
SOCKERRNO);
|
||||
break;
|
||||
return CURLE_RECV_ERROR;
|
||||
|
||||
case 0: /* timeout */
|
||||
if(Curl_pgrsUpdate(conn))
|
||||
return CURLE_ABORTED_BY_CALLBACK;
|
||||
continue; /* just continue in our loop for the timeout duration */
|
||||
|
||||
default:
|
||||
default: /* for clarity */
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(CURLE_OK == result) {
|
||||
/*
|
||||
* This code previously didn't use the kerberos sec_read() code
|
||||
* to read, but when we use Curl_read() it may do so. Do confirm
|
||||
* that this is still ok and then remove this comment!
|
||||
*/
|
||||
if(ftpc->cache) {
|
||||
/* we had data in the "cache", copy that instead of doing an actual
|
||||
* read
|
||||
*
|
||||
* Dave Meyer, December 2003:
|
||||
* ftp->cache_size is cast to int here. This should be safe,
|
||||
* because it would have been populated with something of size
|
||||
* int to begin with, even though its datatype may be larger
|
||||
* than an int.
|
||||
*/
|
||||
memcpy(ptr, ftpc->cache, (int)ftpc->cache_size);
|
||||
gotbytes = (int)ftpc->cache_size;
|
||||
free(ftpc->cache); /* free the cache */
|
||||
ftpc->cache = NULL; /* clear the pointer */
|
||||
ftpc->cache_size = 0; /* zero the size just in case */
|
||||
}
|
||||
else {
|
||||
int res;
|
||||
#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)
|
||||
enum protection_level prot = conn->data_prot;
|
||||
result = ftp_readresp(sockfd, conn, ftpcode, &nread);
|
||||
if(result)
|
||||
break;
|
||||
|
||||
conn->data_prot = 0;
|
||||
#endif
|
||||
res = Curl_read(conn, sockfd, ptr, BUFSIZE-*nreadp,
|
||||
&gotbytes);
|
||||
#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)
|
||||
conn->data_prot = prot;
|
||||
#endif
|
||||
if(res < 0)
|
||||
/* EWOULDBLOCK */
|
||||
continue; /* go looping again */
|
||||
if(!nread && ftpc->cache)
|
||||
/* bump cache skip counter as on repeated skips we must wait for more
|
||||
data */
|
||||
cache_skip++;
|
||||
else
|
||||
/* when we got data or there is no cache left, we reset the cache skip
|
||||
counter */
|
||||
cache_skip=0;
|
||||
|
||||
#ifdef CURL_DOES_CONVERSIONS
|
||||
if((res == CURLE_OK) && (gotbytes > 0)) {
|
||||
/* convert from the network encoding */
|
||||
result = res = Curl_convert_from_network(data, ptr, gotbytes);
|
||||
/* Curl_convert_from_network calls failf if unsuccessful */
|
||||
}
|
||||
#endif /* CURL_DOES_CONVERSIONS */
|
||||
*nreadp += nread;
|
||||
|
||||
if(CURLE_OK != res)
|
||||
keepon = FALSE;
|
||||
}
|
||||
|
||||
if(!keepon)
|
||||
;
|
||||
else if(gotbytes <= 0) {
|
||||
keepon = FALSE;
|
||||
result = CURLE_RECV_ERROR;
|
||||
failf(data, "FTP response reading failed");
|
||||
}
|
||||
else {
|
||||
/* we got a whole chunk of data, which can be anything from one
|
||||
* byte to a set of lines and possible just a piece of the last
|
||||
* line */
|
||||
int i;
|
||||
|
||||
data->reqdata.keep.headerbytecount += gotbytes;
|
||||
|
||||
*nreadp += gotbytes;
|
||||
for(i = 0; i < gotbytes; ptr++, i++) {
|
||||
perline++;
|
||||
if(*ptr=='\n') {
|
||||
/* a newline is CRLF in ftp-talk, so the CR is ignored as
|
||||
the line isn't really terminated until the LF comes */
|
||||
|
||||
/* output debug output if that is requested */
|
||||
#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)
|
||||
if(!conn->sec_complete)
|
||||
#endif
|
||||
if(data->set.verbose)
|
||||
Curl_debug(data, CURLINFO_HEADER_IN,
|
||||
line_start, (size_t)perline, conn);
|
||||
|
||||
/*
|
||||
* We pass all response-lines to the callback function registered
|
||||
* for "headers". The response lines can be seen as a kind of
|
||||
* headers.
|
||||
*/
|
||||
result = Curl_client_write(conn, CLIENTWRITE_HEADER,
|
||||
line_start, perline);
|
||||
if(result)
|
||||
return result;
|
||||
|
||||
if(perline>3 && lastline(line_start)) {
|
||||
/* This is the end of the last line, copy the last
|
||||
* line to the start of the buffer and zero terminate,
|
||||
* for old times sake (and krb4)! */
|
||||
char *meow;
|
||||
int n;
|
||||
for(meow=line_start, n=0; meow<ptr; meow++, n++)
|
||||
buf[n] = *meow;
|
||||
*meow=0; /* zero terminate */
|
||||
keepon=FALSE;
|
||||
line_start = ptr+1; /* advance pointer */
|
||||
i++; /* skip this before getting out */
|
||||
break;
|
||||
}
|
||||
perline=0; /* line starts over here */
|
||||
line_start = ptr+1;
|
||||
}
|
||||
}
|
||||
if(!keepon && (i != gotbytes)) {
|
||||
/* We found the end of the response lines, but we didn't parse the
|
||||
full chunk of data we have read from the server. We therefore
|
||||
need to store the rest of the data to be checked on the next
|
||||
invoke as it may actually contain another end of response
|
||||
already! Cleverly figured out by Eric Lavigne in December
|
||||
2001. */
|
||||
ftpc->cache_size = gotbytes - i;
|
||||
ftpc->cache = (char *)malloc((int)ftpc->cache_size);
|
||||
if(ftpc->cache)
|
||||
memcpy(ftpc->cache, line_start, (int)ftpc->cache_size);
|
||||
else
|
||||
return CURLE_OUT_OF_MEMORY; /**BANG**/
|
||||
}
|
||||
} /* there was data */
|
||||
} /* if(no error) */
|
||||
} /* while there's buffer left and loop is requested */
|
||||
|
||||
if(!result)
|
||||
code = atoi(buf);
|
||||
|
||||
#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)
|
||||
/* handle the security-oriented responses 6xx ***/
|
||||
/* FIXME: some errorchecking perhaps... ***/
|
||||
switch(code) {
|
||||
case 631:
|
||||
code = Curl_sec_read_msg(conn, buf, prot_safe);
|
||||
break;
|
||||
case 632:
|
||||
code = Curl_sec_read_msg(conn, buf, prot_private);
|
||||
break;
|
||||
case 633:
|
||||
code = Curl_sec_read_msg(conn, buf, prot_confidential);
|
||||
break;
|
||||
default:
|
||||
/* normal ftp stuff we pass through! */
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
if(ftpcode)
|
||||
*ftpcode=code; /* return the initial number like this */
|
||||
|
||||
/* store the latest code for later retrieval */
|
||||
conn->data->info.httpcode=code;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1303,8 +1235,8 @@ static CURLcode ftp_state_post_size(struct connectdata *conn)
|
||||
CURLcode result = CURLE_OK;
|
||||
struct FTP *ftp = conn->data->reqdata.proto.ftp;
|
||||
|
||||
if(ftp->no_transfer) {
|
||||
/* if a "head"-like request is being made */
|
||||
if(ftp->no_transfer && ftp->file) {
|
||||
/* if a "head"-like request is being made (on a file) */
|
||||
|
||||
/* Determine if server can respond to REST command and therefore
|
||||
whether it supports range */
|
||||
@@ -1323,8 +1255,8 @@ static CURLcode ftp_state_post_type(struct connectdata *conn)
|
||||
CURLcode result = CURLE_OK;
|
||||
struct FTP *ftp = conn->data->reqdata.proto.ftp;
|
||||
|
||||
if(ftp->no_transfer) {
|
||||
/* if a "head"-like request is being made */
|
||||
if(ftp->no_transfer && ftp->file) {
|
||||
/* if a "head"-like request is being made (on a file) */
|
||||
|
||||
/* we know ftp->file is a valid pointer to a file name */
|
||||
NBFTPSENDF(conn, "SIZE %s", ftp->file);
|
||||
@@ -1898,6 +1830,7 @@ static CURLcode ftp_state_mdtm_resp(struct connectdata *conn,
|
||||
data->info.filetime = (long)curl_getdate(buf, &secs);
|
||||
}
|
||||
|
||||
#ifdef CURL_FTP_HTTPSTYLE_HEAD
|
||||
/* If we asked for a time of the file and we actually got one as well,
|
||||
we "emulate" a HTTP-style header in our output. */
|
||||
|
||||
@@ -1928,6 +1861,7 @@ static CURLcode ftp_state_mdtm_resp(struct connectdata *conn,
|
||||
if(result)
|
||||
return result;
|
||||
} /* end of a ridiculous amount of conditionals */
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -1984,7 +1918,7 @@ static CURLcode ftp_state_type_resp(struct connectdata *conn,
|
||||
successful 'TYPE I'. While that is not as RFC959 says, it is still a
|
||||
positive response code and we allow that. */
|
||||
failf(data, "Couldn't set desired mode");
|
||||
return CURLE_FTP_COULDNT_SET_BINARY; /* FIX */
|
||||
return CURLE_FTP_COULDNT_SET_TYPE;
|
||||
}
|
||||
if(ftpcode != 200)
|
||||
infof(data, "Got a %03d response code instead of the assumed 200\n",
|
||||
@@ -2096,6 +2030,7 @@ static CURLcode ftp_state_size_resp(struct connectdata *conn,
|
||||
filesize = (ftpcode == 213)?curlx_strtoofft(buf+4, NULL, 0):-1;
|
||||
|
||||
if(instate == FTP_SIZE) {
|
||||
#ifdef CURL_FTP_HTTPSTYLE_HEAD
|
||||
if(-1 != filesize) {
|
||||
snprintf(buf, sizeof(data->state.buffer),
|
||||
"Content-Length: %" FORMAT_OFF_T "\r\n", filesize);
|
||||
@@ -2103,10 +2038,14 @@ static CURLcode ftp_state_size_resp(struct connectdata *conn,
|
||||
if(result)
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
Curl_pgrsSetDownloadSize(data, filesize);
|
||||
result = ftp_state_post_size(conn);
|
||||
}
|
||||
else if(instate == FTP_RETR_SIZE)
|
||||
else if(instate == FTP_RETR_SIZE) {
|
||||
Curl_pgrsSetDownloadSize(data, filesize);
|
||||
result = ftp_state_post_retr_size(conn, filesize);
|
||||
}
|
||||
else if(instate == FTP_STOR_SIZE) {
|
||||
data->reqdata.resume_from = filesize;
|
||||
result = ftp_state_ul_setup(conn, TRUE);
|
||||
@@ -2125,13 +2064,14 @@ static CURLcode ftp_state_rest_resp(struct connectdata *conn,
|
||||
switch(instate) {
|
||||
case FTP_REST:
|
||||
default:
|
||||
#ifdef CURL_FTP_HTTPSTYLE_HEAD
|
||||
if (ftpcode == 350) {
|
||||
result = Curl_client_write(conn, CLIENTWRITE_BOTH,
|
||||
(char *)"Accept-ranges: bytes\r\n", 0);
|
||||
char buffer[24]= { "Accept-ranges: bytes\r\n" };
|
||||
result = Curl_client_write(conn, CLIENTWRITE_BOTH, buffer, 0);
|
||||
if(result)
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif
|
||||
result = ftp_state_post_rest(conn);
|
||||
break;
|
||||
|
||||
@@ -2492,7 +2432,7 @@ static CURLcode ftp_statemach_act(struct connectdata *conn)
|
||||
Curl_sec_request_prot(conn, "private");
|
||||
/* We set private first as default, in case the line below fails to
|
||||
set a valid level */
|
||||
Curl_sec_request_prot(conn, data->set.str[STRING_KRB_LEVEL]);
|
||||
Curl_sec_request_prot(conn, data->set.str[STRING_KRB_LEVEL]);
|
||||
|
||||
if(Curl_sec_login(conn) != 0)
|
||||
infof(data, "Logging in with password in cleartext!\n");
|
||||
@@ -2558,9 +2498,9 @@ static CURLcode ftp_statemach_act(struct connectdata *conn)
|
||||
/* remain in this same state */
|
||||
}
|
||||
else {
|
||||
if(data->set.ftp_ssl > CURLFTPSSL_TRY)
|
||||
/* we failed and CURLFTPSSL_CONTROL or CURLFTPSSL_ALL is set */
|
||||
result = CURLE_FTP_SSL_FAILED;
|
||||
if(data->set.ftp_ssl > CURLUSESSL_TRY)
|
||||
/* we failed and CURLUSESSL_CONTROL or CURLUSESSL_ALL is set */
|
||||
result = CURLE_USE_SSL_FAILED;
|
||||
else
|
||||
/* ignore the failure and continue */
|
||||
result = ftp_state_user(conn);
|
||||
@@ -2590,7 +2530,7 @@ static CURLcode ftp_statemach_act(struct connectdata *conn)
|
||||
*/
|
||||
if(!conn->ssl[SECONDARYSOCKET].use) {
|
||||
NBFTPSENDF(conn, "PROT %c",
|
||||
data->set.ftp_ssl == CURLFTPSSL_CONTROL ? 'C' : 'P');
|
||||
data->set.ftp_ssl == CURLUSESSL_CONTROL ? 'C' : 'P');
|
||||
state(conn, FTP_PROT);
|
||||
}
|
||||
else {
|
||||
@@ -2605,12 +2545,12 @@ static CURLcode ftp_statemach_act(struct connectdata *conn)
|
||||
if(ftpcode/100 == 2)
|
||||
/* We have enabled SSL for the data connection! */
|
||||
conn->ssl[SECONDARYSOCKET].use =
|
||||
(bool)(data->set.ftp_ssl != CURLFTPSSL_CONTROL);
|
||||
(bool)(data->set.ftp_ssl != CURLUSESSL_CONTROL);
|
||||
/* FTP servers typically responds with 500 if they decide to reject
|
||||
our 'P' request */
|
||||
else if(data->set.ftp_ssl> CURLFTPSSL_CONTROL)
|
||||
else if(data->set.ftp_ssl > CURLUSESSL_CONTROL)
|
||||
/* we failed and bails out */
|
||||
return CURLE_FTP_SSL_FAILED;
|
||||
return CURLE_USE_SSL_FAILED;
|
||||
|
||||
if(data->set.ftp_ccc) {
|
||||
/* CCC - Clear Command Channel
|
||||
@@ -2627,13 +2567,13 @@ static CURLcode ftp_statemach_act(struct connectdata *conn)
|
||||
|
||||
case FTP_CCC:
|
||||
if (ftpcode < 500) {
|
||||
/* First shut down the SSL layer (note: this call will block) */
|
||||
result = Curl_ssl_shutdown(conn, FIRSTSOCKET);
|
||||
/* First shut down the SSL layer (note: this call will block) */
|
||||
result = Curl_ssl_shutdown(conn, FIRSTSOCKET);
|
||||
|
||||
if(result) {
|
||||
failf(conn->data, "Failed to clear the command channel (CCC)");
|
||||
return result;
|
||||
}
|
||||
if(result) {
|
||||
failf(conn->data, "Failed to clear the command channel (CCC)");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/* Then continue as normal */
|
||||
@@ -2701,7 +2641,7 @@ static CURLcode ftp_statemach_act(struct connectdata *conn)
|
||||
case FTP_STOR_PREQUOTE:
|
||||
if(ftpcode >= 400) {
|
||||
failf(conn->data, "QUOT command failed with %03d", ftpcode);
|
||||
return CURLE_FTP_QUOTE_ERROR;
|
||||
return CURLE_QUOTE_ERROR;
|
||||
}
|
||||
result = ftp_state_quote(conn, FALSE, ftpc->state);
|
||||
if(result)
|
||||
@@ -2724,7 +2664,7 @@ static CURLcode ftp_statemach_act(struct connectdata *conn)
|
||||
failf(data, "Server denied you to change to the given directory");
|
||||
ftpc->cwdfail = TRUE; /* don't remember this path as we failed
|
||||
to enter it */
|
||||
return CURLE_FTP_ACCESS_DENIED;
|
||||
return CURLE_REMOTE_ACCESS_DENIED;
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -2746,7 +2686,7 @@ static CURLcode ftp_statemach_act(struct connectdata *conn)
|
||||
if(ftpcode/100 != 2) {
|
||||
/* failure to MKD the dir */
|
||||
failf(data, "Failed to MKD dir: %03d", ftpcode);
|
||||
return CURLE_FTP_ACCESS_DENIED;
|
||||
return CURLE_REMOTE_ACCESS_DENIED;
|
||||
}
|
||||
state(conn, FTP_CWD);
|
||||
/* send CWD */
|
||||
@@ -3032,7 +2972,8 @@ CURLcode Curl_ftp_connect(struct connectdata *conn,
|
||||
*
|
||||
* Input argument is already checked for validity.
|
||||
*/
|
||||
CURLcode Curl_ftp_done(struct connectdata *conn, CURLcode status, bool premature)
|
||||
CURLcode Curl_ftp_done(struct connectdata *conn, CURLcode status,
|
||||
bool premature)
|
||||
{
|
||||
struct SessionHandle *data = conn->data;
|
||||
struct FTP *ftp = data->reqdata.proto.ftp;
|
||||
@@ -3057,10 +2998,10 @@ CURLcode Curl_ftp_done(struct connectdata *conn, CURLcode status, bool premature
|
||||
case CURLE_BAD_DOWNLOAD_RESUME:
|
||||
case CURLE_FTP_WEIRD_PASV_REPLY:
|
||||
case CURLE_FTP_PORT_FAILED:
|
||||
case CURLE_FTP_COULDNT_SET_BINARY:
|
||||
case CURLE_FTP_COULDNT_SET_TYPE:
|
||||
case CURLE_FTP_COULDNT_RETR_FILE:
|
||||
case CURLE_UPLOAD_FAILED:
|
||||
case CURLE_FTP_ACCESS_DENIED:
|
||||
case CURLE_REMOTE_ACCESS_DENIED:
|
||||
case CURLE_FILESIZE_EXCEEDED:
|
||||
/* the connection stays alive fine even though this happened */
|
||||
/* fall-through */
|
||||
@@ -3094,12 +3035,19 @@ CURLcode Curl_ftp_done(struct connectdata *conn, CURLcode status, bool premature
|
||||
} else {
|
||||
size_t flen = ftp->file?strlen(ftp->file):0; /* file is "raw" already */
|
||||
size_t dlen = strlen(path)-flen;
|
||||
if(dlen && !ftpc->cwdfail) {
|
||||
ftpc->prevpath = path;
|
||||
if(flen)
|
||||
/* if 'path' is not the whole string */
|
||||
ftpc->prevpath[dlen]=0; /* terminate */
|
||||
infof(data, "Remembering we are in dir %s\n", ftpc->prevpath);
|
||||
if(!ftpc->cwdfail) {
|
||||
if(dlen) {
|
||||
ftpc->prevpath = path;
|
||||
if(flen)
|
||||
/* if 'path' is not the whole string */
|
||||
ftpc->prevpath[dlen]=0; /* terminate */
|
||||
}
|
||||
else {
|
||||
/* we never changed dir */
|
||||
ftpc->prevpath=strdup("");
|
||||
free(path);
|
||||
}
|
||||
infof(data, "Remembering we are in dir \"%s\"\n", ftpc->prevpath);
|
||||
}
|
||||
else {
|
||||
ftpc->prevpath = NULL; /* no path */
|
||||
@@ -3239,7 +3187,7 @@ CURLcode ftp_sendquote(struct connectdata *conn, struct curl_slist *quote)
|
||||
|
||||
if (ftpcode >= 400) {
|
||||
failf(conn->data, "QUOT string not accepted: %s", item->data);
|
||||
return CURLE_FTP_QUOTE_ERROR;
|
||||
return CURLE_QUOTE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3274,7 +3222,7 @@ static CURLcode ftp_nb_type(struct connectdata *conn,
|
||||
{
|
||||
struct ftp_conn *ftpc = &conn->proto.ftpc;
|
||||
CURLcode result;
|
||||
int want = ascii?'A':'I';
|
||||
char want = ascii?'A':'I';
|
||||
|
||||
if (ftpc->transfertype == want) {
|
||||
state(conn, newstate);
|
||||
@@ -3285,7 +3233,7 @@ static CURLcode ftp_nb_type(struct connectdata *conn,
|
||||
state(conn, newstate);
|
||||
|
||||
/* keep track of our current transfer type */
|
||||
ftpc->transfertype = (char)want;
|
||||
ftpc->transfertype = want;
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -175,7 +175,7 @@ static CURLcode handshake(struct connectdata *conn,
|
||||
if(timeout_ms < 0) {
|
||||
/* a precaution, no need to continue if time already is up */
|
||||
failf(data, "SSL connection timeout");
|
||||
return CURLE_OPERATION_TIMEOUTED;
|
||||
return CURLE_OPERATION_TIMEDOUT;
|
||||
}
|
||||
|
||||
rc = Curl_socket_ready(conn->sock[sockindex],
|
||||
@@ -691,7 +691,7 @@ void Curl_gtls_session_free(void *ptr)
|
||||
|
||||
size_t Curl_gtls_version(char *buffer, size_t size)
|
||||
{
|
||||
return snprintf(buffer, size, " GnuTLS/%s", gnutls_check_version(NULL));
|
||||
return snprintf(buffer, size, "GnuTLS/%s", gnutls_check_version(NULL));
|
||||
}
|
||||
|
||||
#endif /* USE_GNUTLS */
|
||||
|
||||
@@ -111,7 +111,7 @@ Curl_hash_alloc(int slots,
|
||||
|
||||
|
||||
static struct curl_hash_element *
|
||||
mk_hash_element(void *key, size_t key_len, const void *p)
|
||||
mk_hash_element(const void *key, size_t key_len, const void *p)
|
||||
{
|
||||
struct curl_hash_element *he =
|
||||
(struct curl_hash_element *) malloc(sizeof(struct curl_hash_element));
|
||||
@@ -275,8 +275,8 @@ Curl_hash_destroy(struct curl_hash *h)
|
||||
|
||||
size_t Curl_hash_str(void* key, size_t key_length, size_t slots_num)
|
||||
{
|
||||
char* key_str = (char *) key;
|
||||
char *end = (char *) key_str + key_length;
|
||||
const char* key_str = (const char *) key;
|
||||
const char *end = key_str + key_length;
|
||||
unsigned long h = 5381;
|
||||
|
||||
while (key_str < end) {
|
||||
|
||||
@@ -200,7 +200,7 @@ create_hostcache_id(const char *server, int port)
|
||||
}
|
||||
|
||||
struct hostcache_prune_data {
|
||||
int cache_timeout;
|
||||
long cache_timeout;
|
||||
time_t now;
|
||||
};
|
||||
|
||||
@@ -232,7 +232,7 @@ hostcache_timestamp_remove(void *datap, void *hc)
|
||||
* Prune the DNS cache. This assumes that a lock has already been taken.
|
||||
*/
|
||||
static void
|
||||
hostcache_prune(struct curl_hash *hostcache, int cache_timeout, time_t now)
|
||||
hostcache_prune(struct curl_hash *hostcache, long cache_timeout, time_t now)
|
||||
{
|
||||
struct hostcache_prune_data user;
|
||||
|
||||
|
||||
60
lib/http.c
60
lib/http.c
@@ -384,14 +384,14 @@ CURLcode Curl_http_auth_act(struct connectdata *conn)
|
||||
*/
|
||||
static CURLcode
|
||||
Curl_http_output_auth(struct connectdata *conn,
|
||||
char *request,
|
||||
char *path,
|
||||
const char *request,
|
||||
const char *path,
|
||||
bool proxytunnel) /* TRUE if this is the request setting
|
||||
up the proxy tunnel */
|
||||
{
|
||||
CURLcode result = CURLE_OK;
|
||||
struct SessionHandle *data = conn->data;
|
||||
char *auth=NULL;
|
||||
const char *auth=NULL;
|
||||
struct auth *authhost;
|
||||
struct auth *authproxy;
|
||||
|
||||
@@ -426,7 +426,7 @@ Curl_http_output_auth(struct connectdata *conn,
|
||||
(conn->bits.tunnel_proxy == proxytunnel)) {
|
||||
#ifdef USE_NTLM
|
||||
if(authproxy->picked == CURLAUTH_NTLM) {
|
||||
auth=(char *)"NTLM";
|
||||
auth="NTLM";
|
||||
result = Curl_output_ntlm(conn, TRUE);
|
||||
if(result)
|
||||
return result;
|
||||
@@ -437,7 +437,7 @@ Curl_http_output_auth(struct connectdata *conn,
|
||||
/* Basic */
|
||||
if(conn->bits.proxy_user_passwd &&
|
||||
!checkheaders(data, "Proxy-authorization:")) {
|
||||
auth=(char *)"Basic";
|
||||
auth="Basic";
|
||||
result = Curl_output_basic(conn, TRUE);
|
||||
if(result)
|
||||
return result;
|
||||
@@ -448,11 +448,11 @@ Curl_http_output_auth(struct connectdata *conn,
|
||||
}
|
||||
#ifndef CURL_DISABLE_CRYPTO_AUTH
|
||||
else if(authproxy->picked == CURLAUTH_DIGEST) {
|
||||
auth=(char *)"Digest";
|
||||
auth="Digest";
|
||||
result = Curl_output_digest(conn,
|
||||
TRUE, /* proxy */
|
||||
(unsigned char *)request,
|
||||
(unsigned char *)path);
|
||||
(const unsigned char *)request,
|
||||
(const unsigned char *)path);
|
||||
if(result)
|
||||
return result;
|
||||
}
|
||||
@@ -485,7 +485,7 @@ Curl_http_output_auth(struct connectdata *conn,
|
||||
if((authhost->picked == CURLAUTH_GSSNEGOTIATE) &&
|
||||
data->state.negotiate.context &&
|
||||
!GSS_ERROR(data->state.negotiate.status)) {
|
||||
auth=(char *)"GSS-Negotiate";
|
||||
auth="GSS-Negotiate";
|
||||
result = Curl_output_negotiate(conn);
|
||||
if (result)
|
||||
return result;
|
||||
@@ -495,7 +495,7 @@ Curl_http_output_auth(struct connectdata *conn,
|
||||
#endif
|
||||
#ifdef USE_NTLM
|
||||
if(authhost->picked == CURLAUTH_NTLM) {
|
||||
auth=(char *)"NTLM";
|
||||
auth="NTLM";
|
||||
result = Curl_output_ntlm(conn, FALSE);
|
||||
if(result)
|
||||
return result;
|
||||
@@ -505,11 +505,11 @@ Curl_http_output_auth(struct connectdata *conn,
|
||||
{
|
||||
#ifndef CURL_DISABLE_CRYPTO_AUTH
|
||||
if(authhost->picked == CURLAUTH_DIGEST) {
|
||||
auth=(char *)"Digest";
|
||||
auth="Digest";
|
||||
result = Curl_output_digest(conn,
|
||||
FALSE, /* not a proxy */
|
||||
(unsigned char *)request,
|
||||
(unsigned char *)path);
|
||||
(const unsigned char *)request,
|
||||
(const unsigned char *)path);
|
||||
if(result)
|
||||
return result;
|
||||
} else
|
||||
@@ -517,7 +517,7 @@ Curl_http_output_auth(struct connectdata *conn,
|
||||
if(authhost->picked == CURLAUTH_BASIC) {
|
||||
if(conn->bits.user_passwd &&
|
||||
!checkheaders(data, "Authorization:")) {
|
||||
auth=(char *)"Basic";
|
||||
auth="Basic";
|
||||
result = Curl_output_basic(conn, FALSE);
|
||||
if(result)
|
||||
return result;
|
||||
@@ -551,7 +551,7 @@ Curl_http_output_auth(struct connectdata *conn,
|
||||
|
||||
CURLcode Curl_http_input_auth(struct connectdata *conn,
|
||||
int httpcode,
|
||||
char *header) /* the first non-space */
|
||||
const char *header) /* the first non-space */
|
||||
{
|
||||
/*
|
||||
* This resource requires authentication
|
||||
@@ -559,7 +559,7 @@ CURLcode Curl_http_input_auth(struct connectdata *conn,
|
||||
struct SessionHandle *data = conn->data;
|
||||
|
||||
long *availp;
|
||||
char *start;
|
||||
const char *start;
|
||||
struct auth *authp;
|
||||
|
||||
if (httpcode == 407) {
|
||||
@@ -1055,7 +1055,7 @@ CURLcode add_buffer(send_buffer *in, const void *inptr, size_t size)
|
||||
* Pass headers WITH the colon.
|
||||
*/
|
||||
bool
|
||||
Curl_compareheader(char *headerline, /* line to check */
|
||||
Curl_compareheader(const char *headerline, /* line to check */
|
||||
const char *header, /* header keyword _with_ colon */
|
||||
const char *content) /* content string to find */
|
||||
{
|
||||
@@ -1067,8 +1067,8 @@ Curl_compareheader(char *headerline, /* line to check */
|
||||
size_t hlen = strlen(header);
|
||||
size_t clen;
|
||||
size_t len;
|
||||
char *start;
|
||||
char *end;
|
||||
const char *start;
|
||||
const char *end;
|
||||
|
||||
if(!strnequal(headerline, header, hlen))
|
||||
return FALSE; /* doesn't start with header */
|
||||
@@ -1118,8 +1118,8 @@ Curl_compareheader(char *headerline, /* line to check */
|
||||
|
||||
CURLcode Curl_proxyCONNECT(struct connectdata *conn,
|
||||
int sockindex,
|
||||
char *hostname,
|
||||
int remote_port)
|
||||
const char *hostname,
|
||||
unsigned short remote_port)
|
||||
{
|
||||
int subversion=0;
|
||||
struct SessionHandle *data=conn->data;
|
||||
@@ -1993,7 +1993,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
|
||||
data->reqdata.resume_from = 0;
|
||||
}
|
||||
|
||||
if(data->reqdata.resume_from) {
|
||||
if(data->reqdata.resume_from && !data->state.this_is_a_follow) {
|
||||
/* do we still game? */
|
||||
curl_off_t passed=0;
|
||||
|
||||
@@ -2049,6 +2049,10 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
|
||||
else if((httpreq != HTTPREQ_GET) &&
|
||||
!checkheaders(data, "Content-Range:")) {
|
||||
|
||||
/* if a line like this was already allocated, free the previous one */
|
||||
if(conn->allocptr.rangeline)
|
||||
free(conn->allocptr.rangeline);
|
||||
|
||||
if(data->reqdata.resume_from) {
|
||||
/* This is because "resume" was selected */
|
||||
curl_off_t total_expected_size=
|
||||
@@ -2066,6 +2070,8 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
|
||||
aprintf("Content-Range: bytes %s/%" FORMAT_OFF_T "\r\n",
|
||||
data->reqdata.range, data->set.infilesize);
|
||||
}
|
||||
if(!conn->allocptr.rangeline)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2185,11 +2191,11 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
|
||||
if(data->set.timecondition) {
|
||||
struct tm *tm;
|
||||
|
||||
/* Phil Karn (Fri, 13 Apr 2001) pointed out that the If-Modified-Since
|
||||
* header family should have their times set in GMT as RFC2616 defines:
|
||||
* "All HTTP date/time stamps MUST be represented in Greenwich Mean Time
|
||||
* (GMT), without exception. For the purposes of HTTP, GMT is exactly
|
||||
* equal to UTC (Coordinated Universal Time)." (see page 20 of RFC2616).
|
||||
/* The If-Modified-Since header family should have their times set in
|
||||
* GMT as RFC2616 defines: "All HTTP date/time stamps MUST be
|
||||
* represented in Greenwich Mean Time (GMT), without exception. For the
|
||||
* purposes of HTTP, GMT is exactly equal to UTC (Coordinated Universal
|
||||
* Time)." (see page 20 of RFC2616).
|
||||
*/
|
||||
|
||||
#ifdef HAVE_GMTIME_R
|
||||
|
||||
@@ -24,14 +24,14 @@
|
||||
* $Id$
|
||||
***************************************************************************/
|
||||
#ifndef CURL_DISABLE_HTTP
|
||||
bool Curl_compareheader(char *headerline, /* line to check */
|
||||
bool Curl_compareheader(const char *headerline, /* line to check */
|
||||
const char *header, /* header keyword _with_ colon */
|
||||
const char *content); /* content string to find */
|
||||
|
||||
/* ftp can use this as well */
|
||||
CURLcode Curl_proxyCONNECT(struct connectdata *conn,
|
||||
int tunnelsocket,
|
||||
char *hostname, int remote_port);
|
||||
const char *hostname, unsigned short remote_port);
|
||||
|
||||
/* protocol-specific functions set up to be called by the main engine */
|
||||
CURLcode Curl_http(struct connectdata *conn, bool *done);
|
||||
@@ -50,7 +50,7 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn, char *datap,
|
||||
/* These functions are in http.c */
|
||||
void Curl_http_auth_stage(struct SessionHandle *data, int stage);
|
||||
CURLcode Curl_http_input_auth(struct connectdata *conn,
|
||||
int httpcode, char *header);
|
||||
int httpcode, const char *header);
|
||||
CURLcode Curl_http_auth_act(struct connectdata *conn);
|
||||
|
||||
int Curl_http_should_fail(struct connectdata *conn);
|
||||
|
||||
@@ -56,8 +56,8 @@ Proxy-Authenticate: Digest realm="testrealm", nonce="1053604598"
|
||||
|
||||
CURLdigest Curl_input_digest(struct connectdata *conn,
|
||||
bool proxy,
|
||||
char *header) /* rest of the *-authenticate:
|
||||
header */
|
||||
const char *header) /* rest of the *-authenticate:
|
||||
header */
|
||||
{
|
||||
bool more = TRUE;
|
||||
char *token = NULL;
|
||||
@@ -212,8 +212,8 @@ static void md5_to_ascii(unsigned char *source, /* 16 bytes */
|
||||
|
||||
CURLcode Curl_output_digest(struct connectdata *conn,
|
||||
bool proxy,
|
||||
unsigned char *request,
|
||||
unsigned char *uripath)
|
||||
const unsigned char *request,
|
||||
const unsigned char *uripath)
|
||||
{
|
||||
/* We have a Digest setup for this, use it! Now, to get all the details for
|
||||
this sorted out, I must urge you dear friend to read up on the RFC2617
|
||||
|
||||
@@ -40,13 +40,13 @@ enum {
|
||||
|
||||
/* this is for digest header input */
|
||||
CURLdigest Curl_input_digest(struct connectdata *conn,
|
||||
bool proxy, char *header);
|
||||
bool proxy, const char *header);
|
||||
|
||||
/* this is for creating digest header output */
|
||||
CURLcode Curl_output_digest(struct connectdata *conn,
|
||||
bool proxy,
|
||||
unsigned char *request,
|
||||
unsigned char *uripath);
|
||||
const unsigned char *request,
|
||||
const unsigned char *uripath);
|
||||
void Curl_digest_cleanup_one(struct digestdata *dig);
|
||||
|
||||
#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_CRYPTO_AUTH)
|
||||
|
||||
@@ -113,7 +113,7 @@ log_gss_error(struct connectdata *conn, OM_uint32 error_status, char *prefix)
|
||||
infof(conn->data, "%s", buf);
|
||||
}
|
||||
|
||||
int Curl_input_negotiate(struct connectdata *conn, char *header)
|
||||
int Curl_input_negotiate(struct connectdata *conn, const char *header)
|
||||
{
|
||||
struct negotiatedata *neg_ctx = &conn->data->state.negotiate;
|
||||
OM_uint32 major_status, minor_status, minor_status2;
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#ifdef HAVE_GSSAPI
|
||||
|
||||
/* this is for Negotiate header input */
|
||||
int Curl_input_negotiate(struct connectdata *conn, char *header);
|
||||
int Curl_input_negotiate(struct connectdata *conn, const char *header);
|
||||
|
||||
/* this is for creating Negotiate header output */
|
||||
CURLcode Curl_output_negotiate(struct connectdata *conn);
|
||||
|
||||
@@ -218,8 +218,8 @@ static void print_hex(FILE *handle, const char *buf, size_t len)
|
||||
|
||||
CURLntlm Curl_input_ntlm(struct connectdata *conn,
|
||||
bool proxy, /* if proxy or not */
|
||||
char *header) /* rest of the www-authenticate:
|
||||
header */
|
||||
const char *header) /* rest of the www-authenticate:
|
||||
header */
|
||||
{
|
||||
/* point to the correct struct with this */
|
||||
struct ntlmdata *ntlm;
|
||||
@@ -917,6 +917,13 @@ CURLcode Curl_output_ntlm(struct connectdata *conn,
|
||||
useroff = domoff + domlen;
|
||||
hostoff = useroff + userlen;
|
||||
|
||||
/*
|
||||
* In the case the server sets the flag NTLMFLAG_NEGOTIATE_UNICODE, we
|
||||
* need to filter it off because libcurl doesn't UNICODE encode the
|
||||
* strings it packs into the NTLM authenticate packet.
|
||||
*/
|
||||
ntlm->flags &= ~NTLMFLAG_NEGOTIATE_UNICODE;
|
||||
|
||||
/* Create the big type-3 message binary blob */
|
||||
size = snprintf((char *)ntlmbuf, sizeof(ntlmbuf),
|
||||
NTLMSSP_SIGNATURE "%c"
|
||||
|
||||
@@ -33,7 +33,8 @@ typedef enum {
|
||||
} CURLntlm;
|
||||
|
||||
/* this is for ntlm header input */
|
||||
CURLntlm Curl_input_ntlm(struct connectdata *conn, bool proxy, char *header);
|
||||
CURLntlm Curl_input_ntlm(struct connectdata *conn, bool proxy,
|
||||
const char *header);
|
||||
|
||||
/* this is for creating ntlm header output */
|
||||
CURLcode Curl_output_ntlm(struct connectdata *conn, bool proxy);
|
||||
|
||||
@@ -69,7 +69,12 @@ static char *inet_ntop4 (const unsigned char *src, char *dst, size_t size)
|
||||
return (char *)memmove(dst, ptr, strlen(ptr)+1);
|
||||
|
||||
#elif defined(HAVE_INET_NTOA_R)
|
||||
|
||||
#if defined(HAVE_INT_INET_NTOA_R)
|
||||
return inet_ntoa_r(*(struct in_addr*)src, dst, size)? NULL: dst;
|
||||
#else
|
||||
return inet_ntoa_r(*(struct in_addr*)src, dst, size);
|
||||
#endif
|
||||
|
||||
#else
|
||||
const char *addr = inet_ntoa(*(struct in_addr*)src);
|
||||
|
||||
533
lib/ldap.c
533
lib/ldap.c
@@ -35,18 +35,28 @@
|
||||
#endif
|
||||
#include <errno.h>
|
||||
|
||||
#if defined(WIN32)
|
||||
#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. */
|
||||
# include <winldap.h>
|
||||
#else
|
||||
#define LDAP_DEPRECATED 1 /* Be sure ldap_init() is defined. */
|
||||
# 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 */
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DLFCN_H
|
||||
# include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
#include "urldata.h"
|
||||
#include <curl/curl.h>
|
||||
#include "sendf.h"
|
||||
@@ -54,7 +64,7 @@
|
||||
#include "transfer.h"
|
||||
#include "strequal.h"
|
||||
#include "strtok.h"
|
||||
#include "ldap.h"
|
||||
#include "curl_ldap.h"
|
||||
#include "memory.h"
|
||||
#include "base64.h"
|
||||
|
||||
@@ -63,163 +73,11 @@
|
||||
|
||||
#include "memdebug.h"
|
||||
|
||||
/* WLdap32.dll functions are *not* stdcall. Must call these via __cdecl
|
||||
* pointers in case libcurl was compiled as fastcall (cl -Gr). Watcom
|
||||
* uses fastcall by default.
|
||||
*/
|
||||
#if !defined(WIN32) && !defined(__cdecl)
|
||||
#define __cdecl
|
||||
#endif
|
||||
#ifndef HAVE_LDAP_URL_PARSE
|
||||
|
||||
#ifndef LDAP_SIZELIMIT_EXCEEDED
|
||||
#define LDAP_SIZELIMIT_EXCEEDED 4
|
||||
#endif
|
||||
#ifndef LDAP_VERSION2
|
||||
#define LDAP_VERSION2 2
|
||||
#endif
|
||||
#ifndef LDAP_VERSION3
|
||||
#define LDAP_VERSION3 3
|
||||
#endif
|
||||
#ifndef LDAP_OPT_PROTOCOL_VERSION
|
||||
#define LDAP_OPT_PROTOCOL_VERSION 0x0011
|
||||
#endif
|
||||
/* Use our own implementation. */
|
||||
|
||||
#define DLOPEN_MODE RTLD_LAZY /*! assume all dlopen() implementations have
|
||||
this */
|
||||
|
||||
#if defined(RTLD_LAZY_GLOBAL) /* It turns out some systems use this: */
|
||||
# undef DLOPEN_MODE
|
||||
# define DLOPEN_MODE RTLD_LAZY_GLOBAL
|
||||
#elif defined(RTLD_GLOBAL)
|
||||
# undef DLOPEN_MODE
|
||||
# define DLOPEN_MODE (RTLD_LAZY | RTLD_GLOBAL)
|
||||
#endif
|
||||
|
||||
#define DYNA_GET_FUNCTION(type, fnc) do { \
|
||||
(fnc) = (type)DynaGetFunction(#fnc); \
|
||||
if ((fnc) == NULL) \
|
||||
return CURLE_FUNCTION_NOT_FOUND; \
|
||||
} while (0)
|
||||
|
||||
/*! CygWin etc. configure could set these, but we don't want it.
|
||||
* Must use WLdap32.dll code.
|
||||
*/
|
||||
#if defined(WIN32)
|
||||
#undef HAVE_DLOPEN
|
||||
#undef HAVE_LIBDL
|
||||
#endif
|
||||
|
||||
/*
|
||||
* We use this ZERO_NULL to avoid picky compiler warnings,
|
||||
* when assigning a NULL pointer to a function pointer var.
|
||||
*/
|
||||
|
||||
#define ZERO_NULL 0
|
||||
|
||||
typedef void * (*dynafunc)(void *input);
|
||||
|
||||
/***********************************************************************
|
||||
*/
|
||||
#if defined(HAVE_DLOPEN) || defined(HAVE_LIBDL) || defined(WIN32)
|
||||
static void *libldap = NULL;
|
||||
#if defined(DL_LBER_FILE)
|
||||
static void *liblber = NULL;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
struct bv {
|
||||
unsigned long bv_len;
|
||||
char *bv_val;
|
||||
};
|
||||
|
||||
static int DynaOpen(const char **mod_name)
|
||||
{
|
||||
#if defined(HAVE_DLOPEN) || defined(HAVE_LIBDL)
|
||||
if (libldap == NULL) {
|
||||
/*
|
||||
* libldap.so can normally resolve its dependency on liblber.so
|
||||
* automatically, but in broken installation it does not so
|
||||
* handle it here by opening liblber.so as global.
|
||||
*/
|
||||
#ifdef DL_LBER_FILE
|
||||
*mod_name = DL_LBER_FILE;
|
||||
liblber = dlopen(*mod_name, DLOPEN_MODE);
|
||||
if (!liblber)
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
/* Assume loading libldap.so will fail if loading of liblber.so failed
|
||||
*/
|
||||
*mod_name = DL_LDAP_FILE;
|
||||
libldap = dlopen(*mod_name, RTLD_LAZY);
|
||||
}
|
||||
return (libldap != NULL);
|
||||
|
||||
#elif defined(WIN32)
|
||||
*mod_name = DL_LDAP_FILE;
|
||||
if (!libldap)
|
||||
libldap = (void*)LoadLibrary(*mod_name);
|
||||
return (libldap != NULL);
|
||||
|
||||
#else
|
||||
*mod_name = "";
|
||||
return (0);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void DynaClose(void)
|
||||
{
|
||||
#if defined(HAVE_DLOPEN) || defined(HAVE_LIBDL)
|
||||
if (libldap) {
|
||||
dlclose(libldap);
|
||||
libldap=NULL;
|
||||
}
|
||||
#ifdef DL_LBER_FILE
|
||||
if (liblber) {
|
||||
dlclose(liblber);
|
||||
liblber=NULL;
|
||||
}
|
||||
#endif
|
||||
#elif defined(WIN32)
|
||||
if (libldap) {
|
||||
FreeLibrary ((HMODULE)libldap);
|
||||
libldap = NULL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static dynafunc DynaGetFunction(const char *name)
|
||||
{
|
||||
dynafunc func = (dynafunc)ZERO_NULL;
|
||||
|
||||
#if defined(HAVE_DLOPEN) || defined(HAVE_LIBDL)
|
||||
if (libldap) {
|
||||
/* This typecast magic below was brought by Joe Halpin. In ISO C, you
|
||||
* cannot typecast a data pointer to a function pointer, but that's
|
||||
* exactly what we need to do here to avoid compiler warnings on picky
|
||||
* compilers! */
|
||||
*(void**) (&func) = dlsym(libldap, name);
|
||||
}
|
||||
#ifdef DL_LBER_FILE
|
||||
if (!func && liblber) {
|
||||
*(void**) (&func) = dlsym(liblber, name);
|
||||
}
|
||||
#endif
|
||||
#elif defined(WIN32)
|
||||
if (libldap) {
|
||||
func = (dynafunc)GetProcAddress((HINSTANCE)libldap, name);
|
||||
}
|
||||
#else
|
||||
(void) name;
|
||||
#endif
|
||||
return func;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*/
|
||||
typedef struct ldap_url_desc {
|
||||
struct ldap_url_desc *lud_next;
|
||||
char *lud_scheme;
|
||||
typedef struct {
|
||||
char *lud_host;
|
||||
int lud_port;
|
||||
char *lud_dn;
|
||||
@@ -227,15 +85,17 @@ typedef struct ldap_url_desc {
|
||||
int lud_scope;
|
||||
char *lud_filter;
|
||||
char **lud_exts;
|
||||
int lud_crit_exts;
|
||||
} LDAPURLDesc;
|
||||
} CURL_LDAPURLDesc;
|
||||
|
||||
#undef LDAPURLDesc
|
||||
#define LDAPURLDesc CURL_LDAPURLDesc
|
||||
|
||||
#ifdef WIN32
|
||||
static int _ldap_url_parse (const struct connectdata *conn,
|
||||
LDAPURLDesc **ludp);
|
||||
static void _ldap_free_urldesc (LDAPURLDesc *ludp);
|
||||
|
||||
static void (*ldap_free_urldesc)(LDAPURLDesc *) = _ldap_free_urldesc;
|
||||
#undef ldap_free_urldesc
|
||||
#define ldap_free_urldesc _ldap_free_urldesc
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_LDAP
|
||||
@@ -254,140 +114,225 @@ CURLcode Curl_ldap(struct connectdata *conn, bool *done)
|
||||
{
|
||||
CURLcode status = CURLE_OK;
|
||||
int rc = 0;
|
||||
#ifndef WIN32
|
||||
int (*ldap_url_parse)(char *, LDAPURLDesc **);
|
||||
void (*ldap_free_urldesc)(void *);
|
||||
#endif
|
||||
void *(__cdecl *ldap_init)(char *, int);
|
||||
int (__cdecl *ldap_simple_bind_s)(void *, char *, char *);
|
||||
int (__cdecl *ldap_unbind_s)(void *);
|
||||
int (__cdecl *ldap_search_s)(void *, char *, int, char *, char **,
|
||||
int, void **);
|
||||
void *(__cdecl *ldap_first_entry)(void *, void *);
|
||||
void *(__cdecl *ldap_next_entry)(void *, void *);
|
||||
char *(__cdecl *ldap_err2string)(int);
|
||||
char *(__cdecl *ldap_get_dn)(void *, void *);
|
||||
char *(__cdecl *ldap_first_attribute)(void *, void *, void **);
|
||||
char *(__cdecl *ldap_next_attribute)(void *, void *, void *);
|
||||
void **(__cdecl *ldap_get_values_len)(void *, void *, const char *);
|
||||
void (__cdecl *ldap_value_free_len)(void **);
|
||||
void (__cdecl *ldap_memfree)(void *);
|
||||
void (__cdecl *ber_free)(void *, int);
|
||||
int (__cdecl *ldap_set_option)(void *, int, void *);
|
||||
|
||||
void *server;
|
||||
LDAP *server = NULL;
|
||||
LDAPURLDesc *ludp = NULL;
|
||||
const char *mod_name;
|
||||
void *result;
|
||||
void *entryIterator; /*! type should be 'LDAPMessage *' */
|
||||
LDAPMessage *result = NULL;
|
||||
LDAPMessage *entryIterator;
|
||||
int num = 0;
|
||||
struct SessionHandle *data=conn->data;
|
||||
int ldap_proto;
|
||||
int ldap_ssl = 0;
|
||||
char *val_b64;
|
||||
size_t val_b64_sz;
|
||||
#ifdef LDAP_OPT_NETWORK_TIMEOUT
|
||||
struct timeval ldap_timeout = {10,0}; /* 10 sec connection/search timeout */
|
||||
#endif
|
||||
|
||||
*done = TRUE; /* unconditionally */
|
||||
infof(data, "LDAP local: LDAP Vendor = %s ; LDAP Version = %d\n",
|
||||
LDAP_VENDOR_NAME, LDAP_VENDOR_VERSION);
|
||||
infof(data, "LDAP local: %s\n", data->change.url);
|
||||
|
||||
if (!DynaOpen(&mod_name)) {
|
||||
failf(data, "The %s LDAP library/libraries couldn't be opened", mod_name);
|
||||
return CURLE_LIBRARY_NOT_FOUND;
|
||||
}
|
||||
|
||||
/* The types are needed because ANSI C distinguishes between
|
||||
* pointer-to-object (data) and pointer-to-function.
|
||||
*/
|
||||
DYNA_GET_FUNCTION(void *(__cdecl *)(char *, int), ldap_init);
|
||||
DYNA_GET_FUNCTION(int (__cdecl *)(void *, char *, char *),
|
||||
ldap_simple_bind_s);
|
||||
DYNA_GET_FUNCTION(int (__cdecl *)(void *), ldap_unbind_s);
|
||||
#ifndef WIN32
|
||||
DYNA_GET_FUNCTION(int (*)(char *, LDAPURLDesc **), ldap_url_parse);
|
||||
DYNA_GET_FUNCTION(void (*)(void *), ldap_free_urldesc);
|
||||
#ifdef HAVE_LDAP_URL_PARSE
|
||||
rc = ldap_url_parse(data->change.url, &ludp);
|
||||
#else
|
||||
rc = _ldap_url_parse(conn, &ludp);
|
||||
#endif
|
||||
DYNA_GET_FUNCTION(int (__cdecl *)(void *, char *, int, char *, char **, int,
|
||||
void **), ldap_search_s);
|
||||
DYNA_GET_FUNCTION(void *(__cdecl *)(void *, void *), ldap_first_entry);
|
||||
DYNA_GET_FUNCTION(void *(__cdecl *)(void *, void *), ldap_next_entry);
|
||||
DYNA_GET_FUNCTION(char *(__cdecl *)(int), ldap_err2string);
|
||||
DYNA_GET_FUNCTION(char *(__cdecl *)(void *, void *), ldap_get_dn);
|
||||
DYNA_GET_FUNCTION(char *(__cdecl *)(void *, void *, void **),
|
||||
ldap_first_attribute);
|
||||
DYNA_GET_FUNCTION(char *(__cdecl *)(void *, void *, void *),
|
||||
ldap_next_attribute);
|
||||
DYNA_GET_FUNCTION(void **(__cdecl *)(void *, void *, const char *),
|
||||
ldap_get_values_len);
|
||||
DYNA_GET_FUNCTION(void (__cdecl *)(void **), ldap_value_free_len);
|
||||
DYNA_GET_FUNCTION(void (__cdecl *)(void *), ldap_memfree);
|
||||
DYNA_GET_FUNCTION(void (__cdecl *)(void *, int), ber_free);
|
||||
DYNA_GET_FUNCTION(int (__cdecl *)(void *, int, void *), ldap_set_option);
|
||||
|
||||
server = (*ldap_init)(conn->host.name, (int)conn->port);
|
||||
if (server == NULL) {
|
||||
failf(data, "LDAP local: Cannot connect to %s:%d",
|
||||
conn->host.name, conn->port);
|
||||
status = CURLE_COULDNT_CONNECT;
|
||||
if (rc != 0) {
|
||||
failf(data, "LDAP local: %s", ldap_err2string(rc));
|
||||
status = CURLE_LDAP_INVALID_URL;
|
||||
goto quit;
|
||||
}
|
||||
|
||||
/* Get the URL scheme ( either ldap or ldaps ) */
|
||||
if (strequal(conn->protostr, "LDAPS"))
|
||||
ldap_ssl = 1;
|
||||
infof(data, "LDAP local: trying to establish %s connection\n",
|
||||
ldap_ssl ? "encrypted" : "cleartext");
|
||||
|
||||
#ifdef LDAP_OPT_NETWORK_TIMEOUT
|
||||
ldap_set_option(NULL, LDAP_OPT_NETWORK_TIMEOUT, &ldap_timeout);
|
||||
#endif
|
||||
ldap_proto = LDAP_VERSION3;
|
||||
(*ldap_set_option)(server, LDAP_OPT_PROTOCOL_VERSION, &ldap_proto);
|
||||
rc = (*ldap_simple_bind_s)(server,
|
||||
conn->bits.user_passwd ? conn->user : NULL,
|
||||
conn->bits.user_passwd ? conn->passwd : NULL);
|
||||
if (rc != 0) {
|
||||
ldap_set_option(NULL, LDAP_OPT_PROTOCOL_VERSION, &ldap_proto);
|
||||
|
||||
if (ldap_ssl) {
|
||||
#ifdef HAVE_LDAP_SSL
|
||||
#ifdef CURL_LDAP_WIN
|
||||
/* Win32 LDAP SDK doesnt support insecure mode without CA! */
|
||||
server = ldap_sslinit(conn->host.name, (int)conn->port, 1);
|
||||
ldap_set_option(server, LDAP_OPT_SSL, LDAP_OPT_ON);
|
||||
#else
|
||||
int ldap_option;
|
||||
char* ldap_ca = data->set.str[STRING_SSL_CAFILE];
|
||||
#if defined(CURL_HAS_NOVELL_LDAPSDK)
|
||||
rc = ldapssl_client_init(NULL, NULL);
|
||||
if (rc != LDAP_SUCCESS) {
|
||||
failf(data, "LDAP local: ldapssl_client_init %s", ldap_err2string(rc));
|
||||
status = CURLE_SSL_CERTPROBLEM;
|
||||
goto quit;
|
||||
}
|
||||
if (data->set.ssl.verifypeer) {
|
||||
/* Novell SDK supports DER or BASE64 files. */
|
||||
int cert_type = LDAPSSL_CERT_FILETYPE_B64;
|
||||
if ((data->set.str[STRING_CERT_TYPE]) &&
|
||||
(strequal(data->set.str[STRING_CERT_TYPE], "DER")))
|
||||
cert_type = LDAPSSL_CERT_FILETYPE_DER;
|
||||
if (!ldap_ca) {
|
||||
failf(data, "LDAP local: ERROR %s CA cert not set!",
|
||||
(cert_type == LDAPSSL_CERT_FILETYPE_DER ? "DER" : "PEM"));
|
||||
status = CURLE_SSL_CERTPROBLEM;
|
||||
goto quit;
|
||||
}
|
||||
infof(data, "LDAP local: using %s CA cert '%s'\n",
|
||||
(cert_type == LDAPSSL_CERT_FILETYPE_DER ? "DER" : "PEM"),
|
||||
ldap_ca);
|
||||
rc = ldapssl_add_trusted_cert(ldap_ca, cert_type);
|
||||
if (rc != LDAP_SUCCESS) {
|
||||
failf(data, "LDAP local: ERROR setting %s CA cert: %s",
|
||||
(cert_type == LDAPSSL_CERT_FILETYPE_DER ? "DER" : "PEM"),
|
||||
ldap_err2string(rc));
|
||||
status = CURLE_SSL_CERTPROBLEM;
|
||||
goto quit;
|
||||
}
|
||||
ldap_option = LDAPSSL_VERIFY_SERVER;
|
||||
} else {
|
||||
ldap_option = LDAPSSL_VERIFY_NONE;
|
||||
}
|
||||
rc = ldapssl_set_verify_mode(ldap_option);
|
||||
if (rc != LDAP_SUCCESS) {
|
||||
failf(data, "LDAP local: ERROR setting cert verify mode: %s",
|
||||
ldap_err2string(rc));
|
||||
status = CURLE_SSL_CERTPROBLEM;
|
||||
goto quit;
|
||||
}
|
||||
server = ldapssl_init(conn->host.name, (int)conn->port, 1);
|
||||
if (server == NULL) {
|
||||
failf(data, "LDAP local: Cannot connect to %s:%d",
|
||||
conn->host.name, conn->port);
|
||||
status = CURLE_COULDNT_CONNECT;
|
||||
goto quit;
|
||||
}
|
||||
#elif defined(LDAP_OPT_X_TLS)
|
||||
if (data->set.ssl.verifypeer) {
|
||||
/* OpenLDAP SDK supports BASE64 files. */
|
||||
if ((data->set.str[STRING_CERT_TYPE]) &&
|
||||
(!strequal(data->set.str[STRING_CERT_TYPE], "PEM"))) {
|
||||
failf(data, "LDAP local: ERROR OpenLDAP does only support PEM cert-type!");
|
||||
status = CURLE_SSL_CERTPROBLEM;
|
||||
goto quit;
|
||||
}
|
||||
if (!ldap_ca) {
|
||||
failf(data, "LDAP local: ERROR PEM CA cert not set!");
|
||||
status = CURLE_SSL_CERTPROBLEM;
|
||||
goto quit;
|
||||
}
|
||||
infof(data, "LDAP local: using PEM CA cert: %s\n", ldap_ca);
|
||||
rc = ldap_set_option(NULL, LDAP_OPT_X_TLS_CACERTFILE, ldap_ca);
|
||||
if (rc != LDAP_SUCCESS) {
|
||||
failf(data, "LDAP local: ERROR setting PEM CA cert: %s",
|
||||
ldap_err2string(rc));
|
||||
status = CURLE_SSL_CERTPROBLEM;
|
||||
goto quit;
|
||||
}
|
||||
ldap_option = LDAP_OPT_X_TLS_DEMAND;
|
||||
} else {
|
||||
ldap_option = LDAP_OPT_X_TLS_NEVER;
|
||||
}
|
||||
rc = ldap_set_option(NULL, LDAP_OPT_X_TLS_REQUIRE_CERT, &ldap_option);
|
||||
if (rc != LDAP_SUCCESS) {
|
||||
failf(data, "LDAP local: ERROR setting cert verify mode: %s",
|
||||
ldap_err2string(rc));
|
||||
status = CURLE_SSL_CERTPROBLEM;
|
||||
goto quit;
|
||||
}
|
||||
server = ldap_init(conn->host.name, (int)conn->port);
|
||||
if (server == NULL) {
|
||||
failf(data, "LDAP local: Cannot connect to %s:%d",
|
||||
conn->host.name, conn->port);
|
||||
status = CURLE_COULDNT_CONNECT;
|
||||
goto quit;
|
||||
}
|
||||
ldap_option = LDAP_OPT_X_TLS_HARD;
|
||||
rc = ldap_set_option(server, LDAP_OPT_X_TLS, &ldap_option);
|
||||
if (rc != LDAP_SUCCESS) {
|
||||
failf(data, "LDAP local: ERROR setting SSL/TLS mode: %s",
|
||||
ldap_err2string(rc));
|
||||
status = CURLE_SSL_CERTPROBLEM;
|
||||
goto quit;
|
||||
}
|
||||
/*
|
||||
rc = ldap_start_tls_s(server, NULL, NULL);
|
||||
if (rc != LDAP_SUCCESS) {
|
||||
failf(data, "LDAP local: ERROR starting SSL/TLS mode: %s",
|
||||
ldap_err2string(rc));
|
||||
status = CURLE_SSL_CERTPROBLEM;
|
||||
goto quit;
|
||||
}
|
||||
*/
|
||||
#else
|
||||
/* we should probably never come up to here since configure
|
||||
should check in first place if we can support LDAP SSL/TLS */
|
||||
failf(data, "LDAP local: SSL/TLS not supported with this version "
|
||||
"of the OpenLDAP toolkit\n");
|
||||
status = CURLE_SSL_CERTPROBLEM;
|
||||
goto quit;
|
||||
#endif
|
||||
#endif
|
||||
#endif /* CURL_LDAP_USE_SSL */
|
||||
} else {
|
||||
server = ldap_init(conn->host.name, (int)conn->port);
|
||||
if (server == NULL) {
|
||||
failf(data, "LDAP local: Cannot connect to %s:%d",
|
||||
conn->host.name, conn->port);
|
||||
status = CURLE_COULDNT_CONNECT;
|
||||
goto quit;
|
||||
}
|
||||
}
|
||||
|
||||
rc = ldap_simple_bind_s(server,
|
||||
conn->bits.user_passwd ? conn->user : NULL,
|
||||
conn->bits.user_passwd ? conn->passwd : NULL);
|
||||
if (!ldap_ssl && rc != 0) {
|
||||
ldap_proto = LDAP_VERSION2;
|
||||
(*ldap_set_option)(server, LDAP_OPT_PROTOCOL_VERSION, &ldap_proto);
|
||||
rc = (*ldap_simple_bind_s)(server,
|
||||
conn->bits.user_passwd ? conn->user : NULL,
|
||||
conn->bits.user_passwd ? conn->passwd : NULL);
|
||||
ldap_set_option(server, LDAP_OPT_PROTOCOL_VERSION, &ldap_proto);
|
||||
rc = ldap_simple_bind_s(server,
|
||||
conn->bits.user_passwd ? conn->user : NULL,
|
||||
conn->bits.user_passwd ? conn->passwd : NULL);
|
||||
}
|
||||
if (rc != 0) {
|
||||
failf(data, "LDAP local: %s", (*ldap_err2string)(rc));
|
||||
failf(data, "LDAP local: ldap_simple_bind_s %s", ldap_err2string(rc));
|
||||
status = CURLE_LDAP_CANNOT_BIND;
|
||||
goto quit;
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
rc = _ldap_url_parse(conn, &ludp);
|
||||
#else
|
||||
rc = (*ldap_url_parse)(data->change.url, &ludp);
|
||||
#endif
|
||||
|
||||
if (rc != 0) {
|
||||
failf(data, "LDAP local: %s", (*ldap_err2string)(rc));
|
||||
status = CURLE_LDAP_INVALID_URL;
|
||||
goto quit;
|
||||
}
|
||||
|
||||
rc = (*ldap_search_s)(server, ludp->lud_dn, ludp->lud_scope,
|
||||
ludp->lud_filter, ludp->lud_attrs, 0, &result);
|
||||
rc = ldap_search_s(server, ludp->lud_dn, ludp->lud_scope,
|
||||
ludp->lud_filter, ludp->lud_attrs, 0, &result);
|
||||
|
||||
if (rc != 0 && rc != LDAP_SIZELIMIT_EXCEEDED) {
|
||||
failf(data, "LDAP remote: %s", (*ldap_err2string)(rc));
|
||||
failf(data, "LDAP remote: %s", ldap_err2string(rc));
|
||||
status = CURLE_LDAP_SEARCH_FAILED;
|
||||
goto quit;
|
||||
}
|
||||
|
||||
for(num = 0, entryIterator = (*ldap_first_entry)(server, result);
|
||||
for(num = 0, entryIterator = ldap_first_entry(server, result);
|
||||
entryIterator;
|
||||
entryIterator = (*ldap_next_entry)(server, entryIterator), num++)
|
||||
entryIterator = ldap_next_entry(server, entryIterator), num++)
|
||||
{
|
||||
void *ber = NULL; /*! is really 'BerElement **' */
|
||||
void *attribute; /*! suspicious that this isn't 'const' */
|
||||
char *dn = (*ldap_get_dn)(server, entryIterator);
|
||||
BerElement *ber = NULL;
|
||||
char *attribute; /*! suspicious that this isn't 'const' */
|
||||
char *dn = ldap_get_dn(server, entryIterator);
|
||||
int i;
|
||||
|
||||
Curl_client_write(conn, CLIENTWRITE_BODY, (char *)"DN: ", 4);
|
||||
Curl_client_write(conn, CLIENTWRITE_BODY, (char *)dn, 0);
|
||||
Curl_client_write(conn, CLIENTWRITE_BODY, (char *)"\n", 1);
|
||||
|
||||
for (attribute = (*ldap_first_attribute)(server, entryIterator, &ber);
|
||||
for (attribute = ldap_first_attribute(server, entryIterator, &ber);
|
||||
attribute;
|
||||
attribute = (*ldap_next_attribute)(server, entryIterator, ber))
|
||||
attribute = ldap_next_attribute(server, entryIterator, ber))
|
||||
{
|
||||
struct bv **vals = (struct bv **)
|
||||
(*ldap_get_values_len)(server, entryIterator, attribute);
|
||||
BerValue **vals = ldap_get_values_len(server, entryIterator, attribute);
|
||||
|
||||
if (vals != NULL)
|
||||
{
|
||||
@@ -416,27 +361,32 @@ CURLcode Curl_ldap(struct connectdata *conn, bool *done)
|
||||
}
|
||||
|
||||
/* Free memory used to store values */
|
||||
(*ldap_value_free_len)((void **)vals);
|
||||
ldap_value_free_len(vals);
|
||||
}
|
||||
Curl_client_write(conn, CLIENTWRITE_BODY, (char *)"\n", 1);
|
||||
|
||||
(*ldap_memfree)(attribute);
|
||||
ldap_memfree(attribute);
|
||||
}
|
||||
(*ldap_memfree)(dn);
|
||||
ldap_memfree(dn);
|
||||
if (ber)
|
||||
(*ber_free)(ber, 0);
|
||||
ber_free(ber, 0);
|
||||
}
|
||||
|
||||
quit:
|
||||
LDAP_TRACE (("Received %d entries\n", num));
|
||||
if (result) {
|
||||
ldap_msgfree(result);
|
||||
LDAP_TRACE (("Received %d entries\n", num));
|
||||
}
|
||||
if (rc == LDAP_SIZELIMIT_EXCEEDED)
|
||||
infof(data, "There are more than %d entries\n", num);
|
||||
infof(data, "There are more than %d entries\n", num);
|
||||
if (ludp)
|
||||
(*ldap_free_urldesc)(ludp);
|
||||
ldap_free_urldesc(ludp);
|
||||
if (server)
|
||||
(*ldap_unbind_s)(server);
|
||||
|
||||
DynaClose();
|
||||
ldap_unbind_s(server);
|
||||
#if defined(HAVE_LDAP_SSL) && defined(CURL_HAS_NOVELL_LDAPSDK)
|
||||
if (ldap_ssl)
|
||||
ldapssl_client_deinit();
|
||||
#endif /* HAVE_LDAP_SSL && CURL_HAS_NOVELL_LDAPSDK */
|
||||
|
||||
/* no data to transfer */
|
||||
Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL);
|
||||
@@ -464,7 +414,8 @@ static void _ldap_trace (const char *fmt, ...)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#ifndef HAVE_LDAP_URL_PARSE
|
||||
|
||||
/*
|
||||
* Return scope-value for a scope-string.
|
||||
*/
|
||||
@@ -563,9 +514,9 @@ static int _ldap_url_parse2 (const struct connectdata *conn, LDAPURLDesc *ludp)
|
||||
|
||||
if (!conn->data ||
|
||||
!conn->data->reqdata.path ||
|
||||
conn->data->reqdata.path[0] != '/' ||
|
||||
conn->data->reqdata.path[0] != '/' ||
|
||||
!checkprefix(conn->protostr, conn->data->change.url))
|
||||
return LDAP_INVALID_SYNTAX;
|
||||
return LDAP_INVALID_SYNTAX;
|
||||
|
||||
ludp->lud_scope = LDAP_SCOPE_BASE;
|
||||
ludp->lud_port = conn->remote_port;
|
||||
@@ -575,14 +526,14 @@ static int _ldap_url_parse2 (const struct connectdata *conn, LDAPURLDesc *ludp)
|
||||
*/
|
||||
ludp->lud_dn = strdup(conn->data->reqdata.path+1);
|
||||
if (!ludp->lud_dn)
|
||||
return LDAP_NO_MEMORY;
|
||||
return LDAP_NO_MEMORY;
|
||||
|
||||
p = strchr(ludp->lud_dn, '?');
|
||||
LDAP_TRACE (("DN '%.*s'\n", p ? (size_t)(p-ludp->lud_dn) :
|
||||
strlen(ludp->lud_dn), ludp->lud_dn));
|
||||
|
||||
if (!p)
|
||||
goto success;
|
||||
goto success;
|
||||
|
||||
*p++ = '\0';
|
||||
|
||||
@@ -590,65 +541,65 @@ static int _ldap_url_parse2 (const struct connectdata *conn, LDAPURLDesc *ludp)
|
||||
*/
|
||||
q = strchr(p, '?');
|
||||
if (q)
|
||||
*q++ = '\0';
|
||||
*q++ = '\0';
|
||||
|
||||
if (*p && *p != '?') {
|
||||
ludp->lud_attrs = split_str(p);
|
||||
if (!ludp->lud_attrs)
|
||||
return LDAP_NO_MEMORY;
|
||||
return LDAP_NO_MEMORY;
|
||||
|
||||
for (i = 0; ludp->lud_attrs[i]; i++)
|
||||
LDAP_TRACE (("attr[%d] '%s'\n", i, ludp->lud_attrs[i]));
|
||||
LDAP_TRACE (("attr[%d] '%s'\n", i, ludp->lud_attrs[i]));
|
||||
}
|
||||
|
||||
p = q;
|
||||
if (!p)
|
||||
goto success;
|
||||
goto success;
|
||||
|
||||
/* parse scope. skip "??"
|
||||
*/
|
||||
q = strchr(p, '?');
|
||||
if (q)
|
||||
*q++ = '\0';
|
||||
*q++ = '\0';
|
||||
|
||||
if (*p && *p != '?') {
|
||||
ludp->lud_scope = str2scope(p);
|
||||
if (ludp->lud_scope == -1)
|
||||
return LDAP_INVALID_SYNTAX;
|
||||
return LDAP_INVALID_SYNTAX;
|
||||
LDAP_TRACE (("scope %d\n", ludp->lud_scope));
|
||||
}
|
||||
|
||||
p = q;
|
||||
if (!p)
|
||||
goto success;
|
||||
goto success;
|
||||
|
||||
/* parse filter
|
||||
*/
|
||||
q = strchr(p, '?');
|
||||
if (q)
|
||||
*q++ = '\0';
|
||||
*q++ = '\0';
|
||||
if (!*p)
|
||||
return LDAP_INVALID_SYNTAX;
|
||||
return LDAP_INVALID_SYNTAX;
|
||||
|
||||
ludp->lud_filter = p;
|
||||
LDAP_TRACE (("filter '%s'\n", ludp->lud_filter));
|
||||
|
||||
p = q;
|
||||
if (!p)
|
||||
goto success;
|
||||
goto success;
|
||||
|
||||
/* parse extensions
|
||||
*/
|
||||
ludp->lud_exts = split_str(p);
|
||||
if (!ludp->lud_exts)
|
||||
return LDAP_NO_MEMORY;
|
||||
return LDAP_NO_MEMORY;
|
||||
|
||||
for (i = 0; ludp->lud_exts[i]; i++)
|
||||
LDAP_TRACE (("exts[%d] '%s'\n", i, ludp->lud_exts[i]));
|
||||
LDAP_TRACE (("exts[%d] '%s'\n", i, ludp->lud_exts[i]));
|
||||
|
||||
success:
|
||||
success:
|
||||
if (!unescape_elements(conn->data, ludp))
|
||||
return LDAP_NO_MEMORY;
|
||||
return LDAP_NO_MEMORY;
|
||||
return LDAP_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -697,5 +648,5 @@ static void _ldap_free_urldesc (LDAPURLDesc *ludp)
|
||||
}
|
||||
free (ludp);
|
||||
}
|
||||
#endif /* WIN32 */
|
||||
#endif /* !HAVE_LDAP_URL_PARSE */
|
||||
#endif /* CURL_DISABLE_LDAP */
|
||||
|
||||
10
lib/multi.c
10
lib/multi.c
@@ -511,7 +511,7 @@ CURLMcode curl_multi_add_handle(CURLM *multi_handle,
|
||||
/* We want the connection cache to have plenty room. Before we supported
|
||||
the shared cache every single easy handle had 5 entries in their cache
|
||||
by default. */
|
||||
int newmax = multi->num_easy * 4;
|
||||
long newmax = multi->num_easy * 4;
|
||||
|
||||
if(multi->maxconnects && (multi->maxconnects < newmax))
|
||||
/* don't grow beyond the allowed size */
|
||||
@@ -520,9 +520,11 @@ CURLMcode curl_multi_add_handle(CURLM *multi_handle,
|
||||
if(newmax > multi->connc->num) {
|
||||
/* we only do this is we can in fact grow the cache */
|
||||
CURLcode res = Curl_ch_connc(easy_handle, multi->connc, newmax);
|
||||
if(res != CURLE_OK)
|
||||
/* TODO: we need to do some cleaning up here! */
|
||||
if(res != CURLE_OK) {
|
||||
/* FIXME: may need to do more cleanup here */
|
||||
curl_multi_remove_handle(multi_handle, easy_handle);
|
||||
return CURLM_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -690,7 +692,7 @@ CURLMcode curl_multi_remove_handle(CURLM *multi_handle,
|
||||
return CURLM_BAD_EASY_HANDLE; /* twasn't found */
|
||||
}
|
||||
|
||||
bool Curl_multi_canPipeline(struct Curl_multi* multi)
|
||||
bool Curl_multi_canPipeline(const struct Curl_multi* multi)
|
||||
{
|
||||
return multi->pipelining_enabled;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ void Curl_expire(struct SessionHandle *data, long milli);
|
||||
|
||||
void Curl_multi_rmeasy(void *multi, CURL *data);
|
||||
|
||||
bool Curl_multi_canPipeline(struct Curl_multi* multi);
|
||||
bool Curl_multi_canPipeline(const struct Curl_multi* multi);
|
||||
void Curl_multi_handlePipeBreak(struct SessionHandle *data);
|
||||
|
||||
/* the write bits start at bit 16 for the *getsock() bitmap */
|
||||
|
||||
@@ -550,7 +550,7 @@ int Curl_nss_send(struct connectdata *conn, /* connection data */
|
||||
|
||||
if(err == PR_IO_TIMEOUT_ERROR) {
|
||||
failf(data, "SSL connection timeout");
|
||||
return CURLE_OPERATION_TIMEOUTED;
|
||||
return CURLE_OPERATION_TIMEDOUT;
|
||||
}
|
||||
|
||||
failf(conn->data, "SSL write: error %d\n", err);
|
||||
@@ -591,7 +591,7 @@ ssize_t Curl_nss_recv(struct connectdata * conn, /* connection data */
|
||||
}
|
||||
if(err == PR_IO_TIMEOUT_ERROR) {
|
||||
failf(data, "SSL connection timeout");
|
||||
return CURLE_OPERATION_TIMEOUTED;
|
||||
return CURLE_OPERATION_TIMEDOUT;
|
||||
}
|
||||
failf(conn->data, "SSL read: errno %d", err);
|
||||
return -1;
|
||||
@@ -601,6 +601,6 @@ ssize_t Curl_nss_recv(struct connectdata * conn, /* connection data */
|
||||
|
||||
size_t Curl_nss_version(char *buffer, size_t size)
|
||||
{
|
||||
return snprintf(buffer, size, " NSS/%s", NSS_VERSION);
|
||||
return snprintf(buffer, size, "NSS/%s", NSS_VERSION);
|
||||
}
|
||||
#endif /* USE_NSS */
|
||||
|
||||
140
lib/setup-os400.h
Normal file
140
lib/setup-os400.h
Normal file
@@ -0,0 +1,140 @@
|
||||
#ifndef __SETUP_OS400_H
|
||||
#define __SETUP_OS400_H
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2007, 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.
|
||||
*
|
||||
* $Id$
|
||||
***************************************************************************/
|
||||
|
||||
/* The following must be defined BEFORE common 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. */
|
||||
|
||||
|
||||
/* OS/400 netdb.h does not define NI_MAXHOST. */
|
||||
#define NI_MAXHOST 1025
|
||||
|
||||
/* OS/400 netdb.h does not define NI_MAXSERV. */
|
||||
#define NI_MAXSERV 32
|
||||
|
||||
/* OS/400 does not define the ifr_dstaddr union member. */
|
||||
#define ifr_dstaddr ifr_addr
|
||||
|
||||
/* No OS/400 header file defines u_int32_t. */
|
||||
typedef unsigned long u_int32_t;
|
||||
|
||||
|
||||
/* System API wrapper prototypes and definitions to support ASCII parameters. */
|
||||
|
||||
#include <sys/socket.h>
|
||||
#include <netdb.h>
|
||||
#include <qsossl.h>
|
||||
#include <gssapi.h>
|
||||
|
||||
extern int Curl_getaddrinfo_a(const char * nodename, const char * servname,
|
||||
const struct addrinfo * hints,
|
||||
struct addrinfo * * res);
|
||||
#define getaddrinfo Curl_getaddrinfo_a
|
||||
|
||||
|
||||
extern int Curl_getnameinfo_a(const struct sockaddr * sa, socklen_t salen,
|
||||
char * nodename, socklen_t nodenamelen,
|
||||
char * servname, socklen_t servnamelen,
|
||||
int flags);
|
||||
#define getnameinfo Curl_getnameinfo_a
|
||||
|
||||
|
||||
/* SSL wrappers. */
|
||||
|
||||
extern int Curl_inet_ntoa_r_a(struct in_addr internet_address,
|
||||
char * output_buffer,
|
||||
int output_buffer_length);
|
||||
#define inet_ntoa_r Curl_inet_ntoa_r_a
|
||||
|
||||
|
||||
extern int Curl_SSL_Init_Application_a(SSLInitApp * init_app);
|
||||
#define SSL_Init_Application Curl_SSL_Init_Application_a
|
||||
|
||||
|
||||
extern int Curl_SSL_Init_a(SSLInit * init);
|
||||
#define SSL_Init Curl_SSL_Init_a
|
||||
|
||||
|
||||
extern char * Curl_SSL_Strerror_a(int sslreturnvalue, SSLErrorMsg * serrmsgp);
|
||||
#define SSL_Strerror Curl_SSL_Strerror_a
|
||||
|
||||
|
||||
/* GSSAPI wrappers. */
|
||||
|
||||
extern OM_uint32 Curl_gss_import_name_a(OM_uint32 * minor_status,
|
||||
gss_buffer_t in_name,
|
||||
gss_OID in_name_type,
|
||||
gss_name_t * out_name);
|
||||
#define gss_import_name Curl_gss_import_name_a
|
||||
|
||||
|
||||
extern OM_uint32 Curl_gss_display_status_a(OM_uint32 * minor_status,
|
||||
OM_uint32 status_value,
|
||||
int status_type, gss_OID mech_type,
|
||||
gss_msg_ctx_t * message_context,
|
||||
gss_buffer_t status_string);
|
||||
#define gss_display_status Curl_gss_display_status_a
|
||||
|
||||
|
||||
extern OM_uint32 Curl_gss_init_sec_context_a(OM_uint32 * minor_status,
|
||||
gss_cred_id_t cred_handle,
|
||||
gss_ctx_id_t * context_handle,
|
||||
gss_name_t target_name,
|
||||
gss_OID mech_type,
|
||||
gss_flags_t req_flags,
|
||||
OM_uint32 time_req,
|
||||
gss_channel_bindings_t
|
||||
input_chan_bindings,
|
||||
gss_buffer_t input_token,
|
||||
gss_OID * actual_mech_type,
|
||||
gss_buffer_t output_token,
|
||||
gss_flags_t * ret_flags,
|
||||
OM_uint32 * time_rec);
|
||||
#define gss_init_sec_context Curl_gss_init_sec_context_a
|
||||
|
||||
|
||||
extern OM_uint32 Curl_gss_delete_sec_context_a(OM_uint32 * minor_status,
|
||||
gss_ctx_id_t * context_handle,
|
||||
gss_buffer_t output_token);
|
||||
#define gss_delete_sec_context Curl_gss_delete_sec_context_a
|
||||
|
||||
/* LDAP wrappers. */
|
||||
|
||||
#define BerValue struct berval
|
||||
|
||||
#define ldap_url_parse ldap_url_parse_utf8
|
||||
#define ldap_init Curl_ldap_init_a
|
||||
#define ldap_simple_bind_s Curl_ldap_simple_bind_s_a
|
||||
#define ldap_search_s Curl_ldap_search_s_a
|
||||
#define ldap_get_values_len Curl_ldap_get_values_len_a
|
||||
#define ldap_err2string Curl_ldap_err2string_a
|
||||
#define ldap_get_dn Curl_ldap_get_dn_a
|
||||
#define ldap_first_attribute Curl_ldap_first_attribute_a
|
||||
#define ldap_next_attribute Curl_ldap_next_attribute_a
|
||||
|
||||
#endif /* __SETUP_OS400_H */
|
||||
@@ -67,6 +67,11 @@
|
||||
#include "amigaos.h"
|
||||
#endif
|
||||
|
||||
#ifdef __OS400__
|
||||
#include "config-os400.h"
|
||||
#include "setup-os400.h"
|
||||
#endif
|
||||
|
||||
#ifdef TPF
|
||||
#include "config-tpf.h" /* hand-modified TPF config.h */
|
||||
/* change which select is used for libcurl */
|
||||
|
||||
@@ -98,6 +98,13 @@ struct timeval {
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__minix)
|
||||
/* Minix doesn't support recv on TCP sockets */
|
||||
#define sread(x,y,z) (ssize_t)read((RECV_TYPE_ARG1)(x), \
|
||||
(RECV_TYPE_ARG2)(y), \
|
||||
(RECV_TYPE_ARG3)(z))
|
||||
|
||||
#elif defined(HAVE_RECV)
|
||||
/*
|
||||
* The definitions for the return type and arguments types
|
||||
* of functions recv() and send() belong and come from the
|
||||
@@ -120,7 +127,6 @@ struct timeval {
|
||||
* SEND_TYPE_RETV must also be defined.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_RECV
|
||||
#if !defined(RECV_TYPE_ARG1) || \
|
||||
!defined(RECV_TYPE_ARG2) || \
|
||||
!defined(RECV_TYPE_ARG3) || \
|
||||
@@ -143,7 +149,14 @@ struct timeval {
|
||||
#endif
|
||||
#endif /* HAVE_RECV */
|
||||
|
||||
#ifdef HAVE_SEND
|
||||
|
||||
#if defined(__minix)
|
||||
/* Minix doesn't support send on TCP sockets */
|
||||
#define swrite(x,y,z) (ssize_t)write((SEND_TYPE_ARG1)(x), \
|
||||
(SEND_TYPE_ARG2)(y), \
|
||||
(SEND_TYPE_ARG3)(z))
|
||||
|
||||
#elif defined(HAVE_SEND)
|
||||
#if !defined(SEND_TYPE_ARG1) || \
|
||||
!defined(SEND_QUAL_ARG2) || \
|
||||
!defined(SEND_TYPE_ARG2) || \
|
||||
|
||||
@@ -122,7 +122,7 @@ static int blockread_all(struct connectdata *conn, /* connection data */
|
||||
* Nonsupport "Identification Protocol (RFC1413)"
|
||||
*/
|
||||
CURLcode Curl_SOCKS4(const char *proxy_name,
|
||||
char *hostname,
|
||||
const char *hostname,
|
||||
int remote_port,
|
||||
int sockindex,
|
||||
struct connectdata *conn)
|
||||
@@ -329,7 +329,7 @@ CURLcode Curl_SOCKS4(const char *proxy_name,
|
||||
*/
|
||||
CURLcode Curl_SOCKS5(const char *proxy_name,
|
||||
const char *proxy_password,
|
||||
char *hostname,
|
||||
const char *hostname,
|
||||
int remote_port,
|
||||
int sockindex,
|
||||
struct connectdata *conn)
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
* final destination server.
|
||||
*/
|
||||
CURLcode Curl_SOCKS4(const char *proxy_name,
|
||||
char *hostname,
|
||||
const char *hostname,
|
||||
int remote_port,
|
||||
int sockindex,
|
||||
struct connectdata *conn);
|
||||
@@ -39,7 +39,7 @@ CURLcode Curl_SOCKS4(const char *proxy_name,
|
||||
*/
|
||||
CURLcode Curl_SOCKS5(const char *proxy_name,
|
||||
const char *proxy_password,
|
||||
char *hostname,
|
||||
const char *hostname,
|
||||
int remote_port,
|
||||
int sockindex,
|
||||
struct connectdata *conn);
|
||||
|
||||
@@ -57,7 +57,7 @@ CURLcode Curl_speedcheck(struct SessionHandle *data,
|
||||
"Less than %d bytes/sec transfered the last %d seconds",
|
||||
data->set.low_speed_limit,
|
||||
data->set.low_speed_time);
|
||||
return CURLE_OPERATION_TIMEOUTED;
|
||||
return CURLE_OPERATION_TIMEDOUT;
|
||||
}
|
||||
Curl_expire(data, howlong);
|
||||
}
|
||||
|
||||
70
lib/ssh.c
70
lib/ssh.c
@@ -95,7 +95,6 @@
|
||||
#include "speedcheck.h"
|
||||
#include "getinfo.h"
|
||||
|
||||
#include "strtoofft.h"
|
||||
#include "strequal.h"
|
||||
#include "sslgen.h"
|
||||
#include "connect.h"
|
||||
@@ -166,15 +165,32 @@ kbd_callback(const char *name, int name_len, const char *instruction,
|
||||
|
||||
static CURLcode sftp_libssh2_error_to_CURLE(unsigned long err)
|
||||
{
|
||||
if (err == LIBSSH2_FX_OK)
|
||||
return CURLE_OK;
|
||||
switch (err) {
|
||||
case LIBSSH2_FX_OK:
|
||||
return CURLE_OK;
|
||||
|
||||
/* TODO: map some of the libssh2 errors to the more appropriate CURLcode
|
||||
error code, and possibly add a few new SSH-related one. We must however
|
||||
not return or even depend on libssh2 errors in the public libcurl API */
|
||||
case LIBSSH2_FX_NO_SUCH_FILE:
|
||||
case LIBSSH2_FX_NO_SUCH_PATH:
|
||||
return CURLE_REMOTE_FILE_NOT_FOUND;
|
||||
|
||||
if (err == LIBSSH2_FX_NO_SUCH_FILE)
|
||||
return CURLE_REMOTE_FILE_NOT_FOUND;
|
||||
case LIBSSH2_FX_PERMISSION_DENIED:
|
||||
case LIBSSH2_FX_WRITE_PROTECT:
|
||||
case LIBSSH2_FX_LOCK_CONFlICT:
|
||||
return CURLE_REMOTE_ACCESS_DENIED;
|
||||
|
||||
case LIBSSH2_FX_NO_SPACE_ON_FILESYSTEM:
|
||||
case LIBSSH2_FX_QUOTA_EXCEEDED:
|
||||
return CURLE_REMOTE_DISK_FULL;
|
||||
|
||||
case LIBSSH2_FX_FILE_ALREADY_EXISTS:
|
||||
return CURLE_REMOTE_FILE_EXISTS;
|
||||
|
||||
case LIBSSH2_FX_DIR_NOT_EMPTY:
|
||||
return CURLE_QUOTE_ERROR;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return CURLE_SSH;
|
||||
}
|
||||
@@ -183,6 +199,11 @@ static CURLcode libssh2_session_error_to_CURLE(int err)
|
||||
{
|
||||
if (err == LIBSSH2_ERROR_ALLOC)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
|
||||
/* TODO: map some more of the libssh2 errors to the more appropriate CURLcode
|
||||
error code, and possibly add a few new SSH-related one. We must however
|
||||
not return or even depend on libssh2 errors in the public libcurl API */
|
||||
|
||||
return CURLE_SSH;
|
||||
}
|
||||
|
||||
@@ -722,7 +743,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn)
|
||||
if (cp == NULL) {
|
||||
failf(data, "Syntax error in SFTP command. Supply parameter(s)!");
|
||||
state(conn, SSH_SFTP_CLOSE);
|
||||
sshc->actualCode = CURLE_FTP_QUOTE_ERROR;
|
||||
sshc->actualCode = CURLE_QUOTE_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -880,7 +901,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn)
|
||||
failf(data, "Attempt to get SFTP stats failed: %s",
|
||||
sftp_libssh2_strerror(err));
|
||||
state(conn, SSH_SFTP_CLOSE);
|
||||
sshc->actualCode = CURLE_FTP_QUOTE_ERROR;
|
||||
sshc->actualCode = CURLE_QUOTE_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -894,7 +915,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn)
|
||||
sshc->quote_path2 = NULL;
|
||||
failf(data, "Syntax error: chgrp gid not a number");
|
||||
state(conn, SSH_SFTP_CLOSE);
|
||||
sshc->actualCode = CURLE_FTP_QUOTE_ERROR;
|
||||
sshc->actualCode = CURLE_QUOTE_ERROR;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -909,7 +930,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn)
|
||||
sshc->quote_path2 = NULL;
|
||||
failf(data, "Syntax error: chmod permissions not a number");
|
||||
state(conn, SSH_SFTP_CLOSE);
|
||||
sshc->actualCode = CURLE_FTP_QUOTE_ERROR;
|
||||
sshc->actualCode = CURLE_QUOTE_ERROR;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -922,7 +943,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn)
|
||||
sshc->quote_path2 = NULL;
|
||||
failf(data, "Syntax error: chown uid not a number");
|
||||
state(conn, SSH_SFTP_CLOSE);
|
||||
sshc->actualCode = CURLE_FTP_QUOTE_ERROR;
|
||||
sshc->actualCode = CURLE_QUOTE_ERROR;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -945,7 +966,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn)
|
||||
failf(data, "Attempt to set SFTP stats failed: %s",
|
||||
sftp_libssh2_strerror(err));
|
||||
state(conn, SSH_SFTP_CLOSE);
|
||||
sshc->actualCode = CURLE_FTP_QUOTE_ERROR;
|
||||
sshc->actualCode = CURLE_QUOTE_ERROR;
|
||||
break;
|
||||
}
|
||||
state(conn, SSH_SFTP_NEXT_QUOTE);
|
||||
@@ -966,7 +987,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn)
|
||||
failf(data, "symlink command failed: %s",
|
||||
sftp_libssh2_strerror(err));
|
||||
state(conn, SSH_SFTP_CLOSE);
|
||||
sshc->actualCode = CURLE_FTP_QUOTE_ERROR;
|
||||
sshc->actualCode = CURLE_QUOTE_ERROR;
|
||||
break;
|
||||
}
|
||||
state(conn, SSH_SFTP_NEXT_QUOTE);
|
||||
@@ -983,7 +1004,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn)
|
||||
sshc->quote_path1 = NULL;
|
||||
failf(data, "mkdir command failed: %s", sftp_libssh2_strerror(err));
|
||||
state(conn, SSH_SFTP_CLOSE);
|
||||
sshc->actualCode = CURLE_FTP_QUOTE_ERROR;
|
||||
sshc->actualCode = CURLE_QUOTE_ERROR;
|
||||
break;
|
||||
}
|
||||
state(conn, SSH_SFTP_NEXT_QUOTE);
|
||||
@@ -1002,7 +1023,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn)
|
||||
sshc->quote_path2 = NULL;
|
||||
failf(data, "rename command failed: %s", sftp_libssh2_strerror(err));
|
||||
state(conn, SSH_SFTP_CLOSE);
|
||||
sshc->actualCode = CURLE_FTP_QUOTE_ERROR;
|
||||
sshc->actualCode = CURLE_QUOTE_ERROR;
|
||||
break;
|
||||
}
|
||||
state(conn, SSH_SFTP_NEXT_QUOTE);
|
||||
@@ -1019,7 +1040,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn)
|
||||
sshc->quote_path1 = NULL;
|
||||
failf(data, "rmdir command failed: %s", sftp_libssh2_strerror(err));
|
||||
state(conn, SSH_SFTP_CLOSE);
|
||||
sshc->actualCode = CURLE_FTP_QUOTE_ERROR;
|
||||
sshc->actualCode = CURLE_QUOTE_ERROR;
|
||||
break;
|
||||
}
|
||||
state(conn, SSH_SFTP_NEXT_QUOTE);
|
||||
@@ -1036,7 +1057,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn)
|
||||
sshc->quote_path1 = NULL;
|
||||
failf(data, "rm command failed: %s", sftp_libssh2_strerror(err));
|
||||
state(conn, SSH_SFTP_CLOSE);
|
||||
sshc->actualCode = CURLE_FTP_QUOTE_ERROR;
|
||||
sshc->actualCode = CURLE_QUOTE_ERROR;
|
||||
break;
|
||||
}
|
||||
state(conn, SSH_SFTP_NEXT_QUOTE);
|
||||
@@ -1065,15 +1086,16 @@ static CURLcode ssh_statemach_act(struct connectdata *conn)
|
||||
* same name as the last directory in the path.
|
||||
*/
|
||||
sftp_scp->sftp_handle =
|
||||
libssh2_sftp_open(sftp_scp->sftp_session, sftp_scp->path,
|
||||
LIBSSH2_FXF_WRITE|LIBSSH2_FXF_CREAT|LIBSSH2_FXF_TRUNC,
|
||||
data->set.new_file_perms);
|
||||
libssh2_sftp_open(sftp_scp->sftp_session, sftp_scp->path,
|
||||
LIBSSH2_FXF_WRITE|LIBSSH2_FXF_CREAT|LIBSSH2_FXF_TRUNC,
|
||||
data->set.new_file_perms);
|
||||
if (!sftp_scp->sftp_handle) {
|
||||
if (libssh2_session_last_errno(sftp_scp->ssh_session) ==
|
||||
LIBSSH2_ERROR_EAGAIN) {
|
||||
break;
|
||||
} else {
|
||||
err = libssh2_sftp_last_error(sftp_scp->sftp_session);
|
||||
failf(data, "Upload failed: %s", sftp_libssh2_strerror(err));
|
||||
if (sshc->secondCreateDirs) {
|
||||
state(conn, SSH_SFTP_CLOSE);
|
||||
sshc->actualCode = err;
|
||||
@@ -2143,7 +2165,7 @@ get_pathname(const char **cpp, char **path)
|
||||
if (!*cp) {
|
||||
*cpp = cp;
|
||||
*path = NULL;
|
||||
return CURLE_FTP_QUOTE_ERROR;
|
||||
return CURLE_QUOTE_ERROR;
|
||||
}
|
||||
|
||||
*path = malloc(strlen(cp) + 1);
|
||||
@@ -2198,7 +2220,7 @@ get_pathname(const char **cpp, char **path)
|
||||
fail:
|
||||
Curl_safefree(*path);
|
||||
*path = NULL;
|
||||
return CURLE_FTP_QUOTE_ERROR;
|
||||
return CURLE_QUOTE_ERROR;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -345,7 +345,7 @@ CURLcode Curl_ssl_addsessionid(struct connectdata *conn,
|
||||
void *ssl_sessionid,
|
||||
size_t idsize)
|
||||
{
|
||||
int i;
|
||||
long i;
|
||||
struct SessionHandle *data=conn->data; /* the mother of all structs */
|
||||
struct curl_ssl_session *store = &data->state.session[0];
|
||||
long oldest_age=data->state.session[0].age; /* zero if unused */
|
||||
@@ -395,7 +395,7 @@ CURLcode Curl_ssl_addsessionid(struct connectdata *conn,
|
||||
void Curl_ssl_close_all(struct SessionHandle *data)
|
||||
{
|
||||
#ifdef USE_SSL
|
||||
int i;
|
||||
long i;
|
||||
/* kill the session ID cache */
|
||||
if(data->state.session) {
|
||||
for(i=0; i< data->set.ssl.numsessions; i++)
|
||||
@@ -632,7 +632,7 @@ ssize_t Curl_ssl_recv(struct connectdata *conn, /* connection data */
|
||||
return -1;
|
||||
}
|
||||
|
||||
return (int)nread;
|
||||
return nread;
|
||||
|
||||
#else /* USE_SSL */
|
||||
(void)conn;
|
||||
@@ -726,7 +726,7 @@ int Curl_ssl_check_cxn(struct connectdata *conn)
|
||||
#endif /* USE_SSLEAY */
|
||||
}
|
||||
|
||||
bool Curl_ssl_data_pending(struct connectdata *conn,
|
||||
bool Curl_ssl_data_pending(const struct connectdata *conn,
|
||||
int connindex)
|
||||
{
|
||||
#ifdef USE_SSLEAY
|
||||
|
||||
@@ -71,7 +71,7 @@ int Curl_ssl_check_cxn(struct connectdata *conn);
|
||||
|
||||
CURLcode Curl_ssl_shutdown(struct connectdata *conn, int sockindex);
|
||||
|
||||
bool Curl_ssl_data_pending(struct connectdata *conn,
|
||||
bool Curl_ssl_data_pending(const struct connectdata *conn,
|
||||
int connindex);
|
||||
|
||||
#if !defined(USE_SSL) && !defined(SSLGEN_C)
|
||||
|
||||
18
lib/ssluse.c
18
lib/ssluse.c
@@ -858,9 +858,9 @@ int Curl_ossl_close_all(struct SessionHandle *data)
|
||||
|
||||
static int Curl_ASN1_UTCTIME_output(struct connectdata *conn,
|
||||
const char *prefix,
|
||||
ASN1_UTCTIME *tm)
|
||||
const ASN1_UTCTIME *tm)
|
||||
{
|
||||
char *asn1_string;
|
||||
const char *asn1_string;
|
||||
int gmt=FALSE;
|
||||
int i;
|
||||
int year=0,month=0,day=0,hour=0,minute=0,second=0;
|
||||
@@ -874,7 +874,7 @@ static int Curl_ASN1_UTCTIME_output(struct connectdata *conn,
|
||||
return 0;
|
||||
|
||||
i=tm->length;
|
||||
asn1_string=(char *)tm->data;
|
||||
asn1_string=(const char *)tm->data;
|
||||
|
||||
if(i < 10)
|
||||
return 1;
|
||||
@@ -929,7 +929,7 @@ static int Curl_ASN1_UTCTIME_output(struct connectdata *conn,
|
||||
static int hostmatch(const char *hostname, const char *pattern)
|
||||
{
|
||||
while (1) {
|
||||
int c = *pattern++;
|
||||
char c = *pattern++;
|
||||
|
||||
if (c == '\0')
|
||||
return (*hostname ? HOST_NOMATCH : HOST_MATCH);
|
||||
@@ -1492,7 +1492,7 @@ Curl_ossl_connect_step2(struct connectdata *conn,
|
||||
if(*timeout_ms < 0) {
|
||||
/* a precaution, no need to continue if time already is up */
|
||||
failf(data, "SSL connection timeout");
|
||||
return CURLE_OPERATION_TIMEOUTED;
|
||||
return CURLE_OPERATION_TIMEDOUT;
|
||||
}
|
||||
|
||||
err = SSL_connect(connssl->handle);
|
||||
@@ -1898,7 +1898,7 @@ size_t Curl_ossl_version(char *buffer, size_t size)
|
||||
#ifdef YASSL_VERSION
|
||||
/* yassl provides an OpenSSL API compatiblity layer so it looks identical
|
||||
to OpenSSL in all other aspects */
|
||||
return snprintf(buffer, size, " yassl/%s", YASSL_VERSION);
|
||||
return snprintf(buffer, size, "yassl/%s", YASSL_VERSION);
|
||||
#else /* YASSL_VERSION */
|
||||
|
||||
#if (SSLEAY_VERSION_NUMBER >= 0x905000)
|
||||
@@ -1919,7 +1919,7 @@ size_t Curl_ossl_version(char *buffer, size_t size)
|
||||
sub[0]='\0';
|
||||
}
|
||||
|
||||
return snprintf(buffer, size, " OpenSSL/%lx.%lx.%lx%s",
|
||||
return snprintf(buffer, size, "OpenSSL/%lx.%lx.%lx%s",
|
||||
(ssleay_value>>28)&0xf,
|
||||
(ssleay_value>>20)&0xff,
|
||||
(ssleay_value>>12)&0xff,
|
||||
@@ -1929,7 +1929,7 @@ size_t Curl_ossl_version(char *buffer, size_t size)
|
||||
#else /* SSLEAY_VERSION_NUMBER is less than 0.9.5 */
|
||||
|
||||
#if (SSLEAY_VERSION_NUMBER >= 0x900000)
|
||||
return snprintf(buffer, size, " OpenSSL/%lx.%lx.%lx",
|
||||
return snprintf(buffer, size, "OpenSSL/%lx.%lx.%lx",
|
||||
(SSLEAY_VERSION_NUMBER>>28)&0xff,
|
||||
(SSLEAY_VERSION_NUMBER>>20)&0xff,
|
||||
(SSLEAY_VERSION_NUMBER>>12)&0xf);
|
||||
@@ -1944,7 +1944,7 @@ size_t Curl_ossl_version(char *buffer, size_t size)
|
||||
else
|
||||
sub[0]='\0';
|
||||
|
||||
return snprintf(buffer, size, " SSL/%x.%x.%x%s",
|
||||
return snprintf(buffer, size, "SSL/%x.%x.%x%s",
|
||||
(SSLEAY_VERSION_NUMBER>>12)&0xff,
|
||||
(SSLEAY_VERSION_NUMBER>>8)&0xf,
|
||||
(SSLEAY_VERSION_NUMBER>>4)&0xf, sub);
|
||||
|
||||
200
lib/strerror.c
200
lib/strerror.c
@@ -58,38 +58,35 @@ curl_easy_strerror(CURLcode error)
|
||||
#ifndef CURL_DISABLE_VERBOSE_STRINGS
|
||||
switch (error) {
|
||||
case CURLE_OK:
|
||||
return "no error";
|
||||
return "No error";
|
||||
|
||||
case CURLE_UNSUPPORTED_PROTOCOL:
|
||||
return "unsupported protocol";
|
||||
return "Unsupported protocol";
|
||||
|
||||
case CURLE_FAILED_INIT:
|
||||
return "failed init";
|
||||
return "Failed initialization";
|
||||
|
||||
case CURLE_URL_MALFORMAT:
|
||||
return "URL using bad/illegal format or missing URL";
|
||||
|
||||
case CURLE_COULDNT_RESOLVE_PROXY:
|
||||
return "couldn't resolve proxy name";
|
||||
return "Couldn't resolve proxy name";
|
||||
|
||||
case CURLE_COULDNT_RESOLVE_HOST:
|
||||
return "couldn't resolve host name";
|
||||
return "Couldn't resolve host name";
|
||||
|
||||
case CURLE_COULDNT_CONNECT:
|
||||
return "couldn't connect to server";
|
||||
return "Couldn't connect to server";
|
||||
|
||||
case CURLE_FTP_WEIRD_SERVER_REPLY:
|
||||
return "FTP: weird server reply";
|
||||
|
||||
case CURLE_FTP_ACCESS_DENIED:
|
||||
return "FTP: access denied";
|
||||
case CURLE_REMOTE_ACCESS_DENIED:
|
||||
return "Access denied to remote resource";
|
||||
|
||||
case CURLE_FTP_WEIRD_PASS_REPLY:
|
||||
return "FTP: unknown PASS reply";
|
||||
|
||||
case CURLE_FTP_WEIRD_USER_REPLY:
|
||||
return "FTP: unknown USER reply";
|
||||
|
||||
case CURLE_FTP_WEIRD_PASV_REPLY:
|
||||
return "FTP: unknown PASV reply";
|
||||
|
||||
@@ -99,11 +96,8 @@ curl_easy_strerror(CURLcode error)
|
||||
case CURLE_FTP_CANT_GET_HOST:
|
||||
return "FTP: can't figure out the host in the PASV response";
|
||||
|
||||
case CURLE_FTP_CANT_RECONNECT:
|
||||
return "FTP: can't connect to server the response code is unknown";
|
||||
|
||||
case CURLE_FTP_COULDNT_SET_BINARY:
|
||||
return "FTP: couldn't set binary mode";
|
||||
case CURLE_FTP_COULDNT_SET_TYPE:
|
||||
return "FTP: couldn't set file type";
|
||||
|
||||
case CURLE_PARTIAL_FILE:
|
||||
return "Transferred a partial file";
|
||||
@@ -111,60 +105,47 @@ curl_easy_strerror(CURLcode error)
|
||||
case CURLE_FTP_COULDNT_RETR_FILE:
|
||||
return "FTP: couldn't retrieve (RETR failed) the specified file";
|
||||
|
||||
case CURLE_FTP_WRITE_ERROR:
|
||||
return "FTP: the post-transfer acknowledge response was not OK";
|
||||
|
||||
case CURLE_FTP_QUOTE_ERROR:
|
||||
return "FTP: a quote command returned error";
|
||||
case CURLE_QUOTE_ERROR:
|
||||
return "Quote command returned error";
|
||||
|
||||
case CURLE_HTTP_RETURNED_ERROR:
|
||||
return "HTTP response code said error";
|
||||
|
||||
case CURLE_WRITE_ERROR:
|
||||
return "failed writing received data to disk/application";
|
||||
return "Failed writing received data to disk/application";
|
||||
|
||||
case CURLE_UPLOAD_FAILED:
|
||||
return "upload failed (at start/before it took off)";
|
||||
return "Upload failed (at start/before it took off)";
|
||||
|
||||
case CURLE_READ_ERROR:
|
||||
return "failed to open/read local data from file/application";
|
||||
return "Failed to open/read local data from file/application";
|
||||
|
||||
case CURLE_OUT_OF_MEMORY:
|
||||
#ifdef CURL_DOES_CONVERSIONS
|
||||
return "conversion failed -or- out of memory";
|
||||
#else
|
||||
return "out of memory";
|
||||
#endif /* CURL_DOES_CONVERSIONS */
|
||||
return "Out of memory";
|
||||
|
||||
case CURLE_OPERATION_TIMEOUTED:
|
||||
return "a timeout was reached";
|
||||
|
||||
case CURLE_FTP_COULDNT_SET_ASCII:
|
||||
return "FTP could not set ASCII mode (TYPE A)";
|
||||
case CURLE_OPERATION_TIMEDOUT:
|
||||
return "Timeout was reached";
|
||||
|
||||
case CURLE_FTP_PORT_FAILED:
|
||||
return "FTP command PORT failed";
|
||||
return "FTP: command PORT failed";
|
||||
|
||||
case CURLE_FTP_COULDNT_USE_REST:
|
||||
return "FTP command REST failed";
|
||||
return "FTP: command REST failed";
|
||||
|
||||
case CURLE_FTP_COULDNT_GET_SIZE:
|
||||
return "FTP command SIZE failed";
|
||||
|
||||
case CURLE_HTTP_RANGE_ERROR:
|
||||
return "a range was requested but the server did not deliver it";
|
||||
case CURLE_RANGE_ERROR:
|
||||
return "Requested range was not delivered by the server";
|
||||
|
||||
case CURLE_HTTP_POST_ERROR:
|
||||
return "internal problem setting up the POST";
|
||||
return "Internal problem setting up the POST";
|
||||
|
||||
case CURLE_SSL_CONNECT_ERROR:
|
||||
return "SSL connect error";
|
||||
|
||||
case CURLE_BAD_DOWNLOAD_RESUME:
|
||||
return "couldn't resume download";
|
||||
return "Couldn't resume download";
|
||||
|
||||
case CURLE_FILE_COULDNT_READ_FILE:
|
||||
return "couldn't read a file:// file";
|
||||
return "Couldn't read a file:// file";
|
||||
|
||||
case CURLE_LDAP_CANNOT_BIND:
|
||||
return "LDAP: cannot bind";
|
||||
@@ -172,65 +153,59 @@ curl_easy_strerror(CURLcode error)
|
||||
case CURLE_LDAP_SEARCH_FAILED:
|
||||
return "LDAP: search failed";
|
||||
|
||||
case CURLE_LIBRARY_NOT_FOUND:
|
||||
return "a required shared library was not found";
|
||||
|
||||
case CURLE_FUNCTION_NOT_FOUND:
|
||||
return "a required function in the shared library was not found";
|
||||
return "A required function in the library was not found";
|
||||
|
||||
case CURLE_ABORTED_BY_CALLBACK:
|
||||
return "the operation was aborted by an application callback";
|
||||
return "Operation was aborted by an application callback";
|
||||
|
||||
case CURLE_BAD_FUNCTION_ARGUMENT:
|
||||
return "a libcurl function was given a bad argument";
|
||||
return "A libcurl function was given a bad argument";
|
||||
|
||||
case CURLE_INTERFACE_FAILED:
|
||||
return "failed binding local connection end";
|
||||
return "Failed binding local connection end";
|
||||
|
||||
case CURLE_TOO_MANY_REDIRECTS :
|
||||
return "number of redirects hit maximum amount";
|
||||
return "Number of redirects hit maximum amount";
|
||||
|
||||
case CURLE_UNKNOWN_TELNET_OPTION:
|
||||
return "User specified an unknown option";
|
||||
return "User specified an unknown telnet option";
|
||||
|
||||
case CURLE_TELNET_OPTION_SYNTAX :
|
||||
return "Malformed telnet option";
|
||||
|
||||
case CURLE_SSL_PEER_CERTIFICATE:
|
||||
return "SSL peer certificate was not ok";
|
||||
return "SSL peer certificate was not OK";
|
||||
|
||||
case CURLE_GOT_NOTHING:
|
||||
return "server returned nothing (no headers, no data)";
|
||||
return "Server returned nothing (no headers, no data)";
|
||||
|
||||
case CURLE_SSL_ENGINE_NOTFOUND:
|
||||
return "SSL crypto engine not found";
|
||||
|
||||
case CURLE_SSL_ENGINE_SETFAILED:
|
||||
return "can not set SSL crypto engine as default";
|
||||
return "Can not set SSL crypto engine as default";
|
||||
|
||||
case CURLE_SSL_ENGINE_INITFAILED:
|
||||
return "failed to initialise SSL crypto engine";
|
||||
return "Failed to initialise SSL crypto engine";
|
||||
|
||||
case CURLE_SEND_ERROR:
|
||||
return "failed sending data to the peer";
|
||||
return "Failed sending data to the peer";
|
||||
|
||||
case CURLE_RECV_ERROR:
|
||||
return "failure when receiving data from the peer";
|
||||
|
||||
case CURLE_SHARE_IN_USE:
|
||||
return "share is already in use";
|
||||
return "Failure when receiving data from the peer";
|
||||
|
||||
case CURLE_SSL_CERTPROBLEM:
|
||||
return "problem with the local SSL certificate";
|
||||
return "Problem with the local SSL certificate";
|
||||
|
||||
case CURLE_SSL_CIPHER:
|
||||
return "couldn't use specified SSL cipher";
|
||||
return "Couldn't use specified SSL cipher";
|
||||
|
||||
case CURLE_SSL_CACERT:
|
||||
return "peer certificate cannot be authenticated with known CA certificates";
|
||||
return "Peer certificate cannot be authenticated with known CA certificates";
|
||||
|
||||
case CURLE_SSL_CACERT_BADFILE:
|
||||
return "problem with the SSL CA cert (path? access rights?)";
|
||||
return "Problem with the SSL CA cert (path? access rights?)";
|
||||
|
||||
case CURLE_BAD_CONTENT_ENCODING:
|
||||
return "Unrecognized HTTP Content-Encoding";
|
||||
@@ -241,8 +216,8 @@ curl_easy_strerror(CURLcode error)
|
||||
case CURLE_FILESIZE_EXCEEDED:
|
||||
return "Maximum file size exceeded";
|
||||
|
||||
case CURLE_FTP_SSL_FAILED:
|
||||
return "Requested FTP SSL level failed";
|
||||
case CURLE_USE_SSL_FAILED:
|
||||
return "Requested SSL level failed";
|
||||
|
||||
case CURLE_SSL_SHUTDOWN_FAILED:
|
||||
return "Failed to shut down the SSL connection";
|
||||
@@ -251,7 +226,7 @@ curl_easy_strerror(CURLcode error)
|
||||
return "Send failed since rewinding of the data stream failed";
|
||||
|
||||
case CURLE_LOGIN_DENIED:
|
||||
return "FTP: login denied";
|
||||
return "Login denied";
|
||||
|
||||
case CURLE_TFTP_NOTFOUND:
|
||||
return "TFTP: File Not Found";
|
||||
@@ -259,8 +234,8 @@ curl_easy_strerror(CURLcode error)
|
||||
case CURLE_TFTP_PERM:
|
||||
return "TFTP: Access Violation";
|
||||
|
||||
case CURLE_TFTP_DISKFULL:
|
||||
return "TFTP: Disk full or allocation exceeded";
|
||||
case CURLE_REMOTE_DISK_FULL:
|
||||
return "Disk full or allocation exceeded";
|
||||
|
||||
case CURLE_TFTP_ILLEGAL:
|
||||
return "TFTP: Illegal operation";
|
||||
@@ -268,17 +243,17 @@ curl_easy_strerror(CURLcode error)
|
||||
case CURLE_TFTP_UNKNOWNID:
|
||||
return "TFTP: Unknown transfer ID";
|
||||
|
||||
case CURLE_TFTP_EXISTS:
|
||||
return "TFTP: File already exists";
|
||||
case CURLE_REMOTE_FILE_EXISTS:
|
||||
return "Remote file already exists";
|
||||
|
||||
case CURLE_TFTP_NOSUCHUSER:
|
||||
return "TFTP: No such user";
|
||||
|
||||
case CURLE_CONV_FAILED:
|
||||
return "conversion failed";
|
||||
return "Conversion failed";
|
||||
|
||||
case CURLE_CONV_REQD:
|
||||
return "caller must register CURLOPT_CONV_ callback options";
|
||||
return "Caller must register CURLOPT_CONV_ callback options";
|
||||
|
||||
case CURLE_REMOTE_FILE_NOT_FOUND:
|
||||
return "Remote file not found";
|
||||
@@ -287,12 +262,19 @@ curl_easy_strerror(CURLcode error)
|
||||
return "Error in the SSH layer";
|
||||
|
||||
/* error codes not used by current libcurl */
|
||||
case CURLE_URL_MALFORMAT_USER:
|
||||
case CURLE_FTP_USER_PASSWORD_INCORRECT:
|
||||
case CURLE_MALFORMAT_USER:
|
||||
case CURLE_BAD_CALLING_ORDER:
|
||||
case CURLE_BAD_PASSWORD_ENTERED:
|
||||
case CURLE_OBSOLETE:
|
||||
case CURLE_OBSOLETE4:
|
||||
case CURLE_OBSOLETE10:
|
||||
case CURLE_OBSOLETE12:
|
||||
case CURLE_OBSOLETE16:
|
||||
case CURLE_OBSOLETE20:
|
||||
case CURLE_OBSOLETE24:
|
||||
case CURLE_OBSOLETE29:
|
||||
case CURLE_OBSOLETE32:
|
||||
case CURLE_OBSOLETE40:
|
||||
case CURLE_OBSOLETE44:
|
||||
case CURLE_OBSOLETE46:
|
||||
case CURLE_OBSOLETE50:
|
||||
case CURLE_OBSOLETE57:
|
||||
case CURL_LAST:
|
||||
break;
|
||||
}
|
||||
@@ -310,12 +292,12 @@ curl_easy_strerror(CURLcode error)
|
||||
* The line number for the error will be near this comment, which
|
||||
* is why it is here, and not at the start of the switch.
|
||||
*/
|
||||
return "unknown error";
|
||||
return "Unknown error";
|
||||
#else
|
||||
if (error == CURLE_OK)
|
||||
return "no error";
|
||||
return "No error";
|
||||
else
|
||||
return "error";
|
||||
return "Error";
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -325,39 +307,39 @@ curl_multi_strerror(CURLMcode error)
|
||||
#ifndef CURL_DISABLE_VERBOSE_STRINGS
|
||||
switch (error) {
|
||||
case CURLM_CALL_MULTI_PERFORM:
|
||||
return "please call curl_multi_perform() soon";
|
||||
return "Please call curl_multi_perform() soon";
|
||||
|
||||
case CURLM_OK:
|
||||
return "no error";
|
||||
return "No error";
|
||||
|
||||
case CURLM_BAD_HANDLE:
|
||||
return "invalid multi handle";
|
||||
return "Invalid multi handle";
|
||||
|
||||
case CURLM_BAD_EASY_HANDLE:
|
||||
return "invalid easy handle";
|
||||
return "Invalid easy handle";
|
||||
|
||||
case CURLM_OUT_OF_MEMORY:
|
||||
return "out of memory";
|
||||
return "Out of memory";
|
||||
|
||||
case CURLM_INTERNAL_ERROR:
|
||||
return "internal error";
|
||||
return "Internal error";
|
||||
|
||||
case CURLM_BAD_SOCKET:
|
||||
return "invalid socket argument";
|
||||
return "Invalid socket argument";
|
||||
|
||||
case CURLM_UNKNOWN_OPTION:
|
||||
return "unknown option";
|
||||
return "Unknown option";
|
||||
|
||||
case CURLM_LAST:
|
||||
break;
|
||||
}
|
||||
|
||||
return "unknown error";
|
||||
return "Unknown error";
|
||||
#else
|
||||
if (error == CURLM_OK)
|
||||
return "no error";
|
||||
return "No error";
|
||||
else
|
||||
return "error";
|
||||
return "Error";
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -367,30 +349,30 @@ curl_share_strerror(CURLSHcode error)
|
||||
#ifndef CURL_DISABLE_VERBOSE_STRINGS
|
||||
switch (error) {
|
||||
case CURLSHE_OK:
|
||||
return "no error";
|
||||
return "No error";
|
||||
|
||||
case CURLSHE_BAD_OPTION:
|
||||
return "unknown share option";
|
||||
return "Unknown share option";
|
||||
|
||||
case CURLSHE_IN_USE:
|
||||
return "share currently in use";
|
||||
return "Share currently in use";
|
||||
|
||||
case CURLSHE_INVALID:
|
||||
return "invalid share handle";
|
||||
return "Invalid share handle";
|
||||
|
||||
case CURLSHE_NOMEM:
|
||||
return "out of memory";
|
||||
return "Out of memory";
|
||||
|
||||
case CURLSHE_LAST:
|
||||
break;
|
||||
}
|
||||
|
||||
return "CURLSH unknown";
|
||||
return "CURLSHcode unknown";
|
||||
#else
|
||||
if (error == CURLSHE_OK)
|
||||
return "no error";
|
||||
return "No error";
|
||||
else
|
||||
return "error";
|
||||
return "Error";
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -406,7 +388,7 @@ get_winsock_error (int err, char *buf, size_t len)
|
||||
#ifndef CURL_DISABLE_VERBOSE_STRINGS
|
||||
switch (err) {
|
||||
case WSAEINTR:
|
||||
p = "Call interrupted.";
|
||||
p = "Call interrupted";
|
||||
break;
|
||||
case WSAEBADF:
|
||||
p = "Bad file";
|
||||
@@ -431,7 +413,7 @@ get_winsock_error (int err, char *buf, size_t len)
|
||||
p = "Blocking call in progress";
|
||||
break;
|
||||
case WSAENOTSOCK:
|
||||
p = "Descriptor is not a socket.";
|
||||
p = "Descriptor is not a socket";
|
||||
break;
|
||||
case WSAEDESTADDRREQ:
|
||||
p = "Need destination address";
|
||||
@@ -545,7 +527,7 @@ get_winsock_error (int err, char *buf, size_t len)
|
||||
p = "Winsock library not initialised";
|
||||
break;
|
||||
case WSAVERNOTSUPPORTED:
|
||||
p = "Winsock version not supported.";
|
||||
p = "Winsock version not supported";
|
||||
break;
|
||||
|
||||
/* getXbyY() errors (already handled in herrmsg):
|
||||
@@ -589,7 +571,7 @@ get_winsock_error (int err, char *buf, size_t len)
|
||||
*
|
||||
* The 'err' argument passed in to this function MUST be a true errno number
|
||||
* as reported on this system. We do no range checking on the number before
|
||||
* we pass it to the "number-to-message" convertion function and there might
|
||||
* we pass it to the "number-to-message" conversion function and there might
|
||||
* be systems that don't do proper range checking in there themselves.
|
||||
*
|
||||
* We don't do range checking (on systems other than Windows) since there is
|
||||
@@ -714,7 +696,7 @@ const char *Curl_idn_strerror (struct connectdata *conn, int err)
|
||||
str = "No ACE prefix (\"xn--\")";
|
||||
break;
|
||||
case IDNA_ROUNDTRIP_VERIFY_ERROR:
|
||||
str = "Roundtrip verify error";
|
||||
str = "Round trip verify error";
|
||||
break;
|
||||
case IDNA_CONTAINS_ACE_PREFIX:
|
||||
str = "Already have ACE prefix (\"xn--\")";
|
||||
@@ -737,7 +719,7 @@ const char *Curl_idn_strerror (struct connectdata *conn, int err)
|
||||
if ((Idna_rc)err == IDNA_SUCCESS)
|
||||
str = "No error";
|
||||
else
|
||||
str = "error";
|
||||
str = "Error";
|
||||
#endif
|
||||
if (str)
|
||||
strncpy(buf, str, max);
|
||||
|
||||
@@ -1390,7 +1390,7 @@ CURLcode Curl_telnet(struct connectdata *conn, bool *done)
|
||||
now = Curl_tvnow();
|
||||
if(Curl_tvdiff(now, conn->created) >= data->set.timeout) {
|
||||
failf(data, "Time-out");
|
||||
code = CURLE_OPERATION_TIMEOUTED;
|
||||
code = CURLE_OPERATION_TIMEDOUT;
|
||||
keepon = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
22
lib/tftp.c
22
lib/tftp.c
@@ -114,7 +114,10 @@ typedef enum {
|
||||
TFTP_ERR_ILLEGAL,
|
||||
TFTP_ERR_UNKNOWNID,
|
||||
TFTP_ERR_EXISTS,
|
||||
TFTP_ERR_NOSUCHUSER,
|
||||
TFTP_ERR_NOSUCHUSER, /* This will never be triggered by this code */
|
||||
|
||||
/* The remaining error codes are internal to curl */
|
||||
TFTP_ERR_NONE = -100,
|
||||
TFTP_ERR_TIMEOUT,
|
||||
TFTP_ERR_NORESPONSE
|
||||
} tftp_error_t;
|
||||
@@ -148,7 +151,6 @@ typedef struct tftp_state_data {
|
||||
/* Forward declarations */
|
||||
static CURLcode tftp_rx(tftp_state_data_t *state, tftp_event_t event) ;
|
||||
static CURLcode tftp_tx(tftp_state_data_t *state, tftp_event_t event) ;
|
||||
void tftp_set_timeouts(tftp_state_data_t *state) ;
|
||||
|
||||
/**********************************************************
|
||||
*
|
||||
@@ -160,7 +162,7 @@ void tftp_set_timeouts(tftp_state_data_t *state) ;
|
||||
*
|
||||
*
|
||||
**********************************************************/
|
||||
void tftp_set_timeouts(tftp_state_data_t *state)
|
||||
static void tftp_set_timeouts(tftp_state_data_t *state)
|
||||
{
|
||||
|
||||
struct SessionHandle *data = state->conn->data;
|
||||
@@ -240,12 +242,12 @@ static void setpacketblock(tftp_packet_t *packet, unsigned short num)
|
||||
packet->data[3] = (unsigned char)(num & 0xff);
|
||||
}
|
||||
|
||||
static unsigned short getrpacketevent(tftp_packet_t *packet)
|
||||
static unsigned short getrpacketevent(const tftp_packet_t *packet)
|
||||
{
|
||||
return (unsigned short)((packet->data[0] << 8) | packet->data[1]);
|
||||
}
|
||||
|
||||
static unsigned short getrpacketblock(tftp_packet_t *packet)
|
||||
static unsigned short getrpacketblock(const tftp_packet_t *packet)
|
||||
{
|
||||
return (unsigned short)((packet->data[2] << 8) | packet->data[3]);
|
||||
}
|
||||
@@ -589,6 +591,7 @@ CURLcode Curl_tftp_connect(struct connectdata *conn, bool *done)
|
||||
state->conn = conn;
|
||||
state->sockfd = state->conn->sock[FIRSTSOCKET];
|
||||
state->state = TFTP_STATE_START;
|
||||
state->error = TFTP_ERR_NONE;
|
||||
|
||||
((struct sockaddr *)&state->local_addr)->sa_family =
|
||||
(unsigned short)(conn->ip_addr->ai_family);
|
||||
@@ -791,7 +794,7 @@ CURLcode Curl_tftp(struct connectdata *conn, bool *done)
|
||||
return code;
|
||||
|
||||
/* If we have encountered an error */
|
||||
if(state->error) {
|
||||
if(state->error != TFTP_ERR_NONE) {
|
||||
|
||||
/* Translate internal error codes to curl error codes */
|
||||
switch(state->error) {
|
||||
@@ -802,8 +805,9 @@ CURLcode Curl_tftp(struct connectdata *conn, bool *done)
|
||||
code = CURLE_TFTP_PERM;
|
||||
break;
|
||||
case TFTP_ERR_DISKFULL:
|
||||
code = CURLE_TFTP_DISKFULL;
|
||||
code = CURLE_REMOTE_DISK_FULL;
|
||||
break;
|
||||
case TFTP_ERR_UNDEF:
|
||||
case TFTP_ERR_ILLEGAL:
|
||||
code = CURLE_TFTP_ILLEGAL;
|
||||
break;
|
||||
@@ -811,13 +815,13 @@ CURLcode Curl_tftp(struct connectdata *conn, bool *done)
|
||||
code = CURLE_TFTP_UNKNOWNID;
|
||||
break;
|
||||
case TFTP_ERR_EXISTS:
|
||||
code = CURLE_TFTP_EXISTS;
|
||||
code = CURLE_REMOTE_FILE_EXISTS;
|
||||
break;
|
||||
case TFTP_ERR_NOSUCHUSER:
|
||||
code = CURLE_TFTP_NOSUCHUSER;
|
||||
break;
|
||||
case TFTP_ERR_TIMEOUT:
|
||||
code = CURLE_OPERATION_TIMEOUTED;
|
||||
code = CURLE_OPERATION_TIMEDOUT;
|
||||
break;
|
||||
case TFTP_ERR_NORESPONSE:
|
||||
code = CURLE_COULDNT_CONNECT;
|
||||
|
||||
@@ -268,7 +268,7 @@ CURLcode Curl_readrewind(struct connectdata *conn)
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
static int data_pending(struct connectdata *conn)
|
||||
static int data_pending(const struct connectdata *conn)
|
||||
{
|
||||
/* in the case of libssh2, we can never be really sure that we have emptied
|
||||
its internal buffers so we MUST always try until we get EAGAIN back */
|
||||
@@ -869,6 +869,10 @@ CURLcode Curl_readwrite(struct connectdata *conn,
|
||||
if(contentlength >= 0) {
|
||||
k->size = contentlength;
|
||||
k->maxdownload = k->size;
|
||||
/* we set the progress download size already at this point
|
||||
just to make it easier for apps/callbacks to extract this
|
||||
info as soon as possible */
|
||||
Curl_pgrsSetDownloadSize(data, k->size);
|
||||
}
|
||||
else {
|
||||
/* Negative Content-Length is really odd, and we know it
|
||||
@@ -1178,7 +1182,7 @@ CURLcode Curl_readwrite(struct connectdata *conn,
|
||||
* wasn't a GET we did a POST or PUT resume) */
|
||||
failf(data, "HTTP server doesn't seem to support "
|
||||
"byte ranges. Cannot resume.");
|
||||
return CURLE_HTTP_RANGE_ERROR;
|
||||
return CURLE_RANGE_ERROR;
|
||||
}
|
||||
|
||||
if(data->set.timecondition && !data->reqdata.range) {
|
||||
@@ -1373,7 +1377,7 @@ CURLcode Curl_readwrite(struct connectdata *conn,
|
||||
if((k->keepon & KEEP_WRITE) && (select_res & CURL_CSELECT_OUT)) {
|
||||
/* write */
|
||||
|
||||
int i, si;
|
||||
ssize_t i, si;
|
||||
ssize_t bytes_written;
|
||||
bool writedone=TRUE;
|
||||
|
||||
@@ -1587,7 +1591,7 @@ CURLcode Curl_readwrite(struct connectdata *conn,
|
||||
FORMAT_OFF_T " bytes received",
|
||||
data->set.timeout, k->bytecount);
|
||||
}
|
||||
return CURLE_OPERATION_TIMEOUTED;
|
||||
return CURLE_OPERATION_TIMEDOUT;
|
||||
}
|
||||
|
||||
if(!k->keepon) {
|
||||
@@ -1739,14 +1743,14 @@ void Curl_pre_readwrite(struct connectdata *conn)
|
||||
* keeps track of. This function will only be called for connections that are
|
||||
* in the proper state to have this information available.
|
||||
*/
|
||||
int Curl_single_getsock(struct connectdata *conn,
|
||||
int Curl_single_getsock(const struct connectdata *conn,
|
||||
curl_socket_t *sock, /* points to numsocks number
|
||||
of sockets */
|
||||
int numsocks)
|
||||
{
|
||||
struct SessionHandle *data = conn->data;
|
||||
const struct SessionHandle *data = conn->data;
|
||||
int bitmap = GETSOCK_BLANK;
|
||||
int index = 0;
|
||||
unsigned index = 0;
|
||||
|
||||
if(numsocks < 2)
|
||||
/* simple check but we might need two slots */
|
||||
@@ -1953,16 +1957,17 @@ CURLcode Curl_posttransfer(struct SessionHandle *data)
|
||||
* strlen_url() returns the length of the given URL if the spaces within the
|
||||
* URL were properly URL encoded.
|
||||
*/
|
||||
static int strlen_url(char *url)
|
||||
static size_t strlen_url(const char *url)
|
||||
{
|
||||
char *ptr;
|
||||
int newlen=0;
|
||||
const char *ptr;
|
||||
size_t newlen=0;
|
||||
bool left=TRUE; /* left side of the ? */
|
||||
|
||||
for(ptr=url; *ptr; ptr++) {
|
||||
switch(*ptr) {
|
||||
case '?':
|
||||
left=FALSE;
|
||||
/* fall through */
|
||||
default:
|
||||
newlen++;
|
||||
break;
|
||||
@@ -1980,11 +1985,11 @@ static int strlen_url(char *url)
|
||||
/* strcpy_url() copies a url to a output buffer and URL-encodes the spaces in
|
||||
* the source URL accordingly.
|
||||
*/
|
||||
static void strcpy_url(char *output, char *url)
|
||||
static void strcpy_url(char *output, const char *url)
|
||||
{
|
||||
/* we must add this with whitespace-replacing */
|
||||
bool left=TRUE;
|
||||
char *iptr;
|
||||
const char *iptr;
|
||||
char *optr = output;
|
||||
for(iptr = url; /* read from here */
|
||||
*iptr; /* until zero byte */
|
||||
@@ -1992,6 +1997,7 @@ static void strcpy_url(char *output, char *url)
|
||||
switch(*iptr) {
|
||||
case '?':
|
||||
left=FALSE;
|
||||
/* fall through */
|
||||
default:
|
||||
*optr++=*iptr;
|
||||
break;
|
||||
@@ -2362,6 +2368,11 @@ bool Curl_retry_request(struct connectdata *conn,
|
||||
bool retry = FALSE;
|
||||
struct SessionHandle *data = conn->data;
|
||||
|
||||
/* if we're talking upload, we can't do the checks below, unless the protocol
|
||||
is HTTP as when uploading over HTTP we will still get a response */
|
||||
if(data->set.upload && !(conn->protocol&PROT_HTTP))
|
||||
return retry;
|
||||
|
||||
if((data->reqdata.keep.bytecount +
|
||||
data->reqdata.keep.headerbytecount == 0) &&
|
||||
conn->bits.reuse &&
|
||||
|
||||
@@ -28,7 +28,7 @@ CURLcode Curl_second_connect(struct connectdata *conn);
|
||||
CURLcode Curl_posttransfer(struct SessionHandle *data);
|
||||
CURLcode Curl_follow(struct SessionHandle *data, char *newurl, bool retry);
|
||||
CURLcode Curl_readwrite(struct connectdata *conn, bool *done);
|
||||
int Curl_single_getsock(struct connectdata *conn,
|
||||
int Curl_single_getsock(const struct connectdata *conn,
|
||||
curl_socket_t *socks,
|
||||
int numsocks);
|
||||
CURLcode Curl_readwrite_init(struct connectdata *conn);
|
||||
|
||||
93
lib/url.c
93
lib/url.c
@@ -104,7 +104,6 @@ void idn_free (void *ptr); /* prototype from idn-free.h, not provided by
|
||||
#include "netrc.h"
|
||||
|
||||
#include "formdata.h"
|
||||
#include "base64.h"
|
||||
#include "sslgen.h"
|
||||
#include "hostip.h"
|
||||
#include "transfer.h"
|
||||
@@ -130,7 +129,7 @@ void idn_free (void *ptr); /* prototype from idn-free.h, not provided by
|
||||
#include "tftp.h"
|
||||
#include "http.h"
|
||||
#include "file.h"
|
||||
#include "ldap.h"
|
||||
#include "curl_ldap.h"
|
||||
#include "ssh.h"
|
||||
#include "url.h"
|
||||
#include "connect.h"
|
||||
@@ -158,8 +157,8 @@ static bool ConnectionExists(struct SessionHandle *data,
|
||||
struct connectdata **usethis);
|
||||
static long ConnectionStore(struct SessionHandle *data,
|
||||
struct connectdata *conn);
|
||||
static bool IsPipeliningPossible(struct SessionHandle *handle);
|
||||
static bool IsPipeliningEnabled(struct SessionHandle *handle);
|
||||
static bool IsPipeliningPossible(const struct SessionHandle *handle);
|
||||
static bool IsPipeliningEnabled(const struct SessionHandle *handle);
|
||||
static void conn_free(struct connectdata *conn);
|
||||
|
||||
static void signalPipeClose(struct curl_llist *pipe);
|
||||
@@ -292,7 +291,7 @@ CURLcode Curl_close(struct SessionHandle *data)
|
||||
|
||||
if(data->state.connc && data->state.connc->type == CONNCACHE_MULTI) {
|
||||
struct conncache *c = data->state.connc;
|
||||
int i;
|
||||
long i;
|
||||
struct curl_llist *pipe;
|
||||
struct curl_llist_element *curr;
|
||||
struct connectdata *connptr;
|
||||
@@ -536,7 +535,7 @@ CURLcode Curl_ch_connc(struct SessionHandle *data,
|
||||
void Curl_rm_connc(struct conncache *c)
|
||||
{
|
||||
if(c->connects) {
|
||||
int i;
|
||||
long i;
|
||||
for(i = 0; i < c->num; ++i)
|
||||
conn_free(c->connects[i]);
|
||||
|
||||
@@ -814,16 +813,16 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
|
||||
*/
|
||||
data->set.ftp_response_timeout = va_arg( param , long ) * 1000;
|
||||
break;
|
||||
case CURLOPT_FTPLISTONLY:
|
||||
case CURLOPT_DIRLISTONLY:
|
||||
/*
|
||||
* An FTP option that changes the command to one that asks for a list
|
||||
* An option that changes the command to one that asks for a list
|
||||
* only, no file info details.
|
||||
*/
|
||||
data->set.ftp_list_only = (bool)(0 != va_arg(param, long));
|
||||
break;
|
||||
case CURLOPT_FTPAPPEND:
|
||||
case CURLOPT_APPEND:
|
||||
/*
|
||||
* We want to upload and append to an existing (FTP) file.
|
||||
* We want to upload and append to an existing file.
|
||||
*/
|
||||
data->set.ftp_append = (bool)(0 != va_arg(param, long));
|
||||
break;
|
||||
@@ -1525,9 +1524,9 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
|
||||
result = Curl_setstropt(&data->set.str[STRING_KEY_TYPE],
|
||||
va_arg(param, char *));
|
||||
break;
|
||||
case CURLOPT_SSLKEYPASSWD:
|
||||
case CURLOPT_KEYPASSWD:
|
||||
/*
|
||||
* String that holds the SSL private key password.
|
||||
* String that holds the SSL or SSH private key password.
|
||||
*/
|
||||
result = Curl_setstropt(&data->set.str[STRING_KEY_PASSWD],
|
||||
va_arg(param, char *));
|
||||
@@ -1731,11 +1730,11 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
|
||||
data->set.max_filesize = va_arg(param, long);
|
||||
break;
|
||||
|
||||
case CURLOPT_FTP_SSL:
|
||||
case CURLOPT_USE_SSL:
|
||||
/*
|
||||
* Make FTP transfers attempt to use SSL/TLS.
|
||||
* Make transfers attempt to use SSL/TLS.
|
||||
*/
|
||||
data->set.ftp_ssl = (curl_ftpssl)va_arg(param, long);
|
||||
data->set.ftp_ssl = (curl_usessl)va_arg(param, long);
|
||||
break;
|
||||
|
||||
case CURLOPT_FTPSSLAUTH:
|
||||
@@ -2010,7 +2009,7 @@ static bool SocketIsDead(curl_socket_t sock)
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
static bool IsPipeliningPossible(struct SessionHandle *handle)
|
||||
static bool IsPipeliningPossible(const struct SessionHandle *handle)
|
||||
{
|
||||
if (handle->multi && Curl_multi_canPipeline(handle->multi) &&
|
||||
(handle->set.httpreq == HTTPREQ_GET ||
|
||||
@@ -2021,7 +2020,7 @@ static bool IsPipeliningPossible(struct SessionHandle *handle)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static bool IsPipeliningEnabled(struct SessionHandle *handle)
|
||||
static bool IsPipeliningEnabled(const struct SessionHandle *handle)
|
||||
{
|
||||
if (handle->multi && Curl_multi_canPipeline(handle->multi))
|
||||
return TRUE;
|
||||
@@ -2430,24 +2429,27 @@ static CURLcode ConnectPlease(struct SessionHandle *data,
|
||||
conn->dns_entry = hostaddr;
|
||||
conn->ip_addr = addr;
|
||||
|
||||
Curl_store_ip_addr(conn);
|
||||
result = Curl_store_ip_addr(conn);
|
||||
|
||||
switch(data->set.proxytype) {
|
||||
case CURLPROXY_SOCKS5:
|
||||
result = Curl_SOCKS5(conn->proxyuser, conn->proxypasswd, conn->host.name,
|
||||
conn->remote_port, FIRSTSOCKET, conn);
|
||||
break;
|
||||
case CURLPROXY_HTTP:
|
||||
/* do nothing here. handled later. */
|
||||
break;
|
||||
case CURLPROXY_SOCKS4:
|
||||
result = Curl_SOCKS4(conn->proxyuser, conn->host.name, conn->remote_port,
|
||||
FIRSTSOCKET, conn);
|
||||
break;
|
||||
default:
|
||||
failf(data, "unknown proxytype option given");
|
||||
result = CURLE_COULDNT_CONNECT;
|
||||
break;
|
||||
if(CURLE_OK == result) {
|
||||
|
||||
switch(data->set.proxytype) {
|
||||
case CURLPROXY_SOCKS5:
|
||||
result = Curl_SOCKS5(conn->proxyuser, conn->proxypasswd, conn->host.name,
|
||||
conn->remote_port, FIRSTSOCKET, conn);
|
||||
break;
|
||||
case CURLPROXY_HTTP:
|
||||
/* do nothing here. handled later. */
|
||||
break;
|
||||
case CURLPROXY_SOCKS4:
|
||||
result = Curl_SOCKS4(conn->proxyuser, conn->host.name, conn->remote_port,
|
||||
FIRSTSOCKET, conn);
|
||||
break;
|
||||
default:
|
||||
failf(data, "unknown proxytype option given");
|
||||
result = CURLE_COULDNT_CONNECT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(result)
|
||||
@@ -2867,7 +2869,7 @@ static CURLcode setup_range(struct SessionHandle *data)
|
||||
|
||||
req->resume_from = data->set.set_resume_from;
|
||||
if (req->resume_from || data->set.str[STRING_SET_RANGE]) {
|
||||
if (req->rangestringalloc == TRUE)
|
||||
if (req->rangestringalloc)
|
||||
free(req->range);
|
||||
|
||||
if(req->resume_from)
|
||||
@@ -2946,7 +2948,7 @@ static CURLcode setup_connection_internals(struct SessionHandle *data,
|
||||
#ifdef USE_SSL
|
||||
conn->protocol |= PROT_FTPS|PROT_SSL;
|
||||
/* send data securely unless specifically requested otherwise */
|
||||
conn->ssl[SECONDARYSOCKET].use = data->set.ftp_ssl != CURLFTPSSL_CONTROL;
|
||||
conn->ssl[SECONDARYSOCKET].use = data->set.ftp_ssl != CURLUSESSL_CONTROL;
|
||||
port = PORT_FTPS;
|
||||
#else
|
||||
failf(data, LIBCURL_NAME
|
||||
@@ -3062,6 +3064,23 @@ static CURLcode setup_connection_internals(struct SessionHandle *data,
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef HAVE_LDAP_SSL
|
||||
else if (strequal(conn->protostr, "LDAPS")) {
|
||||
#ifndef CURL_DISABLE_LDAP
|
||||
conn->protocol |= PROT_LDAP|PROT_SSL;
|
||||
conn->port = PORT_LDAPS;
|
||||
conn->remote_port = PORT_LDAPS;
|
||||
conn->curl_do = Curl_ldap;
|
||||
/* no LDAP-specific done */
|
||||
conn->curl_done = (Curl_done_func)ZERO_NULL;
|
||||
#else
|
||||
failf(data, LIBCURL_NAME
|
||||
" was built with LDAP disabled!");
|
||||
return CURLE_UNSUPPORTED_PROTOCOL;
|
||||
#endif
|
||||
}
|
||||
#endif /* CURL_LDAP_USE_SSL */
|
||||
|
||||
else if (strequal(conn->protostr, "FILE")) {
|
||||
#ifndef CURL_DISABLE_FILE
|
||||
conn->protocol |= PROT_FILE;
|
||||
@@ -4207,7 +4226,7 @@ static CURLcode CreateConnection(struct SessionHandle *data,
|
||||
won't, and zero would be to switch it off so we never set it to
|
||||
less than 1! */
|
||||
alarm(1);
|
||||
result = CURLE_OPERATION_TIMEOUTED;
|
||||
result = CURLE_OPERATION_TIMEDOUT;
|
||||
failf(data, "Previous alarm fired off!");
|
||||
}
|
||||
else
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#define PORT_HTTPS 443
|
||||
#define PORT_DICT 2628
|
||||
#define PORT_LDAP 389
|
||||
#define PORT_LDAPS 636
|
||||
#define PORT_TFTP 69
|
||||
#define PORT_SSH 22
|
||||
|
||||
@@ -131,7 +132,7 @@
|
||||
of need. */
|
||||
#define HEADERSIZE 256
|
||||
|
||||
#define CURLEASY_MAGIC_NUMBER 0xc0dedbad
|
||||
#define CURLEASY_MAGIC_NUMBER 0xc0dedbadU
|
||||
|
||||
/* Just a convenience macro to get the larger value out of two given.
|
||||
We prefix with CURL to prevent name collisions. */
|
||||
@@ -1353,7 +1354,7 @@ struct UserDefined {
|
||||
|
||||
curl_proxytype proxytype; /* what kind of proxy that is in use */
|
||||
|
||||
int dns_cache_timeout; /* DNS cache timeout */
|
||||
long dns_cache_timeout; /* DNS cache timeout */
|
||||
long buffer_size; /* size of receive buffer to use */
|
||||
|
||||
void *private_data; /* Private data */
|
||||
@@ -1403,7 +1404,7 @@ struct UserDefined {
|
||||
bool ftp_use_epsv; /* if EPSV is to be attempted or not */
|
||||
bool ftp_use_eprt; /* if EPRT is to be attempted or not */
|
||||
|
||||
curl_ftpssl ftp_ssl; /* if AUTH TLS is to be attempted etc */
|
||||
curl_usessl ftp_ssl; /* if AUTH TLS is to be attempted etc */
|
||||
curl_ftpauth ftpsslauth; /* what AUTH XXX to be attempted */
|
||||
curl_ftpccc ftp_ccc; /* FTP CCC options */
|
||||
bool no_signal; /* do not use any signal/alarm handler */
|
||||
|
||||
@@ -57,13 +57,20 @@ char *curl_version(void)
|
||||
size_t len;
|
||||
size_t left = sizeof(version);
|
||||
strcpy(ptr, LIBCURL_NAME "/" LIBCURL_VERSION );
|
||||
ptr=strchr(ptr, '\0');
|
||||
left -= strlen(ptr);
|
||||
|
||||
len = Curl_ssl_version(ptr, left);
|
||||
len = strlen(ptr);
|
||||
left -= len;
|
||||
ptr += len;
|
||||
|
||||
if (left > 1) {
|
||||
len = Curl_ssl_version(ptr + 1, left - 1);
|
||||
|
||||
if (len > 0) {
|
||||
*ptr = ' ';
|
||||
left -= ++len;
|
||||
ptr += len;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBZ
|
||||
len = snprintf(ptr, left, " zlib/%s", zlibVersion());
|
||||
left -= len;
|
||||
@@ -119,6 +126,9 @@ static const char * const protocols[] = {
|
||||
#endif
|
||||
#ifndef CURL_DISABLE_LDAP
|
||||
"ldap",
|
||||
#ifdef HAVE_LDAP_SSL
|
||||
"ldaps",
|
||||
#endif
|
||||
#endif
|
||||
#ifndef CURL_DISABLE_HTTP
|
||||
"http",
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
SUBDIRS = Win32 Linux Solaris EPM DOS AIX vms
|
||||
|
||||
EXTRA_DIST = README NetWare/get_ver.awk
|
||||
EXTRA_DIST = README NetWare/get_ver.awk OS400/ccsidcurl.c OS400/ccsidcurl.h \
|
||||
OS400/curl.inc.in OS400/initscript.sh OS400/makefile.sh OS400/make-include.sh \
|
||||
OS400/make-lib.sh OS400/make-src.sh OS400/make-tests.sh OS400/os400sys.c \
|
||||
OS400/os400sys.h OS400/README.OS400
|
||||
|
||||
|
||||
245
packages/OS400/README.OS400
Normal file
245
packages/OS400/README.OS400
Normal file
@@ -0,0 +1,245 @@
|
||||
$Id$
|
||||
|
||||
Implementation notes:
|
||||
|
||||
This is a true OS/400 implementation, not a PASE implementation (for PASE,
|
||||
use AIX implementation).
|
||||
|
||||
The biggest problem with OS/400 is EBCDIC. Libcurl implements an internal
|
||||
conversion mechanism, but it has been designed for computers that have a
|
||||
single native character set. OS/400 default native character set varies
|
||||
depending on the country for which it has been localized. And more, a job
|
||||
may dynamically alter its "native" character set.
|
||||
Several characters that do not have fixed code in EBCDIC variants are
|
||||
used in libcurl strings. As a consequence, using the existing conversion
|
||||
mechanism would have lead in a localized binary library - not portable across
|
||||
countries.
|
||||
For this reason, and because libcurl was originally designed for ASCII based
|
||||
operating systems, the current OS/400 implementation uses ASCII as internal
|
||||
character set. This has been accomplished using the QADRT library and
|
||||
include files, a C and system procedures ASCII wrapper library. See IBM QADRT
|
||||
description for more information.
|
||||
This then results in libcurl being an ASCII library: any function string
|
||||
argument is taken/returned in ASCII and a C/C++ calling program built around
|
||||
QADRT may use libcurl functions as on any other platform.
|
||||
QADRT does not define ASCII wrappers for all C/system procedures: the
|
||||
OS/400 configuration header file and an additional module (os400sys.c) define
|
||||
some more of them, that are used by libcurl and that QADRT left out.
|
||||
To support all the different variants of EBCDIC, non-standard wrapper
|
||||
procedures have been added to libcurl on OS/400: they provide an additional
|
||||
CCSID (numeric Coded Character Set ID specific to OS/400) parameter for each
|
||||
string argument. String values passed to callback procedures are NOT converted,
|
||||
so text gathered this way is (probably !) ASCII.
|
||||
|
||||
Another OS/400 problem comes from the fact that the last fixed argument of a
|
||||
vararg procedure may not be of type char, unsigned char, short or unsigned
|
||||
short. Enums that are internally implemented by the C compiler as one of these
|
||||
types are also forbidden. Libcurl uses enums as vararg procedure tagfields...
|
||||
Happily, there is a pragma forcing enums to type "int". The original libcurl
|
||||
header files are thus altered during build process to use this pragma, in
|
||||
order to force libcurl enums of being type int (the pragma disposition in use
|
||||
before inclusion is restored before resuming the including unit compilation).
|
||||
|
||||
Three SSL implementations were present in libcurl. Nevertheless, none of them
|
||||
is available on OS/400. To support SSL on OS/400, a fourth implementation has
|
||||
been added (qssl.[ch]). There is no way to have different certificate stores
|
||||
for CAs and for personal/application certificates/key. More, the SSL context
|
||||
may be defined as an application identifier in the main certificate store,
|
||||
or as a keyring file. As a consequence, the meaning of some fields have been
|
||||
slightly altered:
|
||||
_ The "certificate identifier" is taken from CURLOPT_SSLCERT if defined, else
|
||||
from CURLOPT_CAINFO.
|
||||
_ The certificate identifier is then used as an application identifier in the
|
||||
main certificate store. If successful, this context is used.
|
||||
_ If the previous step failed, the certificate identifier is used as the file
|
||||
name of a keyring. CURLOPT_KEYPASSWD is used here as the keyring password.
|
||||
_ The default ca-bundle (CURLOPT_CAINFO) is set to the main certificate store's
|
||||
keyring file name: this allows to use the system global CAs by default. (In that
|
||||
case, the keyring password is safely recovered from the system... IBM dixit!)
|
||||
|
||||
Non-standard EBCDIC wrapper prototypes are defined in an additional header
|
||||
file: ccsidcurl.h. These should be self-explanatory to an OS/400-aware
|
||||
designer. CCSID 0 can be used to select the current job's CCSID.
|
||||
Wrapper procedures with variable arguments are described below:
|
||||
|
||||
_ curl_easy_setopt_ccsid()
|
||||
Variable arguments are a string pointer and a CCSID (unsigned int) for
|
||||
options:
|
||||
CURLOPT_CAINFO
|
||||
CURLOPT_CAPATH
|
||||
CURLOPT_COOKIE
|
||||
CURLOPT_COOKIEFILE
|
||||
CURLOPT_COOKIEJAR
|
||||
CURLOPT_COOKIELIST
|
||||
CURLOPT_CUSTOMREQUEST
|
||||
CURLOPT_EGDSOCKET
|
||||
CURLOPT_ENCODING
|
||||
CURLOPT_FTPPORT
|
||||
CURLOPT_FTP_ACCOUNT
|
||||
CURLOPT_FTP_ALTERNATIVE_TO_USER
|
||||
CURLOPT_INTERFACE
|
||||
CURLOPT_KEYPASSWD
|
||||
CURLOPT_KRBLEVEL
|
||||
CURLOPT_NETRC_FILE
|
||||
CURLOPT_POSTFIELDS
|
||||
CURLOPT_PROXY
|
||||
CURLOPT_PROXYUSERPWD
|
||||
CURLOPT_RANDOM_FILE
|
||||
CURLOPT_RANGE
|
||||
CURLOPT_REFERER
|
||||
CURLOPT_SSH_PRIVATE_KEYFILE
|
||||
CURLOPT_SSH_PUBLIC_KEYFILE
|
||||
CURLOPT_SSLCERT
|
||||
CURLOPT_SSLCERTTYPE
|
||||
CURLOPT_SSLENGINE
|
||||
CURLOPT_SSLKEY
|
||||
CURLOPT_SSLKEYTYPE
|
||||
CURLOPT_SSL_CIPHER_LIST
|
||||
CURLOPT_URL
|
||||
CURLOPT_USERAGENT
|
||||
CURLOPT_USERPWD
|
||||
Else it is the same as for curl_easy_setopt().
|
||||
Note that CURLOPT_ERRORBUFFER is not in the list above, since it gives the
|
||||
address of an (empty) character buffer, not the address of a string.
|
||||
|
||||
_ curl_formadd_ccsid()
|
||||
In the variable argument list, string pointers should be followed by a (long)
|
||||
CCSID for the following options:
|
||||
CURLFORM_FILENAME
|
||||
CURLFORM_CONTENTTYPE
|
||||
CURLFORM_BUFFER
|
||||
CURLFORM_FILE
|
||||
CURLFORM_FILECONTENT
|
||||
CURLFORM_COPYCONTENTS
|
||||
CURLFORM_COPYNAME
|
||||
CURLFORM_PTRNAME
|
||||
If taken from an argument array, an additional array entry must follow each
|
||||
entry containing one of the above option. This additional entry holds the CCSID
|
||||
in its value field, and the option field is meaningless.
|
||||
It is not possible to have a string pointer and its CCSID across a function
|
||||
parameter/array boundary.
|
||||
Please note that CURLFORM_PTRCONTENTS and CURLFORM_BUFFERPTR are considered
|
||||
unconvertible strings and thus are NOT followed by a CCSID.
|
||||
|
||||
_ curl_easy_getinfo_ccsid
|
||||
The following options are followed by a 'char * *' and a CCSID. Unlike
|
||||
curl_easy_getinfo(), the value returned in the pointer should be freed after
|
||||
use:
|
||||
CURLINFO_EFFECTIVE_URL
|
||||
CURLINFO_CONTENT_TYPE
|
||||
CURLINFO_FTP_ENTRY_PATH
|
||||
Other options are processed like in curl_easy_getinfo().
|
||||
|
||||
Standard compilation environment does support neither autotools nor make;
|
||||
in fact, very few common utilities are available. As a consequence, the
|
||||
config-os400.h has been coded manually and the compilation scripts are
|
||||
a set of shell scripts stored in subdirectory packages/OS400.
|
||||
|
||||
The "curl" command and the test environment are currently not supported on
|
||||
OS/400.
|
||||
|
||||
|
||||
Protocols currently implemented on OS/400:
|
||||
_ HTTP
|
||||
_ HTTPS
|
||||
_ FTP
|
||||
_ FTPS
|
||||
_ FTP with secure transmission.
|
||||
_ LDAP
|
||||
_ DICT
|
||||
_ TELNET
|
||||
|
||||
|
||||
|
||||
Compiling on OS/400:
|
||||
|
||||
These instructions targets people who knows about OS/400, compiling, IFS and
|
||||
archive extraction. Do not ask questions about these subjects if you're not
|
||||
familiar with.
|
||||
|
||||
_ As a prerequisite, QADRT development environment must be installed.
|
||||
_ Install the curl source directory in IFS.
|
||||
_ Enter shell (QSH)
|
||||
_ Change current directory to the curl installation directory
|
||||
_ Change current directory to ./packages/OS400
|
||||
_ Edit file iniscript.sh. You may want to change tunable configuration
|
||||
parameters, like debug info generation, optimisation level, listing option,
|
||||
target library, etc.
|
||||
_ Copy any file in the current directory to makelog (i.e.:
|
||||
cp initscript.sh makelog): this is intended to create the makelog file with
|
||||
an ASCII CCSID!
|
||||
_ Enter the command "sh makefile.sh > makelog 2>&1'
|
||||
_ Examine the makelog file to check for compilation errors.
|
||||
|
||||
Leaving file initscript.sh unchanged, this will produce the following OS/400
|
||||
objects:
|
||||
_ Library CURL. All other objects will be stored in this library.
|
||||
_ Modules for all libcurl units.
|
||||
_ Binding directory CURL_A, to be used at calling program link time for
|
||||
statically binding the modules (specify BNDSRVPGM(QADRTTS) when creating a
|
||||
program using CURL_A).
|
||||
_ Service program CURL, to be used at calling program run-time when this program
|
||||
has dynamically bound curl at link time.
|
||||
_ Binding directory CURL. To be used to dynamically bind libcurl when linking a
|
||||
calling program.
|
||||
_ Source file H. It contains all the include members needed to compile a C/C++
|
||||
module using libcurl, and an ILE/RPG /copy member for support in this
|
||||
language.
|
||||
_ Standard C/C++ libcurl include members in file H.
|
||||
_ CCSIDCURL member in file H. This defines the non-standard EBCDIC wrappers for
|
||||
C and C++.
|
||||
_ CURL.INC member in file H. This defines everything needed by an ILE/RPG
|
||||
program using libcurl.
|
||||
_ LIBxxx modules and programs. Although the test environment is not supported
|
||||
on OS/400, the libcurl test programs are compiled for manual tests.
|
||||
|
||||
|
||||
|
||||
Special programming consideration:
|
||||
|
||||
QADRT being used, the following points must be considered:
|
||||
_ If static binding is used, service program QADRTTS must be linked too.
|
||||
_ The EBCDIC CCSID used by QADRT is 37 by default, NOT THE JOB'S CCSID. If
|
||||
another EBCDIC CCSID is required, it must be set via a locale through a call
|
||||
to setlocale_a (QADRT's setlocale() ASCII wrapper) with category LC_ALL or
|
||||
LC_CTYPE, or by setting environment variable QADRT_ENV_LOCALE to the locale
|
||||
object path before executing the program.
|
||||
_ Do not use original source include files unless you know what you are doing.
|
||||
Use the installed members instead (in /QSYS.LIB/CURL.LIB/H.FILE).
|
||||
|
||||
|
||||
|
||||
ILE/RPG support:
|
||||
|
||||
Since 95% of the OS/400 programmers use ILE/RPG exclusively, a definition
|
||||
/COPY member is provided for this language. To include all libcurl
|
||||
definitions in an ILE/RPG module, line
|
||||
|
||||
h bnddir('CURL/CURL')
|
||||
|
||||
must figure in the program header, and line
|
||||
|
||||
d/copy curl/h,curl.inc
|
||||
|
||||
in the global data section of the module's source code.
|
||||
|
||||
No vararg procedure support exists in ILE/RPG: for this reason, the following
|
||||
considerations apply:
|
||||
_ Procedures curl_easy_setopt_long(), curl_easy_setopt_object(),
|
||||
curl_easy_setopt_function() and curl_easy_setopt_offset() are all alias
|
||||
prototypes to curl_easy_setopt(), but with different parameter lists.
|
||||
_ Procedures curl_easy_getinfo_string(), curl_easy_getinfo_long(),
|
||||
curl_easy_getinfo_double() and curl_easy_getinfo_slist() are all alias
|
||||
prototypes to curl_easy_getinfo(), but with different parameter lists.
|
||||
_ Procedures curl_multi_setopt_long(), curl_multi_setopt_object(),
|
||||
curl_multi_setopt_function() and curl_multi_setopt_offset() are all alias
|
||||
prototypes to curl_multi_setopt(), but with different parameter lists.
|
||||
_ The prototype of procedure curl_formadd() allows specifying a pointer option
|
||||
and the CURLFORM_END option. This makes possible to use an option array
|
||||
without any additional definition. If some specific incompatible argument
|
||||
list is used in the ILE/RPG program, the latter must define a specialised
|
||||
alias. The same applies to curl_formadd_ccsid() too.
|
||||
|
||||
Since RPG cannot cast a long to a pointer, procedure curl_form_long_value()
|
||||
is provided for that purpose: this allows storing a long value in the curl_forms
|
||||
array.
|
||||
1099
packages/OS400/ccsidcurl.c
Normal file
1099
packages/OS400/ccsidcurl.c
Normal file
File diff suppressed because it is too large
Load Diff
65
packages/OS400/ccsidcurl.h
Normal file
65
packages/OS400/ccsidcurl.h
Normal file
@@ -0,0 +1,65 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2007, 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.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef __CURL_CCSIDCURL_H
|
||||
#define __CURL_CCSIDCURL_H
|
||||
|
||||
#include <curl.h>
|
||||
#include <easy.h>
|
||||
#include <multi.h>
|
||||
|
||||
|
||||
CURL_EXTERN char * curl_version_ccsid(unsigned int ccsid);
|
||||
CURL_EXTERN char * curl_easy_escape_ccsid(CURL * handle,
|
||||
const char * string, int length,
|
||||
unsigned int sccsid,
|
||||
unsigned int dccsid);
|
||||
CURL_EXTERN char * curl_easy_unescape_ccsid(CURL * handle, const char * string,
|
||||
int length, int * outlength,
|
||||
unsigned int sccsid,
|
||||
unsigned int dccsid);
|
||||
CURL_EXTERN struct curl_slist * curl_slist_append_ccsid(struct curl_slist * lst,
|
||||
const char * data,
|
||||
unsigned int ccsid);
|
||||
CURL_EXTERN time_t curl_getdate_ccsid(const char * p, const time_t * unused,
|
||||
unsigned int ccsid);
|
||||
CURL_EXTERN curl_version_info_data * curl_version_info_ccsid(CURLversion stamp,
|
||||
unsigned int csid);
|
||||
CURL_EXTERN const char * curl_easy_strerror_ccsid(CURLcode error,
|
||||
unsigned int ccsid);
|
||||
CURL_EXTERN const char * curl_share_strerror_ccsid(CURLSHcode error,
|
||||
unsigned int ccsid);
|
||||
CURL_EXTERN const char * curl_multi_strerror_ccsid(CURLMcode error,
|
||||
unsigned int ccsid);
|
||||
CURL_EXTERN CURLcode curl_easy_getinfo_ccsid(CURL * curl, CURLINFO info, ...);
|
||||
CURL_EXTERN CURLFORMcode curl_formadd_ccsid(struct curl_httppost * * httppost,
|
||||
struct curl_httppost * * last_post,
|
||||
...);
|
||||
CURL_EXTERN char * curl_form_long_value(long value);
|
||||
CURL_EXTERN int curl_formget_ccsid(struct curl_httppost * form, void * arg,
|
||||
curl_formget_callback append,
|
||||
unsigned int ccsid);
|
||||
CURL_EXTERN CURLcode curl_easy_setopt_ccsid(CURL * curl, CURLoption tag, ...);
|
||||
|
||||
#endif
|
||||
1516
packages/OS400/curl.inc.in
Normal file
1516
packages/OS400/curl.inc.in
Normal file
File diff suppressed because it is too large
Load Diff
171
packages/OS400/initscript.sh
Normal file
171
packages/OS400/initscript.sh
Normal file
@@ -0,0 +1,171 @@
|
||||
#!/bin/sh
|
||||
|
||||
# $Id$
|
||||
|
||||
case "${SCRIPTDIR}" in
|
||||
/*) ;;
|
||||
*) SCRIPTDIR="`pwd`/${SCRIPTDIR}"
|
||||
esac
|
||||
|
||||
while true
|
||||
do case "${SCRIPTDIR}" in
|
||||
*/.) SCRIPTDIR="${SCRIPTDIR%/.}";;
|
||||
*) break;;
|
||||
esac
|
||||
done
|
||||
|
||||
# The script directory is supposed to be in $TOPDIR/packages/os400.
|
||||
|
||||
TOPDIR=`dirname "${SCRIPTDIR}"`
|
||||
TOPDIR=`dirname "${TOPDIR}"`
|
||||
export SCRIPTDIR TOPDIR
|
||||
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Tunable configuration parameters.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
TARGETLIB='CURL' # Target OS/400 program library
|
||||
STATBNDDIR='CURL_A' # Static binding directory.
|
||||
DYNBNDDIR='CURL' # Dynamic binding directory.
|
||||
SRVPGM='CURL' # Service program.
|
||||
TGTCCSID='500' # Target CCSID of objects
|
||||
DEBUG='*ALL' # Debug level
|
||||
OPTIMIZE='10' # Optimisation level
|
||||
OUTPUT='*NONE' # Compilation output option.
|
||||
TGTRLS='V5R1M0' # Target OS release
|
||||
|
||||
export TARGETLIB STATBNDDIR DYNBNDDIR SRVPGM TGTCCSID DEBUG OPTIMIZE OUTPUTC
|
||||
export TGTRLS
|
||||
|
||||
|
||||
################################################################################
|
||||
|
||||
# Need to get the version definitions.
|
||||
|
||||
LIBCURL_VERSION=`grep '^#define *LIBCURL_VERSION ' \
|
||||
"${TOPDIR}/include/curl/curlver.h" |
|
||||
sed 's/.*"\(.*\)".*/\1/'`
|
||||
LIBCURL_VERSION_MAJOR=`grep '^#define *LIBCURL_VERSION_MAJOR ' \
|
||||
"${TOPDIR}/include/curl/curlver.h" |
|
||||
sed 's/^#define *LIBCURL_VERSION_MAJOR *\([^ ]*\).*/\1/'`
|
||||
LIBCURL_VERSION_MINOR=`grep '^#define *LIBCURL_VERSION_MINOR ' \
|
||||
"${TOPDIR}/include/curl/curlver.h" |
|
||||
sed 's/^#define *LIBCURL_VERSION_MINOR *\([^ ]*\).*/\1/'`
|
||||
LIBCURL_VERSION_PATCH=`grep '^#define *LIBCURL_VERSION_PATCH ' \
|
||||
"${TOPDIR}/include/curl/curlver.h" |
|
||||
sed 's/^#define *LIBCURL_VERSION_PATCH *\([^ ]*\).*/\1/'`
|
||||
LIBCURL_VERSION_NUM=`grep '^#define *LIBCURL_VERSION_NUM ' \
|
||||
"${TOPDIR}/include/curl/curlver.h" |
|
||||
sed 's/^#define *LIBCURL_VERSION_NUM *0x\([^ ]*\).*/\1/'`
|
||||
LIBCURL_TIMESTAMP=`grep '^#define *LIBCURL_TIMESTAMP ' \
|
||||
"${TOPDIR}/include/curl/curlver.h" |
|
||||
sed 's/.*"\(.*\)".*/\1/'`
|
||||
export LIBCURL_VERSION
|
||||
export LIBCURL_VERSION_MAJOR LIBCURL_VERSION_MINOR LIBCURL_VERSION_PATCH
|
||||
export LIBCURL_VERSION_NUM LIBCURL_TIMESTAMP
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# OS/400 specific definitions.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
LIBIFSNAME="/QSYS.LIB/${TARGETLIB}.LIB"
|
||||
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Procedures.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
# action_needed dest [src]
|
||||
#
|
||||
# dest is an object to build
|
||||
# if specified, src is an object on which dest depends.
|
||||
#
|
||||
# exit 0 (succeeds) if some action has to be taken, else 1.
|
||||
|
||||
action_needed()
|
||||
|
||||
{
|
||||
[ ! -e "${1}" ] && return 0
|
||||
[ "${2}" ] || return 1
|
||||
[ "${1}" -ot "${2}" ] && return 0
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
# make_module module_name source_name [additional_definitions]
|
||||
#
|
||||
# Compile source name into ASCII module if needed.
|
||||
# As side effect, append the module name to variable MODULES.
|
||||
# Set LINK to "YES" if the module has been compiled.
|
||||
|
||||
make_module()
|
||||
|
||||
{
|
||||
MODULES="${MODULES} ${1}"
|
||||
MODIFSNAME="${LIBIFSNAME}/${1}.MODULE"
|
||||
action_needed "${MODIFSNAME}" "${2}" || return 0;
|
||||
|
||||
# #pragma convert has to be in the source file itself, i.e.
|
||||
# putting it in an include file makes it only active
|
||||
# for that include file.
|
||||
# Thus we build a temporary file with the pragma prepended to
|
||||
# the source file and we compile that themporary file.
|
||||
|
||||
echo "#line 1 \"${2}\"" > __tmpsrcf.c
|
||||
echo "#pragma convert(819)" >> __tmpsrcf.c
|
||||
echo "#line 1" >> __tmpsrcf.c
|
||||
cat "${2}" >> __tmpsrcf.c
|
||||
CMD="CRTCMOD MODULE(${TARGETLIB}/${1}) SRCSTMF('__tmpsrcf.c')"
|
||||
# CMD="${CMD} SYSIFCOPT(*IFS64IO) OPTION(*INCDIRFIRST *SHOWINC *SHOWSYS)"
|
||||
CMD="${CMD} SYSIFCOPT(*IFS64IO) OPTION(*INCDIRFIRST)"
|
||||
CMD="${CMD} LOCALETYPE(*LOCALE)"
|
||||
CMD="${CMD} INCDIR('/qibm/proddata/qadrt/include'"
|
||||
CMD="${CMD} '${TOPDIR}/include/curl' '${TOPDIR}/include'"
|
||||
CMD="${CMD} '${TOPDIR}/packages/OS400' ${INCLUDES})"
|
||||
CMD="${CMD} TGTCCSID(${TGTCCSID}) TGTRLS(${TGTRLS})"
|
||||
CMD="${CMD} OUTPUT(${OUTPUT})"
|
||||
CMD="${CMD} OPTIMIZE(${OPTIMIZE})"
|
||||
CMD="${CMD} DBGVIEW(${DEBUG})"
|
||||
|
||||
if [ "${3}" ]
|
||||
then CMD="${CMD} DEFINE(${3})"
|
||||
fi
|
||||
|
||||
system "${CMD}"
|
||||
rm -f __tmpsrcf.c
|
||||
LINK=YES
|
||||
}
|
||||
|
||||
|
||||
# Determine DB2 object name from IFS name.
|
||||
|
||||
db2_name()
|
||||
|
||||
{
|
||||
basename "${1}" |
|
||||
tr '[a-z]' '[A-Z]' |
|
||||
sed -e 's/\..*//' \
|
||||
-e 's/^\(..........\).*/\1/'
|
||||
}
|
||||
|
||||
|
||||
# Copy IFS file replacing version info.
|
||||
|
||||
versioned_copy()
|
||||
|
||||
{
|
||||
sed -e "s/@LIBCURL_VERSION@/${LIBCURL_VERSION}/g" \
|
||||
-e "s/@LIBCURL_VERSION_MAJOR@/${LIBCURL_VERSION_MAJOR}/g" \
|
||||
-e "s/@LIBCURL_VERSION_MINOR@/${LIBCURL_VERSION_MINOR}/g" \
|
||||
-e "s/@LIBCURL_VERSION_PATCH@/${LIBCURL_VERSION_PATCH}/g" \
|
||||
-e "s/@LIBCURL_VERSION_NUM@/${LIBCURL_VERSION_NUM}/g" \
|
||||
-e "s/@LIBCURL_TIMESTAMP@/${LIBCURL_TIMESTAMP}/g" \
|
||||
< "${1}" > "${2}"
|
||||
}
|
||||
48
packages/OS400/make-include.sh
Normal file
48
packages/OS400/make-include.sh
Normal file
@@ -0,0 +1,48 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Installation of the include files in the OS/400 library.
|
||||
#
|
||||
# $Id$
|
||||
|
||||
SCRIPTDIR=`dirname "${0}"`
|
||||
. "${SCRIPTDIR}/initscript.sh"
|
||||
cd "${TOPDIR}/include"
|
||||
|
||||
|
||||
# Create the OS/400 source program file for the include files.
|
||||
|
||||
SRCPF="${LIBIFSNAME}/H.FILE"
|
||||
|
||||
if action_needed "${SRCPF}"
|
||||
then CMD="CRTSRCPF FILE(${TARGETLIB}/H) RCDLEN(112)"
|
||||
CMD="${CMD} CCSID(${TGTCCSID}) TEXT('curl: Header files')"
|
||||
system "${CMD}"
|
||||
fi
|
||||
|
||||
|
||||
# Enumeration values are used as va_arg tagfields, so they MUST be
|
||||
# integers.
|
||||
|
||||
copy_hfile()
|
||||
|
||||
{
|
||||
sed -e '1i\
|
||||
#pragma enum(int)\
|
||||
' -e '$a\
|
||||
#pragma enum(pop)\
|
||||
' < "${2}" > "${1}"
|
||||
}
|
||||
|
||||
# Copy the header files.
|
||||
|
||||
for HFILE in curl/*.h ${SCRIPTDIR}/ccsidcurl.h
|
||||
do DEST="${SRCPF}/`db2_name \"${HFILE}\"`.MBR"
|
||||
if action_needed "${DEST}" "${HFILE}"
|
||||
then copy_hfile "${DEST}" "${HFILE}"
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
# Copy the ILE/RPG include file, setting-up version number.
|
||||
|
||||
versioned_copy "${SCRIPTDIR}/curl.inc.in" "${SRCPF}/CURL.INC.MBR"
|
||||
207
packages/OS400/make-lib.sh
Normal file
207
packages/OS400/make-lib.sh
Normal file
@@ -0,0 +1,207 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# libcurl compilation script for the OS/400.
|
||||
#
|
||||
# $Id$
|
||||
|
||||
SCRIPTDIR=`dirname "${0}"`
|
||||
. "${SCRIPTDIR}/initscript.sh"
|
||||
cd "${TOPDIR}/lib"
|
||||
|
||||
|
||||
# Create ca-bundle.h file.
|
||||
|
||||
if action_needed "ca-bundle.h"
|
||||
then echo "/* This file is generated automatically */" > ca-bundle.h
|
||||
echo "#ifndef CURL_CA_BUNDLE" >> ca-bundle.h
|
||||
|
||||
if [ "${CABUNDLE}" ]
|
||||
then echo '#define CURL_CA_BUNDLE @CURL_CA_BUNDLE@' >> ca-bundle.h
|
||||
else echo '#undef CURL_CA_BUNDLE /* unknown */' >> ca-bundle.h
|
||||
fi
|
||||
|
||||
echo "#endif" >> ca-bundle.h
|
||||
fi
|
||||
|
||||
|
||||
# Create and compile the identification source file.
|
||||
|
||||
echo '#pragma comment(user, "libcurl version '"${LIBCURL_VERSION}"'")' > os400.c
|
||||
echo '#pragma comment(date)' >> os400.c
|
||||
echo '#pragma comment(copyright, "Copyright (C) 1998-2007 Daniel Stenberg et al. OS/400 version by P. Monnerat")' >> os400.c
|
||||
make_module OS400 os400.c
|
||||
LINK= # No need to rebuild service program yet.
|
||||
MODULES=
|
||||
|
||||
|
||||
# Get source list.
|
||||
|
||||
CSOURCES()
|
||||
|
||||
{
|
||||
shift # Drop the equal sign.
|
||||
CSOURCES="$*" # Get the file names.
|
||||
}
|
||||
|
||||
HHEADERS()
|
||||
|
||||
{
|
||||
shift # Drop the equal sign.
|
||||
HHEADERS="$*" # Get the file names.
|
||||
}
|
||||
|
||||
. Makefile.inc
|
||||
|
||||
|
||||
# Compile the sources into modules.
|
||||
|
||||
INCLUDES="'`pwd`'"
|
||||
|
||||
make_module OS400SYS "${SCRIPTDIR}/os400sys.c"
|
||||
make_module CCSIDCURL "${SCRIPTDIR}/ccsidcurl.c"
|
||||
|
||||
for SRC in ${CSOURCES}
|
||||
do MODULE=`basename "${SRC}" .c |
|
||||
tr '[a-z]' '[A-Z]' |
|
||||
sed -e 's/^\(..........\).*/\1/'`
|
||||
make_module "${MODULE}" "${SRC}"
|
||||
done
|
||||
|
||||
|
||||
# If needed, (re)create the static binding directory.
|
||||
|
||||
if action_needed "${LIBIFSNAME}/${STATBNDDIR}.BNDDIR"
|
||||
then LINK=YES
|
||||
fi
|
||||
|
||||
if [ "${LINK}" ]
|
||||
then rm -rf "${LIBIFSNAME}/${STATBNDDIR}.BNDDIR"
|
||||
CMD="CRTBNDDIR BNDDIR(${TARGETLIB}/${STATBNDDIR})"
|
||||
CMD="${CMD} TEXT('LibCurl API static binding directory')"
|
||||
system "${CMD}"
|
||||
|
||||
for MODULE in ${MODULES}
|
||||
do CMD="ADDBNDDIRE BNDDIR(${TARGETLIB}/${STATBNDDIR})"
|
||||
CMD="${CMD} OBJ((${TARGETLIB}/${MODULE} *MODULE))"
|
||||
system "${CMD}"
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# The exportation file for service program creation must be in a DB2
|
||||
# source file, so make sure it exists.
|
||||
|
||||
if action_needed "${LIBIFSNAME}/TOOLS.FILE"
|
||||
then CMD="CRTSRCPF FILE(${TARGETLIB}/TOOLS) RCDLEN(112)"
|
||||
CMD="${CMD} TEXT('curl: build tools')"
|
||||
system "${CMD}"
|
||||
fi
|
||||
|
||||
|
||||
# Gather the list of symbols to export.
|
||||
|
||||
EXPORTS=`grep '^CURL_EXTERN[ ]' \
|
||||
"${TOPDIR}"/include/curl/*.h \
|
||||
"${SCRIPTDIR}/ccsidcurl.h" |
|
||||
sed -e 's/^.*CURL_EXTERN[ ]\(.*\)(.*$/\1/' \
|
||||
-e 's/[ ]*$//' \
|
||||
-e 's/^.*[ ][ ]*//' \
|
||||
-e 's/^\*//' \
|
||||
-e 's/(\(.*\))/\1/'`
|
||||
|
||||
# Create the service program exportation file in DB2 member if needed.
|
||||
|
||||
BSF="${LIBIFSNAME}/TOOLS.FILE/BNDSRC.MBR"
|
||||
|
||||
if action_needed "${BSF}"
|
||||
then LINK=YES
|
||||
fi
|
||||
|
||||
if [ "${LINK}" ]
|
||||
then echo " STRPGMEXP PGMLVL(*CURRENT) SIGNATURE('LIBCURL')" > "${BSF}"
|
||||
for EXPORT in ${EXPORTS}
|
||||
do echo ' EXPORT SYMBOL("'"${EXPORT}"'")' >> "${BSF}"
|
||||
done
|
||||
|
||||
echo ' ENDPGMEXP' >> "${BSF}"
|
||||
fi
|
||||
|
||||
|
||||
# Build the service program if needed.
|
||||
|
||||
if action_needed "${LIBIFSNAME}/${SRVPGM}.SRVPGM"
|
||||
then LINK=YES
|
||||
fi
|
||||
|
||||
if [ "${LINK}" ]
|
||||
then CMD="CRTSRVPGM SRVPGM(${TARGETLIB}/${SRVPGM})"
|
||||
CMD="${CMD} SRCFILE(${TARGETLIB}/TOOLS) SRCMBR(BNDSRC)"
|
||||
CMD="${CMD} MODULE(${TARGETLIB}/OS400)"
|
||||
CMD="${CMD} BNDDIR(${TARGETLIB}/${STATBNDDIR})"
|
||||
CMD="${CMD} BNDSRVPGM(QADRTTS)"
|
||||
CMD="${CMD} TEXT('curl API library')"
|
||||
CMD="${CMD} TGTRLS(${TGTRLS})"
|
||||
system "${CMD}"
|
||||
LINK=YES
|
||||
fi
|
||||
|
||||
|
||||
# If needed, (re)create the dynamic binding directory.
|
||||
|
||||
if action_needed "${LIBIFSNAME}/${DYNBNDDIR}.BNDDIR"
|
||||
then LINK=YES
|
||||
fi
|
||||
|
||||
if [ "${LINK}" ]
|
||||
then rm -rf "${LIBIFSNAME}/${DYNBNDDIR}.BNDDIR"
|
||||
CMD="CRTBNDDIR BNDDIR(${TARGETLIB}/${DYNBNDDIR})"
|
||||
CMD="${CMD} TEXT('LibCurl API dynamic binding directory')"
|
||||
system "${CMD}"
|
||||
CMD="ADDBNDDIRE BNDDIR(${TARGETLIB}/${DYNBNDDIR})"
|
||||
CMD="${CMD} OBJ((*LIBL/${SRVPGM} *SRVPGM))"
|
||||
system "${CMD}"
|
||||
fi
|
||||
|
||||
|
||||
# Rebuild the formdata test if needed.
|
||||
|
||||
if [ "${TEST_FORMDATA}" ]
|
||||
then MODULES=
|
||||
make_module TFORMDATA formdata.c "'_FORM_DEBUG' 'CURLDEBUG'"
|
||||
make_module TSTREQUAL strequal.c "'_FORM_DEBUG' 'CURLDEBUG'"
|
||||
make_module TMEMDEBUG memdebug.c "'_FORM_DEBUG' 'CURLDEBUG'"
|
||||
make_module TMPRINTF mprintf.c "'_FORM_DEBUG' 'CURLDEBUG'"
|
||||
make_module TSTRERROR strerror.c "'_FORM_DEBUG' 'CURLDEBUG'"
|
||||
# The following modules should not be needed (see comment in
|
||||
# formdata.c. However, there are some unsatisfied
|
||||
# external references leading in the following
|
||||
# modules to be (recursively) needed.
|
||||
MODULES="${MODULES} EASY STRDUP SSLGEN QSSL HOSTIP HOSTIP4 HOSTIP6"
|
||||
MODULES="${MODULES} URL HASH TRANSFER GETINFO COOKIE SENDF SELECT"
|
||||
MODULES="${MODULES} INET_NTOP SHARE HOSTTHRE MULTI LLIST FTP HTTP"
|
||||
MODULES="${MODULES} HTTP_DIGES HTTP_CHUNK HTTP_NEGOT TIMEVAL HOSTSYN"
|
||||
MODULES="${MODULES} CONNECT SOCKS PROGRESS ESCAPE INET_PTON GETENV"
|
||||
MODULES="${MODULES} DICT LDAP TELNET FILE TFTP NETRC PARSEDATE"
|
||||
MODULES="${MODULES} SPEEDCHECK SPLAY BASE64 SECURITY IF2IP MD5"
|
||||
MODULES="${MODULES} KRB5 OS400SYS"
|
||||
|
||||
PGMIFSNAME="${LIBIFSNAME}/TFORMDATA.PGM"
|
||||
|
||||
if action_needed "${PGMIFSNAME}"
|
||||
then LINK=YES
|
||||
fi
|
||||
|
||||
if [ "${LINK}" ]
|
||||
then CMD="CRTPGM PGM(${TARGETLIB}/TFORMDATA)"
|
||||
CMD="${CMD} ENTMOD(QADRT/QADRTMAIN2)"
|
||||
CMD="${CMD} MODULE("
|
||||
|
||||
for MODULE in ${MODULES}
|
||||
do CMD="${CMD} ${TARGETLIB}/${MODULE}"
|
||||
done
|
||||
|
||||
CMD="${CMD} ) BNDSRVPGM(QADRTTS)"
|
||||
CMD="${CMD} TGTRLS(${TGTRLS})"
|
||||
system "${CMD}"
|
||||
fi
|
||||
fi
|
||||
5
packages/OS400/make-src.sh
Normal file
5
packages/OS400/make-src.sh
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
# Not implemented yet on OS/400.
|
||||
102
packages/OS400/make-tests.sh
Normal file
102
packages/OS400/make-tests.sh
Normal file
@@ -0,0 +1,102 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# tests compilation script for the OS/400.
|
||||
#
|
||||
# $Id$
|
||||
|
||||
|
||||
SCRIPTDIR=`dirname "${0}"`
|
||||
. "${SCRIPTDIR}/initscript.sh"
|
||||
cd "${TOPDIR}/tests"
|
||||
|
||||
|
||||
# tests directory not implemented yet.
|
||||
|
||||
|
||||
# Process the libtest subdirectory.
|
||||
|
||||
cd libtest
|
||||
|
||||
# Get definitions from the Makefile.am file.
|
||||
# The `sed' statement works as follows:
|
||||
# _ Join \nl-separated lines.
|
||||
# _ Retain only lines that begins with "identifier =".
|
||||
# _ Turn these lines into shell variable assignments.
|
||||
|
||||
eval "`sed -e ': begin' \
|
||||
-e '/\\\\$/{' \
|
||||
-e 'N' \
|
||||
-e 's/\\\\\\n/ /' \
|
||||
-e 'b begin' \
|
||||
-e '}' \
|
||||
-e '/^[A-Za-z_][A-Za-z0-9_]*[ ]*[=]/b keep' \
|
||||
-e 'd' \
|
||||
-e ': keep' \
|
||||
-e 's/[ ]*=[ ]*/=/' \
|
||||
-e 's/=\\(.*[^ ]\\)[ ]*$/=\\"\\1\\"/' \
|
||||
-e 's/\\$(\\([^)]*\\))/${\\1}/g' \
|
||||
< Makefile.am`"
|
||||
|
||||
# Compile all programs.
|
||||
# The list is found in variable "noinst_PROGRAMS"
|
||||
|
||||
INCLUDES="'${TOPDIR}/tests/libtest' '${TOPDIR}/lib'"
|
||||
|
||||
for PGM in ${noinst_PROGRAMS}
|
||||
do DB2PGM=`db2_name "${PGM}"`
|
||||
PGMIFSNAME="${LIBIFSNAME}/${DB2PGM}.PGM"
|
||||
|
||||
# Extract preprocessor symbol definitions from compilation
|
||||
# options for the program.
|
||||
|
||||
PGMCFLAGS="`eval echo \"\\${${PGM}_CFLAGS}\"`"
|
||||
PGMDEFINES=
|
||||
|
||||
for FLAG in ${PGMCFLAGS}
|
||||
do case "${FLAG}" in
|
||||
-D?*) DEFINE="`echo \"${FLAG}\" | sed 's/^..//'`"
|
||||
PGMDEFINES="${PGMDEFINES} '${DEFINE}'"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Compile all C sources for the program into modules.
|
||||
|
||||
PGMSOURCES="`eval echo \"\\${${PGM}_SOURCES}\"`"
|
||||
LINK=
|
||||
MODULES=
|
||||
|
||||
for SOURCE in ${PGMSOURCES}
|
||||
do case "${SOURCE}" in
|
||||
*.c) # Special processing for libxxx.c files: their
|
||||
# module name is determined by the target
|
||||
# PROGRAM name.
|
||||
|
||||
case "${SOURCE}" in
|
||||
lib*.c) MODULE="${DB2PGM}"
|
||||
;;
|
||||
*) MODULE=`db2_name "${SOURCE}"`
|
||||
;;
|
||||
esac
|
||||
|
||||
make_module "${MODULE}" "${SOURCE}" "${PGMDEFINES}"
|
||||
if action_needed "${PGMIFSNAME}" "${MODIFSNAME}"
|
||||
then LINK=yes
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Link program if needed.
|
||||
|
||||
if [ "${LINK}" ]
|
||||
then MODULES="`echo \"${MODULES}\" |
|
||||
sed \"s/[^ ][^ ]*/${TARGETLIB}\/&/g\"`"
|
||||
CMD="CRTPGM PGM(${TARGETLIB}/${DB2PGM})"
|
||||
CMD="${CMD} ENTMOD(QADRT/QADRTMAIN2)"
|
||||
CMD="${CMD} MODULE(${MODULES})"
|
||||
CMD="${CMD} BNDSRVPGM(${TARGETLIB}/${SRVPGM} QADRTTS)"
|
||||
CMD="${CMD} TGTRLS(${TGTRLS})"
|
||||
system "${CMD}"
|
||||
fi
|
||||
done
|
||||
53
packages/OS400/makefile.sh
Normal file
53
packages/OS400/makefile.sh
Normal file
@@ -0,0 +1,53 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# curl compilation script for the OS/400.
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
# This is a shell script since make is not a standard component of OS/400.
|
||||
|
||||
SCRIPTDIR=`dirname "${0}"`
|
||||
. "${SCRIPTDIR}/initscript.sh"
|
||||
cd "${TOPDIR}"
|
||||
|
||||
|
||||
# Create the OS/400 library if it does not exist.
|
||||
|
||||
if action_needed "${LIBIFSNAME}"
|
||||
then CMD="CRTLIB LIB(${TARGETLIB}) TEXT('curl: multiprotocol support API')"
|
||||
system "${CMD}"
|
||||
fi
|
||||
|
||||
|
||||
# Create the DOCS source file if it does not exist.
|
||||
|
||||
if action_needed "${LIBIFSNAME}/DOCS.FILE"
|
||||
then CMD="CRTSRCPF FILE(${TARGETLIB}/DOCS) RCDLEN(112)"
|
||||
CMD="${CMD} CCSID(${TGTCCSID}) TEXT('Documentation texts')"
|
||||
system "${CMD}"
|
||||
fi
|
||||
|
||||
|
||||
# Copy some documentation files if needed.
|
||||
|
||||
for TEXT in "${TOPDIR}/COPYING" "${SCRIPTDIR}/README.OS400" \
|
||||
"${TOPDIR}/CHANGES" "${TOPDIR}/docs/THANKS" "${TOPDIR}/docs/FAQ" \
|
||||
"${TOPDIR}/docs/FEATURES" "${TOPDIR}/docs/SSLCERTS" \
|
||||
"${TOPDIR}/docs/RESOURCES" "${TOPDIR}/docs/VERSIONS" \
|
||||
"${TOPDIR}/docs/HISTORY"
|
||||
do MEMBER="`basename \"${TEXT}\" .OS400`"
|
||||
MEMBER="${LIBIFSNAME}/DOCS.FILE/`db2_name \"${MEMBER}\"`.MBR"
|
||||
|
||||
if action_needed "${MEMBER}" "${TEXT}"
|
||||
then CMD="CPY OBJ('${TEXT}') TOOBJ('${MEMBER}') TOCCSID(${TGTCCSID})"
|
||||
CMD="${CMD} DTAFMT(*TEXT) REPLACE(*YES)"
|
||||
system "${CMD}"
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
# Build in each directory.
|
||||
|
||||
for SUBDIR in include lib src tests
|
||||
do "${SCRIPTDIR}/make-${SUBDIR}.sh"
|
||||
done
|
||||
967
packages/OS400/os400sys.c
Normal file
967
packages/OS400/os400sys.c
Normal file
@@ -0,0 +1,967 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2007, 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.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/* OS/400 additional support. */
|
||||
|
||||
#include "config-os400.h" /* Not setup.h: we only need some defines. */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <pthread.h>
|
||||
#include <netdb.h>
|
||||
#include <qadrt.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef USE_QSOSSL
|
||||
#include <qsossl.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_GSSAPI
|
||||
#include <gssapi.h>
|
||||
#endif
|
||||
|
||||
#ifndef CURL_DISABLE_LDAP
|
||||
#include <ldap.h>
|
||||
#endif
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include "os400sys.h"
|
||||
|
||||
|
||||
/**
|
||||
*** QADRT OS/400 ASCII runtime defines only the most used procedures, but
|
||||
*** but a lot of them are not supported. This module implements
|
||||
*** ASCII wrappers for those that are used by libcurl, but not
|
||||
*** defined by QADRT.
|
||||
**/
|
||||
|
||||
#pragma convert(0) /* Restore EBCDIC. */
|
||||
|
||||
|
||||
#define MIN_BYTE_GAIN 1024 /* Minimum gain when shortening a buffer. */
|
||||
|
||||
typedef struct {
|
||||
unsigned long size; /* Buffer size. */
|
||||
char * buf; /* Buffer address. */
|
||||
} buffer_t;
|
||||
|
||||
|
||||
static char * buffer_undef(localkey_t key, long size);
|
||||
static char * buffer_threaded(localkey_t key, long size);
|
||||
static char * buffer_unthreaded(localkey_t key, long size);
|
||||
|
||||
static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
static pthread_key_t thdkey;
|
||||
static buffer_t * locbufs;
|
||||
|
||||
char * (* Curl_thread_buffer)(localkey_t key, long size) = buffer_undef;
|
||||
|
||||
|
||||
static void
|
||||
thdbufdestroy(void * private)
|
||||
|
||||
{
|
||||
localkey_t i;
|
||||
buffer_t * p;
|
||||
|
||||
if (private) {
|
||||
p = (buffer_t *) private;
|
||||
|
||||
for (i = (localkey_t) 0; i < LK_LAST; i++) {
|
||||
if (p->buf)
|
||||
free(p->buf);
|
||||
|
||||
p++;
|
||||
}
|
||||
|
||||
free(private);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
terminate(void)
|
||||
|
||||
{
|
||||
if (Curl_thread_buffer == buffer_threaded) {
|
||||
locbufs = pthread_getspecific(thdkey);
|
||||
pthread_setspecific(thdkey, (void *) NULL);
|
||||
pthread_key_delete(thdkey);
|
||||
}
|
||||
|
||||
if (Curl_thread_buffer != buffer_undef) {
|
||||
thdbufdestroy((void *) locbufs);
|
||||
locbufs = (buffer_t *) NULL;
|
||||
}
|
||||
|
||||
Curl_thread_buffer = buffer_undef;
|
||||
}
|
||||
|
||||
|
||||
static char *
|
||||
get_buffer(buffer_t * buf, long size)
|
||||
|
||||
{
|
||||
char * cp;
|
||||
|
||||
/* If `size' >= 0, make sure buffer at `buf' is at least `size'-byte long.
|
||||
Return the buffer address. */
|
||||
|
||||
if (size < 0)
|
||||
return buf->buf;
|
||||
|
||||
if (!buf->buf) {
|
||||
if ((buf->buf = malloc(size)))
|
||||
buf->size = size;
|
||||
|
||||
return buf->buf;
|
||||
}
|
||||
|
||||
if ((unsigned long) size <= buf->size) {
|
||||
/* Shorten the buffer only if it frees a significant byte count. This
|
||||
avoids some realloc() overhead. */
|
||||
|
||||
if (buf->size - size < MIN_BYTE_GAIN)
|
||||
return buf->buf;
|
||||
}
|
||||
|
||||
/* Resize the buffer. */
|
||||
|
||||
if ((cp = realloc(buf->buf, size))) {
|
||||
buf->buf = cp;
|
||||
buf->size = size;
|
||||
}
|
||||
else if (size <= buf->size)
|
||||
cp = buf->buf;
|
||||
|
||||
return cp;
|
||||
}
|
||||
|
||||
|
||||
static char *
|
||||
buffer_unthreaded(localkey_t key, long size)
|
||||
|
||||
{
|
||||
return get_buffer(locbufs + key, size);
|
||||
}
|
||||
|
||||
|
||||
static char *
|
||||
buffer_threaded(localkey_t key, long size)
|
||||
|
||||
{
|
||||
buffer_t * bufs;
|
||||
|
||||
/* Get the buffer for the given local key in the current thread, and
|
||||
make sure it is at least `size'-byte long. Set `size' to < 0 to get
|
||||
its address only. */
|
||||
|
||||
bufs = (buffer_t *) pthread_getspecific(thdkey);
|
||||
|
||||
if (!bufs) {
|
||||
if (size < 0)
|
||||
return (char *) NULL; /* No buffer yet. */
|
||||
|
||||
/* Allocate buffer descriptors for the current thread. */
|
||||
|
||||
if (!(bufs = (buffer_t *) calloc((size_t) LK_LAST, sizeof *bufs)))
|
||||
return (char *) NULL;
|
||||
|
||||
if (pthread_setspecific(thdkey, (void *) bufs)) {
|
||||
free(bufs);
|
||||
return (char *) NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return get_buffer(bufs + key, size);
|
||||
}
|
||||
|
||||
|
||||
static char *
|
||||
buffer_undef(localkey_t key, long size)
|
||||
|
||||
{
|
||||
/* Define the buffer system, get the buffer for the given local key in
|
||||
the current thread, and make sure it is at least `size'-byte long.
|
||||
Set `size' to < 0 to get its address only. */
|
||||
|
||||
pthread_mutex_lock(&mutex);
|
||||
|
||||
/* Determine if we can use pthread-specific data. */
|
||||
|
||||
if (Curl_thread_buffer == buffer_undef) { /* If unchanged during lock. */
|
||||
if (!pthread_key_create(&thdkey, thdbufdestroy))
|
||||
Curl_thread_buffer = buffer_threaded;
|
||||
else if (!(locbufs = (buffer_t *) calloc((size_t) LK_LAST,
|
||||
sizeof *locbufs))) {
|
||||
pthread_mutex_unlock(&mutex);
|
||||
return (char *) NULL;
|
||||
}
|
||||
else
|
||||
Curl_thread_buffer = buffer_unthreaded;
|
||||
|
||||
atexit(terminate);
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&mutex);
|
||||
return Curl_thread_buffer(key, size);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
Curl_getnameinfo_a(const struct sockaddr * sa, socklen_t salen,
|
||||
char * nodename, socklen_t nodenamelen,
|
||||
char * servname, socklen_t servnamelen,
|
||||
int flags)
|
||||
|
||||
{
|
||||
char * enodename;
|
||||
char * eservname;
|
||||
int status;
|
||||
int i;
|
||||
|
||||
enodename = (char *) NULL;
|
||||
eservname = (char *) NULL;
|
||||
|
||||
if (nodename && nodenamelen)
|
||||
if (!(enodename = malloc(nodenamelen)))
|
||||
return EAI_MEMORY;
|
||||
|
||||
if (servname && servnamelen)
|
||||
if (!(eservname = malloc(servnamelen))) {
|
||||
if (enodename)
|
||||
free(enodename);
|
||||
|
||||
return EAI_MEMORY;
|
||||
}
|
||||
|
||||
status = getnameinfo(sa, salen, enodename, nodenamelen,
|
||||
eservname, servnamelen, flags);
|
||||
|
||||
if (!status) {
|
||||
if (enodename) {
|
||||
i = QadrtConvertE2A(nodename, enodename,
|
||||
nodenamelen - 1, strlen(enodename));
|
||||
nodename[i] = '\0';
|
||||
}
|
||||
|
||||
if (eservname) {
|
||||
i = QadrtConvertE2A(servname, eservname,
|
||||
servnamelen - 1, strlen(eservname));
|
||||
servname[i] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
if (enodename)
|
||||
free(enodename);
|
||||
|
||||
if (eservname)
|
||||
free(eservname);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
Curl_getaddrinfo_a(const char * nodename, const char * servname,
|
||||
const struct addrinfo * hints,
|
||||
struct addrinfo * * res)
|
||||
|
||||
{
|
||||
char * enodename;
|
||||
char * eservname;
|
||||
int status;
|
||||
int i;
|
||||
|
||||
enodename = (char *) NULL;
|
||||
eservname = (char *) NULL;
|
||||
|
||||
if (nodename) {
|
||||
i = strlen(nodename);
|
||||
|
||||
if (!(enodename = malloc(i + 1)))
|
||||
return EAI_MEMORY;
|
||||
|
||||
i = QadrtConvertA2E(enodename, nodename, i, i);
|
||||
enodename[i] = '\0';
|
||||
}
|
||||
|
||||
if (servname) {
|
||||
i = strlen(servname);
|
||||
|
||||
if (!(eservname = malloc(i + 1))) {
|
||||
if (enodename)
|
||||
free(enodename);
|
||||
|
||||
return EAI_MEMORY;
|
||||
}
|
||||
|
||||
QadrtConvertA2E(eservname, servname, i, i);
|
||||
eservname[i] = '\0';
|
||||
}
|
||||
|
||||
status = getaddrinfo(enodename, eservname, hints, res);
|
||||
|
||||
if (enodename)
|
||||
free(enodename);
|
||||
|
||||
if (eservname)
|
||||
free(eservname);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
Curl_inet_ntoa_r_a(struct in_addr internet_address,
|
||||
char * output_buffer, int output_buffer_length)
|
||||
|
||||
{
|
||||
int rc;
|
||||
int i;
|
||||
char * cp;
|
||||
|
||||
if (!output_buffer || output_buffer_length < 16)
|
||||
return inet_ntoa_r(internet_address, output_buffer, output_buffer_length);
|
||||
|
||||
if (!(cp = malloc(output_buffer_length + 1)))
|
||||
return -1;
|
||||
|
||||
rc = inet_ntoa_r(internet_address, cp, output_buffer_length);
|
||||
|
||||
if (rc) {
|
||||
free(cp);
|
||||
return rc;
|
||||
}
|
||||
|
||||
cp[output_buffer_length - 1] = '\0';
|
||||
i = strlen(cp);
|
||||
QadrtConvertE2A(output_buffer, cp, i, i);
|
||||
output_buffer[i] = '\0';
|
||||
free(cp);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
#ifdef USE_QSOSSL
|
||||
|
||||
/* ASCII wrappers for the SSL procedures. */
|
||||
|
||||
int
|
||||
Curl_SSL_Init_Application_a(SSLInitApp * init_app)
|
||||
|
||||
{
|
||||
int rc;
|
||||
unsigned int i;
|
||||
SSLInitApp ia;
|
||||
|
||||
if (!init_app || !init_app->applicationID || !init_app->applicationIDLen)
|
||||
return SSL_Init_Application(init_app);
|
||||
|
||||
memcpy((char *) &ia, (char *) init_app, sizeof ia);
|
||||
i = ia.applicationIDLen;
|
||||
|
||||
if (!(ia.applicationID = malloc(i + 1))) {
|
||||
errno = ENOMEM;
|
||||
return SSL_ERROR_IO;
|
||||
}
|
||||
|
||||
QadrtConvertA2E(ia.applicationID, init_app->applicationID, i, i);
|
||||
ia.applicationID[i] = '\0';
|
||||
rc = SSL_Init_Application(&ia);
|
||||
free(ia.applicationID);
|
||||
init_app->localCertificateLen = ia.localCertificateLen;
|
||||
init_app->sessionType = ia.sessionType;
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
Curl_SSL_Init_a(SSLInit * init)
|
||||
|
||||
{
|
||||
int rc;
|
||||
unsigned int i;
|
||||
SSLInit ia;
|
||||
|
||||
if (!init || (!init->keyringFileName && !init->keyringPassword))
|
||||
return SSL_Init(init);
|
||||
|
||||
memcpy((char *) &ia, (char *) init, sizeof ia);
|
||||
|
||||
if (ia.keyringFileName) {
|
||||
i = strlen(ia.keyringFileName);
|
||||
|
||||
if (!(ia.keyringFileName = malloc(i + 1))) {
|
||||
errno = ENOMEM;
|
||||
return SSL_ERROR_IO;
|
||||
}
|
||||
|
||||
QadrtConvertA2E(ia.keyringFileName, init->keyringFileName, i, i);
|
||||
ia.keyringFileName[i] = '\0';
|
||||
}
|
||||
|
||||
if (ia.keyringPassword) {
|
||||
i = strlen(ia.keyringPassword);
|
||||
|
||||
if (!(ia.keyringPassword = malloc(i + 1))) {
|
||||
if (ia.keyringFileName)
|
||||
free(ia.keyringFileName);
|
||||
|
||||
errno = ENOMEM;
|
||||
return SSL_ERROR_IO;
|
||||
}
|
||||
|
||||
QadrtConvertA2E(ia.keyringPassword, init->keyringPassword, i, i);
|
||||
ia.keyringPassword[i] = '\0';
|
||||
}
|
||||
|
||||
rc = SSL_Init(&ia);
|
||||
|
||||
if (ia.keyringFileName)
|
||||
free(ia.keyringFileName);
|
||||
|
||||
if (ia.keyringPassword)
|
||||
free(ia.keyringPassword);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
Curl_SSL_Strerror_a(int sslreturnvalue, SSLErrorMsg * serrmsgp)
|
||||
|
||||
{
|
||||
int i;
|
||||
char * cp;
|
||||
char * cp2;
|
||||
|
||||
cp = SSL_Strerror(sslreturnvalue, serrmsgp);
|
||||
|
||||
if (!cp)
|
||||
return cp;
|
||||
|
||||
i = strlen(cp);
|
||||
|
||||
if (!(cp2 = Curl_thread_buffer(LK_SSL_ERROR, MAX_CONV_EXPANSION * i + 1)))
|
||||
return cp2;
|
||||
|
||||
i = QadrtConvertE2A(cp2, cp, MAX_CONV_EXPANSION * i, i);
|
||||
cp2[i] = '\0';
|
||||
return cp2;
|
||||
}
|
||||
|
||||
#endif /* USE_QSOSSL */
|
||||
|
||||
|
||||
#ifdef HAVE_GSSAPI
|
||||
|
||||
/* ASCII wrappers for the GSSAPI procedures. */
|
||||
|
||||
static int
|
||||
Curl_gss_convert_in_place(OM_uint32 * minor_status, gss_buffer_t buf)
|
||||
|
||||
{
|
||||
unsigned int i;
|
||||
char * t;
|
||||
|
||||
/* Convert `buf' in place, from EBCDIC to ASCII.
|
||||
If error, release the buffer and return -1. Else return 0. */
|
||||
|
||||
i = buf->length;
|
||||
|
||||
if (i) {
|
||||
if (!(t = malloc(i))) {
|
||||
gss_release_buffer(minor_status, buf);
|
||||
|
||||
if (minor_status)
|
||||
*minor_status = ENOMEM;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
QadrtConvertE2A(t, buf->value, i, i);
|
||||
memcpy(buf->value, t, i);
|
||||
free(t);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
OM_uint32
|
||||
Curl_gss_import_name_a(OM_uint32 * minor_status, gss_buffer_t in_name,
|
||||
gss_OID in_name_type, gss_name_t * out_name)
|
||||
|
||||
{
|
||||
int rc;
|
||||
unsigned int i;
|
||||
gss_buffer_desc in;
|
||||
|
||||
if (!in_name || !in_name->value || !in_name->length)
|
||||
return gss_import_name(minor_status, in_name, in_name_type, out_name);
|
||||
|
||||
memcpy((char *) &in, (char *) in_name, sizeof in);
|
||||
i = in.length;
|
||||
|
||||
if (!(in.value = malloc(i + 1))) {
|
||||
if (minor_status)
|
||||
*minor_status = ENOMEM;
|
||||
|
||||
return GSS_S_FAILURE;
|
||||
}
|
||||
|
||||
QadrtConvertA2E(in.value, in_name->value, i, i);
|
||||
((char *) in.value)[i] = '\0';
|
||||
rc = gss_import_name(minor_status, &in, in_name_type, out_name);
|
||||
free(in.value);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
OM_uint32
|
||||
Curl_gss_display_status_a(OM_uint32 * minor_status, OM_uint32 status_value,
|
||||
int status_type, gss_OID mech_type,
|
||||
gss_msg_ctx_t * message_context, gss_buffer_t status_string)
|
||||
|
||||
{
|
||||
int rc;
|
||||
|
||||
rc = gss_display_status(minor_status, status_value, status_type,
|
||||
mech_type, message_context, status_string);
|
||||
|
||||
if (rc != GSS_S_COMPLETE || !status_string ||
|
||||
!status_string->length || !status_string->value)
|
||||
return rc;
|
||||
|
||||
/* No way to allocate a buffer here, because it will be released by
|
||||
gss_release_buffer(). The solution is to overwrite the EBCDIC buffer
|
||||
with ASCII to return it. */
|
||||
|
||||
if (Curl_gss_convert_in_place(minor_status, status_string))
|
||||
return GSS_S_FAILURE;
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
OM_uint32
|
||||
Curl_gss_init_sec_context_a(OM_uint32 * minor_status, gss_cred_id_t cred_handle,
|
||||
gss_ctx_id_t * context_handle,
|
||||
gss_name_t target_name, gss_OID mech_type,
|
||||
gss_flags_t req_flags, OM_uint32 time_req,
|
||||
gss_channel_bindings_t input_chan_bindings,
|
||||
gss_buffer_t input_token,
|
||||
gss_OID * actual_mech_type,
|
||||
gss_buffer_t output_token, gss_flags_t * ret_flags,
|
||||
OM_uint32 * time_rec)
|
||||
|
||||
{
|
||||
int rc;
|
||||
unsigned int i;
|
||||
gss_buffer_desc in;
|
||||
gss_buffer_t inp;
|
||||
|
||||
in.value = NULL;
|
||||
|
||||
if ((inp = input_token))
|
||||
if (inp->length && inp->value) {
|
||||
i = inp->length;
|
||||
|
||||
if (!(in.value = malloc(i + 1))) {
|
||||
if (minor_status)
|
||||
*minor_status = ENOMEM;
|
||||
|
||||
return GSS_S_FAILURE;
|
||||
}
|
||||
|
||||
QadrtConvertA2E(in.value, input_token->value, i, i);
|
||||
((char *) in.value)[i] = '\0';
|
||||
in.length = i;
|
||||
inp = ∈
|
||||
}
|
||||
|
||||
rc = gss_init_sec_context(minor_status, cred_handle, context_handle,
|
||||
target_name, mech_type, req_flags, time_req,
|
||||
input_chan_bindings, inp, actual_mech_type,
|
||||
output_token, ret_flags, time_rec);
|
||||
|
||||
if (in.value)
|
||||
free(in.value);
|
||||
|
||||
if (rc != GSS_S_COMPLETE || !output_token ||
|
||||
!output_token->length || !output_token->value)
|
||||
return rc;
|
||||
|
||||
/* No way to allocate a buffer here, because it will be released by
|
||||
gss_release_buffer(). The solution is to overwrite the EBCDIC buffer
|
||||
with ASCII to return it. */
|
||||
|
||||
if (Curl_gss_convert_in_place(minor_status, output_token))
|
||||
return GSS_S_FAILURE;
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
OM_uint32
|
||||
Curl_gss_delete_sec_context_a(OM_uint32 * minor_status,
|
||||
gss_ctx_id_t * context_handle,
|
||||
gss_buffer_t output_token)
|
||||
|
||||
{
|
||||
int rc;
|
||||
|
||||
rc = gss_delete_sec_context(minor_status, context_handle, output_token);
|
||||
|
||||
if (rc != GSS_S_COMPLETE || !output_token ||
|
||||
!output_token->length || !output_token->value)
|
||||
return rc;
|
||||
|
||||
/* No way to allocate a buffer here, because it will be released by
|
||||
gss_release_buffer(). The solution is to overwrite the EBCDIC buffer
|
||||
with ASCII to return it. */
|
||||
|
||||
if (Curl_gss_convert_in_place(minor_status, output_token))
|
||||
return GSS_S_FAILURE;
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
#endif /* HAVE_GSSAPI */
|
||||
|
||||
|
||||
#ifndef CURL_DISABLE_LDAP
|
||||
|
||||
/* ASCII wrappers for the LDAP procedures. */
|
||||
|
||||
void *
|
||||
Curl_ldap_init_a(char * host, int port)
|
||||
|
||||
{
|
||||
unsigned int i;
|
||||
char * ehost;
|
||||
void * result;
|
||||
|
||||
if (!host)
|
||||
return (void *) ldap_init(host, port);
|
||||
|
||||
i = strlen(host);
|
||||
|
||||
if (!(ehost = malloc(i + 1)))
|
||||
return (void *) NULL;
|
||||
|
||||
QadrtConvertA2E(ehost, host, i, i);
|
||||
ehost[i] = '\0';
|
||||
result = (void *) ldap_init(ehost, port);
|
||||
free(ehost);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
Curl_ldap_simple_bind_s_a(void * ld, char * dn, char * passwd)
|
||||
|
||||
{
|
||||
int i;
|
||||
char * edn;
|
||||
char * epasswd;
|
||||
|
||||
edn = (char *) NULL;
|
||||
epasswd = (char *) NULL;
|
||||
|
||||
if (dn) {
|
||||
i = strlen(dn);
|
||||
|
||||
if (!(edn = malloc(i + 1)))
|
||||
return LDAP_NO_MEMORY;
|
||||
|
||||
QadrtConvertA2E(edn, dn, i, i);
|
||||
edn[i] = '\0';
|
||||
}
|
||||
|
||||
if (passwd) {
|
||||
i = strlen(passwd);
|
||||
|
||||
if (!(epasswd = malloc(i + 1))) {
|
||||
if (edn)
|
||||
free(edn);
|
||||
|
||||
return LDAP_NO_MEMORY;
|
||||
}
|
||||
|
||||
QadrtConvertA2E(epasswd, passwd, i, i);
|
||||
epasswd[i] = '\0';
|
||||
}
|
||||
|
||||
i = ldap_simple_bind_s(ld, edn, epasswd);
|
||||
|
||||
if (epasswd)
|
||||
free(epasswd);
|
||||
|
||||
if (edn)
|
||||
free(edn);
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
Curl_ldap_search_s_a(void * ld, char * base, int scope, char * filter,
|
||||
char * * attrs, int attrsonly, LDAPMessage * * res)
|
||||
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
char * ebase;
|
||||
char * efilter;
|
||||
char * * eattrs;
|
||||
int status;
|
||||
|
||||
ebase = (char *) NULL;
|
||||
efilter = (char *) NULL;
|
||||
eattrs = (char * *) NULL;
|
||||
status = LDAP_SUCCESS;
|
||||
|
||||
if (base) {
|
||||
i = strlen(base);
|
||||
|
||||
if (!(ebase = malloc(i + 1)))
|
||||
status = LDAP_NO_MEMORY;
|
||||
else {
|
||||
QadrtConvertA2E(ebase, base, i, i);
|
||||
ebase[i] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
if (filter && status == LDAP_SUCCESS) {
|
||||
i = strlen(filter);
|
||||
|
||||
if (!(efilter = malloc(i + 1)))
|
||||
status = LDAP_NO_MEMORY;
|
||||
else {
|
||||
QadrtConvertA2E(efilter, filter, i, i);
|
||||
efilter[i] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
if (attrs && status == LDAP_SUCCESS) {
|
||||
for (i = 0; attrs[i++];)
|
||||
;
|
||||
|
||||
if (!(eattrs = (char * *) calloc(i, sizeof *eattrs)))
|
||||
status = LDAP_NO_MEMORY;
|
||||
else {
|
||||
for (j = 0; attrs[j]; j++) {
|
||||
i = strlen(attrs[j]);
|
||||
|
||||
if (!(eattrs[j] = malloc(i + 1))) {
|
||||
status = LDAP_NO_MEMORY;
|
||||
break;
|
||||
}
|
||||
|
||||
QadrtConvertA2E(eattrs[j], attrs[j], i, i);
|
||||
eattrs[j][i] = '\0';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (status == LDAP_SUCCESS)
|
||||
status = ldap_search_s(ld, ebase? ebase: "", scope,
|
||||
efilter? efilter: "(objectclass=*)",
|
||||
eattrs, attrsonly, res);
|
||||
|
||||
if (eattrs) {
|
||||
for (j = 0; eattrs[j]; j++)
|
||||
free(eattrs[j]);
|
||||
|
||||
free(eattrs);
|
||||
}
|
||||
|
||||
if (efilter)
|
||||
free(efilter);
|
||||
|
||||
if (ebase)
|
||||
free(ebase);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
struct berval * *
|
||||
Curl_ldap_get_values_len_a(void * ld, LDAPMessage * entry, const char * attr)
|
||||
|
||||
{
|
||||
int i;
|
||||
char * cp;
|
||||
struct berval * * result;
|
||||
|
||||
cp = (char *) NULL;
|
||||
|
||||
if (attr) {
|
||||
i = strlen(attr);
|
||||
|
||||
if (!(cp = malloc(i + 1))) {
|
||||
ldap_set_lderrno(ld, LDAP_NO_MEMORY, NULL,
|
||||
ldap_err2string(LDAP_NO_MEMORY));
|
||||
return (struct berval * *) NULL;
|
||||
}
|
||||
|
||||
QadrtConvertA2E(cp, attr, i, i);
|
||||
cp[i] = '\0';
|
||||
}
|
||||
|
||||
result = ldap_get_values_len(ld, entry, cp);
|
||||
|
||||
if (cp)
|
||||
free(cp);
|
||||
|
||||
/* Result data are binary in nature, so they haven't been converted to EBCDIC.
|
||||
Therefore do not convert. */
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
Curl_ldap_err2string_a(int error)
|
||||
|
||||
{
|
||||
int i;
|
||||
char * cp;
|
||||
char * cp2;
|
||||
|
||||
cp = ldap_err2string(error);
|
||||
|
||||
if (!cp)
|
||||
return cp;
|
||||
|
||||
i = strlen(cp);
|
||||
|
||||
if (!(cp2 = Curl_thread_buffer(LK_LDAP_ERROR, MAX_CONV_EXPANSION * i + 1)))
|
||||
return cp2;
|
||||
|
||||
i = QadrtConvertE2A(cp2, cp, MAX_CONV_EXPANSION * i, i);
|
||||
cp2[i] = '\0';
|
||||
return cp2;
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
Curl_ldap_get_dn_a(void * ld, LDAPMessage * entry)
|
||||
|
||||
{
|
||||
int i;
|
||||
char * cp;
|
||||
char * cp2;
|
||||
|
||||
cp = ldap_get_dn(ld, entry);
|
||||
|
||||
if (!cp)
|
||||
return cp;
|
||||
|
||||
i = strlen(cp);
|
||||
|
||||
if (!(cp2 = malloc(i + 1)))
|
||||
return cp2;
|
||||
|
||||
QadrtConvertE2A(cp2, cp, i, i);
|
||||
|
||||
/* No way to allocate a buffer here, because it will be released by
|
||||
ldap_memfree() and ldap_memalloc() does not exist. The solution is to
|
||||
overwrite the EBCDIC buffer with ASCII to return it. */
|
||||
|
||||
strcpy(cp, cp2);
|
||||
free(cp2);
|
||||
return cp;
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
Curl_ldap_first_attribute_a(void * ld,
|
||||
LDAPMessage * entry, BerElement * * berptr)
|
||||
|
||||
{
|
||||
int i;
|
||||
char * cp;
|
||||
char * cp2;
|
||||
|
||||
cp = ldap_first_attribute(ld, entry, berptr);
|
||||
|
||||
if (!cp)
|
||||
return cp;
|
||||
|
||||
i = strlen(cp);
|
||||
|
||||
if (!(cp2 = malloc(i + 1)))
|
||||
return cp2;
|
||||
|
||||
QadrtConvertE2A(cp2, cp, i, i);
|
||||
|
||||
/* No way to allocate a buffer here, because it will be released by
|
||||
ldap_memfree() and ldap_memalloc() does not exist. The solution is to
|
||||
overwrite the EBCDIC buffer with ASCII to return it. */
|
||||
|
||||
strcpy(cp, cp2);
|
||||
free(cp2);
|
||||
return cp;
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
Curl_ldap_next_attribute_a(void * ld,
|
||||
LDAPMessage * entry, BerElement * berptr)
|
||||
|
||||
{
|
||||
int i;
|
||||
char * cp;
|
||||
char * cp2;
|
||||
|
||||
cp = ldap_next_attribute(ld, entry, berptr);
|
||||
|
||||
if (!cp)
|
||||
return cp;
|
||||
|
||||
i = strlen(cp);
|
||||
|
||||
if (!(cp2 = malloc(i + 1)))
|
||||
return cp2;
|
||||
|
||||
QadrtConvertE2A(cp2, cp, i, i);
|
||||
|
||||
/* No way to allocate a buffer here, because it will be released by
|
||||
ldap_memfree() and ldap_memalloc() does not exist. The solution is to
|
||||
overwrite the EBCDIC buffer with ASCII to return it. */
|
||||
|
||||
strcpy(cp, cp2);
|
||||
free(cp2);
|
||||
return cp;
|
||||
}
|
||||
|
||||
#endif /* CURL_DISABLE_LDAP */
|
||||
53
packages/OS400/os400sys.h
Normal file
53
packages/OS400/os400sys.h
Normal file
@@ -0,0 +1,53 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2007, 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.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/* OS/400 additional definitions. */
|
||||
|
||||
#ifndef __OS400_SYS_
|
||||
#define __OS400_SYS_
|
||||
|
||||
|
||||
/* Per-thread item identifiers. */
|
||||
|
||||
typedef enum {
|
||||
LK_SSL_ERROR,
|
||||
LK_LDAP_ERROR,
|
||||
LK_CURL_VERSION,
|
||||
LK_VERSION_INFO,
|
||||
LK_VERSION_INFO_DATA,
|
||||
LK_EASY_STRERROR,
|
||||
LK_SHARE_STRERROR,
|
||||
LK_MULTI_STRERROR,
|
||||
LK_LAST
|
||||
} localkey_t;
|
||||
|
||||
|
||||
extern char * (* Curl_thread_buffer)(localkey_t key, long size);
|
||||
|
||||
|
||||
/* Maximum string expansion factor due to character code conversion. */
|
||||
|
||||
#define MAX_CONV_EXPANSION 4 /* Can deal with UTF-8. */
|
||||
|
||||
#endif
|
||||
@@ -227,9 +227,6 @@
|
||||
/* Define if you have the getpass function. */
|
||||
#undef HAVE_GETPASS
|
||||
|
||||
/* Define if you have the `dlopen' function. */
|
||||
#define HAVE_DLOPEN 1
|
||||
|
||||
/* Define if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
@@ -262,9 +259,6 @@
|
||||
/* Define to 1 if you have the <limits.h> header file. */
|
||||
#define HAVE_LIMITS_H 1
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#define HAVE_DLFCN_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/ioctl.h> header file. */
|
||||
#define HAVE_SYS_IOCTL_H 1
|
||||
|
||||
|
||||
@@ -1,22 +1,35 @@
|
||||
#############################################################
|
||||
#########################################################################
|
||||
# $Id$
|
||||
#
|
||||
## Makefile for building curl.exe with MingW32 (GCC-3.2) and
|
||||
## optionally OpenSSL (0.9.8)
|
||||
## optionally OpenSSL (0.9.8), libssh2 (0.17), zlib (1.2.3)
|
||||
##
|
||||
## Use: mingw32-make -f Makefile.m32 [SSL=1] [SSH2=1] [DYN=1]
|
||||
## Usage:
|
||||
## mingw32-make -f Makefile.m32 [SSL=1] [SSH2=1] [ZLIB=1] [SSPI=1] [IPV6=1] [DYN=1]
|
||||
##
|
||||
## Hint: you can also set environment vars to control the build, f.e.:
|
||||
## set ZLIB_PATH=c:/zlib-1.2.3
|
||||
## 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.3
|
||||
endif
|
||||
# Edit the path below to point to the base of your OpenSSL package.
|
||||
ifndef OPENSSL_PATH
|
||||
OPENSSL_PATH = ../../openssl-0.9.8e
|
||||
endif
|
||||
# Edit the path below to point to the base of your LibSSH2 package.
|
||||
ifndef LIBSSH2_PATH
|
||||
LIBSSH2_PATH = ../../libssh2-0.16
|
||||
LIBSSH2_PATH = ../../libssh2-0.17
|
||||
endif
|
||||
ifndef ZLIB_PATH
|
||||
ZLIB_PATH = ../../zlib-1.2.3
|
||||
# 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
|
||||
|
||||
ARES_LIB = ../ares
|
||||
@@ -28,6 +41,7 @@ LDFLAGS = -s
|
||||
RC = windres
|
||||
RCFLAGS = --include-dir=../include -O COFF -i
|
||||
RM = del /q /f
|
||||
CP = copy
|
||||
|
||||
# We may need these someday
|
||||
# PERL = perl
|
||||
@@ -49,6 +63,9 @@ else
|
||||
CFLAGS += -DCURL_STATICLIB
|
||||
endif
|
||||
ifdef ARES
|
||||
ifndef DYN
|
||||
curl_DEPENDENCIES += $(ARES_LIB)/libcares.a
|
||||
endif
|
||||
CFLAGS += -DUSE_ARES
|
||||
curl_LDADD += -L$(ARES_LIB) -lcares
|
||||
endif
|
||||
@@ -71,7 +88,23 @@ endif
|
||||
ifdef IPV6
|
||||
CFLAGS += -DENABLE_IPV6
|
||||
endif
|
||||
curl_LDADD += -lwsock32 -lws2_32 -lwinmm
|
||||
ifdef LDAPS
|
||||
CFLAGS += -DHAVE_LDAP_SSL
|
||||
endif
|
||||
ifdef USE_LDAP_NOVELL
|
||||
CFLAGS += -DCURL_HAS_NOVELL_LDAPSDK
|
||||
curl_LDADD += -L"$(LDAP_SDK)/lib/mscvc" -lldapsdk -lldapssl -lldapx
|
||||
endif
|
||||
ifdef USE_LDAP_OPENLDAP
|
||||
CFLAGS += -DCURL_HAS_OPENLDAP_LDAPSDK
|
||||
curl_LDADD += -L"$(LDAP_SDK)/lib" -lldap -llber
|
||||
endif
|
||||
ifndef USE_LDAP_NOVELL
|
||||
ifndef USE_LDAP_OPENLDAP
|
||||
curl_LDADD += -lwldap32
|
||||
endif
|
||||
endif
|
||||
curl_LDADD += -lws2_32 -lwinmm
|
||||
COMPILE = $(CC) $(INCLUDES) $(CFLAGS)
|
||||
|
||||
# Makefile.inc provides the CSOURCES and HHEADERS defines
|
||||
@@ -86,14 +119,18 @@ curl_OBJECTS := $(patsubst %.c,%.o,$(strip $(CURL_SOURCES)))
|
||||
all: curl.exe
|
||||
|
||||
curl.exe: curl.res $(curl_OBJECTS) $(curl_DEPENDENCIES)
|
||||
$(RM) $@
|
||||
-$(RM) $@
|
||||
$(LINK) $< $(curl_OBJECTS) $(curl_LDADD)
|
||||
|
||||
# We don't have nroff normally under win32
|
||||
# hugehelp.c: ../README.curl ../curl.1 mkhelp.pl
|
||||
# $(RM) hugehelp.c
|
||||
# -$(RM) hugehelp.c
|
||||
# $(NROFF) -man ../curl.1 | $(PERL) mkhelp.pl ../README.curl > hugehelp.c
|
||||
|
||||
hugehelp.c:
|
||||
@echo Creating $@
|
||||
@$(CP) hugehelp.c.cvs $@
|
||||
|
||||
.c.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
@@ -101,7 +138,12 @@ curl.exe: curl.res $(curl_OBJECTS) $(curl_DEPENDENCIES)
|
||||
$(RC) $(RCFLAGS) $< -o $@
|
||||
|
||||
clean:
|
||||
$(RM) $(curl_OBJECTS)
|
||||
ifeq "$(wildcard hugehelp.c.cvs)" "hugehelp.c.cvs"
|
||||
-$(RM) hugehelp.c
|
||||
endif
|
||||
-$(RM) $(curl_OBJECTS)
|
||||
|
||||
distrib: clean
|
||||
$(RM) $(curl_PROGRAMS)
|
||||
-$(RM) $(curl_PROGRAMS)
|
||||
|
||||
|
||||
|
||||
@@ -172,12 +172,13 @@ ifeq ($(LIBARCH),LIBC)
|
||||
INCLUDES += -I$(SDK_LIBC)/include
|
||||
# INCLUDES += -I$(SDK_LIBC)/include/nks
|
||||
# INCLUDES += -I$(SDK_LIBC)/include/winsock
|
||||
# INCLUDES += -I$(SDK_LDAP)/libc/inc
|
||||
CFLAGS += -D_POSIX_SOURCE
|
||||
else
|
||||
INCLUDES += -I$(SDK_CLIB)/include/nlm
|
||||
# INCLUDES += -I$(SDK_CLIB)/include
|
||||
# INCLUDES += -I$(SDK_LDAP)/clib/inc
|
||||
endif
|
||||
ifndef DISABLE_LDAP
|
||||
# INCLUDES += -I$(SDK_LDAP)/$(LIBARCH_L)/inc
|
||||
endif
|
||||
CFLAGS += $(INCLUDES)
|
||||
|
||||
@@ -291,9 +292,12 @@ ifeq ($(LIBARCH),CLIB)
|
||||
@echo $(DL)import @$(SDK_CLIB)/imports/threads.imp$(DL) >> $@
|
||||
@echo $(DL)import @$(SDK_CLIB)/imports/nlmlib.imp$(DL) >> $@
|
||||
@echo $(DL)import @$(SDK_CLIB)/imports/socklib.imp$(DL) >> $@
|
||||
# @echo $(DL)import @$(SDK_LDAP)/clib/imports/ldapsdk.imp$(DL) >> $@
|
||||
# @echo $(DL)import @$(SDK_LDAP)/clib/imports/ldapssl.imp$(DL) >> $@
|
||||
# @echo $(DL)import @$(SDK_LDAP)/clib/imports/ldapx.imp$(DL) >> $@
|
||||
ifndef DISABLE_LDAP
|
||||
@echo $(DL)import @$(SDK_LDAP)/clib/imports/ldapsdk.imp$(DL) >> $@
|
||||
@echo $(DL)import @$(SDK_LDAP)/clib/imports/ldapssl.imp$(DL) >> $@
|
||||
@echo $(DL)import @$(SDK_LDAP)/clib/imports/ldapx.imp$(DL) >> $@
|
||||
@echo $(DL)module ldapsdk$(DL) >> $@
|
||||
endif
|
||||
@echo $(DL)module clib$(DL) >> $@
|
||||
else
|
||||
@echo $(DL)flag_on 64$(DL) >> $@
|
||||
@@ -303,9 +307,12 @@ else
|
||||
@echo $(DL)check _LibCCheckUnload$(DL) >> $@
|
||||
@echo $(DL)import @$(SDK_LIBC)/imports/libc.imp$(DL) >> $@
|
||||
@echo $(DL)import @$(SDK_LIBC)/imports/netware.imp$(DL) >> $@
|
||||
# @echo $(DL)import @$(SDK_LDAP)/libc/imports/lldapsdk.imp$(DL) >> $@
|
||||
# @echo $(DL)import @$(SDK_LDAP)/libc/imports/lldapssl.imp$(DL) >> $@
|
||||
# @echo $(DL)import @$(SDK_LDAP)/libc/imports/lldapx.imp$(DL) >> $@
|
||||
ifndef DISABLE_LDAP
|
||||
@echo $(DL)import @$(SDK_LDAP)/libc/imports/lldapsdk.imp$(DL) >> $@
|
||||
@echo $(DL)import @$(SDK_LDAP)/libc/imports/lldapssl.imp$(DL) >> $@
|
||||
@echo $(DL)import @$(SDK_LDAP)/libc/imports/lldapx.imp$(DL) >> $@
|
||||
@echo $(DL)module lldapsdk$(DL) >> $@
|
||||
endif
|
||||
@echo $(DL)module libc$(DL) >> $@
|
||||
endif
|
||||
ifdef MODULES
|
||||
@@ -356,8 +363,6 @@ ifeq ($(LIBARCH),CLIB)
|
||||
@echo $(DL)#define pressanykey PressAnyKeyToContinue$(DL) >> $@
|
||||
else
|
||||
@echo $(DL)#define OS "i586-pc-libc-NetWare"$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_DLFCN_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_DLOPEN 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_FTRUNCATE 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_GETTIMEOFDAY 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_INET_PTON 1$(DL) >> $@
|
||||
@@ -425,9 +430,20 @@ endif
|
||||
@echo $(DL)#define SIZEOF_CURL_OFF_T 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) >> $@
|
||||
|
||||
@@ -77,12 +77,6 @@
|
||||
/* Define if you have the <des.h> header file. */
|
||||
#undef HAVE_DES_H
|
||||
|
||||
/* Define if you have the <dlfcn.h> header file. */
|
||||
#undef HAVE_DLFCN_H
|
||||
|
||||
/* Define if you have the `dlopen' function. */
|
||||
#undef HAVE_DLOPEN
|
||||
|
||||
/* Define if you have the <err.h> header file. */
|
||||
#undef HAVE_ERR_H
|
||||
|
||||
@@ -152,9 +146,6 @@
|
||||
/* Define if you have the `crypto' library (-lcrypto). */
|
||||
#undef HAVE_LIBCRYPTO
|
||||
|
||||
/* Define if you have the `dl' library (-ldl). */
|
||||
#undef HAVE_LIBDL
|
||||
|
||||
/* Define if you have the `nsl' library (-lnsl). */
|
||||
#undef HAVE_LIBNSL
|
||||
|
||||
|
||||
20
src/main.c
20
src/main.c
@@ -175,7 +175,7 @@ typedef enum {
|
||||
#define CONF_NOPROGRESS (1<<10) /* shut off the progress meter */
|
||||
#define CONF_NOBODY (1<<11) /* use HEAD to get http document */
|
||||
#define CONF_FAILONERROR (1<<12) /* no output on http error codes >= 300 */
|
||||
#define CONF_FTPLISTONLY (1<<16) /* Use NLST when listing ftp dir */
|
||||
#define CONF_DIRLISTONLY (1<<16) /* request nonverbose directory listing */
|
||||
#define CONF_FTPAPPEND (1<<20) /* Append instead of overwrite on upload! */
|
||||
#define CONF_NETRC (1<<22) /* read user+password from .netrc */
|
||||
#define CONF_FOLLOWLOCATION (1<<23) /* use Location: Luke! */
|
||||
@@ -2242,7 +2242,7 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
|
||||
nextarg);
|
||||
break;
|
||||
case 'l':
|
||||
config->conf ^= CONF_FTPLISTONLY; /* only list the names of the FTP dir */
|
||||
config->conf ^= CONF_DIRLISTONLY; /* only list the names of the FTP dir */
|
||||
break;
|
||||
case 'L':
|
||||
config->conf ^= CONF_FOLLOWLOCATION; /* Follow Location: HTTP headers */
|
||||
@@ -3437,7 +3437,7 @@ CURLcode _my_setopt(CURL *curl, struct Configurable *config, const char *name,
|
||||
static const char * const srchead[]={
|
||||
"/********* Sample code generated by the curl command line tool **********",
|
||||
" * Lines with [REMARK] below might need to be modified to make this code ",
|
||||
" * usable. Add appropriate error code checking where appropriate.",
|
||||
" * usable. Add error code checking where appropriate.",
|
||||
" * Compile this with a suitable header include path. Then link with ",
|
||||
" * libcurl.",
|
||||
" * If you use any *_LARGE options, make sure your compiler figure",
|
||||
@@ -4132,9 +4132,9 @@ operate(struct Configurable *config, int argc, argv_item_t argv[])
|
||||
my_setopt(curl, CURLOPT_FAILONERROR,
|
||||
config->conf&CONF_FAILONERROR);
|
||||
my_setopt(curl, CURLOPT_UPLOAD, uploadfile?TRUE:FALSE);
|
||||
my_setopt(curl, CURLOPT_FTPLISTONLY,
|
||||
config->conf&CONF_FTPLISTONLY);
|
||||
my_setopt(curl, CURLOPT_FTPAPPEND, config->conf&CONF_FTPAPPEND);
|
||||
my_setopt(curl, CURLOPT_DIRLISTONLY,
|
||||
config->conf&CONF_DIRLISTONLY);
|
||||
my_setopt(curl, CURLOPT_APPEND, config->conf&CONF_FTPAPPEND);
|
||||
|
||||
if (config->conf&CONF_NETRC_OPT)
|
||||
my_setopt(curl, CURLOPT_NETRC, CURL_NETRC_OPTIONAL);
|
||||
@@ -4185,7 +4185,7 @@ operate(struct Configurable *config, int argc, argv_item_t argv[])
|
||||
my_setopt(curl, CURLOPT_SSLCERTTYPE, config->cert_type);
|
||||
my_setopt(curl, CURLOPT_SSLKEY, config->key);
|
||||
my_setopt(curl, CURLOPT_SSLKEYTYPE, config->key_type);
|
||||
my_setopt(curl, CURLOPT_SSLKEYPASSWD, config->key_passwd);
|
||||
my_setopt(curl, CURLOPT_KEYPASSWD, config->key_passwd);
|
||||
|
||||
/* SSH private key uses the same command-line option as SSL private key */
|
||||
my_setopt(curl, CURLOPT_SSH_PRIVATE_KEYFILE, config->key);
|
||||
@@ -4323,15 +4323,15 @@ operate(struct Configurable *config, int argc, argv_item_t argv[])
|
||||
|
||||
/* new in curl 7.15.5 */
|
||||
if(config->ftp_ssl_reqd)
|
||||
my_setopt(curl, CURLOPT_FTP_SSL, CURLFTPSSL_ALL);
|
||||
my_setopt(curl, CURLOPT_USE_SSL, CURLUSESSL_ALL);
|
||||
|
||||
/* new in curl 7.11.0 */
|
||||
else if(config->ftp_ssl)
|
||||
my_setopt(curl, CURLOPT_FTP_SSL, CURLFTPSSL_TRY);
|
||||
my_setopt(curl, CURLOPT_USE_SSL, CURLUSESSL_TRY);
|
||||
|
||||
/* new in curl 7.16.0 */
|
||||
else if(config->ftp_ssl_control)
|
||||
my_setopt(curl, CURLOPT_FTP_SSL, CURLFTPSSL_CONTROL);
|
||||
my_setopt(curl, CURLOPT_USE_SSL, CURLUSESSL_CONTROL);
|
||||
|
||||
/* new in curl 7.16.1 */
|
||||
if(config->ftp_ssl_ccc)
|
||||
|
||||
@@ -90,7 +90,8 @@ Special-commands for the server.
|
||||
For FTP, these are supported:
|
||||
|
||||
REPLY [command] [return value] [response string]
|
||||
- Changes how the server responds to the [command]
|
||||
- Changes how the server responds to the [command]. [response string] is
|
||||
evaluated as a perl string, so it can contain embedded \r\n, for example.
|
||||
COUNT [command] [num]
|
||||
- Do the REPLY change for [command] only [num] times and then go back to the
|
||||
built-in approach
|
||||
@@ -226,6 +227,8 @@ Available substitute variables include:
|
||||
%FTP6PORT - IPv6 port number of the FTP server
|
||||
%FTPSPORT - Port number of the FTPS server
|
||||
%FTP2PORT - Port number of the FTP server 2
|
||||
%FTPTIME2 - Timeout in seconds that should be just sufficient to receive
|
||||
a response from the test FTP server
|
||||
%TFTPPORT - Port number of the TFTP server
|
||||
%TFTP6PORT - IPv6 port number of the TFTP server
|
||||
%SSHPORT - Port number of the SCP/SFTP server
|
||||
|
||||
11
tests/README
11
tests/README
@@ -38,8 +38,10 @@ TCP ports used by default:
|
||||
on one machine.
|
||||
|
||||
Run:
|
||||
'make test'. This invokes the 'runtests.pl' perl script. Edit the top
|
||||
variables of that script in case you have some specific needs.
|
||||
'make test'. This builds the test suite support code and invokes the
|
||||
'runtests.pl' perl script to run all the tests. Edit the top variables
|
||||
of that script in case you have some specific needs, or run the script
|
||||
manually (after the support code has been built).
|
||||
|
||||
The script breaks on the first test that doesn't do OK. Use -a to prevent
|
||||
the script from abort on the first error. Run the script with -v for more
|
||||
@@ -58,6 +60,11 @@ Memory:
|
||||
automatically detect if that is the case, and it will use the ../memanalyze
|
||||
script to analyze the memory debugging output.
|
||||
|
||||
The -t option will enable torture testing mode, which runs each test
|
||||
many times but causes a different memory allocation to fail on each
|
||||
successive run. This tests the out of memory error handling code to
|
||||
ensure that memory leaks do not occur even in those situations.
|
||||
|
||||
Debug:
|
||||
If a test case fails, you can conveniently get the script to invoke the
|
||||
debugger (gdb) for you with the server running and the exact same command
|
||||
|
||||
@@ -43,4 +43,5 @@ EXTRA_DIST = test1 test108 test117 test127 test20 test27 test34 test46 \
|
||||
test296 test297 test298 test610 test611 test612 test406 test407 test408 \
|
||||
test409 test613 test614 test700 test701 test702 test704 test705 test703 \
|
||||
test706 test707 test350 test351 test352 test353 test289 test540 test354 \
|
||||
test231
|
||||
test231 test1000 test1001 test1002 test1003 test1004 test1005 test1006 \
|
||||
test615 test1007 test541
|
||||
|
||||
42
tests/data/test1000
Normal file
42
tests/data/test1000
Normal file
@@ -0,0 +1,42 @@
|
||||
<testcase>
|
||||
<info>
|
||||
<keywords>
|
||||
FTP
|
||||
PASV
|
||||
LIST
|
||||
NOBODY
|
||||
</keywords>
|
||||
</info>
|
||||
#
|
||||
# Server-side
|
||||
<reply>
|
||||
<datacheck>
|
||||
</datacheck>
|
||||
</reply>
|
||||
|
||||
#
|
||||
# Client-side
|
||||
<client>
|
||||
<server>
|
||||
ftp
|
||||
</server>
|
||||
<name>
|
||||
FTP dir list PASV with -I
|
||||
</name>
|
||||
<command>
|
||||
ftp://%HOSTIP:%FTPPORT/1000/ -I
|
||||
</command>
|
||||
</client>
|
||||
|
||||
#
|
||||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
<protocol>
|
||||
USER anonymous
|
||||
PASS ftp@example.com
|
||||
PWD
|
||||
CWD 1000
|
||||
QUIT
|
||||
</protocol>
|
||||
</verify>
|
||||
</testcase>
|
||||
103
tests/data/test1001
Normal file
103
tests/data/test1001
Normal file
@@ -0,0 +1,103 @@
|
||||
<testcase>
|
||||
<info>
|
||||
<keywords>
|
||||
HTTP
|
||||
Digest
|
||||
PUT
|
||||
Resume
|
||||
CUSTOMREQUEST
|
||||
</keywords>
|
||||
</info>
|
||||
# Server-side
|
||||
<reply>
|
||||
<data>
|
||||
HTTP/1.1 100 Continue
|
||||
Server: Microsoft-IIS/5.0
|
||||
Date: Sun, 03 Apr 2005 14:57:45 GMT
|
||||
X-Powered-By: ASP.NET
|
||||
|
||||
HTTP/1.1 401 authentication please swsbounce
|
||||
Server: Microsoft-IIS/6.0
|
||||
WWW-Authenticate: Digest realm="testrealm", nonce="1053604144"
|
||||
Content-Type: text/html; charset=iso-8859-1
|
||||
Content-Length: 0
|
||||
|
||||
</data>
|
||||
<data1000>
|
||||
HTTP/1.1 200 A OK
|
||||
Server: Microsoft-IIS/6.0
|
||||
Content-Type: text/html; charset=iso-8859-1
|
||||
Content-Length: 3
|
||||
|
||||
ok
|
||||
</data1000>
|
||||
|
||||
<datacheck>
|
||||
HTTP/1.1 100 Continue
|
||||
Server: Microsoft-IIS/5.0
|
||||
Date: Sun, 03 Apr 2005 14:57:45 GMT
|
||||
X-Powered-By: ASP.NET
|
||||
|
||||
HTTP/1.1 401 authentication please swsbounce
|
||||
Server: Microsoft-IIS/6.0
|
||||
WWW-Authenticate: Digest realm="testrealm", nonce="1053604144"
|
||||
Content-Type: text/html; charset=iso-8859-1
|
||||
Content-Length: 0
|
||||
|
||||
HTTP/1.1 200 A OK
|
||||
Server: Microsoft-IIS/6.0
|
||||
Content-Type: text/html; charset=iso-8859-1
|
||||
Content-Length: 3
|
||||
|
||||
ok
|
||||
</datacheck>
|
||||
|
||||
</reply>
|
||||
|
||||
# Client-side
|
||||
<client>
|
||||
#
|
||||
<server>
|
||||
http
|
||||
</server>
|
||||
<name>
|
||||
HTTP POST --digest with PUT and resumed upload and modified method
|
||||
</name>
|
||||
<command>
|
||||
http://%HOSTIP:%HTTPPORT/1001 -u auser:apasswd --digest -T log/1001 -x http://%HOSTIP:%HTTPPORT -C 2 -X GET
|
||||
</command>
|
||||
<file name="log/1001">
|
||||
test
|
||||
</file>
|
||||
</client>
|
||||
|
||||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
<strip>
|
||||
^User-Agent:.*
|
||||
</strip>
|
||||
<protocol>
|
||||
GET http://%HOSTIP:%HTTPPORT/1001 HTTP/1.1
|
||||
Content-Range: bytes 2-4/5
|
||||
User-Agent: curl/7.12.1-CVS (i686-pc-linux-gnu) libcurl/7.12.1-CVS OpenSSL/0.9.6b ipv6 zlib/1.1.4 GSS libidn/0.4.6
|
||||
Host: %HOSTIP:%HTTPPORT
|
||||
Pragma: no-cache
|
||||
Accept: */*
|
||||
Proxy-Connection: Keep-Alive
|
||||
Content-Length: 0
|
||||
Expect: 100-continue
|
||||
|
||||
GET http://%HOSTIP:%HTTPPORT/1001 HTTP/1.1
|
||||
Authorization: Digest username="auser", realm="testrealm", nonce="1053604144", uri="/1001", response="6af4d89c952f4dd4cc215a6878dc499d"
|
||||
Content-Range: bytes 2-4/5
|
||||
Host: %HOSTIP:%HTTPPORT
|
||||
Pragma: no-cache
|
||||
Accept: */*
|
||||
Proxy-Connection: Keep-Alive
|
||||
Content-Length: 3
|
||||
Expect: 100-continue
|
||||
|
||||
st
|
||||
</protocol>
|
||||
</verify>
|
||||
</testcase>
|
||||
115
tests/data/test1002
Normal file
115
tests/data/test1002
Normal file
@@ -0,0 +1,115 @@
|
||||
<testcase>
|
||||
<info>
|
||||
<keywords>
|
||||
HTTP
|
||||
Digest
|
||||
PUT
|
||||
Resume
|
||||
CUSTOMREQUEST
|
||||
</keywords>
|
||||
</info>
|
||||
|
||||
<reply>
|
||||
<data>
|
||||
HTTP/1.1 100 Continue
|
||||
Server: Microsoft-IIS/5.0
|
||||
Date: Sun, 03 Apr 2005 14:57:45 GMT
|
||||
X-Powered-By: ASP.NET
|
||||
|
||||
HTTP/1.1 401 authentication please swsbounce
|
||||
Server: Microsoft-IIS/6.0
|
||||
WWW-Authenticate: Digest realm="testrealm", nonce="1053604144"
|
||||
Content-Type: text/html; charset=iso-8859-1
|
||||
Content-Length: 0
|
||||
|
||||
</data>
|
||||
<data1000>
|
||||
HTTP/1.1 200 A OK
|
||||
Server: Microsoft-IIS/6.0
|
||||
Content-Type: text/html; charset=iso-8859-1
|
||||
Content-Length: 3
|
||||
|
||||
ok
|
||||
</data1000>
|
||||
|
||||
<datacheck>
|
||||
HTTP/1.1 100 Continue
|
||||
Server: Microsoft-IIS/5.0
|
||||
Date: Sun, 03 Apr 2005 14:57:45 GMT
|
||||
X-Powered-By: ASP.NET
|
||||
|
||||
HTTP/1.1 401 authentication please swsbounce
|
||||
Server: Microsoft-IIS/6.0
|
||||
WWW-Authenticate: Digest realm="testrealm", nonce="1053604144"
|
||||
Content-Type: text/html; charset=iso-8859-1
|
||||
Content-Length: 0
|
||||
|
||||
HTTP/1.1 200 A OK
|
||||
Server: Microsoft-IIS/6.0
|
||||
Content-Type: text/html; charset=iso-8859-1
|
||||
Content-Length: 3
|
||||
|
||||
ok
|
||||
</datacheck>
|
||||
|
||||
</reply>
|
||||
|
||||
# Client-side
|
||||
<client>
|
||||
#
|
||||
<server>
|
||||
http
|
||||
</server>
|
||||
<name>
|
||||
HTTP POST --digest with PUT and resumed upload and modified method, twice
|
||||
</name>
|
||||
<command>
|
||||
http://%HOSTIP:%HTTPPORT/1002.upload1 -T log/1002 http://%HOSTIP:%HTTPPORT/1002.upload2 -T log/1002 -u auser:apasswd --digest -x http://%HOSTIP:%HTTPPORT -C 2 -X GET
|
||||
</command>
|
||||
<file name="log/1002">
|
||||
test
|
||||
</file>
|
||||
</client>
|
||||
|
||||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
<strip>
|
||||
^User-Agent:.*
|
||||
</strip>
|
||||
<protocol>
|
||||
GET http://%HOSTIP:%HTTPPORT/1002.upload1 HTTP/1.1
|
||||
Content-Range: bytes 2-4/5
|
||||
User-Agent: curl/7.12.1-CVS (i686-pc-linux-gnu) libcurl/7.12.1-CVS OpenSSL/0.9.6b ipv6 zlib/1.1.4 GSS libidn/0.4.6
|
||||
Host: %HOSTIP:%HTTPPORT
|
||||
Pragma: no-cache
|
||||
Accept: */*
|
||||
Proxy-Connection: Keep-Alive
|
||||
Content-Length: 0
|
||||
Expect: 100-continue
|
||||
|
||||
GET http://%HOSTIP:%HTTPPORT/1002.upload1 HTTP/1.1
|
||||
Authorization: Digest username="auser", realm="testrealm", nonce="1053604144", uri="/1002.upload1", response="198aa9b6acb4b0c71d02a197a5e41f54"
|
||||
Content-Range: bytes 2-4/5
|
||||
Host: %HOSTIP:%HTTPPORT
|
||||
Pragma: no-cache
|
||||
Accept: */*
|
||||
Proxy-Connection: Keep-Alive
|
||||
Content-Length: 3
|
||||
Expect: 100-continue
|
||||
|
||||
st
|
||||
GET http://%HOSTIP:%HTTPPORT/1002.upload2 HTTP/1.1
|
||||
Authorization: Digest username="auser", realm="testrealm", nonce="1053604144", uri="/1002.upload2", response="d711f0d2042786d930de635ba0d1a1d0"
|
||||
Content-Range: bytes 2-4/5
|
||||
User-Agent: curl/7.16.1
|
||||
Host: %HOSTIP:%HTTPPORT
|
||||
Pragma: no-cache
|
||||
Accept: */*
|
||||
Proxy-Connection: Keep-Alive
|
||||
Content-Length: 3
|
||||
Expect: 100-continue
|
||||
|
||||
st
|
||||
</protocol>
|
||||
</verify>
|
||||
</testcase>
|
||||
48
tests/data/test1003
Normal file
48
tests/data/test1003
Normal file
File diff suppressed because one or more lines are too long
56
tests/data/test1004
Normal file
56
tests/data/test1004
Normal file
@@ -0,0 +1,56 @@
|
||||
<testcase>
|
||||
<info>
|
||||
<keywords>
|
||||
HTTP
|
||||
HTTP GET
|
||||
HTTP proxy
|
||||
</keywords>
|
||||
</info>
|
||||
|
||||
#
|
||||
# Server-side
|
||||
<reply>
|
||||
<data>
|
||||
HTTP/1.1 200 OK
|
||||
Date: Thu, 09 Nov 2010 14:49:00 GMT
|
||||
Server: test-server/fake
|
||||
Last-Modified: Tue, 13 Jun 2000 12:10:00 GMT
|
||||
ETag: "21025-dc7-39462498"
|
||||
Accept-Ranges: bytes
|
||||
Content-Length: 6
|
||||
Connection: close
|
||||
Content-Type: text/html
|
||||
Funny-head: yesyes
|
||||
|
||||
-foo-
|
||||
</data>
|
||||
</reply>
|
||||
|
||||
#
|
||||
# Client-side
|
||||
<client>
|
||||
<server>
|
||||
http
|
||||
</server>
|
||||
<name>
|
||||
HTTP GET with empty proxy
|
||||
</name>
|
||||
<command>
|
||||
http://%HOSTIP:%HTTPPORT/1004 --proxy ""
|
||||
</command>
|
||||
</client>
|
||||
|
||||
#
|
||||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
<strip>
|
||||
^User-Agent:.*
|
||||
</strip>
|
||||
<protocol>
|
||||
GET /1004 HTTP/1.1
|
||||
Host: %HOSTIP:%HTTPPORT
|
||||
Accept: */*
|
||||
|
||||
</protocol>
|
||||
</verify>
|
||||
</testcase>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user