Import apr-util 1.5.3
This commit is contained in:
parent
d08b300705
commit
5bf7090be4
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/vendor/apr-util/dist/; revision=258600 svn path=/vendor/apr-util/apr-util-1.5.3/; revision=258601; tag=vendor/apr-util/apr-util-1.5.3
19
CHANGES
19
CHANGES
@ -1,4 +1,23 @@
|
||||
-*- coding: utf-8 -*-
|
||||
Changes with APR-util 1.5.3
|
||||
|
||||
*) Cygwin: Use correct file extension when loading APR DSOs. PR 55587.
|
||||
[Carlo Bramini <carlo.bramix libero.it>]
|
||||
|
||||
*) Add experimental cmake-based build system for Windows. Refer to
|
||||
README.cmake for more information. [Jeff Trawick, Tom Donovan]
|
||||
|
||||
*) Fix warnings in odbc driver on 64bit systems.
|
||||
PR 55197 [Tom Donovan]
|
||||
|
||||
*) Add support to apr_memcache for unix domain sockets. PR 54573 [Remi
|
||||
Gacogne <rgacogne+asf aquaray.com>]
|
||||
|
||||
*) Add support for Berkeley DB 6.0. [Rainer Jung]
|
||||
|
||||
*) Improve platform detection for bundled expat by updating
|
||||
config.guess and config.sub. [Rainer Jung]
|
||||
|
||||
Changes with APR-util 1.5.2
|
||||
|
||||
*) Windows: Add command line makefiles. [Gregg Smith]
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
Summary: Apache Portable Runtime Utility library
|
||||
Name: apr-util
|
||||
Version: 1.5.2
|
||||
Version: 1.5.3
|
||||
Release: 1
|
||||
License: Apache Software License
|
||||
Group: System Environment/Libraries
|
||||
|
18
configure
vendored
18
configure
vendored
@ -1440,7 +1440,7 @@ Optional Packages:
|
||||
--with-ldap-lib=path path to ldap lib file
|
||||
--with-ldap=library ldap library to use
|
||||
--with-dbm=DBM choose the DBM type to use.
|
||||
DBM={sdbm,gdbm,ndbm,db,db1,db185,db2,db3,db4,db4X,db5X}
|
||||
DBM={sdbm,gdbm,ndbm,db,db1,db185,db2,db3,db4,db4X,db5X,db6X}
|
||||
for some X=0,...,9
|
||||
--with-gdbm=DIR enable GDBM support
|
||||
--with-ndbm=PATH Find the NDBM header and library in `PATH/include'
|
||||
@ -11218,8 +11218,10 @@ fi
|
||||
|
||||
fi
|
||||
|
||||
test ${apu_has_ldap} != "1" && as_fn_error $? "could not find an LDAP library" "$LINENO" 5
|
||||
test ${apu_has_ldap} == "1" &&
|
||||
if test ${apu_has_ldap} != "1"; then
|
||||
as_fn_error $? "could not find an LDAP library" "$LINENO" 5
|
||||
else
|
||||
|
||||
if test "x$LDADD_ldap" = "x"; then
|
||||
test "x$silent" != "xyes" && echo " setting LDADD_ldap to \"$LDADD_ldap_found\""
|
||||
LDADD_ldap="$LDADD_ldap_found"
|
||||
@ -11240,6 +11242,7 @@ fi
|
||||
done
|
||||
fi
|
||||
|
||||
fi
|
||||
as_ac_Lib=`$as_echo "ac_cv_lib_$apu_liblber_name''_ber_init" | $as_tr_sh`
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ber_init in -l$apu_liblber_name" >&5
|
||||
$as_echo_n "checking for ber_init in -l$apu_liblber_name... " >&6; }
|
||||
@ -11617,6 +11620,7 @@ fi
|
||||
dbm_list="$dbm_list, db$db_version"
|
||||
db_version=`expr $db_version + 1`
|
||||
done
|
||||
dbm_list="$dbm_list, db60"
|
||||
|
||||
|
||||
# Check whether --with-dbm was given.
|
||||
@ -15708,7 +15712,7 @@ fi
|
||||
as_fn_error $? "Berkeley db3 not found" "$LINENO" 5
|
||||
fi
|
||||
;;
|
||||
db[45][0-9])
|
||||
db[456][0-9])
|
||||
db_major=`echo "$requested" | sed -e 's/db//' -e 's/.$//'`
|
||||
db_minor=`echo "$requested" | sed -e 's/db//' -e 's/.//'`
|
||||
|
||||
@ -16113,7 +16117,7 @@ fi
|
||||
as_fn_error $? "Berkeley db$db_major not found" "$LINENO" 5
|
||||
fi
|
||||
;;
|
||||
db[45])
|
||||
db[456])
|
||||
db_major=`echo "$requested" | sed -e 's/db//'`
|
||||
# Start version search at version x.9
|
||||
db_minor=9
|
||||
@ -18561,11 +18565,11 @@ fi
|
||||
eval "apu_use_$requested=1"
|
||||
apu_default_dbm=$requested
|
||||
;;
|
||||
db185 | db[12345])
|
||||
db185 | db[123456])
|
||||
apu_use_db=1
|
||||
apu_default_dbm=$requested
|
||||
;;
|
||||
db[45][0-9])
|
||||
db[456][0-9])
|
||||
apu_use_db=1
|
||||
apu_default_dbm=`echo $requested | sed -e 's/.$//'`
|
||||
;;
|
||||
|
@ -100,7 +100,9 @@ APU_DECLARE(apr_status_t) apr_crypto_init(apr_pool_t *pool)
|
||||
}
|
||||
|
||||
/* Top level pool scope, need process-scope lifetime */
|
||||
for (parent = pool; parent; parent = apr_pool_parent_get(pool))
|
||||
for (parent = apr_pool_parent_get(pool);
|
||||
parent && parent != pool;
|
||||
parent = apr_pool_parent_get(pool))
|
||||
pool = parent;
|
||||
#if APU_DSO_BUILD
|
||||
/* deprecate in 2.0 - permit implicit initialization */
|
||||
@ -176,7 +178,7 @@ APU_DECLARE(apr_status_t) apr_crypto_get_driver(
|
||||
|
||||
#if defined(NETWARE)
|
||||
apr_snprintf(modname, sizeof(modname), "crypto%s.nlm", name);
|
||||
#elif defined(WIN32)
|
||||
#elif defined(WIN32) || defined(__CYGWIN__)
|
||||
apr_snprintf(modname, sizeof(modname),
|
||||
"apr_crypto_%s-" APU_STRINGIFY(APU_MAJOR_VERSION) ".dll", name);
|
||||
#else
|
||||
|
@ -102,8 +102,10 @@ APU_DECLARE(apr_status_t) apr_dbd_init(apr_pool_t *pool)
|
||||
}
|
||||
|
||||
/* Top level pool scope, need process-scope lifetime */
|
||||
for (parent = pool; parent; parent = apr_pool_parent_get(pool))
|
||||
pool = parent;
|
||||
for (parent = apr_pool_parent_get(pool);
|
||||
parent && parent != pool;
|
||||
parent = apr_pool_parent_get(pool))
|
||||
pool = parent;
|
||||
#if APU_DSO_BUILD
|
||||
/* deprecate in 2.0 - permit implicit initialization */
|
||||
apu_dso_init(pool);
|
||||
@ -184,7 +186,7 @@ APU_DECLARE(apr_status_t) apr_dbd_get_driver(apr_pool_t *pool, const char *name,
|
||||
|
||||
#if defined(NETWARE)
|
||||
apr_snprintf(modname, sizeof(modname), "dbd%s.nlm", name);
|
||||
#elif defined(WIN32)
|
||||
#elif defined(WIN32) || defined(__CYGWIN__)
|
||||
apr_snprintf(modname, sizeof(modname),
|
||||
"apr_dbd_%s-" APU_STRINGIFY(APU_MAJOR_VERSION) ".dll", name);
|
||||
#else
|
||||
@ -204,7 +206,7 @@ APU_DECLARE(apr_status_t) apr_dbd_get_driver(apr_pool_t *pool, const char *name,
|
||||
}
|
||||
apu_dso_mutex_unlock();
|
||||
|
||||
#else /* not builtin and !APR_HAS_DSO => not implemented */
|
||||
#else /* not builtin and !APU_DSO_BUILD => not implemented */
|
||||
rv = APR_ENOTIMPL;
|
||||
#endif
|
||||
|
||||
|
@ -114,9 +114,9 @@ struct apr_dbd_t
|
||||
char lastError[MAX_ERROR_STRING];
|
||||
int defaultBufferSize; /* used for CLOBs in text mode,
|
||||
* and when fld size is indeterminate */
|
||||
int transaction_mode;
|
||||
int dboptions; /* driver options re SQLGetData */
|
||||
int default_transaction_mode;
|
||||
intptr_t transaction_mode;
|
||||
intptr_t dboptions; /* driver options re SQLGetData */
|
||||
intptr_t default_transaction_mode;
|
||||
int can_commit; /* controls end_trans behavior */
|
||||
};
|
||||
|
||||
@ -359,7 +359,7 @@ static SQLRETURN odbc_set_result_column(int icol, apr_dbd_results_t *res,
|
||||
SQLHANDLE stmt)
|
||||
{
|
||||
SQLRETURN rc;
|
||||
int maxsize, textsize, realsize, type, isunsigned = 1;
|
||||
intptr_t maxsize, textsize, realsize, type, isunsigned = 1;
|
||||
|
||||
/* discover the sql type */
|
||||
rc = SQLColAttribute(stmt, icol + 1, SQL_DESC_UNSIGNED, NULL, 0, NULL,
|
||||
@ -409,7 +409,7 @@ static SQLRETURN odbc_set_result_column(int icol, apr_dbd_results_t *res,
|
||||
type = SQL_C_CHAR;
|
||||
}
|
||||
|
||||
res->coltypes[icol] = type;
|
||||
res->coltypes[icol] = (SQLSMALLINT)type;
|
||||
|
||||
/* size if retrieved as text */
|
||||
rc = SQLColAttribute(stmt, icol + 1, SQL_DESC_DISPLAY_SIZE, NULL, 0,
|
||||
@ -441,12 +441,12 @@ static SQLRETURN odbc_set_result_column(int icol, apr_dbd_results_t *res,
|
||||
|
||||
res->colptrs[icol] = NULL;
|
||||
res->colstate[icol] = COL_AVAIL;
|
||||
res->colsizes[icol] = maxsize;
|
||||
res->colsizes[icol] = (SQLINTEGER)maxsize;
|
||||
rc = SQL_SUCCESS;
|
||||
}
|
||||
else {
|
||||
res->colptrs[icol] = apr_pcalloc(res->pool, maxsize);
|
||||
res->colsizes[icol] = maxsize;
|
||||
res->colsizes[icol] = (SQLINTEGER)maxsize;
|
||||
if (res->apr_dbd->dboptions & SQL_GD_BOUND) {
|
||||
/* we are allowed to call SQLGetData if we need to */
|
||||
rc = SQLBindCol(stmt, icol + 1, res->coltypes[icol],
|
||||
@ -747,7 +747,7 @@ static void *odbc_get(const apr_dbd_row_t *row, const int col,
|
||||
SQLRETURN rc;
|
||||
SQLLEN indicator;
|
||||
int state = row->res->colstate[col];
|
||||
int options = row->res->apr_dbd->dboptions;
|
||||
intptr_t options = row->res->apr_dbd->dboptions;
|
||||
|
||||
switch (state) {
|
||||
case (COL_UNAVAIL):
|
||||
@ -817,13 +817,13 @@ static apr_status_t odbc_parse_params(apr_pool_t *pool, const char *params,
|
||||
int *connect, SQLCHAR **datasource,
|
||||
SQLCHAR **user, SQLCHAR **password,
|
||||
int *defaultBufferSize, int *nattrs,
|
||||
int **attrs, int **attrvals)
|
||||
int **attrs, intptr_t **attrvals)
|
||||
{
|
||||
char *seps, *last, *next, *name[MAX_PARAMS], *val[MAX_PARAMS];
|
||||
int nparams = 0, i, j;
|
||||
|
||||
*attrs = apr_pcalloc(pool, MAX_PARAMS * sizeof(char *));
|
||||
*attrvals = apr_pcalloc(pool, MAX_PARAMS * sizeof(int));
|
||||
*attrvals = apr_pcalloc(pool, MAX_PARAMS * sizeof(intptr_t));
|
||||
*nattrs = 0;
|
||||
seps = DEFAULTSEPS;
|
||||
name[nparams] = apr_strtok(apr_pstrdup(pool, params), seps, &last);
|
||||
@ -1062,7 +1062,8 @@ static apr_dbd_t *odbc_open(apr_pool_t *pool, const char *params, const char **e
|
||||
SQLHANDLE err_h = NULL;
|
||||
SQLCHAR *datasource = (SQLCHAR *)"", *user = (SQLCHAR *)"",
|
||||
*password = (SQLCHAR *)"";
|
||||
int nattrs = 0, *attrs = NULL, *attrvals = NULL, connect = 0;
|
||||
int nattrs = 0, *attrs = NULL, connect = 0;
|
||||
intptr_t *attrvals = NULL;
|
||||
|
||||
err_step = "SQLAllocHandle (SQL_HANDLE_DBC)";
|
||||
err_htype = SQL_HANDLE_ENV;
|
||||
@ -1116,10 +1117,10 @@ static apr_dbd_t *odbc_open(apr_pool_t *pool, const char *params, const char **e
|
||||
handle->default_transaction_mode = 0;
|
||||
handle->can_commit = APR_DBD_TRANSACTION_IGNORE_ERRORS;
|
||||
SQLGetInfo(hdbc, SQL_DEFAULT_TXN_ISOLATION,
|
||||
&(handle->default_transaction_mode), sizeof(int), NULL);
|
||||
&(handle->default_transaction_mode), sizeof(intptr_t), NULL);
|
||||
handle->transaction_mode = handle->default_transaction_mode;
|
||||
SQLGetInfo(hdbc, SQL_GETDATA_EXTENSIONS ,&(handle->dboptions),
|
||||
sizeof(int), NULL);
|
||||
sizeof(intptr_t), NULL);
|
||||
apr_pool_cleanup_register(pool, handle, odbc_close_cleanup, apr_pool_cleanup_null);
|
||||
return handle;
|
||||
}
|
||||
|
@ -129,8 +129,10 @@ static apr_status_t dbm_open_type(apr_dbm_type_t const* * vtable,
|
||||
apr_pool_t *parent;
|
||||
|
||||
/* Top level pool scope, need process-scope lifetime */
|
||||
for (parent = pool; parent; parent = apr_pool_parent_get(pool))
|
||||
pool = parent;
|
||||
for (parent = apr_pool_parent_get(pool);
|
||||
parent && parent != pool;
|
||||
parent = apr_pool_parent_get(pool))
|
||||
pool = parent;
|
||||
|
||||
/* deprecate in 2.0 - permit implicit initialization */
|
||||
apu_dso_init(pool);
|
||||
@ -162,7 +164,7 @@ static apr_status_t dbm_open_type(apr_dbm_type_t const* * vtable,
|
||||
|
||||
#if defined(NETWARE)
|
||||
apr_snprintf(modname, sizeof(modname), "dbm%s.nlm", type);
|
||||
#elif defined(WIN32)
|
||||
#elif defined(WIN32) || defined (__CYGWIN__)
|
||||
apr_snprintf(modname, sizeof(modname),
|
||||
"apr_dbm_%s-" APU_STRINGIFY(APU_MAJOR_VERSION) ".dll", type);
|
||||
#else
|
||||
|
@ -351,9 +351,9 @@ typedef apr_status_t (*apr_brigade_flush)(apr_bucket_brigade *bb, void *ctx);
|
||||
#define APR_BRIGADE_LAST(b) APR_RING_LAST(&(b)->list)
|
||||
|
||||
/**
|
||||
* Insert a list of buckets at the front of a brigade
|
||||
* Insert a single bucket at the front of a brigade
|
||||
* @param b The brigade to add to
|
||||
* @param e The first bucket in a list of buckets to insert
|
||||
* @param e The bucket to insert
|
||||
*/
|
||||
#define APR_BRIGADE_INSERT_HEAD(b, e) do { \
|
||||
apr_bucket *ap__b = (e); \
|
||||
@ -362,9 +362,9 @@ typedef apr_status_t (*apr_brigade_flush)(apr_bucket_brigade *bb, void *ctx);
|
||||
} while (0)
|
||||
|
||||
/**
|
||||
* Insert a list of buckets at the end of a brigade
|
||||
* Insert a single bucket at the end of a brigade
|
||||
* @param b The brigade to add to
|
||||
* @param e The first bucket in a list of buckets to insert
|
||||
* @param e The bucket to insert
|
||||
*/
|
||||
#define APR_BRIGADE_INSERT_TAIL(b, e) do { \
|
||||
apr_bucket *ap__b = (e); \
|
||||
@ -393,9 +393,9 @@ typedef apr_status_t (*apr_brigade_flush)(apr_bucket_brigade *bb, void *ctx);
|
||||
} while (0)
|
||||
|
||||
/**
|
||||
* Insert a list of buckets before a specified bucket
|
||||
* Insert a single bucket before a specified bucket
|
||||
* @param a The bucket to insert before
|
||||
* @param b The buckets to insert
|
||||
* @param b The bucket to insert
|
||||
*/
|
||||
#define APR_BUCKET_INSERT_BEFORE(a, b) do { \
|
||||
apr_bucket *ap__a = (a), *ap__b = (b); \
|
||||
@ -404,9 +404,9 @@ typedef apr_status_t (*apr_brigade_flush)(apr_bucket_brigade *bb, void *ctx);
|
||||
} while (0)
|
||||
|
||||
/**
|
||||
* Insert a list of buckets after a specified bucket
|
||||
* Insert a single bucket after a specified bucket
|
||||
* @param a The bucket to insert after
|
||||
* @param b The buckets to insert
|
||||
* @param b The bucket to insert
|
||||
*/
|
||||
#define APR_BUCKET_INSERT_AFTER(a, b) do { \
|
||||
apr_bucket *ap__a = (a), *ap__b = (b); \
|
||||
|
@ -107,10 +107,10 @@ APU_DECLARE(apr_status_t) apr_dbd_get_driver(apr_pool_t *pool, const char *name,
|
||||
|
||||
/** apr_dbd_open_ex: open a connection to a backend
|
||||
*
|
||||
* @param driver - driver struct.
|
||||
* @param pool - working pool
|
||||
* @param params - arguments to driver (implementation-dependent)
|
||||
* @param handle - pointer to handle to return
|
||||
* @param driver - driver struct.
|
||||
* @param error - descriptive error.
|
||||
* @return APR_SUCCESS for success
|
||||
* @return APR_EGENERAL if driver exists but connection failed
|
||||
@ -147,10 +147,10 @@ APU_DECLARE(apr_status_t) apr_dbd_open_ex(const apr_dbd_driver_t *driver,
|
||||
|
||||
/** apr_dbd_open: open a connection to a backend
|
||||
*
|
||||
* @param driver - driver struct.
|
||||
* @param pool - working pool
|
||||
* @param params - arguments to driver (implementation-dependent)
|
||||
* @param handle - pointer to handle to return
|
||||
* @param driver - driver struct.
|
||||
* @return APR_SUCCESS for success
|
||||
* @return APR_EGENERAL if driver exists but connection failed
|
||||
* @see apr_dbd_open_ex
|
||||
@ -161,8 +161,8 @@ APU_DECLARE(apr_status_t) apr_dbd_open(const apr_dbd_driver_t *driver,
|
||||
|
||||
/** apr_dbd_close: close a connection to a backend
|
||||
*
|
||||
* @param handle - handle to close
|
||||
* @param driver - driver struct.
|
||||
* @param handle - handle to close
|
||||
* @return APR_SUCCESS for success or error status
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_dbd_close(const apr_dbd_driver_t *driver,
|
||||
|
@ -313,24 +313,24 @@ APU_DECLARE_DATA extern apr_pool_t *apr_hook_global_pool;
|
||||
|
||||
/**
|
||||
* A global variable to determine if debugging information about the
|
||||
* hooks functions should be printed
|
||||
* hooks functions should be printed.
|
||||
*/
|
||||
APU_DECLARE_DATA extern int apr_hook_debug_enabled;
|
||||
|
||||
/**
|
||||
* The name of the module that is currently registering a function
|
||||
* The name of the module that is currently registering a function.
|
||||
*/
|
||||
APU_DECLARE_DATA extern const char *apr_hook_debug_current;
|
||||
|
||||
/**
|
||||
* Register a hook function to be sorted
|
||||
* Register a hook function to be sorted.
|
||||
* @param szHookName The name of the Hook the function is registered for
|
||||
* @param aHooks The array which stores all of the functions for this hook
|
||||
*/
|
||||
APU_DECLARE(void) apr_hook_sort_register(const char *szHookName,
|
||||
apr_array_header_t **aHooks);
|
||||
/**
|
||||
* Sort all of the registerd functions for a given hook
|
||||
* Sort all of the registered functions for a given hook.
|
||||
*/
|
||||
APU_DECLARE(void) apr_hook_sort_all(void);
|
||||
|
||||
|
@ -33,11 +33,11 @@ extern "C" {
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* Function to implemnt the APR_OPTIONAL_HOOK Macro
|
||||
* Function to implement the APR_OPTIONAL_HOOK Macro
|
||||
* @internal
|
||||
* @see APR_OPTIONAL_HOOK
|
||||
*
|
||||
* @param name The name of the hook
|
||||
* @param szName The name of the hook
|
||||
* @param pfn A pointer to a function that will be called
|
||||
* @param aszPre a NULL-terminated array of strings that name modules whose hooks should precede this one
|
||||
* @param aszSucc a NULL-terminated array of strings that name modules whose hooks should succeed this one
|
||||
|
@ -22,7 +22,7 @@
|
||||
* @brief Thread Safe FIFO bounded queue
|
||||
* @note Since most implementations of the queue are backed by a condition
|
||||
* variable implementation, it isn't available on systems without threads.
|
||||
* Although condition variables are some times available without threads.
|
||||
* Although condition variables are sometimes available without threads.
|
||||
*/
|
||||
|
||||
#include "apu.h"
|
||||
|
@ -44,7 +44,7 @@ typedef struct apr_reslist_t apr_reslist_t;
|
||||
/* Generic constructor called by resource list when it needs to create a
|
||||
* resource.
|
||||
* @param resource opaque resource
|
||||
* @param param flags
|
||||
* @param params flags
|
||||
* @param pool Pool
|
||||
*/
|
||||
typedef apr_status_t (*apr_reslist_constructor)(void **resource, void *params,
|
||||
@ -53,7 +53,7 @@ typedef apr_status_t (*apr_reslist_constructor)(void **resource, void *params,
|
||||
/* Generic destructor called by resource list when it needs to destroy a
|
||||
* resource.
|
||||
* @param resource opaque resource
|
||||
* @param param flags
|
||||
* @param params flags
|
||||
* @param pool Pool
|
||||
*/
|
||||
typedef apr_status_t (*apr_reslist_destructor)(void *resource, void *params,
|
||||
@ -111,12 +111,17 @@ APU_DECLARE(apr_status_t) apr_reslist_destroy(apr_reslist_t *reslist);
|
||||
* Retrieve a resource from the list, creating a new one if necessary.
|
||||
* If we have met our maximum number of resources, we will block
|
||||
* until one becomes available.
|
||||
* @param reslist The resource list.
|
||||
* @param resource An address where the pointer to the resource
|
||||
* will be stored.
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_reslist_acquire(apr_reslist_t *reslist,
|
||||
void **resource);
|
||||
|
||||
/**
|
||||
* Return a resource back to the list of available resources.
|
||||
* @param reslist The resource list.
|
||||
* @param resource The resource to return to the list.
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_reslist_release(apr_reslist_t *reslist,
|
||||
void *resource);
|
||||
@ -140,6 +145,8 @@ APU_DECLARE(apr_uint32_t) apr_reslist_acquired_count(apr_reslist_t *reslist);
|
||||
* Invalidate a resource in the pool - e.g. a database connection
|
||||
* that returns a "lost connection" error and can't be restored.
|
||||
* Use this instead of apr_reslist_release if the resource is bad.
|
||||
* @param reslist The resource list.
|
||||
* @param resource The resource to invalidate.
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_reslist_invalidate(apr_reslist_t *reslist,
|
||||
void *resource);
|
||||
|
@ -42,6 +42,12 @@
|
||||
* conventions at compile time.
|
||||
*/
|
||||
|
||||
/* Make sure we have our platform identifier macro defined we ask for later.
|
||||
*/
|
||||
#if defined(_WIN32) && !defined(WIN32)
|
||||
#define WIN32 1
|
||||
#endif
|
||||
|
||||
#if defined(DOXYGEN) || !defined(WIN32)
|
||||
/**
|
||||
* The public APR-UTIL functions are declared with APU_DECLARE(), so they may
|
||||
|
@ -38,6 +38,9 @@
|
||||
*/
|
||||
|
||||
|
||||
#define APU_COPYRIGHT "Copyright (c) 2013 The Apache Software " \
|
||||
"Foundation or its licensors, as applicable."
|
||||
|
||||
/* The numeric compile-time version constants. These constants are the
|
||||
* authoritative version numbers for APU.
|
||||
*/
|
||||
@ -59,7 +62,7 @@
|
||||
* The Patch Level never includes API changes, simply bug fixes.
|
||||
* Reset to 0 when upgrading APR_MINOR_VERSION
|
||||
*/
|
||||
#define APU_PATCH_VERSION 2
|
||||
#define APU_PATCH_VERSION 3
|
||||
|
||||
/**
|
||||
* The symbol APU_IS_DEV_VERSION is only defined for internal,
|
||||
@ -71,7 +74,9 @@
|
||||
|
||||
#if defined(APU_IS_DEV_VERSION) || defined(DOXYGEN)
|
||||
/** Internal: string form of the "is dev" flag */
|
||||
#ifndef APU_IS_DEV_STRING
|
||||
#define APU_IS_DEV_STRING "-dev"
|
||||
#endif
|
||||
#else
|
||||
#define APU_IS_DEV_STRING ""
|
||||
#endif
|
||||
|
@ -1,8 +1,5 @@
|
||||
#include "apu_version.h"
|
||||
|
||||
#define APU_COPYRIGHT "Copyright (c) 2011 The Apache Software " \
|
||||
"Foundation or its licensors, as applicable."
|
||||
|
||||
#define APU_LICENSE \
|
||||
"Licensed to the Apache Software Foundation (ASF) under one or more " \
|
||||
"contributor license agreements. See the NOTICE file distributed with " \
|
||||
|
@ -181,7 +181,7 @@ apr_memcache_find_server_hash_default(void *baton, apr_memcache_t *mc,
|
||||
#if APR_HAS_THREADS
|
||||
apr_thread_mutex_lock(ms->lock);
|
||||
#endif
|
||||
/* Try the the dead server, every 5 seconds */
|
||||
/* Try the dead server, every 5 seconds */
|
||||
if (curtime - ms->btime > apr_time_from_sec(5)) {
|
||||
ms->btime = curtime;
|
||||
if (mc_version_ping(ms) == APR_SUCCESS) {
|
||||
@ -289,8 +289,13 @@ static apr_status_t conn_connect(apr_memcache_conn_t *conn)
|
||||
{
|
||||
apr_status_t rv = APR_SUCCESS;
|
||||
apr_sockaddr_t *sa;
|
||||
#if APR_HAVE_SOCKADDR_UN
|
||||
apr_int32_t family = conn->ms->host[0] != '/' ? APR_INET : APR_UNIX;
|
||||
#else
|
||||
apr_int32_t family = APR_INET;
|
||||
#endif
|
||||
|
||||
rv = apr_sockaddr_info_get(&sa, conn->ms->host, APR_INET, conn->ms->port, 0, conn->p);
|
||||
rv = apr_sockaddr_info_get(&sa, conn->ms->host, family, conn->ms->port, 0, conn->p);
|
||||
if (rv != APR_SUCCESS) {
|
||||
return rv;
|
||||
}
|
||||
@ -322,6 +327,11 @@ mc_conn_construct(void **conn_, void *params, apr_pool_t *pool)
|
||||
apr_pool_t *np;
|
||||
apr_pool_t *tp;
|
||||
apr_memcache_server_t *ms = params;
|
||||
#if APR_HAVE_SOCKADDR_UN
|
||||
apr_int32_t family = ms->host[0] != '/' ? APR_INET : APR_UNIX;
|
||||
#else
|
||||
apr_int32_t family = APR_INET;
|
||||
#endif
|
||||
|
||||
rv = apr_pool_create(&np, pool);
|
||||
if (rv != APR_SUCCESS) {
|
||||
@ -339,7 +349,7 @@ mc_conn_construct(void **conn_, void *params, apr_pool_t *pool)
|
||||
conn->p = np;
|
||||
conn->tp = tp;
|
||||
|
||||
rv = apr_socket_create(&conn->sock, APR_INET, SOCK_STREAM, 0, np);
|
||||
rv = apr_socket_create(&conn->sock, family, SOCK_STREAM, 0, np);
|
||||
|
||||
if (rv != APR_SUCCESS) {
|
||||
apr_pool_destroy(np);
|
||||
|
@ -75,7 +75,6 @@ static apr_status_t apu_dso_term(void *ptr)
|
||||
apr_status_t apu_dso_init(apr_pool_t *pool)
|
||||
{
|
||||
apr_status_t ret = APR_SUCCESS;
|
||||
apr_pool_t *global;
|
||||
apr_pool_t *parent;
|
||||
|
||||
if (apr_atomic_inc32(&initialised)) {
|
||||
@ -88,17 +87,19 @@ apr_status_t apu_dso_init(apr_pool_t *pool)
|
||||
}
|
||||
|
||||
/* Top level pool scope, need process-scope lifetime */
|
||||
for (parent = global = pool; parent; parent = apr_pool_parent_get(global))
|
||||
global = parent;
|
||||
for (parent = apr_pool_parent_get(pool);
|
||||
parent && parent != pool;
|
||||
parent = apr_pool_parent_get(pool))
|
||||
pool = parent;
|
||||
|
||||
dsos = apr_hash_make(global);
|
||||
dsos = apr_hash_make(pool);
|
||||
|
||||
#if APR_HAS_THREADS
|
||||
ret = apr_thread_mutex_create(&mutex, APR_THREAD_MUTEX_DEFAULT, global);
|
||||
ret = apr_thread_mutex_create(&mutex, APR_THREAD_MUTEX_DEFAULT, pool);
|
||||
/* This already registers a pool cleanup */
|
||||
#endif
|
||||
|
||||
apr_pool_cleanup_register(global, NULL, apu_dso_term,
|
||||
apr_pool_cleanup_register(pool, NULL, apu_dso_term,
|
||||
apr_pool_cleanup_null);
|
||||
|
||||
apr_atomic_dec32(&in_init);
|
||||
|
@ -106,6 +106,9 @@ abts_suite *abts_add_suite(abts_suite *suite, const char *suite_name_full)
|
||||
/* suite_name_full may be an absolute path depending on __FILE__
|
||||
* expansion */
|
||||
suite_name = strrchr(suite_name_full, '/');
|
||||
if (!suite_name) {
|
||||
suite_name = strrchr(suite_name_full, '\\');
|
||||
}
|
||||
if (suite_name) {
|
||||
suite_name++;
|
||||
} else {
|
||||
@ -247,7 +250,8 @@ void abts_int_nequal(abts_case *tc, const int expected, const int actual, int li
|
||||
|
||||
tc->failed = TRUE;
|
||||
if (verbose) {
|
||||
fprintf(stderr, "Line %d: expected <%d>, but saw <%d>\n", lineno, expected, actual);
|
||||
fprintf(stderr, "Line %d: expected something other than <%d>, but saw <%d>\n",
|
||||
lineno, expected, actual);
|
||||
fflush(stderr);
|
||||
}
|
||||
}
|
||||
@ -279,7 +283,8 @@ void abts_str_nequal(abts_case *tc, const char *expected, const char *actual,
|
||||
|
||||
tc->failed = TRUE;
|
||||
if (verbose) {
|
||||
fprintf(stderr, "Line %d: expected <%s>, but saw <%s>\n", lineno, expected, actual);
|
||||
fprintf(stderr, "Line %d: expected something other than <%s>, but saw <%s>\n",
|
||||
lineno, expected, actual);
|
||||
fflush(stderr);
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
240
test/testssl.c
240
test/testssl.c
@ -1,240 +0,0 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
* testssl: Simple APR SSL sockets test.
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_general.h"
|
||||
#include "apr_pools.h"
|
||||
#include "apr_errno.h"
|
||||
#include "apr_getopt.h"
|
||||
#include "apr_time.h"
|
||||
#define APR_WANT_STRFUNC
|
||||
#include "apr_want.h"
|
||||
|
||||
#include "apr_ssl.h"
|
||||
#include "apr_network_io.h"
|
||||
|
||||
#if APR_HAVE_STDIO_H
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
#if APR_HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <stdlib.h> /* for atexit(), malloc() */
|
||||
#include <string.h>
|
||||
|
||||
struct sslTestCase {
|
||||
char *host;
|
||||
int port;
|
||||
const char *request;
|
||||
int result;
|
||||
} tests[] = {
|
||||
{ "svn.apache.org", 443, "GET / HTTP/1.0\n\n", 1 },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
static apr_ssl_socket_t *createSocket(apr_ssl_factory_t *asf,
|
||||
apr_pollset_t *pollset,
|
||||
apr_pool_t *pool, int blocking)
|
||||
{
|
||||
apr_ssl_socket_t *sock;
|
||||
apr_status_t rv;
|
||||
printf("::Creating SSL socket\n");
|
||||
rv = apr_ssl_socket_create(&sock, AF_INET, SOCK_STREAM, 0, asf, NULL);
|
||||
if (rv != APR_SUCCESS) {
|
||||
printf("\tFailed to create socket\n");
|
||||
return NULL;
|
||||
}
|
||||
rv = apr_pollset_add_ssl_socket(pollset, sock);
|
||||
if (rv != APR_SUCCESS) {
|
||||
printf("\tFailed to add to pollset\n");
|
||||
return NULL;
|
||||
}
|
||||
printf("\tOK\n");
|
||||
return sock;
|
||||
}
|
||||
|
||||
static apr_status_t connectSocket(apr_ssl_socket_t *sock,
|
||||
const char *host, int port,
|
||||
apr_pool_t *pool)
|
||||
{
|
||||
apr_status_t rv;
|
||||
apr_sockaddr_t *remoteSA;
|
||||
|
||||
printf("::Connecting socket\n");
|
||||
rv = apr_sockaddr_info_get(&remoteSA, host, APR_UNSPEC, port, 0, pool);
|
||||
if (rv != APR_SUCCESS) {
|
||||
printf("\tFailed to get address for '%s', port %d\n", host, port);
|
||||
return rv;
|
||||
}
|
||||
rv = apr_ssl_socket_connect(sock, remoteSA);
|
||||
if (rv != APR_SUCCESS) {
|
||||
printf("\tFailed to connect to '%s' port %d\n", host, port);
|
||||
return rv;
|
||||
}
|
||||
printf("\tOK\n");
|
||||
return rv;
|
||||
}
|
||||
|
||||
static apr_status_t socketRead(apr_ssl_socket_t *sock,
|
||||
apr_pollset_t *pollset,
|
||||
char *buf, apr_size_t *len)
|
||||
{
|
||||
int lrv;
|
||||
const apr_pollfd_t *descs = NULL;
|
||||
apr_status_t rv;
|
||||
|
||||
printf("::Reading from socket\n");
|
||||
rv = apr_ssl_socket_set_poll_events(sock, APR_POLLIN);
|
||||
if (rv != APR_SUCCESS) {
|
||||
printf("\tUnable to change socket poll events!\n");
|
||||
return rv;
|
||||
}
|
||||
|
||||
rv = apr_pollset_poll(pollset, 30 * APR_USEC_PER_SEC, &lrv, &descs);
|
||||
if (APR_STATUS_IS_TIMEUP(rv)) {
|
||||
printf("\tTime up!\n");
|
||||
return rv;
|
||||
}
|
||||
|
||||
if (lrv != 1) {
|
||||
printf("\tIncorrect return count, %d\n", lrv);
|
||||
return rv;
|
||||
}
|
||||
if (descs[0].client_data != sock) {
|
||||
printf("\tWrong socket returned?!\n");
|
||||
return rv;
|
||||
}
|
||||
if ((descs[0].rtnevents & APR_POLLIN) == 0) {
|
||||
printf("\tSocket wasn't ready? huh? req [%08x] vs rtn [%08x]\n",
|
||||
descs[0].reqevents, descs[0].rtnevents);
|
||||
return rv;
|
||||
}
|
||||
rv = apr_ssl_socket_recv(sock, buf, len);
|
||||
if (rv == APR_SUCCESS)
|
||||
printf("\tOK, read %d bytes\n", *len);
|
||||
else
|
||||
printf("\tFailed\n");
|
||||
return rv;
|
||||
}
|
||||
|
||||
static apr_status_t socketWrite(apr_ssl_socket_t *sock,
|
||||
apr_pollset_t *pollset,
|
||||
const char *buf, apr_size_t *len)
|
||||
{
|
||||
int lrv;
|
||||
const apr_pollfd_t *descs = NULL;
|
||||
apr_status_t rv;
|
||||
|
||||
printf("::Writing to socket\n");
|
||||
rv = apr_ssl_socket_set_poll_events(sock, APR_POLLOUT);
|
||||
if (rv != APR_SUCCESS) {
|
||||
printf("\tUnable to change socket poll events!\n");
|
||||
return rv;
|
||||
}
|
||||
|
||||
rv = apr_pollset_poll(pollset, 30 * APR_USEC_PER_SEC, &lrv, &descs);
|
||||
if (APR_STATUS_IS_TIMEUP(rv)) {
|
||||
printf("\tTime up!\n");
|
||||
return rv;
|
||||
}
|
||||
if (lrv != 1) {
|
||||
printf("\tIncorrect return count, %d\n", lrv);
|
||||
return rv;
|
||||
}
|
||||
if (descs[0].client_data != sock) {
|
||||
printf("\tWrong socket returned?!\n");
|
||||
return rv;
|
||||
}
|
||||
if ((descs[0].rtnevents & APR_POLLOUT) == 0) {
|
||||
printf("\tSocket wasn't ready? huh?\n");
|
||||
return rv;
|
||||
}
|
||||
rv = apr_ssl_socket_send(sock, buf, len);
|
||||
if (rv == APR_SUCCESS)
|
||||
printf("\tOK, wrote %d bytes\n", *len);
|
||||
else
|
||||
printf("\tFailed\n");
|
||||
return rv;
|
||||
}
|
||||
|
||||
apr_status_t socketClose(apr_ssl_socket_t *sock, apr_pollset_t *pollset)
|
||||
{
|
||||
apr_status_t rv;
|
||||
printf("::Closing socket\n");
|
||||
rv = apr_pollset_remove_ssl_socket(sock);
|
||||
if (rv != APR_SUCCESS)
|
||||
printf("\tUnable to remove socket from pollset?\n");
|
||||
rv = apr_ssl_socket_close(sock);
|
||||
if (rv != APR_SUCCESS)
|
||||
printf("\tFailed to close SSL socket\n");
|
||||
else
|
||||
printf("\tOK\n");
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, const char * const * argv)
|
||||
{
|
||||
apr_pool_t *pool;
|
||||
apr_ssl_factory_t *asf = NULL;
|
||||
apr_status_t rv;
|
||||
apr_pollset_t *pollset;
|
||||
|
||||
(void) apr_initialize();
|
||||
apr_pool_create(&pool, NULL);
|
||||
atexit(apr_terminate);
|
||||
|
||||
printf("SSL Library: %s\n", apr_ssl_library_name());
|
||||
|
||||
if (apr_pollset_create(&pollset, 1, pool, 0) != APR_SUCCESS) {
|
||||
printf("Failed to create pollset!\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (apr_ssl_factory_create(&asf, NULL, NULL, NULL,
|
||||
APR_SSL_FACTORY_CLIENT, pool) != APR_SUCCESS) {
|
||||
fprintf(stderr, "Unable to create client factory\n");
|
||||
} else {
|
||||
int i;
|
||||
for(i = 0; tests[i].host; i++) {
|
||||
apr_ssl_socket_t *sslSock = createSocket(asf, pollset, pool, 0);
|
||||
if (!sslSock)
|
||||
continue;
|
||||
|
||||
rv = connectSocket(sslSock, tests[i].host, tests[i].port, pool);
|
||||
if (rv == APR_SUCCESS) {
|
||||
apr_size_t len = strlen(tests[i].request);
|
||||
rv = socketWrite(sslSock, pollset, tests[i].request, &len);
|
||||
if (rv == APR_SUCCESS) {
|
||||
char buffer[4096];
|
||||
len = 4096;
|
||||
rv = socketRead(sslSock, pollset, buffer, &len);
|
||||
}
|
||||
}
|
||||
socketClose(sslSock, pollset);
|
||||
}
|
||||
}
|
||||
|
||||
apr_pollset_destroy(pollset);
|
||||
apr_pool_destroy(pool);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user