Porting library to OS/400
This commit is contained in:
4
CHANGES
4
CHANGES
@@ -6,6 +6,10 @@
|
|||||||
|
|
||||||
Changelog
|
Changelog
|
||||||
|
|
||||||
|
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)
|
Daniel S (23 August 2007)
|
||||||
- Bug report #1779751 (http://curl.haxx.se/bug/view.cgi?id=1779751) pointed
|
- 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
|
out that doing first a file:// upload and then an FTP upload crashed libcurl
|
||||||
|
|||||||
@@ -95,6 +95,11 @@ extern "C" {
|
|||||||
typedef long long curl_off_t;
|
typedef long long curl_off_t;
|
||||||
#define CURL_FORMAT_OFF_T "%I64d"
|
#define CURL_FORMAT_OFF_T "%I64d"
|
||||||
#else /* GCC or Watcom on Windows */
|
#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
|
/* "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! */
|
the type is >32 bits, see the SIZEOF_CURL_OFF_T define for that! */
|
||||||
@@ -120,6 +125,7 @@ extern "C" {
|
|||||||
#else /* LARGE_FILE support */
|
#else /* LARGE_FILE support */
|
||||||
#define CURL_FORMAT_OFF_T "%ld"
|
#define CURL_FORMAT_OFF_T "%ld"
|
||||||
#endif
|
#endif
|
||||||
|
#endif /* OS400 C compiler. */
|
||||||
#endif /* GCC or Watcom on Windows */
|
#endif /* GCC or Watcom on Windows */
|
||||||
#endif /* (_MSC_VER && !__POCC__) || (__LCC__ && WIN32) */
|
#endif /* (_MSC_VER && !__POCC__) || (__LCC__ && WIN32) */
|
||||||
|
|
||||||
@@ -517,7 +523,8 @@ typedef enum {
|
|||||||
*/
|
*/
|
||||||
#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) || \
|
#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) || \
|
||||||
defined(__HP_aCC) || defined(__BORLANDC__) || defined(__LCC__) || \
|
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 */
|
/* This compiler is believed to have an ISO compatible preprocessor */
|
||||||
#define CURL_ISOCPP
|
#define CURL_ISOCPP
|
||||||
#else
|
#else
|
||||||
|
|||||||
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"
|
||||||
@@ -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);
|
return (char *)memmove(dst, ptr, strlen(ptr)+1);
|
||||||
|
|
||||||
#elif defined(HAVE_INET_NTOA_R)
|
#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);
|
return inet_ntoa_r(*(struct in_addr*)src, dst, size);
|
||||||
|
#endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
const char *addr = inet_ntoa(*(struct in_addr*)src);
|
const char *addr = inet_ntoa(*(struct in_addr*)src);
|
||||||
|
|||||||
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"
|
#include "amigaos.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __OS400__
|
||||||
|
#include "config-os400.h"
|
||||||
|
#include "setup-os400.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef TPF
|
#ifdef TPF
|
||||||
#include "config-tpf.h" /* hand-modified TPF config.h */
|
#include "config-tpf.h" /* hand-modified TPF config.h */
|
||||||
/* change which select is used for libcurl */
|
/* change which select is used for libcurl */
|
||||||
|
|||||||
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_SSLKEYPASSWD 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_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_SSLKEYPASSWD
|
||||||
|
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
|
||||||
1518
packages/OS400/curl.inc.in
Normal file
1518
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} 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
|
||||||
26
packages/OS400/makefile.sh
Normal file
26
packages/OS400/makefile.sh
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
#!/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
|
||||||
|
|
||||||
|
|
||||||
|
# Build in each directory.
|
||||||
|
|
||||||
|
for SUBDIR in include lib src tests
|
||||||
|
do "${SCRIPTDIR}/make-${SUBDIR}.sh"
|
||||||
|
done
|
||||||
957
packages/OS400/os400sys.c
Normal file
957
packages/OS400/os400sys.c
Normal file
@@ -0,0 +1,957 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* _ _ ____ _
|
||||||
|
* 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 <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>
|
||||||
|
#include <qsossl.h>
|
||||||
|
#include <gssapi.h>
|
||||||
|
#include <ldap.h>
|
||||||
|
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
|
||||||
|
#include "config-os400.h" /* Not config.h: need only some defines. */
|
||||||
|
#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
|
||||||
Reference in New Issue
Block a user