diff options
author | Patrick Monnerat <pm@datasphere.ch> | 2013-10-25 18:37:37 +0200 |
---|---|---|
committer | Patrick Monnerat <pm@datasphere.ch> | 2013-10-25 18:37:37 +0200 |
commit | 2cc9246477285d16d21086dfed5cc4adeee0dbc9 (patch) | |
tree | 2f360cdb14b749bc6bd28cb7982c7ae07b9b571e /packages | |
parent | 650036633ffdc95c8c2181ce85582bbf3939582e (diff) | |
download | curl-2cc9246477285d16d21086dfed5cc4adeee0dbc9.tar.gz |
OS400: sync RPG wrapper, zlib support, fix header file names, ...
IFS compilation support, SSL GSKit backend by default, TLSv1.[12] support in
GSKit for OS400 >= V7R1, no more tabs in make scripts.
Diffstat (limited to 'packages')
-rw-r--r-- | packages/OS400/README.OS400 | 1 | ||||
-rw-r--r-- | packages/OS400/ccsidcurl.c | 7 | ||||
-rw-r--r-- | packages/OS400/curl.inc.in | 29 | ||||
-rw-r--r-- | packages/OS400/initscript.sh | 71 | ||||
-rw-r--r-- | packages/OS400/make-include.sh | 52 | ||||
-rw-r--r-- | packages/OS400/make-lib.sh | 14 | ||||
-rw-r--r-- | packages/OS400/make-tests.sh | 6 | ||||
-rw-r--r-- | packages/OS400/os400sys.c | 157 | ||||
-rw-r--r-- | packages/OS400/os400sys.h | 2 |
9 files changed, 233 insertions, 106 deletions
diff --git a/packages/OS400/README.OS400 b/packages/OS400/README.OS400 index 73e81f8c3..4a39738a9 100644 --- a/packages/OS400/README.OS400 +++ b/packages/OS400/README.OS400 @@ -118,6 +118,7 @@ options: CURLOPT_USERAGENT CURLOPT_USERNAME CURLOPT_USERPWD + CURLOPT_XOAUTH2_BEARER 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. diff --git a/packages/OS400/ccsidcurl.c b/packages/OS400/ccsidcurl.c index a37f79027..9049d9e49 100644 --- a/packages/OS400/ccsidcurl.c +++ b/packages/OS400/ccsidcurl.c @@ -1111,11 +1111,7 @@ curl_easy_setopt_ccsid(CURL * curl, CURLoption tag, ...) if(testwarn) { testwarn = 0; -#ifdef USE_TLS_SRP - if((int) STRING_LAST != (int) STRING_TLSAUTH_PASSWORD + 1) -#else - if((int) STRING_LAST != (int) STRING_MAIL_AUTH + 1) -#endif + if((int) STRING_LAST != (int) STRING_BEARER + 1) curl_mfprintf(stderr, "*** WARNING: curl_easy_setopt_ccsid() should be reworked ***\n"); } @@ -1176,6 +1172,7 @@ curl_easy_setopt_ccsid(CURL * curl, CURLoption tag, ...) case CURLOPT_USERAGENT: case CURLOPT_USERNAME: case CURLOPT_USERPWD: + case CURLOPT_XOAUTH2_BEARER: s = va_arg(arg, char *); ccsid = va_arg(arg, unsigned int); diff --git a/packages/OS400/curl.inc.in b/packages/OS400/curl.inc.in index b14d84f83..edd516740 100644 --- a/packages/OS400/curl.inc.in +++ b/packages/OS400/curl.inc.in @@ -115,6 +115,8 @@ d c X'00004000' d CURL_VERSION_NTLM_WB... d c X'00008000' + d CURL_VERSION_HTTP2... + d c X'00010000' * d HTTPPOST_FILENAME... d c X'00000001' @@ -212,6 +214,8 @@ d c 1 d CURL_HTTP_VERSION_1_1... d c 2 + d CURL_HTTP_VERSION_2_0... + d c 3 * d CURL_NETRC_IGNORED... d c 0 @@ -1168,6 +1172,14 @@ d c 00218 d CURLOPT_XFERINFOFUNCTION... d c 20219 + d CURLOPT_XOAUTH2_BEARER... + d c 10220 + d CURLOPT_DNS_INTERFACE... + d c 10221 + d CURLOPT_DNS_LOCAL_IP4... + d c 10222 + d CURLOPT_DNS_LOCAL_IP6... + d c 10223 * /if not defined(CURL_NO_OLDIES) d CURLOPT_SSLKEYPASSWD... @@ -1457,7 +1469,9 @@ d c 5 d CURLM_UNKNOWN_OPTION... d c 6 - d CURLM_LAST c 7 + d CURLM_ADDED_ALREADY... + d c 7 + d CURLM_LAST c 8 * d CURLMSG s 10i 0 based(######ptr######) Enum d CURLMSG_NONE c 0 @@ -1566,12 +1580,7 @@ d addrlen 10u 0 d addr 16 struct sockaddr * - d curl_khkey ds based(######ptr######) - d qualified - d key * const char * - d len 10u 0 - d keytype 10i 0 - * + d curl_khtype s 10i 0 based(######ptr######) enum d CURLKHTYPE_UNKNOWN... d c 0 d CURLKHTYPE_RSA1... @@ -1581,6 +1590,12 @@ d CURLKHTYPE_DSS... d c 3 * + d curl_khkey ds based(######ptr######) + d qualified + d key * const char * + d len 10u 0 + d keytype like(curl_khtype) + * d curl_forms ds based(######ptr######) d qualified d option like(CURLformoption) diff --git a/packages/OS400/initscript.sh b/packages/OS400/initscript.sh index c07355fc0..64147e393 100644 --- a/packages/OS400/initscript.sh +++ b/packages/OS400/initscript.sh @@ -1,6 +1,16 @@ #!/bin/sh +setenv() + +{ + # Define and export. + + eval ${1}="${2}" + export ${1} +} + + case "${SCRIPTDIR}" in /*) ;; *) SCRIPTDIR="`pwd`/${SCRIPTDIR}" @@ -32,18 +42,23 @@ export SONAME # ################################################################################ -TARGETLIB='CURL' # Target OS/400 program library -STATBNDDIR='CURL_A' # Static binding directory. -DYNBNDDIR='CURL' # Dynamic binding directory. -SRVPGM="CURL.${SONAME}" # Service program. -TGTCCSID='500' # Target CCSID of objects -DEBUG='*ALL' # Debug level -OPTIMIZE='10' # Optimisation level -OUTPUT='*NONE' # Compilation output option. -TGTRLS='V5R3M0' # Target OS release +setenv TARGETLIB 'CURL' # Target OS/400 program library. +setenv STATBNDDIR 'CURL_A' # Static binding directory. +setenv DYNBNDDIR 'CURL' # Dynamic binding directory. +setenv SRVPGM "CURL.${SONAME}" # Service program. +setenv TGTCCSID '500' # Target CCSID of objects. +setenv DEBUG '*ALL' # Debug level. +setenv OPTIMIZE '10' # Optimisation level +setenv OUTPUT '*NONE' # Compilation output option. +setenv TGTRLS 'V5R3M0' # Target OS release. +setenv IFSDIR '/curl' # Installation IFS directory. + +# Define ZLIB availability and locations. -export TARGETLIB STATBNDDIR DYNBNDDIR SRVPGM TGTCCSID DEBUG OPTIMIZE OUTPUT -export TGTRLS +setenv WITH_ZLIB 0 # Define to 1 to enable. +setenv ZLIB_INCLUDE '/zlib/include' # ZLIB include IFS directory. +setenv ZLIB_LIB 'ZLIB' # ZLIB library. +setenv ZLIB_BNDDIR 'ZLIB_A' # ZLIB binding directory. ################################################################################ @@ -133,14 +148,26 @@ make_module() 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} '${TOPDIR}/packages/OS400'" + + if [ "${WITH_ZLIB}" != "0" ] + then CMD="${CMD} '${ZLIB_INCLUDE}'" + fi + + CMD="${CMD} ${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})" + DEFINES="${3}" + + if [ "${WITH_ZLIB}" != "0" ] + then DEFINES="${DEFINES} HAVE_LIBZ HAVE_ZLIB_H" + fi + + if [ "${DEFINES}" ] + then CMD="${CMD} DEFINE(${DEFINES})" fi system "${CMD}" @@ -154,11 +181,17 @@ make_module() db2_name() { - basename "${1}" | - tr 'a-z-' 'A-Z_' | - sed -e 's/\..*//' \ - -e 's/^CURL_*/C/' \ - -e 's/^\(.\).*\(.........\)$/\1\2/' + if [ "${2}" = 'nomangle' ] + then basename "${1}" | + tr 'a-z-' 'A-Z_' | + sed -e 's/\..*//' \ + -e 's/^\(.\).*\(.........\)$/\1\2/' + else basename "${1}" | + tr 'a-z-' 'A-Z_' | + sed -e 's/\..*//' \ + -e 's/^CURL_*/C/' \ + -e 's/^\(.\).*\(.........\)$/\1\2/' + fi } diff --git a/packages/OS400/make-include.sh b/packages/OS400/make-include.sh index 834ee2fce..ad72cf4a7 100644 --- a/packages/OS400/make-include.sh +++ b/packages/OS400/make-include.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# Installation of the include files in the OS/400 library. +# Installation of the header files in the OS/400 library. # SCRIPTDIR=`dirname "${0}"` @@ -8,16 +8,16 @@ SCRIPTDIR=`dirname "${0}"` cd "${TOPDIR}/include" -# Produce the curlbuild.h include file if not yet in distribution (CVS). +# Produce the curlbuild.h header file if not yet in distribution (CVS). if action_needed curl/curlbuild.h -then if action_needed curl/curlbuild.h curl/curlbuild.h.dist - then cp -p curl/curlbuild.h.dist curl/curlbuild.h - fi +then if action_needed curl/curlbuild.h curl/curlbuild.h.dist + then cp -p curl/curlbuild.h.dist curl/curlbuild.h + fi fi -# Create the OS/400 source program file for the include files. +# Create the OS/400 source program file for the header files. SRCPF="${LIBIFSNAME}/H.FILE" @@ -28,16 +28,25 @@ then CMD="CRTSRCPF FILE(${TARGETLIB}/H) RCDLEN(112)" fi +# Create the IFS directory for the header files. + +IFSINCLUDE="${IFSDIR}/include/curl" + +if action_needed "${IFSINCLUDE}" +then mkdir -p "${IFSINCLUDE}" +fi + + # Enumeration values are used as va_arg tagfields, so they MUST be # integers. copy_hfile() { - destfile="${1}" - srcfile="${2}" - shift - shift + destfile="${1}" + srcfile="${2}" + shift + shift sed -e '1i\ #pragma enum(int)\ ' "${@}" -e '$a\ @@ -48,23 +57,34 @@ copy_hfile() # Copy the header files. for HFILE in curl/*.h ${SCRIPTDIR}/ccsidcurl.h -do DEST="${SRCPF}/`db2_name \"${HFILE}\"`.MBR" +do case "`basename \"${HFILE}\" .h`" in + stdcheaders|typecheck-gcc) + continue;; + esac + + DEST="${SRCPF}/`db2_name \"${HFILE}\" nomangle`.MBR" + if action_needed "${DEST}" "${HFILE}" then copy_hfile "${DEST}" "${HFILE}" + IFSDEST="${IFSINCLUDE}/`basename \"${HFILE}\"`" + rm -f "${IFSDEST}" + ln -s "${DEST}" "${IFSDEST}" fi done -# Copy the ILE/RPG include file, setting-up version number. +# Copy the ILE/RPG header file, setting-up version number. - versioned_copy "${SCRIPTDIR}/curl.inc.in" "${SRCPF}/CURL.INC.MBR" +versioned_copy "${SCRIPTDIR}/curl.inc.in" "${SRCPF}/CURL.INC.MBR" +rm -f "${IFSINCLUDE}/curl.inc.rpgle" +ln -s "${SRCPF}/CURL.INC.MBR" "${IFSINCLUDE}/curl.inc.rpgle" -# Duplicate file H as CURL to support more include path forms. +# Duplicate file H as CURL to support more include path forms. if action_needed "${LIBIFSNAME}/CURL.FILE" -then : -else system "DLTF FILE(${TARGETLIB}/CURL)" +then : +else system "DLTF FILE(${TARGETLIB}/CURL)" fi CMD="CRTDUPOBJ OBJ(H) FROMLIB(${TARGETLIB}) OBJTYPE(*FILE) TOLIB(*FROMLIB)" diff --git a/packages/OS400/make-lib.sh b/packages/OS400/make-lib.sh index e2a87082d..5e1f2042b 100644 --- a/packages/OS400/make-lib.sh +++ b/packages/OS400/make-lib.sh @@ -83,12 +83,12 @@ fi # Gather the list of symbols to export. -EXPORTS=`grep '^CURL_EXTERN[ ]' \ +EXPORTS=`grep '^CURL_EXTERN[[:space:]]' \ "${TOPDIR}"/include/curl/*.h \ "${SCRIPTDIR}/ccsidcurl.h" | - sed -e 's/^.*CURL_EXTERN[ ]\(.*\)(.*$/\1/' \ - -e 's/[ ]*$//' \ - -e 's/^.*[ ][ ]*//' \ + sed -e 's/^.*CURL_EXTERN[[:space:]]\(.*\)(.*$/\1/' \ + -e 's/[[:space:]]*$//' \ + -e 's/^.*[[:space:]][[:space:]]*//' \ -e 's/^\*//' \ -e 's/(\(.*\))/\1/'` @@ -121,7 +121,11 @@ 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} BNDDIR(${TARGETLIB}/${STATBNDDIR}" + if [ "${WITH_ZLIB}" != 0 ] + then CMD="${CMD} ${ZLIB_LIB}/${ZLIB_BNDDIR}" + fi + CMD="${CMD})" CMD="${CMD} BNDSRVPGM(QADRTTS QGLDCLNT QGLDBRDR)" CMD="${CMD} TEXT('curl API library')" CMD="${CMD} TGTRLS(${TGTRLS})" diff --git a/packages/OS400/make-tests.sh b/packages/OS400/make-tests.sh index cee3ed95d..9240b7ff6 100644 --- a/packages/OS400/make-tests.sh +++ b/packages/OS400/make-tests.sh @@ -28,11 +28,11 @@ eval "`sed -e ': begin' \ -e 's/\\\\\\n/ /' \ -e 'b begin' \ -e '}' \ - -e '/^[A-Za-z_][A-Za-z0-9_]*[ ]*[=]/b keep' \ + -e '/^[A-Za-z_][A-Za-z0-9_]*[[:space:]]*[=]/b keep' \ -e 'd' \ -e ': keep' \ - -e 's/[ ]*=[ ]*/=/' \ - -e 's/=\\(.*[^ ]\\)[ ]*$/=\\"\\1\\"/' \ + -e 's/[[:space:]]*=[[:space:]]*/=/' \ + -e 's/=\\(.*[^[:space:]]\\)[[:space:]]*$/=\\"\\1\\"/' \ -e 's/\\$(\\([^)]*\\))/${\\1}/g' \ < Makefile.inc`" diff --git a/packages/OS400/os400sys.c b/packages/OS400/os400sys.c index ab0c4fb29..90160878d 100644 --- a/packages/OS400/os400sys.c +++ b/packages/OS400/os400sys.c @@ -38,6 +38,10 @@ #include <qadrt.h> #include <errno.h> +#ifdef HAVE_ZLIB_H +#include <zlib.h> +#endif + #ifdef USE_QSOSSL #include <qsossl.h> #endif @@ -241,6 +245,28 @@ buffer_undef(localkey_t key, long size) } +static char * +set_thread_string(localkey_t key, const char * s) + +{ + int i; + char * cp; + + if(!s) + return (char *) NULL; + + i = strlen(s) + 1; + cp = Curl_thread_buffer(key, MAX_CONV_EXPANSION * i + 1); + + if(cp) { + i = QadrtConvertE2A(cp, s, MAX_CONV_EXPANSION * i, i); + cp[i] = '\0'; + } + + return cp; +} + + int Curl_getnameinfo_a(const struct sockaddr * sa, curl_socklen_t salen, char * nodename, curl_socklen_t nodenamelen, @@ -434,23 +460,8 @@ 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; + return set_thread_string(LK_SSL_ERROR, + SSL_Strerror(sslreturnvalue, serrmsgp)); } #endif /* USE_QSOSSL */ @@ -825,23 +836,7 @@ const char * Curl_gsk_strerror_a(int gsk_return_value) { - int i; - const char * cp; - char * cp2; - - cp = gsk_strerror(gsk_return_value); - - if (!cp) - return cp; - - i = strlen(cp); - - if (!(cp2 = Curl_thread_buffer(LK_GSK_ERROR, MAX_CONV_EXPANSION * i + 1))) - return cp2; - - i = QadrtConvertE2A(cp2, cp, MAX_CONV_EXPANSION * i, i); - cp2[i] = '\0'; - return cp2; + return set_thread_string(LK_GSK_ERROR, gsk_strerror(gsk_return_value)); } int @@ -1235,23 +1230,7 @@ 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; + return set_thread_string(LK_LDAP_ERROR, ldap_err2string(error)); } @@ -1492,3 +1471,79 @@ Curl_os400_recvfrom(int sd, char * buffer, int buflen, int flags, *addrlen = laddrlen; return rcvlen; } + + +#ifdef HAVE_LIBZ +const char * +Curl_os400_zlibVersion(void) + +{ + return set_thread_string(LK_ZLIB_VERSION, zlibVersion()); +} + + +int +Curl_os400_inflateInit_(z_streamp strm, const char * version, int stream_size) + +{ + z_const char * msgb4 = strm->msg; + int ret; + + ret = inflateInit(strm); + + if(strm->msg != msgb4) + strm->msg = set_thread_string(LK_ZLIB_MSG, strm->msg); + + return ret; +} + + +int +Curl_os400_inflateInit2_(z_streamp strm, int windowBits, + const char * version, int stream_size) + +{ + z_const char * msgb4 = strm->msg; + int ret; + + ret = inflateInit2(strm, windowBits); + + if(strm->msg != msgb4) + strm->msg = set_thread_string(LK_ZLIB_MSG, strm->msg); + + return ret; +} + + +int +Curl_os400_inflate(z_streamp strm, int flush) + +{ + z_const char * msgb4 = strm->msg; + int ret; + + ret = inflate(strm, flush); + + if(strm->msg != msgb4) + strm->msg = set_thread_string(LK_ZLIB_MSG, strm->msg); + + return ret; +} + + +int +Curl_os400_inflateEnd(z_streamp strm) + +{ + z_const char * msgb4 = strm->msg; + int ret; + + ret = inflateEnd(strm); + + if(strm->msg != msgb4) + strm->msg = set_thread_string(LK_ZLIB_MSG, strm->msg); + + return ret; +} + +#endif diff --git a/packages/OS400/os400sys.h b/packages/OS400/os400sys.h index 234bf5e80..114469222 100644 --- a/packages/OS400/os400sys.h +++ b/packages/OS400/os400sys.h @@ -39,6 +39,8 @@ typedef enum { LK_EASY_STRERROR, LK_SHARE_STRERROR, LK_MULTI_STRERROR, + LK_ZLIB_VERSION, + LK_ZLIB_MSG, LK_LAST } localkey_t; |