Only in apr-0.9.20: apr.dep Only in apr-0.9.20: apr.mak diff -ru apr-0.9.19/apr.spec apr-0.9.20/apr.spec --- apr-0.9.19/apr.spec 2010-10-09 09:32:28.000000000 -0400 +++ apr-0.9.20/apr.spec 2011-09-12 21:27:51.000000000 -0400 @@ -3,7 +3,7 @@ Summary: Apache Portable Runtime library Name: apr -Version: 0.9.19 +Version: 0.9.20 Release: 1 License: Apache Software License Group: System Environment/Libraries diff -ru apr-0.9.19/build/aplibtool.c apr-0.9.20/build/aplibtool.c --- apr-0.9.19/build/aplibtool.c 2006-09-20 12:04:09.000000000 -0400 +++ apr-0.9.20/build/aplibtool.c 2011-02-18 07:05:21.000000000 -0500 @@ -528,9 +528,9 @@ for (; *s; ++s) { if (*s == '"' || *s == '\\') { - *d++ = '\\'; - } - *d++ = *s; + *d++ = '\\'; + } + *d++ = *s; } *d = '\0'; Only in apr-0.9.20/build: apr_app.dep Only in apr-0.9.20/build: apr_app.mak diff -ru apr-0.9.19/build/apr_hints.m4 apr-0.9.20/build/apr_hints.m4 --- apr-0.9.19/build/apr_hints.m4 2010-02-06 14:06:58.000000000 -0500 +++ apr-0.9.20/build/apr_hints.m4 2010-12-25 08:54:56.000000000 -0500 @@ -356,7 +356,7 @@ APR_ADDTO(LIBS, [-lbind -lsocket]) ;; esac - APR_ADDTO(CPPFLAGS, [-DSIGPROCMASK_SETS_THREAD_MASK -DAP_AUTH_DBM_USE_APR]) + APR_ADDTO(CPPFLAGS, [-DSIGPROCMASK_SETS_THREAD_MASK]) ;; 4850-*.*) APR_ADDTO(CPPFLAGS, [-DSVR4 -DMPRAS]) Only in apr-0.9.20/build: libapr_app.dep Only in apr-0.9.20/build: libapr_app.mak diff -ru apr-0.9.19/CHANGES apr-0.9.20/CHANGES --- apr-0.9.19/CHANGES 2010-07-26 14:12:11.000000000 -0400 +++ apr-0.9.20/CHANGES 2011-09-12 20:41:55.000000000 -0400 @@ -1,4 +1,16 @@ -*- coding: utf-8 -*- +Changes with APR 0.9.20 + + *) Security: CVE-2011-0419 + Reimplement apr_fnmatch() from scratch using a non-recursive + algorithm; now has improved compliance with the fnmatch() spec. + [William Rowe] + + *) Updated config.guess and config.sub. [Rainer Jung] + + *) Fix flag character '#' in combination with format character 'x' in + apr snprintf implementations. [Rainer Jung] + Changes with APR 0.9.19 *) SECURITY: CVE-2009-2412 (cve.mitre.org) diff -ru apr-0.9.19/configure apr-0.9.20/configure --- apr-0.9.19/configure 2010-10-09 09:32:28.000000000 -0400 +++ apr-0.9.20/configure 2011-09-12 21:27:51.000000000 -0400 @@ -7751,10 +7751,10 @@ esac if test "x$CPPFLAGS" = "x"; then - echo " setting CPPFLAGS to \"-DSIGPROCMASK_SETS_THREAD_MASK -DAP_AUTH_DBM_USE_APR\"" - CPPFLAGS="-DSIGPROCMASK_SETS_THREAD_MASK -DAP_AUTH_DBM_USE_APR" + echo " setting CPPFLAGS to \"-DSIGPROCMASK_SETS_THREAD_MASK\"" + CPPFLAGS="-DSIGPROCMASK_SETS_THREAD_MASK" else - apr_addto_bugger="-DSIGPROCMASK_SETS_THREAD_MASK -DAP_AUTH_DBM_USE_APR" + apr_addto_bugger="-DSIGPROCMASK_SETS_THREAD_MASK" for i in $apr_addto_bugger; do apr_addto_duplicate="0" for j in $CPPFLAGS; do diff -ru apr-0.9.19/file_io/os2/readwrite.c apr-0.9.20/file_io/os2/readwrite.c --- apr-0.9.19/file_io/os2/readwrite.c 2006-09-20 12:04:09.000000000 -0400 +++ apr-0.9.20/file_io/os2/readwrite.c 2011-02-18 07:05:21.000000000 -0500 @@ -140,7 +140,7 @@ apr_thread_mutex_lock(thefile->mutex); if ( thefile->direction == 0 ) { - // Position file pointer for writing at the offset we are logically reading from + /* Position file pointer for writing at the offset we are logically reading from */ ULONG offset = thefile->filePtr - thefile->dataRead + thefile->bufpos; if (offset != thefile->filePtr) DosSetFilePtr(thefile->filedes, offset, FILE_BEGIN, &thefile->filePtr ); @@ -149,7 +149,7 @@ } while (rc == 0 && size > 0) { - if (thefile->bufpos == APR_FILE_BUFSIZE) // write buffer is full + if (thefile->bufpos == APR_FILE_BUFSIZE) /* write buffer is full */ rc = apr_file_flush(thefile); blocksize = size > APR_FILE_BUFSIZE - thefile->bufpos ? APR_FILE_BUFSIZE - thefile->bufpos : size; diff -ru apr-0.9.19/file_io/win32/pipe.c apr-0.9.20/file_io/win32/pipe.c --- apr-0.9.19/file_io/win32/pipe.c 2007-08-28 00:43:39.000000000 -0400 +++ apr-0.9.20/file_io/win32/pipe.c 2011-02-18 07:05:21.000000000 -0500 @@ -42,8 +42,7 @@ return APR_ENOTIMPL; } if (timeout && !(thepipe->pOverlapped)) { - /* Cannot be nonzero if a pipe was opened blocking - */ + /* Cannot be nonzero if a pipe was opened blocking */ return APR_EINVAL; } thepipe->timeout = timeout; @@ -95,7 +94,7 @@ char name[50]; sa.nLength = sizeof(sa); - + #if APR_HAS_UNICODE_FS IF_WIN_OS_IS_UNICODE sa.bInheritHandle = FALSE; @@ -149,10 +148,10 @@ (*in)->filehand = CreateNamedPipe(name, dwOpenMode, dwPipeMode, - 1, //nMaxInstances, - 0, //nOutBufferSize, - 65536, //nInBufferSize, - 1, //nDefaultTimeOut, + 1, /* nMaxInstances, */ + 0, /* nOutBufferSize, */ + 65536, /* nInBufferSize, */ + 1, /* nDefaultTimeOut, */ &sa); /* Create the write end of the pipe */ @@ -163,14 +162,14 @@ (*out)->pOverlapped = (OVERLAPPED*) apr_pcalloc(p, sizeof(OVERLAPPED)); (*out)->pOverlapped->hEvent = CreateEvent(NULL, FALSE, FALSE, NULL); } - + (*out)->filehand = CreateFile(name, - GENERIC_WRITE, // access mode - 0, // share mode - &sa, // Security attributes - OPEN_EXISTING, // dwCreationDisposition - dwOpenMode, // Pipe attributes - NULL); // handle to template file + GENERIC_WRITE, /* access mode */ + 0, /* share mode */ + &sa, /* Security attributes */ + OPEN_EXISTING, /* dwCreationDisposition */ + dwOpenMode, /* Pipe attributes */ + NULL); /* handle to template file */ } else { /* Pipes on Win9* are blocking. Live with it. */ @@ -233,3 +232,4 @@ { return apr_os_pipe_put_ex(file, thefile, 0, pool); } + diff -ru apr-0.9.19/file_io/win32/readwrite.c apr-0.9.20/file_io/win32/readwrite.c --- apr-0.9.19/file_io/win32/readwrite.c 2007-09-01 03:27:07.000000000 -0400 +++ apr-0.9.20/file_io/win32/readwrite.c 2011-02-18 07:05:21.000000000 -0500 @@ -251,7 +251,7 @@ apr_thread_mutex_lock(thefile->mutex); if (thefile->direction == 0) { - // Position file pointer for writing at the offset we are logically reading from + /* Position file pointer for writing at the offset we are logically reading from */ apr_off_t offset = thefile->filePtr - thefile->dataRead + thefile->bufpos; DWORD offlo = (DWORD)offset; DWORD offhi = (DWORD)(offset >> 32); diff -ru apr-0.9.19/include/apr.hnw apr-0.9.20/include/apr.hnw --- apr-0.9.19/include/apr.hnw 2007-10-24 00:43:43.000000000 -0400 +++ apr-0.9.20/include/apr.hnw 2011-03-21 21:23:11.000000000 -0400 @@ -53,11 +53,10 @@ #include #include #include -#include - #ifdef NW_BUILD_IPV6 #include #endif +#include #define _POSIX_THREAD_SAFE_FUNCTIONS 1 #define READDIR_IS_THREAD_SAFE 1 diff -ru apr-0.9.19/include/apr_version.h apr-0.9.20/include/apr_version.h --- apr-0.9.19/include/apr_version.h 2010-10-09 09:25:25.000000000 -0400 +++ apr-0.9.20/include/apr_version.h 2011-09-12 21:22:47.000000000 -0400 @@ -61,7 +61,7 @@ #define APR_MINOR_VERSION 9 /** patch level */ -#define APR_PATCH_VERSION 19 +#define APR_PATCH_VERSION 20 /** * This symbol is defined for internal, "development" copies of APR. This diff -ru apr-0.9.19/include/arch/netware/apr_arch_file_io.h apr-0.9.20/include/arch/netware/apr_arch_file_io.h --- apr-0.9.19/include/arch/netware/apr_arch_file_io.h 2007-05-21 02:49:55.000000000 -0400 +++ apr-0.9.20/include/arch/netware/apr_arch_file_io.h 2011-03-09 19:07:06.000000000 -0500 @@ -151,6 +151,9 @@ apr_status_t apr_unix_file_cleanup(void *); apr_status_t apr_unix_child_file_cleanup(void *); +mode_t apr_unix_perms2mode(apr_fileperms_t perms); +apr_fileperms_t apr_unix_mode2perms(mode_t mode); + apr_status_t apr_file_flush_locked(apr_file_t *thefile); apr_status_t apr_file_info_get_locked(apr_finfo_t *finfo, apr_int32_t wanted, apr_file_t *thefile); diff -ru apr-0.9.19/include/arch/netware/apr_arch_pre_nw.h apr-0.9.20/include/arch/netware/apr_arch_pre_nw.h --- apr-0.9.19/include/arch/netware/apr_arch_pre_nw.h 2006-09-20 12:04:09.000000000 -0400 +++ apr-0.9.20/include/arch/netware/apr_arch_pre_nw.h 2010-12-25 09:42:54.000000000 -0500 @@ -1,16 +1,3 @@ -#ifndef __pre_nw__ -#define __pre_nw__ - -#include - -#ifndef __GNUC__ -#pragma precompile_target "precomp.mch" -#endif - -#define NETWARE - -#define N_PLAT_NLM - /* 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. @@ -26,6 +13,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#ifndef __pre_nw__ +#define __pre_nw__ + +#include + +#ifndef __GNUC__ +#pragma precompile_target "precomp.mch" +#endif + +#define NETWARE + +#define N_PLAT_NLM + #define FAR #define far @@ -51,16 +51,6 @@ #define __int64 long long #endif -/* expat version */ -#define VERSION "expat_1.95.1" -#define EXPAT_MAJOR_VERSION 1 -#define EXPAT_MINOR_VERSION 95 -#define EXPAT_EDIT 2 - -#define XML_MAJOR_VERSION EXPAT_MAJOR_VERSION -#define XML_MINOR_VERSION EXPAT_MINOR_VERSION -#define XML_MICRO_VERSION EXPAT_EDIT - #endif diff -ru apr-0.9.19/include/arch/netware/apr_arch_threadproc.h apr-0.9.20/include/arch/netware/apr_arch_threadproc.h --- apr-0.9.19/include/arch/netware/apr_arch_threadproc.h 2006-09-20 12:04:09.000000000 -0400 +++ apr-0.9.20/include/arch/netware/apr_arch_threadproc.h 2011-02-18 07:05:21.000000000 -0500 @@ -68,11 +68,13 @@ unsigned long value; }; -//struct apr_proc_t { -// apr_pool_t *pool; -// pid_t pid; -// apr_procattr_t *attr; -//}; +/* +struct apr_proc_t { + apr_pool_t *pool; + pid_t pid; + apr_procattr_t *attr; +}; +*/ #endif /* ! THREAD_PROC_H */ diff -ru apr-0.9.19/include/arch/netware/apr_private.h apr-0.9.20/include/arch/netware/apr_private.h --- apr-0.9.19/include/arch/netware/apr_private.h 2006-09-20 12:04:09.000000000 -0400 +++ apr-0.9.20/include/arch/netware/apr_private.h 2011-02-15 06:45:18.000000000 -0500 @@ -66,6 +66,16 @@ #define HAVE_WRITEV 1 +#define HAVE_GETPASS_R 1 +/* + * check for older NDKs which only export the getpassword() function + * which is identical to getpass_r(). + */ +#include +#if (CURRENT_NDK_THRESHOLD < 709060000) +#define getpass_r getpassword +#endif + /*#define DSO_USE_DLFCN */ #ifdef NW_BUILD_IPV6 diff -ru apr-0.9.19/include/arch/os2/apr_arch_file_io.h apr-0.9.20/include/arch/os2/apr_arch_file_io.h --- apr-0.9.19/include/arch/os2/apr_arch_file_io.h 2006-09-20 12:04:09.000000000 -0400 +++ apr-0.9.20/include/arch/os2/apr_arch_file_io.h 2011-02-18 07:05:21.000000000 -0500 @@ -47,11 +47,12 @@ /* Stuff for buffered mode */ char *buffer; - int bufpos; // Read/Write position in buffer - unsigned long dataRead; // amount of valid data read into buffer - int direction; // buffer being used for 0 = read, 1 = write - unsigned long filePtr; // position in file of handle - apr_thread_mutex_t *mutex;// mutex semaphore, must be owned to access the above fields + int bufpos; /* Read/Write position in buffer */ + unsigned long dataRead; /* amount of valid data read into buffer */ + int direction; /* buffer being used for 0 = read, 1 = write */ + unsigned long filePtr; /* position in file of handle */ + apr_thread_mutex_t *mutex; /* mutex semaphore, must be owned to access + the above fields */ }; struct apr_dir_t { diff -ru apr-0.9.19/include/arch/win32/apr_arch_file_io.h apr-0.9.20/include/arch/win32/apr_arch_file_io.h --- apr-0.9.19/include/arch/win32/apr_arch_file_io.h 2007-10-01 19:28:12.000000000 -0400 +++ apr-0.9.20/include/arch/win32/apr_arch_file_io.h 2011-02-18 07:05:21.000000000 -0500 @@ -151,13 +151,13 @@ * correctly when writing to a file with this flag set TRUE. */ -// for apr_poll.c; +/* for apr_poll.c */ #define filedes filehand struct apr_file_t { apr_pool_t *pool; HANDLE filehand; - BOOLEAN pipe; // Is this a pipe of a file? + BOOLEAN pipe; /* Is this a pipe of a file? */ OVERLAPPED *pOverlapped; apr_interval_time_t timeout; apr_int32_t flags; diff -ru apr-0.9.19/include/arch/win32/apr_arch_misc.h apr-0.9.20/include/arch/win32/apr_arch_misc.h --- apr-0.9.19/include/arch/win32/apr_arch_misc.h 2006-09-20 12:04:09.000000000 -0400 +++ apr-0.9.20/include/arch/win32/apr_arch_misc.h 2011-02-18 07:05:21.000000000 -0500 @@ -65,7 +65,7 @@ */ extern int APR_DECLARE_DATA apr_app_init_complete; -int apr_wastrtoastr(char const * const * *retarr, +int apr_wastrtoastr(char const * const * *retarr, wchar_t const * const *arr, int args); /* Platform specific designation of run time os version. @@ -73,34 +73,34 @@ * export new kernel or winsock functions or behavior. */ typedef enum { - APR_WIN_UNK = 0, - APR_WIN_UNSUP = 1, - APR_WIN_95 = 10, - APR_WIN_95_B = 11, - APR_WIN_95_OSR2 = 12, - APR_WIN_98 = 14, - APR_WIN_98_SE = 16, - APR_WIN_ME = 18, - - APR_WIN_UNICODE = 20, /* Prior versions support only narrow chars */ - - APR_WIN_CE_3 = 23, /* CE is an odd beast, not supporting */ - /* some pre-NT features, such as the */ - APR_WIN_NT = 30, /* narrow charset APIs (fooA fns), while */ - APR_WIN_NT_3_5 = 35, /* not supporting some NT-family features. */ - APR_WIN_NT_3_51 = 36, - - APR_WIN_NT_4 = 40, - APR_WIN_NT_4_SP2 = 42, - APR_WIN_NT_4_SP3 = 43, - APR_WIN_NT_4_SP4 = 44, - APR_WIN_NT_4_SP5 = 45, - APR_WIN_NT_4_SP6 = 46, - - APR_WIN_2000 = 50, - APR_WIN_2000_SP1 = 51, - APR_WIN_2000_SP2 = 52, - APR_WIN_XP = 60 + APR_WIN_UNK = 0, + APR_WIN_UNSUP = 1, + APR_WIN_95 = 10, + APR_WIN_95_B = 11, + APR_WIN_95_OSR2 = 12, + APR_WIN_98 = 14, + APR_WIN_98_SE = 16, + APR_WIN_ME = 18, + + APR_WIN_UNICODE = 20, /* Prior versions support only narrow chars */ + + APR_WIN_CE_3 = 23, /* CE is an odd beast, not supporting */ + /* some pre-NT features, such as the */ + APR_WIN_NT = 30, /* narrow charset APIs (fooA fns), while */ + APR_WIN_NT_3_5 = 35, /* not supporting some NT-family features. */ + APR_WIN_NT_3_51 = 36, + + APR_WIN_NT_4 = 40, + APR_WIN_NT_4_SP2 = 42, + APR_WIN_NT_4_SP3 = 43, + APR_WIN_NT_4_SP4 = 44, + APR_WIN_NT_4_SP5 = 45, + APR_WIN_NT_4_SP6 = 46, + + APR_WIN_2000 = 50, + APR_WIN_2000_SP1 = 51, + APR_WIN_2000_SP2 = 52, + APR_WIN_XP = 60 } apr_oslevel_e; extern APR_DECLARE_DATA apr_oslevel_e apr_os_level; @@ -136,13 +136,13 @@ #endif /* WINNT */ typedef enum { - DLL_WINBASEAPI = 0, // kernel32 From WinBase.h - DLL_WINADVAPI = 1, // advapi32 From WinBase.h - DLL_WINSOCKAPI = 2, // mswsock From WinSock.h - DLL_WINSOCK2API = 3, // ws2_32 From WinSock2.h - DLL_SHSTDAPI = 4, // shell32 From ShellAPI.h - DLL_NTDLL = 5, // shell32 From our real kernel - DLL_defined = 6 // must define as last idx_ + 1 + DLL_WINBASEAPI = 0, /* kernel32 From WinBase.h */ + DLL_WINADVAPI = 1, /* advapi32 From WinBase.h */ + DLL_WINSOCKAPI = 2, /* mswsock From WinSock.h */ + DLL_WINSOCK2API = 3, /* ws2_32 From WinSock2.h */ + DLL_SHSTDAPI = 4, /* shell32 From ShellAPI.h */ + DLL_NTDLL = 5, /* shell32 From our real kernel */ + DLL_defined = 6 /* must define as last idx_ + 1 */ } apr_dlltoken_e; FARPROC apr_load_dll_func(apr_dlltoken_e fnLib, char *fnName, int ordinal); @@ -232,8 +232,8 @@ OUT PACL *ppDacl, OUT PACL *ppSacl, OUT PSECURITY_DESCRIPTOR *ppSecurityDescriptor), - (pObjectName, ObjectType, SecurityInfo, ppsidOwner, ppsidGroup, - ppDacl, ppSacl, ppSecurityDescriptor)); + (pObjectName, ObjectType, SecurityInfo, ppsidOwner, ppsidGroup, + ppDacl, ppSacl, ppSecurityDescriptor)); #define GetNamedSecurityInfoW apr_winapi_GetNamedSecurityInfoW APR_DECLARE_LATE_DLL_FUNC(DLL_WINADVAPI, BOOL, WINAPI, GetNamedSecurityInfoA, 0, ( @@ -245,8 +245,8 @@ OUT PACL *ppDacl, OUT PACL *ppSacl, OUT PSECURITY_DESCRIPTOR *ppSecurityDescriptor), - (pObjectName, ObjectType, SecurityInfo, ppsidOwner, ppsidGroup, - ppDacl, ppSacl, ppSecurityDescriptor)); + (pObjectName, ObjectType, SecurityInfo, ppsidOwner, ppsidGroup, + ppDacl, ppSacl, ppSecurityDescriptor)); #define GetNamedSecurityInfoA apr_winapi_GetNamedSecurityInfoA #undef GetNamedSecurityInfo #define GetNamedSecurityInfo apr_winapi_GetNamedSecurityInfoA @@ -260,12 +260,12 @@ OUT PACL *ppDacl, OUT PACL *ppSacl, OUT PSECURITY_DESCRIPTOR *ppSecurityDescriptor), - (handle, ObjectType, SecurityInfo, ppsidOwner, ppsidGroup, - ppDacl, ppSacl, ppSecurityDescriptor)); + (handle, ObjectType, SecurityInfo, ppsidOwner, ppsidGroup, + ppDacl, ppSacl, ppSecurityDescriptor)); #define GetSecurityInfo apr_winapi_GetSecurityInfo APR_DECLARE_LATE_DLL_FUNC(DLL_SHSTDAPI, LPWSTR *, WINAPI, CommandLineToArgvW, 0, ( - LPCWSTR lpCmdLine, + LPCWSTR lpCmdLine, int *pNumArgs), (lpCmdLine, pNumArgs)); #define CommandLineToArgvW apr_winapi_CommandLineToArgvW Only in apr-0.9.20: libapr.dep Only in apr-0.9.20: libapr.mak diff -ru apr-0.9.19/libapr.rc apr-0.9.20/libapr.rc --- apr-0.9.19/libapr.rc 2009-07-01 23:07:37.000000000 -0400 +++ apr-0.9.20/libapr.rc 2011-01-03 11:04:17.000000000 -0500 @@ -1,7 +1,7 @@ #include "apr_general.h" #include "apr_version.h" -#define APR_COPYRIGHT "Copyright (c) 2009 The Apache Software " \ +#define APR_COPYRIGHT "Copyright (c) 2011 The Apache Software " \ "Foundation or its licensors, as applicable." #define APR_LICENSE "Licensed under the Apache License, Version 2.0 " \ diff -ru apr-0.9.19/locks/os2/proc_mutex.c apr-0.9.20/locks/os2/proc_mutex.c --- apr-0.9.19/locks/os2/proc_mutex.c 2006-09-20 12:04:09.000000000 -0400 +++ apr-0.9.20/locks/os2/proc_mutex.c 2011-02-18 07:05:21.000000000 -0500 @@ -32,7 +32,7 @@ if (fname == NULL) semname = NULL; else { - // Semaphores don't live in the file system, fix up the name + /* Semaphores don't live in the file system, fix up the name */ while (*fname == '/' || *fname == '\\') { fname++; } diff -ru apr-0.9.19/misc/netware/libprews.c apr-0.9.20/misc/netware/libprews.c --- apr-0.9.19/misc/netware/libprews.c 2006-09-20 12:04:09.000000000 -0400 +++ apr-0.9.20/misc/netware/libprews.c 2011-03-21 19:08:04.000000000 -0400 @@ -16,10 +16,10 @@ #include #include #include -#include "novsock2.h" #include "apr_pools.h" #include "apr_private.h" +#include "apr_arch_internal_time.h" /* library-private data...*/ diff -ru apr-0.9.19/misc/netware/start.c apr-0.9.20/misc/netware/start.c --- apr-0.9.19/misc/netware/start.c 2006-09-20 12:04:09.000000000 -0400 +++ apr-0.9.20/misc/netware/start.c 2011-03-09 20:33:24.000000000 -0500 @@ -23,6 +23,17 @@ #include "apr_arch_proc_mutex.h" /* for apr_proc_mutex_unix_setup_lock() */ #include "apr_arch_internal_time.h" +/* Prototypes missing from older NDKs */ +int WSAStartupRTags(WORD wVersionRequested, + LPWSADATA lpWSAData, + rtag_t WSAStartupRTag, + rtag_t WSPSKTRTag, + rtag_t lookUpServiceBeginRTag, + rtag_t WSAEventRTag, + rtag_t WSPCPRTag); + +int WSACleanupRTag(rtag_t rTag); + /* ** Resource tag signatures for using NetWare WinSock 2. These will no longer ** be needed by anyone once the new WSAStartupWithNlmHandle() is available diff -ru apr-0.9.19/network_io/win32/sockopt.c apr-0.9.20/network_io/win32/sockopt.c --- apr-0.9.19/network_io/win32/sockopt.c 2006-09-20 12:04:09.000000000 -0400 +++ apr-0.9.20/network_io/win32/sockopt.c 2011-03-09 21:17:06.000000000 -0500 @@ -20,7 +20,7 @@ #include "apr_strings.h" #include -apr_status_t soblock(SOCKET sd) +static apr_status_t soblock(SOCKET sd) { u_long zero = 0; @@ -30,7 +30,7 @@ return APR_SUCCESS; } -apr_status_t sononblock(SOCKET sd) +static apr_status_t sononblock(SOCKET sd) { u_long one = 1; diff -ru apr-0.9.19/NOTICE apr-0.9.20/NOTICE --- apr-0.9.19/NOTICE 2009-07-01 23:07:37.000000000 -0400 +++ apr-0.9.20/NOTICE 2011-01-03 11:04:17.000000000 -0500 @@ -1,5 +1,5 @@ Apache Portable Runtime -Copyright (c) 2009 The Apache Software Foundation. +Copyright (c) 2011 The Apache Software Foundation. This product includes software developed by The Apache Software Foundation (http://www.apache.org/). diff -ru apr-0.9.19/NWGNUmakefile apr-0.9.20/NWGNUmakefile --- apr-0.9.19/NWGNUmakefile 2004-11-24 18:02:04.000000000 -0500 +++ apr-0.9.20/NWGNUmakefile 2011-03-18 23:13:19.000000000 -0400 @@ -1,10 +1,26 @@ # +# Define our macros with defaults if we dont got them already. +# +ifndef APR_WORK +export APR_WORK = $(CURDIR) +endif +ifneq "$(wildcard $(APR_WORK)/include/apr_version.h)" "$(APR_WORK)/include/apr_version.h" +$(error APR_WORK does not point to a valid APR source tree) +endif +ifndef APU_WORK +export APU_WORK = $(CURDIR)/../apr-util +endif +ifneq "$(wildcard $(APU_WORK)/include/apu_version.h)" "$(APU_WORK)/include/apu_version.h" +$(error APU_WORK does not point to a valid APU source tree) +endif + +# # Declare the sub-directories to be built here # SUBDIRS = \ build \ diff -ru apr-0.9.19/passwd/apr_getpass.c apr-0.9.20/passwd/apr_getpass.c --- apr-0.9.19/passwd/apr_getpass.c 2006-09-20 12:04:09.000000000 -0400 +++ apr-0.9.20/passwd/apr_getpass.c 2011-03-21 15:35:24.000000000 -0400 @@ -34,9 +34,13 @@ #include #endif #if APR_HAVE_CONIO_H +#ifdef _MSC_VER #pragma warning(disable: 4032) #include #pragma warning(default: 4032) +#else +#include +#endif #endif #if APR_HAVE_STDLIB_H #include @@ -48,6 +52,16 @@ #include #endif +/* Disable getpass() support when PASS_MAX is defined and is "small", + * for an arbitrary definition of "small". + * HP-UX truncates passwords (PR49496) so we disable getpass() for + * this platform too. + */ +#if defined(HAVE_GETPASS) && \ + (defined(PASS_MAX) && PASS_MAX < 32) || defined(__hpux) || defined(__hpux__) +#undef HAVE_GETPASS +#endif + #if defined(HAVE_TERMIOS_H) && !defined(HAVE_GETPASS) #include #endif @@ -64,7 +78,7 @@ #define ERR_OVERFLOW 5 -#ifndef HAVE_GETPASS +#if !defined(HAVE_GETPASS) && !defined(HAVE_GETPASSPHRASE) && !defined(HAVE_GETPASS_R) /* MPE, Win32, NetWare and BeOS all lack a native getpass() */ @@ -74,7 +88,7 @@ * issue the prompt and read the results with echo. (Ugh). */ -static char *getpass(const char *prompt) +static char *get_password(const char *prompt) { static char password[MAX_STRING_LEN]; @@ -87,20 +101,20 @@ #elif defined (HAVE_TERMIOS_H) #include -static char *getpass(const char *prompt) +static char *get_password(const char *prompt) { struct termios attr; static char password[MAX_STRING_LEN]; int n=0; fputs(prompt, stderr); fflush(stderr); - + if (tcgetattr(STDIN_FILENO, &attr) != 0) return NULL; attr.c_lflag &= ~(ECHO); if (tcsetattr(STDIN_FILENO, TCSAFLUSH, &attr) != 0) - return NULL; + return NULL; while ((password[n] = getchar()) != '\n') { if (n < sizeof(password) - 1 && password[n] >= ' ' && password[n] <= '~') { n++; @@ -129,7 +143,7 @@ * Windows lacks getpass(). So we'll re-implement it here. */ -static char *getpass(const char *prompt) +static char *get_password(const char *prompt) { /* WCE lacks console. So the getpass is unsuported * The only way is to use the GUI so the getpass should be implemented @@ -174,7 +188,7 @@ fputs("^Z\n", stderr); return NULL; } - else if (ch == 27) /* ESC */ { + else if (ch == 27) /* ESC */ { fputc('\n', stderr); fputs(prompt, stderr); n = 0; @@ -183,7 +197,7 @@ password[n++] = ch; fputc('*', stderr); } - else { + else { fputc('\a', stderr); } } @@ -196,11 +210,11 @@ #endif /* no getchar or _getch */ -#endif /* no getpass */ +#endif /* no getpass or getpassphrase or getpass_r */ /* - * Use the OS getpass() routine (or our own) to obtain a password from - * the input stream. + * Use the OS getpass() / getpass_r() / getpassphrase() routine (or our own) + * to obtain a password from the input stream. * * Exit values: * 0: Success @@ -215,17 +229,27 @@ APR_DECLARE(apr_status_t) apr_password_get(const char *prompt, char *pwbuf, apr_size_t *bufsiz) { -#ifdef HAVE_GETPASSPHRASE - char *pw_got = getpassphrase(prompt); + apr_status_t rv = APR_SUCCESS; +#if defined(HAVE_GETPASS_R) + if (getpass_r(prompt, pwbuf, *bufsiz) == NULL) + return APR_EINVAL; #else +#if defined(HAVE_GETPASSPHRASE) + char *pw_got = getpassphrase(prompt); +#elif defined(HAVE_GETPASS) char *pw_got = getpass(prompt); +#else /* use the replacement implementation above */ + char *pw_got = get_password(prompt); #endif + if (!pw_got) return APR_EINVAL; - apr_cpystrn(pwbuf, pw_got, *bufsiz); - memset(pw_got, 0, strlen(pw_got)); if (strlen(pw_got) >= *bufsiz) { - return APR_ENAMETOOLONG; + rv = APR_ENAMETOOLONG; } - return APR_SUCCESS; + apr_cpystrn(pwbuf, pw_got, *bufsiz); + memset(pw_got, 0, strlen(pw_got)); +#endif /* HAVE_GETPASS_R */ + return rv; } + diff -ru apr-0.9.19/strings/apr_fnmatch.c apr-0.9.20/strings/apr_fnmatch.c --- apr-0.9.19/strings/apr_fnmatch.c 2004-11-24 18:02:04.000000000 -0500 +++ apr-0.9.20/strings/apr_fnmatch.c 2011-05-28 13:45:54.000000000 -0400 @@ -1,247 +1,439 @@ -/* - * Copyright (c) 1989, 1993, 1994 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Guido van Rossum. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ +/* 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. + */ + -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)fnmatch.c 8.2 (Berkeley) 4/16/94"; -#endif /* LIBC_SCCS and not lint */ - -/* - * Function fnmatch() as specified in POSIX 1003.2-1992, section B.6. - * Compares a filename or pathname to a pattern. +/* Derived from The Open Group Base Specifications Issue 7, IEEE Std 1003.1-2008 + * as described in; + * http://pubs.opengroup.org/onlinepubs/9699919799/functions/fnmatch.html + * + * Filename pattern matches defined in section 2.13, "Pattern Matching Notation" + * from chapter 2. "Shell Command Language" + * http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_13 + * where; 1. A bracket expression starting with an unquoted '^' + * character CONTINUES to specify a non-matching list; 2. an explicit '.' + * in a bracket expression matching list, e.g. "[.abc]" does NOT match a leading + * in a filename; 3. a '[' which does not introduce + * a valid bracket expression is treated as an ordinary character; 4. a differing + * number of consecutive slashes within pattern and string will NOT match; + * 5. a trailing '\' in FNM_ESCAPE mode is treated as an ordinary '\' character. + * + * Bracket expansion defined in section 9.3.5, "RE Bracket Expression", + * from chapter 9, "Regular Expressions" + * http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_03_05 + * with no support for collating symbols, equivalence class expressions or + * character class expressions. A partial range expression with a leading + * hyphen following a valid range expression will match only the ordinary + * and the ending character (e.g. "[a-m-z]" will match characters + * 'a' through 'm', a '-', or a 'z'). + * + * NOTE: Only POSIX/C single byte locales are correctly supported at this time. + * Notably, non-POSIX locales with FNM_CASEFOLD produce undefined results, + * particularly in ranges of mixed case (e.g. "[A-z]") or spanning alpha and + * nonalpha characters within a range. + * + * XXX comments below indicate porting required for multi-byte character sets + * and non-POSIX locale collation orders; requires mbr* APIs to track shift + * state of pattern and string (rewinding pattern and string repeatedly). + * + * Certain parts of the code assume 0x00-0x3F are unique with any MBCS (e.g. + * UTF-8, SHIFT-JIS, etc). Any implementation allowing '\' as an alternate + * path delimiter must be aware that 0x5C is NOT unique within SHIFT-JIS. */ -#ifndef WIN32 -#include "apr_private.h" -#endif + +#include "apr_file_info.h" #include "apr_fnmatch.h" +#include "apr_tables.h" #include "apr_lib.h" +#include "apr_strings.h" #include #if APR_HAVE_CTYPE_H # include #endif -#define EOS '\0' - -static const char *rangematch(const char *, int, int); -APR_DECLARE(apr_status_t) apr_fnmatch(const char *pattern, const char *string, int flags) +/* Most MBCS/collation/case issues handled here. Wildcard '*' is not handled. + * EOS '\0' and the FNM_PATHNAME '/' delimiters are not advanced over, + * however the "\/" sequence is advanced to '/'. + * + * Both pattern and string are **char to support pointer increment of arbitrary + * multibyte characters for the given locale, in a later iteration of this code + */ +static APR_INLINE int fnmatch_ch(const char **pattern, const char **string, int flags) { - const char *stringstart; - char c, test; - - for (stringstart = string;;) { - switch (c = *pattern++) { - case EOS: - return (*string == EOS ? APR_SUCCESS : APR_FNM_NOMATCH); - case '?': - if (*string == EOS) { - return (APR_FNM_NOMATCH); - } - if (*string == '/' && (flags & APR_FNM_PATHNAME)) { - return (APR_FNM_NOMATCH); - } - if (*string == '.' && (flags & APR_FNM_PERIOD) && - (string == stringstart || - ((flags & APR_FNM_PATHNAME) && *(string - 1) == '/'))) { - return (APR_FNM_NOMATCH); - } - ++string; - break; - case '*': - c = *pattern; - /* Collapse multiple stars. */ - while (c == '*') { - c = *++pattern; - } - - if (*string == '.' && (flags & APR_FNM_PERIOD) && - (string == stringstart || - ((flags & APR_FNM_PATHNAME) && *(string - 1) == '/'))) { - return (APR_FNM_NOMATCH); - } - - /* Optimize for pattern with * at end or before /. */ - if (c == EOS) { - if (flags & APR_FNM_PATHNAME) { - return (strchr(string, '/') == NULL ? APR_SUCCESS : APR_FNM_NOMATCH); - } - else { - return (APR_SUCCESS); - } - } - else if (c == '/' && flags & APR_FNM_PATHNAME) { - if ((string = strchr(string, '/')) == NULL) { - return (APR_FNM_NOMATCH); - } - break; - } - - /* General case, use recursion. */ - while ((test = *string) != EOS) { - if (!apr_fnmatch(pattern, string, flags & ~APR_FNM_PERIOD)) { - return (APR_SUCCESS); - } - if (test == '/' && flags & APR_FNM_PATHNAME) { - break; - } - ++string; - } - return (APR_FNM_NOMATCH); - case '[': - if (*string == EOS) { - return (APR_FNM_NOMATCH); - } - if (*string == '/' && flags & APR_FNM_PATHNAME) { - return (APR_FNM_NOMATCH); - } - if (*string == '.' && (flags & APR_FNM_PERIOD) && - (string == stringstart || - ((flags & APR_FNM_PATHNAME) && *(string - 1) == '/'))) { - return (APR_FNM_NOMATCH); - } - if ((pattern = rangematch(pattern, *string, flags)) == NULL) { - return (APR_FNM_NOMATCH); - } - ++string; - break; - case '\\': - if (!(flags & APR_FNM_NOESCAPE)) { - if ((c = *pattern++) == EOS) { - c = '\\'; - --pattern; - } - } - /* FALLTHROUGH */ - default: - if (flags & APR_FNM_CASE_BLIND) { - if (apr_tolower(c) != apr_tolower(*string)) { - return (APR_FNM_NOMATCH); - } - } - else if (c != *string) { - return (APR_FNM_NOMATCH); - } - string++; - break; - } - /* NOTREACHED */ + const char * const mismatch = *pattern; + const int nocase = !!(flags & APR_FNM_CASE_BLIND); + const int escape = !(flags & APR_FNM_NOESCAPE); + const int slash = !!(flags & APR_FNM_PATHNAME); + int result = APR_FNM_NOMATCH; + const char *startch; + int negate; + + if (**pattern == '[') + { + ++*pattern; + + /* Handle negation, either leading ! or ^ operators (never both) */ + negate = ((**pattern == '!') || (**pattern == '^')); + if (negate) + ++*pattern; + + /* ']' is an ordinary character at the start of the range pattern */ + if (**pattern == ']') + goto leadingclosebrace; + + while (**pattern) + { + if (**pattern == ']') { + ++*pattern; + /* XXX: Fix for MBCS character width */ + ++*string; + return (result ^ negate); + } + + if (escape && (**pattern == '\\')) { + ++*pattern; + + /* Patterns must be terminated with ']', not EOS */ + if (!**pattern) + break; + } + + /* Patterns must be terminated with ']' not '/' */ + if (slash && (**pattern == '/')) + break; + +leadingclosebrace: + /* Look at only well-formed range patterns; + * "x-]" is not allowed unless escaped ("x-\]") + * XXX: Fix for locale/MBCS character width + */ + if (((*pattern)[1] == '-') && ((*pattern)[2] != ']')) + { + startch = *pattern; + *pattern += (escape && ((*pattern)[2] == '\\')) ? 3 : 2; + + /* NOT a properly balanced [expr] pattern, EOS terminated + * or ranges containing a slash in FNM_PATHNAME mode pattern + * fall out to to the rewind and test '[' literal code path + */ + if (!**pattern || (slash && (**pattern == '/'))) + break; + + /* XXX: handle locale/MBCS comparison, advance by MBCS char width */ + if ((**string >= *startch) && (**string <= **pattern)) + result = 0; + else if (nocase && (isupper(**string) || isupper(*startch) + || isupper(**pattern)) + && (tolower(**string) >= tolower(*startch)) + && (tolower(**string) <= tolower(**pattern))) + result = 0; + + ++*pattern; + continue; + } + + /* XXX: handle locale/MBCS comparison, advance by MBCS char width */ + if ((**string == **pattern)) + result = 0; + else if (nocase && (isupper(**string) || isupper(**pattern)) + && (tolower(**string) == tolower(**pattern))) + result = 0; + + ++*pattern; + } + + /* NOT a properly balanced [expr] pattern; Rewind + * and reset result to test '[' literal + */ + *pattern = mismatch; + result = APR_FNM_NOMATCH; } + else if (**pattern == '?') { + /* Optimize '?' match before unescaping **pattern */ + if (!**string || (slash && (**string == '/'))) + return APR_FNM_NOMATCH; + result = 0; + goto fnmatch_ch_success; + } + else if (escape && (**pattern == '\\') && (*pattern)[1]) { + ++*pattern; + } + + /* XXX: handle locale/MBCS comparison, advance by the MBCS char width */ + if (**string == **pattern) + result = 0; + else if (nocase && (isupper(**string) || isupper(**pattern)) + && (tolower(**string) == tolower(**pattern))) + result = 0; + + /* Refuse to advance over trailing slash or nulls + */ + if (!**string || !**pattern || (slash && ((**string == '/') || (**pattern == '/')))) + return result; + +fnmatch_ch_success: + ++*pattern; + ++*string; + return result; } -static const char *rangematch(const char *pattern, int test, int flags) -{ - int negate, ok; - char c, c2; - /* - * A bracket expression starting with an unquoted circumflex - * character produces unspecified results (IEEE 1003.2-1992, - * 3.13.2). This implementation treats it like '!', for - * consistency with the regular expression syntax. - * J.T. Conklin (conklin@ngai.kaleida.com) +APR_DECLARE(int) apr_fnmatch(const char *pattern, const char *string, int flags) +{ + static const char dummystring[2] = {' ', 0}; + const int escape = !(flags & APR_FNM_NOESCAPE); + const int slash = !!(flags & APR_FNM_PATHNAME); + const char *strendseg; + const char *dummyptr; + const char *matchptr; + int wild; + /* For '*' wild processing only; surpress 'used before initialization' + * warnings with dummy initialization values; */ - if ((negate = (*pattern == '!' || *pattern == '^'))) { - ++pattern; + const char *strstartseg = NULL; + const char *mismatch = NULL; + int matchlen = 0; + + if (*pattern == '*') + goto firstsegment; + + while (*pattern && *string) + { + /* Pre-decode "\/" which has no special significance, and + * match balanced slashes, starting a new segment pattern + */ + if (slash && escape && (*pattern == '\\') && (pattern[1] == '/')) + ++pattern; + if (slash && (*pattern == '/') && (*string == '/')) { + ++pattern; + ++string; + } + +firstsegment: + /* At the beginning of each segment, validate leading period behavior. + */ + if ((flags & APR_FNM_PERIOD) && (*string == '.')) + { + if (*pattern == '.') + ++pattern; + else if (escape && (*pattern == '\\') && (pattern[1] == '.')) + pattern += 2; + else + return APR_FNM_NOMATCH; + ++string; + } + + /* Determine the end of string segment + * + * Presumes '/' character is unique, not composite in any MBCS encoding + */ + if (slash) { + strendseg = strchr(string, '/'); + if (!strendseg) + strendseg = strchr(string, '\0'); + } + else { + strendseg = strchr(string, '\0'); + } + + /* Allow pattern '*' to be consumed even with no remaining string to match + */ + while (*pattern) + { + if ((string > strendseg) + || ((string == strendseg) && (*pattern != '*'))) + break; + + if (slash && ((*pattern == '/') + || (escape && (*pattern == '\\') + && (pattern[1] == '/')))) + break; + + /* Reduce groups of '*' and '?' to n '?' matches + * followed by one '*' test for simplicity + */ + for (wild = 0; ((*pattern == '*') || (*pattern == '?')); ++pattern) + { + if (*pattern == '*') { + wild = 1; + } + else if (string < strendseg) { /* && (*pattern == '?') */ + /* XXX: Advance 1 char for MBCS locale */ + ++string; + } + else { /* (string >= strendseg) && (*pattern == '?') */ + return APR_FNM_NOMATCH; + } + } + + if (wild) + { + strstartseg = string; + mismatch = pattern; + + /* Count fixed (non '*') char matches remaining in pattern + * excluding '/' (or "\/") and '*' + */ + for (matchptr = pattern, matchlen = 0; 1; ++matchlen) + { + if ((*matchptr == '\0') + || (slash && ((*matchptr == '/') + || (escape && (*matchptr == '\\') + && (matchptr[1] == '/'))))) + { + /* Compare precisely this many trailing string chars, + * the resulting match needs no wildcard loop + */ + /* XXX: Adjust for MBCS */ + if (string + matchlen > strendseg) + return APR_FNM_NOMATCH; + + string = strendseg - matchlen; + wild = 0; + break; + } + + if (*matchptr == '*') + { + /* Ensure at least this many trailing string chars remain + * for the first comparison + */ + /* XXX: Adjust for MBCS */ + if (string + matchlen > strendseg) + return APR_FNM_NOMATCH; + + /* Begin first wild comparison at the current position */ + break; + } + + /* Skip forward in pattern by a single character match + * Use a dummy fnmatch_ch() test to count one "[range]" escape + */ + /* XXX: Adjust for MBCS */ + if (escape && (*matchptr == '\\') && matchptr[1]) { + matchptr += 2; + } + else if (*matchptr == '[') { + dummyptr = dummystring; + fnmatch_ch(&matchptr, &dummyptr, flags); + } + else { + ++matchptr; + } + } + } + + /* Incrementally match string against the pattern + */ + while (*pattern && (string < strendseg)) + { + /* Success; begin a new wild pattern search + */ + if (*pattern == '*') + break; + + if (slash && ((*string == '/') + || (*pattern == '/') + || (escape && (*pattern == '\\') + && (pattern[1] == '/')))) + break; + + /* Compare ch's (the pattern is advanced over "\/" to the '/', + * but slashes will mismatch, and are not consumed) + */ + if (!fnmatch_ch(&pattern, &string, flags)) + continue; + + /* Failed to match, loop against next char offset of string segment + * until not enough string chars remain to match the fixed pattern + */ + if (wild) { + /* XXX: Advance 1 char for MBCS locale */ + string = ++strstartseg; + if (string + matchlen > strendseg) + return APR_FNM_NOMATCH; + + pattern = mismatch; + continue; + } + else + return APR_FNM_NOMATCH; + } + } + + if (*string && !(slash && (*string == '/'))) + return APR_FNM_NOMATCH; + + if (*pattern && !(slash && ((*pattern == '/') + || (escape && (*pattern == '\\') + && (pattern[1] == '/'))))) + return APR_FNM_NOMATCH; } - for (ok = 0; (c = *pattern++) != ']';) { - if (c == '\\' && !(flags & APR_FNM_NOESCAPE)) { - c = *pattern++; - } - if (c == EOS) { - return (NULL); - } - if (*pattern == '-' && (c2 = *(pattern + 1)) != EOS && c2 != ']') { - pattern += 2; - if (c2 == '\\' && !(flags & APR_FNM_NOESCAPE)) { - c2 = *pattern++; - } - if (c2 == EOS) { - return (NULL); - } - if ((c <= test && test <= c2) - || ((flags & APR_FNM_CASE_BLIND) - && ((apr_tolower(c) <= apr_tolower(test)) - && (apr_tolower(test) <= apr_tolower(c2))))) { - ok = 1; - } - } - else if ((c == test) - || ((flags & APR_FNM_CASE_BLIND) - && (apr_tolower(c) == apr_tolower(test)))) { - ok = 1; - } - } - return (ok == negate ? NULL : pattern); + /* Where both pattern and string are at EOS, declare success + */ + if (!*string && !*pattern) + return 0; + + /* pattern didn't match to the end of string */ + return APR_FNM_NOMATCH; } -/* This function is an Apache addition */ -/* return non-zero if pattern has any glob chars in it */ +/* This function is an Apache addition + * return non-zero if pattern has any glob chars in it + * @bug Function does not distinguish for FNM_PATHNAME mode, which renders + * a false positive for test[/]this (which is not a range, but + * seperate test[ and ]this segments and no glob.) + * @bug Function does not distinguish for non-FNM_ESCAPE mode. + * @bug Function does not parse []] correctly + * Solution may be to use fnmatch_ch() to walk the patterns? + */ APR_DECLARE(int) apr_fnmatch_test(const char *pattern) { int nesting; nesting = 0; while (*pattern) { - switch (*pattern) { - case '?': - case '*': - return 1; - - case '\\': - if (*pattern++ == '\0') { - return 0; - } - break; - - case '[': /* '[' is only a glob if it has a matching ']' */ - ++nesting; - break; - - case ']': - if (nesting) { - return 1; - } - break; - } - ++pattern; - } + switch (*pattern) { + case '?': + case '*': + return 1; + + case '\\': + if (*++pattern == '\0') { + return 0; + } + break; + + case '[': /* '[' is only a glob if it has a matching ']' */ + ++nesting; + break; + + case ']': + if (nesting) { + return 1; + } + break; + } + ++pattern; } return 0; } + /* Deprecated */ APR_DECLARE(int) apr_is_fnmatch(const char *pattern) { diff -ru apr-0.9.19/strings/apr_snprintf.c apr-0.9.20/strings/apr_snprintf.c --- apr-0.9.19/strings/apr_snprintf.c 2008-05-27 00:57:11.000000000 -0400 +++ apr-0.9.20/strings/apr_snprintf.c 2011-07-29 13:32:01.000000000 -0400 @@ -694,7 +694,7 @@ widest_int i_quad = (widest_int) 0; u_widest_int ui_quad; wide_int i_num = (wide_int) 0; - u_wide_int ui_num; + u_wide_int ui_num = (u_wide_int) 0; char num_buf[NUM_BUF_SIZE]; char char_buf[2]; /* for printing %% and % */ @@ -931,7 +931,7 @@ &num_buf[NUM_BUF_SIZE], &s_len); } FIX_PRECISION(adjust_precision, precision, s, s_len); - if (alternate_form && i_num != 0) { + if (alternate_form && ui_num != 0) { *--s = *fmt; /* 'x' or 'X' */ *--s = '0'; s_len += 2; Only in apr-0.9.20/test: testapp.dep Only in apr-0.9.20/test: testapp.mak Only in apr-0.9.20/test: testappnt.dep Only in apr-0.9.20/test: testappnt.mak diff -ru apr-0.9.19/threadproc/netware/proc.c apr-0.9.20/threadproc/netware/proc.c --- apr-0.9.19/threadproc/netware/proc.c 2006-09-20 12:04:09.000000000 -0400 +++ apr-0.9.20/threadproc/netware/proc.c 2011-03-09 19:59:42.000000000 -0500 @@ -21,7 +21,7 @@ #include -apr_status_t apr_netware_proc_cleanup(void *theproc) +static apr_status_t apr_netware_proc_cleanup(void *theproc) { apr_proc_t *proc = theproc; int exit_int; @@ -407,8 +407,10 @@ return errno; } -APR_DECLARE(apr_status_t) apr_procattr_limit_set(apr_procattr_t *attr, apr_int32_t what, - struct rlimit *limit) +#if APR_HAVE_STRUCT_RLIMIT +APR_DECLARE(apr_status_t) apr_procattr_limit_set(apr_procattr_t *attr, + apr_int32_t what, + struct rlimit *limit) { switch(what) { case APR_LIMIT_CPU: @@ -418,13 +420,15 @@ #else return APR_ENOTIMPL; #endif + case APR_LIMIT_MEM: -#if defined (RLIMIT_DATA) || defined (RLIMIT_VMEM) || defined(RLIMIT_AS) +#if defined(RLIMIT_DATA) || defined(RLIMIT_VMEM) || defined(RLIMIT_AS) attr->limit_mem = limit; break; #else return APR_ENOTIMPL; #endif + case APR_LIMIT_NPROC: #ifdef RLIMIT_NPROC attr->limit_nproc = limit; @@ -432,7 +436,17 @@ #else return APR_ENOTIMPL; #endif + + case APR_LIMIT_NOFILE: +#ifdef RLIMIT_NOFILE + attr->limit_nofile = limit; + break; +#else + return APR_ENOTIMPL; +#endif + } return APR_SUCCESS; } +#endif /* APR_HAVE_STRUCT_RLIMIT */ diff -ru apr-0.9.19/threadproc/netware/signals.c apr-0.9.20/threadproc/netware/signals.c --- apr-0.9.19/threadproc/netware/signals.c 2006-09-20 12:04:09.000000000 -0400 +++ apr-0.9.20/threadproc/netware/signals.c 2011-03-09 19:59:42.000000000 -0500 @@ -15,7 +15,6 @@ */ #include "apr_arch_threadproc.h" -#include #include "apr_private.h" #include "apr_pools.h" #include "apr_signal.h" @@ -64,12 +63,12 @@ return NULL; } +#if (APR_HAVE_SIGWAIT || APR_HAVE_SIGSUSPEND) APR_DECLARE(apr_status_t) apr_setup_signal_thread(void) { - int rv = 0; - - return rv; + return 0; } +#endif /* (APR_HAVE_SIGWAIT || APR_HAVE_SIGSUSPEND) */ /* Deprecated */ const char *apr_signal_get_description(int signum) diff -ru apr-0.9.19/threadproc/netware/thread.c apr-0.9.20/threadproc/netware/thread.c --- apr-0.9.19/threadproc/netware/thread.c 2006-09-20 12:04:09.000000000 -0400 +++ apr-0.9.20/threadproc/netware/thread.c 2011-02-18 07:05:21.000000000 -0500 @@ -41,7 +41,7 @@ apr_status_t apr_threadattr_detach_set(apr_threadattr_t *attr,apr_int32_t on) { attr->detach = on; - return APR_SUCCESS; + return APR_SUCCESS; } apr_status_t apr_threadattr_detach_get(apr_threadattr_t *attr) @@ -65,21 +65,21 @@ } apr_status_t apr_thread_create(apr_thread_t **new, - apr_threadattr_t *attr, - apr_thread_start_t func, - void *data, - apr_pool_t *pool) + apr_threadattr_t *attr, + apr_thread_start_t func, + void *data, + apr_pool_t *pool) { apr_status_t stat; long flags = NX_THR_BIND_CONTEXT; - char threadName[NX_MAX_OBJECT_NAME_LEN+1]; + char threadName[NX_MAX_OBJECT_NAME_LEN+1]; size_t stack_size = APR_DEFAULT_STACK_SIZE; if (attr && attr->thread_name) { strncpy (threadName, attr->thread_name, NX_MAX_OBJECT_NAME_LEN); } else { - sprintf(threadName, "APR_thread %04ld", ++thread_count); + sprintf(threadName, "APR_thread %04ld", ++thread_count); } /* An original stack size of 0 will allow NXCreateThread() to @@ -112,27 +112,26 @@ } (*new)->ctx = NXContextAlloc( - /* void(*start_routine)(void *arg)*/(void (*)(void *)) dummy_worker, - /* void *arg */ (*new), - /* int priority */ NX_PRIO_MED, - /* NXSize_t stackSize */ stack_size, - /* long flags */ NX_CTX_NORMAL, - /* int *error */ &stat); - - - stat = NXContextSetName( - /* NXContext_t ctx */ (*new)->ctx, - /* const char *name */ threadName); - - stat = NXThreadCreate( - /* NXContext_t context */ (*new)->ctx, - /* long flags */ flags, - /* NXThreadId_t *thread_id */ &(*new)->td); + /* void(*start_routine)(void *arg) */ (void (*)(void *)) dummy_worker, + /* void *arg */ (*new), + /* int priority */ NX_PRIO_MED, + /* NXSize_t stackSize */ stack_size, + /* long flags */ NX_CTX_NORMAL, + /* int *error */ &stat); + + stat = NXContextSetName( + /* NXContext_t ctx */ (*new)->ctx, + /* const char *name */ threadName); + + stat = NXThreadCreate( + /* NXContext_t context */ (*new)->ctx, + /* long flags */ flags, + /* NXThreadId_t *thread_id */ &(*new)->td); - if(stat==0) - return APR_SUCCESS; + if (stat == 0) + return APR_SUCCESS; - return(stat);// if error + return(stat); /* if error */ } apr_os_thread_t apr_os_thread_current() diff -ru apr-0.9.19/threadproc/unix/proc.c apr-0.9.20/threadproc/unix/proc.c --- apr-0.9.19/threadproc/unix/proc.c 2006-09-20 12:04:09.000000000 -0400 +++ apr-0.9.20/threadproc/unix/proc.c 2011-03-09 19:48:05.000000000 -0500 @@ -581,6 +581,7 @@ return errno; } +#if APR_HAVE_STRUCT_RLIMIT APR_DECLARE(apr_status_t) apr_procattr_limit_set(apr_procattr_t *attr, apr_int32_t what, struct rlimit *limit) @@ -595,7 +596,7 @@ #endif case APR_LIMIT_MEM: -#if defined (RLIMIT_DATA) || defined (RLIMIT_VMEM) || defined(RLIMIT_AS) +#if defined(RLIMIT_DATA) || defined(RLIMIT_VMEM) || defined(RLIMIT_AS) attr->limit_mem = limit; break; #else @@ -622,3 +623,5 @@ return APR_SUCCESS; } +#endif /* APR_HAVE_STRUCT_RLIMIT */ +