modsecurity-apache_2.7.7/0000775000175000017500000000000012254306022015627 5ustar zimmerlezimmerlemodsecurity-apache_2.7.7/iis/0000775000175000017500000000000012253711345016422 5ustar zimmerlezimmerlemodsecurity-apache_2.7.7/iis/mymodule.h0000664000175000017500000000306112243422537020427 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #ifndef __MY_MODULE_H__ #define __MY_MODULE_H__ // The module implementation. // This class is responsible for implementing the // module functionality for each of the server events // that it registers for. class CMyHttpModule : public CHttpModule { public: HANDLE m_hEventLog; DWORD m_dwPageSize; CRITICAL_SECTION m_csLock; REQUEST_NOTIFICATION_STATUS OnBeginRequest( IN IHttpContext * pHttpContext, IN IHttpEventProvider * pProvider ); REQUEST_NOTIFICATION_STATUS OnSendResponse( IN IHttpContext * pHttpContext, IN ISendResponseProvider * pProvider ); REQUEST_NOTIFICATION_STATUS OnPostEndRequest( IN IHttpContext * pHttpContext, IN IHttpEventProvider * pProvider ); HRESULT ReadFileChunk(HTTP_DATA_CHUNK *chunk, char *buf); CMyHttpModule(); ~CMyHttpModule(); void Dispose(); BOOL WriteEventViewerLog(LPCSTR szNotification, WORD category = EVENTLOG_INFORMATION_TYPE); }; #endif modsecurity-apache_2.7.7/iis/ModSecurityIIS.vcxproj0000775000175000017500000003534312253711345022666 0ustar zimmerlezimmerle Debug Win32 Debug x64 Release Win32 Release x64 {D1F7201F-064B-48AB-868C-FED22464841C} ModSecurityIIS ModSecurityIIS Application v120 Application v120 DynamicLibrary v120 DynamicLibrary v120 <_ProjectFileVersion>10.0.40219.1 $(SolutionDir)$(Configuration)\ $(SolutionDir)$(Configuration)\ $(Configuration)\ $(Configuration)\ $(Configuration)\ $(Configuration)\ AllRules.ruleset AllRules.ruleset AllRules.ruleset AllRules.ruleset .dll .dll .dll Disabled dependencies\build_dir\pcre\include;dependencies\build_dir\pcre;dependencies\build_dir\libxml2\include;dependencies\build_dir\apache24\include;..\apache2;..\standalone _MBCS;%(PreprocessorDefinitions);WIN32;WINNT;inline=APR_INLINE;AP_DECLARE_STATIC;VERSION_IIS NotUsing precomp.h $(IntDir)$(TargetName).pch ProgramDatabase mymodule.def true kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;ws2_32.lib;%(AdditionalDependencies);dependencies\build_dir\apache24\lib\libapr-1.lib;dependencies\build_dir\apache24\lib\libaprutil-1.lib;dependencies\build_dir\pcre\pcre.lib;dependencies\build_dir\libxml2\win32\bin.msvc\libxml2.lib Disabled dependencies\build_dir\pcre\include;dependencies\build_dir\pcre;dependencies\build_dir\libxml2\include;..\apache2;..\standalone;dependencies\build_dir\apache24\include _MBCS;%(PreprocessorDefinitions);WIN32;WINNT;inline=APR_INLINE;AP_DECLARE_STATIC NotUsing precomp.h $(IntDir)$(TargetName).pch ProgramDatabase mymodule.def true kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;ws2_32.lib;%(AdditionalDependencies);dependencies\build_dir\apache24\lib\libapr-1.lib;dependencies\build_dir\apache24\lib\libaprutil-1.lib;dependencies\build_dir\pcre\pcre.lib;dependencies\build_dir\libxml2\win32\bin.msvc\libxml2.lib C:\core__\ModSecurity\iis\release\x64 /LIBPATH:"C:\core__\ModSecurity\iis\release\x64" %(AdditionalOptions) _MBCS;%(PreprocessorDefinitions);WIN32;WINNT;inline=APR_INLINE;AP_DECLARE_STATIC;VERSION_IIS NotUsing dependencies\build_dir\pcre\include;dependencies\build_dir\pcre;dependencies\build_dir\libxml2\include;..\apache2;..\standalone mymodule.def kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;ws2_32.lib;%(AdditionalDependencies);dependencies\build_dir\apache24\lib\libapr-1.lib;dependencies\build_dir\apache24\lib\libaprutil-1.lib;dependencies\build_dir\pcre\pcre.lib;dependencies\build_dir\libxml2\win32\bin.msvc\libxml2.lib _MBCS;%(PreprocessorDefinitions);WIN32;WINNT;inline=APR_INLINE;AP_DECLARE_STATIC NotUsing dependencies\build_dir\pcre\include;dependencies\build_dir\pcre;dependencies\build_dir\libxml2\include;..\apache2;..\standalone;dependencies\build_dir\apache24\include mymodule.def kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;ws2_32.lib;%(AdditionalDependencies);dependencies\build_dir\apache24\lib\libapr-1.lib;dependencies\build_dir\apache24\lib\libaprutil-1.lib;dependencies\build_dir\pcre\pcre.lib;dependencies\build_dir\libxml2\win32\bin.msvc\libxml2.lib false Designer true modsecurity-apache_2.7.7/iis/build_modsecurity.bat0000664000175000017500000000307112253711345022641 0ustar zimmerlezimmerle set DEPENDENCIES_DIR=dependencies\build_dir set OUTPUT_DIR=dependencies\release_files set CURRENT_DIR=%cd% @echo Checking for vcargs... %1 @if NOT (%1) == "" call %1 @if (%ERRORLEVEL%) == (1) goto build_wrong_vcarg @echo Deleting old stuff... @del *.obj *.dll *.lib @echo apache2... cd ..\apache2 del *.obj *.dll *.lib del libinjection\*.obj libinjection\*.dll libinjection\*.lib NMAKE -f Makefile.win APACHE=..\iis\%DEPENDENCIES_DIR%\Apache24 PCRE=..\iis\%DEPENDENCIES_DIR%\pcre LIBXML2=..\iis\%DEPENDENCIES_DIR%\libxml2 LUA=..\iis\%DEPENDENCIES_DIR%\lua\src VERSION=VERSION_IIS @if NOT (%ERRORLEVEL%) == (0) goto build_failed @echo mlogc... cd ..\mlogc del *.obj *.dll *.lib nmake -f Makefile.win clean nmake -f Makefile.win APACHE=..\iis\%DEPENDENCIES_DIR%\Apache24 PCRE=..\iis\%DEPENDENCIES_DIR%\pcre CURL=..\iis\%DEPENDENCIES_DIR%\curl VERSION=VERSION_IIS @if NOT (%ERRORLEVEL%) == (0) goto build_failed @echo iis... cd ..\iis del *.obj *.dll *.lib nmake -f Makefile.win clean NMAKE -f Makefile.win APACHE=..\iis\%DEPENDENCIES_DIR%\Apache24 PCRE=..\iis\%DEPENDENCIES_DIR%\pcre LIBXML2=..\iis\%DEPENDENCIES_DIR%\libxml2 LUA=..\iis\%DEPENDENCIES_DIR%\lua\src VERSION=VERSION_IIS @if NOT (%ERRORLEVEL%) == (0) goto build_failed cd %CURRENT_DIR% @echo Copy... copy /y ..\mlogc\mlogc.exe %OUTPUT_DIR% copy /y ..\iis\modsecurityiis.dll %OUTPUT_DIR% copy /y ..\iis\modsecurityiis.pdb %OUTPUT_DIR% exit /B 0 :build_wrong_vcargs @echo Please specify a valid vcargs @goto failed :build_failed @echo Problems during the building phase @goto failed :failed @cd %CURRENT_DIR% @exit /B 1 modsecurity-apache_2.7.7/iis/moduleconfig.h0000664000175000017500000000563612243422537021261 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #pragma once #define MODSECURITY_SECTION L"system.webServer/ModSecurity" #define MODSECURITY_SECTION_ENABLED L"enabled" #define MODSECURITY_SECTION_CONFIGFILE L"configFile" extern IHttpServer * g_pHttpServer; extern PVOID g_pModuleContext; class MODSECURITY_STORED_CONTEXT : public IHttpStoredContext { public: MODSECURITY_STORED_CONTEXT(); ~MODSECURITY_STORED_CONTEXT(); static HRESULT GetConfig( IHttpContext * pContext, MODSECURITY_STORED_CONTEXT ** ppModuleConfig ); // virtual VOID CleanupStoredContext( VOID ) { delete this; } BOOL GetIsEnabled() { return m_bIsEnabled; } WCHAR* GetPath() { return m_pszPath; } HRESULT Initialize( IHttpContext * pW3Context, IAppHostConfigException ** ppException ); DWORD GlobalWideCharToMultiByte( WCHAR* pSource, DWORD dwLengthSource, CHAR** ppszDestination, USHORT* pdwLengthDestination ); void* m_Config; DWORD m_dwLastCheck; FILETIME m_LastChange; private: HRESULT GetBooleanPropertyValue( IAppHostElement* pElement, WCHAR* pszPropertyName, IAppHostPropertyException** pException, BOOL* pBoolValue ); HRESULT GetDWORDPropertyValue( IAppHostElement* pElement, WCHAR* pszPropertyName, IAppHostPropertyException** pException, DWORD* pnValue ); HRESULT GetTimeSpanPropertyValue( IAppHostElement* pElement, WCHAR* pszPropertyName, IAppHostPropertyException** pException, ULONGLONG* pnValue ); HRESULT GetStringPropertyValue( IAppHostElement* pElement, WCHAR* pszPropertyName, IAppHostPropertyException** pException, WCHAR** ppszValue ); BOOL m_bIsEnabled; WCHAR* m_pszPath; }; modsecurity-apache_2.7.7/iis/mymodule.def0000664000175000017500000000007112243422537020734 0ustar zimmerlezimmerleLIBRARY "ModSecurityIIS" EXPORTS RegisterModule modsecurity-apache_2.7.7/iis/mymodule.cpp0000664000175000017500000011373512243422537020774 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #define WIN32_LEAN_AND_MEAN #undef inline #define inline inline // IIS7 Server API header file #include #include #include #include "httpserv.h" // Project header files #include "mymodule.h" #include "mymodulefactory.h" #include "api.h" #include "moduleconfig.h" #include "winsock2.h" class REQUEST_STORED_CONTEXT : public IHttpStoredContext { public: REQUEST_STORED_CONTEXT() { m_pConnRec = NULL; m_pRequestRec = NULL; m_pHttpContext = NULL; m_pProvider = NULL; m_pResponseBuffer = NULL; m_pResponseLength = 0; m_pResponsePosition = 0; } ~REQUEST_STORED_CONTEXT() { FinishRequest(); } // virtual VOID CleanupStoredContext( VOID ) { FinishRequest(); delete this; } void FinishRequest() { if(m_pRequestRec != NULL) { modsecFinishRequest(m_pRequestRec); m_pRequestRec = NULL; m_pConnRec = NULL; } } conn_rec *m_pConnRec; request_rec *m_pRequestRec; IHttpContext *m_pHttpContext; IHttpEventProvider *m_pProvider; char *m_pResponseBuffer; ULONGLONG m_pResponseLength; ULONGLONG m_pResponsePosition; }; //---------------------------------------------------------------------------- char *GetIpAddr(apr_pool_t *pool, PSOCKADDR pAddr) { DWORD len = 50; char *buf = (char *)apr_palloc(pool, len); if(buf == NULL) return ""; buf[0] = 0; WSAAddressToString(pAddr, sizeof(SOCKADDR), NULL, buf, &len); return buf; } apr_sockaddr_t *CopySockAddr(apr_pool_t *pool, PSOCKADDR pAddr) { apr_sockaddr_t *addr = (apr_sockaddr_t *)apr_palloc(pool, sizeof(apr_sockaddr_t)); int adrlen = 16, iplen = 4; if(pAddr->sa_family == AF_INET6) { adrlen = 46; iplen = 16; } addr->addr_str_len = adrlen; addr->family = pAddr->sa_family; addr->hostname = "unknown"; #ifdef WIN32 addr->ipaddr_len = sizeof(IN_ADDR); #else addr->ipaddr_len = sizeof(struct in_addr); #endif addr->ipaddr_ptr = &addr->sa.sin.sin_addr; addr->pool = pool; addr->port = 80; #ifdef WIN32 memcpy(&addr->sa.sin.sin_addr.S_un.S_addr, pAddr->sa_data, iplen); #else memcpy(&addr->sa.sin.sin_addr.s_addr, pAddr->sa_data, iplen); #endif addr->sa.sin.sin_family = pAddr->sa_family; addr->sa.sin.sin_port = 80; addr->salen = sizeof(addr->sa); addr->servname = addr->hostname; return addr; } //---------------------------------------------------------------------------- char *ZeroTerminate(const char *str, size_t len, apr_pool_t *pool) { char *_n = (char *)apr_palloc(pool, len + 1); memcpy(_n, str, len); _n[len] = 0; return _n; } //---------------------------------------------------------------------------- // FUNCTION: ConvertUTF16ToUTF8 // DESC: Converts Unicode UTF-16 (Windows default) text to Unicode UTF-8. //---------------------------------------------------------------------------- char *ConvertUTF16ToUTF8( __in const WCHAR * pszTextUTF16, size_t cchUTF16, apr_pool_t *pool ) { // // Special case of NULL or empty input string // if ( (pszTextUTF16 == NULL) || (*pszTextUTF16 == L'\0') || cchUTF16 == 0 ) { // Return empty string return ""; } // // Get size of destination UTF-8 buffer, in CHAR's (= bytes) // int cbUTF8 = ::WideCharToMultiByte( CP_UTF8, // convert to UTF-8 0, // specify conversion behavior pszTextUTF16, // source UTF-16 string static_cast( cchUTF16 ), // total source string length, in WCHAR's, NULL, // unused - no conversion required in this step 0, // request buffer size NULL, NULL // unused ); if ( cbUTF8 == 0 ) { return ""; } // // Allocate destination buffer for UTF-8 string // int cchUTF8 = cbUTF8; // sizeof(CHAR) = 1 byte char *pszUTF8 = (char *)apr_palloc(pool, cchUTF8 + 1 ); // // Do the conversion from UTF-16 to UTF-8 // int result = ::WideCharToMultiByte( CP_UTF8, // convert to UTF-8 0, // specify conversion behavior pszTextUTF16, // source UTF-16 string static_cast( cchUTF16 ), // total source string length, in WCHAR's, // including end-of-string \0 pszUTF8, // destination buffer cbUTF8, // destination buffer size, in bytes NULL, NULL // unused ); if ( result == 0 ) { return ""; } pszUTF8[cchUTF8] = 0; return pszUTF8; } void Log(void *obj, int level, char *str) { CMyHttpModule *mod = (CMyHttpModule *)obj; WORD logcat = EVENTLOG_INFORMATION_TYPE; level &= APLOG_LEVELMASK; if(level <= APLOG_ERR) logcat = EVENTLOG_ERROR_TYPE; if(level == APLOG_WARNING || strstr(str, "Warning.") != NULL) logcat = EVENTLOG_WARNING_TYPE; mod->WriteEventViewerLog(str, logcat); } #define NOTE_IIS "iis-tx-context" void StoreIISContext(request_rec *r, REQUEST_STORED_CONTEXT *rsc) { apr_table_setn(r->notes, NOTE_IIS, (const char *)rsc); } REQUEST_STORED_CONTEXT *RetrieveIISContext(request_rec *r) { REQUEST_STORED_CONTEXT *msr = NULL; request_rec *rx = NULL; /* Look in the current request first. */ msr = (REQUEST_STORED_CONTEXT *)apr_table_get(r->notes, NOTE_IIS); if (msr != NULL) { //msr->r = r; return msr; } /* If this is a subrequest then look in the main request. */ if (r->main != NULL) { msr = (REQUEST_STORED_CONTEXT *)apr_table_get(r->main->notes, NOTE_IIS); if (msr != NULL) { //msr->r = r; return msr; } } /* If the request was redirected then look in the previous requests. */ rx = r->prev; while(rx != NULL) { msr = (REQUEST_STORED_CONTEXT *)apr_table_get(rx->notes, NOTE_IIS); if (msr != NULL) { //msr->r = r; return msr; } rx = rx->prev; } return NULL; } HRESULT CMyHttpModule::ReadFileChunk(HTTP_DATA_CHUNK *chunk, char *buf) { OVERLAPPED ovl; DWORD dwDataStartOffset; ULONGLONG bytesTotal = 0; BYTE * pIoBuffer = NULL; HANDLE hIoEvent = INVALID_HANDLE_VALUE; HRESULT hr = S_OK; pIoBuffer = (BYTE *)VirtualAlloc(NULL, 1, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); if (pIoBuffer == NULL) { hr = HRESULT_FROM_WIN32(GetLastError()); goto Done; } hIoEvent = CreateEvent(NULL, // security attr FALSE, // manual reset FALSE, // initial state NULL); // name if (hIoEvent == NULL) { hr = HRESULT_FROM_WIN32(GetLastError()); goto Done; } while(bytesTotal < chunk->FromFileHandle.ByteRange.Length.QuadPart) { DWORD bytesRead = 0; int was_eof = 0; ULONGLONG offset = chunk->FromFileHandle.ByteRange.StartingOffset.QuadPart + bytesTotal; ZeroMemory(&ovl, sizeof ovl); ovl.hEvent = hIoEvent; ovl.Offset = (DWORD)offset; dwDataStartOffset = ovl.Offset & (m_dwPageSize - 1); ovl.Offset &= ~(m_dwPageSize - 1); ovl.OffsetHigh = offset >> 32; if (!ReadFile(chunk->FromFileHandle.FileHandle, pIoBuffer, m_dwPageSize, &bytesRead, &ovl)) { DWORD dwErr = GetLastError(); switch (dwErr) { case ERROR_IO_PENDING: // // GetOverlappedResult can return without waiting for the // event thus leaving it signalled and causing problems // with future use of that event handle, so just wait ourselves // WaitForSingleObject(ovl.hEvent, INFINITE); // == WAIT_OBJECT_0); if (!GetOverlappedResult( chunk->FromFileHandle.FileHandle, &ovl, &bytesRead, TRUE)) { dwErr = GetLastError(); switch(dwErr) { case ERROR_HANDLE_EOF: was_eof = 1; break; default: hr = HRESULT_FROM_WIN32(dwErr); goto Done; } } break; case ERROR_HANDLE_EOF: was_eof = 1; break; default: hr = HRESULT_FROM_WIN32(dwErr); goto Done; } } bytesRead -= dwDataStartOffset; if (bytesRead > chunk->FromFileHandle.ByteRange.Length.QuadPart) { bytesRead = (DWORD)chunk->FromFileHandle.ByteRange.Length.QuadPart; } if ((bytesTotal + bytesRead) > chunk->FromFileHandle.ByteRange.Length.QuadPart) { bytesRead = chunk->FromFileHandle.ByteRange.Length.QuadPart - bytesTotal; } memcpy(buf, pIoBuffer + dwDataStartOffset, bytesRead); buf += bytesRead; bytesTotal += bytesRead; if(was_eof != 0) chunk->FromFileHandle.ByteRange.Length.QuadPart = bytesTotal; } Done: if(NULL != pIoBuffer) { VirtualFree(pIoBuffer, 0, MEM_RELEASE); } if(INVALID_HANDLE_VALUE != hIoEvent) { CloseHandle(hIoEvent); } return hr; } REQUEST_NOTIFICATION_STATUS CMyHttpModule::OnSendResponse( IN IHttpContext * pHttpContext, IN ISendResponseProvider * pResponseProvider ) { REQUEST_STORED_CONTEXT *rsc = NULL; rsc = (REQUEST_STORED_CONTEXT *)pHttpContext->GetModuleContextContainer()->GetModuleContext(g_pModuleContext); EnterCriticalSection(&m_csLock); // here we must check if response body processing is enabled // if(rsc == NULL || rsc->m_pRequestRec == NULL || rsc->m_pResponseBuffer != NULL || !modsecIsResponseBodyAccessEnabled(rsc->m_pRequestRec)) { goto Exit; } HRESULT hr = S_OK; IHttpResponse *pHttpResponse = NULL; HTTP_RESPONSE *pRawHttpResponse = NULL; HTTP_BYTE_RANGE *pFileByteRange = NULL; HTTP_DATA_CHUNK *pSourceDataChunk = NULL; LARGE_INTEGER lFileSize; REQUEST_NOTIFICATION_STATUS ret = RQ_NOTIFICATION_CONTINUE; ULONGLONG ulTotalLength = 0; DWORD c; request_rec *r = rsc->m_pRequestRec; pHttpResponse = pHttpContext->GetResponse(); pRawHttpResponse = pHttpResponse->GetRawHttpResponse(); // here we must add handling of chunked response // apparently IIS 7 calls this handler once per chunk // see: http://stackoverflow.com/questions/4385249/how-to-buffer-and-process-chunked-data-before-sending-headers-in-iis7-native-mod if(pRawHttpResponse->EntityChunkCount == 0) goto Exit; // here we must transfer response headers // USHORT ctcch = 0; char *ct = (char *)pHttpResponse->GetHeader(HttpHeaderContentType, &ctcch); char *ctz = ZeroTerminate(ct, ctcch, r->pool); // assume HTML if content type not set // without this output filter would not buffer response and processing would hang // if(ctz[0] == 0) ctz = "text/html"; r->content_type = ctz; #define _TRANSHEADER(id,str) if(pRawHttpResponse->Headers.KnownHeaders[id].pRawValue != NULL) \ {\ apr_table_setn(r->headers_out, str, \ ZeroTerminate(pRawHttpResponse->Headers.KnownHeaders[id].pRawValue, pRawHttpResponse->Headers.KnownHeaders[id].RawValueLength, r->pool)); \ } _TRANSHEADER(HttpHeaderCacheControl, "Cache-Control"); _TRANSHEADER(HttpHeaderConnection, "Connection"); _TRANSHEADER(HttpHeaderDate, "Date"); _TRANSHEADER(HttpHeaderKeepAlive, "Keep-Alive"); _TRANSHEADER(HttpHeaderPragma, "Pragma"); _TRANSHEADER(HttpHeaderTrailer, "Trailer"); _TRANSHEADER(HttpHeaderTransferEncoding, "Transfer-Encoding"); _TRANSHEADER(HttpHeaderUpgrade, "Upgrade"); _TRANSHEADER(HttpHeaderVia, "Via"); _TRANSHEADER(HttpHeaderWarning, "Warning"); _TRANSHEADER(HttpHeaderAllow, "Allow"); _TRANSHEADER(HttpHeaderContentLength, "Content-Length"); _TRANSHEADER(HttpHeaderContentType, "Content-Type"); _TRANSHEADER(HttpHeaderContentEncoding, "Content-Encoding"); _TRANSHEADER(HttpHeaderContentLanguage, "Content-Language"); _TRANSHEADER(HttpHeaderContentLocation, "Content-Location"); _TRANSHEADER(HttpHeaderContentMd5, "Content-Md5"); _TRANSHEADER(HttpHeaderContentRange, "Content-Range"); _TRANSHEADER(HttpHeaderExpires, "Expires"); _TRANSHEADER(HttpHeaderLastModified, "Last-Modified"); _TRANSHEADER(HttpHeaderAcceptRanges, "Accept-Ranges"); _TRANSHEADER(HttpHeaderAge, "Age"); _TRANSHEADER(HttpHeaderEtag, "Etag"); _TRANSHEADER(HttpHeaderLocation, "Location"); _TRANSHEADER(HttpHeaderProxyAuthenticate, "Proxy-Authenticate"); _TRANSHEADER(HttpHeaderRetryAfter, "Retry-After"); _TRANSHEADER(HttpHeaderServer, "Server"); _TRANSHEADER(HttpHeaderSetCookie, "Set-Cookie"); _TRANSHEADER(HttpHeaderVary, "Vary"); _TRANSHEADER(HttpHeaderWwwAuthenticate, "Www-Authenticate"); #undef _TRANSHEADER for(int i = 0; i < pRawHttpResponse->Headers.UnknownHeaderCount; i++) { apr_table_setn(r->headers_out, ZeroTerminate(pRawHttpResponse->Headers.pUnknownHeaders[i].pName, pRawHttpResponse->Headers.pUnknownHeaders[i].NameLength, r->pool), ZeroTerminate(pRawHttpResponse->Headers.pUnknownHeaders[i].pRawValue, pRawHttpResponse->Headers.pUnknownHeaders[i].RawValueLength, r->pool)); } r->content_encoding = apr_table_get(r->headers_out, "Content-Encoding"); //r->content_type = apr_table_get(r->headers_out, "Content-Type"); -- already set above const char *lng = apr_table_get(r->headers_out, "Content-Languages"); if(lng != NULL) { r->content_languages = apr_array_make(r->pool, 1, sizeof(const char *)); *(const char **)apr_array_push(r->content_languages) = lng; } // Disable kernel caching for this response // Probably we don't have to do it for ModSecurity //pHttpContext->GetResponse()->DisableKernelCache( // IISCacheEvents::HTTPSYS_CACHEABLE::HANDLER_HTTPSYS_UNFRIENDLY); for(c = 0; c < pRawHttpResponse->EntityChunkCount; c++ ) { pSourceDataChunk = &pRawHttpResponse->pEntityChunks[ c ]; switch( pSourceDataChunk->DataChunkType ) { case HttpDataChunkFromMemory: ulTotalLength += pSourceDataChunk->FromMemory.BufferLength; break; case HttpDataChunkFromFileHandle: pFileByteRange = &pSourceDataChunk->FromFileHandle.ByteRange; // // File chunks may contain by ranges with unspecified length // (HTTP_BYTE_RANGE_TO_EOF). In order to send parts of such a chunk, // its necessary to know when the chunk is finished, and // we need to move to the next chunk. // if ( pFileByteRange->Length.QuadPart == HTTP_BYTE_RANGE_TO_EOF) { if ( GetFileType( pSourceDataChunk->FromFileHandle.FileHandle ) == FILE_TYPE_DISK ) { if ( !GetFileSizeEx( pSourceDataChunk->FromFileHandle.FileHandle, &lFileSize ) ) { DWORD dwError = GetLastError(); hr = HRESULT_FROM_WIN32(dwError); goto Finished; } // put the resolved file length in the chunk, replacing // HTTP_BYTE_RANGE_TO_EOF pFileByteRange->Length.QuadPart = lFileSize.QuadPart - pFileByteRange->StartingOffset.QuadPart; } else { hr = HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED); goto Finished; } } ulTotalLength += pFileByteRange->Length.QuadPart; break; default: // TBD: consider implementing HttpDataChunkFromFragmentCache, // and HttpDataChunkFromFragmentCacheEx hr = HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED); goto Finished; } } rsc->m_pResponseBuffer = (char *)apr_palloc(rsc->m_pRequestRec->pool, ulTotalLength); ulTotalLength = 0; for(c = 0; c < pRawHttpResponse->EntityChunkCount; c++ ) { pSourceDataChunk = &pRawHttpResponse->pEntityChunks[ c ]; switch( pSourceDataChunk->DataChunkType ) { case HttpDataChunkFromMemory: memcpy(rsc->m_pResponseBuffer + ulTotalLength, pSourceDataChunk->FromMemory.pBuffer, pSourceDataChunk->FromMemory.BufferLength); ulTotalLength += pSourceDataChunk->FromMemory.BufferLength; break; case HttpDataChunkFromFileHandle: pFileByteRange = &pSourceDataChunk->FromFileHandle.ByteRange; if(ReadFileChunk(pSourceDataChunk, rsc->m_pResponseBuffer + ulTotalLength) != S_OK) { DWORD dwErr = GetLastError(); hr = HRESULT_FROM_WIN32(dwErr); goto Finished; } ulTotalLength += pFileByteRange->Length.QuadPart; break; default: // TBD: consider implementing HttpDataChunkFromFragmentCache, // and HttpDataChunkFromFragmentCacheEx hr = HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED); goto Finished; } } rsc->m_pResponseLength = ulTotalLength; // // If there's no content-length set, we need to set it to avoid chunked transfer mode // We can only do it if there is it's the only response to be sent. // DWORD dwFlags = pResponseProvider->GetFlags(); if (pResponseProvider->GetHeadersBeingSent() && (dwFlags & HTTP_SEND_RESPONSE_FLAG_MORE_DATA) == 0 && pHttpContext->GetResponse()->GetHeader(HttpHeaderContentLength) == NULL) { CHAR szLength[21]; //Max length for a 64 bit int is 20 ZeroMemory(szLength, sizeof(szLength)); hr = StringCchPrintfA( szLength, sizeof(szLength) / sizeof(CHAR) - 1, "%d", ulTotalLength); if(FAILED(hr)) { goto Finished; } hr = pHttpContext->GetResponse()->SetHeader( HttpHeaderContentLength, szLength, (USHORT)strlen(szLength), TRUE); if(FAILED(hr)) { goto Finished; } } Finished: int status = modsecProcessResponse(rsc->m_pRequestRec); // the logic here is temporary, needs clarification // if(status != 0 && status != -1) { pHttpContext->GetResponse()->Clear(); pHttpContext->GetResponse()->SetStatus(status, "ModSecurity Action"); pHttpContext->SetRequestHandled(); rsc->FinishRequest(); LeaveCriticalSection(&m_csLock); return RQ_NOTIFICATION_FINISH_REQUEST; } Exit: // temporary hack, in reality OnSendRequest theoretically could possibly come before OnEndRequest // if(rsc != NULL) rsc->FinishRequest(); LeaveCriticalSection(&m_csLock); return RQ_NOTIFICATION_CONTINUE; } REQUEST_NOTIFICATION_STATUS CMyHttpModule::OnPostEndRequest( IN IHttpContext * pHttpContext, IN IHttpEventProvider * pProvider ) { REQUEST_STORED_CONTEXT *rsc = NULL; rsc = (REQUEST_STORED_CONTEXT *)pHttpContext->GetModuleContextContainer()->GetModuleContext(g_pModuleContext); // only finish request if OnSendResponse have been called already // if(rsc != NULL && rsc->m_pResponseBuffer != NULL) { EnterCriticalSection(&m_csLock); rsc->FinishRequest(); LeaveCriticalSection(&m_csLock); } return RQ_NOTIFICATION_CONTINUE; } REQUEST_NOTIFICATION_STATUS CMyHttpModule::OnBeginRequest( IN IHttpContext * pHttpContext, IN IHttpEventProvider * pProvider ) { HRESULT hr = S_OK; IHttpRequest* pRequest = NULL; MODSECURITY_STORED_CONTEXT* pConfig = NULL; UNREFERENCED_PARAMETER ( pProvider ); EnterCriticalSection(&m_csLock); if ( pHttpContext == NULL ) { hr = E_UNEXPECTED; goto Finished; } pRequest = pHttpContext->GetRequest(); if ( pRequest == NULL ) { hr = E_UNEXPECTED; goto Finished; } hr = MODSECURITY_STORED_CONTEXT::GetConfig(pHttpContext, &pConfig ); if ( FAILED( hr ) ) { //hr = E_UNEXPECTED; hr = S_OK; goto Finished; } // If module is disabled, dont go any further // if( pConfig->GetIsEnabled() == false ) { goto Finished; } // every 3 seconds we check for changes in config file // DWORD ctime = GetTickCount(); if(pConfig->m_Config == NULL || (ctime - pConfig->m_dwLastCheck) > 3000) { char *path; USHORT pathlen; hr = pConfig->GlobalWideCharToMultiByte(pConfig->GetPath(), wcslen(pConfig->GetPath()), &path, &pathlen); if ( FAILED( hr ) ) { hr = E_UNEXPECTED; goto Finished; } WIN32_FILE_ATTRIBUTE_DATA fdata; BOOL ret; ret = GetFileAttributesEx(path, GetFileExInfoStandard, &fdata); pConfig->m_dwLastCheck = ctime; if(pConfig->m_Config == NULL || (ret != 0 && (pConfig->m_LastChange.dwLowDateTime != fdata.ftLastWriteTime.dwLowDateTime || pConfig->m_LastChange.dwHighDateTime != fdata.ftLastWriteTime.dwHighDateTime))) { pConfig->m_LastChange.dwLowDateTime = fdata.ftLastWriteTime.dwLowDateTime; pConfig->m_LastChange.dwHighDateTime = fdata.ftLastWriteTime.dwHighDateTime; pConfig->m_Config = modsecGetDefaultConfig(); PCWSTR servpath = pHttpContext->GetApplication()->GetApplicationPhysicalPath(); char *apppath; USHORT apppathlen; hr = pConfig->GlobalWideCharToMultiByte((WCHAR *)servpath, wcslen(servpath), &apppath, &apppathlen); if ( FAILED( hr ) ) { delete path; hr = E_UNEXPECTED; goto Finished; } if(path[0] != 0) { const char * err = modsecProcessConfig((directory_config *)pConfig->m_Config, path, apppath); if(err != NULL) { WriteEventViewerLog(err, EVENTLOG_ERROR_TYPE); delete apppath; delete path; goto Finished; } } delete apppath; } delete path; } conn_rec *c; request_rec *r; c = modsecNewConnection(); modsecProcessConnection(c); r = modsecNewRequest(c, (directory_config *)pConfig->m_Config); // on IIS we force input stream inspection flag, because its absence does not add any performance gain // it's because on IIS request body must be restored each time it was read // modsecSetConfigForIISRequestBody(r); REQUEST_STORED_CONTEXT *rsc = new REQUEST_STORED_CONTEXT(); rsc->m_pConnRec = c; rsc->m_pRequestRec = r; rsc->m_pHttpContext = pHttpContext; rsc->m_pProvider = pProvider; pHttpContext->GetModuleContextContainer()->SetModuleContext(rsc, g_pModuleContext); StoreIISContext(r, rsc); HTTP_REQUEST *req = pRequest->GetRawHttpRequest(); r->hostname = ConvertUTF16ToUTF8(req->CookedUrl.pHost, req->CookedUrl.HostLength / sizeof(WCHAR), r->pool); r->path_info = ConvertUTF16ToUTF8(req->CookedUrl.pAbsPath, req->CookedUrl.AbsPathLength / sizeof(WCHAR), r->pool); if(r->hostname == NULL) { if(req->Headers.KnownHeaders[HttpHeaderHost].pRawValue != NULL) r->hostname = ZeroTerminate(req->Headers.KnownHeaders[HttpHeaderHost].pRawValue, req->Headers.KnownHeaders[HttpHeaderHost].RawValueLength, r->pool); } int port = 0; char *port_str = NULL; if(r->hostname != NULL) { int k = 0; char *ptr = (char *)r->hostname; while(*ptr != 0 && *ptr != ':') ptr++; if(*ptr == ':') { *ptr = 0; port_str = ptr + 1; port = atoi(port_str); } } if(req->CookedUrl.pQueryString != NULL && req->CookedUrl.QueryStringLength > 0) r->args = ConvertUTF16ToUTF8(req->CookedUrl.pQueryString + 1, (req->CookedUrl.QueryStringLength / sizeof(WCHAR)) - 1, r->pool); #define _TRANSHEADER(id,str) if(req->Headers.KnownHeaders[id].pRawValue != NULL) \ {\ apr_table_setn(r->headers_in, str, \ ZeroTerminate(req->Headers.KnownHeaders[id].pRawValue, req->Headers.KnownHeaders[id].RawValueLength, r->pool)); \ } _TRANSHEADER(HttpHeaderCacheControl, "Cache-Control"); _TRANSHEADER(HttpHeaderConnection, "Connection"); _TRANSHEADER(HttpHeaderDate, "Date"); _TRANSHEADER(HttpHeaderKeepAlive, "Keep-Alive"); _TRANSHEADER(HttpHeaderPragma, "Pragma"); _TRANSHEADER(HttpHeaderTrailer, "Trailer"); _TRANSHEADER(HttpHeaderTransferEncoding, "Transfer-Encoding"); _TRANSHEADER(HttpHeaderUpgrade, "Upgrade"); _TRANSHEADER(HttpHeaderVia, "Via"); _TRANSHEADER(HttpHeaderWarning, "Warning"); _TRANSHEADER(HttpHeaderAllow, "Allow"); _TRANSHEADER(HttpHeaderContentLength, "Content-Length"); _TRANSHEADER(HttpHeaderContentType, "Content-Type"); _TRANSHEADER(HttpHeaderContentEncoding, "Content-Encoding"); _TRANSHEADER(HttpHeaderContentLanguage, "Content-Language"); _TRANSHEADER(HttpHeaderContentLocation, "Content-Location"); _TRANSHEADER(HttpHeaderContentMd5, "Content-Md5"); _TRANSHEADER(HttpHeaderContentRange, "Content-Range"); _TRANSHEADER(HttpHeaderExpires, "Expires"); _TRANSHEADER(HttpHeaderLastModified, "Last-Modified"); _TRANSHEADER(HttpHeaderAccept, "Accept"); _TRANSHEADER(HttpHeaderAcceptCharset, "Accept-Charset"); _TRANSHEADER(HttpHeaderAcceptEncoding, "Accept-Encoding"); _TRANSHEADER(HttpHeaderAcceptLanguage, "Accept-Language"); _TRANSHEADER(HttpHeaderAuthorization, "Authorization"); _TRANSHEADER(HttpHeaderCookie, "Cookie"); _TRANSHEADER(HttpHeaderExpect, "Expect"); _TRANSHEADER(HttpHeaderFrom, "From"); _TRANSHEADER(HttpHeaderHost, "Host"); _TRANSHEADER(HttpHeaderIfMatch, "If-Match"); _TRANSHEADER(HttpHeaderIfModifiedSince, "If-Modified-Since"); _TRANSHEADER(HttpHeaderIfNoneMatch, "If-None-Match"); _TRANSHEADER(HttpHeaderIfRange, "If-Range"); _TRANSHEADER(HttpHeaderIfUnmodifiedSince, "If-Unmodified-Since"); _TRANSHEADER(HttpHeaderMaxForwards, "Max-Forwards"); _TRANSHEADER(HttpHeaderProxyAuthorization, "Proxy-Authorization"); _TRANSHEADER(HttpHeaderReferer, "Referer"); _TRANSHEADER(HttpHeaderRange, "Range"); _TRANSHEADER(HttpHeaderTe, "TE"); _TRANSHEADER(HttpHeaderTranslate, "Translate"); _TRANSHEADER(HttpHeaderUserAgent, "User-Agent"); #undef _TRANSHEADER for(int i = 0; i < req->Headers.UnknownHeaderCount; i++) { apr_table_setn(r->headers_in, ZeroTerminate(req->Headers.pUnknownHeaders[i].pName, req->Headers.pUnknownHeaders[i].NameLength, r->pool), ZeroTerminate(req->Headers.pUnknownHeaders[i].pRawValue, req->Headers.pUnknownHeaders[i].RawValueLength, r->pool)); } r->content_encoding = apr_table_get(r->headers_in, "Content-Encoding"); r->content_type = apr_table_get(r->headers_in, "Content-Type"); const char *lng = apr_table_get(r->headers_in, "Content-Languages"); if(lng != NULL) { r->content_languages = apr_array_make(r->pool, 1, sizeof(const char *)); *(const char **)apr_array_push(r->content_languages) = lng; } switch(req->Verb) { case HttpVerbUnparsed: case HttpVerbUnknown: case HttpVerbInvalid: case HttpVerbTRACK: // used by Microsoft Cluster Server for a non-logged trace case HttpVerbSEARCH: default: r->method = "INVALID"; r->method_number = M_INVALID; break; case HttpVerbOPTIONS: r->method = "OPTIONS"; r->method_number = M_OPTIONS; break; case HttpVerbGET: case HttpVerbHEAD: r->method = "GET"; r->method_number = M_GET; break; case HttpVerbPOST: r->method = "POST"; r->method_number = M_POST; break; case HttpVerbPUT: r->method = "PUT"; r->method_number = M_PUT; break; case HttpVerbDELETE: r->method = "DELETE"; r->method_number = M_DELETE; break; case HttpVerbTRACE: r->method = "TRACE"; r->method_number = M_TRACE; break; case HttpVerbCONNECT: r->method = "CONNECT"; r->method_number = M_CONNECT; break; case HttpVerbMOVE: r->method = "MOVE"; r->method_number = M_MOVE; break; case HttpVerbCOPY: r->method = "COPY"; r->method_number = M_COPY; break; case HttpVerbPROPFIND: r->method = "PROPFIND"; r->method_number = M_PROPFIND; break; case HttpVerbPROPPATCH: r->method = "PROPPATCH"; r->method_number = M_PROPPATCH; break; case HttpVerbMKCOL: r->method = "MKCOL"; r->method_number = M_MKCOL; break; case HttpVerbLOCK: r->method = "LOCK"; r->method_number = M_LOCK; break; case HttpVerbUNLOCK: r->method = "UNLOCK"; r->method_number = M_UNLOCK; break; } if(HTTP_EQUAL_VERSION(req->Version, 0, 9)) r->protocol = "HTTP/0.9"; else if(HTTP_EQUAL_VERSION(req->Version, 1, 0)) r->protocol = "HTTP/1.0"; else r->protocol = "HTTP/1.1"; r->request_time = apr_time_now(); r->parsed_uri.scheme = "http"; r->parsed_uri.path = r->path_info; r->parsed_uri.hostname = (char *)r->hostname; r->parsed_uri.is_initialized = 1; r->parsed_uri.port = port; r->parsed_uri.port_str = port_str; r->parsed_uri.query = r->args; r->parsed_uri.dns_looked_up = 0; r->parsed_uri.dns_resolved = 0; r->parsed_uri.password = NULL; r->parsed_uri.user = NULL; r->parsed_uri.fragment = NULL; r->unparsed_uri = ZeroTerminate(req->pRawUrl, req->RawUrlLength, r->pool); r->uri = r->unparsed_uri; r->the_request = (char *)apr_palloc(r->pool, strlen(r->method) + 1 + req->RawUrlLength + 1 + strlen(r->protocol) + 1); strcpy(r->the_request, r->method); strcat(r->the_request, " "); strcat(r->the_request, r->uri); strcat(r->the_request, " "); strcat(r->the_request, r->protocol); HTTP_REQUEST_ID httpRequestID; char *pszValue = (char *)apr_palloc(r->pool, 24); httpRequestID = pRequest->GetRawHttpRequest()->RequestId; _ui64toa(httpRequestID, pszValue, 10); apr_table_setn(r->subprocess_env, "UNIQUE_ID", pszValue); PSOCKADDR pAddr = pRequest->GetRemoteAddress(); #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER < 3 c->remote_addr = CopySockAddr(r->pool, pAddr); c->remote_ip = GetIpAddr(r->pool, pAddr); #else c->client_addr = CopySockAddr(r->pool, pAddr); c->client_ip = GetIpAddr(r->pool, pAddr); #endif c->remote_host = NULL; int status = modsecProcessRequest(r); if(status != DECLINED) { pHttpContext->GetResponse()->SetStatus(status, "ModSecurity Action"); pHttpContext->SetRequestHandled(); hr = E_FAIL; goto Finished; } Finished: LeaveCriticalSection(&m_csLock); if ( FAILED( hr ) ) { return RQ_NOTIFICATION_FINISH_REQUEST; } return RQ_NOTIFICATION_CONTINUE; } apr_status_t ReadBodyCallback(request_rec *r, char *buf, unsigned int length, unsigned int *readcnt, int *is_eos) { REQUEST_STORED_CONTEXT *rsc = RetrieveIISContext(r); *readcnt = 0; if(rsc == NULL) { *is_eos = 1; return APR_SUCCESS; } IHttpContext *pHttpContext = rsc->m_pHttpContext; IHttpRequest *pRequest = pHttpContext->GetRequest(); if(pRequest->GetRemainingEntityBytes() == 0) { *is_eos = 1; return APR_SUCCESS; } HRESULT hr = pRequest->ReadEntityBody(buf, length, false, (DWORD *)readcnt, NULL); if (FAILED(hr)) { // End of data is okay. if (ERROR_HANDLE_EOF != (hr & 0x0000FFFF)) { // Set the error status. rsc->m_pProvider->SetErrorStatus( hr ); } *is_eos = 1; } return APR_SUCCESS; } apr_status_t WriteBodyCallback(request_rec *r, char *buf, unsigned int length) { REQUEST_STORED_CONTEXT *rsc = RetrieveIISContext(r); if(rsc == NULL || rsc->m_pRequestRec == NULL) return APR_SUCCESS; IHttpContext *pHttpContext = rsc->m_pHttpContext; IHttpRequest *pHttpRequest = pHttpContext->GetRequest(); CHAR szLength[21]; //Max length for a 64 bit int is 20 ZeroMemory(szLength, sizeof(szLength)); HRESULT hr = StringCchPrintfA( szLength, sizeof(szLength) / sizeof(CHAR) - 1, "%d", length); if(FAILED(hr)) { // not possible } hr = pHttpRequest->SetHeader( HttpHeaderContentLength, szLength, (USHORT)strlen(szLength), TRUE); if(FAILED(hr)) { // possible, but there's nothing we can do } // since we clean the APR pool at the end of OnSendRequest, we must get IIS-managed memory chunk // void *reqbuf = pHttpContext->AllocateRequestMemory(length); memcpy(reqbuf, buf, length); pHttpRequest->InsertEntityBody(reqbuf, length); return APR_SUCCESS; } apr_status_t ReadResponseCallback(request_rec *r, char *buf, unsigned int length, unsigned int *readcnt, int *is_eos) { REQUEST_STORED_CONTEXT *rsc = RetrieveIISContext(r); *readcnt = 0; if(rsc == NULL || rsc->m_pResponseBuffer == NULL) { *is_eos = 1; return APR_SUCCESS; } unsigned int size = length; if(size > rsc->m_pResponseLength - rsc->m_pResponsePosition) size = rsc->m_pResponseLength - rsc->m_pResponsePosition; memcpy(buf, rsc->m_pResponseBuffer + rsc->m_pResponsePosition, size); *readcnt = size; rsc->m_pResponsePosition += size; if(rsc->m_pResponsePosition >= rsc->m_pResponseLength) *is_eos = 1; return APR_SUCCESS; } apr_status_t WriteResponseCallback(request_rec *r, char *buf, unsigned int length) { REQUEST_STORED_CONTEXT *rsc = RetrieveIISContext(r); if(rsc == NULL || rsc->m_pRequestRec == NULL || rsc->m_pResponseBuffer == NULL) return APR_SUCCESS; IHttpContext *pHttpContext = rsc->m_pHttpContext; IHttpResponse *pHttpResponse = pHttpContext->GetResponse(); HTTP_RESPONSE *pRawHttpResponse = pHttpResponse->GetRawHttpResponse(); HTTP_DATA_CHUNK *pDataChunk = (HTTP_DATA_CHUNK *)apr_palloc(rsc->m_pRequestRec->pool, sizeof(HTTP_DATA_CHUNK)); pRawHttpResponse->EntityChunkCount = 0; // since we clean the APR pool at the end of OnSendRequest, we must get IIS-managed memory chunk // void *reqbuf = pHttpContext->AllocateRequestMemory(length); memcpy(reqbuf, buf, length); pDataChunk->DataChunkType = HttpDataChunkFromMemory; pDataChunk->FromMemory.pBuffer = reqbuf; pDataChunk->FromMemory.BufferLength = length; CHAR szLength[21]; //Max length for a 64 bit int is 20 ZeroMemory(szLength, sizeof(szLength)); HRESULT hr = StringCchPrintfA( szLength, sizeof(szLength) / sizeof(CHAR) - 1, "%d", length); if(FAILED(hr)) { // not possible } hr = pHttpResponse->SetHeader( HttpHeaderContentLength, szLength, (USHORT)strlen(szLength), TRUE); if(FAILED(hr)) { // possible, but there's nothing we can do } pHttpResponse->WriteEntityChunkByReference(pDataChunk); return APR_SUCCESS; } CMyHttpModule::CMyHttpModule() { // Open a handle to the Event Viewer. m_hEventLog = RegisterEventSource( NULL, "ModSecurity" ); SYSTEM_INFO sysInfo; GetSystemInfo(&sysInfo); m_dwPageSize = sysInfo.dwPageSize; InitializeCriticalSection(&m_csLock); modsecSetLogHook(this, Log); modsecSetReadBody(ReadBodyCallback); modsecSetReadResponse(ReadResponseCallback); modsecSetWriteBody(WriteBodyCallback); modsecSetWriteResponse(WriteResponseCallback); server_rec *s = modsecInit(); char *compname = (char *)malloc(128); DWORD size = 128; GetComputerName(compname, &size); s->server_hostname = compname; modsecStartConfig(); modsecFinalizeConfig(); modsecInitProcess(); } CMyHttpModule::~CMyHttpModule() { // ModSecurity registers APR pool cleanups, which interfere with APR pool tear down process // this causes crashes and since we are exiting the process here, so this is a temporary solution // //modsecTerminate(); //WriteEventViewerLog("Module deleted."); // Test whether the handle for the Event Viewer is open. if (NULL != m_hEventLog) { // Close the handle to the Event Viewer. DeregisterEventSource( m_hEventLog ); m_hEventLog = NULL; DeleteCriticalSection(&m_csLock); } } void CMyHttpModule::Dispose() { } BOOL CMyHttpModule::WriteEventViewerLog(LPCSTR szNotification, WORD category) { // Test whether the handle for the Event Viewer is open. if (NULL != m_hEventLog) { // Write any strings to the Event Viewer and return. return ReportEvent( m_hEventLog, category, 0, 0, NULL, 1, 0, &szNotification, NULL ); } return FALSE; } modsecurity-apache_2.7.7/iis/moduleconfig.cpp0000664000175000017500000003774612243422537021623 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #define WIN32_LEAN_AND_MEAN #undef inline #define inline inline // IIS7 Server API header file #include "httpserv.h" // Project header files #include "mymodule.h" #include "mymodulefactory.h" #include "moduleconfig.h" HRESULT MODSECURITY_STORED_CONTEXT::Initialize( IHttpContext * pW3Context, IAppHostConfigException ** ppException ) { HRESULT hr = S_OK; IAppHostAdminManager *pAdminManager = NULL; IAppHostElement *pSessionTrackingElement = NULL; IAppHostPropertyException *pPropertyException = NULL; PCWSTR pszConfigPath = pW3Context->GetMetadata()->GetMetaPath(); BSTR bstrUrlPath = SysAllocString( pszConfigPath ); pAdminManager = g_pHttpServer->GetAdminManager(); if ( ( FAILED( hr ) ) || ( pAdminManager == NULL ) ) { hr = E_UNEXPECTED; goto Failure; } // Get a handle to the section: hr = pAdminManager->GetAdminSection( MODSECURITY_SECTION, bstrUrlPath, &pSessionTrackingElement ); if ( FAILED( hr ) ) { goto Failure; } if ( pSessionTrackingElement == NULL ) { hr = E_UNEXPECTED; goto Failure; } // Get the property object for the 'enabled' attribute: hr = GetBooleanPropertyValue( pSessionTrackingElement, MODSECURITY_SECTION_ENABLED, &pPropertyException, &m_bIsEnabled); if ( FAILED( hr ) ) { goto Failure; } // If there is a config failure, we cannot continue execution: if ( pPropertyException != NULL ) { ppException = ( IAppHostConfigException** ) &pPropertyException; goto Failure; } if ( m_bIsEnabled == FALSE ) { // There is no point in reading any more of the config associated with the session // tracking section, since this feature is not enabled for the current URL goto Failure; } // Get the property object for the 'configfile' attribute: hr = GetStringPropertyValue( pSessionTrackingElement, MODSECURITY_SECTION_CONFIGFILE, &pPropertyException, &m_pszPath); if ( FAILED( hr ) ) { goto Failure; } // If there is a config failure, we cannot continue execution: if ( pPropertyException != NULL ) { ppException = ( IAppHostConfigException** ) &pPropertyException; goto Failure; } Failure: SysFreeString( bstrUrlPath ); return hr; } HRESULT MODSECURITY_STORED_CONTEXT::GetBooleanPropertyValue( IAppHostElement* pElement, WCHAR* pszPropertyName, IAppHostPropertyException** pException, BOOL* pBoolValue ) { HRESULT hr = S_OK; IAppHostProperty *pProperty = NULL; VARIANT vPropertyValue; if ( ( pElement == NULL ) || ( pszPropertyName == NULL ) || ( pException == NULL ) || ( pBoolValue == NULL ) ) { hr = E_INVALIDARG; goto Failure; } // Get the property object for the BOOLEAN attribute: hr = pElement->GetPropertyByName( pszPropertyName, &pProperty ); if ( FAILED( hr ) ) { goto Failure; } if ( pProperty == NULL ) { hr = E_UNEXPECTED; goto Failure; } // Get the attribute value: VariantInit( &vPropertyValue ); hr = pProperty->get_Value( &vPropertyValue ); if ( FAILED( hr ) ) { goto Failure; } // See it there is an exception that might be due to the actual value in the // config not meeting validation criteria *pException = NULL; hr = pProperty->get_Exception( pException ); if ( FAILED( hr ) ) { goto Failure; } // No need to continue if we got an exception... if ( ( *pException ) != NULL ) { goto Failure; } // Finally, get the value: *pBoolValue = ( vPropertyValue.boolVal == VARIANT_TRUE ) ? TRUE : FALSE; Failure: VariantClear( &vPropertyValue ); if ( pProperty != NULL ) { pProperty->Release(); pProperty = NULL; } return hr; } HRESULT MODSECURITY_STORED_CONTEXT::GetDWORDPropertyValue( IAppHostElement* pElement, WCHAR* pszPropertyName, IAppHostPropertyException** pException, DWORD* pnValue ) { HRESULT hr = S_OK; IAppHostProperty *pProperty = NULL; VARIANT vPropertyValue; if ( ( pElement == NULL ) || ( pszPropertyName == NULL ) || ( pException == NULL ) || ( pnValue == NULL ) ) { hr = E_INVALIDARG; goto Failure; } // Get the property object for the INT attribute: hr = pElement->GetPropertyByName( pszPropertyName, &pProperty ); if ( FAILED( hr ) ) { goto Failure; } if ( pProperty == NULL ) { hr = E_UNEXPECTED; goto Failure; } // Get the attribute value: VariantInit( &vPropertyValue ); hr = pProperty->get_Value( &vPropertyValue ); if ( FAILED( hr ) ) { goto Failure; } // See it there is an exception that might be due to the actual value in the // config not meeting validation criteria *pException = NULL; hr = pProperty->get_Exception( pException ); if ( FAILED( hr ) ) { goto Failure; } // No need to continue if we got an exception... if ( ( *pException ) != NULL ) { goto Failure; } // Finally, get the value: *pnValue = vPropertyValue.ulVal; Failure: VariantClear( &vPropertyValue ); if ( pProperty != NULL ) { pProperty->Release(); pProperty = NULL; } return hr; } HRESULT MODSECURITY_STORED_CONTEXT::GetTimeSpanPropertyValue( IAppHostElement* pElement, WCHAR* pszPropertyName, IAppHostPropertyException** pException, ULONGLONG* pnValue ) { HRESULT hr = S_OK; IAppHostProperty *pProperty = NULL; VARIANT vPropertyValue; if ( ( pElement == NULL ) || ( pszPropertyName == NULL ) || ( pException == NULL ) || ( pnValue == NULL ) ) { hr = E_INVALIDARG; goto Failure; } // Get the property object for the INT attribute: hr = pElement->GetPropertyByName( pszPropertyName, &pProperty ); if ( FAILED( hr ) ) { goto Failure; } if ( pProperty == NULL ) { hr = E_UNEXPECTED; goto Failure; } // Get the attribute value: VariantInit( &vPropertyValue ); hr = pProperty->get_Value( &vPropertyValue ); if ( FAILED( hr ) ) { goto Failure; } // See it there is an exception that might be due to the actual value in the // config not meeting validation criteria *pException = NULL; hr = pProperty->get_Exception( pException ); if ( FAILED( hr ) ) { goto Failure; } // No need to continue if we got an exception... if ( ( *pException ) != NULL ) { goto Failure; } // Finally, get the value: *pnValue = vPropertyValue.ullVal; Failure: VariantClear( &vPropertyValue ); if ( pProperty != NULL ) { pProperty->Release(); pProperty = NULL; } return hr; } HRESULT MODSECURITY_STORED_CONTEXT::GetStringPropertyValue( IAppHostElement* pElement, WCHAR* pszPropertyName, IAppHostPropertyException** pException, WCHAR** ppszValue ) { HRESULT hr = S_OK; IAppHostProperty *pProperty = NULL; DWORD dwLength; VARIANT vPropertyValue; if ( ( pElement == NULL ) || ( pszPropertyName == NULL ) || ( pException == NULL ) || ( ppszValue == NULL ) ) { hr = E_INVALIDARG; goto Failure; } *ppszValue = NULL; // Get the property object for the string attribute: hr = pElement->GetPropertyByName( pszPropertyName, &pProperty ); if ( FAILED( hr ) ) { goto Failure; } if ( pProperty == NULL ) { hr = E_UNEXPECTED; goto Failure; } // Get the attribute value: VariantInit( &vPropertyValue ); hr = pProperty->get_Value( &vPropertyValue ); if ( FAILED( hr ) ) { goto Failure; } // See it there is an exception that might be due to the actual value in the // config not meeting validation criteria *pException = NULL; hr = pProperty->get_Exception( pException ); if ( FAILED( hr ) ) { goto Failure; } // No need to continue if we got an exception... if ( ( *pException ) != NULL ) { goto Failure; } // Finally, get the value: dwLength = SysStringLen( vPropertyValue.bstrVal ); *ppszValue = new WCHAR[ dwLength + 1 ]; if ( (*ppszValue) == NULL ) { hr = E_OUTOFMEMORY; goto Failure; } wcsncpy( *ppszValue, vPropertyValue.bstrVal, dwLength ); (*ppszValue)[ dwLength ] = L'\0'; Failure: VariantClear( &vPropertyValue ); if ( pProperty != NULL ) { pProperty->Release(); pProperty = NULL; } return hr; } MODSECURITY_STORED_CONTEXT::~MODSECURITY_STORED_CONTEXT() { if ( m_pszPath != NULL ) { delete [] m_pszPath; m_pszPath = NULL; } } MODSECURITY_STORED_CONTEXT::MODSECURITY_STORED_CONTEXT(): m_bIsEnabled ( FALSE ), m_pszPath( NULL ), m_Config( NULL ), m_dwLastCheck( 0 ) { m_LastChange.dwLowDateTime = 0; m_LastChange.dwHighDateTime = 0; } DWORD MODSECURITY_STORED_CONTEXT::GlobalWideCharToMultiByte( WCHAR* pSource, DWORD dwLengthSource, CHAR** ppszDestination, USHORT* pdwLengthDestination ) { DWORD dwResult = NULL; DWORD dwCount = 0; if ( ( pSource == NULL ) || ( ppszDestination == NULL ) || ( pdwLengthDestination == NULL ) ) { dwResult = ERROR_INVALID_PARAMETER; goto Exit; } // Initialize result length *pdwLengthDestination = 0; *ppszDestination = NULL; dwCount = WideCharToMultiByte( CP_ACP, 0, pSource, dwLengthSource + 1, *ppszDestination, 0, NULL, NULL ); if ( 0 == dwCount ) { dwResult = GetLastError (); if ( dwResult == 0 ) { dwResult = ERROR_INVALID_DATA; } goto Exit; } *ppszDestination = new CHAR[ dwCount + 1 ]; if ( NULL == ( *ppszDestination ) ) { dwResult = ERROR_OUTOFMEMORY; goto Exit; } // Make sure the memory is 'clean': SecureZeroMemory( ( *ppszDestination ), ( dwCount + 1 ) * sizeof ( CHAR ) ); if ( 0 == WideCharToMultiByte( CP_ACP, 0, pSource, dwLengthSource + 1, *ppszDestination, dwCount, NULL, NULL ) ) { dwResult = GetLastError(); goto Exit; } *pdwLengthDestination = ( USHORT )dwCount; Exit: if ( dwResult != 0 ) { // Make sure we do the proper cleanup in the error case: if ( pdwLengthDestination != NULL ) { *pdwLengthDestination = 0; } if ( ppszDestination != NULL ) { if ( ( *ppszDestination ) != NULL ) { delete [] ( *ppszDestination ); ( *ppszDestination ) = NULL; } } } return dwResult; } HRESULT MODSECURITY_STORED_CONTEXT::GetConfig( IHttpContext * pContext, MODSECURITY_STORED_CONTEXT ** ppModuleConfig ) { HRESULT hr = S_OK; MODSECURITY_STORED_CONTEXT * pModuleConfig = NULL; IHttpModuleContextContainer * pMetadataContainer = NULL; IAppHostConfigException * pException = NULL; pMetadataContainer = pContext->GetMetadata()->GetModuleContextContainer(); if ( pMetadataContainer == NULL ) { hr = E_UNEXPECTED; return hr; } pModuleConfig = (MODSECURITY_STORED_CONTEXT *)pMetadataContainer->GetModuleContext( g_pModuleContext ); if ( pModuleConfig != NULL ) { // // We found stored data for this module for the metadata // object which is different for unique configuration path // *ppModuleConfig = pModuleConfig; return S_OK; } // // If we reach here, that means this is first request or first // request after a configuration change IIS core will throw stored context away // if a change notification arrives for this metadata path // pModuleConfig = new MODSECURITY_STORED_CONTEXT(); if ( pModuleConfig == NULL ) { return E_OUTOFMEMORY; } // // Read module configuration data and store in MODSECURITY_STORED_CONTEXT // hr = pModuleConfig->Initialize( pContext, &pException ); if ( FAILED( hr ) || pException != NULL ) { pModuleConfig->CleanupStoredContext(); pModuleConfig = NULL; hr = E_UNEXPECTED; return hr; } // // Store MODSECURITY_STORED_CONTEXT data as metadata stored context // hr = pMetadataContainer->SetModuleContext( pModuleConfig, g_pModuleContext ); if ( FAILED( hr ) ) { pModuleConfig->CleanupStoredContext(); pModuleConfig = NULL; // // It is possible that some other thread stored context before this thread // could do. Check returned hr and return context stored by other thread // if ( hr == HRESULT_FROM_WIN32( ERROR_ALREADY_ASSIGNED ) ) { *ppModuleConfig = (MODSECURITY_STORED_CONTEXT *)pMetadataContainer->GetModuleContext( g_pModuleContext ); return S_OK; } } *ppModuleConfig = pModuleConfig; return hr; } modsecurity-apache_2.7.7/iis/Makefile.win0000664000175000017500000000554312252634623020667 0ustar zimmerlezimmerle########################################################################### # # Usage: NMAKE -f Makefile.win APACHE={httpd installion dir} PCRE={pcre dir} LIBXML2={LibXML2 dir} [ LUA={Lua dir} ] # !IF "$(APACHE)" == "" || "$(PCRE)" == "" || "$(LIBXML2)" == "" !ERROR NMAKE arguments: APACHE=dir PCRE=dir LIBXML2=dir are required to build mod_security2 for Windows !ENDIF # Linking libraries LIBS = $(APACHE)\lib\libapr-1.lib \ $(APACHE)\lib\libaprutil-1.lib \ $(PCRE)\pcre.lib \ $(LIBXML2)\win32\bin.msvc\libxml2.lib \ "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" \ "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" "ws2_32.lib" ########################################################################### ########################################################################### CC = CL LINK = link.exe MT = mt DEFS = /nologo /O2 /LD /W3 /wd4244 /wd4018 -DWIN32 -DWINNT -Dinline=APR_INLINE -DAP_DECLARE_STATIC -D_MBCS -D$(VERSION) DLL = ModSecurityIIS.dll INCLUDES = -I. -I.. \ -I$(PCRE)\include -I$(PCRE) \ -I$(LIBXML2)\include \ -I$(APACHE)\include \ -I..\apache2 \ -I..\standalone # Lua is optional !IF "$(LUA)" != "" LIBS = $(LIBS) $(LUA)\lua5.1.lib DEFS=$(DEFS) -DWITH_LUA INCLUDES = $(INCLUDES) -I$(LUA)\include -I$(LUA) \ !ENDIF CFLAGS= -MD /Zi $(INCLUDES) $(DEFS) LDFLAGS = /DEF:"mymodule.def" /DEBUG /OPT:REF /OPT:ICF /MANIFEST /ManifestFile:"ModSecurityIIS.dll.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /TLBID:1 /DYNAMICBASE /NXCOMPAT OBJS1 = mod_security2.obj apache2_config.obj apache2_io.obj apache2_util.obj \ re.obj re_operators.obj re_actions.obj re_tfns.obj re_variables.obj \ msc_logging.obj msc_xml.obj msc_multipart.obj modsecurity.obj \ msc_parsers.obj msc_util.obj msc_pcre.obj persist_dbm.obj \ msc_reqbody.obj msc_geo.obj msc_gsb.obj msc_unicode.obj acmp.obj msc_lua.obj \ msc_release.obj msc_crypt.obj msc_tree.obj OBJS2 = api.obj buckets.obj config.obj filters.obj hooks.obj regex.obj server.obj OBJS3 = main.obj moduleconfig.obj mymodule.obj OBJS4 = libinjection_sqli.obj all: $(DLL) dll: $(DLL) $(OBJS1): ..\apache2\$*.c $(CC) $(CFLAGS) -c ..\apache2\$*.c -Fo$@ $(OBJS4): ..\apache2\libinjection\$*.c $(CC) $(CFLAGS) -c ..\apache2\libinjection\$*.c -Fo$@ $(OBJS2): ..\standalone\$*.c $(CC) $(CFLAGS) -c ..\standalone\$*.c -Fo$@ .cpp.obj: $(CC) $(CFLAGS) -c $< -Fo$@ $(DLL): $(OBJS1) $(OBJS2) $(OBJS3) $(OBJS4) $(LINK) $(LDFLAGS) $(OBJS1) $(OBJS2) $(OBJS3) $(OBJS4) $(LIBS) IF EXIST $(DLL).manifest $(MT) -manifest $(DLL).manifest -outputresource:$(DLL);#1 clean: del /f *.obj del /f *.dll del /f *.exp del /f *.lib modsecurity-apache_2.7.7/iis/build_dependencies.bat0000664000175000017500000000546212253711345022726 0ustar zimmerlezimmerle:: Those variable should be edited as needed. :: Use full paths. :: General paths @set WORK_DIR=%cd%\dependencies\build_dir @set OUTPUT_DIR=%cd%\dependencies\release_files @set SOURCE_DIR=%USERPROFILE%\Downloads :: Aditional paths. @set PATH=%PATH%;c:\work\cmake-2.8.7-win32-x86\bin;"c:\program files\7-zip" @set PCRE=pcre-8.33.zip @set ZLIB=zlib-1.2.8.tar.gz @set LIBXML2=libxml2-2.9.1.tar.gz @set LUA=lua-5.1.5.tar.gz @set CURL=curl-7.33.0.zip @set APACHE_SRC=httpd-2.4.6.tar.gz @set APACHE_BIN32=httpd-2.4.6-win32-VC11.zip @set APACHE_BIN64=httpd-2.4.6-win64-VC11.zip :: @set VCARGS32="C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\vcvars32.bat" :: @set VCARGS64="C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\x86_amd64\vcvarsx86_amd64.bat" :: Do not edit bellow this line. @set CURRENT_DIR=%cd% @echo Cleaning directories... if EXIST "%WORK_DIR%" @rmdir /s /q "%WORK_DIR%" if EXIST "%OUTPUT_DIR%" @rmdir /s /q "%OUTPUT_DIR%" @mkdir "%WORK_DIR%" @if NOT (%ERRORLEVEL%) == (0) goto failed_to_cleanup @mkdir "%OUTPUT_DIR%" @if NOT (%ERRORLEVEL%) == (0) goto failed_to_cleanup @echo Checking for vcargs... %1 @if NOT (%1) == "" call %1 @if (%ERRORLEVEL%) == (1) goto build_wrong_vcargs set APACHE_BIN=%APACHE_BIN32% call cl 2>&1 | findstr /C:"x64" @if (%ERRORLEVEL%) == (0) set APACHE_BIN=%APACHE_BIN64% @echo Starting with the depdendencies... @echo # Apache - %HTTPD%/%APACHE24_ZIP% @call dependencies/build_apache.bat @if NOT (%ERRORLEVEL%) == (0) goto build_failed_apache @cd "%CURRENT_DIR%" echo "c" @echo # pcre. - %PCRE% @call dependencies/build_pcre.bat @if NOT (%ERRORLEVEL%) == (0) goto build_failed_pcre @cd "%CURRENT_DIR%" echo "b" @echo # zlib - %ZLIB% @call dependencies/build_zlib.bat @if NOT (%ERRORLEVEL%) == (0) goto build_failed_zlib @cd "%CURRENT_DIR%" @echo # libxml2 - %LIBXML2% @call dependencies/build_libxml2.bat @if NOT (%ERRORLEVEL%) == (0) goto build_failed_libxml2 @cd "%CURRENT_DIR%" @echo # lua - %LUA% @call dependencies/build_lua.bat @if NOT (%ERRORLEVEL%) == (0) goto build_failed_lua @cd "%CURRENT_DIR%" @echo # curl - %CURL% @call dependencies/build_curl.bat @if NOT (%ERRORLEVEL%) == (0) goto build_failed_curl @cd "%CURRENT_DIR%" @echo All dependencies were built successfully. @cd "%CURRENT_DIR%" @exit /B 0 :failed_to_cleanup @echo Failed to cleanup @goto failed :build_wrong_vcargs @echo Please specify a valid vcargs @goto failed :build_failed_apache @echo Failed to setup %HTTPD%/%APACHE24_ZIP%... @goto failed :build_failed_pcre @echo Failed to setup %PCRE%... @goto failed :build_failed_zlib @echo Failed to setup %ZLIB%... @goto failed :build_failed_libxml2 @echo Failed to setup %LIBXML2%... @goto failed :build_failed_lua @echo Failed to setup %LUA%... @goto failed :build_failed_curl @echo Failed to setup %CURL%... @goto failed :failed @cd %CURRENT_DIR% @exit /B 1 modsecurity-apache_2.7.7/iis/ModSecurityIIS/0000775000175000017500000000000012253711345021236 5ustar zimmerlezimmerlemodsecurity-apache_2.7.7/iis/ModSecurityIIS/ModSecurityIIS/0000775000175000017500000000000012243422537024053 5ustar zimmerlezimmerlemodsecurity-apache_2.7.7/iis/ModSecurityIIS/ModSecurityIIS/uninstall.vbs0000664000175000017500000000020512243422537026575 0ustar zimmerlezimmerleSet WshShell = CreateObject("WScript.Shell") WshShell.Exec("%windir%\system32\inetsrv\appcmd.exe uninstall module ModSecurityIIS")modsecurity-apache_2.7.7/iis/ModSecurityIIS/ModSecurityIIS/readme.rtf0000664000175000017500000013207712243422537026037 0ustar zimmerlezimmerle{\rtf1\adeflang1025\ansi\ansicpg1252\uc1\adeff0\deff0\stshfdbch0\stshfloch31506\stshfhich31506\stshfbi31506\deflang1033\deflangfe1033\themelang1033\themelangfe0\themelangcs0{\fonttbl{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f1\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604020202020204}Arial;} {\f1\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604020202020204}Arial;}{\f37\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri;}{\flomajor\f31500\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;} {\fdbmajor\f31501\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\fhimajor\f31502\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria;} {\fbimajor\f31503\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\flominor\f31504\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;} {\fdbminor\f31505\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\fhiminor\f31506\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri;} {\fbiminor\f31507\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f39\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\f40\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;} {\f42\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\f43\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\f44\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\f45\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);} {\f46\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\f47\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\f49\fbidi \fswiss\fcharset238\fprq2 Arial CE;}{\f50\fbidi \fswiss\fcharset204\fprq2 Arial Cyr;} {\f52\fbidi \fswiss\fcharset161\fprq2 Arial Greek;}{\f53\fbidi \fswiss\fcharset162\fprq2 Arial Tur;}{\f54\fbidi \fswiss\fcharset177\fprq2 Arial (Hebrew);}{\f55\fbidi \fswiss\fcharset178\fprq2 Arial (Arabic);} {\f56\fbidi \fswiss\fcharset186\fprq2 Arial Baltic;}{\f57\fbidi \fswiss\fcharset163\fprq2 Arial (Vietnamese);}{\f49\fbidi \fswiss\fcharset238\fprq2 Arial CE;}{\f50\fbidi \fswiss\fcharset204\fprq2 Arial Cyr;} {\f52\fbidi \fswiss\fcharset161\fprq2 Arial Greek;}{\f53\fbidi \fswiss\fcharset162\fprq2 Arial Tur;}{\f54\fbidi \fswiss\fcharset177\fprq2 Arial (Hebrew);}{\f55\fbidi \fswiss\fcharset178\fprq2 Arial (Arabic);} {\f56\fbidi \fswiss\fcharset186\fprq2 Arial Baltic;}{\f57\fbidi \fswiss\fcharset163\fprq2 Arial (Vietnamese);}{\f409\fbidi \fswiss\fcharset238\fprq2 Calibri CE;}{\f410\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr;} {\f412\fbidi \fswiss\fcharset161\fprq2 Calibri Greek;}{\f413\fbidi \fswiss\fcharset162\fprq2 Calibri Tur;}{\f416\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic;}{\f417\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese);} {\flomajor\f31508\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\flomajor\f31509\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\flomajor\f31511\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;} {\flomajor\f31512\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\flomajor\f31513\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\flomajor\f31514\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);} {\flomajor\f31515\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\flomajor\f31516\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\fdbmajor\f31518\fbidi \froman\fcharset238\fprq2 Times New Roman CE;} {\fdbmajor\f31519\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\fdbmajor\f31521\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\fdbmajor\f31522\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;} {\fdbmajor\f31523\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\fdbmajor\f31524\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\fdbmajor\f31525\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;} {\fdbmajor\f31526\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\fhimajor\f31528\fbidi \froman\fcharset238\fprq2 Cambria CE;}{\fhimajor\f31529\fbidi \froman\fcharset204\fprq2 Cambria Cyr;} {\fhimajor\f31531\fbidi \froman\fcharset161\fprq2 Cambria Greek;}{\fhimajor\f31532\fbidi \froman\fcharset162\fprq2 Cambria Tur;}{\fhimajor\f31535\fbidi \froman\fcharset186\fprq2 Cambria Baltic;} {\fhimajor\f31536\fbidi \froman\fcharset163\fprq2 Cambria (Vietnamese);}{\fbimajor\f31538\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\fbimajor\f31539\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;} {\fbimajor\f31541\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\fbimajor\f31542\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\fbimajor\f31543\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);} {\fbimajor\f31544\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\fbimajor\f31545\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\fbimajor\f31546\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);} {\flominor\f31548\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\flominor\f31549\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\flominor\f31551\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;} {\flominor\f31552\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\flominor\f31553\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\flominor\f31554\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);} {\flominor\f31555\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\flominor\f31556\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\fdbminor\f31558\fbidi \froman\fcharset238\fprq2 Times New Roman CE;} {\fdbminor\f31559\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\fdbminor\f31561\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\fdbminor\f31562\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;} {\fdbminor\f31563\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\fdbminor\f31564\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\fdbminor\f31565\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;} {\fdbminor\f31566\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\fhiminor\f31568\fbidi \fswiss\fcharset238\fprq2 Calibri CE;}{\fhiminor\f31569\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr;} {\fhiminor\f31571\fbidi \fswiss\fcharset161\fprq2 Calibri Greek;}{\fhiminor\f31572\fbidi \fswiss\fcharset162\fprq2 Calibri Tur;}{\fhiminor\f31575\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic;} {\fhiminor\f31576\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese);}{\fbiminor\f31578\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\fbiminor\f31579\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;} {\fbiminor\f31581\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\fbiminor\f31582\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\fbiminor\f31583\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);} {\fbiminor\f31584\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\fbiminor\f31585\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\fbiminor\f31586\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}} {\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0; \red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}{\*\defchp \f31506\fs22 }{\*\defpap \ql \li0\ri0\sa200\sl276\slmult1 \widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 }\noqfpromote {\stylesheet{\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \f31506\fs22\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \snext0 \sqformat \spriority0 Normal;}{\*\cs10 \additive \sunhideused \spriority1 Default Paragraph Font;}{\* \ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\trcbpat1\trcfpat1\tblind0\tblindtype3\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv \ql \li0\ri0\sa200\sl276\slmult1 \widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af31506\afs22\alang1025 \ltrch\fcs0 \f31506\fs22\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \snext11 \ssemihidden \sunhideused Normal Table;}{ \s15\ql \li0\ri0\sb100\sa100\sbauto1\saauto1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext15 \ssemihidden \sunhideused \styrsid3168183 Normal (Web);}{\*\cs16 \additive \rtlch\fcs1 \af0 \ltrch\fcs0 \ul\cf2 \sbasedon10 \sunhideused \styrsid3168183 Hyperlink;}{\*\cs17 \additive \rtlch\fcs1 \ab\af0 \ltrch\fcs0 \b \sbasedon10 \sqformat \spriority22 \styrsid3168183 Strong;}}{\*\listtable{\list\listtemplateid235441858{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'02\'00.;}{\levelnumbers\'01;} \rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li720\jclisttab\tx720\lin720 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'01.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li1440\jclisttab\tx1440\lin1440 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'02.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li2160 \jclisttab\tx2160\lin2160 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'03.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li2880\jclisttab\tx2880\lin2880 } {\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'04.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li3600\jclisttab\tx3600\lin3600 }{\listlevel\levelnfc0 \levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'05.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li4320\jclisttab\tx4320\lin4320 }{\listlevel\levelnfc0\levelnfcn0\leveljc0 \leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'06.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li5040\jclisttab\tx5040\lin5040 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0 \levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'07.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li5760\jclisttab\tx5760\lin5760 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative \levelspace0\levelindent0{\leveltext\'02\'08.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li6480\jclisttab\tx6480\lin6480 }{\listname ;}\listid625282538}{\list\listtemplateid232439776\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0 \leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\leveltemplateid-1715947050\'01\'95;}{\levelnumbers;}\f1\fbias0 \fi-360\li720\jclisttab\tx720\lin720 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1 \levelspace0\levelindent0{\leveltext\leveltemplateid-465034936\'01\'95;}{\levelnumbers;}\f1\fbias0 \fi-360\li1440\jclisttab\tx1440\lin1440 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0 \levelindent0{\leveltext\leveltemplateid857778786\'01\'95;}{\levelnumbers;}\f1\fbias0 \fi-360\li2160\jclisttab\tx2160\lin2160 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0 {\leveltext\leveltemplateid601148814\'01\'95;}{\levelnumbers;}\f1\fbias0 \fi-360\li2880\jclisttab\tx2880\lin2880 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext \leveltemplateid1944200722\'01\'95;}{\levelnumbers;}\f1\fbias0 \fi-360\li3600\jclisttab\tx3600\lin3600 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext \leveltemplateid-132083520\'01\'95;}{\levelnumbers;}\f1\fbias0 \fi-360\li4320\jclisttab\tx4320\lin4320 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext \leveltemplateid-1230063730\'01\'95;}{\levelnumbers;}\f1\fbias0 \fi-360\li5040\jclisttab\tx5040\lin5040 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext \leveltemplateid1225817962\'01\'95;}{\levelnumbers;}\f1\fbias0 \fi-360\li5760\jclisttab\tx5760\lin5760 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext \leveltemplateid1897401684\'01\'95;}{\levelnumbers;}\f1\fbias0 \fi-360\li6480\jclisttab\tx6480\lin6480 }{\listname ;}\listid652101753}}{\*\listoverridetable{\listoverride\listid625282538\listoverridecount0\ls1}{\listoverride\listid652101753 \listoverridecount0\ls2}}{\*\pgptbl {\pgp\ipgp10\itap0\li720\ri0\sb0\sa240}{\pgp\ipgp10\itap0\li720\ri0\sb0\sa240}{\pgp\ipgp10\itap0\li720\ri0\sb0\sa240}{\pgp\ipgp10\itap0\li720\ri0\sb0\sa240}{\pgp\ipgp6\itap0\li0\ri0\sb0\sa0}{\pgp\ipgp8\itap0\li0\ri0\sb0 \sa0}{\pgp\ipgp0\itap0\li0\ri0\sb0\sa0}{\pgp\ipgp7\itap0\li0\ri0\sb0\sa0}{\pgp\ipgp10\itap0\li720\ri0\sb0\sa240}{\pgp\ipgp0\itap0\li0\ri0\sb0\sa0}}{\*\rsidtbl \rsid1197496\rsid2315486\rsid3168183\rsid4593034\rsid6385683\rsid6633290\rsid6967166\rsid9512544 \rsid10098429\rsid12742482\rsid13639667\rsid16350125\rsid16593896}{\mmathPr\mmathFont34\mbrkBin0\mbrkBinSub0\msmallFrac0\mdispDef1\mlMargin0\mrMargin0\mdefJc1\mwrapIndent1440\mintLim0\mnaryLim1}{\info{\author Suha Can}{\operator Greg} {\creatim\yr2012\mo6\dy4\hr11\min43}{\revtim\yr2013\mo1\dy15\hr9\min48}{\version8}{\edmins11}{\nofpages1}{\nofwords176}{\nofchars1008}{\*\company Microsoft Corporation}{\nofcharsws1182}{\vern49275}}{\*\xmlnstbl {\xmlns1 http://schemas.microsoft.com/office /word/2003/wordml}}\paperw12240\paperh15840\margl1440\margr1440\margt1440\margb1440\gutter0\ltrsect \widowctrl\ftnbj\aenddoc\trackmoves0\trackformatting1\donotembedsysfont1\relyonvml0\donotembedlingdata0\grfdocevents0\validatexml1\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0\showxmlerrors1\noxlattoyen \expshrtn\noultrlspc\dntblnsbdb\nospaceforul\formshade\horzdoc\dgmargin\dghspace180\dgvspace180\dghorigin1440\dgvorigin1440\dghshow1\dgvshow1 \jexpand\viewkind1\viewscale100\pgbrdrhead\pgbrdrfoot\splytwnine\ftnlytwnine\htmautsp\nolnhtadjtbl\useltbaln\alntblind\lytcalctblwd\lyttblrtgr\lnbrkrule\nobrkwrptbl\snaptogridincell\allowfieldendsel\wrppunct \asianbrkrule\rsidroot9512544\newtblstyruls\nogrowautofit\usenormstyforlist\noindnmbrts\felnbrelev\nocxsptable\indrlsweleven\noafcnsttbl\afelev\utinl\hwelev\spltpgpar\notcvasp\notbrkcnstfrctbl\notvatxbx\krnprsnet\cachedcolbal \nouicompat \fet0 {\*\wgrffmtfilter 2450}\nofeaturethrottle1\ilfomacatclnup0\ltrpar \sectd \ltrsect\linex0\endnhere\sectlinegrid360\sectdefaultcl\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}} \pard\plain \ltrpar\s15\ql \li0\ri0\sb100\sa100\sbauto1\saauto1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid3168183 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 { \rtlch\fcs1 \af0 \ltrch\fcs0 \lang9\langfe1033\langnp9\insrsid13639667 Thank you}{\rtlch\fcs1 \af0 \ltrch\fcs0 \lang9\langfe1033\langnp9\insrsid4593034 for installing ModSecurity for IIS.}{\rtlch\fcs1 \af0 \ltrch\fcs0 \lang9\langfe1033\langnp9\insrsid3168183 \par }\pard\plain \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid16350125 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \f31506\fs22\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 { \rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \f0\fs24\insrsid6385683\charrsid16350125 ModSecurity home page }{\field\fldedit{\*\fldinst {\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \f0\fs24\insrsid2315486 HYPERLINK "http://www.modsecurity.org"}{\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \f0\fs24\insrsid2315486\charrsid16350125 {\*\datafield 00d0c9ea79f9bace118c8200aa004ba90b0200000003000000e0c9ea79f9bace118c8200aa004ba90b5000000068007400740070003a002f002f007700770077002e006d006f006400730065006300750072006900740079002e006f00720067002f000000795881f43b1d7f48af2c825dc485276300000000a5ab000000}} }{\fldrslt {\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \cs16\f0\fs24\ul\cf2\insrsid6385683\charrsid16350125 http://www.modsecurity.org}}}\sectd \ltrsect\linex0\endnhere\sectlinegrid360\sectdefaultcl\sftnbj {\field\fldedit{\*\fldinst {\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \f0\fs24\insrsid6385683\charrsid16350125 HYPERLINK "http://engineering/" }{\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \f0\fs24\insrsid2315486\charrsid16350125 {\*\datafield 00d0c9ea79f9bace118c8200aa004ba90b0200000003000000e0c9ea79f9bace118c8200aa004ba90b4000000068007400740070003a002f002f0065006e00670069006e0065006500720069006e0067002f000000795881f43b1d7f48af2c825dc485276300000000a5ab000000}}}{\fldrslt {\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \cs16\f0\fs24\ul\cf2\insrsid6385683\charrsid16350125 /}}}\sectd \ltrsect\linex0\endnhere\sectlinegrid360\sectdefaultcl\sftnbj {\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \f0\fs24\insrsid6385683\charrsid16350125 \par OWASP Core Rule Set for ModSecurity: }{\field\fldedit{\*\fldinst {\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \f0\fs24\insrsid6385683\charrsid16350125 HYPERLINK "https://www.owasp.org/index.php/Category:OWASP_ModSecurity_Core_Rule_Set_Project" }{\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \f0\fs24\insrsid2315486\charrsid16350125 {\*\datafield 00d0c9ea79f9bace118c8200aa004ba90b0200000003000000e0c9ea79f9bace118c8200aa004ba90bba000000680074007400700073003a002f002f007700770077002e006f0077006100730070002e006f00720067002f0069006e006400650078002e007000680070002f00430061007400650067006f00720079003a00 4f0057004100530050005f004d006f006400530065006300750072006900740079005f0043006f00720065005f00520075006c0065005f005300650074005f00500072006f006a006500630074000000795881f43b1d7f48af2c825dc485276300000000a5ab000000}}}{\fldrslt {\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \cs16\f0\fs24\ul\cf2\insrsid6385683\charrsid16350125 https://}}}\sectd \ltrsect\linex0\endnhere\sectlinegrid360\sectdefaultcl\sftnbj {\field\fldedit{\*\fldinst {\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \f0\fs24\insrsid2315486 HYPERLINK "https://www.owasp.org/index.php/Category:OWASP_ModSecurity_Core_Rule_Set_Project"}{\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \f0\fs24\insrsid2315486\charrsid16350125 {\*\datafield 00d0c9ea79f9bace118c8200aa004ba90b0200000003000000e0c9ea79f9bace118c8200aa004ba90bba000000680074007400700073003a002f002f007700770077002e006f0077006100730070002e006f00720067002f0069006e006400650078002e007000680070002f00430061007400650067006f00720079003a00 4f0057004100530050005f004d006f006400530065006300750072006900740079005f0043006f00720065005f00520075006c0065005f005300650074005f00500072006f006a006500630074000000795881f43b1d7f48af2c825dc485276300000000a5ab000000}}}{\fldrslt {\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \cs16\f0\fs24\ul\cf2\insrsid6385683\charrsid16350125 www.owasp.org/index.php/Category:OWASP_ModSecurity_Core_Rule_Set_Project}}}\sectd \ltrsect\linex0\endnhere\sectlinegrid360\sectdefaultcl\sftnbj {\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \f0\fs24\insrsid6385683\charrsid16350125 \par }{\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \f0\fs24\insrsid6633290 The OWASP CRS was installed on your system drive, under }{\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \b\f0\fs24\insrsid6633290\charrsid6633290 inetpub\\wwwroot\\owasp_crs}{\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \f0\fs24\insrsid6633290 \par You can include it in your website by adding to your }{\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \b\f0\fs24\insrsid6633290\charrsid6633290 web.config}{\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \f0\fs24\insrsid6633290 file, in }{\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \b\f0\fs24\insrsid6633290\charrsid6633290 system.webServer}{\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \f0\fs24\insrsid6633290 section: \par }{\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \f0\fs24\insrsid6633290\charrsid6633290 \par }{\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \f0\fs24\lang1045\langfe1033\langnp1045\insrsid6385683\charrsid16350125 MSRC blog }{\field\fldedit{\*\fldinst {\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \f0\fs24\lang1045\langfe1033\langnp1045\insrsid6385683\charrsid16350125 HYPERLINK "http://blogs.technet.com/b/srd/" }{\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \f0\fs24\lang1045\langfe1033\langnp1045\insrsid2315486\charrsid16350125 {\*\datafield 00d0c9ea79f9bace118c8200aa004ba90b0200000003000000e0c9ea79f9bace118c8200aa004ba90b5800000068007400740070003a002f002f0062006c006f00670073002e0074006500630068006e00650074002e0063006f006d002f0062002f007300720064002f000000795881f43b1d7f48af2c825dc48527630000 0000a5ab000000}}}{\fldrslt {\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \cs16\f0\fs24\ul\cf2\lang1045\langfe1033\langnp1045\insrsid6385683\charrsid16350125 http://blogs.technet.com/b/srd/}}}\sectd \ltrsect\linex0\endnhere\sectlinegrid360\sectdefaultcl\sftnbj { \rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \f0\fs24\lang1045\langfe1033\langnp1045\insrsid6385683\charrsid16350125 }{\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \f0\fs24\lang1045\langfe1033\langnp1045\insrsid6385683\charrsid6633290 \par }{\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \f0\fs24\insrsid6385683\charrsid16350125 Trustwave SpiderLabs blog: }{\field\fldedit{\*\fldinst {\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \f0\fs24\insrsid2315486 HYPERLINK "http://blog.spiderlabs.com/"}{\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \f0\fs24\insrsid2315486\charrsid16350125 {\*\datafield 00d0c9ea79f9bace118c8200aa004ba90b0200000003000000e0c9ea79f9bace118c8200aa004ba90b5000000068007400740070003a002f002f0062006c006f0067002e007300700069006400650072006c006100620073002e0063006f006d002f000000795881f43b1d7f48af2c825dc485276300000000a5ab000000}} }{\fldrslt {\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \cs16\f0\fs24\ul\cf2\insrsid6385683\charrsid16350125 http://blog.spiderlabs.com}}}\sectd \ltrsect\linex0\endnhere\sectlinegrid360\sectdefaultcl\sftnbj {\field\fldedit{\*\fldinst {\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \f0\fs24\insrsid6385683\charrsid16350125 HYPERLINK "http://blog.spiderlabs.com/" }{\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \f0\fs24\insrsid2315486\charrsid16350125 {\*\datafield 00d0c9ea79f9bace118c8200aa004ba90b0200000003000000e0c9ea79f9bace118c8200aa004ba90b5000000068007400740070003a002f002f0062006c006f0067002e007300700069006400650072006c006100620073002e0063006f006d002f000000795881f43b1d7f48af2c825dc485276300000000a5ab000000}} }{\fldrslt {\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \cs16\f0\fs24\ul\cf2\insrsid6385683\charrsid16350125 /}}}\sectd \ltrsect\linex0\endnhere\sectlinegrid360\sectdefaultcl\sftnbj {\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \f0\fs24\insrsid6385683\charrsid16350125 \par Trustwave Commercial Rule Set for ModSecurity: }{\field\fldedit{\*\fldinst {\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \f0\fs24\insrsid2315486 HYPERLINK "https://www.trustwave.com/modsecurity-rules-support.php"}{\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \f0\fs24\insrsid2315486\charrsid16350125 {\*\datafield 00d0c9ea79f9bace118c8200aa004ba90b0200000003000000e0c9ea79f9bace118c8200aa004ba90b88000000680074007400700073003a002f002f007700770077002e007400720075007300740077006100760065002e0063006f006d002f006d006f006400730065006300750072006900740079002d00720075006c00 650073002d0073007500700070006f00720074002e007000680070000000795881f43b1d7f48af2c825dc485276300000000a5ab000000}}}{\fldrslt {\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \cs16\f0\fs24\ul\cf2\insrsid6385683\charrsid16350125 https://www.trustwave.com/modsecurity-rules-support.php}}}\sectd \ltrsect\linex0\endnhere\sectlinegrid360\sectdefaultcl\sftnbj {\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \f0\fs24\insrsid6385683\charrsid16350125 \par }\pard \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 {\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid6967166 \par }{\*\themedata 504b030414000600080000002100e9de0fbfff0000001c020000130000005b436f6e74656e745f54797065735d2e786d6cac91cb4ec3301045f748fc83e52d4a 9cb2400825e982c78ec7a27cc0c8992416c9d8b2a755fbf74cd25442a820166c2cd933f79e3be372bd1f07b5c3989ca74aaff2422b24eb1b475da5df374fd9ad 5689811a183c61a50f98f4babebc2837878049899a52a57be670674cb23d8e90721f90a4d2fa3802cb35762680fd800ecd7551dc18eb899138e3c943d7e503b6 b01d583deee5f99824e290b4ba3f364eac4a430883b3c092d4eca8f946c916422ecab927f52ea42b89a1cd59c254f919b0e85e6535d135a8de20f20b8c12c3b0 0c895fcf6720192de6bf3b9e89ecdbd6596cbcdd8eb28e7c365ecc4ec1ff1460f53fe813d3cc7f5b7f020000ffff0300504b030414000600080000002100a5d6 a7e7c0000000360100000b0000005f72656c732f2e72656c73848fcf6ac3300c87ef85bd83d17d51d2c31825762fa590432fa37d00e1287f68221bdb1bebdb4f c7060abb0884a4eff7a93dfeae8bf9e194e720169aaa06c3e2433fcb68e1763dbf7f82c985a4a725085b787086a37bdbb55fbc50d1a33ccd311ba548b6309512 0f88d94fbc52ae4264d1c910d24a45db3462247fa791715fd71f989e19e0364cd3f51652d73760ae8fa8c9ffb3c330cc9e4fc17faf2ce545046e37944c69e462 a1a82fe353bd90a865aad41ed0b5b8f9d6fd010000ffff0300504b0304140006000800000021006b799616830000008a0000001c0000007468656d652f746865 6d652f7468656d654d616e616765722e786d6c0ccc4d0ac3201040e17da17790d93763bb284562b2cbaebbf600439c1a41c7a0d29fdbd7e5e38337cedf14d59b 4b0d592c9c070d8a65cd2e88b7f07c2ca71ba8da481cc52c6ce1c715e6e97818c9b48d13df49c873517d23d59085adb5dd20d6b52bd521ef2cdd5eb9246a3d8b 4757e8d3f729e245eb2b260a0238fd010000ffff0300504b030414000600080000002100da7e1364a9060000a41b0000160000007468656d652f7468656d652f 7468656d65312e786d6cec594d6f1b4518be23f11f467b6f6327761a4775aad8b11b48d346b15bd4e37877bc3bcdecce6a669cd437d41e9190100571a012370e 08a8d44a5ccaaf09144191fa1778676677bd13af49d24650417b68bcb3cffbfd31efcc5ebd763f66e890084979d2f6ea976b1e2289cf039a846deff6b07f69cd 4352e124c08c27a4ed4d89f4ae6dbcffde55bcae22121304f4895cc76d2f522a5d5f5a923e2c637999a7248177632e62ace051844b81c047c037664bcbb5daea 528c69e2a104c7c0f6d6784c7d82869aa5b79133ef31784c94d40b3e1303cd9a3814061b1cd435424e659709748859db0339013f1a92fbca430c4b052fda5ead d6efd76aded2c6d525bc9e1131b580d6a1abc1bf8c2e23080e968d4c118e0aa1f57ea37565abe06f004ccde37abd5eb7572ff81900f67db0d4ea52e6d9e8afd5 3b39cf12c8fe9ce7ddad356b0d175fe2bf32a773abd3e9345b992e96a901d99f8d39fc5a6db5b1b9ece00dc8e29b73f84667b3db5d75f00664f1ab73f8fe95d6 6ac3c51b50c468723087d671e9f733ee0564ccd976257c0de06b79206728c88622bbb488314fd4a25c8bf13d2efa00d04086154d909aa6648c7dc8e22e8e4782 62ad0f5e27b8f4c62ef9726e49cb42d21734556defc3144345ccf8bd7afefdabe74fd1f18367c70f7e3a7ef8f0f8c18f969143b58d93b04cf5f2dbcffe7cfc31 fae3e9372f1f7d518d9765fcaf3f7cf2cbcf9f5703a17c66eabcf8f2c96fcf9ebcf8ead3dfbf7b5401df147854860f694c24ba498ed03e8fc130e31557733212 e7a31846989629369350e2046b2915fc7b2a72d037a79865d171f4e810d7837704b48f2ae0f5c93d47e14124268a5648de896207b8cb39eb7051e9851d2dabe4 e6e12409ab858b4919b78ff16195ec2e4e9cf8f62629f4cd3c2d1dc3bb1171d4dc6338513824095148bfe307845458779752c7afbbd4175cf2b1427729ea605a e992211d39d93423daa631c4655a6533c4dbf1cdee1dd4e1accaea2d72e822a12a30ab507e4898e3c6eb78a2705cc57288635676f80daca22a250753e197713d a920d221611cf502226515cd2d01f69682be83a16355867d974d631729143da8e27903735e466ef1836e84e3b40a3ba04954c67e200f204531dae3aa0abecbdd 0ad1cf10079c2c0cf71d4a9c709fde0d6ed3d051699620facd4454c4f23ae14efe0ea66c8c896935d0d49d5e1dd3e4ef1a37a3d0b9ad848b6bdcd02a5f7cfdb8 42efb7b5656fc2ee555533db271af522dcc9f6dce522a06f7f77dec293648f4041cc6f51ef9af3bbe6ecfde79bf3a27abef8963cebc2d0a0f52c62076d3376c7 0ba7ee31656ca0a68cdc9066f096b0f7047d58d474e6c4498a53581ac14f5dc920c0c185021b1a24b8fa88aa6810e11486f6baa7998432631d4a9472098745b3 5cc95be361f057f6a8d9d48710db392456bb3cb0cb2b7a393f6b146c8c56a139d0e682563483b30a5bb9923105db5e47585d2b75666975a39a698a8eb4c264ed 627328079717a6c162e14d186a108c42e0e55538f36bd170d8c18c04daef364679584c142e324432c201c962a4ed9e8f51dd0429cf953943b41d3619f4c1f114 af95a4b534db379076962095c5351688cba3f72651ca33781625e076b21c59522e4e96a0a3b6d76a2e373de4e3b4ed8de19c0c3fe314a22ef51c895908974dbe 1236ed4f2d6653e5b368b672c3dc22a8c3d587f5fb9cc14e1f4885545b58463635ccab2c0558a22559fd979be0d68b32a0a21b9d4d8b953548867f4d0bf0a31b 5a321e135f95835d5ad1beb38f592be51345c4200a8ed0884dc43e86f0eb54057b022ae1bac37404fd007773dadbe695db9cb3a22bdf88199c5dc72c8d70d66e 7589e6956ce1a621153a98a7927a605ba5eec6b8f39b624afe824c29a7f1ffcc14bd9fc0edc34aa023e0c3d5b0c048574adbe342451cba501a51bf2f607030bd 03b205ee77e13524155c509bbf821ceabfb6e62c0f53d6708854fb344482c27ea42241c81eb425937da730ab677b9765c9324626a34aeacad4aa3d2287840d75 0f5cd57bbb87224875d34db236607027f3cf7dce2a6814ea21a75c6f4e272bf65e5b03fff4e4638b198c72fbb0196872ff172a16e3c16c57b5f4863cdf7bcb86 e817b331ab915705082b6d05adacec5f5385736eb5b663cd59bcdccc958328ce5b0c8bc54094c21d12d2ffc1fe4785cfecd70ebda10ef93ef456041f2f343348 1bc8ea4b76f040ba41dac5110c4e76d1269366655d9b8d4eda6bf9667dc1936e21f784b3b5666789f7399d5d0c67ae38a7162fd2d999871d5fdbb585ae86c89e 2c51581ae707191318f399acfc258b8fee41a0b7e09bc18429699209be53090c33f4c0d40114bf95684837fe020000ffff0300504b0304140006000800000021 000dd1909fb60000001b010000270000007468656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73848f4d0ac2301484 f78277086f6fd3ba109126dd88d0add40384e4350d363f2451eced0dae2c082e8761be9969bb979dc9136332de3168aa1a083ae995719ac16db8ec8e4052164e 89d93b64b060828e6f37ed1567914b284d262452282e3198720e274a939cd08a54f980ae38a38f56e422a3a641c8bbd048f7757da0f19b017cc524bd62107bd5 001996509affb3fd381a89672f1f165dfe514173d9850528a2c6cce0239baa4c04ca5bbabac4df000000ffff0300504b01022d0014000600080000002100e9de 0fbfff0000001c0200001300000000000000000000000000000000005b436f6e74656e745f54797065735d2e786d6c504b01022d0014000600080000002100a5 d6a7e7c0000000360100000b00000000000000000000000000300100005f72656c732f2e72656c73504b01022d00140006000800000021006b79961683000000 8a0000001c00000000000000000000000000190200007468656d652f7468656d652f7468656d654d616e616765722e786d6c504b01022d001400060008000000 2100da7e1364a9060000a41b00001600000000000000000000000000d60200007468656d652f7468656d652f7468656d65312e786d6c504b01022d0014000600 0800000021000dd1909fb60000001b0100002700000000000000000000000000b30900007468656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73504b050600000000050005005d010000ae0a00000000} {\*\colorschememapping 3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d22796573223f3e0d0a3c613a636c724d 617020786d6c6e733a613d22687474703a2f2f736368656d61732e6f70656e786d6c666f726d6174732e6f72672f64726177696e676d6c2f323030362f6d6169 6e22206267313d226c743122207478313d22646b3122206267323d226c743222207478323d22646b322220616363656e74313d22616363656e74312220616363 656e74323d22616363656e74322220616363656e74333d22616363656e74332220616363656e74343d22616363656e74342220616363656e74353d22616363656e74352220616363656e74363d22616363656e74362220686c696e6b3d22686c696e6b2220666f6c486c696e6b3d22666f6c486c696e6b222f3e} {\*\latentstyles\lsdstimax267\lsdlockeddef0\lsdsemihiddendef1\lsdunhideuseddef1\lsdqformatdef0\lsdprioritydef99{\lsdlockedexcept \lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority0 \lsdlocked0 Normal; \lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 1;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 2;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 3;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 4; \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 5;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 6;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 7;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 8;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 9; \lsdpriority39 \lsdlocked0 toc 1;\lsdpriority39 \lsdlocked0 toc 2;\lsdpriority39 \lsdlocked0 toc 3;\lsdpriority39 \lsdlocked0 toc 4;\lsdpriority39 \lsdlocked0 toc 5;\lsdpriority39 \lsdlocked0 toc 6;\lsdpriority39 \lsdlocked0 toc 7; \lsdpriority39 \lsdlocked0 toc 8;\lsdpriority39 \lsdlocked0 toc 9;\lsdqformat1 \lsdpriority35 \lsdlocked0 caption;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority10 \lsdlocked0 Title;\lsdpriority1 \lsdlocked0 Default Paragraph Font; \lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority11 \lsdlocked0 Subtitle;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority22 \lsdlocked0 Strong;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority20 \lsdlocked0 Emphasis; \lsdsemihidden0 \lsdunhideused0 \lsdpriority59 \lsdlocked0 Table Grid;\lsdunhideused0 \lsdlocked0 Placeholder Text;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority1 \lsdlocked0 No Spacing; \lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid; \lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1; \lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2; \lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading; \lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 1; \lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 1; \lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 1;\lsdunhideused0 \lsdlocked0 Revision; \lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority34 \lsdlocked0 List Paragraph;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority29 \lsdlocked0 Quote;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority30 \lsdlocked0 Intense Quote; \lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 1; \lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 1; \lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 2; \lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 2; \lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 2; \lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 2; \lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 2; \lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 3; \lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 3; \lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 3; \lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 3; \lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 3; \lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 4; \lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 4; \lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 4; \lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 4; \lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 5; \lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 5; \lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 5; \lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 5; \lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 5; \lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 6; \lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 6; \lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 6; \lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 6; \lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 6; \lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority19 \lsdlocked0 Subtle Emphasis;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority21 \lsdlocked0 Intense Emphasis; \lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority31 \lsdlocked0 Subtle Reference;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority32 \lsdlocked0 Intense Reference; \lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority33 \lsdlocked0 Book Title;\lsdpriority37 \lsdlocked0 Bibliography;\lsdqformat1 \lsdpriority39 \lsdlocked0 TOC Heading;}}{\*\datastore 010500000200000018000000 4d73786d6c322e534158584d4c5265616465722e362e3000000000000000000000060000 d0cf11e0a1b11ae1000000000000000000000000000000003e000300feff090006000000000000000000000001000000010000000000000000100000feffffff00000000feffffff0000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff fffffffffffffffffdfffffffeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffff52006f006f007400200045006e00740072007900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000500ffffffffffffffffffffffff0c6ad98892f1d411a65f0040963251e5000000000000000000000000e065 dc7748f3cd01feffffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000105000000000000}}modsecurity-apache_2.7.7/iis/ModSecurityIIS/ModSecurityIIS/install.vbs0000664000175000017500000000027712243422537026243 0ustar zimmerlezimmerleSet WshShell = CreateObject("WScript.Shell") WshShell.Exec("%windir%\system32\inetsrv\appcmd.exe install module /name:ModSecurityIIS /image:%windir%\system32\inetsrv\modsecurityiis.dll") modsecurity-apache_2.7.7/iis/ModSecurityIIS/ModSecurityIIS/EULA.rtf0000664000175000017500000013374012243422537025326 0ustar zimmerlezimmerle{\rtf1\adeflang1025\ansi\ansicpg1252\uc1\adeff0\deff0\stshfdbch0\stshfloch31506\stshfhich31506\stshfbi31506\deflang1033\deflangfe1033\themelang1033\themelangfe0\themelangcs0{\fonttbl{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;} {\f37\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri;}{\flomajor\f31500\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;} {\fdbmajor\f31501\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\fhimajor\f31502\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria;} {\fbimajor\f31503\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\flominor\f31504\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;} {\fdbminor\f31505\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\fhiminor\f31506\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri;} {\fbiminor\f31507\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f39\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\f40\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;} {\f42\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\f43\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\f44\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\f45\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);} {\f46\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\f47\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\f39\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\f40\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;} {\f42\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\f43\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\f44\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\f45\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);} {\f46\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\f47\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\f409\fbidi \fswiss\fcharset238\fprq2 Calibri CE;}{\f410\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr;} {\f412\fbidi \fswiss\fcharset161\fprq2 Calibri Greek;}{\f413\fbidi \fswiss\fcharset162\fprq2 Calibri Tur;}{\f416\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic;}{\f417\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese);} {\flomajor\f31508\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\flomajor\f31509\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\flomajor\f31511\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;} {\flomajor\f31512\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\flomajor\f31513\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\flomajor\f31514\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);} {\flomajor\f31515\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\flomajor\f31516\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\fdbmajor\f31518\fbidi \froman\fcharset238\fprq2 Times New Roman CE;} {\fdbmajor\f31519\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\fdbmajor\f31521\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\fdbmajor\f31522\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;} {\fdbmajor\f31523\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\fdbmajor\f31524\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\fdbmajor\f31525\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;} {\fdbmajor\f31526\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\fhimajor\f31528\fbidi \froman\fcharset238\fprq2 Cambria CE;}{\fhimajor\f31529\fbidi \froman\fcharset204\fprq2 Cambria Cyr;} {\fhimajor\f31531\fbidi \froman\fcharset161\fprq2 Cambria Greek;}{\fhimajor\f31532\fbidi \froman\fcharset162\fprq2 Cambria Tur;}{\fhimajor\f31535\fbidi \froman\fcharset186\fprq2 Cambria Baltic;} {\fhimajor\f31536\fbidi \froman\fcharset163\fprq2 Cambria (Vietnamese);}{\fbimajor\f31538\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\fbimajor\f31539\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;} {\fbimajor\f31541\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\fbimajor\f31542\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\fbimajor\f31543\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);} {\fbimajor\f31544\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\fbimajor\f31545\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\fbimajor\f31546\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);} {\flominor\f31548\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\flominor\f31549\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\flominor\f31551\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;} {\flominor\f31552\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\flominor\f31553\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\flominor\f31554\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);} {\flominor\f31555\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\flominor\f31556\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\fdbminor\f31558\fbidi \froman\fcharset238\fprq2 Times New Roman CE;} {\fdbminor\f31559\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\fdbminor\f31561\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\fdbminor\f31562\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;} {\fdbminor\f31563\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\fdbminor\f31564\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\fdbminor\f31565\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;} {\fdbminor\f31566\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\fhiminor\f31568\fbidi \fswiss\fcharset238\fprq2 Calibri CE;}{\fhiminor\f31569\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr;} {\fhiminor\f31571\fbidi \fswiss\fcharset161\fprq2 Calibri Greek;}{\fhiminor\f31572\fbidi \fswiss\fcharset162\fprq2 Calibri Tur;}{\fhiminor\f31575\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic;} {\fhiminor\f31576\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese);}{\fbiminor\f31578\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\fbiminor\f31579\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;} {\fbiminor\f31581\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\fbiminor\f31582\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\fbiminor\f31583\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);} {\fbiminor\f31584\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\fbiminor\f31585\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\fbiminor\f31586\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}} {\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0; \red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}{\*\defchp \f31506\fs22 }{\*\defpap \ql \li0\ri0\sa200\sl276\slmult1 \widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 }\noqfpromote {\stylesheet{\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \f31506\fs22\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \snext0 \sqformat \spriority0 Normal;}{\*\cs10 \additive \ssemihidden \sunhideused \spriority1 Default Paragraph Font;}{\* \ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\trcbpat1\trcfpat1\tblind0\tblindtype3\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv \ql \li0\ri0\sa200\sl276\slmult1 \widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af31506\afs22\alang1025 \ltrch\fcs0 \f31506\fs22\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \snext11 \ssemihidden \sunhideused Normal Table;}{ \s15\ql \li0\ri0\sb100\sa100\sbauto1\saauto1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext15 \ssemihidden \sunhideused \styrsid3168183 Normal (Web);}{\*\cs16 \additive \rtlch\fcs1 \af0 \ltrch\fcs0 \ul\cf2 \sbasedon10 \ssemihidden \sunhideused \styrsid3168183 Hyperlink;}{\*\cs17 \additive \rtlch\fcs1 \ab\af0 \ltrch\fcs0 \b \sbasedon10 \sqformat \spriority22 \styrsid3168183 Strong;}}{\*\listtable{\list\listtemplateid235441858{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'02\'00.;}{\levelnumbers\'01;} \rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li720\jclisttab\tx720\lin720 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'01.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li1440\jclisttab\tx1440\lin1440 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'02.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li2160 \jclisttab\tx2160\lin2160 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'03.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li2880\jclisttab\tx2880\lin2880 } {\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'04.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li3600\jclisttab\tx3600\lin3600 }{\listlevel\levelnfc0 \levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'05.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li4320\jclisttab\tx4320\lin4320 }{\listlevel\levelnfc0\levelnfcn0\leveljc0 \leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'06.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li5040\jclisttab\tx5040\lin5040 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0 \levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'07.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li5760\jclisttab\tx5760\lin5760 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative \levelspace0\levelindent0{\leveltext\'02\'08.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li6480\jclisttab\tx6480\lin6480 }{\listname ;}\listid625282538}}{\*\listoverridetable{\listoverride\listid625282538\listoverridecount0\ls1}}{\*\pgptbl {\pgp\ipgp2\itap0\li0\ri0\sb0\sa0}{\pgp\ipgp4\itap0\li0\ri0\sb0\sa0}{\pgp\ipgp0\itap0\li0\ri0\sb0\sa0}{\pgp\ipgp3\itap0\li0\ri0\sb0\sa0}}{\*\rsidtbl \rsid1197496\rsid3168183\rsid6967166\rsid9512544\rsid12742482\rsid16593896}{\mmathPr\mmathFont34\mbrkBin0 \mbrkBinSub0\msmallFrac0\mdispDef1\mlMargin0\mrMargin0\mdefJc1\mwrapIndent1440\mintLim0\mnaryLim1}{\info{\author Suha Can}{\operator Greg}{\creatim\yr2012\mo6\dy4\hr11\min43}{\revtim\yr2012\mo7\dy9\min41}{\version3}{\edmins2}{\nofpages4}{\nofwords1368} {\nofchars7798}{\*\company Microsoft Corporation}{\nofcharsws9148}{\vern49273}}{\*\xmlnstbl {\xmlns1 http://schemas.microsoft.com/office/word/2003/wordml}}\paperw12240\paperh15840\margl1440\margr1440\margt1440\margb1440\gutter0\ltrsect \widowctrl\ftnbj\aenddoc\trackmoves0\trackformatting1\donotembedsysfont1\relyonvml0\donotembedlingdata0\grfdocevents0\validatexml1\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0\showxmlerrors1\noxlattoyen \expshrtn\noultrlspc\dntblnsbdb\nospaceforul\formshade\horzdoc\dgmargin\dghspace180\dgvspace180\dghorigin1440\dgvorigin1440\dghshow1\dgvshow1 \jexpand\viewkind1\viewscale100\pgbrdrhead\pgbrdrfoot\splytwnine\ftnlytwnine\htmautsp\nolnhtadjtbl\useltbaln\alntblind\lytcalctblwd\lyttblrtgr\lnbrkrule\nobrkwrptbl\snaptogridincell\allowfieldendsel\wrppunct \asianbrkrule\rsidroot9512544\newtblstyruls\nogrowautofit\usenormstyforlist\noindnmbrts\felnbrelev\nocxsptable\indrlsweleven\noafcnsttbl\afelev\utinl\hwelev\spltpgpar\notcvasp\notbrkcnstfrctbl\notvatxbx\krnprsnet\cachedcolbal \nouicompat \fet0 {\*\wgrffmtfilter 2450}\nofeaturethrottle1\ilfomacatclnup0\ltrpar \sectd \ltrsect\linex0\endnhere\sectlinegrid360\sectdefaultcl\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}} \pard\plain \ltrpar\s15\ql \li0\ri0\sb100\sa100\sbauto1\saauto1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid3168183 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 { \rtlch\fcs1 \af0 \ltrch\fcs0 \lang9\langfe1033\langnp9\insrsid3168183 Apache License\line \line Version 2.0, January 2004\line \line }{\field\fldedit{\*\fldinst {\rtlch\fcs1 \af0 \ltrch\fcs0 \lang9\langfe1033\langnp9\insrsid3168183 HYPERLINK "http://www.apache.org/licenses/" }}{\fldrslt {\rtlch\fcs1 \af0 \ltrch\fcs0 \cs16\ul\cf2\lang9\langfe1033\langnp9\insrsid3168183 http://www.apache.org/licenses/}}}\sectd \ltrsect\linex0\endnhere\sectlinegrid360\sectdefaultcl\sftnbj {\rtlch\fcs1 \af0 \ltrch\fcs0 \lang9\langfe1033\langnp9\insrsid3168183 \par TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION \par }{\rtlch\fcs1 \ab\af0 \ltrch\fcs0 \cs17\b\lang9\langfe1033\langnp9\insrsid3168183 {\*\bkmkstart definitions}1. Definitions}{\rtlch\fcs1 \af0 \ltrch\fcs0 \lang9\langfe1033\langnp9\insrsid3168183 {\*\bkmkend definitions}. \par "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. \par "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. \par " Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. \par "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. \par "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. \par "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. \par "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). \par "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that rema in separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. \par "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitt e d" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." \par "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. \par }{\rtlch\fcs1 \ab\af0 \ltrch\fcs0 \cs17\b\lang9\langfe1033\langnp9\insrsid3168183 {\*\bkmkstart copyright}2. Grant of Copyright License}{\rtlch\fcs1 \af0 \ltrch\fcs0 \lang9\langfe1033\langnp9\insrsid3168183 {\*\bkmkend copyright} . Subject to the terms and conditions of this License, each Contributor here by grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. \par }{\rtlch\fcs1 \ab\af0 \ltrch\fcs0 \cs17\b\lang9\langfe1033\langnp9\insrsid3168183 {\*\bkmkstart patent}3. Grant of Patent License}{\rtlch\fcs1 \af0 \ltrch\fcs0 \lang9\langfe1033\langnp9\insrsid3168183 {\*\bkmkend patent} . Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) pate nt license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by com b ination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. \par }{\rtlch\fcs1 \ab\af0 \ltrch\fcs0 \cs17\b\lang9\langfe1033\langnp9\insrsid3168183 {\*\bkmkstart redistribution}4. Redistribution}{\rtlch\fcs1 \af0 \ltrch\fcs0 \lang9\langfe1033\langnp9\insrsid3168183 {\*\bkmkend redistribution} . You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: \par {\listtext\pard\plain\ltrpar \s15 \rtlch\fcs1 \af0 \ltrch\fcs0 \lang9\langfe1033\langnp9\insrsid3168183 \hich\af0\dbch\af0\loch\f0 1.\tab}}\pard \ltrpar\s15\ql \fi-360\li720\ri0\sb100\sa100\sbauto1\saauto1\widctlpar \jclisttab\tx720\wrapdefault\aspalpha\aspnum\faauto\ls1\adjustright\rin0\lin720\itap0\pararsid3168183 {\rtlch\fcs1 \af0 \ltrch\fcs0 \lang9\langfe1033\langnp9\insrsid3168183 You must give any other recipients of the Work or D erivative Works a copy of this License; and \par {\listtext\pard\plain\ltrpar \s15 \rtlch\fcs1 \af0 \ltrch\fcs0 \lang9\langfe1033\langnp9\insrsid3168183 \hich\af0\dbch\af0\loch\f0 2.\tab}You must cause any modified files to carry prominent notices stating that You changed the files; and \par {\listtext\pard\plain\ltrpar \s15 \rtlch\fcs1 \af0 \ltrch\fcs0 \lang9\langfe1033\langnp9\insrsid3168183 \hich\af0\dbch\af0\loch\f0 3.\tab}You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, tradema rk, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and \par {\listtext\pard\plain\ltrpar \s15 \rtlch\fcs1 \af0 \ltrch\fcs0 \lang9\langfe1033\langnp9\insrsid3168183 \hich\af0\dbch\af0\loch\f0 4.\tab}If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You dis tribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distribu t ed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additiona l attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modificat ions, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. \par }\pard \ltrpar\s15\ql \li0\ri0\sb100\sa100\sbauto1\saauto1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid3168183 {\rtlch\fcs1 \ab\af0 \ltrch\fcs0 \cs17\b\lang9\langfe1033\langnp9\insrsid3168183 {\*\bkmkstart contributions}5. Submission of Contributions}{\rtlch\fcs1 \af0 \ltrch\fcs0 \lang9\langfe1033\langnp9\insrsid3168183 {\*\bkmkend contributions}. Unless You explicitly state otherwise, any Contri bution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the te rms of any separate license agreement you may have executed with Licensor regarding such Contributions. \par }{\rtlch\fcs1 \ab\af0 \ltrch\fcs0 \cs17\b\lang9\langfe1033\langnp9\insrsid3168183 {\*\bkmkstart trademarks}6. Trademarks}{\rtlch\fcs1 \af0 \ltrch\fcs0 \lang9\langfe1033\langnp9\insrsid3168183 {\*\bkmkend trademarks} . This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as requ ired for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. \par }{\rtlch\fcs1 \ab\af0 \ltrch\fcs0 \cs17\b\lang9\langfe1033\langnp9\insrsid3168183 {\*\bkmkstart no-warranty}7. Disclaimer of Warranty}{\rtlch\fcs1 \af0 \ltrch\fcs0 \lang9\langfe1033\langnp9\insrsid3168183 {\*\bkmkend no-warranty} . Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributo r provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULA R PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. \par }{\rtlch\fcs1 \ab\af0 \ltrch\fcs0 \cs17\b\lang9\langfe1033\langnp9\insrsid3168183 {\*\bkmkstart no-liability}8. Limitation of Liability}{\rtlch\fcs1 \af0 \ltrch\fcs0 \lang9\langfe1033\langnp9\insrsid3168183 {\*\bkmkend no-liability} . In no event and under no legal th eory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indi r ect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfuncti on, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. \par }{\rtlch\fcs1 \ab\af0 \ltrch\fcs0 \cs17\b\lang9\langfe1033\langnp9\insrsid3168183 {\*\bkmkstart additional}9. Accepting Warranty or Additional Liability}{\rtlch\fcs1 \af0 \ltrch\fcs0 \lang9\langfe1033\langnp9\insrsid3168183 {\*\bkmkend additional} . While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibilit y , not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additiona l liability. \par END OF TERMS AND CONDITIONS \par }\pard\plain \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \f31506\fs22\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid6967166 \par }{\*\themedata 504b030414000600080000002100e9de0fbfff0000001c020000130000005b436f6e74656e745f54797065735d2e786d6cac91cb4ec3301045f748fc83e52d4a 9cb2400825e982c78ec7a27cc0c8992416c9d8b2a755fbf74cd25442a820166c2cd933f79e3be372bd1f07b5c3989ca74aaff2422b24eb1b475da5df374fd9ad 5689811a183c61a50f98f4babebc2837878049899a52a57be670674cb23d8e90721f90a4d2fa3802cb35762680fd800ecd7551dc18eb899138e3c943d7e503b6 b01d583deee5f99824e290b4ba3f364eac4a430883b3c092d4eca8f946c916422ecab927f52ea42b89a1cd59c254f919b0e85e6535d135a8de20f20b8c12c3b0 0c895fcf6720192de6bf3b9e89ecdbd6596cbcdd8eb28e7c365ecc4ec1ff1460f53fe813d3cc7f5b7f020000ffff0300504b030414000600080000002100a5d6 a7e7c0000000360100000b0000005f72656c732f2e72656c73848fcf6ac3300c87ef85bd83d17d51d2c31825762fa590432fa37d00e1287f68221bdb1bebdb4f c7060abb0884a4eff7a93dfeae8bf9e194e720169aaa06c3e2433fcb68e1763dbf7f82c985a4a725085b787086a37bdbb55fbc50d1a33ccd311ba548b6309512 0f88d94fbc52ae4264d1c910d24a45db3462247fa791715fd71f989e19e0364cd3f51652d73760ae8fa8c9ffb3c330cc9e4fc17faf2ce545046e37944c69e462 a1a82fe353bd90a865aad41ed0b5b8f9d6fd010000ffff0300504b0304140006000800000021006b799616830000008a0000001c0000007468656d652f746865 6d652f7468656d654d616e616765722e786d6c0ccc4d0ac3201040e17da17790d93763bb284562b2cbaebbf600439c1a41c7a0d29fdbd7e5e38337cedf14d59b 4b0d592c9c070d8a65cd2e88b7f07c2ca71ba8da481cc52c6ce1c715e6e97818c9b48d13df49c873517d23d59085adb5dd20d6b52bd521ef2cdd5eb9246a3d8b 4757e8d3f729e245eb2b260a0238fd010000ffff0300504b030414000600080000002100da7e1364a9060000a41b0000160000007468656d652f7468656d652f 7468656d65312e786d6cec594d6f1b4518be23f11f467b6f6327761a4775aad8b11b48d346b15bd4e37877bc3bcdecce6a669cd437d41e9190100571a012370e 08a8d44a5ccaaf09144191fa1778676677bd13af49d24650417b68bcb3cffbfd31efcc5ebd763f66e890084979d2f6ea976b1e2289cf039a846deff6b07f69cd 4352e124c08c27a4ed4d89f4ae6dbcffde55bcae22121304f4895cc76d2f522a5d5f5a923e2c637999a7248177632e62ace051844b81c047c037664bcbb5daea 528c69e2a104c7c0f6d6784c7d82869aa5b79133ef31784c94d40b3e1303cd9a3814061b1cd435424e659709748859db0339013f1a92fbca430c4b052fda5ead d6efd76aded2c6d525bc9e1131b580d6a1abc1bf8c2e23080e968d4c118e0aa1f57ea37565abe06f004ccde37abd5eb7572ff81900f67db0d4ea52e6d9e8afd5 3b39cf12c8fe9ce7ddad356b0d175fe2bf32a773abd3e9345b992e96a901d99f8d39fc5a6db5b1b9ece00dc8e29b73f84667b3db5d75f00664f1ab73f8fe95d6 6ac3c51b50c468723087d671e9f733ee0564ccd976257c0de06b79206728c88622bbb488314fd4a25c8bf13d2efa00d04086154d909aa6648c7dc8e22e8e4782 62ad0f5e27b8f4c62ef9726e49cb42d21734556defc3144345ccf8bd7afefdabe74fd1f18367c70f7e3a7ef8f0f8c18f969143b58d93b04cf5f2dbcffe7cfc31 fae3e9372f1f7d518d9765fcaf3f7cf2cbcf9f5703a17c66eabcf8f2c96fcf9ebcf8ead3dfbf7b5401df147854860f694c24ba498ed03e8fc130e31557733212 e7a31846989629369350e2046b2915fc7b2a72d037a79865d171f4e810d7837704b48f2ae0f5c93d47e14124268a5648de896207b8cb39eb7051e9851d2dabe4 e6e12409ab858b4919b78ff16195ec2e4e9cf8f62629f4cd3c2d1dc3bb1171d4dc6338513824095148bfe307845458779752c7afbbd4175cf2b1427729ea605a e992211d39d93423daa631c4655a6533c4dbf1cdee1dd4e1accaea2d72e822a12a30ab507e4898e3c6eb78a2705cc57288635676f80daca22a250753e197713d a920d221611cf502226515cd2d01f69682be83a16355867d974d631729143da8e27903735e466ef1836e84e3b40a3ba04954c67e200f204531dae3aa0abecbdd 0ad1cf10079c2c0cf71d4a9c709fde0d6ed3d051699620facd4454c4f23ae14efe0ea66c8c896935d0d49d5e1dd3e4ef1a37a3d0b9ad848b6bdcd02a5f7cfdb8 42efb7b5656fc2ee555533db271af522dcc9f6dce522a06f7f77dec293648f4041cc6f51ef9af3bbe6ecfde79bf3a27abef8963cebc2d0a0f52c62076d3376c7 0ba7ee31656ca0a68cdc9066f096b0f7047d58d474e6c4498a53581ac14f5dc920c0c185021b1a24b8fa88aa6810e11486f6baa7998432631d4a9472098745b3 5cc95be361f057f6a8d9d48710db392456bb3cb0cb2b7a393f6b146c8c56a139d0e682563483b30a5bb9923105db5e47585d2b75666975a39a698a8eb4c264ed 627328079717a6c162e14d186a108c42e0e55538f36bd170d8c18c04daef364679584c142e324432c201c962a4ed9e8f51dd0429cf953943b41d3619f4c1f114 af95a4b534db379076962095c5351688cba3f72651ca33781625e076b21c59522e4e96a0a3b6d76a2e373de4e3b4ed8de19c0c3fe314a22ef51c895908974dbe 1236ed4f2d6653e5b368b672c3dc22a8c3d587f5fb9cc14e1f4885545b58463635ccab2c0558a22559fd979be0d68b32a0a21b9d4d8b953548867f4d0bf0a31b 5a321e135f95835d5ad1beb38f592be51345c4200a8ed0884dc43e86f0eb54057b022ae1bac37404fd007773dadbe695db9cb3a22bdf88199c5dc72c8d70d66e 7589e6956ce1a621153a98a7927a605ba5eec6b8f39b624afe824c29a7f1ffcc14bd9fc0edc34aa023e0c3d5b0c048574adbe342451cba501a51bf2f607030bd 03b205ee77e13524155c509bbf821ceabfb6e62c0f53d6708854fb344482c27ea42241c81eb425937da730ab677b9765c9324626a34aeacad4aa3d2287840d75 0f5cd57bbb87224875d34db236607027f3cf7dce2a6814ea21a75c6f4e272bf65e5b03fff4e4638b198c72fbb0196872ff172a16e3c16c57b5f4863cdf7bcb86 e817b331ab915705082b6d05adacec5f5385736eb5b663cd59bcdccc958328ce5b0c8bc54094c21d12d2ffc1fe4785cfecd70ebda10ef93ef456041f2f343348 1bc8ea4b76f040ba41dac5110c4e76d1269366655d9b8d4eda6bf9667dc1936e21f784b3b5666789f7399d5d0c67ae38a7162fd2d999871d5fdbb585ae86c89e 2c51581ae707191318f399acfc258b8fee41a0b7e09bc18429699209be53090c33f4c0d40114bf95684837fe020000ffff0300504b0304140006000800000021 000dd1909fb60000001b010000270000007468656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73848f4d0ac2301484 f78277086f6fd3ba109126dd88d0add40384e4350d363f2451eced0dae2c082e8761be9969bb979dc9136332de3168aa1a083ae995719ac16db8ec8e4052164e 89d93b64b060828e6f37ed1567914b284d262452282e3198720e274a939cd08a54f980ae38a38f56e422a3a641c8bbd048f7757da0f19b017cc524bd62107bd5 001996509affb3fd381a89672f1f165dfe514173d9850528a2c6cce0239baa4c04ca5bbabac4df000000ffff0300504b01022d0014000600080000002100e9de 0fbfff0000001c0200001300000000000000000000000000000000005b436f6e74656e745f54797065735d2e786d6c504b01022d0014000600080000002100a5 d6a7e7c0000000360100000b00000000000000000000000000300100005f72656c732f2e72656c73504b01022d00140006000800000021006b79961683000000 8a0000001c00000000000000000000000000190200007468656d652f7468656d652f7468656d654d616e616765722e786d6c504b01022d001400060008000000 2100da7e1364a9060000a41b00001600000000000000000000000000d60200007468656d652f7468656d652f7468656d65312e786d6c504b01022d0014000600 0800000021000dd1909fb60000001b0100002700000000000000000000000000b30900007468656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73504b050600000000050005005d010000ae0a00000000} {\*\colorschememapping 3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d22796573223f3e0d0a3c613a636c724d 617020786d6c6e733a613d22687474703a2f2f736368656d61732e6f70656e786d6c666f726d6174732e6f72672f64726177696e676d6c2f323030362f6d6169 6e22206267313d226c743122207478313d22646b3122206267323d226c743222207478323d22646b322220616363656e74313d22616363656e74312220616363 656e74323d22616363656e74322220616363656e74333d22616363656e74332220616363656e74343d22616363656e74342220616363656e74353d22616363656e74352220616363656e74363d22616363656e74362220686c696e6b3d22686c696e6b2220666f6c486c696e6b3d22666f6c486c696e6b222f3e} {\*\latentstyles\lsdstimax267\lsdlockeddef0\lsdsemihiddendef1\lsdunhideuseddef1\lsdqformatdef0\lsdprioritydef99{\lsdlockedexcept \lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority0 \lsdlocked0 Normal; \lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 1;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 2;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 3;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 4; \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 5;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 6;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 7;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 8;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 9; \lsdpriority39 \lsdlocked0 toc 1;\lsdpriority39 \lsdlocked0 toc 2;\lsdpriority39 \lsdlocked0 toc 3;\lsdpriority39 \lsdlocked0 toc 4;\lsdpriority39 \lsdlocked0 toc 5;\lsdpriority39 \lsdlocked0 toc 6;\lsdpriority39 \lsdlocked0 toc 7; \lsdpriority39 \lsdlocked0 toc 8;\lsdpriority39 \lsdlocked0 toc 9;\lsdqformat1 \lsdpriority35 \lsdlocked0 caption;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority10 \lsdlocked0 Title;\lsdpriority1 \lsdlocked0 Default Paragraph Font; \lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority11 \lsdlocked0 Subtitle;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority22 \lsdlocked0 Strong;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority20 \lsdlocked0 Emphasis; \lsdsemihidden0 \lsdunhideused0 \lsdpriority59 \lsdlocked0 Table Grid;\lsdunhideused0 \lsdlocked0 Placeholder Text;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority1 \lsdlocked0 No Spacing; \lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid; \lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1; \lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2; \lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading; \lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 1; \lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 1; \lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 1;\lsdunhideused0 \lsdlocked0 Revision; \lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority34 \lsdlocked0 List Paragraph;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority29 \lsdlocked0 Quote;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority30 \lsdlocked0 Intense Quote; \lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 1; \lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 1; \lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 2; \lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 2; \lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 2; \lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 2; \lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 2; \lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 3; \lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 3; \lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 3; \lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 3; \lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 3; \lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 4; \lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 4; \lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 4; \lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 4; \lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 5; \lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 5; \lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 5; \lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 5; \lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 5; \lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 6; \lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 6; \lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 6; \lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 6; \lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 6; \lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority19 \lsdlocked0 Subtle Emphasis;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority21 \lsdlocked0 Intense Emphasis; \lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority31 \lsdlocked0 Subtle Reference;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority32 \lsdlocked0 Intense Reference; \lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority33 \lsdlocked0 Book Title;\lsdpriority37 \lsdlocked0 Bibliography;\lsdqformat1 \lsdpriority39 \lsdlocked0 TOC Heading;}}{\*\datastore 010500000200000018000000 4d73786d6c322e534158584d4c5265616465722e362e3000000000000000000000060000 d0cf11e0a1b11ae1000000000000000000000000000000003e000300feff090006000000000000000000000001000000010000000000000000100000feffffff00000000feffffff0000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff fffffffffffffffffdfffffffeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffff52006f006f007400200045006e00740072007900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000500ffffffffffffffffffffffff0c6ad98892f1d411a65f0040963251e50000000000000000000000002079 0935a65dcd01feffffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000105000000000000}}modsecurity-apache_2.7.7/iis/ModSecurityIIS/ModSecurityIIS/README.TXT0000664000175000017500000000125012243422537025407 0ustar zimmerlezimmerlePlease note that installing ModSecurity for IIS requires IIS to be installed and enabled. After installing ModSecurity for IIS, the module will be running in all websites by default. To remove from a website add to web.config: To configure module in a website add to web.config: where configFile is standard ModSecurity config file. Events from the module will show up in "Application" Windows log. modsecurity-apache_2.7.7/iis/ModSecurityIIS/ModSecurityIIS/ModSecurityIIS.vdproj0000664000175000017500000020016712243422537030123 0ustar zimmerlezimmerle"DeployProject" { "VSVersion" = "3:800" "ProjectType" = "8:{978C614F-708E-4E1A-B201-565925725DBA}" "IsWebType" = "8:FALSE" "ProjectName" = "8:ModSecurityIIS" "LanguageId" = "3:1033" "CodePage" = "3:1252" "UILanguageId" = "3:1033" "SccProjectName" = "8:" "SccLocalPath" = "8:" "SccAuxPath" = "8:" "SccProvider" = "8:" "Hierarchy" { "Entry" { "MsmKey" = "8:_009A580142D04FE980ED45947D355FE7" "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" } "Entry" { "MsmKey" = "8:_0593BBFCC6154162A5F7E88C4967D8E8" "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" } "Entry" { "MsmKey" = "8:_170CE3CF68BE4944BF485C45F31146A0" "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" } "Entry" { "MsmKey" = "8:_17390F12AE3C4CD7A8BFA284458C87BB" "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" } "Entry" { "MsmKey" = "8:_2A9DB6318EE24F649FB0CDB52691122C" "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" } "Entry" { "MsmKey" = "8:_51AF671FCA3544DEA3E5756B5D450275" "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" } "Entry" { "MsmKey" = "8:_5B5ADDD0F4CC408DBE22616494149521" "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" } "Entry" { "MsmKey" = "8:_6245377DC73E4285A8017758A810A975" "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" } "Entry" { "MsmKey" = "8:_6882D4568B994750A5AAD32E0C73C653" "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" } "Entry" { "MsmKey" = "8:_6969BF58501241E8A23EDD630A6ADD90" "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" } "Entry" { "MsmKey" = "8:_72B533FBDB1E48A9B44CAA948E245528" "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" } "Entry" { "MsmKey" = "8:_7C2A420982404573B53BE273BC730435" "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" } "Entry" { "MsmKey" = "8:_804BB5CB74F84281874FF482E8E968A9" "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" } "Entry" { "MsmKey" = "8:_9BC99765061C4EEEB064E614C1AD82EF" "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" } "Entry" { "MsmKey" = "8:_A916EC2DF983431489489D69D523838A" "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" } "Entry" { "MsmKey" = "8:_AD24111D6D7F4FE3ACF65A4A340B3C01" "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" } "Entry" { "MsmKey" = "8:_B5C810AB7A8E478884463074B628D888" "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" } "Entry" { "MsmKey" = "8:_BB3C0C1507C345988554DD719126235D" "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" } "Entry" { "MsmKey" = "8:_BBF79864F88546FEB7C68EE7F5DFC52A" "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" } "Entry" { "MsmKey" = "8:_C20805AF8FC94DE9B6148EB9EF000052" "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" } "Entry" { "MsmKey" = "8:_CEB23D021A2E4EEF9245EEDC143AFBA8" "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" } "Entry" { "MsmKey" = "8:_D8E3D69430F54B5DB4F890834BBC0CC6" "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" } "Entry" { "MsmKey" = "8:_DE7847BDBDC046F29E13230DCDD4F6E3" "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" } "Entry" { "MsmKey" = "8:_E86FB9D69F2946038E7BBDD01D619813" "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" } "Entry" { "MsmKey" = "8:_ECC9F59ECF5E4AF2B7E9A13EB821F56A" "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" } "Entry" { "MsmKey" = "8:_F00431C1D11D40A6B52E228DE6F904FF" "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" } "Entry" { "MsmKey" = "8:_FF9BA3624F9349AF98F01CAE921D7D80" "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" } } "Configurations" { "Debug" { "DisplayName" = "8:Debug" "IsDebugOnly" = "11:TRUE" "IsReleaseOnly" = "11:FALSE" "OutputFilename" = "8:Debug\\ModSecurityIIS.msi" "PackageFilesAs" = "3:2" "PackageFileSize" = "3:-2147483648" "CabType" = "3:1" "Compression" = "3:2" "SignOutput" = "11:FALSE" "CertificateFile" = "8:" "PrivateKeyFile" = "8:" "TimeStampServer" = "8:" "InstallerBootstrapper" = "3:2" "BootstrapperCfg:{63ACBE69-63AA-4F98-B2B6-99F9E24495F2}" { "Enabled" = "11:TRUE" "PromptEnabled" = "11:TRUE" "PrerequisitesLocation" = "2:1" "Url" = "8:" "ComponentsUrl" = "8:" "Items" { "{EDC2488A-8267-493A-A98E-7D9C3B36CDF3}:.NETFramework,Version=v4.0,Profile=Client" { "Name" = "8:Microsoft .NET Framework 4 Client Profile (x86 and x64)" "ProductCode" = "8:.NETFramework,Version=v4.0,Profile=Client" } "{EDC2488A-8267-493A-A98E-7D9C3B36CDF3}:Microsoft.Visual.C++.10.0.x64" { "Name" = "8:Visual C++ 2010 Runtime Libraries (x64)" "ProductCode" = "8:Microsoft.Visual.C++.10.0.x64" } "{EDC2488A-8267-493A-A98E-7D9C3B36CDF3}:Microsoft.Visual.C++.10.0.x86" { "Name" = "8:Visual C++ 2010 Runtime Libraries (x86)" "ProductCode" = "8:Microsoft.Visual.C++.10.0.x86" } "{EDC2488A-8267-493A-A98E-7D9C3B36CDF3}:Microsoft.Windows.Installer.3.1" { "Name" = "8:Windows Installer 3.1" "ProductCode" = "8:Microsoft.Windows.Installer.3.1" } } } } "Release" { "DisplayName" = "8:Release" "IsDebugOnly" = "11:FALSE" "IsReleaseOnly" = "11:TRUE" "OutputFilename" = "8:Release\\ModSecurityIIS.msi" "PackageFilesAs" = "3:2" "PackageFileSize" = "3:-2147483648" "CabType" = "3:1" "Compression" = "3:3" "SignOutput" = "11:FALSE" "CertificateFile" = "8:" "PrivateKeyFile" = "8:" "TimeStampServer" = "8:" "InstallerBootstrapper" = "3:2" "BootstrapperCfg:{63ACBE69-63AA-4F98-B2B6-99F9E24495F2}" { "Enabled" = "11:TRUE" "PromptEnabled" = "11:TRUE" "PrerequisitesLocation" = "2:1" "Url" = "8:" "ComponentsUrl" = "8:" "Items" { "{EDC2488A-8267-493A-A98E-7D9C3B36CDF3}:Microsoft.Visual.C++.10.0.x64" { "Name" = "8:Visual C++ 2010 Runtime Libraries (x64)" "ProductCode" = "8:Microsoft.Visual.C++.10.0.x64" } "{EDC2488A-8267-493A-A98E-7D9C3B36CDF3}:Microsoft.Visual.C++.10.0.x86" { "Name" = "8:Visual C++ 2010 Runtime Libraries (x86)" "ProductCode" = "8:Microsoft.Visual.C++.10.0.x86" } "{EDC2488A-8267-493A-A98E-7D9C3B36CDF3}:Microsoft.Windows.Installer.3.1" { "Name" = "8:Windows Installer 3.1" "ProductCode" = "8:Microsoft.Windows.Installer.3.1" } } } } } "Deployable" { "CustomAction" { "{4AA51A2D-7D85-4A59-BA75-B0809FC8B380}:_08431F489ECB46FB908D9C6006906D0E" { "Name" = "8:Installer.exe" "Condition" = "8:" "Object" = "8:_009A580142D04FE980ED45947D355FE7" "FileType" = "3:2" "InstallAction" = "3:4" "Arguments" = "8:uninstall" "EntryPoint" = "8:" "Sequence" = "3:1" "Identifier" = "8:_A708DE11_BE76_4BD9_BF40_5243FE900066" "InstallerClass" = "11:FALSE" "CustomActionData" = "8:" } "{4AA51A2D-7D85-4A59-BA75-B0809FC8B380}:_9C73118A4CD14A65BD57D7CC552AAD79" { "Name" = "8:Installer.exe" "Condition" = "8:" "Object" = "8:_009A580142D04FE980ED45947D355FE7" "FileType" = "3:2" "InstallAction" = "3:1" "Arguments" = "8:\"[TARGETDIR]\"" "EntryPoint" = "8:" "Sequence" = "3:1" "Identifier" = "8:_166E62F8_D2C0_4A30_A2FE_EF5B53066941" "InstallerClass" = "11:FALSE" "CustomActionData" = "8:" } } "DefaultFeature" { "Name" = "8:DefaultFeature" "Title" = "8:" "Description" = "8:" } "ExternalPersistence" { "LaunchCondition" { } } "File" { "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_009A580142D04FE980ED45947D355FE7" { "SourcePath" = "8:..\\Release\\Installer.exe" "TargetName" = "8:Installer.exe" "Tag" = "8:" "Folder" = "8:_565C3432A64049EAA7CA6E8C007B2188" "Condition" = "8:" "Transitive" = "11:FALSE" "Vital" = "11:TRUE" "ReadOnly" = "11:FALSE" "Hidden" = "11:FALSE" "System" = "11:FALSE" "Permanent" = "11:FALSE" "SharedLegacy" = "11:FALSE" "PackageAs" = "3:1" "Register" = "3:1" "Exclude" = "11:FALSE" "IsDependency" = "11:FALSE" "IsolateTo" = "8:" } "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_0593BBFCC6154162A5F7E88C4967D8E8" { "SourcePath" = "8:x86\\pcre.dll" "TargetName" = "8:pcre.dll" "Tag" = "8:" "Folder" = "8:_D7AEA61DD2D746158A1F5660E4C59AB8" "Condition" = "8:" "Transitive" = "11:FALSE" "Vital" = "11:TRUE" "ReadOnly" = "11:FALSE" "Hidden" = "11:FALSE" "System" = "11:FALSE" "Permanent" = "11:FALSE" "SharedLegacy" = "11:FALSE" "PackageAs" = "3:1" "Register" = "3:1" "Exclude" = "11:FALSE" "IsDependency" = "11:FALSE" "IsolateTo" = "8:" } "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_170CE3CF68BE4944BF485C45F31146A0" { "SourcePath" = "8:x86\\libapr-1.dll" "TargetName" = "8:libapr-1.dll" "Tag" = "8:" "Folder" = "8:_D7AEA61DD2D746158A1F5660E4C59AB8" "Condition" = "8:" "Transitive" = "11:FALSE" "Vital" = "11:TRUE" "ReadOnly" = "11:FALSE" "Hidden" = "11:FALSE" "System" = "11:FALSE" "Permanent" = "11:FALSE" "SharedLegacy" = "11:FALSE" "PackageAs" = "3:1" "Register" = "3:1" "Exclude" = "11:FALSE" "IsDependency" = "11:FALSE" "IsolateTo" = "8:" } "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_17390F12AE3C4CD7A8BFA284458C87BB" { "SourcePath" = "8:ModSecurity.xml" "TargetName" = "8:ModSecurity.xml" "Tag" = "8:" "Folder" = "8:_565C3432A64049EAA7CA6E8C007B2188" "Condition" = "8:" "Transitive" = "11:FALSE" "Vital" = "11:TRUE" "ReadOnly" = "11:FALSE" "Hidden" = "11:FALSE" "System" = "11:FALSE" "Permanent" = "11:FALSE" "SharedLegacy" = "11:FALSE" "PackageAs" = "3:1" "Register" = "3:1" "Exclude" = "11:FALSE" "IsDependency" = "11:FALSE" "IsolateTo" = "8:" } "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_2A9DB6318EE24F649FB0CDB52691122C" { "SourcePath" = "8:ModSecurityLogo.bmp" "TargetName" = "8:ModSecurityLogo.bmp" "Tag" = "8:" "Folder" = "8:_565C3432A64049EAA7CA6E8C007B2188" "Condition" = "8:" "Transitive" = "11:FALSE" "Vital" = "11:TRUE" "ReadOnly" = "11:FALSE" "Hidden" = "11:FALSE" "System" = "11:FALSE" "Permanent" = "11:FALSE" "SharedLegacy" = "11:FALSE" "PackageAs" = "3:1" "Register" = "3:1" "Exclude" = "11:TRUE" "IsDependency" = "11:FALSE" "IsolateTo" = "8:" } "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_51AF671FCA3544DEA3E5756B5D450275" { "SourcePath" = "8:x86\\ModSecurityIIS.dll" "TargetName" = "8:ModSecurityIIS.dll" "Tag" = "8:" "Folder" = "8:_D7AEA61DD2D746158A1F5660E4C59AB8" "Condition" = "8:" "Transitive" = "11:FALSE" "Vital" = "11:TRUE" "ReadOnly" = "11:FALSE" "Hidden" = "11:FALSE" "System" = "11:FALSE" "Permanent" = "11:FALSE" "SharedLegacy" = "11:FALSE" "PackageAs" = "3:1" "Register" = "3:1" "Exclude" = "11:FALSE" "IsDependency" = "11:FALSE" "IsolateTo" = "8:" } "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_5B5ADDD0F4CC408DBE22616494149521" { "SourcePath" = "8:amd64\\libxml2.dll" "TargetName" = "8:libxml2.dll" "Tag" = "8:" "Folder" = "8:_4FF50879FDA54129BDEBA08F0D1FF20D" "Condition" = "8:" "Transitive" = "11:FALSE" "Vital" = "11:TRUE" "ReadOnly" = "11:FALSE" "Hidden" = "11:FALSE" "System" = "11:FALSE" "Permanent" = "11:FALSE" "SharedLegacy" = "11:FALSE" "PackageAs" = "3:1" "Register" = "3:1" "Exclude" = "11:FALSE" "IsDependency" = "11:FALSE" "IsolateTo" = "8:" } "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_6245377DC73E4285A8017758A810A975" { "SourcePath" = "8:amd64\\lua5.1.dll" "TargetName" = "8:lua5.1.dll" "Tag" = "8:" "Folder" = "8:_4FF50879FDA54129BDEBA08F0D1FF20D" "Condition" = "8:" "Transitive" = "11:FALSE" "Vital" = "11:TRUE" "ReadOnly" = "11:FALSE" "Hidden" = "11:FALSE" "System" = "11:FALSE" "Permanent" = "11:FALSE" "SharedLegacy" = "11:FALSE" "PackageAs" = "3:1" "Register" = "3:1" "Exclude" = "11:FALSE" "IsDependency" = "11:FALSE" "IsolateTo" = "8:" } "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_6882D4568B994750A5AAD32E0C73C653" { "SourcePath" = "8:amd64\\zlib1.dll" "TargetName" = "8:zlib1.dll" "Tag" = "8:" "Folder" = "8:_4FF50879FDA54129BDEBA08F0D1FF20D" "Condition" = "8:" "Transitive" = "11:FALSE" "Vital" = "11:TRUE" "ReadOnly" = "11:FALSE" "Hidden" = "11:FALSE" "System" = "11:FALSE" "Permanent" = "11:FALSE" "SharedLegacy" = "11:FALSE" "PackageAs" = "3:1" "Register" = "3:1" "Exclude" = "11:FALSE" "IsDependency" = "11:FALSE" "IsolateTo" = "8:" } "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_6969BF58501241E8A23EDD630A6ADD90" { "SourcePath" = "8:x86\\mlogc.exe" "TargetName" = "8:mlogc.exe" "Tag" = "8:" "Folder" = "8:_D7AEA61DD2D746158A1F5660E4C59AB8" "Condition" = "8:" "Transitive" = "11:FALSE" "Vital" = "11:TRUE" "ReadOnly" = "11:FALSE" "Hidden" = "11:FALSE" "System" = "11:FALSE" "Permanent" = "11:FALSE" "SharedLegacy" = "11:FALSE" "PackageAs" = "3:1" "Register" = "3:1" "Exclude" = "11:FALSE" "IsDependency" = "11:FALSE" "IsolateTo" = "8:" } "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_72B533FBDB1E48A9B44CAA948E245528" { "SourcePath" = "8:x86\\zlib1.dll" "TargetName" = "8:zlib1.dll" "Tag" = "8:" "Folder" = "8:_D7AEA61DD2D746158A1F5660E4C59AB8" "Condition" = "8:" "Transitive" = "11:FALSE" "Vital" = "11:TRUE" "ReadOnly" = "11:FALSE" "Hidden" = "11:FALSE" "System" = "11:FALSE" "Permanent" = "11:FALSE" "SharedLegacy" = "11:FALSE" "PackageAs" = "3:1" "Register" = "3:1" "Exclude" = "11:FALSE" "IsDependency" = "11:FALSE" "IsolateTo" = "8:" } "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_7C2A420982404573B53BE273BC730435" { "SourcePath" = "8:amd64\\mlogc.exe" "TargetName" = "8:mlogc.exe" "Tag" = "8:" "Folder" = "8:_4FF50879FDA54129BDEBA08F0D1FF20D" "Condition" = "8:" "Transitive" = "11:FALSE" "Vital" = "11:TRUE" "ReadOnly" = "11:FALSE" "Hidden" = "11:FALSE" "System" = "11:FALSE" "Permanent" = "11:FALSE" "SharedLegacy" = "11:FALSE" "PackageAs" = "3:1" "Register" = "3:1" "Exclude" = "11:FALSE" "IsDependency" = "11:FALSE" "IsolateTo" = "8:" } "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_804BB5CB74F84281874FF482E8E968A9" { "SourcePath" = "8:x86\\libcurl.dll" "TargetName" = "8:libcurl.dll" "Tag" = "8:" "Folder" = "8:_D7AEA61DD2D746158A1F5660E4C59AB8" "Condition" = "8:" "Transitive" = "11:FALSE" "Vital" = "11:TRUE" "ReadOnly" = "11:FALSE" "Hidden" = "11:FALSE" "System" = "11:FALSE" "Permanent" = "11:FALSE" "SharedLegacy" = "11:FALSE" "PackageAs" = "3:1" "Register" = "3:1" "Exclude" = "11:FALSE" "IsDependency" = "11:FALSE" "IsolateTo" = "8:" } "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_9BC99765061C4EEEB064E614C1AD82EF" { "SourcePath" = "8:x86\\libapriconv-1.dll" "TargetName" = "8:libapriconv-1.dll" "Tag" = "8:" "Folder" = "8:_D7AEA61DD2D746158A1F5660E4C59AB8" "Condition" = "8:" "Transitive" = "11:FALSE" "Vital" = "11:TRUE" "ReadOnly" = "11:FALSE" "Hidden" = "11:FALSE" "System" = "11:FALSE" "Permanent" = "11:FALSE" "SharedLegacy" = "11:FALSE" "PackageAs" = "3:1" "Register" = "3:1" "Exclude" = "11:FALSE" "IsDependency" = "11:FALSE" "IsolateTo" = "8:" } "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_A916EC2DF983431489489D69D523838A" { "SourcePath" = "8:amd64\\libcurl.dll" "TargetName" = "8:libcurl.dll" "Tag" = "8:" "Folder" = "8:_4FF50879FDA54129BDEBA08F0D1FF20D" "Condition" = "8:" "Transitive" = "11:FALSE" "Vital" = "11:TRUE" "ReadOnly" = "11:FALSE" "Hidden" = "11:FALSE" "System" = "11:FALSE" "Permanent" = "11:FALSE" "SharedLegacy" = "11:FALSE" "PackageAs" = "3:1" "Register" = "3:1" "Exclude" = "11:FALSE" "IsDependency" = "11:FALSE" "IsolateTo" = "8:" } "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_AD24111D6D7F4FE3ACF65A4A340B3C01" { "SourcePath" = "8:x86\\libxml2.dll" "TargetName" = "8:libxml2.dll" "Tag" = "8:" "Folder" = "8:_D7AEA61DD2D746158A1F5660E4C59AB8" "Condition" = "8:" "Transitive" = "11:FALSE" "Vital" = "11:TRUE" "ReadOnly" = "11:FALSE" "Hidden" = "11:FALSE" "System" = "11:FALSE" "Permanent" = "11:FALSE" "SharedLegacy" = "11:FALSE" "PackageAs" = "3:1" "Register" = "3:1" "Exclude" = "11:FALSE" "IsDependency" = "11:FALSE" "IsolateTo" = "8:" } "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_B5C810AB7A8E478884463074B628D888" { "SourcePath" = "8:amd64\\libaprutil-1.dll" "TargetName" = "8:libaprutil-1.dll" "Tag" = "8:" "Folder" = "8:_4FF50879FDA54129BDEBA08F0D1FF20D" "Condition" = "8:" "Transitive" = "11:FALSE" "Vital" = "11:TRUE" "ReadOnly" = "11:FALSE" "Hidden" = "11:FALSE" "System" = "11:FALSE" "Permanent" = "11:FALSE" "SharedLegacy" = "11:FALSE" "PackageAs" = "3:1" "Register" = "3:1" "Exclude" = "11:FALSE" "IsDependency" = "11:FALSE" "IsolateTo" = "8:" } "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_BB3C0C1507C345988554DD719126235D" { "SourcePath" = "8:amd64\\libapriconv-1.dll" "TargetName" = "8:libapriconv-1.dll" "Tag" = "8:" "Folder" = "8:_4FF50879FDA54129BDEBA08F0D1FF20D" "Condition" = "8:" "Transitive" = "11:FALSE" "Vital" = "11:TRUE" "ReadOnly" = "11:FALSE" "Hidden" = "11:FALSE" "System" = "11:FALSE" "Permanent" = "11:FALSE" "SharedLegacy" = "11:FALSE" "PackageAs" = "3:1" "Register" = "3:1" "Exclude" = "11:FALSE" "IsDependency" = "11:FALSE" "IsolateTo" = "8:" } "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_BBF79864F88546FEB7C68EE7F5DFC52A" { "SourcePath" = "8:README.TXT" "TargetName" = "8:README.TXT" "Tag" = "8:" "Folder" = "8:_565C3432A64049EAA7CA6E8C007B2188" "Condition" = "8:" "Transitive" = "11:FALSE" "Vital" = "11:TRUE" "ReadOnly" = "11:FALSE" "Hidden" = "11:FALSE" "System" = "11:FALSE" "Permanent" = "11:FALSE" "SharedLegacy" = "11:FALSE" "PackageAs" = "3:1" "Register" = "3:1" "Exclude" = "11:FALSE" "IsDependency" = "11:FALSE" "IsolateTo" = "8:" } "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_C20805AF8FC94DE9B6148EB9EF000052" { "SourcePath" = "8:x86\\libaprutil-1.dll" "TargetName" = "8:libaprutil-1.dll" "Tag" = "8:" "Folder" = "8:_D7AEA61DD2D746158A1F5660E4C59AB8" "Condition" = "8:" "Transitive" = "11:FALSE" "Vital" = "11:TRUE" "ReadOnly" = "11:FALSE" "Hidden" = "11:FALSE" "System" = "11:FALSE" "Permanent" = "11:FALSE" "SharedLegacy" = "11:FALSE" "PackageAs" = "3:1" "Register" = "3:1" "Exclude" = "11:FALSE" "IsDependency" = "11:FALSE" "IsolateTo" = "8:" } "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_CEB23D021A2E4EEF9245EEDC143AFBA8" { "SourcePath" = "8:amd64\\ModSecurityIIS.dll" "TargetName" = "8:ModSecurityIIS.dll" "Tag" = "8:" "Folder" = "8:_4FF50879FDA54129BDEBA08F0D1FF20D" "Condition" = "8:" "Transitive" = "11:FALSE" "Vital" = "11:TRUE" "ReadOnly" = "11:FALSE" "Hidden" = "11:FALSE" "System" = "11:FALSE" "Permanent" = "11:FALSE" "SharedLegacy" = "11:FALSE" "PackageAs" = "3:1" "Register" = "3:1" "Exclude" = "11:FALSE" "IsDependency" = "11:FALSE" "IsolateTo" = "8:" } "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_D8E3D69430F54B5DB4F890834BBC0CC6" { "SourcePath" = "8:readme.rtf" "TargetName" = "8:readme.rtf" "Tag" = "8:" "Folder" = "8:_565C3432A64049EAA7CA6E8C007B2188" "Condition" = "8:" "Transitive" = "11:FALSE" "Vital" = "11:TRUE" "ReadOnly" = "11:FALSE" "Hidden" = "11:FALSE" "System" = "11:FALSE" "Permanent" = "11:FALSE" "SharedLegacy" = "11:FALSE" "PackageAs" = "3:1" "Register" = "3:1" "Exclude" = "11:TRUE" "IsDependency" = "11:FALSE" "IsolateTo" = "8:" } "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_DE7847BDBDC046F29E13230DCDD4F6E3" { "SourcePath" = "8:x86\\lua5.1.dll" "TargetName" = "8:lua5.1.dll" "Tag" = "8:" "Folder" = "8:_D7AEA61DD2D746158A1F5660E4C59AB8" "Condition" = "8:" "Transitive" = "11:FALSE" "Vital" = "11:TRUE" "ReadOnly" = "11:FALSE" "Hidden" = "11:FALSE" "System" = "11:FALSE" "Permanent" = "11:FALSE" "SharedLegacy" = "11:FALSE" "PackageAs" = "3:1" "Register" = "3:1" "Exclude" = "11:FALSE" "IsDependency" = "11:FALSE" "IsolateTo" = "8:" } "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_E86FB9D69F2946038E7BBDD01D619813" { "SourcePath" = "8:owasp_crs.zip" "TargetName" = "8:owasp_crs.zip" "Tag" = "8:" "Folder" = "8:_565C3432A64049EAA7CA6E8C007B2188" "Condition" = "8:" "Transitive" = "11:FALSE" "Vital" = "11:TRUE" "ReadOnly" = "11:FALSE" "Hidden" = "11:FALSE" "System" = "11:FALSE" "Permanent" = "11:FALSE" "SharedLegacy" = "11:FALSE" "PackageAs" = "3:1" "Register" = "3:1" "Exclude" = "11:FALSE" "IsDependency" = "11:FALSE" "IsolateTo" = "8:" } "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_ECC9F59ECF5E4AF2B7E9A13EB821F56A" { "SourcePath" = "8:EULA.rtf" "TargetName" = "8:EULA.rtf" "Tag" = "8:" "Folder" = "8:_565C3432A64049EAA7CA6E8C007B2188" "Condition" = "8:" "Transitive" = "11:FALSE" "Vital" = "11:TRUE" "ReadOnly" = "11:FALSE" "Hidden" = "11:FALSE" "System" = "11:FALSE" "Permanent" = "11:FALSE" "SharedLegacy" = "11:FALSE" "PackageAs" = "3:1" "Register" = "3:1" "Exclude" = "11:TRUE" "IsDependency" = "11:FALSE" "IsolateTo" = "8:" } "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_F00431C1D11D40A6B52E228DE6F904FF" { "SourcePath" = "8:amd64\\pcre.dll" "TargetName" = "8:pcre.dll" "Tag" = "8:" "Folder" = "8:_4FF50879FDA54129BDEBA08F0D1FF20D" "Condition" = "8:" "Transitive" = "11:FALSE" "Vital" = "11:TRUE" "ReadOnly" = "11:FALSE" "Hidden" = "11:FALSE" "System" = "11:FALSE" "Permanent" = "11:FALSE" "SharedLegacy" = "11:FALSE" "PackageAs" = "3:1" "Register" = "3:1" "Exclude" = "11:FALSE" "IsDependency" = "11:FALSE" "IsolateTo" = "8:" } "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_FF9BA3624F9349AF98F01CAE921D7D80" { "SourcePath" = "8:amd64\\libapr-1.dll" "TargetName" = "8:libapr-1.dll" "Tag" = "8:" "Folder" = "8:_4FF50879FDA54129BDEBA08F0D1FF20D" "Condition" = "8:" "Transitive" = "11:FALSE" "Vital" = "11:TRUE" "ReadOnly" = "11:FALSE" "Hidden" = "11:FALSE" "System" = "11:FALSE" "Permanent" = "11:FALSE" "SharedLegacy" = "11:FALSE" "PackageAs" = "3:1" "Register" = "3:1" "Exclude" = "11:FALSE" "IsDependency" = "11:FALSE" "IsolateTo" = "8:" } } "FileType" { } "Folder" { "{1525181F-901A-416C-8A58-119130FE478E}:_2C5F88CA53E243FEB2EB6415E4E15F9D" { "Name" = "8:#1916" "AlwaysCreate" = "11:FALSE" "Condition" = "8:" "Transitive" = "11:FALSE" "Property" = "8:DesktopFolder" "Folders" { } } "{3C67513D-01DD-4637-8A68-80971EB9504F}:_565C3432A64049EAA7CA6E8C007B2188" { "DefaultLocation" = "8:[ProgramFilesFolder]\\[ProductName]" "Name" = "8:#1925" "AlwaysCreate" = "11:FALSE" "Condition" = "8:" "Transitive" = "11:FALSE" "Property" = "8:TARGETDIR" "Folders" { "{9EF0B969-E518-4E46-987F-47570745A589}:_4FF50879FDA54129BDEBA08F0D1FF20D" { "Name" = "8:amd64" "AlwaysCreate" = "11:FALSE" "Condition" = "8:" "Transitive" = "11:FALSE" "Property" = "8:_3E46ACA5D6114D469C67008149BA2030" "Folders" { } } "{9EF0B969-E518-4E46-987F-47570745A589}:_D7AEA61DD2D746158A1F5660E4C59AB8" { "Name" = "8:x86" "AlwaysCreate" = "11:FALSE" "Condition" = "8:" "Transitive" = "11:FALSE" "Property" = "8:_8B184E68172E4B07BEAAB3116380C2E5" "Folders" { } } } } "{1525181F-901A-416C-8A58-119130FE478E}:_BBDABB2A7D8C42A786516B2A402564C6" { "Name" = "8:#1919" "AlwaysCreate" = "11:FALSE" "Condition" = "8:" "Transitive" = "11:FALSE" "Property" = "8:ProgramMenuFolder" "Folders" { } } } "LaunchCondition" { } "Locator" { } "MsiBootstrapper" { "LangId" = "3:1033" "RequiresElevation" = "11:FALSE" } "Product" { "Name" = "8:Microsoft Visual Studio" "ProductName" = "8:ModSecurity IIS" "ProductCode" = "8:{81EE8A4A-5128-4CDB-97B2-06B147E8B4B8}" "PackageCode" = "8:{4F65AFE0-1E8A-4F79-98D5-1D7C1C39ABCC}" "UpgradeCode" = "8:{7B32CF94-443C-47BB-91C3-0E9D3D12DF8B}" "AspNetVersion" = "8:4.0.30319.0" "RestartWWWService" = "11:FALSE" "RemovePreviousVersions" = "11:TRUE" "DetectNewerInstalledVersion" = "11:TRUE" "InstallAllUsers" = "11:TRUE" "ProductVersion" = "8:1.0.0" "Manufacturer" = "8:Microsoft" "ARPHELPTELEPHONE" = "8:" "ARPHELPLINK" = "8:" "Title" = "8:Install ModSecurity for IIS" "Subject" = "8:" "ARPCONTACT" = "8:Microsoft" "Keywords" = "8:" "ARPCOMMENTS" = "8:ModSecurity Module for IIS" "ARPURLINFOABOUT" = "8:" "ARPPRODUCTICON" = "8:" "ARPIconIndex" = "3:0" "SearchPath" = "8:" "UseSystemSearchPath" = "11:TRUE" "TargetPlatform" = "3:0" "PreBuildEvent" = "8:" "PostBuildEvent" = "8:" "RunPostBuildEvent" = "3:0" } "Registry" { "HKLM" { "Keys" { "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_08760C875F8543139CF6DE446F1F0F4D" { "Name" = "8:Software" "Condition" = "8:" "AlwaysCreate" = "11:FALSE" "DeleteAtUninstall" = "11:FALSE" "Transitive" = "11:FALSE" "Keys" { "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_681ABE93BF174EBA982CBFA693BC925F" { "Name" = "8:[Manufacturer]" "Condition" = "8:" "AlwaysCreate" = "11:FALSE" "DeleteAtUninstall" = "11:FALSE" "Transitive" = "11:FALSE" "Keys" { } "Values" { } } } "Values" { } } } } "HKCU" { "Keys" { "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_985DD1FA5E55418B85FDAD78E1864975" { "Name" = "8:Software" "Condition" = "8:" "AlwaysCreate" = "11:FALSE" "DeleteAtUninstall" = "11:FALSE" "Transitive" = "11:FALSE" "Keys" { "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_348B7C9FDF8C400E88C61519EE3BB26C" { "Name" = "8:[Manufacturer]" "Condition" = "8:" "AlwaysCreate" = "11:FALSE" "DeleteAtUninstall" = "11:FALSE" "Transitive" = "11:FALSE" "Keys" { } "Values" { } } } "Values" { } } } } "HKCR" { "Keys" { } } "HKU" { "Keys" { } } "HKPU" { "Keys" { } } } "Sequences" { } "Shortcut" { } "UserInterface" { "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_03C8F8214F0D406B9B9ABB87FEDD39EB" { "Name" = "8:#1900" "Sequence" = "3:1" "Attributes" = "3:1" "Dialogs" { "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_09EF4C31C20240ED8FA7996D190C2E6F" { "Sequence" = "3:200" "DisplayName" = "8:Installation Folder" "UseDynamicProperties" = "11:TRUE" "IsDependency" = "11:FALSE" "SourcePath" = "8:\\VsdFolderDlg.wid" "Properties" { "BannerBitmap" { "Name" = "8:BannerBitmap" "DisplayName" = "8:#1001" "Description" = "8:#1101" "Type" = "3:8" "ContextData" = "8:Bitmap" "Attributes" = "3:4" "Setting" = "3:2" "Value" = "8:_2A9DB6318EE24F649FB0CDB52691122C" "UsePlugInResources" = "11:TRUE" } "InstallAllUsersVisible" { "Name" = "8:InstallAllUsersVisible" "DisplayName" = "8:#1059" "Description" = "8:#1159" "Type" = "3:5" "ContextData" = "8:1;True=1;False=0" "Attributes" = "3:0" "Setting" = "3:0" "Value" = "3:1" "DefaultValue" = "3:1" "UsePlugInResources" = "11:TRUE" } } } "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_5FABD25B5435457CBD593E62DA6F2446" { "Sequence" = "3:210" "DisplayName" = "8:License Agreement" "UseDynamicProperties" = "11:TRUE" "IsDependency" = "11:FALSE" "SourcePath" = "8:\\VsdLicenseDlg.wid" "Properties" { "BannerBitmap" { "Name" = "8:BannerBitmap" "DisplayName" = "8:#1001" "Description" = "8:#1101" "Type" = "3:8" "ContextData" = "8:Bitmap" "Attributes" = "3:4" "Setting" = "3:2" "Value" = "8:_2A9DB6318EE24F649FB0CDB52691122C" "UsePlugInResources" = "11:TRUE" } "EulaText" { "Name" = "8:EulaText" "DisplayName" = "8:#1008" "Description" = "8:#1108" "Type" = "3:6" "ContextData" = "8:" "Attributes" = "3:0" "Setting" = "3:2" "Value" = "8:_ECC9F59ECF5E4AF2B7E9A13EB821F56A" "UsePlugInResources" = "11:TRUE" } "Sunken" { "Name" = "8:Sunken" "DisplayName" = "8:#1007" "Description" = "8:#1107" "Type" = "3:5" "ContextData" = "8:4;True=4;False=0" "Attributes" = "3:0" "Setting" = "3:0" "Value" = "3:4" "DefaultValue" = "3:4" "UsePlugInResources" = "11:TRUE" } } } "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_8BA5D0091E6747AFA72977D73F495172" { "Sequence" = "3:100" "DisplayName" = "8:Welcome" "UseDynamicProperties" = "11:TRUE" "IsDependency" = "11:FALSE" "SourcePath" = "8:\\VsdWelcomeDlg.wid" "Properties" { "BannerBitmap" { "Name" = "8:BannerBitmap" "DisplayName" = "8:#1001" "Description" = "8:#1101" "Type" = "3:8" "ContextData" = "8:Bitmap" "Attributes" = "3:4" "Setting" = "3:2" "Value" = "8:_2A9DB6318EE24F649FB0CDB52691122C" "UsePlugInResources" = "11:TRUE" } "CopyrightWarning" { "Name" = "8:CopyrightWarning" "DisplayName" = "8:#1002" "Description" = "8:#1102" "Type" = "3:3" "ContextData" = "8:" "Attributes" = "3:0" "Setting" = "3:2" "Value" = "8:" "DefaultValue" = "8:#1202" "UsePlugInResources" = "11:TRUE" } "Welcome" { "Name" = "8:Welcome" "DisplayName" = "8:#1003" "Description" = "8:#1103" "Type" = "3:3" "ContextData" = "8:" "Attributes" = "3:0" "Setting" = "3:1" "Value" = "8:#1203" "DefaultValue" = "8:#1203" "UsePlugInResources" = "11:TRUE" } } } "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_DD04ADB466084065920D21349E63B1B4" { "Sequence" = "3:300" "DisplayName" = "8:Confirm Installation" "UseDynamicProperties" = "11:TRUE" "IsDependency" = "11:FALSE" "SourcePath" = "8:\\VsdConfirmDlg.wid" "Properties" { "BannerBitmap" { "Name" = "8:BannerBitmap" "DisplayName" = "8:#1001" "Description" = "8:#1101" "Type" = "3:8" "ContextData" = "8:Bitmap" "Attributes" = "3:4" "Setting" = "3:2" "Value" = "8:_2A9DB6318EE24F649FB0CDB52691122C" "UsePlugInResources" = "11:TRUE" } } } } } "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_09003E2068A547849152D3D35738A00E" { "Name" = "8:#1901" "Sequence" = "3:2" "Attributes" = "3:2" "Dialogs" { "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_4F93544D25594D488DA7E02A8A3B89E9" { "Sequence" = "3:100" "DisplayName" = "8:Progress" "UseDynamicProperties" = "11:TRUE" "IsDependency" = "11:FALSE" "SourcePath" = "8:\\VsdAdminProgressDlg.wid" "Properties" { "BannerBitmap" { "Name" = "8:BannerBitmap" "DisplayName" = "8:#1001" "Description" = "8:#1101" "Type" = "3:8" "ContextData" = "8:Bitmap" "Attributes" = "3:4" "Setting" = "3:2" "Value" = "8:_2A9DB6318EE24F649FB0CDB52691122C" "UsePlugInResources" = "11:TRUE" } "ShowProgress" { "Name" = "8:ShowProgress" "DisplayName" = "8:#1009" "Description" = "8:#1109" "Type" = "3:5" "ContextData" = "8:1;True=1;False=0" "Attributes" = "3:0" "Setting" = "3:0" "Value" = "3:1" "DefaultValue" = "3:1" "UsePlugInResources" = "11:TRUE" } } } } } "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_22B9B4351EA04F2098552947E2568F8D" { "Name" = "8:#1900" "Sequence" = "3:2" "Attributes" = "3:1" "Dialogs" { "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_0772D4150F424CCEA66580B17DAC47A4" { "Sequence" = "3:200" "DisplayName" = "8:Installation Folder" "UseDynamicProperties" = "11:TRUE" "IsDependency" = "11:FALSE" "SourcePath" = "8:\\VsdAdminFolderDlg.wid" "Properties" { "BannerBitmap" { "Name" = "8:BannerBitmap" "DisplayName" = "8:#1001" "Description" = "8:#1101" "Type" = "3:8" "ContextData" = "8:Bitmap" "Attributes" = "3:4" "Setting" = "3:2" "Value" = "8:_2A9DB6318EE24F649FB0CDB52691122C" "UsePlugInResources" = "11:TRUE" } } } "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_0AEF617DE1764D998761CAF6CEDBE9C7" { "Sequence" = "3:300" "DisplayName" = "8:Confirm Installation" "UseDynamicProperties" = "11:TRUE" "IsDependency" = "11:FALSE" "SourcePath" = "8:\\VsdAdminConfirmDlg.wid" "Properties" { "BannerBitmap" { "Name" = "8:BannerBitmap" "DisplayName" = "8:#1001" "Description" = "8:#1101" "Type" = "3:8" "ContextData" = "8:Bitmap" "Attributes" = "3:4" "Setting" = "3:2" "Value" = "8:_2A9DB6318EE24F649FB0CDB52691122C" "UsePlugInResources" = "11:TRUE" } } } "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_5E47C2C29D55459CA3D0CE1D87849CB5" { "Sequence" = "3:210" "DisplayName" = "8:License Agreement" "UseDynamicProperties" = "11:TRUE" "IsDependency" = "11:FALSE" "SourcePath" = "8:\\VsdAdminLicenseDlg.wid" "Properties" { "BannerBitmap" { "Name" = "8:BannerBitmap" "DisplayName" = "8:#1001" "Description" = "8:#1101" "Type" = "3:8" "ContextData" = "8:Bitmap" "Attributes" = "3:4" "Setting" = "3:2" "Value" = "8:_2A9DB6318EE24F649FB0CDB52691122C" "UsePlugInResources" = "11:TRUE" } "EulaText" { "Name" = "8:EulaText" "DisplayName" = "8:#1008" "Description" = "8:#1108" "Type" = "3:6" "ContextData" = "8:" "Attributes" = "3:0" "Setting" = "3:2" "Value" = "8:_ECC9F59ECF5E4AF2B7E9A13EB821F56A" "UsePlugInResources" = "11:TRUE" } "Sunken" { "Name" = "8:Sunken" "DisplayName" = "8:#1007" "Description" = "8:#1107" "Type" = "3:5" "ContextData" = "8:4;True=4;False=0" "Attributes" = "3:0" "Setting" = "3:0" "Value" = "3:4" "DefaultValue" = "3:4" "UsePlugInResources" = "11:TRUE" } } } "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_A8F89A67BEB94457BE851BF7D2B9ABB3" { "Sequence" = "3:100" "DisplayName" = "8:Welcome" "UseDynamicProperties" = "11:TRUE" "IsDependency" = "11:FALSE" "SourcePath" = "8:\\VsdAdminWelcomeDlg.wid" "Properties" { "BannerBitmap" { "Name" = "8:BannerBitmap" "DisplayName" = "8:#1001" "Description" = "8:#1101" "Type" = "3:8" "ContextData" = "8:Bitmap" "Attributes" = "3:4" "Setting" = "3:2" "Value" = "8:_2A9DB6318EE24F649FB0CDB52691122C" "UsePlugInResources" = "11:TRUE" } "CopyrightWarning" { "Name" = "8:CopyrightWarning" "DisplayName" = "8:#1002" "Description" = "8:#1102" "Type" = "3:3" "ContextData" = "8:" "Attributes" = "3:0" "Setting" = "3:2" "Value" = "8:Enter Copyright Warning here" "DefaultValue" = "8:#1202" "UsePlugInResources" = "11:TRUE" } "Welcome" { "Name" = "8:Welcome" "DisplayName" = "8:#1003" "Description" = "8:#1103" "Type" = "3:3" "ContextData" = "8:" "Attributes" = "3:0" "Setting" = "3:1" "Value" = "8:#1203" "DefaultValue" = "8:#1203" "UsePlugInResources" = "11:TRUE" } } } } } "{2479F3F5-0309-486D-8047-8187E2CE5BA0}:_2AAFACD0BBFF4CD59018D04F8FD4EAB1" { "UseDynamicProperties" = "11:FALSE" "IsDependency" = "11:FALSE" "SourcePath" = "8:\\VsdBasicDialogs.wim" } "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_486EC70432EB416CAC7249721137AF24" { "Name" = "8:#1901" "Sequence" = "3:1" "Attributes" = "3:2" "Dialogs" { "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_CA5171C1018B44D19826935E430AC6E4" { "Sequence" = "3:100" "DisplayName" = "8:Progress" "UseDynamicProperties" = "11:TRUE" "IsDependency" = "11:FALSE" "SourcePath" = "8:\\VsdProgressDlg.wid" "Properties" { "BannerBitmap" { "Name" = "8:BannerBitmap" "DisplayName" = "8:#1001" "Description" = "8:#1101" "Type" = "3:8" "ContextData" = "8:Bitmap" "Attributes" = "3:4" "Setting" = "3:2" "Value" = "8:_2A9DB6318EE24F649FB0CDB52691122C" "UsePlugInResources" = "11:TRUE" } "ShowProgress" { "Name" = "8:ShowProgress" "DisplayName" = "8:#1009" "Description" = "8:#1109" "Type" = "3:5" "ContextData" = "8:1;True=1;False=0" "Attributes" = "3:0" "Setting" = "3:0" "Value" = "3:1" "DefaultValue" = "3:1" "UsePlugInResources" = "11:TRUE" } } } } } "{2479F3F5-0309-486D-8047-8187E2CE5BA0}:_572FFF7B95854CC7BD606EC77C5E5B23" { "UseDynamicProperties" = "11:FALSE" "IsDependency" = "11:FALSE" "SourcePath" = "8:\\VsdUserInterface.wim" } "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_BE7223C331D7475FB0E17005927F7804" { "Name" = "8:#1902" "Sequence" = "3:1" "Attributes" = "3:3" "Dialogs" { "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_0FE8B37FBD6348D2B550B51AE9213A02" { "Sequence" = "3:110" "DisplayName" = "8:Finished" "UseDynamicProperties" = "11:TRUE" "IsDependency" = "11:FALSE" "SourcePath" = "8:\\VsdFinishedDlg.wid" "Properties" { "BannerBitmap" { "Name" = "8:BannerBitmap" "DisplayName" = "8:#1001" "Description" = "8:#1101" "Type" = "3:8" "ContextData" = "8:Bitmap" "Attributes" = "3:4" "Setting" = "3:2" "Value" = "8:_2A9DB6318EE24F649FB0CDB52691122C" "UsePlugInResources" = "11:TRUE" } "UpdateText" { "Name" = "8:UpdateText" "DisplayName" = "8:#1058" "Description" = "8:#1158" "Type" = "3:15" "ContextData" = "8:" "Attributes" = "3:0" "Setting" = "3:1" "Value" = "8:#1258" "DefaultValue" = "8:#1258" "UsePlugInResources" = "11:TRUE" } } } "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_7A153700BD224EF1A4E5E255037C70D9" { "Sequence" = "3:100" "DisplayName" = "8:Read Me" "UseDynamicProperties" = "11:TRUE" "IsDependency" = "11:FALSE" "SourcePath" = "8:\\VsdReadmeDlg.wid" "Properties" { "BannerBitmap" { "Name" = "8:BannerBitmap" "DisplayName" = "8:#1001" "Description" = "8:#1101" "Type" = "3:8" "ContextData" = "8:Bitmap" "Attributes" = "3:4" "Setting" = "3:2" "Value" = "8:_2A9DB6318EE24F649FB0CDB52691122C" "UsePlugInResources" = "11:TRUE" } "ReadmeText" { "Name" = "8:ReadmeText" "DisplayName" = "8:#1010" "Description" = "8:#1110" "Type" = "3:6" "ContextData" = "8:" "Attributes" = "3:0" "Setting" = "3:2" "Value" = "8:_D8E3D69430F54B5DB4F890834BBC0CC6" "UsePlugInResources" = "11:TRUE" } "Sunken" { "Name" = "8:Sunken" "DisplayName" = "8:#1007" "Description" = "8:#1107" "Type" = "3:5" "ContextData" = "8:4;True=4;False=0" "Attributes" = "3:0" "Setting" = "3:0" "Value" = "3:4" "DefaultValue" = "3:4" "UsePlugInResources" = "11:TRUE" } } } } } "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_CA31C9E5F16A44B0B782E38B84A49FD2" { "Name" = "8:#1902" "Sequence" = "3:2" "Attributes" = "3:3" "Dialogs" { "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_B317FC7D252F4803B2866CF882D4822A" { "Sequence" = "3:100" "DisplayName" = "8:Read Me" "UseDynamicProperties" = "11:TRUE" "IsDependency" = "11:FALSE" "SourcePath" = "8:\\VsdAdminReadmeDlg.wid" "Properties" { "BannerBitmap" { "Name" = "8:BannerBitmap" "DisplayName" = "8:#1001" "Description" = "8:#1101" "Type" = "3:8" "ContextData" = "8:Bitmap" "Attributes" = "3:4" "Setting" = "3:2" "Value" = "8:_2A9DB6318EE24F649FB0CDB52691122C" "UsePlugInResources" = "11:TRUE" } "ReadmeText" { "Name" = "8:ReadmeText" "DisplayName" = "8:#1010" "Description" = "8:#1110" "Type" = "3:6" "ContextData" = "8:" "Attributes" = "3:0" "Setting" = "3:2" "Value" = "8:_D8E3D69430F54B5DB4F890834BBC0CC6" "UsePlugInResources" = "11:TRUE" } "Sunken" { "Name" = "8:Sunken" "DisplayName" = "8:#1007" "Description" = "8:#1107" "Type" = "3:5" "ContextData" = "8:4;True=4;False=0" "Attributes" = "3:0" "Setting" = "3:0" "Value" = "3:4" "DefaultValue" = "3:4" "UsePlugInResources" = "11:TRUE" } } } "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_F40B2723DC3E4BADBD94FFAC5683C171" { "Sequence" = "3:200" "DisplayName" = "8:Finished" "UseDynamicProperties" = "11:TRUE" "IsDependency" = "11:FALSE" "SourcePath" = "8:\\VsdAdminFinishedDlg.wid" "Properties" { "BannerBitmap" { "Name" = "8:BannerBitmap" "DisplayName" = "8:#1001" "Description" = "8:#1101" "Type" = "3:8" "ContextData" = "8:Bitmap" "Attributes" = "3:4" "Setting" = "3:2" "Value" = "8:_2A9DB6318EE24F649FB0CDB52691122C" "UsePlugInResources" = "11:TRUE" } } } } } } "MergeModule" { } "ProjectOutput" { } } } modsecurity-apache_2.7.7/iis/ModSecurityIIS/ModSecurityIIS/ModSecurity.xml0000664000175000017500000000055612243422537027052 0ustar zimmerlezimmerle modsecurity-apache_2.7.7/iis/ModSecurityIIS/ModSecurityIIS/installer project/0000775000175000017500000000000012243422537027477 5ustar zimmerlezimmerlemodsecurity-apache_2.7.7/iis/ModSecurityIIS/ModSecurityIIS/installer project/Properties/0000775000175000017500000000000012243422537031633 5ustar zimmerlezimmerle././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootmodsecurity-apache_2.7.7/iis/ModSecurityIIS/ModSecurityIIS/installer project/Properties/Settings.settingsmodsecurity-apache_2.7.7/iis/ModSecurityIIS/ModSecurityIIS/installer project/Properties/Settings.set0000664000175000017500000000037112243422537034151 0ustar zimmerlezimmerle ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmodsecurity-apache_2.7.7/iis/ModSecurityIIS/ModSecurityIIS/installer project/Properties/AssemblyInfo.csmodsecurity-apache_2.7.7/iis/ModSecurityIIS/ModSecurityIIS/installer project/Properties/AssemblyInfo0000664000175000017500000000262612243422537034157 0ustar zimmerlezimmerleusing System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("configure")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("configure")] [assembly: AssemblyCopyright("Copyright © 2012")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("320c5ce4-6089-4bb4-a9d2-ea68f9894a88")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmodsecurity-apache_2.7.7/iis/ModSecurityIIS/ModSecurityIIS/installer project/Properties/Resources.resxmodsecurity-apache_2.7.7/iis/ModSecurityIIS/ModSecurityIIS/installer project/Properties/Resources.re0000664000175000017500000001411112243422537034133 0ustar zimmerlezimmerle text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ..\Resources\ModSecurityLogo.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootmodsecurity-apache_2.7.7/iis/ModSecurityIIS/ModSecurityIIS/installer project/Properties/Settings.Designer.csmodsecurity-apache_2.7.7/iis/ModSecurityIIS/ModSecurityIIS/installer project/Properties/Settings.Des0000664000175000017500000000210212243422537034063 0ustar zimmerlezimmerle//------------------------------------------------------------------------------ // // This code was generated by a tool. // Runtime Version:4.0.30319.269 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // //------------------------------------------------------------------------------ namespace configure.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); public static Settings Default { get { return defaultInstance; } } } } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootmodsecurity-apache_2.7.7/iis/ModSecurityIIS/ModSecurityIIS/installer project/Properties/Resources.Designer.csmodsecurity-apache_2.7.7/iis/ModSecurityIIS/ModSecurityIIS/installer project/Properties/Resources.De0000664000175000017500000000605112243422537034061 0ustar zimmerlezimmerle//------------------------------------------------------------------------------ // // This code was generated by a tool. // Runtime Version:4.0.30319.269 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // //------------------------------------------------------------------------------ namespace configure.Properties { using System; /// /// A strongly-typed resource class, for looking up localized strings, etc. /// // This class was auto-generated by the StronglyTypedResourceBuilder // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { private static global::System.Resources.ResourceManager resourceMan; private static global::System.Globalization.CultureInfo resourceCulture; [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal Resources() { } /// /// Returns the cached ResourceManager instance used by this class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("configure.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } /// /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } internal static System.Drawing.Bitmap ModSecurityLogo { get { object obj = ResourceManager.GetObject("ModSecurityLogo", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootmodsecurity-apache_2.7.7/iis/ModSecurityIIS/ModSecurityIIS/installer project/ModSecurityIIS Installer.slnmodsecurity-apache_2.7.7/iis/ModSecurityIIS/ModSecurityIIS/installer project/ModSecurityIIS Installe0000664000175000017500000000233312243422537033773 0ustar zimmerlezimmerle Microsoft Visual Studio Solution File, Format Version 11.00 # Visual Studio 2010 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ModSecurityIIS Installer", "ModSecurityIIS Installer.csproj", "{023E10BD-4FF6-4401-9A40-AED9717073F2}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x64 = Debug|x64 Debug|x86 = Debug|x86 Release|x64 = Release|x64 Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {023E10BD-4FF6-4401-9A40-AED9717073F2}.Debug|x64.ActiveCfg = Debug|x64 {023E10BD-4FF6-4401-9A40-AED9717073F2}.Debug|x64.Build.0 = Debug|x64 {023E10BD-4FF6-4401-9A40-AED9717073F2}.Debug|x86.ActiveCfg = Debug|x86 {023E10BD-4FF6-4401-9A40-AED9717073F2}.Debug|x86.Build.0 = Debug|x86 {023E10BD-4FF6-4401-9A40-AED9717073F2}.Release|x64.ActiveCfg = Release|x64 {023E10BD-4FF6-4401-9A40-AED9717073F2}.Release|x64.Build.0 = Release|x64 {023E10BD-4FF6-4401-9A40-AED9717073F2}.Release|x86.ActiveCfg = Release|x86 {023E10BD-4FF6-4401-9A40-AED9717073F2}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal modsecurity-apache_2.7.7/iis/ModSecurityIIS/ModSecurityIIS/installer project/Program.cs0000664000175000017500000000125112243422537031434 0ustar zimmerlezimmerleusing System; namespace configure { public class Program { static void Main(string[] args) { ModSecurityConfigurator configurator = new ModSecurityConfigurator(); if (args.Length > 0) { if (args[0].Equals("uninstall", StringComparison.InvariantCultureIgnoreCase)) configurator.Uninstall(); else { configurator.Install(args[0]); } } else { Console.WriteLine("configure.exe | uninstall"); } } } } modsecurity-apache_2.7.7/iis/ModSecurityIIS/ModSecurityIIS/installer project/Resources/0000775000175000017500000000000012243422537031451 5ustar zimmerlezimmerle././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootmodsecurity-apache_2.7.7/iis/ModSecurityIIS/ModSecurityIIS/installer project/Resources/ModSecurityLogo.pngmodsecurity-apache_2.7.7/iis/ModSecurityIIS/ModSecurityIIS/installer project/Resources/ModSecurityLo0000664000175000017500000007621712243422537034153 0ustar zimmerlezimmerlePNG  IHDRP^ pHYs.#.#x?vtEXtSoftwareAdobe ImageReadyqe<|IDATxU#G`#9G` D&,"X@kThz]|FtWWWb(F*2T} g w~@xB 'P@xB 'P@xB 'P@xB 'P@xB 'P@xB 'P@qC@J~4et0~W#B2PXM>H R$@mFWǴL΋eHjv)BNPJ<~Z8߄ 0$(& ?X;8aP&0V盄' Z<$N|#007 #{MV+P-R!|AjfP27 wR#xyܪ&# 8%I 8j$i 8 xIL @Pz.or^,W8Z S1p2-oIy!x@xB 'P@xB 'P@xB 'P@xB 'P@xB 'P@xB 'PY4o4V?N~n\j6yVjf&k8~*Q~ CvR|^y^/IiUt^LZa䠯|u{V)-]Wʃl@Zm_,ւ/WT'G- l<>Vnճ0}k;)Z n-K9 Mp`59؀gi2Z+ͩRkyv[}\VeZxT'?Mzm?JiY.\/הm@mIM/V9O'URV屑J2 >} 08wVTk=y&ȳ_oevs>*X~ YSPz9Y+Rla6t<6oVuAޗg" .TMK O [FP@e\,j{EKa#Y2q4:R G2bh~{|CY:f4~L[+?Pz9qPחb$L;?Wue5-ouOʴդgי=<ѴioQo4B[`5.drJfyaJ}*ߝfv ep+w@yaإk5``p͟BWҪ߫ ?pR{-|4ixzq7EWQ6}|k0 䌽:O+VgypP١JoI3 ./b=}Z)Rm`"Q-rїYz~5Ga ~x6-;棑Mە#3xCYAԮV(߾uJ׺68I 5䭎ʴ'8f[SA$ I Qhez}?ɣTR3N"|fZUئ-2}CglY 5۴'T aeʦٞZ9s܇r;3+˒o/[M2JoӐB}i S.rp1rm6 rwVe<5m$ֻn$7C{CVKwZr;aBoh&5`P&ʪZd};Njp:nFNaΞ,`tPާ >VYrs|އo:V_?W)@o$_e TrɇL*L>!jJPl)U:J1xTچUmU*l{;X9 r.Q:on-s&q<A_ +NBy;+rJe2 ډ饯g>W aKe<]%cR1PV]jCǫ4dz@r/OaWB:o2͋Y W iQkǼlX!w!)P l\.&ieNȡ_w8;t%;u0xKO@h Bqe@/*"̮.s]<zYDi#B weZk4 W\w倵\_Xs^z\`(1xby>DikVBya)' ^tȳ\<ɳH#:S2--ovI_ [͓b<X7ɤ˥}Sap8h viuj[/żYS39`, bgUv$g^J습|mO--Kc"P >3r ;7=`ȝ媾ă(k3͕q@K3ڣu1JݯK)āYgxqsGAgAA˻3l܁2(zv^ڙ'闧IQbfbS>eL2@6mPxMd ʧ"JLRQca$i$Xy孋fmX}Q6I>ٜ}Wͯ<-+ۦʶ m\2H2J y+PtQ5/(g\(kak]sQ'9Ne@u^Z8OmvQm$wÇ2zٵAƽr-9OGb.<`Aݏ ụʼݶ|@$vdƩ%>;'y-$hǴ9ꢋBq:zWuB`άҼ]|zDm< uQg<$z9L((OX%w2%_ Ohh{+/A_Oj=ؚUI8;,PZX^ۺaϺ:ئrm2c)㸫UNmsj˰;F4V;o=H>(K WۇFe?h=wm .ƭKAس.=alIT2{J1zPZ! 'lZ=y#A3I^v-/ ^S/ue!>Va (=?7pSK#Zzh4-d@כ3އIٟ/g tw-䯷6gUVR@&UwU> +̐m[<7h4{{,+-_:wo9+(!8khh%meˬÿoUV`" k'Um T2h˩$)> gbIf, ;ssY(K:P>l {$u =#|X ,0ily4,>/lEҴho[}܎oCɓ2ʜzrnfqvXV{aAɛ~Vxrw}Zm (ҙU~}p~a" k"=6IkRuፁ3:9o!Mޭ^JCMshź\2bZ>F3x[A?yCP3o{y{(埱-V~ $]rVo4 W_WHƉlŗPB% p,?tQD4AAty&Tyfowo'3WVq4?6Uޘϰh7^yLX4m1bke.3}Z弭'Gi,{m6m+~/=<Ԁ$ôOY 2:Z}Rf5NW"m;xL.!P{4C4]FS]=X5ea:+be^A1hqmzYחJQ?rbP'U(v3ܾkZa/yAuuBڵHc@qP=xj郙2Wrq{qv?,\=]}2U_ffBɭu)M@K⅕ƃS>Y Os=ޥY%P> l&@ח`!de{Yϯ/a3Hꝙ()^|w8h2mp.Ka+\K; /x O9+H=ڱ qmKouYX-KPO_e}&XShx9F$g)k&~J`0?0'*cC4 =|8錏wuHM2ʄROxq+B n=nUJO\|8~N+ p4۞:˩+4wm4T ?YlM4aɥm+P}w<4䷆4́zH}=S،f9_͵a\R,'WY׉_(u٬(=^p'NNfLrimV|0nrvIV %VmӸ| 6g_Kr_F4${'S1sV&N:]T7D2;A}ٍ[לdϙu f8^<9 Ъ2ﺯX콁4Z7: F62 ӎ gE~ڼeM},և!m7:)Fe ?CnO>?鸟6Is @r 'x9vsMg[he\bP7|`yi}$. ODˎی,(FT2@'*Olkwe_dl4Mt;UfC"w?gʨpLMc0HKsg@7D()eț 7QZˊ͹N2T>/OWHA`g%aD}~Yl;95'[Wyr^}(el\g jO9n:)4 й/þKhg(7'G5 =(|_lI}ti.пO$^{P@IלyF{C !xJ ʅ3@lέ5 Khښ)}6@eXcTDg+|[zy - '\+PZ~(cI@]FѶ8۟g;?Ê|g 'O[ʠc $^Iꦎ [IйΐMd5Q99׏UCv 5+7wDzq۞I;:᧖@ djTVn2z !Q_q[/w7tL@/}I'u| `7u38K?l(;9h ٨D@ک@ _IZv@@tNC[ mU&|m4 ]lZ셡ΐ}1+atgs2&W'[x˩͖dYAɹ@JIo6[x8Qum#VѵV@r'|9>-n RiҍjEJ%ô%nA[c4?[ f䵜$’a@Hzؤdڻ:W@H X,U(X/ üeߒ1f@+Nj]Y$:l, Hą$xQ\}B e:s@ԗt]gK.,=q>xVd w)Uk 8DMIimY(ƛ'8׹mn>4EA6Oqc}Z Gz )6O!r-I}f[~R4 $Y+[xdEKRb'I_) ڰI?O8{9MfөeFJ9))Psg3=X!~I߄/@|t^zb4@%5Q2euNFW | ֗OsHP/Kml.FQ+zQ9ClS)QpUc:&Hǣw $@hǠcЈUJ}jRa}𾦺sIbۤFa(2 U?  +Ibdg( B՘:/Q"LZ).t !8 ER{9d 0((HR'Ϋ ^z8H~\w:d 0y!҆U 庁F=@D$F@FѡTx] .%Z=z>(l%P O'mYyGWH():ܾ@mqvxwR6 < kW%ze g2\YM^8J5x${F\_ [z)luL~O@X8;FhQ!@2Kj%cy^}&?^XҦt6 С/ ^d/ۀ%tq;F j]V?Ɖ6S:BR(擞|GvIl>wR5FW3[z-+:@y ^'4(m՞rKZ&72I~#(5WzQ!lu(x:k޷.{ EP@ʟRqr%y=e<֔\(;U4-Q>7DXW&x'nP%@{gs[I>^. IBϩi X/sIjdRAr zLOZ.z> @b eZ8lI(@y{.@hsXV{RD9 @y$Uj⹼gc7YcNknυ3x撡sC}"́pU_&.:I4@Rp( ehTA$tp$G1y _h['5-`vh-:vsRlﵻAHq?!СsRwdj쯅]3Q"j{a{hq_TbyKFeb{; Cw6nbףTl~.W]6gAu' `8FѡTO<'%lo9)o;r+$w 9([̟x@|j ŶE{<+򖋸/}ydM%r?9NYIxR8'%g*]Ώl $C$}Y;'E GD2@:Jm((@ $A/l\CЂxNy!-/>rU&vL$ݭ$fsInPRHeaPԗtNZm-RY]ȗl؇@i<#J0g@=Įq"i(gL<8)NGWCVh,@#9%". hWN^H8;A 4 +{nr=r sߪL_[2ItteWn{xGG sQ,`\6@keFrqK&2y[gye?md!̘ Nop|8F.dTO=UhDY}ާyaL*ηM@`SrqQ5C#zV,I_ʈ#F]k˪G{3|%Ir+2i{{*Q/70ʄ8v иIЩqN7X,)i@A!PO I)Sp.~K;!@*& ^8eϜfԦAS(a:Ǚޓ.w=Y>f+@}yՆKAl&y wRFȦA昧^zCgc.7a[y~7p H+V(6u#ly?@ly7r98fqF++Lv@ Ìҿ4ōFPLN[,'=*mT>,st]%3j82(<8@ʄ8] (OsK9d xxyj+øOߋkCgv?I?λ NJ4&(}[x|2e4伴X,2}=V%wK/]S:͘d=#E sB@>lyY>s- js_}(<{9Fg ^TD1GˁtnS*eCnvA֣Wmϯqֻ"X` ^/~zɍAVݼ)7PlkPr*RQ?jo8kd_1]@ t@ai@(NnN3cnW &rqu]=Pggv3sF.J۲<@qfdMRCGX,)Vf<-i@*Snp>r|:,HU` klU_r;v2\8;̭3q}u-wC |[9n+x؝KoW046$9 h gz lg, Zܼ&=Mn|O eŗGW} Vh䯔y b-h4dwjDg/l"6^mVЩ3wP=G6A: A٣P`8rꐟ눷Yޥ>=㉢-+_[.ym,_](KikeColpmm5'IZy,}vmǕkw& (EǣѨ9#Zveۉkk2k9~{ҫU(\eO:xŠbn[ϥoB]nIrQ>:w 4ࠏ~ǭG3IMɭgy+Yscma {U_;H~ Jp@ae1aq;*'y,=uMy`E .2Kʢ8ϽI W8uW {?8Ն@a)3i%+(ÿ^.꤇הKq;>'zrJs;Bٳrd?}i+Y}VߧmÜ X,rzׇU(@{u틂u9zRpePP\ MoPkuQy1íuܓ6ңݪ OnYk6xfNmb.eG]B3}"m,w%.p<1MgYt~AIL}?(9m6ׅ`w+J66 , ؝u`vngQ4U؈瑴ߺ,x*EVTrY}ʙnZ//<n8rA) w ei֧D&)\ L\ [A[G+Bgm.nm1'-^}2li˲-_2K I+AO{qeyyގletd[N(0LL+Qws9v@}ǶZtqyLߙVmMR΁ߩ6ylzT-_W =}ܶQ+&f~!P^a;cSiN(034S{Ο\eFXF(wNg[e'%1Xc^78uvTc^Ww[6N_ܚ)dzxB9WWj^)fbS/ ԡ J\է4&80L +cU;5;~^7rn}=+"YVQ shRlqy[U- 6Sf|o &Y`cf=;?e.vTCyY0֓0B-`o!ā}q;p\ިC8x!3˿iC1N;ڶ/^_1P%Ӓ @FMby>}ng^re oa JY J"@j])q%˴pyp^5s y!ltuմ}ywPY1`\XwΟ A0h8!u םo_B[.X*mMJN+gaы濱't,= _&D!: >bmp4yk|Wvk_bP1pJЮ "-[B\,h|(=XYj\{H|5t^꒡ = zzt= d:;r@@!E9U(AM+J wi@@jya1}Wu~4nJo\ s;/Yw;\_GDž-@OUs&$\C$!T eul[,a~Vg]żpPjyP'M/]->Y+v';0$}<$HJ) ~pϹw]@[ ppUt3 3[4袮'ԗ)O n>t5bKZ$\KKK.$`M\} $[w* Vxӎ˷a7I0 Vt~CPlH<V>є$Ŀ~:{Uӎ0?€@b{O)R|@5-l 14]ZByKy6L4Rl{zXSIt.klSwCIIM(`iZnt.%㏸<RrVP5:D68|Uḻ۬rxxh$3:y[(%Ai!|fzӞ\㠡NE[t-yaPU/zT ML>Ht:}ЖRE OgJxVH pj\:B2 |u ShijoW5 V$}_o@[y뭻q%? " |U=uNJF+e9% c|9ΟqG[D͜M܊o gU]43*yL*#R'[șس< @Cev@:j@/ܗ*|sO{|}VMHǦa\Jd) r zKptͅzYJ{]=L) l(*dfΕe ܧ}QWɗq¤DI>Kd=(Nsܺ m;iՆNKz v!/vS=\غk,mI r $'O:B%53Of=OemZr1CzLN@6@} $'kyR>؟Uz$K%U4ՙ(=|ua9\b,wDlYςa 9}[z[9{N>h$l^/`y{kח"m^anV-MTȽYTdY[*/PcpL uPVem@e~Nc6u \c B4,8y>oFˏqz no'@fbz ))L~VT?RM뫊JsY}N~WV+ף(4O%4Nf!]LvS!&UT?EZAL# ֆq,BX|W/ha gku#M RZ}}s?oe,߬}9ywm!g}9E~Zh;MxXVmbFQ< ޜY;k|^!2syy%+PkOY@c:峺@ &M*]fI彫eϕiׂ&<`j4U?)rʷ2ol׏v@g C}δu$ ,oN_眬k`;EpUgmrj@EU̩kܹY*b5\F+li҇<_)\Lnc{I'y0MU:΋ 'UcU~@(3Ob}Rs r5C6 &>m 2 |Vʳ(_+r|<&=_v-O\ve$q0Emv˸hҔIu0urF9 eP h5>( R:]k*Ku;@m.Lyb`q oqqvx8gj o}] r=@M2/+P퍮&Տ onqv0*u!?T؏O24Z,6`t0~=.l@Y})$@ݽʡ?X!g?_$*=Zؕ36Z,R0zW?g#O EOxK(IUzK(׵G$[]=}p / vr 7(Ie5(I(+=oP`sLfqv~#w=!]=V?ez{'=$z\z@ؾk@P`3Lh$o]=T?2=+P!odz_wG?(dy;|¿;X})Ox Ţ`j\|律R߱~wK9>yhXl ѸX>j/!]e/b3U{ٖ2غik xϯ ߋ|׆mu F;j3fޮ߯UKլǮeXWntQ[e ȡ2zi6eqvXz~/Ҹ1>;A*I|5Sx [{qTG 5.jɎis?CVW„[xcvtP&Ir補fO^f%v 5w"_`>T祎&9Y ^V7Q.=m{bRcVwvGMuxhwZ _2/x5VQX?] )KC?^XrbȪq1d5@Ay t`qv8~̥İ'eMd%lATk?O}g7`pWaRm]n(,fJV<@Y 5yVxo AYw[묣'5|x_ꕸfw4٨eяJY3eU|O=rߝPf8;nd'fWL$/@:[2++o>5}'Z,{Գ5\B[K9jhv%3Wʠꢿ)нt%t>X,N$~U?}xUǾ1!XrVGw*|Bp?@i;H_/S q3vBs^}{R?~^}gɇ'⿟ƥ~.Z=> ջvg{S_gVeHWxwzRuUSi#wR6hgdfC˦pIӆm+wJeg@x }> J&ܬyX+]f>ׂ'kC|:P ]A&MPXIRoe WT=VSZ&@`eMBCyGFS;ϔ$k׾m:"|M"}f]lN2C gG=K]9AG;? $:qaٶgs'}7w03v@irV(mͦ&-w]&$k3(LRà þ}oʿهb(7{wHOq=w Cζ+V% >.Is(U撗ݼ;%p @ }f>y@]x]$K:?iា.#dac)[(P{^36=b)yضNB ]Ʈe(첥힫?msP;ɔAzyʎ>P'Ԏ~[p

βi4 ,?m>ޫ~YwOs>]^Pf^&Пn7}!=7,'}Gw.Ov{xLI]XGߡgUSO8:l, ba67p]X~.Y.~<|w=e4>3:,YrϤY"'.CS_c³ZNo,WM.{P|Lmaw'erb> ߝPU9\~|ؿ{}6Է*6Vc1m܆ߣ_o]˿u_o wM1fhO5nYWۡ\W-A}D |fK*?9?54X|gTS:;O:6wS2N]k~v`zs3|&ߔ{; oMy]LXt6[A.Uҿ EQmFvӢޱ.ʱ .iko]׾}WSQ6͸ ԫ[Mjma~aZ\8mٯu6C#_>>f(ga=.nToϙ[vL⊼ϊذK/|n˾I  }4#TykWxכzBj]ʝ{a]*fŀvӿDZ^&9ߪrJA705izWk':Ϋ>?IWdMC!ef/mV@=P6XTI,~ݣMlJ5\ۯc00e ǎ> fbmCӮm4?c[5~j?]Yo<3vw]%Xʞ"rVjuujK`'ſwa.6(#b'=oӚMǵL:NT6㪭I{}}gudvmt}۽2%\gŷgW7|OV ۏ_ms 7 L`vDQ&:A ^yTJYV \okQ p9Jȼ@h~mx0_#B٧N29o?,FnbJ01s-i,ds:*F^cl_OW"' i?YynҡݥN|4>!;P+X\ڝjIW],+sl鳵{=^U%3G.i.Tq#Ow_M!~Bٍ&+cǞm9]jQh}|+r <ے* 7慬R^[^o"]>싯^to ܗm##fgcsQuQk:Jue?g_[VjS6 ,{d~Y#9C"zc{%q]{=B|'ƗGuZyd@Ike{.$ǪGn#H6^9:(g-ь63yD=ĴI9u! %v cm̅NL>C״'ZEJInm doRFˑhzP84.*u=pyjjükggG7j:k9K7C->/@8imϾG5a<.UJBV=b5,WiUl]agb* (HQ$AͳC<^R l5ڳF2.rw`#"y xV'}XIIya7JIn6 Q9֚.1kDlviˎ(hm:6@v7Wߚ;qΧg\u6IXP4aX@ 6ɀ1-(vc,q S˄_Xk:.JžCU9S*Tv4ܽƟLnIl܋GqMu"oKƢ6X~ ’ʖsMz^jx3Z#!5qB6a;>AFCvG61 *`=1m{I2H*:̅>Ւe}ȁJk\ml%C= O(uq5)r6>4) Z_v`O*a!DY:{k\cJa|b3Oh'@氀o@b!$ H3 $EJ[7^zL>pLݫ$t"!l#$6W/` :"G0zFQ@}=0/@-_ Q GvB6 ˀ]Ē͎ ])op' GxfFP-'y: ИRYD%zZnfw(#[u)HjK|o=vl_rh[-N#I |h[Չ!5Br-Ó5);> gL.} FNUG~=Es/ (qOPY^+ 1`D^;(T/KǺdv31(c W$6K| ͅBĥϩk_B!QL@d Iy&iuF@/s9fv۸/Xj-X+شKõUPQY{f_/q\H3IvwdH|i1gJm{u@?ӌq;R`yV/v>IH|c1ʚ+=.A}ijEI _b>|"p/?/z"8S{Ԗؕqk]ر_cz1A:RH&ͮoJm:.+jpR Qt!u.dbgatXŕAƖr=c_gg!6r]Ĺ cuvܾ3v`dp @#O<&Bdɐ;#Wk{{ضJ`WK*KT$Iъ 6}TO'@Nw3k"Ƀ=|Ԭ{W$\/1 Zc]īdgz@\$.tKEK~ࢨ{W3 i!8˲` 5&qO\>;xpApWW=8XwLU&agT6T_)H19Q8&v}OO$#}PyŦH|\A;PL2:œWuaf3atpy#{ bv. wFW(` g\1vh₃_hڬ>d|HSO7ל!ExήSmZ17,_؆.fe~ |TYP G{Df ¿:KH$A Ҿ 7Xb:6 4:+ /ܰ,G쎠䔋>5tqt8QR{: !bE}ҴB=D"bҦʵ/$'aʸeyvMJ-J (*T%+E1a~oBO{4֮bs+u8wc1Rىo;1KawbswHN4]&%~ΰPa`$Gq3+&qR3W$ IM~טTXn:UV͙Do+$;~Uл[׋JQK"|sma@*o>Y7Y xTlU#|$] ZzȗTvbThɏn scD CH=5XݧxnPacxUt{t*w)AvHأGuE?x_$`ɡC̎9Qr m3 {W :)Y$kn=l6a1EBDAf>|?3QrC;*vqٛH#jy<ʞ$ANA\<;V.q N.1ZnJm\LE㹹.H5s}9ʕf$* 2eȱ~rl5M}v.:4+IqS']柳r ],_:FugѬ`$`ܴ9tQ^so Uq .U:& T<6ꁑNvsoEfV]b6>[!x ǺrwقD_x0Rmb}pC_.$ )Q-!8e=b'4&a54@JkX@Y  /n޹&աKmͧ,i)*ą 8f~?c5 nXqN3 ԁeO!0Nv:Utj"lɷDH<7@}"$ ЖǾv-/Tvk6磰MOv]K&֧vдvNJ}V0wkNe䶧mBKxBx9uˋGWbQzd'کc?S6ק H,zơ9˲'g>78ΠoLG{b-GmHئR}(nI&dᗀ$nW+Gk@7)=S-2 ` $څIKK|ׅlr9D{X;0\W)%zak{6Ƞxdto9zS_AۤhM,Gtmߢa @:z蝆clbuwhk{I"'m49bߤ]o\P]X{=j|T'4bFxkݖ|ꭢ@ZtМ%ĖĎ J*{T`X~B+kxs| czlOb 0fP~X2>q"@? u+itlZ^(݅pi㴽7cЊ};.Ƽ߫80nN 2j&-`~ Nf5Ln̅jnD`^dw~ HpA_dTl2{3k}I^ck3$1Mr9<.qc +Ca6b[D29d_ǎ,<}c֡sX#;hC8X53|+Jtt c!^ݷ0@WWQ%0Z!Y2=L=޻%CsHRZI_3{N>Ta'}Yoj\ZȏZX*bsLޭ7OTt>_Qٷioocm׽mDK;0 Y SB"g3ge؆+J,8a;8 LMیoCE8V`oӷE#DLOJ'CG2ڇ*<$֑/GM\kY (l-<%H4Vܶ$c [~X\%;mR'{Un2wmY%F76K^ )]MɎyTŗ[;VTaå!gIq0gy:]vƇSUh@7ߘ,&1yØ'uk3v)%2$Vy,l YH"&wF:& 12~dq. tjXkN';kg)dHź?;o޼"IOwߵ&Ct0hƪ_M8pBDqPYMߥ.Z?r2QB]wbږHqUNsf/}[;qAy8c'ֹ.lkɶ# TiF*&H?9J$_lbgkB}؋- 3F[nd,: í"Jz\{fc|_9>L/ӕ!Oebj{IG_}19$-{kg;r9ǏxCer: n{n9MMBumcN.0Q7o&6C؏ Lk };%/|l׈pjξ}+<8u{a,&?1ٵԬ`gl=xL^^ ](Z7 :m/]MKI4뿊MBFatpey[ix![ز~:ai˦:X ct3!M;w܃ٷS~sش% [u:] +;U씭8+jvUhҝ/89r8=!NPCPFd-dx5b (,t` (X@ @P:Ё,t` (X@ @P:Ё?\{> A< s^n3 /kW0&SIENDB`modsecurity-apache_2.7.7/iis/ModSecurityIIS/ModSecurityIIS/installer project/app.config0000664000175000017500000000016512243422537031450 0ustar zimmerlezimmerle ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmodsecurity-apache_2.7.7/iis/ModSecurityIIS/ModSecurityIIS/installer project/ModSecurityConfigurator.csmodsecurity-apache_2.7.7/iis/ModSecurityIIS/ModSecurityIIS/installer project/ModSecurityConfigurator0000664000175000017500000003224712243422537034264 0ustar zimmerlezimmerleusing System; using System.Collections.Generic; using System.Text; using System.IO; using System.Xml; using AppHostAdminLibrary; using System.Runtime.InteropServices; namespace configure { public class ModSecurityConfigurator { public void Install(string installDir) { if (installDir.EndsWith("\"")) { installDir = installDir.Substring(0, installDir.Length - 1); } if (installDir.StartsWith("\"")) { installDir = installDir.Substring(1); } Console.WriteLine("Copying 32-bit binaries..."); string dstpath = Environment.ExpandEnvironmentVariables("%windir%\\SysWow64"); if (!Directory.Exists(dstpath)) dstpath = Environment.ExpandEnvironmentVariables("%windir%\\system32"); CopyBinaries(Path.Combine(installDir, "x86"), Path.Combine(dstpath, "inetsrv")); dstpath = Environment.ExpandEnvironmentVariables("%windir%\\SysNative"); if (Directory.Exists(dstpath)) { Console.WriteLine("Copying 64-bit binaries..."); CopyBinaries(Path.Combine(installDir, "amd64"), Path.Combine(dstpath, "inetsrv")); } string text = Path.Combine(installDir, "ModSecurity.xml"); string text2 = null; IntPtr zero = IntPtr.Zero; try { bool flag = false; if (Wow64Redirection.IsWow64Process(new IntPtr(-1), out flag) && flag) { Wow64Redirection.Wow64DisableWow64FsRedirection(out zero); } if (!File.Exists(text)) { throw new FileNotFoundException("The specified schema file does not exist", text); } Console.WriteLine("Installing schema file: " + text); text2 = Path.Combine(Environment.ExpandEnvironmentVariables("%windir%\\system32\\inetsrv\\config\\schema\\"), Path.GetFileName(text)); if (!text2.Equals(text, StringComparison.InvariantCultureIgnoreCase)) { File.Copy(text, text2, true); Console.WriteLine("Installed schema file: " + text2); } else { Console.WriteLine("Schema file is already in the destination location."); } } finally { if (IntPtr.Zero != zero) { Wow64Redirection.Wow64RevertWow64FsRedirection(zero); } } SectionList configurationSections = GetConfigurationSections(text2); RegisterConfigurationSections(configurationSections, false); Console.WriteLine("Finished"); } /* add specific cleanup logic here (basically mirror install) * No need to clean Program Files or other aspects of install, just revert the things you manually modified in Install() */ public void Uninstall() { } private SectionList GetConfigurationSections(string schemaPath) { XmlDocument xmlDocument = new XmlDocument(); xmlDocument.Load(schemaPath); SectionList sectionList = new SectionList(); XmlElement documentElement = xmlDocument.DocumentElement; foreach (XmlNode xmlNode in documentElement.ChildNodes) { if (xmlNode.LocalName.Equals("sectionSchema", StringComparison.InvariantCultureIgnoreCase)) { sectionList.Add(new SectionDefinition(xmlNode.Attributes["name"].Value)); } } return sectionList; } private static SectionList GetConfigurationSections(string sectionGroupName, IAppHostSectionGroup sectionGroup) { SectionList sectionList = new SectionList(); string text = string.IsNullOrEmpty(sectionGroupName) ? sectionGroup.Name : (sectionGroupName + "/" + sectionGroup.Name); for (uint num = 0u; num < sectionGroup.Count; num += 1u) { IAppHostSectionGroup sectionGroup2 = sectionGroup[num]; SectionList configurationSections = GetConfigurationSections(text, sectionGroup2); sectionList.AddRange(configurationSections); } IAppHostSectionDefinitionCollection sections = sectionGroup.Sections; for (uint num2 = 0u; num2 < sections.Count; num2 += 1u) { IAppHostSectionDefinition appHostSectionDefinition = sections[num2]; sectionList.Add(new SectionDefinition(string.IsNullOrEmpty(text) ? appHostSectionDefinition.Name : (text + "/" + appHostSectionDefinition.Name), (AllowDefinition)Enum.Parse(typeof(AllowDefinition), appHostSectionDefinition.AllowDefinition, true), (OverrideModeDefault)Enum.Parse(typeof(OverrideModeDefault), appHostSectionDefinition.OverrideModeDefault, true), appHostSectionDefinition.Type)); } return sectionList; } private static bool RegisterConfigSection(IAppHostWritableAdminManager adminManager, SectionDefinition sectionDefinition, string sectionName, IAppHostSectionGroup sectionGroup, bool remove) { string text = null; string sectionName2 = sectionName; int num = sectionName.IndexOf('/'); if (num >= 0) { text = sectionName.Substring(0, num); sectionName2 = sectionName.Substring(num + 1, sectionName.Length - num - 1); } if (text != null) { uint count = sectionGroup.Count; for (uint num2 = 0u; num2 < count; num2 += 1u) { IAppHostSectionGroup appHostSectionGroup = sectionGroup[num2]; if (appHostSectionGroup.Name.Equals(text, StringComparison.InvariantCultureIgnoreCase)) { return RegisterConfigSection(adminManager, sectionDefinition, sectionName2, appHostSectionGroup, remove); } } if (remove) { return false; } IAppHostSectionGroup sectionGroup2 = sectionGroup.AddSectionGroup(text); return RegisterConfigSection(adminManager, sectionDefinition, sectionName2, sectionGroup2, remove); } else { IAppHostSectionDefinitionCollection sections = sectionGroup.Sections; bool flag = false; uint count2 = sections.Count; for (uint num3 = 0u; num3 < count2; num3 += 1u) { IAppHostSectionDefinition appHostSectionDefinition = sections[num3]; if (appHostSectionDefinition.Name.Equals(sectionName, StringComparison.InvariantCultureIgnoreCase)) { flag = true; break; } } if (!flag) { if (remove) { return false; } IAppHostSectionDefinition appHostSectionDefinition2 = sections.AddSection(sectionName); appHostSectionDefinition2.OverrideModeDefault = sectionDefinition.OverrideModeDefault.ToString(); appHostSectionDefinition2.AllowDefinition = sectionDefinition.AllowDefinition.ToString(); appHostSectionDefinition2.Type = sectionDefinition.Type; return true; } else { if (remove) { try { IAppHostElement adminSection = adminManager.GetAdminSection(sectionName, "MACHINE/WEBROOT/APPHOST"); adminSection.Clear(); } catch (Exception) { } sections.DeleteSection(sectionName); return true; } return false; } } } private void RegisterConfigurationSections(SectionList sectionList, bool remove) { IAppHostWritableAdminManager appHostWritableAdminManager = new AppHostWritableAdminManagerClass(); appHostWritableAdminManager.CommitPath = "MACHINE/WEBROOT/APPHOST"; IAppHostConfigManager configManager = appHostWritableAdminManager.ConfigManager; IAppHostConfigFile configFile = configManager.GetConfigFile("MACHINE/WEBROOT/APPHOST"); IAppHostSectionGroup rootSectionGroup = configFile.RootSectionGroup; foreach (SectionDefinition current in sectionList) { if (RegisterConfigSection(appHostWritableAdminManager, current, current.Name, rootSectionGroup, remove)) { if (remove) { Console.WriteLine("Unregistered section: " + current.Name); } else { Console.WriteLine("Registered section: " + current.Name); } } else { if (remove) { Console.WriteLine("Section not currently registered, ignoring: " + current.Name); } else { Console.WriteLine("Section already registered, ignoring: " + current.Name); } } } appHostWritableAdminManager.CommitChanges(); } internal class Wow64Redirection { [DllImport("Kernel32.dll", CharSet = CharSet.Auto)] public static extern bool IsWow64Process(IntPtr hProcess, out bool isWow64); [DllImport("Kernel32.dll", CharSet = CharSet.Auto)] public static extern bool Wow64DisableWow64FsRedirection(out IntPtr oldValue); [DllImport("Kernel32.dll", CharSet = CharSet.Auto)] public static extern bool Wow64RevertWow64FsRedirection(IntPtr oldValue); } private void CopyBinaries(string srcpath, string dstpath) { string[] files = { "libapr-1.dll", "libapriconv-1.dll", "libaprutil-1.dll", "libxml2.dll", "lua5.1.dll", "pcre.dll", "zlib1.dll", "ModSecurityIIS.dll" }; foreach (string s in files) File.Copy(Path.Combine(srcpath, s), Path.Combine(dstpath, s), true); } public enum AllowDefinition { MachineOnly, MachineToWebRoot, MachineToApplication, AppHostOnly, Everywhere } public enum OverrideModeDefault { Allow, Deny } public class SectionDefinition { public const AllowDefinition DefaultAllowDefinition = AllowDefinition.Everywhere; public const OverrideModeDefault DefaultOverrideModeDefault = OverrideModeDefault.Allow; private string name; private AllowDefinition allowDefinition; private OverrideModeDefault overrideModeDefault; private string type; public string Name { get { return this.name; } } public AllowDefinition AllowDefinition { get { return this.allowDefinition; } } public OverrideModeDefault OverrideModeDefault { get { return this.overrideModeDefault; } } public string Type { get { return this.type; } set { this.type = value; } } public SectionDefinition(string sectionName) : this(sectionName, AllowDefinition.Everywhere, OverrideModeDefault.Allow, null) { } public SectionDefinition(string sectionName, AllowDefinition allowDefinition, OverrideModeDefault overrideModeDefault, string type) { this.name = sectionName; this.allowDefinition = allowDefinition; this.overrideModeDefault = overrideModeDefault; this.type = type; } } internal class SectionList : List {} } } modsecurity-apache_2.7.7/iis/ModSecurityIIS/ModSecurityIIS/installer project/configure.csproj.user0000664000175000017500000000073612243422537033665 0ustar zimmerlezimmerle publish\ en-US false modsecurity-apache_2.7.7/iis/ModSecurityIIS/ModSecurityIIS/installer project/configure.csproj0000664000175000017500000001716212243422537032711 0ustar zimmerlezimmerle Debug x86 8.0.30703 2.0 {023E10BD-4FF6-4401-9A40-AED9717073F2} WinExe Properties configure configure v2.0 512 publish\ true Disk false Foreground 7 Days false false true 0 1.0.0.%2a false false true x86 true full false bin\Debug\ DEBUG;TRACE prompt 4 x86 pdbonly true bin\Release\ TRACE prompt 4 true bin\x64\Debug\ DEBUG;TRACE full x64 bin\Debug\ModSecurityIIS Installer.exe.CodeAnalysisLog.xml true GlobalSuppressions.cs prompt MinimumRecommendedRules.ruleset ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets false ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules false bin\x64\Release\ TRACE true pdbonly x64 bin\Release\ModSecurityIIS Installer.exe.CodeAnalysisLog.xml true GlobalSuppressions.cs prompt MinimumRecommendedRules.ruleset ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets false ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules false false configure.Program true ResXFileCodeGenerator Resources.Designer.cs Designer True Resources.resx True SettingsSingleFileGenerator Settings.Designer.cs True Settings.settings True {598F9C7D-D2D7-4980-B234-F1E753CD9FD9} 1 0 0 tlbimp False True False .NET Framework 3.5 SP1 Client Profile false False .NET Framework 3.5 SP1 true False Windows Installer 3.1 true modsecurity-apache_2.7.7/iis/ModSecurityIIS/ModSecurityIIS/ModSecurityLogo.bmp0000664000175000017500000031513612243422537027654 0ustar zimmerlezimmerleBM^6(F(tt?ooo?O?O/???OOO?ooo????????_????????????????ۏ??????___?///?___O?O????modsecurity-apache_2.7.7/iis/ModSecurityIIS/ModSecurityIIS/ModSecurityLogo.ico0000664000175000017500000002333412243422537027644 0ustar zimmerlezimmerlePNG  IHDRBsRGBgAMA a pHYs+tEXtSoftwareAdobe ImageReadyqe<&LIDATx^] U߿y JQTdV _=1$<"dTz !Xdl5]ss_u]9g^g^{sb|qsW^q+СC;)9bz3ovc5 n^\נdfWx f9N@V4fg9 FY i ,,ǫoJ/SSg@;wr`6kbfWo5ִּ]Y -Á1PL:.{Rys~⡕-&զ fEL"UPLO]6^́3g(nNz]W;k9t估)}R膻+qY7lw=ah :=z~`lYt*+gת.g5lr`/@of{?ž+WJ1|AIҥK_ U Vq[sc͹f\ v&#qX1f#X(?G揪_=Ce˦`غuiڴ;Қ뮻,Z(%m-3iyw; $ ~kb(g~9jٲ;wiӦ3gNh#aG>|x"]͚5#i \ׯώkp;v E_reC{f@iN|gYNmh,֯mLG*>>LQ@{݋]TbF0ښL_""T0QV Q{Gj3W0mϞ=pڰ`)G*]t`=z$2˗/7+V0˖-3P#Qm# tCJW[5a93-Yщ! |j ?:AX*fY*o>6F^'O1m6S?zdY\=v~s1omzƱW)eמ&6ە+.u5bJr2 jLjp$?)?& 㶞H>H}GvLf7o^R> žS1CMaa?0 9r1Svɓ'G\Fcџ*EJ˿uf|x\4TmSoNB<`LnkRApoMKu O_%.M=ěI9xS[gnôӺߦ*kyETO?& n!eھ,)\A'fz[ކ8 a`wyaztujQhQՋ ?~|uo[yСCzsR;Am-Тۋ?u9::saZ#lδYP]$15]#8ˠ *50 o4Ue?B,Ys856txEX*zYˑ6\s8 2fΜNs4%Kghuatٻ1:G*nN(addpW!(Nʑ9猸zRF?`ps`[-̶UYˎCV4r*7@m_tr /VP}b06ژt" P Ep"9*|'I6l|͟?_y$RpQK@K{#& C1G`_o-o5+#E(,.E.u~<.XGDCʻB9Zxy5z+ s ; <Aۑ |c3!XcLsM Q <[׋ Pt kԨd} RqӰA|ԥΞ;`1aݍΔB^Ssvju,SDRd?Ax5 N@k]-.0? yht~֧rt4`;mesBzS % (S&oA /o:ŽeKꚺ7]AP<75\Ɵ}__g!:?&\"W;<܏eBgUعrI{%CcYr*/i,^Ld` =xf oߠT_l&@q|yd#96n | Xf>nDc.PVmxF"Z  # ھK0؜)dܚD9@TК"(d8 Ѓ?[j%vR7:`PeW*fv(#~7JZAE OZ6#nelTnJq"l!wvm޴-~< JHgsGlt.P]q7qSA8:.!SyӑA/)7S Ɉ4YD_ 0@ Hl ,’,ce;%AoVO888AY7 {gDo>;Ko77mA^~WBCuWם.XBÑӸ 5dx0"Ovip30Q0 yD4QmiPBܮIYˁ)}.hq+n!O= ~%o L嗧?s0 qn 51]}A>'m2tN»#xitx臥l#A2F8d tq@bPНLa& ]gyi >tV${ oN=TSO ?3M7G9D^xa`z9-<ۀD FR>:ch=}t/"s9c:B }?t{ͥLA'!PhI?n!=p3–ؑӀ8!/x~Vs)ι;+1b<ѐ5; (w7FS }eZry {JpkLL{T\~\ќJ((1vv # h6m ,wΡCPaۜ \Wك2s|6/YCVO{E=+e خ'4Lp+~Mf tIqw$! ,{\ڣ1dhZW!dBĎLo;Bϣ˭\\3yYs]{0VA7t ߢ/k1McK=ʠm<#[*Hhض`W=d6I$8݀YpQfk`0ӾbRgY_u6tPsMm>3/cjp:Z$ZkzAD蔵1v~>AaF |IТJ@=6O!_ ဗ@$_ڄK-A?sJ*r_Aу]VN Y`8;#2Id~Miy1OO ͏a-4Dԡ;s"ڨ&O sK" 7 uƀv1?4B[[y$qX6hi<3 )!d!m qۃ4rϱɊy1 $_U;T\te]&y„Q;:pUW9|M x#B֍h\cb09 %y\ۨx 6n9KET=iMDp3%1<+E 7}vb3<$)X[D}|’@k =|ϛhϮd6I%B)ƟG9t%Cv y5ilj\qz/|m 18ʉ?lrss ]emy`ggP#k>KC R?O7r x@< c̀Zjv:& PQsVw 4h _HZƨ (xV@<3: _]Pȃ 4PFuısY~ F4( 9NDm;~c\ WV @s'exbZ:˩t) f *APYa̳djˠLvoޔ*٦HH>-2̀ ;c^ah@zazҽz~fL@ZtO?dј ʕszgȤ̂ԓu`ع+N>04;}=l.Euf-{ؖv^|GnnZ4۷Hwœ9s̿/}˗G$Ly' MmD~ļs`]AJZhHF@&}٤d/bli|C+0v[hް&L~$%NF]jڴiX{MQ>l0%\Jg_htjOXIo_HXTQ?Rl)]wݕ4)Hb4#a֬Y ^;3JkY:K?R>8;L>i@ӣJ>j>; ]iFVp퇴"hy ={{`i".CIa9DzN?,eiH櫯Jn:<㎓-щ堑 iӦ%:Ap ̘1# wVe9eD[ ߖSL:p"AދZ@"_/}_OLMG Ħe2*/ qCPqVZ%Ӗ]tIzצCwursjv=ZA}O9#8s$/i$p{~᥁vE}ݤl;L{&Ӽ|0|$\ԪIBL,W_M웗gPt ơF.h9)hr.NOX74ܤVUuM#5QE%tH ^5Qq*oFe1[$%44IC'OlcZYt'SKl߈S&φЩ0V0}j攙#SZ֟ѩ(CXĴxbDG& crKR~x-P Q;VԸqcKjQҋF?/`u$Q.8I;u3]`Lӻ{}1ͥt#<"i!ϼ;A@wfSB?Ƹ0/17aL4 _bN{,Y+C~|औ9_&޳@}礇4򞍈AhU(ņIF )Y;/ iYnsBMO; 4v,0BSC9/P^<`GQK8w7 0J$J+7tp t5xyOGBxDו9pU?d KB#z27LbB(@t5>δY*{Z޽@N0`C WCB!9  &(xM(FW¸@x6+  HPՍ԰㴃dZ@UQ4rk˖Hk75䀭cP{aƵ}]csBdʒTfsIcOi IENDB`modsecurity-apache_2.7.7/iis/ModSecurityIIS/ModSecurityIIS.sln0000664000175000017500000000607012247774714024607 0ustar zimmerlezimmerle Microsoft Visual Studio Solution File, Format Version 11.00 # Visual Studio 2010 Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "ModSecurityIIS", "ModSecurityIIS\ModSecurityIIS.vdproj", "{3352AEF1-9F2A-47CD-9F63-658553063040}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Installer", "Installer\Installer.vcxproj", "{990BB195-6716-4DE3-B5E4-DCFCB1BD7D9C}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Mixed Platforms = Debug|Mixed Platforms Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 Debug|x86 = Debug|x86 Release|Mixed Platforms = Release|Mixed Platforms Release|Win32 = Release|Win32 Release|x64 = Release|x64 Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {3352AEF1-9F2A-47CD-9F63-658553063040}.Debug|Mixed Platforms.ActiveCfg = Debug {3352AEF1-9F2A-47CD-9F63-658553063040}.Debug|Mixed Platforms.Build.0 = Debug {3352AEF1-9F2A-47CD-9F63-658553063040}.Debug|Win32.ActiveCfg = Debug {3352AEF1-9F2A-47CD-9F63-658553063040}.Debug|Win32.Build.0 = Debug {3352AEF1-9F2A-47CD-9F63-658553063040}.Debug|x64.ActiveCfg = Debug {3352AEF1-9F2A-47CD-9F63-658553063040}.Debug|x64.Build.0 = Debug {3352AEF1-9F2A-47CD-9F63-658553063040}.Debug|x86.ActiveCfg = Debug {3352AEF1-9F2A-47CD-9F63-658553063040}.Debug|x86.Build.0 = Debug {3352AEF1-9F2A-47CD-9F63-658553063040}.Release|Mixed Platforms.ActiveCfg = Release {3352AEF1-9F2A-47CD-9F63-658553063040}.Release|Mixed Platforms.Build.0 = Release {3352AEF1-9F2A-47CD-9F63-658553063040}.Release|Win32.ActiveCfg = Release {3352AEF1-9F2A-47CD-9F63-658553063040}.Release|Win32.Build.0 = Release {3352AEF1-9F2A-47CD-9F63-658553063040}.Release|x64.ActiveCfg = Release {3352AEF1-9F2A-47CD-9F63-658553063040}.Release|x64.Build.0 = Release {3352AEF1-9F2A-47CD-9F63-658553063040}.Release|x86.ActiveCfg = Release {3352AEF1-9F2A-47CD-9F63-658553063040}.Release|x86.Build.0 = Release {990BB195-6716-4DE3-B5E4-DCFCB1BD7D9C}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 {990BB195-6716-4DE3-B5E4-DCFCB1BD7D9C}.Debug|Mixed Platforms.Build.0 = Debug|Win32 {990BB195-6716-4DE3-B5E4-DCFCB1BD7D9C}.Debug|Win32.ActiveCfg = Debug|Win32 {990BB195-6716-4DE3-B5E4-DCFCB1BD7D9C}.Debug|Win32.Build.0 = Debug|Win32 {990BB195-6716-4DE3-B5E4-DCFCB1BD7D9C}.Debug|x64.ActiveCfg = Debug|Win32 {990BB195-6716-4DE3-B5E4-DCFCB1BD7D9C}.Debug|x86.ActiveCfg = Debug|Win32 {990BB195-6716-4DE3-B5E4-DCFCB1BD7D9C}.Release|Mixed Platforms.ActiveCfg = Release|Win32 {990BB195-6716-4DE3-B5E4-DCFCB1BD7D9C}.Release|Mixed Platforms.Build.0 = Release|Win32 {990BB195-6716-4DE3-B5E4-DCFCB1BD7D9C}.Release|Win32.ActiveCfg = Release|Win32 {990BB195-6716-4DE3-B5E4-DCFCB1BD7D9C}.Release|Win32.Build.0 = Release|Win32 {990BB195-6716-4DE3-B5E4-DCFCB1BD7D9C}.Release|x64.ActiveCfg = Release|Win32 {990BB195-6716-4DE3-B5E4-DCFCB1BD7D9C}.Release|x86.ActiveCfg = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal modsecurity-apache_2.7.7/iis/ModSecurity.xml0000664000175000017500000000055612243422537021422 0ustar zimmerlezimmerle modsecurity-apache_2.7.7/iis/wix/0000775000175000017500000000000012253711345017231 5ustar zimmerlezimmerlemodsecurity-apache_2.7.7/iis/wix/dialog.jpg0000664000175000017500000002771012253711345021201 0ustar zimmerlezimmerleJFIFCC8  ٽELg$`Qb~7x6;qܜj@Q0SD+M3"Hp$U0L&7I3XR$` A2f8'T79Gm9*wdI)81:oyMu+W}CmVn Ppngi>byoI雏\af㧲bQwo펟ߺϙ}D'P7„uH #,*GXXab2eH(_gUVE`% K_K_K_K_K_K_k_k_k_k_k_k_k.{kMqIkK%IkIkIkIkIkIkIkIkIkIkI`Q\QxJ+V(QXC*uɺ*ӴqopSwY1OD *kER.*S i`'Lr1c C cxaC;[ۀ}?mŭcK0=tˬшhrRxn5~B9Uo%YdeƸ%O&ĩ31 ET"gISY94D_~#{zBN|kg}nl[W?>r'[tpB"uw?.r'[s""u?.r'[sp#"uW?>r'[sC"uW?>r'[sp#"uW/.r'[spC"u7>r'[spC"uw7>r'[spC"uw7>n'[ aܹ|N7D,KCN2'ov7C_Dcp~|N¹!=_\ȝln\ȝln 3ȝln ȝln \ȝln]ȝl-sB"uG.r'[s"O{B]^2'[x /όhL%vȝl.\N;xsEcۧ9.\N;8s:^5W=ֵsj&j⪾*4bfG+ =f\nsu433L"vڣvnEۋkl5K=\||c8c` 7h7=jf`G Ӏ0^#'yf1UL,|1ܳLy_3g㊄[]IQ.:(a-R,f%[(^axH܆&R* Ik&qjxXFBEtkm;I,Ly\"ڟ5S(R(ѧU([qS+c̲[V 8'mIx]-rjUnT_F2jT$ ʵ5@=Y`R;i^+ܵE >d:ۂ[ʁC{%Eu]'`5ISZ4zdS\Cʕ5Ricr*2KvrH$F5s趣b4RT;:H{CAYL`fSC1DBC#d<!U)*?pwQ0lk: Q]vBok" 6OG ]RW5g4SM:9T)І2Mx%&},WQ*$=b7<܊4}oV{‡q25}*<ѠIvɶW6Y{L= ׭2b)Cp_fƧkSk5ND-CݫRߡ+Fiq+e7N١'f?7k湪SJV_emq2i .1*rḦ́LE v][J *4BBHq$ͣ)kYRM9K$ vhM}52@IP-~ߦTYKHXX Ls5s=9]0hH|aϯO,.ϯO,.>}hS}_?,_X:/{1[{؎z3t{Tunb9-нG=Sźc8BLg^# s1_{؎z3tO{tunb9-нG=Sźc:BK^# s1[{َzs/{Tqnb-źc8BLx~BL^#s3[{؎{3/{tu~b9ίнG=9պc:@LgWv#s1_{؎{3t/{tq~b9-нG=źc:@kb|[{9-=G=!{؎{3yd^?XV#)s1[{؎|t{ϔunb9έ=G>Rպ,8-"ËH,8-"ËH,8-"ËH,8-"ËH,8-"ËH,8-"ËH,8-"ËH,8-"ËH,8-"ËH,8-"ËH,8-"ËH,8-"ËH,8-"ËH,8-"ËH,8-"ËH,8/0J""qEd J{*5vN6cq7 n/mfl^&C"e)J"?AQ#j&t/9LC|%0"a4ZB~e(13HD */VPs^QS jg+YH›WzR%`H)|&H~%I%fLWl`:hyTS?\fKH꡷ؕ aMR%f;ge)n4A\#gk2:{*BE"&6Zd,dt&|+*-)NܢR쩒ငn(2wUww`9SJ2hS.t13wE0)T6M]Hj %sw;hؗe)]%R2u^R7-<].=rvbQ!prqSDL[]Pjwu*#q'%lh6:" }J Sɛ•}95ӳBL%ÄDPYDVI C*xМVމњG)(jثTsHrab*!b?=Ӊћ]pɢ&p;jm(mc?B 5!1"2AQTa#$%34PqCDSUdv?}90:_uLWxguLYcx}90:gwLYG_+VONJ䩣>ze9dO.;r(f"j;r(f"j;r(f"j;r(f"j;r(f"j;r(f"j;r(f"j;r(f"j;r(f"j;r(f¯F]yGQGy'FnEoݧO54oϻ7Y1ȣz99Gͪlȣu7Y1cu7Y1ȣu7Yqȣu7Y1ȣu7Y1ȣu7Y1ȣutQ抟lu 7yxo'jj>il__Tqf"j;r8f"j;r8f#j;*5X|τH#Ld:(k65&6W 0HiQ=csU5UT8 ]nHdr;}hKc6H>+d-ĐR3 m3nΟ =(!1AQaqP 0@?!Y<lH,xˏ؆^vBcK|zwx= ][ǀs`/̼{l}%6 ~dXz>6!?=Dɘ֡*lC{7X4 ( hc7lo)yK^R򗔼/)yK^R򗔼/)yK^R򗔼/)yK^R򗔼/)yK^R򗔼/)yK^R򗔼/)yK^R򗔼/)yK^R/|qaVdn00PuZZ®GKG.Qrm8E06@d,XXb`@Gv̰ zs("(hHSѐ&lGqoF>EͱhJ&*GD yݱ pKO&`q0 r Pin ` d@ D6hDG֔ Re{Y9F4L%щ`'@_$v 7L$Wj.f8$g!0'[%^LR/Aαd ~0F>dRr_Psc\ћ7 0iĥSk8@ߐbXJXB ).q#AV4 r*_ {12se4N- 6mmmmmmm`ĩ$O@qTǐ'!1AQaq P?[+ނ辅˅ye=ջXCv]Bx_&`-Hʙ`t[C mu fkBtK訦hjmQjn҃8kQ9*kj>*?= G7`2~j%6V{|1 jKyQ-w |:Kn˵I5I>Ǡpƹ=[$dUYA t+ '`3$`AC( ~DK"1'2lD7k[&-ygI*'rP^B`M)Q]Bh*r{= BA38`ȕb.JͧGjKD(H&N?%&vz+P)qՏ m(s@L(Fa$au˞;)x [Ф!HR#*s;Q;H.W$4^&i#`=lP6jv\2K*uR{f{U kJ$d"E ¤d$VD!S.f%WaR4p愕 D]8r o~hԔG(a!1qQA Pᐠ? @_6^{<'M@!ܞ;;*v /b s^"`j9vY_<w%'߅jVbt?b5 T8"o7\A^W.ώ+JD{l_T*Wv%zh˥XIi2>>:pU\cQM?t*,`&Y@d])IU ǶC]P$wSbS@dj:?{V|ݟm8yʟʟʟʟʟʟʟʟʟʟʟʟʟʟʟʟʟʟʟʟʟʟʟʟʟʟʟʟʟʟʟ'狀@uA%BK{OEA hF l =q,$XbHs ǵL.`Ab j1VeYJЃO^@LTA ?T'`0δ9j5.(1FIr Kh`Sǥu" f;CHPz$r#6(,j.# cp8I;>t6eZU (j /LKQ! A[&9j!(hknmU`"Mc䑕n\Ř~`)#[܎(׌$QH)!a1AQqP?!? }G*wd} gWWI{ۊ}4KoZw-EK"6L@b{Дisx.gzE&*G(=zd((Sdz-(_/B5#t:*no"<\S@4cab0@B( w*޻ 5 A P%q8XA T B@+@ = ynTx1{q8]ڂq0wQ q f@2 E HK%3r(5&$!X(]A 2!".Pz@@8rj9BAo^ &=qBnZ\(eWljM]Q5v&D(eWljM]Q5v&D(eWljM]Q5v&D(eWljM]Q5v&D(eWljM]Q5v&D(eWljM]Q5v&D(eWljM]Q5v&D(eWljM][{:Ȁ|x}G!%1 :l (!D QH`(D#]%F)F?)?ZGB#L&nq@ܩ+A~#J9a80q̀*`b2$Xc8 H!H!,*r'p=Pnynh(*BPP }Ghé~"b_ ɪzyzrO5)tEx椅15b6L"}6G6 PȘ@.+β(1BU'B~Ӎ&{8 E@Aʳ_AP W~Fxޛx Q?If"W_SCKjR88/ ^lt !&S8AqBnkL_= 6ב \!)2modsecurity-apache_2.7.7/iis/wix/modsecurity_iis.conf0000664000175000017500000000014312253711345023311 0ustar zimmerlezimmerleInclude modsecurity.conf Include modsecurity_crs_10_setup.conf Include owasp_crs\base_rules\*.conf modsecurity-apache_2.7.7/iis/wix/EULA.rtf0000664000175000017500000002314512253711345020501 0ustar zimmerlezimmerle{\rtf1\ansi\ansicpg1252\deff0\deflang1033\deflangfe1033{\fonttbl{\f0\froman\fprq2\fcharset0 Times New Roman;}{\f1\fswiss\fprq2\fcharset0 Calibri;}} {\colortbl ;\red0\green0\blue255;} {\*\generator Msftedit 5.41.21.2510;}\viewkind4\uc1\pard\sb100\sa100\lang9\f0\fs24 Apache License\line\line Version 2.0, January 2004\line\line\pard{\field{\*\fldinst{HYPERLINK "http://www.apache.org/licenses/"}}{\fldrslt{\ul\cf1 http://www.apache.org/licenses/}}}\f0\fs24 \par TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\par \b 1. Definitions\b0 .\par "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.\par "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.\par "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.\par "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.\par "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.\par "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.\par "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).\par "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.\par "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."\par "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.\par \b 2. Grant of Copyright License\b0 . Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.\par \b 3. Grant of Patent License\b0 . Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.\par \b 4. Redistribution\b0 . You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:\par \pard\fi-360\li720\sb100\sa100\tx720 1.\tab You must give any other recipients of the Work or Derivative Works a copy of this License; and\par \pard\fi-360\li720\sb100\sa100 2.\tab You must cause any modified files to carry prominent notices stating that You changed the files; and\par 3.\tab You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and\par 4.\tab If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.\par \pard\sb100\sa100\b 5. Submission of Contributions\b0 . Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.\par \b 6. Trademarks\b0 . This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.\par \b 7. Disclaimer of Warranty\b0 . Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.\par \b 8. Limitation of Liability\b0 . In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.\par \b 9. Accepting Warranty or Additional Liability\b0 . While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.\par END OF TERMS AND CONDITIONS\par \pard\sa200\sl276\slmult1\lang1033\f1\fs22\par } modsecurity-apache_2.7.7/iis/wix/README.TXT0000664000175000017500000000122312253711345020565 0ustar zimmerlezimmerlePlease note that installing ModSecurity for IIS requires IIS to be installed and enabled. After installing ModSecurity for IIS, the module will be running in all websites by default. To remove from a website add to web.config: To configure module in a website add to web.config: where configFile is standard ModSecurity config file. Events from the module will show up in "Application" Windows log. modsecurity-apache_2.7.7/iis/wix/modsecurity_crs_10_setup.conf0000664000175000017500000003237112253711345025044 0ustar zimmerlezimmerle# --------------------------------------------------------------- # Core ModSecurity Rule Set ver.2.2.6 # Copyright (C) 2006-2012 Trustwave All rights reserved. # # The OWASP ModSecurity Core Rule Set is distributed under # Apache Software License (ASL) version 2 # Please see the enclosed LICENCE file for full details. # --------------------------------------------------------------- # # -- [[ Recommended Base Configuration ]] ------------------------------------------------- # # The configuration directives/settings in this file are used to control # the OWASP ModSecurity CRS. These settings do **NOT** configure the main # ModSecurity settings such as: # # - SecRuleEngine # - SecRequestBodyAccess # - SecAuditEngine # - SecDebugLog # # You should use the modsecurity.conf-recommended file that comes with the # ModSecurity source code archive. # # Ref: http://mod-security.svn.sourceforge.net/viewvc/mod-security/m2/trunk/modsecurity.conf-recommended # # # -- [[ Rule Version ]] ------------------------------------------------------------------- # # Rule version data is added to the "Producer" line of Section H of the Audit log: # # - Producer: ModSecurity for Apache/2.7.0-rc1 (http://www.modsecurity.org/); OWASP_CRS/2.2.4. # # Ref: https://sourceforge.net/apps/mediawiki/mod-security/index.php?title=Reference_Manual#SecComponentSignature # SecComponentSignature "OWASP_CRS/2.2.6" # # -- [[ Modes of Operation: Self-Contained vs. Collaborative Detection ]] ----------------- # # Each detection rule uses the "block" action which will inherit the SecDefaultAction # specified below. Your settings here will determine which mode of operation you use. # # -- [[ Self-Contained Mode ]] -- # Rules inherit the "deny" disruptive action. The first rule that matches will block. # # -- [[ Collaborative Detection Mode ]] -- # This is a "delayed blocking" mode of operation where each matching rule will inherit # the "pass" action and will only contribute to anomaly scores. Transactional blocking # can be applied # # -- [[ Alert Logging Control ]] -- # You have three options - # # - To log to both the Apache error_log and ModSecurity audit_log file use: "log" # - To log *only* to the ModSecurity audit_log file use: "nolog,auditlog" # - To log *only* to the Apache error_log file use: "log,noauditlog" # # Ref: http://blog.spiderlabs.com/2010/11/advanced-topic-of-the-week-traditional-vs-anomaly-scoring-detection-modes.html # Ref: https://sourceforge.net/apps/mediawiki/mod-security/index.php?title=Reference_Manual#SecDefaultAction # SecDefaultAction "phase:1,deny,log" # # -- [[ Collaborative Detection Severity Levels ]] ---------------------------------------- # # These are the default scoring points for each severity level. You may # adjust these to you liking. These settings will be used in macro expansion # in the rules to increment the anomaly scores when rules match. # # These are the default Severity ratings (with anomaly scores) of the individual rules - # # - 2: Critical - Anomaly Score of 5. # Is the highest severity level possible without correlation. It is # normally generated by the web attack rules (40 level files). # - 3: Error - Anomaly Score of 4. # Is generated mostly from outbound leakage rules (50 level files). # - 4: Warning - Anomaly Score of 3. # Is generated by malicious client rules (35 level files). # - 5: Notice - Anomaly Score of 2. # Is generated by the Protocol policy and anomaly files. # SecAction \ "id:'900001', \ phase:1, \ t:none, \ setvar:tx.critical_anomaly_score=5, \ setvar:tx.error_anomaly_score=4, \ setvar:tx.warning_anomaly_score=3, \ setvar:tx.notice_anomaly_score=2, \ nolog, \ pass" # # -- [[ Collaborative Detection Scoring Threshold Levels ]] ------------------------------ # # These variables are used in macro expansion in the 49 inbound blocking and 59 # outbound blocking files. # # **MUST HAVE** ModSecurity v2.5.12 or higher to use macro expansion in numeric # operators. If you have an earlier version, edit the 49/59 files directly to # set the appropriate anomaly score levels. # # You should set the score to the proper threshold you would prefer. If set to "5" # it will work similarly to previous Mod CRS rules and will create an event in the error_log # file if there are any rules that match. If you would like to lessen the number of events # generated in the error_log file, you should increase the anomaly score threshold to # something like "20". This would only generate an event in the error_log file if # there are multiple lower severity rule matches or if any 1 higher severity item matches. # SecAction \ "id:'900002', \ phase:1, \ t:none, \ setvar:tx.inbound_anomaly_score_level=5, \ nolog, \ pass" SecAction \ "id:'900003', \ phase:1, \ t:none, \ setvar:tx.outbound_anomaly_score_level=4, \ nolog, \ pass" # # -- [[ Collaborative Detection Blocking ]] ----------------------------------------------- # # This is a collaborative detection mode where each rule will increment an overall # anomaly score for the transaction. The scores are then evaluated in the following files: # # Inbound anomaly score - checked in the modsecurity_crs_49_inbound_blocking.conf file # Outbound anomaly score - checked in the modsecurity_crs_59_outbound_blocking.conf file # # If you want to use anomaly scoring mode, then uncomment this line. # #SecAction \ "id:'900004', \ phase:1, \ t:none, \ setvar:tx.anomaly_score_blocking=on, \ nolog, \ pass" # # -- [[ GeoIP Database ]] ----------------------------------------------------------------- # # There are some rulesets that need to inspect the GEO data of the REMOTE_ADDR data. # # You must first download the MaxMind GeoIP Lite City DB - # # http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz # # You then need to define the proper path for the SecGeoLookupDb directive # # Ref: http://blog.spiderlabs.com/2010/10/detecting-malice-with-modsecurity-geolocation-data.html # Ref: http://blog.spiderlabs.com/2010/11/detecting-malice-with-modsecurity-ip-forensics.html # #SecGeoLookupDb /opt/modsecurity/lib/GeoLiteCity.dat # # -- [[ Regression Testing Mode ]] -------------------------------------------------------- # # If you are going to run the regression testing mode, you should uncomment the # following rule. It will enable DetectionOnly mode for the SecRuleEngine and # will enable Response Header tagging so that the client testing script can see # which rule IDs have matched. # # You must specify the your source IP address where you will be running the tests # from. # #SecRule REMOTE_ADDR "@ipMatch 192.168.1.100" \ "id:'900005', \ phase:1, \ t:none, \ ctl:ruleEngine=DetectionOnly, \ setvar:tx.regression_testing=1, \ nolog, \ pass" # # -- [[ HTTP Policy Settings ]] ---------------------------------------------------------- # # Set the following policy settings here and they will be propagated to the 23 rules # file (modsecurity_common_23_request_limits.conf) by using macro expansion. # If you run into false positives, you can adjust the settings here. # # Only the max number of args is uncommented by default as there are a high rate # of false positives. Uncomment the items you wish to set. # # # -- Maximum number of arguments in request limited SecAction \ "id:'900006', \ phase:1, \ t:none, \ setvar:tx.max_num_args=255, \ nolog, \ pass" # # -- Limit argument name length #SecAction \ "id:'900007', \ phase:1, \ t:none, \ setvar:tx.arg_name_length=100, \ nolog, \ pass" # # -- Limit value name length #SecAction \ "id:'900008', \ phase:1, \ t:none, \ setvar:tx.arg_length=400, \ nolog, \ pass" # # -- Limit arguments total length #SecAction \ "id:'900009', \ phase:1, \ t:none, \ setvar:tx.total_arg_length=64000, \ nolog, \ pass" # # -- Individual file size is limited #SecAction \ "id:'900010', \ phase:1, \ t:none, \ setvar:tx.max_file_size=1048576, \ nolog, \ pass" # # -- Combined file size is limited #SecAction \ "id:'900011', \ phase:1, \ t:none, \ setvar:tx.combined_file_sizes=1048576, \ nolog, \ pass" # # Set the following policy settings here and they will be propagated to the 30 rules # file (modsecurity_crs_30_http_policy.conf) by using macro expansion. # If you run into false positves, you can adjust the settings here. # SecAction \ "id:'900012', \ phase:1, \ t:none, \ setvar:'tx.allowed_methods=GET HEAD POST OPTIONS', \ setvar:'tx.allowed_request_content_type=application/x-www-form-urlencoded|multipart/form-data|text/xml|application/xml|application/x-amf|application/json', \ setvar:'tx.allowed_http_versions=HTTP/0.9 HTTP/1.0 HTTP/1.1', \ setvar:'tx.restricted_extensions=.asa/ .asax/ .ascx/ .axd/ .backup/ .bak/ .bat/ .cdx/ .cer/ .cfg/ .cmd/ .com/ .config/ .conf/ .cs/ .csproj/ .csr/ .dat/ .db/ .dbf/ .dll/ .dos/ .htr/ .htw/ .ida/ .idc/ .idq/ .inc/ .ini/ .key/ .licx/ .lnk/ .log/ .mdb/ .old/ .pass/ .pdb/ .pol/ .printer/ .pwd/ .resources/ .resx/ .sql/ .sys/ .vb/ .vbs/ .vbproj/ .vsdisco/ .webinfo/ .xsd/ .xsx/', \ setvar:'tx.restricted_headers=/Proxy-Connection/ /Lock-Token/ /Content-Range/ /Translate/ /via/ /if/', \ nolog, \ pass" # # -- [[ Content Security Policy (CSP) Settings ]] ----------------------------------------- # # The purpose of these settings is to send CSP response headers to # Mozilla FireFox users so that you can enforce how dynamic content # is used. CSP usage helps to prevent XSS attacks against your users. # # Reference Link: # # https://developer.mozilla.org/en/Security/CSP # # Uncomment this SecAction line if you want use CSP enforcement. # You need to set the appropriate directives and settings for your site/domain and # and activate the CSP file in the experimental_rules directory. # # Ref: http://blog.spiderlabs.com/2011/04/modsecurity-advanced-topic-of-the-week-integrating-content-security-policy-csp.html # #SecAction \ "id:'900013', \ phase:1, \ t:none, \ setvar:tx.csp_report_only=1, \ setvar:tx.csp_report_uri=/csp_violation_report, \ setenv:'csp_policy=allow \'self\'; img-src *.yoursite.com; media-src *.yoursite.com; style-src *.yoursite.com; frame-ancestors *.yoursite.com; script-src *.yoursite.com; report-uri %{tx.csp_report_uri}', \ nolog, \ pass" # # -- [[ Brute Force Protection ]] --------------------------------------------------------- # # If you are using the Brute Force Protection rule set, then uncomment the following # lines and set the following variables: # - Protected URLs: resources to protect (e.g. login pages) - set to your login page # - Burst Time Slice Interval: time interval window to monitor for bursts # - Request Threshold: request # threshold to trigger a burst # - Block Period: temporary block timeout # #SecAction \ "id:'900014', \ phase:1, \ t:none, \ setvar:'tx.brute_force_protected_urls=/login.jsp /partner_login.php', \ setvar:'tx.brute_force_burst_time_slice=60', \ setvar:'tx.brute_force_counter_threshold=10', \ setvar:'tx.brute_force_block_timeout=300', \ nolog, \ pass" # # -- [[ DoS Protection ]] ---------------------------------------------------------------- # # If you are using the DoS Protection rule set, then uncomment the following # lines and set the following variables: # - Burst Time Slice Interval: time interval window to monitor for bursts # - Request Threshold: request # threshold to trigger a burst # - Block Period: temporary block timeout # #SecAction \ "id:'900015', \ phase:1, \ t:none, \ setvar:'tx.dos_burst_time_slice=60', \ setvar:'tx.dos_counter_threshold=100', \ setvar:'tx.dos_block_timeout=600', \ nolog, \ pass" # # -- [[ Check UTF enconding ]] ----------------------------------------------------------- # # We only want to apply this check if UTF-8 encoding is actually used by the site, otherwise # it will result in false positives. # # Uncomment this line if your site uses UTF8 encoding #SecAction \ "id:'900016', \ phase:1, \ t:none, \ setvar:tx.crs_validate_utf8_encoding=1, \ nolog, \ pass" # # -- [[ Enable XML Body Parsing ]] ------------------------------------------------------- # # The rules in this file will trigger the XML parser upon an XML request # # Initiate XML Processor in case of xml content-type # SecRule REQUEST_HEADERS:Content-Type "text/xml" \ "id:'900017', \ phase:1, \ t:none,t:lowercase, \ nolog, \ pass, \ chain" SecRule REQBODY_PROCESSOR "!@streq XML" \ "ctl:requestBodyProcessor=XML" # # -- [[ Global and IP Collections ]] ----------------------------------------------------- # # Create both Global and IP collections for rules to use # There are some CRS rules that assume that these two collections # have already been initiated. # SecRule REQUEST_HEADERS:User-Agent "^(.*)$" \ "id:'900018', \ phase:1, \ t:none,t:sha1,t:hexEncode, \ setvar:tx.ua_hash=%{matched_var}, \ nolog, \ pass" SecRule REQUEST_HEADERS:x-forwarded-for "^\b(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\b" \ "id:'900019', \ phase:1, \ t:none, \ capture, \ setvar:tx.real_ip=%{tx.1}, \ nolog, \ pass" SecRule &TX:REAL_IP "!@eq 0" \ "id:'900020', \ phase:1, \ t:none, \ initcol:global=global, \ initcol:ip=%{tx.real_ip}_%{tx.ua_hash}, \ nolog, \ pass" SecRule &TX:REAL_IP "@eq 0" \ "id:'900021', \ phase:1, \ t:none, \ initcol:global=global, \ initcol:ip=%{remote_addr}_%{tx.ua_hash}, \ nolog, \ pass" modsecurity-apache_2.7.7/iis/wix/banner.jpg0000664000175000017500000002374612253711345021214 0ustar zimmerlezimmerleJFIFCC:  ٽJgII/ñ~ s_;H)-5bX*$ ֛.JJo V$4"*W)5qa@5)P?C>`&Oa4, P7Иzp'>4XNo{~#c7kbFpwR|sw~Nn|gu.O+jY}{]) A$,J%O& ĩ31 E*x5Tc{VN戋=w=b TB#WղuTۆgܿ.Ĺ#"gal+y;ttB"gcy;ș y;sB"gcnn}LrЏB!3W?B>&v9 GD!\ș;y;st#"gcn}LrC!3w7D>&vùuH}Lr.o?Ru?OLrͫC"gc~}L%stC"~_!\ș+y;s#"gcn~Lr ЏA377B>&v9D \ș y;tt""gal y;ttB"gc.~_o"}oș[T_"g~@}D^޲' 5z"gat}tt""gc맡y;]=yCLJO@.&v<<:w3}S ƕK'Dm8) 3+yۦ~+~֪6VR͊0R 4\4TW6y഍[j R*-4$5)4 H 2!kn[οsܗ$a_2G$҇#J@wǎ[W- *+~)[UyIQwR69(,m8bfRĐ3nFe֍szO:5Mz;H׵!6S]R]ޥMNz8IdFqސ%6+Pd ;r&)ޮ˞F.KI+Z9"ďގH)E@ʧnm,9BY D \RUŠE=B-Vw!g2 űxti*aBSH1C |Ӥ m*+IY<7F3b#xgE&ˢ7ev'4^>֦X!4,I5  ̆("L 3 &˩RmY=Z|I=:rCG4$:ZB)oYl;bKL|2EJc^zrNC"9ѳ! &)ŸvB+z8mwty4(OFXZsa٪&;K:J\i6mVDD;UbՏA,Kܣ HquB!$A\tmmMFNG-6 Gu!$rP3ќ!TY{^hTdTݫOƛAY5j2KP7B(jQ#E ѤW#e~J`UopơOS`SaH"9K 1FHV_v5RKqRDcExωЌ3)XBݣɺIjk)/4FI 0'K2saUV*55"S4l$TݡpE31=$Uk,MNrvA RT!"#124ADQ$Pq3`abps?Iot=%_hL>Z=;0hH|:a߯/-߯/->Ч 9@-o?,_߬-]cŃqL~/^#=SպTnb3/[{،Lo#=źtnb31_{،LoW^#=Sź'tnb33[{،Lo#=SպT~b31[{ٌLoV^c=S;zTnb, gcxBnb33[{،LV#=;պt~b31_{،LoW^#=;պt~b31_y،LV#=tnb31_{،LV/PLT<;n053gT~ywtn1i~lvc<;>i>FީѺywtn1igczDީ:Fy7tNQ`,\Euq"X:W`,\Euq"X:W`,\Euq"X:W`,\Euq"X:W`,\Euq"X:W`,\Euq"X:W:H%,VAᬙ4**|B '92x PQ,̳I9S{d'!EA& Hs~3()D?gB/+ a*b F'R^/M$K&*7IC9@D P J*eJ"kz Nʤ:ǦOf@όSTʪ@B&\HLcPGҌR\W/3iD01xKrD_64F@)e;@L pS 7"c^ 7%fI I9Ē~\wF iaDpZ>iKahljUY#geK>pwΒ:N'io\ @"2M7T\JٻK%t8";$A0 YvQTD%SfԎR"sZ "k~L>5s NiCk c?nDK) Nw B'~@<+tS3lRԭ4.cU`!&U ׽ۿ馲-go˗9ȫĔMALURY4g ɆL'P鐦P#9 a4L=Wy4Y<# \ P/1¤DuTKdlNdU:MسESH'`LJ"!]#:f[XW^+c2"S\.ېTR.0_$ TĊY<}QN_#B_0YbN @蔷]§H*eU g8$фrJp)E%^$C˔R){fD/s C)*jć98xQ\&ob^|$8|#ѲU=zT%rPޱFEF%/ZQD)(tư3js \*1E j61 gXpi Ձ%]QUP;egl\b"}҈U2&ȨR70flf&chGIiyLܚm3˜&e#{L)12.x~A 5!"1#Aa%4QT2P $03DU`bdpq?ѐݢtѐݢTѐbtѐbtћhnќhn|hn|hnhnXx6Ł𡛪Yxߺ`&9Лo1hMe4&G6m#M ̦ySBms)6b9Лo1hMe4&G6m#M ̦ySBms)6b9Лo1hMe4&G6= qY4&G2۹lb?,M:G sM ̦|!ƚm#M ̦ySBms)6b9Лo1hMm4&G2m#M ̦ySBmCi6ޡCZhme݇j#ߗ΄۱b>a-zoQ}4&sͦySBmsi6b9o1hMg´TRuntfQvdzs|>sxxv){Ev0ΦQ|#7k}"ajnP'r-0zB_5ʛUĄp! Km*ZXbԐu(q1&FD,h pUSW/^ްCU%+i6[U愍o]D㱅S!T1;Ίhd xY'BV%_Q&/ɑxFuSUM:HZaj /*}&FdvxkA0AUPpj5UQFV.FMvUh߀YT n&t*1 OQ`*G tsPɍ[+4l+Lf0 Э3veXeܜ(URKWJ(h}x)Ml:vܘ ̦ 'f%FJBIĵh?ul]9P<"]U8:ȦULhQe]f*fKE\@ʷ/s,e {)ꮼWrhU͢Xʴ:  uTx&nS,%(,tlj]+tf`spN( ˉT HG &]Dn] .^@K,Mԙd*w,`cCV"_D[ጇOy c~ ["QH"d\TlL:rH/[M#g*t1n3j;7lʤUDRBckư r- "gآ-Ѭ0JR1LrE b\|57f]Y6ICخZC%p_m-)m?zňŏQ5 w^bP(&v'!1QAaq 0P`@?!س3`yk'Y0x?c.\p\!Ofc.&6^'}x+@c9H0R];ټe:Jl=s"Xz>*1>hw0LJ]h:1ir>a@&C[ /̸{/TRK/TRK/TRK/TRK/TRK/TRK/TRK/TRK/TRK/TRK/TRK/TRK2tt*P#~PpV\i*'8$$"݁AcV{/H1o͔N0JX0]Ȟl@yW5!zJ׋8AyͬP Cَ\NILX& St`tL 6`R~TT9-1;Iθ3keY밆sVANDr}6z?@)G_x2C7L 2,eveV盠茦a|( @ĄQqBD;0HC~ pKWFo#" ?(D]80a!b@2;9p2շߛq{ ?"p>" zWT`sY*? {12se4N-\P6mmmmmm@h u `&!1AQaq P`?[+ނ_Bռajݬ!\!B* I39PPJ_,ȱI̡f ɩviiOt[y;`JLa}q&(QW>'K QaBУPƈ-RK$j&m4Ӣ3^C UCFe vHv%жaEMA)>e皋-fއ"SǮ 1|yfH(4xJ'M2F  #,Z{;xiH)Эxi&i=>~RZűlZ-m* 'Xڠ6|T0I0Na P3 ͋ ,jb;f@!>i$ąRFIȘ'!1aqQA P`? @j_6];'M1 OΨ~ЋvʁЃ{zpUP`KAyiVB(`&yinׯ|XA٪D]HMv=" p 44"-u@c #X*}ΟСNe_*YWʿUe_*YWʿUe_*YWʿUe_*YWʿUe_*YWʿUe_*YWʿPDA33%0kinVn)ݠ:(0"F2CY]ws :CWlV)(A4;  />L qED|E :VTTi4Lhcn۔(|# Vo4a%S'7k\V TQByT>r ;LX 0&a,IgU(HS˚gc `I!@ ?4>XA|53'.]/SL@@\s*GۊH!ćNE P/[0q)!1AaQqP0p?!~ֽdGΕ7M7$ F_#\]J4' 97C4@ C$P`2-oHC!? ~FEDTOQ<<}204%v(S@oxNNJ[8IPVhB:@&eg_[E A P%8pe 2B _4@dX2I1_ nA%^:/'+Km{P@?J`'AȾM@w-4,x@D)[,Ѥ,4~$`AM,%PJ$C8OdP$  AMExd5HɡG ~(,|I ַc:.u]똻1v3bg\ιsc:.u]똻1v3bg\ιsc:.u]똻1v3bg\ιsc:.u]똻1v3bg\ιsc:.u]똻1v3bg\ιsc:.u]똻1v3bg\ιsR6(?Bь {G7QW%{ 5'yщJ ^ ?B\e_˒ <;,$V <^ԭդkiIa2 `xaq*XJkd3[p,]%)b9P6] .#-S'RX^Y}>Pl, ¶Џ /T}htL($IŒY'R!`t·DV~$xD2Lx`(8_o5tʴGetId(); g_pHttpServer = pHttpServer; // step 2: create the module factory // pFactory = new CMyHttpModuleFactory(); if ( pFactory == NULL ) { hr = HRESULT_FROM_WIN32( ERROR_NOT_ENOUGH_MEMORY ); goto Finished; } // step 3: register for server events // hr = pModuleInfo->SetRequestNotifications( pFactory, /* module factory */ RQ_BEGIN_REQUEST | RQ_SEND_RESPONSE /* server event mask */, RQ_END_REQUEST /* server post event mask */); if ( FAILED( hr ) ) { goto Finished; } hr = pModuleInfo->SetPriorityForRequestNotification(RQ_BEGIN_REQUEST, PRIORITY_ALIAS_FIRST); hr = pModuleInfo->SetPriorityForRequestNotification(RQ_SEND_RESPONSE, PRIORITY_ALIAS_LAST); // reverted! //hr = pModuleInfo2->SetPriorityForPostRequestNotification(RQ_END_REQUEST, PRIORITY_ALIAS_LAST); pFactory = NULL; Finished: /* if ( pFactory != NULL ) { delete pFactory; pFactory = NULL; } */ return hr; } modsecurity-apache_2.7.7/iis/build_msi.bat0000664000175000017500000000200512253711345021056 0ustar zimmerlezimmerle set PATH="%PATH%;C:\Program Files (x86)\WiX Toolset v3.8\bin;C:\Program Files (x86)\WiX Toolset v3.7\bin;" set CURRENT_DIR=%cd% del installer.wix* "candle.exe" -ext WixUtilExtension -ext WixUIExtension "%CURRENT_DIR%\installer.wxs" -out "%CURRENT_DIR%\installer.wixobj" -dPlatform="x64" @if NOT (%ERRORLEVEL%) == (0) goto build_failed "light.exe" -ext WixUtilExtension -ext WixUIExtension "%CURRENT_DIR%\installer.wixobj" -out "%CURRENT_DIR%\installer-64.msi" -dPlatform="x64" @if NOT (%ERRORLEVEL%) == (0) goto build_failed "candle.exe" -ext WixUtilExtension -ext WixUIExtension "%CURRENT_DIR%\installer.wxs" -out "%CURRENT_DIR%\installer.wixobj" -dPlatform="x86" @if NOT (%ERRORLEVEL%) == (0) goto build_failed "light.exe" -ext WixUtilExtension -ext WixUIExtension "%CURRENT_DIR%\installer.wixobj" -out "%CURRENT_DIR%\installer-32.msi" -dPlatform="x86" @if NOT (%ERRORLEVEL%) == (0) goto build_failed exit /B 0 :build_failed @echo Problems during the building phase @goto failed :failed @cd %CURRENT_DIR% @exit /B 1 modsecurity-apache_2.7.7/iis/dependencies/0000775000175000017500000000000012253711345021050 5ustar zimmerlezimmerlemodsecurity-apache_2.7.7/iis/dependencies/build_libxml2.bat0000664000175000017500000000152512253711345024273 0ustar zimmerlezimmerlecd "%WORK_DIR%" @if NOT EXIST "%SOURCE_DIR%\%LIBXML2%" goto file_not_found_bin @7z.exe x "%SOURCE_DIR%\%LIBXML2%" -so | 7z.exe x -aoa -si -ttar set LIBXML2_DIR=%LIBXML2:~0,-7% move "%LIBXML2_DIR%" "libxml2" :: fart.exe -r -i -C "%WORK_DIR%\%LIBXML2_DIR%\win32\*.*" \x2Fopt:nowin98 " " cd "libxml2\win32" CSCRIPT configure.js iconv=no vcmanifest=yes zlib=yes @if NOT (%ERRORLEVEL%) == (0) goto build_failed NMAKE -f Makefile.msvc @if NOT (%ERRORLEVEL%) == (0) goto build_failed cd "%WORK%" copy /y "%WORK_DIR%\libxml2\win32\bin.msvc\libxml2.dll" "%OUTPUT_DIR%" copy /y "%WORK_DIR%\libxml2\win32\bin.msvc\libxml2.lib" "%OUTPUT_DIR%" @exit /B 0 :file_not_found_bin @echo File not found: "%SOURCE_DIR%\%LIBXML2%" @goto failed :build_failed @echo Problems during the building phase @goto failed :failed @exit /B 1 modsecurity-apache_2.7.7/iis/dependencies/build_pcre.bat0000664000175000017500000000134712253711345023655 0ustar zimmerlezimmerlecd "%WORK_DIR%" @if NOT EXIST "%SOURCE_DIR%\%APACHE_BIN%" goto file_not_found_bin 7z.exe x "%SOURCE_DIR%\%PCRE%" set PCRE_DIR=%PCRE:~0,-4% move "%PCRE_DIR%" "pcre" cd "pcre" CMAKE -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_SHARED_LIBS=True @if NOT (%ERRORLEVEL%) == (0) goto build_failed NMAKE @if NOT (%ERRORLEVEL%) == (0) goto build_failed cd "%WORK%" copy /y "%WORK_DIR%\pcre\pcre.dll" "%OUTPUT_DIR%" copy /y "%WORK_DIR%\pcre\pcre.pdb" "%OUTPUT_DIR%" copy /y "%WORK_DIR%\pcre\pcre.lib" "%OUTPUT_DIR%" echo "a" @exit /B 0 :file_not_found_bin @echo File not found: "%SOURCE_DIR%\%PCRE%" @goto failed :build_failed @echo Problems during the building phase @goto failed :failed @exit /B 1 modsecurity-apache_2.7.7/iis/dependencies/build_apache.bat0000664000175000017500000000255012253711345024142 0ustar zimmerlezimmerle@cd "%WORK_DIR%" @set APACHE=%WORK_DIR%\Apache24 @if NOT EXIST "%SOURCE_DIR%\%APACHE_BIN%" goto file_not_found_bin @if NOT EXIST "%SOURCE_DIR%\%APACHE_SRC%" goto file_not_found_src @7z.exe x "%SOURCE_DIR%\%APACHE_BIN%" @if NOT (%ERRORLEVEL%) == (0) goto something_went_wrong @7z.exe x "%SOURCE_DIR%\%APACHE_SRC%" -so | 7z.exe x -aoa -si -ttar @if NOT (%ERRORLEVEL%) == (0) goto something_went_wrong :: Missing: %APACHE%\bin\libapr-1.pdb %APACHE%\bin\libapr-1.lib ? copy /y "%APACHE%\bin\libapr-1.dll" "%OUTPUT_DIR%" @if NOT (%ERRORLEVEL%) == (0) goto something_went_wrong_copy :: Missing: %APACHE%\bin\libapriconv-1.pdb %APACHE%\lib\libapriconv-1.lib ? copy /y "%APACHE%\bin\libapriconv-1.dll" "%OUTPUT_DIR%" @if NOT (%ERRORLEVEL%) == (0) goto something_went_wrong_copy :: Missing: %APACHE%\bin\libaprutil-1.pdb %APACHE%\lib\libaprutil-1.lib ? copy /y "%APACHE%\bin\libaprutil-1.dll" "%OUTPUT_DIR%" @if NOT (%ERRORLEVEL%) == (0) goto something_went_wrong_copy @cd "%WORK_DIR%" @exit /B 0 :something_went_wrong_copy @echo Something went wrong while trying to copy Apache binaries files. @goto failed :file_not_found_bin @echo File not found: %SOURCE_DIR%\%APACHE_BIN% @goto failed :file_not_found_src @echo File not found: %SOURCE_DIR%\%APACHE_SRC% @goto failed :something_went_wrong @echo Something went wrong while unzip Apache files. @goto failed :failed @exit /B 1 modsecurity-apache_2.7.7/iis/dependencies/howto.txt0000664000175000017500000000277012253711345022757 0ustar zimmerlezimmerleWARNING! Building ModSecurityIIS on Windows is a relatively complicated process. Understanding it requires advanced knowledge of Windows and Unix environments. Using the same versions of libraries as listed below is strongly recommended. -------------------------------------- Tested on: Windows 7 x64 Vistual Studio 2010 Ultimate SP1 IIS enabled/installed cmake 2.8.7 curl 7.24.0 apache 2.2.22 or apache 2.4.3 libxml2 2.7.7 lua 5.1.5 pcre 8.30 zlib 1.2.7 7-Zip -------------------------------------- 1. Create working directory c:\work and drop directory c:\drop 2. Sync SVN ModSecurity branch to c:\work\mod_security 3. Copy files from c:\work\mod_security\iis\winbuild to c:\work 4. Download and install cmake (unpack to c:\work\cmake-2.8.7-win32-x86) 5. Download and install 7-Zip 6. Adjust paths in c:\work\init.bat accordingly if needed 7. Download curl, apache, libxml2, lua, pcre and zlib, place them in zip files in c:\work curl-7.24.0.zip httpd-2.2.22-win32-src.zip or (httpd-2.4.3.zip (source) and httpd-2.4.3-win32.zip + httpd-2.4.3-win64.zip (binaries)) libxml2-2.7.7.zip lua-5.1.5.zip pcre-8.30.zip zlib-1.2.7.zip Modify c:\work\build.bat accordingly (if other versions were used) 8. Open cmd.exe window, go to c:\work and run buildall.bat 9. When done, the binaries, lib and pdb files should appear under c:\drop\x86 (32-bit) and c:\drop\amd64 (64-bit) 10. Open the VS ModSecurity IIS installer project 11. Copy new binaries to the installer's x86 and amd64 directories 12. Build installer from within VS modsecurity-apache_2.7.7/iis/dependencies/build_curl.bat0000664000175000017500000000173612253711345023673 0ustar zimmerlezimmerlecd "%WORK_DIR%" @if NOT EXIST "%SOURCE_DIR%\%CURL%" goto file_not_found_bin echo "7z..." 7z.exe x "%SOURCE_DIR%\%CURL%" echo "Timeout..." timeout 5 echo "Curl..." set CURL_DIR=%CURL:~0,-4% echo "Move..." move "%CURL_DIR%" "curl" echo "Cd..." :: copy /y CMakeLists.txt "curl" CD "curl" echo "Cmake..." CMAKE -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_SHARED_LIBS=True -DCURL_ZLIB=True @if NOT (%ERRORLEVEL%) == (0) goto build_failed :: "%WORK_DIR%\fart.exe" -r -C "%WORK_DIR%\curl\include\curl\curlbuild.h" LLU ULL NMAKE @if NOT (%ERRORLEVEL%) == (0) goto build_failed cd "%WORK_DIR%" copy /y "%WORK_DIR%\curl\lib\libcurl.dll" "%OUTPUT_DIR%" copy /y "%WORK_DIR%\curl\lib\libcurl.pdb" "%OUTPUT_DIR%" copy /y "%WORK_DIR%\curl\lib\libcurl_imp.lib" "%OUTPUT_DIR%" exit /B 0 :file_not_found_bin @echo File not found: "%SOURCE_DIR%\%CURL%" @goto failed :build_failed @echo Problems during the building phase @goto failed :failed @exit /B 1 modsecurity-apache_2.7.7/iis/dependencies/build_lua.bat0000664000175000017500000000212312253711345023476 0ustar zimmerlezimmerlecd "%WORK_DIR%" @if NOT EXIST "%SOURCE_DIR%\%LUA%" goto file_not_found_bin @7z.exe x "%SOURCE_DIR%\%LUA%" -so | 7z.exe x -aoa -si -ttar set LUA_DIR=%LUA:~0,-7% move "%LUA_DIR%" "lua" cd "lua\src" CL /Ox /arch:SSE2 /GF /GL /Gy /FD /EHsc /MD /Zi /TC /wd4005 /D "_MBCS" /D "LUA_CORE" /D "LUA_BUILD_AS_DLL" /D "_CRT_SECURE_NO_WARNINGS" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_WIN32" /D "_WINDLL" /c *.c @if NOT (%ERRORLEVEL%) == (0) goto build_failed DEL lua.obj luac.obj LINK /DLL /LTCG /DEBUG /OUT:lua5.1.dll *.obj @if NOT (%ERRORLEVEL%) == (0) goto build_failed IF EXIST lua5.1.dll.manifest MT -manifest lua5.1.dll.manifest -outputresource:lua5.1.dll;2 @if NOT (%ERRORLEVEL%) == (0) goto build_failed cd "%WORK_DIR%" copy /y "%WORK_DIR%\lua\src\lua5.1.dll" "%OUTPUT_DIR%" copy /y "%WORK_DIR%\lua\src\lua5.1.pdb" "%OUTPUT_DIR%" copy /y "%WORK_DIR%\lua\src\lua5.1.lib" "%OUTPUT_DIR%" @exit /B 0 :file_not_found_bin @echo File not found: "%SOURCE_DIR%\%LUA%" @goto failed :build_failed @echo Problems during the building phase @goto failed :failed @exit /B 1 modsecurity-apache_2.7.7/iis/dependencies/build_zlib.bat0000664000175000017500000000132512253711345023660 0ustar zimmerlezimmerlecd "%WORK_DIR%" @if NOT EXIST "%SOURCE_DIR%\%ZLIB%" goto file_not_found_bin @7z.exe x "%SOURCE_DIR%\%ZLIB%" -so | 7z.exe x -aoa -si -ttar set ZLIB_DIR=%ZLIB:~0,-7% move "%ZLIB_DIR%" "zlib" cd "zlib" nmake -f win32\Makefile.msc @if NOT (%ERRORLEVEL%) == (0) goto build_failed SET INCLUDE=%INCLUDE%;%WORK_DIR%\zlib SET LIB=%LIB%;%WORK_DIR%\zlib cd "%WORK_DIR%" copy /y "%WORK_DIR%\zlib\zlib1.dll" "%OUTPUT_DIR%" copy /y "%WORK_DIR%\zlib\zlib1.pdb" "%OUTPUT_DIR%" copy /y "%WORK_DIR%\zlib\zdll.lib" "%OUTPUT_DIR%" @exit /B 0 :file_not_found_bin @echo File not found: "%SOURCE_DIR%\%ZLIB%" @goto failed :build_failed @echo Problems during the building phase @goto failed :failed @exit /B 1 modsecurity-apache_2.7.7/iis/ModSecurityIIS.vcxproj.filters0000775000175000017500000001530412253711345024330 0ustar zimmerlezimmerle ModSecurity ModSecurity ModSecurity ModSecurity ModSecurity ModSecurity ModSecurity ModSecurity ModSecurity ModSecurity ModSecurity ModSecurity ModSecurity ModSecurity ModSecurity ModSecurity ModSecurity ModSecurity ModSecurity ModSecurity ModSecurity ModSecurity ModSecurity ModSecurity Standalone Standalone Standalone Standalone Standalone Standalone Standalone ModSecurity ModSecurity ModSecurity ModSecurity ModSecurity ModSecurity ModSecurity ModSecurity ModSecurity ModSecurity ModSecurity ModSecurity ModSecurity ModSecurity ModSecurity ModSecurity ModSecurity ModSecurity ModSecurity ModSecurity Standalone Standalone ModSecurity ModSecurity {ba9b4453-b351-4739-9f9d-3d56d6b27bbc} {ba6117ea-f101-4d23-85f2-d1af0235e22a} modsecurity-apache_2.7.7/iis/mymodulefactory.h0000664000175000017500000000361112243422537022020 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #ifndef __MODULE_FACTORY_H__ #define __MODULE_FACTORY_H__ // Factory class for CMyHttpModule. // This class is responsible for creating instances // of CMyHttpModule for each request. class CMyHttpModuleFactory : public IHttpModuleFactory { CMyHttpModule * m_pModule; CRITICAL_SECTION m_csLock; public: CMyHttpModuleFactory() { m_pModule = NULL; InitializeCriticalSection(&m_csLock); } virtual HRESULT GetHttpModule( OUT CHttpModule **ppModule, IN IModuleAllocator * ) { HRESULT hr = S_OK; if ( ppModule == NULL ) { hr = HRESULT_FROM_WIN32( ERROR_INVALID_PARAMETER ); goto Finished; } EnterCriticalSection(&m_csLock); if(m_pModule == NULL) { m_pModule = new CMyHttpModule(); if ( m_pModule == NULL ) { hr = HRESULT_FROM_WIN32( ERROR_NOT_ENOUGH_MEMORY ); goto Finished; } } LeaveCriticalSection(&m_csLock); *ppModule = m_pModule; Finished: return hr; } virtual void Terminate() { if ( m_pModule != NULL ) { //m_pModule->WriteEventViewerLog("Module terminated."); delete m_pModule; m_pModule = NULL; } delete this; } }; #endif modsecurity-apache_2.7.7/iis/build_release.bat0000664000175000017500000000361312253711345021714 0ustar zimmerlezimmerle echo "Building release..." set RELEASE_DIR=release set OUTPUT_DIR=%cd%\dependencies\release_files set CURRENT_DIR=%cd% set AMD64=%RELEASE_DIR%\amd64 set X86=%RELEASE_DIR%\x86 mkdir "%RELEASE_DIR%" mkdir "%AMD64%" mkdir "%X86%" set VCARGS32="C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\vcvars32.bat" set VCARGS64="C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\x86_amd64\vcvarsx86_amd64.bat" call build_dependencies.bat %VCARGS64% @if NOT (%ERRORLEVEL%) == (0) goto build_failed call build_modsecurity.bat %VCARGS64% @if NOT (%ERRORLEVEL%) == (0) goto build_failed copy "%OUTPUT_DIR%\libapr-1.dll" "%AMD64%" copy "%OUTPUT_DIR%\libapriconv-1.dll" "%AMD64%" copy "%OUTPUT_DIR%\libaprutil-1.dll" "%AMD64%" copy "%OUTPUT_DIR%\libcurl.dll" "%AMD64%" copy "%OUTPUT_DIR%\libxml2.dll" "%AMD64%" copy "%OUTPUT_DIR%\lua5.1.dll" "%AMD64%" copy "%OUTPUT_DIR%\mlogc.exe" "%AMD64%" copy "%OUTPUT_DIR%\ModSecurityIIS.dll" "%AMD64%" copy "%OUTPUT_DIR%\pcre.dll" "%AMD64%" copy "%OUTPUT_DIR%\zlib1.dll" "%AMD64%" call build_dependencies.bat %VCARGS32% @if NOT (%ERRORLEVEL%) == (0) goto build_failed call build_modsecurity.bat %VCARGS32% @if NOT (%ERRORLEVEL%) == (0) goto build_failed copy "%OUTPUT_DIR%\libapr-1.dll" "%X86%" copy "%OUTPUT_DIR%\libapriconv-1.dll" "%X86%" copy "%OUTPUT_DIR%\libaprutil-1.dll" "%X86%" copy "%OUTPUT_DIR%\libcurl.dll" "%X86%" copy "%OUTPUT_DIR%\libxml2.dll" "%X86%" copy "%OUTPUT_DIR%\lua5.1.dll" "%X86%" copy "%OUTPUT_DIR%\mlogc.exe" "%X86%" copy "%OUTPUT_DIR%\ModSecurityIIS.dll" "%X86%" copy %OUTPUT_DIR%\pcre.dll "%X86%" copy %OUTPUT_DIR%\zlib1.dll "%X86%" :: copy %OUTPUT_DIR%\Installer.exe %RELEASE_DIR% :: copy %OUTPUT_DIR%\ModSecurity.xml %RELEASE_DIR% :: copy %OUTPUT_DIR%\owasp_csr.zip %RELEASE_DIR% :: copy %OUTPUT_DIR%\README.txt %RELEASE_DIR% exit /B 0 :build_failed @echo Problems during the building phase @goto failed :failed @cd %CURRENT_DIR% @exit /B 1 modsecurity-apache_2.7.7/iis/installer.wxs0000664000175000017500000020430612253711345021167 0ustar zimmerlezimmerle modsecurity-apache_2.7.7/authors.txt0000664000175000017500000000057512243422537020074 0ustar zimmerlezimmerleb1v1r = Brian Rectanus brectanu = Brian Rectanus brectanus = Brian Rectanus ivanr = Ivan Ristić rbarnett = Ryan C. Barnett [anonymous] = Brian Rectanus (no author) = Brian Rectanus brenosilva = Breno Silva modsecurity-apache_2.7.7/stamp-h10000664000175000017500000000005012243422537017207 0ustar zimmerlezimmerletimestamp for modsecurity_config_auto.h modsecurity-apache_2.7.7/aclocal.m40000664000175000017500000013127412254306011017475 0ustar zimmerlezimmerle# generated automatically by aclocal 1.13.3 -*- Autoconf -*- # Copyright (C) 1996-2013 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, [m4_warning([this file was generated for autoconf 2.69. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- # serial 1 (pkg-config-0.24) # # Copyright © 2004 Scott James Remnant . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # PKG_PROG_PKG_CONFIG([MIN-VERSION]) # ---------------------------------- AC_DEFUN([PKG_PROG_PKG_CONFIG], [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) fi if test -n "$PKG_CONFIG"; then _pkg_min_version=m4_default([$1], [0.9.0]) AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) PKG_CONFIG="" fi fi[]dnl ])# PKG_PROG_PKG_CONFIG # PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # # Check to see whether a particular set of modules exists. Similar # to PKG_CHECK_MODULES(), but does not set variables or print errors. # # Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) # only at the first occurence in configure.ac, so if the first place # it's called might be skipped (such as if it is within an "if", you # have to call PKG_CHECK_EXISTS manually # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_EXISTS], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl if test -n "$PKG_CONFIG" && \ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then m4_default([$2], [:]) m4_ifvaln([$3], [else $3])dnl fi]) # _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) # --------------------------------------------- m4_define([_PKG_CONFIG], [if test -n "$$1"; then pkg_cv_[]$1="$$1" elif test -n "$PKG_CONFIG"; then PKG_CHECK_EXISTS([$3], [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes ], [pkg_failed=yes]) else pkg_failed=untried fi[]dnl ])# _PKG_CONFIG # _PKG_SHORT_ERRORS_SUPPORTED # ----------------------------- AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], [AC_REQUIRE([PKG_PROG_PKG_CONFIG]) if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi[]dnl ])# _PKG_SHORT_ERRORS_SUPPORTED # PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], # [ACTION-IF-NOT-FOUND]) # # # Note that if there is a possibility the first call to # PKG_CHECK_MODULES might not happen, you should be sure to include an # explicit call to PKG_PROG_PKG_CONFIG in your configure.ac # # # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_MODULES], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl pkg_failed=no AC_MSG_CHECKING([for $1]) _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) _PKG_CONFIG([$1][_LIBS], [libs], [$2]) m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS and $1[]_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.]) if test $pkg_failed = yes; then AC_MSG_RESULT([no]) _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` else $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD m4_default([$4], [AC_MSG_ERROR( [Package requirements ($2) were not met: $$1_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. _PKG_TEXT])[]dnl ]) elif test $pkg_failed = untried; then AC_MSG_RESULT([no]) m4_default([$4], [AC_MSG_FAILURE( [The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. _PKG_TEXT To get pkg-config, see .])[]dnl ]) else $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS $1[]_LIBS=$pkg_cv_[]$1[]_LIBS AC_MSG_RESULT([yes]) $3 fi[]dnl ])# PKG_CHECK_MODULES # Copyright (C) 2002-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.13' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.13.3], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.13.3])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # Copyright (C) 2011-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_AR([ACT-IF-FAIL]) # ------------------------- # Try to determine the archiver interface, and trigger the ar-lib wrapper # if it is needed. If the detection of archiver interface fails, run # ACT-IF-FAIL (default is to abort configure with a proper error message). AC_DEFUN([AM_PROG_AR], [AC_BEFORE([$0], [LT_INIT])dnl AC_BEFORE([$0], [AC_PROG_LIBTOOL])dnl AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([ar-lib])dnl AC_CHECK_TOOLS([AR], [ar lib "link -lib"], [false]) : ${AR=ar} AC_CACHE_CHECK([the archiver ($AR) interface], [am_cv_ar_interface], [am_cv_ar_interface=ar AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int some_variable = 0;]])], [am_ar_try='$AR cru libconftest.a conftest.$ac_objext >&AS_MESSAGE_LOG_FD' AC_TRY_EVAL([am_ar_try]) if test "$ac_status" -eq 0; then am_cv_ar_interface=ar else am_ar_try='$AR -NOLOGO -OUT:conftest.lib conftest.$ac_objext >&AS_MESSAGE_LOG_FD' AC_TRY_EVAL([am_ar_try]) if test "$ac_status" -eq 0; then am_cv_ar_interface=lib else am_cv_ar_interface=unknown fi fi rm -f conftest.lib libconftest.a ]) ]) case $am_cv_ar_interface in ar) ;; lib) # Microsoft lib, so override with the ar-lib wrapper script. # FIXME: It is wrong to rewrite AR. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__AR in this case, # and then we could set am__AR="$am_aux_dir/ar-lib \$(AR)" or something # similar. AR="$am_aux_dir/ar-lib $AR" ;; unknown) m4_default([$1], [AC_MSG_ERROR([could not determine $AR interface])]) ;; esac AC_SUBST([AR])dnl ]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to # '$srcdir', '$srcdir/..', or '$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is '.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ([2.52])dnl m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], [$1], [CXX], [depcc="$CXX" am_compiler_list=], [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], [$1], [UPC], [depcc="$UPC" am_compiler_list=], [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES. AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE([dependency-tracking], [dnl AS_HELP_STRING( [--enable-dependency-tracking], [do not reject slow dependency extractors]) AS_HELP_STRING( [--disable-dependency-tracking], [speeds up one-time build])]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl AC_SUBST([am__nodep])dnl _AM_SUBST_NOTMAKE([am__nodep])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named 'Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "$am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each '.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.65])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [AC_DIAGNOSE([obsolete], [$0: two- and three-arguments forms are deprecated.]) m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if( m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), [ok:ok],, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) AM_MISSING_PROG([AUTOCONF], [autoconf]) AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) AM_MISSING_PROG([AUTOHEADER], [autoheader]) AM_MISSING_PROG([MAKEINFO], [makeinfo]) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES([CC])], [m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES([CXX])], [m4_define([AC_PROG_CXX], m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES([OBJC])], [m4_define([AC_PROG_OBJC], m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], [_AM_DEPENDENCIES([OBJCXX])], [m4_define([AC_PROG_OBJCXX], m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl ]) AC_REQUIRE([AM_SILENT_RULES])dnl dnl The testsuite driver may need to know about EXEEXT, so add the dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl ]) dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST([install_sh])]) # Copyright (C) 2003-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it is modern enough. # If it is, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= AC_MSG_WARN(['missing' script is too old or missing]) fi ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), [1])]) # _AM_SET_OPTIONS(OPTIONS) # ------------------------ # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi if test "$[2]" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT([yes]) # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi AC_CONFIG_COMMANDS_PRE( [AC_MSG_CHECKING([that generated files are newer than configure]) if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi AC_MSG_RESULT([done])]) rm -f conftest.file ]) # Copyright (C) 2009-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SILENT_RULES([DEFAULT]) # -------------------------- # Enable less verbose build rules; with the default set to DEFAULT # ("yes" being less verbose, "no" or empty being verbose). AC_DEFUN([AM_SILENT_RULES], [AC_ARG_ENABLE([silent-rules], [dnl AS_HELP_STRING( [--enable-silent-rules], [less verbose build output (undo: "make V=1")]) AS_HELP_STRING( [--disable-silent-rules], [verbose build output (undo: "make V=0")])dnl ]) case $enable_silent_rules in @%:@ ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; esac dnl dnl A few 'make' implementations (e.g., NonStop OS and NextStep) dnl do not support nested variable expansions. dnl See automake bug#9928 and bug#10237. am_make=${MAKE-make} AC_CACHE_CHECK([whether $am_make supports nested variables], [am_cv_make_support_nested_variables], [if AS_ECHO([['TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi]) if test $am_cv_make_support_nested_variables = yes; then dnl Using '$V' instead of '$(V)' breaks IRIX make. AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AC_SUBST([AM_V])dnl AM_SUBST_NOTMAKE([AM_V])dnl AC_SUBST([AM_DEFAULT_V])dnl AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl AC_SUBST([AM_DEFAULT_VERBOSITY])dnl AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) # Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor 'install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in "make install-strip", and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of 'v7', 'ustar', or 'pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar # AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar], [# The POSIX 1988 'ustar' format is defined with fixed-size fields. # There is notably a 21 bits limit for the UID and the GID. In fact, # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 # and bug#13588). am_max_uid=2097151 # 2^21 - 1 am_max_gid=$am_max_uid # The $UID and $GID variables are not portable, so we need to resort # to the POSIX-mandated id(1) utility. Errors in the 'id' calls # below are definitely unexpected, so allow the users to see them # (that is, avoid stderr redirection). am_uid=`id -u || echo unknown` am_gid=`id -g || echo unknown` AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) if test $am_uid -le $am_max_uid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) if test $am_gid -le $am_max_gid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi], [pax], [], [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Go ahead even if we have the value already cached. We do so because we # need to set the values for the 'am__tar' and 'am__untar' variables. _am_tools=${am_cv_prog_tar_$1-$_am_tools} for _am_tool in $_am_tools; do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works. rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR m4_include([build/find_apr.m4]) m4_include([build/find_apu.m4]) m4_include([build/find_curl.m4]) m4_include([build/find_lua.m4]) m4_include([build/find_pcre.m4]) m4_include([build/find_xml.m4]) m4_include([build/libtool.m4]) m4_include([build/ltoptions.m4]) m4_include([build/ltsugar.m4]) m4_include([build/ltversion.m4]) m4_include([build/lt~obsolete.m4]) modsecurity-apache_2.7.7/modsecurity.conf-recommended0000664000175000017500000001714012254305577023346 0ustar zimmerlezimmerle# -- Rule engine initialization ---------------------------------------------- # Enable ModSecurity, attaching it to every transaction. Use detection # only to start with, because that minimises the chances of post-installation # disruption. # SecRuleEngine DetectionOnly # -- Request body handling --------------------------------------------------- # Allow ModSecurity to access request bodies. If you don't, ModSecurity # won't be able to see any POST parameters, which opens a large security # hole for attackers to exploit. # SecRequestBodyAccess On # Enable XML request body parser. # Initiate XML Processor in case of xml content-type # SecRule REQUEST_HEADERS:Content-Type "text/xml" \ "id:'200000',phase:1,t:none,t:lowercase,pass,nolog,ctl:requestBodyProcessor=XML" # Maximum request body size we will accept for buffering. If you support # file uploads then the value given on the first line has to be as large # as the largest file you are willing to accept. The second value refers # to the size of data, with files excluded. You want to keep that value as # low as practical. # SecRequestBodyLimit 13107200 SecRequestBodyNoFilesLimit 131072 # Store up to 128 KB of request body data in memory. When the multipart # parser reachers this limit, it will start using your hard disk for # storage. That is slow, but unavoidable. # SecRequestBodyInMemoryLimit 131072 # What do do if the request body size is above our configured limit. # Keep in mind that this setting will automatically be set to ProcessPartial # when SecRuleEngine is set to DetectionOnly mode in order to minimize # disruptions when initially deploying ModSecurity. # SecRequestBodyLimitAction Reject # Verify that we've correctly processed the request body. # As a rule of thumb, when failing to process a request body # you should reject the request (when deployed in blocking mode) # or log a high-severity alert (when deployed in detection-only mode). # SecRule REQBODY_ERROR "!@eq 0" \ "id:'200001', phase:2,t:none,log,deny,status:400,msg:'Failed to parse request body.',logdata:'%{reqbody_error_msg}',severity:2" # By default be strict with what we accept in the multipart/form-data # request body. If the rule below proves to be too strict for your # environment consider changing it to detection-only. You are encouraged # _not_ to remove it altogether. # SecRule MULTIPART_STRICT_ERROR "!@eq 0" \ "id:'200002',phase:2,t:none,log,deny,status:44, \ msg:'Multipart request body failed strict validation: \ PE %{REQBODY_PROCESSOR_ERROR}, \ BQ %{MULTIPART_BOUNDARY_QUOTED}, \ BW %{MULTIPART_BOUNDARY_WHITESPACE}, \ DB %{MULTIPART_DATA_BEFORE}, \ DA %{MULTIPART_DATA_AFTER}, \ HF %{MULTIPART_HEADER_FOLDING}, \ LF %{MULTIPART_LF_LINE}, \ SM %{MULTIPART_MISSING_SEMICOLON}, \ IQ %{MULTIPART_INVALID_QUOTING}, \ IP %{MULTIPART_INVALID_PART}, \ IH %{MULTIPART_INVALID_HEADER_FOLDING}, \ FL %{MULTIPART_FILE_LIMIT_EXCEEDED}'" # Did we see anything that might be a boundary? # SecRule MULTIPART_UNMATCHED_BOUNDARY "!@eq 0" \ "id:'200003',phase:2,t:none,log,deny,msg:'Multipart parser detected a possible unmatched boundary.'" # PCRE Tuning # We want to avoid a potential RegEx DoS condition # SecPcreMatchLimit 1000 SecPcreMatchLimitRecursion 1000 # Some internal errors will set flags in TX and we will need to look for these. # All of these are prefixed with "MSC_". The following flags currently exist: # # MSC_PCRE_LIMITS_EXCEEDED: PCRE match limits were exceeded. # SecRule TX:/^MSC_/ "!@streq 0" \ "id:'200004',phase:2,t:none,deny,msg:'ModSecurity internal error flagged: %{MATCHED_VAR_NAME}'" # -- Response body handling -------------------------------------------------- # Allow ModSecurity to access response bodies. # You should have this directive enabled in order to identify errors # and data leakage issues. # # Do keep in mind that enabling this directive does increases both # memory consumption and response latency. # SecResponseBodyAccess On # Which response MIME types do you want to inspect? You should adjust the # configuration below to catch documents but avoid static files # (e.g., images and archives). # SecResponseBodyMimeType text/plain text/html text/xml # Buffer response bodies of up to 512 KB in length. SecResponseBodyLimit 524288 # What happens when we encounter a response body larger than the configured # limit? By default, we process what we have and let the rest through. # That's somewhat less secure, but does not break any legitimate pages. # SecResponseBodyLimitAction ProcessPartial # -- Filesystem configuration ------------------------------------------------ # The location where ModSecurity stores temporary files (for example, when # it needs to handle a file upload that is larger than the configured limit). # # This default setting is chosen due to all systems have /tmp available however, # this is less than ideal. It is recommended that you specify a location that's private. # SecTmpDir /tmp/ # The location where ModSecurity will keep its persistent data. This default setting # is chosen due to all systems have /tmp available however, it # too should be updated to a place that other users can't access. # SecDataDir /tmp/ # -- File uploads handling configuration ------------------------------------- # The location where ModSecurity stores intercepted uploaded files. This # location must be private to ModSecurity. You don't want other users on # the server to access the files, do you? # #SecUploadDir /opt/modsecurity/var/upload/ # By default, only keep the files that were determined to be unusual # in some way (by an external inspection script). For this to work you # will also need at least one file inspection rule. # #SecUploadKeepFiles RelevantOnly # Uploaded files are by default created with permissions that do not allow # any other user to access them. You may need to relax that if you want to # interface ModSecurity to an external program (e.g., an anti-virus). # #SecUploadFileMode 0600 # -- Debug log configuration ------------------------------------------------- # The default debug log configuration is to duplicate the error, warning # and notice messages from the error log. # #SecDebugLog /opt/modsecurity/var/log/debug.log #SecDebugLogLevel 3 # -- Audit log configuration ------------------------------------------------- # Log the transactions that are marked by a rule, as well as those that # trigger a server error (determined by a 5xx or 4xx, excluding 404, # level response status codes). # SecAuditEngine RelevantOnly SecAuditLogRelevantStatus "^(?:5|4(?!04))" # Log everything we know about a transaction. SecAuditLogParts ABIJDEFHZ # Use a single file for logging. This is much easier to look at, but # assumes that you will use the audit log only ocassionally. # SecAuditLogType Serial SecAuditLog /var/log/modsec_audit.log # Specify the path for concurrent audit logging. #SecAuditLogStorageDir /opt/modsecurity/var/audit/ # -- Miscellaneous ----------------------------------------------------------- # Use the most commonly used application/x-www-form-urlencoded parameter # separator. There's probably only one application somewhere that uses # something else so don't expect to change this value. # SecArgumentSeparator & # Settle on version 0 (zero) cookies, as that is what most applications # use. Using an incorrect cookie version may open your installation to # evasion attacks (against the rules that examine named cookies). # SecCookieFormat 0 # Specify your Unicode Code Point. # This mapping is used by the t:urlDecodeUni transformation function # to properly map encoded data to your language. Properly setting # these directives helps to reduce false positives and negatives. # SecUnicodeMapFile unicode.mapping 20127 modsecurity-apache_2.7.7/unicode.mapping0000664000175000017500000015061212243422537020647 0ustar zimmerlezimmerle(MAC - Roman) (MAC - Icelandic) 1250 (ANSI - Central Europe) 00a1:21 00a2:63 00a3:4c 00a5:59 00aa:61 00b2:32 00b3:33 00b9:31 00ba:6f 00bc:31 00bd:31 00be:33 00c0:41 00c3:41 00c5:41 00c6:41 00c8:45 00ca:45 00cc:49 00cf:49 00d1:4e 00d2:4f 00d5:4f 00d8:4f 00d9:55 00db:55 00e0:61 00e3:61 00e5:61 00e6:61 00e8:65 00ea:65 00ec:69 00ef:69 00f1:6e 00f2:6f 00f5:6f 00f8:6f 00f9:75 00fb:75 00ff:79 0100:41 0101:61 0108:43 0109:63 010a:43 010b:63 0112:45 0113:65 0114:45 0115:65 0116:45 0117:65 011c:47 011d:67 011e:47 011f:67 0120:47 0121:67 0122:47 0123:67 0124:48 0125:68 0126:48 0127:68 0128:49 0129:69 012a:49 012b:69 012c:49 012d:69 012e:49 012f:69 0130:49 0131:69 0134:4a 0135:6a 0136:4b 0137:6b 013b:4c 013c:6c 0145:4e 0146:6e 014c:4f 014d:6f 014e:4f 014f:6f 0152:4f 0153:6f 0156:52 0157:72 015c:53 015d:73 0166:54 0167:74 0168:55 0169:75 016a:55 016b:75 016c:55 016d:75 0172:55 0173:75 0174:57 0175:77 0176:59 0177:79 0178:59 0180:62 0191:46 0192:66 0197:49 019a:6c 019f:4f 01a0:4f 01a1:6f 01ab:74 01ae:54 01af:55 01b0:75 01b6:7a 01c0:7c 01c3:21 01cd:41 01ce:61 01cf:49 01d0:69 01d1:4f 01d2:6f 01d3:55 01d4:75 01d5:55 01d6:75 01d7:55 01d8:75 01d9:55 01da:75 01db:55 01dc:75 01de:41 01df:61 01e4:47 01e5:67 01e6:47 01e7:67 01e8:4b 01e9:6b 01ea:4f 01eb:6f 01ec:4f 01ed:6f 01f0:6a 0261:67 02b9:27 02ba:22 02bc:27 02c4:5e 02c6:5e 02c8:27 02cb:60 02cd:5f 02dc:7e 0300:60 0302:5e 0303:7e 030e:22 0331:5f 0332:5f 037e:3b 04bb:68 0589:3a 066a:25 2000:20 2001:20 2002:20 2003:20 2004:20 2005:20 2006:20 2010:2d 2011:2d 2032:27 2035:60 203c:21 2044:2f 2074:34 2075:35 2076:36 2077:37 2078:38 2080:30 2081:31 2082:32 2083:33 2084:34 2085:35 2086:36 2087:37 2088:38 2089:39 2102:43 2107:45 210a:67 210b:48 210c:48 210d:48 210e:68 2110:49 2111:49 2112:4c 2113:6c 2115:4e 2118:50 2119:50 211a:51 211b:52 211c:52 211d:52 2124:5a 2128:5a 212a:4b 212c:42 212d:43 212e:65 212f:65 2130:45 2131:46 2133:4d 2134:6f 2191:5e 2194:2d 2195:7c 21a8:7c 2212:2d 2215:2f 2216:5c 2217:2a 221f:4c 2223:7c 2236:3a 223c:7e 2303:5e 2329:3c 232a:3e 2502:2d 250c:2d 2514:4c 2518:2d 251c:2b 2524:2b 252c:54 2534:2b 253c:2b 2550:3d 2554:2d 255a:4c 255d:2d 2566:54 256c:2b 2580:2d 2584:2d 2588:2d 2591:2d 2592:2d 2593:2d 25ac:2d 25b2:5e 25ba:3e 25c4:3c 25cb:30 25d9:30 263c:30 2640:2b 2642:3e 266a:64 266b:64 2758:7c 3000:20 3008:3c 3009:3e 301a:5b 301b:5d ff01:21 ff02:22 ff03:23 ff04:24 ff05:25 ff06:26 ff07:27 ff08:28 ff09:29 ff0a:2a ff0b:2b ff0c:2c ff0d:2d ff0e:2e ff0f:2f ff10:30 ff11:31 ff12:32 ff13:33 ff14:34 ff15:35 ff16:36 ff17:37 ff18:38 ff19:39 ff1a:3a ff1b:3b ff1c:3c ff1d:3d ff1e:3e ff20:40 ff21:41 ff22:42 ff23:43 ff24:44 ff25:45 ff26:46 ff27:47 ff28:48 ff29:49 ff2a:4a ff2b:4b ff2c:4c ff2d:4d ff2e:4e ff2f:4f ff30:50 ff31:51 ff32:52 ff33:53 ff34:54 ff35:55 ff36:56 ff37:57 ff38:58 ff39:59 ff3a:5a ff3b:5b ff3c:5c ff3d:5d ff3e:5e ff3f:5f ff40:60 ff41:61 ff42:62 ff43:63 ff44:64 ff45:65 ff46:66 ff47:67 ff48:68 ff49:69 ff4a:6a ff4b:6b ff4c:6c ff4d:6d ff4e:6e ff4f:6f ff50:70 ff51:71 ff52:72 ff53:73 ff54:74 ff55:75 ff56:76 ff57:77 ff58:78 ff59:79 ff5a:7a ff5b:7b ff5c:7c ff5d:7d ff5e:7e 1251 (ANSI - Cyrillic) 00c0:41 00c1:41 00c2:41 00c3:41 00c4:41 00c5:41 00c7:43 00c8:45 00c9:45 00ca:45 00cb:45 00cc:49 00cd:49 00ce:49 00cf:49 00d1:4e 00d2:4f 00d3:4f 00d4:4f 00d5:4f 00d6:4f 00d8:4f 00d9:55 00da:55 00db:55 00dc:55 00dd:59 00e0:61 00e1:61 00e2:61 00e3:61 00e4:61 00e5:61 00e7:63 00e8:65 00e9:65 00ea:65 00eb:65 00ec:69 00ed:69 00ee:69 00ef:69 00f1:6e 00f2:6f 00f3:6f 00f4:6f 00f5:6f 00f6:6f 00f8:6f 00f9:75 00fa:75 00fb:75 00fc:75 00fd:79 00ff:79 0100:41 0101:61 0102:41 0103:61 0104:41 0105:61 0106:43 0107:63 0108:43 0109:63 010a:43 010b:63 010c:43 010d:63 010e:44 010f:64 0110:44 0111:64 0112:45 0113:65 0114:45 0115:65 0116:45 0117:65 0118:45 0119:65 011a:45 011b:65 011c:47 011d:67 011e:47 011f:67 0120:47 0121:67 0122:47 0123:67 0124:48 0125:68 0126:48 0127:68 0128:49 0129:69 012a:49 012b:69 012c:49 012d:69 012e:49 012f:69 0130:49 0134:4a 0135:6a 0136:4b 0137:6b 0139:4c 013a:6c 013b:4c 013c:6c 013d:4c 013e:6c 0141:4c 0142:6c 0143:4e 0144:6e 0145:4e 0146:6e 0147:4e 0148:6e 014c:4f 014d:6f 014e:4f 014f:6f 0150:4f 0151:6f 0154:52 0155:72 0156:52 0157:72 0158:52 0159:72 015a:53 015b:73 015c:53 015d:73 015e:53 015f:73 0160:53 0161:73 0162:54 0163:74 0164:54 0165:74 0166:54 0167:74 0168:55 0169:75 016a:55 016b:75 016c:55 016d:75 016e:55 016f:75 0170:55 0171:75 0172:55 0173:75 0174:57 0175:77 0176:59 0177:79 0178:59 0179:5a 017b:5a 017c:7a 017d:5a 017e:7a 0180:62 0197:49 019a:6c 019f:4f 01a0:4f 01a1:6f 01ab:74 01ae:54 01af:55 01b0:75 01cd:41 01ce:61 01cf:49 01d0:69 01d1:4f 01d2:6f 01d3:55 01d4:75 01d5:55 01d6:75 01d7:55 01d8:75 01d9:55 01da:75 01db:55 01dc:75 01de:41 01df:61 01e4:47 01e5:67 01e6:47 01e7:67 01e8:4b 01e9:6b 01ea:4f 01eb:6f 01ec:4f 01ed:6f 01f0:6a 203c:21 2190:3c 2191:5e 2192:3e 2193:76 2194:2d 221a:76 221f:4c 2500:2d 250c:2d 2514:4c 2518:2d 251c:2b 2524:2b 252c:54 2534:2b 253c:2b 2550:3d 2552:2d 2558:4c 2559:4c 255a:4c 255b:2d 255c:2d 255d:2d 2564:54 2565:54 2566:54 256a:2b 256b:2b 256c:2b 2580:2d 2584:2d 2588:2d 2591:2d 2592:2d 2593:2d 25ac:2d 25b2:5e 25ba:3e 25c4:3c 25cb:30 25d9:30 263a:4f 263b:4f 263c:30 2640:2b 2642:3e 266a:64 266b:64 ff01:21 ff02:22 ff03:23 ff04:24 ff05:25 ff06:26 ff07:27 ff08:28 ff09:29 ff0a:2a ff0b:2b ff0c:2c ff0d:2d ff0e:2e ff0f:2f ff10:30 ff11:31 ff12:32 ff13:33 ff14:34 ff15:35 ff16:36 ff17:37 ff18:38 ff19:39 ff1a:3a ff1b:3b ff1c:3c ff1d:3d ff1e:3e ff20:40 ff21:41 ff22:42 ff23:43 ff24:44 ff25:45 ff26:46 ff27:47 ff28:48 ff29:49 ff2a:4a ff2b:4b ff2c:4c ff2d:4d ff2e:4e ff2f:4f ff30:50 ff31:51 ff32:52 ff33:53 ff34:54 ff35:55 ff36:56 ff37:57 ff38:58 ff39:59 ff3a:5a ff3b:5b ff3c:5c ff3d:5d ff3e:5e ff3f:5f ff40:60 ff41:61 ff42:62 ff43:63 ff44:64 ff45:65 ff46:66 ff47:67 ff48:68 ff49:69 ff4a:6a ff4b:6b ff4c:6c ff4d:6d ff4e:6e ff4f:6f ff50:70 ff51:71 ff52:72 ff53:73 ff54:74 ff55:75 ff56:76 ff57:77 ff58:78 ff59:79 ff5a:7a ff5b:7b ff5c:7c ff5d:7d ff5e:7e 1252 (ANSI - Latin I) 0100:41 0101:61 0102:41 0103:61 0104:41 0105:61 0106:43 0107:63 0108:43 0109:63 010a:43 010b:63 010c:43 010d:63 010e:44 010f:64 0111:64 0112:45 0113:65 0114:45 0115:65 0116:45 0117:65 0118:45 0119:65 011a:45 011b:65 011c:47 011d:67 011e:47 011f:67 0120:47 0121:67 0122:47 0123:67 0124:48 0125:68 0126:48 0127:68 0128:49 0129:69 012a:49 012b:69 012c:49 012d:69 012e:49 012f:69 0130:49 0131:69 0134:4a 0135:6a 0136:4b 0137:6b 0139:4c 013a:6c 013b:4c 013c:6c 013d:4c 013e:6c 0141:4c 0142:6c 0143:4e 0144:6e 0145:4e 0146:6e 0147:4e 0148:6e 014c:4f 014d:6f 014e:4f 014f:6f 0150:4f 0151:6f 0154:52 0155:72 0156:52 0157:72 0158:52 0159:72 015a:53 015b:73 015c:53 015d:73 015e:53 015f:73 0162:54 0163:74 0164:54 0165:74 0166:54 0167:74 0168:55 0169:75 016a:55 016b:75 016c:55 016d:75 016e:55 016f:75 0170:55 0171:75 0172:55 0173:75 0174:57 0175:77 0176:59 0177:79 0179:5a 017b:5a 017c:7a 0180:62 0197:49 019a:6c 019f:4f 01a0:4f 01a1:6f 01ab:74 01ae:54 01af:55 01b0:75 01b6:7a 01c0:7c 01c3:21 01cd:41 01ce:61 01cf:49 01d0:69 01d1:4f 01d2:6f 01d3:55 01d4:75 01d5:55 01d6:75 01d7:55 01d8:75 01d9:55 01da:75 01db:55 01dc:75 01de:41 01df:61 01e4:47 01e5:67 01e6:47 01e7:67 01e8:4b 01e9:6b 01ea:4f 01eb:6f 01ec:4f 01ed:6f 01f0:6a 0261:67 02b9:27 02ba:22 02bc:27 02c4:5e 02c8:27 02cb:60 02cd:5f 0300:60 0302:5e 0303:7e 030e:22 0331:5f 0332:5f 037e:3b 0393:47 0398:54 03a3:53 03a6:46 03a9:4f 03b1:61 03b4:64 03b5:65 03c0:70 03c3:73 03c4:74 03c6:66 04bb:68 0589:3a 066a:25 2000:20 2001:20 2002:20 2003:20 2004:20 2005:20 2006:20 2010:2d 2011:2d 2017:3d 2032:27 2035:60 2044:2f 2074:34 2075:35 2076:36 2077:37 2078:38 207f:6e 2080:30 2081:31 2082:32 2083:33 2084:34 2085:35 2086:36 2087:37 2088:38 2089:39 20a7:50 2102:43 2107:45 210a:67 210b:48 210c:48 210d:48 210e:68 2110:49 2111:49 2112:4c 2113:6c 2115:4e 2118:50 2119:50 211a:51 211b:52 211c:52 211d:52 2124:5a 2128:5a 212a:4b 212c:42 212d:43 212e:65 212f:65 2130:45 2131:46 2133:4d 2134:6f 2212:2d 2215:2f 2216:5c 2217:2a 221a:76 221e:38 2223:7c 2229:6e 2236:3a 223c:7e 2261:3d 2264:3d 2265:3d 2303:5e 2320:28 2321:29 2329:3c 232a:3e 2500:2d 250c:2b 2510:2b 2514:2b 2518:2b 251c:2b 252c:2d 2534:2d 253c:2b 2550:2d 2552:2b 2553:2b 2554:2b 2555:2b 2556:2b 2557:2b 2558:2b 2559:2b 255a:2b 255b:2b 255c:2b 255d:2b 2564:2d 2565:2d 2566:2d 2567:2d 2568:2d 2569:2d 256a:2b 256b:2b 256c:2b 2584:5f 2758:7c 3000:20 3008:3c 3009:3e 301a:5b 301b:5d ff01:21 ff02:22 ff03:23 ff04:24 ff05:25 ff06:26 ff07:27 ff08:28 ff09:29 ff0a:2a ff0b:2b ff0c:2c ff0d:2d ff0e:2e ff0f:2f ff10:30 ff11:31 ff12:32 ff13:33 ff14:34 ff15:35 ff16:36 ff17:37 ff18:38 ff19:39 ff1a:3a ff1b:3b ff1c:3c ff1d:3d ff1e:3e ff20:40 ff21:41 ff22:42 ff23:43 ff24:44 ff25:45 ff26:46 ff27:47 ff28:48 ff29:49 ff2a:4a ff2b:4b ff2c:4c ff2d:4d ff2e:4e ff2f:4f ff30:50 ff31:51 ff32:52 ff33:53 ff34:54 ff35:55 ff36:56 ff37:57 ff38:58 ff39:59 ff3a:5a ff3b:5b ff3c:5c ff3d:5d ff3e:5e ff3f:5f ff40:60 ff41:61 ff42:62 ff43:63 ff44:64 ff45:65 ff46:66 ff47:67 ff48:68 ff49:69 ff4a:6a ff4b:6b ff4c:6c ff4d:6d ff4e:6e ff4f:6f ff50:70 ff51:71 ff52:72 ff53:73 ff54:74 ff55:75 ff56:76 ff57:77 ff58:78 ff59:79 ff5a:7a ff5b:7b ff5c:7c ff5d:7d ff5e:7e 1253 (ANSI - Greek) 00b4:2f 00c0:41 00c1:41 00c2:41 00c3:41 00c4:41 00c5:41 00c7:43 00c8:45 00c9:45 00ca:45 00cb:45 00cc:49 00cd:49 00ce:49 00cf:49 00d1:4e 00d2:4f 00d3:4f 00d4:4f 00d5:4f 00d6:4f 00d8:4f 00d9:55 00da:55 00db:55 00dc:55 00dd:59 00e0:61 00e1:61 00e2:61 00e3:61 00e4:61 00e5:61 00e7:63 00e8:65 00e9:65 00ea:65 00eb:65 00ec:69 00ed:69 00ee:69 00ef:69 00f1:6e 00f2:6f 00f3:6f 00f4:6f 00f5:6f 00f6:6f 00f8:6f 00f9:75 00fa:75 00fb:75 00fc:75 00fd:79 00ff:79 0100:41 0101:61 0102:41 0103:61 0104:41 0105:61 0106:43 0107:63 0108:43 0109:63 010a:43 010b:63 010c:43 010d:63 010e:44 010f:64 0110:44 0111:64 0112:45 0113:65 0114:45 0115:65 0116:45 0117:65 0118:45 0119:65 011a:45 011b:65 011c:47 011d:67 011e:47 011f:67 0120:47 0121:67 0122:47 0123:67 0124:48 0125:68 0126:48 0127:68 0128:49 0129:69 012a:49 012b:69 012c:49 012d:69 012e:49 012f:69 0130:49 0134:4a 0135:6a 0136:4b 0137:6b 0139:4c 013a:6c 013b:4c 013c:6c 013d:4c 013e:6c 0141:4c 0142:6c 0143:4e 0144:6e 0145:4e 0146:6e 0147:4e 0148:6e 014c:4f 014d:6f 014e:4f 014f:6f 0150:4f 0151:6f 0154:52 0155:72 0156:52 0157:72 0158:52 0159:72 015a:53 015b:73 015c:53 015d:73 015e:53 015f:73 0160:53 0161:73 0162:54 0163:74 0164:54 0165:74 0166:54 0167:74 0168:55 0169:75 016a:55 016b:75 016c:55 016d:75 016e:55 016f:75 0170:55 0171:75 0172:55 0173:75 0174:57 0175:77 0176:59 0177:79 0178:59 0179:5a 017b:5a 017c:7a 017d:5a 017e:7a 0180:62 0197:49 019a:6c 019f:4f 01a0:4f 01a1:6f 01ab:74 01ae:54 01af:55 01b0:75 01cd:41 01ce:61 01cf:49 01d0:69 01d1:4f 01d2:6f 01d3:55 01d4:75 01d5:55 01d6:75 01d7:55 01d8:75 01d9:55 01da:75 01db:55 01dc:75 01de:41 01df:61 01e4:47 01e5:67 01e6:47 01e7:67 01e8:4b 01e9:6b 01ea:4f 01eb:6f 01ec:4f 01ed:6f 01f0:6a 037e:3b 203c:21 2190:3c 2191:5e 2192:3e 2193:76 2194:2d 221f:4c 2500:2d 250c:2d 2514:4c 2518:2d 251c:2b 2524:2b 252c:54 2534:2b 253c:2b 2550:3d 2554:2d 255a:4c 255d:2d 2566:54 256c:2b 2580:2d 2584:2d 2588:2d 2591:2d 2592:2d 2593:2d 25ac:2d 25b2:5e 25ba:3e 25c4:3c 25cb:30 25d9:30 263a:4f 263b:4f 263c:30 2640:2b 2642:3e 266a:64 266b:64 ff01:21 ff02:22 ff03:23 ff04:24 ff05:25 ff06:26 ff07:27 ff08:28 ff09:29 ff0a:2a ff0b:2b ff0c:2c ff0d:2d ff0e:2e ff0f:2f ff10:30 ff11:31 ff12:32 ff13:33 ff14:34 ff15:35 ff16:36 ff17:37 ff18:38 ff19:39 ff1a:3a ff1b:3b ff1c:3c ff1d:3d ff1e:3e ff20:40 ff21:41 ff22:42 ff23:43 ff24:44 ff25:45 ff26:46 ff27:47 ff28:48 ff29:49 ff2a:4a ff2b:4b ff2c:4c ff2d:4d ff2e:4e ff2f:4f ff30:50 ff31:51 ff32:52 ff33:53 ff34:54 ff35:55 ff36:56 ff37:57 ff38:58 ff39:59 ff3a:5a ff3b:5b ff3c:5c ff3d:5d ff3e:5e ff3f:5f ff40:60 ff41:61 ff42:62 ff43:63 ff44:64 ff45:65 ff46:66 ff47:67 ff48:68 ff49:69 ff4a:6a ff4b:6b ff4c:6c ff4d:6d ff4e:6e ff4f:6f ff50:70 ff51:71 ff52:72 ff53:73 ff54:74 ff55:75 ff56:76 ff57:77 ff58:78 ff59:79 ff5a:7a ff5b:7b ff5c:7c ff5d:7d ff5e:7e 1254 (ANSI - Turkish) 00dd:59 00fd:79 0100:41 0101:61 0102:41 0103:61 0104:41 0105:61 0106:43 0107:63 0108:43 0109:63 010a:43 010b:63 010c:43 010d:63 010e:44 010f:64 0110:44 0111:64 0112:45 0113:65 0114:45 0115:65 0116:45 0117:65 0118:45 0119:65 011a:45 011b:65 011c:47 011d:67 0120:47 0121:67 0122:47 0123:67 0124:48 0125:68 0126:48 0127:68 0128:49 0129:69 012a:49 012b:69 012c:49 012d:69 012e:49 012f:69 0134:4a 0135:6a 0136:4b 0137:6b 0139:4c 013a:6c 013b:4c 013c:6c 013d:4c 013e:6c 0141:4c 0142:6c 0143:4e 0144:6e 0145:4e 0146:6e 0147:4e 0148:6e 014c:4f 014d:6f 014e:4f 014f:6f 0150:4f 0151:6f 0154:52 0155:72 0156:52 0157:72 0158:52 0159:72 015a:53 015b:73 015c:53 015d:73 0162:54 0163:74 0164:54 0165:74 0166:54 0167:74 0168:55 0169:75 016a:55 016b:75 016c:55 016d:75 016e:55 016f:75 0170:55 0171:75 0172:55 0173:75 0174:57 0175:77 0176:59 0177:79 0179:5a 017b:5a 017c:7a 017d:5a 017e:7a 0180:62 0189:44 0197:49 019a:6c 019f:4f 01a0:4f 01a1:6f 01ab:74 01ae:54 01af:55 01b0:75 01b6:7a 01c0:7c 01c3:21 01cd:41 01ce:61 01cf:49 01d0:69 01d1:4f 01d2:6f 01d3:55 01d4:75 01d5:55 01d6:75 01d7:55 01d8:75 01d9:55 01da:75 01db:55 01dc:75 01de:41 01df:61 01e4:47 01e5:67 01e6:47 01e7:67 01e8:4b 01e9:6b 01ea:4f 01eb:6f 01ec:4f 01ed:6f 01f0:6a 0261:67 02b9:27 02ba:22 02bc:27 02c4:5e 02c7:5e 02c8:27 02cb:60 02cd:5f 02d8:5e 02d9:27 0300:60 0302:5e 0331:5f 0332:5f 04bb:68 0589:3a 066a:25 2000:20 2001:20 2002:20 2003:20 2004:20 2005:20 2006:20 2010:2d 2011:2d 2032:27 2035:60 203c:21 2044:2f 2074:34 2075:35 2076:36 2077:37 2078:38 2081:30 2084:34 2085:35 2086:36 2087:37 2088:38 2089:39 2102:43 2107:45 210a:67 210b:48 210c:48 210d:48 210e:68 2110:49 2111:49 2112:4c 2113:6c 2115:4e 2118:50 2119:50 211a:51 211b:52 211c:52 211d:52 2124:5a 2128:5a 212a:4b 212c:42 212d:43 212e:65 212f:65 2130:45 2131:46 2133:4d 2134:6f 2191:5e 2193:76 2194:2d 2195:7c 21a8:7c 2212:2d 2215:2f 2216:5c 2217:2a 221f:4c 2223:7c 2236:3a 223c:7e 2303:5e 2329:3c 232a:3e 2502:2d 250c:2d 2514:4c 2518:2d 251c:2b 2524:2b 252c:54 2534:2b 253c:2b 2550:3d 2554:2d 255a:4c 255d:2d 2566:54 256c:2b 2580:2d 2584:2d 2588:2d 2591:2d 2592:2d 2593:2d 25ac:2d 25b2:5e 25ba:3e 25c4:3c 25cb:30 25d9:30 263a:4f 263b:4f 263c:30 2640:2b 2642:3e 266a:64 266b:64 2758:7c 3000:20 3008:3c 3009:3e 301a:5b 301b:3d 301d:22 301e:22 ff01:21 ff02:22 ff03:23 ff04:24 ff05:25 ff06:26 ff07:27 ff08:28 ff09:29 ff0a:2a ff0b:2b ff0c:2c ff0d:2d ff0e:2e ff0f:2f ff10:30 ff11:31 ff12:32 ff13:33 ff14:34 ff15:35 ff16:36 ff17:37 ff18:38 ff19:39 ff1a:3a ff1b:3b ff1c:3c ff1d:3d ff1e:3e ff20:40 ff21:41 ff22:42 ff23:43 ff24:44 ff25:45 ff26:46 ff27:47 ff28:48 ff29:49 ff2a:4a ff2b:4b ff2c:4c ff2d:4d ff2e:4e ff2f:4f ff30:50 ff31:51 ff32:52 ff33:53 ff34:54 ff35:55 ff36:56 ff37:57 ff38:58 ff39:59 ff3a:5a ff3b:5b ff3c:5c ff3d:5d ff3e:5e ff3f:5f ff40:60 ff41:61 ff42:62 ff43:63 ff44:64 ff45:65 ff46:66 ff47:67 ff48:68 ff49:69 ff4a:6a ff4b:6b ff4c:6c ff4d:6d ff4e:6e ff4f:6f ff50:70 ff51:71 ff52:72 ff53:73 ff54:74 ff55:75 ff56:76 ff57:77 ff58:78 ff59:79 ff5a:7a ff5b:7b ff5c:7c ff5d:7d ff5e:7e 1255 (ANSI - Hebrew) 0191:46 ff01:21 ff02:22 ff03:23 ff04:24 ff05:25 ff06:26 ff07:27 ff08:28 ff09:29 ff0a:2a ff0b:2b ff0c:2c ff0d:2d ff0e:2e ff0f:2f ff10:30 ff11:31 ff12:32 ff13:33 ff14:34 ff15:35 ff16:36 ff17:37 ff18:38 ff19:39 ff1a:3a ff1b:3b ff1c:3c ff1d:3d ff1e:3e ff20:40 ff21:41 ff22:42 ff23:43 ff24:44 ff25:45 ff26:46 ff27:47 ff28:48 ff29:49 ff2a:4a ff2b:4b ff2c:4c ff2d:4d ff2e:4e ff2f:4f ff30:50 ff31:51 ff32:52 ff33:53 ff34:54 ff35:55 ff36:56 ff37:57 ff38:58 ff39:59 ff3a:5a ff3b:5b ff3c:5c ff3d:5d ff3e:5e ff3f:5f ff40:60 ff41:61 ff42:62 ff43:63 ff44:64 ff45:65 ff46:66 ff47:67 ff48:68 ff49:69 ff4a:6a ff4b:6b ff4c:6c ff4d:6d ff4e:6e ff4f:6f ff50:70 ff51:71 ff52:72 ff53:73 ff54:74 ff55:75 ff56:76 ff57:77 ff58:78 ff59:79 ff5a:7a ff5b:7b ff5c:7c ff5d:7d ff5e:7e 1256 (ANSI - Arabic) 00c0:41 00c2:41 00c7:43 00c8:45 00c9:45 00ca:45 00cb:45 00ce:49 00cf:49 00d4:4f 00d9:55 00db:55 00dc:55 0191:46 ff01:21 ff02:22 ff03:23 ff04:24 ff05:25 ff06:26 ff07:27 ff08:28 ff09:29 ff0a:2a ff0b:2b ff0c:2c ff0d:2d ff0e:2e ff0f:2f ff10:30 ff11:31 ff12:32 ff13:33 ff14:34 ff15:35 ff16:36 ff17:37 ff18:38 ff19:39 ff1a:3a ff1b:3b ff1c:3c ff1d:3d ff1e:3e ff20:40 ff21:41 ff22:42 ff23:43 ff24:44 ff25:45 ff26:46 ff27:47 ff28:48 ff29:49 ff2a:4a ff2b:4b ff2c:4c ff2d:4d ff2e:4e ff2f:4f ff30:50 ff31:51 ff32:52 ff33:53 ff34:54 ff35:55 ff36:56 ff37:57 ff38:58 ff39:59 ff3a:5a ff3b:5b ff3c:5c ff3d:5d ff3e:5e ff3f:5f ff40:60 ff41:61 ff42:62 ff43:63 ff44:64 ff45:65 ff46:66 ff47:67 ff48:68 ff49:69 ff4a:6a ff4b:6b ff4c:6c ff4d:6d ff4e:6e ff4f:6f ff50:70 ff51:71 ff52:72 ff53:73 ff54:74 ff55:75 ff56:76 ff57:77 ff58:78 ff59:79 ff5a:7a ff5b:7b ff5c:7c ff5d:7d ff5e:7e 1257 (ANSI - Baltic) ff01:21 ff02:22 ff03:23 ff04:24 ff05:25 ff06:26 ff07:27 ff08:28 ff09:29 ff0a:2a ff0b:2b ff0c:2c ff0d:2d ff0e:2e ff0f:2f ff10:30 ff11:31 ff12:32 ff13:33 ff14:34 ff15:35 ff16:36 ff17:37 ff18:38 ff19:39 ff1a:3a ff1b:3b ff1c:3c ff1d:3d ff1e:3e ff20:40 ff21:41 ff22:42 ff23:43 ff24:44 ff25:45 ff26:46 ff27:47 ff28:48 ff29:49 ff2a:4a ff2b:4b ff2c:4c ff2d:4d ff2e:4e ff2f:4f ff30:50 ff31:51 ff32:52 ff33:53 ff34:54 ff35:55 ff36:56 ff37:57 ff38:58 ff39:59 ff3a:5a ff3b:5b ff3c:5c ff3d:5d ff3e:5e ff3f:5f ff40:60 ff41:61 ff42:62 ff43:63 ff44:64 ff45:65 ff46:66 ff47:67 ff48:68 ff49:69 ff4a:6a ff4b:6b ff4c:6c ff4d:6d ff4e:6e ff4f:6f ff50:70 ff51:71 ff52:72 ff53:73 ff54:74 ff55:75 ff56:76 ff57:77 ff58:78 ff59:79 ff5a:7a ff5b:7b ff5c:7c ff5d:7d ff5e:7e 1258 (ANSI/OEM - Viet Nam) ff01:21 ff02:22 ff03:23 ff04:24 ff05:25 ff06:26 ff07:27 ff08:28 ff09:29 ff0a:2a ff0b:2b ff0c:2c ff0d:2d ff0e:2e ff0f:2f ff10:30 ff11:31 ff12:32 ff13:33 ff14:34 ff15:35 ff16:36 ff17:37 ff18:38 ff19:39 ff1a:3a ff1b:3b ff1c:3c ff1d:3d ff1e:3e ff20:40 ff21:41 ff22:42 ff23:43 ff24:44 ff25:45 ff26:46 ff27:47 ff28:48 ff29:49 ff2a:4a ff2b:4b ff2c:4c ff2d:4d ff2e:4e ff2f:4f ff30:50 ff31:51 ff32:52 ff33:53 ff34:54 ff35:55 ff36:56 ff37:57 ff38:58 ff39:59 ff3a:5a ff3b:5b ff3c:5c ff3d:5d ff3e:5e ff3f:5f ff40:60 ff41:61 ff42:62 ff43:63 ff44:64 ff45:65 ff46:66 ff47:67 ff48:68 ff49:69 ff4a:6a ff4b:6b ff4c:6c ff4d:6d ff4e:6e ff4f:6f ff50:70 ff51:71 ff52:72 ff53:73 ff54:74 ff55:75 ff56:76 ff57:77 ff58:78 ff59:79 ff5a:7a ff5b:7b ff5c:7c ff5d:7d ff5e:7e 20127 (US-ASCII) 00a0:20 00a1:21 00a2:63 00a4:24 00a5:59 00a6:7c 00a9:43 00aa:61 00ab:3c 00ad:2d 00ae:52 00b2:32 00b3:33 00b7:2e 00b8:2c 00b9:31 00ba:6f 00bb:3e 00c0:41 00c1:41 00c2:41 00c3:41 00c4:41 00c5:41 00c6:41 00c7:43 00c8:45 00c9:45 00ca:45 00cb:45 00cc:49 00cd:49 00ce:49 00cf:49 00d0:44 00d1:4e 00d2:4f 00d3:4f 00d4:4f 00d5:4f 00d6:4f 00d8:4f 00d9:55 00da:55 00db:55 00dc:55 00dd:59 00e0:61 00e1:61 00e2:61 00e3:61 00e4:61 00e5:61 00e6:61 00e7:63 00e8:65 00e9:65 00ea:65 00eb:65 00ec:69 00ed:69 00ee:69 00ef:69 00f1:6e 00f2:6f 00f3:6f 00f4:6f 00f5:6f 00f6:6f 00f8:6f 00f9:75 00fa:75 00fb:75 00fc:75 00fd:79 00ff:79 0100:41 0101:61 0102:41 0103:61 0104:41 0105:61 0106:43 0107:63 0108:43 0109:63 010a:43 010b:63 010c:43 010d:63 010e:44 010f:64 0110:44 0111:64 0112:45 0113:65 0114:45 0115:65 0116:45 0117:65 0118:45 0119:65 011a:45 011b:65 011c:47 011d:67 011e:47 011f:67 0120:47 0121:67 0122:47 0123:67 0124:48 0125:68 0126:48 0127:68 0128:49 0129:69 012a:49 012b:69 012c:49 012d:69 012e:49 012f:69 0130:49 0131:69 0134:4a 0135:6a 0136:4b 0137:6b 0139:4c 013a:6c 013b:4c 013c:6c 013d:4c 013e:6c 0141:4c 0142:6c 0143:4e 0144:6e 0145:4e 0146:6e 0147:4e 0148:6e 014c:4f 014d:6f 014e:4f 014f:6f 0150:4f 0151:6f 0152:4f 0153:6f 0154:52 0155:72 0156:52 0157:72 0158:52 0159:72 015a:53 015b:73 015c:53 015d:73 015e:53 015f:73 0160:53 0161:73 0162:54 0163:74 0164:54 0165:74 0166:54 0167:74 0168:55 0169:75 016a:55 016b:75 016c:55 016d:75 016e:55 016f:75 0170:55 0171:75 0172:55 0173:75 0174:57 0175:77 0176:59 0177:79 0178:59 0179:5a 017b:5a 017c:7a 017d:5a 017e:7a 0180:62 0189:44 0191:46 0192:66 0197:49 019a:6c 019f:4f 01a0:4f 01a1:6f 01ab:74 01ae:54 01af:55 01b0:75 01b6:7a 01cd:41 01ce:61 01cf:49 01d0:69 01d1:4f 01d2:6f 01d3:55 01d4:75 01d5:55 01d6:75 01d7:55 01d8:75 01d9:55 01da:75 01db:55 01dc:75 01de:41 01df:61 01e4:47 01e5:67 01e6:47 01e7:67 01e8:4b 01e9:6b 01ea:4f 01eb:6f 01ec:4f 01ed:6f 01f0:6a 0261:67 02b9:27 02ba:22 02bc:27 02c4:5e 02c6:5e 02c8:27 02cb:60 02cd:5f 02dc:7e 0300:60 0302:5e 0303:7e 030e:22 0331:5f 0332:5f 2000:20 2001:20 2002:20 2003:20 2004:20 2005:20 2006:20 2010:2d 2011:2d 2013:2d 2014:2d 2018:27 2019:27 201a:2c 201c:22 201d:22 201e:22 2022:2e 2026:2e 2032:27 2035:60 2039:3c 203a:3e 2122:54 ff01:21 ff02:22 ff03:23 ff04:24 ff05:25 ff06:26 ff07:27 ff08:28 ff09:29 ff0a:2a ff0b:2b ff0c:2c ff0d:2d ff0e:2e ff0f:2f ff10:30 ff11:31 ff12:32 ff13:33 ff14:34 ff15:35 ff16:36 ff17:37 ff18:38 ff19:39 ff1a:3a ff1b:3b ff1c:3c ff1d:3d ff1e:3e ff20:40 ff21:41 ff22:42 ff23:43 ff24:44 ff25:45 ff26:46 ff27:47 ff28:48 ff29:49 ff2a:4a ff2b:4b ff2c:4c ff2d:4d ff2e:4e ff2f:4f ff30:50 ff31:51 ff32:52 ff33:53 ff34:54 ff35:55 ff36:56 ff37:57 ff38:58 ff39:59 ff3a:5a ff3b:5b ff3c:5c ff3d:5d ff3e:5e ff3f:5f ff40:60 ff41:61 ff42:62 ff43:63 ff44:64 ff45:65 ff46:66 ff47:67 ff48:68 ff49:69 ff4a:6a ff4b:6b ff4c:6c ff4d:6d ff4e:6e ff4f:6f ff50:70 ff51:71 ff52:72 ff53:73 ff54:74 ff55:75 ff56:76 ff57:77 ff58:78 ff59:79 ff5a:7a ff5b:7b ff5c:7c ff5d:7d ff5e:7e 20261 (T.61) f8dd:5c f8de:5e f8df:60 f8e0:7b f8fc:7d f8fd:7e f8fe:7f 20866 (Russian - KOI8) 00a7:15 00ab:3c 00ad:2d 00ae:52 00b1:2b 00b6:14 00bb:3e 00c0:41 00c1:41 00c2:41 00c3:41 00c4:41 00c5:41 00c7:43 00c8:45 00c9:45 00ca:45 00cb:45 00cc:49 00cd:49 00ce:49 00cf:49 00d1:4e 00d2:4f 00d3:4f 00d4:4f 00d5:4f 00d6:4f 00d8:4f 00d9:55 00da:55 00db:55 00dc:55 00dd:59 00e0:61 00e1:61 00e2:61 00e3:61 00e4:61 00e5:61 00e7:63 00e8:65 00e9:65 00ea:65 00eb:65 00ec:69 00ed:69 00ee:69 00ef:69 00f1:6e 00f2:6f 00f3:6f 00f4:6f 00f5:6f 00f6:6f 00f8:6f 00f9:75 00fa:75 00fb:75 00fc:75 00fd:79 00ff:79 0100:41 0101:61 0102:41 0103:61 0104:41 0105:61 0106:43 0107:63 0108:43 0109:63 010a:43 010b:63 010c:43 010d:63 010e:44 010f:64 0110:44 0111:64 0112:45 0113:65 0114:45 0115:65 0116:45 0117:65 0118:45 0119:65 011a:45 011b:65 011c:47 011d:67 011e:47 011f:67 0120:47 0121:67 0122:47 0123:67 0124:48 0125:68 0126:48 0127:68 0128:49 0129:69 012a:49 012b:69 012c:49 012d:69 012e:49 012f:69 0130:49 0134:4a 0135:6a 0136:4b 0137:6b 0139:4c 013a:6c 013b:4c 013c:6c 013d:4c 013e:6c 0141:4c 0142:6c 0143:4e 0144:6e 0145:4e 0146:6e 0147:4e 0148:6e 014c:4f 014d:6f 014e:4f 014f:6f 0150:4f 0151:6f 0154:52 0155:72 0156:52 0157:72 0158:52 0159:72 015a:53 015b:73 015c:53 015d:73 015e:53 015f:73 0160:53 0161:73 0162:54 0163:74 0164:54 0165:74 0166:54 0167:74 0168:55 0169:75 016a:55 016b:75 016c:55 016d:75 016e:55 016f:75 0170:55 0171:75 0172:55 0173:75 0174:57 0175:77 0176:59 0177:79 0178:59 0179:5a 017b:5a 017c:7a 017d:5a 017e:7a 0180:62 0197:49 019a:6c 019f:4f 01a0:4f 01a1:6f 01ab:74 01ae:54 01af:55 01b0:75 01cd:41 01ce:61 01cf:49 01d0:69 01d1:4f 01d2:6f 01d3:55 01d4:75 01d5:55 01d6:75 01d7:55 01d8:75 01d9:55 01da:75 01db:55 01dc:75 01de:41 01df:61 01e4:47 01e5:67 01e6:47 01e7:67 01e8:4b 01e9:6b 01ea:4f 01eb:6f 01ec:4f 01ed:6f 01f0:6a 2013:2d 2014:2d 2018:27 2019:27 201a:27 201c:22 201d:22 201e:22 2022:07 2026:3a 2030:25 2039:3c 203a:3e 203c:13 2122:54 2190:1b 2191:18 2192:1a 2193:19 2194:1d 2195:12 21a8:17 221f:1c 2302:7f 25ac:16 25b2:1e 25ba:10 25bc:1f 25c4:11 25cb:09 25d8:08 25d9:0a 263a:01 263b:02 263c:0f 2640:0c 2642:0b 2660:06 2663:05 2665:03 2666:04 266a:0d 266b:0e 28591 (ISO 8859-1 Latin I) 0100:41 0101:61 0102:41 0103:61 0104:41 0105:61 0106:43 0107:63 0108:43 0109:63 010a:43 010b:63 010c:43 010d:63 010e:44 010f:64 0110:44 0111:64 0112:45 0113:65 0114:45 0115:65 0116:45 0117:65 0118:45 0119:65 011a:45 011b:65 011c:47 011d:67 011e:47 011f:67 0120:47 0121:67 0122:47 0123:67 0124:48 0125:68 0126:48 0127:68 0128:49 0129:69 012a:49 012b:69 012c:49 012d:69 012e:49 012f:69 0130:49 0131:69 0134:4a 0135:6a 0136:4b 0137:6b 0139:4c 013a:6c 013b:4c 013c:6c 013d:4c 013e:6c 0141:4c 0142:6c 0143:4e 0144:6e 0145:4e 0146:6e 0147:4e 0148:6e 014c:4f 014d:6f 014e:4f 014f:6f 0150:4f 0151:6f 0152:4f 0153:6f 0154:52 0155:72 0156:52 0157:72 0158:52 0159:72 015a:53 015b:73 015c:53 015d:73 015e:53 015f:73 0160:53 0161:73 0162:54 0163:74 0164:54 0165:74 0166:54 0167:74 0168:55 0169:75 016a:55 016b:75 016c:55 016d:75 016e:55 016f:75 0170:55 0171:75 0172:55 0173:75 0174:57 0175:77 0176:59 0177:79 0178:59 0179:5a 017b:5a 017c:7a 017d:5a 017e:7a 0180:62 0189:44 0191:46 0192:66 0197:49 019a:6c 019f:4f 01a0:4f 01a1:6f 01ab:74 01ae:54 01af:55 01b0:75 01b6:7a 01cd:41 01ce:61 01cf:49 01d0:69 01d1:4f 01d2:6f 01d3:55 01d4:75 01d5:55 01d6:75 01d7:55 01d8:75 01d9:55 01da:75 01db:55 01dc:75 01de:41 01df:61 01e4:47 01e5:67 01e6:47 01e7:67 01e8:4b 01e9:6b 01ea:4f 01eb:6f 01ec:4f 01ed:6f 01f0:6a 0261:67 02b9:27 02ba:22 02bc:27 02c4:5e 02c6:5e 02c8:27 02cb:60 02cd:5f 02dc:7e 0300:60 0302:5e 0303:7e 030e:22 0331:5f 0332:5f 2000:20 2001:20 2002:20 2003:20 2004:20 2005:20 2006:20 2010:2d 2011:2d 2013:2d 2014:2d 2018:27 2019:27 201a:2c 201c:22 201d:22 201e:22 2022:2e 2026:2e 2032:27 2035:60 2039:3c 203a:3e 2122:54 ff01:21 ff02:22 ff03:23 ff04:24 ff05:25 ff06:26 ff07:27 ff08:28 ff09:29 ff0a:2a ff0b:2b ff0c:2c ff0d:2d ff0e:2e ff0f:2f ff10:30 ff11:31 ff12:32 ff13:33 ff14:34 ff15:35 ff16:36 ff17:37 ff18:38 ff19:39 ff1a:3a ff1b:3b ff1c:3c ff1d:3d ff1e:3e ff20:40 ff21:41 ff22:42 ff23:43 ff24:44 ff25:45 ff26:46 ff27:47 ff28:48 ff29:49 ff2a:4a ff2b:4b ff2c:4c ff2d:4d ff2e:4e ff2f:4f ff30:50 ff31:51 ff32:52 ff33:53 ff34:54 ff35:55 ff36:56 ff37:57 ff38:58 ff39:59 ff3a:5a ff3b:5b ff3c:5c ff3d:5d ff3e:5e ff3f:5f ff40:60 ff41:61 ff42:62 ff43:63 ff44:64 ff45:65 ff46:66 ff47:67 ff48:68 ff49:69 ff4a:6a ff4b:6b ff4c:6c ff4d:6d ff4e:6e ff4f:6f ff50:70 ff51:71 ff52:72 ff53:73 ff54:74 ff55:75 ff56:76 ff57:77 ff58:78 ff59:79 ff5a:7a ff5b:7b ff5c:7c ff5d:7d ff5e:7e 28592 (ISO 8859-2 Central Europe) 00a1:21 00a2:63 00a5:59 00a6:7c 00a9:43 00aa:61 00ab:3c 00ae:52 00b2:32 00b3:33 00b7:2e 00b9:31 00ba:6f 00bb:3e 00c0:41 00c3:41 00c5:41 00c6:41 00c8:45 00ca:45 00cc:49 00cf:49 00d0:44 00d1:4e 00d2:4f 00d5:4f 00d8:4f 00d9:55 00db:55 00e0:61 00e3:61 00e5:61 00e6:61 00e8:65 00ea:65 00ec:69 00ef:69 00f1:6e 00f2:6f 00f5:6f 00f8:6f 00f9:75 00fb:75 00ff:79 0100:41 0101:61 0108:43 0109:63 010a:43 010b:63 0112:45 0113:65 0114:45 0115:65 0116:45 0117:65 011c:47 011d:67 011e:47 011f:67 0120:47 0121:67 0122:47 0123:67 0124:48 0125:68 0126:48 0127:68 0128:49 0129:69 012a:49 012b:69 012c:49 012d:69 012e:49 012f:69 0130:49 0131:69 0134:4a 0135:6a 0136:4b 0137:6b 013b:4c 013c:6c 0145:4e 0146:6e 014c:4f 014d:6f 014e:4f 014f:6f 0152:4f 0153:6f 0156:52 0157:72 015c:53 015d:73 0166:54 0167:74 0168:55 0169:75 016a:55 016b:75 016c:55 016d:75 0172:55 0173:75 0174:57 0175:77 0176:59 0177:79 0178:59 0180:62 0189:44 0191:46 0192:66 0197:49 019a:6c 019f:4f 01a0:4f 01a1:6f 01ab:74 01ae:54 01af:55 01b0:75 01b6:7a 01cd:41 01ce:61 01cf:49 01d0:69 01d1:4f 01d2:6f 01d3:55 01d4:75 01d5:55 01d6:75 01d7:55 01d8:75 01d9:55 01da:75 01db:55 01dc:75 01de:41 01df:61 01e4:47 01e5:67 01e6:47 01e7:67 01e8:4b 01e9:6b 01ea:4f 01eb:6f 01ec:4f 01ed:6f 01f0:6a 0261:67 02b9:27 02ba:22 02bc:27 02c4:5e 02c6:5e 02c8:27 02cb:60 02cd:5f 02dc:7e 0300:60 0302:5e 0303:7e 030e:22 0331:5f 0332:5f 2000:20 2001:20 2002:20 2003:20 2004:20 2005:20 2006:20 2010:2d 2011:2d 2013:2d 2014:2d 2018:27 2019:27 201a:2c 201c:22 201d:22 201e:22 2022:2e 2026:2e 2032:27 2035:60 2039:3c 203a:3e 2122:54 ff01:21 ff02:22 ff03:23 ff04:24 ff05:25 ff06:26 ff07:27 ff08:28 ff09:29 ff0a:2a ff0b:2b ff0c:2c ff0d:2d ff0e:2e ff0f:2f ff10:30 ff11:31 ff12:32 ff13:33 ff14:34 ff15:35 ff16:36 ff17:37 ff18:38 ff19:39 ff1a:3a ff1b:3b ff1c:3c ff1d:3d ff1e:3e ff20:40 ff21:41 ff22:42 ff23:43 ff24:44 ff25:45 ff26:46 ff27:47 ff28:48 ff29:49 ff2a:4a ff2b:4b ff2c:4c ff2d:4d ff2e:4e ff2f:4f ff30:50 ff31:51 ff32:52 ff33:53 ff34:54 ff35:55 ff36:56 ff37:57 ff38:58 ff39:59 ff3a:5a ff3b:5b ff3c:5c ff3d:5d ff3e:5e ff3f:5f ff40:60 ff41:61 ff42:62 ff43:63 ff44:64 ff45:65 ff46:66 ff47:67 ff48:68 ff49:69 ff4a:6a ff4b:6b ff4c:6c ff4d:6d ff4e:6e ff4f:6f ff50:70 ff51:71 ff52:72 ff53:73 ff54:74 ff55:75 ff56:76 ff57:77 ff58:78 ff59:79 ff5a:7a ff5b:7b ff5c:7c ff5d:7d ff5e:7e 28605 (ISO 8859-15 Latin 9) 00a6:7c 0100:41 0101:61 0102:41 0103:61 0104:41 0105:61 0106:43 0107:63 0108:43 0109:63 010a:43 010b:63 010c:43 010d:63 010e:44 010f:64 0112:45 0113:65 0114:45 0115:65 0116:45 0117:65 0118:45 0119:65 011a:45 011b:65 011c:47 011d:67 011e:47 011f:67 0120:47 0121:67 0122:47 0123:67 0124:48 0125:68 0126:48 0127:68 0128:49 0129:69 012a:49 012b:69 012c:49 012d:69 012e:49 012f:69 0130:49 0131:69 0134:4a 0135:6a 0136:4b 0137:6b 0138:6b 0139:4c 013a:6c 013b:4c 013c:6c 013d:4c 013e:6c 0141:4c 0142:6c 0143:4e 0144:6e 0145:4e 0146:6e 0147:4e 0148:6e 014a:4e 014b:6e 014c:4f 014d:6f 014e:4f 014f:6f 0150:4f 0151:6f 0154:52 0155:72 0156:52 0157:72 0158:52 0159:72 015a:53 015b:73 015c:53 015d:73 015e:53 015f:73 0162:54 0163:74 0164:54 0165:74 0166:54 0167:74 0168:54 0169:74 016a:55 016b:75 016c:55 016d:75 016e:55 016f:75 0170:55 0171:75 0172:55 0173:75 0174:57 0175:77 0176:59 0177:79 0179:5a 017b:5a 017c:7a 0180:62 0189:44 0191:46 0192:66 0197:49 019a:6c 019f:4f 01a0:4f 01a1:6f 01ab:74 01ae:54 01af:55 01b0:75 01b6:7a 01cd:41 01ce:61 01cf:49 01d0:69 01d1:4f 01d2:6f 01d3:55 01d4:75 01d5:55 01d6:75 01d7:55 01d8:75 01d9:55 01da:75 01db:55 01dc:75 01de:41 01df:61 01e4:47 01e5:67 01e6:47 01e7:67 01e8:4b 01e9:6b 01ea:4f 01eb:6f 01ec:4f 01ed:6f 01f0:6a 0261:67 02b9:27 02ba:22 02bc:27 02c4:5e 02c6:5e 02c8:27 02cb:60 02cd:5f 02dc:7e 0300:60 0302:5e 0303:7e 030e:22 0331:5f 0332:5f 2000:20 2001:20 2002:20 2003:20 2004:20 2005:20 2006:20 2010:2d 2011:2d 2013:2d 2014:2d 2018:27 2019:27 201a:2c 201c:22 201d:22 201e:22 2022:2e 2026:2e 2032:27 2035:60 2039:3c 203a:3e 2122:54 ff01:21 ff02:22 ff03:23 ff04:24 ff05:25 ff06:26 ff07:27 ff08:28 ff09:29 ff0a:2a ff0b:2b ff0c:2c ff0d:2d ff0e:2e ff0f:2f ff10:30 ff11:31 ff12:32 ff13:33 ff14:34 ff15:35 ff16:36 ff17:37 ff18:38 ff19:39 ff1a:3a ff1b:3b ff1c:3c ff1d:3d ff1e:3e ff20:40 ff21:41 ff22:42 ff23:43 ff24:44 ff25:45 ff26:46 ff27:47 ff28:48 ff29:49 ff2a:4a ff2b:4b ff2c:4c ff2d:4d ff2e:4e ff2f:4f ff30:50 ff31:51 ff32:52 ff33:53 ff34:54 ff35:55 ff36:56 ff37:57 ff38:58 ff39:59 ff3a:5a ff3b:5b ff3c:5c ff3d:5d ff3e:5e ff3f:5f ff40:60 ff41:61 ff42:62 ff43:63 ff44:64 ff45:65 ff46:66 ff47:67 ff48:68 ff49:69 ff4a:6a ff4b:6b ff4c:6c ff4d:6d ff4e:6e ff4f:6f ff50:70 ff51:71 ff52:72 ff53:73 ff54:74 ff55:75 ff56:76 ff57:77 ff58:78 ff59:79 ff5a:7a ff5b:7b ff5c:7c ff5d:7d ff5e:7e 37 (IBM EBCDIC - U.S./Canada) 0004:37 0005:2d 0006:2e 0007:2f 0008:16 0009:05 000a:25 0014:3c 0015:3d 0016:32 0017:26 001a:3f 001b:27 0020:40 0021:5a 0022:7f 0023:7b 0024:5b 0025:6c 0026:50 0027:7d 0028:4d 0029:5d 002a:5c 002b:4e 002c:6b 002d:60 002e:4b 002f:61 003a:7a 003b:5e 003c:4c 003d:7e 003e:6e 003f:6f 0040:7c 005f:6d 0060:79 007c:4f 007f:07 0080:20 0081:21 0082:22 0083:23 0084:24 0085:15 0086:06 0087:17 0088:28 0089:29 008a:2a 008b:2b 008c:2c 008d:09 008e:0a 008f:1b 0090:30 0091:31 0092:1a 0093:33 0094:34 0095:35 0096:36 0097:08 0098:38 0099:39 009a:3a 009b:3b 009c:04 009d:14 009e:3e 00a0:41 00a2:4a 00a6:6a 00ac:5f 00c0:64 00c1:65 00c2:62 00c3:66 00c4:63 00c5:67 00c7:68 00c8:74 00c9:71 00ca:72 00cb:73 00cc:78 00cd:75 00ce:76 00cf:77 00d1:69 00df:59 00e0:44 00e1:45 00e2:42 00e3:46 00e4:43 00e5:47 00e7:48 00e8:54 00e9:51 00ea:52 00eb:53 00ec:58 00ed:55 00ee:56 00ef:57 00f1:49 00f8:70 ff01:5a ff02:7f ff03:7b ff04:5b ff05:6c ff06:50 ff07:7d ff08:4d ff09:5d ff0a:5c ff0b:4e ff0c:6b ff0d:60 ff0e:4b ff0f:61 ff1a:7a ff1b:5e ff1c:4c ff1d:7e ff1e:6e ff20:7c ff3f:6d ff40:79 ff5c:4f 437 (OEM - United States) 00a4:0f 00a7:15 00a8:22 00a9:63 00ad:2d 00ae:72 00af:5f 00b3:33 00b4:27 00b6:14 00b8:2c 00b9:31 00be:5f 00c0:41 00c1:41 00c2:41 00c3:41 00c8:45 00ca:45 00cb:45 00cc:49 00cd:49 00ce:49 00cf:49 00d0:44 00d2:4f 00d3:4f 00d4:4f 00d5:4f 00d7:78 00d8:4f 00d9:55 00da:55 00db:55 00dd:59 00de:5f 00e3:61 00f0:64 00f5:6f 00f8:6f 00fd:79 00fe:5f 0100:41 0101:61 0102:41 0103:61 0104:41 0105:61 0106:43 0107:63 0108:43 0109:63 010a:43 010b:63 010c:43 010d:63 010e:44 010f:64 0110:44 0111:64 0112:45 0113:65 0114:45 0115:65 0116:45 0117:65 0118:45 0119:65 011a:45 011b:65 011c:47 011d:67 011e:47 011f:67 0120:47 0121:67 0122:47 0123:67 0124:48 0125:68 0126:48 0127:68 0128:49 0129:69 012a:49 012b:69 012c:49 012d:69 012e:49 012f:69 0130:49 0131:69 0134:4a 0135:6a 0136:4b 0137:6b 0139:4c 013a:6c 013b:4c 013c:6c 013d:4c 013e:6c 0141:4c 0142:6c 0143:4e 0144:6e 0145:4e 0146:6e 0147:4e 0148:6e 014c:4f 014d:6f 014e:4f 014f:6f 0150:4f 0151:6f 0152:4f 0153:6f 0154:52 0155:72 0156:52 0157:72 0158:52 0159:72 015a:53 015b:73 015c:53 015d:73 015e:53 015f:73 0160:53 0161:73 0162:54 0163:74 0164:54 0165:74 0166:54 0167:74 0168:55 0169:75 016a:55 016b:75 016c:55 016d:75 016e:55 016f:75 0170:55 0171:75 0172:55 0173:75 0174:57 0175:77 0176:59 0177:79 0178:59 0179:5a 017b:5a 017c:7a 017d:5a 017e:7a 0180:62 0189:44 0197:49 019a:6c 019f:4f 01a0:4f 01a1:6f 01ab:74 01ae:54 01af:55 01b0:75 01b6:7a 01c0:7c 01c3:21 01cd:41 01ce:61 01cf:49 01d0:69 01d1:4f 01d2:6f 01d3:55 01d4:75 01d5:55 01d6:75 01d7:55 01d8:75 01d9:55 01da:75 01db:55 01dc:75 01de:41 01df:61 01e4:47 01e5:67 01e6:47 01e7:67 01e8:4b 01e9:6b 01ea:4f 01eb:6f 01ec:4f 01ed:6f 01f0:6a 0261:67 02b9:27 02ba:22 02bc:27 02c4:5e 02c6:5e 02c8:27 02ca:27 02cb:60 02cd:5f 02dc:7e 0300:60 0301:27 0302:5e 0303:7e 0308:22 030e:22 0327:2c 0331:5f 0332:5f 037e:3b 04bb:68 0589:3a 066a:25 2000:20 2001:20 2002:20 2003:20 2004:20 2005:20 2006:20 2010:2d 2011:2d 2013:2d 2014:2d 2017:5f 2018:60 2019:27 201a:2c 201c:22 201d:22 201e:2c 2020:2b 2022:07 2026:2e 2030:25 2032:27 2035:60 2039:3c 203a:3e 203c:13 2044:2f 2074:34 2075:35 2076:36 2077:37 2078:38 2080:30 2081:31 2082:32 2083:33 2084:34 2085:35 2086:36 2087:37 2088:38 2089:39 20dd:09 2102:43 2107:45 210a:67 210b:48 210c:48 210d:48 210e:68 2110:49 2111:49 2112:4c 2113:6c 2115:4e 2118:50 2119:50 211a:51 211b:52 211c:52 211d:52 2122:54 2124:5a 2128:5a 212a:4b 212c:42 212d:43 212e:65 212f:65 2130:45 2131:46 2133:4d 2134:6f 2190:1b 2191:18 2192:1a 2193:19 2194:1d 2195:12 21a8:17 2212:2d 2215:2f 2216:5c 2217:2a 221f:1c 2223:7c 2236:3a 223c:7e 2302:7f 2303:5e 2329:3c 232a:3e 25ac:16 25b2:1e 25ba:10 25bc:1f 25c4:11 25cb:09 25d8:08 25d9:0a 263a:01 263b:02 263c:0f 2640:0c 2642:0b 2660:06 2663:05 2665:03 2666:04 266a:0d 266b:0e 2758:7c 3000:20 3007:09 3008:3c 3009:3e 301a:5b 301b:5d ff01:21 ff02:22 ff03:23 ff04:24 ff05:25 ff06:26 ff07:27 ff08:28 ff09:29 ff0a:2a ff0b:2b ff0c:2c ff0d:2d ff0e:2e ff0f:2f ff10:30 ff11:31 ff12:32 ff13:33 ff14:34 ff15:35 ff16:36 ff17:37 ff18:38 ff19:39 ff1a:3a ff1b:3b ff1c:3c ff1d:3d ff1e:3e ff20:40 ff21:41 ff22:42 ff23:43 ff24:44 ff25:45 ff26:46 ff27:47 ff28:48 ff29:49 ff2a:4a ff2b:4b ff2c:4c ff2d:4d ff2e:4e ff2f:4f ff30:50 ff31:51 ff32:52 ff33:53 ff34:54 ff35:55 ff36:56 ff37:57 ff38:58 ff39:59 ff3a:5a ff3b:5b ff3c:5c ff3d:5d ff3e:5e ff3f:5f ff40:60 ff41:61 ff42:62 ff43:63 ff44:64 ff45:65 ff46:66 ff47:67 ff48:68 ff49:69 ff4a:6a ff4b:6b ff4c:6c ff4d:6d ff4e:6e ff4f:6f ff50:70 ff51:71 ff52:72 ff53:73 ff54:74 ff55:75 ff56:76 ff57:77 ff58:78 ff59:79 ff5a:7a ff5b:7b ff5c:7c ff5d:7d ff5e:7e 500 (IBM EBCDIC - International) 0004:37 0005:2d 0006:2e 0007:2f 0008:16 0009:05 000a:25 0014:3c 0015:3d 0016:32 0017:26 001a:3f 001b:27 0020:40 0021:4f 0022:7f 0023:7b 0024:5b 0025:6c 0026:50 0027:7d 0028:4d 0029:5d 002a:5c 002b:4e 002c:6b 002d:60 002e:4b 002f:61 003a:7a 003b:5e 003c:4c 003d:7e 003e:6e 003f:6f 0040:7c 005b:4a 005d:5a 005e:5f 005f:6d 0060:79 007f:07 0080:20 0081:21 0082:22 0083:23 0084:24 0085:15 0086:06 0087:17 0088:28 0089:29 008a:2a 008b:2b 008c:2c 008d:09 008e:0a 008f:1b 0090:30 0091:31 0092:1a 0093:33 0094:34 0095:35 0096:36 0097:08 0098:38 0099:39 009a:3a 009b:3b 009c:04 009d:14 009e:3e 00a0:41 00a6:6a 00c0:64 00c1:65 00c2:62 00c3:66 00c4:63 00c5:67 00c7:68 00c8:74 00c9:71 00ca:72 00cb:73 00cc:78 00cd:75 00ce:76 00cf:77 00d1:69 00df:59 00e0:44 00e1:45 00e2:42 00e3:46 00e4:43 00e5:47 00e7:48 00e8:54 00e9:51 00ea:52 00eb:53 00ec:58 00ed:55 00ee:56 00ef:57 00f1:49 00f8:70 ff01:4f ff02:7f ff03:7b ff04:5b ff05:6c ff06:50 ff07:7d ff08:4d ff09:5d ff0a:5c ff0b:4e ff0c:6b ff0d:60 ff0e:4b ff0f:61 ff1a:7a ff1b:5e ff1c:4c ff1d:7e ff1e:6e ff20:7c ff3b:4a ff3d:5a ff3e:5f ff3f:6d ff40:79 850 (OEM - Multilingual Latin I) 0100:41 0101:61 0102:41 0103:61 0104:41 0105:61 0106:43 0107:63 0108:43 0109:63 010a:43 010b:63 010c:43 010d:63 010e:44 010f:64 0110:44 0111:64 0112:45 0113:65 0114:45 0115:65 0116:45 0117:65 0118:45 0119:65 011a:45 011b:65 011c:47 011d:67 011e:47 011f:67 0120:47 0121:67 0122:47 0123:67 0124:48 0125:68 0126:48 0127:68 0128:49 0129:69 012a:49 012b:69 012c:49 012d:69 012e:49 012f:69 0130:49 0134:4a 0135:6a 0136:4b 0137:6b 0139:4c 013a:6c 013b:4c 013c:6c 013d:4c 013e:6c 0141:4c 0142:6c 0143:4e 0144:6e 0145:4e 0146:6e 0147:4e 0148:6e 014c:4f 014d:6f 014e:4f 014f:6f 0150:4f 0151:6f 0152:4f 0153:6f 0154:52 0155:72 0156:52 0157:72 0158:52 0159:72 015a:53 015b:73 015c:53 015d:73 015e:53 015f:73 0160:53 0161:73 0162:54 0163:74 0164:54 0165:74 0166:54 0167:74 0168:55 0169:75 016a:55 016b:75 016c:55 016d:75 016e:55 016f:75 0170:55 0171:75 0172:55 0173:75 0174:57 0175:77 0176:59 0177:79 0178:59 0179:5a 017b:5a 017c:7a 017d:5a 017e:7a 0180:62 0189:44 0197:49 019a:6c 019f:4f 01a0:4f 01a1:6f 01a9:53 01ab:74 01ae:54 01af:55 01b0:75 01b6:5a 01c3:21 01cd:41 01ce:61 01cf:49 01d0:69 01d1:4f 01d2:6f 01d3:55 01d4:75 01d5:55 01d6:75 01d7:55 01d8:75 01d9:55 01da:75 01db:55 01dc:75 01de:41 01df:61 01e4:47 01e5:67 01e6:47 01e7:67 01e8:4b 01e9:6b 01ea:4f 01eb:6f 01ec:4f 01ed:6f 01f0:6a 0261:67 02ba:22 02bc:27 02c4:5e 02c6:5e 02c8:27 02cb:27 02cd:5f 02dc:7e 0300:27 0302:5e 0303:7e 030e:22 0331:5f 0332:5f 037e:3b 0393:47 03a3:53 03a6:46 03a9:4f 03b1:61 03b4:64 03b5:65 03c0:70 03c3:73 03c4:74 03c6:66 04bb:68 0589:3a 066a:25 2000:20 2001:20 2002:20 2003:20 2004:20 2005:20 2006:20 2010:2d 2011:2d 2013:2d 2014:2d 2018:27 2019:27 201a:27 201c:22 201d:22 201e:22 2022:07 2024:07 2026:2e 2030:25 2039:3c 203a:3e 203c:13 2044:2f 2070:30 2074:34 2075:35 2076:36 2077:37 2078:39 207f:6e 2080:30 2084:34 2085:35 2086:36 2087:37 2088:38 2089:39 20a7:50 20dd:4f 2102:43 2107:45 210a:67 210b:48 210c:48 210d:48 210e:68 2110:49 2111:49 2112:4c 2113:6c 2115:4e 2118:50 2119:50 211a:51 211b:52 211c:52 211d:52 2122:54 2124:5a 2126:4f 2128:5a 212a:4b 212c:42 212d:43 212e:65 212f:65 2130:45 2131:46 2133:4d 2134:6f 2190:1b 2191:18 2192:1a 2193:19 2194:1d 2195:12 21a8:17 2211:53 2212:2d 2215:2f 2216:2f 2217:2a 2219:07 221a:56 221e:38 221f:1c 2229:6e 2236:3a 223c:7e 2248:7e 2261:3d 2264:3d 2265:3d 2302:7f 2303:5e 2320:28 2321:29 2329:3c 232a:3e 25ac:16 25b2:1e 25ba:10 25bc:1f 25c4:11 25cb:09 25d8:08 25d9:0a 263a:01 263b:02 263c:0f 2640:0c 2642:0b 2660:06 2663:05 2665:03 2666:04 266a:0d 266b:0e 2713:56 3000:20 3007:4f 3008:3c 3009:3e 301a:5b 301b:5d ff01:21 ff02:22 ff03:23 ff04:24 ff05:25 ff06:26 ff07:27 ff08:28 ff09:29 ff0a:2a ff0b:2b ff0c:2c ff0d:2d ff0e:2e ff0f:2f ff10:30 ff11:31 ff12:32 ff13:33 ff14:34 ff15:35 ff16:36 ff17:37 ff18:38 ff19:39 ff1a:3a ff1b:3b ff1c:3c ff1d:3d ff1e:3e ff20:40 ff21:41 ff22:42 ff23:43 ff24:44 ff25:45 ff26:46 ff27:47 ff28:48 ff29:49 ff2a:4a ff2b:4b ff2c:4c ff2d:4d ff2e:4e ff2f:4f ff30:50 ff31:51 ff32:52 ff33:53 ff34:54 ff35:55 ff36:56 ff37:57 ff38:58 ff39:59 ff3a:5a ff3b:5b ff3c:5c ff3d:5d ff3e:5e ff3f:5f ff40:60 ff41:61 ff42:62 ff43:63 ff44:64 ff45:65 ff46:66 ff47:67 ff48:68 ff49:69 ff4a:6a ff4b:6b ff4c:6c ff4d:6d ff4e:6e ff4f:6f ff50:70 ff51:71 ff52:72 ff53:73 ff54:74 ff55:75 ff56:76 ff57:77 ff58:78 ff59:79 ff5a:7a ff5b:7b ff5c:7c ff5d:7d ff5e:7e 860 (OEM - Portuguese) 00a4:0f 00a5:59 00a7:15 00a8:22 00a9:63 00ad:5f 00ae:72 00af:16 00b3:33 00b4:2f 00b6:14 00b8:2c 00b9:31 00be:33 00c4:41 00c5:41 00c6:41 00cb:45 00ce:49 00cf:49 00d0:44 00d6:4f 00d7:58 00d8:4f 00db:55 00dd:59 00de:54 00e4:61 00e5:61 00e6:61 00eb:65 00ee:69 00ef:69 00f0:64 00f6:6f 00f8:6f 00fb:75 00fd:79 00fe:74 00ff:79 0100:41 0101:61 0102:41 0103:61 0104:41 0105:61 0106:43 0107:63 0108:43 0109:63 010a:43 010b:63 010c:43 010d:63 010e:44 010f:64 0110:44 0111:64 0112:45 0113:65 0114:45 0115:65 0116:45 0117:65 0118:45 0119:65 011a:45 011b:65 011c:47 011d:67 011e:47 011f:67 0120:47 0121:67 0122:47 0123:67 0124:48 0125:68 0126:48 0127:68 0128:49 0129:69 012a:49 012b:69 012c:49 012d:69 012e:49 012f:69 0130:49 0131:69 0134:4a 0135:6a 0136:4b 0137:6b 0139:4c 013a:6c 013b:4c 013c:6c 013d:4c 013e:6c 0141:4c 0142:6c 0143:4e 0144:6e 0145:4e 0146:6e 0147:4e 0148:6e 014c:4f 014d:6f 014e:4f 014f:6f 0150:4f 0151:6f 0152:4f 0153:6f 0154:52 0155:72 0156:52 0157:72 0158:52 0159:72 015a:53 015b:73 015c:53 015d:73 015e:53 015f:73 0160:5c 0161:7c 0162:54 0163:74 0164:54 0165:74 0166:54 0167:74 0168:55 0169:75 016a:55 016b:75 016c:55 016d:75 016e:55 016f:75 0170:55 0171:75 0172:55 0173:75 0174:57 0175:77 0176:59 0177:79 0178:59 0179:5a 017b:5a 017c:7a 017d:5a 017e:7a 0180:62 0189:44 0191:46 0192:66 0197:49 019a:6c 019f:4f 01a0:4f 01a1:6f 01ab:74 01ae:54 01af:55 01b0:75 01b6:7a 01c0:7c 01c3:21 01cd:41 01ce:61 01cf:49 01d0:69 01d1:4f 01d2:6f 01d3:55 01d4:75 01d5:55 01d6:75 01d7:55 01d8:75 01d9:55 01da:75 01db:55 01dc:75 01de:41 01df:61 01e4:47 01e5:67 01e6:47 01e7:67 01e8:4b 01e9:6b 01ea:4f 01eb:6f 01ec:4f 01ed:6f 01f0:6a 0261:67 0278:66 02b9:27 02ba:22 02bc:27 02c4:5e 02c6:5e 02c8:27 02c9:16 02ca:2f 02cb:60 02cd:5f 02dc:7e 0300:60 0301:2f 0302:5e 0303:7e 0304:16 0305:16 0308:22 030e:22 0327:2c 0331:5f 0332:5f 037e:3b 04bb:68 0589:3a 066a:25 2000:20 2001:20 2002:20 2003:20 2004:20 2005:20 2006:20 2010:5f 2011:5f 2013:5f 2014:5f 2017:5f 2018:27 2019:27 201a:2c 201c:22 201d:22 201e:22 2022:07 2024:07 2026:2e 2030:25 2032:27 2035:60 2039:3c 203a:3e 203c:13 2044:2f 2070:30 2074:34 2075:35 2076:36 2077:37 2078:38 2080:30 2081:31 2083:33 2084:34 2085:35 2086:36 2087:37 2088:38 2089:39 20dd:4f 2102:43 2107:45 210a:67 210b:48 210c:48 210d:48 210e:68 2110:49 2111:49 2112:4c 2113:6c 2115:4e 2118:70 2119:50 211a:51 211b:52 211c:52 211d:52 2122:74 2124:5a 2128:5a 212a:4b 212b:41 212c:42 212d:43 212e:65 212f:65 2130:45 2131:46 2133:4d 2134:6f 2190:1b 2191:18 2192:1a 2193:19 2194:1d 2195:12 21a8:17 2205:4f 2212:5f 2215:2f 2216:5c 2217:2a 221f:1c 2223:7c 2236:3a 223c:7e 22c5:07 2302:7f 2303:5e 2329:3c 232a:3e 25ac:16 25b2:1e 25ba:10 25bc:1f 25c4:11 25cb:09 25d8:08 25d9:0a 263a:01 263b:02 263c:0f 2640:0c 2642:0b 2660:06 2663:05 2665:03 2666:04 266a:0d 266b:0e 3000:20 3007:4f 3008:3c 3009:3e 301a:5b 301b:5d 30fb:07 861 (OEM - Icelandic) 00a2:63 00a4:0f 00a5:59 00a7:15 00a8:22 00a9:63 00aa:61 00ad:5f 00ae:72 00af:16 00b3:33 00b4:2f 00b6:14 00b8:2c 00b9:31 00ba:6f 00be:33 00c0:41 00c2:41 00c3:41 00c8:45 00ca:45 00cb:45 00cc:49 00ce:49 00cf:49 00d1:4e 00d2:4f 00d4:4f 00d5:4f 00d7:58 00d9:55 00db:55 00e3:61 00ec:69 00ee:69 00ef:69 00f1:6e 00f2:6f 00f5:6f 00f9:75 00ff:79 0100:41 0101:61 0102:41 0103:61 0104:41 0105:61 0106:43 0107:63 0108:43 0109:63 010a:43 010b:63 010c:43 010d:63 010e:44 010f:64 0111:64 0112:45 0113:65 0114:45 0115:65 0116:45 0117:65 0118:45 0119:65 011a:45 011b:65 011c:47 011d:67 011e:47 011f:67 0120:47 0121:67 0122:47 0123:67 0124:48 0125:68 0126:48 0127:68 0128:49 0129:69 012a:49 012b:69 012c:49 012d:69 012e:49 012f:69 0130:49 0131:69 0134:4a 0135:6a 0136:4b 0137:6b 0139:4c 013a:6c 013b:4c 013c:6c 013d:4c 013e:6c 0141:4c 0142:6c 0143:4e 0144:6e 0145:4e 0146:6e 0147:4e 0148:6e 014c:4f 014d:6f 014e:4f 014f:6f 0150:4f 0151:6f 0152:4f 0153:6f 0154:52 0155:72 0156:52 0157:72 0158:52 0159:72 015a:53 015b:73 015c:53 015d:73 015e:53 015f:73 0160:53 0161:73 0162:54 0163:74 0164:54 0165:74 0166:54 0167:74 0168:55 0169:75 016a:55 016b:75 016c:55 016d:75 016e:55 016f:75 0170:55 0171:75 0172:55 0173:75 0174:57 0175:77 0176:59 0177:79 0178:59 0179:5a 017b:5a 017c:7a 017d:5a 017e:7a 0180:62 0197:49 019a:6c 019f:4f 01a0:4f 01a1:6f 01ab:74 01ae:54 01af:55 01b0:75 01b6:7a 01c3:21 01cd:41 01ce:61 01cf:49 01d0:69 01d1:4f 01d2:6f 01d3:55 01d4:75 01d5:55 01d6:75 01d7:55 01d8:75 01d9:55 01da:75 01db:55 01dc:75 01de:41 01df:61 01e4:47 01e5:67 01e6:47 01e7:67 01e8:4b 01e9:6b 01ea:4f 01eb:6f 01ec:4f 01ed:6f 01f0:6a 0261:67 0278:66 02b9:27 02ba:22 02bc:27 02c4:5e 02c6:5e 02c8:27 02c9:16 02ca:2f 02cb:60 02cd:5f 02dc:7e 0300:60 0301:2f 0302:5e 0303:7e 0304:16 0305:16 0308:22 030e:22 0327:2c 0331:5f 0332:5f 037e:3b 04bb:68 0589:3a 066a:25 2000:20 2001:20 2002:20 2003:20 2004:20 2005:20 2006:20 2010:2d 2011:2d 2013:2d 2014:2d 2017:5f 2018:27 2019:27 201a:27 201c:22 201d:22 201e:22 2022:07 2024:07 2026:07 2030:25 2032:27 2035:27 2039:3c 203a:3e 203c:13 2044:2f 2070:30 2074:34 2075:35 2076:36 2077:37 2078:38 2080:30 2081:31 2083:33 2084:34 2085:35 2086:36 2087:37 2088:38 2089:39 20dd:4f 2102:43 2107:45 210a:67 210b:48 210c:48 210d:48 210e:68 2110:49 2111:49 2112:4c 2113:6c 2115:4e 2118:70 2119:50 211a:51 211b:52 211c:52 211d:52 2122:74 2124:5a 2128:5a 212a:4b 212c:42 212d:43 212e:65 212f:65 2130:45 2131:46 2133:4d 2134:6f 2190:1b 2191:18 2192:1a 2193:19 2194:1d 2195:12 21a8:17 2205:4f 2212:5f 2215:2f 2216:5c 2217:2a 221f:1c 2223:7c 2236:3a 223c:7e 22c5:07 2302:7f 2303:5e 2329:3c 232a:3e 25ac:16 25b2:1e 25ba:10 25bc:1f 25c4:11 25cb:09 25d8:08 25d9:0a 263a:01 263b:02 263c:0f 2640:0c 2642:0b 2660:06 2663:05 2665:03 2666:04 266a:0d 266b:0e 3000:20 3007:4f 3008:3c 3009:3e 301a:5b 301b:5d 30fb:07 863 (OEM - Canadian French) 00a1:21 00a5:59 00a9:63 00aa:61 00ad:16 00ae:72 00b9:33 00ba:6f 00c1:41 00c3:41 00c4:41 00c5:41 00c6:41 00cc:49 00cd:49 00d0:44 00d1:4e 00d2:4f 00d3:4f 00d5:4f 00d6:4f 00d7:58 00d8:4f 00da:55 00dd:59 00de:54 00e1:61 00e3:61 00e4:61 00e5:61 00e6:61 00ec:69 00ed:69 00f0:64 00f1:6e 00f2:6f 00f5:6f 00f6:6f 00f8:6f 00fd:79 00fe:74 00ff:79 0100:41 0101:61 0102:41 0103:61 0104:41 0105:61 0106:43 0107:63 0108:43 0109:63 010a:43 010b:63 010c:43 010d:63 010e:44 010f:64 0110:44 0111:64 0112:45 0113:65 0114:45 0115:65 0116:45 0117:65 0118:45 0119:65 011a:45 011b:65 011c:47 011d:67 011e:47 011f:67 0120:47 0121:67 0122:47 0123:67 0124:48 0125:68 0126:48 0127:68 0128:49 0129:69 012a:49 012b:69 012c:49 012d:69 012e:49 012f:69 0130:49 0131:69 0134:4a 0135:6a 0136:4b 0137:6b 0139:4c 013a:6c 013b:4c 013c:6c 013d:4c 013e:6c 0141:4c 0142:6c 0143:4e 0144:6e 0145:4e 0146:6e 0147:4e 0148:6e 014c:4f 014d:6f 014e:4f 014f:6f 0150:4f 0151:6f 0152:4f 0153:6f 0154:52 0155:72 0156:52 0157:72 0158:52 0159:72 015a:53 015b:73 015c:53 015d:73 015e:53 015f:73 0160:53 0161:73 0162:54 0163:74 0164:54 0165:74 0166:54 0167:74 0168:55 0169:75 016a:55 016b:75 016c:55 016d:75 016e:55 016f:75 0170:55 0171:75 0172:55 0173:75 0174:57 0175:77 0176:59 0177:79 0178:59 0179:5a 017b:5a 017c:7a 017d:5a 017e:7a 0180:62 0189:44 0197:49 019a:6c 019f:4f 01a0:4f 01a1:6f 01ab:74 01ae:54 01af:55 01b0:75 01b6:7a 01c3:21 01cd:41 01ce:61 01cf:49 01d0:69 01d1:4f 01d2:6f 01d3:55 01d4:75 01d5:55 01d6:75 01d7:55 01d8:75 01d9:55 01da:75 01db:55 01dc:75 01de:41 01df:61 01e4:47 01e5:67 01e6:47 01e7:67 01e8:4b 01e9:6b 01ea:4f 01eb:6f 01ec:4f 01ed:6f 01f0:6a 0261:67 02b9:22 02ba:27 02bc:27 02c4:5e 02c6:5e 02c8:27 02c9:16 02cb:60 02cd:5f 02dc:7e 0300:60 0302:5e 0303:7e 0304:16 0305:16 0331:5f 0332:5f 037e:3b 04bb:68 0589:3a 066a:25 2000:20 2001:20 2002:20 2003:20 2004:20 2005:20 2006:20 2010:2d 2011:2d 2013:2d 2014:2d 2018:27 2019:27 201a:27 201c:22 201d:22 201e:22 2022:07 2024:07 2026:07 2030:25 2032:27 2035:27 2039:3c 203a:3e 203c:13 2044:2f 2070:30 2074:34 2075:35 2076:36 2077:37 2078:38 2080:30 2081:31 2084:34 2085:35 2086:36 2087:37 2088:38 2089:39 20a7:50 20dd:4f 2102:43 2107:45 210a:67 210b:48 210c:48 210d:48 210e:68 2110:49 2111:49 2112:4c 2113:6c 2115:4e 2118:70 2119:50 211a:51 211b:52 211c:52 211d:52 2122:74 2124:5a 2128:5a 212a:4b 212b:41 212c:42 212d:43 212e:65 212f:65 2130:45 2131:46 2133:4d 2134:6f 2190:1b 2191:18 2192:1a 2193:19 2194:1d 2195:12 21a8:17 2205:4f 2212:5f 2215:2f 2216:5c 2217:2a 221f:1c 2223:7c 2236:3a 223c:7e 22c5:07 2302:7f 2303:5e 2329:3c 232a:3e 25ac:16 25b2:1e 25ba:10 25bc:1f 25c4:11 25cb:09 25d8:08 25d9:0a 263a:01 263b:02 263c:0f 2640:0c 2642:0b 2660:06 2663:05 2665:03 2666:04 266a:0d 266b:0e 3000:20 3007:4f 3008:3c 3009:3e 301a:5b 301b:5d 30fb:07 865 (OEM - Nordic) 00a2:63 00a5:59 00a7:15 00a8:22 00a9:63 00ad:5f 00ae:72 00af:16 00b3:33 00b4:2f 00b6:14 00b8:2c 00b9:31 00bb:3e 00be:33 00c0:41 00c1:41 00c2:41 00c3:41 00c8:45 00ca:45 00cb:45 00cc:49 00cd:49 00ce:49 00cf:49 00d0:44 00d2:4f 00d3:4f 00d4:4f 00d5:4f 00d7:58 00d9:55 00da:55 00db:55 00dd:59 00de:54 00e3:61 00f0:64 00f5:6f 00fd:79 00fe:74 0100:41 0101:61 0102:41 0103:61 0104:41 0105:61 0106:43 0107:63 0108:43 0109:63 010a:43 010b:63 010c:43 010d:63 010e:44 010f:64 0110:44 0111:64 0112:45 0113:65 0114:45 0115:65 0116:45 0117:65 0118:45 0119:65 011a:45 011b:65 011c:47 011d:67 011e:47 011f:67 0120:47 0121:67 0122:47 0123:67 0124:48 0125:68 0126:48 0127:68 0128:49 0129:69 012a:49 012b:69 012c:49 012d:69 012e:49 012f:69 0130:49 0131:69 0134:4a 0135:6a 0136:4b 0137:6b 0139:4c 013a:6c 013b:4c 013c:6c 013d:4c 013e:6c 0141:4c 0142:6c 0143:4e 0144:6e 0145:4e 0146:6e 0147:4e 0148:6e 014c:4f 014d:6f 014e:4f 014f:6f 0150:4f 0151:6f 0152:4f 0153:6f 0154:52 0155:72 0156:52 0157:72 0158:52 0159:72 015a:53 015b:73 015c:53 015d:73 015e:53 015f:73 0160:53 0161:73 0162:54 0163:74 0164:54 0165:74 0166:54 0167:74 0168:55 0169:75 016a:55 016b:75 016c:55 016d:75 016e:55 016f:75 0170:55 0171:75 0172:55 0173:75 0174:57 0175:77 0176:59 0177:79 0178:59 0179:5a 017b:5a 017c:7a 017d:5a 017e:7a 0180:62 0189:44 0197:49 019a:6c 019f:4f 01a0:4f 01a1:6f 01ab:74 01ae:54 01af:55 01b0:75 01b6:7a 01c3:21 01cd:41 01ce:61 01cf:49 01d0:69 01d1:4f 01d2:6f 01d3:55 01d4:75 01d5:55 01d6:75 01d7:55 01d8:75 01d9:55 01da:75 01db:55 01dc:75 01de:41 01df:61 01e4:47 01e5:67 01e6:47 01e7:67 01e8:4b 01e9:6b 01ea:4f 01eb:6f 01ec:4f 01ed:6f 01f0:6a 0261:67 02b9:27 02ba:22 02bc:27 02c4:5e 02c6:5e 02c8:27 02c9:16 02ca:2f 02cb:60 02cd:5f 02dc:7e 0300:60 0301:2f 0302:5e 0303:7e 0304:16 0305:16 0308:22 030e:22 0327:2c 0331:5f 0332:5f 037e:3b 04bb:68 0589:3a 066a:25 2000:20 2001:20 2002:20 2003:20 2004:20 2005:20 2006:20 2010:2d 2011:2d 2013:2d 2014:2d 2017:5f 2018:27 2019:27 201a:27 201c:22 201d:22 201e:22 2022:07 2024:07 2026:07 2030:25 2032:27 2035:27 2039:3c 203a:3e 203c:13 2044:2f 2070:30 2074:34 2075:35 2076:36 2077:37 2078:38 2080:30 2081:31 2083:33 2084:34 2085:35 2086:36 2087:37 2088:38 2089:39 20dd:4f 2102:43 2107:45 210a:67 210b:48 210c:48 210d:48 210e:68 2110:49 2111:49 2112:4c 2113:6c 2115:4e 2118:70 2119:50 211a:51 211b:52 211c:52 211d:52 2122:74 2124:5a 2128:5a 212a:4b 212c:42 212d:43 212e:65 212f:65 2130:45 2131:46 2133:4d 2134:6f 2190:1b 2191:18 2192:1a 2193:19 2194:1d 2195:12 21a8:17 2205:4f 2212:5f 2215:2f 2216:5c 2217:2a 221f:1c 2223:7c 2236:3a 223c:7e 226b:3c 22c5:07 2302:7f 2303:5e 2329:3c 232a:3e 25ac:16 25b2:1e 25ba:10 25bc:1f 25c4:11 25cb:09 25d8:08 25d9:0a 263a:01 263b:02 263c:0f 2640:0c 2642:0b 2660:06 2663:05 2665:03 2666:04 266a:0d 266b:0e 3000:20 3007:4f 3008:3c 3009:3e 300b:3e 301a:5b 301b:5d 30fb:07 874 (ANSI/OEM - Thai) 00a7:15 00b6:14 203c:13 2190:1b 2191:18 2192:1a 2193:19 2194:1d 2195:12 21a8:17 221f:1c 2302:7f 25ac:16 25b2:1e 25ba:10 25bc:1f 25c4:11 25cb:09 25d8:08 25d9:0a 263a:01 263b:02 263c:0f 2640:0c 2642:0b 2660:06 2663:05 2665:03 2666:04 266a:0d 266b:0e ff01:21 ff02:22 ff03:23 ff04:24 ff05:25 ff06:26 ff07:27 ff08:28 ff09:29 ff0a:2a ff0b:2b ff0c:2c ff0d:2d ff0e:2e ff0f:2f ff10:30 ff11:31 ff12:32 ff13:33 ff14:34 ff15:35 ff16:36 ff17:37 ff18:38 ff19:39 ff1a:3a ff1b:3b ff1c:3c ff1d:3d ff1e:3e ff20:40 ff21:41 ff22:42 ff23:43 ff24:44 ff25:45 ff26:46 ff27:47 ff28:48 ff29:49 ff2a:4a ff2b:4b ff2c:4c ff2d:4d ff2e:4e ff2f:4f ff30:50 ff31:51 ff32:52 ff33:53 ff34:54 ff35:55 ff36:56 ff37:57 ff38:58 ff39:59 ff3a:5a ff3b:5b ff3c:5c ff3d:5d ff3e:5e ff3f:5f ff40:60 ff41:61 ff42:62 ff43:63 ff44:64 ff45:65 ff46:66 ff47:67 ff48:68 ff49:69 ff4a:6a ff4b:6b ff4c:6c ff4d:6d ff4e:6e ff4f:6f ff50:70 ff51:71 ff52:72 ff53:73 ff54:74 ff55:75 ff56:76 ff57:77 ff58:78 ff59:79 ff5a:7a ff5b:7b ff5c:7c ff5d:7d ff5e:7e 932 (ANSI/OEM - Japanese Shift-JIS) 00a1:21 00a5:5c 00a6:7c 00a9:63 00aa:61 00ad:2d 00ae:52 00b2:32 00b3:33 00b9:31 00ba:6f 00c0:41 00c1:41 00c2:41 00c3:41 00c4:41 00c5:41 00c6:41 00c7:43 00c8:45 00c9:45 00ca:45 00cb:45 00cc:49 00cd:49 00ce:49 00cf:49 00d0:44 00d1:4e 00d2:4f 00d3:4f 00d4:4f 00d5:4f 00d6:4f 00d8:4f 00d9:55 00da:55 00db:55 00dc:55 00dd:59 00de:54 00df:73 00e0:61 00e1:61 00e2:61 00e3:61 00e4:61 00e5:61 00e6:61 00e7:63 00e8:65 00e9:65 00ea:65 00eb:65 00ec:69 00ed:69 00ee:69 00ef:69 00f0:64 00f1:6e 00f2:6f 00f3:6f 00f4:6f 00f5:6f 00f6:6f 00f8:6f 00f9:75 00fa:75 00fb:75 00fc:75 00fd:79 00fe:74 00ff:79 936 (ANSI/OEM - Simplified Chinese GBK) 00a6:7c 00aa:61 00ad:2d 00b2:32 00b3:33 00b9:31 00ba:6f 00d0:44 00dd:59 00de:54 00e2:61 00f0:65 00fd:79 00fe:74 949 (ANSI/OEM - Korean) 00a6:7c 00c0:41 00c1:41 00c2:41 00c3:41 00c4:41 00c5:41 00c7:43 00c8:45 00c9:45 00ca:45 00cb:45 00cc:49 00cd:49 00ce:49 00cf:49 00d1:4e 00d2:4f 00d3:4f 00d4:4f 00d5:4f 00d6:4f 00d9:55 00da:55 00db:55 00dc:55 00dd:59 00e0:61 00e1:61 00e2:61 00e3:61 00e4:61 00e5:61 00e7:63 00e8:65 00e9:65 00ea:65 00eb:65 00ec:69 00ed:69 00ee:69 00ef:69 00f1:6e 00f2:6f 00f3:6f 00f4:6f 00f5:6f 00f6:6f 00f9:75 00fa:75 00fb:75 00fc:75 00fd:79 00ff:79 20a9:5c 950 (ANSI/OEM - Traditional Chinese Big5) 00a1:21 00a6:7c 00a9:63 00aa:61 00ad:2d 00ae:52 00b2:32 00b3:33 00b9:31 00ba:6f 00c0:41 00c1:41 00c2:41 00c3:41 00c4:41 00c5:41 00c6:41 00c7:43 00c8:45 00c9:45 00ca:45 00cb:45 00cc:49 00cd:49 00ce:49 00cf:49 00d0:44 00d1:4e 00d2:4f 00d3:4f 00d4:4f 00d5:4f 00d6:4f 00d8:4f 00d9:55 00da:55 00db:55 00dc:55 00dd:59 00de:54 00df:73 00e0:61 00e1:61 00e2:61 00e3:61 00e4:61 00e5:61 00e6:61 00e7:63 00e8:65 00e9:65 00ea:65 00eb:65 00ec:69 00ed:69 00ee:69 00ef:69 00f0:65 00f1:6e 00f2:6f 00f3:6f 00f4:6f 00f5:6f 00f6:6f 00f8:6f 00f9:75 00fa:75 00fb:75 00fc:75 00fd:79 00fe:74 00ff:79 (UTF-7) (UTF-8) modsecurity-apache_2.7.7/Makefile.am0000664000175000017500000000216412254164464017702 0ustar zimmerlezimmerleACLOCAL_AMFLAGS = -I build SUBDIRS = @TOPLEVEL_SUBDIRS@ tests CLEANFILES = MAINTAINERCLEANFILES = CLEANFILES += tests/regression/server_root/conf/*.t_*.conf \ tests/regression/server_root/logs/*.log MAINTAINERCLEANFILES += $(CLEANFILES) \ aclocal.m4 \ alp2/Makefile.in \ apache2/Makefile.in \ build/config.guess \ build/config.sub \ build/depcomp \ build/libtool.m4 \ build/ltmain.sh \ build/lt~obsolete.m4 \ build/ltoptions.m4 \ build/ltsugar.m4 \ build/ltversion.m4 \ build/missing \ config.log \ config.status \ configure \ ext/Makefile.in \ Makefile \ Makefile.in \ mlogc/Makefile.in \ modsecurity_config_auto.h.in~ test: check test-regression: (cd tests && $(MAKE) test-regression) cppcheck: cppcheck . --enable=all --force 2>&1 | sed 's/^/warning: /g' 1>&2; check-coding-style: for i in `(find . -iname "*.c" ; find . -iname "*.h")`; \ do echo $$i...; \ vera++ -rule L004 -param max-line-length=80 $$i 2>&1 | sed 's/^/warning: /g' 1>&2; \ vera++ -rule L001 $$i 2>&1 | sed 's/^/warning: /g' 1>&2; \ done; .PHONY: test modsecurity-apache_2.7.7/apache2/0000775000175000017500000000000012254306021017131 5ustar zimmerlezimmerlemodsecurity-apache_2.7.7/apache2/re_tfns.c0000664000175000017500000006036612243422537020761 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #include #include "apr_md5.h" #include "apr_sha1.h" #include "apr_base64.h" #include "msc_unicode.h" #include "re.h" #include "msc_util.h" /* cmdline */ /** * \brief cmdline transformation function * * \param mptmp Pointer to resource pool * \param input Pointer to input data * \param input_len Input data length * \param rval Pointer to decoded buffer * \param rval_len Decoded buffer length * * \retval 0 On failure * \retval 1 On Success */ static int msre_fn_cmdline_execute(apr_pool_t *mptmp, unsigned char *input, long int input_len, char **rval, long int *rval_len) { int space = 0; unsigned char *s = input; if (rval == NULL) return -1; *rval = (char *)input; /* Check characters */ for ( ; *input; input++ ) { switch(*input) { /* remove some characters */ case '"': case '\'': case '\\': case '^': continue; /* replace some characters to space (only one) */ case ' ': case ',': case ';': case '\t': case '\r': case '\n': if (!space) { *s++ = ' '; space++; } break; case '/': case '(': /* remove space before / or ( */ if (space) s--; space = 0; *s++ = *input; break; /* copy normal characters */ default : *s++ = tolower(*input); space = 0; } } *s = 0; *rval_len = strlen(*rval); return 1; } /* lowercase */ static int msre_fn_lowercase_execute(apr_pool_t *mptmp, unsigned char *input, long int input_len, char **rval, long int *rval_len) { long int i; int changed = 0; if (rval == NULL) return -1; *rval = NULL; i = 0; while(i < input_len) { int x = input[i]; input[i] = tolower(x); if (x != input[i]) changed = 1; i++; } *rval = (char *)input; *rval_len = input_len; return changed; } /* trimLeft */ static int msre_fn_trimLeft_execute(apr_pool_t *mptmp, unsigned char *input, long int input_len, char **rval, long int *rval_len) { long int i; *rval = (char *)input; for (i = 0; i < input_len; i++) { if (isspace(**rval) == 0) { break; } (*rval)++; } *rval_len = input_len - i; return (*rval_len == input_len ? 0 : 1); } /* trimRight */ static int msre_fn_trimRight_execute(apr_pool_t *mptmp, unsigned char *input, long int input_len, char **rval, long int *rval_len) { long int i; *rval = (char *)input; for (i = input_len - 1; i >= 0; i--) { if (isspace((*rval)[i]) == 0) { break; } (*rval)[i] = '\0'; } *rval_len = i + 1; return (*rval_len == input_len ? 0 : 1); } /* trim */ static int msre_fn_trim_execute(apr_pool_t *mptmp, unsigned char *input, long int input_len, char **rval, long int *rval_len) { int rc = 0; rc = msre_fn_trimLeft_execute(mptmp, input, input_len, rval, rval_len); if (rc == 1) { rc = msre_fn_trimRight_execute(mptmp, (unsigned char *)*rval, *rval_len, rval, rval_len); } else { rc = msre_fn_trimRight_execute(mptmp, input, input_len, rval, rval_len); } return (*rval_len == input_len ? 0 : 1); } /* removeNulls */ static int msre_fn_removeNulls_execute(apr_pool_t *mptmp, unsigned char *input, long int input_len, char **rval, long int *rval_len) { long int i, j; int changed = 0; i = j = 0; while(i < input_len) { if (input[i] == '\0') { changed = 1; } else { input[j] = input[i]; j++; } i++; } *rval = (char *)input; *rval_len = j; return changed; } /* replaceNulls */ static int msre_fn_replaceNulls_execute(apr_pool_t *mptmp, unsigned char *input, long int input_len, char **rval, long int *rval_len) { long int i; int changed = 0; if (rval == NULL) return -1; *rval = NULL; i = 0; while(i < input_len) { if (input[i] == '\0') { changed = 1; input[i] = ' '; } i++; } *rval = (char *)input; *rval_len = input_len; return changed; } /* compressWhitespace */ static int msre_fn_compressWhitespace_execute(apr_pool_t *mptmp, unsigned char *input, long int input_len, char **rval, long int *rval_len) { long int i, j, count; int changed = 0; int inwhitespace = 0; i = j = count = 0; while(i < input_len) { if (isspace(input[i])||(input[i] == NBSP)) { if (inwhitespace) changed = 1; inwhitespace = 1; count++; } else { inwhitespace = 0; if (count) { input[j] = ' '; count = 0; j++; } input[j] = input[i]; j++; } i++; } if (count) { input[j] = ' '; j++; } *rval = (char *)input; *rval_len = j; return changed; } /* cssDecode */ static int msre_fn_cssDecode_execute(apr_pool_t *mptmp, unsigned char *input, long int input_len, char **rval, long int *rval_len) { long int length; length = css_decode_inplace(input, input_len); *rval = (char *)input; *rval_len = length; return (*rval_len == input_len ? 0 : 1); } /* removeWhitespace */ static int msre_fn_removeWhitespace_execute(apr_pool_t *mptmp, unsigned char *input, long int input_len, char **rval, long int *rval_len) { long int i, j; int changed = 0; i = j = 0; while(i < input_len) { if (isspace(input[i])||(input[i] == NBSP)) { /* do nothing */ changed = 1; } else { input[j] = input[i]; j++; } i++; } *rval = (char *)input; *rval_len = j; return changed; } /* removeCommentsChar */ static int msre_fn_removeCommentsChar_execute(apr_pool_t *mptmp, unsigned char *input, long int input_len, char **rval, long int *rval_len) { long int i, j; int changed = 0; i = j = 0; while(i < input_len) { if ((input[i] == '/')&&(i + 1 < input_len)&&(input[i + 1] == '*')) { changed = 1; i += 2; } else if ((input[i] == '*')&&(i + 1 < input_len)&&(input[i + 1] == '/')) { changed = 1; i += 2; } else if ((input[i] == '<')&&(i + 1 < input_len)&&(input[i + 1] == '!')&& (i + 2 < input_len)&&(input[i+2] == '-')&&(i + 3 < input_len)&& (input[i + 3] == '-')) { changed = 1; i += 4; } else if ((input[i] == '-')&&(i + 1 < input_len)&&(input[i + 1] == '-')&& (i + 2 < input_len)&&(input[i+2] == '>')) { changed = 1; i += 3; } else if ((input[i] == '-')&&(i + 1 < input_len)&&(input[i + 1] == '-')) { changed = 1; i += 2; } else if (input[i] == '#') { changed = 1; i++; } else { input[j] = input[i]; i++; j++; } } input[j] = '\0'; *rval = (char *)input; *rval_len = j; return changed; } /* removeComments */ static int msre_fn_removeComments_execute(apr_pool_t *mptmp, unsigned char *input, long int input_len, char **rval, long int *rval_len) { long int i, j, incomment; int changed = 0; i = j = incomment = 0; while(i < input_len) { if (incomment == 0) { if ((input[i] == '/')&&(i + 1 < input_len)&&(input[i + 1] == '*')) { changed = 1; incomment = 1; i += 2; } else if ((input[i] == '<')&&(i + 1 < input_len)&&(input[i + 1] == '!')&& (i + 2 < input_len)&&(input[i+2] == '-')&&(i + 3 < input_len)&& (input[i + 3] == '-') && (incomment == 0)) { incomment = 1; changed = 1; i += 4; } else if ((input[i] == '-')&&(i + 1 < input_len)&&(input[i + 1] == '-') && (incomment == 0)) { changed = 1; input[i] = ' '; break; } else if (input[i] == '#' && (incomment == 0)) { changed = 1; input[i] = ' '; break; } else { input[j] = input[i]; i++; j++; } } else { if ((input[i] == '*')&&(i + 1 < input_len)&&(input[i + 1] == '/')) { incomment = 0; i += 2; input[j] = input[i]; i++; j++; } else if ((input[i] == '-')&&(i + 1 < input_len)&&(input[i + 1] == '-')&& (i + 2 < input_len)&&(input[i+2] == '>')) { incomment = 0; i += 3; input[j] = input[i]; i++; j++; } else { i++; } } } if (incomment) { input[j++] = ' '; } *rval = (char *)input; *rval_len = j; return changed; } /* replaceComments */ static int msre_fn_replaceComments_execute(apr_pool_t *mptmp, unsigned char *input, long int input_len, char **rval, long int *rval_len) { long int i, j, incomment; int changed = 0; i = j = incomment = 0; while(i < input_len) { if (incomment == 0) { if ((input[i] == '/')&&(i + 1 < input_len)&&(input[i + 1] == '*')) { changed = 1; incomment = 1; i += 2; } else { input[j] = input[i]; i++; j++; } } else { if ((input[i] == '*')&&(i + 1 < input_len)&&(input[i + 1] == '/')) { incomment = 0; i += 2; input[j] = ' '; j++; } else { i++; } } } if (incomment) { input[j++] = ' '; } *rval = (char *)input; *rval_len = j; return changed; } /* jsDecode */ static int msre_fn_jsDecode_execute(apr_pool_t *mptmp, unsigned char *input, long int input_len, char **rval, long int *rval_len) { long int length; length = js_decode_nonstrict_inplace(input, input_len); *rval = (char *)input; *rval_len = length; return (*rval_len == input_len ? 0 : 1); } /* urlDecode */ static int msre_fn_urlDecode_execute(apr_pool_t *mptmp, unsigned char *input, long int input_len, char **rval, long int *rval_len) { long int length; int invalid_count; int changed; length = urldecode_nonstrict_inplace_ex(input, input_len, &invalid_count, &changed); *rval = (char *)input; *rval_len = length; return changed; } /* urlDecodeUni */ static int msre_fn_urlDecodeUni_execute(apr_pool_t *mptmp, unsigned char *input, long int input_len, char **rval, long int *rval_len) { long int length; int changed; length = urldecode_uni_nonstrict_inplace_ex(input, input_len, &changed); *rval = (char *)input; *rval_len = length; return changed; } static int msre_fn_utf8Unicode_execute(apr_pool_t *mptmp, unsigned char *input, long int input_len, char **rval, long int *rval_len) { int changed = 0; *rval = (char *)utf8_unicode_inplace_ex(mptmp, input, input_len, &changed); *rval_len = strlen(*rval); return changed; } /* urlEncode */ static int msre_fn_urlEncode_execute(apr_pool_t *mptmp, unsigned char *input, long int input_len, char **rval, long int *rval_len) { int changed; *rval = url_encode(mptmp, (char *)input, input_len, &changed); *rval_len = strlen(*rval); return changed; } /* base64Encode */ static int msre_fn_base64Encode_execute(apr_pool_t *mptmp, unsigned char *input, long int input_len, char **rval, long int *rval_len) { *rval_len = apr_base64_encode_len(input_len); /* returns len with NULL byte included */ *rval = apr_palloc(mptmp, *rval_len); apr_base64_encode(*rval, (const char *)input, input_len); (*rval_len)--; return *rval_len ? 1 : 0; } /* base64Decode */ static int msre_fn_base64Decode_execute(apr_pool_t *mptmp, unsigned char *input, long int input_len, char **rval, long int *rval_len) { *rval_len = apr_base64_decode_len((const char *)input); /* returns len with NULL byte included */ *rval = apr_palloc(mptmp, *rval_len); *rval_len = apr_base64_decode(*rval, (const char *)input); return *rval_len ? 1 : 0; } /* length */ static int msre_fn_length_execute(apr_pool_t *mptmp, unsigned char *input, long int input_len, char **rval, long int *rval_len) { *rval = apr_psprintf(mptmp, "%ld", input_len); *rval_len = strlen(*rval); return 1; } /* md5 */ static int msre_fn_md5_execute(apr_pool_t *mptmp, unsigned char *input, long int input_len, char **rval, long int *rval_len) { unsigned char digest[APR_MD5_DIGESTSIZE]; apr_md5(digest, input, input_len); *rval_len = APR_MD5_DIGESTSIZE; *rval = apr_pstrmemdup(mptmp, (const char *)digest, APR_MD5_DIGESTSIZE); return 1; } /* sha1 */ static int msre_fn_sha1_execute(apr_pool_t *mptmp, unsigned char *input, long int input_len, char **rval, long int *rval_len) { unsigned char digest[APR_SHA1_DIGESTSIZE]; apr_sha1_ctx_t context; apr_sha1_init(&context); apr_sha1_update(&context, (const char *)input, input_len); apr_sha1_final(digest, &context); *rval_len = APR_SHA1_DIGESTSIZE; *rval = apr_pstrmemdup(mptmp, (const char *)digest, APR_SHA1_DIGESTSIZE); return 1; } /** * \brief SqlHexDecode transformation function. Transform xNN data. * * \param mptmp Pointer to resource pool * \param input Pointer to input data * \param input_len Input data length * \param rval Pointer to decoded buffer * \param rval_len Decoded buffer length * * \retval 0 On failure * \retval 1 On Success */ static int msre_fn_sqlHexDecode_execute(apr_pool_t *mptmp, unsigned char *input, long int input_len, char **rval, long int *rval_len) { *rval_len = sql_hex2bytes_inplace(input, input_len); *rval = (char *)input; return 1; } /* hexDecode */ static int msre_fn_hexDecode_execute(apr_pool_t *mptmp, unsigned char *input, long int input_len, char **rval, long int *rval_len) { *rval_len = hex2bytes_inplace(input, input_len); *rval = (char *)input; return 1; } /* hexEncode */ static int msre_fn_hexEncode_execute(apr_pool_t *mptmp, unsigned char *input, long int input_len, char **rval, long int *rval_len) { *rval = bytes2hex(mptmp, input, input_len); *rval_len = strlen(*rval); return 1; } /* htmlEntityDecode */ static int msre_fn_htmlEntityDecode_execute(apr_pool_t *mptmp, unsigned char *input, long int input_len, char **rval, long int *rval_len) { *rval_len = html_entities_decode_inplace(mptmp, input, input_len); *rval = (char *)input; return (*rval_len == input_len ? 0 : 1); } /* escapeSeqDecode */ static int msre_fn_escapeSeqDecode_execute(apr_pool_t *mptmp, unsigned char *input, long int input_len, char **rval, long int *rval_len) { *rval_len = ansi_c_sequences_decode_inplace(input, input_len); *rval = (char *)input; return (*rval_len == input_len ? 0 : 1); } /* normalizePath */ static int msre_fn_normalizePath_execute(apr_pool_t *mptmp, unsigned char *input, long int input_len, char **rval, long int *rval_len) { int changed; *rval_len = normalize_path_inplace(input, input_len, 0, &changed); *rval = (char *)input; return changed; } /* normalizePathWin */ static int msre_fn_normalizePathWin_execute(apr_pool_t *mptmp, unsigned char *input, long int input_len, char **rval, long int *rval_len) { int changed; *rval_len = normalize_path_inplace(input, input_len, 1, &changed); *rval = (char *)input; return changed; } /* parityEven7bit */ static int msre_fn_parityEven7bit_execute(apr_pool_t *mptmp, unsigned char *input, long int input_len, char **rval, long int *rval_len) { long int i; int changed = 0; if (rval == NULL) return -1; *rval = NULL; i = 0; while(i < input_len) { unsigned int x = input[i]; input[i] ^= input[i] >> 4; input[i] &= 0xf; if ((0x6996 >> input[i]) & 1) { input[i] = x | 0x80; } else { input[i] = x & 0x7f; } if (x != input[i]) changed = 1; i++; } *rval = (char *)input; *rval_len = input_len; return changed; } /* parityZero7bit */ static int msre_fn_parityZero7bit_execute(apr_pool_t *mptmp, unsigned char *input, long int input_len, char **rval, long int *rval_len) { long int i; int changed = 0; if (rval == NULL) return -1; *rval = NULL; i = 0; while(i < input_len) { unsigned char c = input[i]; input[i] &= 0x7f; if (c != input[i]) changed = 1; i++; } *rval = (char *)input; *rval_len = input_len; return changed; } /* parityOdd7bit */ static int msre_fn_parityOdd7bit_execute(apr_pool_t *mptmp, unsigned char *input, long int input_len, char **rval, long int *rval_len) { long int i; int changed = 0; if (rval == NULL) return -1; *rval = NULL; i = 0; while(i < input_len) { unsigned int x = input[i]; input[i] ^= input[i] >> 4; input[i] &= 0xf; if ((0x6996 >> input[i]) & 1) { input[i] = x & 0x7f; } else { input[i] = x | 0x80; } if (x != input[i]) changed = 1; i++; } *rval = (char *)input; *rval_len = input_len; return changed; } /** * \brief Base64 transformation function based on RFC2045 * * \param mptmp Pointer to resource pool * \param input Pointer to input data * \param input_len Input data length * \param rval Pointer to decoded buffer * \param rval_len Decoded buffer length * * \retval 0 On failure * \retval 1 On Success */ static int msre_fn_base64DecodeExt_execute(apr_pool_t *mptmp, unsigned char *input, long int input_len, char **rval, long int *rval_len) { *rval_len = input_len; *rval = apr_palloc(mptmp, *rval_len); *rval_len = decode_base64_ext(*rval, (const unsigned char *)input, input_len); return *rval_len ? 1 : 0; } /* ------------------------------------------------------------------------------ */ /** * Registers one transformation function with the engine. */ void msre_engine_tfn_register(msre_engine *engine, const char *name, fn_tfn_execute_t execute) { msre_tfn_metadata *metadata = (msre_tfn_metadata *)apr_pcalloc(engine->mp, sizeof(msre_tfn_metadata)); if (metadata == NULL) return; metadata->name = name; metadata->execute = execute; apr_table_setn(engine->tfns, name, (void *)metadata); } /** * Returns transformation function metadata given a name. */ msre_tfn_metadata *msre_engine_tfn_resolve(msre_engine *engine, const char *name) { return (msre_tfn_metadata *)apr_table_get(engine->tfns, name); } /** * Register the default transformation functions. */ void msre_engine_register_default_tfns(msre_engine *engine) { /* none */ msre_engine_tfn_register(engine, "none", NULL ); /* base64Decode */ msre_engine_tfn_register(engine, "base64Decode", msre_fn_base64Decode_execute ); /* base64Encode */ msre_engine_tfn_register(engine, "base64Encode", msre_fn_base64Encode_execute ); /* compressWhitespace */ msre_engine_tfn_register(engine, "compressWhitespace", msre_fn_compressWhitespace_execute ); /* cssDecode */ msre_engine_tfn_register(engine, "cssDecode", msre_fn_cssDecode_execute ); /* escapeSeqDecode */ msre_engine_tfn_register(engine, "escapeSeqDecode", msre_fn_escapeSeqDecode_execute ); /* sqlHexDecode */ msre_engine_tfn_register(engine, "sqlHexDecode", msre_fn_sqlHexDecode_execute ); /* hexDecode */ msre_engine_tfn_register(engine, "hexDecode", msre_fn_hexDecode_execute ); /* hexEncode */ msre_engine_tfn_register(engine, "hexEncode", msre_fn_hexEncode_execute ); /* htmlEntityDecode */ msre_engine_tfn_register(engine, "htmlEntityDecode", msre_fn_htmlEntityDecode_execute ); /* jsDecode */ msre_engine_tfn_register(engine, "jsDecode", msre_fn_jsDecode_execute ); /* length */ msre_engine_tfn_register(engine, "length", msre_fn_length_execute ); /* lowercase */ msre_engine_tfn_register(engine, "lowercase", msre_fn_lowercase_execute ); /* md5 */ msre_engine_tfn_register(engine, "md5", msre_fn_md5_execute ); /* normalisePath */ msre_engine_tfn_register(engine, "normalisePath", msre_fn_normalizePath_execute ); /* normalizePath */ msre_engine_tfn_register(engine, "normalizePath", msre_fn_normalizePath_execute ); /* normalisePathWin */ msre_engine_tfn_register(engine, "normalisePathWin", msre_fn_normalizePathWin_execute ); /* normalizePathWin */ msre_engine_tfn_register(engine, "normalizePathWin", msre_fn_normalizePathWin_execute ); /* parityEven7bit */ msre_engine_tfn_register(engine, "parityEven7bit", msre_fn_parityEven7bit_execute ); /* parityZero7bit */ msre_engine_tfn_register(engine, "parityZero7bit", msre_fn_parityZero7bit_execute ); /* parityOdd7bit */ msre_engine_tfn_register(engine, "parityOdd7bit", msre_fn_parityOdd7bit_execute ); /* removeWhitespace */ msre_engine_tfn_register(engine, "removeWhitespace", msre_fn_removeWhitespace_execute ); /* removeNulls */ msre_engine_tfn_register(engine, "removeNulls", msre_fn_removeNulls_execute ); /* replaceNulls */ msre_engine_tfn_register(engine, "replaceNulls", msre_fn_replaceNulls_execute ); /* removeComments */ msre_engine_tfn_register(engine, "removeComments", msre_fn_removeComments_execute ); /* removeCommentsChar */ msre_engine_tfn_register(engine, "removeCommentsChar", msre_fn_removeCommentsChar_execute ); /* replaceComments */ msre_engine_tfn_register(engine, "replaceComments", msre_fn_replaceComments_execute ); /* sha1 */ msre_engine_tfn_register(engine, "sha1", msre_fn_sha1_execute ); /* trim */ msre_engine_tfn_register(engine, "trim", msre_fn_trim_execute ); /* trimLeft */ msre_engine_tfn_register(engine, "trimLeft", msre_fn_trimLeft_execute ); msre_engine_tfn_register(engine, "cmdline", msre_fn_cmdline_execute ); /* trimRight */ msre_engine_tfn_register(engine, "trimRight", msre_fn_trimRight_execute ); /* urlDecode */ msre_engine_tfn_register(engine, "urlDecode", msre_fn_urlDecode_execute ); /* urlDecodeUni */ msre_engine_tfn_register(engine, "urlDecodeUni", msre_fn_urlDecodeUni_execute ); /* Utf8Unicode */ msre_engine_tfn_register(engine, "Utf8toUnicode", msre_fn_utf8Unicode_execute ); /* urlEncode */ msre_engine_tfn_register(engine, "urlEncode", msre_fn_urlEncode_execute ); /* base64DecodeExt */ msre_engine_tfn_register(engine, "base64DecodeExt", msre_fn_base64DecodeExt_execute ); } modsecurity-apache_2.7.7/apache2/modules.mk0000664000175000017500000000145112252647335021151 0ustar zimmerlezimmerleMOD_SECURITY2 = mod_security2 apache2_config apache2_io apache2_util \ re re_operators re_actions re_tfns re_variables \ msc_logging msc_xml msc_multipart modsecurity msc_parsers msc_util msc_pcre \ persist_dbm msc_reqbody pdf_protect msc_geo msc_gsb msc_crypt msc_tree msc_unicode acmp msc_lua H = re.h modsecurity.h msc_logging.h msc_multipart.h msc_parsers.h \ msc_pcre.h msc_util.h msc_xml.h persist_dbm.h apache2.h pdf_protect.h \ msc_geo.h msc_gsb.h msc_crypt.h msc_tree.h msc_unicode.h acmp.h utf8tables.h msc_lua.h ${MOD_SECURITY2:=.slo}: ${H} ${MOD_SECURITY2:=.lo}: ${H} ${MOD_SECURITY2:=.o}: ${H} mod_security2.la: ${MOD_SECURITY2:=.slo} $(SH_LINK) -rpath $(libexecdir) -module -avoid-version ${MOD_SECURITY2:=.lo} DISTCLEAN_TARGETS = modules.mk shared = mod_security2.la modsecurity-apache_2.7.7/apache2/modsecurity.c0000664000175000017500000006012312253711345021656 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #include #include "apr_global_mutex.h" #include "modsecurity.h" #include "msc_parsers.h" #include "msc_util.h" #include "msc_xml.h" #include "apr_version.h" unsigned long int DSOLOCAL unicode_codepage = 0; int DSOLOCAL *unicode_map_table = NULL; /** * Format an alert message. */ const char * msc_alert_message(modsec_rec *msr, msre_actionset *actionset, const char *action_message, const char *rule_message) { const char *message = NULL; if (rule_message == NULL) rule_message = "Unknown error."; if (action_message == NULL) { message = apr_psprintf(msr->mp, "%s%s", rule_message, msre_format_metadata(msr, actionset)); } else { message = apr_psprintf(msr->mp, "%s %s%s", action_message, rule_message, msre_format_metadata(msr, actionset)); } return message; } /** * Log an alert message to the log, adding the rule metadata at the end. */ void msc_alert(modsec_rec *msr, int level, msre_actionset *actionset, const char *action_message, const char *rule_message) { const char *message = msc_alert_message(msr, actionset, action_message, rule_message); msr_log(msr, level, "%s", message); } #if 0 /** * Return phase name associated with the given phase number. */ static const char *phase_name(int phase) { switch(phase) { case 1 : return "REQUEST_HEADERS"; break; case 2 : return "REQUEST_BODY"; break; case 3 : return "RESPONSE_HEADERS"; break; case 4 : return "RESPONSE_BODY"; break; case 5 : return "LOGGING"; break; } return "INVALID"; } #endif /** * Creates and initialises a ModSecurity engine instance. */ msc_engine *modsecurity_create(apr_pool_t *mp, int processing_mode) { msc_engine *msce = NULL; msce = apr_pcalloc(mp, sizeof(msc_engine)); if (msce == NULL) return NULL; msce->mp = mp; msce->processing_mode = processing_mode; msce->msre = msre_engine_create(msce->mp); if (msce->msre == NULL) return NULL; msre_engine_register_default_variables(msce->msre); msre_engine_register_default_operators(msce->msre); msre_engine_register_default_tfns(msce->msre); msre_engine_register_default_actions(msce->msre); // TODO: msre_engine_register_default_reqbody_processors(msce->msre); return msce; } /** * Initialise the modsecurity engine. This function must be invoked * after configuration processing is complete as Apache needs to know the * username it is running as. */ int modsecurity_init(msc_engine *msce, apr_pool_t *mp) { apr_status_t rc; /* Serial audit log mutext */ rc = apr_global_mutex_create(&msce->auditlog_lock, NULL, APR_LOCK_DEFAULT, mp); if (rc != APR_SUCCESS) { //ap_log_error(APLOG_MARK, APLOG_ERR, rv, s, "mod_security: Could not create modsec_auditlog_lock"); //return HTTP_INTERNAL_SERVER_ERROR; return -1; } #if !defined(MSC_TEST) #ifdef __SET_MUTEX_PERMS #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER > 2 rc = ap_unixd_set_global_mutex_perms(msce->auditlog_lock); #else rc = unixd_set_global_mutex_perms(msce->auditlog_lock); #endif if (rc != APR_SUCCESS) { // ap_log_error(APLOG_MARK, APLOG_ERR, rc, s, "mod_security: Could not set permissions on modsec_auditlog_lock; check User and Group directives"); // return HTTP_INTERNAL_SERVER_ERROR; return -1; } #endif /* SET_MUTEX_PERMS */ rc = apr_global_mutex_create(&msce->geo_lock, NULL, APR_LOCK_DEFAULT, mp); if (rc != APR_SUCCESS) { return -1; } #ifdef __SET_MUTEX_PERMS #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER > 2 rc = ap_unixd_set_global_mutex_perms(msce->geo_lock); #else rc = unixd_set_global_mutex_perms(msce->geo_lock); #endif if (rc != APR_SUCCESS) { return -1; } #endif /* SET_MUTEX_PERMS */ #endif return 1; } /** * Performs per-child (new process) initialisation. */ void modsecurity_child_init(msc_engine *msce) { /* Need to call this once per process before any other XML calls. */ xmlInitParser(); if (msce->auditlog_lock != NULL) { apr_status_t rc = apr_global_mutex_child_init(&msce->auditlog_lock, NULL, msce->mp); if (rc != APR_SUCCESS) { // ap_log_error(APLOG_MARK, APLOG_ERR, rs, s, "Failed to child-init auditlog mutex"); } } if (msce->geo_lock != NULL) { apr_status_t rc = apr_global_mutex_child_init(&msce->geo_lock, NULL, msce->mp); if (rc != APR_SUCCESS) { // ap_log_error(APLOG_MARK, APLOG_ERR, rs, s, "Failed to child-init geo mutex"); } } } /** * Releases resources held by engine instance. */ void modsecurity_shutdown(msc_engine *msce) { if (msce == NULL) return; } /** * */ static void modsecurity_persist_data(modsec_rec *msr) { const apr_array_header_t *arr; apr_table_entry_t *te; apr_time_t time_before, time_after; int i; time_before = apr_time_now(); /* Collections, store & remove stale. */ arr = apr_table_elts(msr->collections); te = (apr_table_entry_t *)arr->elts; for (i = 0; i < arr->nelts; i++) { apr_table_t *col = (apr_table_t *)te[i].val; /* Only store those collections that changed. */ if (apr_table_get(msr->collections_dirty, te[i].key)) { collection_store(msr, col); } } time_after = apr_time_now(); msr->time_storage_write += time_after - time_before; if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Recording persistent data took %" APR_TIME_T_FMT " microseconds.", msr->time_gc); } /* Remove stale collections. */ srand(time(NULL)); if (rand() < RAND_MAX/100) { arr = apr_table_elts(msr->collections); te = (apr_table_entry_t *)arr->elts; for (i = 0; i < arr->nelts; i++) { collections_remove_stale(msr, te[i].key); } msr->time_gc = apr_time_now() - time_after; if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Garbage collection took %" APR_TIME_T_FMT " microseconds.", msr->time_gc); } } } /** * */ static apr_status_t modsecurity_tx_cleanup(void *data) { modsec_rec *msr = (modsec_rec *)data; char *my_error_msg = NULL; if (msr == NULL) return APR_SUCCESS; /* Multipart processor cleanup. */ if (msr->mpd != NULL) multipart_cleanup(msr); /* XML processor cleanup. */ if (msr->xml != NULL) xml_cleanup(msr); // TODO: Why do we ignore return code here? modsecurity_request_body_clear(msr, &my_error_msg); if (my_error_msg != NULL) { msr_log(msr, 1, "%s", my_error_msg); } #if defined(WITH_LUA) #ifdef CACHE_LUA if(msr->L != NULL) lua_close(msr->L); #endif #endif return APR_SUCCESS; } /** * */ apr_status_t modsecurity_tx_init(modsec_rec *msr) { const char *s = NULL; const apr_array_header_t *arr; char *semicolon = NULL; char *comma = NULL; apr_table_entry_t *te; int i; /* Register TX cleanup */ apr_pool_cleanup_register(msr->mp, msr, modsecurity_tx_cleanup, apr_pool_cleanup_null); /* Initialise C-L */ msr->request_content_length = -1; s = apr_table_get(msr->request_headers, "Content-Length"); if (s != NULL) { msr->request_content_length = strtol(s, NULL, 10); } /* Figure out whether this request has a body */ msr->reqbody_chunked = 0; msr->reqbody_should_exist = 0; if (msr->request_content_length == -1) { /* There's no C-L, but is chunked encoding used? */ char *transfer_encoding = (char *)apr_table_get(msr->request_headers, "Transfer-Encoding"); if ((transfer_encoding != NULL)&&(m_strcasestr(transfer_encoding, "chunked") != NULL)) { msr->reqbody_should_exist = 1; msr->reqbody_chunked = 1; } } else { /* C-L found */ msr->reqbody_should_exist = 1; } /* Initialise C-T */ msr->request_content_type = NULL; s = apr_table_get(msr->request_headers, "Content-Type"); if (s != NULL) msr->request_content_type = s; /* Decide what to do with the request body. */ if ((msr->request_content_type != NULL) && (strncasecmp(msr->request_content_type, "application/x-www-form-urlencoded", 33) == 0)) { /* Always place POST requests with * "application/x-www-form-urlencoded" payloads in memory. */ msr->msc_reqbody_storage = MSC_REQBODY_MEMORY; msr->msc_reqbody_spilltodisk = 0; msr->msc_reqbody_processor = "URLENCODED"; } else { /* If the C-L is known and there's more data than * our limit go to disk straight away. */ if ((msr->request_content_length != -1) && (msr->request_content_length > msr->txcfg->reqbody_inmemory_limit)) { msr->msc_reqbody_storage = MSC_REQBODY_DISK; } /* In all other cases, try using the memory first * but switch over to disk for larger bodies. */ msr->msc_reqbody_storage = MSC_REQBODY_MEMORY; msr->msc_reqbody_spilltodisk = 1; if (msr->request_content_type != NULL) { if (strncasecmp(msr->request_content_type, "multipart/form-data", 19) == 0) { msr->msc_reqbody_processor = "MULTIPART"; } } } /* Check if we are forcing buffering, then use memory only. */ if (msr->txcfg->reqbody_buffering != REQUEST_BODY_FORCEBUF_OFF) { msr->msc_reqbody_storage = MSC_REQBODY_MEMORY; msr->msc_reqbody_spilltodisk = 0; } /* Initialise arguments */ msr->arguments = apr_table_make(msr->mp, 32); if (msr->arguments == NULL) return -1; if (msr->query_string != NULL) { int invalid_count = 0; if (parse_arguments(msr, msr->query_string, strlen(msr->query_string), msr->txcfg->argument_separator, "QUERY_STRING", msr->arguments, &invalid_count) < 0) { msr_log(msr, 1, "Initialisation: Error occurred while parsing QUERY_STRING arguments."); return -1; } if (invalid_count) { msr->urlencoded_error = 1; } } msr->arguments_to_sanitize = apr_table_make(msr->mp, 16); if (msr->arguments_to_sanitize == NULL) return -1; msr->request_headers_to_sanitize = apr_table_make(msr->mp, 16); if (msr->request_headers_to_sanitize == NULL) return -1; msr->response_headers_to_sanitize = apr_table_make(msr->mp, 16); if (msr->response_headers_to_sanitize == NULL) return -1; msr->pattern_to_sanitize = apr_table_make(msr->mp, 32); if (msr->pattern_to_sanitize == NULL) return -1; /* remove targets */ msr->removed_targets = apr_table_make(msr->mp, 16); if (msr->removed_targets == NULL) return -1; /* Initialise cookies */ msr->request_cookies = apr_table_make(msr->mp, 16); if (msr->request_cookies == NULL) return -1; /* Initialize matched vars */ msr->matched_vars = apr_table_make(msr->mp, 8); if (msr->matched_vars == NULL) return -1; apr_table_clear(msr->matched_vars); msr->perf_rules = apr_table_make(msr->mp, 8); if (msr->perf_rules == NULL) return -1; apr_table_clear(msr->perf_rules); /* Locate the cookie headers and parse them */ arr = apr_table_elts(msr->request_headers); te = (apr_table_entry_t *)arr->elts; for (i = 0; i < arr->nelts; i++) { if (strcasecmp(te[i].key, "Cookie") == 0) { if (msr->txcfg->cookie_format == COOKIES_V0) { semicolon = apr_pstrdup(msr->mp, te[i].val); while((*semicolon != 0)&&(*semicolon != ';')) semicolon++; if(*semicolon == ';') { parse_cookies_v0(msr, te[i].val, msr->request_cookies, ";"); } else { comma = apr_pstrdup(msr->mp, te[i].val); while((*comma != 0)&&(*comma != ',')) comma++; if(*comma == ',') { comma++; if(*comma == 0x20) {// looks like comma is the separator if (msr->txcfg->debuglog_level >= 5) { msr_log(msr, 5, "Cookie v0 parser: Using comma as a separator. Semi-colon was not identified!"); } parse_cookies_v0(msr, te[i].val, msr->request_cookies, ","); } else { parse_cookies_v0(msr, te[i].val, msr->request_cookies, ";"); } } else { parse_cookies_v0(msr, te[i].val, msr->request_cookies, ";"); } } } else { parse_cookies_v1(msr, te[i].val, msr->request_cookies); } } } /* Collections. */ msr->tx_vars = apr_table_make(msr->mp, 32); if (msr->tx_vars == NULL) return -1; msr->geo_vars = apr_table_make(msr->mp, 8); if (msr->geo_vars == NULL) return -1; msr->collections_original = apr_table_make(msr->mp, 8); if (msr->collections_original == NULL) return -1; msr->collections = apr_table_make(msr->mp, 8); if (msr->collections == NULL) return -1; msr->collections_dirty = apr_table_make(msr->mp, 8); if (msr->collections_dirty == NULL) return -1; /* Other */ msr->tcache = NULL; msr->tcache_items = 0; msr->matched_rules = apr_array_make(msr->mp, 16, sizeof(void *)); if (msr->matched_rules == NULL) return -1; msr->matched_var = (msc_string *)apr_pcalloc(msr->mp, sizeof(msc_string)); if (msr->matched_var == NULL) return -1; msr->highest_severity = 255; /* high, invalid value */ msr->removed_rules = apr_array_make(msr->mp, 16, sizeof(char *)); if (msr->removed_rules == NULL) return -1; msr->removed_rules_tag = apr_array_make(msr->mp, 16, sizeof(char *)); if (msr->removed_rules_tag == NULL) return -1; msr->removed_rules_msg = apr_array_make(msr->mp, 16, sizeof(char *)); if (msr->removed_rules_msg == NULL) return -1; return 1; } /** * */ static int is_response_status_relevant(modsec_rec *msr, int status) { char *my_error_msg = NULL; apr_status_t rc; char buf[32]; /* ENH: Setting is_relevant here will cause an audit even if noauditlog * was set for the last rule that matched. Is this what we want? */ if ((msr->txcfg->auditlog_relevant_regex == NULL) ||(msr->txcfg->auditlog_relevant_regex == NOT_SET_P)) { return 0; } apr_snprintf(buf, sizeof(buf), "%d", status); rc = msc_regexec(msr->txcfg->auditlog_relevant_regex, buf, strlen(buf), &my_error_msg); if (rc >= 0) return 1; if (rc == PCRE_ERROR_NOMATCH) return 0; msr_log(msr, 1, "Regex processing failed (rc %d): %s", rc, my_error_msg); return 0; } /** * */ static apr_status_t modsecurity_process_phase_request_headers(modsec_rec *msr) { apr_time_t time_before; apr_status_t rc = 0; if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Starting phase REQUEST_HEADERS."); } time_before = apr_time_now(); if (msr->txcfg->ruleset != NULL) { rc = msre_ruleset_process_phase(msr->txcfg->ruleset, msr); } msr->time_phase1 = apr_time_now() - time_before; return rc; } /** * */ static apr_status_t modsecurity_process_phase_request_body(modsec_rec *msr) { apr_time_t time_before; apr_status_t rc = 0; if ((msr->allow_scope == ACTION_ALLOW_REQUEST)||(msr->allow_scope == ACTION_ALLOW)) { if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Skipping phase REQUEST_BODY (allow used)."); } return 0; } else { if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Starting phase REQUEST_BODY."); } } time_before = apr_time_now(); if (msr->txcfg->ruleset != NULL) { rc = msre_ruleset_process_phase(msr->txcfg->ruleset, msr); } msr->time_phase2 = apr_time_now() - time_before; return rc; } /** * */ static apr_status_t modsecurity_process_phase_response_headers(modsec_rec *msr) { apr_time_t time_before; apr_status_t rc = 0; if (msr->allow_scope == ACTION_ALLOW) { if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Skipping phase RESPONSE_HEADERS (allow used)."); } return 0; } else { if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Starting phase RESPONSE_HEADERS."); } } time_before = apr_time_now(); if (msr->txcfg->ruleset != NULL) { rc = msre_ruleset_process_phase(msr->txcfg->ruleset, msr); } msr->time_phase3 = apr_time_now() - time_before; return rc; } /** * */ static apr_status_t modsecurity_process_phase_response_body(modsec_rec *msr) { apr_time_t time_before; apr_status_t rc = 0; if (msr->allow_scope == ACTION_ALLOW) { if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Skipping phase RESPONSE_BODY (allow used)."); } return 0; } else { if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Starting phase RESPONSE_BODY."); } } time_before = apr_time_now(); if (msr->txcfg->ruleset != NULL) { rc = msre_ruleset_process_phase(msr->txcfg->ruleset, msr); } msr->time_phase4 = apr_time_now() - time_before; return rc; } /** * */ static apr_status_t modsecurity_process_phase_logging(modsec_rec *msr) { apr_time_t time_before, time_after; if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Starting phase LOGGING."); } time_before = apr_time_now(); if (msr->txcfg->ruleset != NULL) { msre_ruleset_process_phase(msr->txcfg->ruleset, msr); } modsecurity_persist_data(msr); time_after = apr_time_now(); msr->time_phase5 = time_after - time_before; /* Is this request relevant for logging purposes? */ if (msr->is_relevant == 0) { /* Check the status */ msr->is_relevant += is_response_status_relevant(msr, msr->r->status); /* If we processed two requests and statuses are different then * check the other status too. */ if (msr->r_early->status != msr->r->status) { msr->is_relevant += is_response_status_relevant(msr, msr->r_early->status); } } /* Figure out if we want to keep the files (if there are any, of course). */ if ((msr->txcfg->upload_keep_files == KEEP_FILES_ON) || ((msr->txcfg->upload_keep_files == KEEP_FILES_RELEVANT_ONLY)&&(msr->is_relevant))) { msr->upload_remove_files = 0; } else { msr->upload_remove_files = 1; } /* Are we configured for audit logging? */ switch(msr->txcfg->auditlog_flag) { case AUDITLOG_OFF : if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Audit log: Not configured to run for this request."); } return DECLINED; break; case AUDITLOG_RELEVANT : if (msr->is_relevant == 0) { if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Audit log: Ignoring a non-relevant request."); } return DECLINED; } break; case AUDITLOG_ON : /* All right, do nothing */ break; default : msr_log(msr, 1, "Internal error: Could not determine if auditing is needed, so forcing auditing."); break; } /* Invoke the Audit logger */ if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Audit log: Logging this transaction."); } sec_audit_logger(msr); msr->time_logging = apr_time_now() - time_after; return 0; } /** * Processes one transaction phase. The phase number does not * need to be explicitly provided since it's already available * in the modsec_rec structure. */ apr_status_t modsecurity_process_phase(modsec_rec *msr, unsigned int phase) { /* Check if we should run. */ if ((msr->was_intercepted)&&(phase != PHASE_LOGGING)) { if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Skipping phase %d as request was already intercepted.", phase); } return 0; } /* Do not process the same phase twice. */ if (msr->phase >= phase) { if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Skipping phase %d because it was previously run (at %d now).", phase, msr->phase); } return 0; } msr->phase = phase; /* Clear out the transformation cache at the start of each phase */ if (msr->txcfg->cache_trans == MODSEC_CACHE_ENABLED) { if (msr->tcache) { apr_hash_index_t *hi; void *dummy; apr_table_t *tab; const void *key; apr_ssize_t klen; #ifdef CACHE_DEBUG apr_pool_t *mp = msr->msc_rule_mptmp; const apr_array_header_t *ctarr; const apr_table_entry_t *ctelts; msre_cache_rec *rec; int cn = 0; int ri; #else apr_pool_t *mp = msr->mp; #endif for (hi = apr_hash_first(mp, msr->tcache); hi; hi = apr_hash_next(hi)) { apr_hash_this(hi, &key, &klen, &dummy); tab = (apr_table_t *)dummy; if (tab == NULL) continue; #ifdef CACHE_DEBUG /* Dump the cache out as we clear */ ctarr = apr_table_elts(tab); ctelts = (const apr_table_entry_t*)ctarr->elts; for (ri = 0; ri < ctarr->nelts; ri++) { cn++; rec = (msre_cache_rec *)ctelts[ri].val; if (rec->changed) { if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "CACHE: %5d) hits=%d key=%pp %x;%s=\"%s\" (%pp - %pp)", cn, rec->hits, key, rec->num, rec->path, log_escape_nq_ex(mp, rec->val, rec->val_len), rec->val, rec->val + rec->val_len); } } else { if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "CACHE: %5d) hits=%d key=%pp %x;%s=", cn, rec->hits, key, rec->num, rec->path); } } } #endif apr_table_clear(tab); apr_hash_set(msr->tcache, key, klen, NULL); } if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Cleared transformation cache for phase %d", msr->phase); } } msr->tcache_items = 0; msr->tcache = apr_hash_make(msr->mp); if (msr->tcache == NULL) return -1; } switch(phase) { case 1 : return modsecurity_process_phase_request_headers(msr); case 2 : return modsecurity_process_phase_request_body(msr); case 3 : return modsecurity_process_phase_response_headers(msr); case 4 : return modsecurity_process_phase_response_body(msr); case 5 : return modsecurity_process_phase_logging(msr); default : msr_log(msr, 1, "Invalid processing phase: %d", msr->phase); break; } return -1; } modsecurity-apache_2.7.7/apache2/msc_lua.h0000664000175000017500000000242112243422537020735 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #if defined(WITH_LUA) #ifndef _MSC_LUA_H_ #define _MSC_LUA_H_ typedef struct msc_script msc_script; typedef struct msc_script_part msc_script_part; #include #include #include #include "apr_general.h" #include "apr_tables.h" #include "modsecurity.h" struct msc_script { const char *name; apr_array_header_t *parts; }; struct msc_script_part { const void *data; size_t len; }; char DSOLOCAL *lua_compile(msc_script **script, const char *filename, apr_pool_t *pool); int DSOLOCAL lua_execute(msc_script *script, char *param, modsec_rec *msr, msre_rule *rule, char **error_msg); apr_status_t DSOLOCAL msre_action_setvar_execute(modsec_rec *r, apr_pool_t *, msre_rule *, char *, char *); #endif #endif /* WITH_LUA */ modsecurity-apache_2.7.7/apache2/persist_dbm.h0000664000175000017500000000162612243422537021633 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #ifndef _PERSIST_DBM_H_ #define _PERSIST_DBM_H_ #include "apr_general.h" #include "modsecurity.h" apr_table_t DSOLOCAL *collection_retrieve(modsec_rec *msr, const char *col_name, const char *col_value, int col_value_length); int DSOLOCAL collection_store(modsec_rec *msr, apr_table_t *collection); int DSOLOCAL collections_remove_stale(modsec_rec *msr, const char *col_name); #endif modsecurity-apache_2.7.7/apache2/msc_geo.h0000664000175000017500000000361212243422537020731 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #ifndef _MSC_GEO_H_ #define _MSC_GEO_H_ #define GEO_STRUCT_INFO_MAX_SIZE 20 #define GEO_DB_INFO_MAX_SIZE 100 #define GEO_COUNTRY_OFFSET 0xffff00 #define GEO_MAX_RECORD_LEN 4 #define GEO_COUNTRY_UNKNOWN "Unknown" #define GEO_CITY_UNKNOWN "Unknown" #define GEO_CITY_RECORD_LEN 50 #define GEO_COUNTRY_DATABASE 1 #define GEO_CITY_DATABASE_0 6 #define GEO_CITY_DATABASE_1 2 #define GEO_COUNTRY_LAST 250 #define GEO_SEGMENT_RECORD_LENGTH 3 #define GEO_STATE_BEGIN_REV0 16700000 #define GEO_STATE_BEGIN_REV1 16000000 #define GEO_COUNTRY_BEGIN 16776960 typedef struct geo_rec geo_rec; typedef struct geo_db geo_db; #include #include "modsecurity.h" /* Structures */ struct geo_rec { const char *country_code; const char *country_code3; const char *country_name; const char *country_continent; const char *region; const char *city; const char *postal_code; float latitude; float longitude; int dma_code; int area_code; }; struct geo_db { apr_file_t *db; const char *dbfn; int dbtype; unsigned int ctry_offset; }; /* Functions */ int DSOLOCAL geo_init(directory_config *dcfg, const char *dbfn, char **error_msg); int DSOLOCAL geo_lookup(modsec_rec *msr, geo_rec *rec, const char *target, char **error_msg); #endif modsecurity-apache_2.7.7/apache2/msc_gsb.c0000664000175000017500000000643512243422537020733 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #include "msc_gsb.h" /** \brief Load GSB database * * \param dcfg Pointer to directory configuration * \param error_msg Error message * * \retval 1 On Success * \retval 0 On Fail */ static int gsb_db_create(directory_config *dcfg, char **error_msg) { char errstr[1024]; apr_pool_t *mp = dcfg->mp; gsb_db *gsb = dcfg->gsb; apr_int32_t wanted = APR_FINFO_SIZE; apr_finfo_t finfo; apr_status_t rc; apr_size_t nbytes; char *buf = NULL, *p = NULL, *savedptr = NULL; char *op = NULL; if ((rc = apr_file_open(&gsb->db, gsb->dbfn, APR_READ, APR_OS_DEFAULT, mp)) != APR_SUCCESS) { *error_msg = apr_psprintf(mp, "Could not open gsb database \"%s\": %s", gsb->dbfn, apr_strerror(rc, errstr, 1024)); return 0; } if ((rc = apr_file_info_get(&finfo, wanted, gsb->db)) != APR_SUCCESS) { *error_msg = apr_psprintf(mp, "Could not cannot get gsb malware file information \"%s\": %s", gsb->dbfn, apr_strerror(rc, errstr, 1024)); apr_file_close(gsb->db); return 0; } buf = (char *)malloc(finfo.size+1); if (buf == NULL) { *error_msg = apr_psprintf(mp, "Could not alloc memory for gsb data"); apr_file_close(gsb->db); return 0; } rc = apr_file_read_full(gsb->db, buf, finfo.size, &nbytes); gsb->gsb_table = apr_hash_make(dcfg->mp); if (gsb->gsb_table == NULL) { *error_msg = apr_psprintf(mp, "Could not alloc memory for gsb table"); free(buf); buf = NULL; apr_file_close(gsb->db); return 0; } p = apr_strtok(buf,"\t",&savedptr); while (p != NULL) { op = strchr(p,'+'); if(op != NULL) { char *hash = ++op; if(strlen(hash) == 32) apr_hash_set(gsb->gsb_table, hash, APR_HASH_KEY_STRING, "malware"); } op = strchr(p,'-'); if(op != NULL) { char *hash = ++op; if(strlen(hash) == 32) apr_hash_set(gsb->gsb_table, hash, APR_HASH_KEY_STRING, NULL); } p = apr_strtok(NULL,"\t",&savedptr); } apr_file_close(gsb->db); free(buf); buf = NULL; return 1; } /** \brief Init GSB database * * \param dcfg Pointer to directory configuration * \param dbfn Database filename * \param error_msg Error message * * \retval gsb_db_create On Success * \retval -1 On Fail */ int gsb_db_init(directory_config *dcfg, const char *dbfn, char **error_msg) { *error_msg = NULL; if ((dcfg->gsb == NULL) || (dcfg->gsb == NOT_SET_P)) { dcfg->gsb = apr_pcalloc(dcfg->mp, sizeof(gsb_db)); if (dcfg->gsb == NULL) { return -1; } } dcfg->gsb->db = NULL; dcfg->gsb->dbfn = apr_pstrdup(dcfg->mp, dbfn); return gsb_db_create(dcfg, error_msg); } modsecurity-apache_2.7.7/apache2/libinjection/0000775000175000017500000000000012253711345021612 5ustar zimmerlezimmerlemodsecurity-apache_2.7.7/apache2/libinjection/libinjection.h0000664000175000017500000001702712253711345024443 0ustar zimmerlezimmerle/** * Copyright 2012, 2013 Nick Galbreath * nickg@client9.com * BSD License -- see COPYING.txt for details * * https://libinjection.client9.com/ * */ #ifndef _LIBINJECTION_H #define _LIBINJECTION_H #ifdef __cplusplus extern "C" { #endif /** * Libinjection's sqli module makes a "normalized" * value of the token. This is the maximum size * Token with values larger than this will be truncated */ #ifndef LIBINJECTION_SQLI_TOKEN_SIZE #define LIBINJECTION_SQLI_TOKEN_SIZE 32 #endif /** * Number of tokens used to create a fingerprint */ #ifndef LIBINJECTION_SQLI_MAX_TOKENS #define LIBINJECTION_SQLI_MAX_TOKENS 5 #endif #if LIBINJECTION_SQLI_MAX_TOKENS >= 8 #define LIBINJECTION_SQLI_BUFFER_SZ (LIBINJECTION_SQLI_MAX_TOKENS + 1) #else #define LIBINJECTION_SQLI_BUFFER_SZ 8 #endif enum lookup_type { FLAG_NONE = 0, FLAG_QUOTE_NONE = 1 << 1, FLAG_QUOTE_SINGLE = 1 << 2, FLAG_QUOTE_DOUBLE = 1 << 3, FLAG_SQL_ANSI = 1 << 4, FLAG_SQL_MYSQL = 1 << 5, LOOKUP_WORD, LOOKUP_TYPE, LOOKUP_OPERATOR, LOOKUP_FINGERPRINT }; struct libinjection_sqli_token { #ifdef SWIG %immutable; #endif char type; char str_open; char str_close; /* * position and length of token * in original string */ size_t pos; size_t len; /* count: * in type 'v', used for number of opening '@' * but maybe unsed in other contexts */ int count; char val[LIBINJECTION_SQLI_TOKEN_SIZE]; }; typedef struct libinjection_sqli_token stoken_t; /** * Pointer to function, takes cstr input, * returns '\0' for no match, else a char */ struct libinjection_sqli_state; typedef char (*ptr_lookup_fn)(struct libinjection_sqli_state*, int lookuptype, const char* word, size_t len); struct libinjection_sqli_state { #ifdef SWIG %immutable; #endif /* * input, does not need to be null terminated. * it is also not modified. */ const char *s; /* * input length */ size_t slen; /* * How to lookup a word or fingerprint */ ptr_lookup_fn lookup; void* userdata; /* * */ int flags; /* * pos is index in string we are at when tokenizing */ size_t pos; #ifndef SWIG /* for SWIG.. don't use this.. use functional API instead */ /* MAX TOKENS + 1 since we use one extra token * to determine the type of the previous token */ struct libinjection_sqli_token tokenvec[LIBINJECTION_SQLI_BUFFER_SZ]; #endif /* * Pointer to token position in tokenvec, above */ struct libinjection_sqli_token *current; /* * fingerprint pattern c-string * +1 for ending null * Mimimum of 8 bytes to add gcc's -fstack-protector to work */ char fingerprint[LIBINJECTION_SQLI_BUFFER_SZ]; /* * Line number of code that said decided if the input was SQLi or * not. Most of the time it's line that said "it's not a matching * fingerprint" but there is other logic that sometimes approves * an input. This is only useful for debugging. * */ int reason; /* Number of ddw (dash-dash-white) comments * These comments are in the form of * '--[whitespace]' or '--[EOF]' * * All databases treat this as a comment. */ int stats_comment_ddw; /* Number of ddx (dash-dash-[notwhite]) comments * * ANSI SQL treats these are comments, MySQL treats this as * two unary operators '-' '-' * * If you are parsing result returns FALSE and * stats_comment_dd > 0, you should reparse with * COMMENT_MYSQL * */ int stats_comment_ddx; /* * c-style comments found /x .. x/ */ int stats_comment_c; /* '#' operators or mysql EOL comments found * */ int stats_comment_hash; /* * number of tokens folded away */ int stats_folds; /* * total tokens processed */ int stats_tokens; }; struct libinjection_sqli_token* libinjection_sqli_get_token( struct libinjection_sqli_state* sqlistate, int i); typedef struct libinjection_sqli_state sfilter; /* * Version info. * * This is moved into a function to allow SWIG and other auto-generated * binding to not be modified during minor release changes. We change * change the version number in the c source file, and not regenerated * the binding * * See python's normalized version * http://www.python.org/dev/peps/pep-0386/#normalizedversion */ const char* libinjection_version(); /** * */ void libinjection_sqli_init(struct libinjection_sqli_state* sql_state, const char* s, size_t slen, int flags); /** * Main API: tests for SQLi in three possible contexts, no quotes, * single quote and double quote * * \param sql_state * \param s * \param slen * \param fn a pointer to a function that determines if a fingerprint * is a match or not. If NULL, then a hardwired list is * used. Useful for loading fingerprints data from custom * sources. * * \return 1 (true) if SQLi, 0 (false) if benign */ int libinjection_is_sqli(struct libinjection_sqli_state* sql_state); /* FOR H@CKERS ONLY * */ void libinjection_sqli_callback(struct libinjection_sqli_state* sql_state, ptr_lookup_fn fn, void* userdata); /* * Resets state, but keeps initial string and callbacks */ void libinjection_sqli_reset(struct libinjection_sqli_state* sql_state, int flags); /** * */ /** * This detects SQLi in a single context, mostly useful for custom * logic and debugging. * * \param sql_state * * \returns a pointer to sfilter.fingerprint as convenience * do not free! * */ const char* libinjection_sqli_fingerprint(struct libinjection_sqli_state* sql_state, int flags); /** * The default "word" to token-type or fingerprint function. This * uses a ASCII case-insensitive binary tree. */ char libinjection_sqli_lookup_word(struct libinjection_sqli_state* sql_state, int lookup_type, const char* s, size_t slen); /* Streaming tokenization interface. * * sql_state->current is updated with the current token. * * \returns 1, has a token, keep going, or 0 no tokens * */ int libinjection_sqli_tokenize(struct libinjection_sqli_state * sql_state); /** * parses and folds input, up to 5 tokens * */ int libinjection_sqli_fold(struct libinjection_sqli_state * sql_state); /** The built-in default function to match fingerprints * and do false negative/positive analysis. This calls the following * two functions. With this, you over-ride one part or the other. * * return libinjection_sqli_blacklist(sql_state) && * libinject_sqli_not_whitelist(sql_state); * * \param sql_state should be filled out after libinjection_sqli_fingerprint is called */ int libinjection_sqli_check_fingerprint(struct libinjection_sqli_state * sql_state); /* Given a pattern determine if it's a SQLi pattern. * * \return TRUE if sqli, false otherwise */ int libinjection_sqli_blacklist(struct libinjection_sqli_state* sql_state); /* Given a positive match for a pattern (i.e. pattern is SQLi), this function * does additional analysis to reduce false positives. * * \return TRUE if sqli, false otherwise */ int libinjection_sqli_not_whitelist(struct libinjection_sqli_state * sql_state); #ifdef __cplusplus } #endif #endif /* _LIBINJECTION_H */ modsecurity-apache_2.7.7/apache2/libinjection/COPYING.txt0000664000175000017500000000334012243422537023464 0ustar zimmerlezimmerle/* * Copyright 2012, 2013 * Nick Galbreath -- nickg [at] client9 [dot] com * http://www.client9.com/projects/libinjection/ * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 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. * * Neither the name of libinjection 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 COPYRIGHT HOLDERS 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 COPYRIGHT * OWNER 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. * * This is the standard "new" BSD license: * http://www.opensource.org/licenses/bsd-license.php */ modsecurity-apache_2.7.7/apache2/libinjection/libinjection_sqli.c0000664000175000017500000020740712253711345025471 0ustar zimmerlezimmerle/** * Copyright 2012,2013 Nick Galbreath * nickg@client9.com * BSD License -- see COPYING.txt for details * * https://libinjection.client9.com/ * */ #include #include #include #include #include #include #define LIBINJECTION_VERSION "3.8.0" #ifndef TRUE #define TRUE 1 #endif #ifndef FALSE #define FALSE 0 #endif #define CHAR_NULL '\0' #define CHAR_SINGLE '\'' #define CHAR_DOUBLE '"' #define CHAR_TICK '`' /* faster than calling out to libc isdigit */ #define ISDIGIT(a) ((unsigned)((a) - '0') <= 9) #if 0 #define FOLD_DEBUG printf("%d \t more=%d pos=%d left=%d\n", __LINE__, more, (int)pos, (int)left); #else #define FOLD_DEBUG #endif #include "libinjection_sqli_data.h" /* * not making public just yet */ typedef enum { TYPE_NONE = 0, TYPE_KEYWORD = (int)'k', TYPE_UNION = (int)'U', TYPE_GROUP = (int)'B', TYPE_EXPRESSION = (int)'E', TYPE_SQLTYPE = (int)'t', TYPE_FUNCTION = (int)'f', TYPE_BAREWORD = (int)'n', TYPE_NUMBER = (int)'1', TYPE_VARIABLE = (int)'v', TYPE_STRING = (int)'s', TYPE_OPERATOR = (int)'o', TYPE_LOGIC_OPERATOR = (int)'&', TYPE_COMMENT = (int)'c', TYPE_COLLATE = (int)'A', TYPE_LEFTPARENS = (int)'(', TYPE_RIGHTPARENS = (int)')', /* not used? */ TYPE_LEFTBRACE = (int)'{', TYPE_RIGHTBRACE = (int)'}', TYPE_DOT = (int)'.', TYPE_COMMA = (int)',', TYPE_COLON = (int)':', TYPE_SEMICOLON = (int)';', TYPE_TSQL = (int)'T', /* TSQL start */ TYPE_UNKNOWN = (int)'?', TYPE_EVIL = (int)'X', /* unparsable, abort */ TYPE_FINGERPRINT = (int)'F', /* not really a token */ TYPE_BACKSLASH = (int)'\\' } sqli_token_types; /** * Initializes parsing state * */ static char flag2delim(int flag) { if (flag & FLAG_QUOTE_SINGLE) { return CHAR_SINGLE; } else if (flag & FLAG_QUOTE_DOUBLE) { return CHAR_DOUBLE; } else { return CHAR_NULL; } } /* memchr2 finds a string of 2 characters inside another string * This a specialized version of "memmem" or "memchr". * 'memmem' doesn't exist on all platforms * * Porting notes: this is just a special version of * astring.find("AB") * */ static const char * memchr2(const char *haystack, size_t haystack_len, char c0, char c1) { const char *cur = haystack; const char *last = haystack + haystack_len - 1; if (haystack_len < 2) { return NULL; } while (cur < last) { if (cur[0] == c0) { if (cur[1] == c1) { return cur; } else { cur += 2; /* (c0 == c1) ? 1 : 2; */ } } else { cur += 1; } } return NULL; } /** * memmem might not exist on some systems */ static const char * my_memmem(const char* haystack, size_t hlen, const char* needle, size_t nlen) { const char* cur; const char* last; assert(haystack); assert(needle); assert(nlen > 1); last = haystack + hlen - nlen; for (cur = haystack; cur <= last; ++cur) { if (cur[0] == needle[0] && memcmp(cur, needle, nlen) == 0) { return cur; } } return NULL; } /** Find largest string containing certain characters. * * C Standard library 'strspn' only works for 'c-strings' (null terminated) * This works on arbitrary length. * * Performance notes: * not critical * * Porting notes: * if accept is 'ABC', then this function would be similar to * a_regexp.match(a_str, '[ABC]*'), */ static size_t strlenspn(const char *s, size_t len, const char *accept) { size_t i; for (i = 0; i < len; ++i) { /* likely we can do better by inlining this function * but this works for now */ if (strchr(accept, s[i]) == NULL) { return i; } } return len; } static size_t strlencspn(const char *s, size_t len, const char *accept) { size_t i; for (i = 0; i < len; ++i) { /* likely we can do better by inlining this function * but this works for now */ if (strchr(accept, s[i]) != NULL) { return i; } } return len; } static int char_is_white(char ch) { /* ' ' space is 0x32 '\t 0x09 \011 horizontal tab '\n' 0x0a \012 new line '\v' 0x0b \013 verical tab '\f' 0x0c \014 new page '\r' 0x0d \015 carriage return 0x00 \000 null (oracle) 0xa0 \240 is latin1 */ return strchr(" \t\n\v\f\r\240\000", ch) != NULL; } /* DANGER DANGER * This is -very specialized function- * * this compares a ALL_UPPER CASE C STRING * with a *arbitrary memory* + length * * Sane people would just make a copy, up-case * and use a hash table. * * Required since libc version uses the current locale * and is much slower. */ static int cstrcasecmp(const char *a, const char *b, size_t n) { char cb; for (; n > 0; a++, b++, n--) { cb = *b; if (cb >= 'a' && cb <= 'z') { cb -= 0x20; } if (*a != cb) { return *a - cb; } else if (*a == '\0') { return -1; } } return (*a == 0) ? 0 : 1; } /** * Case sensitive string compare. * Here only to make code more readable */ static int streq(const char *a, const char *b) { return strcmp(a, b) == 0; } /** * * * * Porting Notes: * given a mapping/hash of string to char * this is just * typecode = mapping[key.upper()] */ static char bsearch_keyword_type(const char *key, size_t len, const keyword_t * keywords, size_t numb) { size_t pos; size_t left = 0; size_t right = numb - 1; while (left < right) { pos = (left + right) >> 1; /* arg0 = upper case only, arg1 = mixed case */ if (cstrcasecmp(keywords[pos].word, key, len) < 0) { left = pos + 1; } else { right = pos; } } if ((left == right) && cstrcasecmp(keywords[left].word, key, len) == 0) { return keywords[left].type; } else { return CHAR_NULL; } } static char is_keyword(const char* key, size_t len) { return bsearch_keyword_type(key, len, sql_keywords, sql_keywords_sz); } /* st_token methods * * The following functions manipulates the stoken_t type * * */ static void st_clear(stoken_t * st) { memset(st, 0, sizeof(stoken_t)); } static void st_assign_char(stoken_t * st, const char stype, size_t pos, size_t len, const char value) { /* done to elimiate unused warning */ (void)len; st->type = (char) stype; st->pos = pos; st->len = 1; st->val[0] = value; st->val[1] = CHAR_NULL; } static void st_assign(stoken_t * st, const char stype, size_t pos, size_t len, const char* value) { const size_t MSIZE = LIBINJECTION_SQLI_TOKEN_SIZE; size_t last = len < MSIZE ? len : (MSIZE - 1); st->type = (char) stype; st->pos = pos; st->len = last; memcpy(st->val, value, last); st->val[last] = CHAR_NULL; } static void st_copy(stoken_t * dest, const stoken_t * src) { memcpy(dest, src, sizeof(stoken_t)); } static int st_is_arithmetic_op(const stoken_t* st) { const char ch = st->val[0]; return (st->type == TYPE_OPERATOR && st->len == 1 && (ch == '*' || ch == '/' || ch == '-' || ch == '+' || ch == '%')); } static int st_is_unary_op(const stoken_t * st) { const char* str = st->val; const size_t len = st->len; if (st->type != TYPE_OPERATOR) { return FALSE; } switch (len) { case 1: return *str == '+' || *str == '-' || *str == '!' || *str == '~'; case 2: return str[0] == '!' && str[1] == '!'; case 3: return cstrcasecmp("NOT", str, 3) == 0; default: return FALSE; } } /* Parsers * * */ static size_t parse_white(struct libinjection_sqli_state * sf) { return sf->pos + 1; } static size_t parse_operator1(struct libinjection_sqli_state * sf) { const char *cs = sf->s; size_t pos = sf->pos; st_assign_char(sf->current, TYPE_OPERATOR, pos, 1, cs[pos]); return pos + 1; } static size_t parse_other(struct libinjection_sqli_state * sf) { const char *cs = sf->s; size_t pos = sf->pos; st_assign_char(sf->current, TYPE_UNKNOWN, pos, 1, cs[pos]); return pos + 1; } static size_t parse_char(struct libinjection_sqli_state * sf) { const char *cs = sf->s; size_t pos = sf->pos; st_assign_char(sf->current, cs[pos], pos, 1, cs[pos]); return pos + 1; } static size_t parse_eol_comment(struct libinjection_sqli_state * sf) { const char *cs = sf->s; const size_t slen = sf->slen; size_t pos = sf->pos; const char *endpos = (const char *) memchr((const void *) (cs + pos), '\n', slen - pos); if (endpos == NULL) { st_assign(sf->current, TYPE_COMMENT, pos, slen - pos, cs + pos); return slen; } else { st_assign(sf->current, TYPE_COMMENT, pos, endpos - cs - pos, cs + pos); return (endpos - cs) + 1; } } /** In Ansi mode, hash is an operator * In MYSQL mode, it's a EOL comment like '--' */ static size_t parse_hash(struct libinjection_sqli_state * sf) { sf->stats_comment_hash += 1; if (sf->flags & FLAG_SQL_MYSQL) { sf->stats_comment_hash += 1; return parse_eol_comment(sf); } else { st_assign_char(sf->current, TYPE_OPERATOR, sf->pos, 1, '#'); return sf->pos + 1; } } static size_t parse_dash(struct libinjection_sqli_state * sf) { const char *cs = sf->s; const size_t slen = sf->slen; size_t pos = sf->pos; /* * five cases * 1) --[white] this is always a SQL comment * 2) --[EOF] this is a comment * 3) --[notwhite] in MySQL this is NOT a comment but two unary operators * 4) --[notwhite] everyone else thinks this is a comment * 5) -[not dash] '-' is a unary operator */ if (pos + 2 < slen && cs[pos + 1] == '-' && char_is_white(cs[pos+2]) ) { return parse_eol_comment(sf); } else if (pos +2 == slen && cs[pos + 1] == '-') { return parse_eol_comment(sf); } else if (pos + 1 < slen && cs[pos + 1] == '-' && (sf->flags & FLAG_SQL_ANSI)) { /* --[not-white] not-white case: * */ sf->stats_comment_ddx += 1; return parse_eol_comment(sf); } else { st_assign_char(sf->current, TYPE_OPERATOR, pos, 1, '-'); return pos + 1; } } /** This detects MySQL comments, comments that * start with /x! We just ban these now but * previously we attempted to parse the inside * * For reference: * the form of /x![anything]x/ or /x!12345[anything] x/ * * Mysql 3 (maybe 4), allowed this: * /x!0selectx/ 1; * where 0 could be any number. * * The last version of MySQL 3 was in 2003. * It is unclear if the MySQL 3 syntax was allowed * in MySQL 4. The last version of MySQL 4 was in 2008 * */ static size_t is_mysql_comment(const char *cs, const size_t len, size_t pos) { /* so far... * cs[pos] == '/' && cs[pos+1] == '*' */ if (pos + 2 >= len) { /* not a mysql comment */ return 0; } if (cs[pos + 2] != '!') { /* not a mysql comment */ return 0; } /* * this is a mysql comment * got "/x!" */ return 1; } static size_t parse_slash(struct libinjection_sqli_state * sf) { const char* ptr; size_t clen; const char *cs = sf->s; const size_t slen = sf->slen; size_t pos = sf->pos; const char* cur = cs + pos; char ctype = TYPE_COMMENT; size_t pos1 = pos + 1; if (pos1 == slen || cs[pos1] != '*') { return parse_operator1(sf); } /* * skip over initial '/x' */ ptr = memchr2(cur + 2, slen - (pos + 2), '*', '/'); /* * (ptr == NULL) causes false positive in cppcheck 1.61 * casting to type seems to fix it */ if (ptr == (const char*) NULL) { /* till end of line */ clen = slen - pos; } else { clen = (ptr + 2) - cur; } /* * postgresql allows nested comments which makes * this is incompatible with parsing so * if we find a '/x' inside the coment, then * make a new token. * * Also, Mysql's "conditional" comments for version * are an automatic black ban! */ if (memchr2(cur + 2, ptr - (cur + 1), '/', '*') != NULL) { ctype = TYPE_EVIL; } else if (is_mysql_comment(cs, slen, pos)) { ctype = TYPE_EVIL; } st_assign(sf->current, ctype, pos, clen, cs + pos); return pos + clen; } static size_t parse_backslash(struct libinjection_sqli_state * sf) { const char *cs = sf->s; const size_t slen = sf->slen; size_t pos = sf->pos; /* * Weird MySQL alias for NULL, "\N" (capital N only) */ if (pos + 1 < slen && cs[pos +1] == 'N') { st_assign(sf->current, TYPE_NUMBER, pos, 2, cs + pos); return pos + 2; } else { st_assign_char(sf->current, TYPE_BACKSLASH, pos, 1, cs[pos]); return pos + 1; } } static size_t parse_operator2(struct libinjection_sqli_state * sf) { char ch; const char *cs = sf->s; const size_t slen = sf->slen; size_t pos = sf->pos; if (pos + 1 >= slen) { return parse_operator1(sf); } if (pos + 2 < slen && cs[pos] == '<' && cs[pos + 1] == '=' && cs[pos + 2] == '>') { /* * special 3-char operator */ st_assign(sf->current, TYPE_OPERATOR, pos, 3, cs + pos); return pos + 3; } ch = sf->lookup(sf, LOOKUP_OPERATOR, cs + pos, 2); if (ch != CHAR_NULL) { st_assign(sf->current, ch, pos, 2, cs+pos); return pos + 2; } /* * not an operator.. what to do with the two * characters we got? */ if (cs[pos] == ':') { /* ':' is not an operator */ st_assign(sf->current, TYPE_COLON, pos, 1, cs+pos); return pos + 1; } else { /* * must be a single char operator */ return parse_operator1(sf); } } /* * Ok! " \" " one backslash = escaped! * " \\" " two backslash = not escaped! * "\\\" " three backslash = escaped! */ static int is_backslash_escaped(const char* end, const char* start) { const char* ptr; for (ptr = end; ptr >= start; ptr--) { if (*ptr != '\\') { break; } } /* if number of backslashes is odd, it is escaped */ return (end - ptr) & 1; } static size_t is_double_delim_escaped(const char* cur, const char* end) { return ((cur + 1) < end) && *(cur+1) == *cur; } /* Look forward for doubling of deliminter * * case 'foo''bar' --> foo''bar * * ending quote isn't duplicated (i.e. escaped) * since it's the wrong char or EOL * */ static size_t parse_string_core(const char *cs, const size_t len, size_t pos, stoken_t * st, char delim, size_t offset) { /* * offset is to skip the perhaps first quote char */ const char *qpos = (const char *) memchr((const void *) (cs + pos + offset), delim, len - pos - offset); /* * then keep string open/close info */ if (offset > 0) { /* * this is real quote */ st->str_open = delim; } else { /* * this was a simulated quote */ st->str_open = CHAR_NULL; } while (TRUE) { if (qpos == NULL) { /* * string ended with no trailing quote * assign what we have */ st_assign(st, TYPE_STRING, pos + offset, len - pos - offset, cs + pos + offset); st->str_close = CHAR_NULL; return len; } else if ( is_backslash_escaped(qpos - 1, cs + pos + offset)) { /* keep going, move ahead one character */ qpos = (const char *) memchr((const void *) (qpos + 1), delim, (cs + len) - (qpos + 1)); continue; } else if (is_double_delim_escaped(qpos, cs + len)) { /* keep going, move ahead two characters */ qpos = (const char *) memchr((const void *) (qpos + 2), delim, (cs + len) - (qpos + 2)); continue; } else { /* hey it's a normal string */ st_assign(st, TYPE_STRING, pos + offset, qpos - (cs + pos + offset), cs + pos + offset); st->str_close = delim; return qpos - cs + 1; } } } /** * Used when first char is a ' or " */ static size_t parse_string(struct libinjection_sqli_state * sf) { const char *cs = sf->s; const size_t slen = sf->slen; size_t pos = sf->pos; /* * assert cs[pos] == single or double quote */ return parse_string_core(cs, slen, pos, sf->current, cs[pos], 1); } /** * Used when first char is: * N or n: mysql "National Character set" * E : psql "Escaped String" */ static size_t parse_estring(struct libinjection_sqli_state * sf) { const char *cs = sf->s; const size_t slen = sf->slen; size_t pos = sf->pos; if (pos + 2 >= slen || cs[pos+1] != CHAR_SINGLE) { return parse_word(sf); } return parse_string_core(cs, slen, pos, sf->current, CHAR_SINGLE, 2); } static size_t parse_ustring(struct libinjection_sqli_state * sf) { const char *cs = sf->s; size_t slen = sf->slen; size_t pos = sf->pos; if (pos + 2 < slen && cs[pos+1] == '&' && cs[pos+2] == '\'') { sf->pos += 2; pos = parse_string(sf); sf->current->str_open = 'u'; if (sf->current->str_close == '\'') { sf->current->str_close = 'u'; } return pos; } else { return parse_word(sf); } } static size_t parse_qstring_core(struct libinjection_sqli_state * sf, int offset) { char ch; const char *strend; const char *cs = sf->s; size_t slen = sf->slen; size_t pos = sf->pos + offset; /* if we are already at end of string.. if current char is not q or Q if we don't have 2 more chars if char2 != a single quote then, just treat as word */ if (pos >= slen || (cs[pos] != 'q' && cs[pos] != 'Q') || pos + 2 >= slen || cs[pos + 1] != '\'') { return parse_word(sf); } ch = cs[pos + 2]; /* the ch > 127 is un-needed since * we assume char is signed */ if (ch < 33 /* || ch > 127 */) { return parse_word(sf); } switch (ch) { case '(' : ch = ')'; break; case '[' : ch = ']'; break; case '{' : ch = '}'; break; case '<' : ch = '>'; break; } strend = memchr2(cs + pos + 3, slen - pos - 3, ch, '\''); if (strend == NULL) { st_assign(sf->current, TYPE_STRING, pos + 3, slen - pos - 3, cs + pos + 3); sf->current->str_open = 'q'; sf->current->str_close = CHAR_NULL; return slen; } else { st_assign(sf->current, TYPE_STRING, pos + 3, strend - cs - pos - 3, cs + pos + 3); sf->current->str_open = 'q'; sf->current->str_close = 'q'; return (strend - cs) + 2; } } /* * Oracle's q string */ static size_t parse_qstring(struct libinjection_sqli_state * sf) { return parse_qstring_core(sf, 0); } /* * mysql's N'STRING' or * ... Oracle's nq string */ static size_t parse_nqstring(struct libinjection_sqli_state * sf) { size_t slen = sf->slen; size_t pos = sf->pos; if (pos + 2 < slen && sf->s[pos+1] == CHAR_SINGLE) { return parse_estring(sf); } return parse_qstring_core(sf, 1); } /* * binary literal string * re: [bB]'[01]*' */ static size_t parse_bstring(struct libinjection_sqli_state *sf) { size_t wlen; const char *cs = sf->s; size_t pos = sf->pos; size_t slen = sf->slen; /* need at least 2 more characters * if next char isn't a single quote, then * continue as normal word */ if (pos + 2 >= slen || cs[pos+1] != '\'') { return parse_word(sf); } wlen = strlenspn(cs + pos + 2, sf->slen - pos - 2, "01"); if (pos + 2 + wlen >= slen || cs[pos + 2 + wlen] != '\'') { return parse_word(sf); } st_assign(sf->current, TYPE_NUMBER, pos, wlen + 3, cs + pos); return pos + 2 + wlen + 1; } /* * hex literal string * re: [XX]'[0123456789abcdefABCDEF]*' * mysql has requirement of having EVEN number of chars, * but pgsql does not */ static size_t parse_xstring(struct libinjection_sqli_state *sf) { size_t wlen; const char *cs = sf->s; size_t pos = sf->pos; size_t slen = sf->slen; /* need at least 2 more characters * if next char isn't a single quote, then * continue as normal word */ if (pos + 2 >= slen || cs[pos+1] != '\'') { return parse_word(sf); } wlen = strlenspn(cs + pos + 2, sf->slen - pos - 2, "0123456789ABCDEFabcdef"); if (pos + 2 + wlen >= slen || cs[pos + 2 + wlen] != '\'') { return parse_word(sf); } st_assign(sf->current, TYPE_NUMBER, pos, wlen + 3, cs + pos); return pos + 2 + wlen + 1; } /** * This handles MS SQLSERVER bracket words * http://stackoverflow.com/questions/3551284/sql-serverwhat-do-brackets-mean-around-column-name * */ static size_t parse_bword(struct libinjection_sqli_state * sf) { const char *cs = sf->s; size_t pos = sf->pos; const char* endptr = (const char*) memchr(cs + pos, ']', sf->slen - pos); if (endptr == NULL) { st_assign(sf->current, TYPE_BAREWORD, pos, sf->slen - pos, cs + pos); return sf->slen; } else { st_assign(sf->current, TYPE_BAREWORD, pos, (endptr - cs) - pos + 1, cs + pos); return (endptr - cs) + 1; } } static size_t parse_word(struct libinjection_sqli_state * sf) { char ch; char delim; size_t i; const char *cs = sf->s; size_t pos = sf->pos; size_t wlen = strlencspn(cs + pos, sf->slen - pos, " []{}<>:\\?=@!#~+-*/&|^%(),';\t\n\v\f\r\"\240\000"); st_assign(sf->current, TYPE_BAREWORD, pos, wlen, cs + pos); /* now we need to look inside what we good for "." and "`" * and see if what is before is a keyword or not */ for (i =0; i < sf->current->len; ++i) { delim = sf->current->val[i]; if (delim == '.' || delim == '`') { ch = sf->lookup(sf, LOOKUP_WORD, sf->current->val, i); if (ch != TYPE_NONE && ch != TYPE_BAREWORD) { /* needed for swig */ st_clear(sf->current); /* * we got something like "SELECT.1" * or SELECT`column` */ st_assign(sf->current, ch, pos, i, cs + pos); return pos + i; } } } /* * do normal lookup with word including '.' */ if (wlen < LIBINJECTION_SQLI_TOKEN_SIZE) { ch = sf->lookup(sf, LOOKUP_WORD, sf->current->val, wlen); if (ch == CHAR_NULL) { ch = TYPE_BAREWORD; } sf->current->type = ch; } return pos + wlen; } /* MySQL backticks are a cross between string and * and a bare word. * */ static size_t parse_tick(struct libinjection_sqli_state* sf) { size_t pos = parse_string_core(sf->s, sf->slen, sf->pos, sf->current, CHAR_TICK, 1); /* we could check to see if start and end of * of string are both "`", i.e. make sure we have * matching set. `foo` vs. `foo * but I don't think it matters much */ /* check value of string to see if it's a keyword, * function, operator, etc */ char ch = sf->lookup(sf, LOOKUP_WORD, sf->current->val, sf->current->len); if (ch == TYPE_FUNCTION) { /* if it's a function, then convert token */ sf->current->type = TYPE_FUNCTION; } else { /* otherwise it's a 'n' type -- mysql treats * everything as a bare word */ sf->current->type = TYPE_BAREWORD; } return pos; } static size_t parse_var(struct libinjection_sqli_state * sf) { size_t xlen; const char *cs = sf->s; const size_t slen = sf->slen; size_t pos = sf->pos + 1; /* * var_count is only used to reconstruct * the input. It counts the number of '@' * seen 0 in the case of NULL, 1 or 2 */ /* * move past optional other '@' */ if (pos < slen && cs[pos] == '@') { pos += 1; sf->current->count = 2; } else { sf->current->count = 1; } /* * MySQL allows @@`version` */ if (pos < slen) { if (cs[pos] == '`') { sf->pos = pos; pos = parse_tick(sf); sf->current->type = TYPE_VARIABLE; return pos; } else if (cs[pos] == CHAR_SINGLE || cs[pos] == CHAR_DOUBLE) { sf->pos = pos; pos = parse_string(sf); sf->current->type = TYPE_VARIABLE; return pos; } } xlen = strlencspn(cs + pos, slen - pos, " <>:\\?=@!#~+-*/&|^%(),';\t\n\v\f\r'`\""); if (xlen == 0) { st_assign(sf->current, TYPE_VARIABLE, pos, 0, cs + pos); return pos; } else { st_assign(sf->current, TYPE_VARIABLE, pos, xlen, cs + pos); return pos + xlen; } } static size_t parse_money(struct libinjection_sqli_state *sf) { size_t xlen; const char* strend; const char *cs = sf->s; const size_t slen = sf->slen; size_t pos = sf->pos; if (pos + 1 == slen) { /* end of line */ st_assign_char(sf->current, TYPE_BAREWORD, pos, 1, '$'); return slen; } /* * $1,000.00 or $1.000,00 ok! * This also parses $....,,,111 but that's ok */ xlen = strlenspn(cs + pos + 1, slen - pos - 1, "0123456789.,"); if (xlen == 0) { if (cs[pos + 1] == '$') { /* we have $$ .. find ending $$ and make string */ strend = memchr2(cs + pos + 2, slen - pos -2, '$', '$'); if (strend == NULL) { /* fell off edge */ st_assign(sf->current, TYPE_STRING, pos + 2, slen - (pos + 2), cs + pos + 2); sf->current->str_open = '$'; sf->current->str_close = CHAR_NULL; return slen; } else { st_assign(sf->current, TYPE_STRING, pos + 2, strend - (cs + pos + 2), cs + pos + 2); sf->current->str_open = '$'; sf->current->str_close = '$'; return strend - cs + 2; } } else { /* ok it's not a number or '$$', but maybe it's pgsql "$ quoted strings" */ xlen = strlenspn(cs + pos + 1, slen - pos - 1, "abcdefghjiklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"); if (xlen == 0) { /* hmm it's "$" _something_ .. just add $ and keep going*/ st_assign_char(sf->current, TYPE_BAREWORD, pos, 1, '$'); return pos + 1; } /* we have $foobar????? */ /* is it $foobar$ */ if (pos + xlen + 1 == slen || cs[pos+xlen+1] != '$') { /* not $foobar$, or fell off edge */ st_assign_char(sf->current, TYPE_BAREWORD, pos, 1, '$'); return pos + 1; } /* we have $foobar$ ... find it again */ strend = my_memmem(cs+xlen+2, slen - (pos+xlen+2), cs + pos, xlen+2); if (strend == NULL) { /* fell off edge */ st_assign(sf->current, TYPE_STRING, pos+xlen+2, slen - pos - xlen - 2, cs+pos+xlen+2); sf->current->str_open = '$'; sf->current->str_close = CHAR_NULL; return slen; } else { /* got one */ st_assign(sf->current, TYPE_STRING, pos+xlen+2, strend - (cs + pos + xlen + 2), cs+pos+xlen+2); sf->current->str_open = '$'; sf->current->str_close = '$'; return (strend + xlen + 2) - cs; } } } else if (xlen == 1 && cs[pos + 1] == '.') { /* $. should parsed as a word */ return parse_word(sf); } else { st_assign(sf->current, TYPE_NUMBER, pos, 1 + xlen, cs + pos); return pos + 1 + xlen; } } static size_t parse_number(struct libinjection_sqli_state * sf) { size_t xlen; size_t start; const char* digits = NULL; const char *cs = sf->s; const size_t slen = sf->slen; size_t pos = sf->pos; int have_dot = 0; int have_e = 0; int have_exp = 0; /* cs[pos] == '0' has 1/10 chance of being true, * while pos+1< slen is almost always true */ if (cs[pos] == '0' && pos + 1 < slen) { if (cs[pos + 1] == 'X' || cs[pos + 1] == 'x') { digits = "0123456789ABCDEFabcdef"; } else if (cs[pos + 1] == 'B' || cs[pos + 1] == 'b') { digits = "01"; } if (digits) { xlen = strlenspn(cs + pos + 2, slen - pos - 2, digits); if (xlen == 0) { st_assign(sf->current, TYPE_BAREWORD, pos, 2, cs + pos); return pos + 2; } else { st_assign(sf->current, TYPE_NUMBER, pos, 2 + xlen, cs + pos); return pos + 2 + xlen; } } } start = pos; while (pos < slen && ISDIGIT(cs[pos])) { pos += 1; } if (pos < slen && cs[pos] == '.') { have_dot = 1; pos += 1; while (pos < slen && ISDIGIT(cs[pos])) { pos += 1; } if (pos - start == 1) { /* only one character read so far */ st_assign_char(sf->current, TYPE_DOT, start, 1, '.'); return pos; } } if (pos < slen) { if (cs[pos] == 'E' || cs[pos] == 'e') { have_e = 1; pos += 1; if (pos < slen && (cs[pos] == '+' || cs[pos] == '-')) { pos += 1; } while (pos < slen && ISDIGIT(cs[pos])) { have_exp = 1; pos += 1; } } } /* oracle's ending float or double suffix * http://docs.oracle.com/cd/B19306_01/server.102/b14200/sql_elements003.htm#i139891 */ if (pos < slen && (cs[pos] == 'd' || cs[pos] == 'D' || cs[pos] == 'f' || cs[pos] == 'F')) { if (pos + 1 == slen) { /* line ends evaluate "... 1.2f$" as '1.2f' */ pos += 1; } else if ((char_is_white(cs[pos+1]) || cs[pos+1] == ';')) { /* * easy case, evaluate "... 1.2f ... as '1.2f' */ pos += 1; } else if (cs[pos+1] == 'u' || cs[pos+1] == 'U') { /* * a bit of a hack but makes '1fUNION' parse as '1f UNION' */ pos += 1; } else { /* it's like "123FROM" */ /* parse as "123" only */ } } if (have_dot == 1 && have_e == 1 && have_exp == 0) { /* very special form of * "1234.e" * "10.10E" * ".E" * this is a WORD not a number!! */ st_assign(sf->current, TYPE_BAREWORD, start, pos - start, cs + start); } else { st_assign(sf->current, TYPE_NUMBER, start, pos - start, cs + start); } return pos; } /* * API to return version. This allows us to increment the version * without having to regenerated the SWIG (or other binding) in minor * releases. */ const char* libinjection_version() { return LIBINJECTION_VERSION; } int libinjection_sqli_tokenize(struct libinjection_sqli_state * sf) { pt2Function fnptr; size_t *pos = &sf->pos; stoken_t *current = sf->current; const char *s = sf->s; const size_t slen = sf->slen; if (slen == 0) { return FALSE; } st_clear(current); sf->current = current; /* * if we are at beginning of string * and in single-quote or double quote mode * then pretend the input starts with a quote */ if (*pos == 0 && (sf->flags & (FLAG_QUOTE_SINGLE | FLAG_QUOTE_DOUBLE))) { *pos = parse_string_core(s, slen, 0, current, flag2delim(sf->flags), 0); sf->stats_tokens += 1; return TRUE; } while (*pos < slen) { /* * get current character */ const unsigned char ch = (unsigned int) (s[*pos]); /* * if not ascii, then continue... * actually probably need to just assuming * it's a string */ if (ch > 127) { /* 160 or 0xA0 or octal 240 is "latin1 non-breaking space" * but is treated as a space in mysql. */ if (ch == 160) { fnptr = parse_white; } else { fnptr = parse_word; } } else { /* * look up the parser, and call it * * Porting Note: this is mapping of char to function * charparsers[ch]() */ fnptr = char_parse_map[ch]; } *pos = (*fnptr) (sf); /* * */ if (current->type != CHAR_NULL) { sf->stats_tokens += 1; return TRUE; } } return FALSE; } void libinjection_sqli_init(struct libinjection_sqli_state * sf, const char *s, size_t len, int flags) { if (flags == 0) { flags = FLAG_QUOTE_NONE | FLAG_SQL_ANSI; } memset(sf, 0, sizeof(struct libinjection_sqli_state)); sf->s = s; sf->slen = len; sf->lookup = libinjection_sqli_lookup_word; sf->userdata = 0; sf->flags = flags; sf->current = &(sf->tokenvec[0]); } void libinjection_sqli_reset(struct libinjection_sqli_state * sf, int flags) { void *userdata = sf->userdata; ptr_lookup_fn lookup = sf->lookup;; if (flags == 0) { flags = FLAG_QUOTE_NONE | FLAG_SQL_ANSI; } libinjection_sqli_init(sf, sf->s, sf->slen, flags); sf->lookup = lookup; sf->userdata = userdata; } void libinjection_sqli_callback(struct libinjection_sqli_state * sf, ptr_lookup_fn fn, void* userdata) { if (fn == NULL) { sf->lookup = libinjection_sqli_lookup_word; sf->userdata = (void*)(NULL); } else { sf->lookup = fn; sf->userdata = userdata; } } /** See if two tokens can be merged since they are compound SQL phrases. * * This takes two tokens, and, if they are the right type, * merges their values together. Then checks to see if the * new value is special using the PHRASES mapping. * * Example: "UNION" + "ALL" ==> "UNION ALL" * * C Security Notes: this is safe to use C-strings (null-terminated) * since the types involved by definition do not have embedded nulls * (e.g. there is no keyword with embedded null) * * Porting Notes: since this is C, it's oddly complicated. * This is just: multikeywords[token.value + ' ' + token2.value] * */ static int syntax_merge_words(struct libinjection_sqli_state * sf,stoken_t * a, stoken_t * b) { size_t sz1; size_t sz2; size_t sz3; char tmp[LIBINJECTION_SQLI_TOKEN_SIZE]; char ch; /* first token is of right type? */ if (! (a->type == TYPE_KEYWORD || a->type == TYPE_BAREWORD || a->type == TYPE_OPERATOR || a->type == TYPE_UNION || a->type == TYPE_FUNCTION || a->type == TYPE_EXPRESSION || a->type == TYPE_SQLTYPE)) { return CHAR_NULL; } if (b->type != TYPE_KEYWORD && b->type != TYPE_BAREWORD && b->type != TYPE_OPERATOR && b->type != TYPE_SQLTYPE && b->type != TYPE_LOGIC_OPERATOR && b->type != TYPE_FUNCTION && b->type != TYPE_UNION && b->type != TYPE_EXPRESSION) { return CHAR_NULL; } sz1 = a->len; sz2 = b->len; sz3 = sz1 + sz2 + 1; /* +1 for space in the middle */ if (sz3 >= LIBINJECTION_SQLI_TOKEN_SIZE) { /* make sure there is room for ending null */ return FALSE; } /* * oddly annoying last.val + ' ' + current.val */ memcpy(tmp, a->val, sz1); tmp[sz1] = ' '; memcpy(tmp + sz1 + 1, b->val, sz2); tmp[sz3] = CHAR_NULL; ch = sf->lookup(sf, LOOKUP_WORD, tmp, sz3); if (ch != CHAR_NULL) { st_assign(a, ch, a->pos, sz3, tmp); return TRUE; } else { return FALSE; } } int libinjection_sqli_fold(struct libinjection_sqli_state * sf) { stoken_t last_comment; /* POS is the position of where the NEXT token goes */ size_t pos = 0; /* LEFT is a count of how many tokens that are already folded or processed (i.e. part of the fingerprint) */ size_t left = 0; int more = 1; st_clear(&last_comment); /* Skip all initial comments, right-parens ( and unary operators * */ sf->current = &(sf->tokenvec[0]); while (more) { more = libinjection_sqli_tokenize(sf); if ( ! (sf->current->type == TYPE_COMMENT || sf->current->type == TYPE_LEFTPARENS || st_is_unary_op(sf->current))) { break; } } if (! more) { /* If input was only comments, unary or (, then exit */ return 0; } else { /* it's some other token */ pos += 1; } while (1) { FOLD_DEBUG; /* do we have all the max number of tokens? if so do * some special cases for 5 tokens */ if (pos >= LIBINJECTION_SQLI_MAX_TOKENS) { if ( ( sf->tokenvec[0].type == TYPE_NUMBER && (sf->tokenvec[1].type == TYPE_OPERATOR || sf->tokenvec[1].type == TYPE_COMMA) && sf->tokenvec[2].type == TYPE_LEFTPARENS && sf->tokenvec[3].type == TYPE_NUMBER && sf->tokenvec[4].type == TYPE_RIGHTPARENS ) || ( sf->tokenvec[0].type == TYPE_BAREWORD && sf->tokenvec[1].type == TYPE_OPERATOR && sf->tokenvec[2].type == TYPE_LEFTPARENS && (sf->tokenvec[3].type == TYPE_BAREWORD || sf->tokenvec[3].type == TYPE_NUMBER) && sf->tokenvec[4].type == TYPE_RIGHTPARENS ) || ( sf->tokenvec[0].type == TYPE_NUMBER && sf->tokenvec[1].type == TYPE_RIGHTPARENS && sf->tokenvec[2].type == TYPE_COMMA && sf->tokenvec[3].type == TYPE_LEFTPARENS && sf->tokenvec[4].type == TYPE_NUMBER ) ) { if (pos > LIBINJECTION_SQLI_MAX_TOKENS) { //printf("TRUNCATE pos = %lu vs. %lu\n", pos, LIBINJECTION_SQLI_MAX_TOKENS); st_copy(&(sf->tokenvec[1]), &(sf->tokenvec[LIBINJECTION_SQLI_MAX_TOKENS])); pos = 2; left = 0; } else { //printf("HEREIAM\n"); pos = 1; left = 0; } } } if (! more || left >= LIBINJECTION_SQLI_MAX_TOKENS) { left = pos; break; } /* get up to two tokens */ while (more && pos <= LIBINJECTION_SQLI_MAX_TOKENS && (pos - left) < 2) { sf->current = &(sf->tokenvec[pos]); more = libinjection_sqli_tokenize(sf); if (more) { if (sf->current->type == TYPE_COMMENT) { st_copy(&last_comment, sf->current); } else { last_comment.type = CHAR_NULL; pos += 1; } } } FOLD_DEBUG; /* did we get 2 tokens? if not then we are done */ if (pos - left < 2) { left = pos; continue; } /* FOLD: "ss" -> "s" * "foo" "bar" is valid SQL * just ignore second string */ if (sf->tokenvec[left].type == TYPE_STRING && sf->tokenvec[left+1].type == TYPE_STRING) { pos -= 1; sf->stats_folds += 1; continue; } else if (sf->tokenvec[left].type == TYPE_SEMICOLON && sf->tokenvec[left+1].type == TYPE_SEMICOLON) { /* not sure how various engines handle * 'select 1;;drop table foo' or * 'select 1; /x foo x/; drop table foo' * to prevent surprises, just fold away repeated semicolons */ pos -= 1; sf->stats_folds += 1; continue; } else if (sf->tokenvec[left].type == TYPE_SEMICOLON && sf->tokenvec[left+1].type == TYPE_FUNCTION && cstrcasecmp("IF", sf->tokenvec[left+1].val, sf->tokenvec[left+1].len) == 0) { /* IF is normally a function, except in Transact-SQL where it can be used as a * standalone control flow operator, e.g. ; IF 1=1 ... * if found after a semicolon, convert from 'f' type to 'T' type */ sf->tokenvec[left+1].type = TYPE_TSQL; left += 2; continue; /* reparse everything, but we probably can advance left, and pos */ } else if ((sf->tokenvec[left].type ==TYPE_OPERATOR || sf->tokenvec[left].type ==TYPE_LOGIC_OPERATOR) && st_is_unary_op(&sf->tokenvec[left+1])) { pos -= 1; sf->stats_folds += 1; left = 0; continue; } else if (sf->tokenvec[left].type ==TYPE_LEFTPARENS && st_is_unary_op(&sf->tokenvec[left+1])) { pos -= 1; sf->stats_folds += 1; if (left > 0) { left -= 1; } continue; } else if (syntax_merge_words(sf, &sf->tokenvec[left], &sf->tokenvec[left+1])) { pos -= 1; sf->stats_folds += 1; if (left > 0) { left -= 1; } continue; } else if ((sf->tokenvec[left].type == TYPE_BAREWORD || sf->tokenvec[left].type == TYPE_VARIABLE) && sf->tokenvec[left+1].type == TYPE_LEFTPARENS && ( /* TSQL functions but common enough to be collumn names */ cstrcasecmp("USER_ID", sf->tokenvec[left].val, sf->tokenvec[left].len) == 0 || cstrcasecmp("USER_NAME", sf->tokenvec[left].val, sf->tokenvec[left].len) == 0 || /* Function in MYSQL */ cstrcasecmp("DATABASE", sf->tokenvec[left].val, sf->tokenvec[left].len) == 0 || cstrcasecmp("PASSWORD", sf->tokenvec[left].val, sf->tokenvec[left].len) == 0 || cstrcasecmp("USER", sf->tokenvec[left].val, sf->tokenvec[left].len) == 0 || /* Mysql words that act as a variable and are a function */ /* TSQL current_users is fake-variable */ /* http://msdn.microsoft.com/en-us/library/ms176050.aspx */ cstrcasecmp("CURRENT_USER", sf->tokenvec[left].val, sf->tokenvec[left].len) == 0 || cstrcasecmp("CURRENT_DATE", sf->tokenvec[left].val, sf->tokenvec[left].len) == 0 || cstrcasecmp("CURRENT_TIME", sf->tokenvec[left].val, sf->tokenvec[left].len) == 0 || cstrcasecmp("CURRENT_TIMESTAMP", sf->tokenvec[left].val, sf->tokenvec[left].len) == 0 || cstrcasecmp("LOCALTIME", sf->tokenvec[left].val, sf->tokenvec[left].len) == 0 || cstrcasecmp("LOCALTIMESTAMP", sf->tokenvec[left].val, sf->tokenvec[left].len) == 0 )) { /* pos is the same * other conversions need to go here... for instance * password CAN be a function, coalese CAN be a function */ sf->tokenvec[left].type = TYPE_FUNCTION; continue; } else if (sf->tokenvec[left].type == TYPE_KEYWORD && ( cstrcasecmp("IN", sf->tokenvec[left].val, sf->tokenvec[left].len) == 0 || cstrcasecmp("NOT IN", sf->tokenvec[left].val, sf->tokenvec[left].len) == 0 )) { if (sf->tokenvec[left+1].type == TYPE_LEFTPARENS) { /* got .... IN ( ... (or 'NOT IN') * it's an operator */ sf->tokenvec[left].type = TYPE_OPERATOR; } else { /* * it's a nothing */ sf->tokenvec[left].type = TYPE_BAREWORD; } /* "IN" can be used as "IN BOOLEAN MODE" for mysql * in which case merging of words can be done later * other wise it acts as an equality operator __ IN (values..) * * here we got "IN" "(" so it's an operator. * also back track to handle "NOT IN" * might need to do the same with like * two use cases "foo" LIKE "BAR" (normal operator) * "foo" = LIKE(1,2) */ continue; } else if (sf->tokenvec[left].type == TYPE_SQLTYPE && (sf->tokenvec[left+1].type == TYPE_BAREWORD || sf->tokenvec[left+1].type == TYPE_NUMBER || sf->tokenvec[left+1].type == TYPE_FUNCTION || sf->tokenvec[left+1].type == TYPE_VARIABLE || sf->tokenvec[left+1].type == TYPE_STRING)) { st_copy(&sf->tokenvec[left], &sf->tokenvec[left+1]); pos -= 1; sf->stats_folds += 1; left = 0; continue; } else if (sf->tokenvec[left].type == TYPE_COLLATE && sf->tokenvec[left+1].type == TYPE_BAREWORD) { /* * there are too many collation types.. so if the bareword has a "_" * then it's TYPE_SQLTYPE */ if (strchr(sf->tokenvec[left+1].val, '_') != NULL) { sf->tokenvec[left+1].type = TYPE_SQLTYPE; } } else if (sf->tokenvec[left].type == TYPE_BACKSLASH) { if (st_is_arithmetic_op(&(sf->tokenvec[left+1]))) { /* very weird case in TSQL where '\%1' is parsed as '0 % 1', etc */ sf->tokenvec[left].type = TYPE_NUMBER; } else { /* just ignore it.. Again T-SQL seems to parse \1 as "1" */ st_copy(&sf->tokenvec[left], &sf->tokenvec[left+1]); pos -= 1; sf->stats_folds += 1; } left = 0; continue; } else if (sf->tokenvec[left].type == TYPE_LEFTPARENS && sf->tokenvec[left+1].type == TYPE_LEFTPARENS) { pos -= 1; sf->stats_folds += 1; continue; } else if (sf->tokenvec[left].type == TYPE_RIGHTPARENS && sf->tokenvec[left+1].type == TYPE_RIGHTPARENS) { pos -= 1; sf->stats_folds += 1; continue; } else if (sf->tokenvec[left].type == TYPE_SQLTYPE && sf->tokenvec[left+1].type == TYPE_SQLTYPE) { pos -= 1; sf->stats_folds += 1; continue; } else if (sf->tokenvec[left].type == TYPE_LEFTBRACE && sf->tokenvec[left+1].type == TYPE_BAREWORD) { /* weird ODBC / MYSQL {foo expr} --> expr * but for this rule we just strip away the "{ foo" part */ if (left > 0) { left -= 1; } pos -= 2; sf->stats_folds += 2; continue; } else if (sf->tokenvec[left+1].type == TYPE_RIGHTBRACE) { pos -= 1; sf->stats_folds += 1; continue; } /* all cases of handing 2 tokens is done and nothing matched. Get one more token */ FOLD_DEBUG; while (more && pos <= LIBINJECTION_SQLI_MAX_TOKENS && pos - left < 3) { sf->current = &(sf->tokenvec[pos]); more = libinjection_sqli_tokenize(sf); if (more) { if (sf->current->type == TYPE_COMMENT) { st_copy(&last_comment, sf->current); } else { last_comment.type = CHAR_NULL; pos += 1; } } } /* do we have three tokens? If not then we are done */ if (pos -left < 3) { left = pos; continue; } /* * now look for three token folding */ if (sf->tokenvec[left].type == TYPE_NUMBER && sf->tokenvec[left+1].type == TYPE_OPERATOR && sf->tokenvec[left+2].type == TYPE_NUMBER) { pos -= 2; continue; } else if (sf->tokenvec[left].type == TYPE_OPERATOR && sf->tokenvec[left+1].type != TYPE_LEFTPARENS && sf->tokenvec[left+2].type == TYPE_OPERATOR) { if (left > 0) { left -= 1; } pos -= 2; continue; } else if (sf->tokenvec[left].type == TYPE_LOGIC_OPERATOR && sf->tokenvec[left+2].type == TYPE_LOGIC_OPERATOR) { pos -= 2; continue; } else if (sf->tokenvec[left].type == TYPE_VARIABLE && sf->tokenvec[left+1].type == TYPE_OPERATOR && (sf->tokenvec[left+2].type == TYPE_VARIABLE || sf->tokenvec[left+2].type == TYPE_NUMBER || sf->tokenvec[left+2].type == TYPE_BAREWORD)) { pos -= 2; continue; } else if ((sf->tokenvec[left].type == TYPE_BAREWORD || sf->tokenvec[left].type == TYPE_NUMBER ) && sf->tokenvec[left+1].type == TYPE_OPERATOR && (sf->tokenvec[left+2].type == TYPE_NUMBER || sf->tokenvec[left+2].type == TYPE_BAREWORD)) { pos -= 2; continue; } else if ((sf->tokenvec[left].type == TYPE_BAREWORD || sf->tokenvec[left].type == TYPE_NUMBER || sf->tokenvec[left].type == TYPE_VARIABLE || sf->tokenvec[left].type == TYPE_STRING) && sf->tokenvec[left+1].type == TYPE_OPERATOR && streq(sf->tokenvec[left+1].val, "::") && sf->tokenvec[left+2].type == TYPE_SQLTYPE) { pos -= 2; sf->stats_folds += 2; continue; } else if ((sf->tokenvec[left].type == TYPE_BAREWORD || sf->tokenvec[left].type == TYPE_NUMBER || sf->tokenvec[left].type == TYPE_STRING || sf->tokenvec[left].type == TYPE_VARIABLE) && sf->tokenvec[left+1].type == TYPE_COMMA && (sf->tokenvec[left+2].type == TYPE_NUMBER || sf->tokenvec[left+2].type == TYPE_BAREWORD || sf->tokenvec[left+2].type == TYPE_STRING || sf->tokenvec[left+2].type == TYPE_VARIABLE)) { pos -= 2; if (left > 0) { left -= 1; } continue; } else if ((sf->tokenvec[left].type == TYPE_EXPRESSION || sf->tokenvec[left].type == TYPE_GROUP || sf->tokenvec[left].type == TYPE_COMMA) && st_is_unary_op(&sf->tokenvec[left+1]) && sf->tokenvec[left+2].type == TYPE_LEFTPARENS) { /* got something like SELECT + (, LIMIT + ( * remove unary operator */ st_copy(&sf->tokenvec[left+1], &sf->tokenvec[left+2]); pos -= 1; continue; } else if ((sf->tokenvec[left].type == TYPE_KEYWORD || sf->tokenvec[left].type == TYPE_EXPRESSION || sf->tokenvec[left].type == TYPE_GROUP ) && st_is_unary_op(&sf->tokenvec[left+1]) && (sf->tokenvec[left+2].type == TYPE_NUMBER || sf->tokenvec[left+2].type == TYPE_BAREWORD || sf->tokenvec[left+2].type == TYPE_VARIABLE || sf->tokenvec[left+2].type == TYPE_STRING || sf->tokenvec[left+2].type == TYPE_FUNCTION )) { /* remove unary operators * select - 1 */ st_copy(&sf->tokenvec[left+1], &sf->tokenvec[left+2]); pos -= 1; continue; } else if (sf->tokenvec[left].type == TYPE_COMMA && st_is_unary_op(&sf->tokenvec[left+1]) && (sf->tokenvec[left+2].type == TYPE_NUMBER || sf->tokenvec[left+2].type == TYPE_BAREWORD || sf->tokenvec[left+2].type == TYPE_VARIABLE || sf->tokenvec[left+2].type == TYPE_STRING)) { /* * interesting case turn ", -1" ->> ",1" PLUS we need to back up * one token if possible to see if more folding can be done * "1,-1" --> "1" */ st_copy(&sf->tokenvec[left+1], &sf->tokenvec[left+2]); if (left > 0) { left -= 1; } /* pos is >= 3 so this is safe */ assert(pos >= 3); pos -= 3; continue; } else if (sf->tokenvec[left].type == TYPE_COMMA && st_is_unary_op(&sf->tokenvec[left+1]) && sf->tokenvec[left+2].type == TYPE_FUNCTION) { /* Seperate case from above since you end up with * 1,-sin(1) --> 1 (1) * Here, just do * 1,-sin(1) --> 1,sin(1) * just remove unary opartor */ st_copy(&sf->tokenvec[left+1], &sf->tokenvec[left+2]); pos -= 1; continue; } else if ((sf->tokenvec[left].type == TYPE_BAREWORD) && (sf->tokenvec[left+1].type == TYPE_DOT) && (sf->tokenvec[left+2].type == TYPE_BAREWORD)) { /* ignore the '.n' * typically is this databasename.table */ assert(pos >= 3); pos -= 2; continue; } else if ((sf->tokenvec[left].type == TYPE_EXPRESSION) && (sf->tokenvec[left+1].type == TYPE_DOT) && (sf->tokenvec[left+2].type == TYPE_BAREWORD)) { /* select . `foo` --> select `foo` */ st_copy(&sf->tokenvec[left+1], &sf->tokenvec[left+2]); pos -= 1; continue; } /* no folding -- assume left-most token is is good, now use the existing 2 tokens -- do not get another */ left += 1; } /* while(1) */ /* if we have 4 or less tokens, and we had a comment token * at the end, add it back */ if (left < LIBINJECTION_SQLI_MAX_TOKENS && last_comment.type == TYPE_COMMENT) { st_copy(&sf->tokenvec[left], &last_comment); left += 1; } /* sometimes we grab a 6th token to help determine the type of token 5. */ if (left > LIBINJECTION_SQLI_MAX_TOKENS) { left = LIBINJECTION_SQLI_MAX_TOKENS; } return (int)left; } /* secondary api: detects SQLi in a string, GIVEN a context. * * A context can be: * * CHAR_NULL (\0), process as is * * CHAR_SINGLE ('), process pretending input started with a * single quote. * * CHAR_DOUBLE ("), process pretending input started with a * double quote. * */ const char* libinjection_sqli_fingerprint(struct libinjection_sqli_state * sql_state, int flags) { int i; int tlen = 0; libinjection_sqli_reset(sql_state, flags); tlen = libinjection_sqli_fold(sql_state); /* Check for magic PHP backquote comment * If: * * last token is of type "bareword" * * And is quoted in a backtick * * And isn't closed * * And it's empty? * Then convert it to comment */ if (tlen > 2 && sql_state->tokenvec[tlen-1].type == TYPE_BAREWORD && sql_state->tokenvec[tlen-1].str_open == CHAR_TICK && sql_state->tokenvec[tlen-1].len == 0 && sql_state->tokenvec[tlen-1].str_close == CHAR_NULL) { sql_state->tokenvec[tlen-1].type = TYPE_COMMENT; } for (i = 0; i < tlen; ++i) { sql_state->fingerprint[i] = sql_state->tokenvec[i].type; } /* * make the fingerprint pattern a c-string (null delimited) */ sql_state->fingerprint[tlen] = CHAR_NULL; /* * check for 'X' in pattern, and then * clear out all tokens * * this means parsing could not be done * accurately due to pgsql's double comments * or other syntax that isn't consistent. * Should be very rare false positive */ if (strchr(sql_state->fingerprint, TYPE_EVIL)) { /* needed for SWIG */ memset((void*)sql_state->fingerprint, 0, LIBINJECTION_SQLI_MAX_TOKENS + 1); memset((void*)sql_state->tokenvec[0].val, 0, LIBINJECTION_SQLI_TOKEN_SIZE); sql_state->fingerprint[0] = TYPE_EVIL; sql_state->tokenvec[0].type = TYPE_EVIL; sql_state->tokenvec[0].val[0] = TYPE_EVIL; sql_state->tokenvec[1].type = CHAR_NULL; } return sql_state->fingerprint; } /** * */ #define UNUSED(x) (void)(x) int libinjection_sqli_check_fingerprint(struct libinjection_sqli_state* sql_state) { return libinjection_sqli_blacklist(sql_state) && libinjection_sqli_not_whitelist(sql_state); } char libinjection_sqli_lookup_word(struct libinjection_sqli_state *sql_state, int lookup_type, const char* str, size_t len) { if (lookup_type == LOOKUP_FINGERPRINT) { return libinjection_sqli_check_fingerprint(sql_state) ? 'X' : '\0'; } else { return bsearch_keyword_type(str, len, sql_keywords, sql_keywords_sz); } } int libinjection_sqli_blacklist(struct libinjection_sqli_state* sql_state) { /* * use minimum of 8 bytes to make sure gcc -fstack-protector * works correctly */ char fp2[LIBINJECTION_SQLI_MAX_TOKENS + 2 < 8 ? 8 : LIBINJECTION_SQLI_MAX_TOKENS + 2]; char ch; size_t i; size_t len = strlen(sql_state->fingerprint); int patmatch; if (len < 1) { sql_state->reason = __LINE__; return FALSE; } /* to keep everything compatible, convert the v0 fingerprint pattern to v1 v0: up to 5 chars, mixed case v1: 1 char is '0', up to 5 more chars, upper case */ fp2[0] = '0'; for (i = 0; i < len; ++i) { ch = sql_state->fingerprint[i]; if (ch >= 'a' && ch <= 'z') { ch -= 0x20; } fp2[i+1] = ch; } fp2[i+1] = '\0'; patmatch = is_keyword(fp2, len + 1) == TYPE_FINGERPRINT; /* * No match. * * Set sql_state->reason to current line number * only for debugging purposes. */ if (!patmatch) { sql_state->reason = __LINE__; return FALSE; } return TRUE; } /* * return TRUE if sqli, false is benign */ int libinjection_sqli_not_whitelist(struct libinjection_sqli_state* sql_state) { /* * We assume we got a SQLi match * This next part just helps reduce false positives. * */ char ch; size_t tlen = strlen(sql_state->fingerprint); if (tlen > 1 && sql_state->fingerprint[tlen-1] == TYPE_COMMENT) { /* * if ending comment is contains 'sp_password' then it's sqli! * MS Audit log appearantly ignores anything with * 'sp_password' in it. Unable to find primary refernece to * this "feature" of SQL Server but seems to be known sqli * technique */ if (my_memmem(sql_state->s, sql_state->slen, "sp_password", strlen("sp_password"))) { sql_state->reason = __LINE__; return TRUE; } } switch (tlen) { case 2:{ /* * case 2 are "very small SQLi" which make them * hard to tell from normal input... */ if (sql_state->fingerprint[1] == TYPE_UNION) { if (sql_state->stats_tokens == 2) { /* not sure why but 1U comes up in Sqli attack * likely part of parameter splitting/etc. * lots of reasons why "1 union" might be normal * input, so beep only if other SQLi things are present */ /* it really is a number and 'union' * other wise it has folding or comments */ sql_state->reason = __LINE__; return FALSE; } else { sql_state->reason = __LINE__; return TRUE; } } /* * if 'comment' is '#' ignore.. too many FP */ if (sql_state->tokenvec[1].val[0] == '#') { sql_state->reason = __LINE__; return FALSE; } /* * for fingerprint like 'nc', only comments of /x are treated * as SQL... ending comments of "--" and "#" are not sqli */ if (sql_state->tokenvec[0].type == TYPE_BAREWORD && sql_state->tokenvec[1].type == TYPE_COMMENT && sql_state->tokenvec[1].val[0] != '/') { sql_state->reason = __LINE__; return FALSE; } /* * if '1c' ends with '/x' then it's sqli */ if (sql_state->tokenvec[0].type == TYPE_NUMBER && sql_state->tokenvec[1].type == TYPE_COMMENT && sql_state->tokenvec[1].val[0] == '/') { return TRUE; } /** * there are some odd base64-looking query string values * 1234-ABCDEFEhfhihwuefi-- * which evaluate to "1c"... these are not SQLi * but 1234-- probably is. * Make sure the "1" in "1c" is actually a true decimal number * * Need to check -original- string since the folding step * may have merged tokens, e.g. "1+FOO" is folded into "1" * * Note: evasion: 1*1-- */ if (sql_state->tokenvec[0].type == TYPE_NUMBER && sql_state->tokenvec[1].type == TYPE_COMMENT) { if (sql_state->stats_tokens > 2) { /* we have some folding going on, highly likely sqli */ sql_state->reason = __LINE__; return TRUE; } /* * we check that next character after the number is either whitespace, * or '/' or a '-' ==> sqli. */ ch = sql_state->s[sql_state->tokenvec[0].len]; if ( ch <= 32 ) { /* next char was whitespace,e.g. "1234 --" * this isn't exactly correct.. ideally we should skip over all whitespace * but this seems to be ok for now */ return TRUE; } if (ch == '/' && sql_state->s[sql_state->tokenvec[0].len + 1] == '*') { return TRUE; } if (ch == '-' && sql_state->s[sql_state->tokenvec[0].len + 1] == '-') { return TRUE; } sql_state->reason = __LINE__; return FALSE; } /* * detect obvious sqli scans.. many people put '--' in plain text * so only detect if input ends with '--', e.g. 1-- but not 1-- foo */ if ((sql_state->tokenvec[1].len > 2) && sql_state->tokenvec[1].val[0] == '-') { sql_state->reason = __LINE__; return FALSE; } break; } /* case 2 */ case 3:{ /* * ...foo' + 'bar... * no opening quote, no closing quote * and each string has data */ if (streq(sql_state->fingerprint, "sos") || streq(sql_state->fingerprint, "s&s")) { if ((sql_state->tokenvec[0].str_open == CHAR_NULL) && (sql_state->tokenvec[2].str_close == CHAR_NULL) && (sql_state->tokenvec[0].str_close == sql_state->tokenvec[2].str_open)) { /* * if ....foo" + "bar.... */ sql_state->reason = __LINE__; return TRUE; } if (sql_state->stats_tokens == 3) { sql_state->reason = __LINE__; return FALSE; } /* * not sqli */ sql_state->reason = __LINE__; return FALSE; } else if (streq(sql_state->fingerprint, "s&n") || streq(sql_state->fingerprint, "n&1") || streq(sql_state->fingerprint, "1&1") || streq(sql_state->fingerprint, "1&v") || streq(sql_state->fingerprint, "1&s")) { /* 'sexy and 17' not sqli * 'sexy and 17<18' sqli */ if (sql_state->stats_tokens == 3) { sql_state->reason = __LINE__; return FALSE; } } else if (sql_state->tokenvec[1].type == TYPE_KEYWORD) { if ((sql_state->tokenvec[1].len < 5) || cstrcasecmp("INTO", sql_state->tokenvec[1].val, 4)) { /* if it's not "INTO OUTFILE", or "INTO DUMPFILE" (MySQL) * then treat as safe */ sql_state->reason = __LINE__; return FALSE; } } break; } /* case 3 */ case 4: case 5: { /* nothing right now */ break; } /* case 5 */ } /* end switch */ return TRUE; } /** Main API, detects SQLi in an input. * * */ static int reparse_as_mysql(struct libinjection_sqli_state * sql_state) { return sql_state->stats_comment_ddx || sql_state->stats_comment_hash; } /* * This function is mostly use with SWIG */ struct libinjection_sqli_token* libinjection_sqli_get_token(struct libinjection_sqli_state * sql_state, int i) { if (i < 0 || i > LIBINJECTION_SQLI_MAX_TOKENS) { return NULL; } return &(sql_state->tokenvec[i]); } int libinjection_is_sqli(struct libinjection_sqli_state * sql_state) { const char *s = sql_state->s; size_t slen = sql_state->slen; /* * no input? not sqli */ if (slen == 0) { return FALSE; } /* * test input "as-is" */ libinjection_sqli_fingerprint(sql_state, FLAG_QUOTE_NONE | FLAG_SQL_ANSI); if (sql_state->lookup(sql_state, LOOKUP_FINGERPRINT, sql_state->fingerprint, strlen(sql_state->fingerprint))) { return TRUE; } else if (reparse_as_mysql(sql_state)) { libinjection_sqli_fingerprint(sql_state, FLAG_QUOTE_NONE | FLAG_SQL_MYSQL); if (sql_state->lookup(sql_state, LOOKUP_FINGERPRINT, sql_state->fingerprint, strlen(sql_state->fingerprint))) { return TRUE; } } /* * if input has a single_quote, then * test as if input was actually ' * example: if input if "1' = 1", then pretend it's * "'1' = 1" * Porting Notes: example the same as doing * is_string_sqli(sql_state, "'" + s, slen+1, NULL, fn, arg) * */ if (memchr(s, CHAR_SINGLE, slen)) { libinjection_sqli_fingerprint(sql_state, FLAG_QUOTE_SINGLE | FLAG_SQL_ANSI); if (sql_state->lookup(sql_state, LOOKUP_FINGERPRINT, sql_state->fingerprint, strlen(sql_state->fingerprint))) { return TRUE; } else if (reparse_as_mysql(sql_state)) { libinjection_sqli_fingerprint(sql_state, FLAG_QUOTE_SINGLE | FLAG_SQL_MYSQL); if (sql_state->lookup(sql_state, LOOKUP_FINGERPRINT, sql_state->fingerprint, strlen(sql_state->fingerprint))) { return TRUE; } } } /* * same as above but with a double-quote " */ if (memchr(s, CHAR_DOUBLE, slen)) { libinjection_sqli_fingerprint(sql_state, FLAG_QUOTE_DOUBLE | FLAG_SQL_MYSQL); if (sql_state->lookup(sql_state, LOOKUP_FINGERPRINT, sql_state->fingerprint, strlen(sql_state->fingerprint))) { return TRUE; } } /* * Hurray, input is not SQLi */ return FALSE; } modsecurity-apache_2.7.7/apache2/libinjection/libinjection_sqli_data.h0000664000175000017500000063410012253711345026461 0ustar zimmerlezimmerle #ifndef _LIBINJECTION_SQLI_DATA_H #define _LIBINJECTION_SQLI_DATA_H #include "libinjection.h" typedef struct { const char *word; char type; } keyword_t; static size_t parse_money(sfilter * sf); static size_t parse_other(sfilter * sf); static size_t parse_white(sfilter * sf); static size_t parse_operator1(sfilter *sf); static size_t parse_char(sfilter *sf); static size_t parse_hash(sfilter *sf); static size_t parse_dash(sfilter *sf); static size_t parse_slash(sfilter *sf); static size_t parse_backslash(sfilter * sf); static size_t parse_operator2(sfilter *sf); static size_t parse_string(sfilter *sf); static size_t parse_word(sfilter * sf); static size_t parse_var(sfilter * sf); static size_t parse_number(sfilter * sf); static size_t parse_tick(sfilter * sf); static size_t parse_ustring(sfilter * sf); static size_t parse_qstring(sfilter * sf); static size_t parse_nqstring(sfilter * sf); static size_t parse_xstring(sfilter * sf); static size_t parse_bstring(sfilter * sf); static size_t parse_estring(sfilter * sf); static size_t parse_bword(sfilter * sf); typedef size_t (*pt2Function)(sfilter *sf); static const pt2Function char_parse_map[] = { &parse_white, /* 0 */ &parse_white, /* 1 */ &parse_white, /* 2 */ &parse_white, /* 3 */ &parse_white, /* 4 */ &parse_white, /* 5 */ &parse_white, /* 6 */ &parse_white, /* 7 */ &parse_white, /* 8 */ &parse_white, /* 9 */ &parse_white, /* 10 */ &parse_white, /* 11 */ &parse_white, /* 12 */ &parse_white, /* 13 */ &parse_white, /* 14 */ &parse_white, /* 15 */ &parse_white, /* 16 */ &parse_white, /* 17 */ &parse_white, /* 18 */ &parse_white, /* 19 */ &parse_white, /* 20 */ &parse_white, /* 21 */ &parse_white, /* 22 */ &parse_white, /* 23 */ &parse_white, /* 24 */ &parse_white, /* 25 */ &parse_white, /* 26 */ &parse_white, /* 27 */ &parse_white, /* 28 */ &parse_white, /* 29 */ &parse_white, /* 30 */ &parse_white, /* 31 */ &parse_white, /* 32 */ &parse_operator2, /* 33 */ &parse_string, /* 34 */ &parse_hash, /* 35 */ &parse_money, /* 36 */ &parse_operator1, /* 37 */ &parse_operator2, /* 38 */ &parse_string, /* 39 */ &parse_char, /* 40 */ &parse_char, /* 41 */ &parse_operator2, /* 42 */ &parse_operator1, /* 43 */ &parse_char, /* 44 */ &parse_dash, /* 45 */ &parse_number, /* 46 */ &parse_slash, /* 47 */ &parse_number, /* 48 */ &parse_number, /* 49 */ &parse_number, /* 50 */ &parse_number, /* 51 */ &parse_number, /* 52 */ &parse_number, /* 53 */ &parse_number, /* 54 */ &parse_number, /* 55 */ &parse_number, /* 56 */ &parse_number, /* 57 */ &parse_operator2, /* 58 */ &parse_char, /* 59 */ &parse_operator2, /* 60 */ &parse_operator2, /* 61 */ &parse_operator2, /* 62 */ &parse_other, /* 63 */ &parse_var, /* 64 */ &parse_word, /* 65 */ &parse_bstring, /* 66 */ &parse_word, /* 67 */ &parse_word, /* 68 */ &parse_estring, /* 69 */ &parse_word, /* 70 */ &parse_word, /* 71 */ &parse_word, /* 72 */ &parse_word, /* 73 */ &parse_word, /* 74 */ &parse_word, /* 75 */ &parse_word, /* 76 */ &parse_word, /* 77 */ &parse_nqstring, /* 78 */ &parse_word, /* 79 */ &parse_word, /* 80 */ &parse_qstring, /* 81 */ &parse_word, /* 82 */ &parse_word, /* 83 */ &parse_word, /* 84 */ &parse_ustring, /* 85 */ &parse_word, /* 86 */ &parse_word, /* 87 */ &parse_xstring, /* 88 */ &parse_word, /* 89 */ &parse_word, /* 90 */ &parse_bword, /* 91 */ &parse_backslash, /* 92 */ &parse_other, /* 93 */ &parse_operator1, /* 94 */ &parse_word, /* 95 */ &parse_tick, /* 96 */ &parse_word, /* 97 */ &parse_bstring, /* 98 */ &parse_word, /* 99 */ &parse_word, /* 100 */ &parse_estring, /* 101 */ &parse_word, /* 102 */ &parse_word, /* 103 */ &parse_word, /* 104 */ &parse_word, /* 105 */ &parse_word, /* 106 */ &parse_word, /* 107 */ &parse_word, /* 108 */ &parse_word, /* 109 */ &parse_nqstring, /* 110 */ &parse_word, /* 111 */ &parse_word, /* 112 */ &parse_qstring, /* 113 */ &parse_word, /* 114 */ &parse_word, /* 115 */ &parse_word, /* 116 */ &parse_ustring, /* 117 */ &parse_word, /* 118 */ &parse_word, /* 119 */ &parse_xstring, /* 120 */ &parse_word, /* 121 */ &parse_word, /* 122 */ &parse_char, /* 123 */ &parse_operator2, /* 124 */ &parse_char, /* 125 */ &parse_operator1, /* 126 */ &parse_white, /* 127 */ }; static const keyword_t sql_keywords[] = { {"!!", 'o'}, {"!<", 'o'}, {"!=", 'o'}, {"!>", 'o'}, {"%=", 'o'}, {"&&", '&'}, {"&=", 'o'}, {"*=", 'o'}, {"+=", 'o'}, {"-=", 'o'}, {"/=", 'o'}, {"0&(1)O", 'F'}, {"0&(1)U", 'F'}, {"0&(1O(", 'F'}, {"0&(1OF", 'F'}, {"0&(1OS", 'F'}, {"0&(1OV", 'F'}, {"0&(F()", 'F'}, {"0&(F(1", 'F'}, {"0&(F(F", 'F'}, {"0&(F(N", 'F'}, {"0&(F(S", 'F'}, {"0&(F(V", 'F'}, {"0&(N)O", 'F'}, {"0&(N)U", 'F'}, {"0&(NO(", 'F'}, {"0&(NOF", 'F'}, {"0&(NOS", 'F'}, {"0&(NOV", 'F'}, {"0&(S)O", 'F'}, {"0&(S)U", 'F'}, {"0&(SO(", 'F'}, {"0&(SO1", 'F'}, {"0&(SOF", 'F'}, {"0&(SON", 'F'}, {"0&(SOS", 'F'}, {"0&(SOV", 'F'}, {"0&(V)O", 'F'}, {"0&(V)U", 'F'}, {"0&(VO(", 'F'}, {"0&(VOF", 'F'}, {"0&(VOS", 'F'}, {"0&1O(1", 'F'}, {"0&1O(F", 'F'}, {"0&1O(N", 'F'}, {"0&1O(S", 'F'}, {"0&1O(V", 'F'}, {"0&1OF(", 'F'}, {"0&1OS(", 'F'}, {"0&1OS1", 'F'}, {"0&1OSF", 'F'}, {"0&1OSO", 'F'}, {"0&1OSU", 'F'}, {"0&1OSV", 'F'}, {"0&1OV(", 'F'}, {"0&1OVF", 'F'}, {"0&1OVO", 'F'}, {"0&1OVS", 'F'}, {"0&1OVU", 'F'}, {"0&1UE(", 'F'}, {"0&1UE1", 'F'}, {"0&1UEF", 'F'}, {"0&1UEK", 'F'}, {"0&1UEN", 'F'}, {"0&1UES", 'F'}, {"0&1UEV", 'F'}, {"0&F()O", 'F'}, {"0&F()U", 'F'}, {"0&F(1)", 'F'}, {"0&F(1O", 'F'}, {"0&F(F(", 'F'}, {"0&F(N)", 'F'}, {"0&F(NO", 'F'}, {"0&F(S)", 'F'}, {"0&F(SO", 'F'}, {"0&F(V)", 'F'}, {"0&F(VO", 'F'}, {"0&NO(1", 'F'}, {"0&NO(F", 'F'}, {"0&NO(N", 'F'}, {"0&NO(S", 'F'}, {"0&NO(V", 'F'}, {"0&NOF(", 'F'}, {"0&NOS(", 'F'}, {"0&NOS1", 'F'}, {"0&NOSF", 'F'}, {"0&NOSO", 'F'}, {"0&NOSU", 'F'}, {"0&NOSV", 'F'}, {"0&NOV(", 'F'}, {"0&NOVF", 'F'}, {"0&NOVO", 'F'}, {"0&NOVS", 'F'}, {"0&NOVU", 'F'}, {"0&NUE(", 'F'}, {"0&NUE1", 'F'}, {"0&NUEF", 'F'}, {"0&NUEK", 'F'}, {"0&NUEN", 'F'}, {"0&NUES", 'F'}, {"0&NUEV", 'F'}, {"0&SO(1", 'F'}, {"0&SO(F", 'F'}, {"0&SO(N", 'F'}, {"0&SO(S", 'F'}, {"0&SO(V", 'F'}, {"0&SO1(", 'F'}, {"0&SO1F", 'F'}, {"0&SO1N", 'F'}, {"0&SO1O", 'F'}, {"0&SO1S", 'F'}, {"0&SO1U", 'F'}, {"0&SO1V", 'F'}, {"0&SOF(", 'F'}, {"0&SON(", 'F'}, {"0&SON1", 'F'}, {"0&SONF", 'F'}, {"0&SONO", 'F'}, {"0&SONU", 'F'}, {"0&SOS(", 'F'}, {"0&SOS1", 'F'}, {"0&SOSF", 'F'}, {"0&SOSO", 'F'}, {"0&SOSU", 'F'}, {"0&SOSV", 'F'}, {"0&SOV(", 'F'}, {"0&SOVF", 'F'}, {"0&SOVO", 'F'}, {"0&SOVS", 'F'}, {"0&SOVU", 'F'}, {"0&SUE(", 'F'}, {"0&SUE1", 'F'}, {"0&SUEF", 'F'}, {"0&SUEK", 'F'}, {"0&SUEN", 'F'}, {"0&SUES", 'F'}, {"0&SUEV", 'F'}, {"0&VO(1", 'F'}, {"0&VO(F", 'F'}, {"0&VO(N", 'F'}, {"0&VO(S", 'F'}, {"0&VO(V", 'F'}, {"0&VOF(", 'F'}, {"0&VOS(", 'F'}, {"0&VOS1", 'F'}, {"0&VOSF", 'F'}, {"0&VOSO", 'F'}, {"0&VOSU", 'F'}, {"0&VOSV", 'F'}, {"0&VUE(", 'F'}, {"0&VUE1", 'F'}, {"0&VUEF", 'F'}, {"0&VUEK", 'F'}, {"0&VUEN", 'F'}, {"0&VUES", 'F'}, {"0&VUEV", 'F'}, {"0)UE(1", 'F'}, {"0)UE(F", 'F'}, {"0)UE(N", 'F'}, {"0)UE(S", 'F'}, {"0)UE(V", 'F'}, {"0)UE1K", 'F'}, {"0)UE1O", 'F'}, {"0)UEF(", 'F'}, {"0)UEK(", 'F'}, {"0)UEK1", 'F'}, {"0)UEKF", 'F'}, {"0)UEKN", 'F'}, {"0)UEKS", 'F'}, {"0)UEKV", 'F'}, {"0)UENK", 'F'}, {"0)UENO", 'F'}, {"0)UESK", 'F'}, {"0)UESO", 'F'}, {"0)UEVK", 'F'}, {"0)UEVO", 'F'}, {"01&(1&", 'F'}, {"01&(1)", 'F'}, {"01&(1,", 'F'}, {"01&(1O", 'F'}, {"01&(E(", 'F'}, {"01&(E1", 'F'}, {"01&(EF", 'F'}, {"01&(EK", 'F'}, {"01&(EN", 'F'}, {"01&(EO", 'F'}, {"01&(ES", 'F'}, {"01&(ET", 'F'}, {"01&(EV", 'F'}, {"01&(F(", 'F'}, {"01&(N&", 'F'}, {"01&(N)", 'F'}, {"01&(N,", 'F'}, {"01&(NO", 'F'}, {"01&(S&", 'F'}, {"01&(S)", 'F'}, {"01&(S,", 'F'}, {"01&(SO", 'F'}, {"01&(T(", 'F'}, {"01&(V&", 'F'}, {"01&(V)", 'F'}, {"01&(V,", 'F'}, {"01&(VO", 'F'}, {"01&1", 'F'}, {"01&1&(", 'F'}, {"01&1&1", 'F'}, {"01&1&F", 'F'}, {"01&1&N", 'F'}, {"01&1&S", 'F'}, {"01&1&V", 'F'}, {"01&1)&", 'F'}, {"01&1)C", 'F'}, {"01&1)O", 'F'}, {"01&1)U", 'F'}, {"01&1;", 'F'}, {"01&1;C", 'F'}, {"01&1;E", 'F'}, {"01&1;T", 'F'}, {"01&1B(", 'F'}, {"01&1B1", 'F'}, {"01&1BF", 'F'}, {"01&1BN", 'F'}, {"01&1BS", 'F'}, {"01&1BV", 'F'}, {"01&1C", 'F'}, {"01&1EK", 'F'}, {"01&1EN", 'F'}, {"01&1F(", 'F'}, {"01&1K(", 'F'}, {"01&1K1", 'F'}, {"01&1KF", 'F'}, {"01&1KN", 'F'}, {"01&1KS", 'F'}, {"01&1KV", 'F'}, {"01&1O(", 'F'}, {"01&1OF", 'F'}, {"01&1OO", 'F'}, {"01&1OS", 'F'}, {"01&1OV", 'F'}, {"01&1TN", 'F'}, {"01&1U", 'F'}, {"01&1U(", 'F'}, {"01&1U;", 'F'}, {"01&1UC", 'F'}, {"01&1UE", 'F'}, {"01&E(1", 'F'}, {"01&E(F", 'F'}, {"01&E(N", 'F'}, {"01&E(O", 'F'}, {"01&E(S", 'F'}, {"01&E(V", 'F'}, {"01&E1", 'F'}, {"01&E1;", 'F'}, {"01&E1C", 'F'}, {"01&E1K", 'F'}, {"01&E1O", 'F'}, {"01&EF(", 'F'}, {"01&EK(", 'F'}, {"01&EK1", 'F'}, {"01&EKF", 'F'}, {"01&EKN", 'F'}, {"01&EKS", 'F'}, {"01&EKU", 'F'}, {"01&EKV", 'F'}, {"01&EN", 'F'}, {"01&EN;", 'F'}, {"01&ENC", 'F'}, {"01&ENK", 'F'}, {"01&ENO", 'F'}, {"01&ES", 'F'}, {"01&ES;", 'F'}, {"01&ESC", 'F'}, {"01&ESK", 'F'}, {"01&ESO", 'F'}, {"01&EUE", 'F'}, {"01&EV", 'F'}, {"01&EV;", 'F'}, {"01&EVC", 'F'}, {"01&EVK", 'F'}, {"01&EVO", 'F'}, {"01&F()", 'F'}, {"01&F(1", 'F'}, {"01&F(E", 'F'}, {"01&F(F", 'F'}, {"01&F(N", 'F'}, {"01&F(S", 'F'}, {"01&F(T", 'F'}, {"01&F(V", 'F'}, {"01&K&(", 'F'}, {"01&K&1", 'F'}, {"01&K&F", 'F'}, {"01&K&N", 'F'}, {"01&K&S", 'F'}, {"01&K&V", 'F'}, {"01&K(1", 'F'}, {"01&K(F", 'F'}, {"01&K(N", 'F'}, {"01&K(S", 'F'}, {"01&K(V", 'F'}, {"01&K1O", 'F'}, {"01&KF(", 'F'}, {"01&KNK", 'F'}, {"01&KO(", 'F'}, {"01&KO1", 'F'}, {"01&KOF", 'F'}, {"01&KOK", 'F'}, {"01&KON", 'F'}, {"01&KOS", 'F'}, {"01&KOV", 'F'}, {"01&KSO", 'F'}, {"01&KVO", 'F'}, {"01&N&(", 'F'}, {"01&N&1", 'F'}, {"01&N&F", 'F'}, {"01&N&N", 'F'}, {"01&N&S", 'F'}, {"01&N&V", 'F'}, {"01&N)&", 'F'}, {"01&N)C", 'F'}, {"01&N)O", 'F'}, {"01&N)U", 'F'}, {"01&N;", 'F'}, {"01&N;C", 'F'}, {"01&N;E", 'F'}, {"01&N;T", 'F'}, {"01&NB(", 'F'}, {"01&NB1", 'F'}, {"01&NBF", 'F'}, {"01&NBN", 'F'}, {"01&NBS", 'F'}, {"01&NBV", 'F'}, {"01&NC", 'F'}, {"01&NEN", 'F'}, {"01&NF(", 'F'}, {"01&NK(", 'F'}, {"01&NK1", 'F'}, {"01&NKF", 'F'}, {"01&NKN", 'F'}, {"01&NKS", 'F'}, {"01&NKV", 'F'}, {"01&NO(", 'F'}, {"01&NOF", 'F'}, {"01&NOS", 'F'}, {"01&NOV", 'F'}, {"01&NTN", 'F'}, {"01&NU", 'F'}, {"01&NU(", 'F'}, {"01&NU;", 'F'}, {"01&NUC", 'F'}, {"01&NUE", 'F'}, {"01&S", 'F'}, {"01&S&(", 'F'}, {"01&S&1", 'F'}, {"01&S&F", 'F'}, {"01&S&N", 'F'}, {"01&S&S", 'F'}, {"01&S&V", 'F'}, {"01&S)&", 'F'}, {"01&S)C", 'F'}, {"01&S)O", 'F'}, {"01&S)U", 'F'}, {"01&S1", 'F'}, {"01&S1;", 'F'}, {"01&S1C", 'F'}, {"01&S1O", 'F'}, {"01&S;", 'F'}, {"01&S;C", 'F'}, {"01&S;E", 'F'}, {"01&S;T", 'F'}, {"01&SB(", 'F'}, {"01&SB1", 'F'}, {"01&SBF", 'F'}, {"01&SBN", 'F'}, {"01&SBS", 'F'}, {"01&SBV", 'F'}, {"01&SC", 'F'}, {"01&SEK", 'F'}, {"01&SEN", 'F'}, {"01&SF(", 'F'}, {"01&SK(", 'F'}, {"01&SK1", 'F'}, {"01&SKF", 'F'}, {"01&SKN", 'F'}, {"01&SKS", 'F'}, {"01&SKV", 'F'}, {"01&SO(", 'F'}, {"01&SO1", 'F'}, {"01&SOF", 'F'}, {"01&SON", 'F'}, {"01&SOO", 'F'}, {"01&SOS", 'F'}, {"01&SOV", 'F'}, {"01&STN", 'F'}, {"01&SU", 'F'}, {"01&SU(", 'F'}, {"01&SU;", 'F'}, {"01&SUC", 'F'}, {"01&SUE", 'F'}, {"01&SV", 'F'}, {"01&SV;", 'F'}, {"01&SVC", 'F'}, {"01&SVO", 'F'}, {"01&T(1", 'F'}, {"01&T(E", 'F'}, {"01&T(F", 'F'}, {"01&T(N", 'F'}, {"01&T(S", 'F'}, {"01&T(V", 'F'}, {"01&V", 'F'}, {"01&V&(", 'F'}, {"01&V&1", 'F'}, {"01&V&F", 'F'}, {"01&V&N", 'F'}, {"01&V&S", 'F'}, {"01&V&V", 'F'}, {"01&V)&", 'F'}, {"01&V)C", 'F'}, {"01&V)O", 'F'}, {"01&V)U", 'F'}, {"01&V;", 'F'}, {"01&V;C", 'F'}, {"01&V;E", 'F'}, {"01&V;T", 'F'}, {"01&VB(", 'F'}, {"01&VB1", 'F'}, {"01&VBF", 'F'}, {"01&VBN", 'F'}, {"01&VBS", 'F'}, {"01&VBV", 'F'}, {"01&VC", 'F'}, {"01&VEK", 'F'}, {"01&VEN", 'F'}, {"01&VF(", 'F'}, {"01&VK(", 'F'}, {"01&VK1", 'F'}, {"01&VKF", 'F'}, {"01&VKN", 'F'}, {"01&VKS", 'F'}, {"01&VKV", 'F'}, {"01&VO(", 'F'}, {"01&VOF", 'F'}, {"01&VOO", 'F'}, {"01&VOS", 'F'}, {"01&VS", 'F'}, {"01&VS;", 'F'}, {"01&VSC", 'F'}, {"01&VSO", 'F'}, {"01&VTN", 'F'}, {"01&VU", 'F'}, {"01&VU(", 'F'}, {"01&VU;", 'F'}, {"01&VUC", 'F'}, {"01&VUE", 'F'}, {"01(EF(", 'F'}, {"01(EKF", 'F'}, {"01(EKN", 'F'}, {"01(ENK", 'F'}, {"01(U(E", 'F'}, {"01)&(1", 'F'}, {"01)&(E", 'F'}, {"01)&(F", 'F'}, {"01)&(N", 'F'}, {"01)&(S", 'F'}, {"01)&(V", 'F'}, {"01)&1", 'F'}, {"01)&1&", 'F'}, {"01)&1)", 'F'}, {"01)&1;", 'F'}, {"01)&1B", 'F'}, {"01)&1C", 'F'}, {"01)&1F", 'F'}, {"01)&1O", 'F'}, {"01)&1U", 'F'}, {"01)&F(", 'F'}, {"01)&N", 'F'}, {"01)&N&", 'F'}, {"01)&N)", 'F'}, {"01)&N;", 'F'}, {"01)&NB", 'F'}, {"01)&NC", 'F'}, {"01)&NF", 'F'}, {"01)&NO", 'F'}, {"01)&NU", 'F'}, {"01)&S", 'F'}, {"01)&S&", 'F'}, {"01)&S)", 'F'}, {"01)&S;", 'F'}, {"01)&SB", 'F'}, {"01)&SC", 'F'}, {"01)&SF", 'F'}, {"01)&SO", 'F'}, {"01)&SU", 'F'}, {"01)&V", 'F'}, {"01)&V&", 'F'}, {"01)&V)", 'F'}, {"01)&V;", 'F'}, {"01)&VB", 'F'}, {"01)&VC", 'F'}, {"01)&VF", 'F'}, {"01)&VO", 'F'}, {"01)&VU", 'F'}, {"01),(1", 'F'}, {"01),(F", 'F'}, {"01),(N", 'F'}, {"01),(S", 'F'}, {"01),(V", 'F'}, {"01);E(", 'F'}, {"01);E1", 'F'}, {"01);EF", 'F'}, {"01);EK", 'F'}, {"01);EN", 'F'}, {"01);EO", 'F'}, {"01);ES", 'F'}, {"01);EV", 'F'}, {"01);T(", 'F'}, {"01);T1", 'F'}, {"01);TF", 'F'}, {"01);TK", 'F'}, {"01);TN", 'F'}, {"01);TO", 'F'}, {"01);TS", 'F'}, {"01);TV", 'F'}, {"01)B(1", 'F'}, {"01)B(F", 'F'}, {"01)B(N", 'F'}, {"01)B(S", 'F'}, {"01)B(V", 'F'}, {"01)B1", 'F'}, {"01)B1&", 'F'}, {"01)B1;", 'F'}, {"01)B1C", 'F'}, {"01)B1K", 'F'}, {"01)B1N", 'F'}, {"01)B1O", 'F'}, {"01)B1U", 'F'}, {"01)BF(", 'F'}, {"01)BN", 'F'}, {"01)BN&", 'F'}, {"01)BN;", 'F'}, {"01)BNC", 'F'}, {"01)BNK", 'F'}, {"01)BNO", 'F'}, {"01)BNU", 'F'}, {"01)BS", 'F'}, {"01)BS&", 'F'}, {"01)BS;", 'F'}, {"01)BSC", 'F'}, {"01)BSK", 'F'}, {"01)BSO", 'F'}, {"01)BSU", 'F'}, {"01)BV", 'F'}, {"01)BV&", 'F'}, {"01)BV;", 'F'}, {"01)BVC", 'F'}, {"01)BVK", 'F'}, {"01)BVO", 'F'}, {"01)BVU", 'F'}, {"01)C", 'F'}, {"01)E(1", 'F'}, {"01)E(F", 'F'}, {"01)E(N", 'F'}, {"01)E(S", 'F'}, {"01)E(V", 'F'}, {"01)E1C", 'F'}, {"01)E1O", 'F'}, {"01)EF(", 'F'}, {"01)EK(", 'F'}, {"01)EK1", 'F'}, {"01)EKF", 'F'}, {"01)EKN", 'F'}, {"01)EKS", 'F'}, {"01)EKV", 'F'}, {"01)ENC", 'F'}, {"01)ENO", 'F'}, {"01)ESC", 'F'}, {"01)ESO", 'F'}, {"01)EVC", 'F'}, {"01)EVO", 'F'}, {"01)K(1", 'F'}, {"01)K(F", 'F'}, {"01)K(N", 'F'}, {"01)K(S", 'F'}, {"01)K(V", 'F'}, {"01)K1&", 'F'}, {"01)K1;", 'F'}, {"01)K1B", 'F'}, {"01)K1E", 'F'}, {"01)K1O", 'F'}, {"01)K1U", 'F'}, {"01)KB(", 'F'}, {"01)KB1", 'F'}, {"01)KBF", 'F'}, {"01)KBN", 'F'}, {"01)KBS", 'F'}, {"01)KBV", 'F'}, {"01)KF(", 'F'}, {"01)KN&", 'F'}, {"01)KN;", 'F'}, {"01)KNB", 'F'}, {"01)KNE", 'F'}, {"01)KNK", 'F'}, {"01)KNU", 'F'}, {"01)KS&", 'F'}, {"01)KS;", 'F'}, {"01)KSB", 'F'}, {"01)KSE", 'F'}, {"01)KSO", 'F'}, {"01)KSU", 'F'}, {"01)KUE", 'F'}, {"01)KV&", 'F'}, {"01)KV;", 'F'}, {"01)KVB", 'F'}, {"01)KVE", 'F'}, {"01)KVO", 'F'}, {"01)KVU", 'F'}, {"01)O(1", 'F'}, {"01)O(E", 'F'}, {"01)O(F", 'F'}, {"01)O(N", 'F'}, {"01)O(S", 'F'}, {"01)O(T", 'F'}, {"01)O(V", 'F'}, {"01)O1", 'F'}, {"01)O1&", 'F'}, {"01)O1)", 'F'}, {"01)O1;", 'F'}, {"01)O1B", 'F'}, {"01)O1C", 'F'}, {"01)O1K", 'F'}, {"01)O1O", 'F'}, {"01)O1U", 'F'}, {"01)OF(", 'F'}, {"01)ON&", 'F'}, {"01)ON)", 'F'}, {"01)ON;", 'F'}, {"01)ONB", 'F'}, {"01)ONC", 'F'}, {"01)ONK", 'F'}, {"01)ONO", 'F'}, {"01)ONU", 'F'}, {"01)OS", 'F'}, {"01)OS&", 'F'}, {"01)OS)", 'F'}, {"01)OS;", 'F'}, {"01)OSB", 'F'}, {"01)OSC", 'F'}, {"01)OSK", 'F'}, {"01)OSO", 'F'}, {"01)OSU", 'F'}, {"01)OV", 'F'}, {"01)OV&", 'F'}, {"01)OV)", 'F'}, {"01)OV;", 'F'}, {"01)OVB", 'F'}, {"01)OVC", 'F'}, {"01)OVK", 'F'}, {"01)OVO", 'F'}, {"01)OVU", 'F'}, {"01)U(E", 'F'}, {"01)UE(", 'F'}, {"01)UE1", 'F'}, {"01)UEF", 'F'}, {"01)UEK", 'F'}, {"01)UEN", 'F'}, {"01)UES", 'F'}, {"01)UEV", 'F'}, {"01,(1)", 'F'}, {"01,(1O", 'F'}, {"01,(E(", 'F'}, {"01,(E1", 'F'}, {"01,(EF", 'F'}, {"01,(EK", 'F'}, {"01,(EN", 'F'}, {"01,(ES", 'F'}, {"01,(EV", 'F'}, {"01,(F(", 'F'}, {"01,(N)", 'F'}, {"01,(NO", 'F'}, {"01,(S)", 'F'}, {"01,(SO", 'F'}, {"01,(V)", 'F'}, {"01,(VO", 'F'}, {"01,F()", 'F'}, {"01,F(1", 'F'}, {"01,F(F", 'F'}, {"01,F(N", 'F'}, {"01,F(S", 'F'}, {"01,F(T", 'F'}, {"01,F(V", 'F'}, {"01,V),", 'F'}, {"01,V)O", 'F'}, {"01,VB(", 'F'}, {"01,VB1", 'F'}, {"01,VBF", 'F'}, {"01,VBN", 'F'}, {"01,VBS", 'F'}, {"01,VBV", 'F'}, {"01,VO(", 'F'}, {"01,VOF", 'F'}, {"01,VOS", 'F'}, {"01,VUE", 'F'}, {"01;E(1", 'F'}, {"01;E(E", 'F'}, {"01;E(F", 'F'}, {"01;E(N", 'F'}, {"01;E(S", 'F'}, {"01;E(V", 'F'}, {"01;E1,", 'F'}, {"01;E1;", 'F'}, {"01;E1C", 'F'}, {"01;E1K", 'F'}, {"01;E1O", 'F'}, {"01;E1T", 'F'}, {"01;EF(", 'F'}, {"01;EK(", 'F'}, {"01;EK1", 'F'}, {"01;EKF", 'F'}, {"01;EKN", 'F'}, {"01;EKO", 'F'}, {"01;EKS", 'F'}, {"01;EKV", 'F'}, {"01;EN,", 'F'}, {"01;EN;", 'F'}, {"01;ENC", 'F'}, {"01;ENE", 'F'}, {"01;ENK", 'F'}, {"01;ENO", 'F'}, {"01;ENT", 'F'}, {"01;EO(", 'F'}, {"01;ES,", 'F'}, {"01;ES;", 'F'}, {"01;ESC", 'F'}, {"01;ESK", 'F'}, {"01;ESO", 'F'}, {"01;EST", 'F'}, {"01;EV,", 'F'}, {"01;EV;", 'F'}, {"01;EVC", 'F'}, {"01;EVK", 'F'}, {"01;EVO", 'F'}, {"01;EVT", 'F'}, {"01;N:T", 'F'}, {"01;T(1", 'F'}, {"01;T(E", 'F'}, {"01;T(F", 'F'}, {"01;T(N", 'F'}, {"01;T(S", 'F'}, {"01;T(V", 'F'}, {"01;T1,", 'F'}, {"01;T1;", 'F'}, {"01;T1C", 'F'}, {"01;T1F", 'F'}, {"01;T1K", 'F'}, {"01;T1O", 'F'}, {"01;T1T", 'F'}, {"01;T;", 'F'}, {"01;T;C", 'F'}, {"01;TF(", 'F'}, {"01;TK(", 'F'}, {"01;TK1", 'F'}, {"01;TKF", 'F'}, {"01;TKK", 'F'}, {"01;TKN", 'F'}, {"01;TKO", 'F'}, {"01;TKS", 'F'}, {"01;TKV", 'F'}, {"01;TN(", 'F'}, {"01;TN,", 'F'}, {"01;TN1", 'F'}, {"01;TN;", 'F'}, {"01;TNC", 'F'}, {"01;TNF", 'F'}, {"01;TNK", 'F'}, {"01;TNN", 'F'}, {"01;TNO", 'F'}, {"01;TNS", 'F'}, {"01;TNT", 'F'}, {"01;TNV", 'F'}, {"01;TO(", 'F'}, {"01;TS,", 'F'}, {"01;TS;", 'F'}, {"01;TSC", 'F'}, {"01;TSF", 'F'}, {"01;TSK", 'F'}, {"01;TSO", 'F'}, {"01;TST", 'F'}, {"01;TT(", 'F'}, {"01;TT1", 'F'}, {"01;TTF", 'F'}, {"01;TTN", 'F'}, {"01;TTS", 'F'}, {"01;TTV", 'F'}, {"01;TV,", 'F'}, {"01;TV;", 'F'}, {"01;TVC", 'F'}, {"01;TVF", 'F'}, {"01;TVK", 'F'}, {"01;TVO", 'F'}, {"01;TVT", 'F'}, {"01A(F(", 'F'}, {"01A(N)", 'F'}, {"01A(NO", 'F'}, {"01A(S)", 'F'}, {"01A(SO", 'F'}, {"01A(V)", 'F'}, {"01A(VO", 'F'}, {"01AF()", 'F'}, {"01AF(1", 'F'}, {"01AF(F", 'F'}, {"01AF(N", 'F'}, {"01AF(S", 'F'}, {"01AF(V", 'F'}, {"01ASO(", 'F'}, {"01ASO1", 'F'}, {"01ASOF", 'F'}, {"01ASON", 'F'}, {"01ASOS", 'F'}, {"01ASOV", 'F'}, {"01ASUE", 'F'}, {"01ATO(", 'F'}, {"01ATO1", 'F'}, {"01ATOF", 'F'}, {"01ATON", 'F'}, {"01ATOS", 'F'}, {"01ATOV", 'F'}, {"01ATUE", 'F'}, {"01AVO(", 'F'}, {"01AVOF", 'F'}, {"01AVOS", 'F'}, {"01AVUE", 'F'}, {"01B(1)", 'F'}, {"01B(1O", 'F'}, {"01B(F(", 'F'}, {"01B(N)", 'F'}, {"01B(NO", 'F'}, {"01B(S)", 'F'}, {"01B(SO", 'F'}, {"01B(V)", 'F'}, {"01B(VO", 'F'}, {"01B1", 'F'}, {"01B1&(", 'F'}, {"01B1&1", 'F'}, {"01B1&F", 'F'}, {"01B1&N", 'F'}, {"01B1&S", 'F'}, {"01B1&V", 'F'}, {"01B1,(", 'F'}, {"01B1,F", 'F'}, {"01B1,V", 'F'}, {"01B1;", 'F'}, {"01B1;C", 'F'}, {"01B1B(", 'F'}, {"01B1B1", 'F'}, {"01B1BF", 'F'}, {"01B1BN", 'F'}, {"01B1BS", 'F'}, {"01B1BV", 'F'}, {"01B1C", 'F'}, {"01B1K(", 'F'}, {"01B1K1", 'F'}, {"01B1KF", 'F'}, {"01B1KN", 'F'}, {"01B1KS", 'F'}, {"01B1KV", 'F'}, {"01B1O(", 'F'}, {"01B1OF", 'F'}, {"01B1OS", 'F'}, {"01B1OV", 'F'}, {"01B1U(", 'F'}, {"01B1UE", 'F'}, {"01BE(1", 'F'}, {"01BE(F", 'F'}, {"01BE(N", 'F'}, {"01BE(S", 'F'}, {"01BE(V", 'F'}, {"01BEK(", 'F'}, {"01BF()", 'F'}, {"01BF(1", 'F'}, {"01BF(F", 'F'}, {"01BF(N", 'F'}, {"01BF(S", 'F'}, {"01BF(V", 'F'}, {"01BN", 'F'}, {"01BN&(", 'F'}, {"01BN&1", 'F'}, {"01BN&F", 'F'}, {"01BN&N", 'F'}, {"01BN&S", 'F'}, {"01BN&V", 'F'}, {"01BN,(", 'F'}, {"01BN,F", 'F'}, {"01BN,V", 'F'}, {"01BN;", 'F'}, {"01BN;C", 'F'}, {"01BNB(", 'F'}, {"01BNB1", 'F'}, {"01BNBF", 'F'}, {"01BNBN", 'F'}, {"01BNBS", 'F'}, {"01BNBV", 'F'}, {"01BNC", 'F'}, {"01BNK(", 'F'}, {"01BNK1", 'F'}, {"01BNKF", 'F'}, {"01BNKN", 'F'}, {"01BNKS", 'F'}, {"01BNKV", 'F'}, {"01BNO(", 'F'}, {"01BNOF", 'F'}, {"01BNOS", 'F'}, {"01BNOV", 'F'}, {"01BNU(", 'F'}, {"01BNUE", 'F'}, {"01BS", 'F'}, {"01BS&(", 'F'}, {"01BS&1", 'F'}, {"01BS&F", 'F'}, {"01BS&N", 'F'}, {"01BS&S", 'F'}, {"01BS&V", 'F'}, {"01BS,(", 'F'}, {"01BS,F", 'F'}, {"01BS,V", 'F'}, {"01BS;", 'F'}, {"01BS;C", 'F'}, {"01BSB(", 'F'}, {"01BSB1", 'F'}, {"01BSBF", 'F'}, {"01BSBN", 'F'}, {"01BSBS", 'F'}, {"01BSBV", 'F'}, {"01BSC", 'F'}, {"01BSK(", 'F'}, {"01BSK1", 'F'}, {"01BSKF", 'F'}, {"01BSKN", 'F'}, {"01BSKS", 'F'}, {"01BSKV", 'F'}, {"01BSO(", 'F'}, {"01BSO1", 'F'}, {"01BSOF", 'F'}, {"01BSON", 'F'}, {"01BSOS", 'F'}, {"01BSOV", 'F'}, {"01BSU(", 'F'}, {"01BSUE", 'F'}, {"01BV", 'F'}, {"01BV&(", 'F'}, {"01BV&1", 'F'}, {"01BV&F", 'F'}, {"01BV&N", 'F'}, {"01BV&S", 'F'}, {"01BV&V", 'F'}, {"01BV,(", 'F'}, {"01BV,1", 'F'}, {"01BV,F", 'F'}, {"01BV,N", 'F'}, {"01BV,S", 'F'}, {"01BV,V", 'F'}, {"01BV;", 'F'}, {"01BV;C", 'F'}, {"01BVB(", 'F'}, {"01BVB1", 'F'}, {"01BVBF", 'F'}, {"01BVBN", 'F'}, {"01BVBS", 'F'}, {"01BVBV", 'F'}, {"01BVC", 'F'}, {"01BVK(", 'F'}, {"01BVK1", 'F'}, {"01BVKF", 'F'}, {"01BVKN", 'F'}, {"01BVKS", 'F'}, {"01BVKV", 'F'}, {"01BVO(", 'F'}, {"01BVOF", 'F'}, {"01BVOS", 'F'}, {"01BVU(", 'F'}, {"01BVUE", 'F'}, {"01C", 'F'}, {"01E(1)", 'F'}, {"01E(1O", 'F'}, {"01E(F(", 'F'}, {"01E(N)", 'F'}, {"01E(NO", 'F'}, {"01E(S)", 'F'}, {"01E(SO", 'F'}, {"01E(V)", 'F'}, {"01E(VO", 'F'}, {"01E1C", 'F'}, {"01E1O(", 'F'}, {"01E1OF", 'F'}, {"01E1OS", 'F'}, {"01E1OV", 'F'}, {"01E1UE", 'F'}, {"01EF()", 'F'}, {"01EF(1", 'F'}, {"01EF(F", 'F'}, {"01EF(N", 'F'}, {"01EF(S", 'F'}, {"01EF(V", 'F'}, {"01EK(1", 'F'}, {"01EK(E", 'F'}, {"01EK(F", 'F'}, {"01EK(N", 'F'}, {"01EK(S", 'F'}, {"01EK(V", 'F'}, {"01EK1C", 'F'}, {"01EK1O", 'F'}, {"01EK1U", 'F'}, {"01EKF(", 'F'}, {"01EKNC", 'F'}, {"01EKNE", 'F'}, {"01EKNU", 'F'}, {"01EKOK", 'F'}, {"01EKSC", 'F'}, {"01EKSO", 'F'}, {"01EKSU", 'F'}, {"01EKU(", 'F'}, {"01EKU1", 'F'}, {"01EKUE", 'F'}, {"01EKUF", 'F'}, {"01EKUN", 'F'}, {"01EKUS", 'F'}, {"01EKUV", 'F'}, {"01EKVC", 'F'}, {"01EKVO", 'F'}, {"01EKVU", 'F'}, {"01ENC", 'F'}, {"01ENEN", 'F'}, {"01ENO(", 'F'}, {"01ENOF", 'F'}, {"01ENOS", 'F'}, {"01ENOV", 'F'}, {"01ENUE", 'F'}, {"01EOKN", 'F'}, {"01ESC", 'F'}, {"01ESO(", 'F'}, {"01ESO1", 'F'}, {"01ESOF", 'F'}, {"01ESON", 'F'}, {"01ESOS", 'F'}, {"01ESOV", 'F'}, {"01ESUE", 'F'}, {"01EU(1", 'F'}, {"01EU(F", 'F'}, {"01EU(N", 'F'}, {"01EU(S", 'F'}, {"01EU(V", 'F'}, {"01EU1,", 'F'}, {"01EU1C", 'F'}, {"01EU1O", 'F'}, {"01EUEF", 'F'}, {"01EUEK", 'F'}, {"01EUF(", 'F'}, {"01EUN,", 'F'}, {"01EUNC", 'F'}, {"01EUNO", 'F'}, {"01EUS,", 'F'}, {"01EUSC", 'F'}, {"01EUSO", 'F'}, {"01EUV,", 'F'}, {"01EUVC", 'F'}, {"01EUVO", 'F'}, {"01EVC", 'F'}, {"01EVO(", 'F'}, {"01EVOF", 'F'}, {"01EVOS", 'F'}, {"01EVUE", 'F'}, {"01F()1", 'F'}, {"01F()F", 'F'}, {"01F()K", 'F'}, {"01F()N", 'F'}, {"01F()O", 'F'}, {"01F()S", 'F'}, {"01F()U", 'F'}, {"01F()V", 'F'}, {"01F(1)", 'F'}, {"01F(1N", 'F'}, {"01F(1O", 'F'}, {"01F(E(", 'F'}, {"01F(E1", 'F'}, {"01F(EF", 'F'}, {"01F(EK", 'F'}, {"01F(EN", 'F'}, {"01F(ES", 'F'}, {"01F(EV", 'F'}, {"01F(F(", 'F'}, {"01F(N)", 'F'}, {"01F(N,", 'F'}, {"01F(NO", 'F'}, {"01F(S)", 'F'}, {"01F(SO", 'F'}, {"01F(V)", 'F'}, {"01F(VO", 'F'}, {"01K(1O", 'F'}, {"01K(F(", 'F'}, {"01K(N)", 'F'}, {"01K(NO", 'F'}, {"01K(S)", 'F'}, {"01K(SO", 'F'}, {"01K(V)", 'F'}, {"01K(VO", 'F'}, {"01K)&(", 'F'}, {"01K)&1", 'F'}, {"01K)&F", 'F'}, {"01K)&N", 'F'}, {"01K)&S", 'F'}, {"01K)&V", 'F'}, {"01K);E", 'F'}, {"01K);T", 'F'}, {"01K)B(", 'F'}, {"01K)B1", 'F'}, {"01K)BF", 'F'}, {"01K)BN", 'F'}, {"01K)BS", 'F'}, {"01K)BV", 'F'}, {"01K)E(", 'F'}, {"01K)E1", 'F'}, {"01K)EF", 'F'}, {"01K)EK", 'F'}, {"01K)EN", 'F'}, {"01K)ES", 'F'}, {"01K)EV", 'F'}, {"01K)OF", 'F'}, {"01K)UE", 'F'}, {"01K1", 'F'}, {"01K1&(", 'F'}, {"01K1&1", 'F'}, {"01K1&F", 'F'}, {"01K1&N", 'F'}, {"01K1&S", 'F'}, {"01K1&V", 'F'}, {"01K1;", 'F'}, {"01K1;C", 'F'}, {"01K1;E", 'F'}, {"01K1;T", 'F'}, {"01K1B(", 'F'}, {"01K1B1", 'F'}, {"01K1BF", 'F'}, {"01K1BN", 'F'}, {"01K1BS", 'F'}, {"01K1BV", 'F'}, {"01K1C", 'F'}, {"01K1E(", 'F'}, {"01K1E1", 'F'}, {"01K1EF", 'F'}, {"01K1EK", 'F'}, {"01K1EN", 'F'}, {"01K1ES", 'F'}, {"01K1EV", 'F'}, {"01K1O(", 'F'}, {"01K1OF", 'F'}, {"01K1OS", 'F'}, {"01K1OV", 'F'}, {"01K1U(", 'F'}, {"01K1UE", 'F'}, {"01KF()", 'F'}, {"01KF(1", 'F'}, {"01KF(F", 'F'}, {"01KF(N", 'F'}, {"01KF(S", 'F'}, {"01KF(V", 'F'}, {"01KN", 'F'}, {"01KN&(", 'F'}, {"01KN&1", 'F'}, {"01KN&F", 'F'}, {"01KN&N", 'F'}, {"01KN&S", 'F'}, {"01KN&V", 'F'}, {"01KN;", 'F'}, {"01KN;C", 'F'}, {"01KN;E", 'F'}, {"01KN;T", 'F'}, {"01KNB(", 'F'}, {"01KNB1", 'F'}, {"01KNBF", 'F'}, {"01KNBN", 'F'}, {"01KNBS", 'F'}, {"01KNBV", 'F'}, {"01KNC", 'F'}, {"01KNE(", 'F'}, {"01KNE1", 'F'}, {"01KNEF", 'F'}, {"01KNEN", 'F'}, {"01KNES", 'F'}, {"01KNEV", 'F'}, {"01KNU(", 'F'}, {"01KNUE", 'F'}, {"01KS", 'F'}, {"01KS&(", 'F'}, {"01KS&1", 'F'}, {"01KS&F", 'F'}, {"01KS&N", 'F'}, {"01KS&S", 'F'}, {"01KS&V", 'F'}, {"01KS;", 'F'}, {"01KS;C", 'F'}, {"01KS;E", 'F'}, {"01KS;T", 'F'}, {"01KSB(", 'F'}, {"01KSB1", 'F'}, {"01KSBF", 'F'}, {"01KSBN", 'F'}, {"01KSBS", 'F'}, {"01KSBV", 'F'}, {"01KSC", 'F'}, {"01KSE(", 'F'}, {"01KSE1", 'F'}, {"01KSEF", 'F'}, {"01KSEK", 'F'}, {"01KSEN", 'F'}, {"01KSES", 'F'}, {"01KSEV", 'F'}, {"01KSO(", 'F'}, {"01KSO1", 'F'}, {"01KSOF", 'F'}, {"01KSON", 'F'}, {"01KSOS", 'F'}, {"01KSOV", 'F'}, {"01KSU(", 'F'}, {"01KSUE", 'F'}, {"01KUE(", 'F'}, {"01KUE1", 'F'}, {"01KUEF", 'F'}, {"01KUEK", 'F'}, {"01KUEN", 'F'}, {"01KUES", 'F'}, {"01KUEV", 'F'}, {"01KV", 'F'}, {"01KV&(", 'F'}, {"01KV&1", 'F'}, {"01KV&F", 'F'}, {"01KV&N", 'F'}, {"01KV&S", 'F'}, {"01KV&V", 'F'}, {"01KV;", 'F'}, {"01KV;C", 'F'}, {"01KV;E", 'F'}, {"01KV;T", 'F'}, {"01KVB(", 'F'}, {"01KVB1", 'F'}, {"01KVBF", 'F'}, {"01KVBN", 'F'}, {"01KVBS", 'F'}, {"01KVBV", 'F'}, {"01KVC", 'F'}, {"01KVE(", 'F'}, {"01KVE1", 'F'}, {"01KVEF", 'F'}, {"01KVEK", 'F'}, {"01KVEN", 'F'}, {"01KVES", 'F'}, {"01KVEV", 'F'}, {"01KVO(", 'F'}, {"01KVOF", 'F'}, {"01KVOS", 'F'}, {"01KVU(", 'F'}, {"01KVUE", 'F'}, {"01N&F(", 'F'}, {"01N(1)", 'F'}, {"01N(1O", 'F'}, {"01N(F(", 'F'}, {"01N(S)", 'F'}, {"01N(SO", 'F'}, {"01N(V)", 'F'}, {"01N(VO", 'F'}, {"01N)UE", 'F'}, {"01N,F(", 'F'}, {"01NE(1", 'F'}, {"01NE(F", 'F'}, {"01NE(N", 'F'}, {"01NE(S", 'F'}, {"01NE(V", 'F'}, {"01NE1C", 'F'}, {"01NE1O", 'F'}, {"01NEF(", 'F'}, {"01NENC", 'F'}, {"01NENO", 'F'}, {"01NESC", 'F'}, {"01NESO", 'F'}, {"01NEVC", 'F'}, {"01NEVO", 'F'}, {"01NF()", 'F'}, {"01NF(1", 'F'}, {"01NF(F", 'F'}, {"01NF(N", 'F'}, {"01NF(S", 'F'}, {"01NF(V", 'F'}, {"01NU(E", 'F'}, {"01NUE", 'F'}, {"01NUE(", 'F'}, {"01NUE1", 'F'}, {"01NUE;", 'F'}, {"01NUEC", 'F'}, {"01NUEF", 'F'}, {"01NUEK", 'F'}, {"01NUEN", 'F'}, {"01NUES", 'F'}, {"01NUEV", 'F'}, {"01O(1&", 'F'}, {"01O(1)", 'F'}, {"01O(1,", 'F'}, {"01O(1O", 'F'}, {"01O(E(", 'F'}, {"01O(E1", 'F'}, {"01O(EE", 'F'}, {"01O(EF", 'F'}, {"01O(EK", 'F'}, {"01O(EN", 'F'}, {"01O(ES", 'F'}, {"01O(ET", 'F'}, {"01O(EV", 'F'}, {"01O(F(", 'F'}, {"01O(N&", 'F'}, {"01O(N)", 'F'}, {"01O(N,", 'F'}, {"01O(NO", 'F'}, {"01O(O(", 'F'}, {"01O(O1", 'F'}, {"01O(OF", 'F'}, {"01O(ON", 'F'}, {"01O(OS", 'F'}, {"01O(OV", 'F'}, {"01O(S&", 'F'}, {"01O(S)", 'F'}, {"01O(S,", 'F'}, {"01O(SO", 'F'}, {"01O(T(", 'F'}, {"01O(V&", 'F'}, {"01O(V)", 'F'}, {"01O(V,", 'F'}, {"01O(VO", 'F'}, {"01OF()", 'F'}, {"01OF(1", 'F'}, {"01OF(E", 'F'}, {"01OF(F", 'F'}, {"01OF(N", 'F'}, {"01OF(S", 'F'}, {"01OF(T", 'F'}, {"01OF(V", 'F'}, {"01OK&(", 'F'}, {"01OK&1", 'F'}, {"01OK&F", 'F'}, {"01OK&N", 'F'}, {"01OK&S", 'F'}, {"01OK&V", 'F'}, {"01OK(1", 'F'}, {"01OK(F", 'F'}, {"01OK(N", 'F'}, {"01OK(S", 'F'}, {"01OK(V", 'F'}, {"01OK1C", 'F'}, {"01OK1O", 'F'}, {"01OKF(", 'F'}, {"01OKNC", 'F'}, {"01OKO(", 'F'}, {"01OKO1", 'F'}, {"01OKOF", 'F'}, {"01OKON", 'F'}, {"01OKOS", 'F'}, {"01OKOV", 'F'}, {"01OKSC", 'F'}, {"01OKSO", 'F'}, {"01OKVC", 'F'}, {"01OKVO", 'F'}, {"01ONSU", 'F'}, {"01OS&(", 'F'}, {"01OS&1", 'F'}, {"01OS&E", 'F'}, {"01OS&F", 'F'}, {"01OS&K", 'F'}, {"01OS&N", 'F'}, {"01OS&S", 'F'}, {"01OS&T", 'F'}, {"01OS&U", 'F'}, {"01OS&V", 'F'}, {"01OS(E", 'F'}, {"01OS(U", 'F'}, {"01OS)&", 'F'}, {"01OS),", 'F'}, {"01OS);", 'F'}, {"01OS)B", 'F'}, {"01OS)C", 'F'}, {"01OS)E", 'F'}, {"01OS)K", 'F'}, {"01OS)O", 'F'}, {"01OS)U", 'F'}, {"01OS,(", 'F'}, {"01OS,F", 'F'}, {"01OS,V", 'F'}, {"01OS1(", 'F'}, {"01OS1F", 'F'}, {"01OS1N", 'F'}, {"01OS1S", 'F'}, {"01OS1U", 'F'}, {"01OS1V", 'F'}, {"01OS;", 'F'}, {"01OS;C", 'F'}, {"01OS;E", 'F'}, {"01OS;N", 'F'}, {"01OS;T", 'F'}, {"01OSA(", 'F'}, {"01OSAF", 'F'}, {"01OSAS", 'F'}, {"01OSAT", 'F'}, {"01OSAV", 'F'}, {"01OSB(", 'F'}, {"01OSB1", 'F'}, {"01OSBE", 'F'}, {"01OSBF", 'F'}, {"01OSBN", 'F'}, {"01OSBS", 'F'}, {"01OSBV", 'F'}, {"01OSC", 'F'}, {"01OSE(", 'F'}, {"01OSE1", 'F'}, {"01OSEF", 'F'}, {"01OSEK", 'F'}, {"01OSEN", 'F'}, {"01OSEO", 'F'}, {"01OSES", 'F'}, {"01OSEU", 'F'}, {"01OSEV", 'F'}, {"01OSF(", 'F'}, {"01OSK(", 'F'}, {"01OSK)", 'F'}, {"01OSK1", 'F'}, {"01OSKB", 'F'}, {"01OSKF", 'F'}, {"01OSKN", 'F'}, {"01OSKS", 'F'}, {"01OSKU", 'F'}, {"01OSKV", 'F'}, {"01OSO(", 'F'}, {"01OSO1", 'F'}, {"01OSOF", 'F'}, {"01OSOK", 'F'}, {"01OSON", 'F'}, {"01OSOS", 'F'}, {"01OSOT", 'F'}, {"01OSOU", 'F'}, {"01OSOV", 'F'}, {"01OSU", 'F'}, {"01OSU(", 'F'}, {"01OSU1", 'F'}, {"01OSU;", 'F'}, {"01OSUC", 'F'}, {"01OSUE", 'F'}, {"01OSUF", 'F'}, {"01OSUK", 'F'}, {"01OSUN", 'F'}, {"01OSUO", 'F'}, {"01OSUS", 'F'}, {"01OSUT", 'F'}, {"01OSUV", 'F'}, {"01OSV(", 'F'}, {"01OSVF", 'F'}, {"01OSVO", 'F'}, {"01OSVS", 'F'}, {"01OSVU", 'F'}, {"01OT(1", 'F'}, {"01OT(E", 'F'}, {"01OT(F", 'F'}, {"01OT(N", 'F'}, {"01OT(S", 'F'}, {"01OT(T", 'F'}, {"01OT(V", 'F'}, {"01OU(E", 'F'}, {"01OUEK", 'F'}, {"01OUEN", 'F'}, {"01OV", 'F'}, {"01OV&(", 'F'}, {"01OV&1", 'F'}, {"01OV&E", 'F'}, {"01OV&F", 'F'}, {"01OV&K", 'F'}, {"01OV&N", 'F'}, {"01OV&S", 'F'}, {"01OV&T", 'F'}, {"01OV&U", 'F'}, {"01OV&V", 'F'}, {"01OV(E", 'F'}, {"01OV(U", 'F'}, {"01OV)&", 'F'}, {"01OV),", 'F'}, {"01OV);", 'F'}, {"01OV)B", 'F'}, {"01OV)C", 'F'}, {"01OV)E", 'F'}, {"01OV)K", 'F'}, {"01OV)O", 'F'}, {"01OV)U", 'F'}, {"01OV,(", 'F'}, {"01OV,1", 'F'}, {"01OV,F", 'F'}, {"01OV,N", 'F'}, {"01OV,S", 'F'}, {"01OV,V", 'F'}, {"01OV;", 'F'}, {"01OV;C", 'F'}, {"01OV;E", 'F'}, {"01OV;N", 'F'}, {"01OV;T", 'F'}, {"01OVA(", 'F'}, {"01OVAF", 'F'}, {"01OVAS", 'F'}, {"01OVAT", 'F'}, {"01OVAV", 'F'}, {"01OVB(", 'F'}, {"01OVB1", 'F'}, {"01OVBE", 'F'}, {"01OVBF", 'F'}, {"01OVBN", 'F'}, {"01OVBS", 'F'}, {"01OVBV", 'F'}, {"01OVC", 'F'}, {"01OVE(", 'F'}, {"01OVE1", 'F'}, {"01OVEF", 'F'}, {"01OVEK", 'F'}, {"01OVEN", 'F'}, {"01OVEO", 'F'}, {"01OVES", 'F'}, {"01OVEU", 'F'}, {"01OVEV", 'F'}, {"01OVF(", 'F'}, {"01OVK(", 'F'}, {"01OVK)", 'F'}, {"01OVK1", 'F'}, {"01OVKB", 'F'}, {"01OVKF", 'F'}, {"01OVKN", 'F'}, {"01OVKS", 'F'}, {"01OVKU", 'F'}, {"01OVKV", 'F'}, {"01OVO(", 'F'}, {"01OVOF", 'F'}, {"01OVOK", 'F'}, {"01OVOS", 'F'}, {"01OVOT", 'F'}, {"01OVOU", 'F'}, {"01OVS(", 'F'}, {"01OVS1", 'F'}, {"01OVSF", 'F'}, {"01OVSO", 'F'}, {"01OVSU", 'F'}, {"01OVSV", 'F'}, {"01OVU", 'F'}, {"01OVU(", 'F'}, {"01OVU1", 'F'}, {"01OVU;", 'F'}, {"01OVUC", 'F'}, {"01OVUE", 'F'}, {"01OVUF", 'F'}, {"01OVUK", 'F'}, {"01OVUN", 'F'}, {"01OVUO", 'F'}, {"01OVUS", 'F'}, {"01OVUT", 'F'}, {"01OVUV", 'F'}, {"01SF()", 'F'}, {"01SF(1", 'F'}, {"01SF(F", 'F'}, {"01SF(N", 'F'}, {"01SF(S", 'F'}, {"01SF(V", 'F'}, {"01SUE", 'F'}, {"01SUE;", 'F'}, {"01SUEC", 'F'}, {"01SUEK", 'F'}, {"01SV", 'F'}, {"01SV;", 'F'}, {"01SV;C", 'F'}, {"01SVC", 'F'}, {"01SVO(", 'F'}, {"01SVOF", 'F'}, {"01SVOS", 'F'}, {"01U", 'F'}, {"01U(1)", 'F'}, {"01U(1O", 'F'}, {"01U(E(", 'F'}, {"01U(E1", 'F'}, {"01U(EF", 'F'}, {"01U(EK", 'F'}, {"01U(EN", 'F'}, {"01U(ES", 'F'}, {"01U(EV", 'F'}, {"01U(F(", 'F'}, {"01U(N)", 'F'}, {"01U(NO", 'F'}, {"01U(S)", 'F'}, {"01U(SO", 'F'}, {"01U(V)", 'F'}, {"01U(VO", 'F'}, {"01U1,(", 'F'}, {"01U1,F", 'F'}, {"01U1,V", 'F'}, {"01U1C", 'F'}, {"01U1O(", 'F'}, {"01U1OF", 'F'}, {"01U1OS", 'F'}, {"01U1OV", 'F'}, {"01U;", 'F'}, {"01U;C", 'F'}, {"01UC", 'F'}, {"01UE", 'F'}, {"01UE(1", 'F'}, {"01UE(E", 'F'}, {"01UE(F", 'F'}, {"01UE(N", 'F'}, {"01UE(O", 'F'}, {"01UE(S", 'F'}, {"01UE(V", 'F'}, {"01UE1", 'F'}, {"01UE1&", 'F'}, {"01UE1(", 'F'}, {"01UE1)", 'F'}, {"01UE1,", 'F'}, {"01UE1;", 'F'}, {"01UE1B", 'F'}, {"01UE1C", 'F'}, {"01UE1F", 'F'}, {"01UE1K", 'F'}, {"01UE1N", 'F'}, {"01UE1O", 'F'}, {"01UE1S", 'F'}, {"01UE1U", 'F'}, {"01UE1V", 'F'}, {"01UE;", 'F'}, {"01UE;C", 'F'}, {"01UEC", 'F'}, {"01UEF", 'F'}, {"01UEF(", 'F'}, {"01UEF,", 'F'}, {"01UEF;", 'F'}, {"01UEFC", 'F'}, {"01UEK", 'F'}, {"01UEK(", 'F'}, {"01UEK1", 'F'}, {"01UEK;", 'F'}, {"01UEKC", 'F'}, {"01UEKF", 'F'}, {"01UEKN", 'F'}, {"01UEKO", 'F'}, {"01UEKS", 'F'}, {"01UEKV", 'F'}, {"01UEN", 'F'}, {"01UEN&", 'F'}, {"01UEN(", 'F'}, {"01UEN)", 'F'}, {"01UEN,", 'F'}, {"01UEN1", 'F'}, {"01UEN;", 'F'}, {"01UENB", 'F'}, {"01UENC", 'F'}, {"01UENF", 'F'}, {"01UENK", 'F'}, {"01UENN", 'F'}, {"01UENO", 'F'}, {"01UENS", 'F'}, {"01UENU", 'F'}, {"01UEOK", 'F'}, {"01UEON", 'F'}, {"01UEOO", 'F'}, {"01UES", 'F'}, {"01UES&", 'F'}, {"01UES(", 'F'}, {"01UES)", 'F'}, {"01UES,", 'F'}, {"01UES1", 'F'}, {"01UES;", 'F'}, {"01UESB", 'F'}, {"01UESC", 'F'}, {"01UESF", 'F'}, {"01UESK", 'F'}, {"01UESO", 'F'}, {"01UESU", 'F'}, {"01UESV", 'F'}, {"01UEV", 'F'}, {"01UEV&", 'F'}, {"01UEV(", 'F'}, {"01UEV)", 'F'}, {"01UEV,", 'F'}, {"01UEV;", 'F'}, {"01UEVB", 'F'}, {"01UEVC", 'F'}, {"01UEVF", 'F'}, {"01UEVK", 'F'}, {"01UEVN", 'F'}, {"01UEVO", 'F'}, {"01UEVS", 'F'}, {"01UEVU", 'F'}, {"01UF()", 'F'}, {"01UF(1", 'F'}, {"01UF(F", 'F'}, {"01UF(N", 'F'}, {"01UF(S", 'F'}, {"01UF(V", 'F'}, {"01UK(E", 'F'}, {"01UN(1", 'F'}, {"01UN(F", 'F'}, {"01UN(S", 'F'}, {"01UN(V", 'F'}, {"01UN,(", 'F'}, {"01UN,F", 'F'}, {"01UN,V", 'F'}, {"01UN1(", 'F'}, {"01UN1,", 'F'}, {"01UN1O", 'F'}, {"01UNC", 'F'}, {"01UNE(", 'F'}, {"01UNE1", 'F'}, {"01UNEF", 'F'}, {"01UNEN", 'F'}, {"01UNES", 'F'}, {"01UNEV", 'F'}, {"01UNF(", 'F'}, {"01UNO(", 'F'}, {"01UNOF", 'F'}, {"01UNOS", 'F'}, {"01UNOV", 'F'}, {"01UNS(", 'F'}, {"01UNS,", 'F'}, {"01UNSO", 'F'}, {"01UO(E", 'F'}, {"01UON(", 'F'}, {"01UON1", 'F'}, {"01UONF", 'F'}, {"01UONS", 'F'}, {"01US,(", 'F'}, {"01US,F", 'F'}, {"01US,V", 'F'}, {"01USC", 'F'}, {"01USO(", 'F'}, {"01USO1", 'F'}, {"01USOF", 'F'}, {"01USON", 'F'}, {"01USOS", 'F'}, {"01USOV", 'F'}, {"01UTN(", 'F'}, {"01UTN1", 'F'}, {"01UTNF", 'F'}, {"01UTNS", 'F'}, {"01UV,(", 'F'}, {"01UV,1", 'F'}, {"01UV,F", 'F'}, {"01UV,N", 'F'}, {"01UV,S", 'F'}, {"01UV,V", 'F'}, {"01UVC", 'F'}, {"01UVO(", 'F'}, {"01UVOF", 'F'}, {"01UVOS", 'F'}, {"01VF()", 'F'}, {"01VF(1", 'F'}, {"01VF(F", 'F'}, {"01VF(N", 'F'}, {"01VF(S", 'F'}, {"01VF(V", 'F'}, {"01VO(1", 'F'}, {"01VO(F", 'F'}, {"01VO(N", 'F'}, {"01VO(S", 'F'}, {"01VO(V", 'F'}, {"01VOF(", 'F'}, {"01VOS(", 'F'}, {"01VOS1", 'F'}, {"01VOSF", 'F'}, {"01VOSO", 'F'}, {"01VOSU", 'F'}, {"01VOSV", 'F'}, {"01VS", 'F'}, {"01VS;", 'F'}, {"01VS;C", 'F'}, {"01VSC", 'F'}, {"01VSO(", 'F'}, {"01VSO1", 'F'}, {"01VSOF", 'F'}, {"01VSON", 'F'}, {"01VSOS", 'F'}, {"01VSOV", 'F'}, {"01VUE", 'F'}, {"01VUE;", 'F'}, {"01VUEC", 'F'}, {"01VUEK", 'F'}, {"0;TKNC", 'F'}, {"0E(1&(", 'F'}, {"0E(1&1", 'F'}, {"0E(1&F", 'F'}, {"0E(1&N", 'F'}, {"0E(1&S", 'F'}, {"0E(1&V", 'F'}, {"0E(1)&", 'F'}, {"0E(1),", 'F'}, {"0E(1)1", 'F'}, {"0E(1);", 'F'}, {"0E(1)B", 'F'}, {"0E(1)C", 'F'}, {"0E(1)F", 'F'}, {"0E(1)K", 'F'}, {"0E(1)N", 'F'}, {"0E(1)O", 'F'}, {"0E(1)S", 'F'}, {"0E(1)U", 'F'}, {"0E(1)V", 'F'}, {"0E(1,F", 'F'}, {"0E(1F(", 'F'}, {"0E(1N)", 'F'}, {"0E(1O(", 'F'}, {"0E(1OF", 'F'}, {"0E(1OS", 'F'}, {"0E(1OV", 'F'}, {"0E(1S)", 'F'}, {"0E(1V)", 'F'}, {"0E(1VO", 'F'}, {"0E(E(1", 'F'}, {"0E(E(E", 'F'}, {"0E(E(F", 'F'}, {"0E(E(N", 'F'}, {"0E(E(S", 'F'}, {"0E(E(V", 'F'}, {"0E(E1&", 'F'}, {"0E(E1)", 'F'}, {"0E(E1O", 'F'}, {"0E(EF(", 'F'}, {"0E(EK(", 'F'}, {"0E(EK1", 'F'}, {"0E(EKF", 'F'}, {"0E(EKN", 'F'}, {"0E(EKS", 'F'}, {"0E(EKT", 'F'}, {"0E(EKV", 'F'}, {"0E(EN&", 'F'}, {"0E(EN)", 'F'}, {"0E(ENO", 'F'}, {"0E(ES&", 'F'}, {"0E(ES)", 'F'}, {"0E(ESO", 'F'}, {"0E(ET(", 'F'}, {"0E(EV&", 'F'}, {"0E(EV)", 'F'}, {"0E(EVO", 'F'}, {"0E(F()", 'F'}, {"0E(F(1", 'F'}, {"0E(F(E", 'F'}, {"0E(F(F", 'F'}, {"0E(F(N", 'F'}, {"0E(F(S", 'F'}, {"0E(F(T", 'F'}, {"0E(F(V", 'F'}, {"0E(N&(", 'F'}, {"0E(N&1", 'F'}, {"0E(N&F", 'F'}, {"0E(N&N", 'F'}, {"0E(N&S", 'F'}, {"0E(N&V", 'F'}, {"0E(N(1", 'F'}, {"0E(N(F", 'F'}, {"0E(N(S", 'F'}, {"0E(N(V", 'F'}, {"0E(N)&", 'F'}, {"0E(N),", 'F'}, {"0E(N)1", 'F'}, {"0E(N);", 'F'}, {"0E(N)B", 'F'}, {"0E(N)C", 'F'}, {"0E(N)F", 'F'}, {"0E(N)K", 'F'}, {"0E(N)N", 'F'}, {"0E(N)O", 'F'}, {"0E(N)S", 'F'}, {"0E(N)U", 'F'}, {"0E(N)V", 'F'}, {"0E(N,F", 'F'}, {"0E(N1)", 'F'}, {"0E(N1O", 'F'}, {"0E(NF(", 'F'}, {"0E(NO(", 'F'}, {"0E(NOF", 'F'}, {"0E(NOS", 'F'}, {"0E(NOV", 'F'}, {"0E(S&(", 'F'}, {"0E(S&1", 'F'}, {"0E(S&F", 'F'}, {"0E(S&N", 'F'}, {"0E(S&S", 'F'}, {"0E(S&V", 'F'}, {"0E(S)&", 'F'}, {"0E(S),", 'F'}, {"0E(S)1", 'F'}, {"0E(S);", 'F'}, {"0E(S)B", 'F'}, {"0E(S)C", 'F'}, {"0E(S)F", 'F'}, {"0E(S)K", 'F'}, {"0E(S)N", 'F'}, {"0E(S)O", 'F'}, {"0E(S)S", 'F'}, {"0E(S)U", 'F'}, {"0E(S)V", 'F'}, {"0E(S,F", 'F'}, {"0E(S1)", 'F'}, {"0E(S1O", 'F'}, {"0E(SF(", 'F'}, {"0E(SO(", 'F'}, {"0E(SO1", 'F'}, {"0E(SOF", 'F'}, {"0E(SON", 'F'}, {"0E(SOS", 'F'}, {"0E(SOV", 'F'}, {"0E(SV)", 'F'}, {"0E(SVO", 'F'}, {"0E(T(1", 'F'}, {"0E(T(E", 'F'}, {"0E(T(F", 'F'}, {"0E(T(N", 'F'}, {"0E(T(S", 'F'}, {"0E(T(V", 'F'}, {"0E(V&(", 'F'}, {"0E(V&1", 'F'}, {"0E(V&F", 'F'}, {"0E(V&N", 'F'}, {"0E(V&S", 'F'}, {"0E(V&V", 'F'}, {"0E(V)&", 'F'}, {"0E(V),", 'F'}, {"0E(V)1", 'F'}, {"0E(V);", 'F'}, {"0E(V)B", 'F'}, {"0E(V)C", 'F'}, {"0E(V)F", 'F'}, {"0E(V)K", 'F'}, {"0E(V)N", 'F'}, {"0E(V)O", 'F'}, {"0E(V)S", 'F'}, {"0E(V)U", 'F'}, {"0E(V)V", 'F'}, {"0E(V,F", 'F'}, {"0E(VF(", 'F'}, {"0E(VO(", 'F'}, {"0E(VOF", 'F'}, {"0E(VOS", 'F'}, {"0E(VS)", 'F'}, {"0E(VSO", 'F'}, {"0E1&(1", 'F'}, {"0E1&(E", 'F'}, {"0E1&(F", 'F'}, {"0E1&(N", 'F'}, {"0E1&(S", 'F'}, {"0E1&(V", 'F'}, {"0E1&1)", 'F'}, {"0E1&1O", 'F'}, {"0E1&F(", 'F'}, {"0E1&N)", 'F'}, {"0E1&NO", 'F'}, {"0E1&S)", 'F'}, {"0E1&SO", 'F'}, {"0E1&V)", 'F'}, {"0E1&VO", 'F'}, {"0E1)", 'F'}, {"0E1)&(", 'F'}, {"0E1)&1", 'F'}, {"0E1)&F", 'F'}, {"0E1)&N", 'F'}, {"0E1)&S", 'F'}, {"0E1)&V", 'F'}, {"0E1);", 'F'}, {"0E1);(", 'F'}, {"0E1);C", 'F'}, {"0E1);E", 'F'}, {"0E1);T", 'F'}, {"0E1)C", 'F'}, {"0E1)KN", 'F'}, {"0E1)O(", 'F'}, {"0E1)O1", 'F'}, {"0E1)OF", 'F'}, {"0E1)ON", 'F'}, {"0E1)OS", 'F'}, {"0E1)OV", 'F'}, {"0E1)UE", 'F'}, {"0E1,(1", 'F'}, {"0E1,(F", 'F'}, {"0E1,(N", 'F'}, {"0E1,(S", 'F'}, {"0E1,(V", 'F'}, {"0E1,F(", 'F'}, {"0E1,V,", 'F'}, {"0E1,VK", 'F'}, {"0E1,VO", 'F'}, {"0E1;(E", 'F'}, {"0E1B(1", 'F'}, {"0E1B(F", 'F'}, {"0E1B(N", 'F'}, {"0E1B(S", 'F'}, {"0E1B(V", 'F'}, {"0E1B1)", 'F'}, {"0E1B1O", 'F'}, {"0E1BF(", 'F'}, {"0E1BN)", 'F'}, {"0E1BNO", 'F'}, {"0E1BS)", 'F'}, {"0E1BSO", 'F'}, {"0E1BV)", 'F'}, {"0E1BVO", 'F'}, {"0E1F()", 'F'}, {"0E1F(1", 'F'}, {"0E1F(F", 'F'}, {"0E1F(N", 'F'}, {"0E1F(S", 'F'}, {"0E1F(V", 'F'}, {"0E1K(1", 'F'}, {"0E1K(E", 'F'}, {"0E1K(F", 'F'}, {"0E1K(N", 'F'}, {"0E1K(S", 'F'}, {"0E1K(V", 'F'}, {"0E1K1)", 'F'}, {"0E1K1K", 'F'}, {"0E1K1O", 'F'}, {"0E1KF(", 'F'}, {"0E1KN", 'F'}, {"0E1KN)", 'F'}, {"0E1KN;", 'F'}, {"0E1KNC", 'F'}, {"0E1KNK", 'F'}, {"0E1KNU", 'F'}, {"0E1KS)", 'F'}, {"0E1KSK", 'F'}, {"0E1KSO", 'F'}, {"0E1KV)", 'F'}, {"0E1KVK", 'F'}, {"0E1KVO", 'F'}, {"0E1N)U", 'F'}, {"0E1N;", 'F'}, {"0E1N;C", 'F'}, {"0E1NC", 'F'}, {"0E1NKN", 'F'}, {"0E1O(1", 'F'}, {"0E1O(E", 'F'}, {"0E1O(F", 'F'}, {"0E1O(N", 'F'}, {"0E1O(S", 'F'}, {"0E1O(T", 'F'}, {"0E1O(V", 'F'}, {"0E1OF(", 'F'}, {"0E1OS&", 'F'}, {"0E1OS(", 'F'}, {"0E1OS)", 'F'}, {"0E1OS,", 'F'}, {"0E1OS1", 'F'}, {"0E1OS;", 'F'}, {"0E1OSB", 'F'}, {"0E1OSF", 'F'}, {"0E1OSK", 'F'}, {"0E1OSO", 'F'}, {"0E1OSU", 'F'}, {"0E1OSV", 'F'}, {"0E1OV&", 'F'}, {"0E1OV(", 'F'}, {"0E1OV)", 'F'}, {"0E1OV,", 'F'}, {"0E1OV;", 'F'}, {"0E1OVB", 'F'}, {"0E1OVF", 'F'}, {"0E1OVK", 'F'}, {"0E1OVO", 'F'}, {"0E1OVS", 'F'}, {"0E1OVU", 'F'}, {"0E1S;", 'F'}, {"0E1S;C", 'F'}, {"0E1SC", 'F'}, {"0E1U(E", 'F'}, {"0E1UE(", 'F'}, {"0E1UE1", 'F'}, {"0E1UEF", 'F'}, {"0E1UEK", 'F'}, {"0E1UEN", 'F'}, {"0E1UES", 'F'}, {"0E1UEV", 'F'}, {"0E1V", 'F'}, {"0E1V;", 'F'}, {"0E1V;C", 'F'}, {"0E1VC", 'F'}, {"0E1VO(", 'F'}, {"0E1VOF", 'F'}, {"0E1VOS", 'F'}, {"0ECHO", 'F'}, {"0ECHO;", 'F'}, {"0ECHOC", 'F'}, {"0EE(F(", 'F'}, {"0EEK(F", 'F'}, {"0EF()&", 'F'}, {"0EF(),", 'F'}, {"0EF()1", 'F'}, {"0EF();", 'F'}, {"0EF()B", 'F'}, {"0EF()F", 'F'}, {"0EF()K", 'F'}, {"0EF()N", 'F'}, {"0EF()O", 'F'}, {"0EF()S", 'F'}, {"0EF()U", 'F'}, {"0EF()V", 'F'}, {"0EF(1&", 'F'}, {"0EF(1)", 'F'}, {"0EF(1,", 'F'}, {"0EF(1O", 'F'}, {"0EF(E(", 'F'}, {"0EF(E1", 'F'}, {"0EF(EF", 'F'}, {"0EF(EK", 'F'}, {"0EF(EN", 'F'}, {"0EF(ES", 'F'}, {"0EF(EV", 'F'}, {"0EF(F(", 'F'}, {"0EF(N&", 'F'}, {"0EF(N)", 'F'}, {"0EF(N,", 'F'}, {"0EF(NO", 'F'}, {"0EF(O)", 'F'}, {"0EF(S&", 'F'}, {"0EF(S)", 'F'}, {"0EF(S,", 'F'}, {"0EF(SO", 'F'}, {"0EF(T(", 'F'}, {"0EF(V&", 'F'}, {"0EF(V)", 'F'}, {"0EF(V,", 'F'}, {"0EF(VO", 'F'}, {"0EK(1&", 'F'}, {"0EK(1(", 'F'}, {"0EK(1)", 'F'}, {"0EK(1,", 'F'}, {"0EK(1F", 'F'}, {"0EK(1N", 'F'}, {"0EK(1O", 'F'}, {"0EK(1S", 'F'}, {"0EK(1V", 'F'}, {"0EK(E(", 'F'}, {"0EK(E1", 'F'}, {"0EK(EF", 'F'}, {"0EK(EK", 'F'}, {"0EK(EN", 'F'}, {"0EK(ES", 'F'}, {"0EK(ET", 'F'}, {"0EK(EV", 'F'}, {"0EK(F(", 'F'}, {"0EK(N&", 'F'}, {"0EK(N(", 'F'}, {"0EK(N)", 'F'}, {"0EK(N,", 'F'}, {"0EK(N1", 'F'}, {"0EK(NF", 'F'}, {"0EK(NO", 'F'}, {"0EK(S&", 'F'}, {"0EK(S(", 'F'}, {"0EK(S)", 'F'}, {"0EK(S,", 'F'}, {"0EK(S1", 'F'}, {"0EK(SF", 'F'}, {"0EK(SO", 'F'}, {"0EK(SV", 'F'}, {"0EK(T(", 'F'}, {"0EK(V&", 'F'}, {"0EK(V(", 'F'}, {"0EK(V)", 'F'}, {"0EK(V,", 'F'}, {"0EK(VF", 'F'}, {"0EK(VO", 'F'}, {"0EK(VS", 'F'}, {"0EK1&(", 'F'}, {"0EK1&1", 'F'}, {"0EK1&F", 'F'}, {"0EK1&N", 'F'}, {"0EK1&S", 'F'}, {"0EK1&V", 'F'}, {"0EK1)", 'F'}, {"0EK1)&", 'F'}, {"0EK1);", 'F'}, {"0EK1)C", 'F'}, {"0EK1)K", 'F'}, {"0EK1)O", 'F'}, {"0EK1)U", 'F'}, {"0EK1,(", 'F'}, {"0EK1,F", 'F'}, {"0EK1,V", 'F'}, {"0EK1;(", 'F'}, {"0EK1B(", 'F'}, {"0EK1B1", 'F'}, {"0EK1BF", 'F'}, {"0EK1BN", 'F'}, {"0EK1BS", 'F'}, {"0EK1BV", 'F'}, {"0EK1F(", 'F'}, {"0EK1K(", 'F'}, {"0EK1K1", 'F'}, {"0EK1KF", 'F'}, {"0EK1KN", 'F'}, {"0EK1KS", 'F'}, {"0EK1KV", 'F'}, {"0EK1N", 'F'}, {"0EK1N)", 'F'}, {"0EK1N;", 'F'}, {"0EK1NC", 'F'}, {"0EK1NF", 'F'}, {"0EK1NK", 'F'}, {"0EK1O(", 'F'}, {"0EK1OF", 'F'}, {"0EK1OS", 'F'}, {"0EK1OV", 'F'}, {"0EK1S", 'F'}, {"0EK1S;", 'F'}, {"0EK1SC", 'F'}, {"0EK1SF", 'F'}, {"0EK1SK", 'F'}, {"0EK1U(", 'F'}, {"0EK1UE", 'F'}, {"0EK1V", 'F'}, {"0EK1V;", 'F'}, {"0EK1VC", 'F'}, {"0EK1VF", 'F'}, {"0EK1VK", 'F'}, {"0EK1VO", 'F'}, {"0EKE(F", 'F'}, {"0EKEK(", 'F'}, {"0EKF()", 'F'}, {"0EKF(1", 'F'}, {"0EKF(E", 'F'}, {"0EKF(F", 'F'}, {"0EKF(N", 'F'}, {"0EKF(O", 'F'}, {"0EKF(S", 'F'}, {"0EKF(T", 'F'}, {"0EKF(V", 'F'}, {"0EKN&(", 'F'}, {"0EKN&1", 'F'}, {"0EKN&F", 'F'}, {"0EKN&N", 'F'}, {"0EKN&S", 'F'}, {"0EKN&V", 'F'}, {"0EKN(1", 'F'}, {"0EKN(F", 'F'}, {"0EKN(S", 'F'}, {"0EKN(V", 'F'}, {"0EKN)", 'F'}, {"0EKN)&", 'F'}, {"0EKN);", 'F'}, {"0EKN)C", 'F'}, {"0EKN)K", 'F'}, {"0EKN)O", 'F'}, {"0EKN)U", 'F'}, {"0EKN,(", 'F'}, {"0EKN,F", 'F'}, {"0EKN,V", 'F'}, {"0EKN1", 'F'}, {"0EKN1;", 'F'}, {"0EKN1C", 'F'}, {"0EKN1F", 'F'}, {"0EKN1K", 'F'}, {"0EKN1O", 'F'}, {"0EKN;(", 'F'}, {"0EKNB(", 'F'}, {"0EKNB1", 'F'}, {"0EKNBF", 'F'}, {"0EKNBN", 'F'}, {"0EKNBS", 'F'}, {"0EKNBV", 'F'}, {"0EKNF(", 'F'}, {"0EKNK(", 'F'}, {"0EKNK1", 'F'}, {"0EKNKF", 'F'}, {"0EKNKN", 'F'}, {"0EKNKS", 'F'}, {"0EKNKV", 'F'}, {"0EKNU(", 'F'}, {"0EKNUE", 'F'}, {"0EKO(1", 'F'}, {"0EKO(F", 'F'}, {"0EKO(N", 'F'}, {"0EKO(S", 'F'}, {"0EKO(V", 'F'}, {"0EKOK(", 'F'}, {"0EKOKN", 'F'}, {"0EKS&(", 'F'}, {"0EKS&1", 'F'}, {"0EKS&F", 'F'}, {"0EKS&N", 'F'}, {"0EKS&S", 'F'}, {"0EKS&V", 'F'}, {"0EKS)", 'F'}, {"0EKS)&", 'F'}, {"0EKS);", 'F'}, {"0EKS)C", 'F'}, {"0EKS)K", 'F'}, {"0EKS)O", 'F'}, {"0EKS)U", 'F'}, {"0EKS,(", 'F'}, {"0EKS,F", 'F'}, {"0EKS,V", 'F'}, {"0EKS1", 'F'}, {"0EKS1;", 'F'}, {"0EKS1C", 'F'}, {"0EKS1F", 'F'}, {"0EKS1K", 'F'}, {"0EKS1O", 'F'}, {"0EKS;(", 'F'}, {"0EKSB(", 'F'}, {"0EKSB1", 'F'}, {"0EKSBF", 'F'}, {"0EKSBN", 'F'}, {"0EKSBS", 'F'}, {"0EKSBV", 'F'}, {"0EKSF(", 'F'}, {"0EKSK(", 'F'}, {"0EKSK1", 'F'}, {"0EKSKF", 'F'}, {"0EKSKN", 'F'}, {"0EKSKS", 'F'}, {"0EKSKV", 'F'}, {"0EKSO(", 'F'}, {"0EKSO1", 'F'}, {"0EKSOF", 'F'}, {"0EKSON", 'F'}, {"0EKSOS", 'F'}, {"0EKSOV", 'F'}, {"0EKSU(", 'F'}, {"0EKSUE", 'F'}, {"0EKSV", 'F'}, {"0EKSV;", 'F'}, {"0EKSVC", 'F'}, {"0EKSVF", 'F'}, {"0EKSVK", 'F'}, {"0EKSVO", 'F'}, {"0EKT(1", 'F'}, {"0EKT(E", 'F'}, {"0EKT(F", 'F'}, {"0EKT(N", 'F'}, {"0EKT(S", 'F'}, {"0EKT(T", 'F'}, {"0EKT(V", 'F'}, {"0EKV&(", 'F'}, {"0EKV&1", 'F'}, {"0EKV&F", 'F'}, {"0EKV&N", 'F'}, {"0EKV&S", 'F'}, {"0EKV&V", 'F'}, {"0EKV)", 'F'}, {"0EKV)&", 'F'}, {"0EKV);", 'F'}, {"0EKV)C", 'F'}, {"0EKV)K", 'F'}, {"0EKV)O", 'F'}, {"0EKV)U", 'F'}, {"0EKV,(", 'F'}, {"0EKV,1", 'F'}, {"0EKV,F", 'F'}, {"0EKV,N", 'F'}, {"0EKV,S", 'F'}, {"0EKV,V", 'F'}, {"0EKV;(", 'F'}, {"0EKVB(", 'F'}, {"0EKVB1", 'F'}, {"0EKVBF", 'F'}, {"0EKVBN", 'F'}, {"0EKVBS", 'F'}, {"0EKVBV", 'F'}, {"0EKVF(", 'F'}, {"0EKVK(", 'F'}, {"0EKVK1", 'F'}, {"0EKVKF", 'F'}, {"0EKVKN", 'F'}, {"0EKVKS", 'F'}, {"0EKVKV", 'F'}, {"0EKVO(", 'F'}, {"0EKVOF", 'F'}, {"0EKVOS", 'F'}, {"0EKVS", 'F'}, {"0EKVS;", 'F'}, {"0EKVSC", 'F'}, {"0EKVSF", 'F'}, {"0EKVSK", 'F'}, {"0EKVSO", 'F'}, {"0EKVU(", 'F'}, {"0EKVUE", 'F'}, {"0EN&(1", 'F'}, {"0EN&(E", 'F'}, {"0EN&(F", 'F'}, {"0EN&(N", 'F'}, {"0EN&(S", 'F'}, {"0EN&(V", 'F'}, {"0EN&1)", 'F'}, {"0EN&1O", 'F'}, {"0EN&F(", 'F'}, {"0EN&N)", 'F'}, {"0EN&NO", 'F'}, {"0EN&S)", 'F'}, {"0EN&SO", 'F'}, {"0EN&V)", 'F'}, {"0EN&VO", 'F'}, {"0EN(1O", 'F'}, {"0EN(F(", 'F'}, {"0EN(S)", 'F'}, {"0EN(SO", 'F'}, {"0EN(V)", 'F'}, {"0EN(VO", 'F'}, {"0EN)", 'F'}, {"0EN)&(", 'F'}, {"0EN)&1", 'F'}, {"0EN)&F", 'F'}, {"0EN)&N", 'F'}, {"0EN)&S", 'F'}, {"0EN)&V", 'F'}, {"0EN);", 'F'}, {"0EN);(", 'F'}, {"0EN);C", 'F'}, {"0EN);E", 'F'}, {"0EN);T", 'F'}, {"0EN)C", 'F'}, {"0EN)KN", 'F'}, {"0EN)O(", 'F'}, {"0EN)O1", 'F'}, {"0EN)OF", 'F'}, {"0EN)ON", 'F'}, {"0EN)OS", 'F'}, {"0EN)OV", 'F'}, {"0EN)UE", 'F'}, {"0EN,(1", 'F'}, {"0EN,(F", 'F'}, {"0EN,(N", 'F'}, {"0EN,(S", 'F'}, {"0EN,(V", 'F'}, {"0EN,F(", 'F'}, {"0EN,V,", 'F'}, {"0EN,VK", 'F'}, {"0EN,VO", 'F'}, {"0EN1;", 'F'}, {"0EN1;C", 'F'}, {"0EN1C", 'F'}, {"0EN1O(", 'F'}, {"0EN1OF", 'F'}, {"0EN1OS", 'F'}, {"0EN1OV", 'F'}, {"0EN;(E", 'F'}, {"0ENB(1", 'F'}, {"0ENB(F", 'F'}, {"0ENB(N", 'F'}, {"0ENB(S", 'F'}, {"0ENB(V", 'F'}, {"0ENB1)", 'F'}, {"0ENB1O", 'F'}, {"0ENBF(", 'F'}, {"0ENBN)", 'F'}, {"0ENBNO", 'F'}, {"0ENBS)", 'F'}, {"0ENBSO", 'F'}, {"0ENBV)", 'F'}, {"0ENBVO", 'F'}, {"0ENF()", 'F'}, {"0ENF(1", 'F'}, {"0ENF(F", 'F'}, {"0ENF(N", 'F'}, {"0ENF(S", 'F'}, {"0ENF(V", 'F'}, {"0ENK(1", 'F'}, {"0ENK(E", 'F'}, {"0ENK(F", 'F'}, {"0ENK(N", 'F'}, {"0ENK(S", 'F'}, {"0ENK(V", 'F'}, {"0ENK1)", 'F'}, {"0ENK1K", 'F'}, {"0ENK1O", 'F'}, {"0ENKF(", 'F'}, {"0ENKN)", 'F'}, {"0ENKN,", 'F'}, {"0ENKN;", 'F'}, {"0ENKNB", 'F'}, {"0ENKNC", 'F'}, {"0ENKNK", 'F'}, {"0ENKNU", 'F'}, {"0ENKS)", 'F'}, {"0ENKSK", 'F'}, {"0ENKSO", 'F'}, {"0ENKV)", 'F'}, {"0ENKVK", 'F'}, {"0ENKVO", 'F'}, {"0ENO(1", 'F'}, {"0ENO(E", 'F'}, {"0ENO(F", 'F'}, {"0ENO(N", 'F'}, {"0ENO(S", 'F'}, {"0ENO(T", 'F'}, {"0ENO(V", 'F'}, {"0ENOF(", 'F'}, {"0ENOS&", 'F'}, {"0ENOS(", 'F'}, {"0ENOS)", 'F'}, {"0ENOS,", 'F'}, {"0ENOS1", 'F'}, {"0ENOS;", 'F'}, {"0ENOSB", 'F'}, {"0ENOSF", 'F'}, {"0ENOSK", 'F'}, {"0ENOSO", 'F'}, {"0ENOSU", 'F'}, {"0ENOSV", 'F'}, {"0ENOV&", 'F'}, {"0ENOV(", 'F'}, {"0ENOV)", 'F'}, {"0ENOV,", 'F'}, {"0ENOV;", 'F'}, {"0ENOVB", 'F'}, {"0ENOVF", 'F'}, {"0ENOVK", 'F'}, {"0ENOVO", 'F'}, {"0ENOVS", 'F'}, {"0ENOVU", 'F'}, {"0ENU(E", 'F'}, {"0ENUE(", 'F'}, {"0ENUE1", 'F'}, {"0ENUEF", 'F'}, {"0ENUEK", 'F'}, {"0ENUEN", 'F'}, {"0ENUES", 'F'}, {"0ENUEV", 'F'}, {"0EO(1,", 'F'}, {"0EO(1O", 'F'}, {"0EO(F(", 'F'}, {"0EO(N,", 'F'}, {"0EO(NO", 'F'}, {"0EO(S,", 'F'}, {"0EO(SO", 'F'}, {"0EO(V,", 'F'}, {"0EO(VO", 'F'}, {"0EOK(E", 'F'}, {"0EOKNK", 'F'}, {"0ES&(1", 'F'}, {"0ES&(E", 'F'}, {"0ES&(F", 'F'}, {"0ES&(N", 'F'}, {"0ES&(S", 'F'}, {"0ES&(V", 'F'}, {"0ES&1)", 'F'}, {"0ES&1O", 'F'}, {"0ES&F(", 'F'}, {"0ES&N)", 'F'}, {"0ES&NO", 'F'}, {"0ES&S)", 'F'}, {"0ES&SO", 'F'}, {"0ES&V)", 'F'}, {"0ES&VO", 'F'}, {"0ES)", 'F'}, {"0ES)&(", 'F'}, {"0ES)&1", 'F'}, {"0ES)&F", 'F'}, {"0ES)&N", 'F'}, {"0ES)&S", 'F'}, {"0ES)&V", 'F'}, {"0ES);", 'F'}, {"0ES);(", 'F'}, {"0ES);C", 'F'}, {"0ES);E", 'F'}, {"0ES);T", 'F'}, {"0ES)C", 'F'}, {"0ES)KN", 'F'}, {"0ES)O(", 'F'}, {"0ES)O1", 'F'}, {"0ES)OF", 'F'}, {"0ES)ON", 'F'}, {"0ES)OS", 'F'}, {"0ES)OV", 'F'}, {"0ES)UE", 'F'}, {"0ES,(1", 'F'}, {"0ES,(F", 'F'}, {"0ES,(N", 'F'}, {"0ES,(S", 'F'}, {"0ES,(V", 'F'}, {"0ES,F(", 'F'}, {"0ES,V,", 'F'}, {"0ES,VK", 'F'}, {"0ES,VO", 'F'}, {"0ES1", 'F'}, {"0ES1;", 'F'}, {"0ES1;C", 'F'}, {"0ES1C", 'F'}, {"0ES1O(", 'F'}, {"0ES1OF", 'F'}, {"0ES1OS", 'F'}, {"0ES1OV", 'F'}, {"0ES;(E", 'F'}, {"0ESB(1", 'F'}, {"0ESB(F", 'F'}, {"0ESB(N", 'F'}, {"0ESB(S", 'F'}, {"0ESB(V", 'F'}, {"0ESB1)", 'F'}, {"0ESB1O", 'F'}, {"0ESBF(", 'F'}, {"0ESBN)", 'F'}, {"0ESBNO", 'F'}, {"0ESBS)", 'F'}, {"0ESBSO", 'F'}, {"0ESBV)", 'F'}, {"0ESBVO", 'F'}, {"0ESF()", 'F'}, {"0ESF(1", 'F'}, {"0ESF(F", 'F'}, {"0ESF(N", 'F'}, {"0ESF(S", 'F'}, {"0ESF(V", 'F'}, {"0ESK(1", 'F'}, {"0ESK(E", 'F'}, {"0ESK(F", 'F'}, {"0ESK(N", 'F'}, {"0ESK(S", 'F'}, {"0ESK(V", 'F'}, {"0ESK1)", 'F'}, {"0ESK1K", 'F'}, {"0ESK1O", 'F'}, {"0ESKF(", 'F'}, {"0ESKN", 'F'}, {"0ESKN)", 'F'}, {"0ESKN;", 'F'}, {"0ESKNC", 'F'}, {"0ESKNK", 'F'}, {"0ESKNU", 'F'}, {"0ESKS)", 'F'}, {"0ESKSK", 'F'}, {"0ESKSO", 'F'}, {"0ESKV)", 'F'}, {"0ESKVK", 'F'}, {"0ESKVO", 'F'}, {"0ESO(1", 'F'}, {"0ESO(E", 'F'}, {"0ESO(F", 'F'}, {"0ESO(N", 'F'}, {"0ESO(S", 'F'}, {"0ESO(T", 'F'}, {"0ESO(V", 'F'}, {"0ESO1&", 'F'}, {"0ESO1(", 'F'}, {"0ESO1)", 'F'}, {"0ESO1,", 'F'}, {"0ESO1;", 'F'}, {"0ESO1B", 'F'}, {"0ESO1F", 'F'}, {"0ESO1K", 'F'}, {"0ESO1N", 'F'}, {"0ESO1O", 'F'}, {"0ESO1S", 'F'}, {"0ESO1U", 'F'}, {"0ESO1V", 'F'}, {"0ESOF(", 'F'}, {"0ESON&", 'F'}, {"0ESON(", 'F'}, {"0ESON)", 'F'}, {"0ESON,", 'F'}, {"0ESON1", 'F'}, {"0ESON;", 'F'}, {"0ESONB", 'F'}, {"0ESONF", 'F'}, {"0ESONK", 'F'}, {"0ESONO", 'F'}, {"0ESONU", 'F'}, {"0ESOS&", 'F'}, {"0ESOS(", 'F'}, {"0ESOS)", 'F'}, {"0ESOS,", 'F'}, {"0ESOS1", 'F'}, {"0ESOS;", 'F'}, {"0ESOSB", 'F'}, {"0ESOSF", 'F'}, {"0ESOSK", 'F'}, {"0ESOSO", 'F'}, {"0ESOSU", 'F'}, {"0ESOSV", 'F'}, {"0ESOV&", 'F'}, {"0ESOV(", 'F'}, {"0ESOV)", 'F'}, {"0ESOV,", 'F'}, {"0ESOV;", 'F'}, {"0ESOVB", 'F'}, {"0ESOVF", 'F'}, {"0ESOVK", 'F'}, {"0ESOVO", 'F'}, {"0ESOVS", 'F'}, {"0ESOVU", 'F'}, {"0ESU(E", 'F'}, {"0ESUE(", 'F'}, {"0ESUE1", 'F'}, {"0ESUEF", 'F'}, {"0ESUEK", 'F'}, {"0ESUEN", 'F'}, {"0ESUES", 'F'}, {"0ESUEV", 'F'}, {"0ESV", 'F'}, {"0ESV;", 'F'}, {"0ESV;C", 'F'}, {"0ESVC", 'F'}, {"0ESVO(", 'F'}, {"0ESVOF", 'F'}, {"0ESVOS", 'F'}, {"0ET(1&", 'F'}, {"0ET(1)", 'F'}, {"0ET(1O", 'F'}, {"0ET(E(", 'F'}, {"0ET(E1", 'F'}, {"0ET(EF", 'F'}, {"0ET(EK", 'F'}, {"0ET(EN", 'F'}, {"0ET(ES", 'F'}, {"0ET(EV", 'F'}, {"0ET(F(", 'F'}, {"0ET(N&", 'F'}, {"0ET(N)", 'F'}, {"0ET(NO", 'F'}, {"0ET(S&", 'F'}, {"0ET(S)", 'F'}, {"0ET(SO", 'F'}, {"0ET(T(", 'F'}, {"0ET(V&", 'F'}, {"0ET(V)", 'F'}, {"0ET(VO", 'F'}, {"0EV&(1", 'F'}, {"0EV&(E", 'F'}, {"0EV&(F", 'F'}, {"0EV&(N", 'F'}, {"0EV&(S", 'F'}, {"0EV&(V", 'F'}, {"0EV&1)", 'F'}, {"0EV&1O", 'F'}, {"0EV&F(", 'F'}, {"0EV&N)", 'F'}, {"0EV&NO", 'F'}, {"0EV&S)", 'F'}, {"0EV&SO", 'F'}, {"0EV&V)", 'F'}, {"0EV&VO", 'F'}, {"0EV)", 'F'}, {"0EV)&(", 'F'}, {"0EV)&1", 'F'}, {"0EV)&F", 'F'}, {"0EV)&N", 'F'}, {"0EV)&S", 'F'}, {"0EV)&V", 'F'}, {"0EV);", 'F'}, {"0EV);(", 'F'}, {"0EV);C", 'F'}, {"0EV);E", 'F'}, {"0EV);T", 'F'}, {"0EV)C", 'F'}, {"0EV)KN", 'F'}, {"0EV)O(", 'F'}, {"0EV)O1", 'F'}, {"0EV)OF", 'F'}, {"0EV)ON", 'F'}, {"0EV)OS", 'F'}, {"0EV)OV", 'F'}, {"0EV)UE", 'F'}, {"0EV,(1", 'F'}, {"0EV,(F", 'F'}, {"0EV,(N", 'F'}, {"0EV,(S", 'F'}, {"0EV,(V", 'F'}, {"0EV,1,", 'F'}, {"0EV,1K", 'F'}, {"0EV,1O", 'F'}, {"0EV,F(", 'F'}, {"0EV,N,", 'F'}, {"0EV,NK", 'F'}, {"0EV,NO", 'F'}, {"0EV,S,", 'F'}, {"0EV,SK", 'F'}, {"0EV,SO", 'F'}, {"0EV,V,", 'F'}, {"0EV,VK", 'F'}, {"0EV,VO", 'F'}, {"0EV;(E", 'F'}, {"0EVB(1", 'F'}, {"0EVB(F", 'F'}, {"0EVB(N", 'F'}, {"0EVB(S", 'F'}, {"0EVB(V", 'F'}, {"0EVB1)", 'F'}, {"0EVB1O", 'F'}, {"0EVBF(", 'F'}, {"0EVBN)", 'F'}, {"0EVBNO", 'F'}, {"0EVBS)", 'F'}, {"0EVBSO", 'F'}, {"0EVBV)", 'F'}, {"0EVBVO", 'F'}, {"0EVF()", 'F'}, {"0EVF(1", 'F'}, {"0EVF(F", 'F'}, {"0EVF(N", 'F'}, {"0EVF(S", 'F'}, {"0EVF(V", 'F'}, {"0EVK(1", 'F'}, {"0EVK(E", 'F'}, {"0EVK(F", 'F'}, {"0EVK(N", 'F'}, {"0EVK(S", 'F'}, {"0EVK(V", 'F'}, {"0EVK1)", 'F'}, {"0EVK1K", 'F'}, {"0EVK1O", 'F'}, {"0EVKF(", 'F'}, {"0EVKN", 'F'}, {"0EVKN)", 'F'}, {"0EVKN;", 'F'}, {"0EVKNC", 'F'}, {"0EVKNK", 'F'}, {"0EVKNU", 'F'}, {"0EVKS)", 'F'}, {"0EVKSK", 'F'}, {"0EVKSO", 'F'}, {"0EVKV)", 'F'}, {"0EVKVK", 'F'}, {"0EVKVO", 'F'}, {"0EVN", 'F'}, {"0EVN)U", 'F'}, {"0EVN;", 'F'}, {"0EVN;C", 'F'}, {"0EVNC", 'F'}, {"0EVNKN", 'F'}, {"0EVNO(", 'F'}, {"0EVNOF", 'F'}, {"0EVNOS", 'F'}, {"0EVNOV", 'F'}, {"0EVO(1", 'F'}, {"0EVO(E", 'F'}, {"0EVO(F", 'F'}, {"0EVO(N", 'F'}, {"0EVO(S", 'F'}, {"0EVO(T", 'F'}, {"0EVO(V", 'F'}, {"0EVOF(", 'F'}, {"0EVOS&", 'F'}, {"0EVOS(", 'F'}, {"0EVOS)", 'F'}, {"0EVOS,", 'F'}, {"0EVOS1", 'F'}, {"0EVOS;", 'F'}, {"0EVOSB", 'F'}, {"0EVOSF", 'F'}, {"0EVOSK", 'F'}, {"0EVOSO", 'F'}, {"0EVOSU", 'F'}, {"0EVOSV", 'F'}, {"0EVS", 'F'}, {"0EVS;", 'F'}, {"0EVS;C", 'F'}, {"0EVSC", 'F'}, {"0EVSO(", 'F'}, {"0EVSO1", 'F'}, {"0EVSOF", 'F'}, {"0EVSON", 'F'}, {"0EVSOS", 'F'}, {"0EVSOV", 'F'}, {"0EVU(E", 'F'}, {"0EVUE(", 'F'}, {"0EVUE1", 'F'}, {"0EVUEF", 'F'}, {"0EVUEK", 'F'}, {"0EVUEN", 'F'}, {"0EVUES", 'F'}, {"0EVUEV", 'F'}, {"0F()&(", 'F'}, {"0F()&1", 'F'}, {"0F()&E", 'F'}, {"0F()&F", 'F'}, {"0F()&K", 'F'}, {"0F()&N", 'F'}, {"0F()&S", 'F'}, {"0F()&T", 'F'}, {"0F()&V", 'F'}, {"0F(),(", 'F'}, {"0F(),1", 'F'}, {"0F(),F", 'F'}, {"0F(),N", 'F'}, {"0F(),S", 'F'}, {"0F(),V", 'F'}, {"0F()1(", 'F'}, {"0F()1F", 'F'}, {"0F()1N", 'F'}, {"0F()1O", 'F'}, {"0F()1S", 'F'}, {"0F()1U", 'F'}, {"0F()1V", 'F'}, {"0F();E", 'F'}, {"0F();N", 'F'}, {"0F();T", 'F'}, {"0F()A(", 'F'}, {"0F()AF", 'F'}, {"0F()AS", 'F'}, {"0F()AT", 'F'}, {"0F()AV", 'F'}, {"0F()B(", 'F'}, {"0F()B1", 'F'}, {"0F()BE", 'F'}, {"0F()BF", 'F'}, {"0F()BN", 'F'}, {"0F()BS", 'F'}, {"0F()BV", 'F'}, {"0F()C", 'F'}, {"0F()E(", 'F'}, {"0F()E1", 'F'}, {"0F()EF", 'F'}, {"0F()EK", 'F'}, {"0F()EN", 'F'}, {"0F()EO", 'F'}, {"0F()ES", 'F'}, {"0F()EU", 'F'}, {"0F()EV", 'F'}, {"0F()F(", 'F'}, {"0F()K(", 'F'}, {"0F()K)", 'F'}, {"0F()K1", 'F'}, {"0F()KF", 'F'}, {"0F()KN", 'F'}, {"0F()KS", 'F'}, {"0F()KU", 'F'}, {"0F()KV", 'F'}, {"0F()N&", 'F'}, {"0F()N(", 'F'}, {"0F()N)", 'F'}, {"0F()N,", 'F'}, {"0F()N1", 'F'}, {"0F()NE", 'F'}, {"0F()NF", 'F'}, {"0F()NO", 'F'}, {"0F()NU", 'F'}, {"0F()O(", 'F'}, {"0F()O1", 'F'}, {"0F()OF", 'F'}, {"0F()OK", 'F'}, {"0F()ON", 'F'}, {"0F()OS", 'F'}, {"0F()OT", 'F'}, {"0F()OU", 'F'}, {"0F()OV", 'F'}, {"0F()S(", 'F'}, {"0F()S1", 'F'}, {"0F()SF", 'F'}, {"0F()SO", 'F'}, {"0F()SU", 'F'}, {"0F()SV", 'F'}, {"0F()U", 'F'}, {"0F()U(", 'F'}, {"0F()U1", 'F'}, {"0F()U;", 'F'}, {"0F()UC", 'F'}, {"0F()UE", 'F'}, {"0F()UF", 'F'}, {"0F()UK", 'F'}, {"0F()UN", 'F'}, {"0F()UO", 'F'}, {"0F()US", 'F'}, {"0F()UT", 'F'}, {"0F()UV", 'F'}, {"0F()V(", 'F'}, {"0F()VF", 'F'}, {"0F()VO", 'F'}, {"0F()VS", 'F'}, {"0F()VU", 'F'}, {"0F(1&(", 'F'}, {"0F(1&1", 'F'}, {"0F(1&F", 'F'}, {"0F(1&N", 'F'}, {"0F(1&S", 'F'}, {"0F(1&V", 'F'}, {"0F(1)", 'F'}, {"0F(1)&", 'F'}, {"0F(1),", 'F'}, {"0F(1)1", 'F'}, {"0F(1);", 'F'}, {"0F(1)A", 'F'}, {"0F(1)B", 'F'}, {"0F(1)C", 'F'}, {"0F(1)E", 'F'}, {"0F(1)F", 'F'}, {"0F(1)K", 'F'}, {"0F(1)N", 'F'}, {"0F(1)O", 'F'}, {"0F(1)S", 'F'}, {"0F(1)U", 'F'}, {"0F(1)V", 'F'}, {"0F(1,(", 'F'}, {"0F(1,F", 'F'}, {"0F(1,V", 'F'}, {"0F(1O(", 'F'}, {"0F(1OF", 'F'}, {"0F(1OS", 'F'}, {"0F(1OV", 'F'}, {"0F(E(1", 'F'}, {"0F(E(E", 'F'}, {"0F(E(F", 'F'}, {"0F(E(N", 'F'}, {"0F(E(S", 'F'}, {"0F(E(V", 'F'}, {"0F(E1&", 'F'}, {"0F(E1)", 'F'}, {"0F(E1K", 'F'}, {"0F(E1O", 'F'}, {"0F(EF(", 'F'}, {"0F(EK(", 'F'}, {"0F(EK1", 'F'}, {"0F(EKF", 'F'}, {"0F(EKN", 'F'}, {"0F(EKS", 'F'}, {"0F(EKT", 'F'}, {"0F(EKV", 'F'}, {"0F(EN&", 'F'}, {"0F(EN)", 'F'}, {"0F(ENK", 'F'}, {"0F(ENO", 'F'}, {"0F(ES&", 'F'}, {"0F(ES)", 'F'}, {"0F(ESK", 'F'}, {"0F(ESO", 'F'}, {"0F(ET(", 'F'}, {"0F(EV&", 'F'}, {"0F(EV)", 'F'}, {"0F(EVK", 'F'}, {"0F(EVO", 'F'}, {"0F(F()", 'F'}, {"0F(F(1", 'F'}, {"0F(F(E", 'F'}, {"0F(F(F", 'F'}, {"0F(F(N", 'F'}, {"0F(F(S", 'F'}, {"0F(F(T", 'F'}, {"0F(F(V", 'F'}, {"0F(K()", 'F'}, {"0F(K,(", 'F'}, {"0F(K,F", 'F'}, {"0F(N&(", 'F'}, {"0F(N&1", 'F'}, {"0F(N&F", 'F'}, {"0F(N&N", 'F'}, {"0F(N&S", 'F'}, {"0F(N&V", 'F'}, {"0F(N)", 'F'}, {"0F(N)&", 'F'}, {"0F(N),", 'F'}, {"0F(N)1", 'F'}, {"0F(N);", 'F'}, {"0F(N)A", 'F'}, {"0F(N)B", 'F'}, {"0F(N)C", 'F'}, {"0F(N)E", 'F'}, {"0F(N)F", 'F'}, {"0F(N)K", 'F'}, {"0F(N)N", 'F'}, {"0F(N)O", 'F'}, {"0F(N)S", 'F'}, {"0F(N)U", 'F'}, {"0F(N)V", 'F'}, {"0F(N,(", 'F'}, {"0F(N,F", 'F'}, {"0F(N,V", 'F'}, {"0F(NO(", 'F'}, {"0F(NOF", 'F'}, {"0F(NOS", 'F'}, {"0F(NOV", 'F'}, {"0F(S&(", 'F'}, {"0F(S&1", 'F'}, {"0F(S&F", 'F'}, {"0F(S&N", 'F'}, {"0F(S&S", 'F'}, {"0F(S&V", 'F'}, {"0F(S)", 'F'}, {"0F(S)&", 'F'}, {"0F(S),", 'F'}, {"0F(S)1", 'F'}, {"0F(S);", 'F'}, {"0F(S)A", 'F'}, {"0F(S)B", 'F'}, {"0F(S)C", 'F'}, {"0F(S)E", 'F'}, {"0F(S)F", 'F'}, {"0F(S)K", 'F'}, {"0F(S)N", 'F'}, {"0F(S)O", 'F'}, {"0F(S)S", 'F'}, {"0F(S)U", 'F'}, {"0F(S)V", 'F'}, {"0F(S,(", 'F'}, {"0F(S,F", 'F'}, {"0F(S,V", 'F'}, {"0F(SO(", 'F'}, {"0F(SO1", 'F'}, {"0F(SOF", 'F'}, {"0F(SON", 'F'}, {"0F(SOS", 'F'}, {"0F(SOV", 'F'}, {"0F(T(1", 'F'}, {"0F(T(E", 'F'}, {"0F(T(F", 'F'}, {"0F(T(N", 'F'}, {"0F(T(S", 'F'}, {"0F(T(T", 'F'}, {"0F(T(V", 'F'}, {"0F(T),", 'F'}, {"0F(T,(", 'F'}, {"0F(T,1", 'F'}, {"0F(T,F", 'F'}, {"0F(T,N", 'F'}, {"0F(T,S", 'F'}, {"0F(T,V", 'F'}, {"0F(V&(", 'F'}, {"0F(V&1", 'F'}, {"0F(V&F", 'F'}, {"0F(V&N", 'F'}, {"0F(V&S", 'F'}, {"0F(V&V", 'F'}, {"0F(V)", 'F'}, {"0F(V)&", 'F'}, {"0F(V),", 'F'}, {"0F(V)1", 'F'}, {"0F(V);", 'F'}, {"0F(V)A", 'F'}, {"0F(V)B", 'F'}, {"0F(V)C", 'F'}, {"0F(V)E", 'F'}, {"0F(V)F", 'F'}, {"0F(V)K", 'F'}, {"0F(V)N", 'F'}, {"0F(V)O", 'F'}, {"0F(V)S", 'F'}, {"0F(V)U", 'F'}, {"0F(V)V", 'F'}, {"0F(V,(", 'F'}, {"0F(V,1", 'F'}, {"0F(V,F", 'F'}, {"0F(V,N", 'F'}, {"0F(V,S", 'F'}, {"0F(V,V", 'F'}, {"0F(VO(", 'F'}, {"0F(VOF", 'F'}, {"0F(VOS", 'F'}, {"0K(1),", 'F'}, {"0K(1)A", 'F'}, {"0K(1)K", 'F'}, {"0K(1)O", 'F'}, {"0K(1O(", 'F'}, {"0K(1OF", 'F'}, {"0K(1OS", 'F'}, {"0K(1OV", 'F'}, {"0K(F()", 'F'}, {"0K(F(1", 'F'}, {"0K(F(F", 'F'}, {"0K(F(N", 'F'}, {"0K(F(S", 'F'}, {"0K(F(V", 'F'}, {"0K(N),", 'F'}, {"0K(N)A", 'F'}, {"0K(N)K", 'F'}, {"0K(N)O", 'F'}, {"0K(NO(", 'F'}, {"0K(NOF", 'F'}, {"0K(NOS", 'F'}, {"0K(NOV", 'F'}, {"0K(S),", 'F'}, {"0K(S)A", 'F'}, {"0K(S)K", 'F'}, {"0K(S)O", 'F'}, {"0K(SO(", 'F'}, {"0K(SO1", 'F'}, {"0K(SOF", 'F'}, {"0K(SON", 'F'}, {"0K(SOS", 'F'}, {"0K(SOV", 'F'}, {"0K(V),", 'F'}, {"0K(V)A", 'F'}, {"0K(V)K", 'F'}, {"0K(V)O", 'F'}, {"0K(VO(", 'F'}, {"0K(VOF", 'F'}, {"0K(VOS", 'F'}, {"0K1,(1", 'F'}, {"0K1,(F", 'F'}, {"0K1,(N", 'F'}, {"0K1,(S", 'F'}, {"0K1,(V", 'F'}, {"0K1,F(", 'F'}, {"0K1,VC", 'F'}, {"0K1,VO", 'F'}, {"0K1A(F", 'F'}, {"0K1A(N", 'F'}, {"0K1A(S", 'F'}, {"0K1A(V", 'F'}, {"0K1AF(", 'F'}, {"0K1ASO", 'F'}, {"0K1ATO", 'F'}, {"0K1AVO", 'F'}, {"0K1K(1", 'F'}, {"0K1K(F", 'F'}, {"0K1K(N", 'F'}, {"0K1K(S", 'F'}, {"0K1K(V", 'F'}, {"0K1K1O", 'F'}, {"0K1K1U", 'F'}, {"0K1KF(", 'F'}, {"0K1KNU", 'F'}, {"0K1KSO", 'F'}, {"0K1KSU", 'F'}, {"0K1KVO", 'F'}, {"0K1KVU", 'F'}, {"0K1O(1", 'F'}, {"0K1O(F", 'F'}, {"0K1O(N", 'F'}, {"0K1O(S", 'F'}, {"0K1O(V", 'F'}, {"0K1OF(", 'F'}, {"0K1OS(", 'F'}, {"0K1OS,", 'F'}, {"0K1OS1", 'F'}, {"0K1OSA", 'F'}, {"0K1OSF", 'F'}, {"0K1OSK", 'F'}, {"0K1OSO", 'F'}, {"0K1OSV", 'F'}, {"0K1OV(", 'F'}, {"0K1OV,", 'F'}, {"0K1OVA", 'F'}, {"0K1OVF", 'F'}, {"0K1OVK", 'F'}, {"0K1OVO", 'F'}, {"0K1OVS", 'F'}, {"0KF(),", 'F'}, {"0KF()A", 'F'}, {"0KF()K", 'F'}, {"0KF()O", 'F'}, {"0KF(1)", 'F'}, {"0KF(1O", 'F'}, {"0KF(F(", 'F'}, {"0KF(N)", 'F'}, {"0KF(NO", 'F'}, {"0KF(S)", 'F'}, {"0KF(SO", 'F'}, {"0KF(V)", 'F'}, {"0KF(VO", 'F'}, {"0KN,(1", 'F'}, {"0KN,(F", 'F'}, {"0KN,(N", 'F'}, {"0KN,(S", 'F'}, {"0KN,(V", 'F'}, {"0KN,F(", 'F'}, {"0KN,VC", 'F'}, {"0KN,VO", 'F'}, {"0KNA(F", 'F'}, {"0KNA(N", 'F'}, {"0KNA(S", 'F'}, {"0KNA(V", 'F'}, {"0KNAF(", 'F'}, {"0KNASO", 'F'}, {"0KNATO", 'F'}, {"0KNAVO", 'F'}, {"0KNK(1", 'F'}, {"0KNK(F", 'F'}, {"0KNK(N", 'F'}, {"0KNK(S", 'F'}, {"0KNK(V", 'F'}, {"0KNK1O", 'F'}, {"0KNK1U", 'F'}, {"0KNKF(", 'F'}, {"0KNKNU", 'F'}, {"0KNKSO", 'F'}, {"0KNKSU", 'F'}, {"0KNKVO", 'F'}, {"0KNKVU", 'F'}, {"0KS,(1", 'F'}, {"0KS,(F", 'F'}, {"0KS,(N", 'F'}, {"0KS,(S", 'F'}, {"0KS,(V", 'F'}, {"0KS,F(", 'F'}, {"0KS,VC", 'F'}, {"0KS,VO", 'F'}, {"0KSA(F", 'F'}, {"0KSA(N", 'F'}, {"0KSA(S", 'F'}, {"0KSA(V", 'F'}, {"0KSAF(", 'F'}, {"0KSASO", 'F'}, {"0KSATO", 'F'}, {"0KSAVO", 'F'}, {"0KSK(1", 'F'}, {"0KSK(F", 'F'}, {"0KSK(N", 'F'}, {"0KSK(S", 'F'}, {"0KSK(V", 'F'}, {"0KSK1O", 'F'}, {"0KSK1U", 'F'}, {"0KSKF(", 'F'}, {"0KSKNU", 'F'}, {"0KSKSO", 'F'}, {"0KSKSU", 'F'}, {"0KSKVO", 'F'}, {"0KSKVU", 'F'}, {"0KSO(1", 'F'}, {"0KSO(F", 'F'}, {"0KSO(N", 'F'}, {"0KSO(S", 'F'}, {"0KSO(V", 'F'}, {"0KSO1(", 'F'}, {"0KSO1,", 'F'}, {"0KSO1A", 'F'}, {"0KSO1F", 'F'}, {"0KSO1K", 'F'}, {"0KSO1N", 'F'}, {"0KSO1O", 'F'}, {"0KSO1S", 'F'}, {"0KSO1V", 'F'}, {"0KSOF(", 'F'}, {"0KSON(", 'F'}, {"0KSON,", 'F'}, {"0KSON1", 'F'}, {"0KSONA", 'F'}, {"0KSONF", 'F'}, {"0KSONK", 'F'}, {"0KSONO", 'F'}, {"0KSOS(", 'F'}, {"0KSOS,", 'F'}, {"0KSOS1", 'F'}, {"0KSOSA", 'F'}, {"0KSOSF", 'F'}, {"0KSOSK", 'F'}, {"0KSOSO", 'F'}, {"0KSOSV", 'F'}, {"0KSOV(", 'F'}, {"0KSOV,", 'F'}, {"0KSOVA", 'F'}, {"0KSOVF", 'F'}, {"0KSOVK", 'F'}, {"0KSOVO", 'F'}, {"0KSOVS", 'F'}, {"0KV,(1", 'F'}, {"0KV,(F", 'F'}, {"0KV,(N", 'F'}, {"0KV,(S", 'F'}, {"0KV,(V", 'F'}, {"0KV,1C", 'F'}, {"0KV,1O", 'F'}, {"0KV,F(", 'F'}, {"0KV,NC", 'F'}, {"0KV,NO", 'F'}, {"0KV,SC", 'F'}, {"0KV,SO", 'F'}, {"0KV,VC", 'F'}, {"0KV,VO", 'F'}, {"0KVA(F", 'F'}, {"0KVA(N", 'F'}, {"0KVA(S", 'F'}, {"0KVA(V", 'F'}, {"0KVAF(", 'F'}, {"0KVASO", 'F'}, {"0KVATO", 'F'}, {"0KVAVO", 'F'}, {"0KVK(1", 'F'}, {"0KVK(F", 'F'}, {"0KVK(N", 'F'}, {"0KVK(S", 'F'}, {"0KVK(V", 'F'}, {"0KVK1O", 'F'}, {"0KVK1U", 'F'}, {"0KVKF(", 'F'}, {"0KVKNU", 'F'}, {"0KVKSO", 'F'}, {"0KVKSU", 'F'}, {"0KVKVO", 'F'}, {"0KVKVU", 'F'}, {"0KVO(1", 'F'}, {"0KVO(F", 'F'}, {"0KVO(N", 'F'}, {"0KVO(S", 'F'}, {"0KVO(V", 'F'}, {"0KVOF(", 'F'}, {"0KVOS(", 'F'}, {"0KVOS,", 'F'}, {"0KVOS1", 'F'}, {"0KVOSA", 'F'}, {"0KVOSF", 'F'}, {"0KVOSK", 'F'}, {"0KVOSO", 'F'}, {"0KVOSV", 'F'}, {"0N&(1&", 'F'}, {"0N&(1)", 'F'}, {"0N&(1,", 'F'}, {"0N&(1O", 'F'}, {"0N&(E(", 'F'}, {"0N&(E1", 'F'}, {"0N&(EF", 'F'}, {"0N&(EK", 'F'}, {"0N&(EN", 'F'}, {"0N&(EO", 'F'}, {"0N&(ES", 'F'}, {"0N&(ET", 'F'}, {"0N&(EV", 'F'}, {"0N&(F(", 'F'}, {"0N&(N&", 'F'}, {"0N&(N)", 'F'}, {"0N&(N,", 'F'}, {"0N&(NO", 'F'}, {"0N&(O(", 'F'}, {"0N&(O1", 'F'}, {"0N&(OF", 'F'}, {"0N&(ON", 'F'}, {"0N&(OS", 'F'}, {"0N&(OV", 'F'}, {"0N&(S&", 'F'}, {"0N&(S)", 'F'}, {"0N&(S,", 'F'}, {"0N&(SO", 'F'}, {"0N&(T(", 'F'}, {"0N&(V&", 'F'}, {"0N&(V)", 'F'}, {"0N&(V,", 'F'}, {"0N&(VO", 'F'}, {"0N&1", 'F'}, {"0N&1&(", 'F'}, {"0N&1&1", 'F'}, {"0N&1&F", 'F'}, {"0N&1&N", 'F'}, {"0N&1&S", 'F'}, {"0N&1&V", 'F'}, {"0N&1)&", 'F'}, {"0N&1)C", 'F'}, {"0N&1)O", 'F'}, {"0N&1)U", 'F'}, {"0N&1;", 'F'}, {"0N&1;C", 'F'}, {"0N&1;E", 'F'}, {"0N&1;T", 'F'}, {"0N&1B(", 'F'}, {"0N&1B1", 'F'}, {"0N&1BF", 'F'}, {"0N&1BN", 'F'}, {"0N&1BS", 'F'}, {"0N&1BV", 'F'}, {"0N&1C", 'F'}, {"0N&1EK", 'F'}, {"0N&1EN", 'F'}, {"0N&1F(", 'F'}, {"0N&1K(", 'F'}, {"0N&1K1", 'F'}, {"0N&1KF", 'F'}, {"0N&1KN", 'F'}, {"0N&1KS", 'F'}, {"0N&1KV", 'F'}, {"0N&1O(", 'F'}, {"0N&1OF", 'F'}, {"0N&1OO", 'F'}, {"0N&1OS", 'F'}, {"0N&1OV", 'F'}, {"0N&1TN", 'F'}, {"0N&1U", 'F'}, {"0N&1U(", 'F'}, {"0N&1U;", 'F'}, {"0N&1UC", 'F'}, {"0N&1UE", 'F'}, {"0N&E(1", 'F'}, {"0N&E(F", 'F'}, {"0N&E(N", 'F'}, {"0N&E(O", 'F'}, {"0N&E(S", 'F'}, {"0N&E(V", 'F'}, {"0N&E1", 'F'}, {"0N&E1;", 'F'}, {"0N&E1C", 'F'}, {"0N&E1K", 'F'}, {"0N&E1O", 'F'}, {"0N&EF(", 'F'}, {"0N&EK(", 'F'}, {"0N&EK1", 'F'}, {"0N&EKF", 'F'}, {"0N&EKN", 'F'}, {"0N&EKS", 'F'}, {"0N&EKV", 'F'}, {"0N&EN;", 'F'}, {"0N&ENC", 'F'}, {"0N&ENK", 'F'}, {"0N&ENO", 'F'}, {"0N&ES", 'F'}, {"0N&ES;", 'F'}, {"0N&ESC", 'F'}, {"0N&ESK", 'F'}, {"0N&ESO", 'F'}, {"0N&EV", 'F'}, {"0N&EV;", 'F'}, {"0N&EVC", 'F'}, {"0N&EVK", 'F'}, {"0N&EVO", 'F'}, {"0N&F()", 'F'}, {"0N&F(1", 'F'}, {"0N&F(E", 'F'}, {"0N&F(F", 'F'}, {"0N&F(N", 'F'}, {"0N&F(S", 'F'}, {"0N&F(T", 'F'}, {"0N&F(V", 'F'}, {"0N&K&(", 'F'}, {"0N&K&1", 'F'}, {"0N&K&F", 'F'}, {"0N&K&N", 'F'}, {"0N&K&S", 'F'}, {"0N&K&V", 'F'}, {"0N&K(1", 'F'}, {"0N&K(F", 'F'}, {"0N&K(N", 'F'}, {"0N&K(S", 'F'}, {"0N&K(V", 'F'}, {"0N&K1O", 'F'}, {"0N&KF(", 'F'}, {"0N&KNK", 'F'}, {"0N&KO(", 'F'}, {"0N&KO1", 'F'}, {"0N&KOF", 'F'}, {"0N&KOK", 'F'}, {"0N&KON", 'F'}, {"0N&KOS", 'F'}, {"0N&KOV", 'F'}, {"0N&KSO", 'F'}, {"0N&KVO", 'F'}, {"0N&N&(", 'F'}, {"0N&N&1", 'F'}, {"0N&N&F", 'F'}, {"0N&N&S", 'F'}, {"0N&N&V", 'F'}, {"0N&N)&", 'F'}, {"0N&N)C", 'F'}, {"0N&N)O", 'F'}, {"0N&N)U", 'F'}, {"0N&N;C", 'F'}, {"0N&N;E", 'F'}, {"0N&N;T", 'F'}, {"0N&NB(", 'F'}, {"0N&NB1", 'F'}, {"0N&NBF", 'F'}, {"0N&NBN", 'F'}, {"0N&NBS", 'F'}, {"0N&NBV", 'F'}, {"0N&NF(", 'F'}, {"0N&NK(", 'F'}, {"0N&NK1", 'F'}, {"0N&NKF", 'F'}, {"0N&NKS", 'F'}, {"0N&NKV", 'F'}, {"0N&NO(", 'F'}, {"0N&NOF", 'F'}, {"0N&NOS", 'F'}, {"0N&NOV", 'F'}, {"0N&NU", 'F'}, {"0N&NU(", 'F'}, {"0N&NU;", 'F'}, {"0N&NUC", 'F'}, {"0N&NUE", 'F'}, {"0N&S&(", 'F'}, {"0N&S&1", 'F'}, {"0N&S&F", 'F'}, {"0N&S&N", 'F'}, {"0N&S&S", 'F'}, {"0N&S&V", 'F'}, {"0N&S)&", 'F'}, {"0N&S)C", 'F'}, {"0N&S)O", 'F'}, {"0N&S)U", 'F'}, {"0N&S1", 'F'}, {"0N&S1;", 'F'}, {"0N&S1C", 'F'}, {"0N&S1O", 'F'}, {"0N&S;", 'F'}, {"0N&S;C", 'F'}, {"0N&S;E", 'F'}, {"0N&S;T", 'F'}, {"0N&SB(", 'F'}, {"0N&SB1", 'F'}, {"0N&SBF", 'F'}, {"0N&SBN", 'F'}, {"0N&SBS", 'F'}, {"0N&SBV", 'F'}, {"0N&SC", 'F'}, {"0N&SEK", 'F'}, {"0N&SEN", 'F'}, {"0N&SF(", 'F'}, {"0N&SK(", 'F'}, {"0N&SK1", 'F'}, {"0N&SKF", 'F'}, {"0N&SKN", 'F'}, {"0N&SKS", 'F'}, {"0N&SKV", 'F'}, {"0N&SO(", 'F'}, {"0N&SO1", 'F'}, {"0N&SOF", 'F'}, {"0N&SON", 'F'}, {"0N&SOO", 'F'}, {"0N&SOS", 'F'}, {"0N&SOV", 'F'}, {"0N&STN", 'F'}, {"0N&SU", 'F'}, {"0N&SU(", 'F'}, {"0N&SU;", 'F'}, {"0N&SUC", 'F'}, {"0N&SUE", 'F'}, {"0N&SV", 'F'}, {"0N&SV;", 'F'}, {"0N&SVC", 'F'}, {"0N&SVO", 'F'}, {"0N&T(1", 'F'}, {"0N&T(E", 'F'}, {"0N&T(F", 'F'}, {"0N&T(N", 'F'}, {"0N&T(S", 'F'}, {"0N&T(V", 'F'}, {"0N&V", 'F'}, {"0N&V&(", 'F'}, {"0N&V&1", 'F'}, {"0N&V&F", 'F'}, {"0N&V&N", 'F'}, {"0N&V&S", 'F'}, {"0N&V&V", 'F'}, {"0N&V)&", 'F'}, {"0N&V)C", 'F'}, {"0N&V)O", 'F'}, {"0N&V)U", 'F'}, {"0N&V;", 'F'}, {"0N&V;C", 'F'}, {"0N&V;E", 'F'}, {"0N&V;T", 'F'}, {"0N&VB(", 'F'}, {"0N&VB1", 'F'}, {"0N&VBF", 'F'}, {"0N&VBN", 'F'}, {"0N&VBS", 'F'}, {"0N&VBV", 'F'}, {"0N&VC", 'F'}, {"0N&VEK", 'F'}, {"0N&VEN", 'F'}, {"0N&VF(", 'F'}, {"0N&VK(", 'F'}, {"0N&VK1", 'F'}, {"0N&VKF", 'F'}, {"0N&VKN", 'F'}, {"0N&VKS", 'F'}, {"0N&VKV", 'F'}, {"0N&VO(", 'F'}, {"0N&VOF", 'F'}, {"0N&VOO", 'F'}, {"0N&VOS", 'F'}, {"0N&VS", 'F'}, {"0N&VS;", 'F'}, {"0N&VSC", 'F'}, {"0N&VSO", 'F'}, {"0N&VTN", 'F'}, {"0N&VU", 'F'}, {"0N&VU(", 'F'}, {"0N&VU;", 'F'}, {"0N&VUC", 'F'}, {"0N&VUE", 'F'}, {"0N(1)F", 'F'}, {"0N(1)O", 'F'}, {"0N(1)U", 'F'}, {"0N(1)V", 'F'}, {"0N(1O(", 'F'}, {"0N(1OF", 'F'}, {"0N(1OS", 'F'}, {"0N(1OV", 'F'}, {"0N(EF(", 'F'}, {"0N(EKN", 'F'}, {"0N(ENK", 'F'}, {"0N(F()", 'F'}, {"0N(F(1", 'F'}, {"0N(F(F", 'F'}, {"0N(F(N", 'F'}, {"0N(F(S", 'F'}, {"0N(F(V", 'F'}, {"0N(S)1", 'F'}, {"0N(S)F", 'F'}, {"0N(S)N", 'F'}, {"0N(S)O", 'F'}, {"0N(S)S", 'F'}, {"0N(S)U", 'F'}, {"0N(S)V", 'F'}, {"0N(SO(", 'F'}, {"0N(SO1", 'F'}, {"0N(SOF", 'F'}, {"0N(SON", 'F'}, {"0N(SOS", 'F'}, {"0N(SOV", 'F'}, {"0N(U(E", 'F'}, {"0N(V)1", 'F'}, {"0N(V)F", 'F'}, {"0N(V)N", 'F'}, {"0N(V)O", 'F'}, {"0N(V)S", 'F'}, {"0N(V)U", 'F'}, {"0N(V)V", 'F'}, {"0N(VO(", 'F'}, {"0N(VOF", 'F'}, {"0N(VOS", 'F'}, {"0N)&(1", 'F'}, {"0N)&(E", 'F'}, {"0N)&(F", 'F'}, {"0N)&(N", 'F'}, {"0N)&(S", 'F'}, {"0N)&(V", 'F'}, {"0N)&1", 'F'}, {"0N)&1&", 'F'}, {"0N)&1)", 'F'}, {"0N)&1;", 'F'}, {"0N)&1B", 'F'}, {"0N)&1C", 'F'}, {"0N)&1F", 'F'}, {"0N)&1O", 'F'}, {"0N)&1U", 'F'}, {"0N)&F(", 'F'}, {"0N)&N", 'F'}, {"0N)&N&", 'F'}, {"0N)&N)", 'F'}, {"0N)&N;", 'F'}, {"0N)&NB", 'F'}, {"0N)&NC", 'F'}, {"0N)&NF", 'F'}, {"0N)&NO", 'F'}, {"0N)&NU", 'F'}, {"0N)&S", 'F'}, {"0N)&S&", 'F'}, {"0N)&S)", 'F'}, {"0N)&S;", 'F'}, {"0N)&SB", 'F'}, {"0N)&SC", 'F'}, {"0N)&SF", 'F'}, {"0N)&SO", 'F'}, {"0N)&SU", 'F'}, {"0N)&V", 'F'}, {"0N)&V&", 'F'}, {"0N)&V)", 'F'}, {"0N)&V;", 'F'}, {"0N)&VB", 'F'}, {"0N)&VC", 'F'}, {"0N)&VF", 'F'}, {"0N)&VO", 'F'}, {"0N)&VU", 'F'}, {"0N),(1", 'F'}, {"0N),(F", 'F'}, {"0N),(N", 'F'}, {"0N),(S", 'F'}, {"0N),(V", 'F'}, {"0N);E(", 'F'}, {"0N);E1", 'F'}, {"0N);EF", 'F'}, {"0N);EK", 'F'}, {"0N);EN", 'F'}, {"0N);EO", 'F'}, {"0N);ES", 'F'}, {"0N);EV", 'F'}, {"0N);T(", 'F'}, {"0N);T1", 'F'}, {"0N);TF", 'F'}, {"0N);TK", 'F'}, {"0N);TN", 'F'}, {"0N);TO", 'F'}, {"0N);TS", 'F'}, {"0N);TV", 'F'}, {"0N)B(1", 'F'}, {"0N)B(F", 'F'}, {"0N)B(N", 'F'}, {"0N)B(S", 'F'}, {"0N)B(V", 'F'}, {"0N)B1", 'F'}, {"0N)B1&", 'F'}, {"0N)B1;", 'F'}, {"0N)B1C", 'F'}, {"0N)B1K", 'F'}, {"0N)B1N", 'F'}, {"0N)B1O", 'F'}, {"0N)B1U", 'F'}, {"0N)BF(", 'F'}, {"0N)BN", 'F'}, {"0N)BN&", 'F'}, {"0N)BN;", 'F'}, {"0N)BNC", 'F'}, {"0N)BNK", 'F'}, {"0N)BNO", 'F'}, {"0N)BNU", 'F'}, {"0N)BS", 'F'}, {"0N)BS&", 'F'}, {"0N)BS;", 'F'}, {"0N)BSC", 'F'}, {"0N)BSK", 'F'}, {"0N)BSO", 'F'}, {"0N)BSU", 'F'}, {"0N)BV", 'F'}, {"0N)BV&", 'F'}, {"0N)BV;", 'F'}, {"0N)BVC", 'F'}, {"0N)BVK", 'F'}, {"0N)BVO", 'F'}, {"0N)BVU", 'F'}, {"0N)E(1", 'F'}, {"0N)E(F", 'F'}, {"0N)E(N", 'F'}, {"0N)E(S", 'F'}, {"0N)E(V", 'F'}, {"0N)E1C", 'F'}, {"0N)E1O", 'F'}, {"0N)EF(", 'F'}, {"0N)EK(", 'F'}, {"0N)EK1", 'F'}, {"0N)EKF", 'F'}, {"0N)EKN", 'F'}, {"0N)EKS", 'F'}, {"0N)EKV", 'F'}, {"0N)ENC", 'F'}, {"0N)ENO", 'F'}, {"0N)ESC", 'F'}, {"0N)ESO", 'F'}, {"0N)EVC", 'F'}, {"0N)EVO", 'F'}, {"0N)K(1", 'F'}, {"0N)K(F", 'F'}, {"0N)K(N", 'F'}, {"0N)K(S", 'F'}, {"0N)K(V", 'F'}, {"0N)K1&", 'F'}, {"0N)K1;", 'F'}, {"0N)K1B", 'F'}, {"0N)K1E", 'F'}, {"0N)K1O", 'F'}, {"0N)K1U", 'F'}, {"0N)KB(", 'F'}, {"0N)KB1", 'F'}, {"0N)KBF", 'F'}, {"0N)KBN", 'F'}, {"0N)KBS", 'F'}, {"0N)KBV", 'F'}, {"0N)KF(", 'F'}, {"0N)KN&", 'F'}, {"0N)KN;", 'F'}, {"0N)KNB", 'F'}, {"0N)KNE", 'F'}, {"0N)KNK", 'F'}, {"0N)KNU", 'F'}, {"0N)KS&", 'F'}, {"0N)KS;", 'F'}, {"0N)KSB", 'F'}, {"0N)KSE", 'F'}, {"0N)KSO", 'F'}, {"0N)KSU", 'F'}, {"0N)KUE", 'F'}, {"0N)KV&", 'F'}, {"0N)KV;", 'F'}, {"0N)KVB", 'F'}, {"0N)KVE", 'F'}, {"0N)KVO", 'F'}, {"0N)KVU", 'F'}, {"0N)O(1", 'F'}, {"0N)O(E", 'F'}, {"0N)O(F", 'F'}, {"0N)O(N", 'F'}, {"0N)O(S", 'F'}, {"0N)O(T", 'F'}, {"0N)O(V", 'F'}, {"0N)O1&", 'F'}, {"0N)O1)", 'F'}, {"0N)O1;", 'F'}, {"0N)O1B", 'F'}, {"0N)O1C", 'F'}, {"0N)O1K", 'F'}, {"0N)O1O", 'F'}, {"0N)O1U", 'F'}, {"0N)OF(", 'F'}, {"0N)ON", 'F'}, {"0N)ON&", 'F'}, {"0N)ON)", 'F'}, {"0N)ON;", 'F'}, {"0N)ONB", 'F'}, {"0N)ONC", 'F'}, {"0N)ONK", 'F'}, {"0N)ONO", 'F'}, {"0N)ONU", 'F'}, {"0N)OS", 'F'}, {"0N)OS&", 'F'}, {"0N)OS)", 'F'}, {"0N)OS;", 'F'}, {"0N)OSB", 'F'}, {"0N)OSC", 'F'}, {"0N)OSK", 'F'}, {"0N)OSO", 'F'}, {"0N)OSU", 'F'}, {"0N)OV", 'F'}, {"0N)OV&", 'F'}, {"0N)OV)", 'F'}, {"0N)OV;", 'F'}, {"0N)OVB", 'F'}, {"0N)OVC", 'F'}, {"0N)OVK", 'F'}, {"0N)OVO", 'F'}, {"0N)OVU", 'F'}, {"0N)U(E", 'F'}, {"0N)UE(", 'F'}, {"0N)UE1", 'F'}, {"0N)UEF", 'F'}, {"0N)UEK", 'F'}, {"0N)UEN", 'F'}, {"0N)UES", 'F'}, {"0N)UEV", 'F'}, {"0N,(1)", 'F'}, {"0N,(1O", 'F'}, {"0N,(E(", 'F'}, {"0N,(E1", 'F'}, {"0N,(EF", 'F'}, {"0N,(EK", 'F'}, {"0N,(EN", 'F'}, {"0N,(ES", 'F'}, {"0N,(EV", 'F'}, {"0N,(F(", 'F'}, {"0N,(NO", 'F'}, {"0N,(S)", 'F'}, {"0N,(SO", 'F'}, {"0N,(V)", 'F'}, {"0N,(VO", 'F'}, {"0N,F()", 'F'}, {"0N,F(1", 'F'}, {"0N,F(F", 'F'}, {"0N,F(N", 'F'}, {"0N,F(S", 'F'}, {"0N,F(T", 'F'}, {"0N,F(V", 'F'}, {"0N,V),", 'F'}, {"0N,V)O", 'F'}, {"0N,V,(", 'F'}, {"0N,V,1", 'F'}, {"0N,V,F", 'F'}, {"0N,V,N", 'F'}, {"0N,V,S", 'F'}, {"0N,V,V", 'F'}, {"0N,VB(", 'F'}, {"0N,VB1", 'F'}, {"0N,VBF", 'F'}, {"0N,VBN", 'F'}, {"0N,VBS", 'F'}, {"0N,VBV", 'F'}, {"0N,VO(", 'F'}, {"0N,VOF", 'F'}, {"0N,VOS", 'F'}, {"0N,VUE", 'F'}, {"0N1F()", 'F'}, {"0N1F(1", 'F'}, {"0N1F(F", 'F'}, {"0N1F(N", 'F'}, {"0N1F(S", 'F'}, {"0N1F(V", 'F'}, {"0N1O(1", 'F'}, {"0N1O(F", 'F'}, {"0N1O(N", 'F'}, {"0N1O(S", 'F'}, {"0N1O(V", 'F'}, {"0N1OF(", 'F'}, {"0N1OS(", 'F'}, {"0N1OS1", 'F'}, {"0N1OSF", 'F'}, {"0N1OSO", 'F'}, {"0N1OSU", 'F'}, {"0N1OSV", 'F'}, {"0N1OV(", 'F'}, {"0N1OVF", 'F'}, {"0N1OVO", 'F'}, {"0N1OVS", 'F'}, {"0N1OVU", 'F'}, {"0N1S;", 'F'}, {"0N1S;C", 'F'}, {"0N1SC", 'F'}, {"0N1UE", 'F'}, {"0N1UE;", 'F'}, {"0N1UEC", 'F'}, {"0N1UEK", 'F'}, {"0N1V;", 'F'}, {"0N1V;C", 'F'}, {"0N1VC", 'F'}, {"0N1VO(", 'F'}, {"0N1VOF", 'F'}, {"0N1VOS", 'F'}, {"0N;E(1", 'F'}, {"0N;E(E", 'F'}, {"0N;E(F", 'F'}, {"0N;E(N", 'F'}, {"0N;E(S", 'F'}, {"0N;E(V", 'F'}, {"0N;E1,", 'F'}, {"0N;E1;", 'F'}, {"0N;E1C", 'F'}, {"0N;E1K", 'F'}, {"0N;E1O", 'F'}, {"0N;E1T", 'F'}, {"0N;EF(", 'F'}, {"0N;EK(", 'F'}, {"0N;EK1", 'F'}, {"0N;EKF", 'F'}, {"0N;EKN", 'F'}, {"0N;EKO", 'F'}, {"0N;EKS", 'F'}, {"0N;EKV", 'F'}, {"0N;EN,", 'F'}, {"0N;EN;", 'F'}, {"0N;ENC", 'F'}, {"0N;ENE", 'F'}, {"0N;ENK", 'F'}, {"0N;ENO", 'F'}, {"0N;ENT", 'F'}, {"0N;EO(", 'F'}, {"0N;ES,", 'F'}, {"0N;ES;", 'F'}, {"0N;ESC", 'F'}, {"0N;ESK", 'F'}, {"0N;ESO", 'F'}, {"0N;EST", 'F'}, {"0N;EV,", 'F'}, {"0N;EV;", 'F'}, {"0N;EVC", 'F'}, {"0N;EVK", 'F'}, {"0N;EVO", 'F'}, {"0N;EVT", 'F'}, {"0N;N:T", 'F'}, {"0N;T(1", 'F'}, {"0N;T(E", 'F'}, {"0N;T(F", 'F'}, {"0N;T(N", 'F'}, {"0N;T(S", 'F'}, {"0N;T(V", 'F'}, {"0N;T1,", 'F'}, {"0N;T1;", 'F'}, {"0N;T1C", 'F'}, {"0N;T1F", 'F'}, {"0N;T1K", 'F'}, {"0N;T1O", 'F'}, {"0N;T1T", 'F'}, {"0N;T;", 'F'}, {"0N;T;C", 'F'}, {"0N;TF(", 'F'}, {"0N;TK(", 'F'}, {"0N;TK1", 'F'}, {"0N;TKF", 'F'}, {"0N;TKK", 'F'}, {"0N;TKN", 'F'}, {"0N;TKO", 'F'}, {"0N;TKS", 'F'}, {"0N;TKV", 'F'}, {"0N;TN(", 'F'}, {"0N;TN,", 'F'}, {"0N;TN1", 'F'}, {"0N;TN;", 'F'}, {"0N;TNC", 'F'}, {"0N;TNE", 'F'}, {"0N;TNF", 'F'}, {"0N;TNK", 'F'}, {"0N;TNN", 'F'}, {"0N;TNO", 'F'}, {"0N;TNS", 'F'}, {"0N;TNT", 'F'}, {"0N;TNV", 'F'}, {"0N;TO(", 'F'}, {"0N;TS,", 'F'}, {"0N;TS;", 'F'}, {"0N;TSC", 'F'}, {"0N;TSF", 'F'}, {"0N;TSK", 'F'}, {"0N;TSO", 'F'}, {"0N;TST", 'F'}, {"0N;TT(", 'F'}, {"0N;TT1", 'F'}, {"0N;TTF", 'F'}, {"0N;TTN", 'F'}, {"0N;TTS", 'F'}, {"0N;TTV", 'F'}, {"0N;TV,", 'F'}, {"0N;TV;", 'F'}, {"0N;TVC", 'F'}, {"0N;TVF", 'F'}, {"0N;TVK", 'F'}, {"0N;TVO", 'F'}, {"0N;TVT", 'F'}, {"0NA(F(", 'F'}, {"0NA(N)", 'F'}, {"0NA(NO", 'F'}, {"0NA(S)", 'F'}, {"0NA(SO", 'F'}, {"0NA(V)", 'F'}, {"0NA(VO", 'F'}, {"0NAF()", 'F'}, {"0NAF(1", 'F'}, {"0NAF(F", 'F'}, {"0NAF(N", 'F'}, {"0NAF(S", 'F'}, {"0NAF(V", 'F'}, {"0NASO(", 'F'}, {"0NASO1", 'F'}, {"0NASOF", 'F'}, {"0NASON", 'F'}, {"0NASOS", 'F'}, {"0NASOV", 'F'}, {"0NASUE", 'F'}, {"0NATO(", 'F'}, {"0NATO1", 'F'}, {"0NATOF", 'F'}, {"0NATON", 'F'}, {"0NATOS", 'F'}, {"0NATOV", 'F'}, {"0NATUE", 'F'}, {"0NAVO(", 'F'}, {"0NAVOF", 'F'}, {"0NAVOS", 'F'}, {"0NAVUE", 'F'}, {"0NB(1)", 'F'}, {"0NB(1O", 'F'}, {"0NB(F(", 'F'}, {"0NB(N)", 'F'}, {"0NB(NO", 'F'}, {"0NB(S)", 'F'}, {"0NB(SO", 'F'}, {"0NB(V)", 'F'}, {"0NB(VO", 'F'}, {"0NB1", 'F'}, {"0NB1&(", 'F'}, {"0NB1&1", 'F'}, {"0NB1&F", 'F'}, {"0NB1&N", 'F'}, {"0NB1&S", 'F'}, {"0NB1&V", 'F'}, {"0NB1,(", 'F'}, {"0NB1,F", 'F'}, {"0NB1,V", 'F'}, {"0NB1;", 'F'}, {"0NB1;C", 'F'}, {"0NB1B(", 'F'}, {"0NB1B1", 'F'}, {"0NB1BF", 'F'}, {"0NB1BN", 'F'}, {"0NB1BS", 'F'}, {"0NB1BV", 'F'}, {"0NB1C", 'F'}, {"0NB1K(", 'F'}, {"0NB1K1", 'F'}, {"0NB1KF", 'F'}, {"0NB1KN", 'F'}, {"0NB1KS", 'F'}, {"0NB1KV", 'F'}, {"0NB1O(", 'F'}, {"0NB1OF", 'F'}, {"0NB1OS", 'F'}, {"0NB1OV", 'F'}, {"0NB1U(", 'F'}, {"0NB1UE", 'F'}, {"0NBE(1", 'F'}, {"0NBE(F", 'F'}, {"0NBE(N", 'F'}, {"0NBE(S", 'F'}, {"0NBE(V", 'F'}, {"0NBEK(", 'F'}, {"0NBF()", 'F'}, {"0NBF(1", 'F'}, {"0NBF(F", 'F'}, {"0NBF(N", 'F'}, {"0NBF(S", 'F'}, {"0NBF(V", 'F'}, {"0NBN&(", 'F'}, {"0NBN&1", 'F'}, {"0NBN&F", 'F'}, {"0NBN&N", 'F'}, {"0NBN&S", 'F'}, {"0NBN&V", 'F'}, {"0NBN,(", 'F'}, {"0NBN,F", 'F'}, {"0NBN,V", 'F'}, {"0NBN;", 'F'}, {"0NBN;C", 'F'}, {"0NBNB(", 'F'}, {"0NBNB1", 'F'}, {"0NBNBF", 'F'}, {"0NBNBN", 'F'}, {"0NBNBS", 'F'}, {"0NBNBV", 'F'}, {"0NBNC", 'F'}, {"0NBNK(", 'F'}, {"0NBNK1", 'F'}, {"0NBNKF", 'F'}, {"0NBNKN", 'F'}, {"0NBNKS", 'F'}, {"0NBNKV", 'F'}, {"0NBNO(", 'F'}, {"0NBNOF", 'F'}, {"0NBNOS", 'F'}, {"0NBNOV", 'F'}, {"0NBNU(", 'F'}, {"0NBNUE", 'F'}, {"0NBS", 'F'}, {"0NBS&(", 'F'}, {"0NBS&1", 'F'}, {"0NBS&F", 'F'}, {"0NBS&N", 'F'}, {"0NBS&S", 'F'}, {"0NBS&V", 'F'}, {"0NBS,(", 'F'}, {"0NBS,F", 'F'}, {"0NBS,V", 'F'}, {"0NBS;", 'F'}, {"0NBS;C", 'F'}, {"0NBSB(", 'F'}, {"0NBSB1", 'F'}, {"0NBSBF", 'F'}, {"0NBSBN", 'F'}, {"0NBSBS", 'F'}, {"0NBSBV", 'F'}, {"0NBSC", 'F'}, {"0NBSK(", 'F'}, {"0NBSK1", 'F'}, {"0NBSKF", 'F'}, {"0NBSKN", 'F'}, {"0NBSKS", 'F'}, {"0NBSKV", 'F'}, {"0NBSO(", 'F'}, {"0NBSO1", 'F'}, {"0NBSOF", 'F'}, {"0NBSON", 'F'}, {"0NBSOS", 'F'}, {"0NBSOV", 'F'}, {"0NBSU(", 'F'}, {"0NBSUE", 'F'}, {"0NBV", 'F'}, {"0NBV&(", 'F'}, {"0NBV&1", 'F'}, {"0NBV&F", 'F'}, {"0NBV&N", 'F'}, {"0NBV&S", 'F'}, {"0NBV&V", 'F'}, {"0NBV,(", 'F'}, {"0NBV,1", 'F'}, {"0NBV,F", 'F'}, {"0NBV,N", 'F'}, {"0NBV,S", 'F'}, {"0NBV,V", 'F'}, {"0NBV;", 'F'}, {"0NBV;C", 'F'}, {"0NBVB(", 'F'}, {"0NBVB1", 'F'}, {"0NBVBF", 'F'}, {"0NBVBN", 'F'}, {"0NBVBS", 'F'}, {"0NBVBV", 'F'}, {"0NBVC", 'F'}, {"0NBVK(", 'F'}, {"0NBVK1", 'F'}, {"0NBVKF", 'F'}, {"0NBVKN", 'F'}, {"0NBVKS", 'F'}, {"0NBVKV", 'F'}, {"0NBVO(", 'F'}, {"0NBVOF", 'F'}, {"0NBVOS", 'F'}, {"0NBVU(", 'F'}, {"0NBVUE", 'F'}, {"0NC", 'F'}, {"0NE(1)", 'F'}, {"0NE(1O", 'F'}, {"0NE(F(", 'F'}, {"0NE(N)", 'F'}, {"0NE(NO", 'F'}, {"0NE(S)", 'F'}, {"0NE(SO", 'F'}, {"0NE(V)", 'F'}, {"0NE(VO", 'F'}, {"0NE1C", 'F'}, {"0NE1O(", 'F'}, {"0NE1OF", 'F'}, {"0NE1OS", 'F'}, {"0NE1OV", 'F'}, {"0NE1UE", 'F'}, {"0NEF()", 'F'}, {"0NEF(1", 'F'}, {"0NEF(F", 'F'}, {"0NEF(N", 'F'}, {"0NEF(S", 'F'}, {"0NEF(V", 'F'}, {"0NENC", 'F'}, {"0NENO(", 'F'}, {"0NENOF", 'F'}, {"0NENOS", 'F'}, {"0NENOV", 'F'}, {"0NENUE", 'F'}, {"0NEOKN", 'F'}, {"0NESC", 'F'}, {"0NESO(", 'F'}, {"0NESO1", 'F'}, {"0NESOF", 'F'}, {"0NESON", 'F'}, {"0NESOS", 'F'}, {"0NESOV", 'F'}, {"0NESUE", 'F'}, {"0NEU(1", 'F'}, {"0NEU(F", 'F'}, {"0NEU(N", 'F'}, {"0NEU(S", 'F'}, {"0NEU(V", 'F'}, {"0NEU1,", 'F'}, {"0NEU1C", 'F'}, {"0NEU1O", 'F'}, {"0NEUEF", 'F'}, {"0NEUEK", 'F'}, {"0NEUF(", 'F'}, {"0NEUN,", 'F'}, {"0NEUNC", 'F'}, {"0NEUNO", 'F'}, {"0NEUS,", 'F'}, {"0NEUSC", 'F'}, {"0NEUSO", 'F'}, {"0NEUV,", 'F'}, {"0NEUVC", 'F'}, {"0NEUVO", 'F'}, {"0NEVC", 'F'}, {"0NEVO(", 'F'}, {"0NEVOF", 'F'}, {"0NEVOS", 'F'}, {"0NEVUE", 'F'}, {"0NF()1", 'F'}, {"0NF()F", 'F'}, {"0NF()K", 'F'}, {"0NF()N", 'F'}, {"0NF()O", 'F'}, {"0NF()S", 'F'}, {"0NF()U", 'F'}, {"0NF()V", 'F'}, {"0NF(1)", 'F'}, {"0NF(1N", 'F'}, {"0NF(1O", 'F'}, {"0NF(E(", 'F'}, {"0NF(E1", 'F'}, {"0NF(EF", 'F'}, {"0NF(EK", 'F'}, {"0NF(EN", 'F'}, {"0NF(ES", 'F'}, {"0NF(EV", 'F'}, {"0NF(F(", 'F'}, {"0NF(N)", 'F'}, {"0NF(N,", 'F'}, {"0NF(NO", 'F'}, {"0NF(S)", 'F'}, {"0NF(SO", 'F'}, {"0NF(V)", 'F'}, {"0NF(VO", 'F'}, {"0NK(1)", 'F'}, {"0NK(1O", 'F'}, {"0NK(F(", 'F'}, {"0NK(N)", 'F'}, {"0NK(NO", 'F'}, {"0NK(S)", 'F'}, {"0NK(SO", 'F'}, {"0NK(V)", 'F'}, {"0NK(VO", 'F'}, {"0NK)&(", 'F'}, {"0NK)&1", 'F'}, {"0NK)&F", 'F'}, {"0NK)&N", 'F'}, {"0NK)&S", 'F'}, {"0NK)&V", 'F'}, {"0NK);E", 'F'}, {"0NK);T", 'F'}, {"0NK)B(", 'F'}, {"0NK)B1", 'F'}, {"0NK)BF", 'F'}, {"0NK)BN", 'F'}, {"0NK)BS", 'F'}, {"0NK)BV", 'F'}, {"0NK)E(", 'F'}, {"0NK)E1", 'F'}, {"0NK)EF", 'F'}, {"0NK)EK", 'F'}, {"0NK)EN", 'F'}, {"0NK)ES", 'F'}, {"0NK)EV", 'F'}, {"0NK)OF", 'F'}, {"0NK)UE", 'F'}, {"0NK1", 'F'}, {"0NK1&(", 'F'}, {"0NK1&1", 'F'}, {"0NK1&F", 'F'}, {"0NK1&N", 'F'}, {"0NK1&S", 'F'}, {"0NK1&V", 'F'}, {"0NK1;C", 'F'}, {"0NK1;E", 'F'}, {"0NK1;T", 'F'}, {"0NK1B(", 'F'}, {"0NK1B1", 'F'}, {"0NK1BF", 'F'}, {"0NK1BN", 'F'}, {"0NK1BS", 'F'}, {"0NK1BV", 'F'}, {"0NK1C", 'F'}, {"0NK1E(", 'F'}, {"0NK1E1", 'F'}, {"0NK1EF", 'F'}, {"0NK1EK", 'F'}, {"0NK1EN", 'F'}, {"0NK1ES", 'F'}, {"0NK1EV", 'F'}, {"0NK1O(", 'F'}, {"0NK1OF", 'F'}, {"0NK1OS", 'F'}, {"0NK1OV", 'F'}, {"0NK1U(", 'F'}, {"0NK1UE", 'F'}, {"0NKF()", 'F'}, {"0NKF(1", 'F'}, {"0NKF(F", 'F'}, {"0NKF(N", 'F'}, {"0NKF(S", 'F'}, {"0NKF(V", 'F'}, {"0NKN", 'F'}, {"0NKN&(", 'F'}, {"0NKN&1", 'F'}, {"0NKN&F", 'F'}, {"0NKN&S", 'F'}, {"0NKN&V", 'F'}, {"0NKN;C", 'F'}, {"0NKN;E", 'F'}, {"0NKN;T", 'F'}, {"0NKNB(", 'F'}, {"0NKNB1", 'F'}, {"0NKNBF", 'F'}, {"0NKNBN", 'F'}, {"0NKNBS", 'F'}, {"0NKNBV", 'F'}, {"0NKNC", 'F'}, {"0NKNE(", 'F'}, {"0NKNE1", 'F'}, {"0NKNEF", 'F'}, {"0NKNES", 'F'}, {"0NKNEV", 'F'}, {"0NKNU(", 'F'}, {"0NKNUE", 'F'}, {"0NKS", 'F'}, {"0NKS&(", 'F'}, {"0NKS&1", 'F'}, {"0NKS&F", 'F'}, {"0NKS&N", 'F'}, {"0NKS&S", 'F'}, {"0NKS&V", 'F'}, {"0NKS;", 'F'}, {"0NKS;C", 'F'}, {"0NKS;E", 'F'}, {"0NKS;T", 'F'}, {"0NKSB(", 'F'}, {"0NKSB1", 'F'}, {"0NKSBF", 'F'}, {"0NKSBN", 'F'}, {"0NKSBS", 'F'}, {"0NKSBV", 'F'}, {"0NKSC", 'F'}, {"0NKSE(", 'F'}, {"0NKSE1", 'F'}, {"0NKSEF", 'F'}, {"0NKSEK", 'F'}, {"0NKSEN", 'F'}, {"0NKSES", 'F'}, {"0NKSEV", 'F'}, {"0NKSO(", 'F'}, {"0NKSO1", 'F'}, {"0NKSOF", 'F'}, {"0NKSON", 'F'}, {"0NKSOS", 'F'}, {"0NKSOV", 'F'}, {"0NKSU(", 'F'}, {"0NKSUE", 'F'}, {"0NKUE(", 'F'}, {"0NKUE1", 'F'}, {"0NKUEF", 'F'}, {"0NKUEK", 'F'}, {"0NKUEN", 'F'}, {"0NKUES", 'F'}, {"0NKUEV", 'F'}, {"0NKV", 'F'}, {"0NKV&(", 'F'}, {"0NKV&1", 'F'}, {"0NKV&F", 'F'}, {"0NKV&N", 'F'}, {"0NKV&S", 'F'}, {"0NKV&V", 'F'}, {"0NKV;", 'F'}, {"0NKV;C", 'F'}, {"0NKV;E", 'F'}, {"0NKV;T", 'F'}, {"0NKVB(", 'F'}, {"0NKVB1", 'F'}, {"0NKVBF", 'F'}, {"0NKVBN", 'F'}, {"0NKVBS", 'F'}, {"0NKVBV", 'F'}, {"0NKVC", 'F'}, {"0NKVE(", 'F'}, {"0NKVE1", 'F'}, {"0NKVEF", 'F'}, {"0NKVEK", 'F'}, {"0NKVEN", 'F'}, {"0NKVES", 'F'}, {"0NKVEV", 'F'}, {"0NKVO(", 'F'}, {"0NKVOF", 'F'}, {"0NKVOS", 'F'}, {"0NKVU(", 'F'}, {"0NKVUE", 'F'}, {"0NO(1&", 'F'}, {"0NO(1)", 'F'}, {"0NO(1,", 'F'}, {"0NO(1O", 'F'}, {"0NO(E(", 'F'}, {"0NO(E1", 'F'}, {"0NO(EE", 'F'}, {"0NO(EF", 'F'}, {"0NO(EK", 'F'}, {"0NO(EN", 'F'}, {"0NO(ES", 'F'}, {"0NO(ET", 'F'}, {"0NO(EV", 'F'}, {"0NO(F(", 'F'}, {"0NO(N&", 'F'}, {"0NO(N)", 'F'}, {"0NO(N,", 'F'}, {"0NO(NO", 'F'}, {"0NO(O(", 'F'}, {"0NO(O1", 'F'}, {"0NO(OF", 'F'}, {"0NO(ON", 'F'}, {"0NO(OS", 'F'}, {"0NO(OV", 'F'}, {"0NO(S&", 'F'}, {"0NO(S)", 'F'}, {"0NO(S,", 'F'}, {"0NO(SO", 'F'}, {"0NO(T(", 'F'}, {"0NO(V&", 'F'}, {"0NO(V)", 'F'}, {"0NO(V,", 'F'}, {"0NO(VO", 'F'}, {"0NOF()", 'F'}, {"0NOF(1", 'F'}, {"0NOF(E", 'F'}, {"0NOF(F", 'F'}, {"0NOF(N", 'F'}, {"0NOF(S", 'F'}, {"0NOF(T", 'F'}, {"0NOF(V", 'F'}, {"0NOK&(", 'F'}, {"0NOK&1", 'F'}, {"0NOK&F", 'F'}, {"0NOK&N", 'F'}, {"0NOK&S", 'F'}, {"0NOK&V", 'F'}, {"0NOK(1", 'F'}, {"0NOK(F", 'F'}, {"0NOK(N", 'F'}, {"0NOK(S", 'F'}, {"0NOK(V", 'F'}, {"0NOK1C", 'F'}, {"0NOK1O", 'F'}, {"0NOKF(", 'F'}, {"0NOKNC", 'F'}, {"0NOKO(", 'F'}, {"0NOKO1", 'F'}, {"0NOKOF", 'F'}, {"0NOKON", 'F'}, {"0NOKOS", 'F'}, {"0NOKOV", 'F'}, {"0NOKSC", 'F'}, {"0NOKSO", 'F'}, {"0NOKVC", 'F'}, {"0NOKVO", 'F'}, {"0NONSU", 'F'}, {"0NOS&(", 'F'}, {"0NOS&1", 'F'}, {"0NOS&E", 'F'}, {"0NOS&F", 'F'}, {"0NOS&K", 'F'}, {"0NOS&N", 'F'}, {"0NOS&S", 'F'}, {"0NOS&T", 'F'}, {"0NOS&U", 'F'}, {"0NOS&V", 'F'}, {"0NOS(E", 'F'}, {"0NOS(U", 'F'}, {"0NOS)&", 'F'}, {"0NOS),", 'F'}, {"0NOS);", 'F'}, {"0NOS)B", 'F'}, {"0NOS)C", 'F'}, {"0NOS)E", 'F'}, {"0NOS)K", 'F'}, {"0NOS)O", 'F'}, {"0NOS)U", 'F'}, {"0NOS,(", 'F'}, {"0NOS,F", 'F'}, {"0NOS,V", 'F'}, {"0NOS1(", 'F'}, {"0NOS1F", 'F'}, {"0NOS1N", 'F'}, {"0NOS1O", 'F'}, {"0NOS1S", 'F'}, {"0NOS1U", 'F'}, {"0NOS1V", 'F'}, {"0NOS;", 'F'}, {"0NOS;C", 'F'}, {"0NOS;E", 'F'}, {"0NOS;T", 'F'}, {"0NOSA(", 'F'}, {"0NOSAF", 'F'}, {"0NOSAS", 'F'}, {"0NOSAT", 'F'}, {"0NOSAV", 'F'}, {"0NOSB(", 'F'}, {"0NOSB1", 'F'}, {"0NOSBE", 'F'}, {"0NOSBF", 'F'}, {"0NOSBN", 'F'}, {"0NOSBS", 'F'}, {"0NOSBV", 'F'}, {"0NOSC", 'F'}, {"0NOSE(", 'F'}, {"0NOSE1", 'F'}, {"0NOSEF", 'F'}, {"0NOSEK", 'F'}, {"0NOSEN", 'F'}, {"0NOSEO", 'F'}, {"0NOSES", 'F'}, {"0NOSEU", 'F'}, {"0NOSEV", 'F'}, {"0NOSF(", 'F'}, {"0NOSK(", 'F'}, {"0NOSK)", 'F'}, {"0NOSK1", 'F'}, {"0NOSKB", 'F'}, {"0NOSKF", 'F'}, {"0NOSKN", 'F'}, {"0NOSKS", 'F'}, {"0NOSKU", 'F'}, {"0NOSKV", 'F'}, {"0NOSO(", 'F'}, {"0NOSO1", 'F'}, {"0NOSOF", 'F'}, {"0NOSOK", 'F'}, {"0NOSON", 'F'}, {"0NOSOS", 'F'}, {"0NOSOT", 'F'}, {"0NOSOU", 'F'}, {"0NOSOV", 'F'}, {"0NOSU", 'F'}, {"0NOSU(", 'F'}, {"0NOSU1", 'F'}, {"0NOSU;", 'F'}, {"0NOSUC", 'F'}, {"0NOSUE", 'F'}, {"0NOSUF", 'F'}, {"0NOSUK", 'F'}, {"0NOSUN", 'F'}, {"0NOSUO", 'F'}, {"0NOSUS", 'F'}, {"0NOSUT", 'F'}, {"0NOSUV", 'F'}, {"0NOSV(", 'F'}, {"0NOSVF", 'F'}, {"0NOSVO", 'F'}, {"0NOSVS", 'F'}, {"0NOSVU", 'F'}, {"0NOT(1", 'F'}, {"0NOT(E", 'F'}, {"0NOT(F", 'F'}, {"0NOT(N", 'F'}, {"0NOT(S", 'F'}, {"0NOT(T", 'F'}, {"0NOT(V", 'F'}, {"0NOU(E", 'F'}, {"0NOUEK", 'F'}, {"0NOUEN", 'F'}, {"0NOV&(", 'F'}, {"0NOV&1", 'F'}, {"0NOV&E", 'F'}, {"0NOV&F", 'F'}, {"0NOV&K", 'F'}, {"0NOV&N", 'F'}, {"0NOV&S", 'F'}, {"0NOV&T", 'F'}, {"0NOV&U", 'F'}, {"0NOV&V", 'F'}, {"0NOV(E", 'F'}, {"0NOV(U", 'F'}, {"0NOV)&", 'F'}, {"0NOV),", 'F'}, {"0NOV);", 'F'}, {"0NOV)B", 'F'}, {"0NOV)C", 'F'}, {"0NOV)E", 'F'}, {"0NOV)K", 'F'}, {"0NOV)O", 'F'}, {"0NOV)U", 'F'}, {"0NOV,(", 'F'}, {"0NOV,1", 'F'}, {"0NOV,F", 'F'}, {"0NOV,N", 'F'}, {"0NOV,S", 'F'}, {"0NOV,V", 'F'}, {"0NOV;", 'F'}, {"0NOV;C", 'F'}, {"0NOV;E", 'F'}, {"0NOV;N", 'F'}, {"0NOV;T", 'F'}, {"0NOVA(", 'F'}, {"0NOVAF", 'F'}, {"0NOVAS", 'F'}, {"0NOVAT", 'F'}, {"0NOVAV", 'F'}, {"0NOVB(", 'F'}, {"0NOVB1", 'F'}, {"0NOVBE", 'F'}, {"0NOVBF", 'F'}, {"0NOVBN", 'F'}, {"0NOVBS", 'F'}, {"0NOVBV", 'F'}, {"0NOVC", 'F'}, {"0NOVE(", 'F'}, {"0NOVE1", 'F'}, {"0NOVEF", 'F'}, {"0NOVEK", 'F'}, {"0NOVEN", 'F'}, {"0NOVEO", 'F'}, {"0NOVES", 'F'}, {"0NOVEU", 'F'}, {"0NOVEV", 'F'}, {"0NOVF(", 'F'}, {"0NOVK(", 'F'}, {"0NOVK)", 'F'}, {"0NOVK1", 'F'}, {"0NOVKB", 'F'}, {"0NOVKF", 'F'}, {"0NOVKN", 'F'}, {"0NOVKS", 'F'}, {"0NOVKU", 'F'}, {"0NOVKV", 'F'}, {"0NOVO(", 'F'}, {"0NOVOF", 'F'}, {"0NOVOK", 'F'}, {"0NOVOS", 'F'}, {"0NOVOT", 'F'}, {"0NOVOU", 'F'}, {"0NOVS(", 'F'}, {"0NOVS1", 'F'}, {"0NOVSF", 'F'}, {"0NOVSO", 'F'}, {"0NOVSU", 'F'}, {"0NOVSV", 'F'}, {"0NOVU", 'F'}, {"0NOVU(", 'F'}, {"0NOVU1", 'F'}, {"0NOVU;", 'F'}, {"0NOVUC", 'F'}, {"0NOVUE", 'F'}, {"0NOVUF", 'F'}, {"0NOVUK", 'F'}, {"0NOVUN", 'F'}, {"0NOVUO", 'F'}, {"0NOVUS", 'F'}, {"0NOVUT", 'F'}, {"0NOVUV", 'F'}, {"0NSO1U", 'F'}, {"0NSONU", 'F'}, {"0NSOSU", 'F'}, {"0NSOVU", 'F'}, {"0NSUE", 'F'}, {"0NSUE;", 'F'}, {"0NSUEC", 'F'}, {"0NSUEK", 'F'}, {"0NU(1)", 'F'}, {"0NU(1O", 'F'}, {"0NU(E(", 'F'}, {"0NU(E1", 'F'}, {"0NU(EF", 'F'}, {"0NU(EK", 'F'}, {"0NU(EN", 'F'}, {"0NU(ES", 'F'}, {"0NU(EV", 'F'}, {"0NU(F(", 'F'}, {"0NU(N)", 'F'}, {"0NU(NO", 'F'}, {"0NU(S)", 'F'}, {"0NU(SO", 'F'}, {"0NU(V)", 'F'}, {"0NU(VO", 'F'}, {"0NU1,(", 'F'}, {"0NU1,F", 'F'}, {"0NU1,V", 'F'}, {"0NU1C", 'F'}, {"0NU1O(", 'F'}, {"0NU1OF", 'F'}, {"0NU1OS", 'F'}, {"0NU1OV", 'F'}, {"0NU;", 'F'}, {"0NU;C", 'F'}, {"0NUC", 'F'}, {"0NUE", 'F'}, {"0NUE(1", 'F'}, {"0NUE(E", 'F'}, {"0NUE(F", 'F'}, {"0NUE(N", 'F'}, {"0NUE(O", 'F'}, {"0NUE(S", 'F'}, {"0NUE(V", 'F'}, {"0NUE1", 'F'}, {"0NUE1&", 'F'}, {"0NUE1(", 'F'}, {"0NUE1)", 'F'}, {"0NUE1,", 'F'}, {"0NUE1;", 'F'}, {"0NUE1B", 'F'}, {"0NUE1C", 'F'}, {"0NUE1F", 'F'}, {"0NUE1K", 'F'}, {"0NUE1N", 'F'}, {"0NUE1O", 'F'}, {"0NUE1S", 'F'}, {"0NUE1U", 'F'}, {"0NUE1V", 'F'}, {"0NUE;", 'F'}, {"0NUE;C", 'F'}, {"0NUEC", 'F'}, {"0NUEF", 'F'}, {"0NUEF(", 'F'}, {"0NUEF,", 'F'}, {"0NUEF;", 'F'}, {"0NUEFC", 'F'}, {"0NUEK", 'F'}, {"0NUEK(", 'F'}, {"0NUEK1", 'F'}, {"0NUEK;", 'F'}, {"0NUEKC", 'F'}, {"0NUEKF", 'F'}, {"0NUEKN", 'F'}, {"0NUEKO", 'F'}, {"0NUEKS", 'F'}, {"0NUEKV", 'F'}, {"0NUEN", 'F'}, {"0NUEN&", 'F'}, {"0NUEN(", 'F'}, {"0NUEN)", 'F'}, {"0NUEN,", 'F'}, {"0NUEN1", 'F'}, {"0NUEN;", 'F'}, {"0NUENB", 'F'}, {"0NUENC", 'F'}, {"0NUENF", 'F'}, {"0NUENK", 'F'}, {"0NUENO", 'F'}, {"0NUENS", 'F'}, {"0NUENU", 'F'}, {"0NUEOK", 'F'}, {"0NUEON", 'F'}, {"0NUEOO", 'F'}, {"0NUES", 'F'}, {"0NUES&", 'F'}, {"0NUES(", 'F'}, {"0NUES)", 'F'}, {"0NUES,", 'F'}, {"0NUES1", 'F'}, {"0NUES;", 'F'}, {"0NUESB", 'F'}, {"0NUESC", 'F'}, {"0NUESF", 'F'}, {"0NUESK", 'F'}, {"0NUESO", 'F'}, {"0NUESU", 'F'}, {"0NUESV", 'F'}, {"0NUEV", 'F'}, {"0NUEV&", 'F'}, {"0NUEV(", 'F'}, {"0NUEV)", 'F'}, {"0NUEV,", 'F'}, {"0NUEV;", 'F'}, {"0NUEVB", 'F'}, {"0NUEVC", 'F'}, {"0NUEVF", 'F'}, {"0NUEVK", 'F'}, {"0NUEVN", 'F'}, {"0NUEVO", 'F'}, {"0NUEVS", 'F'}, {"0NUEVU", 'F'}, {"0NUF()", 'F'}, {"0NUF(1", 'F'}, {"0NUF(F", 'F'}, {"0NUF(N", 'F'}, {"0NUF(S", 'F'}, {"0NUF(V", 'F'}, {"0NUK(E", 'F'}, {"0NUN(1", 'F'}, {"0NUN(F", 'F'}, {"0NUN(S", 'F'}, {"0NUN(V", 'F'}, {"0NUN,(", 'F'}, {"0NUN,F", 'F'}, {"0NUN,V", 'F'}, {"0NUN1(", 'F'}, {"0NUN1,", 'F'}, {"0NUN1O", 'F'}, {"0NUNC", 'F'}, {"0NUNE(", 'F'}, {"0NUNE1", 'F'}, {"0NUNEF", 'F'}, {"0NUNEN", 'F'}, {"0NUNES", 'F'}, {"0NUNEV", 'F'}, {"0NUNF(", 'F'}, {"0NUNO(", 'F'}, {"0NUNOF", 'F'}, {"0NUNOS", 'F'}, {"0NUNOV", 'F'}, {"0NUNS(", 'F'}, {"0NUNS,", 'F'}, {"0NUNSO", 'F'}, {"0NUO(E", 'F'}, {"0NUON(", 'F'}, {"0NUON1", 'F'}, {"0NUONF", 'F'}, {"0NUONS", 'F'}, {"0NUS,(", 'F'}, {"0NUS,F", 'F'}, {"0NUS,V", 'F'}, {"0NUSC", 'F'}, {"0NUSO(", 'F'}, {"0NUSO1", 'F'}, {"0NUSOF", 'F'}, {"0NUSON", 'F'}, {"0NUSOS", 'F'}, {"0NUSOV", 'F'}, {"0NUTN(", 'F'}, {"0NUTN1", 'F'}, {"0NUTNF", 'F'}, {"0NUTNS", 'F'}, {"0NUV,(", 'F'}, {"0NUV,1", 'F'}, {"0NUV,F", 'F'}, {"0NUV,N", 'F'}, {"0NUV,S", 'F'}, {"0NUV,V", 'F'}, {"0NUVC", 'F'}, {"0NUVO(", 'F'}, {"0NUVOF", 'F'}, {"0NUVOS", 'F'}, {"0O(1)O", 'F'}, {"0O(1)U", 'F'}, {"0O(1O(", 'F'}, {"0O(1OF", 'F'}, {"0O(1OS", 'F'}, {"0O(1OV", 'F'}, {"0O(F()", 'F'}, {"0O(F(1", 'F'}, {"0O(F(F", 'F'}, {"0O(F(N", 'F'}, {"0O(F(S", 'F'}, {"0O(F(V", 'F'}, {"0O(N)O", 'F'}, {"0O(N)U", 'F'}, {"0O(NO(", 'F'}, {"0O(NOF", 'F'}, {"0O(NOS", 'F'}, {"0O(NOV", 'F'}, {"0O(S)O", 'F'}, {"0O(S)U", 'F'}, {"0O(SO(", 'F'}, {"0O(SO1", 'F'}, {"0O(SOF", 'F'}, {"0O(SON", 'F'}, {"0O(SOS", 'F'}, {"0O(SOV", 'F'}, {"0O(V)O", 'F'}, {"0O(V)U", 'F'}, {"0O(VO(", 'F'}, {"0O(VOF", 'F'}, {"0O(VOS", 'F'}, {"0O1O(1", 'F'}, {"0O1O(F", 'F'}, {"0O1O(N", 'F'}, {"0O1O(S", 'F'}, {"0O1O(V", 'F'}, {"0O1OF(", 'F'}, {"0O1OSO", 'F'}, {"0O1OSU", 'F'}, {"0O1OVO", 'F'}, {"0O1OVU", 'F'}, {"0O1UE(", 'F'}, {"0O1UE1", 'F'}, {"0O1UEF", 'F'}, {"0O1UEK", 'F'}, {"0O1UEN", 'F'}, {"0O1UES", 'F'}, {"0O1UEV", 'F'}, {"0OF()O", 'F'}, {"0OF()U", 'F'}, {"0OF(1)", 'F'}, {"0OF(1O", 'F'}, {"0OF(F(", 'F'}, {"0OF(N)", 'F'}, {"0OF(NO", 'F'}, {"0OF(S)", 'F'}, {"0OF(SO", 'F'}, {"0OF(V)", 'F'}, {"0OF(VO", 'F'}, {"0ONO(1", 'F'}, {"0ONO(F", 'F'}, {"0ONO(N", 'F'}, {"0ONO(S", 'F'}, {"0ONO(V", 'F'}, {"0ONOF(", 'F'}, {"0ONOSO", 'F'}, {"0ONOSU", 'F'}, {"0ONOVO", 'F'}, {"0ONOVU", 'F'}, {"0ONUE(", 'F'}, {"0ONUE1", 'F'}, {"0ONUEF", 'F'}, {"0ONUEK", 'F'}, {"0ONUEN", 'F'}, {"0ONUES", 'F'}, {"0ONUEV", 'F'}, {"0OSO(1", 'F'}, {"0OSO(F", 'F'}, {"0OSO(N", 'F'}, {"0OSO(S", 'F'}, {"0OSO(V", 'F'}, {"0OSO1O", 'F'}, {"0OSO1U", 'F'}, {"0OSOF(", 'F'}, {"0OSONO", 'F'}, {"0OSONU", 'F'}, {"0OSOSO", 'F'}, {"0OSOSU", 'F'}, {"0OSOVO", 'F'}, {"0OSOVU", 'F'}, {"0OSUE(", 'F'}, {"0OSUE1", 'F'}, {"0OSUEF", 'F'}, {"0OSUEK", 'F'}, {"0OSUEN", 'F'}, {"0OSUES", 'F'}, {"0OSUEV", 'F'}, {"0OUE(1", 'F'}, {"0OUE(F", 'F'}, {"0OUE(N", 'F'}, {"0OUE(S", 'F'}, {"0OUE(V", 'F'}, {"0OUE1,", 'F'}, {"0OUE1O", 'F'}, {"0OUEF(", 'F'}, {"0OUEK(", 'F'}, {"0OUEK1", 'F'}, {"0OUEKF", 'F'}, {"0OUEKN", 'F'}, {"0OUEKS", 'F'}, {"0OUEKV", 'F'}, {"0OUEN,", 'F'}, {"0OUENO", 'F'}, {"0OUES,", 'F'}, {"0OUESO", 'F'}, {"0OUEV,", 'F'}, {"0OUEVO", 'F'}, {"0OVO(1", 'F'}, {"0OVO(F", 'F'}, {"0OVO(N", 'F'}, {"0OVO(S", 'F'}, {"0OVO(V", 'F'}, {"0OVOF(", 'F'}, {"0OVOSO", 'F'}, {"0OVOSU", 'F'}, {"0OVUE(", 'F'}, {"0OVUE1", 'F'}, {"0OVUEF", 'F'}, {"0OVUEK", 'F'}, {"0OVUEN", 'F'}, {"0OVUES", 'F'}, {"0OVUEV", 'F'}, {"0S&(1&", 'F'}, {"0S&(1)", 'F'}, {"0S&(1,", 'F'}, {"0S&(1O", 'F'}, {"0S&(E(", 'F'}, {"0S&(E1", 'F'}, {"0S&(EF", 'F'}, {"0S&(EK", 'F'}, {"0S&(EN", 'F'}, {"0S&(EO", 'F'}, {"0S&(ES", 'F'}, {"0S&(ET", 'F'}, {"0S&(EV", 'F'}, {"0S&(F(", 'F'}, {"0S&(N&", 'F'}, {"0S&(N)", 'F'}, {"0S&(N,", 'F'}, {"0S&(NO", 'F'}, {"0S&(S&", 'F'}, {"0S&(S)", 'F'}, {"0S&(S,", 'F'}, {"0S&(SO", 'F'}, {"0S&(T(", 'F'}, {"0S&(V&", 'F'}, {"0S&(V)", 'F'}, {"0S&(V,", 'F'}, {"0S&(VO", 'F'}, {"0S&1", 'F'}, {"0S&1&(", 'F'}, {"0S&1&1", 'F'}, {"0S&1&F", 'F'}, {"0S&1&N", 'F'}, {"0S&1&S", 'F'}, {"0S&1&V", 'F'}, {"0S&1)&", 'F'}, {"0S&1)C", 'F'}, {"0S&1)O", 'F'}, {"0S&1)U", 'F'}, {"0S&1;", 'F'}, {"0S&1;C", 'F'}, {"0S&1;E", 'F'}, {"0S&1;T", 'F'}, {"0S&1B(", 'F'}, {"0S&1B1", 'F'}, {"0S&1BF", 'F'}, {"0S&1BN", 'F'}, {"0S&1BS", 'F'}, {"0S&1BV", 'F'}, {"0S&1C", 'F'}, {"0S&1EK", 'F'}, {"0S&1EN", 'F'}, {"0S&1F(", 'F'}, {"0S&1K(", 'F'}, {"0S&1K1", 'F'}, {"0S&1KF", 'F'}, {"0S&1KN", 'F'}, {"0S&1KS", 'F'}, {"0S&1KV", 'F'}, {"0S&1O(", 'F'}, {"0S&1OF", 'F'}, {"0S&1OO", 'F'}, {"0S&1OS", 'F'}, {"0S&1OV", 'F'}, {"0S&1TN", 'F'}, {"0S&1U", 'F'}, {"0S&1U(", 'F'}, {"0S&1U;", 'F'}, {"0S&1UC", 'F'}, {"0S&1UE", 'F'}, {"0S&E(1", 'F'}, {"0S&E(F", 'F'}, {"0S&E(N", 'F'}, {"0S&E(O", 'F'}, {"0S&E(S", 'F'}, {"0S&E(V", 'F'}, {"0S&E1", 'F'}, {"0S&E1;", 'F'}, {"0S&E1C", 'F'}, {"0S&E1K", 'F'}, {"0S&E1O", 'F'}, {"0S&EF(", 'F'}, {"0S&EK(", 'F'}, {"0S&EK1", 'F'}, {"0S&EKF", 'F'}, {"0S&EKN", 'F'}, {"0S&EKS", 'F'}, {"0S&EKV", 'F'}, {"0S&EN", 'F'}, {"0S&EN;", 'F'}, {"0S&ENC", 'F'}, {"0S&ENK", 'F'}, {"0S&ENO", 'F'}, {"0S&ES", 'F'}, {"0S&ES;", 'F'}, {"0S&ESC", 'F'}, {"0S&ESK", 'F'}, {"0S&ESO", 'F'}, {"0S&EV", 'F'}, {"0S&EV;", 'F'}, {"0S&EVC", 'F'}, {"0S&EVK", 'F'}, {"0S&EVO", 'F'}, {"0S&F()", 'F'}, {"0S&F(1", 'F'}, {"0S&F(E", 'F'}, {"0S&F(F", 'F'}, {"0S&F(N", 'F'}, {"0S&F(S", 'F'}, {"0S&F(T", 'F'}, {"0S&F(V", 'F'}, {"0S&K&(", 'F'}, {"0S&K&1", 'F'}, {"0S&K&F", 'F'}, {"0S&K&N", 'F'}, {"0S&K&S", 'F'}, {"0S&K&V", 'F'}, {"0S&K(1", 'F'}, {"0S&K(F", 'F'}, {"0S&K(N", 'F'}, {"0S&K(S", 'F'}, {"0S&K(V", 'F'}, {"0S&K1O", 'F'}, {"0S&KF(", 'F'}, {"0S&KNK", 'F'}, {"0S&KO(", 'F'}, {"0S&KO1", 'F'}, {"0S&KOF", 'F'}, {"0S&KOK", 'F'}, {"0S&KON", 'F'}, {"0S&KOS", 'F'}, {"0S&KOV", 'F'}, {"0S&KSO", 'F'}, {"0S&KVO", 'F'}, {"0S&N", 'F'}, {"0S&N&(", 'F'}, {"0S&N&1", 'F'}, {"0S&N&F", 'F'}, {"0S&N&N", 'F'}, {"0S&N&S", 'F'}, {"0S&N&V", 'F'}, {"0S&N)&", 'F'}, {"0S&N)C", 'F'}, {"0S&N)O", 'F'}, {"0S&N)U", 'F'}, {"0S&N;", 'F'}, {"0S&N;C", 'F'}, {"0S&N;E", 'F'}, {"0S&N;T", 'F'}, {"0S&NB(", 'F'}, {"0S&NB1", 'F'}, {"0S&NBF", 'F'}, {"0S&NBN", 'F'}, {"0S&NBS", 'F'}, {"0S&NBV", 'F'}, {"0S&NC", 'F'}, {"0S&NEN", 'F'}, {"0S&NF(", 'F'}, {"0S&NK(", 'F'}, {"0S&NK1", 'F'}, {"0S&NKF", 'F'}, {"0S&NKN", 'F'}, {"0S&NKS", 'F'}, {"0S&NKV", 'F'}, {"0S&NO(", 'F'}, {"0S&NOF", 'F'}, {"0S&NOS", 'F'}, {"0S&NOV", 'F'}, {"0S&NTN", 'F'}, {"0S&NU", 'F'}, {"0S&NU(", 'F'}, {"0S&NU;", 'F'}, {"0S&NUC", 'F'}, {"0S&NUE", 'F'}, {"0S&S", 'F'}, {"0S&S&(", 'F'}, {"0S&S&1", 'F'}, {"0S&S&F", 'F'}, {"0S&S&N", 'F'}, {"0S&S&S", 'F'}, {"0S&S&V", 'F'}, {"0S&S)&", 'F'}, {"0S&S)C", 'F'}, {"0S&S)O", 'F'}, {"0S&S)U", 'F'}, {"0S&S1", 'F'}, {"0S&S1;", 'F'}, {"0S&S1C", 'F'}, {"0S&S1O", 'F'}, {"0S&S;", 'F'}, {"0S&S;C", 'F'}, {"0S&S;E", 'F'}, {"0S&S;T", 'F'}, {"0S&SB(", 'F'}, {"0S&SB1", 'F'}, {"0S&SBF", 'F'}, {"0S&SBN", 'F'}, {"0S&SBS", 'F'}, {"0S&SBV", 'F'}, {"0S&SC", 'F'}, {"0S&SEK", 'F'}, {"0S&SEN", 'F'}, {"0S&SF(", 'F'}, {"0S&SK(", 'F'}, {"0S&SK1", 'F'}, {"0S&SKF", 'F'}, {"0S&SKN", 'F'}, {"0S&SKS", 'F'}, {"0S&SKV", 'F'}, {"0S&SO(", 'F'}, {"0S&SO1", 'F'}, {"0S&SOF", 'F'}, {"0S&SON", 'F'}, {"0S&SOO", 'F'}, {"0S&SOS", 'F'}, {"0S&SOV", 'F'}, {"0S&STN", 'F'}, {"0S&SU", 'F'}, {"0S&SU(", 'F'}, {"0S&SU;", 'F'}, {"0S&SUC", 'F'}, {"0S&SUE", 'F'}, {"0S&SV", 'F'}, {"0S&SV;", 'F'}, {"0S&SVC", 'F'}, {"0S&SVO", 'F'}, {"0S&T(1", 'F'}, {"0S&T(E", 'F'}, {"0S&T(F", 'F'}, {"0S&T(N", 'F'}, {"0S&T(S", 'F'}, {"0S&T(V", 'F'}, {"0S&V", 'F'}, {"0S&V&(", 'F'}, {"0S&V&1", 'F'}, {"0S&V&F", 'F'}, {"0S&V&N", 'F'}, {"0S&V&S", 'F'}, {"0S&V&V", 'F'}, {"0S&V)&", 'F'}, {"0S&V)C", 'F'}, {"0S&V)O", 'F'}, {"0S&V)U", 'F'}, {"0S&V;", 'F'}, {"0S&V;C", 'F'}, {"0S&V;E", 'F'}, {"0S&V;T", 'F'}, {"0S&VB(", 'F'}, {"0S&VB1", 'F'}, {"0S&VBF", 'F'}, {"0S&VBN", 'F'}, {"0S&VBS", 'F'}, {"0S&VBV", 'F'}, {"0S&VC", 'F'}, {"0S&VEK", 'F'}, {"0S&VEN", 'F'}, {"0S&VF(", 'F'}, {"0S&VK(", 'F'}, {"0S&VK1", 'F'}, {"0S&VKF", 'F'}, {"0S&VKN", 'F'}, {"0S&VKS", 'F'}, {"0S&VKV", 'F'}, {"0S&VO(", 'F'}, {"0S&VOF", 'F'}, {"0S&VOO", 'F'}, {"0S&VOS", 'F'}, {"0S&VS", 'F'}, {"0S&VS;", 'F'}, {"0S&VSC", 'F'}, {"0S&VSO", 'F'}, {"0S&VTN", 'F'}, {"0S&VU", 'F'}, {"0S&VU(", 'F'}, {"0S&VU;", 'F'}, {"0S&VUC", 'F'}, {"0S&VUE", 'F'}, {"0S(EF(", 'F'}, {"0S(EKF", 'F'}, {"0S(EKN", 'F'}, {"0S(ENK", 'F'}, {"0S(U(E", 'F'}, {"0S)&(1", 'F'}, {"0S)&(E", 'F'}, {"0S)&(F", 'F'}, {"0S)&(N", 'F'}, {"0S)&(S", 'F'}, {"0S)&(V", 'F'}, {"0S)&1", 'F'}, {"0S)&1&", 'F'}, {"0S)&1)", 'F'}, {"0S)&1;", 'F'}, {"0S)&1B", 'F'}, {"0S)&1C", 'F'}, {"0S)&1F", 'F'}, {"0S)&1O", 'F'}, {"0S)&1U", 'F'}, {"0S)&F(", 'F'}, {"0S)&N", 'F'}, {"0S)&N&", 'F'}, {"0S)&N)", 'F'}, {"0S)&N;", 'F'}, {"0S)&NB", 'F'}, {"0S)&NC", 'F'}, {"0S)&NF", 'F'}, {"0S)&NO", 'F'}, {"0S)&NU", 'F'}, {"0S)&S", 'F'}, {"0S)&S&", 'F'}, {"0S)&S)", 'F'}, {"0S)&S;", 'F'}, {"0S)&SB", 'F'}, {"0S)&SC", 'F'}, {"0S)&SF", 'F'}, {"0S)&SO", 'F'}, {"0S)&SU", 'F'}, {"0S)&V", 'F'}, {"0S)&V&", 'F'}, {"0S)&V)", 'F'}, {"0S)&V;", 'F'}, {"0S)&VB", 'F'}, {"0S)&VC", 'F'}, {"0S)&VF", 'F'}, {"0S)&VO", 'F'}, {"0S)&VU", 'F'}, {"0S),(1", 'F'}, {"0S),(F", 'F'}, {"0S),(N", 'F'}, {"0S),(S", 'F'}, {"0S),(V", 'F'}, {"0S);E(", 'F'}, {"0S);E1", 'F'}, {"0S);EF", 'F'}, {"0S);EK", 'F'}, {"0S);EN", 'F'}, {"0S);EO", 'F'}, {"0S);ES", 'F'}, {"0S);EV", 'F'}, {"0S);T(", 'F'}, {"0S);T1", 'F'}, {"0S);TF", 'F'}, {"0S);TK", 'F'}, {"0S);TN", 'F'}, {"0S);TO", 'F'}, {"0S);TS", 'F'}, {"0S);TV", 'F'}, {"0S)B(1", 'F'}, {"0S)B(F", 'F'}, {"0S)B(N", 'F'}, {"0S)B(S", 'F'}, {"0S)B(V", 'F'}, {"0S)B1", 'F'}, {"0S)B1&", 'F'}, {"0S)B1;", 'F'}, {"0S)B1C", 'F'}, {"0S)B1K", 'F'}, {"0S)B1N", 'F'}, {"0S)B1O", 'F'}, {"0S)B1U", 'F'}, {"0S)BF(", 'F'}, {"0S)BN", 'F'}, {"0S)BN&", 'F'}, {"0S)BN;", 'F'}, {"0S)BNC", 'F'}, {"0S)BNK", 'F'}, {"0S)BNO", 'F'}, {"0S)BNU", 'F'}, {"0S)BS", 'F'}, {"0S)BS&", 'F'}, {"0S)BS;", 'F'}, {"0S)BSC", 'F'}, {"0S)BSK", 'F'}, {"0S)BSO", 'F'}, {"0S)BSU", 'F'}, {"0S)BV", 'F'}, {"0S)BV&", 'F'}, {"0S)BV;", 'F'}, {"0S)BVC", 'F'}, {"0S)BVK", 'F'}, {"0S)BVO", 'F'}, {"0S)BVU", 'F'}, {"0S)C", 'F'}, {"0S)E(1", 'F'}, {"0S)E(F", 'F'}, {"0S)E(N", 'F'}, {"0S)E(S", 'F'}, {"0S)E(V", 'F'}, {"0S)E1C", 'F'}, {"0S)E1O", 'F'}, {"0S)EF(", 'F'}, {"0S)EK(", 'F'}, {"0S)EK1", 'F'}, {"0S)EKF", 'F'}, {"0S)EKN", 'F'}, {"0S)EKS", 'F'}, {"0S)EKV", 'F'}, {"0S)ENC", 'F'}, {"0S)ENO", 'F'}, {"0S)ESC", 'F'}, {"0S)ESO", 'F'}, {"0S)EVC", 'F'}, {"0S)EVO", 'F'}, {"0S)K(1", 'F'}, {"0S)K(F", 'F'}, {"0S)K(N", 'F'}, {"0S)K(S", 'F'}, {"0S)K(V", 'F'}, {"0S)K1&", 'F'}, {"0S)K1;", 'F'}, {"0S)K1B", 'F'}, {"0S)K1E", 'F'}, {"0S)K1O", 'F'}, {"0S)K1U", 'F'}, {"0S)KB(", 'F'}, {"0S)KB1", 'F'}, {"0S)KBF", 'F'}, {"0S)KBN", 'F'}, {"0S)KBS", 'F'}, {"0S)KBV", 'F'}, {"0S)KF(", 'F'}, {"0S)KN&", 'F'}, {"0S)KN;", 'F'}, {"0S)KNB", 'F'}, {"0S)KNE", 'F'}, {"0S)KNK", 'F'}, {"0S)KNU", 'F'}, {"0S)KS&", 'F'}, {"0S)KS;", 'F'}, {"0S)KSB", 'F'}, {"0S)KSE", 'F'}, {"0S)KSO", 'F'}, {"0S)KSU", 'F'}, {"0S)KUE", 'F'}, {"0S)KV&", 'F'}, {"0S)KV;", 'F'}, {"0S)KVB", 'F'}, {"0S)KVE", 'F'}, {"0S)KVO", 'F'}, {"0S)KVU", 'F'}, {"0S)O(1", 'F'}, {"0S)O(E", 'F'}, {"0S)O(F", 'F'}, {"0S)O(N", 'F'}, {"0S)O(S", 'F'}, {"0S)O(T", 'F'}, {"0S)O(V", 'F'}, {"0S)O1", 'F'}, {"0S)O1&", 'F'}, {"0S)O1)", 'F'}, {"0S)O1;", 'F'}, {"0S)O1B", 'F'}, {"0S)O1C", 'F'}, {"0S)O1K", 'F'}, {"0S)O1O", 'F'}, {"0S)O1U", 'F'}, {"0S)OF(", 'F'}, {"0S)ON&", 'F'}, {"0S)ON)", 'F'}, {"0S)ON;", 'F'}, {"0S)ONB", 'F'}, {"0S)ONC", 'F'}, {"0S)ONK", 'F'}, {"0S)ONO", 'F'}, {"0S)ONU", 'F'}, {"0S)OS", 'F'}, {"0S)OS&", 'F'}, {"0S)OS)", 'F'}, {"0S)OS;", 'F'}, {"0S)OSB", 'F'}, {"0S)OSC", 'F'}, {"0S)OSK", 'F'}, {"0S)OSO", 'F'}, {"0S)OSU", 'F'}, {"0S)OV", 'F'}, {"0S)OV&", 'F'}, {"0S)OV)", 'F'}, {"0S)OV;", 'F'}, {"0S)OVB", 'F'}, {"0S)OVC", 'F'}, {"0S)OVK", 'F'}, {"0S)OVO", 'F'}, {"0S)OVU", 'F'}, {"0S)U(E", 'F'}, {"0S)UE(", 'F'}, {"0S)UE1", 'F'}, {"0S)UEF", 'F'}, {"0S)UEK", 'F'}, {"0S)UEN", 'F'}, {"0S)UES", 'F'}, {"0S)UEV", 'F'}, {"0S,(1)", 'F'}, {"0S,(1O", 'F'}, {"0S,(E(", 'F'}, {"0S,(E1", 'F'}, {"0S,(EF", 'F'}, {"0S,(EK", 'F'}, {"0S,(EN", 'F'}, {"0S,(ES", 'F'}, {"0S,(EV", 'F'}, {"0S,(F(", 'F'}, {"0S,(N)", 'F'}, {"0S,(NO", 'F'}, {"0S,(S)", 'F'}, {"0S,(SO", 'F'}, {"0S,(V)", 'F'}, {"0S,(VO", 'F'}, {"0S,F()", 'F'}, {"0S,F(1", 'F'}, {"0S,F(F", 'F'}, {"0S,F(N", 'F'}, {"0S,F(S", 'F'}, {"0S,F(T", 'F'}, {"0S,F(V", 'F'}, {"0S,V),", 'F'}, {"0S,V)O", 'F'}, {"0S,VB(", 'F'}, {"0S,VB1", 'F'}, {"0S,VBF", 'F'}, {"0S,VBN", 'F'}, {"0S,VBS", 'F'}, {"0S,VBV", 'F'}, {"0S,VO(", 'F'}, {"0S,VOF", 'F'}, {"0S,VOS", 'F'}, {"0S,VUE", 'F'}, {"0S1F()", 'F'}, {"0S1F(1", 'F'}, {"0S1F(F", 'F'}, {"0S1F(N", 'F'}, {"0S1F(S", 'F'}, {"0S1F(V", 'F'}, {"0S1NC", 'F'}, {"0S1O(1", 'F'}, {"0S1O(F", 'F'}, {"0S1O(N", 'F'}, {"0S1O(S", 'F'}, {"0S1O(V", 'F'}, {"0S1OF(", 'F'}, {"0S1OS(", 'F'}, {"0S1OS1", 'F'}, {"0S1OSF", 'F'}, {"0S1OSO", 'F'}, {"0S1OSU", 'F'}, {"0S1OSV", 'F'}, {"0S1OV(", 'F'}, {"0S1OVF", 'F'}, {"0S1OVO", 'F'}, {"0S1OVS", 'F'}, {"0S1OVU", 'F'}, {"0S1S;", 'F'}, {"0S1S;C", 'F'}, {"0S1SC", 'F'}, {"0S1UE", 'F'}, {"0S1UE;", 'F'}, {"0S1UEC", 'F'}, {"0S1UEK", 'F'}, {"0S1V", 'F'}, {"0S1V;", 'F'}, {"0S1V;C", 'F'}, {"0S1VC", 'F'}, {"0S1VO(", 'F'}, {"0S1VOF", 'F'}, {"0S1VOS", 'F'}, {"0S;E(1", 'F'}, {"0S;E(E", 'F'}, {"0S;E(F", 'F'}, {"0S;E(N", 'F'}, {"0S;E(S", 'F'}, {"0S;E(V", 'F'}, {"0S;E1,", 'F'}, {"0S;E1;", 'F'}, {"0S;E1C", 'F'}, {"0S;E1K", 'F'}, {"0S;E1O", 'F'}, {"0S;E1T", 'F'}, {"0S;EF(", 'F'}, {"0S;EK(", 'F'}, {"0S;EK1", 'F'}, {"0S;EKF", 'F'}, {"0S;EKN", 'F'}, {"0S;EKO", 'F'}, {"0S;EKS", 'F'}, {"0S;EKV", 'F'}, {"0S;EN,", 'F'}, {"0S;EN;", 'F'}, {"0S;ENC", 'F'}, {"0S;ENE", 'F'}, {"0S;ENK", 'F'}, {"0S;ENO", 'F'}, {"0S;ENT", 'F'}, {"0S;EO(", 'F'}, {"0S;ES,", 'F'}, {"0S;ES;", 'F'}, {"0S;ESC", 'F'}, {"0S;ESK", 'F'}, {"0S;ESO", 'F'}, {"0S;EST", 'F'}, {"0S;EV,", 'F'}, {"0S;EV;", 'F'}, {"0S;EVC", 'F'}, {"0S;EVK", 'F'}, {"0S;EVO", 'F'}, {"0S;EVT", 'F'}, {"0S;N:T", 'F'}, {"0S;T(1", 'F'}, {"0S;T(E", 'F'}, {"0S;T(F", 'F'}, {"0S;T(N", 'F'}, {"0S;T(S", 'F'}, {"0S;T(V", 'F'}, {"0S;T1,", 'F'}, {"0S;T1;", 'F'}, {"0S;T1C", 'F'}, {"0S;T1F", 'F'}, {"0S;T1K", 'F'}, {"0S;T1O", 'F'}, {"0S;T1T", 'F'}, {"0S;T;", 'F'}, {"0S;T;C", 'F'}, {"0S;TF(", 'F'}, {"0S;TK(", 'F'}, {"0S;TK1", 'F'}, {"0S;TKF", 'F'}, {"0S;TKK", 'F'}, {"0S;TKN", 'F'}, {"0S;TKO", 'F'}, {"0S;TKS", 'F'}, {"0S;TKV", 'F'}, {"0S;TN(", 'F'}, {"0S;TN,", 'F'}, {"0S;TN1", 'F'}, {"0S;TN;", 'F'}, {"0S;TNC", 'F'}, {"0S;TNE", 'F'}, {"0S;TNF", 'F'}, {"0S;TNK", 'F'}, {"0S;TNN", 'F'}, {"0S;TNO", 'F'}, {"0S;TNS", 'F'}, {"0S;TNT", 'F'}, {"0S;TNV", 'F'}, {"0S;TO(", 'F'}, {"0S;TS,", 'F'}, {"0S;TS;", 'F'}, {"0S;TSC", 'F'}, {"0S;TSF", 'F'}, {"0S;TSK", 'F'}, {"0S;TSO", 'F'}, {"0S;TST", 'F'}, {"0S;TT(", 'F'}, {"0S;TT1", 'F'}, {"0S;TTF", 'F'}, {"0S;TTN", 'F'}, {"0S;TTS", 'F'}, {"0S;TTV", 'F'}, {"0S;TV,", 'F'}, {"0S;TV;", 'F'}, {"0S;TVC", 'F'}, {"0S;TVF", 'F'}, {"0S;TVK", 'F'}, {"0S;TVO", 'F'}, {"0S;TVT", 'F'}, {"0SA(F(", 'F'}, {"0SA(N)", 'F'}, {"0SA(NO", 'F'}, {"0SA(S)", 'F'}, {"0SA(SO", 'F'}, {"0SA(V)", 'F'}, {"0SA(VO", 'F'}, {"0SAF()", 'F'}, {"0SAF(1", 'F'}, {"0SAF(F", 'F'}, {"0SAF(N", 'F'}, {"0SAF(S", 'F'}, {"0SAF(V", 'F'}, {"0SASO(", 'F'}, {"0SASO1", 'F'}, {"0SASOF", 'F'}, {"0SASON", 'F'}, {"0SASOS", 'F'}, {"0SASOV", 'F'}, {"0SASUE", 'F'}, {"0SATO(", 'F'}, {"0SATO1", 'F'}, {"0SATOF", 'F'}, {"0SATON", 'F'}, {"0SATOS", 'F'}, {"0SATOV", 'F'}, {"0SATUE", 'F'}, {"0SAVO(", 'F'}, {"0SAVOF", 'F'}, {"0SAVOS", 'F'}, {"0SAVUE", 'F'}, {"0SB(1)", 'F'}, {"0SB(1O", 'F'}, {"0SB(F(", 'F'}, {"0SB(N)", 'F'}, {"0SB(NO", 'F'}, {"0SB(S)", 'F'}, {"0SB(SO", 'F'}, {"0SB(V)", 'F'}, {"0SB(VO", 'F'}, {"0SB1", 'F'}, {"0SB1&(", 'F'}, {"0SB1&1", 'F'}, {"0SB1&F", 'F'}, {"0SB1&N", 'F'}, {"0SB1&S", 'F'}, {"0SB1&V", 'F'}, {"0SB1,(", 'F'}, {"0SB1,F", 'F'}, {"0SB1,V", 'F'}, {"0SB1;", 'F'}, {"0SB1;C", 'F'}, {"0SB1B(", 'F'}, {"0SB1B1", 'F'}, {"0SB1BF", 'F'}, {"0SB1BN", 'F'}, {"0SB1BS", 'F'}, {"0SB1BV", 'F'}, {"0SB1C", 'F'}, {"0SB1K(", 'F'}, {"0SB1K1", 'F'}, {"0SB1KF", 'F'}, {"0SB1KN", 'F'}, {"0SB1KS", 'F'}, {"0SB1KV", 'F'}, {"0SB1O(", 'F'}, {"0SB1OF", 'F'}, {"0SB1OS", 'F'}, {"0SB1OV", 'F'}, {"0SB1U(", 'F'}, {"0SB1UE", 'F'}, {"0SBE(1", 'F'}, {"0SBE(F", 'F'}, {"0SBE(N", 'F'}, {"0SBE(S", 'F'}, {"0SBE(V", 'F'}, {"0SBEK(", 'F'}, {"0SBF()", 'F'}, {"0SBF(1", 'F'}, {"0SBF(F", 'F'}, {"0SBF(N", 'F'}, {"0SBF(S", 'F'}, {"0SBF(V", 'F'}, {"0SBN", 'F'}, {"0SBN&(", 'F'}, {"0SBN&1", 'F'}, {"0SBN&F", 'F'}, {"0SBN&N", 'F'}, {"0SBN&S", 'F'}, {"0SBN&V", 'F'}, {"0SBN,(", 'F'}, {"0SBN,F", 'F'}, {"0SBN,V", 'F'}, {"0SBN;", 'F'}, {"0SBN;C", 'F'}, {"0SBNB(", 'F'}, {"0SBNB1", 'F'}, {"0SBNBF", 'F'}, {"0SBNBN", 'F'}, {"0SBNBS", 'F'}, {"0SBNBV", 'F'}, {"0SBNC", 'F'}, {"0SBNK(", 'F'}, {"0SBNK1", 'F'}, {"0SBNKF", 'F'}, {"0SBNKN", 'F'}, {"0SBNKS", 'F'}, {"0SBNKV", 'F'}, {"0SBNO(", 'F'}, {"0SBNOF", 'F'}, {"0SBNOS", 'F'}, {"0SBNOV", 'F'}, {"0SBNU(", 'F'}, {"0SBNUE", 'F'}, {"0SBS", 'F'}, {"0SBS&(", 'F'}, {"0SBS&1", 'F'}, {"0SBS&F", 'F'}, {"0SBS&N", 'F'}, {"0SBS&S", 'F'}, {"0SBS&V", 'F'}, {"0SBS,(", 'F'}, {"0SBS,F", 'F'}, {"0SBS,V", 'F'}, {"0SBS;", 'F'}, {"0SBS;C", 'F'}, {"0SBSB(", 'F'}, {"0SBSB1", 'F'}, {"0SBSBF", 'F'}, {"0SBSBN", 'F'}, {"0SBSBS", 'F'}, {"0SBSBV", 'F'}, {"0SBSC", 'F'}, {"0SBSK(", 'F'}, {"0SBSK1", 'F'}, {"0SBSKF", 'F'}, {"0SBSKN", 'F'}, {"0SBSKS", 'F'}, {"0SBSKV", 'F'}, {"0SBSO(", 'F'}, {"0SBSO1", 'F'}, {"0SBSOF", 'F'}, {"0SBSON", 'F'}, {"0SBSOS", 'F'}, {"0SBSOV", 'F'}, {"0SBSU(", 'F'}, {"0SBSUE", 'F'}, {"0SBV", 'F'}, {"0SBV&(", 'F'}, {"0SBV&1", 'F'}, {"0SBV&F", 'F'}, {"0SBV&N", 'F'}, {"0SBV&S", 'F'}, {"0SBV&V", 'F'}, {"0SBV,(", 'F'}, {"0SBV,1", 'F'}, {"0SBV,F", 'F'}, {"0SBV,N", 'F'}, {"0SBV,S", 'F'}, {"0SBV,V", 'F'}, {"0SBV;", 'F'}, {"0SBV;C", 'F'}, {"0SBVB(", 'F'}, {"0SBVB1", 'F'}, {"0SBVBF", 'F'}, {"0SBVBN", 'F'}, {"0SBVBS", 'F'}, {"0SBVBV", 'F'}, {"0SBVC", 'F'}, {"0SBVK(", 'F'}, {"0SBVK1", 'F'}, {"0SBVKF", 'F'}, {"0SBVKN", 'F'}, {"0SBVKS", 'F'}, {"0SBVKV", 'F'}, {"0SBVO(", 'F'}, {"0SBVOF", 'F'}, {"0SBVOS", 'F'}, {"0SBVU(", 'F'}, {"0SBVUE", 'F'}, {"0SC", 'F'}, {"0SE(1)", 'F'}, {"0SE(1O", 'F'}, {"0SE(F(", 'F'}, {"0SE(N)", 'F'}, {"0SE(NO", 'F'}, {"0SE(S)", 'F'}, {"0SE(SO", 'F'}, {"0SE(V)", 'F'}, {"0SE(VO", 'F'}, {"0SE1C", 'F'}, {"0SE1O(", 'F'}, {"0SE1OF", 'F'}, {"0SE1OS", 'F'}, {"0SE1OV", 'F'}, {"0SE1UE", 'F'}, {"0SEF()", 'F'}, {"0SEF(1", 'F'}, {"0SEF(F", 'F'}, {"0SEF(N", 'F'}, {"0SEF(S", 'F'}, {"0SEF(V", 'F'}, {"0SEK(1", 'F'}, {"0SEK(E", 'F'}, {"0SEK(F", 'F'}, {"0SEK(N", 'F'}, {"0SEK(S", 'F'}, {"0SEK(V", 'F'}, {"0SEK1C", 'F'}, {"0SEK1O", 'F'}, {"0SEK1U", 'F'}, {"0SEKF(", 'F'}, {"0SEKNC", 'F'}, {"0SEKNE", 'F'}, {"0SEKNU", 'F'}, {"0SEKOK", 'F'}, {"0SEKSC", 'F'}, {"0SEKSO", 'F'}, {"0SEKSU", 'F'}, {"0SEKU(", 'F'}, {"0SEKU1", 'F'}, {"0SEKUE", 'F'}, {"0SEKUF", 'F'}, {"0SEKUN", 'F'}, {"0SEKUS", 'F'}, {"0SEKUV", 'F'}, {"0SEKVC", 'F'}, {"0SEKVO", 'F'}, {"0SEKVU", 'F'}, {"0SENC", 'F'}, {"0SENEN", 'F'}, {"0SENO(", 'F'}, {"0SENOF", 'F'}, {"0SENOS", 'F'}, {"0SENOV", 'F'}, {"0SENUE", 'F'}, {"0SEOKN", 'F'}, {"0SESC", 'F'}, {"0SESO(", 'F'}, {"0SESO1", 'F'}, {"0SESOF", 'F'}, {"0SESON", 'F'}, {"0SESOS", 'F'}, {"0SESOV", 'F'}, {"0SESUE", 'F'}, {"0SEU(1", 'F'}, {"0SEU(F", 'F'}, {"0SEU(N", 'F'}, {"0SEU(S", 'F'}, {"0SEU(V", 'F'}, {"0SEU1,", 'F'}, {"0SEU1C", 'F'}, {"0SEU1O", 'F'}, {"0SEUEF", 'F'}, {"0SEUEK", 'F'}, {"0SEUF(", 'F'}, {"0SEUN,", 'F'}, {"0SEUNC", 'F'}, {"0SEUNO", 'F'}, {"0SEUS,", 'F'}, {"0SEUSC", 'F'}, {"0SEUSO", 'F'}, {"0SEUV,", 'F'}, {"0SEUVC", 'F'}, {"0SEUVO", 'F'}, {"0SEVC", 'F'}, {"0SEVO(", 'F'}, {"0SEVOF", 'F'}, {"0SEVOS", 'F'}, {"0SEVUE", 'F'}, {"0SF()1", 'F'}, {"0SF()F", 'F'}, {"0SF()K", 'F'}, {"0SF()N", 'F'}, {"0SF()O", 'F'}, {"0SF()S", 'F'}, {"0SF()U", 'F'}, {"0SF()V", 'F'}, {"0SF(1)", 'F'}, {"0SF(1N", 'F'}, {"0SF(1O", 'F'}, {"0SF(E(", 'F'}, {"0SF(E1", 'F'}, {"0SF(EF", 'F'}, {"0SF(EK", 'F'}, {"0SF(EN", 'F'}, {"0SF(ES", 'F'}, {"0SF(EV", 'F'}, {"0SF(F(", 'F'}, {"0SF(N)", 'F'}, {"0SF(N,", 'F'}, {"0SF(NO", 'F'}, {"0SF(S)", 'F'}, {"0SF(SO", 'F'}, {"0SF(V)", 'F'}, {"0SF(VO", 'F'}, {"0SK(1)", 'F'}, {"0SK(1O", 'F'}, {"0SK(F(", 'F'}, {"0SK(N)", 'F'}, {"0SK(NO", 'F'}, {"0SK(S)", 'F'}, {"0SK(SO", 'F'}, {"0SK(V)", 'F'}, {"0SK(VO", 'F'}, {"0SK)&(", 'F'}, {"0SK)&1", 'F'}, {"0SK)&F", 'F'}, {"0SK)&N", 'F'}, {"0SK)&S", 'F'}, {"0SK)&V", 'F'}, {"0SK);E", 'F'}, {"0SK);T", 'F'}, {"0SK)B(", 'F'}, {"0SK)B1", 'F'}, {"0SK)BF", 'F'}, {"0SK)BN", 'F'}, {"0SK)BS", 'F'}, {"0SK)BV", 'F'}, {"0SK)E(", 'F'}, {"0SK)E1", 'F'}, {"0SK)EF", 'F'}, {"0SK)EK", 'F'}, {"0SK)EN", 'F'}, {"0SK)ES", 'F'}, {"0SK)EV", 'F'}, {"0SK)OF", 'F'}, {"0SK)UE", 'F'}, {"0SK1", 'F'}, {"0SK1&(", 'F'}, {"0SK1&1", 'F'}, {"0SK1&F", 'F'}, {"0SK1&N", 'F'}, {"0SK1&S", 'F'}, {"0SK1&V", 'F'}, {"0SK1;", 'F'}, {"0SK1;C", 'F'}, {"0SK1;E", 'F'}, {"0SK1;T", 'F'}, {"0SK1B(", 'F'}, {"0SK1B1", 'F'}, {"0SK1BF", 'F'}, {"0SK1BN", 'F'}, {"0SK1BS", 'F'}, {"0SK1BV", 'F'}, {"0SK1C", 'F'}, {"0SK1E(", 'F'}, {"0SK1E1", 'F'}, {"0SK1EF", 'F'}, {"0SK1EK", 'F'}, {"0SK1EN", 'F'}, {"0SK1ES", 'F'}, {"0SK1EV", 'F'}, {"0SK1O(", 'F'}, {"0SK1OF", 'F'}, {"0SK1OS", 'F'}, {"0SK1OV", 'F'}, {"0SK1U(", 'F'}, {"0SK1UE", 'F'}, {"0SKF()", 'F'}, {"0SKF(1", 'F'}, {"0SKF(F", 'F'}, {"0SKF(N", 'F'}, {"0SKF(S", 'F'}, {"0SKF(V", 'F'}, {"0SKN", 'F'}, {"0SKN&(", 'F'}, {"0SKN&1", 'F'}, {"0SKN&F", 'F'}, {"0SKN&N", 'F'}, {"0SKN&S", 'F'}, {"0SKN&V", 'F'}, {"0SKN;", 'F'}, {"0SKN;C", 'F'}, {"0SKN;E", 'F'}, {"0SKN;T", 'F'}, {"0SKNB(", 'F'}, {"0SKNB1", 'F'}, {"0SKNBF", 'F'}, {"0SKNBN", 'F'}, {"0SKNBS", 'F'}, {"0SKNBV", 'F'}, {"0SKNC", 'F'}, {"0SKNE(", 'F'}, {"0SKNE1", 'F'}, {"0SKNEF", 'F'}, {"0SKNEN", 'F'}, {"0SKNES", 'F'}, {"0SKNEV", 'F'}, {"0SKNU(", 'F'}, {"0SKNUE", 'F'}, {"0SKS", 'F'}, {"0SKS&(", 'F'}, {"0SKS&1", 'F'}, {"0SKS&F", 'F'}, {"0SKS&N", 'F'}, {"0SKS&S", 'F'}, {"0SKS&V", 'F'}, {"0SKS;", 'F'}, {"0SKS;C", 'F'}, {"0SKS;E", 'F'}, {"0SKS;T", 'F'}, {"0SKSB(", 'F'}, {"0SKSB1", 'F'}, {"0SKSBF", 'F'}, {"0SKSBN", 'F'}, {"0SKSBS", 'F'}, {"0SKSBV", 'F'}, {"0SKSC", 'F'}, {"0SKSE(", 'F'}, {"0SKSE1", 'F'}, {"0SKSEF", 'F'}, {"0SKSEK", 'F'}, {"0SKSEN", 'F'}, {"0SKSES", 'F'}, {"0SKSEV", 'F'}, {"0SKSO(", 'F'}, {"0SKSO1", 'F'}, {"0SKSOF", 'F'}, {"0SKSON", 'F'}, {"0SKSOS", 'F'}, {"0SKSOV", 'F'}, {"0SKSU(", 'F'}, {"0SKSUE", 'F'}, {"0SKUE(", 'F'}, {"0SKUE1", 'F'}, {"0SKUEF", 'F'}, {"0SKUEK", 'F'}, {"0SKUEN", 'F'}, {"0SKUES", 'F'}, {"0SKUEV", 'F'}, {"0SKV", 'F'}, {"0SKV&(", 'F'}, {"0SKV&1", 'F'}, {"0SKV&F", 'F'}, {"0SKV&N", 'F'}, {"0SKV&S", 'F'}, {"0SKV&V", 'F'}, {"0SKV;", 'F'}, {"0SKV;C", 'F'}, {"0SKV;E", 'F'}, {"0SKV;T", 'F'}, {"0SKVB(", 'F'}, {"0SKVB1", 'F'}, {"0SKVBF", 'F'}, {"0SKVBN", 'F'}, {"0SKVBS", 'F'}, {"0SKVBV", 'F'}, {"0SKVC", 'F'}, {"0SKVE(", 'F'}, {"0SKVE1", 'F'}, {"0SKVEF", 'F'}, {"0SKVEK", 'F'}, {"0SKVEN", 'F'}, {"0SKVES", 'F'}, {"0SKVEV", 'F'}, {"0SKVO(", 'F'}, {"0SKVOF", 'F'}, {"0SKVOS", 'F'}, {"0SKVU(", 'F'}, {"0SKVUE", 'F'}, {"0SO(1&", 'F'}, {"0SO(1)", 'F'}, {"0SO(1,", 'F'}, {"0SO(1O", 'F'}, {"0SO(E(", 'F'}, {"0SO(E1", 'F'}, {"0SO(EE", 'F'}, {"0SO(EF", 'F'}, {"0SO(EK", 'F'}, {"0SO(EN", 'F'}, {"0SO(ES", 'F'}, {"0SO(ET", 'F'}, {"0SO(EV", 'F'}, {"0SO(F(", 'F'}, {"0SO(N&", 'F'}, {"0SO(N)", 'F'}, {"0SO(N,", 'F'}, {"0SO(NO", 'F'}, {"0SO(O(", 'F'}, {"0SO(O1", 'F'}, {"0SO(OF", 'F'}, {"0SO(ON", 'F'}, {"0SO(OS", 'F'}, {"0SO(OV", 'F'}, {"0SO(S&", 'F'}, {"0SO(S)", 'F'}, {"0SO(S,", 'F'}, {"0SO(SO", 'F'}, {"0SO(T(", 'F'}, {"0SO(V&", 'F'}, {"0SO(V)", 'F'}, {"0SO(V,", 'F'}, {"0SO(VO", 'F'}, {"0SO1&(", 'F'}, {"0SO1&1", 'F'}, {"0SO1&E", 'F'}, {"0SO1&F", 'F'}, {"0SO1&K", 'F'}, {"0SO1&N", 'F'}, {"0SO1&S", 'F'}, {"0SO1&T", 'F'}, {"0SO1&U", 'F'}, {"0SO1&V", 'F'}, {"0SO1(E", 'F'}, {"0SO1(U", 'F'}, {"0SO1)&", 'F'}, {"0SO1),", 'F'}, {"0SO1);", 'F'}, {"0SO1)B", 'F'}, {"0SO1)C", 'F'}, {"0SO1)E", 'F'}, {"0SO1)K", 'F'}, {"0SO1)O", 'F'}, {"0SO1)U", 'F'}, {"0SO1,(", 'F'}, {"0SO1,F", 'F'}, {"0SO1,V", 'F'}, {"0SO1;", 'F'}, {"0SO1;C", 'F'}, {"0SO1;E", 'F'}, {"0SO1;N", 'F'}, {"0SO1;T", 'F'}, {"0SO1A(", 'F'}, {"0SO1AF", 'F'}, {"0SO1AS", 'F'}, {"0SO1AT", 'F'}, {"0SO1AV", 'F'}, {"0SO1B(", 'F'}, {"0SO1B1", 'F'}, {"0SO1BE", 'F'}, {"0SO1BF", 'F'}, {"0SO1BN", 'F'}, {"0SO1BS", 'F'}, {"0SO1BV", 'F'}, {"0SO1C", 'F'}, {"0SO1E(", 'F'}, {"0SO1E1", 'F'}, {"0SO1EF", 'F'}, {"0SO1EK", 'F'}, {"0SO1EN", 'F'}, {"0SO1EO", 'F'}, {"0SO1ES", 'F'}, {"0SO1EU", 'F'}, {"0SO1EV", 'F'}, {"0SO1F(", 'F'}, {"0SO1K(", 'F'}, {"0SO1K)", 'F'}, {"0SO1K1", 'F'}, {"0SO1KB", 'F'}, {"0SO1KF", 'F'}, {"0SO1KN", 'F'}, {"0SO1KS", 'F'}, {"0SO1KU", 'F'}, {"0SO1KV", 'F'}, {"0SO1N&", 'F'}, {"0SO1N(", 'F'}, {"0SO1N,", 'F'}, {"0SO1NE", 'F'}, {"0SO1NF", 'F'}, {"0SO1NU", 'F'}, {"0SO1O(", 'F'}, {"0SO1OF", 'F'}, {"0SO1OK", 'F'}, {"0SO1OS", 'F'}, {"0SO1OT", 'F'}, {"0SO1OU", 'F'}, {"0SO1OV", 'F'}, {"0SO1S(", 'F'}, {"0SO1SF", 'F'}, {"0SO1SU", 'F'}, {"0SO1SV", 'F'}, {"0SO1U", 'F'}, {"0SO1U(", 'F'}, {"0SO1U1", 'F'}, {"0SO1U;", 'F'}, {"0SO1UC", 'F'}, {"0SO1UE", 'F'}, {"0SO1UF", 'F'}, {"0SO1UK", 'F'}, {"0SO1UN", 'F'}, {"0SO1UO", 'F'}, {"0SO1US", 'F'}, {"0SO1UT", 'F'}, {"0SO1UV", 'F'}, {"0SO1V(", 'F'}, {"0SO1VF", 'F'}, {"0SO1VO", 'F'}, {"0SO1VS", 'F'}, {"0SO1VU", 'F'}, {"0SOF()", 'F'}, {"0SOF(1", 'F'}, {"0SOF(E", 'F'}, {"0SOF(F", 'F'}, {"0SOF(N", 'F'}, {"0SOF(S", 'F'}, {"0SOF(T", 'F'}, {"0SOF(V", 'F'}, {"0SOK&(", 'F'}, {"0SOK&1", 'F'}, {"0SOK&F", 'F'}, {"0SOK&N", 'F'}, {"0SOK&S", 'F'}, {"0SOK&V", 'F'}, {"0SOK(1", 'F'}, {"0SOK(F", 'F'}, {"0SOK(N", 'F'}, {"0SOK(S", 'F'}, {"0SOK(V", 'F'}, {"0SOK1C", 'F'}, {"0SOK1O", 'F'}, {"0SOKF(", 'F'}, {"0SOKNC", 'F'}, {"0SOKO(", 'F'}, {"0SOKO1", 'F'}, {"0SOKOF", 'F'}, {"0SOKON", 'F'}, {"0SOKOS", 'F'}, {"0SOKOV", 'F'}, {"0SOKSC", 'F'}, {"0SOKSO", 'F'}, {"0SOKVC", 'F'}, {"0SOKVO", 'F'}, {"0SON&(", 'F'}, {"0SON&1", 'F'}, {"0SON&E", 'F'}, {"0SON&F", 'F'}, {"0SON&K", 'F'}, {"0SON&N", 'F'}, {"0SON&S", 'F'}, {"0SON&T", 'F'}, {"0SON&U", 'F'}, {"0SON&V", 'F'}, {"0SON(1", 'F'}, {"0SON(E", 'F'}, {"0SON(F", 'F'}, {"0SON(S", 'F'}, {"0SON(U", 'F'}, {"0SON(V", 'F'}, {"0SON)&", 'F'}, {"0SON),", 'F'}, {"0SON);", 'F'}, {"0SON)B", 'F'}, {"0SON)C", 'F'}, {"0SON)E", 'F'}, {"0SON)K", 'F'}, {"0SON)O", 'F'}, {"0SON)U", 'F'}, {"0SON,(", 'F'}, {"0SON,F", 'F'}, {"0SON,V", 'F'}, {"0SON1(", 'F'}, {"0SON1F", 'F'}, {"0SON1N", 'F'}, {"0SON1O", 'F'}, {"0SON1S", 'F'}, {"0SON1U", 'F'}, {"0SON1V", 'F'}, {"0SON;", 'F'}, {"0SON;C", 'F'}, {"0SON;E", 'F'}, {"0SON;N", 'F'}, {"0SON;T", 'F'}, {"0SONA(", 'F'}, {"0SONAF", 'F'}, {"0SONAS", 'F'}, {"0SONAT", 'F'}, {"0SONAV", 'F'}, {"0SONB(", 'F'}, {"0SONB1", 'F'}, {"0SONBE", 'F'}, {"0SONBF", 'F'}, {"0SONBN", 'F'}, {"0SONBS", 'F'}, {"0SONBV", 'F'}, {"0SONE(", 'F'}, {"0SONE1", 'F'}, {"0SONEF", 'F'}, {"0SONEN", 'F'}, {"0SONEO", 'F'}, {"0SONES", 'F'}, {"0SONEU", 'F'}, {"0SONEV", 'F'}, {"0SONF(", 'F'}, {"0SONK(", 'F'}, {"0SONK)", 'F'}, {"0SONK1", 'F'}, {"0SONKB", 'F'}, {"0SONKF", 'F'}, {"0SONKS", 'F'}, {"0SONKU", 'F'}, {"0SONKV", 'F'}, {"0SONO(", 'F'}, {"0SONOF", 'F'}, {"0SONOK", 'F'}, {"0SONOS", 'F'}, {"0SONOT", 'F'}, {"0SONOU", 'F'}, {"0SONOV", 'F'}, {"0SONSU", 'F'}, {"0SONU", 'F'}, {"0SONU(", 'F'}, {"0SONU1", 'F'}, {"0SONU;", 'F'}, {"0SONUC", 'F'}, {"0SONUE", 'F'}, {"0SONUF", 'F'}, {"0SONUK", 'F'}, {"0SONUN", 'F'}, {"0SONUO", 'F'}, {"0SONUS", 'F'}, {"0SONUT", 'F'}, {"0SONUV", 'F'}, {"0SOS", 'F'}, {"0SOS&(", 'F'}, {"0SOS&1", 'F'}, {"0SOS&E", 'F'}, {"0SOS&F", 'F'}, {"0SOS&K", 'F'}, {"0SOS&N", 'F'}, {"0SOS&S", 'F'}, {"0SOS&T", 'F'}, {"0SOS&U", 'F'}, {"0SOS&V", 'F'}, {"0SOS(E", 'F'}, {"0SOS(U", 'F'}, {"0SOS)&", 'F'}, {"0SOS),", 'F'}, {"0SOS);", 'F'}, {"0SOS)B", 'F'}, {"0SOS)C", 'F'}, {"0SOS)E", 'F'}, {"0SOS)K", 'F'}, {"0SOS)O", 'F'}, {"0SOS)U", 'F'}, {"0SOS,(", 'F'}, {"0SOS,F", 'F'}, {"0SOS,V", 'F'}, {"0SOS1(", 'F'}, {"0SOS1F", 'F'}, {"0SOS1N", 'F'}, {"0SOS1O", 'F'}, {"0SOS1S", 'F'}, {"0SOS1U", 'F'}, {"0SOS1V", 'F'}, {"0SOS;", 'F'}, {"0SOS;C", 'F'}, {"0SOS;E", 'F'}, {"0SOS;N", 'F'}, {"0SOS;T", 'F'}, {"0SOSA(", 'F'}, {"0SOSAF", 'F'}, {"0SOSAS", 'F'}, {"0SOSAT", 'F'}, {"0SOSAV", 'F'}, {"0SOSB(", 'F'}, {"0SOSB1", 'F'}, {"0SOSBE", 'F'}, {"0SOSBF", 'F'}, {"0SOSBN", 'F'}, {"0SOSBS", 'F'}, {"0SOSBV", 'F'}, {"0SOSC", 'F'}, {"0SOSE(", 'F'}, {"0SOSE1", 'F'}, {"0SOSEF", 'F'}, {"0SOSEK", 'F'}, {"0SOSEN", 'F'}, {"0SOSEO", 'F'}, {"0SOSES", 'F'}, {"0SOSEU", 'F'}, {"0SOSEV", 'F'}, {"0SOSF(", 'F'}, {"0SOSK(", 'F'}, {"0SOSK)", 'F'}, {"0SOSK1", 'F'}, {"0SOSKB", 'F'}, {"0SOSKF", 'F'}, {"0SOSKN", 'F'}, {"0SOSKS", 'F'}, {"0SOSKU", 'F'}, {"0SOSKV", 'F'}, {"0SOSO(", 'F'}, {"0SOSO1", 'F'}, {"0SOSOF", 'F'}, {"0SOSOK", 'F'}, {"0SOSON", 'F'}, {"0SOSOS", 'F'}, {"0SOSOT", 'F'}, {"0SOSOU", 'F'}, {"0SOSOV", 'F'}, {"0SOSU", 'F'}, {"0SOSU(", 'F'}, {"0SOSU1", 'F'}, {"0SOSU;", 'F'}, {"0SOSUC", 'F'}, {"0SOSUE", 'F'}, {"0SOSUF", 'F'}, {"0SOSUK", 'F'}, {"0SOSUN", 'F'}, {"0SOSUO", 'F'}, {"0SOSUS", 'F'}, {"0SOSUT", 'F'}, {"0SOSUV", 'F'}, {"0SOSV(", 'F'}, {"0SOSVF", 'F'}, {"0SOSVO", 'F'}, {"0SOSVS", 'F'}, {"0SOSVU", 'F'}, {"0SOT(1", 'F'}, {"0SOT(E", 'F'}, {"0SOT(F", 'F'}, {"0SOT(N", 'F'}, {"0SOT(S", 'F'}, {"0SOT(T", 'F'}, {"0SOT(V", 'F'}, {"0SOU(E", 'F'}, {"0SOUEK", 'F'}, {"0SOUEN", 'F'}, {"0SOV", 'F'}, {"0SOV&(", 'F'}, {"0SOV&1", 'F'}, {"0SOV&E", 'F'}, {"0SOV&F", 'F'}, {"0SOV&K", 'F'}, {"0SOV&N", 'F'}, {"0SOV&S", 'F'}, {"0SOV&T", 'F'}, {"0SOV&U", 'F'}, {"0SOV&V", 'F'}, {"0SOV(E", 'F'}, {"0SOV(U", 'F'}, {"0SOV)&", 'F'}, {"0SOV),", 'F'}, {"0SOV);", 'F'}, {"0SOV)B", 'F'}, {"0SOV)C", 'F'}, {"0SOV)E", 'F'}, {"0SOV)K", 'F'}, {"0SOV)O", 'F'}, {"0SOV)U", 'F'}, {"0SOV,(", 'F'}, {"0SOV,1", 'F'}, {"0SOV,F", 'F'}, {"0SOV,N", 'F'}, {"0SOV,S", 'F'}, {"0SOV,V", 'F'}, {"0SOV;", 'F'}, {"0SOV;C", 'F'}, {"0SOV;E", 'F'}, {"0SOV;N", 'F'}, {"0SOV;T", 'F'}, {"0SOVA(", 'F'}, {"0SOVAF", 'F'}, {"0SOVAS", 'F'}, {"0SOVAT", 'F'}, {"0SOVAV", 'F'}, {"0SOVB(", 'F'}, {"0SOVB1", 'F'}, {"0SOVBE", 'F'}, {"0SOVBF", 'F'}, {"0SOVBN", 'F'}, {"0SOVBS", 'F'}, {"0SOVBV", 'F'}, {"0SOVC", 'F'}, {"0SOVE(", 'F'}, {"0SOVE1", 'F'}, {"0SOVEF", 'F'}, {"0SOVEK", 'F'}, {"0SOVEN", 'F'}, {"0SOVEO", 'F'}, {"0SOVES", 'F'}, {"0SOVEU", 'F'}, {"0SOVEV", 'F'}, {"0SOVF(", 'F'}, {"0SOVK(", 'F'}, {"0SOVK)", 'F'}, {"0SOVK1", 'F'}, {"0SOVKB", 'F'}, {"0SOVKF", 'F'}, {"0SOVKN", 'F'}, {"0SOVKS", 'F'}, {"0SOVKU", 'F'}, {"0SOVKV", 'F'}, {"0SOVO(", 'F'}, {"0SOVOF", 'F'}, {"0SOVOK", 'F'}, {"0SOVOS", 'F'}, {"0SOVOT", 'F'}, {"0SOVOU", 'F'}, {"0SOVS(", 'F'}, {"0SOVS1", 'F'}, {"0SOVSF", 'F'}, {"0SOVSO", 'F'}, {"0SOVSU", 'F'}, {"0SOVSV", 'F'}, {"0SOVU", 'F'}, {"0SOVU(", 'F'}, {"0SOVU1", 'F'}, {"0SOVU;", 'F'}, {"0SOVUC", 'F'}, {"0SOVUE", 'F'}, {"0SOVUF", 'F'}, {"0SOVUK", 'F'}, {"0SOVUN", 'F'}, {"0SOVUO", 'F'}, {"0SOVUS", 'F'}, {"0SOVUT", 'F'}, {"0SOVUV", 'F'}, {"0SU(1)", 'F'}, {"0SU(1O", 'F'}, {"0SU(E(", 'F'}, {"0SU(E1", 'F'}, {"0SU(EF", 'F'}, {"0SU(EK", 'F'}, {"0SU(EN", 'F'}, {"0SU(ES", 'F'}, {"0SU(EV", 'F'}, {"0SU(F(", 'F'}, {"0SU(N)", 'F'}, {"0SU(NO", 'F'}, {"0SU(S)", 'F'}, {"0SU(SO", 'F'}, {"0SU(V)", 'F'}, {"0SU(VO", 'F'}, {"0SU1,(", 'F'}, {"0SU1,F", 'F'}, {"0SU1,V", 'F'}, {"0SU1C", 'F'}, {"0SU1O(", 'F'}, {"0SU1OF", 'F'}, {"0SU1OS", 'F'}, {"0SU1OV", 'F'}, {"0SU;", 'F'}, {"0SU;C", 'F'}, {"0SUC", 'F'}, {"0SUE", 'F'}, {"0SUE(1", 'F'}, {"0SUE(E", 'F'}, {"0SUE(F", 'F'}, {"0SUE(N", 'F'}, {"0SUE(O", 'F'}, {"0SUE(S", 'F'}, {"0SUE(V", 'F'}, {"0SUE1", 'F'}, {"0SUE1&", 'F'}, {"0SUE1(", 'F'}, {"0SUE1)", 'F'}, {"0SUE1,", 'F'}, {"0SUE1;", 'F'}, {"0SUE1B", 'F'}, {"0SUE1C", 'F'}, {"0SUE1F", 'F'}, {"0SUE1K", 'F'}, {"0SUE1N", 'F'}, {"0SUE1O", 'F'}, {"0SUE1S", 'F'}, {"0SUE1U", 'F'}, {"0SUE1V", 'F'}, {"0SUE;", 'F'}, {"0SUE;C", 'F'}, {"0SUEC", 'F'}, {"0SUEF", 'F'}, {"0SUEF(", 'F'}, {"0SUEF,", 'F'}, {"0SUEF;", 'F'}, {"0SUEFC", 'F'}, {"0SUEK", 'F'}, {"0SUEK(", 'F'}, {"0SUEK1", 'F'}, {"0SUEK;", 'F'}, {"0SUEKC", 'F'}, {"0SUEKF", 'F'}, {"0SUEKN", 'F'}, {"0SUEKO", 'F'}, {"0SUEKS", 'F'}, {"0SUEKV", 'F'}, {"0SUEN", 'F'}, {"0SUEN&", 'F'}, {"0SUEN(", 'F'}, {"0SUEN)", 'F'}, {"0SUEN,", 'F'}, {"0SUEN1", 'F'}, {"0SUEN;", 'F'}, {"0SUENB", 'F'}, {"0SUENC", 'F'}, {"0SUENF", 'F'}, {"0SUENK", 'F'}, {"0SUENO", 'F'}, {"0SUENS", 'F'}, {"0SUENU", 'F'}, {"0SUEOK", 'F'}, {"0SUEON", 'F'}, {"0SUEOO", 'F'}, {"0SUES", 'F'}, {"0SUES&", 'F'}, {"0SUES(", 'F'}, {"0SUES)", 'F'}, {"0SUES,", 'F'}, {"0SUES1", 'F'}, {"0SUES;", 'F'}, {"0SUESB", 'F'}, {"0SUESC", 'F'}, {"0SUESF", 'F'}, {"0SUESK", 'F'}, {"0SUESO", 'F'}, {"0SUESU", 'F'}, {"0SUESV", 'F'}, {"0SUEV", 'F'}, {"0SUEV&", 'F'}, {"0SUEV(", 'F'}, {"0SUEV)", 'F'}, {"0SUEV,", 'F'}, {"0SUEV;", 'F'}, {"0SUEVB", 'F'}, {"0SUEVC", 'F'}, {"0SUEVF", 'F'}, {"0SUEVK", 'F'}, {"0SUEVN", 'F'}, {"0SUEVO", 'F'}, {"0SUEVS", 'F'}, {"0SUEVU", 'F'}, {"0SUF()", 'F'}, {"0SUF(1", 'F'}, {"0SUF(F", 'F'}, {"0SUF(N", 'F'}, {"0SUF(S", 'F'}, {"0SUF(V", 'F'}, {"0SUK(E", 'F'}, {"0SUN(1", 'F'}, {"0SUN(F", 'F'}, {"0SUN(S", 'F'}, {"0SUN(V", 'F'}, {"0SUN,(", 'F'}, {"0SUN,F", 'F'}, {"0SUN,V", 'F'}, {"0SUN1(", 'F'}, {"0SUN1,", 'F'}, {"0SUN1O", 'F'}, {"0SUNC", 'F'}, {"0SUNE(", 'F'}, {"0SUNE1", 'F'}, {"0SUNEF", 'F'}, {"0SUNEN", 'F'}, {"0SUNES", 'F'}, {"0SUNEV", 'F'}, {"0SUNF(", 'F'}, {"0SUNO(", 'F'}, {"0SUNOF", 'F'}, {"0SUNOS", 'F'}, {"0SUNOV", 'F'}, {"0SUNS(", 'F'}, {"0SUNS,", 'F'}, {"0SUNSO", 'F'}, {"0SUO(E", 'F'}, {"0SUON(", 'F'}, {"0SUON1", 'F'}, {"0SUONF", 'F'}, {"0SUONS", 'F'}, {"0SUS,(", 'F'}, {"0SUS,F", 'F'}, {"0SUS,V", 'F'}, {"0SUSC", 'F'}, {"0SUSO(", 'F'}, {"0SUSO1", 'F'}, {"0SUSOF", 'F'}, {"0SUSON", 'F'}, {"0SUSOS", 'F'}, {"0SUSOV", 'F'}, {"0SUTN(", 'F'}, {"0SUTN1", 'F'}, {"0SUTNF", 'F'}, {"0SUTNS", 'F'}, {"0SUV,(", 'F'}, {"0SUV,1", 'F'}, {"0SUV,F", 'F'}, {"0SUV,N", 'F'}, {"0SUV,S", 'F'}, {"0SUV,V", 'F'}, {"0SUVC", 'F'}, {"0SUVO(", 'F'}, {"0SUVOF", 'F'}, {"0SUVOS", 'F'}, {"0SVF()", 'F'}, {"0SVF(1", 'F'}, {"0SVF(F", 'F'}, {"0SVF(N", 'F'}, {"0SVF(S", 'F'}, {"0SVF(V", 'F'}, {"0SVO(1", 'F'}, {"0SVO(F", 'F'}, {"0SVO(N", 'F'}, {"0SVO(S", 'F'}, {"0SVO(V", 'F'}, {"0SVOF(", 'F'}, {"0SVOS(", 'F'}, {"0SVOS1", 'F'}, {"0SVOSF", 'F'}, {"0SVOSO", 'F'}, {"0SVOSU", 'F'}, {"0SVOSV", 'F'}, {"0SVS", 'F'}, {"0SVS;", 'F'}, {"0SVS;C", 'F'}, {"0SVSC", 'F'}, {"0SVSO(", 'F'}, {"0SVSO1", 'F'}, {"0SVSOF", 'F'}, {"0SVSON", 'F'}, {"0SVSOS", 'F'}, {"0SVSOV", 'F'}, {"0SVUE", 'F'}, {"0SVUE;", 'F'}, {"0SVUEC", 'F'}, {"0SVUEK", 'F'}, {"0T(1&(", 'F'}, {"0T(1&1", 'F'}, {"0T(1&F", 'F'}, {"0T(1&N", 'F'}, {"0T(1&S", 'F'}, {"0T(1&V", 'F'}, {"0T(1)&", 'F'}, {"0T(1)C", 'F'}, {"0T(1)F", 'F'}, {"0T(1)O", 'F'}, {"0T(1)U", 'F'}, {"0T(1F(", 'F'}, {"0T(1N)", 'F'}, {"0T(1O(", 'F'}, {"0T(1OF", 'F'}, {"0T(1OS", 'F'}, {"0T(1OT", 'F'}, {"0T(1OV", 'F'}, {"0T(1S)", 'F'}, {"0T(1V)", 'F'}, {"0T(1VO", 'F'}, {"0T(E(1", 'F'}, {"0T(E(E", 'F'}, {"0T(E(F", 'F'}, {"0T(E(N", 'F'}, {"0T(E(S", 'F'}, {"0T(E(V", 'F'}, {"0T(E1&", 'F'}, {"0T(E1)", 'F'}, {"0T(E1O", 'F'}, {"0T(EF(", 'F'}, {"0T(EK(", 'F'}, {"0T(EK1", 'F'}, {"0T(EKF", 'F'}, {"0T(EKN", 'F'}, {"0T(EKS", 'F'}, {"0T(EKT", 'F'}, {"0T(EKV", 'F'}, {"0T(EN&", 'F'}, {"0T(EN)", 'F'}, {"0T(ENO", 'F'}, {"0T(ES&", 'F'}, {"0T(ES)", 'F'}, {"0T(ESO", 'F'}, {"0T(ET(", 'F'}, {"0T(EV&", 'F'}, {"0T(EV)", 'F'}, {"0T(EVO", 'F'}, {"0T(F()", 'F'}, {"0T(F(1", 'F'}, {"0T(F(E", 'F'}, {"0T(F(F", 'F'}, {"0T(F(N", 'F'}, {"0T(F(S", 'F'}, {"0T(F(T", 'F'}, {"0T(F(V", 'F'}, {"0T(N&(", 'F'}, {"0T(N&1", 'F'}, {"0T(N&F", 'F'}, {"0T(N&N", 'F'}, {"0T(N&S", 'F'}, {"0T(N&V", 'F'}, {"0T(N(1", 'F'}, {"0T(N(F", 'F'}, {"0T(N(S", 'F'}, {"0T(N(V", 'F'}, {"0T(N)&", 'F'}, {"0T(N)C", 'F'}, {"0T(N)F", 'F'}, {"0T(N)O", 'F'}, {"0T(N)U", 'F'}, {"0T(N1)", 'F'}, {"0T(N1O", 'F'}, {"0T(NF(", 'F'}, {"0T(NO(", 'F'}, {"0T(NOF", 'F'}, {"0T(NOS", 'F'}, {"0T(NOT", 'F'}, {"0T(NOV", 'F'}, {"0T(NS)", 'F'}, {"0T(NSO", 'F'}, {"0T(S&(", 'F'}, {"0T(S&1", 'F'}, {"0T(S&F", 'F'}, {"0T(S&N", 'F'}, {"0T(S&S", 'F'}, {"0T(S&V", 'F'}, {"0T(S)&", 'F'}, {"0T(S)C", 'F'}, {"0T(S)F", 'F'}, {"0T(S)O", 'F'}, {"0T(S)U", 'F'}, {"0T(S1)", 'F'}, {"0T(S1O", 'F'}, {"0T(SF(", 'F'}, {"0T(SN)", 'F'}, {"0T(SNO", 'F'}, {"0T(SO(", 'F'}, {"0T(SO1", 'F'}, {"0T(SOF", 'F'}, {"0T(SON", 'F'}, {"0T(SOS", 'F'}, {"0T(SOT", 'F'}, {"0T(SOV", 'F'}, {"0T(SV)", 'F'}, {"0T(SVO", 'F'}, {"0T(T(1", 'F'}, {"0T(T(E", 'F'}, {"0T(T(F", 'F'}, {"0T(T(N", 'F'}, {"0T(T(S", 'F'}, {"0T(T(V", 'F'}, {"0T(V&(", 'F'}, {"0T(V&1", 'F'}, {"0T(V&F", 'F'}, {"0T(V&N", 'F'}, {"0T(V&S", 'F'}, {"0T(V&V", 'F'}, {"0T(V)&", 'F'}, {"0T(V)C", 'F'}, {"0T(V)F", 'F'}, {"0T(V)O", 'F'}, {"0T(V)U", 'F'}, {"0T(VF(", 'F'}, {"0T(VO(", 'F'}, {"0T(VOF", 'F'}, {"0T(VOS", 'F'}, {"0T(VOT", 'F'}, {"0T(VS)", 'F'}, {"0T(VSO", 'F'}, {"0T(VV)", 'F'}, {"0T1F(1", 'F'}, {"0T1F(F", 'F'}, {"0T1F(N", 'F'}, {"0T1F(S", 'F'}, {"0T1F(V", 'F'}, {"0T1O(1", 'F'}, {"0T1O(F", 'F'}, {"0T1O(N", 'F'}, {"0T1O(S", 'F'}, {"0T1O(V", 'F'}, {"0T1OF(", 'F'}, {"0T1OSF", 'F'}, {"0T1OSO", 'F'}, {"0T1OVF", 'F'}, {"0T1OVO", 'F'}, {"0TF()F", 'F'}, {"0TF()O", 'F'}, {"0TF(1)", 'F'}, {"0TF(1O", 'F'}, {"0TF(F(", 'F'}, {"0TF(N)", 'F'}, {"0TF(NO", 'F'}, {"0TF(S)", 'F'}, {"0TF(SO", 'F'}, {"0TF(V)", 'F'}, {"0TF(VO", 'F'}, {"0TN(1)", 'F'}, {"0TN(1O", 'F'}, {"0TN(F(", 'F'}, {"0TN(S)", 'F'}, {"0TN(SO", 'F'}, {"0TN(V)", 'F'}, {"0TN(VO", 'F'}, {"0TN1;", 'F'}, {"0TN1;C", 'F'}, {"0TN1O(", 'F'}, {"0TN1OF", 'F'}, {"0TN1OS", 'F'}, {"0TN1OV", 'F'}, {"0TNF()", 'F'}, {"0TNF(1", 'F'}, {"0TNF(F", 'F'}, {"0TNF(N", 'F'}, {"0TNF(S", 'F'}, {"0TNF(V", 'F'}, {"0TNO(1", 'F'}, {"0TNO(F", 'F'}, {"0TNO(N", 'F'}, {"0TNO(S", 'F'}, {"0TNO(V", 'F'}, {"0TNOF(", 'F'}, {"0TNOSF", 'F'}, {"0TNOSO", 'F'}, {"0TNOVF", 'F'}, {"0TNOVO", 'F'}, {"0TNS;", 'F'}, {"0TNS;C", 'F'}, {"0TNSO(", 'F'}, {"0TNSO1", 'F'}, {"0TNSOF", 'F'}, {"0TNSON", 'F'}, {"0TNSOS", 'F'}, {"0TNSOV", 'F'}, {"0TNV;", 'F'}, {"0TNVOS", 'F'}, {"0TO(1)", 'F'}, {"0TO(1O", 'F'}, {"0TO(F(", 'F'}, {"0TO(N)", 'F'}, {"0TO(NO", 'F'}, {"0TO(S)", 'F'}, {"0TO(SO", 'F'}, {"0TO(V)", 'F'}, {"0TO(VO", 'F'}, {"0TO1O(", 'F'}, {"0TO1OF", 'F'}, {"0TO1OS", 'F'}, {"0TO1OV", 'F'}, {"0TO1UE", 'F'}, {"0TOF()", 'F'}, {"0TOF(1", 'F'}, {"0TOF(F", 'F'}, {"0TOF(N", 'F'}, {"0TOF(S", 'F'}, {"0TOF(V", 'F'}, {"0TONO(", 'F'}, {"0TONOF", 'F'}, {"0TONOS", 'F'}, {"0TONOV", 'F'}, {"0TONUE", 'F'}, {"0TOSO(", 'F'}, {"0TOSO1", 'F'}, {"0TOSOF", 'F'}, {"0TOSON", 'F'}, {"0TOSOS", 'F'}, {"0TOSOV", 'F'}, {"0TOSUE", 'F'}, {"0TOVO(", 'F'}, {"0TOVOF", 'F'}, {"0TOVOS", 'F'}, {"0TOVUE", 'F'}, {"0TSF(1", 'F'}, {"0TSF(F", 'F'}, {"0TSF(N", 'F'}, {"0TSF(S", 'F'}, {"0TSF(V", 'F'}, {"0TSO(1", 'F'}, {"0TSO(F", 'F'}, {"0TSO(N", 'F'}, {"0TSO(S", 'F'}, {"0TSO(V", 'F'}, {"0TSO1F", 'F'}, {"0TSO1O", 'F'}, {"0TSOF(", 'F'}, {"0TSONF", 'F'}, {"0TSONO", 'F'}, {"0TSOSF", 'F'}, {"0TSOSO", 'F'}, {"0TSOVF", 'F'}, {"0TSOVO", 'F'}, {"0TVF(1", 'F'}, {"0TVF(F", 'F'}, {"0TVF(N", 'F'}, {"0TVF(S", 'F'}, {"0TVF(V", 'F'}, {"0TVO(1", 'F'}, {"0TVO(F", 'F'}, {"0TVO(N", 'F'}, {"0TVO(S", 'F'}, {"0TVO(V", 'F'}, {"0TVOF(", 'F'}, {"0TVOSF", 'F'}, {"0TVOSO", 'F'}, {"0U(E(1", 'F'}, {"0U(E(F", 'F'}, {"0U(E(K", 'F'}, {"0U(E(N", 'F'}, {"0U(E(S", 'F'}, {"0U(E(V", 'F'}, {"0U(E1)", 'F'}, {"0U(E1O", 'F'}, {"0U(EF(", 'F'}, {"0U(EK(", 'F'}, {"0U(EK1", 'F'}, {"0U(EKF", 'F'}, {"0U(EKN", 'F'}, {"0U(EKO", 'F'}, {"0U(EKS", 'F'}, {"0U(EKV", 'F'}, {"0U(EN)", 'F'}, {"0U(ENK", 'F'}, {"0U(ENO", 'F'}, {"0U(EOK", 'F'}, {"0U(ES)", 'F'}, {"0U(ESO", 'F'}, {"0U(EV)", 'F'}, {"0U(EVO", 'F'}, {"0UE(1)", 'F'}, {"0UE(1,", 'F'}, {"0UE(1O", 'F'}, {"0UE(F(", 'F'}, {"0UE(N)", 'F'}, {"0UE(N,", 'F'}, {"0UE(NO", 'F'}, {"0UE(S)", 'F'}, {"0UE(S,", 'F'}, {"0UE(SO", 'F'}, {"0UE(V)", 'F'}, {"0UE(V,", 'F'}, {"0UE(VO", 'F'}, {"0UE1", 'F'}, {"0UE1,(", 'F'}, {"0UE1,F", 'F'}, {"0UE1,V", 'F'}, {"0UE1;", 'F'}, {"0UE1;C", 'F'}, {"0UE1C", 'F'}, {"0UE1K(", 'F'}, {"0UE1K1", 'F'}, {"0UE1KF", 'F'}, {"0UE1KN", 'F'}, {"0UE1KS", 'F'}, {"0UE1KV", 'F'}, {"0UE1O(", 'F'}, {"0UE1OF", 'F'}, {"0UE1OS", 'F'}, {"0UE1OV", 'F'}, {"0UEF()", 'F'}, {"0UEF(1", 'F'}, {"0UEF(F", 'F'}, {"0UEF(N", 'F'}, {"0UEF(S", 'F'}, {"0UEF(V", 'F'}, {"0UEK(1", 'F'}, {"0UEK(F", 'F'}, {"0UEK(N", 'F'}, {"0UEK(S", 'F'}, {"0UEK(V", 'F'}, {"0UEK1", 'F'}, {"0UEK1,", 'F'}, {"0UEK1;", 'F'}, {"0UEK1C", 'F'}, {"0UEK1K", 'F'}, {"0UEK1O", 'F'}, {"0UEKF(", 'F'}, {"0UEKN", 'F'}, {"0UEKN(", 'F'}, {"0UEKN,", 'F'}, {"0UEKN;", 'F'}, {"0UEKNC", 'F'}, {"0UEKNK", 'F'}, {"0UEKS", 'F'}, {"0UEKS,", 'F'}, {"0UEKS;", 'F'}, {"0UEKSC", 'F'}, {"0UEKSK", 'F'}, {"0UEKSO", 'F'}, {"0UEKV", 'F'}, {"0UEKV,", 'F'}, {"0UEKV;", 'F'}, {"0UEKVC", 'F'}, {"0UEKVK", 'F'}, {"0UEKVO", 'F'}, {"0UEN()", 'F'}, {"0UEN,(", 'F'}, {"0UEN,F", 'F'}, {"0UEN,V", 'F'}, {"0UEN;", 'F'}, {"0UEN;C", 'F'}, {"0UENC", 'F'}, {"0UENK(", 'F'}, {"0UENK1", 'F'}, {"0UENKF", 'F'}, {"0UENKN", 'F'}, {"0UENKS", 'F'}, {"0UENKV", 'F'}, {"0UENO(", 'F'}, {"0UENOF", 'F'}, {"0UENOS", 'F'}, {"0UENOV", 'F'}, {"0UES", 'F'}, {"0UES,(", 'F'}, {"0UES,F", 'F'}, {"0UES,V", 'F'}, {"0UES;", 'F'}, {"0UES;C", 'F'}, {"0UESC", 'F'}, {"0UESK(", 'F'}, {"0UESK1", 'F'}, {"0UESKF", 'F'}, {"0UESKN", 'F'}, {"0UESKS", 'F'}, {"0UESKV", 'F'}, {"0UESO(", 'F'}, {"0UESO1", 'F'}, {"0UESOF", 'F'}, {"0UESON", 'F'}, {"0UESOS", 'F'}, {"0UESOV", 'F'}, {"0UEV", 'F'}, {"0UEV,(", 'F'}, {"0UEV,1", 'F'}, {"0UEV,F", 'F'}, {"0UEV,N", 'F'}, {"0UEV,S", 'F'}, {"0UEV,V", 'F'}, {"0UEV;", 'F'}, {"0UEV;C", 'F'}, {"0UEVC", 'F'}, {"0UEVK(", 'F'}, {"0UEVK1", 'F'}, {"0UEVKF", 'F'}, {"0UEVKN", 'F'}, {"0UEVKS", 'F'}, {"0UEVKV", 'F'}, {"0UEVO(", 'F'}, {"0UEVOF", 'F'}, {"0UEVOS", 'F'}, {"0UF(1O", 'F'}, {"0UF(F(", 'F'}, {"0UF(NO", 'F'}, {"0UF(SO", 'F'}, {"0UF(VO", 'F'}, {"0V&(1&", 'F'}, {"0V&(1)", 'F'}, {"0V&(1,", 'F'}, {"0V&(1O", 'F'}, {"0V&(E(", 'F'}, {"0V&(E1", 'F'}, {"0V&(EF", 'F'}, {"0V&(EK", 'F'}, {"0V&(EN", 'F'}, {"0V&(EO", 'F'}, {"0V&(ES", 'F'}, {"0V&(ET", 'F'}, {"0V&(EV", 'F'}, {"0V&(F(", 'F'}, {"0V&(N&", 'F'}, {"0V&(N)", 'F'}, {"0V&(N,", 'F'}, {"0V&(NO", 'F'}, {"0V&(S&", 'F'}, {"0V&(S)", 'F'}, {"0V&(S,", 'F'}, {"0V&(SO", 'F'}, {"0V&(T(", 'F'}, {"0V&(V&", 'F'}, {"0V&(V)", 'F'}, {"0V&(V,", 'F'}, {"0V&(VO", 'F'}, {"0V&1", 'F'}, {"0V&1&(", 'F'}, {"0V&1&1", 'F'}, {"0V&1&F", 'F'}, {"0V&1&N", 'F'}, {"0V&1&S", 'F'}, {"0V&1&V", 'F'}, {"0V&1)&", 'F'}, {"0V&1)C", 'F'}, {"0V&1)O", 'F'}, {"0V&1)U", 'F'}, {"0V&1;", 'F'}, {"0V&1;C", 'F'}, {"0V&1;E", 'F'}, {"0V&1;T", 'F'}, {"0V&1B(", 'F'}, {"0V&1B1", 'F'}, {"0V&1BF", 'F'}, {"0V&1BN", 'F'}, {"0V&1BS", 'F'}, {"0V&1BV", 'F'}, {"0V&1C", 'F'}, {"0V&1EK", 'F'}, {"0V&1EN", 'F'}, {"0V&1F(", 'F'}, {"0V&1K(", 'F'}, {"0V&1K1", 'F'}, {"0V&1KF", 'F'}, {"0V&1KN", 'F'}, {"0V&1KS", 'F'}, {"0V&1KV", 'F'}, {"0V&1O(", 'F'}, {"0V&1OF", 'F'}, {"0V&1OO", 'F'}, {"0V&1OS", 'F'}, {"0V&1OV", 'F'}, {"0V&1TN", 'F'}, {"0V&1U", 'F'}, {"0V&1U(", 'F'}, {"0V&1U;", 'F'}, {"0V&1UC", 'F'}, {"0V&1UE", 'F'}, {"0V&E(1", 'F'}, {"0V&E(F", 'F'}, {"0V&E(N", 'F'}, {"0V&E(O", 'F'}, {"0V&E(S", 'F'}, {"0V&E(V", 'F'}, {"0V&E1", 'F'}, {"0V&E1;", 'F'}, {"0V&E1C", 'F'}, {"0V&E1K", 'F'}, {"0V&E1O", 'F'}, {"0V&EF(", 'F'}, {"0V&EK(", 'F'}, {"0V&EK1", 'F'}, {"0V&EKF", 'F'}, {"0V&EKN", 'F'}, {"0V&EKS", 'F'}, {"0V&EKV", 'F'}, {"0V&EN", 'F'}, {"0V&EN;", 'F'}, {"0V&ENC", 'F'}, {"0V&ENK", 'F'}, {"0V&ENO", 'F'}, {"0V&ES", 'F'}, {"0V&ES;", 'F'}, {"0V&ESC", 'F'}, {"0V&ESK", 'F'}, {"0V&ESO", 'F'}, {"0V&EV", 'F'}, {"0V&EV;", 'F'}, {"0V&EVC", 'F'}, {"0V&EVK", 'F'}, {"0V&EVO", 'F'}, {"0V&F()", 'F'}, {"0V&F(1", 'F'}, {"0V&F(E", 'F'}, {"0V&F(F", 'F'}, {"0V&F(N", 'F'}, {"0V&F(S", 'F'}, {"0V&F(T", 'F'}, {"0V&F(V", 'F'}, {"0V&K&(", 'F'}, {"0V&K&1", 'F'}, {"0V&K&F", 'F'}, {"0V&K&N", 'F'}, {"0V&K&S", 'F'}, {"0V&K&V", 'F'}, {"0V&K(1", 'F'}, {"0V&K(F", 'F'}, {"0V&K(N", 'F'}, {"0V&K(S", 'F'}, {"0V&K(V", 'F'}, {"0V&K1O", 'F'}, {"0V&KF(", 'F'}, {"0V&KNK", 'F'}, {"0V&KO(", 'F'}, {"0V&KO1", 'F'}, {"0V&KOF", 'F'}, {"0V&KOK", 'F'}, {"0V&KON", 'F'}, {"0V&KOS", 'F'}, {"0V&KOV", 'F'}, {"0V&KSO", 'F'}, {"0V&KVO", 'F'}, {"0V&N", 'F'}, {"0V&N&(", 'F'}, {"0V&N&1", 'F'}, {"0V&N&F", 'F'}, {"0V&N&N", 'F'}, {"0V&N&S", 'F'}, {"0V&N&V", 'F'}, {"0V&N)&", 'F'}, {"0V&N)C", 'F'}, {"0V&N)O", 'F'}, {"0V&N)U", 'F'}, {"0V&N;", 'F'}, {"0V&N;C", 'F'}, {"0V&N;E", 'F'}, {"0V&N;T", 'F'}, {"0V&NB(", 'F'}, {"0V&NB1", 'F'}, {"0V&NBF", 'F'}, {"0V&NBN", 'F'}, {"0V&NBS", 'F'}, {"0V&NBV", 'F'}, {"0V&NC", 'F'}, {"0V&NEN", 'F'}, {"0V&NF(", 'F'}, {"0V&NK(", 'F'}, {"0V&NK1", 'F'}, {"0V&NKF", 'F'}, {"0V&NKN", 'F'}, {"0V&NKS", 'F'}, {"0V&NKV", 'F'}, {"0V&NO(", 'F'}, {"0V&NOF", 'F'}, {"0V&NOS", 'F'}, {"0V&NOV", 'F'}, {"0V&NTN", 'F'}, {"0V&NU", 'F'}, {"0V&NU(", 'F'}, {"0V&NU;", 'F'}, {"0V&NUC", 'F'}, {"0V&NUE", 'F'}, {"0V&S", 'F'}, {"0V&S&(", 'F'}, {"0V&S&1", 'F'}, {"0V&S&F", 'F'}, {"0V&S&N", 'F'}, {"0V&S&S", 'F'}, {"0V&S&V", 'F'}, {"0V&S)&", 'F'}, {"0V&S)C", 'F'}, {"0V&S)O", 'F'}, {"0V&S)U", 'F'}, {"0V&S1", 'F'}, {"0V&S1;", 'F'}, {"0V&S1C", 'F'}, {"0V&S1O", 'F'}, {"0V&S;", 'F'}, {"0V&S;C", 'F'}, {"0V&S;E", 'F'}, {"0V&S;T", 'F'}, {"0V&SB(", 'F'}, {"0V&SB1", 'F'}, {"0V&SBF", 'F'}, {"0V&SBN", 'F'}, {"0V&SBS", 'F'}, {"0V&SBV", 'F'}, {"0V&SC", 'F'}, {"0V&SEK", 'F'}, {"0V&SEN", 'F'}, {"0V&SF(", 'F'}, {"0V&SK(", 'F'}, {"0V&SK1", 'F'}, {"0V&SKF", 'F'}, {"0V&SKN", 'F'}, {"0V&SKS", 'F'}, {"0V&SKV", 'F'}, {"0V&SO(", 'F'}, {"0V&SO1", 'F'}, {"0V&SOF", 'F'}, {"0V&SON", 'F'}, {"0V&SOO", 'F'}, {"0V&SOS", 'F'}, {"0V&SOV", 'F'}, {"0V&STN", 'F'}, {"0V&SU", 'F'}, {"0V&SU(", 'F'}, {"0V&SU;", 'F'}, {"0V&SUC", 'F'}, {"0V&SUE", 'F'}, {"0V&SV", 'F'}, {"0V&SV;", 'F'}, {"0V&SVC", 'F'}, {"0V&SVO", 'F'}, {"0V&T(1", 'F'}, {"0V&T(E", 'F'}, {"0V&T(F", 'F'}, {"0V&T(N", 'F'}, {"0V&T(S", 'F'}, {"0V&T(V", 'F'}, {"0V&V", 'F'}, {"0V&V&(", 'F'}, {"0V&V&1", 'F'}, {"0V&V&F", 'F'}, {"0V&V&N", 'F'}, {"0V&V&S", 'F'}, {"0V&V&V", 'F'}, {"0V&V)&", 'F'}, {"0V&V)C", 'F'}, {"0V&V)O", 'F'}, {"0V&V)U", 'F'}, {"0V&V;", 'F'}, {"0V&V;C", 'F'}, {"0V&V;E", 'F'}, {"0V&V;T", 'F'}, {"0V&VB(", 'F'}, {"0V&VB1", 'F'}, {"0V&VBF", 'F'}, {"0V&VBN", 'F'}, {"0V&VBS", 'F'}, {"0V&VBV", 'F'}, {"0V&VC", 'F'}, {"0V&VEK", 'F'}, {"0V&VEN", 'F'}, {"0V&VF(", 'F'}, {"0V&VK(", 'F'}, {"0V&VK1", 'F'}, {"0V&VKF", 'F'}, {"0V&VKN", 'F'}, {"0V&VKS", 'F'}, {"0V&VKV", 'F'}, {"0V&VO(", 'F'}, {"0V&VOF", 'F'}, {"0V&VOO", 'F'}, {"0V&VOS", 'F'}, {"0V&VS", 'F'}, {"0V&VS;", 'F'}, {"0V&VSC", 'F'}, {"0V&VSO", 'F'}, {"0V&VTN", 'F'}, {"0V&VU", 'F'}, {"0V&VU(", 'F'}, {"0V&VU;", 'F'}, {"0V&VUC", 'F'}, {"0V&VUE", 'F'}, {"0V(EF(", 'F'}, {"0V(EKF", 'F'}, {"0V(EKN", 'F'}, {"0V(ENK", 'F'}, {"0V(U(E", 'F'}, {"0V)&(1", 'F'}, {"0V)&(E", 'F'}, {"0V)&(F", 'F'}, {"0V)&(N", 'F'}, {"0V)&(S", 'F'}, {"0V)&(V", 'F'}, {"0V)&1", 'F'}, {"0V)&1&", 'F'}, {"0V)&1)", 'F'}, {"0V)&1;", 'F'}, {"0V)&1B", 'F'}, {"0V)&1C", 'F'}, {"0V)&1F", 'F'}, {"0V)&1O", 'F'}, {"0V)&1U", 'F'}, {"0V)&F(", 'F'}, {"0V)&N", 'F'}, {"0V)&N&", 'F'}, {"0V)&N)", 'F'}, {"0V)&N;", 'F'}, {"0V)&NB", 'F'}, {"0V)&NC", 'F'}, {"0V)&NF", 'F'}, {"0V)&NO", 'F'}, {"0V)&NU", 'F'}, {"0V)&S", 'F'}, {"0V)&S&", 'F'}, {"0V)&S)", 'F'}, {"0V)&S;", 'F'}, {"0V)&SB", 'F'}, {"0V)&SC", 'F'}, {"0V)&SF", 'F'}, {"0V)&SO", 'F'}, {"0V)&SU", 'F'}, {"0V)&V", 'F'}, {"0V)&V&", 'F'}, {"0V)&V)", 'F'}, {"0V)&V;", 'F'}, {"0V)&VB", 'F'}, {"0V)&VC", 'F'}, {"0V)&VF", 'F'}, {"0V)&VO", 'F'}, {"0V)&VU", 'F'}, {"0V),(1", 'F'}, {"0V),(F", 'F'}, {"0V),(N", 'F'}, {"0V),(S", 'F'}, {"0V),(V", 'F'}, {"0V);E(", 'F'}, {"0V);E1", 'F'}, {"0V);EF", 'F'}, {"0V);EK", 'F'}, {"0V);EN", 'F'}, {"0V);EO", 'F'}, {"0V);ES", 'F'}, {"0V);EV", 'F'}, {"0V);T(", 'F'}, {"0V);T1", 'F'}, {"0V);TF", 'F'}, {"0V);TK", 'F'}, {"0V);TN", 'F'}, {"0V);TO", 'F'}, {"0V);TS", 'F'}, {"0V);TV", 'F'}, {"0V)B(1", 'F'}, {"0V)B(F", 'F'}, {"0V)B(N", 'F'}, {"0V)B(S", 'F'}, {"0V)B(V", 'F'}, {"0V)B1", 'F'}, {"0V)B1&", 'F'}, {"0V)B1;", 'F'}, {"0V)B1C", 'F'}, {"0V)B1K", 'F'}, {"0V)B1N", 'F'}, {"0V)B1O", 'F'}, {"0V)B1U", 'F'}, {"0V)BF(", 'F'}, {"0V)BN", 'F'}, {"0V)BN&", 'F'}, {"0V)BN;", 'F'}, {"0V)BNC", 'F'}, {"0V)BNK", 'F'}, {"0V)BNO", 'F'}, {"0V)BNU", 'F'}, {"0V)BS", 'F'}, {"0V)BS&", 'F'}, {"0V)BS;", 'F'}, {"0V)BSC", 'F'}, {"0V)BSK", 'F'}, {"0V)BSO", 'F'}, {"0V)BSU", 'F'}, {"0V)BV", 'F'}, {"0V)BV&", 'F'}, {"0V)BV;", 'F'}, {"0V)BVC", 'F'}, {"0V)BVK", 'F'}, {"0V)BVO", 'F'}, {"0V)BVU", 'F'}, {"0V)C", 'F'}, {"0V)E(1", 'F'}, {"0V)E(F", 'F'}, {"0V)E(N", 'F'}, {"0V)E(S", 'F'}, {"0V)E(V", 'F'}, {"0V)E1C", 'F'}, {"0V)E1O", 'F'}, {"0V)EF(", 'F'}, {"0V)EK(", 'F'}, {"0V)EK1", 'F'}, {"0V)EKF", 'F'}, {"0V)EKN", 'F'}, {"0V)EKS", 'F'}, {"0V)EKV", 'F'}, {"0V)ENC", 'F'}, {"0V)ENO", 'F'}, {"0V)ESC", 'F'}, {"0V)ESO", 'F'}, {"0V)EVC", 'F'}, {"0V)EVO", 'F'}, {"0V)K(1", 'F'}, {"0V)K(F", 'F'}, {"0V)K(N", 'F'}, {"0V)K(S", 'F'}, {"0V)K(V", 'F'}, {"0V)K1&", 'F'}, {"0V)K1;", 'F'}, {"0V)K1B", 'F'}, {"0V)K1E", 'F'}, {"0V)K1O", 'F'}, {"0V)K1U", 'F'}, {"0V)KB(", 'F'}, {"0V)KB1", 'F'}, {"0V)KBF", 'F'}, {"0V)KBN", 'F'}, {"0V)KBS", 'F'}, {"0V)KBV", 'F'}, {"0V)KF(", 'F'}, {"0V)KN&", 'F'}, {"0V)KN;", 'F'}, {"0V)KNB", 'F'}, {"0V)KNE", 'F'}, {"0V)KNK", 'F'}, {"0V)KNU", 'F'}, {"0V)KS&", 'F'}, {"0V)KS;", 'F'}, {"0V)KSB", 'F'}, {"0V)KSE", 'F'}, {"0V)KSO", 'F'}, {"0V)KSU", 'F'}, {"0V)KUE", 'F'}, {"0V)KV&", 'F'}, {"0V)KV;", 'F'}, {"0V)KVB", 'F'}, {"0V)KVE", 'F'}, {"0V)KVO", 'F'}, {"0V)KVU", 'F'}, {"0V)O(1", 'F'}, {"0V)O(E", 'F'}, {"0V)O(F", 'F'}, {"0V)O(N", 'F'}, {"0V)O(S", 'F'}, {"0V)O(T", 'F'}, {"0V)O(V", 'F'}, {"0V)O1", 'F'}, {"0V)O1&", 'F'}, {"0V)O1)", 'F'}, {"0V)O1;", 'F'}, {"0V)O1B", 'F'}, {"0V)O1C", 'F'}, {"0V)O1K", 'F'}, {"0V)O1O", 'F'}, {"0V)O1U", 'F'}, {"0V)OF(", 'F'}, {"0V)ON", 'F'}, {"0V)ON&", 'F'}, {"0V)ON)", 'F'}, {"0V)ON;", 'F'}, {"0V)ONB", 'F'}, {"0V)ONC", 'F'}, {"0V)ONK", 'F'}, {"0V)ONO", 'F'}, {"0V)ONU", 'F'}, {"0V)OS", 'F'}, {"0V)OS&", 'F'}, {"0V)OS)", 'F'}, {"0V)OS;", 'F'}, {"0V)OSB", 'F'}, {"0V)OSC", 'F'}, {"0V)OSK", 'F'}, {"0V)OSO", 'F'}, {"0V)OSU", 'F'}, {"0V)OV", 'F'}, {"0V)OV&", 'F'}, {"0V)OV)", 'F'}, {"0V)OV;", 'F'}, {"0V)OVB", 'F'}, {"0V)OVC", 'F'}, {"0V)OVK", 'F'}, {"0V)OVO", 'F'}, {"0V)OVU", 'F'}, {"0V)U(E", 'F'}, {"0V)UE(", 'F'}, {"0V)UE1", 'F'}, {"0V)UEF", 'F'}, {"0V)UEK", 'F'}, {"0V)UEN", 'F'}, {"0V)UES", 'F'}, {"0V)UEV", 'F'}, {"0V,(1)", 'F'}, {"0V,(1O", 'F'}, {"0V,(E(", 'F'}, {"0V,(E1", 'F'}, {"0V,(EF", 'F'}, {"0V,(EK", 'F'}, {"0V,(EN", 'F'}, {"0V,(ES", 'F'}, {"0V,(EV", 'F'}, {"0V,(F(", 'F'}, {"0V,(N)", 'F'}, {"0V,(NO", 'F'}, {"0V,(S)", 'F'}, {"0V,(SO", 'F'}, {"0V,(V)", 'F'}, {"0V,(VO", 'F'}, {"0V,1),", 'F'}, {"0V,1)O", 'F'}, {"0V,1B(", 'F'}, {"0V,1B1", 'F'}, {"0V,1BF", 'F'}, {"0V,1BN", 'F'}, {"0V,1BS", 'F'}, {"0V,1BV", 'F'}, {"0V,1O(", 'F'}, {"0V,1OF", 'F'}, {"0V,1OS", 'F'}, {"0V,1OV", 'F'}, {"0V,1UE", 'F'}, {"0V,F()", 'F'}, {"0V,F(1", 'F'}, {"0V,F(F", 'F'}, {"0V,F(N", 'F'}, {"0V,F(S", 'F'}, {"0V,F(T", 'F'}, {"0V,F(V", 'F'}, {"0V,N),", 'F'}, {"0V,N)O", 'F'}, {"0V,NB(", 'F'}, {"0V,NB1", 'F'}, {"0V,NBF", 'F'}, {"0V,NBN", 'F'}, {"0V,NBS", 'F'}, {"0V,NBV", 'F'}, {"0V,NO(", 'F'}, {"0V,NOF", 'F'}, {"0V,NOS", 'F'}, {"0V,NOV", 'F'}, {"0V,NUE", 'F'}, {"0V,S),", 'F'}, {"0V,S)O", 'F'}, {"0V,SB(", 'F'}, {"0V,SB1", 'F'}, {"0V,SBF", 'F'}, {"0V,SBN", 'F'}, {"0V,SBS", 'F'}, {"0V,SBV", 'F'}, {"0V,SO(", 'F'}, {"0V,SO1", 'F'}, {"0V,SOF", 'F'}, {"0V,SON", 'F'}, {"0V,SOS", 'F'}, {"0V,SOV", 'F'}, {"0V,SUE", 'F'}, {"0V,V),", 'F'}, {"0V,V)O", 'F'}, {"0V,VB(", 'F'}, {"0V,VB1", 'F'}, {"0V,VBF", 'F'}, {"0V,VBN", 'F'}, {"0V,VBS", 'F'}, {"0V,VBV", 'F'}, {"0V,VO(", 'F'}, {"0V,VOF", 'F'}, {"0V,VOS", 'F'}, {"0V,VUE", 'F'}, {"0V;E(1", 'F'}, {"0V;E(E", 'F'}, {"0V;E(F", 'F'}, {"0V;E(N", 'F'}, {"0V;E(S", 'F'}, {"0V;E(V", 'F'}, {"0V;E1,", 'F'}, {"0V;E1;", 'F'}, {"0V;E1C", 'F'}, {"0V;E1K", 'F'}, {"0V;E1O", 'F'}, {"0V;E1T", 'F'}, {"0V;EF(", 'F'}, {"0V;EK(", 'F'}, {"0V;EK1", 'F'}, {"0V;EKF", 'F'}, {"0V;EKN", 'F'}, {"0V;EKO", 'F'}, {"0V;EKS", 'F'}, {"0V;EKV", 'F'}, {"0V;EN,", 'F'}, {"0V;EN;", 'F'}, {"0V;ENC", 'F'}, {"0V;ENE", 'F'}, {"0V;ENK", 'F'}, {"0V;ENO", 'F'}, {"0V;ENT", 'F'}, {"0V;EO(", 'F'}, {"0V;ES,", 'F'}, {"0V;ES;", 'F'}, {"0V;ESC", 'F'}, {"0V;ESK", 'F'}, {"0V;ESO", 'F'}, {"0V;EST", 'F'}, {"0V;EV,", 'F'}, {"0V;EV;", 'F'}, {"0V;EVC", 'F'}, {"0V;EVK", 'F'}, {"0V;EVO", 'F'}, {"0V;EVT", 'F'}, {"0V;N:T", 'F'}, {"0V;T(1", 'F'}, {"0V;T(E", 'F'}, {"0V;T(F", 'F'}, {"0V;T(N", 'F'}, {"0V;T(S", 'F'}, {"0V;T(V", 'F'}, {"0V;T1,", 'F'}, {"0V;T1;", 'F'}, {"0V;T1C", 'F'}, {"0V;T1F", 'F'}, {"0V;T1K", 'F'}, {"0V;T1O", 'F'}, {"0V;T1T", 'F'}, {"0V;T;", 'F'}, {"0V;T;C", 'F'}, {"0V;TF(", 'F'}, {"0V;TK(", 'F'}, {"0V;TK1", 'F'}, {"0V;TKF", 'F'}, {"0V;TKK", 'F'}, {"0V;TKN", 'F'}, {"0V;TKO", 'F'}, {"0V;TKS", 'F'}, {"0V;TKV", 'F'}, {"0V;TN(", 'F'}, {"0V;TN,", 'F'}, {"0V;TN1", 'F'}, {"0V;TN;", 'F'}, {"0V;TNC", 'F'}, {"0V;TNE", 'F'}, {"0V;TNF", 'F'}, {"0V;TNK", 'F'}, {"0V;TNN", 'F'}, {"0V;TNO", 'F'}, {"0V;TNS", 'F'}, {"0V;TNT", 'F'}, {"0V;TNV", 'F'}, {"0V;TO(", 'F'}, {"0V;TS,", 'F'}, {"0V;TS;", 'F'}, {"0V;TSC", 'F'}, {"0V;TSF", 'F'}, {"0V;TSK", 'F'}, {"0V;TSO", 'F'}, {"0V;TST", 'F'}, {"0V;TT(", 'F'}, {"0V;TT1", 'F'}, {"0V;TTF", 'F'}, {"0V;TTN", 'F'}, {"0V;TTS", 'F'}, {"0V;TTV", 'F'}, {"0V;TV,", 'F'}, {"0V;TV;", 'F'}, {"0V;TVC", 'F'}, {"0V;TVF", 'F'}, {"0V;TVK", 'F'}, {"0V;TVO", 'F'}, {"0V;TVT", 'F'}, {"0VA(F(", 'F'}, {"0VA(N)", 'F'}, {"0VA(NO", 'F'}, {"0VA(S)", 'F'}, {"0VA(SO", 'F'}, {"0VA(V)", 'F'}, {"0VA(VO", 'F'}, {"0VAF()", 'F'}, {"0VAF(1", 'F'}, {"0VAF(F", 'F'}, {"0VAF(N", 'F'}, {"0VAF(S", 'F'}, {"0VAF(V", 'F'}, {"0VASO(", 'F'}, {"0VASO1", 'F'}, {"0VASOF", 'F'}, {"0VASON", 'F'}, {"0VASOS", 'F'}, {"0VASOV", 'F'}, {"0VASUE", 'F'}, {"0VATO(", 'F'}, {"0VATO1", 'F'}, {"0VATOF", 'F'}, {"0VATON", 'F'}, {"0VATOS", 'F'}, {"0VATOV", 'F'}, {"0VATUE", 'F'}, {"0VAVO(", 'F'}, {"0VAVOF", 'F'}, {"0VAVOS", 'F'}, {"0VAVUE", 'F'}, {"0VB(1)", 'F'}, {"0VB(1O", 'F'}, {"0VB(F(", 'F'}, {"0VB(N)", 'F'}, {"0VB(NO", 'F'}, {"0VB(S)", 'F'}, {"0VB(SO", 'F'}, {"0VB(V)", 'F'}, {"0VB(VO", 'F'}, {"0VB1", 'F'}, {"0VB1&(", 'F'}, {"0VB1&1", 'F'}, {"0VB1&F", 'F'}, {"0VB1&N", 'F'}, {"0VB1&S", 'F'}, {"0VB1&V", 'F'}, {"0VB1,(", 'F'}, {"0VB1,F", 'F'}, {"0VB1,V", 'F'}, {"0VB1;", 'F'}, {"0VB1;C", 'F'}, {"0VB1B(", 'F'}, {"0VB1B1", 'F'}, {"0VB1BF", 'F'}, {"0VB1BN", 'F'}, {"0VB1BS", 'F'}, {"0VB1BV", 'F'}, {"0VB1C", 'F'}, {"0VB1K(", 'F'}, {"0VB1K1", 'F'}, {"0VB1KF", 'F'}, {"0VB1KN", 'F'}, {"0VB1KS", 'F'}, {"0VB1KV", 'F'}, {"0VB1O(", 'F'}, {"0VB1OF", 'F'}, {"0VB1OS", 'F'}, {"0VB1OV", 'F'}, {"0VB1U(", 'F'}, {"0VB1UE", 'F'}, {"0VBE(1", 'F'}, {"0VBE(F", 'F'}, {"0VBE(N", 'F'}, {"0VBE(S", 'F'}, {"0VBE(V", 'F'}, {"0VBEK(", 'F'}, {"0VBF()", 'F'}, {"0VBF(1", 'F'}, {"0VBF(F", 'F'}, {"0VBF(N", 'F'}, {"0VBF(S", 'F'}, {"0VBF(V", 'F'}, {"0VBN", 'F'}, {"0VBN&(", 'F'}, {"0VBN&1", 'F'}, {"0VBN&F", 'F'}, {"0VBN&N", 'F'}, {"0VBN&S", 'F'}, {"0VBN&V", 'F'}, {"0VBN,(", 'F'}, {"0VBN,F", 'F'}, {"0VBN,V", 'F'}, {"0VBN;", 'F'}, {"0VBN;C", 'F'}, {"0VBNB(", 'F'}, {"0VBNB1", 'F'}, {"0VBNBF", 'F'}, {"0VBNBN", 'F'}, {"0VBNBS", 'F'}, {"0VBNBV", 'F'}, {"0VBNC", 'F'}, {"0VBNK(", 'F'}, {"0VBNK1", 'F'}, {"0VBNKF", 'F'}, {"0VBNKN", 'F'}, {"0VBNKS", 'F'}, {"0VBNKV", 'F'}, {"0VBNO(", 'F'}, {"0VBNOF", 'F'}, {"0VBNOS", 'F'}, {"0VBNOV", 'F'}, {"0VBNU(", 'F'}, {"0VBNUE", 'F'}, {"0VBS", 'F'}, {"0VBS&(", 'F'}, {"0VBS&1", 'F'}, {"0VBS&F", 'F'}, {"0VBS&N", 'F'}, {"0VBS&S", 'F'}, {"0VBS&V", 'F'}, {"0VBS,(", 'F'}, {"0VBS,F", 'F'}, {"0VBS,V", 'F'}, {"0VBS;", 'F'}, {"0VBS;C", 'F'}, {"0VBSB(", 'F'}, {"0VBSB1", 'F'}, {"0VBSBF", 'F'}, {"0VBSBN", 'F'}, {"0VBSBS", 'F'}, {"0VBSBV", 'F'}, {"0VBSC", 'F'}, {"0VBSK(", 'F'}, {"0VBSK1", 'F'}, {"0VBSKF", 'F'}, {"0VBSKN", 'F'}, {"0VBSKS", 'F'}, {"0VBSKV", 'F'}, {"0VBSO(", 'F'}, {"0VBSO1", 'F'}, {"0VBSOF", 'F'}, {"0VBSON", 'F'}, {"0VBSOS", 'F'}, {"0VBSOV", 'F'}, {"0VBSU(", 'F'}, {"0VBSUE", 'F'}, {"0VBV", 'F'}, {"0VBV&(", 'F'}, {"0VBV&1", 'F'}, {"0VBV&F", 'F'}, {"0VBV&N", 'F'}, {"0VBV&S", 'F'}, {"0VBV&V", 'F'}, {"0VBV,(", 'F'}, {"0VBV,1", 'F'}, {"0VBV,F", 'F'}, {"0VBV,N", 'F'}, {"0VBV,S", 'F'}, {"0VBV,V", 'F'}, {"0VBV;", 'F'}, {"0VBV;C", 'F'}, {"0VBVB(", 'F'}, {"0VBVB1", 'F'}, {"0VBVBF", 'F'}, {"0VBVBN", 'F'}, {"0VBVBS", 'F'}, {"0VBVBV", 'F'}, {"0VBVC", 'F'}, {"0VBVK(", 'F'}, {"0VBVK1", 'F'}, {"0VBVKF", 'F'}, {"0VBVKN", 'F'}, {"0VBVKS", 'F'}, {"0VBVKV", 'F'}, {"0VBVO(", 'F'}, {"0VBVOF", 'F'}, {"0VBVOS", 'F'}, {"0VBVU(", 'F'}, {"0VBVUE", 'F'}, {"0VC", 'F'}, {"0VE(1)", 'F'}, {"0VE(1O", 'F'}, {"0VE(F(", 'F'}, {"0VE(N)", 'F'}, {"0VE(NO", 'F'}, {"0VE(S)", 'F'}, {"0VE(SO", 'F'}, {"0VE(V)", 'F'}, {"0VE(VO", 'F'}, {"0VE1C", 'F'}, {"0VE1O(", 'F'}, {"0VE1OF", 'F'}, {"0VE1OS", 'F'}, {"0VE1OV", 'F'}, {"0VE1UE", 'F'}, {"0VEF()", 'F'}, {"0VEF(1", 'F'}, {"0VEF(F", 'F'}, {"0VEF(N", 'F'}, {"0VEF(S", 'F'}, {"0VEF(V", 'F'}, {"0VEK(1", 'F'}, {"0VEK(E", 'F'}, {"0VEK(F", 'F'}, {"0VEK(N", 'F'}, {"0VEK(S", 'F'}, {"0VEK(V", 'F'}, {"0VEK1C", 'F'}, {"0VEK1O", 'F'}, {"0VEK1U", 'F'}, {"0VEKF(", 'F'}, {"0VEKNC", 'F'}, {"0VEKNE", 'F'}, {"0VEKNU", 'F'}, {"0VEKOK", 'F'}, {"0VEKSC", 'F'}, {"0VEKSO", 'F'}, {"0VEKSU", 'F'}, {"0VEKU(", 'F'}, {"0VEKU1", 'F'}, {"0VEKUE", 'F'}, {"0VEKUF", 'F'}, {"0VEKUN", 'F'}, {"0VEKUS", 'F'}, {"0VEKUV", 'F'}, {"0VEKVC", 'F'}, {"0VEKVO", 'F'}, {"0VEKVU", 'F'}, {"0VENC", 'F'}, {"0VENEN", 'F'}, {"0VENO(", 'F'}, {"0VENOF", 'F'}, {"0VENOS", 'F'}, {"0VENOV", 'F'}, {"0VENUE", 'F'}, {"0VEOKN", 'F'}, {"0VESC", 'F'}, {"0VESO(", 'F'}, {"0VESO1", 'F'}, {"0VESOF", 'F'}, {"0VESON", 'F'}, {"0VESOS", 'F'}, {"0VESOV", 'F'}, {"0VESUE", 'F'}, {"0VEU(1", 'F'}, {"0VEU(F", 'F'}, {"0VEU(N", 'F'}, {"0VEU(S", 'F'}, {"0VEU(V", 'F'}, {"0VEU1,", 'F'}, {"0VEU1C", 'F'}, {"0VEU1O", 'F'}, {"0VEUEF", 'F'}, {"0VEUEK", 'F'}, {"0VEUF(", 'F'}, {"0VEUN,", 'F'}, {"0VEUNC", 'F'}, {"0VEUNO", 'F'}, {"0VEUS,", 'F'}, {"0VEUSC", 'F'}, {"0VEUSO", 'F'}, {"0VEUV,", 'F'}, {"0VEUVC", 'F'}, {"0VEUVO", 'F'}, {"0VEVC", 'F'}, {"0VEVO(", 'F'}, {"0VEVOF", 'F'}, {"0VEVOS", 'F'}, {"0VEVUE", 'F'}, {"0VF()1", 'F'}, {"0VF()F", 'F'}, {"0VF()K", 'F'}, {"0VF()N", 'F'}, {"0VF()O", 'F'}, {"0VF()S", 'F'}, {"0VF()U", 'F'}, {"0VF()V", 'F'}, {"0VF(1)", 'F'}, {"0VF(1N", 'F'}, {"0VF(1O", 'F'}, {"0VF(E(", 'F'}, {"0VF(E1", 'F'}, {"0VF(EF", 'F'}, {"0VF(EK", 'F'}, {"0VF(EN", 'F'}, {"0VF(ES", 'F'}, {"0VF(EV", 'F'}, {"0VF(F(", 'F'}, {"0VF(N)", 'F'}, {"0VF(N,", 'F'}, {"0VF(NO", 'F'}, {"0VF(S)", 'F'}, {"0VF(SO", 'F'}, {"0VF(V)", 'F'}, {"0VF(VO", 'F'}, {"0VK(1)", 'F'}, {"0VK(1O", 'F'}, {"0VK(F(", 'F'}, {"0VK(N)", 'F'}, {"0VK(NO", 'F'}, {"0VK(S)", 'F'}, {"0VK(SO", 'F'}, {"0VK(V)", 'F'}, {"0VK(VO", 'F'}, {"0VK)&(", 'F'}, {"0VK)&1", 'F'}, {"0VK)&F", 'F'}, {"0VK)&N", 'F'}, {"0VK)&S", 'F'}, {"0VK)&V", 'F'}, {"0VK);E", 'F'}, {"0VK);T", 'F'}, {"0VK)B(", 'F'}, {"0VK)B1", 'F'}, {"0VK)BF", 'F'}, {"0VK)BN", 'F'}, {"0VK)BS", 'F'}, {"0VK)BV", 'F'}, {"0VK)E(", 'F'}, {"0VK)E1", 'F'}, {"0VK)EF", 'F'}, {"0VK)EK", 'F'}, {"0VK)EN", 'F'}, {"0VK)ES", 'F'}, {"0VK)EV", 'F'}, {"0VK)OF", 'F'}, {"0VK)UE", 'F'}, {"0VK1", 'F'}, {"0VK1&(", 'F'}, {"0VK1&1", 'F'}, {"0VK1&F", 'F'}, {"0VK1&N", 'F'}, {"0VK1&S", 'F'}, {"0VK1&V", 'F'}, {"0VK1;", 'F'}, {"0VK1;C", 'F'}, {"0VK1;E", 'F'}, {"0VK1;T", 'F'}, {"0VK1B(", 'F'}, {"0VK1B1", 'F'}, {"0VK1BF", 'F'}, {"0VK1BN", 'F'}, {"0VK1BS", 'F'}, {"0VK1BV", 'F'}, {"0VK1C", 'F'}, {"0VK1E(", 'F'}, {"0VK1E1", 'F'}, {"0VK1EF", 'F'}, {"0VK1EK", 'F'}, {"0VK1EN", 'F'}, {"0VK1ES", 'F'}, {"0VK1EV", 'F'}, {"0VK1O(", 'F'}, {"0VK1OF", 'F'}, {"0VK1OS", 'F'}, {"0VK1OV", 'F'}, {"0VK1U(", 'F'}, {"0VK1UE", 'F'}, {"0VKF()", 'F'}, {"0VKF(1", 'F'}, {"0VKF(F", 'F'}, {"0VKF(N", 'F'}, {"0VKF(S", 'F'}, {"0VKF(V", 'F'}, {"0VKN", 'F'}, {"0VKN&(", 'F'}, {"0VKN&1", 'F'}, {"0VKN&F", 'F'}, {"0VKN&N", 'F'}, {"0VKN&S", 'F'}, {"0VKN&V", 'F'}, {"0VKN;", 'F'}, {"0VKN;C", 'F'}, {"0VKN;E", 'F'}, {"0VKN;T", 'F'}, {"0VKNB(", 'F'}, {"0VKNB1", 'F'}, {"0VKNBF", 'F'}, {"0VKNBN", 'F'}, {"0VKNBS", 'F'}, {"0VKNBV", 'F'}, {"0VKNC", 'F'}, {"0VKNE(", 'F'}, {"0VKNE1", 'F'}, {"0VKNEF", 'F'}, {"0VKNEN", 'F'}, {"0VKNES", 'F'}, {"0VKNEV", 'F'}, {"0VKNU(", 'F'}, {"0VKNUE", 'F'}, {"0VKS", 'F'}, {"0VKS&(", 'F'}, {"0VKS&1", 'F'}, {"0VKS&F", 'F'}, {"0VKS&N", 'F'}, {"0VKS&S", 'F'}, {"0VKS&V", 'F'}, {"0VKS;", 'F'}, {"0VKS;C", 'F'}, {"0VKS;E", 'F'}, {"0VKS;T", 'F'}, {"0VKSB(", 'F'}, {"0VKSB1", 'F'}, {"0VKSBF", 'F'}, {"0VKSBN", 'F'}, {"0VKSBS", 'F'}, {"0VKSBV", 'F'}, {"0VKSC", 'F'}, {"0VKSE(", 'F'}, {"0VKSE1", 'F'}, {"0VKSEF", 'F'}, {"0VKSEK", 'F'}, {"0VKSEN", 'F'}, {"0VKSES", 'F'}, {"0VKSEV", 'F'}, {"0VKSO(", 'F'}, {"0VKSO1", 'F'}, {"0VKSOF", 'F'}, {"0VKSON", 'F'}, {"0VKSOS", 'F'}, {"0VKSOV", 'F'}, {"0VKSU(", 'F'}, {"0VKSUE", 'F'}, {"0VKUE(", 'F'}, {"0VKUE1", 'F'}, {"0VKUEF", 'F'}, {"0VKUEK", 'F'}, {"0VKUEN", 'F'}, {"0VKUES", 'F'}, {"0VKUEV", 'F'}, {"0VKV", 'F'}, {"0VKV&(", 'F'}, {"0VKV&1", 'F'}, {"0VKV&F", 'F'}, {"0VKV&N", 'F'}, {"0VKV&S", 'F'}, {"0VKV&V", 'F'}, {"0VKV;", 'F'}, {"0VKV;C", 'F'}, {"0VKV;E", 'F'}, {"0VKV;T", 'F'}, {"0VKVB(", 'F'}, {"0VKVB1", 'F'}, {"0VKVBF", 'F'}, {"0VKVBN", 'F'}, {"0VKVBS", 'F'}, {"0VKVBV", 'F'}, {"0VKVC", 'F'}, {"0VKVE(", 'F'}, {"0VKVE1", 'F'}, {"0VKVEF", 'F'}, {"0VKVEK", 'F'}, {"0VKVEN", 'F'}, {"0VKVES", 'F'}, {"0VKVEV", 'F'}, {"0VKVO(", 'F'}, {"0VKVOF", 'F'}, {"0VKVOS", 'F'}, {"0VKVU(", 'F'}, {"0VKVUE", 'F'}, {"0VO(1&", 'F'}, {"0VO(1)", 'F'}, {"0VO(1,", 'F'}, {"0VO(1O", 'F'}, {"0VO(E(", 'F'}, {"0VO(E1", 'F'}, {"0VO(EE", 'F'}, {"0VO(EF", 'F'}, {"0VO(EK", 'F'}, {"0VO(EN", 'F'}, {"0VO(ES", 'F'}, {"0VO(ET", 'F'}, {"0VO(EV", 'F'}, {"0VO(F(", 'F'}, {"0VO(N&", 'F'}, {"0VO(N)", 'F'}, {"0VO(N,", 'F'}, {"0VO(NO", 'F'}, {"0VO(O(", 'F'}, {"0VO(O1", 'F'}, {"0VO(OF", 'F'}, {"0VO(ON", 'F'}, {"0VO(OS", 'F'}, {"0VO(OV", 'F'}, {"0VO(S&", 'F'}, {"0VO(S)", 'F'}, {"0VO(S,", 'F'}, {"0VO(SO", 'F'}, {"0VO(T(", 'F'}, {"0VO(V&", 'F'}, {"0VO(V)", 'F'}, {"0VO(V,", 'F'}, {"0VO(VO", 'F'}, {"0VOF()", 'F'}, {"0VOF(1", 'F'}, {"0VOF(E", 'F'}, {"0VOF(F", 'F'}, {"0VOF(N", 'F'}, {"0VOF(S", 'F'}, {"0VOF(T", 'F'}, {"0VOF(V", 'F'}, {"0VOK&(", 'F'}, {"0VOK&1", 'F'}, {"0VOK&F", 'F'}, {"0VOK&N", 'F'}, {"0VOK&S", 'F'}, {"0VOK&V", 'F'}, {"0VOK(1", 'F'}, {"0VOK(F", 'F'}, {"0VOK(N", 'F'}, {"0VOK(S", 'F'}, {"0VOK(V", 'F'}, {"0VOK1C", 'F'}, {"0VOK1O", 'F'}, {"0VOKF(", 'F'}, {"0VOKNC", 'F'}, {"0VOKO(", 'F'}, {"0VOKO1", 'F'}, {"0VOKOF", 'F'}, {"0VOKON", 'F'}, {"0VOKOS", 'F'}, {"0VOKOV", 'F'}, {"0VOKSC", 'F'}, {"0VOKSO", 'F'}, {"0VOKVC", 'F'}, {"0VOKVO", 'F'}, {"0VOS", 'F'}, {"0VOS&(", 'F'}, {"0VOS&1", 'F'}, {"0VOS&E", 'F'}, {"0VOS&F", 'F'}, {"0VOS&K", 'F'}, {"0VOS&N", 'F'}, {"0VOS&S", 'F'}, {"0VOS&T", 'F'}, {"0VOS&U", 'F'}, {"0VOS&V", 'F'}, {"0VOS(E", 'F'}, {"0VOS(U", 'F'}, {"0VOS)&", 'F'}, {"0VOS),", 'F'}, {"0VOS);", 'F'}, {"0VOS)B", 'F'}, {"0VOS)C", 'F'}, {"0VOS)E", 'F'}, {"0VOS)K", 'F'}, {"0VOS)O", 'F'}, {"0VOS)U", 'F'}, {"0VOS,(", 'F'}, {"0VOS,F", 'F'}, {"0VOS,V", 'F'}, {"0VOS1(", 'F'}, {"0VOS1F", 'F'}, {"0VOS1N", 'F'}, {"0VOS1O", 'F'}, {"0VOS1S", 'F'}, {"0VOS1U", 'F'}, {"0VOS1V", 'F'}, {"0VOS;", 'F'}, {"0VOS;C", 'F'}, {"0VOS;E", 'F'}, {"0VOS;N", 'F'}, {"0VOS;T", 'F'}, {"0VOSA(", 'F'}, {"0VOSAF", 'F'}, {"0VOSAS", 'F'}, {"0VOSAT", 'F'}, {"0VOSAV", 'F'}, {"0VOSB(", 'F'}, {"0VOSB1", 'F'}, {"0VOSBE", 'F'}, {"0VOSBF", 'F'}, {"0VOSBN", 'F'}, {"0VOSBS", 'F'}, {"0VOSBV", 'F'}, {"0VOSC", 'F'}, {"0VOSE(", 'F'}, {"0VOSE1", 'F'}, {"0VOSEF", 'F'}, {"0VOSEK", 'F'}, {"0VOSEN", 'F'}, {"0VOSEO", 'F'}, {"0VOSES", 'F'}, {"0VOSEU", 'F'}, {"0VOSEV", 'F'}, {"0VOSF(", 'F'}, {"0VOSK(", 'F'}, {"0VOSK)", 'F'}, {"0VOSK1", 'F'}, {"0VOSKB", 'F'}, {"0VOSKF", 'F'}, {"0VOSKN", 'F'}, {"0VOSKS", 'F'}, {"0VOSKU", 'F'}, {"0VOSKV", 'F'}, {"0VOSO(", 'F'}, {"0VOSO1", 'F'}, {"0VOSOF", 'F'}, {"0VOSOK", 'F'}, {"0VOSON", 'F'}, {"0VOSOS", 'F'}, {"0VOSOT", 'F'}, {"0VOSOU", 'F'}, {"0VOSOV", 'F'}, {"0VOSU", 'F'}, {"0VOSU(", 'F'}, {"0VOSU1", 'F'}, {"0VOSU;", 'F'}, {"0VOSUC", 'F'}, {"0VOSUE", 'F'}, {"0VOSUF", 'F'}, {"0VOSUK", 'F'}, {"0VOSUN", 'F'}, {"0VOSUO", 'F'}, {"0VOSUS", 'F'}, {"0VOSUT", 'F'}, {"0VOSUV", 'F'}, {"0VOSV(", 'F'}, {"0VOSVF", 'F'}, {"0VOSVO", 'F'}, {"0VOSVS", 'F'}, {"0VOSVU", 'F'}, {"0VOT(1", 'F'}, {"0VOT(E", 'F'}, {"0VOT(F", 'F'}, {"0VOT(N", 'F'}, {"0VOT(S", 'F'}, {"0VOT(T", 'F'}, {"0VOT(V", 'F'}, {"0VOU(E", 'F'}, {"0VOUEK", 'F'}, {"0VOUEN", 'F'}, {"0VU", 'F'}, {"0VU(1)", 'F'}, {"0VU(1O", 'F'}, {"0VU(E(", 'F'}, {"0VU(E1", 'F'}, {"0VU(EF", 'F'}, {"0VU(EK", 'F'}, {"0VU(EN", 'F'}, {"0VU(ES", 'F'}, {"0VU(EV", 'F'}, {"0VU(F(", 'F'}, {"0VU(N)", 'F'}, {"0VU(NO", 'F'}, {"0VU(S)", 'F'}, {"0VU(SO", 'F'}, {"0VU(V)", 'F'}, {"0VU(VO", 'F'}, {"0VU1,(", 'F'}, {"0VU1,F", 'F'}, {"0VU1,V", 'F'}, {"0VU1C", 'F'}, {"0VU1O(", 'F'}, {"0VU1OF", 'F'}, {"0VU1OS", 'F'}, {"0VU1OV", 'F'}, {"0VU;", 'F'}, {"0VU;C", 'F'}, {"0VUC", 'F'}, {"0VUE", 'F'}, {"0VUE(1", 'F'}, {"0VUE(E", 'F'}, {"0VUE(F", 'F'}, {"0VUE(N", 'F'}, {"0VUE(O", 'F'}, {"0VUE(S", 'F'}, {"0VUE(V", 'F'}, {"0VUE1", 'F'}, {"0VUE1&", 'F'}, {"0VUE1(", 'F'}, {"0VUE1)", 'F'}, {"0VUE1,", 'F'}, {"0VUE1;", 'F'}, {"0VUE1B", 'F'}, {"0VUE1C", 'F'}, {"0VUE1F", 'F'}, {"0VUE1K", 'F'}, {"0VUE1N", 'F'}, {"0VUE1O", 'F'}, {"0VUE1S", 'F'}, {"0VUE1U", 'F'}, {"0VUE1V", 'F'}, {"0VUE;", 'F'}, {"0VUE;C", 'F'}, {"0VUEC", 'F'}, {"0VUEF", 'F'}, {"0VUEF(", 'F'}, {"0VUEF,", 'F'}, {"0VUEF;", 'F'}, {"0VUEFC", 'F'}, {"0VUEK", 'F'}, {"0VUEK(", 'F'}, {"0VUEK1", 'F'}, {"0VUEK;", 'F'}, {"0VUEKC", 'F'}, {"0VUEKF", 'F'}, {"0VUEKN", 'F'}, {"0VUEKO", 'F'}, {"0VUEKS", 'F'}, {"0VUEKV", 'F'}, {"0VUEN", 'F'}, {"0VUEN&", 'F'}, {"0VUEN(", 'F'}, {"0VUEN)", 'F'}, {"0VUEN,", 'F'}, {"0VUEN1", 'F'}, {"0VUEN;", 'F'}, {"0VUENB", 'F'}, {"0VUENC", 'F'}, {"0VUENF", 'F'}, {"0VUENK", 'F'}, {"0VUENO", 'F'}, {"0VUENS", 'F'}, {"0VUENU", 'F'}, {"0VUEOK", 'F'}, {"0VUEON", 'F'}, {"0VUEOO", 'F'}, {"0VUES", 'F'}, {"0VUES&", 'F'}, {"0VUES(", 'F'}, {"0VUES)", 'F'}, {"0VUES,", 'F'}, {"0VUES1", 'F'}, {"0VUES;", 'F'}, {"0VUESB", 'F'}, {"0VUESC", 'F'}, {"0VUESF", 'F'}, {"0VUESK", 'F'}, {"0VUESO", 'F'}, {"0VUESU", 'F'}, {"0VUESV", 'F'}, {"0VUEV", 'F'}, {"0VUEV&", 'F'}, {"0VUEV(", 'F'}, {"0VUEV)", 'F'}, {"0VUEV,", 'F'}, {"0VUEV;", 'F'}, {"0VUEVB", 'F'}, {"0VUEVC", 'F'}, {"0VUEVF", 'F'}, {"0VUEVK", 'F'}, {"0VUEVN", 'F'}, {"0VUEVO", 'F'}, {"0VUEVS", 'F'}, {"0VUEVU", 'F'}, {"0VUF()", 'F'}, {"0VUF(1", 'F'}, {"0VUF(F", 'F'}, {"0VUF(N", 'F'}, {"0VUF(S", 'F'}, {"0VUF(V", 'F'}, {"0VUK(E", 'F'}, {"0VUN(1", 'F'}, {"0VUN(F", 'F'}, {"0VUN(S", 'F'}, {"0VUN(V", 'F'}, {"0VUN,(", 'F'}, {"0VUN,F", 'F'}, {"0VUN,V", 'F'}, {"0VUN1(", 'F'}, {"0VUN1,", 'F'}, {"0VUN1O", 'F'}, {"0VUNC", 'F'}, {"0VUNE(", 'F'}, {"0VUNE1", 'F'}, {"0VUNEF", 'F'}, {"0VUNEN", 'F'}, {"0VUNES", 'F'}, {"0VUNEV", 'F'}, {"0VUNF(", 'F'}, {"0VUNO(", 'F'}, {"0VUNOF", 'F'}, {"0VUNOS", 'F'}, {"0VUNOV", 'F'}, {"0VUNS(", 'F'}, {"0VUNS,", 'F'}, {"0VUNSO", 'F'}, {"0VUO(E", 'F'}, {"0VUON(", 'F'}, {"0VUON1", 'F'}, {"0VUONF", 'F'}, {"0VUONS", 'F'}, {"0VUS,(", 'F'}, {"0VUS,F", 'F'}, {"0VUS,V", 'F'}, {"0VUSC", 'F'}, {"0VUSO(", 'F'}, {"0VUSO1", 'F'}, {"0VUSOF", 'F'}, {"0VUSON", 'F'}, {"0VUSOS", 'F'}, {"0VUSOV", 'F'}, {"0VUTN(", 'F'}, {"0VUTN1", 'F'}, {"0VUTNF", 'F'}, {"0VUTNS", 'F'}, {"0VUV,(", 'F'}, {"0VUV,1", 'F'}, {"0VUV,F", 'F'}, {"0VUV,N", 'F'}, {"0VUV,S", 'F'}, {"0VUV,V", 'F'}, {"0VUVC", 'F'}, {"0VUVO(", 'F'}, {"0VUVOF", 'F'}, {"0VUVOS", 'F'}, {"0X", 'F'}, {"::", 'o'}, {":=", 'o'}, {"<<", 'o'}, {"<=", 'o'}, {"<>", 'o'}, {"<@", 'o'}, {">=", 'o'}, {">>", 'o'}, {"@>", 'o'}, {"ABORT", 'k'}, {"ABS", 'f'}, {"ACCESSIBLE", 'k'}, {"ACOS", 'f'}, {"ADD", 'k'}, {"ADDDATE", 'f'}, {"ADDTIME", 'f'}, {"AES_DECRYPT", 'f'}, {"AES_ENCRYPT", 'f'}, {"AGAINST", 'k'}, {"AGE", 'f'}, {"ALL_USERS", 'k'}, {"ALTER", 'k'}, {"ALTER DOMAIN", 'k'}, {"ALTER TABLE", 'k'}, {"ANALYZE", 'k'}, {"AND", '&'}, {"ANY", 'f'}, {"ANYARRAY", 't'}, {"ANYELEMENT", 't'}, {"ANYNONARRY", 't'}, {"APPLOCK_MODE", 'f'}, {"APPLOCK_TEST", 'f'}, {"APP_NAME", 'f'}, {"ARRAY_AGG", 'f'}, {"ARRAY_CAT", 'f'}, {"ARRAY_DIM", 'f'}, {"ARRAY_FILL", 'f'}, {"ARRAY_LENGTH", 'f'}, {"ARRAY_LOWER", 'f'}, {"ARRAY_NDIMS", 'f'}, {"ARRAY_PREPEND", 'f'}, {"ARRAY_TO_JSON", 'f'}, {"ARRAY_TO_STRING", 'f'}, {"ARRAY_UPPER", 'f'}, {"AS", 'k'}, {"ASC", 'k'}, {"ASCII", 'f'}, {"ASENSITIVE", 'k'}, {"ASIN", 'f'}, {"ASSEMBLYPROPERTY", 'f'}, {"ASYMKEY_ID", 'f'}, {"AT TIME", 'n'}, {"AT TIME ZONE", 'k'}, {"ATAN", 'f'}, {"ATAN2", 'f'}, {"AUTOINCREMENT", 'k'}, {"AVG", 'f'}, {"BEFORE", 'k'}, {"BEGIN", 'T'}, {"BENCHMARK", 'f'}, {"BETWEEN", 'o'}, {"BIGINT", 't'}, {"BIGSERIAL", 't'}, {"BIN", 'f'}, {"BINARY", 't'}, {"BINARY_DOUBLE_INFINITY", '1'}, {"BINARY_DOUBLE_NAN", '1'}, {"BINARY_FLOAT_INFINITY", '1'}, {"BINARY_FLOAT_NAN", '1'}, {"BINBINARY", 'f'}, {"BIT_AND", 'f'}, {"BIT_COUNT", 'f'}, {"BIT_LENGTH", 'f'}, {"BIT_OR", 'f'}, {"BIT_XOR", 'f'}, {"BLOB", 'k'}, {"BOOLEAN", 't'}, {"BOOL_AND", 'f'}, {"BOOL_OR", 'f'}, {"BOTH", 'k'}, {"BTRIM", 'f'}, {"BY", 'n'}, {"BYTEA", 't'}, {"CALL", 'T'}, {"CASCADE", 'k'}, {"CASE", 'E'}, {"CAST", 'f'}, {"CBOOL", 'f'}, {"CBRT", 'f'}, {"CBYTE", 'f'}, {"CCUR", 'f'}, {"CDATE", 'f'}, {"CDBL", 'f'}, {"CEIL", 'f'}, {"CEILING", 'f'}, {"CERTENCODED", 'f'}, {"CERTPRIVATEKEY", 'f'}, {"CERT_ID", 'f'}, {"CERT_PROPERTY", 'f'}, {"CHANGE", 'k'}, {"CHANGES", 'f'}, {"CHAR", 'f'}, {"CHARACTER", 't'}, {"CHARACTER VARYING", 't'}, {"CHARACTER_LENGTH", 'f'}, {"CHARINDEX", 'f'}, {"CHARSET", 'f'}, {"CHAR_LENGTH", 'f'}, {"CHDIR", 'f'}, {"CHDRIVE", 'f'}, {"CHECK", 'k'}, {"CHECKSUM_AGG", 'f'}, {"CHOOSE", 'f'}, {"CHR", 'f'}, {"CINT", 'f'}, {"CLNG", 'f'}, {"CLOCK_TIMESTAMP", 'f'}, {"COALESCE", 'f'}, {"COERCIBILITY", 'f'}, {"COLLATE", 'A'}, {"COLLATION", 'f'}, {"COLLATIONPROPERTY", 'f'}, {"COLUMN", 'k'}, {"COLUMNPROPERTY", 'f'}, {"COLUMNS_UPDATED", 'f'}, {"COL_LENGTH", 'f'}, {"COL_NAME", 'f'}, {"COMPRESS", 'f'}, {"CONCAT", 'f'}, {"CONCAT_WS", 'f'}, {"CONDITION", 'k'}, {"CONNECTION_ID", 'f'}, {"CONSTRAINT", 'k'}, {"CONTINUE", 'k'}, {"CONV", 'f'}, {"CONVERT", 'f'}, {"CONVERT_FROM", 'f'}, {"CONVERT_TO", 'f'}, {"CONVERT_TZ", 'f'}, {"COS", 'f'}, {"COT", 'f'}, {"COUNT", 'f'}, {"COUNT_BIG", 'k'}, {"CRC32", 'f'}, {"CREATE", 'E'}, {"CREATE OR", 'n'}, {"CREATE OR REPLACE", 'T'}, {"CROSS", 'n'}, {"CROSS JOIN", 'k'}, {"CSNG", 'f'}, {"CSTRING", 't'}, {"CTXSYS.DRITHSX.SN", 'f'}, {"CUME_DIST", 'f'}, {"CURDATE", 'f'}, {"CURDIR", 'f'}, {"CURRENT DATE", 'v'}, {"CURRENT DEGREE", 'v'}, {"CURRENT FUNCTION", 'v'}, {"CURRENT FUNCTION PATH", 'v'}, {"CURRENT PATH", 'v'}, {"CURRENT SCHEMA", 'v'}, {"CURRENT SERVER", 'v'}, {"CURRENT TIME", 'v'}, {"CURRENT TIMEZONE", 'v'}, {"CURRENTUSER", 'f'}, {"CURRENT_DATABASE", 'f'}, {"CURRENT_DATE", 'v'}, {"CURRENT_PATH", 'v'}, {"CURRENT_QUERY", 'f'}, {"CURRENT_SCHEMA", 'f'}, {"CURRENT_SCHEMAS", 'f'}, {"CURRENT_SERVER", 'v'}, {"CURRENT_SETTING", 'f'}, {"CURRENT_TIME", 'v'}, {"CURRENT_TIMESTAMP", 'v'}, {"CURRENT_TIMEZONE", 'v'}, {"CURRENT_USER", 'v'}, {"CURRVAL", 'f'}, {"CURSOR", 'k'}, {"CURSOR_STATUS", 'f'}, {"CURTIME", 'f'}, {"CVAR", 'f'}, {"DATABASE", 'n'}, {"DATABASEPROPERTYEX", 'f'}, {"DATABASES", 'k'}, {"DATABASE_PRINCIPAL_ID", 'f'}, {"DATALENGTH", 'f'}, {"DATE", 'f'}, {"DATEADD", 'f'}, {"DATEDIFF", 'f'}, {"DATEFROMPARTS", 'f'}, {"DATENAME", 'f'}, {"DATEPART", 'f'}, {"DATESERIAL", 'f'}, {"DATETIME2FROMPARTS", 'f'}, {"DATETIMEFROMPARTS", 'f'}, {"DATETIMEOFFSETFROMPARTS", 'f'}, {"DATEVALUE", 'f'}, {"DATE_ADD", 'f'}, {"DATE_FORMAT", 'f'}, {"DATE_PART", 'f'}, {"DATE_SUB", 'f'}, {"DATE_TRUNC", 'f'}, {"DAVG", 'f'}, {"DAY", 'f'}, {"DAYNAME", 'f'}, {"DAYOFMONTH", 'f'}, {"DAYOFWEEK", 'f'}, {"DAYOFYEAR", 'f'}, {"DAY_HOUR", 'k'}, {"DAY_MICROSECOND", 'k'}, {"DAY_MINUTE", 'k'}, {"DAY_SECOND", 'k'}, {"DBMS_LOCK.SLEEP", 'f'}, {"DBMS_PIPE.RECEIVE_MESSAGE", 'f'}, {"DB_ID", 'f'}, {"DB_NAME", 'f'}, {"DCOUNT", 'f'}, {"DEC", 'k'}, {"DECIMAL", 't'}, {"DECLARE", 'T'}, {"DECODE", 'f'}, {"DECRYPTBYASMKEY", 'f'}, {"DECRYPTBYCERT", 'f'}, {"DECRYPTBYKEY", 'f'}, {"DECRYPTBYKEYAUTOCERT", 'f'}, {"DECRYPTBYPASSPHRASE", 'f'}, {"DEFAULT", 'k'}, {"DEGREES", 'f'}, {"DELAY", 'k'}, {"DELAYED", 'k'}, {"DELETE", 'T'}, {"DENSE_RANK", 'f'}, {"DESC", 'k'}, {"DESCRIBE", 'k'}, {"DES_DECRYPT", 'f'}, {"DES_ENCRYPT", 'f'}, {"DETERMINISTIC", 'k'}, {"DFIRST", 'f'}, {"DIFFERENCE", 'f'}, {"DISTINCT", 'k'}, {"DISTINCTROW", 'k'}, {"DIV", 'o'}, {"DLAST", 'f'}, {"DLOOKUP", 'f'}, {"DMAX", 'f'}, {"DMIN", 'f'}, {"DO", 'n'}, {"DOUBLE", 't'}, {"DOUBLE PRECISION", 't'}, {"DROP", 'T'}, {"DSUM", 'f'}, {"DUAL", 'n'}, {"EACH", 'k'}, {"ELSE", 'k'}, {"ELSEIF", 'k'}, {"ELT", 'f'}, {"ENCLOSED", 'k'}, {"ENCODE", 'f'}, {"ENCRYPT", 'f'}, {"ENCRYPTBYASMKEY", 'f'}, {"ENCRYPTBYCERT", 'f'}, {"ENCRYPTBYKEY", 'f'}, {"ENCRYPTBYPASSPHRASE", 'f'}, {"ENUM_FIRST", 'f'}, {"ENUM_LAST", 'f'}, {"ENUM_RANGE", 'f'}, {"EOMONTH", 'f'}, {"EQV", 'o'}, {"ESCAPED", 'k'}, {"EVENTDATA", 'f'}, {"EXCEPT", 'U'}, {"EXEC", 'T'}, {"EXECUTE", 'T'}, {"EXECUTE AS", 'E'}, {"EXECUTE AS LOGIN", 'E'}, {"EXISTS", 'f'}, {"EXIT", 'k'}, {"EXP", 'f'}, {"EXPLAIN", 'k'}, {"EXPORT_SET", 'f'}, {"EXTRACT", 'f'}, {"EXTRACTVALUE", 'f'}, {"EXTRACT_VALUE", 'f'}, {"FALSE", '1'}, {"FETCH", 'k'}, {"FIELD", 'f'}, {"FILEDATETIME", 'f'}, {"FILEGROUPPROPERTY", 'f'}, {"FILEGROUP_ID", 'f'}, {"FILEGROUP_NAME", 'f'}, {"FILELEN", 'f'}, {"FILEPROPERTY", 'f'}, {"FILE_ID", 'f'}, {"FILE_IDEX", 'f'}, {"FILE_NAME", 'f'}, {"FIND_IN_SET", 'f'}, {"FIRST_VALUE", 'f'}, {"FLOAT", 't'}, {"FLOAT4", 't'}, {"FLOAT8", 't'}, {"FLOOR", 'f'}, {"FN_VIRTUALFILESTATS", 'f'}, {"FOR", 'n'}, {"FOR UPDATE", 'k'}, {"FOR UPDATE NOWAIT", 'k'}, {"FOR UPDATE OF", 'k'}, {"FOR UPDATE SKIP", 'k'}, {"FOR UPDATE SKIP LOCKED", 'k'}, {"FOR UPDATE WAIT", 'k'}, {"FORCE", 'k'}, {"FOREIGN", 'k'}, {"FORMAT", 'f'}, {"FOUND_ROWS", 'f'}, {"FROM", 'k'}, {"FROM_DAYS", 'f'}, {"FROM_UNIXTIME", 'f'}, {"FULL JOIN", 'k'}, {"FULL OUTER", 'k'}, {"FULL OUTER JOIN", 'k'}, {"FULLTEXT", 'k'}, {"FULLTEXTCATALOGPROPERTY", 'f'}, {"FULLTEXTSERVICEPROPERTY", 'f'}, {"FUNCTION", 'k'}, {"GENERATE_SERIES", 'f'}, {"GENERATE_SUBSCRIPTS", 'f'}, {"GETATTR", 'f'}, {"GETDATE", 'f'}, {"GETUTCDATE", 'f'}, {"GET_BIT", 'f'}, {"GET_BYTE", 'f'}, {"GET_FORMAT", 'f'}, {"GET_LOCK", 'f'}, {"GO", 'T'}, {"GOTO", 'T'}, {"GRANT", 'k'}, {"GREATEST", 'f'}, {"GROUP", 'n'}, {"GROUP BY", 'B'}, {"GROUPING", 'f'}, {"GROUPING_ID", 'f'}, {"GROUP_CONCAT", 'f'}, {"HANDLER", 'T'}, {"HASHBYTES", 'f'}, {"HAS_PERMS_BY_NAME", 'f'}, {"HAVING", 'B'}, {"HEX", 'f'}, {"HIGH_PRIORITY", 'k'}, {"HOST_NAME", 'f'}, {"HOUR", 'f'}, {"HOUR_MICROSECOND", 'k'}, {"HOUR_MINUTE", 'k'}, {"HOUR_SECOND", 'k'}, {"IDENTIFY", 'f'}, {"IDENT_CURRENT", 'f'}, {"IDENT_INCR", 'f'}, {"IDENT_SEED", 'f'}, {"IF", 'f'}, {"IF EXISTS", 'f'}, {"IF NOT", 'n'}, {"IF NOT EXISTS", 'f'}, {"IFF", 'f'}, {"IFNULL", 'f'}, {"IGNORE", 'k'}, {"IIF", 'f'}, {"IN", 'k'}, {"IN BOOLEAN", 'n'}, {"IN BOOLEAN MODE", 'k'}, {"INDEX", 'k'}, {"INDEXKEY_PROPERTY", 'f'}, {"INDEXPROPERTY", 'f'}, {"INDEX_COL", 'f'}, {"INET_ATON", 'f'}, {"INET_NTOA", 'f'}, {"INFILE", 'k'}, {"INITCAP", 'f'}, {"INNER", 'k'}, {"INNER JOIN", 'k'}, {"INOUT", 'k'}, {"INSENSITIVE", 'k'}, {"INSERT", 'E'}, {"INSERT DELAYED", 'E'}, {"INSERT DELAYED INTO", 'T'}, {"INSERT HIGH_PRIORITY", 'E'}, {"INSERT HIGH_PRIORITY INTO", 'T'}, {"INSERT IGNORE", 'E'}, {"INSERT IGNORE INTO", 'T'}, {"INSERT INTO", 'T'}, {"INSERT LOW_PRIORITY", 'E'}, {"INSERT LOW_PRIORITY INTO", 'T'}, {"INSTR", 'f'}, {"INSTRREV", 'f'}, {"INT", 't'}, {"INT1", 't'}, {"INT2", 't'}, {"INT3", 't'}, {"INT4", 't'}, {"INT8", 't'}, {"INTEGER", 't'}, {"INTERSECT", 'U'}, {"INTERSECT ALL", 'U'}, {"INTERVAL", 'k'}, {"INTO", 'k'}, {"INTO DUMPFILE", 'k'}, {"INTO OUTFILE", 'k'}, {"IS", 'o'}, {"IS DISTINCT", 'n'}, {"IS DISTINCT FROM", 'o'}, {"IS NOT", 'o'}, {"IS NOT DISTINCT", 'n'}, {"IS NOT DISTINCT FROM", 'o'}, {"ISDATE", 'f'}, {"ISEMPTY", 'f'}, {"ISFINITE", 'f'}, {"ISNULL", 'f'}, {"ISNUMERIC", 'f'}, {"IS_FREE_LOCK", 'f'}, {"IS_MEMBER", 'f'}, {"IS_OBJECTSIGNED", 'f'}, {"IS_ROLEMEMBER", 'f'}, {"IS_SRVROLEMEMBER", 'f'}, {"IS_USED_LOCK", 'f'}, {"ITERATE", 'k'}, {"JOIN", 'k'}, {"JULIANDAY", 'f'}, {"JUSTIFY_DAYS", 'f'}, {"JUSTIFY_HOURS", 'f'}, {"JUSTIFY_INTERVAL", 'f'}, {"KEYS", 'k'}, {"KEY_GUID", 'f'}, {"KEY_ID", 'f'}, {"KILL", 'k'}, {"LAG", 'f'}, {"LASTVAL", 'f'}, {"LAST_INSERT_ID", 'f'}, {"LAST_INSERT_ROWID", 'f'}, {"LAST_VALUE", 'f'}, {"LCASE", 'f'}, {"LEAD", 'f'}, {"LEADING", 'k'}, {"LEAST", 'f'}, {"LEAVE", 'k'}, {"LEFT", 'n'}, {"LEFT JOIN", 'k'}, {"LEFT OUTER", 'k'}, {"LEFT OUTER JOIN", 'k'}, {"LENGTH", 'f'}, {"LIKE", 'o'}, {"LIMIT", 'B'}, {"LINEAR", 'k'}, {"LINES", 'k'}, {"LN", 'f'}, {"LOAD", 'k'}, {"LOAD DATA", 'T'}, {"LOAD XML", 'T'}, {"LOAD_EXTENSION", 'f'}, {"LOAD_FILE", 'f'}, {"LOCALTIME", 'v'}, {"LOCALTIMESTAMP", 'v'}, {"LOCATE", 'f'}, {"LOCK", 'n'}, {"LOCK IN", 'n'}, {"LOCK IN SHARE", 'n'}, {"LOCK IN SHARE MODE", 'k'}, {"LOCK TABLE", 'k'}, {"LOCK TABLES", 'k'}, {"LOG", 'f'}, {"LOG10", 'f'}, {"LOG2", 'f'}, {"LONGBLOB", 'k'}, {"LONGTEXT", 'k'}, {"LOOP", 'k'}, {"LOWER", 'f'}, {"LOWER_INC", 'f'}, {"LOWER_INF", 'f'}, {"LOW_PRIORITY", 'k'}, {"LPAD", 'f'}, {"LTRIM", 'f'}, {"MAKEDATE", 'f'}, {"MAKE_SET", 'f'}, {"MASKLEN", 'f'}, {"MASTER_BIND", 'k'}, {"MASTER_POS_WAIT", 'f'}, {"MASTER_SSL_VERIFY_SERVER_CERT", 'k'}, {"MATCH", 'k'}, {"MAX", 'f'}, {"MAXVALUE", 'k'}, {"MD5", 'f'}, {"MEDIUMBLOB", 'k'}, {"MEDIUMINT", 'k'}, {"MEDIUMTEXT", 'k'}, {"MERGE", 'k'}, {"MICROSECOND", 'f'}, {"MID", 'f'}, {"MIDDLEINT", 'k'}, {"MIN", 'f'}, {"MINUTE", 'f'}, {"MINUTE_MICROSECOND", 'k'}, {"MINUTE_SECOND", 'k'}, {"MKDIR", 'f'}, {"MOD", 'o'}, {"MODE", 'n'}, {"MODIFIES", 'k'}, {"MONEY", 't'}, {"MONTH", 'f'}, {"MONTHNAME", 'f'}, {"NAME_CONST", 'f'}, {"NATURAL", 'n'}, {"NATURAL FULL", 'k'}, {"NATURAL FULL OUTER JOIN", 'k'}, {"NATURAL INNER", 'k'}, {"NATURAL JOIN", 'k'}, {"NATURAL LEFT", 'k'}, {"NATURAL LEFT OUTER", 'k'}, {"NATURAL LEFT OUTER JOIN", 'k'}, {"NATURAL OUTER", 'k'}, {"NATURAL RIGHT", 'k'}, {"NATURAL RIGHT OUTER JOIN", 'k'}, {"NETMASK", 'f'}, {"NEXT VALUE", 'n'}, {"NEXT VALUE FOR", 'k'}, {"NEXTVAL", 'f'}, {"NOT", 'o'}, {"NOT BETWEEN", 'o'}, {"NOT IN", 'k'}, {"NOT LIKE", 'o'}, {"NOT REGEXP", 'o'}, {"NOT RLIKE", 'o'}, {"NOT SIMILAR", 'o'}, {"NOT SIMILAR TO", 'o'}, {"NOTNULL", 'k'}, {"NOW", 'f'}, {"NOWAIT", 'k'}, {"NO_WRITE_TO_BINLOG", 'k'}, {"NTH_VALUE", 'f'}, {"NTILE", 'f'}, {"NULL", 'v'}, {"NULLIF", 'f'}, {"NUMERIC", 't'}, {"NZ", 'f'}, {"OBJECTPROPERTY", 'f'}, {"OBJECTPROPERTYEX", 'f'}, {"OBJECT_DEFINITION", 'f'}, {"OBJECT_ID", 'f'}, {"OBJECT_NAME", 'f'}, {"OBJECT_SCHEMA_NAME", 'f'}, {"OCT", 'f'}, {"OCTET_LENGTH", 'f'}, {"OFFSET", 'k'}, {"OID", 't'}, {"OLD_PASSWORD", 'f'}, {"ONE_SHOT", 'k'}, {"OPEN", 'k'}, {"OPENDATASOURCE", 'f'}, {"OPENQUERY", 'f'}, {"OPENROWSET", 'f'}, {"OPENXML", 'f'}, {"OPTIMIZE", 'k'}, {"OPTION", 'k'}, {"OPTIONALLY", 'k'}, {"OR", '&'}, {"ORD", 'f'}, {"ORDER", 'n'}, {"ORDER BY", 'B'}, {"ORIGINAL_DB_NAME", 'f'}, {"ORIGINAL_LOGIN", 'f'}, {"OUT", 'k'}, {"OUTER", 'n'}, {"OUTFILE", 'k'}, {"OVERLAPS", 'f'}, {"OVERLAY", 'f'}, {"OWN3D", 'k'}, {"OWN3D BY", 'B'}, {"PARSENAME", 'f'}, {"PARTITION", 'k'}, {"PARTITION BY", 'B'}, {"PASSWORD", 'n'}, {"PATHINDEX", 'f'}, {"PATINDEX", 'f'}, {"PERCENTILE_COUNT", 'f'}, {"PERCENTILE_DISC", 'f'}, {"PERCENTILE_RANK", 'f'}, {"PERCENT_RANK", 'f'}, {"PERIOD_ADD", 'f'}, {"PERIOD_DIFF", 'f'}, {"PERMISSIONS", 'f'}, {"PG_ADVISORY_LOCK", 'f'}, {"PG_BACKEND_PID", 'f'}, {"PG_CANCEL_BACKEND", 'f'}, {"PG_CLIENT_ENCODING", 'f'}, {"PG_CONF_LOAD_TIME", 'f'}, {"PG_CREATE_RESTORE_POINT", 'f'}, {"PG_HAS_ROLE", 'f'}, {"PG_IS_IN_RECOVERY", 'f'}, {"PG_IS_OTHER_TEMP_SCHEMA", 'f'}, {"PG_LISTENING_CHANNELS", 'f'}, {"PG_LS_DIR", 'f'}, {"PG_MY_TEMP_SCHEMA", 'f'}, {"PG_POSTMASTER_START_TIME", 'f'}, {"PG_READ_BINARY_FILE", 'f'}, {"PG_READ_FILE", 'f'}, {"PG_RELOAD_CONF", 'f'}, {"PG_ROTATE_LOGFILE", 'f'}, {"PG_SLEEP", 'f'}, {"PG_START_BACKUP", 'f'}, {"PG_STAT_FILE", 'f'}, {"PG_STOP_BACKUP", 'f'}, {"PG_SWITCH_XLOG", 'f'}, {"PG_TERMINATE_BACKEND", 'f'}, {"PG_TRIGGER_DEPTH", 'f'}, {"PI", 'f'}, {"POSITION", 'f'}, {"POW", 'f'}, {"POWER", 'f'}, {"PRECISION", 'k'}, {"PREVIOUS VALUE", 'n'}, {"PREVIOUS VALUE FOR", 'k'}, {"PRIMARY", 'k'}, {"PRINT", 'T'}, {"PROCEDURE", 'k'}, {"PROCEDURE ANALYSE", 'f'}, {"PUBLISHINGSERVERNAME", 'f'}, {"PURGE", 'k'}, {"PWDCOMPARE", 'f'}, {"PWDENCRYPT", 'f'}, {"QUARTER", 'f'}, {"QUOTE", 'f'}, {"QUOTENAME", 'f'}, {"QUOTE_IDENT", 'f'}, {"QUOTE_LITERAL", 'f'}, {"QUOTE_NULLABLE", 'f'}, {"RADIANS", 'f'}, {"RAISEERROR", 'E'}, {"RAND", 'f'}, {"RANDOM", 'f'}, {"RANDOMBLOB", 'f'}, {"RANGE", 'k'}, {"RANK", 'f'}, {"READ", 'k'}, {"READ WRITE", 'k'}, {"READS", 'k'}, {"READ_WRITE", 'k'}, {"REAL", 't'}, {"REFERENCES", 'k'}, {"REGCLASS", 't'}, {"REGCONFIG", 't'}, {"REGDICTIONARY", 't'}, {"REGEXP", 'o'}, {"REGEXP_MATCHES", 'f'}, {"REGEXP_REPLACE", 'f'}, {"REGEXP_SPLIT_TO_ARRAY", 'f'}, {"REGEXP_SPLIT_TO_TABLE", 'f'}, {"REGOPER", 't'}, {"REGOPERATOR", 't'}, {"REGPROC", 't'}, {"REGPROCEDURE", 't'}, {"REGTYPE", 't'}, {"RELEASE", 'k'}, {"RELEASE_LOCK", 'f'}, {"RENAME", 'k'}, {"REPEAT", 'k'}, {"REPLACE", 'k'}, {"REPLICATE", 'f'}, {"REQUIRE", 'k'}, {"RESIGNAL", 'k'}, {"RESTRICT", 'k'}, {"RETURN", 'k'}, {"REVERSE", 'f'}, {"REVOKE", 'k'}, {"RIGHT", 'n'}, {"RIGHT JOIN", 'k'}, {"RIGHT OUTER", 'k'}, {"RIGHT OUTER JOIN", 'k'}, {"RLIKE", 'o'}, {"ROUND", 'f'}, {"ROW", 'f'}, {"ROW_COUNT", 'f'}, {"ROW_NUMBER", 'f'}, {"ROW_TO_JSON", 'f'}, {"RPAD", 'f'}, {"RTRIM", 'f'}, {"SCHAMA_NAME", 'f'}, {"SCHEMA", 'k'}, {"SCHEMAS", 'k'}, {"SCHEMA_ID", 'f'}, {"SCOPE_IDENTITY", 'f'}, {"SECOND_MICROSECOND", 'k'}, {"SEC_TO_TIME", 'f'}, {"SELECT", 'E'}, {"SELECT ALL", 'E'}, {"SELECT DISTINCT", 'E'}, {"SENSITIVE", 'k'}, {"SEPARATOR", 'k'}, {"SERIAL", 't'}, {"SERIAL2", 't'}, {"SERIAL4", 't'}, {"SERIAL8", 't'}, {"SERVERPROPERTY", 'f'}, {"SESSION_USER", 'f'}, {"SET", 'E'}, {"SETATTR", 'f'}, {"SETSEED", 'f'}, {"SETVAL", 'f'}, {"SET_BIT", 'f'}, {"SET_BYTE", 'f'}, {"SET_CONFIG", 'f'}, {"SET_MASKLEN", 'f'}, {"SHA", 'f'}, {"SHA1", 'f'}, {"SHA2", 'f'}, {"SHOW", 'n'}, {"SHUTDOWN", 'T'}, {"SIGN", 'f'}, {"SIGNAL", 'k'}, {"SIGNBYASMKEY", 'f'}, {"SIGNBYCERT", 'f'}, {"SIMILAR", 'k'}, {"SIMILAR TO", 'o'}, {"SIN", 'f'}, {"SLEEP", 'f'}, {"SMALLDATETIMEFROMPARTS", 'f'}, {"SMALLINT", 't'}, {"SMALLSERIAL", 't'}, {"SOME", 'f'}, {"SOUNDEX", 'f'}, {"SOUNDS", 'o'}, {"SOUNDS LIKE", 'o'}, {"SPACE", 'f'}, {"SPATIAL", 'k'}, {"SPECIFIC", 'k'}, {"SPLIT_PART", 'f'}, {"SQL", 'k'}, {"SQLEXCEPTION", 'k'}, {"SQLSTATE", 'k'}, {"SQLWARNING", 'k'}, {"SQL_BIG_RESULT", 'k'}, {"SQL_BUFFER_RESULT", 'k'}, {"SQL_CACHE", 'k'}, {"SQL_CALC_FOUND_ROWS", 'k'}, {"SQL_NO_CACHE", 'k'}, {"SQL_SMALL_RESULT", 'k'}, {"SQL_VARIANT_PROPERTY", 'f'}, {"SQRT", 'f'}, {"SSL", 'k'}, {"STARTING", 'k'}, {"STATEMENT_TIMESTAMP", 'f'}, {"STATS_DATE", 'f'}, {"STDDEV", 'f'}, {"STDDEV_POP", 'f'}, {"STDDEV_SAMP", 'f'}, {"STRAIGHT_JOIN", 'k'}, {"STRCMP", 'f'}, {"STRCOMP", 'f'}, {"STRCONV", 'f'}, {"STRING_AGG", 'f'}, {"STRING_TO_ARRAY", 'f'}, {"STRPOS", 'f'}, {"STR_TO_DATE", 'f'}, {"STUFF", 'f'}, {"SUBDATE", 'f'}, {"SUBSTR", 'f'}, {"SUBSTRING", 'f'}, {"SUBSTRING_INDEX", 'f'}, {"SUBTIME", 'f'}, {"SUM", 'f'}, {"SUSER_ID", 'f'}, {"SUSER_NAME", 'f'}, {"SUSER_SID", 'f'}, {"SUSER_SNAME", 'f'}, {"SWITCHOFFET", 'f'}, {"SYS.DATABASE_NAME", 'n'}, {"SYS.FN_BUILTIN_PERMISSIONS", 'f'}, {"SYS.FN_GET_AUDIT_FILE", 'f'}, {"SYS.FN_MY_PERMISSIONS", 'f'}, {"SYS.STRAGG", 'f'}, {"SYSCOLUMNS", 'k'}, {"SYSDATE", 'f'}, {"SYSDATETIME", 'f'}, {"SYSDATETIMEOFFSET", 'f'}, {"SYSOBJECTS", 'k'}, {"SYSTEM_USER", 'f'}, {"SYSUSERS", 'k'}, {"SYSUTCDATETME", 'f'}, {"TABLE", 'k'}, {"TAN", 'f'}, {"TERMINATED", 'k'}, {"TERTIARY_WEIGHTS", 'f'}, {"TEXT", 't'}, {"TEXTPOS", 'f'}, {"TEXTPTR", 'f'}, {"TEXTVALID", 'f'}, {"THEN", 'k'}, {"TIME", 'k'}, {"TIMEDIFF", 'f'}, {"TIMEFROMPARTS", 'f'}, {"TIMEOFDAY", 'f'}, {"TIMESERIAL", 'f'}, {"TIMESTAMP", 't'}, {"TIMESTAMPADD", 'f'}, {"TIMEVALUE", 'f'}, {"TIME_FORMAT", 'f'}, {"TIME_TO_SEC", 'f'}, {"TINYBLOB", 'k'}, {"TINYINT", 'k'}, {"TINYTEXT", 'k'}, {"TODATETIMEOFFSET", 'f'}, {"TOP", 'k'}, {"TOTAL", 'f'}, {"TOTAL_CHANGES", 'f'}, {"TO_ASCII", 'f'}, {"TO_CHAR", 'f'}, {"TO_DATE", 'f'}, {"TO_DAYS", 'f'}, {"TO_HEX", 'f'}, {"TO_NUMBER", 'f'}, {"TO_SECONDS", 'f'}, {"TO_TIMESTAMP", 'f'}, {"TRAILING", 'n'}, {"TRANSACTION_TIMESTAMP", 'f'}, {"TRANSLATE", 'f'}, {"TRIGGER", 'k'}, {"TRIGGER_NESTLEVEL", 'f'}, {"TRIM", 'f'}, {"TRUE", '1'}, {"TRUNC", 'f'}, {"TRUNCATE", 'f'}, {"TRY_CAST", 'f'}, {"TRY_CONVERT", 'f'}, {"TRY_PARSE", 'f'}, {"TYPEOF", 'f'}, {"TYPEPROPERTY", 'f'}, {"TYPE_ID", 'f'}, {"TYPE_NAME", 'f'}, {"UCASE", 'f'}, {"UESCAPE", 'o'}, {"UNCOMPRESS", 'f'}, {"UNCOMPRESS_LENGTH", 'f'}, {"UNDO", 'k'}, {"UNHEX", 'f'}, {"UNICODE", 'f'}, {"UNION", 'U'}, {"UNION ALL", 'U'}, {"UNION ALL DISTINCT", 'U'}, {"UNION DISTINCT", 'U'}, {"UNION DISTINCT ALL", 'U'}, {"UNIQUE", 'n'}, {"UNIX_TIMESTAMP", 'f'}, {"UNI_ON", 'U'}, {"UNKNOWN", 'v'}, {"UNLOCK", 'k'}, {"UNNEST", 'f'}, {"UNSIGNED", 'k'}, {"UPDATE", 'E'}, {"UPDATEXML", 'f'}, {"UPPER", 'f'}, {"UPPER_INC", 'f'}, {"UPPER_INF", 'f'}, {"USAGE", 'k'}, {"USE", 'T'}, {"USER", 'n'}, {"USER_ID", 'n'}, {"USER_LOCK.SLEEP", 'f'}, {"USER_NAME", 'n'}, {"USING", 'f'}, {"UTC_DATE", 'k'}, {"UTC_TIME", 'k'}, {"UTC_TIMESTAMP", 'k'}, {"UTL_HTTP.REQUEST", 'f'}, {"UTL_INADDR.GET_HOST_ADDRESS", 'f'}, {"UTL_INADDR.GET_HOST_NAME", 'f'}, {"UUID", 'f'}, {"UUID_SHORT", 'f'}, {"VALUES", 'k'}, {"VAR", 'f'}, {"VARBINARY", 'k'}, {"VARCHAR", 't'}, {"VARCHARACTER", 'k'}, {"VARIANCE", 'f'}, {"VARP", 'f'}, {"VARYING", 'k'}, {"VAR_POP", 'f'}, {"VAR_SAMP", 'f'}, {"VERIFYSIGNEDBYASMKEY", 'f'}, {"VERIFYSIGNEDBYCERT", 'f'}, {"VERSION", 'f'}, {"VOID", 't'}, {"WAIT", 'k'}, {"WAITFOR", 'n'}, {"WAITFOR DELAY", 'E'}, {"WAITFOR RECEIVE", 'E'}, {"WAITFOR TIME", 'E'}, {"WEEK", 'f'}, {"WEEKDAY", 'f'}, {"WEEKDAYNAME", 'f'}, {"WEEKOFYEAR", 'f'}, {"WHEN", 'k'}, {"WHERE", 'k'}, {"WHILE", 'T'}, {"WIDTH_BUCKET", 'f'}, {"WITH", 'n'}, {"WITH ROLLUP", 'k'}, {"XMLAGG", 'f'}, {"XMLCOMMENT", 'f'}, {"XMLCONCAT", 'f'}, {"XMLELEMENT", 'f'}, {"XMLEXISTS", 'f'}, {"XMLFOREST", 'f'}, {"XMLFORMAT", 'f'}, {"XMLPI", 'f'}, {"XMLROOT", 'f'}, {"XMLTYPE", 'f'}, {"XML_IS_WELL_FORMED", 'f'}, {"XOR", '&'}, {"XPATH", 'f'}, {"XPATH_EXISTS", 'f'}, {"XP_EXECRESULTSET", 'k'}, {"YEAR", 'f'}, {"YEARWEEK", 'f'}, {"YEAR_MONTH", 'k'}, {"ZEROBLOB", 'f'}, {"ZEROFILL", 'k'}, {"^=", 'o'}, {"_ARMSCII8", 't'}, {"_ASCII", 't'}, {"_BIG5", 't'}, {"_BINARY", 't'}, {"_CP1250", 't'}, {"_CP1251", 't'}, {"_CP1257", 't'}, {"_CP850", 't'}, {"_CP852", 't'}, {"_CP866", 't'}, {"_CP932", 't'}, {"_DEC8", 't'}, {"_EUCJPMS", 't'}, {"_EUCKR", 't'}, {"_GB2312", 't'}, {"_GBK", 't'}, {"_GEOSTD8", 't'}, {"_GREEK", 't'}, {"_HEBREW", 't'}, {"_HP8", 't'}, {"_KEYBCS2", 't'}, {"_KOI8R", 't'}, {"_KOI8U", 't'}, {"_LATIN1", 't'}, {"_LATIN2", 't'}, {"_LATIN5", 't'}, {"_LATIN7", 't'}, {"_MACCE", 't'}, {"_MACROMAN", 't'}, {"_SJIS", 't'}, {"_SWE7", 't'}, {"_TIS620", 't'}, {"_UJIS", 't'}, {"_USC2", 't'}, {"_UTF8", 't'}, {"|/", 'o'}, {"|=", 'o'}, {"||", '&'}, {"~*", 'o'}, }; static const size_t sql_keywords_sz = 9712; #endif modsecurity-apache_2.7.7/apache2/apache2_util.c0000664000175000017500000002737012243422537021657 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #include "modsecurity.h" #include "apache2.h" #include "http_core.h" #include "util_script.h" /** * Sends a brigade with an error bucket down the filter chain. */ apr_status_t send_error_bucket(modsec_rec *msr, ap_filter_t *f, int status) { apr_bucket_brigade *brigade = NULL; apr_bucket *bucket = NULL; /* Set the status line explicitly for the error document */ f->r->status_line = ap_get_status_line(status); brigade = apr_brigade_create(f->r->pool, f->r->connection->bucket_alloc); if (brigade == NULL) return APR_EGENERAL; bucket = ap_bucket_error_create(status, NULL, f->r->pool, f->r->connection->bucket_alloc); if (bucket == NULL) return APR_EGENERAL; APR_BRIGADE_INSERT_TAIL(brigade, bucket); bucket = apr_bucket_eos_create(f->r->connection->bucket_alloc); if (bucket == NULL) return APR_EGENERAL; APR_BRIGADE_INSERT_TAIL(brigade, bucket); ap_pass_brigade(f->next, brigade); /* NOTE: * It may not matter what we do from the filter as it may be too * late to even generate an error (already sent to client). Nick Kew * recommends to return APR_EGENERAL in hopes that the handler in control * will notice and do The Right Thing. So, that is what we do now. */ return APR_EGENERAL; } /** * Execute system command. First line of the output will be returned in * the "output" parameter. */ int apache2_exec(modsec_rec *msr, const char *command, const char **argv, char **output) { apr_procattr_t *procattr = NULL; apr_proc_t *procnew = NULL; apr_status_t rc = APR_SUCCESS; const char *const *env = NULL; apr_file_t *script_out = NULL; request_rec *r = msr->r; if (argv == NULL) { argv = apr_pcalloc(r->pool, 3 * sizeof(char *)); argv[0] = command; argv[1] = NULL; } ap_add_cgi_vars(r); ap_add_common_vars(r); /* PHP hack, getting around its silly security checks. */ apr_table_add(r->subprocess_env, "PATH_TRANSLATED", command); apr_table_add(r->subprocess_env, "REDIRECT_STATUS", "302"); env = (const char * const *)ap_create_environment(r->pool, r->subprocess_env); if (env == NULL) { msr_log(msr, 1, "Exec: Unable to create environment."); return -1; } procnew = apr_pcalloc(r->pool, sizeof(*procnew)); if (procnew == NULL) { msr_log(msr, 1, "Exec: Unable to allocate %lu bytes.", (unsigned long)sizeof(*procnew)); return -1; } apr_procattr_create(&procattr, r->pool); if (procattr == NULL) { msr_log(msr, 1, "Exec: Unable to create procattr."); return -1; } apr_procattr_io_set(procattr, APR_NO_PIPE, APR_FULL_BLOCK, APR_NO_PIPE); apr_procattr_cmdtype_set(procattr, APR_SHELLCMD); if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Exec: %s", log_escape_nq(r->pool, command)); } rc = apr_proc_create(procnew, command, argv, env, procattr, r->pool); if (rc != APR_SUCCESS) { msr_log(msr, 1, "Exec: Execution failed: %s (%s)", log_escape_nq(r->pool, command), get_apr_error(r->pool, rc)); return -1; } apr_pool_note_subprocess(r->pool, procnew, APR_KILL_AFTER_TIMEOUT); script_out = procnew->out; if (!script_out) { msr_log(msr, 1, "Exec: Failed to get script output pipe."); return -1; } apr_file_pipe_timeout_set(script_out, r->server->timeout); /* Now read from the pipe. */ { char buf[260] = ""; char *p = buf; apr_size_t nbytes = 255; apr_status_t rc2; rc2 = apr_file_read(script_out, buf, &nbytes); if (rc2 == APR_SUCCESS) { buf[nbytes] = 0; /* if there is more than one line ignore them */ while(*p != 0) { if (*p == 0x0a) *p = 0; p++; } if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Exec: First line from script output: \"%s\"", log_escape(r->pool, buf)); } if (output != NULL) *output = apr_pstrdup(r->pool, buf); /* Soak up the remaining data. */ nbytes = 255; while(apr_file_read(script_out, buf, &nbytes) == APR_SUCCESS) nbytes = 255; } else { msr_log(msr, 1, "Exec: Execution failed while reading output: %s (%s)", log_escape_nq(r->pool, command), get_apr_error(r->pool, rc2)); return -1; } } apr_proc_wait(procnew, NULL, NULL, APR_WAIT); return 1; } /** * Returns a new string that contains the error * message for the given return code. */ char *get_apr_error(apr_pool_t *p, apr_status_t rc) { char *text = apr_pcalloc(p, 201); if (text == NULL) return NULL; apr_strerror(rc, text, 200); return text; } /** * Retrieve named environment variable. */ char *get_env_var(request_rec *r, char *name) { char *result = (char *)apr_table_get(r->notes, name); if (result == NULL) { result = (char *)apr_table_get(r->subprocess_env, name); } if (result == NULL) { result = getenv(name); } return result; } /** * Extended internal log helper function. Use msr_log instead. If fixup is * true, the message will be stripped of any trailing newline and any * required bytes will be escaped. */ static void internal_log_ex(request_rec *r, directory_config *dcfg, modsec_rec *msr, int level, int fixup, const char *text, va_list ap) { apr_size_t nbytes, nbytes_written; apr_file_t *debuglog_fd = NULL; int filter_debug_level = 0; char *remote = NULL; char *parse_remote = NULL; char *saved = NULL; char *str = NULL; char str1[1024] = ""; char str2[1256] = ""; /* Find the logging FD and determine the logging level from configuration. */ if (dcfg != NULL) { if ((dcfg->debuglog_fd != NULL)&&(dcfg->debuglog_fd != NOT_SET_P)) { debuglog_fd = dcfg->debuglog_fd; } if (dcfg->debuglog_level != NOT_SET) { filter_debug_level = dcfg->debuglog_level; } } /* Return immediately if we don't have where to write * or if the log level of the message is higher than * wanted in the log. */ if ((level > 3)&&( (debuglog_fd == NULL) || (level > filter_debug_level) )) return; /* Construct the message. */ apr_vsnprintf(str1, sizeof(str1), text, ap); if (fixup) { int len = strlen(str1); /* Strip line ending. */ if (len && str1[len - 1] == '\n') { str1[len - 1] = '\0'; } if (len > 1 && str1[len - 2] == '\r') { str1[len - 2] = '\0'; } } /* Construct the log entry. */ apr_snprintf(str2, sizeof(str2), "[%s] [%s/sid#%pp][rid#%pp][%s][%d] %s\n", current_logtime(msr->mp), ap_get_server_name(r), (r->server), r, ((r->uri == NULL) ? "" : log_escape_nq(msr->mp, r->uri)), level, (fixup ? log_escape_nq(msr->mp, str1) : str1)); /* Write to the debug log. */ if ((debuglog_fd != NULL)&&(level <= filter_debug_level)) { nbytes = strlen(str2); apr_file_write_full(debuglog_fd, str2, nbytes, &nbytes_written); } /* Send message levels 1-3 to the Apache error log and * add it to the message list in the audit log. */ if (level <= 3) { char *unique_id = (char *)get_env_var(r, "UNIQUE_ID"); char *hostname = (char *)msr->hostname; if (unique_id != NULL) { unique_id = apr_psprintf(msr->mp, " [unique_id \"%s\"]", log_escape(msr->mp, unique_id)); } else unique_id = ""; if (hostname != NULL) { hostname = apr_psprintf(msr->mp, " [hostname \"%s\"]", log_escape(msr->mp, hostname)); } else hostname = ""; #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER > 2 ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r->server, "[client %s] ModSecurity: %s%s [uri \"%s\"]%s", r->useragent_ip ? r->useragent_ip : r->connection->client_ip, str1, hostname, log_escape(msr->mp, r->uri), unique_id); #else ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r->server, "[client %s] ModSecurity: %s%s [uri \"%s\"]%s", msr->remote_addr ? msr->remote_addr : r->connection->remote_ip, str1, hostname, log_escape(msr->mp, r->uri), unique_id); #endif /* Add this message to the list. */ if (msr != NULL) { /* Force relevency if this is an alert */ msr->is_relevant++; *(const char **)apr_array_push(msr->alerts) = apr_pstrdup(msr->mp, str1); } } return; } /** * Logs one message at the given level to the debug log (and to the * Apache error log if the message is important enough. */ void msr_log(modsec_rec *msr, int level, const char *text, ...) { va_list ap; va_start(ap, text); internal_log_ex(msr->r, msr->txcfg, msr, level, 0, text, ap); va_end(ap); } /** * Logs one message at level 3 to the debug log and to the * Apache error log. This is intended for error callbacks. */ void msr_log_error(modsec_rec *msr, const char *text, ...) { va_list ap; va_start(ap, text); internal_log_ex(msr->r, msr->txcfg, msr, 3, 1, text, ap); va_end(ap); } /** * Logs one message at level 4 to the debug log and to the * Apache error log. This is intended for warning callbacks. * * The 'text' will first be escaped. */ void msr_log_warn(modsec_rec *msr, const char *text, ...) { va_list ap; va_start(ap, text); internal_log_ex(msr->r, msr->txcfg, msr, 4, 1, text, ap); va_end(ap); } /** * Converts an Apache error log message into one line of text. */ char *format_error_log_message(apr_pool_t *mp, error_message_t *em) { char *s_file = "", *s_line = "", *s_level = ""; char *s_status = "", *s_message = ""; char *msg = NULL; if (em == NULL) return NULL; if (em->file != NULL) { s_file = apr_psprintf(mp, "[file \"%s\"] ", log_escape(mp, (char *)em->file)); if (s_file == NULL) return NULL; } if (em->line > 0) { s_line = apr_psprintf(mp, "[line %d] ", em->line); if (s_line == NULL) return NULL; } s_level = apr_psprintf(mp, "[level %d] ", em->level); if (s_level == NULL) return NULL; if (em->status != 0) { s_status = apr_psprintf(mp, "[status %d] ", em->status); if (s_status == NULL) return NULL; } if (em->message != NULL) { s_message = log_escape_nq(mp, em->message); if (s_message == NULL) return NULL; } msg = apr_psprintf(mp, "%s%s%s%s%s", s_file, s_line, s_level, s_status, s_message); if (msg == NULL) return NULL; return msg; } /** * Determines the reponse protocol Apache will use (or has used) * to respond to the given request. */ const char *get_response_protocol(request_rec *r) { int proto_num = r->proto_num; if (r->assbackwards) { return NULL; } if (proto_num > HTTP_VERSION(1,0) && apr_table_get(r->subprocess_env, "downgrade-1.0")) { proto_num = HTTP_VERSION(1,0); } if (proto_num == HTTP_VERSION(1,0) && apr_table_get(r->subprocess_env, "force-response-1.0")) { return "HTTP/1.0"; } return AP_SERVER_PROTOCOL; } modsecurity-apache_2.7.7/apache2/msc_crypt.h0000664000175000017500000000260212243422537021316 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #ifndef _MSC_CRYPT_H_ #define _MSC_CRYPT_H_ #include "modsecurity.h" #include #include #define HMAC_PAD_SIZE 65 #define HASH_ONLY 0 #define FULL_LINK 1 #ifndef INT32_MAX #define INT32_MAX (2147483647) #endif char DSOLOCAL *hmac(modsec_rec *msr, const char *key, int key_len, unsigned char *msg, int msglen); char DSOLOCAL *do_hash_link(modsec_rec *msr, char *link, int type); char DSOLOCAL *getkey(apr_pool_t *mp); int DSOLOCAL init_response_body_html_parser(modsec_rec *msr); int DSOLOCAL hash_response_body_links(modsec_rec *msr); int DSOLOCAL inject_hashed_response_body(modsec_rec *msr, int elts); int DSOLOCAL do_hash_method(modsec_rec *msr, char *link, int type); int DSOLOCAL modify_response_header(modsec_rec *msr); char DSOLOCAL *normalize_path(modsec_rec *msr, char *input); #endif modsecurity-apache_2.7.7/apache2/msc_multipart.c0000664000175000017500000014413612243422537022202 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #include "modsecurity.h" #include #include #include "msc_multipart.h" #include "msc_util.h" #include "msc_parsers.h" void validate_quotes(modsec_rec *msr, char *data) { int i, len; if(msr == NULL) return; if(msr->mpd == NULL) return; if(data == NULL) return; len = strlen(data); for(i = 0; i < len; i++) { if(data[i] == '\'') { if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Multipart: Invalid quoting detected: %s length %d bytes", log_escape_nq(msr->mp, data), len); } msr->mpd->flag_invalid_quoting = 1; } } } #if 0 static char *multipart_construct_filename(modsec_rec *msr) { char c, *p, *q = msr->mpd->mpp->filename; char *filename; /* find the last backward slash and consider the * filename to be only what's right from it */ p = strrchr(q, '\\'); if (p != NULL) q = p + 1; /* do the same for the forward slash */ p = strrchr(q, '/'); if (p != NULL) q = p + 1; /* allow letters, digits and dots, replace * everything else with underscores */ p = filename = apr_pstrdup(msr->mp, q); while((c = *p) != 0) { if (!( isalnum(c) || (c == '.') )) *p = '_'; p++; } return filename; } #endif /** * */ static int multipart_parse_content_disposition(modsec_rec *msr, char *c_d_value) { char *p = NULL, *t = NULL; /* accept only what we understand */ if (strncmp(c_d_value, "form-data", 9) != 0) { return -1; } /* see if there are any other parts to parse */ p = c_d_value + 9; while((*p == '\t') || (*p == ' ')) p++; if (*p == '\0') return 1; /* this is OK */ if (*p != ';') return -2; p++; /* parse the appended parts */ while(*p != '\0') { char *name = NULL, *value = NULL, *start = NULL; /* go over the whitespace */ while((*p == '\t') || (*p == ' ')) p++; if (*p == '\0') return -3; start = p; while((*p != '\0') && (*p != '=') && (*p != '\t') && (*p != ' ')) p++; if (*p == '\0') return -4; name = apr_pstrmemdup(msr->mp, start, (p - start)); while((*p == '\t') || (*p == ' ')) p++; if (*p == '\0') return -5; if (*p != '=') return -13; p++; while((*p == '\t') || (*p == ' ')) p++; if (*p == '\0') return -6; /* Accept both quotes as some backends will accept them, but * technically "'" is invalid and so flag_invalid_quoting is * set so the user can deal with it in the rules if they so wish. */ if ((*p == '"') || (*p == '\'')) { /* quoted */ char quote = *p; if (quote == '\'') { msr->mpd->flag_invalid_quoting = 1; } p++; if (*p == '\0') return -7; start = p; value = apr_pstrdup(msr->mp, p); t = value; while(*p != '\0') { if (*p == '\\') { if (*(p + 1) == '\0') { /* improper escaping */ return -8; } /* only quote and \ can be escaped */ if ((*(p + 1) == quote) || (*(p + 1) == '\\')) { p++; } else { /* improper escaping */ /* We allow for now because IE sends * improperly escaped content and there's * nothing we can do about it. * * return -9; */ } } else if (*p == quote) { *t = '\0'; break; } *(t++) = *(p++); } if (*p == '\0') return -10; p++; /* go over the quote at the end */ } else { /* not quoted */ start = p; while((*p != '\0') && (is_token_char(*p))) p++; value = apr_pstrmemdup(msr->mp, start, (p - start)); } /* evaluate part */ if (strcmp(name, "name") == 0) { validate_quotes(msr, value); msr->multipart_name = apr_pstrdup(msr->mp, value); if (msr->mpd->mpp->name != NULL) { msr_log(msr, 4, "Multipart: Warning: Duplicate Content-Disposition name: %s", log_escape_nq(msr->mp, value)); return -14; } msr->mpd->mpp->name = value; if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Multipart: Content-Disposition name: %s", log_escape_nq(msr->mp, value)); } } else if (strcmp(name, "filename") == 0) { validate_quotes(msr, value); msr->multipart_filename = apr_pstrdup(msr->mp, value); if (msr->mpd->mpp->filename != NULL) { msr_log(msr, 4, "Multipart: Warning: Duplicate Content-Disposition filename: %s", log_escape_nq(msr->mp, value)); return -15; } msr->mpd->mpp->filename = value; if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Multipart: Content-Disposition filename: %s", log_escape_nq(msr->mp, value)); } } else return -11; if (*p != '\0') { while((*p == '\t') || (*p == ' ')) p++; /* the next character must be a zero or a semi-colon */ if (*p == '\0') return 1; /* this is OK */ if (*p != ';') { p--; if(*p == '\'' || *p == '\"') { if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Multipart: Invalid quoting detected: %s length %d bytes", log_escape_nq(msr->mp, p), strlen(p)); } msr->mpd->flag_invalid_quoting = 1; } p++; return -12; } p++; /* move over the semi-colon */ } /* loop will stop when (*p == '\0') */ } return 1; } /** * */ static int multipart_process_part_header(modsec_rec *msr, char **error_msg) { int i, len, rc; if (error_msg == NULL) return -1; *error_msg = NULL; /* Check for nul bytes. */ len = MULTIPART_BUF_SIZE - msr->mpd->bufleft; for(i = 0; i < len; i++) { if (msr->mpd->buf[i] == '\0') { *error_msg = apr_psprintf(msr->mp, "Multipart: Nul byte in part headers."); return -1; } } /* The buffer is data so increase the data length counter. */ msr->msc_reqbody_no_files_length += (MULTIPART_BUF_SIZE - msr->mpd->bufleft); if (len > 1) { if (msr->mpd->buf[len - 2] == '\r') { msr->mpd->flag_crlf_line = 1; } else { msr->mpd->flag_lf_line = 1; } } else { msr->mpd->flag_lf_line = 1; } /* Is this an empty line? */ if ( ((msr->mpd->buf[0] == '\r') &&(msr->mpd->buf[1] == '\n') &&(msr->mpd->buf[2] == '\0') ) || ((msr->mpd->buf[0] == '\n') &&(msr->mpd->buf[1] == '\0') ) ) { /* Empty line. */ char *header_value = NULL; header_value = (char *)apr_table_get(msr->mpd->mpp->headers, "Content-Disposition"); if (header_value == NULL) { *error_msg = apr_psprintf(msr->mp, "Multipart: Part missing Content-Disposition header."); return -1; } rc = multipart_parse_content_disposition(msr, header_value); if (rc < 0) { *error_msg = apr_psprintf(msr->mp, "Multipart: Invalid Content-Disposition header (%d): %s.", rc, log_escape_nq(msr->mp, header_value)); return -1; } if (msr->mpd->mpp->name == NULL) { *error_msg = apr_psprintf(msr->mp, "Multipart: Content-Disposition header missing name field."); return -1; } if (msr->mpd->mpp->filename != NULL) { /* Some parsers use crude methods to extract the name and filename * values from the C-D header. We need to check for the case where they * didn't understand C-D but we did. */ if (strstr(header_value, "filename=") == NULL) { *error_msg = apr_psprintf(msr->mp, "Multipart: Invalid Content-Disposition header (filename)."); return -1; } msr->mpd->mpp->type = MULTIPART_FILE; } else { msr->mpd->mpp->type = MULTIPART_FORMDATA; } msr->mpd->mpp_state = 1; msr->mpd->mpp->last_header_name = NULL; } else { /* Header line. */ if (isspace(msr->mpd->buf[0])) { char *header_value, *new_value, *data; /* header folding, add data to the header we are building */ msr->mpd->flag_header_folding = 1; /* RFC-2557 states header folding is SP / HTAB, but PHP and * perhaps others will take any whitespace. So, we accept, * but with a flag set. */ if ((msr->mpd->buf[0] != '\t') && (msr->mpd->buf[0] != ' ')) { msr->mpd->flag_invalid_header_folding = 1; } if (msr->mpd->mpp->last_header_name == NULL) { /* we are not building a header at this moment */ *error_msg = apr_psprintf(msr->mp, "Multipart: Invalid part header (folding error)."); return -1; } /* locate the beginning of data */ data = msr->mpd->buf; while(isspace(*data)) { /* Flag invalid header folding if an invalid RFC-2557 character is used anywhere * in the folding prefix. */ if ((*data != '\t') && (*data != ' ')) { msr->mpd->flag_invalid_header_folding = 1; } data++; } new_value = apr_pstrdup(msr->mp, data); remove_lf_crlf_inplace(new_value); /* update the header value in the table */ header_value = (char *)apr_table_get(msr->mpd->mpp->headers, msr->mpd->mpp->last_header_name); new_value = apr_pstrcat(msr->mp, header_value, " ", new_value, NULL); apr_table_set(msr->mpd->mpp->headers, msr->mpd->mpp->last_header_name, new_value); if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Multipart: Continued folder header \"%s\" with \"%s\"", log_escape(msr->mp, msr->mpd->mpp->last_header_name), log_escape(msr->mp, data)); } if (strlen(new_value) > MULTIPART_BUF_SIZE) { *error_msg = apr_psprintf(msr->mp, "Multipart: Part header too long."); return -1; } } else { char *header_name, *header_value, *data; /* new header */ data = msr->mpd->buf; while((*data != ':') && (*data != '\0')) data++; if (*data == '\0') { *error_msg = apr_psprintf(msr->mp, "Multipart: Invalid part header (colon missing): %s.", log_escape_nq(msr->mp, msr->mpd->buf)); return -1; } /* extract header name */ header_name = apr_pstrmemdup(msr->mp, msr->mpd->buf, (data - msr->mpd->buf)); if (data == msr->mpd->buf) { *error_msg = apr_psprintf(msr->mp, "Multipart: Invalid part header (header name missing)."); return -1; } /* extract the value value */ data++; while((*data == '\t') || (*data == ' ')) data++; header_value = apr_pstrdup(msr->mp, data); remove_lf_crlf_inplace(header_value); /* error if the name already exists */ if (apr_table_get(msr->mpd->mpp->headers, header_name) != NULL) { *error_msg = apr_psprintf(msr->mp, "Multipart: Duplicate part header: %s.", log_escape_nq(msr->mp, header_name)); return -1; } apr_table_setn(msr->mpd->mpp->headers, header_name, header_value); msr->mpd->mpp->last_header_name = header_name; if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Multipart: Added part header \"%s\" \"%s\"", log_escape(msr->mp, header_name), log_escape(msr->mp, header_value)); } } } return 1; } /** * */ static int multipart_process_part_data(modsec_rec *msr, char **error_msg) { char *p = msr->mpd->buf + (MULTIPART_BUF_SIZE - msr->mpd->bufleft); char localreserve[2] = { '\0', '\0' }; /* initialized to quiet warning */ int bytes_reserved = 0; if (error_msg == NULL) return -1; *error_msg = NULL; /* Preserve some bytes for later. */ if ( ((MULTIPART_BUF_SIZE - msr->mpd->bufleft) >= 1) && (*(p - 1) == '\n') ) { if ( ((MULTIPART_BUF_SIZE - msr->mpd->bufleft) >= 2) && (*(p - 2) == '\r') ) { /* Two bytes. */ bytes_reserved = 2; localreserve[0] = *(p - 2); localreserve[1] = *(p - 1); msr->mpd->bufleft += 2; *(p - 2) = 0; } else { /* Only one byte. */ bytes_reserved = 1; localreserve[0] = *(p - 1); localreserve[1] = 0; msr->mpd->bufleft += 1; *(p - 1) = 0; } } /* add data to the part we are building */ if (msr->mpd->mpp->type == MULTIPART_FILE) { int extract = msr->upload_extract_files; /* remember where we started */ if (msr->mpd->mpp->length == 0) { msr->mpd->mpp->offset = msr->mpd->buf_offset; } /* check if the file limit has been reached */ if (extract && (msr->mpd->nfiles >= msr->txcfg->upload_file_limit)) { if (msr->mpd->flag_file_limit_exceeded == 0) { *error_msg = apr_psprintf(msr->mp, "Multipart: Upload file limit exceeded " "SecUploadFileLimit %d.", msr->txcfg->upload_file_limit); msr_log(msr, 3, "%s", *error_msg); msr->mpd->flag_file_limit_exceeded = 1; } extract = 0; } /* only store individual files on disk if we are going * to keep them or if we need to have them approved later */ if (extract) { /* first create a temporary file if we don't have it already */ if (msr->mpd->mpp->tmp_file_fd == 0) { /* construct temporary file name */ msr->mpd->mpp->tmp_file_name = apr_psprintf(msr->mp, "%s/%s-%s-file-XXXXXX", msr->txcfg->tmp_dir, current_filetime(msr->mp), msr->txid); msr->mpd->mpp->tmp_file_fd = msc_mkstemp_ex(msr->mpd->mpp->tmp_file_name, msr->txcfg->upload_filemode); /* do we have an opened file? */ if (msr->mpd->mpp->tmp_file_fd < 0) { *error_msg = apr_psprintf(msr->mp, "Multipart: Failed to create file: %s", log_escape_nq(msr->mp, msr->mpd->mpp->tmp_file_name)); return -1; } /* keep track of the files count */ msr->mpd->nfiles++; if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Multipart: Created temporary file %d (mode %04o): %s", msr->mpd->nfiles, (unsigned int)msr->txcfg->upload_filemode, log_escape_nq(msr->mp, msr->mpd->mpp->tmp_file_name)); } } /* write the reserve first */ if (msr->mpd->reserve[0] != 0) { if (write(msr->mpd->mpp->tmp_file_fd, &msr->mpd->reserve[1], msr->mpd->reserve[0]) != msr->mpd->reserve[0]) { *error_msg = apr_psprintf(msr->mp, "Multipart: writing to \"%s\" failed", log_escape(msr->mp, msr->mpd->mpp->tmp_file_name)); return -1; } msr->mpd->mpp->tmp_file_size += msr->mpd->reserve[0]; msr->mpd->mpp->length += msr->mpd->reserve[0]; } /* write data to the file */ if (write(msr->mpd->mpp->tmp_file_fd, msr->mpd->buf, MULTIPART_BUF_SIZE - msr->mpd->bufleft) != (MULTIPART_BUF_SIZE - msr->mpd->bufleft)) { *error_msg = apr_psprintf(msr->mp, "Multipart: writing to \"%s\" failed", log_escape(msr->mp, msr->mpd->mpp->tmp_file_name)); return -1; } msr->mpd->mpp->tmp_file_size += (MULTIPART_BUF_SIZE - msr->mpd->bufleft); msr->mpd->mpp->length += (MULTIPART_BUF_SIZE - msr->mpd->bufleft); } else { /* just keep track of the file size */ msr->mpd->mpp->tmp_file_size += (MULTIPART_BUF_SIZE - msr->mpd->bufleft) + msr->mpd->reserve[0]; msr->mpd->mpp->length += (MULTIPART_BUF_SIZE - msr->mpd->bufleft) + msr->mpd->reserve[0]; } } else if (msr->mpd->mpp->type == MULTIPART_FORMDATA) { value_part_t *value_part = apr_pcalloc(msr->mp, sizeof(value_part_t)); /* The buffer contains data so increase the data length counter. */ msr->msc_reqbody_no_files_length += (MULTIPART_BUF_SIZE - msr->mpd->bufleft) + msr->mpd->reserve[0]; /* add this part to the list of parts */ /* remember where we started */ if (msr->mpd->mpp->length == 0) { msr->mpd->mpp->offset = msr->mpd->buf_offset; } if (msr->mpd->reserve[0] != 0) { value_part->data = apr_palloc(msr->mp, (MULTIPART_BUF_SIZE - msr->mpd->bufleft) + msr->mpd->reserve[0]); memcpy(value_part->data, &(msr->mpd->reserve[1]), msr->mpd->reserve[0]); memcpy(value_part->data + msr->mpd->reserve[0], msr->mpd->buf, (MULTIPART_BUF_SIZE - msr->mpd->bufleft)); value_part->length = (MULTIPART_BUF_SIZE - msr->mpd->bufleft) + msr->mpd->reserve[0]; msr->mpd->mpp->length += value_part->length; } else { value_part->length = (MULTIPART_BUF_SIZE - msr->mpd->bufleft); value_part->data = apr_pstrmemdup(msr->mp, msr->mpd->buf, value_part->length); msr->mpd->mpp->length += value_part->length; } *(value_part_t **)apr_array_push(msr->mpd->mpp->value_parts) = value_part; if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Multipart: Added data to variable: %s", log_escape_nq_ex(msr->mp, value_part->data, value_part->length)); } } else { *error_msg = apr_psprintf(msr->mp, "Multipart: unknown part type %d", msr->mpd->mpp->type); return -1; } /* store the reserved bytes to the multipart * context so that they don't get lost */ if (bytes_reserved) { msr->mpd->reserve[0] = bytes_reserved; msr->mpd->reserve[1] = localreserve[0]; msr->mpd->reserve[2] = localreserve[1]; msr->mpd->buf_offset += bytes_reserved; } else { msr->mpd->buf_offset -= msr->mpd->reserve[0]; msr->mpd->reserve[0] = 0; } return 1; } /** * */ static char *multipart_combine_value_parts(modsec_rec *msr, apr_array_header_t *value_parts) { value_part_t **parts = NULL; char *rval = apr_palloc(msr->mp, msr->mpd->mpp->length + 1); unsigned long int offset; int i; if (rval == NULL) return NULL; offset = 0; parts = (value_part_t **)value_parts->elts; for(i = 0; i < value_parts->nelts; i++) { if (offset + parts[i]->length <= msr->mpd->mpp->length) { memcpy(rval + offset, parts[i]->data, parts[i]->length); offset += parts[i]->length; } } rval[offset] = '\0'; return rval; } /** * */ static int multipart_process_boundary(modsec_rec *msr, int last_part, char **error_log) { /* if there was a part being built finish it */ if (msr->mpd->mpp != NULL) { /* close the temp file */ if ((msr->mpd->mpp->type == MULTIPART_FILE) &&(msr->mpd->mpp->tmp_file_name != NULL) &&(msr->mpd->mpp->tmp_file_fd != 0)) { close(msr->mpd->mpp->tmp_file_fd); msr->mpd->mpp->tmp_file_fd = -1; } if (msr->mpd->mpp->type != MULTIPART_FILE) { /* now construct a single string out of the parts */ msr->mpd->mpp->value = multipart_combine_value_parts(msr, msr->mpd->mpp->value_parts); if (msr->mpd->mpp->value == NULL) return -1; } if (msr->mpd->mpp->name) { /* add the part to the list of parts */ *(multipart_part **)apr_array_push(msr->mpd->parts) = msr->mpd->mpp; if (msr->mpd->mpp->type == MULTIPART_FILE) { if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Multipart: Added file part %pp to the list: name \"%s\" " "file name \"%s\" (offset %u, length %u)", msr->mpd->mpp, log_escape(msr->mp, msr->mpd->mpp->name), log_escape(msr->mp, msr->mpd->mpp->filename), msr->mpd->mpp->offset, msr->mpd->mpp->length); } } else { if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Multipart: Added part %pp to the list: name \"%s\" " "(offset %u, length %u)", msr->mpd->mpp, log_escape(msr->mp, msr->mpd->mpp->name), msr->mpd->mpp->offset, msr->mpd->mpp->length); } } } else { msr->mpd->flag_invalid_part = 1; msr_log(msr, 3, "Multipart: Skipping invalid part %pp (part name missing): " "(offset %u, length %u)", msr->mpd->mpp, msr->mpd->mpp->offset, msr->mpd->mpp->length); } msr->mpd->mpp = NULL; } if (last_part == 0) { /* start building a new part */ msr->mpd->mpp = (multipart_part *)apr_pcalloc(msr->mp, sizeof(multipart_part)); if (msr->mpd->mpp == NULL) return -1; msr->mpd->mpp->type = MULTIPART_FORMDATA; msr->mpd->mpp_state = 0; msr->mpd->mpp->headers = apr_table_make(msr->mp, 10); if (msr->mpd->mpp->headers == NULL) return -1; msr->mpd->mpp->last_header_name = NULL; msr->mpd->reserve[0] = 0; msr->mpd->reserve[1] = 0; msr->mpd->reserve[2] = 0; msr->mpd->reserve[3] = 0; msr->mpd->mpp->value_parts = apr_array_make(msr->mp, 10, sizeof(value_part_t *)); } return 1; } static int multipart_boundary_characters_valid(char *boundary) { unsigned char *p = (unsigned char *)boundary; unsigned char c; if (p == NULL) return -1; while((c = *p) != '\0') { /* Control characters and space not allowed. */ if (c < 32) { return 0; } /* Non-ASCII characters not allowed. */ if (c > 126) { return 0; } switch(c) { /* Special characters not allowed. */ case '(' : case ')' : case '<' : case '>' : case '@' : case ',' : case ';' : case ':' : case '\\' : case '"' : case '/' : case '[' : case ']' : case '?' : case '=' : return 0; break; default : /* Do nothing. */ break; } p++; } return 1; } static int multipart_count_boundary_params(apr_pool_t *mp, const char *header_value) { char *duplicate = NULL; char *s = NULL; int count = 0; if (header_value == NULL) return -1; duplicate = apr_pstrdup(mp, header_value); if (duplicate == NULL) return -1; /* Performing a case-insensitive search. */ strtolower_inplace((unsigned char *)duplicate); s = duplicate; while((s = strstr(s, "boundary")) != NULL) { s += 8; if (strchr(s, '=') != NULL) { count++; } } return count; } /** * */ int multipart_init(modsec_rec *msr, char **error_msg) { if (error_msg == NULL) return -1; *error_msg = NULL; msr->mpd = (multipart_data *)apr_pcalloc(msr->mp, sizeof(multipart_data)); if (msr->mpd == NULL) return -1; msr->mpd->parts = apr_array_make(msr->mp, 10, sizeof(multipart_part *)); msr->mpd->bufleft = MULTIPART_BUF_SIZE; msr->mpd->bufptr = msr->mpd->buf; msr->mpd->buf_contains_line = 1; msr->mpd->mpp = NULL; if (msr->request_content_type == NULL) { msr->mpd->flag_error = 1; *error_msg = apr_psprintf(msr->mp, "Multipart: Content-Type header not available."); return -1; } if (strlen(msr->request_content_type) > 1024) { msr->mpd->flag_error = 1; *error_msg = apr_psprintf(msr->mp, "Multipart: Invalid boundary in C-T (length)."); return -1; } if (strncasecmp(msr->request_content_type, "multipart/form-data", 19) != 0) { msr->mpd->flag_error = 1; *error_msg = apr_psprintf(msr->mp, "Multipart: Invalid MIME type."); return -1; } /* Count how many times the word "boundary" appears in the C-T header. */ if (multipart_count_boundary_params(msr->mp, msr->request_content_type) > 1) { msr->mpd->flag_error = 1; *error_msg = apr_psprintf(msr->mp, "Multipart: Multiple boundary parameters in C-T."); return -1; } msr->mpd->boundary = strstr(msr->request_content_type, "boundary"); if (msr->mpd->boundary != NULL) { char *p = NULL; char *b = NULL; int seen_semicolon = 0; int len = 0; /* Check for extra characters before the boundary. */ for (p = (char *)(msr->request_content_type + 19); p < msr->mpd->boundary; p++) { if (!isspace(*p)) { if ((seen_semicolon == 0) && (*p == ';')) { seen_semicolon = 1; /* It is OK to have one semicolon. */ } else { msr->mpd->flag_error = 1; *error_msg = apr_psprintf(msr->mp, "Multipart: Invalid boundary in C-T (malformed)."); return -1; } } } /* Have we seen the semicolon in the header? */ if (seen_semicolon == 0) { msr->mpd->flag_missing_semicolon = 1; } b = strchr(msr->mpd->boundary + 8, '='); if (b == NULL) { msr->mpd->flag_error = 1; *error_msg = apr_psprintf(msr->mp, "Multipart: Invalid boundary in C-T (malformed)."); return -1; } /* Check parameter name ends well. */ if (b != (msr->mpd->boundary + 8)) { /* Check all characters between the end of the boundary * and the = character. */ for (p = msr->mpd->boundary + 8; p < b; p++) { if (isspace(*p)) { /* Flag for whitespace after parameter name. */ msr->mpd->flag_boundary_whitespace = 1; } else { msr->mpd->flag_error = 1; *error_msg = apr_psprintf(msr->mp, "Multipart: Invalid boundary in C-T (parameter name)."); return -1; } } } b++; /* Go over the = character. */ len = strlen(b); /* Flag for whitespace before parameter value. */ if (isspace(*b)) { msr->mpd->flag_boundary_whitespace = 1; } /* Is the boundary quoted? */ if ((len >= 2) && (*b == '"') && (*(b + len - 1) == '"')) { /* Quoted. */ msr->mpd->boundary = apr_pstrndup(msr->mp, b + 1, len - 2); if (msr->mpd->boundary == NULL) return -1; msr->mpd->flag_boundary_quoted = 1; } else { /* Not quoted. */ /* Test for partial quoting. */ if ( (*b == '"') || ((len >= 2) && (*(b + len - 1) == '"')) ) { msr->mpd->flag_error = 1; *error_msg = apr_psprintf(msr->mp, "Multipart: Invalid boundary in C-T (quote)."); return -1; } msr->mpd->boundary = apr_pstrdup(msr->mp, b); if (msr->mpd->boundary == NULL) return -1; msr->mpd->flag_boundary_quoted = 0; } /* Case-insensitive test for the string "boundary" in the boundary. */ if (multipart_count_boundary_params(msr->mp, msr->mpd->boundary) != 0) { msr->mpd->flag_error = 1; *error_msg = apr_psprintf(msr->mp, "Multipart: Invalid boundary in C-T (content)."); return -1; } /* Validate the characters used in the boundary. */ if (multipart_boundary_characters_valid(msr->mpd->boundary) != 1) { msr->mpd->flag_error = 1; *error_msg = apr_psprintf(msr->mp, "Multipart: Invalid boundary in C-T (characters)."); return -1; } if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Multipart: Boundary%s: %s", (msr->mpd->flag_boundary_quoted ? " (quoted)" : ""), log_escape_nq(msr->mp, msr->mpd->boundary)); } if (strlen(msr->mpd->boundary) == 0) { msr->mpd->flag_error = 1; *error_msg = apr_psprintf(msr->mp, "Multipart: Invalid boundary in C-T (empty)."); return -1; } } else { /* Could not find boundary in the C-T header. */ msr->mpd->flag_error = 1; /* Test for case-insensitive boundary. Allowed by the RFC but highly unusual. */ if (multipart_count_boundary_params(msr->mp, msr->request_content_type) > 0) { *error_msg = apr_psprintf(msr->mp, "Multipart: Invalid boundary in C-T (case sensitivity)."); return -1; } *error_msg = apr_psprintf(msr->mp, "Multipart: Boundary not found in C-T."); return -1; } return 1; } /** * Finalise multipart processing. This method is invoked at the end, when it * is clear that there is no more data to be processed. */ int multipart_complete(modsec_rec *msr, char **error_msg) { if (msr->mpd == NULL) return 1; if (msr->txcfg->debuglog_level >= 4) { if (msr->mpd->flag_data_before) { msr_log(msr, 4, "Multipart: Warning: seen data before first boundary."); } if (msr->mpd->flag_data_after) { msr_log(msr, 4, "Multipart: Warning: seen data after last boundary."); } if (msr->mpd->flag_boundary_quoted) { msr_log(msr, 4, "Multipart: Warning: boundary was quoted."); } if (msr->mpd->flag_boundary_whitespace) { msr_log(msr, 4, "Multipart: Warning: boundary whitespace in C-T header."); } if (msr->mpd->flag_header_folding) { msr_log(msr, 4, "Multipart: Warning: header folding used."); } if (msr->mpd->flag_crlf_line && msr->mpd->flag_lf_line) { msr_log(msr, 4, "Multipart: Warning: mixed line endings used (CRLF/LF)."); } else if (msr->mpd->flag_lf_line) { msr_log(msr, 4, "Multipart: Warning: incorrect line endings used (LF)."); } if (msr->mpd->flag_missing_semicolon) { msr_log(msr, 4, "Multipart: Warning: missing semicolon in C-T header."); } if (msr->mpd->flag_invalid_quoting) { msr_log(msr, 4, "Multipart: Warning: invalid quoting used."); } if (msr->mpd->flag_invalid_part) { msr_log(msr, 4, "Multipart: Warning: invalid part parsing."); } if (msr->mpd->flag_invalid_header_folding) { msr_log(msr, 4, "Multipart: Warning: invalid header folding used."); } } if ((msr->mpd->seen_data != 0) && (msr->mpd->is_complete == 0)) { if (msr->mpd->boundary_count > 0) { /* Check if we have the final boundary (that we haven't * processed yet) in the buffer. */ if (msr->mpd->buf_contains_line) { if ( ((unsigned int)(MULTIPART_BUF_SIZE - msr->mpd->bufleft) == (4 + strlen(msr->mpd->boundary))) && (*(msr->mpd->buf) == '-') && (*(msr->mpd->buf + 1) == '-') && (strncmp(msr->mpd->buf + 2, msr->mpd->boundary, strlen(msr->mpd->boundary)) == 0) && (*(msr->mpd->buf + 2 + strlen(msr->mpd->boundary)) == '-') && (*(msr->mpd->buf + 2 + strlen(msr->mpd->boundary) + 1) == '-') ) { /* Looks like the final boundary - process it. */ if (multipart_process_boundary(msr, 1 /* final */, error_msg) < 0) { msr->mpd->flag_error = 1; return -1; } /* The payload is complete after all. */ msr->mpd->is_complete = 1; } } if (msr->mpd->is_complete == 0) { *error_msg = apr_psprintf(msr->mp, "Multipart: Final boundary missing."); return -1; } } else { *error_msg = apr_psprintf(msr->mp, "Multipart: No boundaries found in payload."); return -1; } } return 1; } /** * */ int multipart_process_chunk(modsec_rec *msr, const char *buf, unsigned int size, char **error_msg) { char *inptr = (char *)buf; unsigned int inleft = size; if (error_msg == NULL) return -1; *error_msg = NULL; if (size == 0) return 1; msr->mpd->seen_data = 1; if (msr->mpd->is_complete) { msr->mpd->flag_data_before = 1; if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Multipart: Ignoring data after last boundary (received %u bytes)", size); } return 1; } if (msr->mpd->bufleft == 0) { msr->mpd->flag_error = 1; *error_msg = apr_psprintf(msr->mp, "Multipart: Internal error in process_chunk: no space left in the buffer"); return -1; } /* here we loop through the available data, one byte at a time */ while(inleft > 0) { char c = *inptr; int process_buffer = 0; if ((c == '\r') && (msr->mpd->bufleft == 1)) { /* we don't want to take \r as the last byte in the buffer */ process_buffer = 1; } else { inptr++; inleft = inleft - 1; *(msr->mpd->bufptr) = c; msr->mpd->bufptr++; msr->mpd->bufleft--; } /* until we either reach the end of the line * or the end of our internal buffer */ if ((c == '\n') || (msr->mpd->bufleft == 0) || (process_buffer)) { int processed_as_boundary = 0; *(msr->mpd->bufptr) = 0; /* Do we have something that looks like a boundary? */ if ( msr->mpd->buf_contains_line && (strlen(msr->mpd->buf) > 3) && (*(msr->mpd->buf) == '-') && (*(msr->mpd->buf + 1) == '-') ) { /* Does it match our boundary? */ if ( (strlen(msr->mpd->buf) >= strlen(msr->mpd->boundary) + 2) && (strncmp(msr->mpd->buf + 2, msr->mpd->boundary, strlen(msr->mpd->boundary)) == 0) ) { char *boundary_end = msr->mpd->buf + 2 + strlen(msr->mpd->boundary); int is_final = 0; /* Is this the final boundary? */ if ((*boundary_end == '-') && (*(boundary_end + 1)== '-')) { is_final = 1; boundary_end += 2; if (msr->mpd->is_complete != 0) { msr->mpd->flag_error = 1; *error_msg = apr_psprintf(msr->mp, "Multipart: Invalid boundary (final duplicate)."); return -1; } } /* Allow for CRLF and LF line endings. */ if ( ( (*boundary_end == '\r') && (*(boundary_end + 1) == '\n') && (*(boundary_end + 2) == '\0') ) || ( (*boundary_end == '\n') && (*(boundary_end + 1) == '\0') ) ) { if (*boundary_end == '\n') { msr->mpd->flag_lf_line = 1; } else { msr->mpd->flag_crlf_line = 1; } if (multipart_process_boundary(msr, (is_final ? 1 : 0), error_msg) < 0) { msr->mpd->flag_error = 1; return -1; } if (is_final) { msr->mpd->is_complete = 1; } processed_as_boundary = 1; msr->mpd->boundary_count++; } else { /* error */ msr->mpd->flag_error = 1; *error_msg = apr_psprintf(msr->mp, "Multipart: Invalid boundary: %s", log_escape_nq(msr->mp, msr->mpd->buf)); return -1; } } else { /* It looks like a boundary but we couldn't match it. */ char *p = NULL; /* Check if an attempt to use quotes around the boundary was made. */ if ( (msr->mpd->flag_boundary_quoted) && (strlen(msr->mpd->buf) >= strlen(msr->mpd->boundary) + 3) && (*(msr->mpd->buf + 2) == '"') && (strncmp(msr->mpd->buf + 3, msr->mpd->boundary, strlen(msr->mpd->boundary)) == 0) ) { msr->mpd->flag_error = 1; *error_msg = apr_psprintf(msr->mp, "Multipart: Invalid boundary (quotes)."); return -1; } /* Check the beginning of the boundary for whitespace. */ p = msr->mpd->buf + 2; while(isspace(*p)) { p++; } if ( (p != msr->mpd->buf + 2) && (strncmp(p, msr->mpd->boundary, strlen(msr->mpd->boundary)) == 0) ) { /* Found whitespace in front of a boundary. */ msr->mpd->flag_error = 1; *error_msg = apr_psprintf(msr->mp, "Multipart: Invalid boundary (whitespace)."); return -1; } msr->mpd->flag_unmatched_boundary = 1; } } else { /* We do not think the buffer contains a boundary. */ /* Look into the buffer to see if there's anything * there that resembles a boundary. */ if (msr->mpd->buf_contains_line) { int i, len = (MULTIPART_BUF_SIZE - msr->mpd->bufleft); char *p = msr->mpd->buf; for(i = 0; i < len; i++) { if ((p[i] == '-') && (i + 1 < len) && (p[i + 1] == '-')) { if (strncmp(p + i + 2, msr->mpd->boundary, strlen(msr->mpd->boundary)) == 0) { msr->mpd->flag_unmatched_boundary = 1; break; } } } } } /* Process as data if it was not a boundary. */ if (processed_as_boundary == 0) { if (msr->mpd->mpp == NULL) { msr->mpd->flag_data_before = 1; if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Multipart: Ignoring data before first boundary."); } } else { if (msr->mpd->mpp_state == 0) { if ((msr->mpd->bufleft == 0) || (process_buffer)) { /* part header lines must be shorter than * MULTIPART_BUF_SIZE bytes */ msr->mpd->flag_error = 1; *error_msg = apr_psprintf(msr->mp, "Multipart: Part header line over %d bytes long", MULTIPART_BUF_SIZE); return -1; } if (multipart_process_part_header(msr, error_msg) < 0) { msr->mpd->flag_error = 1; return -1; } } else { if (multipart_process_part_data(msr, error_msg) < 0) { msr->mpd->flag_error = 1; return -1; } } } } /* Update the offset of the data we are about * to process. This is to allow us to know the * offsets of individual files and variables. */ msr->mpd->buf_offset += (MULTIPART_BUF_SIZE - msr->mpd->bufleft); /* reset the pointer to the beginning of the buffer * and continue to accept input data */ msr->mpd->bufptr = msr->mpd->buf; msr->mpd->bufleft = MULTIPART_BUF_SIZE; msr->mpd->buf_contains_line = (c == 0x0a) ? 1 : 0; } if ((msr->mpd->is_complete) && (inleft != 0)) { msr->mpd->flag_data_after = 1; if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Multipart: Ignoring data after last boundary (%u bytes left)", inleft); } return 1; } } return 1; } /** * */ apr_status_t multipart_cleanup(modsec_rec *msr) { int keep_files = 0; if (msr->mpd == NULL) return -1; if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Multipart: Cleanup started (remove files %d).", msr->upload_remove_files); } if (msr->upload_remove_files == 0) { if (msr->txcfg->upload_dir == NULL) { msr_log(msr, 1, "Input filter: SecUploadDir is undefined, unable to store " "multipart files."); } else { keep_files = 1; } } /* Loop through the list of parts * and delete the temporary files, but only if * file storage was not requested, or if storage * of relevant files was requested and this isn't * such a request. */ if (keep_files == 0) { multipart_part **parts; int i; parts = (multipart_part **)msr->mpd->parts->elts; for(i = 0; i < msr->mpd->parts->nelts; i++) { if (parts[i]->type == MULTIPART_FILE) { if (parts[i]->tmp_file_name != NULL) { /* make sure it is closed first */ if (parts[i]->tmp_file_fd > 0) { close(parts[i]->tmp_file_fd); parts[i]->tmp_file_fd = -1; } if (unlink(parts[i]->tmp_file_name) < 0) { msr_log(msr, 1, "Multipart: Failed to delete file (part) \"%s\" because %d(%s)", log_escape(msr->mp, parts[i]->tmp_file_name), errno, strerror(errno)); } else { if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Multipart: Deleted file (part) \"%s\"", log_escape(msr->mp, parts[i]->tmp_file_name)); } } } } } } else { /* delete empty files, move the others to the upload dir */ multipart_part **parts; int i; parts = (multipart_part **)msr->mpd->parts->elts; for(i = 0; i < msr->mpd->parts->nelts; i++) { if ( (parts[i]->type == MULTIPART_FILE) && (parts[i]->tmp_file_size == 0)) { /* Delete empty file. */ if (parts[i]->tmp_file_name != NULL) { /* make sure it is closed first */ if (parts[i]->tmp_file_fd > 0) { close(parts[i]->tmp_file_fd); parts[i]->tmp_file_fd = -1; } if (unlink(parts[i]->tmp_file_name) < 0) { msr_log(msr, 1, "Multipart: Failed to delete empty file (part) \"%s\" because %d(%s)", log_escape(msr->mp, parts[i]->tmp_file_name), errno, strerror(errno)); } else { if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Multipart: Deleted empty file (part) \"%s\"", log_escape(msr->mp, parts[i]->tmp_file_name)); } } } } else { /* Move file to the upload dir. */ if (parts[i]->tmp_file_name != NULL) { const char *new_filename = NULL; const char *new_basename = NULL; /* make sure it is closed first */ if (parts[i]->tmp_file_fd > 0) { close(parts[i]->tmp_file_fd); parts[i]->tmp_file_fd = -1; } new_basename = file_basename(msr->mp, parts[i]->tmp_file_name); if (new_basename == NULL) return -1; new_filename = apr_psprintf(msr->mp, "%s/%s", msr->txcfg->upload_dir, new_basename); if (new_filename == NULL) return -1; if (apr_file_rename(parts[i]->tmp_file_name, new_filename, msr->msc_reqbody_mp) != APR_SUCCESS) { msr_log(msr, 1, "Input filter: Failed to rename file from \"%s\" to \"%s\".", log_escape(msr->mp, parts[i]->tmp_file_name), log_escape(msr->mp, new_filename)); return -1; } else { if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Input filter: Moved file from \"%s\" to \"%s\".", log_escape(msr->mp, parts[i]->tmp_file_name), log_escape(msr->mp, new_filename)); } } } } } } return 1; } /** * */ int multipart_get_arguments(modsec_rec *msr, char *origin, apr_table_t *arguments) { multipart_part **parts; int i; parts = (multipart_part **)msr->mpd->parts->elts; for(i = 0; i < msr->mpd->parts->nelts; i++) { if (parts[i]->type == MULTIPART_FORMDATA) { msc_arg *arg = (msc_arg *)apr_pcalloc(msr->mp, sizeof(msc_arg)); if (arg == NULL) return -1; arg->name = parts[i]->name; arg->name_len = strlen(parts[i]->name); arg->value = parts[i]->value; arg->value_len = parts[i]->length; arg->value_origin_offset = parts[i]->offset; arg->value_origin_len = parts[i]->length; arg->origin = origin; add_argument(msr, arguments, arg); } } return 1; } /** * */ char *multipart_reconstruct_urlencoded_body_sanitize(modsec_rec *msr) { multipart_part **parts; char *body; unsigned int body_len; int i; if (msr->mpd == NULL) return NULL; /* calculate the size of the buffer */ body_len = 1; parts = (multipart_part **)msr->mpd->parts->elts; for(i = 0; i < msr->mpd->parts->nelts; i++) { if (parts[i]->type == MULTIPART_FORMDATA) { body_len += 4; body_len += strlen(parts[i]->name) * 3; body_len += strlen(parts[i]->value) * 3; } } /* allocate the buffer */ body = apr_palloc(msr->mp, body_len + 1); if ((body == NULL) || (body_len + 1 == 0)) return NULL; *body = 0; parts = (multipart_part **)msr->mpd->parts->elts; for(i = 0; i < msr->mpd->parts->nelts; i++) { if (parts[i]->type == MULTIPART_FORMDATA) { if (*body != 0) { strncat(body, "&", body_len - strlen(body)); } strnurlencat(body, parts[i]->name, body_len - strlen(body)); strncat(body, "=", body_len - strlen(body)); /* Sanitise the variable. Since we are only doing this for * the logging we will actually write over the data we keep * in the memory. */ if (msr->phase >= PHASE_LOGGING) { if (apr_table_get(msr->arguments_to_sanitize, parts[i]->name) != NULL) { memset(parts[i]->value, '*', strlen(parts[i]->value)); } } strnurlencat(body, parts[i]->value, body_len - strlen(body)); } } return body; } modsecurity-apache_2.7.7/apache2/Makefile.am0000664000175000017500000000624512253711345021204 0ustar zimmerlezimmerlepkglibdir = $(prefix)/lib pkglib_LTLIBRARIES = mod_security2.la mod_security2_la_SOURCES = acmp.c \ apache2_config.c \ apache2_io.c \ apache2_util.c \ libinjection/libinjection_sqli.c \ mod_security2.c \ modsecurity.c \ msc_crypt.c \ msc_geo.c \ msc_gsb.c \ msc_logging.c \ msc_lua.c \ msc_multipart.c \ msc_parsers.c \ msc_pcre.c \ msc_release.c \ msc_reqbody.c \ msc_tree.c \ msc_unicode.c \ msc_util.c \ msc_xml.c \ persist_dbm.c \ re_actions.c \ re.c \ re_operators.c \ re_tfns.c \ re_variables.c mod_security2_la_CFLAGS = @APR_CFLAGS@ \ @APU_CFLAGS@ \ @APXS_CFLAGS@ \ @CURL_CFLAGS@ \ @LIBXML2_CFLAGS@ \ @LUA_CFLAGS@ \ @MODSEC_EXTRA_CFLAGS@ \ @PCRE_CFLAGS@ mod_security2_la_CPPFLAGS = @APR_CPPFLAGS@ \ @LIBXML2_CPPFLAGS@ \ @PCRE_CPPFLAGS@ mod_security2_la_LIBADD = @APR_LDADD@ \ @APU_LDADD@ \ @LIBXML2_LDADD@ \ @LUA_LDADD@ \ @PCRE_LDADD@ if AIX mod_security2_la_LDFLAGS = -module -avoid-version \ @APR_LDFLAGS@ \ @APU_LDFLAGS@ \ @APXS_LDFLAGS@ \ @LIBXML2_LDFLAGS@ \ @LUA_LDFLAGS@ \ @PCRE_LDFLAGS@ endif if HPUX mod_security2_la_LDFLAGS = -module -avoid-version \ @APR_LDFLAGS@ \ @APU_LDFLAGS@ \ @APXS_LDFLAGS@ \ @LIBXML2_LDFLAGS@ \ @LUA_LDFLAGS@ \ @PCRE_LDFLAGS@ endif if MACOSX mod_security2_la_LDFLAGS = -module -avoid-version \ @APR_LDFLAGS@ \ @APU_LDFLAGS@ \ @APXS_LDFLAGS@ \ @LIBXML2_LDFLAGS@ \ @LUA_LDFLAGS@ \ @PCRE_LDFLAGS@ endif if SOLARIS mod_security2_la_LDFLAGS = -module -avoid-version \ @APR_LDFLAGS@ \ @APU_LDFLAGS@ \ @APXS_LDFLAGS@ \ @LIBXML2_LDFLAGS@ \ @LUA_LDFLAGS@ \ @PCRE_LDFLAGS@ endif if LINUX mod_security2_la_LDFLAGS = -no-undefined -module -avoid-version -R @PCRE_LD_PATH@ \ @APR_LDFLAGS@ \ @APU_LDFLAGS@ \ @APXS_LDFLAGS@ \ @LIBXML2_LDFLAGS@ \ @LUA_LDFLAGS@ \ @PCRE_LDFLAGS@ endif if FREEBSD mod_security2_la_LDFLAGS = -no-undefined -module -avoid-version \ @APR_LDFLAGS@ \ @APU_LDFLAGS@ \ @APXS_LDFLAGS@ \ @LIBXML2_LDFLAGS@ \ @LUA_LDFLAGS@ \ @PCRE_LDFLAGS@ endif if OPENBSD mod_security2_la_LDFLAGS = -no-undefined -module -avoid-version \ @APR_LDFLAGS@ \ @APU_LDFLAGS@ \ @APXS_LDFLAGS@ \ @LIBXML2_LDFLAGS@ \ @LUA_LDFLAGS@ \ @PCRE_LDFLAGS@ endif if NETBSD mod_security2_la_LDFLAGS = -no-undefined -module -avoid-version \ @APR_LDFLAGS@ \ @APU_LDFLAGS@ \ @APXS_LDFLAGS@ \ @LIBXML2_LDFLAGS@ \ @LUA_LDFLAGS@ \ @PCRE_LDFLAGS@ endif if LINUX install-exec-hook: $(pkglib_LTLIBRARIES) @echo "Removing unused static libraries..."; \ for m in $(pkglib_LTLIBRARIES); do \ base=`echo $$m | sed 's/\..*//'`; \ rm -f $(DESTDIR)$(pkglibdir)/$$base.*a; \ install -D -m444 $(DESTDIR)$(pkglibdir)/$$base.so $(DESTDIR)$(APXS_MODULES)/$$base.so; \ done else install-exec-hook: $(pkglib_LTLIBRARIES) @echo "Removing unused static libraries..."; \ for m in $(pkglib_LTLIBRARIES); do \ base=`echo $$m | sed 's/\..*//'`; \ rm -f $(DESTDIR)$(pkglibdir)/$$base.*a; \ cp -p $(DESTDIR)$(pkglibdir)/$$base.so $(DESTDIR)$(APXS_MODULES); \ done endif modsecurity-apache_2.7.7/apache2/msc_parsers.h0000664000175000017500000000207012243422537021633 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #ifndef _MSC_PARSERS_H_ #define _MSC_PARSERS_H_ #include "modsecurity.h" int DSOLOCAL parse_cookies_v0(modsec_rec *msr, char *_cookie_header, apr_table_t *cookies, const char *delim); int DSOLOCAL parse_cookies_v1(modsec_rec *msr, char *_cookie_header, apr_table_t *cookies); int DSOLOCAL parse_arguments(modsec_rec *msr, const char *s, apr_size_t inputlength, int argument_separator, const char *origin, apr_table_t *arguments, int *invalid_count); void DSOLOCAL add_argument(modsec_rec *msr, apr_table_t *arguments, msc_arg *arg); #endif modsecurity-apache_2.7.7/apache2/acmp.h0000664000175000017500000000655312243422537020244 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #ifndef ACMP_H_ #define ACMP_H_ #include #include #define ACMP_FLAG_BYTE 0 #define ACMP_FLAG_CASE_SENSITIVE 1 #define ACMP_FLAG_CASE_INSENSITIVE 0 #ifdef ACMP_USE_UTF8 #define ACMP_FLAG_UTF8 0x100 #endif /** * Opaque struct with parser data */ typedef struct ACMP ACMP; /** * Used to separate state from the trie for acmp_process_quick function */ typedef struct { ACMP *parser; void *ptr; } ACMPT; /** * Callback function. Arguments are: * ACMP * - acmp parser that initiated callback * void * - custom data you supplied when adding callback * apr_size_t - position in bytes where pattern was found * apr_size_t - position in chars where pattern was found, for multibyte strings */ typedef void (*acmp_callback_t)(ACMP *, void *, apr_size_t, apr_size_t); /** * flags - OR-ed values of ACMP_FLAG constants * pool - apr_pool to use as parent pool, can be set to NULL */ ACMP *acmp_create(int flags, apr_pool_t *pool); /** * Destroys previously created parser */ void acmp_destroy(ACMP *parser); /** * Creates parser with same options and same patterns * parser - ACMP parser to duplicate * pool - parent pool to use, if left as NULL original parser's parent pool is used */ ACMP *acmp_duplicate(ACMP *parser, apr_pool_t *pool); /** * Adds pattern to parser. Cannot be done after starting the search. * parser - ACMP parser * pattern - string with pattern to match * callback - Optional, pointer to an acmp_callback_t function * data - pointer to data that will be passed to callback function, only used if callback * is supplied * len - Length of pattern in characters, if zero string length is used. */ apr_status_t acmp_add_pattern(ACMP *parser, const char *pattern, acmp_callback_t callback, void *data, apr_size_t len); /** * Called to process incoming data stream. You must call acmp_done after sending * last data packet * * data - ptr to incoming data * len - size of data in bytes */ apr_status_t acmp_process(ACMP *parser, const char *data, apr_size_t len); /** * Returns number of matches on all patterns combined */ apr_size_t acmp_match_count_total(ACMP *parser); /** * Returns number of matches for given pattern */ apr_size_t acmp_match_count(ACMP *parser, const char *pattern); /** * Resets the state of parser so you can start using it with new set of data, * or add new patterns. */ void acmp_reset(ACMP *parser); /** * Creates an ACMPT struct that will use parser's tree, without duplicating its data */ ACMPT *acmp_duplicate_quick(ACMP *parser, apr_pool_t *pool); /** * Process the data using ACMPT to keep state, and ACMPT's parser to keep the tree */ apr_status_t acmp_process_quick(ACMPT *acmpt, const char **match, const char *data, apr_size_t len); /** * Prepares parser for searching */ apr_status_t acmp_prepare(ACMP *parser); #endif /*ACMP_H_*/ modsecurity-apache_2.7.7/apache2/msc_reqbody.c0000664000175000017500000010155212252647335021626 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #include "modsecurity.h" #include "re.h" #include "msc_parsers.h" #define CHUNK_CAPACITY 8192 /** * */ void msre_engine_reqbody_processor_register(msre_engine *engine, const char *name, void *fn_init, void *fn_process, void *fn_complete) { msre_reqbody_processor_metadata *metadata = (msre_reqbody_processor_metadata *)apr_pcalloc(engine->mp, sizeof(msre_reqbody_processor_metadata)); if (metadata == NULL) return; metadata->name = name; metadata->init = fn_init; metadata->process = fn_process; metadata->complete = fn_complete; apr_table_setn(engine->reqbody_processors, name, (void *)metadata); } /** * Prepare to accept the request body (part 2). */ static apr_status_t modsecurity_request_body_start_init(modsec_rec *msr, char **error_msg) { *error_msg = NULL; if(msr->msc_reqbody_storage == MSC_REQBODY_MEMORY) { /* Prepare to store request body in memory. */ msr->msc_reqbody_chunks = apr_array_make(msr->msc_reqbody_mp, 32, sizeof(msc_data_chunk *)); if (msr->msc_reqbody_chunks == NULL) { *error_msg = apr_pstrdup(msr->mp, "Input filter: Failed to prepare in-memory storage."); return -1; } } else { /* Prepare to store request body on disk. */ msr->msc_reqbody_filename = apr_psprintf(msr->mp, "%s/%s-%s-request_body-XXXXXX", msr->txcfg->tmp_dir, current_filetime(msr->mp), msr->txid); if (msr->msc_reqbody_filename == NULL) { *error_msg = apr_pstrdup(msr->mp, "Input filter: Failed to generate an on-disk filename."); return -1; } msr->msc_reqbody_fd = msc_mkstemp((char *)msr->msc_reqbody_filename); if (msr->msc_reqbody_fd < 0) { *error_msg = apr_psprintf(msr->mp, "Input filter: Failed to create temporary file: %s", msr->msc_reqbody_filename); return -1; } msr_log(msr, 4, "Input filter: Created temporary file to store request body: %s", msr->msc_reqbody_filename); } return 1; } /** * Prepare to accept the request body (part 1). */ apr_status_t modsecurity_request_body_start(modsec_rec *msr, char **error_msg) { *error_msg = NULL; msr->msc_reqbody_length = 0; msr->stream_input_length = 0; /* Create a separate memory pool that will be used * to allocate structures from (not data, which is allocated * via malloc). */ apr_pool_create(&msr->msc_reqbody_mp, NULL); /* Initialise request body processors, if any. */ if (msr->msc_reqbody_processor != NULL) { char *my_error_msg = NULL; msre_reqbody_processor_metadata *metadata = (msre_reqbody_processor_metadata *)apr_table_get(msr->modsecurity->msre->reqbody_processors, msr->msc_reqbody_processor); if (metadata != NULL) { if ( (metadata->init != NULL) && (metadata->init(msr, &my_error_msg) < 0)) { *error_msg = apr_psprintf(msr->mp, "%s parsing error (init): %s", msr->msc_reqbody_processor, my_error_msg); msr->msc_reqbody_error = 1; msr->msc_reqbody_error_msg = my_error_msg; msr_log(msr, 2, "%s", *error_msg); } } // TODO: All these below need to be registered in the same way as above else if (strcmp(msr->msc_reqbody_processor, "MULTIPART") == 0) { if (multipart_init(msr, &my_error_msg) < 0) { *error_msg = apr_psprintf(msr->mp, "Multipart parsing error (init): %s", my_error_msg); msr->msc_reqbody_error = 1; msr->msc_reqbody_error_msg = my_error_msg; msr_log(msr, 2, "%s", *error_msg); } } else if (strcmp(msr->msc_reqbody_processor, "XML") == 0) { if (xml_init(msr, &my_error_msg) < 0) { *error_msg = apr_psprintf(msr->mp, "XML parsing error (init): %s", my_error_msg); msr->msc_reqbody_error = 1; msr->msc_reqbody_error_msg = my_error_msg; msr_log(msr, 2, "%s", *error_msg); } } else if (strcmp(msr->msc_reqbody_processor, "URLENCODED") == 0) { /* Do nothing, URLENCODED processor does not support streaming yet. */ } else { *error_msg = apr_psprintf(msr->mp, "Unknown request body processor: %s", msr->msc_reqbody_processor); return -1; } } return modsecurity_request_body_start_init(msr, error_msg); } /** * Stores a chunk of request body data to disk. */ static apr_status_t modsecurity_request_body_store_disk(modsec_rec *msr, const char *data, apr_size_t length, char **error_msg) { apr_size_t i; *error_msg = NULL; i = write(msr->msc_reqbody_fd, data, length); if (i != length) { *error_msg = apr_psprintf(msr->mp, "Input filter: Failed writing %" APR_SIZE_T_FMT " bytes to temporary file (rc %" APR_SIZE_T_FMT ").", length, i); return -1; } return 1; } /** * Stores one chunk of request body data in memory. */ static apr_status_t modsecurity_request_body_store_memory(modsec_rec *msr, const char *data, apr_size_t length, char **error_msg) { *error_msg = NULL; /* Would storing this chunk mean going over the limit? */ if ((msr->msc_reqbody_spilltodisk) && (msr->txcfg->reqbody_buffering != REQUEST_BODY_FORCEBUF_ON) && (msr->msc_reqbody_length + length > (apr_size_t)msr->txcfg->reqbody_inmemory_limit)) { msc_data_chunk **chunks; unsigned int disklen = 0; int i; msr_log(msr, 4, "Input filter: Request too large to store in memory, switching to disk."); /* NOTE Must use modsecurity_request_body_store_disk() here * to prevent data to be sent to the streaming * processors again. */ /* Initialise disk storage */ msr->msc_reqbody_storage = MSC_REQBODY_DISK; if (modsecurity_request_body_start_init(msr, error_msg) < 0) return -1; /* Write the data we keep in memory */ chunks = (msc_data_chunk **)msr->msc_reqbody_chunks->elts; for(i = 0; i < msr->msc_reqbody_chunks->nelts; i++) { disklen += chunks[i]->length; if (modsecurity_request_body_store_disk(msr, chunks[i]->data, chunks[i]->length, error_msg) < 0) { return -1; } free(chunks[i]->data); chunks[i]->data = NULL; } /* Clear the memory pool as we no longer need the bits. */ /* IMP1 But since we only used apr_pool_clear memory might * not be released back to the OS straight away? */ msr->msc_reqbody_chunks = NULL; apr_pool_clear(msr->msc_reqbody_mp); msr_log(msr, 4, "Input filter: Wrote %u bytes from memory to disk.", disklen); /* Continue with disk storage from now on */ return modsecurity_request_body_store_disk(msr, data, length, error_msg); } /* If we're here that means we are not over the * request body in-memory limit yet. */ { unsigned long int bucket_offset, bucket_left; bucket_offset = 0; bucket_left = length; /* Although we store the request body in chunks we don't * want to use the same chunk sizes as the incoming memory * buffers. They are often of very small sizes and that * would make us waste a lot of memory. That's why we * use our own chunks of CHUNK_CAPACITY sizes. */ /* Loop until we empty this bucket into our chunks. */ while(bucket_left > 0) { /* Allocate a new chunk if we have to. */ if (msr->msc_reqbody_chunk_current == NULL) { msr->msc_reqbody_chunk_current = (msc_data_chunk *) apr_pcalloc(msr->msc_reqbody_mp, sizeof(msc_data_chunk)); if (msr->msc_reqbody_chunk_current == NULL) { *error_msg = apr_psprintf(msr->mp, "Input filter: Failed to allocate %lu bytes " "for request body chunk.", (unsigned long)sizeof(msc_data_chunk)); return -1; } msr->msc_reqbody_chunk_current->data = malloc(CHUNK_CAPACITY); if (msr->msc_reqbody_chunk_current->data == NULL) { *error_msg = apr_psprintf(msr->mp, "Input filter: Failed to allocate %d bytes " "for request body chunk data.", CHUNK_CAPACITY); return -1; } msr->msc_reqbody_chunk_current->length = 0; msr->msc_reqbody_chunk_current->is_permanent = 1; *(const msc_data_chunk **)apr_array_push(msr->msc_reqbody_chunks) = msr->msc_reqbody_chunk_current; } if (bucket_left < (CHUNK_CAPACITY - msr->msc_reqbody_chunk_current->length)) { /* There's enough space in the current chunk. */ memcpy(msr->msc_reqbody_chunk_current->data + msr->msc_reqbody_chunk_current->length, data + bucket_offset, bucket_left); msr->msc_reqbody_chunk_current->length += bucket_left; bucket_left = 0; } else { /* Fill the existing chunk. */ unsigned long int copy_length = CHUNK_CAPACITY - msr->msc_reqbody_chunk_current->length; memcpy(msr->msc_reqbody_chunk_current->data + msr->msc_reqbody_chunk_current->length, data + bucket_offset, copy_length); bucket_offset += copy_length; bucket_left -= copy_length; msr->msc_reqbody_chunk_current->length += copy_length; /* We're done with this chunk. Setting the pointer * to NULL is going to force a new chunk to be allocated * on the next go. */ msr->msc_reqbody_chunk_current = NULL; } } msr->msc_reqbody_length += length; } return 1; } /** * Stores one chunk of request body data. Returns -1 on error. */ apr_status_t modsecurity_request_body_store(modsec_rec *msr, const char *data, apr_size_t length, char **error_msg) { *error_msg = NULL; /* If we have a processor for this request body send * data to it first (but only if it did not report an * error on previous invocations). */ if ((msr->msc_reqbody_processor != NULL) && (msr->msc_reqbody_error == 0)) { char *my_error_msg = NULL; msre_reqbody_processor_metadata *metadata = (msre_reqbody_processor_metadata *)apr_table_get(msr->modsecurity->msre->reqbody_processors, msr->msc_reqbody_processor); if (metadata != NULL) { if ( (metadata->process != NULL) && (metadata->process(msr, data, length, &my_error_msg) < 0)) { *error_msg = apr_psprintf(msr->mp, "%s parsing error: %s", msr->msc_reqbody_processor, my_error_msg); msr->msc_reqbody_error = 1; msr->msc_reqbody_error_msg = my_error_msg; msr_log(msr, 2, "%s", *error_msg); } } // TODO: All these below need to be registered in the same way as above else if (strcmp(msr->msc_reqbody_processor, "MULTIPART") == 0) { /* The per-request data length counter will * be updated by the multipart parser. */ /* Process data as multipart/form-data. */ if (multipart_process_chunk(msr, data, length, &my_error_msg) < 0) { *error_msg = apr_psprintf(msr->mp, "Multipart parsing error: %s", my_error_msg); msr->msc_reqbody_error = 1; msr->msc_reqbody_error_msg = *error_msg; msr_log(msr, 2, "%s", *error_msg); } } else if (strcmp(msr->msc_reqbody_processor, "XML") == 0) { /* Increase per-request data length counter. */ msr->msc_reqbody_no_files_length += length; /* Process data as XML. */ if (xml_process_chunk(msr, data, length, &my_error_msg) < 0) { *error_msg = apr_psprintf(msr->mp, "XML parsing error: %s", my_error_msg); msr->msc_reqbody_error = 1; msr->msc_reqbody_error_msg = *error_msg; msr_log(msr, 2, "%s", *error_msg); } } else if (strcmp(msr->msc_reqbody_processor, "URLENCODED") == 0) { /* Increase per-request data length counter. */ msr->msc_reqbody_no_files_length += length; /* Do nothing else, URLENCODED processor does not support streaming. */ } else { *error_msg = apr_psprintf(msr->mp, "Unknown request body processor: %s", msr->msc_reqbody_processor); return -1; } } else if (msr->txcfg->reqbody_buffering != REQUEST_BODY_FORCEBUF_OFF) { /* Increase per-request data length counter if forcing buffering. */ msr->msc_reqbody_no_files_length += length; } /* Check that we are not over the request body no files limit. */ if (msr->msc_reqbody_no_files_length >= (unsigned long) msr->txcfg->reqbody_no_files_limit) { *error_msg = apr_psprintf(msr->mp, "Request body no files data length is larger than the " "configured limit (%ld).", msr->txcfg->reqbody_no_files_limit); if (msr->txcfg->debuglog_level >= 1) { msr_log(msr, 1, "%s", *error_msg); } if ((msr->txcfg->is_enabled == MODSEC_ENABLED) && (msr->txcfg->if_limit_action == REQUEST_BODY_LIMIT_ACTION_REJECT)) { return -5; } else if (msr->txcfg->if_limit_action == REQUEST_BODY_LIMIT_ACTION_PARTIAL) { if(msr->txcfg->is_enabled == MODSEC_ENABLED) return -5; } } /* Store data. */ if (msr->msc_reqbody_storage == MSC_REQBODY_MEMORY) { return modsecurity_request_body_store_memory(msr, data, length, error_msg); } else if (msr->msc_reqbody_storage == MSC_REQBODY_DISK) { return modsecurity_request_body_store_disk(msr, data, length, error_msg); } /* Should never happen. */ *error_msg = apr_psprintf(msr->mp, "Internal error, unknown value for msc_reqbody_storage: %u", msr->msc_reqbody_storage); return -1; } apr_status_t modsecurity_request_body_to_stream(modsec_rec *msr, const char *buffer, int buflen, char **error_msg) { char *stream_input_body = NULL; char *data = NULL; int first_pkt = 0; if(msr->stream_input_data == NULL) { msr->stream_input_data = (char *)calloc(sizeof(char), msr->stream_input_length + 1); first_pkt = 1; } else { data = (char *)malloc(msr->stream_input_length + 1 - buflen); if(data == NULL) return -1; memset(data, 0, msr->stream_input_length + 1 - buflen); memcpy(data, msr->stream_input_data, msr->stream_input_length - buflen); stream_input_body = (char *)realloc(msr->stream_input_data, msr->stream_input_length + 1); msr->stream_input_data = (char *)stream_input_body; } if (msr->stream_input_data == NULL) { if(data) { free(data); data = NULL; } *error_msg = apr_psprintf(msr->mp, "Unable to allocate memory to hold request body on stream. Asked for %" APR_SIZE_T_FMT " bytes.", msr->stream_input_length + 1); return -1; } memset(msr->stream_input_data, 0, msr->stream_input_length+1); if(first_pkt) { memcpy(msr->stream_input_data, buffer, msr->stream_input_length); } else { memcpy(msr->stream_input_data, data, msr->stream_input_length - buflen); memcpy(msr->stream_input_data+(msr->stream_input_length - buflen), buffer, buflen); } if(data) { free(data); data = NULL; } return 1; } /** * Replace a bunch of chunks holding a request body with a single large chunk. */ static apr_status_t modsecurity_request_body_end_raw(modsec_rec *msr, char **error_msg) { msc_data_chunk **chunks, *one_chunk; char *d; int i, sofar; *error_msg = NULL; /* Allocate a buffer large enough to hold the request body. */ if (msr->msc_reqbody_length + 1 == 0) { *error_msg = apr_psprintf(msr->mp, "Internal error, request body length will overflow: %u", msr->msc_reqbody_length); return -1; } msr->msc_reqbody_buffer = malloc(msr->msc_reqbody_length + 1); if (msr->msc_reqbody_buffer == NULL) { *error_msg = apr_psprintf(msr->mp, "Unable to allocate memory to hold request body. Asked for %u bytes.", msr->msc_reqbody_length + 1); return -1; } msr->msc_reqbody_buffer[msr->msc_reqbody_length] = '\0'; /* Copy the data we keep in chunks into the new buffer. */ sofar = 0; d = msr->msc_reqbody_buffer; chunks = (msc_data_chunk **)msr->msc_reqbody_chunks->elts; for(i = 0; i < msr->msc_reqbody_chunks->nelts; i++) { if (sofar + chunks[i]->length <= msr->msc_reqbody_length) { memcpy(d, chunks[i]->data, chunks[i]->length); d += chunks[i]->length; sofar += chunks[i]->length; } else { *error_msg = apr_psprintf(msr->mp, "Internal error, request body buffer overflow."); return -1; } } /* Now free the memory used by the chunks. */ chunks = (msc_data_chunk **)msr->msc_reqbody_chunks->elts; for(i = 0; i < msr->msc_reqbody_chunks->nelts; i++) { free(chunks[i]->data); chunks[i]->data = NULL; } /* Create a new array with only one chunk in it. */ msr->msc_reqbody_chunks = apr_array_make(msr->msc_reqbody_mp, 2, sizeof(msc_data_chunk *)); if (msr->msc_reqbody_chunks == NULL) { *error_msg = apr_pstrdup(msr->mp, "Failed to create structure to hold request body."); return -1; } one_chunk = (msc_data_chunk *)apr_pcalloc(msr->msc_reqbody_mp, sizeof(msc_data_chunk)); one_chunk->data = msr->msc_reqbody_buffer; one_chunk->length = msr->msc_reqbody_length; one_chunk->is_permanent = 1; *(const msc_data_chunk **)apr_array_push(msr->msc_reqbody_chunks) = one_chunk; if(msr->txcfg->reqbody_limit > 0 && msr->txcfg->reqbody_limit < msr->msc_reqbody_length) { msr->msc_reqbody_length = msr->txcfg->reqbody_limit; } return 1; } /** * */ static apr_status_t modsecurity_request_body_end_urlencoded(modsec_rec *msr, char **error_msg) { int invalid_count = 0; *error_msg = NULL; /* Create the raw buffer */ if (modsecurity_request_body_end_raw(msr, error_msg) != 1) { return -1; } /* Parse URL-encoded arguments in the request body. */ if (parse_arguments(msr, msr->msc_reqbody_buffer, msr->msc_reqbody_length, msr->txcfg->argument_separator, "BODY", msr->arguments, &invalid_count) < 0) { *error_msg = apr_pstrdup(msr->mp, "Initialisation: Error occurred while parsing BODY arguments."); return -1; } if (invalid_count) { msr->urlencoded_error = 1; } return 1; } /** * Stops receiving the request body. */ apr_status_t modsecurity_request_body_end(modsec_rec *msr, char **error_msg) { *error_msg = NULL; /* Close open file descriptors, if any. */ if (msr->msc_reqbody_storage == MSC_REQBODY_DISK) { if (msr->msc_reqbody_fd > 0) { close(msr->msc_reqbody_fd); msr->msc_reqbody_fd = -1; } } /* Note that we've read the body. */ msr->msc_reqbody_read = 1; /* Finalise body processing. */ if ((msr->msc_reqbody_processor != NULL) && (msr->msc_reqbody_error == 0)) { char *my_error_msg = NULL; msre_reqbody_processor_metadata *metadata = (msre_reqbody_processor_metadata *)apr_table_get(msr->modsecurity->msre->reqbody_processors, msr->msc_reqbody_processor); if (metadata != NULL) { if ( (metadata->complete != NULL) && (metadata->complete(msr, &my_error_msg) < 0)) { *error_msg = apr_psprintf(msr->mp, "%s parsing error (complete): %s", msr->msc_reqbody_processor, my_error_msg); msr->msc_reqbody_error = 1; msr->msc_reqbody_error_msg = my_error_msg; msr_log(msr, 2, "%s", *error_msg); } } // TODO: All these below need to be registered in the same way as above else if (strcmp(msr->msc_reqbody_processor, "MULTIPART") == 0) { if (multipart_complete(msr, &my_error_msg) < 0) { *error_msg = apr_psprintf(msr->mp, "Multipart parsing error: %s", my_error_msg); msr->msc_reqbody_error = 1; msr->msc_reqbody_error_msg = *error_msg; if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "%s", *error_msg); } return -1; } if (multipart_get_arguments(msr, "BODY", msr->arguments) < 0) { *error_msg = "Multipart parsing error: Failed to retrieve arguments."; msr->msc_reqbody_error = 1; msr->msc_reqbody_error_msg = *error_msg; msr_log(msr, 2, "%s", *error_msg); return -1; } } else if (strcmp(msr->msc_reqbody_processor, "URLENCODED") == 0) { return modsecurity_request_body_end_urlencoded(msr, error_msg); } else if (strcmp(msr->msc_reqbody_processor, "XML") == 0) { if (xml_complete(msr, &my_error_msg) < 0) { *error_msg = apr_psprintf(msr->mp, "XML parser error: %s", my_error_msg); msr->msc_reqbody_error = 1; msr->msc_reqbody_error_msg = *error_msg; msr_log(msr, 2, "%s", *error_msg); return -1; } } } else if (msr->txcfg->reqbody_buffering != REQUEST_BODY_FORCEBUF_OFF) { /* Convert to a single continous buffer, but don't do anything else. */ return modsecurity_request_body_end_raw(msr, error_msg); } /* Note the request body no files length. */ msr_log(msr, 4, "Request body no files length: %" APR_SIZE_T_FMT, msr->msc_reqbody_no_files_length); return 1; } /** * Prepares to forward the request body. */ apr_status_t modsecurity_request_body_retrieve_start(modsec_rec *msr, char **error_msg) { *error_msg = NULL; if (msr->msc_reqbody_storage == MSC_REQBODY_MEMORY) { msr->msc_reqbody_chunk_position = 0; msr->msc_reqbody_chunk_offset = 0; msr->msc_reqbody_disk_chunk = apr_pcalloc(msr->msc_reqbody_mp, sizeof(msc_data_chunk)); if (msr->msc_reqbody_disk_chunk == NULL) { *error_msg = apr_psprintf(msr->mp, "Failed to allocate %lu bytes for request body disk chunk.", (unsigned long)sizeof(msc_data_chunk)); return -1; } msr->msc_reqbody_disk_chunk->is_permanent = 1; } else if (msr->msc_reqbody_storage == MSC_REQBODY_DISK) { msr->msc_reqbody_disk_chunk = apr_pcalloc(msr->msc_reqbody_mp, sizeof(msc_data_chunk)); if (msr->msc_reqbody_disk_chunk == NULL) { *error_msg = apr_psprintf(msr->mp, "Failed to allocate %lu bytes for request body disk chunk.", (unsigned long)sizeof(msc_data_chunk)); return -1; } msr->msc_reqbody_disk_chunk->is_permanent = 0; msr->msc_reqbody_disk_chunk->data = apr_palloc(msr->msc_reqbody_mp, CHUNK_CAPACITY); if (msr->msc_reqbody_disk_chunk->data == NULL) { *error_msg = apr_psprintf(msr->mp, "Failed to allocate %d bytes for request body disk chunk data.", CHUNK_CAPACITY); return -1; } msr->msc_reqbody_fd = open(msr->msc_reqbody_filename, O_RDONLY | O_BINARY); if (msr->msc_reqbody_fd < 0) { *error_msg = apr_psprintf(msr->mp, "Failed to open temporary file for reading: %s", msr->msc_reqbody_filename); return -1; } } return 1; } /** * */ apr_status_t modsecurity_request_body_retrieve_end(modsec_rec *msr) { if (msr->msc_reqbody_storage == MSC_REQBODY_DISK) { if (msr->msc_reqbody_fd > 0) { close(msr->msc_reqbody_fd); msr->msc_reqbody_fd = -1; } } return 1; } /** * Returns one chunk of request body data. It stores a NULL * in the chunk pointer when there is no data to return. The * return code is 1 if more calls can be made to retrieve more * data, 0 if there is no more data to retrieve, or -1 on error. * * The caller can limit the amount of data returned by providing * a non-negative value in nbytes. */ apr_status_t modsecurity_request_body_retrieve(modsec_rec *msr, msc_data_chunk **chunk, long int nbytes, char **error_msg) { msc_data_chunk **chunks; *error_msg = NULL; if (chunk == NULL) { *error_msg = apr_pstrdup(msr->mp, "Internal error, retrieving request body chunk."); return -1; } *chunk = NULL; if (msr->msc_reqbody_storage == MSC_REQBODY_MEMORY) { /* Are there any chunks left? */ if (msr->msc_reqbody_chunk_position >= msr->msc_reqbody_chunks->nelts) { /* No more chunks. */ return 0; } /* We always respond with the same chunk, just different information in it. */ *chunk = msr->msc_reqbody_disk_chunk; /* Advance to the current chunk and position on the * next byte we need to send. */ chunks = (msc_data_chunk **)msr->msc_reqbody_chunks->elts; msr->msc_reqbody_disk_chunk->data = chunks[msr->msc_reqbody_chunk_position]->data + msr->msc_reqbody_chunk_offset; if (nbytes < 0) { /* Send what's left in this chunk as there is no limit on the size. */ msr->msc_reqbody_disk_chunk->length = chunks[msr->msc_reqbody_chunk_position]->length; msr->msc_reqbody_chunk_position++; msr->msc_reqbody_chunk_offset = 0; } else { /* We have a limit we must obey. */ if (chunks[msr->msc_reqbody_chunk_position]->length - msr->msc_reqbody_chunk_offset <= (unsigned int)nbytes) { /* If what's left in our chunk is less than the limit * then send it all back. */ msr->msc_reqbody_disk_chunk->length = chunks[msr->msc_reqbody_chunk_position]->length - msr->msc_reqbody_chunk_offset; msr->msc_reqbody_chunk_position++; msr->msc_reqbody_chunk_offset = 0; } else { /* If we have more data in our chunk, send the * maximum bytes we can (nbytes). */ msr->msc_reqbody_disk_chunk->length = nbytes; msr->msc_reqbody_chunk_offset += nbytes; } } /* If we've advanced beyond our last chunk then * we have no more data to send. */ if (msr->msc_reqbody_chunk_position >= msr->msc_reqbody_chunks->nelts) { return 0; /* No more chunks. */ } /* More data available. */ return 1; } if (msr->msc_reqbody_storage == MSC_REQBODY_DISK) { long int my_nbytes = CHUNK_CAPACITY; int i; /* Send CHUNK_CAPACITY bytes at a time unless a lower limit was requested. */ if ((nbytes != -1)&&(my_nbytes > nbytes)) { my_nbytes = nbytes; } i = read(msr->msc_reqbody_fd, msr->msc_reqbody_disk_chunk->data, my_nbytes); if (i < 0) { *error_msg = apr_psprintf(msr->mp, "Input filter: Error reading from temporary file: %s", strerror(errno)); return -1; } *chunk = msr->msc_reqbody_disk_chunk; msr->msc_reqbody_disk_chunk->length = i; if (i == 0) return 0; /* No more data available. */ return 1; /* More data available. */ } /* Should never happen. */ *error_msg = apr_psprintf(msr->mp, "Internal error, invalid msc_reqbody_storage value: %u", msr->msc_reqbody_storage); return -1; } /** * */ apr_status_t modsecurity_request_body_clear(modsec_rec *msr, char **error_msg) { *error_msg = NULL; /* Release memory we used to store request body data. */ if (msr->msc_reqbody_chunks != NULL) { msc_data_chunk **chunks = (msc_data_chunk **)msr->msc_reqbody_chunks->elts; int i; for(i = 0; i < msr->msc_reqbody_chunks->nelts; i++) { if (chunks[i]->data != NULL) { free(chunks[i]->data); chunks[i]->data = NULL; } } } if (msr->msc_reqbody_storage == MSC_REQBODY_DISK) { int keep_body = 0; /* Should we keep the body? This normally * happens when a PUT method was used, which * means the body is actually a file. */ if ((msr->upload_remove_files == 0)&&(strcasecmp(msr->request_method, "PUT") == 0)) { if (msr->txcfg->upload_dir != NULL) { keep_body = 1; } else { *error_msg = apr_psprintf(msr->mp, "Input filter: SecUploadDir is undefined, " "unable to store PUT file."); } } /* Deal with a request body stored in a file. */ if (msr->msc_reqbody_filename != NULL) { if (keep_body) { /* Move request body (which is a file) to the storage area. */ const char *put_filename = NULL; const char *put_basename = NULL; /* Construct the new filename. */ put_basename = file_basename(msr->msc_reqbody_mp, msr->msc_reqbody_filename); if (put_basename == NULL) { *error_msg = apr_psprintf(msr->mp, "Input filter: Failed to generate basename to PUT file \"%s\"", log_escape(msr->msc_reqbody_mp, msr->msc_reqbody_filename)); return -1; } put_filename = apr_psprintf(msr->msc_reqbody_mp, "%s/%s", msr->txcfg->upload_dir, put_basename); if (put_filename == NULL) { *error_msg = apr_psprintf(msr->mp, "Input filter: Failed to generate filename to PUT file \"%s\"", log_escape(msr->msc_reqbody_mp, msr->msc_reqbody_filename)); return -1; } if (apr_file_rename(msr->msc_reqbody_filename, put_filename, msr->msc_reqbody_mp) != APR_SUCCESS) { *error_msg = apr_psprintf(msr->mp, "Input filter: Failed to rename file from \"%s\" to \"%s\".", log_escape(msr->msc_reqbody_mp, msr->msc_reqbody_filename), log_escape(msr->msc_reqbody_mp, put_filename)); return -1; } else { msr_log(msr, 4, "Input filter: Moved file from \"%s\" to \"%s\".", log_escape(msr->msc_reqbody_mp, msr->msc_reqbody_filename), log_escape(msr->msc_reqbody_mp, put_filename)); } } else { /* make sure it is closed first */ if (msr->msc_reqbody_fd > 0) { close(msr->msc_reqbody_fd); msr->msc_reqbody_fd = -1; } /* We do not want to keep the request body. */ if (apr_file_remove(msr->msc_reqbody_filename, msr->msc_reqbody_mp) != APR_SUCCESS) { *error_msg = apr_psprintf(msr->mp, "Input filter: Failed to delete temporary file: %s", log_escape(msr->mp, msr->msc_reqbody_filename)); return -1; } msr_log(msr, 4, "Input filter: Removed temporary file: %s", msr->msc_reqbody_filename); } msr->msc_reqbody_filename = NULL; } } if (msr->msc_reqbody_mp != NULL) { apr_pool_destroy(msr->msc_reqbody_mp); msr->msc_reqbody_mp = NULL; } return 1; } modsecurity-apache_2.7.7/apache2/modsecurity_config_auto.h.in0000664000175000017500000001171212254306016024641 0ustar zimmerlezimmerle/* apache2/modsecurity_config_auto.h.in. Generated from configure.ac by autoheader. */ /* Define if the operating system is AIX */ #undef AIX /* Define if the operating system is FREEBSD */ #undef FREEBSD /* Define to 1 if you have the `atexit' function. */ #undef HAVE_ATEXIT /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H /* Define to 1 if you have the `fchmod' function. */ #undef HAVE_FCHMOD /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H /* Define to 1 if you have the `getcwd' function. */ #undef HAVE_GETCWD /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_LIMITS_H /* Define to 1 if your system has a GNU libc compatible `malloc' function, and to 0 otherwise. */ #undef HAVE_MALLOC /* Define to 1 if you have the `memmove' function. */ #undef HAVE_MEMMOVE /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the `memset' function. */ #undef HAVE_MEMSET /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the `strcasecmp' function. */ #undef HAVE_STRCASECMP /* Define to 1 if you have the `strcasestr' function. */ #undef HAVE_STRCASESTR /* Define to 1 if you have the `strchr' function. */ #undef HAVE_STRCHR /* Define to 1 if you have the `strdup' function. */ #undef HAVE_STRDUP /* Define to 1 if you have the `strerror' function. */ #undef HAVE_STRERROR /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the `strncasecmp' function. */ #undef HAVE_STRNCASECMP /* Define to 1 if you have the `strrchr' function. */ #undef HAVE_STRRCHR /* Define to 1 if you have the `strstr' function. */ #undef HAVE_STRSTR /* Define to 1 if you have the `strtol' function. */ #undef HAVE_STRTOL /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define if the operating system is HPUX */ #undef HPUX /* Define if the operating system is LINUX */ #undef LINUX /* Define to the sub-directory in which libtool stores uninstalled libraries. */ #undef LT_OBJDIR /* Define if the operating system is Macintosh OSX */ #undef MACOSX /* Define if the operating system is NetBSD */ #undef NETBSD /* Define if the operating system is OpenBSD */ #undef OPENBSD /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define if the operating system is SOLARIS */ #undef SOLARIS /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define to 1 if your declares `struct tm'. */ #undef TM_IN_SYS_TIME /* Version number of package */ #undef VERSION /* Define for Solaris 2.5.1 so the uint8_t typedef from , , or is not used. If the typedef were allowed, the #define below would cause a syntax error. */ #undef _UINT8_T /* Define to empty if `const' does not conform to ANSI C. */ #undef const /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus #undef inline #endif /* Define to rpl_malloc if the replacement function should be used. */ #undef malloc /* Define to `int' if does not define. */ #undef pid_t /* Define to the equivalent of the C99 'restrict' keyword, or to nothing if this is not supported. Do not define if restrict is supported directly. */ #undef restrict /* Work around a bug in Sun C++: it does not support _Restrict or __restrict__, even though the corresponding Sun C compiler ends up with "#define restrict _Restrict" or "#define restrict __restrict__" in the previous line. Perhaps some future version of Sun C++ will work with restrict; if so, hopefully it defines __RESTRICT like Sun C does. */ #if defined __SUNPRO_CC && !defined __RESTRICT # define _Restrict # define __restrict__ #endif /* Define to `unsigned int' if does not define. */ #undef size_t /* Define to the type of an unsigned integer type of width exactly 8 bits if such a type exists and the standard includes do not define it. */ #undef uint8_t modsecurity-apache_2.7.7/apache2/Makefile.win0000664000175000017500000000423112247774714021411 0ustar zimmerlezimmerle########################################################################### # # Usage: NMAKE -f Makefile.win APACHE={httpd installion dir} PCRE={pcre dir} LIBXML2={LibXML2 dir} [ LUA={Lua dir} ] # !IF "$(APACHE)" == "" || "$(PCRE)" == "" || "$(LIBXML2)" == "" !ERROR NMAKE arguments: APACHE=dir PCRE=dir LIBXML2=dir are required to build mod_security2 for Windows !ENDIF # Linking libraries LIBS = $(APACHE)\lib\libhttpd.lib \ $(APACHE)\lib\libapr-1.lib \ $(APACHE)\lib\libaprutil-1.lib \ $(PCRE)\pcre.lib \ $(LIBXML2)\win32\bin.msvc\libxml2.lib \ Ws2_32.lib ########################################################################### ########################################################################### CC = CL MT = mt DEFS = /nologo /O2 /LD /W3 /wd4244 /wd4018 -DWIN32 -DWINNT -Dinline=APR_INLINE -D$(VERSION) DLL = mod_security2.so INCLUDES = -I. -I.. \ -I$(PCRE)\include -I$(PCRE) \ -I$(LIBXML2)\include \ -I$(APACHE)\include # Lua is optional !IF "$(LUA)" != "" LIBS = $(LIBS) $(LUA)\lua5.1.lib DEFS=$(DEFS) -DWITH_LUA INCLUDES = $(INCLUDES) -I$(LUA)\include -I$(LUA) \ !ENDIF CFLAGS= -MD $(INCLUDES) $(DEFS) LDFLAGS = OBJS = mod_security2.obj apache2_config.obj apache2_io.obj apache2_util.obj \ re.obj re_operators.obj re_actions.obj re_tfns.obj re_variables.obj \ msc_logging.obj msc_xml.obj msc_multipart.obj modsecurity.obj \ msc_parsers.obj msc_util.obj msc_pcre.obj persist_dbm.obj \ msc_reqbody.obj msc_geo.obj msc_gsb.obj msc_crypt.obj msc_tree.obj msc_unicode.obj acmp.obj msc_lua.obj \ msc_release.obj libinjection\libinjection_sqli.obj all: $(DLL) dll: $(DLL) .c.obj: $(CC) $(CFLAGS) -c $< -Fo$@ .cpp.obj: $(CC) $(CFLAGS) -c $< -Fo$@ $(DLL): $(OBJS) $(CC) $(CFLAGS) $(LDFLAGS) -LD $(OBJS) -Fe$(DLL) $(LIBS) /link IF EXIST $(DLL).manifest $(MT) -manifest $(DLL).manifest -outputresource:$(DLL);2 install: $(DLL) copy /Y $(DLL) $(APACHE)\modules clean: del $(OBJS) $(DLL) *.dll *.lib *.pdb *.idb *.ilk *.exp *.res *.rc *.bin *.manifest modsecurity-apache_2.7.7/apache2/apache2_io.c0000664000175000017500000011325012244675772021316 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #include #include "modsecurity.h" #include "apache2.h" #include "msc_crypt.h" /* -- Input filter -- */ #if 0 static void dummy_free_func(void *data) {} #endif /** * This request filter will forward the previously stored * request body further down the chain (most likely to the * processing module). */ apr_status_t input_filter(ap_filter_t *f, apr_bucket_brigade *bb_out, ap_input_mode_t mode, apr_read_type_e block, apr_off_t nbytes) { modsec_rec *msr = (modsec_rec *)f->ctx; msc_data_chunk *chunk = NULL; apr_bucket *bucket; apr_status_t rc; char *my_error_msg = NULL; if (msr == NULL) { ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, f->r->server, "ModSecurity: Internal error in input filter: msr is null."); ap_remove_input_filter(f); return APR_EGENERAL; } /* Make sure we are using the current request */ msr->r = f->r; if (msr->phase < PHASE_REQUEST_BODY) { msr_log(msr, 1, "Internal error: REQUEST_BODY phase incomplete for input filter in phase %d", msr->phase); return APR_EGENERAL; } if ((msr->if_status == IF_STATUS_COMPLETE)||(msr->if_status == IF_STATUS_NONE)) { if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Input filter: Input forwarding already complete, skipping (f %pp, r %pp).", f, f->r); } ap_remove_input_filter(f); return ap_get_brigade(f->next, bb_out, mode, block, nbytes); } if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Input filter: Forwarding input: mode=%d, block=%d, nbytes=%" APR_OFF_T_FMT " (f %pp, r %pp).", mode, block, nbytes, f, f->r); } if (msr->if_started_forwarding == 0) { msr->if_started_forwarding = 1; rc = modsecurity_request_body_retrieve_start(msr, &my_error_msg); if (rc == -1) { if (my_error_msg != NULL) { msr_log(msr, 1, "%s", my_error_msg); } return APR_EGENERAL; } } rc = modsecurity_request_body_retrieve(msr, &chunk, (unsigned int)nbytes, &my_error_msg); if (rc == -1) { if (my_error_msg != NULL) { msr_log(msr, 1, "%s", my_error_msg); } return APR_EGENERAL; } if (chunk && (!msr->txcfg->stream_inbody_inspection || (msr->txcfg->stream_inbody_inspection && msr->if_stream_changed == 0))) { /* Copy the data we received in the chunk */ bucket = apr_bucket_heap_create(chunk->data, chunk->length, NULL, f->r->connection->bucket_alloc); #if 0 It would seem that we cannot prevent other filters in the chain from modifying data in-place. Hence we copy. if (chunk->is_permanent) { /* Do not make a copy of the data we received in the chunk. */ bucket = apr_bucket_heap_create(chunk->data, chunk->length, dummy_free_func, f->r->connection->bucket_alloc); } else { /* Copy the data we received in the chunk. */ bucket = apr_bucket_heap_create(chunk->data, chunk->length, NULL, f->r->connection->bucket_alloc); } #endif if (bucket == NULL) return APR_EGENERAL; APR_BRIGADE_INSERT_TAIL(bb_out, bucket); if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Input filter: Forwarded %" APR_SIZE_T_FMT " bytes.", chunk->length); } } else if (msr->stream_input_data != NULL) { msr->if_stream_changed = 0; bucket = apr_bucket_heap_create(msr->stream_input_data, msr->stream_input_length, NULL, f->r->connection->bucket_alloc); if (msr->txcfg->stream_inbody_inspection) { if(msr->stream_input_data != NULL) { free(msr->stream_input_data); msr->stream_input_data = NULL; } } if (bucket == NULL) return APR_EGENERAL; APR_BRIGADE_INSERT_TAIL(bb_out, bucket); if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Input stream filter: Forwarded %" APR_SIZE_T_FMT " bytes.", msr->stream_input_length); } } if (rc == 0) { modsecurity_request_body_retrieve_end(msr); bucket = apr_bucket_eos_create(f->r->connection->bucket_alloc); if (bucket == NULL) return APR_EGENERAL; APR_BRIGADE_INSERT_TAIL(bb_out, bucket); if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Input filter: Sent EOS."); } /* We're done */ msr->if_status = IF_STATUS_COMPLETE; ap_remove_input_filter(f); if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Input filter: Input forwarding complete."); } } return APR_SUCCESS; } /** * Reads request body from a client. */ apr_status_t read_request_body(modsec_rec *msr, char **error_msg) { request_rec *r = msr->r; unsigned int seen_eos; apr_bucket_brigade *bb_in; apr_bucket *bucket; if (error_msg == NULL) return -1; *error_msg = NULL; if (msr->reqbody_should_exist != 1) { if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Input filter: This request does not have a body."); } return 0; } if (msr->txcfg->reqbody_access != 1) { if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Input filter: Request body access not enabled."); } return 0; } if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Input filter: Reading request body."); } if (modsecurity_request_body_start(msr, error_msg) < 0) { return -1; } seen_eos = 0; bb_in = apr_brigade_create(msr->mp, r->connection->bucket_alloc); if (bb_in == NULL) return -1; do { apr_status_t rc; rc = ap_get_brigade(r->input_filters, bb_in, AP_MODE_READBYTES, APR_BLOCK_READ, HUGE_STRING_LEN); if (rc != APR_SUCCESS) { /* NOTE Apache returns AP_FILTER_ERROR here when the request is * too large and APR_EGENERAL when the client disconnects. */ switch(rc) { case APR_EOF : *error_msg = apr_psprintf(msr->mp, "Error reading request body: %s", get_apr_error(msr->mp, rc)); return -6; case APR_TIMEUP : *error_msg = apr_psprintf(msr->mp, "Error reading request body: %s", get_apr_error(msr->mp, rc)); return -4; case AP_FILTER_ERROR : *error_msg = apr_psprintf(msr->mp, "Error reading request body: HTTP Error 413 - Request entity too large. (Most likely.)"); return -3; case APR_EGENERAL : *error_msg = apr_psprintf(msr->mp, "Error reading request body: Client went away."); return -2; default : *error_msg = apr_psprintf(msr->mp, "Error reading request body: %s", get_apr_error(msr->mp, rc)); return -1; } } /* Loop through the buckets in the brigade in order * to extract the size of the data available. */ for(bucket = APR_BRIGADE_FIRST(bb_in); bucket != APR_BRIGADE_SENTINEL(bb_in); bucket = APR_BUCKET_NEXT(bucket)) { const char *buf; apr_size_t buflen; rc = apr_bucket_read(bucket, &buf, &buflen, APR_BLOCK_READ); if (rc != APR_SUCCESS) { *error_msg = apr_psprintf(msr->mp, "Failed reading input / bucket (%d): %s", rc, get_apr_error(msr->mp, rc)); return -1; } if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Input filter: Bucket type %s contains %" APR_SIZE_T_FMT " bytes.", bucket->type->name, buflen); } /* Check request body limit (should only trigger on chunked requests). */ if (msr->reqbody_length + buflen > (apr_size_t)msr->txcfg->reqbody_limit) { if((msr->txcfg->is_enabled == MODSEC_ENABLED) && (msr->txcfg->if_limit_action == REQUEST_BODY_LIMIT_ACTION_REJECT)) { *error_msg = apr_psprintf(msr->mp, "Request body is larger than the " "configured limit (%ld).", msr->txcfg->reqbody_limit); return -5; } else if((msr->txcfg->is_enabled == MODSEC_ENABLED) && (msr->txcfg->if_limit_action == REQUEST_BODY_LIMIT_ACTION_PARTIAL)) { *error_msg = apr_psprintf(msr->mp, "Request body is larger than the " "configured limit (%ld).", msr->txcfg->reqbody_limit); } else if ((msr->txcfg->is_enabled == MODSEC_DETECTION_ONLY) && (msr->txcfg->if_limit_action == REQUEST_BODY_LIMIT_ACTION_PARTIAL)){ *error_msg = apr_psprintf(msr->mp, "Request body is larger than the " "configured limit (%ld).", msr->txcfg->reqbody_limit); } else if ((msr->txcfg->is_enabled == MODSEC_DETECTION_ONLY) && (msr->txcfg->if_limit_action == REQUEST_BODY_LIMIT_ACTION_REJECT)){ *error_msg = apr_psprintf(msr->mp, "Request body is larger than the " "configured limit (%ld).", msr->txcfg->reqbody_limit); } else { *error_msg = apr_psprintf(msr->mp, "Request body is larger than the " "configured limit (%ld).", msr->txcfg->reqbody_limit); return -5; } } if (msr->txcfg->stream_inbody_inspection == 1) { msr->stream_input_length+=buflen; modsecurity_request_body_to_stream(msr, buf, buflen, error_msg); } msr->reqbody_length += buflen; if (buflen != 0) { int rcbs = modsecurity_request_body_store(msr, buf, buflen, error_msg); if (rcbs < 0) { if (rcbs == -5) { if((msr->txcfg->is_enabled == MODSEC_ENABLED) && (msr->txcfg->if_limit_action == REQUEST_BODY_LIMIT_ACTION_REJECT)) { *error_msg = apr_psprintf(msr->mp, "Request body no files data length is larger than the " "configured limit (%ld).", msr->txcfg->reqbody_no_files_limit); return -5; } else if ((msr->txcfg->is_enabled == MODSEC_ENABLED) && (msr->txcfg->if_limit_action == REQUEST_BODY_LIMIT_ACTION_PARTIAL)) { *error_msg = apr_psprintf(msr->mp, "Request body no files data length is larger than the " "configured limit (%ld).", msr->txcfg->reqbody_no_files_limit); } else if ((msr->txcfg->is_enabled == MODSEC_DETECTION_ONLY) && (msr->txcfg->if_limit_action == REQUEST_BODY_LIMIT_ACTION_PARTIAL)) { *error_msg = apr_psprintf(msr->mp, "Request body no files data length is larger than the " "configured limit (%ld).", msr->txcfg->reqbody_no_files_limit); } else { *error_msg = apr_psprintf(msr->mp, "Request body no files data length is larger than the " "configured limit (%ld).", msr->txcfg->reqbody_no_files_limit); return -5; } } if((msr->txcfg->is_enabled == MODSEC_ENABLED) && (msr->txcfg->if_limit_action == REQUEST_BODY_LIMIT_ACTION_REJECT)) return -1; } } if (APR_BUCKET_IS_EOS(bucket)) { seen_eos = 1; } } apr_brigade_cleanup(bb_in); } while(!seen_eos); // TODO: Why ignore the return code here? modsecurity_request_body_end(msr, error_msg); if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Input filter: Completed receiving request body (length %" APR_SIZE_T_FMT ").", msr->reqbody_length); } msr->if_status = IF_STATUS_WANTS_TO_RUN; return 1; } /* -- Output filter -- */ /** * Examines the configuration and the response MIME type * in order to determine whether output buffering should * run or not. */ static int output_filter_should_run(modsec_rec *msr, request_rec *r) { char *content_type = NULL; /* Check configuration. */ if (msr->txcfg->resbody_access != 1) { if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Output filter: Response body buffering is not enabled."); } return 0; } /* Check MIME type. */ if ((msr->txcfg->of_mime_types == NULL)||(msr->txcfg->of_mime_types == NOT_SET_P)) { msr_log(msr, 1, "Output filter: MIME type structures corrupted (internal error)."); return -1; } if (r->content_type != NULL) { char *p = NULL; content_type = apr_pstrdup(msr->mp, r->content_type); if (content_type == NULL) { msr_log(msr, 1, "Output filter: Failed to allocate memory for content type."); return -1; } /* Hide the character encoding information * if present. Sometimes the content type header * looks like this "text/html; charset=xyz" ... */ p = strstr(content_type, ";"); if (p != NULL) { *p = '\0'; } strtolower_inplace((unsigned char *)content_type); if (strcmp(content_type, "text/html") == 0) { /* Useful information to have should we later * decide to do something with the HTML output. */ msr->resbody_contains_html = 1; } } else { content_type = "null"; } if (apr_table_get(msr->txcfg->of_mime_types, content_type) != NULL) return 1; msr_log(msr, 4, "Output filter: Not buffering response body for unconfigured MIME type \"%s\".", content_type); return 0; } /** * Initialises the output filter. */ static apr_status_t output_filter_init(modsec_rec *msr, ap_filter_t *f, apr_bucket_brigade *bb_in) { request_rec *r = f->r; const char *s_content_length = NULL; apr_status_t rc; msr->of_brigade = apr_brigade_create(msr->mp, f->c->bucket_alloc); if (msr->of_brigade == NULL) { msr_log(msr, 1, "Output filter: Failed to create brigade."); return -1; } msr->of_status = OF_STATUS_IN_PROGRESS; rc = output_filter_should_run(msr, r); if (rc < 0) return -1; /* output_filter_should_run() generates error msg */ if (rc == 0) return 0; /* Do not check the output limit if we are willing to * process partial response bodies. */ if (msr->txcfg->of_limit_action == RESPONSE_BODY_LIMIT_ACTION_PARTIAL) { return 1; } /* Look up the Content-Length header to see if we know * the amount of data coming our way. If we do and if * it's too much we might want to stop processing right here. */ s_content_length = apr_table_get(r->headers_out, "Content-Length"); if (s_content_length == NULL) { /* Try this too, mod_cgi seems to put headers there. */ s_content_length = apr_table_get(r->err_headers_out, "Content-Length"); } if (s_content_length != NULL) { long int len; len = strtol(s_content_length, NULL, 10); if ((len == LONG_MIN)||(len == LONG_MAX)||(len < 0)||(len >= 1073741824)) { msr_log(msr, 1, "Output filter: Invalid Content-Length: %s", log_escape_nq(r->pool, (char *)s_content_length)); return -1; /* Invalid. */ } if (len == 0) { if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Output filter: Skipping response since Content-Length is zero."); } return 0; } if (len > msr->txcfg->of_limit) { msr_log(msr, 1, "Output filter: Content-Length (%s) over the limit (%ld).", log_escape_nq(r->pool, (char *)s_content_length), msr->txcfg->of_limit); msr->outbound_error = 1; return -2; /* Over the limit. */ } } return 1; } /** * Send the accumulated content down the filter stream * and to the client. */ static apr_status_t send_of_brigade(modsec_rec *msr, ap_filter_t *f) { apr_status_t rc; rc = ap_pass_brigade(f->next, msr->of_brigade); if (rc != APR_SUCCESS) { /* TODO: These need to move to flags in 2.6. For now log them * at level 4 so that they are not confusing users. */ int log_level = 4; if (msr->txcfg->debuglog_level >= log_level) { switch(rc) { case AP_NOBODY_WROTE : msr_log(msr, log_level, "Output filter: Error while forwarding response data (%d): No data", rc); break; case AP_FILTER_ERROR : /* Look like this is caused by the error * already being handled, so we should ignore it * msr_log(msr, log_level, "Output filter: Error while forwarding response data (%d): Filter error", rc); */ break; default : msr_log(msr, log_level, "Output filter: Error while forwarding response data (%d): %s", rc, get_apr_error(msr->mp, rc)); break; } } return rc; } return APR_SUCCESS; } /** \brief Inject data into brigade * * \param msr ModSecurity transation resource * \param ap_filter_t Apache filter * */ static void inject_content_to_of_brigade(modsec_rec *msr, ap_filter_t *f) { apr_bucket *b; if (msr->txcfg->content_injection_enabled && msr->stream_output_data != NULL) { apr_bucket *bucket_ci = NULL; bucket_ci = apr_bucket_heap_create(msr->stream_output_data, msr->stream_output_length, NULL, f->r->connection->bucket_alloc); for (b = APR_BRIGADE_FIRST(msr->of_brigade); b != APR_BRIGADE_SENTINEL(msr->of_brigade); b = APR_BUCKET_NEXT(b)) { if(!APR_BUCKET_IS_METADATA(b)) apr_bucket_delete(b); } APR_BRIGADE_INSERT_HEAD(msr->of_brigade, bucket_ci); if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Content Injection: Data reinjected bytes [%"APR_SIZE_T_FMT"]",msr->stream_output_length); } } } /** * */ static void prepend_content_to_of_brigade(modsec_rec *msr, ap_filter_t *f) { if ((msr->txcfg->content_injection_enabled) && (msr->content_prepend) && (!msr->of_skipping)) { apr_bucket *bucket_ci = NULL; bucket_ci = apr_bucket_heap_create(msr->content_prepend, msr->content_prepend_len, NULL, f->r->connection->bucket_alloc); APR_BRIGADE_INSERT_HEAD(msr->of_brigade, bucket_ci); if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Content Injection (b): Added content to top: %s", log_escape_nq_ex(msr->mp, msr->content_prepend, msr->content_prepend_len)); } } } /** * */ static int flatten_response_body(modsec_rec *msr) { apr_status_t rc; msr->resbody_status = RESBODY_STATUS_READ_BRIGADE; if (msr->resbody_length + 1 <= 0) { msr_log(msr, 1, "Output filter: Invalid response length: %" APR_SIZE_T_FMT, msr->resbody_length); return -1; } msr->resbody_data = apr_palloc(msr->mp, msr->resbody_length + 1); if (msr->resbody_data == NULL) { msr_log(msr, 1, "Output filter: Response body data memory allocation failed. Asked for: %" APR_SIZE_T_FMT, msr->resbody_length + 1); return -1; } rc = apr_brigade_flatten(msr->of_brigade, msr->resbody_data, &msr->resbody_length); if (rc != APR_SUCCESS) { msr_log(msr, 1, "Output filter: Failed to flatten brigade (%d): %s", rc, get_apr_error(msr->mp, rc)); return -1; } msr->resbody_data[msr->resbody_length] = '\0'; msr->resbody_status = RESBODY_STATUS_READ; if (msr->txcfg->stream_outbody_inspection && msr->txcfg->hash_is_enabled == HASH_DISABLED) { msr->stream_output_length = msr->resbody_length; if (msr->stream_output_data == NULL) { msr_log(msr, 1, "Output filter: Stream Response body data memory allocation failed. Asked for: %" APR_SIZE_T_FMT, msr->stream_output_length + 1); return -1; } memset(msr->stream_output_data, 0, msr->stream_output_length+1); memcpy(msr->stream_output_data, msr->resbody_data, msr->stream_output_length); msr->stream_output_data[msr->stream_output_length] = '\0'; } else if (msr->txcfg->stream_outbody_inspection && msr->txcfg->hash_is_enabled == HASH_ENABLED) { int retval = 0; apr_time_t time1 = apr_time_now(); retval = init_response_body_html_parser(msr); if(retval == 1) { retval = hash_response_body_links(msr); if(retval > 0) { retval = inject_hashed_response_body(msr, retval); if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Hash completed in %" APR_TIME_T_FMT " usec.", (apr_time_now() - time1)); } } } if(msr->of_stream_changed == 0) { msr->stream_output_length = msr->resbody_length; if (msr->stream_output_data == NULL) { msr_log(msr, 1, "Output filter: Stream Response body data memory allocation failed. Asked for: %" APR_SIZE_T_FMT, msr->stream_output_length + 1); return -1; } memset(msr->stream_output_data, 0, msr->stream_output_length+1); memcpy(msr->stream_output_data, msr->resbody_data, msr->stream_output_length); msr->stream_output_data[msr->stream_output_length] = '\0'; } } return 1; } /** * Output filter. */ apr_status_t output_filter(ap_filter_t *f, apr_bucket_brigade *bb_in) { request_rec *r = f->r; modsec_rec *msr = (modsec_rec *)f->ctx; apr_bucket *bucket = NULL, *eos_bucket = NULL; apr_status_t rc; int start_skipping = 0; /* Do we have the context? */ if (msr == NULL) { ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, f->r->server, "ModSecurity: Internal Error: msr is null in output filter."); ap_remove_output_filter(f); return send_error_bucket(msr, f, HTTP_INTERNAL_SERVER_ERROR); } msr->r = r; if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Output filter: Receiving output (f %pp, r %pp).", f, f->r); } /* Put back the Accept-Encoding and TE request headers * if they were removed from the request. */ if (msr->txcfg->disable_backend_compression) { char *ae = (char *)apr_table_get(msr->request_headers, "Accept-Encoding"); char *te = (char *)apr_table_get(msr->request_headers, "TE"); if ((ae != NULL)&&(apr_table_get(f->r->headers_in, "Accept-Encoding") == NULL)) { apr_table_add(f->r->headers_in, "Accept-Encoding", ae); } if ((te != NULL)&&(apr_table_get(f->r->headers_in, "TE") == NULL)) { apr_table_add(f->r->headers_in, "TE", te); } } /* Initialise on first invocation */ if (msr->of_status == OF_STATUS_NOT_STARTED) { /* Update our context from the request structure. */ msr->r = r; msr->response_status = r->status; msr->status_line = ((r->status_line != NULL) ? r->status_line : ap_get_status_line(r->status)); msr->response_protocol = get_response_protocol(r); if(msr->txcfg->crypto_hash_location_rx == 1 || msr->txcfg->crypto_hash_location_pm == 1) rc = modify_response_header(msr); msr->response_headers = apr_table_overlay(msr->mp, r->err_headers_out, r->headers_out); /* Process phase RESPONSE_HEADERS */ rc = modsecurity_process_phase(msr, PHASE_RESPONSE_HEADERS); if (rc < 0) { /* error */ ap_remove_output_filter(f); return send_error_bucket(msr, f, HTTP_INTERNAL_SERVER_ERROR); } if (rc > 0) { /* transaction needs to be interrupted */ int status = perform_interception(msr); if (status != DECLINED) { /* DECLINED means we allow-ed the request. */ ap_remove_output_filter(f); msr->of_status = OF_STATUS_COMPLETE; msr->resbody_status = RESBODY_STATUS_ERROR; return send_error_bucket(msr, f, status); } } msr->outbound_error = 0; /* Decide whether to observe the response body. */ rc = output_filter_init(msr, f, bb_in); switch(rc) { case -2 : /* response too large */ case -1 : /* error */ /* there's something wrong with this response */ ap_remove_output_filter(f); msr->of_status = OF_STATUS_COMPLETE; msr->resbody_status = RESBODY_STATUS_ERROR; return send_error_bucket(msr, f, HTTP_INTERNAL_SERVER_ERROR); case 0 : /* We do not want to observe this response body * but we need to remain attached to observe * when it is completed so that we can run * the RESPONSE_BODY phase. */ msr->of_skipping = 1; msr->resbody_status = RESBODY_STATUS_NOT_READ; break; default : /* Continue (observe the response body). */ break; } /* If injecting content unset headers now. */ if (msr->txcfg->content_injection_enabled == 0) { if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Content Injection: Not enabled."); } } else { if ((msr->content_prepend) || (msr->content_append)) { apr_table_unset(msr->r->headers_out, "Content-Length"); apr_table_unset(msr->r->headers_out, "Last-Modified"); apr_table_unset(msr->r->headers_out, "ETag"); apr_table_unset(msr->r->headers_out, "Expires"); if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Content Injection: Removing headers (C-L, L-M, Etag, Expires)."); } } else { if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Content Injection: Nothing to inject."); } } } /* Content injection (prepend & non-buffering). */ if ((msr->txcfg->content_injection_enabled) && (msr->content_prepend) && (msr->of_skipping)) { apr_bucket *bucket_ci = apr_bucket_heap_create(msr->content_prepend, msr->content_prepend_len, NULL, f->r->connection->bucket_alloc); APR_BRIGADE_INSERT_HEAD(bb_in, bucket_ci); if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Content Injection (nb): Added content to top: %s", log_escape_nq_ex(msr->mp, msr->content_prepend, msr->content_prepend_len)); } } } else if (msr->of_status == OF_STATUS_COMPLETE) { msr_log(msr, 1, "Output filter: Internal error: output filtering complete yet filter was invoked."); ap_remove_output_filter(f); return APR_EGENERAL; } /* Loop through the buckets in the brigade in order * to extract the size of the data available. */ for(bucket = APR_BRIGADE_FIRST(bb_in); bucket != APR_BRIGADE_SENTINEL(bb_in); bucket = APR_BUCKET_NEXT(bucket)) { const char *buf; apr_size_t buflen; /* Look into response data if configured to do so, * unless we've already processed a partial response. */ if ((msr->of_skipping == 0)&&(!msr->of_partial)) { /* Observe the response data. */ /* Retrieve data from the bucket. */ rc = apr_bucket_read(bucket, &buf, &buflen, APR_BLOCK_READ); if (rc != APR_SUCCESS) { msr->of_status = OF_STATUS_COMPLETE; msr->resbody_status = RESBODY_STATUS_ERROR; msr_log(msr, 1, "Output filter: Failed to read bucket (rc %d): %s", rc, get_apr_error(r->pool, rc)); ap_remove_output_filter(f); return send_error_bucket(msr, f, HTTP_INTERNAL_SERVER_ERROR); } if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Output filter: Bucket type %s contains %" APR_SIZE_T_FMT " bytes.", bucket->type->name, buflen); } /* Check the response size. */ if (msr->resbody_length > (apr_size_t)msr->txcfg->of_limit) { /* The size of the response is larger than what we're * ready to accept. We need to decide what we want to do * about it. */ msr->outbound_error = 1; if (msr->txcfg->of_limit_action == RESPONSE_BODY_LIMIT_ACTION_REJECT) { /* Reject response. */ msr_log(msr, 1, "Output filter: Response body too large (over limit of %ld, " "total not specified).", msr->txcfg->of_limit); msr->of_status = OF_STATUS_COMPLETE; msr->resbody_status = RESBODY_STATUS_PARTIAL; ap_remove_output_filter(f); return send_error_bucket(msr, f, HTTP_INTERNAL_SERVER_ERROR); } else { /* Process partial response. */ start_skipping = 1; msr->resbody_length = msr->txcfg->of_limit; if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Output filter: Processing partial response body (limit %ld)", msr->txcfg->of_limit); } } } else { msr->resbody_length += buflen; } } /* Have we reached the end of the response? */ if (APR_BUCKET_IS_EOS(bucket)) { eos_bucket = bucket; /* Inject content (append & non-buffering). */ if ((msr->txcfg->content_injection_enabled) && (msr->content_append) && (msr->of_skipping || msr->of_partial || start_skipping)) { apr_bucket *bucket_ci = NULL; bucket_ci = apr_bucket_heap_create(msr->content_append, msr->content_append_len, NULL, f->r->connection->bucket_alloc); APR_BUCKET_INSERT_BEFORE(bucket, bucket_ci); if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Content-Injection (nb): Added content to bottom: %s", log_escape_nq_ex(msr->mp, msr->content_append, msr->content_append_len)); } } msr->of_done_reading = 1; } } /* Add buckets in this brigade to the brigade * we have in the context, but only if we actually * want to keep the response body. */ if ((msr->of_skipping == 0)&&(msr->of_partial == 0)) { ap_save_brigade(f, &msr->of_brigade, &bb_in, msr->mp); /* Do we need to process a partial response? */ if (start_skipping) { if (msr->txcfg->stream_outbody_inspection) { if(msr->stream_output_data != NULL) { free(msr->stream_output_data); msr->stream_output_data = NULL; } msr->stream_output_data = (char *)malloc(msr->resbody_length+1); } if (flatten_response_body(msr) < 0) { if (msr->txcfg->stream_outbody_inspection) { if(msr->stream_output_data != NULL) { free(msr->stream_output_data); msr->stream_output_data = NULL; } } ap_remove_output_filter(f); return send_error_bucket(msr, f, HTTP_INTERNAL_SERVER_ERROR); } /* Process phase RESPONSE_BODY */ rc = modsecurity_process_phase(msr, PHASE_RESPONSE_BODY); if (rc < 0) { ap_remove_output_filter(f); return send_error_bucket(msr, f, HTTP_INTERNAL_SERVER_ERROR); } if (rc > 0) { int status = perform_interception(msr); if (status != DECLINED) { /* DECLINED means we allow-ed the request. */ ap_remove_output_filter(f); return send_error_bucket(msr, f, status); } } /* Prepend content as necessary. */ prepend_content_to_of_brigade(msr, f); if ((rc = send_of_brigade(msr, f)) != APR_SUCCESS) { return rc; } msr->of_partial = 1; } if (msr->of_done_reading == 0) { /* We are done for now. We will be called again with more data. */ return APR_SUCCESS; } if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Output filter: Completed receiving response body (buffered %s - %" APR_SIZE_T_FMT " bytes).", (msr->of_partial ? "partial" : "full"), msr->resbody_length); } } else { /* Not looking at response data. */ if (msr->of_done_reading == 0) { if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Output filter: Sending input brigade directly."); } return ap_pass_brigade(f->next, bb_in); } if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Output filter: Completed receiving response body (non-buffering)."); } } /* We've done our thing; remove us from the filter list. */ msr->of_status = OF_STATUS_COMPLETE; ap_remove_output_filter(f); /* Process phase RESPONSE_BODY, but * only if it hasn't been processed already. */ if (msr->phase < PHASE_RESPONSE_BODY) { if (msr->txcfg->stream_outbody_inspection) { if(msr->stream_output_data != NULL) { free(msr->stream_output_data); msr->stream_output_data = NULL; } msr->stream_output_data = (char *)malloc(msr->resbody_length+1); } if (flatten_response_body(msr) < 0) { if (msr->txcfg->stream_outbody_inspection) { if(msr->stream_output_data != NULL) { free(msr->stream_output_data); msr->stream_output_data = NULL; } } ap_remove_output_filter(f); return send_error_bucket(msr, f, HTTP_INTERNAL_SERVER_ERROR); } rc = modsecurity_process_phase(msr, PHASE_RESPONSE_BODY); if (rc < 0) { ap_remove_output_filter(f); return send_error_bucket(msr, f, HTTP_INTERNAL_SERVER_ERROR); } if (rc > 0) { int status = perform_interception(msr); if (status != DECLINED) { /* DECLINED means we allow-ed the request. */ ap_remove_output_filter(f); return send_error_bucket(msr, f, status); } } } /* Now send data down the filter stream * (full-buffering only). */ if ((msr->of_skipping == 0)&&(!msr->of_partial)) { if(msr->of_stream_changed == 1) { inject_content_to_of_brigade(msr,f); msr->of_stream_changed = 0; } if (msr->txcfg->stream_outbody_inspection) { if(msr->stream_output_data != NULL) { free(msr->stream_output_data); msr->stream_output_data = NULL; } } prepend_content_to_of_brigade(msr, f); /* Inject content into response (append & buffering). */ if ((msr->txcfg->content_injection_enabled) && (msr->content_append)) { apr_bucket *bucket_ci = NULL; bucket_ci = apr_bucket_heap_create(msr->content_append, msr->content_append_len, NULL, f->r->connection->bucket_alloc); APR_BUCKET_INSERT_BEFORE(eos_bucket, bucket_ci); if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Content-Injection (b): Added content to bottom: %s", log_escape_nq_ex(msr->mp, msr->content_append, msr->content_append_len)); } } /* Send data down the filter stream. */ if ((rc = send_of_brigade(msr, f)) != APR_SUCCESS) { return rc; } } /* Another job well done! */ if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Output filter: Output forwarding complete."); } if ((msr->of_skipping == 0)&&(msr->of_partial == 0)) { return APR_SUCCESS; } else { if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Output filter: Sending input brigade directly."); } return ap_pass_brigade(f->next, bb_in); } } modsecurity-apache_2.7.7/apache2/msc_logging.c0000664000175000017500000013634512243422537021612 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #include "modsecurity.h" #include #include "re.h" #include "msc_logging.h" #include "httpd.h" #include "apr_strings.h" #include "apr_global_mutex.h" #include "msc_util.h" #include "apr_version.h" #include /** * Write the supplied data to the audit log (if the FD is ready), update * the size counters, update the hash context. */ static int sec_auditlog_write(modsec_rec *msr, const char *data, unsigned int len) { apr_size_t nbytes_written, nbytes = len; apr_status_t rc; /* Do nothing if there's no data. */ if (data == NULL) return -1; /* Update size counters and the hash calculation. We always do this, * even in cases where write fails. That will make it easier to detect * problems with partial writes. */ msr->new_auditlog_size += len; apr_md5_update(&msr->new_auditlog_md5ctx, data, len); /* Do not write if we do not have a file descriptor. */ if (msr->new_auditlog_fd == NULL) return -1; /* Write data to file. */ rc = apr_file_write_full(msr->new_auditlog_fd, data, nbytes, &nbytes_written); if (rc != APR_SUCCESS) { msr_log(msr, 1, "Audit log: Failed writing (requested %" APR_SIZE_T_FMT " bytes, written %" APR_SIZE_T_FMT ")", nbytes, nbytes_written); /* Set to NULL to prevent more than one error message on * out-of-disk-space events and to prevent further attempts * to write to the same file in this request. * * Note that, as we opened the file through the pool mechanism of * the APR, we do not need to close the file here. It will be closed * automatically at the end of the request. */ msr->new_auditlog_fd = NULL; return -1; } return 1; } /** * Constructs a log line in vcombined log format trying to truncate * some of the fields to make the log line shorter than _limit bytes. */ char *construct_log_vcombinedus_limited(modsec_rec *msr, int _limit, int *was_limited) { char *hostname; char *local_user, *remote_user; char *referer, *user_agent, *uniqueid; const char *sessionid; char *the_request, *bytes_sent; int limit = _limit; /* hostname */ hostname = (msr->hostname == NULL ? "-" : log_escape_nq(msr->mp, msr->hostname)); /* remote log name */ if (msr->remote_user == NULL) remote_user = "-"; else remote_user = log_escape_nq(msr->mp, msr->remote_user); /* authenticated user */ if (msr->local_user == NULL) local_user = "-"; else local_user = log_escape_nq(msr->mp, msr->local_user); /* unique id */ if (msr->txid == NULL) uniqueid = "-"; else uniqueid = log_escape(msr->mp, msr->txid); /* referer */ referer = "-"; /* referer = (char *)apr_table_get(msr->request_headers, "Referer"); if (referer == NULL) referer = "-"; else referer = log_escape(msr->mp, referer); */ /* user agent */ user_agent = "-"; /* user_agent = (char *)apr_table_get(msr->request_headers, "User-Agent"); if (user_agent == NULL) user_agent = "-"; else user_agent = log_escape(msr->mp, user_agent); */ /* sessionid */ sessionid = (msr->sessionid == NULL) ? "-" : log_escape(msr->mp, msr->sessionid); the_request = (msr->request_line == NULL) ? "" : log_escape(msr->mp, msr->request_line); bytes_sent = apr_psprintf(msr->mp, "%" APR_OFF_T_FMT, msr->bytes_sent); /* first take away the size of the * information we must log */ limit -= 22; /* spaces and double quotes */ limit -= strlen(hostname); /* server name or IP */ limit -= strlen(msr->remote_addr); /* remote IP */ limit -= 28; /* current_logtime */ limit -= 3; /* status */ limit -= strlen(bytes_sent); /* bytes sent */ limit -= strlen(uniqueid); /* unique id */ limit -= strlen(sessionid); /* session id */ if (limit <= 0) { msr_log(msr, 1, "GuardianLog: Atomic pipe write size too small: %d", PIPE_BUF); return NULL; } /* we hope to be able to squeeze everything in */ if (limit < (int)(strlen(remote_user) + strlen(local_user) + strlen(referer) + strlen(user_agent) + strlen(the_request))) { /* Boo hoo hoo, there's not enough space available. */ *was_limited = 1; /* Let's see if we can reduce the size of something. This * is a very crude approach but it seems to work for our * needs. */ if (strlen(remote_user) > 32) { msr_log(msr, 9, "GuardianLog: Reduced remote_user to 32."); remote_user[32] = '\0'; } limit -= strlen(remote_user); if (strlen(local_user) > 32) { msr_log(msr, 9, "GuardianLog: Reduced local_user to 32."); local_user[32] = '\0'; } limit -= strlen(local_user); if (strlen(referer) > 64) { msr_log(msr, 9, "GuardianLog: Reduced referer to 64."); referer[64] = '\0'; } limit -= strlen(referer); if (strlen(user_agent) > 64) { msr_log(msr, 9, "GuardianLog: Reduced user_agent to 64."); user_agent[64] = '\0'; } limit -= strlen(user_agent); if (limit <= 0) { msr_log(msr, 1, "GuardianLog: Atomic pipe write size too small: %d.", PIPE_BUF); return NULL; } /* use what's left for the request line */ if ((int)strlen(the_request) > limit) { the_request[limit] = '\0'; msr_log(msr, 9, "GuardianLog: Reduced the_request to %d bytes.", limit); } } else { /* Yay! We have enough space! */ *was_limited = 0; } return apr_psprintf(msr->mp, "%s %s %s %s [%s] \"%s\" %u %s \"%s\" \"%s\" %s \"%s\"", hostname, msr->remote_addr, remote_user, local_user, current_logtime(msr->mp), the_request, msr->response_status, bytes_sent, referer, user_agent, uniqueid, sessionid ); } /** * Checks if the provided string is a valid audit log parts specification. */ int is_valid_parts_specification(char *p) { char c, *t = p; while((c = *(t++)) != '\0') { if ((c != AUDITLOG_PART_ENDMARKER)&&((c < AUDITLOG_PART_FIRST)||(c > AUDITLOG_PART_LAST))) { return 0; } } return 1; } /** * Constructs a filename that will be used to store an * audit log entry. */ static char *construct_auditlog_filename(apr_pool_t *mp, const char *uniqueid) { apr_time_exp_t t; char tstr[300]; apr_size_t len; apr_time_exp_lt(&t, apr_time_now()); apr_strftime(tstr, &len, 299, "/%Y%m%d/%Y%m%d-%H%M/%Y%m%d-%H%M%S", &t); return apr_psprintf(mp, "%s-%s", tstr, uniqueid); } /** * Creates a random 8-character string that * consists of hexadecimal numbers, to be used * as an audit log boundary. */ static char *create_auditlog_boundary(request_rec *r) { #ifdef LINUX_S390 int data = swap_int32(rand()); #else unsigned long data = rand(); #endif /* Do note that I tried using apr_generate_random_bytes but it turned * out to be terribly slow for some reason. Needs further investigation. */ return bytes2hex(r->pool, (void *)&data, 4); } /** * Sanitises the request line by removing the parameters * that have been marked as sensitive. */ static void sanitize_request_line(modsec_rec *msr) { const apr_array_header_t *tarr = NULL; const apr_table_entry_t *telts = NULL; const apr_array_header_t *tarr_pattern = NULL; const apr_table_entry_t *telts_pattern = NULL; msc_parm *mparm = NULL; int i, k; char *qspos; char *buf = NULL; int sanitized_partial = 0; int sanitize_matched = 0; /* Locate the query string. */ qspos = strstr(msr->request_line, "?"); if (qspos == NULL) return; qspos++; /* Loop through the list of sensitive parameters. */ tarr = apr_table_elts(msr->arguments_to_sanitize); telts = (const apr_table_entry_t*)tarr->elts; for (i = 0; i < tarr->nelts; i++) { msc_arg *arg = (msc_arg *)telts[i].val; /* Only look at the parameters that appeared in the query string. */ if (strcmp(arg->origin, "QUERY_STRING") == 0) { char *pat = NULL; char *p; int j, arg_min, arg_max; /* Go to the beginning of the parameter. */ p = qspos; j = arg->value_origin_offset; while((*p != '\0')&&(j--)) p++; if (*p == '\0') { msr_log(msr, 1, "Unable to sanitize variable \"%s\" at offset %u of QUERY_STRING" "because the request line is too short.", log_escape_ex(msr->mp, arg->name, arg->name_len), arg->value_origin_offset); continue; } tarr_pattern = apr_table_elts(msr->pattern_to_sanitize); telts_pattern = (const apr_table_entry_t*)tarr_pattern->elts; sanitized_partial = 0; sanitize_matched = 0; buf = apr_psprintf(msr->mp, "%s",p); for ( k = 0; k < tarr_pattern->nelts; k++) { if(strncmp(telts_pattern[k].key,arg->name,strlen(arg->name)) ==0 ) { mparm = (msc_parm *)telts_pattern[k].val; pat = strstr(buf,mparm->value); if(mparm->pad_1 == -1) sanitize_matched = 1; if (pat != NULL) { j = strlen(mparm->value); arg_min = j; arg_max = 1; while((*pat != '\0')&&(j--)) { if(arg_max > mparm->pad_2) { int off = (strlen(mparm->value) - arg_max); int pos = (mparm->pad_1-1); if(off > pos) { *pat = '*'; } } arg_max++; arg_min--; pat++; } } sanitized_partial = 1; } } if(sanitized_partial == 1 && sanitize_matched == 0) { while(*buf != '\0') { *p++ = *buf++; } continue; } else { /* Write over the value. */ j = arg->value_origin_len; while((*p != '\0')&&(j--)) { *p++ = '*'; } if (*p == '\0') { msr_log(msr, 1, "Unable to sanitize variable \"%s\" at offset %u (size %d) " "of QUERY_STRING because the request line is too short.", log_escape_ex(msr->mp, arg->name, arg->name_len), arg->value_origin_offset, arg->value_origin_len); continue; } } } } } /** * Output the Producer header. */ static void sec_auditlog_write_producer_header(modsec_rec *msr) { char **signatures = NULL; char *text = NULL; int i; /* Try to write everything in one go. */ if (msr->txcfg->component_signatures->nelts == 0) { text = apr_psprintf(msr->mp, "Producer: %s.\n", MODSEC_MODULE_NAME_FULL); sec_auditlog_write(msr, text, strlen(text)); return; } /* Start with the ModSecurity signature. */ text = apr_psprintf(msr->mp, "Producer: %s", MODSEC_MODULE_NAME_FULL); sec_auditlog_write(msr, text, strlen(text)); /* Then loop through the components and output individual signatures. */ signatures = (char **)msr->txcfg->component_signatures->elts; for(i = 0; i < msr->txcfg->component_signatures->nelts; i++) { text = apr_psprintf(msr->mp, "; %s", (char *)signatures[i]); sec_auditlog_write(msr, text, strlen(text)); } sec_auditlog_write(msr, ".\n", 2); } /* * \brief This function will returns the next chain node * * \param current Pointer to current chined rule * \param msr Pointer to modsec_rec * * \retval NULL On failure * \retval next_rule On Success */ static msre_rule *return_chained_rule(const msre_rule *current, modsec_rec *msr) { apr_array_header_t *arr = NULL; msre_rule **rules = NULL; msre_rule *rule = NULL, *next_rule = NULL; int i; int phase; if (current == NULL || current->actionset == NULL || current->ruleset == NULL) return NULL; phase = current->actionset->phase; switch (phase) { case PHASE_REQUEST_HEADERS : arr = current->ruleset->phase_request_headers; break; case PHASE_REQUEST_BODY : arr = current->ruleset->phase_request_body; break; case PHASE_RESPONSE_HEADERS : arr = current->ruleset->phase_response_headers; break; case PHASE_RESPONSE_BODY : arr = current->ruleset->phase_response_body; break; case PHASE_LOGGING : arr = current->ruleset->phase_logging; break; default : msr_log(msr, 1, "Logging: Invalid phase %d",phase); return NULL; } rules = (msre_rule **)arr->elts; for (i = 0; i < arr->nelts; i++) { rule = rules[i]; if (rule != NULL) { if (strncmp(current->unparsed,rule->unparsed,strlen(current->unparsed)) == 0) { if (i < arr->nelts -1) { next_rule = rules[i+1]; } else { next_rule = rules[i]; } if (next_rule == NULL || next_rule->chain_starter == NULL) return NULL; if(current->chain_starter == NULL && next_rule->chain_starter != NULL) { if (strncmp(current->unparsed, next_rule->chain_starter->unparsed, strlen(current->unparsed)) != 0) return NULL; } if(current->chain_starter != NULL && next_rule->chain_starter != NULL) { if (strncmp(current->chain_starter->unparsed, rule->chain_starter->unparsed, strlen(current->chain_starter->unparsed)) != 0) return NULL; } return next_rule; } } } return NULL; } /* * \brief This function will check if a chained rule * appears into matched array. * * \param msr Pointer to modsec_rec * \param next_rule Pointer to chained rule * * \retval 0 On failure * \retval 1 On Success */ static int chained_is_matched(modsec_rec *msr, const msre_rule *next_rule) { int i = 0; const msre_rule *rule = NULL; for (i = 0; i < msr->matched_rules->nelts; i++) { rule = ((msre_rule **)msr->matched_rules->elts)[i]; if (rule != NULL && (strncmp(rule->unparsed,next_rule->unparsed,strlen(rule->unparsed)) == 0)) { return 1; } } return 0; } /** * Produce an audit log entry. */ void sec_audit_logger(modsec_rec *msr) { const apr_array_header_t *arr = NULL; apr_table_entry_t *te = NULL; const apr_array_header_t *tarr_pattern = NULL; const apr_table_entry_t *telts_pattern = NULL; char *str1 = NULL, *str2 = NULL, *text = NULL; const msre_rule *rule = NULL, *next_rule = NULL; apr_size_t nbytes, nbytes_written; unsigned char md5hash[APR_MD5_DIGESTSIZE]; int was_limited = 0; int present = 0; int wrote_response_body = 0; char *entry_filename, *entry_basename; apr_status_t rc; int i, limit, k, sanitized_partial, j; char *buf = NULL, *pat = NULL; msc_parm *mparm = NULL; int arg_min, arg_max, sanitize_matched; /* the boundary is used by both audit log types */ msr->new_auditlog_boundary = create_auditlog_boundary(msr->r); /* Return silently if we don't have a request line. This * means we will not be logging request timeouts. */ if (msr->request_line == NULL) { msr_log(msr, 4, "Audit log: Skipping request whose request_line is null."); return; } /* Also return silently if we don't have a file descriptor. */ if (msr->txcfg->auditlog_fd == NULL) { msr_log(msr, 4, "Audit log: Skipping request since there is nowhere to write to."); return; } if (msr->txcfg->auditlog_type != AUDITLOG_CONCURRENT) { /* Serial logging - we already have an open file * descriptor to write to. */ msr->new_auditlog_fd = msr->txcfg->auditlog_fd; } else { /* Concurrent logging - we need to create a brand * new file for this request. */ apr_md5_init(&msr->new_auditlog_md5ctx); msr->new_auditlog_filename = construct_auditlog_filename(msr->mp, msr->txid); if (msr->new_auditlog_filename == NULL) return; /* The audit log storage directory should be explicitly * defined. But if it isn't try to write to the same * directory where the index file is placed. Of course, * it is *very* bad practice to allow the Apache user * to write to the same directory where a root user is * writing to but it's not us that's causing the problem * and there isn't anything we can do about that. * * ENH Actually there is something we can do! We will make * SecAuditStorageDir mandatory, ask the user to explicitly * define the storage location *and* refuse to work if the * index and the storage location are in the same folder. */ if (msr->txcfg->auditlog_storage_dir == NULL) { entry_filename = file_dirname(msr->mp, msr->txcfg->auditlog_name); } else { entry_filename = msr->txcfg->auditlog_storage_dir; } if (entry_filename == NULL) return; entry_filename = apr_psprintf(msr->mp, "%s%s", entry_filename, msr->new_auditlog_filename); if (entry_filename == NULL) return; entry_basename = file_dirname(msr->mp, entry_filename); if (entry_basename == NULL) return; /* IMP1 Surely it would be more efficient to check the folders for * the audit log repository base path in the configuration phase, to reduce * the work we do on every request. Also, since our path depends on time, * we could cache the time we last checked and don't check if we know * the folder is there. */ rc = apr_dir_make_recursive(entry_basename, msr->txcfg->auditlog_dirperms, msr->mp); if ((rc != APR_SUCCESS) && (rc != APR_EEXIST)) { msr_log(msr, 1, "Audit log: Failed to create subdirectories: %s (%s)", entry_basename, get_apr_error(msr->mp, rc)); return; } rc = apr_file_open(&msr->new_auditlog_fd, entry_filename, APR_WRITE | APR_TRUNCATE | APR_CREATE | APR_BINARY | APR_FILE_NOCLEANUP, msr->txcfg->auditlog_fileperms, msr->mp); if (rc != APR_SUCCESS) { msr_log(msr, 1, "Audit log: Failed to create file: %s (%s)", entry_filename, get_apr_error(msr->mp, rc)); return; } } /* Lock the mutex, but only if we are using serial format. */ if (msr->txcfg->auditlog_type != AUDITLOG_CONCURRENT) { rc = apr_global_mutex_lock(msr->modsecurity->auditlog_lock); if (rc != APR_SUCCESS) { msr_log(msr, 1, "Audit log: Failed to lock global mutex: %s", get_apr_error(msr->mp, rc)); } } /* AUDITLOG_PART_HEADER */ text = apr_psprintf(msr->mp, "--%s-%c--\n", msr->new_auditlog_boundary, AUDITLOG_PART_HEADER); sec_auditlog_write(msr, text, strlen(text)); /* Format: time transaction_id remote_addr remote_port local_addr local_port */ text = apr_psprintf(msr->mp, "[%s] %s %s %u %s %u", current_logtime(msr->mp), msr->txid, msr->remote_addr, msr->remote_port, msr->local_addr, msr->local_port); sec_auditlog_write(msr, text, strlen(text)); /* AUDITLOG_PART_REQUEST_HEADERS */ if (strchr(msr->txcfg->auditlog_parts, AUDITLOG_PART_REQUEST_HEADERS) != NULL) { text = apr_psprintf(msr->mp, "\n--%s-%c--\n", msr->new_auditlog_boundary, AUDITLOG_PART_REQUEST_HEADERS); sec_auditlog_write(msr, text, strlen(text)); sanitize_request_line(msr); sec_auditlog_write(msr, msr->request_line, strlen(msr->request_line)); sec_auditlog_write(msr, "\n", 1); arr = apr_table_elts(msr->request_headers); te = (apr_table_entry_t *)arr->elts; tarr_pattern = apr_table_elts(msr->pattern_to_sanitize); telts_pattern = (const apr_table_entry_t*)tarr_pattern->elts; for (i = 0; i < arr->nelts; i++) { sanitized_partial = 0; sanitize_matched = 0; text = apr_psprintf(msr->mp, "%s: %s\n", te[i].key, te[i].val); if (apr_table_get(msr->request_headers_to_sanitize, te[i].key) != NULL) { buf = apr_psprintf(msr->mp, "%s",text+strlen(te[i].key)+2); for ( k = 0; k < tarr_pattern->nelts; k++) { if(strncmp(telts_pattern[k].key,te[i].key,strlen(te[i].key)) ==0 ) { mparm = (msc_parm *)telts_pattern[k].val; if(mparm->pad_1 == -1) sanitize_matched = 1; pat = strstr(buf,mparm->value); if (pat != NULL) { j = strlen(mparm->value); arg_min = j; arg_max = 1; while((*pat != '\0')&&(j--)) { if(arg_max > mparm->pad_2) { int off = strlen(mparm->value) - arg_max; int pos = mparm->pad_1-1; if(off > pos) { *pat = '*'; } } arg_max++; arg_min--; pat++; } sanitized_partial = 1; } } } if(sanitized_partial == 1 && sanitize_matched == 0) { text = apr_psprintf(msr->mp, "%s: %s\n", te[i].key, buf); } else { memset(text + strlen(te[i].key) + 2, '*', strlen(te[i].val)); } } sec_auditlog_write(msr, text, strlen(text)); } } /* AUDITLOG_PART_REQUEST_BODY */ /* Output this part of it was explicitly requested (C) or if it was the faked * request body that was requested (I) but we have no reason to fake it (it's * already in the correct format). */ if ( (strchr(msr->txcfg->auditlog_parts, AUDITLOG_PART_REQUEST_BODY) != NULL) || ( (strchr(msr->txcfg->auditlog_parts, AUDITLOG_PART_FAKE_REQUEST_BODY) != NULL) && (msr->mpd == NULL) ) ) { if (msr->msc_reqbody_read) { const apr_array_header_t *tarr; const apr_table_entry_t *telts; apr_array_header_t *sorted_args; unsigned int offset = 0, last_offset = 0; msc_arg *nextarg = NULL; int sanitize = 0; /* IMP1 Use constants for "sanitize" values. */ char *my_error_msg = NULL; sorted_args = apr_array_make(msr->mp, 25, sizeof(const msc_arg *)); /* First we need to sort the arguments that need to be * sanitized in descending order (we are using a stack structure * to store then so the order will be ascending when we start * popping them out). This is because we will * be reading the request body sequentially and must * sanitize it as we go. */ for(;;) { nextarg = NULL; /* Find the next largest offset (excluding * the ones we've used up already). */ tarr = apr_table_elts(msr->arguments_to_sanitize); telts = (const apr_table_entry_t*)tarr->elts; for(i = 0; i < tarr->nelts; i++) { msc_arg *arg = (msc_arg *)telts[i].val; if (strcmp(arg->origin, "BODY") != 0) continue; if (last_offset == 0) { /* The first time we're here. */ if (arg->value_origin_offset > offset) { offset = arg->value_origin_offset; nextarg = arg; } } else { /* Not the first time. */ if ((arg->value_origin_offset > offset) &&(arg->value_origin_offset < last_offset)) { offset = arg->value_origin_offset; nextarg = arg; } } } /* If we don't have the next argument that means * we're done here. */ if (nextarg == NULL) break; sanitize = 2; /* Means time to pop the next argument out. */ last_offset = offset; offset = 0; { /* IMP1 Fix this ugly bit here. */ msc_arg **x = apr_array_push(sorted_args); *x = nextarg; } } /* Now start retrieving the body chunk by chunk and * sanitize data in pieces. */ rc = modsecurity_request_body_retrieve_start(msr, &my_error_msg); if (rc < 0) { msr_log(msr, 1, "Audit log: %s", my_error_msg); } else { msc_data_chunk *chunk = NULL; unsigned int chunk_offset = 0; unsigned int sanitize_offset = 0; unsigned int sanitize_length = 0; text = apr_psprintf(msr->mp, "\n--%s-%c--\n", msr->new_auditlog_boundary, AUDITLOG_PART_REQUEST_BODY); sec_auditlog_write(msr, text, strlen(text)); for(;;) { rc = modsecurity_request_body_retrieve(msr, &chunk, -1, &my_error_msg); if (chunk != NULL) { /* Anything greater than 1 means we have more data to sanitize. */ while (sanitize > 1) { msc_arg **arg = NULL; if (sanitize == 2) { /* Get the next argument from the stack. */ arg = (msc_arg **)apr_array_pop(sorted_args); if (arg == NULL) sanitize = 0; /* We're done sanitising. */ else { /* Continue with sanitation to process the * retrieved argument. */ sanitize = 1; sanitize_offset = (*arg)->value_origin_offset; sanitize_length = (*arg)->value_origin_len; } } if (sanitize) { /* Check if the data we want to sanitize is * stored in the current chunk. */ if (chunk_offset + chunk->length > sanitize_offset) { unsigned int soff; /* data offset within chunk */ unsigned int len; /* amount in this chunk to sanitize */ soff = sanitize_offset - chunk_offset; if (soff + sanitize_length <= chunk->length) { /* The entire argument resides in the current chunk. */ len = sanitize_length; sanitize = 2; /* Get another parameter to sanitize. */ } else { /* Some work to do here but we'll need to seek * another chunk. */ len = chunk->length - soff; sanitize_offset += len; sanitize_length -= len; sanitize = 1; /* It's OK to go to the next chunk. */ } /* Yes, we actually write over the original data. * We shouldn't be needing it any more. */ if (soff + len <= chunk->length) { /* double check */ memset((char *)chunk->data + soff, '*', len); } } } } /* Write the sanitized chunk to the log * and advance to the next chunk. */ sec_auditlog_write(msr, chunk->data, chunk->length); chunk_offset += chunk->length; } if (rc <= 0) { break; } } if (rc < 0) { msr_log(msr, 1, "Audit log: %s", my_error_msg); } modsecurity_request_body_retrieve_end(msr); } } } /* AUDITLOG_PART_FAKE_REQUEST_BODY */ if (strchr(msr->txcfg->auditlog_parts, AUDITLOG_PART_FAKE_REQUEST_BODY) != NULL) { if ((msr->msc_reqbody_read)&&(msr->mpd != NULL)) { char *buffer = NULL; buffer = multipart_reconstruct_urlencoded_body_sanitize(msr); if (buffer == NULL) { msr_log(msr, 1, "Audit log: Failed to reconstruct request body."); } else { text = apr_psprintf(msr->mp, "\n--%s-%c--\n", msr->new_auditlog_boundary, AUDITLOG_PART_FAKE_REQUEST_BODY); sec_auditlog_write(msr, text, strlen(text)); sec_auditlog_write(msr, buffer, strlen(buffer)); } } } /* AUDITLOG_PART_A_RESPONSE_HEADERS */ if (strchr(msr->txcfg->auditlog_parts, AUDITLOG_PART_A_RESPONSE_HEADERS) != NULL) { text = apr_psprintf(msr->mp, "\n--%s-%c--\n", msr->new_auditlog_boundary, AUDITLOG_PART_A_RESPONSE_HEADERS); sec_auditlog_write(msr, text, strlen(text)); /* There are no response headers (or the status line) in HTTP 0.9 */ if (msr->response_headers_sent) { if (msr->status_line != NULL) { text = apr_psprintf(msr->mp, "%s %s\n", msr->response_protocol, msr->status_line); } else { text = apr_psprintf(msr->mp, "%s %u\n", msr->response_protocol, msr->response_status); } sec_auditlog_write(msr, text, strlen(text)); /* Output headers */ arr = apr_table_elts(msr->response_headers); te = (apr_table_entry_t *)arr->elts; tarr_pattern = apr_table_elts(msr->pattern_to_sanitize); telts_pattern = (const apr_table_entry_t*)tarr_pattern->elts; for (i = 0; i < arr->nelts; i++) { sanitized_partial = 0; sanitize_matched = 0; text = apr_psprintf(msr->mp, "%s: %s\n", te[i].key, te[i].val); if (apr_table_get(msr->response_headers_to_sanitize, te[i].key) != NULL) { buf = apr_psprintf(msr->mp, "%s",text+strlen(te[i].key)+2); for ( k = 0; k < tarr_pattern->nelts; k++) { if(strncmp(telts_pattern[k].key,te[i].key,strlen(te[i].key)) ==0 ) { mparm = (msc_parm *)telts_pattern[k].val; if(mparm->pad_1 == -1) sanitize_matched = 1; pat = strstr(buf,mparm->value); if (pat != NULL) { j = strlen(mparm->value); arg_min = j; arg_max = 1; while((*pat != '\0')&&(j--)) { if(arg_max > mparm->pad_2) { int off = strlen(mparm->value) - arg_max; int pos = mparm->pad_1-1; if(off > pos) { *pat = '*'; } } arg_max++; arg_min--; pat++; } sanitized_partial = 1; } } } if(sanitized_partial == 1 && sanitize_matched == 0) { text = apr_psprintf(msr->mp, "%s: %s\n", te[i].key, buf); } else { memset(text + strlen(te[i].key) + 2, '*', strlen(te[i].val)); } } sec_auditlog_write(msr, text, strlen(text)); } } } apr_table_clear(msr->pattern_to_sanitize); /* AUDITLOG_PART_RESPONSE_BODY */ if (strchr(msr->txcfg->auditlog_parts, AUDITLOG_PART_RESPONSE_BODY) != NULL) { if (msr->resbody_data != NULL) { text = apr_psprintf(msr->mp, "\n--%s-%c--\n", msr->new_auditlog_boundary, AUDITLOG_PART_RESPONSE_BODY); sec_auditlog_write(msr, text, strlen(text)); sec_auditlog_write(msr, msr->resbody_data, msr->resbody_length); wrote_response_body = 1; } } /* AUDITLOG_PART_TRAILER */ if (strchr(msr->txcfg->auditlog_parts, AUDITLOG_PART_TRAILER) != NULL) { apr_time_t now = apr_time_now(); text = apr_psprintf(msr->mp, "\n--%s-%c--\n", msr->new_auditlog_boundary, AUDITLOG_PART_TRAILER); sec_auditlog_write(msr, text, strlen(text)); /* Messages */ for(i = 0; i < msr->alerts->nelts; i++) { text = apr_psprintf(msr->mp, "Message: %s\n", ((char **)msr->alerts->elts)[i]); sec_auditlog_write(msr, text, strlen(text)); } /* Apache error messages */ for(i = 0; i < msr->error_messages->nelts; i++) { error_message_t *em = (((error_message_t **)msr->error_messages->elts)[i]); text = apr_psprintf(msr->mp, "Apache-Error: %s\n", format_error_log_message(msr->mp, em)); sec_auditlog_write(msr, text, strlen(text)); } /* Action */ if (msr->was_intercepted) { text = apr_psprintf(msr->mp, "Action: Intercepted (phase %d)\n", msr->intercept_phase); sec_auditlog_write(msr, text, strlen(text)); } /* Apache-Handler */ if (msr->r->handler != NULL) { text = apr_psprintf(msr->mp, "Apache-Handler: %s\n", msr->r->handler); sec_auditlog_write(msr, text, strlen(text)); } /* Stopwatch; left in for compatibility reasons */ text = apr_psprintf(msr->mp, "Stopwatch: %" APR_TIME_T_FMT " %" APR_TIME_T_FMT " (- - -)\n", msr->request_time, (now - msr->request_time)); sec_auditlog_write(msr, text, strlen(text)); /* Stopwatch2 */ { char *perf_all = format_all_performance_variables(msr, msr->mp); text = apr_psprintf(msr->mp, "Stopwatch2: %" APR_TIME_T_FMT " %" APR_TIME_T_FMT "; %s\n", msr->request_time, (now - msr->request_time), perf_all); sec_auditlog_write(msr, text, strlen(text)); } /* Our response body does not contain chunks */ /* ENH Only write this when the output was chunked. */ /* ENH Add info when request body was decompressed, dechunked too. */ if (wrote_response_body) { text = apr_psprintf(msr->mp, "Response-Body-Transformed: Dechunked\n"); sec_auditlog_write(msr, text, strlen(text)); } sec_auditlog_write_producer_header(msr); /* Server */ if (msr->server_software != NULL) { text = apr_psprintf(msr->mp, "Server: %s\n", msr->server_software); sec_auditlog_write(msr, text, strlen(text)); } /* Sanitised arguments */ { const apr_array_header_t *tarr; const apr_table_entry_t *telts; tarr = apr_table_elts(msr->arguments_to_sanitize); telts = (const apr_table_entry_t*)tarr->elts; if (tarr->nelts > 0) { text = apr_psprintf(msr->mp, "Sanitised-Args: "); sec_auditlog_write(msr, text, strlen(text)); } for(i = 0; i < tarr->nelts; i++) { msc_arg *arg = (msc_arg *)telts[i].val; text = apr_psprintf(msr->mp, "%s\"%s\"%s", ((i == 0) ? "" : ", "), log_escape(msr->mp, arg->name), ((i == (tarr->nelts - 1)) ? ".\n" : "")); sec_auditlog_write(msr, text, strlen(text)); } } /* Sanitised request headers */ { const apr_array_header_t *tarr; const apr_table_entry_t *telts; tarr = apr_table_elts(msr->request_headers_to_sanitize); telts = (const apr_table_entry_t*)tarr->elts; if (tarr->nelts > 0) { text = apr_psprintf(msr->mp, "Sanitised-Request-Headers: "); sec_auditlog_write(msr, text, strlen(text)); } for(i = 0; i < tarr->nelts; i++) { text = apr_psprintf(msr->mp, "%s\"%s\"%s", ((i == 0) ? "" : ", "), log_escape(msr->mp, telts[i].key), ((i == (tarr->nelts - 1)) ? ".\n" : "")); sec_auditlog_write(msr, text, strlen(text)); } } /* Sanitised response headers */ { const apr_array_header_t *tarr; const apr_table_entry_t *telts; tarr = apr_table_elts(msr->response_headers_to_sanitize); telts = (const apr_table_entry_t*)tarr->elts; if (tarr->nelts > 0) { text = apr_psprintf(msr->mp, "Sanitised-Response-Headers: "); sec_auditlog_write(msr, text, strlen(text)); } for(i = 0; i < tarr->nelts; i++) { text = apr_psprintf(msr->mp, "%s\"%s\"%s", ((i == 0) ? "" : ", "), log_escape(msr->mp, telts[i].key), ((i == (tarr->nelts - 1)) ? ".\n" : "")); sec_auditlog_write(msr, text, strlen(text)); } } /* Web application info. */ if ( ((msr->txcfg->webappid != NULL)&&(strcmp(msr->txcfg->webappid, "default") != 0)) || (msr->sessionid != NULL) || (msr->userid != NULL)) { text = apr_psprintf(msr->mp, "WebApp-Info: \"%s\" \"%s\" \"%s\"\n", msr->txcfg->webappid == NULL ? "-" : log_escape(msr->mp, msr->txcfg->webappid), msr->sessionid == NULL ? "-" : log_escape(msr->mp, msr->sessionid), msr->userid == NULL ? "-" : log_escape(msr->mp, msr->userid)); sec_auditlog_write(msr, text, strlen(text)); } if ( ((msr->txcfg->sensor_id != NULL)&&(strcmp(msr->txcfg->sensor_id, "default") != 0))) { text = apr_psprintf(msr->mp, "Sensor-Id: \"%s\"\n", msr->txcfg->sensor_id == NULL ? "-" : log_escape(msr->mp, msr->txcfg->sensor_id)), sec_auditlog_write(msr, text, strlen(text)); } if (msr->txcfg->is_enabled > 0) { text = apr_psprintf(msr->mp, "Engine-Mode: \"%s\"\n", msr->txcfg->is_enabled == 1 ? "DETECTION_ONLY" : "ENABLED"), sec_auditlog_write(msr, text, strlen(text)); } /* Rule performance time */ if(msr->txcfg->max_rule_time > 0) { const apr_array_header_t *tarr; const apr_table_entry_t *telts; tarr = apr_table_elts(msr->perf_rules); telts = (const apr_table_entry_t*)tarr->elts; if (tarr->nelts > 0) { text = apr_psprintf(msr->mp, "Rules-Performance-Info: "); sec_auditlog_write(msr, text, strlen(text)); } for(i = 0; i < tarr->nelts; i++) { text = apr_psprintf(msr->mp, "%s\"%s=%s\"%s", ((i == 0) ? "" : ", "), log_escape(msr->mp, telts[i].key), log_escape(msr->mp, telts[i].val), ((i == (tarr->nelts - 1)) ? ".\n" : "")); sec_auditlog_write(msr, text, strlen(text)); } } } /* AUDITLOG_PART_UPLOADS */ if ((strchr(msr->txcfg->auditlog_parts, AUDITLOG_PART_UPLOADS) != NULL) && (msr->mpd != NULL)) { multipart_part **parts = NULL; unsigned int total_size = 0; int cfiles = 0; text = apr_psprintf(msr->mp, "\n--%s-%c--\n", msr->new_auditlog_boundary, AUDITLOG_PART_UPLOADS); sec_auditlog_write(msr, text, strlen(text)); parts = (multipart_part **)msr->mpd->parts->elts; for(cfiles = 0; cfiles < msr->mpd->parts->nelts; cfiles++) { if (parts[cfiles]->type == MULTIPART_FILE) { if(parts[cfiles]->filename != NULL) { text = apr_psprintf(msr->mp, "%d,%u,\"%s\",\"%s\"\n", cfiles+1, parts[cfiles]->tmp_file_size, log_escape(msr->mp, parts[cfiles]->filename), log_escape(msr->mp, parts[cfiles]->content_type ? parts[cfiles]->content_type : "")); sec_auditlog_write(msr, text, strlen(text)); total_size += parts[cfiles]->tmp_file_size; } } } text = apr_psprintf(msr->mp, "Total,%u\n", total_size); sec_auditlog_write(msr, text, strlen(text)); } /* AUDITLOG_PART_MATCHEDRULES */ if (strchr(msr->txcfg->auditlog_parts, AUDITLOG_PART_MATCHEDRULES) != NULL) { text = apr_psprintf(msr->mp, "\n--%s-%c--\n", msr->new_auditlog_boundary, AUDITLOG_PART_MATCHEDRULES); sec_auditlog_write(msr, text, strlen(text)); /* Matched Rules */ for(i = 0; i < msr->matched_rules->nelts; i++) { rule = ((msre_rule **)msr->matched_rules->elts)[i]; if ((rule != NULL) && (rule->actionset != NULL) && rule->actionset->is_chained && (rule->chain_starter == NULL)) { text = apr_psprintf(msr->mp, "%s\n", rule->unparsed); sec_auditlog_write(msr, text, strlen(text)); do { if (rule->ruleset != NULL) { next_rule = return_chained_rule(rule,msr); if (next_rule != NULL) { present = chained_is_matched(msr,next_rule); if (present == 0) { text = apr_psprintf(msr->mp, "#%s\n",next_rule->unparsed); } else { text = apr_psprintf(msr->mp, "%s\n",next_rule->unparsed); i++; } sec_auditlog_write(msr, text, strlen(text)); } } rule = next_rule; } while (rule != NULL && rule->actionset != NULL && rule->actionset->is_chained); text = apr_psprintf(msr->mp, "\n"); sec_auditlog_write(msr, text, strlen(text)); } else { if ((rule != NULL) && (rule->actionset != NULL) && !rule->actionset->is_chained && (rule->chain_starter == NULL)) { text = apr_psprintf(msr->mp, "%s\n\n", rule->unparsed); sec_auditlog_write(msr, text, strlen(text)); } } } } /* AUDITLOG_PART_ENDMARKER */ text = apr_psprintf(msr->mp, "\n--%s-%c--\n", msr->new_auditlog_boundary, AUDITLOG_PART_ENDMARKER); sec_auditlog_write(msr, text, strlen(text)); /* Return here if we were writing to a serial log * as it does not need an index file. */ if (msr->txcfg->auditlog_type != AUDITLOG_CONCURRENT) { sec_auditlog_write(msr, "\n", 1); /* Unlock the mutex we used to serialise access to the audit log file. */ rc = apr_global_mutex_unlock(msr->modsecurity->auditlog_lock); if (rc != APR_SUCCESS) { msr_log(msr, 1, "Audit log: Failed to unlock global mutex: %s", get_apr_error(msr->mp, rc)); } return; } /* From here on only concurrent-style processing. */ apr_file_close(msr->new_auditlog_fd); /* Write an entry to the index file */ /* Calculate hash of the entry. */ apr_md5_final(md5hash, &msr->new_auditlog_md5ctx); str2 = apr_psprintf(msr->mp, "%s %d %d md5:%s", msr->new_auditlog_filename, 0, msr->new_auditlog_size, bytes2hex(msr->mp, md5hash, 16)); if (str2 == NULL) return; /* We do not want the index line to be longer than 3980 bytes. */ limit = 3980; was_limited = 0; /* If we are logging to a pipe we need to observe and * obey the pipe atomic write limit - PIPE_BUF. For * more details see the discussion in sec_guardian_logger code. */ if (msr->txcfg->auditlog_name[0] == '|') { if (PIPE_BUF < limit) { limit = PIPE_BUF; } } limit = limit - strlen(str2) - 5; if (limit <= 0) { msr_log(msr, 1, "Audit Log: Atomic PIPE write buffer too small: %d", PIPE_BUF); return; } str1 = construct_log_vcombinedus_limited(msr, limit, &was_limited); if (str1 == NULL) return; if (was_limited == 0) { text = apr_psprintf(msr->mp, "%s %s \n", str1, str2); } else { text = apr_psprintf(msr->mp, "%s %s L\n", str1, str2); } if (text == NULL) return; nbytes = strlen(text); if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Audit Log: Writing %" APR_SIZE_T_FMT " bytes to primary concurrent index", nbytes); } apr_file_write_full(msr->txcfg->auditlog_fd, text, nbytes, &nbytes_written); /* Write to the secondary audit log if we have one */ if (msr->txcfg->auditlog2_fd != NULL) { if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Audit Log: Writing %" APR_SIZE_T_FMT " bytes to secondary concurrent index", nbytes); } apr_file_write_full(msr->txcfg->auditlog2_fd, text, nbytes, &nbytes_written); } } modsecurity-apache_2.7.7/apache2/msc_multipart.h0000664000175000017500000001043112243422537022175 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #ifndef _MSC_MULTIPART_H_ #define _MSC_MULTIPART_H_ #define MULTIPART_BUF_SIZE 4096 #define MULTIPART_FORMDATA 1 #define MULTIPART_FILE 2 typedef struct multipart_part multipart_part; typedef struct multipart_data multipart_data; #include "apr_general.h" #include "apr_tables.h" #include "modsecurity.h" typedef struct value_part_t value_part_t; struct value_part_t { char *data; long int length; }; struct multipart_part { /* part type, can be MULTIPART_FORMDATA or MULTIPART_FILE */ int type; /* the name */ char *name; /* variables only, variable value */ char *value; apr_array_header_t *value_parts; /* files only, the content type (where available) */ char *content_type; /* files only, the name of the temporary file holding data */ char *tmp_file_name; int tmp_file_fd; unsigned int tmp_file_size; /* files only, filename as supplied by the browser */ char *filename; char *last_header_name; apr_table_t *headers; unsigned int offset; unsigned int length; }; struct multipart_data { /* this array keeps parts */ apr_array_header_t *parts; /* Number of parts that are files */ int nfiles; /* mime boundary used to detect when * parts end and begin */ char *boundary; int boundary_count; /* internal buffer and other variables * used while parsing */ char buf[MULTIPART_BUF_SIZE + 2]; int buf_contains_line; char *bufptr; int bufleft; unsigned int buf_offset; /* pointer that keeps track of a part while * it is being built */ multipart_part *mpp; /* part parsing state; 0 means we are reading * headers, 1 means we are collecting data */ int mpp_state; /* because of the way this parsing algorithm * works we hold back the last two bytes of * each data chunk so that we can discard it * later if the next data chunk proves to be * a boundary; the first byte is an indicator * 0 - no content, 1 - two data bytes available */ char reserve[4]; int seen_data; int is_complete; int flag_error; int flag_data_before; int flag_data_after; int flag_header_folding; int flag_boundary_quoted; int flag_lf_line; int flag_crlf_line; int flag_unmatched_boundary; int flag_boundary_whitespace; int flag_missing_semicolon; int flag_invalid_quoting; int flag_invalid_part; int flag_invalid_header_folding; int flag_file_limit_exceeded; }; /* Functions */ int DSOLOCAL multipart_init(modsec_rec *msr, char **error_msg); int DSOLOCAL multipart_complete(modsec_rec *msr, char **error_msg); int DSOLOCAL multipart_process_chunk(modsec_rec *msr, const char *buf, unsigned int size, char **error_msg); apr_status_t DSOLOCAL multipart_cleanup(modsec_rec *msr); int DSOLOCAL multipart_get_arguments(modsec_rec *msr, char *origin, apr_table_t *arguments); char DSOLOCAL *multipart_reconstruct_urlencoded_body_sanitize(modsec_rec *msr); #endif modsecurity-apache_2.7.7/apache2/apache2_config.c0000664000175000017500000034256312254164464022157 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #include #include "modsecurity.h" #include "msc_logging.h" #include "msc_util.h" #include "http_log.h" #include "apr_lib.h" #include "acmp.h" #include "msc_crypt.h" #if defined(WITH_LUA) #include "msc_lua.h" #endif /* -- Directory context creation and initialisation -- */ /** * Creates a fresh directory configuration. */ void *create_directory_config(apr_pool_t *mp, char *path) { directory_config *dcfg = (directory_config *)apr_pcalloc(mp, sizeof(directory_config)); if (dcfg == NULL) return NULL; #ifdef DEBUG_CONF ap_log_perror(APLOG_MARK, APLOG_STARTUP|APLOG_NOERRNO, 0, mp, "Created directory config %pp path %s", dcfg, path); #endif dcfg->mp = mp; dcfg->is_enabled = NOT_SET; dcfg->reqbody_access = NOT_SET; dcfg->reqintercept_oe = NOT_SET; dcfg->reqbody_buffering = NOT_SET; dcfg->reqbody_inmemory_limit = NOT_SET; dcfg->reqbody_limit = NOT_SET; dcfg->reqbody_no_files_limit = NOT_SET; dcfg->resbody_access = NOT_SET; dcfg->debuglog_name = NOT_SET_P; dcfg->debuglog_level = NOT_SET; dcfg->debuglog_fd = NOT_SET_P; dcfg->of_limit = NOT_SET; dcfg->if_limit_action = NOT_SET; dcfg->of_limit_action = NOT_SET; dcfg->of_mime_types = NOT_SET_P; dcfg->of_mime_types_cleared = NOT_SET; dcfg->cookie_format = NOT_SET; dcfg->argument_separator = NOT_SET; dcfg->cookiev0_separator = NOT_SET_P; dcfg->rule_inheritance = NOT_SET; dcfg->rule_exceptions = apr_array_make(mp, 16, sizeof(rule_exception *)); dcfg->hash_method = apr_array_make(mp, 16, sizeof(hash_method *)); /* audit log variables */ dcfg->auditlog_flag = NOT_SET; dcfg->auditlog_type = NOT_SET; dcfg->max_rule_time = NOT_SET; dcfg->auditlog_dirperms = NOT_SET; dcfg->auditlog_fileperms = NOT_SET; dcfg->auditlog_name = NOT_SET_P; dcfg->auditlog2_name = NOT_SET_P; dcfg->auditlog_fd = NOT_SET_P; dcfg->auditlog2_fd = NOT_SET_P; dcfg->auditlog_storage_dir = NOT_SET_P; dcfg->auditlog_parts = NOT_SET_P; dcfg->auditlog_relevant_regex = NOT_SET_P; dcfg->ruleset = NULL; /* Upload */ dcfg->tmp_dir = NOT_SET_P; dcfg->upload_dir = NOT_SET_P; dcfg->upload_keep_files = NOT_SET; dcfg->upload_validates_files = NOT_SET; dcfg->upload_filemode = NOT_SET; dcfg->upload_file_limit = NOT_SET; /* These are only used during the configuration process. */ dcfg->tmp_chain_starter = NULL; dcfg->tmp_default_actionset = NULL; dcfg->tmp_rule_placeholders = NULL; /* Misc */ dcfg->data_dir = NOT_SET_P; dcfg->webappid = NOT_SET_P; dcfg->sensor_id = NOT_SET_P; dcfg->httpBlkey = NOT_SET_P; /* Content injection. */ dcfg->content_injection_enabled = NOT_SET; /* Stream inspection */ dcfg->stream_inbody_inspection = NOT_SET; dcfg->stream_outbody_inspection = NOT_SET; /* Geo Lookups */ dcfg->geo = NOT_SET_P; /* Gsb Lookups */ dcfg->gsb = NOT_SET_P; /* Unicode Map */ dcfg->u_map = NOT_SET_P; /* Cache */ dcfg->cache_trans = NOT_SET; dcfg->cache_trans_incremental = NOT_SET; dcfg->cache_trans_min = NOT_SET; dcfg->cache_trans_max = NOT_SET; dcfg->cache_trans_maxitems = NOT_SET; /* Rule ids */ dcfg->rule_id_htab = apr_hash_make(mp); dcfg->component_signatures = apr_array_make(mp, 16, sizeof(char *)); dcfg->request_encoding = NOT_SET_P; dcfg->disable_backend_compression = NOT_SET; /* Collection timeout */ dcfg->col_timeout = NOT_SET; dcfg->crypto_key = NOT_SET_P; dcfg->crypto_key_len = NOT_SET; dcfg->crypto_key_add = NOT_SET; dcfg->crypto_param_name = NOT_SET_P; dcfg->hash_is_enabled = NOT_SET; dcfg->hash_enforcement = NOT_SET; dcfg->crypto_hash_href_rx = NOT_SET; dcfg->crypto_hash_faction_rx = NOT_SET; dcfg->crypto_hash_location_rx = NOT_SET; dcfg->crypto_hash_iframesrc_rx = NOT_SET; dcfg->crypto_hash_framesrc_rx = NOT_SET; dcfg->crypto_hash_href_pm = NOT_SET; dcfg->crypto_hash_faction_pm = NOT_SET; dcfg->crypto_hash_location_pm = NOT_SET; dcfg->crypto_hash_iframesrc_pm = NOT_SET; dcfg->crypto_hash_framesrc_pm = NOT_SET; /* xml external entity */ dcfg->xml_external_entity = NOT_SET; return dcfg; } /** * Copies rules between one phase of two configuration contexts, * taking exceptions into account. */ static void copy_rules_phase(apr_pool_t *mp, apr_array_header_t *parent_phase_arr, apr_array_header_t *child_phase_arr, apr_array_header_t *exceptions_arr) { rule_exception **exceptions; msre_rule **rules; int i, j; int mode = 0; rules = (msre_rule **)parent_phase_arr->elts; for(i = 0; i < parent_phase_arr->nelts; i++) { msre_rule *rule = (msre_rule *)rules[i]; int copy = 1; if (mode == 0) { /* First rule in the chain. */ exceptions = (rule_exception **)exceptions_arr->elts; for(j = 0; j < exceptions_arr->nelts; j++) { /* Process exceptions. */ switch(exceptions[j]->type) { case RULE_EXCEPTION_REMOVE_ID : if ((rule->actionset != NULL)&&(rule->actionset->id != NULL)) { int ruleid = atoi(rule->actionset->id); if (rule_id_in_range(ruleid, exceptions[j]->param)) copy--; } break; case RULE_EXCEPTION_REMOVE_MSG : if ((rule->actionset != NULL)&&(rule->actionset->msg != NULL)) { char *my_error_msg = NULL; int rc = msc_regexec(exceptions[j]->param_data, rule->actionset->msg, strlen(rule->actionset->msg), &my_error_msg); if (rc >= 0) copy--; } break; case RULE_EXCEPTION_REMOVE_TAG : if ((rule->actionset != NULL)&&(apr_is_empty_table(rule->actionset->actions) == 0)) { char *my_error_msg = NULL; const apr_array_header_t *tarr = NULL; const apr_table_entry_t *telts = NULL; int c; tarr = apr_table_elts(rule->actionset->actions); telts = (const apr_table_entry_t*)tarr->elts; for (c = 0; c < tarr->nelts; c++) { msre_action *action = (msre_action *)telts[c].val; if(strcmp("tag", action->metadata->name) == 0) { int rc = msc_regexec(exceptions[j]->param_data, action->param, strlen(action->param), &my_error_msg); if (rc >= 0) copy--; } } } break; } } if (copy > 0) { #ifdef DEBUG_CONF ap_log_perror(APLOG_MARK, APLOG_STARTUP|APLOG_NOERRNO, 0, mp, "Copy rule %pp [id \"%s\"]", rule, rule->actionset->id); #endif /* Copy the rule. */ *(msre_rule **)apr_array_push(child_phase_arr) = rule; if (rule->actionset->is_chained) mode = 2; } else { if (rule->actionset->is_chained) mode = 1; } } else { if (mode == 2) { #ifdef DEBUG_CONF ap_log_perror(APLOG_MARK, APLOG_STARTUP|APLOG_NOERRNO, 0, mp, "Copy chain %pp for rule %pp [id \"%s\"]", rule, rule->chain_starter, rule->chain_starter->actionset->id); #endif /* Copy the rule (it belongs to the chain we want to include. */ *(msre_rule **)apr_array_push(child_phase_arr) = rule; } if ((rule->actionset == NULL)||(rule->actionset->is_chained == 0)) mode = 0; } } } /** * Copies rules between two configuration contexts, * taking exceptions into account. */ static int copy_rules(apr_pool_t *mp, msre_ruleset *parent_ruleset, msre_ruleset *child_ruleset, apr_array_header_t *exceptions_arr) { copy_rules_phase(mp, parent_ruleset->phase_request_headers, child_ruleset->phase_request_headers, exceptions_arr); copy_rules_phase(mp, parent_ruleset->phase_request_body, child_ruleset->phase_request_body, exceptions_arr); copy_rules_phase(mp, parent_ruleset->phase_response_headers, child_ruleset->phase_response_headers, exceptions_arr); copy_rules_phase(mp, parent_ruleset->phase_response_body, child_ruleset->phase_response_body, exceptions_arr); copy_rules_phase(mp, parent_ruleset->phase_logging, child_ruleset->phase_logging, exceptions_arr); return 1; } /** * Merges two directory configurations. */ void *merge_directory_configs(apr_pool_t *mp, void *_parent, void *_child) { directory_config *parent = (directory_config *)_parent; directory_config *child = (directory_config *)_child; directory_config *merged = create_directory_config(mp, NULL); #ifdef DEBUG_CONF ap_log_perror(APLOG_MARK, APLOG_STARTUP|APLOG_NOERRNO, 0, mp, "Merge parent %pp child %pp RESULT %pp", _parent, _child, merged); #endif if (merged == NULL) return NULL; /* Use values from the child configuration where possible, * otherwise use the parent's. */ merged->is_enabled = (child->is_enabled == NOT_SET ? parent->is_enabled : child->is_enabled); /* IO parameters */ merged->reqbody_access = (child->reqbody_access == NOT_SET ? parent->reqbody_access : child->reqbody_access); merged->reqbody_buffering = (child->reqbody_buffering == NOT_SET ? parent->reqbody_buffering : child->reqbody_buffering); merged->reqbody_inmemory_limit = (child->reqbody_inmemory_limit == NOT_SET ? parent->reqbody_inmemory_limit : child->reqbody_inmemory_limit); merged->reqbody_limit = (child->reqbody_limit == NOT_SET ? parent->reqbody_limit : child->reqbody_limit); merged->reqbody_no_files_limit = (child->reqbody_no_files_limit == NOT_SET ? parent->reqbody_no_files_limit : child->reqbody_no_files_limit); merged->resbody_access = (child->resbody_access == NOT_SET ? parent->resbody_access : child->resbody_access); merged->of_limit = (child->of_limit == NOT_SET ? parent->of_limit : child->of_limit); merged->if_limit_action = (child->if_limit_action == NOT_SET ? parent->if_limit_action : child->if_limit_action); merged->of_limit_action = (child->of_limit_action == NOT_SET ? parent->of_limit_action : child->of_limit_action); merged->reqintercept_oe = (child->reqintercept_oe == NOT_SET ? parent->reqintercept_oe : child->reqintercept_oe); if (child->of_mime_types != NOT_SET_P) { /* Child added to the table */ if (child->of_mime_types_cleared == 1) { /* The list of MIME types was cleared in the child, * which means the parent's MIME types went away and * we should not take them into consideration here. */ merged->of_mime_types = child->of_mime_types; merged->of_mime_types_cleared = 1; } else { /* Add MIME types defined in the child to those * defined in the parent context. */ if (parent->of_mime_types == NOT_SET_P) { merged->of_mime_types = child->of_mime_types; merged->of_mime_types_cleared = NOT_SET; } else { merged->of_mime_types = apr_table_overlay(mp, parent->of_mime_types, child->of_mime_types); if (merged->of_mime_types == NULL) return NULL; } } } else { /* Child did not add to the table */ if (child->of_mime_types_cleared == 1) { merged->of_mime_types_cleared = 1; } else { merged->of_mime_types = parent->of_mime_types; merged->of_mime_types_cleared = parent->of_mime_types_cleared; } } /* debug log */ if (child->debuglog_fd == NOT_SET_P) { merged->debuglog_name = parent->debuglog_name; merged->debuglog_fd = parent->debuglog_fd; } else { merged->debuglog_name = child->debuglog_name; merged->debuglog_fd = child->debuglog_fd; } merged->debuglog_level = (child->debuglog_level == NOT_SET ? parent->debuglog_level : child->debuglog_level); merged->cookie_format = (child->cookie_format == NOT_SET ? parent->cookie_format : child->cookie_format); merged->argument_separator = (child->argument_separator == NOT_SET ? parent->argument_separator : child->argument_separator); merged->cookiev0_separator = (child->cookiev0_separator == NOT_SET_P ? parent->cookiev0_separator : child->cookiev0_separator); /* rule inheritance */ if ((child->rule_inheritance == NOT_SET)||(child->rule_inheritance == 1)) { merged->rule_inheritance = parent->rule_inheritance; if ((child->ruleset == NULL)&&(parent->ruleset == NULL)) { #ifdef DEBUG_CONF ap_log_perror(APLOG_MARK, APLOG_STARTUP|APLOG_NOERRNO, 0, mp, "No rules in this context."); #endif /* Do nothing, there are no rules in either context. */ } else if (child->ruleset == NULL) { #ifdef DEBUG_CONF ap_log_perror(APLOG_MARK, APLOG_STARTUP|APLOG_NOERRNO, 0, mp, "Using parent rules in this context."); #endif /* Copy the rules from the parent context. */ merged->ruleset = msre_ruleset_create(parent->ruleset->engine, mp); copy_rules(mp, parent->ruleset, merged->ruleset, child->rule_exceptions); } else if (parent->ruleset == NULL) { #ifdef DEBUG_CONF ap_log_perror(APLOG_MARK, APLOG_STARTUP|APLOG_NOERRNO, 0, mp, "Using child rules in this context."); #endif /* Copy child rules. */ merged->ruleset = msre_ruleset_create(child->ruleset->engine, mp); merged->ruleset->phase_request_headers = apr_array_copy(mp, child->ruleset->phase_request_headers); merged->ruleset->phase_request_body = apr_array_copy(mp, child->ruleset->phase_request_body); merged->ruleset->phase_response_headers = apr_array_copy(mp, child->ruleset->phase_response_headers); merged->ruleset->phase_response_body = apr_array_copy(mp, child->ruleset->phase_response_body); merged->ruleset->phase_logging = apr_array_copy(mp, child->ruleset->phase_logging); } else { #ifdef DEBUG_CONF ap_log_perror(APLOG_MARK, APLOG_STARTUP|APLOG_NOERRNO, 0, mp, "Using parent then child rules in this context."); #endif /* Copy parent rules, then add child rules to it. */ merged->ruleset = msre_ruleset_create(parent->ruleset->engine, mp); copy_rules(mp, parent->ruleset, merged->ruleset, child->rule_exceptions); apr_array_cat(merged->ruleset->phase_request_headers, child->ruleset->phase_request_headers); apr_array_cat(merged->ruleset->phase_request_body, child->ruleset->phase_request_body); apr_array_cat(merged->ruleset->phase_response_headers, child->ruleset->phase_response_headers); apr_array_cat(merged->ruleset->phase_response_body, child->ruleset->phase_response_body); apr_array_cat(merged->ruleset->phase_logging, child->ruleset->phase_logging); } } else { merged->rule_inheritance = 0; if (child->ruleset != NULL) { /* Copy child rules. */ merged->ruleset = msre_ruleset_create(child->ruleset->engine, mp); merged->ruleset->phase_request_headers = apr_array_copy(mp, child->ruleset->phase_request_headers); merged->ruleset->phase_request_body = apr_array_copy(mp, child->ruleset->phase_request_body); merged->ruleset->phase_response_headers = apr_array_copy(mp, child->ruleset->phase_response_headers); merged->ruleset->phase_response_body = apr_array_copy(mp, child->ruleset->phase_response_body); merged->ruleset->phase_logging = apr_array_copy(mp, child->ruleset->phase_logging); } } /* Merge rule exceptions. */ merged->rule_exceptions = apr_array_append(mp, parent->rule_exceptions, child->rule_exceptions); merged->hash_method = apr_array_append(mp, parent->hash_method, child->hash_method); /* audit log variables */ merged->auditlog_flag = (child->auditlog_flag == NOT_SET ? parent->auditlog_flag : child->auditlog_flag); merged->auditlog_type = (child->auditlog_type == NOT_SET ? parent->auditlog_type : child->auditlog_type); merged->max_rule_time = (child->max_rule_time == NOT_SET ? parent->max_rule_time : child->max_rule_time); merged->auditlog_dirperms = (child->auditlog_dirperms == NOT_SET ? parent->auditlog_dirperms : child->auditlog_dirperms); merged->auditlog_fileperms = (child->auditlog_fileperms == NOT_SET ? parent->auditlog_fileperms : child->auditlog_fileperms); if (child->auditlog_fd != NOT_SET_P) { merged->auditlog_fd = child->auditlog_fd; merged->auditlog_name = child->auditlog_name; } else { merged->auditlog_fd = parent->auditlog_fd; merged->auditlog_name = parent->auditlog_name; } if (child->auditlog2_fd != NOT_SET_P) { merged->auditlog2_fd = child->auditlog2_fd; merged->auditlog2_name = child->auditlog2_name; } else { merged->auditlog2_fd = parent->auditlog2_fd; merged->auditlog2_name = parent->auditlog2_name; } merged->auditlog_storage_dir = (child->auditlog_storage_dir == NOT_SET_P ? parent->auditlog_storage_dir : child->auditlog_storage_dir); merged->auditlog_parts = (child->auditlog_parts == NOT_SET_P ? parent->auditlog_parts : child->auditlog_parts); merged->auditlog_relevant_regex = (child->auditlog_relevant_regex == NOT_SET_P ? parent->auditlog_relevant_regex : child->auditlog_relevant_regex); /* Upload */ merged->tmp_dir = (child->tmp_dir == NOT_SET_P ? parent->tmp_dir : child->tmp_dir); merged->upload_dir = (child->upload_dir == NOT_SET_P ? parent->upload_dir : child->upload_dir); merged->upload_keep_files = (child->upload_keep_files == NOT_SET ? parent->upload_keep_files : child->upload_keep_files); merged->upload_validates_files = (child->upload_validates_files == NOT_SET ? parent->upload_validates_files : child->upload_validates_files); merged->upload_filemode = (child->upload_filemode == NOT_SET ? parent->upload_filemode : child->upload_filemode); merged->upload_file_limit = (child->upload_file_limit == NOT_SET ? parent->upload_file_limit : child->upload_file_limit); /* Misc */ merged->data_dir = (child->data_dir == NOT_SET_P ? parent->data_dir : child->data_dir); merged->webappid = (child->webappid == NOT_SET_P ? parent->webappid : child->webappid); merged->sensor_id = (child->sensor_id == NOT_SET_P ? parent->sensor_id : child->sensor_id); merged->httpBlkey = (child->httpBlkey == NOT_SET_P ? parent->httpBlkey : child->httpBlkey); /* Content injection. */ merged->content_injection_enabled = (child->content_injection_enabled == NOT_SET ? parent->content_injection_enabled : child->content_injection_enabled); /* Stream inspection */ merged->stream_inbody_inspection = (child->stream_inbody_inspection == NOT_SET ? parent->stream_inbody_inspection : child->stream_inbody_inspection); merged->stream_outbody_inspection = (child->stream_outbody_inspection == NOT_SET ? parent->stream_outbody_inspection : child->stream_outbody_inspection); /* Geo Lookup */ merged->geo = (child->geo == NOT_SET_P ? parent->geo : child->geo); /* Gsb Lookup */ merged->gsb = (child->gsb == NOT_SET_P ? parent->gsb : child->gsb); /* Unicode Map */ merged->u_map = (child->u_map == NOT_SET_P ? parent->u_map : child->u_map); /* Cache */ merged->cache_trans = (child->cache_trans == NOT_SET ? parent->cache_trans : child->cache_trans); merged->cache_trans_incremental = (child->cache_trans_incremental == NOT_SET ? parent->cache_trans_incremental : child->cache_trans_incremental); merged->cache_trans_min = (child->cache_trans_min == (apr_size_t)NOT_SET ? parent->cache_trans_min : child->cache_trans_min); merged->cache_trans_max = (child->cache_trans_max == (apr_size_t)NOT_SET ? parent->cache_trans_max : child->cache_trans_max); merged->cache_trans_maxitems = (child->cache_trans_maxitems == (apr_size_t)NOT_SET ? parent->cache_trans_maxitems : child->cache_trans_maxitems); /* Merge component signatures. */ merged->component_signatures = apr_array_append(mp, parent->component_signatures, child->component_signatures); merged->request_encoding = (child->request_encoding == NOT_SET_P ? parent->request_encoding : child->request_encoding); merged->disable_backend_compression = (child->disable_backend_compression == NOT_SET ? parent->disable_backend_compression : child->disable_backend_compression); merged->col_timeout = (child->col_timeout == NOT_SET ? parent->col_timeout : child->col_timeout); /* Hash */ merged->crypto_key = (child->crypto_key == NOT_SET_P ? parent->crypto_key : child->crypto_key); merged->crypto_key_len = (child->crypto_key_len == NOT_SET ? parent->crypto_key_len : child->crypto_key_len); merged->crypto_key_add = (child->crypto_key_add == NOT_SET ? parent->crypto_key_add : child->crypto_key_add); merged->crypto_param_name = (child->crypto_param_name == NOT_SET_P ? parent->crypto_param_name : child->crypto_param_name); merged->hash_is_enabled = (child->hash_is_enabled == NOT_SET ? parent->hash_is_enabled : child->hash_is_enabled); merged->hash_enforcement = (child->hash_enforcement == NOT_SET ? parent->hash_enforcement : child->hash_enforcement); merged->crypto_hash_href_rx = (child->crypto_hash_href_rx == NOT_SET ? parent->crypto_hash_href_rx : child->crypto_hash_href_rx); merged->crypto_hash_faction_rx = (child->crypto_hash_faction_rx == NOT_SET ? parent->crypto_hash_faction_rx : child->crypto_hash_faction_rx); merged->crypto_hash_location_rx = (child->crypto_hash_location_rx == NOT_SET ? parent->crypto_hash_location_rx : child->crypto_hash_location_rx); merged->crypto_hash_iframesrc_rx = (child->crypto_hash_iframesrc_rx == NOT_SET ? parent->crypto_hash_iframesrc_rx : child->crypto_hash_iframesrc_rx); merged->crypto_hash_framesrc_rx = (child->crypto_hash_framesrc_rx == NOT_SET ? parent->crypto_hash_framesrc_rx : child->crypto_hash_framesrc_rx); merged->crypto_hash_href_pm = (child->crypto_hash_href_pm == NOT_SET ? parent->crypto_hash_href_pm : child->crypto_hash_href_pm); merged->crypto_hash_faction_pm = (child->crypto_hash_faction_pm == NOT_SET ? parent->crypto_hash_faction_pm : child->crypto_hash_faction_pm); merged->crypto_hash_location_pm = (child->crypto_hash_location_pm == NOT_SET ? parent->crypto_hash_location_pm : child->crypto_hash_location_pm); merged->crypto_hash_iframesrc_pm = (child->crypto_hash_iframesrc_pm == NOT_SET ? parent->crypto_hash_iframesrc_pm : child->crypto_hash_iframesrc_pm); merged->crypto_hash_framesrc_pm = (child->crypto_hash_framesrc_pm == NOT_SET ? parent->crypto_hash_framesrc_pm : child->crypto_hash_framesrc_pm); /* xml external entity */ merged->xml_external_entity = (child->xml_external_entity == NOT_SET ? parent->xml_external_entity : child->xml_external_entity); return merged; } /** * Initialise directory configuration. This function is *not* meant * to be called for directory configuration instances created during * the configuration phase. It can only be called on copies of those * (created fresh for every transaction). */ void init_directory_config(directory_config *dcfg) { if (dcfg == NULL) return; if (dcfg->is_enabled == NOT_SET) dcfg->is_enabled = 0; if (dcfg->reqbody_access == NOT_SET) dcfg->reqbody_access = 0; if (dcfg->reqintercept_oe == NOT_SET) dcfg->reqintercept_oe = 0; if (dcfg->reqbody_buffering == NOT_SET) dcfg->reqbody_buffering = REQUEST_BODY_FORCEBUF_OFF; if (dcfg->reqbody_inmemory_limit == NOT_SET) dcfg->reqbody_inmemory_limit = REQUEST_BODY_DEFAULT_INMEMORY_LIMIT; if (dcfg->reqbody_limit == NOT_SET) dcfg->reqbody_limit = REQUEST_BODY_DEFAULT_LIMIT; if (dcfg->reqbody_no_files_limit == NOT_SET) dcfg->reqbody_no_files_limit = REQUEST_BODY_NO_FILES_DEFAULT_LIMIT; if (dcfg->resbody_access == NOT_SET) dcfg->resbody_access = 0; if (dcfg->of_limit == NOT_SET) dcfg->of_limit = RESPONSE_BODY_DEFAULT_LIMIT; if (dcfg->if_limit_action == NOT_SET) dcfg->if_limit_action = REQUEST_BODY_LIMIT_ACTION_REJECT; if (dcfg->of_limit_action == NOT_SET) dcfg->of_limit_action = RESPONSE_BODY_LIMIT_ACTION_REJECT; if (dcfg->of_mime_types == NOT_SET_P) { dcfg->of_mime_types = apr_table_make(dcfg->mp, 3); if (dcfg->of_mime_types_cleared != 1) { apr_table_setn(dcfg->of_mime_types, "text/plain", "1"); apr_table_setn(dcfg->of_mime_types, "text/html", "1"); } } if (dcfg->debuglog_fd == NOT_SET_P) dcfg->debuglog_fd = NULL; if (dcfg->debuglog_name == NOT_SET_P) dcfg->debuglog_name = NULL; if (dcfg->debuglog_level == NOT_SET) dcfg->debuglog_level = 0; if (dcfg->cookie_format == NOT_SET) dcfg->cookie_format = 0; if (dcfg->argument_separator == NOT_SET) dcfg->argument_separator = '&'; if (dcfg->cookiev0_separator == NOT_SET_P) dcfg->cookiev0_separator = NULL; if (dcfg->rule_inheritance == NOT_SET) dcfg->rule_inheritance = 1; /* audit log variables */ if (dcfg->auditlog_flag == NOT_SET) dcfg->auditlog_flag = 0; if (dcfg->auditlog_type == NOT_SET) dcfg->auditlog_type = AUDITLOG_SERIAL; if (dcfg->max_rule_time == NOT_SET) dcfg->max_rule_time = 0; if (dcfg->auditlog_dirperms == NOT_SET) dcfg->auditlog_dirperms = CREATEMODE_DIR; if (dcfg->auditlog_fileperms == NOT_SET) dcfg->auditlog_fileperms = CREATEMODE; if (dcfg->auditlog_fd == NOT_SET_P) dcfg->auditlog_fd = NULL; if (dcfg->auditlog2_fd == NOT_SET_P) dcfg->auditlog2_fd = NULL; if (dcfg->auditlog_name == NOT_SET_P) dcfg->auditlog_name = NULL; if (dcfg->auditlog2_name == NOT_SET_P) dcfg->auditlog2_name = NULL; if (dcfg->auditlog_storage_dir == NOT_SET_P) dcfg->auditlog_storage_dir = NULL; if (dcfg->auditlog_parts == NOT_SET_P) dcfg->auditlog_parts = "ABCFHZ"; if (dcfg->auditlog_relevant_regex == NOT_SET_P) dcfg->auditlog_relevant_regex = NULL; /* Upload */ if (dcfg->tmp_dir == NOT_SET_P) dcfg->tmp_dir = guess_tmp_dir(dcfg->mp); if (dcfg->upload_dir == NOT_SET_P) dcfg->upload_dir = NULL; if (dcfg->upload_keep_files == NOT_SET) dcfg->upload_keep_files = KEEP_FILES_OFF; if (dcfg->upload_validates_files == NOT_SET) dcfg->upload_validates_files = 0; if (dcfg->upload_filemode == NOT_SET) dcfg->upload_filemode = 0600; if (dcfg->upload_file_limit == NOT_SET) dcfg->upload_file_limit = 100; /* Misc */ if (dcfg->data_dir == NOT_SET_P) dcfg->data_dir = NULL; if (dcfg->webappid == NOT_SET_P) dcfg->webappid = "default"; if (dcfg->sensor_id == NOT_SET_P) dcfg->sensor_id = "default"; if (dcfg->httpBlkey == NOT_SET_P) dcfg->httpBlkey = NULL; /* Content injection. */ if (dcfg->content_injection_enabled == NOT_SET) dcfg->content_injection_enabled = 0; /* Stream inspection */ if (dcfg->stream_inbody_inspection == NOT_SET) dcfg->stream_inbody_inspection = 0; if (dcfg->stream_outbody_inspection == NOT_SET) dcfg->stream_outbody_inspection = 0; /* Geo Lookup */ if (dcfg->geo == NOT_SET_P) dcfg->geo = NULL; /* Gsb Lookup */ if (dcfg->gsb == NOT_SET_P) dcfg->gsb = NULL; /* Unicode Map */ if (dcfg->u_map == NOT_SET_P) dcfg->u_map = NULL; /* Cache */ if (dcfg->cache_trans == NOT_SET) dcfg->cache_trans = MODSEC_CACHE_DISABLED; if (dcfg->cache_trans_incremental == NOT_SET) dcfg->cache_trans_incremental = 0; if (dcfg->cache_trans_min == (apr_size_t)NOT_SET) dcfg->cache_trans_min = 32; if (dcfg->cache_trans_max == (apr_size_t)NOT_SET) dcfg->cache_trans_max = 1024; if (dcfg->cache_trans_maxitems == (apr_size_t)NOT_SET) dcfg->cache_trans_maxitems = 512; if (dcfg->request_encoding == NOT_SET_P) dcfg->request_encoding = NULL; if (dcfg->disable_backend_compression == NOT_SET) dcfg->disable_backend_compression = 0; if (dcfg->col_timeout == NOT_SET) dcfg->col_timeout = 3600; /* Hash */ if (dcfg->crypto_key == NOT_SET_P) dcfg->crypto_key = getkey(dcfg->mp); if (dcfg->crypto_key_len == NOT_SET) dcfg->crypto_key_len = strlen(dcfg->crypto_key); if (dcfg->crypto_key_add == NOT_SET) dcfg->crypto_key_add = HASH_KEYONLY; if (dcfg->crypto_param_name == NOT_SET_P) dcfg->crypto_param_name = "crypt"; if (dcfg->hash_is_enabled == NOT_SET) dcfg->hash_is_enabled = HASH_DISABLED; if (dcfg->hash_enforcement == NOT_SET) dcfg->hash_enforcement = HASH_DISABLED; if (dcfg->crypto_hash_href_rx == NOT_SET) dcfg->crypto_hash_href_rx = 0; if (dcfg->crypto_hash_faction_rx == NOT_SET) dcfg->crypto_hash_faction_rx = 0; if (dcfg->crypto_hash_location_rx == NOT_SET) dcfg->crypto_hash_location_rx = 0; if (dcfg->crypto_hash_iframesrc_rx == NOT_SET) dcfg->crypto_hash_iframesrc_rx = 0; if (dcfg->crypto_hash_framesrc_rx == NOT_SET) dcfg->crypto_hash_framesrc_rx = 0; if (dcfg->crypto_hash_href_pm == NOT_SET) dcfg->crypto_hash_href_pm = 0; if (dcfg->crypto_hash_faction_pm == NOT_SET) dcfg->crypto_hash_faction_pm = 0; if (dcfg->crypto_hash_location_pm == NOT_SET) dcfg->crypto_hash_location_pm = 0; if (dcfg->crypto_hash_iframesrc_pm == NOT_SET) dcfg->crypto_hash_iframesrc_pm = 0; if (dcfg->crypto_hash_framesrc_pm == NOT_SET) dcfg->crypto_hash_framesrc_pm = 0; /* xml external entity */ if (dcfg->xml_external_entity == NOT_SET) dcfg->xml_external_entity = 0; } /** * */ static const char *add_rule(cmd_parms *cmd, directory_config *dcfg, int type, const char *p1, const char *p2, const char *p3) { char *my_error_msg = NULL; //msre_rule *rule = NULL, *tmp_rule = NULL; char *rid = NULL; msre_rule *rule = NULL; extern msc_engine *modsecurity; int offset = 0; #ifdef DEBUG_CONF ap_log_perror(APLOG_MARK, APLOG_STARTUP|APLOG_NOERRNO, 0, cmd->pool, "Rule: type=%d p1='%s' p2='%s' p3='%s'", type, p1, p2, p3); #endif /* Create a ruleset if one does not exist. */ if ((dcfg->ruleset == NULL)||(dcfg->ruleset == NOT_SET_P)) { dcfg->ruleset = msre_ruleset_create(modsecurity->msre, cmd->pool); if (dcfg->ruleset == NULL) return FATAL_ERROR; } /* Create the rule now. */ switch(type) { #if defined(WITH_LUA) case RULE_TYPE_LUA : rule = msre_rule_lua_create(dcfg->ruleset, cmd->directive->filename, cmd->directive->line_num, p1, p2, &my_error_msg); break; #endif default : rule = msre_rule_create(dcfg->ruleset, type, cmd->directive->filename, cmd->directive->line_num, p1, p2, p3, &my_error_msg); break; } if (rule == NULL) { return my_error_msg; } /* Rules must have uniq ID */ if ( #if defined(WITH_LUA) type != RULE_TYPE_LUA && #endif (dcfg->tmp_chain_starter == NULL)) if(rule->actionset == NULL) return "ModSecurity: Rules must have at least id action"; if(rule->actionset != NULL && (dcfg->tmp_chain_starter == NULL)) { if(rule->actionset->id == NOT_SET_P #if defined(WITH_LUA) && (type != RULE_TYPE_LUA) #endif ) return "ModSecurity: No action id present within the rule"; #if defined(WITH_LUA) if(type != RULE_TYPE_LUA) #endif { rid = apr_hash_get(dcfg->rule_id_htab, rule->actionset->id, APR_HASH_KEY_STRING); if(rid != NULL) { return "ModSecurity: Found another rule with the same id"; } else { apr_hash_set(dcfg->rule_id_htab, apr_pstrdup(dcfg->mp, rule->actionset->id), APR_HASH_KEY_STRING, apr_pstrdup(dcfg->mp, "1")); } //tmp_rule = msre_ruleset_fetch_rule(dcfg->ruleset, rule->actionset->id, offset); //if(tmp_rule != NULL) // return "ModSecurity: Found another rule with the same id"; } } /* Create default actionset if one does not already exist. */ if (dcfg->tmp_default_actionset == NULL) { dcfg->tmp_default_actionset = msre_actionset_create_default(modsecurity->msre); if (dcfg->tmp_default_actionset == NULL) return FATAL_ERROR; } /* Check some cases prior to merging so we know where it came from */ /* Check syntax for chained rules */ if ((rule->actionset != NULL) && (dcfg->tmp_chain_starter != NULL)) { /* Must NOT specify a disruptive action. */ if (rule->actionset->intercept_action != NOT_SET) { return apr_psprintf(cmd->pool, "ModSecurity: Disruptive actions can only " "be specified by chain starter rules."); } /* Must NOT specify a skipafter action. */ if (rule->actionset->skip_after != NOT_SET_P) { return apr_psprintf(cmd->pool, "ModSecurity: SkipAfter actions can only " "be specified by chain starter rules."); } /* Must NOT specify a phase. */ if (rule->actionset->phase != NOT_SET) { return apr_psprintf(cmd->pool, "ModSecurity: Execution phases can only be " "specified by chain starter rules."); } /* Must NOT use metadata actions. */ /* ENH: loop through to check for tags */ if ((rule->actionset->id != NOT_SET_P) ||(rule->actionset->rev != NOT_SET_P) ||(rule->actionset->msg != NOT_SET_P) ||(rule->actionset->severity != NOT_SET) ||(rule->actionset->version != NOT_SET_P) ||(rule->actionset->accuracy != NOT_SET) ||(rule->actionset->maturity != NOT_SET) ||(rule->actionset->logdata != NOT_SET_P)) { return apr_psprintf(cmd->pool, "ModSecurity: Metadata actions (id, rev, msg, tag, severity, ver, accuracy, maturity, logdata) " " can only be specified by chain starter rules."); } /* Must NOT use skip. */ if (rule->actionset->skip_count != NOT_SET) { return apr_psprintf(cmd->pool, "ModSecurity: The skip action can only be used " " by chain starter rules. "); } } /* Merge actions with the parent. * * ENH Probably do not want this done fully for chained rules. */ rule->actionset = msre_actionset_merge(modsecurity->msre, dcfg->tmp_default_actionset, rule->actionset, 1); /* Keep track of the parent action for "block" */ rule->actionset->parent_intercept_action_rec = dcfg->tmp_default_actionset->intercept_action_rec; rule->actionset->parent_intercept_action = dcfg->tmp_default_actionset->intercept_action; /* Must NOT specify a disruptive action in logging phase. */ if ((rule->actionset != NULL) && (rule->actionset->phase == PHASE_LOGGING) && (rule->actionset->intercept_action != ACTION_ALLOW) && (rule->actionset->intercept_action != ACTION_ALLOW_REQUEST) && (rule->actionset->intercept_action != ACTION_NONE) ) { return apr_psprintf(cmd->pool, "ModSecurity: Disruptive actions " "cannot be specified in the logging phase."); } if (dcfg->tmp_chain_starter != NULL) { rule->chain_starter = dcfg->tmp_chain_starter; rule->actionset->phase = rule->chain_starter->actionset->phase; } if (rule->actionset->is_chained != 1) { /* If this rule is part of the chain but does * not want more rules to follow in the chain * then cut it (the chain). */ dcfg->tmp_chain_starter = NULL; } else { /* On the other hand, if this rule wants other * rules to follow it, then start a new chain * if there isn't one already. */ if (dcfg->tmp_chain_starter == NULL) { dcfg->tmp_chain_starter = rule; } } /* Optimisation */ if ((rule->op_name != NULL)&&(strcasecmp(rule->op_name, "inspectFile") == 0)) { dcfg->upload_validates_files = 1; } /* Create skip table if one does not already exist. */ if (dcfg->tmp_rule_placeholders == NULL) { dcfg->tmp_rule_placeholders = apr_table_make(cmd->pool, 10); if (dcfg->tmp_rule_placeholders == NULL) return FATAL_ERROR; } /* Keep track of any rule IDs we need to skip after */ if (rule->actionset->skip_after != NOT_SET_P) { char *tmp_id = apr_pstrdup(cmd->pool, rule->actionset->skip_after); apr_table_setn(dcfg->tmp_rule_placeholders, tmp_id, tmp_id); #ifdef DEBUG_CONF ap_log_perror(APLOG_MARK, APLOG_STARTUP|APLOG_NOERRNO, 0, cmd->pool, "Watching for skipafter target rule id=\"%s\".", tmp_id); #endif } #ifdef DEBUG_CONF ap_log_perror(APLOG_MARK, APLOG_STARTUP|APLOG_NOERRNO, 0, cmd->pool, "Adding rule %pp phase=%d id=\"%s\".", rule, rule->actionset->phase, (rule->actionset->id == NOT_SET_P ? "(none)" : rule->actionset->id)); #endif /* Add rule to the recipe. */ if (msre_ruleset_rule_add(dcfg->ruleset, rule, rule->actionset->phase) < 0) { return "Internal Error: Failed to add rule to the ruleset."; } /* Add an additional placeholder if this rule ID is on the list */ if ((rule->actionset->id != NULL) && apr_table_get(dcfg->tmp_rule_placeholders, rule->actionset->id)) { msre_rule *phrule = apr_palloc(rule->ruleset->mp, sizeof(msre_rule)); if (phrule == NULL) { return FATAL_ERROR; } #ifdef DEBUG_CONF ap_log_perror(APLOG_MARK, APLOG_STARTUP|APLOG_NOERRNO, 0, cmd->pool, "Adding placeholder %pp for rule %pp id=\"%s\".", phrule, rule, rule->actionset->id); #endif /* shallow copy of original rule with placeholder marked as target */ memcpy(phrule, rule, sizeof(msre_rule)); phrule->placeholder = RULE_PH_SKIPAFTER; /* Add placeholder. */ if (msre_ruleset_rule_add(dcfg->ruleset, phrule, phrule->actionset->phase) < 0) { return "Internal Error: Failed to add placeholder to the ruleset."; } /* No longer need to search for the ID */ apr_table_unset(dcfg->tmp_rule_placeholders, rule->actionset->id); } /* Update the unparsed rule */ rule->unparsed = msre_rule_generate_unparsed(dcfg->ruleset->mp, rule, NULL, NULL, NULL); return NULL; } /** * */ static const char *add_marker(cmd_parms *cmd, directory_config *dcfg, const char *p1, const char *p2, const char *p3) { char *my_error_msg = NULL; msre_rule *rule = NULL; extern msc_engine *modsecurity; int p; #ifdef DEBUG_CONF ap_log_perror(APLOG_MARK, APLOG_STARTUP|APLOG_NOERRNO, 0, cmd->pool, "Rule: type=%d p1='%s' p2='%s' p3='%s'", RULE_TYPE_MARKER, p1, p2, p3); #endif /* Create a ruleset if one does not exist. */ if ((dcfg->ruleset == NULL)||(dcfg->ruleset == NOT_SET_P)) { dcfg->ruleset = msre_ruleset_create(modsecurity->msre, cmd->pool); if (dcfg->ruleset == NULL) return FATAL_ERROR; } /* Create the rule now. */ rule = msre_rule_create(dcfg->ruleset, RULE_TYPE_MARKER, cmd->directive->filename, cmd->directive->line_num, p1, p2, p3, &my_error_msg); if (rule == NULL) { return my_error_msg; } /* This is a marker */ rule->placeholder = RULE_PH_MARKER; /* Add placeholder to each phase */ for (p = PHASE_FIRST; p <= PHASE_LAST; p++) { #ifdef DEBUG_CONF ap_log_perror(APLOG_MARK, APLOG_STARTUP|APLOG_NOERRNO, 0, cmd->pool, "Adding marker %pp phase=%d id=\"%s\".", rule, p, (rule->actionset->id == NOT_SET_P ? "(none)" : rule->actionset->id)); #endif if (msre_ruleset_rule_add(dcfg->ruleset, rule, p) < 0) { return "Internal Error: Failed to add marker to the ruleset."; } } /* No longer need to search for the ID */ if (dcfg->tmp_rule_placeholders != NULL) { apr_table_unset(dcfg->tmp_rule_placeholders, rule->actionset->id); } return NULL; } /** * */ static const char *update_rule_action(cmd_parms *cmd, directory_config *dcfg, const char *p1, const char *p2, int offset) { char *my_error_msg = NULL; msre_rule *rule = NULL; msre_actionset *new_actionset = NULL; msre_ruleset *ruleset = dcfg->ruleset; extern msc_engine *modsecurity; /* Get the ruleset if one exists */ if ((ruleset == NULL)||(ruleset == NOT_SET_P)) { return NULL; } #ifdef DEBUG_CONF ap_log_perror(APLOG_MARK, APLOG_STARTUP|APLOG_NOERRNO, 0, cmd->pool, "Update rule id=\"%s\" with action \"%s\".", p1, p2); #endif /* Fetch the rule */ rule = msre_ruleset_fetch_rule(ruleset, p1, offset); if (rule == NULL) { #ifdef DEBUG_CONF ap_log_perror(APLOG_MARK, APLOG_STARTUP|APLOG_NOERRNO, 0, cmd->pool, "Update rule id=\"%s\" with action \"%s\" failed: Rule not found.", p1, p2); #endif return NULL; } /* Check the rule actionset */ /* ENH: Can this happen? */ if (rule->actionset == NULL) { return apr_psprintf(cmd->pool, "ModSecurity: Attempt to update action for rule \"%s\" failed: Rule does not have an actionset.", p1); } /* Create a new actionset */ new_actionset = msre_actionset_create(modsecurity->msre, p2, &my_error_msg); if (new_actionset == NULL) return FATAL_ERROR; if (my_error_msg != NULL) return my_error_msg; /* Must NOT change an id */ if ((new_actionset->id != NOT_SET_P) && (rule->actionset->id != NULL) && (strcmp(rule->actionset->id, new_actionset->id) != 0)) { return apr_psprintf(cmd->pool, "ModSecurity: Rule IDs cannot be updated via SecRuleUpdateActionById."); } /* Must NOT alter the phase */ if ((new_actionset->phase != NOT_SET) && (rule->actionset->phase != new_actionset->phase)) { return apr_psprintf(cmd->pool, "ModSecurity: Rule phases cannot be updated via SecRuleUpdateActionById."); } #ifdef DEBUG_CONF { char *actions = msre_actionset_generate_action_string(ruleset->mp, rule->actionset); ap_log_perror(APLOG_MARK, APLOG_STARTUP|APLOG_NOERRNO, 0, cmd->pool, "Update rule %pp id=\"%s\" old action: \"%s\"", rule, (rule->actionset->id == NOT_SET_P ? "(none)" : rule->actionset->id), actions); } #endif /* Merge new actions with the rule */ /* ENH: Will this leak the old actionset? */ rule->actionset = msre_actionset_merge(modsecurity->msre, rule->actionset, new_actionset, 1); msre_actionset_set_defaults(rule->actionset); /* Update the unparsed rule */ rule->unparsed = msre_rule_generate_unparsed(ruleset->mp, rule, NULL, NULL, NULL); #ifdef DEBUG_CONF { char *actions = msre_actionset_generate_action_string(ruleset->mp, rule->actionset); ap_log_perror(APLOG_MARK, APLOG_STARTUP|APLOG_NOERRNO, 0, cmd->pool, "Update rule %pp id=\"%s\" new action: \"%s\"", rule, (rule->actionset->id == NOT_SET_P ? "(none)" : rule->actionset->id), actions); } #endif return NULL; } /* -- Configuration directives -- */ static const char *cmd_action(cmd_parms *cmd, void *_dcfg, const char *p1) { return add_rule(cmd, (directory_config *)_dcfg, RULE_TYPE_ACTION, SECACTION_TARGETS, SECACTION_ARGS, p1); } static const char *cmd_marker(cmd_parms *cmd, void *_dcfg, const char *p1) { directory_config *dcfg = (directory_config *)_dcfg; const char *action = apr_pstrcat(dcfg->mp, SECMARKER_BASE_ACTIONS, p1, NULL); return add_marker(cmd, (directory_config *)_dcfg, SECMARKER_TARGETS, SECMARKER_ARGS, action); } static const char *cmd_cookiev0_separator(cmd_parms *cmd, void *_dcfg, const char *p1) { directory_config *dcfg = (directory_config *)_dcfg; if (strlen(p1) != 1) { return apr_psprintf(cmd->pool, "ModSecurity: Invalid cookie v0 separator: %s", p1); } dcfg->cookiev0_separator = p1; return NULL; } static const char *cmd_argument_separator(cmd_parms *cmd, void *_dcfg, const char *p1) { directory_config *dcfg = (directory_config *)_dcfg; if (strlen(p1) != 1) { return apr_psprintf(cmd->pool, "ModSecurity: Invalid argument separator: %s", p1); } dcfg->argument_separator = p1[0]; return NULL; } static const char *cmd_audit_engine(cmd_parms *cmd, void *_dcfg, const char *p1) { directory_config *dcfg = _dcfg; if (strcasecmp(p1, "On") == 0) dcfg->auditlog_flag = AUDITLOG_ON; else if (strcasecmp(p1, "Off") == 0) dcfg->auditlog_flag = AUDITLOG_OFF; else if (strcasecmp(p1, "RelevantOnly") == 0) dcfg->auditlog_flag = AUDITLOG_RELEVANT; else return (const char *)apr_psprintf(cmd->pool, "ModSecurity: Unrecognised parameter value for SecAuditEngine: %s", p1); return NULL; } static const char *cmd_audit_log(cmd_parms *cmd, void *_dcfg, const char *p1) { directory_config *dcfg = _dcfg; dcfg->auditlog_name = (char *)p1; if (dcfg->auditlog_name[0] == '|') { const char *pipe_name = dcfg->auditlog_name + 1; piped_log *pipe_log; pipe_log = ap_open_piped_log(cmd->pool, pipe_name); if (pipe_log == NULL) { return apr_psprintf(cmd->pool, "ModSecurity: Failed to open the audit log pipe: %s", pipe_name); } dcfg->auditlog_fd = ap_piped_log_write_fd(pipe_log); } else { const char *file_name = ap_server_root_relative(cmd->pool, dcfg->auditlog_name); apr_status_t rc; rc = apr_file_open(&dcfg->auditlog_fd, file_name, APR_WRITE | APR_APPEND | APR_CREATE | APR_BINARY, CREATEMODE, cmd->pool); if (rc != APR_SUCCESS) { return apr_psprintf(cmd->pool, "ModSecurity: Failed to open the audit log file: %s", file_name); } } return NULL; } static const char *cmd_audit_log2(cmd_parms *cmd, void *_dcfg, const char *p1) { directory_config *dcfg = _dcfg; if (dcfg->auditlog_name == NOT_SET_P) { return apr_psprintf(cmd->pool, "ModSecurity: Cannot configure a secondary audit log without a primary defined: %s", p1); } dcfg->auditlog2_name = (char *)p1; if (dcfg->auditlog2_name[0] == '|') { const char *pipe_name = ap_server_root_relative(cmd->pool, dcfg->auditlog2_name + 1); piped_log *pipe_log; pipe_log = ap_open_piped_log(cmd->pool, pipe_name); if (pipe_log == NULL) { return apr_psprintf(cmd->pool, "ModSecurity: Failed to open the secondary audit log pipe: %s", pipe_name); } dcfg->auditlog2_fd = ap_piped_log_write_fd(pipe_log); } else { const char *file_name = ap_server_root_relative(cmd->pool, dcfg->auditlog2_name); apr_status_t rc; rc = apr_file_open(&dcfg->auditlog2_fd, file_name, APR_WRITE | APR_APPEND | APR_CREATE | APR_BINARY, CREATEMODE, cmd->pool); if (rc != APR_SUCCESS) { return apr_psprintf(cmd->pool, "ModSecurity: Failed to open the secondary audit log file: %s", file_name); } } return NULL; } static const char *cmd_audit_log_parts(cmd_parms *cmd, void *_dcfg, const char *p1) { directory_config *dcfg = _dcfg; if (is_valid_parts_specification((char *)p1) != 1) { return apr_psprintf(cmd->pool, "Invalid parts specification for SecAuditLogParts: %s", p1); } dcfg->auditlog_parts = (char *)p1; return NULL; } static const char *cmd_audit_log_relevant_status(cmd_parms *cmd, void *_dcfg, const char *p1) { directory_config *dcfg = _dcfg; dcfg->auditlog_relevant_regex = msc_pregcomp(cmd->pool, p1, PCRE_DOTALL, NULL, NULL); if (dcfg->auditlog_relevant_regex == NULL) { return apr_psprintf(cmd->pool, "ModSecurity: Invalid regular expression: %s", p1); } return NULL; } static const char *cmd_audit_log_type(cmd_parms *cmd, void *_dcfg, const char *p1) { directory_config *dcfg = _dcfg; if (strcasecmp(p1, "Serial") == 0) dcfg->auditlog_type = AUDITLOG_SERIAL; else if (strcasecmp(p1, "Concurrent") == 0) dcfg->auditlog_type = AUDITLOG_CONCURRENT; else return (const char *)apr_psprintf(cmd->pool, "ModSecurity: Unrecognised parameter value for SecAuditLogType: %s", p1); return NULL; } static const char *cmd_audit_log_dirmode(cmd_parms *cmd, void *_dcfg, const char *p1) { directory_config *dcfg = (directory_config *)_dcfg; if (dcfg == NULL) return NULL; if (strcasecmp(p1, "default") == 0) { dcfg->auditlog_dirperms = NOT_SET; } else { long int mode = strtol(p1, NULL, 8); /* expects octal mode */ if ((mode == LONG_MAX)||(mode == LONG_MIN)||(mode <= 0)||(mode > 07777)) { return apr_psprintf(cmd->pool, "ModSecurity: Invalid value for SecAuditLogDirMode: %s", p1); } dcfg->auditlog_dirperms = mode2fileperms(mode); } return NULL; } static const char *cmd_audit_log_filemode(cmd_parms *cmd, void *_dcfg, const char *p1) { directory_config *dcfg = (directory_config *)_dcfg; if (dcfg == NULL) return NULL; if (strcasecmp(p1, "default") == 0) { dcfg->auditlog_fileperms = NOT_SET; } else { long int mode = strtol(p1, NULL, 8); /* expects octal mode */ if ((mode == LONG_MAX)||(mode == LONG_MIN)||(mode <= 0)||(mode > 07777)) { return apr_psprintf(cmd->pool, "ModSecurity: Invalid value for SecAuditLogFileMode: %s", p1); } dcfg->auditlog_fileperms = mode2fileperms(mode); } return NULL; } static const char *cmd_audit_log_storage_dir(cmd_parms *cmd, void *_dcfg, const char *p1) { directory_config *dcfg = _dcfg; dcfg->auditlog_storage_dir = ap_server_root_relative(cmd->pool, p1); return NULL; } static const char *cmd_cookie_format(cmd_parms *cmd, void *_dcfg, const char *p1) { directory_config *dcfg = (directory_config *)_dcfg; if (strcmp(p1, "0") == 0) dcfg->cookie_format = COOKIES_V0; else if (strcmp(p1, "1") == 0) dcfg->cookie_format = COOKIES_V1; else { return apr_psprintf(cmd->pool, "ModSecurity: Invalid cookie format: %s", p1); } return NULL; } static const char *cmd_chroot_dir(cmd_parms *cmd, void *_dcfg, const char *p1) { char cwd[1025] = ""; if (cmd->server->is_virtual) { return "ModSecurity: SecChrootDir not allowed in VirtualHost"; } chroot_dir = (char *)p1; if (getcwd(cwd, 1024) == NULL) { return "ModSecurity: Failed to get the current working directory"; } if (chdir(chroot_dir) < 0) { return apr_psprintf(cmd->pool, "ModSecurity: Failed to chdir to %s, errno=%d (%s)", chroot_dir, errno, strerror(errno)); } if (chdir(cwd) < 0) { return apr_psprintf(cmd->pool, "ModSecurity: Failed to chdir to %s, errno=%d (%s)", cwd, errno, strerror(errno)); } return NULL; } /** * Adds component signature to the list of signatures kept in configuration. */ static const char *cmd_component_signature(cmd_parms *cmd, void *_dcfg, const char *p1) { directory_config *dcfg = (directory_config *)_dcfg; /* ENH Enforce "Name/VersionX.Y.Z (comment)" format. */ *(char **)apr_array_push(dcfg->component_signatures) = (char *)p1; return NULL; } static const char *cmd_content_injection(cmd_parms *cmd, void *_dcfg, int flag) { directory_config *dcfg = (directory_config *)_dcfg; if (dcfg == NULL) return NULL; dcfg->content_injection_enabled = flag; return NULL; } static const char *cmd_data_dir(cmd_parms *cmd, void *_dcfg, const char *p1) { directory_config *dcfg = (directory_config *)_dcfg; if (cmd->server->is_virtual) { return "ModSecurity: SecDataDir not allowed in VirtualHost."; } dcfg->data_dir = ap_server_root_relative(cmd->pool, p1); return NULL; } static const char *cmd_debug_log(cmd_parms *cmd, void *_dcfg, const char *p1) { directory_config *dcfg = (directory_config *)_dcfg; apr_status_t rc; dcfg->debuglog_name = ap_server_root_relative(cmd->pool, p1); rc = apr_file_open(&dcfg->debuglog_fd, dcfg->debuglog_name, APR_WRITE | APR_APPEND | APR_CREATE | APR_BINARY, CREATEMODE, cmd->pool); if (rc != APR_SUCCESS) { return apr_psprintf(cmd->pool, "ModSecurity: Failed to open debug log file: %s", dcfg->debuglog_name); } return NULL; } /** * \brief Add SecCollectionTimeout configuration option * * \param cmd Pointer to configuration data * \param _dcfg Pointer to directory configuration * \param p1 Pointer to configuration option * * \retval NULL On failure * \retval apr_psprintf On Success */ static const char *cmd_collection_timeout(cmd_parms *cmd, void *_dcfg, const char *p1) { directory_config *dcfg = (directory_config *)_dcfg; dcfg->col_timeout = atoi(p1); /* max 30 days */ if ((dcfg->col_timeout >= 0)&&(dcfg->col_timeout <= 2592000)) return NULL; return apr_psprintf(cmd->pool, "ModSecurity: Invalid value for SecCollectionTimeout: %s", p1); } static const char *cmd_debug_log_level(cmd_parms *cmd, void *_dcfg, const char *p1) { directory_config *dcfg = (directory_config *)_dcfg; dcfg->debuglog_level = atoi(p1); if ((dcfg->debuglog_level >= 0)&&(dcfg->debuglog_level <= 9)) return NULL; return apr_psprintf(cmd->pool, "ModSecurity: Invalid value for SecDebugLogLevel: %s", p1); } static const char *cmd_default_action(cmd_parms *cmd, void *_dcfg, const char *p1) { directory_config *dcfg = (directory_config *)_dcfg; extern msc_engine *modsecurity; char *my_error_msg = NULL; dcfg->tmp_default_actionset = msre_actionset_create(modsecurity->msre, p1, &my_error_msg); if (dcfg->tmp_default_actionset == NULL) { if (my_error_msg != NULL) return my_error_msg; else return FATAL_ERROR; } /* Must specify a disruptive action. */ /* ENH: Remove this requirement? */ if (dcfg->tmp_default_actionset->intercept_action == NOT_SET) { return apr_psprintf(cmd->pool, "ModSecurity: SecDefaultAction must specify a disruptive action."); } /* Must specify a phase. */ /* ENH: Remove this requirement? */ if (dcfg->tmp_default_actionset->phase == NOT_SET) { return apr_psprintf(cmd->pool, "ModSecurity: SecDefaultAction must specify a phase."); } /* Must not use metadata actions. */ /* ENH: loop through to check for tags */ if ((dcfg->tmp_default_actionset->id != NOT_SET_P) ||(dcfg->tmp_default_actionset->rev != NOT_SET_P) ||(dcfg->tmp_default_actionset->version != NOT_SET_P) ||(dcfg->tmp_default_actionset->maturity != NOT_SET) ||(dcfg->tmp_default_actionset->accuracy != NOT_SET) ||(dcfg->tmp_default_actionset->msg != NOT_SET_P)) { return apr_psprintf(cmd->pool, "ModSecurity: SecDefaultAction must not " "contain any metadata actions (id, rev, msg, tag, severity, ver, accuracy, maturity, logdata)."); } /* These are just a warning for now. */ if ((dcfg->tmp_default_actionset->severity != NOT_SET) ||(dcfg->tmp_default_actionset->logdata != NOT_SET_P)) { ap_log_perror(APLOG_MARK, APLOG_STARTUP|APLOG_WARNING|APLOG_NOERRNO, 0, cmd->pool, "ModSecurity: WARNING Using \"severity\" or \"logdata\" in " "SecDefaultAction is deprecated (%s:%d).", cmd->directive->filename, cmd->directive->line_num); } if (apr_table_get(dcfg->tmp_default_actionset->actions, "t")) { ap_log_perror(APLOG_MARK, APLOG_STARTUP|APLOG_WARNING|APLOG_NOERRNO, 0, cmd->pool, "ModSecurity: WARNING Using transformations in " "SecDefaultAction is deprecated (%s:%d).", cmd->directive->filename, cmd->directive->line_num); } /* Must not use chain. */ if (dcfg->tmp_default_actionset->is_chained != NOT_SET) { return apr_psprintf(cmd->pool, "ModSecurity: SecDefaultAction must not " "contain a chain action."); } /* Must not use skip. */ if (dcfg->tmp_default_actionset->skip_count != NOT_SET) { return apr_psprintf(cmd->pool, "ModSecurity: SecDefaultAction must not " "contain a skip action."); } /* Must not use skipAfter. */ if (dcfg->tmp_default_actionset->skip_after != NOT_SET_P) { return apr_psprintf(cmd->pool, "ModSecurity: SecDefaultAction must not " "contain a skipAfter action."); } return NULL; } static const char *cmd_disable_backend_compression(cmd_parms *cmd, void *_dcfg, int flag) { directory_config *dcfg = (directory_config *)_dcfg; if (dcfg == NULL) return NULL; dcfg->disable_backend_compression = flag; return NULL; } static const char *cmd_guardian_log(cmd_parms *cmd, void *_dcfg, const char *p1, const char *p2) { extern char *guardianlog_name; extern apr_file_t *guardianlog_fd; extern char *guardianlog_condition; if (cmd->server->is_virtual) { return "ModSecurity: SecGuardianLog not allowed in VirtualHost"; } if (p2 != NULL) { if (strncmp(p2, "env=", 4) != 0) { return "ModSecurity: Error in condition clause"; } if ( (p2[4] == '\0') || ((p2[4] == '!')&&(p2[5] == '\0')) ) { return "ModSecurity: Missing variable name"; } guardianlog_condition = apr_pstrdup(cmd->pool, p2 + 4); } guardianlog_name = (char *)p1; if (guardianlog_name[0] == '|') { const char *pipe_name = ap_server_root_relative(cmd->pool, guardianlog_name + 1); piped_log *pipe_log; pipe_log = ap_open_piped_log(cmd->pool, pipe_name); if (pipe_log == NULL) { return apr_psprintf(cmd->pool, "ModSecurity: Failed to open the guardian log pipe: %s", pipe_name); } guardianlog_fd = ap_piped_log_write_fd(pipe_log); } else { const char *file_name = ap_server_root_relative(cmd->pool, guardianlog_name); apr_status_t rc; rc = apr_file_open(&guardianlog_fd, file_name, APR_WRITE | APR_APPEND | APR_CREATE | APR_BINARY, CREATEMODE, cmd->pool); if (rc != APR_SUCCESS) { return apr_psprintf(cmd->pool, "ModSecurity: Failed to open the guardian log file: %s", file_name); } } return NULL; } /** * \brief Add SecStreamInBodyInspection configuration option * * \param cmd Pointer to configuration data * \param _dcfg Pointer to directory configuration * \param p1 Pointer to configuration option * * \retval NULL On failure * \retval apr_psprintf On Success */ static const char *cmd_stream_inbody_inspection(cmd_parms *cmd, void *_dcfg, int flag) { directory_config *dcfg = (directory_config *)_dcfg; if (dcfg == NULL) return NULL; dcfg->stream_inbody_inspection = flag; return NULL; } /** * \brief Add SecStreamOutBodyInspection configuration option * * \param cmd Pointer to configuration data * \param _dcfg Pointer to directory configuration * \param p1 Pointer to configuration option * * \retval NULL On failure * \retval apr_psprintf On Success */ static const char *cmd_stream_outbody_inspection(cmd_parms *cmd, void *_dcfg, int flag) { directory_config *dcfg = (directory_config *)_dcfg; if (dcfg == NULL) return NULL; dcfg->stream_outbody_inspection = flag; return NULL; } /** * \brief Add SecRulePerfTime configuration option * * \param cmd Pointer to configuration data * \param _dcfg Pointer to directory configuration * \param p1 Pointer to configuration option * * \retval NULL On failure * \retval apr_psprintf On Success */ static const char *cmd_rule_perf_time(cmd_parms *cmd, void *_dcfg, const char *p1) { directory_config *dcfg = (directory_config *)_dcfg; long int limit; if (dcfg == NULL) return NULL; limit = strtol(p1, NULL, 10); if ((limit == LONG_MAX)||(limit == LONG_MIN)||(limit <= 0)) { return apr_psprintf(cmd->pool, "ModSecurity: Invalid value for SecRulePerfTime: %s", p1); } dcfg->max_rule_time = limit; return NULL; } /** * \brief Add SecReadStateLimit configuration option * * \param cmd Pointer to configuration data * \param _dcfg Pointer to directory configuration * \param p1 Pointer to configuration option * * \retval NULL On failure * \retval apr_psprintf On Success */ static const char *cmd_conn_read_state_limit(cmd_parms *cmd, void *_dcfg, const char *p1) { directory_config *dcfg = (directory_config *)_dcfg; long int limit; if (dcfg == NULL) return NULL; limit = strtol(p1, NULL, 10); if ((limit == LONG_MAX)||(limit == LONG_MIN)||(limit <= 0)) { return apr_psprintf(cmd->pool, "ModSecurity: Invalid value for SecReadStateLimit: %s", p1); } conn_read_state_limit = limit; return NULL; } /** * \brief Add SecWriteStateLimit configuration option * * \param cmd Pointer to configuration data * \param _dcfg Pointer to directory configuration * \param p1 Pointer to configuration option * * \retval NULL On failure * \retval apr_psprintf On Success */ static const char *cmd_conn_write_state_limit(cmd_parms *cmd, void *_dcfg, const char *p1) { directory_config *dcfg = (directory_config *)_dcfg; long int limit; if (dcfg == NULL) return NULL; limit = strtol(p1, NULL, 10); if ((limit == LONG_MAX)||(limit == LONG_MIN)||(limit <= 0)) { return apr_psprintf(cmd->pool, "ModSecurity: Invalid value for SecWriteStateLimit: %s", p1); } conn_write_state_limit = limit; return NULL; } static const char *cmd_request_body_inmemory_limit(cmd_parms *cmd, void *_dcfg, const char *p1) { directory_config *dcfg = (directory_config *)_dcfg; long int limit; if (dcfg == NULL) return NULL; limit = strtol(p1, NULL, 10); if ((limit == LONG_MAX)||(limit == LONG_MIN)||(limit <= 0)) { return apr_psprintf(cmd->pool, "ModSecurity: Invalid value for SecRequestBodyInMemoryLimit: %s", p1); } dcfg->reqbody_inmemory_limit = limit; return NULL; } static const char *cmd_request_body_limit(cmd_parms *cmd, void *_dcfg, const char *p1) { directory_config *dcfg = (directory_config *)_dcfg; long int limit; if (dcfg == NULL) return NULL; limit = strtol(p1, NULL, 10); if ((limit == LONG_MAX)||(limit == LONG_MIN)||(limit <= 0)) { return apr_psprintf(cmd->pool, "ModSecurity: Invalid value for SecRequestBodyLimit: %s", p1); } dcfg->reqbody_limit = limit; return NULL; } static const char *cmd_request_body_no_files_limit(cmd_parms *cmd, void *_dcfg, const char *p1) { directory_config *dcfg = (directory_config *)_dcfg; long int limit; if (dcfg == NULL) return NULL; limit = strtol(p1, NULL, 10); if ((limit == LONG_MAX)||(limit == LONG_MIN)||(limit <= 0)) { return apr_psprintf(cmd->pool, "ModSecurity: Invalid value for SecRequestBodyNoFilesLimit: %s", p1); } dcfg->reqbody_no_files_limit = limit; return NULL; } static const char *cmd_request_body_access(cmd_parms *cmd, void *_dcfg, const char *p1) { directory_config *dcfg = (directory_config *)_dcfg; if (dcfg == NULL) return NULL; if (strcasecmp(p1, "on") == 0) dcfg->reqbody_access = 1; else if (strcasecmp(p1, "off") == 0) dcfg->reqbody_access = 0; else return apr_psprintf(cmd->pool, "ModSecurity: Invalid value for SecRequestBodyAccess: %s", p1); return NULL; } /** * \brief Add SecInterceptOnError configuration option * * \param cmd Pointer to configuration data * \param _dcfg Pointer to directory configuration * \param p1 Pointer to configuration option * * \retval NULL On failure * \retval apr_psprintf On success */ static const char *cmd_request_intercept_on_error(cmd_parms *cmd, void *_dcfg, const char *p1) { directory_config *dcfg = (directory_config *)_dcfg; if (dcfg == NULL) return NULL; if (strcasecmp(p1, "on") == 0) dcfg->reqintercept_oe = 1; else if (strcasecmp(p1, "off") == 0) dcfg->reqintercept_oe = 0; else return apr_psprintf(cmd->pool, "ModSecurity: Invalid value for SecInterceptOnError: %s", p1); return NULL; } static const char *cmd_request_encoding(cmd_parms *cmd, void *_dcfg, const char *p1) { directory_config *dcfg = (directory_config *)_dcfg; if (dcfg == NULL) return NULL; /* ENH Validate encoding */ dcfg->request_encoding = p1; return NULL; } static const char *cmd_response_body_access(cmd_parms *cmd, void *_dcfg, const char *p1) { directory_config *dcfg = (directory_config *)_dcfg; if (dcfg == NULL) return NULL; if (strcasecmp(p1, "on") == 0) dcfg->resbody_access = 1; else if (strcasecmp(p1, "off") == 0) dcfg->resbody_access = 0; else return apr_psprintf(cmd->pool, "ModSecurity: Invalid value for SecResponseBodyAccess: %s", p1); return NULL; } static const char *cmd_response_body_limit(cmd_parms *cmd, void *_dcfg, const char *p1) { directory_config *dcfg = (directory_config *)_dcfg; long int limit; limit = strtol(p1, NULL, 10); if ((limit == LONG_MAX)||(limit == LONG_MIN)||(limit <= 0)) { return apr_psprintf(cmd->pool, "ModSecurity: Invalid value for SecResponseBodyLimit: %s", p1); } if (limit > RESPONSE_BODY_HARD_LIMIT) { return apr_psprintf(cmd->pool, "ModSecurity: Response size limit can not exceed the hard limit: %li", RESPONSE_BODY_HARD_LIMIT); } dcfg->of_limit = limit; return NULL; } static const char *cmd_response_body_limit_action(cmd_parms *cmd, void *_dcfg, const char *p1) { directory_config *dcfg = (directory_config *)_dcfg; if (dcfg == NULL) return NULL; if (dcfg->is_enabled == MODSEC_DETECTION_ONLY) { dcfg->of_limit_action = RESPONSE_BODY_LIMIT_ACTION_PARTIAL; return NULL; } if (strcasecmp(p1, "ProcessPartial") == 0) dcfg->of_limit_action = RESPONSE_BODY_LIMIT_ACTION_PARTIAL; else if (strcasecmp(p1, "Reject") == 0) dcfg->of_limit_action = RESPONSE_BODY_LIMIT_ACTION_REJECT; else return apr_psprintf(cmd->pool, "ModSecurity: Invalid value for SecResponseBodyLimitAction: %s", p1); return NULL; } /** * \brief Add SecRequestBodyLimitAction configuration option * * \param cmd Pointer to configuration data * \param _dcfg Pointer to directory configuration * \param p1 Pointer to configuration option * * \retval NULL On failure * \retval apr_psprintf On success */ static const char *cmd_resquest_body_limit_action(cmd_parms *cmd, void *_dcfg, const char *p1) { directory_config *dcfg = (directory_config *)_dcfg; if (dcfg == NULL) return NULL; if (dcfg->is_enabled == MODSEC_DETECTION_ONLY) { dcfg->if_limit_action = REQUEST_BODY_LIMIT_ACTION_PARTIAL; return NULL; } if (strcasecmp(p1, "ProcessPartial") == 0) dcfg->if_limit_action = REQUEST_BODY_LIMIT_ACTION_PARTIAL; else if (strcasecmp(p1, "Reject") == 0) dcfg->if_limit_action = REQUEST_BODY_LIMIT_ACTION_REJECT; else return apr_psprintf(cmd->pool, "ModSecurity: Invalid value for SecRequestBodyLimitAction: %s", p1); return NULL; } static const char *cmd_response_body_mime_type(cmd_parms *cmd, void *_dcfg, const char *_p1) { directory_config *dcfg = (directory_config *)_dcfg; char *p1 = apr_pstrdup(cmd->pool, _p1); /* TODO check whether the parameter is a valid MIME type of "???" */ if ((dcfg->of_mime_types == NULL)||(dcfg->of_mime_types == NOT_SET_P)) { dcfg->of_mime_types = apr_table_make(cmd->pool, 10); } strtolower_inplace((unsigned char *)p1); apr_table_setn(dcfg->of_mime_types, p1, "1"); return NULL; } static const char *cmd_response_body_mime_types_clear(cmd_parms *cmd, void *_dcfg) { directory_config *dcfg = (directory_config *)_dcfg; if (dcfg == NULL) return NULL; dcfg->of_mime_types_cleared = 1; if ((dcfg->of_mime_types != NULL)&&(dcfg->of_mime_types != NOT_SET_P)) { apr_table_clear(dcfg->of_mime_types); } return NULL; } /** * \brief Add SecRuleUpdateTargetById * * \param cmd Pointer to configuration data * \param _dcfg Pointer to directory configuration * \param p1 Pointer to configuration option * \param p2 Pointer to configuration option * \param p3 Pointer to configuration option * * \retval NULL On failure|Success */ static const char *cmd_rule_update_target_by_id(cmd_parms *cmd, void *_dcfg, const char *p1, const char *p2, const char *p3) { directory_config *dcfg = (directory_config *)_dcfg; rule_exception *re = apr_pcalloc(cmd->pool, sizeof(rule_exception)); if (dcfg == NULL) return NULL; if(p1 == NULL) { return apr_psprintf(cmd->pool, "Updating target by ID with no ID"); } re->type = RULE_EXCEPTION_REMOVE_ID; /* TODO: Validate the range here, while we can still tell the user if it's invalid */ re->param = p1; if(dcfg->ruleset == NULL) { return apr_psprintf(cmd->pool, "Updating target by ID with no ruleset in this context"); } return msre_ruleset_rule_update_target_matching_exception(NULL, dcfg->ruleset, re, p2, p3); } /** * \brief Add SecRuleUpdateTargetByTag configuration option * * \param cmd Pointer to configuration data * \param _dcfg Pointer to directory configuration * \param p1 Pointer to configuration option RULETAG * \param p2 Pointer to configuration option TARGET * \param p3 Pointer to configuration option REPLACED_TARGET * \todo Finish documenting * * \retval NULL On success * \retval apr_psprintf On failure * * \todo Figure out error checking */ static const char *cmd_rule_update_target_by_tag(cmd_parms *cmd, void *_dcfg, const char *p1, const char *p2, const char *p3) { directory_config *dcfg = (directory_config *)_dcfg; rule_exception *re = apr_pcalloc(cmd->pool, sizeof(rule_exception)); if (dcfg == NULL) return NULL; if(p1 == NULL) { return apr_psprintf(cmd->pool, "Updating target by tag with no tag"); } re->type = RULE_EXCEPTION_REMOVE_TAG; re->param = p1; re->param_data = msc_pregcomp(cmd->pool, p1, 0, NULL, NULL); if (re->param_data == NULL) { return apr_psprintf(cmd->pool, "ModSecurity: Invalid regular expression: %s", p1); } return msre_ruleset_rule_update_target_matching_exception(NULL, dcfg->ruleset, re, p2, p3); } /** * \brief Add SecRuleUpdateTargetByMsg configuration option * * \param cmd Pointer to configuration data * \param _dcfg Pointer to directory configuration * \param p1 Pointer to configuration option RULEMSG * \param p2 Pointer to configuration option TARGET * \param p3 Pointer to configuration option REPLACED_TARGET * \todo Finish documenting * * \retval NULL On success * \retval apr_psprintf On failure * * \todo Figure out error checking */ static const char *cmd_rule_update_target_by_msg(cmd_parms *cmd, void *_dcfg, const char *p1, const char *p2, const char *p3) { directory_config *dcfg = (directory_config *)_dcfg; rule_exception *re = apr_pcalloc(cmd->pool, sizeof(rule_exception)); if (dcfg == NULL) return NULL; if(p1 == NULL) { return apr_psprintf(cmd->pool, "Updating target by message with no message"); } re->type = RULE_EXCEPTION_REMOVE_MSG; re->param = p1; re->param_data = msc_pregcomp(cmd->pool, p1, 0, NULL, NULL); if (re->param_data == NULL) { return apr_psprintf(cmd->pool, "ModSecurity: Invalid regular expression: %s", p1); } return msre_ruleset_rule_update_target_matching_exception(NULL, dcfg->ruleset, re, p2, p3); } static const char *cmd_rule(cmd_parms *cmd, void *_dcfg, const char *p1, const char *p2, const char *p3) { return add_rule(cmd, (directory_config *)_dcfg, RULE_TYPE_NORMAL, p1, p2, p3); } static const char *cmd_rule_engine(cmd_parms *cmd, void *_dcfg, const char *p1) { directory_config *dcfg = (directory_config *)_dcfg; if (dcfg == NULL) return NULL; if (strcasecmp(p1, "on") == 0) dcfg->is_enabled = MODSEC_ENABLED; else if (strcasecmp(p1, "off") == 0) dcfg->is_enabled = MODSEC_DISABLED; else if (strcasecmp(p1, "detectiononly") == 0) { dcfg->is_enabled = MODSEC_DETECTION_ONLY; dcfg->of_limit_action = RESPONSE_BODY_LIMIT_ACTION_PARTIAL; dcfg->if_limit_action = REQUEST_BODY_LIMIT_ACTION_PARTIAL; } else return apr_psprintf(cmd->pool, "ModSecurity: Invalid value for SecRuleEngine: %s", p1); return NULL; } static const char *cmd_rule_inheritance(cmd_parms *cmd, void *_dcfg, int flag) { directory_config *dcfg = (directory_config *)_dcfg; if (dcfg == NULL) return NULL; dcfg->rule_inheritance = flag; return NULL; } static const char *cmd_rule_script(cmd_parms *cmd, void *_dcfg, const char *p1, const char *p2) { #if defined(WITH_LUA) const char *filename = resolve_relative_path(cmd->pool, cmd->directive->filename, p1); return add_rule(cmd, (directory_config *)_dcfg, RULE_TYPE_LUA, filename, p2, NULL); #else ap_log_perror(APLOG_MARK, APLOG_STARTUP|APLOG_NOERRNO, 0, cmd->pool, "Ignoring SecRuleScript \"%s\" directive (%s:%d): No Lua scripting support.", p1, cmd->directive->filename, cmd->directive->line_num); return NULL; #endif } static const char *cmd_rule_remove_by_id(cmd_parms *cmd, void *_dcfg, const char *p1) { directory_config *dcfg = (directory_config *)_dcfg; rule_exception *re = apr_pcalloc(cmd->pool, sizeof(rule_exception)); if (dcfg == NULL) return NULL; re->type = RULE_EXCEPTION_REMOVE_ID; re->param = p1; *(rule_exception **)apr_array_push(dcfg->rule_exceptions) = re; /* Remove the corresponding rules from the context straight away. */ msre_ruleset_rule_remove_with_exception(dcfg->ruleset, re); return NULL; } /** * \brief Add SecRuleRemoveByTag configuration option * * \param cmd Pointer to configuration data * \param _dcfg Pointer to directory configuration * \param p1 Pointer to configuration option * * \retval NULL On failure * \retval apr_psprintf On success */ static const char *cmd_rule_remove_by_tag(cmd_parms *cmd, void *_dcfg, const char *p1) { directory_config *dcfg = (directory_config *)_dcfg; rule_exception *re = apr_pcalloc(cmd->pool, sizeof(rule_exception)); if (dcfg == NULL) return NULL; re->type = RULE_EXCEPTION_REMOVE_TAG; re->param = p1; re->param_data = msc_pregcomp(cmd->pool, p1, 0, NULL, NULL); if (re->param_data == NULL) { return apr_psprintf(cmd->pool, "ModSecurity: Invalid regular expression: %s", p1); } *(rule_exception **)apr_array_push(dcfg->rule_exceptions) = re; /* Remove the corresponding rules from the context straight away. */ msre_ruleset_rule_remove_with_exception(dcfg->ruleset, re); #ifdef DEBUG_CONF ap_log_perror(APLOG_MARK, APLOG_STARTUP|APLOG_NOERRNO, 0, cmd->pool, "Added exception %pp (%d %s) to dcfg %pp.", re, re->type, re->param, dcfg); #endif return NULL; } static const char *cmd_rule_remove_by_msg(cmd_parms *cmd, void *_dcfg, const char *p1) { directory_config *dcfg = (directory_config *)_dcfg; rule_exception *re = apr_pcalloc(cmd->pool, sizeof(rule_exception)); if (dcfg == NULL) return NULL; re->type = RULE_EXCEPTION_REMOVE_MSG; re->param = p1; re->param_data = msc_pregcomp(cmd->pool, p1, 0, NULL, NULL); if (re->param_data == NULL) { return apr_psprintf(cmd->pool, "ModSecurity: Invalid regular expression: %s", p1); } *(rule_exception **)apr_array_push(dcfg->rule_exceptions) = re; /* Remove the corresponding rules from the context straight away. */ msre_ruleset_rule_remove_with_exception(dcfg->ruleset, re); #ifdef DEBUG_CONF ap_log_perror(APLOG_MARK, APLOG_STARTUP|APLOG_NOERRNO, 0, cmd->pool, "Added exception %pp (%d %s) to dcfg %pp.", re, re->type, re->param, dcfg); #endif return NULL; } static const char *cmd_rule_update_action_by_id(cmd_parms *cmd, void *_dcfg, const char *p1, const char *p2) { int offset = 0, rule_id = atoi(p1); char *opt = strchr(p1,':'); char *savedptr = NULL; char *param = apr_pstrdup(cmd->pool, p1); if ((rule_id == LONG_MAX)||(rule_id == LONG_MIN)||(rule_id <= 0)) { return apr_psprintf(cmd->pool, "ModSecurity: Invalid value for ID for update action: %s", p1); } if(opt != NULL) { opt++; offset = atoi(opt); opt = apr_strtok(param,":", &savedptr); return update_rule_action(cmd, (directory_config *)_dcfg, (const char *)opt, p2, offset); } return update_rule_action(cmd, (directory_config *)_dcfg, p1, p2, offset); } static const char *cmd_server_signature(cmd_parms *cmd, void *_dcfg, const char *p1) { if (cmd->server->is_virtual) { return "ModSecurity: SecServerSignature not allowed in VirtualHost"; } new_server_signature = (char *)p1; return NULL; } static const char *cmd_tmp_dir(cmd_parms *cmd, void *_dcfg, const char *p1) { directory_config *dcfg = (directory_config *)_dcfg; if (dcfg == NULL) return NULL; if (strcasecmp(p1, "none") == 0) dcfg->tmp_dir = NULL; else dcfg->tmp_dir = ap_server_root_relative(cmd->pool, p1); return NULL; } static const char *cmd_upload_dir(cmd_parms *cmd, void *_dcfg, const char *p1) { directory_config *dcfg = (directory_config *)_dcfg; if (dcfg == NULL) return NULL; if (strcasecmp(p1, "none") == 0) dcfg->upload_dir = NULL; else dcfg->upload_dir = ap_server_root_relative(cmd->pool, p1); return NULL; } static const char *cmd_upload_file_limit(cmd_parms *cmd, void *_dcfg, const char *p1) { directory_config *dcfg = (directory_config *)_dcfg; if (dcfg == NULL) return NULL; if (strcasecmp(p1, "default") == 0) { dcfg->upload_file_limit = NOT_SET; } else { dcfg->upload_file_limit = atoi(p1); } return NULL; } static const char *cmd_upload_filemode(cmd_parms *cmd, void *_dcfg, const char *p1) { directory_config *dcfg = (directory_config *)_dcfg; if (dcfg == NULL) return NULL; if (strcasecmp(p1, "default") == 0) { dcfg->upload_filemode = NOT_SET; } else { long int mode = strtol(p1, NULL, 8); /* expects octal mode */ if ((mode == LONG_MAX)||(mode == LONG_MIN)||(mode <= 0)||(mode > 07777)) { return apr_psprintf(cmd->pool, "ModSecurity: Invalid value for SecUploadFileMode: %s", p1); } dcfg->upload_filemode = (int)mode; } return NULL; } static const char *cmd_upload_keep_files(cmd_parms *cmd, void *_dcfg, const char *p1) { directory_config *dcfg = (directory_config *)_dcfg; if (dcfg == NULL) return NULL; if (strcasecmp(p1, "on") == 0) { dcfg->upload_keep_files = KEEP_FILES_ON; } else if (strcasecmp(p1, "off") == 0) { dcfg->upload_keep_files = KEEP_FILES_OFF; } else if (strcasecmp(p1, "relevantonly") == 0) { dcfg->upload_keep_files = KEEP_FILES_RELEVANT_ONLY; } else { return apr_psprintf(cmd->pool, "ModSecurity: Invalid setting for SecUploadKeepFiles: %s", p1); } return NULL; } static const char *cmd_web_app_id(cmd_parms *cmd, void *_dcfg, const char *p1) { directory_config *dcfg = (directory_config *)_dcfg; /* ENH enforce format (letters, digits, ., _, -) */ dcfg->webappid = p1; return NULL; } static const char *cmd_sensor_id(cmd_parms *cmd, void *_dcfg, const char *p1) { directory_config *dcfg = (directory_config *)_dcfg; /* ENH enforce format (letters, digits, ., _, -) */ dcfg->sensor_id = p1; return NULL; } /** * \brief Add SecXmlExternalEntity configuration option * * \param cmd Pointer to configuration data * \param _dcfg Pointer to directory configuration * \param p1 Pointer to configuration option * * \retval NULL On failure * \retval apr_psprintf On Success */ static const char *cmd_xml_external_entity(cmd_parms *cmd, void *_dcfg, const char *p1) { directory_config *dcfg = (directory_config *)_dcfg; if (dcfg == NULL) return NULL; if (strcasecmp(p1, "on") == 0) { dcfg->xml_external_entity = 1; } else if (strcasecmp(p1, "off") == 0) { dcfg->xml_external_entity = 0; } else return apr_psprintf(cmd->pool, "ModSecurity: Invalid value for SecXmlExternalEntity: %s", p1); return NULL; } /** * \brief Add SecHashEngine configuration option * * \param cmd Pointer to configuration data * \param _dcfg Pointer to directory configuration * \param p1 Pointer to configuration option * * \retval NULL On failure * \retval apr_psprintf On Success */ static const char *cmd_hash_engine(cmd_parms *cmd, void *_dcfg, const char *p1) { directory_config *dcfg = (directory_config *)_dcfg; if (dcfg == NULL) return NULL; if (strcasecmp(p1, "on") == 0) { dcfg->hash_is_enabled = HASH_ENABLED; dcfg->hash_enforcement = HASH_ENABLED; } else if (strcasecmp(p1, "off") == 0) { dcfg->hash_is_enabled = HASH_DISABLED; dcfg->hash_enforcement = HASH_DISABLED; } else return apr_psprintf(cmd->pool, "ModSecurity: Invalid value for SecHashEngine: %s", p1); return NULL; } /** * \brief Add SecHashPram configuration option * * \param cmd Pointer to configuration data * \param _dcfg Pointer to directory configuration * \param p1 Pointer to configuration option * * \retval NULL On success */ static const char *cmd_hash_param(cmd_parms *cmd, void *_dcfg, const char *p1) { directory_config *dcfg = (directory_config *)_dcfg; if (dcfg == NULL) return NULL; if (p1 == NULL) return NULL; dcfg->crypto_param_name = p1; return NULL; } /** * \brief Add SecHashKey configuration option * * \param cmd Pointer to configuration data * \param _dcfg Pointer to directory configuration * \param _p1 Pointer to configuration option * \param _p2 Pointer to configuration option * * \retval NULL On success */ static const char *cmd_hash_key(cmd_parms *cmd, void *_dcfg, const char *_p1, const char *_p2) { directory_config *dcfg = (directory_config *)_dcfg; char *p1 = NULL; if (dcfg == NULL) return NULL; if (_p1 == NULL) return NULL; if (strcasecmp(_p1, "Rand") == 0) { p1 = apr_pstrdup(cmd->pool, getkey(cmd->pool)); dcfg->crypto_key = p1; dcfg->crypto_key_len = strlen(dcfg->crypto_key); } else { p1 = apr_pstrdup(cmd->pool, _p1); dcfg->crypto_key = p1; dcfg->crypto_key_len = strlen(p1); } if(_p2 == NULL) { return NULL; } else { if (strcasecmp(_p2, "KeyOnly") == 0) dcfg->crypto_key_add = HASH_KEYONLY; else if (strcasecmp(_p2, "SessionID") == 0) dcfg->crypto_key_add = HASH_SESSIONID; else if (strcasecmp(_p2, "RemoteIP") == 0) dcfg->crypto_key_add = HASH_REMOTEIP; } return NULL; } /** * \brief Add SecHashMethodPm configuration option * * \param cmd Pointer to configuration data * \param _dcfg Pointer to directory configuration * \param p1 Pointer to configuration option * \param p2 Pointer to configuration option * * \retval NULL On failure * \retval apr_psprintf On Success */ static const char *cmd_hash_method_pm(cmd_parms *cmd, void *_dcfg, const char *p1, const char *p2) { directory_config *dcfg = (directory_config *)_dcfg; rule_exception *re = apr_pcalloc(cmd->pool, sizeof(hash_method)); const char *_p2 = apr_pstrdup(cmd->pool, p2); ACMP *p = NULL; const char *phrase = NULL; const char *next = NULL; if (dcfg == NULL) return NULL; p = acmp_create(0, cmd->pool); if (p == NULL) return NULL; if(phrase == NULL) phrase = apr_pstrdup(cmd->pool, _p2); for (;;) { while((apr_isspace(*phrase) != 0) && (*phrase != '\0')) phrase++; if (*phrase == '\0') break; next = phrase; while((apr_isspace(*next) == 0) && (*next != 0)) next++; acmp_add_pattern(p, phrase, NULL, NULL, next - phrase); phrase = next; } acmp_prepare(p); if (strcasecmp(p1, "HashHref") == 0) { re->type = HASH_URL_HREF_HASH_PM; re->param = _p2; re->param_data = (void *)p; if (re->param_data == NULL) { return apr_psprintf(cmd->pool, "ModSecurity: Invalid pattern: %s", p2); } dcfg->crypto_hash_href_pm = 1; } else if (strcasecmp(p1, "HashFormAction") == 0) { re->type = HASH_URL_FACTION_HASH_PM; re->param = _p2; re->param_data = (void *)p; if (re->param_data == NULL) { return apr_psprintf(cmd->pool, "ModSecurity: Invalid pattern: %s", p2); } dcfg->crypto_hash_faction_pm = 1; } else if (strcasecmp(p1, "HashLocation") == 0) { re->type = HASH_URL_LOCATION_HASH_PM; re->param = _p2; re->param_data = (void *)p; if (re->param_data == NULL) { return apr_psprintf(cmd->pool, "ModSecurity: Invalid pattern: %s", p2); } dcfg->crypto_hash_location_pm = 1; } else if (strcasecmp(p1, "HashIframeSrc") == 0) { re->type = HASH_URL_IFRAMESRC_HASH_PM; re->param = _p2; re->param_data = (void *)p; if (re->param_data == NULL) { return apr_psprintf(cmd->pool, "ModSecurity: Invalid pattern: %s", p2); } dcfg->crypto_hash_iframesrc_pm = 1; } else if (strcasecmp(p1, "HashFrameSrc") == 0) { re->type = HASH_URL_FRAMESRC_HASH_PM; re->param = _p2; re->param_data = (void *)p; if (re->param_data == NULL) { return apr_psprintf(cmd->pool, "ModSecurity: Invalid pattern: %s", p2); } dcfg->crypto_hash_framesrc_pm = 1; } *(hash_method **)apr_array_push(dcfg->hash_method) = re; return NULL; } /** * \brief Add SecHashMethodRx configuration option * * \param cmd Pointer to configuration data * \param _dcfg Pointer to directory configuration * \param p1 Pointer to configuration option * \param p2 Pointer to configuration option * * \retval NULL On failure * \retval apr_psprintf On Success */ static const char *cmd_hash_method_rx(cmd_parms *cmd, void *_dcfg, const char *p1, const char *p2) { directory_config *dcfg = (directory_config *)_dcfg; rule_exception *re = apr_pcalloc(cmd->pool, sizeof(hash_method)); const char *_p2 = apr_pstrdup(cmd->pool, p2); if (dcfg == NULL) return NULL; if (strcasecmp(p1, "HashHref") == 0) { re->type = HASH_URL_HREF_HASH_RX; re->param = _p2; re->param_data = msc_pregcomp(cmd->pool, p2, 0, NULL, NULL); if (re->param_data == NULL) { return apr_psprintf(cmd->pool, "ModSecurity: Invalid regular expression: %s", p2); } dcfg->crypto_hash_href_rx = 1; } else if (strcasecmp(p1, "HashFormAction") == 0) { re->type = HASH_URL_FACTION_HASH_RX; re->param = _p2; re->param_data = msc_pregcomp(cmd->pool, p2, 0, NULL, NULL); if (re->param_data == NULL) { return apr_psprintf(cmd->pool, "ModSecurity: Invalid regular expression: %s", p2); } dcfg->crypto_hash_faction_rx = 1; } else if (strcasecmp(p1, "HashLocation") == 0) { re->type = HASH_URL_LOCATION_HASH_RX; re->param = _p2; re->param_data = msc_pregcomp(cmd->pool, p2, 0, NULL, NULL); if (re->param_data == NULL) { return apr_psprintf(cmd->pool, "ModSecurity: Invalid regular expression: %s", p2); } dcfg->crypto_hash_location_rx = 1; } else if (strcasecmp(p1, "HashIframeSrc") == 0) { re->type = HASH_URL_IFRAMESRC_HASH_RX; re->param = _p2; re->param_data = msc_pregcomp(cmd->pool, p2, 0, NULL, NULL); if (re->param_data == NULL) { return apr_psprintf(cmd->pool, "ModSecurity: Invalid regular expression: %s", p2); } dcfg->crypto_hash_iframesrc_rx = 1; } else if (strcasecmp(p1, "HashFrameSrc") == 0) { re->type = HASH_URL_FRAMESRC_HASH_RX; re->param = _p2; re->param_data = msc_pregcomp(cmd->pool, p2, 0, NULL, NULL); if (re->param_data == NULL) { return apr_psprintf(cmd->pool, "ModSecurity: Invalid regular expression: %s", p2); } dcfg->crypto_hash_framesrc_rx = 1; } *(hash_method **)apr_array_push(dcfg->hash_method) = re; return NULL; } /** * \brief Add SecHttpBlKey configuration option * * \param cmd Pointer to configuration data * \param _dcfg Pointer to directory configuration * \param p1 Pointer to configuration option * * \retval NULL On success */ static const char *cmd_httpBl_key(cmd_parms *cmd, void *_dcfg, const char *p1) { directory_config *dcfg = (directory_config *)_dcfg; if (dcfg == NULL) return NULL; if (p1 == NULL) return NULL; dcfg->httpBlkey = p1; return NULL; } /* PCRE Limits */ static const char *cmd_pcre_match_limit(cmd_parms *cmd, void *_dcfg, const char *p1) { long val; if (cmd->server->is_virtual) { return "ModSecurity: SecPcreMatchLimit not allowed in VirtualHost"; } val = atol(p1); if (val <= 0) { return apr_psprintf(cmd->pool, "ModSecurity: Invalid setting for " "SecPcreMatchLimit: %s", p1); } msc_pcre_match_limit = (unsigned long int)val; return NULL; } static const char *cmd_pcre_match_limit_recursion(cmd_parms *cmd, void *_dcfg, const char *p1) { long val; if (cmd->server->is_virtual) { return "ModSecurity: SecPcreMatchLimitRecursion not allowed in VirtualHost"; } val = atol(p1); if (val <= 0) { return apr_psprintf(cmd->pool, "ModSecurity: Invalid setting for " "SecPcreMatchLimitRecursion: %s", p1); } msc_pcre_match_limit_recursion = (unsigned long int)val; return NULL; } /* -- Geo Lookup configuration -- */ static const char *cmd_geo_lookup_db(cmd_parms *cmd, void *_dcfg, const char *p1) { const char *filename = resolve_relative_path(cmd->pool, cmd->directive->filename, p1); char *error_msg; directory_config *dcfg = (directory_config *)_dcfg; if (dcfg == NULL) return NULL; if (geo_init(dcfg, filename, &error_msg) <= 0) { return error_msg; } return NULL; } /** * \brief Add SecUnicodeCodePage configuration option * * Depcrecated * * \param cmd Pointer to configuration data * \param _dcfg Pointer to directory configuration * \param p1 Pointer to configuration option * * \retval NULL On success */ static const char *cmd_unicode_codepage(cmd_parms *cmd, void *_dcfg, const char *p1) { long val; val = atol(p1); if (val <= 0) { return apr_psprintf(cmd->pool, "ModSecurity: Invalid setting for " "SecUnicodeCodePage: %s", p1); } unicode_codepage = (unsigned long int)val; return NULL; } /** * \brief Add SecUnicodeMapFile configuration option * * \param cmd Pointer to configuration data * \param _dcfg Pointer to directory configuration * \param p1 Pointer to configuration option * * \retval NULL On success */ static const char *cmd_unicode_map(cmd_parms *cmd, void *_dcfg, const char *p1, const char *p2) { const char *filename = resolve_relative_path(cmd->pool, cmd->directive->filename, p1); char *error_msg; long val = 0; directory_config *dcfg = (directory_config *)_dcfg; if (dcfg == NULL) return NULL; if(p2 != NULL) { val = atol(p2); if (val <= 0) { return apr_psprintf(cmd->pool, "ModSecurity: Invalid setting for " "SecUnicodeMapFile: %s", p2); } unicode_codepage = (unsigned long int)val; } if (unicode_map_init(dcfg, filename, &error_msg) <= 0) { return error_msg; } return NULL; } /** * \brief Add SecGsbLookupDb configuration option * * \param cmd Pointer to configuration data * \param _dcfg Pointer to directory configuration * \param p1 Pointer to configuration option * * \retval NULL On success */ static const char *cmd_gsb_lookup_db(cmd_parms *cmd, void *_dcfg, const char *p1) { const char *filename = resolve_relative_path(cmd->pool, cmd->directive->filename, p1); char *error_msg; directory_config *dcfg = (directory_config *)_dcfg; if (dcfg == NULL) return NULL; if (gsb_db_init(dcfg, filename, &error_msg) <= 0) { return error_msg; } return NULL; } /* -- Cache -- */ static const char *cmd_cache_transformations(cmd_parms *cmd, void *_dcfg, const char *p1, const char *p2) { directory_config *dcfg = (directory_config *)_dcfg; if (dcfg == NULL) return NULL; if (strcasecmp(p1, "on") == 0) dcfg->cache_trans = MODSEC_CACHE_ENABLED; else if (strcasecmp(p1, "off") == 0) dcfg->cache_trans = MODSEC_CACHE_DISABLED; else return apr_psprintf(cmd->pool, "ModSecurity: Invalid value for SecCacheTransformations: %s", p1); /* Process options */ if (p2 != NULL) { apr_table_t *vartable = apr_table_make(cmd->pool, 4); apr_status_t rc; char *error_msg = NULL; const char *charval = NULL; apr_int64_t intval = 0; if (vartable == NULL) { return apr_psprintf(cmd->pool, "ModSecurity: Unable to process options for SecCacheTransformations"); } rc = msre_parse_generic(cmd->pool, p2, vartable, &error_msg); if (rc < 0) { return apr_psprintf(cmd->pool, "ModSecurity: Unable to parse options for SecCacheTransformations: %s", error_msg); } /* incremental */ charval = apr_table_get(vartable, "incremental"); if (charval != NULL) { if (strcasecmp(charval, "on") == 0) dcfg->cache_trans_incremental = 1; else if (strcasecmp(charval, "off") == 0) dcfg->cache_trans_incremental = 0; else return apr_psprintf(cmd->pool, "ModSecurity: SecCacheTransformations invalid incremental value: %s", charval); } /* minlen */ charval = apr_table_get(vartable, "minlen"); if (charval != NULL) { intval = apr_atoi64(charval); if (errno == ERANGE) { return apr_psprintf(cmd->pool, "ModSecurity: SecCacheTransformations minlen out of range: %s", charval); } if (intval < 0) { return apr_psprintf(cmd->pool, "ModSecurity: SecCacheTransformations minlen must be positive: %s", charval); } /* The NOT_SET indicator is -1, a signed long, and therfore * we cannot be >= the unsigned value of NOT_SET. */ if ((unsigned long)intval >= (unsigned long)NOT_SET) { return apr_psprintf(cmd->pool, "ModSecurity: SecCacheTransformations minlen must be less than: %lu", (unsigned long)NOT_SET); } dcfg->cache_trans_min = (apr_size_t)intval; } /* maxlen */ charval = apr_table_get(vartable, "maxlen"); if (charval != NULL) { intval = apr_atoi64(charval); if (errno == ERANGE) { return apr_psprintf(cmd->pool, "ModSecurity: SecCacheTransformations maxlen out of range: %s", charval); } if (intval < 0) { return apr_psprintf(cmd->pool, "ModSecurity: SecCacheTransformations maxlen must be positive: %s", charval); } /* The NOT_SET indicator is -1, a signed long, and therfore * we cannot be >= the unsigned value of NOT_SET. */ if ((unsigned long)intval >= (unsigned long)NOT_SET) { return apr_psprintf(cmd->pool, "ModSecurity: SecCacheTransformations maxlen must be less than: %lu", (unsigned long)NOT_SET); } if ((intval != 0) && ((apr_size_t)intval < dcfg->cache_trans_min)) { return apr_psprintf(cmd->pool, "ModSecurity: SecCacheTransformations maxlen must not be less than minlen: %lu < %" APR_SIZE_T_FMT, (unsigned long)intval, dcfg->cache_trans_min); } dcfg->cache_trans_max = (apr_size_t)intval; } /* maxitems */ charval = apr_table_get(vartable, "maxitems"); if (charval != NULL) { intval = apr_atoi64(charval); if (errno == ERANGE) { return apr_psprintf(cmd->pool, "ModSecurity: SecCacheTransformations maxitems out of range: %s", charval); } if (intval < 0) { return apr_psprintf(cmd->pool, "ModSecurity: SecCacheTransformations maxitems must be positive: %s", charval); } dcfg->cache_trans_maxitems = (apr_size_t)intval; } } return NULL; } /* -- Configuration directives definitions -- */ #define CMD_SCOPE_MAIN (RSRC_CONF) #define CMD_SCOPE_ANY (RSRC_CONF | ACCESS_CONF) #if defined(HTACCESS_CONFIG) #define CMD_SCOPE_HTACCESS (OR_OPTIONS) #endif const command_rec module_directives[] = { #ifdef HTACCESS_CONFIG AP_INIT_TAKE1 ( "SecAction", cmd_action, NULL, CMD_SCOPE_HTACCESS, "an action list" ), #else AP_INIT_TAKE1 ( "SecAction", cmd_action, NULL, CMD_SCOPE_ANY, "an action list" ), #endif AP_INIT_TAKE1 ( "SecArgumentSeparator", cmd_argument_separator, NULL, CMD_SCOPE_ANY, "character that will be used as separator when parsing application/x-www-form-urlencoded content." ), AP_INIT_TAKE1 ( "SecCookiev0Separator", cmd_cookiev0_separator, NULL, CMD_SCOPE_ANY, "character that will be used as separator when parsing cookie v0 content." ), AP_INIT_TAKE1 ( "SecAuditEngine", cmd_audit_engine, NULL, CMD_SCOPE_ANY, "On, Off or RelevantOnly to determine the level of audit logging" ), AP_INIT_TAKE1 ( "SecAuditLog", cmd_audit_log, NULL, CMD_SCOPE_ANY, "filename of the primary audit log file" ), AP_INIT_TAKE1 ( "SecAuditLog2", cmd_audit_log2, NULL, CMD_SCOPE_ANY, "filename of the secondary audit log file" ), AP_INIT_TAKE1 ( "SecAuditLogParts", cmd_audit_log_parts, NULL, CMD_SCOPE_ANY, "list of audit log parts that go into the log." ), AP_INIT_TAKE1 ( "SecAuditLogRelevantStatus", cmd_audit_log_relevant_status, NULL, CMD_SCOPE_ANY, "regular expression that will be used to determine if the response status is relevant for audit logging" ), AP_INIT_TAKE1 ( "SecAuditLogType", cmd_audit_log_type, NULL, CMD_SCOPE_ANY, "whether to use the old audit log format (Serial) or new (Concurrent)" ), AP_INIT_TAKE1 ( "SecAuditLogStorageDir", cmd_audit_log_storage_dir, NULL, CMD_SCOPE_ANY, "path to the audit log storage area; absolute, or relative to the root of the server" ), AP_INIT_TAKE1 ( "SecAuditLogDirMode", cmd_audit_log_dirmode, NULL, CMD_SCOPE_ANY, "octal permissions mode for concurrent audit log directories" ), AP_INIT_TAKE1 ( "SecAuditLogFileMode", cmd_audit_log_filemode, NULL, CMD_SCOPE_ANY, "octal permissions mode for concurrent audit log files" ), AP_INIT_TAKE12 ( "SecCacheTransformations", cmd_cache_transformations, NULL, CMD_SCOPE_ANY, "whether or not to cache transformations. Defaults to true." ), AP_INIT_TAKE1 ( "SecChrootDir", cmd_chroot_dir, NULL, CMD_SCOPE_MAIN, "path of the directory to which server will be chrooted" ), AP_INIT_TAKE1 ( "SecComponentSignature", cmd_component_signature, NULL, CMD_SCOPE_MAIN, "component signature to add to ModSecurity signature." ), AP_INIT_FLAG ( "SecContentInjection", cmd_content_injection, NULL, CMD_SCOPE_ANY, "On or Off" ), AP_INIT_FLAG ( "SecStreamOutBodyInspection", cmd_stream_outbody_inspection, NULL, CMD_SCOPE_ANY, "On or Off" ), AP_INIT_FLAG ( "SecStreamInBodyInspection", cmd_stream_inbody_inspection, NULL, CMD_SCOPE_ANY, "On or Off" ), AP_INIT_TAKE1 ( "SecCookieFormat", cmd_cookie_format, NULL, CMD_SCOPE_ANY, "version of the Cookie specification to use for parsing. Possible values are 0 and 1." ), AP_INIT_TAKE1 ( "SecDataDir", cmd_data_dir, NULL, CMD_SCOPE_MAIN, "path to the persistent data storage area" // TODO ), AP_INIT_TAKE1 ( "SecDebugLog", cmd_debug_log, NULL, CMD_SCOPE_ANY, "path to the debug log file" ), AP_INIT_TAKE1 ( "SecDebugLogLevel", cmd_debug_log_level, NULL, CMD_SCOPE_ANY, "debug log level, which controls the verbosity of logging." " Use values from 0 (no logging) to 9 (a *lot* of logging)." ), AP_INIT_TAKE1 ( "SecCollectionTimeout", cmd_collection_timeout, NULL, CMD_SCOPE_ANY, "set default collections timeout. default it 3600" ), AP_INIT_TAKE1 ( "SecDefaultAction", cmd_default_action, NULL, CMD_SCOPE_ANY, "default action list" ), AP_INIT_FLAG ( "SecDisableBackendCompression", cmd_disable_backend_compression, NULL, CMD_SCOPE_ANY, "When set to On, removes the compression headers from the backend requests." ), AP_INIT_TAKE1 ( "SecGsbLookupDB", cmd_gsb_lookup_db, NULL, RSRC_CONF, "database google safe browsing" ), AP_INIT_TAKE1 ( "SecUnicodeCodePage", cmd_unicode_codepage, NULL, CMD_SCOPE_MAIN, "Unicode CodePage" ), AP_INIT_TAKE12 ( "SecUnicodeMapFile", cmd_unicode_map, NULL, CMD_SCOPE_MAIN, "Unicode Map file" ), AP_INIT_TAKE1 ( "SecGeoLookupDB", cmd_geo_lookup_db, NULL, RSRC_CONF, "database for geographical lookups module." ), AP_INIT_TAKE12 ( "SecGuardianLog", cmd_guardian_log, NULL, CMD_SCOPE_MAIN, "The filename of the filter debugging log file" ), AP_INIT_TAKE1 ( "SecMarker", cmd_marker, NULL, CMD_SCOPE_ANY, "marker for a skipAfter target" ), AP_INIT_TAKE1 ( "SecPcreMatchLimit", cmd_pcre_match_limit, NULL, CMD_SCOPE_MAIN, "PCRE match limit" ), AP_INIT_TAKE1 ( "SecPcreMatchLimitRecursion", cmd_pcre_match_limit_recursion, NULL, CMD_SCOPE_MAIN, "PCRE match limit recursion" ), AP_INIT_TAKE1 ( "SecRequestBodyAccess", cmd_request_body_access, NULL, CMD_SCOPE_ANY, "On or Off" ), AP_INIT_TAKE1 ( "SecInterceptOnError", cmd_request_intercept_on_error, NULL, CMD_SCOPE_ANY, "On or Off" ), AP_INIT_TAKE1 ( "SecRulePerfTime", cmd_rule_perf_time, NULL, CMD_SCOPE_ANY, "Threshold to log slow rules in usecs." ), AP_INIT_TAKE1 ( "SecReadStateLimit", cmd_conn_read_state_limit, NULL, CMD_SCOPE_ANY, "maximum number of threads in READ_BUSY state per ip address" ), AP_INIT_TAKE1 ( "SecWriteStateLimit", cmd_conn_write_state_limit, NULL, CMD_SCOPE_ANY, "maximum number of threads in WRITE_BUSY state per ip address" ), AP_INIT_TAKE1 ( "SecRequestBodyInMemoryLimit", cmd_request_body_inmemory_limit, NULL, CMD_SCOPE_ANY, "maximum request body size that will be placed in memory (except for POST urlencoded requests)." ), AP_INIT_TAKE1 ( "SecRequestBodyLimit", cmd_request_body_limit, NULL, CMD_SCOPE_ANY, "maximum request body size ModSecurity will accept." ), AP_INIT_TAKE1 ( "SecRequestBodyNoFilesLimit", cmd_request_body_no_files_limit, NULL, CMD_SCOPE_ANY, "maximum request body size ModSecurity will accept, but excluding the size of uploaded files." ), AP_INIT_TAKE1 ( "SecRequestEncoding", cmd_request_encoding, NULL, CMD_SCOPE_ANY, "character encoding used in request." ), AP_INIT_TAKE1 ( "SecResponseBodyAccess", cmd_response_body_access, NULL, CMD_SCOPE_ANY, "On or Off" ), AP_INIT_TAKE1 ( "SecResponseBodyLimit", cmd_response_body_limit, NULL, CMD_SCOPE_ANY, "byte limit for response body" ), AP_INIT_TAKE1 ( "SecResponseBodyLimitAction", cmd_response_body_limit_action, NULL, CMD_SCOPE_ANY, "what happens when the response body limit is reached" ), AP_INIT_TAKE1 ( "SecRequestBodyLimitAction", cmd_resquest_body_limit_action, NULL, CMD_SCOPE_ANY, "what happens when the request body limit is reached" ), AP_INIT_ITERATE ( "SecResponseBodyMimeType", cmd_response_body_mime_type, NULL, CMD_SCOPE_ANY, "adds given MIME types to the list of types that will be buffered on output" ), AP_INIT_NO_ARGS ( "SecResponseBodyMimeTypesClear", cmd_response_body_mime_types_clear, NULL, CMD_SCOPE_ANY, "clears the list of MIME types that will be buffered on output" ), #ifdef HTACCESS_CONFIG AP_INIT_TAKE23 ( "SecRule", cmd_rule, NULL, CMD_SCOPE_HTACCESS, "rule target, operator and optional action list" ), #else AP_INIT_TAKE23 ( "SecRule", cmd_rule, NULL, CMD_SCOPE_ANY, "rule target, operator and optional action list" ), #endif AP_INIT_TAKE1 ( "SecRuleEngine", cmd_rule_engine, NULL, CMD_SCOPE_ANY, "On or Off" ), AP_INIT_TAKE1 ( "SecXmlExternalEntity", cmd_xml_external_entity, NULL, CMD_SCOPE_ANY, "On or Off" ), AP_INIT_FLAG ( "SecRuleInheritance", cmd_rule_inheritance, NULL, CMD_SCOPE_ANY, "On or Off" ), AP_INIT_TAKE12 ( "SecRuleScript", cmd_rule_script, NULL, CMD_SCOPE_ANY, "rule script and optional actionlist" ), #ifdef HTACCESS_CONFIG AP_INIT_ITERATE ( "SecRuleRemoveById", cmd_rule_remove_by_id, NULL, CMD_SCOPE_HTACCESS, "rule ID for removal" ), AP_INIT_ITERATE ( "SecRuleRemoveByTag", cmd_rule_remove_by_tag, NULL, CMD_SCOPE_HTACCESS, "rule tag for removal" ), AP_INIT_ITERATE ( "SecRuleRemoveByMsg", cmd_rule_remove_by_msg, NULL, CMD_SCOPE_HTACCESS, "rule message for removal" ), #else AP_INIT_ITERATE ( "SecRuleRemoveById", cmd_rule_remove_by_id, NULL, CMD_SCOPE_ANY, "rule ID for removal" ), AP_INIT_ITERATE ( "SecRuleRemoveByTag", cmd_rule_remove_by_tag, NULL, CMD_SCOPE_ANY, "rule tag for removal" ), AP_INIT_ITERATE ( "SecRuleRemoveByMsg", cmd_rule_remove_by_msg, NULL, CMD_SCOPE_ANY, "rule message for removal" ), #endif AP_INIT_TAKE2 ( "SecHashMethodPm", cmd_hash_method_pm, NULL, CMD_SCOPE_ANY, "Hash method and pattern" ), AP_INIT_TAKE2 ( "SecHashMethodRx", cmd_hash_method_rx, NULL, CMD_SCOPE_ANY, "Hash method and regex" ), #ifdef HTACCESS_CONFIG AP_INIT_TAKE2 ( "SecRuleUpdateActionById", cmd_rule_update_action_by_id, NULL, CMD_SCOPE_HTACCESS, "updated action list" ), AP_INIT_TAKE23 ( "SecRuleUpdateTargetById", cmd_rule_update_target_by_id, NULL, CMD_SCOPE_HTACCESS, "updated target list" ), AP_INIT_TAKE23 ( "SecRuleUpdateTargetByTag", cmd_rule_update_target_by_tag, NULL, CMD_SCOPE_HTACCESS, "rule tag pattern and updated target list" ), AP_INIT_TAKE23 ( "SecRuleUpdateTargetByMsg", cmd_rule_update_target_by_msg, NULL, CMD_SCOPE_HTACCESS, "rule message pattern and updated target list" ), #else AP_INIT_TAKE2 ( "SecRuleUpdateActionById", cmd_rule_update_action_by_id, NULL, CMD_SCOPE_ANY, "updated action list" ), AP_INIT_TAKE23 ( "SecRuleUpdateTargetById", cmd_rule_update_target_by_id, NULL, CMD_SCOPE_ANY, "updated target list" ), AP_INIT_TAKE23 ( "SecRuleUpdateTargetByTag", cmd_rule_update_target_by_tag, NULL, CMD_SCOPE_ANY, "rule tag pattern and updated target list" ), AP_INIT_TAKE23 ( "SecRuleUpdateTargetByMsg", cmd_rule_update_target_by_msg, NULL, CMD_SCOPE_ANY, "rule message pattern and updated target list" ), #endif AP_INIT_TAKE1 ( "SecServerSignature", cmd_server_signature, NULL, CMD_SCOPE_MAIN, "the new signature of the server" ), AP_INIT_TAKE1 ( "SecTmpDir", cmd_tmp_dir, NULL, CMD_SCOPE_ANY, "path to the temporary storage area" ), AP_INIT_TAKE1 ( "SecUploadDir", cmd_upload_dir, NULL, CMD_SCOPE_ANY, "path to the file upload area" ), AP_INIT_TAKE1 ( "SecUploadFileLimit", cmd_upload_file_limit, NULL, CMD_SCOPE_ANY, "limit the number of uploaded files processed" ), AP_INIT_TAKE1 ( "SecUploadFileMode", cmd_upload_filemode, NULL, CMD_SCOPE_ANY, "octal permissions mode for uploaded files" ), AP_INIT_TAKE1 ( "SecUploadKeepFiles", cmd_upload_keep_files, NULL, CMD_SCOPE_ANY, "On or Off" ), AP_INIT_TAKE1 ( "SecWebAppId", cmd_web_app_id, NULL, CMD_SCOPE_ANY, "id" ), AP_INIT_TAKE1 ( "SecSensorId", cmd_sensor_id, NULL, CMD_SCOPE_MAIN, "sensor id" ), AP_INIT_TAKE1 ( "SecHttpBlKey", cmd_httpBl_key, NULL, CMD_SCOPE_ANY, "httpBl access key" ), AP_INIT_TAKE1 ( "SecHashEngine", cmd_hash_engine, NULL, CMD_SCOPE_ANY, "On or Off" ), AP_INIT_TAKE2 ( "SecHashKey", cmd_hash_key, NULL, CMD_SCOPE_ANY, "Set Hash key" ), AP_INIT_TAKE1 ( "SecHashParam", cmd_hash_param, NULL, CMD_SCOPE_ANY, "Set Hash parameter" ), { NULL } }; modsecurity-apache_2.7.7/apache2/msc_gsb.h0000664000175000017500000000152612243422537020734 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #ifndef _MSC_GSB_H_ #define _MSC_GSB_H_ typedef struct gsb_db gsb_db; #include #include "modsecurity.h" #include "apr_hash.h" struct gsb_db { apr_file_t *db; const char *dbfn; apr_hash_t *gsb_table; }; int DSOLOCAL gsb_db_init(directory_config *dcfg, const char *dbfn, char **error_msg); #endif modsecurity-apache_2.7.7/apache2/re_variables.c0000664000175000017500000033750712252634623021764 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #include "http_core.h" #include "modsecurity.h" #include "apache2.h" #include "re.h" #include "msc_util.h" #include "libxml/xpathInternals.h" /** * Generates a variable from a string and a length. */ static int var_simple_generate_ex(msre_var *var, apr_table_t *vartab, apr_pool_t *mptmp, const char *value, int value_len) { msre_var *rvar = NULL; if (value == NULL) return 0; rvar = apr_pmemdup(mptmp, var, sizeof(msre_var)); rvar->value = value; rvar->value_len = value_len; apr_table_addn(vartab, rvar->name, (void *)rvar); return 1; } /** * Generates a variable from a NULL-terminated string. */ static int var_simple_generate(msre_var *var, apr_table_t *vartab, apr_pool_t *mptmp, const char *value) { if (value == NULL) return 0; return var_simple_generate_ex(var, vartab, mptmp, value, strlen(value)); } /** * Validate that a target parameter is valid. We only need to take * care of the case when the parameter is a regular expression. */ static char *var_generic_list_validate(msre_ruleset *ruleset, msre_var *var) { /* It's OK if there's no parameter. */ if (var->param == NULL) return NULL; /* Is it a regular expression? */ if ((strlen(var->param) > 2)&&(var->param[0] == '/') &&(var->param[strlen(var->param) - 1] == '/')) { /* Regex. */ msc_regex_t *regex = NULL; const char *errptr = NULL; const char *pattern = NULL; int erroffset; pattern = apr_pstrmemdup(ruleset->mp, var->param + 1, strlen(var->param + 1) - 1); if (pattern == NULL) return FATAL_ERROR; regex = msc_pregcomp(ruleset->mp, pattern, PCRE_DOTALL | PCRE_CASELESS | PCRE_DOLLAR_ENDONLY, &errptr, &erroffset); if (regex == NULL) { return apr_psprintf(ruleset->mp, "Error compiling pattern (offset %d): %s", erroffset, errptr); } /* Store the compiled regex for later. */ var->param_data = regex; } /* Simple string */ return NULL; } /* Custom parameter validation functions */ /* ARGS */ static int var_args_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { const apr_array_header_t *arr = NULL; const apr_table_entry_t *te = NULL; int i, count = 0; /* Loop through the arguments. */ arr = apr_table_elts(msr->arguments); te = (apr_table_entry_t *)arr->elts; for (i = 0; i < arr->nelts; i++) { msc_arg *arg = (msc_arg *)te[i].val; int match = 0; /* Figure out if we want to include this argument. */ if (var->param == NULL) match = 1; /* Unconditional inclusion. */ else { if (var->param_data != NULL) { /* Regex. */ char *my_error_msg = NULL; /* Run the regex against the argument name. */ if (!(msc_regexec((msc_regex_t *)var->param_data, arg->name, arg->name_len, &my_error_msg) == PCRE_ERROR_NOMATCH)) match = 1; } else { /* Simple comparison. */ if (strcasecmp(arg->name, var->param) == 0) match = 1; } } /* If we had a match add this argument to the collection. */ if (match) { msre_var *rvar = apr_pmemdup(mptmp, var, sizeof(msre_var)); rvar->value = arg->value; rvar->value_len = arg->value_len; rvar->name = apr_psprintf(mptmp, "ARGS:%s", log_escape_nq_ex(mptmp, arg->name, arg->name_len)); apr_table_addn(vartab, rvar->name, (void *)rvar); count++; } } return count; } /* ARGS_COMBINED_SIZE */ static int var_args_combined_size_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { const apr_array_header_t *arr = NULL; const apr_table_entry_t *te = NULL; unsigned int combined_size = 0; int i; msre_var *rvar = NULL; arr = apr_table_elts(msr->arguments); te = (apr_table_entry_t *)arr->elts; for (i = 0; i < arr->nelts; i++) { msc_arg *arg = (msc_arg *)te[i].val; combined_size += arg->name_len; combined_size += arg->value_len; } rvar = apr_pmemdup(mptmp, var, sizeof(msre_var)); rvar->value = apr_psprintf(mptmp, "%u", combined_size); rvar->value_len = strlen(rvar->value); apr_table_addn(vartab, rvar->name, (void *)rvar); return 1; } /* ARGS_NAMES */ static int var_args_names_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { const apr_array_header_t *arr = NULL; const apr_table_entry_t *te = NULL; int i, count = 0; arr = apr_table_elts(msr->arguments); te = (apr_table_entry_t *)arr->elts; for (i = 0; i < arr->nelts; i++) { msc_arg *arg = (msc_arg *)te[i].val; int match = 0; /* Figure out if we want to include this variable. */ if (var->param == NULL) match = 1; /* Unconditional inclusion. */ else { if (var->param_data != NULL) { /* Regex. */ char *my_error_msg = NULL; if (!(msc_regexec((msc_regex_t *)var->param_data, arg->name, arg->name_len, &my_error_msg) == PCRE_ERROR_NOMATCH)) match = 1; } else { /* Simple comparison. */ if (strcasecmp(arg->name, var->param) == 0) match = 1; } } /* If we had a match add this argument to the collection. */ if (match) { msre_var *rvar = apr_pmemdup(mptmp, var, sizeof(msre_var)); rvar->value = arg->name; rvar->value_len = arg->name_len; rvar->name = apr_psprintf(mptmp, "ARGS_NAMES:%s", log_escape_nq_ex(mptmp, arg->name, arg->name_len)); apr_table_addn(vartab, rvar->name, (void *)rvar); count++; } } return count; } /* ARGS_GET */ static int var_args_get_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { const apr_array_header_t *arr = NULL; const apr_table_entry_t *te = NULL; int i, count = 0; /* Loop through the arguments. */ arr = apr_table_elts(msr->arguments); te = (apr_table_entry_t *)arr->elts; for (i = 0; i < arr->nelts; i++) { msc_arg *arg = (msc_arg *)te[i].val; int match = 0; /* Only QUERY_STRING arguments */ if (strcmp("QUERY_STRING", arg->origin) != 0) continue; /* Figure out if we want to include this argument. */ if (var->param == NULL) match = 1; /* Unconditional inclusion. */ else { if (var->param_data != NULL) { /* Regex. */ char *my_error_msg = NULL; /* Run the regex against the argument name. */ if (!(msc_regexec((msc_regex_t *)var->param_data, arg->name, arg->name_len, &my_error_msg) == PCRE_ERROR_NOMATCH)) match = 1; } else { /* Simple comparison. */ if (strcasecmp(arg->name, var->param) == 0) match = 1; } } /* If we had a match add this argument to the collection. */ if (match) { msre_var *rvar = apr_pmemdup(mptmp, var, sizeof(msre_var)); rvar->value = arg->value; rvar->value_len = arg->value_len; rvar->name = apr_psprintf(mptmp, "ARGS_GET:%s", log_escape_nq_ex(mptmp, arg->name, arg->name_len)); apr_table_addn(vartab, rvar->name, (void *)rvar); count++; } } return count; } /* ARGS_GET_NAMES */ static int var_args_get_names_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { const apr_array_header_t *arr = NULL; const apr_table_entry_t *te = NULL; int i, count = 0; arr = apr_table_elts(msr->arguments); te = (apr_table_entry_t *)arr->elts; for (i = 0; i < arr->nelts; i++) { msc_arg *arg = (msc_arg *)te[i].val; int match = 0; /* Only QUERY_STRING arguments */ if (strcmp("QUERY_STRING", arg->origin) != 0) continue; /* Figure out if we want to include this variable. */ if (var->param == NULL) match = 1; /* Unconditional inclusion. */ else { if (var->param_data != NULL) { /* Regex. */ char *my_error_msg = NULL; if (!(msc_regexec((msc_regex_t *)var->param_data, arg->name, arg->name_len, &my_error_msg) == PCRE_ERROR_NOMATCH)) match = 1; } else { /* Simple comparison. */ if (strcasecmp(arg->name, var->param) == 0) match = 1; } } /* If we had a match add this argument to the collection. */ if (match) { msre_var *rvar = apr_pmemdup(mptmp, var, sizeof(msre_var)); rvar->value = arg->name; rvar->value_len = arg->name_len; rvar->name = apr_psprintf(mptmp, "ARGS_GET_NAMES:%s", log_escape_nq_ex(mptmp, arg->name, arg->name_len)); apr_table_addn(vartab, rvar->name, (void *)rvar); count++; } } return count; } /* ARGS_POST */ static int var_args_post_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { const apr_array_header_t *arr = NULL; const apr_table_entry_t *te = NULL; int i, count = 0; /* Loop through the arguments. */ arr = apr_table_elts(msr->arguments); te = (apr_table_entry_t *)arr->elts; for (i = 0; i < arr->nelts; i++) { msc_arg *arg = (msc_arg *)te[i].val; int match = 0; /* Only BODY arguments */ if (strcmp("BODY", arg->origin) != 0) continue; /* Figure out if we want to include this argument. */ if (var->param == NULL) match = 1; /* Unconditional inclusion. */ else { if (var->param_data != NULL) { /* Regex. */ char *my_error_msg = NULL; /* Run the regex against the argument name. */ if (!(msc_regexec((msc_regex_t *)var->param_data, arg->name, arg->name_len, &my_error_msg) == PCRE_ERROR_NOMATCH)) match = 1; } else { /* Simple comparison. */ if (strcasecmp(arg->name, var->param) == 0) match = 1; } } /* If we had a match add this argument to the collection. */ if (match) { msre_var *rvar = apr_pmemdup(mptmp, var, sizeof(msre_var)); rvar->value = arg->value; rvar->value_len = arg->value_len; rvar->name = apr_psprintf(mptmp, "ARGS_POST:%s", log_escape_nq_ex(mptmp, arg->name, arg->name_len)); apr_table_addn(vartab, rvar->name, (void *)rvar); count++; } } return count; } /* ARGS_POST_NAMES */ static int var_args_post_names_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { const apr_array_header_t *arr = NULL; const apr_table_entry_t *te = NULL; int i, count = 0; arr = apr_table_elts(msr->arguments); te = (apr_table_entry_t *)arr->elts; for (i = 0; i < arr->nelts; i++) { msc_arg *arg = (msc_arg *)te[i].val; int match = 0; /* Only BODY arguments */ if (strcmp("BODY", arg->origin) != 0) continue; /* Figure out if we want to include this variable. */ if (var->param == NULL) match = 1; /* Unconditional inclusion. */ else { if (var->param_data != NULL) { /* Regex. */ char *my_error_msg = NULL; if (!(msc_regexec((msc_regex_t *)var->param_data, arg->name, arg->name_len, &my_error_msg) == PCRE_ERROR_NOMATCH)) match = 1; } else { /* Simple comparison. */ if (strcasecmp(arg->name, var->param) == 0) match = 1; } } /* If we had a match add this argument to the collection. */ if (match) { msre_var *rvar = apr_pmemdup(mptmp, var, sizeof(msre_var)); rvar->value = arg->name; rvar->value_len = arg->name_len; rvar->name = apr_psprintf(mptmp, "ARGS_POST_NAMES:%s", log_escape_nq_ex(mptmp, arg->name, arg->name_len)); apr_table_addn(vartab, rvar->name, (void *)rvar); count++; } } return count; } /* RULE */ static int var_rule_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { msre_actionset *actionset = NULL; if (rule == NULL) return 0; actionset = rule->actionset; if (rule->chain_starter != NULL) actionset = rule->chain_starter->actionset; if ((strcasecmp(var->param, "id") == 0)&&(actionset->id != NULL)) { return var_simple_generate(var, vartab, mptmp, actionset->id); } else if ((strcasecmp(var->param, "rev") == 0)&&(actionset->rev != NULL)) { return var_simple_generate(var, vartab, mptmp, actionset->rev); } else if ((strcasecmp(var->param, "severity") == 0)&&(actionset->severity != -1)) { char *value = apr_psprintf(mptmp, "%d", actionset->severity); return var_simple_generate(var, vartab, mptmp, value); } else if ((strcasecmp(var->param, "msg") == 0)&&(actionset->msg != NULL)) { return var_simple_generate(var, vartab, mptmp, actionset->msg); } else if ((strcasecmp(var->param, "logdata") == 0)&&(actionset->logdata != NULL)) { return var_simple_generate(var, vartab, mptmp, actionset->logdata); } else if ((strcasecmp(var->param, "ver") == 0)&&(actionset->version != NULL)) { return var_simple_generate(var, vartab, mptmp, actionset->version); } else if ((strcasecmp(var->param, "maturity") == 0)&&(actionset->maturity != -1)) { char *value = apr_psprintf(mptmp, "%d", actionset->maturity); return var_simple_generate(var, vartab, mptmp, value); } else if ((strcasecmp(var->param, "accuracy") == 0)&&(actionset->accuracy != -1)) { char *value = apr_psprintf(mptmp, "%d", actionset->accuracy); return var_simple_generate(var, vartab, mptmp, value); } return 0; } /* ENV */ static char *var_env_validate(msre_ruleset *ruleset, msre_var *var) { if (var->param == NULL) { return apr_psprintf(ruleset->mp, "Parameter required for ENV."); } if ((strlen(var->param) > 2)&&(var->param[0] == '/') &&(var->param[strlen(var->param) - 1] == '/')) { return apr_psprintf(ruleset->mp, "Regular expressions not supported in ENV."); } return NULL; } static int var_env_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { char *value = get_env_var(msr->r, (char *)var->param); if (value != NULL) { return var_simple_generate(var, vartab, mptmp, value); } return 0; } /* REQUEST_URI_RAW */ static int var_request_uri_raw_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { return var_simple_generate(var, vartab, mptmp, msr->r->unparsed_uri); } /* UNIQUE_ID */ static int var_uniqueid_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { char *value = get_env_var(msr->r, "UNIQUE_ID"); if (value != NULL) { return var_simple_generate(var, vartab, mptmp, value); } return 0; } /* REQUEST_URI */ static int var_request_uri_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) /* dynamic */ { char *value = NULL; if (msr->r->parsed_uri.query == NULL) value = msr->r->parsed_uri.path; else value = apr_pstrcat(mptmp, msr->r->parsed_uri.path, "?", msr->r->parsed_uri.query, NULL); return var_simple_generate(var, vartab, mptmp, value); } /* REQBODY_PROCESSOR */ static int var_reqbody_processor_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { msre_var *rvar = apr_pmemdup(mptmp, var, sizeof(msre_var)); if (msr->msc_reqbody_processor == NULL) { rvar->value = apr_pstrdup(mptmp, ""); rvar->value_len = 0; } else { rvar->value = apr_pstrdup(mptmp, msr->msc_reqbody_processor); rvar->value_len = strlen(rvar->value); } apr_table_addn(vartab, rvar->name, (void *)rvar); return 1; } /* SDBM_DELETE_ERROR */ static int var_sdbm_delete_error_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { msre_var *rvar = apr_pmemdup(mptmp, var, sizeof(msre_var)); rvar->value = apr_psprintf(mptmp, "%d", msr->msc_sdbm_delete_error); rvar->value_len = strlen(rvar->value); apr_table_addn(vartab, rvar->name, (void *)rvar); return 1; } /* REQBODY_ERROR */ static int var_reqbody_processor_error_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { msre_var *rvar = apr_pmemdup(mptmp, var, sizeof(msre_var)); rvar->value = apr_psprintf(mptmp, "%d", msr->msc_reqbody_error); rvar->value_len = strlen(rvar->value); apr_table_addn(vartab, rvar->name, (void *)rvar); return 1; } /* REQBODY_ERROR_MSG */ static int var_reqbody_processor_error_msg_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { msre_var *rvar = apr_pmemdup(mptmp, var, sizeof(msre_var)); if (msr->msc_reqbody_error_msg == NULL) { rvar->value = apr_pstrdup(mptmp, ""); rvar->value_len = 0; } else { rvar->value = apr_psprintf(mptmp, "%s", msr->msc_reqbody_error_msg); rvar->value_len = strlen(rvar->value); } apr_table_addn(vartab, rvar->name, (void *)rvar); return 1; } /* XML */ static char *var_xml_validate(msre_ruleset *ruleset, msre_var *var) { /* It's OK if there's no parameter. */ if (var->param == NULL) return NULL; /* ENH validate XPath expression in advance. */ return NULL; } static int var_xml_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { const apr_array_header_t *tarr; const apr_table_entry_t *telts; xmlXPathContextPtr xpathCtx; xmlXPathObjectPtr xpathObj; xmlNodeSetPtr nodes; const xmlChar* xpathExpr = NULL; int i, count; /* Is there an XML document tree at all? */ if ((msr->xml == NULL)||(msr->xml->doc == NULL)) { /* Sorry, we've got nothing to give! */ return 0; } if (var->param == NULL) { /* Invocation without an XPath expression makes sense * with functions that manipulate the document tree. */ msre_var *rvar = apr_pmemdup(mptmp, var, sizeof(msre_var)); rvar->value = apr_pstrdup(mptmp, "[XML document tree]"); rvar->value_len = strlen(rvar->value); apr_table_addn(vartab, rvar->name, (void *)rvar); return 1; } /* Process the XPath expression. */ count = 0; xpathExpr = (const xmlChar*)var->param; xpathCtx = xmlXPathNewContext(msr->xml->doc); if (xpathCtx == NULL) { msr_log(msr, 1, "XML: Unable to create new XPath context."); return -1; } /* Look through the actionset of the associated rule * for the namespace information. Register them if any are found. */ tarr = apr_table_elts(rule->actionset->actions); telts = (const apr_table_entry_t*)tarr->elts; for (i = 0; i < tarr->nelts; i++) { msre_action *action = (msre_action *)telts[i].val; if (strcasecmp(action->metadata->name, "xmlns") == 0) { char *prefix, *href; if (parse_name_eq_value(mptmp, action->param, &prefix, &href) < 0) return -1; if ((prefix == NULL)||(href == NULL)) return -1; if(xmlXPathRegisterNs(xpathCtx, (const xmlChar*)prefix, (const xmlChar*)href) != 0) { msr_log(msr, 1, "Failed to register XML namespace href \"%s\" prefix \"%s\".", log_escape(mptmp, prefix), log_escape(mptmp, href)); return -1; } msr_log(msr, 4, "Registered XML namespace href \"%s\" prefix \"%s\".", log_escape(mptmp, prefix), log_escape(mptmp, href)); } } /* Initialise XPath expression. */ xpathObj = xmlXPathEvalExpression(xpathExpr, xpathCtx); if (xpathObj == NULL) { msr_log(msr, 1, "XML: Unable to evaluate xpath expression."); xmlXPathFreeContext(xpathCtx); return -1; } /* Evaluate XPath expression. */ nodes = xpathObj->nodesetval; if (nodes == NULL) { xmlXPathFreeObject(xpathObj); xmlXPathFreeContext(xpathCtx); return 0; } /* Create one variable for each node in the result. */ for(i = 0; i < nodes->nodeNr; i++) { msre_var *rvar = NULL; char *content = NULL; content = (char *)xmlNodeGetContent(nodes->nodeTab[i]); if (content != NULL) { rvar = apr_pmemdup(mptmp, var, sizeof(msre_var)); rvar->value = apr_pstrdup(mptmp, content); xmlFree(content); rvar->value_len = strlen(rvar->value); apr_table_addn(vartab, rvar->name, (void *)rvar); count++; } } xmlXPathFreeObject(xpathObj); xmlXPathFreeContext(xpathCtx); return count; } /* WEBSERVER_ERROR_LOG */ static int var_webserver_error_log_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { msre_var *rvar = NULL; int i, count = 0; for(i = 0; i < msr->error_messages->nelts; i++) { error_message_t *em = (((error_message_t **)msr->error_messages->elts)[i]); char *fem = NULL; fem = format_error_log_message(mptmp, em); if (fem != NULL) { rvar = apr_pmemdup(mptmp, var, sizeof(msre_var)); rvar->value = apr_pstrdup(mptmp, fem); rvar->value_len = strlen(rvar->value); apr_table_addn(vartab, rvar->name, (void *)rvar); count++; } } return count; } #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER > 2 static int var_useragent_ip_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { return var_simple_generate(var, vartab, mptmp, msr->useragent_ip ? msr->useragent_ip : "0.0.0.0"); } #endif /* REMOTE_ADDR */ static int var_remote_addr_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { #if !defined(MSC_TEST) #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER > 3 if (ap_find_linked_module("mod_remoteip.c") != NULL) { if(msr->r->useragent_ip != NULL) msr->remote_addr = apr_pstrdup(msr->mp, msr->r->useragent_ip); return var_simple_generate(var, vartab, mptmp, msr->remote_addr); } #endif #endif return var_simple_generate(var, vartab, mptmp, msr->remote_addr); } /* REMOTE_HOST */ static int var_remote_host_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { const char *value1 = ap_get_remote_host(msr->r->connection, msr->r->per_dir_config, REMOTE_NAME, NULL); return var_simple_generate(var, vartab, mptmp, value1); } /* REMOTE_PORT */ static int var_remote_port_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { char *value = apr_psprintf(mptmp, "%u", msr->remote_port); return var_simple_generate(var, vartab, mptmp, value); } /* REMOTE_USER */ static int var_remote_user_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { return var_simple_generate(var, vartab, mptmp, msr->remote_user); } /* TX */ static int var_tx_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { const apr_array_header_t *arr = NULL; const apr_table_entry_t *te = NULL; int i, count = 0; arr = apr_table_elts(msr->tx_vars); te = (apr_table_entry_t *)arr->elts; for (i = 0; i < arr->nelts; i++) { msc_string *str = (msc_string *)te[i].val; int match; /* Figure out if we want to include this variable. */ match = 0; if (var->param == NULL) match = 1; /* Unconditional inclusion. */ else { if (var->param_data != NULL) { /* Regex. */ char *my_error_msg = NULL; if (!(msc_regexec((msc_regex_t *)var->param_data, str->name, str->name_len, &my_error_msg) == PCRE_ERROR_NOMATCH)) match = 1; } else { /* Simple comparison. */ if (strcasecmp(str->name, var->param) == 0) match = 1; } } /* If we had a match add this argument to the collection. */ if (match) { msre_var *rvar = apr_pmemdup(mptmp, var, sizeof(msre_var)); rvar->value = str->value; rvar->value_len = str->value_len; rvar->name = apr_psprintf(mptmp, "TX:%s", log_escape_nq_ex(mptmp, str->name, str->name_len)); apr_table_addn(vartab, rvar->name, (void *)rvar); count++; } } return count; } /* GEO */ static int var_geo_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { const apr_array_header_t *arr = NULL; const apr_table_entry_t *te = NULL; int i, count = 0; arr = apr_table_elts(msr->geo_vars); te = (apr_table_entry_t *)arr->elts; for (i = 0; i < arr->nelts; i++) { msc_string *str = (msc_string *)te[i].val; int match; /* Figure out if we want to include this variable. */ match = 0; if (var->param == NULL) match = 1; /* Unconditional inclusion. */ else { if (var->param_data != NULL) { /* Regex. */ char *my_error_msg = NULL; if (!(msc_regexec((msc_regex_t *)var->param_data, str->name, str->name_len, &my_error_msg) == PCRE_ERROR_NOMATCH)) match = 1; } else { /* Simple comparison. */ if (strcasecmp(str->name, var->param) == 0) match = 1; } } /* If we had a match add this argument to the collection. */ if (match) { msre_var *rvar = apr_pmemdup(mptmp, var, sizeof(msre_var)); rvar->value = str->value; rvar->value_len = str->value_len; rvar->name = apr_psprintf(mptmp, "GEO:%s", log_escape_nq_ex(mptmp, str->name, str->name_len)); apr_table_addn(vartab, rvar->name, (void *)rvar); count++; } } return count; } /* HIGHEST_SEVERITY */ static int var_highest_severity_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { return var_simple_generate(var, vartab, mptmp, apr_psprintf(mptmp, "%d", msr->highest_severity)); } /* IP */ static int var_ip_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { const apr_array_header_t *arr = NULL; const apr_table_entry_t *te = NULL; int i, count = 0; apr_table_t *target_col = NULL; target_col = (apr_table_t *)apr_table_get(msr->collections, "ip"); if (target_col == NULL) return 0; arr = apr_table_elts(target_col); te = (apr_table_entry_t *)arr->elts; for (i = 0; i < arr->nelts; i++) { msc_string *str = (msc_string *)te[i].val; int match; /* Figure out if we want to include this variable. */ match = 0; if (var->param == NULL) match = 1; /* Unconditional inclusion. */ else { if (var->param_data != NULL) { /* Regex. */ char *my_error_msg = NULL; if (!(msc_regexec((msc_regex_t *)var->param_data, str->name, str->name_len, &my_error_msg) == PCRE_ERROR_NOMATCH)) match = 1; } else { /* Simple comparison. */ if (strcasecmp(str->name, var->param) == 0) match = 1; } } /* If we had a match add this argument to the collection. */ if (match) { msre_var *rvar = apr_pmemdup(mptmp, var, sizeof(msre_var)); rvar->value = str->value; rvar->value_len = str->value_len; rvar->name = apr_psprintf(mptmp, "IP:%s", log_escape_nq_ex(mptmp, str->name, str->name_len)); apr_table_addn(vartab, rvar->name, (void *)rvar); count++; } } return count; } /* MATCHED_VAR */ static int var_matched_var_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { return var_simple_generate_ex(var, vartab, mptmp, apr_pmemdup(mptmp, msr->matched_var->value, msr->matched_var->value_len), msr->matched_var->value_len); } /* MATCHED_VAR_NAME */ static int var_matched_var_name_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { return var_simple_generate_ex(var, vartab, mptmp, apr_pmemdup(mptmp, msr->matched_var->name, msr->matched_var->name_len), msr->matched_var->name_len); } /* SESSION */ static int var_session_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { const apr_array_header_t *arr = NULL; const apr_table_entry_t *te = NULL; int i, count = 0; apr_table_t *target_col = NULL; target_col = (apr_table_t *)apr_table_get(msr->collections, "session"); if (target_col == NULL) return 0; arr = apr_table_elts(target_col); te = (apr_table_entry_t *)arr->elts; for (i = 0; i < arr->nelts; i++) { msc_string *str = (msc_string *)te[i].val; int match; /* Figure out if we want to include this variable. */ match = 0; if (var->param == NULL) match = 1; /* Unconditional inclusion. */ else { if (var->param_data != NULL) { /* Regex. */ char *my_error_msg = NULL; if (!(msc_regexec((msc_regex_t *)var->param_data, str->name, str->name_len, &my_error_msg) == PCRE_ERROR_NOMATCH)) match = 1; } else { /* Simple comparison. */ if (strcasecmp(str->name, var->param) == 0) match = 1; } } /* If we had a match add this argument to the collection. */ if (match) { msre_var *rvar = apr_pmemdup(mptmp, var, sizeof(msre_var)); rvar->value = str->value; rvar->value_len = str->value_len; rvar->name = apr_psprintf(mptmp, "SESSION:%s", log_escape_nq_ex(mptmp, str->name, str->name_len)); apr_table_addn(vartab, rvar->name, (void *)rvar); count++; } } return count; } /* USER */ static int var_user_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { const apr_array_header_t *arr = NULL; const apr_table_entry_t *te = NULL; int i, count = 0; apr_table_t *target_col = NULL; target_col = (apr_table_t *)apr_table_get(msr->collections, "user"); if (target_col == NULL) return 0; arr = apr_table_elts(target_col); te = (apr_table_entry_t *)arr->elts; for (i = 0; i < arr->nelts; i++) { msc_string *str = (msc_string *)te[i].val; int match; /* Figure out if we want to include this variable. */ match = 0; if (var->param == NULL) match = 1; /* Unconditional match. */ else { if (var->param_data != NULL) { /* Regex. */ char *my_error_msg = NULL; if (!(msc_regexec((msc_regex_t *)var->param_data, str->name, str->name_len, &my_error_msg) == PCRE_ERROR_NOMATCH)) match = 1; } else { /* Simple comparison. */ if (strcasecmp(str->name, var->param) == 0) match = 1; } } /* If we had a match add this argument to the collection. */ if (match) { msre_var *rvar = apr_pmemdup(mptmp, var, sizeof(msre_var)); rvar->value = str->value; rvar->value_len = str->value_len; rvar->name = apr_psprintf(mptmp, "USER:%s", log_escape_nq_ex(mptmp, str->name, str->name_len)); apr_table_addn(vartab, rvar->name, (void *)rvar); count++; } } return count; } /* GLOBAL */ static int var_global_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { const apr_array_header_t *arr = NULL; const apr_table_entry_t *te = NULL; int i, count = 0; apr_table_t *target_col = NULL; target_col = (apr_table_t *)apr_table_get(msr->collections, "global"); if (target_col == NULL) return 0; arr = apr_table_elts(target_col); te = (apr_table_entry_t *)arr->elts; for (i = 0; i < arr->nelts; i++) { msc_string *str = (msc_string *)te[i].val; int match; /* Figure out if we want to include this variable. */ match = 0; if (var->param == NULL) match = 1; /* Unconditional match. */ else { if (var->param_data != NULL) { /* Regex. */ char *my_error_msg = NULL; if (!(msc_regexec((msc_regex_t *)var->param_data, str->name, str->name_len, &my_error_msg) == PCRE_ERROR_NOMATCH)) match = 1; } else { /* Simple comparison. */ if (strcasecmp(str->name, var->param) == 0) match = 1; } } /* If we had a match add this argument to the collection. */ if (match) { msre_var *rvar = apr_pmemdup(mptmp, var, sizeof(msre_var)); rvar->value = str->value; rvar->value_len = str->value_len; rvar->name = apr_psprintf(mptmp, "GLOBAL:%s", log_escape_nq_ex(mptmp, str->name, str->name_len)); apr_table_addn(vartab, rvar->name, (void *)rvar); count++; } } return count; } /* RESOURCE */ static int var_resource_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { const apr_array_header_t *arr = NULL; const apr_table_entry_t *te = NULL; int i, count = 0; apr_table_t *target_col = NULL; target_col = (apr_table_t *)apr_table_get(msr->collections, "resource"); if (target_col == NULL) return 0; arr = apr_table_elts(target_col); te = (apr_table_entry_t *)arr->elts; for (i = 0; i < arr->nelts; i++) { msc_string *str = (msc_string *)te[i].val; int match; /* Figure out if we want to include this variable. */ match = 0; if (var->param == NULL) match = 1; /* Unconditional match. */ else { if (var->param_data != NULL) { /* Regex. */ char *my_error_msg = NULL; if (!(msc_regexec((msc_regex_t *)var->param_data, str->name, str->name_len, &my_error_msg) == PCRE_ERROR_NOMATCH)) match = 1; } else { /* Simple comparison. */ if (strcasecmp(str->name, var->param) == 0) match = 1; } } /* If we had a match add this argument to the collection. */ if (match) { msre_var *rvar = apr_pmemdup(mptmp, var, sizeof(msre_var)); rvar->value = str->value; rvar->value_len = str->value_len; rvar->name = apr_psprintf(mptmp, "RESOURCE:%s", log_escape_nq_ex(mptmp, str->name, str->name_len)); apr_table_addn(vartab, rvar->name, (void *)rvar); count++; } } return count; } /* FILES_TMPNAMES */ static int var_files_tmpnames_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { multipart_part **parts = NULL; int i, count = 0; if (msr->mpd == NULL) return 0; parts = (multipart_part **)msr->mpd->parts->elts; for(i = 0; i < msr->mpd->parts->nelts; i++) { if ((parts[i]->type == MULTIPART_FILE)&&(parts[i]->tmp_file_name != NULL)) { int match = 0; /* Figure out if we want to include this variable. */ if (var->param == NULL) match = 1; else { if (var->param_data != NULL) { /* Regex. */ char *my_error_msg = NULL; if (!(msc_regexec((msc_regex_t *)var->param_data, parts[i]->name, strlen(parts[i]->name), &my_error_msg) == PCRE_ERROR_NOMATCH)) match = 1; } else { /* Simple comparison. */ if (strcasecmp(parts[i]->name, var->param) == 0) match = 1; } } /* If we had a match add this argument to the collection. */ if (match) { msre_var *rvar = apr_pmemdup(mptmp, var, sizeof(msre_var)); rvar->value = parts[i]->tmp_file_name; rvar->value_len = strlen(rvar->value); rvar->name = apr_psprintf(mptmp, "FILES_TMPNAMES:%s", log_escape_nq(mptmp, parts[i]->name)); apr_table_addn(vartab, rvar->name, (void *)rvar); count++; } } } return count; } /* FILES */ static int var_files_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { multipart_part **parts = NULL; int i, count = 0; if (msr->mpd == NULL) return 0; parts = (multipart_part **)msr->mpd->parts->elts; for(i = 0; i < msr->mpd->parts->nelts; i++) { if (parts[i]->type == MULTIPART_FILE) { int match = 0; /* Figure out if we want to include this variable. */ if (var->param == NULL) match = 1; else { if (var->param_data != NULL) { /* Regex. */ char *my_error_msg = NULL; if (!(msc_regexec((msc_regex_t *)var->param_data, parts[i]->name, strlen(parts[i]->name), &my_error_msg) == PCRE_ERROR_NOMATCH)) match = 1; } else { /* Simple comparison. */ if (strcasecmp(parts[i]->name, var->param) == 0) match = 1; } } /* If we had a match add this argument to the collection. */ if (match) { msre_var *rvar = apr_pmemdup(mptmp, var, sizeof(msre_var)); rvar->value = parts[i]->filename; rvar->value_len = strlen(rvar->value); rvar->name = apr_psprintf(mptmp, "FILES:%s", log_escape_nq(mptmp, parts[i]->name)); apr_table_addn(vartab, rvar->name, (void *)rvar); count++; } } } return count; } /* FILES_SIZES */ static int var_files_sizes_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { multipart_part **parts = NULL; int i, count = 0; if (msr->mpd == NULL) return 0; parts = (multipart_part **)msr->mpd->parts->elts; for(i = 0; i < msr->mpd->parts->nelts; i++) { if (parts[i]->type == MULTIPART_FILE) { int match = 0; /* Figure out if we want to include this variable. */ if (var->param == NULL) match = 1; else { if (var->param_data != NULL) { /* Regex. */ char *my_error_msg = NULL; if (!(msc_regexec((msc_regex_t *)var->param_data, parts[i]->name, strlen(parts[i]->name), &my_error_msg) == PCRE_ERROR_NOMATCH)) match = 1; } else { /* Simple comparison. */ if (strcasecmp(parts[i]->name, var->param) == 0) match = 1; } } /* If we had a match add this argument to the collection. */ if (match) { msre_var *rvar = apr_pmemdup(mptmp, var, sizeof(msre_var)); rvar->value = apr_psprintf(mptmp, "%u", parts[i]->tmp_file_size); rvar->value_len = strlen(rvar->value); rvar->name = apr_psprintf(mptmp, "FILES_SIZES:%s", log_escape_nq(mptmp, parts[i]->name)); apr_table_addn(vartab, rvar->name, (void *)rvar); count++; } } } return count; } /* FILES_NAMES */ static int var_files_names_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { multipart_part **parts = NULL; int i, count = 0; if (msr->mpd == NULL) return 0; parts = (multipart_part **)msr->mpd->parts->elts; for(i = 0; i < msr->mpd->parts->nelts; i++) { if (parts[i]->type == MULTIPART_FILE) { msre_var *rvar = apr_pmemdup(mptmp, var, sizeof(msre_var)); rvar->value = parts[i]->name; rvar->value_len = strlen(rvar->value); rvar->name = apr_psprintf(mptmp, "FILES_NAMES:%s", log_escape_nq_ex(mptmp, parts[i]->name, rvar->value_len)); apr_table_addn(vartab, rvar->name, (void *)rvar); count++; } } return count; } /* FILES_COMBINED_SIZE */ static int var_files_combined_size_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { multipart_part **parts = NULL; msre_var *rvar = NULL; unsigned int combined_size = 0; int i; if (msr->mpd != NULL) { parts = (multipart_part **)msr->mpd->parts->elts; for(i = 0; i < msr->mpd->parts->nelts; i++) { if (parts[i]->type == MULTIPART_FILE) { combined_size += parts[i]->tmp_file_size; } } } rvar = apr_pmemdup(mptmp, var, sizeof(msre_var)); rvar->value = apr_psprintf(mptmp, "%u", combined_size); rvar->value_len = strlen(rvar->value); apr_table_addn(vartab, rvar->name, (void *)rvar); return 1; } /* MODSEC_BUILD */ static int var_modsec_build_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { return var_simple_generate(var, vartab, mptmp, modsec_build(mptmp)); } /* MULTIPART_FILENAME */ static int var_multipart_filename_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { return var_simple_generate(var, vartab, mptmp, msr->multipart_filename); } /* MULTIPART_NAME */ static int var_multipart_name_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { return var_simple_generate(var, vartab, mptmp, msr->multipart_name); } /* MULTIPART_BOUNDARY_QUOTED */ static int var_multipart_boundary_quoted_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { if ((msr->mpd != NULL)&&(msr->mpd->flag_boundary_quoted != 0)) { return var_simple_generate(var, vartab, mptmp, "1"); } else { return var_simple_generate(var, vartab, mptmp, "0"); } } /* MULTIPART_BOUNDARY_WHITESPACE */ static int var_multipart_boundary_whitespace_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { if ((msr->mpd != NULL)&&(msr->mpd->flag_boundary_whitespace != 0)) { return var_simple_generate(var, vartab, mptmp, "1"); } else { return var_simple_generate(var, vartab, mptmp, "0"); } } /* MULTIPART_DATA_AFTER */ static int var_multipart_data_after_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { if ((msr->mpd != NULL)&&(msr->mpd->flag_data_after != 0)) { return var_simple_generate(var, vartab, mptmp, "1"); } else { return var_simple_generate(var, vartab, mptmp, "0"); } } /* MULTIPART_DATA_BEFORE */ static int var_multipart_data_before_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { if ((msr->mpd != NULL)&&(msr->mpd->flag_data_before != 0)) { return var_simple_generate(var, vartab, mptmp, "1"); } else { return var_simple_generate(var, vartab, mptmp, "0"); } } /* MULTIPART_HEADER_FOLDING */ static int var_multipart_header_folding_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { if ((msr->mpd != NULL)&&(msr->mpd->flag_header_folding != 0)) { return var_simple_generate(var, vartab, mptmp, "1"); } else { return var_simple_generate(var, vartab, mptmp, "0"); } } /* MULTIPART_CRLF_LINE */ static int var_multipart_crlf_line_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { if ((msr->mpd != NULL)&&(msr->mpd->flag_crlf_line != 0)) { return var_simple_generate(var, vartab, mptmp, "1"); } else { return var_simple_generate(var, vartab, mptmp, "0"); } } /* MULTIPART_CRLF_LF_LINES */ static int var_multipart_crlf_lf_lines_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { if ((msr->mpd != NULL)&&(msr->mpd->flag_lf_line != 0)&&(msr->mpd->flag_crlf_line != 0)) { return var_simple_generate(var, vartab, mptmp, "1"); } else { return var_simple_generate(var, vartab, mptmp, "0"); } } /* MULTIPART_LF_LINE */ static int var_multipart_lf_line_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { if ((msr->mpd != NULL)&&(msr->mpd->flag_lf_line != 0)) { return var_simple_generate(var, vartab, mptmp, "1"); } else { return var_simple_generate(var, vartab, mptmp, "0"); } } /* MULTIPART_MISSING_SEMICOLON */ static int var_multipart_missing_semicolon_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { if ((msr->mpd != NULL)&&(msr->mpd->flag_missing_semicolon != 0)) { return var_simple_generate(var, vartab, mptmp, "1"); } else { return var_simple_generate(var, vartab, mptmp, "0"); } } /* MULTIPART_INVALID_PART */ static int var_multipart_invalid_part_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { if ((msr->mpd != NULL)&&(msr->mpd->flag_invalid_part != 0)) { return var_simple_generate(var, vartab, mptmp, "1"); } else { return var_simple_generate(var, vartab, mptmp, "0"); } } /* MULTIPART_INVALID_QUOTING */ static int var_multipart_invalid_quoting_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { if ((msr->mpd != NULL)&&(msr->mpd->flag_invalid_quoting != 0)) { return var_simple_generate(var, vartab, mptmp, "1"); } else { return var_simple_generate(var, vartab, mptmp, "0"); } } /* MULTIPART_INVALID_HEADER_FOLDING */ static int var_multipart_invalid_header_folding_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { if ((msr->mpd != NULL)&&(msr->mpd->flag_invalid_header_folding != 0)) { return var_simple_generate(var, vartab, mptmp, "1"); } else { return var_simple_generate(var, vartab, mptmp, "0"); } } /* MULTIPART_FILE_LIMIT_EXCEEDED */ static int var_multipart_file_limit_exceeded_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { if ((msr->mpd != NULL)&&(msr->mpd->flag_file_limit_exceeded != 0)) { return var_simple_generate(var, vartab, mptmp, "1"); } else { return var_simple_generate(var, vartab, mptmp, "0"); } } /* MULTIPART_STRICT_ERROR */ static int var_multipart_strict_error_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { if (msr->mpd != NULL) { /* Respond positive if at least one of the multipart flags is raised. */ if ( (msr->mpd->flag_error) ||(msr->mpd->flag_boundary_quoted != 0) ||(msr->mpd->flag_boundary_whitespace != 0) ||(msr->mpd->flag_data_before != 0) ||(msr->mpd->flag_data_after != 0) ||(msr->mpd->flag_header_folding != 0) ||(msr->mpd->flag_lf_line != 0) ||(msr->mpd->flag_missing_semicolon != 0) ||(msr->mpd->flag_invalid_quoting != 0) ||(msr->mpd->flag_invalid_part != 0) ||(msr->mpd->flag_invalid_header_folding != 0) ||(msr->mpd->flag_file_limit_exceeded != 0) ) { return var_simple_generate(var, vartab, mptmp, "1"); } } return var_simple_generate(var, vartab, mptmp, "0"); } /* MULTIPART_UNMATCHED_BOUNDARY */ static int var_multipart_unmatched_boundary_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { if ((msr->mpd != NULL)&&(msr->mpd->flag_unmatched_boundary != 0)) { return var_simple_generate(var, vartab, mptmp, "1"); } else { return var_simple_generate(var, vartab, mptmp, "0"); } } /* URLENCODED_ERROR */ static int var_urlencoded_error_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { if (msr->urlencoded_error) { return var_simple_generate(var, vartab, mptmp, "1"); } else { return var_simple_generate(var, vartab, mptmp, "0"); } } /* INBOUND_DATA_ERROR */ static int var_inbound_error_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { if (msr->inbound_error) { return var_simple_generate(var, vartab, mptmp, "1"); } else { return var_simple_generate(var, vartab, mptmp, "0"); } } /* OUTBOUND_DATA_ERROR */ static int var_outbound_error_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { if (msr->outbound_error) { return var_simple_generate(var, vartab, mptmp, "1"); } else { return var_simple_generate(var, vartab, mptmp, "0"); } } static apr_time_t calculate_perf_combined(modsec_rec *msr) { return msr->time_phase1 + msr->time_phase2 + msr->time_phase3 + msr->time_phase4 + msr->time_phase5 + msr->time_storage_write /* time_storage_read is already included in phases */ + msr->time_logging + msr->time_gc; } char *format_all_performance_variables(modsec_rec *msr, apr_pool_t *mp) { return apr_psprintf(mp, "combined=%" APR_TIME_T_FMT ", p1=%" APR_TIME_T_FMT ", p2=%" APR_TIME_T_FMT ", p3=%" APR_TIME_T_FMT ", p4=%" APR_TIME_T_FMT ", p5=%" APR_TIME_T_FMT ", sr=%" APR_TIME_T_FMT ", sw=%" APR_TIME_T_FMT ", l=%" APR_TIME_T_FMT ", gc=%" APR_TIME_T_FMT, calculate_perf_combined(msr), msr->time_phase1, msr->time_phase2, msr->time_phase3, msr->time_phase4, msr->time_phase5, msr->time_storage_read, msr->time_storage_write, msr->time_logging, msr->time_gc); } static int generate_performance_variable(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp, apr_time_t value) { msre_var *rvar = NULL; rvar = apr_pmemdup(mptmp, var, sizeof(msre_var)); rvar->value = apr_psprintf(mptmp, "%" APR_TIME_T_FMT, value); rvar->value_len = strlen(rvar->value); apr_table_addn(vartab, rvar->name, (void *)rvar); return 1; } /* PERF_ALL */ static int var_perf_all_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { msre_var *rvar = NULL; rvar = apr_pmemdup(mptmp, var, sizeof(msre_var)); rvar->value = format_all_performance_variables(msr, mptmp); rvar->value_len = strlen(rvar->value); apr_table_addn(vartab, rvar->name, (void *)rvar); return 1; } /* PERF_COMBINED */ static int var_perf_combined_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { return generate_performance_variable(msr, var, rule, vartab, mptmp, calculate_perf_combined(msr)); } /* PERF_GC */ static int var_perf_gc_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { return generate_performance_variable(msr, var, rule, vartab, mptmp, msr->time_gc); } /* PERF_PHASE1 */ static int var_perf_phase1_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { return generate_performance_variable(msr, var, rule, vartab, mptmp, msr->time_phase1); } /* PERF_PHASE2 */ static int var_perf_phase2_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { return generate_performance_variable(msr, var, rule, vartab, mptmp, msr->time_phase2); } /* PERF_PHASE3 */ static int var_perf_phase3_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { return generate_performance_variable(msr, var, rule, vartab, mptmp, msr->time_phase3); } /* PERF_PHASE4 */ static int var_perf_phase4_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { return generate_performance_variable(msr, var, rule, vartab, mptmp, msr->time_phase4); } /* PERF_PHASE5 */ static int var_perf_phase5_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { return generate_performance_variable(msr, var, rule, vartab, mptmp, msr->time_phase5); } /* PERF_SREAD */ static int var_perf_sread_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { return generate_performance_variable(msr, var, rule, vartab, mptmp, msr->time_storage_read); } /* PERF_SWRITE */ static int var_perf_swrite_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { return generate_performance_variable(msr, var, rule, vartab, mptmp, msr->time_storage_write); } /* PERF_LOGGING */ static int var_perf_logging_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { return generate_performance_variable(msr, var, rule, vartab, mptmp, msr->time_logging); } /* PERF_RULES */ static int var_perf_rules_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { const apr_array_header_t *arr = NULL; const apr_table_entry_t *te = NULL; int i, count = 0; arr = apr_table_elts(msr->perf_rules); te = (apr_table_entry_t *)arr->elts; for (i = 0; i < arr->nelts; i++) { int match = 0; /* Figure out if we want to include this variable. */ if (var->param == NULL) match = 1; else { if (var->param_data != NULL) { /* Regex. */ char *my_error_msg = NULL; if (!(msc_regexec((msc_regex_t *)var->param_data, te[i].key, strlen(te[i].key), &my_error_msg) == PCRE_ERROR_NOMATCH)) match = 1; } else { /* Simple comparison. */ if (strcasecmp(te[i].key, var->param) == 0) match = 1; } } /* If we had a match add this argument to the collection. */ if (match) { msre_var *rvar = apr_pmemdup(mptmp, var, sizeof(msre_var)); rvar->value = te[i].val; rvar->value_len = strlen(rvar->value); rvar->name = apr_psprintf(mptmp, "PERF_RULES:%s", log_escape_nq(mptmp, te[i].key)); apr_table_addn(vartab, rvar->name, (void *)rvar); count++; } } return count; } /* DURATION */ static int var_duration_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { msre_var *rvar = NULL; rvar = apr_pmemdup(mptmp, var, sizeof(msre_var)); rvar->value = apr_psprintf(mptmp, "%" APR_TIME_T_FMT, (apr_time_usec(apr_time_now() - msr->r->request_time))); rvar->value_len = strlen(rvar->value); apr_table_addn(vartab, rvar->name, (void *)rvar); return 1; } /* TIME */ static int var_time_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { msre_var *rvar = NULL; struct tm *tm; time_t tc; tc = time(NULL); tm = localtime(&tc); rvar = apr_pmemdup(mptmp, var, sizeof(msre_var)); rvar->value = apr_psprintf(mptmp, "%02d%02d%02d%02d%02d%02d%02d", (tm->tm_year / 100) + 19, (tm->tm_year % 100), tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec); rvar->value_len = strlen(rvar->value); apr_table_addn(vartab, rvar->name, (void *)rvar); return 1; } /* TIME_YEAR */ static int var_time_year_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { msre_var *rvar = NULL; struct tm *tm; time_t tc; tc = time(NULL); tm = localtime(&tc); rvar = apr_pmemdup(mptmp, var, sizeof(msre_var)); rvar->value = apr_psprintf(mptmp, "%02d%02d", (tm->tm_year / 100) + 19, tm->tm_year % 100); rvar->value_len = strlen(rvar->value); apr_table_addn(vartab, rvar->name, (void *)rvar); return 1; } /* TIME_WDAY */ static int var_time_wday_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { msre_var *rvar = NULL; struct tm *tm; time_t tc; tc = time(NULL); tm = localtime(&tc); rvar = apr_pmemdup(mptmp, var, sizeof(msre_var)); rvar->value = apr_psprintf(mptmp, "%d", tm->tm_wday); rvar->value_len = strlen(rvar->value); apr_table_addn(vartab, rvar->name, (void *)rvar); return 1; } /* TIME_SEC */ static int var_time_sec_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { msre_var *rvar = NULL; struct tm *tm; time_t tc; tc = time(NULL); tm = localtime(&tc); rvar = apr_pmemdup(mptmp, var, sizeof(msre_var)); rvar->value = apr_psprintf(mptmp, "%02d", tm->tm_sec); rvar->value_len = strlen(rvar->value); apr_table_addn(vartab, rvar->name, (void *)rvar); return 1; } /* TIME_MIN */ static int var_time_min_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { msre_var *rvar = NULL; struct tm *tm; time_t tc; tc = time(NULL); tm = localtime(&tc); rvar = apr_pmemdup(mptmp, var, sizeof(msre_var)); rvar->value = apr_psprintf(mptmp, "%02d", tm->tm_min); rvar->value_len = strlen(rvar->value); apr_table_addn(vartab, rvar->name, (void *)rvar); return 1; } /* TIME_HOUR */ static int var_time_hour_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { msre_var *rvar = NULL; struct tm *tm; time_t tc; tc = time(NULL); tm = localtime(&tc); rvar = apr_pmemdup(mptmp, var, sizeof(msre_var)); rvar->value = apr_psprintf(mptmp, "%02d", tm->tm_hour); rvar->value_len = strlen(rvar->value); apr_table_addn(vartab, rvar->name, (void *)rvar); return 1; } /* TIME_MON */ static int var_time_mon_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { msre_var *rvar = NULL; struct tm *tm; time_t tc; tc = time(NULL); tm = localtime(&tc); rvar = apr_pmemdup(mptmp, var, sizeof(msre_var)); rvar->value = apr_psprintf(mptmp, "%02d", tm->tm_mon + 1); rvar->value_len = strlen(rvar->value); apr_table_addn(vartab, rvar->name, (void *)rvar); return 1; } /* TIME_DAY */ static int var_time_day_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { msre_var *rvar = NULL; struct tm *tm; time_t tc; tc = time(NULL); tm = localtime(&tc); rvar = apr_pmemdup(mptmp, var, sizeof(msre_var)); rvar->value = apr_psprintf(mptmp, "%02d", tm->tm_mday); rvar->value_len = strlen(rvar->value); apr_table_addn(vartab, rvar->name, (void *)rvar); return 1; } /* TIME_EPOCH */ static int var_time_epoch_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { msre_var *rvar = NULL; time_t tc; tc = time(NULL); rvar = apr_pmemdup(mptmp, var, sizeof(msre_var)); rvar->value = apr_psprintf(mptmp, "%ld", (long)tc); rvar->value_len = strlen(rvar->value); apr_table_addn(vartab, rvar->name, (void *)rvar); return 1; } /* QUERY_STRING */ static int var_query_string_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { return var_simple_generate(var, vartab, mptmp, msr->query_string); } /* REQUEST_BASENAME */ static int var_request_basename_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { char *value = file_basename(mptmp, msr->r->parsed_uri.path); return var_simple_generate(var, vartab, mptmp, value); } /* REQUEST_BODY */ static int var_request_body_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { if (msr->msc_reqbody_buffer != NULL) { return var_simple_generate_ex(var, vartab, mptmp, msr->msc_reqbody_buffer, msr->msc_reqbody_length); } return 0; } /* REQUEST_BODY_LENGTH */ static int var_request_body_length_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { char *value = apr_psprintf(mptmp, "%d", msr->msc_reqbody_length); return var_simple_generate(var, vartab, mptmp, value); } /* MATCHED_VARS_NAMES */ static int var_matched_vars_names_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { const apr_array_header_t *arr = NULL; const apr_table_entry_t *te = NULL; int i, count = 0; arr = apr_table_elts(msr->matched_vars); te = (apr_table_entry_t *)arr->elts; for (i = 0; i < arr->nelts; i++) { int match = 0; msc_string *str = (msc_string *)te[i].val; /* Figure out if we want to include this variable. */ if (var->param == NULL) match = 1; else { if (var->param_data != NULL) { /* Regex. */ char *my_error_msg = NULL; if (!(msc_regexec((msc_regex_t *)var->param_data, str->name, strlen(str->name), &my_error_msg) == PCRE_ERROR_NOMATCH)) match = 1; } else { /* Simple comparison. */ if (strcasecmp(str->name, var->param) == 0) match = 1; } } /* If we had a match add this argument to the collection. */ if (match && (strncmp(str->name,"MATCHED_VARS:",13) != 0) && (strncmp(str->name,"MATCHED_VARS_NAMES:",19))) { msre_var *rvar = apr_palloc(mptmp, sizeof(msre_var)); rvar->value = apr_pstrndup(mptmp, str->name, strlen(str->name)); rvar->value_len = strlen(rvar->value); rvar->name = apr_psprintf(mptmp, "%s", log_escape_nq(mptmp, str->name)); if(var->is_counting == 0) rvar->is_counting = 0; else rvar->is_counting = 1; if(var->is_negated == 0) rvar->is_negated = 0; else rvar->is_negated = 1; apr_table_addn(vartab, rvar->name, (void *)rvar); if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Set variable \"%s\" size %d to collection.", rvar->name,rvar->value_len); } count++; } } return count; } /* MATCHED_VARS */ static int var_matched_vars_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { const apr_array_header_t *arr = NULL; const apr_table_entry_t *te = NULL; int i, count = 0; arr = apr_table_elts(msr->matched_vars); te = (apr_table_entry_t *)arr->elts; for (i = 0; i < arr->nelts; i++) { int match = 0; msc_string *str = (msc_string *)te[i].val; /* Figure out if we want to include this variable. */ if (var->param == NULL) match = 1; else { if (var->param_data != NULL) { /* Regex. */ char *my_error_msg = NULL; if (!(msc_regexec((msc_regex_t *)var->param_data, str->name, strlen(str->name), &my_error_msg) == PCRE_ERROR_NOMATCH)) match = 1; } else { /* Simple comparison. */ if (strcasecmp(str->name, var->param) == 0) match = 1; } } /* If we had a match add this argument to the collection. */ if (match && (strncmp(str->name,"MATCHED_VARS:",13) != 0) && (strncmp(str->name,"MATCHED_VARS_NAMES:",19))) { msre_var *rvar = apr_palloc(mptmp, sizeof(msre_var)); rvar->value = apr_pstrndup(mptmp, str->value, str->value_len); rvar->value_len = str->value_len; rvar->name = apr_psprintf(mptmp, "%s", log_escape_nq(mptmp, str->name)); if(var->is_counting == 0) rvar->is_counting = 0; else rvar->is_counting = 1; if(var->is_negated == 0) rvar->is_negated = 0; else rvar->is_negated = 1; apr_table_addn(vartab, rvar->name, (void *)rvar); if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Set variable \"%s\" value \"%s\" size %d to collection.", rvar->name, rvar->value, rvar->value_len); } count++; } } return count; } /* REQUEST_COOKIES */ static int var_request_cookies_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { const apr_array_header_t *arr = NULL; const apr_table_entry_t *te = NULL; int i, count = 0; arr = apr_table_elts(msr->request_cookies); te = (apr_table_entry_t *)arr->elts; for (i = 0; i < arr->nelts; i++) { int match = 0; /* Figure out if we want to include this variable. */ if (var->param == NULL) match = 1; else { if (var->param_data != NULL) { /* Regex. */ char *my_error_msg = NULL; if (!(msc_regexec((msc_regex_t *)var->param_data, te[i].key, strlen(te[i].key), &my_error_msg) == PCRE_ERROR_NOMATCH)) match = 1; } else { /* Simple comparison. */ if (strcasecmp(te[i].key, var->param) == 0) match = 1; } } /* If we had a match add this argument to the collection. */ if (match) { msre_var *rvar = apr_pmemdup(mptmp, var, sizeof(msre_var)); rvar->value = te[i].val; rvar->value_len = strlen(rvar->value); rvar->name = apr_psprintf(mptmp, "REQUEST_COOKIES:%s", log_escape_nq(mptmp, te[i].key)); apr_table_addn(vartab, rvar->name, (void *)rvar); count++; } } return count; } /* REQUEST_COOKIES_NAMES */ static int var_request_cookies_names_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { const apr_array_header_t *arr = NULL; const apr_table_entry_t *te = NULL; int i, count = 0; arr = apr_table_elts(msr->request_cookies); te = (apr_table_entry_t *)arr->elts; for (i = 0; i < arr->nelts; i++) { int match = 0; /* Figure out if we want to include this variable. */ if (var->param == NULL) match = 1; else { if (var->param_data != NULL) { /* Regex. */ char *my_error_msg = NULL; if (!(msc_regexec((msc_regex_t *)var->param_data, te[i].key, strlen(te[i].key), &my_error_msg) == PCRE_ERROR_NOMATCH)) match = 1; } else { /* Simple comparison. */ if (strcasecmp(te[i].key, var->param) == 0) match = 1; } } /* If we had a match add this argument to the collection. */ if (match) { msre_var *rvar = apr_pmemdup(mptmp, var, sizeof(msre_var)); rvar->value = te[i].key; rvar->value_len = strlen(rvar->value); rvar->name = apr_psprintf(mptmp, "REQUEST_COOKIES_NAMES:%s", log_escape_nq(mptmp, te[i].key)); apr_table_addn(vartab, rvar->name, (void *)rvar); count++; } } return count; } /* REQUEST_HEADERS */ static int var_request_headers_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { const apr_array_header_t *arr = NULL; const apr_table_entry_t *te = NULL; int i, count = 0; arr = apr_table_elts(msr->request_headers); te = (apr_table_entry_t *)arr->elts; for (i = 0; i < arr->nelts; i++) { int match = 0; /* Figure out if we want to include this variable. */ if (var->param == NULL) match = 1; else { if (var->param_data != NULL) { /* Regex. */ char *my_error_msg = NULL; if (!(msc_regexec((msc_regex_t *)var->param_data, te[i].key, strlen(te[i].key), &my_error_msg) == PCRE_ERROR_NOMATCH)) match = 1; } else { /* Simple comparison. */ if (strcasecmp(te[i].key, var->param) == 0) match = 1; } } /* If we had a match add this argument to the collection. */ if (match) { msre_var *rvar = apr_pmemdup(mptmp, var, sizeof(msre_var)); rvar->value = te[i].val; rvar->value_len = strlen(rvar->value); rvar->name = apr_psprintf(mptmp, "REQUEST_HEADERS:%s", log_escape_nq(mptmp, te[i].key)); apr_table_addn(vartab, rvar->name, (void *)rvar); count++; } } return count; } /* REQUEST_HEADERS_NAMES */ static int var_request_headers_names_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { const apr_array_header_t *arr = NULL; const apr_table_entry_t *te = NULL; int i, count = 0; arr = apr_table_elts(msr->request_headers); te = (apr_table_entry_t *)arr->elts; for (i = 0; i < arr->nelts; i++) { int match = 0; /* Figure out if we want to include this variable. */ if (var->param == NULL) match = 1; else { if (var->param_data != NULL) { /* Regex. */ char *my_error_msg = NULL; if (!(msc_regexec((msc_regex_t *)var->param_data, te[i].key, strlen(te[i].key), &my_error_msg) == PCRE_ERROR_NOMATCH)) match = 1; } else { /* Simple comparison. */ if (strcasecmp(te[i].key, var->param) == 0) match = 1; } } /* If we had a match add this argument to the collection. */ if (match) { msre_var *rvar = apr_pmemdup(mptmp, var, sizeof(msre_var)); rvar->value = te[i].key; rvar->value_len = strlen(rvar->value); rvar->name = apr_psprintf(mptmp, "REQUEST_HEADERS_NAMES:%s", log_escape_nq(mptmp, te[i].key)); apr_table_addn(vartab, rvar->name, (void *)rvar); count++; } } return count; } /* REQUEST_FILENAME */ static int var_request_filename_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { return var_simple_generate(var, vartab, mptmp, msr->r->parsed_uri.path); } /* REQUEST_LINE */ static int var_request_line_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { return var_simple_generate(var, vartab, mptmp, msr->request_line); } /* REQUEST_METHOD */ static int var_request_method_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { return var_simple_generate(var, vartab, mptmp, msr->request_method); } /* REQUEST_PROTOCOL */ static int var_request_protocol_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { return var_simple_generate(var, vartab, mptmp, msr->request_protocol); } /* SERVER_ADDR */ static int var_server_addr_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { return var_simple_generate(var, vartab, mptmp, msr->local_addr); } /* SERVER_NAME */ static int var_server_name_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { return var_simple_generate(var, vartab, mptmp, msr->hostname); } /* SERVER_PORT */ static int var_server_port_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { char *value = apr_psprintf(mptmp, "%u", msr->local_port); return var_simple_generate(var, vartab, mptmp, value); } /* SCRIPT_BASENAME */ static int var_script_basename_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { char *value = file_basename(mptmp, msr->r->filename); return var_simple_generate(var, vartab, mptmp, value); } /* SCRIPT_FILENAME */ static int var_script_filename_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { char *value = msr->r->filename; return var_simple_generate(var, vartab, mptmp, value); } /* SCRIPT_GID */ static int var_script_gid_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { char *value = apr_psprintf(mptmp, "%ld", (long)msr->r->finfo.group); return var_simple_generate(var, vartab, mptmp, value); } /* SCRIPT_GROUPNAME */ static int var_script_groupname_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { char *value = NULL; if (apr_gid_name_get(&value, msr->r->finfo.group, mptmp) == APR_SUCCESS) { return var_simple_generate(var, vartab, mptmp, value); } return 0; } /* SCRIPT_MODE */ static int var_script_mode_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { char *value = apr_psprintf(mptmp, "%04x", msr->r->finfo.protection); return var_simple_generate(var, vartab, mptmp, value); } /* SCRIPT_UID */ static int var_script_uid_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { char *value = apr_psprintf(mptmp, "%ld", (long)msr->r->finfo.user); return var_simple_generate(var, vartab, mptmp, value); } /* SCRIPT_USERNAME */ static int var_script_username_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { char *value = NULL; if (apr_uid_name_get(&value, msr->r->finfo.user, mptmp) == APR_SUCCESS) { return var_simple_generate(var, vartab, mptmp, value); } return 0; } /* AUTH_TYPE */ static int var_auth_type_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { char *value = msr->r->ap_auth_type; return var_simple_generate(var, vartab, mptmp, value); } /* PATH_INFO */ static int var_path_info_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { const char *value = msr->r->path_info; return var_simple_generate(var, vartab, mptmp, value); } /* STREAM_OUTPUT_BODY */ static int var_stream_output_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { if (msr->stream_output_data != NULL) { return var_simple_generate_ex(var, vartab, mptmp, msr->stream_output_data, msr->stream_output_length); } return 0; } /* STREAM_INPUT_BODY */ static int var_stream_input_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { if (msr->stream_input_data != NULL) { return var_simple_generate_ex(var, vartab, mptmp, msr->stream_input_data, msr->stream_input_length); } return 0; } /* RESPONSE_BODY */ static int var_response_body_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { if (msr->resbody_data != NULL) { return var_simple_generate_ex(var, vartab, mptmp, msr->resbody_data, msr->resbody_length); } return 0; } /* RESPONSE_HEADERS */ static int var_response_headers_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { const apr_array_header_t *arr = NULL; const apr_table_entry_t *te = NULL; int i, count = 0; if (msr->response_headers == NULL) return 0; arr = apr_table_elts(msr->response_headers); te = (apr_table_entry_t *)arr->elts; for (i = 0; i < arr->nelts; i++) { int match = 0; /* Figure out if we want to include this variable. */ if (var->param == NULL) match = 1; else { if (var->param_data != NULL) { /* Regex. */ char *my_error_msg = NULL; if (!(msc_regexec((msc_regex_t *)var->param_data, te[i].key, strlen(te[i].key), &my_error_msg) == PCRE_ERROR_NOMATCH)) match = 1; } else { /* Simple comparison. */ if (strcasecmp(te[i].key, var->param) == 0) match = 1; } } /* If we had a match add this argument to the collection. */ if (match) { msre_var *rvar = apr_pmemdup(mptmp, var, sizeof(msre_var)); rvar->value = te[i].val; rvar->value_len = strlen(rvar->value); rvar->name = apr_psprintf(mptmp, "RESPONSE_HEADERS:%s", log_escape_nq(mptmp, te[i].key)); apr_table_addn(vartab, rvar->name, (void *)rvar); count++; } } return count; } /* RESPONSE_HEADERS_NAMES */ static int var_response_headers_names_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { const apr_array_header_t *arr = NULL; const apr_table_entry_t *te = NULL; int i, count = 0; arr = apr_table_elts(msr->response_headers); te = (apr_table_entry_t *)arr->elts; for (i = 0; i < arr->nelts; i++) { int match = 0; /* Figure out if we want to include this variable. */ if (var->param == NULL) match = 1; else { if (var->param_data != NULL) { /* Regex. */ char *my_error_msg = NULL; if (!(msc_regexec((msc_regex_t *)var->param_data, te[i].key, strlen(te[i].key), &my_error_msg) == PCRE_ERROR_NOMATCH)) match = 1; } else { /* Simple comparison. */ if (strcasecmp(te[i].key, var->param) == 0) match = 1; } } /* If we had a match add this argument to the collection. */ if (match) { msre_var *rvar = apr_pmemdup(mptmp, var, sizeof(msre_var)); rvar->value = te[i].key; rvar->value_len = strlen(rvar->value); rvar->name = apr_psprintf(mptmp, "RESPONSE_HEADERS_NAMES:%s", log_escape_nq(mptmp, te[i].key)); apr_table_addn(vartab, rvar->name, (void *)rvar); count++; } } return count; } /* STATUS_LINE */ static int var_status_line_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { const char *value = msr->status_line; return var_simple_generate(var, vartab, mptmp, value); } /* RESPONSE_PROTOCOL */ static int var_response_protocol_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { const char *value = msr->response_protocol; return var_simple_generate(var, vartab, mptmp, value); } /* RESPONSE_STATUS */ static int var_response_status_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { const char *value = apr_psprintf(mptmp, "%u", msr->response_status); return var_simple_generate(var, vartab, mptmp, value); } /* RESPONSE_CONTENT_TYPE */ static int var_response_content_type(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { return var_simple_generate(var, vartab, mptmp, msr->r->content_type); } /* RESPONSE_CONTENT_LENGTH */ static int var_response_content_length(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { const char *value = apr_psprintf(mptmp, "%" APR_OFF_T_FMT, msr->r->clength); return var_simple_generate(var, vartab, mptmp, value); } /* USERID */ static int var_userid_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { const char *value = msr->userid; return var_simple_generate(var, vartab, mptmp, value); } /* SESSIONID */ static int var_sessionid_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { const char *value = msr->sessionid; return var_simple_generate(var, vartab, mptmp, value); } /* WEBAPPID */ static int var_webappid_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { const char *value = msr->txcfg->webappid; return var_simple_generate(var, vartab, mptmp, value); } /* ---------------------------------------------- */ /** * */ void msre_engine_variable_register(msre_engine *engine, const char *name, unsigned int type, unsigned int argc_min, unsigned int argc_max, fn_var_validate_t validate, fn_var_generate_t generate, unsigned int is_cacheable, unsigned int availability) { msre_var_metadata *metadata = (msre_var_metadata *)apr_pcalloc(engine->mp, sizeof(msre_var_metadata)); if (metadata == NULL) return; metadata->name = name; metadata->type = type; metadata->argc_min = argc_min; metadata->argc_max = argc_max; metadata->validate = validate; metadata->generate = generate; metadata->is_cacheable = is_cacheable; metadata->availability = availability; apr_table_setn(engine->variables, name, (void *)metadata); } /** * */ void msre_engine_register_default_variables(msre_engine *engine) { /* ARGS */ msre_engine_variable_register(engine, "ARGS", VAR_LIST, 0, 1, var_generic_list_validate, var_args_generate, VAR_CACHE, PHASE_REQUEST_HEADERS ); /* ARGS_COMBINED_SIZE */ msre_engine_variable_register(engine, "ARGS_COMBINED_SIZE", VAR_LIST, 0, 0, NULL, var_args_combined_size_generate, VAR_DONT_CACHE, /* dynamic */ PHASE_REQUEST_HEADERS ); /* ARGS_GET */ msre_engine_variable_register(engine, "ARGS_GET", VAR_LIST, 0, 1, var_generic_list_validate, var_args_get_generate, VAR_CACHE, PHASE_REQUEST_HEADERS ); /* ARGS_GET_NAMES */ msre_engine_variable_register(engine, "ARGS_GET_NAMES", VAR_LIST, 0, 1, var_generic_list_validate, var_args_get_names_generate, VAR_CACHE, PHASE_REQUEST_HEADERS ); /* ARGS_NAMES */ msre_engine_variable_register(engine, "ARGS_NAMES", VAR_LIST, 0, 1, var_generic_list_validate, var_args_names_generate, VAR_CACHE, PHASE_REQUEST_HEADERS ); /* ARGS_POST */ msre_engine_variable_register(engine, "ARGS_POST", VAR_LIST, 0, 1, var_generic_list_validate, var_args_post_generate, VAR_CACHE, PHASE_REQUEST_BODY ); /* ARGS_POST_NAMES */ msre_engine_variable_register(engine, "ARGS_POST_NAMES", VAR_LIST, 0, 1, var_generic_list_validate, var_args_post_names_generate, VAR_CACHE, PHASE_REQUEST_BODY ); /* AUTH_TYPE */ msre_engine_variable_register(engine, "AUTH_TYPE", VAR_SIMPLE, 0, 0, NULL, var_auth_type_generate, VAR_CACHE, PHASE_REQUEST_BODY ); /* ENV */ msre_engine_variable_register(engine, "ENV", VAR_LIST, 0, 1, var_env_validate, var_env_generate, VAR_DONT_CACHE, PHASE_REQUEST_HEADERS ); /* FILES */ msre_engine_variable_register(engine, "FILES", VAR_LIST, 0, 1, var_generic_list_validate, var_files_generate, VAR_CACHE, PHASE_REQUEST_BODY ); /* FILES_COMBINED_SIZE */ msre_engine_variable_register(engine, "FILES_COMBINED_SIZE", VAR_LIST, 0, 0, NULL, var_files_combined_size_generate, VAR_DONT_CACHE, /* temp copy */ PHASE_REQUEST_BODY ); /* FILES_NAMES */ msre_engine_variable_register(engine, "FILES_NAMES", VAR_LIST, 0, 0, NULL, var_files_names_generate, VAR_CACHE, PHASE_REQUEST_BODY ); /* FILES_SIZES */ msre_engine_variable_register(engine, "FILES_SIZES", VAR_LIST, 0, 1, var_generic_list_validate, var_files_sizes_generate, VAR_DONT_CACHE, /* temp copy */ PHASE_REQUEST_BODY ); /* FILES_TMPNAMES */ msre_engine_variable_register(engine, "FILES_TMPNAMES", VAR_LIST, 0, 1, var_generic_list_validate, var_files_tmpnames_generate, VAR_CACHE, PHASE_REQUEST_BODY ); /* GEO */ msre_engine_variable_register(engine, "GEO", VAR_LIST, 0, 1, var_generic_list_validate, var_geo_generate, VAR_DONT_CACHE, /* dynamic */ PHASE_REQUEST_HEADERS ); /* GLOBAL */ msre_engine_variable_register(engine, "GLOBAL", VAR_LIST, 1, 1, var_generic_list_validate, var_global_generate, VAR_DONT_CACHE, /* dynamic */ PHASE_REQUEST_HEADERS ); /* HIGHEST_SEVERITY */ msre_engine_variable_register(engine, "HIGHEST_SEVERITY", VAR_SIMPLE, 0, 0, NULL, var_highest_severity_generate, VAR_DONT_CACHE, /* dynamic */ PHASE_REQUEST_HEADERS ); /* IP */ msre_engine_variable_register(engine, "IP", VAR_LIST, 1, 1, var_generic_list_validate, var_ip_generate, VAR_DONT_CACHE, /* dynamic */ PHASE_REQUEST_HEADERS ); /* MATCHED_VAR */ msre_engine_variable_register(engine, "MATCHED_VAR", VAR_SIMPLE, 0, 0, NULL, var_matched_var_generate, VAR_DONT_CACHE, /* dynamic */ PHASE_REQUEST_HEADERS ); /* MATCHED_VAR_NAME */ msre_engine_variable_register(engine, "MATCHED_VAR_NAME", VAR_SIMPLE, 0, 0, NULL, var_matched_var_name_generate, VAR_DONT_CACHE, /* dynamic */ PHASE_REQUEST_HEADERS ); /* MODSEC_BUILD */ msre_engine_variable_register(engine, "MODSEC_BUILD", VAR_SIMPLE, 0, 0, NULL, var_modsec_build_generate, VAR_CACHE, PHASE_REQUEST_HEADERS ); /* MULTIPART_FILENAME */ msre_engine_variable_register(engine, "MULTIPART_FILENAME", VAR_SIMPLE, 0, 0, NULL, var_multipart_filename_generate, VAR_CACHE, PHASE_REQUEST_BODY ); /* MULTIPART_NAME */ msre_engine_variable_register(engine, "MULTIPART_NAME", VAR_SIMPLE, 0, 0, NULL, var_multipart_name_generate, VAR_CACHE, PHASE_REQUEST_BODY ); /* MULTIPART_BOUNDARY_QUOTED */ msre_engine_variable_register(engine, "MULTIPART_BOUNDARY_QUOTED", VAR_SIMPLE, 0, 0, NULL, var_multipart_boundary_quoted_generate, VAR_DONT_CACHE, /* flag */ PHASE_REQUEST_BODY ); /* MULTIPART_BOUNDARY_WHITESPACE */ msre_engine_variable_register(engine, "MULTIPART_BOUNDARY_WHITESPACE", VAR_SIMPLE, 0, 0, NULL, var_multipart_boundary_whitespace_generate, VAR_DONT_CACHE, /* flag */ PHASE_REQUEST_BODY ); /* MULTIPART_DATA_AFTER */ msre_engine_variable_register(engine, "MULTIPART_DATA_AFTER", VAR_SIMPLE, 0, 0, NULL, var_multipart_data_after_generate, VAR_DONT_CACHE, /* flag */ PHASE_REQUEST_BODY ); /* MULTIPART_DATA_BEFORE */ msre_engine_variable_register(engine, "MULTIPART_DATA_BEFORE", VAR_SIMPLE, 0, 0, NULL, var_multipart_data_before_generate, VAR_DONT_CACHE, /* flag */ PHASE_REQUEST_BODY ); /* MULTIPART_HEADER_FOLDING */ msre_engine_variable_register(engine, "MULTIPART_HEADER_FOLDING", VAR_SIMPLE, 0, 0, NULL, var_multipart_header_folding_generate, VAR_DONT_CACHE, /* flag */ PHASE_REQUEST_BODY ); /* MULTIPART_CRLF_LINE */ msre_engine_variable_register(engine, "MULTIPART_CRLF_LINE", VAR_SIMPLE, 0, 0, NULL, var_multipart_crlf_line_generate, VAR_DONT_CACHE, /* flag */ PHASE_REQUEST_BODY ); /* MULTIPART_CRLF_LF_LINES */ msre_engine_variable_register(engine, "MULTIPART_CRLF_LF_LINES", VAR_SIMPLE, 0, 0, NULL, var_multipart_crlf_lf_lines_generate, VAR_DONT_CACHE, /* flag */ PHASE_REQUEST_BODY ); /* MULTIPART_LF_LINE */ msre_engine_variable_register(engine, "MULTIPART_LF_LINE", VAR_SIMPLE, 0, 0, NULL, var_multipart_lf_line_generate, VAR_DONT_CACHE, /* flag */ PHASE_REQUEST_BODY ); /* MULTIPART_MISSING_SEMICOLON */ msre_engine_variable_register(engine, "MULTIPART_MISSING_SEMICOLON", VAR_SIMPLE, 0, 0, NULL, var_multipart_missing_semicolon_generate, VAR_DONT_CACHE, /* flag */ PHASE_REQUEST_BODY ); /* MULTIPART_INVALID_PART */ msre_engine_variable_register(engine, "MULTIPART_INVALID_PART", VAR_SIMPLE, 0, 0, NULL, var_multipart_invalid_part_generate, VAR_DONT_CACHE, /* flag */ PHASE_REQUEST_BODY ); /* MULTIPART_INVALID_QUOTING */ msre_engine_variable_register(engine, "MULTIPART_INVALID_QUOTING", VAR_SIMPLE, 0, 0, NULL, var_multipart_invalid_quoting_generate, VAR_DONT_CACHE, /* flag */ PHASE_REQUEST_BODY ); /* MULTIPART_INVALID_HEADER_FOLDING */ msre_engine_variable_register(engine, "MULTIPART_INVALID_HEADER_FOLDING", VAR_SIMPLE, 0, 0, NULL, var_multipart_invalid_header_folding_generate, VAR_DONT_CACHE, /* flag */ PHASE_REQUEST_BODY ); /* MULTIPART_FILE_LIMIT_EXCEEDED */ msre_engine_variable_register(engine, "MULTIPART_FILE_LIMIT_EXCEEDED", VAR_SIMPLE, 0, 0, NULL, var_multipart_file_limit_exceeded_generate, VAR_DONT_CACHE, /* flag */ PHASE_REQUEST_BODY ); /* MULTIPART_STRICT_ERROR */ msre_engine_variable_register(engine, "MULTIPART_STRICT_ERROR", VAR_SIMPLE, 0, 0, NULL, var_multipart_strict_error_generate, VAR_DONT_CACHE, /* flag */ PHASE_REQUEST_BODY ); /* MULTIPART_UNMATCHED_BOUNDARY */ msre_engine_variable_register(engine, "MULTIPART_UNMATCHED_BOUNDARY", VAR_SIMPLE, 0, 0, NULL, var_multipart_unmatched_boundary_generate, VAR_DONT_CACHE, /* flag */ PHASE_REQUEST_BODY ); /* PATH_INFO */ msre_engine_variable_register(engine, "PATH_INFO", VAR_SIMPLE, 0, 0, NULL, var_path_info_generate, VAR_CACHE, PHASE_REQUEST_BODY ); /* QUERY_STRING */ msre_engine_variable_register(engine, "QUERY_STRING", VAR_SIMPLE, 0, 0, NULL, var_query_string_generate, VAR_CACHE, PHASE_REQUEST_HEADERS ); #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER > 2 /* USERAGENT_IP */ msre_engine_variable_register(engine, "USERAGENT_IP", VAR_SIMPLE, 0, 0, NULL, var_useragent_ip_generate, VAR_CACHE, PHASE_REQUEST_HEADERS ); #endif /* REMOTE_ADDR */ msre_engine_variable_register(engine, "REMOTE_ADDR", VAR_SIMPLE, 0, 0, NULL, var_remote_addr_generate, VAR_CACHE, PHASE_REQUEST_HEADERS ); /* REMOTE_HOST */ msre_engine_variable_register(engine, "REMOTE_HOST", VAR_SIMPLE, 0, 0, NULL, var_remote_host_generate, VAR_CACHE, PHASE_REQUEST_BODY ); /* REMOTE_PORT */ msre_engine_variable_register(engine, "REMOTE_PORT", VAR_SIMPLE, 0, 0, NULL, var_remote_port_generate, VAR_DONT_CACHE, /* temp copy */ PHASE_REQUEST_BODY ); /* REMOTE_USER */ msre_engine_variable_register(engine, "REMOTE_USER", VAR_SIMPLE, 0, 0, NULL, var_remote_user_generate, VAR_CACHE, PHASE_REQUEST_BODY ); /* RESOURCE */ msre_engine_variable_register(engine, "RESOURCE", VAR_LIST, 1, 1, var_generic_list_validate, var_resource_generate, VAR_DONT_CACHE, /* dynamic */ PHASE_REQUEST_HEADERS ); /* REQBODY_PROCESSOR */ msre_engine_variable_register(engine, "REQBODY_PROCESSOR", VAR_SIMPLE, 0, 0, NULL, var_reqbody_processor_generate, VAR_DONT_CACHE, /* temp copy */ PHASE_REQUEST_HEADERS ); msre_engine_variable_register(engine, "SDBM_DELETE_ERROR", VAR_SIMPLE, 0, 0, NULL, var_sdbm_delete_error_generate, VAR_DONT_CACHE, /* dynamic */ PHASE_REQUEST_BODY ); /* REQBODY_PROCESSOR_ERROR - Deprecated */ msre_engine_variable_register(engine, "REQBODY_PROCESSOR_ERROR", VAR_SIMPLE, 0, 0, NULL, var_reqbody_processor_error_generate, VAR_DONT_CACHE, /* dynamic */ PHASE_REQUEST_BODY ); /* REQBODY_PROCESSOR_ERROR_MSG - Deprecated */ msre_engine_variable_register(engine, "REQBODY_PROCESSOR_ERROR_MSG", VAR_SIMPLE, 0, 0, NULL, var_reqbody_processor_error_msg_generate, VAR_DONT_CACHE, /* dynamic */ PHASE_REQUEST_BODY ); /* REQBODY_ERROR */ msre_engine_variable_register(engine, "REQBODY_ERROR", VAR_SIMPLE, 0, 0, NULL, var_reqbody_processor_error_generate, VAR_DONT_CACHE, /* dynamic */ PHASE_REQUEST_BODY ); /* REQBODY_ERROR_MSG */ msre_engine_variable_register(engine, "REQBODY_ERROR_MSG", VAR_SIMPLE, 0, 0, NULL, var_reqbody_processor_error_msg_generate, VAR_DONT_CACHE, /* dynamic */ PHASE_REQUEST_BODY ); /* REQUEST_BASENAME */ msre_engine_variable_register(engine, "REQUEST_BASENAME", VAR_SIMPLE, 0, 0, NULL, var_request_basename_generate, VAR_DONT_CACHE, /* temp copy */ PHASE_REQUEST_HEADERS ); /* REQUEST_BODY */ msre_engine_variable_register(engine, "REQUEST_BODY", VAR_SIMPLE, 0, 0, NULL, var_request_body_generate, VAR_CACHE, PHASE_REQUEST_BODY ); /* REQUEST_BODY_LENGTH */ msre_engine_variable_register(engine, "REQUEST_BODY_LENGTH", VAR_SIMPLE, 0, 0, NULL, var_request_body_length_generate, VAR_CACHE, PHASE_REQUEST_BODY ); /* MATCHED_VARS_NAMES */ msre_engine_variable_register(engine, "MATCHED_VARS_NAMES", VAR_LIST, 0, 1, var_generic_list_validate, var_matched_vars_names_generate, VAR_CACHE, PHASE_REQUEST_HEADERS ); /* MATCHED_VARS */ msre_engine_variable_register(engine, "MATCHED_VARS", VAR_LIST, 0, 1, var_generic_list_validate, var_matched_vars_generate, VAR_CACHE, PHASE_REQUEST_HEADERS ); /* REQUEST_COOKIES */ msre_engine_variable_register(engine, "REQUEST_COOKIES", VAR_LIST, 0, 1, var_generic_list_validate, var_request_cookies_generate, VAR_CACHE, PHASE_REQUEST_HEADERS ); /* REQUEST_COOKIES_NAMES */ msre_engine_variable_register(engine, "REQUEST_COOKIES_NAMES", VAR_LIST, 0, 1, var_generic_list_validate, var_request_cookies_names_generate, VAR_CACHE, PHASE_REQUEST_HEADERS ); /* REQUEST_FILENAME */ msre_engine_variable_register(engine, "REQUEST_FILENAME", VAR_SIMPLE, 0, 0, NULL, var_request_filename_generate, VAR_CACHE, PHASE_REQUEST_HEADERS ); /* REQUEST_HEADERS */ msre_engine_variable_register(engine, "REQUEST_HEADERS", VAR_LIST, 0, 1, var_generic_list_validate, var_request_headers_generate, VAR_CACHE, PHASE_REQUEST_HEADERS ); /* REQUEST_HEADERS_NAMES */ msre_engine_variable_register(engine, "REQUEST_HEADERS_NAMES", VAR_LIST, 0, 1, var_generic_list_validate, var_request_headers_names_generate, VAR_CACHE, PHASE_REQUEST_HEADERS ); /* REQUEST_LINE */ msre_engine_variable_register(engine, "REQUEST_LINE", VAR_SIMPLE, 0, 0, NULL, var_request_line_generate, VAR_CACHE, PHASE_REQUEST_HEADERS ); /* REQUEST_METHOD */ msre_engine_variable_register(engine, "REQUEST_METHOD", VAR_SIMPLE, 0, 0, NULL, var_request_method_generate, VAR_CACHE, PHASE_REQUEST_HEADERS ); /* REQUEST_PROTOCOL */ msre_engine_variable_register(engine, "REQUEST_PROTOCOL", VAR_SIMPLE, 0, 0, NULL, var_request_protocol_generate, VAR_CACHE, PHASE_REQUEST_HEADERS ); /* REQUEST_URI */ msre_engine_variable_register(engine, "REQUEST_URI", VAR_SIMPLE, 0, 0, NULL, var_request_uri_generate, VAR_DONT_CACHE, /* temp copy */ PHASE_REQUEST_HEADERS ); /* REQUEST_URI_RAW */ msre_engine_variable_register(engine, "REQUEST_URI_RAW", VAR_SIMPLE, 0, 0, NULL, var_request_uri_raw_generate, VAR_CACHE, PHASE_REQUEST_HEADERS ); /* UNIQUE_ID */ msre_engine_variable_register(engine, "UNIQUE_ID", VAR_SIMPLE, 0, 0, NULL, var_uniqueid_generate, VAR_CACHE, PHASE_REQUEST_HEADERS ); /* STREAM_OUTPUT_BODY */ msre_engine_variable_register(engine, "STREAM_OUTPUT_BODY", VAR_SIMPLE, 0, 0, NULL, var_stream_output_generate, VAR_CACHE, PHASE_RESPONSE_BODY ); /* STREAM_INPUT_BODY */ msre_engine_variable_register(engine, "STREAM_INPUT_BODY", VAR_SIMPLE, 0, 0, NULL, var_stream_input_generate, VAR_CACHE, PHASE_FIRST ); /* RESPONSE_BODY */ msre_engine_variable_register(engine, "RESPONSE_BODY", VAR_SIMPLE, 0, 0, NULL, var_response_body_generate, VAR_CACHE, PHASE_RESPONSE_BODY ); /* RESPONSE_CONTENT_LENGTH */ msre_engine_variable_register(engine, "RESPONSE_CONTENT_LENGTH", VAR_SIMPLE, 0, 0, NULL, var_response_content_length, VAR_DONT_CACHE, /* temp copy */ PHASE_RESPONSE_HEADERS ); /* RESPONSE_CONTENT_TYPE */ msre_engine_variable_register(engine, "RESPONSE_CONTENT_TYPE", VAR_SIMPLE, 0, 0, NULL, var_response_content_type, VAR_CACHE, PHASE_RESPONSE_HEADERS ); /* RESPONSE_HEADERS */ msre_engine_variable_register(engine, "RESPONSE_HEADERS", VAR_LIST, 0, 1, var_generic_list_validate, var_response_headers_generate, VAR_CACHE, PHASE_RESPONSE_HEADERS ); /* RESPONSE_HEADERS_NAMES */ msre_engine_variable_register(engine, "RESPONSE_HEADERS_NAMES", VAR_LIST, 0, 1, var_generic_list_validate, var_response_headers_names_generate, VAR_CACHE, PHASE_RESPONSE_HEADERS ); /* RESPONSE_PROTOCOL */ msre_engine_variable_register(engine, "RESPONSE_PROTOCOL", VAR_SIMPLE, 0, 0, NULL, var_response_protocol_generate, VAR_CACHE, PHASE_RESPONSE_HEADERS ); /* RESPONSE_STATUS */ msre_engine_variable_register(engine, "RESPONSE_STATUS", VAR_SIMPLE, 0, 0, NULL, var_response_status_generate, VAR_DONT_CACHE, /* temp copy */ PHASE_RESPONSE_HEADERS ); /* RULE */ msre_engine_variable_register(engine, "RULE", VAR_LIST, 1, 1, NULL, var_rule_generate, VAR_DONT_CACHE, /* dynamic */ PHASE_RESPONSE_HEADERS ); /* SCRIPT_GID */ msre_engine_variable_register(engine, "SCRIPT_GID", VAR_SIMPLE, 0, 0, NULL, var_script_gid_generate, VAR_DONT_CACHE, /* temp copy */ PHASE_REQUEST_BODY ); /* SCRIPT_BASENAME */ msre_engine_variable_register(engine, "SCRIPT_BASENAME", VAR_SIMPLE, 0, 0, NULL, var_script_basename_generate, VAR_DONT_CACHE, /* temp copy */ PHASE_REQUEST_BODY ); /* SCRIPT_FILENAME */ msre_engine_variable_register(engine, "SCRIPT_FILENAME", VAR_SIMPLE, 0, 0, NULL, var_script_filename_generate, VAR_CACHE, PHASE_REQUEST_BODY ); /* SCRIPT_GROUPNAME */ msre_engine_variable_register(engine, "SCRIPT_GROUPNAME", VAR_SIMPLE, 0, 0, NULL, var_script_groupname_generate, VAR_DONT_CACHE, /* temp copy */ PHASE_REQUEST_BODY ); /* SCRIPT_MODE */ msre_engine_variable_register(engine, "SCRIPT_MODE", VAR_SIMPLE, 0, 0, NULL, var_script_mode_generate, VAR_DONT_CACHE, /* temp copy */ PHASE_REQUEST_BODY ); /* SCRIPT_UID */ msre_engine_variable_register(engine, "SCRIPT_UID", VAR_SIMPLE, 0, 0, NULL, var_script_uid_generate, VAR_DONT_CACHE, /* temp copy */ PHASE_REQUEST_BODY ); /* SCRIPT_USERNAME */ msre_engine_variable_register(engine, "SCRIPT_USERNAME", VAR_SIMPLE, 0, 0, NULL, var_script_username_generate, VAR_DONT_CACHE, /* temp copy */ PHASE_REQUEST_BODY ); /* SERVER_ADDR */ msre_engine_variable_register(engine, "SERVER_ADDR", VAR_SIMPLE, 0, 0, NULL, var_server_addr_generate, VAR_CACHE, PHASE_REQUEST_HEADERS ); /* SERVER_NAME */ msre_engine_variable_register(engine, "SERVER_NAME", VAR_SIMPLE, 0, 0, NULL, var_server_name_generate, VAR_CACHE, PHASE_REQUEST_HEADERS ); /* SERVER_PORT */ msre_engine_variable_register(engine, "SERVER_PORT", VAR_SIMPLE, 0, 0, NULL, var_server_port_generate, VAR_DONT_CACHE, /* temp copy */ PHASE_REQUEST_HEADERS ); /* SESSION */ msre_engine_variable_register(engine, "SESSION", VAR_LIST, 1, 1, var_generic_list_validate, var_session_generate, VAR_DONT_CACHE, /* dynamic */ PHASE_REQUEST_HEADERS ); /* SESSIONID */ msre_engine_variable_register(engine, "SESSIONID", VAR_SIMPLE, 0, 0, NULL, var_sessionid_generate, VAR_DONT_CACHE, /* dynamic */ PHASE_RESPONSE_HEADERS ); /* STATUS_LINE */ msre_engine_variable_register(engine, "STATUS_LINE", VAR_SIMPLE, 0, 0, NULL, var_status_line_generate, VAR_CACHE, PHASE_RESPONSE_HEADERS ); /* URLENCODED_ERROR */ msre_engine_variable_register(engine, "URLENCODED_ERROR", VAR_SIMPLE, 0, 0, NULL, var_urlencoded_error_generate, VAR_DONT_CACHE, /* flag */ PHASE_REQUEST_HEADERS ); /* INBOUND_DATA_ERROR */ msre_engine_variable_register(engine, "INBOUND_DATA_ERROR", VAR_SIMPLE, 0, 0, NULL, var_inbound_error_generate, VAR_DONT_CACHE, /* flag */ PHASE_REQUEST_BODY ); /* OUTBOUND_DATA_ERROR */ msre_engine_variable_register(engine, "OUTBOUND_DATA_ERROR", VAR_SIMPLE, 0, 0, NULL, var_outbound_error_generate, VAR_DONT_CACHE, /* flag */ PHASE_RESPONSE_BODY ); /* USER */ msre_engine_variable_register(engine, "USER", VAR_LIST, 1, 1, var_generic_list_validate, var_user_generate, VAR_DONT_CACHE, /* dynamic */ PHASE_REQUEST_HEADERS ); /* USERID */ msre_engine_variable_register(engine, "USERID", VAR_SIMPLE, 0, 0, NULL, var_userid_generate, VAR_DONT_CACHE, /* dynamic */ PHASE_RESPONSE_HEADERS ); /* PERF_RULES */ msre_engine_variable_register(engine, "PERF_RULES", VAR_LIST, 0, 1, var_generic_list_validate, var_perf_rules_generate, VAR_DONT_CACHE, PHASE_REQUEST_HEADERS ); /* PERF_ALL */ msre_engine_variable_register(engine, "PERF_ALL", VAR_SIMPLE, 0, 0, NULL, var_perf_all_generate, VAR_DONT_CACHE, PHASE_REQUEST_HEADERS ); /* PERF_COMBINED */ msre_engine_variable_register(engine, "PERF_COMBINED", VAR_SIMPLE, 0, 0, NULL, var_perf_combined_generate, VAR_DONT_CACHE, PHASE_REQUEST_HEADERS ); /* PERF_GC */ msre_engine_variable_register(engine, "PERF_GC", VAR_SIMPLE, 0, 0, NULL, var_perf_gc_generate, VAR_DONT_CACHE, PHASE_REQUEST_HEADERS ); /* PERF_LOGGING */ msre_engine_variable_register(engine, "PERF_LOGGING", VAR_SIMPLE, 0, 0, NULL, var_perf_logging_generate, VAR_DONT_CACHE, PHASE_REQUEST_HEADERS ); /* PERF_PHASE1 */ msre_engine_variable_register(engine, "PERF_PHASE1", VAR_SIMPLE, 0, 0, NULL, var_perf_phase1_generate, VAR_DONT_CACHE, PHASE_REQUEST_HEADERS ); /* PERF_PHASE2 */ msre_engine_variable_register(engine, "PERF_PHASE2", VAR_SIMPLE, 0, 0, NULL, var_perf_phase2_generate, VAR_DONT_CACHE, PHASE_REQUEST_HEADERS ); /* PERF_PHASE3 */ msre_engine_variable_register(engine, "PERF_PHASE3", VAR_SIMPLE, 0, 0, NULL, var_perf_phase3_generate, VAR_DONT_CACHE, PHASE_REQUEST_HEADERS ); /* PERF_PHASE4 */ msre_engine_variable_register(engine, "PERF_PHASE4", VAR_SIMPLE, 0, 0, NULL, var_perf_phase4_generate, VAR_DONT_CACHE, PHASE_REQUEST_HEADERS ); /* PERF_PHASE5 */ msre_engine_variable_register(engine, "PERF_PHASE5", VAR_SIMPLE, 0, 0, NULL, var_perf_phase5_generate, VAR_DONT_CACHE, PHASE_REQUEST_HEADERS ); /* PERF_SREAD */ msre_engine_variable_register(engine, "PERF_SREAD", VAR_SIMPLE, 0, 0, NULL, var_perf_sread_generate, VAR_DONT_CACHE, PHASE_REQUEST_HEADERS ); /* PERF_SWRITE */ msre_engine_variable_register(engine, "PERF_SWRITE", VAR_SIMPLE, 0, 0, NULL, var_perf_swrite_generate, VAR_DONT_CACHE, PHASE_REQUEST_HEADERS ); /* DURATION */ msre_engine_variable_register(engine, "DURATION", VAR_SIMPLE, 0, 0, NULL, var_duration_generate, VAR_DONT_CACHE, /* dynamic */ PHASE_REQUEST_HEADERS ); /* TIME */ msre_engine_variable_register(engine, "TIME", VAR_SIMPLE, 0, 0, NULL, var_time_generate, VAR_DONT_CACHE, /* dynamic */ PHASE_REQUEST_HEADERS ); /* TIME_DAY */ msre_engine_variable_register(engine, "TIME_DAY", VAR_SIMPLE, 0, 0, NULL, var_time_day_generate, VAR_DONT_CACHE, /* dynamic */ PHASE_REQUEST_HEADERS ); /* TIME_EPOCH */ msre_engine_variable_register(engine, "TIME_EPOCH", VAR_SIMPLE, 0, 0, NULL, var_time_epoch_generate, VAR_DONT_CACHE, /* dynamic */ PHASE_REQUEST_HEADERS ); /* TIME_HOUR */ msre_engine_variable_register(engine, "TIME_HOUR", VAR_SIMPLE, 0, 0, NULL, var_time_hour_generate, VAR_DONT_CACHE, /* dynamic */ PHASE_REQUEST_HEADERS ); /* TIME_MIN */ msre_engine_variable_register(engine, "TIME_MIN", VAR_SIMPLE, 0, 0, NULL, var_time_min_generate, VAR_DONT_CACHE, /* dynamic */ PHASE_REQUEST_HEADERS ); /* TIME_MON */ msre_engine_variable_register(engine, "TIME_MON", VAR_SIMPLE, 0, 0, NULL, var_time_mon_generate, VAR_DONT_CACHE, /* dynamic */ PHASE_REQUEST_HEADERS ); /* TIME_SEC */ msre_engine_variable_register(engine, "TIME_SEC", VAR_SIMPLE, 0, 0, NULL, var_time_sec_generate, VAR_DONT_CACHE, /* dynamic */ PHASE_REQUEST_HEADERS ); /* TIME_WDAY */ msre_engine_variable_register(engine, "TIME_WDAY", VAR_SIMPLE, 0, 0, NULL, var_time_wday_generate, VAR_DONT_CACHE, /* dynamic */ PHASE_REQUEST_HEADERS ); /* TIME_YEAR */ msre_engine_variable_register(engine, "TIME_YEAR", VAR_SIMPLE, 0, 0, NULL, var_time_year_generate, VAR_DONT_CACHE, /* dynamic */ PHASE_REQUEST_HEADERS ); /* TX */ msre_engine_variable_register(engine, "TX", VAR_LIST, 1, 1, var_generic_list_validate, var_tx_generate, VAR_DONT_CACHE, /* dynamic */ PHASE_REQUEST_HEADERS ); /* WEBAPPID */ msre_engine_variable_register(engine, "WEBAPPID", VAR_SIMPLE, 0, 0, NULL, var_webappid_generate, VAR_DONT_CACHE, PHASE_RESPONSE_HEADERS ); /* WEBSERVER_ERROR_LOG */ msre_engine_variable_register(engine, "WEBSERVER_ERROR_LOG", VAR_LIST, 0, 0, NULL, var_webserver_error_log_generate, VAR_DONT_CACHE, /* dynamic */ PHASE_REQUEST_HEADERS ); /* XML */ msre_engine_variable_register(engine, "XML", VAR_LIST, 0, 1, var_xml_validate, var_xml_generate, VAR_DONT_CACHE, /* dynamic */ PHASE_REQUEST_BODY ); } modsecurity-apache_2.7.7/apache2/msc_tree.h0000664000175000017500000000365712243422537021127 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #ifndef __MSC_TREE_H__ #define __MSC_TREE_H__ #include "modsecurity.h" typedef struct CPTData CPTData; typedef struct TreePrefix TreePrefix; typedef struct TreeNode TreeNode; typedef struct CPTTree CPTTree; typedef struct TreeRoot TreeRoot; #define IPV4_TREE 0x1 #define IPV6_TREE 0x2 #define IPV4_LEN 0x20 #define IPV6_LEN 0x80 #define TREE_CHECK(x, y) ((x) & (y)) #define MASK_BITS(x) ((x + 1) * 8) #define SHIFT_LEFT_MASK(x) ((-1) << (x)) #define SHIFT_RIGHT_MASK(x,y) ((x) >> (y)) #define NETMASK_256 0x100 #define NETMASK_128 0x80 #define NETMASK_64 0x40 #define NETMASK_32 0x20 #define NETMASK_16 0x10 #define NETMASK_8 0x8 #define NETMASK_4 0x4 #define NETMASK_2 0x2 struct CPTData { unsigned char netmask; struct CPTData *next; }; struct TreePrefix { unsigned char *buffer; unsigned int bitlen; CPTData *prefix_data; }; struct TreeNode { unsigned int bit; int count; unsigned char *netmasks; TreePrefix *prefix; struct TreeNode *left, *right; struct TreeNode *parent; }; struct CPTTree { int count; apr_pool_t *pool; TreeNode *head; }; struct TreeRoot { CPTTree *ipv4_tree; CPTTree *ipv6_tree; }; CPTTree DSOLOCAL *CPTCreateRadixTree(apr_pool_t *pool); TreeNode DSOLOCAL *CPTIpMatch(modsec_rec *msr, unsigned char *ipdata, CPTTree *tree, int type); TreeNode DSOLOCAL *TreeAddIP(const char *buffer, CPTTree *tree, int type); #endif /*__MSC_TREE_H__ */ modsecurity-apache_2.7.7/apache2/utf8tables.h0000664000175000017500000005456412243422537021412 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #ifndef UTF8TABLES_H_ #define UTF8TABLES_H_ /** * This include file is used by acmp.c only; it's not included anywhere else. */ typedef long acmp_utf8_char_t; static const char utf8_seq_lengths[256] = { 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 3,3,3,3,3,3,3,3, 3,3,3,3,3,3,3,3, 4,4,4,4,4,4,4,4, 5,5,5,5,6,6,6,6, }; static const acmp_utf8_char_t utf8_offsets[6] = { 0x00000000UL, 0x00003080UL, 0x000E2080UL, 0x03C82080UL, 0xFA082080UL, 0x82082080UL }; /** * How many element pairs are there in utf8_lcase_map */ #define UTF8_LCASEMAP_LEN 759 /** * Table mapping is from PHP's mbstring extension, maps uppercase */ static const acmp_utf8_char_t utf8_lcase_map[UTF8_LCASEMAP_LEN * 2] = { 0x00000061, 0x00000041, 0x00000062, 0x00000042, 0x00000063, 0x00000043, 0x00000064, 0x00000044, 0x00000065, 0x00000045, 0x00000066, 0x00000046, 0x00000067, 0x00000047, 0x00000068, 0x00000048, 0x00000069, 0x00000049, 0x0000006a, 0x0000004a, 0x0000006b, 0x0000004b, 0x0000006c, 0x0000004c, 0x0000006d, 0x0000004d, 0x0000006e, 0x0000004e, 0x0000006f, 0x0000004f, 0x00000070, 0x00000050, 0x00000071, 0x00000051, 0x00000072, 0x00000052, 0x00000073, 0x00000053, 0x00000074, 0x00000054, 0x00000075, 0x00000055, 0x00000076, 0x00000056, 0x00000077, 0x00000057, 0x00000078, 0x00000058, 0x00000079, 0x00000059, 0x0000007a, 0x0000005a, 0x000000b5, 0x0000039c, 0x000000e0, 0x000000c0, 0x000000e1, 0x000000c1, 0x000000e2, 0x000000c2, 0x000000e3, 0x000000c3, 0x000000e4, 0x000000c4, 0x000000e5, 0x000000c5, 0x000000e6, 0x000000c6, 0x000000e7, 0x000000c7, 0x000000e8, 0x000000c8, 0x000000e9, 0x000000c9, 0x000000ea, 0x000000ca, 0x000000eb, 0x000000cb, 0x000000ec, 0x000000cc, 0x000000ed, 0x000000cd, 0x000000ee, 0x000000ce, 0x000000ef, 0x000000cf, 0x000000f0, 0x000000d0, 0x000000f1, 0x000000d1, 0x000000f2, 0x000000d2, 0x000000f3, 0x000000d3, 0x000000f4, 0x000000d4, 0x000000f5, 0x000000d5, 0x000000f6, 0x000000d6, 0x000000f8, 0x000000d8, 0x000000f9, 0x000000d9, 0x000000fa, 0x000000da, 0x000000fb, 0x000000db, 0x000000fc, 0x000000dc, 0x000000fd, 0x000000dd, 0x000000fe, 0x000000de, 0x000000ff, 0x00000178, 0x00000101, 0x00000100, 0x00000103, 0x00000102, 0x00000105, 0x00000104, 0x00000107, 0x00000106, 0x00000109, 0x00000108, 0x0000010b, 0x0000010a, 0x0000010d, 0x0000010c, 0x0000010f, 0x0000010e, 0x00000111, 0x00000110, 0x00000113, 0x00000112, 0x00000115, 0x00000114, 0x00000117, 0x00000116, 0x00000119, 0x00000118, 0x0000011b, 0x0000011a, 0x0000011d, 0x0000011c, 0x0000011f, 0x0000011e, 0x00000121, 0x00000120, 0x00000123, 0x00000122, 0x00000125, 0x00000124, 0x00000127, 0x00000126, 0x00000129, 0x00000128, 0x0000012b, 0x0000012a, 0x0000012d, 0x0000012c, 0x0000012f, 0x0000012e, 0x00000131, 0x00000049, 0x00000133, 0x00000132, 0x00000135, 0x00000134, 0x00000137, 0x00000136, 0x0000013a, 0x00000139, 0x0000013c, 0x0000013b, 0x0000013e, 0x0000013d, 0x00000140, 0x0000013f, 0x00000142, 0x00000141, 0x00000144, 0x00000143, 0x00000146, 0x00000145, 0x00000148, 0x00000147, 0x0000014b, 0x0000014a, 0x0000014d, 0x0000014c, 0x0000014f, 0x0000014e, 0x00000151, 0x00000150, 0x00000153, 0x00000152, 0x00000155, 0x00000154, 0x00000157, 0x00000156, 0x00000159, 0x00000158, 0x0000015b, 0x0000015a, 0x0000015d, 0x0000015c, 0x0000015f, 0x0000015e, 0x00000161, 0x00000160, 0x00000163, 0x00000162, 0x00000165, 0x00000164, 0x00000167, 0x00000166, 0x00000169, 0x00000168, 0x0000016b, 0x0000016a, 0x0000016d, 0x0000016c, 0x0000016f, 0x0000016e, 0x00000171, 0x00000170, 0x00000173, 0x00000172, 0x00000175, 0x00000174, 0x00000177, 0x00000176, 0x0000017a, 0x00000179, 0x0000017c, 0x0000017b, 0x0000017e, 0x0000017d, 0x0000017f, 0x00000053, 0x00000183, 0x00000182, 0x00000185, 0x00000184, 0x00000188, 0x00000187, 0x0000018c, 0x0000018b, 0x00000192, 0x00000191, 0x00000195, 0x000001f6, 0x00000199, 0x00000198, 0x0000019e, 0x00000220, 0x000001a1, 0x000001a0, 0x000001a3, 0x000001a2, 0x000001a5, 0x000001a4, 0x000001a8, 0x000001a7, 0x000001ad, 0x000001ac, 0x000001b0, 0x000001af, 0x000001b4, 0x000001b3, 0x000001b6, 0x000001b5, 0x000001b9, 0x000001b8, 0x000001bd, 0x000001bc, 0x000001bf, 0x000001f7, 0x000001c6, 0x000001c4, 0x000001c9, 0x000001c7, 0x000001cc, 0x000001ca, 0x000001ce, 0x000001cd, 0x000001d0, 0x000001cf, 0x000001d2, 0x000001d1, 0x000001d4, 0x000001d3, 0x000001d6, 0x000001d5, 0x000001d8, 0x000001d7, 0x000001da, 0x000001d9, 0x000001dc, 0x000001db, 0x000001dd, 0x0000018e, 0x000001df, 0x000001de, 0x000001e1, 0x000001e0, 0x000001e3, 0x000001e2, 0x000001e5, 0x000001e4, 0x000001e7, 0x000001e6, 0x000001e9, 0x000001e8, 0x000001eb, 0x000001ea, 0x000001ed, 0x000001ec, 0x000001ef, 0x000001ee, 0x000001f3, 0x000001f1, 0x000001f5, 0x000001f4, 0x000001f9, 0x000001f8, 0x000001fb, 0x000001fa, 0x000001fd, 0x000001fc, 0x000001ff, 0x000001fe, 0x00000201, 0x00000200, 0x00000203, 0x00000202, 0x00000205, 0x00000204, 0x00000207, 0x00000206, 0x00000209, 0x00000208, 0x0000020b, 0x0000020a, 0x0000020d, 0x0000020c, 0x0000020f, 0x0000020e, 0x00000211, 0x00000210, 0x00000213, 0x00000212, 0x00000215, 0x00000214, 0x00000217, 0x00000216, 0x00000219, 0x00000218, 0x0000021b, 0x0000021a, 0x0000021d, 0x0000021c, 0x0000021f, 0x0000021e, 0x00000223, 0x00000222, 0x00000225, 0x00000224, 0x00000227, 0x00000226, 0x00000229, 0x00000228, 0x0000022b, 0x0000022a, 0x0000022d, 0x0000022c, 0x0000022f, 0x0000022e, 0x00000231, 0x00000230, 0x00000233, 0x00000232, 0x00000253, 0x00000181, 0x00000254, 0x00000186, 0x00000256, 0x00000189, 0x00000257, 0x0000018a, 0x00000259, 0x0000018f, 0x0000025b, 0x00000190, 0x00000260, 0x00000193, 0x00000263, 0x00000194, 0x00000268, 0x00000197, 0x00000269, 0x00000196, 0x0000026f, 0x0000019c, 0x00000272, 0x0000019d, 0x00000275, 0x0000019f, 0x00000280, 0x000001a6, 0x00000283, 0x000001a9, 0x00000288, 0x000001ae, 0x0000028a, 0x000001b1, 0x0000028b, 0x000001b2, 0x00000292, 0x000001b7, 0x00000345, 0x00000399, 0x000003ac, 0x00000386, 0x000003ad, 0x00000388, 0x000003ae, 0x00000389, 0x000003af, 0x0000038a, 0x000003b1, 0x00000391, 0x000003b2, 0x00000392, 0x000003b3, 0x00000393, 0x000003b4, 0x00000394, 0x000003b5, 0x00000395, 0x000003b6, 0x00000396, 0x000003b7, 0x00000397, 0x000003b8, 0x00000398, 0x000003b9, 0x00000399, 0x000003ba, 0x0000039a, 0x000003bb, 0x0000039b, 0x000003bc, 0x0000039c, 0x000003bd, 0x0000039d, 0x000003be, 0x0000039e, 0x000003bf, 0x0000039f, 0x000003c0, 0x000003a0, 0x000003c1, 0x000003a1, 0x000003c2, 0x000003a3, 0x000003c3, 0x000003a3, 0x000003c4, 0x000003a4, 0x000003c5, 0x000003a5, 0x000003c6, 0x000003a6, 0x000003c7, 0x000003a7, 0x000003c8, 0x000003a8, 0x000003c9, 0x000003a9, 0x000003ca, 0x000003aa, 0x000003cb, 0x000003ab, 0x000003cc, 0x0000038c, 0x000003cd, 0x0000038e, 0x000003ce, 0x0000038f, 0x000003d0, 0x00000392, 0x000003d1, 0x00000398, 0x000003d5, 0x000003a6, 0x000003d6, 0x000003a0, 0x000003d9, 0x000003d8, 0x000003db, 0x000003da, 0x000003dd, 0x000003dc, 0x000003df, 0x000003de, 0x000003e1, 0x000003e0, 0x000003e3, 0x000003e2, 0x000003e5, 0x000003e4, 0x000003e7, 0x000003e6, 0x000003e9, 0x000003e8, 0x000003eb, 0x000003ea, 0x000003ed, 0x000003ec, 0x000003ef, 0x000003ee, 0x000003f0, 0x0000039a, 0x000003f1, 0x000003a1, 0x000003f2, 0x000003a3, 0x000003f5, 0x00000395, 0x00000430, 0x00000410, 0x00000431, 0x00000411, 0x00000432, 0x00000412, 0x00000433, 0x00000413, 0x00000434, 0x00000414, 0x00000435, 0x00000415, 0x00000436, 0x00000416, 0x00000437, 0x00000417, 0x00000438, 0x00000418, 0x00000439, 0x00000419, 0x0000043a, 0x0000041a, 0x0000043b, 0x0000041b, 0x0000043c, 0x0000041c, 0x0000043d, 0x0000041d, 0x0000043e, 0x0000041e, 0x0000043f, 0x0000041f, 0x00000440, 0x00000420, 0x00000441, 0x00000421, 0x00000442, 0x00000422, 0x00000443, 0x00000423, 0x00000444, 0x00000424, 0x00000445, 0x00000425, 0x00000446, 0x00000426, 0x00000447, 0x00000427, 0x00000448, 0x00000428, 0x00000449, 0x00000429, 0x0000044a, 0x0000042a, 0x0000044b, 0x0000042b, 0x0000044c, 0x0000042c, 0x0000044d, 0x0000042d, 0x0000044e, 0x0000042e, 0x0000044f, 0x0000042f, 0x00000450, 0x00000400, 0x00000451, 0x00000401, 0x00000452, 0x00000402, 0x00000453, 0x00000403, 0x00000454, 0x00000404, 0x00000455, 0x00000405, 0x00000456, 0x00000406, 0x00000457, 0x00000407, 0x00000458, 0x00000408, 0x00000459, 0x00000409, 0x0000045a, 0x0000040a, 0x0000045b, 0x0000040b, 0x0000045c, 0x0000040c, 0x0000045d, 0x0000040d, 0x0000045e, 0x0000040e, 0x0000045f, 0x0000040f, 0x00000461, 0x00000460, 0x00000463, 0x00000462, 0x00000465, 0x00000464, 0x00000467, 0x00000466, 0x00000469, 0x00000468, 0x0000046b, 0x0000046a, 0x0000046d, 0x0000046c, 0x0000046f, 0x0000046e, 0x00000471, 0x00000470, 0x00000473, 0x00000472, 0x00000475, 0x00000474, 0x00000477, 0x00000476, 0x00000479, 0x00000478, 0x0000047b, 0x0000047a, 0x0000047d, 0x0000047c, 0x0000047f, 0x0000047e, 0x00000481, 0x00000480, 0x0000048b, 0x0000048a, 0x0000048d, 0x0000048c, 0x0000048f, 0x0000048e, 0x00000491, 0x00000490, 0x00000493, 0x00000492, 0x00000495, 0x00000494, 0x00000497, 0x00000496, 0x00000499, 0x00000498, 0x0000049b, 0x0000049a, 0x0000049d, 0x0000049c, 0x0000049f, 0x0000049e, 0x000004a1, 0x000004a0, 0x000004a3, 0x000004a2, 0x000004a5, 0x000004a4, 0x000004a7, 0x000004a6, 0x000004a9, 0x000004a8, 0x000004ab, 0x000004aa, 0x000004ad, 0x000004ac, 0x000004af, 0x000004ae, 0x000004b1, 0x000004b0, 0x000004b3, 0x000004b2, 0x000004b5, 0x000004b4, 0x000004b7, 0x000004b6, 0x000004b9, 0x000004b8, 0x000004bb, 0x000004ba, 0x000004bd, 0x000004bc, 0x000004bf, 0x000004be, 0x000004c2, 0x000004c1, 0x000004c4, 0x000004c3, 0x000004c6, 0x000004c5, 0x000004c8, 0x000004c7, 0x000004ca, 0x000004c9, 0x000004cc, 0x000004cb, 0x000004ce, 0x000004cd, 0x000004d1, 0x000004d0, 0x000004d3, 0x000004d2, 0x000004d5, 0x000004d4, 0x000004d7, 0x000004d6, 0x000004d9, 0x000004d8, 0x000004db, 0x000004da, 0x000004dd, 0x000004dc, 0x000004df, 0x000004de, 0x000004e1, 0x000004e0, 0x000004e3, 0x000004e2, 0x000004e5, 0x000004e4, 0x000004e7, 0x000004e6, 0x000004e9, 0x000004e8, 0x000004eb, 0x000004ea, 0x000004ed, 0x000004ec, 0x000004ef, 0x000004ee, 0x000004f1, 0x000004f0, 0x000004f3, 0x000004f2, 0x000004f5, 0x000004f4, 0x000004f9, 0x000004f8, 0x00000501, 0x00000500, 0x00000503, 0x00000502, 0x00000505, 0x00000504, 0x00000507, 0x00000506, 0x00000509, 0x00000508, 0x0000050b, 0x0000050a, 0x0000050d, 0x0000050c, 0x0000050f, 0x0000050e, 0x00000561, 0x00000531, 0x00000562, 0x00000532, 0x00000563, 0x00000533, 0x00000564, 0x00000534, 0x00000565, 0x00000535, 0x00000566, 0x00000536, 0x00000567, 0x00000537, 0x00000568, 0x00000538, 0x00000569, 0x00000539, 0x0000056a, 0x0000053a, 0x0000056b, 0x0000053b, 0x0000056c, 0x0000053c, 0x0000056d, 0x0000053d, 0x0000056e, 0x0000053e, 0x0000056f, 0x0000053f, 0x00000570, 0x00000540, 0x00000571, 0x00000541, 0x00000572, 0x00000542, 0x00000573, 0x00000543, 0x00000574, 0x00000544, 0x00000575, 0x00000545, 0x00000576, 0x00000546, 0x00000577, 0x00000547, 0x00000578, 0x00000548, 0x00000579, 0x00000549, 0x0000057a, 0x0000054a, 0x0000057b, 0x0000054b, 0x0000057c, 0x0000054c, 0x0000057d, 0x0000054d, 0x0000057e, 0x0000054e, 0x0000057f, 0x0000054f, 0x00000580, 0x00000550, 0x00000581, 0x00000551, 0x00000582, 0x00000552, 0x00000583, 0x00000553, 0x00000584, 0x00000554, 0x00000585, 0x00000555, 0x00000586, 0x00000556, 0x00001e01, 0x00001e00, 0x00001e03, 0x00001e02, 0x00001e05, 0x00001e04, 0x00001e07, 0x00001e06, 0x00001e09, 0x00001e08, 0x00001e0b, 0x00001e0a, 0x00001e0d, 0x00001e0c, 0x00001e0f, 0x00001e0e, 0x00001e11, 0x00001e10, 0x00001e13, 0x00001e12, 0x00001e15, 0x00001e14, 0x00001e17, 0x00001e16, 0x00001e19, 0x00001e18, 0x00001e1b, 0x00001e1a, 0x00001e1d, 0x00001e1c, 0x00001e1f, 0x00001e1e, 0x00001e21, 0x00001e20, 0x00001e23, 0x00001e22, 0x00001e25, 0x00001e24, 0x00001e27, 0x00001e26, 0x00001e29, 0x00001e28, 0x00001e2b, 0x00001e2a, 0x00001e2d, 0x00001e2c, 0x00001e2f, 0x00001e2e, 0x00001e31, 0x00001e30, 0x00001e33, 0x00001e32, 0x00001e35, 0x00001e34, 0x00001e37, 0x00001e36, 0x00001e39, 0x00001e38, 0x00001e3b, 0x00001e3a, 0x00001e3d, 0x00001e3c, 0x00001e3f, 0x00001e3e, 0x00001e41, 0x00001e40, 0x00001e43, 0x00001e42, 0x00001e45, 0x00001e44, 0x00001e47, 0x00001e46, 0x00001e49, 0x00001e48, 0x00001e4b, 0x00001e4a, 0x00001e4d, 0x00001e4c, 0x00001e4f, 0x00001e4e, 0x00001e51, 0x00001e50, 0x00001e53, 0x00001e52, 0x00001e55, 0x00001e54, 0x00001e57, 0x00001e56, 0x00001e59, 0x00001e58, 0x00001e5b, 0x00001e5a, 0x00001e5d, 0x00001e5c, 0x00001e5f, 0x00001e5e, 0x00001e61, 0x00001e60, 0x00001e63, 0x00001e62, 0x00001e65, 0x00001e64, 0x00001e67, 0x00001e66, 0x00001e69, 0x00001e68, 0x00001e6b, 0x00001e6a, 0x00001e6d, 0x00001e6c, 0x00001e6f, 0x00001e6e, 0x00001e71, 0x00001e70, 0x00001e73, 0x00001e72, 0x00001e75, 0x00001e74, 0x00001e77, 0x00001e76, 0x00001e79, 0x00001e78, 0x00001e7b, 0x00001e7a, 0x00001e7d, 0x00001e7c, 0x00001e7f, 0x00001e7e, 0x00001e81, 0x00001e80, 0x00001e83, 0x00001e82, 0x00001e85, 0x00001e84, 0x00001e87, 0x00001e86, 0x00001e89, 0x00001e88, 0x00001e8b, 0x00001e8a, 0x00001e8d, 0x00001e8c, 0x00001e8f, 0x00001e8e, 0x00001e91, 0x00001e90, 0x00001e93, 0x00001e92, 0x00001e95, 0x00001e94, 0x00001e9b, 0x00001e60, 0x00001ea1, 0x00001ea0, 0x00001ea3, 0x00001ea2, 0x00001ea5, 0x00001ea4, 0x00001ea7, 0x00001ea6, 0x00001ea9, 0x00001ea8, 0x00001eab, 0x00001eaa, 0x00001ead, 0x00001eac, 0x00001eaf, 0x00001eae, 0x00001eb1, 0x00001eb0, 0x00001eb3, 0x00001eb2, 0x00001eb5, 0x00001eb4, 0x00001eb7, 0x00001eb6, 0x00001eb9, 0x00001eb8, 0x00001ebb, 0x00001eba, 0x00001ebd, 0x00001ebc, 0x00001ebf, 0x00001ebe, 0x00001ec1, 0x00001ec0, 0x00001ec3, 0x00001ec2, 0x00001ec5, 0x00001ec4, 0x00001ec7, 0x00001ec6, 0x00001ec9, 0x00001ec8, 0x00001ecb, 0x00001eca, 0x00001ecd, 0x00001ecc, 0x00001ecf, 0x00001ece, 0x00001ed1, 0x00001ed0, 0x00001ed3, 0x00001ed2, 0x00001ed5, 0x00001ed4, 0x00001ed7, 0x00001ed6, 0x00001ed9, 0x00001ed8, 0x00001edb, 0x00001eda, 0x00001edd, 0x00001edc, 0x00001edf, 0x00001ede, 0x00001ee1, 0x00001ee0, 0x00001ee3, 0x00001ee2, 0x00001ee5, 0x00001ee4, 0x00001ee7, 0x00001ee6, 0x00001ee9, 0x00001ee8, 0x00001eeb, 0x00001eea, 0x00001eed, 0x00001eec, 0x00001eef, 0x00001eee, 0x00001ef1, 0x00001ef0, 0x00001ef3, 0x00001ef2, 0x00001ef5, 0x00001ef4, 0x00001ef7, 0x00001ef6, 0x00001ef9, 0x00001ef8, 0x00001f00, 0x00001f08, 0x00001f01, 0x00001f09, 0x00001f02, 0x00001f0a, 0x00001f03, 0x00001f0b, 0x00001f04, 0x00001f0c, 0x00001f05, 0x00001f0d, 0x00001f06, 0x00001f0e, 0x00001f07, 0x00001f0f, 0x00001f10, 0x00001f18, 0x00001f11, 0x00001f19, 0x00001f12, 0x00001f1a, 0x00001f13, 0x00001f1b, 0x00001f14, 0x00001f1c, 0x00001f15, 0x00001f1d, 0x00001f20, 0x00001f28, 0x00001f21, 0x00001f29, 0x00001f22, 0x00001f2a, 0x00001f23, 0x00001f2b, 0x00001f24, 0x00001f2c, 0x00001f25, 0x00001f2d, 0x00001f26, 0x00001f2e, 0x00001f27, 0x00001f2f, 0x00001f30, 0x00001f38, 0x00001f31, 0x00001f39, 0x00001f32, 0x00001f3a, 0x00001f33, 0x00001f3b, 0x00001f34, 0x00001f3c, 0x00001f35, 0x00001f3d, 0x00001f36, 0x00001f3e, 0x00001f37, 0x00001f3f, 0x00001f40, 0x00001f48, 0x00001f41, 0x00001f49, 0x00001f42, 0x00001f4a, 0x00001f43, 0x00001f4b, 0x00001f44, 0x00001f4c, 0x00001f45, 0x00001f4d, 0x00001f51, 0x00001f59, 0x00001f53, 0x00001f5b, 0x00001f55, 0x00001f5d, 0x00001f57, 0x00001f5f, 0x00001f60, 0x00001f68, 0x00001f61, 0x00001f69, 0x00001f62, 0x00001f6a, 0x00001f63, 0x00001f6b, 0x00001f64, 0x00001f6c, 0x00001f65, 0x00001f6d, 0x00001f66, 0x00001f6e, 0x00001f67, 0x00001f6f, 0x00001f70, 0x00001fba, 0x00001f71, 0x00001fbb, 0x00001f72, 0x00001fc8, 0x00001f73, 0x00001fc9, 0x00001f74, 0x00001fca, 0x00001f75, 0x00001fcb, 0x00001f76, 0x00001fda, 0x00001f77, 0x00001fdb, 0x00001f78, 0x00001ff8, 0x00001f79, 0x00001ff9, 0x00001f7a, 0x00001fea, 0x00001f7b, 0x00001feb, 0x00001f7c, 0x00001ffa, 0x00001f7d, 0x00001ffb, 0x00001f80, 0x00001f88, 0x00001f81, 0x00001f89, 0x00001f82, 0x00001f8a, 0x00001f83, 0x00001f8b, 0x00001f84, 0x00001f8c, 0x00001f85, 0x00001f8d, 0x00001f86, 0x00001f8e, 0x00001f87, 0x00001f8f, 0x00001f90, 0x00001f98, 0x00001f91, 0x00001f99, 0x00001f92, 0x00001f9a, 0x00001f93, 0x00001f9b, 0x00001f94, 0x00001f9c, 0x00001f95, 0x00001f9d, 0x00001f96, 0x00001f9e, 0x00001f97, 0x00001f9f, 0x00001fa0, 0x00001fa8, 0x00001fa1, 0x00001fa9, 0x00001fa2, 0x00001faa, 0x00001fa3, 0x00001fab, 0x00001fa4, 0x00001fac, 0x00001fa5, 0x00001fad, 0x00001fa6, 0x00001fae, 0x00001fa7, 0x00001faf, 0x00001fb0, 0x00001fb8, 0x00001fb1, 0x00001fb9, 0x00001fb3, 0x00001fbc, 0x00001fbe, 0x00000399, 0x00001fc3, 0x00001fcc, 0x00001fd0, 0x00001fd8, 0x00001fd1, 0x00001fd9, 0x00001fe0, 0x00001fe8, 0x00001fe1, 0x00001fe9, 0x00001fe5, 0x00001fec, 0x00001ff3, 0x00001ffc, 0x00002170, 0x00002160, 0x00002171, 0x00002161, 0x00002172, 0x00002162, 0x00002173, 0x00002163, 0x00002174, 0x00002164, 0x00002175, 0x00002165, 0x00002176, 0x00002166, 0x00002177, 0x00002167, 0x00002178, 0x00002168, 0x00002179, 0x00002169, 0x0000217a, 0x0000216a, 0x0000217b, 0x0000216b, 0x0000217c, 0x0000216c, 0x0000217d, 0x0000216d, 0x0000217e, 0x0000216e, 0x0000217f, 0x0000216f, 0x000024d0, 0x000024b6, 0x000024d1, 0x000024b7, 0x000024d2, 0x000024b8, 0x000024d3, 0x000024b9, 0x000024d4, 0x000024ba, 0x000024d5, 0x000024bb, 0x000024d6, 0x000024bc, 0x000024d7, 0x000024bd, 0x000024d8, 0x000024be, 0x000024d9, 0x000024bf, 0x000024da, 0x000024c0, 0x000024db, 0x000024c1, 0x000024dc, 0x000024c2, 0x000024dd, 0x000024c3, 0x000024de, 0x000024c4, 0x000024df, 0x000024c5, 0x000024e0, 0x000024c6, 0x000024e1, 0x000024c7, 0x000024e2, 0x000024c8, 0x000024e3, 0x000024c9, 0x000024e4, 0x000024ca, 0x000024e5, 0x000024cb, 0x000024e6, 0x000024cc, 0x000024e7, 0x000024cd, 0x000024e8, 0x000024ce, 0x000024e9, 0x000024cf, 0x0000ff41, 0x0000ff21, 0x0000ff42, 0x0000ff22, 0x0000ff43, 0x0000ff23, 0x0000ff44, 0x0000ff24, 0x0000ff45, 0x0000ff25, 0x0000ff46, 0x0000ff26, 0x0000ff47, 0x0000ff27, 0x0000ff48, 0x0000ff28, 0x0000ff49, 0x0000ff29, 0x0000ff4a, 0x0000ff2a, 0x0000ff4b, 0x0000ff2b, 0x0000ff4c, 0x0000ff2c, 0x0000ff4d, 0x0000ff2d, 0x0000ff4e, 0x0000ff2e, 0x0000ff4f, 0x0000ff2f, 0x0000ff50, 0x0000ff30, 0x0000ff51, 0x0000ff31, 0x0000ff52, 0x0000ff32, 0x0000ff53, 0x0000ff33, 0x0000ff54, 0x0000ff34, 0x0000ff55, 0x0000ff35, 0x0000ff56, 0x0000ff36, 0x0000ff57, 0x0000ff37, 0x0000ff58, 0x0000ff38, 0x0000ff59, 0x0000ff39, 0x0000ff5a, 0x0000ff3a, 0x00010428, 0x00010400, 0x00010429, 0x00010401, 0x0001042a, 0x00010402, 0x0001042b, 0x00010403, 0x0001042c, 0x00010404, 0x0001042d, 0x00010405, 0x0001042e, 0x00010406, 0x0001042f, 0x00010407, 0x00010430, 0x00010408, 0x00010431, 0x00010409, 0x00010432, 0x0001040a, 0x00010433, 0x0001040b, 0x00010434, 0x0001040c, 0x00010435, 0x0001040d, 0x00010436, 0x0001040e, 0x00010437, 0x0001040f, 0x00010438, 0x00010410, 0x00010439, 0x00010411, 0x0001043a, 0x00010412, 0x0001043b, 0x00010413, 0x0001043c, 0x00010414, 0x0001043d, 0x00010415, 0x0001043e, 0x00010416, 0x0001043f, 0x00010417, 0x00010440, 0x00010418, 0x00010441, 0x00010419, 0x00010442, 0x0001041a, 0x00010443, 0x0001041b, 0x00010444, 0x0001041c, 0x00010445, 0x0001041d, 0x00010446, 0x0001041e, 0x00010447, 0x0001041f, 0x00010448, 0x00010420, 0x00010449, 0x00010421, 0x0001044a, 0x00010422, 0x0001044b, 0x00010423, 0x0001044c, 0x00010424, 0x0001044d, 0x00010425, }; #endif /*UTF8TABLES_H_*/ modsecurity-apache_2.7.7/apache2/msc_geo.c0000664000175000017500000005210112243422537020721 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #include "msc_geo.h" /* -- Lookup Tables -- */ static const char geo_country_code[GEO_COUNTRY_LAST + 1][4] = { "--", "AP","EU","AD","AE","AF","AG","AI","AL","AM","AN", "AO","AQ","AR","AS","AT","AU","AW","AZ","BA","BB", "BD","BE","BF","BG","BH","BI","BJ","BM","BN","BO", "BR","BS","BT","BV","BW","BY","BZ","CA","CC","CD", "CF","CG","CH","CI","CK","CL","CM","CN","CO","CR", "CU","CV","CX","CY","CZ","DE","DJ","DK","DM","DO", "DZ","EC","EE","EG","EH","ER","ES","ET","FI","FJ", "FK","FM","FO","FR","FX","GA","GB","GD","GE","GF", "GH","GI","GL","GM","GN","GP","GQ","GR","GS","GT", "GU","GW","GY","HK","HM","HN","HR","HT","HU","ID", "IE","IL","IN","IO","IQ","IR","IS","IT","JM","JO", "JP","KE","KG","KH","KI","KM","KN","KP","KR","KW", "KY","KZ","LA","LB","LC","LI","LK","LR","LS","LT", "LU","LV","LY","MA","MC","MD","MG","MH","MK","ML", "MM","MN","MO","MP","MQ","MR","MS","MT","MU","MV", "MW","MX","MY","MZ","NA","NC","NE","NF","NG","NI", "NL","NO","NP","NR","NU","NZ","OM","PA","PE","PF", "PG","PH","PK","PL","PM","PN","PR","PS","PT","PW", "PY","QA","RE","RO","RU","RW","SA","SB","SC","SD", "SE","SG","SH","SI","SJ","SK","SL","SM","SN","SO", "SR","ST","SV","SY","SZ","TC","TD","TF","TG","TH", "TJ","TK","TM","TN","TO","TL","TR","TT","TV","TW", "TZ","UA","UG","UM","US","UY","UZ","VA","VC","VE", "VG","VI","VN","VU","WF","WS","YE","YT","RS","ZA", "ZM","ME","ZW","A1","A2","O1","AX","GG","IM","JE" }; static const char geo_country_code3[GEO_COUNTRY_LAST + 1][4] = { "--", "AP","EU","AND","ARE","AFG","ATG","AIA","ALB","ARM","ANT", "AGO","AQ","ARG","ASM","AUT","AUS","ABW","AZE","BIH","BRB", "BGD","BEL","BFA","BGR","BHR","BDI","BEN","BMU","BRN","BOL", "BRA","BHS","BTN","BV","BWA","BLR","BLZ","CAN","CC","COD", "CAF","COG","CHE","CIV","COK","CHL","CMR","CHN","COL","CRI", "CUB","CPV","CX","CYP","CZE","DEU","DJI","DNK","DMA","DOM", "DZA","ECU","EST","EGY","ESH","ERI","ESP","ETH","FIN","FJI", "FLK","FSM","FRO","FRA","FX","GAB","GBR","GRD","GEO","GUF", "GHA","GIB","GRL","GMB","GIN","GLP","GNQ","GRC","GS","GTM", "GUM","GNB","GUY","HKG","HM","HND","HRV","HTI","HUN","IDN", "IRL","ISR","IND","IO","IRQ","IRN","ISL","ITA","JAM","JOR", "JPN","KEN","KGZ","KHM","KIR","COM","KNA","PRK","KOR","KWT", "CYM","KAZ","LAO","LBN","LCA","LIE","LKA","LBR","LSO","LTU", "LUX","LVA","LBY","MAR","MCO","MDA","MDG","MHL","MKD","MLI", "MMR","MNG","MAC","MNP","MTQ","MRT","MSR","MLT","MUS","MDV", "MWI","MEX","MYS","MOZ","NAM","NCL","NER","NFK","NGA","NIC", "NLD","NOR","NPL","NRU","NIU","NZL","OMN","PAN","PER","PYF", "PNG","PHL","PAK","POL","SPM","PCN","PRI","PSE","PRT","PLW", "PRY","QAT","REU","ROU","RUS","RWA","SAU","SLB","SYC","SDN", "SWE","SGP","SHN","SVN","SJM","SVK","SLE","SMR","SEN","SOM", "SUR","STP","SLV","SYR","SWZ","TCA","TCD","TF","TGO","THA", "TJK","TKL","TKM","TUN","TON","TLS","TUR","TTO","TUV","TWN", "TZA","UKR","UGA","UM","USA","URY","UZB","VAT","VCT","VEN", "VGB","VIR","VNM","VUT","WLF","WSM","YEM","YT","SRB","ZAF", "ZMB","MNE","ZWE","A1","A2","O1","ALA","GGY","IMN","JEY" }; static const char *const geo_country_name[GEO_COUNTRY_LAST + 1] = { "N/A", "Asia/Pacific Region","Europe","Andorra","United Arab Emirates","Afghanistan","Antigua and Barbuda","Anguilla","Albania","Armenia","Netherlands Antilles", "Angola","Antarctica","Argentina","American Samoa","Austria","Australia","Aruba","Azerbaijan","Bosnia and Herzegovina","Barbados", "Bangladesh","Belgium","Burkina Faso","Bulgaria","Bahrain","Burundi","Benin","Bermuda","Brunei Darussalam","Bolivia", "Brazil","Bahamas","Bhutan","Bouvet Island","Botswana","Belarus","Belize","Canada","Cocos (Keeling) Islands","Congo, The Democratic Republic of the", "Central African Republic","Congo","Switzerland","Cote D'Ivoire","Cook Islands","Chile","Cameroon","China","Colombia","Costa Rica", "Cuba","Cape Verde","Christmas Island","Cyprus","Czech Republic","Germany","Djibouti","Denmark","Dominica","Dominican Republic", "Algeria","Ecuador","Estonia","Egypt","Western Sahara","Eritrea","Spain","Ethiopia","Finland","Fiji", "Falkland Islands (Malvinas)","Micronesia, Federated States of","Faroe Islands","France","France, Metropolitan","Gabon","United Kingdom","Grenada","Georgia","French Guiana", "Ghana","Gibraltar","Greenland","Gambia","Guinea","Guadeloupe","Equatorial Guinea","Greece","South Georgia and the South Sandwich Islands","Guatemala", "Guam","Guinea-Bissau","Guyana","Hong Kong","Heard Island and McDonald Islands","Honduras","Croatia","Haiti","Hungary","Indonesia", "Ireland","Israel","India","British Indian Ocean Territory","Iraq","Iran, Islamic Republic of","Iceland","Italy","Jamaica","Jordan", "Japan","Kenya","Kyrgyzstan","Cambodia","Kiribati","Comoros","Saint Kitts and Nevis","Korea, Democratic People's Republic of","Korea, Republic of","Kuwait", "Cayman Islands","Kazakhstan","Lao People's Democratic Republic","Lebanon","Saint Lucia","Liechtenstein","Sri Lanka","Liberia","Lesotho","Lithuania", "Luxembourg","Latvia","Libyan Arab Jamahiriya","Morocco","Monaco","Moldova, Republic of","Madagascar","Marshall Islands","Macedonia","Mali", "Myanmar","Mongolia","Macau","Northern Mariana Islands","Martinique","Mauritania","Montserrat","Malta","Mauritius","Maldives", "Malawi","Mexico","Malaysia","Mozambique","Namibia","New Caledonia","Niger","Norfolk Island","Nigeria","Nicaragua", "Netherlands","Norway","Nepal","Nauru","Niue","New Zealand","Oman","Panama","Peru","French Polynesia", "Papua New Guinea","Philippines","Pakistan","Poland","Saint Pierre and Miquelon","Pitcairn Islands","Puerto Rico","Palestinian Territory","Portugal","Palau", "Paraguay","Qatar","Reunion","Romania","Russian Federation","Rwanda","Saudi Arabia","Solomon Islands","Seychelles","Sudan", "Sweden","Singapore","Saint Helena","Slovenia","Svalbard and Jan Mayen","Slovakia","Sierra Leone","San Marino","Senegal","Somalia","Suriname", "Sao Tome and Principe","El Salvador","Syrian Arab Republic","Swaziland","Turks and Caicos Islands","Chad","French Southern Territories","Togo","Thailand", "Tajikistan","Tokelau","Turkmenistan","Tunisia","Tonga","Timor-Leste","Turkey","Trinidad and Tobago","Tuvalu","Taiwan", "Tanzania, United Republic of","Ukraine","Uganda","United States Minor Outlying Islands","United States","Uruguay","Uzbekistan","Holy See (Vatican City State)","Saint Vincent and the Grenadines","Venezuela", "Virgin Islands, British","Virgin Islands, U.S.","Vietnam","Vanuatu","Wallis and Futuna","Samoa","Yemen","Mayotte","Serbia","South Africa", "Zambia","Montenegro","Zimbabwe","Anonymous Proxy","Satellite Provider","Other","Aland Islands","Guernsey","Isle of Man","Jersey" }; static const char geo_country_continent[GEO_COUNTRY_LAST + 1][4] = { "--", "AS","EU","EU","AS","AS","SA","SA","EU","AS","SA", "AF","AN","SA","OC","EU","OC","SA","AS","EU","SA", "AS","EU","AF","EU","AS","AF","AF","SA","AS","SA", "SA","SA","AS","AF","AF","EU","SA","NA","AS","AF", "AF","AF","EU","AF","OC","SA","AF","AS","SA","SA", "SA","AF","AS","AS","EU","EU","AF","EU","SA","SA", "AF","SA","EU","AF","AF","AF","EU","AF","EU","OC", "SA","OC","EU","EU","EU","AF","EU","SA","AS","SA", "AF","EU","SA","AF","AF","SA","AF","EU","SA","SA", "OC","AF","SA","AS","AF","SA","EU","SA","EU","AS", "EU","AS","AS","AS","AS","AS","EU","EU","SA","AS", "AS","AF","AS","AS","OC","AF","SA","AS","AS","AS", "SA","AS","AS","AS","SA","EU","AS","AF","AF","EU", "EU","EU","AF","AF","EU","EU","AF","OC","EU","AF", "AS","AS","AS","OC","SA","AF","SA","EU","AF","AS", "AF","NA","AS","AF","AF","OC","AF","OC","AF","SA", "EU","EU","AS","OC","OC","OC","AS","SA","SA","OC", "OC","AS","AS","EU","SA","OC","SA","AS","EU","OC", "SA","AS","AF","EU","AS","AF","AS","OC","AF","AF", "EU","AS","AF","EU","EU","EU","AF","EU","AF","AF", "SA","AF","SA","AS","AF","SA","AF","AF","AF","AS", "AS","OC","AS","AF","OC","AS","AS","SA","OC","AS", "AF","EU","AF","OC","NA","SA","AS","EU","SA","SA", "SA","SA","AS","OC","OC","OC","AS","AF","EU","AF", "AF","EU","AF","--","--","--","EU","EU","EU","EU" }; typedef enum { GEOIP_COUNTRY_EDITION = 1, GEOIP_REGION_EDITION_REV0 = 7, GEOIP_CITY_EDITION_REV0 = 6, GEOIP_ORG_EDITION = 5, GEOIP_ISP_EDITION = 4, GEOIP_CITY_EDITION_REV1 = 2, GEOIP_REGION_EDITION_REV1 = 3, GEOIP_PROXY_EDITION = 8, GEOIP_ASNUM_EDITION = 9, GEOIP_NETSPEED_EDITION = 10, GEOIP_DOMAIN_EDITION = 11 } GeoIPDBTypes; static void create_segments(geo_db *geo) { int i, j; unsigned char delim[3]; unsigned char buf[GEO_SEGMENT_RECORD_LENGTH]; apr_size_t nbytes; apr_off_t offset; geo->ctry_offset = 0; geo->dbtype = GEOIP_COUNTRY_EDITION; offset = -3l; apr_file_seek(geo->db, APR_END, &offset); for (i = 0; i < GEO_STRUCT_INFO_MAX_SIZE; i++) { apr_file_read_full(geo->db, &delim, 3, &nbytes); if (delim[0] == 255 && delim[1] == 255 && delim[2] == 255) { apr_file_read_full(geo->db, &geo->dbtype, 1, &nbytes); if (geo->dbtype >= 106) { geo->dbtype -= 105; } if (geo->dbtype == GEOIP_REGION_EDITION_REV0) { geo->ctry_offset = GEO_STATE_BEGIN_REV0; } else if (geo->dbtype == GEOIP_REGION_EDITION_REV1) { geo->ctry_offset = GEO_STATE_BEGIN_REV1; } else if (geo->dbtype == GEOIP_CITY_EDITION_REV0 || geo->dbtype == GEOIP_CITY_EDITION_REV1 || geo->dbtype == GEOIP_ORG_EDITION || geo->dbtype == GEOIP_ISP_EDITION || geo->dbtype == GEOIP_ASNUM_EDITION) { geo->ctry_offset = 0; apr_file_read_full(geo->db, &buf, GEO_SEGMENT_RECORD_LENGTH, &nbytes); for (j = 0; j < GEO_SEGMENT_RECORD_LENGTH; j++) { geo->ctry_offset += (buf[j] << (j * 8)); } } break; } else { offset = -4l; apr_file_seek(geo->db, APR_CUR, &offset); } } if (geo->dbtype == GEOIP_COUNTRY_EDITION || geo->dbtype == GEOIP_PROXY_EDITION || geo->dbtype == GEOIP_NETSPEED_EDITION) { geo->ctry_offset = GEO_COUNTRY_BEGIN; } } static int db_open(directory_config *dcfg, char **error_msg) { char errstr[1024]; apr_pool_t *mp = dcfg->mp; geo_db *geo = dcfg->geo; apr_status_t rc; #ifdef DEBUG_CONF fprintf(stderr, "GEO: Initializing geo DB \"%s\".\n", geo->dbfn); #endif if ((rc = apr_file_open(&geo->db, geo->dbfn, APR_READ, APR_OS_DEFAULT, mp)) != APR_SUCCESS) { *error_msg = apr_psprintf(mp, "Could not open geo database \"%s\": %s", geo->dbfn, apr_strerror(rc, errstr, 1024)); return 0; } create_segments(geo); return 1; } static int field_length(const char *field, int maxlen) { int i; if (field == NULL) { return 0; } for (i = 0; i < maxlen; i++) { if (field[i] == '\0') { break; } } return i; } /** * Initialise Geo data structure */ int geo_init(directory_config *dcfg, const char *dbfn, char **error_msg) { *error_msg = NULL; if ((dcfg->geo == NULL) || (dcfg->geo == NOT_SET_P)) { dcfg->geo = apr_pcalloc(dcfg->mp, sizeof(geo_db)); } dcfg->geo->db = NULL; dcfg->geo->dbfn = apr_pstrdup(dcfg->mp, dbfn); dcfg->geo->dbtype = 0; dcfg->geo->ctry_offset = 0; return db_open(dcfg, error_msg); } /** * Perform geographical lookup on target. */ int geo_lookup(modsec_rec *msr, geo_rec *georec, const char *target, char **error_msg) { apr_sockaddr_t *addr; long ipnum = 0; char *targetip = NULL; geo_db *geo = msr->txcfg->geo; char errstr[1024]; unsigned char buf[2* GEO_MAX_RECORD_LEN]; const int reclen = 3; /* Algorithm needs changed if this changes */ apr_size_t nbytes; unsigned int rec_val = 0; apr_off_t seekto = 0; apr_status_t ret; int rc; int country = 0; int level; double dtmp; int itmp; *error_msg = NULL; /* init */ georec->country_code = geo_country_code[0]; georec->country_code3 = geo_country_code3[0]; georec->country_name = geo_country_name[0]; georec->country_continent = geo_country_continent[0]; georec->region = ""; georec->city = ""; georec->postal_code = ""; georec->latitude = 0; georec->longitude = 0; georec->dma_code = 0; georec->area_code = 0; if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "GEO: Looking up \"%s\".", log_escape(msr->mp, target)); } /* NOTE: This only works with ipv4 */ if ((rc = apr_sockaddr_info_get(&addr, target, APR_INET, 0, 0, msr->mp)) != APR_SUCCESS) { *error_msg = apr_psprintf(msr->mp, "Geo lookup for \"%s\" failed: %s", log_escape(msr->mp, target), apr_strerror(rc, errstr, 1024)); msr_log(msr, 4, "%s", *error_msg); return 0; } if ((rc = apr_sockaddr_ip_get(&targetip, addr)) != APR_SUCCESS) { *error_msg = apr_psprintf(msr->mp, "Geo lookup for \"%s\" failed: %s", log_escape(msr->mp, target), apr_strerror(rc, errstr, 1024)); msr_log(msr, 4, "%s", *error_msg); return 0; }; /* Why is this in host byte order? */ ipnum = ntohl(addr->sa.sin.sin_addr.s_addr); if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "GEO: Using address \"%s\" (0x%08lx). %lu", targetip, ipnum, ipnum); } ret = apr_global_mutex_lock(msr->modsecurity->geo_lock); if (ret != APR_SUCCESS) { msr_log(msr, 1, "Geo Lookup: Failed to lock proc mutex: %s", get_apr_error(msr->mp, ret)); } for (level = 31; level >= 0; level--) { /* Read the record */ seekto = 2 * reclen * rec_val; apr_file_seek(geo->db, APR_SET, &seekto); /* TODO: check rc */ rc = apr_file_read_full(geo->db, &buf, (2 * reclen), &nbytes); /* NOTE: This is hard-coded for size 3 records */ /* Left */ if ((ipnum & (1 << level)) == 0) { rec_val = (buf[3*0 + 0] << (0*8)) + (buf[3*0 + 1] << (1*8)) + (buf[3*0 + 2] << (2*8)); } /* Right */ else { rec_val = (buf[3*1 + 0] << (0*8)) + (buf[3*1 + 1] << (1*8)) + (buf[3*1 + 2] << (2*8)); } /* If we are past the country offset, then we are done */ if (rec_val >= geo->ctry_offset) { break; } } if (rec_val == geo->ctry_offset) { *error_msg = apr_psprintf(msr->mp, "No geo data for \"%s\").", log_escape(msr->mp, target)); msr_log(msr, 4, "%s", *error_msg); ret = apr_global_mutex_unlock(msr->modsecurity->geo_lock); if (ret != APR_SUCCESS) { msr_log(msr, 1, "Geo Lookup: Failed to lock proc mutex: %s", get_apr_error(msr->mp, ret)); } return 0; } if (geo->dbtype == GEO_COUNTRY_DATABASE) { country = rec_val; country -= geo->ctry_offset; if ((country <= 0) || (country > GEO_COUNTRY_LAST)) { *error_msg = apr_psprintf(msr->mp, "No geo data for \"%s\" (country %d).", log_escape(msr->mp, target), country); msr_log(msr, 4, "%s", *error_msg); ret = apr_global_mutex_unlock(msr->modsecurity->geo_lock); if (ret != APR_SUCCESS) { msr_log(msr, 1, "Geo Lookup: Failed to lock proc mutex: %s", get_apr_error(msr->mp, ret)); } return 0; } /* Country */ georec->country_code = geo_country_code[country]; georec->country_code3 = geo_country_code3[country]; georec->country_name = geo_country_name[country]; georec->country_continent = geo_country_continent[country]; } else { int field_len = 0; int rec_offset = 0; int remaining = GEO_CITY_RECORD_LEN; unsigned char cbuf[GEO_CITY_RECORD_LEN]; seekto = rec_val + (2 * reclen - 1) * geo->ctry_offset; apr_file_seek(geo->db, APR_SET, &seekto); /* TODO: check rc */ rc = apr_file_read_full(geo->db, &cbuf, sizeof(cbuf), &nbytes); country = cbuf[0]; if ((country <= 0) || (country > GEO_COUNTRY_LAST)) { *error_msg = apr_psprintf(msr->mp, "No geo data for \"%s\" (country %d).", log_escape(msr->mp, target), country); msr_log(msr, 4, "%s", *error_msg); ret = apr_global_mutex_unlock(msr->modsecurity->geo_lock); if (ret != APR_SUCCESS) { msr_log(msr, 1, "Geo Lookup: Failed to lock proc mutex: %s", get_apr_error(msr->mp, ret)); } return 0; } if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "GEO: rec=\"%s\"", log_escape_raw(msr->mp, cbuf, sizeof(cbuf))); } /* Country */ if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "GEO: country=\"%.*s\"", (1*4), log_escape_raw(msr->mp, cbuf, sizeof(cbuf))); } georec->country_code = geo_country_code[country]; georec->country_code3 = geo_country_code3[country]; georec->country_name = geo_country_name[country]; georec->country_continent = geo_country_continent[country]; rec_offset++; remaining -= rec_offset; /* Region */ field_len = field_length((const char *)cbuf+rec_offset, remaining); if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "GEO: region=\"%.*s\"", ((field_len+1)*4), log_escape_raw(msr->mp, cbuf, sizeof(cbuf))+(rec_offset*4)); } georec->region = apr_pstrmemdup(msr->mp, (const char *)cbuf+rec_offset, (remaining)); rec_offset += field_len + 1; remaining -= field_len + 1; /* City */ field_len = field_length((const char *)cbuf+rec_offset, remaining); if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "GEO: city=\"%.*s\"", ((field_len+1)*4), log_escape_raw(msr->mp, cbuf, sizeof(cbuf))+(rec_offset*4)); } georec->city = apr_pstrmemdup(msr->mp, (const char *)cbuf+rec_offset, (remaining)); rec_offset += field_len + 1; remaining -= field_len + 1; /* Postal Code */ field_len = field_length((const char *)cbuf+rec_offset, remaining); if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "GEO: postal_code=\"%.*s\"", ((field_len+1)*4), log_escape_raw(msr->mp, cbuf, sizeof(cbuf))+(rec_offset*4)); } georec->postal_code = apr_pstrmemdup(msr->mp, (const char *)cbuf+rec_offset, (remaining)); rec_offset += field_len + 1; remaining -= field_len + 1; /* Latitude */ if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "GEO: latitude=\"%.*s\"", (3*4), log_escape_raw(msr->mp, cbuf, sizeof(cbuf))+(rec_offset*4)); } dtmp = cbuf[rec_offset] + (cbuf[rec_offset+1] << 8) + (cbuf[rec_offset+2] << 16); georec->latitude = dtmp/10000 - 180; rec_offset += 3; remaining -= 3; /* Longitude */ if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "GEO: longitude=\"%.*s\"", (3*4), log_escape_raw(msr->mp, cbuf, sizeof(cbuf))+(rec_offset*4)); } dtmp = cbuf[rec_offset] + (cbuf[rec_offset+1] << 8) + (cbuf[rec_offset+2] << 16); georec->longitude = dtmp/10000 - 180; rec_offset += 3; remaining -= 3; /* dma/area codes are in city rev1 and US only */ if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "GEO: dma/area=\"%.*s\"", (3*4), log_escape_raw(msr->mp, cbuf, sizeof(cbuf))+(rec_offset*4)); } if (geo->dbtype == GEO_CITY_DATABASE_1 && georec->country_code[0] == 'U' && georec->country_code[1] == 'S') { /* DMA Code */ itmp = cbuf[rec_offset] + (cbuf[rec_offset+1] << 8) + (cbuf[rec_offset+2] << 16); georec->dma_code = itmp / 1000; georec->area_code = itmp % 1000; rec_offset += 6; remaining -= 6; } } *error_msg = apr_psprintf(msr->mp, "Geo lookup for \"%s\" succeeded.", log_escape(msr->mp, target)); ret = apr_global_mutex_unlock(msr->modsecurity->geo_lock); if (ret != APR_SUCCESS) { msr_log(msr, 1, "Geo Lookup: Failed to lock proc mutex: %s", get_apr_error(msr->mp, ret)); } return 1; } modsecurity-apache_2.7.7/apache2/msc_pcre.c0000664000175000017500000001407012243422537021103 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #include "msc_pcre.h" #include "apr_strings.h" /** * Releases the resources used by a single regular expression pattern. */ static apr_status_t msc_pcre_cleanup(msc_regex_t *regex) { if (regex != NULL) { if (regex->pe != NULL) { #if defined(VERSION_NGINX) pcre_free(regex->pe); #else free(regex->pe); #endif regex->pe = NULL; } if (regex->re != NULL) { pcre_free(regex->re); regex->re = NULL; } } return APR_SUCCESS; } /** * Compiles the provided regular expression pattern. The _err* * parameters are optional, but if they are provided and an error * occurs they will contain the error message and the offset in * the pattern where the offending part of the pattern begins. The * match_limit* parameters are optional and if >0, then will set * match limits. */ void *msc_pregcomp_ex(apr_pool_t *pool, const char *pattern, int options, const char **_errptr, int *_erroffset, int match_limit, int match_limit_recursion) { const char *errptr = NULL; int erroffset; msc_regex_t *regex; pcre_extra *pe = NULL; regex = apr_pcalloc(pool, sizeof(msc_regex_t)); if (regex == NULL) return NULL; regex->pattern = pattern; if ((_errptr == NULL)||(_erroffset == NULL)) { regex->re = pcre_compile(pattern, options, &errptr, &erroffset, NULL); } else { regex->re = pcre_compile(pattern, options, _errptr, _erroffset, NULL); } if (regex->re == NULL) return NULL; #ifdef WITH_PCRE_STUDY #ifdef WITH_PCRE_JIT pe = pcre_study(regex->re, PCRE_STUDY_JIT_COMPILE, &errptr); #else pe = pcre_study(regex->re, 0, &errptr); #endif #endif /* Setup the pcre_extra record if pcre_study did not already do it */ if (pe == NULL) { #if defined(VERSION_NGINX) pe = pcre_malloc(sizeof(pcre_extra)); #else pe = malloc(sizeof(pcre_extra)); #endif if (pe == NULL) { return NULL; } memset(pe, 0, sizeof(pcre_extra)); } #ifdef PCRE_EXTRA_MATCH_LIMIT /* If match limit is available, then use it */ /* Use ModSecurity runtime defaults */ if (match_limit > 0) { pe->match_limit = match_limit; pe->flags |= PCRE_EXTRA_MATCH_LIMIT; } #ifdef MODSEC_PCRE_MATCH_LIMIT /* Default to ModSecurity compiled defaults */ else { pe->match_limit = MODSEC_PCRE_MATCH_LIMIT; pe->flags |= PCRE_EXTRA_MATCH_LIMIT; } #endif /* MODSEC_PCRE_MATCH_LIMIT */ #else #pragma message ( "This PCRE version does not support match limits! Upgrade to at least PCRE v6.5." ) #endif /* PCRE_EXTRA_MATCH_LIMIT */ #ifdef PCRE_EXTRA_MATCH_LIMIT_RECURSION /* If match limit recursion is available, then use it */ /* Use ModSecurity runtime defaults */ if (match_limit_recursion > 0) { pe->match_limit_recursion = match_limit_recursion; pe->flags |= PCRE_EXTRA_MATCH_LIMIT_RECURSION; } #ifdef MODSEC_PCRE_MATCH_LIMIT_RECURSION /* Default to ModSecurity compiled defaults */ else { pe->match_limit_recursion = MODSEC_PCRE_MATCH_LIMIT_RECURSION; pe->flags |= PCRE_EXTRA_MATCH_LIMIT_RECURSION; } #endif /* MODSEC_PCRE_MATCH_LIMIT_RECURSION */ #else #pragma message ( "This PCRE version does not support match recursion limits! Upgrade to at least PCRE v6.5." ) #endif /* PCRE_EXTRA_MATCH_LIMIT_RECURSION */ regex->pe = pe; apr_pool_cleanup_register(pool, (void *)regex, (apr_status_t (*)(void *))msc_pcre_cleanup, apr_pool_cleanup_null); return regex; } /** * Compiles the provided regular expression pattern. Calls msc_pregcomp_ex() * with default limits. */ void *msc_pregcomp(apr_pool_t *pool, const char *pattern, int options, const char **_errptr, int *_erroffset) { return msc_pregcomp_ex(pool, pattern, options, _errptr, _erroffset, 0, 0); } /** * Executes regular expression with extended options. * Returns PCRE_ERROR_NOMATCH when there is no match, error code < -1 * on errors, and a value > 0 when there is a match. */ int msc_regexec_ex(msc_regex_t *regex, const char *s, unsigned int slen, int startoffset, int options, int *ovector, int ovecsize, char **error_msg) { if (error_msg == NULL) return -1000; /* To differentiate from PCRE as it already uses -1. */ *error_msg = NULL; return pcre_exec(regex->re, regex->pe, s, slen, startoffset, options, ovector, ovecsize); } /** * Executes regular expression, capturing subexpressions in the given * vector. Returns PCRE_ERROR_NOMATCH when there is no match, error code < -1 * on errors, and a value > 0 when there is a match. */ int msc_regexec_capture(msc_regex_t *regex, const char *s, unsigned int slen, int *ovector, int ovecsize, char **error_msg) { if (error_msg == NULL) return -1000; /* To differentiate from PCRE as it already uses -1. */ *error_msg = NULL; return msc_regexec_ex(regex, s, slen, 0, 0, ovector, ovecsize, error_msg); } /** * Executes regular expression but ignores any of the subexpression * captures. See above for the return codes. */ int msc_regexec(msc_regex_t *regex, const char *s, unsigned int slen, char **error_msg) { if (error_msg == NULL) return -1000; /* To differentiate from PCRE as it already uses -1. */ *error_msg = NULL; return msc_regexec_ex(regex, s, slen, 0, 0, NULL, 0, error_msg); } /** * Gets info on a compiled regex. */ int msc_fullinfo(msc_regex_t *regex, int what, void *where) { return pcre_fullinfo(regex->re, regex->pe, what, where); } modsecurity-apache_2.7.7/apache2/msc_logging.h0000664000175000017500000000331612243422537021606 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #ifndef _MSC_LOGGING_H_ #define _MSC_LOGGING_H_ #define AUDITLOG_OFF 0 #define AUDITLOG_ON 1 #define AUDITLOG_RELEVANT 2 #define AUDITLOG_SERIAL 0 #define AUDITLOG_CONCURRENT 1 #define AUDITLOG_PART_FIRST 'A' #define AUDITLOG_PART_HEADER 'A' #define AUDITLOG_PART_REQUEST_HEADERS 'B' #define AUDITLOG_PART_REQUEST_BODY 'C' #define AUDITLOG_PART_RESPONSE_HEADERS 'D' #define AUDITLOG_PART_RESPONSE_BODY 'E' #define AUDITLOG_PART_A_RESPONSE_HEADERS 'F' #define AUDITLOG_PART_A_RESPONSE_BODY 'G' #define AUDITLOG_PART_TRAILER 'H' #define AUDITLOG_PART_FAKE_REQUEST_BODY 'I' #define AUDITLOG_PART_UPLOADS 'J' #define AUDITLOG_PART_MATCHEDRULES 'K' #define AUDITLOG_PART_LAST 'K' #define AUDITLOG_PART_ENDMARKER 'Z' #include "modsecurity.h" #include "apr_pools.h" int DSOLOCAL is_valid_parts_specification(char *p); char DSOLOCAL *construct_log_vcombinedus_limited(modsec_rec *msr, int _limit, int *was_limited); void DSOLOCAL sec_audit_logger(modsec_rec *msr); #endif modsecurity-apache_2.7.7/apache2/modsecurity.h0000664000175000017500000005335412254164464021700 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #ifndef _MODSECURITY_H_ #define _MODSECURITY_H_ #include #include #include #include #include typedef struct rule_exception rule_exception; typedef struct rule_exception hash_method; typedef struct modsec_rec modsec_rec; typedef struct directory_config directory_config; typedef struct error_message_t error_message_t; typedef struct msc_engine msc_engine; typedef struct msc_data_chunk msc_data_chunk; typedef struct msc_arg msc_arg; typedef struct msc_string msc_string; typedef struct msc_parm msc_parm; #include "msc_release.h" #include "msc_logging.h" #include "msc_multipart.h" #include "msc_pcre.h" #include "msc_util.h" #include "msc_xml.h" #include "msc_geo.h" #include "msc_gsb.h" #include "msc_unicode.h" #include "re.h" #include "msc_crypt.h" #include "ap_config.h" #include "apr_md5.h" #include "apr_strings.h" #include "apr_hash.h" #include "httpd.h" #include "http_config.h" #include "http_log.h" #include "http_protocol.h" #if defined(WITH_LUA) #include "msc_lua.h" #endif #define PHASE_REQUEST_HEADERS 1 #define PHASE_REQUEST_BODY 2 #define PHASE_RESPONSE_HEADERS 3 #define PHASE_RESPONSE_BODY 4 #define PHASE_LOGGING 5 #define PHASE_FIRST PHASE_REQUEST_HEADERS #define PHASE_LAST PHASE_LOGGING #define NOT_SET -1l #define NOT_SET_P ((void *)-1l) #define CREATEMODE ( APR_UREAD | APR_UWRITE | APR_GREAD ) #define CREATEMODE_DIR ( APR_UREAD | APR_UWRITE | APR_UEXECUTE | APR_GREAD | APR_GEXECUTE ) #if defined(NETWARE) #define CREATEMODE_UNISTD ( S_IREAD | S_IWRITE ) #elif defined(WIN32) #define CREATEMODE_UNISTD ( _S_IREAD | _S_IWRITE ) #else #define CREATEMODE_UNISTD ( S_IRUSR | S_IWUSR | S_IRGRP ) #endif #if !defined(O_BINARY) #define O_BINARY (0) #endif #ifndef PIPE_BUF #define PIPE_BUF (512) #endif #define REQUEST_BODY_HARD_LIMIT 1073741824L #define REQUEST_BODY_DEFAULT_INMEMORY_LIMIT 131072 #define REQUEST_BODY_DEFAULT_LIMIT 134217728 #define REQUEST_BODY_NO_FILES_DEFAULT_LIMIT 1048576 #define RESPONSE_BODY_DEFAULT_LIMIT 524288 #define RESPONSE_BODY_HARD_LIMIT 1073741824L #define RESPONSE_BODY_LIMIT_ACTION_REJECT 0 #define RESPONSE_BODY_LIMIT_ACTION_PARTIAL 1 #define REQUEST_BODY_FORCEBUF_OFF 0 #define REQUEST_BODY_FORCEBUF_ON 1 #define REQUEST_BODY_LIMIT_ACTION_REJECT 0 #define REQUEST_BODY_LIMIT_ACTION_PARTIAL 1 #define SECACTION_TARGETS "REMOTE_ADDR" #define SECACTION_ARGS "@unconditionalMatch" #define SECMARKER_TARGETS "REMOTE_ADDR" #define SECMARKER_ARGS "@noMatch" #define SECMARKER_BASE_ACTIONS "t:none,pass,marker:" #if !defined(OS2) && !defined(WIN32) && !defined(BEOS) && !defined(NETWARE) #include "unixd.h" #define __SET_MUTEX_PERMS #endif #define COOKIES_V0 0 #define COOKIES_V1 1 #ifdef WIN32 #include #else #include #include #endif #define NOTE_MSR "modsecurity-tx-context" #define FATAL_ERROR "ModSecurity: Fatal error (memory allocation or unexpected internal error)!" extern DSOLOCAL char *new_server_signature; extern DSOLOCAL char *chroot_dir; extern module AP_MODULE_DECLARE_DATA security2_module; extern DSOLOCAL const command_rec module_directives[]; extern DSOLOCAL unsigned long int msc_pcre_match_limit; extern DSOLOCAL unsigned long int msc_pcre_match_limit_recursion; extern DSOLOCAL unsigned long int conn_read_state_limit; extern DSOLOCAL unsigned long int conn_write_state_limit; extern DSOLOCAL unsigned long int unicode_codepage; extern DSOLOCAL int *unicode_map_table; #define RESBODY_STATUS_NOT_READ 0 /* we were not configured to read the body */ #define RESBODY_STATUS_ERROR 1 /* error occured while we were reading the body */ #define RESBODY_STATUS_PARTIAL 2 /* partial body content available in the brigade */ #define RESBODY_STATUS_READ_BRIGADE 3 /* body was read but not flattened */ #define RESBODY_STATUS_READ 4 /* body was read and flattened */ #define IF_STATUS_NONE 0 #define IF_STATUS_WANTS_TO_RUN 1 #define IF_STATUS_COMPLETE 2 #define OF_STATUS_NOT_STARTED 0 #define OF_STATUS_IN_PROGRESS 1 #define OF_STATUS_COMPLETE 2 #define MSC_REQBODY_NONE 0 #define MSC_REQBODY_MEMORY 1 #define MSC_REQBODY_DISK 2 #define ACTION_NONE 0 #define ACTION_DENY 1 #define ACTION_REDIRECT 2 #define ACTION_PROXY 3 #define ACTION_DROP 4 #define ACTION_ALLOW 5 #define ACTION_ALLOW_REQUEST 6 #define ACTION_ALLOW_PHASE 7 #define ACTION_PAUSE 8 #define MODSEC_DISABLED 0 #define MODSEC_DETECTION_ONLY 1 #define MODSEC_ENABLED 2 #define HASH_DISABLED 0 #define HASH_ENABLED 1 #define HASH_URL_HREF_HASH_RX 0 #define HASH_URL_HREF_HASH_PM 1 #define HASH_URL_FACTION_HASH_RX 2 #define HASH_URL_FACTION_HASH_PM 3 #define HASH_URL_LOCATION_HASH_RX 4 #define HASH_URL_LOCATION_HASH_PM 5 #define HASH_URL_IFRAMESRC_HASH_RX 6 #define HASH_URL_IFRAMESRC_HASH_PM 7 #define HASH_URL_FRAMESRC_HASH_RX 8 #define HASH_URL_FRAMESRC_HASH_PM 9 #define HASH_KEYONLY 0 #define HASH_SESSIONID 1 #define HASH_REMOTEIP 2 #define MODSEC_CACHE_DISABLED 0 #define MODSEC_CACHE_ENABLED 1 #define MODSEC_OFFLINE 0 #define MODSEC_ONLINE 1 #define REGEX_CAPTURE_BUFLEN 1024 #define KEEP_FILES_OFF 0 #define KEEP_FILES_ON 1 #define KEEP_FILES_RELEVANT_ONLY 2 #define RULE_EXCEPTION_IMPORT_ID 1 #define RULE_EXCEPTION_IMPORT_MSG 2 #define RULE_EXCEPTION_REMOVE_ID 3 #define RULE_EXCEPTION_REMOVE_MSG 4 #define RULE_EXCEPTION_REMOVE_TAG 5 #define NBSP 160 struct rule_exception { int type; const char *param; void *param_data; }; struct modsec_rec { apr_pool_t *mp; msc_engine *modsecurity; request_rec *r_early; request_rec *r; directory_config *dcfg1; directory_config *dcfg2; directory_config *usercfg; directory_config *txcfg; unsigned int reqbody_should_exist; unsigned int reqbody_chunked; unsigned int phase; unsigned int phase_request_headers_complete; unsigned int phase_request_body_complete; apr_bucket_brigade *if_brigade; unsigned int if_status; unsigned int if_started_forwarding; apr_size_t reqbody_length; apr_bucket_brigade *of_brigade; unsigned int of_status; unsigned int of_done_reading; unsigned int of_skipping; unsigned int of_partial; unsigned int of_is_error; unsigned int resbody_status; apr_size_t resbody_length; char *resbody_data; unsigned int resbody_contains_html; apr_size_t stream_input_length; char *stream_input_data; apr_size_t stream_output_length; char *stream_output_data; unsigned int of_stream_changed; unsigned int if_stream_changed; apr_array_header_t *error_messages; apr_array_header_t *alerts; const char *txid; const char *sessionid; const char *userid; const char *server_software; const char *local_addr; unsigned int local_port; const char *local_user; /* client */ const char *remote_addr; unsigned int remote_port; const char *remote_user; /* useragent */ const char *useragent_ip; /* request */ const char *request_line; const char *request_method; const char *request_uri; const char *query_string; const char *request_protocol; const char *hostname; apr_table_t *request_headers; apr_off_t request_content_length; const char *request_content_type; apr_table_t *arguments; apr_table_t *arguments_to_sanitize; apr_table_t *request_headers_to_sanitize; apr_table_t *response_headers_to_sanitize; apr_table_t *request_cookies; apr_table_t *pattern_to_sanitize; unsigned int urlencoded_error; unsigned int inbound_error; unsigned int outbound_error; unsigned int is_relevant; apr_table_t *tx_vars; /* ENH: refactor to allow arbitrary var tables */ apr_table_t *geo_vars; /* response */ unsigned int response_status; const char *status_line; const char *response_protocol; apr_table_t *response_headers; unsigned int response_headers_sent; apr_off_t bytes_sent; /* modsecurity request body processing stuff */ unsigned int msc_reqbody_storage; /* on disk or in memory */ unsigned int msc_reqbody_spilltodisk; unsigned int msc_reqbody_read; apr_pool_t *msc_reqbody_mp; /* this is where chunks are allocated from */ apr_array_header_t *msc_reqbody_chunks; /* data chunks when stored in memory */ unsigned int msc_reqbody_length; /* the amount of data received */ int msc_reqbody_chunk_position; /* used when retrieving the body */ unsigned int msc_reqbody_chunk_offset; /* offset of the chunk currently in use */ msc_data_chunk *msc_reqbody_chunk_current; /* current chunk */ char *msc_reqbody_buffer; const char *msc_reqbody_filename; /* when stored on disk */ int msc_reqbody_fd; msc_data_chunk *msc_reqbody_disk_chunk; const char *msc_reqbody_processor; int msc_reqbody_error; const char *msc_reqbody_error_msg; apr_size_t msc_reqbody_no_files_length; char *multipart_filename; char *multipart_name; multipart_data *mpd; /* MULTIPART processor data structure */ xml_data *xml; /* XML processor data structure */ /* audit logging */ char *new_auditlog_boundary; char *new_auditlog_filename; apr_file_t *new_auditlog_fd; unsigned int new_auditlog_size; apr_md5_ctx_t new_auditlog_md5ctx; unsigned int was_intercepted; unsigned int rule_was_intercepted; unsigned int intercept_phase; msre_actionset *intercept_actionset; const char *intercept_message; /* performance measurement */ apr_time_t request_time; apr_time_t time_phase1; apr_time_t time_phase2; apr_time_t time_phase3; apr_time_t time_phase4; apr_time_t time_phase5; apr_time_t time_storage_read; apr_time_t time_storage_write; apr_time_t time_logging; apr_time_t time_gc; apr_table_t *perf_rules; apr_array_header_t *matched_rules; msc_string *matched_var; int highest_severity; /* upload */ int upload_extract_files; int upload_remove_files; int upload_files_count; /* other */ apr_table_t *collections_original; apr_table_t *collections; apr_table_t *collections_dirty; /* rule processing temp pool */ apr_pool_t *msc_rule_mptmp; /* content injection */ const char *content_prepend; apr_off_t content_prepend_len; const char *content_append; apr_off_t content_append_len; /* data cache */ apr_hash_t *tcache; apr_size_t tcache_items; /* removed rules */ apr_array_header_t *removed_rules; apr_array_header_t *removed_rules_tag; apr_array_header_t *removed_rules_msg; /* removed targets */ apr_table_t *removed_targets; /* When "allow" is executed the variable below is * updated to contain the scope of the allow action. Set * at 0 by default, it will have ACTION_ALLOW if we are * to allow phases 1-4 and ACTION_ALLOW_REQUEST if we * are to allow phases 1-2 only. */ unsigned int allow_scope; /* matched vars */ apr_table_t *matched_vars; /* Generic request body processor context to be used by custom parsers. */ void *reqbody_processor_ctx; htmlDocPtr crypto_html_tree; #if defined(WITH_LUA) #ifdef CACHE_LUA lua_State *L; #endif #endif int msc_sdbm_delete_error; }; struct directory_config { apr_pool_t *mp; msre_ruleset *ruleset; int is_enabled; int reqbody_access; int reqintercept_oe; int reqbody_buffering; long int reqbody_inmemory_limit; long int reqbody_limit; long int reqbody_no_files_limit; int resbody_access; long int of_limit; apr_table_t *of_mime_types; int of_mime_types_cleared; int of_limit_action; int if_limit_action; const char *debuglog_name; int debuglog_level; apr_file_t *debuglog_fd; int cookie_format; int argument_separator; const char *cookiev0_separator; int rule_inheritance; apr_array_header_t *rule_exceptions; /* -- Audit log -- */ /* Max rule time */ int max_rule_time; /* Whether audit log should be enabled in the context or not */ int auditlog_flag; /* AUDITLOG_SERIAL (single file) or AUDITLOG_CONCURRENT (multiple files) */ int auditlog_type; /* Mode for audit log directories and files */ apr_fileperms_t auditlog_dirperms; apr_fileperms_t auditlog_fileperms; /* The name of the audit log file (for the old type), or the * name of the index file (for the new audit log type) */ char *auditlog_name; /* The name of the secondary index file */ char *auditlog2_name; /* The file descriptors for the files above */ apr_file_t *auditlog_fd; apr_file_t *auditlog2_fd; /* For the new-style audit log only, the path where * audit log entries will be stored */ char *auditlog_storage_dir; /* A list of parts to include in the new-style audit log * entry. By default, it contains 'ABCFHZ'. Have a look at * the AUDITLOG_PART_* constants above to decipher the * meaning. */ char *auditlog_parts; /* A regular expression that determines if a response * status is treated as relevant. */ msc_regex_t *auditlog_relevant_regex; /* Upload */ const char *tmp_dir; const char *upload_dir; int upload_keep_files; int upload_validates_files; int upload_filemode; /* int only so NOT_SET works */ int upload_file_limit; /* Used only in the configuration phase. */ msre_rule *tmp_chain_starter; msre_actionset *tmp_default_actionset; apr_table_t *tmp_rule_placeholders; /* Misc */ const char *data_dir; const char *webappid; const char *sensor_id; const char *httpBlkey; /* Content injection. */ int content_injection_enabled; /* Stream Inspection */ int stream_inbody_inspection; int stream_outbody_inspection; /* Geo Lookup */ geo_db *geo; /* Gsb Lookup */ gsb_db *gsb; /* Unicode map */ unicode_map *u_map; /* Cache */ int cache_trans; int cache_trans_incremental; apr_size_t cache_trans_min; apr_size_t cache_trans_max; apr_size_t cache_trans_maxitems; /* Array to hold signatures of components, which will * appear in the ModSecurity signature in the audit log. */ apr_array_header_t *component_signatures; /* Request character encoding. */ const char *request_encoding; int disable_backend_compression; /* Collection timeout */ int col_timeout; /* hash of ids */ apr_hash_t *rule_id_htab; /* Hash */ apr_array_header_t *hash_method; const char *crypto_key; int crypto_key_len; const char *crypto_param_name; int hash_is_enabled; int hash_enforcement; int crypto_key_add; int crypto_hash_href_rx; int crypto_hash_faction_rx; int crypto_hash_location_rx; int crypto_hash_iframesrc_rx; int crypto_hash_framesrc_rx; int crypto_hash_href_pm; int crypto_hash_faction_pm; int crypto_hash_location_pm; int crypto_hash_iframesrc_pm; int crypto_hash_framesrc_pm; /* xml */ int xml_external_entity; }; struct error_message_t { const char *file; int line; int level; apr_status_t status; const char *message; }; struct msc_engine { apr_pool_t *mp; apr_global_mutex_t *auditlog_lock; apr_global_mutex_t *geo_lock; msre_engine *msre; unsigned int processing_mode; }; struct msc_data_chunk { char *data; apr_size_t length; unsigned int is_permanent; }; struct msc_arg { const char *name; unsigned int name_len; unsigned int name_origin_offset; unsigned int name_origin_len; const char *value; unsigned int value_len; unsigned int value_origin_offset; unsigned int value_origin_len; const char *origin; }; struct msc_string { char *name; unsigned int name_len; char *value; unsigned int value_len; }; struct msc_parm { char *value; int pad_1; int pad_2; }; /* Engine functions */ msc_engine DSOLOCAL *modsecurity_create(apr_pool_t *mp, int processing_mode); int DSOLOCAL modsecurity_init(msc_engine *msce, apr_pool_t *mp); void DSOLOCAL modsecurity_child_init(msc_engine *msce); void DSOLOCAL modsecurity_shutdown(msc_engine *msce); apr_status_t DSOLOCAL modsecurity_tx_init(modsec_rec *msr); apr_status_t DSOLOCAL modsecurity_process_phase(modsec_rec *msr, unsigned int phase); /* Request body functions */ apr_status_t DSOLOCAL modsecurity_request_body_start(modsec_rec *msr, char **error_msg); apr_status_t DSOLOCAL modsecurity_request_body_store(modsec_rec *msr, const char *data, apr_size_t length, char **error_msg); apr_status_t DSOLOCAL modsecurity_request_body_end(modsec_rec *msr, char **error_msg); apr_status_t DSOLOCAL modsecurity_request_body_to_stream(modsec_rec *msr, const char *buffer, int buflen, char **error_msg); apr_status_t DSOLOCAL modsecurity_request_body_retrieve_start(modsec_rec *msr, char **error_msg); apr_status_t DSOLOCAL modsecurity_request_body_retrieve_end(modsec_rec *msr); /* Retrieves up to nbytes bytes of the request body. Returns 1 on * success, 0 when there is no more data, or -1 on error. On return * nbytes will contain the number of bytes stored in the buffer. */ apr_status_t DSOLOCAL modsecurity_request_body_retrieve(modsec_rec *msr, msc_data_chunk **chunk, long int nbytes, char **error_msg); void DSOLOCAL msc_add(modsec_rec *msr, int level, msre_actionset *actionset, const char *action_message, const char *rule_message); const char DSOLOCAL *msc_alert_message(modsec_rec *msr, msre_actionset *actionset, const char *action_message, const char *rule_message); void DSOLOCAL msc_alert(modsec_rec *msr, int level, msre_actionset *actionset, const char *action_message, const char *rule_message); apr_status_t DSOLOCAL modsecurity_request_body_clear(modsec_rec *msr, char **error_msg); #endif modsecurity-apache_2.7.7/apache2/mod_security2.c0000664000175000017500000015276212252634762022120 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #include #include "http_core.h" #include "http_request.h" #include "modsecurity.h" #include "apache2.h" #include "http_main.h" #include "http_connection.h" #include "apr_optional.h" #include "mod_log_config.h" #include "msc_logging.h" #include "msc_util.h" #include "ap_mpm.h" #include "scoreboard.h" #include "apr_version.h" #if defined(WITH_LUA) #include "msc_lua.h" #endif /* ModSecurity structure */ msc_engine DSOLOCAL *modsecurity = NULL; /* Global module variables; these are used for the Apache-specific functionality */ char DSOLOCAL *chroot_dir = NULL; char DSOLOCAL *new_server_signature = NULL; static char *real_server_signature = NULL; char DSOLOCAL *guardianlog_name = NULL; apr_file_t DSOLOCAL *guardianlog_fd = NULL; char DSOLOCAL *guardianlog_condition = NULL; unsigned long int DSOLOCAL msc_pcre_match_limit = 0; unsigned long int DSOLOCAL msc_pcre_match_limit_recursion = 0; unsigned long int DSOLOCAL conn_read_state_limit = 0; unsigned long int DSOLOCAL conn_write_state_limit = 0; #if defined(WIN32) || defined(VERSION_NGINX) int (*modsecDropAction)(request_rec *r) = NULL; #endif static int server_limit, thread_limit; typedef struct { int child_num; int thread_num; } sb_handle; /* -- Miscellaneous functions -- */ /** * \brief Print informations from used libraries * * \param mp Pointer to memory pool */ static void version(apr_pool_t *mp) { char *pcre_vrs = NULL; ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, NULL, "ModSecurity: APR compiled version=\"%s\"; " "loaded version=\"%s\"", APR_VERSION_STRING, apr_version_string()); if (strstr(apr_version_string(),APR_VERSION_STRING) == NULL) { ap_log_error(APLOG_MARK, APLOG_WARNING, 0, NULL, "ModSecurity: Loaded APR do not match with compiled!"); } pcre_vrs = apr_psprintf(mp,"%d.%d ", PCRE_MAJOR, PCRE_MINOR); ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, NULL, "ModSecurity: PCRE compiled version=\"%s\"; " "loaded version=\"%s\"", pcre_vrs, pcre_version()); if (strstr(pcre_version(),pcre_vrs) == NULL) { ap_log_error(APLOG_MARK, APLOG_WARNING, 0, NULL, "ModSecurity: Loaded PCRE do not match with compiled!"); } /* Lua version function was removed in current 5.1. Need to check in future versions if it's back */ #if defined(WITH_LUA) ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, NULL, "ModSecurity: LUA compiled version=\"%s\"",LUA_VERSION); #endif /* WITH_LUA */ ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, NULL, "ModSecurity: LIBXML compiled version=\"%s\"",LIBXML_DOTTED_VERSION); } /** * Intercepts transaction, using the method specified * in the structure itself. MUST return an HTTP status code, * which will be used to terminate the transaction. */ int perform_interception(modsec_rec *msr) { msre_actionset *actionset = NULL; const char *message = NULL; const char *phase_text = ""; unsigned int pause = 0; int status = DECLINED; int log_level = 1; /* Sanity checks first. */ if (msr->was_intercepted == 0) { msr_log(msr, 1, "Internal Error: Asked to intercept request but was_intercepted is zero"); return DECLINED; } if (msr->phase > 4) { msr_log(msr, 1, "Internal Error: Asked to intercept request in phase %d.", msr->phase); msr->was_intercepted = 0; return DECLINED; } /* OK, we're good to go. */ actionset = msr->intercept_actionset; phase_text = apr_psprintf(msr->mp, " (phase %d)", msr->phase); /* By default we log at level 1 but we switch to 4 * if a nolog action was used or this is not the initial request * to hide the message. */ log_level = (actionset->log != 1) ? 4 : 1; /* Pause the request first (if configured and the initial request). */ if (actionset->intercept_pause != NULL) { if(strstr(actionset->intercept_pause,"%{") != NULL) { msc_string *var = (msc_string *)apr_pcalloc(msr->mp, sizeof(msc_string)); var->value = (char *)actionset->intercept_pause; var->value_len = strlen(actionset->intercept_pause); expand_macros(msr, var, NULL, msr->mp); pause = atoi(var->value); if ((pause == LONG_MAX)||(pause == LONG_MIN)||(pause <= 0)) pause = 0; msr_log(msr, (log_level > 3 ? log_level : log_level + 1), "Pausing transaction for " "%d msec.", pause); /* apr_sleep accepts microseconds */ apr_sleep((apr_interval_time_t)(pause * 1000)); } else { pause = atoi(actionset->intercept_pause); if ((pause == LONG_MAX)||(pause == LONG_MIN)||(pause <= 0)) pause = 0; msr_log(msr, (log_level > 3 ? log_level : log_level + 1), "Pausing transaction for " "%d msec.", pause); /* apr_sleep accepts microseconds */ apr_sleep((apr_interval_time_t)(pause * 1000)); } } /* Determine how to respond and prepare the log message. */ switch(actionset->intercept_action) { case ACTION_DENY : if (actionset->intercept_status != 0) { status = actionset->intercept_status; message = apr_psprintf(msr->mp, "Access denied with code %d%s.", status, phase_text); } else { log_level = 1; status = HTTP_INTERNAL_SERVER_ERROR; message = apr_psprintf(msr->mp, "Access denied with code 500%s " "(Internal Error: Invalid status code requested %d).", phase_text, actionset->intercept_status); } break; case ACTION_PROXY : if (msr->phase < 3) { if (ap_find_linked_module("mod_proxy.c") == NULL) { log_level = 1; status = HTTP_INTERNAL_SERVER_ERROR; message = apr_psprintf(msr->mp, "Access denied with code 500%s " "(Configuration Error: Proxy action to %s requested but mod_proxy not found).", phase_text, log_escape_nq(msr->mp, actionset->intercept_uri)); } else { msr->r->filename = apr_psprintf(msr->mp, "proxy:%s", actionset->intercept_uri); msr->r->proxyreq = PROXYREQ_REVERSE; msr->r->handler = "proxy-server"; status = OK; message = apr_psprintf(msr->mp, "Access denied using proxy to%s %s.", phase_text, log_escape_nq(msr->mp, actionset->intercept_uri)); } } else { log_level = 1; status = HTTP_INTERNAL_SERVER_ERROR; message = apr_psprintf(msr->mp, "Access denied with code 500%s " "(Configuration Error: Proxy action requested but it does not work in output phases).", phase_text); } break; case ACTION_DROP : /* ENH This does not seem to work on Windows. Is there a * better way to drop a connection anyway? */ #if !defined(WIN32) && !defined(VERSION_NGINX) { extern module core_module; apr_socket_t *csd = ap_get_module_config(msr->r->connection->conn_config, &core_module); if (csd) { if (apr_socket_close(csd) == APR_SUCCESS) { status = HTTP_FORBIDDEN; message = apr_psprintf(msr->mp, "Access denied with connection close%s.", phase_text); } else { log_level = 1; status = HTTP_INTERNAL_SERVER_ERROR; message = apr_psprintf(msr->mp, "Access denied with code 500%s " "(Error: Connection drop requested but failed to close the " " socket).", phase_text); } } else { log_level = 1; status = HTTP_INTERNAL_SERVER_ERROR; message = apr_psprintf(msr->mp, "Access denied with code 500%s " "(Error: Connection drop requested but socket not found.", phase_text); } } #else { if (modsecDropAction == NULL) { log_level = 1; status = HTTP_INTERNAL_SERVER_ERROR; message = apr_psprintf(msr->mp, "Access denied with code 500%s " "(Error: Connection drop not implemented on this platform.", phase_text); } else if (modsecDropAction(msr->r) == 0) { status = HTTP_FORBIDDEN; message = apr_psprintf(msr->mp, "Access denied with connection close%s.", phase_text); } else { log_level = 1; status = HTTP_INTERNAL_SERVER_ERROR; message = apr_psprintf(msr->mp, "Access denied with code 500%s " "(Error: Connection drop request failed.", phase_text); } } #endif break; case ACTION_REDIRECT : if(strstr(actionset->intercept_uri,"%{") != NULL) { msc_string *var = (msc_string *)apr_pcalloc(msr->mp, sizeof(msc_string)); var->value = (char *)actionset->intercept_uri; var->value_len = strlen(actionset->intercept_uri); expand_macros(msr, var, NULL, msr->mp); apr_table_setn(msr->r->headers_out, "Location", var->value); if ((actionset->intercept_status == 301)||(actionset->intercept_status == 302) ||(actionset->intercept_status == 303)||(actionset->intercept_status == 307)) { status = actionset->intercept_status; } else { status = HTTP_MOVED_TEMPORARILY; } message = apr_psprintf(msr->mp, "Access denied with redirection to %s using " "status %d%s.", log_escape_nq(msr->mp, var->value), status, phase_text); } else { apr_table_setn(msr->r->headers_out, "Location", actionset->intercept_uri); if ((actionset->intercept_status == 301)||(actionset->intercept_status == 302) ||(actionset->intercept_status == 303)||(actionset->intercept_status == 307)) { status = actionset->intercept_status; } else { status = HTTP_MOVED_TEMPORARILY; } message = apr_psprintf(msr->mp, "Access denied with redirection to %s using " "status %d%s.", log_escape_nq(msr->mp, actionset->intercept_uri), status, phase_text); } break; case ACTION_ALLOW : status = DECLINED; message = apr_psprintf(msr->mp, "Access allowed%s.", phase_text); msr->was_intercepted = 0; msr->allow_scope = ACTION_ALLOW; break; case ACTION_PAUSE : status = DECLINED; message = apr_psprintf(msr->mp, "Paused Access%s.", phase_text); msr->was_intercepted = 0; msr->allow_scope = ACTION_ALLOW; break; case ACTION_ALLOW_PHASE : status = DECLINED; message = apr_psprintf(msr->mp, "Access to phase allowed%s.", phase_text); msr->was_intercepted = 0; msr->allow_scope = ACTION_ALLOW_PHASE; break; case ACTION_ALLOW_REQUEST : status = DECLINED; message = apr_psprintf(msr->mp, "Access to request allowed%s.", phase_text); msr->was_intercepted = 0; msr->allow_scope = ACTION_ALLOW_REQUEST; break; default : log_level = 1; status = HTTP_INTERNAL_SERVER_ERROR; message = apr_psprintf(msr->mp, "Access denied with code 500%s " "(Internal Error: invalid interception action %d).", phase_text, actionset->intercept_action); break; } /* If the level is not high enough to add an alert message, but "auditlog" * is enabled, then still add the message. */ if ((log_level > 3) && (actionset->auditlog != 0)) { *(const char **)apr_array_push(msr->alerts) = msc_alert_message(msr, actionset, NULL, message); } /* Log the message now. */ msc_alert(msr, log_level, actionset, message, msr->intercept_message); /* However, this will mark the txn relevant again if it is <= 3, * which will mess up noauditlog. We need to compensate for this * so that we do not increment twice when auditlog is enabled and * prevent incrementing when auditlog is disabled. */ if ((actionset->auditlog == 0) && (log_level <= 3)) { msr->is_relevant--; } return status; } /** * Retrieves a previously stored transaction context by * looking at the main request, and the previous requests. */ static modsec_rec *retrieve_tx_context(request_rec *r) { modsec_rec *msr = NULL; request_rec *rx = NULL; /* Look in the current request first. */ msr = (modsec_rec *)apr_table_get(r->notes, NOTE_MSR); if (msr != NULL) { msr->r = r; return msr; } /* If this is a subrequest then look in the main request. */ if (r->main != NULL) { msr = (modsec_rec *)apr_table_get(r->main->notes, NOTE_MSR); if (msr != NULL) { msr->r = r; return msr; } } /* If the request was redirected then look in the previous requests. */ rx = r->prev; while(rx != NULL) { msr = (modsec_rec *)apr_table_get(rx->notes, NOTE_MSR); if (msr != NULL) { msr->r = r; return msr; } rx = rx->prev; } return NULL; } /** * Stores transaction context where it can be found in subsequent * phases, redirections, or subrequests. */ static void store_tx_context(modsec_rec *msr, request_rec *r) { apr_table_setn(r->notes, NOTE_MSR, (void *)msr); } /** * Creates a new transaction context. */ static modsec_rec *create_tx_context(request_rec *r) { apr_allocator_t *allocator = NULL; modsec_rec *msr = NULL; msr = (modsec_rec *)apr_pcalloc(r->pool, sizeof(modsec_rec)); if (msr == NULL) return NULL; apr_allocator_create(&allocator); apr_allocator_max_free_set(allocator, 1024); apr_pool_create_ex(&msr->mp, r->pool, NULL, allocator); if (msr->mp == NULL) return NULL; apr_allocator_owner_set(allocator, msr->mp); msr->modsecurity = modsecurity; msr->r = r; msr->r_early = r; msr->request_time = r->request_time; msr->dcfg1 = (directory_config *)ap_get_module_config(r->per_dir_config, &security2_module); #if defined(WITH_LUA) #ifdef CACHE_LUA #if LUA_VERSION_NUM > 501 msr->L = luaL_newstate(); #else msr->L = lua_open(); #endif luaL_openlibs(msr->L); #endif #endif /** * Create a special user configuration. This is where * explicit instructions will be stored. This will be used * to override the default settings (and to override the * configuration in the second phase, dcfg2, with the user * setting executed in the first phase. */ msr->usercfg = create_directory_config(msr->mp, NULL); if (msr->usercfg == NULL) return NULL; /* Create a transaction context and populate * it using the directory config we just * got from Apache. */ msr->txcfg = create_directory_config(msr->mp, NULL); if (msr->txcfg == NULL) return NULL; if (msr->dcfg1 != NULL) { msr->txcfg = merge_directory_configs(msr->mp, msr->txcfg, msr->dcfg1); if (msr->txcfg == NULL) return NULL; } init_directory_config(msr->txcfg); msr->txid = get_env_var(r, "UNIQUE_ID"); if (msr->txid == NULL) { ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r->server, "ModSecurity: ModSecurity requires mod_unique_id to be installed."); return NULL; } if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Initialising transaction (txid %s).", msr->txid); } /* Populate tx fields */ msr->error_messages = apr_array_make(msr->mp, 5, sizeof(error_message_t *)); msr->alerts = apr_array_make(msr->mp, 5, sizeof(char *)); msr->server_software = real_server_signature; msr->local_addr = r->connection->local_ip; msr->local_port = r->connection->local_addr->port; #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER < 3 msr->remote_addr = r->connection->remote_ip; msr->remote_port = r->connection->remote_addr->port; #else msr->remote_addr = r->connection->client_ip; msr->remote_port = r->connection->client_addr->port; msr->useragent_ip = r->useragent_ip; #endif msr->request_line = r->the_request; msr->request_uri = r->uri; msr->request_method = r->method; msr->query_string = r->args; msr->request_protocol = r->protocol; msr->request_headers = apr_table_copy(msr->mp, r->headers_in); msr->hostname = ap_get_server_name(r); msr->msc_rule_mptmp = NULL; /* Invoke the engine to continue with initialisation */ if (modsecurity_tx_init(msr) < 0) { msr_log(msr, 1, "Failed to initialise transaction (txid %s).", msr->txid); return NULL; } store_tx_context(msr, r); if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Transaction context created (dcfg %pp).", msr->dcfg1); } return msr; } /* -- Hooks -- */ /* * Change the signature of the server if change was requested in * configuration. We do this by locating the signature in server * memory and writing over it. */ static apr_status_t change_server_signature(server_rec *s) { char *server_version = NULL; if (new_server_signature == NULL) return 0; server_version = (char *)apache_get_server_version(); if (server_version == NULL) { ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, s, "SecServerSignature: Apache returned null as signature."); return -1; } if (strlen(server_version) >= strlen(new_server_signature)) { strcpy(server_version, new_server_signature); } else { ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, s, "SecServerSignature: original signature too short. Please set " "ServerTokens to Full."); return -1; } /* Check that it really changed. This assumes that what we got was * not a copy and this could change in future versions of Apache. */ server_version = (char *)apache_get_server_version(); if ((server_version == NULL) || (strcmp(server_version, new_server_signature) != 0)) { ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, s, "SecServerSignature: Failed to change server signature to \"%s\".", new_server_signature); return 0; } else { ap_log_error(APLOG_MARK, APLOG_DEBUG | APLOG_NOERRNO, 0, s, "SecServerSignature: Changed server signature to \"%s\".", server_version); } return 1; } /** * Executed at the end of server lifetime to cleanup the allocated resources. */ static apr_status_t module_cleanup(void *data) { modsecurity_shutdown(modsecurity); return APR_SUCCESS; } /** * Generate a single variable for use with mod_log_config. */ static const char *modsec_var_log_handler(request_rec *r, char *name) { modsec_rec *msr = NULL; if (name == NULL) return NULL; msr = retrieve_tx_context(r); if (msr == NULL) return NULL; return construct_single_var(msr, name); } /** * Pre-configuration initialisation hook. */ static int hook_pre_config(apr_pool_t *mp, apr_pool_t *mp_log, apr_pool_t *mp_temp) { static APR_OPTIONAL_FN_TYPE(ap_register_log_handler) *log_pfn_register; /* Initialise ModSecurity engine */ modsecurity = modsecurity_create(mp, MODSEC_ONLINE); if (modsecurity == NULL) { ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, "ModSecurity: Failed to initialise engine."); return HTTP_INTERNAL_SERVER_ERROR; } log_pfn_register = APR_RETRIEVE_OPTIONAL_FN(ap_register_log_handler); if (log_pfn_register) { log_pfn_register(mp, "M", modsec_var_log_handler, 0); } return OK; } /** * Main (post-configuration) module initialisation. */ static int hook_post_config(apr_pool_t *mp, apr_pool_t *mp_log, apr_pool_t *mp_temp, server_rec *s) { void *init_flag = NULL; int first_time = 0; /* ENH Figure out a way to validate config before we start * - skipafter: need to make sure we found all of our targets */ /* Figure out if we are here for the first time */ apr_pool_userdata_get(&init_flag, "modsecurity-init-flag", s->process->pool); if (init_flag == NULL) { first_time = 1; apr_pool_userdata_set((const void *)1, "modsecurity-init-flag", apr_pool_cleanup_null, s->process->pool); } else { modsecurity_init(modsecurity, mp); } /* Store the original server signature */ real_server_signature = apr_pstrdup(mp, apache_get_server_version()); /* Make some space in the server signature for later */ if (new_server_signature != NULL) { ap_add_version_component(mp, new_server_signature); change_server_signature(s); } #if (!(defined(WIN32) || defined(NETWARE))) /* Internal chroot functionality */ if (chroot_dir != NULL) { /* ENH Is it safe to simply return with an error, instead * of using exit()? */ if (first_time == 0) { ap_log_error(APLOG_MARK, APLOG_NOTICE | APLOG_NOERRNO, 0, s, "ModSecurity: chroot checkpoint #2 (pid=%ld ppid=%ld)", (long)getpid(), (long)getppid()); if (chdir(chroot_dir) < 0) { ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, s, "ModSecurity: chroot failed, unable to chdir to %s, errno=%d (%s)", chroot_dir, errno, strerror(errno)); exit(1); } if (chroot(chroot_dir) < 0) { ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, s, "ModSecurity: chroot failed, path=%s, errno=%d(%s)", chroot_dir, errno, strerror(errno)); exit(1); } if (chdir("/") < 0) { ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, s, "ModSecurity: chdoot failed, unable to chdir to /, errno=%d (%s)", errno, strerror(errno)); exit(1); } ap_log_error(APLOG_MARK, APLOG_NOTICE | APLOG_NOERRNO, 0, s, "ModSecurity: chroot successful, path=%s", chroot_dir); } else { ap_log_error(APLOG_MARK, APLOG_NOTICE | APLOG_NOERRNO, 0, s, "ModSecurity: chroot checkpoint #1 (pid=%ld ppid=%ld)", (long)getpid(), (long)getppid()); } } #endif /* Schedule main cleanup for later, when the main pool is destroyed. */ apr_pool_cleanup_register(mp, (void *)s, module_cleanup, apr_pool_cleanup_null); /* Log our presence to the error log. */ if (first_time) { ap_log_error(APLOG_MARK, APLOG_NOTICE | APLOG_NOERRNO, 0, s, "%s configured.", MODSEC_MODULE_NAME_FULL); version(mp); /* If we've changed the server signature make note of the original. */ if (new_server_signature != NULL) { ap_log_error(APLOG_MARK, APLOG_NOTICE | APLOG_NOERRNO, 0, s, "Original server signature: %s", real_server_signature); } } srand((unsigned int)(time(NULL) * getpid())); return OK; } /** * Initialisation performed for every new child process. */ static void hook_child_init(apr_pool_t *mp, server_rec *s) { modsecurity_child_init(modsecurity); } /** * Initial request processing, executed immediatelly after * Apache receives the request headers. This function wil create * a transaction context. */ static int hook_request_early(request_rec *r) { modsec_rec *msr = NULL; int rc = DECLINED; /* This function needs to run only once per transaction * (i.e. subrequests and redirects are excluded). */ if ((r->main != NULL)||(r->prev != NULL)) { return DECLINED; } /* Initialise transaction context and * create the initial configuration. */ msr = create_tx_context(r); if (msr == NULL) return DECLINED; #ifdef REQUEST_EARLY /* Are we allowed to continue? */ if (msr->txcfg->is_enabled == MODSEC_DISABLED) { if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Processing disabled, skipping (hook request_early)."); } return DECLINED; } /* Process phase REQUEST_HEADERS */ if (modsecurity_process_phase(msr, PHASE_REQUEST_HEADERS) > 0) { rc = perform_interception(msr); } if ( (msr->txcfg->is_enabled != MODSEC_DISABLED) && (msr->txcfg->reqbody_access == 1) && (rc == DECLINED)) { /* Check request body limit (non-chunked requests only). */ if (msr->request_content_length > msr->txcfg->reqbody_limit) { msr_log(msr, 1, "Request body (Content-Length) is larger than the " "configured limit (%ld).", msr->txcfg->reqbody_limit); if(msr->txcfg->is_enabled != MODSEC_DETECTION_ONLY) return HTTP_REQUEST_ENTITY_TOO_LARGE; } } #endif return rc; } /** * Invoked as the first hook in the handler chain, this function * executes the second phase of ModSecurity request processing. */ static int hook_request_late(request_rec *r) { char *my_error_msg = NULL; modsec_rec *msr = NULL; int rc; /* This function needs to run only once per transaction * (i.e. subrequests and redirects are excluded). */ if ((r->main != NULL)||(r->prev != NULL)) { return DECLINED; } /* Find the transaction context and make sure * we are supposed to proceed. */ msr = retrieve_tx_context(r); if (msr == NULL) { /* If we can't find the context that probably means it's * a subrequest that was not initiated from the outside. */ return DECLINED; } /* Has this phase been completed already? */ if (msr->phase_request_body_complete) { msr_log(msr, 1, "Internal Error: Attempted to process the request body more than once."); return DECLINED; } msr->phase_request_body_complete = 1; msr->remote_user = r->user; /* Get the second configuration context. */ msr->dcfg2 = (directory_config *)ap_get_module_config(r->per_dir_config, &security2_module); /* Create a transaction context. */ msr->txcfg = create_directory_config(msr->mp, NULL); if (msr->txcfg == NULL) return DECLINED; if (msr->dcfg2 != NULL) { msr->txcfg = merge_directory_configs(msr->mp, msr->txcfg, msr->dcfg2); if (msr->txcfg == NULL) return DECLINED; } /* Update with the explicit user settings. */ msr->txcfg = merge_directory_configs(msr->mp, msr->txcfg, msr->usercfg); init_directory_config(msr->txcfg); if (msr->txcfg->is_enabled == 0) { if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Processing disabled, skipping (hook request_late)."); } return DECLINED; } #ifndef REQUEST_EARLY /* Phase 1 */ if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "First phase starting (dcfg %pp).", msr->dcfg2); } /* Process phase REQUEST_HEADERS */ if (modsecurity_process_phase(msr, PHASE_REQUEST_HEADERS) > 0) { /* There was a match; see if we need to intercept. */ rc = perform_interception(msr); if (rc != DECLINED) { /* Intercepted */ return rc; } } #endif /* The rule engine could have been disabled in phase 1. */ if (msr->txcfg->is_enabled == MODSEC_DISABLED) { if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Skipping phase 2 as the rule engine was disabled by a rule in phase 1."); } return DECLINED; } /* Phase 2 */ if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Second phase starting (dcfg %pp).", msr->dcfg2); } /* Check that the request body is not too long, but only * if configuration allows for request body access. */ msr->inbound_error = 0; if (msr->txcfg->reqbody_access == 1) { /* Check request body limit (non-chunked requests only). */ if (msr->request_content_length > msr->txcfg->reqbody_limit) { if((msr->txcfg->is_enabled == MODSEC_ENABLED) && (msr->txcfg->if_limit_action == REQUEST_BODY_LIMIT_ACTION_REJECT)) { msr->inbound_error = 1; msr_log(msr, 1, "Request body (Content-Length) is larger than the " "configured limit (%ld). Deny with status (%d)", msr->txcfg->reqbody_limit, HTTP_REQUEST_ENTITY_TOO_LARGE); return HTTP_REQUEST_ENTITY_TOO_LARGE; } else if ((msr->txcfg->is_enabled == MODSEC_ENABLED) && (msr->txcfg->if_limit_action == REQUEST_BODY_LIMIT_ACTION_PARTIAL)){ msr->inbound_error = 1; msr_log(msr, 1, "Request body (Content-Length) is larger than the " "configured limit (%ld).", msr->txcfg->reqbody_limit); } else if ((msr->txcfg->is_enabled == MODSEC_DETECTION_ONLY) && (msr->txcfg->if_limit_action == REQUEST_BODY_LIMIT_ACTION_PARTIAL)){ msr_log(msr, 1, "Request body (Content-Length) is larger than the " "configured limit (%ld).", msr->txcfg->reqbody_limit); msr->inbound_error = 1; } else { msr_log(msr, 1, "Request body (Content-Length) is larger than the " "configured limit (%ld).", msr->txcfg->reqbody_limit); msr->inbound_error = 1; } } } /* Figure out whether to extract multipart files. */ if ((msr->txcfg->upload_keep_files != KEEP_FILES_OFF) /* user might want to keep them */ || (msr->txcfg->upload_validates_files)) /* user might want to validate them */ { msr->upload_extract_files = 1; msr->upload_remove_files = 1; } rc = read_request_body(msr, &my_error_msg); if (rc < 0) { switch(rc) { case -1 : if (my_error_msg != NULL) { msr_log(msr, 1, "%s", my_error_msg); } return HTTP_INTERNAL_SERVER_ERROR; break; case -4 : /* Timeout. */ if (my_error_msg != NULL) { msr_log(msr, 4, "%s", my_error_msg); } r->connection->keepalive = AP_CONN_CLOSE; return HTTP_REQUEST_TIME_OUT; break; case -5 : /* Request body limit reached. */ msr->inbound_error = 1; if((msr->txcfg->is_enabled == MODSEC_ENABLED) && (msr->txcfg->if_limit_action == REQUEST_BODY_LIMIT_ACTION_REJECT)) { r->connection->keepalive = AP_CONN_CLOSE; if (my_error_msg != NULL) { msr_log(msr, 1, "%s. Deny with code (%d)", my_error_msg, HTTP_REQUEST_ENTITY_TOO_LARGE); } return HTTP_REQUEST_ENTITY_TOO_LARGE; } else { if (my_error_msg != NULL) { msr_log(msr, 1, "%s", my_error_msg); } } break; case -6 : /* EOF when reading request body. */ if (my_error_msg != NULL) { msr_log(msr, 4, "%s", my_error_msg); } r->connection->keepalive = AP_CONN_CLOSE; return HTTP_BAD_REQUEST; break; default : /* allow through */ break; } msr->msc_reqbody_error = 1; msr->msc_reqbody_error_msg = my_error_msg; } /* Update the request headers. They might have changed after * the body was read (trailers). * * TODO We might still want to hold onto the original headers * so that we can log them. Keeping them is probably not * going to increase our memory requirements (because all * headers are allocated from the request memory pool * anyway). */ msr->request_headers = apr_table_copy(msr->mp, r->headers_in); /* Process phase REQUEST_BODY */ rc = DECLINED; if (modsecurity_process_phase(msr, PHASE_REQUEST_BODY) > 0) { rc = perform_interception(msr); } if(msr->txcfg->stream_inbody_inspection && msr->msc_reqbody_read) { const char *clen = NULL; clen = apr_psprintf(msr->mp,"%"APR_SIZE_T_FMT,msr->stream_input_length); if(clen) apr_table_setn(r->headers_in, "Content-Length",clen); } /* Remove the compression ability indications the client set, * but only if we need to disable backend compression. */ if (msr->txcfg->disable_backend_compression) { apr_table_unset(r->headers_in, "Accept-Encoding"); apr_table_unset(r->headers_in, "TE"); } return rc; } /** * Invoked every time Apache has something to write to the error log. */ #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER > 2 static void hook_error_log(const ap_errorlog_info *info, const char *errstr) #else static void hook_error_log(const char *file, int line, int level, apr_status_t status, const server_rec *s, const request_rec *r, apr_pool_t *mp, const char *fmt) #endif { modsec_rec *msr = NULL; error_message_t *em = NULL; #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER > 2 if (info == NULL) return; if (info->r == NULL) return; #else if (r == NULL) return; #endif #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER > 2 msr = retrieve_tx_context((request_rec *)info->r); #else msr = retrieve_tx_context((request_rec *)r); #endif /* Create a context for requests we never had the chance to process */ #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER > 2 if ((msr == NULL) && ((info->level & APLOG_LEVELMASK) < APLOG_DEBUG) && apr_table_get(info->r->subprocess_env, "UNIQUE_ID")) #else if ((msr == NULL) && ((level & APLOG_LEVELMASK) < APLOG_DEBUG) && apr_table_get(r->subprocess_env, "UNIQUE_ID")) #endif { #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER > 2 msr = create_tx_context((request_rec *)info->r); #else msr = create_tx_context((request_rec *)r); #endif if (msr->txcfg->debuglog_level >= 9) { if (msr == NULL) { msr_log(msr, 9, "Failed to create context after request failure."); } else { msr_log(msr, 9, "Context created after request failure."); } } } if (msr == NULL) return; /* Store the error message for later */ em = (error_message_t *)apr_pcalloc(msr->mp, sizeof(error_message_t)); if (em == NULL) return; #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER > 2 if (info->file != NULL) em->file = apr_pstrdup(msr->mp, info->file); em->line = info->line; em->level = info->level; em->status = info->status; if (info->format != NULL) em->message = apr_pstrdup(msr->mp, info->format); #else if (file != NULL) em->file = apr_pstrdup(msr->mp, file); em->line = line; em->level = level; em->status = status; if (fmt != NULL) em->message = apr_pstrdup(msr->mp, fmt); #endif /* Remove \n from the end of the message */ if (em->message != NULL) { char *p = (char *)em->message; while(*p != '\0') { if ((*(p + 1) == '\0')&&(*p == '\n')) { *p = '\0'; break; } p++; } } *(const error_message_t **)apr_array_push(msr->error_messages) = em; } /** * Guardian logger is used to interface to the external * script for web server protection - httpd_guardian. */ static void sec_guardian_logger(request_rec *r, request_rec *origr, modsec_rec *msr) { char *str1, *str2, *text; char *modsec_message = "-"; int modsec_rating = 0; /* not used yet */ apr_size_t nbytes, nbytes_written; apr_time_t duration = (apr_time_now() - origr->request_time); int limit, was_limited; /* bail out if we do not have where to write */ if ((guardianlog_name == NULL)||(guardianlog_fd == NULL)) return; /* process the condition, if we have one */ if (guardianlog_condition != NULL) { if (*guardianlog_condition == '!') { if (apr_table_get(r->subprocess_env, guardianlog_condition + 1) != NULL) { return; } } else { if (apr_table_get(r->subprocess_env, guardianlog_condition) == NULL) { return; } } } /* * Log format is as follows: * * %V %h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-agent}i" %{UNIQUE_ID}e * "SESSION_ID" %T %D "MODSEC_MESSAGE" MODSEC_RATING * * The fields SESSION_ID, MODSEC_MESSAGE, and MODSEC_RATING are not used at the moment. */ str2 = apr_psprintf(msr->mp, "%" APR_TIME_T_FMT " %" APR_TIME_T_FMT " \"%s\" %d", duration, apr_time_sec(duration), log_escape(msr->mp, modsec_message), modsec_rating); if (str2 == NULL) return; /* We do not want the index line to be longer than 3980 bytes. */ limit = 3980; was_limited = 0; /* If we are logging to a pipe we need to observe and * obey the pipe atomic write limit - PIPE_BUF. For * more details see the discussion in sec_guardian_logger, * above. */ if (msr->txcfg->auditlog_name[0] == '|') { if (PIPE_BUF < limit) { limit = PIPE_BUF; } } limit = limit - strlen(str2) - 5; if (limit <= 0) { msr_log(msr, 1, "Audit Log: Atomic PIPE write buffer too small: %d", PIPE_BUF); return; } str1 = construct_log_vcombinedus_limited(msr, limit, &was_limited); if (str1 == NULL) return; if (was_limited == 0) { text = apr_psprintf(msr->mp, "%s %s \n", str1, str2); } else { text = apr_psprintf(msr->mp, "%s %s L\n", str1, str2); } if (text == NULL) return; nbytes = strlen(text); apr_file_write_full(guardianlog_fd, text, nbytes, &nbytes_written); } /** * Invoked at the end of each transaction. */ static int hook_log_transaction(request_rec *r) { const apr_array_header_t *arr = NULL; request_rec *origr = NULL; modsec_rec *msr = NULL; msr = retrieve_tx_context(r); if (msr == NULL) { return DECLINED; } if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Initialising logging."); } /* Find the first (origr) and the last (r) request */ origr = r; while(origr->prev) { origr = origr->prev; } while(r->next) { r = r->next; } /* At this point r is the last request in the * chain. However, we now need to detect a case when * a bad ErrorDocument was used and back out of it. That's * how Apache does it internally. Except where Apache knows * exactly what is happening we will have to rely on the missing * headers in the final request to detect this condition. */ arr = apr_table_elts(r->headers_out); while ((arr->nelts == 0)&&(r->prev != NULL)) { r = r->prev; arr = apr_table_elts(r->headers_out); } msr->r = r; msr->response_status = r->status; msr->status_line = ((r->status_line != NULL) ? r->status_line : ap_get_status_line(r->status)); msr->response_protocol = get_response_protocol(origr); msr->response_headers = apr_table_copy(msr->mp, r->headers_out); if (!r->assbackwards) msr->response_headers_sent = 1; msr->bytes_sent = r->bytes_sent; msr->local_user = r->user; msr->remote_user = r->connection->remote_logname; /* -- Guardian -- */ sec_guardian_logger(r, origr, msr); /* Invoke the engine to do the rest of the work now. */ modsecurity_process_phase(msr, PHASE_LOGGING); return DECLINED; } /** * Invoked right before request processing begins. This is * when we need to decide if we want to hook into the output * filter chain. */ static void hook_insert_filter(request_rec *r) { modsec_rec *msr = NULL; /* Find the transaction context first. */ msr = retrieve_tx_context(r); if (msr == NULL) return; /* Add the input filter, but only if we need it to run. */ if (msr->if_status == IF_STATUS_WANTS_TO_RUN) { if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Hook insert_filter: Adding input forwarding filter %s(r %pp).", (((r->main != NULL)||(r->prev != NULL)) ? "for subrequest " : ""), r); } ap_add_input_filter("MODSECURITY_IN", msr, r, r->connection); } /* The output filters only need to be added only once per transaction * (i.e. subrequests and redirects are excluded). */ if ((r->main != NULL)||(r->prev != NULL)) { return; } /* Only proceed to add the second filter if the engine is enabled. */ if (msr->txcfg->is_enabled == 0) { if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Hook insert_filter: Processing disabled, skipping."); } return; } /* We always add the output filter because that's where we need to * initiate our 3rd and 4th processing phases from. The filter is * smart enough not to buffer the data if it is not supposed to. */ if (msr->of_status != OF_STATUS_COMPLETE) { if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Hook insert_filter: Adding output filter (r %pp).", r); } ap_add_output_filter("MODSECURITY_OUT", msr, r, r->connection); } } // TODO: Holding off on this for now (needs more testing) /** * Invoked whenever Apache starts processing an error. A chance * to insert ourselves into the output filter chain. */ static void hook_insert_error_filter(request_rec *r) { modsec_rec *msr = NULL; /* Find the transaction context and make sure we are * supposed to proceed. */ msr = retrieve_tx_context(r); if (msr == NULL) return; /* Do not run if not enabled. */ if (msr->txcfg->is_enabled == 0) { if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Hook insert_error_filter: Processing disabled, skipping."); } return; } /* Do not run if the output filter already completed. This will * happen if we intercept in phase 4. */ if (msr->of_status != OF_STATUS_COMPLETE) { if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Hook insert_error_filter: Adding output filter (r %pp).", r); } /* Make a note that the output we will be receiving is a * result of error processing. */ msr->of_is_error = 1; ap_add_output_filter("MODSECURITY_OUT", msr, r, r->connection); } else { if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Hook insert_error_filter: Output buffering already complete."); } } } #if (!defined(NO_MODSEC_API)) /** * This function is exported for other Apache modules to * register new transformation functions. */ static void modsec_register_tfn(const char *name, void *fn) { if (modsecurity != NULL) { msre_engine_tfn_register(modsecurity->msre, name, (fn_tfn_execute_t)fn); } } /** * This function is exported for other Apache modules to * register new operators. */ static void modsec_register_operator(const char *name, void *fn_init, void *fn_exec) { if (modsecurity != NULL) { msre_engine_op_register(modsecurity->msre, name, (fn_op_param_init_t)fn_init, (fn_op_execute_t)fn_exec); } } /** * \brief Connetion hook to limit the number of * connections in BUSY state * * \param conn Pointer to connection struct * * \retval DECLINED On failure * \retval OK On Success */ static int hook_connection_early(conn_rec *conn) { sb_handle *sb = conn->sbh; int i, j; unsigned long int ip_count = 0, ip_count_w = 0; worker_score *ws_record = NULL; #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER > 2 ap_sb_handle_t *sbh = NULL; #endif if(sb != NULL && (conn_read_state_limit > 0 || conn_write_state_limit > 0)) { ws_record = &ap_scoreboard_image->servers[sb->child_num][sb->thread_num]; if(ws_record == NULL) return DECLINED; #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER > 2 apr_cpystrn(ws_record->client, conn->client_ip, sizeof(ws_record->client)); #else apr_cpystrn(ws_record->client, conn->remote_ip, sizeof(ws_record->client)); #endif for (i = 0; i < server_limit; ++i) { for (j = 0; j < thread_limit; ++j) { #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER > 2 sbh = conn->sbh; if (sbh == NULL) { return DECLINED; } ws_record = ap_get_scoreboard_worker(sbh); #else ws_record = ap_get_scoreboard_worker(i, j); #endif if(ws_record == NULL) return DECLINED; switch (ws_record->status) { case SERVER_BUSY_READ: #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER > 2 if (strcmp(conn->client_ip, ws_record->client) == 0) ip_count++; #else if (strcmp(conn->remote_ip, ws_record->client) == 0) ip_count++; #endif break; case SERVER_BUSY_WRITE: #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER > 2 if (strcmp(conn->client_ip, ws_record->client) == 0) ip_count_w++; #else if (strcmp(conn->remote_ip, ws_record->client) == 0) ip_count_w++; #endif break; default: break; } } } if ((conn_read_state_limit > 0) && (ip_count > conn_read_state_limit)) { #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER > 2 ap_log_error(APLOG_MARK, APLOG_WARNING, 0, NULL, "ModSecurity: Access denied with code 400. Too many threads [%ld] of %ld allowed in READ state from %s - Possible DoS Consumption Attack [Rejected]", ip_count,conn_read_state_limit,conn->client_ip); #else ap_log_error(APLOG_MARK, APLOG_WARNING, 0, NULL, "ModSecurity: Access denied with code 400. Too many threads [%ld] of %ld allowed in READ state from %s - Possible DoS Consumption Attack [Rejected]", ip_count,conn_read_state_limit,conn->remote_ip); #endif return OK; } else if ((conn_write_state_limit > 0) && (ip_count_w > conn_write_state_limit)) { #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER > 2 ap_log_error(APLOG_MARK, APLOG_WARNING, 0, NULL, "ModSecurity: Access denied with code 400. Too many threads [%ld] of %ld allowed in WRITE state from %s - Possible DoS Consumption Attack [Rejected]", ip_count_w,conn_write_state_limit,conn->client_ip); #else ap_log_error(APLOG_MARK, APLOG_WARNING, 0, NULL, "ModSecurity: Access denied with code 400. Too many threads [%ld] of %ld allowed in WRITE state from %s - Possible DoS Consumption Attack [Rejected]", ip_count_w,conn_write_state_limit,conn->remote_ip); #endif return OK; } else { return DECLINED; } } return DECLINED; } /** * This function is exported for other Apache modules to * register new variables. */ static void modsec_register_variable(const char *name, unsigned int type, unsigned int argc_min, unsigned int argc_max, void *fn_validate, void *fn_generate, unsigned int is_cacheable, unsigned int availability) { if (modsecurity != NULL) { msre_engine_variable_register(modsecurity->msre, name, type, argc_min, argc_max, (fn_var_validate_t)fn_validate, (fn_var_generate_t)fn_generate, is_cacheable, availability); } else { fprintf(stderr,"modsecurity is NULL\n"); } } /** * This function is exported for other Apache modules to * register new request body processors. */ static void modsec_register_reqbody_processor(const char *name, void *fn_init, void *fn_process, void *fn_complete) { if (modsecurity != NULL) { msre_engine_reqbody_processor_register(modsecurity->msre, name, (fn_reqbody_processor_init_t)fn_init, (fn_reqbody_processor_init_t)fn_process, (fn_reqbody_processor_init_t)fn_complete); } } #endif /** * Registers module hooks with Apache. */ static void register_hooks(apr_pool_t *mp) { static const char *const postconfig_beforeme_list[] = { "mod_unique_id.c", "mod_ssl.c", NULL }; static const char *const postconfig_afterme_list[] = { "mod_fcgid.c", "mod_cgid.c", NULL }; static const char *const postread_beforeme_list[] = { "mod_rpaf.c", "mod_rpaf-2.0.c", "mod_extract_forwarded2.c", "mod_remoteip.c", "mod_custom_header.c", "mod_breach_realip.c", "mod_breach_trans.c", "mod_unique_id.c", NULL }; static const char *const postread_afterme_list[] = { "mod_log_forensic.c", NULL }; static const char *const transaction_afterme_list[] = { "mod_log_config.c", NULL }; static const char *const fixups_beforeme_list[] = { "mod_env.c", NULL }; /* Add the MODSEC_2.x compatibility defines */ *(char **)apr_array_push(ap_server_config_defines) = apr_pstrdup(mp, "MODSEC_2.5"); /* Add the MODSEC_a.b define */ *(char **)apr_array_push(ap_server_config_defines) = apr_psprintf(mp, "MODSEC_%s.%s", MODSEC_VERSION_MAJOR, MODSEC_VERSION_MINOR); #if (!defined(NO_MODSEC_API)) /* Export optional functions. */ APR_REGISTER_OPTIONAL_FN(modsec_register_tfn); APR_REGISTER_OPTIONAL_FN(modsec_register_operator); APR_REGISTER_OPTIONAL_FN(modsec_register_variable); APR_REGISTER_OPTIONAL_FN(modsec_register_reqbody_processor); #endif /* For connection level hook */ ap_mpm_query(AP_MPMQ_HARD_LIMIT_THREADS, &thread_limit); ap_mpm_query(AP_MPMQ_HARD_LIMIT_DAEMONS, &server_limit); /* Main hooks */ ap_hook_pre_config(hook_pre_config, NULL, NULL, APR_HOOK_FIRST); ap_hook_post_config(hook_post_config, postconfig_beforeme_list, postconfig_afterme_list, APR_HOOK_REALLY_LAST); ap_hook_child_init(hook_child_init, NULL, NULL, APR_HOOK_MIDDLE); /* Our own hook to handle RPC transactions (not used at the moment). * // ap_hook_handler(hook_handler, NULL, NULL, APR_HOOK_MIDDLE); */ /* Connection processing hooks */ ap_hook_process_connection(hook_connection_early, NULL, NULL, APR_HOOK_FIRST); /* Transaction processing hooks */ ap_hook_post_read_request(hook_request_early, postread_beforeme_list, postread_afterme_list, APR_HOOK_REALLY_FIRST); ap_hook_fixups(hook_request_late, fixups_beforeme_list, NULL, APR_HOOK_REALLY_FIRST); /* Logging */ ap_hook_error_log(hook_error_log, NULL, NULL, APR_HOOK_MIDDLE); ap_hook_log_transaction(hook_log_transaction, NULL, transaction_afterme_list, APR_HOOK_MIDDLE); /* Filter hooks */ ap_hook_insert_filter(hook_insert_filter, NULL, NULL, APR_HOOK_FIRST); ap_hook_insert_error_filter(hook_insert_error_filter, NULL, NULL, APR_HOOK_FIRST); ap_register_input_filter("MODSECURITY_IN", input_filter, NULL, AP_FTYPE_CONTENT_SET); /* Ensure that the output filter runs before other modules so that * we get a request that has a better chance of not being modified: * * Currently: * mod_expires = -2 * mod_cache = -1 * mod_deflate = -1 * mod_headers = 0 */ ap_register_output_filter("MODSECURITY_OUT", output_filter, NULL, AP_FTYPE_CONTENT_SET - 3); } /* Defined in apache2_config.c */ extern const command_rec module_directives[]; /* Module entry points */ module AP_MODULE_DECLARE_DATA security2_module = { STANDARD20_MODULE_STUFF, create_directory_config, merge_directory_configs, NULL, /* create_server_config */ NULL, /* merge_server_configs */ module_directives, register_hooks }; modsecurity-apache_2.7.7/apache2/re_actions.c0000664000175000017500000026020612243422537021442 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #include "re.h" #include #include "apr_lib.h" #include "apr_strmatch.h" /** * Register action with the engine. */ static void msre_engine_action_register(msre_engine *engine, const char *name, unsigned int type, unsigned int argc_min, unsigned int argc_max, unsigned int allow_param_plusminus, unsigned int cardinality, unsigned int cardinality_group, fn_action_validate_t validate, fn_action_init_t init, fn_action_execute_t execute) { msre_action_metadata *metadata = (msre_action_metadata *)apr_pcalloc(engine->mp, sizeof(msre_action_metadata)); if (metadata == NULL) return; metadata->name = name; metadata->type = type; metadata->argc_min = argc_min; metadata->argc_max = argc_max; metadata->allow_param_plusminus = allow_param_plusminus; metadata->cardinality = cardinality; metadata->cardinality_group = cardinality_group; metadata->validate = validate; metadata->init = init; metadata->execute = execute; apr_table_setn(engine->actions, name, (void *)metadata); } /** * Generates a single variable (from the supplied metadata). */ msre_var *generate_single_var(modsec_rec *msr, msre_var *var, apr_array_header_t *tfn_arr, msre_rule *rule, apr_pool_t *mptmp) { apr_table_t *vartab = NULL; const apr_table_entry_t *te = NULL; const apr_array_header_t *arr = NULL; msre_var *rvar = NULL; int i; /* Sanity check. */ if ((var == NULL)||(var->metadata == NULL)||(var->metadata->generate == NULL)) return NULL; vartab = apr_table_make(mptmp, 16); var->metadata->generate(msr, var, rule, vartab, mptmp); arr = apr_table_elts(vartab); if (arr->nelts == 0) return NULL; te = (apr_table_entry_t *)arr->elts; rvar = (msre_var *)te[0].val; /* Return straight away if there were no * transformation functions supplied. */ if ((tfn_arr == NULL)||(tfn_arr->nelts == 0)) { return rvar; } /* Copy the value so that we can transform it in place. */ rvar->value = apr_pstrndup(mptmp, rvar->value, rvar->value_len); /* Transform rvar in a loop. */ for (i = 0; i < tfn_arr->nelts; i++) { msre_tfn_metadata *tfn = ((msre_tfn_metadata **)tfn_arr->elts)[i]; char *rval; int rc; long int rval_len; rc = tfn->execute(mptmp, (unsigned char *)rvar->value, rvar->value_len, &rval, &rval_len); rvar->value = rval; rvar->value_len = rval_len; if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "T (%d) %s: \"%s\"", rc, tfn->name, log_escape_nq_ex(mptmp, rvar->value, rvar->value_len)); } } return rvar; } #if defined(WITH_LUA) /** * */ apr_table_t *generate_multi_var(modsec_rec *msr, msre_var *var, apr_array_header_t *tfn_arr, msre_rule *rule, apr_pool_t *mptmp) { const apr_array_header_t *tarr; const apr_table_entry_t *telts; apr_table_t *vartab = NULL, *tvartab = NULL; msre_var *rvar = NULL; int i, j; /* Sanity check. */ if ((var == NULL)||(var->metadata == NULL)||(var->metadata->generate == NULL)) return NULL; /* Generate variables. */ vartab = apr_table_make(mptmp, 16); var->metadata->generate(msr, var, rule, vartab, mptmp); /* Return straight away if there were no * transformation functions supplied. */ if ((tfn_arr == NULL)||(tfn_arr->nelts == 0)) { return vartab; } tvartab = apr_table_make(mptmp, 16); tarr = apr_table_elts(vartab); telts = (const apr_table_entry_t*)tarr->elts; for (j = 0; j < tarr->nelts; j++) { rvar = (msre_var *)telts[j].val; /* Copy the value so that we can transform it in place. */ rvar->value = apr_pstrndup(mptmp, rvar->value, rvar->value_len); /* Transform rvar in a loop. */ for (i = 0; i < tfn_arr->nelts; i++) { msre_tfn_metadata *tfn = ((msre_tfn_metadata **)tfn_arr->elts)[i]; char *rval; int rc; long int rval_len; rc = tfn->execute(mptmp, (unsigned char *)rvar->value, rvar->value_len, &rval, &rval_len); rvar->value = rval; rvar->value_len = rval_len; if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "T (%d) %s: \"%s\"", rc, tfn->name, log_escape_nq_ex(mptmp, rvar->value, rvar->value_len)); } } apr_table_addn(tvartab, rvar->name, (void *)rvar); } return tvartab; } #endif /** * Expands macros ("%{NAME}" entities) if present * in the given variable. */ int expand_macros(modsec_rec *msr, msc_string *var, msre_rule *rule, apr_pool_t *mptmp) { char *data = NULL; apr_array_header_t *arr = NULL; char *p = NULL, *q = NULL, *t = NULL; char *text_start = NULL, *next_text_start = NULL; msc_string *part = NULL; int i, offset = 0; if (var->value == NULL) return 0; /* IMP1 Duplicate the string and create the array on * demand, thus not having to do it if there are * no macros in the input data. */ data = apr_pstrdup(mptmp, var->value); /* IMP1 Are we modifying data anywhere? */ arr = apr_array_make(mptmp, 16, sizeof(msc_string *)); if ((data == NULL)||(arr == NULL)) return -1; text_start = next_text_start = data; do { text_start = next_text_start; p = strstr(text_start, "%"); if (p != NULL) { char *var_name = NULL; char *var_value = NULL; if ((*(p + 1) == '{')&&(*(p + 2) != '\0')) { char *var_start = p + 2; t = var_start; while((*t != '\0')&&(*t != '}')) t++; if (*t == '}') { /* Named variable. */ var_name = apr_pstrmemdup(mptmp, var_start, t - var_start); q = strstr(var_name, "."); if (q != NULL) { var_value = q + 1; *q = '\0'; } next_text_start = t + 1; /* *t was '}' */ } else { /* Warn about a possiblly forgotten '}' */ if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Warning: Possibly unterminated macro: \"%s\"", log_escape_ex(mptmp, var_start - 2, t - var_start + 2)); } next_text_start = t; /* *t was '\0' */ } } if (var_name != NULL) { char *my_error_msg = NULL; msre_var *var_generated = NULL; msre_var *var_resolved = NULL; /* Add the text part before the macro to the array. */ part = (msc_string *)apr_pcalloc(mptmp, sizeof(msc_string)); if (part == NULL) return -1; part->value_len = p - text_start; part->value = apr_pstrmemdup(mptmp, text_start, part->value_len); *(msc_string **)apr_array_push(arr) = part; /* Resolve the macro and add that to the array. */ var_resolved = msre_create_var_ex(mptmp, msr->modsecurity->msre, var_name, var_value, msr, &my_error_msg); if (var_resolved != NULL) { var_generated = generate_single_var(msr, var_resolved, NULL, rule, mptmp); if (var_generated != NULL) { part = (msc_string *)apr_pcalloc(mptmp, sizeof(msc_string)); if (part == NULL) return -1; part->value_len = var_generated->value_len; part->value = (char *)var_generated->value; *(msc_string **)apr_array_push(arr) = part; if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Resolved macro %%{%s%s%s} to: %s", var_name, (var_value ? "." : ""), (var_value ? var_value : ""), log_escape_nq_ex(mptmp, part->value, part->value_len)); } } } else { if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Failed to resolve macro %%{%s%s%s}: %s", var_name, (var_value ? "." : ""), (var_value ? var_value : ""), my_error_msg); } } } else { /* We could not identify a valid macro so add it as text. */ part = (msc_string *)apr_pcalloc(mptmp, sizeof(msc_string)); if (part == NULL) return -1; part->value_len = p - text_start + 1; /* len(text)+len("%") */ part->value = apr_pstrmemdup(mptmp, text_start, part->value_len); *(msc_string **)apr_array_push(arr) = part; next_text_start = p + 1; } } else { /* Text part. */ part = (msc_string *)apr_pcalloc(mptmp, sizeof(msc_string)); part->value = apr_pstrdup(mptmp, text_start); part->value_len = strlen(part->value); *(msc_string **)apr_array_push(arr) = part; } } while (p != NULL); /* If there's more than one member of the array that * means there was at least one macro present. Combine * text parts into a single string now. */ if (arr->nelts > 1) { /* Figure out the required size for the string. */ var->value_len = 0; for(i = 0; i < arr->nelts; i++) { part = ((msc_string **)arr->elts)[i]; var->value_len += part->value_len; } /* Allocate the string. */ var->value = apr_palloc(msr->mp, var->value_len + 1); if (var->value == NULL) return -1; /* Combine the parts. */ offset = 0; for(i = 0; i < arr->nelts; i++) { part = ((msc_string **)arr->elts)[i]; memcpy((char *)(var->value + offset), part->value, part->value_len); offset += part->value_len; } var->value[offset] = '\0'; } return 1; } /** * Record the original collection values to use to calculate deltas. * This can be called multiple times and will not overwrite the first * value that is set. */ apr_status_t collection_original_setvar(modsec_rec *msr, const char *col_name, const msc_string *orig_var) { apr_table_t *table = NULL; msc_string *var = NULL; const char *var_name = NULL; if (orig_var == NULL) { msr_log(msr, 1, "Internal Error: Attempt to record NULL original variable."); return -1; } var_name = orig_var->name; table = (apr_table_t *)apr_table_get(msr->collections_original, col_name); /* Does the collection exist already? */ if (table == NULL) { table = apr_table_make(msr->mp, 24); if (table == NULL) { msr_log(msr, 1, "Failed to allocate space for original collection."); return -1; } apr_table_setn(msr->collections_original, apr_pstrdup(msr->mp, col_name), (void *)table); } else { /* Does the variable exist already? */ var = (msc_string *)apr_table_get(table, var_name); if (var != NULL) { if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Original collection variable: %s.%s = \"%s\"", col_name, var_name, log_escape_ex(msr->mp, orig_var->value, orig_var->value_len)); } return 1; } } var = (msc_string *)apr_palloc(msr->mp, sizeof(msc_string)); if (var == NULL) { msr_log(msr, 1, "Failed to allocate space for original collection variable."); return -1; } /* Copy the original var and add to collection. */ var->name = orig_var->name ? apr_pstrmemdup(msr->mp, orig_var->name, orig_var->name_len) : NULL; var->name_len = orig_var->name_len; var->value = orig_var->value ? apr_pstrmemdup(msr->mp, orig_var->value, orig_var->value_len) : NULL; var->value_len = orig_var->value_len; apr_table_setn(table, apr_pstrmemdup(msr->mp, var->name, var->name_len), (void *)var); if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Recorded original collection variable: %s.%s = \"%s\"", col_name, var_name, log_escape_ex(msr->mp, var->value, var->value_len)); } return 0; } /* marker */ static apr_status_t msre_action_marker_init(msre_engine *engine, msre_actionset *actionset, msre_action *action) { actionset->id = action->param; return 1; } /* id */ static apr_status_t msre_action_id_init(msre_engine *engine, msre_actionset *actionset, msre_action *action) { actionset->id = action->param; return 1; } static char *msre_action_id_validate(msre_engine *engine, msre_action *action) { int id; if(action != NULL && action->param != NULL) { for(id=0;idparam);id++) { if(!apr_isdigit(action->param[id])) return apr_psprintf(engine->mp, "ModSecurity: Invalid value for action ID: %s", action->param); } id = atoi(action->param); if ((id == LONG_MAX)||(id == LONG_MIN)||(id <= 0)) { return apr_psprintf(engine->mp, "ModSecurity: Invalid value for action ID: %s", action->param); } } return NULL; } /* rev */ static apr_status_t msre_action_rev_init(msre_engine *engine, msre_actionset *actionset, msre_action *action) { actionset->rev = action->param; return 1; } /* msg */ static apr_status_t msre_action_msg_init(msre_engine *engine, msre_actionset *actionset, msre_action *action) { actionset->msg = action->param; return 1; } /* logdata */ static apr_status_t msre_action_logdata_init(msre_engine *engine, msre_actionset *actionset, msre_action *action) { actionset->logdata = action->param; return 1; } /* SanitizeMatchedBytes init */ static apr_status_t msre_action_sanitizeMatchedBytes_init(msre_engine *engine, msre_actionset *actionset, msre_action *action) { char *parse_parm = NULL; char *ac_param = NULL; char *savedptr = NULL; int arg_min = 0; int arg_max = 0; if (action->param != NULL && strlen(action->param) == 3) { ac_param = apr_pstrdup(engine->mp, action->param); parse_parm = apr_strtok(ac_param,"/",&savedptr); if(apr_isdigit(*parse_parm) && apr_isdigit(*savedptr)) { arg_max = atoi(parse_parm); arg_min = atoi(savedptr); } } actionset->arg_min = arg_min; actionset->arg_max = arg_max; return 1; } /* accuracy */ static apr_status_t msre_action_accuracy_init(msre_engine *engine, msre_actionset *actionset, msre_action *action) { actionset->accuracy = atoi(action->param); return 1; } /* maturity */ static apr_status_t msre_action_maturity_init(msre_engine *engine, msre_actionset *actionset, msre_action *action) { actionset->maturity = atoi(action->param); return 1; } /* ver */ static apr_status_t msre_action_ver_init(msre_engine *engine, msre_actionset *actionset, msre_action *action) { actionset->version = action->param; return 1; } /* severity */ static apr_status_t msre_action_severity_init(msre_engine *engine, msre_actionset *actionset, msre_action *action) { if (strcasecmp(action->param, "emergency") == 0) { actionset->severity = 0; } else if (strcasecmp(action->param, "alert") == 0) { actionset->severity = 1; } else if (strcasecmp(action->param, "critical") == 0) { actionset->severity = 2; } else if (strcasecmp(action->param, "error") == 0) { actionset->severity = 3; } else if (strcasecmp(action->param, "warning") == 0) { actionset->severity = 4; } else if (strcasecmp(action->param, "notice") == 0) { actionset->severity = 5; } else if (strcasecmp(action->param, "info") == 0) { actionset->severity = 6; } else if (strcasecmp(action->param, "debug") == 0) { actionset->severity = 7; } else { actionset->severity = atoi(action->param); } return 1; } /* chain */ static apr_status_t msre_action_chain_init(msre_engine *engine, msre_actionset *actionset, msre_action *action) { actionset->is_chained = 1; return 1; } /* log */ static apr_status_t msre_action_log_init(msre_engine *engine, msre_actionset *actionset, msre_action *action) { actionset->log = 1; return 1; } /* nolog */ static apr_status_t msre_action_nolog_init(msre_engine *engine, msre_actionset *actionset, msre_action *action) { actionset->log = 0; actionset->auditlog = 0; return 1; } /* auditlog */ static apr_status_t msre_action_auditlog_init(msre_engine *engine, msre_actionset *actionset, msre_action *action) { actionset->auditlog = 1; return 1; } /* noauditlog */ static apr_status_t msre_action_noauditlog_init(msre_engine *engine, msre_actionset *actionset, msre_action *action) { actionset->auditlog = 0; return 1; } /* block */ static apr_status_t msre_action_block_init(msre_engine *engine, msre_actionset *actionset, msre_action *action) { /* Right now we just set a flag and inherit the real disruptive action */ actionset->block = 1; return 1; } /* deny */ static apr_status_t msre_action_deny_init(msre_engine *engine, msre_actionset *actionset, msre_action *action) { actionset->intercept_action = ACTION_DENY; actionset->intercept_action_rec = action; return 1; } /* status */ static char *msre_action_status_validate(msre_engine *engine, msre_action *action) { /* ENH action->param must be a valid HTTP status code. */ return NULL; } static apr_status_t msre_action_status_init(msre_engine *engine, msre_actionset *actionset, msre_action *action) { actionset->intercept_status = atoi(action->param); return 1; } /* drop */ static apr_status_t msre_action_drop_init(msre_engine *engine, msre_actionset *actionset, msre_action *action) { actionset->intercept_action = ACTION_DROP; actionset->intercept_action_rec = action; return 1; } /* pause */ static char *msre_action_pause_validate(msre_engine *engine, msre_action *action) { /* ENH Validate a positive number. */ return NULL; } static apr_status_t msre_action_pause_init(msre_engine *engine, msre_actionset *actionset, msre_action *action) { actionset->intercept_action = ACTION_PAUSE; actionset->intercept_pause = action->param; return 1; } /* redirect */ static char *msre_action_redirect_validate(msre_engine *engine, msre_action *action) { /* ENH Add validation. */ return NULL; } static apr_status_t msre_action_redirect_init(msre_engine *engine, msre_actionset *actionset, msre_action *action) { actionset->intercept_action = ACTION_REDIRECT; actionset->intercept_uri = action->param; actionset->intercept_action_rec = action; return 1; } static apr_status_t msre_action_redirect_execute(modsec_rec *msr, apr_pool_t *mptmp, msre_rule *rule, msre_action *action) { msc_string *var = NULL; var = apr_pcalloc(mptmp, sizeof(msc_string)); if (var == NULL) return -1; var->value = (char *)action->param; var->value_len = strlen(var->value); expand_macros(msr, var, rule, mptmp); rule->actionset->intercept_uri = apr_pstrmemdup(msr->mp, var->value, var->value_len); return 1; } /* proxy */ static char *msre_action_proxy_validate(msre_engine *engine, msre_action *action) { /* ENH Add validation. */ return NULL; } static apr_status_t msre_action_proxy_init(msre_engine *engine, msre_actionset *actionset, msre_action *action) { actionset->intercept_action = ACTION_PROXY; actionset->intercept_uri = action->param; actionset->intercept_action_rec = action; return 1; } static apr_status_t msre_action_proxy_execute(modsec_rec *msr, apr_pool_t *mptmp, msre_rule *rule, msre_action *action) { msc_string *var = NULL; var = apr_pcalloc(mptmp, sizeof(msc_string)); if (var == NULL) return -1; var->value = (char *)action->param; var->value_len = strlen(var->value); expand_macros(msr, var, rule, mptmp); rule->actionset->intercept_uri = apr_pstrmemdup(msr->mp, var->value, var->value_len); return 1; } /* pass */ static apr_status_t msre_action_pass_init(msre_engine *engine, msre_actionset *actionset, msre_action *action) { actionset->intercept_action = ACTION_NONE; actionset->intercept_action_rec = action; return 1; } /* skip */ static char *msre_action_skip_validate(msre_engine *engine, msre_action *action) { /* ENH Add validation. */ return NULL; } static apr_status_t msre_action_skip_init(msre_engine *engine, msre_actionset *actionset, msre_action *action) { actionset->skip_count = atoi(action->param); if (actionset->skip_count <= 0) actionset->skip_count = 1; return 1; } /* skipAfter */ static char *msre_action_skipAfter_validate(msre_engine *engine, msre_action *action) { /* ENH Add validation. */ return NULL; } static apr_status_t msre_action_skipAfter_init(msre_engine *engine, msre_actionset *actionset, msre_action *action) { actionset->skip_after = action->param; return 1; } /* allow */ static apr_status_t msre_action_allow_init(msre_engine *engine, msre_actionset *actionset, msre_action *action) { actionset->intercept_action = ACTION_ALLOW; actionset->intercept_action_rec = action; if (action->param != NULL) { if (strcasecmp(action->param, "phase") == 0) { actionset->intercept_action = ACTION_ALLOW_PHASE; } else if (strcasecmp(action->param, "request") == 0) { actionset->intercept_action = ACTION_ALLOW_REQUEST; } } return 1; } static char *msre_action_allow_validate(msre_engine *engine, msre_action *action) { if (action->param != NULL) { if (strcasecmp(action->param, "phase") == 0) { return NULL; } else if (strcasecmp(action->param, "request") == 0) { return NULL; } else { return apr_psprintf(engine->mp, "Invalid parameter for allow: %s", action->param); } } return NULL; } /* phase */ static char *msre_action_phase_validate(msre_engine *engine, msre_action *action) { /* ENH Add validation. */ return NULL; } static apr_status_t msre_action_phase_init(msre_engine *engine, msre_actionset *actionset, msre_action *action) { if(strcasecmp(action->param,"request") == 0) actionset->phase = 2; else if(strcasecmp(action->param,"response") == 0) actionset->phase = 4; else if(strcasecmp(action->param,"logging") == 0) actionset->phase = 5; else actionset->phase = atoi(action->param); return 1; } /* t */ static char *msre_action_t_validate(msre_engine *engine, msre_action *action) { msre_tfn_metadata *metadata = NULL; metadata = msre_engine_tfn_resolve(engine, action->param); if (metadata == NULL) return apr_psprintf(engine->mp, "Invalid transformation function: %s", action->param); action->param_data = metadata; return NULL; } static apr_status_t msre_action_t_init(msre_engine *engine, msre_actionset *actionset, msre_action *action) { msre_tfn_metadata *metadata = (msre_tfn_metadata *)action->param_data; action->param_data = metadata; return 1; } /* ctl */ static char *msre_action_ctl_validate(msre_engine *engine, msre_action *action) { char *name = NULL; char *value = NULL; /* Parse first. */ if (parse_name_eq_value(engine->mp, action->param, &name, &value) < 0) { return FATAL_ERROR; } if (value == NULL) { return apr_psprintf(engine->mp, "Missing ctl value for name: %s", name); } /* Validate value. */ if (strcasecmp(name, "ruleEngine") == 0) { if (strcasecmp(value, "on") == 0) return NULL; if (strcasecmp(value, "off") == 0) return NULL; if (strcasecmp(value, "detectiononly") == 0) return NULL; return apr_psprintf(engine->mp, "Invalid setting for ctl name ruleEngine: %s", value); } else if (strcasecmp(name, "ruleRemoveById") == 0) { /* ENH nothing yet */ return NULL; } else if (strcasecmp(name, "ruleRemoveByTag") == 0) { if (!msc_pregcomp(engine->mp, value, 0, NULL, NULL)) return apr_psprintf(engine->mp, "ModSecurity: Invalid regular expression \"%s\"", value); return NULL; } else if (strcasecmp(name, "ruleRemoveByMsg") == 0) { if (!msc_pregcomp(engine->mp, value, 0, NULL, NULL)) return apr_psprintf(engine->mp, "ModSecurity: Invalid regular expression \"%s\"", value); return NULL; } else if (strcasecmp(name, "requestBodyAccess") == 0) { if (parse_boolean(value) == -1) { return apr_psprintf(engine->mp, "Invalid setting for ctl name " " requestBodyAccess: %s", value); } return NULL; } else if (strcasecmp(name, "requestBodyProcessor") == 0) { /* ENH We will accept anything for now but it'd be nice * to add a check here that the processor name is a valid one. */ return NULL; } else if (strcasecmp(name, "forceRequestBodyVariable") == 0) { if (strcasecmp(value, "on") == 0) return NULL; if (strcasecmp(value, "off") == 0) return NULL; return apr_psprintf(engine->mp, "Invalid setting for ctl name " " forceRequestBodyVariable: %s", value); } else if (strcasecmp(name, "responseBodyAccess") == 0) { if (parse_boolean(value) == -1) { return apr_psprintf(engine->mp, "Invalid setting for ctl name " " responseBodyAccess: %s", value); } return NULL; } else if (strcasecmp(name, "auditEngine") == 0) { if (strcasecmp(value, "on") == 0) return NULL; if (strcasecmp(value, "off") == 0) return NULL; if (strcasecmp(value, "relevantonly") == 0) return NULL; return apr_psprintf(engine->mp, "Invalid setting for ctl name " " auditEngine: %s", value); } else if (strcasecmp(name, "auditLogParts") == 0) { if ((value[0] == '+')||(value[0] == '-')) { if (is_valid_parts_specification(value + 1) != 1) { return apr_psprintf(engine->mp, "Invalid setting for ctl name " "auditLogParts: %s", value); } } else if (is_valid_parts_specification(value) != 1) { return apr_psprintf(engine->mp, "Invalid setting for ctl name " "auditLogParts: %s", value); } return NULL; } else if (strcasecmp(name, "debugLogLevel") == 0) { if ((atoi(value) >= 0)&&(atoi(value) <= 9)) return NULL; return apr_psprintf(engine->mp, "Invalid setting for ctl name " "debugLogLevel: %s", value); } else if (strcasecmp(name, "requestBodyLimit") == 0) { long int limit = strtol(value, NULL, 10); if ((limit == LONG_MAX)||(limit == LONG_MIN)||(limit <= 0)) { return apr_psprintf(engine->mp, "Invalid setting for ctl name " "requestBodyLimit: %s", value); } if (limit > REQUEST_BODY_HARD_LIMIT) { return apr_psprintf(engine->mp, "Request size limit cannot exceed " "the hard limit: %ld", RESPONSE_BODY_HARD_LIMIT); } return NULL; } else if (strcasecmp(name, "responseBodyLimit") == 0) { long int limit = strtol(value, NULL, 10); if ((limit == LONG_MAX)||(limit == LONG_MIN)||(limit <= 0)) { return apr_psprintf(engine->mp, "Invalid setting for ctl name " "responseBodyLimit: %s", value); } if (limit > RESPONSE_BODY_HARD_LIMIT) { return apr_psprintf(engine->mp, "Response size limit cannot exceed " "the hard limit: %ld", RESPONSE_BODY_HARD_LIMIT); } return NULL; } else if (strcasecmp(name, "ruleRemoveTargetById") == 0) { char *parm = NULL; char *savedptr = NULL; parm = apr_strtok(value,";",&savedptr); if(parm == NULL && savedptr == NULL) return apr_psprintf(engine->mp, "ruleRemoveTargetById must has at least id;VARIABLE"); return NULL; } else if (strcasecmp(name,"ruleRemoveTargetByTag") == 0) { char *parm = NULL; char *savedptr = NULL; parm = apr_strtok(value,";",&savedptr); if(parm == NULL && savedptr == NULL) return apr_psprintf(engine->mp, "ruleRemoveTargetByTag must has at least tag;VARIABLE"); if (!msc_pregcomp(engine->mp, parm, 0, NULL, NULL)) { return apr_psprintf(engine->mp, "ModSecurity: Invalid regular expression \"%s\"", parm); } return NULL; } else if (strcasecmp(name,"ruleRemoveTargetByMsg") == 0) { char *parm = NULL; char *savedptr = NULL; parm = apr_strtok(value,";",&savedptr); if(parm == NULL && savedptr == NULL) return apr_psprintf(engine->mp, "ruleRemoveTargetByMsg must has at least msg;VARIABLE"); if (!msc_pregcomp(engine->mp, parm, 0, NULL, NULL)) { return apr_psprintf(engine->mp, "ModSecurity: Invalid regular expression \"%s\"", parm); } return NULL; } else if (strcasecmp(name, "HashEnforcement") == 0) { if (strcasecmp(value, "on") == 0) return NULL; if (strcasecmp(value, "off") == 0) return NULL; return apr_psprintf(engine->mp, "Invalid setting for ctl name HashEnforcement: %s", value); } else if (strcasecmp(name, "HashEngine") == 0) { if (strcasecmp(value, "on") == 0) return NULL; if (strcasecmp(value, "off") == 0) return NULL; return apr_psprintf(engine->mp, "Invalid setting for ctl name HashEngine: %s", value); } else { return apr_psprintf(engine->mp, "Invalid ctl name setting: %s", name); } } static apr_status_t msre_action_ctl_init(msre_engine *engine, msre_actionset *actionset, msre_action *action) { /* Do nothing. */ return 1; } static apr_status_t msre_action_ctl_execute(modsec_rec *msr, apr_pool_t *mptmp, msre_rule *rule, msre_action *action) { char *name = NULL; char *value = NULL; /* Parse first. */ if (parse_name_eq_value(msr->mp, action->param, &name, &value) < 0) return -1; if (value == NULL) return -1; /* Validate value. */ if (strcasecmp(name, "ruleEngine") == 0) { if (strcasecmp(value, "on") == 0) { msr->txcfg->is_enabled = MODSEC_ENABLED; msr->usercfg->is_enabled = MODSEC_ENABLED; } else if (strcasecmp(value, "off") == 0) { msr->txcfg->is_enabled = MODSEC_DISABLED; msr->usercfg->is_enabled = MODSEC_DISABLED; } else if (strcasecmp(value, "detectiononly") == 0) { msr->txcfg->is_enabled = MODSEC_DETECTION_ONLY; msr->usercfg->is_enabled = MODSEC_DETECTION_ONLY; msr->txcfg->if_limit_action = REQUEST_BODY_LIMIT_ACTION_PARTIAL; msr->usercfg->if_limit_action = REQUEST_BODY_LIMIT_ACTION_PARTIAL; msr->txcfg->of_limit_action = REQUEST_BODY_LIMIT_ACTION_PARTIAL; msr->usercfg->of_limit_action = REQUEST_BODY_LIMIT_ACTION_PARTIAL; } if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Ctl: Set ruleEngine to %s.", value); } return 1; } else if (strcasecmp(name, "HashEnforcement") == 0) { if (strcasecmp(value, "on") == 0) { msr->txcfg->hash_enforcement = HASH_ENABLED; msr->usercfg->hash_enforcement = HASH_ENABLED; } if (strcasecmp(value, "off") == 0) { msr->txcfg->hash_enforcement = HASH_DISABLED; msr->usercfg->hash_enforcement = HASH_DISABLED; } if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Ctl: Set HashEnforcement to %s.", value); } return 1; } else if (strcasecmp(name, "HashEngine") == 0) { if (strcasecmp(value, "on") == 0) { msr->txcfg->hash_is_enabled = HASH_ENABLED; msr->usercfg->hash_is_enabled = HASH_ENABLED; } if (strcasecmp(value, "off") == 0) { msr->txcfg->hash_is_enabled = HASH_DISABLED; msr->usercfg->hash_is_enabled = HASH_DISABLED; } if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Ctl: Set HashEngine to %s.", value); } return 1; } else if (strcasecmp(name, "ruleRemoveById") == 0) { *(const char **)apr_array_push(msr->removed_rules) = (const char *)apr_pstrdup(msr->mp, value); if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Ctl: Removed rule by id : %s.", value); } return 1; } else if (strcasecmp(name, "ruleRemoveByTag") == 0) { rule_exception *re = apr_pcalloc(msr->mp, sizeof(rule_exception)); re->type = RULE_EXCEPTION_REMOVE_TAG; re->param = (const char *)apr_pstrdup(msr->mp, value); re->param_data = msc_pregcomp(msr->mp, re->param, 0, NULL, NULL); if (re->param_data == NULL) { msr_log(msr, 1, "ModSecurity: Invalid regular expression \"%s\"", re->param); return -1; } *(rule_exception **)apr_array_push(msr->removed_rules_tag) = re; if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Ctl: Removed rule by tag : %s.", value); } return 1; } else if (strcasecmp(name, "ruleRemoveByMsg") == 0) { rule_exception *re = apr_pcalloc(msr->mp, sizeof(rule_exception)); re->type = RULE_EXCEPTION_REMOVE_MSG; re->param = (const char *)apr_pstrdup(msr->mp, value); re->param_data = msc_pregcomp(msr->mp, re->param, 0, NULL, NULL); if (re->param_data == NULL) { msr_log(msr, 1, "ModSecurity: Invalid regular expression \"%s\"", re->param); return -1; } *(rule_exception **)apr_array_push(msr->removed_rules_msg) = re; if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Ctl: Removed rule by msg : %s.", value); } return 1; } else if (strcasecmp(name, "requestBodyAccess") == 0) { int pv = parse_boolean(value); if (pv == -1) return -1; msr->txcfg->reqbody_access = pv; msr->usercfg->reqbody_access = pv; if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Ctl: Set requestBodyAccess to %d.", pv); } return 1; } else if (strcasecmp(name, "forceRequestBodyVariable") == 0) { if (strcasecmp(value, "on") == 0) { msr->txcfg->reqbody_buffering = REQUEST_BODY_FORCEBUF_ON; msr->usercfg->reqbody_buffering = REQUEST_BODY_FORCEBUF_ON; } else if (strcasecmp(value, "off") == 0) { msr->txcfg->reqbody_buffering = REQUEST_BODY_FORCEBUF_OFF; msr->usercfg->reqbody_buffering = REQUEST_BODY_FORCEBUF_OFF; } if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Ctl: Set requestBodyAccess to %d.", msr->txcfg->reqbody_buffering); } return 1; } else if (strcasecmp(name, "requestBodyProcessor") == 0) { msr->msc_reqbody_processor = value; if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Ctl: Set requestBodyProcessor to %s.", value); } return 1; } else if (strcasecmp(name, "responseBodyAccess") == 0) { int pv = parse_boolean(value); if (pv == -1) return -1; msr->txcfg->resbody_access = pv; msr->usercfg->resbody_access = pv; if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Ctl: Set responseBodyAccess to %d.", pv); } return 1; } else if (strcasecmp(name, "auditEngine") == 0) { if (strcasecmp(value, "on") == 0) { msr->txcfg->auditlog_flag = AUDITLOG_ON; msr->usercfg->auditlog_flag = AUDITLOG_ON; } else if (strcasecmp(value, "off") == 0) { msr->txcfg->auditlog_flag = AUDITLOG_OFF; msr->usercfg->auditlog_flag = AUDITLOG_OFF; } else if (strcasecmp(value, "relevantonly") == 0) { msr->txcfg->auditlog_flag = AUDITLOG_RELEVANT; msr->usercfg->auditlog_flag = AUDITLOG_RELEVANT; } if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Ctl: Set auditEngine to %d.", msr->txcfg->auditlog_flag); } return 1; } else if (strcasecmp(name, "auditLogParts") == 0) { char *new_value = value; if (value[0] == '+') { /* Add the listed parts. */ new_value = apr_pstrcat(msr->mp, msr->txcfg->auditlog_parts, value + 1, NULL); } else if (value[0] == '-') { /* Remove the listed parts. */ char c, *t = value + 1; /* Start with the current value. */ new_value = apr_pstrdup(msr->mp, msr->txcfg->auditlog_parts); while((c = *t++) != '\0') { char *s = new_value; char *d = new_value; while(*s != '\0') { if (*s != c) { *(d++) = *(s++); } else { s++; } } *d = '\0'; } } /* Set the new value. */ msr->txcfg->auditlog_parts = new_value; msr->usercfg->auditlog_parts = new_value; if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Ctl: Set auditLogParts to %s.", msr->txcfg->auditlog_parts); } return 1; } else if (strcasecmp(name, "debugLogLevel") == 0) { msr->txcfg->debuglog_level = atoi(value); msr->usercfg->debuglog_level = atoi(value); if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Ctl: Set debugLogLevel to %d.", msr->txcfg->debuglog_level); } return 1; } else if (strcasecmp(name, "requestBodyLimit") == 0) { long int limit = strtol(value, NULL, 10); /* ENH Accept only in correct phase warn otherwise. */ msr->txcfg->reqbody_limit = limit; msr->usercfg->reqbody_limit = limit; if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Ctl: Set requestBodyLimit to %ld.", limit); } return 1; } else if (strcasecmp(name, "responseBodyLimit") == 0) { long int limit = strtol(value, NULL, 10); /* ENH Accept only in correct phase warn otherwise. */ msr->txcfg->of_limit = limit; msr->usercfg->of_limit = limit; if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Ctl: Set responseBodyLimit to %ld.", limit); } return 1; } else if (strcasecmp(name, "ruleRemoveTargetById") == 0) { rule_exception *re = NULL; char *p1 = NULL, *p2 = NULL; char *savedptr = NULL; p1 = apr_strtok(value,";",&savedptr); p2 = apr_strtok(NULL,";",&savedptr); if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Ctl: ruleRemoveTargetById id=%s targets=%s", p1, p2); } re = apr_pcalloc(msr->mp, sizeof(rule_exception)); re->type = RULE_EXCEPTION_REMOVE_ID; re->param = (const char *)apr_pstrdup(msr->mp, p1); apr_table_addn(msr->removed_targets, apr_pstrdup(msr->mp, p2), (void *)re); return 1; } else if (strcasecmp(name, "ruleRemoveTargetByTag") == 0) { rule_exception *re = NULL; char *p1 = NULL, *p2 = NULL; char *savedptr = NULL; p1 = apr_strtok(value,";",&savedptr); p2 = apr_strtok(NULL,";",&savedptr); if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Ctl: ruleRemoveTargetByTag tag=%s targets=%s", p1, p2); } re = apr_pcalloc(msr->mp, sizeof(rule_exception)); re->type = RULE_EXCEPTION_REMOVE_TAG; re->param = (const char *)apr_pstrdup(msr->mp, p1); re->param_data = msc_pregcomp(msr->mp, p1, 0, NULL, NULL); if (re->param_data == NULL) { msr_log(msr, 1, "ModSecurity: Invalid regular expression \"%s\"", p1); return -1; } apr_table_addn(msr->removed_targets, apr_pstrdup(msr->mp, p2), (void *)re); return 1; } else if (strcasecmp(name, "ruleRemoveTargetByMsg") == 0) { rule_exception *re = NULL; char *p1 = NULL, *p2 = NULL; char *savedptr = NULL; p1 = apr_strtok(value,";",&savedptr); p2 = apr_strtok(NULL,";",&savedptr); if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Ctl: ruleRemoveTargetByMsg msg=%s targets=%s", p1, p2); } re = apr_pcalloc(msr->mp, sizeof(rule_exception)); re->type = RULE_EXCEPTION_REMOVE_MSG; re->param = apr_pstrdup(msr->mp, p1); re->param_data = msc_pregcomp(msr->mp, p1, 0, NULL, NULL); if (re->param_data == NULL) { msr_log(msr, 1, "ModSecurity: Invalid regular expression \"%s\"", p1); return -1; } apr_table_addn(msr->removed_targets, apr_pstrdup(msr->mp, p2), (void *)re); return 1; } else { /* Should never happen, but log if it does. */ msr_log(msr, 1, "Internal Error: Unknown ctl action \"%s\".", name); return -1; } return -1; } /* xmlns */ static char *msre_action_xmlns_validate(msre_engine *engine, msre_action *action) { char *name = NULL; char *value = NULL; /* Parse first. */ if (parse_name_eq_value(engine->mp, action->param, &name, &value) < 0) { return FATAL_ERROR; } if (value == NULL) { return apr_psprintf(engine->mp, "Missing xmlns href for prefix: %s", name); } /* Don't do anything else right now, we are just storing * the value for the variable, which is the real consumer * for the namespace information. */ return NULL; } /* sanitizeArg */ static apr_status_t msre_action_sanitizeArg_execute(modsec_rec *msr, apr_pool_t *mptmp, msre_rule *rule, msre_action *action) { const char *sargname = NULL; const apr_array_header_t *tarr; const apr_table_entry_t *telts; int i; sargname = action->param; tarr = apr_table_elts(msr->arguments); telts = (const apr_table_entry_t*)tarr->elts; for (i = 0; i < tarr->nelts; i++) { msc_arg *arg = (msc_arg *)telts[i].val; if (strcasecmp(sargname, arg->name) == 0) { apr_table_addn(msr->arguments_to_sanitize, arg->name, (void *)arg); } } return 1; } #define SANITISE_ARG 1 #define SANITISE_REQUEST_HEADER 2 #define SANITISE_RESPONSE_HEADER 3 /* sanitizeMatched */ static apr_status_t msre_action_sanitizeMatched_execute(modsec_rec *msr, apr_pool_t *mptmp, msre_rule *rule, msre_action *action) { const char *sargname = NULL; const apr_array_header_t *tarr; const apr_table_entry_t *telts; int i, type = 0; msc_string *mvar = msr->matched_var; if (mvar->name_len == 0) return 0; /* IMP1 We need to extract the variable name properly here, * taking into account it may have been escaped. */ if ((mvar->name_len > 5) && (strncmp(mvar->name, "ARGS:", 5) == 0)) { sargname = apr_pstrdup(msr->mp, mvar->name + 5); type = SANITISE_ARG; } else if ((mvar->name_len > 11) && (strncmp(mvar->name, "ARGS_NAMES:", 11) == 0)) { sargname = apr_pstrdup(msr->mp, mvar->name + 11); type = SANITISE_ARG; } else if ((mvar->name_len > 16) && (strncmp(mvar->name, "REQUEST_HEADERS:", 16) == 0)) { sargname = apr_pstrdup(msr->mp, mvar->name + 16); type = SANITISE_REQUEST_HEADER; } else if ((mvar->name_len > 22) && (strncmp(mvar->name, "REQUEST_HEADERS_NAMES:", 22) == 0)) { sargname = apr_pstrdup(msr->mp, mvar->name + 22); type = SANITISE_REQUEST_HEADER; } else if ((mvar->name_len > 17) && (strncmp(mvar->name, "RESPONSE_HEADERS:", 17) == 0)) { sargname = apr_pstrdup(msr->mp, mvar->name + 17); type = SANITISE_RESPONSE_HEADER; } else if ((mvar->name_len > 23) && (strncmp(mvar->name, "RESPONSE_HEADERS_NAMES:", 23) == 0)) { sargname = apr_pstrdup(msr->mp, mvar->name + 23); type = SANITISE_RESPONSE_HEADER; } else { if (msr->txcfg->debuglog_level >= 3) { msr_log(msr, 3, "sanitizeMatched: Don't know how to handle variable: %s", mvar->name); } return 0; } switch(type) { case SANITISE_ARG : tarr = apr_table_elts(msr->arguments); telts = (const apr_table_entry_t*)tarr->elts; for (i = 0; i < tarr->nelts; i++) { msc_arg *arg = (msc_arg *)telts[i].val; if (strcasecmp(sargname, arg->name) == 0) { apr_table_addn(msr->arguments_to_sanitize, arg->name, (void *)arg); } } break; case SANITISE_REQUEST_HEADER : apr_table_set(msr->request_headers_to_sanitize, sargname, "1"); break; case SANITISE_RESPONSE_HEADER : apr_table_set(msr->response_headers_to_sanitize, sargname, "1"); break; default : /* do nothing */ break; } return 1; } /* sanitizeRequestHeader */ static apr_status_t msre_action_sanitizeRequestHeader_execute(modsec_rec *msr, apr_pool_t *mptmp, msre_rule *rule, msre_action *action) { apr_table_set(msr->request_headers_to_sanitize, action->param, "1"); return 1; } /* sanitizeResponseHeader */ static apr_status_t msre_action_sanitizeResponseHeader_execute(modsec_rec *msr, apr_pool_t *mptmp, msre_rule *rule, msre_action *action) { apr_table_set(msr->response_headers_to_sanitize, action->param, "1"); return 1; } /* setenv */ static apr_status_t msre_action_setenv_execute(modsec_rec *msr, apr_pool_t *mptmp, msre_rule *rule, msre_action *action) { char *data = apr_pstrdup(mptmp, action->param); char *env_name = NULL, *env_value = NULL; char *s = NULL; msc_string *env = NULL; /* Extract the name and the value. */ /* IMP1 We have a function for this now, parse_name_eq_value? */ s = strstr(data, "="); if (s == NULL) { env_name = data; env_value = "1"; } else { env_name = data; env_value = s + 1; *s = '\0'; } if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Setting env variable: %s=%s", env_name, env_value); } /* Expand and escape any macros in the name */ env = apr_palloc(msr->mp, sizeof(msc_string)); if (env == NULL) { msr_log(msr, 1, "Failed to allocate space to expand name macros"); return -1; } env->value = env_name; env->value_len = strlen(env->value); expand_macros(msr, env, rule, mptmp); env_name = log_escape_nq_ex(msr->mp, env->value, env->value_len); /* Execute the requested action. */ if (env_name[0] == '!') { /* Delete */ apr_table_unset(msr->r->subprocess_env, env_name + 1); if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Unset env variable \"%s\".", env_name); } } else { /* Set */ char * val_value = NULL; msc_string *val = apr_palloc(msr->mp, sizeof(msc_string)); if (val == NULL) { msr_log(msr, 1, "Failed to allocate space to expand value macros"); return -1; } /* Expand values in value */ val->value = env_value; val->value_len = strlen(val->value); expand_macros(msr, val, rule, mptmp); /* To be safe, we escape NULs as it goes in subprocess_env. */ val_value = log_escape_nul(msr->mp, (const unsigned char *)val->value, val->value_len); apr_table_set(msr->r->subprocess_env, env_name, val_value); if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Set env variable \"%s\" to: %s", env_name, log_escape_nq(mptmp, val_value)); } } return 1; } /* setvar */ apr_status_t msre_action_setvar_execute(modsec_rec *msr, apr_pool_t *mptmp, msre_rule *rule, char *var_name, char *var_value) { char *col_name = NULL; char *s = NULL; apr_table_t *target_col = NULL; int is_negated = 0; msc_string *var = NULL; if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Setting variable: %s=%s", var_name, var_value); } /* Expand and escape any macros in the name */ var = apr_palloc(msr->mp, sizeof(msc_string)); if (var == NULL) { msr_log(msr, 1, "Failed to allocate space to expand name macros"); return -1; } var->value = var_name; var->value_len = strlen(var->value); expand_macros(msr, var, rule, mptmp); var_name = log_escape_nq_ex(msr->mp, var->value, var->value_len); /* Handle the exclamation mark. */ if (var_name[0] == '!') { var_name = var_name + 1; is_negated = 1; } /* ENH Not possible to use ! and = at the same time. */ /* ENH Not possible to change variable "KEY". */ /* Figure out the collection name. */ target_col = msr->tx_vars; s = strstr(var_name, "."); if (s == NULL) { if (msr->txcfg->debuglog_level >= 3) { msr_log(msr, 3, "Asked to set variable \"%s\", but no collection name specified. ", log_escape(msr->mp, var_name)); } return 0; } col_name = var_name; var_name = s + 1; *s = '\0'; /* Locate the collection. */ if (strcasecmp(col_name, "tx") == 0) { /* Special case for TX variables. */ target_col = msr->tx_vars; } else { target_col = (apr_table_t *)apr_table_get(msr->collections, col_name); if (target_col == NULL) { if (msr->txcfg->debuglog_level >= 3) { msr_log(msr, 3, "Could not set variable \"%s.%s\" as the collection does not exist.", log_escape(msr->mp, col_name), log_escape(msr->mp, var_name)); } return 0; } } if (is_negated) { /* Unset variable. */ /* ENH Refuse to remove certain variables, e.g. TIMEOUT, internal variables, etc... */ apr_table_unset(target_col, var_name); if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Unset variable \"%s.%s\".", col_name, var_name); } } else { /* Set or change variable. */ if ((var_value[0] == '+')||(var_value[0] == '-')) { /* Relative change. */ msc_string *rec = NULL; msc_string *val = apr_palloc(msr->mp, sizeof(msc_string)); int value = 0; if (val == NULL) { msr_log(msr, 1, "Failed to allocate space to expand value macros"); return -1; } /* Retrieve variable or generate (if it does not exist). */ rec = (msc_string *)apr_table_get(target_col, var_name); if (rec == NULL) { rec = var; /* use the already allocated space for var */ rec->name = apr_pstrdup(msr->mp, var_name); rec->name_len = strlen(rec->name); value = 0; rec->value = apr_psprintf(msr->mp, "%d", value); rec->value_len = strlen(rec->value); } else { value = atoi(rec->value); } /* Record the original value before we change it */ collection_original_setvar(msr, col_name, rec); /* Expand values in value */ val->value = var_value; val->value_len = strlen(val->value); expand_macros(msr, val, rule, mptmp); var_value = val->value; if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Relative change: %s=%d%s", var_name, value, var_value); } /* Change value. */ value += atoi(var_value); if (value < 0) value = 0; /* Counters never go below zero. */ /* Put the variable back. */ rec->value = apr_psprintf(msr->mp, "%d", value); rec->value_len = strlen(rec->value); apr_table_setn(target_col, rec->name, (void *)rec); if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Set variable \"%s.%s\" to \"%s\".", col_name, rec->name, log_escape_ex(mptmp, rec->value, rec->value_len)); } } else { /* Absolute change. */ var->name = apr_pstrdup(msr->mp, var_name); var->name_len = strlen(var->name); var->value = apr_pstrdup(msr->mp, var_value); var->value_len = strlen(var->value); expand_macros(msr, var, rule, mptmp); apr_table_setn(target_col, var->name, (void *)var); if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Set variable \"%s.%s\" to \"%s\".", log_escape(mptmp, col_name), log_escape_ex(mptmp, var->name, var->name_len), log_escape_ex(mptmp, var->value, var->value_len)); } } } /* Make note of the change so that we know later * we need to persist the collection. */ apr_table_set(msr->collections_dirty, col_name, "1"); return 1; } /* * \brief Parse fuction for setvar input * * \param msr Pointer to the engine * \param mptmp Pointer to the pool * \param rule Pointer to rule struct * \param action input data * * \retval -1 On failure * \retval 0 On Collection failure * \retval 1 On Success */ static apr_status_t msre_action_setvar_parse(modsec_rec *msr, apr_pool_t *mptmp, msre_rule *rule, msre_action *action) { char *data = apr_pstrdup(mptmp, action->param); char *var_name = NULL, *var_value = NULL; char *s = NULL; /* Extract the name and the value. */ /* IMP1 We have a function for this now, parse_name_eq_value? */ s = strstr(data, "="); if (s == NULL) { var_name = data; var_value = "1"; } else { var_name = data; var_value = s + 1; *s = '\0'; while ((*var_value != '\0')&&(isspace(*var_value))) var_value++; } return msre_action_setvar_execute(msr,mptmp,rule,var_name,var_value); } /* expirevar */ static apr_status_t msre_action_expirevar_execute(modsec_rec *msr, apr_pool_t *mptmp, msre_rule *rule, msre_action *action) { char *data = apr_pstrdup(mptmp, action->param); char *col_name = NULL, *var_name = NULL, *var_value = NULL; char *s = NULL; apr_table_t *target_col = NULL; msc_string *var = NULL; /* Extract the name and the value. */ /* IMP1 We have a function for this now, parse_name_eq_value? */ s = strstr(data, "="); if (s == NULL) { var_name = data; var_value = "1"; } else { var_name = data; var_value = s + 1; *s = '\0'; } if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Expiring variable: %s=%s", var_name, var_value); } /* Expand and escape any macros in the name */ var = apr_palloc(msr->mp, sizeof(msc_string)); if (var == NULL) { msr_log(msr, 1, "Failed to allocate space to expand name macros"); return -1; } var->value = var_name; var->value_len = strlen(var->value); expand_macros(msr, var, rule, mptmp); var_name = log_escape_nq_ex(msr->mp, var->value, var->value_len); /* Choose the collection to work with. */ s = strstr(var_name, "."); if (s != NULL) { col_name = var_name; var_name = s + 1; *s = '\0'; /* IMP1 No need to handle TX here because TX variables cannot expire, * but we definitely need to have a better error message. */ target_col = (apr_table_t *)apr_table_get(msr->collections, col_name); if (target_col == NULL) { if (msr->txcfg->debuglog_level >= 3) { msr_log(msr, 3, "Could not expire variable \"%s.%s\" as the collection does not exist.", log_escape(msr->mp, col_name), log_escape(msr->mp, var_name)); } return 0; } } else { if (msr->txcfg->debuglog_level >= 3) { msr_log(msr, 3, "Asked to expire variable \"%s\", but no collection name specified. ", log_escape(msr->mp, var_name)); } return 0; } /* To expire a variable we just place a special variable into * the collection. Expiry actually happens when the collection * is retrieved from storage the next time. */ var = (msc_string *)apr_pcalloc(msr->mp, sizeof(msc_string)); var->name = apr_psprintf(msr->mp, "__expire_%s", var_name); var->name_len = strlen(var->name); /* Expand macros in value */ var->value = var_value; var->value_len = strlen(var->value); expand_macros(msr, var, rule, msr->mp); var_value = var->value; /* Calculate with the expanded value */ var->value = apr_psprintf(msr->mp, "%" APR_TIME_T_FMT, (apr_time_t)(apr_time_sec(msr->request_time) + atoi(var_value))); var->value_len = strlen(var->value); apr_table_setn(target_col, var->name, (void *)var); if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Variable \"%s.%s\" set to expire in %s seconds.", col_name, var_name, var_value); } apr_table_set(msr->collections_dirty, col_name, "1"); return 1; } /* deprecatevar */ static apr_status_t msre_action_deprecatevar_execute(modsec_rec *msr, apr_pool_t *mptmp, msre_rule *rule, msre_action *action) { char *data = apr_pstrdup(mptmp, action->param); char *col_name = NULL, *var_name = NULL, *var_value = NULL; char *s = NULL; apr_table_t *target_col = NULL; msc_string *var = NULL, *var_last_update_time = NULL; apr_time_t last_update_time, current_time; long current_value, new_value; /* Extract the name and the value. */ /* IMP1 We have a function for this now, parse_name_eq_value? */ s = strstr(data, "="); if (s == NULL) { var_name = data; var_value = "1"; } else { var_name = data; var_value = s + 1; *s = '\0'; } if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Deprecating variable: %s=%s", var_name, var_value); } /* Expand and escape any macros in the name */ var = apr_palloc(msr->mp, sizeof(msc_string)); if (var == NULL) { msr_log(msr, 1, "Failed to allocate space to expand name macros"); return -1; } var->value = var_name; var->value_len = strlen(var->value); expand_macros(msr, var, rule, mptmp); var_name = log_escape_nq_ex(msr->mp, var->value, var->value_len); /* Expand macros in value */ var->value = var_value; var->value_len = strlen(var->value); expand_macros(msr, var, rule, msr->mp); var_value = var->value; /* Choose the collection to work with. */ s = strstr(var_name, "."); if (s != NULL) { col_name = var_name; var_name = s + 1; *s = '\0'; /* IMP1 Add message TX variables cannot deprecate in value. */ target_col = (apr_table_t *)apr_table_get(msr->collections, col_name); if (target_col == NULL) { if (msr->txcfg->debuglog_level >= 3) { msr_log(msr, 3, "Could not deprecate variable \"%s.%s\" as the collection does " "not exist.", log_escape(msr->mp, col_name), log_escape(msr->mp, var_name)); } return 0; } } else { if (msr->txcfg->debuglog_level >= 3) { msr_log(msr, 3, "Asked to deprecate variable \"%s\", but no collection name specified. ", log_escape(msr->mp, var_name)); } return 0; } /* Find the current value. */ var = (msc_string *)apr_table_get(target_col, var_name); if (var == NULL) { if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Asked to deprecate variable \"%s.%s\", but it does not exist.", log_escape(msr->mp, col_name), log_escape(msr->mp, var_name)); } return 0; } current_value = atoi(var->value); /* Find the last update time (of the collection). */ var_last_update_time = (msc_string *)apr_table_get(target_col, "LAST_UPDATE_TIME"); if (var_last_update_time == NULL) { /* This is all right. If collection was created (and not restored from * storage) then it won't have LAST_UPDATE_TIME - it was never updated. */ return 0; } current_time = apr_time_sec(apr_time_now()); last_update_time = atoi(var_last_update_time->value); s = strstr(var_value, "/"); if (s == NULL) { msr_log(msr, 3, "Incorrect format for the deprecatevar argument: \"%s\"", log_escape(msr->mp, var_value)); return 0; } *s = '\0'; s++; /* Deprecate the value using the given speed and the * time elapsed since the last update. */ new_value = current_value - (atol(var_value) * ((current_time - last_update_time) / atol(s))); if (new_value < 0) new_value = 0; /* Only change the value if it differs. */ if (new_value != current_value) { var->value = apr_psprintf(msr->mp, "%ld", new_value); var->value_len = strlen(var->value); if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Deprecated variable \"%s.%s\" from %ld to %ld (%" APR_TIME_T_FMT " seconds since " "last update).", log_escape(msr->mp, col_name), log_escape(msr->mp, var_name), current_value, new_value, (apr_time_t)(current_time - last_update_time)); } apr_table_set(msr->collections_dirty, col_name, "1"); } else { if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Not deprecating variable \"%s.%s\" because the new value (%ld) is " "the same as the old one (%ld) (%" APR_TIME_T_FMT " seconds since last update).", log_escape(msr->mp, col_name), log_escape(msr->mp, var_name), current_value, new_value, (apr_time_t)(current_time - last_update_time)); } } return 1; } static apr_status_t init_collection(modsec_rec *msr, const char *real_col_name, const char *col_name, const char *col_key, unsigned int col_key_len) { apr_table_t *table = NULL; msc_string *var = NULL; /* IMP1 Cannot initialise the built-in collections this way. */ /* Does the collection exist already? */ if (apr_table_get(msr->collections, col_name) != NULL) { /* ENH Warn about this. */ return 0; } /* Init collection from storage. */ table = collection_retrieve(msr, real_col_name, col_key, col_key_len); if (table == NULL) { /* Does not exist yet - create new. */ if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Creating collection (name \"%s\", key \"%s\").", real_col_name, col_key); } table = apr_table_make(msr->mp, 24); if (table == NULL) return -1; /* IMP1 Is the timeout hard-coded to 3600? */ if(msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Setting default timeout collection value %d.",msr->txcfg->col_timeout); } /* Add default timeout. */ var = (msc_string *)apr_pcalloc(msr->mp, sizeof(msc_string)); var->name = "__expire_KEY"; var->name_len = strlen(var->name); var->value = apr_psprintf(msr->mp, "%" APR_TIME_T_FMT, (apr_time_t)(apr_time_sec(msr->request_time) + msr->txcfg->col_timeout)); var->value_len = strlen(var->value); apr_table_setn(table, var->name, (void *)var); /* Remember the key. */ var = apr_pcalloc(msr->mp, sizeof(msc_string)); var->name = "KEY"; var->name_len = strlen(var->name); var->value = apr_pstrmemdup(msr->mp, col_key, col_key_len); var->value_len = col_key_len; apr_table_setn(table, var->name, (void *)var); /* The timeout. */ var = apr_pcalloc(msr->mp, sizeof(msc_string)); var->name = "TIMEOUT"; var->name_len = strlen(var->name); var->value = apr_psprintf(msr->mp, "%d", msr->txcfg->col_timeout); var->value_len = strlen(var->value); apr_table_setn(table, var->name, (void *)var); /* We may want to allow the user to unset KEY * but we still need to preserve value to identify * the collection in storage. */ /* IMP1 Actually I want a better way to delete collections, * perhaps a dedicated action. */ var = apr_pcalloc(msr->mp, sizeof(msc_string)); var->name = "__key"; var->name_len = strlen(var->name); var->value = apr_pstrmemdup(msr->mp, col_key, col_key_len); var->value_len = col_key_len; apr_table_setn(table, var->name, (void *)var); /* Peristence code will need to know the name of the collection. */ var = apr_pcalloc(msr->mp, sizeof(msc_string)); var->name = "__name"; var->name_len = strlen(var->name); var->value = apr_pstrdup(msr->mp, real_col_name); var->value_len = strlen(var->value); apr_table_setn(table, var->name, (void *)var); /* Create time. */ var = apr_pcalloc(msr->mp, sizeof(msc_string)); var->name = "CREATE_TIME"; var->name_len = strlen(var->name); var->value = apr_psprintf(msr->mp, "%" APR_TIME_T_FMT, (apr_time_t)apr_time_sec(msr->request_time)); var->value_len = strlen(var->value); apr_table_setn(table, var->name, (void *)var); /* Update counter. */ var = apr_pcalloc(msr->mp, sizeof(msc_string)); var->name = "UPDATE_COUNTER"; var->name_len = strlen(var->name); var->value = "0"; var->value_len = strlen(var->value); apr_table_setn(table, var->name, (void *)var); /* This is a new collection. */ var = apr_pcalloc(msr->mp, sizeof(msc_string)); var->name = "IS_NEW"; var->name_len = strlen(var->name); var->value = "1"; var->value_len = strlen(var->value); apr_table_setn(table, var->name, (void *)var); } /* Record the original counter value before we change it */ var = (msc_string *)apr_table_get(table, "UPDATE_COUNTER"); if (var != NULL) { collection_original_setvar(msr, col_name, var); } /* Add the collection to the list. */ apr_table_setn(msr->collections, apr_pstrdup(msr->mp, col_name), (void *)table); if (msr->txcfg->debuglog_level >= 4) { if (strcmp(col_name, real_col_name) != 0) { msr_log(msr, 4, "Added collection \"%s\" to the list as \"%s\".", log_escape(msr->mp, real_col_name), log_escape(msr->mp, col_name)); } else { msr_log(msr, 4, "Added collection \"%s\" to the list.", log_escape(msr->mp, real_col_name)); } } return 1; } /* initcol */ static apr_status_t msre_action_initcol_execute(modsec_rec *msr, apr_pool_t *mptmp, msre_rule *rule, msre_action *action) { char *data = apr_pstrdup(msr->mp, action->param); char *col_name = NULL, *col_key = NULL; unsigned int col_key_len; msc_string *var = NULL; char *s = NULL; /* Extract the name and the value. */ /* IMP1 We have a function for this now, parse_name_eq_value? */ s = strstr(data, "="); if (s == NULL) return 0; col_name = strtolower_inplace((unsigned char *)data); col_key = s + 1; *s = '\0'; /* Expand the key and init collection from storage. */ var = apr_pcalloc(mptmp, sizeof(msc_string)); var->value = col_key; var->value_len = strlen(var->value); expand_macros(msr, var, rule, mptmp); col_key = var->value; col_key_len = var->value_len; return init_collection(msr, col_name, col_name, col_key, col_key_len); } /* setsid */ static apr_status_t msre_action_setsid_execute(modsec_rec *msr, apr_pool_t *mptmp, msre_rule *rule, msre_action *action) { msc_string *var = NULL; char *real_col_name = NULL, *col_key = NULL; unsigned int col_key_len; /* Construct session ID. */ var = apr_pcalloc(mptmp, sizeof(msc_string)); var->value = (char *)action->param; var->value_len = strlen(var->value); expand_macros(msr, var, rule, mptmp); msr->sessionid = apr_pstrdup(msr->mp, var->value); /* Construct collection name. */ col_key = var->value; col_key_len = var->value_len; real_col_name = apr_psprintf(mptmp, "%s_SESSION", msr->txcfg->webappid); /* Initialise collection. */ return init_collection(msr, real_col_name, "SESSION", col_key, col_key_len); } /* setuid */ static apr_status_t msre_action_setuid_execute(modsec_rec *msr, apr_pool_t *mptmp, msre_rule *rule, msre_action *action) { msc_string *var = NULL; char *real_col_name = NULL, *col_key = NULL; unsigned int col_key_len; /* Construct user ID. */ var = apr_pcalloc(mptmp, sizeof(msc_string)); var->value = (char *)action->param; var->value_len = strlen(var->value); expand_macros(msr, var, rule, mptmp); msr->userid = apr_pstrdup(msr->mp, var->value); /* Construct collection name. */ col_key = var->value; col_key_len = var->value_len; real_col_name = apr_psprintf(mptmp, "%s_USER", msr->txcfg->webappid); /* Initialise collection. */ return init_collection(msr, real_col_name, "USER", col_key, col_key_len); } /* setrsc */ static apr_status_t msre_action_setrsc_execute(modsec_rec *msr, apr_pool_t *mptmp, msre_rule *rule, msre_action *action) { msc_string *var = NULL; char *real_col_name = NULL, *col_key = NULL; unsigned int col_key_len; /* Construct user ID. */ var = apr_pcalloc(mptmp, sizeof(msc_string)); var->value = (char *)action->param; var->value_len = strlen(var->value); expand_macros(msr, var, rule, mptmp); /* Construct collection name. */ col_key = var->value; col_key_len = var->value_len; real_col_name = apr_psprintf(mptmp, "%s_RESOURCE", msr->txcfg->webappid); /* Initialise collection. */ return init_collection(msr, real_col_name, "RESOURCE", col_key, col_key_len); } /* exec */ static char *msre_action_exec_validate(msre_engine *engine, msre_action *action) { #if defined(WITH_LUA) char *filename = (char *)action->param; /* TODO Support relative filenames. */ /* Process Lua scripts internally. */ if (strlen(filename) > 4) { char *p = filename + strlen(filename) - 4; if ((p[0] == '.')&&(p[1] == 'l')&&(p[2] == 'u')&&(p[3] == 'a')) { /* It's a Lua script. */ msc_script *script = NULL; /* Compile script. */ char *msg = lua_compile(&script, filename, engine->mp); if (msg != NULL) return msg; action->param_data = script; } } #endif return NULL; } static apr_status_t msre_action_exec_execute(modsec_rec *msr, apr_pool_t *mptmp, msre_rule *rule, msre_action *action) { #if defined(WITH_LUA) if (action->param_data != NULL) { /* Lua */ msc_script *script = (msc_script *)action->param_data; char *my_error_msg = NULL; if (lua_execute(script, NULL, msr, rule, &my_error_msg) < 0) { msr_log(msr, 1, "%s", my_error_msg); return 0; } } else #endif { /* Execute as shell script. */ char *script_output = NULL; int rc = apache2_exec(msr, action->param, NULL, &script_output); if (rc != 1) { msr_log(msr, 1, "Failed to execute: %s", action->param); return 0; } } return 1; } /* prepend */ static apr_status_t msre_action_prepend_execute(modsec_rec *msr, apr_pool_t *mptmp, msre_rule *rule, msre_action *action) { msc_string *var = NULL; /* Expand any macros in the text */ var = apr_pcalloc(mptmp, sizeof(msc_string)); if (var == NULL) return -1; var->value = (char *)action->param; var->value_len = strlen(var->value); expand_macros(msr, var, rule, mptmp); /* ENH: Verify we really have to dup the data here. */ msr->content_prepend = apr_pstrndup(msr->mp, var->value, var->value_len); msr->content_prepend_len = var->value_len; return 1; } /* append */ static apr_status_t msre_action_append_execute(modsec_rec *msr, apr_pool_t *mptmp, msre_rule *rule, msre_action *action) { msc_string *var = NULL; /* Expand any macros in the text */ var = apr_pcalloc(mptmp, sizeof(msc_string)); if (var == NULL) return -1; var->value = (char *)action->param; var->value_len = strlen(var->value); expand_macros(msr, var, rule, mptmp); /* ENH: Verify we really have to dup the data here. */ msr->content_append = apr_pstrndup(msr->mp, var->value, var->value_len); msr->content_append_len = var->value_len; return 1; } /* -- */ /** * */ void msre_engine_register_default_actions(msre_engine *engine) { /* id */ msre_engine_action_register(engine, "id", ACTION_METADATA, 1, 1, NO_PLUS_MINUS, ACTION_CARDINALITY_ONE, ACTION_CGROUP_NONE, msre_action_id_validate, msre_action_id_init, NULL ); /* marker */ msre_engine_action_register(engine, "marker", ACTION_METADATA, 1, 1, NO_PLUS_MINUS, ACTION_CARDINALITY_ONE, ACTION_CGROUP_NONE, NULL, msre_action_marker_init, NULL ); /* rev */ msre_engine_action_register(engine, "rev", ACTION_METADATA, 1, 1, NO_PLUS_MINUS, ACTION_CARDINALITY_ONE, ACTION_CGROUP_NONE, NULL, msre_action_rev_init, NULL ); /* msg */ msre_engine_action_register(engine, "msg", ACTION_METADATA, 1, 1, NO_PLUS_MINUS, ACTION_CARDINALITY_ONE, ACTION_CGROUP_NONE, NULL, msre_action_msg_init, NULL ); /* logdata */ msre_engine_action_register(engine, "logdata", ACTION_METADATA, 1, 1, NO_PLUS_MINUS, ACTION_CARDINALITY_ONE, ACTION_CGROUP_NONE, NULL, msre_action_logdata_init, NULL ); /* accuracy */ msre_engine_action_register(engine, "accuracy", ACTION_METADATA, 1, 1, NO_PLUS_MINUS, ACTION_CARDINALITY_ONE, ACTION_CGROUP_NONE, NULL, msre_action_accuracy_init, NULL ); /* maturity */ msre_engine_action_register(engine, "maturity", ACTION_METADATA, 1, 1, NO_PLUS_MINUS, ACTION_CARDINALITY_ONE, ACTION_CGROUP_NONE, NULL, msre_action_maturity_init, NULL ); /* ver */ msre_engine_action_register(engine, "ver", ACTION_METADATA, 1, 1, NO_PLUS_MINUS, ACTION_CARDINALITY_ONE, ACTION_CGROUP_NONE, NULL, msre_action_ver_init, NULL ); /* severity */ msre_engine_action_register(engine, "severity", ACTION_METADATA, 1, 1, NO_PLUS_MINUS, ACTION_CARDINALITY_ONE, ACTION_CGROUP_NONE, NULL, msre_action_severity_init, NULL ); /* chain */ msre_engine_action_register(engine, "chain", ACTION_FLOW, 0, 0, NO_PLUS_MINUS, ACTION_CARDINALITY_ONE, ACTION_CGROUP_NONE, NULL, msre_action_chain_init, NULL ); /* log */ msre_engine_action_register(engine, "log", ACTION_NON_DISRUPTIVE, 0, 0, NO_PLUS_MINUS, ACTION_CARDINALITY_ONE, ACTION_CGROUP_LOG, NULL, msre_action_log_init, NULL ); /* nolog */ msre_engine_action_register(engine, "nolog", ACTION_NON_DISRUPTIVE, 0, 0, NO_PLUS_MINUS, ACTION_CARDINALITY_ONE, ACTION_CGROUP_LOG, NULL, msre_action_nolog_init, NULL ); /* auditlog */ msre_engine_action_register(engine, "auditlog", ACTION_NON_DISRUPTIVE, 0, 0, NO_PLUS_MINUS, ACTION_CARDINALITY_ONE, ACTION_CGROUP_AUDITLOG, NULL, msre_action_auditlog_init, NULL ); /* noauditlog */ msre_engine_action_register(engine, "noauditlog", ACTION_NON_DISRUPTIVE, 0, 0, NO_PLUS_MINUS, ACTION_CARDINALITY_ONE, ACTION_CGROUP_AUDITLOG, NULL, msre_action_noauditlog_init, NULL ); /* deny */ msre_engine_action_register(engine, "block", ACTION_DISRUPTIVE, 0, 0, NO_PLUS_MINUS, ACTION_CARDINALITY_ONE, ACTION_CGROUP_DISRUPTIVE, NULL, msre_action_block_init, NULL ); /* deny */ msre_engine_action_register(engine, "deny", ACTION_DISRUPTIVE, 0, 0, NO_PLUS_MINUS, ACTION_CARDINALITY_ONE, ACTION_CGROUP_DISRUPTIVE, NULL, msre_action_deny_init, NULL ); /* status */ msre_engine_action_register(engine, "status", ACTION_DISRUPTIVE, 1, 1, NO_PLUS_MINUS, ACTION_CARDINALITY_ONE, ACTION_CGROUP_NONE, msre_action_status_validate, msre_action_status_init, NULL ); /* drop */ msre_engine_action_register(engine, "drop", ACTION_DISRUPTIVE, 0, 0, NO_PLUS_MINUS, ACTION_CARDINALITY_ONE, ACTION_CGROUP_DISRUPTIVE, NULL, msre_action_drop_init, NULL ); /* pause */ msre_engine_action_register(engine, "pause", ACTION_DISRUPTIVE, 1, 1, NO_PLUS_MINUS, ACTION_CARDINALITY_ONE, ACTION_CGROUP_NONE, msre_action_pause_validate, msre_action_pause_init, NULL ); /* redirect */ msre_engine_action_register(engine, "redirect", ACTION_DISRUPTIVE, 1, 1, NO_PLUS_MINUS, ACTION_CARDINALITY_ONE, ACTION_CGROUP_DISRUPTIVE, msre_action_redirect_validate, msre_action_redirect_init, msre_action_redirect_execute ); /* proxy */ msre_engine_action_register(engine, "proxy", ACTION_DISRUPTIVE, 1, 1, NO_PLUS_MINUS, ACTION_CARDINALITY_ONE, ACTION_CGROUP_DISRUPTIVE, msre_action_proxy_validate, msre_action_proxy_init, msre_action_proxy_execute ); /* pass */ msre_engine_action_register(engine, "pass", ACTION_DISRUPTIVE, 0, 0, NO_PLUS_MINUS, ACTION_CARDINALITY_ONE, ACTION_CGROUP_DISRUPTIVE, NULL, msre_action_pass_init, NULL ); /* skip */ msre_engine_action_register(engine, "skip", ACTION_DISRUPTIVE, 1, 1, NO_PLUS_MINUS, ACTION_CARDINALITY_ONE, ACTION_CGROUP_DISRUPTIVE, msre_action_skip_validate, msre_action_skip_init, NULL ); /* skipAfter */ msre_engine_action_register(engine, "skipAfter", ACTION_DISRUPTIVE, 1, 1, NO_PLUS_MINUS, ACTION_CARDINALITY_ONE, ACTION_CGROUP_DISRUPTIVE, msre_action_skipAfter_validate, msre_action_skipAfter_init, NULL ); /* allow */ msre_engine_action_register(engine, "allow", ACTION_DISRUPTIVE, 0, 1, NO_PLUS_MINUS, ACTION_CARDINALITY_ONE, ACTION_CGROUP_DISRUPTIVE, msre_action_allow_validate, msre_action_allow_init, NULL ); /* phase */ /* ENH: This should be ACTION_NON_DISRUPTIVE or ACTION_FLOW??? */ msre_engine_action_register(engine, "phase", ACTION_DISRUPTIVE, 1, 1, NO_PLUS_MINUS, ACTION_CARDINALITY_ONE, ACTION_CGROUP_NONE, msre_action_phase_validate, msre_action_phase_init, NULL ); /* t */ msre_engine_action_register(engine, "t", ACTION_NON_DISRUPTIVE, 1, 1, ALLOW_PLUS_MINUS, ACTION_CARDINALITY_MANY, ACTION_CGROUP_NONE, msre_action_t_validate, msre_action_t_init, NULL ); /* ctl */ msre_engine_action_register(engine, "ctl", ACTION_NON_DISRUPTIVE, 1, 1, NO_PLUS_MINUS, ACTION_CARDINALITY_MANY, ACTION_CGROUP_NONE, msre_action_ctl_validate, msre_action_ctl_init, msre_action_ctl_execute ); /* xmlns */ msre_engine_action_register(engine, "xmlns", ACTION_NON_DISRUPTIVE, 1, 1, NO_PLUS_MINUS, ACTION_CARDINALITY_MANY, ACTION_CGROUP_NONE, msre_action_xmlns_validate, NULL, NULL ); /* capture */ msre_engine_action_register(engine, "capture", ACTION_NON_DISRUPTIVE, 0, 0, NO_PLUS_MINUS, ACTION_CARDINALITY_ONE, ACTION_CGROUP_NONE, NULL, NULL, NULL ); /* sanitiseArg */ msre_engine_action_register(engine, "sanitiseArg", ACTION_NON_DISRUPTIVE, 1, 1, NO_PLUS_MINUS, ACTION_CARDINALITY_MANY, ACTION_CGROUP_NONE, NULL, NULL, msre_action_sanitizeArg_execute ); /* sanitiseMatchedBytes */ msre_engine_action_register(engine, "sanitiseMatchedBytes", ACTION_NON_DISRUPTIVE, 0, 1, NO_PLUS_MINUS, ACTION_CARDINALITY_MANY, ACTION_CGROUP_NONE, NULL, msre_action_sanitizeMatchedBytes_init, msre_action_sanitizeMatched_execute ); /* sanitizeMatchedBytes */ msre_engine_action_register(engine, "sanitizeMatchedBytes", ACTION_NON_DISRUPTIVE, 0, 1, NO_PLUS_MINUS, ACTION_CARDINALITY_MANY, ACTION_CGROUP_NONE, NULL, msre_action_sanitizeMatchedBytes_init, msre_action_sanitizeMatched_execute ); /* sanitizeArg */ msre_engine_action_register(engine, "sanitizeArg", ACTION_NON_DISRUPTIVE, 1, 1, NO_PLUS_MINUS, ACTION_CARDINALITY_MANY, ACTION_CGROUP_NONE, NULL, NULL, msre_action_sanitizeArg_execute ); /* sanitiseMatched */ msre_engine_action_register(engine, "sanitiseMatched", ACTION_NON_DISRUPTIVE, 0, 0, NO_PLUS_MINUS, ACTION_CARDINALITY_MANY, ACTION_CGROUP_NONE, NULL, NULL, msre_action_sanitizeMatched_execute ); /* sanitizeMatched */ msre_engine_action_register(engine, "sanitizeMatched", ACTION_NON_DISRUPTIVE, 0, 0, NO_PLUS_MINUS, ACTION_CARDINALITY_MANY, ACTION_CGROUP_NONE, NULL, NULL, msre_action_sanitizeMatched_execute ); /* sanitiseRequestHeader */ msre_engine_action_register(engine, "sanitiseRequestHeader", ACTION_NON_DISRUPTIVE, 1, 1, NO_PLUS_MINUS, ACTION_CARDINALITY_MANY, ACTION_CGROUP_NONE, NULL, NULL, msre_action_sanitizeRequestHeader_execute ); /* sanitizeRequestHeader */ msre_engine_action_register(engine, "sanitizeRequestHeader", ACTION_NON_DISRUPTIVE, 1, 1, NO_PLUS_MINUS, ACTION_CARDINALITY_MANY, ACTION_CGROUP_NONE, NULL, NULL, msre_action_sanitizeRequestHeader_execute ); /* sanitiseResponseHeader */ msre_engine_action_register(engine, "sanitiseResponseHeader", ACTION_NON_DISRUPTIVE, 1, 1, NO_PLUS_MINUS, ACTION_CARDINALITY_MANY, ACTION_CGROUP_NONE, NULL, NULL, msre_action_sanitizeResponseHeader_execute ); /* sanitizeResponseHeader */ msre_engine_action_register(engine, "sanitizeResponseHeader", ACTION_NON_DISRUPTIVE, 1, 1, NO_PLUS_MINUS, ACTION_CARDINALITY_MANY, ACTION_CGROUP_NONE, NULL, NULL, msre_action_sanitizeResponseHeader_execute ); /* setenv */ msre_engine_action_register(engine, "setenv", ACTION_NON_DISRUPTIVE, 1, 1, NO_PLUS_MINUS, ACTION_CARDINALITY_MANY, ACTION_CGROUP_NONE, NULL, NULL, msre_action_setenv_execute ); /* setvar */ msre_engine_action_register(engine, "setvar", ACTION_NON_DISRUPTIVE, 1, 1, NO_PLUS_MINUS, ACTION_CARDINALITY_MANY, ACTION_CGROUP_NONE, NULL, NULL, msre_action_setvar_parse ); /* expirevar */ msre_engine_action_register(engine, "expirevar", ACTION_NON_DISRUPTIVE, 1, 1, NO_PLUS_MINUS, ACTION_CARDINALITY_MANY, ACTION_CGROUP_NONE, NULL, NULL, msre_action_expirevar_execute ); /* deprecatevar */ msre_engine_action_register(engine, "deprecatevar", ACTION_NON_DISRUPTIVE, 1, 1, NO_PLUS_MINUS, ACTION_CARDINALITY_MANY, ACTION_CGROUP_NONE, NULL, NULL, msre_action_deprecatevar_execute ); /* initcol */ msre_engine_action_register(engine, "initcol", ACTION_NON_DISRUPTIVE, 1, 1, NO_PLUS_MINUS, ACTION_CARDINALITY_MANY, ACTION_CGROUP_NONE, NULL, NULL, msre_action_initcol_execute ); /* setsid */ msre_engine_action_register(engine, "setsid", ACTION_NON_DISRUPTIVE, 1, 1, NO_PLUS_MINUS, ACTION_CARDINALITY_ONE, ACTION_CGROUP_NONE, NULL, NULL, msre_action_setsid_execute ); /* setuid */ msre_engine_action_register(engine, "setrsc", ACTION_NON_DISRUPTIVE, 1, 1, NO_PLUS_MINUS, ACTION_CARDINALITY_ONE, ACTION_CGROUP_NONE, NULL, NULL, msre_action_setrsc_execute ); /* setuid */ msre_engine_action_register(engine, "setuid", ACTION_NON_DISRUPTIVE, 1, 1, NO_PLUS_MINUS, ACTION_CARDINALITY_ONE, ACTION_CGROUP_NONE, NULL, NULL, msre_action_setuid_execute ); /* exec */ msre_engine_action_register(engine, "exec", ACTION_NON_DISRUPTIVE, 1, 1, NO_PLUS_MINUS, ACTION_CARDINALITY_MANY, ACTION_CGROUP_NONE, msre_action_exec_validate, NULL, msre_action_exec_execute ); /* multiMatch */ msre_engine_action_register(engine, "multiMatch", ACTION_NON_DISRUPTIVE, 0, 0, NO_PLUS_MINUS, ACTION_CARDINALITY_ONE, ACTION_CGROUP_NONE, NULL, NULL, NULL ); /* tag */ msre_engine_action_register(engine, "tag", ACTION_METADATA, 1, 1, NO_PLUS_MINUS, ACTION_CARDINALITY_MANY, ACTION_CGROUP_NONE, NULL, NULL, NULL ); /* prepend */ msre_engine_action_register(engine, "prepend", ACTION_NON_DISRUPTIVE, 1, 1, NO_PLUS_MINUS, ACTION_CARDINALITY_ONE, ACTION_CGROUP_NONE, NULL, NULL, msre_action_prepend_execute ); /* append */ msre_engine_action_register(engine, "append", ACTION_NON_DISRUPTIVE, 1, 1, NO_PLUS_MINUS, ACTION_CARDINALITY_ONE, ACTION_CGROUP_NONE, NULL, NULL, msre_action_append_execute ); } modsecurity-apache_2.7.7/apache2/msc_xml.c0000664000175000017500000001044412243422537020753 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #include "msc_xml.h" static xmlParserInputBufferPtr xml_unload_external_entity(const char *URI, xmlCharEncoding enc) { return NULL; } /** * Initialise XML parser. */ int xml_init(modsec_rec *msr, char **error_msg) { xmlParserInputBufferCreateFilenameFunc entity; if (error_msg == NULL) return -1; *error_msg = NULL; msr->xml = apr_pcalloc(msr->mp, sizeof(xml_data)); if (msr->xml == NULL) return -1; if(msr->txcfg->xml_external_entity == 0) { entity = xmlParserInputBufferCreateFilenameDefault(xml_unload_external_entity); } return 1; } #if 0 static void xml_receive_sax_error(void *data, const char *msg, ...) { modsec_rec *msr = (modsec_rec *)data; char message[256]; if (msr == NULL) return; apr_snprintf(message, sizeof(message), "%s (line %d offset %d)", log_escape_nq(msr->mp, msr->xml->parsing_ctx->lastError.message), msr->xml->parsing_ctx->lastError.line, msr->xml->parsing_ctx->lastError.int2); msr_log(msr, 5, "XML: Parsing error: %s", message); } #endif /** * Feed one chunk of data to the XML parser. */ int xml_process_chunk(modsec_rec *msr, const char *buf, unsigned int size, char **error_msg) { if (error_msg == NULL) return -1; *error_msg = NULL; /* We want to initialise our parsing context here, to * enable us to pass it the first chunk of data so that * it can attempt to auto-detect the encoding. */ if (msr->xml->parsing_ctx == NULL) { /* First invocation. */ msr_log(msr, 4, "XML: Initialising parser."); /* NOTE When Sax interface is used libxml will not * create the document object, but we need it. msr->xml->sax_handler = (xmlSAXHandler *)apr_pcalloc(msr->mp, sizeof(xmlSAXHandler)); if (msr->xml->sax_handler == NULL) return -1; msr->xml->sax_handler->error = xml_receive_sax_error; msr->xml->sax_handler->warning = xml_receive_sax_error; msr->xml->parsing_ctx = xmlCreatePushParserCtxt(msr->xml->sax_handler, msr, buf, size, "body.xml"); */ msr->xml->parsing_ctx = xmlCreatePushParserCtxt(NULL, NULL, buf, size, "body.xml"); if (msr->xml->parsing_ctx == NULL) { *error_msg = apr_psprintf(msr->mp, "XML: Failed to create parsing context."); return -1; } } else { /* Not a first invocation. */ xmlParseChunk(msr->xml->parsing_ctx, buf, size, 0); if (msr->xml->parsing_ctx->wellFormed != 1) { *error_msg = apr_psprintf(msr->mp, "XML: Failed parsing document."); return -1; } } return 1; } /** * Finalise XML parsing. */ int xml_complete(modsec_rec *msr, char **error_msg) { if (error_msg == NULL) return -1; *error_msg = NULL; /* Only if we have a context, meaning we've done some work. */ if (msr->xml->parsing_ctx != NULL) { /* This is how we signalise the end of parsing to libxml. */ xmlParseChunk(msr->xml->parsing_ctx, NULL, 0, 1); /* Preserve the results for our reference. */ msr->xml->well_formed = msr->xml->parsing_ctx->wellFormed; msr->xml->doc = msr->xml->parsing_ctx->myDoc; /* Clean up everything else. */ xmlFreeParserCtxt(msr->xml->parsing_ctx); msr->xml->parsing_ctx = NULL; msr_log(msr, 4, "XML: Parsing complete (well_formed %u).", msr->xml->well_formed); if (msr->xml->well_formed != 1) { *error_msg = apr_psprintf(msr->mp, "XML: Failed parsing document."); return -1; } } return 1; } /** * Frees the resources used for XML parsing. */ apr_status_t xml_cleanup(modsec_rec *msr) { if (msr->xml->doc != NULL) { xmlFreeDoc(msr->xml->doc); msr->xml->doc = NULL; } return 1; } modsecurity-apache_2.7.7/apache2/msc_unicode.h0000664000175000017500000000153212243422537021604 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #ifndef _MSC_UNICODE_H_ #define _MSC_UNICODE_H_ typedef struct unicode_map unicode_map; #include #include "modsecurity.h" #include "apr_hash.h" struct unicode_map { apr_file_t *map; const char *mapfn; }; int DSOLOCAL unicode_map_init(directory_config *dcfg, const char *mapfn, char **error_msg); #endif modsecurity-apache_2.7.7/apache2/re.c0000664000175000017500000034475712243422537017740 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #include #include "re.h" #if defined(WITH_LUA) #include "msc_lua.h" #endif static const char *const severities[] = { "EMERGENCY", "ALERT", "CRITICAL", "ERROR", "WARNING", "NOTICE", "INFO", "DEBUG", NULL, }; static int fetch_target_exception(msre_rule *rule, modsec_rec *msr, msre_var *var, const char *exceptions); static apr_status_t msre_parse_targets(msre_ruleset *ruleset, const char *text, apr_array_header_t *arr, char **error_msg); static char *msre_generate_target_string(apr_pool_t *pool, msre_rule *rule); static msre_var *msre_create_var(msre_ruleset *ruleset, const char *name, const char *param, modsec_rec *msr, char **error_msg); static msre_action *msre_create_action(msre_engine *engine, const char *name, const char *param, char **error_msg); static apr_status_t msre_rule_process(msre_rule *rule, modsec_rec *msr); /* -- Actions, variables, functions and operator functions ----------------- */ /** * \brief Remove rule targets to be processed * * \param rule Pointer to the rule * \param msr ModSecurity transaction resource * \param var Pointer to target structure. * \param targets Exception list. */ static int fetch_target_exception(msre_rule *rule, modsec_rec *msr, msre_var *var, const char *exceptions) { const char *targets = NULL; char *savedptr = NULL, *target = NULL; char *c = NULL, *name = NULL, *value = NULL; char *variable = NULL, *myvar = NULL; char *myvalue = NULL, *myname = NULL; int match = 0; if(msr == NULL) return 0; if(var == NULL) return 0; if(rule == NULL) return 0; if(rule->actionset == NULL) return 0; if(rule->actionset->id !=NULL) { myvar = apr_pstrdup(msr->mp, var->name); c = strchr(myvar,':'); if(c != NULL) { myname = apr_strtok(myvar,":",&myvalue); } else { myname = myvar; } match = 0; targets = apr_pstrdup(msr->mp, exceptions); if(targets != NULL) { if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "fetch_target_exception: Found exception target list [%s] for rule id %s", targets, rule->actionset->id); } target = apr_strtok((char *)targets, ",", &savedptr); while(target != NULL) { variable = apr_pstrdup(msr->mp, target); c = strchr(variable,':'); if(c != NULL) { name = apr_strtok(variable,":",&value); } else { name = variable; value = NULL; } if((strlen(myname) == strlen(name)) && (strncasecmp(myname, name,strlen(myname)) == 0)) { if(value != NULL && myvalue != NULL) { if((strlen(myvalue) == strlen(value)) && strncasecmp(myvalue,value,strlen(myvalue)) == 0) { if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "fetch_target_exception: Target %s will not be processed.", target); } match = 1; } } else if (value == NULL && myvalue == NULL) { if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "fetch_target_exception: Target %s will not be processed.", target); } match = 1; } else if (value == NULL && myvalue != NULL) { if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "fetch_target_exception: Target %s will not be processed.", target); } match = 1; } } target = apr_strtok(NULL, ",", &savedptr); } } else { if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "fetch_target_exception: No exception target found for rule id %s.", rule->actionset->id); } } } if(match == 1) return 1; return 0; } /** * \brief Update target for all matching rules in set, in any phase * * \param msr ModSecurity transaction resource * \param ruleset Pointer to set of rules to modify * \param re Pointer to exception object describing which rules to modify * \param p2 Pointer to configuration option TARGET * \param p3 Pointer to configuration option REPLACED_TARGET */ char *msre_ruleset_rule_update_target_matching_exception(modsec_rec *msr, msre_ruleset *ruleset, rule_exception *re, const char *p2, const char *p3) { char *err; if(ruleset == NULL) return NULL; if(p2 == NULL) { return apr_psprintf(ruleset->mp, "Trying to update without a target"); } if (NULL != (err = msre_ruleset_phase_rule_update_target_matching_exception(msr, ruleset, re, ruleset->phase_request_headers, p2, p3))) return err; if (NULL != (err = msre_ruleset_phase_rule_update_target_matching_exception(msr, ruleset, re, ruleset->phase_request_body, p2, p3))) return err; if (NULL != (err = msre_ruleset_phase_rule_update_target_matching_exception(msr, ruleset, re, ruleset->phase_response_headers, p2, p3))) return err; if (NULL != (err = msre_ruleset_phase_rule_update_target_matching_exception(msr, ruleset, re, ruleset->phase_response_body, p2, p3))) return err; if (NULL != (err = msre_ruleset_phase_rule_update_target_matching_exception(msr, ruleset, re, ruleset->phase_logging, p2, p3))) return err; /* Everything worked! */ return NULL; } /** * \brief Update target for all matching rules in set for a specific phase * * \param msr ModSecurity transaction resource * \param ruleset Pointer to set of rules to modify * \param re Pointer to exception object describing which rules to modify * \param phase_arr Pointer to phase that should be edited * \param p2 Pointer to configuration option TARGET * \param p3 Pointer to configuration option REPLACED_TARGET * * \todo Figure out error checking */ char *msre_ruleset_phase_rule_update_target_matching_exception(modsec_rec *msr, msre_ruleset *ruleset, rule_exception *re, apr_array_header_t *phase_arr, const char *p2, const char *p3) { msre_rule **rules; int i, j, mode; char *err; j = 0; mode = 0; rules = (msre_rule **)phase_arr->elts; for (i = 0; i < phase_arr->nelts; i++) { msre_rule *rule = (msre_rule *)rules[i]; if (mode == 0) { /* Looking for next rule. */ if (msre_ruleset_rule_matches_exception(rule, re)) { err = update_rule_target_ex(NULL, ruleset, rule, p2, p3); if (err) return err; if (rule->actionset->is_chained) mode = 2; /* Match all rules in this chain. */ } else { if (rule->actionset->is_chained) mode = 1; /* Skip all rules in this chain. */ } } else { /* Handling rule that is part of a chain. */ if (mode == 2) { /* We want to change the rule. */ err = update_rule_target_ex(msr, ruleset, rule, p2, p3); if (err) return err; } if ((rule->actionset == NULL)||(rule->actionset->is_chained == 0)) mode = 0; } } return NULL; } char *update_rule_target_ex(modsec_rec *msr, msre_ruleset *ruleset, msre_rule *rule, const char *p2, const char *p3) { msre_var **targets = NULL; const char *current_targets = NULL; char *my_error_msg = NULL, *target = NULL; char *p = NULL, *savedptr = NULL; unsigned int is_negated = 0, is_counting = 0; int name_len = 0, value_len = 0; char *name = NULL, *value = NULL; char *opt = NULL, *param = NULL; char *target_list = NULL, *replace = NULL; int i, rc, match = 0, var_appended = 0; if(rule != NULL) { target_list = strdup(p2); if(target_list == NULL) return apr_psprintf(ruleset->mp, "Error to update target - memory allocation");; if(p3 != NULL) { replace = strdup(p3); if(replace == NULL) { free(target_list); target_list = NULL; return apr_psprintf(ruleset->mp, "Error to update target - memory allocation");; } } if(replace != NULL) { opt = strchr(replace,'!'); if(opt != NULL) { *opt = '\0'; opt++; param = opt; is_negated = 1; } else if ((opt = strchr(replace,'&')) != NULL) { *opt = '\0'; opt++; param = opt; is_counting = 1; } else { param = replace; } opt = strchr(param,':'); if(opt != NULL) { name = apr_strtok(param,":",&value); } else { name = param; } if(apr_table_get(ruleset->engine->variables, name) == NULL) { if(target_list != NULL) free(target_list); if(replace != NULL) free(replace); if(msr) { msr_log(msr, 9, "Error to update target - [%s] is not valid target", name); } return apr_psprintf(ruleset->mp, "Error to update target - [%s] is not valid target", name); } name_len = strlen(name); if(value != NULL) value_len = strlen(value); if(msr) { msr_log(msr, 9, "Trying to replace by variable name [%s] value [%s]", name, value); } #if !defined(MSC_TEST) else { ap_log_error(APLOG_MARK, APLOG_INFO, 0, NULL, " ModSecurity: Trying to replace by variable name [%s] value [%s]", name, value); } #endif targets = (msre_var **)rule->targets->elts; // TODO need a good way to remove the element from array, maybe change array by tables or rings for (i = 0; i < rule->targets->nelts; i++) { if((strlen(targets[i]->name) == strlen(name)) && (strncasecmp(targets[i]->name,name,strlen(targets[i]->name)) == 0) && (targets[i]->is_negated == is_negated) && (targets[i]->is_counting == is_counting)) { if(value != NULL && targets[i]->param != NULL) { if((strlen(targets[i]->param) == strlen(value)) && strncasecmp(targets[i]->param,value,strlen(targets[i]->param)) == 0) { memset(targets[i]->name,0,strlen(targets[i]->name)); memset(targets[i]->param,0,strlen(targets[i]->param)); targets[i]->is_counting = 0; targets[i]->is_negated = 1; match = 1; } } else if (value == NULL && targets[i]->param == NULL){ memset(targets[i]->name,0,strlen(targets[i]->name)); targets[i]->is_counting = 0; targets[i]->is_negated = 1; match = 1; } else continue; } } } p = apr_strtok(target_list, ",", &savedptr); while(p != NULL) { if(replace != NULL) { if(match == 1) { rc = msre_parse_targets(ruleset, p, rule->targets, &my_error_msg); if (rc < 0) { if(msr) { msr_log(msr, 9, "Error parsing rule targets to replace variable"); } #if !defined(MSC_TEST) else { ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL, " ModSecurity: Error parsing rule targets to replace variable"); } #endif goto end; } if(msr) { msr_log(msr, 9, "Successfully replaced variable"); } #if !defined(MSC_TEST) else { ap_log_error(APLOG_MARK, APLOG_INFO, 0, NULL, " ModSecurity: Successfully replaced variable"); } #endif var_appended = 1; } else { if(msr) { msr_log(msr, 9, "Cannot find variable to replace"); } #if !defined(MSC_TEST) else { ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL, " ModSecurity: Cannot find varibale to replace"); } #endif goto end; } } else { target = strdup(p); if(target == NULL) return NULL; is_negated = is_counting = 0; param = name = value = NULL; opt = strchr(target,'!'); if(opt != NULL) { *opt = '\0'; opt++; param = opt; is_negated = 1; } else if ((opt = strchr(target,'&')) != NULL) { *opt = '\0'; opt++; param = opt; is_counting = 1; } else { param = target; } opt = strchr(param,':'); if(opt != NULL) { name = apr_strtok(param,":",&value); } else { name = param; } if(apr_table_get(ruleset->engine->variables, name) == NULL) { if(target_list != NULL) free(target_list); if(replace != NULL) free(replace); if(msr) { msr_log(msr, 9, "Error to update target - [%s] is not valid target", name); } return apr_psprintf(ruleset->mp, "Error to update target - [%s] is not valid target", name); } name_len = strlen(name); if(value != NULL) value_len = strlen(value); if(msr) { msr_log(msr, 9, "Trying to append variable name [%s] value [%s]", name, value); } #if !defined(MSC_TEST) else { ap_log_error(APLOG_MARK, APLOG_INFO, 0, NULL, " ModSecurity: Trying to append variable name [%s] value [%s]", name, value); } #endif match = 0; targets = (msre_var **)rule->targets->elts; for (i = 0; i < rule->targets->nelts; i++) { if((strlen(targets[i]->name) == strlen(name)) && (strncasecmp(targets[i]->name,name,strlen(targets[i]->name)) == 0) && (targets[i]->is_negated == is_negated) && (targets[i]->is_counting == is_counting)) { if(value != NULL && targets[i]->param != NULL) { if((strlen(targets[i]->param) == strlen(value)) && strncasecmp(targets[i]->param,value,strlen(targets[i]->param)) == 0) { match = 1; } } else if (value == NULL && targets[i]->param == NULL){ match = 1; } else continue; } } if(target != NULL) { free(target); target = NULL; } if(match == 0 ) { rc = msre_parse_targets(ruleset, p, rule->targets, &my_error_msg); if (rc < 0) { if(msr) { msr_log(msr, 9, "Error parsing rule targets to append variable"); } #if !defined(MSC_TEST) else { ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL, " ModSecurity: Error parsing rule targets to append variable"); } #endif goto end; } var_appended = 1; } else { if(msr) { msr_log(msr, 9, "Skipping variable, already appended"); } #if !defined(MSC_TEST) else { ap_log_error(APLOG_MARK, APLOG_INFO, 0, NULL, " ModSecurity: Skipping variable, already appended"); } #endif } } p = apr_strtok(NULL,",",&savedptr); } if(var_appended == 1) { current_targets = msre_generate_target_string(ruleset->mp, rule); rule->unparsed = msre_rule_generate_unparsed(ruleset->mp, rule, current_targets, NULL, NULL); rule->p1 = apr_pstrdup(ruleset->mp, current_targets); if(msr) { msr_log(msr, 9, "Successfully appended variable"); } #if !defined(MSC_TEST) else { ap_log_error(APLOG_MARK, APLOG_INFO, 0, NULL, " ModSecurity: Successfully appended variable"); } #endif } } end: if(target_list != NULL) { free(target_list); target_list = NULL; } if(replace != NULL) { free(replace); replace = NULL; } if(target != NULL) { free(target); target = NULL; } return NULL; } int msre_ruleset_rule_matches_exception(msre_rule *rule, rule_exception *re) { int match = 0; /* Only remove non-placeholder rules */ if (rule->placeholder == RULE_PH_NONE) { switch(re->type) { case RULE_EXCEPTION_REMOVE_ID : if ((rule->actionset != NULL)&&(rule->actionset->id != NULL)) { int ruleid = atoi(rule->actionset->id); if (rule_id_in_range(ruleid, re->param)) { match = 1; } } break; case RULE_EXCEPTION_REMOVE_MSG : if ((rule->actionset != NULL)&&(rule->actionset->msg != NULL)) { char *my_error_msg = NULL; int rc = msc_regexec(re->param_data, rule->actionset->msg, strlen(rule->actionset->msg), &my_error_msg); if (rc >= 0) { match = 1; } } break; case RULE_EXCEPTION_REMOVE_TAG : if ((rule->actionset != NULL)&&(apr_is_empty_table(rule->actionset->actions) == 0)) { char *my_error_msg = NULL; const apr_array_header_t *tarr = NULL; const apr_table_entry_t *telts = NULL; int act; tarr = apr_table_elts(rule->actionset->actions); telts = (const apr_table_entry_t*)tarr->elts; for (act = 0; act < tarr->nelts; act++) { msre_action *action = (msre_action *)telts[act].val; if((action != NULL) && (action->metadata != NULL) && (strcmp("tag", action->metadata->name) == 0)) { int rc = msc_regexec(re->param_data, action->param, strlen(action->param), &my_error_msg); if (rc >= 0) { match = 1; } } } } break; } } return match; } /** * Remove actions with the same cardinality group from the actionset. */ static void msre_actionset_cardinality_fixup(msre_actionset *actionset, msre_action *action) { const apr_array_header_t *tarr = NULL; const apr_table_entry_t *telts = NULL; int i; if ((actionset == NULL) || (action == NULL)) return; tarr = apr_table_elts(actionset->actions); telts = (const apr_table_entry_t*)tarr->elts; for (i = 0; i < tarr->nelts; i++) { msre_action *target = (msre_action *)telts[i].val; if (target->metadata->cardinality_group == action->metadata->cardinality_group) { apr_table_unset(actionset->actions, target->metadata->name); } } } static char *msre_generate_target_string(apr_pool_t *pool, msre_rule *rule) { char *target_str = NULL; msre_var **targets = NULL; int i = 0; targets = (msre_var **)rule->targets->elts; for (i = 0; i < rule->targets->nelts; i++) { if(targets[i]->name != NULL && strlen(targets[i]->name) > 0) { target_str = apr_pstrcat(pool, (target_str == NULL) ? "" : apr_psprintf(pool, "%s|", target_str), (targets[i]->is_negated == 0) ? "" : "!", (targets[i]->is_counting == 0) ? "" : "&", (targets[i]->name == NULL) ? "" : targets[i]->name, (targets[i]->param == NULL) ? "" : apr_psprintf(pool, ":%s", targets[i]->param), NULL); } } return target_str; } /** * Generate an action string from an actionset. */ static char *msre_actionset_generate_action_string(apr_pool_t *pool, const msre_actionset *actionset) { const apr_array_header_t *tarr = NULL; const apr_table_entry_t *telts = NULL; char *actions = NULL; int chain; int i; if (actionset == NULL) return NULL; chain = ((actionset->rule != NOT_SET_P) && actionset->rule->chain_starter) ? 1 : 0; tarr = apr_table_elts(actionset->actions); telts = (const apr_table_entry_t*)tarr->elts; for (i = 0; i < tarr->nelts; i++) { msre_action *action = (msre_action *)telts[i].val; int use_quotes = 0; if (chain) { /* Skip some actions that are not used in a chain. */ if ( (action->metadata->type == ACTION_DISRUPTIVE) || (action->metadata->type == ACTION_METADATA) || (strcmp("log", action->metadata->name) == 0) || (strcmp("auditlog", action->metadata->name) == 0) || (strcmp("nolog", action->metadata->name) == 0) || (strcmp("noauditlog", action->metadata->name) == 0) || (strcmp("severity", action->metadata->name) == 0) || (strcmp("ver", action->metadata->name) == 0) || (strcmp("maturity", action->metadata->name) == 0) || (strcmp("accuracy", action->metadata->name) == 0) || (strcmp("tag", action->metadata->name) == 0) || (strcmp("phase", action->metadata->name) == 0)) { continue; } } /* Check if we need any quotes */ if (action->param != NULL) { int j; for(j = 0; action->param[j] != '\0'; j++) { if (isspace(action->param[j])) { use_quotes = 1; break; } } if (j == 0) use_quotes = 1; } actions = apr_pstrcat(pool, (actions == NULL) ? "" : actions, (actions == NULL) ? "" : ",", action->metadata->name, (action->param == NULL) ? "" : ":", (use_quotes) ? "'" : "", (action->param == NULL) ? "" : action->param, (use_quotes) ? "'" : "", NULL); } return actions; } /** * Add an action to an actionset. */ static void msre_actionset_action_add(msre_actionset *actionset, msre_action *action) { msre_action *add_action = action; if ((actionset == NULL)) return; /** * The "block" action is just a placeholder for the parent action. */ if ((actionset->parent_intercept_action_rec != NULL) && (actionset->parent_intercept_action_rec != NOT_SET_P) && (strcmp("block", action->metadata->name) == 0) && (strcmp("block", action->metadata->name) == 0)) { /* revert back to parent */ actionset->intercept_action = actionset->parent_intercept_action; add_action = actionset->parent_intercept_action_rec; } if ((add_action == NULL)) return; if (add_action->metadata->cardinality_group != ACTION_CGROUP_NONE) { msre_actionset_cardinality_fixup(actionset, add_action); } if (add_action->metadata->cardinality == ACTION_CARDINALITY_ONE) { /* One action per actionlist. */ apr_table_setn(actionset->actions, add_action->metadata->name, (void *)add_action); } else { /* Multiple actions per actionlist. */ apr_table_addn(actionset->actions, add_action->metadata->name, (void *)add_action); } } /** * Creates msre_var instances (rule variables) out of the * given text string and places them into the supplied table. */ static apr_status_t msre_parse_targets(msre_ruleset *ruleset, const char *text, apr_array_header_t *arr, char **error_msg) { const apr_array_header_t *tarr; const apr_table_entry_t *telts; apr_table_t *vartable; unsigned int count = 0; apr_status_t rc; msre_var *var; int i; if (text == NULL) return -1; /* Extract name & value pairs first */ vartable = apr_table_make(ruleset->mp, 10); if (vartable == NULL) return -1; rc = msre_parse_generic(ruleset->mp, text, vartable, error_msg); if (rc < 0) return rc; /* Loop through the table and create variables */ tarr = apr_table_elts(vartable); telts = (const apr_table_entry_t*)tarr->elts; for (i = 0; i < tarr->nelts; i++) { var = msre_create_var(ruleset, telts[i].key, telts[i].val, NULL, error_msg); if (var == NULL) return -1; *(msre_var **)apr_array_push(arr) = var; count++; } return count; } /** * Creates msre_action instances by parsing the given string, placing * them into the supplied array. */ static apr_status_t msre_parse_actions(msre_engine *engine, msre_actionset *actionset, const char *text, char **error_msg) { const apr_array_header_t *tarr; const apr_table_entry_t *telts; apr_table_t *vartable; unsigned int count = 0; apr_status_t rc; msre_action *action; int i; if (text == NULL) return -1; /* Extract name & value pairs first */ vartable = apr_table_make(engine->mp, 10); if (vartable == NULL) return -1; rc = msre_parse_generic(engine->mp, text, vartable, error_msg); if (rc < 0) return rc; /* Loop through the table and create actions */ tarr = apr_table_elts(vartable); telts = (const apr_table_entry_t*)tarr->elts; for (i = 0; i < tarr->nelts; i++) { /* Create action. */ action = msre_create_action(engine, telts[i].key, telts[i].val, error_msg); if (action == NULL) return -1; /* Initialise action (option). */ if (action->metadata->init != NULL) { action->metadata->init(engine, actionset, action); } msre_actionset_action_add(actionset, action); count++; } return count; } /** * Locates variable metadata given the variable name. */ msre_var_metadata *msre_resolve_var(msre_engine *engine, const char *name) { return (msre_var_metadata *)apr_table_get(engine->variables, name); } /** * Locates action metadata given the action name. */ static msre_action_metadata *msre_resolve_action(msre_engine *engine, const char *name) { return (msre_action_metadata *)apr_table_get(engine->actions, name); } /** * Creates a new variable instance given the variable name * and an (optional) parameter. */ msre_var *msre_create_var_ex(apr_pool_t *pool, msre_engine *engine, const char *name, const char *param, modsec_rec *msr, char **error_msg) { const char *varparam = param; msre_var *var = apr_pcalloc(pool, sizeof(msre_var)); if (var == NULL) return NULL; if (error_msg == NULL) return NULL; *error_msg = NULL; /* Handle negation and member counting */ if (name[0] == '!') { var->is_negated = 1; var->name = (char *)name + 1; } else if (name[0] == '&') { var->is_counting = 1; var->name = (char *)name + 1; } else { var->name = (char *)name; } /* Treat HTTP_* targets as an alias for REQUEST_HEADERS:* */ if ( (var->name != NULL) && (strlen(var->name) > 5) && (strncmp("HTTP_", var->name, 5) == 0)) { const char *oldname = var->name; var->name = apr_pstrdup(pool, "REQUEST_HEADERS"); varparam = apr_pstrdup(pool, oldname + 5); } /* Resolve variable */ var->metadata = msre_resolve_var(engine, var->name); if (var->metadata == NULL) { *error_msg = apr_psprintf(engine->mp, "Unknown variable: %s", name); return NULL; } /* The counting operator "&" can only be used against collections. */ if (var->is_counting) { if (var->metadata->type == VAR_SIMPLE) { *error_msg = apr_psprintf(engine->mp, "The & modificator does not apply to " "non-collection variables."); return NULL; } } /* Check the parameter. */ if (varparam == NULL) { if (var->metadata->argc_min > 0) { *error_msg = apr_psprintf(engine->mp, "Missing mandatory parameter for variable %s.", name); return NULL; } } else { /* Parameter present */ /* Do we allow a parameter? */ if (var->metadata->argc_max == 0) { *error_msg = apr_psprintf(engine->mp, "Variable %s does not support parameters.", name); return NULL; } var->param = (char *)varparam; } return var; } /** * Create a new variable object from the provided name and value. * * NOTE: this allocates out of the global pool and should not be used * per-request */ static msre_var *msre_create_var(msre_ruleset *ruleset, const char *name, const char *param, modsec_rec *msr, char **error_msg) { msre_var *var = msre_create_var_ex(ruleset->engine->mp, ruleset->engine, name, param, msr, error_msg); if (var == NULL) return NULL; /* Validate & initialise variable */ if (var->metadata->validate != NULL) { *error_msg = var->metadata->validate(ruleset, var); if (*error_msg != NULL) { return NULL; } } return var; } /** * Creates a new action instance given its name and an (optional) parameter. */ msre_action *msre_create_action(msre_engine *engine, const char *name, const char *param, char **error_msg) { msre_action *action = apr_pcalloc(engine->mp, sizeof(msre_action)); if (action == NULL) return NULL; if (error_msg == NULL) return NULL; *error_msg = NULL; /* Resolve action */ action->metadata = msre_resolve_action(engine, name); if (action->metadata == NULL) { *error_msg = apr_psprintf(engine->mp, "Unknown action: %s", name); return NULL; } if (param == NULL) { /* Parameter not present */ if (action->metadata->argc_min > 0) { *error_msg = apr_psprintf(engine->mp, "Missing mandatory parameter for action %s", name); return NULL; } } else { /* Parameter present */ /* Should we allow the parameter? */ if (action->metadata->argc_max == 0) { *error_msg = apr_psprintf(engine->mp, "Extra parameter provided to action %s", name); return NULL; } /* Handle +/- modificators */ if ((param[0] == '+')||(param[0] == '-')) { if (action->metadata->allow_param_plusminus == 0) { *error_msg = apr_psprintf(engine->mp, "Action %s does not allow +/- modificators.", name); return NULL; } else { /* Modificators allowed. */ if (param[0] == '+') { action->param = param + 1; action->param_plusminus = POSITIVE_VALUE; } else if (param[0] == '-') { action->param = param + 1; action->param_plusminus = NEGATIVE_VALUE; } } } else { action->param = param; } /* Validate parameter */ if (action->metadata->validate != NULL) { *error_msg = action->metadata->validate(engine, action); if (*error_msg != NULL) return NULL; } } return action; } /** * Generic parser that is used as basis for target and action parsing. * It breaks up the input string into name-parameter pairs and places * them into the given table. */ int msre_parse_generic(apr_pool_t *mp, const char *text, apr_table_t *vartable, char **error_msg) { char *p = (char *)text; int count = 0; if (error_msg == NULL) return -1; *error_msg = NULL; count = 0; while(*p != '\0') { char *name = NULL, *value = NULL; /* ignore whitespace */ while(isspace(*p)) p++; if (*p == '\0') return count; /* we are at the beginning of the name */ name = p; while((*p != '\0')&&(*p != '|')&&(*p != ':')&&(*p != ',')&&(!isspace(*p))) p++; /* ENH replace with isvarnamechar() */ /* get the name */ name = apr_pstrmemdup(mp, name, p - name); if (*p != ':') { /* we don't have a parameter */ /* add to the table with no value */ apr_table_addn(vartable, name, NULL); count++; /* go over any whitespace present */ while(isspace(*p)) p++; /* we're done */ if (*p == '\0') { return count; } /* skip over the separator character and continue */ if ((*p == ',')||(*p == '|')) { p++; continue; } *error_msg = apr_psprintf(mp, "Unexpected character at position %d: %s", (int)(p - text), text); return -1; } /* we have a parameter */ p++; /* move over the colon */ /* we'll allow empty values */ if (*p == '\0') { apr_table_addn(vartable, name, NULL); count++; return count; } if ((*p == ',')||(*p == '|')) { apr_table_addn(vartable, name, NULL); count++; /* move over the separator char and continue */ p++; continue; } /* we really have a parameter */ if (*p == '\'') { /* quoted value */ char *d = NULL; p++; /* go over the openning quote */ value = d = strdup(p); if (d == NULL) return -1; for(;;) { if (*p == '\0') { *error_msg = apr_psprintf(mp, "Missing closing quote at position %d: %s", (int)(p - text), text); free(value); return -1; } else if (*p == '\\') { if ( (*(p + 1) == '\0') || ((*(p + 1) != '\'')&&(*(p + 1) != '\\')) ) { *error_msg = apr_psprintf(mp, "Invalid quoted pair at position %d: %s", (int)(p - text), text); free(value); return -1; } p++; *(d++) = *(p++); } else if (*p == '\'') { *d = '\0'; p++; break; } else { *(d++) = *(p++); } } d = value; value = apr_pstrdup(mp, d); free(d); } else { /* non-quoted value */ value = p; while((*p != '\0')&&(*p != ',')&&(*p != '|')&&(!isspace(*p))) p++; value = apr_pstrmemdup(mp, value, p - value); } /* add to table */ apr_table_addn(vartable, name, value); count++; /* move to the first character of the next name-value pair */ while(isspace(*p)||(*p == ',')||(*p == '|')) p++; } return count; } /* -- Actionset functions -------------------------------------------------- */ /** * Creates an actionset instance and (as an option) populates it by * parsing the given string which contains a list of actions. */ msre_actionset *msre_actionset_create(msre_engine *engine, const char *text, char **error_msg) { msre_actionset *actionset = (msre_actionset *)apr_pcalloc(engine->mp, sizeof(msre_actionset)); if (actionset == NULL) return NULL; actionset->actions = apr_table_make(engine->mp, 25); if (actionset->actions == NULL) return NULL; /* Metadata */ actionset->id = NOT_SET_P; actionset->rev = NOT_SET_P; actionset->msg = NOT_SET_P; actionset->version = NOT_SET_P; actionset->logdata = NOT_SET_P; actionset->phase = NOT_SET; actionset->severity = -1; actionset->accuracy = -1; actionset->maturity = -1; actionset->rule = NOT_SET_P; actionset->arg_max = -1; actionset->arg_min = -1; /* Flow */ actionset->is_chained = NOT_SET; actionset->skip_count = NOT_SET; actionset->skip_after = NOT_SET_P; /* Disruptive */ actionset->parent_intercept_action_rec = NOT_SET_P; actionset->intercept_action_rec = NOT_SET_P; actionset->parent_intercept_action = NOT_SET; actionset->intercept_action = NOT_SET; actionset->intercept_uri = NOT_SET_P; actionset->intercept_status = NOT_SET; actionset->intercept_pause = NOT_SET_P; /* Other */ actionset->auditlog = NOT_SET; actionset->log = NOT_SET; /* Parse the list of actions, if it's present */ if (text != NULL) { if (msre_parse_actions(engine, actionset, text, error_msg) < 0) { return NULL; } } return actionset; } /** * Create a (shallow) copy of the supplied actionset. */ static msre_actionset *msre_actionset_copy(apr_pool_t *mp, msre_actionset *orig) { msre_actionset *copy = NULL; if (orig == NULL) return NULL; copy = (msre_actionset *)apr_pmemdup(mp, orig, sizeof(msre_actionset)); if (copy == NULL) return NULL; copy->actions = apr_table_copy(mp, orig->actions); return copy; } /** * Merges two actionsets into one. */ msre_actionset *msre_actionset_merge(msre_engine *engine, msre_actionset *parent, msre_actionset *child, int inherit_by_default) { msre_actionset *merged = NULL; const apr_array_header_t *tarr; const apr_table_entry_t *telts; int i; if (inherit_by_default == 0) { /* There is nothing to merge in this case. */ return msre_actionset_copy(engine->mp, child); } /* Start with a copy of the parent configuration. */ merged = msre_actionset_copy(engine->mp, parent); if (merged == NULL) return NULL; if (child == NULL) { /* The child actionset does not exist, hence * go with the parent one. */ return merged; } /* First merge the hard-coded stuff. */ /* Metadata */ if (child->id != NOT_SET_P) merged->id = child->id; if (child->rev != NOT_SET_P) merged->rev = child->rev; if (child->msg != NOT_SET_P) merged->msg = child->msg; if (child->version != NOT_SET_P) merged->version = child->version; if (child->logdata != NOT_SET_P) merged->logdata = child->logdata; if (child->severity != NOT_SET) merged->severity = child->severity; if (child->accuracy != NOT_SET) merged->accuracy = child->accuracy; if (child->maturity != NOT_SET) merged->maturity = child->maturity; if (child->phase != NOT_SET) merged->phase = child->phase; if (child->rule != NOT_SET_P) merged->rule = child->rule; if (child->arg_min != NOT_SET) merged->arg_min = child->arg_min; if (child->arg_max != NOT_SET) merged->arg_max = child->arg_max; /* Flow */ merged->is_chained = child->is_chained; if (child->skip_count != NOT_SET) merged->skip_count = child->skip_count; if (child->skip_after != NOT_SET_P) merged->skip_after = child->skip_after; /* Disruptive */ if (child->intercept_action != NOT_SET) { merged->intercept_action_rec = child->intercept_action_rec; merged->intercept_action = child->intercept_action; merged->intercept_uri = child->intercept_uri; } if (child->intercept_status != NOT_SET) merged->intercept_status = child->intercept_status; if (child->intercept_pause != NOT_SET_P) merged->intercept_pause = child->intercept_pause; /* Other */ if (child->auditlog != NOT_SET) merged->auditlog = child->auditlog; if (child->log != NOT_SET) merged->log = child->log; /* Now merge the actions. */ tarr = apr_table_elts(child->actions); telts = (const apr_table_entry_t*)tarr->elts; for (i = 0; i < tarr->nelts; i++) { msre_actionset_action_add(merged, (msre_action *)telts[i].val); } return merged; } /** * Creates an actionset that contains a default list of actions. */ msre_actionset *msre_actionset_create_default(msre_engine *engine) { char *my_error_msg = NULL; return msre_actionset_create(engine, "phase:2,log,auditlog,pass", &my_error_msg); } /** * Sets the default values for the hard-coded actionset configuration. */ void msre_actionset_set_defaults(msre_actionset *actionset) { /* Metadata */ if (actionset->id == NOT_SET_P) actionset->id = NULL; if (actionset->rev == NOT_SET_P) actionset->rev = NULL; if (actionset->msg == NOT_SET_P) actionset->msg = NULL; if (actionset->version == NOT_SET_P) actionset->version = NULL; if (actionset->logdata == NOT_SET_P) actionset->logdata = NULL; if (actionset->phase == NOT_SET) actionset->phase = 2; if (actionset->severity == -1) {} /* leave at -1 */ if (actionset->accuracy == -1) {} /* leave at -1 */ if (actionset->maturity == -1) {} /* leave at -1 */ if (actionset->rule == NOT_SET_P) actionset->rule = NULL; if (actionset->arg_max == NOT_SET) actionset->arg_max = -1; if (actionset->arg_min == NOT_SET) actionset->arg_min = -1; /* Flow */ if (actionset->is_chained == NOT_SET) actionset->is_chained = 0; if (actionset->skip_count == NOT_SET) actionset->skip_count = 0; if (actionset->skip_after == NOT_SET_P) actionset->skip_after = NULL; /* Disruptive */ if (actionset->parent_intercept_action_rec == NOT_SET_P) actionset->parent_intercept_action_rec = NULL; if (actionset->intercept_action_rec == NOT_SET_P) actionset->intercept_action_rec = NULL; if (actionset->parent_intercept_action == NOT_SET) actionset->parent_intercept_action = ACTION_NONE; if (actionset->intercept_action == NOT_SET) actionset->intercept_action = ACTION_NONE; if (actionset->intercept_uri == NOT_SET_P) actionset->intercept_uri = NULL; if (actionset->intercept_status == NOT_SET) actionset->intercept_status = 403; if (actionset->intercept_pause == NOT_SET_P) actionset->intercept_pause = NULL; /* Other */ if (actionset->auditlog == NOT_SET) actionset->auditlog = 1; if (actionset->log == NOT_SET) actionset->log = 1; } /* -- Engine functions ----------------------------------------------------- */ /** * Creates a new engine instance. */ msre_engine *msre_engine_create(apr_pool_t *parent_pool) { msre_engine *engine; apr_pool_t *mp; /* Create new memory pool */ if (apr_pool_create(&mp, parent_pool) != APR_SUCCESS) return NULL; /* Init fields */ engine = apr_pcalloc(mp, sizeof(msre_engine)); if (engine == NULL) return NULL; engine->mp = mp; engine->tfns = apr_table_make(mp, 50); if (engine->tfns == NULL) return NULL; engine->operators = apr_table_make(mp, 25); if (engine->operators == NULL) return NULL; engine->variables = apr_table_make(mp, 100); if (engine->variables == NULL) return NULL; engine->actions = apr_table_make(mp, 50); if (engine->actions == NULL) return NULL; engine->reqbody_processors = apr_table_make(mp, 10); if (engine->reqbody_processors == NULL) return NULL; return engine; } /* -- Recipe functions ----------------------------------------------------- */ #define NEXT_CHAIN 1 #define NEXT_RULE 2 #define SKIP_RULES 3 /** * Default implementation of the ruleset phase processing; it processes * the rules in the ruleset attached to the currently active * transaction phase. */ #if defined(PERFORMANCE_MEASUREMENT) #define PERFORMANCE_MEASUREMENT_LOOP 5000 static apr_status_t msre_ruleset_process_phase_(msre_ruleset *ruleset, modsec_rec *msr); apr_status_t msre_ruleset_process_phase(msre_ruleset *ruleset, modsec_rec *msr) { apr_array_header_t *arr = NULL; msre_rule **rules = NULL; apr_status_t rc; int i; switch (msr->phase) { case PHASE_REQUEST_HEADERS : arr = ruleset->phase_request_headers; break; case PHASE_REQUEST_BODY : arr = ruleset->phase_request_body; break; case PHASE_RESPONSE_HEADERS : arr = ruleset->phase_response_headers; break; case PHASE_RESPONSE_BODY : arr = ruleset->phase_response_body; break; case PHASE_LOGGING : arr = ruleset->phase_logging; break; default : msr_log(msr, 1, "Internal Error: Invalid phase %d", msr->phase); return -1; } rules = (msre_rule **)arr->elts; for (i = 0; i < arr->nelts; i++) { msre_rule *rule = rules[i]; rule->execution_time = 0; } for (i = 0; i < PERFORMANCE_MEASUREMENT_LOOP; i++) { rc = msre_ruleset_process_phase_(ruleset, msr); } msr_log(msr, 1, "Phase %d", msr->phase); rules = (msre_rule **)arr->elts; for (i = 0; i < arr->nelts; i++) { msre_rule *rule = rules[i]; /* Ignore markers, which are never processed. */ if (rule->placeholder == RULE_PH_MARKER) continue; msr_log(msr, 1, "Rule %pp [id \"%s\"][file \"%s\"][line \"%d\"]: %u usec", rule, ((rule->actionset != NULL)&&(rule->actionset->id != NULL)) ? rule->actionset->id : "-", rule->filename != NULL ? rule->filename : "-", rule->line_num, (rule->execution_time / PERFORMANCE_MEASUREMENT_LOOP)); } return rc; } static apr_status_t msre_ruleset_process_phase_(msre_ruleset *ruleset, modsec_rec *msr) { #else apr_status_t msre_ruleset_process_phase(msre_ruleset *ruleset, modsec_rec *msr) { #endif apr_array_header_t *arr = NULL; msre_rule **rules; apr_status_t rc; const char *skip_after = NULL; msre_rule *last_rule = NULL; msre_rule *rule_starter = NULL; int i, mode, skip, skipped, saw_starter; /* First determine which set of rules we need to use. */ switch (msr->phase) { case PHASE_REQUEST_HEADERS : arr = ruleset->phase_request_headers; break; case PHASE_REQUEST_BODY : arr = ruleset->phase_request_body; break; case PHASE_RESPONSE_HEADERS : arr = ruleset->phase_response_headers; break; case PHASE_RESPONSE_BODY : arr = ruleset->phase_response_body; break; case PHASE_LOGGING : arr = ruleset->phase_logging; break; default : msr_log(msr, 1, "Internal Error: Invalid phase %d", msr->phase); return -1; } if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "This phase consists of %d rule(s).", arr->nelts); } apr_table_clear(msr->matched_vars); /* Loop through the rules in the selected set. */ skip = 0; skipped = 0; saw_starter = 0; mode = NEXT_RULE; rules = (msre_rule **)arr->elts; for (i = 0; i < arr->nelts; i++) { msre_rule *rule = rules[i]; #if defined(PERFORMANCE_MEASUREMENT) apr_time_t time1 = 0; #endif /* Reset the rule interception flag */ msr->rule_was_intercepted = 0; /* SKIP_RULES is used to skip all rules until we hit a placeholder * with the specified rule ID and then resume execution after that. */ if (mode == SKIP_RULES) { /* Go to the next rule if we have not yet hit the skip_after ID */ if ((rule->placeholder == RULE_PH_NONE) || (rule->actionset->id == NULL) || (strcmp(skip_after, rule->actionset->id) != 0)) { if(i-1 >=0) last_rule = rules[i-1]; else last_rule = rules[0]; if((last_rule != NULL) && (last_rule->actionset != NULL) && last_rule->actionset->is_chained && (saw_starter == 1)) { mode = NEXT_RULE; skipped = 1; --i; } else { mode = SKIP_RULES; skipped = 0; saw_starter = 0; if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Current rule is id=\"%s\" [chained %d] is trying to find the SecMarker=\"%s\" [stater %d]",rule->actionset->id,last_rule->actionset->is_chained,skip_after,saw_starter); } } continue; } if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Found rule %pp id=\"%s\".", rule, skip_after); } /* Go to the rule *after* this one to continue execution. */ if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Continuing execution after rule id=\"%s\".", skip_after); } saw_starter = 0; skipped = 0; skip_after = NULL; mode = NEXT_RULE; apr_table_clear(msr->matched_vars); continue; } /* Skip any rule marked as a placeholder */ if (rule->placeholder != RULE_PH_NONE) { continue; } /* NEXT_CHAIN is used when one of the rules in a chain * fails to match and then we need to skip the remaining * rules in that chain in order to get to the next * rule that can execute. */ if (mode == NEXT_CHAIN) { if (rule->actionset->is_chained == 0) { mode = NEXT_RULE; } /* Go to the next rule. */ apr_table_clear(msr->matched_vars); continue; } /* If we are here that means the mode is NEXT_RULE, which * then means we have done processing any chains. However, * if the "skip" parameter is set we need to skip over. */ if ((mode == NEXT_RULE)&&(skip > 0)) { /* Decrement the skip counter by one. */ skip--; /* If the current rule is part of a chain then * we need to skip over the entire chain. Thus * we change the mode to NEXT_CHAIN. The skip * counter will not decrement as we are moving * over the rules belonging to the chain. */ if (rule->actionset->is_chained) { mode = NEXT_CHAIN; } /* Go to the next rule. */ apr_table_clear(msr->matched_vars); continue; } /* Check if this rule was removed at runtime */ if (((rule->actionset->id !=NULL) && !apr_is_empty_array(msr->removed_rules)) || (apr_is_empty_array(msr->removed_rules_tag)==0) || (apr_is_empty_array(msr->removed_rules_msg)==0)) { int j, act, rc; int do_process = 1; const char *range = NULL; rule_exception *re = NULL; char *my_error_msg; const apr_array_header_t *tag_tarr = NULL; const apr_table_entry_t *tag_telts = NULL; for(j = 0; j < msr->removed_rules_msg->nelts; j++) { re = ((rule_exception **)msr->removed_rules_msg->elts)[j]; if(rule->actionset->msg !=NULL) { if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Checking removal of rule msg=\"%s\" against: %s", rule->actionset->msg, re->param); } rc = msc_regexec(re->param_data, rule->actionset->msg, strlen(rule->actionset->msg), &my_error_msg); if (rc >= 0) { do_process = 0; break; } } } for(j = 0; j < msr->removed_rules->nelts; j++) { range = ((const char**)msr->removed_rules->elts)[j]; if(rule->actionset->id !=NULL) { if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Checking removal of rule id=\"%s\" against: %s", rule->actionset->id, range); } if (rule_id_in_range(atoi(rule->actionset->id), range)) { do_process = 0; break; } } } tag_tarr = apr_table_elts(rule->actionset->actions); tag_telts = (const apr_table_entry_t*)tag_tarr->elts; for (act = 0; act < tag_tarr->nelts; act++) { msre_action *action = (msre_action *)tag_telts[act].val; if((action != NULL) && (action->metadata != NULL ) && strcmp("tag", action->metadata->name) == 0) { for(j = 0; j < msr->removed_rules_tag->nelts; j++) { re = ((rule_exception **)msr->removed_rules_tag->elts)[j]; if(action->param != NULL) { /* Expand variables in the tag argument. */ msc_string *var = (msc_string *)apr_pcalloc(msr->mp, sizeof(msc_string)); var->value = (char *)action->param; var->value_len = strlen(action->param); expand_macros(msr, var, NULL, msr->mp); if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Checking removal of rule tag=\"%s\" against: %s", var->value, re->param); } rc = msc_regexec(re->param_data, var->value, strlen(var->value), &my_error_msg); if (rc >= 0) { do_process = 0; break; } } } } } /* Go to the next rule if this one has been removed. */ if (do_process == 0) { if (msr->txcfg->debuglog_level >= 5) { msr_log(msr, 5, "Not processing %srule id=\"%s\": " "removed by ctl action", rule->actionset->is_chained ? "chained " : "", rule->actionset->id); } /* Skip the whole chain, if this is a chained rule */ if (rule->actionset->is_chained) { mode = NEXT_CHAIN; } skipped = 0; saw_starter = 0; apr_table_clear(msr->matched_vars); continue; } } if(msr->txcfg->is_enabled == MODSEC_DISABLED) { saw_starter = 0; skipped = 0; skip_after = NULL; mode = NEXT_RULE; apr_table_clear(msr->matched_vars); continue; } if (msr->txcfg->debuglog_level >= 4) { apr_pool_t *p = msr->mp; const char *fn = NULL; const char *id = NULL; const char *rev = NULL; if (rule->filename != NULL) { fn = apr_psprintf(p, " [file \"%s\"] [line \"%d\"]", rule->filename, rule->line_num); } if (rule->actionset != NULL && rule->actionset->id != NULL) { id = apr_psprintf(p, " [id \"%s\"]", rule->actionset->id); } if (rule->actionset != NULL && rule->actionset->rev != NULL) { rev = apr_psprintf(p, " [rev \"%s\"]", rule->actionset->rev); } msr_log(msr, 4, "Recipe: Invoking rule %pp;%s%s%s.", rule, (fn ? fn : ""), (id ? id : ""), (rev ? rev : "")); msr_log(msr, 5, "Rule %pp: %s", rule, rule->unparsed); } #if defined(PERFORMANCE_MEASUREMENT) time1 = apr_time_now(); #endif rc = msre_rule_process(rule, msr); #if defined(PERFORMANCE_MEASUREMENT) rule->execution_time += (apr_time_now() - time1); #endif if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Rule returned %d.", rc); } if (rc == RULE_NO_MATCH) { if (rule->actionset->is_chained) { /* If the current rule is part of a chain then * we need to skip over all the rules in the chain. */ mode = NEXT_CHAIN; if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "No match, chained -> mode NEXT_CHAIN."); } } else { /* This rule is not part of a chain so we simply * move to the next rule. */ mode = NEXT_RULE; if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "No match, not chained -> mode NEXT_RULE."); } } apr_table_clear(msr->matched_vars); skipped = 0; saw_starter = 0; } else if (rc == RULE_MATCH) { if (msr->rule_was_intercepted) { /* If the transaction was intercepted by this rule we will * go back. Do note that we are relying on the * rule to know if it is a part of a chain and * not intercept if it is. */ if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Match, intercepted -> returning."); } if(i-1 >= 0) last_rule = rules[i-1]; else last_rule = rules[0]; if((last_rule != NULL) && (last_rule->actionset != NULL) && last_rule->actionset->is_chained) { int st = 0; for(st=i;st>=0;st--) { rule_starter = rules[st]; if(rule_starter != NULL && rule_starter->chain_starter != NULL) { if((msr != NULL) && (msr->intercept_actionset != NULL) && (rule_starter->actionset != NULL)) msr->intercept_actionset->intercept_uri = rule_starter->actionset->intercept_uri; break; } } } apr_table_clear(msr->matched_vars); return 1; } if (rule->actionset->skip_after != NULL) { skip_after = rule->actionset->skip_after; mode = SKIP_RULES; saw_starter = 1; if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Skipping after rule %pp id=\"%s\" -> mode SKIP_RULES.", rule, skip_after); } continue; } if(skipped == 1) { mode = SKIP_RULES; continue; } /* We had a match but the transaction was not * intercepted. In that case we proceed with the * next rule... */ mode = NEXT_RULE; if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Match -> mode NEXT_RULE."); } /* ...unless we need to skip, in which case we * determine how many rules/chains we need to * skip and configure the counter accordingly. */ if (rule->actionset->is_chained == 0) { apr_table_clear(msr->matched_vars); if (rule->chain_starter != NULL) { if (rule->chain_starter->actionset->skip_count > 0) { skip = rule->chain_starter->actionset->skip_count; if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Skipping %d rules/chains (from a chain).", skip); } } } else if (rule->actionset->skip_count > 0) { skip = rule->actionset->skip_count; if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Skipping %d rules/chains.", skip); } } } } else if (rc < 0) { msr_log(msr, 1, "Rule processing failed."); if (msr->txcfg->reqintercept_oe == 1) { apr_table_clear(msr->matched_vars); return -1; } else { if (rule->actionset->is_chained) { /* If the current rule is part of a chain then * we need to skip over all the rules in the chain. */ mode = NEXT_CHAIN; if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Ruled failed, chained -> mode NEXT_CHAIN."); } } else { /* This rule is not part of a chain so we simply * move to the next rule. */ mode = NEXT_RULE; if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Rule failed, not chained -> mode NEXT_RULE."); } } apr_table_clear(msr->matched_vars); skipped = 0; saw_starter = 0; } } else { msr_log(msr, 1, "Rule processing failed with unknown return code: %d.", rc); apr_table_clear(msr->matched_vars); return -1; } } /* ENH warn if chained rules are missing. */ apr_table_clear(msr->matched_vars); return 0; } /** * Creates a ruleset that will be handled by the default * implementation. */ msre_ruleset *msre_ruleset_create(msre_engine *engine, apr_pool_t *mp) { msre_ruleset *ruleset; ruleset = apr_pcalloc(mp, sizeof(msre_ruleset)); if (ruleset == NULL) return NULL; ruleset->mp = mp; ruleset->engine = engine; ruleset->phase_request_headers = apr_array_make(ruleset->mp, 25, sizeof(const msre_rule *)); ruleset->phase_request_body = apr_array_make(ruleset->mp, 25, sizeof(const msre_rule *)); ruleset->phase_response_headers = apr_array_make(ruleset->mp, 25, sizeof(const msre_rule *)); ruleset->phase_response_body = apr_array_make(ruleset->mp, 25, sizeof(const msre_rule *)); ruleset->phase_logging = apr_array_make(ruleset->mp, 25, sizeof(const msre_rule *)); return ruleset; } /** * Adds one rule to the given phase of the ruleset. */ int msre_ruleset_rule_add(msre_ruleset *ruleset, msre_rule *rule, int phase) { apr_array_header_t *arr = NULL; switch (phase) { case PHASE_REQUEST_HEADERS : arr = ruleset->phase_request_headers; break; case PHASE_REQUEST_BODY : arr = ruleset->phase_request_body; break; case PHASE_RESPONSE_HEADERS : arr = ruleset->phase_response_headers; break; case PHASE_RESPONSE_BODY : arr = ruleset->phase_response_body; break; case PHASE_LOGGING : arr = ruleset->phase_logging; break; default : return -1; } /* ENH verify the rule's use of targets is consistent with * the phase it selected to run at. */ msre_actionset_set_defaults(rule->actionset); rule->actionset->rule = rule; *(const msre_rule **)apr_array_push(arr) = rule; return 1; } static msre_rule * msre_ruleset_fetch_phase_rule(const msre_ruleset *ruleset, const char *id, const apr_array_header_t *phase_arr, int offset) { msre_rule **rules = (msre_rule **)phase_arr->elts; int i; for (i = 0; i < phase_arr->nelts; i++) { msre_rule *rule = (msre_rule *)rules[i]; /* Rule with an action, not a sub-rule (chain) and a matching id */ if ( (rule->actionset != NULL) && (!rule->actionset->is_chained || !rule->chain_starter) && (rule->actionset->id != NULL) && (strcmp(rule->actionset->id, id) == 0)) { /* Return rule that matched unless it is a placeholder */ if(offset == 0) { return (rule->placeholder == RULE_PH_NONE) ? rule : NULL; } else { if (i+offset < phase_arr->nelts) { msre_rule *rule_off = (msre_rule *)rules[i+offset]; return (rule_off->placeholder == RULE_PH_NONE) ? rule_off : NULL; } } } } return NULL; } /** * Fetches rule from the ruleset all rules that match the given exception. */ msre_rule * msre_ruleset_fetch_rule(msre_ruleset *ruleset, const char *id, int offset) { msre_rule *rule = NULL; if (ruleset == NULL) return NULL; rule = msre_ruleset_fetch_phase_rule(ruleset, id, ruleset->phase_request_headers, offset); if (rule != NULL) return rule; rule = msre_ruleset_fetch_phase_rule(ruleset, id, ruleset->phase_request_body, offset); if (rule != NULL) return rule; rule = msre_ruleset_fetch_phase_rule(ruleset, id, ruleset->phase_response_headers, offset); if (rule != NULL) return rule; rule = msre_ruleset_fetch_phase_rule(ruleset, id, ruleset->phase_response_body, offset); if (rule != NULL) return rule; rule = msre_ruleset_fetch_phase_rule(ruleset, id, ruleset->phase_logging, offset); return rule; } static int msre_ruleset_phase_rule_remove_with_exception(msre_ruleset *ruleset, rule_exception *re, apr_array_header_t *phase_arr) { msre_rule **rules; int i, j, mode, removed_count; j = 0; mode = 0; removed_count = 0; rules = (msre_rule **)phase_arr->elts; for (i = 0; i < phase_arr->nelts; i++) { msre_rule *rule = (msre_rule *)rules[i]; if (mode == 0) { /* Looking for next rule. */ int remove_rule = 0; /* Only remove non-placeholder rules */ if (rule->placeholder == RULE_PH_NONE) { switch(re->type) { case RULE_EXCEPTION_REMOVE_ID : if ((rule->actionset != NULL)&&(rule->actionset->id != NULL)) { int ruleid = atoi(rule->actionset->id); if (rule_id_in_range(ruleid, re->param)) { remove_rule = 1; } } break; case RULE_EXCEPTION_REMOVE_MSG : if ((rule->actionset != NULL)&&(rule->actionset->msg != NULL)) { char *my_error_msg = NULL; int rc = msc_regexec(re->param_data, rule->actionset->msg, strlen(rule->actionset->msg), &my_error_msg); if (rc >= 0) { remove_rule = 1; } } break; case RULE_EXCEPTION_REMOVE_TAG : if ((rule->actionset != NULL)&&(apr_is_empty_table(rule->actionset->actions) == 0)) { char *my_error_msg = NULL; const apr_array_header_t *tarr = NULL; const apr_table_entry_t *telts = NULL; int act; tarr = apr_table_elts(rule->actionset->actions); telts = (const apr_table_entry_t*)tarr->elts; for (act = 0; act < tarr->nelts; act++) { msre_action *action = (msre_action *)telts[act].val; if((action != NULL) && (action->metadata != NULL) && (strcmp("tag", action->metadata->name) == 0)) { int rc = msc_regexec(re->param_data, action->param, strlen(action->param), &my_error_msg); if (rc >= 0) { remove_rule = 1; } } } } break; } } if (remove_rule) { /* Do not increment j. */ removed_count++; if (rule->actionset->is_chained) mode = 2; /* Remove rules in this chain. */ } else { if (rule->actionset->is_chained) mode = 1; /* Keep rules in this chain. */ rules[j++] = rules[i]; } } else { /* Handling rule that is part of a chain. */ if (mode == 2) { /* We want to remove the rule. */ /* Do not increment j. */ removed_count++; } else { rules[j++] = rules[i]; } if ((rule->actionset == NULL)||(rule->actionset->is_chained == 0)) mode = 0; } } /* Update the number of rules in the array. */ phase_arr->nelts -= removed_count; return 0; } /** * Removes from the ruleset all rules that match the given exception. */ int msre_ruleset_rule_remove_with_exception(msre_ruleset *ruleset, rule_exception *re) { int count = 0; if (ruleset == NULL) return 0; count += msre_ruleset_phase_rule_remove_with_exception(ruleset, re, ruleset->phase_request_headers); count += msre_ruleset_phase_rule_remove_with_exception(ruleset, re, ruleset->phase_request_body); count += msre_ruleset_phase_rule_remove_with_exception(ruleset, re, ruleset->phase_response_headers); count += msre_ruleset_phase_rule_remove_with_exception(ruleset, re, ruleset->phase_response_body); count += msre_ruleset_phase_rule_remove_with_exception(ruleset, re, ruleset->phase_logging); return count; } /* -- Rule functions ------------------------------------------------------- */ /** * Returns the name of the supplied severity level. */ static const char *msre_format_severity(int severity) { if ((severity >= 0)&&(severity <= 7)) { return severities[severity]; } else { return "(invalid value)"; } } /** * Creates a string containing the metadata of the supplied rule. */ char *msre_format_metadata(modsec_rec *msr, msre_actionset *actionset) { const apr_array_header_t *tarr; const apr_table_entry_t *telts; char *id = ""; char *rev = ""; char *msg = ""; char *logdata = ""; char *severity = ""; char *accuracy = ""; char *maturity = ""; char *version = ""; char *tags = ""; char *fn = ""; int k; if (actionset == NULL) return ""; if ((actionset->rule != NULL) && (actionset->rule->filename != NULL)) { fn = apr_psprintf(msr->mp, " [file \"%s\"] [line \"%d\"]", actionset->rule->filename, actionset->rule->line_num); } if (actionset->id != NULL) { id = apr_psprintf(msr->mp, " [id \"%s\"]", log_escape(msr->mp, actionset->id)); } if (actionset->rev != NULL) { rev = apr_psprintf(msr->mp, " [rev \"%s\"]", log_escape(msr->mp, actionset->rev)); } if (actionset->msg != NULL) { /* Expand variables in the message string. */ msc_string *var = (msc_string *)apr_pcalloc(msr->mp, sizeof(msc_string)); var->value = (char *)actionset->msg; var->value_len = strlen(actionset->msg); expand_macros(msr, var, NULL, msr->mp); msg = apr_psprintf(msr->mp, " [msg \"%s\"]", log_escape_ex(msr->mp, var->value, var->value_len)); } if (actionset->logdata != NULL) { /* Expand variables in the message string. */ msc_string *var = (msc_string *)apr_pcalloc(msr->mp, sizeof(msc_string)); var->value = (char *)actionset->logdata; var->value_len = strlen(actionset->logdata); expand_macros(msr, var, NULL, msr->mp); logdata = apr_psprintf(msr->mp, " [data \"%s", log_escape_hex(msr->mp, (unsigned char *)var->value, var->value_len)); logdata = apr_pstrcat(msr->mp, logdata, "\"]", NULL); /* If it is > 512 bytes, then truncate at 512 with ellipsis. * NOTE: 512 actual data + 9 bytes of label = 521 */ if (strlen(logdata) > 521) { logdata[517] = '.'; logdata[518] = '.'; logdata[519] = '.'; logdata[520] = '"'; logdata[521] = ']'; logdata[522] = '\0'; } } if ((actionset->severity >= 0)&&(actionset->severity <= 7)) { severity = apr_psprintf(msr->mp, " [severity \"%s\"]", msre_format_severity(actionset->severity)); } if (actionset->version != NULL) { version = apr_psprintf(msr->mp, " [ver \"%s\"]", log_escape(msr->mp, actionset->version)); } if (actionset->maturity >= 0) { maturity = apr_psprintf(msr->mp, " [maturity \"%d\"]", actionset->maturity); } if (actionset->accuracy >= 0) { accuracy = apr_psprintf(msr->mp, " [accuracy \"%d\"]", actionset->accuracy); } /* Extract rule tags from the action list. */ tarr = apr_table_elts(actionset->actions); telts = (const apr_table_entry_t*)tarr->elts; for (k = 0; k < tarr->nelts; k++) { msre_action *action = (msre_action *)telts[k].val; if (strcmp(telts[k].key, "tag") == 0) { /* Expand variables in the tag argument. */ msc_string *var = (msc_string *)apr_pcalloc(msr->mp, sizeof(msc_string)); var->value = (char *)action->param; var->value_len = strlen(action->param); expand_macros(msr, var, NULL, msr->mp); tags = apr_psprintf(msr->mp, "%s [tag \"%s\"]", tags, log_escape(msr->mp, var->value)); } } return apr_pstrcat(msr->mp, fn, id, rev, msg, logdata, severity, version, maturity, accuracy, tags, NULL); } char * msre_rule_generate_unparsed(apr_pool_t *pool, const msre_rule *rule, const char *targets, const char *args, const char *actions) { char *unparsed = NULL; const char *r_targets = targets; const char *r_args = args; const char *r_actions = actions; if (r_targets == NULL) { r_targets = rule->p1; } if (r_args == NULL) { r_args = apr_pstrcat(pool, (rule->op_negated ? "!" : ""), "@", rule->op_name, " ", rule->op_param, NULL); } if (r_actions == NULL) { r_actions = msre_actionset_generate_action_string(pool, rule->actionset); } switch (rule->type) { case RULE_TYPE_NORMAL: if (r_actions == NULL) { unparsed = apr_psprintf(pool, "SecRule \"%s\" \"%s\"", log_escape(pool, r_targets), log_escape(pool, r_args)); } else { unparsed = apr_psprintf(pool, "SecRule \"%s\" \"%s\" \"%s\"", log_escape(pool, r_targets), log_escape(pool, r_args), log_escape(pool, r_actions)); } break; case RULE_TYPE_ACTION: unparsed = apr_psprintf(pool, "SecAction \"%s\"", log_escape(pool, r_actions)); break; case RULE_TYPE_MARKER: unparsed = apr_psprintf(pool, "SecMarker \"%s\"", rule->actionset->id); break; #if defined(WITH_LUA) case RULE_TYPE_LUA: /* SecRuleScript */ if (r_actions == NULL) { unparsed = apr_psprintf(pool, "SecRuleScript \"%s\"", r_args); } else { unparsed = apr_psprintf(pool, "SecRuleScript \"%s\" \"%s\"", r_args, log_escape(pool, r_actions)); } break; #endif } return unparsed; } /** * Assembles a new rule using the strings that contain a list * of targets (variables), arguments, and actions. */ msre_rule *msre_rule_create(msre_ruleset *ruleset, int type, const char *fn, int line, const char *targets, const char *args, const char *actions, char **error_msg) { msre_rule *rule; char *my_error_msg; const char *argsp; int rc; if (error_msg == NULL) return NULL; *error_msg = NULL; rule = (msre_rule *)apr_pcalloc(ruleset->mp, sizeof(msre_rule)); if (rule == NULL) return NULL; rule->type = type; rule->ruleset = ruleset; rule->targets = apr_array_make(ruleset->mp, 10, sizeof(const msre_var *)); rule->p1 = apr_pstrdup(ruleset->mp, targets); rule->filename = apr_pstrdup(ruleset->mp, fn); rule->line_num = line; /* Parse targets */ rc = msre_parse_targets(ruleset, targets, rule->targets, &my_error_msg); if (rc < 0) { *error_msg = apr_psprintf(ruleset->mp, "Error creating rule: %s", my_error_msg); return NULL; } /* Parse args */ argsp = args; /* Is negation used? */ if (*argsp == '!') { rule->op_negated = 1; argsp++; while((isspace(*argsp))&&(*argsp != '\0')) argsp++; } /* Is the operator explicitly selected? */ if (*argsp != '@') { /* Go with a regular expression. */ rule->op_name = "rx"; rule->op_param = argsp; } else { /* Explicitly selected operator. */ char *p = (char *)(argsp + 1); while((!isspace(*p))&&(*p != '\0')) p++; rule->op_name = apr_pstrmemdup(ruleset->mp, argsp + 1, p - (argsp + 1)); while(isspace(*p)) p++; /* skip over the whitespace at the end*/ rule->op_param = p; /* IMP1 So we always have a parameter even when it's empty? */ } /* Find the operator. */ rule->op_metadata = msre_engine_op_resolve(ruleset->engine, rule->op_name); if (rule->op_metadata == NULL) { *error_msg = apr_psprintf(ruleset->mp, "Error creating rule: Failed to resolve operator: %s", rule->op_name); return NULL; } /* Initialise & validate parameter */ if (rule->op_metadata->param_init != NULL) { if (rule->op_metadata->param_init(rule, &my_error_msg) <= 0) { *error_msg = apr_psprintf(ruleset->mp, "Error creating rule: %s", my_error_msg); return NULL; } } /* Parse actions */ if (actions != NULL) { /* Create per-rule actionset */ rule->actionset = msre_actionset_create(ruleset->engine, actions, &my_error_msg); if (rule->actionset == NULL) { *error_msg = apr_psprintf(ruleset->mp, "Error parsing actions: %s", my_error_msg); return NULL; } } /* Add the unparsed rule */ rule->unparsed = msre_rule_generate_unparsed(ruleset->mp, rule, targets, args, NULL); return rule; } #if defined(WITH_LUA) /** * */ msre_rule *msre_rule_lua_create(msre_ruleset *ruleset, const char *fn, int line, const char *script_filename, const char *actions, char **error_msg) { msre_rule *rule; char *my_error_msg; if (error_msg == NULL) return NULL; *error_msg = NULL; rule = (msre_rule *)apr_pcalloc(ruleset->mp, sizeof(msre_rule)); if (rule == NULL) return NULL; rule->type = RULE_TYPE_LUA; rule->ruleset = ruleset; rule->filename = apr_pstrdup(ruleset->mp, fn); rule->line_num = line; /* Compile script. */ *error_msg = lua_compile(&rule->script, script_filename, ruleset->mp); if (*error_msg != NULL) { return NULL; } /* Parse actions */ if (actions != NULL) { /* Create per-rule actionset */ rule->actionset = msre_actionset_create(ruleset->engine, actions, &my_error_msg); if (rule->actionset == NULL) { *error_msg = apr_psprintf(ruleset->mp, "Error parsing actions: %s", my_error_msg); return NULL; } } /* Add the unparsed rule */ rule->unparsed = msre_rule_generate_unparsed(ruleset->mp, rule, NULL, script_filename, NULL); return rule; } #endif /** * Perform non-disruptive actions associated with the provided actionset. */ static void msre_perform_nondisruptive_actions(modsec_rec *msr, msre_rule *rule, msre_actionset *actionset, apr_pool_t *mptmp) { const apr_array_header_t *tarr; const apr_table_entry_t *telts; int i; tarr = apr_table_elts(actionset->actions); telts = (const apr_table_entry_t*)tarr->elts; for (i = 0; i < tarr->nelts; i++) { msre_action *action = (msre_action *)telts[i].val; if (action->metadata->type == ACTION_NON_DISRUPTIVE) { if (action->metadata->execute != NULL) { action->metadata->execute(msr, mptmp, rule, action); } } } } /** * Perform the disruptive actions associated with the given actionset. */ static void msre_perform_disruptive_actions(modsec_rec *msr, msre_rule *rule, msre_actionset *actionset, apr_pool_t *mptmp, const char *message) { const apr_array_header_t *tarr; const apr_table_entry_t *telts; int i; /* Execute the disruptive actions. Do note that this does * not mean the request will be interrupted straight away. All * disruptive actions need to do here is update the information * that will be used to act later. */ tarr = apr_table_elts(actionset->actions); telts = (const apr_table_entry_t*)tarr->elts; for (i = 0; i < tarr->nelts; i++) { msre_action *action = (msre_action *)telts[i].val; if (action->metadata->type == ACTION_DISRUPTIVE) { if (action->metadata->execute != NULL) { action->metadata->execute(msr, mptmp, rule, action); } } } /* If "noauditlog" was used do not mark the transaction relevant. */ if (actionset->auditlog != 0) { msr->is_relevant++; } /* We only do stuff when in ONLINE mode. In all other * cases we only emit warnings. */ if ((msr->phase == PHASE_LOGGING) || (msr->txcfg->is_enabled == MODSEC_DETECTION_ONLY) || (msr->modsecurity->processing_mode == MODSEC_OFFLINE) || (actionset->intercept_action == ACTION_NONE)) { int log_level; /* If "nolog" was used log at a higher level to prevent an "alert". */ if (actionset->log == 0) { log_level = 4; /* But, if "auditlog" is enabled, then still add the message. */ if (actionset->auditlog != 0) { *(const char **)apr_array_push(msr->alerts) = msc_alert_message(msr, actionset, NULL, message); } } else { log_level = 2; } msc_alert(msr, log_level, actionset, "Warning.", message); /* However, this will mark the txn relevant again if it is <= 3, * which will mess up noauditlog. We need to compensate for this * so that we do not increment twice when auditlog is enabled and * prevent incrementing when auditlog is disabled. */ if (log_level <= 3) { msr->is_relevant--; } return; } /* Signal to the engine we need to intercept this * transaction, and rememer the rule that caused it. */ msr->was_intercepted = 1; msr->rule_was_intercepted = 1; msr->intercept_phase = msr->phase; msr->intercept_actionset = actionset; msr->intercept_message = message; } /** * Invokes the rule operator against the given value. */ static int execute_operator(msre_var *var, msre_rule *rule, modsec_rec *msr, msre_actionset *acting_actionset, apr_pool_t *mptmp) { apr_time_t time_before_op = 0; char *my_error_msg = NULL; const char *full_varname = NULL; const apr_array_header_t *tarr = NULL; const apr_table_entry_t *telts = NULL; rule_exception *re = NULL; char *exceptions = NULL; int rc, i; /* determine the full var name if not already resolved * * NOTE: this can happen if the var does not match but it is * being tested for non-existance as in: * @REQUEST_HEADERS:Foo "@eq 0" * @REQUEST_HEADERS:Foo "!@eq 1" */ if ((var->param != NULL) && (var->name != NULL) && (strchr(var->name,':') == NULL)) { full_varname = apr_psprintf(mptmp, "%s%s:%s", (var->is_counting ? "&" : ""), var->name, var->param); } else if ((var->name != NULL) && var->is_counting && (*var->name != '&')) { full_varname = apr_pstrcat(mptmp, "&", var->name, NULL); } else { full_varname = var->name; } tarr = apr_table_elts(msr->removed_targets); telts = (const apr_table_entry_t*)tarr->elts; for (i = 0; i < tarr->nelts; i++) { exceptions = (char *)telts[i].key; re = (rule_exception *)telts[i].val; rc = msre_ruleset_rule_matches_exception(rule, re); if (rc > 0) { rc = fetch_target_exception(rule, msr, var, exceptions); if(rc > 0) { if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Executing operator \"%s%s\" with param \"%s\" against %s skipped.", (rule->op_negated ? "!" : ""), rule->op_name, log_escape(msr->mp, rule->op_param), full_varname); } return RULE_NO_MATCH; } } } if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Executing operator \"%s%s\" with param \"%s\" against %s.", (rule->op_negated ? "!" : ""), rule->op_name, log_escape(msr->mp, rule->op_param), full_varname); } if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Target value: \"%s\"", log_escape_nq_ex(msr->mp, var->value, var->value_len)); } #if defined(PERFORMANCE_MEASUREMENT) time_before_op = apr_time_now(); #else if (msr->txcfg->debuglog_level >= 4 || msr->txcfg->max_rule_time > 0) { time_before_op = apr_time_now(); } #endif rc = rule->op_metadata->execute(msr, rule, var, &my_error_msg); #if defined(PERFORMANCE_MEASUREMENT) { /* Record performance but do not log anything. */ apr_time_t t1 = apr_time_now(); rule->op_time += (t1 - time_before_op); } #else if (msr->txcfg->debuglog_level >= 4) { apr_time_t t1 = apr_time_now(); msr_log(msr, 4, "Operator completed in %" APR_TIME_T_FMT " usec.", (t1 - time_before_op)); } if(msr->txcfg->max_rule_time > 0) { apr_time_t t1 = apr_time_now(); apr_time_t rule_time = 0; const char *rt_time = NULL; if(rule->actionset->id != NULL) { rt_time = apr_table_get(msr->perf_rules, rule->actionset->id); if(rt_time == NULL) { rt_time = apr_psprintf(msr->mp, "%" APR_TIME_T_FMT, (t1 - time_before_op)); rule_time = (apr_time_t)atoi(rt_time); if(rule_time >= msr->txcfg->max_rule_time) apr_table_setn(msr->perf_rules, rule->actionset->id, rt_time); } else { rule_time = (apr_time_t)atoi(rt_time); rule_time += (t1 - time_before_op); if(rule_time >= msr->txcfg->max_rule_time) { rt_time = apr_psprintf(msr->mp, "%" APR_TIME_T_FMT, rule_time); apr_table_setn(msr->perf_rules, rule->actionset->id, rt_time); } } } } #endif if (rc < 0) { msr_log(msr, 4, "Operator error: %s", my_error_msg); return -1; } if (((rc == 0)&&(rule->op_negated == 0))||((rc == 1)&&(rule->op_negated == 1))) { /* No match, do nothing. */ return RULE_NO_MATCH; } else { /* Match. */ if (rc == 0) { char *op_param = log_escape(msr->mp, rule->op_param); /* Truncate op parameter. */ if (strlen(op_param) > 252) { op_param = apr_psprintf(msr->mp, "%.252s ...", op_param); } /* Operator did not match so we need to provide a message. */ my_error_msg = apr_psprintf(msr->mp, "Match of \"%s %s\" against \"%s\" required.", log_escape(msr->mp, rule->op_name), op_param, log_escape(msr->mp, full_varname)); } /* Save the rules that match */ *(const msre_rule **)apr_array_push(msr->matched_rules) = rule; /* Save the last matched var data */ if(var != NULL && msr != NULL) { msc_string *mvar = NULL; msr->matched_var->name = apr_pstrdup(msr->mp, var->name); msr->matched_var->name_len = strlen(msr->matched_var->name); msr->matched_var->value = apr_pmemdup(msr->mp, var->value, var->value_len); msr->matched_var->value_len = var->value_len; mvar = apr_palloc(msr->mp, sizeof(msc_string)); mvar->name = apr_pstrdup(msr->mp, var->name); mvar->name_len = strlen(mvar->name); mvar->value = apr_pmemdup(msr->mp, var->value, var->value_len); mvar->value_len = var->value_len; apr_table_addn(msr->matched_vars, mvar->name, (void *)mvar); } /* Keep track of the highest severity matched so far */ if ((acting_actionset->severity > 0) && (acting_actionset->severity < msr->highest_severity) && !rule->actionset->is_chained) { msr->highest_severity = acting_actionset->severity; } /* Perform non-disruptive actions. */ msre_perform_nondisruptive_actions(msr, rule, rule->actionset, mptmp); /* Perform disruptive actions, but only if * this rule is not part of a chain. */ if (rule->actionset->is_chained == 0) { msre_perform_disruptive_actions(msr, rule, acting_actionset, mptmp, my_error_msg); } return RULE_MATCH; } } /** * Executes rule against the given transaction. */ static apr_status_t msre_rule_process_normal(msre_rule *rule, modsec_rec *msr) { const apr_array_header_t *arr = NULL; const apr_table_entry_t *te = NULL; msre_actionset *acting_actionset = NULL; msre_var **targets = NULL; apr_pool_t *mptmp = msr->msc_rule_mptmp; apr_table_t *tartab = NULL; apr_table_t *vartab = NULL; int i, rc = 0, match_count = 0; int invocations = 0; int multi_match = 0; /* Choose the correct metadata/disruptive action actionset. */ acting_actionset = rule->actionset; if (rule->chain_starter != NULL) { acting_actionset = rule->chain_starter->actionset; } /* Configure recursive matching. */ if (apr_table_get(rule->actionset->actions, "multiMatch") != NULL) { multi_match = 1; } /* ENH: What is a good initial size? */ tartab = apr_table_make(mptmp, 24); if (tartab == NULL) return -1; vartab = apr_table_make(mptmp, 24); if (vartab == NULL) return -1; /* Expand variables to create a list of targets. */ targets = (msre_var **)rule->targets->elts; for (i = 0; i < rule->targets->nelts; i++) { int j, list_count; apr_table_clear(vartab); /* ENH Introduce a new variable hook that would allow the code * behind the variable to return the size of the collection * without having to generate the variables. */ /* Expand individual variables first. */ list_count = targets[i]->metadata->generate(msr, targets[i], rule, vartab, mptmp); if (targets[i]->is_counting) { /* Count how many there are and just add the score to the target list. */ msre_var *newvar = (msre_var *)apr_pmemdup(mptmp, targets[i], sizeof(msre_var)); newvar->value = apr_psprintf(mptmp, "%d", list_count); newvar->value_len = strlen(newvar->value); apr_table_addn(tartab, newvar->name, (void *)newvar); } else { /* And either add them or remove from the final target list. */ arr = apr_table_elts(vartab); te = (apr_table_entry_t *)arr->elts; for(j = 0; j < arr->nelts; j++) { if (targets[i]->is_negated == 0) { apr_table_addn(tartab, te[j].key, te[j].val); } else { apr_table_unset(tartab, te[j].key); } } } } /* Log the target variable expansion */ if (msr->txcfg->debuglog_level >= 4) { const char *expnames = NULL; arr = apr_table_elts(tartab); if (arr->nelts > 1) { te = (apr_table_entry_t *)arr->elts; expnames = apr_pstrdup(mptmp, ((msre_var *)te[0].val)->name); for(i = 1; i < arr->nelts; i++) { expnames = apr_psprintf(mptmp, "%s|%s", expnames, ((msre_var *)te[i].val)->name); } if (strcmp(rule->p1, expnames) != 0) { msr_log(msr, 4, "Expanded \"%s\" to \"%s\".", rule->p1, expnames); } } } /* Loop through targets on the final target list, * perform transformations as necessary, and invoke * the operator. */ arr = apr_table_elts(tartab); te = (apr_table_entry_t *)arr->elts; for (i = 0; i < arr->nelts; i++) { int changed; int usecache = 0; apr_table_t *cachetab = NULL; apr_time_t time_before_trans = 0; msre_var *var; /* Take one target. */ var = (msre_var *)te[i].val; /* Is this var cacheable? */ if (msr->txcfg->cache_trans != MODSEC_CACHE_DISABLED) { usecache = 1; /* Counting vars are not cacheable due to them being created * in a local per-rule pool. */ if (var->is_counting) { if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "CACHE: Disabled - &%s is dynamic", var->name); } usecache = 0; } /* Only cache if if the variable is available in this phase */ else if (msr->phase < var->metadata->availability) { if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "CACHE: Disabled - %s is not yet available in phase %d (requires phase %d or later)", var->name, msr->phase, var->metadata->availability); } usecache = 0; } /* check the cache options */ else if (var->value_len < msr->txcfg->cache_trans_min) { if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "CACHE: Disabled - %s value length=%u, smaller than minlen=%" APR_SIZE_T_FMT, var->name, var->value_len, msr->txcfg->cache_trans_min); } usecache = 0; } else if ((msr->txcfg->cache_trans_max != 0) && (var->value_len > msr->txcfg->cache_trans_max)) { if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "CACHE: Disabled - %s value length=%u, larger than maxlen=%" APR_SIZE_T_FMT, var->name, var->value_len, msr->txcfg->cache_trans_max); } usecache = 0; } /* if cache is still enabled, check the VAR for cacheablity */ if (usecache) { if (var->metadata->is_cacheable == VAR_CACHE) { if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "CACHE: Enabled"); } #ifdef CACHE_DEBUG msr_log(msr, 9, "CACHE: Fetching cache entry from hash=%pp: %pp=%s", msr->tcache, var, var->name); #endif /* Fetch cache table for this target */ cachetab = (apr_table_t *)apr_hash_get(msr->tcache, var->value, sizeof(var->value)); /* Create an empty cache table if this is the first time */ #ifdef CACHE_DEBUG if (cachetab) { msr_log(msr, 9, "CACHE: Using cache table %pp", cachetab); } else #else if (cachetab == NULL) #endif { /* NOTE: We use the pointer to the var value as a hash * key as it is unique. This pointer *must* * remain valid through the entire phase. If * it does not, then we will not receive a cache * hit and just wasted RAM. So, it is important * that any such vars be marked as VAR_DONT_CACHE. * * ENH: Only use pointer for non-scalar vars */ cachetab = apr_table_make(msr->mp, 3); apr_hash_set(msr->tcache, var->value, sizeof(var->value), cachetab); #ifdef CACHE_DEBUG msr_log(msr, 9, "CACHE: Created a new cache table %pp for %pp", cachetab, var->value); #endif } } else { usecache = 0; if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "CACHE: %s transformations are not cacheable", var->name); } } } } #if defined(PERFORMANCE_MEASUREMENT) time_before_trans = apr_time_now(); #else if (msr->txcfg->debuglog_level >= 4) { time_before_trans = apr_time_now(); } #endif /* Transform target. */ { const apr_array_header_t *tarr; const apr_table_entry_t *telts; const char *tfnspath = NULL; char *tfnskey = NULL; int tfnscount = 0; int last_cached_tfn = 0; msre_cache_rec *crec = NULL; msre_cache_rec *last_crec = NULL; int k; msre_action *action; msre_tfn_metadata *metadata; apr_table_t *normtab; const char *lastvarval = NULL; apr_size_t lastvarlen = 0; int tfnchanged = 0; changed = 0; normtab = apr_table_make(mptmp, 10); if (normtab == NULL) return -1; tarr = apr_table_elts(rule->actionset->actions); telts = (const apr_table_entry_t*)tarr->elts; /* Build the final list of transformation functions. */ for (k = 0; k < tarr->nelts; k++) { action = (msre_action *)telts[k].val; if (strcmp(telts[k].key, "t") == 0) { if (strcmp(action->param, "none") == 0) { apr_table_clear(normtab); tfnspath = NULL; tfnskey = NULL; tfnscount = 0; last_crec = NULL; last_cached_tfn = 0; continue; } if (action->param_plusminus == NEGATIVE_VALUE) { apr_table_unset(normtab, action->param); } else { tfnscount++; apr_table_addn(normtab, action->param, (void *)action); /* Check the cache, saving the 'most complete' as a * starting point */ if (usecache) { tfnspath = apr_psprintf(mptmp, "%s%s%s", (tfnspath?tfnspath:""), (tfnspath?",":""), action->param); tfnskey = apr_psprintf(mptmp, "%x;%s", tfnscount, tfnspath); crec = (msre_cache_rec *)apr_table_get(cachetab, tfnskey); #ifdef CACHE_DEBUG msr_log(msr, 9, "CACHE: %s %s cached=%d", var->name, tfnskey, (crec ? 1 : 0)); #endif if (crec != NULL) { last_crec = crec; last_cached_tfn = tfnscount; } } } } } /* If the last cached tfn is the last in the list * then we can stop here and just execute the action immediatly */ if (usecache && !multi_match && (crec != NULL) && (crec == last_crec)) { crec->hits++; if (crec->changed) { var->value = apr_pmemdup(mptmp, crec->val, crec->val_len); var->value_len = crec->val_len; } if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "T (%d) %s: \"%s\" [fully cached hits=%d]", crec->changed, crec->path, log_escape_nq_ex(mptmp, var->value, var->value_len), crec->hits); } #if defined(PERFORMANCE_MEASUREMENT) { apr_time_t t1 = apr_time_now(); rule->trans_time += (t1 - time_before_trans); } #else if (msr->txcfg->debuglog_level >= 4) { apr_time_t t1 = apr_time_now(); msr_log(msr, 4, "Transformation completed in %" APR_TIME_T_FMT " usec.", (t1 - time_before_trans)); } #endif rc = execute_operator(var, rule, msr, acting_actionset, mptmp); if (rc < 0) { return -1; } if (rc == RULE_MATCH) { match_count++; /* Return straight away if the transaction * was intercepted - no need to process the remaining * targets. */ if (msr->rule_was_intercepted) { return RULE_MATCH; } } continue; /* next target */ } /* Perform transformations. */ tarr = apr_table_elts(normtab); /* Execute transformations in a loop. */ /* Start after the last known cached transformation if we can */ if (!multi_match && (last_crec != NULL)) { k = last_cached_tfn; tfnspath = last_crec->path; last_crec->hits++; if ((changed = last_crec->changed) > 0) { var->value = last_crec->val; var->value_len = last_crec->val_len; } if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "T (%d) %s: \"%s\" [partially cached hits=%d]", last_crec->changed, tfnspath, log_escape_nq_ex(mptmp, var->value, var->value_len), last_crec->hits); } } else { tfnspath = NULL; k = 0; } /* Make a copy of the value so that we can change it in-place. */ if (tarr->nelts) { var->value = apr_pstrmemdup(mptmp, var->value, var->value_len); /* var->value_len remains the same */ } telts = (const apr_table_entry_t*)tarr->elts; for (; k < tarr->nelts; k++) { char *rval = NULL; long int rval_length = -1; /* In multi-match mode we execute the operator * once at the beginning and then once every * time the variable is changed by the transformation * function. */ if (multi_match && (k == 0 || tfnchanged)) { invocations++; #if defined(PERFORMANCE_MEASUREMENT) { apr_time_t t1 = apr_time_now(); rule->trans_time += (t1 - time_before_trans); } #else if (msr->txcfg->debuglog_level >= 4) { apr_time_t t1 = apr_time_now(); msr_log(msr, 4, "Transformation completed in %" APR_TIME_T_FMT " usec.", (t1 - time_before_trans)); } #endif rc = execute_operator(var, rule, msr, acting_actionset, mptmp); if (rc < 0) { return -1; } if (rc == RULE_MATCH) { match_count++; /* Return straight away if the transaction * was intercepted - no need to process the remaining * targets. */ if (msr->rule_was_intercepted) { return RULE_MATCH; } } } /* Perform one transformation. */ action = (msre_action *)telts[k].val; metadata = (msre_tfn_metadata *)action->param_data; tfnchanged = metadata->execute(mptmp, (unsigned char *)var->value, var->value_len, &rval, &rval_length); if (tfnchanged < 0) { return -1; } if (tfnchanged) { changed++; } /* Use the new values */ var->value = rval; var->value_len = rval_length; /* Cache the transformation */ if (usecache) { int tfnsnum = k + 1; /* Generate the cache key */ tfnspath = apr_psprintf(msr->mp, "%s%s%s", (tfnspath ? tfnspath : ""), (tfnspath ? "," : ""), action->param); tfnskey = apr_psprintf(msr->mp, "%x;%s", tfnsnum, tfnspath); if ((msr->txcfg->cache_trans_maxitems != 0) && (msr->tcache_items >= msr->txcfg->cache_trans_maxitems)) { /* Warn only once if we attempt to go over the cache limit. */ if (msr->tcache_items == msr->txcfg->cache_trans_maxitems) { msr->tcache_items++; msr_log(msr, 4, "CACHE: Disabled - phase=%d" " maxitems=%" APR_SIZE_T_FMT " limit reached.", msr->phase, msr->txcfg->cache_trans_maxitems); } } else if (msr->txcfg->cache_trans_incremental || (tfnsnum == tarr->nelts)) { /* ENH1: Add flag to vars to tell which ones can change across phases store the rest in a global cache */ crec = (msre_cache_rec *)apr_pcalloc(msr->mp, sizeof(msre_cache_rec)); if (crec == NULL) return -1; crec->hits = 0; crec->changed = changed; crec->num = k + 1; crec->path = tfnspath; /* We want to cache a copy if it changed otherwise * we just want to use a pointer to the last changed value. */ crec->val = (!lastvarval || tfnchanged) ? apr_pmemdup(msr->mp, var->value, var->value_len) : lastvarval; crec->val_len = changed ? ((!lastvarval || tfnchanged) ? var->value_len : lastvarlen) : 0; /* Keep track of the last changed var value */ if (tfnchanged) { lastvarval = crec->val; lastvarlen = crec->val_len; } #ifdef CACHE_DEBUG if (changed) { msr_log(msr, 9, "CACHE: Caching %s=\"%s\" (%pp)", tfnskey, log_escape_nq_ex(mptmp, crec->val, crec->val_len), var); } else { msr_log(msr, 9, "CACHE: Caching %s= (%pp)", tfnskey, var); } #endif msr->tcache_items++; apr_table_setn(cachetab, tfnskey, (void *)crec); } } if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "T (%d) %s: \"%s\"", rc, metadata->name, log_escape_nq_ex(mptmp, var->value, var->value_len)); } } } /* Execute operator if multi-matching is not enabled, * or if it is and we need to process the result of the * last transformation. */ if (!multi_match || changed) { invocations++; #if defined(PERFORMANCE_MEASUREMENT) { apr_time_t t1 = apr_time_now(); rule->trans_time += (t1 - time_before_trans); } #else if (msr->txcfg->debuglog_level >= 4) { apr_time_t t1 = apr_time_now(); msr_log(msr, 4, "Transformation completed in %" APR_TIME_T_FMT " usec.", (t1 - time_before_trans)); } #endif rc = execute_operator(var, rule, msr, acting_actionset, mptmp); if (rc < 0) { return -1; } if (rc == RULE_MATCH) { match_count++; /* Return straight away if the transaction * was intercepted - no need to process the remaining * targets. */ if (msr->rule_was_intercepted) { return RULE_MATCH; } } } } return (match_count ? RULE_MATCH : RULE_NO_MATCH); } #if defined(WITH_LUA) /** * */ static apr_status_t msre_rule_process_lua(msre_rule *rule, modsec_rec *msr) { msre_actionset *acting_actionset = NULL; char *my_error_msg = NULL; int rc; /* Choose the correct metadata/disruptive action actionset. */ acting_actionset = rule->actionset; if (rule->chain_starter != NULL) { acting_actionset = rule->chain_starter->actionset; } rc = lua_execute(rule->script, NULL, msr, rule, &my_error_msg); if (rc < 0) { msr_log(msr, 1, "%s", my_error_msg); return -1; } /* A non-NULL error message means the rule matched. */ if (my_error_msg != NULL) { /* Perform non-disruptive actions. */ msre_perform_nondisruptive_actions(msr, rule, rule->actionset, msr->msc_rule_mptmp); /* Perform disruptive actions, but only if * this rule is not part of a chain. */ if (rule->actionset->is_chained == 0) { msre_perform_disruptive_actions(msr, rule, acting_actionset, msr->msc_rule_mptmp, my_error_msg); } } return rc; } #endif /** * */ static apr_status_t msre_rule_process(msre_rule *rule, modsec_rec *msr) { /* Use a fresh memory sub-pool for processing each rule */ if (msr->msc_rule_mptmp == NULL) { if (apr_pool_create(&msr->msc_rule_mptmp, msr->mp) != APR_SUCCESS) { return -1; } } else { apr_pool_clear(msr->msc_rule_mptmp); } #if defined(WITH_LUA) if (rule->type == RULE_TYPE_LUA) { return msre_rule_process_lua(rule, msr); } #endif return msre_rule_process_normal(rule, msr); } /** * Checks whether the given rule ID is in the given range. */ int rule_id_in_range(int ruleid, const char *range) { char *p = NULL, *saveptr = NULL; char *data = NULL; if (range == NULL) return 0; data = strdup(range); if (data == NULL) return 0; p = apr_strtok(data, ",", &saveptr); while(p != NULL) { char *s = strstr(p, "-"); if (s == NULL) { if (ruleid == atoi(p)) { free(data); return 1; } } else { int start = atoi(p); int end = atoi(s + 1); if ((ruleid >= start)&&(ruleid <= end)) { free(data); return 1; } } p = apr_strtok(NULL, ",", &saveptr); } free(data); return 0; } modsecurity-apache_2.7.7/apache2/msc_util.h0000664000175000017500000001222612253711345021134 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #ifndef _UTIL_H_ #define _UTIL_H_ #include #include #ifndef APR_WSTICKY /* Add extra flags added to APR in 0.9.5 */ #define APR_USETID 0x8000 /**< Set user id */ #define APR_GSETID 0x4000 /**< Set group id */ #define APR_WSTICKY 0x2000 /**< Sticky bit */ #endif #include "modsecurity.h" #include "re.h" #ifdef WIN32 #include // This is a trick: for ModSecurity modules this will declare inet_pton, // but for mymodule.cpp (IIS module) this will skip, because we include // windows.h before including msc_util.h // Without the trick we have redefinition conflict. // #if !(NTDDI_VERSION >= NTDDI_VISTA) int DSOLOCAL inet_pton(int family, const char *src, void *dst); #endif #endif #define UNICODE_ERROR_CHARACTERS_MISSING -1 #define UNICODE_ERROR_INVALID_ENCODING -2 #define UNICODE_ERROR_OVERLONG_CHARACTER -3 #define UNICODE_ERROR_RESTRICTED_CHARACTER -4 #define UNICODE_ERROR_DECODING_ERROR -5 #ifdef LINUX_S390 int DSOLOCAL swap_int32(int x); #endif #ifdef WIN32 #define inet_pton(x, y, z) my_inet_pton(x, y, z) #endif char DSOLOCAL *utf8_unicode_inplace_ex(apr_pool_t *mp, unsigned char *input, long int input_len, int *changed); char DSOLOCAL *m_strcasestr(const char *haystack, const char *needle); int DSOLOCAL normalize_path_inplace(unsigned char *input, int len, int win, int *changed); int DSOLOCAL parse_boolean(const char *input); char DSOLOCAL *remove_quotes(apr_pool_t *mptmp, const char *input, int input_len); char DSOLOCAL *parse_pm_content(const char *op_parm, unsigned short int op_len, msre_rule *rule, char **error_msg); char DSOLOCAL *remove_escape(apr_pool_t *mptmp, const char *input, int input_len); int DSOLOCAL parse_name_eq_value(apr_pool_t *mp, const char *input, char **name, char **value); char DSOLOCAL *url_encode(apr_pool_t *mp, char *input, unsigned int input_len, int *changed); char DSOLOCAL *strnurlencat(char *destination, char *source, unsigned int maxlen); char DSOLOCAL *file_dirname(apr_pool_t *p, const char *filename); char DSOLOCAL *file_basename(apr_pool_t *p, const char *filename); int DSOLOCAL sql_hex2bytes_inplace(unsigned char *data, int len); int DSOLOCAL hex2bytes_inplace(unsigned char *data, int len); char DSOLOCAL *bytes2hex(apr_pool_t *pool, unsigned char *data, int len); int DSOLOCAL is_token_char(unsigned char c); int DSOLOCAL remove_lf_crlf_inplace(char *text); char DSOLOCAL *guess_tmp_dir(apr_pool_t *p); char DSOLOCAL *current_logtime(apr_pool_t *mp); char DSOLOCAL *current_filetime(apr_pool_t *mp); int DSOLOCAL msc_mkstemp_ex(char *templat, int mode); int DSOLOCAL msc_mkstemp(char *templat); char DSOLOCAL *strtolower_inplace(unsigned char *str); char DSOLOCAL *log_escape_re(apr_pool_t *p, const char *text); char DSOLOCAL *log_escape(apr_pool_t *p, const char *text); char DSOLOCAL *log_escape_nq(apr_pool_t *p, const char *text); char DSOLOCAL *log_escape_ex(apr_pool_t *p, const char *text, unsigned long int text_length); char DSOLOCAL *log_escape_nq_ex(apr_pool_t *p, const char *text, unsigned long int text_length); char DSOLOCAL *log_escape_hex(apr_pool_t *mp, const unsigned char *text, unsigned long int text_length); char DSOLOCAL *log_escape_raw(apr_pool_t *mp, const unsigned char *text, unsigned long int text_length); char DSOLOCAL *log_escape_nul(apr_pool_t *mp, const unsigned char *text, unsigned long int text_length); int DSOLOCAL decode_base64_ext(char *plain_text, const unsigned char *input, int input_len); int DSOLOCAL convert_to_int(const char c); int DSOLOCAL set_match_to_tx(modsec_rec *msr, int capture, const char *match, int tx_n); int DSOLOCAL js_decode_nonstrict_inplace(unsigned char *input, long int input_len); int DSOLOCAL urldecode_uni_nonstrict_inplace_ex(unsigned char *input, long int input_length, int * changed); int DSOLOCAL urldecode_nonstrict_inplace_ex(unsigned char *input, long int input_length, int *invalid_count, int *changed); int DSOLOCAL html_entities_decode_inplace(apr_pool_t *mp, unsigned char *input, int len); int DSOLOCAL ansi_c_sequences_decode_inplace(unsigned char *input, int len); char DSOLOCAL *modsec_build(apr_pool_t *mp); int DSOLOCAL is_empty_string(const char *string); char DSOLOCAL *resolve_relative_path(apr_pool_t *pool, const char *parent_filename, const char *filename); int DSOLOCAL css_decode_inplace(unsigned char *input, long int input_len); apr_fileperms_t DSOLOCAL mode2fileperms(int mode); char DSOLOCAL *construct_single_var(modsec_rec *msr, char *name); char DSOLOCAL *format_all_performance_variables(modsec_rec *msr, apr_pool_t *mp); unsigned char DSOLOCAL is_netmask_v4(char *ip_strv4); unsigned char DSOLOCAL is_netmask_v6(char *ip_strv6); #endif modsecurity-apache_2.7.7/apache2/msc_release.h0000664000175000017500000000414612254305305021575 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #ifndef _MSC_RELEASE_H_ #define _MSC_RELEASE_H_ #include #include /* ENH: Clean this mess up by detecting this is possible */ #if !(defined(_AIX) || defined(WIN32) || defined(CYGWIN) || defined(NETWARE) || defined(SOLARIS2) || defined(OSF1)) #define DSOLOCAL __attribute__((visibility("hidden"))) #else #define DSOLOCAL #endif #if defined(DEBUG_MEM) /* Nothing Yet */ #endif /* For GNU C, tell the compiler to check printf like formatters */ #if (defined(__GNUC__) && !defined(SOLARIS2)) #define PRINTF_ATTRIBUTE(a,b) __attribute__((format (printf, a, b))) #else #define PRINTF_ATTRIBUTE(a,b) #endif #define MODSEC_VERSION_MAJOR "2" #define MODSEC_VERSION_MINOR "7" #define MODSEC_VERSION_MAINT "7" #define MODSEC_VERSION_TYPE "" #define MODSEC_VERSION_RELEASE "" #define MODSEC_VERSION_SUFFIX MODSEC_VERSION_TYPE MODSEC_VERSION_RELEASE #define MODSEC_VERSION \ MODSEC_VERSION_MAJOR "." MODSEC_VERSION_MINOR "." MODSEC_VERSION_MAINT \ MODSEC_VERSION_SUFFIX /* Apache Module Defines */ #ifdef VERSION_IIS #define MODSEC_MODULE_NAME "ModSecurity for IIS (STABLE)" #else #ifdef VERSION_NGINX #define MODSEC_MODULE_NAME "ModSecurity for nginx (STABLE)" #else #ifdef VERSION_STANDALONE #define MODSEC_MODULE_NAME "ModSecurity Standalone (STABLE)" #else #define MODSEC_MODULE_NAME "ModSecurity for Apache" #endif #endif #endif #define MODSEC_MODULE_VERSION MODSEC_VERSION #define MODSEC_MODULE_NAME_FULL MODSEC_MODULE_NAME "/" MODSEC_MODULE_VERSION " (http://www.modsecurity.org/)" int DSOLOCAL get_modsec_build_type(const char *name); #endif /* _MSC_RELEASE_H_ */ modsecurity-apache_2.7.7/apache2/msc_unicode.c0000664000175000017500000001111212253711345021571 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #include "msc_unicode.h" #define CODEPAGE_SEPARATORS " \t\n\r" /** \brief Load Unicode file * * \param dcfg Pointer to directory configuration * \param error_msg Error message * * \retval 1 On Success * \retval 0 On Fail */ static int unicode_map_create(directory_config *dcfg, char **error_msg) { char errstr[1024]; apr_pool_t *mp = dcfg->mp; unicode_map *u_map = dcfg->u_map; apr_int32_t wanted = APR_FINFO_SIZE; apr_finfo_t finfo; apr_status_t rc; apr_size_t nbytes; unsigned int codepage = 0; char *buf = NULL, *p = NULL, *savedptr = NULL; char *ucode = NULL, *hmap = NULL; int found = 0, processing = 0; int Code = 0, Map = 0; if(unicode_map_table != NULL) { free(unicode_map_table); unicode_map_table = NULL; } if ((rc = apr_file_open(&u_map->map, u_map->mapfn, APR_READ, APR_OS_DEFAULT, mp)) != APR_SUCCESS) { *error_msg = apr_psprintf(mp, "Could not open unicode map file \"%s\": %s", u_map->mapfn, apr_strerror(rc, errstr, 1024)); return 0; } if ((rc = apr_file_info_get(&finfo, wanted, u_map->map)) != APR_SUCCESS) { *error_msg = apr_psprintf(mp, "Could not cannot get unicode map file information \"%s\": %s", u_map->mapfn, apr_strerror(rc, errstr, 1024)); apr_file_close(u_map->map); return 0; } buf = (char *)malloc(finfo.size+1); if (buf == NULL) { *error_msg = apr_psprintf(mp, "Could not alloc memory for unicode map"); apr_file_close(u_map->map); return 0; } rc = apr_file_read_full(u_map->map, buf, finfo.size, &nbytes); if (unicode_map_table != NULL) { memset(unicode_map_table, -1, (sizeof(int)*65536)); } else { unicode_map_table = (int *)malloc(sizeof(int) * 65536); if(unicode_map_table == NULL) { *error_msg = apr_psprintf(mp, "Could not alloc memory for unicode map"); free(buf); buf = NULL; apr_file_close(u_map->map); return 0; } memset(unicode_map_table, -1, (sizeof(int)*65536)); } /* Setting some unicode values - http://tools.ietf.org/html/rfc3490#section-3.1 */ /* Set 0x3002 -> 0x2e */ unicode_map_table[0x3002] = 0x2e; /* Set 0xFF61 -> 0x2e */ unicode_map_table[0xff61] = 0x2e; /* Set 0xFF0E -> 0x2e */ unicode_map_table[0xff0e] = 0x2e; /* Set 0x002E -> 0x2e */ unicode_map_table[0x002e] = 0x2e; p = apr_strtok(buf,CODEPAGE_SEPARATORS,&savedptr); while (p != NULL) { codepage = atol(p); if (codepage == unicode_codepage) { found = 1; } if (found == 1 && (strchr(p,':') != NULL)) { char *mapping = strdup(p); processing = 1; if(mapping != NULL) { ucode = apr_strtok(mapping,":", &hmap); sscanf(ucode,"%x",&Code); sscanf(hmap,"%x",&Map); if(Code >= 0 && Code <= 65535) { unicode_map_table[Code] = Map; } free(mapping); mapping = NULL; } } if (processing == 1 && (strchr(p,':') == NULL)) { free(buf); buf = NULL; break; } p = apr_strtok(NULL,CODEPAGE_SEPARATORS,&savedptr); } apr_file_close(u_map->map); if(buf) { free(buf); buf = NULL; } return 1; } /** \brief Init unicode map * * \param dcfg Pointer to directory configuration * \param mapfn Unicode map filename * \param error_msg Error message * * \retval unicode_map_create On Success * \retval -1 On Fail */ int unicode_map_init(directory_config *dcfg, const char *mapfn, char **error_msg) { *error_msg = NULL; if ((dcfg->u_map == NULL) || (dcfg->u_map == NOT_SET_P)) { dcfg->u_map = apr_pcalloc(dcfg->mp, sizeof(unicode_map)); if (dcfg->u_map == NULL) { return -1; } } dcfg->u_map->map = NULL; dcfg->u_map->mapfn = apr_pstrdup(dcfg->mp, mapfn); return unicode_map_create(dcfg, error_msg); } modsecurity-apache_2.7.7/apache2/persist_dbm.c0000664000175000017500000006216612243422537021634 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #include "persist_dbm.h" #include "apr_sdbm.h" /** * */ static apr_table_t *collection_unpack(modsec_rec *msr, const unsigned char *blob, unsigned int blob_size, int log_vars) { apr_table_t *col = NULL; unsigned int blob_offset; col = apr_table_make(msr->mp, 32); if (col == NULL) return NULL; /* ENH verify the first 3 bytes (header) */ blob_offset = 3; while (blob_offset + 1 < blob_size) { msc_string *var = apr_pcalloc(msr->mp, sizeof(msc_string)); var->name_len = (blob[blob_offset] << 8) + blob[blob_offset + 1]; if (var->name_len == 0) { /* Is the length a name length, or just the end of the blob? */ if (blob_offset < blob_size - 2) { /* This should never happen as the name length * includes the terminating NUL and should be 1 for "" */ if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "collection_unpack: BLOB[%d]: %s", blob_offset, log_escape_hex(msr->mp, blob + blob_offset, blob_size - blob_offset)); } msr_log(msr, 4, "collection_unpack: Possibly corrupted database: var name length = 0 at blob offset %u-%u.", blob_offset, blob_offset + 1); } break; } else if (var->name_len > 65536) { /* This should never happen as the length is restricted on store * to 65536. */ if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "collection_unpack: BLOB[%d]: %s", blob_offset, log_escape_hex(msr->mp, blob + blob_offset, blob_size - blob_offset)); } msr_log(msr, 4, "collection_unpack: Possibly corrupted database: var name length > 65536 (0x%04x) at blob offset %u-%u.", var->name_len, blob_offset, blob_offset + 1); break; } blob_offset += 2; if (blob_offset + var->name_len > blob_size) return NULL; var->name = apr_pstrmemdup(msr->mp, (const char *)blob + blob_offset, var->name_len - 1); blob_offset += var->name_len; var->name_len--; var->value_len = (blob[blob_offset] << 8) + blob[blob_offset + 1]; blob_offset += 2; if (blob_offset + var->value_len > blob_size) return NULL; var->value = apr_pstrmemdup(msr->mp, (const char *)blob + blob_offset, var->value_len - 1); blob_offset += var->value_len; var->value_len--; if (log_vars && (msr->txcfg->debuglog_level >= 9)) { msr_log(msr, 9, "collection_unpack: Read variable: name \"%s\", value \"%s\".", log_escape_ex(msr->mp, var->name, var->name_len), log_escape_ex(msr->mp, var->value, var->value_len)); } apr_table_addn(col, var->name, (void *)var); } return col; } /** * */ static apr_table_t *collection_retrieve_ex(apr_sdbm_t *existing_dbm, modsec_rec *msr, const char *col_name, const char *col_key, int col_key_len) { char *dbm_filename = NULL; apr_status_t rc; apr_sdbm_datum_t key; apr_sdbm_datum_t *value = NULL; apr_sdbm_t *dbm = NULL; apr_table_t *col = NULL; const apr_array_header_t *arr; apr_table_entry_t *te; int expired = 0; int i; if (msr->txcfg->data_dir == NULL) { msr_log(msr, 1, "collection_retrieve_ex: Unable to retrieve collection (name \"%s\", key \"%s\"). Use " "SecDataDir to define data directory first.", log_escape(msr->mp, col_name), log_escape_ex(msr->mp, col_key, col_key_len)); goto cleanup; } dbm_filename = apr_pstrcat(msr->mp, msr->txcfg->data_dir, "/", col_name, NULL); if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "collection_retrieve_ex: collection_retrieve_ex: Retrieving collection (name \"%s\", filename \"%s\")",log_escape(msr->mp, col_name), log_escape(msr->mp, dbm_filename)); } key.dptr = (char *)col_key; key.dsize = col_key_len + 1; if (existing_dbm == NULL) { rc = apr_sdbm_open(&dbm, dbm_filename, APR_READ | APR_SHARELOCK, CREATEMODE, msr->mp); if (rc != APR_SUCCESS) { dbm = NULL; goto cleanup; } } else { dbm = existing_dbm; } value = (apr_sdbm_datum_t *)apr_pcalloc(msr->mp, sizeof(apr_sdbm_datum_t)); rc = apr_sdbm_fetch(dbm, value, key); if (rc != APR_SUCCESS) { msr_log(msr, 1, "collection_retrieve_ex: Failed to read from DBM file \"%s\": %s", log_escape(msr->mp, dbm_filename), get_apr_error(msr->mp, rc)); goto cleanup; } if (value->dptr == NULL) { /* Key not found in DBM file. */ goto cleanup; } /* ENH Need expiration (and perhaps other metadata) accessible in blob * form to determine if converting to a table is needed. This will * save some cycles. */ /* Transform raw data into a table. */ col = collection_unpack(msr, (const unsigned char *)value->dptr, value->dsize, 1); if (col == NULL) { goto cleanup; } /* Close after "value" used from fetch or memory may be overwritten. */ if (existing_dbm == NULL) { apr_sdbm_close(dbm); dbm = NULL; } /* Remove expired variables. */ do { arr = apr_table_elts(col); te = (apr_table_entry_t *)arr->elts; for (i = 0; i < arr->nelts; i++) { if (strncmp(te[i].key, "__expire_", 9) == 0) { msc_string *var = (msc_string *)te[i].val; int expiry_time = atoi(var->value); if (expiry_time <= apr_time_sec(msr->request_time)) { char *key_to_expire = te[i].key; /* Done early if the col expired */ if (strcmp(key_to_expire, "__expire_KEY") == 0) { expired = 1; } if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "collection_retrieve_ex: Removing key \"%s\" from collection.", key_to_expire + 9); msr_log(msr, 9, "collection_retrieve_ex: Removing key \"%s\" from collection.", key_to_expire); } apr_table_unset(col, key_to_expire + 9); apr_table_unset(col, key_to_expire); if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "collection_retrieve_ex: Removed expired variable \"%s\".", key_to_expire + 9); } break; } } } } while(!expired && (i != arr->nelts)); /* Delete the collection if the variable "KEY" does not exist. * * ENH It would probably be more efficient to hold the DBM * open until determined if it needs deleted than to open a second * time. */ if (apr_table_get(col, "KEY") == NULL) { if (existing_dbm == NULL) { rc = apr_sdbm_open(&dbm, dbm_filename, APR_CREATE | APR_WRITE | APR_SHARELOCK, CREATEMODE, msr->mp); if (rc != APR_SUCCESS) { msr_log(msr, 1, "collection_retrieve_ex: Failed to access DBM file \"%s\": %s", log_escape(msr->mp, dbm_filename), get_apr_error(msr->mp, rc)); dbm = NULL; goto cleanup; } } else { dbm = existing_dbm; } rc = apr_sdbm_delete(dbm, key); if (rc != APR_SUCCESS) { msr_log(msr, 1, "collection_retrieve_ex: Failed deleting collection (name \"%s\", " "key \"%s\"): %s", log_escape(msr->mp, col_name), log_escape_ex(msr->mp, col_key, col_key_len), get_apr_error(msr->mp, rc)); msr->msc_sdbm_delete_error = 1; goto cleanup; } if (existing_dbm == NULL) { apr_sdbm_close(dbm); dbm = NULL; } if (expired && (msr->txcfg->debuglog_level >= 9)) { msr_log(msr, 9, "collection_retrieve_ex: Collection expired (name \"%s\", key \"%s\").", col_name, log_escape_ex(msr->mp, col_key, col_key_len)); } if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "collection_retrieve_ex: Deleted collection (name \"%s\", key \"%s\").", log_escape(msr->mp, col_name), log_escape_ex(msr->mp, col_key, col_key_len)); } goto cleanup; } /* Update UPDATE_RATE */ { msc_string *var; int create_time, counter; var = (msc_string *)apr_table_get(col, "CREATE_TIME"); if (var == NULL) { /* Error. */ } else { create_time = atoi(var->value); var = (msc_string *)apr_table_get(col, "UPDATE_COUNTER"); if (var == NULL) { /* Error. */ } else { apr_time_t td; counter = atoi(var->value); /* UPDATE_RATE is removed on store, so add it back here */ var = (msc_string *)apr_pcalloc(msr->mp, sizeof(msc_string)); var->name = "UPDATE_RATE"; var->name_len = strlen(var->name); apr_table_setn(col, var->name, (void *)var); /* NOTE: No rate if there has been no time elapsed */ td = (apr_time_sec(apr_time_now()) - create_time); if (td == 0) { var->value = apr_psprintf(msr->mp, "%d", 0); } else { var->value = apr_psprintf(msr->mp, "%" APR_TIME_T_FMT, (apr_time_t)((60 * counter)/td)); } var->value_len = strlen(var->value); } } } if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "collection_retrieve_ex: Retrieved collection (name \"%s\", key \"%s\").", log_escape(msr->mp, col_name), log_escape_ex(msr->mp, col_key, col_key_len)); } if ((existing_dbm == NULL) && dbm) { /* Should not ever get here */ msr_log(msr, 1, "collection_retrieve_ex: Internal Error: Collection remained open (name \"%s\", key \"%s\").", log_escape(msr->mp, col_name), log_escape_ex(msr->mp, col_key, col_key_len)); apr_sdbm_close(dbm); } return col; cleanup: if ((existing_dbm == NULL) && dbm) { apr_sdbm_close(dbm); } return NULL; } /** * */ apr_table_t *collection_retrieve(modsec_rec *msr, const char *col_name, const char *col_key, int col_key_len) { apr_time_t time_before = apr_time_now(); apr_table_t *rtable = NULL; rtable = collection_retrieve_ex(NULL, msr, col_name, col_key, col_key_len); msr->time_storage_read += apr_time_now() - time_before; return rtable; } /** * */ int collection_store(modsec_rec *msr, apr_table_t *col) { char *dbm_filename = NULL; msc_string *var_name = NULL, *var_key = NULL; unsigned char *blob = NULL; unsigned int blob_size, blob_offset; apr_status_t rc; apr_sdbm_datum_t key; apr_sdbm_datum_t value; apr_sdbm_t *dbm = NULL; const apr_array_header_t *arr; apr_table_entry_t *te; int i; const apr_table_t *stored_col = NULL; const apr_table_t *orig_col = NULL; var_name = (msc_string *)apr_table_get(col, "__name"); if (var_name == NULL) { goto error; } var_key = (msc_string *)apr_table_get(col, "__key"); if (var_key == NULL) { goto error; } if (msr->txcfg->data_dir == NULL) { msr_log(msr, 1, "collection_store: Unable to store collection (name \"%s\", key \"%s\"). Use " "SecDataDir to define data directory first.", log_escape_ex(msr->mp, var_name->value, var_name->value_len), log_escape_ex(msr->mp, var_key->value, var_key->value_len)); goto error; } // ENH: lowercase the var name in the filename dbm_filename = apr_pstrcat(msr->mp, msr->txcfg->data_dir, "/", var_name->value, NULL); if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "collection_store: Retrieving collection (name \"%s\", filename \"%s\")",log_escape(msr->mp, var_name->value), log_escape(msr->mp, dbm_filename)); } /* Delete IS_NEW on store. */ apr_table_unset(col, "IS_NEW"); /* Delete UPDATE_RATE on store to save space as it is calculated */ apr_table_unset(col, "UPDATE_RATE"); /* Update the timeout value. */ { msc_string *var = (msc_string *)apr_table_get(col, "TIMEOUT"); if (var != NULL) { int timeout = atoi(var->value); var = (msc_string *)apr_table_get(col, "__expire_KEY"); if (var != NULL) { var->value = apr_psprintf(msr->mp, "%" APR_TIME_T_FMT, (apr_time_t)(apr_time_sec(apr_time_now()) + timeout)); var->value_len = strlen(var->value); } } } /* LAST_UPDATE_TIME */ { msc_string *var = (msc_string *)apr_table_get(col, "LAST_UPDATE_TIME"); if (var == NULL) { var = (msc_string *)apr_pcalloc(msr->mp, sizeof(msc_string)); var->name = "LAST_UPDATE_TIME"; var->name_len = strlen(var->name); apr_table_setn(col, var->name, (void *)var); } var->value = apr_psprintf(msr->mp, "%" APR_TIME_T_FMT, (apr_time_t)(apr_time_sec(apr_time_now()))); var->value_len = strlen(var->value); } /* UPDATE_COUNTER */ { msc_string *var = (msc_string *)apr_table_get(col, "UPDATE_COUNTER"); int counter = 0; if (var == NULL) { var = (msc_string *)apr_pcalloc(msr->mp, sizeof(msc_string)); var->name = "UPDATE_COUNTER"; var->name_len = strlen(var->name); apr_table_setn(col, var->name, (void *)var); } else { counter = atoi(var->value); } var->value = apr_psprintf(msr->mp, "%d", counter + 1); var->value_len = strlen(var->value); } /* ENH Make the expiration timestamp accessible in blob form so that * it is easier/faster to determine expiration without having to * convert back to table form */ rc = apr_sdbm_open(&dbm, dbm_filename, APR_CREATE | APR_WRITE | APR_SHARELOCK, CREATEMODE, msr->mp); if (rc != APR_SUCCESS) { msr_log(msr, 1, "collection_store: Failed to access DBM file \"%s\": %s", log_escape(msr->mp, dbm_filename), get_apr_error(msr->mp, rc)); dbm = NULL; goto error; } /* Need to lock to pull in the stored data again and apply deltas. */ rc = apr_sdbm_lock(dbm, APR_FLOCK_EXCLUSIVE); if (rc != APR_SUCCESS) { msr_log(msr, 1, "collection_store: Failed to exclusivly lock DBM file \"%s\": %s", log_escape(msr->mp, dbm_filename), get_apr_error(msr->mp, rc)); goto error; } /* If there is an original value, then create a delta and * apply the delta to the current value */ orig_col = (const apr_table_t *)apr_table_get(msr->collections_original, var_name->value); if (orig_col != NULL) { if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "collection_store: Re-retrieving collection prior to store: %s", apr_psprintf(msr->mp, "%.*s", var_name->value_len, var_name->value)); } stored_col = (const apr_table_t *)collection_retrieve_ex(dbm, msr, var_name->value, var_key->value, var_key->value_len); } /* Merge deltas and calculate the size first. */ blob_size = 3 + 2; arr = apr_table_elts(col); te = (apr_table_entry_t *)arr->elts; for (i = 0; i < arr->nelts; i++) { msc_string *var = (msc_string *)te[i].val; int len; /* If there is an original value, then apply the delta * to the latest stored value */ if (stored_col != NULL) { const msc_string *orig_var = (const msc_string *)apr_table_get(orig_col, var->name); if (orig_var != NULL) { const msc_string *stored_var = (const msc_string *)apr_table_get(stored_col, var->name); if (stored_var != NULL) { int origval = atoi(orig_var->value); int ourval = atoi(var->value); int storedval = atoi(stored_var->value); int delta = ourval - origval; int newval = storedval + delta; if (newval < 0) newval = 0; /* Counters never go below zero. */ var->value = apr_psprintf(msr->mp, "%d", newval); var->value_len = strlen(var->value); if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "collection_store: Delta applied for %s.%s %d->%d (%d): %d + (%d) = %d [%s,%d]", log_escape_ex(msr->mp, var_name->value, var_name->value_len), log_escape_ex(msr->mp, var->name, var->name_len), origval, ourval, delta, storedval, delta, newval, var->value, var->value_len); } } } } len = var->name_len + 1; if (len >= 65536) len = 65536; blob_size += len + 2; len = var->value_len + 1; if (len >= 65536) len = 65536; blob_size += len + 2; } /* Now generate the binary object. */ blob = apr_pcalloc(msr->mp, blob_size); if (blob == NULL) { if (dbm != NULL) { apr_sdbm_unlock(dbm); apr_sdbm_close(dbm); } return -1; } blob[0] = 0x49; blob[1] = 0x52; blob[2] = 0x01; blob_offset = 3; arr = apr_table_elts(col); te = (apr_table_entry_t *)arr->elts; for (i = 0; i < arr->nelts; i++) { msc_string *var = (msc_string *)te[i].val; int len; len = var->name_len + 1; if (len >= 65536) len = 65536; blob[blob_offset + 0] = (len & 0xff00) >> 8; blob[blob_offset + 1] = len & 0x00ff; memcpy(blob + blob_offset + 2, var->name, len - 1); blob[blob_offset + 2 + len - 1] = '\0'; blob_offset += 2 + len; len = var->value_len + 1; if (len >= 65536) len = 65536; blob[blob_offset + 0] = (len & 0xff00) >> 8; blob[blob_offset + 1] = len & 0x00ff; memcpy(blob + blob_offset + 2, var->value, len - 1); blob[blob_offset + 2 + len - 1] = '\0'; blob_offset += 2 + len; if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "collection_store: Wrote variable: name \"%s\", value \"%s\".", log_escape_ex(msr->mp, var->name, var->name_len), log_escape_ex(msr->mp, var->value, var->value_len)); } } blob[blob_offset] = 0; blob[blob_offset + 1] = 0; /* And, finally, store it. */ key.dptr = var_key->value; key.dsize = var_key->value_len + 1; value.dptr = (char *)blob; value.dsize = blob_size; rc = apr_sdbm_store(dbm, key, value, APR_SDBM_REPLACE); if (rc != APR_SUCCESS) { msr_log(msr, 1, "collection_store: Failed to write to DBM file \"%s\": %s", dbm_filename, get_apr_error(msr->mp, rc)); if (dbm != NULL) { apr_sdbm_unlock(dbm); apr_sdbm_close(dbm); } return -1; } apr_sdbm_unlock(dbm); apr_sdbm_close(dbm); if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "collection_store: Persisted collection (name \"%s\", key \"%s\").", log_escape_ex(msr->mp, var_name->value, var_name->value_len), log_escape_ex(msr->mp, var_key->value, var_key->value_len)); } return 0; error: return -1; } /** * */ int collections_remove_stale(modsec_rec *msr, const char *col_name) { char *dbm_filename = NULL; apr_sdbm_datum_t key, value; apr_sdbm_t *dbm = NULL; apr_status_t rc; apr_array_header_t *keys_arr; char **keys; apr_time_t now = apr_time_sec(msr->request_time); int i; if (msr->txcfg->data_dir == NULL) { /* The user has been warned about this problem enough times already by now. * msr_log(msr, 1, "Unable to access collection file (name \"%s\"). Use SecDataDir to " * "define data directory first.", log_escape(msr->mp, col_name)); */ goto error; } if(strstr(col_name,"USER") || strstr(col_name,"SESSION") || strstr(col_name, "RESOURCE")) dbm_filename = apr_pstrcat(msr->mp, msr->txcfg->data_dir, "/", msr->txcfg->webappid, "_", col_name, NULL); else dbm_filename = apr_pstrcat(msr->mp, msr->txcfg->data_dir, "/", col_name, NULL); if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "collections_remove_stale: Retrieving collection (name \"%s\", filename \"%s\")",log_escape(msr->mp, col_name), log_escape(msr->mp, dbm_filename)); } rc = apr_sdbm_open(&dbm, dbm_filename, APR_CREATE | APR_WRITE | APR_SHARELOCK, CREATEMODE, msr->mp); if (rc != APR_SUCCESS) { msr_log(msr, 1, "collections_remove_stale: Failed to access DBM file \"%s\": %s", log_escape(msr->mp, dbm_filename), get_apr_error(msr->mp, rc)); dbm = NULL; goto error; } /* First get a list of all keys. */ keys_arr = apr_array_make(msr->mp, 256, sizeof(char *)); rc = apr_sdbm_lock(dbm, APR_FLOCK_SHARED); if (rc != APR_SUCCESS) { msr_log(msr, 1, "collections_remove_stale: Failed to lock DBM file \"%s\": %s", log_escape(msr->mp, dbm_filename), get_apr_error(msr->mp, rc)); goto error; } /* No one can write to the file while doing this so * do it as fast as possible. */ rc = apr_sdbm_firstkey(dbm, &key); while(rc == APR_SUCCESS) { char *s = apr_pstrmemdup(msr->mp, key.dptr, key.dsize - 1); *(char **)apr_array_push(keys_arr) = s; rc = apr_sdbm_nextkey(dbm, &key); } apr_sdbm_unlock(dbm); if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "collections_remove_stale: Found %d record(s) in file \"%s\".", keys_arr->nelts, log_escape(msr->mp, dbm_filename)); } /* Now retrieve the entires one by one. */ keys = (char **)keys_arr->elts; for (i = 0; i < keys_arr->nelts; i++) { key.dptr = keys[i]; key.dsize = strlen(key.dptr) + 1; rc = apr_sdbm_fetch(dbm, &value, key); if (rc != APR_SUCCESS) { msr_log(msr, 1, "collections_remove_stale: Failed reading DBM file \"%s\": %s", log_escape(msr->mp, dbm_filename), get_apr_error(msr->mp, rc)); goto error; } if (value.dptr != NULL) { apr_table_t *col = NULL; msc_string *var = NULL; col = collection_unpack(msr, (const unsigned char *)value.dptr, value.dsize, 0); if (col == NULL) { goto error; } var = (msc_string *)apr_table_get(col, "__expire_KEY"); if (var == NULL) { msr_log(msr, 1, "collections_remove_stale: Collection cleanup discovered entry with no " "__expire_KEY (name \"%s\", key \"%s\").", log_escape(msr->mp, col_name), log_escape_ex(msr->mp, key.dptr, key.dsize - 1)); } else { unsigned int expiry_time = atoi(var->value); if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "collections_remove_stale: Record (name \"%s\", key \"%s\") set to expire in %" APR_TIME_T_FMT " seconds.", log_escape(msr->mp, col_name), log_escape_ex(msr->mp, key.dptr, key.dsize - 1), expiry_time - now); } if (expiry_time <= now) { rc = apr_sdbm_delete(dbm, key); if (rc != APR_SUCCESS) { msr_log(msr, 1, "collections_remove_stale: Failed deleting collection (name \"%s\", " "key \"%s\"): %s", log_escape(msr->mp, col_name), log_escape_ex(msr->mp, key.dptr, key.dsize - 1), get_apr_error(msr->mp, rc)); msr->msc_sdbm_delete_error = 1; goto error; } if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "collections_remove_stale: Removed stale collection (name \"%s\", " "key \"%s\").", log_escape(msr->mp, col_name), log_escape_ex(msr->mp, key.dptr, key.dsize - 1)); } } } } else { /* Ignore entry not found - it may have been removed in the meantime. */ } } apr_sdbm_close(dbm); return 1; error: if (dbm) { apr_sdbm_close(dbm); } return -1; } modsecurity-apache_2.7.7/apache2/msc_util.c0000664000175000017500000020372612253711345021136 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #include "modsecurity.h" #include #include #include #include #include #include "msc_release.h" #include "msc_util.h" #include #include "modsecurity_config.h" /** * NOTE: Be careful as these can ONLY be used on static values for X. * (i.e. VALID_HEX(c++) will NOT work) */ #define VALID_HEX(X) (((X >= '0')&&(X <= '9')) || ((X >= 'a')&&(X <= 'f')) || ((X >= 'A')&&(X <= 'F'))) #define ISODIGIT(X) ((X >= '0')&&(X <= '7')) #if (defined(WIN32) || defined(NETWARE)) /** Windows does not define all the octal modes */ #define S_IXOTH 00001 #define S_IWOTH 00002 #define S_IROTH 00004 #define S_IXGRP 00010 #define S_IWGRP 00020 #define S_IRGRP 00040 #define S_IXUSR 00100 #define S_IWUSR 00200 #define S_IRUSR 00400 #define S_ISVTX 01000 #define S_ISGID 02000 #define S_ISUID 04000 #endif /* defined(WIN32 || NETWARE) */ /* Base64 tables used in decodeBase64Ext */ static const char b64_pad = '='; static const short b64_reverse_t[256] = { -2, -2, -2, -2, -2, -2, -2, -2, -2, -1, -1, -2, -2, -1, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -1, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, 62, -2, -2, -2, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -2, -2, -2, -2, -2, -2, -2, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -2, -2, -2, -2, -2, -2, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2 }; static unsigned char *c2x(unsigned what, unsigned char *where); static unsigned char x2c(unsigned char *what); static unsigned char xsingle2c(unsigned char *what); #ifdef LINUX_S390 int swap_int32(int x) { int swap = ((x>>24)&0xff) | ((x<<8)&0xff0000) | ((x>>8)&0xff00) | ((x<<24)&0xff000000); return swap; } #endif /** \brief Decode utf-8 to unicode format. * * \param mp Pointer to memory pool * \param input Pointer to input data * \param input_len Input data length * \param changed Set if data is changed * * \retval rval On Success */ char *utf8_unicode_inplace_ex(apr_pool_t *mp, unsigned char *input, long int input_len, int *changed) { int unicode_len = 0, length = 0; unsigned int d = 0, count = 0; unsigned char c, *utf; char *rval, *data; unsigned int i, len, j; unsigned int bytes_left = input_len; unsigned char *unicode = NULL; *changed = 0; len = input_len * 7 + 1; data = rval = apr_palloc(mp, len); if (rval == NULL) return NULL; if (input == NULL) return NULL; for(i = 0; i < bytes_left;) { unicode_len = 0; d = 0; utf = (unsigned char *)&input[i]; c = *utf; /* If first byte begins with binary 0 it is single byte encoding */ if ((c & 0x80) == 0) { /* single byte unicode (7 bit ASCII equivilent) has no validation */ count++; if(count <= len) { if(c == 0) *data = x2c(&c); else *data++ = c; } } /* If first byte begins with binary 110 it is two byte encoding*/ else if ((c & 0xE0) == 0xC0) { /* check we have at least two bytes */ if (bytes_left < 2) unicode_len = UNICODE_ERROR_CHARACTERS_MISSING; /* check second byte starts with binary 10 */ else if (((*(utf + 1)) & 0xC0) != 0x80) unicode_len = UNICODE_ERROR_INVALID_ENCODING; else { unicode_len = 2; count+=6; if(count <= len) { /* compute character number */ d = ((c & 0x1F) << 6) | (*(utf + 1) & 0x3F); *data++ = '%'; *data++ = 'u'; unicode = apr_psprintf(mp, "%x", d); length = strlen(unicode); switch(length) { case 1: *data++ = '0'; *data++ = '0'; *data++ = '0'; break; case 2: *data++ = '0'; *data++ = '0'; break; case 3: *data++ = '0'; break; case 4: case 5: break; } for(j=0; j= 0xF5) { *data++ = c; } /* check we have at least four bytes */ if (bytes_left < 4) unicode_len = UNICODE_ERROR_CHARACTERS_MISSING; /* check second byte starts with binary 10 */ else if (((*(utf + 1)) & 0xC0) != 0x80) unicode_len = UNICODE_ERROR_INVALID_ENCODING; /* check third byte starts with binary 10 */ else if (((*(utf + 2)) & 0xC0) != 0x80) unicode_len = UNICODE_ERROR_INVALID_ENCODING; /* check forth byte starts with binary 10 */ else if (((*(utf + 3)) & 0xC0) != 0x80) unicode_len = UNICODE_ERROR_INVALID_ENCODING; else { unicode_len = 4; count+=7; if(count <= len) { /* compute character number */ d = ((c & 0x07) << 18) | ((*(utf + 1) & 0x3F) << 12) | ((*(utf + 2) & 0x3F) < 6) | (*(utf + 3) & 0x3F); *data++ = '%'; *data++ = 'u'; unicode = apr_psprintf(mp, "%x", d); length = strlen(unicode); switch(length) { case 1: *data++ = '0'; *data++ = '0'; *data++ = '0'; break; case 2: *data++ = '0'; *data++ = '0'; break; case 3: *data++ = '0'; break; case 4: case 5: break; } for(j=0; j= 0xD800) && (d <= 0xDFFF)) { count++; if(count <= len) *data++ = c; } /* check for overlong */ if ((unicode_len == 4) && (d < 0x010000)) { /* four byte could be represented with less bytes */ count++; if(count <= len) *data++ = c; } else if ((unicode_len == 3) && (d < 0x0800)) { /* three byte could be represented with less bytes */ count++; if(count <= len) *data++ = c; } else if ((unicode_len == 2) && (d < 0x80)) { /* two byte could be represented with less bytes */ count++; if(count <= len) *data++ = c; } if(unicode_len > 0) { i += unicode_len; } else { i++; } } *data ='\0'; return rval; } /** \brief Validate IPv4 Netmask * * \param ip_strv6 Pointer to ipv6 address * * \retval netmask_v4 On Success */ unsigned char is_netmask_v4(char *ip_strv4) { unsigned char netmask_v4 = 32; char *mask_str = NULL; int cidr; if(ip_strv4 == NULL) return netmask_v4; if ((mask_str = strchr(ip_strv4, '/'))) { *(mask_str++) = '\0'; if (strchr(mask_str, '.') != NULL) { return 0; } cidr = atoi(mask_str); if ((cidr < 0) || (cidr > 32)) { return 0; } netmask_v4 = (unsigned char)cidr; } return netmask_v4; } /** \brief Validate IPv6 Netmask * * \param ip_strv6 Pointer to ipv6 address * * \retval netmask_v6 On Success */ unsigned char is_netmask_v6(char *ip_strv6) { unsigned char netmask_v6 = 128; char *mask_str = NULL; int cidr; if(ip_strv6 == NULL) return netmask_v6; if ((mask_str = strchr(ip_strv6, '/'))) { *(mask_str++) = '\0'; if (strchr(mask_str, '.') != NULL) { return 0; } cidr = atoi(mask_str); if ((cidr < 0) || (cidr > 64)) { return 0; } netmask_v6 = (unsigned char)cidr; } return netmask_v6; } /** \brief Interpret |HEX| syntax * * \param op_parm Pointer to operator input * \param op_len Operator input lenght * \param rule Pointer to rule struct * \param error_msg Pointer to error message * * \retval string On Success */ char *parse_pm_content(const char *op_parm, unsigned short int op_len, msre_rule *rule, char **error_msg) { char *parm = NULL; char *content = NULL; unsigned short int offset = 0; char converted = 0; int i, x; unsigned char bin = 0, esc = 0, bin_offset = 0; unsigned char bin_parm[3], c = 0; char *processed = NULL; content = apr_pstrdup(rule->ruleset->mp, op_parm); if (content == NULL) { *error_msg = apr_psprintf(rule->ruleset->mp, "Error allocating memory for pattern matching content."); return NULL; } while (offset < op_len && apr_isspace(content[offset])) { offset++; }; op_len = strlen(content); if (content[offset] == '\"' && content[op_len-1] == '\"') { parm = apr_pstrdup(rule->ruleset->mp, content + offset + 1); if (parm == NULL) { *error_msg = apr_psprintf(rule->ruleset->mp, "Error allocating memory for pattern matching content."); return NULL; } parm[op_len - offset - 2] = '\0'; } else { parm = apr_pstrdup(rule->ruleset->mp, content + offset); if (parm == NULL) { *error_msg = apr_psprintf(rule->ruleset->mp, "Error allocating memory for pattern matching content."); return NULL; } } op_len = strlen(parm); if (op_len == 0) { *error_msg = apr_psprintf(rule->ruleset->mp, "Content length is 0."); return NULL; } for (i = 0, x = 0; i < op_len; i++) { if (parm[i] == '|') { if (bin) { bin = 0; } else { bin = 1; } } else if(!esc && parm[i] == '\\') { esc = 1; } else { if (bin) { if (apr_isdigit(parm[i]) || parm[i] == 'A' || parm[i] == 'a' || parm[i] == 'B' || parm[i] == 'b' || parm[i] == 'C' || parm[i] == 'c' || parm[i] == 'D' || parm[i] == 'd' || parm[i] == 'E' || parm[i] == 'e' || parm[i] == 'F' || parm[i] == 'f') { bin_parm[bin_offset] = (char)parm[i]; bin_offset++; if (bin_offset == 2) { c = strtol((char *)bin_parm, (char **) NULL, 16) & 0xFF; bin_offset = 0; parm[x] = c; x++; converted = 1; } } else if (parm[i] == ' ') { } } else if (esc) { if (parm[i] == ':' || parm[i] == ';' || parm[i] == '\\' || parm[i] == '\"') { parm[x] = parm[i]; x++; } else { *error_msg = apr_psprintf(rule->ruleset->mp, "Unsupported escape sequence."); return NULL; } esc = 0; converted = 1; } else { parm[x] = parm[i]; x++; } } } if (converted) { op_len = x; } processed = apr_pstrmemdup(rule->ruleset->mp, parm, op_len); if (processed == NULL) { *error_msg = apr_psprintf(rule->ruleset->mp, "Error allocating memory for pattern matching content."); return NULL; } return processed; } /** \brief Remove quotes * * \param mptmp Pointer to the pool * \param input Pointer to input string * \param input_len Input data length * * \retval string On Success */ char *remove_quotes(apr_pool_t *mptmp, const char *input, int input_len) { char *parm = apr_palloc(mptmp, input_len); char *ret = parm; int len = input_len; for(; *input !='\0' && len >=0; input++, len--) { if(*input != '\'' && *input != '\"') { *parm++ = *input; } } *parm = '\0'; return ret; } /** \brief Remove escape char * * \param mptmp Pointer to the pool * \param input Pointer to input string * \param input_len Input data length * * \retval string On Success */ char *remove_escape(apr_pool_t *mptmp, const char *input, int input_len) { char *parm = apr_palloc(mptmp, input_len); char *ret = parm; int len = input_len; for(; *input !='\0' && len >=0; input++, len--) { if(*input != '\\') { *parm++ = *input; } } *parm = '\0'; return ret; } /** * */ int parse_boolean(const char *input) { if (input == NULL) return -1; if (strcasecmp(input, "on") == 0) return 1; if (strcasecmp(input, "true") == 0) return 1; if (strcasecmp(input, "1") == 0) return 1; if (strcasecmp(input, "off") == 0) return 0; if (strcasecmp(input, "false") == 0) return 0; if (strcasecmp(input, "0") == 0) return 0; return -1; } /** \brief Decode Base64 data with special chars * * \param plain_text Pointer to plain text data * \param input Pointer to input data * \param input_len Input data length * * \retval 0 On failure * \retval string length On Success */ int decode_base64_ext(char *plain_text, const unsigned char *input, int input_len) { const unsigned char *encoded = input; int i = 0, j = 0, k = 0; int ch = 0; while ((ch = *encoded++) != '\0' && input_len-- > 0) { if (ch == b64_pad) { if (*encoded != '=' && (i % 4) == 1) { return 0; } continue; } ch = b64_reverse_t[ch]; if (ch < 0 || ch == -1) { continue; } else if (ch == -2) { return 0; } switch(i % 4) { case 0: plain_text[j] = ch << 2; break; case 1: plain_text[j++] |= ch >> 4; plain_text[j] = (ch & 0x0f) << 4; break; case 2: plain_text[j++] |= ch >>2; plain_text[j] = (ch & 0x03) << 6; break; case 3: plain_text[j++] |= ch; break; } i++; } k = j; if (ch == b64_pad) { switch(i % 4) { case 1: return 0; case 2: k++; case 3: plain_text[k] = 0; } } plain_text[j] = '\0'; return j; } /** \brief Convert const char to int * * \param c number string * * \retval n The converted number */ int convert_to_int(const char c) { int n; if ((c>='0') && (c<='9')) n = c - '0'; else if ((c>='A') && (c<='F')) n = c - 'A' + 10; else if ((c>='a') && (c<='f')) n = c - 'a' + 10; else n = 0; return n; } /** \brief Set a match to tx.N * * \param msr Pointer to modsec resource * \param capture If ON match will be saved * \param match Pointer to captured string *\parm tx_n The tx number to save the data * * \retval 0 On Sucess|Fail */ int set_match_to_tx(modsec_rec *msr, int capture, const char *match, int tx_n) { if (capture) { msc_string *s = (msc_string *)apr_pcalloc(msr->mp, sizeof(msc_string)); if (s == NULL) return -1; s->name = apr_psprintf(msr->mp,"%d", tx_n); s->name_len = strlen(s->name); s->value = apr_pstrdup(msr->mp, match); if (s->value == NULL) return -1; s->value_len = strlen(s->value); apr_table_setn(msr->tx_vars, s->name, (void *)s); if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Added phrase match to TX.%d: %s", tx_n, log_escape_nq_ex(msr->mp, s->value, s->value_len)); } } return 0; } /** * Parses a string that contains a name-value pair in the form "name=value". * IMP1 It does not check for whitespace between tokens. */ int parse_name_eq_value(apr_pool_t *mp, const char *input, char **name, char **value) { char *p = NULL; if ((name == NULL)||(value == NULL)) return -1; if (input == NULL) return 0; *name = NULL; *value = NULL; p = (char *)input; while((*p != '=')&&(*p != '\0')) p++; if (*p == '\0') { *name = (char *)input; return 1; } *name = apr_pstrmemdup(mp, input, p - input); if (*name == NULL) return -1; p++; *value = apr_pstrdup(mp, p); if (*value == NULL) return -1; return 1; } /** * * IMP1 Assumes NUL-terminated */ char *url_encode(apr_pool_t *mp, char *input, unsigned int input_len, int *changed) { char *rval, *d; unsigned int i, len; *changed = 0; len = input_len * 3 + 1; d = rval = apr_palloc(mp, len); if (rval == NULL) return NULL; /* ENH Only encode the characters that really need to be encoded. */ for(i = 0; i < input_len; i++) { unsigned char c = input[i]; if (c == ' ') { *d++ = '+'; *changed = 1; } else if ( (c == 42) || ((c >= 48)&&(c <= 57)) || ((c >= 65)&&(c <= 90)) || ((c >= 97)&&(c <= 122)) ) { *d++ = c; } else { *d++ = '%'; c2x(c, (unsigned char *)d); d += 2; *changed = 1; } } *d = '\0'; return rval; } /** * Appends an URL-encoded version of the source string to the * destination string, but makes sure that no more than "maxlen" * bytes are added. */ char *strnurlencat(char *destination, char *source, unsigned int maxlen) { char *s = source; char *d = destination; /* ENH Only encode the characters that really need to be encoded. */ /* Advance to the end of destination string. */ while(*d != '\0') d++; /* Loop while there's bytes in the source string or * until we reach the output limit. */ while((*s != '\0')&&(maxlen > 0)) { unsigned char c = *s; if (c == ' ') { *d++ = '+'; maxlen--; } else if ( (c == 42) || ((c >= 48)&&(c <= 57)) || ((c >= 65)&&(c <= 90)) || ((c >= 97)&&(c <= 122)) ) { *d++ = c; maxlen--; } else { if (maxlen >= 3) { *d++ = '%'; c2x(c, (unsigned char *)d); d += 2; maxlen -= 3; } else { /* If there's not enough room for the encoded * byte we ignore it. */ maxlen = 0; } } s++; } *d++ = '\0'; return destination; } /** * */ char *file_basename(apr_pool_t *mp, const char *filename) { char *d, *p; if (filename == NULL) return NULL; d = apr_pstrdup(mp, filename); if (d == NULL) return NULL; p = strrchr(d, '/'); if (p != NULL) d = p + 1; p = strrchr(d, '\\'); if (p != NULL) d = p + 1; return d; } char *m_strcasestr(const char *haystack, const char *needle) { char aux, lower_aux; int length; if ((aux = *needle++) != 0) { aux = (char)tolower((unsigned char)aux); length = strlen(needle); do { do { if ((lower_aux = *haystack++) == 0) return NULL; } while ((char)tolower((unsigned char)lower_aux) != aux); } while (strncasecmp(haystack, needle, length) != 0); haystack--; } return ((char *)haystack); } #ifdef WIN32 int my_inet_pton(int family, const char *src, void *dst) { struct addrinfo addr; struct sockaddr_in *in = NULL; #if APR_HAVE_IPV6 struct sockaddr_in6 *in6 = NULL; #endif struct addrinfo *addr_info = NULL; memset(&addr, 0, sizeof(struct addrinfo)); addr.ai_family = family; if (getaddrinfo(src, NULL, &addr, &addr_info) != 0) return -1; if (addr_info) { if (addr_info->ai_family == AF_INET) { in = (struct sockaddr_in*)addr_info->ai_addr; if(in != NULL) memcpy(dst, &in->sin_addr, 4); } #if APR_HAVE_IPV6 else if (addr_info->ai_family == AF_INET6) { in6 = (struct sockaddr_in6*)addr_info->ai_addr; if(in6 != NULL) memcpy(dst, &in6->sin6_addr, 16); } #endif else { freeaddrinfo(addr_info); return -1; } freeaddrinfo(addr_info); return 1; } return -1; } #endif /** * */ #ifdef WIN32 char *file_dirname(apr_pool_t *p, const char *filename) { char *b, *c, *d; if (filename == NULL) return NULL; b = apr_pstrdup(p, filename); if (b == NULL) return NULL; c = strrchr(b, '/'); if (c != NULL) { d = strrchr(c, '\\'); if (d != NULL) *d = '\0'; else *c = '\0'; } else { d = strrchr(b, '\\'); if (d != NULL) *d = '\0'; } return b; } #else char *file_dirname(apr_pool_t *p, const char *filename) { char *b, *c; if (filename == NULL) return NULL; b = apr_pstrdup(p, filename); if (b == NULL) return NULL; c = strrchr(b, '/'); if (c != NULL) *c = '\0'; return b; } #endif /** * */ int sql_hex2bytes_inplace(unsigned char *data, int len) { unsigned char *d, *begin = data; if ((data == NULL)||(len == 0)) return 0; for( d = data; *data; *d++ = *data++) { if ( *data != '0' ) continue; if ( tolower(*++data) != 'x' ) { data--; continue; } data++; // Do we need to keep "0x" if no hexa after? if ( !VALID_HEX(data[0]) || !VALID_HEX(data[1]) ) { data-=2; continue; } while ( VALID_HEX(data[0]) && VALID_HEX(data[1]) ) { *d++ = x2c(data); data += 2; } } *d = '\0'; return strlen((char *)begin); } /** * * */ int hex2bytes_inplace(unsigned char *data, int len) { unsigned char *d = data; int i, count = 0; if ((data == NULL)||(len == 0)) return 0; for(i = 0; i <= len - 2; i += 2) { *d++ = x2c(&data[i]); count++; } *d = '\0'; return count; } /** * Converts a series of bytes into its hexadecimal * representation. */ char *bytes2hex(apr_pool_t *pool, unsigned char *data, int len) { static const unsigned char b2hex[] = "0123456789abcdef"; char *hex = NULL; int i, j; hex = apr_palloc(pool, (len * 2) + 1); if (hex == NULL) return NULL; j = 0; for(i = 0; i < len; i++) { hex[j++] = b2hex[data[i] >> 4]; hex[j++] = b2hex[data[i] & 0x0f]; } hex[j] = 0; return hex; } /** * */ int is_token_char(unsigned char c) { /* ENH Is the performance important at all? We could use a table instead. */ /* CTLs not allowed */ if ((c <= 32)||(c >= 127)) return 0; switch(c) { case '(' : case ')' : case '<' : case '>' : case '@' : case ',' : case ';' : case ':' : case '\\' : case '"' : case '/' : case '[' : case ']' : case '?' : case '=' : return 0; } return 1; } /** * */ int remove_lf_crlf_inplace(char *text) { char *p = text; int count = 0; if (text == NULL) return -1; while(*p != '\0') { count++; p++; } if (count > 0) { if (*(p - 1) == '\n') { *(p - 1) = '\0'; if (count > 1) { if (*(p - 2) == '\r') { *(p - 2) = '\0'; } } } } return 1; } /** * Converts a byte given as its hexadecimal representation * into a proper byte. Handles uppercase and lowercase letters * but does not check for overflows. */ static unsigned char x2c(unsigned char *what) { register unsigned char digit; digit = (what[0] >= 'A' ? ((what[0] & 0xdf) - 'A') + 10 : (what[0] - '0')); digit *= 16; digit += (what[1] >= 'A' ? ((what[1] & 0xdf) - 'A') + 10 : (what[1] - '0')); return digit; } /** * Converts a single hexadecimal digit into a decimal value. */ static unsigned char xsingle2c(unsigned char *what) { register unsigned char digit; digit = (what[0] >= 'A' ? ((what[0] & 0xdf) - 'A') + 10 : (what[0] - '0')); return digit; } /** * */ char *guess_tmp_dir(apr_pool_t *p) { char *filename = NULL; /* ENH Use apr_temp_dir_get instead. */ #ifdef WIN32 filename = apr_pcalloc(p, 256); if (filename == NULL) return ""; if (GetTempPath(255, filename) != 0) return filename; #endif filename = getenv("TMPDIR"); if (filename != NULL) return filename; filename = getenv("TEMP"); if (filename != NULL) return filename; filename = getenv("TMP"); if (filename != NULL) return filename; #if defined NETWARE return("sys:/tmp/"); #elif defined WIN32 return(""); #else return("/tmp/"); #endif } /** * */ char *current_logtime(apr_pool_t *mp) { apr_time_exp_t t; char tstr[100]; apr_size_t len; apr_time_exp_lt(&t, apr_time_now()); apr_strftime(tstr, &len, 80, "%d/%b/%Y:%H:%M:%S ", &t); apr_snprintf(tstr + strlen(tstr), 80 - strlen(tstr), "%c%.2d%.2d", t.tm_gmtoff < 0 ? '-' : '+', t.tm_gmtoff / (60 * 60), (t.tm_gmtoff / 60) % 60); return apr_pstrdup(mp, tstr); } /** * */ char *current_filetime(apr_pool_t *mp) { apr_time_exp_t t; char tstr[100]; apr_size_t len; apr_time_exp_lt(&t, apr_time_now()); apr_strftime(tstr, &len, 80, "%Y%m%d-%H%M%S", &t); return apr_pstrdup(mp, tstr); } /** * */ int msc_mkstemp_ex(char *templat, int mode) { int fd = -1; /* ENH Use apr_file_mktemp instead. */ #if !(defined(WIN32)||defined(NETWARE)) fd = mkstemp(templat); #ifdef HAVE_FCHMOD if ((fd != -1) && (mode != 0)) { if (fchmod(fd, mode) == -1) { return -1; } } #endif /* HAVE_FCHMOD */ #else if (mktemp(templat) == NULL) return -1; fd = open(templat, O_WRONLY | O_APPEND | O_CREAT | O_BINARY, mode); #endif /* !(defined(WIN32)||defined(NETWARE)) */ return fd; } /** * */ int msc_mkstemp(char *templat) { return msc_mkstemp_ex(templat, CREATEMODE_UNISTD); } /** * Converts the input string to lowercase (in-place). */ char *strtolower_inplace(unsigned char *str) { unsigned char *c = str; if (str == NULL) return NULL; while(*c != 0) { *c = tolower(*c); c++; } return (char *)str; } /** * Converts a single byte into its hexadecimal representation. * Will overwrite two bytes at the destination. */ static unsigned char *c2x(unsigned what, unsigned char *where) { static const char c2x_table[] = "0123456789abcdef"; what = what & 0xff; *where++ = c2x_table[what >> 4]; *where++ = c2x_table[what & 0x0f]; return where; } static char *_log_escape(apr_pool_t *p, const unsigned char *input, unsigned long int input_length, int escape_quotes, int escape_colon, int escape_re); char *log_escape_re(apr_pool_t *mp, const char *text) { return _log_escape(mp, (const unsigned char *)text, text ? strlen(text) : 0, 1, 1, 1); } char *log_escape(apr_pool_t *mp, const char *text) { return _log_escape(mp, (const unsigned char *)text, text ? strlen(text) : 0, 1, 0, 0); } char *log_escape_nq(apr_pool_t *mp, const char *text) { #ifdef VERSION_IIS int l = 0; // this is a workaround for unknown bug that causes 'text' sometimes to lack zero-termination // __try { l = text ? strlen(text) : 0; } __except(EXCEPTION_EXECUTE_HANDLER) { l = -1; } if(l < 0) return _log_escape(mp, "BUG: see log_escape_nq()", 24, 0, 0, 0); return _log_escape(mp, (const unsigned char *)text, l, 0, 0, 0); #else return _log_escape(mp, (const unsigned char *)text, text ? strlen(text) : 0, 0, 0, 0); #endif } char *log_escape_ex(apr_pool_t *mp, const char *text, unsigned long int text_length) { return _log_escape(mp, (const unsigned char *)text, text_length, 1, 0, 0); } char *log_escape_nq_ex(apr_pool_t *mp, const char *text, unsigned long int text_length) { return _log_escape(mp, (const unsigned char *)text, text_length, 0, 0, 0); } char *log_escape_raw(apr_pool_t *mp, const unsigned char *text, unsigned long int text_length) { unsigned char *ret = apr_palloc(mp, text_length * 4 + 1); unsigned long int i, j; for (i = 0, j = 0; i < text_length; i++, j += 4) { ret[j] = '\\'; ret[j+1] = 'x'; c2x(text[i], ret+j+2); } ret[text_length * 4] = '\0'; return (char *)ret; } char *log_escape_nul(apr_pool_t *mp, const unsigned char *text, unsigned long int text_length) { unsigned char *ret = apr_palloc(mp, text_length * 4 + 1); unsigned long int i, j; for (i = 0, j = 0; i < text_length; i++) { if (text[i] == '\0') { ret[j] = '\\'; ret[j+1] = 'x'; c2x(text[i], ret+j+2); j += 4; } else { ret[j] = text[i]; j++; } } ret[j] = '\0'; return (char *)ret; } /** * Transform text to ASCII printable or hex escaped */ char *log_escape_hex(apr_pool_t *mp, const unsigned char *text, unsigned long int text_length) { unsigned char *ret = apr_palloc(mp, text_length * 4 + 1); unsigned long int i, j; for (i = 0, j = 0; i < text_length; i++) { if ( (text[i] == '"') ||(text[i] == '\\') ||(text[i] <= 0x1f) ||(text[i] >= 0x7f)) { ret[j] = '\\'; ret[j+1] = 'x'; c2x(text[i], ret+j+2); j += 4; } else { ret[j] = text[i]; j ++; } } ret[j] = '\0'; return (char *)ret; } /** * Transform input into a form safe for logging. */ static char *_log_escape(apr_pool_t *mp, const unsigned char *input, unsigned long int input_len, int escape_quotes, int escape_colon, int escape_re) { unsigned char *d = NULL; char *ret = NULL; unsigned long int i; if (input == NULL) return NULL; ret = apr_palloc(mp, input_len * 4 + 1); if (ret == NULL) return NULL; d = (unsigned char *)ret; i = 0; while(i < input_len) { switch(input[i]) { case ':' : if (escape_colon) { *d++ = '\\'; *d++ = ':'; } else { *d++ = input[i]; } break; case '"' : if (escape_quotes) { *d++ = '\\'; *d++ = '"'; } else { *d++ = input[i]; } break; case '+' : if (escape_re) { *d++ = '\\'; *d++ = '+'; } else { *d++ = input[i]; } break; case '.' : if (escape_re) { *d++ = '\\'; *d++ = '.'; } else { *d++ = input[i]; } break; case ']' : if (escape_re) { *d++ = '\\'; *d++ = ']'; } else { *d++ = input[i]; } break; case '[' : if (escape_re) { *d++ = '\\'; *d++ = '['; } else { *d++ = input[i]; } break; case '(' : if (escape_re) { *d++ = '\\'; *d++ = '('; } else { *d++ = input[i]; } break; case ')' : if (escape_re) { *d++ = '\\'; *d++ = ')'; } else { *d++ = input[i]; } break; case '?' : if (escape_re) { *d++ = '\\'; *d++ = '?'; } else { *d++ = input[i]; } break; case '/' : if (escape_re) { *d++ = '\\'; *d++ = '/'; } else { *d++ = input[i]; } break; case '\b' : *d++ = '\\'; *d++ = 'b'; break; case '\n' : *d++ = '\\'; *d++ = 'n'; break; case '\r' : *d++ = '\\'; *d++ = 'r'; break; case '\t' : *d++ = '\\'; *d++ = 't'; break; case '\v' : *d++ = '\\'; *d++ = 'v'; break; case '\\' : *d++ = '\\'; *d++ = '\\'; break; default : if ((input[i] <= 0x1f)||(input[i] >= 0x7f)) { *d++ = '\\'; *d++ = 'x'; c2x(input[i], d); d += 2; } else { *d++ = input[i]; } break; } i++; } *d = 0; return ret; } /** * JavaScript decoding. * IMP1 Assumes NUL-terminated */ int js_decode_nonstrict_inplace(unsigned char *input, long int input_len) { unsigned char *d = (unsigned char *)input; long int i, count; if (input == NULL) return -1; i = count = 0; while (i < input_len) { if (input[i] == '\\') { /* Character is an escape. */ if ( (i + 5 < input_len) && (input[i + 1] == 'u') && (VALID_HEX(input[i + 2])) && (VALID_HEX(input[i + 3])) && (VALID_HEX(input[i + 4])) && (VALID_HEX(input[i + 5])) ) { /* \uHHHH */ /* Use only the lower byte. */ *d = x2c(&input[i + 4]); /* Full width ASCII (ff01 - ff5e) needs 0x20 added */ if ( (*d > 0x00) && (*d < 0x5f) && ((input[i + 2] == 'f') || (input[i + 2] == 'F')) && ((input[i + 3] == 'f') || (input[i + 3] == 'F'))) { (*d) += 0x20; } d++; count++; i += 6; } else if ( (i + 3 < input_len) && (input[i + 1] == 'x') && VALID_HEX(input[i + 2]) && VALID_HEX(input[i + 3])) { /* \xHH */ *d++ = x2c(&input[i + 2]); count++; i += 4; } else if ((i + 1 < input_len) && ISODIGIT(input[i + 1])) { /* \OOO (only one byte, \000 - \377) */ char buf[4]; int j = 0; while((i + 1 + j < input_len)&&(j < 3)) { buf[j] = input[i + 1 + j]; j++; if (!ISODIGIT(input[i + 1 + j])) break; } buf[j] = '\0'; if (j > 0) { /* Do not use 3 characters if we will be > 1 byte */ if ((j == 3) && (buf[0] > '3')) { j = 2; buf[j] = '\0'; } *d++ = (unsigned char)strtol(buf, NULL, 8); i += 1 + j; count++; } } else if (i + 1 < input_len) { /* \C */ unsigned char c = input[i + 1]; switch(input[i + 1]) { case 'a' : c = '\a'; break; case 'b' : c = '\b'; break; case 'f' : c = '\f'; break; case 'n' : c = '\n'; break; case 'r' : c = '\r'; break; case 't' : c = '\t'; break; case 'v' : c = '\v'; break; /* The remaining (\?,\\,\',\") are just a removal * of the escape char which is default. */ } *d++ = c; i += 2; count++; } else { /* Not enough bytes */ while(i < input_len) { *d++ = input[i++]; count++; } } } else { *d++ = input[i++]; count++; } } *d = '\0'; return count; } /** * * IMP1 Assumes NUL-terminated */ int urldecode_uni_nonstrict_inplace_ex(unsigned char *input, long int input_len, int *changed) { unsigned char *d = input; long int i, count, fact, j, xv; int Code, hmap = -1; *changed = 0; if (input == NULL) return -1; i = count = 0; while (i < input_len) { if (input[i] == '%') { /* Character is a percent sign. */ if ((i + 1 < input_len)&&( (input[i + 1] == 'u')||(input[i + 1] == 'U') )) { /* IIS-specific %u encoding. */ if (i + 5 < input_len) { /* We have at least 4 data bytes. */ if ( (VALID_HEX(input[i + 2]))&&(VALID_HEX(input[i + 3])) &&(VALID_HEX(input[i + 4]))&&(VALID_HEX(input[i + 5])) ) { Code = 0; fact = 1; if (unicode_map_table != NULL && unicode_codepage > 0) { for(j=5; j>=2; j--) { if (isxdigit((input[i+j]))) { if ((input[i+j])>=97) { xv = ( (input[i+j]) - 97) + 10; } else if ( (input[i+j]) >= 65) { xv = ((input[i+j]) - 65) + 10; } else { xv = (input[i+j]) - 48; } Code += (xv * fact); fact *= 16; } } if(Code >= 0 && Code <= 65535) { hmap = unicode_map_table[Code]; } } if(hmap != -1) { *d = hmap; } else { /* We first make use of the lower byte here, ignoring the higher byte. */ *d = x2c(&input[i + 4]); /* Full width ASCII (ff01 - ff5e) needs 0x20 added */ if ( (*d > 0x00) && (*d < 0x5f) && ((input[i + 2] == 'f') || (input[i + 2] == 'F')) && ((input[i + 3] == 'f') || (input[i + 3] == 'F'))) { (*d) += 0x20; } } d++; count++; i += 6; *changed = 1; } else { /* Invalid data, skip %u. */ *d++ = input[i++]; *d++ = input[i++]; count += 2; } } else { /* Not enough bytes (4 data bytes), skip %u. */ *d++ = input[i++]; *d++ = input[i++]; count += 2; } } else { /* Standard URL encoding. */ /* Are there enough bytes available? */ if (i + 2 < input_len) { /* Yes. */ /* Decode a %xx combo only if it is valid. */ char c1 = input[i + 1]; char c2 = input[i + 2]; if (VALID_HEX(c1) && VALID_HEX(c2)) { *d++ = x2c(&input[i + 1]); count++; i += 3; *changed = 1; } else { /* Not a valid encoding, skip this % */ *d++ = input[i++]; count++; } } else { /* Not enough bytes available, skip this % */ *d++ = input[i++]; count++; } } } else { /* Character is not a percent sign. */ if (input[i] == '+') { *d++ = ' '; *changed = 1; } else { *d++ = input[i]; } count++; i++; } } *d = '\0'; return count; } /** * * IMP1 Assumes NUL-terminated */ int urldecode_nonstrict_inplace_ex(unsigned char *input, long int input_len, int *invalid_count, int *changed) { unsigned char *d = (unsigned char *)input; long int i, count; *changed = 0; if (input == NULL) return -1; i = count = 0; while (i < input_len) { if (input[i] == '%') { /* Character is a percent sign. */ /* Are there enough bytes available? */ if (i + 2 < input_len) { char c1 = input[i + 1]; char c2 = input[i + 2]; if (VALID_HEX(c1) && VALID_HEX(c2)) { /* Valid encoding - decode it. */ *d++ = x2c(&input[i + 1]); count++; i += 3; *changed = 1; } else { /* Not a valid encoding, skip this % */ *d++ = input[i++]; count ++; (*invalid_count)++; } } else { /* Not enough bytes available, copy the raw bytes. */ *d++ = input[i++]; count ++; (*invalid_count)++; } } else { /* Character is not a percent sign. */ if (input[i] == '+') { *d++ = ' '; *changed = 1; } else { *d++ = input[i]; } count++; i++; } } *d = '\0'; return count; } /** * * IMP1 Assumes NUL-terminated */ int html_entities_decode_inplace(apr_pool_t *mp, unsigned char *input, int input_len) { unsigned char *d = input; int i, count; if ((input == NULL)||(input_len <= 0)) return 0; i = count = 0; while((i < input_len)&&(count < input_len)) { int z, copy = 1; /* Require an ampersand and at least one character to * start looking into the entity. */ if ((input[i] == '&')&&(i + 1 < input_len)) { int k, j = i + 1; if (input[j] == '#') { /* Numerical entity. */ copy++; if (!(j + 1 < input_len)) goto HTML_ENT_OUT; /* Not enough bytes. */ j++; if ((input[j] == 'x')||(input[j] == 'X')) { /* Hexadecimal entity. */ copy++; if (!(j + 1 < input_len)) goto HTML_ENT_OUT; /* Not enough bytes. */ j++; /* j is the position of the first digit now. */ k = j; while((j < input_len)&&(isxdigit(input[j]))) j++; if (j > k) { /* Do we have at least one digit? */ /* Decode the entity. */ char *x = apr_pstrmemdup(mp, (const char *)&input[k], j - k); *d++ = (unsigned char)strtol(x, NULL, 16); count++; /* Skip over the semicolon if it's there. */ if ((j < input_len)&&(input[j] == ';')) i = j + 1; else i = j; continue; } else { goto HTML_ENT_OUT; } } else { /* Decimal entity. */ k = j; while((j < input_len)&&(isdigit(input[j]))) j++; if (j > k) { /* Do we have at least one digit? */ /* Decode the entity. */ char *x = apr_pstrmemdup(mp, (const char *)&input[k], j - k); *d++ = (unsigned char)strtol(x, NULL, 10); count++; /* Skip over the semicolon if it's there. */ if ((j < input_len)&&(input[j] == ';')) i = j + 1; else i = j; continue; } else { goto HTML_ENT_OUT; } } } else { /* Text entity. */ k = j; while((j < input_len)&&(isalnum(input[j]))) j++; if (j > k) { /* Do we have at least one digit? */ char *x = apr_pstrmemdup(mp, (const char *)&input[k], j - k); /* Decode the entity. */ /* ENH What about others? */ if (strcasecmp(x, "quot") == 0) *d++ = '"'; else if (strcasecmp(x, "amp") == 0) *d++ = '&'; else if (strcasecmp(x, "lt") == 0) *d++ = '<'; else if (strcasecmp(x, "gt") == 0) *d++ = '>'; else if (strcasecmp(x, "nbsp") == 0) *d++ = NBSP; else { /* We do no want to convert this entity, copy the raw data over. */ copy = j - k + 1; goto HTML_ENT_OUT; } count++; /* Skip over the semicolon if it's there. */ if ((j < input_len)&&(input[j] == ';')) i = j + 1; else i = j; continue; } } } HTML_ENT_OUT: for(z = 0; ((z < copy) && (count < input_len)); z++) { *d++ = input[i++]; count++; } } *d = '\0'; return count; } /** * * IMP1 Assumes NUL-terminated */ int ansi_c_sequences_decode_inplace(unsigned char *input, int input_len) { unsigned char *d = input; int i, count; i = count = 0; while(i < input_len) { if ((input[i] == '\\')&&(i + 1 < input_len)) { int c = -1; switch(input[i + 1]) { case 'a' : c = '\a'; break; case 'b' : c = '\b'; break; case 'f' : c = '\f'; break; case 'n' : c = '\n'; break; case 'r' : c = '\r'; break; case 't' : c = '\t'; break; case 'v' : c = '\v'; break; case '\\' : c = '\\'; break; case '?' : c = '?'; break; case '\'' : c = '\''; break; case '"' : c = '"'; break; } if (c != -1) i += 2; /* Hexadecimal or octal? */ if (c == -1) { if ((input[i + 1] == 'x')||(input[i + 1] == 'X')) { /* Hexadecimal. */ if ((i + 3 < input_len)&&(isxdigit(input[i + 2]))&&(isxdigit(input[i + 3]))) { /* Two digits. */ c = x2c(&input[i + 2]); i += 4; } else { /* Invalid encoding, do nothing. */ } } else if (ISODIGIT(input[i + 1])) { /* Octal. */ char buf[4]; int j = 0; while((i + 1 + j < input_len)&&(j < 3)) { buf[j] = input[i + 1 + j]; j++; if (!ISODIGIT(input[i + 1 + j])) break; } buf[j] = '\0'; if (j > 0) { c = strtol(buf, NULL, 8); i += 1 + j; } } } if (c == -1) { /* Didn't recognise encoding, copy raw bytes. */ *d++ = input[i + 1]; count++; i += 2; } else { /* Converted the encoding. */ *d++ = c; count++; } } else { /* Input character not a backslash, copy it. */ *d++ = input[i++]; count++; } } *d = '\0'; return count; } /** * * IMP1 Assumes NUL-terminated */ int normalize_path_inplace(unsigned char *input, int input_len, int win, int *changed) { unsigned char *src; unsigned char *dst; unsigned char *end; int ldst = 0; int hitroot = 0; int done = 0; int relative; int trailing; *changed = 0; /* Need at least one byte to normalize */ if (input_len <= 0) return 0; /* * ENH: Deal with UNC and drive letters? */ src = dst = input; end = input + (input_len - 1); ldst = 1; relative = ((*input == '/') || (win && (*input == '\\'))) ? 0 : 1; trailing = ((*end == '/') || (win && (*end == '\\'))) ? 1 : 0; while (!done && (src <= end) && (dst <= end)) { /* Convert backslash to forward slash on Windows only. */ if (win) { if (*src == '\\') { *src = '/'; *changed = 1; } if ((src < end) && (*(src + 1) == '\\')) { *(src + 1) = '/'; *changed = 1; } } /* Always normalize at the end of the input. */ if (src == end) { done = 1; } /* Skip normalization if this is NOT the end of the path segment. */ else if (*(src + 1) != '/') { goto copy; /* Skip normalization. */ } /*** Normalize the path segment. ***/ /* Could it be an empty path segment? */ if ((src != end) && *src == '/') { /* Ignore */ *changed = 1; goto copy; /* Copy will take care of this. */ } /* Could it be a back or self reference? */ else if (*src == '.') { /* Back-reference? */ if ((dst > input) && (*(dst - 1) == '.')) { /* If a relative path and either our normalization has * already hit the rootdir, or this is a backref with no * previous path segment, then mark that the rootdir was hit * and just copy the backref as no normilization is possible. */ if (relative && (hitroot || ((dst - 2) <= input))) { hitroot = 1; goto copy; /* Skip normalization. */ } /* Remove backreference and the previous path segment. */ dst -= 3; while ((dst > input) && (*dst != '/')) { dst--; } /* But do not allow going above rootdir. */ if (dst <= input) { hitroot = 1; dst = input; /* Need to leave the root slash if this * is not a relative path and the end was reached * on a backreference. */ if (!relative && (src == end)) { dst++; } } if (done) goto length; /* Skip the copy. */ src++; *changed = 1; } /* Relative Self-reference? */ else if (dst == input) { *changed = 1; /* Ignore. */ if (done) goto length; /* Skip the copy. */ src++; } /* Self-reference? */ else if (*(dst - 1) == '/') { *changed = 1; /* Ignore. */ if (done) goto length; /* Skip the copy. */ dst--; src++; } } /* Found a regular path segment. */ else if (dst > input) { hitroot = 0; } copy: /*** Copy the byte if required. ***/ /* Skip to the last forward slash when multiple are used. */ if (*src == '/') { unsigned char *oldsrc = src; while ( (src < end) && ((*(src + 1) == '/') || (win && (*(src + 1) == '\\'))) ) { src++; } if (oldsrc != src) *changed = 1; /* Do not copy the forward slash to the root * if it is not a relative path. Instead * move over the slash to the next segment. */ if (relative && (dst == input)) { src++; goto length; /* Skip the copy */ } } *(dst++) = *(src++); length: ldst = (dst - input); } /* Make sure that there is not a trailing slash in the * normalized form if there was not one in the original form. */ if (!trailing && (dst > input) && *(dst - 1) == '/') { ldst--; dst--; } /* Always NUL terminate */ *dst = '\0'; return ldst; } char *modsec_build(apr_pool_t *mp) { return apr_psprintf(mp, "%02i%02i%02i%1i%02i", atoi(MODSEC_VERSION_MAJOR), atoi(MODSEC_VERSION_MINOR), atoi(MODSEC_VERSION_MAINT), get_modsec_build_type(NULL), atoi(MODSEC_VERSION_RELEASE)); } int is_empty_string(const char *string) { unsigned int i; if (string == NULL) return 1; for(i = 0; string[i] != '\0'; i++) { if (!isspace(string[i])) { return 0; } } return 1; } char *resolve_relative_path(apr_pool_t *pool, const char *parent_filename, const char *filename) { if (filename == NULL) return NULL; // TODO Support paths on operating systems other than Unix. if (filename[0] == '/') return (char *)filename; return apr_pstrcat(pool, apr_pstrndup(pool, parent_filename, strlen(parent_filename) - strlen(apr_filepath_name_get(parent_filename))), filename, NULL); } /** * Decode a string that contains CSS-escaped characters. * * References: * http://www.w3.org/TR/REC-CSS2/syndata.html#q4 * http://www.unicode.org/roadmaps/ */ int css_decode_inplace(unsigned char *input, long int input_len) { unsigned char *d = (unsigned char *)input; long int i, j, count; if (input == NULL) return -1; i = count = 0; while (i < input_len) { /* Is the character a backslash? */ if (input[i] == '\\') { /* Is there at least one more byte? */ if (i + 1 < input_len) { i++; /* We are not going to need the backslash. */ /* Check for 1-6 hex characters following the backslash */ j = 0; while ( (j < 6) && (i + j < input_len) && (VALID_HEX(input[i + j]))) { j++; } if (j > 0) { /* We have at least one valid hexadecimal character. */ int fullcheck = 0; /* For now just use the last two bytes. */ switch (j) { /* Number of hex characters */ case 1: *d++ = xsingle2c(&input[i]); break; case 2: case 3: /* Use the last two from the end. */ *d++ = x2c(&input[i + j - 2]); break; case 4: /* Use the last two from the end, but request * a full width check. */ *d = x2c(&input[i + j - 2]); fullcheck = 1; break; case 5: /* Use the last two from the end, but request * a full width check if the number is greater * or equal to 0xFFFF. */ *d = x2c(&input[i + j - 2]); /* Do full check if first byte is 0 */ if (input[i] == '0') { fullcheck = 1; } else { d++; } break; case 6: /* Use the last two from the end, but request * a full width check if the number is greater * or equal to 0xFFFF. */ *d = x2c(&input[i + j - 2]); /* Do full check if first/second bytes are 0 */ if ( (input[i] == '0') && (input[i + 1] == '0') ) { fullcheck = 1; } else { d++; } break; } /* Full width ASCII (0xff01 - 0xff5e) needs 0x20 added */ if (fullcheck) { if ( (*d > 0x00) && (*d < 0x5f) && ((input[i + j - 3] == 'f') || (input[i + j - 3] == 'F')) && ((input[i + j - 4] == 'f') || (input[i + j - 4] == 'F'))) { (*d) += 0x20; } d++; } /* We must ignore a single whitespace after a hex escape */ if ((i + j < input_len) && isspace(input[i + j])) { j++; } /* Move over. */ count++; i += j; } /* No hexadecimal digits after backslash */ else if (input[i] == '\n') { /* A newline character following backslash is ignored. */ i++; } /* The character after backslash is not a hexadecimal digit, nor a newline. */ else { /* Use one character after backslash as is. */ *d++ = input[i++]; count++; } } /* No characters after backslash. */ else { /* Do not include backslash in output (continuation to nothing) */ i++; } } /* Character is not a backslash. */ else { /* Copy one normal character to output. */ *d++ = input[i++]; count++; } } /* Terminate output string. */ *d = '\0'; return count; } /** * Translate UNIX octal umask/mode to APR apr_fileperms_t */ apr_fileperms_t mode2fileperms(int mode) { apr_fileperms_t perms = 0; if (mode & S_IXOTH) perms |= APR_WEXECUTE; if (mode & S_IWOTH) perms |= APR_WWRITE; if (mode & S_IROTH) perms |= APR_WREAD; if (mode & S_IXGRP) perms |= APR_GEXECUTE; if (mode & S_IWGRP) perms |= APR_GWRITE; if (mode & S_IRGRP) perms |= APR_GREAD; if (mode & S_IXUSR) perms |= APR_UEXECUTE; if (mode & S_IWUSR) perms |= APR_UWRITE; if (mode & S_IRUSR) perms |= APR_UREAD; if (mode & S_ISVTX) perms |= APR_WSTICKY; if (mode & S_ISGID) perms |= APR_GSETID; if (mode & S_ISUID) perms |= APR_USETID; return perms; } /** * Generate a single variable. */ char *construct_single_var(modsec_rec *msr, char *name) { char *varname = NULL; char *param = NULL; msre_var *var = NULL; msre_var *vx = NULL; char *my_error_msg = NULL; /* Extract variable name and its parameter from the script. */ varname = apr_pstrdup(msr->mp, name); param = strchr(varname, '.'); if (param != NULL) { *param = '\0'; param++; } /* Resolve variable. */ var = msre_create_var_ex(msr->mp, msr->modsecurity->msre, varname, param, msr, &my_error_msg); if (var == NULL) return NULL; /* Generate variable. */ vx = generate_single_var(msr, var, NULL, NULL, msr->msc_rule_mptmp); if (vx == NULL) return NULL; return (char *)vx->value; } modsecurity-apache_2.7.7/apache2/msc_lua.c0000664000175000017500000003112512243422537020733 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #if defined(WITH_LUA) #include "msc_lua.h" #include "apr_strings.h" typedef struct { apr_array_header_t *parts; apr_pool_t *pool; } msc_lua_dumpw_t; typedef struct { msc_script *script; int index; } msc_lua_dumpr_t; /** * */ static const char* dump_reader(lua_State* L, void* user_data, size_t* size) { msc_lua_dumpr_t *dumpr = (msc_lua_dumpr_t *)user_data; msc_script_part *part; /* Do we have more chunks to return? */ if (dumpr->index == dumpr->script->parts->nelts) { return NULL; } /* Get one chunk. */ part = ((msc_script_part **)dumpr->script->parts->elts)[dumpr->index]; *size = part->len; dumpr->index++; return part->data; } /** * */ static int dump_writer(lua_State *L, const void* data, size_t len, void* user_data) { msc_lua_dumpw_t *dump = (msc_lua_dumpw_t *)user_data; msc_script_part *part; void *part_data; /* Allocate new part, copy the data into it. */ part_data = apr_palloc(dump->pool, len); memcpy(part_data, data, len); part = apr_palloc(dump->pool, sizeof(msc_script_part)); part->data = part_data; part->len = len; /* Then add it to the list of parsts. */ *(const msc_script_part **)apr_array_push(dump->parts) = part; return 0; } /** * */ static int lua_restore(lua_State *L, msc_script *script) { msc_lua_dumpr_t dumpr; dumpr.script = script; dumpr.index = 0; #if LUA_VERSION_NUM > 501 return lua_load(L, dump_reader, &dumpr, script->name, NULL); #else return lua_load(L, dump_reader, &dumpr, script->name); #endif } /** * */ char *lua_compile(msc_script **script, const char *filename, apr_pool_t *pool) { lua_State *L = NULL; msc_lua_dumpw_t dump; /* Initialise state. */ #if LUA_VERSION_NUM > 501 L = luaL_newstate(); #else L = lua_open(); #endif luaL_openlibs(L); /* Find script. */ if (luaL_loadfile(L, filename)) { return apr_psprintf(pool, "ModSecurity: Failed to compile script %s: %s", filename, lua_tostring(L, -1)); } /* Dump the script into binary form. */ dump.pool = pool; dump.parts = apr_array_make(pool, 128, sizeof(msc_script_part *)); lua_dump(L, dump_writer, &dump); (*script) = apr_pcalloc(pool, sizeof(msc_script)); (*script)->name = filename; (*script)->parts = dump.parts; /* Destroy state. */ lua_close(L); return NULL; } /** * */ static int l_log(lua_State *L) { modsec_rec *msr = NULL; const char *text; int level; /* Retrieve parameters. */ level = luaL_checknumber(L, 1); text = luaL_checkstring(L, 2); /* Retrieve msr. */ lua_getglobal(L, "__msr"); msr = (modsec_rec *)lua_topointer(L, -1); /* Log message. */ if (msr != NULL) { msr_log(msr, level, "%s", text); } return 0; } /** * */ static apr_array_header_t *resolve_tfns(lua_State *L, int idx, modsec_rec *msr, apr_pool_t *mp) { apr_array_header_t *tfn_arr = NULL; msre_tfn_metadata *tfn = NULL; char *name = NULL; tfn_arr = apr_array_make(mp, 25, sizeof(msre_tfn_metadata *)); if (tfn_arr == NULL) return NULL; /* ENH: Why is this userdata and not none/nil when parameter not given? */ if (lua_isuserdata(L, idx) || lua_isnoneornil(L, idx)) { /* No second parameter */ return tfn_arr; } else if (lua_istable(L, idx)) { /* Is the second parameter an array? */ #if LUA_VERSION_NUM > 501 int i, n = lua_rawlen(L, idx); #else int i, n = lua_objlen(L, idx); #endif for(i = 1; i <= n; i++) { lua_rawgeti(L, idx, i); name = (char *)luaL_checkstring(L, -1); /* A "none" means start over */ if (strcmp("none", name) == 0) { tfn_arr->nelts = 0; continue; } tfn = msre_engine_tfn_resolve(msr->modsecurity->msre, name); if (tfn == NULL) { msr_log(msr, 1, "SecRuleScript: Invalid transformation function: %s", name); } else { *(msre_tfn_metadata **)apr_array_push(tfn_arr) = tfn; } } } else if (lua_isstring(L, idx)) { /* The second parameter may be a simple string? */ name = (char *)luaL_checkstring(L, idx); /* A "none" means start over */ if (strcmp("none", name) == 0) { tfn_arr->nelts = 0; } else { tfn = msre_engine_tfn_resolve(msr->modsecurity->msre, name); if (tfn == NULL) { msr_log(msr, 1, "SecRuleScript: Invalid transformation function: %s", name); } else { *(msre_tfn_metadata **)apr_array_push(tfn_arr) = tfn; } } } else { msr_log(msr, 1, "SecRuleScript: Transformation parameter must be a transformation name or array of transformation names, but found \"%s\" (type %d).", lua_typename(L, idx), lua_type(L, idx)); return NULL; } return tfn_arr; } /** * */ static int l_getvar(lua_State *L) { char *varname = NULL, *param = NULL; modsec_rec *msr = NULL; msre_rule *rule = NULL; char *my_error_msg = NULL; char *p1 = NULL; apr_array_header_t *tfn_arr = NULL; msre_var *vx = NULL; msre_var *var; /* Retrieve parameters. */ p1 = (char *)luaL_checkstring(L, 1); /* Retrieve msr. */ lua_getglobal(L, "__msr"); msr = (modsec_rec *)lua_topointer(L, -1); /* Retrieve rule. */ lua_getglobal(L, "__rule"); rule = (msre_rule *)lua_topointer(L, -1); /* Extract the variable name and its parameter from the script. */ varname = apr_pstrdup(msr->msc_rule_mptmp, p1); param = strchr(varname, '.'); if (param != NULL) { *param = '\0'; param++; } /* Resolve variable. */ var = msre_create_var_ex(msr->msc_rule_mptmp, msr->modsecurity->msre, varname, param, msr, &my_error_msg); if (var == NULL) { msr_log(msr, 1, "%s", my_error_msg); lua_pushnil(L); return 0; } /* Resolve transformation functions. */ tfn_arr = resolve_tfns(L, 2, msr, msr->msc_rule_mptmp); /* Generate variable. */ vx = generate_single_var(msr, var, tfn_arr, rule, msr->msc_rule_mptmp); if (vx == NULL) { lua_pushnil(L); return 0; } /* Return variable value. */ lua_pushlstring(L, vx->value, vx->value_len); return 1; } /** * */ static int l_getvars(lua_State *L) { const apr_array_header_t *tarr; const apr_table_entry_t *telts; apr_table_t *vartable = NULL; apr_array_header_t *tfn_arr = NULL; char *varname = NULL, *param = NULL; modsec_rec *msr = NULL; msre_rule *rule = NULL; msre_var *vartemplate = NULL; char *my_error_msg = NULL; char *p1 = NULL; int i; /* Retrieve parameters. */ p1 = (char *)luaL_checkstring(L, 1); /* Retrieve msr. */ lua_getglobal(L, "__msr"); msr = (modsec_rec *)lua_topointer(L, -1); /* Retrieve rule. */ lua_getglobal(L, "__rule"); rule = (msre_rule *)lua_topointer(L, -1); /* Extract the variable name and its parameter from the script. */ varname = apr_pstrdup(msr->msc_rule_mptmp, p1); param = strchr(varname, '.'); if (param != NULL) { *param = '\0'; param++; } /* Resolve transformation functions. */ tfn_arr = resolve_tfns(L, 2, msr, msr->msc_rule_mptmp); lua_newtable(L); /* Resolve variable. */ vartemplate = msre_create_var_ex(msr->msc_rule_mptmp, msr->modsecurity->msre, varname, param, msr, &my_error_msg); if (vartemplate == NULL) { msr_log(msr, 1, "%s", my_error_msg); /* Returning empty table. */ return 1; } vartable = generate_multi_var(msr, vartemplate, tfn_arr, rule, msr->msc_rule_mptmp); tarr = apr_table_elts(vartable); telts = (const apr_table_entry_t*)tarr->elts; for (i = 0; i < tarr->nelts; i++) { msre_var *var = (msre_var *)telts[i].val; lua_pushnumber(L, i + 1); /* Index is not zero-based. */ lua_newtable(L); /* Per-parameter table. */ lua_pushstring(L, "name"); lua_pushlstring(L, var->name, strlen(var->name)); lua_settable(L, -3); lua_pushstring(L, "value"); lua_pushlstring(L, var->value, var->value_len); lua_settable(L, -3); lua_settable(L, -3); /* Push one parameter into the results table. */ } return 1; } /* * \brief New setvar function for Lua API. Users can put back * data in modsecurity core via new variables * * \param L Pointer to Lua state * * \retval -1 On failure * \retval 0 On Collection failure * \retval 1 On Success */ static int l_setvar(lua_State *L) { modsec_rec *msr = NULL; msre_rule *rule = NULL; const char *var_value = NULL; const char *var_name = NULL; int nargs = lua_gettop(L); char *chr = NULL; lua_getglobal(L, "__msr"); msr = (modsec_rec *)lua_topointer(L, -1); lua_getglobal(L, "__rule"); rule = (msre_rule *)lua_topointer(L, -1); if(nargs != 2) { msr_log(msr, 8, "m.setvar: Failed m.setvar funtion must has 2 arguments"); return -1; } var_value = luaL_checkstring (L, 2); var_name = luaL_checkstring (L, 1); lua_pop(L,2); if(var_value == NULL || var_name == NULL) return -1; chr = strchr((char *)var_name,0x2e); if(chr == NULL) { msr_log(msr, 8, "m.setvar: Must specify a collection using dot character - ie m.setvar(tx.myvar,mydata)"); return -1; } return msre_action_setvar_execute(msr,msr->msc_rule_mptmp,rule,(char *)var_name,(char *)var_value); } static const struct luaL_Reg mylib[] = { { "log", l_log }, { "getvar", l_getvar }, { "getvars", l_getvars }, { "setvar", l_setvar }, { NULL, NULL } }; /** * */ int lua_execute(msc_script *script, char *param, modsec_rec *msr, msre_rule *rule, char **error_msg) { apr_time_t time_before; lua_State *L = NULL; int rc = 0; if (error_msg == NULL) return -1; *error_msg = NULL; if (msr->txcfg->debuglog_level >= 8) { msr_log(msr, 8, "Lua: Executing script: %s", script->name); } time_before = apr_time_now(); #ifdef CACHE_LUA L = msr->L; rc = lua_gettop(L); if(rc) lua_pop(L, rc); #else /* Create new state. */ #if LUA_VERSION_NUM > 501 L = luaL_newstate(); #else L = lua_open(); #endif luaL_openlibs(L); #endif if(L == NULL) return -1; /* Associate msr with the state. */ lua_pushlightuserdata(L, (void *)msr); lua_setglobal(L, "__msr"); /* Associate rule with the state. */ if (rule != NULL) { lua_pushlightuserdata(L, (void *)rule); lua_setglobal(L, "__rule"); } /* Register functions. */ #if LUA_VERSION_NUM > 501 luaL_setfuncs(L,mylib,0); lua_setglobal(L,"m"); #else luaL_register(L, "m", mylib); #endif rc = lua_restore(L, script); if (rc) { *error_msg = apr_psprintf(msr->mp, "Lua: Failed to restore script with %i.", rc); return -1; } /* Execute the chunk so that the functions are defined. */ lua_pcall(L, 0, 0, 0); /* Execute main() */ lua_getglobal(L, "main"); /* Put the parameter on the stack. */ if (param != NULL) { lua_pushlstring(L, param, strlen(param)); } if (lua_pcall(L, ((param != NULL) ? 1 : 0), 1, 0)) { *error_msg = apr_psprintf(msr->mp, "Lua: Script execution failed: %s", lua_tostring(L, -1)); if (msr->txcfg->debuglog_level >= 8) { msr_log(msr, 8, "Lua: Script execution failed: %s", lua_tostring(L, -1)); } return -1; } /* Get the response from the script. */ *error_msg = (char *)lua_tostring(L, -1); if (*error_msg != NULL) { *error_msg = apr_pstrdup(msr->mp, *error_msg); } /* Destroy state. */ lua_pop(L, 1); #ifndef CACHE_LUA lua_close(L); #endif /* Returns status code to caller. */ if (msr->txcfg->debuglog_level >= 8) { msr_log(msr, 8, "Lua: Script completed in %" APR_TIME_T_FMT " usec, returning: %s.", (apr_time_now() - time_before), *error_msg); } return ((*error_msg != NULL) ? RULE_MATCH : RULE_NO_MATCH); } #endif /* WITH_LUA */ modsecurity-apache_2.7.7/apache2/msc_xml.h0000664000175000017500000000224612243422537020761 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #ifndef _MSC_XML_H_ #define _MSC_XML_H_ typedef struct xml_data xml_data; #include "modsecurity.h" #include #include /* Structures */ struct xml_data { xmlSAXHandler *sax_handler; xmlParserCtxtPtr parsing_ctx; xmlDocPtr doc; unsigned int well_formed; }; /* Functions */ int DSOLOCAL xml_init(modsec_rec *msr, char **error_msg); int DSOLOCAL xml_process_chunk(modsec_rec *msr, const char *buf, unsigned int size, char **error_msg); int DSOLOCAL xml_complete(modsec_rec *msr, char **error_msg); apr_status_t DSOLOCAL xml_cleanup(modsec_rec *msr); #endif modsecurity-apache_2.7.7/apache2/re.h0000664000175000017500000003515612252634762017740 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #ifndef _MSC_RE_H_ #define _MSC_RE_H_ #define ABSOLUTE_VALUE 0 #define POSITIVE_VALUE 1 #define NEGATIVE_VALUE 2 typedef struct msre_ipmatch msre_ipmatch; typedef struct msre_engine msre_engine; typedef struct msre_ruleset msre_ruleset; typedef struct msre_ruleset_internal msre_ruleset_internal; typedef struct msre_rule msre_rule; typedef struct msre_var_metadata msre_var_metadata; typedef struct msre_var msre_var; typedef struct msre_op_metadata msre_op_metadata; typedef struct msre_tfn_metadata msre_tfn_metadata; typedef struct msre_actionset msre_actionset; typedef struct msre_action_metadata msre_action_metadata; typedef struct msre_action msre_action; typedef struct msre_reqbody_processor_metadata msre_reqbody_processor_metadata; typedef struct msre_cache_rec msre_cache_rec; #include "apr_general.h" #include "apr_tables.h" #include "modsecurity.h" #include "msc_pcre.h" #include "persist_dbm.h" #include "apache2.h" #include "http_config.h" #if defined(WITH_LUA) #include "msc_lua.h" #endif /* Actions, variables, functions and operator functions */ char DSOLOCAL *update_rule_target_ex(modsec_rec *msr, msre_ruleset *ruleset, msre_rule *rule, const char *p2, const char *p3); int DSOLOCAL msre_ruleset_rule_matches_exception(msre_rule *rule, rule_exception *re); char DSOLOCAL *msre_ruleset_rule_update_target_matching_exception(modsec_rec *msr, msre_ruleset *ruleset, rule_exception *re, const char *p2, const char *p3); char DSOLOCAL *msre_ruleset_phase_rule_update_target_matching_exception(modsec_rec *msr, msre_ruleset *ruleset, rule_exception *re, apr_array_header_t *phase_arr, const char *p2, const char *p3); apr_status_t DSOLOCAL collection_original_setvar(modsec_rec *msr, const char *col_name, const msc_string *orig_var); int DSOLOCAL expand_macros(modsec_rec *msr, msc_string *var, msre_rule *rule, apr_pool_t *mptmp); msre_var_metadata DSOLOCAL *msre_resolve_var(msre_engine *engine, const char *name); msre_var DSOLOCAL *msre_create_var_ex(apr_pool_t *pool, msre_engine *engine, const char *name, const char *param, modsec_rec *msr, char **error_msg); int DSOLOCAL msre_parse_generic(apr_pool_t *pool, const char *text, apr_table_t *vartable, char **error_msg); int DSOLOCAL rule_id_in_range(int ruleid, const char *range); msre_var DSOLOCAL *generate_single_var(modsec_rec *msr, msre_var *var, apr_array_header_t *tfn_arr, msre_rule *rule, apr_pool_t *mptmp); #if defined(WITH_LUA) apr_table_t DSOLOCAL *generate_multi_var(modsec_rec *msr, msre_var *var, apr_array_header_t *tfn_arr, msre_rule *rule, apr_pool_t *mptmp); #endif /* Structures with the corresponding functions */ struct msre_engine { apr_pool_t *mp; apr_table_t *variables; apr_table_t *operators; apr_table_t *actions; apr_table_t *tfns; apr_table_t *reqbody_processors; }; msre_engine DSOLOCAL *msre_engine_create(apr_pool_t *parent_pool); void DSOLOCAL msre_engine_destroy(msre_engine *engine); msre_op_metadata DSOLOCAL *msre_engine_op_resolve(msre_engine *engine, const char *name); struct msre_ruleset { apr_pool_t *mp; msre_engine *engine; apr_array_header_t *phase_request_headers; apr_array_header_t *phase_request_body; apr_array_header_t *phase_response_headers; apr_array_header_t *phase_response_body; apr_array_header_t *phase_logging; }; apr_status_t DSOLOCAL msre_ruleset_process_phase(msre_ruleset *ruleset, modsec_rec *msr); apr_status_t DSOLOCAL msre_ruleset_process_phase_internal(msre_ruleset *ruleset, modsec_rec *msr); msre_ruleset DSOLOCAL *msre_ruleset_create(msre_engine *engine, apr_pool_t *mp); int DSOLOCAL msre_ruleset_rule_add(msre_ruleset *ruleset, msre_rule *rule, int phase); msre_rule DSOLOCAL *msre_ruleset_fetch_rule(msre_ruleset *ruleset, const char *id, int offset); int DSOLOCAL msre_ruleset_rule_remove_with_exception(msre_ruleset *ruleset, rule_exception *re); /* int DSOLOCAL msre_ruleset_phase_rule_remove_with_exception(msre_ruleset *ruleset, rule_exception *re, apr_array_header_t *phase_arr); */ #define RULE_NO_MATCH 0 #define RULE_MATCH 1 #define RULE_PH_NONE 0 /* Not a placeholder */ #define RULE_PH_SKIPAFTER 1 /* Implicit placeholder for skipAfter */ #define RULE_PH_MARKER 2 /* Explicit placeholder for SecMarker */ #define RULE_TYPE_NORMAL 0 /* SecRule */ #define RULE_TYPE_ACTION 1 /* SecAction */ #define RULE_TYPE_MARKER 2 /* SecMarker */ #if defined(WITH_LUA) #define RULE_TYPE_LUA 3 /* SecRuleScript */ #endif struct msre_ipmatch { apr_ipsubnet_t *ipsubnet; const char * address; struct msre_ipmatch *next; }; struct msre_rule { apr_array_header_t *targets; const char *op_name; const char *op_param; void *op_param_data; msre_op_metadata *op_metadata; unsigned int op_negated; msre_actionset *actionset; const char *p1; const char *unparsed; const char *filename; int line_num; int placeholder; int type; msre_ruleset *ruleset; msre_rule *chain_starter; #if defined(PERFORMANCE_MEASUREMENT) unsigned int execution_time; unsigned int trans_time; unsigned int op_time; #endif #if defined(WITH_LUA) /* Compiled Lua script. */ msc_script *script; #endif #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER > 0 ap_regex_t *sub_regex; #else regex_t *sub_regex; #endif char *sub_str; char *re_str; int re_precomp; int escape_re; msre_ipmatch *ip_op; }; char DSOLOCAL *msre_rule_generate_unparsed(apr_pool_t *pool, const msre_rule *rule, const char *targets, const char *args, const char *actions); msre_rule DSOLOCAL *msre_rule_create(msre_ruleset *ruleset, int type, const char *fn, int line, const char *targets, const char *args, const char *actions, char **error_msg); #if defined(WITH_LUA) msre_rule DSOLOCAL *msre_rule_lua_create(msre_ruleset *ruleset, const char *fn, int line, const char *script_filename, const char *actions, char **error_msg); #endif #define VAR_SIMPLE 0 /* REQUEST_URI */ #define VAR_LIST 1 #define PHASE_REQUEST_HEADERS 1 #define PHASE_REQUEST_BODY 2 #define PHASE_RESPONSE_HEADERS 3 #define PHASE_RESPONSE_BODY 4 #define PHASE_LOGGING 5 typedef int (*fn_op_param_init_t)(msre_rule *rule, char **error_msg); typedef int (*fn_op_execute_t)(modsec_rec *msr, msre_rule *rule, msre_var *var, char **error_msg); struct msre_op_metadata { const char *name; fn_op_param_init_t param_init; fn_op_execute_t execute; }; typedef int (*fn_tfn_execute_t)(apr_pool_t *pool, unsigned char *input, long int input_length, char **rval, long int *rval_length); struct msre_tfn_metadata { const char *name; /* Functions should populate *rval and return 1 on * success, or return -1 on failure (in which case *rval * should contain the error message. Strict functions * (those that validate in * addition to transforming) can return 0 when input * fails validation. Functions are free to perform * in-place transformation, or to allocate a new buffer * from the provideded temporary (per-rule) memory pool. * * NOTE Strict transformation functions not supported yet. */ fn_tfn_execute_t execute; }; void DSOLOCAL msre_engine_tfn_register(msre_engine *engine, const char *name, fn_tfn_execute_t execute); void DSOLOCAL msre_engine_op_register(msre_engine *engine, const char *name, fn_op_param_init_t fn1, fn_op_execute_t fn2); void DSOLOCAL msre_engine_register_default_tfns(msre_engine *engine); void DSOLOCAL msre_engine_register_default_variables(msre_engine *engine); void DSOLOCAL msre_engine_register_default_operators(msre_engine *engine); void DSOLOCAL msre_engine_register_default_actions(msre_engine *engine); msre_tfn_metadata DSOLOCAL *msre_engine_tfn_resolve(msre_engine *engine, const char *name); #define VAR_DONT_CACHE 0 #define VAR_CACHE 1 typedef char *(*fn_var_validate_t)(msre_ruleset *ruleset, msre_var *var); typedef int (*fn_var_generate_t)(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *table, apr_pool_t *mptmp); struct msre_var_metadata { const char *name; unsigned int type; /* VAR_TYPE_ constants */ unsigned int argc_min; unsigned int argc_max; fn_var_validate_t validate; fn_var_generate_t generate; unsigned int is_cacheable; /* 0 - no, 1 - yes */ unsigned int availability; /* when does this variable become available? */ }; struct msre_var { char *name; const char *value; unsigned int value_len; char *param; const void *param_data; msre_var_metadata *metadata; msc_regex_t *param_regex; unsigned int is_negated; unsigned int is_counting; }; struct msre_actionset { apr_table_t *actions; /* Metadata */ const char *id; const char *rev; const char *msg; const char *logdata; const char *version; int maturity; int accuracy; int severity; int phase; msre_rule *rule; int arg_min; int arg_max; /* Flow */ int is_chained; int skip_count; const char *skip_after; /* Disruptive */ int intercept_action; const char *intercept_uri; int intercept_status; const char *intercept_pause; /* "block" needs parent action to reset it */ msre_action *parent_intercept_action_rec; msre_action *intercept_action_rec; int parent_intercept_action; /* Other */ int log; int auditlog; int block; }; void DSOLOCAL msre_engine_variable_register(msre_engine *engine, const char *name, unsigned int type, unsigned int argc_min, unsigned int argc_max, fn_var_validate_t validate, fn_var_generate_t generate, unsigned int is_cacheable, unsigned int availability); msre_actionset DSOLOCAL *msre_actionset_create(msre_engine *engine, const char *text, char **error_msg); msre_actionset DSOLOCAL *msre_actionset_merge(msre_engine *engine, msre_actionset *parent, msre_actionset *child, int inherit_by_default); msre_actionset DSOLOCAL *msre_actionset_create_default(msre_engine *engine); void DSOLOCAL msre_actionset_set_defaults(msre_actionset *actionset); void DSOLOCAL msre_actionset_init(msre_actionset *actionset, msre_rule *rule); typedef char *(*fn_action_validate_t)(msre_engine *engine, msre_action *action); typedef apr_status_t (*fn_action_init_t)(msre_engine *engine, msre_actionset *actionset, msre_action *action); typedef apr_status_t (*fn_action_execute_t)(modsec_rec *msr, apr_pool_t *mptmp, msre_rule *rule, msre_action *action); #define ACTION_DISRUPTIVE 1 #define ACTION_NON_DISRUPTIVE 2 #define ACTION_METADATA 3 #define ACTION_FLOW 4 #define NO_PLUS_MINUS 0 #define ALLOW_PLUS_MINUS 1 #define ACTION_CARDINALITY_ONE 1 #define ACTION_CARDINALITY_MANY 2 #define ACTION_CGROUP_NONE 0 #define ACTION_CGROUP_DISRUPTIVE 1 #define ACTION_CGROUP_LOG 2 #define ACTION_CGROUP_AUDITLOG 3 struct msre_action_metadata { const char *name; unsigned int type; unsigned int argc_min; unsigned int argc_max; unsigned int allow_param_plusminus; unsigned int cardinality; unsigned int cardinality_group; fn_action_validate_t validate; fn_action_init_t init; fn_action_execute_t execute; }; struct msre_action { msre_action_metadata *metadata; const char *param; const void *param_data; unsigned int param_plusminus; /* ABSOLUTE_VALUE, POSITIVE_VALUE, NEGATIVE_VALUE */ }; void DSOLOCAL msre_engine_reqbody_processor_register(msre_engine *engine, const char *name, void *fn_init, void *fn_process, void *fn_complete); typedef int (*fn_reqbody_processor_init_t)(modsec_rec *msr, char **error_msg); typedef int (*fn_reqbody_processor_process_t)(modsec_rec *msr, const char *buf, unsigned int size, char **error_msg); typedef int (*fn_reqbody_processor_complete_t)(modsec_rec *msr, char **error_msg); struct msre_reqbody_processor_metadata { const char *name; fn_reqbody_processor_init_t init; fn_reqbody_processor_process_t process; fn_reqbody_processor_complete_t complete; }; /* -- MSRE Function Prototypes ---------------------------------------------- */ msre_var_metadata DSOLOCAL *msre_resolve_var(msre_engine *engine, const char *name); int DSOLOCAL msre_parse_generic(apr_pool_t *pool, const char *text, apr_table_t *vartable, char **error_msg); apr_status_t DSOLOCAL msre_parse_vars(msre_ruleset *ruleset, const char *text, apr_array_header_t *arr, char **error_msg); char DSOLOCAL *msre_format_metadata(modsec_rec *msr, msre_actionset *actionset); /* -- Data Cache -- */ struct msre_cache_rec { int hits; int changed; int num; const char *path; const char *val; apr_size_t val_len; }; #endif modsecurity-apache_2.7.7/apache2/msc_crypt.c0000664000175000017500000016701612243422537021324 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #include "msc_crypt.h" #include "msc_util.h" #include "apr_sha1.h" #include "apr_uri.h" #include "apr_base64.h" #include "acmp.h" #include "libxml/HTMLtree.h" #include "libxml/uri.h" #include /** * \brief Normalize path in URI * * \param msr ModSecurity transaction resource * \param input The URI to be normalized * * \retval input normalized input * \retval NULL on fail */ char *normalize_path(modsec_rec *msr, char *input) { xmlURI *uri = NULL; char *parsed_content = NULL; char *content = NULL; if(msr == NULL) return NULL; if(input == NULL) return NULL; uri = xmlParseURI(input); if(uri != NULL && uri->path) { if(uri->scheme) { content = apr_psprintf(msr->mp, "%s://", uri->scheme); parsed_content = apr_pstrcat(msr->mp, content, NULL); } if(uri->server) { content = apr_psprintf(msr->mp, "%s", uri->server); if(parsed_content) parsed_content = apr_pstrcat(msr->mp, parsed_content, content, NULL); else parsed_content = apr_pstrcat(msr->mp, content, NULL); } if(uri->port) { content = apr_psprintf(msr->mp, ":%d", uri->port); if(parsed_content) parsed_content = apr_pstrcat(msr->mp, parsed_content, content, NULL); else parsed_content = apr_pstrcat(msr->mp, content, NULL); } if(uri->path) { char *Uri = NULL; int bytes = 0; int i; char *relative_link = NULL; char *filename = NULL; char *relative_path = NULL; char *relative_uri = NULL; filename = file_basename(msr->mp, msr->r->parsed_uri.path); if(filename == NULL || (strlen(msr->r->parsed_uri.path) - strlen(filename) < 0)) return NULL; relative_path = apr_pstrndup(msr->mp, msr->r->parsed_uri.path, strlen(msr->r->parsed_uri.path) - strlen(filename)); relative_uri = apr_pstrcat(msr->mp, relative_path, uri->path, NULL); relative_link = apr_pstrdup(msr->mp, relative_uri); xmlNormalizeURIPath(relative_link); Uri = apr_pstrdup(msr->mp, relative_link); /* for(i = 0; i < (int)strlen(Uri); i++) { if(Uri[i] != '.' && Uri[i] != '/') { if (i - 1 < 0) i = 0; else i--; if(Uri[i] == '/') --bytes; break; } else { bytes++; } } if(bytes >= (int)strlen(uri->path)) return NULL; */ content = apr_psprintf(msr->mp, "%s", Uri); if(parsed_content) parsed_content = apr_pstrcat(msr->mp, parsed_content, content, NULL); else parsed_content = apr_pstrcat(msr->mp, content, NULL); } if(uri->query_raw) { content = apr_psprintf(msr->mp, "?%s", uri->query_raw); if(parsed_content) parsed_content = apr_pstrcat(msr->mp, parsed_content, content, NULL); else parsed_content = apr_pstrcat(msr->mp, content, NULL); } if(uri->fragment) { content = apr_psprintf(msr->mp, "#%s", uri->fragment); if(parsed_content) parsed_content = apr_pstrcat(msr->mp, parsed_content, content, NULL); else parsed_content = apr_pstrcat(msr->mp, content, NULL); } xmlFreeURI(uri); return apr_pstrdup(msr->mp, parsed_content); } if(uri != NULL) xmlFreeURI(uri); return apr_pstrdup(msr->mp, input); } /** * \brief Create a random password * * \param mp ModSecurity transaction memory pool * * \retval key random key */ char *getkey(apr_pool_t *mp) { unsigned char digest[APR_SHA1_DIGESTSIZE]; char *sig, *key, *value; apr_sha1_ctx_t ctx; char salt[64]; apr_generate_random_bytes(salt, sizeof(salt)); key = apr_psprintf(mp,"%s",salt); apr_sha1_init (&ctx); apr_sha1_update (&ctx, (const char*)key, strlen(key)); apr_sha1_update (&ctx, "\0", 1); apr_generate_random_bytes(salt, sizeof(salt)); value = apr_psprintf(mp,"%s",salt); apr_sha1_update (&ctx, value, strlen (value)); apr_sha1_final (digest, &ctx); sig = apr_pcalloc (mp, apr_base64_encode_len (sizeof (digest))); apr_base64_encode (sig, (const char*)digest, sizeof (digest)); return sig; } /** * \brief Generate the MAC for a given message * * \param msr ModSecurity transaction resource * \param key The key used within HMAC * \param key_len Key length * \param msg The message to generate the MAC * \param msglen The message length * * \retval hex_digest The MAC */ char *hmac(modsec_rec *msr, const char *key, int key_len, unsigned char *msg, int msglen) { apr_sha1_ctx_t ctx; unsigned char digest[APR_SHA1_DIGESTSIZE]; unsigned char hmac_ipad[HMAC_PAD_SIZE], hmac_opad[HMAC_PAD_SIZE]; unsigned char nkey[APR_SHA1_DIGESTSIZE]; unsigned char *hmac_key = (unsigned char *) key; char hex_digest[APR_SHA1_DIGESTSIZE * 2], *hmac_digest; const char hex[] = "0123456789abcdef"; int i; if (key_len > HMAC_PAD_SIZE-1) { hmac_key = nkey; key_len = APR_SHA1_DIGESTSIZE; } memset ((void *) hmac_ipad, 0, sizeof (hmac_ipad)); memset ((void *) hmac_opad, 0, sizeof (hmac_opad)); memmove (hmac_ipad, hmac_key, key_len); memmove (hmac_opad, hmac_key, key_len); for (i = 0; i < HMAC_PAD_SIZE-1; i++) { hmac_ipad[i] ^= 0x36; hmac_opad[i] ^= 0x5c; } apr_sha1_init (&ctx); apr_sha1_update_binary (&ctx, hmac_ipad, HMAC_PAD_SIZE-1); apr_sha1_update_binary (&ctx, (const unsigned char *) msg, msglen); apr_sha1_final (digest, &ctx); apr_sha1_init (&ctx); apr_sha1_update_binary (&ctx, hmac_opad, HMAC_PAD_SIZE-1); apr_sha1_update_binary (&ctx, digest, sizeof (digest)); apr_sha1_final (digest, &ctx); hmac_digest = hex_digest; for (i = 0; i < sizeof (digest); i++) { *hmac_digest++ = hex[digest[i] >> 4]; *hmac_digest++ = hex[digest[i] & 0xF]; } *hmac_digest = '\0'; return apr_pstrdup (msr->mp, hex_digest); } /** * \brief Init html response body parser * * \param msr ModSecurity transaction resource * * \retval 1 on success * \retval -1 on fail */ int init_response_body_html_parser(modsec_rec *msr) { char *charset = NULL; char *final_charset = NULL; char sep; if(msr == NULL) return -1; if(msr->r == NULL) return -1; if(msr->r->content_type == NULL) return -1; if(msr->crypto_html_tree != NULL){ xmlFreeDoc(msr->crypto_html_tree); msr->crypto_html_tree = NULL; } if((strncmp("text/html",msr->r->content_type, 9) != 0)){ if (msr->txcfg->debuglog_level >= 4) msr_log(msr, 4, "init_response_body_html_parser: skipping html_tree generation for Content[%s].", msr->r->content_type); if(msr->crypto_html_tree != NULL){ xmlFreeDoc(msr->crypto_html_tree); msr->crypto_html_tree = NULL; } return -1; } if (msr->resbody_length == 0) { if (msr->txcfg->debuglog_level >= 4) msr_log(msr, 4, "init_response_body_html_parser: skipping html_tree generation for zero length respomse body."); msr->crypto_html_tree = NULL; return 0; } if((msr->r->content_encoding == NULL)||(apr_strnatcasecmp(msr->r->content_encoding,"(null)")==0)){ charset=m_strcasestr(msr->r->content_type,"charset="); if(charset == NULL){ if (msr->txcfg->debuglog_level >= 4) msr_log(msr, 4, "init_response_body_html_parser: assuming ISO-8859-1."); msr->crypto_html_tree = htmlReadMemory(msr->resbody_data, msr->resbody_length, NULL, "ISO-8859-1", HTML_PARSE_RECOVER | HTML_PARSE_NOBLANKS | HTML_PARSE_NOERROR | HTML_PARSE_NOWARNING); htmlSetMetaEncoding ((htmlDocPtr) msr->crypto_html_tree, (const xmlChar *) "ISO-8859-1"); } else{ charset+=8; final_charset=strchr(charset,' '); if(final_charset == NULL) final_charset = strchr(charset,';'); if(final_charset != NULL) { sep = *final_charset; *final_charset = '\0'; } if (msr->txcfg->debuglog_level >= 4) msr_log(msr, 4, "init_response_body_html_parser: Charset[%s]",charset); msr->crypto_html_tree = htmlReadMemory(msr->resbody_data, msr->resbody_length, NULL, charset, HTML_PARSE_RECOVER| HTML_PARSE_NOBLANKS | HTML_PARSE_NOERROR | HTML_PARSE_NOWARNING); htmlSetMetaEncoding ((htmlDocPtr) msr->crypto_html_tree, (const xmlChar *)charset); if(final_charset != NULL) *final_charset=sep; } } else{ if (msr->txcfg->debuglog_level >= 4) msr_log(msr, 4,"init_response_body_html_parser: Enconding[%s].",msr->r->content_encoding); msr->crypto_html_tree = htmlReadMemory(msr->resbody_data, msr->resbody_length, NULL, msr->r->content_encoding, HTML_PARSE_RECOVER | HTML_PARSE_NOBLANKS | HTML_PARSE_NOERROR | HTML_PARSE_NOWARNING); htmlSetMetaEncoding ((htmlDocPtr) msr->crypto_html_tree, (const xmlChar *)msr->r->content_encoding); } if(msr->crypto_html_tree == NULL){ if (msr->txcfg->debuglog_level >= 4) msr_log(msr, 4, "init_response_body_html_parser: Failed to parse response body."); return -1; } else { if (msr->txcfg->debuglog_level >= 4) msr_log(msr, 4, "init_response_body_html_parser: Successfully html parser generated."); return 1; } return 1; } /** * \brief Execute all hash methods * * \param msr ModSecurity transaction resource * \param link The html attr value to be checked * \param type The hash method type * * \retval 1 Match * \retval 0 No Match * \retval -1 on fail */ int do_hash_method(modsec_rec *msr, char *link, int type) { hash_method **em = NULL; int i = 0; char *error_msg = NULL; char *my_error_msg = NULL; int ovector[33]; int rc; if(msr == NULL) return -1; em = (hash_method **)msr->txcfg->hash_method->elts; if(msr->txcfg->hash_method->nelts == 0) return 1; for (i = 0; i < msr->txcfg->hash_method->nelts; i++) { if(em[i] != NULL && em[i]->param_data != NULL){ switch(type) { case HASH_URL_HREF_HASH_PM: if(em[i]->type == HASH_URL_HREF_HASH_PM) { const char *match = NULL; apr_status_t rc = 0; ACMPT pt; pt.parser = (ACMP *)em[i]->param_data; pt.ptr = NULL; rc = acmp_process_quick(&pt, &match, link, strlen(link)); if (rc) { return 1; } else { return 0; } } break; case HASH_URL_HREF_HASH_RX: if(em[i]->type == HASH_URL_HREF_HASH_RX) { rc = msc_regexec_capture(em[i]->param_data, link, strlen(link), ovector, 30, &my_error_msg); if ((rc == PCRE_ERROR_MATCHLIMIT) || (rc == PCRE_ERROR_RECURSIONLIMIT)) { msc_string *s = (msc_string *)apr_pcalloc(msr->mp, sizeof(msc_string)); if (s == NULL) return -1; s->name = apr_pstrdup(msr->mp, "MSC_PCRE_LIMITS_EXCEEDED"); if (s->name == NULL) return -1; s->name_len = strlen(s->name); s->value = apr_pstrdup(msr->mp, "1"); if (s->value == NULL) return -1; s->value_len = 1; apr_table_setn(msr->tx_vars, s->name, (void *)s); error_msg = apr_psprintf(msr->mp, "Execution error - " "PCRE limits exceeded for Hash regex [%s] (%d): %s", em[i]->param,rc, my_error_msg); if (msr->txcfg->debuglog_level >= 4) msr_log(msr, 4, "%s.", error_msg); return 0; /* No match. */ } else if (rc < -1) { error_msg = apr_psprintf(msr->mp, "Regex execution failed (%d): %s", rc, my_error_msg); if (msr->txcfg->debuglog_level >= 4) msr_log(msr, 4, "%s.", error_msg); return -1; } if (rc != PCRE_ERROR_NOMATCH) { /* Match. */ return 1; } } break; case HASH_URL_FACTION_HASH_PM: if(em[i]->type == HASH_URL_FACTION_HASH_PM) { const char *match = NULL; apr_status_t rc = 0; ACMPT pt; pt.parser = (ACMP *)em[i]->param_data; pt.ptr = NULL; rc = acmp_process_quick(&pt, &match, link, strlen(link)); if (rc) { return 1; } else { return 0; } } break; case HASH_URL_FACTION_HASH_RX: if(em[i]->type == HASH_URL_FACTION_HASH_RX) { rc = msc_regexec_capture(em[i]->param_data, link, strlen(link), ovector, 30, &my_error_msg); if ((rc == PCRE_ERROR_MATCHLIMIT) || (rc == PCRE_ERROR_RECURSIONLIMIT)) { msc_string *s = (msc_string *)apr_pcalloc(msr->mp, sizeof(msc_string)); if (s == NULL) return -1; s->name = apr_pstrdup(msr->mp, "MSC_PCRE_LIMITS_EXCEEDED"); if (s->name == NULL) return -1; s->name_len = strlen(s->name); s->value = apr_pstrdup(msr->mp, "1"); if (s->value == NULL) return -1; s->value_len = 1; apr_table_setn(msr->tx_vars, s->name, (void *)s); error_msg = apr_psprintf(msr->mp, "Execution error - " "PCRE limits exceeded for Hash regex [%s] (%d): %s", em[i]->param,rc, my_error_msg); if (msr->txcfg->debuglog_level >= 4) msr_log(msr, 4, "%s.", error_msg); return 0; /* No match. */ } else if (rc < -1) { error_msg = apr_psprintf(msr->mp, "Regex execution failed (%d): %s", rc, my_error_msg); if (msr->txcfg->debuglog_level >= 4) msr_log(msr, 4, "%s.", error_msg); return -1; } if (rc != PCRE_ERROR_NOMATCH) { /* Match. */ return 1; } } break; case HASH_URL_LOCATION_HASH_PM: if(em[i]->type == HASH_URL_LOCATION_HASH_PM) { const char *match = NULL; apr_status_t rc = 0; ACMPT pt; pt.parser = (ACMP *)em[i]->param_data; pt.ptr = NULL; rc = acmp_process_quick(&pt, &match, link, strlen(link)); if (rc) { return 1; } else { return 0; } } break; case HASH_URL_LOCATION_HASH_RX: if(em[i]->type == HASH_URL_LOCATION_HASH_RX) { rc = msc_regexec_capture(em[i]->param_data, link, strlen(link), ovector, 30, &my_error_msg); if ((rc == PCRE_ERROR_MATCHLIMIT) || (rc == PCRE_ERROR_RECURSIONLIMIT)) { msc_string *s = (msc_string *)apr_pcalloc(msr->mp, sizeof(msc_string)); if (s == NULL) return -1; s->name = apr_pstrdup(msr->mp, "MSC_PCRE_LIMITS_EXCEEDED"); if (s->name == NULL) return -1; s->name_len = strlen(s->name); s->value = apr_pstrdup(msr->mp, "1"); if (s->value == NULL) return -1; s->value_len = 1; apr_table_setn(msr->tx_vars, s->name, (void *)s); error_msg = apr_psprintf(msr->mp, "Execution error - " "PCRE limits exceeded for Hash regex [%s] (%d): %s", em[i]->param,rc, my_error_msg); if (msr->txcfg->debuglog_level >= 4) msr_log(msr, 4, "%s.", error_msg); return 0; /* No match. */ } else if (rc < -1) { error_msg = apr_psprintf(msr->mp, "Regex execution failed (%d): %s", rc, my_error_msg); if (msr->txcfg->debuglog_level >= 4) msr_log(msr, 4, "%s.", error_msg); return -1; } if (rc != PCRE_ERROR_NOMATCH) { /* Match. */ return 1; } } break; case HASH_URL_IFRAMESRC_HASH_PM: if(em[i]->type == HASH_URL_IFRAMESRC_HASH_PM) { const char *match = NULL; apr_status_t rc = 0; ACMPT pt; pt.parser = (ACMP *)em[i]->param_data; pt.ptr = NULL; rc = acmp_process_quick(&pt, &match, link, strlen(link)); if (rc) { return 1; } else { return 0; } } break; case HASH_URL_IFRAMESRC_HASH_RX: if(em[i]->type == HASH_URL_IFRAMESRC_HASH_RX) { rc = msc_regexec_capture(em[i]->param_data, link, strlen(link), ovector, 30, &my_error_msg); if ((rc == PCRE_ERROR_MATCHLIMIT) || (rc == PCRE_ERROR_RECURSIONLIMIT)) { msc_string *s = (msc_string *)apr_pcalloc(msr->mp, sizeof(msc_string)); if (s == NULL) return -1; s->name = apr_pstrdup(msr->mp, "MSC_PCRE_LIMITS_EXCEEDED"); if (s->name == NULL) return -1; s->name_len = strlen(s->name); s->value = apr_pstrdup(msr->mp, "1"); if (s->value == NULL) return -1; s->value_len = 1; apr_table_setn(msr->tx_vars, s->name, (void *)s); error_msg = apr_psprintf(msr->mp, "Execution error - " "PCRE limits exceeded for Hash regex [%s] (%d): %s", em[i]->param,rc, my_error_msg); if (msr->txcfg->debuglog_level >= 4) msr_log(msr, 4, "%s.", error_msg); return 0; /* No match. */ } else if (rc < -1) { error_msg = apr_psprintf(msr->mp, "Regex execution failed (%d): %s", rc, my_error_msg); if (msr->txcfg->debuglog_level >= 4) msr_log(msr, 4, "%s.", error_msg); return -1; } if (rc != PCRE_ERROR_NOMATCH) { /* Match. */ return 1; } } break; case HASH_URL_FRAMESRC_HASH_PM: if(em[i]->type == HASH_URL_FRAMESRC_HASH_PM) { const char *match = NULL; apr_status_t rc = 0; ACMPT pt; pt.parser = (ACMP *)em[i]->param_data; pt.ptr = NULL; rc = acmp_process_quick(&pt, &match, link, strlen(link)); if (rc) { return 1; } else { return 0; } } break; case HASH_URL_FRAMESRC_HASH_RX: if(em[i]->type == HASH_URL_FRAMESRC_HASH_RX) { rc = msc_regexec_capture(em[i]->param_data, link, strlen(link), ovector, 30, &my_error_msg); if ((rc == PCRE_ERROR_MATCHLIMIT) || (rc == PCRE_ERROR_RECURSIONLIMIT)) { msc_string *s = (msc_string *)apr_pcalloc(msr->mp, sizeof(msc_string)); if (s == NULL) return -1; s->name = apr_pstrdup(msr->mp, "MSC_PCRE_LIMITS_EXCEEDED"); if (s->name == NULL) return -1; s->name_len = strlen(s->name); s->value = apr_pstrdup(msr->mp, "1"); if (s->value == NULL) return -1; s->value_len = 1; apr_table_setn(msr->tx_vars, s->name, (void *)s); error_msg = apr_psprintf(msr->mp, "Execution error - " "PCRE limits exceeded for Hash regex [%s] (%d): %s", em[i]->param,rc, my_error_msg); if (msr->txcfg->debuglog_level >= 4) msr_log(msr, 4, "%s.", error_msg); return 0; /* No match. */ } else if (rc < -1) { error_msg = apr_psprintf(msr->mp, "Regex execution failed (%d): %s", rc, my_error_msg); if (msr->txcfg->debuglog_level >= 4) msr_log(msr, 4, "%s.", error_msg); return -1; } if (rc != PCRE_ERROR_NOMATCH) { /* Match. */ return 1; } } break; } } } return 0; } /** * \brief Hash the html elements * * \param msr ModSecurity transaction resource * * \retval 1 On success * \retval 0 No element was changed * \retval -1 On fail */ int hash_response_body_links(modsec_rec *msr) { int lsize = 0, fsize = 0, lcount = 0, fcount = 0, i; int isize = 0, icount = 0, frsize = 0, frcount = 0; int bytes = 0; xmlXPathContextPtr xpathCtx = NULL; xmlXPathObjectPtr xpathObj = NULL; xmlChar *content_option = NULL; char *mac_link = NULL; int rc, elts = 0; if(msr == NULL) return -1; if (msr->crypto_html_tree == NULL) { if (msr->txcfg->debuglog_level >= 4) msr_log(msr, 4, "hash_response_body_links: Cannot parse NULL html tree"); return -1; } if(msr->txcfg->crypto_hash_href_rx == 0 && msr->txcfg->crypto_hash_href_pm == 0 && msr->txcfg->crypto_hash_faction_rx == 0 && msr->txcfg->crypto_hash_faction_pm == 0 && msr->txcfg->crypto_hash_iframesrc_rx == 0 && msr->txcfg->crypto_hash_iframesrc_pm == 0 && msr->txcfg->crypto_hash_framesrc_rx == 0 && msr->txcfg->crypto_hash_framesrc_pm == 0) return -1; xpathCtx = xmlXPathNewContext(msr->crypto_html_tree); if(xpathCtx == NULL) { if (msr->txcfg->debuglog_level >= 4) msr_log(msr, 4, "hash_response_body_links: Unable to create Xpath context."); goto ctx_error; } lcount=fcount=0; if(msr->txcfg->crypto_hash_href_rx == 1 || msr->txcfg->crypto_hash_href_pm == 1) { xpathObj = xmlXPathEvalExpression((xmlChar*)"//*[@href]", xpathCtx); if(xpathObj == NULL) { if (msr->txcfg->debuglog_level >= 4) msr_log(msr, 4, "hash_response_body_links: Unable to evaluate xpath expression."); goto obj_error; } lsize = (xpathObj->nodesetval) ? xpathObj->nodesetval->nodeNr : 0; for(i = lsize - 1; i >=0; i--) { register xmlNodePtr cur; cur = xpathObj->nodesetval->nodeTab[i]; if(cur != NULL){ xmlChar *href = xmlGetProp(cur, (const xmlChar *) "href"); char *content_href = normalize_path(msr, (char *)href); if(content_href != NULL && strstr(content_href,msr->txcfg->crypto_param_name) == NULL) { if(msr->txcfg->crypto_hash_href_rx == 1) { rc = do_hash_method(msr, (char *)content_href, HASH_URL_HREF_HASH_RX); if(rc > 0) { mac_link = NULL; mac_link = do_hash_link(msr, (char *)content_href, FULL_LINK); if(mac_link != NULL) { xmlSetProp(cur, (const xmlChar *) "href", (const xmlChar *) mac_link); lcount++; bytes += strlen(mac_link); msr->of_stream_changed = 1; } mac_link = NULL; if(href != NULL) xmlFree(href); continue; } } if(msr->txcfg->crypto_hash_href_pm == 1) { rc = do_hash_method(msr, (char *)content_href, HASH_URL_HREF_HASH_PM); if(rc > 0) { mac_link = NULL; mac_link = do_hash_link(msr, (char *)content_href, FULL_LINK); if(mac_link != NULL) { xmlSetProp(cur, (const xmlChar *) "href", (const xmlChar *) mac_link); lcount++; bytes += strlen(mac_link); msr->of_stream_changed = 1; } mac_link = NULL; if(href != NULL) xmlFree(href); continue; } } } if(href != NULL) { xmlFree(href); href = NULL; } } } if(xpathObj != NULL) xmlXPathFreeObject(xpathObj); } if(msr->txcfg->crypto_hash_faction_rx == 1 || msr->txcfg->crypto_hash_faction_pm == 1) { xpathObj = xmlXPathEvalExpression((xmlChar*)"//form", xpathCtx); if(xpathObj == NULL) { if (msr->txcfg->debuglog_level >= 4) msr_log(msr, 4, "hash_response_body_links: Unable to evaluate xpath expression."); goto obj_error; } fsize = (xpathObj->nodesetval) ? xpathObj->nodesetval->nodeNr : 0; for(i = fsize - 1; i >=0; i--) { register xmlNodePtr cur; cur = xpathObj->nodesetval->nodeTab[i]; if((cur != NULL)){ xmlChar *action = NULL; char *content_action = NULL; if(content_option) xmlFree(content_option); action = xmlGetProp(cur, (const xmlChar *) "action"); content_action = normalize_path(msr, (char *)action); content_option = xmlGetProp(cur, (const xmlChar *) "option"); if(content_action != NULL && content_option == NULL && strstr(content_action,msr->txcfg->crypto_param_name) == NULL) { if(msr->txcfg->crypto_hash_faction_rx == 1) { rc = do_hash_method(msr, (char *)content_action, HASH_URL_FACTION_HASH_RX); if(rc > 0) { mac_link = NULL; mac_link = do_hash_link(msr, (char *)content_action, FULL_LINK); if(mac_link != NULL) { xmlSetProp(cur, (const xmlChar *) "action", (const xmlChar *) mac_link); fcount++; bytes += strlen(mac_link); msr->of_stream_changed = 1; } mac_link = NULL; if(action != NULL) xmlFree(action); continue; } } if(msr->txcfg->crypto_hash_faction_pm == 1) { rc = do_hash_method(msr, (char *)content_action, HASH_URL_FACTION_HASH_PM); if(rc > 0) { mac_link = NULL; mac_link = do_hash_link(msr, (char *)content_action, FULL_LINK); if(mac_link != NULL) { xmlSetProp(cur, (const xmlChar *) "action", (const xmlChar *) mac_link); fcount++; bytes += strlen(mac_link); msr->of_stream_changed = 1; } mac_link = NULL; if(action != NULL) xmlFree(action); continue; } } } if(action != NULL) { xmlFree(action); action = NULL; } if(content_option) { xmlFree(content_option); content_option = NULL; } } } if(xpathObj != NULL) xmlXPathFreeObject(xpathObj); } if(msr->txcfg->crypto_hash_iframesrc_rx == 1 || msr->txcfg->crypto_hash_iframesrc_pm == 1) { xpathObj = xmlXPathEvalExpression((xmlChar*)"//iframe", xpathCtx); if(xpathObj == NULL) { if (msr->txcfg->debuglog_level >= 4) msr_log(msr, 4, "hash_response_body_links: Unable to evaluate xpath expression."); goto obj_error; } isize = (xpathObj->nodesetval) ? xpathObj->nodesetval->nodeNr : 0; for(i = isize - 1; i >=0; i--) { register xmlNodePtr cur; cur = xpathObj->nodesetval->nodeTab[i]; if((cur != NULL)){ xmlChar *src = xmlGetProp(cur, (const xmlChar *) "src"); char *content_src = normalize_path(msr, (char *)src); if(content_src != NULL && strstr(content_src,msr->txcfg->crypto_param_name) == NULL) { if(msr->txcfg->crypto_hash_iframesrc_rx == 1) { rc = do_hash_method(msr, (char *)content_src, HASH_URL_IFRAMESRC_HASH_RX); if(rc > 0) { mac_link = NULL; mac_link = do_hash_link(msr, (char *)content_src, FULL_LINK); if(mac_link != NULL) { xmlSetProp(cur, (const xmlChar *) "src", (const xmlChar *) mac_link); icount++; bytes += strlen(mac_link); msr->of_stream_changed = 1; } mac_link = NULL; if(src != NULL) xmlFree(src); continue; } } if(msr->txcfg->crypto_hash_iframesrc_pm == 1) { rc = do_hash_method(msr, (char *)content_src, HASH_URL_IFRAMESRC_HASH_PM); if(rc > 0) { mac_link = NULL; mac_link = do_hash_link(msr, (char *)content_src, FULL_LINK); if(mac_link != NULL) { xmlSetProp(cur, (const xmlChar *) "src", (const xmlChar *) mac_link); icount++; bytes += strlen(mac_link); msr->of_stream_changed = 1; } mac_link = NULL; if(src != NULL) xmlFree(src); continue; } } } if(src != NULL) { xmlFree(src); src = NULL; } } } if(xpathObj != NULL) xmlXPathFreeObject(xpathObj); } if(msr->txcfg->crypto_hash_framesrc_rx == 1 || msr->txcfg->crypto_hash_framesrc_pm == 1) { xpathObj = xmlXPathEvalExpression((xmlChar*)"//frame", xpathCtx); if(xpathObj == NULL) { if (msr->txcfg->debuglog_level >= 4) msr_log(msr, 4, "hash_response_body_links: Unable to evaluate xpath expression."); goto obj_error; } frsize = (xpathObj->nodesetval) ? xpathObj->nodesetval->nodeNr : 0; for(i = frsize - 1; i >=0; i--) { register xmlNodePtr cur; cur = xpathObj->nodesetval->nodeTab[i]; if((cur != NULL)){ xmlChar *src = xmlGetProp(cur, (const xmlChar *) "src"); char *content_src = normalize_path(msr, (char *)src); if(content_src != NULL && strstr(content_src,msr->txcfg->crypto_param_name) == NULL) { if(msr->txcfg->crypto_hash_framesrc_rx == 1) { rc = do_hash_method(msr, (char *)content_src, HASH_URL_FRAMESRC_HASH_RX); if(rc > 0) { mac_link = NULL; mac_link = do_hash_link(msr, (char *)content_src, FULL_LINK); if(mac_link != NULL) { xmlSetProp(cur, (const xmlChar *) "src", (const xmlChar *) mac_link); frcount++; bytes += strlen(mac_link); msr->of_stream_changed = 1; } mac_link = NULL; if(src != NULL) xmlFree(src); continue; } } if(msr->txcfg->crypto_hash_framesrc_pm == 1) { rc = do_hash_method(msr, (char *)content_src, HASH_URL_FRAMESRC_HASH_PM); if(rc > 0) { mac_link = NULL; mac_link = do_hash_link(msr, (char *)content_src, FULL_LINK); if(mac_link != NULL) { xmlSetProp(cur, (const xmlChar *) "src", (const xmlChar *) mac_link); frcount++; bytes += strlen(mac_link); msr->of_stream_changed = 1; } mac_link = NULL; if(src != NULL) xmlFree(src); continue; } } } if(src != NULL) { xmlFree(src); src = NULL; } } } if(xpathObj != NULL) xmlXPathFreeObject(xpathObj); } if(xpathCtx != NULL) xmlXPathFreeContext(xpathCtx); if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "hash_response_body_links: Processed [%d] iframe src, [%d] hashed.",isize, icount); msr_log(msr, 4, "hash_response_body_links: Processed [%d] frame src, [%d] hashed.",frsize, frcount); msr_log(msr, 4, "hash_response_body_links: Processed [%d] form actions, [%d] hashed.",fsize, fcount); msr_log(msr, 4, "hash_response_body_links: Processed [%d] links, [%d] hashed.",lsize, lcount); } if(msr->of_stream_changed == 0) { if(msr->crypto_html_tree != NULL) { xmlFreeDoc(msr->crypto_html_tree); msr->crypto_html_tree = NULL; } return 0; } elts = (icount+frcount+fcount+lcount); if((elts >= INT32_MAX) || (elts < 0)) return 0; return bytes; obj_error: if(xpathCtx != NULL) xmlXPathFreeContext(xpathCtx); ctx_error: return -1; } /** * \brief Inject the new response body * * \param msr ModSecurity transaction resource * \param elts Number of hashed elements * * \retval 1 On success * \retval -1 On fail */ int inject_hashed_response_body(modsec_rec *msr, int elts) { xmlOutputBufferPtr output_buf = NULL; xmlCharEncodingHandlerPtr handler = NULL; char *p = NULL; const char *ctype = NULL; const char *encoding = NULL; char *new_ct = NULL, *content_value = NULL; if(msr == NULL) return -1; if(msr->r == NULL) return -1; if (msr->crypto_html_tree == NULL) { if (msr->txcfg->debuglog_level >= 4) msr_log(msr, 4, "inject_hashed_response_body: Cannot parse NULL html tree"); return -1; } if(msr->r->content_type != NULL) ctype = msr->r->content_type; encoding = (const char *) htmlGetMetaEncoding(msr->crypto_html_tree); if (ctype && encoding == NULL) { if (ctype && (p = m_strcasestr(ctype, "charset=") , p != NULL)) { p += 8 ; if (encoding = apr_pstrndup(msr->mp, p, strcspn(p, " ;") ), encoding) { xmlCharEncoding enc; enc = xmlParseCharEncoding(encoding); handler = xmlFindCharEncodingHandler(encoding); } } } else { if(encoding != NULL) { xmlCharEncoding enc; enc = xmlParseCharEncoding(encoding); handler = xmlFindCharEncodingHandler(encoding); } } if (msr->txcfg->debuglog_level >= 4) msr_log(msr, 4, "inject_hashed_response_body: Detected encoding type [%s].", encoding); if (handler == NULL) handler = xmlFindCharEncodingHandler("UTF-8"); if (handler == NULL) handler = xmlFindCharEncodingHandler("ISO-8859-1"); if (handler == NULL) handler = xmlFindCharEncodingHandler("HTML"); if (handler == NULL) handler = xmlFindCharEncodingHandler("ascii"); if(handler == NULL) { xmlFreeDoc(msr->crypto_html_tree); return -1; } apr_table_unset(msr->r->headers_out,"Content-Type"); new_ct = (char*)apr_psprintf(msr->mp, "text/html;%s",handler->name); apr_table_set(msr->r->err_headers_out,"Content-Type",new_ct); if (msr->txcfg->debuglog_level >= 4) msr_log(msr, 4, "inject_hashed_response_body: Using content-type [%s].", handler->name); output_buf = xmlAllocOutputBuffer(handler); if (output_buf == NULL) { if (msr->txcfg->debuglog_level >= 4) msr_log(msr, 4, "inject_hashed_response_body: Unable to allocate memory buffer."); xmlFreeDoc(msr->crypto_html_tree); return -1; } htmlDocContentDumpFormatOutput(output_buf, msr->crypto_html_tree, NULL, 0); xmlOutputBufferFlush(output_buf); #ifdef LIBXML2_NEW_BUFFER if (output_buf->conv == NULL || (output_buf->conv && xmlOutputBufferGetSize(output_buf) == 0)) { if(output_buf->buffer == NULL || xmlOutputBufferGetSize(output_buf) == 0) { xmlOutputBufferClose(output_buf); xmlFreeDoc(msr->crypto_html_tree); msr->of_stream_changed = 0; return -1; } if(msr->stream_output_data != NULL) { free(msr->stream_output_data); msr->stream_output_data = NULL; } msr->stream_output_length = xmlOutputBufferGetSize(output_buf); msr->stream_output_data = (char *)malloc(msr->stream_output_length+1); if (msr->stream_output_data == NULL) { xmlOutputBufferClose(output_buf); xmlFreeDoc(msr->crypto_html_tree); return -1; } memset(msr->stream_output_data, 0x0, msr->stream_output_length+1); memcpy(msr->stream_output_data, xmlOutputBufferGetContent(output_buf), msr->stream_output_length); if (msr->txcfg->debuglog_level >= 4) msr_log(msr, 4, "inject_hashed_response_body: Copying XML tree from CONTENT to stream buffer [%d] bytes.", xmlOutputBufferGetSize(output_buf)); } else { if(output_buf->conv == NULL || xmlOutputBufferGetSize(output_buf) == 0) { xmlOutputBufferClose(output_buf); xmlFreeDoc(msr->crypto_html_tree); msr->of_stream_changed = 0; return -1; } if(msr->stream_output_data != NULL) { free(msr->stream_output_data); msr->stream_output_data = NULL; } msr->stream_output_length = xmlOutputBufferGetSize(output_buf); msr->stream_output_data = (char *)malloc(msr->stream_output_length+1); if (msr->stream_output_data == NULL) { xmlOutputBufferClose(output_buf); xmlFreeDoc(msr->crypto_html_tree); return -1; } memset(msr->stream_output_data, 0x0, msr->stream_output_length+1); memcpy(msr->stream_output_data, xmlOutputBufferGetContent(output_buf), msr->stream_output_length); if (msr->txcfg->debuglog_level >= 4) msr_log(msr, 4, "inject_hashed_response_body: Copying XML tree from CONV to stream buffer [%d] bytes.", xmlOutputBufferGetSize(output_buf)); } #else if (output_buf->conv == NULL || (output_buf->conv && output_buf->conv->use == 0)) { if(output_buf->buffer == NULL || output_buf->buffer->use == 0) { xmlOutputBufferClose(output_buf); xmlFreeDoc(msr->crypto_html_tree); msr->of_stream_changed = 0; return -1; } if(msr->stream_output_data != NULL) { free(msr->stream_output_data); msr->stream_output_data = NULL; } msr->stream_output_length = output_buf->buffer->use; msr->stream_output_data = (char *)malloc(msr->stream_output_length+1); if (msr->stream_output_data == NULL) { xmlOutputBufferClose(output_buf); xmlFreeDoc(msr->crypto_html_tree); return -1; } memset(msr->stream_output_data, 0x0, msr->stream_output_length+1); memcpy(msr->stream_output_data, (char *)xmlBufferContent(output_buf->buffer), msr->stream_output_length); //memcpy(msr->stream_output_data, output_buf->buffer->content, msr->stream_output_length); if (msr->txcfg->debuglog_level >= 4) msr_log(msr, 4, "inject_hashed_response_body: Copying XML tree from CONTENT to stream buffer [%d] bytes.", msr->stream_output_length); } else { if(output_buf->conv == NULL || output_buf->conv->use == 0) { xmlOutputBufferClose(output_buf); xmlFreeDoc(msr->crypto_html_tree); msr->of_stream_changed = 0; return -1; } if(msr->stream_output_data != NULL) { free(msr->stream_output_data); msr->stream_output_data = NULL; } msr->stream_output_length = output_buf->conv->use; msr->stream_output_data = (char *)malloc(msr->stream_output_length+1); if (msr->stream_output_data == NULL) { xmlOutputBufferClose(output_buf); xmlFreeDoc(msr->crypto_html_tree); return -1; } memset(msr->stream_output_data, 0x0, msr->stream_output_length+1); memcpy(msr->stream_output_data, (char *)xmlBufferContent(output_buf->conv), msr->stream_output_length); //memcpy(msr->stream_output_data, output_buf->conv->content, msr->stream_output_length); if (msr->txcfg->debuglog_level >= 4) msr_log(msr, 4, "inject_hashed_response_body: Copying XML tree from CONV to stream buffer [%d] bytes.", msr->stream_output_length); } #endif xmlOutputBufferClose(output_buf); content_value = (char*)apr_psprintf(msr->mp, "%"APR_SIZE_T_FMT, msr->stream_output_length); apr_table_unset(msr->r->headers_out,"Content-Length"); if (msr->txcfg->debuglog_level >= 4) msr_log(msr, 4, "inject_hashed_response_body: Setting new content value %s", content_value); apr_table_set(msr->r->headers_out, "Content-Length", content_value); xmlFreeDoc(msr->crypto_html_tree); if (msr->txcfg->debuglog_level >= 4) msr_log(msr, 4, "inject_hashed_response_body: Stream buffer [%"APR_SIZE_T_FMT"]. Done",msr->stream_output_length); return 1; } /** * \brief Parse and MAC html elements * * \param msr ModSecurity transaction resource * \param link The html attr value to be checked * \param type The hash method type * * \retval mac_link MACed link * \retval NULL on fail */ char *do_hash_link(modsec_rec *msr, char *link, int type) { char *mac_link = NULL; char *path_chunk = NULL; char *hash_value = NULL; char *qm = NULL; if(msr == NULL) return NULL; if(strlen(link) > 7 && strncmp("http:",(char*)link,5)==0){ path_chunk = strchr(link+7,'/'); if(path_chunk != NULL) { if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Signing data [%s]", path_chunk+1); } if(msr->txcfg->crypto_key_add == HASH_KEYONLY) hash_value = hmac(msr, msr->txcfg->crypto_key, msr->txcfg->crypto_key_len, (unsigned char *) path_chunk+1, strlen((char*)path_chunk)-1); if(msr->txcfg->crypto_key_add == HASH_SESSIONID) { if(msr->sessionid == NULL || strlen(msr->sessionid) == 0) { #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER > 2 const char *new_pwd = apr_psprintf(msr->mp,"%s%s", msr->txcfg->crypto_key, msr->r->connection->client_ip); #else const char *new_pwd = apr_psprintf(msr->mp,"%s%s", msr->txcfg->crypto_key, msr->r->connection->remote_ip); #endif if (msr->txcfg->debuglog_level >= 4) msr_log(msr, 4, "Session id is empty. Using REMOTE_IP"); msr->txcfg->crypto_key_len = strlen(new_pwd); hash_value = hmac(msr, new_pwd, msr->txcfg->crypto_key_len, (unsigned char *) path_chunk+1, strlen((char*)path_chunk)-1); } else { const char *new_pwd = apr_psprintf(msr->mp,"%s%s", msr->txcfg->crypto_key, msr->sessionid); if (msr->txcfg->debuglog_level >= 4) msr_log(msr, 4, "Using session id [%s]", msr->sessionid); msr->txcfg->crypto_key_len = strlen(new_pwd); hash_value = hmac(msr, new_pwd, msr->txcfg->crypto_key_len, (unsigned char *) path_chunk+1, strlen((char*)path_chunk)-1); } } if(msr->txcfg->crypto_key_add == HASH_REMOTEIP) { #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER > 2 const char *new_pwd = apr_psprintf(msr->mp,"%s%s", msr->txcfg->crypto_key, msr->r->connection->client_ip); #else const char *new_pwd = apr_psprintf(msr->mp,"%s%s", msr->txcfg->crypto_key, msr->r->connection->remote_ip); #endif msr->txcfg->crypto_key_len = strlen(new_pwd); hash_value = hmac(msr, new_pwd, msr->txcfg->crypto_key_len, (unsigned char *) path_chunk+1, strlen((char*)path_chunk)-1); } } else { return NULL; } } else if(strlen(link) > 8 && strncmp("https",(char*)link,5)==0){ path_chunk = strchr(link+8,'/'); if(path_chunk != NULL) { if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Signing data [%s]", path_chunk+1); } if(msr->txcfg->crypto_key_add == HASH_KEYONLY) hash_value = hmac(msr, msr->txcfg->crypto_key, msr->txcfg->crypto_key_len, (unsigned char *) path_chunk+1, strlen((char*)path_chunk)-1); if(msr->txcfg->crypto_key_add == HASH_SESSIONID) { if(msr->sessionid == NULL || strlen(msr->sessionid) == 0) { #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER > 2 const char *new_pwd = apr_psprintf(msr->mp,"%s%s", msr->txcfg->crypto_key, msr->r->connection->client_ip); #else const char *new_pwd = apr_psprintf(msr->mp,"%s%s", msr->txcfg->crypto_key, msr->r->connection->remote_ip); #endif if (msr->txcfg->debuglog_level >= 4) msr_log(msr, 4, "Session id is empty. Using REMOTE_IP"); msr->txcfg->crypto_key_len = strlen(new_pwd); hash_value = hmac(msr, new_pwd, msr->txcfg->crypto_key_len, (unsigned char *) path_chunk+1, strlen((char*)path_chunk)-1); } else { const char *new_pwd = apr_psprintf(msr->mp,"%s%s", msr->txcfg->crypto_key, msr->sessionid); if (msr->txcfg->debuglog_level >= 4) msr_log(msr, 4, "Using session id [%s]", msr->sessionid); msr->txcfg->crypto_key_len = strlen(new_pwd); hash_value = hmac(msr, new_pwd, msr->txcfg->crypto_key_len, (unsigned char *) path_chunk+1, strlen((char*)path_chunk)-1); } } if(msr->txcfg->crypto_key_add == HASH_REMOTEIP) { #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER > 2 const char *new_pwd = apr_psprintf(msr->mp,"%s%s", msr->txcfg->crypto_key, msr->r->connection->client_ip); #else const char *new_pwd = apr_psprintf(msr->mp,"%s%s", msr->txcfg->crypto_key, msr->r->connection->remote_ip); #endif msr->txcfg->crypto_key_len = strlen(new_pwd); hash_value = hmac(msr, new_pwd, msr->txcfg->crypto_key_len, (unsigned char *) path_chunk+1, strlen((char*)path_chunk)-1); } } else { return NULL; } } else if(*link=='/'){ if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Signing data [%s]", link+1); } if(msr->txcfg->crypto_key_add == HASH_KEYONLY) hash_value = hmac(msr, msr->txcfg->crypto_key, msr->txcfg->crypto_key_len, (unsigned char *) link+1, strlen((char*)link)-1); if(msr->txcfg->crypto_key_add == HASH_SESSIONID) { if(msr->sessionid == NULL || strlen(msr->sessionid) == 0) { #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER > 2 const char *new_pwd = apr_psprintf(msr->mp,"%s%s", msr->txcfg->crypto_key, msr->r->connection->client_ip); #else const char *new_pwd = apr_psprintf(msr->mp,"%s%s", msr->txcfg->crypto_key, msr->r->connection->remote_ip); #endif if (msr->txcfg->debuglog_level >= 4) msr_log(msr, 4, "Session id is empty. Using REMOTE_IP"); msr->txcfg->crypto_key_len = strlen(new_pwd); hash_value = hmac(msr, new_pwd, msr->txcfg->crypto_key_len, (unsigned char *) link+1, strlen((char*)link)-1); } else { const char *new_pwd = apr_psprintf(msr->mp,"%s%s", msr->txcfg->crypto_key, msr->sessionid); if (msr->txcfg->debuglog_level >= 4) msr_log(msr, 4, "Using session id [%s]", msr->sessionid); msr->txcfg->crypto_key_len = strlen(new_pwd); hash_value = hmac(msr, new_pwd, msr->txcfg->crypto_key_len, (unsigned char *) link+1, strlen((char*)link)-1); } } if(msr->txcfg->crypto_key_add == HASH_REMOTEIP) { #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER > 2 const char *new_pwd = apr_psprintf(msr->mp,"%s%s", msr->txcfg->crypto_key, msr->r->connection->client_ip); #else const char *new_pwd = apr_psprintf(msr->mp,"%s%s", msr->txcfg->crypto_key, msr->r->connection->remote_ip); #endif msr->txcfg->crypto_key_len = strlen(new_pwd); hash_value = hmac(msr, new_pwd, msr->txcfg->crypto_key_len, (unsigned char *) link+1, strlen((char*)link)-1); } } else { char *relative_link = NULL; char *filename = NULL; char *relative_path = NULL; char *relative_uri = NULL; filename = file_basename(msr->mp, msr->r->parsed_uri.path); if(filename == NULL || (strlen(msr->r->parsed_uri.path) - strlen(filename) < 0)) return NULL; relative_path = apr_pstrndup(msr->mp, msr->r->parsed_uri.path, strlen(msr->r->parsed_uri.path) - strlen(filename)); relative_uri = apr_pstrcat(msr->mp, relative_path, link, NULL); relative_link = relative_uri+1; if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Signing data [%s] size %d", relative_link, strlen(relative_link)); } if(msr->txcfg->crypto_key_add == HASH_KEYONLY) hash_value = hmac(msr, msr->txcfg->crypto_key, msr->txcfg->crypto_key_len, (unsigned char *) relative_link, strlen((char*)relative_link)); if(msr->txcfg->crypto_key_add == HASH_SESSIONID) { if(msr->sessionid == NULL || strlen(msr->sessionid) == 0) { #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER > 2 const char *new_pwd = apr_psprintf(msr->mp,"%s%s", msr->txcfg->crypto_key, msr->r->connection->client_ip); #else const char *new_pwd = apr_psprintf(msr->mp,"%s%s", msr->txcfg->crypto_key, msr->r->connection->remote_ip); #endif if (msr->txcfg->debuglog_level >= 4) msr_log(msr, 4, "Session id is empty. Using REMOTE_IP"); msr->txcfg->crypto_key_len = strlen(new_pwd); hash_value = hmac(msr, new_pwd, msr->txcfg->crypto_key_len, (unsigned char *) relative_link, strlen((char*)relative_link)); } else { const char *new_pwd = apr_psprintf(msr->mp,"%s%s", msr->txcfg->crypto_key, msr->sessionid); if (msr->txcfg->debuglog_level >= 4) msr_log(msr, 4, "Using session id [%s]", msr->sessionid); msr->txcfg->crypto_key_len = strlen(new_pwd); hash_value = hmac(msr, new_pwd, msr->txcfg->crypto_key_len, (unsigned char *) relative_link, strlen((char*)relative_link)); } } if(msr->txcfg->crypto_key_add == HASH_REMOTEIP) { #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER > 2 const char *new_pwd = apr_psprintf(msr->mp,"%s%s", msr->txcfg->crypto_key, msr->r->connection->client_ip); #else const char *new_pwd = apr_psprintf(msr->mp,"%s%s", msr->txcfg->crypto_key, msr->r->connection->remote_ip); #endif msr->txcfg->crypto_key_len = strlen(new_pwd); hash_value = hmac(msr, new_pwd, msr->txcfg->crypto_key_len, (unsigned char *) relative_link, strlen((char*)relative_link)); } link = relative_uri; } if(hash_value == NULL) return NULL; if(type == HASH_ONLY) return hash_value; qm = strchr((char*)link,'?'); if(qm == NULL){ mac_link= (char*)apr_psprintf(msr->mp, "%s?%s=%s", link, msr->txcfg->crypto_param_name, (char *)hash_value); } else{ mac_link= (char*)apr_psprintf(msr->mp, "%s&%s=%s", link, msr->txcfg->crypto_param_name, (char*)hash_value); } return mac_link; } /** * \brief Modify Location in case of status 302 and 301 * * \param msr ModSecurity transaction resource * * \retval 1 On Success * \retval 0 on fail */ int modify_response_header(modsec_rec *msr) { char *mac_link = NULL; const char *location = NULL; int rc = 0; if(msr == NULL) return 0; if (msr->txcfg->debuglog_level >= 9) msr_log(msr, 4, "HTTP status (%d)", msr->response_status); if(msr->response_status != HTTP_MOVED_TEMPORARILY && msr->response_status != HTTP_MOVED_PERMANENTLY) { if (msr->txcfg->debuglog_level >= 9) msr_log(msr, 4, "Skipping status other than 302 an 301"); return 0; } location = apr_table_get(msr->r->headers_out, "Location"); if(location == NULL || strlen(location) == 0) return 0; if (msr->txcfg->debuglog_level >= 9) msr_log(msr, 4, "Processing reponse header location [%s]", location); if(msr->txcfg->crypto_hash_location_rx == 1) { rc = do_hash_method(msr, (char *)location, HASH_URL_LOCATION_HASH_RX); if(rc > 0) { mac_link = NULL; mac_link = do_hash_link(msr, (char *)location, FULL_LINK); } else { return 0; } } else if(msr->txcfg->crypto_hash_location_pm == 1) { rc = do_hash_method(msr, (char *)location, HASH_URL_LOCATION_HASH_PM); if(rc > 0) { mac_link = NULL; mac_link = do_hash_link(msr, (char *)location, FULL_LINK); } else { return 0; } } if(mac_link == NULL) return 0; if (msr->txcfg->debuglog_level >= 9) msr_log(msr, 4, "Setting new reponse header location [%s]", mac_link); if(rc > 0) { apr_table_unset(msr->r->headers_out,"Location"); apr_table_set(msr->r->headers_out, "Location",(char*)apr_psprintf(msr->mp,"%s", mac_link)); } return 1; } modsecurity-apache_2.7.7/apache2/msc_pcre.h0000664000175000017500000000412012243422537021103 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #ifndef _MSC_PCRE_H_ #define _MSC_PCRE_H_ typedef struct msc_regex_t msc_regex_t; #include "pcre.h" #ifndef PCRE_ERROR_MATCHLIMIT /* Define for compile, but not valid in this version of PCRE. */ #define PCRE_ERROR_MATCHLIMIT (-8) #endif /* PCRE_ERROR_MATCHLIMIT */ #ifndef PCRE_ERROR_RECURSIONLIMIT /* Define for compile, but not valid in this version of PCRE. */ #define PCRE_ERROR_RECURSIONLIMIT (-21) #endif /* PCRE_ERROR_RECURSIONLIMIT */ #include "apr_general.h" #include "modsecurity.h" struct msc_regex_t { void *re; void *pe; const char *pattern; }; void DSOLOCAL *msc_pregcomp_ex(apr_pool_t *pool, const char *pattern, int options, const char **_errptr, int *_erroffset, int match_limit, int match_limit_recursion); void DSOLOCAL *msc_pregcomp(apr_pool_t *pool, const char *pattern, int options, const char **_errptr, int *_erroffset); int DSOLOCAL msc_regexec_ex(msc_regex_t *regex, const char *s, unsigned int slen, int startoffset, int options, int *ovector, int ovecsize, char **error_msg); int DSOLOCAL msc_regexec_capture(msc_regex_t *regex, const char *s, unsigned int slen, int *ovector, int ovecsize, char **error_msg); int DSOLOCAL msc_regexec(msc_regex_t *regex, const char *s, unsigned int slen, char **error_msg); int DSOLOCAL msc_fullinfo(msc_regex_t *regex, int what, void *where); #endif modsecurity-apache_2.7.7/apache2/msc_tree.c0000664000175000017500000005662112252634762021126 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #include #include #if APR_HAVE_STDINT_H #include #endif #include #if APR_HAVE_NETINET_IN_H #include #endif #if APR_HAVE_ARPA_INET_H #include #endif #include "apr_lib.h" #include "msc_util.h" #include "msc_tree.h" CPTTree *CPTCreateRadixTree(apr_pool_t *pool) { CPTTree *tree = NULL; tree = apr_palloc(pool, sizeof(CPTTree)); if(tree == NULL) return NULL; memset(tree, 0, sizeof(CPTTree)); tree->pool = pool; return tree; } void ConvertIPNetmask(unsigned char *buffer, unsigned char netmask, unsigned int ip_bitmask) { int aux = 0, bytes = 0; int mask = 0, mask_bit = 0; bytes = ip_bitmask/8; while(aux < bytes) { mask_bit = ((1+aux) * 8); if (mask_bit > netmask) { mask = 0; if ((mask_bit - netmask) < 8) mask = SHIFT_LEFT_MASK(mask_bit - netmask); } else { mask = -1; } buffer[aux] &= mask; aux++; } return; } TreeNode *CPTCreateNode(apr_pool_t *pool) { TreeNode *node = NULL; node = apr_palloc(pool, sizeof(TreeNode)); if(node == NULL) return NULL; memset(node, 0, sizeof(TreeNode)); return node; } CPTData *CPTCreateCPTData(unsigned char netmask, apr_pool_t *pool) { CPTData *prefix_data = apr_palloc(pool, sizeof(CPTData)); if (prefix_data == NULL) { return NULL; } memset(prefix_data, 0, sizeof(CPTData)); prefix_data->netmask = netmask; return prefix_data; } TreePrefix *InsertDataPrefix(TreePrefix *prefix, unsigned char *ipdata, unsigned int ip_bitmask, unsigned char netmask, apr_pool_t *pool) { if(prefix == NULL) return NULL; memcpy(prefix->buffer, ipdata, ip_bitmask/8); prefix->bitlen = ip_bitmask; prefix->prefix_data = CPTCreateCPTData(netmask, pool); if(prefix->prefix_data == NULL) return NULL; return prefix; } TreePrefix *CPTCreatePrefix(unsigned char *ipdata, unsigned int ip_bitmask, unsigned char netmask, apr_pool_t *pool) { TreePrefix *prefix = NULL; int bytes = ip_bitmask/8; if ((ip_bitmask % 8 != 0) || (ipdata == NULL)) { return NULL; } prefix = apr_palloc(pool, sizeof(TreePrefix)); if (prefix == NULL) return NULL; memset(prefix, 0, sizeof(TreePrefix)); prefix->buffer = apr_palloc(pool, bytes); if(prefix->buffer == NULL) return NULL; memset(prefix->buffer, 0, bytes); return InsertDataPrefix(prefix, ipdata, ip_bitmask, netmask, pool); } void CPTAppendToCPTDataList(CPTData *new, CPTData **list) { CPTData *temp = NULL, *prev = NULL; if (new == NULL) { return; } if (list == NULL) { return; } prev = *list; temp = *list; while (temp != NULL) { if (new->netmask > temp->netmask) break; prev = temp; temp = temp->next; } if (temp == *list) { new->next = *list; *list = new; } else { new->next = prev->next; prev->next = new; } return; } int TreePrefixContainNetmask(TreePrefix *prefix, unsigned char netmask) { CPTData *prefix_data = NULL; if (prefix == NULL) { return 0; } prefix_data = prefix->prefix_data; while (prefix_data != NULL) { if (prefix_data->netmask == netmask) return 1; prefix_data = prefix_data->next; } return 0; } int CheckBitmask(unsigned char netmask, unsigned int ip_bitmask) { switch(netmask) { case 0xff: return 1; case 0x20: if(ip_bitmask == 0x20) return 1; break; case 0x80: if(ip_bitmask == 0x80) return 1; break; } return 0; } TreeNode *CPTCreateHead(TreePrefix *prefix, TreeNode *node, CPTTree *tree, unsigned char netmask, unsigned int ip_bitmask) { if(tree == NULL) return NULL; if(prefix == NULL) return NULL; if (node != NULL) { node->prefix = prefix; node->bit = prefix->bitlen; tree->head = node; if(CheckBitmask(netmask, ip_bitmask)) return node; node->count++; node->netmasks = apr_palloc(tree->pool, (node->count * sizeof(unsigned char))); if(node->netmasks) node->netmasks[0] = netmask; return node; } else { return NULL; } return NULL; } TreeNode *SetParentNode(TreeNode *node, TreeNode *new_node, CPTTree *tree) { if (node->parent == NULL) tree->head = new_node; else if (node->parent->right == node) node->parent->right = new_node; else node->parent->left = new_node; return new_node; } int InsertNetmask(TreeNode *node, TreeNode *parent, TreeNode *new_node, CPTTree *tree, unsigned char netmask, unsigned char bitlen) { int i; if (netmask != NETMASK_256-1 && netmask != NETMASK_128) { if ((netmask != NETMASK_32 || (netmask == NETMASK_32 && bitlen != NETMASK_32))) { node = new_node; parent = new_node->parent; while (parent != NULL && netmask < (parent->bit + 1)) { node = parent; parent = parent->parent; } node->count++; node->netmasks = apr_palloc(tree->pool, (node->count * sizeof(unsigned char))); if(node->netmasks == NULL) return 0; if ((node->count-1) == 0) { node->netmasks[0] = netmask; return 1; } node->netmasks[node->count - 1] = netmask; i = node->count - 2; while (i >= 0) { if (netmask < node->netmasks[i]) { node->netmasks[i + 1] = netmask; break; } node->netmasks[i + 1] = node->netmasks[i]; node->netmasks[i] = netmask; i--; } } } return 0; } TreeNode *CPTAddElement(unsigned char *ipdata, unsigned int ip_bitmask, CPTTree *tree, unsigned char netmask) { unsigned char *buffer = NULL; unsigned char bitlen = 0; int bit_validation = 0, test_bit = 0; int i = 0, j = 0, temp = 0; unsigned int x, y; TreeNode *node = NULL, *new_node = NULL; TreeNode *parent = NULL, *i_node = NULL; TreeNode *bottom_node = NULL; TreePrefix *prefix = NULL; if (tree == NULL) { return NULL; } ConvertIPNetmask(ipdata, netmask, ip_bitmask); prefix = CPTCreatePrefix(ipdata, ip_bitmask, netmask, tree->pool); if (prefix == NULL) { return NULL; } if (tree->head == NULL) { node = CPTCreateNode(tree->pool); return CPTCreateHead(prefix, node, tree, netmask, ip_bitmask); } node = tree->head; buffer = prefix->buffer; bitlen = prefix->bitlen; while (node->bit < bitlen || node->prefix == NULL) { if (bitlen < node->bit) { if (node->right == NULL) break; else node = node->right; } else { x = SHIFT_RIGHT_MASK(node->bit, 3); y = SHIFT_RIGHT_MASK(NETMASK_128, (node->bit % 8)); if (TREE_CHECK(buffer[x],y)) { if (node->right == NULL) break; node = node->right; } else { if (node->left == NULL) break; else node = node->left; } } } bottom_node = node; if(node->bit < bitlen) bit_validation = node->bit; else bit_validation = bitlen; for (i = 0; (i * NETMASK_8) < bit_validation; i++) { int net = 0, div = 0; int cnt = 0; if ((temp = (buffer[i] ^ bottom_node->prefix->buffer[i])) == 0) { test_bit = (i + 1) * NETMASK_8; continue; } temp += temp; for(cnt = 0, net = NETMASK_256, div = 2; net >= NETMASK_2; net = NETMASK_256/div, div += div, cnt++) { if(temp >= net) { test_bit = (i * NETMASK_8) + cnt; break; } } break; } if (bit_validation < test_bit) test_bit = bit_validation; parent = node->parent; while (parent && test_bit <= parent->bit) { node = parent; parent = node->parent; } if (test_bit == bitlen && node->bit == bitlen) { if (node->prefix != NULL) { int found = 0; CPTData *prefix_data = NULL; prefix_data = node->prefix->prefix_data; while(prefix_data != NULL) { if (prefix_data->netmask == netmask) ++found; prefix_data = prefix_data->next; } if (found != 0) { CPTData *prefix_data = CPTCreateCPTData(netmask, tree->pool); CPTAppendToCPTDataList(prefix_data, &prefix->prefix_data); if(CheckBitmask(netmask, ip_bitmask)) return node; parent = node->parent; while (parent != NULL && netmask < (parent->bit + 1)) { node = parent; parent = parent->parent; } node->count++; new_node = node; node->netmasks = apr_palloc(tree->pool, (node->count * sizeof(unsigned char))); if ((node->count -1) == 0) { node->netmasks[0] = netmask; return new_node; } node->netmasks[node->count - 1] = netmask; i = node->count - 2; while (i >= 0) { if (netmask < node->netmasks[i]) { node->netmasks[i + 1] = netmask; break; } node->netmasks[i + 1] = node->netmasks[i]; node->netmasks[i] = netmask; i--; } } } else { node->prefix = CPTCreatePrefix(prefix->buffer, prefix->bitlen, NETMASK_256-1, tree->pool); } return node; } new_node = CPTCreateNode(tree->pool); if(new_node == NULL) return NULL; new_node->prefix = prefix; new_node->bit = prefix->bitlen; if (test_bit == bitlen) { x = SHIFT_RIGHT_MASK(test_bit, 3); y = SHIFT_RIGHT_MASK(NETMASK_128, (test_bit % 8)); if (TREE_CHECK(bottom_node->prefix->buffer[x],y)) { new_node->right = node; } else { new_node->left = node; } new_node->parent = node->parent; node->parent = SetParentNode(node, new_node, tree); } else { i_node = CPTCreateNode(tree->pool); if(i_node == NULL) return NULL; //i_node->prefix = NULL; i_node->bit = test_bit; i_node->parent = node->parent; if (node->netmasks != NULL) { i = 0; while(i < node->count) { if (node->netmasks[i] < test_bit + 1) break; i++; } i_node->netmasks = apr_palloc(tree->pool, (node->count - i) * sizeof(unsigned char)); if(i_node->netmasks == NULL) { return NULL; } j = 0; while (j < (node->count - i)) { i_node->netmasks[j] = node->netmasks[i + j]; j++; } i_node->count = (node->count - i); node->count = i; if (node->count == 0) { node->netmasks = NULL; } } x = SHIFT_RIGHT_MASK(test_bit, 3); y = SHIFT_RIGHT_MASK(NETMASK_128, (test_bit % 8)); if (TREE_CHECK(buffer[x],y)) { i_node->left = node; i_node->right = new_node; } else { i_node->left = new_node; i_node->right = node; } new_node->parent = i_node; node->parent = SetParentNode(node, i_node, tree); } if (InsertNetmask(node, parent, new_node, tree, netmask, bitlen)) return new_node; return new_node; } int TreeCheckData(TreePrefix *prefix, CPTData *prefix_data, unsigned int netmask) { while(prefix_data != NULL) { if (prefix_data->netmask == netmask) { return 1; } prefix_data = prefix_data->next; } return 0; } int TreePrefixNetmask(modsec_rec *msr, TreePrefix *prefix, unsigned int netmask, int flag) { CPTData *prefix_data = NULL; int ret = 0; if (prefix == NULL) { if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "TreePrefixNetmask: prefix is NULL."); } return 0; } prefix_data = prefix->prefix_data; if (flag == 1) { if(prefix_data == NULL) return 0; if (prefix_data->netmask != netmask) { if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "TreePrefixNetmask: Cannot find a prefix with correct netmask."); } return 0; } else { if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "TreePrefixNetmask: Found a prefix with correct netmask."); } return 1; } } if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "TreePrefixNetmask: Check if a prefix has a the correct netmask"); } ret = TreeCheckData(prefix, prefix_data, netmask); return ret; } TreeNode *CPTRetriveNode(modsec_rec *msr, unsigned char *buffer, unsigned int ip_bitmask, TreeNode *node) { unsigned int x, y; if(node == NULL) { if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "CPTRetriveNode: Node tree is NULL."); } return NULL; } if(buffer == NULL) { if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "CPTRetriveNode: Empty ip address. Nothing to search for."); } return NULL; } while (node->bit < ip_bitmask) { x = SHIFT_RIGHT_MASK(node->bit, 3); y = SHIFT_RIGHT_MASK(NETMASK_128, (node->bit % 8)); if (TREE_CHECK(buffer[x], y)) { node = node->right; if (node == NULL) return NULL; } else { node = node->left; if (node == NULL) return NULL; } } if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "CPTRetriveNode: Found the node for provided ip address."); } return node; } TreeNode *CPTRetriveParentNode(TreeNode *node) { while (node != NULL && node->netmasks == NULL) node = node->parent; return node; } TreeNode *CPTFindElementIPNetblock(modsec_rec *msr, unsigned char *ipdata, unsigned char ip_bitmask, TreeNode *node) { TreeNode *netmask_node = NULL; int mask = 0, bytes = 0; int i = 0, j = 0; int mask_bits = 0; node = CPTRetriveParentNode(node); if (node == NULL) { if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "CPTFindElementIPNetblock: Node tree is NULL."); } return NULL; } netmask_node = node; while(j < netmask_node->count) { bytes = ip_bitmask / 8; while( i < bytes ) { mask = -1; mask_bits = ((i + 1) * 8); if (mask_bits > netmask_node->netmasks[j]) { if ((mask_bits - netmask_node->netmasks[j]) < 8) mask = SHIFT_LEFT_MASK(mask_bits - netmask_node->netmasks[j]); else mask = 0; } ipdata[i] &= mask; i++; } node = CPTRetriveNode(msr, ipdata, ip_bitmask, node); if (node && node->bit != ip_bitmask) { if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "CPTFindElementIPNetblock: Found a tree node but netmask is different."); } return NULL; } if (node && node->prefix == NULL) { if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "CPTFindElementIPNetblock: Found a tree node but prefix is NULL."); } return NULL; } if (memcmp(node->prefix->buffer, ipdata, bytes) == 0) { mask = SHIFT_LEFT_MASK(8 - ip_bitmask % 8); if ((ip_bitmask % 8) == 0) { if (TreePrefixNetmask(msr, node->prefix, netmask_node->netmasks[j], FALSE)) { if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "CPTFindElementIPNetblock: Node found for provided ip address"); } return node; } } if ((node->prefix->buffer[bytes] & mask) == (ipdata[bytes] & mask)) { if (TreePrefixNetmask(msr, node->prefix, netmask_node->netmasks[j], FALSE)) { if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "CPTFindElementIPNetblock: Node found for provided ip address"); } return node; } } } j++; } return CPTFindElementIPNetblock(msr, ipdata, ip_bitmask, netmask_node->parent); } TreeNode *CPTFindElement(modsec_rec *msr, unsigned char *ipdata, unsigned int ip_bitmask, CPTTree *tree) { TreeNode *node = NULL; int mask = 0, bytes = 0; unsigned char temp_data[NETMASK_256-1]; if (tree == NULL) { if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "CPTFindElement: Tree is NULL. Cannot proceed searching the ip."); } return node; } if (tree->head == NULL) { if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "CPTFindElement: Tree head is NULL. Cannot proceed searching the ip."); } return node; } node = tree->head; if (ip_bitmask > (NETMASK_256-1)) { if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "CPTFindElement: Netmask cannot be greater than 255"); } return NULL; } bytes = ip_bitmask/8; memset(temp_data, 0, NETMASK_256-1); memcpy(temp_data, ipdata, bytes); node = CPTRetriveNode(msr, temp_data, ip_bitmask, node); if (node && (node->bit != ip_bitmask)) { if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "CPTFindElement: Found a tree node but netmask is different."); } return NULL; } if(node == NULL) { if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "CPTFindElement: Node tree is NULL."); } return node; } if(node->prefix == NULL) { if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "CPTFindElement: Found a tree node but prefix is NULL."); } return node; } if (memcmp(node->prefix->buffer, temp_data, bytes) == 0) { mask = SHIFT_LEFT_MASK(8 - ip_bitmask % 8); if ((ip_bitmask % 8) == 0) { if (TreePrefixNetmask(msr, node->prefix, ip_bitmask, TRUE)) { if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "CPTFindElement: Node found for provided ip address"); } return node; } } if ((node->prefix->buffer[bytes] & mask) == (temp_data[bytes] & mask)) { if (TreePrefixNetmask(msr, node->prefix, ip_bitmask, TRUE)) { if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "CPTFindElement: Node found for provided ip address"); } return node; } } } return CPTFindElementIPNetblock(msr, temp_data, ip_bitmask, node); } TreeNode *CPTIpMatch(modsec_rec *msr, unsigned char *ipdata, CPTTree *tree, int type) { if(tree == NULL) { if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "CPTIpMatch: Tree is NULL. Cannot proceed searching the ip."); } return NULL; } if(ipdata == NULL) { if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "CPTIpMatch: Empty ip address. Nothing to search for."); } return NULL; } switch(type) { case IPV4_TREE: if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "CPTIpMatch: Searching ip type 0x%x", type); } return CPTFindElement(msr, ipdata, NETMASK_32, tree); case IPV6_TREE: if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "CPTIpMatch: Searching ip type 0x%x", type); } return CPTFindElement(msr, ipdata, NETMASK_128, tree); default: if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "CPTIpMatch: Unknown ip type 0x%x", type); } return NULL; } } TreeNode *TreeAddIP(const char *buffer, CPTTree *tree, int type) { unsigned long ip, ret; unsigned char netmask_v4 = NETMASK_32, netmask_v6 = NETMASK_128; char ip_strv4[NETMASK_32], ip_strv6[NETMASK_128]; struct in_addr addr4; struct in6_addr addr6; char *ptr = NULL; if(tree == NULL) return NULL; switch(type) { case IPV4_TREE: memset(&addr4, 0, sizeof(addr4)); memset(ip_strv4, 0x0, NETMASK_32); strncpy(ip_strv4, buffer, sizeof(ip_strv4) - 2); *(ip_strv4 + (sizeof(ip_strv4) - 1)) = '\0'; ptr = strdup(ip_strv4); netmask_v4 = is_netmask_v4(ptr); if(ptr != NULL) { free(ptr); ptr = NULL; } if(netmask_v4 == 0) return NULL; else if(netmask_v4 != NETMASK_32) { ip_strv4[strlen(ip_strv4)-3] = '\0'; } ret = inet_pton(AF_INET, ip_strv4, &addr4); if (ret <= 0) { return NULL; } ip = addr4.s_addr; tree->count++; return CPTAddElement((unsigned char *)&ip, NETMASK_32, tree, netmask_v4); case IPV6_TREE: memset(&addr6, 0, sizeof(addr6)); memset(ip_strv6, 0x0, NETMASK_128); strncpy(ip_strv6, buffer, sizeof(ip_strv6) - 2); *(ip_strv6 + sizeof(ip_strv6) - 1) = '\0'; ptr = strdup(ip_strv6); netmask_v6 = is_netmask_v6(ptr); if(ptr != NULL) { free(ptr); ptr = NULL; } if(netmask_v6 == 0) return NULL; else if (netmask_v6 != NETMASK_64) { ip_strv4[strlen(ip_strv6)-3] = '\0'; } ret = inet_pton(AF_INET6, ip_strv6, &addr6); if(ret <= 0) return NULL; tree->count++; return CPTAddElement((unsigned char *)&addr6.s6_addr, NETMASK_128, tree, netmask_v6); default: return NULL; } return NULL; } modsecurity-apache_2.7.7/apache2/msc_parsers.c0000664000175000017500000002411712243422537021634 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #include "msc_parsers.h" #include /** * */ int parse_cookies_v0(modsec_rec *msr, char *_cookie_header, apr_table_t *cookies, const char *delim) { char *attr_name = NULL, *attr_value = NULL; char *cookie_header; char *saveptr = NULL; int cookie_count = 0; char *p = NULL; if (_cookie_header == NULL) { msr_log(msr, 1, "Cookie parser: Received null for argument."); return -1; } cookie_header = strdup(_cookie_header); if (cookie_header == NULL) return -1; if(msr->txcfg->cookiev0_separator == NULL) { p = apr_strtok(cookie_header, delim, &saveptr); } else { p = apr_strtok(cookie_header, msr->txcfg->cookiev0_separator, &saveptr); } while(p != NULL) { attr_name = NULL; attr_value = NULL; /* ignore whitespace at the beginning of cookie name */ while(isspace(*p)) p++; attr_name = p; attr_value = strstr(p, "="); if (attr_value != NULL) { /* terminate cookie name */ *attr_value = 0; /* move over to the beginning of the value */ attr_value++; } /* we ignore cookies with empty names */ if ((attr_name != NULL)&&(strlen(attr_name) != 0)) { if (attr_value != NULL) { if (msr->txcfg->debuglog_level >= 5) { msr_log(msr, 5, "Adding request cookie: name \"%s\", value \"%s\"", log_escape(msr->mp, attr_name), log_escape(msr->mp, attr_value)); } apr_table_add(cookies, attr_name, attr_value); } else { if (msr->txcfg->debuglog_level >= 5) { msr_log(msr, 5, "Adding request cookie: name \"%s\", value empty", log_escape(msr->mp, attr_name)); } apr_table_add(cookies, attr_name, ""); } cookie_count++; } if(msr->txcfg->cookiev0_separator == NULL) { p = apr_strtok(NULL, delim, &saveptr); } else { p = apr_strtok(NULL, msr->txcfg->cookiev0_separator, &saveptr); } } free(cookie_header); return cookie_count; } /** * */ int parse_cookies_v1(modsec_rec *msr, char *_cookie_header, apr_table_t *cookies) { char *attr_name = NULL, *attr_value = NULL, *p = NULL; char *prev_attr_name = NULL; char *cookie_header = NULL; int cookie_count = 0; if (_cookie_header == NULL) return -1; // XXX Should it not match _v0 parser? //if (_cookie_header == NULL) { // msr_log(msr, 1, "Cookie parser: Received null for argument."); // return -1; //} cookie_header = strdup(_cookie_header); if (cookie_header == NULL) return -1; p = cookie_header; while(*p != 0) { attr_name = NULL; attr_value = NULL; /* attribute name */ /* remove space from the beginning */ while((isspace(*p))&&(*p != 0)) p++; attr_name = p; while((*p != 0)&&(*p != '=')&&(*p != ';')&&(*p != ',')) p++; /* if we've reached the end of string */ if (*p == 0) goto add_cookie; /* if there is no cookie value supplied */ if ((*p == ';')||(*p == ',')) { *p++ = 0; /* terminate the name */ goto add_cookie; } /* terminate the attribute name, * writing over the = character */ *p++ = 0; /* attribute value */ /* skip over the whitespace at the beginning */ while((isspace(*p))&&(*p != 0)) p++; /* no value supplied */ if (*p == 0) goto add_cookie; if (*p == '"') { if (*++p == 0) goto add_cookie; attr_value = p; while((*p != 0)&&(*p != '"')) p++; if (*p != 0) *p++ = 0; else { /* Do nothing about this. */ } } else { attr_value = p; while((*p != 0)&&(*p != ',')&&(*p != ';')) p++; if (*p != 0) *p++ = 0; /* remove the whitespace from the end of cookie value */ if (attr_value != NULL) { char *t = attr_value; int i = 0; while(*t != 0) { t++; i++; } while((i-- > 0)&&(isspace(*(--t)))) *t = 0; } } add_cookie: /* remove the whitespace from the end of cookie name */ if (attr_name != NULL) { char *t = attr_name; int i = 0; while(*t != 0) { t++; i++; } while((i-- > 0)&&(isspace(*(--t)))) *t = 0; } /* add the cookie to the list now */ if ((attr_name != NULL)&&(strlen(attr_name) != 0)) { /* handle special attribute names */ if (attr_name[0] == '$') { if (prev_attr_name != NULL) { /* cookie keyword, we change the name we use * so they can have a unique name in the cookie table */ attr_name = apr_psprintf(msr->mp, "$%s_%s", prev_attr_name, attr_name + 1); } } if (attr_value != NULL) { if (msr->txcfg->debuglog_level >= 5) { msr_log(msr, 5, "Adding request cookie: name \"%s\", value \"%s\"", log_escape(msr->mp, attr_name), log_escape(msr->mp, attr_value)); } apr_table_add(cookies, attr_name, attr_value); } else { if (msr->txcfg->debuglog_level >= 5) { msr_log(msr, 5, "Adding request cookie: name \"%s\", value empty", log_escape(msr->mp, attr_name)); } apr_table_add(cookies, attr_name, ""); } cookie_count++; /* only keep the cookie names for later */ if (attr_name[0] != '$') prev_attr_name = attr_name; } /* at this point the *p is either 0 (in which case we exit), or * right after the current cookie ended - we need to look for * the next cookie */ while( (*p != 0)&&( (*p == ',')||(*p == ';')||(isspace(*p)) ) ) p++; } free(cookie_header); return cookie_count; } /** * */ int parse_arguments(modsec_rec *msr, const char *s, apr_size_t inputlength, int argument_separator, const char *origin, apr_table_t *arguments, int *invalid_count) { msc_arg *arg; apr_size_t i, j; char *value = NULL; char *buf; int status; int changed; if (s == NULL) return -1; if (inputlength == 0) return 1; /* Check that adding one will not overflow */ if (inputlength + 1 <= 0) return -1; buf = (char *)malloc(inputlength + 1); if (buf == NULL) return -1; arg = (msc_arg *)apr_pcalloc(msr->mp, sizeof(msc_arg)); arg->origin = origin; i = 0; j = 0; status = 0; *invalid_count = 0; while (i < inputlength) { if (status == 0) { /* parameter name */ arg->name_origin_offset = i; while ((s[i] != '=') && (s[i] != argument_separator) && (i < inputlength)) { buf[j] = s[i]; j++; i++; } buf[j++] = '\0'; arg->name_origin_len = i - arg->name_origin_offset; } else { /* parameter value */ arg->value_origin_offset = i; while ((s[i] != argument_separator) && (i < inputlength)) { buf[j] = s[i]; j++; i++; } buf[j++] = '\0'; arg->value_origin_len = i - arg->value_origin_offset; } if (status == 0) { arg->name_len = urldecode_nonstrict_inplace_ex((unsigned char *)buf, arg->name_origin_len, invalid_count, &changed); arg->name = apr_pstrmemdup(msr->mp, buf, arg->name_len); if (s[i] == argument_separator) { /* Empty parameter */ arg->value_len = 0; arg->value = ""; add_argument(msr, arguments, arg); arg = (msc_arg *)apr_pcalloc(msr->mp, sizeof(msc_arg)); arg->origin = origin; status = 0; /* unchanged */ j = 0; } else { status = 1; value = &buf[j]; } } else { arg->value_len = urldecode_nonstrict_inplace_ex((unsigned char *)value, arg->value_origin_len, invalid_count, &changed); arg->value = apr_pstrmemdup(msr->mp, value, arg->value_len); add_argument(msr, arguments, arg); arg = (msc_arg *)apr_pcalloc(msr->mp, sizeof(msc_arg)); arg->origin = origin; status = 0; j = 0; } i++; /* skip over the separator */ } /* the last parameter was empty */ if (status == 1) { arg->value_len = 0; arg->value = ""; add_argument(msr, arguments, arg); } free(buf); return 1; } /** * */ void add_argument(modsec_rec *msr, apr_table_t *arguments, msc_arg *arg) { if (msr->txcfg->debuglog_level >= 5) { msr_log(msr, 5, "Adding request argument (%s): name \"%s\", value \"%s\"", arg->origin, log_escape_ex(msr->mp, arg->name, arg->name_len), log_escape_ex(msr->mp, arg->value, arg->value_len)); } apr_table_addn(arguments, log_escape_nq_ex(msr->mp, arg->name, arg->name_len), (void *)arg); } modsecurity-apache_2.7.7/apache2/Makefile.in0000664000175000017500000017043012254306021021203 0ustar zimmerlezimmerle# Makefile.in generated by automake 1.13.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = apache2 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(srcdir)/modsecurity_config_auto.h.in \ $(top_srcdir)/build/depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/build/find_apr.m4 \ $(top_srcdir)/build/find_apu.m4 \ $(top_srcdir)/build/find_curl.m4 \ $(top_srcdir)/build/find_lua.m4 \ $(top_srcdir)/build/find_pcre.m4 \ $(top_srcdir)/build/find_xml.m4 $(top_srcdir)/build/libtool.m4 \ $(top_srcdir)/build/ltoptions.m4 \ $(top_srcdir)/build/ltsugar.m4 \ $(top_srcdir)/build/ltversion.m4 \ $(top_srcdir)/build/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = modsecurity_config_auto.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(pkglibdir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) mod_security2_la_DEPENDENCIES = am_mod_security2_la_OBJECTS = mod_security2_la-acmp.lo \ mod_security2_la-apache2_config.lo \ mod_security2_la-apache2_io.lo \ mod_security2_la-apache2_util.lo \ mod_security2_la-libinjection_sqli.lo \ mod_security2_la-mod_security2.lo \ mod_security2_la-modsecurity.lo mod_security2_la-msc_crypt.lo \ mod_security2_la-msc_geo.lo mod_security2_la-msc_gsb.lo \ mod_security2_la-msc_logging.lo mod_security2_la-msc_lua.lo \ mod_security2_la-msc_multipart.lo \ mod_security2_la-msc_parsers.lo mod_security2_la-msc_pcre.lo \ mod_security2_la-msc_release.lo \ mod_security2_la-msc_reqbody.lo mod_security2_la-msc_tree.lo \ mod_security2_la-msc_unicode.lo mod_security2_la-msc_util.lo \ mod_security2_la-msc_xml.lo mod_security2_la-persist_dbm.lo \ mod_security2_la-re_actions.lo mod_security2_la-re.lo \ mod_security2_la-re_operators.lo mod_security2_la-re_tfns.lo \ mod_security2_la-re_variables.lo mod_security2_la_OBJECTS = $(am_mod_security2_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = mod_security2_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(mod_security2_la_CFLAGS) $(CFLAGS) \ $(mod_security2_la_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/build/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(mod_security2_la_SOURCES) DIST_SOURCES = $(mod_security2_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ $(LISP)modsecurity_config_auto.h.in # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) pkglibdir = $(prefix)/lib ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APR_CFLAGS = @APR_CFLAGS@ APR_CONFIG = @APR_CONFIG@ APR_CPPFLAGS = @APR_CPPFLAGS@ APR_INCLUDEDIR = @APR_INCLUDEDIR@ APR_LDADD = @APR_LDADD@ APR_LDFLAGS = @APR_LDFLAGS@ APR_LINKLD = @APR_LINKLD@ APR_VERSION = @APR_VERSION@ APU_CFLAGS = @APU_CFLAGS@ APU_CONFIG = @APU_CONFIG@ APU_INCLUDEDIR = @APU_INCLUDEDIR@ APU_LDADD = @APU_LDADD@ APU_LDFLAGS = @APU_LDFLAGS@ APU_LINKLD = @APU_LINKLD@ APU_VERSION = @APU_VERSION@ APXS = @APXS@ APXS_BINDIR = @APXS_BINDIR@ APXS_CC = @APXS_CC@ APXS_CFLAGS = @APXS_CFLAGS@ APXS_EXTRA_CFLAGS = @APXS_EXTRA_CFLAGS@ APXS_HTTPD = @APXS_HTTPD@ APXS_INCLUDEDIR = @APXS_INCLUDEDIR@ APXS_INCLUDES = @APXS_INCLUDES@ APXS_LDFLAGS = @APXS_LDFLAGS@ APXS_LIBDIR = @APXS_LIBDIR@ APXS_LIBEXECDIR = @APXS_LIBEXECDIR@ APXS_LIBS = @APXS_LIBS@ APXS_LIBTOOL = @APXS_LIBTOOL@ APXS_MODULES = @APXS_MODULES@ APXS_PROGNAME = @APXS_PROGNAME@ APXS_SBINDIR = @APXS_SBINDIR@ APXS_WRAPPER = @APXS_WRAPPER@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CURL_CFLAGS = @CURL_CFLAGS@ CURL_CONFIG = @CURL_CONFIG@ CURL_CPPFLAGS = @CURL_CPPFLAGS@ CURL_LDADD = @CURL_LDADD@ CURL_LDFLAGS = @CURL_LDFLAGS@ CURL_USES_GNUTLS = @CURL_USES_GNUTLS@ CURL_VERSION = @CURL_VERSION@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENV_CMD = @ENV_CMD@ EXEEXT = @EXEEXT@ EXTRA_CFLAGS = @EXTRA_CFLAGS@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ LIBXML2_CONFIG = @LIBXML2_CONFIG@ LIBXML2_CPPFLAGS = @LIBXML2_CPPFLAGS@ LIBXML2_LDADD = @LIBXML2_LDADD@ LIBXML2_LDFLAGS = @LIBXML2_LDFLAGS@ LIBXML2_VERSION = @LIBXML2_VERSION@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LUA_CFLAGS = @LUA_CFLAGS@ LUA_LDADD = @LUA_LDADD@ LUA_LDFLAGS = @LUA_LDFLAGS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MODSEC_APXS_EXTRA_CFLAGS = @MODSEC_APXS_EXTRA_CFLAGS@ MODSEC_EXTRA_CFLAGS = @MODSEC_EXTRA_CFLAGS@ MSC_BASE_DIR = @MSC_BASE_DIR@ MSC_PKGBASE_DIR = @MSC_PKGBASE_DIR@ MSC_REGRESSION_CONF_DIR = @MSC_REGRESSION_CONF_DIR@ MSC_REGRESSION_DIR = @MSC_REGRESSION_DIR@ MSC_REGRESSION_DOCROOT_DIR = @MSC_REGRESSION_DOCROOT_DIR@ MSC_REGRESSION_LOGS_DIR = @MSC_REGRESSION_LOGS_DIR@ MSC_REGRESSION_SERVERROOT_DIR = @MSC_REGRESSION_SERVERROOT_DIR@ MSC_TEST_DIR = @MSC_TEST_DIR@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCRE_CFLAGS = @PCRE_CFLAGS@ PCRE_CONFIG = @PCRE_CONFIG@ PCRE_CPPFLAGS = @PCRE_CPPFLAGS@ PCRE_LDADD = @PCRE_LDADD@ PCRE_LDFLAGS = @PCRE_LDFLAGS@ PCRE_LD_PATH = @PCRE_LD_PATH@ PCRE_VERSION = @PCRE_VERSION@ PERL = @PERL@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOPLEVEL_SUBDIRS = @TOPLEVEL_SUBDIRS@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ pkglib_LTLIBRARIES = mod_security2.la mod_security2_la_SOURCES = acmp.c \ apache2_config.c \ apache2_io.c \ apache2_util.c \ libinjection/libinjection_sqli.c \ mod_security2.c \ modsecurity.c \ msc_crypt.c \ msc_geo.c \ msc_gsb.c \ msc_logging.c \ msc_lua.c \ msc_multipart.c \ msc_parsers.c \ msc_pcre.c \ msc_release.c \ msc_reqbody.c \ msc_tree.c \ msc_unicode.c \ msc_util.c \ msc_xml.c \ persist_dbm.c \ re_actions.c \ re.c \ re_operators.c \ re_tfns.c \ re_variables.c mod_security2_la_CFLAGS = @APR_CFLAGS@ \ @APU_CFLAGS@ \ @APXS_CFLAGS@ \ @CURL_CFLAGS@ \ @LIBXML2_CFLAGS@ \ @LUA_CFLAGS@ \ @MODSEC_EXTRA_CFLAGS@ \ @PCRE_CFLAGS@ mod_security2_la_CPPFLAGS = @APR_CPPFLAGS@ \ @LIBXML2_CPPFLAGS@ \ @PCRE_CPPFLAGS@ mod_security2_la_LIBADD = @APR_LDADD@ \ @APU_LDADD@ \ @LIBXML2_LDADD@ \ @LUA_LDADD@ \ @PCRE_LDADD@ @AIX_TRUE@mod_security2_la_LDFLAGS = -module -avoid-version \ @AIX_TRUE@ @APR_LDFLAGS@ \ @AIX_TRUE@ @APU_LDFLAGS@ \ @AIX_TRUE@ @APXS_LDFLAGS@ \ @AIX_TRUE@ @LIBXML2_LDFLAGS@ \ @AIX_TRUE@ @LUA_LDFLAGS@ \ @AIX_TRUE@ @PCRE_LDFLAGS@ @FREEBSD_TRUE@mod_security2_la_LDFLAGS = -no-undefined -module -avoid-version \ @FREEBSD_TRUE@ @APR_LDFLAGS@ \ @FREEBSD_TRUE@ @APU_LDFLAGS@ \ @FREEBSD_TRUE@ @APXS_LDFLAGS@ \ @FREEBSD_TRUE@ @LIBXML2_LDFLAGS@ \ @FREEBSD_TRUE@ @LUA_LDFLAGS@ \ @FREEBSD_TRUE@ @PCRE_LDFLAGS@ @HPUX_TRUE@mod_security2_la_LDFLAGS = -module -avoid-version \ @HPUX_TRUE@ @APR_LDFLAGS@ \ @HPUX_TRUE@ @APU_LDFLAGS@ \ @HPUX_TRUE@ @APXS_LDFLAGS@ \ @HPUX_TRUE@ @LIBXML2_LDFLAGS@ \ @HPUX_TRUE@ @LUA_LDFLAGS@ \ @HPUX_TRUE@ @PCRE_LDFLAGS@ @LINUX_TRUE@mod_security2_la_LDFLAGS = -no-undefined -module -avoid-version -R @PCRE_LD_PATH@ \ @LINUX_TRUE@ @APR_LDFLAGS@ \ @LINUX_TRUE@ @APU_LDFLAGS@ \ @LINUX_TRUE@ @APXS_LDFLAGS@ \ @LINUX_TRUE@ @LIBXML2_LDFLAGS@ \ @LINUX_TRUE@ @LUA_LDFLAGS@ \ @LINUX_TRUE@ @PCRE_LDFLAGS@ @MACOSX_TRUE@mod_security2_la_LDFLAGS = -module -avoid-version \ @MACOSX_TRUE@ @APR_LDFLAGS@ \ @MACOSX_TRUE@ @APU_LDFLAGS@ \ @MACOSX_TRUE@ @APXS_LDFLAGS@ \ @MACOSX_TRUE@ @LIBXML2_LDFLAGS@ \ @MACOSX_TRUE@ @LUA_LDFLAGS@ \ @MACOSX_TRUE@ @PCRE_LDFLAGS@ @NETBSD_TRUE@mod_security2_la_LDFLAGS = -no-undefined -module -avoid-version \ @NETBSD_TRUE@ @APR_LDFLAGS@ \ @NETBSD_TRUE@ @APU_LDFLAGS@ \ @NETBSD_TRUE@ @APXS_LDFLAGS@ \ @NETBSD_TRUE@ @LIBXML2_LDFLAGS@ \ @NETBSD_TRUE@ @LUA_LDFLAGS@ \ @NETBSD_TRUE@ @PCRE_LDFLAGS@ @OPENBSD_TRUE@mod_security2_la_LDFLAGS = -no-undefined -module -avoid-version \ @OPENBSD_TRUE@ @APR_LDFLAGS@ \ @OPENBSD_TRUE@ @APU_LDFLAGS@ \ @OPENBSD_TRUE@ @APXS_LDFLAGS@ \ @OPENBSD_TRUE@ @LIBXML2_LDFLAGS@ \ @OPENBSD_TRUE@ @LUA_LDFLAGS@ \ @OPENBSD_TRUE@ @PCRE_LDFLAGS@ @SOLARIS_TRUE@mod_security2_la_LDFLAGS = -module -avoid-version \ @SOLARIS_TRUE@ @APR_LDFLAGS@ \ @SOLARIS_TRUE@ @APU_LDFLAGS@ \ @SOLARIS_TRUE@ @APXS_LDFLAGS@ \ @SOLARIS_TRUE@ @LIBXML2_LDFLAGS@ \ @SOLARIS_TRUE@ @LUA_LDFLAGS@ \ @SOLARIS_TRUE@ @PCRE_LDFLAGS@ all: modsecurity_config_auto.h $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign apache2/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign apache2/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): modsecurity_config_auto.h: stamp-h1 @if test ! -f $@; then rm -f stamp-h1; else :; fi @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi stamp-h1: $(srcdir)/modsecurity_config_auto.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status apache2/modsecurity_config_auto.h $(srcdir)/modsecurity_config_auto.h.in: $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f modsecurity_config_auto.h stamp-h1 install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(MKDIR_P) '$(DESTDIR)$(pkglibdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ } uninstall-pkglibLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ done clean-pkglibLTLIBRARIES: -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) @list='$(pkglib_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } mod_security2.la: $(mod_security2_la_OBJECTS) $(mod_security2_la_DEPENDENCIES) $(EXTRA_mod_security2_la_DEPENDENCIES) $(AM_V_CCLD)$(mod_security2_la_LINK) -rpath $(pkglibdir) $(mod_security2_la_OBJECTS) $(mod_security2_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mod_security2_la-acmp.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mod_security2_la-apache2_config.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mod_security2_la-apache2_io.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mod_security2_la-apache2_util.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mod_security2_la-libinjection_sqli.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mod_security2_la-mod_security2.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mod_security2_la-modsecurity.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mod_security2_la-msc_crypt.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mod_security2_la-msc_geo.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mod_security2_la-msc_gsb.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mod_security2_la-msc_logging.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mod_security2_la-msc_lua.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mod_security2_la-msc_multipart.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mod_security2_la-msc_parsers.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mod_security2_la-msc_pcre.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mod_security2_la-msc_release.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mod_security2_la-msc_reqbody.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mod_security2_la-msc_tree.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mod_security2_la-msc_unicode.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mod_security2_la-msc_util.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mod_security2_la-msc_xml.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mod_security2_la-persist_dbm.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mod_security2_la-re.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mod_security2_la-re_actions.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mod_security2_la-re_operators.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mod_security2_la-re_tfns.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mod_security2_la-re_variables.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mod_security2_la-acmp.lo: acmp.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_security2_la_CPPFLAGS) $(CPPFLAGS) $(mod_security2_la_CFLAGS) $(CFLAGS) -MT mod_security2_la-acmp.lo -MD -MP -MF $(DEPDIR)/mod_security2_la-acmp.Tpo -c -o mod_security2_la-acmp.lo `test -f 'acmp.c' || echo '$(srcdir)/'`acmp.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mod_security2_la-acmp.Tpo $(DEPDIR)/mod_security2_la-acmp.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='acmp.c' object='mod_security2_la-acmp.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_security2_la_CPPFLAGS) $(CPPFLAGS) $(mod_security2_la_CFLAGS) $(CFLAGS) -c -o mod_security2_la-acmp.lo `test -f 'acmp.c' || echo '$(srcdir)/'`acmp.c mod_security2_la-apache2_config.lo: apache2_config.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_security2_la_CPPFLAGS) $(CPPFLAGS) $(mod_security2_la_CFLAGS) $(CFLAGS) -MT mod_security2_la-apache2_config.lo -MD -MP -MF $(DEPDIR)/mod_security2_la-apache2_config.Tpo -c -o mod_security2_la-apache2_config.lo `test -f 'apache2_config.c' || echo '$(srcdir)/'`apache2_config.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mod_security2_la-apache2_config.Tpo $(DEPDIR)/mod_security2_la-apache2_config.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='apache2_config.c' object='mod_security2_la-apache2_config.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_security2_la_CPPFLAGS) $(CPPFLAGS) $(mod_security2_la_CFLAGS) $(CFLAGS) -c -o mod_security2_la-apache2_config.lo `test -f 'apache2_config.c' || echo '$(srcdir)/'`apache2_config.c mod_security2_la-apache2_io.lo: apache2_io.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_security2_la_CPPFLAGS) $(CPPFLAGS) $(mod_security2_la_CFLAGS) $(CFLAGS) -MT mod_security2_la-apache2_io.lo -MD -MP -MF $(DEPDIR)/mod_security2_la-apache2_io.Tpo -c -o mod_security2_la-apache2_io.lo `test -f 'apache2_io.c' || echo '$(srcdir)/'`apache2_io.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mod_security2_la-apache2_io.Tpo $(DEPDIR)/mod_security2_la-apache2_io.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='apache2_io.c' object='mod_security2_la-apache2_io.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_security2_la_CPPFLAGS) $(CPPFLAGS) $(mod_security2_la_CFLAGS) $(CFLAGS) -c -o mod_security2_la-apache2_io.lo `test -f 'apache2_io.c' || echo '$(srcdir)/'`apache2_io.c mod_security2_la-apache2_util.lo: apache2_util.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_security2_la_CPPFLAGS) $(CPPFLAGS) $(mod_security2_la_CFLAGS) $(CFLAGS) -MT mod_security2_la-apache2_util.lo -MD -MP -MF $(DEPDIR)/mod_security2_la-apache2_util.Tpo -c -o mod_security2_la-apache2_util.lo `test -f 'apache2_util.c' || echo '$(srcdir)/'`apache2_util.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mod_security2_la-apache2_util.Tpo $(DEPDIR)/mod_security2_la-apache2_util.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='apache2_util.c' object='mod_security2_la-apache2_util.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_security2_la_CPPFLAGS) $(CPPFLAGS) $(mod_security2_la_CFLAGS) $(CFLAGS) -c -o mod_security2_la-apache2_util.lo `test -f 'apache2_util.c' || echo '$(srcdir)/'`apache2_util.c mod_security2_la-libinjection_sqli.lo: libinjection/libinjection_sqli.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_security2_la_CPPFLAGS) $(CPPFLAGS) $(mod_security2_la_CFLAGS) $(CFLAGS) -MT mod_security2_la-libinjection_sqli.lo -MD -MP -MF $(DEPDIR)/mod_security2_la-libinjection_sqli.Tpo -c -o mod_security2_la-libinjection_sqli.lo `test -f 'libinjection/libinjection_sqli.c' || echo '$(srcdir)/'`libinjection/libinjection_sqli.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mod_security2_la-libinjection_sqli.Tpo $(DEPDIR)/mod_security2_la-libinjection_sqli.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libinjection/libinjection_sqli.c' object='mod_security2_la-libinjection_sqli.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_security2_la_CPPFLAGS) $(CPPFLAGS) $(mod_security2_la_CFLAGS) $(CFLAGS) -c -o mod_security2_la-libinjection_sqli.lo `test -f 'libinjection/libinjection_sqli.c' || echo '$(srcdir)/'`libinjection/libinjection_sqli.c mod_security2_la-mod_security2.lo: mod_security2.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_security2_la_CPPFLAGS) $(CPPFLAGS) $(mod_security2_la_CFLAGS) $(CFLAGS) -MT mod_security2_la-mod_security2.lo -MD -MP -MF $(DEPDIR)/mod_security2_la-mod_security2.Tpo -c -o mod_security2_la-mod_security2.lo `test -f 'mod_security2.c' || echo '$(srcdir)/'`mod_security2.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mod_security2_la-mod_security2.Tpo $(DEPDIR)/mod_security2_la-mod_security2.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mod_security2.c' object='mod_security2_la-mod_security2.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_security2_la_CPPFLAGS) $(CPPFLAGS) $(mod_security2_la_CFLAGS) $(CFLAGS) -c -o mod_security2_la-mod_security2.lo `test -f 'mod_security2.c' || echo '$(srcdir)/'`mod_security2.c mod_security2_la-modsecurity.lo: modsecurity.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_security2_la_CPPFLAGS) $(CPPFLAGS) $(mod_security2_la_CFLAGS) $(CFLAGS) -MT mod_security2_la-modsecurity.lo -MD -MP -MF $(DEPDIR)/mod_security2_la-modsecurity.Tpo -c -o mod_security2_la-modsecurity.lo `test -f 'modsecurity.c' || echo '$(srcdir)/'`modsecurity.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mod_security2_la-modsecurity.Tpo $(DEPDIR)/mod_security2_la-modsecurity.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='modsecurity.c' object='mod_security2_la-modsecurity.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_security2_la_CPPFLAGS) $(CPPFLAGS) $(mod_security2_la_CFLAGS) $(CFLAGS) -c -o mod_security2_la-modsecurity.lo `test -f 'modsecurity.c' || echo '$(srcdir)/'`modsecurity.c mod_security2_la-msc_crypt.lo: msc_crypt.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_security2_la_CPPFLAGS) $(CPPFLAGS) $(mod_security2_la_CFLAGS) $(CFLAGS) -MT mod_security2_la-msc_crypt.lo -MD -MP -MF $(DEPDIR)/mod_security2_la-msc_crypt.Tpo -c -o mod_security2_la-msc_crypt.lo `test -f 'msc_crypt.c' || echo '$(srcdir)/'`msc_crypt.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mod_security2_la-msc_crypt.Tpo $(DEPDIR)/mod_security2_la-msc_crypt.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='msc_crypt.c' object='mod_security2_la-msc_crypt.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_security2_la_CPPFLAGS) $(CPPFLAGS) $(mod_security2_la_CFLAGS) $(CFLAGS) -c -o mod_security2_la-msc_crypt.lo `test -f 'msc_crypt.c' || echo '$(srcdir)/'`msc_crypt.c mod_security2_la-msc_geo.lo: msc_geo.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_security2_la_CPPFLAGS) $(CPPFLAGS) $(mod_security2_la_CFLAGS) $(CFLAGS) -MT mod_security2_la-msc_geo.lo -MD -MP -MF $(DEPDIR)/mod_security2_la-msc_geo.Tpo -c -o mod_security2_la-msc_geo.lo `test -f 'msc_geo.c' || echo '$(srcdir)/'`msc_geo.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mod_security2_la-msc_geo.Tpo $(DEPDIR)/mod_security2_la-msc_geo.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='msc_geo.c' object='mod_security2_la-msc_geo.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_security2_la_CPPFLAGS) $(CPPFLAGS) $(mod_security2_la_CFLAGS) $(CFLAGS) -c -o mod_security2_la-msc_geo.lo `test -f 'msc_geo.c' || echo '$(srcdir)/'`msc_geo.c mod_security2_la-msc_gsb.lo: msc_gsb.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_security2_la_CPPFLAGS) $(CPPFLAGS) $(mod_security2_la_CFLAGS) $(CFLAGS) -MT mod_security2_la-msc_gsb.lo -MD -MP -MF $(DEPDIR)/mod_security2_la-msc_gsb.Tpo -c -o mod_security2_la-msc_gsb.lo `test -f 'msc_gsb.c' || echo '$(srcdir)/'`msc_gsb.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mod_security2_la-msc_gsb.Tpo $(DEPDIR)/mod_security2_la-msc_gsb.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='msc_gsb.c' object='mod_security2_la-msc_gsb.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_security2_la_CPPFLAGS) $(CPPFLAGS) $(mod_security2_la_CFLAGS) $(CFLAGS) -c -o mod_security2_la-msc_gsb.lo `test -f 'msc_gsb.c' || echo '$(srcdir)/'`msc_gsb.c mod_security2_la-msc_logging.lo: msc_logging.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_security2_la_CPPFLAGS) $(CPPFLAGS) $(mod_security2_la_CFLAGS) $(CFLAGS) -MT mod_security2_la-msc_logging.lo -MD -MP -MF $(DEPDIR)/mod_security2_la-msc_logging.Tpo -c -o mod_security2_la-msc_logging.lo `test -f 'msc_logging.c' || echo '$(srcdir)/'`msc_logging.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mod_security2_la-msc_logging.Tpo $(DEPDIR)/mod_security2_la-msc_logging.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='msc_logging.c' object='mod_security2_la-msc_logging.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_security2_la_CPPFLAGS) $(CPPFLAGS) $(mod_security2_la_CFLAGS) $(CFLAGS) -c -o mod_security2_la-msc_logging.lo `test -f 'msc_logging.c' || echo '$(srcdir)/'`msc_logging.c mod_security2_la-msc_lua.lo: msc_lua.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_security2_la_CPPFLAGS) $(CPPFLAGS) $(mod_security2_la_CFLAGS) $(CFLAGS) -MT mod_security2_la-msc_lua.lo -MD -MP -MF $(DEPDIR)/mod_security2_la-msc_lua.Tpo -c -o mod_security2_la-msc_lua.lo `test -f 'msc_lua.c' || echo '$(srcdir)/'`msc_lua.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mod_security2_la-msc_lua.Tpo $(DEPDIR)/mod_security2_la-msc_lua.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='msc_lua.c' object='mod_security2_la-msc_lua.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_security2_la_CPPFLAGS) $(CPPFLAGS) $(mod_security2_la_CFLAGS) $(CFLAGS) -c -o mod_security2_la-msc_lua.lo `test -f 'msc_lua.c' || echo '$(srcdir)/'`msc_lua.c mod_security2_la-msc_multipart.lo: msc_multipart.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_security2_la_CPPFLAGS) $(CPPFLAGS) $(mod_security2_la_CFLAGS) $(CFLAGS) -MT mod_security2_la-msc_multipart.lo -MD -MP -MF $(DEPDIR)/mod_security2_la-msc_multipart.Tpo -c -o mod_security2_la-msc_multipart.lo `test -f 'msc_multipart.c' || echo '$(srcdir)/'`msc_multipart.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mod_security2_la-msc_multipart.Tpo $(DEPDIR)/mod_security2_la-msc_multipart.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='msc_multipart.c' object='mod_security2_la-msc_multipart.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_security2_la_CPPFLAGS) $(CPPFLAGS) $(mod_security2_la_CFLAGS) $(CFLAGS) -c -o mod_security2_la-msc_multipart.lo `test -f 'msc_multipart.c' || echo '$(srcdir)/'`msc_multipart.c mod_security2_la-msc_parsers.lo: msc_parsers.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_security2_la_CPPFLAGS) $(CPPFLAGS) $(mod_security2_la_CFLAGS) $(CFLAGS) -MT mod_security2_la-msc_parsers.lo -MD -MP -MF $(DEPDIR)/mod_security2_la-msc_parsers.Tpo -c -o mod_security2_la-msc_parsers.lo `test -f 'msc_parsers.c' || echo '$(srcdir)/'`msc_parsers.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mod_security2_la-msc_parsers.Tpo $(DEPDIR)/mod_security2_la-msc_parsers.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='msc_parsers.c' object='mod_security2_la-msc_parsers.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_security2_la_CPPFLAGS) $(CPPFLAGS) $(mod_security2_la_CFLAGS) $(CFLAGS) -c -o mod_security2_la-msc_parsers.lo `test -f 'msc_parsers.c' || echo '$(srcdir)/'`msc_parsers.c mod_security2_la-msc_pcre.lo: msc_pcre.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_security2_la_CPPFLAGS) $(CPPFLAGS) $(mod_security2_la_CFLAGS) $(CFLAGS) -MT mod_security2_la-msc_pcre.lo -MD -MP -MF $(DEPDIR)/mod_security2_la-msc_pcre.Tpo -c -o mod_security2_la-msc_pcre.lo `test -f 'msc_pcre.c' || echo '$(srcdir)/'`msc_pcre.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mod_security2_la-msc_pcre.Tpo $(DEPDIR)/mod_security2_la-msc_pcre.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='msc_pcre.c' object='mod_security2_la-msc_pcre.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_security2_la_CPPFLAGS) $(CPPFLAGS) $(mod_security2_la_CFLAGS) $(CFLAGS) -c -o mod_security2_la-msc_pcre.lo `test -f 'msc_pcre.c' || echo '$(srcdir)/'`msc_pcre.c mod_security2_la-msc_release.lo: msc_release.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_security2_la_CPPFLAGS) $(CPPFLAGS) $(mod_security2_la_CFLAGS) $(CFLAGS) -MT mod_security2_la-msc_release.lo -MD -MP -MF $(DEPDIR)/mod_security2_la-msc_release.Tpo -c -o mod_security2_la-msc_release.lo `test -f 'msc_release.c' || echo '$(srcdir)/'`msc_release.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mod_security2_la-msc_release.Tpo $(DEPDIR)/mod_security2_la-msc_release.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='msc_release.c' object='mod_security2_la-msc_release.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_security2_la_CPPFLAGS) $(CPPFLAGS) $(mod_security2_la_CFLAGS) $(CFLAGS) -c -o mod_security2_la-msc_release.lo `test -f 'msc_release.c' || echo '$(srcdir)/'`msc_release.c mod_security2_la-msc_reqbody.lo: msc_reqbody.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_security2_la_CPPFLAGS) $(CPPFLAGS) $(mod_security2_la_CFLAGS) $(CFLAGS) -MT mod_security2_la-msc_reqbody.lo -MD -MP -MF $(DEPDIR)/mod_security2_la-msc_reqbody.Tpo -c -o mod_security2_la-msc_reqbody.lo `test -f 'msc_reqbody.c' || echo '$(srcdir)/'`msc_reqbody.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mod_security2_la-msc_reqbody.Tpo $(DEPDIR)/mod_security2_la-msc_reqbody.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='msc_reqbody.c' object='mod_security2_la-msc_reqbody.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_security2_la_CPPFLAGS) $(CPPFLAGS) $(mod_security2_la_CFLAGS) $(CFLAGS) -c -o mod_security2_la-msc_reqbody.lo `test -f 'msc_reqbody.c' || echo '$(srcdir)/'`msc_reqbody.c mod_security2_la-msc_tree.lo: msc_tree.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_security2_la_CPPFLAGS) $(CPPFLAGS) $(mod_security2_la_CFLAGS) $(CFLAGS) -MT mod_security2_la-msc_tree.lo -MD -MP -MF $(DEPDIR)/mod_security2_la-msc_tree.Tpo -c -o mod_security2_la-msc_tree.lo `test -f 'msc_tree.c' || echo '$(srcdir)/'`msc_tree.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mod_security2_la-msc_tree.Tpo $(DEPDIR)/mod_security2_la-msc_tree.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='msc_tree.c' object='mod_security2_la-msc_tree.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_security2_la_CPPFLAGS) $(CPPFLAGS) $(mod_security2_la_CFLAGS) $(CFLAGS) -c -o mod_security2_la-msc_tree.lo `test -f 'msc_tree.c' || echo '$(srcdir)/'`msc_tree.c mod_security2_la-msc_unicode.lo: msc_unicode.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_security2_la_CPPFLAGS) $(CPPFLAGS) $(mod_security2_la_CFLAGS) $(CFLAGS) -MT mod_security2_la-msc_unicode.lo -MD -MP -MF $(DEPDIR)/mod_security2_la-msc_unicode.Tpo -c -o mod_security2_la-msc_unicode.lo `test -f 'msc_unicode.c' || echo '$(srcdir)/'`msc_unicode.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mod_security2_la-msc_unicode.Tpo $(DEPDIR)/mod_security2_la-msc_unicode.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='msc_unicode.c' object='mod_security2_la-msc_unicode.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_security2_la_CPPFLAGS) $(CPPFLAGS) $(mod_security2_la_CFLAGS) $(CFLAGS) -c -o mod_security2_la-msc_unicode.lo `test -f 'msc_unicode.c' || echo '$(srcdir)/'`msc_unicode.c mod_security2_la-msc_util.lo: msc_util.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_security2_la_CPPFLAGS) $(CPPFLAGS) $(mod_security2_la_CFLAGS) $(CFLAGS) -MT mod_security2_la-msc_util.lo -MD -MP -MF $(DEPDIR)/mod_security2_la-msc_util.Tpo -c -o mod_security2_la-msc_util.lo `test -f 'msc_util.c' || echo '$(srcdir)/'`msc_util.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mod_security2_la-msc_util.Tpo $(DEPDIR)/mod_security2_la-msc_util.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='msc_util.c' object='mod_security2_la-msc_util.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_security2_la_CPPFLAGS) $(CPPFLAGS) $(mod_security2_la_CFLAGS) $(CFLAGS) -c -o mod_security2_la-msc_util.lo `test -f 'msc_util.c' || echo '$(srcdir)/'`msc_util.c mod_security2_la-msc_xml.lo: msc_xml.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_security2_la_CPPFLAGS) $(CPPFLAGS) $(mod_security2_la_CFLAGS) $(CFLAGS) -MT mod_security2_la-msc_xml.lo -MD -MP -MF $(DEPDIR)/mod_security2_la-msc_xml.Tpo -c -o mod_security2_la-msc_xml.lo `test -f 'msc_xml.c' || echo '$(srcdir)/'`msc_xml.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mod_security2_la-msc_xml.Tpo $(DEPDIR)/mod_security2_la-msc_xml.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='msc_xml.c' object='mod_security2_la-msc_xml.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_security2_la_CPPFLAGS) $(CPPFLAGS) $(mod_security2_la_CFLAGS) $(CFLAGS) -c -o mod_security2_la-msc_xml.lo `test -f 'msc_xml.c' || echo '$(srcdir)/'`msc_xml.c mod_security2_la-persist_dbm.lo: persist_dbm.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_security2_la_CPPFLAGS) $(CPPFLAGS) $(mod_security2_la_CFLAGS) $(CFLAGS) -MT mod_security2_la-persist_dbm.lo -MD -MP -MF $(DEPDIR)/mod_security2_la-persist_dbm.Tpo -c -o mod_security2_la-persist_dbm.lo `test -f 'persist_dbm.c' || echo '$(srcdir)/'`persist_dbm.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mod_security2_la-persist_dbm.Tpo $(DEPDIR)/mod_security2_la-persist_dbm.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='persist_dbm.c' object='mod_security2_la-persist_dbm.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_security2_la_CPPFLAGS) $(CPPFLAGS) $(mod_security2_la_CFLAGS) $(CFLAGS) -c -o mod_security2_la-persist_dbm.lo `test -f 'persist_dbm.c' || echo '$(srcdir)/'`persist_dbm.c mod_security2_la-re_actions.lo: re_actions.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_security2_la_CPPFLAGS) $(CPPFLAGS) $(mod_security2_la_CFLAGS) $(CFLAGS) -MT mod_security2_la-re_actions.lo -MD -MP -MF $(DEPDIR)/mod_security2_la-re_actions.Tpo -c -o mod_security2_la-re_actions.lo `test -f 're_actions.c' || echo '$(srcdir)/'`re_actions.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mod_security2_la-re_actions.Tpo $(DEPDIR)/mod_security2_la-re_actions.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='re_actions.c' object='mod_security2_la-re_actions.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_security2_la_CPPFLAGS) $(CPPFLAGS) $(mod_security2_la_CFLAGS) $(CFLAGS) -c -o mod_security2_la-re_actions.lo `test -f 're_actions.c' || echo '$(srcdir)/'`re_actions.c mod_security2_la-re.lo: re.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_security2_la_CPPFLAGS) $(CPPFLAGS) $(mod_security2_la_CFLAGS) $(CFLAGS) -MT mod_security2_la-re.lo -MD -MP -MF $(DEPDIR)/mod_security2_la-re.Tpo -c -o mod_security2_la-re.lo `test -f 're.c' || echo '$(srcdir)/'`re.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mod_security2_la-re.Tpo $(DEPDIR)/mod_security2_la-re.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='re.c' object='mod_security2_la-re.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_security2_la_CPPFLAGS) $(CPPFLAGS) $(mod_security2_la_CFLAGS) $(CFLAGS) -c -o mod_security2_la-re.lo `test -f 're.c' || echo '$(srcdir)/'`re.c mod_security2_la-re_operators.lo: re_operators.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_security2_la_CPPFLAGS) $(CPPFLAGS) $(mod_security2_la_CFLAGS) $(CFLAGS) -MT mod_security2_la-re_operators.lo -MD -MP -MF $(DEPDIR)/mod_security2_la-re_operators.Tpo -c -o mod_security2_la-re_operators.lo `test -f 're_operators.c' || echo '$(srcdir)/'`re_operators.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mod_security2_la-re_operators.Tpo $(DEPDIR)/mod_security2_la-re_operators.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='re_operators.c' object='mod_security2_la-re_operators.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_security2_la_CPPFLAGS) $(CPPFLAGS) $(mod_security2_la_CFLAGS) $(CFLAGS) -c -o mod_security2_la-re_operators.lo `test -f 're_operators.c' || echo '$(srcdir)/'`re_operators.c mod_security2_la-re_tfns.lo: re_tfns.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_security2_la_CPPFLAGS) $(CPPFLAGS) $(mod_security2_la_CFLAGS) $(CFLAGS) -MT mod_security2_la-re_tfns.lo -MD -MP -MF $(DEPDIR)/mod_security2_la-re_tfns.Tpo -c -o mod_security2_la-re_tfns.lo `test -f 're_tfns.c' || echo '$(srcdir)/'`re_tfns.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mod_security2_la-re_tfns.Tpo $(DEPDIR)/mod_security2_la-re_tfns.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='re_tfns.c' object='mod_security2_la-re_tfns.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_security2_la_CPPFLAGS) $(CPPFLAGS) $(mod_security2_la_CFLAGS) $(CFLAGS) -c -o mod_security2_la-re_tfns.lo `test -f 're_tfns.c' || echo '$(srcdir)/'`re_tfns.c mod_security2_la-re_variables.lo: re_variables.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_security2_la_CPPFLAGS) $(CPPFLAGS) $(mod_security2_la_CFLAGS) $(CFLAGS) -MT mod_security2_la-re_variables.lo -MD -MP -MF $(DEPDIR)/mod_security2_la-re_variables.Tpo -c -o mod_security2_la-re_variables.lo `test -f 're_variables.c' || echo '$(srcdir)/'`re_variables.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mod_security2_la-re_variables.Tpo $(DEPDIR)/mod_security2_la-re_variables.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='re_variables.c' object='mod_security2_la-re_variables.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_security2_la_CPPFLAGS) $(CPPFLAGS) $(mod_security2_la_CFLAGS) $(CFLAGS) -c -o mod_security2_la-re_variables.lo `test -f 're_variables.c' || echo '$(srcdir)/'`re_variables.c mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) modsecurity_config_auto.h installdirs: for dir in "$(DESTDIR)$(pkglibdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-hdr distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-pkglibLTLIBRARIES @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) install-exec-hook install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkglibLTLIBRARIES .MAKE: all install-am install-exec-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-libtool clean-pkglibLTLIBRARIES cscopelist-am ctags \ ctags-am distclean distclean-compile distclean-generic \ distclean-hdr distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-exec-hook install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-pkglibLTLIBRARIES \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am \ uninstall-pkglibLTLIBRARIES @LINUX_TRUE@install-exec-hook: $(pkglib_LTLIBRARIES) @LINUX_TRUE@ @echo "Removing unused static libraries..."; \ @LINUX_TRUE@ for m in $(pkglib_LTLIBRARIES); do \ @LINUX_TRUE@ base=`echo $$m | sed 's/\..*//'`; \ @LINUX_TRUE@ rm -f $(DESTDIR)$(pkglibdir)/$$base.*a; \ @LINUX_TRUE@ install -D -m444 $(DESTDIR)$(pkglibdir)/$$base.so $(DESTDIR)$(APXS_MODULES)/$$base.so; \ @LINUX_TRUE@ done @LINUX_FALSE@install-exec-hook: $(pkglib_LTLIBRARIES) @LINUX_FALSE@ @echo "Removing unused static libraries..."; \ @LINUX_FALSE@ for m in $(pkglib_LTLIBRARIES); do \ @LINUX_FALSE@ base=`echo $$m | sed 's/\..*//'`; \ @LINUX_FALSE@ rm -f $(DESTDIR)$(pkglibdir)/$$base.*a; \ @LINUX_FALSE@ cp -p $(DESTDIR)$(pkglibdir)/$$base.so $(DESTDIR)$(APXS_MODULES); \ @LINUX_FALSE@ done # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: modsecurity-apache_2.7.7/apache2/msc_release.c0000664000175000017500000000237212243422537021574 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #include "msc_release.h" static const struct modsec_build_type_rec { char name[12]; /* pads at 16 bytes with val */ int val; } modsec_build_type[] = { { "-dev", 1 }, /* Development build */ { "-rc", 3 }, /* Release Candidate build */ { "", 9 }, /* Production build */ { "-tw", 9 }, /* Truswave Holdings build */ { "-trunk", 9 } /* Trunk build */ }; int get_modsec_build_type(const char *name) { size_t i; for (i = 0; i < sizeof(modsec_build_type)/sizeof(modsec_build_type[0]); i++) { if (strcmp(((name == NULL) ? MODSEC_VERSION_TYPE : name), modsec_build_type[i].name) == 0) { return modsec_build_type[i].val; } } return 9; /* so no warning */ } modsecurity-apache_2.7.7/apache2/modsecurity_config.h0000664000175000017500000000121712243422537023210 0ustar zimmerlezimmerle/* Some APR files define PACKAGE* constants, which may conflict * so this is here to prevent that by removing them. */ #ifndef WIN32 /* Undefine all these so there are no conflicts */ #undef PACKAGE #undef PACKAGE_BUGREPORT #undef PACKAGE_NAME #undef PACKAGE_STRING #undef PACKAGE_TARNAME #undef PACKAGE_URL #undef PACKAGE_VERSION /* Include the real autoconf header */ #include "modsecurity_config_auto.h" /* Undefine all these (again) so there are no conflicts */ #undef PACKAGE #undef PACKAGE_BUGREPORT #undef PACKAGE_NAME #undef PACKAGE_STRING #undef PACKAGE_TARNAME #undef PACKAGE_URL #undef PACKAGE_VERSION #endif modsecurity-apache_2.7.7/apache2/acmp.c0000664000175000017500000004176512243422537020243 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ /* Aho-Corasick Matching */ #include "acmp.h" #ifdef ACMP_USE_UTF8 /* UTF support */ #include "utf8tables.h" #else /* No UTF support */ #define acmp_utf8_char_t long #include #define utf8_lcase(a) apr_tolower(a) #endif #include #include #include /* ******************************************************************************* ******************************************************************************* * Data structures for acmp parser */ /** * One node in trie */ typedef struct acmp_node_t acmp_node_t; typedef struct acmp_btree_node_t acmp_btree_node_t; struct acmp_node_t { acmp_utf8_char_t letter; int is_last; acmp_callback_t callback; void *callback_data; int depth; acmp_node_t *child; acmp_node_t *sibling; acmp_node_t *fail; acmp_node_t *parent; acmp_node_t *o_match; acmp_btree_node_t *btree; apr_size_t hit_count; char *text; char *pattern; }; struct acmp_btree_node_t { acmp_utf8_char_t letter; acmp_btree_node_t *left; acmp_btree_node_t *right; acmp_node_t *node; }; /** * Data related to parser, not to individual nodes */ struct ACMP { #ifdef ACMP_USE_UTF8 int is_utf8; #endif int is_case_sensitive; apr_pool_t *parent_pool; apr_pool_t *pool; int dict_count; apr_size_t longest_entry; acmp_node_t *root_node; const char *data_start; const char *data_end; const char *data_pos; apr_size_t data_len; apr_size_t *bp_buffer; apr_size_t bp_buff_len; acmp_node_t *active_node; char u8_buff[6]; apr_size_t u8buff_len; apr_size_t hit_count; int is_failtree_done; int is_active; apr_size_t byte_pos; apr_size_t char_pos; }; /* ******************************************************************************* ******************************************************************************* * Functions for UTF-8 support */ #ifdef ACMP_USE_UTF8 /** * Returns length of utf-8 sequence based on its first byte */ static int utf8_seq_len(const char *first_byte) { return utf8_seq_lengths[(unsigned int)(unsigned char)first_byte[0]]; } /** * Returns length of utf8-encoded text */ static size_t utf8_strlen(const char *str) { int len = 0; const char *c = str; while (*c != 0) { c += utf8_seq_len(c); len++; } return len; } /** * Returns ucs code for given utf-8 sequence */ static acmp_utf8_char_t utf8_decodechar(const char *str) { int len = utf8_seq_len(str); acmp_utf8_char_t ch = 0; switch (len) { case 6: ch += (unsigned char)*str++; ch <<= 6; case 5: ch += (unsigned char)*str++; ch <<= 6; case 4: ch += (unsigned char)*str++; ch <<= 6; case 3: ch += (unsigned char)*str++; ch <<= 6; case 2: ch += (unsigned char)*str++; ch <<= 6; case 1: ch += (unsigned char)*str++; } ch -= utf8_offsets[len - 1]; return ch; } /** * Returns lowercase for given unicode character. Searches through * utf8_lcase_map table, if it doesn't find the code assumes * it doesn't have a lowercase variant and returns code itself. */ static long utf8_lcase(acmp_utf8_char_t ucs_code) { long mid, left, right; left = 1; right = UTF8_LCASEMAP_LEN * 2 + 1; while (left <= right) { mid = (left + right) >> 1; mid -= (mid % 2); mid++; if (ucs_code > utf8_lcase_map[mid]) left = mid + 2; else if (ucs_code < utf8_lcase_map[mid]) right = mid - 2; else if (ucs_code == utf8_lcase_map[mid]) return utf8_lcase_map[mid - 1]; } return ucs_code; } #endif /* ******************************************************************************* ******************************************************************************* * Code for local / static utility functions */ /** * Returns length of given string for parser's encoding */ static size_t acmp_strlen(ACMP *parser, const char *str) { #ifdef ACMP_USE_UTF8 return (parser->is_utf8 == 0) ? strlen(str) : utf8_strlen(str); #else return strlen(str); #endif } /** * Turns string to array of ucs values, depending on parser's encoding * str - string to convert, doesn't have to be NULL-terminated * ucs_chars - where to write ucs values * len - length of input string */ static void acmp_strtoucs(ACMP *parser, const char *str, acmp_utf8_char_t *ucs_chars, int len) { int i; const char *c = str; #ifdef ACMP_USE_UTF8 if (parser->is_utf8) { for (i = 0; i < len; i++) { *(ucs_chars++) = utf8_decodechar(c); c += utf8_seq_len(c); } } else #endif { for (i = 0; i < len; i++) { *(ucs_chars++) = *(c++); } } } /** * Returns node with given letter, or null if not found */ static acmp_node_t *acmp_child_for_code(acmp_node_t *parent_node, acmp_utf8_char_t ucs_code) { acmp_node_t *node = parent_node->child; if (node == NULL) return NULL; for (;;) { if (node->letter == ucs_code) return node; node = node->sibling; if (node == NULL) return NULL; } } /** * Adds node to parent node, if it is not already there */ static void acmp_add_node_to_parent(acmp_node_t *parent, acmp_node_t *child) { acmp_node_t *node = NULL; child->parent = parent; if (parent->child == NULL) { parent->child = child; return; } node = parent->child; for (;;) { if (node == child) return; if (node->sibling == NULL) { node->sibling = child; return; } node = node->sibling; } } /** * Copies values from one node to another, without child/sibling/fail pointers * and without state variables. */ static void acmp_clone_node_no_state(acmp_node_t *from, acmp_node_t *to) { memcpy(to, from, sizeof(acmp_node_t)); to->child = NULL; to->sibling = NULL; to->fail = NULL; to->hit_count = 0; } static inline acmp_node_t *acmp_btree_find(acmp_node_t *node, acmp_utf8_char_t letter) { acmp_btree_node_t *bnode = node->btree; for (;;) { if (bnode == NULL) return NULL; if (bnode->letter == letter) return bnode->node; if (bnode->letter > letter) { bnode = bnode->left; } else { bnode = bnode->right; } } } /** * */ static inline acmp_node_t *acmp_goto(acmp_node_t *node, acmp_utf8_char_t letter) { return acmp_btree_find(node, letter); } /** * Connects each node with its first fail node that is end of a phrase. */ static void acmp_connect_other_matches(ACMP *parser, acmp_node_t *node) { acmp_node_t *child, *om; for (child = node->child; child != NULL; child = child->sibling) { if (child->fail == NULL) continue; for (om = child->fail; om != parser->root_node; om = om->fail) { if (om->is_last) { child->o_match = om; break; } } } /* Go recursively through children of this node that have a child node */ for(child = node->child; child != NULL; child = child->sibling) { if (child->child != NULL) acmp_connect_other_matches(parser, child); } } /** * Adds leaves to binary tree, working from sorted array of keyword tree nodes */ static void acmp_add_btree_leaves(acmp_btree_node_t *node, acmp_node_t *nodes[], int pos, int lb, int rb, apr_pool_t *pool) { int left = 0, right = 0; if ((pos - lb) > 1) { left = lb + (pos - lb) / 2; node->left = apr_pcalloc(pool, sizeof(acmp_btree_node_t)); /* ENH: Check alloc succeded */ node->left->node = nodes[left]; node->left->letter = nodes[left]->letter; #ifdef DEBUG_ACMP fprintf(stderr, "%lc ->left %lc\n", (wint_t)node->node->letter, (wint_t)node->left->node->letter); #endif } if ((rb - pos) > 1) { right = pos + (rb - pos) / 2; node->right = apr_pcalloc(pool, sizeof(acmp_btree_node_t)); /* ENH: Check alloc succeded */ node->right->node = nodes[right]; node->right->letter = nodes[right]->letter; #ifdef DEBUG_ACMP fprintf(stderr, "%lc ->right %lc\n", (wint_t)node->node->letter, (wint_t)node->right->node->letter); #endif } if (node->right != NULL) { acmp_add_btree_leaves(node->right, nodes, right, pos, rb, pool); } if (node->left != NULL) { acmp_add_btree_leaves(node->left, nodes, left, lb, pos, pool); } } /** * Builds balanced binary tree from children nodes of given node. */ static void acmp_build_binary_tree(ACMP *parser, acmp_node_t *node) { apr_size_t count, i, j; acmp_node_t *child = node->child; acmp_node_t **nodes; apr_size_t pos; /* Build an array big enough */ for (count = 0; child != NULL; child = child->sibling) count++; nodes = apr_pcalloc(parser->pool, count * sizeof(acmp_node_t *)); /* ENH: Check alloc succeded */ /* ENH: Combine this in the loop below - we do not need two loops */ child = node->child; for (i = 0; i < count; i++) { nodes[i] = child; child = child->sibling; }; /* We have array with all children of the node and number of those children */ for (i = 0; i < count - 1; i++) for (j = i + 1; j < count; j++) { acmp_node_t *tmp; if (nodes[i]->letter < nodes[j]->letter) continue; tmp = nodes[i]; nodes[i] = nodes[j]; nodes[j] = tmp; } node->btree = apr_pcalloc(parser->pool, sizeof(acmp_btree_node_t)); /* ENH: Check alloc succeded */ pos = count / 2; node->btree->node = nodes[pos]; node->btree->letter = nodes[pos]->letter; acmp_add_btree_leaves(node->btree, nodes, pos, -1, count, parser->pool); for (i = 0; i < count; i++) { if (nodes[i]->child != NULL) acmp_build_binary_tree(parser, nodes[i]); } } /** * Constructs fail paths on keyword trie */ static apr_status_t acmp_connect_fail_branches(ACMP *parser) { /* Already connected ? */ acmp_node_t *child, *node, *goto_node; apr_array_header_t *arr, *arr2, *tmp; if (parser->is_failtree_done != 0) return APR_SUCCESS; parser->root_node->text = ""; arr = apr_array_make(parser->pool, 32, sizeof(acmp_node_t *)); arr2 = apr_array_make(parser->pool, 32, sizeof(acmp_node_t *)); parser->root_node->fail = parser->root_node; /* All first-level children will fail back to root node */ for (child = parser->root_node->child; child != NULL; child = child->sibling) { child->fail = parser->root_node; *(acmp_node_t **)apr_array_push(arr) = child; #ifdef DEBUG_ACMP fprintf(stderr, "fail direction: *%s* => *%s*\n", child->text, child->fail->text); #endif } for (;;) { while (apr_is_empty_array(arr) == 0) { node = *(acmp_node_t **)apr_array_pop(arr); node->fail = parser->root_node; if (node->parent != parser->root_node) { goto_node = acmp_child_for_code(node->parent->fail, node->letter); node->fail = (goto_node != NULL) ? goto_node : parser->root_node; } #ifdef DEBUG_ACMP fprintf(stderr, "fail direction: *%s* => *%s*\n", node->text, node->fail->text); #endif child = node->child; while (child != NULL) { *(acmp_node_t **)apr_array_push(arr2) = child; child = child->sibling; } } if (apr_is_empty_array(arr2) != 0) break; tmp = arr; arr = arr2; arr2 = tmp; } acmp_connect_other_matches(parser, parser->root_node); if (parser->root_node->child != NULL) acmp_build_binary_tree(parser, parser->root_node); parser->is_failtree_done = 1; return APR_SUCCESS; } /* ******************************************************************************* ******************************************************************************* * Code for functions from header file */ /** * flags - OR-ed values of ACMP_FLAG constants * pool - apr_pool to use as parent pool, can be set to NULL */ ACMP *acmp_create(int flags, apr_pool_t *pool) { apr_status_t rc; apr_pool_t *p; ACMP *parser; rc = apr_pool_create(&p, pool); if (rc != APR_SUCCESS) return NULL; parser = apr_pcalloc(p, sizeof(ACMP)); /* ENH: Check alloc succeded */ parser->pool = p; parser->parent_pool = pool; #ifdef ACMP_USE_UTF8 parser->is_utf8 = (flags & ACMP_FLAG_UTF8) == 0 ? 0 : 1; #endif parser->is_case_sensitive = (flags & ACMP_FLAG_CASE_SENSITIVE) == 0 ? 0 : 1; parser->root_node = apr_pcalloc(p, sizeof(acmp_node_t)); /* ENH: Check alloc succeded */ return parser; } /** * Creates fail tree and initializes buffer */ apr_status_t acmp_prepare(ACMP *parser) { apr_status_t st; if (parser->bp_buff_len < parser->longest_entry) { parser->bp_buff_len = parser->longest_entry * 2; parser->bp_buffer = apr_pcalloc(parser->pool, sizeof(apr_size_t) * parser->bp_buff_len); /* ENH: Check alloc succeded */ } st = acmp_connect_fail_branches(parser); parser->active_node = parser->root_node; if (st != APR_SUCCESS) return st; parser->is_active = 1; return APR_SUCCESS; } /** * Adds pattern to parser * parser - ACMP parser * pattern - string with pattern to match * callback - Optional, pointer to an acmp_callback_t function * data - pointer to data that will be passed to callback function, only used if callback * is supplied * len - Length of pattern in characters, if zero string length is used. */ apr_status_t acmp_add_pattern(ACMP *parser, const char *pattern, acmp_callback_t callback, void *data, apr_size_t len) { size_t length, i, j; acmp_utf8_char_t *ucs_chars; acmp_node_t *parent, *child; if (parser->is_active != 0) return APR_EGENERAL; length = (len == 0) ? acmp_strlen(parser, pattern) : len; ucs_chars = apr_pcalloc(parser->pool, length * sizeof(acmp_utf8_char_t)); /* ENH: Check alloc succeded */ parent = parser->root_node; acmp_strtoucs(parser, pattern, ucs_chars, length); for (i = 0; i < length; i++) { acmp_utf8_char_t letter = ucs_chars[i]; if (parser->is_case_sensitive == 0) { letter = utf8_lcase(letter); } child = acmp_child_for_code(parent, letter); if (child == NULL) { child = apr_pcalloc(parser->pool, sizeof(acmp_node_t)); /* ENH: Check alloc succeded */ child->pattern = ""; child->letter = letter; child->depth = i; child->text = apr_pcalloc(parser->pool, strlen(pattern) + 2); /* ENH: Check alloc succeded */ for (j = 0; j <= i; j++) child->text[j] = pattern[j]; } if (i == length - 1) { if (child->is_last == 0) { parser->dict_count++; child->is_last = 1; child->pattern = apr_pcalloc(parser->pool, strlen(pattern) + 2); /* ENH: Check alloc succeded */ strcpy(child->pattern, pattern); } child->callback = callback; child->callback_data = data; } acmp_add_node_to_parent(parent, child); parent = child; } if (length > parser->longest_entry) parser->longest_entry = length; parser->is_failtree_done = 0; return APR_SUCCESS; } /** * Process the data using ACMPT to keep state, and ACMPT's parser to keep the tree */ apr_status_t acmp_process_quick(ACMPT *acmpt, const char **match, const char *data, apr_size_t len) { ACMP *parser; acmp_node_t *node, *go_to; const char *end; if (acmpt->parser->is_failtree_done == 0) { acmp_prepare(acmpt->parser); }; parser = acmpt->parser; if (acmpt->ptr == NULL) acmpt->ptr = parser->root_node; node = acmpt->ptr; end = data + len; while (data < end) { acmp_utf8_char_t letter = (unsigned char)*data++; if (parser->is_case_sensitive == 0) letter = utf8_lcase(letter); go_to = NULL; while (go_to == NULL) { go_to = acmp_goto(node, letter); if (go_to != NULL) { if (go_to->is_last) { *match = go_to->text; return 1; } } if (node == parser->root_node) break; if (go_to == NULL) node = node->fail; } if (go_to != NULL) node = go_to; /* If node has o_match, then we found a pattern */ if (node->o_match != NULL) { *match = node->text; return 1; } } acmpt->ptr = node; return 0; } modsecurity-apache_2.7.7/apache2/re_operators.c0000664000175000017500000044313312252634762022027 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #include "re.h" #include "msc_pcre.h" #include "msc_geo.h" #include "msc_gsb.h" #include "apr_lib.h" #include "apr_strmatch.h" #include "acmp.h" #include "msc_util.h" #include "msc_tree.h" #include "msc_crypt.h" #if APR_HAVE_ARPA_INET_H #include #endif #include "libinjection/libinjection.h" /** * */ void msre_engine_op_register(msre_engine *engine, const char *name, fn_op_param_init_t fn1, fn_op_execute_t fn2) { msre_op_metadata *metadata = (msre_op_metadata *)apr_pcalloc(engine->mp, sizeof(msre_op_metadata)); if (metadata == NULL) return; metadata->name = name; metadata->param_init = fn1; metadata->execute = fn2; apr_table_setn(engine->operators, name, (void *)metadata); } /** * */ msre_op_metadata *msre_engine_op_resolve(msre_engine *engine, const char *name) { return (msre_op_metadata *)apr_table_get(engine->operators, name); } /* -- Operators -- */ /* unconditionalMatch */ static int msre_op_unconditionalmatch_execute(modsec_rec *msr, msre_rule *rule, msre_var *var, char **error_msg) { *error_msg = "Unconditional match in SecAction."; /* Always match. */ return 1; } /* noMatch */ static int msre_op_nomatch_execute(modsec_rec *msr, msre_rule *rule, msre_var *var, char **error_msg) { *error_msg = "No match."; /* Never match. */ return 0; } /* ipmatch */ /** * \brief Init function to ipmatch operator * * \param rule ModSecurity rule struct * \param error_msg Error message * * \retval 1 On Success * \retval 0 On Fail */ static int msre_op_ipmatch_param_init(msre_rule *rule, char **error_msg) { apr_status_t rv; char *str = NULL; char *saved = NULL; char *param = NULL; msre_ipmatch *current; msre_ipmatch **last = &rule->ip_op; if (error_msg == NULL) return -1; else *error_msg = NULL; param = apr_pstrdup(rule->ruleset->mp, rule->op_param); str = apr_strtok(param, ",", &saved); while( str != NULL) { const char *ipstr, *mask, *sep; /* get the IP address and mask strings */ sep = strchr(str, '/'); if (sep) { ipstr = apr_pstrndup(rule->ruleset->mp, str, (sep - str) ); mask = apr_pstrdup(rule->ruleset->mp, (sep + 1) ); } else { ipstr = apr_pstrdup(rule->ruleset->mp, str); mask = NULL; } /* create a new msre_ipmatch containing a new apr_ipsubnet_t*, and add it to the linked list */ current = apr_pcalloc(rule->ruleset->mp, sizeof(msre_ipmatch)); rv = apr_ipsubnet_create(¤t->ipsubnet, ipstr, mask, rule->ruleset->mp); if ( rv != APR_SUCCESS ) { char msgbuf[120]; apr_strerror(rv, msgbuf, sizeof msgbuf); *error_msg = apr_pstrcat(rule->ruleset->mp, "Error: ", msgbuf, NULL); return -1; } current->address = str; current->next = NULL; *last = current; last = ¤t->next; str = apr_strtok(NULL, ",",&saved); } return 1; } /** * \brief Execution function to ipmatch operator * * \param msr Pointer internal modsec request structure * \param rule Pointer to the rule * \param var Pointer to variable structure * \param error_msg Pointer to error msg * * \retval -1 On Failure * \retval 1 On Match * \retval 0 On No Match */ static int msre_op_ipmatch_execute(modsec_rec *msr, msre_rule *rule, msre_var *var, char **error_msg) { msre_ipmatch *current = rule->ip_op; apr_sockaddr_t *sa; if (error_msg == NULL) return -1; else *error_msg = NULL; if(current == NULL) { msr_log(msr, 1, "ipMatch Internal Error: ipmatch value is null."); return 0; } /* create an apr_sockaddr_t for the value string */ if ( apr_sockaddr_info_get(&sa, var->value, APR_UNSPEC, 0, 0, msr->mp) != APR_SUCCESS ) { msr_log(msr, 1, "ipMatch Internal Error: Invalid ip address."); return 0; } /* look through the linked list for a match */ while (current) { if (apr_ipsubnet_test(current->ipsubnet, sa)) { *error_msg = apr_psprintf(msr->mp, "IPmatch \"%s\" matched \"%s\" at %s.", var->value, current->address, var->name); return 1; } current = current->next; } return 0; } /** * \brief Init function to ipmatchFromFile operator * * \param rule Pointer to the rule * \param error_msg Pointer to error msg * * \retval 1 On Success * \retval 0 On Fail */ static int msre_op_ipmatchFromFile_param_init(msre_rule *rule, char **error_msg) { char errstr[1024]; char buf[HUGE_STRING_LEN + 1]; const char *rootpath = NULL; const char *filepath = NULL; char *fn; char *start; char *end; const char *ipfile_path; int line = 0; unsigned short int op_len; apr_status_t rc; apr_file_t *fd; TreeRoot *rtree = NULL; TreeNode *tnode = NULL; if (error_msg == NULL) return -1; else *error_msg = NULL; rtree = apr_palloc(rule->ruleset->mp, sizeof(TreeRoot)); if(rtree == NULL) { *error_msg = apr_psprintf(rule->ruleset->mp, "Failed allocating memory to TreeRoot."); return 0; } memset(rtree, 0, sizeof(TreeRoot)); if ((rule->op_param == NULL)||(strlen(rule->op_param) == 0)) { *error_msg = apr_psprintf(rule->ruleset->mp, "Missing parameter for operator 'ipmatchFromFile'."); return 0; } rtree->ipv4_tree = CPTCreateRadixTree(rule->ruleset->mp); if (rtree->ipv4_tree == NULL) { *error_msg = apr_psprintf(rule->ruleset->mp, "ipmatchFromFile: Tree tree initialization failed."); return 0; } rtree->ipv6_tree = CPTCreateRadixTree(rule->ruleset->mp); if (rtree->ipv6_tree == NULL) { *error_msg = apr_psprintf(rule->ruleset->mp, "ipmatchFromFile: Tree tree initialization failed."); return 0; } fn = apr_pstrdup(rule->ruleset->mp, rule->op_param); ipfile_path = apr_pstrndup(rule->ruleset->mp, rule->filename, strlen(rule->filename) - strlen(apr_filepath_name_get(rule->filename))); while((apr_isspace(*fn) != 0) && (*fn != '\0')) fn++; if (*fn == '\0') { *error_msg = apr_psprintf(rule->ruleset->mp, "Empty file specification for operator ipmatchFromFile \"%s\"", fn); return 0; } filepath = fn; if (apr_filepath_root(&rootpath, &filepath, APR_FILEPATH_TRUENAME, rule->ruleset->mp) != APR_SUCCESS) { apr_filepath_merge(&fn, ipfile_path, fn, APR_FILEPATH_TRUENAME, rule->ruleset->mp); } rc = apr_file_open(&fd, fn, APR_READ | APR_BUFFERED | APR_FILE_NOCLEANUP, 0, rule->ruleset->mp); if (rc != APR_SUCCESS) { *error_msg = apr_psprintf(rule->ruleset->mp, "Could not open ipmatch file \"%s\": %s", fn, apr_strerror(rc, errstr, 1024)); return 0; } while((rc = apr_file_gets(buf, HUGE_STRING_LEN, fd)) != APR_EOF) { line++; if (rc != APR_SUCCESS) { *error_msg = apr_psprintf(rule->ruleset->mp, "Could not read \"%s\" line %d: %s", fn, line, apr_strerror(rc, errstr, 1024)); return 0; } op_len = strlen(buf); start = buf; while ((apr_isspace(*start) != 0) && (*start != '\0')) start++; for (end = start; end != NULL || *end != '\0' || *end != '\n'; end++) { if (apr_isxdigit(*end) || *end == '.' || *end == '/' || *end == ':') { continue; } else { if (*end != '\n') { *error_msg = apr_psprintf(rule->ruleset->mp, "Invalid char \"%c\" in line %d of file %s", *end, line, fn); } break; } } *end = '\0'; if ((start == end) || (*start == '#')) continue; if (strchr(start, ':') == NULL) { tnode = TreeAddIP(start, rtree->ipv4_tree, IPV4_TREE); } else { tnode = TreeAddIP(start, rtree->ipv6_tree, IPV6_TREE); } if (tnode == NULL) { *error_msg = apr_psprintf(rule->ruleset->mp, "Could not add entry \"%s\" in line %d of file %s to IP list", start, line, fn); } } if (fd != NULL) apr_file_close(fd); rule->op_param_data = rtree; return 1; } /** * \brief Execution function to ipmatchFromFile operator * * \param msr Pointer internal modsec request structure * \param rule Pointer to the rule * \param var Pointer to variable structure * \param error_msg Pointer to error msg * * \retval -1 On Failure * \retval 1 On Match * \retval 0 On No Match */ static int msre_op_ipmatchFromFile_execute(modsec_rec *msr, msre_rule *rule, msre_var *var, char **error_msg) { TreeRoot *rtree = (TreeRoot *)rule->op_param_data; struct in_addr in; #if APR_HAVE_IPV6 struct in6_addr in6; #endif if (error_msg == NULL) return -1; else *error_msg = NULL; if(rtree == NULL) { msr_log(msr, 1, "ipMatchFromFile Internal Error: tree value is null."); return 0; } if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "IPmatchFromFile: Total tree entries: %d, ipv4 %d ipv6 %d", rtree->ipv4_tree->count+rtree->ipv6_tree->count, rtree->ipv4_tree->count, rtree->ipv6_tree->count); } if (strchr(var->value, ':') == NULL) { if (inet_pton(AF_INET, var->value, &in) <= 0) { if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "IPmatchFromFile: bad IPv4 specification \"%s\".", var->value); } *error_msg = apr_psprintf(msr->mp, "IPmatchFromFile: bad IP specification \"%s\".", var->value); return 0; } if (CPTIpMatch(msr, (unsigned char *)&in.s_addr, rtree->ipv4_tree, IPV4_TREE) != NULL) { *error_msg = apr_psprintf(msr->mp, "IPmatchFromFile \"%s\" matched at %s.", var->value, var->name); return 1; } } #if APR_HAVE_IPV6 else { if (inet_pton(AF_INET6, var->value, &in6) <= 0) { if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "IPmatchFromFile: bad IPv6 specification \"%s\".", var->value); } *error_msg = apr_psprintf(msr->mp, "IPmatchFromFile: bad IP specification \"%s\".", var->value); return 0; } if (CPTIpMatch(msr, (unsigned char *)&in6.s6_addr, rtree->ipv6_tree, IPV6_TREE) != NULL) { *error_msg = apr_psprintf(msr->mp, "IPmatchFromFile \"%s\" matched at %s.", var->value, var->name); return 1; } } #endif return 0; } /* rsub */ static char *param_remove_escape(msre_rule *rule, char *str, int len) { char *parm = apr_pcalloc(rule->ruleset->mp, len); char *ret = parm; for(;*str!='\0';str++) { if(*str != '\\') { *parm++ = *str; } else { str++; if(*str != '/') { str--; *parm++ = *str; } else { *parm++ = *str; } } } *parm = '\0'; return ret; } /** * \brief Init function to rsub operator * * \param rule Pointer to the rule * \param error_msg Pointer to error msg * * \retval 1 On Success * \retval 0 On Fail */ #if !defined(MSC_TEST) static int msre_op_rsub_param_init(msre_rule *rule, char **error_msg) { #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER > 0 ap_regex_t *regex; #else regex_t *regex; #endif const char *pattern = NULL; const char *line = NULL; char *reg_pattern = NULL; char *replace = NULL; char *e_pattern = NULL; char *parsed_replace = NULL; char *flags = NULL; char *data = NULL; char delim; int ignore_case = 0; unsigned short int op_len = 0; if (error_msg == NULL) return -1; *error_msg = NULL; line = rule->op_param; if (apr_tolower(*line) != 's') { *error_msg = apr_psprintf(rule->ruleset->mp, "Error rsub operator format, must be s/ pattern"); return -1; } data = apr_pstrdup(rule->ruleset->mp, line); delim = *++data; if (delim) reg_pattern = ++data; if (reg_pattern) { if (*data != delim) { for(;*data != '\0' ;data++) { if(*data == delim) { data--; if(*data == '\\') { data++; continue; } break; } } } if (*data) { *++data = '\0'; ++data; replace = data; } } if (replace) { if (*data != delim) { for(;*data != '\0' ;data++) { if(*data == delim) { data--; if(*data == '\\') { data++; continue; } break; } } } if (*data) { *++data = '\0'; flags = ++data; } } if (!delim || !reg_pattern || !replace) { *error_msg = apr_psprintf(rule->ruleset->mp, "Error rsub operator format - must be s/regex/str/[flags]"); return -1; } op_len = strlen(replace); parsed_replace = apr_pstrdup(rule->ruleset->mp, parse_pm_content(param_remove_escape(rule, replace, strlen(replace)), op_len, rule, error_msg)); if(!parsed_replace) { *error_msg = apr_psprintf(rule->ruleset->mp, "Error rsub operator parsing input data"); return -1; } rule->sub_str = apr_pstrmemdup(rule->ruleset->mp, parsed_replace, strlen(parsed_replace)); if (flags) { while (*flags) { delim = apr_tolower(*flags); if (delim == 'i') ignore_case = 1; else if (delim == 'd') rule->escape_re = 1; else *error_msg = apr_psprintf(rule->ruleset->mp, "Regex flag not supported"); flags++; } } e_pattern = param_remove_escape(rule, reg_pattern, strlen(reg_pattern)); pattern = apr_pstrndup(rule->ruleset->mp, e_pattern, strlen(e_pattern)); if(strstr(pattern,"%{") == NULL) { #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER > 0 regex = ap_pregcomp(rule->ruleset->mp, pattern, AP_REG_EXTENDED | (ignore_case ? AP_REG_ICASE : 0)); #else regex = ap_pregcomp(rule->ruleset->mp, pattern, REG_EXTENDED | (ignore_case ? REG_ICASE : 0)); #endif rule->sub_regex = regex; } else { rule->re_precomp = 1; rule->re_str = apr_pstrndup(rule->ruleset->mp, pattern, strlen(pattern)); rule->sub_regex = NULL; } return 1; /* OK */ } /** * \brief Execution function to rsub operator * * \param msr Pointer internal modsec request structure * \param rule Pointer to the rule * \param var Pointer to variable structure * \param error_msg Pointer to error msg * * \retval -1 On Failure * \retval 1 On Match * \retval 0 On No Match */ static int msre_op_rsub_execute(modsec_rec *msr, msre_rule *rule, msre_var *var, char **error_msg) { msc_string *str = (msc_string *)apr_pcalloc(msr->mp, sizeof(msc_string)); msc_string *re_pattern = (msc_string *)apr_pcalloc(msr->mp, sizeof(msc_string)); char *offset = NULL; char *data = NULL, *pattern = NULL; char *data_out = NULL; unsigned int size = 0; unsigned int maxsize=0; int output_body = 0, input_body = 0, sl; #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER > 0 ap_regmatch_t pmatch[AP_MAX_REG_MATCH]; #else regmatch_t pmatch[AP_MAX_REG_MATCH]; #endif if (error_msg == NULL) return -1; *error_msg = NULL; if(strcmp(var->name,"STREAM_OUTPUT_BODY") == 0 ) { output_body = 1; } else if(strcmp(var->name,"STREAM_INPUT_BODY") == 0 ) { input_body = 1; } else { msr_log(msr,9,"Operator rsub only works with STREAM_* variables"); return -1; } if(rule->re_precomp == 1) { re_pattern->value = apr_pstrndup(msr->mp, rule->re_str, strlen(rule->re_str)); re_pattern->value_len = strlen(re_pattern->value); expand_macros(msr, re_pattern, rule, msr->mp); if(strlen(re_pattern->value) > 0) { if(rule->escape_re == 1) { pattern = log_escape_re(msr->mp, re_pattern->value); if (msr->txcfg->debuglog_level >= 6) { msr_log(msr, 6, "Escaping pattern [%s]",pattern); } #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER > 0 rule->sub_regex = ap_pregcomp(msr->mp, pattern, AP_REG_EXTENDED); #else rule->sub_regex = ap_pregcomp(msr->mp, pattern, REG_EXTENDED); #endif } else { #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER > 0 rule->sub_regex = ap_pregcomp(msr->mp, re_pattern->value, AP_REG_EXTENDED); #else rule->sub_regex = ap_pregcomp(msr->mp, re_pattern->value, REG_EXTENDED); #endif } } else { rule->sub_regex = NULL; } } if(rule->sub_regex == NULL) { *error_msg = "Internal Error: regex data is null."; return -1; } str->value = apr_pstrndup(msr->mp, rule->sub_str, strlen(rule->sub_str)); str->value_len = strlen(str->value); if(strstr(rule->sub_str,"%{") != NULL) expand_macros(msr, str, rule, msr->mp); maxsize=var->value_len+(AP_MAX_REG_MATCH*1024)+1; nextround: data = apr_pcalloc(msr->mp, maxsize+1); if(data == NULL) { *error_msg = "Internal Error: cannot allocate memory"; return -1; } data_out=data; size=0; for (offset = (char*)var->value; !ap_regexec(rule->sub_regex, offset, AP_MAX_REG_MATCH, pmatch, 0); ) { //Copy of data before the regex match int i; int s = pmatch [0].rm_so; int p_len=pmatch [0].rm_eo - pmatch [0].rm_so; if (size+s>maxsize) { maxsize*=2; goto nextround; } memcpy(data_out,offset,s); data_out+=s; size+=s; //Copy of regex match with replacing data \1..\9 for(i=0;ivalue_len;) { char *x = str->value+i; if (*x == '\\' && *(x + 1) > '0' && *(x + 1) <= '9') { int capture=*(x + 1) - 48; int capture_len=pmatch[capture].rm_eo-pmatch[capture].rm_so; if (size+capture_len>maxsize) { maxsize*=2; goto nextround; } memcpy(data_out,offset+pmatch[capture].rm_so,capture_len); data_out+= capture_len; size+=capture_len; i+=2; } else { if (size+1>maxsize) { maxsize*=2; goto nextround; } *data_out=*(str->value+i); data_out++; size++; i++; } } offset+=s; offset+=p_len; } //Copy of data after the last regex match sl = strlen(offset); if (size+sl>maxsize) { maxsize*=2; goto nextround; } memcpy(data_out,offset,sl); data_out+=sl; size+=sl; *data_out=0; if(msr->stream_output_data != NULL && output_body == 1) { memset(msr->stream_output_data, 0x0, msr->stream_output_length); free(msr->stream_output_data); msr->stream_output_data = NULL; msr->stream_output_length = 0; msr->stream_output_data = (char *)malloc(size+1); if(msr->stream_output_data == NULL) { return -1; } msr->stream_output_length = size; memset(msr->stream_output_data, 0x0, size+1); msr->of_stream_changed = 1; memcpy(msr->stream_output_data, data, size); msr->stream_output_data[size] = '\0'; var->value_len = size; var->value = msr->stream_output_data; } if(msr->stream_input_data != NULL && input_body == 1) { memset(msr->stream_input_data, 0x0, msr->stream_input_length); free(msr->stream_input_data); msr->stream_input_data = NULL; msr->stream_input_length = 0; msr->stream_input_data = (char *)malloc(size+1); if(msr->stream_input_data == NULL) { return -1; } msr->stream_input_length = size; memset(msr->stream_input_data, 0x0, size+1); msr->if_stream_changed = 1; memcpy(msr->stream_input_data, data, size); msr->stream_input_data[size] = '\0'; var->value_len = size; var->value = msr->stream_input_data; } if (! *error_msg) { *error_msg = apr_psprintf(msr->mp, "Operator rsub succeeded."); } return 1; } #endif /* MSC_TEST */ /** * \brief Init function to validateHash * * \param rule ModSecurity rule struct * \param error_msg Error message * * \retval 1 On success * \retval 0 On fail */ static int msre_op_validateHash_param_init(msre_rule *rule, char **error_msg) { const char *errptr = NULL; int erroffset; msc_regex_t *regex; const char *pattern = rule->op_param; #ifdef WITH_PCRE_STUDY #ifdef WITH_PCRE_JIT int rc, jit; #endif #endif if (error_msg == NULL) return -1; *error_msg = NULL; /* Compile pattern */ if(strstr(pattern,"%{") == NULL) { regex = msc_pregcomp_ex(rule->ruleset->mp, pattern, PCRE_DOTALL | PCRE_DOLLAR_ENDONLY, &errptr, &erroffset, msc_pcre_match_limit, msc_pcre_match_limit_recursion); if (regex == NULL) { *error_msg = apr_psprintf(rule->ruleset->mp, "Error compiling pattern (offset %d): %s", erroffset, errptr); return 0; } #ifdef WITH_PCRE_STUDY #ifdef WITH_PCRE_JIT rc = msc_fullinfo(regex, PCRE_INFO_JIT, &jit); if ((rc != 0) || (jit != 1)) { *error_msg = apr_psprintf(rule->ruleset->mp, "Rule %pp [id \"%s\"][file \"%s\"][line \"%d\"] - " "Execution error - " "Does not support JIT (%d)", rule,((rule->actionset != NULL)&&((rule->actionset->id != NULL)&& (rule->actionset->id != NOT_SET_P))) ? rule->actionset->id : "-", rule->filename != NULL ? rule->filename : "-", rule->line_num,rc); } #endif #endif rule->op_param_data = regex; } else { rule->re_precomp = 1; rule->re_str = apr_pstrndup(rule->ruleset->mp, pattern, strlen(pattern)); rule->op_param_data = NULL; } return 1; /* OK */ } /** * \brief Execute function to validateHash * * \param msr ModSecurity transaction resource * \param rule ModSecurity rule struct * \param var ModSecurity variable struct * \param error_msg Error message * * \retval 1 On success * \retval 0 On fail */ static int msre_op_validateHash_execute(modsec_rec *msr, msre_rule *rule, msre_var *var, char **error_msg) { msc_regex_t *regex = (msc_regex_t *)rule->op_param_data; msc_string *re_pattern = (msc_string *)apr_pcalloc(msr->mp, sizeof(msc_string)); const char *target; const char *errptr = NULL; int erroffset; unsigned int target_length; char *my_error_msg = NULL; int ovector[33]; int rc; const char *pattern = NULL; #ifdef WITH_PCRE_STUDY #ifdef WITH_PCRE_JIT int jit; #endif #endif if (error_msg == NULL) return -1; *error_msg = NULL; if (msr->txcfg->hash_enforcement == HASH_DISABLED || msr->txcfg->hash_is_enabled == HASH_DISABLED) return 0; if (regex == NULL) { if(rule->re_precomp == 0) { *error_msg = "Internal Error: regex data is null."; return -1; } else { if(re_pattern == NULL) { *error_msg = "Internal Error: regex variable data is null."; return -1; } re_pattern->value = apr_pstrndup(msr->mp, rule->re_str, strlen(rule->re_str)); re_pattern->value_len = strlen(re_pattern->value); expand_macros(msr, re_pattern, rule, msr->mp); pattern = log_escape_re(msr->mp, re_pattern->value); if (msr->txcfg->debuglog_level >= 6) { msr_log(msr, 6, "Escaping pattern [%s]",pattern); } regex = msc_pregcomp_ex(rule->ruleset->mp, pattern, PCRE_DOTALL | PCRE_DOLLAR_ENDONLY, &errptr, &erroffset, msc_pcre_match_limit, msc_pcre_match_limit_recursion); if (regex == NULL) { *error_msg = apr_psprintf(rule->ruleset->mp, "Error compiling pattern (offset %d): %s", erroffset, errptr); return 0; } #ifdef WITH_PCRE_STUDY #ifdef WITH_PCRE_JIT if (msr->txcfg->debuglog_level >= 4) { rc = msc_fullinfo(regex, PCRE_INFO_JIT, &jit); if ((rc != 0) || (jit != 1)) { *error_msg = apr_psprintf(rule->ruleset->mp, "Rule %pp [id \"%s\"][file \"%s\"][line \"%d\"] - " "Execution error - " "Does not support JIT (%d)", rule,((rule->actionset != NULL)&&((rule->actionset->id != NULL)&& (rule->actionset->id != NOT_SET_P))) ? rule->actionset->id : "-", rule->filename != NULL ? rule->filename : "-", rule->line_num,rc); msr_log(msr, 4, "%s.", *error_msg); } } #endif #endif } } /* If the given target is null run against an empty * string. This is a behaviour consistent with previous * releases. */ if (var->value == NULL) { target = ""; target_length = 0; } else { target = var->value; target_length = var->value_len; } /* We always use capture so that ovector can be used as working space * and no memory has to be allocated for any backreferences. */ rc = msc_regexec_capture(regex, target, target_length, ovector, 30, &my_error_msg); if ((rc == PCRE_ERROR_MATCHLIMIT) || (rc == PCRE_ERROR_RECURSIONLIMIT)) { msc_string *s = (msc_string *)apr_pcalloc(msr->mp, sizeof(msc_string)); if (s == NULL) return -1; s->name = apr_pstrdup(msr->mp, "MSC_PCRE_LIMITS_EXCEEDED"); if (s->name == NULL) return -1; s->name_len = strlen(s->name); s->value = apr_pstrdup(msr->mp, "1"); if (s->value == NULL) return -1; s->value_len = 1; apr_table_setn(msr->tx_vars, s->name, (void *)s); *error_msg = apr_psprintf(msr->mp, "Rule %pp [id \"%s\"][file \"%s\"][line \"%d\"] - " "Execution error - " "PCRE limits exceeded (%d): %s", rule,((rule->actionset != NULL)&&(rule->actionset->id != NULL)) ? rule->actionset->id : "-", rule->filename != NULL ? rule->filename : "-", rule->line_num,rc, my_error_msg); msr_log(msr, 3, "%s.", *error_msg); return 0; /* No match. */ } else if (rc < -1) { *error_msg = apr_psprintf(msr->mp, "Regex execution failed (%d): %s", rc, my_error_msg); return -1; } if (rc != PCRE_ERROR_NOMATCH) { /* Match. */ /* We no longer escape the pattern here as it is done when logging */ char *pattern = apr_pstrdup(msr->mp, log_escape(msr->mp, regex->pattern ? regex->pattern : "")); char *hmac = NULL, *valid = NULL; char *hash_link = NULL, *nlink = NULL; if (strlen(pattern) > 252) { *error_msg = apr_psprintf(msr->mp, "Request URI matched \"%.252s ...\" at %s.", pattern, var->name); } else { *error_msg = apr_psprintf(msr->mp, "Request URI matched \"%s\" at %s.", pattern, var->name); } valid = strstr(target, msr->txcfg->crypto_param_name); if(valid == NULL) { if (msr->txcfg->debuglog_level >= 9) msr_log(msr, 9, "Request URI without hash parameter [%s]", target); if (strlen(pattern) > 252) { *error_msg = apr_psprintf(msr->mp, "Request URI matched \"%.252s ...\" at %s. No Hash parameter", pattern, var->name); } else { *error_msg = apr_psprintf(msr->mp, "Request URI matched \"%s\" at %s. No Hash parameter", pattern, var->name); } return 1; } else { if(strlen(valid) < strlen(msr->txcfg->crypto_param_name)+1) return 1; hmac = valid+strlen(msr->txcfg->crypto_param_name)+1; nlink = apr_pstrmemdup(msr->mp, target, strlen(target) - strlen(valid) - 1); msr_log(msr, 9, "Validating URI %s size %d",nlink,strlen(nlink)); hash_link = do_hash_link(msr, (char *)nlink, HASH_ONLY); if(strcmp(hmac, hash_link) != 0) { if (strlen(pattern) > 252) { *error_msg = apr_psprintf(msr->mp, "Request URI matched \"%.252s ...\" at %s. Hash parameter hash value = [%s] Requested URI hash value = [%s]", pattern, var->name, hmac, hash_link); } else { *error_msg = apr_psprintf(msr->mp, "Request URI matched \"%s\" at %s. Hash parameter hash value = [%s] Requested URI hash value = [%s]", pattern, var->name, hmac, hash_link); } return 1; } } return 0; } return 0; } /* rx */ static int msre_op_rx_param_init(msre_rule *rule, char **error_msg) { const char *errptr = NULL; int erroffset; msc_regex_t *regex; const char *pattern = rule->op_param; #ifdef WITH_PCRE_STUDY #ifdef WITH_PCRE_JIT int rc, jit; #endif #endif if (error_msg == NULL) return -1; *error_msg = NULL; /* Compile pattern */ if(strstr(pattern,"%{") == NULL) { regex = msc_pregcomp_ex(rule->ruleset->mp, pattern, PCRE_DOTALL | PCRE_DOLLAR_ENDONLY, &errptr, &erroffset, msc_pcre_match_limit, msc_pcre_match_limit_recursion); if (regex == NULL) { *error_msg = apr_psprintf(rule->ruleset->mp, "Error compiling pattern (offset %d): %s", erroffset, errptr); return 0; } #ifdef WITH_PCRE_STUDY #ifdef WITH_PCRE_JIT rc = msc_fullinfo(regex, PCRE_INFO_JIT, &jit); if ((rc != 0) || (jit != 1)) { *error_msg = apr_psprintf(rule->ruleset->mp, "Rule %pp [id \"%s\"][file \"%s\"][line \"%d\"] - " "Execution error - " "Does not support JIT (%d)", rule,((rule->actionset != NULL)&&((rule->actionset->id != NULL)&& (rule->actionset->id != NOT_SET_P))) ? rule->actionset->id : "-", rule->filename != NULL ? rule->filename : "-", rule->line_num,rc); } #endif #endif rule->op_param_data = regex; } else { rule->re_precomp = 1; rule->re_str = apr_pstrndup(rule->ruleset->mp, pattern, strlen(pattern)); rule->op_param_data = NULL; } return 1; /* OK */ } static int msre_op_rx_execute(modsec_rec *msr, msre_rule *rule, msre_var *var, char **error_msg) { msc_regex_t *regex = (msc_regex_t *)rule->op_param_data; msc_string *re_pattern = (msc_string *)apr_pcalloc(msr->mp, sizeof(msc_string)); const char *target; const char *errptr = NULL; int erroffset; unsigned int target_length; char *my_error_msg = NULL; int ovector[33]; int capture = 0; int matched_bytes = 0; int matched = 0; int rc; char *qspos = NULL; const char *parm = NULL, *pattern = NULL; msc_parm *mparm = NULL; #ifdef WITH_PCRE_STUDY #ifdef WITH_PCRE_JIT int jit; #endif #endif if (error_msg == NULL) return -1; *error_msg = NULL; if (regex == NULL) { if(rule->re_precomp == 0) { *error_msg = "Internal Error: regex data is null."; return -1; } else { if(re_pattern == NULL) { *error_msg = "Internal Error: regex variable data is null."; return -1; } re_pattern->value = apr_pstrndup(msr->mp, rule->re_str, strlen(rule->re_str)); re_pattern->value_len = strlen(re_pattern->value); expand_macros(msr, re_pattern, rule, msr->mp); pattern = log_escape_re(msr->mp, re_pattern->value); if (msr->txcfg->debuglog_level >= 6) { msr_log(msr, 6, "Escaping pattern [%s]",pattern); } regex = msc_pregcomp_ex(rule->ruleset->mp, pattern, PCRE_DOTALL | PCRE_DOLLAR_ENDONLY, &errptr, &erroffset, msc_pcre_match_limit, msc_pcre_match_limit_recursion); if (regex == NULL) { *error_msg = apr_psprintf(rule->ruleset->mp, "Error compiling pattern (offset %d): %s", erroffset, errptr); return 0; } #ifdef WITH_PCRE_STUDY #ifdef WITH_PCRE_JIT if (msr->txcfg->debuglog_level >= 4) { rc = msc_fullinfo(regex, PCRE_INFO_JIT, &jit); if ((rc != 0) || (jit != 1)) { *error_msg = apr_psprintf(rule->ruleset->mp, "Rule %pp [id \"%s\"][file \"%s\"][line \"%d\"] - " "Execution error - " "Does not support JIT (%d)", rule,((rule->actionset != NULL)&&((rule->actionset->id != NULL)&& (rule->actionset->id != NOT_SET_P))) ? rule->actionset->id : "-", rule->filename != NULL ? rule->filename : "-", rule->line_num,rc); msr_log(msr, 4, "%s.", *error_msg); } } #endif #endif } } /* If the given target is null run against an empty * string. This is a behaviour consistent with previous * releases. */ if (var->value == NULL) { target = ""; target_length = 0; } else { target = var->value; target_length = var->value_len; } /* Are we supposed to capture subexpressions? */ capture = apr_table_get(rule->actionset->actions, "capture") ? 1 : 0; matched_bytes = apr_table_get(rule->actionset->actions, "sanitizeMatchedBytes") ? 1 : 0; if(!matched_bytes) matched_bytes = apr_table_get(rule->actionset->actions, "sanitiseMatchedBytes") ? 1 : 0; matched = apr_table_get(rule->actionset->actions, "sanitizeMatched") ? 1 : 0; if(!matched) matched = apr_table_get(rule->actionset->actions, "sanitiseMatched") ? 1 : 0; /* Show when the regex captures but "capture" is not set */ if (msr->txcfg->debuglog_level >= 6) { int capcount = 0; rc = msc_fullinfo(regex, PCRE_INFO_CAPTURECOUNT, &capcount); if (msr->txcfg->debuglog_level >= 6) { if ((capture == 0) && (capcount > 0)) { msr_log(msr, 6, "Ignoring regex captures since \"capture\" action is not enabled."); } } } /* We always use capture so that ovector can be used as working space * and no memory has to be allocated for any backreferences. */ rc = msc_regexec_capture(regex, target, target_length, ovector, 30, &my_error_msg); if ((rc == PCRE_ERROR_MATCHLIMIT) || (rc == PCRE_ERROR_RECURSIONLIMIT)) { msc_string *s = (msc_string *)apr_pcalloc(msr->mp, sizeof(msc_string)); if (s == NULL) return -1; s->name = apr_pstrdup(msr->mp, "MSC_PCRE_LIMITS_EXCEEDED"); if (s->name == NULL) return -1; s->name_len = strlen(s->name); s->value = apr_pstrdup(msr->mp, "1"); if (s->value == NULL) return -1; s->value_len = 1; apr_table_setn(msr->tx_vars, s->name, (void *)s); *error_msg = apr_psprintf(msr->mp, "Rule %pp [id \"%s\"][file \"%s\"][line \"%d\"] - " "Execution error - " "PCRE limits exceeded (%d): %s", rule,((rule->actionset != NULL)&&(rule->actionset->id != NULL)) ? rule->actionset->id : "-", rule->filename != NULL ? rule->filename : "-", rule->line_num,rc, my_error_msg); msr_log(msr, 3, "%s.", *error_msg); return 0; /* No match. */ } else if (rc < -1) { *error_msg = apr_psprintf(msr->mp, "Regex execution failed (%d): %s", rc, my_error_msg); return -1; } /* Handle captured subexpressions. */ if (capture && rc > 0) { int i; /* Unset any of the previously set capture variables. */ apr_table_unset(msr->tx_vars, "0"); apr_table_unset(msr->tx_vars, "1"); apr_table_unset(msr->tx_vars, "2"); apr_table_unset(msr->tx_vars, "3"); apr_table_unset(msr->tx_vars, "4"); apr_table_unset(msr->tx_vars, "5"); apr_table_unset(msr->tx_vars, "6"); apr_table_unset(msr->tx_vars, "7"); apr_table_unset(msr->tx_vars, "8"); apr_table_unset(msr->tx_vars, "9"); /* Use the available captures. */ for(i = 0; i < rc; i++) { msc_string *s = (msc_string *)apr_pcalloc(msr->mp, sizeof(msc_string)); if (s == NULL) return -1; s->name = apr_psprintf(msr->mp, "%d", i); if (s->name == NULL) return -1; s->name_len = strlen(s->name); s->value = apr_pstrmemdup(msr->mp, target + ovector[2 * i], ovector[2 * i + 1] - ovector[2 * i]); if (s->value == NULL) return -1; s->value_len = (ovector[2 * i + 1] - ovector[2 * i]); apr_table_addn(msr->tx_vars, s->name, (void *)s); if(((matched == 1) || (matched_bytes == 1)) && (var != NULL) && (var->name != NULL)) { qspos = apr_psprintf(msr->mp, "%s", var->name); parm = strstr(qspos, ":"); if (parm != NULL) { parm++; mparm = apr_palloc(msr->mp, sizeof(msc_parm)); if (mparm == NULL) continue; mparm->value = apr_pstrmemdup(msr->mp,s->value,s->value_len); mparm->pad_1 = rule->actionset->arg_min; mparm->pad_2 = rule->actionset->arg_max; apr_table_addn(msr->pattern_to_sanitize, parm, (void *)mparm); } else { mparm = apr_palloc(msr->mp, sizeof(msc_parm)); if (mparm == NULL) continue; mparm->value = apr_pstrmemdup(msr->mp,s->value,s->value_len); apr_table_addn(msr->pattern_to_sanitize, qspos, (void *)mparm); } } if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Added regex subexpression to TX.%d: %s", i, log_escape_nq_ex(msr->mp, s->value, s->value_len)); } } } if (rc != PCRE_ERROR_NOMATCH) { /* Match. */ /* We no longer escape the pattern here as it is done when logging */ char *pattern = apr_pstrdup(msr->mp, log_escape(msr->mp, regex->pattern ? regex->pattern : "")); /* This message will be logged. */ if (strlen(pattern) > 252) { *error_msg = apr_psprintf(msr->mp, "Pattern match \"%.252s ...\" at %s.", pattern, var->name); } else { *error_msg = apr_psprintf(msr->mp, "Pattern match \"%s\" at %s.", pattern, var->name); } return 1; } /* No match. */ return 0; } /* pm */ static int msre_op_pm_param_init(msre_rule *rule, char **error_msg) { ACMP *p; const char *phrase; const char *next; unsigned short int op_len; if ((rule->op_param == NULL)||(strlen(rule->op_param) == 0)) { *error_msg = apr_psprintf(rule->ruleset->mp, "Missing parameter for operator 'pm'."); return 0; /* ERROR */ } op_len = strlen(rule->op_param); p = acmp_create(0, rule->ruleset->mp); if (p == NULL) return 0; phrase = apr_pstrdup(rule->ruleset->mp, parse_pm_content(rule->op_param, op_len, rule, error_msg)); if(phrase == NULL) phrase = apr_pstrdup(rule->ruleset->mp, rule->op_param); /* Loop through phrases */ /* ENH: Need to allow quoted phrases w/space */ for (;;) { while((apr_isspace(*phrase) != 0) && (*phrase != '\0')) phrase++; if (*phrase == '\0') break; next = phrase; while((apr_isspace(*next) == 0) && (*next != 0)) next++; acmp_add_pattern(p, phrase, NULL, NULL, next - phrase); phrase = next; } acmp_prepare(p); rule->op_param_data = p; return 1; } /* pmFromFile */ static int msre_op_pmFromFile_param_init(msre_rule *rule, char **error_msg) { char errstr[1024]; char buf[HUGE_STRING_LEN + 1]; char *fn = NULL; char *next = NULL; char *start = NULL; char *end = NULL; const char *rulefile_path; char *processed = NULL; unsigned short int op_len; apr_status_t rc; apr_file_t *fd = NULL; ACMP *p; if ((rule->op_param == NULL)||(strlen(rule->op_param) == 0)) { *error_msg = apr_psprintf(rule->ruleset->mp, "Missing parameter for operator 'pmFromFile'."); return 0; /* ERROR */ } p = acmp_create(0, rule->ruleset->mp); if (p == NULL) return 0; fn = apr_pstrdup(rule->ruleset->mp, rule->op_param); /* Get the path of the rule filename to use as a base */ rulefile_path = apr_pstrndup(rule->ruleset->mp, rule->filename, strlen(rule->filename) - strlen(apr_filepath_name_get(rule->filename))); #ifdef DEBUG_CONF fprintf(stderr, "Rulefile path: \"%s\"\n", rulefile_path); #endif /* Loop through filenames */ /* ENH: Need to allow quoted filenames w/space */ for (;;) { const char *rootpath = NULL; const char *filepath = NULL; int line = 0; /* Trim whitespace */ while((apr_isspace(*fn) != 0) && (*fn != '\0')) fn++; if (*fn == '\0') break; next = fn; while((apr_isspace(*next) == 0) && (*next != '\0')) next++; while((apr_isspace(*next) != 0) && (*next != '\0')) *(next++) = '\0'; /* Add path of the rule filename for a relative phrase filename */ filepath = fn; if (apr_filepath_root(&rootpath, &filepath, APR_FILEPATH_TRUENAME, rule->ruleset->mp) != APR_SUCCESS) { /* We are not an absolute path. It could mean an error, but * let that pass through to the open call for a better error */ apr_filepath_merge(&fn, rulefile_path, fn, APR_FILEPATH_TRUENAME, rule->ruleset->mp); } /* Open file and read */ rc = apr_file_open(&fd, fn, APR_READ | APR_BUFFERED | APR_FILE_NOCLEANUP, 0, rule->ruleset->mp); if (rc != APR_SUCCESS) { *error_msg = apr_psprintf(rule->ruleset->mp, "Could not open phrase file \"%s\": %s", fn, apr_strerror(rc, errstr, 1024)); return 0; } #ifdef DEBUG_CONF fprintf(stderr, "Loading phrase file: \"%s\"\n", fn); #endif /* Read one pattern per line skipping empty/commented */ for(;;) { line++; rc = apr_file_gets(buf, HUGE_STRING_LEN, fd); if (rc == APR_EOF) break; if (rc != APR_SUCCESS) { *error_msg = apr_psprintf(rule->ruleset->mp, "Could not read \"%s\" line %d: %s", fn, line, apr_strerror(rc, errstr, 1024)); return 0; } op_len = strlen(buf); processed = apr_pstrdup(rule->ruleset->mp, parse_pm_content(buf, op_len, rule, error_msg)); /* Trim Whitespace */ if(processed != NULL) start = processed; else start = buf; while ((apr_isspace(*start) != 0) && (*start != '\0')) start++; if(processed != NULL) end = processed + strlen(processed); else end = buf + strlen(buf); if (end > start) end--; while ((end > start) && (apr_isspace(*end) != 0)) end--; if (end > start) { *(++end) = '\0'; } /* Ignore empty lines and comments */ if ((start == end) || (*start == '#')) continue; acmp_add_pattern(p, start, NULL, NULL, (end - start)); } fn = next; } if (fd != NULL) apr_file_close(fd); acmp_prepare(p); rule->op_param_data = p; return 1; } static int msre_op_pm_execute(modsec_rec *msr, msre_rule *rule, msre_var *var, char **error_msg) { const char *match = NULL; apr_status_t rc = 0; int capture; ACMPT pt; /* Nothing to read */ if ((var->value == NULL) || (var->value_len == 0)) return 0; /* Are we supposed to capture subexpressions? */ capture = apr_table_get(rule->actionset->actions, "capture") ? 1 : 0; pt.parser = (ACMP *)rule->op_param_data; pt.ptr = NULL; rc = acmp_process_quick(&pt, &match, var->value, var->value_len); if (rc) { char *match_escaped = log_escape(msr->mp, match ? match : ""); /* This message will be logged. */ if (strlen(match_escaped) > 252) { *error_msg = apr_psprintf(msr->mp, "Matched phrase \"%.252s ...\" at %s.", match_escaped, var->name); } else { *error_msg = apr_psprintf(msr->mp, "Matched phrase \"%s\" at %s.", match_escaped, var->name); } /* Handle capture as tx.0=match */ if (capture) { int i; msc_string *s = (msc_string *)apr_pcalloc(msr->mp, sizeof(msc_string)); if (s == NULL) return -1; s->name = "0"; s->name_len = strlen(s->name); s->value = apr_pstrdup(msr->mp, match); if (s->value == NULL) return -1; s->value_len = strlen(s->value); apr_table_setn(msr->tx_vars, s->name, (void *)s); if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Added phrase match to TX.0: %s", log_escape_nq_ex(msr->mp, s->value, s->value_len)); } /* Unset the remaining ones (from previous invocations). */ for(i = rc; i <= 9; i++) { char buf[2]; apr_snprintf(buf, sizeof(buf), "%d", i); apr_table_unset(msr->tx_vars, buf); } } return 1; } return rc; } /* gsbLookup */ /** * \brief Reduce /./ to / * * \param pool Pointer to the memory pool * \param domain Input data * * \retval domain On Failure * \retval url On Success */ static const char *gsb_replace_tpath(apr_pool_t *pool, const char *domain, int len) { char *pos = NULL, *data = NULL; char *url = NULL; int match = 0; url = apr_palloc(pool, len + 1); data = apr_palloc(pool, len + 1); memset(data, 0, len+1); memset(url, 0, len+1); memcpy(url, domain, len); while(( pos = strstr(url , "/./" )) != NULL) { match = 1; data[0] = '\0'; strncat(data, url, pos - url); strcat(data , "/"); strcat(data ,pos + strlen("/./")); strncpy(url , data, len); } if(match == 0) return domain; return url; } /** * \brief Reduce double dot to single dot * * \param msr ModSecurity transation resource * \param domain Input data * * \retval domain On Failure * \retval reduced On Success */ static const char *gsb_reduce_char(apr_pool_t *pool, const char *domain) { char *ptr = apr_pstrdup(pool, domain); char *data = NULL; char *reduced = NULL; int skip = 0; if(ptr == NULL) return domain; data = apr_pcalloc(pool, strlen(ptr)); if(data == NULL) return domain; reduced = data; while(*ptr != '\0') { switch(*ptr) { case '.': ptr++; if(*ptr == '.') skip = 1; ptr--; break; case '/': ptr++; if(*ptr == '/') skip = 1; ptr--; break; } if(skip == 0) { *data = *ptr; data++; } ptr++; skip = 0; } *data = '\0'; --data; if(*data == '.') *data = '\0'; else ++data; return reduced; } /** * \brief Verify function to gsbLookup operator * * \param msr ModSecurity transaction resource * \param match Pointer to input data * \param match_length Input size * * \retval -1 On Failure * \retval 1 On Match * \retval 0 On No Match */ static int verify_gsb(gsb_db *gsb, modsec_rec *msr, const char *match, unsigned int match_length) { apr_md5_ctx_t ctx; apr_status_t rc; unsigned char digest[APR_MD5_DIGESTSIZE]; const char *hash = NULL; const char *search = NULL; memset(digest, 0, sizeof(digest)); apr_md5_init(&ctx); if ((rc = apr_md5_update(&ctx, match, match_length)) != APR_SUCCESS) return -1; apr_md5_final(digest, &ctx); hash = apr_psprintf(msr->mp, "%s", bytes2hex(msr->mp, digest, 16)); if ((hash != NULL) && (gsb->gsb_table != NULL)) { search = apr_hash_get(gsb->gsb_table, hash, APR_HASH_KEY_STRING); if (search != NULL) return 1; } return 0; } /** * \brief Init function to gsbLookup operator * * \param rule ModSecurity rule struct * \param error_msg Error message * * \retval 1 On Success * \retval 0 On Fail */ static int msre_op_gsbLookup_param_init(msre_rule *rule, char **error_msg) { const char *errptr = NULL; int erroffset; msc_regex_t *regex; if (error_msg == NULL) return -1; *error_msg = NULL; /* Compile rule->op_param */ regex = msc_pregcomp_ex(rule->ruleset->mp, rule->op_param, PCRE_DOTALL | PCRE_MULTILINE, &errptr, &erroffset, msc_pcre_match_limit, msc_pcre_match_limit_recursion); if (regex == NULL) { *error_msg = apr_psprintf(rule->ruleset->mp, "Error compiling pattern (offset %d): %s", erroffset, errptr); return 0; } rule->op_param_data = regex; return 1; /* OK */ } /** * \brief Execution function to gsbLookup operator * * \param msr ModSecurity transaction resource * \param rule ModSecurity rule struct * \param var ModSecurity variable struct * \param error_msg Error message * * \retval -1 On Failure * \retval 1 On Match * \retval 0 On No Match */ static int msre_op_gsbLookup_execute(modsec_rec *msr, msre_rule *rule, msre_var *var, char **error_msg) { msc_regex_t *regex = (msc_regex_t *)rule->op_param_data; char *my_error_msg = NULL; int ovector[33]; unsigned int offset = 0; gsb_db *gsb = msr->txcfg->gsb; const char *match = NULL; unsigned int match_length; unsigned int canon_length; int rv, i, ret, count_slash; unsigned int j = 0; unsigned int size = var->value_len; char *base = NULL, *domain = NULL, *savedptr = NULL; char *str = NULL, *canon = NULL, *dot = NULL; char *data = NULL, *ptr = NULL, *url = NULL; int capture, domain_len; int d_pos = -1; int s_pos = -1; if (error_msg == NULL) return -1; *error_msg = NULL; if(regex == NULL) { *error_msg = "Internal Error: regex is null."; return 0; } if(gsb == NULL) { msr_log(msr, 1, "GSB lookup failed without a database. Set SecGsbLookupDB."); return 0; } data = apr_pcalloc(rule->ruleset->mp, var->value_len+1); if(data == NULL) { *error_msg = "Internal Error: cannot allocate memory for data."; return -1; } capture = apr_table_get(rule->actionset->actions, "capture") ? 1 : 0; memcpy(data,var->value,var->value_len); while (offset < size && (rv = msc_regexec_ex(regex, data, size, offset, PCRE_NOTEMPTY, ovector, 30, &my_error_msg)) >= 0) { for(i = 0; i < rv; ++i) { match = apr_psprintf(rule->ruleset->mp, "%.*s", ovector[2*i+1] - ovector[2*i], data + ovector[2*i]); if (match == NULL) { *error_msg = "Internal Error: cannot allocate memory for match."; return -1; } match = remove_escape(rule->ruleset->mp, match, strlen(match)); match = gsb_replace_tpath(rule->ruleset->mp, match, strlen(match)); match = gsb_reduce_char(rule->ruleset->mp, match); match_length = strlen(match); strtolower_inplace((unsigned char *)match); if((strstr(match,"http") == NULL) && (match_length > 0) && (strchr(match,'.'))) { /* full url */ if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "GSB: Successfully extracted url: %s", match); } ret = verify_gsb(gsb, msr, match, match_length); if(ret > 0) { set_match_to_tx(msr, capture, match, 0); if (! *error_msg) { *error_msg = apr_psprintf(msr->mp, "Gsb lookup for \"%s\" succeeded.", log_escape_nq(msr->mp, match)); } str = apr_pstrdup(rule->ruleset->mp,match); base = apr_strtok(str,"/",&savedptr); if(base != NULL) set_match_to_tx(msr, capture, base, 1); return 1; } /* append / in the end of full url */ if ((match[match_length -1] != '/') && (strchr(match,'?') == NULL)) { canon = apr_psprintf(rule->ruleset->mp, "%s/", match); if (canon != NULL) { canon_length = strlen(canon); ret = verify_gsb(gsb, msr, canon, canon_length); if(ret > 0) { set_match_to_tx(msr, capture, match, 0); if (! *error_msg) { *error_msg = apr_psprintf(msr->mp, "Gsb lookup for \"%s\" succeeded.", log_escape_nq(msr->mp, canon)); } str = apr_pstrdup(rule->ruleset->mp,match); base = apr_strtok(str,"/",&savedptr); if(base != NULL) set_match_to_tx(msr, capture, base, 1); return 1; } } } /* Parsing full url */ domain = apr_pstrdup(rule->ruleset->mp, match); domain_len = strlen(domain); if(*domain != '/') { if(domain[domain_len-1] == '.') domain[domain_len-1] = '\0'; if(domain[domain_len-1] == '/' && domain[domain_len-2] == '.') { domain[domain_len-2] = '/'; domain[domain_len-1] = '\0'; } dot = strchr(domain,'.'); if(dot != NULL) { canon = apr_pstrdup(rule->ruleset->mp, domain); ret = verify_gsb(gsb, msr, canon, strlen(canon)); if(ret > 0) { set_match_to_tx(msr, capture, canon, 0); if (! *error_msg) { *error_msg = apr_psprintf(msr->mp, "Gsb lookup for \"%s\" succeeded.", log_escape_nq(msr->mp, canon)); } str = apr_pstrdup(rule->ruleset->mp,match); base = apr_strtok(str,"/",&savedptr); if(base != NULL) set_match_to_tx(msr, capture, base, 1); return 1; } base = apr_strtok(canon,"?",&savedptr); if(base != NULL) { ret = verify_gsb(gsb, msr, base, strlen(base)); if(ret > 0) { set_match_to_tx(msr, capture, base, 0); if (! *error_msg) { *error_msg = apr_psprintf(msr->mp, "Gsb lookup for \"%s\" succeeded.", log_escape_nq(msr->mp, base)); } str = apr_pstrdup(rule->ruleset->mp,match); base = apr_strtok(str,"/",&savedptr); if(base != NULL) set_match_to_tx(msr, capture, base, 1); return 1; } } url = apr_palloc(rule->ruleset->mp, strlen(canon)); count_slash = 0; while(*canon != '\0') { switch (*canon) { case '/': ptr = apr_psprintf(rule->ruleset->mp,"%s/",url); ret = verify_gsb(gsb, msr, ptr, strlen(ptr)); if(ret > 0) { set_match_to_tx(msr, capture, ptr, 0); if (! *error_msg) { *error_msg = apr_psprintf(msr->mp, "Gsb lookup for \"%s\" succeeded.", log_escape_nq(msr->mp, ptr)); } str = apr_pstrdup(rule->ruleset->mp,match); base = apr_strtok(str,"/",&savedptr); if(base != NULL) set_match_to_tx(msr, capture, base, 1); return 1; } break; } url[count_slash] = *canon; count_slash++; canon++; } } } /* Do the same for subdomains */ for(j=0; jruleset->mp, match); while (*str != '\0') { switch(*str) { case '.': domain++; domain_len = strlen(domain); d_pos = strchr(domain,'.') - domain; if(s_pos >= 0 && d_pos >= 0 && d_pos > s_pos) break; if(*domain != '/') { if(domain[domain_len-1] == '.') domain[domain_len-1] = '\0'; if(domain[domain_len-1] == '/' && domain[domain_len-2] == '.') { domain[domain_len-2] = '/'; domain[domain_len-1] = '\0'; } dot = strchr(domain,'.'); if(dot != NULL) { canon = apr_pstrdup(rule->ruleset->mp, domain); ret = verify_gsb(gsb, msr, canon, strlen(canon)); if(ret > 0) { set_match_to_tx(msr, capture, canon, 0); if (! *error_msg) { *error_msg = apr_psprintf(msr->mp, "Gsb lookup for \"%s\" succeeded.", log_escape_nq(msr->mp, canon)); } str = apr_pstrdup(rule->ruleset->mp,match); base = apr_strtok(str,"/",&savedptr); if(base != NULL) set_match_to_tx(msr, capture, base, 1); return 1; } base = apr_strtok(canon,"?",&savedptr); if(base != NULL) { ret = verify_gsb(gsb, msr, base, strlen(base)); if(ret > 0) { set_match_to_tx(msr, capture, base, 0); if (! *error_msg) { *error_msg = apr_psprintf(msr->mp, "Gsb lookup for \"%s\" succeeded.", log_escape_nq(msr->mp, base)); } str = apr_pstrdup(rule->ruleset->mp,match); base = apr_strtok(str,"/",&savedptr); if(base != NULL) set_match_to_tx(msr, capture, base, 1); return 1; } } url = apr_palloc(rule->ruleset->mp, strlen(canon)); count_slash = 0; while(*canon != '\0') { switch (*canon) { case '/': ptr = apr_psprintf(rule->ruleset->mp,"%s/",url); ret = verify_gsb(gsb, msr, ptr, strlen(ptr)); if(ret > 0) { set_match_to_tx(msr, capture, ptr, 0); if (! *error_msg) { *error_msg = apr_psprintf(msr->mp, "Gsb lookup for \"%s\" succeeded.", log_escape_nq(msr->mp, ptr)); } str = apr_pstrdup(rule->ruleset->mp,match); base = apr_strtok(str,"/",&savedptr); if(base != NULL) set_match_to_tx(msr, capture, base, 1); return 1; } break; } url[count_slash] = *canon; count_slash++; canon++; } } } break; } domain = str; domain++; str++; } } } offset = ovector[1]; } return 0; } /* within */ static int msre_op_within_execute(modsec_rec *msr, msre_rule *rule, msre_var *var, char **error_msg) { msc_string *str = (msc_string *)apr_pcalloc(msr->mp, sizeof(msc_string)); const char *match = NULL; const char *target; unsigned int match_length; unsigned int target_length = 0; unsigned int i, i_max; str->value = (char *)rule->op_param; if (str->value == NULL) { *error_msg = "Internal Error: match string is null."; return -1; } str->value_len = strlen(str->value); if (error_msg == NULL) return -1; *error_msg = NULL; expand_macros(msr, str, rule, msr->mp); match = (const char *)str->value; match_length = str->value_len; /* If the given target is null we give up without a match */ if (var->value == NULL) { /* No match. */ return 0; } target = var->value; target_length = var->value_len; /* The empty string always matches */ if (target_length == 0) { /* Match. */ *error_msg = apr_psprintf(msr->mp, "String match within \"\" at %s.", var->name); return 1; } /* This is impossible to match */ if (target_length > match_length) { /* No match. */ return 0; } /* scan for first character, then compare from there until we * have a match or there is no room left in the target */ i_max = match_length - target_length; for (i = 0; i <= i_max; i++) { if (match[i] == target[0]) { if (memcmp((target + 1), (match + i + 1), (target_length - 1)) == 0) { /* match. */ *error_msg = apr_psprintf(msr->mp, "String match within \"%s\" at %s.", log_escape_ex(msr->mp, match, match_length), var->name); return 1; } } } /* No match. */ return 0; } /* contains */ static int msre_op_contains_execute(modsec_rec *msr, msre_rule *rule, msre_var *var, char **error_msg) { msc_string *str = (msc_string *)apr_pcalloc(msr->mp, sizeof(msc_string)); const char *match = NULL; const char *target; unsigned int match_length; unsigned int target_length = 0; unsigned int i, i_max; str->value = (char *)rule->op_param; if (str->value == NULL) { *error_msg = "Internal Error: match string is null."; return -1; } str->value_len = strlen(str->value); if (error_msg == NULL) return -1; *error_msg = NULL; expand_macros(msr, str, rule, msr->mp); match = (const char *)str->value; match_length = str->value_len; /* If the given target is null run against an empty * string. This is a behaviour consistent with previous * releases. */ if (var->value == NULL) { target = ""; target_length = 0; } else { target = var->value; target_length = var->value_len; } /* The empty string always matches */ if (match_length == 0) { /* Match. */ *error_msg = apr_psprintf(msr->mp, "String match \"\" at %s.", var->name); return 1; } /* This is impossible to match */ if (match_length > target_length) { /* No match. */ return 0; } /* scan for first character, then compare from there until we * have a match or there is no room left in the target */ i_max = target_length - match_length; for (i = 0; i <= i_max; i++) { /* First character matched - avoid func call */ if (target[i] == match[0]) { /* See if remaining matches */ if ( (match_length == 1) || (memcmp((match + 1), (target + i + 1), (match_length - 1)) == 0)) { /* Match. */ *error_msg = apr_psprintf(msr->mp, "String match \"%s\" at %s.", log_escape_ex(msr->mp, match, match_length), var->name); return 1; } } } /* No match. */ return 0; } /** libinjection detectSQLi * links against files in libinjection directory * See www.client9.com/libinjection for details */ static int msre_op_detectSQLi_execute(modsec_rec *msr, msre_rule *rule, msre_var *var, char **error_msg) { struct libinjection_sqli_state sqli_state; int issqli; int capture; libinjection_sqli_init(&sqli_state, var->value, var->value_len, 0); issqli = libinjection_is_sqli(&sqli_state); capture = apr_table_get(rule->actionset->actions, "capture") ? 1 : 0; if (issqli) { set_match_to_tx(msr, capture, sqli_state.fingerprint, 0); *error_msg = apr_psprintf(msr->mp, "detected SQLi using libinjection with fingerprint '%s'", sqli_state.fingerprint); if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "ISSQL: libinjection fingerprint '%s' matched input '%s'", sqli_state.fingerprint, log_escape_ex(msr->mp, var->value, var->value_len)); } } else { if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "ISSQL: not sqli, no libinjection sqli fingerprint matched input '%s'", log_escape_ex(msr->mp, var->value, var->value_len)); } } return issqli; } /* containsWord */ static int msre_op_containsWord_execute(modsec_rec *msr, msre_rule *rule, msre_var *var, char **error_msg) { msc_string *str = (msc_string *)apr_pcalloc(msr->mp, sizeof(msc_string)); const char *match = NULL; const char *target; unsigned int match_length; unsigned int target_length = 0; unsigned int i, i_max; int rc = 0; str->value = (char *)rule->op_param; if (str->value == NULL) { *error_msg = "Internal Error: match string is null."; return -1; } str->value_len = strlen(str->value); if (error_msg == NULL) return -1; *error_msg = NULL; expand_macros(msr, str, rule, msr->mp); match = (const char *)str->value; match_length = str->value_len; /* If the given target is null run against an empty * string. This is a behaviour consistent with previous * releases. */ if (var->value == NULL) { target = ""; target_length = 0; } else { target = var->value; target_length = var->value_len; } /* The empty string always matches */ if (match_length == 0) { /* Match. */ *error_msg = apr_psprintf(msr->mp, "String match \"\" at %s.", var->name); return 1; } /* This is impossible to match */ if (match_length > target_length) { /* No match. */ return 0; } /* scan for first character, then compare from there until we * have a match or there is no room left in the target */ i_max = target_length - match_length; for (i = 0; i <= i_max; i++) { /* Previous char must have been a start or non-word */ if ((i > 0) && (apr_isalnum(target[i-1])||(target[i-1] == '_'))) continue; /* First character matched - avoid func call */ if (target[i] == match[0]) { /* See if remaining matches */ if ( (match_length == 1) || (memcmp((match + 1), (target + i + 1), (match_length - 1)) == 0)) { /* check boundaries */ if (i == i_max) { /* exact/end word match */ rc = 1; } else if (!(apr_isalnum(target[i + match_length])||(target[i + match_length] == '_'))) { /* start/mid word match */ rc = 1; } } } } if (rc == 1) { /* Maybe a match. */ *error_msg = apr_psprintf(msr->mp, "String match \"%s\" at %s.", log_escape_ex(msr->mp, match, match_length), var->name); return 1; } /* No match. */ *error_msg = NULL; return 0; } /* streq */ static int msre_op_streq_execute(modsec_rec *msr, msre_rule *rule, msre_var *var, char **error_msg) { msc_string *str = (msc_string *)apr_pcalloc(msr->mp, sizeof(msc_string)); const char *match = NULL; const char *target; unsigned int match_length; unsigned int target_length; str->value = (char *)rule->op_param; if (str->value == NULL) { *error_msg = "Internal Error: match string is null."; return -1; } str->value_len = strlen(str->value); if (error_msg == NULL) return -1; *error_msg = NULL; expand_macros(msr, str, rule, msr->mp); match = (const char *)str->value; match_length = str->value_len; /* If the given target is null run against an empty * string. This is a behaviour consistent with previous * releases. */ if (var->value == NULL) { target = ""; target_length = 0; } else { target = var->value; target_length = var->value_len; } /* These are impossible to match */ if (match_length != target_length) { /* No match. */ return 0; } if (memcmp(match, target, target_length) == 0) { /* Match. */ *error_msg = apr_psprintf(msr->mp, "String match \"%s\" at %s.", log_escape_ex(msr->mp, match, match_length), var->name); return 1; } /* No match. */ return 0; } /* beginsWith */ static int msre_op_beginsWith_execute(modsec_rec *msr, msre_rule *rule, msre_var *var, char **error_msg) { msc_string *str = (msc_string *)apr_pcalloc(msr->mp, sizeof(msc_string)); const char *match = NULL; const char *target; unsigned int match_length; unsigned int target_length; str->value = (char *)rule->op_param; if (str->value == NULL) { *error_msg = "Internal Error: match string is null."; return -1; } str->value_len = strlen(str->value); if (error_msg == NULL) return -1; *error_msg = NULL; expand_macros(msr, str, rule, msr->mp); match = (const char *)str->value; match_length = str->value_len; /* If the given target is null run against an empty * string. This is a behaviour consistent with previous * releases. */ if (var->value == NULL) { target = ""; target_length = 0; } else { target = var->value; target_length = var->value_len; } /* The empty string always matches */ if (match_length == 0) { /* Match. */ *error_msg = apr_psprintf(msr->mp, "String match \"\" at %s.", var->name); return 1; } /* This is impossible to match */ if (match_length > target_length) { /* No match. */ return 0; } if (memcmp(match, target, match_length) == 0) { /* Match. */ *error_msg = apr_psprintf(msr->mp, "String match \"%s\" at %s.", log_escape_ex(msr->mp, match, match_length), var->name); return 1; } /* No match. */ return 0; } /* endsWith */ static int msre_op_endsWith_execute(modsec_rec *msr, msre_rule *rule, msre_var *var, char **error_msg) { msc_string *str = (msc_string *)apr_pcalloc(msr->mp, sizeof(msc_string)); const char *match = NULL; const char *target; unsigned int match_length; unsigned int target_length; str->value = (char *)rule->op_param; if (str->value == NULL) { *error_msg = "Internal Error: match string is null."; return -1; } str->value_len = strlen(str->value); if (error_msg == NULL) return -1; *error_msg = NULL; expand_macros(msr, str, rule, msr->mp); match = (const char *)str->value; match_length = str->value_len; /* If the given target is null run against an empty * string. This is a behaviour consistent with previous * releases. */ if (var->value == NULL) { target = ""; target_length = 0; } else { target = var->value; target_length = var->value_len; } /* The empty string always matches */ if (match_length == 0) { /* Match. */ *error_msg = apr_psprintf(msr->mp, "String match \"\" at %s.", var->name); return 1; } /* This is impossible to match */ if (match_length > target_length) { /* No match. */ return 0; } if (memcmp(match, (target + (target_length - match_length)), match_length) == 0) { /* Match. */ *error_msg = apr_psprintf(msr->mp, "String match \"%s\" at %s.", log_escape_ex(msr->mp, match, match_length), var->name); return 1; } /* No match. */ return 0; } /* strmatch */ static int msre_op_strmatch_param_init(msre_rule *rule, char **error_msg) { const apr_strmatch_pattern *compiled_pattern; char *processed = NULL; const char *pattern = rule->op_param; unsigned short int op_len; if (error_msg == NULL) return -1; *error_msg = NULL; op_len = strlen(pattern); /* Process pattern */ processed = parse_pm_content(pattern, op_len, rule, error_msg); if (processed == NULL) { return 0; } /* Compile pattern */ compiled_pattern = apr_strmatch_precompile(rule->ruleset->mp, processed, 1); if (compiled_pattern == NULL) { *error_msg = apr_psprintf(rule->ruleset->mp, "Error compiling pattern: %s", pattern); return 0; } rule->op_param_data = (void *)compiled_pattern; return 1; /* OK */ } static int msre_op_strmatch_execute(modsec_rec *msr, msre_rule *rule, msre_var *var, char **error_msg) { apr_strmatch_pattern *compiled_pattern = (apr_strmatch_pattern *)rule->op_param_data; const char *target; unsigned int target_length; const char *rc; if (error_msg == NULL) return -1; *error_msg = NULL; if (compiled_pattern == NULL) { *error_msg = "Internal Error: strnmatch data is null."; return -1; } /* If the given target is null run against an empty * string. This is a behaviour consistent with previous * releases. */ if (var->value == NULL) { target = ""; target_length = 0; } else { target = var->value; target_length = var->value_len; } rc = apr_strmatch(compiled_pattern, target, target_length); if (rc == NULL) { /* No match. */ return 0; } *error_msg = apr_psprintf(msr->mp, "Pattern match \"%s\" at %s.", log_escape(msr->mp, rule->op_param), var->name); /* Match. */ return 1; } /* validateDTD */ static int msre_op_validateDTD_init(msre_rule *rule, char **error_msg) { /* ENH Verify here the file actually exists. */ return 1; } static int msre_op_validateDTD_execute(modsec_rec *msr, msre_rule *rule, msre_var *var, char **error_msg) { xmlValidCtxtPtr cvp; xmlDtdPtr dtd; if ((msr->xml == NULL)||(msr->xml->doc == NULL)) { *error_msg = apr_psprintf(msr->mp, "XML document tree could not be found for DTD validation."); return -1; } if (msr->xml->well_formed != 1) { *error_msg = apr_psprintf(msr->mp, "XML: DTD validation failed because content is not well formed."); return 1; } /* Make sure there were no other generic processing errors */ if (msr->msc_reqbody_error) { *error_msg = apr_psprintf(msr->mp, "XML: DTD validation could not proceed due to previous" " processing errors."); return 1; } dtd = xmlParseDTD(NULL, (const xmlChar *)rule->op_param); /* EHN support relative filenames */ if (dtd == NULL) { *error_msg = apr_psprintf(msr->mp, "XML: Failed to load DTD: %s", rule->op_param); return -1; } cvp = xmlNewValidCtxt(); if (cvp == NULL) { *error_msg = "XML: Failed to create a validation context."; xmlFreeDtd(dtd); return -1; } /* Send validator errors/warnings to msr_log */ /* NOTE: No xmlDtdSetValidErrors()? */ cvp->error = (xmlSchemaValidityErrorFunc)msr_log_error; cvp->warning = (xmlSchemaValidityErrorFunc)msr_log_warn; cvp->userData = msr; if (!xmlValidateDtd(cvp, msr->xml->doc, dtd)) { *error_msg = "XML: DTD validation failed."; xmlFreeValidCtxt(cvp); xmlFreeDtd(dtd); return 1; /* No match. */ } if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "XML: Successfully validated payload against DTD: %s", rule->op_param); } xmlFreeValidCtxt(cvp); xmlFreeDtd(dtd); /* Match. */ return 0; } /* validateSchema */ static int msre_op_validateSchema_init(msre_rule *rule, char **error_msg) { /* ENH Verify here the file actually exists. */ return 1; } static int msre_op_validateSchema_execute(modsec_rec *msr, msre_rule *rule, msre_var *var, char **error_msg) { xmlSchemaParserCtxtPtr parserCtx; xmlSchemaValidCtxtPtr validCtx; xmlSchemaPtr schema; int rc; if ((msr->xml == NULL)||(msr->xml->doc == NULL)) { *error_msg = apr_psprintf(msr->mp, "XML document tree could not be found for schema validation."); return -1; } if (msr->xml->well_formed != 1) { *error_msg = apr_psprintf(msr->mp, "XML: Schema validation failed because content is not well formed."); return 1; } /* Make sure there were no other generic processing errors */ if (msr->msc_reqbody_error) { *error_msg = apr_psprintf(msr->mp, "XML: Schema validation could not proceed due to previous" " processing errors."); return 1; } parserCtx = xmlSchemaNewParserCtxt(rule->op_param); /* ENH support relative filenames */ if (parserCtx == NULL) { *error_msg = apr_psprintf(msr->mp, "XML: Failed to load Schema from file: %s", rule->op_param); return -1; } /* Send parser errors/warnings to msr_log */ xmlSchemaSetParserErrors(parserCtx, (xmlSchemaValidityErrorFunc)msr_log_error, (xmlSchemaValidityWarningFunc)msr_log_warn, msr); schema = xmlSchemaParse(parserCtx); if (schema == NULL) { *error_msg = apr_psprintf(msr->mp, "XML: Failed to load Schema: %s", rule->op_param); xmlSchemaFreeParserCtxt(parserCtx); return -1; } validCtx = xmlSchemaNewValidCtxt(schema); if (validCtx == NULL) { *error_msg = "XML: Failed to create validation context."; xmlSchemaFree(schema); xmlSchemaFreeParserCtxt(parserCtx); return -1; } /* Send validator errors/warnings to msr_log */ xmlSchemaSetValidErrors(validCtx, (xmlSchemaValidityErrorFunc)msr_log_error, (xmlSchemaValidityWarningFunc)msr_log_warn, msr); rc = xmlSchemaValidateDoc(validCtx, msr->xml->doc); if (rc != 0) { *error_msg = "XML: Schema validation failed."; xmlSchemaFree(schema); xmlSchemaFreeParserCtxt(parserCtx); return 1; /* No match. */ } if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "XML: Successfully validated payload against Schema: %s", rule->op_param); } xmlSchemaFree(schema); xmlSchemaFreeValidCtxt(validCtx); return 0; } /* verifyCC */ /** * Luhn Mod-10 Method (ISO 2894/ANSI 4.13) */ static int luhn_verify(const char *ccnumber, int len) { int sum[2] = { 0, 0 }; int odd = 0; int digits = 0; int i; /* Weighted lookup table which is just a precalculated (i = index): * i*2 + (( (i*2) > 9 ) ? -9 : 0) */ static const int wtable[10] = {0, 2, 4, 6, 8, 1, 3, 5, 7, 9}; /* weight lookup table */ /* Add up only digits (weighted digits via lookup table) * for both odd and even CC numbers to avoid 2 passes. */ for (i = 0; i < len; i++) { if (apr_isdigit(ccnumber[i])) { sum[0] += (!odd ? wtable[ccnumber[i] - '0'] : (ccnumber[i] - '0')); sum[1] += (odd ? wtable[ccnumber[i] - '0'] : (ccnumber[i] - '0')); odd = 1 - odd; /* alternate weights */ digits++; } } /* No digits extracted */ if (digits == 0) return 0; /* Do a mod 10 on the sum */ sum[odd] %= 10; /* If the result is a zero the card is valid. */ return sum[odd] ? 0 : 1; } static int msre_op_verifyCC_init(msre_rule *rule, char **error_msg) { const char *errptr = NULL; int erroffset; msc_regex_t *regex; if (error_msg == NULL) return -1; *error_msg = NULL; /* Compile rule->op_param */ regex = msc_pregcomp_ex(rule->ruleset->mp, rule->op_param, PCRE_DOTALL | PCRE_MULTILINE, &errptr, &erroffset, msc_pcre_match_limit, msc_pcre_match_limit_recursion); if (regex == NULL) { *error_msg = apr_psprintf(rule->ruleset->mp, "Error compiling pattern (offset %d): %s", erroffset, errptr); return 0; } rule->op_param_data = regex; return 1; /* OK */ } static int msre_op_verifyCC_execute(modsec_rec *msr, msre_rule *rule, msre_var *var, char **error_msg) { msc_regex_t *regex = (msc_regex_t *)rule->op_param_data; const char *target; unsigned int target_length; char *my_error_msg = NULL; int ovector[33]; int rc; int is_cc = 0; int offset; int matched_bytes = 0; char *qspos = NULL; const char *parm = NULL; msc_parm *mparm = NULL; #ifdef WITH_PCRE_STUDY #ifdef WITH_PCRE_JIT int jit; #endif #endif if (error_msg == NULL) return -1; *error_msg = NULL; if (regex == NULL) { *error_msg = "Internal Error: regex data is null."; return -1; } memset(ovector, 0, sizeof(ovector)); #ifdef WITH_PCRE_STUDY #ifdef WITH_PCRE_JIT if (msr->txcfg->debuglog_level >= 4) { rc = msc_fullinfo(regex, PCRE_INFO_JIT, &jit); if ((rc != 0) || (jit != 1)) { *error_msg = apr_psprintf(rule->ruleset->mp, "Rule %pp [id \"%s\"][file \"%s\"][line \"%d\"] - " "Execution error - " "Does not support JIT (%d)", rule,((rule->actionset != NULL)&&((rule->actionset->id != NULL)&& (rule->actionset->id != NOT_SET_P))) ? rule->actionset->id : "-", rule->filename != NULL ? rule->filename : "-", rule->line_num,rc); msr_log(msr, 4, "%s.", *error_msg); } } #endif #endif /* If the given target is null run against an empty * string. This is a behaviour consistent with previous * releases. */ if (var->value == NULL) { target = ""; target_length = 0; } else { target = var->value; target_length = var->value_len; } for (offset = 0; ((unsigned int)offset < target_length) && (is_cc == 0); offset++) { if (msr->txcfg->debuglog_level >= 9) { if (offset > 0) { msr_log(msr, 9, "Continuing CC# search at target offset %d.", offset); } } rc = msc_regexec_ex(regex, target, target_length, offset, PCRE_NOTEMPTY, ovector, 30, &my_error_msg); /* If there was no match, then we are done. */ if (rc == PCRE_ERROR_NOMATCH) { break; } if (rc < -1) { *error_msg = apr_psprintf(msr->mp, "CC# regex execution failed: %s", my_error_msg); return -1; } /* Verify a match. */ if (rc > 0) { const char *match = target + ovector[0]; int length = ovector[1] - ovector[0]; int i = 0; offset = ovector[2*i]; /* Check the Luhn using the match string */ is_cc = luhn_verify(match, length); /* Not a CC number, then try another match where we left off. */ if (!is_cc) { if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "CC# Luhn check failed at target offset %d: \"%.*s\"", offset, length, match); } continue; } /* We have a potential CC number and need to set any captures * and we are done. */ matched_bytes = apr_table_get(rule->actionset->actions, "sanitizeMatchedBytes") ? 1 : 0; if(!matched_bytes) matched_bytes = apr_table_get(rule->actionset->actions, "sanitiseMatchedBytes") ? 1 : 0; if (apr_table_get(rule->actionset->actions, "capture")) { for(; i < rc; i++) { msc_string *s = (msc_string *)apr_pcalloc(msr->mp, sizeof(msc_string)); if (s == NULL) return -1; s->name = apr_psprintf(msr->mp, "%d", i); if (s->name == NULL) return -1; s->name_len = strlen(s->name); s->value = apr_pstrmemdup(msr->mp, match, length); if (s->value == NULL) return -1; s->value_len = length; apr_table_setn(msr->tx_vars, s->name, (void *)s); if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Added regex subexpression to TX.%d: %s", i, log_escape_nq_ex(msr->mp, s->value, s->value_len)); } if((matched_bytes == 1) && (var != NULL) && (var->name != NULL)) { qspos = apr_psprintf(msr->mp, "%s", var->name); parm = strstr(qspos, ":"); if (parm != NULL) { parm++; mparm = apr_palloc(msr->mp, sizeof(msc_parm)); if (mparm == NULL) continue; mparm->value = apr_pstrmemdup(msr->mp,s->value,s->value_len); mparm->pad_1 = rule->actionset->arg_min; mparm->pad_2 = rule->actionset->arg_max; apr_table_addn(msr->pattern_to_sanitize, parm, (void *)mparm); } else { mparm = apr_palloc(msr->mp, sizeof(msc_parm)); if (mparm == NULL) continue; mparm->value = apr_pstrmemdup(msr->mp,s->value,s->value_len); apr_table_addn(msr->pattern_to_sanitize, qspos, (void *)mparm); } } } } /* Unset the remaining TX vars (from previous invocations). */ for(; i <= 9; i++) { char buf[24]; apr_snprintf(buf, sizeof(buf), "%i", i); apr_table_unset(msr->tx_vars, buf); } break; } } if (is_cc) { /* Match. */ /* This message will be logged. */ *error_msg = apr_psprintf(msr->mp, "CC# match \"%s\" at %s. [offset \"%d\"]", regex->pattern, var->name, offset); return 1; } /* No match. */ return 0; } /** * \brief Check for a valid CPF * * \param cpfnumber Pointer to cpf * \param len cpf length * * \retval 0 On Invalid CPF * \retval 1 On Valid CPF */ static int cpf_verify(const char *cpfnumber, int len) { int factor, part_1, part_2, var_len = len; unsigned int sum = 0, i = 0, cpf_len = 11, c; int cpf[11]; char s_cpf[11]; char bad_cpf[11][11] = { "00000000000", "01234567890", "11111111111", "22222222222", "33333333333", "44444444444", "55555555555", "66666666666", "77777777777", "88888888888", "99999999999"}; while((*cpfnumber != '\0') && ( var_len > 0)) { if(*cpfnumber != '-' || *cpfnumber != '.') { if(i < cpf_len && isdigit(*cpfnumber)) { s_cpf[i] = *cpfnumber; cpf[i] = convert_to_int(*cpfnumber); i++; } } cpfnumber++; var_len--; } if (i != cpf_len) return 0; else { for(i = 0; i< cpf_len; i++) { if(strncmp(s_cpf,bad_cpf[i],cpf_len) == 0) { return 0; } } } part_1 = convert_to_int(s_cpf[cpf_len-2]); part_2 = convert_to_int(s_cpf[cpf_len-1]); c = cpf_len; for(i = 0; i < 9; i++) { sum += (cpf[i] * --c); } factor = (sum % cpf_len); if(factor < 2) { cpf[9] = 0; } else { cpf[9] = cpf_len-factor; } sum = 0; c = cpf_len; for(i = 0;i < 10; i++) sum += (cpf[i] * c--); factor = (sum % cpf_len); if(factor < 2) { cpf[10] = 0; } else { cpf[10] = cpf_len-factor; } if(part_1 == cpf[9] && part_2 == cpf[10]) return 1; return 0; } /** * \brief Init function to CPF operator * * \param rule ModSecurity rule struct * \param error_msg Error message * * \retval 0 On Failure * \retval 1 On Success */ static int msre_op_verifyCPF_init(msre_rule *rule, char **error_msg) { const char *errptr = NULL; int erroffset; msc_regex_t *regex; if (error_msg == NULL) return -1; *error_msg = NULL; /* Compile rule->op_param */ regex = msc_pregcomp_ex(rule->ruleset->mp, rule->op_param, PCRE_DOTALL | PCRE_MULTILINE, &errptr, &erroffset, msc_pcre_match_limit, msc_pcre_match_limit_recursion); if (regex == NULL) { *error_msg = apr_psprintf(rule->ruleset->mp, "Error compiling pattern (offset %d): %s", erroffset, errptr); return 0; } rule->op_param_data = regex; return 1; /* OK */ } /** * \brief Execution function to CPF operator * * \param msr ModSecurity transaction resource * \param rule ModSecurity rule struct * \param var ModSecurity variable struct * \param error_msg Error message * * \retval -1 On Failure * \retval 1 On Match * \retval 0 On No Match */ static int msre_op_verifyCPF_execute(modsec_rec *msr, msre_rule *rule, msre_var *var, char **error_msg) { msc_regex_t *regex = (msc_regex_t *)rule->op_param_data; const char *target; unsigned int target_length; char *my_error_msg = NULL; int ovector[33]; int rc; int is_cpf = 0; int offset; int matched_bytes = 0; char *qspos = NULL; const char *parm = NULL; msc_parm *mparm = NULL; #ifdef WITH_PCRE_STUDY #ifdef WITH_PCRE_JIT int jit; #endif #endif if (error_msg == NULL) return -1; *error_msg = NULL; if (regex == NULL) { *error_msg = "Internal Error: regex data is null."; return -1; } memset(ovector, 0, sizeof(ovector)); #ifdef WITH_PCRE_STUDY #ifdef WITH_PCRE_JIT if (msr->txcfg->debuglog_level >= 4) { rc = msc_fullinfo(regex, PCRE_INFO_JIT, &jit); if ((rc != 0) || (jit != 1)) { *error_msg = apr_psprintf(rule->ruleset->mp, "Rule %pp [id \"%s\"][file \"%s\"][line \"%d\"] - " "Execution error - " "Does not support JIT (%d)", rule,((rule->actionset != NULL)&&((rule->actionset->id != NULL)&& (rule->actionset->id != NOT_SET_P))) ? rule->actionset->id : "-", rule->filename != NULL ? rule->filename : "-", rule->line_num,rc); msr_log(msr, 4, "%s.", *error_msg); } } #endif #endif /* If the given target is null run against an empty * string. This is a behaviour consistent with previous * releases. */ if (var->value == NULL) { target = ""; target_length = 0; } else { target = var->value; target_length = var->value_len; } for (offset = 0; ((unsigned int)offset < target_length) && (is_cpf == 0); offset++) { if (msr->txcfg->debuglog_level >= 9) { if (offset > 0) { msr_log(msr, 9, "Continuing CPF# search at target offset %d.", offset); } } rc = msc_regexec_ex(regex, target, target_length, offset, PCRE_NOTEMPTY, ovector, 30, &my_error_msg); /* If there was no match, then we are done. */ if (rc == PCRE_ERROR_NOMATCH) { break; } if (rc < -1) { *error_msg = apr_psprintf(msr->mp, "CPF# regex execution failed: %s", my_error_msg); return -1; } /* Verify a match. */ if (rc > 0) { const char *match = target + ovector[0]; int length = ovector[1] - ovector[0]; int i = 0; offset = ovector[2*i]; /* Check CPF using the match string */ is_cpf = cpf_verify(match, length); /* Not a CPF number, then try another match where we left off. */ if (!is_cpf) { if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "CPF# check failed at target offset %d: \"%.*s\"", offset, length, match); } continue; } /* We have a potential CPF number and need to set any captures * and we are done. */ matched_bytes = apr_table_get(rule->actionset->actions, "sanitizeMatchedBytes") ? 1 : 0; if(!matched_bytes) matched_bytes = apr_table_get(rule->actionset->actions, "sanitiseMatchedBytes") ? 1 : 0; if (apr_table_get(rule->actionset->actions, "capture")) { for(; i < rc; i++) { msc_string *s = (msc_string *)apr_pcalloc(msr->mp, sizeof(msc_string)); if (s == NULL) return -1; s->name = apr_psprintf(msr->mp, "%d", i); if (s->name == NULL) return -1; s->name_len = strlen(s->name); s->value = apr_pstrmemdup(msr->mp, match, length); if (s->value == NULL) return -1; s->value_len = length; apr_table_setn(msr->tx_vars, s->name, (void *)s); if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Added regex subexpression to TX.%d: %s", i, log_escape_nq_ex(msr->mp, s->value, s->value_len)); } if((matched_bytes == 1) && (var != NULL) && (var->name != NULL)) { qspos = apr_psprintf(msr->mp, "%s", var->name); parm = strstr(qspos, ":"); if (parm != NULL) { parm++; mparm = apr_palloc(msr->mp, sizeof(msc_parm)); if (mparm == NULL) continue; mparm->value = apr_pstrmemdup(msr->mp,s->value,s->value_len); mparm->pad_1 = rule->actionset->arg_min; mparm->pad_2 = rule->actionset->arg_max; apr_table_addn(msr->pattern_to_sanitize, parm, (void *)mparm); } else { mparm = apr_palloc(msr->mp, sizeof(msc_parm)); if (mparm == NULL) continue; mparm->value = apr_pstrmemdup(msr->mp,s->value,s->value_len); apr_table_addn(msr->pattern_to_sanitize, qspos, (void *)mparm); } } } } /* Unset the remaining TX vars (from previous invocations). */ for(; i <= 9; i++) { char buf[24]; apr_snprintf(buf, sizeof(buf), "%i", i); apr_table_unset(msr->tx_vars, buf); } break; } } if (is_cpf) { /* Match. */ /* This message will be logged. */ *error_msg = apr_psprintf(msr->mp, "CPF# match \"%s\" at %s. [offset \"%d\"]", regex->pattern, var->name, offset); return 1; } /* No match. */ return 0; } /** * \brief Check for a valid SSN * * \param msr ModSecurity transaction source * \param ssnumber Pointer to ssn * \param len ssn length * * \retval 0 On Invalid SSN * \retval 1 On Valid SSN */ static int ssn_verify(modsec_rec *msr, const char *ssnumber, int len) { int i; int num[9]; int digits = 0; int area, serial, grp; int sequencial = 0; int repetitions = 0; char *str_area; char *str_grp; char *str_serial; for (i = 0; i < len; i++) { if (apr_isdigit(ssnumber[i])) { if (digits < 9) num[digits] = convert_to_int(ssnumber[i]); digits++; } } /* Not a valid number */ if (digits != 9) goto invalid; for (i=0; i < 8; i++) { if (num[i] == (num[i+1]-1)) sequencial++; if (num[i] == num[i+1]) repetitions++; } /* We are blocking when all numbers were sequencial or repeated */ if (sequencial == 8) goto invalid; if (repetitions == 8) goto invalid; str_area = apr_psprintf(msr->mp,"%d%d%d",num[0],num[1],num[2]); str_grp = apr_psprintf(msr->mp,"%d%d",num[3],num[4]); str_serial = apr_psprintf(msr->mp,"%d%d%d%d",num[5],num[6],num[7],num[8]); if(str_area == NULL || str_grp == NULL || str_serial == NULL) goto invalid; area = atoi(str_area); grp = atoi(str_grp); serial = atoi(str_serial); /* Cannot has seroed fields */ if (area == 0 || serial == 0 || grp == 0) goto invalid; /* More tests */ if (area >= 740 || area == 666) goto invalid; return 1; invalid: return 0; } /** * \brief Init function to SSN operator * * \param rule ModSecurity rule struct * \param error_msg Error message * * \retval 0 On Failure * \retval 1 On Success */ static int msre_op_verifySSN_init(msre_rule *rule, char **error_msg) { const char *errptr = NULL; int erroffset; msc_regex_t *regex; if (error_msg == NULL) return -1; *error_msg = NULL; /* Compile rule->op_param */ regex = msc_pregcomp_ex(rule->ruleset->mp, rule->op_param, PCRE_DOTALL | PCRE_MULTILINE, &errptr, &erroffset, msc_pcre_match_limit, msc_pcre_match_limit_recursion); if (regex == NULL) { *error_msg = apr_psprintf(rule->ruleset->mp, "Error compiling pattern (offset %d): %s", erroffset, errptr); return 0; } rule->op_param_data = regex; return 1; /* OK */ } /** * \brief Execution function to SSN operator * * \param msr ModSecurity transaction resource * \param rule ModSecurity rule struct * \param var ModSecurity variable struct * \param error_msg Error message * * \retval -1 On Failure * \retval 1 On Match * \retval 0 On No Match */ static int msre_op_verifySSN_execute(modsec_rec *msr, msre_rule *rule, msre_var *var, char **error_msg) { msc_regex_t *regex = (msc_regex_t *)rule->op_param_data; const char *target; unsigned int target_length; char *my_error_msg = NULL; int ovector[33]; int rc; int is_ssn = 0; int offset; int matched_bytes = 0; char *qspos = NULL; const char *parm = NULL; msc_parm *mparm = NULL; #ifdef WITH_PCRE_STUDY #ifdef WITH_PCRE_JIT int jit; #endif #endif if (error_msg == NULL) return -1; *error_msg = NULL; if (regex == NULL) { *error_msg = "Internal Error: regex data is null."; return -1; } memset(ovector, 0, sizeof(ovector)); #ifdef WITH_PCRE_STUDY #ifdef WITH_PCRE_JIT if (msr->txcfg->debuglog_level >= 4) { rc = msc_fullinfo(regex, PCRE_INFO_JIT, &jit); if ((rc != 0) || (jit != 1)) { *error_msg = apr_psprintf(rule->ruleset->mp, "Rule %pp [id \"%s\"][file \"%s\"][line \"%d\"] - " "Execution error - " "Does not support JIT (%d)", rule,((rule->actionset != NULL)&&((rule->actionset->id != NULL)&& (rule->actionset->id != NOT_SET_P))) ? rule->actionset->id : "-", rule->filename != NULL ? rule->filename : "-", rule->line_num,rc); msr_log(msr, 4, "%s.", *error_msg); } } #endif #endif /* If the given target is null run against an empty * string. This is a behaviour consistent with previous * releases. */ if (var->value == NULL) { target = ""; target_length = 0; } else { target = var->value; target_length = var->value_len; } for (offset = 0; ((unsigned int)offset < target_length) && (is_ssn == 0); offset++) { if (msr->txcfg->debuglog_level >= 9) { if (offset > 0) { msr_log(msr, 9, "Continuing SSN# search at target offset %d.", offset); } } rc = msc_regexec_ex(regex, target, target_length, offset, PCRE_NOTEMPTY, ovector, 30, &my_error_msg); /* If there was no match, then we are done. */ if (rc == PCRE_ERROR_NOMATCH) { break; } if (rc < -1) { *error_msg = apr_psprintf(msr->mp, "SSN# regex execution failed: %s", my_error_msg); return -1; } /* Verify a match. */ if (rc > 0) { const char *match = target + ovector[0]; int length = ovector[1] - ovector[0]; int i = 0; offset = ovector[2*i]; /* Check SSN using the match string */ is_ssn = ssn_verify(msr, match, length); /* Not a SSN number, then try another match where we left off. */ if (!is_ssn) { if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "SSN# check failed at target offset %d: \"%.*s\"", offset, length, match); } continue; } /* We have a potential SSN number and need to set any captures * and we are done. */ matched_bytes = apr_table_get(rule->actionset->actions, "sanitizeMatchedBytes") ? 1 : 0; if(!matched_bytes) matched_bytes = apr_table_get(rule->actionset->actions, "sanitiseMatchedBytes") ? 1 : 0; if (apr_table_get(rule->actionset->actions, "capture")) { for(; i < rc; i++) { msc_string *s = (msc_string *)apr_pcalloc(msr->mp, sizeof(msc_string)); if (s == NULL) return -1; s->name = apr_psprintf(msr->mp, "%d", i); if (s->name == NULL) return -1; s->name_len = strlen(s->name); s->value = apr_pstrmemdup(msr->mp, match, length); if (s->value == NULL) return -1; s->value_len = length; apr_table_setn(msr->tx_vars, s->name, (void *)s); if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Added regex subexpression to TX.%d: %s", i, log_escape_nq_ex(msr->mp, s->value, s->value_len)); } if((matched_bytes == 1) && (var != NULL) && (var->name != NULL)) { qspos = apr_psprintf(msr->mp, "%s", var->name); parm = strstr(qspos, ":"); if (parm != NULL) { parm++; mparm = apr_palloc(msr->mp, sizeof(msc_parm)); if (mparm == NULL) continue; mparm->value = apr_pstrmemdup(msr->mp,s->value,s->value_len); mparm->pad_1 = rule->actionset->arg_min; mparm->pad_2 = rule->actionset->arg_max; apr_table_addn(msr->pattern_to_sanitize, parm, (void *)mparm); } else { mparm = apr_palloc(msr->mp, sizeof(msc_parm)); if (mparm == NULL) continue; mparm->value = apr_pstrmemdup(msr->mp,s->value,s->value_len); apr_table_addn(msr->pattern_to_sanitize, qspos, (void *)mparm); } } } } /* Unset the remaining TX vars (from previous invocations). */ for(; i <= 9; i++) { char buf[24]; apr_snprintf(buf, sizeof(buf), "%i", i); apr_table_unset(msr->tx_vars, buf); } break; } } if (is_ssn) { /* Match. */ /* This message will be logged. */ *error_msg = apr_psprintf(msr->mp, "SSN# match \"%s\" at %s. [offset \"%d\"]", regex->pattern, var->name, offset); return 1; } /* No match. */ return 0; } /** * Perform geograpical lookups on an IP/Host. */ static int msre_op_geoLookup_execute(modsec_rec *msr, msre_rule *rule, msre_var *var, char **error_msg) { geo_rec rec; geo_db *geo = msr->txcfg->geo; const char *geo_host = var->value; msc_string *s = NULL; int rc; *error_msg = NULL; if (geo == NULL) { msr_log(msr, 1, "Geo lookup for \"%s\" attempted without a database. Set SecGeoLookupDB.", log_escape(msr->mp, geo_host)); return 0; } rc = geo_lookup(msr, &rec, geo_host, error_msg); if (rc <= 0) { if (! *error_msg) { *error_msg = apr_psprintf(msr->mp, "Geo lookup for \"%s\" failed at %s.", log_escape_nq(msr->mp, geo_host), var->name); } apr_table_clear(msr->geo_vars); return rc; } if (! *error_msg) { *error_msg = apr_psprintf(msr->mp, "Geo lookup for \"%s\" succeeded at %s.", log_escape_nq(msr->mp, geo_host), var->name); } if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "GEO: %s={country_code=%s, country_code3=%s, country_name=%s, country_continent=%s, region=%s, city=%s, postal_code=%s, latitude=%f, longitude=%f, dma_code=%d, area_code=%d}", geo_host, rec.country_code, rec.country_code3, rec.country_name, rec.country_continent, rec.region, rec.city, rec.postal_code, rec.latitude, rec.longitude, rec.dma_code, rec.area_code); } s = (msc_string *)apr_pcalloc(msr->mp, sizeof(msc_string)); s->name = apr_pstrdup(msr->mp, "COUNTRY_CODE"); s->name_len = strlen(s->name); s->value = apr_pstrdup(msr->mp, rec.country_code ? rec.country_code : ""); s->value_len = strlen(s->value); apr_table_setn(msr->geo_vars, s->name, (void *)s); s = (msc_string *)apr_pcalloc(msr->mp, sizeof(msc_string)); s->name = apr_pstrdup(msr->mp, "COUNTRY_CODE3"); s->name_len = strlen(s->name); s->value = apr_pstrdup(msr->mp, rec.country_code3 ? rec.country_code3 : ""); s->value_len = strlen(s->value); apr_table_setn(msr->geo_vars, s->name, (void *)s); s = (msc_string *)apr_pcalloc(msr->mp, sizeof(msc_string)); s->name = apr_pstrdup(msr->mp, "COUNTRY_NAME"); s->name_len = strlen(s->name); s->value = apr_pstrdup(msr->mp, rec.country_name ? rec.country_name : ""); s->value_len = strlen(s->value); apr_table_setn(msr->geo_vars, s->name, (void *)s); s = (msc_string *)apr_pcalloc(msr->mp, sizeof(msc_string)); s->name = apr_pstrdup(msr->mp, "COUNTRY_CONTINENT"); s->name_len = strlen(s->name); s->value = apr_pstrdup(msr->mp, rec.country_continent ? rec.country_continent : ""); s->value_len = strlen(s->value); apr_table_setn(msr->geo_vars, s->name, (void *)s); s = (msc_string *)apr_pcalloc(msr->mp, sizeof(msc_string)); s->name = apr_pstrdup(msr->mp, "REGION"); s->name_len = strlen(s->name); s->value = apr_pstrdup(msr->mp, rec.region ? rec.region : ""); s->value_len = strlen(s->value); apr_table_setn(msr->geo_vars, s->name, (void *)s); s = (msc_string *)apr_pcalloc(msr->mp, sizeof(msc_string)); s->name = apr_pstrdup(msr->mp, "CITY"); s->name_len = strlen(s->name); s->value = apr_pstrdup(msr->mp, rec.city ? rec.city : ""); s->value_len = strlen(s->value); apr_table_setn(msr->geo_vars, s->name, (void *)s); s = (msc_string *)apr_pcalloc(msr->mp, sizeof(msc_string)); s->name = apr_pstrdup(msr->mp, "POSTAL_CODE"); s->name_len = strlen(s->name); s->value = apr_pstrdup(msr->mp, rec.postal_code ? rec.postal_code : ""); s->value_len = strlen(s->value); apr_table_setn(msr->geo_vars, s->name, (void *)s); s = (msc_string *)apr_pcalloc(msr->mp, sizeof(msc_string)); s->name = apr_pstrdup(msr->mp, "LATITUDE"); s->name_len = strlen(s->name); s->value = apr_psprintf(msr->mp, "%f", rec.latitude); s->value_len = strlen(s->value); apr_table_setn(msr->geo_vars, s->name, (void *)s); s = (msc_string *)apr_pcalloc(msr->mp, sizeof(msc_string)); s->name = apr_pstrdup(msr->mp, "LONGITUDE"); s->name_len = strlen(s->name); s->value = apr_psprintf(msr->mp, "%f", rec.longitude); s->value_len = strlen(s->value); apr_table_setn(msr->geo_vars, s->name, (void *)s); s = (msc_string *)apr_pcalloc(msr->mp, sizeof(msc_string)); s->name = apr_pstrdup(msr->mp, "DMA_CODE"); s->name_len = strlen(s->name); s->value = apr_psprintf(msr->mp, "%d", rec.dma_code); s->value_len = strlen(s->value); apr_table_setn(msr->geo_vars, s->name, (void *)s); s = (msc_string *)apr_pcalloc(msr->mp, sizeof(msc_string)); s->name = apr_pstrdup(msr->mp, "AREA_CODE"); s->name_len = strlen(s->name); s->value = apr_psprintf(msr->mp, "%d", rec.area_code); s->value_len = strlen(s->value); apr_table_setn(msr->geo_vars, s->name, (void *)s); return 1; } /* rbl */ static int msre_op_rbl_execute(modsec_rec *msr, msre_rule *rule, msre_var *var, char **error_msg) { unsigned int h0, h1, h2, h3; unsigned int high8bits = 0; char *name_to_check = NULL; char *target = NULL; apr_sockaddr_t *sa = NULL; apr_status_t rc; int capture = 0; if (error_msg == NULL) return -1; *error_msg = NULL; capture = apr_table_get(rule->actionset->actions, "capture") ? 1 : 0; /* ENH Add IPv6 support. */ target = apr_pstrmemdup(msr->mp, var->value, var->value_len); if (target == NULL) return -1; /* Construct the host name we want to resolve. */ if (sscanf(target, "%d.%d.%d.%d", &h0, &h1, &h2, &h3) == 4) { /* IPv4 address */ /* If we're using the httpBl blocklist, we need to add the key */ if(strstr(rule->op_param,"httpbl.org")) { if (msr->txcfg->httpBlkey == NULL) { if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "RBL httpBl called but no key defined: set SecHttpBlKey"); } *error_msg = "RBL httpBl called but no key defined: set SecHttpBlKey"; } else { name_to_check = apr_psprintf(msr->mp, "%s.%d.%d.%d.%d.%s", msr->txcfg->httpBlkey, h3, h2, h1, h0, rule->op_param); } } else { /* regular IPv4 RBLs */ name_to_check = apr_psprintf(msr->mp, "%d.%d.%d.%d.%s", h3, h2, h1, h0, rule->op_param); } } else { /* Assume the input is a domain name. */ name_to_check = apr_psprintf(msr->mp, "%s.%s", target, rule->op_param); } if (name_to_check == NULL) return -1; rc = apr_sockaddr_info_get(&sa, name_to_check, APR_UNSPEC/*msr->r->connection->remote_addr->family*/, 0, 0, msr->mp); if (rc == APR_SUCCESS) { high8bits = sa->sa.sin.sin_addr.s_addr >> 24; /* multi.uribl.com */ if(strstr(rule->op_param,"uribl.com")) { switch(high8bits) { case 2: *error_msg = apr_psprintf(msr->r->pool, "RBL lookup of %s succeeded at %s (BLACK).", log_escape_nq(msr->mp, name_to_check), var->name); break; case 4: *error_msg = apr_psprintf(msr->r->pool, "RBL lookup of %s succeeded at %s (GREY).", log_escape_nq(msr->mp, name_to_check), var->name); break; case 8: *error_msg = apr_psprintf(msr->r->pool, "RBL lookup of %s succeeded at %s (RED).", log_escape_nq(msr->mp, name_to_check), var->name); break; case 14: *error_msg = apr_psprintf(msr->r->pool, "RBL lookup of %s succeeded at %s (BLACK,GREY,RED).", log_escape_nq(msr->mp, name_to_check), var->name); break; case 255: *error_msg = apr_psprintf(msr->r->pool, "RBL lookup of %s succeeded at %s (DNS IS BLOCKED).", log_escape_nq(msr->mp, name_to_check), var->name); break; default: *error_msg = apr_psprintf(msr->r->pool, "RBL lookup of %s succeeded at %s (WHITE).", log_escape_nq(msr->mp, name_to_check), var->name); break; } set_match_to_tx(msr, capture, *error_msg, 0); } else if(strstr(rule->op_param,"spamhaus.org")) { switch(high8bits) { case 2: case 3: *error_msg = apr_psprintf(msr->r->pool, "RBL lookup of %s succeeded at %s (Static UBE sources).", log_escape_nq(msr->mp, name_to_check), var->name); break; case 4: case 5: case 6: case 7: *error_msg = apr_psprintf(msr->r->pool, "RBL lookup of %s succeeded at %s (Illegal 3rd party exploits).", log_escape_nq(msr->mp, name_to_check), var->name); break; case 10: case 11: *error_msg = apr_psprintf(msr->r->pool, "RBL lookup of %s succeeded at %s (Delivering unauthenticated SMTP email).", log_escape_nq(msr->mp, name_to_check), var->name); break; default: *error_msg = apr_psprintf(msr->r->pool, "RBL lookup of %s succeeded at %s.", log_escape_nq(msr->mp, name_to_check), var->name); break; } set_match_to_tx(msr, capture, *error_msg, 0); } else if(strstr(rule->op_param,"httpbl.org")) { char *respBl; int first, days, score, type; respBl = inet_ntoa(sa->sa.sin.sin_addr); if (sscanf(respBl, "%d.%d.%d.%d", &first, &days, &score, &type) != 4) { *error_msg = apr_psprintf(msr->r->pool, "RBL lookup of %s failed: bad response", log_escape_nq(msr->mp, name_to_check)); } else { if (first != 127) { *error_msg = apr_psprintf(msr->r->pool, "RBL lookup of %s failed: bad response", log_escape_nq(msr->mp, name_to_check)); } else { char *ptype; switch(type) { case 0: ptype = "Search Engine"; break; case 1: ptype = "Suspicious IP"; break; case 2: ptype = "Harvester IP"; break; case 3: ptype = "Suspicious harvester IP"; break; case 4: ptype = "Comment spammer IP"; break; case 5: ptype = "Suspicious comment spammer IP"; break; case 6: ptype = "Harvester and comment spammer IP"; break; case 7: ptype = "Suspicious harvester comment spammer IP"; break; default: ptype = " "; } *error_msg = apr_psprintf(msr->r->pool, "RBL lookup of %s succeeded at %s. %s: %d days since last activity, threat score %d", log_escape_nq(msr->mp, name_to_check), var->name, ptype, days, score); } } set_match_to_tx(msr, capture, *error_msg, 0); /* end of httpBl code */ } else { *error_msg = apr_psprintf(msr->r->pool, "RBL lookup of %s succeeded at %s.", log_escape_nq(msr->mp, name_to_check), var->name); set_match_to_tx(msr, capture, *error_msg, 0); } return 1; /* Match. */ } if (msr->txcfg->debuglog_level >= 5) { msr_log(msr, 5, "RBL lookup of %s failed at %s.", log_escape_nq(msr->mp, name_to_check), var->name); } /* No match. */ return 0; } /* inspectFile */ static int msre_op_inspectFile_init(msre_rule *rule, char **error_msg) { char *filename = (char *)rule->op_param; if (error_msg == NULL) return -1; *error_msg = NULL; if ((filename == NULL)||(is_empty_string(filename))) { *error_msg = apr_psprintf(rule->ruleset->mp, "Operator @inspectFile requires parameter."); return -1; } filename = resolve_relative_path(rule->ruleset->mp, rule->filename, filename); #if defined(WITH_LUA) /* ENH Write & use string_ends(s, e). */ if (strlen(rule->op_param) > 4) { char *p = filename + strlen(filename) - 4; if ((p[0] == '.')&&(p[1] == 'l')&&(p[2] == 'u')&&(p[3] == 'a')) { msc_script *script = NULL; /* Compile script. */ *error_msg = lua_compile(&script, filename, rule->ruleset->mp); if (*error_msg != NULL) return -1; rule->op_param_data = script; } } #endif if (rule->op_param_data == NULL) { /* ENH Verify the script exists and that we have * the rights to execute it. */ } return 1; } static int msre_op_inspectFile_execute(modsec_rec *msr, msre_rule *rule, msre_var *var, char **error_msg) { if (error_msg == NULL) return -1; *error_msg = NULL; if (rule->op_param_data == NULL) { /* Execute externally, as native binary/shell script. */ char *script_output = NULL; char const *argv[5]; const char *approver_script = rule->op_param; const char *target_file = apr_pstrmemdup(msr->mp, var->value, var->value_len); if (msr->txcfg->debuglog_level >= 4) { msr_log(msr, 4, "Executing %s to inspect %s.", approver_script, target_file); } argv[0] = approver_script; argv[1] = target_file; argv[2] = NULL; if (apache2_exec(msr, approver_script, (const char **)argv, &script_output) <= 0) { *error_msg = apr_psprintf(msr->mp, "Execution of the approver script \"%s\" failed (invocation failed).", log_escape(msr->mp, approver_script)); return -1; } if (script_output == NULL) { *error_msg = apr_psprintf(msr->mp, "Execution of the approver script \"%s\" failed (no output).", log_escape(msr->mp, approver_script)); return -1; } if (script_output[0] != '1') { *error_msg = apr_psprintf(msr->mp, "File \"%s\" rejected by the approver script \"%s\": %s", log_escape(msr->mp, target_file), log_escape(msr->mp, approver_script), log_escape_nq(msr->mp, script_output)); return 1; /* Match. */ } } #if defined(WITH_LUA) else { /* Execute internally, as Lua script. */ char *target = apr_pstrmemdup(msr->mp, var->value, var->value_len); msc_script *script = (msc_script *)rule->op_param_data; int rc; rc = lua_execute(script, target, msr, rule, error_msg); if (rc < 0) { /* Error. */ return -1; } return rc; } #endif /* No match. */ return 0; } /* validateByteRange */ static int msre_op_validateByteRange_init(msre_rule *rule, char **error_msg) { char *p = NULL, *saveptr = NULL; char *table = NULL, *data = NULL; if (error_msg == NULL) return -1; *error_msg = NULL; if (rule->op_param == NULL) { *error_msg = apr_psprintf(rule->ruleset->mp, "Missing parameter for validateByteRange."); return -1; } /* Initialise. */ data = apr_pstrdup(rule->ruleset->mp, rule->op_param); rule->op_param_data = apr_pcalloc(rule->ruleset->mp, 32); if ((data == NULL)||(rule->op_param_data == NULL)) return -1; table = rule->op_param_data; /* Extract parameters and update table. */ p = apr_strtok(data, ",", &saveptr); while(p != NULL) { char *s = strstr(p, "-"); if (s == NULL) { /* Single value. */ int x = atoi(p); if ((x < 0)||(x > 255)) { *error_msg = apr_psprintf(rule->ruleset->mp, "Invalid range value: %d", x); return 0; } table[x>>3] = (table[x>>3] | (1 << (x & 0x7))); } else { /* Range. */ int start = atoi(p); int end = atoi(s + 1); if ((start < 0)||(start > 255)) { *error_msg = apr_psprintf(rule->ruleset->mp, "Invalid range start value: %d", start); return 0; } if ((end < 0)||(end > 255)) { *error_msg = apr_psprintf(rule->ruleset->mp, "Invalid range end value: %d", end); return 0; } if (start > end) { *error_msg = apr_psprintf(rule->ruleset->mp, "Invalid range: %d-%d", start, end); return 0; } while(start <= end) { table[start >> 3] = (table[start >> 3] | (1 << (start & 0x7))); start++; } } p = apr_strtok(NULL, ",", &saveptr); } return 1; } static int msre_op_validateByteRange_execute(modsec_rec *msr, msre_rule *rule, msre_var *var, char **error_msg) { char *table = rule->op_param_data; unsigned int i, count; if (error_msg == NULL) return -1; *error_msg = NULL; if (table == NULL) { *error_msg = apr_psprintf(msr->mp, "Internal Error: validateByteRange table not " "initialised."); return -1; } /* Check every byte of the target to detect characters that are not allowed. */ count = 0; for(i = 0; i < var->value_len; i++) { int x = ((unsigned char *)var->value)[i]; if (!(table[x >> 3] & (1 << (x & 0x7)))) { if (msr->txcfg->debuglog_level >= 9) { msr_log(msr, 9, "Value %d in %s outside range: %s", x, var->name, rule->op_param); } count++; } } if (count == 0) return 0; /* Valid - no match. */ *error_msg = apr_psprintf(msr->mp, "Found %d byte(s) in %s outside range: %s.", count, var->name, rule->op_param); return 1; /* Invalid - match.*/ } /* validateUrlEncoding */ static int validate_url_encoding(const char *input, long int input_length) { int i; if ((input == NULL)||(input_length < 0)) return -1; i = 0; while (i < input_length) { if (input[i] == '%') { if (i + 2 >= input_length) { /* Not enough bytes. */ return -3; } else { /* Here we only decode a %xx combination if it is valid, * leaving it as is otherwise. */ char c1 = input[i + 1]; char c2 = input[i + 2]; if ( (((c1 >= '0')&&(c1 <= '9')) || ((c1 >= 'a')&&(c1 <= 'f')) || ((c1 >= 'A')&&(c1 <= 'F'))) && (((c2 >= '0')&&(c2 <= '9')) || ((c2 >= 'a')&&(c2 <= 'f')) || ((c2 >= 'A')&&(c2 <= 'F'))) ) { i += 3; } else { /* Non-hexadecimal characters used in encoding. */ return -2; } } } else { i++; } } return 1; } static int msre_op_validateUrlEncoding_execute(modsec_rec *msr, msre_rule *rule, msre_var *var, char **error_msg) { int rc = validate_url_encoding(var->value, var->value_len); switch(rc) { case 1 : /* Encoding is valid */ *error_msg = apr_psprintf(msr->mp, "Valid URL Encoding at %s.", var->name); break; case -2 : *error_msg = apr_psprintf(msr->mp, "Invalid URL Encoding: Non-hexadecimal " "digits used at %s.", var->name); return 1; /* Invalid match. */ break; case -3 : *error_msg = apr_psprintf(msr->mp, "Invalid URL Encoding: Not enough characters " "at the end of input at %s.", var->name); return 1; /* Invalid match. */ break; case -1 : default : *error_msg = apr_psprintf(msr->mp, "Invalid URL Encoding: Internal Error (rc = %d) at %s", rc, var->name); return -1; break; } /* No match. */ return 0; } /* validateUtf8Encoding */ /* NOTE: This is over-commented for ease of verification */ static int detect_utf8_character(const unsigned char *p_read, unsigned int length) { int unicode_len = 0; unsigned int d = 0; unsigned char c; if (p_read == NULL) return UNICODE_ERROR_DECODING_ERROR; c = *p_read; /* If first byte begins with binary 0 it is single byte encoding */ if ((c & 0x80) == 0) { /* single byte unicode (7 bit ASCII equivilent) has no validation */ return 1; } /* If first byte begins with binary 110 it is two byte encoding*/ else if ((c & 0xE0) == 0xC0) { /* check we have at least two bytes */ if (length < 2) unicode_len = UNICODE_ERROR_CHARACTERS_MISSING; /* check second byte starts with binary 10 */ else if (((*(p_read + 1)) & 0xC0) != 0x80) unicode_len = UNICODE_ERROR_INVALID_ENCODING; else { unicode_len = 2; /* compute character number */ d = ((c & 0x1F) << 6) | (*(p_read + 1) & 0x3F); } } /* If first byte begins with binary 1110 it is three byte encoding */ else if ((c & 0xF0) == 0xE0) { /* check we have at least three bytes */ if (length < 3) unicode_len = UNICODE_ERROR_CHARACTERS_MISSING; /* check second byte starts with binary 10 */ else if (((*(p_read + 1)) & 0xC0) != 0x80) unicode_len = UNICODE_ERROR_INVALID_ENCODING; /* check third byte starts with binary 10 */ else if (((*(p_read + 2)) & 0xC0) != 0x80) unicode_len = UNICODE_ERROR_INVALID_ENCODING; else { unicode_len = 3; /* compute character number */ d = ((c & 0x0F) << 12) | ((*(p_read + 1) & 0x3F) << 6) | (*(p_read + 2) & 0x3F); } } /* If first byte begins with binary 11110 it is four byte encoding */ else if ((c & 0xF8) == 0xF0) { /* restrict characters to UTF-8 range (U+0000 - U+10FFFF)*/ if (c >= 0xF5) { return UNICODE_ERROR_RESTRICTED_CHARACTER; } /* check we have at least four bytes */ if (length < 4) unicode_len = UNICODE_ERROR_CHARACTERS_MISSING; /* check second byte starts with binary 10 */ else if (((*(p_read + 1)) & 0xC0) != 0x80) unicode_len = UNICODE_ERROR_INVALID_ENCODING; /* check third byte starts with binary 10 */ else if (((*(p_read + 2)) & 0xC0) != 0x80) unicode_len = UNICODE_ERROR_INVALID_ENCODING; /* check forth byte starts with binary 10 */ else if (((*(p_read + 3)) & 0xC0) != 0x80) unicode_len = UNICODE_ERROR_INVALID_ENCODING; else { unicode_len = 4; /* compute character number */ d = ((c & 0x07) << 18) | ((*(p_read + 1) & 0x3F) << 12) | ((*(p_read + 2) & 0x3F) < 6) | (*(p_read + 3) & 0x3F); } } /* any other first byte is invalid (RFC 3629) */ else { return UNICODE_ERROR_INVALID_ENCODING; } /* invalid UTF-8 character number range (RFC 3629) */ if ((d >= 0xD800) && (d <= 0xDFFF)) { return UNICODE_ERROR_RESTRICTED_CHARACTER; } /* check for overlong */ if ((unicode_len == 4) && (d < 0x010000)) { /* four byte could be represented with less bytes */ return UNICODE_ERROR_OVERLONG_CHARACTER; } else if ((unicode_len == 3) && (d < 0x0800)) { /* three byte could be represented with less bytes */ return UNICODE_ERROR_OVERLONG_CHARACTER; } else if ((unicode_len == 2) && (d < 0x80)) { /* two byte could be represented with less bytes */ return UNICODE_ERROR_OVERLONG_CHARACTER; } return unicode_len; } static int msre_op_validateUtf8Encoding_execute(modsec_rec *msr, msre_rule *rule, msre_var *var, char **error_msg) { unsigned int i, bytes_left; bytes_left = var->value_len; for(i = 0; i < var->value_len;) { int rc = detect_utf8_character((unsigned char *)&var->value[i], bytes_left); switch(rc) { case UNICODE_ERROR_CHARACTERS_MISSING : *error_msg = apr_psprintf(msr->mp, "Invalid UTF-8 encoding: " "not enough bytes in character " "at %s. [offset \"%d\"]", var->name, i); return 1; break; case UNICODE_ERROR_INVALID_ENCODING : *error_msg = apr_psprintf(msr->mp, "Invalid UTF-8 encoding: " "invalid byte value in character " "at %s. [offset \"%d\"]", var->name, i); return 1; break; case UNICODE_ERROR_OVERLONG_CHARACTER : *error_msg = apr_psprintf(msr->mp, "Invalid UTF-8 encoding: " "overlong character detected " "at %s. [offset \"%d\"]", var->name, i); return 1; break; case UNICODE_ERROR_RESTRICTED_CHARACTER : *error_msg = apr_psprintf(msr->mp, "Invalid UTF-8 encoding: " "use of restricted character " "at %s. [offset \"%d\"]", var->name, i); return 1; break; case UNICODE_ERROR_DECODING_ERROR : *error_msg = apr_psprintf(msr->mp, "Error validating UTF-8 decoding " "at %s. [offset \"%d\"]", var->name, i); return 1; break; } if (rc <= 0) { *error_msg = apr_psprintf(msr->mp, "Internal error during UTF-8 validation " "at %s.", var->name); return 1; } i += rc; bytes_left -= rc; } return 0; } /* eq */ static int msre_op_eq_execute(modsec_rec *msr, msre_rule *rule, msre_var *var, char **error_msg) { msc_string str; int left, right; char *target = NULL; if (error_msg == NULL) return -1; *error_msg = NULL; if ((var->value == NULL)||(rule->op_param == NULL)) { /* NULL values do not match anything. */ return 0; } str.value = (char *)rule->op_param; str.value_len = strlen(str.value); expand_macros(msr, &str, rule, msr->mp); target = apr_pstrmemdup(msr->mp, var->value, var->value_len); if (target == NULL) return -1; left = atoi(target); right = atoi(str.value); if (left != right) { /* No match. */ return 0; } else { *error_msg = apr_psprintf(msr->mp, "Operator EQ matched %d at %s.", right, var->name); /* Match. */ return 1; } } /* gt */ static int msre_op_gt_execute(modsec_rec *msr, msre_rule *rule, msre_var *var, char **error_msg) { msc_string str; int left, right; char *target = NULL; if ((var->value == NULL)||(rule->op_param == NULL)) { /* NULL values do not match anything. */ return 0; } if (error_msg == NULL) return -1; *error_msg = NULL; if ((var->value == NULL)||(rule->op_param == NULL)) { /* NULL values do not match anything. */ return 0; } str.value = (char *)rule->op_param; str.value_len = strlen(str.value); expand_macros(msr, &str, rule, msr->mp); target = apr_pstrmemdup(msr->mp, var->value, var->value_len); if (target == NULL) return -1; left = atoi(target); right = atoi(str.value); if (left <= right) { /* No match. */ return 0; } else { *error_msg = apr_psprintf(msr->mp, "Operator GT matched %d at %s.", right, var->name); /* Match. */ return 1; } } /* lt */ static int msre_op_lt_execute(modsec_rec *msr, msre_rule *rule, msre_var *var, char **error_msg) { msc_string str; int left, right; char *target = NULL; if ((var->value == NULL)||(rule->op_param == NULL)) { /* NULL values do not match anything. */ return 0; } if (error_msg == NULL) return -1; *error_msg = NULL; if ((var->value == NULL)||(rule->op_param == NULL)) { /* NULL values do not match anything. */ return 0; } str.value = (char *)rule->op_param; str.value_len = strlen(str.value); expand_macros(msr, &str, rule, msr->mp); target = apr_pstrmemdup(msr->mp, var->value, var->value_len); if (target == NULL) return -1; left = atoi(target); right = atoi(str.value); if (left >= right) { /* No match. */ return 0; } else { *error_msg = apr_psprintf(msr->mp, "Operator LT matched %d at %s.", right, var->name); /* Match. */ return 1; } } /* ge */ static int msre_op_ge_execute(modsec_rec *msr, msre_rule *rule, msre_var *var, char **error_msg) { msc_string str; int left, right; char *target = NULL; if ((var->value == NULL)||(rule->op_param == NULL)) { /* NULL values do not match anything. */ return 0; } if (error_msg == NULL) return -1; *error_msg = NULL; if ((var->value == NULL)||(rule->op_param == NULL)) { /* NULL values do not match anything. */ return 0; } str.value = (char *)rule->op_param; str.value_len = strlen(str.value); expand_macros(msr, &str, rule, msr->mp); target = apr_pstrmemdup(msr->mp, var->value, var->value_len); if (target == NULL) return -1; left = atoi(target); right = atoi(str.value); if (left < right) { /* No match. */ return 0; } else { *error_msg = apr_psprintf(msr->mp, "Operator GE matched %d at %s.", right, var->name); /* Match. */ return 1; } } /* le */ static int msre_op_le_execute(modsec_rec *msr, msre_rule *rule, msre_var *var, char **error_msg) { msc_string str; int left, right; char *target = NULL; if ((var->value == NULL)||(rule->op_param == NULL)) { /* NULL values do not match anything. */ return 0; } if (error_msg == NULL) return -1; *error_msg = NULL; if ((var->value == NULL)||(rule->op_param == NULL)) { /* NULL values do not match anything. */ return 0; } str.value = (char *)rule->op_param; str.value_len = strlen(str.value); expand_macros(msr, &str, rule, msr->mp); target = apr_pstrmemdup(msr->mp, var->value, var->value_len); if (target == NULL) return -1; left = atoi(target); right = atoi(str.value); if (left > right) { /* No match. */ return 0; } else { *error_msg = apr_psprintf(msr->mp, "Operator LE matched %d at %s.", right, var->name); /* Match. */ return 1; } } /* -------------------------------------------------------------------------- */ /** * */ void msre_engine_register_default_operators(msre_engine *engine) { /* unconditionalMatch */ msre_engine_op_register(engine, "unconditionalMatch", NULL, msre_op_unconditionalmatch_execute ); /* noMatch */ msre_engine_op_register(engine, "noMatch", NULL, msre_op_nomatch_execute ); /* ipmatch */ msre_engine_op_register(engine, "ipmatch", msre_op_ipmatch_param_init, msre_op_ipmatch_execute ); /* ipmatchFromFile */ msre_engine_op_register(engine, "ipmatchFromFile", msre_op_ipmatchFromFile_param_init, msre_op_ipmatchFromFile_execute ); /* ipmatchf */ msre_engine_op_register(engine, "ipmatchf", msre_op_ipmatchFromFile_param_init, msre_op_ipmatchFromFile_execute ); /* rsub */ #if !defined(MSC_TEST) msre_engine_op_register(engine, "rsub", msre_op_rsub_param_init, msre_op_rsub_execute ); #endif /* MSC_TEST */ /* rx */ msre_engine_op_register(engine, "rx", msre_op_rx_param_init, msre_op_rx_execute ); /* validateEncyption */ msre_engine_op_register(engine, "validateHash", msre_op_validateHash_param_init, msre_op_validateHash_execute ); /* pm */ msre_engine_op_register(engine, "pm", msre_op_pm_param_init, msre_op_pm_execute ); /* pmFromFile */ msre_engine_op_register(engine, "pmFromFile", msre_op_pmFromFile_param_init, msre_op_pm_execute ); /* pmf */ msre_engine_op_register(engine, "pmf", msre_op_pmFromFile_param_init, msre_op_pm_execute ); /* within */ msre_engine_op_register(engine, "within", NULL, /* ENH init function to flag var substitution */ msre_op_within_execute ); /* contains */ msre_engine_op_register(engine, "contains", NULL, /* ENH init function to flag var substitution */ msre_op_contains_execute ); /* containsWord */ msre_engine_op_register(engine, "containsWord", NULL, /* ENH init function to flag var substitution */ msre_op_containsWord_execute ); /* detectSQLi */ msre_engine_op_register(engine, "detectSQLi", NULL, msre_op_detectSQLi_execute ); /* streq */ msre_engine_op_register(engine, "streq", NULL, /* ENH init function to flag var substitution */ msre_op_streq_execute ); /* beginsWith */ msre_engine_op_register(engine, "beginsWith", NULL, /* ENH init function to flag var substitution */ msre_op_beginsWith_execute ); /* endsWith */ msre_engine_op_register(engine, "endsWith", NULL, /* ENH init function to flag var substitution */ msre_op_endsWith_execute ); /* strmatch */ msre_engine_op_register(engine, "strmatch", msre_op_strmatch_param_init, msre_op_strmatch_execute ); /* validateDTD */ msre_engine_op_register(engine, "validateDTD", msre_op_validateDTD_init, msre_op_validateDTD_execute ); /* validateSchema */ msre_engine_op_register(engine, "validateSchema", msre_op_validateSchema_init, msre_op_validateSchema_execute ); /* verifyCC */ msre_engine_op_register(engine, "verifyCC", msre_op_verifyCC_init, msre_op_verifyCC_execute ); /* verifyCPF */ msre_engine_op_register(engine, "verifyCPF", msre_op_verifyCPF_init, msre_op_verifyCPF_execute ); /* verifySSN */ msre_engine_op_register(engine, "verifySSN", msre_op_verifySSN_init, msre_op_verifySSN_execute ); /* geoLookup */ msre_engine_op_register(engine, "geoLookup", NULL, msre_op_geoLookup_execute ); /* gsbLookup */ msre_engine_op_register(engine, "gsbLookup", msre_op_gsbLookup_param_init, msre_op_gsbLookup_execute ); /* rbl */ msre_engine_op_register(engine, "rbl", NULL, /* ENH init function to validate DNS server */ msre_op_rbl_execute ); /* inspectFile */ msre_engine_op_register(engine, "inspectFile", msre_op_inspectFile_init, msre_op_inspectFile_execute ); /* validateByteRange */ msre_engine_op_register(engine, "validateByteRange", msre_op_validateByteRange_init, msre_op_validateByteRange_execute ); /* validateUrlEncoding */ msre_engine_op_register(engine, "validateUrlEncoding", NULL, msre_op_validateUrlEncoding_execute ); /* validateUtf8Encoding */ msre_engine_op_register(engine, "validateUtf8Encoding", NULL, msre_op_validateUtf8Encoding_execute ); /* eq */ msre_engine_op_register(engine, "eq", NULL, msre_op_eq_execute ); /* gt */ msre_engine_op_register(engine, "gt", NULL, msre_op_gt_execute ); /* lt */ msre_engine_op_register(engine, "lt", NULL, msre_op_lt_execute ); /* le */ msre_engine_op_register(engine, "le", NULL, msre_op_le_execute ); /* ge */ msre_engine_op_register(engine, "ge", NULL, msre_op_ge_execute ); } modsecurity-apache_2.7.7/apache2/mod_security2_config.hw0000664000175000017500000000007012243422537023614 0ustar zimmerlezimmerle/* This file is left empty for building on Windows. */ modsecurity-apache_2.7.7/apache2/apache2.h0000664000175000017500000000645612243422537020631 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #ifndef _APACHE2_H_ #define _APACHE2_H_ #include "http_core.h" #include "http_request.h" #include "httpd.h" #include "ap_release.h" #include #include #if (!defined(NO_MODSEC_API)) /* Optional functions. */ APR_DECLARE_OPTIONAL_FN(void, modsec_register_tfn, (const char *name, void *fn)); APR_DECLARE_OPTIONAL_FN(void, modsec_register_operator, (const char *name, void *fn_init, void *fn_exec)); APR_DECLARE_OPTIONAL_FN(void, modsec_register_variable, (const char *name, unsigned int type, unsigned int argc_min, unsigned int argc_max, void *fn_validate, void *fn_generate, unsigned int is_cacheable, unsigned int availability)); APR_DECLARE_OPTIONAL_FN(void, modsec_register_reqbody_processor, (const char *name, void *fn_init, void *fn_process, void *fn_complete)); #endif /* ap_get_server_version() is gone in 2.3.0. * It was replaced by two calls in 2.2.4 and higher: * ap_get_server_banner() * ap_get_server_description() */ #if (AP_SERVER_MAJORVERSION_NUMBER > 2) \ || ((AP_SERVER_MAJORVERSION_NUMBER == 2)&& (AP_SERVER_MINORVERSION_NUMBER > 2)) \ || ((AP_SERVER_MAJORVERSION_NUMBER == 2) && (AP_SERVER_MINORVERSION_NUMBER == 2) && (AP_SERVER_PATCHLEVEL_NUMBER >= 4)) #define apache_get_server_version() ap_get_server_banner() #else #define apache_get_server_version() ap_get_server_version() #endif /* Configuration functions. */ void DSOLOCAL *create_directory_config(apr_pool_t *mp, char *path); void DSOLOCAL *merge_directory_configs(apr_pool_t *mp, void *_parent, void *_child); void DSOLOCAL init_directory_config(directory_config *dcfg); /* IO functions. */ apr_status_t DSOLOCAL input_filter(ap_filter_t *f, apr_bucket_brigade *bb_out, ap_input_mode_t mode, apr_read_type_e block, apr_off_t nbytes); apr_status_t DSOLOCAL output_filter(ap_filter_t *f, apr_bucket_brigade *bb_in); apr_status_t DSOLOCAL read_request_body(modsec_rec *msr, char **error_msg); /* Utility functions */ int DSOLOCAL perform_interception(modsec_rec *msr); apr_status_t DSOLOCAL send_error_bucket(modsec_rec *msr, ap_filter_t *f, int status); int DSOLOCAL apache2_exec(modsec_rec *msr, const char *command, const char **argv, char **output); void DSOLOCAL record_time_checkpoint(modsec_rec *msr, int checkpoint_no); char DSOLOCAL *get_apr_error(apr_pool_t *p, apr_status_t rc); char DSOLOCAL *get_env_var(request_rec *r, char *name); void DSOLOCAL msr_log(modsec_rec *msr, int level, const char *text, ...) PRINTF_ATTRIBUTE(3,4); void DSOLOCAL msr_log_error(modsec_rec *msr, const char *text, ...) PRINTF_ATTRIBUTE(2,3); void DSOLOCAL msr_log_warn(modsec_rec *msr, const char *text, ...) PRINTF_ATTRIBUTE(2,3); char DSOLOCAL *format_error_log_message(apr_pool_t *mp, error_message_t *em); const DSOLOCAL char *get_response_protocol(request_rec *r); #endif modsecurity-apache_2.7.7/mlogc/0000775000175000017500000000000012254306021016727 5ustar zimmerlezimmerlemodsecurity-apache_2.7.7/mlogc/mlogc-batch-load.pl.in0000775000175000017500000000644312243422537023011 0ustar zimmerlezimmerle#!@PERL@ # # ModSecurity for Apache 2.x, http://www.modsecurity.org/ # Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) # # 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 # # If any of the files related to licensing are missing or if you have any # other questions related to licensing please contact Trustwave Holdings, Inc. # directly using the email address security@modsecurity.org. use strict; use File::Find qw(find); use File::Spec::Functions qw(catfile); use Sys::Hostname qw(hostname); use Digest::MD5 qw(md5_hex); my $ROOTDIR = $ARGV[0] || ''; my $MLOGC = $ARGV[1] || ''; my $MLOGCCONF = $ARGV[2] || ''; my @AUDIT = (); if ($ROOTDIR eq '' or ! -e $MLOGC or ! -e $MLOGCCONF) { printf STDERR "\nUsage: $0 \n\n"; exit 1; } open(MLOGC, "|$MLOGC -f $MLOGCCONF") or die "ERROR: could not open '$MLOGC' - $!\n"; find( { wanted => sub { my($fn,$dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size); (($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size) = stat($_)) && -f _ && #### MODSEC-204 /^\d{8}-\d+-\w{24}$/s /^\d{8}-\d+-.{24}$/s && (($fn = $File::Find::name) =~ s/^\Q$ROOTDIR\E//) && push(@AUDIT, [$fn, $size]); }, follow => 1, }, $ROOTDIR ); for my $audit (@AUDIT) { my $fn = $audit->[0]; my $line = ""; my $err = 0; my $ln = 0; my $sln = 0; my $sect = ""; my $data = ""; my %data = ( hostname => hostname(), remote_addr => "-", remote_user => "-", local_user => "-", logtime => "-", request => "-", response_status => "-", bytes_sent => "-", referer => "-", user_agent => "-", uniqueid => "-", sessionid => "-", audit_file => $fn, extra => "0", audit_size => $audit->[1], md5 => "-", ); ### Parse the audit file in an attempt to recreate the original log line open (AUDIT, "<".catfile($ROOTDIR,$fn)) or $err = 1; if ($err == 1) { print STDERR "ERROR: could not open '$fn' - $!\n"; next; } while($line = ) { $data .= $line; chop $line; $ln++; $sln++; if ($line =~ m%^--[0-9A-Fa-f]{8}-([A-Z])--$%) { $sect = $1; $sln = 0; next; }; if ($sect eq 'A') { if ($line =~ m%^(\[[^:]+:\d+:\d+:\d+ [^\]]+\]) (\S+) (\S+) (\d+) (\S+) (\d+)%) { $data{logtime} = $1; $data{uniqueid} = $2; $data{remote_addr} = $3; } next; } elsif ($sect eq 'B') { if ($sln == 1) { $data{request} = $line; } elsif ($line =~ m%^User=Agent: (.*)%i) { $data{user_agent} = $1; } elsif ($line =~ m%^Referer: (.*)%i) { $data{referer} = $1; } next; } elsif ($sect eq 'F') { if ($sln == 1 and $line =~ m%^\S+ (\d{3})\D?.*%) { $data{response_status} = $1; } elsif ($line =~ m%^Content-Length: (\d+)%i) { $data{bytes_sent} = $1; } next; } } $data{md5} = md5_hex($data); printf MLOGC ( "%s %s %s %s %s \"%s\" %s %s \"%s\" \"%s\" %s \"%s\" %s %s %s md5:%s\n", $data{hostname}, $data{remote_addr}, $data{remote_user}, $data{local_user}, $data{logtime}, $data{request}, $data{response_status}, $data{bytes_sent}, $data{referer}, $data{user_agent}, $data{uniqueid}, $data{sessionid}, $data{audit_file}, $data{extra}, $data{audit_size}, $data{md5}, ); } modsecurity-apache_2.7.7/mlogc/Makefile.am0000664000175000017500000000062412253711345020775 0ustar zimmerlezimmerle bin_SCRIPTS = mlogc-batch-load.pl bin_PROGRAMS = mlogc mlogc_SOURCES = mlogc.c mlogc_CPPFLAGS = @APR_CPPFLAGS@ \ @PCRE_CPPFLAGS@ \ @CURL_CPPFLAGS@ \ -I$(top_srcdir)/apache2 mlogc_CFLAGS = @APR_CFLAGS@ \ @CURL_CFLAGS@ \ @PCRE_CFLAGS@ mlogc_LDFLAGS = @APR_LDFLAGS@ \ @CURL_LDFLAGS@ \ @PCRE_LDFLAGS@ mlogc_LDADD = @APR_LDADD@ \ @CURL_LDADD@ \ @PCRE_LDADD@ modsecurity-apache_2.7.7/mlogc/INSTALL0000664000175000017500000000533112243422537017773 0ustar zimmerlezimmerleModSecurity Audit Log Collector (mlogc) Mlogc is used to connect a ModSecurity sensor to the central audit log repository. To Install: =========== 1) Copy the mlogc executable to an appropriate location. A good location might be /usr/local/bin, /opt/mlogc/bin, etc. 2) Create sensor in the central audit log repository. Note the username and the password (SENSOR_USERNAME, SENSOR_PASSWORD). Also note the IP address central repository listens on (CONSOLE_IP_ADDRESS). 3) Configure the ModSecurity sensor to use mlogc # Use ReleventOnly auditing SecAuditEngine RelevantOnly # Must use concurrent logging SecAuditLogType Concurrent # Send all audit log parts SecAuditLogParts ABIDEFGHZ # Use the same /CollectorRoot/LogStorageDir as in mlogc.conf SecAuditLogStorageDir /var/log/mlogc/data # Pipe audit log to mlogc with your configuration SecAuditLog "|/usr/local/bin/mlogc /etc/mlogc.conf" 4) Using the mlogc-default.conf as a template, configure the logger. Typically these are the only directives that will need to be modified to conform to your site: # Points to the root of the installation. All relative # paths configured in this file will be resolved with the # help of this path (LogStorageDir, TransactionLog, etc.) # # Typically, this will be the parent directory that is configured # in ModSecurity for the SecAuditLogStorageDirectory. So, if # your SecAuditLogStorageDirectory is set to /var/log/mlogc/data, # then set this to /var/log/mlogc. CollectorRoot "/var/log/mlogc" # ModSecurity Console receiving URI. You can change the host # and the port parts but leave everything else as is. ConsoleURI https://CONSOLE_IP_ADDRESS:8886/rpc/auditLogReceiver # Sensor credentials SensorUsername "SENSOR_USERNAME" SensorPassword "SENSOR_PASSWORD" # Base directory where the audit logs are stored. This can be specified # as a path relative to the CollectorRoot, or a full path. It should # resolve to the same path as ModSecurity's SecAuditLogStorageDirectory. LogStorageDir "data" See the mlogc-default.conf configuration file for details on other configuration directives. 5) Restart the ModSecurity sensor. From now on every audit log generated will go to the repository. Make sure you create an alert. Transactions without alerts will be recorded but not displayed on the home page. To troubleshoot, generate alerts and observe file "mlogc-error.log". If mlogc fails to connect to the server it will pause for a period of time (60 seconds by default) before it will try again. modsecurity-apache_2.7.7/mlogc/mlogc.c0000664000175000017500000022035112243422537020210 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #if APR_HAVE_UNISTD_H #include /* for getpid() */ #endif #include #include #include #include #include #include "msc_release.h" static void logc_shutdown(int rc); static void create_new_worker(int lock); static void error_log(int level, void *thread, const char *text, ...) PRINTF_ATTRIBUTE(3,4); /* -- Constants -- */ /* Error log levels. */ #define LOG_ERROR 1 #define LOG_WARNING 2 #define LOG_NOTICE 3 #define LOG_DEBUG 4 #define LOG_DEBUG2 5 /* The management thread will wake up every five seconds. */ #define MANAGER_SLEEP 5000000 #define MANAGER_SUBSLEEP 10000 /* Hack to allow multiple mlogc with single delete */ #define KEEP_ENTRIES_REMOVE_HACK 2600 #define KEEP_ENTRIES_REMOVE_TIME 0l #ifdef TEST_HACK #define TEST_WITH_RAND_SLEEP(n) \ do { \ int sec = rand()/(RAND_MAX/n); \ error_log(LOG_DEBUG2, NULL, "TEST_HACK: Sleeping for %ds", sec); \ apr_sleep(apr_time_from_sec(sec)); \ } while(0) #else #define TEST_WITH_RAND_SLEEP(n) #endif #define CAPTUREVECTORSIZE 60 #define PIPE_BUF_SIZE 65536 #define MEMALLOC_ERROR_MSG "Memory allocation failed!" #define VERSION MODSEC_VERSION #define CMDLINE_OPTS "fvh" #define TXIN 0 #define TXOUT 1 #define STATUSBUF_SIZE 256 #define ISHEXCHAR(X) ( ((X >= '0')&&(X <= '9')) \ || ((X >= 'a')&&(X <= 'f')) \ || ((X >= 'A')&&(X <= 'F')) ) /* -- Regex Patterns -- */ /** * This regular expression is used to parse the entire * log line we receive from Apache. The REQUEST_LINE is * treated as a single parameter to allow for invalid * requests. */ static const char logline_pattern[] = "^(\\S+)" "\\ (\\S+)\\ (\\S+)\\ (\\S+)" "\\ \\[([^:]+):(\\d+:\\d+:\\d+)\\ ([^\\]]+)\\]" "\\ \"(.*)\"" "\\ (\\d+)\\ (\\S+)" "\\ \"(.*)\"\\ \"(.*)\"" "\\ (\\S+)\\ \"(.*)\"" "\\ /?(\\S+)\\ (\\d+)\\ (\\d+)" "\\ (\\S+)" "(.*)$"; /** * This regular expression can be used to parse * a REQUEST_LINE field into method, URI, and * protocol. */ static const char requestline_pattern[] = "(\\S+)\\ (.*?)\\ (\\S+)"; /* -- Structures -- */ typedef struct { unsigned long int id; const char *line; apr_size_t line_size; } entry_t; /* -- Global variables -- */ static pid_t logc_pid = 0; static const char *conffile = NULL; static const char *lockfile = NULL; static int have_read_data = 0; static int checkpoint_interval = 60; static apr_time_t checkpoint_time_last = 0; static const char *collector_root = NULL; static apr_table_t *conf = NULL; static const char *console_uri = NULL; static apr_array_header_t *curl_handles = NULL; static int current_workers = 0; static int management_thread_active = 0; static unsigned long int entry_counter = 1; static const char *error_log_path = NULL; static apr_file_t *error_log_fd = NULL; static int error_log_level = 2; static apr_hash_t *in_progress = NULL; static int keep_alive = 150; /* Not used yet. */ static int keep_alive_timeout = 300; /* Not used yet. */ static int keep_entries = 0; static const char *log_repository = NULL; static void *logline_regex = NULL; static int max_connections = 10; static int max_worker_requests = 1000; static apr_global_mutex_t *gmutex = NULL; static apr_thread_mutex_t *mutex = NULL; static apr_pool_t *pool = NULL; static apr_pool_t *thread_pool = NULL; static apr_pool_t *recv_pool = NULL; static apr_array_header_t *queue = NULL; static const char *queue_path = NULL; /* static apr_time_t queue_time = 0; */ static void *requestline_regex = NULL; static int running = 0; static const char *sensor_password = NULL; static const char *sensor_username = NULL; static int server_error = 0; static apr_time_t server_error_last_check_time = 0; static int server_error_timeout = 60; static int startup_delay = 100; static int transaction_delay = 100; static const char *transaction_log_path = NULL; static apr_file_t *transaction_log_fd = NULL; /* -- Commandline opts -- */ static int opt_force = 0; /* -- Code -- */ static char *_log_escape(apr_pool_t *mp, const char *input, apr_size_t input_len) { static const char c2x_table[] = "0123456789abcdef"; unsigned char *d = NULL; char *ret = NULL; unsigned long int i; if (input == NULL) return NULL; ret = apr_palloc(mp, input_len * 4 + 1); if (ret == NULL) return NULL; d = (unsigned char *)ret; i = 0; while(i < input_len) { switch(input[i]) { case '"' : *d++ = '\\'; *d++ = '"'; break; case '\b' : *d++ = '\\'; *d++ = 'b'; break; case '\n' : *d++ = '\\'; *d++ = 'n'; break; case '\r' : *d++ = '\\'; *d++ = 'r'; break; case '\t' : *d++ = '\\'; *d++ = 't'; break; case '\v' : *d++ = '\\'; *d++ = 'v'; break; case '\\' : *d++ = '\\'; *d++ = '\\'; break; default : if ((input[i] <= 0x1f)||(input[i] >= 0x7f)) { *d++ = '\\'; *d++ = 'x'; *d++ = c2x_table[input[i] >> 4]; *d++ = c2x_table[input[i] & 0x0f]; } else { *d++ = input[i]; } break; } i++; } *d = 0; return ret; } /** * Converts a byte given as its hexadecimal representation * into a proper byte. Handles uppercase and lowercase letters * but does not check for overflows. */ static unsigned char x2c(unsigned char *what) { register unsigned char digit; digit = (what[0] >= 'A' ? ((what[0] & 0xdf) - 'A') + 10 : (what[0] - '0')); digit *= 16; digit += (what[1] >= 'A' ? ((what[1] & 0xdf) - 'A') + 10 : (what[1] - '0')); return digit; } /** * URL Decodes a string in-place */ static int urldecode_inplace(unsigned char *input, apr_size_t input_len) { unsigned char *d = (unsigned char *)input; apr_size_t i; if (input == NULL) return 0; i = 0; while (i < input_len) { if (input[i] == '%') { /* Character is a percent sign. */ /* Are there enough bytes available? */ if (i + 2 < input_len) { char c1 = input[i + 1]; char c2 = input[i + 2]; if (ISHEXCHAR(c1) && ISHEXCHAR(c2)) { /* Valid encoding - decode it. */ *d++ = x2c(&input[i + 1]); i += 3; } else { /* Not a valid encoding, skip this % */ *d++ = input[i++]; } } else { /* Not enough bytes available, copy the raw bytes. */ *d++ = input[i++]; } } else { /* Character is not a percent sign. */ if (input[i] == '+') { *d++ = ' '; } else { *d++ = input[i]; } i++; } } *d = '\0'; return 1; } /** * Detect a relative path and merge it with the collector root * path. Leave absolute paths as they are. */ static const char *file_path(const char *path) { char *newpath = NULL; apr_status_t rc; if (path == NULL) return NULL; rc = apr_filepath_merge(&newpath, collector_root, path, APR_FILEPATH_TRUENAME, pool); if ((newpath != NULL) && (rc == APR_SUCCESS || APR_STATUS_IS_EPATHWILD(rc) || APR_STATUS_IS_ENOENT(rc) || APR_STATUS_IS_ENOTDIR(rc))) { return newpath; } else { return NULL; } } /** * Returns the current datetime as a string. */ static char *current_logtime(char *dest, int dlen) { apr_time_exp_t t; apr_size_t len; apr_time_exp_lt(&t, apr_time_now()); apr_strftime(dest, &len, dlen, "%a %b %d %H:%M:%S %Y", &t); return dest; } /** * Logs error to the error log (if available) or * to the stderr. */ static void error_log(int level, void *thread, const char *text, ...) { char msg1[4096] = ""; char msg2[4096] = ""; char datetime[100]; va_list ap; if (level > error_log_level) return; va_start(ap, text); apr_vsnprintf(msg1, sizeof(msg1), text, ap); apr_snprintf(msg2, sizeof(msg2), "[%s] [%d] [%" APR_PID_T_FMT "/%pp] %s\n", current_logtime(datetime, sizeof(datetime)), level, logc_pid, (thread ? thread : 0), msg1); if (error_log_fd != NULL) { apr_size_t nbytes_written; apr_size_t nbytes = strlen(msg2); apr_file_write_full(error_log_fd, msg2, nbytes, &nbytes_written); } else { fprintf(stderr, "%s", msg2); } va_end(ap); } /** * Adds one entry to the internal queue. It will (optionally) start * a new thread to handle it. */ static void add_entry(const char *data, int start_worker) { entry_t *entry = NULL; entry = (entry_t *)malloc(sizeof(entry_t)); entry->id = 0; entry->line = strdup(data); entry->line_size = strlen(entry->line); error_log(LOG_DEBUG, NULL, "Queue locking thread mutex."); if (APR_STATUS_IS_EBUSY(apr_thread_mutex_trylock(mutex))) { error_log(LOG_DEBUG, NULL, "Queue waiting on thread mutex."); apr_thread_mutex_lock(mutex); } /* Assign unique ID to this log entry. */ entry->id = entry_counter++; /* Add the new audit log entry to the queue. */ *(entry_t **)apr_array_push(queue) = entry; /* Create a new worker if we can, but not if there is a * known problem with the server. */ if ( (start_worker != 0) && (current_workers < max_connections)&&(server_error == 0)) { create_new_worker(0); } error_log(LOG_DEBUG, NULL, "Queue unlocking thread mutex."); apr_thread_mutex_unlock(mutex); } /** * Read the queue entries. */ static int read_queue_entries(apr_file_t *fd, apr_time_t *queue_time) { char linebuf[4100]; int line_count = -1; int line_size = 0; apr_status_t rc = 0; char *p = NULL; for(;;) { memset(linebuf, 0, 4100); rc = apr_file_gets(linebuf, 4096, fd); if (rc == APR_EOF) break; if (rc != APR_SUCCESS) { error_log(LOG_ERROR, NULL, "Error reading from the queue file."); logc_shutdown(1); } if (line_count < 0) { /* First line contains the queue time. */ *queue_time = (apr_time_t)apr_atoi64(linebuf); line_count = 0; continue; } p = &linebuf[0]; line_size = strlen(p); /* Remove the \n from the end of the line. */ while(*p != '\0' && line_size > 0) { if (*p == '\n') { *p = '\0'; break; } p++; line_size--; } if (linebuf[0] == '#') { /* Ignore comments. */ continue; } add_entry((const char *)&linebuf, 0); line_count++; } apr_file_close(fd); return line_count; } /** * Initialise the transaction log. This code should be * executed only once at startup. */ static void transaction_log_init(void) { /* ENH: These big enough? */ char new_queue_path[256]; char old_queue_path[256]; apr_file_t *queue_fd = NULL; apr_time_t queue_time; apr_snprintf(new_queue_path, sizeof(new_queue_path), "%s.new", queue_path); apr_snprintf(old_queue_path, sizeof(old_queue_path), "%s.old", queue_path); /* Put a lock in place to ensure exclusivity. */ error_log(LOG_DEBUG, NULL, "Transaction initialization locking global mutex."); if (APR_STATUS_IS_EBUSY(apr_global_mutex_trylock(gmutex))) { error_log(LOG_DEBUG, NULL, "Transaction initialization waiting on global mutex."); apr_global_mutex_lock(gmutex); } error_log(LOG_DEBUG, NULL, "Transaction initialization started."); /* Delete .new file if there is one. */ apr_file_remove(new_queue_path, pool); /* Read in the data from the queue. */ if (apr_file_open(&queue_fd, queue_path, APR_READ | APR_FILE_NOCLEANUP, 0, pool) == APR_SUCCESS) { int line_count = read_queue_entries(queue_fd, &queue_time); apr_file_close(queue_fd); if (line_count > 0) { error_log(LOG_NOTICE, NULL, "Loaded %d entries from the queue file.", line_count); } } /* Try the old queue file. */ else if (apr_file_open(&queue_fd, old_queue_path, APR_READ | APR_FILE_NOCLEANUP, 0, pool) == APR_SUCCESS) { int line_count = read_queue_entries(queue_fd, &queue_time); apr_file_close(queue_fd); error_log(LOG_NOTICE, NULL, "Loaded %d entries from the OLD queue file.", line_count); apr_file_rename(old_queue_path, queue_path, pool); } else { error_log(LOG_NOTICE, NULL, "Queue file not found. New one will be created."); } /* Delete the old queue file. */ apr_file_remove(old_queue_path, pool); checkpoint_time_last = apr_time_now(); /* Start fresh with the transaction log. Do note that * we do not truncate the transaction log on purpose. Apache * will start copies of piped logging binaries during configuration * testing. Truncating would erase the log of a currently running * instance. */ if (apr_file_open(&transaction_log_fd, transaction_log_path, APR_WRITE | APR_CREATE | APR_APPEND | APR_XTHREAD, APR_OS_DEFAULT, pool) != APR_SUCCESS) { error_log(LOG_ERROR, NULL, "Failed to open the transaction log: %s\n", transaction_log_path); error_log(LOG_DEBUG, NULL, "Transaction initialization unlocking global mutex."); apr_global_mutex_unlock(gmutex); logc_shutdown(1); } error_log(LOG_DEBUG, NULL, "Transaction initialization completed."); /* Unlock */ error_log(LOG_DEBUG, NULL, "Transaction initialization unlocking global mutex."); apr_global_mutex_unlock(gmutex); } /** * Log entry event (incoming or outgoing) to the transaction log. */ static void transaction_log(int direction, const char *entry) { apr_size_t nbytes, nbytes_written; char msg[8196] = ""; apr_snprintf(msg, sizeof(msg), "%u %s: %s\n", (unsigned int)apr_time_sec(apr_time_now()), (direction == TXIN ? "IN" : "OUT"), entry); nbytes = strlen(msg); apr_file_write_full(transaction_log_fd, msg, nbytes, &nbytes_written); } /** * Executes a checkpoint, which causes the current queue to be * written to a file and the transaction log to be truncated. */ static void transaction_checkpoint(void) { /* ENH: These big enough? */ char new_queue_path[256]; char old_queue_path[256]; apr_file_t *queue_fd = NULL; apr_hash_index_t *hi = NULL; char msg[256]; int i; apr_pool_t *cpool; apr_snprintf(new_queue_path, sizeof(new_queue_path), "%s.new", queue_path); apr_snprintf(old_queue_path, sizeof(old_queue_path), "%s.old", queue_path); apr_snprintf(msg, sizeof(msg), "%u\n", (unsigned int)apr_time_sec(apr_time_now())); if (! have_read_data) { error_log(LOG_DEBUG, NULL, "Checkpoint not required."); return; } /* Put a lock in place to ensure exclusivity. */ error_log(LOG_DEBUG, NULL, "Checkpoint locking global mutex."); if (APR_STATUS_IS_EBUSY(apr_global_mutex_trylock(gmutex))) { error_log(LOG_DEBUG, NULL, "Checkpoint waiting on global mutex."); apr_global_mutex_lock(gmutex); } error_log(LOG_DEBUG, NULL, "Checkpoint started."); apr_pool_create(&cpool, NULL); /* Dump active entries into a new queue file. */ if (apr_file_open(&queue_fd, new_queue_path, APR_WRITE | APR_CREATE | APR_EXCL | APR_TRUNCATE | APR_FILE_NOCLEANUP, APR_OS_DEFAULT, cpool) != APR_SUCCESS) { error_log(LOG_ERROR, NULL, "Failed to create file: %s", new_queue_path); error_log(LOG_DEBUG, NULL, "Checkpoint unlocking global mutex."); apr_pool_destroy(cpool); apr_global_mutex_unlock(gmutex); return; } /* Write the time first. */ apr_file_write_full(queue_fd, msg, strlen(msg), NULL); /* Dump the entries sitting in the queue first. */ for (i = 0; i < queue->nelts; i++) { entry_t *entry = ((entry_t **)queue->elts)[i]; apr_file_write_full(queue_fd, entry->line, entry->line_size, NULL); apr_file_write_full(queue_fd, &"\n", 1, NULL); } error_log(LOG_DEBUG2, NULL, "Checkpoint wrote %d queued entries to new queue.", i); /* Then dump the ones that are currently being processed. */ i = 0; for (hi = apr_hash_first(NULL, in_progress); hi != NULL; hi = apr_hash_next(hi))\ { void *e; entry_t *entry = NULL; i++; apr_hash_this(hi, NULL, NULL, &e); entry = e; /* quiet type-punned warning */ apr_file_write_full(queue_fd, entry->line, entry->line_size, NULL); apr_file_write_full(queue_fd, &"\n", 1, NULL); } error_log(LOG_DEBUG2, NULL, "Checkpoint wrote %d additional entries to new queue.", i); apr_file_close(queue_fd); /* Switch the files and truncate the transaction log file. */ apr_file_remove(old_queue_path, cpool); apr_file_rename(queue_path, old_queue_path, cpool); apr_file_rename(new_queue_path, queue_path, cpool); apr_file_remove(old_queue_path, cpool); apr_file_trunc(transaction_log_fd, 0); error_log(LOG_DEBUG, NULL, "Checkpoint completed."); apr_pool_destroy(cpool); /* Unlock and exit. */ error_log(LOG_DEBUG, NULL, "Checkpoint unlocking global mutex."); apr_global_mutex_unlock(gmutex); } /** * Parse one confguration line and add it to the * configuration table. */ static void parse_configuration_line(const char *line, int line_count) { char *start = NULL, *command = NULL; char *p = NULL; /* Remove the trailing newline character. */ p = (char *)line; while(*p != '\0') p++; if ((p > start)&&(*(p - 1) == '\n')) *(p - 1) = '\0'; p = (char *)line; /* Ignore whitespace at the beginning of the line. */ while(apr_isspace(*p)) p++; /* Ignore empty lines and comments. */ if ((*p == '\0')||(*p == '#')) return; start = p; while(!apr_isspace(*p)&&(*p != '\0')) p++; command = apr_pstrmemdup(pool, start, p - start); while(apr_isspace(*p)) p++; /* Remove whitespace at the end. */ start = p; while(*p != '\0') p++; if (p > start) { p--; while(apr_isspace(*p)) { *p-- = '\0'; } } /* Remove quotes, but only if we have matching */ if ((*start == '"') && (p > start) && (*p == '"')) { start++; *p-- = '\0'; } /* Take the last directive */ /* ENH: Error on dup directives? */ apr_table_set(conf, command, start); } /** * Reads configuration from a file. */ static void read_configuration(void) { char linebuf[4096]; apr_status_t rc; apr_file_t *fd; int line_count; conf = apr_table_make(pool, 32); if (conf == NULL) { error_log(LOG_ERROR, NULL, MEMALLOC_ERROR_MSG); logc_shutdown(1); } rc = apr_file_open(&fd, conffile, APR_READ | APR_FILE_NOCLEANUP, 0, pool); if (rc != APR_SUCCESS) { error_log(LOG_ERROR, NULL, "Unable to open configuration file: %s", conffile); logc_shutdown(1); } line_count = 0; for(;;) { rc = apr_file_gets(linebuf, 4096, fd); if (rc == APR_EOF) return; if (rc != APR_SUCCESS) { error_log(LOG_ERROR, NULL, "Error reading from the configuration file."); logc_shutdown(1); } line_count++; parse_configuration_line(linebuf, line_count); } apr_file_close(fd); } /** * Initialize the configuration. */ static void init_configuration(void) { char errstr[1024]; apr_status_t rc = 0; const char *s = NULL; /* Other values may be based off the collector root. */ s = apr_table_get(conf, "CollectorRoot"); if (s != NULL) { collector_root = s; } /* Error Log */ s = apr_table_get(conf, "ErrorLog"); if (s != NULL) { error_log_path = file_path(s); } s = apr_table_get(conf, "ErrorLogLevel"); if (s != NULL) { error_log_level = atoi(s); } if ((rc = apr_file_open(&error_log_fd, error_log_path, APR_WRITE | APR_CREATE | APR_APPEND, APR_OS_DEFAULT, pool)) != APR_SUCCESS) { error_log(LOG_ERROR, NULL, "Failed to open the error log %s: %s\n", error_log_path, apr_strerror(rc, errstr, 1024)); logc_shutdown(1); } error_log(LOG_NOTICE, NULL, "Configuring ModSecurity Audit Log Collector %s.", VERSION); /* Startup Delay */ s = apr_table_get(conf, "StartupDelay"); if (s != NULL) { startup_delay = atoi(s); } if ( startup_delay > 0 ) { error_log(LOG_NOTICE, NULL, "Delaying execution for %dms.", startup_delay); apr_sleep(startup_delay * 1000); error_log(LOG_DEBUG, NULL, "Continuing execution after %dms delay.", startup_delay); } /* Remaining Configuration */ error_log(LOG_DEBUG2, NULL, "CollectorRoot=%s", collector_root); error_log(LOG_DEBUG2, NULL, "ErrorLog=%s", error_log_path); error_log(LOG_DEBUG2, NULL, "ErrorLogLevel=%d", error_log_level); error_log(LOG_DEBUG2, NULL, "StartupDelay=%d", startup_delay); s = apr_table_get(conf, "CheckpointInterval"); if (s != NULL) { checkpoint_interval = atoi(s); error_log(LOG_DEBUG2, NULL, "CheckpointInterval=%d", checkpoint_interval); } s = apr_table_get(conf, "QueuePath"); if (s != NULL) { queue_path = file_path(s); error_log(LOG_DEBUG2, NULL, "QueuePath=%s", queue_path); } else { error_log(LOG_ERROR, NULL, "QueuePath not defined in the configuration file."); logc_shutdown(1); } s = apr_table_get(conf, "LockFile"); if (s != NULL) { lockfile = file_path(s); error_log(LOG_DEBUG2, NULL, "LockFile=%s", lockfile); } s = apr_table_get(conf, "ServerErrorTimeout"); if (s != NULL) { server_error_timeout = atoi(s); error_log(LOG_DEBUG2, NULL, "ServerErrorTimeout=%d", server_error_timeout); } s = apr_table_get(conf, "TransactionDelay"); if (s != NULL) { transaction_delay = atoi(s); error_log(LOG_DEBUG2, NULL, "TransactionDelay=%d", transaction_delay); } s = apr_table_get(conf, "TransactionLog"); if (s != NULL) { transaction_log_path = file_path(s); error_log(LOG_DEBUG2, NULL, "TransactionLog=%s", transaction_log_path); } s = apr_table_get(conf, "MaxConnections"); if (s != NULL) { int v = atoi(s); if (v >= 0) max_connections = v; error_log(LOG_DEBUG2, NULL, "MaxConnections=%d", max_connections); } s = apr_table_get(conf, "MaxWorkerRequests"); if (s != NULL) { int v = atoi(s); if (v >= 0) max_worker_requests = v; error_log(LOG_DEBUG2, NULL, "MaxWorkerRequests=%d", max_worker_requests); } s = apr_table_get(conf, "KeepAlive"); if (s != NULL) { int v = atoi(s); if (v >= 0) keep_alive = v; error_log(LOG_DEBUG2, NULL, "KeepAlive=%d", keep_alive); } s = apr_table_get(conf, "KeepAliveTimeout"); if (s != NULL) { int v = atoi(s); if (v >= 0) keep_alive_timeout = v; error_log(LOG_DEBUG2, NULL, "KeepAliveTimeout=%d", keep_alive_timeout); } s = apr_table_get(conf, "LogStorageDir"); if (s != NULL) { log_repository = file_path(s); error_log(LOG_DEBUG2, NULL, "LogStorageDir=%s", log_repository); } else { error_log(LOG_ERROR, NULL, "Missing mandatory parameter LogStorageDir.\n"); logc_shutdown(1); } s = apr_table_get(conf, "ConsoleURI"); if (s != NULL) { console_uri = s; error_log(LOG_DEBUG2, NULL, "ConsoleURI=%s", console_uri); } else { error_log(LOG_ERROR, NULL, "Missing mandatory parameter ConsoleURI.\n"); logc_shutdown(1); } s = apr_table_get(conf, "SensorUsername"); if (s != NULL) { sensor_username = s; error_log(LOG_DEBUG2, NULL, "SensorUsername=%s", sensor_username); } else { error_log(LOG_ERROR, NULL, "Missing mandatory parameter SensorUsername.\n"); logc_shutdown(1); } s = apr_table_get(conf, "SensorPassword"); if (s != NULL) { sensor_password = s; error_log(LOG_DEBUG2, NULL, "SensorPassword=%s", sensor_password); } else { error_log(LOG_ERROR, NULL, "Missing mandatory parameter SensorPassword.\n"); logc_shutdown(1); } s = apr_table_get(conf, "KeepEntries"); if (s != NULL) { keep_entries = atoi(s); } else { keep_entries = 0; } error_log(LOG_DEBUG2, NULL, "KeepEntries=%d", keep_entries); } /** * Clean-up resources before process shutdown. */ static void logc_cleanup(void) { curl_global_cleanup(); } /** * Shutdown the logger. */ static void logc_shutdown(int rc) { /* Tell the threads to shut down. */ running = 0; error_log(LOG_DEBUG, NULL, "Shutting down"); /* Wait for the management thread to stop */ /* ENH: Need a fixed timeout if this never happens */ while(management_thread_active != 0) { apr_sleep(10 * 1000); } if (rc == 0) { error_log(LOG_NOTICE, NULL, "ModSecurity Audit Log Collector %s terminating normally.", VERSION); } else { error_log(LOG_NOTICE, NULL, "ModSecurity Audit Log Collector %s " "terminating with error %d", VERSION, rc); } if (error_log_fd != NULL) { apr_file_flush(error_log_fd); } exit(rc); } /** * Handle signals. */ static int handle_signals(int signum) { switch (signum) { case SIGINT: error_log(LOG_NOTICE, NULL, "Caught SIGINT, shutting down."); logc_shutdown(0); case SIGTERM: error_log(LOG_NOTICE, NULL, "Caught SIGTERM, shutting down."); logc_shutdown(0); #ifndef WIN32 case SIGHUP: error_log(LOG_NOTICE, NULL, "Caught SIGHUP, ignored."); /* ENH: reload config? */ return 0; case SIGALRM: error_log(LOG_DEBUG, NULL, "Caught SIGALRM, ignored."); return 0; case SIGTSTP: error_log(LOG_DEBUG, NULL, "Caught SIGTSTP, ignored."); return 0; #endif /* WIN32 */ } #ifndef WIN32 error_log(LOG_NOTICE, NULL, "Caught unexpected signal %d: %s", signum, apr_signal_description_get(signum)); #else error_log(LOG_NOTICE, NULL, "Caught unexpected signal %d", signum); #endif /* WIN32 */ logc_shutdown(1); return 0; /* should never reach */ } #ifdef WIN32 /** * This function is invoked by Curl to read the source file on Windows */ static size_t curl_readfunction(void *ptr, size_t size, size_t nmemb, void *stream) { return fread(ptr, size, nmemb, (FILE *)stream); } #endif /** * This function is invoked by Curl to read the response * body. Since we don't care about the response body the function * pretends it is retrieving data where it isn't. */ static size_t curl_writefunction(void *ptr, size_t size, size_t nmemb, void *stream) { unsigned char *data = (unsigned char *)ptr; unsigned char *status = (unsigned char *)stream; /* Grab the status line text from the first line of output */ if ((status[0] == 0) && (status[1] == 1)) { apr_size_t i, j; int ismsg = 0; status[1] = 0; /* reset hidden init flag */ for (i = 0, j = 0; i < STATUSBUF_SIZE; i++) { /* We found a line ending so we are done */ if ( data[i] == '\r' ) { break; } /* Skip to after the first space (where msg is) */ if (ismsg < 3) { if ((ismsg == 1) && !isspace(data[i])) { ismsg++; } else if (isspace(data[i])) { ismsg++; } continue; } /* Copy data (msg) from data to status */ status[j++] = data[i]; } status[j] = '\0'; urldecode_inplace(status, j); } /* do nothing */ return (size * nmemb); } /** * This function is invoked by Curl whenever it has something * to say. We forward its messages to the error log at level * DEBUG or DEBUG2 depending on the verbosity. */ static int curl_debugfunction(CURL *curl, curl_infotype infotype, char *data, size_t datalen, void *ourdata) { apr_size_t i, effectivelen; apr_thread_t *thread = (apr_thread_t *)ourdata; if (error_log_level < LOG_DEBUG) return 0; effectivelen = datalen; for(i = 0; i < datalen; i++) { if ((data[i] == 0x0a)||(data[i] == 0x0d)) { effectivelen = i; break; } } switch (infotype) { case CURLINFO_TEXT: /* More verbose data starts with an indent */ if (apr_isspace(data[0])) { char *dataptr = data + 1; /* Skip initial whitespace (indent) */ while ( ((size_t)(dataptr - data) > datalen) && apr_isspace(*dataptr)) dataptr++; dataptr++; error_log(LOG_DEBUG2, thread, "CURL: %s", _log_escape(apr_thread_pool_get(thread), dataptr, effectivelen - (dataptr - data))); } else { error_log(LOG_DEBUG, thread, "CURL: %s", _log_escape(apr_thread_pool_get(thread), data, effectivelen)); } break; case CURLINFO_HEADER_IN: error_log(LOG_DEBUG, thread, "CURL: HEADER_IN %s", _log_escape(apr_thread_pool_get(thread), data, effectivelen)); break; case CURLINFO_HEADER_OUT: error_log(LOG_DEBUG, thread, "CURL: HEADER_OUT %s", _log_escape(apr_thread_pool_get(thread), data, effectivelen)); break; case CURLINFO_DATA_IN: error_log(LOG_DEBUG2, thread, "CURL: DATA_IN %s", _log_escape(apr_thread_pool_get(thread), data, effectivelen)); break; case CURLINFO_DATA_OUT: error_log(LOG_DEBUG2, thread, "CURL: DATA_OUT %s", _log_escape(apr_thread_pool_get(thread), data, effectivelen)); break; default: /* Ignore anything else */ break; } return 0; } /** * Initialise the necessary resources and structures. */ static void logc_init(void) { char errstr[1024]; apr_status_t rc = 0; const char *errptr = NULL; int i, erroffset; queue = apr_array_make(pool, 64, sizeof(entry_t *)); if (queue == NULL) { error_log(LOG_ERROR, NULL, MEMALLOC_ERROR_MSG); logc_shutdown(1); } in_progress = apr_hash_make(pool); if (in_progress == NULL) { error_log(LOG_ERROR, NULL, MEMALLOC_ERROR_MSG); logc_shutdown(1); } if ((rc = apr_global_mutex_create(&gmutex, lockfile, APR_LOCK_DEFAULT, pool)) != APR_SUCCESS) { error_log(LOG_ERROR, NULL, "Failed to create global mutex: %s", apr_strerror(rc, errstr, 1024)); logc_shutdown(1); } if ((rc = apr_thread_mutex_create(&mutex, APR_THREAD_MUTEX_UNNESTED, pool)) != APR_SUCCESS) { error_log(LOG_ERROR, NULL, "Failed to create thread mutex: %s", apr_strerror(rc, errstr, 1024)); logc_shutdown(1); } entry_counter = 1; curl_handles = apr_array_make(pool, max_connections, sizeof(CURL *)); if (curl_handles == NULL) { error_log(LOG_ERROR, NULL, MEMALLOC_ERROR_MSG); logc_shutdown(1); } /* Initialise a number of Curl handles. */ for(i = 0; i < max_connections; i++) { CURL *curl = NULL; /* Create cURL handle. */ curl = curl_easy_init(); /* Pre-configure the handle. */ curl_easy_setopt(curl, CURLOPT_UPLOAD, TRUE); curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, (char *)NULL); curl_easy_setopt(curl, CURLOPT_URL, console_uri); curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, FALSE); curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0); /* SSLv3 works better overall as some servers have issues with TLS */ curl_easy_setopt(curl, CURLOPT_SSLVERSION, CURL_SSLVERSION_SSLv3); curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 15); curl_easy_setopt(curl, CURLOPT_NOSIGNAL, TRUE); curl_easy_setopt(curl, CURLOPT_HEADER, TRUE); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curl_writefunction); *(CURL **)apr_array_push(curl_handles) = curl; } logline_regex = pcre_compile(logline_pattern, PCRE_CASELESS, &errptr, &erroffset, NULL); if (logline_regex == NULL) { error_log(LOG_ERROR, NULL, "Failed to compile pattern: %s\n", logline_pattern); logc_shutdown(1); } requestline_regex = pcre_compile(requestline_pattern, PCRE_CASELESS, &errptr, &erroffset, NULL); if (requestline_regex == NULL) { error_log(LOG_ERROR, NULL, "Failed to compile pattern: %s\n", requestline_pattern); logc_shutdown(1); } } /** * HACK: To allow two mlogcs running against a single dataset we use the * mtime as a flag for deletion. * * 1) Check file date. * 2) If it is KEEP_ENTRIES_REMOVE_TIME, then remove the file. * 3) Otherwise set the date and let the other mlogc remove it. */ static void keep_entries_hack(apr_pool_t *mp, apr_thread_t *thread, const char *fn) { apr_file_t *f = NULL; apr_finfo_t finfo; char errstr[1024]; apr_status_t rc; /* Opening for write as required for exclusive lock */ if ((rc = apr_file_open(&f, fn, APR_READ|APR_WRITE|APR_APPEND, APR_OS_DEFAULT, mp)) != APR_SUCCESS) { error_log(LOG_ERROR, thread, "Could not open \"%s\": %s", fn, apr_strerror(rc, errstr, 1024)); return; } if ((rc = apr_file_lock(f, APR_FLOCK_EXCLUSIVE|APR_FLOCK_NONBLOCK)) != APR_SUCCESS) { error_log(LOG_DEBUG2, thread, "Waiting for lock on \"%s\": %s", fn, apr_strerror(rc, errstr, 1024)); if ((rc = apr_file_lock(f, APR_FLOCK_EXCLUSIVE)) != APR_SUCCESS) { error_log(LOG_ERROR, thread, "Could not lock \"%s\": %s", fn, apr_strerror(rc, errstr, 1024)); apr_file_close(f); return; } } error_log(LOG_DEBUG2, thread, "Locked: %s", fn); /* For testing only */ TEST_WITH_RAND_SLEEP(2); if ((rc = apr_stat(&finfo, fn, APR_FINFO_MIN, mp)) != APR_SUCCESS) { error_log(LOG_ERROR, thread, "Could not stat \"%s\": %s", fn, apr_strerror(rc, errstr, 1024)); error_log(LOG_DEBUG2, thread, "Unlocked: %s", fn); apr_file_close(f); return; } if (error_log_level >= LOG_DEBUG) { error_log(LOG_DEBUG, thread, "STAT \"%s\" {" "uid=%d; gid=%d; size=%" APR_OFF_T_FMT "; " "csize=%" APR_OFF_T_FMT "; atime=%" APR_TIME_T_FMT "; " "ctime=%" APR_TIME_T_FMT "; mtime=%" APR_TIME_T_FMT "}", fn, finfo.user, finfo.group, finfo.size, finfo.csize, finfo.atime, finfo.ctime, finfo.mtime); } if (finfo.mtime != KEEP_ENTRIES_REMOVE_TIME) { error_log(LOG_DEBUG2, thread, "Set mtime: %s", fn); if ((rc = apr_file_mtime_set(fn, (apr_time_t)KEEP_ENTRIES_REMOVE_TIME, mp)) != APR_SUCCESS) { error_log(LOG_ERROR, thread, "Could not set mtime on \"%s\": %s", fn, apr_strerror(rc, errstr, 1024)); } error_log(LOG_DEBUG2, thread, "Unlocked: %s", fn); apr_file_close(f); return; } error_log(LOG_DEBUG, thread, "Removing: %s", fn); error_log(LOG_DEBUG2, thread, "Unlocked: %s", fn); apr_file_close(f); apr_file_remove(fn, mp); } /** * Worker thread. Works in a loop, fetching jobs from the queue, * until the queue is empty or it is otherwise told to quit. */ static void * APR_THREAD_FUNC thread_worker(apr_thread_t *thread, void *data) { unsigned int loop_count = 0; CURL *curl = (CURL *)data; entry_t **entryptr = NULL; entry_t *entry = NULL; apr_status_t rc; apr_finfo_t finfo; int capturevector[CAPTUREVECTORSIZE]; int take_new = 1; apr_pool_t *tpool; struct curl_slist *headerlist = NULL; char curl_error_buffer[CURL_ERROR_SIZE] = ""; int num_requests = 0; /* There is no need to do the sleep if this was an invalid entry * as the sleep is just to protect flooding the console server * with rapid requests. With an invalid entry we never hit the * server, so we should not delay processing the next event. */ int nodelay = 0; error_log(LOG_DEBUG, thread, "Worker thread starting."); /* Each worker uses its own pool to manage memory. To avoid * memory leaks the pool is cleared after each processed * entry. */ apr_pool_create(&tpool, thread_pool); /* Process jobs in a queue until there are no more jobs to process. */ for(;;) { nodelay = 0; /* Do we need to shut down? */ if (running == 0) { error_log(LOG_DEBUG, thread, "We were told to shut down."); goto THREAD_SHUTDOWN; } /* Is there a problem with the server? We need * to shut down if there is. Except that we don't * want to shut down if we were launched to investigate * if the server came back online (loop_count will be * zero in that case). */ if ((server_error == 1)&&(loop_count != 0)) { error_log(LOG_DEBUG, thread, "Shutting down due to server error."); goto THREAD_SHUTDOWN; } loop_count++; /* Get a new entry, but only if we need one. */ if (take_new) { error_log(LOG_DEBUG, thread, "Worker fetch locking thread mutex."); if (APR_STATUS_IS_EBUSY(apr_thread_mutex_trylock(mutex))) { error_log(LOG_DEBUG, thread, "Worker fetch waiting on thread mutex."); apr_thread_mutex_lock(mutex); } error_log(LOG_DEBUG, thread, "Worker fetch started."); /* Deal with the previous entry. */ if (entry != NULL) { error_log(LOG_DEBUG, thread, "Removing previous entry from storage."); transaction_log(TXOUT, entry->line); /* Remove previous entry from storage. */ apr_hash_set(in_progress, &entry->id, sizeof(entry->id), NULL); /* Release the memory it used to occupy. */ free((void *)entry->line); free(entry); entry = NULL; } error_log(LOG_DEBUG, thread, "Getting one entry from the queue."); /* Get one entry. */ entryptr = (entry_t **)apr_array_pop(queue); if (entryptr == NULL) { error_log(LOG_DEBUG, thread, "Worker fetch unlocking thread mutex."); apr_thread_mutex_unlock(mutex); error_log(LOG_DEBUG, thread, "No more work for this thread, exiting."); goto THREAD_SHUTDOWN; } entry = *entryptr; apr_hash_set(in_progress, &entry->id, sizeof(entry->id), entry); error_log(LOG_DEBUG, thread, "Worker fetch completed."); error_log(LOG_DEBUG, thread, "Worker fetch unlocking thread mutex."); apr_thread_mutex_unlock(mutex); } /* Send one entry. */ error_log(LOG_DEBUG, thread, "Processing entry."); take_new = 0; /* Keep track of requests processed if we need to */ if (max_worker_requests > 0) { num_requests++; } rc = pcre_exec(logline_regex, NULL, entry->line, entry->line_size, 0, 0, capturevector, CAPTUREVECTORSIZE); if (rc == PCRE_ERROR_NOMATCH) { /* No match. */ error_log(LOG_WARNING, thread, "Invalid entry (failed to match regex): %s", _log_escape(tpool, entry->line, entry->line_size)); take_new = 1; nodelay = 1; } else if (rc < 0) { /* Error condition. */ error_log(LOG_WARNING, thread, "Invalid entry (PCRE error %d): %s", rc, _log_escape(tpool, entry->line, entry->line_size)); take_new = 1; nodelay = 1; } else { /* We have a match. */ char *uniqueid = NULL; char *auditlogentry = NULL; char *hash = NULL; char *summary = NULL; char *credentials = NULL; error_log(LOG_DEBUG, thread, "Regular expression matched."); /* For testing only */ TEST_WITH_RAND_SLEEP(2); uniqueid = apr_psprintf(tpool, "%.*s", (capturevector[2*13+1] - capturevector[2*13]), (entry->line + capturevector[2*13])); auditlogentry = apr_psprintf(tpool, "%s/%.*s", log_repository, (capturevector[2*15+1] - capturevector[2*15]), (entry->line + capturevector[2*15])); hash = apr_psprintf(tpool, "X-Content-Hash: %.*s", (capturevector[2*18+1] - capturevector[2*15]), (entry->line + capturevector[2*18])); summary = apr_psprintf(tpool, "X-ForensicLog-Summary: %s", entry->line); credentials = apr_psprintf(tpool, "%s:%s", sensor_username, sensor_password); rc = apr_stat(&finfo, auditlogentry, APR_FINFO_SIZE, tpool); if (rc == APR_SUCCESS) { FILE *hd_src; char response_buf[STATUSBUF_SIZE]; CURLcode res; if (error_log_level >= LOG_DEBUG) { error_log(LOG_DEBUG, thread, "STAT \"%s\" {" "uid=%d; gid=%d; size=%" APR_OFF_T_FMT "; " "csize=%" APR_OFF_T_FMT "; " "atime=%" APR_TIME_T_FMT "; " "ctime=%" APR_TIME_T_FMT "; " "mtime=%" APR_TIME_T_FMT "}", auditlogentry, finfo.user, finfo.group, finfo.size, finfo.csize, finfo.atime, finfo.ctime, finfo.mtime); } /* Initialize the respone buffer with a hidden value */ response_buf[0] = 0; response_buf[1] = 1; if (finfo.size == 0) { error_log(LOG_WARNING, thread, "File found (%" APR_OFF_T_FMT " bytes), skipping.", finfo.size); take_new = 1; nodelay = 1; goto THREAD_CLEANUP; } else { error_log(LOG_DEBUG, thread, "File found (%" APR_OFF_T_FMT " bytes), activating cURL.", finfo.size); } curl_easy_setopt(curl, CURLOPT_VERBOSE, 1); curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION, curl_debugfunction); curl_easy_setopt(curl, CURLOPT_DEBUGDATA, thread); curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, curl_error_buffer); curl_easy_setopt(curl, CURLOPT_USERPWD, credentials); curl_easy_setopt(curl, CURLOPT_WRITEDATA, (char *)response_buf); headerlist = curl_slist_append(headerlist, "Expect:"); headerlist = curl_slist_append(headerlist, hash); headerlist = curl_slist_append(headerlist, summary); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headerlist); hd_src = fopen(auditlogentry, "rb"); if (hd_src == NULL) { error_log(LOG_WARNING, thread, "Invalid entry (failed to open file for " "reading): %s", auditlogentry); take_new = 1; nodelay = 1; goto THREAD_CLEANUP; } curl_easy_setopt(curl, CURLOPT_READDATA, hd_src); curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE, finfo.size); #ifdef WIN32 /* Mandatory on win32 */ curl_easy_setopt(curl, CURLOPT_READFUNCTION, curl_readfunction); #endif res = curl_easy_perform(curl); fclose(hd_src); if (res == 0) { long response_code = 0; res = curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &response_code); error_log(LOG_DEBUG, thread, "Request returned with status \"%ld %s\": %s", response_code, response_buf, uniqueid); if (response_code == 0) { /* Assume problem with connection */ error_log(LOG_WARNING, thread, "Flagging server as errored after failure " "to retrieve response code for entry %s " "(cURL code %d): Possible SSL negotiation " "error", uniqueid, res); apr_sleep(1000 * 1000); take_new = 0; server_error = 1; server_error_last_check_time = apr_time_now(); } else if (res != 0) { error_log(LOG_WARNING, thread, "Flagging server as errored after failure " "to retrieve response code for entry %s " "(cURL code %d): %s", uniqueid, res, curl_error_buffer); apr_sleep(1000 * 1000); take_new = 0; server_error = 1; server_error_last_check_time = apr_time_now(); } else { if (response_code == 200) { double total_time, upload_size; if (server_error == 1) { error_log(LOG_NOTICE, thread, "Clearing the server error flag " "after successful entry " "submission: %s", uniqueid); } server_error = 0; server_error_last_check_time = 0; curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME, &total_time); curl_easy_getinfo(curl, CURLINFO_SIZE_UPLOAD, &upload_size); if (!keep_entries) { error_log(LOG_DEBUG, thread, "Removing: %s", auditlogentry); apr_file_remove(auditlogentry, tpool); } else if (keep_entries == KEEP_ENTRIES_REMOVE_HACK) { keep_entries_hack(tpool, thread, auditlogentry); } error_log(LOG_NOTICE, thread, "Entry completed (%.3f seconds, %.0f " "bytes): %s", total_time, upload_size, uniqueid); take_new = 1; } else if (response_code == 409) { /* Assume problem with audit log entry. */ error_log(LOG_WARNING, thread, "Failed to submit entry with " "\"409 %s\": %s", response_buf, uniqueid); take_new = 1; } else { /* Assume problem with server. */ error_log(LOG_WARNING, thread, "Flagging server as errored after " "failure to submit entry %s with " "HTTP response code %ld: %s", uniqueid, response_code, response_buf); server_error = 1; server_error_last_check_time = apr_time_now(); take_new = 0; } } } else { /* Something isn't right. */ error_log(LOG_WARNING, thread, "Flagging server as errored after " "failure to submit entry %s " "(cURL code %d): %s", uniqueid, res, curl_error_buffer); server_error = 1; server_error_last_check_time = apr_time_now(); take_new = 0; } } else { error_log(LOG_WARNING, thread, "Invalid entry (file not found %d): %s", rc, auditlogentry); take_new = 1; nodelay = 1; } /* If we are tracking num_requests, then shutdown if we are * over our threshold. */ if (num_requests && (num_requests >= max_worker_requests)) { error_log(LOG_NOTICE, thread, "Reached max requests (%d) for this worker, exiting.", max_worker_requests); goto THREAD_SHUTDOWN; } } THREAD_CLEANUP: /* Sleep if we sent data to the server so we do not flood */ /* ENH: Need to sleep for 1ms in a loop checking for shutdown */ if ((nodelay == 0) && (transaction_delay > 0)) { error_log(LOG_DEBUG, thread, "Sleeping for %d msec.", transaction_delay); apr_sleep(transaction_delay * 1000); } if (headerlist != NULL) { curl_slist_free_all(headerlist); headerlist = NULL; } apr_pool_clear(tpool); error_log(LOG_DEBUG, thread, "Worker processing completed."); } THREAD_SHUTDOWN: error_log(LOG_DEBUG, thread, "Worker shutdown locking thread mutex."); if (APR_STATUS_IS_EBUSY(apr_thread_mutex_trylock(mutex))) { error_log(LOG_DEBUG, thread, "Worker shutdown waiting on thread mutex."); apr_thread_mutex_lock(mutex); } /* Deal with the previous entry, if any. */ if (entry != NULL) { apr_hash_set(in_progress, &entry->id, sizeof(entry->id), NULL); if (take_new == 0) { /* Not done. */ *(entry_t **)apr_array_push(queue) = entry; } else { transaction_log(TXOUT, entry->line); free((void *)entry->line); free(entry); } entry = NULL; } /* Return curl handle to the pool for reuse. */ *(CURL **)apr_array_push(curl_handles) = curl; /* No more work, exit. */ current_workers--; error_log(LOG_DEBUG, thread, "Worker shutdown unlocking thread mutex."); apr_thread_mutex_unlock(mutex); apr_pool_destroy(tpool); error_log(LOG_DEBUG, thread, "Worker thread completed."); apr_thread_exit(thread, 0); return NULL; } /** * Creates one new worker, giving it one of the available * Curl handles to work with. */ static void create_new_worker(int lock) { apr_thread_t *thread = NULL; CURL **curlptr = NULL; if (lock) { error_log(LOG_DEBUG, NULL, "Worker creation locking thread mutex."); if (APR_STATUS_IS_EBUSY(apr_thread_mutex_trylock(mutex))) { error_log(LOG_DEBUG, NULL, "Worker creation waiting on thread mutex."); apr_thread_mutex_lock(mutex); } } error_log(LOG_DEBUG, NULL, "Worker creation started."); /* A sanity check: this part executes under lock and * we want to make *sure* we don't create more threads * than we are allowed. */ if (current_workers >= max_connections) { if (lock) { error_log(LOG_DEBUG, NULL, "Worker creation unlocking thread mutex."); apr_thread_mutex_unlock(mutex); } return; } /* Cleanup thread pool when idle */ if (current_workers <= 0) { if (thread_pool != NULL) { error_log(LOG_DEBUG, NULL, "Destroying thread_pool."); apr_pool_destroy(thread_pool); thread_pool = NULL; } error_log(LOG_DEBUG, NULL, "Creating thread_pool."); apr_pool_create(&thread_pool, NULL); } curlptr = (CURL **)apr_array_pop(curl_handles); if (curlptr != NULL) { apr_threadattr_t *thread_attrs; apr_status_t rc; apr_threadattr_create(&thread_attrs, thread_pool); apr_threadattr_detach_set(thread_attrs, 1); apr_threadattr_stacksize_set(thread_attrs, 1024); rc = apr_thread_create(&thread, thread_attrs, thread_worker, *curlptr, thread_pool); if (rc != APR_SUCCESS) { if (lock) { error_log(LOG_DEBUG, NULL, "Worker creation unlocking thread mutex."); apr_thread_mutex_unlock(mutex); } error_log(LOG_ERROR, NULL, "Failed to create new worker thread: %d", rc); logc_shutdown(1); } current_workers++; } else { if (lock) { error_log(LOG_DEBUG, NULL, "Worker creation unlocking thread mutex."); apr_thread_mutex_unlock(mutex); } error_log(LOG_ERROR, NULL, "No more cURL handles (Internal Error)."); logc_shutdown(1); } error_log(LOG_DEBUG, NULL, "Worker creation completed: %pp", thread); if (lock) { error_log(LOG_DEBUG, NULL, "Worker creation unlocking thread mutex."); apr_thread_mutex_unlock(mutex); } } /** * This function implements the management thread. */ static void * APR_THREAD_FUNC thread_manager(apr_thread_t *thread, void *data) { apr_time_t last = 0; apr_time_t now = 0; error_log(LOG_DEBUG, thread, "Management thread: Starting."); for(;;) { now = apr_time_now(); /* Should we stop running? */ if (running == 0) { /* We need to be last */ error_log(LOG_DEBUG, thread, "Management thread: Waiting for worker " "threads to finish."); while(current_workers > 0) { apr_sleep(10 * 1000); } if (have_read_data) { error_log(LOG_NOTICE, thread, "Running final transaction checkpoint."); transaction_checkpoint(); } error_log(LOG_DEBUG, thread, "Management thread: Exiting."); management_thread_active = 0; apr_thread_exit(thread, 0); } /* Sleep for a while, but wake up often to check running status */ if ((last > 0) && ((now - last) < MANAGER_SLEEP)) { apr_sleep(MANAGER_SUBSLEEP); continue; } last = now; error_log(LOG_DEBUG2, thread, "Management thread: Processing"); /* When the server is flagged errored we need to * create a worker thread from time to time to * investigate. */ if (server_error) { if ((current_workers == 0)&& (apr_time_sec(now - server_error_last_check_time) > server_error_timeout)) { server_error_last_check_time = now; error_log(LOG_DEBUG, thread, "Management thread: Creating worker thread to " "investigate server."); create_new_worker(1); } } else { if ( (current_workers < max_connections) && (queue->nelts > current_workers) ) { error_log(LOG_DEBUG, thread, "Management thread: Creating worker thread to " "catch up with the queue."); create_new_worker(1); } } /* Initiate a transaction log checkpoint if enough time passed * since the last one. */ if (apr_time_sec(now - checkpoint_time_last) > checkpoint_interval) { error_log(LOG_DEBUG, thread, "Management thread: Initiating a checkpoint " "(previous was %" APR_TIME_T_FMT " seconds ago).", apr_time_sec(now - checkpoint_time_last)); checkpoint_time_last = now; transaction_checkpoint(); } else { error_log(LOG_DEBUG2, thread, "Management thread: Last checkpoint was %" APR_TIME_T_FMT " seconds ago.", apr_time_sec(now - checkpoint_time_last)); } } return NULL; } #ifndef WIN32 /** * Thread to handle all signals */ static void * APR_THREAD_FUNC thread_signals(apr_thread_t *thread, void *data) { apr_status_t rc; error_log(LOG_DEBUG, thread, "Signal thread: Starting."); rc = apr_signal_thread(handle_signals); if (rc != APR_SUCCESS) { error_log(LOG_DEBUG, thread, "Signal thread: Error %d", rc); logc_shutdown(1); } return NULL; } #endif /* WIN32 */ /** * The main loop where we receive log entries from * Apache and add them to the queue, sometimes creating * new worker threads to handle them. */ static void receive_loop(void) { apr_file_t *fd_stdin; apr_size_t nbytes = PIPE_BUF_SIZE; char *buf = apr_palloc(pool, PIPE_BUF_SIZE + 1); char errstr[1024]; apr_size_t evnt = 0; /* Index in buf to first event char */ apr_size_t curr = 0; /* Index in buf to current processing char */ apr_size_t next = 0; /* Index in buf to next unused char */ int done = 0; int drop_next = 0; int buffered_events = 0; int count = 0; apr_pool_t *tmp_pool; /* Open stdin. */ if (apr_file_open_stdin(&fd_stdin, pool) != APR_SUCCESS) { error_log(LOG_ERROR, NULL, "Unable to open stdin for reading"); logc_shutdown(1); } /* Always want this NUL terminated */ buf[PIPE_BUF_SIZE] = '\0'; apr_pool_create(&tmp_pool, NULL); /* Loop forever receiving entries from stdin. */ while(!done || (curr < next)) { apr_status_t rc; if (error_log_level >= LOG_DEBUG2) { error_log(LOG_DEBUG2, NULL, "Internal state: " "[evnt \"%" APR_SIZE_T_FMT "\"]" "[curr \"%" APR_SIZE_T_FMT "\"]" "[next \"%" APR_SIZE_T_FMT "\"]" "[nbytes \"%" APR_SIZE_T_FMT "\"]", evnt, curr, next, nbytes); } /* If we are not done and have the space, read more */ if (!done && (nbytes > 0)) { buffered_events = 0; nbytes = PIPE_BUF_SIZE - next; rc = apr_file_read(fd_stdin, (buf + next), &nbytes); if (rc != APR_SUCCESS) { if (have_read_data) { error_log(LOG_NOTICE, NULL, "No more data to read, emptying buffer: %s", apr_strerror(rc, errstr, 1024)); } done = 1; } else { have_read_data = 1; if (error_log_level == LOG_DEBUG) { error_log(LOG_DEBUG, NULL, "Read %" APR_SIZE_T_FMT " bytes from pipe", nbytes); } else { error_log(LOG_DEBUG2, NULL, "Read %" APR_SIZE_T_FMT " bytes from pipe: `%s'", nbytes, _log_escape(tmp_pool, (buf + next), nbytes)); } } next += nbytes; } /** * Each chunk of data we receive can contain one or more lines for * which we need to find the EOL marker and then queue the event * up to that. So, find/queue as many lines in the buffer as we * can. Any remaining data will get shifted back to the beginning * of the buffer and the buffer size for the next read adjusted. */ while(curr < next) { /* Look for EOL so we can parse the event */ while((curr < next) && (buf[curr] != 0x0a)) { curr++; } if (buf[curr] == 0x0a) { buf[curr] = '\0'; /* We may have to drop this one if it previously failed */ if (drop_next) { error_log(LOG_ERROR, NULL, "Dropping remaining portion of failed " "event: `%s'", _log_escape(tmp_pool, (buf + evnt), (curr - evnt))); drop_next = 0; } else { transaction_log(TXIN, buf + evnt); error_log(LOG_DEBUG2, NULL, "Received audit log entry " "(count %lu queue %d workers %d): %s", entry_counter, queue->nelts, current_workers, _log_escape(tmp_pool, (buf + evnt), strlen(buf + evnt))); add_entry(buf + evnt, 1); buffered_events++; } /* Advance indexes to next event in buf */ evnt = curr = curr + 1; } else { error_log(LOG_DEBUG2, NULL, "Event buffer contains partial event: `%s'", _log_escape(tmp_pool, (buf + evnt), (next - evnt))); break; } } if (buffered_events > 0) { error_log(LOG_DEBUG, NULL, "Processed %d entries from buffer.", buffered_events); /* Move the unused portion of the buffer to the beginning */ next -= evnt; curr -= evnt; memmove(buf, (buf + evnt), next); error_log(LOG_DEBUG2, NULL, "Shifted buffer back %" APR_SIZE_T_FMT " and offset %" APR_SIZE_T_FMT " bytes for next read: `%s'", evnt, next, _log_escape(tmp_pool, buf, next)); evnt = 0; } else if (next == PIPE_BUF_SIZE) { /** * There is a chance we could fill the buffer, but not have finished * reading the event (no EOL yet), so we need to say so and drop * all data until we find the end of the event that is too large. */ if (drop_next) { error_log(LOG_ERROR, NULL, "Event continuation too large, " "dropping it as well: `%s'", _log_escape(tmp_pool, buf, PIPE_BUF_SIZE)); } else { error_log(LOG_ERROR, NULL, "Event too large, dropping event: `%s'", _log_escape(tmp_pool, buf, PIPE_BUF_SIZE)); } /* Rewind buf and mark that we need to drop up to the next event */ evnt = curr = next = 0; drop_next = 1; } nbytes = PIPE_BUF_SIZE - next; if (count++ > 1000) { count = 0; error_log(LOG_DEBUG, NULL, "Recycling tmp_pool."); apr_pool_destroy(tmp_pool); apr_pool_create(&tmp_pool, NULL); } else { apr_pool_clear(tmp_pool); } } /* Wait for queue to empty if specified */ if ((server_error == 0) && (opt_force != 0) && (queue->nelts > 0)) { error_log(LOG_NOTICE, NULL, "Waiting for queue to empty (%d active).", queue->nelts); while ((server_error == 0) && (opt_force != 0) && (queue->nelts > 0)) { apr_sleep(10 * 1000); } if (queue->nelts > 0) { error_log(LOG_ERROR, NULL, "Could not empty queue (%d active).", queue->nelts); } } } /** * Creates the management thread. */ static void start_management_thread(void) { apr_thread_t *thread = NULL; apr_threadattr_t *thread_attrs; apr_status_t rc; apr_threadattr_create(&thread_attrs, pool); apr_threadattr_detach_set(thread_attrs, 1); apr_threadattr_stacksize_set(thread_attrs, 1024); management_thread_active = 1; rc = apr_thread_create(&thread, thread_attrs, thread_manager, NULL, pool); if (rc != APR_SUCCESS) { error_log(LOG_ERROR, NULL, "Failed to create new management thread: %d", rc); management_thread_active = 0; logc_shutdown(1); } } #ifndef WIN32 /** * Creates a thread to handle all signals */ static void start_signal_thread(void) { apr_thread_t *thread = NULL; apr_threadattr_t *thread_attrs; apr_status_t rc; apr_threadattr_create(&thread_attrs, pool); apr_threadattr_detach_set(thread_attrs, 1); apr_threadattr_stacksize_set(thread_attrs, 1024); rc = apr_thread_create(&thread, thread_attrs, thread_signals, NULL, pool); if (rc != APR_SUCCESS) { error_log(LOG_ERROR, NULL, "Failed to create new signal thread: %d", rc); logc_shutdown(1); } } #endif /* WIN32 */ /** * Usage text. */ static void usage(void) { fprintf(stderr, "ModSecurity Log Collector (mlogc) v%s\n", VERSION); fprintf(stderr, " Usage: mlogc [options] /path/to/the/mlogc.conf\n"); fprintf(stderr, "\n"); fprintf(stderr, " Options:\n"); fprintf(stderr, " -f Force depletion of queue on exit\n"); fprintf(stderr, " -v Version information\n"); fprintf(stderr, " -h This help\n\n"); } /** * Version text. */ static void version(void) { fprintf(stderr, "ModSecurity Log Collector (mlogc) v%s\n", VERSION); fprintf(stderr, " APR: compiled=\"%s\"; " "loaded=\"%s\"\n", APR_VERSION_STRING, apr_version_string()); fprintf(stderr, " PCRE: compiled=\"%d.%d\"; " "loaded=\"%s\"\n", PCRE_MAJOR, PCRE_MINOR, pcre_version()); fprintf(stderr, " cURL: compiled=\"%s\"; " "loaded=\"%s\"\n", LIBCURL_VERSION, curl_version()); fprintf(stderr, "\n"); } /** * This is the main entry point. */ int main(int argc, const char * const argv[]) { apr_getopt_t *opt; apr_status_t rc; apr_app_initialize(&argc, &argv, NULL); atexit(apr_terminate); curl_global_init(CURL_GLOBAL_ALL); atexit(logc_cleanup); logc_pid = getpid(); apr_pool_create(&pool, NULL); apr_pool_create(&recv_pool, NULL); #ifndef WIN32 apr_setup_signal_thread(); #else apr_signal(SIGINT, handle_signals); apr_signal(SIGTERM, handle_signals); #endif /* WIN32 */ if (argc < 2) { usage(); logc_shutdown(1); } /* Commandline opts */ rc = apr_getopt_init(&opt, pool, argc, argv); if (rc != APR_SUCCESS) { usage(); logc_shutdown(1); } do { char ch; const char *val; rc = apr_getopt(opt, CMDLINE_OPTS, &ch, &val); switch (rc) { case APR_SUCCESS: switch (ch) { case 'f': opt_force = 1; break; case 'v': version(); logc_shutdown(0); case 'h': usage(); logc_shutdown(0); } break; case APR_BADCH: case APR_BADARG: usage(); logc_shutdown(1); } } while (rc != APR_EOF); /* Conf file is last */ conffile = argv[argc - 1]; read_configuration(); init_configuration(); logc_init(); transaction_log_init(); running = 1; server_error = 0; start_management_thread(); #ifndef WIN32 start_signal_thread(); #endif /* WIN32 */ /* Process stdin until EOF */ receive_loop(); logc_shutdown(0); return 0; } modsecurity-apache_2.7.7/mlogc/mlogc-default.conf0000664000175000017500000000675312243422537022345 0ustar zimmerlezimmerle########################################################################## # Required configuration # At a minimum, the items in this section will need to be adjusted to # fit your environment. The remaining options are optional. ########################################################################## # Points to the root of the installation. All relative # paths will be resolved with the help of this path. CollectorRoot "/var/log/mlogc" # ModSecurity Console receiving URI. You can change the host # and the port parts but leave everything else as is. ConsoleURI "https://CONSOLE_IP_ADDRESS:8888/rpc/auditLogReceiver" # Sensor credentials SensorUsername "SENSOR_USERNAME" SensorPassword "SENSOR_PASSWORD" # Base directory where the audit logs are stored. This can be specified # as a path relative to the CollectorRoot, or a full path. LogStorageDir "data" # Transaction log will contain the information on all log collector # activities that happen between checkpoints. The transaction log # is used to recover data in case of a crash (or if Apache kills # the process). TransactionLog "mlogc-transaction.log" # The file where the pending audit log entry data is kept. This file # is updated on every checkpoint. QueuePath "mlogc-queue.log" # The location of the error log. ErrorLog "mlogc-error.log" # The location of the lock file. LockFile "mlogc.lck" # Keep audit log entries after sending? (0=false 1=true) # NOTE: This is required to be set in SecAuditLog mlogc config if you # are going to use a secondary console via SecAuditLog2. KeepEntries 0 ########################################################################## # Optional configuration ########################################################################## # The error log level controls how much detail there # will be in the error log. The levels are as follows: # 0 - NONE # 1 - ERROR # 2 - WARNING # 3 - NOTICE # 4 - DEBUG # 5 - DEBUG2 # ErrorLogLevel 3 # How many concurrent connections to the server # are we allowed to open at the same time? Log collector uses # multiple connections in order to speed up audit log transfer. # This is especially needed when the communication takes place # over a slow link (e.g. not over a LAN). MaxConnections 10 # How many requests a worker will process before recycling itself. # This is to help prevent problems due to any memory leaks that may # exists. If this is set to 0, then no maximum is imposed. The default # is 1000 requests per worker (the number of workers is controlled by the # MaxConnections limit). MaxWorkerRequests 1000 # The time each connection will sit idle before being reused, # in milliseconds. Increase if you don't want ModSecurity Console # to be hit with too many log collector requests. TransactionDelay 50 # The time to wait before initialization on startup in milliseconds. # Increase if mlogc is starting faster then termination when the # sensor is reloaded. StartupDelay 5000 # How often is the pending audit log entry data going to be written # to a file. The default is 15 seconds. CheckpointInterval 15 # If the server fails all threads will back down until the # problem is sorted. The management thread will periodically # launch a thread to test the server. The default is to test # once in 60 seconds. ServerErrorTimeout 60 # The following two parameters are not used yet, but # reserved for future expansion. # KeepAlive 150 # KeepAliveTimeout 300 modsecurity-apache_2.7.7/mlogc/Makefile.win0000775000175000017500000000265512253711345021206 0ustar zimmerlezimmerle########################################################################### ### You Will need to modify the following variables for your system ########################################################################### ########################################################################### # Path to Apache httpd installation BASE = %APACHE% # Paths to required libraries PCRE = %PCRE% CURL = %CURL% # Linking libraries LIBS = $(BASE)\lib\libapr-1.lib \ $(BASE)\lib\libaprutil-1.lib \ $(PCRE)\pcre.lib \ $(CURL)\lib\libcurl_imp.lib \ wsock32.lib ########################################################################### ########################################################################### CC = cL MT = mt DEFS = /nologo /O2 /W3 -DWIN32 -DWINNT -Dinline=APR_INLINE -D_CONSOLE -D$(VERSION) EXE = mlogc.exe INCLUDES = -I. -I..\apache2 \ -I$(PCRE)\include -I$(PCRE) \ -I$(CURL)\include -I$(CURL) \ -I$(BASE)\include CFLAGS= -MT $(INCLUDES) $(DEFS) LDFLAGS = OBJS = mlogc.obj all: $(EXE) .c.obj: $(CC) $(CFLAGS) -c $< -Fo$@ .cpp.obj: $(CC) $(CFLAGS) -c $< -Fo$@ $(EXE): $(OBJS) $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) /link /NODEFAULTLIB:MSVCRT.lib /subsystem:console install: $(EXE) copy $(EXE) $(BASE)\bin clean: del $(OBJS) $(EXE) *.dll *.lib *.pdb *.idb *.ilk *.exp *.res *.rc *.bin *.manifest modsecurity-apache_2.7.7/mlogc/Makefile.in0000664000175000017500000006403112254306021021000 0ustar zimmerlezimmerle# Makefile.in generated by automake 1.13.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ bin_PROGRAMS = mlogc$(EXEEXT) subdir = mlogc DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(srcdir)/mlogc-batch-load.pl.in $(top_srcdir)/build/depcomp \ INSTALL ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/build/find_apr.m4 \ $(top_srcdir)/build/find_apu.m4 \ $(top_srcdir)/build/find_curl.m4 \ $(top_srcdir)/build/find_lua.m4 \ $(top_srcdir)/build/find_pcre.m4 \ $(top_srcdir)/build/find_xml.m4 $(top_srcdir)/build/libtool.m4 \ $(top_srcdir)/build/ltoptions.m4 \ $(top_srcdir)/build/ltsugar.m4 \ $(top_srcdir)/build/ltversion.m4 \ $(top_srcdir)/build/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/apache2/modsecurity_config_auto.h CONFIG_CLEAN_FILES = mlogc-batch-load.pl CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)" PROGRAMS = $(bin_PROGRAMS) am_mlogc_OBJECTS = mlogc-mlogc.$(OBJEXT) mlogc_OBJECTS = $(am_mlogc_OBJECTS) mlogc_DEPENDENCIES = AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = mlogc_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(mlogc_CFLAGS) $(CFLAGS) \ $(mlogc_LDFLAGS) $(LDFLAGS) -o $@ am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } SCRIPTS = $(bin_SCRIPTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/apache2 depcomp = $(SHELL) $(top_srcdir)/build/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(mlogc_SOURCES) DIST_SOURCES = $(mlogc_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APR_CFLAGS = @APR_CFLAGS@ APR_CONFIG = @APR_CONFIG@ APR_CPPFLAGS = @APR_CPPFLAGS@ APR_INCLUDEDIR = @APR_INCLUDEDIR@ APR_LDADD = @APR_LDADD@ APR_LDFLAGS = @APR_LDFLAGS@ APR_LINKLD = @APR_LINKLD@ APR_VERSION = @APR_VERSION@ APU_CFLAGS = @APU_CFLAGS@ APU_CONFIG = @APU_CONFIG@ APU_INCLUDEDIR = @APU_INCLUDEDIR@ APU_LDADD = @APU_LDADD@ APU_LDFLAGS = @APU_LDFLAGS@ APU_LINKLD = @APU_LINKLD@ APU_VERSION = @APU_VERSION@ APXS = @APXS@ APXS_BINDIR = @APXS_BINDIR@ APXS_CC = @APXS_CC@ APXS_CFLAGS = @APXS_CFLAGS@ APXS_EXTRA_CFLAGS = @APXS_EXTRA_CFLAGS@ APXS_HTTPD = @APXS_HTTPD@ APXS_INCLUDEDIR = @APXS_INCLUDEDIR@ APXS_INCLUDES = @APXS_INCLUDES@ APXS_LDFLAGS = @APXS_LDFLAGS@ APXS_LIBDIR = @APXS_LIBDIR@ APXS_LIBEXECDIR = @APXS_LIBEXECDIR@ APXS_LIBS = @APXS_LIBS@ APXS_LIBTOOL = @APXS_LIBTOOL@ APXS_MODULES = @APXS_MODULES@ APXS_PROGNAME = @APXS_PROGNAME@ APXS_SBINDIR = @APXS_SBINDIR@ APXS_WRAPPER = @APXS_WRAPPER@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CURL_CFLAGS = @CURL_CFLAGS@ CURL_CONFIG = @CURL_CONFIG@ CURL_CPPFLAGS = @CURL_CPPFLAGS@ CURL_LDADD = @CURL_LDADD@ CURL_LDFLAGS = @CURL_LDFLAGS@ CURL_USES_GNUTLS = @CURL_USES_GNUTLS@ CURL_VERSION = @CURL_VERSION@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENV_CMD = @ENV_CMD@ EXEEXT = @EXEEXT@ EXTRA_CFLAGS = @EXTRA_CFLAGS@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ LIBXML2_CONFIG = @LIBXML2_CONFIG@ LIBXML2_CPPFLAGS = @LIBXML2_CPPFLAGS@ LIBXML2_LDADD = @LIBXML2_LDADD@ LIBXML2_LDFLAGS = @LIBXML2_LDFLAGS@ LIBXML2_VERSION = @LIBXML2_VERSION@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LUA_CFLAGS = @LUA_CFLAGS@ LUA_LDADD = @LUA_LDADD@ LUA_LDFLAGS = @LUA_LDFLAGS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MODSEC_APXS_EXTRA_CFLAGS = @MODSEC_APXS_EXTRA_CFLAGS@ MODSEC_EXTRA_CFLAGS = @MODSEC_EXTRA_CFLAGS@ MSC_BASE_DIR = @MSC_BASE_DIR@ MSC_PKGBASE_DIR = @MSC_PKGBASE_DIR@ MSC_REGRESSION_CONF_DIR = @MSC_REGRESSION_CONF_DIR@ MSC_REGRESSION_DIR = @MSC_REGRESSION_DIR@ MSC_REGRESSION_DOCROOT_DIR = @MSC_REGRESSION_DOCROOT_DIR@ MSC_REGRESSION_LOGS_DIR = @MSC_REGRESSION_LOGS_DIR@ MSC_REGRESSION_SERVERROOT_DIR = @MSC_REGRESSION_SERVERROOT_DIR@ MSC_TEST_DIR = @MSC_TEST_DIR@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCRE_CFLAGS = @PCRE_CFLAGS@ PCRE_CONFIG = @PCRE_CONFIG@ PCRE_CPPFLAGS = @PCRE_CPPFLAGS@ PCRE_LDADD = @PCRE_LDADD@ PCRE_LDFLAGS = @PCRE_LDFLAGS@ PCRE_LD_PATH = @PCRE_LD_PATH@ PCRE_VERSION = @PCRE_VERSION@ PERL = @PERL@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOPLEVEL_SUBDIRS = @TOPLEVEL_SUBDIRS@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ bin_SCRIPTS = mlogc-batch-load.pl mlogc_SOURCES = mlogc.c mlogc_CPPFLAGS = @APR_CPPFLAGS@ \ @PCRE_CPPFLAGS@ \ @CURL_CPPFLAGS@ \ -I$(top_srcdir)/apache2 mlogc_CFLAGS = @APR_CFLAGS@ \ @CURL_CFLAGS@ \ @PCRE_CFLAGS@ mlogc_LDFLAGS = @APR_LDFLAGS@ \ @CURL_LDFLAGS@ \ @PCRE_LDFLAGS@ mlogc_LDADD = @APR_LDADD@ \ @CURL_LDADD@ \ @PCRE_LDADD@ all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign mlogc/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign mlogc/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mlogc-batch-load.pl: $(top_builddir)/config.status $(srcdir)/mlogc-batch-load.pl.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p \ || test -f $$p1 \ ; then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' \ -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' \ `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list mlogc$(EXEEXT): $(mlogc_OBJECTS) $(mlogc_DEPENDENCIES) $(EXTRA_mlogc_DEPENDENCIES) @rm -f mlogc$(EXEEXT) $(AM_V_CCLD)$(mlogc_LINK) $(mlogc_OBJECTS) $(mlogc_LDADD) $(LIBS) install-binSCRIPTS: $(bin_SCRIPTS) @$(NORMAL_INSTALL) @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n' \ -e 'h;s|.*|.|' \ -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) { files[d] = files[d] " " $$1; \ if (++n[d] == $(am__install_max)) { \ print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ else { print "f", d "/" $$4, $$1 } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binSCRIPTS: @$(NORMAL_UNINSTALL) @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ dir='$(DESTDIR)$(bindir)'; $(am__uninstall_files_from_dir) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mlogc-mlogc.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mlogc-mlogc.o: mlogc.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mlogc_CPPFLAGS) $(CPPFLAGS) $(mlogc_CFLAGS) $(CFLAGS) -MT mlogc-mlogc.o -MD -MP -MF $(DEPDIR)/mlogc-mlogc.Tpo -c -o mlogc-mlogc.o `test -f 'mlogc.c' || echo '$(srcdir)/'`mlogc.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mlogc-mlogc.Tpo $(DEPDIR)/mlogc-mlogc.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mlogc.c' object='mlogc-mlogc.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mlogc_CPPFLAGS) $(CPPFLAGS) $(mlogc_CFLAGS) $(CFLAGS) -c -o mlogc-mlogc.o `test -f 'mlogc.c' || echo '$(srcdir)/'`mlogc.c mlogc-mlogc.obj: mlogc.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mlogc_CPPFLAGS) $(CPPFLAGS) $(mlogc_CFLAGS) $(CFLAGS) -MT mlogc-mlogc.obj -MD -MP -MF $(DEPDIR)/mlogc-mlogc.Tpo -c -o mlogc-mlogc.obj `if test -f 'mlogc.c'; then $(CYGPATH_W) 'mlogc.c'; else $(CYGPATH_W) '$(srcdir)/mlogc.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mlogc-mlogc.Tpo $(DEPDIR)/mlogc-mlogc.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mlogc.c' object='mlogc-mlogc.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mlogc_CPPFLAGS) $(CPPFLAGS) $(mlogc_CFLAGS) $(CFLAGS) -c -o mlogc-mlogc.obj `if test -f 'mlogc.c'; then $(CYGPATH_W) 'mlogc.c'; else $(CYGPATH_W) '$(srcdir)/mlogc.c'; fi` mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) $(SCRIPTS) installdirs: for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binPROGRAMS install-binSCRIPTS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS uninstall-binSCRIPTS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \ clean-binPROGRAMS clean-generic clean-libtool cscopelist-am \ ctags ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-binPROGRAMS \ install-binSCRIPTS install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ uninstall-binPROGRAMS uninstall-binSCRIPTS # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: modsecurity-apache_2.7.7/LICENSE0000664000175000017500000002613512243422537016653 0ustar zimmerlezimmerle Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed 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. modsecurity-apache_2.7.7/README.TXT0000664000175000017500000000777312247757654017232 0ustar zimmerlezimmerleModSecurity for Apache 2.x, http://www.modsecurity.org/ Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) 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 If any of the files related to licensing are missing or if you have any other questions related to licensing please contact Trustwave Holdings, Inc. directly using the email address security@modsecurity.org. DOCUMENTATION Please refer to the documentation folder (/doc) for the reference manual. ############################################## ---------------------------------- OWASP ModSecurity Core Rule Set (CRS) Project Site: https://www.owasp.org/index.php/Category:OWASP_ModSecurity_Core_Rule_Set_Pr oject Download: https://github.com/SpiderLabs/owasp-modsecurity-crs ---------------------------------- ModSecurity™ is a web application firewall engine that provides very little protection on its own. In order to become useful, ModSecurity™ must be configured with rules. In order to enable users to take full advantage of ModSecurity™ out of the box, Trustwave's SpiderLabs is providing a free certified rule set for ModSecurity™ 2.x. Unlike intrusion detection and prevention systems, which rely on signatures specific to known vulnerabilities, the Core Rules provide generic protection from unknown vulnerabilities often found in web applications, which are in most cases custom coded. The Core Rules are heavily commented to allow it to be used as a step-by-step deployment guide for ModSecurity™. Core Rules Content In order to provide generic web applications protection, the Core Rules use the following techniques: * HTTP Protection - detecting violations of the HTTP protocol and a locally defined usage policy. * Real-time Blacklist Lookups - utilizes 3rd Party IP Reputation * Web-based Malware Detection - identifies malicious web content by check against the Google Safe Browsing API. * HTTP Denial of Service Protections - defense against HTTP Flooding and Slow HTTP DoS Attacks. * Common Web Attacks Protection - detecting common web application security attack. * Automation Detection - Detecting bots, crawlers, scanners and other surface malicious activity. * Integration with AV Scanning for File Uploads - detects malicious files uploaded through the web application. * Tracking Sensitive Data - Tracks Credit Card usage and blocks leakages. * Trojan Protection - Detecting access to Trojans horses. * Identification of Application Defects - alerts on application misconfigurations. * Error Detection and Hiding - Disguising error messages sent by the server. ---------------------------------- ModSecurity Rules from Trustwave SpiderLabs Project Site: hhttps://www.trustwave.com/modsecurity-rules-support.php Download: https://ssl.trustwave.com/web-application-firewall ---------------------------------- Trustwave now provides a commercial certified rule set for ModSecurity 2.x that protects against known attacks that target vulnerabilities in public software and are based on intelligence gathered from real-world investigations, honeypot data and research. 1. More than 16,000 specific rules, broken out into the following attack categories: * SQL injection * Cross-site Scripting (XSS) * Local File Include * Remote File Include 2. User option for application specific rules, covering the same vulnerability classes for applications such as: * WordPress * cPanel * osCommerce * Joomla * For a complete listing of application coverage, please refer to this link (which is updated daily). https://modsecurity.org/projects/commercial/rules/application_coverage.html 3. Complements and integrates with the OWASP Core Rule Set 4. IP Reputation capabilities which provide protection against malicious clients identified by the Trustwave SpiderLabs Distributed Web Honeypots 5. Malware Detection capabilities which prevent your web site from distributing malicious code to clients. ############################################## modsecurity-apache_2.7.7/ext/0000775000175000017500000000000012254306021016426 5ustar zimmerlezimmerlemodsecurity-apache_2.7.7/ext/mod_op_strstr.c0000664000175000017500000001425312243422537021506 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #include "httpd.h" #include "http_core.h" #include "http_config.h" #include "http_log.h" #include "http_protocol.h" #include "ap_config.h" #include "apr_optional.h" #include "modsecurity.h" #define ALPHABET_SIZE 256 #define MAX_PATTERN_SIZE 64 static void initBoyerMooreHorspool(const char *pattern, int patlength, int *bm_badcharacter_array); static int BoyerMooreHorspool(const char *pattern, int patlength, const char *text, int textlen, int *bm_badcharacter_array); /** * Operator parameter initialisation entry point. */ static int op_strstr_init(msre_rule *rule, char **error_msg) { /* Operator initialisation function will be called once per * statement where operator is used. It is meant to be used * to check the parameters to see whether they are present * and if they are in the correct format. */ /* In this example we just look for a simple non-empty parameter. */ if ((rule->op_param == NULL)||(strlen(rule->op_param) == 0)) { *error_msg = apr_psprintf(rule->ruleset->mp, "Missing parameter for operator 'strstr'."); return 0; /* ERROR */ } /* If you need to transform the data in the parameter into something * else you should do that here. Simply create a new structure to hold * the transformed data and place the pointer to it into rule->op_param_data. * You will have access to this pointer later on. */ rule->op_param_data = apr_pcalloc(rule->ruleset->mp, ALPHABET_SIZE * sizeof(int)); initBoyerMooreHorspool(rule->op_param, strlen(rule->op_param), (int *)rule->op_param_data); /* OK */ return 1; } /** * Operator execution entry point. */ static int op_strstr_exec(modsec_rec *msr, msre_rule *rule, msre_var *var, char **error_msg) { /* Here we need to inspect the contents of the supplied variable. */ /* In a general case it is possible for the value * to be NULL. What you need to do in this case * depends on your operator. In this example we return * a "no match" response. */ if (var->value == NULL) return 0; /* No match. */ /* Another thing to note is that variables are not C strings, * meaning the NULL byte is not used to determine the end * of the string. Variable length var->value_len should be * used for this purpose. */ if (BoyerMooreHorspool(rule->op_param, strlen(rule->op_param), var->value, var->value_len, (int *)rule->op_param_data) >= 0) { return 1; /* Match. */ } return 0; /* No match. */ } static int hook_pre_config(apr_pool_t *mp, apr_pool_t *mp_log, apr_pool_t *mp_temp) { void (*fn)(const char *name, void *fn_init, void *fn_exec); /* Look for the registration function * exported by ModSecurity. */ fn = APR_RETRIEVE_OPTIONAL_FN(modsec_register_operator); if (fn) { /* Use it to register our new * transformation function under the * name "reverse". */ fn("strstr", (void *)op_strstr_init, (void *)op_strstr_exec); } else { ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, NULL, "mod_op_strstr: Unable to find modsec_register_operator."); } return OK; } static void register_hooks(apr_pool_t *p) { ap_hook_pre_config(hook_pre_config, NULL, NULL, APR_HOOK_LAST); } /* Dispatch list for API hooks */ module AP_MODULE_DECLARE_DATA op_strstr_module = { STANDARD20_MODULE_STUFF, NULL, /* create per-dir config structures */ NULL, /* merge per-dir config structures */ NULL, /* create per-server config structures */ NULL, /* merge per-server config structures */ NULL, /* table of config file commands */ register_hooks /* register hooks */ }; /* This example uses an implementation Boyer-Moore-Horspool matching algorithm as implemented in Streamline (http://ffpf.sourceforge.net). Copyright (c) 2004-2006, Vrije Universiteit Amsterdam All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 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. Neither the name of the Vrije Universiteit nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. */ static void precompute_badcharacter(const char *pattern, int patlength, int bm_badcharacter_array[]) { int i; for (i = 0; i < ALPHABET_SIZE; ++i) { bm_badcharacter_array[i] = patlength; } for (i = 0; i < patlength - 1; ++i){ bm_badcharacter_array[(uint8_t)pattern[i]] = patlength - i - 1; } } static void initBoyerMooreHorspool(const char *pattern, int patlength, int *bm_badcharacter_array) { precompute_badcharacter(pattern, (patlength < MAX_PATTERN_SIZE ? patlength : MAX_PATTERN_SIZE), bm_badcharacter_array); } static int BoyerMooreHorspool(const char *pattern, int patlength, const char *text, int textlen, int *bm_badcharacter_array) { int j; char c; j = 0; while (j <= textlen - patlength) { c = text[j + patlength - 1]; if (pattern[patlength - 1] == c && memcmp(pattern, text + j, patlength - 1) == 0) { return j; } j += bm_badcharacter_array[(uint8_t)c]; } return -1; } modsecurity-apache_2.7.7/ext/mod_tfn_reverse.c0000664000175000017500000000607612243422537021775 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #include "httpd.h" #include "http_core.h" #include "http_config.h" #include "http_log.h" #include "http_protocol.h" #include "ap_config.h" #include "apr_optional.h" #include "modsecurity.h" /** * This function will be invoked by * ModSecurity to transform input. */ static int reverse(apr_pool_t *mptmp, unsigned char *input, long int input_len, char **rval, long int *rval_len) { /* Transformation functions can choose to do their * thing in-place, overwriting the existing content. This * is normally possible only if the transformed content * is of equal length or shorter. * * If you need to expand the content use the temporary * memory pool mptmp to allocate the space. */ /* Reverse the string in place, but only if it's long enough. */ if (input_len > 1) { long int i = 0; long int j = input_len - 1; while(i < j) { char c = input[i]; input[i] = input[j]; input[j] = c; i++; j--; } } /* Tell ModSecurity about the content * we have generated. In this case we * merely point back to the input buffer. */ *rval = (char *)input; *rval_len = input_len; /* Must return 1 if the content was * changed, or 0 otherwise. */ return 1; } static int hook_pre_config(apr_pool_t *mp, apr_pool_t *mp_log, apr_pool_t *mp_temp) { void (*fn)(const char *name, void *fn); /* Look for the registration function * exported by ModSecurity. */ fn = APR_RETRIEVE_OPTIONAL_FN(modsec_register_tfn); if (fn) { /* Use it to register our new * transformation function under the * name "reverse". */ fn("reverse", (void *)reverse); } else { ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, NULL, "mod_tfn_reverse: Unable to find modsec_register_tfn."); } return OK; } static void register_hooks(apr_pool_t *p) { ap_hook_pre_config(hook_pre_config, NULL, NULL, APR_HOOK_LAST); } /* Dispatch list for API hooks */ module AP_MODULE_DECLARE_DATA tfn_reverse_module = { STANDARD20_MODULE_STUFF, NULL, /* create per-dir config structures */ NULL, /* merge per-dir config structures */ NULL, /* create per-server config structures */ NULL, /* merge per-server config structures */ NULL, /* table of config file commands */ register_hooks /* register hooks */ }; modsecurity-apache_2.7.7/ext/Makefile.am0000664000175000017500000000343712253711345020501 0ustar zimmerlezimmerle EXT_CFLAGS = -I../apache2 \ @APR_CFLAGS@ \ @APU_CFLAGS@ \ @APXS_CFLAGS@ \ @LIBXML2_CFLAGS@ \ @LUA_CFLAGS@ EXT_CPPFLAGS = @APR_CPPFLAGS@ \ @LIBXML2_CPPFLAGS@ EXT_LIBADD = @APR_LDADD@ \ @APU_LDADD@ \ @LIBXML2_LDADD@ \ @LUA_LDADD@ EXT_LDFLAGS = -no-undefined -module -avoid-version \ @APR_LDFLAGS@ \ @APU_LDFLAGS@ \ @APXS_LDFLAGS@ \ @LIBXML2_LDFLAGS@ \ @LUA_LDFLAGS@ pkglibdir = $(prefix)/lib pkglib_LTLIBRARIES = mod_op_strstr.la \ mod_tfn_reverse.la \ mod_var_remote_addr_port.la \ mod_reqbody_example.la mod_op_strstr_la_SOURCES = mod_op_strstr.c mod_op_strstr_la_CFLAGS = $(EXT_CFLAGS) mod_op_strstr_la_CPPFLAGS = $(EXT_CPPFLAGS) mod_op_strstr_la_LIBADD = $(EXT_LIBADD) mod_op_strstr_la_LDFLAGS = $(EXT_LDFLAGS) mod_tfn_reverse_la_SOURCES = mod_tfn_reverse.c mod_tfn_reverse_la_CFLAGS = $(EXT_CFLAGS) mod_tfn_reverse_la_CPPFLAGS = $(EXT_CPPFLAGS) mod_tfn_reverse_la_LIBADD = $(EXT_LIBADD) mod_tfn_reverse_la_LDFLAGS = $(EXT_LDFLAGS) mod_var_remote_addr_port_la_SOURCES = mod_var_remote_addr_port.c mod_var_remote_addr_port_la_CFLAGS = $(EXT_CFLAGS) mod_var_remote_addr_port_la_CPPFLAGS = $(EXT_CPPFLAGS) mod_var_remote_addr_port_la_LIBADD = $(EXT_LIBADD) mod_var_remote_addr_port_la_LDFLAGS = $(EXT_LDFLAGS) mod_reqbody_example_la_SOURCES = mod_reqbody_example.c mod_reqbody_example_la_CFLAGS = $(EXT_CFLAGS) mod_reqbody_example_la_CPPFLAGS = $(EXT_CPPFLAGS) mod_reqbody_example_la_LIBADD = $(EXT_LIBADD) mod_reqbody_example_la_LDFLAGS = $(EXT_LDFLAGS) install-exec-hook: $(pkglib_LTLIBRARIES) @echo "Removing unused static libraries..."; \ for m in $(pkglib_LTLIBRARIES); do \ base=`echo $$m | sed 's/\..*//'`; \ rm -f $(DESTDIR)$(pkglibdir)/$$base.*a; \ cp -p $(DESTDIR)$(pkglibdir)/$$base.so $(APXS_MODULES); \ done modsecurity-apache_2.7.7/ext/README0000664000175000017500000000512612243422537017323 0ustar zimmerlezimmerleCustom ModSecurity Modules -------------------------- This directory contains three examples how you can extend ModSecurity without having to touch it directly, simply by creating custom Apache modules. NOTE: ModSecurity must be compiled with API support to use this feature (the API is enabled by default, but it will have been disabled if you used -DNO_MODSEC_API). Building the Example Custom Modules ----------------------------------- 1) Example custom transformation function module Module mod_tfn_reverse.c creates a custom transformation function "reverse" that reverses the content it receives on input. # Compile as a normal user apxs -I -I/usr/include/libxml2 \ -ca mod_tfn_reverse.c # Install as superuser sudo apxs -i mod_tfn_reverse.la 2) Example custom operator module Module mod_op_strstr.c creates a custom operator "strstr" that implements fast matching using the Boyer-Moore-Horspool algorithm. # Compile as a normal user apxs -I -I/usr/include/libxml2 \ -ca mod_op_strstr.c # Install as superuser sudo apxs -i mod_op_strstr.la 3) Example custom target variable module Module mod_var_remote_addr_port.c creates a custom variable "REMOTE_ADDR_PORT" that combines the REMOTE_ADDR and REMOTE_PORT into a.b.c.d:port format. # Compile as a normal user apxs -I -I/usr/include/libxml2 \ -ca mod_var_remote_addr_port.c # Install as superuser sudo apxs -i mod_var_remote_addr_port.la 3) Example custom request body parser module Module mod_reqbody_example.c creates a custom request body parser named "EXAMPLE". It does noting in particular, but shows the basic structure of such a module. # Compile as a normal user apxs -I -I/usr/include/libxml2 \ -ca mod_reqbody_example.c # Install as superuser sudo apxs -i mod_var_remote_addr_port.la # Write a phase 1 rule to set the parser SecAction "phase:1,pass,nolog,ctl:requestBodyProcessor=EXAMPLE" Using the Modules ----------------- Once the modules are built and installed, you load them like any other Apache module, but they must be loaded *after* the mod_security2.so module. # Load ModSecurity LoadModule security2_module modules/mod_security2.so # Load ModSecurity custom modules LoadModule tfn_reverse_module modules/mod_tfn_reverse.so LoadModule op_strstr_module modules/mod_op_strstr.so LoadModule var_remote_addr_port_module modules/mod_var_remote_addr_port.so # All three custom var/op/tfn used SecRule REMOTE_ADDR_PORT "@strstr 1.2.3.4:5678" "t:reverse" modsecurity-apache_2.7.7/ext/mod_reqbody_example.c0000664000175000017500000001243612243422537022630 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ /* This is just an example on how to make an extension to allow custom * request body parsing. This just describes how to do this externally * and you should look more at on e of the internal parsers to see * the full potential. * * This module defines "EXAMPLE" and can be enabled with a rule like this: * * SecAction "phase:1,pass,nolog,ctl:requestBodyProcessor=EXAMPLE" * * See these for real parsers: * msc_reqbody.c * msc_multipart.c * msc_xml.c */ #include "httpd.h" #include "http_core.h" #include "http_config.h" #include "http_log.h" #include "http_protocol.h" #include "ap_config.h" #include "apr_optional.h" #include "modsecurity.h" typedef struct example_ctx { unsigned long length; } example_ctx; /** * This function will be invoked to initialize the processor. This is * probably only needed for streaming parsers that must create a context. */ static int example_init(modsec_rec *msr, char **error_msg) { if (error_msg == NULL) return -1; *error_msg = NULL; ap_log_error(APLOG_MARK, APLOG_INFO | APLOG_NOERRNO, 0, NULL, "mod_reqbody_example: init()"); msr->reqbody_processor_ctx = apr_pcalloc(msr->mp, sizeof(example_ctx)); if (msr->reqbody_processor_ctx == NULL) { /* Set error message and return -1 if unsuccessful */ *error_msg = apr_pstrdup(msr->mp, "failed to create example requbody processor context"); return -1; } /* Return 1 on success */ return 1; } /** * This function will be invoked whenever the ModSecurity has data to * be processed. You probably at least need to increment the no_files * length, but otherwise this is only useful for a streaming parser. */ static int example_process(modsec_rec *msr, const char *buf, unsigned int size, char **error_msg) { example_ctx *ctx = (example_ctx *)msr->reqbody_processor_ctx; if (error_msg == NULL) return -1; *error_msg = NULL; ap_log_error(APLOG_MARK, APLOG_INFO | APLOG_NOERRNO, 0, NULL, "mod_reqbody_example: process()"); /* Need to increment the no_files length if this is not an uploaded file. * Failing to do this will mess up some other limit checks. */ msr->msc_reqbody_no_files_length += size; /* Check for an existing context and do something interesting * with the chunk of data we have been given. */ if (ctx != NULL) { ctx->length += size; } /* Return 1 on success */ return 1; } /** * This function is called to signal the parser that the request body is * complete. Here you should do any final parsing. For non-streaming parsers * you can parse the data in msr->msc_reqbody_buffer of length * msr->msc_reqbody_length. See modsecurity_request_body_end_urlencoded() in * msc_reqbody.c for an example of this. */ static int example_complete(modsec_rec *msr, char **error_msg) { example_ctx *ctx = (example_ctx *)msr->reqbody_processor_ctx; if (error_msg == NULL) return -1; *error_msg = NULL; ap_log_error(APLOG_MARK, APLOG_INFO | APLOG_NOERRNO, 0, NULL, "mod_reqbody_example: complete()"); ap_log_error(APLOG_MARK, APLOG_INFO | APLOG_NOERRNO, 0, NULL, "mod_reqbody_example: request body length=%lu", ctx->length); /* Return 1 on success */ return 1; } static int hook_pre_config(apr_pool_t *mp, apr_pool_t *mp_log, apr_pool_t *mp_temp) { void (*fn)(const char *name, void *fn_init, void *fn_process, void *fn_complete); /* Look for the registration function exported by ModSecurity. */ fn = APR_RETRIEVE_OPTIONAL_FN(modsec_register_reqbody_processor); if (fn) { /* Use it to register our new request body parser functions under * the name "EXAMPLE". */ fn("EXAMPLE", (void *)example_init, (void *)example_process, (void *)example_complete); } else { ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, NULL, "mod_reqbody_example: Unable to find modsec_register_reqbody_processor."); } return OK; } /* This is a function to register another function to be called during * the Apache configuration process. */ static void register_hooks(apr_pool_t *p) { ap_hook_pre_config(hook_pre_config, NULL, NULL, APR_HOOK_LAST); } /* Dispatch list for API hooks */ module AP_MODULE_DECLARE_DATA reqbody_example_module = { STANDARD20_MODULE_STUFF, NULL, /* create per-dir config structures */ NULL, /* merge per-dir config structures */ NULL, /* create per-server config structures */ NULL, /* merge per-server config structures */ NULL, /* table of config file commands */ register_hooks /* register hooks */ }; modsecurity-apache_2.7.7/ext/mod_var_remote_addr_port.c0000664000175000017500000000704112243422537023645 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #include "httpd.h" #include "http_core.h" #include "http_config.h" #include "http_log.h" #include "http_protocol.h" #include "ap_config.h" #include "apr_optional.h" #include "modsecurity.h" /* -- Generic generators/validators from re_variables.c -- */ /** * Generates a variable from a string and a length. */ static int var_simple_generate_ex(msre_var *var, apr_table_t *vartab, apr_pool_t *mptmp, const char *value, int value_len) { msre_var *rvar = NULL; if (value == NULL) return 0; rvar = apr_pmemdup(mptmp, var, sizeof(msre_var)); rvar->value = value; rvar->value_len = value_len; apr_table_addn(vartab, rvar->name, (void *)rvar); return 1; } /** * Generates a variable from a NULL-terminated string. */ static int var_simple_generate(msre_var *var, apr_table_t *vartab, apr_pool_t *mptmp, const char *value) { if (value == NULL) return 0; return var_simple_generate_ex(var, vartab, mptmp, value, strlen(value)); } /* -- Module specific code -- */ /** * Create a silly variable with value = a.b.c.d:port */ static int var_remote_addr_port_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *vartab, apr_pool_t *mptmp) { const char *value = apr_psprintf(mptmp, "%s:%d", msr->remote_addr, msr->remote_port); return var_simple_generate(var, vartab, mptmp, value); } static int hook_pre_config(apr_pool_t *mp, apr_pool_t *mp_log, apr_pool_t *mp_temp) { void (*register_fn)(const char *name, unsigned int type, unsigned int argc_min, unsigned int argc_max, void *fn_validate, void *fn_generate, unsigned int is_cacheable, unsigned int availability); /* Look for the registration function * exported by ModSecurity. */ register_fn = APR_RETRIEVE_OPTIONAL_FN(modsec_register_variable); if (register_fn) { /* Use it to register our new * variable under the * name "REMOTE_ADDR_PORT". */ register_fn( "REMOTE_ADDR_PORT", VAR_SIMPLE, 0, 0, NULL, var_remote_addr_port_generate, VAR_DONT_CACHE, PHASE_REQUEST_HEADERS ); } else { ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, NULL, "mod_var_remote_addr_port: Unable to find modsec_register_variable."); } return OK; } static void register_hooks(apr_pool_t *p) { ap_hook_pre_config(hook_pre_config, NULL, NULL, APR_HOOK_LAST); } /* Dispatch list for API hooks */ module AP_MODULE_DECLARE_DATA var_remote_addr_port_module = { STANDARD20_MODULE_STUFF, NULL, /* create per-dir config structures */ NULL, /* merge per-dir config structures */ NULL, /* create per-server config structures */ NULL, /* merge per-server config structures */ NULL, /* table of config file commands */ register_hooks /* register hooks */ }; modsecurity-apache_2.7.7/ext/Makefile.in0000664000175000017500000007717212254306021020511 0ustar zimmerlezimmerle# Makefile.in generated by automake 1.13.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = ext DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/build/depcomp README ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/build/find_apr.m4 \ $(top_srcdir)/build/find_apu.m4 \ $(top_srcdir)/build/find_curl.m4 \ $(top_srcdir)/build/find_lua.m4 \ $(top_srcdir)/build/find_pcre.m4 \ $(top_srcdir)/build/find_xml.m4 $(top_srcdir)/build/libtool.m4 \ $(top_srcdir)/build/ltoptions.m4 \ $(top_srcdir)/build/ltsugar.m4 \ $(top_srcdir)/build/ltversion.m4 \ $(top_srcdir)/build/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/apache2/modsecurity_config_auto.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(pkglibdir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) am__DEPENDENCIES_1 = mod_op_strstr_la_DEPENDENCIES = $(am__DEPENDENCIES_1) am_mod_op_strstr_la_OBJECTS = mod_op_strstr_la-mod_op_strstr.lo mod_op_strstr_la_OBJECTS = $(am_mod_op_strstr_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = mod_op_strstr_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(mod_op_strstr_la_CFLAGS) $(CFLAGS) \ $(mod_op_strstr_la_LDFLAGS) $(LDFLAGS) -o $@ mod_reqbody_example_la_DEPENDENCIES = $(am__DEPENDENCIES_1) am_mod_reqbody_example_la_OBJECTS = \ mod_reqbody_example_la-mod_reqbody_example.lo mod_reqbody_example_la_OBJECTS = $(am_mod_reqbody_example_la_OBJECTS) mod_reqbody_example_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(mod_reqbody_example_la_CFLAGS) $(CFLAGS) \ $(mod_reqbody_example_la_LDFLAGS) $(LDFLAGS) -o $@ mod_tfn_reverse_la_DEPENDENCIES = $(am__DEPENDENCIES_1) am_mod_tfn_reverse_la_OBJECTS = mod_tfn_reverse_la-mod_tfn_reverse.lo mod_tfn_reverse_la_OBJECTS = $(am_mod_tfn_reverse_la_OBJECTS) mod_tfn_reverse_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(mod_tfn_reverse_la_CFLAGS) $(CFLAGS) \ $(mod_tfn_reverse_la_LDFLAGS) $(LDFLAGS) -o $@ mod_var_remote_addr_port_la_DEPENDENCIES = $(am__DEPENDENCIES_1) am_mod_var_remote_addr_port_la_OBJECTS = \ mod_var_remote_addr_port_la-mod_var_remote_addr_port.lo mod_var_remote_addr_port_la_OBJECTS = \ $(am_mod_var_remote_addr_port_la_OBJECTS) mod_var_remote_addr_port_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(mod_var_remote_addr_port_la_CFLAGS) $(CFLAGS) \ $(mod_var_remote_addr_port_la_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/apache2 depcomp = $(SHELL) $(top_srcdir)/build/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(mod_op_strstr_la_SOURCES) \ $(mod_reqbody_example_la_SOURCES) \ $(mod_tfn_reverse_la_SOURCES) \ $(mod_var_remote_addr_port_la_SOURCES) DIST_SOURCES = $(mod_op_strstr_la_SOURCES) \ $(mod_reqbody_example_la_SOURCES) \ $(mod_tfn_reverse_la_SOURCES) \ $(mod_var_remote_addr_port_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) pkglibdir = $(prefix)/lib ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APR_CFLAGS = @APR_CFLAGS@ APR_CONFIG = @APR_CONFIG@ APR_CPPFLAGS = @APR_CPPFLAGS@ APR_INCLUDEDIR = @APR_INCLUDEDIR@ APR_LDADD = @APR_LDADD@ APR_LDFLAGS = @APR_LDFLAGS@ APR_LINKLD = @APR_LINKLD@ APR_VERSION = @APR_VERSION@ APU_CFLAGS = @APU_CFLAGS@ APU_CONFIG = @APU_CONFIG@ APU_INCLUDEDIR = @APU_INCLUDEDIR@ APU_LDADD = @APU_LDADD@ APU_LDFLAGS = @APU_LDFLAGS@ APU_LINKLD = @APU_LINKLD@ APU_VERSION = @APU_VERSION@ APXS = @APXS@ APXS_BINDIR = @APXS_BINDIR@ APXS_CC = @APXS_CC@ APXS_CFLAGS = @APXS_CFLAGS@ APXS_EXTRA_CFLAGS = @APXS_EXTRA_CFLAGS@ APXS_HTTPD = @APXS_HTTPD@ APXS_INCLUDEDIR = @APXS_INCLUDEDIR@ APXS_INCLUDES = @APXS_INCLUDES@ APXS_LDFLAGS = @APXS_LDFLAGS@ APXS_LIBDIR = @APXS_LIBDIR@ APXS_LIBEXECDIR = @APXS_LIBEXECDIR@ APXS_LIBS = @APXS_LIBS@ APXS_LIBTOOL = @APXS_LIBTOOL@ APXS_MODULES = @APXS_MODULES@ APXS_PROGNAME = @APXS_PROGNAME@ APXS_SBINDIR = @APXS_SBINDIR@ APXS_WRAPPER = @APXS_WRAPPER@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CURL_CFLAGS = @CURL_CFLAGS@ CURL_CONFIG = @CURL_CONFIG@ CURL_CPPFLAGS = @CURL_CPPFLAGS@ CURL_LDADD = @CURL_LDADD@ CURL_LDFLAGS = @CURL_LDFLAGS@ CURL_USES_GNUTLS = @CURL_USES_GNUTLS@ CURL_VERSION = @CURL_VERSION@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENV_CMD = @ENV_CMD@ EXEEXT = @EXEEXT@ EXTRA_CFLAGS = @EXTRA_CFLAGS@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ LIBXML2_CONFIG = @LIBXML2_CONFIG@ LIBXML2_CPPFLAGS = @LIBXML2_CPPFLAGS@ LIBXML2_LDADD = @LIBXML2_LDADD@ LIBXML2_LDFLAGS = @LIBXML2_LDFLAGS@ LIBXML2_VERSION = @LIBXML2_VERSION@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LUA_CFLAGS = @LUA_CFLAGS@ LUA_LDADD = @LUA_LDADD@ LUA_LDFLAGS = @LUA_LDFLAGS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MODSEC_APXS_EXTRA_CFLAGS = @MODSEC_APXS_EXTRA_CFLAGS@ MODSEC_EXTRA_CFLAGS = @MODSEC_EXTRA_CFLAGS@ MSC_BASE_DIR = @MSC_BASE_DIR@ MSC_PKGBASE_DIR = @MSC_PKGBASE_DIR@ MSC_REGRESSION_CONF_DIR = @MSC_REGRESSION_CONF_DIR@ MSC_REGRESSION_DIR = @MSC_REGRESSION_DIR@ MSC_REGRESSION_DOCROOT_DIR = @MSC_REGRESSION_DOCROOT_DIR@ MSC_REGRESSION_LOGS_DIR = @MSC_REGRESSION_LOGS_DIR@ MSC_REGRESSION_SERVERROOT_DIR = @MSC_REGRESSION_SERVERROOT_DIR@ MSC_TEST_DIR = @MSC_TEST_DIR@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCRE_CFLAGS = @PCRE_CFLAGS@ PCRE_CONFIG = @PCRE_CONFIG@ PCRE_CPPFLAGS = @PCRE_CPPFLAGS@ PCRE_LDADD = @PCRE_LDADD@ PCRE_LDFLAGS = @PCRE_LDFLAGS@ PCRE_LD_PATH = @PCRE_LD_PATH@ PCRE_VERSION = @PCRE_VERSION@ PERL = @PERL@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOPLEVEL_SUBDIRS = @TOPLEVEL_SUBDIRS@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXT_CFLAGS = -I../apache2 \ @APR_CFLAGS@ \ @APU_CFLAGS@ \ @APXS_CFLAGS@ \ @LIBXML2_CFLAGS@ \ @LUA_CFLAGS@ EXT_CPPFLAGS = @APR_CPPFLAGS@ \ @LIBXML2_CPPFLAGS@ EXT_LIBADD = @APR_LDADD@ \ @APU_LDADD@ \ @LIBXML2_LDADD@ \ @LUA_LDADD@ EXT_LDFLAGS = -no-undefined -module -avoid-version \ @APR_LDFLAGS@ \ @APU_LDFLAGS@ \ @APXS_LDFLAGS@ \ @LIBXML2_LDFLAGS@ \ @LUA_LDFLAGS@ pkglib_LTLIBRARIES = mod_op_strstr.la \ mod_tfn_reverse.la \ mod_var_remote_addr_port.la \ mod_reqbody_example.la mod_op_strstr_la_SOURCES = mod_op_strstr.c mod_op_strstr_la_CFLAGS = $(EXT_CFLAGS) mod_op_strstr_la_CPPFLAGS = $(EXT_CPPFLAGS) mod_op_strstr_la_LIBADD = $(EXT_LIBADD) mod_op_strstr_la_LDFLAGS = $(EXT_LDFLAGS) mod_tfn_reverse_la_SOURCES = mod_tfn_reverse.c mod_tfn_reverse_la_CFLAGS = $(EXT_CFLAGS) mod_tfn_reverse_la_CPPFLAGS = $(EXT_CPPFLAGS) mod_tfn_reverse_la_LIBADD = $(EXT_LIBADD) mod_tfn_reverse_la_LDFLAGS = $(EXT_LDFLAGS) mod_var_remote_addr_port_la_SOURCES = mod_var_remote_addr_port.c mod_var_remote_addr_port_la_CFLAGS = $(EXT_CFLAGS) mod_var_remote_addr_port_la_CPPFLAGS = $(EXT_CPPFLAGS) mod_var_remote_addr_port_la_LIBADD = $(EXT_LIBADD) mod_var_remote_addr_port_la_LDFLAGS = $(EXT_LDFLAGS) mod_reqbody_example_la_SOURCES = mod_reqbody_example.c mod_reqbody_example_la_CFLAGS = $(EXT_CFLAGS) mod_reqbody_example_la_CPPFLAGS = $(EXT_CPPFLAGS) mod_reqbody_example_la_LIBADD = $(EXT_LIBADD) mod_reqbody_example_la_LDFLAGS = $(EXT_LDFLAGS) all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign ext/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign ext/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(MKDIR_P) '$(DESTDIR)$(pkglibdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ } uninstall-pkglibLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ done clean-pkglibLTLIBRARIES: -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) @list='$(pkglib_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } mod_op_strstr.la: $(mod_op_strstr_la_OBJECTS) $(mod_op_strstr_la_DEPENDENCIES) $(EXTRA_mod_op_strstr_la_DEPENDENCIES) $(AM_V_CCLD)$(mod_op_strstr_la_LINK) -rpath $(pkglibdir) $(mod_op_strstr_la_OBJECTS) $(mod_op_strstr_la_LIBADD) $(LIBS) mod_reqbody_example.la: $(mod_reqbody_example_la_OBJECTS) $(mod_reqbody_example_la_DEPENDENCIES) $(EXTRA_mod_reqbody_example_la_DEPENDENCIES) $(AM_V_CCLD)$(mod_reqbody_example_la_LINK) -rpath $(pkglibdir) $(mod_reqbody_example_la_OBJECTS) $(mod_reqbody_example_la_LIBADD) $(LIBS) mod_tfn_reverse.la: $(mod_tfn_reverse_la_OBJECTS) $(mod_tfn_reverse_la_DEPENDENCIES) $(EXTRA_mod_tfn_reverse_la_DEPENDENCIES) $(AM_V_CCLD)$(mod_tfn_reverse_la_LINK) -rpath $(pkglibdir) $(mod_tfn_reverse_la_OBJECTS) $(mod_tfn_reverse_la_LIBADD) $(LIBS) mod_var_remote_addr_port.la: $(mod_var_remote_addr_port_la_OBJECTS) $(mod_var_remote_addr_port_la_DEPENDENCIES) $(EXTRA_mod_var_remote_addr_port_la_DEPENDENCIES) $(AM_V_CCLD)$(mod_var_remote_addr_port_la_LINK) -rpath $(pkglibdir) $(mod_var_remote_addr_port_la_OBJECTS) $(mod_var_remote_addr_port_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mod_op_strstr_la-mod_op_strstr.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mod_reqbody_example_la-mod_reqbody_example.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mod_tfn_reverse_la-mod_tfn_reverse.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mod_var_remote_addr_port_la-mod_var_remote_addr_port.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mod_op_strstr_la-mod_op_strstr.lo: mod_op_strstr.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_op_strstr_la_CPPFLAGS) $(CPPFLAGS) $(mod_op_strstr_la_CFLAGS) $(CFLAGS) -MT mod_op_strstr_la-mod_op_strstr.lo -MD -MP -MF $(DEPDIR)/mod_op_strstr_la-mod_op_strstr.Tpo -c -o mod_op_strstr_la-mod_op_strstr.lo `test -f 'mod_op_strstr.c' || echo '$(srcdir)/'`mod_op_strstr.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mod_op_strstr_la-mod_op_strstr.Tpo $(DEPDIR)/mod_op_strstr_la-mod_op_strstr.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mod_op_strstr.c' object='mod_op_strstr_la-mod_op_strstr.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_op_strstr_la_CPPFLAGS) $(CPPFLAGS) $(mod_op_strstr_la_CFLAGS) $(CFLAGS) -c -o mod_op_strstr_la-mod_op_strstr.lo `test -f 'mod_op_strstr.c' || echo '$(srcdir)/'`mod_op_strstr.c mod_reqbody_example_la-mod_reqbody_example.lo: mod_reqbody_example.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_reqbody_example_la_CPPFLAGS) $(CPPFLAGS) $(mod_reqbody_example_la_CFLAGS) $(CFLAGS) -MT mod_reqbody_example_la-mod_reqbody_example.lo -MD -MP -MF $(DEPDIR)/mod_reqbody_example_la-mod_reqbody_example.Tpo -c -o mod_reqbody_example_la-mod_reqbody_example.lo `test -f 'mod_reqbody_example.c' || echo '$(srcdir)/'`mod_reqbody_example.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mod_reqbody_example_la-mod_reqbody_example.Tpo $(DEPDIR)/mod_reqbody_example_la-mod_reqbody_example.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mod_reqbody_example.c' object='mod_reqbody_example_la-mod_reqbody_example.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_reqbody_example_la_CPPFLAGS) $(CPPFLAGS) $(mod_reqbody_example_la_CFLAGS) $(CFLAGS) -c -o mod_reqbody_example_la-mod_reqbody_example.lo `test -f 'mod_reqbody_example.c' || echo '$(srcdir)/'`mod_reqbody_example.c mod_tfn_reverse_la-mod_tfn_reverse.lo: mod_tfn_reverse.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_tfn_reverse_la_CPPFLAGS) $(CPPFLAGS) $(mod_tfn_reverse_la_CFLAGS) $(CFLAGS) -MT mod_tfn_reverse_la-mod_tfn_reverse.lo -MD -MP -MF $(DEPDIR)/mod_tfn_reverse_la-mod_tfn_reverse.Tpo -c -o mod_tfn_reverse_la-mod_tfn_reverse.lo `test -f 'mod_tfn_reverse.c' || echo '$(srcdir)/'`mod_tfn_reverse.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mod_tfn_reverse_la-mod_tfn_reverse.Tpo $(DEPDIR)/mod_tfn_reverse_la-mod_tfn_reverse.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mod_tfn_reverse.c' object='mod_tfn_reverse_la-mod_tfn_reverse.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_tfn_reverse_la_CPPFLAGS) $(CPPFLAGS) $(mod_tfn_reverse_la_CFLAGS) $(CFLAGS) -c -o mod_tfn_reverse_la-mod_tfn_reverse.lo `test -f 'mod_tfn_reverse.c' || echo '$(srcdir)/'`mod_tfn_reverse.c mod_var_remote_addr_port_la-mod_var_remote_addr_port.lo: mod_var_remote_addr_port.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_var_remote_addr_port_la_CPPFLAGS) $(CPPFLAGS) $(mod_var_remote_addr_port_la_CFLAGS) $(CFLAGS) -MT mod_var_remote_addr_port_la-mod_var_remote_addr_port.lo -MD -MP -MF $(DEPDIR)/mod_var_remote_addr_port_la-mod_var_remote_addr_port.Tpo -c -o mod_var_remote_addr_port_la-mod_var_remote_addr_port.lo `test -f 'mod_var_remote_addr_port.c' || echo '$(srcdir)/'`mod_var_remote_addr_port.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mod_var_remote_addr_port_la-mod_var_remote_addr_port.Tpo $(DEPDIR)/mod_var_remote_addr_port_la-mod_var_remote_addr_port.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mod_var_remote_addr_port.c' object='mod_var_remote_addr_port_la-mod_var_remote_addr_port.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mod_var_remote_addr_port_la_CPPFLAGS) $(CPPFLAGS) $(mod_var_remote_addr_port_la_CFLAGS) $(CFLAGS) -c -o mod_var_remote_addr_port_la-mod_var_remote_addr_port.lo `test -f 'mod_var_remote_addr_port.c' || echo '$(srcdir)/'`mod_var_remote_addr_port.c mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: for dir in "$(DESTDIR)$(pkglibdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-pkglibLTLIBRARIES @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) install-exec-hook install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkglibLTLIBRARIES .MAKE: install-am install-exec-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-libtool clean-pkglibLTLIBRARIES cscopelist-am ctags \ ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-exec-hook install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-pkglibLTLIBRARIES install-ps \ install-ps-am install-strip installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ uninstall-am uninstall-pkglibLTLIBRARIES install-exec-hook: $(pkglib_LTLIBRARIES) @echo "Removing unused static libraries..."; \ for m in $(pkglib_LTLIBRARIES); do \ base=`echo $$m | sed 's/\..*//'`; \ rm -f $(DESTDIR)$(pkglibdir)/$$base.*a; \ cp -p $(DESTDIR)$(pkglibdir)/$$base.so $(APXS_MODULES); \ done # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: modsecurity-apache_2.7.7/configure.ac0000664000175000017500000004654412253711345020141 0ustar zimmerlezimmerlednl dnl Autoconf configuration for ModSecurity dnl dnl Use ./autogen.sh to produce a configure script dnl AC_PREREQ(2.63) AC_INIT([modsecurity], [2.7], [support@modsecurity.org]) AC_CONFIG_MACRO_DIR([build]) AC_CONFIG_SRCDIR([LICENSE]) AC_CONFIG_HEADERS([apache2/modsecurity_config_auto.h]) AC_CONFIG_AUX_DIR([build]) AC_PREFIX_DEFAULT([/usr/local/modsecurity]) AM_INIT_AUTOMAKE([-Wall foreign]) m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) LT_PREREQ([2.2]) LT_INIT([dlopen]) # Checks for programs. AC_PROG_AWK AC_PROG_CC AC_PROG_CPP AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET AC_PROG_GREP AC_PATH_PROGS(PERL, [perl perl5], ) AC_PATH_PROGS(ENV_CMD, [env printenv], ) # Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS([fcntl.h limits.h stdlib.h string.h unistd.h sys/types.h sys/stat.h]) # Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_C_INLINE AC_C_RESTRICT AC_TYPE_PID_T AC_TYPE_SIZE_T AC_STRUCT_TM AC_TYPE_UINT8_T # Checks for library functions. AC_FUNC_MALLOC AC_FUNC_MEMCMP AC_CHECK_FUNCS([atexit getcwd memmove memset strcasecmp strchr strdup strerror strncasecmp strrchr strstr strtol fchmod strcasestr]) # Some directories MSC_BASE_DIR=`pwd` MSC_PKGBASE_DIR="$MSC_BASE_DIR/.." MSC_TEST_DIR="$MSC_BASE_DIR/tests" MSC_REGRESSION_DIR="$MSC_TEST_DIR/regression" MSC_REGRESSION_SERVERROOT_DIR="$MSC_REGRESSION_DIR/server_root" MSC_REGRESSION_CONF_DIR="$MSC_REGRESSION_SERVERROOT_DIR/conf" MSC_REGRESSION_LOGS_DIR="$MSC_REGRESSION_SERVERROOT_DIR/logs" MSC_REGRESSION_DOCROOT_DIR="$MSC_REGRESSION_SERVERROOT_DIR/htdocs" AC_SUBST(MSC_BASE_DIR) AC_SUBST(MSC_PKGBASE_DIR) AC_SUBST(MSC_TEST_DIR) AC_SUBST(MSC_REGRESSION_DIR) AC_SUBST(MSC_REGRESSION_SERVERROOT_DIR) AC_SUBST(MSC_REGRESSION_CONF_DIR) AC_SUBST(MSC_REGRESSION_LOGS_DIR) AC_SUBST(MSC_REGRESSION_DOCROOT_DIR) ### Configure Options #OS type AC_CANONICAL_HOST CANONICAL_HOST=$host AH_TEMPLATE([AIX], [Define if the operating system is AIX]) AH_TEMPLATE([LINUX], [Define if the operating system is LINUX]) AH_TEMPLATE([OPENBSD], [Define if the operating system is OpenBSD]) AH_TEMPLATE([SOLARIS], [Define if the operating system is SOLARIS]) AH_TEMPLATE([HPUX], [Define if the operating system is HPUX]) AH_TEMPLATE([MACOSX], [Define if the operating system is Macintosh OSX]) AH_TEMPLATE([FREEBSD], [Define if the operating system is FREEBSD]) AH_TEMPLATE([NETBSD], [Define if the operating system is NetBSD]) case $host in *-*-aix*) echo "Checking plataform... Identified as AIX" aixos=true ;; *-*-hpux*) echo "Checking plataform... Identified as HPUX" hpuxos=true ;; *-*-darwin*) echo "Checking plataform... Identified as Macintosh OS X" macos=true ;; *-*-linux*) echo "Checking plataform... Identified as Linux" linuxos=true case "${host_cpu}" in s390x) cpu_type="-DLINUX_S390" ;; esac ;; *-*-solaris*) echo "Checking plataform... Identified as Solaris" solarisos=true ;; *-*-freebsd*) echo "Checking plataform... Identified as FreeBSD" freebsdos=true ;; *-*-netbsd*) echo "Checking plataform... Identified as NetBSD" netbsdos=true ;; *-*-openbsd*) echo "Checking plataform... Identified as OpenBSD" openbsdos=true ;; *-*-kfreebsd*) echo "Checking plataform... Identified as kFreeBSD, treating as linux" linuxos=true ;; *-*-gnu*.*) echo "Checking plataform... Identified as HURD, treating as linux" linuxos=true ;; *) echo "Unknown CANONICAL_HOST $host" exit ;; esac AM_CONDITIONAL([AIX], [test x$aixos = xtrue]) AM_CONDITIONAL([HPUX], [test x$hpuxos = xtrue]) AM_CONDITIONAL([MACOSX], [test x$macos = xtrue]) AM_CONDITIONAL([LINUX], [test x$linuxos = xtrue]) AM_CONDITIONAL([LINUX390], [test x$linuxos390 = xtrue]) AM_CONDITIONAL([SOLARIS], [test x$solarisos = xtrue]) AM_CONDITIONAL([FREEBSD], [test x$freebsdos = xtrue]) AM_CONDITIONAL([OPENBSD], [test x$openbsdos = xtrue]) AM_CONDITIONAL([NETBSD], [test x$netbsdos = xtrue]) #Subdirs TOPLEVEL_SUBDIRS="tools" # Apache2 Module AC_ARG_ENABLE(apache2-module, AS_HELP_STRING([--disable-apache2-module], [Disable building Apache2 module.]), [ if test "$enableval" != "no"; then build_apache2_module=1 else build_apache2_module=0 fi ], [ build_apache2_module=1 ]) AM_CONDITIONAL([BUILD_APACHE2_MODULE], [test "$build_apache2_module" -eq 1]) if test "$build_apache2_module" -eq 1; then TOPLEVEL_SUBDIRS="$TOPLEVEL_SUBDIRS apache2" fi # Standalone Module AC_ARG_ENABLE(standalone-module, AS_HELP_STRING([--enable-standalone-module], [Enable building standalone module.]), [ if test "$enableval" != "no"; then build_standalone_module=1 else build_standalone_module=0 fi ], [ build_standalone_module=0 ]) AM_CONDITIONAL([BUILD_STANDALONE_MODULE], [test "$build_standalone_module" -eq 1]) if test "$build_standalone_module" -eq 1; then TOPLEVEL_SUBDIRS="$TOPLEVEL_SUBDIRS standalone" fi # Extensions AC_ARG_ENABLE(extentions, AS_HELP_STRING([--enable-extentions], [Enable building extension.]), [ if test "$enableval" != "no"; then build_extentions=1 else build_extentions=0 fi ], [ build_extentions=0 ]) AM_CONDITIONAL([BUILD_extentions], [test "$build_extentions" -eq 1]) if test "$build_extentions" -eq 1; then TOPLEVEL_SUBDIRS="$TOPLEVEL_SUBDIRS ext" fi # Mlogc AC_ARG_ENABLE(mlogc, AS_HELP_STRING([--disable-mlogc], [Disable building mlogc.]), [ if test "$enableval" != "no"; then build_mlogc=1 else build_mlogc=0 fi ], [ build_mlogc=1 ]) AM_CONDITIONAL([BUILD_MLOGC], [test "$build_mlogc" -eq 1]) if test "$build_mlogc" -eq 1; then TOPLEVEL_SUBDIRS="$TOPLEVEL_SUBDIRS mlogc" fi # Audit Log Parser v2 (ALP2) AC_ARG_ENABLE(alp2, AS_HELP_STRING([--enable-alp2], [Enable building audit log parser lib.]), [ if test "$enableval" != "no"; then build_alp2=1 else build_alp2=0 fi ], [ build_alp2=0 ]) AM_CONDITIONAL([BUILD_ALP2], [test "$build_alp2" -eq 1]) if test "$build_alp2" -eq 1; then TOPLEVEL_SUBDIRS="$TOPLEVEL_SUBDIRS alp2" fi # Documentation AC_ARG_ENABLE(docs, AS_HELP_STRING([--enable-docs], [Enable building documentation.]), [ if test "$enableval" != "no"; then build_docs=1 else build_docs=0 fi ], [ build_docs=0 ]) AM_CONDITIONAL([BUILD_DOCS], [test "$build_docs" -eq 1]) if test "$build_docs" -eq 1; then TOPLEVEL_SUBDIRS="$TOPLEVEL_SUBDIRS docs" fi # Add PCRE Studying AC_ARG_ENABLE(pcre-study, AS_HELP_STRING([--enable-pcre-study], [Enable PCRE regex studying during configure.]), [ if test "$enableval" != "no"; then pcre_study='-DWITH_PCRE_STUDY' MODSEC_EXTRA_CFLAGS="$MODSEC_EXTRA_CFLAGS $pcre_study" else pcre_study='' fi ], [ pcre_study='-DWITH_PCRE_STUDY' ]) # Add PCRE JIT AC_ARG_ENABLE(pcre-jit, AS_HELP_STRING([--enable-pcre-jit], [Enable PCRE regex jit support during configure.]), [ if test "$enableval" != "no"; then pcre_jit='-DWITH_PCRE_JIT' MODSEC_EXTRA_CFLAGS="$MODSEC_EXTRA_CFLAGS $pcre_jit" else pcre_jit='' fi ], [ pcre_jit='' ]) # Limit PCRE matching AC_ARG_ENABLE(pcre-match-limit, AS_HELP_STRING([--enable-pcre-match-limit], [Enable PCRE regex match limit during configure.]), [ if test "$enableval" = "yes"; then AC_MSG_ERROR([PCRE match limits require a numeric value]) elif test "$enableval" = "no"; then pcre_match_limit='' else pcre_match_limit="-DMODSEC_PCRE_MATCH_LIMIT=$enableval" MODSEC_EXTRA_CFLAGS="$MODSEC_EXTRA_CFLAGS $pcre_match_limit" fi ], [ pcre_match_limit='-DMODSEC_PCRE_MATCH_LIMIT=1500' ]) # Limit PCRE matching recursion AC_ARG_ENABLE(pcre-match-limit-recursion, AS_HELP_STRING([--enable-pcre-match-limit-recursion], [Enable PCRE regex match limit recursion during configure.]), [ if test "$enableval" = "yes"; then AC_MSG_ERROR([PCRE match limits require a numeric value]) elif test "$enableval" = "no"; then pcre_match_limit_recursion='' else pcre_match_limit_recursion="-DMODSEC_PCRE_MATCH_LIMIT_RECURSION=$enableval" MODSEC_EXTRA_CFLAGS="$MODSEC_EXTRA_CFLAGS $pcre_match_limit_recursion" fi ], [ pcre_match_limit_recursion='-DMODSEC_PCRE_MATCH_LIMIT_RECURSION=1500' ]) # Enable Lua per transaction cache AC_ARG_ENABLE(lua-cache, AS_HELP_STRING([--enable-lua-cache], [Enable Lua per transaction cache.]), [ if test "$enableval" != "no"; then lua_cache="-DCACHE_LUA" MODSEC_EXTRA_CFLAGS="$MODSEC_EXTRA_CFLAGS $lua_cache" else lua_cache= fi ], [ lua_cache= ]) # Enable phase-1 in post_read_request AC_ARG_ENABLE(htaccess-config, AS_HELP_STRING([--enable-htaccess-config], [Enable some mod_security directives into htaccess files.]), [ if test "$enableval" != "no"; then htaccess_config="-DHTACCESS_CONFIG" MODSEC_EXTRA_CFLAGS="$MODSEC_EXTRA_CFLAGS $htaccess_config" else htaccess_config= fi ], [ htaccess_config= ]) # Enable phase-1 in post_read_request AC_ARG_ENABLE(request-early, AS_HELP_STRING([--enable-request-early], [Place phase1 into post_read_request hook. default is hook_request_early]), [ if test "$enableval" != "no"; then request_early="-DREQUEST_EARLY" MODSEC_EXTRA_CFLAGS="$MODSEC_EXTRA_CFLAGS $request_early" else request_early= fi ], [ request_early='-DREQUEST_EARLY' ]) # Ignore configure errors AC_ARG_ENABLE(errors, AS_HELP_STRING([--disable-errors], [Disable errors during configure.]), [ if test "$enableval" != "no"; then report_errors=1 else report_errors=0 fi ], [ report_errors=1 ]) # Verbose output AC_ARG_ENABLE(verbose-output, AS_HELP_STRING([--enable-verbose-output], [Enable more verbose configure output.]), [ if test "$enableval" != "no"; then verbose_output=1 else verbose_output=0 fi ], [ verbose_output=0 ]) # Strict Compile AC_ARG_ENABLE(strict-compile, AS_HELP_STRING([--enable-strict-compile], [Enable strict compilation (warnings are errors).]), [ if test "$enableval" != "no"; then strict_compile="-std=c99 -Wstrict-overflow=1 -Wextra -Wno-missing-field-initializers -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wno-unused-parameter -Wformat -Wformat-security -Werror -fstack-protector -D_FORTIFY_SOURCE=2" MODSEC_EXTRA_CFLAGS="$MODSEC_EXTRA_CFLAGS $strict_compile" else strict_compile= fi ], [ strict_compile= ]) # DEBUG_CONF AC_ARG_ENABLE(debug-conf, AS_HELP_STRING([--enable-debug-conf], [Enable debug during configuration.]), [ if test "$enableval" != "no"; then debug_conf="-DDEBUG_CONF" MODSEC_EXTRA_CFLAGS="$MODSEC_EXTRA_CFLAGS $debug_conf" else debug_conf= fi ], [ debug_conf= ]) # CACHE_DEBUG AC_ARG_ENABLE(debug-cache, AS_HELP_STRING([--enable-debug-cache], [Enable debug for transformation caching.]), [ if test "$enableval" != "no"; then debug_cache="-DCACHE_DEBUG" MODSEC_EXTRA_CFLAGS="$MODSEC_EXTRA_CFLAGS $debug_cache" else debug_cache= fi ], [ debug_cache= ]) # DEBUG_ACMP AC_ARG_ENABLE(debug-acmp, AS_HELP_STRING([--enable-debug-acmp], [Enable debugging acmp code.]), [ if test "$enableval" != "no"; then debug_acmp="-DDEBUG_ACMP" MODSEC_EXTRA_CFLAGS="$MODSEC_EXTRA_CFLAGS $debug_acmp" else debug_acmp= fi ], [ debug_acmp= ]) # DEBUG_MEM AC_ARG_ENABLE(debug-mem, AS_HELP_STRING([--enable-debug-mem], [Enable debug during configuration.]), [ if test "$enableval" != "no"; then debug_mem="-DDEBUG_MEM" MODSEC_EXTRA_CFLAGS="$MODSEC_EXTRA_CFLAGS $debug_mem" else debug_mem= fi ], [ debug_mem= ]) # PERFORMANCE_MEASUREMENT AC_ARG_ENABLE(performance-measurement, AS_HELP_STRING([--enable-performance-measurement], [Enable performance-measurement stats.]), [ if test "$enableval" != "no"; then perf_meas="-DPERFORMANCE_MEASUREMENT" MODSEC_EXTRA_CFLAGS="$MODSEC_EXTRA_CFLAGS $perf_meas" else perf_meas= fi ], [ perf_meas= ]) # NO_MODSEC_API AC_ARG_ENABLE(modsec-api, AS_HELP_STRING([--disable-modsec-api], [Disable the API; compiling against some older Apache versions require this.]), [ if test "$enableval" != "yes"; then modsec_api="-DNO_MODSEC_API" MODSEC_EXTRA_CFLAGS="$MODSEC_EXTRA_CFLAGS $modsec_api" else modsec_api= fi ], [ modsec_api= ]) # Find apxs AC_MSG_NOTICE(looking for Apache module support via DSO through APXS) AC_ARG_WITH(apxs, [AS_HELP_STRING([[--with-apxs=FILE]], [FILE is the path to apxs; defaults to "apxs".])], [ if test "$withval" = "yes"; then APXS=apxs else APXS="$withval" fi ]) if test -z "$APXS"; then for i in /usr/local/apache22/bin \ /usr/local/apache2/bin \ /usr/local/apache/bin \ /usr/local/sbin \ /usr/local/bin \ /usr/sbin \ /usr/bin; do if test -f "$i/apxs2"; then APXS="$i/apxs2" break elif test -f "$i/apxs"; then APXS="$i/apxs" break fi done fi # arbitrarily picking the same version subversion looks for, don't know how # accurate this really is, but at least it'll force us to have apache2... HTTPD_WANTED_MMN=20020903 if test -n "$APXS" -a "$APXS" != "no" -a -x "$APXS" ; then APXS_INCLUDE="`$APXS -q INCLUDEDIR`" if test -r $APXS_INCLUDE/httpd.h; then AC_MSG_NOTICE(found apxs at $APXS) AC_MSG_NOTICE(checking httpd version) AC_EGREP_CPP(VERSION_OK, [ #include "$APXS_INCLUDE/ap_mmn.h" #if AP_MODULE_MAGIC_AT_LEAST($HTTPD_WANTED_MMN,0) VERSION_OK #endif], [AC_MSG_NOTICE(httpd is recent enough)], [ if test "$report_errors" -eq 1; then AC_MSG_ERROR(apache is too old, mmn must be at least $HTTPD_WANTED_MMN) else AC_MSG_NOTICE(apache is too old, mmn must be at least $HTTPD_WANTED_MMN) fi ]) fi APXS_INCLUDEDIR="`$APXS -q INCLUDEDIR`" if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(apxs INCLUDEDIR: $APXS_INCLUDEDIR); fi # Make sure the include dir is used if test -n "$APXS_INCLUDEDIR"; then APXS_INCLUDES="-I${APXS_INCLUDEDIR} `$APXS -q INCLUDES` `$APXS -q EXTRA_INCLUDES`" else APXS_INCLUDES="`$APXS -q INCLUDES` `$APXS -q EXTRA_INCLUDES`" fi if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(apxs INCLUDES: $APXS_INCLUDES); fi APXS_CFLAGS=-I`$APXS -q INCLUDEDIR` if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(apxs CFLAGS: $APXS_CFLAGS); fi APXS_LDFLAGS= if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(apxs LDFLAGS: $APXS_LDFLAGS); fi APXS_LIBDIR="`$APXS -q LIBDIR`" if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(apxs LIBDIR: $APXS_LIBDIR); fi # Make sure the lib dir is used if test -n "$APXS_LIBDIR"; then APXS_LIBS="-L${APXS_LIBDIR} `$APXS -q LIBS` `$APXS -q EXTRA_LIBS`" else APXS_LIBS="`$APXS -q LIBS` `$APXS -q EXTRA_LIBS`" fi if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(apxs LIBS: $APXS_LIBS); fi APXS_LIBTOOL="`$APXS -q LIBTOOL`" if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(apxs LIBTOOL: $APXS_LIBTOOL); fi APXS_CC="`$APXS -q CC`" if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(apxs CC: $APXS_CC); fi APXS_BINDIR="`$APXS -q BINDIR`" if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(apxs BINDIR: $APXS_BINDIR); fi APXS_SBINDIR="`$APXS -q SBINDIR`" if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(apxs SBINDIR: $APXS_SBINDIR); fi APXS_PROGNAME="`$APXS -q PROGNAME`" if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(apxs PROGNAME: $APXS_PROGNAME); fi APXS_LIBEXECDIR="`$APXS -q LIBEXECDIR`" if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(apxs LIBEXECDIR: $APXS_LIBEXECDIR); fi APXS_MODULES=$APXS_LIBEXECDIR if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(apxs MODULES: $APXS_MODULES); fi if test "$APXS_SBINDIR" = "/"; then APXS_HTTPD="$APXS_SBINDIR/$APXS_PROGNAME" else APXS_HTTPD="$APXS_SBINDIR/$APXS_PROGNAME" fi if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(apxs HTTPD: $APXS_HTTPD); fi else if test "$report_errors" -eq 1; then AC_MSG_ERROR(couldn't find APXS) else AC_MSG_NOTICE(couldn't find APXS) fi fi ### Build *EXTRA_CFLAGS vars # Allow overriding EXTRA_CFLAGS if $ENV_CMD | $GREP "^EXTRA_CFLAGS" > /dev/null 2>&1; then if test -z "$debug_mem"; then EXTRA_CFLAGS="$EXTRA_CFLAGS $strict_compile" fi else if test -n "$debug_mem"; then EXTRA_CFLAGS="-O0 -g -Wall" else EXTRA_CFLAGS="-O2 -g -Wall $strict_compile" fi fi MODSEC_EXTRA_CFLAGS="$pcre_study $pcre_match_limit $pcre_match_limit_recursion $pcre_jit $request_early $htaccess_config $lua_cache $debug_conf $debug_cache $debug_acmp $debug_mem $perf_meas $modsec_api $cpu_type" APXS_WRAPPER=build/apxs-wrapper APXS_EXTRA_CFLAGS="" for f in $EXTRA_CFLAGS; do APXS_EXTRA_CFLAGS="$APXS_EXTRA_CFLAGS -Wc,$f" done; MODSEC_APXS_EXTRA_CFLAGS="" for f in $MODSEC_EXTRA_CFLAGS; do MODSEC_APXS_EXTRA_CFLAGS="$MODSEC_APXS_EXTRA_CFLAGS -Wc,$f" done; ### Substitute the vars AC_SUBST(TOPLEVEL_SUBDIRS) AC_SUBST(EXTRA_CFLAGS) AC_SUBST(MODSEC_EXTRA_CFLAGS) AC_SUBST(APXS) AC_SUBST(APXS_WRAPPER) AC_SUBST(APXS_INCLUDEDIR) AC_SUBST(APXS_INCLUDES) AC_SUBST(APXS_EXTRA_CFLAGS) AC_SUBST(MODSEC_APXS_EXTRA_CFLAGS) AC_SUBST(APXS_LDFLAGS) AC_SUBST(APXS_LIBS) AC_SUBST(APXS_CFLAGS) AC_SUBST(APXS_LIBTOOL) AC_SUBST(APXS_CC) AC_SUBST(APXS_LIBDIR) AC_SUBST(APXS_BINDIR) AC_SUBST(APXS_SBINDIR) AC_SUBST(APXS_PROGNAME) AC_SUBST(APXS_LIBEXECDIR) AC_SUBST(APXS_MODULES) AC_SUBST(APXS_HTTPD) CHECK_PCRE() if test "$build_apache2_module" -ne 0 -o "$build_mlogc" -ne 0; then CHECK_APR() CHECK_APU() fi CHECK_LIBXML2() CHECK_LUA() if test "$build_mlogc" -ne 0; then CHECK_CURL() fi AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([tools/Makefile]) if test "$build_alp2" -ne 0; then AC_CONFIG_FILES([alp2/Makefile]) fi if test "$build_apache2_module" -ne 0; then AC_CONFIG_FILES([apache2/Makefile]) fi if test "$build_standalone_module" -ne 0; then AC_CONFIG_FILES([standalone/Makefile]) AC_CONFIG_FILES([nginx/modsecurity/config]) fi if test "$build_extentions" -ne 0; then AC_CONFIG_FILES([ext/Makefile]) fi AC_CONFIG_FILES([build/apxs-wrapper], [chmod +x build/apxs-wrapper]) if test -e "$PERL"; then if test "$build_mlogc" -ne 0; then AC_CONFIG_FILES([mlogc/mlogc-batch-load.pl], [chmod +x mlogc/mlogc-batch-load.pl]) fi AC_CONFIG_FILES([tests/run-unit-tests.pl], [chmod +x tests/run-unit-tests.pl]) AC_CONFIG_FILES([tests/run-regression-tests.pl], [chmod +x tests/run-regression-tests.pl]) AC_CONFIG_FILES([tests/gen_rx-pm.pl], [chmod +x tests/gen_rx-pm.pl]) AC_CONFIG_FILES([tests/csv_rx-pm.pl], [chmod +x tests/csv_rx-pm.pl]) AC_CONFIG_FILES([tests/regression/server_root/conf/httpd.conf]) # Perl based tools AC_CONFIG_FILES([tools/rules-updater.pl], [chmod +x tools/rules-updater.pl]) fi if test "$build_mlogc" -ne 0; then AC_CONFIG_FILES([mlogc/Makefile]) fi AC_CONFIG_FILES([tests/Makefile]) AC_OUTPUT modsecurity-apache_2.7.7/tests/0000775000175000017500000000000012254306021016770 5ustar zimmerlezimmerlemodsecurity-apache_2.7.7/tests/action/0000775000175000017500000000000012243422537020256 5ustar zimmerlezimmerlemodsecurity-apache_2.7.7/tests/action/.empty0000664000175000017500000000000012243422537021403 0ustar zimmerlezimmerlemodsecurity-apache_2.7.7/tests/msc_test.c0000664000175000017500000007036712253711345021002 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #include #include #include "modsecurity.h" #include "re.h" #define ISHEX(X) (((X >= '0')&&(X <= '9')) || ((X >= 'a')&&(X <= 'f')) || ((X >= 'A')&&(X <= 'F'))) #define BUFLEN 32768 #define RESULT_SUCCESS 0 #define RESULT_ERROR -1 #define RESULT_MISMATCHED -2 #define RESULT_WRONGSIZE -3 #define RESULT_WRONGRET -4 #define DEFAULT_ACTION "phase:2,log,auditlog,pass" #define CMDLINE_OPTS "t:n:p:P:r:I:D:Nh" /* Types */ typedef struct tfn_data_t tfn_data_t; typedef struct op_data_t op_data_t; typedef struct action_data_t action_data_t; struct tfn_data_t { const char *name; const char *param; unsigned char *input; apr_size_t input_len; msre_tfn_metadata *metadata; }; struct op_data_t { const char *name; const char *param; unsigned char *input; apr_size_t input_len; msre_ruleset *ruleset; msre_rule *rule; msre_var *var; msre_op_metadata *metadata; }; struct action_data_t { const char *name; unsigned char *input; apr_size_t input_len; msre_ruleset *ruleset; msre_rule *rule; msre_var *var; msre_actionset *actionset; msre_action *action; }; /* Globals */ static int debuglog_level = 0; static char *test_name = NULL; static apr_pool_t *g_mp = NULL; static modsec_rec *g_msr = NULL; static unsigned char buf[BUFLEN]; msc_engine *modsecurity = NULL; unsigned long int DSOLOCAL msc_pcre_match_limit = 0; unsigned long int DSOLOCAL msc_pcre_match_limit_recursion = 0; /* Stubs */ char *format_error_log_message(apr_pool_t *mp, error_message_t *em) { return "FAKE ERROR LOG MESSAGE"; } apr_status_t send_error_bucket(modsec_rec *msr, ap_filter_t *f, int status) { return APR_SUCCESS; } int apache2_exec(modsec_rec *msr, const char *command, const char **argv, char **output) { return 0; } char *get_apr_error(apr_pool_t *p, apr_status_t rc) { char *text = apr_pcalloc(p, 201); if (text == NULL) return NULL; apr_strerror(rc, text, 200); return text; } void msr_log(modsec_rec *msr, int level, const char *text, ...) { va_list ap; char str1[1024] = ""; char str2[1256] = ""; if ((msr == NULL) || (level > msr->txcfg->debuglog_level)) { return; } if (msr->txcfg->debuglog_fd == NOT_SET_P) { if (apr_file_open(&msr->txcfg->debuglog_fd, msr->txcfg->debuglog_name, APR_READ|APR_WRITE|APR_CREATE|APR_APPEND|APR_BINARY, APR_OS_DEFAULT, g_mp) != APR_SUCCESS) { fprintf(stderr, "ERROR: failed to create unit test debug log \"%s\".\n", msr->txcfg->debuglog_name); msr->txcfg->debuglog_fd = NULL; } } va_start(ap, text); if (msr->txcfg->debuglog_fd != NULL) { apr_size_t nbytes_written = 0; apr_vsnprintf(str1, sizeof(str1), text, ap); apr_snprintf(str2, sizeof(str2), "%lu: [%d] [%s] %s\n", (unsigned long)getpid(), level, test_name, str1); apr_file_write_full(msr->txcfg->debuglog_fd, str2, strlen(str2), &nbytes_written); } va_end(ap); } void msr_log_error(modsec_rec *msr, const char *text, ...) { va_list ap; int level = 3; char str1[1024] = ""; char str2[1256] = ""; if ((msr == NULL) || (level > msr->txcfg->debuglog_level)) { return; } if (msr->txcfg->debuglog_fd == NOT_SET_P) { if (apr_file_open(&msr->txcfg->debuglog_fd, msr->txcfg->debuglog_name, APR_READ|APR_WRITE|APR_CREATE|APR_APPEND|APR_BINARY, APR_OS_DEFAULT, g_mp) != APR_SUCCESS) { fprintf(stderr, "ERROR: failed to create unit test debug log \"%s\".\n", msr->txcfg->debuglog_name); msr->txcfg->debuglog_fd = NULL; } } va_start(ap, text); if (msr->txcfg->debuglog_fd != NULL) { apr_size_t nbytes_written = 0; apr_vsnprintf(str1, sizeof(str1), text, ap); apr_snprintf(str2, sizeof(str2), "%lu: [%d] [%s] %s\n", (unsigned long)getpid(), level, test_name, str1); apr_file_write_full(msr->txcfg->debuglog_fd, str2, strlen(str2), &nbytes_written); } va_end(ap); } void msr_log_warn(modsec_rec *msr, const char *text, ...) { va_list ap; int level = 4; char str1[1024] = ""; char str2[1256] = ""; if ((msr == NULL) || (level > msr->txcfg->debuglog_level)) { return; } if (msr->txcfg->debuglog_fd == NOT_SET_P) { if (apr_file_open(&msr->txcfg->debuglog_fd, msr->txcfg->debuglog_name, APR_READ|APR_WRITE|APR_CREATE|APR_APPEND|APR_BINARY, APR_OS_DEFAULT, g_mp) != APR_SUCCESS) { fprintf(stderr, "ERROR: failed to create unit test debug log \"%s\".\n", msr->txcfg->debuglog_name); msr->txcfg->debuglog_fd = NULL; } } va_start(ap, text); if (msr->txcfg->debuglog_fd != NULL) { apr_size_t nbytes_written = 0; apr_vsnprintf(str1, sizeof(str1), text, ap); apr_snprintf(str2, sizeof(str2), "%lu: [%d] [%s] %s\n", (unsigned long)getpid(), level, test_name, str1); apr_file_write_full(msr->txcfg->debuglog_fd, str2, strlen(str2), &nbytes_written); } va_end(ap); } #define ap_get_remote_host(a, b, c, d) test_ap_get_remote_host(a, b, c, d) const char *test_ap_get_remote_host(conn_rec *conn, void *dir_config, int type, int *str_is_ip) { return "FAKE-REMOTE-HOST"; } char *get_env_var(request_rec *r, char *name) { return "FAKE-ENV-VAR"; } #define unixd_set_global_mutex_perms(a) my_unixd_set_global_mutex_perms(a) apr_status_t my_unixd_set_global_mutex_perms(apr_global_mutex_t *gmutex) { return APR_SUCCESS; } #define unixd_set_proc_mutex_perms(a) my_unixd_set_proc_mutex_perms(a) apr_status_t my_unixd_set_proc_mutex_perms(apr_proc_mutex_t *pmutex) { return APR_SUCCESS; } /* Escaping functions */ static unsigned char hex2dec(unsigned char *what) { register unsigned char digit; digit = (what[0] >= 'A' ? ((what[0] & 0xdf) - 'A') + 10 : (what[0] - '0')); digit *= 16; digit += (what[1] >= 'A' ? ((what[1] & 0xdf) - 'A') + 10 : (what[1] - '0')); return digit; } static unsigned char *unescape_inplace(unsigned char *str, apr_size_t *len) { apr_size_t i, j; for (i = j = 0; i < *len; j++) { if ((str[i] == '\\') && (i + 3 < *len) && (str[i + 1] == 'x') && ISHEX(str[i + 2]) && ISHEX(str[i + 3]) ) { str[j] = hex2dec(str + i + 2); i += 4; } else { str[j] = str[i++]; } } *len = j; while (j < i) { str[j++] = '\0'; } return str; } static char *escape(unsigned char *str, apr_size_t *len) { char *new = apr_pcalloc(g_mp, (*len * 4) + 1); apr_size_t i, j; for (i = j = 0; i < *len; i++) { if ((str[i] >= 0x20) && (str[i] <= 0x7e)) { new[j++] = str[i]; } else { sprintf(new + j, "\\x%02x", str[i]); j += 4; } } *len = j; return new; } /* Testing functions */ static int init_tfn(tfn_data_t *data, const char *name, unsigned char *input, apr_size_t input_len, char **errmsg) { *errmsg = NULL; data->name = name; data->input = apr_pmemdup(g_mp, input, input_len); data->input_len = input_len; data->metadata = msre_engine_tfn_resolve(modsecurity->msre, name); if (data->metadata == NULL) { *errmsg = apr_psprintf(g_mp, "Failed to fetch tfn \"%s\".", name); return -1; } return 0; } static int test_tfn(tfn_data_t *data, unsigned char **rval, apr_size_t *rval_len, char **errmsg) { int rc = -1; *errmsg = NULL; /* Execute the tfn */ rc = data->metadata->execute(g_mp, data->input, (long)(data->input_len), (char **)rval, (long *)rval_len); if (rc < 0) { *errmsg = apr_psprintf(g_mp, "Failed to execute tfn \"%s\".", data->name); } return rc; } static int init_op(op_data_t *data, const char *name, const char *param, unsigned char *input, apr_size_t input_len, char **errmsg) { const char *args = apr_psprintf(g_mp, "@%s %s", name, param); char *conf_fn; int rc = -1; *errmsg = NULL; data->name = name; data->param = param; data->input = input; data->input_len = input_len; if ( apr_filepath_merge(&conf_fn, NULL, "unit-test.conf", APR_FILEPATH_TRUENAME, g_mp) != APR_SUCCESS) { *errmsg = apr_psprintf(g_mp, "Failed to build a conf filename."); return -1; } /* Register UNIT_TEST variable */ msre_engine_variable_register(modsecurity->msre, "UNIT_TEST", VAR_SIMPLE, 0, 0, NULL, NULL, VAR_DONT_CACHE, PHASE_REQUEST_HEADERS ); /* Lookup the operator */ data->metadata = msre_engine_op_resolve(modsecurity->msre, name); if (data->metadata == NULL) { *errmsg = apr_psprintf(g_mp, "Failed to fetch op \"%s\".", name); return -1; } /* Create a ruleset/rule */ data->ruleset = msre_ruleset_create(modsecurity->msre, g_mp); if (data->ruleset == NULL) { *errmsg = apr_psprintf(g_mp, "Failed to create ruleset for op \"%s\".", name); return -1; } data->rule = msre_rule_create(data->ruleset, RULE_TYPE_NORMAL, conf_fn, 1, "UNIT_TEST", args, DEFAULT_ACTION, errmsg); if (data->rule == NULL) { *errmsg = apr_psprintf(g_mp, "Failed to create rule for op \"%s\": %s", name, *errmsg); return -1; } /* Create a fake variable */ data->var = (msre_var *)apr_pcalloc(g_mp, sizeof(msre_var)); data->var->name = "UNIT_TEST"; data->var->value = apr_pstrmemdup(g_mp, (char *)input, input_len); data->var->value_len = input_len; data->var->metadata = msre_resolve_var(modsecurity->msre, data->var->name); if (data->var->metadata == NULL) { *errmsg = apr_psprintf(g_mp, "Failed to resolve variable for op \"%s\": %s", name, data->var->name); return -1; } /* Initialize the operator parameter */ if (data->metadata->param_init != NULL) { rc = data->metadata->param_init(data->rule, errmsg); if (rc <= 0) { *errmsg = apr_psprintf(g_mp, "Failed to init op \"%s\": %s", name, *errmsg); return rc; } } return 0; } static int test_op(op_data_t *data, char **errmsg) { int rc = -1; *errmsg = NULL; /* Execute the operator */ if (data->metadata->execute != NULL) { rc = data->metadata->execute(g_msr, data->rule, data->var, errmsg); if (rc < 0) { *errmsg = apr_psprintf(g_mp, "Failed to execute op \"%s\": %s", data->name, *errmsg); } } return rc; } static int init_action(action_data_t *data, const char *name, const char *param, char **errmsg) { const char *action_string = NULL; char *conf_fn; *errmsg = NULL; if ((param == NULL) || (strcmp("", param) == 0)) { action_string = apr_psprintf(g_mp, "%s", name); } else { action_string = apr_psprintf(g_mp, "%s:%s", name, param); } if (action_string == NULL) { *errmsg = apr_psprintf(g_mp, "Failed to build action string for action: \"%s\".", name); return -1; } if ( apr_filepath_merge(&conf_fn, NULL, "unit-test.conf", APR_FILEPATH_TRUENAME, g_mp) != APR_SUCCESS) { *errmsg = apr_psprintf(g_mp, "Failed to build a conf filename."); return -1; } /* Register UNIT_TEST variable */ msre_engine_variable_register(modsecurity->msre, "UNIT_TEST", VAR_SIMPLE, 0, 0, NULL, NULL, VAR_DONT_CACHE, PHASE_REQUEST_HEADERS ); /* Create a ruleset/rule */ data->ruleset = msre_ruleset_create(modsecurity->msre, g_mp); if (data->ruleset == NULL) { *errmsg = apr_psprintf(g_mp, "Failed to create ruleset for action \"%s\".", name); return -1; } data->rule = msre_rule_create(data->ruleset, RULE_TYPE_NORMAL, conf_fn, 1, "UNIT_TEST", "@unconditionalMatch", action_string, errmsg); if (data->rule == NULL) { *errmsg = apr_psprintf(g_mp, "Failed to create rule for action \"%s\": %s", name, *errmsg); return -1; } /* Get the actionset/action */ data->actionset = data->rule->actionset; if (data->actionset == NULL) { *errmsg = apr_psprintf(g_mp, "Failed to fetch actionset for action \"%s\"", name); return -1; } data->action = (msre_action *)apr_table_get(data->actionset->actions, name); if (data->action == NULL) { *errmsg = apr_psprintf(g_mp, "Failed to fetch action for action \"%s\"", name); return -1; } return 0; } static int test_action(action_data_t *data, char **errmsg) { int rc = -1; *errmsg = NULL; /* Execute the action */ if (data->action->metadata->execute != NULL) { rc = data->action->metadata->execute(g_msr, g_mp, data->rule, data->action); if (rc < 0) { *errmsg = apr_psprintf(g_mp, "Failed to execute action \"%s\": %d", data->name, rc); } } return rc; } /* Initialization */ static void init_msr(void) { directory_config *dcfg = NULL; request_rec *r = NULL; r = (request_rec *)apr_pcalloc(g_mp, sizeof(request_rec)); dcfg = (directory_config *)apr_pcalloc(g_mp, sizeof(directory_config)); dcfg->is_enabled = 0; dcfg->reqbody_access = 0; dcfg->reqbody_buffering = 0; dcfg->reqbody_inmemory_limit = REQUEST_BODY_DEFAULT_INMEMORY_LIMIT; dcfg->reqbody_limit = REQUEST_BODY_DEFAULT_LIMIT; dcfg->reqbody_no_files_limit = REQUEST_BODY_NO_FILES_DEFAULT_LIMIT; dcfg->resbody_access = 0; dcfg->of_limit = RESPONSE_BODY_DEFAULT_LIMIT; dcfg->of_limit_action = RESPONSE_BODY_LIMIT_ACTION_REJECT; dcfg->debuglog_fd = NOT_SET_P; dcfg->debuglog_name = "msc-test-debug.log"; dcfg->debuglog_level = debuglog_level; dcfg->cookie_format = 0; dcfg->argument_separator = '&'; dcfg->rule_inheritance = 0; dcfg->auditlog_flag = 0; dcfg->auditlog_type = AUDITLOG_SERIAL; dcfg->auditlog_fd = NULL; dcfg->auditlog2_fd = NULL; dcfg->auditlog_name = NULL; dcfg->auditlog2_name = NULL; dcfg->auditlog_storage_dir = NULL; dcfg->auditlog_parts = "ABCFHZ"; dcfg->auditlog_relevant_regex = NULL; dcfg->tmp_dir = guess_tmp_dir(g_mp); dcfg->upload_dir = NULL; dcfg->upload_keep_files = KEEP_FILES_OFF; dcfg->upload_validates_files = 0; dcfg->data_dir = "."; dcfg->webappid = "default"; dcfg->content_injection_enabled = 0; dcfg->geo = NULL; dcfg->cache_trans = MODSEC_CACHE_ENABLED; dcfg->cache_trans_min = 15; dcfg->cache_trans_max = 0; dcfg->request_encoding = NULL; g_msr = (modsec_rec *)apr_pcalloc(g_mp, sizeof(modsec_rec)); g_msr->modsecurity = modsecurity; g_msr->mp = g_mp; g_msr->r = r; g_msr->r_early = r; g_msr->request_time = apr_time_now(); g_msr->dcfg1 = NULL; g_msr->usercfg = NULL; g_msr->txcfg = dcfg; g_msr->txid = "FAKE-TXID"; g_msr->error_messages = NULL; g_msr->alerts = NULL; g_msr->server_software = "FAKE-SERVER-SOFTWARE"; g_msr->local_addr = "127.0.0.1"; g_msr->local_port = 80; g_msr->remote_addr = "127.0.0.1"; g_msr->remote_port = 1080; g_msr->request_line = "GET /unit-tests HTTP/1.1"; g_msr->request_uri = "http://localhost/unit-tests"; g_msr->request_method = "GET"; g_msr->query_string = ""; g_msr->request_protocol = "HTTP/1.1"; g_msr->request_headers = NULL; g_msr->hostname = "localhost"; g_msr->msc_rule_mptmp = g_mp; g_msr->tx_vars = apr_table_make(g_mp, 1); g_msr->collections_original = apr_table_make(g_mp, 1); g_msr->collections = apr_table_make(g_mp, 1); g_msr->collections_dirty = apr_table_make(g_mp, 1); } /** * Usage text. */ static void usage(void) { fprintf(stderr, "ModSecurity Unit Tester v%s\n", MODSEC_VERSION); fprintf(stderr, " Usage: msc_test [options]\n"); fprintf(stderr, "\n"); fprintf(stderr, " Options:\n"); fprintf(stderr, " -t Type (required)\n"); fprintf(stderr, " -n Name (required)\n"); fprintf(stderr, " -p Parameter (required)\n"); fprintf(stderr, " -P Prerun (optional for actions)\n"); fprintf(stderr, " -r Function return code (required for some types)\n"); fprintf(stderr, " -I Iterations (default 1)\n"); fprintf(stderr, " -D Debug log level (default 0)\n"); fprintf(stderr, " -N No input on stdin.\n\n"); fprintf(stderr, " -h This help\n\n"); fprintf(stderr, "\n"); fprintf(stderr, "Input is from stdin unless -N is used.\n"); } /* Main */ int main(int argc, const char * const argv[]) { apr_getopt_t *opt; apr_file_t *fd; apr_size_t nbytes = 0; const char *type = NULL; const char *name = NULL; unsigned char *param = NULL; unsigned char *prerun = NULL; const char *returnval = NULL; int iterations = 1; char *errmsg = NULL; unsigned char *out = NULL; apr_size_t param_len = 0; apr_size_t prerun_len = 0; apr_size_t out_len = 0; int noinput = 0; int rc = 0; int result = 0; int ec = 0; int i; apr_time_t T0 = 0; apr_time_t T1 = 0; tfn_data_t tfn_data; op_data_t op_data; action_data_t action_data; int ret = 0; memset(&tfn_data, 0, sizeof(tfn_data_t)); memset(&op_data, 0, sizeof(op_data_t)); memset(&action_data, 0, sizeof(action_data_t)); apr_app_initialize(&argc, &argv, NULL); atexit(apr_terminate); apr_pool_create(&g_mp, NULL); rc = apr_getopt_init(&opt, g_mp, argc, argv); if (rc != APR_SUCCESS) { fprintf(stderr, "Failed to initialize.\n\n"); usage(); exit(1); } do { char ch; const char *val; rc = apr_getopt(opt, CMDLINE_OPTS, &ch, &val); switch (rc) { case APR_SUCCESS: switch (ch) { case 't': type = val; break; case 'n': name = val; break; case 'p': param_len = strlen(val); param = apr_pmemdup(g_mp, val, param_len + 1); unescape_inplace(param, ¶m_len); break; case 'P': prerun_len = strlen(val); prerun = apr_pmemdup(g_mp, val, prerun_len + 1); unescape_inplace(prerun, &prerun_len); break; case 'r': returnval = val; break; case 'I': iterations = atoi(val); break; case 'D': debuglog_level = atoi(val); break; case 'N': noinput = 1; break; case 'h': usage(); exit(0); } break; case APR_BADCH: case APR_BADARG: usage(); exit(1); } } while (rc != APR_EOF); rc = apr_getopt_init(&opt, g_mp, argc, argv); if (!type || !name || !param) { usage(); exit(1); } modsecurity = modsecurity_create(g_mp, MODSEC_OFFLINE); test_name = apr_psprintf(g_mp, "%s/%s", type, name); if (noinput == 0) { if (apr_file_open_stdin(&fd, g_mp) != APR_SUCCESS) { fprintf(stderr, "Failed to open stdin\n"); exit(1); } /* Read in the input */ nbytes = BUFLEN; memset(buf, 0, nbytes); rc = apr_file_read(fd, buf, &nbytes); if ((rc != APR_EOF) && (rc != APR_SUCCESS)) { fprintf(stderr, "Failed to read data\n"); exit(1); } if (nbytes < 0) { fprintf(stderr, "Error reading data\n"); exit(1); } apr_file_close(fd); } if (strcmp("tfn", type) == 0) { ret = returnval ? atoi(returnval) : -8888; rc = init_tfn(&tfn_data, name, buf, nbytes, &errmsg); if (rc < 0) { fprintf(stderr, "ERROR: %s\n", errmsg); result = RESULT_ERROR; } } else if (strcmp("op", type) == 0) { if (!returnval) { fprintf(stderr, "Return value required for type \"%s\"\n", type); exit(1); } ret = atoi(returnval); init_msr(); rc = init_op(&op_data, name, (const char *)param, buf, nbytes, &errmsg); if (rc < 0) { fprintf(stderr, "ERROR: %s\n", errmsg); result = RESULT_ERROR; } } else if (strcmp("action", type) == 0) { if (!returnval) { fprintf(stderr, "Return value required for type \"%s\"\n", type); exit(1); } ret = atoi(returnval); init_msr(); if (prerun) { action_data_t paction_data; char *pname = apr_pstrdup(g_mp, (const char *)prerun); char *pparam = NULL; if ((pparam = strchr((const char *)pname, ':'))) { pparam[0] = '\0'; pparam++; } rc = init_action(&paction_data, pname, (const char *)pparam, &errmsg); if (rc < 0) { fprintf(stderr, "ERROR: prerun - %s\n", errmsg); exit(1); } rc = test_action(&paction_data, &errmsg); if (rc < 0) { fprintf(stderr, "ERROR: prerun - %s\n", errmsg); exit(1); } } rc = init_action(&action_data, name, (const char *)param, &errmsg); if (rc < 0) { fprintf(stderr, "ERROR: %s\n", errmsg); result = RESULT_ERROR; } } if (iterations > 1) { apr_time_clock_hires (g_mp); T0 = apr_time_now(); } for (i = 1; i <= iterations; i++) { #ifdef VERBOSE if (i % 100 == 0) { if (i == 100) { fprintf(stderr, "Iterations/100: ."); } else { fprintf(stderr, "."); } } #endif if (strcmp("tfn", type) == 0) { /* Transformations */ rc = test_tfn(&tfn_data, &out, &out_len, &errmsg); if (rc < 0) { fprintf(stderr, "ERROR: %s\n", errmsg); result = RESULT_ERROR; } else if ((ret != -8888) && (rc != ret)) { fprintf(stderr, "Returned %d (expected %d)\n", rc, ret); result = RESULT_WRONGRET; } else if (param_len != out_len) { fprintf(stderr, "Length %" APR_SIZE_T_FMT " (expected %" APR_SIZE_T_FMT ")\n", out_len, param_len); result = RESULT_WRONGSIZE; } else { result = memcmp(param, out, param_len) ? RESULT_MISMATCHED : RESULT_SUCCESS; } if (result != RESULT_SUCCESS) { apr_size_t s0len = nbytes; const char *s0 = escape(buf, &s0len); apr_size_t s1len = out_len; const char *s1 = escape(out, &s1len); apr_size_t s2len = param_len; const char *s2 = escape(param, &s2len); fprintf(stderr, " Input: '%s' len=%" APR_SIZE_T_FMT "\n" "Output: '%s' len=%" APR_SIZE_T_FMT "\n" "Expect: '%s' len=%" APR_SIZE_T_FMT "\n", s0, nbytes, s1, out_len, s2, param_len); ec = 1; } } else if (strcmp("op", type) == 0) { /* Operators */ rc = test_op(&op_data, &errmsg); if (rc < 0) { fprintf(stderr, "ERROR: %s\n", errmsg); result = RESULT_ERROR; } else if (rc != ret) { fprintf(stderr, "Returned %d (expected %d)\n", rc, ret); result = RESULT_WRONGRET; } else { result = RESULT_SUCCESS; } if (result != RESULT_SUCCESS) { apr_size_t s0len = nbytes; const char *s0 = escape(buf, &s0len); fprintf(stderr, " Test: '@%s %s'\n" "Input: '%s' len=%" APR_SIZE_T_FMT "\n", name, param, s0, nbytes); ec = 1; } } else if (strcmp("action", type) == 0) { /* Actions */ int n; const apr_array_header_t *arr; apr_table_entry_t *te; rc = test_action(&action_data, &errmsg); if (rc < 0) { fprintf(stderr, "ERROR: %s\n", errmsg); result = RESULT_ERROR; } else if (rc != ret) { fprintf(stderr, "Returned %d (expected %d)\n", rc, ret); result = RESULT_WRONGRET; } else { result = RESULT_SUCCESS; } if (result != RESULT_SUCCESS) { fprintf(stderr, " Test: '%s:%s'\n" "Prerun: '%s'\n", name, param, (prerun ? (const char *)prerun : "")); ec = 1; } /* Store any collections that were initialized and changed */ arr = apr_table_elts(g_msr->collections); te = (apr_table_entry_t *)arr->elts; for (n = 0; n < arr->nelts; n++) { apr_table_t *col = (apr_table_t *)te[n].val; // apr_table_t *orig_col = NULL; if (g_msr->txcfg->debuglog_level >= 9) { msr_log(g_msr, 9, "Found loaded collection: %s", te[n].key); } /* Only store those collections that changed. */ if (apr_table_get(g_msr->collections_dirty, te[n].key)) { int x = collection_store(g_msr, col); if (g_msr->txcfg->debuglog_level >= 9) { msr_log(g_msr, 9, "Stored collection: %s (%d)", te[n].key, x); } } #if 0 /* Re-populate the original values with the new ones. */ if ((orig_col = (apr_table_t *)apr_table_get(g_msr->collections_original, te[n].key)) != NULL) { const apr_array_header_t *orig_arr = apr_table_elts(orig_col); apr_table_entry_t *orig_te = (apr_table_entry_t *)orig_arr->elts; int m; for (m = 0; m < orig_arr->nelts; m++) { msc_string *mstr = (msc_string *)apr_table_get(col, orig_te[m].key); if (g_msr->txcfg->debuglog_level >= 9) { msr_log(g_msr, 9, "Updating original collection: %s.%s=%s", te[n].key, mstr->name, mstr->value); } //apr_table_setn(orig_col, orig_te[m].key, (void *)mstr ); collection_original_setvar(g_msr, te[n].key, mstr); } } #endif } apr_table_clear(g_msr->collections_dirty); apr_table_clear(g_msr->collections_original); } else { fprintf(stderr, "Unknown type: \"%s\"\n", type); exit(1); } if (ec != 0) { fprintf(stdout, "%s\n", errmsg ? errmsg : ""); return ec; } } if (iterations > 1) { double dT; T1 = apr_time_now(); dT = apr_time_as_msec(T1 - T0); #ifdef VERBOSE if (i >= 100) { fprintf(stderr, "\n"); } #endif fprintf(stdout, "%d @ %.4f msec per iteration.\n", iterations, dT / iterations); } fprintf(stdout, "%s\n", errmsg ? errmsg : ""); return ec; } modsecurity-apache_2.7.7/tests/Makefile.am0000664000175000017500000000336712253711345021045 0ustar zimmerlezimmerlecheck_PROGRAMS = msc_test msc_test_SOURCES = msc_test.c \ $(top_srcdir)/apache2/acmp.c \ $(top_srcdir)/apache2/libinjection/libinjection_sqli.c \ $(top_srcdir)/apache2/modsecurity.c \ $(top_srcdir)/apache2/msc_crypt.c \ $(top_srcdir)/apache2/msc_geo.c \ $(top_srcdir)/apache2/msc_gsb.c \ $(top_srcdir)/apache2/msc_logging.c \ $(top_srcdir)/apache2/msc_lua.c \ $(top_srcdir)/apache2/msc_multipart.c \ $(top_srcdir)/apache2/msc_parsers.c \ $(top_srcdir)/apache2/msc_pcre.c \ $(top_srcdir)/apache2/msc_release.c \ $(top_srcdir)/apache2/msc_reqbody.c \ $(top_srcdir)/apache2/msc_tree.c \ $(top_srcdir)/apache2/msc_unicode.c \ $(top_srcdir)/apache2/msc_util.c \ $(top_srcdir)/apache2/msc_xml.c \ $(top_srcdir)/apache2/persist_dbm.c \ $(top_srcdir)/apache2/re_actions.c \ $(top_srcdir)/apache2/re.c \ $(top_srcdir)/apache2/re_operators.c \ $(top_srcdir)/apache2/re_tfns.c \ $(top_srcdir)/apache2/re_variables.c \ $(top_srcdir)/standalone/regex.c \ $(top_srcdir)/standalone/server.c msc_test_CFLAGS = @APR_CFLAGS@ \ @APU_CFLAGS@ \ @APXS_CFLAGS@ \ @LIBXML2_CFLAGS@ \ @LUA_CFLAGS@ \ @MODSEC_EXTRA_CFLAGS@ \ @PCRE_CFLAGS@ msc_test_CPPFLAGS = -I$(top_srcdir)/apache2 \ @APR_CPPFLAGS@ \ @LIBXML2_CPPFLAGS@ \ @PCRE_CPPFLAGS@ msc_test_LDADD = @APR_LDADD@ \ @APU_LDADD@ \ @LIBXML2_LDADD@ \ @LUA_LDADD@ \ @PCRE_LDADD@ msc_test_LDFLAGS = @APR_LDFLAGS@ \ @APU_LDFLAGS@ \ @APXS_LDFLAGS@ \ @LIBXML2_LDFLAGS@ \ @LUA_LDFLAGS@ \ @PCRE_LDFLAGS@ check_SCRIPTS = run-unit-tests.pl TESTS = $(check_SCRIPTS) test: check test-regression: run-regression-tests.pl $(PERL) run-regression-tests.pl .PHONY: test test-regression modsecurity-apache_2.7.7/tests/run-regression-tests.pl.in0000775000175000017500000005123012243422537024071 0ustar zimmerlezimmerle#!@PERL@ # # Run regression tests. # # Syntax: run-regression-tests.pl [options] [file [N]] # # All: run-regression-tests.pl # All in file: run-regression-tests.pl file # Nth in file: run-regression-tests.pl file N # use strict; use Time::HiRes qw(gettimeofday sleep); use POSIX qw(WIFEXITED WEXITSTATUS WIFSIGNALED WTERMSIG); use File::Spec qw(rel2abs); use File::Basename qw(basename dirname); use FileHandle; use IPC::Open2 qw(open2); use IPC::Open3 qw(open3); use Getopt::Std; use Data::Dumper; use IO::Socket; use LWP::UserAgent; my @TYPES = qw(config misc action target rule); my $SCRIPT = basename($0); my $SCRIPT_DIR = File::Spec->rel2abs(dirname($0)); my $REG_DIR = "$SCRIPT_DIR/regression"; my $SROOT_DIR = "$REG_DIR/server_root"; my $DATA_DIR = "$SROOT_DIR/data"; my $TEMP_DIR = "$SROOT_DIR/tmp"; my $UPLOAD_DIR = "$SROOT_DIR/upload"; my $CONF_DIR = "$SROOT_DIR/conf"; my $MODULES_DIR = q(@APXS_LIBEXECDIR@); my $FILES_DIR = "$SROOT_DIR/logs"; my $PID_FILE = "$FILES_DIR/httpd.pid"; my $HTTPD = q(@APXS_HTTPD@); my $PASSED = 0; my $TOTAL = 0; my $BUFSIZ = 32768; my %C = (); my %FILE = (); my $UA_NAME = "ModSecurity Regression Tests/1.2.3"; my $UA = LWP::UserAgent->new; $UA->agent($UA_NAME); # Hack for testing the script w/o configure if ($HTTPD eq "\@APXS_HTTPD\@") { $HTTPD = "/usr/local/apache2/bin/httpd"; $MODULES_DIR = "/usr/local/apache2/modules"; } $SIG{TERM} = $SIG{INT} = \&handle_interrupt; my %opt; getopts('A:E:D:C:T:H:a:p:dvh', \%opt); if ($opt{d}) { $Data::Dumper::Indent = 1; $Data::Dumper::Terse = 1; $Data::Dumper::Pad = ""; $Data::Dumper::Quotekeys = 0; } sub usage { print stderr <<"EOT"; @_ Usage: $SCRIPT [options] [file [N]] Options: -A file Specify ModSecurity audit log to read. -D file Specify ModSecurity debug log to read. -E file Specify Apache httpd error log to read. -C file Specify Apache httpd base conf file to generate/reload. -H path Specify Apache httpd htdocs path. -S path Specify Apache httpd server root path. -a file Specify Apache httpd binary (default: httpd) -p port Specify Apache httpd port (default: 8088) -v Enable verbose output (details on failure). -d Enable debugging output. -h This help. EOT exit(1); } usage() if ($opt{h}); ### Check httpd binary if (defined $opt{a}) { $HTTPD = $opt{a}; } else { $opt{a} = $HTTPD; } usage("Invalid Apache startup script: $HTTPD\n") unless (-e $HTTPD); ### Defaults $opt{A} = "$FILES_DIR/modsec_audit.log" unless (defined $opt{A}); $opt{D} = "$FILES_DIR/modsec_debug.log" unless (defined $opt{D}); $opt{E} = "$FILES_DIR/error.log" unless (defined $opt{E}); $opt{C} = "$CONF_DIR/httpd.conf" unless (defined $opt{C}); $opt{H} = "$SROOT_DIR/htdocs" unless (defined $opt{H}); $opt{p} = 8088 unless (defined $opt{p}); $opt{v} = 1 if ($opt{d}); unless (defined $opt{S}) { my $httpd_root = `$HTTPD -V`; ($opt{S} = $httpd_root) =~ s/.*-D HTTPD_ROOT="([^"]*)".*/$1/sm; } %ENV = ( %ENV, SERVER_ROOT => $opt{S}, SERVER_PORT => $opt{p}, SERVER_NAME => "localhost", TEST_SERVER_ROOT => $SROOT_DIR, DATA_DIR => $DATA_DIR, TEMP_DIR => $TEMP_DIR, UPLOAD_DIR => $UPLOAD_DIR, CONF_DIR => $CONF_DIR, MODULES_DIR => $MODULES_DIR, LOGS_DIR => $FILES_DIR, SCRIPT_DIR => $SCRIPT_DIR, REGRESSION_DIR => $REG_DIR, DIST_ROOT => File::Spec->rel2abs(dirname("$SCRIPT_DIR/../../..")), AUDIT_LOG => $opt{A}, DEBUG_LOG => $opt{D}, ERROR_LOG => $opt{E}, HTTPD_CONF => $opt{C}, HTDOCS => $opt{H}, USER_AGENT => $UA_NAME, ); #dbg("OPTIONS: ", \%opt); if (-e "$PID_FILE") { msg("Shutting down previous instance: $PID_FILE"); httpd_stop(); } if (defined $ARGV[0]) { runfile(dirname($ARGV[0]), basename($ARGV[0]), $ARGV[1]); done(); } for my $type (@TYPES) { my $dir = "$SCRIPT_DIR/regression/$type"; my @cfg = (); # Get test names opendir(DIR, "$dir") or quit(1, "Failed to open \"$dir\": $!"); @cfg = grep { /\.t$/ && -f "$dir/$_" } readdir(DIR); closedir(DIR); for my $cfg (sort @cfg) { runfile($dir, $cfg); } } done(); sub runfile { my($dir, $cfg, $testnum) = @_; my $fn = "$dir/$cfg"; my @data = (); my $edata; my @C = (); my @test = (); my $teststr; my $n = 0; my $pass = 0; open(CFG, "<$fn") or quit(1, "Failed to open \"$fn\": $!"); @data = ; $edata = q/@C = (/ . join("", @data) . q/)/; eval $edata; quit(1, "Failed to read test data \"$cfg\": $@") if ($@); unless (@C) { msg("\nNo tests defined for $fn"); return; } msg("\nLoaded ".@C." tests from $fn"); for my $t (@C) { $n++; next if (defined $testnum and $n != $testnum); my $httpd_up = 0; my %t = %{$t || {}}; my $id = sprintf("%3d", $n); my $out = ""; my $rc = 0; my $conf_fn; # Startup httpd with optionally included conf. if (exists $t{conf} and defined $t{conf}) { $conf_fn = sprintf "%s/%s_%s_%06d.conf", $CONF_DIR, $t{type}, $cfg, $n; #dbg("Writing test config to: $conf_fn"); open(CONF, ">$conf_fn") or die "Failed to open conf \"$conf_fn\": $!\n"; print CONF (ref $t{conf} eq "CODE" ? eval { &{$t{conf}} } : $t{conf}); msg("$@") if ($@); close CONF; $httpd_up = httpd_start(\%t, "Include $conf_fn") ? 0 : 1; } else { $httpd_up = httpd_start(\%t) ? 0 : 1; } # Run any prerun setup if ($rc == 0 and exists $t{prerun} and defined $t{prerun}) { vrb("Executing perl prerun..."); $rc = &{$t{prerun}}; vrb("Perl prerun returned: $rc"); } if ($httpd_up) { # Perform the request and check response if (exists $t{request}) { my $resp = do_request($t{request}); if (!$resp) { msg("invalid response"); vrb("RESPONSE: ", $resp); $rc = 1; } else { for my $key (keys %{ $t{match_response} || {}}) { my($neg,$mtype) = ($key =~ m/^(-?)(.*)$/); my $m = $t{match_response}{$key}; my $match = match_response($mtype, $resp, $m); if ($neg and defined $match) { $rc = 1; msg("response $mtype matched: $m"); vrb($resp); last; } elsif (!$neg and !defined $match) { $rc = 1; msg("response $mtype failed to match: $m"); vrb($resp); last; } } } } # Run any arbitrary perl tests if ($rc == 0 and exists $t{test} and defined $t{test}) { dbg("Executing perl test(s)..."); $rc = eval { &{$t{test}} }; if (! defined $rc) { msg("Error running test: $@"); $rc = -1; } dbg("Perl tests returned: $rc"); } # Search for all log matches if ($rc == 0 and exists $t{match_log} and defined $t{match_log}) { for my $key (keys %{ $t{match_log} || {}}) { my($neg,$mtype) = ($key =~ m/^(-?)(.*)$/); my $m = $t{match_log}{$key}; my $match = match_log($mtype, @{$m || []}); if ($neg and defined $match) { $rc = 1; msg("$mtype log matched: $m->[0]"); last; } elsif (!$neg and !defined $match) { $rc = 1; msg("$mtype log failed to match: $m->[0]"); last; } } } # Search for all file matches if ($rc == 0 and exists $t{match_file} and defined $t{match_file}) { sleep 1; # Make sure the file exists for my $key (keys %{ $t{match_file} || {}}) { my($neg,$fn) = ($key =~ m/^(-?)(.*)$/); my $m = $t{match_file}{$key}; my $match = match_file($fn, $m); if ($neg and defined $match) { $rc = 1; msg("$fn file matched: $m"); last; } elsif (!$neg and !defined $match) { $rc = 1; msg("$fn file failed match: $m"); last; } } } } else { msg("Failed to start httpd."); $rc = 1; } if ($rc == 0) { $pass++; } else { vrb("Test Config: $conf_fn"); vrb("Debug Log: $FILE{debug}{fn}"); dbg(escape("$FILE{debug}{buf}")); vrb("Error Log: $FILE{error}{fn}"); dbg(escape("$FILE{error}{buf}")); } msg(sprintf("%s) %s%s: %s%s", $id, $t{type}, (exists($t{comment}) ? " - $t{comment}" : ""), ($rc ? "failed" : "passed"), ((defined($out) && $out ne "")? " ($out)" : ""))); if ($httpd_up) { $httpd_up = httpd_stop(\%t) ? 0 : 1; } } $TOTAL += $testnum ? 1 : $n; $PASSED += $pass; msg(sprintf("Passed: %2d; Failed: %2d", $pass, $testnum ? (1 - $pass) : ($n - $pass))); } # Take out any indenting and translate LF -> CRLF sub normalize_raw_request_data { my $r = $_[0]; # Allow for indenting in test file $r =~ s/^[ \t]*\x0d?\x0a//s; my($indention) = ($r =~ m/^([ \t]*)/s); # indention taken from first line $r =~ s/^$indention//mg; $r =~ s/(\x0d?\x0a)[ \t]+$/$1/s; # Translate LF to CRLF $r =~ s/^\x0a/\x0d\x0a/mg; $r =~ s/([^\x0d])\x0a/$1\x0d\x0a/mg; return $r; } sub do_raw_request { my $sock = new IO::Socket::INET( Proto => "tcp", PeerAddr => "localhost", PeerPort => $opt{p}, ) or msg("Failed to connect to localhost:$opt{p}: $@"); return unless ($sock); # Join togeather the request my $r = join("", @_); dbg($r); # Write to socket print $sock "$r"; $sock->shutdown(1); # Read from socket my @resp = <$sock>; $sock->close(); return HTTP::Response->parse(join("", @resp)); } sub do_request { my $r = $_[0]; # Allow test to execute code if (ref $r eq "CODE") { $r = eval { &$r }; msg("$@") unless (defined $r); } if (ref $r eq "HTTP::Request") { my $resp = $UA->request($r); dbg($resp->request()->as_string()) if ($opt{d}); return $resp } else { return do_raw_request($r); } return; } sub match_response { my($name, $resp, $re) = @_; msg("Warning: Empty regular expression.") if (!defined $re or $re eq ""); if ($name eq "status") { return $& if ($resp->code =~ m/$re/); } elsif ($name eq "content") { return $& if ($resp->content =~ m/$re/m); } elsif ($name eq "raw") { return $& if ($resp->as_string =~ m/$re/m); } return; } sub read_log { my($name, $timeout, $graph) = @_; return match_log($name, undef, $timeout, $graph); } sub match_log { my($name, $re, $timeout, $graph) = @_; my $t0 = gettimeofday; my($fh,$rbuf) = ($FILE{$name}{fd}, \$FILE{$name}{buf}); my $n = length($$rbuf); my $rc = undef; unless (defined $fh) { msg("Error: File \"$name\" is not opened for matching."); return; } $timeout = 0 unless (defined $timeout); my $i = 0; my $graphed = 0; READ: { do { my $nbytes = $fh->sysread($$rbuf, $BUFSIZ, $n); if (!defined($nbytes)) { msg("Error: Could not read \"$name\" log: $!"); last; } elsif (!defined($re) and $nbytes == 0) { last; } # Remove APR pool debugging $$rbuf =~ s/POOL DEBUG:[^\n]+PALLOC[^\n]+\n//sg; $n = length($$rbuf); #dbg("Match \"$re\" in $name \"$$rbuf\" ($n)"); if ($$rbuf =~ m/$re/m) { $rc = $&; last; } # TODO: Use select()/poll() sleep 0.1 unless ($nbytes == $BUFSIZ); if ($graph and $opt{d}) { $i++; if ($i == 10) { $graphed++; $i=0; print STDERR $graph if ($graphed == 1); print STDERR "." } } } while (gettimeofday - $t0 < $timeout); } print STDERR "\n" if ($graphed); return $rc; } sub match_file { my($neg,$fn) = ($_[0] =~ m/^(-?)(.*)$/); unless (exists $FILE{$fn}) { eval { $FILE{$fn}{fn} = $fn; $FILE{$fn}{fd} = new FileHandle($fn, O_RDONLY) or die "$!\n"; $FILE{$fn}{fd}->blocking(0); $FILE{$fn}{buf} = ""; }; if ($@) { msg("Warning: Failed to open file \"$fn\": $@"); return; } } return match_log($_[0], $_[1]); # timeout makes no sense } sub quote_shell { my($s) = @_; return $s unless ($s =~ m|[^\w!%+,\-./:@^]|); $s =~ s/(['\\])/\\$1/g; return "'$s'"; } sub escape { my @new = (); for my $c (split(//, $_[0])) { my $oc = ord($c); push @new, ((($oc >= 0x20 and $oc <= 0x7e) or $oc == 0x0a or $oc == 0x0d) ? $c : sprintf("\\x%02x", ord($c))); } join('', @new); } sub dbg { return unless(@_ and $opt{d}); my $out = join "", map { (ref $_ ne "" ? Dumper($_) : $_) } @_; $out =~ s/^/DBG: /mg; print STDOUT "$out\n"; } sub vrb { return unless(@_ and $opt{v}); msg(@_); } sub msg { return unless(@_); my $out = join "", map { (ref $_ ne "" ? Dumper($_) : $_) } @_; print STDOUT "$out\n"; } sub handle_interrupt { $SIG{TERM} = $SIG{INT} = \&handle_interrupt; msg("Interrupted via SIG$_[0]. Shutting down tests..."); httpd_stop(); quit(1); } sub quit { my($ec,$msg) = @_; $ec = 0 unless (defined $_[0]); msg("$msg") if (defined $msg); exit $ec; } sub done { if ($PASSED != $TOTAL) { quit(1, "\n$PASSED/$TOTAL tests passed."); } quit(0, "\nAll tests passed ($TOTAL)."); } sub httpd_start { my $t = shift; httpd_reset_fd($t); my @p = ( $HTTPD, -d => $opt{S}, -f => $opt{C}, (map { (-c => $_) } ("Listen localhost:$opt{p}", @_)), -k => "start", ); my $httpd_out; my $httpd_pid = open3(undef, $httpd_out, undef, @p) or quit(1); my $out = join("\\n", grep(!/POOL DEBUG/, (<$httpd_out>))); close $httpd_out; waitpid($httpd_pid, 0); my $rc = $?; if ( WIFEXITED($rc) ) { $rc = WEXITSTATUS($rc); vrb("Httpd start returned with $rc.") if ($rc); } elsif( WIFSIGNALED($rc) ) { msg("Httpd start failed with signal " . WTERMSIG($rc) . "."); $rc = -1; } else { msg("Httpd start failed with unknown error."); $rc = -1; } if (defined $out and $out ne "") { vrb(join(" ", map { quote_shell($_) } @p)); msg("Httpd start failed with error messages:\n$out"); httpd_stop(); return -1 } # Look for startup msg unless (defined match_log("error", qr/resuming normal operations/, 60, "Waiting on httpd to start: ")) { vrb(join(" ", map { quote_shell($_) } @p)); vrb(match_log("error", qr/(^.*ModSecurity: .*)/sm, 10)); msg("Httpd server failed to start."); httpd_stop(); return -1; } return $rc; } sub httpd_stop { my $t = shift; my @p = ( $HTTPD, -d => $opt{S}, -f => $opt{C}, (map { (-c => $_) } ("Listen localhost:$opt{p}", @_)), -k => "stop", ); my $httpd_out; my $httpd_pid = open3(undef, $httpd_out, undef, @p) or quit(1); my $out = join("\\n", grep(!/POOL DEBUG/, (<$httpd_out>))); close $httpd_out; waitpid($httpd_pid, 0); if (defined $out and $out ne "") { msg("Httpd stop failed with error messages:\n$out"); return -1 } my $rc = $?; if ( WIFEXITED($rc) ) { $rc = WEXITSTATUS($rc); vrb("Httpd stop returned with $rc.") if ($rc); } elsif( WIFSIGNALED($rc) ) { msg("Httpd stop failed with signal " . WTERMSIG($rc) . "."); $rc = -1; } else { msg("Httpd stop failed with unknown error."); $rc = -1; } # Look for startup msg unless (defined match_log("error", qr/caught SIG[A-Z]+, shutting down/, 60, "Waiting on httpd to stop: ")) { vrb(join(" ", map { quote_shell($_) } @p)); msg("Httpd server failed to shutdown."); sleep 0.5; return -1; } sleep 0.5; return $rc; } sub httpd_reload { my $t = shift; httpd_reset_fd($t); my @p = ( $HTTPD, -d => $opt{S}, -f => $opt{C}, (map { (-c => $_) } ("Listen localhost:$opt{p}", @_)), -k => "graceful", ); my $httpd_out; my $httpd_pid = open3(undef, $httpd_out, undef, @p) or quit(1); my $out = join("\\n", grep(!/POOL DEBUG/, (<$httpd_out>))); close $httpd_out; waitpid($httpd_pid, 0); if (defined $out and $out ne "") { msg("Httpd reload failed with error messages:\n$out"); return -1 } my $rc = $?; if ( WIFEXITED($rc) ) { $rc = WEXITSTATUS($rc); vrb("Httpd reload returned with $rc.") if ($rc); } elsif( WIFSIGNALED($rc) ) { msg("Httpd reload failed with signal " . WTERMSIG($rc) . "."); $rc = -1; } else { msg("Httpd reload failed with unknown error."); $rc = -1; } # Look for startup msg unless (defined match_log("error", qr/resuming normal operations/, 60, "Waiting on httpd to restart: ")) { vrb(join(" ", map { quote_shell($_) } @p)); msg("Httpd server failed to reload."); return -1; } return $rc; } sub httpd_reset_fd { my($t) = @_; # Cleanup for my $key (keys %FILE) { if (exists $FILE{$key}{fd} and defined $FILE{$key}{fd}) { $FILE{$key}{fd}->close(); } delete $FILE{$key}; } # Error eval { $FILE{error}{fn} = $opt{E}; $FILE{error}{fd} = new FileHandle($opt{E}, O_RDWR|O_CREAT) or die "$!\n"; $FILE{error}{fd}->blocking(0); $FILE{error}{fd}->sysseek(0, 2); $FILE{error}{buf} = ""; }; if ($@) { msg("Warning: Failed to open file \"$opt{E}\": $@"); return undef; } # Audit eval { $FILE{audit}{fn} = $opt{A}; $FILE{audit}{fd} = new FileHandle($opt{A}, O_RDWR|O_CREAT) or die "$!\n"; $FILE{audit}{fd}->blocking(0); $FILE{audit}{fd}->sysseek(0, 2); $FILE{audit}{buf} = ""; }; if ($@) { msg("Warning: Failed to open file \"$opt{A}\": $@"); return undef; } # Debug eval { $FILE{debug}{fn} = $opt{D}; $FILE{debug}{fd} = new FileHandle($opt{D}, O_RDWR|O_CREAT) or die "$!\n"; $FILE{debug}{fd}->blocking(0); $FILE{debug}{fd}->sysseek(0, 2); $FILE{debug}{buf} = ""; }; if ($@) { msg("Warning: Failed to open file \"$opt{D}\": $@"); return undef; } # Any extras listed in "match_log" if ($t and exists $t->{match_log}) { for my $k (keys %{ $t->{match_log} || {} }) { my($neg,$fn) = ($k =~ m/^(-?)(.*)$/); next if (!$fn or exists $FILE{$fn}); eval { $FILE{$fn}{fn} = $fn; $FILE{$fn}{fd} = new FileHandle($fn, O_RDWR|O_CREAT) or die "$!\n"; $FILE{$fn}{fd}->blocking(0); $FILE{$fn}{fd}->sysseek(0, 2); $FILE{$fn}{buf} = ""; }; if ($@) { msg("Warning: Failed to open file \"$fn\": $@"); return undef; } } } } sub encode_chunked { my($data, $size) = @_; $size = 128 unless ($size); my $chunked = ""; my $n = 0; my $bytes = length($data); while ($bytes >= $size) { $chunked .= sprintf "%x\x0d\x0a%s\x0d\x0a", $size, substr($data, $n, $size); $n += $size; $bytes -= $size; } if ($bytes) { $chunked .= sprintf "%x\x0d\x0a%s\x0d\x0a", $bytes, substr($data, $n, $bytes); } $chunked .= "0\x0d\x0a\x0d\x0a" } modsecurity-apache_2.7.7/tests/regression/0000775000175000017500000000000012243422537021161 5ustar zimmerlezimmerlemodsecurity-apache_2.7.7/tests/regression/misc/0000775000175000017500000000000012243422537022114 5ustar zimmerlezimmerlemodsecurity-apache_2.7.7/tests/regression/misc/10-pcre.t0000664000175000017500000021616712243422537023465 0ustar zimmerlezimmerle### PCRE Limits { type => "misc", comment => "PCRE limits", conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRequestBodyAccess On SecRequestBodyLimit 1000000 SecRequestBodyInMemoryLimit 1000000 # Set Limits low SecPcreMatchLimit 100 SecPcreMatchLimitRecursion 100 # Poor REGEX SecRule ARGS "(?:(.{2,})\\1{32,})" "phase:2,deny,capture,msg:'REDoS',id:500053" # Detect PCRE limits exceeded SecRule TX:MSC_PCRE_LIMITS_EXCEEDED "!\@streq 0" "phase:2,deny,msg:'ModSecurity Internal Error Flagged: %{MATCHED_VAR_NAME}',id:500054" ), match_log => { debug => [ qr/PCRE limits exceeded/, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/index.html", [ "Content-Type" => "application/x-www-form-urlencoded", ], # Args "test=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaacaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaacaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaacaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaacaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaacaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaacaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaacaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaacaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaacaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaacaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaacaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaacaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaacaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaacaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaacaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaacaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaacaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaacaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaacaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaacaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaacaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaacaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaacaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaacaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaacaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaacaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaacaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaacaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaacaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaacaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaacaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaacaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaad", ), }, modsecurity-apache_2.7.7/tests/regression/misc/00-multipart-parser.t0000664000175000017500000016550612243422537026046 0ustar zimmerlezimmerle### Multipart parser tests # Normal { type => "misc", comment => "multipart parser (normal)", conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRequestBodyAccess On SecRule MULTIPART_STRICT_ERROR "\@eq 1" "phase:2,deny,id:500055" SecRule MULTIPART_UNMATCHED_BOUNDARY "\@eq 1" "phase:2,deny,id:500056" SecRule REQBODY_PROCESSOR_ERROR "\@eq 1" "phase:2,deny,id:500057" ), match_log => { debug => [ qr/Added file part [0-9a-h]+ to the list: name "image" file name "image.jpg" \(offset 258, length 10\).*Adding request argument \(BODY\): name "name", value "Brian Rectanus".*Adding request argument \(BODY\): name "email", value "brian.rectanus\@breach.com"/s, 1 ], -debug => [ qr/Multipart.*(?i:error|warning)/, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => q(multipart/form-data; boundary=0000), ], normalize_raw_request_data( q( --0000 Content-Disposition: form-data; name="name" Brian Rectanus --0000 Content-Disposition: form-data; name="email" brian.rectanus@breach.com --0000 Content-Disposition: form-data; name="image"; filename="image.jpg" Content-Type: image/jpeg BINARYDATA --0000-- ), ), ), }, # Final CRLF or not, we should still work { type => "misc", comment => "multipart parser (final CRLF)", conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRequestBodyAccess On SecRule MULTIPART_STRICT_ERROR "\@eq 1" "phase:2,deny,id:500058" SecRule MULTIPART_UNMATCHED_BOUNDARY "\@eq 1" "phase:2,deny,id:500059" SecRule REQBODY_PROCESSOR_ERROR "\@eq 1" "phase:2,deny,id:500060" ), match_log => { debug => [ qr/Adding request argument \(BODY\): name "a", value "1".*Adding request argument \(BODY\): name "b", value "2"/s, 1 ], -debug => [ qr/Multipart error:/, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "multipart/form-data; boundary=---------------------------69343412719991675451336310646", ], normalize_raw_request_data( q( -----------------------------69343412719991675451336310646 Content-Disposition: form-data; name="a" 1 -----------------------------69343412719991675451336310646 Content-Disposition: form-data; name="b" 2 -----------------------------69343412719991675451336310646-- ), ), ), }, # No final CRLF { type => "misc", comment => "multipart parser (no final CRLF)", conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRequestBodyAccess On SecRule MULTIPART_STRICT_ERROR "\@eq 1" "phase:2,deny,id:500061" SecRule MULTIPART_UNMATCHED_BOUNDARY "\@eq 1" "phase:2,deny,id:500062" SecRule REQBODY_PROCESSOR_ERROR "\@eq 1" "phase:2,deny,id:500063" ), match_log => { debug => [ qr/Adding request argument \(BODY\): name "a", value "1".*Adding request argument \(BODY\): name "b", value "2"/s, 1 ], -debug => [ qr/Multipart error:/, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "multipart/form-data; boundary=---------------------------69343412719991675451336310646", ], normalize_raw_request_data( q( -----------------------------69343412719991675451336310646 Content-Disposition: form-data; name="a" 1 -----------------------------69343412719991675451336310646 Content-Disposition: form-data; name="b" 2 -----------------------------69343412719991675451336310646--), ), ), }, # Should work with a boundary of "boundary" { type => "misc", comment => "multipart parser (boundary contains \"boundary\")", conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRequestBodyAccess On SecRule MULTIPART_STRICT_ERROR "\@eq 1" "phase:2,deny,id:500064" SecRule MULTIPART_UNMATCHED_BOUNDARY "\@eq 1" "phase:2,deny,id:500065" SecRule REQBODY_PROCESSOR_ERROR "\@eq 1" "phase:2,deny,id:500066" ), match_log => { debug => [ qr/Adding request argument \(BODY\): name "a", value "1".*Adding request argument \(BODY\): name "b", value "2"/s, 1 ], -debug => [ qr/Multipart error:/, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "multipart/form-data; boundary=------------------------------------------------boundary", ], normalize_raw_request_data( q( --------------------------------------------------boundary Content-Disposition: form-data; name="a" 1 --------------------------------------------------boundary Content-Disposition: form-data; name="b" 2 --------------------------------------------------boundary-- ), ), ), }, { type => "misc", comment => "multipart parser (boundary contains \"bOuNdArY\")", note => q( KHTML Boundary ), conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRequestBodyAccess On SecRule MULTIPART_STRICT_ERROR "\@eq 1" "phase:2,deny,id:500067" SecRule MULTIPART_UNMATCHED_BOUNDARY "\@eq 1" "phase:2,deny,id:500068" SecRule REQBODY_PROCESSOR_ERROR "\@eq 1" "phase:2,deny,id:500069" ), match_log => { debug => [ qr/Adding request argument \(BODY\): name "a", value "1".*Adding request argument \(BODY\): name "b", value "2"/s, 1 ], -debug => [ qr/Multipart error:/, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "multipart/form-data; boundary=--------0xKhTmLbOuNdArY", ], normalize_raw_request_data( q( ----------0xKhTmLbOuNdArY Content-Disposition: form-data; name="a" 1 ----------0xKhTmLbOuNdArY Content-Disposition: form-data; name="b" 2 ----------0xKhTmLbOuNdArY-- ), ), ), }, # We should handle data starting with a "--" { type => "misc", comment => "multipart parser (data contains \"--\")", conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRequestBodyAccess On SecRule MULTIPART_STRICT_ERROR "\@eq 1" "phase:2,deny,id:500070" SecRule REQBODY_PROCESSOR_ERROR "\@eq 1" "phase:2,deny,id:500071" ), match_log => { debug => [ qr/Adding request argument \(BODY\): name "a", value "--test".*Adding request argument \(BODY\): name "b", value "--"/s, 1 ], -debug => [ qr/Multipart error:/, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "multipart/form-data; boundary=---------------------------69343412719991675451336310646", ], normalize_raw_request_data( q( -----------------------------69343412719991675451336310646 Content-Disposition: form-data; name="a" --test -----------------------------69343412719991675451336310646 Content-Disposition: form-data; name="b" -- -----------------------------69343412719991675451336310646--), ), ), }, # We should emit warnings for parsing errors { type => "misc", comment => "multipart parser error (no final boundary)", conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRequestBodyAccess On SecAuditLog "$ENV{AUDIT_LOG}" SecAuditEngine RelevantOnly ), match_log => { audit => [ qr/Final boundary missing/, 1 ], debug => [ qr/Final boundary missing/, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "multipart/form-data; boundary=---------------------------69343412719991675451336310646", ], normalize_raw_request_data( q( -----------------------------69343412719991675451336310646 Content-Disposition: form-data; name="a" 1 -----------------------------69343412719991675451336310646 Content-Disposition: form-data; name="b" 2 ), ), ), }, { type => "misc", comment => "multipart parser error (no disposition)", conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRequestBodyAccess On SecAuditLog "$ENV{AUDIT_LOG}" SecAuditEngine RelevantOnly ), match_log => { -debug => [ qr/Multipart error:/, 1 ], audit => [ qr/Part missing Content-Disposition header/, 1 ], debug => [ qr/Part missing Content-Disposition header/, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "multipart/form-data; boundary=---------------------------69343412719991675451336310646", ], normalize_raw_request_data( q( -----------------------------69343412719991675451336310646 1 -----------------------------69343412719991675451336310646 2 -----------------------------69343412719991675451336310646-- ), ), ), }, { type => "misc", comment => "multipart parser error (bad disposition)", conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRequestBodyAccess On SecAuditLog "$ENV{AUDIT_LOG}" SecAuditEngine RelevantOnly ), match_log => { audit => [ qr/Invalid Content-Disposition header/, 1 ], debug => [ qr/Invalid Content-Disposition header/, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "multipart/form-data; boundary=---------------------------69343412719991675451336310646", ], normalize_raw_request_data( q( -----------------------------69343412719991675451336310646 Content-Disposition: form-data name="a" 1 -----------------------------69343412719991675451336310646 Content-Disposition: form-data name="b" 2 -----------------------------69343412719991675451336310646-- ), ), ), }, { type => "misc", comment => "multipart parser error (no disposition name)", conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRequestBodyAccess On SecAuditLog "$ENV{AUDIT_LOG}" SecAuditEngine RelevantOnly ), match_log => { -debug => [ qr/Multipart error:/, 1 ], audit => [ qr/Content-Disposition header missing name field/, 1 ], debug => [ qr/Content-Disposition header missing name field/, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "multipart/form-data; boundary=---------------------------69343412719991675451336310646", ], normalize_raw_request_data( q( -----------------------------69343412719991675451336310646 Content-Disposition: form-data; 1 -----------------------------69343412719991675451336310646 Content-Disposition: form-data; 2 -----------------------------69343412719991675451336310646-- ), ), ), }, # Zero length part name should not crash { type => "misc", comment => "multipart parser (zero length part name)", conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRequestBodyAccess On SecRule MULTIPART_STRICT_ERROR "!\@eq 1" "phase:2,deny,id:500072" SecRule REQBODY_PROCESSOR_ERROR "!\@eq 1" "phase:2,deny,id:500073" ), match_log => { debug => [ qr/name: a.*variable: 1.*Invalid part header \(header name missing\)/s, 1 ], -debug => [ qr/Adding request argument \(BODY\): name "b"/s, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "multipart/form-data; boundary=---------------------------69343412719991675451336310646", ], normalize_raw_request_data( q( -----------------------------69343412719991675451336310646 Content-Disposition: form-data; name="a" 1 -----------------------------69343412719991675451336310646 : -----------------------------69343412719991675451336310646 Content-Disposition: form-data; name="b" 2 -----------------------------69343412719991675451336310646-- ), ), ), }, # Part header folding { type => "misc", comment => "multipart parser (part header folding - space)", conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRequestBodyAccess On SecRule MULTIPART_STRICT_ERROR "!\@eq 1" "phase:2,deny,status:403,id:500074" SecRule MULTIPART_HEADER_FOLDING "!\@eq 1" "phase:2,deny,status:403,id:500075" SecRule MULTIPART_INVALID_HEADER_FOLDING "!\@eq 0" "phase:2,deny,status:403,id:500076" SecRule REQBODY_PROCESSOR_ERROR "\@eq 1" "phase:2,deny,status:403,id:500077" ), match_log => { debug => [ qr/name: a.*variable: 1.*name: b.*variable: 2/s, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "multipart/form-data; boundary=---------------------------69343412719991675451336310646", ], normalize_raw_request_data( q( -----------------------------69343412719991675451336310646 Content-Disposition: form-data; name="a" 1 -----------------------------69343412719991675451336310646 Content-Disposition: form-data; name="b" 2 -----------------------------69343412719991675451336310646-- ), ), ), }, { type => "misc", comment => "multipart parser (part header folding - tab)", conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRequestBodyAccess On SecRule MULTIPART_STRICT_ERROR "!\@eq 1" "phase:2,deny,status:403,id:500078" SecRule MULTIPART_HEADER_FOLDING "!\@eq 1" "phase:2,deny,status:403,id:500079" SecRule MULTIPART_INVALID_HEADER_FOLDING "!\@eq 0" "phase:2,deny,status:403,id:500080" SecRule REQBODY_PROCESSOR_ERROR "\@eq 1" "phase:2,deny,status:403,id:500081" ), match_log => { debug => [ qr/name: a.*variable: 1.*name: b.*variable: 2/s, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "multipart/form-data; boundary=---------------------------69343412719991675451336310646", ], normalize_raw_request_data( q( -----------------------------69343412719991675451336310646 Content-Disposition: form-data; name="a" 1 -----------------------------69343412719991675451336310646 Content-Disposition: form-data; name="b" 2 -----------------------------69343412719991675451336310646-- ), ), ), }, { type => "misc", comment => "multipart parser (part header folding - mixed)", conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRequestBodyAccess On SecRule MULTIPART_STRICT_ERROR "!\@eq 1" "phase:2,deny,status:403,id:500082" SecRule MULTIPART_HEADER_FOLDING "!\@eq 1" "phase:2,deny,status:403,id:500083" SecRule MULTIPART_INVALID_HEADER_FOLDING "!\@eq 0" "phase:2,deny,status:403,id:500084" SecRule REQBODY_PROCESSOR_ERROR "\@eq 1" "phase:2,deny,status:403,id:500085" ), match_log => { debug => [ qr/name: a.*variable: 1.*name: b.*variable: 2/s, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "multipart/form-data; boundary=---------------------------69343412719991675451336310646", ], normalize_raw_request_data( q( -----------------------------69343412719991675451336310646 Content-Disposition: form-data; name="a" 1 -----------------------------69343412719991675451336310646 Content-Disposition: form-data; name="b" 2 -----------------------------69343412719991675451336310646-- ), ), ), }, { type => "misc", comment => "multipart parser (part header folding - invalid)", conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRequestBodyAccess On SecRule MULTIPART_STRICT_ERROR "!\@eq 1" "phase:2,deny,status:403,id:500086" SecRule MULTIPART_HEADER_FOLDING "!\@eq 1" "phase:2,deny,status:403,id:500087" SecRule MULTIPART_INVALID_HEADER_FOLDING "!\@eq 1" "phase:2,deny,status:403,id:500088" SecRule REQBODY_PROCESSOR_ERROR "\@eq 1" "phase:2,deny,status:403,id:500089" ), match_log => { debug => [ qr/name: a.*variable: 1.*name: b.*variable: 2/s, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "multipart/form-data; boundary=---------------------------69343412719991675451336310646", ], normalize_raw_request_data( q( -----------------------------69343412719991675451336310646 Content-Disposition: form-data; name="a" 1 -----------------------------69343412719991675451336310646 Content-Disposition: form-data; name="b" 2 -----------------------------69343412719991675451336310646-- ), ), ), }, { type => "misc", comment => "multipart parser (part header folding - mixed invalid)", conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRequestBodyAccess On SecRule MULTIPART_STRICT_ERROR "!\@eq 1" "phase:2,deny,status:403,id:500090" SecRule MULTIPART_HEADER_FOLDING "!\@eq 1" "phase:2,deny,status:403,id:500091" SecRule MULTIPART_INVALID_HEADER_FOLDING "!\@eq 1" "phase:2,deny,status:403,id:500092" SecRule REQBODY_PROCESSOR_ERROR "\@eq 1" "phase:2,deny,status:403,id:500093" ), match_log => { debug => [ qr/name: a.*variable: 1.*name: b.*variable: 2/s, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "multipart/form-data; boundary=---------------------------69343412719991675451336310646", ], normalize_raw_request_data( q( -----------------------------69343412719991675451336310646 Content-Disposition: form-data; name="a" 1 -----------------------------69343412719991675451336310646 Content-Disposition: form-data; name="b" 2 -----------------------------69343412719991675451336310646-- ), ), ), }, # Data following final boundary should set flag { type => "misc", comment => "multipart parser (data after final boundary)", conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRequestBodyAccess On SecRule MULTIPART_DATA_AFTER "\@eq 1" "phase:2,deny,status:403,id:500094" ), match_log => { debug => [ qr/name: a.*variable: 1.*Ignoring data after last boundary/s, 1 ], -debug => [ qr/Adding request argument \(BODY\): name "b"/s, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "multipart/form-data; boundary=---------------------------69343412719991675451336310646", ], normalize_raw_request_data( q( -----------------------------69343412719991675451336310646 Content-Disposition: form-data; name="a" 1 -----------------------------69343412719991675451336310646-- -----------------------------69343412719991675451336310646 Content-Disposition: form-data; name="b" 2 -----------------------------69343412719991675451336310646-- ), ), ), }, # Single quoted data is invalid { type => "misc", comment => "multipart parser (C-D uses single quotes)", conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRequestBodyAccess On SecRule MULTIPART_STRICT_ERROR "!\@eq 1" "phase:2,deny,id:500095" SecRule MULTIPART_INVALID_QUOTING "!\@eq 1" "phase:2,deny,id:500096" SecRule REQBODY_PROCESSOR_ERROR "\@eq 1" "chain,phase:2,deny,id:500097" ), match_log => { debug => [ qr/name: a.*variable: 1.*Duplicate Content-Disposition name/s, 1 ], -debug => [ qr/Adding request argument \(BODY\): name "b/s, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "multipart/form-data; boundary=---------------------------69343412719991675451336310646", ], normalize_raw_request_data( q( -----------------------------69343412719991675451336310646 Content-Disposition: form-data; name="a" 1 -----------------------------69343412719991675451336310646 Content-Disposition: form-data; name=';filename="dummy';name=b;" 2 -----------------------------69343412719991675451336310646-- ), ), ), }, # Invalid boundary separators { type => "misc", comment => "multipart parser (invalid C-T boundary separator - comma)", note => q( PHP 5.2.3 - no effect. ), conf => qq( SecRuleEngine On SecRequestBodyAccess On SecRule MULTIPART_STRICT_ERROR "\@eq 1" "phase:2,deny,id:500098" SecRule MULTIPART_UNMATCHED_BOUNDARY "\@eq 1" "phase:2,deny,id:500099" SecRule REQBODY_PROCESSOR_ERROR "\@eq 1" "phase:2,deny,id:500100" ), match_log => { error => [ qr/Invalid boundary in C-T \(malformed\)/, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => q(multipart/form-data, boundary=0000), ], normalize_raw_request_data( q( --0000 Content-Disposition: form-data; name="name" Brian Rectanus --0000 Content-Disposition: form-data; name="email" brian.rectanus@breach.com --0000 Content-Disposition: form-data; name="image"; filename="image.jpg" Content-Type: image/jpeg BINARYDATA --0000-- ), ), ), }, { type => "misc", comment => "multipart parser (invalid C-T boundary separator - space)", note => q( PHP 5.2.3 - no effect. ), conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRequestBodyAccess On SecRule MULTIPART_STRICT_ERROR "\@eq 1" "phase:2,deny,id:500101" SecRule MULTIPART_UNMATCHED_BOUNDARY "\@eq 1" "phase:2,deny,id:500102" SecRule REQBODY_PROCESSOR_ERROR "\@eq 1" "phase:2,deny,id:500103" ), match_log => { }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => q(multipart/form-data boundary=0000), ], normalize_raw_request_data( q( --0000 Content-Disposition: form-data; name="name" Brian Rectanus --0000 Content-Disposition: form-data; name="email" brian.rectanus@breach.com --0000 Content-Disposition: form-data; name="image"; filename="image.jpg" Content-Type: image/jpeg BINARYDATA --0000-- ), ), ), }, # Invalid boundary parameter names { type => "misc", comment => "multipart parser (invalid C-T boundary parameter name - case)", note => q( PHP 5.2.3 - does not recognise boundary. ), conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRequestBodyAccess On SecRule MULTIPART_STRICT_ERROR "\@eq 1" "phase:2,deny,id:500104" SecRule MULTIPART_UNMATCHED_BOUNDARY "\@eq 1" "phase:2,deny,id:500105" SecRule REQBODY_PROCESSOR_ERROR "\@eq 1" "phase:2,deny,id:500106" ), match_log => { error => [ qr/Invalid boundary in C-T \(case sensitivity\)/, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => q(multipart/form-data; bOundAry=0000), ], normalize_raw_request_data( q( --0000 Content-Disposition: form-data; name="name" Brian Rectanus --0000 Content-Disposition: form-data; name="email" brian.rectanus@breach.com --0000 Content-Disposition: form-data; name="image"; filename="image.jpg" Content-Type: image/jpeg BINARYDATA --0000-- ), ), ), }, { type => "misc", comment => "multipart parser (invalid C-T boundary parameter name - trailing chars)", note => q( PHP 5.2.3 - does not recognise boundary. ), conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRequestBodyAccess On SecRule MULTIPART_STRICT_ERROR "\@eq 1" "phase:2,deny,id:500107" SecRule MULTIPART_UNMATCHED_BOUNDARY "\@eq 1" "phase:2,deny,id:500108" SecRule REQBODY_PROCESSOR_ERROR "\@eq 1" "phase:2,deny,id:500109" ), match_log => { error => [ qr/Invalid boundary in C-T \(parameter name\)/, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => q(multipart/form-data; boundary123=0000), ], normalize_raw_request_data( q( --0000 Content-Disposition: form-data; name="name" Brian Rectanus --0000 Content-Disposition: form-data; name="email" brian.rectanus@breach.com --0000 Content-Disposition: form-data; name="image"; filename="image.jpg" Content-Type: image/jpeg BINARYDATA --0000-- ), ), ), }, # Invalid boundaries { type => "misc", comment => "multipart parser (multiple C-T boundaries - first quoted)", note => q( PHP 5.2.3 - uses first boundary. ), conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRequestBodyAccess On SecRule MULTIPART_STRICT_ERROR "\@eq 1" "phase:2,deny,id:500110" SecRule MULTIPART_UNMATCHED_BOUNDARY "\@eq 1" "phase:2,deny,id:500111" SecRule REQBODY_PROCESSOR_ERROR "\@eq 1" "phase:2,deny,id:500112" ), match_log => { debug => [ qr/Multiple boundary parameters in C-T/, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => q(multipart/form-data; boundary="0000"; boundary=1111), ], normalize_raw_request_data( q( --0000 Content-Disposition: form-data; name="name" Brian Rectanus --0000 Content-Disposition: form-data; name="email" brian.rectanus@breach.com --0000 Content-Disposition: form-data; name="image"; filename="image.jpg" Content-Type: image/jpeg BINARYDATA --0000-- ), ), ), }, { type => "misc", comment => "multipart parser (multiple C-T boundaries - comma separated)", note => q( PHP 5.2.3 - uses first boundary. ), conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRequestBodyAccess On SecRule MULTIPART_STRICT_ERROR "\@eq 1" "phase:2,deny,id:500113" SecRule MULTIPART_UNMATCHED_BOUNDARY "\@eq 1" "phase:2,deny,id:500114" SecRule REQBODY_PROCESSOR_ERROR "\@eq 1" "phase:2,deny,id:500115" ), match_log => { debug => [ qr/Multiple boundary parameters in C-T/, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => q(multipart/form-data; boundary=0000, boundary=1111), ], normalize_raw_request_data( q( --0000 Content-Disposition: form-data; name="name" Brian Rectanus --0000 Content-Disposition: form-data; name="email" brian.rectanus@breach.com --0000 Content-Disposition: form-data; name="image"; filename="image.jpg" Content-Type: image/jpeg BINARYDATA --0000-- ), ), ), }, { type => "misc", comment => "multipart parser (boundary whitespace in C-T - after name)", note => q( PHP 5.2.3 - no effect. ), conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRequestBodyAccess On SecRule MULTIPART_STRICT_ERROR "\@eq 1" "phase:2,deny,id:500116" SecRule MULTIPART_UNMATCHED_BOUNDARY "\@eq 1" "phase:2,deny,id:500117" SecRule REQBODY_PROCESSOR_ERROR "\@eq 1" "phase:2,deny,id:500118" ), match_log => { }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => q(multipart/form-data; boundary =0000), ], normalize_raw_request_data( q( --0000 Content-Disposition: form-data; name="name" Brian Rectanus --0000 Content-Disposition: form-data; name="email" brian.rectanus@breach.com --0000 Content-Disposition: form-data; name="image"; filename="image.jpg" Content-Type: image/jpeg BINARYDATA --0000-- ), ), ), }, { type => "misc", comment => "multipart parser (boundary whitespace in C-T - before value)", note => q( PHP 5.2.3 - uses " 0000" as boundary. We should probably interpret it as "0000" and just flag a strict error. ), conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRequestBodyAccess On SecRule MULTIPART_STRICT_ERROR "\@eq 1" "phase:2,deny,id:500119" SecRule MULTIPART_UNMATCHED_BOUNDARY "\@eq 1" "phase:2,deny,id:500120" SecRule REQBODY_PROCESSOR_ERROR "\@eq 1" "phase:2,deny,id:500121" ), match_log => { debug => [ qr/boundary whitespace in C-T header/, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => q(multipart/form-data; boundary= 0000), ], normalize_raw_request_data( q( --0000 Content-Disposition: form-data; name="name" Brian Rectanus --0000 Content-Disposition: form-data; name="email" brian.rectanus@breach.com --0000 Content-Disposition: form-data; name="image"; filename="image.jpg" Content-Type: image/jpeg BINARYDATA --0000-- ), ), ), }, { type => "misc", comment => "multipart parser (boundary whitespace in C-T - after value)", note => q( PHP 5.2.3 - no effect. Apache just silently removes the trailing whitespace for us. ), conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRequestBodyAccess On SecRule MULTIPART_STRICT_ERROR "\@eq 1" "phase:2,deny,id:500122" SecRule MULTIPART_UNMATCHED_BOUNDARY "\@eq 1" "phase:2,deny,id:500123" SecRule REQBODY_PROCESSOR_ERROR "\@eq 1" "phase:2,deny,id:500124" ), match_log => { debug => [ qr/Added file part [0-9a-h]+ to the list: name "image" file name "image.jpg" \(offset 258, length 10\).*Adding request argument \(BODY\): name "name", value "Brian Rectanus".*Adding request argument \(BODY\): name "email", value "brian.rectanus\@breach.com"/s, 1 ], -debug => [ qr/Multipart.*(?i:error|warning)/, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => q(multipart/form-data; boundary=0000 ), ], normalize_raw_request_data( q( --0000 Content-Disposition: form-data; name="name" Brian Rectanus --0000 Content-Disposition: form-data; name="email" brian.rectanus@breach.com --0000 Content-Disposition: form-data; name="image"; filename="image.jpg" Content-Type: image/jpeg BINARYDATA --0000-- ), ), ), }, # Special chars { type => "misc", comment => "multipart parser (boundary special char - trailing whitespace+token)", note => q( PHP 5.2.3 - uses "0000 1111" as boundary. ), conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRequestBodyAccess On SecRule MULTIPART_STRICT_ERROR "\@eq 1" "phase:2,deny,id:500125" SecRule MULTIPART_UNMATCHED_BOUNDARY "\@eq 1" "phase:2,deny,id:500126" SecRule REQBODY_PROCESSOR_ERROR "\@eq 1" "phase:2,deny,id:500127" ), match_log => { debug => [ qr/No boundaries found in payload/, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => q(multipart/form-data; boundary=0000 1111), ], normalize_raw_request_data( q( --0000 Content-Disposition: form-data; name="name" Brian Rectanus --0000 Content-Disposition: form-data; name="email" brian.rectanus@breach.com --0000 Content-Disposition: form-data; name="image"; filename="image.jpg" Content-Type: image/jpeg BINARYDATA --0000-- ), ), ), }, { type => "misc", comment => "multipart parser (boundary special char - trailing comma+token)", note => q( PHP 5.2.3 - uses "0000" as boundary. ), conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRequestBodyAccess On SecRule MULTIPART_STRICT_ERROR "\@eq 1" "phase:2,deny,id:500128" SecRule MULTIPART_UNMATCHED_BOUNDARY "\@eq 1" "phase:2,deny,id:500129" SecRule REQBODY_PROCESSOR_ERROR "\@eq 1" "phase:2,deny,id:500130" ), match_log => { debug => [ qr/Invalid boundary in C-T \(characters\)/, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => q(multipart/form-data; boundary=0000,1111), ], normalize_raw_request_data( q( --0000 Content-Disposition: form-data; name="name" Brian Rectanus --0000 Content-Disposition: form-data; name="email" brian.rectanus@breach.com --0000 Content-Disposition: form-data; name="image"; filename="image.jpg" Content-Type: image/jpeg BINARYDATA --0000-- ), ), ), }, # Quoting { type => "misc", comment => "multipart parser (quoted boundary - normal)", note => q( PHP 5.2.3 - no effect. ), conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRequestBodyAccess On SecRule MULTIPART_STRICT_ERROR "\@eq 1" "phase:2,deny,id:500131" SecRule MULTIPART_UNMATCHED_BOUNDARY "\@eq 1" "phase:2,deny,id:500132" SecRule REQBODY_PROCESSOR_ERROR "\@eq 1" "phase:2,deny,id:500133" ), match_log => { debug => [ qr/boundary was quoted/, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => q(multipart/form-data; boundary="0000"), ], normalize_raw_request_data( q( --0000 Content-Disposition: form-data; name="name" Brian Rectanus --0000 Content-Disposition: form-data; name="email" brian.rectanus@breach.com --0000 Content-Disposition: form-data; name="image"; filename="image.jpg" Content-Type: image/jpeg BINARYDATA --0000-- ), ), ), }, { type => "misc", comment => "multipart parser (quoted boundary value - whitespace before)", note => q( PHP 5.2.3 - uses " 0000" as boundary. ), conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRequestBodyAccess On SecRule MULTIPART_STRICT_ERROR "\@eq 1" "phase:2,deny,id:500134" SecRule MULTIPART_UNMATCHED_BOUNDARY "\@eq 1" "phase:2,deny,id:500135" SecRule REQBODY_PROCESSOR_ERROR "\@eq 1" "phase:2,deny,id:500136" ), match_log => { debug => [ qr/boundary was quoted.*No boundaries found in payload/s, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => q(multipart/form-data; boundary=" 0000"), ], normalize_raw_request_data( q( --0000 Content-Disposition: form-data; name="name" Brian Rectanus --0000 Content-Disposition: form-data; name="email" brian.rectanus@breach.com --0000 Content-Disposition: form-data; name="image"; filename="image.jpg" Content-Type: image/jpeg BINARYDATA --0000-- ), ), ), }, { type => "misc", comment => "multipart parser (quoted boundary value - whitespace after)", note => q( PHP 5.2.3 - uses "0000 " as boundary. Trailing whitespace violates RFC as well. ), conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRequestBodyAccess On SecRule MULTIPART_STRICT_ERROR "\@eq 1" "phase:2,deny,id:500137" SecRule MULTIPART_UNMATCHED_BOUNDARY "\@eq 1" "phase:2,deny,id:500138" SecRule REQBODY_PROCESSOR_ERROR "\@eq 1" "phase:2,deny,id:500139" ), match_log => { debug => [ qr/boundary was quoted.*No boundaries found in payload/s, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => q(multipart/form-data; boundary="0000 "), ], normalize_raw_request_data( q( --0000 Content-Disposition: form-data; name="name" Brian Rectanus --0000 Content-Disposition: form-data; name="email" brian.rectanus@breach.com --0000 Content-Disposition: form-data; name="image"; filename="image.jpg" Content-Type: image/jpeg BINARYDATA --0000-- ), ), ), }, { type => "misc", comment => "multipart parser (quoted boundary value - whitespace between)", note => q( PHP 5.2.3 - uses "0000 " as boundary. ), conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRequestBodyAccess On SecRule MULTIPART_STRICT_ERROR "\@eq 1" "phase:2,deny,id:500140" SecRule MULTIPART_UNMATCHED_BOUNDARY "\@eq 1" "phase:2,deny,id:500141" SecRule REQBODY_PROCESSOR_ERROR "\@eq 1" "phase:2,deny,id:500142" ), match_log => { debug => [ qr/boundary was quoted/s, 1 ], -debug => [ qr/No boundaries found in payload/s, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => q(multipart/form-data; boundary="0000 1111"), ], normalize_raw_request_data( q( --0000 1111 Content-Disposition: form-data; name="name" Brian Rectanus --0000 1111 Content-Disposition: form-data; name="email" brian.rectanus@breach.com --0000 1111 Content-Disposition: form-data; name="image"; filename="image.jpg" Content-Type: image/jpeg BINARYDATA --0000 1111-- ), ), ), }, { type => "misc", comment => "multipart parser (quoted boundary value - contained quote)", note => q( PHP 5.2.3 - uses "0000 " as boundary. ), conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRequestBodyAccess On SecRule MULTIPART_STRICT_ERROR "\@eq 1" "phase:2,deny,id:500143" SecRule MULTIPART_UNMATCHED_BOUNDARY "\@eq 1" "phase:2,deny,id:500144" SecRule REQBODY_PROCESSOR_ERROR "\@eq 1" "phase:2,deny,id:500145" ), match_log => { debug => [ qr/Invalid boundary in C-T \(characters\)/, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => q(multipart/form-data; boundary="00\"00"), ], normalize_raw_request_data( q( --00"00 Content-Disposition: form-data; name="name" Brian Rectanus --00"00 Content-Disposition: form-data; name="email" brian.rectanus@breach.com --00"00 Content-Disposition: form-data; name="image"; filename="image.jpg" Content-Type: image/jpeg BINARYDATA --00"00-- ), ), ), }, { type => "misc", comment => "multipart parser (quoted boundary value - two quoted values)", note => q( PHP 5.2.3 - does not work, uses "00" as boundary. ), conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRequestBodyAccess On SecRule MULTIPART_STRICT_ERROR "\@eq 1" "phase:2,deny,id:500146" SecRule MULTIPART_UNMATCHED_BOUNDARY "\@eq 1" "phase:2,deny,id:500147" SecRule REQBODY_PROCESSOR_ERROR "\@eq 1" "phase:2,deny,id:500148" ), match_log => { debug => [ qr/Invalid boundary in C-T \(characters\)/, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => q(multipart/form-data; boundary="00""00"), ], normalize_raw_request_data( q( --00"00 Content-Disposition: form-data; name="name" Brian Rectanus --00"00 Content-Disposition: form-data; name="email" brian.rectanus@breach.com --00"00 Content-Disposition: form-data; name="image"; filename="image.jpg" Content-Type: image/jpeg BINARYDATA --00"00-- ), ), ), }, { type => "misc", comment => "multipart parser (partial quoted boundary value - only start quote)", note => q( PHP 5.2.3 - breaks parsing. ), conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRequestBodyAccess On SecRule MULTIPART_STRICT_ERROR "\@eq 1" "phase:2,deny,id:500149" SecRule MULTIPART_UNMATCHED_BOUNDARY "\@eq 1" "phase:2,deny,id:500150" SecRule REQBODY_PROCESSOR_ERROR "\@eq 1" "phase:2,deny,id:500151" ), match_log => { debug => [ qr/Invalid boundary in C-T \(quote\)/, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => q(multipart/form-data; boundary="0000), ], normalize_raw_request_data( q( --0000 Content-Disposition: form-data; name="name" Brian Rectanus --0000 Content-Disposition: form-data; name="email" brian.rectanus@breach.com --0000 Content-Disposition: form-data; name="image"; filename="image.jpg" Content-Type: image/jpeg BINARYDATA --0000-- ), ), ), }, { type => "misc", comment => "multipart parser (partial quoted boundary value - only end quote)", note => q( PHP 5.2.3 - breaks parsing. ), conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRequestBodyAccess On SecRule MULTIPART_STRICT_ERROR "\@eq 1" "phase:2,deny,id:500152" SecRule MULTIPART_UNMATCHED_BOUNDARY "\@eq 1" "phase:2,deny,id:500153" SecRule REQBODY_PROCESSOR_ERROR "\@eq 1" "phase:2,deny,id:500154" ), match_log => { debug => [ qr/Invalid boundary in C-T \(quote\)/, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => q(multipart/form-data; boundary=0000"), ], normalize_raw_request_data( q( --0000 Content-Disposition: form-data; name="name" Brian Rectanus --0000 Content-Disposition: form-data; name="email" brian.rectanus@breach.com --0000 Content-Disposition: form-data; name="image"; filename="image.jpg" Content-Type: image/jpeg BINARYDATA --0000-- ), ), ), }, # Multipart mixed { type => "misc", comment => "multipart parser (multipart mixed - normal)", conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRequestBodyAccess On SecRule MULTIPART_STRICT_ERROR "\@eq 1" "phase:2,deny,id:500155" SecRule MULTIPART_UNMATCHED_BOUNDARY "\@eq 1" "phase:2,deny,id:500156" SecRule REQBODY_PROCESSOR_ERROR "\@eq 1" "phase:2,deny,id:500157" ), match_log => { debug => [ qr/Invalid Content-Disposition header/, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => q(multipart/form-data; boundary=0000), ], normalize_raw_request_data( q( --0000 Content-Disposition: form-data; name="name" Brian Rectanus --0000 Content-Disposition: form-data; name="email" brian.rectanus@breach.com --0000 Content-Disposition: attachment Content-Type: multipart/mixed; boundary=BbC04y --BbC04y Content-Disposition: file; filename="file1.txt" Content-Type: text/plain ... contents of file1.txt ... --BbC04y Content-Disposition: file; filename="file2.gif Content-Type: image/jpeg Content-Transfer-Encoding: binary ...contents of file2.gif... --0000-- ), ), ), }, { type => "misc", comment => "multipart parser (multipart mixed - missing disposition)", conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRequestBodyAccess On SecRule MULTIPART_STRICT_ERROR "\@eq 1" "phase:2,deny,id:500158" SecRule MULTIPART_UNMATCHED_BOUNDARY "\@eq 1" "phase:2,deny,id:500159" SecRule REQBODY_PROCESSOR_ERROR "\@eq 1" "phase:2,deny,id:500160" ), match_log => { debug => [ qr/Part missing Content-Disposition header/, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => q(multipart/form-data; boundary=0000), ], normalize_raw_request_data( q( --0000 Content-Disposition: form-data; name="name" Brian Rectanus --0000 Content-Disposition: form-data; name="email" brian.rectanus@breach.com --0000 Content-Type: multipart/mixed; boundary=BbC04y --BbC04y Content-Disposition: file; filename="file1.txt" Content-Type: text/plain ... contents of file1.txt ... --BbC04y Content-Disposition: file; filename="file2.gif Content-Type: image/jpeg Content-Transfer-Encoding: binary ...contents of file2.gif... --0000-- ), ), ), }, # File limits { type => "misc", comment => "multipart parser (normal)", conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRequestBodyAccess On SecTmpDir "$ENV{TEMP_DIR}" SecUploadDir "$ENV{UPLOAD_DIR}" SecUploadKeepFiles On SecUploadFileLimit 2 # These should be set SecRule MULTIPART_STRICT_ERROR "!\@eq 1" "phase:2,deny,id:500161" SecRule MULTIPART_FILE_LIMIT_EXCEEDED "!\@eq 1" "phase:2,deny,id:500162" # This should not be set SecRule REQBODY_PROCESSOR_ERROR "\@eq 1" "phase:2,deny,id:500163" # Theses should still be accurate SecRule &FILES "!\@eq 3" "phase:2,deny,id:500164" SecRule &FILES_NAMES "!\@eq 3" "phase:2,deny,id:500165" SecRule &FILES_SIZES "!\@eq 3" "phase:2,deny,id:500166" SecRule FILES_SIZES:/^image/ "\@eq 0" "phase:2,deny,id:500167" # This should be the SecUploadFileLimit SecRule &FILES_TMPNAMES "!\@eq 2" "phase:2,deny,id:500168" ), match_log => { debug => [ qr/Multipart: Upload file limit exceeded.*name: test.*variable: This is test data/s, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => q(multipart/form-data; boundary=0000), ], normalize_raw_request_data( q( --0000 Content-Disposition: form-data; name="name" Brian Rectanus --0000 Content-Disposition: form-data; name="email" brian.rectanus@breach.com --0000 Content-Disposition: form-data; name="image1"; filename="image1.jpg" Content-Type: image/jpeg BINARYDATA1 --0000 Content-Disposition: form-data; name="image2"; filename="image2.jpg" Content-Type: image/jpeg BINARYDATA2 --0000 Content-Disposition: form-data; name="image3"; filename="image3.jpg" Content-Type: image/jpeg BINARYDATA3 --0000 Content-Disposition: form-data; name="test" This is test data. --0000-- ), ), ), }, modsecurity-apache_2.7.7/tests/regression/misc/10-tfn-cache.t0000664000175000017500000001361012243422537024350 0ustar zimmerlezimmerle### Transformation Caching { type => "misc", comment => "tfncache (simple fully cached)", conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 # We need to make this work no matter what the defaults may change to SecCacheTransformations On "minlen:1,maxlen:0" # This should cache it SecRule ARGS_GET "WillNotMatch" "phase:1,t:none,t:removeWhiteSpace,t:lowercase,pass,nolog,id:500037" # This should use the cached value SecRule ARGS_GET:test "foobar" "phase:1,t:none,t:removeWhiteSpace,t:lowercase,deny,id:500038" ), match_log => { debug => [ qr/removeWhiteSpace,lowercase: "foobar" .*cached/, 1 ], -debug => [ qr/partially cached/, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/index.html?test=Foo+Bar", ), }, { type => "misc", comment => "tfncache (simple partially cached)", conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 # We need to make this work no matter what the defaults may change to SecCacheTransformations On "minlen:1,maxlen:0,incremental:off,maxitems:0" # This should cache it SecRule ARGS_GET "WillNotMatch" "phase:1,t:none,t:removeWhiteSpace,pass,nolog,id:500039" # This should use the partially cached value SecRule ARGS_GET:test "foobar" "phase:1,t:none,t:removeWhiteSpace,t:lowercase,deny,id:500040" ), match_log => { debug => [ qr/removeWhiteSpace: "FooBar" .*partially cached/, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/index.html?test=Foo+Bar", ), }, { type => "misc", comment => "tfncache (separate phases)", conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 # We need to make this work no matter what the defaults may change to SecCacheTransformations On "minlen:1,maxlen:0" # This should cache it SecRule ARGS_GET "WillNotMatch" "phase:1,t:none,t:removeWhiteSpace,t:lowercase,pass,nolog,id:500041" # This should use the cached value SecRule ARGS_GET:test "foobar" "phase:2,t:none,t:removeWhiteSpace,t:lowercase,deny,id:500042" ), match_log => { -debug => [ qr/removeWhiteSpace,lowercase: "foobar" .*cached/, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/index.html?test=Foo+Bar", ), }, { type => "misc", comment => "tfncache (non-modifying tfns cached)", conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 # We need to make this work no matter what the defaults may change to SecCacheTransformations On "minlen:1,maxlen:0" # This should cache it SecRule ARGS_GET "WillNotMatch" "phase:1,t:none,t:removeWhiteSpace,t:lowercase,pass,nolog,id:500043" # This should use the cached value SecRule ARGS_GET:test "foobar" "phase:1,t:none,t:removeWhiteSpace,t:lowercase,deny,id:500044" ), match_log => { debug => [ qr/removeWhiteSpace,lowercase: "foobar" .*cached/, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/index.html?test=foo+bar", ), }, { type => "misc", comment => "tfncache (unique keys)", conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRequestBodyAccess On # We need to make this work no matter what the defaults may change to SecCacheTransformations On "minlen:1,maxlen:0" # This should cache it SecRule ARGS "WillNotMatch" "phase:2,t:none,t:removeWhiteSpace,t:lowercase,pass,id:500045" # This should see cached versions of *both* ARGS_GET SecRule ARGS:test "queryval" "phase:2,t:none,t:removeWhiteSpace,t:lowercase,deny,chain,id:500046" SecRule ARGS:test "firstval" "t:none,t:removeWhiteSpace,t:lowercase,chain,id:500047" SecRule ARGS:test "secondval" "t:none,t:removeWhiteSpace,t:lowercase,id:500017" ), match_log => { debug => [ qr/removeWhiteSpace,lowercase: "queryval" .*removeWhiteSpace,lowercase: "firstval" .*cached.*removeWhiteSpace,lowercase: "secondval" .*cached/s, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/index.html?test=Query+Val", [ "Content-Type" => "application/x-www-form-urlencoded", ], # Args "test=First+Val&test=Second+Val", ), }, { type => "misc", comment => "tfncache (large cache)", conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRequestBodyAccess On SecRequestBodyNoFilesLimit 1048576 SecRequestBodyInMemoryLimit 131072 SecResponseBodyLimit 1048576 # We need to make this work no matter what the defaults may change to SecCacheTransformations On "minlen:1,maxlen:0,maxitems:0" # This should cache it in all phases SecRule ARGS "WillNotMatch" "phase:1,t:none,t:removeWhiteSpace,t:lowercase,pass,nolog,id:500048" SecRule ARGS "WillNotMatch" "phase:2,t:none,t:removeWhiteSpace,t:lowercase,pass,nolog,id:500049" SecRule ARGS "WillNotMatch" "phase:3,t:none,t:removeWhiteSpace,t:lowercase,pass,nolog,id:500050" SecRule ARGS "WillNotMatch" "phase:4,t:none,t:removeWhiteSpace,t:lowercase,pass,nolog,id:500051" # This should use the cached value SecRule ARGS "foobar" "phase:4,t:none,t:removeWhiteSpace,t:lowercase,deny,id:500052" ), match_log => { debug => [ qr/Adding request argument \(BODY\): name "test", value "Foo Bar"/, 60, "Waiting for httpd to process request: "], -error => [ qr/segmentation fault/i, 60 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/index.html", [ "Content-Type" => "application/x-www-form-urlencoded", ], # 1000 Args join("&", map { sprintf "arg%08d=0123456789abcdef+0123456789ABCDEF+0123456789abcdef", $_ } (1 .. 1000))."&test=Foo+Bar", ), }, modsecurity-apache_2.7.7/tests/regression/misc/00-phases.t0000664000175000017500000001075112243422537024005 0ustar zimmerlezimmerle### Test the phases # Phase 1 (request headers) { type => "misc", comment => "phase 1", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType text/plain null SecRule REQUEST_LINE "^POST" "phase:1,pass,log,auditlog,id:500169" SecRule ARGS "val1" "phase:1,pass,log,auditlog,id:500170" SecRule RESPONSE_HEADERS:Last-Modified "." "phase:1,pass,log,auditlog,id:500171" SecRule RESPONSE_BODY "TEST" "phase:1,pass,log,auditlog,id:500172" ), match_log => { error => [ qr/Pattern match "\^POST" at REQUEST_LINE/, 1 ], -error => [ qr/Pattern match .* (ARGS|RESPONSE)/, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "application/x-www-form-urlencoded", ], "arg1=val1&arg2=val2", ), }, # Phase 2 (request body) { type => "misc", comment => "phase 2", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType text/plain null SecRule REQUEST_LINE "^POST" "phase:2,pass,log,auditlog,id:500173" SecRule ARGS "val1" "phase:2,pass,log,auditlog,id:500174" SecRule RESPONSE_HEADERS:Last-Modified "." "phase:2,pass,log,auditlog,id:500175" SecRule RESPONSE_BODY "TEST" "phase:2,pass,log,auditlog,id:500176" ), match_log => { error => [ qr/Pattern match "\^POST" at REQUEST_LINE.*Pattern match "val1" at ARGS/s, 1 ], -error => [ qr/Pattern match .* RESPONSE/, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "application/x-www-form-urlencoded", ], "arg1=val1&arg2=val2", ), }, # Phase 3 (response headers) { type => "misc", comment => "phase 3", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType text/plain null SecRule REQUEST_LINE "^POST" "phase:3,pass,log,auditlog,id:500177" SecRule ARGS "val1" "phase:3,pass,log,auditlog,id:500178" SecRule RESPONSE_HEADERS:Last-Modified "." "phase:3,pass,log,auditlog,id:500179" SecRule RESPONSE_BODY "TEST" "phase:3,pass,log,auditlog,id:500180" ), match_log => { error => [ qr/Pattern match "\^POST" at REQUEST_LINE.*Pattern match "val1" at ARGS.*Pattern match "\." at RESPONSE_HEADERS/s, 1 ], -error => [ qr/Pattern match .* RESPONSE_BODY/, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "application/x-www-form-urlencoded", ], "arg1=val1&arg2=val2", ), }, # Phase 4 (response body) { type => "misc", comment => "phase 4", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType text/plain null SecDebugLog "$ENV{DEBUG_LOG}" SecDebugLogLevel 9 SecRule REQUEST_LINE "^POST" "phase:4,pass,log,auditlog,id:500181" SecRule ARGS "val1" "phase:4,pass,log,auditlog,id:500182" SecRule RESPONSE_HEADERS:Last-Modified "." "phase:4,pass,log,auditlog,id:500183" SecRule RESPONSE_BODY "TEST" "phase:4,pass,log,auditlog,id:500184" ), match_log => { error => [ qr/Pattern match "\^POST" at REQUEST_LINE.*Pattern match "val1" at ARGS.*Pattern match "\." at RESPONSE_HEADERS.*Pattern match "TEST" at RESPONSE_BODY/s, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "application/x-www-form-urlencoded", ], "arg1=val1&arg2=val2", ), }, # Phase 5 (logging) { type => "misc", comment => "phase 5", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType text/plain null SecRule REQUEST_LINE "^POST" "phase:5,pass,log,auditlog,id:500185" SecRule ARGS "val1" "phase:5,pass,log,auditlog,id:500186" SecRule RESPONSE_HEADERS:Last-Modified "." "phase:5,pass,log,auditlog,id:500187" SecRule RESPONSE_BODY "TEST" "phase:5,pass,log,auditlog,id:500188" ), match_log => { error => [ qr/Pattern match "\^POST" at REQUEST_LINE.*Pattern match "val1" at ARGS.*Pattern match "\." at RESPONSE_HEADERS.*Pattern match "TEST" at RESPONSE_BODY/s, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "application/x-www-form-urlencoded", ], "arg1=val1&arg2=val2", ), }, modsecurity-apache_2.7.7/tests/regression/action/0000775000175000017500000000000012243422537022436 5ustar zimmerlezimmerlemodsecurity-apache_2.7.7/tests/regression/action/00-transformations.t0000664000175000017500000000024112243422537026266 0ustar zimmerlezimmerle### Transformation tests # NOTE: individual tests done in unit tests # TODO: t:none to override default # TODO: t:none inline # TODO: combined # TODO: caching modsecurity-apache_2.7.7/tests/regression/action/10-detectiononly-actions.t0000664000175000017500000003453712243422537027373 0ustar zimmerlezimmerle### Tests all of the actions in each phase in detection only mode # Pass { type => "action", comment => "pass in phase:1", conf => qq( SecRuleEngine DetectionOnly SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecDebugLog "$ENV{DEBUG_LOG}" SecDebugLogLevel 9 SecAction "phase:1,pass,msg:'PASSED',id:500057" SecAction "phase:1,deny,msg:'DENIED',id:500058" ), match_log => { error => [ qr/ModSecurity: Warning. Unconditional match in SecAction.*PASSED/, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, { type => "action", comment => "pass in phase:2", conf => qq( SecRuleEngine DetectionOnly SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecAction "phase:2,pass,msg:'PASSED',id:500059" SecAction "phase:2,deny,msg:'DENIED',id:500060" ), match_log => { error => [ qr/ModSecurity: Warning. Unconditional match in SecAction.*PASSED/, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, { type => "action", comment => "pass in phase:3", conf => qq( SecRuleEngine DetectionOnly SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecDebugLog "$ENV{DEBUG_LOG}" SecDebugLogLevel 4 SecAction "phase:3,pass,msg:'PASSED',id:500061" SecAction "phase:3,deny,msg:'DENIED',id:500062" ), match_log => { error => [ qr/ModSecurity: Warning. Unconditional match in SecAction.*PASSED/, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, { type => "action", comment => "pass in phase:4", conf => qq( SecRuleEngine DetectionOnly SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecDebugLog "$ENV{DEBUG_LOG}" SecDebugLogLevel 4 SecAction "phase:4,pass,msg:'PASSED',id:500063" SecAction "phase:4,deny,msg:'DENIED',id:500064" ), match_log => { error => [ qr/ModSecurity: Warning. Unconditional match in SecAction.*PASSED/, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, # Allow { type => "action", comment => "allow in phase:1", conf => qq( SecRuleEngine DetectionOnly SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecAction "phase:1,allow,msg:'ALLOWED',id:500065" SecAction "phase:1,deny,msg:'DENIED',id:500066" ), match_log => { error => [ qr/ModSecurity: Warning. Unconditional match in SecAction.*ALLOWED/, 1 ], -error => [ qr/Access allowed/, 1 ], # TODO: Allow should probably stop rule execution # -error => [ qr/DENIED/, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, { type => "action", comment => "allow in phase:2", conf => qq( SecRuleEngine DetectionOnly SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecAction "phase:2,allow,msg:'ALLOWED',id:500067" SecAction "phase:2,deny,msg:'DENIED',id:500068" ), match_log => { error => [ qr/ModSecurity: Warning. Unconditional match in SecAction.*ALLOWED/, 1 ], -error => [ qr/Access allowed/, 1 ], # TODO: Allow should probably stop rule execution # -error => [ qr/DENIED/, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, { type => "action", comment => "allow in phase:3", conf => qq( SecRuleEngine DetectionOnly SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecAction "phase:3,allow,msg:'ALLOWED',id:500069" SecAction "phase:3,deny,msg:'DENIED',id:500070" ), match_log => { error => [ qr/ModSecurity: Warning. Unconditional match in SecAction.*ALLOWED/, 1 ], -error => [ qr/Access allowed/, 1 ], # TODO: Allow should probably stop rule execution # -error => [ qr/DENIED/, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, { type => "action", comment => "allow in phase:4", conf => qq( SecRuleEngine DetectionOnly SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecAction "phase:4,allow,msg:'ALLOWED',id:500071" SecAction "phase:4,deny,msg:'DENIED',id:500072" ), match_log => { error => [ qr/ModSecurity: Warning. Unconditional match in SecAction.*ALLOWED/, 1 ], -error => [ qr/Access allowed/, 1 ], # TODO: Allow should probably stop rule execution # -error => [ qr/DENIED/, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, # Deny { type => "action", comment => "deny in phase:1", conf => qq( SecRuleEngine DetectionOnly SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecAction "phase:1,deny,msg:'DENIED',id:500073" ), match_log => { error => [ qr/ModSecurity: Warning. Unconditional match in SecAction.*DENIED/, 1 ], -error => [ qr/Access denied/, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, { type => "action", comment => "deny in phase:2", conf => qq( SecRuleEngine DetectionOnly SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecAction "phase:2,deny,msg:'DENIED',id:500074" ), match_log => { error => [ qr/ModSecurity: Warning. Unconditional match in SecAction.*DENIED/, 1 ], -error => [ qr/Access denied/, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, { type => "action", comment => "deny in phase:3", conf => qq( SecRuleEngine DetectionOnly SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecAction "phase:3,deny,msg:'DENIED',id:500075" ), match_log => { error => [ qr/ModSecurity: Warning. Unconditional match in SecAction.*DENIED/, 1 ], -error => [ qr/Access denied/, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, { type => "action", comment => "deny in phase:4", conf => qq( SecRuleEngine DetectionOnly SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecAction "phase:4,deny,msg:'DENIED',id:500076" ), match_log => { error => [ qr/ModSecurity: Warning. Unconditional match in SecAction.*DENIED/, 1 ], -error => [ qr/Access denied/, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, # Drop { type => "action", comment => "drop in phase:1", conf => qq( SecRuleEngine DetectionOnly SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecAction "phase:1,drop,msg:'DROPPED',id:500077" ), match_log => { error => [ qr/ModSecurity: Warning. Unconditional match in SecAction.*DROPPED/, 1 ], -error => [ qr/Access denied/, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, { type => "action", comment => "drop in phase:2", conf => qq( SecRuleEngine DetectionOnly SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecAction "phase:2,drop,msg:'DROPPED',id:500078" ), match_log => { error => [ qr/ModSecurity: Warning. Unconditional match in SecAction.*DROPPED/, 1 ], -error => [ qr/Access denied/, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, { type => "action", comment => "drop in phase:3", conf => qq( SecRuleEngine DetectionOnly SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecAction "phase:3,drop,msg:'DROPPED',id:500079" ), match_log => { error => [ qr/ModSecurity: Warning. Unconditional match in SecAction.*DROPPED/, 1 ], -error => [ qr/Access denied/, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, { type => "action", comment => "drop in phase:4", conf => qq( SecRuleEngine DetectionOnly SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecAction "phase:4,drop,msg:'DROPPED',id:500080" ), match_log => { error => [ qr/ModSecurity: Warning. Unconditional match in SecAction.*DROPPED/, 1 ], -error => [ qr/Access denied/, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, # Redirect { type => "action", comment => "redirect in phase:1 (get)", conf => qq( SecRuleEngine DetectionOnly SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecRule REQUEST_URI "\@streq /test2.txt" "phase:1,redirect:'http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt',msg:'REDIRECTED',id:500009" ), match_log => { error => [ qr/ModSecurity: Warning. String match "\/test2.txt" at REQUEST_URI.*REDIRECTED/, 1 ], -error => [ qr/Access denied/, 1 ], }, match_response => { status => qr/^200$/, content => qr/^TEST 2$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test2.txt", ), }, { type => "action", comment => "redirect in phase:2 (get)", conf => qq( SecRuleEngine DetectionOnly SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecRule REQUEST_URI "\@streq /test2.txt" "phase:2,redirect:'http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt',msg:'REDIRECTED',id:500010" ), match_log => { error => [ qr/ModSecurity: Warning. String match "\/test2.txt" at REQUEST_URI.*REDIRECTED/, 1 ], -error => [ qr/Access denied/, 1 ], }, match_response => { status => qr/^200$/, content => qr/^TEST 2$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test2.txt", ), }, { type => "action", comment => "redirect in phase:3 (get)", conf => qq( SecRuleEngine DetectionOnly SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecRule REQUEST_URI "\@streq /test2.txt" "phase:3,redirect:'http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt',msg:'REDIRECTED',id:500011" ), match_log => { error => [ qr/ModSecurity: Warning. String match "\/test2.txt" at REQUEST_URI.*REDIRECTED/, 1 ], -error => [ qr/Access denied/, 1 ], }, match_response => { status => qr/^200$/, content => qr/^TEST 2$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test2.txt", ), }, { type => "action", comment => "redirect in phase:4 (get)", conf => qq( SecRuleEngine DetectionOnly SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecRule REQUEST_URI "\@streq /test2.txt" "phase:4,redirect:'http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt',msg:'REDIRECTED',id:500012" ), match_log => { error => [ qr/ModSecurity: Warning. String match "\/test2.txt" at REQUEST_URI.*REDIRECTED/, 1 ], -error => [ qr/Access denied/, 1 ], }, match_response => { status => qr/^200$/, content => qr/^TEST 2$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test2.txt", ), }, # Proxy { type => "action", comment => "proxy in phase:1 (get)", conf => qq( SecRuleEngine DetectionOnly SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecRule REQUEST_URI "\@streq /test2.txt" "phase:1,proxy:'http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt',msg:'PROXIED',id:500013" ), match_log => { error => [ qr/ModSecurity: Warning. String match "\/test2.txt" at REQUEST_URI.*PROXIED/, 1 ], -error => [ qr/Access denied/, 1 ], }, match_response => { status => qr/^200$/, content => qr/^TEST 2$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test2.txt", ), }, { type => "action", comment => "proxy in phase:2 (get)", conf => qq( SecRuleEngine DetectionOnly SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecRule REQUEST_URI "\@streq /test2.txt" "phase:2,proxy:'http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt',msg:'PROXIED',id:500014" ), match_log => { error => [ qr/ModSecurity: Warning. String match "\/test2.txt" at REQUEST_URI.*PROXIED/, 1 ], -error => [ qr/Access denied/, 1 ], }, match_response => { status => qr/^200$/, content => qr/^TEST 2$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test2.txt", ), }, { type => "action", comment => "proxy in phase:3 (get)", conf => qq( SecRuleEngine DetectionOnly SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecDebugLog "$ENV{DEBUG_LOG}" SecDebugLogLevel 4 SecRule REQUEST_URI "\@streq /test2.txt" "phase:3,proxy:'http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt',msg:'PROXIED',id:500015" ), match_log => { error => [ qr/ModSecurity: Warning. String match "\/test2.txt" at REQUEST_URI.*PROXIED/, 1 ], -error => [ qr/Access denied/, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test2.txt", ), }, { type => "action", comment => "proxy in phase:4 (get)", conf => qq( SecRuleEngine DetectionOnly SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecDebugLog "$ENV{DEBUG_LOG}" SecDebugLogLevel 4 SecRule REQUEST_URI "\@streq /test2.txt" "phase:4,proxy:'http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt',msg:'PROXIED',id:500016" ), match_log => { error => [ qr/ModSecurity: Warning. String match "\/test2.txt" at REQUEST_URI.*PROXIED/, 1 ], -error => [ qr/Access denied/, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test2.txt", ), }, modsecurity-apache_2.7.7/tests/regression/action/00-meta.t0000664000175000017500000000014712243422537023770 0ustar zimmerlezimmerle### Test meta actions # TODO: id # TODO: logdata # TODO: msg # TODO: rev # TODO: severity # TODO: tag modsecurity-apache_2.7.7/tests/regression/action/00-misc.t0000664000175000017500000000057212243422537023777 0ustar zimmerlezimmerle### Test misc actions # TODO: block # TODO: capture # TODO: chain # TODO: deprecatevar # TODO: exec # TODO: expirevar # TODO: initcol # TODO: multiMatch # TODO: pause # TODO: sanitiseArg # TODO: sanitiseMatched # TODO: sanitiseRequestHeader # TODO: sanitiseResponseHeader # TODO: setuid # TODO: setsid # TODO: setenv # TODO: setvar # TODO: skip # TODO: skipAfter # TODO: xmlns modsecurity-apache_2.7.7/tests/regression/action/00-disruptive-actions.t0000664000175000017500000003222712243422537026702 0ustar zimmerlezimmerle### Tests all of the actions in each phase # Pass { type => "action", comment => "pass in phase:1", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecAction "phase:1,pass,id:500033" SecAction "phase:1,deny,id:500034" ), match_log => { error => [ qr/ModSecurity: Warning. Unconditional match in SecAction/, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, { type => "action", comment => "pass in phase:2", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecAction "phase:2,pass,id:500035" SecAction "phase:2,deny,id:500036" ), match_log => { error => [ qr/ModSecurity: Warning. Unconditional match in SecAction/, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, { type => "action", comment => "pass in phase:3", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecDebugLog "$ENV{DEBUG_LOG}" SecDebugLogLevel 4 SecAction "phase:3,pass,id:500037" SecAction "phase:3,deny,id:500038" ), match_log => { error => [ qr/ModSecurity: Warning. Unconditional match in SecAction/, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, { type => "action", comment => "pass in phase:4", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecDebugLog "$ENV{DEBUG_LOG}" SecDebugLogLevel 4 SecAction "phase:4,pass,id:500039" SecAction "phase:4,deny,id:500040" ), match_log => { error => [ qr/ModSecurity: Warning. Unconditional match in SecAction/, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, # Allow { type => "action", comment => "allow in phase:1", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecAction "phase:1,allow,id:500041" SecAction "phase:1,deny,id:500042" ), match_log => { error => [ qr/ModSecurity: Access allowed \(phase 1\). Unconditional match in SecAction/, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, { type => "action", comment => "allow in phase:2", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecAction "phase:2,allow,id:500043" SecAction "phase:2,deny,id:500044" ), match_log => { error => [ qr/ModSecurity: Access allowed \(phase 2\). Unconditional match in SecAction/, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, { type => "action", comment => "allow in phase:3", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecDebugLog "$ENV{DEBUG_LOG}" SecDebugLogLevel 4 SecAction "phase:3,allow,id:500045" SecAction "phase:3,deny,id:500046" ), match_log => { error => [ qr/ModSecurity: Access allowed \(phase 3\). Unconditional match in SecAction/, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, { type => "action", comment => "allow in phase:4", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecDebugLog "$ENV{DEBUG_LOG}" SecDebugLogLevel 4 SecAction "phase:4,allow,id:500047" SecAction "phase:4,deny,id:500048" ), match_log => { error => [ qr/ModSecurity: Access allowed \(phase 4\). Unconditional match in SecAction/, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, # Deny { type => "action", comment => "deny in phase:1", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecAction "phase:1,deny,id:500049" ), match_log => { error => [ qr/Access denied with code 403 \(phase 1\). Unconditional match in SecAction./, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, { type => "action", comment => "deny in phase:2", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecAction "phase:2,deny,id:500050" ), match_log => { error => [ qr/Access denied with code 403 \(phase 2\). Unconditional match in SecAction./, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, { type => "action", comment => "deny in phase:3", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecDebugLog "$ENV{DEBUG_LOG}" SecDebugLogLevel 4 SecAction "phase:3,deny,id:500051" ), match_log => { error => [ qr/Access denied with code 403 \(phase 3\). Unconditional match in SecAction./, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, { type => "action", comment => "deny in phase:4", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecDebugLog "$ENV{DEBUG_LOG}" SecDebugLogLevel 4 SecAction "phase:4,deny,id:500052" ), match_log => { error => [ qr/Access denied with code 403 \(phase 4\). Unconditional match in SecAction./, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, # Drop { type => "action", comment => "drop in phase:1", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecAction "phase:1,drop,id:500053" ), match_log => { error => [ qr/Access denied with connection close \(phase 1\). Unconditional match in SecAction./, 1 ], }, match_response => { status => qr/^500$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, { type => "action", comment => "drop in phase:2", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecAction "phase:2,drop,id:500054" ), match_log => { error => [ qr/Access denied with connection close \(phase 2\). Unconditional match in SecAction./, 1 ], }, match_response => { status => qr/^500$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, { type => "action", comment => "drop in phase:3", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecDebugLog "$ENV{DEBUG_LOG}" SecDebugLogLevel 4 SecAction "phase:3,drop,id:500055" ), match_log => { error => [ qr/Access denied with connection close \(phase 3\). Unconditional match in SecAction./, 1 ], }, match_response => { status => qr/^500$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, { type => "action", comment => "drop in phase:4", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecDebugLog "$ENV{DEBUG_LOG}" SecDebugLogLevel 4 SecAction "phase:4,drop,id:500056" ), match_log => { error => [ qr/Access denied with connection close \(phase 4\). Unconditional match in SecAction./, 1 ], }, match_response => { status => qr/^500$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, # Redirect { type => "action", comment => "redirect in phase:1 (get)", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecRule REQUEST_URI "\@streq /test2.txt" "phase:1,redirect:'http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt',id:500001" ), match_log => { error => [ qr/ModSecurity: Access denied with redirection to .* using status 302 \(phase 1\)/, 1 ], }, match_response => { status => qr/^200$/, content => qr/^TEST$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test2.txt", ), }, { type => "action", comment => "redirect in phase:2 (get)", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecRule REQUEST_URI "\@streq /test2.txt" "phase:2,redirect:'http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt',id:500002" ), match_log => { error => [ qr/ModSecurity: Access denied with redirection to .* using status 302 \(phase 2\)/, 1 ], }, match_response => { status => qr/^200$/, content => qr/^TEST$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test2.txt", ), }, { type => "action", comment => "redirect in phase:3 (get)", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecDebugLog "$ENV{DEBUG_LOG}" SecDebugLogLevel 4 SecRule REQUEST_URI "\@streq /test2.txt" "phase:3,redirect:'http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt',id:500003" ), match_log => { error => [ qr/ModSecurity: Access denied with redirection to .* using status 302 \(phase 3\)/, 1 ], }, match_response => { status => qr/^200$/, content => qr/^TEST$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test2.txt", ), }, { type => "action", comment => "redirect in phase:4 (get)", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecDebugLog "$ENV{DEBUG_LOG}" SecDebugLogLevel 4 SecRule REQUEST_URI "\@streq /test2.txt" "phase:4,redirect:'http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt',id:500004" ), match_log => { error => [ qr/ModSecurity: Access denied with redirection to .* using status 302 \(phase 4\)/, 1 ], }, match_response => { status => qr/^200$/, content => qr/^TEST$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test2.txt", ), }, # Proxy { type => "action", comment => "proxy in phase:1 (get)", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecRule REQUEST_URI "\@streq /test2.txt" "phase:1,proxy:'http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt',id:500005" ), match_log => { error => [ qr/ModSecurity: Access denied using proxy to \(phase 1\)/, 1 ], }, match_response => { status => qr/^200$/, content => qr/^TEST$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test2.txt", ), }, { type => "action", comment => "proxy in phase:2 (get)", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecRule REQUEST_URI "\@streq /test2.txt" "phase:2,proxy:'http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt',id:500006" ), match_log => { error => [ qr/ModSecurity: Access denied using proxy to \(phase 2\)/, 1 ], }, match_response => { status => qr/^200$/, content => qr/^TEST$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test2.txt", ), }, { type => "action", comment => "proxy in phase:3 (get)", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecDebugLog "$ENV{DEBUG_LOG}" SecDebugLogLevel 4 SecRule REQUEST_URI "\@streq /test2.txt" "phase:3,proxy:'http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt',id:500007" ), match_log => { error => [ qr/ModSecurity: Access denied with code 500 \(phase 3\) \(Configuration Error: Proxy action requested but it does not work in output phases\)./, 1 ], }, match_response => { status => qr/^500$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test2.txt", ), }, { type => "action", comment => "proxy in phase:4 (get)", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecDebugLog "$ENV{DEBUG_LOG}" SecDebugLogLevel 4 SecRule REQUEST_URI "\@streq /test2.txt" "phase:4,proxy:'http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt',id:500008" ), match_log => { error => [ qr/ModSecurity: Access denied with code 500 \(phase 4\) \(Configuration Error: Proxy action requested but it does not work in output phases\)./, 1 ], }, match_response => { status => qr/^500$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test2.txt", ), }, modsecurity-apache_2.7.7/tests/regression/action/10-ctl.t0000664000175000017500000000221012243422537023616 0ustar zimmerlezimmerle### ctl ### ruleRemoveById { type => "action", comment => "ruleRemoveById existing rule across phases", conf => qq( SecRuleEngine On SecAction "phase:2,id:666,deny" SecAction "phase:1,pass,ctl:ruleRemoveById=666,id:500030" ), match_log => { }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, { type => "action", comment => "ruleRemoveById future rule across phases", conf => qq( SecRuleEngine On SecAction "phase:1,pass,ctl:ruleRemoveById=666,id:500031" SecAction "phase:2,id:666,deny" ), match_log => { }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, { type => "action", comment => "ruleRemoveById future rule same phase", conf => qq( SecRuleEngine On SecAction "phase:1,pass,ctl:ruleRemoveById=666,id:500032" SecAction "phase:1,id:666,deny" ), match_log => { }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, modsecurity-apache_2.7.7/tests/regression/action/10-logging.t0000664000175000017500000003410412243422537024471 0ustar zimmerlezimmerle### Logging tests # log/nolog (pass) { type => "action", comment => "log (pass)", conf => qq( SecRuleEngine On SecDebugLog "$ENV{DEBUG_LOG}" SecDebugLogLevel 9 SecAuditLogRelevantStatus xxx SecAuditEngine RelevantOnly SecAuditLog "$ENV{AUDIT_LOG}" SecAction "phase:1,pass,log,id:500006" ), match_log => { error => [ qr/ModSecurity: Warning\. Unconditional match in SecAction\./, 1 ], audit => [ qr/Message: Warning\. Unconditional match in SecAction\./, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, { type => "action", comment => "nolog (pass)", conf => qq( SecRuleEngine On SecDebugLog "$ENV{DEBUG_LOG}" SecDebugLogLevel 9 SecAuditLogRelevantStatus xxx SecAuditEngine RelevantOnly SecAuditLog "$ENV{AUDIT_LOG}" SecAction "phase:1,pass,nolog,id:500007" ), match_log => { -error => [ qr/ModSecurity: /, 1 ], -audit => [ qr/./, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, # log/nolog (deny) { type => "action", comment => "log (deny)", conf => qq( SecRuleEngine On SecDebugLog "$ENV{DEBUG_LOG}" SecDebugLogLevel 9 SecAuditLogRelevantStatus xxx SecAuditEngine RelevantOnly SecAuditLog "$ENV{AUDIT_LOG}" SecAction "phase:1,deny,status:403,log,id:500008" ), match_log => { error => [ qr/ModSecurity: Access denied with code 403 \(phase 1\)\. Unconditional match in SecAction\./, 1 ], audit => [ qr/Message: Access denied with code 403 \(phase 1\)\. Unconditional match in SecAction\./, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, { type => "action", comment => "nolog (deny)", conf => qq( SecRuleEngine On SecDebugLog "$ENV{DEBUG_LOG}" SecDebugLogLevel 9 SecAuditLogRelevantStatus xxx SecAuditEngine RelevantOnly SecAuditLog "$ENV{AUDIT_LOG}" SecAction "phase:1,deny,status:403,nolog,id:500009" ), match_log => { -error => [ qr/ModSecurity: /, 1 ], -audit => [ qr/./, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, # auditlog/noauditlog (pass) { type => "action", comment => "auditlog (pass)", conf => qq( SecRuleEngine On SecDebugLog "$ENV{DEBUG_LOG}" SecDebugLogLevel 9 SecAuditLogRelevantStatus xxx SecAuditEngine RelevantOnly SecAuditLog "$ENV{AUDIT_LOG}" SecAction "phase:1,pass,auditlog,id:500010" ), match_log => { error => [ qr/ModSecurity: Warning\. Unconditional match in SecAction\./, 1 ], audit => [ qr/Message: Warning\. Unconditional match in SecAction\./, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, { type => "action", comment => "noauditlog (pass)", conf => qq( SecRuleEngine On SecDebugLog "$ENV{DEBUG_LOG}" SecDebugLogLevel 9 SecAuditLogRelevantStatus xxx SecAuditEngine RelevantOnly SecAuditLog "$ENV{AUDIT_LOG}" SecAction "phase:1,pass,noauditlog,id:500011" ), match_log => { error => [ qr/ModSecurity: Warning\. Unconditional match in SecAction\./, 1 ], -audit => [ qr/./, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, # auditlog/noauditlog (deny) { type => "action", comment => "auditlog (deny)", conf => qq( SecRuleEngine On SecDebugLog "$ENV{DEBUG_LOG}" SecDebugLogLevel 9 SecAuditLogRelevantStatus xxx SecAuditEngine RelevantOnly SecAuditLog "$ENV{AUDIT_LOG}" SecAction "phase:1,deny,status:403,auditlog,id:500012" ), match_log => { error => [ qr/ModSecurity: Access denied with code 403 \(phase 1\)\. Unconditional match in SecAction\./, 1 ], audit => [ qr/Message: Access denied with code 403 \(phase 1\)\. Unconditional match in SecAction\./, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, { type => "action", comment => "noauditlog (deny)", conf => qq( SecRuleEngine On SecDebugLog "$ENV{DEBUG_LOG}" SecDebugLogLevel 9 SecAuditLogRelevantStatus xxx SecAuditEngine RelevantOnly SecAuditLog "$ENV{AUDIT_LOG}" SecAction "phase:1,deny,status:403,noauditlog,id:500013" ), match_log => { error => [ qr/ModSecurity: Access denied with code 403 \(phase 1\)\. Unconditional match in SecAction\./, 1 ], -audit => [ qr/./, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, # All log/nolog auditlog/noauditlog combos (pass) { type => "action", comment => "log,auditlog (pass)", conf => qq( SecRuleEngine On SecDebugLog "$ENV{DEBUG_LOG}" SecDebugLogLevel 9 SecAuditLogRelevantStatus xxx SecAuditEngine RelevantOnly SecAuditLog "$ENV{AUDIT_LOG}" SecAction "phase:1,pass,log,auditlog,id:500014" ), match_log => { error => [ qr/ModSecurity: Warning\. Unconditional match in SecAction\./, 1 ], audit => [ qr/Message: Warning\. Unconditional match in SecAction\./, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, { type => "action", comment => "log,noauditlog (pass)", conf => qq( SecRuleEngine On SecDebugLog "$ENV{DEBUG_LOG}" SecDebugLogLevel 9 SecAuditLogRelevantStatus xxx SecAuditEngine RelevantOnly SecAuditLog "$ENV{AUDIT_LOG}" SecAction "phase:1,pass,log,noauditlog,id:500015" ), match_log => { error => [ qr/ModSecurity: Warning\. Unconditional match in SecAction\./, 1 ], -audit => [ qr/./, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, { type => "action", comment => "nolog,auditlog (pass)", conf => qq( SecRuleEngine On SecDebugLog "$ENV{DEBUG_LOG}" SecDebugLogLevel 9 SecAuditLogRelevantStatus xxx SecAuditEngine RelevantOnly SecAuditLog "$ENV{AUDIT_LOG}" SecAction "phase:1,pass,nolog,auditlog,id:500016" ), match_log => { audit => [ qr/-H--\s+Message: .*Stopwatch: /s, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, { type => "action", comment => "nolog,noauditlog (pass)", conf => qq( SecRuleEngine On SecDebugLog "$ENV{DEBUG_LOG}" SecDebugLogLevel 9 SecAuditLogRelevantStatus xxx SecAuditEngine RelevantOnly SecAuditLog "$ENV{AUDIT_LOG}" SecAction "phase:1,pass,nolog,noauditlog,id:500017" ), match_log => { -error => [ qr/ModSecurity: /, 1 ], -audit => [ qr/./, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, { type => "action", comment => "auditlog,log (pass)", conf => qq( SecRuleEngine On SecDebugLog "$ENV{DEBUG_LOG}" SecDebugLogLevel 9 SecAuditLogRelevantStatus xxx SecAuditEngine RelevantOnly SecAuditLog "$ENV{AUDIT_LOG}" SecAction "phase:1,pass,auditlog,log,id:500018" ), match_log => { error => [ qr/ModSecurity: Warning\. Unconditional match in SecAction\./, 1 ], audit => [ qr/Message: Warning\. Unconditional match in SecAction\./, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, { type => "action", comment => "auditlog,nolog (pass)", conf => qq( SecRuleEngine On SecDebugLog "$ENV{DEBUG_LOG}" SecDebugLogLevel 9 SecAuditLogRelevantStatus xxx SecAuditEngine RelevantOnly SecAuditLog "$ENV{AUDIT_LOG}" SecAction "phase:1,pass,auditlog,nolog,id:500019" ), match_log => { -error => [ qr/ModSecurity: /, 1 ], -audit => [ qr/./, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, { type => "action", comment => "noauditlog,log (pass)", conf => qq( SecRuleEngine On SecDebugLog "$ENV{DEBUG_LOG}" SecDebugLogLevel 9 SecAuditLogRelevantStatus xxx SecAuditEngine RelevantOnly SecAuditLog "$ENV{AUDIT_LOG}" SecAction "phase:1,pass,noauditlog,log,id:500020" ), match_log => { error => [ qr/ModSecurity: Warning\. Unconditional match in SecAction\./, 1 ], -audit => [ qr/./, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, { type => "action", comment => "noauditlog,nolog (pass)", conf => qq( SecRuleEngine On SecDebugLog "$ENV{DEBUG_LOG}" SecDebugLogLevel 9 SecAuditLogRelevantStatus xxx SecAuditEngine RelevantOnly SecAuditLog "$ENV{AUDIT_LOG}" SecAction "phase:1,pass,noauditlog,nolog,id:500021" ), match_log => { -error => [ qr/ModSecurity: /, 1 ], -audit => [ qr/./, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, # All log/nolog auditlog/noauditlog combos (deny) { type => "action", comment => "log,auditlog (deny)", conf => qq( SecRuleEngine On SecDebugLog "$ENV{DEBUG_LOG}" SecDebugLogLevel 9 SecAuditLogRelevantStatus xxx SecAuditEngine RelevantOnly SecAuditLog "$ENV{AUDIT_LOG}" SecAction "phase:1,deny,status:403,log,auditlog,id:500022" ), match_log => { error => [ qr/ModSecurity: Access denied with code 403 \(phase 1\)\. Unconditional match in SecAction\./, 1 ], audit => [ qr/Message: Access denied with code 403 \(phase 1\)\. Unconditional match in SecAction\./, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, { type => "action", comment => "log,noauditlog (deny)", conf => qq( SecRuleEngine On SecDebugLog "$ENV{DEBUG_LOG}" SecDebugLogLevel 9 SecAuditLogRelevantStatus xxx SecAuditEngine RelevantOnly SecAuditLog "$ENV{AUDIT_LOG}" SecAction "phase:1,deny,status:403,log,noauditlog,id:500023" ), match_log => { error => [ qr/ModSecurity: Access denied with code 403 \(phase 1\)\. Unconditional match in SecAction\./, 1 ], -audit => [ qr/./, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, { type => "action", comment => "nolog,auditlog (deny)", conf => qq( SecRuleEngine On SecDebugLog "$ENV{DEBUG_LOG}" SecDebugLogLevel 9 SecAuditLogRelevantStatus xxx SecAuditEngine RelevantOnly SecAuditLog "$ENV{AUDIT_LOG}" SecAction "phase:1,deny,status:403,nolog,auditlog,id:500024" ), match_log => { audit => [ qr/-H--\s+Message: .*Stopwatch: /s, 1 ], }, match_response => { -error => [ qr/ModSecurity: /, 1 ], status => qr/^403$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, { type => "action", comment => "nolog,noauditlog (deny)", conf => qq( SecRuleEngine On SecDebugLog "$ENV{DEBUG_LOG}" SecDebugLogLevel 9 SecAuditLogRelevantStatus xxx SecAuditEngine RelevantOnly SecAuditLog "$ENV{AUDIT_LOG}" SecAction "phase:1,deny,status:403,nolog,noauditlog,id:500025" ), match_log => { -error => [ qr/ModSecurity: /, 1 ], -audit => [ qr/./, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, { type => "action", comment => "auditlog,log (deny)", conf => qq( SecRuleEngine On SecDebugLog "$ENV{DEBUG_LOG}" SecDebugLogLevel 9 SecAuditLogRelevantStatus xxx SecAuditEngine RelevantOnly SecAuditLog "$ENV{AUDIT_LOG}" SecAction "phase:1,deny,status:403,auditlog,log,id:500026" ), match_log => { error => [ qr/ModSecurity: Access denied with code 403 \(phase 1\)\. Unconditional match in SecAction\./, 1 ], audit => [ qr/Message: Access denied with code 403 \(phase 1\)\. Unconditional match in SecAction\./, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, { type => "action", comment => "auditlog,nolog (deny)", conf => qq( SecRuleEngine On SecDebugLog "$ENV{DEBUG_LOG}" SecDebugLogLevel 9 SecAuditLogRelevantStatus xxx SecAuditEngine RelevantOnly SecAuditLog "$ENV{AUDIT_LOG}" SecAction "phase:1,deny,status:403,auditlog,nolog,id:500027" ), match_log => { -error => [ qr/ModSecurity: /, 1 ], -audit => [ qr/./, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, { type => "action", comment => "noauditlog,log (deny)", conf => qq( SecRuleEngine On SecDebugLog "$ENV{DEBUG_LOG}" SecDebugLogLevel 9 SecAuditLogRelevantStatus xxx SecAuditEngine RelevantOnly SecAuditLog "$ENV{AUDIT_LOG}" SecAction "phase:1,deny,status:403,noauditlog,log,id:500028" ), match_log => { error => [ qr/ModSecurity: Access denied with code 403 \(phase 1\)\. Unconditional match in SecAction\./, 1 ], -audit => [ qr/./, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, { type => "action", comment => "noauditlog,nolog (deny)", conf => qq( SecRuleEngine On SecDebugLog "$ENV{DEBUG_LOG}" SecDebugLogLevel 9 SecAuditLogRelevantStatus xxx SecAuditEngine RelevantOnly SecAuditLog "$ENV{AUDIT_LOG}" SecAction "phase:1,deny,status:403,noauditlog,nolog,id:500029" ), match_log => { -error => [ qr/ModSecurity: /, 1 ], -audit => [ qr/./, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, modsecurity-apache_2.7.7/tests/regression/action/10-append-prepend.t0000664000175000017500000000220612243422537025743 0ustar zimmerlezimmerle# TODO: Need more tests here ### append { type => "action", comment => "append content", conf => qq( SecRuleEngine On SecContentInjection On SecDebugLog "$ENV{DEBUG_LOG}" SecDebugLogLevel 9 SecAction "phase:1,setvar:tx.test=test,id:500002" SecAction "phase:2,append:'APPEND: \%{tx.test}',id:500003" ), match_log => { debug => [ "Added content to bottom: APPEND: test", 1 ], }, match_response => { status => qr/^200$/, content => qr/APPEND: test$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, ### prepend { type => "action", comment => "prepend content", conf => qq( SecRuleEngine On SecContentInjection On SecDebugLog "$ENV{DEBUG_LOG}" SecDebugLogLevel 9 SecAction "phase:1,setvar:tx.test=test,id:500004" SecAction "phase:2,prepend:'PREPEND: \%{tx.test}',id:500005" ), match_log => { debug => [ "Added content to top: PREPEND: test", 1 ], }, match_response => { status => qr/^200$/, content => qr/^PREPEND: test/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, modsecurity-apache_2.7.7/tests/regression/config/0000775000175000017500000000000012252376055022431 5ustar zimmerlezimmerlemodsecurity-apache_2.7.7/tests/regression/config/10-debug-directives.t0000664000175000017500000001401012243422537026252 0ustar zimmerlezimmerle### SecDebug* directive tests { type => "config", comment => "SecDebugLog (pos)", conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 ), match_log => { debug => [ qr/./, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, { type => "config", comment => "SecDebugLog (neg)", conf => qq( SecRuleEngine On ), match_log => { -debug => [ qr/./, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, { type => "config", comment => "SecDebugLogLevel 0", conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 0 SecRule REQUEST_URI "." "phase:1,deny,id:500241" ), match_log => { -debug => [ qr/./, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, { type => "config", comment => "SecDebugLogLevel 1", conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 1 SecRuleScript "test.lua" "phase:1" SecRule REQUEST_URI "(.)" "phase:4,deny,deprecatevar:bogus,id:500242" ), match_log => { debug => [ qr/\]\[[1]\] /, 1 ], -debug => [ qr/\]\[[2-9]\] /, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "application/x-www-form-urlencoded", ], "a=1&b=2", ), }, { type => "config", comment => "SecDebugLogLevel 2", conf => qq( SecRuleEngine DetectionOnly SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 2 SecRuleScript "test.lua" "phase:1" SecRule REQUEST_URI "(.)" "phase:4,deny,deprecatevar:bogus,id:500243" ), match_log => { debug => [ qr/\]\[2\] /, 1 ], -debug => [ qr/\]\[[3-9]\] /, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "application/x-www-form-urlencoded", ], "a=1&b=2", ), }, { type => "config", comment => "SecDebugLogLevel 3", conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 3 SecRuleScript "test.lua" "phase:1" SecRule REQUEST_URI "(.)" "phase:4,deny,deprecatevar:bogus,id:500244" ), match_log => { debug => [ qr/\]\[3\] /, 1 ], -debug => [ qr/\]\[[4-9]\] /, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "application/x-www-form-urlencoded", ], "a=1&b=2", ), }, { type => "config", comment => "SecDebugLogLevel 4", conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 4 SecRuleScript "test.lua" "phase:1" SecRule REQUEST_URI "(.)" "phase:4,deny,deprecatevar:bogus,id:500245" ), match_log => { debug => [ qr/\]\[4\] /, 1 ], -debug => [ qr/\]\[[5-9]\] /, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "application/x-www-form-urlencoded", ], "a=1&b=2", ), }, { type => "config", comment => "SecDebugLogLevel 5", conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 5 SecRuleScript "test.lua" "phase:1" SecRule REQUEST_URI "(.)" "phase:4,deny,deprecatevar:bogus,id:500246" ), match_log => { debug => [ qr/\]\[5\] /, 1 ], -debug => [ qr/\]\[[6-9]\] /, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "application/x-www-form-urlencoded", ], "a=1&b=2", ), }, { type => "config", comment => "SecDebugLogLevel 6", conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 6 SecRuleScript "test.lua" "phase:1" SecRule REQUEST_URI "(.)" "phase:4,deny,deprecatevar:bogus,id:500247" ), match_log => { debug => [ qr/\]\[6\] /, 1 ], -debug => [ qr/\]\[[7-9]\] /, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "application/x-www-form-urlencoded", ], "a=1&b=2", ), }, { type => "config", comment => "SecDebugLogLevel 7", conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 7 SecRuleScript "test.lua" "phase:1" SecRule REQUEST_URI "(.)" "phase:4,deny,deprecatevar:bogus,id:500248" ), match_log => { debug => [ qr/\]\[7\] /, 1 ], -debug => [ qr/\]\[[8-9]\] /, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "application/x-www-form-urlencoded", ], "a=1&b=2", ), }, { type => "config", comment => "SecDebugLogLevel 8", conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 8 SecRuleScript "test.lua" "phase:1" SecRule REQUEST_URI "(.)" "phase:4,deny,deprecatevar:bogus,id:500249" ), match_log => { debug => [ qr/\]\[8\] /, 1 ], -debug => [ qr/\]\[9\] /, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "application/x-www-form-urlencoded", ], "a=1&b=2", ), }, { type => "config", comment => "SecDebugLogLevel 9", conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRuleScript "test.lua" "phase:1" SecRule REQUEST_URI "(.)" "phase:4,deny,deprecatevar:bogus,id:500250" ), match_log => { debug => [ qr/\]\[9\] /, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "application/x-www-form-urlencoded", ], "a=1&b=2", ), }, modsecurity-apache_2.7.7/tests/regression/config/10-response-directives.t0000664000175000017500000001016512243422537027031 0ustar zimmerlezimmerle### Tests for directives altering how a response is handled # SecResponseBodyMimeTypesClear { type => "config", comment => "SecResponseBodyMimeTypesClear", conf => qq( SecRuleEngine On SecResponseBodyAccess On SecResponseBodyMimeTypesClear SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRule RESPONSE_BODY "TEST" "phase:4,deny,id:500237" ), match_log => { -error => [ qr/Access denied/, 1 ], debug => [ qr/Not buffering response body for unconfigured MIME type/, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, # SecResponseBodyAccess & SecResponseBodyMimeType { type => "config", comment => "SecResponseBodyAccess On", conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecResponseBodyAccess On SecResponseBodyMimeType text/plain null SecRule RESPONSE_BODY "TEST" "phase:4,deny,id:500238" ), match_log => { error => [ qr/Access denied with code 403 \(phase 4\)\. Pattern match "TEST" at RESPONSE_BODY\./, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, { type => "config", comment => "SecResponseBodyAccess Off", conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecResponseBodyAccess Off SecResponseBodyMimeType text/plain null SecRule RESPONSE_BODY "TEST" "phase:4,deny,id:500239" ), match_log => { -error => [ qr/Access denied/, 1 ], debug => [ qr/Response body buffering is not enabled\./, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, # SecResponseBodyLimit { type => "config", comment => "SecResponseBodyLimit (equal)", conf => qq( SecRuleEngine On SecResponseBodyAccess On SecResponseBodyMimeType text/plain null SecResponseBodyLimit 8192 ), match_log => { -error => [ qr/Content-Length \(\d+\) over the limit/, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/8k.txt", ), }, { type => "config", comment => "SecResponseBodyLimit (less)", conf => qq( SecRuleEngine On SecResponseBodyAccess On SecResponseBodyMimeType text/plain null SecResponseBodyLimit 9000 ), match_log => { -error => [ qr/Content-Length \(\d+\) over the limit/, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/8k.txt", ), }, { type => "config", comment => "SecResponseBodyLimit (greater)", conf => qq( SecRuleEngine On SecResponseBodyAccess On SecResponseBodyMimeType text/plain null SecResponseBodyLimit 8000 ), match_log => { error => [ qr/Content-Length \(\d+\) over the limit \(8000\)\./, 1 ], }, match_response => { status => qr/^500$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/8k.txt", ), }, # ResponseBodyLimitAction { type => "config", comment => "SecResponseBodyLimitAction Reject", conf => qq( SecRuleEngine On SecResponseBodyAccess On SecResponseBodyMimeType text/plain null SecResponseBodyLimit 5 SecResponseBodyLimitAction Reject ), match_log => { error => [ qr/Content-Length \(\d+\) over the limit \(5\)\./, 1 ], }, match_response => { status => qr/^500$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/8k.txt", ), }, { type => "config", comment => "SecResponseBodyLimitAction ProcessPartial", conf => qq( SecRuleEngine On SecResponseBodyAccess On SecResponseBodyMimeType text/plain null SecResponseBodyLimit 5 SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 4 SecResponseBodyLimitAction ProcessPartial ), match_log => { -error => [ qr/Content-Length \(\d+\) over the limit/, 1 ], debug => [ qr/Processing partial response body \(limit 5\)/, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/8k.txt", ), }, modsecurity-apache_2.7.7/tests/regression/config/10-request-directives.t0000664000175000017500000003215212252376055026666 0ustar zimmerlezimmerle### Tests for directives altering how a request is handled # SecArgumentSeparator { type => "config", comment => "SecArgumentSeparator (get-pos)", conf => q( SecRuleEngine On SecArgumentSeparator ";" SecRule ARGS:a "@streq 1" "phase:1,deny,chain,id:500215" SecRule ARGS:b "@streq 2,id:500216" ), match_log => { error => [ qr/Access denied with code 403 \(phase 1\)\. String match "2" at ARGS:b\./, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt?a=1;b=2", ), }, { type => "config", comment => "SecArgumentSeparator (get-neg)", conf => q( SecRuleEngine On SecRule ARGS:a "@streq 1" "phase:1,deny,chain,id:500217" SecRule ARGS:b "@streq 2,id:500218" ), match_log => { -error => [ qr/Access denied/, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt?a=1;b=2", ), }, { type => "config", comment => "SecArgumentSeparator (post-pos)", conf => q( SecRuleEngine On SecRequestBodyAccess On SecArgumentSeparator ";" SecRule ARGS:a "@streq 1" "phase:2,deny,chain,id:500219" SecRule ARGS:b "@streq 2,id:500220" ), match_log => { error => [ qr/Access denied with code 403 \(phase 2\)\. String match "2" at ARGS:b\./, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "application/x-www-form-urlencoded", ], "a=1;b=2", ), }, { type => "config", comment => "SecArgumentSeparator (post-neg)", conf => q( SecRuleEngine On SecRequestBodyAccess On SecRule ARGS:a "@streq 1" "phase:2,deny,id:500221" SecRule ARGS:b "@streq 2" "phase:2,deny,id:500222" ), match_log => { -error => [ qr/Access denied/, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "application/x-www-form-urlencoded", ], "a=1;b=2", ), }, # SecRequestBodyAccess { type => "config", comment => "SecRequestBodyAccess (pos)", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecRule ARGS:a "\@streq 1" "phase:2,deny,chain,id:500223" SecRule ARGS:b "\@streq 2,id:500224" ), match_log => { error => [ qr/Access denied with code 403 \(phase 2\)\. String match "2" at ARGS:b\./, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "application/x-www-form-urlencoded", ], "a=1&b=2", ), }, { type => "config", comment => "SecRequestBodyAccess (neg)", conf => qq( SecRuleEngine On SecRequestBodyAccess Off SecRule ARGS:a "\@streq 1" "phase:2,deny,id:500225" SecRule ARGS:b "\@streq 2" "phase:2,deny,id:500226" ), match_log => { -error => [ qr/Access denied/, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "application/x-www-form-urlencoded", ], "a=1&b=2", ), }, # SecRequestBodyLimit { type => "config", comment => "SecRequestBodyLimit (equal)", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecRequestBodyLimit 7 ), match_log => { -error => [ qr/Request body is larger than the configured limit/, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "application/x-www-form-urlencoded", ], "a=1&b=2", ), }, { type => "config", comment => "SecRequestBodyLimit (greater)", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecRequestBodyLimit 5 ), match_log => { error => [ qr/Request body .*is larger than the configured limit \(5\)\./, 1 ], }, match_response => { status => qr/^413$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "application/x-www-form-urlencoded", ], "a=1&b=2", ), }, { type => "config", comment => "SecRequestBodyLimit (equal - chunked)", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecRequestBodyLimit 276 ), match_log => { -error => [ qr/Request body is larger than the configured limit/, 1 ], }, match_response => { status => qr/^200$/, }, request => normalize_raw_request_data( qq( POST /test.txt HTTP/1.1 Host: $ENV{SERVER_NAME}:$ENV{SERVER_PORT} User-Agent: $ENV{USER_AGENT} Content-Type: multipart/form-data; boundary=---------------------------69343412719991675451336310646 Transfer-Encoding: chunked ), ) .encode_chunked( normalize_raw_request_data( q( -----------------------------69343412719991675451336310646 Content-Disposition: form-data; name="a" 1 -----------------------------69343412719991675451336310646 Content-Disposition: form-data; name="b" 2 -----------------------------69343412719991675451336310646-- ) ), 1024 ), }, { type => "config", comment => "SecRequestBodyLimit (greater - chunked)", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecRequestBodyLimit 256 ), match_log => { error => [ qr/Request body .*is larger than the configured limit \(256\)\./, 1 ], }, match_response => { status => qr/^413$/, }, request => normalize_raw_request_data( qq( POST /test.txt HTTP/1.1 Host: $ENV{SERVER_NAME}:$ENV{SERVER_PORT} User-Agent: $ENV{USER_AGENT} Content-Type: multipart/form-data; boundary=---------------------------69343412719991675451336310646 Transfer-Encoding: chunked ), ) .encode_chunked( normalize_raw_request_data( q( -----------------------------69343412719991675451336310646 Content-Disposition: form-data; name="a" 1 -----------------------------69343412719991675451336310646 Content-Disposition: form-data; name="b" 2 -----------------------------69343412719991675451336310646-- ) ), 1024 ), }, { type => "config", comment => "SecRequestBodyLimit (ctl:ruleEngine=off)", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecRequestBodyLimit 5 SecAction "phase:1,pass,nolog,ctl:ruleEngine=off,id:500081" SecRule REQUEST_BODY "." "phase:2,deny,id:500227" ), match_log => { -error => [ qr/Request body .*is larger than the configured limit/, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "application/x-www-form-urlencoded", ], "a=1&b=2", ), }, { type => "config", comment => "SecRequestBodyLimit (ctl:requestBodyAccess=off)", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecRequestBodyLimit 5 SecAction "phase:1,pass,nolog,ctl:requestBodyAccess=off,id:500082" SecRule REQUEST_BODY "." "phase:2,deny,id:500228" ), match_log => { -error => [ qr/Request body .*is larger than the configured limit/, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "application/x-www-form-urlencoded", ], "a=1&b=2", ), }, { type => "config", comment => "SecRequestBodyLimit (ctl:ruleEngine=off - chunked)", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecRequestBodyLimit 256 SecAction "phase:1,pass,nolog,ctl:ruleEngine=off,id:500083" SecRule REQUEST_BODY "." "phase:2,deny,id:500229" ), match_log => { -error => [ qr/Request body .*is larger than the configured limit/, 1 ], }, match_response => { status => qr/^200$/, }, request => normalize_raw_request_data( qq( POST /test.txt HTTP/1.1 Host: $ENV{SERVER_NAME}:$ENV{SERVER_PORT} User-Agent: $ENV{USER_AGENT} Content-Type: multipart/form-data; boundary=---------------------------69343412719991675451336310646 Transfer-Encoding: chunked ), ) .encode_chunked( normalize_raw_request_data( q( -----------------------------69343412719991675451336310646 Content-Disposition: form-data; name="a" 1 -----------------------------69343412719991675451336310646 Content-Disposition: form-data; name="b" 2 -----------------------------69343412719991675451336310646-- ) ), 1024 ), }, { type => "config", comment => "SecRequestBodyLimit (ctl:requestBodyAccess=off - chunked)", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecRequestBodyLimit 256 SecAction "phase:1,pass,nolog,ctl:requestBodyAccess=off,id:500084" SecRule REQUEST_BODY "." "phase:2,deny,id:500230" ), match_log => { -error => [ qr/Request body .*is larger than the configured limit \(256\)\./, 1 ], }, match_response => { status => qr/^200$/, }, request => normalize_raw_request_data( qq( POST /test.txt HTTP/1.1 Host: $ENV{SERVER_NAME}:$ENV{SERVER_PORT} User-Agent: $ENV{USER_AGENT} Content-Type: multipart/form-data; boundary=---------------------------69343412719991675451336310646 Transfer-Encoding: chunked ), ) .encode_chunked( normalize_raw_request_data( q( -----------------------------69343412719991675451336310646 Content-Disposition: form-data; name="a" 1 -----------------------------69343412719991675451336310646 Content-Disposition: form-data; name="b" 2 -----------------------------69343412719991675451336310646-- ) ), 1024 ), }, # SecRequestBodyInMemoryLimit { type => "config", comment => "SecRequestBodyInMemoryLimit (equal)", conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRequestBodyAccess On SecRequestBodyLimit 1000 SecRequestBodyInMemoryLimit 276 ), match_log => { -debug => [ qr/Input filter: Request too large to store in memory, switching to disk\./, 1 ], }, match_response => { status => qr/^200$/, }, request => normalize_raw_request_data( qq( POST /test.txt HTTP/1.1 Host: $ENV{SERVER_NAME}:$ENV{SERVER_PORT} User-Agent: $ENV{USER_AGENT} Content-Type: multipart/form-data; boundary=---------------------------69343412719991675451336310646 Transfer-Encoding: chunked ), ) .encode_chunked( normalize_raw_request_data( q( -----------------------------69343412719991675451336310646 Content-Disposition: form-data; name="a" 1 -----------------------------69343412719991675451336310646 Content-Disposition: form-data; name="b" 2 -----------------------------69343412719991675451336310646-- ) ), 1024 ), }, { type => "config", comment => "SecRequestBodyInMemoryLimit (greater)", conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRequestBodyAccess On SecRequestBodyLimit 1000 SecRequestBodyInMemoryLimit 16 ), match_log => { debug => [ qr/Input filter: Request too large to store in memory, switching to disk\./, 1 ], }, match_response => { status => qr/^200$/, }, request => normalize_raw_request_data( qq( POST /test.txt HTTP/1.1 Host: $ENV{SERVER_NAME}:$ENV{SERVER_PORT} User-Agent: $ENV{USER_AGENT} Content-Type: multipart/form-data; boundary=---------------------------69343412719991675451336310646 Transfer-Encoding: chunked ), ) .encode_chunked( normalize_raw_request_data( q( -----------------------------69343412719991675451336310646 Content-Disposition: form-data; name="a" 1 -----------------------------69343412719991675451336310646 Content-Disposition: form-data; name="b" 2 -----------------------------69343412719991675451336310646-- ) ), 1024 ), }, # SecCookieFormat { type => "config", comment => "SecCookieFormat (pos)", conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 5 SecCookieFormat 1 SecRule REQUEST_COOKIES_NAMES "\@streq SESSIONID" "phase:1,deny,chain,id:500231" SecRule REQUEST_COOKIES:\$SESSIONID_PATH "\@streq /" "chain,id:500232" SecRule REQUEST_COOKIES:SESSIONID "\@streq cookieval,id:500233" ), match_log => { error => [ qr/Access denied with code 403 \(phase 1\)\. String match "cookieval" at REQUEST_COOKIES:SESSIONID\./, 1 ], debug => [ qr(Adding request cookie: name "\$SESSIONID_PATH", value "/"), 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Cookie" => q($Version="1"; SESSIONID="cookieval"; $PATH="/"), ], undef, ), }, { type => "config", comment => "SecCookieFormat (neg)", conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 5 SecCookieFormat 0 SecRule REQUEST_COOKIES_NAMES "\@streq SESSIONID" "phase:1,deny,chain,id:500234" SecRule REQUEST_COOKIES:\$SESSIONID_PATH "\@streq /" "chain,id:500235" SecRule REQUEST_COOKIES:SESSIONID "\@streq cookieval,id:500236" ), match_log => { -error => [ qr/Access denied/, 1 ], -debug => [ qr(Adding request cookie: name "\$SESSIONID_PATH", value "/"), 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Cookie" => q($Version="1"; SESSIONID="cookieval"; $PATH="/"), ], undef, ), }, modsecurity-apache_2.7.7/tests/regression/config/10-misc-directives.t0000664000175000017500000000711512252376055026132 0ustar zimmerlezimmerle### Misc directive tests ### TODO: # SecTmpDir # SecUploadKeepFiles # SecChrootDir # SecGuardianLog # SecDefaultAction { type => "config", comment => "SecDefaultAction", conf => qq( SecRuleEngine on SecDefaultAction "phase:1,deny,status:500" SecRule REQUEST_URI "test.txt,id:500240" ), match_log => { error => [ qr/ModSecurity: Access denied with code 500 \(phase 1\)/, 1 ], }, match_response => { status => qr/^500$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, # SecServerSignature { type => "config", comment => "SecServerSignature On", conf => qq( SecServerSignature "NewServerSignature" ), match_log => { error => [ qr/NewServerSignature/, 1 ], }, match_response => { status => qr/^200$/, raw => qr/^Server: +NewServerSignature$/m, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, # SecDataDir { type => "config", comment => "SecDataDir", conf => qq( SecRuleEngine On SecDataDir "$ENV{DATA_DIR}" SecAction initcol:ip=%{REMOTE_ADDR},setvar:ip.dummy=1,pass,id:500085 ), match_log => { error => [ qr/ModSecurity: Warning. Unconditional match in SecAction\./, 1 ], }, match_file => { "$ENV{DATA_DIR}/ip.pag" => qr/\x00\x06dummy\x00\x00\x021\x00/, }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, # SecTmpDir/SecUploadDir/SecUploadKeepFiles { type => "config", comment => "SecTmpDir/SecUploadDir/SecUploadKeepFiles", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 4 SecTmpDir "$ENV{TEMP_DIR}" SecUploadKeepFiles On SecUploadDir "$ENV{UPLOAD_DIR}" ), test => sub { # Get the filename and make sure the file exists my $fn = match_log(debug => qr/Moved file from .* to ".*"\./, 5); die "Failed to determine uploaded filename\n" unless (defined $fn); $fn =~ s/Moved file from .* to "(.*)"\..*/$1/; die "File does not exist: $fn\n" unless (-e $fn); # Check the contents of the file return 0 if (match_file($fn, qr/^TESTFILE$/m)); msg("Failed to match contents of uploaded file: $fn"); return 1; }, match_log => { debug => [ qr/Created temporary file.*$ENV{TEMP_DIR}/, 1 ], -debug => [ qr/Failed to /, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "multipart/form-data; boundary=---------------------------19813181771830765643996187206", ], q(-----------------------------19813181771830765643996187206 Content-Disposition: form-data; name="upload-file"; filename="test" Content-Type: application/octet-stream TESTFILE -----------------------------19813181771830765643996187206 Content-Disposition: form-data; name="file" Upload File -----------------------------19813181771830765643996187206--), ), }, # SecWebAppId { type => "config", comment => "SecWebAppId", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 4 SecAuditLog "$ENV{AUDIT_LOG}" SecAuditEngine RelevantOnly SecWebAppId "app-1" SecAction "pass,log,auditlog,id:1" ), match_log => { error => [ qr/Warning\. Unconditional match in SecAction\./, 1 ], debug => [ qr/Warning\. Unconditional match in SecAction\./, 1 ], audit => [ qr/^WebApp-Info: "app-1"/m, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, modsecurity-apache_2.7.7/tests/regression/config/20-chroot.t0000664000175000017500000000136112243422537024331 0ustar zimmerlezimmerle### SecChroot tests # TODO: Will not work as we need root access #{ # type => "config", # comment => "SecChroot", # httpd_opts => qw( # -DCHROOT # ), # conf => qq( # # These will be in the chroot # PidFile /logs/httpd.pid # ScoreBoardFile /logs/httpd.scoreboard # User nobody # Group nogroup # # SecAuditEngine On # SecDebugLog $ENV{DEBUG_LOG} # SecDebugLogLevel 9 # SecAuditLog $ENV{AUDIT_LOG} # SecAuditLogStorageDir "/logs/audit" # SecAuditLogType Concurrent # SecChrootDir "$ENV{TEST_SERVER_ROOT}" # ), # match_log => { # debug => [ qr/./, 1 ], # audit => [ qr/./, 1 ], # }, # match_response => { # status => qr/^200$/, # }, # request => new HTTP::Request( # GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", # ), #}, modsecurity-apache_2.7.7/tests/regression/config/00-load-modsec.t0000664000175000017500000000105512243422537025220 0ustar zimmerlezimmerle{ type => "config", comment => "module loaded", match_log => { error => [ qr/ModSecurity for Apache.* configured\./, 10 ], }, }, { type => "config", comment => "minimal config", conf => sub { # Open the minimal conf file, substituting the # relative log paths with full paths. open(C, "<$ENV{DIST_ROOT}/modsecurity.conf-minimal") or die "$!\n"; (my $conf = join('', )) =~ s#Log logs/#Log $ENV{TEST_SERVER_ROOT}/logs/#g; close C; return $conf; }, match_log => { error => [ qr/ModSecurity for Apache.* configured\./, 10 ], }, }, modsecurity-apache_2.7.7/tests/regression/config/10-audit-directives.t0000664000175000017500000001337712243422537026311 0ustar zimmerlezimmerle### SecAudit* directive tests # SecAuditEngine { type => "config", comment => "SecAuditEngine On", conf => qq( SecAuditEngine On SecAuditLog $ENV{AUDIT_LOG} ), match_log => { audit => [ qr/./, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, { type => "config", comment => "SecAuditEngine Off", conf => qq( SecAuditEngine Off SecAuditLog $ENV{AUDIT_LOG} ), match_log => { -audit => [ qr/./, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, { type => "config", comment => "SecAuditEngine RelevantOnly (pos)", conf => qq( SecRuleEngine On SecAuditEngine RelevantOnly SecAuditLog $ENV{AUDIT_LOG} SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecResponseBodyAccess On SecDefaultAction "phase:2,log,auditlog,pass" SecRule REQUEST_URI "." "phase:4,deny,id:500251" ), match_log => { audit => [ qr/./, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, { type => "config", comment => "SecAuditEngine RelevantOnly (neg)", conf => qq( SecAuditEngine RelevantOnly SecAuditLog $ENV{AUDIT_LOG} SecResponseBodyAccess On SecDefaultAction "phase:2,log,auditlog,pass" ), match_log => { -audit => [ qr/./, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, # SecAuditLogType & SecAuditLogStorageDir { type => "config", comment => "SecAuditLogType Serial", conf => qq( SecAuditEngine On SecAuditLog $ENV{AUDIT_LOG} SecAuditLogType Serial ), match_log => { audit => [ qr/./, 1 ], }, match_response => { status => qr/^404$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/bogus", ), }, { type => "config", comment => "SecAuditLogType Concurrent", conf => qq( SecAuditEngine On SecAuditLog $ENV{AUDIT_LOG} SecAuditLogType Concurrent SecAuditLogStorageDir "$ENV{LOGS_DIR}/audit" ), test => sub { ### Perl code to parse the audit log entry and verify ### that the concurrent audit log exists and contains ### the correct data. ### ### TODO: Need some API for this :) ### # Parse log my $alogre = qr/^(?:\S+)\ (?:\S+)\ (?:\S+)\ (?:\S+)\ \[(?:[^:]+):(?:\d+:\d+:\d+)\ (?:[^\]]+)\]\ \"(?:.*)\"\ (?:\d+)\ (?:\S+)\ \"(?:.*)\"\ \"(?:.*)\"\ (\S+)\ \"(?:.*)\"\ (\S+)\ (?:\d+)\ (?:\d+)\ (?:\S+)(?:.*)$/m; my $alog = match_log("audit", $alogre, 1); chomp $alog; my @log = ($alog =~ m/$alogre/); my($id, $fn) = ($log[0], $log[1]); if (!$id or !$fn) { dbg("LOG ENTRY: $alog"); die "Failed to parse audit log: $ENV{AUDIT_LOG}\n"; } # Verify concurrent log exists my $alogdatafn = "$ENV{LOGS_DIR}/audit$fn"; if (! -e "$alogdatafn") { die "Audit log does not exist: $alogdatafn\n"; } # Verify concurrent log contents if (defined match_file($alogdatafn, qr/^--[^-]+-A--.*$id.*-Z--$/s)) { return 0; } # Error dbg("LOGDATA: \"$FILE{$alogdatafn}{buf}\""); die "Audit log data did not match.\n"; }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, # SecAuditLogRelevantStatus { type => "config", comment => "SecAuditLogRelevantStatus (pos)", conf => qq( SecAuditEngine RelevantOnly SecAuditLog $ENV{AUDIT_LOG} SecAuditLogRelevantStatus "^4" ), match_log => { audit => [ qr/./, 1 ], }, match_response => { status => qr/^404$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/bogus", ), }, { type => "config", comment => "SecAuditLogRelevantStatus (neg)", conf => qq( SecAuditEngine RelevantOnly SecAuditLog $ENV{AUDIT_LOG} SecAuditLogRelevantStatus "^4" ), match_log => { -audit => [ qr/./, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, # SecAuditLogParts { type => "config", comment => "SecAuditLogParts (minimal)", conf => qq( SecAuditEngine On SecAuditLog $ENV{AUDIT_LOG} SecRequestBodyAccess On SecResponseBodyAccess On SecAuditLogParts "AZ" ), match_log => { audit => [ qr/-A--.*-Z--/s, 1 ], -audit => [ qr/-[B-Y]--/, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "application/x-www-form-urlencoded", ], "a=1r&=2", ), }, { type => "config", comment => "SecAuditLogParts (default)", conf => qq( SecAuditEngine On SecAuditLog $ENV{AUDIT_LOG} SecRequestBodyAccess On SecResponseBodyAccess On ), match_log => { audit => [ qr/-A--.*-B--.*-F--.*-H--.*-Z--/s, 1 ], -audit => [ qr/-[DEGIJK]--/, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "application/x-www-form-urlencoded", ], "a=1r&=2", ), }, { type => "config", comment => "SecAuditLogParts (all)", conf => qq( SecRuleEngine On SecAuditEngine On SecAuditLog $ENV{AUDIT_LOG} SecRequestBodyAccess On SecResponseBodyAccess On SecAuditLogParts "ABCDEFGHIJKZ" SecAction "phase:4,log,auditlog,allow,id:500086" ), match_log => { audit => [ qr/-A--.*-B--.*-C--.*-F--.*-E--.*-H--.*-K--.*-Z--/s, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "application/x-www-form-urlencoded", ], "a=1r&=2", ), }, modsecurity-apache_2.7.7/tests/regression/rule/0000775000175000017500000000000012253711345022127 5ustar zimmerlezimmerlemodsecurity-apache_2.7.7/tests/regression/rule/20-exceptions.t0000664000175000017500000001151212243422537024715 0ustar zimmerlezimmerle### Tests for rule exceptions # SecRuleRemoveById { type => "rule", comment => "SecRuleRemoveById (single)", conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRule REQUEST_URI "test" "phase:1,deny,status:500,id:1" SecRuleRemoveById 1 ), match_log => { -error => [ qr/ModSecurity: /, 1 ], -audit => [ qr/./, 1 ], debug => [ qr/Starting phase REQUEST_HEADERS\..*This phase consists of 0 rule.*Starting phase RESPONSE_HEADERS\./s, 1 ], -debug => [ qr/Access denied/, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, { type => "rule", comment => "SecRuleRemoveById (multiple)", conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRule REQUEST_URI "test" "phase:1,deny,status:500,id:1" SecRule REQUEST_URI "test" "phase:1,deny,status:500,id:2" SecRule REQUEST_URI "test" "phase:1,deny,status:500,id:3" SecRuleRemoveById 1 2 3 ), match_log => { -error => [ qr/ModSecurity: /, 1 ], -audit => [ qr/./, 1 ], debug => [ qr/Starting phase REQUEST_HEADERS\..*This phase consists of 0 rule.*Starting phase RESPONSE_HEADERS\./s, 1 ], -debug => [ qr/Access denied/, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, { type => "rule", comment => "SecRuleRemoveById (range)", conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRule REQUEST_URI "test" "phase:1,deny,status:500,id:1" SecRule REQUEST_URI "test" "phase:1,deny,status:500,id:2" SecRule REQUEST_URI "test" "phase:1,deny,status:500,id:3" SecRuleRemoveById 1-3 ), match_log => { -error => [ qr/ModSecurity: /, 1 ], -audit => [ qr/./, 1 ], debug => [ qr/Starting phase REQUEST_HEADERS\..*This phase consists of 0 rule.*Starting phase RESPONSE_HEADERS\./s, 1 ], -debug => [ qr/Access denied/, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, { type => "rule", comment => "SecRuleRemoveById (multiple + range)", conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRule REQUEST_URI "test" "phase:1,deny,status:500,id:1" SecRule REQUEST_URI "test" "phase:1,deny,status:500,id:2" SecRule REQUEST_URI "test" "phase:1,deny,status:500,id:3" SecRule REQUEST_URI "test" "phase:1,deny,status:500,id:4" SecRuleRemoveById 1 2-4 ), match_log => { -error => [ qr/ModSecurity: /, 1 ], -audit => [ qr/./, 1 ], debug => [ qr/Starting phase REQUEST_HEADERS\..*This phase consists of 0 rule.*Starting phase RESPONSE_HEADERS\./s, 1 ], -debug => [ qr/Access denied/, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, # SecRuleRemoveByMsg { type => "rule", comment => "SecRuleRemoveByMsg", conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRule REQUEST_URI "test" "phase:1,deny,status:500,id:1,msg:'testing rule',id:500001" SecRuleRemoveByMsg "testing rule" ), match_log => { -error => [ qr/ModSecurity: /, 1 ], -audit => [ qr/./, 1 ], debug => [ qr/Starting phase REQUEST_HEADERS\..*This phase consists of 0 rule.*Starting phase RESPONSE_HEADERS\./s, 1 ], -debug => [ qr/Access denied/, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, # SecRuleUpdateActionById { type => "rule", comment => "SecRuleUpdateActionById", conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRule REQUEST_URI "test" "phase:1,deny,status:500,id:1,msg:'testing rule',id:500002" SecRuleUpdateActionById 1 "pass,nolog" ), match_log => { -error => [ qr/ModSecurity: /, 1 ], -audit => [ qr/./, 1 ], debug => [ qr/id:1,.*,pass,nolog/, 1 ], -debug => [ qr/Access denied/, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, { type => "rule", comment => "SecRuleUpdateActionById (chain)", conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRule REQUEST_URI "test" "phase:1,deny,status:500,id:1,msg:'testing rule',chain,id:500003" SecRule ARGS "bar,id:500004" SecRuleUpdateActionById 1 "pass,nolog" ), match_log => { -error => [ qr/ModSecurity: /, 1 ], -audit => [ qr/./, 1 ], debug => [ qr/id:1,.*,pass,nolog/, 1 ], -debug => [ qr/Access denied/, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt?foo=bar", ), }, modsecurity-apache_2.7.7/tests/regression/rule/00-inheritance.t0000664000175000017500000000007712243422537025027 0ustar zimmerlezimmerle### Tests for rule inheritance ### TODO: # SecRuleInheritance modsecurity-apache_2.7.7/tests/regression/rule/10-xml.t0000664000175000017500000003423412253711345023340 0ustar zimmerlezimmerle### Test for XML operator rules ### Validate Scheme # OK { type => "rule", comment => "validateSchema (validate ok)", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRule REQUEST_HEADERS:Content-Type "^text/xml\$" "id:500005, \\ phase:1,t:none,t:lowercase,nolog,pass,ctl:requestBodyProcessor=XML" SecRule REQBODY_PROCESSOR "!^XML\$" nolog,pass,skipAfter:12345,id:500006 SecRule XML "\@validateSchema $ENV{CONF_DIR}/SoapEnvelope.xsd" "id:500007, \\ phase:3:,deny" ), match_log => { debug => [ qr/XML: Initialising parser.*XML: Parsing complete \(well_formed 1\).*Target value: "\[XML document tree\]".*Successfully validated payload against Schema/s, 1 ], -debug => [ qr/XML parser error|validation failed|Failed to load/, 1 ], -error => [ qr/XML parser error|validation failed|Failed to load/, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "text/xml", ], normalize_raw_request_data( q( 12123 ), ), ), }, # Failed attribute value { type => "rule", comment => "validateSchema (validate attribute value failed)", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecAuditEngine RelevantOnly SecAuditLog "$ENV{AUDIT_LOG}" SecRule REQUEST_HEADERS:Content-Type "^text/xml\$" "id:500008, \\ phase:1,t:none,t:lowercase,nolog,pass,ctl:requestBodyProcessor=XML" SecRule REQBODY_PROCESSOR "!^XML\$" nolog,pass,skipAfter:12345,id:500009 SecRule XML "\@validateSchema $ENV{CONF_DIR}/SoapEnvelope.xsd" "id:500010 \\ phase:2,deny,log,auditlog,id:12345" ), match_log => { debug => [ qr/XML: Initialising parser.*XML: Parsing complete \(well_formed 1\).*Target value: "\[XML document tree\]".*'badval' is not a valid value of the local atomic type.*Schema validation failed/s, 1 ], -debug => [ qr/Successfully validated payload against Schema|\n\r?\n/, 1 ], audit => [ qr/^Message: Element.*'badval' is not a valid value of the local atomic type\.\nMessage:/m, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "text/xml", ], normalize_raw_request_data( q( 12123 ), ), ), }, # Failed validation { type => "rule", comment => "validateSchema (validate failed)", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecAuditEngine RelevantOnly SecAuditLog "$ENV{AUDIT_LOG}" SecRule REQUEST_HEADERS:Content-Type "^text/xml\$" "id:500011, \\ phase:1,t:none,t:lowercase,nolog,pass,ctl:requestBodyProcessor=XML" SecRule REQBODY_PROCESSOR "!^XML\$" nolog,pass,skipAfter:12345,id:500012 SecRule XML "\@validateSchema $ENV{CONF_DIR}/SoapEnvelope.xsd" "id:500013 \\ phase:2,deny,id:12345" ), match_log => { debug => [ qr/XML: Initialising parser.*XML: Parsing complete \(well_formed 1\).*Target value: "\[XML document tree\]".*element is not expected/s, 1 ], -debug => [ qr/XML parser error|Failed to load/, 1 ], -error => [ qr/XML parser error|Failed to load/, 1 ], audit => [ qr/^Message: Element.*This element is not expected.*\nMessage:/m, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "text/xml", ], normalize_raw_request_data( q( 12123 ), ), ), }, # Bad XML { type => "rule", comment => "validateSchema (bad XML)", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecAuditEngine RelevantOnly SecAuditLog "$ENV{AUDIT_LOG}" SecRule REQUEST_HEADERS:Content-Type "^text/xml\$" "id:500014, \\ phase:1,t:none,t:lowercase,nolog,pass,ctl:requestBodyProcessor=XML" SecRule REQBODY_PROCESSOR "!^XML\$" nolog,pass,skipAfter:12345,id:500015 SecRule XML "\@validateSchema $ENV{CONF_DIR}/SoapEnvelope.xsd" "id:500016, \\ phase:2,deny,id:12345" ), match_log => { debug => [ qr/XML: Initialising parser.*XML: Parsing complete \(well_formed 0\).*XML parser error.*validation failed because content is not well formed/s, 1 ], -debug => [ qr/Failed to load|Successfully validated/, 1 ], -error => [ qr/Failed to load|Successfully validated/, 1 ], audit => [ qr/^Message: .*Failed parsing document.*\nMessage:/m, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "text/xml", ], normalize_raw_request_data( q( 12123 ), ), ), }, # Bad schema { type => "rule", comment => "validateSchema (bad schema)", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecAuditEngine RelevantOnly SecAuditLog "$ENV{AUDIT_LOG}" SecRule REQUEST_HEADERS:Content-Type "^text/xml\$" "id:500017 \\ phase:1,t:none,t:lowercase,nolog,pass,ctl:requestBodyProcessor=XML" SecRule REQBODY_PROCESSOR "!^XML\$" nolog,pass,skipAfter:12345,id:500018 SecRule XML "\@validateSchema $ENV{CONF_DIR}/SoapEnvelope-bad.xsd" "id:500019 \\ phase:2,deny,id:12345" ), match_log => { debug => [ qr/XML: Initialising parser.*XML: Parsing complete \(well_formed 1\).*Target value: "\[XML document tree\]".*Failed to parse the XML resource.*Failed to load Schema/s, 1 ], audit => [ qr/^Message: .*Failed to parse the XML resource.*\nMessage: Rule processing failed/m, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "text/xml", ], normalize_raw_request_data( q( 12123 ), ), ), }, # Validate DTD # OK { type => "rule", comment => "validateDTD (validate ok)", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRule REQUEST_HEADERS:Content-Type "^text/xml\$" "id:500020, \\ phase:1,t:none,t:lowercase,nolog,pass,ctl:requestBodyProcessor=XML" SecRule REQBODY_PROCESSOR "!^XML\$" nolog,pass,skipAfter:12345,id:500021 SecRule XML "\@validateDTD $ENV{CONF_DIR}/SoapEnvelope.dtd" "id:500022, \\ phase:2,deny,id:12345" ), match_log => { debug => [ qr/XML: Initialising parser.*XML: Parsing complete \(well_formed 1\).*Target value: "\[XML document tree\]".*Successfully validated payload against DTD/s, 1 ], -debug => [ qr/XML parser error|validation failed|Failed to load/, 1 ], -error => [ qr/XML parser error|validation failed|Failed to load/, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "text/xml", ], normalize_raw_request_data( q( 12123 ), ), ), }, # Failed validation { type => "rule", comment => "validateDTD (validate failed)", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRule REQUEST_HEADERS:Content-Type "^text/xml\$" "id:500023, \\ phase:1,t:none,t:lowercase,nolog,pass,ctl:requestBodyProcessor=XML" SecRule REQBODY_PROCESSOR "!^XML\$" nolog,pass,skipAfter:12345,id:500024 SecRule XML "\@validateDTD $ENV{CONF_DIR}/SoapEnvelope.dtd" "id:500025, \\ phase:2,deny,id:12345" ), match_log => { debug => [ qr/XML: Initialising parser.*XML: Parsing complete \(well_formed 1\).*Target value: "\[XML document tree\]".*content does not follow the DTD/s, 1 ], -debug => [ qr/XML parser error|Failed to load/, 1 ], -error => [ qr/XML parser error|Failed to load/, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "text/xml", ], normalize_raw_request_data( q( 12123 ), ), ), }, # Bad XML { type => "rule", comment => "validateDTD (bad XML)", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRule REQUEST_HEADERS:Content-Type "^text/xml\$" "id:500026, \\ phase:1,t:none,t:lowercase,nolog,pass,ctl:requestBodyProcessor=XML" SecRule REQBODY_PROCESSOR "!^XML\$" nolog,pass,skipAfter:12345,id:500027 SecRule XML "\@validateDTD $ENV{CONF_DIR}/SoapEnvelope.dtd" "id:500028, \\ phase:2,deny,id:12345" ), match_log => { debug => [ qr/XML: Initialising parser.*XML: Parsing complete \(well_formed 0\).*XML parser error.*validation failed because content is not well formed/s, 1 ], -debug => [ qr/Failed to load|Successfully validated/, 1 ], -error => [ qr/Failed to load|Successfully validated/, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "text/xml", ], normalize_raw_request_data( q( 12123 ), ), ), }, # Bad DTD { type => "rule", comment => "validateDTD (bad DTD)", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRule REQUEST_HEADERS:Content-Type "^text/xml\$" "id:500029, \\ phase:1,t:none,t:lowercase,nolog,pass,ctl:requestBodyProcessor=XML" SecRule REQBODY_PROCESSOR "!^XML\$" nolog,pass,skipAfter:12345,id:500030 SecRule XML "\@validateDTD $ENV{CONF_DIR}/SoapEnvelope-bad.dtd" "id:500031 \\ phase:2,deny,id:12345" ), match_log => { debug => [ qr/XML: Initialising parser.*XML: Parsing complete \(well_formed 1\).*Target value: "\[XML document tree\]".*Failed to load DTD/s, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "text/xml", ], normalize_raw_request_data( q( 12123 ), ), ), }, modsecurity-apache_2.7.7/tests/regression/rule/00-basics.t0000664000175000017500000000475112243422537024005 0ustar zimmerlezimmerle### Tests for basic rule components # SecAction { type => "rule", comment => "SecAction (override default)", conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 4 SecAction "nolog,id:500001" ), match_log => { -error => [ qr/ModSecurity: /, 1 ], -audit => [ qr/./, 1 ], debug => [ qr/Warning\. Unconditional match in SecAction\./, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, # SecRule { type => "rule", comment => "SecRule (no action)", conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 5 SecDefaultAction "phase:2,deny,status:403" SecRule ARGS:test "value,id:500032" ), match_log => { error => [ qr/ModSecurity: /, 1 ], debug => [ qr/Rule [0-9a-f]+: SecRule "ARGS:test" "\@rx value" "phase:2,deny,status:403"$/m, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt?test=value", ), }, { type => "rule", comment => "SecRule (action)", conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 5 SecDefaultAction "phase:2,pass" SecRule ARGS:test "value" "deny,status:403,id:500033" ), match_log => { error => [ qr/ModSecurity: /, 1 ], debug => [ qr/Rule [0-9a-f]+: SecRule "ARGS:test" "\@rx value" "phase:2,deny,status:403"$/m, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt?test=value", ), }, { type => "rule", comment => "SecRule (chain)", conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 5 SecDefaultAction "phase:2,log,noauditlog,pass,tag:foo" SecRule ARGS:test "value" "chain,phase:2,deny,status:403,id:500034" SecRule &ARGS "\@eq 1" "chain,setenv:tx.foo=bar,id:500035" SecRule REQUEST_METHOD "\@streq GET,id:500036" ), match_log => { error => [ qr/ModSecurity: /, 1 ], debug => [ qr/Rule [0-9a-f]+: SecRule "ARGS:test" "\@rx value" "phase:2,log,noauditlog,tag:foo,chain,deny,status:403"\r?\n.*Rule [0-9a-f]+: SecRule "&ARGS" "\@eq 1" "chain,setenv:tx.foo=bar"\r?\n.*Rule [0-9a-f]+: SecRule "REQUEST_METHOD" "\@streq GET"\r?\n/s, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt?test=value", ), }, modsecurity-apache_2.7.7/tests/regression/rule/00-script.t0000664000175000017500000000266512243422537024047 0ustar zimmerlezimmerle### Test for SecRuleScript # Lua { type => "rule", comment => "SecRuleScript (lua absolute nomatch)", conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 1 SecRuleScript "$ENV{CONF_DIR}/test.lua" "phase:2,deny" ), match_log => { -error => [ qr/Lua script matched\./, 1 ], debug => [ qr/Test message\./, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, { type => "rule", comment => "SecRuleScript (lua relative nomatch)", conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 1 SecRuleScript "test.lua" "phase:2,deny" ), match_log => { -error => [ qr/Lua script matched\./, 1 ], debug => [ qr/Test message\./, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, { type => "rule", comment => "SecRuleScript (lua relative match)", conf => qq( SecRuleEngine On SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 1 SecRuleScript "match.lua" "phase:2,deny" ), match_log => { error => [ qr/ModSecurity: Access denied with code 403 \(phase 2\)\. Lua script matched\./, 1 ], debug => [ qr/Test message\./, 1 ], }, match_response => { status => qr/^403$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", ), }, modsecurity-apache_2.7.7/tests/regression/server_root/0000775000175000017500000000000012243422537023532 5ustar zimmerlezimmerlemodsecurity-apache_2.7.7/tests/regression/server_root/logs/0000775000175000017500000000000012252641453024476 5ustar zimmerlezimmerlemodsecurity-apache_2.7.7/tests/regression/server_root/logs/audit/0000775000175000017500000000000012252643564025611 5ustar zimmerlezimmerlemodsecurity-apache_2.7.7/tests/regression/server_root/logs/audit/.empty0000664000175000017500000000000012243422537026731 0ustar zimmerlezimmerlemodsecurity-apache_2.7.7/tests/regression/server_root/logs/subdir/0000775000175000017500000000000012243422537025766 5ustar zimmerlezimmerlemodsecurity-apache_2.7.7/tests/regression/server_root/logs/subdir/.empty0000664000175000017500000000000012243422537027113 0ustar zimmerlezimmerlemodsecurity-apache_2.7.7/tests/regression/server_root/upload/0000775000175000017500000000000012252643564025023 5ustar zimmerlezimmerlemodsecurity-apache_2.7.7/tests/regression/server_root/upload/.empty0000664000175000017500000000000012243422537026143 0ustar zimmerlezimmerlemodsecurity-apache_2.7.7/tests/regression/server_root/conf/0000775000175000017500000000000012254305737024463 5ustar zimmerlezimmerlemodsecurity-apache_2.7.7/tests/regression/server_root/conf/SoapEnvelope-bad.dtd0000664000175000017500000000032112243422537030274 0ustar zimmerlezimmerle modsecurity-apache_2.7.7/tests/regression/server_root/conf/match.lua0000664000175000017500000000060712243422537026261 0ustar zimmerlezimmerle-- Test matching Lua Script to just print debug messages function main() m.log(1, "Test message."); m.log(2, "Test message."); m.log(3, "Test message."); m.log(4, "Test message."); m.log(5, "Test message."); m.log(6, "Test message."); m.log(7, "Test message."); m.log(8, "Test message."); m.log(9, "Test message."); return "Lua script matched."; end modsecurity-apache_2.7.7/tests/regression/server_root/conf/test.lua0000664000175000017500000000055412243422537026145 0ustar zimmerlezimmerle-- Test Lua Script to just print debug messages function main() m.log(1, "Test message."); m.log(2, "Test message."); m.log(3, "Test message."); m.log(4, "Test message."); m.log(5, "Test message."); m.log(6, "Test message."); m.log(7, "Test message."); m.log(8, "Test message."); m.log(9, "Test message."); return nil; end modsecurity-apache_2.7.7/tests/regression/server_root/conf/httpd.conf.in0000664000175000017500000000244212253711345027057 0ustar zimmerlezimmerle### Base configuration for starting Apache httpd # File locations PidFile @MSC_REGRESSION_LOGS_DIR@/httpd.pid ScoreBoardFile @MSC_REGRESSION_LOGS_DIR@/httpd.scoreboard LoadModule proxy_module @APXS_LIBEXECDIR@/mod_proxy.so LoadModule proxy_http_module @APXS_LIBEXECDIR@/mod_proxy_http.so LoadModule unique_id_module @APXS_LIBEXECDIR@/mod_unique_id.so # TODO: Need to have these configurable LoadModule security2_module @MSC_BASE_DIR@/apache2/.libs/mod_security2.so ServerName localhost CoreDumpDirectory @MSC_REGRESSION_SERVERROOT_DIR@/tmp LogLevel debug ErrorLog @MSC_REGRESSION_LOGS_DIR@/error.log = 2.4> LoadModule access_compat_module /usr/lib/apache2/modules/mod_access_compat.so LoadModule mpm_worker_module /usr/lib/apache2/modules/mod_mpm_worker.so DocumentRoot @MSC_REGRESSION_DOCROOT_DIR@ Options +Indexes +FollowSymLinks AllowOverride None = 2.4> Allow from all Satisfy Any Require all granted modsecurity-apache_2.7.7/tests/regression/server_root/conf/SoapEnvelope.xsd0000664000175000017500000001375312243422537027610 0ustar zimmerlezimmerle Prose in the spec does not specify that attributes are allowed on the Body element 'encodingStyle' indicates any canonicalization conventions followed in the contents of the containing element. For example, the value 'http://schemas.xmlsoap.org/soap/encoding/' indicates the pattern described in SOAP specification Fault reporting structure modsecurity-apache_2.7.7/tests/regression/server_root/conf/SoapEnvelope-bad.xsd0000664000175000017500000001375212243422537030333 0ustar zimmerlezimmerle Prose in the spec does not specify that attributes are allowed on the Body element 'encodingStyle' indicates any canonicalization conventions followed in the contents of the containing element. For example, the value 'http://schemas.xmlsoap.org/soap/encoding/' indicates the pattern described in SOAP specification Fault reporting structure modsecurity-apache_2.7.7/tests/regression/server_root/conf/SoapEnvelope.dtd0000664000175000017500000000032212243422537027551 0ustar zimmerlezimmerle modsecurity-apache_2.7.7/tests/regression/server_root/tmp/0000775000175000017500000000000012252136451024327 5ustar zimmerlezimmerlemodsecurity-apache_2.7.7/tests/regression/server_root/tmp/.empty0000664000175000017500000000000012243422537025457 0ustar zimmerlezimmerlemodsecurity-apache_2.7.7/tests/regression/server_root/htdocs/0000775000175000017500000000000012243422537025016 5ustar zimmerlezimmerlemodsecurity-apache_2.7.7/tests/regression/server_root/htdocs/index.html0000664000175000017500000000000612243422537027007 0ustar zimmerlezimmerleINDEX modsecurity-apache_2.7.7/tests/regression/server_root/htdocs/test.pdf0000664000175000017500000003605612243422537026502 0ustar zimmerlezimmerle%PDF-1.4 %äüöß 2 0 obj <> stream x=L 0 )r:lm7(mP d0ojEBGUqP\xJ ctu> stream x|{\\9{.go%LH , %k [jZ/5nZAެjVjkަmj91myf晙g9Dl4Th(;dqº _?с[7ɿ8>04ֿ5BBY}`W; !50ƢA03&Pv '*l(P:BP憃WEwkP p ?ռ6|H<ч)^"X(!p P )3H, JoX,&NdD(.)gV>oE-lGP @t4ZB݉( Q#z91hb@1{tP3z`&EYȟfQR]t a}i\ހ7#u= .C[OSԃu ўV=~[oȟDCS/(#} }8DӌmDG(_Do \RP0+f~J7ZЭ~+q%>+›(| c(.ťL6 FhCG ܌;4~}P\2SLSHPj`h`&DfQB\v:Xa::^>.s-+)H YP5mF@>~?a@gRlR{AKh a阃UTx]x d$M/-S50R2üv i}8{aECL#\0/3o7Do99OR{l9a= R3 ǿ''4VJmc;/w?a.ŇWRͩyPk Eኡkuh vtuG/_ߢA[0> Vw# 1!~?&c,bf3ם u}qcb!HBWEKB#{u{{|a殙fژȋ|~z,)#ݿ3X ovh/+Z/k\fµ / VUzk{?1~?2` d b+m`3-:\Q&l =a2Av.<"FjEEE/^!Dl7% -{$Kޗ|*H[=kIS2'Dú\%/8Sto@bboc!gXavkvlodckװ‡wDz|]1иH/^>B̯P O3?dgO=jw1 Nt@W ~΄]T!A_^|Cg|DU"s%LJ ftoCQUO)#x5m%5g*P3zʜa6HNC]3'4p'S1 ɫ  x^~*ZXaհ'©Qn]^ԕ?u@S@ݞDf-G{!n@oA9ZFaz]z8e 4 zP*3@ݒjUVwQ ۬Ŝg223tZMZTeRX2y˺d~wRo_K TUt'9Z&uS2n!e(/ 9JjQ5ٹ|y;6;iՀ[Ёk2 6rI5%mV* !׃+*KfۣqL&0dj`*kolJ IK^hZ;$n$}iR$N4$t.LVr={nҢn=;n1})" khy~dsg\[$1sYe0- ў7„YYtorR-ݠ=In:8:r=mvkh6g=Ǝ-^am:/iQ#6Qr5+&W9$^8iÚIF{z >z%@᤼{굤Rڹ=!п kBĩXɜA,tEE@ Qq -Wz=ۧ= Vmo ($/o1N@#t2>2׽v'esmVF`Mg}Nsoo^oo|s;״[msۂ^=&`o'ENJ;޺ep p51c, I]E9%20`ZeIm >PXdҋf kJָ/(/`OELs={ ږAڳg[{Op*5c=Gv}O{VSc{et"qu1\pg,Ek3ipn2'X4| )yD|B$[~\{vlspXӭNH0숟r1N `K`K;6Bgx+5oYVlXm|DQj6o`MQh֮[ SlZg,W+1W;iV2Vԅf 3[U9 :ń,1ԆJ4uVJvn.0V6D 3a>϶}(,1juc:V4Qd߉c,K)++e ʹ`VЅE.6~gK͹&WFjXq 8UqDR_RV({r/_L__wyO=}~ zvy+ fO/,|Pe٤\LXw\l#ggGۆljiSpm/.ZSթg~rǖUjWoy7w7+r[ntDӶ{5inhe4< ]lD=n",GO)X[, Ujuu"ixk Γ)Ҥ͊ʕU 5+/ۤP(AqRӖu}cce娢Wx RO hhԪZULnlJFPo1t"ذhijZ(2BO qt7n'*WTO@N(3͏s) 88q'v>4QIf`@l,Ji~N*Z)>#ŭR,mX02|1p 7dk䯏;as<{T6N.ß&8zQ5#2Fbq6FRs(=/Ätڄmb U*8\Yԙ&fFRk"ABآ"1pmtPx;(D),7:9Si*K\CE%iN0U*+ C.ო;%R~g} lٳ mZT'W$P,ձ貮/ _p:g>S,NzbNѪ|qcs񪍎6WV8QhYqgJյw5ށ;ks<] S+zG:~^] S?}q񬩜s\ܢjQwP``\$x6L-a,QU<ewֳP%< |y<&a,x< mF2c:D IFna_γΝN#}[B)N/r q>\+A#_/wY}E_{ Eͼw;zz˻zAkVxE>y":u]&Q&c9.CgN7|p&?+`[3+VU, VWa3lBrT.S+%[$7ho{9dx25M[ڳ xL+ʺݲ(8nsҟhHU",UcHf۰HY.o1m&؝?[o)dOʓ3`N*2e'IOHN:!=(MJEҝLT'f..PH7*¢ԉL?D$,EJFltK/ɲ\F& GvebffplBƔޑZY@K%e'e٣izM7$-֚Ƣ4mƞIi93on:km[~'d!h6; KoiH"qOofi4?!AauЀD>4$ERLi^@FvE_goJ KrZ zm?K95 ݂!lbLeN+۲I}}7oks7GڜEgH^]hM:pnzk"rGMeoԐ0&L׸c9~m-$@sŮpA7S\S_ŏOofx ןS璥Y2 [R]c1vy\u;cKE,=#t(W[ȍsWWW|8Ki `&>/8w{ nZzFKv;א{|f;@aWgLl//$9Ei'5rVC+Zj/bd,XN-Dp`WZ˲ [5.4)yIir]+nh+oe83:n8Ֆ;Dɫ:\ Чc,dE/4*n~UKxv{{2_0VfHeYߜe3I,FdI-F՞mͱLhL-:tZ+tbJsvvk6[و*!7>MJ=׬kfi#Cnو9Isun+_(HNkkk9otd@| ˞{칙_>.qg5<=3uDŽlgo nx UξEr\,fqs&OD(QqTKK6.ɤ y#TS8?yc&2 )%YVb̷Bal/#ŸW΂|&+[Vv= 1*,) F EE[8J͓; cd)S{b?yvsC=7!H .n1Ü mWBi}CMW+8OIc%mzf6sjTrl Ng)w5;3wuZb߂8/d/_?mdU+rndoT&] Ʉ>}I\+J.7c=anOS,`sÙݭp.)*ԥK@[Z؈#;|bN:_nŐJ>XG°{ӇYʯNz);`B 5@]e?.g7\M,QZl@W_&dÿp)zpg^p9+٫\b y jkF:s|njH9-aXO Z0K3?|/ 5~jچ)[p?'Da5A9'Lh¨C$N@sSI .oCڱHKvP ᥶< A͘ ]5)}sh5]rAڋˬqw/ 1*=/Ym8Ք>AG#Tq3HǍѕ kAy텔5A:Vxh&h=TW0De^jw!׈ϳ!5L#!K%z7OT2y1mV"oܼeqT?}R Q|- 1zyD|;=/a^F##su$Ҩ (^7B_}g[v}uL;6s6wr|_Rj9]G풗ÈJ>}޺GF9[XdŕVGLx/f>FQΆh8]`uTAaޘT pK:Ø *KH`jJC,e~  % Q]ّ4GG:[@G%ի C1Ȁ\>5[O:Ŕ~F/4A#ዔ⨋{cs{owPM/i_g@-e4z&Y)9,-mCjp~3[?8/D)En=e޶f9{wΟ GY~x75"\[a6ۅCwXعydfd;Rx^ yOb" ->H?:1z;/JK>k9,( sSJ!.>7a3! (lX"9gyI裒c~ͻOQsKjF1xeSl;OZ=J%N[|$/ޫ} mVt>VҵVs{![ R\>?2Y_;;8hv<'C~p_zů !Y/uy)v^#sv=#'}r₻AmBΠjK.dj(KZ* !hE(3ζ_ m,osm!nMd$*!FbD82Ez}\c0o`(s+G__Ⅴ q8.Ŷá86[ c\ 5C8W]ƹք{cx?Qx|2-u hbp0:Xh Ob>.<%tz55\K qxh F Eb  aP[ ƀX8pýH[F px!,{B\bVX<PP,_8qudV4v {ps}xx`$㸕 nj=жQah FC\d$D# Ź0 C572hX@x$8s;@X0 .B0z"z. (`n}< :BXdt`…JF!Xdhh,BXm m'AYV"Y}L4YG Ka\`$G{@4'=[Ch(1:IAa^`c\d'@Xhpo FɈ7@744D<6 '`'H,x כ}!PhHdk24^ yPHC% ǣC1o{(hMq;| }`:Ń6yp+AT##d!bږV6ԷlY˵,VlhZ_iM6B30V1_e°d1(NCod0 7@,"qm0ʊ$ afH$˅y%XNDB%$ba0s L̉b3An{ph`<J6Gͮ$DB0 z`"]9R$6>@ďctO-%05 N_|L&G+#; @ d0$q Z8#^.N F)q|02  mÆBl'tnnL/?cuŇ,u &j+ joIEI\*KJK+* *U+j?uFR*أ~7zIn MVc A>ٶه};kaY8Qإ+^\zr bҋK/V.XbҋK/V.XbҋK/V.Xʂ Xۻ -x.Ÿ/>yeYT*j-] $QR!_ NYDbt#<.9JYa|w45 wh>*, gw`@;YFҥGyީWo?0;`gL*0{-`, [`P}#q%h)pJ0N/~鐅}}RhyHZz"!=p E؇.}R @1@ aɿCZ  BmP#dw"={;h-s!&ԛ!$? M,]H-WvvKA6>ih ؝ ;!0e9kNuHvNANNNN$kfii5@s \4׀TJ8'_eT  8ȝ'!8Aot );@nvˤF6p({Q#9yeΗ b Іhk\EjCGr֧ ʄP b{'ŖcZ4,C4.fKK,*iĺlj!0IE@PhU|\j圼Dve-l1[Ƕ]|/UZSN\RS>k3?1ǓSz=>WHoB ?joM^G_7MFGCIOzg fY;&=!}3پI'apdm>T Ch{!f\#A4!Sa^ YlGt:ˤ.2&dLiXCW#e`S>M>š,{ַ eiSxe3%)?i9 BN-<|N[C+@r}eʓ<60x#4wxXV,sNahdz ב,#H*9LQfij6 i@۟m(XN9 9bb4N>&ӹG 6 ^ 't/U @z F2c[vz `?Mkd]^ÒoOol[F孶#n _|I$ND܉ۍ /{D hmt%a] endstream endobj 6 0 obj 13186 endobj 7 0 obj <> endobj 8 0 obj <> stream x]n <b"::?1:3p$·/\mspH(Wy R ^,(I3*$w w>u$ۮQ.KJ7g{x ɋ`n}.|QF  4!jp1~/|ԟs> endobj 10 0 obj <> endobj 11 0 obj <> endobj 1 0 obj <>/Contents 2 0 R>> endobj 4 0 obj <> endobj 12 0 obj <> endobj 13 0 obj < /Producer /CreationDate(D:20081006142251-07'00')>> endobj xref 0 14 0000000000 65535 f 0000014396 00000 n 0000000019 00000 n 0000000224 00000 n 0000014539 00000 n 0000000244 00000 n 0000013515 00000 n 0000013537 00000 n 0000013735 00000 n 0000014091 00000 n 0000014309 00000 n 0000014341 00000 n 0000014638 00000 n 0000014735 00000 n trailer < <9DF444F8B9A94D3A8214330AA876A2A6> ] /DocChecksum /046AAD787AFCAEA02E1D68CA0DC6D18F >> startxref 14922 %%EOF modsecurity-apache_2.7.7/tests/regression/server_root/htdocs/test.txt0000664000175000017500000000000512243422537026531 0ustar zimmerlezimmerleTEST modsecurity-apache_2.7.7/tests/regression/server_root/htdocs/test2.txt0000664000175000017500000000000712243422537026615 0ustar zimmerlezimmerleTEST 2 modsecurity-apache_2.7.7/tests/regression/server_root/htdocs/8k.txt0000664000175000017500000002000012243422537026071 0ustar zimmerlezimmerlemodsecurity-apache_2.7.7/tests/regression/server_root/data/0000775000175000017500000000000012252643564024450 5ustar zimmerlezimmerlemodsecurity-apache_2.7.7/tests/regression/server_root/data/ip.dir0000664000175000017500000000000012243422537025541 0ustar zimmerlezimmerlemodsecurity-apache_2.7.7/tests/regression/server_root/data/.empty0000664000175000017500000000000012243422537025570 0ustar zimmerlezimmerlemodsecurity-apache_2.7.7/tests/regression/nginx/0000775000175000017500000000000012243422537022304 5ustar zimmerlezimmerlemodsecurity-apache_2.7.7/tests/regression/nginx/conf/0000775000175000017500000000000012243422537023231 5ustar zimmerlezimmerlemodsecurity-apache_2.7.7/tests/regression/nginx/conf/empty.conf0000664000175000017500000000000012243422537025224 0ustar zimmerlezimmerlemodsecurity-apache_2.7.7/tests/regression/nginx/conf/nginx.conf.template0000664000175000017500000000042512243422537027036 0ustar zimmerlezimmerle user root; worker_processes 1; daemon on; error_log logs/error.log debug; events { worker_connections 1024; } http { ModSecurityEnabled [% enable %]; ModSecurityConfig [% config %]; server { listen [% listen %]; server_name localhost; location / { } } } modsecurity-apache_2.7.7/tests/regression/target/0000775000175000017500000000000012243422537022447 5ustar zimmerlezimmerlemodsecurity-apache_2.7.7/tests/regression/target/00-targets.t0000664000175000017500000004213212243422537024524 0ustar zimmerlezimmerle### Test basic targets # ARGS { type => "target", comment => "ARGS (get)", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRule ARGS "val1" "phase:2,log,pass,id:500189" SecRule ARGS "val2" "phase:2,log,pass,id:500190" ), match_log => { error => [ qr/Pattern match "val1" at ARGS.*Pattern match "val2" at ARGS/s, 1 ], debug => [ qr/Adding request argument \(QUERY_STRING\): name "arg1", value "val1".*Adding request argument \(QUERY_STRING\): name "arg2", value "val2"/s, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt?arg1=val1&arg2=val2", ), }, { type => "target", comment => "ARGS (post)", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRule ARGS "val1" "phase:2,log,pass,id:500191" SecRule ARGS "val2" "phase:2,log,pass,id:500192" ), match_log => { error => [ qr/Pattern match "val1" at ARGS.*Pattern match "val2" at ARGS/s, 1 ], debug => [ qr/Adding request argument \(BODY\): name "arg1", value "val1".*Adding request argument \(BODY\): name "arg2", value "val2"/s, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "application/x-www-form-urlencoded", ], "arg1=val1&arg2=val2", ), }, # ARGS_COMBINED_SIZE { type => "target", comment => "ARGS_COMBINED_SIZE (get)", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecRule ARGS_COMBINED_SIZE "\@eq 16" "phase:2,log,pass,id:500193" ), match_log => { error => [ qr/Operator EQ matched 16 at ARGS_COMBINED_SIZE\./s, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt?arg1=val1&arg2=val2", ), }, { type => "target", comment => "ARGS_COMBINED_SIZE (post)", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecRule ARGS_COMBINED_SIZE "\@eq 16" "phase:2,log,pass,id:500194" ), match_log => { error => [ qr/Operator EQ matched 16 at ARGS_COMBINED_SIZE\./s, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "application/x-www-form-urlencoded", ], "arg1=val1&arg2=val2", ), }, # ARGS_NAMES { type => "target", comment => "ARGS_NAMES (get)", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRule ARGS_NAMES "arg1" "phase:2,log,pass,id:500195" SecRule ARGS_NAMES "arg2" "phase:2,log,pass,id:500196" ), match_log => { error => [ qr/Pattern match "arg1" at ARGS.*Pattern match "arg2" at ARGS/s, 1 ], debug => [ qr/Adding request argument \(QUERY_STRING\): name "arg1", value "val1".*Adding request argument \(QUERY_STRING\): name "arg2", value "val2"/s, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt?arg1=val1&arg2=val2", ), }, { type => "target", comment => "ARGS_NAMES (post)", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRule ARGS_NAMES "arg1" "phase:2,log,pass,id:500197" SecRule ARGS_NAMES "arg2" "phase:2,log,pass,id:500198" ), match_log => { error => [ qr/Pattern match "arg1" at ARGS_NAMES.*Pattern match "arg2" at ARGS_NAMES/s, 1 ], debug => [ qr/Adding request argument \(BODY\): name "arg1", value "val1".*Adding request argument \(BODY\): name "arg2", value "val2"/s, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "application/x-www-form-urlencoded", ], "arg1=val1&arg2=val2", ), }, # ARGS_GET { type => "target", comment => "ARGS_GET (get)", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRule ARGS_GET "val1" "phase:2,log,pass,id:500199" SecRule ARGS_GET "val2" "phase:2,log,pass,id:500200" ), match_log => { error => [ qr/Pattern match "val1" at ARGS_GET.*Pattern match "val2" at ARGS_GET/s, 1 ], debug => [ qr/Adding request argument \(QUERY_STRING\): name "arg1", value "val1".*Adding request argument \(QUERY_STRING\): name "arg2", value "val2"/s, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt?arg1=val1&arg2=val2", ), }, { type => "target", comment => "ARGS_GET (post)", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRule ARGS_GET "val1" "phase:2,log,pass,id:500201" SecRule ARGS_GET "val2" "phase:2,log,pass,id:500202" ), match_log => { -error => [ qr/Pattern match/, 1 ], debug => [ qr/Adding request argument \(BODY\): name "arg1", value "val1".*Adding request argument \(BODY\): name "arg2", value "val2"/s, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "application/x-www-form-urlencoded", ], "arg1=val1&arg2=val2", ), }, # ARGS_GET_NAMES { type => "target", comment => "ARGS_GET_NAMES (get)", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRule ARGS_GET_NAMES "arg1" "phase:2,log,pass,id:500203" SecRule ARGS_GET_NAMES "arg2" "phase:2,log,pass,id:500204" ), match_log => { error => [ qr/Pattern match "arg1" at ARGS_GET.*Pattern match "arg2" at ARGS_GET/s, 1 ], debug => [ qr/Adding request argument \(QUERY_STRING\): name "arg1", value "val1".*Adding request argument \(QUERY_STRING\): name "arg2", value "val2"/s, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt?arg1=val1&arg2=val2", ), }, { type => "target", comment => "ARGS_GET_NAMES (post)", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRule ARGS_GET_NAMES "arg1" "phase:2,log,pass,id:500205" SecRule ARGS_GET_NAMES "arg2" "phase:2,log,pass,id:500206" ), match_log => { -error => [ qr/Pattern match/, 1 ], debug => [ qr/Adding request argument \(BODY\): name "arg1", value "val1".*Adding request argument \(BODY\): name "arg2", value "val2"/s, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "application/x-www-form-urlencoded", ], "arg1=val1&arg2=val2", ), }, # ARGS_POST { type => "target", comment => "ARGS_POST (get)", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRule ARGS_POST "val1" "phase:2,log,pass,id:500207" SecRule ARGS_POST "val2" "phase:2,log,pass,id:500208" ), match_log => { -error => [ qr/Pattern match/, 1 ], debug => [ qr/Adding request argument \(QUERY_STRING\): name "arg1", value "val1".*Adding request argument \(QUERY_STRING\): name "arg2", value "val2"/s, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt?arg1=val1&arg2=val2", ), }, { type => "target", comment => "ARGS_POST (post)", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRule ARGS_POST "val1" "phase:2,log,pass,id:500209" SecRule ARGS_POST "val2" "phase:2,log,pass,id:500210" ), match_log => { error => [ qr/Pattern match "val1" at ARGS_POST.*Pattern match "val2" at ARGS_POST/s, 1 ], debug => [ qr/Adding request argument \(BODY\): name "arg1", value "val1".*Adding request argument \(BODY\): name "arg2", value "val2"/s, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "application/x-www-form-urlencoded", ], "arg1=val1&arg2=val2", ), }, # ARGS_POST_NAMES { type => "target", comment => "ARGS_POST_NAMES (get)", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRule ARGS_POST_NAMES "arg1" "phase:2,log,pass,id:500211" SecRule ARGS_POST_NAMES "arg2" "phase:2,log,pass,id:500212" ), match_log => { -error => [ qr/Pattern match/, 1 ], debug => [ qr/Adding request argument \(QUERY_STRING\): name "arg1", value "val1".*Adding request argument \(QUERY_STRING\): name "arg2", value "val2"/s, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt?arg1=val1&arg2=val2", ), }, { type => "target", comment => "ARGS_POST_NAMES (post)", conf => qq( SecRuleEngine On SecRequestBodyAccess On SecResponseBodyAccess On SecResponseBodyMimeType null SecDebugLog $ENV{DEBUG_LOG} SecDebugLogLevel 9 SecRule ARGS_POST_NAMES "arg1" "phase:2,log,pass,id:500213" SecRule ARGS_POST_NAMES "arg2" "phase:2,log,pass,id:500214" ), match_log => { error => [ qr/Pattern match "arg1" at ARGS_POST.*Pattern match "arg2" at ARGS_POST/s, 1 ], debug => [ qr/Adding request argument \(BODY\): name "arg1", value "val1".*Adding request argument \(BODY\): name "arg2", value "val2"/s, 1 ], }, match_response => { status => qr/^200$/, }, request => new HTTP::Request( POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", [ "Content-Type" => "application/x-www-form-urlencoded", ], "arg1=val1&arg2=val2", ), }, # AUTH_TYPE #{ # type => "target", # comment => "AUTH_TYPE", # conf => qq( # = 2.2> # # LoadModule authn_file_module modules/mod_authn_file.so # # ## ## ## LoadModule auth_module modules/mod_auth.so ## ## # # AuthType Basic # AuthName Test # AuthUserFile "$ENV{CONF_DIR}/htpasswd" # Require user nobody # # SecRuleEngine On # SecRequestBodyAccess On # SecResponseBodyAccess On # SecResponseBodyMimeType null ## SecDebugLog $ENV{DEBUG_LOG} ## SecDebugLogLevel 9 # SecRule REQUEST_HEADERS:Authorization "Basic (.*)" "phase:2,log,pass,capture,chain" # SecRule TX:1 "nobody:test" "t:none,t:base64Decode,chain" # SecRule AUTH_TYPE "Basic" # ), # match_log => { # error => [ qr/Pattern match "Basic" at AUTH_TYPE/s, 1 ], # }, # match_response => { # status => qr/^200$/, # }, # request => new HTTP::Request( # GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", # [ # "Authorization" => "Basic bm9ib2R5OnRlc3Q=" # ], # ), #}, ## ENH: We cannot include this test as we cannot distribute the database. ## Instead we should create a simple test DB of our own. ## GEO #{ # type => "target", # comment => "GEO (ip)", # conf => qq( # SecRuleEngine On # SecDebugLog $ENV{DEBUG_LOG} # SecDebugLogLevel 9 # SecGeoLookupDB GeoLiteCity.dat # SecRule ARGS:ip "\@geoLookup" "phase:2,log,pass,t:none" # SecRule GEO:COUNTRY_CODE "\@streq US" "phase:2,log,pass,t:none" # SecRule GEO:COUNTRY_CODE3 "\@streq USA" "phase:2,log,pass,t:none" # SecRule GEO:COUNTRY_NAME "\@streq United States" "phase:2,log,pass,t:none" # # ENH: Not in this database? # SecRule GEO:COUNTRY_CONTINENT "\@streq NA" "phase:2,log,pass,t:none" # SecRule GEO:REGION "\@streq CA" "phase:2,log,pass,t:none" # SecRule GEO:CITY "\@streq San Diego" "phase:2,log,pass,t:none" # SecRule GEO:POSTAL_CODE "\@streq 92123" "phase:2,log,pass,t:none" # SecRule GEO:LATITUDE "\@beginsWith 32.8" "phase:2,log,pass,t:none" # SecRule GEO:LONGITUDE "\@beginsWith 117.1" "phase:2,log,pass,t:none" # SecRule GEO:DMA_CODE "\@streq 825" "phase:2,log,pass,t:none" # SecRule GEO:AREA_CODE "\@streq 858" "phase:2,log,pass,t:none" # ), # match_log => { # debug => [ qr/Geo lookup for "216.75.21.122" succeeded.*match "US" at GEO:COUNTRY_CODE.*match "USA" at GEO:COUNTRY_CODE3.*match "United States" at GEO:COUNTRY_NAME.*match "NA" at GEO:COUNTRY_CONTINENT.*match "CA" at GEO:REGION.*match "San Diego" at GEO:CITY.*match "92123" at GEO:POSTAL_CODE.*match "32.8" at GEO:LATITUDE.*match "825" at GEO:DMA_CODE.*match "858" at GEO:AREA_CODE/si, 1 ], # }, # match_response => { # status => qr/^200$/, # }, # request => new HTTP::Request( # GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt?ip=216.75.21.122", # ), #}, #{ # type => "target", # comment => "GEO (host)", # conf => qq( # SecRuleEngine On # SecDebugLog $ENV{DEBUG_LOG} # SecDebugLogLevel 9 # SecGeoLookupDB GeoLiteCity.dat # SecRule ARGS:host "\@geoLookup" "phase:2,log,pass,t:none" # SecRule GEO:COUNTRY_CODE "\@streq US" "phase:2,log,pass,t:none" # SecRule GEO:COUNTRY_CODE3 "\@streq USA" "phase:2,log,pass,t:none" # SecRule GEO:COUNTRY_NAME "\@streq United States" "phase:2,log,pass,t:none" # # ENH: Not in this database? # SecRule GEO:COUNTRY_CONTINENT "\@streq NA" "phase:2,log,pass,t:none" # SecRule GEO:REGION "\@streq CA" "phase:2,log,pass,t:none" # SecRule GEO:CITY "\@streq San Diego" "phase:2,log,pass,t:none" # SecRule GEO:POSTAL_CODE "\@streq 92123" "phase:2,log,pass,t:none" # SecRule GEO:LATITUDE "\@beginsWith 32.8" "phase:2,log,pass,t:none" # SecRule GEO:LONGITUDE "\@beginsWith 117.1" "phase:2,log,pass,t:none" # SecRule GEO:DMA_CODE "\@streq 825" "phase:2,log,pass,t:none" # SecRule GEO:AREA_CODE "\@streq 858" "phase:2,log,pass,t:none" # ), # match_log => { # debug => [ qr/Using address "\d+\.\d+\.\d+\.\d+".*Geo lookup for "www\.modsecurity\.org" succeeded.*match "US" at GEO:COUNTRY_CODE.*match "USA" at GEO:COUNTRY_CODE3.*match "United States" at GEO:COUNTRY_NAME.*match "NA" at GEO:COUNTRY_CONTINENT.*match "CA" at GEO:REGION.*match "San Diego" at GEO:CITY.*match "92123" at GEO:POSTAL_CODE.*match "32.8" at GEO:LATITUDE.*match "825" at GEO:DMA_CODE.*match "858" at GEO:AREA_CODE/si, 1 ], # }, # match_response => { # status => qr/^200$/, # }, # request => new HTTP::Request( # GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt?host=www.modsecurity.org", # ), #}, #{ # type => "target", # comment => "GEO (failed lookup)", # conf => qq( # SecRuleEngine On # SecDebugLog $ENV{DEBUG_LOG} # SecDebugLogLevel 9 # SecGeoLookupDB GeoLiteCity.dat # SecRule ARGS:ip "\@geoLookup" "phase:2,log,pass,t:none" # SecRule \&GEO "\@eq 0" "phase:2,log,deny,status:403,t:none" # SecRule ARGS:badip "\@geoLookup" "phase:2,log,pass,t:none" # SecRule \&GEO "!\@eq 0" "phase:2,log,deny,status:403,t:none" # ), # match_log => { # -debug => [ qr/Geo lookup for "127\.0\.0\.1" succeeded/si, 1 ], # }, # match_response => { # status => qr/^200$/, # }, # request => new HTTP::Request( # GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt?ip=216.75.21.122&badip=127.0.0.1", # ), #}, # TODO: ENV # TODO: FILES # TODO: FILES_COMBINED_SIZE # TODO: FILES_NAMES # TODO: FILES_SIZES # TODO: FILES_TMPNAMES # TODO: HIGHEST_SEVERITY # TODO: MATCHED_VAR # TODO: MATCHED_VAR_NAME # TODO: MODSEC_BUILD # TODO: MULTIPART_CRLF_LF_LINES # TODO: MULTIPART_STRICT_ERROR # TODO: MULTIPART_UNMATCHED_BOUNDARY # TODO: PATH_INFO # TODO: QUERY_STRING # TODO: REMOTE_ADDR # TODO: REMOTE_HOST # TODO: REMOTE_PORT # TODO: REMOTE_USER # TODO: REQBODY_PROCESSOR # TODO: REQBODY_PROCESSOR_ERROR # TODO: REQBODY_PROCESSOR_ERROR_MSG # TODO: REQUEST_BASENAME # TODO: REQUEST_BODY # TODO: REQUEST_COOKIES # TODO: REQUEST_COOKIES_NAMES # TODO: REQUEST_FILENAME # TODO: REQUEST_HEADERS # TODO: REQUEST_HEADERS_NAMES # TODO: REQUEST_LINE # TODO: REQUEST_METHOD # TODO: REQUEST_PROTOCOL # TODO: REQUEST_URI # TODO: REQUEST_URI_RAW # TODO: RESPONSE_BODY # TODO: RESPONSE_CONTENT_LENGTH # TODO: RESPONSE_CONTENT_TYPE # TODO: RESPONSE_HEADERS # TODO: RESPONSE_HEADERS_NAMES # TODO: RESPONSE_PROTOCOL # TODO: RESPONSE_STATUS # TODO: RULE # TODO: SCRIPT_BASENAME # TODO: SCRIPT_FILENAME # TODO: SCRIPT_GID # TODO: SCRIPT_GROUPNAME # TODO: SCRIPT_MODE # TODO: SCRIPT_UID # TODO: SCRIPT_USERNAME # TODO: SERVER_ADDR # TODO: SERVER_NAME # TODO: SERVER_PORT # TODO: SESSION # TODO: SESSIONID # TODO: TIME # TODO: TIME_DAY # TODO: TIME_EPOCH # TODO: TIME_HOUR # TODO: TIME_MIN # TODO: TIME_MON # TODO: TIME_SEC # TODO: TIME_WDAY # TODO: TIME_YEAR # TODO: TX # TODO: USERID # TODO: WEBAPPID # TODO: WEBSERVER_ERROR_LOG # TODO: XML modsecurity-apache_2.7.7/tests/tfn/0000775000175000017500000000000012243422537017570 5ustar zimmerlezimmerlemodsecurity-apache_2.7.7/tests/tfn/parityOdd7bit.t0000664000175000017500000000157612243422537022513 0ustar zimmerlezimmerle### Empty { type => "tfn", name => "parityOdd7bit", input => "", output => "", ret => 0, }, ### Nothing { type => "tfn", name => "parityOdd7bit", input => "abdghkmnpsuvyz12478CEFIJLOQRTW", output => "abdghkmnpsuvyz12478CEFIJLOQRTW", ret => 0, }, ### Parity { type => "tfn", name => "parityOdd7bit", input => "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", output => "ab\xe3d\xe5\xe6gh\xe9\xeak\xecmn\xefp\xf1\xf2s\xf4uv\xf7\xf8yz\xb012\xb34\xb5\xb678\xb9\xc1\xc2C\xc4EF\xc7\xc8IJ\xcbL\xcd\xceO\xd0QR\xd3T\xd5\xd6WX\xd9\xda", ret => 1, }, { type => "tfn", name => "parityOdd7bit", input => "abcdefghijklmnopqrstuvwxyz\x000123456789\x00ABCDEFGHIJKLMNOPQRSTUVWXYZ", output => "ab\xe3d\xe5\xe6gh\xe9\xeak\xecmn\xefp\xf1\xf2s\xf4uv\xf7\xf8yz\x80\xb012\xb34\xb5\xb678\xb9\x80\xc1\xc2C\xc4EF\xc7\xc8IJ\xcbL\xcd\xceO\xd0QR\xd3T\xd5\xd6WX\xd9\xda", ret => 1, }, modsecurity-apache_2.7.7/tests/tfn/trimRight.t0000664000175000017500000000176012243422537021732 0ustar zimmerlezimmerle### Empty { type => "tfn", name => "trimRight", input => "", output => "", ret => 0, }, ### Nothing { type => "tfn", name => "trimRight", input => "TestCase", output => "TestCase", ret => 0, }, { type => "tfn", name => "trimRight", input => "Test\0Case", output => "Test\0Case", ret => 0, }, { type => "tfn", name => "trimRight", input => " TestCase", output => " TestCase", ret => 0, }, ### Basics { type => "tfn", name => "trimRight", input => "TestCase ", output => "TestCase", ret => 1, }, { type => "tfn", name => "trimRight", input => " TestCase ", output => " TestCase", ret => 1, }, { type => "tfn", name => "trimRight", input => " Test Case ", output => " Test Case", ret => 1, }, { type => "tfn", name => "trimRight", input => " Test \0 Case ", output => " Test \0 Case", ret => 1, }, { type => "tfn", name => "trimRight", input => " Test \0 Case \r\n ", output => " Test \0 Case", ret => 1, }, modsecurity-apache_2.7.7/tests/tfn/jsDecode.t0000664000175000017500000000426012243422537021477 0ustar zimmerlezimmerle### Empty { type => "tfn", name => "jsDecode", input => "", output => "", ret => 0, }, ### Nothing { type => "tfn", name => "jsDecode", input => "TestCase", output => "TestCase", ret => 0, }, { type => "tfn", name => "jsDecode", input => "Test\0Case", output => "Test\0Case", ret => 0, }, ### Valid Sequences { type => "tfn", name => "jsDecode", input => "\\a\\b\\f\\n\\r\\t\\v\\?\\'\\\"\\0\\12\\123\\x00\\xff\\u0021\\uff01", output => "\a\b\f\x0a\x0d\t\x0b?'\"\x00\x0a\x53\x00\xff\x21\x21", ret => 1, }, { type => "tfn", name => "jsDecode", input => "\\a\\b\\f\\n\\r\\t\\v\0\\?\\'\\\"\\0\\12\\123\\x00\\xff\\u0021\\uff01", output => "\a\b\f\x0a\x0d\t\x0b\0?'\"\x00\x0a\x53\x00\xff\x21\x21", ret => 1, }, ### Invalid Sequences # \8 and \9 are not octal # \666 is \66 + '6' (JS does not allow the overflow as C does) # \u00ag, \u00ga, \u0zaa, \uz0aa are not hex # \xag and \xga are not hex, # \0123 is \012 + '3' { type => "tfn", name => "jsDecode", input => "\\8\\9\\666\\u00ag\\u00ga\\u0zaa\\uz0aa\\xag\\xga\\0123\\u00a", output => "89\x366u00agu00gau0zaauz0aaxagxga\x0a3u00a", ret => 1, }, # \x, \x0 lack enough hex digits { type => "tfn", name => "jsDecode", input => "\\x", output => "x", ret => 1, }, { type => "tfn", name => "jsDecode", input => "\\x\\x0", output => "xx0", ret => 1, }, { type => "tfn", name => "jsDecode", input => "\\x\\x0\0", output => "xx0\0", ret => 1, }, # \u, \u0 \u01, \u012 lack enough hex digits { type => "tfn", name => "jsDecode", input => "\\u", output => "u", ret => 1, }, { type => "tfn", name => "jsDecode", input => "\\u\\u0", output => "uu0", ret => 1, }, { type => "tfn", name => "jsDecode", input => "\\u\\u0\\u01", output => "uu0u01", ret => 1, }, { type => "tfn", name => "jsDecode", input => "\\u\\u0\\u01\\u012", output => "uu0u01u012", ret => 1, }, { type => "tfn", name => "jsDecode", input => "\\u\\u0\\u01\\u012\0", output => "uu0u01u012\0", ret => 1, }, # A forward slash with nothing after { type => "tfn", name => "jsDecode", input => "\\", output => "\\", ret => 0, }, # A forward slash with NUL after { type => "tfn", name => "jsDecode", input => "\\\0", output => "\0", ret => 1, }, modsecurity-apache_2.7.7/tests/tfn/sha1.t0000664000175000017500000000105512243422537020612 0ustar zimmerlezimmerle### Empty { type => "tfn", name => "sha1", input => "", output => "\xda\x39\xa3\xee\x5e\x6b\x4b\x0d\x32\x55\xbf\xef\x95\x60\x18\x90\xaf\xd8\x07\x09", ret => 1, }, ### Basic { type => "tfn", name => "sha1", input => "TestCase", output => "\xa7\x0c\xe3\x83\x89\xe3\x18\xbd\x2b\xe1\x8a\x01\x11\xc6\xdc\x76\xbd\x2c\xd9\xed", ret => 1, }, ### Binary w/NUL { type => "tfn", name => "sha1", input => "\x00\x01\x02\x03\x04\x05\x06\x07\x08", output => "\x63\xbf\x60\xc7\x10\x5a\x07\xa2\xb1\x25\xbb\xf8\x9e\x61\xab\xda\xbc\x69\x78\xc2", ret => 1, }, modsecurity-apache_2.7.7/tests/tfn/cssDecode.t0000664000175000017500000000204612243422537021653 0ustar zimmerlezimmerle### Empty { type => "tfn", name => "cssDecode", input => "", output => "", ret => 0, }, ### Nothing { type => "tfn", name => "cssDecode", input => "TestCase", output => "TestCase", ret => 0, }, { type => "tfn", name => "cssDecode", input => "Test\0Case", output => "Test\0Case", ret => 0, }, ### Valid Sequences { type => "tfn", name => "cssDecode", input => "test\\a\\b\\f\\n\\r\\t\\v\\?\\'\\\"\\0\\12\\123\\1234\\12345\\123456\\ff01\\ff5e\\\n\\0 string", output => qq(test\x0a\x0b\x0fnrtv?'"\x00\x12\x23\x34\x45\x56\x21\x7e\x00 string), ret => 1, }, ### Invalid Sequences # Trailing escape == line continuation with no line following (ie nothing) { type => "tfn", name => "cssDecode", input => "test\\", output => "test", ret => 1, }, # Edge cases # "\1A" == "\x1A" # "\1 A" == "\x01A" # "\1234567" == "\x567" # "\123456 7" == "\x567" # "\1x" == "\x01x" # "\1 x" == "\x01 x" { type => "tfn", name => "cssDecode", input => "\\1A\\1 A\\1234567\\123456 7\\1x\\1 x", output => "\x1A\x01A\x567\x567\x01x\x01x", ret => 1, }, modsecurity-apache_2.7.7/tests/tfn/md5.t0000664000175000017500000000077212243422537020450 0ustar zimmerlezimmerle### Empty { type => "tfn", name => "md5", input => "", output => "\xd4\x1d\x8c\xd9\x8f\x00\xb2\x04\xe9\x80\x09\x98\xec\xf8\x42\x7e", ret => 1, }, ### Basic { type => "tfn", name => "md5", input => "TestCase", output => "\xc9\xab\xa2\xc3\xe6\x01\x26\x16\x9e\x80\xe9\xa2\x6b\xa2\x73\xc1", ret => 1, }, ### Binary w/NUL { type => "tfn", name => "md5", input => "\x00\x01\x02\x03\x04\x05\x06\x07\x08", output => "\xa6\xe7\xd3\xb4\x6f\xdf\xaf\x0b\xde\x2a\x1f\x83\x2a\x00\xd2\xde", ret => 1, }, modsecurity-apache_2.7.7/tests/tfn/trimLeft.t0000664000175000017500000000176112243422537021550 0ustar zimmerlezimmerle### Empty { type => "tfn", name => "trimLeft", input => "", output => "", ret => 0, }, ### Nothing { type => "tfn", name => "trimLeft", input => "TestCase", output => "TestCase", ret => 0, }, { type => "tfn", name => "trimLeft", input => "Test\0Case", output => "Test\0Case", ret => 0, }, { type => "tfn", name => "trimLeft", input => "TestCase ", output => "TestCase ", ret => 0, }, ### Basics { type => "tfn", name => "trimLeft", input => " TestCase", output => "TestCase", ret => 1, }, { type => "tfn", name => "trimLeft", input => " TestCase ", output => "TestCase ", ret => 1, }, { type => "tfn", name => "trimLeft", input => " Test Case ", output => "Test Case ", ret => 1, }, { type => "tfn", name => "trimLeft", input => " Test \0 Case ", output => "Test \0 Case ", ret => 1, }, { type => "tfn", name => "trimLeft", input => " Test \0 Case \r\n ", output => "Test \0 Case \r\n ", ret => 1, }, modsecurity-apache_2.7.7/tests/tfn/parityEven7bit.t0000664000175000017500000000160412243422537022672 0ustar zimmerlezimmerle### Empty { type => "tfn", name => "parityEven7bit", input => "", output => "", ret => 0, }, ### Nothing { type => "tfn", name => "parityEven7bit", input => "cefijloqrtwx03569ABDGHKMNPSUVYZ", output => "cefijloqrtwx03569ABDGHKMNPSUVYZ", ret => 0, }, ### Parity { type => "tfn", name => "parityEven7bit", input => "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", output => "\xe1\xe2c\xe4ef\xe7\xe8ij\xebl\xed\xeeo\xf0qr\xf3t\xf5\xf6wx\xf9\xfa0\xb1\xb23\xb456\xb7\xb89AB\xc3D\xc5\xc6GH\xc9\xcaK\xccMN\xcfP\xd1\xd2S\xd4UV\xd7\xd8YZ", ret => 1, }, { type => "tfn", name => "parityEven7bit", input => "abcdefghijklmnopqrstuvwxyz\x000123456789\x00ABCDEFGHIJKLMNOPQRSTUVWXYZ", output => "\xe1\xe2c\xe4ef\xe7\xe8ij\xebl\xed\xeeo\xf0qr\xf3t\xf5\xf6wx\xf9\xfa\x000\xb1\xb23\xb456\xb7\xb89\x00AB\xc3D\xc5\xc6GH\xc9\xcaK\xccMN\xcfP\xd1\xd2S\xd4UV\xd7\xd8YZ", ret => 1, }, modsecurity-apache_2.7.7/tests/tfn/htmlEntityDecode.t0000664000175000017500000000216412243422537023225 0ustar zimmerlezimmerle### Empty { type => "tfn", name => "htmlEntityDecode", input => "", output => "", ret => 0, }, ### Nothing { type => "tfn", name => "htmlEntityDecode", input => "TestCase", output => "TestCase", ret => 0, }, { type => "tfn", name => "htmlEntityDecode", input => "Test\0Case", output => "Test\0Case", ret => 0, }, ### Valid # With ; { type => "tfn", name => "htmlEntityDecode", input => "�� � \0d"&<> ", output => "\0\0\x20\x20\0\x20\0\x64\"&<>\xa0", ret => 1, }, # Without ; { type => "tfn", name => "htmlEntityDecode", input => "�� � \0d"&<> ", output => "\0\0\x20\x20\0\x20\0\x64\"&<>\xa0", ret => 1, }, ### Invalid { type => "tfn", name => "htmlEntityDecode", input => "&#xg;&#Xg;&#xg0;g;&#a;\0&#a2;a&#a00;a0; a;&foo;", output => "&#xg;&#Xg;&#xg0;\x02g;&#a;\0&#a2;\x03a&#a00;\x01a0;\x0aa;&foo;", ret => 1, }, { type => "tfn", name => "htmlEntityDecode", input => "&#xg&#Xg&#xg0g&#a\0&#a2a&#a00a0 a&foo", output => "&#xg&#Xg&#xg0\x02g&#a\0&#a2\x03a&#a00\x01a0\x0aa&foo", ret => 1, }, modsecurity-apache_2.7.7/tests/tfn/hexDecode.t0000664000175000017500000000141312243422537021644 0ustar zimmerlezimmerle### Empty { type => "tfn", name => "hexDecode", input => "", output => "", ret => 1, }, ### Basic { type => "tfn", name => "hexDecode", input => "5465737443617365", output => "TestCase", ret => 1, }, ### Basic w/NULL { type => "tfn", name => "hexDecode", input => "546573740043617365", output => "Test\0Case", ret => 1, }, ### Invalid # What should happen here? Probably just fail and leave alone. { type => "tfn", name => "hexDecode", input => "01234567890a0z01234567890a", output => "\x01#Eg\x89\x0a#\x01#Eg\x89\x0a", ret => 1, }, { type => "tfn", name => "hexDecode", input => "01234567890az", output => "\x01#Eg\x89\x0a", ret => 1, }, { type => "tfn", name => "hexDecode", input => "01234567890a0", output => "\x01#Eg\x89\x0a", ret => 1, }, modsecurity-apache_2.7.7/tests/tfn/normalisePathWin.t0000664000175000017500000000731112243422537023243 0ustar zimmerlezimmerle### Empty { type => "tfn", name => "normalisePathWin", input => "", output => "", ret => 0, }, ### Nothing but switch slashes { type => "tfn", name => "normalisePathWin", input => "\\foo\\bar\\baz", output => "/foo/bar/baz", ret => 1, }, { type => "tfn", name => "normalisePathWin", input => "\\foo\\bar\0\\baz", output => "/foo/bar\0/baz", ret => 1, }, ### Basics { type => "tfn", name => "normalisePathWin", input => "x", output => "x", ret => 0, }, { type => "tfn", name => "normalisePathWin", input => ".", output => "", ret => 1, }, { type => "tfn", name => "normalisePathWin", input => ".\\", output => "", ret => 1, }, { type => "tfn", name => "normalisePathWin", input => ".\\..", output => "..", ret => 1, }, { type => "tfn", name => "normalisePathWin", input => ".\\..\\", output => "../", ret => 1, }, { type => "tfn", name => "normalisePathWin", input => "..", output => "..", ret => 0, }, { type => "tfn", name => "normalisePathWin", input => "..\\", output => "../", ret => 1, }, { type => "tfn", name => "normalisePathWin", input => "..\\.", output => "..", ret => 1, }, { type => "tfn", name => "normalisePathWin", input => "..\\.\\", output => "../", ret => 1, }, { type => "tfn", name => "normalisePathWin", input => "..\\..", output => "../..", ret => 1, }, { type => "tfn", name => "normalisePathWin", input => "..\\..\\", output => "../../", ret => 1, }, { type => "tfn", name => "normalisePathWin", input => "\\dir\\foo\\\\bar", output => "/dir/foo/bar", ret => 1, }, { type => "tfn", name => "normalisePathWin", input => "dir\\foo\\\\bar\\", output => "dir/foo/bar/", ret => 1, }, { type => "tfn", name => "normalisePathWin", input => "dir\\..\\foo", output => "foo", ret => 1, }, { type => "tfn", name => "normalisePathWin", input => "dir\\..\\..\\foo", output => "../foo", ret => 1, }, { type => "tfn", name => "normalisePathWin", input => "dir\\.\\..\\.\\..\\..\\foo\\bar", output => "../../foo/bar", ret => 1, }, { type => "tfn", name => "normalisePathWin", input => "dir\\.\\..\\.\\..\\..\\foo\\bar\\.", output => "../../foo/bar", ret => 1, }, { type => "tfn", name => "normalisePathWin", input => "dir\\.\\..\\.\\..\\..\\foo\\bar\\.\\", output => "../../foo/bar/", ret => 1, }, { type => "tfn", name => "normalisePathWin", input => "dir\\.\\..\\.\\..\\..\\foo\\bar\\..", output => "../../foo", ret => 1, }, { type => "tfn", name => "normalisePathWin", input => "dir\\.\\..\\.\\..\\..\\foo\\bar\\..\\", output => "../../foo/", ret => 1, }, { type => "tfn", name => "normalisePathWin", input => "dir\\.\\..\\.\\..\\..\\foo\\bar\\", output => "../../foo/bar/", ret => 1, }, { type => "tfn", name => "normalisePathWin", input => "dir\\\\.\\\\..\\\\.\\\\..\\\\..\\\\foo\\\\bar", output => "../../foo/bar", ret => 1, }, { type => "tfn", name => "normalisePathWin", input => "dir\\\\.\\\\..\\\\.\\\\..\\\\..\\\\foo\\\\bar\\\\", output => "../../foo/bar/", ret => 1, }, { type => "tfn", name => "normalisePathWin", input => "dir\\subdir\\subsubdir\\subsubsubdir\\..\\..\\..", output => "dir", ret => 1, }, { type => "tfn", name => "normalisePathWin", input => "dir\\.\\subdir\\.\\subsubdir\\.\\subsubsubdir\\..\\..\\..", output => "dir", ret => 1, }, { type => "tfn", name => "normalisePathWin", input => "dir\\.\\subdir\\..\\subsubdir\\..\\subsubsubdir\\..", output => "dir", ret => 1, }, { type => "tfn", name => "normalisePathWin", input => "\\dir\\.\\subdir\\..\\subsubdir\\..\\subsubsubdir\\..\\", output => "/dir/", ret => 1, }, ### With NUL { type => "tfn", name => "normalisePathWin", input => "\\.\\..\\.\\..\\..\\..\\..\\..\\..\\..\\\0\\..\\etc\\.\\passwd", output => "/etc/passwd", ret => 1, }, modsecurity-apache_2.7.7/tests/tfn/replaceNulls.t0000664000175000017500000000136612243422537022414 0ustar zimmerlezimmerle### Empty { type => "tfn", name => "replaceNulls", input => "", output => "", ret => 0, }, ### Nothing { type => "tfn", name => "replaceNulls", input => "TestCase", output => "TestCase", ret => 0, }, ### Basics { type => "tfn", name => "replaceNulls", input => "\0TestCase", output => " TestCase", ret => 1, }, { type => "tfn", name => "replaceNulls", input => "Test\0Case", output => "Test Case", ret => 1, }, { type => "tfn", name => "replaceNulls", input => "Test\0\0Case", output => "Test Case", ret => 1, }, { type => "tfn", name => "replaceNulls", input => "TestCase\0", output => "TestCase ", ret => 1, }, { type => "tfn", name => "replaceNulls", input => "\0Test\0Case\0", output => " Test Case ", ret => 1, }, modsecurity-apache_2.7.7/tests/tfn/escapeSeqDecode.t0000664000175000017500000000360512243422537022776 0ustar zimmerlezimmerle### Empty { type => "tfn", name => "escapeSeqDecode", input => "", output => "", ret => 0, }, ### Nothing { type => "tfn", name => "escapeSeqDecode", input => "TestCase", output => "TestCase", ret => 0, }, { type => "tfn", name => "escapeSeqDecode", input => "Test\0Case", output => "Test\0Case", ret => 0, }, ### Valid Sequences { type => "tfn", name => "escapeSeqDecode", input => "\\a\\b\\f\\n\\r\\t\\v\\?\\'\\\"\\0\\12\\123\\x00\\xff", output => "\a\b\f\x0a\x0d\t\x0b?'\"\x00\x0a\x53\x00\xff", ret => 1, }, { type => "tfn", name => "escapeSeqDecode", input => "\\a\\b\\f\\n\\r\\t\\v\0\\?\\'\\\"\\0\\12\\123\\x00\\xff", output => "\a\b\f\x0a\x0d\t\x0b\0?'\"\x00\x0a\x53\x00\xff", ret => 1, }, ### Invalid Sequences # \8 and \9 are not octal # \666 is a byte overflow (0x1b6) and should be truncated to a byte as 0xb6 # \xag and \xga are not hex, # \0123 is \012 + '3' { type => "tfn", name => "escapeSeqDecode", input => "\\8\\9\\666\\xag\\xga\\0123", output => "89\xb6xagxga\x0a3", ret => 1, }, # \x, \x0 lack enough hex digits { type => "tfn", name => "escapeSeqDecode", input => "\\x", output => "x", ret => 1, }, { type => "tfn", name => "escapeSeqDecode", input => "\\x\\x0", output => "xx0", ret => 1, }, { type => "tfn", name => "escapeSeqDecode", input => "\\x\\x0\0", output => "xx0\0", ret => 1, }, # Octal at end { type => "tfn", name => "escapeSeqDecode", input => "\\0", output => "\x00", ret => 1, }, { type => "tfn", name => "escapeSeqDecode", input => "\\01", output => "\x01", ret => 1, }, { type => "tfn", name => "escapeSeqDecode", input => "\\012", output => "\x0a", ret => 1, }, # A forward slash with nothing after { type => "tfn", name => "escapeSeqDecode", input => "\\", output => "\\", ret => 0, }, # A forward slash with NUL after { type => "tfn", name => "escapeSeqDecode", input => "\\\0", output => "\0", ret => 1, }, modsecurity-apache_2.7.7/tests/tfn/hexEncode.t0000664000175000017500000000052412243422537021660 0ustar zimmerlezimmerle### Empty { type => "tfn", name => "hexEncode", input => "", output => "", ret => 1, }, ### Basic { type => "tfn", name => "hexEncode", input => "TestCase", output => "5465737443617365", ret => 1, }, ### Basic w/NULL { type => "tfn", name => "hexEncode", input => "Test\0Case", output => "546573740043617365", ret => 1, }, modsecurity-apache_2.7.7/tests/tfn/removeWhitespace.t0000664000175000017500000000145712243422537023276 0ustar zimmerlezimmerle### Empty { type => "tfn", name => "removeWhitespace", input => "", output => "", ret => 0, }, ### Nothing { type => "tfn", name => "removeWhitespace", input => "TestCase", output => "TestCase", ret => 0, }, { type => "tfn", name => "removeWhitespace", input => "Test\0Case", output => "Test\0Case", ret => 0, }, ### Remove space/tab { type => "tfn", name => "removeWhitespace", input => " Test \t Case ", output => "TestCase", ret => 1, }, ### Pretty much everything in one { type => "tfn", name => "removeWhitespace", input => "This is a test case with a tab \t, vtab \x0b, newline \x0a, return \x0d, formfeed \f, and a NUL\0 in it with a CRLF at the end.\x0d\x0a", output => "Thisisatestcasewithatab,vtab,newline,return,formfeed,andaNUL\0initwithaCRLFattheend.", ret => 1, }, modsecurity-apache_2.7.7/tests/tfn/removeNulls.t0000664000175000017500000000152412243422537022272 0ustar zimmerlezimmerle### Empty { type => "tfn", name => "removeNulls", input => "", output => "", ret => 0, }, ### Nothing { type => "tfn", name => "removeNulls", input => "TestCase", output => "TestCase", ret => 0, }, { type => "tfn", name => "removeNulls", input => "Test\x01Case", output => "Test\x01Case", ret => 0, }, ### Basics { type => "tfn", name => "removeNulls", input => "\0TestCase", output => "TestCase", ret => 1, }, { type => "tfn", name => "removeNulls", input => "Test\0Case", output => "TestCase", ret => 1, }, { type => "tfn", name => "removeNulls", input => "Test\0\0Case", output => "TestCase", ret => 1, }, { type => "tfn", name => "removeNulls", input => "TestCase\0", output => "TestCase", ret => 1, }, { type => "tfn", name => "removeNulls", input => "\0Test\0Case\0", output => "TestCase", ret => 1, }, modsecurity-apache_2.7.7/tests/tfn/normalisePath.t0000664000175000017500000000667512243422537022601 0ustar zimmerlezimmerle### Empty { type => "tfn", name => "normalisePath", input => "", output => "", ret => 0, }, ### Nothing { type => "tfn", name => "normalisePath", input => "/foo/bar/baz", output => "/foo/bar/baz", ret => 0, }, { type => "tfn", name => "normalisePath", input => "/foo/bar\0/baz", output => "/foo/bar\0/baz", ret => 0, }, ### Basic { type => "tfn", name => "normalisePath", input => "x", output => "x", ret => 0, }, { type => "tfn", name => "normalisePath", input => ".", output => "", ret => 1, }, { type => "tfn", name => "normalisePath", input => "./", output => "", ret => 1, }, { type => "tfn", name => "normalisePath", input => "./..", output => "..", ret => 1, }, { type => "tfn", name => "normalisePath", input => "./../", output => "../", ret => 1, }, { type => "tfn", name => "normalisePath", input => "..", output => "..", ret => 0, }, { type => "tfn", name => "normalisePath", input => "../", output => "../", ret => 0, }, { type => "tfn", name => "normalisePath", input => "../.", output => "..", ret => 1, }, { type => "tfn", name => "normalisePath", input => ".././", output => "../", ret => 1, }, { type => "tfn", name => "normalisePath", input => "../..", output => "../..", ret => 0, }, { type => "tfn", name => "normalisePath", input => "../../", output => "../../", ret => 0, }, { type => "tfn", name => "normalisePath", input => "/dir/foo//bar", output => "/dir/foo/bar", ret => 1, }, { type => "tfn", name => "normalisePath", input => "dir/foo//bar/", output => "dir/foo/bar/", ret => 1, }, { type => "tfn", name => "normalisePath", input => "dir/../foo", output => "foo", ret => 1, }, { type => "tfn", name => "normalisePath", input => "dir/../../foo", output => "../foo", ret => 1, }, { type => "tfn", name => "normalisePath", input => "dir/./.././../../foo/bar", output => "../../foo/bar", ret => 1, }, { type => "tfn", name => "normalisePath", input => "dir/./.././../../foo/bar/.", output => "../../foo/bar", ret => 1, }, { type => "tfn", name => "normalisePath", input => "dir/./.././../../foo/bar/./", output => "../../foo/bar/", ret => 1, }, { type => "tfn", name => "normalisePath", input => "dir/./.././../../foo/bar/..", output => "../../foo", ret => 1, }, { type => "tfn", name => "normalisePath", input => "dir/./.././../../foo/bar/../", output => "../../foo/", ret => 1, }, { type => "tfn", name => "normalisePath", input => "dir/./.././../../foo/bar/", output => "../../foo/bar/", ret => 1, }, { type => "tfn", name => "normalisePath", input => "dir//.//..//.//..//..//foo//bar", output => "../../foo/bar", ret => 1, }, { type => "tfn", name => "normalisePath", input => "dir//.//..//.//..//..//foo//bar//", output => "../../foo/bar/", ret => 1, }, { type => "tfn", name => "normalisePath", input => "dir/subdir/subsubdir/subsubsubdir/../../..", output => "dir", ret => 1, }, { type => "tfn", name => "normalisePath", input => "dir/./subdir/./subsubdir/./subsubsubdir/../../..", output => "dir", ret => 1, }, { type => "tfn", name => "normalisePath", input => "dir/./subdir/../subsubdir/../subsubsubdir/..", output => "dir", ret => 1, }, { type => "tfn", name => "normalisePath", input => "/dir/./subdir/../subsubdir/../subsubsubdir/../", output => "/dir/", ret => 1, }, ### With NUL { type => "tfn", name => "normalisePath", input => "/./.././../../../../../../../\0/../etc/./passwd", output => "/etc/passwd", ret => 1, }, modsecurity-apache_2.7.7/tests/tfn/base64Decode.t0000664000175000017500000000144412243422537022150 0ustar zimmerlezimmerle### Empty { type => "tfn", name => "base64Decode", input => "", output => "", ret => 0, }, ### Test values with varying lengths to check padding { type => "tfn", name => "base64Decode", input => "VGVzdENhc2U=", output => "TestCase", ret => 1, }, { type => "tfn", name => "base64Decode", input => "VGVzdENhc2Ux", output => "TestCase1", ret => 1, }, { type => "tfn", name => "base64Decode", input => "VGVzdENhc2UxMg==", output => "TestCase12", ret => 1, }, ### Check with a NUL { type => "tfn", name => "base64Decode", input => "VGVzdABDYXNl", output => "Test\0Case", ret => 1, }, ### Invalid # What should happen here? Probably just fail and leave alone. { type => "tfn", name => "base64Decode", input => "VGVzdENhc2U=\0VGVzdENhc2U=", output => "TestCase", ret => 1, }, modsecurity-apache_2.7.7/tests/tfn/trim.t0000664000175000017500000000165612243422537020740 0ustar zimmerlezimmerle### Empty { type => "tfn", name => "trim", input => "", output => "", ret => 0, }, ### Nothing { type => "tfn", name => "trim", input => "TestCase", output => "TestCase", ret => 0, }, { type => "tfn", name => "trim", input => "Test\0Case", output => "Test\0Case", ret => 0, }, ### Basics { type => "tfn", name => "trim", input => " TestCase", output => "TestCase", ret => 1, }, { type => "tfn", name => "trim", input => "TestCase ", output => "TestCase", ret => 1, }, { type => "tfn", name => "trim", input => " TestCase ", output => "TestCase", ret => 1, }, { type => "tfn", name => "trim", input => " Test Case ", output => "Test Case", ret => 1, }, { type => "tfn", name => "trim", input => " Test \0 Case ", output => "Test \0 Case", ret => 1, }, { type => "tfn", name => "trim", input => " Test \0 Case \r\n ", output => "Test \0 Case", ret => 1, }, modsecurity-apache_2.7.7/tests/tfn/urlDecodeUni.t0000664000175000017500000003036212243422537022343 0ustar zimmerlezimmerle### Empty { type => "tfn", name => "urlDecodeUni", input => "", output => "", ret => 0, }, ### Nothing { type => "tfn", name => "urlDecodeUni", input => "TestCase", output => "TestCase", ret => 0, }, { type => "tfn", name => "urlDecodeUni", input => "Test\0Case", output => "Test\0Case", ret => 0, }, ### Valid { type => "tfn", name => "urlDecodeUni", input => "+%00%01%02%03%04%05%06%07%08%09%0a%0b%0c%0d%0e%0f%10%11%12%13%14%15%16%17%18%19%1a%1b%1c%1d%1e%1f%20%21%22%23%24%25%26%27%28%29%2a%2b%2c%2d%2e%2f%30%31%32%33%34%35%36%37%38%39%3a%3b%3c%3d%3e%3f%40%41%42%43%44%45%46%47%48%49%4a%4b%4c%4d%4e%4f%50%51%52%53%54%55%56%57%58%59%5a%5b%5c%5d%5e%5f%60%61%62%63%64%65%66%67%68%69%6a%6b%6c%6d%6e%6f%70%71%72%73%74%75%76%77%78%79%7a%7b%7c%7d%7e%7f%80%81%82%83%84%85%86%87%88%89%8a%8b%8c%8d%8e%8f%90%91%92%93%94%95%96%97%98%99%9a%9b%9c%9d%9e%9f%a0%a1%a2%a3%a4%a5%a6%a7%a8%a9%aa%ab%ac%ad%ae%af%b0%b1%b2%b3%b4%b5%b6%b7%b8%b9%ba%bb%bc%bd%be%bf%c0%c1%c2%c3%c4%c5%c6%c7%c8%c9%ca%cb%cc%cd%ce%cf%d0%d1%d2%d3%d4%d5%d6%d7%d8%d9%da%db%dc%dd%de%df%e0%e1%e2%e3%e4%e5%e6%e7%e8%e9%ea%eb%ec%ed%ee%ef%f0%f1%f2%f3%f4%f5%f6%f7%f8%f9%fa%fb%fc%fd%fe%ff", output => " \x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f \x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff", ret => 1, }, { type => "tfn", name => "urlDecodeUni", input => "Test+Case", output => "Test Case", ret => 1, }, { type => "tfn", name => "urlDecodeUni", input => "+%u0000%u0001%u0002%u0003%u0004%u0005%u0006%u0007%u0008%u0009%u000a%u000b%u000c%u000d%u000e%u000f%u0010%u0011%u0012%u0013%u0014%u0015%u0016%u0017%u0018%u0019%u001a%u001b%u001c%u001d%u001e%u001f%u0020%u0021%u0022%u0023%u0024%u0025%u0026%u0027%u0028%u0029%u002a%u002b%u002c%u002d%u002e%u002f%u0030%u0031%u0032%u0033%u0034%u0035%u0036%u0037%u0038%u0039%u003a%u003b%u003c%u003d%u003e%u003f%u0040%u0041%u0042%u0043%u0044%u0045%u0046%u0047%u0048%u0049%u004a%u004b%u004c%u004d%u004e%u004f%u0050%u0051%u0052%u0053%u0054%u0055%u0056%u0057%u0058%u0059%u005a%u005b%u005c%u005d%u005e%u005f%u0060%u0061%u0062%u0063%u0064%u0065%u0066%u0067%u0068%u0069%u006a%u006b%u006c%u006d%u006e%u006f%u0070%u0071%u0072%u0073%u0074%u0075%u0076%u0077%u0078%u0079%u007a%u007b%u007c%u007d%u007e%u007f%u0080%u0081%u0082%u0083%u0084%u0085%u0086%u0087%u0088%u0089%u008a%u008b%u008c%u008d%u008e%u008f%u0090%u0091%u0092%u0093%u0094%u0095%u0096%u0097%u0098%u0099%u009a%u009b%u009c%u009d%u009e%u009f%u00a0%u00a1%u00a2%u00a3%u00a4%u00a5%u00a6%u00a7%u00a8%u00a9%u00aa%u00ab%u00ac%u00ad%u00ae%u00af%u00b0%u00b1%u00b2%u00b3%u00b4%u00b5%u00b6%u00b7%u00b8%u00b9%u00ba%u00bb%u00bc%u00bd%u00be%u00bf%u00c0%u00c1%u00c2%u00c3%u00c4%u00c5%u00c6%u00c7%u00c8%u00c9%u00ca%u00cb%u00cc%u00cd%u00ce%u00cf%u00d0%u00d1%u00d2%u00d3%u00d4%u00d5%u00d6%u00d7%u00d8%u00d9%u00da%u00db%u00dc%u00dd%u00de%u00df%u00e0%u00e1%u00e2%u00e3%u00e4%u00e5%u00e6%u00e7%u00e8%u00e9%u00ea%u00eb%u00ec%u00ed%u00ee%u00ef%u00f0%u00f1%u00f2%u00f3%u00f4%u00f5%u00f6%u00f7%u00f8%u00f9%u00fa%u00fb%u00fc%u00fd%u00fe%u00ff", output => " \x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f \x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff", ret => 1, }, { type => "tfn", name => "urlDecodeUni", input => "+%u1100%u1101%u1102%u1103%u1104%u1105%u1106%u1107%u1108%u1109%u110a%u110b%u110c%u110d%u110e%u110f%u1110%u1111%u1112%u1113%u1114%u1115%u1116%u1117%u1118%u1119%u111a%u111b%u111c%u111d%u111e%u111f%u1120%u1121%u1122%u1123%u1124%u1125%u1126%u1127%u1128%u1129%u112a%u112b%u112c%u112d%u112e%u112f%u1130%u1131%u1132%u1133%u1134%u1135%u1136%u1137%u1138%u1139%u113a%u113b%u113c%u113d%u113e%u113f%u1140%u1141%u1142%u1143%u1144%u1145%u1146%u1147%u1148%u1149%u114a%u114b%u114c%u114d%u114e%u114f%u1150%u1151%u1152%u1153%u1154%u1155%u1156%u1157%u1158%u1159%u115a%u115b%u115c%u115d%u115e%u115f%u1160%u1161%u1162%u1163%u1164%u1165%u1166%u1167%u1168%u1169%u116a%u116b%u116c%u116d%u116e%u116f%u1170%u1171%u1172%u1173%u1174%u1175%u1176%u1177%u1178%u1179%u117a%u117b%u117c%u117d%u117e%u117f%u1180%u1181%u1182%u1183%u1184%u1185%u1186%u1187%u1188%u1189%u118a%u118b%u118c%u118d%u118e%u118f%u1190%u1191%u1192%u1193%u1194%u1195%u1196%u1197%u1198%u1199%u119a%u119b%u119c%u119d%u119e%u119f%u11a0%u11a1%u11a2%u11a3%u11a4%u11a5%u11a6%u11a7%u11a8%u11a9%u11aa%u11ab%u11ac%u11ad%u11ae%u11af%u11b0%u11b1%u11b2%u11b3%u11b4%u11b5%u11b6%u11b7%u11b8%u11b9%u11ba%u11bb%u11bc%u11bd%u11be%u11bf%u11c0%u11c1%u11c2%u11c3%u11c4%u11c5%u11c6%u11c7%u11c8%u11c9%u11ca%u11cb%u11cc%u11cd%u11ce%u11cf%u11d0%u11d1%u11d2%u11d3%u11d4%u11d5%u11d6%u11d7%u11d8%u11d9%u11da%u11db%u11dc%u11dd%u11de%u11df%u11e0%u11e1%u11e2%u11e3%u11e4%u11e5%u11e6%u11e7%u11e8%u11e9%u11ea%u11eb%u11ec%u11ed%u11ee%u11ef%u11f0%u11f1%u11f2%u11f3%u11f4%u11f5%u11f6%u11f7%u11f8%u11f9%u11fa%u11fb%u11fc%u11fd%u11fe%u11ff", output => " \x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f \x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff", ret => 1, }, # Full Width ASCII { type => "tfn", name => "urlDecodeUni", input => "%uff01%uff02%uff03%uff04%uff05%uff06%uff07%uff08%uff09%uff0a%uff0b%uff0c%uff0d%uff0e%uff0f%uff10%uff11%uff12%uff13%uff14%uff15%uff16%uff17%uff18%uff19%uff1a%uff1b%uff1c%uff1d%uff1e%uff1f%uff20%uff21%uff22%uff23%uff24%uff25%uff26%uff27%uff28%uff29%uff2a%uff2b%uff2c%uff2d%uff2e%uff2f%uff30%uff31%uff32%uff33%uff34%uff35%uff36%uff37%uff38%uff39%uff3a%uff3b%uff3c%uff3d%uff3e%uff3f%uff40%uff41%uff42%uff43%uff44%uff45%uff46%uff47%uff48%uff49%uff4a%uff4b%uff4c%uff4d%uff4e%uff4f%uff50%uff51%uff52%uff53%uff54%uff55%uff56%uff57%uff58%uff59%uff5a%uff5b%uff5c%uff5d%uff5e", output => "\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e", ret => 1, }, # Invalid Full Width ASCII { type => "tfn", name => "urlDecodeUni", input => "%uff00%uff7f%uff80%uff81%uff82%uff83%uff84%uff85%uff86%uff87%uff88%uff89%uff8a%uff8b%uff8c%uff8d%uff8e%uff8f%uff90%uff91%uff92%uff93%uff94%uff95%uff96%uff97%uff98%uff99%uff9a%uff9b%uff9c%uff9d%uff9e%uff9f%uffa0%uffa1%uffa2%uffa3%uffa4%uffa5%uffa6%uffa7%uffa8%uffa9%uffaa%uffab%uffac%uffad%uffae%uffaf%uffb0%uffb1%uffb2%uffb3%uffb4%uffb5%uffb6%uffb7%uffb8%uffb9%uffba%uffbb%uffbc%uffbd%uffbe%uffbf%uffc0%uffc1%uffc2%uffc3%uffc4%uffc5%uffc6%uffc7%uffc8%uffc9%uffca%uffcb%uffcc%uffcd%uffce%uffcf%uffd0%uffd1%uffd2%uffd3%uffd4%uffd5%uffd6%uffd7%uffd8%uffd9%uffda%uffdb%uffdc%uffdd%uffde%uffdf%uffe0%uffe1%uffe2%uffe3%uffe4%uffe5%uffe6%uffe7%uffe8%uffe9%uffea%uffeb%uffec%uffed%uffee%uffef%ufff0%ufff1%ufff2%ufff3%ufff4%ufff5%ufff6%ufff7%ufff8%ufff9%ufffa%ufffb%ufffc%ufffd%ufffe%uffff", output => "\x00\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff", ret => 1, }, ### Partial Invalid { type => "tfn", name => "urlDecodeUni", input => "%+", output => "% ", ret => 1, }, { type => "tfn", name => "urlDecodeUni", input => "%%20", output => "% ", ret => 1, }, { type => "tfn", name => "urlDecodeUni", input => "%0g%20", output => "%0g ", ret => 1, }, { type => "tfn", name => "urlDecodeUni", input => "%0%20", output => "%0 ", ret => 1, }, { type => "tfn", name => "urlDecodeUni", input => "%g0%20", output => "%g0 ", ret => 1, }, { type => "tfn", name => "urlDecodeUni", input => "%g%20", output => "%g ", ret => 1, }, { type => "tfn", name => "urlDecodeUni", input => "%%u0020", output => "% ", ret => 1, }, { type => "tfn", name => "urlDecodeUni", input => "%0g%u0020", output => "%0g ", ret => 1, }, { type => "tfn", name => "urlDecodeUni", input => "%0%u0020", output => "%0 ", ret => 1, }, { type => "tfn", name => "urlDecodeUni", input => "%g0%u0020", output => "%g0 ", ret => 1, }, { type => "tfn", name => "urlDecodeUni", input => "%u%u0020", output => "%u ", ret => 1, }, { type => "tfn", name => "urlDecodeUni", input => "%u0%u0020", output => "%u0 ", ret => 1, }, { type => "tfn", name => "urlDecodeUni", input => "%u00%u0020", output => "%u00 ", ret => 1, }, { type => "tfn", name => "urlDecodeUni", input => "%u000%u0020", output => "%u000 ", ret => 1, }, { type => "tfn", name => "urlDecodeUni", input => "%u000g%u0020", output => "%u000g ", ret => 1, }, ### Invalid { type => "tfn", name => "urlDecodeUni", input => "%0%1%2%3%4%5%6%7%8%9%0%a%b%c%d%e%f", output => "%0%1%2%3%4%5%6%7%8%9%0%a%b%c%d%e%f", ret => 0, }, { type => "tfn", name => "urlDecodeUni", input => "%g0%g1%g2%g3%g4%g5%g6%g7%g8%g9%g0%ga%gb%gc%gd%ge%gf", output => "%g0%g1%g2%g3%g4%g5%g6%g7%g8%g9%g0%ga%gb%gc%gd%ge%gf", ret => 0, }, { type => "tfn", name => "urlDecodeUni", input => "%0g%1g%2g%3g%4g%5g%6g%7g%8g%9g%0g%ag%bg%cg%dg%eg%fg", output => "%0g%1g%2g%3g%4g%5g%6g%7g%8g%9g%0g%ag%bg%cg%dg%eg%fg", ret => 0, }, { type => "tfn", name => "urlDecodeUni", input => "%", output => "%", ret => 0, }, { type => "tfn", name => "urlDecodeUni", input => "%0", output => "%0", ret => 0, }, { type => "tfn", name => "urlDecodeUni", input => "%%", output => "%%", ret => 0, }, { type => "tfn", name => "urlDecodeUni", input => "%0g", output => "%0g", ret => 0, }, { type => "tfn", name => "urlDecodeUni", input => "%gg", output => "%gg", ret => 0, }, modsecurity-apache_2.7.7/tests/tfn/length.t0000664000175000017500000000110412243422537021232 0ustar zimmerlezimmerle### Empty { type => "tfn", name => "length", input => "", output => "0", ret => 1, }, ### Basic normal and large { type => "tfn", name => "length", input => "0123456789abcdef", output => "16", ret => 1, }, # ENH: This sometimes fails w/4096 length #{ # type => "tfn", # name => "length", # input => ('x' x 8192), # output => "8192", # ret => 1, #}, ### With TAB { type => "tfn", name => "length", input => "0123456789\tabcdef", output => "17", ret => 1, }, ### With NUL { type => "tfn", name => "length", input => "Test\0Case", output => "9", ret => 1, }, modsecurity-apache_2.7.7/tests/tfn/replaceComments.t0000664000175000017500000000466212243422537023106 0ustar zimmerlezimmerle### Empty { type => "tfn", name => "replaceComments", input => "", output => "", ret => 0, }, ### Nothing { type => "tfn", name => "replaceComments", input => "TestCase", output => "TestCase", ret => 0, }, { type => "tfn", name => "replaceComments", input => "Test\0Case", output => "Test\0Case", ret => 0, }, ### Basics { type => "tfn", name => "replaceComments", input => "/* TestCase */", output => " ", ret => 1, }, { type => "tfn", name => "replaceComments", input => "/*TestCase*/", output => " ", ret => 1, }, { type => "tfn", name => "replaceComments", input => "/* TestCase*/", output => " ", ret => 1, }, { type => "tfn", name => "replaceComments", input => "/*TestCase */", output => " ", ret => 1, }, { type => "tfn", name => "replaceComments", input => "Before/* TestCase */After", output => "Before After", ret => 1, }, { type => "tfn", name => "replaceComments", input => "Before /* TestCase */ After", output => "Before After", ret => 1, }, { type => "tfn", name => "replaceComments", input => "/* Test\nCase */", output => " ", ret => 1, }, { type => "tfn", name => "replaceComments", input => "/* Test\x0d\x0aCase */", output => " ", ret => 1, }, { type => "tfn", name => "replaceComments", input => "/* Test\x0aCase */", output => " ", ret => 1, }, { type => "tfn", name => "replaceComments", input => "/* Test\x0dCase */", output => " ", ret => 1, }, ### Broken Comments { type => "tfn", name => "replaceComments", input => "Before/* Test\x0d\x0aCase ", output => "Before ", ret => 1, }, { type => "tfn", name => "replaceComments", input => "Before /* Test\x0aCase ", output => "Before ", ret => 1, }, { type => "tfn", name => "replaceComments", input => "Before/* Test\x0d\x0aCase ", output => "Before ", ret => 1, }, { type => "tfn", name => "replaceComments", input => "Before /* Test\x0aCase ", output => "Before ", ret => 1, }, { type => "tfn", name => "replaceComments", input => "Test\x0d\x0aCase */After", output => "Test\x0d\x0aCase */After", ret => 0, }, { type => "tfn", name => "replaceComments", input => "Test\x0aCase */ After", output => "Test\x0aCase */ After", ret => 0, }, { type => "tfn", name => "replaceComments", input => "Test\x0d\x0aCase */After", output => "Test\x0d\x0aCase */After", ret => 0, }, { type => "tfn", name => "replaceComments", input => "Test\x0aCase */ After", output => "Test\x0aCase */ After", ret => 0, }, modsecurity-apache_2.7.7/tests/tfn/urlDecode.t0000664000175000017500000000736712243422537021700 0ustar zimmerlezimmerle### Empty { type => "tfn", name => "urlDecode", input => "", output => "", ret => 0, }, ### Nothing { type => "tfn", name => "urlDecode", input => "TestCase", output => "TestCase", ret => 0, }, { type => "tfn", name => "urlDecode", input => "Test\0Case", output => "Test\0Case", ret => 0, }, ### Valid { type => "tfn", name => "urlDecode", input => "+%00%01%02%03%04%05%06%07%08%09%0a%0b%0c%0d%0e%0f%10%11%12%13%14%15%16%17%18%19%1a%1b%1c%1d%1e%1f%20%21%22%23%24%25%26%27%28%29%2a%2b%2c%2d%2e%2f%30%31%32%33%34%35%36%37%38%39%3a%3b%3c%3d%3e%3f%40%41%42%43%44%45%46%47%48%49%4a%4b%4c%4d%4e%4f%50%51%52%53%54%55%56%57%58%59%5a%5b%5c%5d%5e%5f%60%61%62%63%64%65%66%67%68%69%6a%6b%6c%6d%6e%6f%70%71%72%73%74%75%76%77%78%79%7a%7b%7c%7d%7e%7f%80%81%82%83%84%85%86%87%88%89%8a%8b%8c%8d%8e%8f%90%91%92%93%94%95%96%97%98%99%9a%9b%9c%9d%9e%9f%a0%a1%a2%a3%a4%a5%a6%a7%a8%a9%aa%ab%ac%ad%ae%af%b0%b1%b2%b3%b4%b5%b6%b7%b8%b9%ba%bb%bc%bd%be%bf%c0%c1%c2%c3%c4%c5%c6%c7%c8%c9%ca%cb%cc%cd%ce%cf%d0%d1%d2%d3%d4%d5%d6%d7%d8%d9%da%db%dc%dd%de%df%e0%e1%e2%e3%e4%e5%e6%e7%e8%e9%ea%eb%ec%ed%ee%ef%f0%f1%f2%f3%f4%f5%f6%f7%f8%f9%fa%fb%fc%fd%fe%ff", output => " \x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f \x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff", ret => 1, }, { type => "tfn", name => "urlDecode", input => "Test+Case", output => "Test Case", ret => 1, }, ### Partial Invalid { type => "tfn", name => "urlDecode", input => "%+", output => "% ", ret => 1, }, { type => "tfn", name => "urlDecode", input => "%%20", output => "% ", ret => 1, }, { type => "tfn", name => "urlDecode", input => "%0g%20", output => "%0g ", ret => 1, }, { type => "tfn", name => "urlDecode", input => "%0%20", output => "%0 ", ret => 1, }, { type => "tfn", name => "urlDecode", input => "%g0%20", output => "%g0 ", ret => 1, }, { type => "tfn", name => "urlDecode", input => "%g%20", output => "%g ", ret => 1, }, ### Invalid { type => "tfn", name => "urlDecode", input => "%0%1%2%3%4%5%6%7%8%9%0%a%b%c%d%e%f", output => "%0%1%2%3%4%5%6%7%8%9%0%a%b%c%d%e%f", ret => 0, }, { type => "tfn", name => "urlDecode", input => "%g0%g1%g2%g3%g4%g5%g6%g7%g8%g9%g0%ga%gb%gc%gd%ge%gf", output => "%g0%g1%g2%g3%g4%g5%g6%g7%g8%g9%g0%ga%gb%gc%gd%ge%gf", ret => 0, }, { type => "tfn", name => "urlDecode", input => "%0g%1g%2g%3g%4g%5g%6g%7g%8g%9g%0g%ag%bg%cg%dg%eg%fg", output => "%0g%1g%2g%3g%4g%5g%6g%7g%8g%9g%0g%ag%bg%cg%dg%eg%fg", ret => 0, }, { type => "tfn", name => "urlDecode", input => "%", output => "%", ret => 0, }, { type => "tfn", name => "urlDecode", input => "%0", output => "%0", ret => 0, }, { type => "tfn", name => "urlDecode", input => "%%", output => "%%", ret => 0, }, { type => "tfn", name => "urlDecode", input => "%0g", output => "%0g", ret => 0, }, { type => "tfn", name => "urlDecode", input => "%gg", output => "%gg", ret => 0, }, modsecurity-apache_2.7.7/tests/tfn/urlEncode.t0000664000175000017500000000705612243422537021705 0ustar zimmerlezimmerle### Empty { type => "tfn", name => "urlEncode", input => "", output => "", ret => 0, }, ### Nothing { type => "tfn", name => "urlEncode", input => "TestCase", output => "TestCase", ret => 0, }, ### Valid { type => "tfn", name => "urlEncode", input => " \x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff", output => "+%00%01%02%03%04%05%06%07%08%09%0a%0b%0c%0d%0e%0f%10%11%12%13%14%15%16%17%18%19%1a%1b%1c%1d%1e%1f+%21%22%23%24%25%26%27%28%29*%2b%2c%2d%2e%2f0123456789%3a%3b%3c%3d%3e%3f%40ABCDEFGHIJKLMNOPQRSTUVWXYZ%5b%5c%5d%5e%5f%60abcdefghijklmnopqrstuvwxyz%7b%7c%7d%7e%7f%80%81%82%83%84%85%86%87%88%89%8a%8b%8c%8d%8e%8f%90%91%92%93%94%95%96%97%98%99%9a%9b%9c%9d%9e%9f%a0%a1%a2%a3%a4%a5%a6%a7%a8%a9%aa%ab%ac%ad%ae%af%b0%b1%b2%b3%b4%b5%b6%b7%b8%b9%ba%bb%bc%bd%be%bf%c0%c1%c2%c3%c4%c5%c6%c7%c8%c9%ca%cb%cc%cd%ce%cf%d0%d1%d2%d3%d4%d5%d6%d7%d8%d9%da%db%dc%dd%de%df%e0%e1%e2%e3%e4%e5%e6%e7%e8%e9%ea%eb%ec%ed%ee%ef%f0%f1%f2%f3%f4%f5%f6%f7%f8%f9%fa%fb%fc%fd%fe%ff", ret => 1, }, { type => "tfn", name => "urlEncode", input => "Test Case", output => "Test+Case", ret => 1, }, ### Partial Invalid { type => "tfn", name => "urlEncode", input => "% ", output => "%25+", ret => 1, }, { type => "tfn", name => "urlEncode", input => "%0g ", output => "%250g+", ret => 1, }, { type => "tfn", name => "urlEncode", input => "%0 ", output => "%250+", ret => 1, }, { type => "tfn", name => "urlEncode", input => "%g0 ", output => "%25g0+", ret => 1, }, { type => "tfn", name => "urlEncode", input => "%g ", output => "%25g+", ret => 1, }, ### Invalid { type => "tfn", name => "urlEncode", input => "%0%1%2%3%4%5%6%7%8%9%0%a%b%c%d%e%f", output => "%250%251%252%253%254%255%256%257%258%259%250%25a%25b%25c%25d%25e%25f", ret => 1, }, { type => "tfn", name => "urlEncode", input => "%g0%g1%g2%g3%g4%g5%g6%g7%g8%g9%g0%ga%gb%gc%gd%ge%gf", output => "%25g0%25g1%25g2%25g3%25g4%25g5%25g6%25g7%25g8%25g9%25g0%25ga%25gb%25gc%25gd%25ge%25gf", ret => 1, }, { type => "tfn", name => "urlEncode", input => "%0g%1g%2g%3g%4g%5g%6g%7g%8g%9g%0g%ag%bg%cg%dg%eg%fg", output => "%250g%251g%252g%253g%254g%255g%256g%257g%258g%259g%250g%25ag%25bg%25cg%25dg%25eg%25fg", ret => 1, }, { type => "tfn", name => "urlEncode", input => "%", output => "%25", ret => 1, }, { type => "tfn", name => "urlEncode", input => "%0", output => "%250", ret => 1, }, { type => "tfn", name => "urlEncode", input => "%%", output => "%25%25", ret => 1, }, { type => "tfn", name => "urlEncode", input => "%0g", output => "%250g", ret => 1, }, { type => "tfn", name => "urlEncode", input => "%gg", output => "%25gg", ret => 1, }, modsecurity-apache_2.7.7/tests/tfn/lowercase.t0000664000175000017500000000101112243422537021732 0ustar zimmerlezimmerle### Empty { type => "tfn", name => "lowercase", input => "", output => "", ret => 0, }, ### Nothing { type => "tfn", name => "lowercase", input => "testcase", output => "testcase", ret => 0, }, { type => "tfn", name => "lowercase", input => "test\0case", output => "test\0case", ret => 0, }, ### Basic { type => "tfn", name => "lowercase", input => "TestCase", output => "testcase", ret => 1, }, { type => "tfn", name => "lowercase", input => "Test\0Case", output => "test\0case", ret => 1, }, modsecurity-apache_2.7.7/tests/tfn/compressWhitespace.t0000664000175000017500000000171012243422537023624 0ustar zimmerlezimmerle### Empty { type => "tfn", name => "compressWhitespace", input => "", output => "", ret => 0, }, ### Nothing { type => "tfn", name => "compressWhitespace", input => "TestCase", output => "TestCase", ret => 0, }, { type => "tfn", name => "compressWhitespace", input => "Test\0Case", output => "Test\0Case", ret => 0, }, { type => "tfn", name => "compressWhitespace", input => "Test Case", output => "Test Case", ret => 0, }, ### Compress space/tab { type => "tfn", name => "compressWhitespace", input => " Test \t Case ", output => " Test Case ", ret => 1, }, ### Pretty much everything in one { type => "tfn", name => "compressWhitespace", input => "This is a test case with a tab \t, vtab \x0b, newline \x0a, return \x0d, formfeed \f, and a NUL\0 in it with a CRLF at the end.\x0d\x0a", output => "This is a test case with a tab , vtab , newline , return , formfeed , and a NUL\0 in it with a CRLF at the end. ", ret => 1, }, modsecurity-apache_2.7.7/tests/tfn/base64Encode.t0000664000175000017500000000113612243422537022160 0ustar zimmerlezimmerle### Empty { type => "tfn", name => "base64Encode", input => "", output => "", ret => 0, }, ### Test values with varying lengths to check padding { type => "tfn", name => "base64Encode", input => "TestCase", output => "VGVzdENhc2U=", ret => 1, }, { type => "tfn", name => "base64Encode", input => "TestCase1", output => "VGVzdENhc2Ux", ret => 1, }, { type => "tfn", name => "base64Encode", input => "TestCase12", output => "VGVzdENhc2UxMg==", ret => 1, }, ### Check with a NUL { type => "tfn", name => "base64Encode", input => "Test\0Case", output => "VGVzdABDYXNl", ret => 1, }, modsecurity-apache_2.7.7/tests/tfn/parityZero7bit.t0000664000175000017500000000125212243422537022713 0ustar zimmerlezimmerle### Empty { type => "tfn", name => "parityZero7bit", input => "", output => "", ret => 0, }, ### Nothing { type => "tfn", name => "parityZero7bit", input => "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", output => "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", ret => 0, }, { type => "tfn", name => "parityZero7bit", input => "abcdefghijklmnopqrstuvwxyz\x000123456789\x00ABCDEFGHIJKLMNOPQRSTUVWXYZ", output => "abcdefghijklmnopqrstuvwxyz\x000123456789\x00ABCDEFGHIJKLMNOPQRSTUVWXYZ", ret => 0, }, ### Basic { type => "tfn", name => "parityZero7bit", input => "\x80\x00\x8f\xff", output => "\x00\x00\x0f\x7f", ret => 1, }, modsecurity-apache_2.7.7/tests/run-regression-tests-nginx.pl0000664000175000017500000003767612243422537024624 0ustar zimmerlezimmerle#!/usr/bin/perl # # Run regression tests. # # Syntax: run-regression-tests.pl [options] [file [N]] # # All: run-regression-tests.pl # All in file: run-regression-tests.pl file # Nth in file: run-regression-tests.pl file N # use strict; use Time::HiRes qw(gettimeofday sleep); use POSIX qw(WIFEXITED WEXITSTATUS WIFSIGNALED WTERMSIG); use File::Spec qw(rel2abs); use File::Basename qw(basename dirname); use File::Path qw(make_path); use FileHandle; use IPC::Open2 qw(open2); use IPC::Open3 qw(open3); use Getopt::Std; use Data::Dumper; use IO::Socket; use LWP::UserAgent; use Cwd 'abs_path'; use Template; use File::Copy::Recursive qw(dircopy); my @TYPES = qw(action config misc rule target); my $SCRIPT = basename($0); my $SCRIPT_DIR = File::Spec->rel2abs(dirname($0)); my $REG_DIR = "$SCRIPT_DIR/regression"; my $NGINX_DIR = "$REG_DIR/nginx"; my $NGINX_CONF_TEMP = "$REG_DIR/nginx/conf/nginx.conf.template"; my $NGINX = q(/usr/local/nginx/sbin/nginx); my $PASSED = 0; my $TOTAL = 0; my $BUFSIZ = 32768; my %C = (); my %FILE = (); my $UA_NAME = "ModSecurity Regression Tests/1.2.3"; my $UA = LWP::UserAgent->new; $UA->agent($UA_NAME); $SIG{TERM} = $SIG{INT} = \&handle_interrupt; my %opt; getopts('A:E:D:C:T:H:a:p:dvh', \%opt); if ($opt{d}) { $Data::Dumper::Indent = 1; $Data::Dumper::Terse = 1; $Data::Dumper::Pad = ""; $Data::Dumper::Quotekeys = 0; } sub usage { print stderr <<"EOT"; @_ Usage: $SCRIPT [options] [file [N]] Options: -P path Specify nginx prefix path (default: $NGINX_DIR) -a file Specify nginx binary (default: $NGINX) -p port Specify nginx port (default: 8088) -v Enable verbose output (details on failure). -d Enable debugging output. -h This help. EOT exit(1); } usage() if ($opt{h}); ### Check nginx binary if (defined $opt{a}) { $NGINX = $opt{a}; } else { $opt{a} = $NGINX; } usage("Invalid Apache startup script: $NGINX\n") unless (-e $NGINX); ### Defaults $opt{P} = "$NGINX_DIR" unless (defined $opt{P}); my $CONF_DIR = "$opt{P}/conf"; my $FILES_DIR = "$opt{P}/logs"; my $PID_FILE = "$FILES_DIR/nginx.pid"; $opt{A} = "$FILES_DIR/modsec_audit.log"; $opt{D} = "$FILES_DIR/modsec_debug.log"; $opt{E} = "$FILES_DIR/error.log"; $opt{C} = "$CONF_DIR/nginx.conf"; $opt{p} = 8088 unless (defined $opt{p}); $opt{v} = 1 if ($opt{d}); if ( !-d "$opt{P}" ) { make_path($opt{P}) or die $!; } if ( !-d "$opt{P}/logs" ) { make_path("$opt{P}/logs") or die $!; } if ( !-d "$opt{P}/html" ) { make_path("$opt{P}/html") or die $!; } dircopy("$REG_DIR/server_root/htdocs","$opt{P}/html") or die $!; %ENV = ( %ENV, $NGINX_DIR => $opt{P}, SERVER_PORT => $opt{p}, SERVER_NAME => "localhost", # TEST_NGX_PREFIX => $NGINX_DIR, # DATA_DIR => $DATA_DIR, # TEMP_DIR => $TEMP_DIR, # UPLOAD_DIR => $UPLOAD_DIR, CONF_DIR => $CONF_DIR, # MODULES_DIR => $MODULES_DIR, LOGS_DIR => $FILES_DIR, SCRIPT_DIR => $SCRIPT_DIR, REGRESSION_DIR => $REG_DIR, DIST_ROOT => File::Spec->rel2abs(dirname("$SCRIPT_DIR/../../..")), AUDIT_LOG => $opt{A}, DEBUG_LOG => $opt{D}, ERROR_LOG => $opt{E}, NGINX_CONF => $opt{C}, # HTDOCS => $opt{H}, USER_AGENT => $UA_NAME, ); #dbg("OPTIONS: ", \%opt); if (-e "$PID_FILE") { msg("Shutting down previous instance: $PID_FILE"); nginx_stop(); } if (defined $ARGV[0]) { runfile(dirname($ARGV[0]), basename($ARGV[0]), $ARGV[1]); done(); } for my $type (@TYPES) { my $dir = "$SCRIPT_DIR/regression/$type"; my @cfg = (); # Get test names opendir(DIR, "$dir") or quit(1, "Failed to open \"$dir\": $!"); @cfg = grep { /\.t$/ && -f "$dir/$_" } readdir(DIR); closedir(DIR); for my $cfg (sort @cfg) { runfile($dir, $cfg); } } done(); sub runfile { my($dir, $cfg, $testnum) = @_; my $fn = "$dir/$cfg"; my @data = (); my $edata; my @C = (); my @test = (); my $teststr; my $n = 0; my $pass = 0; open(CFG, "<$fn") or quit(1, "Failed to open \"$fn\": $!"); @data = ; $edata = q/@C = (/ . join("", @data) . q/)/; eval $edata; quit(1, "Failed to read test data \"$cfg\": $@") if ($@); unless (@C) { msg("\nNo tests defined for $fn"); return; } msg("\nLoaded ".@C." tests from $fn"); for my $t (@C) { $n++; next if (defined $testnum and $n != $testnum); my $nginx_up = 0; my %t = %{$t || {}}; my $id = sprintf("%3d", $n); my $out = ""; my $rc = 0; my $conf_fn; # Startup nginx with optionally included conf. if (exists $t{conf} and defined $t{conf}) { $conf_fn = sprintf "%s/%s_%s_%06d.conf", $CONF_DIR, $t{type}, $cfg, $n; #dbg("Writing test config to: $conf_fn"); open(CONF, ">$conf_fn") or die "Failed to open conf \"$conf_fn\": $!\n"; print CONF (ref $t{conf} eq "CODE" ? eval { &{$t{conf}} } : $t{conf}); msg("$@") if ($@); close CONF; my %conf=(config => $conf_fn, enable => "on"); $nginx_up = nginx_start($t, \%conf) ? 0 : 1; } else { $nginx_up = nginx_start($t) ? 0 : 1; } # Run any prerun setup if ($rc == 0 and exists $t{prerun} and defined $t{prerun}) { vrb("Executing perl prerun..."); $rc = &{$t{prerun}}; vrb("Perl prerun returned: $rc"); } if ($nginx_up) { # Perform the request and check response if (exists $t{request}) { my $resp = do_request($t{request}); if (!$resp) { msg("invalid response"); vrb("RESPONSE: ", $resp); $rc = 1; } else { for my $key (keys %{ $t{match_response} || {}}) { my($neg,$mtype) = ($key =~ m/^(-?)(.*)$/); my $m = $t{match_response}{$key}; my $match = match_response($mtype, $resp, $m); if ($neg and defined $match) { $rc = 1; msg("response $mtype matched: $m"); vrb($resp); last; } elsif (!$neg and !defined $match) { $rc = 1; msg("response $mtype failed to match: $m"); vrb($resp); last; } } } } # Run any arbitrary perl tests if ($rc == 0 and exists $t{test} and defined $t{test}) { dbg("Executing perl test(s)..."); $rc = eval { &{$t{test}} }; if (! defined $rc) { msg("Error running test: $@"); $rc = -1; } dbg("Perl tests returned: $rc"); } # Search for all log matches if ($rc == 0 and exists $t{match_log} and defined $t{match_log}) { for my $key (keys %{ $t{match_log} || {}}) { my($neg,$mtype) = ($key =~ m/^(-?)(.*)$/); my $m = $t{match_log}{$key}; my $match = match_log($mtype, @{$m || []}); if ($neg and defined $match) { $rc = 1; msg("$mtype log matched: $m->[0]"); last; } elsif (!$neg and !defined $match) { $rc = 1; msg("$mtype log failed to match: $m->[0]"); last; } } } # Search for all file matches if ($rc == 0 and exists $t{match_file} and defined $t{match_file}) { sleep 1; # Make sure the file exists for my $key (keys %{ $t{match_file} || {}}) { my($neg,$fn) = ($key =~ m/^(-?)(.*)$/); my $m = $t{match_file}{$key}; my $match = match_file($fn, $m); if ($neg and defined $match) { $rc = 1; msg("$fn file matched: $m"); last; } elsif (!$neg and !defined $match) { $rc = 1; msg("$fn file failed match: $m"); last; } } } } else { msg("Failed to start nginx."); $rc = 1; } if ($rc == 0) { $pass++; } else { vrb("Test Config: $conf_fn"); vrb("Debug Log: $FILE{debug}{fn}"); dbg(escape("$FILE{debug}{buf}")); vrb("Error Log: $FILE{error}{fn}"); dbg(escape("$FILE{error}{buf}")); } msg(sprintf("%s) %s%s: %s%s", $id, $t{type}, (exists($t{comment}) ? " - $t{comment}" : ""), ($rc ? "failed" : "passed"), ((defined($out) && $out ne "")? " ($out)" : ""))); if ($nginx_up) { $nginx_up = nginx_stop(\%t) ? 0 : 1; } } $TOTAL += $testnum ? 1 : $n; $PASSED += $pass; msg(sprintf("Passed: %2d; Failed: %2d", $pass, $testnum ? (1 - $pass) : ($n - $pass))); } # Take out any indenting and translate LF -> CRLF sub normalize_raw_request_data { my $r = $_[0]; # Allow for indenting in test file $r =~ s/^[ \t]*\x0d?\x0a//s; my($indention) = ($r =~ m/^([ \t]*)/s); # indention taken from first line $r =~ s/^$indention//mg; $r =~ s/(\x0d?\x0a)[ \t]+$/$1/s; # Translate LF to CRLF $r =~ s/^\x0a/\x0d\x0a/mg; $r =~ s/([^\x0d])\x0a/$1\x0d\x0a/mg; return $r; } sub do_raw_request { my $sock = new IO::Socket::INET( Proto => "tcp", PeerAddr => "localhost", PeerPort => $opt{p}, ) or msg("Failed to connect to localhost:$opt{p}: $@"); return unless ($sock); # Join togeather the request my $r = join("", @_); dbg($r); # Write to socket print $sock "$r"; $sock->shutdown(1); # Read from socket my @resp = <$sock>; $sock->close(); return HTTP::Response->parse(join("", @resp)); } sub do_request { my $r = $_[0]; # Allow test to execute code if (ref $r eq "CODE") { $r = eval { &$r }; msg("$@") unless (defined $r); } if (ref $r eq "HTTP::Request") { my $resp = $UA->request($r); dbg($resp->request()->as_string()) if ($opt{d}); return $resp } else { return do_raw_request($r); } return; } sub match_response { my($name, $resp, $re) = @_; msg("Warning: Empty regular expression.") if (!defined $re or $re eq ""); if ($name eq "status") { return $& if ($resp->code =~ m/$re/); } elsif ($name eq "content") { return $& if ($resp->content =~ m/$re/m); } elsif ($name eq "raw") { return $& if ($resp->as_string =~ m/$re/m); } return; } sub read_log { my($name, $timeout, $graph) = @_; return match_log($name, undef, $timeout, $graph); } sub match_log { my($name, $re, $timeout, $graph) = @_; my $t0 = gettimeofday; my($fh,$rbuf) = ($FILE{$name}{fd}, \$FILE{$name}{buf}); my $n = length($$rbuf); my $rc = undef; unless (defined $fh) { msg("Error: File \"$name\" is not opened for matching."); return; } $timeout = 0 unless (defined $timeout); my $i = 0; my $graphed = 0; READ: { do { my $nbytes = $fh->sysread($$rbuf, $BUFSIZ, $n); if (!defined($nbytes)) { msg("Error: Could not read \"$name\" log: $!"); last; } elsif (!defined($re) and $nbytes == 0) { last; } # Remove APR pool debugging $$rbuf =~ s/POOL DEBUG:[^\n]+PALLOC[^\n]+\n//sg; $n = length($$rbuf); #dbg("Match \"$re\" in $name \"$$rbuf\" ($n)"); if ($$rbuf =~ m/$re/m) { $rc = $&; last; } # TODO: Use select()/poll() sleep 0.1 unless ($nbytes == $BUFSIZ); if ($graph and $opt{d}) { $i++; if ($i == 10) { $graphed++; $i=0; print STDERR $graph if ($graphed == 1); print STDERR "." } } } while (gettimeofday - $t0 < $timeout); } print STDERR "\n" if ($graphed); return $rc; } sub match_file { my($neg,$fn) = ($_[0] =~ m/^(-?)(.*)$/); unless (exists $FILE{$fn}) { eval { $FILE{$fn}{fn} = $fn; $FILE{$fn}{fd} = new FileHandle($fn, O_RDONLY) or die "$!\n"; $FILE{$fn}{fd}->blocking(0); $FILE{$fn}{buf} = ""; }; if ($@) { msg("Warning: Failed to open file \"$fn\": $@"); return; } } return match_log($_[0], $_[1]); # timeout makes no sense } sub quote_shell { my($s) = @_; return $s unless ($s =~ m|[^\w!%+,\-./:@^]|); $s =~ s/(['\\])/\\$1/g; return "'$s'"; } sub escape { my @new = (); for my $c (split(//, $_[0])) { my $oc = ord($c); push @new, ((($oc >= 0x20 and $oc <= 0x7e) or $oc == 0x0a or $oc == 0x0d) ? $c : sprintf("\\x%02x", ord($c))); } join('', @new); } sub dbg { return unless(@_ and $opt{d}); my $out = join "", map { (ref $_ ne "" ? Dumper($_) : $_) } @_; $out =~ s/^/DBG: /mg; print STDOUT "$out\n"; } sub vrb { return unless(@_ and $opt{v}); msg(@_); } sub msg { return unless(@_); my $out = join "", map { (ref $_ ne "" ? Dumper($_) : $_) } @_; print STDOUT "$out\n"; } sub handle_interrupt { $SIG{TERM} = $SIG{INT} = \&handle_interrupt; msg("Interrupted via SIG$_[0]. Shutting down tests..."); nginx_stop(); quit(1); } sub quit { my($ec,$msg) = @_; $ec = 0 unless (defined $_[0]); msg("$msg") if (defined $msg); exit $ec; } sub done { if ($PASSED != $TOTAL) { quit(1, "\n$PASSED/$TOTAL tests passed."); } quit(0, "\nAll tests passed ($TOTAL)."); } sub nginx_stop { my $t = shift; my @p = ( $NGINX, -p => $opt{P}, -s => "quit", ); my $nginx_out; my $nginx_pid = open3(undef, $nginx_out, undef, @p) or quit(1); my $out = join("\\n", grep(!/POOL DEBUG/, (<$nginx_out>))); close $nginx_out; waitpid($nginx_pid, 0); my $rc = $?; if ( WIFEXITED($rc) ) { $rc = WEXITSTATUS($rc); vrb("Nginx stop returned with $rc.") if ($rc); } elsif( WIFSIGNALED($rc) ) { msg("Nginx stop failed with signal " . WTERMSIG($rc) . "."); $rc = -1; } else { msg("Nginx stop failed with unknown error."); $rc = -1; } sleep 0.5; if (-e $PID_FILE) { msg("Nginx stop failed: $PID_FILE still exists"); } return $rc; } sub nginx_reset_fd { my($t) = @_; # Cleanup for my $key (keys %FILE) { if (exists $FILE{$key}{fd} and defined $FILE{$key}{fd}) { $FILE{$key}{fd}->close(); } delete $FILE{$key}; } # Error eval { $FILE{error}{fn} = $opt{E}; $FILE{error}{fd} = new FileHandle($opt{E}, O_RDWR|O_CREAT) or die "$!\n"; $FILE{error}{fd}->blocking(0); $FILE{error}{fd}->sysseek(0, 2); $FILE{error}{buf} = ""; }; if ($@) { msg("Warning: Failed to open file \"$opt{E}\": $@"); return undef; } # Audit eval { $FILE{audit}{fn} = $opt{A}; $FILE{audit}{fd} = new FileHandle($opt{A}, O_RDWR|O_CREAT) or die "$!\n"; $FILE{audit}{fd}->blocking(0); $FILE{audit}{fd}->sysseek(0, 2); $FILE{audit}{buf} = ""; }; if ($@) { msg("Warning: Failed to open file \"$opt{A}\": $@"); return undef; } # Debug eval { $FILE{debug}{fn} = $opt{D}; $FILE{debug}{fd} = new FileHandle($opt{D}, O_RDWR|O_CREAT) or die "$!\n"; $FILE{debug}{fd}->blocking(0); $FILE{debug}{fd}->sysseek(0, 2); $FILE{debug}{buf} = ""; }; if ($@) { msg("Warning: Failed to open file \"$opt{D}\": $@"); return undef; } # Any extras listed in "match_log" if ($t and exists $t->{match_log}) { for my $k (keys %{ $t->{match_log} || {} }) { my($neg,$fn) = ($k =~ m/^(-?)(.*)$/); next if (!$fn or exists $FILE{$fn}); eval { $FILE{$fn}{fn} = $fn; $FILE{$fn}{fd} = new FileHandle($fn, O_RDWR|O_CREAT) or die "$!\n"; $FILE{$fn}{fd}->blocking(0); $FILE{$fn}{fd}->sysseek(0, 2); $FILE{$fn}{buf} = ""; }; if ($@) { msg("Warning: Failed to open file \"$fn\": $@"); return undef; } } } } sub encode_chunked { my($data, $size) = @_; $size = 128 unless ($size); my $chunked = ""; my $n = 0; my $bytes = length($data); while ($bytes >= $size) { $chunked .= sprintf "%x\x0d\x0a%s\x0d\x0a", $size, substr($data, $n, $size); $n += $size; $bytes -= $size; } if ($bytes) { $chunked .= sprintf "%x\x0d\x0a%s\x0d\x0a", $bytes, substr($data, $n, $bytes); } $chunked .= "0\x0d\x0a\x0d\x0a" } sub nginx_start { my ($t) = shift; my($C) = shift; my %conf = ( listen => "$opt{p}", config => "$REG_DIR/nginx/conf/empty.conf", enable => "off", ); while(my($k,$v)= each %$C){ $conf{$k}=$v; } my ($tt) = Template->new(INCLUDE_PATH => "$REG_DIR/nginx/conf/"); my ($output); $tt->process("nginx.conf.template", \%conf, \$output) || die $tt->error; open (OUTFILE, ">$opt{C}"); print OUTFILE "$output"; close(OUTFILE); nginx_reset_fd($t); my @p = ($NGINX, -p => $opt{P}); my $nginx_out; my $nginx_pid = open3(undef, $nginx_out, undef, @p) or quit(1); my $out = join("\\n", grep(!/POOL DEBUG/, (<$nginx_out>))); close $nginx_out; waitpid($nginx_pid, 0); my $rc = $?; if ( WIFEXITED($rc) ) { $rc = WEXITSTATUS($rc); vrb("Nginx start returned with $rc.") if ($rc); } elsif( WIFSIGNALED($rc) ) { msg("Nginx start failed with signal " . WTERMSIG($rc) . "."); $rc = -1; } else { msg("Nginx start failed with unknown error."); $rc = -1; } # Look for startup msg # unless (defined match_log("error", qr/start worker process/, 60, "Waiting on nginx to start: ")) { # vrb(join(" ", map { quote_shell($_) } @p)); # vrb(match_log("error", qr/(^.*ModSecurity: .*)/sm, 10)); # msg("Nginx server failed to start."); # nginx_stop(); # return -1; # } return $rc; } modsecurity-apache_2.7.7/tests/op/0000775000175000017500000000000012243422537017417 5ustar zimmerlezimmerlemodsecurity-apache_2.7.7/tests/op/eq.t0000664000175000017500000000217612243422537020217 0ustar zimmerlezimmerle### Empty { type => "op", name => "eq", param => "0", input => "", ret => 1, }, { type => "op", name => "eq", param => "5", input => "", ret => 0, }, ### Invalid # xxx interpreted as 0 { type => "op", name => "eq", param => "xxx", input => "0", ret => 1, }, # xxx interpreted as 0 { type => "op", name => "eq", param => "xxx", input => "5", ret => 0, }, # xxx interpreted as 0 { type => "op", name => "eq", param => "xxx", input => "-1", ret => 0, }, # xxx interpreted as 0 { type => "op", name => "eq", param => "0", input => "xxx", ret => 1, }, # xxx interpreted as 0 { type => "op", name => "eq", param => "5", input => "xxx", ret => 0, }, ### General { type => "op", name => "eq", param => "0", input => "-5", ret => 0, }, { type => "op", name => "eq", param => "0", input => "0", ret => 1, }, { type => "op", name => "eq", param => "0", input => "5", ret => 0, }, { type => "op", name => "eq", param => "5", input => "0", ret => 0, }, { type => "op", name => "eq", param => "5", input => "5", ret => 1, }, { type => "op", name => "eq", param => "5", input => "10", ret => 0, }, modsecurity-apache_2.7.7/tests/op/rx.t0000664000175000017500000000142412243422537020236 0ustar zimmerlezimmerle### Empty { type => "op", name => "rx", param => "", input => "", ret => 1, }, { type => "op", name => "rx", param => "TestCase", input => "", ret => 0, }, { type => "op", name => "rx", param => "", input => "TestCase", ret => 1, }, ### General { type => "op", name => "rx", param => "abc", input => "abcdefghi", ret => 1, }, { type => "op", name => "rx", param => "def", input => "abcdefghi", ret => 1, }, { type => "op", name => "rx", param => "ghi", input => "abcdefghi", ret => 1, }, { type => "op", name => "rx", param => "ghij", input => "abcdefghi", ret => 0, }, ### Complex regex { type => "op", name => "rx", param => "(?i:(sleep\\((\\s*?)(\\d*?)(\\s*?)\\)|benchmark\\((.*?)\\,(.*?)\\)))", input => "SELECT pg_sleep(10);", ret => 1, }, modsecurity-apache_2.7.7/tests/op/validateDTD.t0000664000175000017500000000000112243422537021720 0ustar zimmerlezimmerle modsecurity-apache_2.7.7/tests/op/pm.t0000664000175000017500000001243212243422537020222 0ustar zimmerlezimmerle### Empty { type => "op", name => "pm", param => "TestCase", input => "", ret => 0, }, ### General { type => "op", name => "pm", param => "abc", input => "abcdefghi", ret => 1, }, { type => "op", name => "pm", param => "def", input => "abcdefghi", ret => 1, }, { type => "op", name => "pm", param => "ghi", input => "abcdefghi", ret => 1, }, { type => "op", name => "pm", param => "ghij", input => "abcdefghi", ret => 0, }, ### Multiple { type => "op", name => "pm", param => "abc def ghi", input => "abcxxxyyy", ret => 1, }, { type => "op", name => "pm", param => "abc def ghi", input => "xxxabcyyy", ret => 1, }, { type => "op", name => "pm", param => "abc def ghi", input => "xxxyyyabc", ret => 1, }, { type => "op", name => "pm", param => "abc def ghi", input => "defxxxyyy", ret => 1, }, { type => "op", name => "pm", param => "abc def ghi", input => "xxxdefyyy", ret => 1, }, { type => "op", name => "pm", param => "abc def ghi", input => "xxxyyydef", ret => 1, }, { type => "op", name => "pm", param => "abc def ghi", input => "ghixxxyyy", ret => 1, }, { type => "op", name => "pm", param => "abc def ghi", input => "xxxghiyyy", ret => 1, }, { type => "op", name => "pm", param => "abc def ghi", input => "xxxyyyghi", ret => 1, }, ### Long { type => "op", name => "pm", param => "000 001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017 018 019 020 021 022 023 024 025 026 027 028 029 030 031 032 033 034 035 036 037 038 039 040 041 042 043 044 045 046 047 048 049 050 051 052 053 054 055 056 057 058 059 060 061 062 063 064 065 066 067 068 069 070 071 072 073 074 075 076 077 078 079 080 081 082 083 084 085 086 087 088 089 090 091 092 093 094 095 096 097 098 099 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999", input => "xxxyyy999", ret => 1, }, modsecurity-apache_2.7.7/tests/op/detectSQLi.t0000664000175000017500000000043112243422537021603 0ustar zimmerlezimmerle{ type => "op", name => "detectSQLi", input => "", ret => 0 }, { type => "op", name => "detectSQLi", input => "this is not isqli", ret => 0 }, { type => "op", name => "detectSQLi", input => "ascii(substring(version() from 1 for 1))", ret => 1 } modsecurity-apache_2.7.7/tests/op/containsWord.t0000664000175000017500000000270512243422537022262 0ustar zimmerlezimmerle### Empty { type => "op", name => "containsWord", param => "", input => "", ret => 1, }, { type => "op", name => "containsWord", param => "TestCase", input => "", ret => 0, }, { type => "op", name => "containsWord", param => "", input => "TestCase", ret => 1, }, ### General { type => "op", name => "containsWord", param => "abc", input => "abcdefghi", ret => 0, }, { type => "op", name => "containsWord", param => "def", input => "abcdefghi", ret => 0, }, { type => "op", name => "containsWord", param => "ghi", input => "abcdefghi", ret => 0, }, { type => "op", name => "containsWord", param => "abc", input => "abc def ghi", ret => 1, }, { type => "op", name => "containsWord", param => "def", input => "abc def ghi", ret => 1, }, { type => "op", name => "containsWord", param => "ghi", input => "abc def ghi", ret => 1, }, { type => "op", name => "containsWord", param => "abc", input => "abc\0def ghi", ret => 1, }, { type => "op", name => "containsWord", param => "def", input => "abc\0def ghi", ret => 1, }, { type => "op", name => "containsWord", param => "x", input => "x", ret => 1, }, { type => "op", name => "containsWord", param => "x", input => " x ", ret => 1, }, { type => "op", name => "containsWord", param => "y", input => "xyz", ret => 0, }, { type => "op", name => "containsWord", param => "hiding", input => "hidingX<-not on word boundary, but is later on->hiding", ret => 1, }, modsecurity-apache_2.7.7/tests/op/validateUrlEncoding.t0000664000175000017500000000255412243422537023535 0ustar zimmerlezimmerle### Empty { type => "op", name => "validateUrlEncoding", param => "", input => "", ret => 0, }, ### General { type => "op", name => "validateUrlEncoding", param => "", input => "Hello%20World!", ret => 0, }, { type => "op", name => "validateUrlEncoding", param => "", input => "Hello+World!", ret => 0, }, { type => "op", name => "validateUrlEncoding", param => "", input => "HelloWorld!", ret => 0, }, { type => "op", name => "validateUrlEncoding", param => "", input => "%00Hello%20World!", ret => 0, }, { type => "op", name => "validateUrlEncoding", param => "", input => "Hello%20World!%00", ret => 0, }, { type => "op", name => "validateUrlEncoding", param => "", input => "%00", ret => 0, }, { type => "op", name => "validateUrlEncoding", param => "", input => "%ff", ret => 0, }, { type => "op", name => "validateUrlEncoding", param => "", input => "%0", ret => 1, }, { type => "op", name => "validateUrlEncoding", param => "", input => "%f", ret => 1, }, { type => "op", name => "validateUrlEncoding", param => "", input => "%", ret => 1, }, { type => "op", name => "validateUrlEncoding", param => "", input => "%0z", ret => 1, }, { type => "op", name => "validateUrlEncoding", param => "", input => "%z0", ret => 1, }, { type => "op", name => "validateUrlEncoding", param => "", input => "%0%", ret => 1, }, modsecurity-apache_2.7.7/tests/op/validateUtf8Encoding.t0000664000175000017500000001217212243422537023616 0ustar zimmerlezimmerle### Empty { type => "op", name => "validateUtf8Encoding", param => "", input => "", ret => 0, }, ### Valid "I can eat glass and it does not hurt me." # Greek { type => "op", name => "validateUtf8Encoding", param => "", input => "ὕαλον ϕαγεῖν δύναμαι· τοῦτο οὔ με βλάπτει.", ret => 0, }, # French { type => "op", name => "validateUtf8Encoding", param => "", input => "Je peux manger du verre, ça ne me fait pas de mal.", ret => 0, }, # Spanish { type => "op", name => "validateUtf8Encoding", param => "", input => "Puedo comer vidrio, no me hace daño.", ret => 0, }, # Esparanto { type => "op", name => "validateUtf8Encoding", param => "", input => "Mi povas manĝi vitron, ĝi ne damaĝas min.", ret => 0, }, # Latin { type => "op", name => "validateUtf8Encoding", param => "", input => "Ic mæg glæs eotan ond hit ne hearmiað me.", ret => 0, }, # Serbian { type => "op", name => "validateUtf8Encoding", param => "", input => "Могу јести стакло а да ми не шкоди.", ret => 0, }, # Russian { type => "op", name => "validateUtf8Encoding", param => "", input => "Я могу есть стекло, оно мне не вредит.", ret => 0, }, # Armenian { type => "op", name => "validateUtf8Encoding", param => "", input => "Կրնամ ապակի ուտել և ինծի անհանգիստ չըներ։", ret => 0, }, # Turkish { type => "op", name => "validateUtf8Encoding", param => "", input => "جام ييه بلورم بڭا ضررى طوقونمز", ret => 0, }, # Hindi { type => "op", name => "validateUtf8Encoding", param => "", input => "मैं काँच खा सकता हूँ, मुझे उस से कोई पीडा नहीं होती.", ret => 0, }, # Arabic { type => "op", name => "validateUtf8Encoding", param => "", input => "أنا قادر على أكل الزجاج و هذا لا يؤلمني.", ret => 0, }, # Hebrew { type => "op", name => "validateUtf8Encoding", param => "", input => "אני יכול לאכול זכוכית וזה לא מזיק לי.", ret => 0, }, # Japanese { type => "op", name => "validateUtf8Encoding", param => "", input => "私はガラスを食べられます。それは私を傷つけません。", ret => 0, }, # Thai { type => "op", name => "validateUtf8Encoding", param => "", input => "ฉันกินกระจกได้ แต่มันไม่ทำให้ฉันเจ็บ", ret => 0, }, # Korean { type => "op", name => "validateUtf8Encoding", param => "", input => "나는 유리를 먹을 수 있어요. 그래도 아프지 않아요", ret => 0, }, # Navajo { type => "op", name => "validateUtf8Encoding", param => "", input => "Tsésǫʼ yishą́ągo bííníshghah dóó doo shił neezgai da.", ret => 0, }, # Icelandic { type => "op", name => "validateUtf8Encoding", param => "", input => "Ég get etið gler án þess að meiða mig.", ret => 0, }, # Sanskrit { type => "op", name => "validateUtf8Encoding", param => "", input => "काचं शक्नोम्यत्तुम् । नोपहिनस्ति माम् ॥", ret => 0, }, # English Braille { type => "op", name => "validateUtf8Encoding", param => "", input => "⠊⠀⠉⠁⠝⠀⠑⠁⠞⠀⠛⠇⠁⠎⠎⠀⠁⠝⠙⠀⠊⠞⠀⠙⠕⠑⠎⠝⠞⠀⠓⠥⠗⠞⠀⠍⠑", ret => 0, }, # Danish { type => "op", name => "validateUtf8Encoding", param => "", input => "Jeg kan spise glas, det gør ikke ondt på mig.", ret => 0, }, # Hungarian { type => "op", name => "validateUtf8Encoding", param => "", input => "Meg tudom enni az üveget, nem lesz tőle bajom.", ret => 0, }, # Estonian { type => "op", name => "validateUtf8Encoding", param => "", input => "Ma võin klaasi süüa, see ei tee mulle midagi.", ret => 0, }, # Czech { type => "op", name => "validateUtf8Encoding", param => "", input => "Mohu jíst sklo, neublíží mi.", ret => 0, }, # Slovak { type => "op", name => "validateUtf8Encoding", param => "", input => "Môžem jesť sklo. Nezraní ma.", ret => 0, }, # Polish { type => "op", name => "validateUtf8Encoding", param => "", input => "Mogę jeść szkło i mi nie szkodzi.", ret => 0, }, # Symbols { type => "op", name => "validateUtf8Encoding", param => "", input=>"∮E⋅da=Qn→∞∑f(i)=∏g(i)∀x∈ℝ:⌈x⌉=−⌊−x⌋α∧¬β=¬(¬α∨β)ℕ⊆ℕ₀⊂ℤ⊂ℚ⊂ℝ⊂ℂ⊥ 0, }, ### Invalid # Umlauted a { type => "op", name => "validateUtf8Encoding", param => "", input => "\x00\xe4", ret => 1, }, # Umlauted a { type => "op", name => "validateUtf8Encoding", param => "", input => "\xe4", ret => 1, }, # { type => "op", name => "validateUtf8Encoding", param => "", input => "\x03\xbf", ret => 1, }, # { type => "op", name => "validateUtf8Encoding", param => "", input => "\xc9\x3b", ret => 1, }, ### Invalid Full width # { type => "op", name => "validateUtf8Encoding", param => "", input => "\xFF\x00", ret => 1, }, modsecurity-apache_2.7.7/tests/op/rbl.t0000664000175000017500000000000112243422537020352 0ustar zimmerlezimmerle modsecurity-apache_2.7.7/tests/op/validateSchema.t0000664000175000017500000000000112243422537022505 0ustar zimmerlezimmerle modsecurity-apache_2.7.7/tests/op/unconditionalMatch.t0000664000175000017500000000045112243422537023427 0ustar zimmerlezimmerle### Empty { type => "op", name => "unconditionalMatch", param => "", input => "", ret => 1, }, { type => "op", name => "unconditionalMatch", param => "TestCase", input => "", ret => 1, }, { type => "op", name => "unconditionalMatch", param => "", input => "TestCase", ret => 1, }, modsecurity-apache_2.7.7/tests/op/within.t0000664000175000017500000000117212243422537021107 0ustar zimmerlezimmerle### Empty { type => "op", name => "within", param => "", input => "", ret => 1, }, { type => "op", name => "within", param => "TestCase", input => "", ret => 1, }, { type => "op", name => "within", param => "", input => "TestCase", ret => 0, }, ### General { type => "op", name => "within", param => "abcdefghi", input => "abc", ret => 1, }, { type => "op", name => "within", param => "abcdefghi", input => "def", ret => 1, }, { type => "op", name => "within", param => "abcdefghi", input => "ghi", ret => 1, }, { type => "op", name => "within", param => "abcdefghi", input => "ghij", ret => 0, }, modsecurity-apache_2.7.7/tests/op/validateByteRange.t0000664000175000017500000000137112243422537023200 0ustar zimmerlezimmerle### Empty { type => "op", name => "validateByteRange", param => "0-255", input => "", ret => 0, }, { type => "op", name => "validateByteRange", param => "", input => "TestCase", ret => 1, }, ### Invalid { type => "op", name => "validateByteRange", param => "xxx", input => "TestCase", ret => 1, }, { type => "op", name => "validateByteRange", param => "xxx", input => "\x00", ret => 0, }, ### General { type => "op", name => "validateByteRange", param => "0-255", input => "abcdefghi", ret => 0, }, { type => "op", name => "validateByteRange", param => ord("a")."-".ord("i"), input => "abcdefghi", ret => 0, }, { type => "op", name => "validateByteRange", param => ord("a")."-".ord("i"), input => "abcdefghij", ret => 1, }, modsecurity-apache_2.7.7/tests/op/ge.t0000664000175000017500000000203112243422537020173 0ustar zimmerlezimmerle### Empty { type => "op", name => "ge", param => "0", input => "", ret => 1, }, { type => "op", name => "ge", param => "5", input => "", ret => 0, }, ### Invalid # xxx interpreted as 0 { type => "op", name => "ge", param => "xxx", input => "5", ret => 1, }, # xxx interpreted as 0 { type => "op", name => "ge", param => "xxx", input => "-1", ret => 0, }, # xxx interpreted as 0 { type => "op", name => "ge", param => "0", input => "xxx", ret => 1, }, # xxx interpreted as 0 { type => "op", name => "ge", param => "5", input => "xxx", ret => 0, }, ### General { type => "op", name => "ge", param => "0", input => "-5", ret => 0, }, { type => "op", name => "ge", param => "0", input => "0", ret => 1, }, { type => "op", name => "ge", param => "0", input => "5", ret => 1, }, { type => "op", name => "ge", param => "5", input => "0", ret => 0, }, { type => "op", name => "ge", param => "5", input => "5", ret => 1, }, { type => "op", name => "ge", param => "5", input => "10", ret => 1, }, modsecurity-apache_2.7.7/tests/op/le.t0000664000175000017500000000203112243422537020200 0ustar zimmerlezimmerle### Empty { type => "op", name => "le", param => "0", input => "", ret => 1, }, { type => "op", name => "le", param => "5", input => "", ret => 1, }, ### Invalid # xxx interpreted as 0 { type => "op", name => "le", param => "xxx", input => "5", ret => 0, }, # xxx interpreted as 0 { type => "op", name => "le", param => "xxx", input => "-1", ret => 1, }, # xxx interpreted as 0 { type => "op", name => "le", param => "0", input => "xxx", ret => 1, }, # xxx interpreted as 0 { type => "op", name => "le", param => "5", input => "xxx", ret => 1, }, ### General { type => "op", name => "le", param => "0", input => "-5", ret => 1, }, { type => "op", name => "le", param => "0", input => "0", ret => 1, }, { type => "op", name => "le", param => "0", input => "5", ret => 0, }, { type => "op", name => "le", param => "5", input => "0", ret => 1, }, { type => "op", name => "le", param => "5", input => "5", ret => 1, }, { type => "op", name => "le", param => "5", input => "10", ret => 0, }, modsecurity-apache_2.7.7/tests/op/noMatch.t0000664000175000017500000000041012243422537021170 0ustar zimmerlezimmerle### Empty { type => "op", name => "noMatch", param => "", input => "", ret => 0, }, { type => "op", name => "noMatch", param => "TestCase", input => "", ret => 0, }, { type => "op", name => "noMatch", param => "", input => "TestCase", ret => 0, }, modsecurity-apache_2.7.7/tests/op/inspectFile.t0000664000175000017500000000000112243422537022040 0ustar zimmerlezimmerle modsecurity-apache_2.7.7/tests/op/pmFromFile-01.dat0000664000175000017500000000003012243422537022360 0ustar zimmerlezimmerleabc def ghi xxx yyy zzz modsecurity-apache_2.7.7/tests/op/gt.t0000664000175000017500000000203212243422537020213 0ustar zimmerlezimmerle### Empty { type => "op", name => "gt", param => "0", input => "", ret => 0, }, { type => "op", name => "gt", param => "5", input => "", ret => 0, }, ### Invalid # xxx interpreted as 0 { type => "op", name => "gt", param => "xxx", input => "5", ret => 1, }, # xxx interpreted as 0 { type => "op", name => "gt", param => "xxx", input => "-1", ret => 0, }, # xxx interpreted as 0 { type => "op", name => "gt", param => "-1", input => "xxx", ret => 1, }, # xxx interpreted as 0 { type => "op", name => "gt", param => "5", input => "xxx", ret => 0, }, ### General { type => "op", name => "gt", param => "0", input => "-5", ret => 0, }, { type => "op", name => "gt", param => "0", input => "0", ret => 0, }, { type => "op", name => "gt", param => "0", input => "5", ret => 1, }, { type => "op", name => "gt", param => "5", input => "0", ret => 0, }, { type => "op", name => "gt", param => "5", input => "5", ret => 0, }, { type => "op", name => "gt", param => "5", input => "10", ret => 1, }, modsecurity-apache_2.7.7/tests/op/lt.t0000664000175000017500000000203212243422537020220 0ustar zimmerlezimmerle### Empty { type => "op", name => "lt", param => "0", input => "", ret => 0, }, { type => "op", name => "lt", param => "5", input => "", ret => 1, }, ### Invalid # xxx interpreted as 0 { type => "op", name => "lt", param => "xxx", input => "5", ret => 0, }, # xxx interpreted as 0 { type => "op", name => "lt", param => "xxx", input => "-1", ret => 1, }, # xxx interpreted as 0 { type => "op", name => "lt", param => "-1", input => "xxx", ret => 0, }, # xxx interpreted as 0 { type => "op", name => "lt", param => "5", input => "xxx", ret => 1, }, ### General { type => "op", name => "lt", param => "0", input => "-5", ret => 1, }, { type => "op", name => "lt", param => "0", input => "0", ret => 0, }, { type => "op", name => "lt", param => "0", input => "5", ret => 0, }, { type => "op", name => "lt", param => "5", input => "0", ret => 1, }, { type => "op", name => "lt", param => "5", input => "5", ret => 0, }, { type => "op", name => "lt", param => "5", input => "10", ret => 0, }, modsecurity-apache_2.7.7/tests/op/streq.t0000664000175000017500000000117012243422537020741 0ustar zimmerlezimmerle### Empty { type => "op", name => "streq", param => "", input => "", ret => 1, }, { type => "op", name => "streq", param => "TestCase", input => "", ret => 0, }, { type => "op", name => "streq", param => "", input => "TestCase", ret => 0, }, ### General { type => "op", name => "streq", param => "abc", input => "abcdefghi", ret => 0, }, { type => "op", name => "streq", param => "def", input => "abcdefghi", ret => 0, }, { type => "op", name => "streq", param => "ghi", input => "abcdefghi", ret => 0, }, { type => "op", name => "streq", param => "abcdefghi", input => "abcdefghi", ret => 1, }, modsecurity-apache_2.7.7/tests/op/contains.t0000664000175000017500000000165612243422537021432 0ustar zimmerlezimmerle### Empty { type => "op", name => "contains", param => "", input => "", ret => 1, }, { type => "op", name => "contains", param => "TestCase", input => "", ret => 0, }, { type => "op", name => "contains", param => "", input => "TestCase", ret => 1, }, ### General { type => "op", name => "contains", param => "abc", input => "abcdefghi", ret => 1, }, { type => "op", name => "contains", param => "def", input => "abcdefghi", ret => 1, }, { type => "op", name => "contains", param => "ghi", input => "abcdefghi", ret => 1, }, { type => "op", name => "contains", param => "ghij", input => "abcdefghi", ret => 0, }, { type => "op", name => "contains", param => "x", input => "x", ret => 1, }, { type => "op", name => "contains", param => "y", input => "xyz", ret => 1, }, { type => "op", name => "contains", param => "hiding", input => "hidinX<-not quite, but is later on->hiding", ret => 1, }, modsecurity-apache_2.7.7/tests/op/verifyCC.t0000664000175000017500000002227112243422537021322 0ustar zimmerlezimmerle### Empty # empty w/re not matching empty { type => "op", name => "verifyCC", param => "\d+", input => "", ret => 0, }, # empty w/re matching empty { type => "op", name => "verifyCC", param => '\d*', input => "", ret => 0, }, ### Non-matching { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d+)(?:[^\d]|$)', input => "TestCase", ret => 0, }, ### No digits in match { type => "op", name => "verifyCC", param => 'TestCase', input => "TestCase", ret => 0, }, ### Too generic RE w/no matchs (Luhn will be called until all fail) { type => "op", name => "verifyCC", param => '.*', input => "TestCase", ret => 0, }, ### Test Good CC# # Mastercard { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d+)(?:[^\d]|$)', input => "5484605089158216", ret => 1, }, { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d+)(?:[^\d]|$)', input => "5574407071707154", ret => 1, }, { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d+)(?:[^\d]|$)', input => "5351341509714210", ret => 1, }, { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d+)(?:[^\d]|$)', input => "5585166974020647", ret => 1, }, { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d+)(?:[^\d]|$)', input => "5492180332479256", ret => 1, }, { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d+)(?:[^\d]|$)', input => "5111178142162816", ret => 1, }, { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d+)(?:[^\d]|$)', input => "5511424748431031", ret => 1, }, { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d+)(?:[^\d]|$)', input => "5259964281562326", ret => 1, }, { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d+)(?:[^\d]|$)', input => "5138342589974385", ret => 1, }, { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d+)(?:[^\d]|$)', input => "5362069587634979", ret => 1, }, # VISA 16 digit { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d+)(?:[^\d]|$)', input => "4916545704601136", ret => 1, }, { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d+)(?:[^\d]|$)', input => "4539501231827691", ret => 1, }, { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d+)(?:[^\d]|$)', input => "4556338049595394", ret => 1, }, { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d+)(?:[^\d]|$)', input => "4929326438756024", ret => 1, }, { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d+)(?:[^\d]|$)', input => "4485432027326322", ret => 1, }, { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d+)(?:[^\d]|$)', input => "4532104980682081", ret => 1, }, { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d+)(?:[^\d]|$)', input => "4485974616349298", ret => 1, }, { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d+)(?:[^\d]|$)', input => "4916580487207199", ret => 1, }, { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d+)(?:[^\d]|$)', input => "4532009746910413", ret => 1, }, { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d+)(?:[^\d]|$)', input => "4024007144622932", ret => 1, }, # VISA 13 digit { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d+)(?:[^\d]|$)', input => "4556324125126", ret => 1, }, { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d+)(?:[^\d]|$)', input => "4067482954141", ret => 1, }, { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d+)(?:[^\d]|$)', input => "4532402654980", ret => 1, }, { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d+)(?:[^\d]|$)', input => "4539709679875", ret => 1, }, { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d+)(?:[^\d]|$)', input => "4024007182237", ret => 1, }, # American Express { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d+)(?:[^\d]|$)', input => "343918934573386", ret => 1, }, { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d+)(?:[^\d]|$)', input => "344881778330710", ret => 1, }, { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d+)(?:[^\d]|$)', input => "345439478558905", ret => 1, }, { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d+)(?:[^\d]|$)', input => "346465614421111", ret => 1, }, { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d+)(?:[^\d]|$)', input => "372263817755618", ret => 1, }, # Discover { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d+)(?:[^\d]|$)', input => "6011402777433576", ret => 1, }, { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d+)(?:[^\d]|$)', input => "6011890045362751", ret => 1, }, { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d+)(?:[^\d]|$)', input => "6011439091242416", ret => 1, }, # Diners Club { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d+)(?:[^\d]|$)', input => "30162519308318", ret => 1, }, { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d+)(?:[^\d]|$)', input => "30311556856867", ret => 1, }, { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d+)(?:[^\d]|$)', input => "36850112043985", ret => 1, }, # enRoute { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d+)(?:[^\d]|$)', input => "201427829075664", ret => 1, }, { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d+)(?:[^\d]|$)', input => "201434726660424", ret => 1, }, { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d+)(?:[^\d]|$)', input => "201453368666085", ret => 1, }, # JCB 15 digit { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d+)(?:[^\d]|$)', input => "210091499965007", ret => 1, }, { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d+)(?:[^\d]|$)', input => "210072739882947", ret => 1, }, { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d+)(?:[^\d]|$)', input => "180013970064072", ret => 1, }, # JCB 16 digit { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d+)(?:[^\d]|$)', input => "3096676276259096", ret => 1, }, { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d+)(?:[^\d]|$)', input => "3158726040010070", ret => 1, }, { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d+)(?:[^\d]|$)', input => "3096531217494742", ret => 1, }, # Voyager { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d+)(?:[^\d]|$)', input => "869974262335041", ret => 1, }, { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d+)(?:[^\d]|$)', input => "869905005856398", ret => 1, }, { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d+)(?:[^\d]|$)', input => "869950500085465", ret => 1, }, ### Test Bad CC# { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d+)(?:[^\d]|$)', input => "1234567890012345", ret => 0, }, ### Test regex + Luhn # from http://www.merriampark.com/anatomycc.htm { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d{4}\-?\d{4}\-?\d{2}\-?\d{2}\-?\d{1,4})(?:[^\d]|$)', input => "4417123456789113", ret => 1, }, { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d{4}\-?\d{4}\-?\d{2}\-?\d{2}\-?\d{1,4})(?:[^\d]|$)', input => "4408041234567893", ret => 1, }, { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d{4}\-?\d{4}\-?\d{2}\-?\d{2}\-?\d{1,4})(?:[^\d]|$)', input => "4408041234567890", ret => 0, }, { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d{4}\-?\d{4}\-?\d{2}\-?\d{2}\-?\d{1,4})(?:[^\d]|$)', input => "4417123456789112", ret => 0, }, # on word boundary { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d{4}\-?\d{4}\-?\d{2}\-?\d{2}\-?\d{1,4})(?:[^\d]|$)', input => "a5484605089158216", ret => 1, }, { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d{4}\-?\d{4}\-?\d{2}\-?\d{2}\-?\d{1,4})(?:[^\d]|$)', input => "a5484605089158216b", ret => 1, }, { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d{4}\-?\d{4}\-?\d{2}\-?\d{2}\-?\d{1,4})(?:[^\d]|$)', input => "5484605089158216b", ret => 1, }, # valid patterns { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d{4}\-?\d{4}\-?\d{2}\-?\d{2}\-?\d{1,4})(?:[^\d]|$)', input => "5484-6050-8915-8216", ret => 1, }, # changed digit from table above { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d{4}\-?\d{4}\-?\d{2}\-?\d{2}\-?\d{1,4})(?:[^\d]|$)', input => "5484605089158217", ret => 0, }, { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d{4}\-?\d{4}\-?\d{2}\-?\d{2}\-?\d{1,4})(?:[^\d]|$)', input => "5574407071807154", ret => 0, }, # wrong patterns { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d{4}\-?\d{4}\-?\d{2}\-?\d{2}\-?\d{1,4})(?:[^\d]|$)', input => "5-484-6050-8915-8216", ret => 0, }, { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d{4}\-?\d{4}\-?\d{2}\-?\d{2}\-?\d{1,4})(?:[^\d]|$)', input => "5484 6050 8915 8216", ret => 0, }, # not on digits boundary { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d{4}\-?\d{4}\-?\d{2}\-?\d{2}\-?\d{1,4})(?:[^\d]|$)', input => "15484605089158216", ret => 0, }, { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d{4}\-?\d{4}\-?\d{2}\-?\d{2}\-?\d{1,4})(?:[^\d]|$)', input => "154846050891582162", ret => 0, }, { type => "op", name => "verifyCC", param => '(?:^|[^\d])(\d{4}\-?\d{4}\-?\d{2}\-?\d{2}\-?\d{1,4})(?:[^\d]|$)', input => "54846050891582162", ret => 0, }, modsecurity-apache_2.7.7/tests/op/endsWith.t0000664000175000017500000000121112243422537021364 0ustar zimmerlezimmerle### Empty { type => "op", name => "endsWith", param => "", input => "", ret => 1, }, { type => "op", name => "endsWith", param => "TestCase", input => "", ret => 0, }, { type => "op", name => "endsWith", param => "", input => "TestCase", ret => 1, }, ### General { type => "op", name => "endsWith", param => "abc", input => "abcdefghi", ret => 0, }, { type => "op", name => "endsWith", param => "def", input => "abcdefghi", ret => 0, }, { type => "op", name => "endsWith", param => "ghi", input => "abcdefghi", ret => 1, }, { type => "op", name => "endsWith", param => "ghi", input => "abcdef\0ghi", ret => 1, }, modsecurity-apache_2.7.7/tests/op/strmatch.t0000664000175000017500000000073712243422537021440 0ustar zimmerlezimmerle### Empty { type => "op", name => "strmatch", param => "TestCase", input => "", ret => 0, }, ### General { type => "op", name => "strmatch", param => "abc", input => "abcdefghi", ret => 1, }, { type => "op", name => "strmatch", param => "def", input => "abcdefghi", ret => 1, }, { type => "op", name => "strmatch", param => "ghi", input => "abcdefghi", ret => 1, }, { type => "op", name => "strmatch", param => "ghij", input => "abcdefghi", ret => 0, }, modsecurity-apache_2.7.7/tests/op/pmFromFile.t0000664000175000017500000000126512243422537021650 0ustar zimmerlezimmerle### No Match { type => "op", name => "pmFromFile", param => "op/pmFromFile-01.dat", input => "xxxyyyzzz", ret => 0, }, ### Multiple { type => "op", name => "pmFromFile", param => "op/pmFromFile-01.dat", input => "defxxxyyy", ret => 1, }, { type => "op", name => "pmFromFile", param => "op/pmFromFile-01.dat", input => "xxxdefyyy", ret => 1, }, { type => "op", name => "pmFromFile", param => "op/pmFromFile-01.dat", input => "xxxyyydef", ret => 1, }, { type => "op", name => "pmFromFile", param => "op/pmFromFile-01.dat", input => "xxx yyy zzz", ret => 1, }, { type => "op", name => "pmFromFile", param => "op/pmFromFile-01.dat", input => "xxx yyy", ret => 0, }, modsecurity-apache_2.7.7/tests/op/beginsWith.t0000664000175000017500000000106712243422537021713 0ustar zimmerlezimmerle### Empty { type => "op", name => "beginsWith", param => "", input => "", ret => 1, }, { type => "op", name => "beginsWith", param => "TestCase", input => "", ret => 0, }, { type => "op", name => "beginsWith", param => "", input => "TestCase", ret => 1, }, ### General { type => "op", name => "beginsWith", param => "abcdef", input => "abcdef", ret => 1, }, { type => "op", name => "beginsWith", param => "abcdef", input => "abcdefghi", ret => 1, }, { type => "op", name => "beginsWith", param => "abcdef", input => "abc", ret => 0, }, modsecurity-apache_2.7.7/tests/op/geoLookup.t0000664000175000017500000000106212243422537021547 0ustar zimmerlezimmerle### Empty # NOTE: All will return 0 because of lacking DB { type => "op", name => "geoLookup", param => "", input => "", ret => 0, }, { type => "op", name => "geoLookup", param => "TestCase", input => "", ret => 0, }, # Failed Lookup { type => "op", name => "geoLookup", param => "", input => "127.0.0.1", ret => 0, }, # Good { type => "op", name => "geoLookup", param => "", input => "216.75.21.122", #ret => 1, ret => 0, }, { type => "op", name => "geoLookup", param => "", input => "www.modsecurity.org", #ret => 1, ret => 0, }, modsecurity-apache_2.7.7/tests/csv_rx-pm.pl.in0000775000175000017500000000101112243422537021655 0ustar zimmerlezimmerle#!@PERL@ # # Example to generate CSV performance data from test results taken from # test generated by gen_rx-pm.pl. # use strict; my %H = (); while (<>) { chomp; my ($op, $label, $n, $i, $value) = (m/\s*\d+\)\s+\S+\s+"([^"]*)"\s+(\S+)\s+(\d+) item\(s\): passed\s+\((\d+)\s+\@\s+([-\+\d\.E]+) msec\s.*/); next unless defined($value); $H{$n}{$label} = $value; } printf "%s, %s, %s, %s\n", qw(N rx1 rx2 pm1); for (sort {$a <=> $b} keys %H) { printf "%s, %s, %s, %s\n", $_, $H{$_}{rx1}, $H{$_}{rx2}, $H{$_}{pm1} }; modsecurity-apache_2.7.7/tests/run-unit-tests.pl.in0000775000175000017500000000776412243422537022705 0ustar zimmerlezimmerle#!@PERL@ # # Run unit tests. # # Syntax: # All: run-tests.pl # All in file: run-tests.pl file # Nth in file: run-tests.pl file N # use strict; use POSIX qw(WIFEXITED WEXITSTATUS WIFSIGNALED WTERMSIG); use File::Basename qw(basename dirname); use FileHandle; use IPC::Open2 qw(open2); my @TYPES = qw(tfn op action); my $TEST = "./msc_test"; my $SCRIPT = basename($0); my $SCRIPTDIR = dirname($0); my $PASSED = 0; my $TOTAL = 0; my $DEBUG = $ENV{MSC_TEST_DEBUG} || 0; if (defined $ARGV[0]) { runfile(dirname($ARGV[0]), basename($ARGV[0]), $ARGV[1]); done(); } for my $type (sort @TYPES) { my $dir = "$SCRIPTDIR/$type"; my @cfg = (); # Get test names opendir(DIR, "$dir") or quit(1, "Failed to open \"$dir\": $!"); @cfg = grep { /\.t$/ && -f "$dir/$_" } readdir(DIR); closedir(DIR); for my $cfg (sort @cfg) { runfile($dir, $cfg); } } done(); sub runfile { my($dir, $cfg, $testnum) = @_; my $fn = "$dir/$cfg"; my @data = (); my $edata; my @C = (); my @test = (); my $teststr; my $n = 0; my $pass = 0; open(CFG, "<$fn") or quit(1, "Failed to open \"$fn\": $!"); @data = ; $edata = q/@C = (/ . join("", @data) . q/)/; eval $edata; quit(1, "Failed to read test data \"$cfg\": $@") if ($@); unless (@C) { msg("\nNo tests defined for $fn"); return; } msg("\nLoaded ".@C." tests from $fn"); for my $t (@C) { $n++; next if (defined $testnum and $n != $testnum); my %t = %{$t || {}}; my $id = sprintf("%6d", $n); my $in = (exists($t{input}) and defined($t{input})) ? $t{input} : ""; my $out; my $test_in = new FileHandle(); my $test_out = new FileHandle(); my $test_pid; my $rc = 0; my $param; if ($t{type} eq "tfn") { $param = escape($t{output}); } elsif ($t{type} eq "op") { $param = escape($t{param}); } elsif ($t{type} eq "action") { $param = escape($t{param}); } else { quit(1, "Unknown type \"$t{type}\" - should be one of: " . join(",",@TYPES)); } @test = ("-t", $t{type}, "-n", $t{name}, "-p", $param, "-D", "$DEBUG", (exists($t{ret}) ? ("-r", $t{ret}) : ()), (exists($t{iterations}) ? ("-I", $t{iterations}) : ()), (exists($t{prerun}) ? ("-P", $t{prerun}) : ())); $teststr = "$TEST " . join(" ", map { "\"$_\"" } @test); $test_pid = open2($test_out, $test_in, $TEST, @test) or quit(1, "Failed to execute test: $teststr\": $!"); print $test_in "$in"; close $test_in; $out = join("\\n", split(/\n/, <$test_out>)); close $test_out; waitpid($test_pid, 0); $rc = $?; if ( WIFEXITED($rc) ) { $rc = WEXITSTATUS($rc); } elsif( WIFSIGNALED($rc) ) { msg("Test exited with signal " . WTERMSIG($rc) . "."); msg("Executed: $teststr"); $rc = -1; } else { msg("Test exited with unknown error."); $rc = -1; } if ($rc == 0) { $pass++; } msg(sprintf("%s) %s \"%s\"%s: %s%s", $id, $t{type}, $t{name}, (exists($t{comment}) ? " $t{comment}" : ""), ($rc ? "failed" : "passed"), ((defined($out) && $out ne "")? " ($out)" : ""))); } $TOTAL += $testnum ? 1 : $n; $PASSED += $pass; msg(sprintf("Passed: %2d; Failed: %2d", $pass, $testnum ? (1 - $pass) : ($n - $pass))); } sub escape { my @new = (); for my $c (split(//, $_[0])) { push @new, ((ord($c) >= 0x20 and ord($c) <= 0x7e) ? $c : sprintf("\\x%02x", ord($c))); } join('', @new); } sub msg { print STDOUT "@_\n" if (@_); } sub quit { my($ec,$msg) = @_; $ec = 0 unless (defined $_[0]); msg("$msg") if (defined $msg); exit $ec; } sub done { if ($PASSED != $TOTAL) { quit(1, "\n$PASSED/$TOTAL tests passed."); } quit(0, "\nAll tests passed ($TOTAL)."); } modsecurity-apache_2.7.7/tests/Makefile.in0000664000175000017500000027266612254306021021060 0ustar zimmerlezimmerle# Makefile.in generated by automake 1.13.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ check_PROGRAMS = msc_test$(EXEEXT) subdir = tests DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(srcdir)/run-unit-tests.pl.in \ $(srcdir)/run-regression-tests.pl.in $(srcdir)/gen_rx-pm.pl.in \ $(srcdir)/csv_rx-pm.pl.in $(top_srcdir)/build/depcomp \ $(top_srcdir)/build/test-driver ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/build/find_apr.m4 \ $(top_srcdir)/build/find_apu.m4 \ $(top_srcdir)/build/find_curl.m4 \ $(top_srcdir)/build/find_lua.m4 \ $(top_srcdir)/build/find_pcre.m4 \ $(top_srcdir)/build/find_xml.m4 $(top_srcdir)/build/libtool.m4 \ $(top_srcdir)/build/ltoptions.m4 \ $(top_srcdir)/build/ltsugar.m4 \ $(top_srcdir)/build/ltversion.m4 \ $(top_srcdir)/build/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/apache2/modsecurity_config_auto.h CONFIG_CLEAN_FILES = run-unit-tests.pl run-regression-tests.pl \ gen_rx-pm.pl csv_rx-pm.pl CONFIG_CLEAN_VPATH_FILES = am_msc_test_OBJECTS = msc_test-msc_test.$(OBJEXT) \ msc_test-acmp.$(OBJEXT) msc_test-libinjection_sqli.$(OBJEXT) \ msc_test-modsecurity.$(OBJEXT) msc_test-msc_crypt.$(OBJEXT) \ msc_test-msc_geo.$(OBJEXT) msc_test-msc_gsb.$(OBJEXT) \ msc_test-msc_logging.$(OBJEXT) msc_test-msc_lua.$(OBJEXT) \ msc_test-msc_multipart.$(OBJEXT) \ msc_test-msc_parsers.$(OBJEXT) msc_test-msc_pcre.$(OBJEXT) \ msc_test-msc_release.$(OBJEXT) msc_test-msc_reqbody.$(OBJEXT) \ msc_test-msc_tree.$(OBJEXT) msc_test-msc_unicode.$(OBJEXT) \ msc_test-msc_util.$(OBJEXT) msc_test-msc_xml.$(OBJEXT) \ msc_test-persist_dbm.$(OBJEXT) msc_test-re_actions.$(OBJEXT) \ msc_test-re.$(OBJEXT) msc_test-re_operators.$(OBJEXT) \ msc_test-re_tfns.$(OBJEXT) msc_test-re_variables.$(OBJEXT) \ msc_test-regex.$(OBJEXT) msc_test-server.$(OBJEXT) msc_test_OBJECTS = $(am_msc_test_OBJECTS) msc_test_DEPENDENCIES = AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = msc_test_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(msc_test_CFLAGS) \ $(CFLAGS) $(msc_test_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/apache2 depcomp = $(SHELL) $(top_srcdir)/build/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(msc_test_SOURCES) DIST_SOURCES = $(msc_test_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__tty_colors_dummy = \ mgn= red= grn= lgn= blu= brg= std=; \ am__color_tests=no am__tty_colors = { \ $(am__tty_colors_dummy); \ if test "X$(AM_COLOR_TESTS)" = Xno; then \ am__color_tests=no; \ elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ am__color_tests=yes; \ elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ am__color_tests=yes; \ fi; \ if test $$am__color_tests = yes; then \ red=''; \ grn=''; \ lgn=''; \ blu=''; \ mgn=''; \ brg=''; \ std=''; \ fi; \ } am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__recheck_rx = ^[ ]*:recheck:[ ]* am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* # A command that, given a newline-separated list of test names on the # standard input, print the name of the tests that are to be re-run # upon "make recheck". am__list_recheck_tests = $(AWK) '{ \ recheck = 1; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ { \ if ((getline line2 < ($$0 ".log")) < 0) \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ { \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ { \ break; \ } \ }; \ if (recheck) \ print $$0; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # A command that, given a newline-separated list of test names on the # standard input, create the global log from their .trs and .log files. am__create_global_log = $(AWK) ' \ function fatal(msg) \ { \ print "fatal: making $@: " msg | "cat >&2"; \ exit 1; \ } \ function rst_section(header) \ { \ print header; \ len = length(header); \ for (i = 1; i <= len; i = i + 1) \ printf "="; \ printf "\n\n"; \ } \ { \ copy_in_global_log = 1; \ global_test_result = "RUN"; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".trs"); \ if (line ~ /$(am__global_test_result_rx)/) \ { \ sub("$(am__global_test_result_rx)", "", line); \ sub("[ ]*$$", "", line); \ global_test_result = line; \ } \ else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ copy_in_global_log = 0; \ }; \ if (copy_in_global_log) \ { \ rst_section(global_test_result ": " $$0); \ while ((rc = (getline line < ($$0 ".log"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".log"); \ print line; \ }; \ printf "\n"; \ }; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # Restructured Text title. am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } # Solaris 10 'make', and several other traditional 'make' implementations, # pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it # by disabling -e (using the XSI extension "set +e") if it's set. am__sh_e_setup = case $$- in *e*) set +e;; esac # Default flags passed to test drivers. am__common_driver_flags = \ --color-tests "$$am__color_tests" \ --enable-hard-errors "$$am__enable_hard_errors" \ --expect-failure "$$am__expect_failure" # To be inserted before the command running the test. Creates the # directory for the log if needed. Stores in $dir the directory # containing $f, in $tst the test, in $log the log. Executes the # developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and # passes TESTS_ENVIRONMENT. Set up options for the wrapper that # will run the test scripts (or their associated LOG_COMPILER, if # thy have one). am__check_pre = \ $(am__sh_e_setup); \ $(am__vpath_adj_setup) $(am__vpath_adj) \ $(am__tty_colors); \ srcdir=$(srcdir); export srcdir; \ case "$@" in \ */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ *) am__odir=.;; \ esac; \ test "x$$am__odir" = x"." || test -d "$$am__odir" \ || $(MKDIR_P) "$$am__odir" || exit $$?; \ if test -f "./$$f"; then dir=./; \ elif test -f "$$f"; then dir=; \ else dir="$(srcdir)/"; fi; \ tst=$$dir$$f; log='$@'; \ if test -n '$(DISABLE_HARD_ERRORS)'; then \ am__enable_hard_errors=no; \ else \ am__enable_hard_errors=yes; \ fi; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ am__expect_failure=yes;; \ *) \ am__expect_failure=no;; \ esac; \ $(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) # A shell command to get the names of the tests scripts with any registered # extension removed (i.e., equivalently, the names of the test logs, with # the '.log' extension removed). The result is saved in the shell variable # '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, # we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", # since that might cause problem with VPATH rewrites for suffix-less tests. # See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. am__set_TESTS_bases = \ bases='$(TEST_LOGS)'; \ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ bases=`echo $$bases` RECHECK_LOGS = $(TEST_LOGS) AM_RECURSIVE_TARGETS = check recheck TEST_SUITE_LOG = test-suite.log TEST_EXTENSIONS = @EXEEXT@ .test LOG_DRIVER = $(SHELL) $(top_srcdir)/build/test-driver LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) am__set_b = \ case '$@' in \ */*) \ case '$*' in \ */*) b='$*';; \ *) b=`echo '$@' | sed 's/\.log$$//'`; \ esac;; \ *) \ b='$*';; \ esac am__test_logs1 = $(TESTS:=.log) am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) TEST_LOGS = $(am__test_logs2:.test.log=.log) TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/build/test-driver TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ $(TEST_LOG_FLAGS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APR_CFLAGS = @APR_CFLAGS@ APR_CONFIG = @APR_CONFIG@ APR_CPPFLAGS = @APR_CPPFLAGS@ APR_INCLUDEDIR = @APR_INCLUDEDIR@ APR_LDADD = @APR_LDADD@ APR_LDFLAGS = @APR_LDFLAGS@ APR_LINKLD = @APR_LINKLD@ APR_VERSION = @APR_VERSION@ APU_CFLAGS = @APU_CFLAGS@ APU_CONFIG = @APU_CONFIG@ APU_INCLUDEDIR = @APU_INCLUDEDIR@ APU_LDADD = @APU_LDADD@ APU_LDFLAGS = @APU_LDFLAGS@ APU_LINKLD = @APU_LINKLD@ APU_VERSION = @APU_VERSION@ APXS = @APXS@ APXS_BINDIR = @APXS_BINDIR@ APXS_CC = @APXS_CC@ APXS_CFLAGS = @APXS_CFLAGS@ APXS_EXTRA_CFLAGS = @APXS_EXTRA_CFLAGS@ APXS_HTTPD = @APXS_HTTPD@ APXS_INCLUDEDIR = @APXS_INCLUDEDIR@ APXS_INCLUDES = @APXS_INCLUDES@ APXS_LDFLAGS = @APXS_LDFLAGS@ APXS_LIBDIR = @APXS_LIBDIR@ APXS_LIBEXECDIR = @APXS_LIBEXECDIR@ APXS_LIBS = @APXS_LIBS@ APXS_LIBTOOL = @APXS_LIBTOOL@ APXS_MODULES = @APXS_MODULES@ APXS_PROGNAME = @APXS_PROGNAME@ APXS_SBINDIR = @APXS_SBINDIR@ APXS_WRAPPER = @APXS_WRAPPER@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CURL_CFLAGS = @CURL_CFLAGS@ CURL_CONFIG = @CURL_CONFIG@ CURL_CPPFLAGS = @CURL_CPPFLAGS@ CURL_LDADD = @CURL_LDADD@ CURL_LDFLAGS = @CURL_LDFLAGS@ CURL_USES_GNUTLS = @CURL_USES_GNUTLS@ CURL_VERSION = @CURL_VERSION@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENV_CMD = @ENV_CMD@ EXEEXT = @EXEEXT@ EXTRA_CFLAGS = @EXTRA_CFLAGS@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ LIBXML2_CONFIG = @LIBXML2_CONFIG@ LIBXML2_CPPFLAGS = @LIBXML2_CPPFLAGS@ LIBXML2_LDADD = @LIBXML2_LDADD@ LIBXML2_LDFLAGS = @LIBXML2_LDFLAGS@ LIBXML2_VERSION = @LIBXML2_VERSION@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LUA_CFLAGS = @LUA_CFLAGS@ LUA_LDADD = @LUA_LDADD@ LUA_LDFLAGS = @LUA_LDFLAGS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MODSEC_APXS_EXTRA_CFLAGS = @MODSEC_APXS_EXTRA_CFLAGS@ MODSEC_EXTRA_CFLAGS = @MODSEC_EXTRA_CFLAGS@ MSC_BASE_DIR = @MSC_BASE_DIR@ MSC_PKGBASE_DIR = @MSC_PKGBASE_DIR@ MSC_REGRESSION_CONF_DIR = @MSC_REGRESSION_CONF_DIR@ MSC_REGRESSION_DIR = @MSC_REGRESSION_DIR@ MSC_REGRESSION_DOCROOT_DIR = @MSC_REGRESSION_DOCROOT_DIR@ MSC_REGRESSION_LOGS_DIR = @MSC_REGRESSION_LOGS_DIR@ MSC_REGRESSION_SERVERROOT_DIR = @MSC_REGRESSION_SERVERROOT_DIR@ MSC_TEST_DIR = @MSC_TEST_DIR@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCRE_CFLAGS = @PCRE_CFLAGS@ PCRE_CONFIG = @PCRE_CONFIG@ PCRE_CPPFLAGS = @PCRE_CPPFLAGS@ PCRE_LDADD = @PCRE_LDADD@ PCRE_LDFLAGS = @PCRE_LDFLAGS@ PCRE_LD_PATH = @PCRE_LD_PATH@ PCRE_VERSION = @PCRE_VERSION@ PERL = @PERL@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOPLEVEL_SUBDIRS = @TOPLEVEL_SUBDIRS@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ msc_test_SOURCES = msc_test.c \ $(top_srcdir)/apache2/acmp.c \ $(top_srcdir)/apache2/libinjection/libinjection_sqli.c \ $(top_srcdir)/apache2/modsecurity.c \ $(top_srcdir)/apache2/msc_crypt.c \ $(top_srcdir)/apache2/msc_geo.c \ $(top_srcdir)/apache2/msc_gsb.c \ $(top_srcdir)/apache2/msc_logging.c \ $(top_srcdir)/apache2/msc_lua.c \ $(top_srcdir)/apache2/msc_multipart.c \ $(top_srcdir)/apache2/msc_parsers.c \ $(top_srcdir)/apache2/msc_pcre.c \ $(top_srcdir)/apache2/msc_release.c \ $(top_srcdir)/apache2/msc_reqbody.c \ $(top_srcdir)/apache2/msc_tree.c \ $(top_srcdir)/apache2/msc_unicode.c \ $(top_srcdir)/apache2/msc_util.c \ $(top_srcdir)/apache2/msc_xml.c \ $(top_srcdir)/apache2/persist_dbm.c \ $(top_srcdir)/apache2/re_actions.c \ $(top_srcdir)/apache2/re.c \ $(top_srcdir)/apache2/re_operators.c \ $(top_srcdir)/apache2/re_tfns.c \ $(top_srcdir)/apache2/re_variables.c \ $(top_srcdir)/standalone/regex.c \ $(top_srcdir)/standalone/server.c msc_test_CFLAGS = @APR_CFLAGS@ \ @APU_CFLAGS@ \ @APXS_CFLAGS@ \ @LIBXML2_CFLAGS@ \ @LUA_CFLAGS@ \ @MODSEC_EXTRA_CFLAGS@ \ @PCRE_CFLAGS@ msc_test_CPPFLAGS = -I$(top_srcdir)/apache2 \ @APR_CPPFLAGS@ \ @LIBXML2_CPPFLAGS@ \ @PCRE_CPPFLAGS@ msc_test_LDADD = @APR_LDADD@ \ @APU_LDADD@ \ @LIBXML2_LDADD@ \ @LUA_LDADD@ \ @PCRE_LDADD@ msc_test_LDFLAGS = @APR_LDFLAGS@ \ @APU_LDFLAGS@ \ @APXS_LDFLAGS@ \ @LIBXML2_LDFLAGS@ \ @LUA_LDFLAGS@ \ @PCRE_LDFLAGS@ check_SCRIPTS = run-unit-tests.pl TESTS = $(check_SCRIPTS) all: all-am .SUFFIXES: .SUFFIXES: .c .lo .log .o .obj .test .test$(EXEEXT) .trs $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tests/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign tests/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): run-unit-tests.pl: $(top_builddir)/config.status $(srcdir)/run-unit-tests.pl.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ run-regression-tests.pl: $(top_builddir)/config.status $(srcdir)/run-regression-tests.pl.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ gen_rx-pm.pl: $(top_builddir)/config.status $(srcdir)/gen_rx-pm.pl.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ csv_rx-pm.pl: $(top_builddir)/config.status $(srcdir)/csv_rx-pm.pl.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ clean-checkPROGRAMS: @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list msc_test$(EXEEXT): $(msc_test_OBJECTS) $(msc_test_DEPENDENCIES) $(EXTRA_msc_test_DEPENDENCIES) @rm -f msc_test$(EXEEXT) $(AM_V_CCLD)$(msc_test_LINK) $(msc_test_OBJECTS) $(msc_test_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/msc_test-acmp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/msc_test-libinjection_sqli.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/msc_test-modsecurity.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/msc_test-msc_crypt.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/msc_test-msc_geo.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/msc_test-msc_gsb.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/msc_test-msc_logging.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/msc_test-msc_lua.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/msc_test-msc_multipart.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/msc_test-msc_parsers.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/msc_test-msc_pcre.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/msc_test-msc_release.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/msc_test-msc_reqbody.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/msc_test-msc_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/msc_test-msc_tree.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/msc_test-msc_unicode.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/msc_test-msc_util.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/msc_test-msc_xml.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/msc_test-persist_dbm.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/msc_test-re.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/msc_test-re_actions.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/msc_test-re_operators.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/msc_test-re_tfns.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/msc_test-re_variables.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/msc_test-regex.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/msc_test-server.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< msc_test-msc_test.o: msc_test.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -MT msc_test-msc_test.o -MD -MP -MF $(DEPDIR)/msc_test-msc_test.Tpo -c -o msc_test-msc_test.o `test -f 'msc_test.c' || echo '$(srcdir)/'`msc_test.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/msc_test-msc_test.Tpo $(DEPDIR)/msc_test-msc_test.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='msc_test.c' object='msc_test-msc_test.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -c -o msc_test-msc_test.o `test -f 'msc_test.c' || echo '$(srcdir)/'`msc_test.c msc_test-msc_test.obj: msc_test.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -MT msc_test-msc_test.obj -MD -MP -MF $(DEPDIR)/msc_test-msc_test.Tpo -c -o msc_test-msc_test.obj `if test -f 'msc_test.c'; then $(CYGPATH_W) 'msc_test.c'; else $(CYGPATH_W) '$(srcdir)/msc_test.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/msc_test-msc_test.Tpo $(DEPDIR)/msc_test-msc_test.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='msc_test.c' object='msc_test-msc_test.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -c -o msc_test-msc_test.obj `if test -f 'msc_test.c'; then $(CYGPATH_W) 'msc_test.c'; else $(CYGPATH_W) '$(srcdir)/msc_test.c'; fi` msc_test-acmp.o: $(top_srcdir)/apache2/acmp.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -MT msc_test-acmp.o -MD -MP -MF $(DEPDIR)/msc_test-acmp.Tpo -c -o msc_test-acmp.o `test -f '$(top_srcdir)/apache2/acmp.c' || echo '$(srcdir)/'`$(top_srcdir)/apache2/acmp.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/msc_test-acmp.Tpo $(DEPDIR)/msc_test-acmp.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/apache2/acmp.c' object='msc_test-acmp.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -c -o msc_test-acmp.o `test -f '$(top_srcdir)/apache2/acmp.c' || echo '$(srcdir)/'`$(top_srcdir)/apache2/acmp.c msc_test-acmp.obj: $(top_srcdir)/apache2/acmp.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -MT msc_test-acmp.obj -MD -MP -MF $(DEPDIR)/msc_test-acmp.Tpo -c -o msc_test-acmp.obj `if test -f '$(top_srcdir)/apache2/acmp.c'; then $(CYGPATH_W) '$(top_srcdir)/apache2/acmp.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/apache2/acmp.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/msc_test-acmp.Tpo $(DEPDIR)/msc_test-acmp.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/apache2/acmp.c' object='msc_test-acmp.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -c -o msc_test-acmp.obj `if test -f '$(top_srcdir)/apache2/acmp.c'; then $(CYGPATH_W) '$(top_srcdir)/apache2/acmp.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/apache2/acmp.c'; fi` msc_test-libinjection_sqli.o: $(top_srcdir)/apache2/libinjection/libinjection_sqli.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -MT msc_test-libinjection_sqli.o -MD -MP -MF $(DEPDIR)/msc_test-libinjection_sqli.Tpo -c -o msc_test-libinjection_sqli.o `test -f '$(top_srcdir)/apache2/libinjection/libinjection_sqli.c' || echo '$(srcdir)/'`$(top_srcdir)/apache2/libinjection/libinjection_sqli.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/msc_test-libinjection_sqli.Tpo $(DEPDIR)/msc_test-libinjection_sqli.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/apache2/libinjection/libinjection_sqli.c' object='msc_test-libinjection_sqli.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -c -o msc_test-libinjection_sqli.o `test -f '$(top_srcdir)/apache2/libinjection/libinjection_sqli.c' || echo '$(srcdir)/'`$(top_srcdir)/apache2/libinjection/libinjection_sqli.c msc_test-libinjection_sqli.obj: $(top_srcdir)/apache2/libinjection/libinjection_sqli.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -MT msc_test-libinjection_sqli.obj -MD -MP -MF $(DEPDIR)/msc_test-libinjection_sqli.Tpo -c -o msc_test-libinjection_sqli.obj `if test -f '$(top_srcdir)/apache2/libinjection/libinjection_sqli.c'; then $(CYGPATH_W) '$(top_srcdir)/apache2/libinjection/libinjection_sqli.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/apache2/libinjection/libinjection_sqli.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/msc_test-libinjection_sqli.Tpo $(DEPDIR)/msc_test-libinjection_sqli.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/apache2/libinjection/libinjection_sqli.c' object='msc_test-libinjection_sqli.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -c -o msc_test-libinjection_sqli.obj `if test -f '$(top_srcdir)/apache2/libinjection/libinjection_sqli.c'; then $(CYGPATH_W) '$(top_srcdir)/apache2/libinjection/libinjection_sqli.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/apache2/libinjection/libinjection_sqli.c'; fi` msc_test-modsecurity.o: $(top_srcdir)/apache2/modsecurity.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -MT msc_test-modsecurity.o -MD -MP -MF $(DEPDIR)/msc_test-modsecurity.Tpo -c -o msc_test-modsecurity.o `test -f '$(top_srcdir)/apache2/modsecurity.c' || echo '$(srcdir)/'`$(top_srcdir)/apache2/modsecurity.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/msc_test-modsecurity.Tpo $(DEPDIR)/msc_test-modsecurity.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/apache2/modsecurity.c' object='msc_test-modsecurity.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -c -o msc_test-modsecurity.o `test -f '$(top_srcdir)/apache2/modsecurity.c' || echo '$(srcdir)/'`$(top_srcdir)/apache2/modsecurity.c msc_test-modsecurity.obj: $(top_srcdir)/apache2/modsecurity.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -MT msc_test-modsecurity.obj -MD -MP -MF $(DEPDIR)/msc_test-modsecurity.Tpo -c -o msc_test-modsecurity.obj `if test -f '$(top_srcdir)/apache2/modsecurity.c'; then $(CYGPATH_W) '$(top_srcdir)/apache2/modsecurity.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/apache2/modsecurity.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/msc_test-modsecurity.Tpo $(DEPDIR)/msc_test-modsecurity.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/apache2/modsecurity.c' object='msc_test-modsecurity.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -c -o msc_test-modsecurity.obj `if test -f '$(top_srcdir)/apache2/modsecurity.c'; then $(CYGPATH_W) '$(top_srcdir)/apache2/modsecurity.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/apache2/modsecurity.c'; fi` msc_test-msc_crypt.o: $(top_srcdir)/apache2/msc_crypt.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -MT msc_test-msc_crypt.o -MD -MP -MF $(DEPDIR)/msc_test-msc_crypt.Tpo -c -o msc_test-msc_crypt.o `test -f '$(top_srcdir)/apache2/msc_crypt.c' || echo '$(srcdir)/'`$(top_srcdir)/apache2/msc_crypt.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/msc_test-msc_crypt.Tpo $(DEPDIR)/msc_test-msc_crypt.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/apache2/msc_crypt.c' object='msc_test-msc_crypt.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -c -o msc_test-msc_crypt.o `test -f '$(top_srcdir)/apache2/msc_crypt.c' || echo '$(srcdir)/'`$(top_srcdir)/apache2/msc_crypt.c msc_test-msc_crypt.obj: $(top_srcdir)/apache2/msc_crypt.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -MT msc_test-msc_crypt.obj -MD -MP -MF $(DEPDIR)/msc_test-msc_crypt.Tpo -c -o msc_test-msc_crypt.obj `if test -f '$(top_srcdir)/apache2/msc_crypt.c'; then $(CYGPATH_W) '$(top_srcdir)/apache2/msc_crypt.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/apache2/msc_crypt.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/msc_test-msc_crypt.Tpo $(DEPDIR)/msc_test-msc_crypt.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/apache2/msc_crypt.c' object='msc_test-msc_crypt.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -c -o msc_test-msc_crypt.obj `if test -f '$(top_srcdir)/apache2/msc_crypt.c'; then $(CYGPATH_W) '$(top_srcdir)/apache2/msc_crypt.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/apache2/msc_crypt.c'; fi` msc_test-msc_geo.o: $(top_srcdir)/apache2/msc_geo.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -MT msc_test-msc_geo.o -MD -MP -MF $(DEPDIR)/msc_test-msc_geo.Tpo -c -o msc_test-msc_geo.o `test -f '$(top_srcdir)/apache2/msc_geo.c' || echo '$(srcdir)/'`$(top_srcdir)/apache2/msc_geo.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/msc_test-msc_geo.Tpo $(DEPDIR)/msc_test-msc_geo.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/apache2/msc_geo.c' object='msc_test-msc_geo.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -c -o msc_test-msc_geo.o `test -f '$(top_srcdir)/apache2/msc_geo.c' || echo '$(srcdir)/'`$(top_srcdir)/apache2/msc_geo.c msc_test-msc_geo.obj: $(top_srcdir)/apache2/msc_geo.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -MT msc_test-msc_geo.obj -MD -MP -MF $(DEPDIR)/msc_test-msc_geo.Tpo -c -o msc_test-msc_geo.obj `if test -f '$(top_srcdir)/apache2/msc_geo.c'; then $(CYGPATH_W) '$(top_srcdir)/apache2/msc_geo.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/apache2/msc_geo.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/msc_test-msc_geo.Tpo $(DEPDIR)/msc_test-msc_geo.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/apache2/msc_geo.c' object='msc_test-msc_geo.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -c -o msc_test-msc_geo.obj `if test -f '$(top_srcdir)/apache2/msc_geo.c'; then $(CYGPATH_W) '$(top_srcdir)/apache2/msc_geo.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/apache2/msc_geo.c'; fi` msc_test-msc_gsb.o: $(top_srcdir)/apache2/msc_gsb.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -MT msc_test-msc_gsb.o -MD -MP -MF $(DEPDIR)/msc_test-msc_gsb.Tpo -c -o msc_test-msc_gsb.o `test -f '$(top_srcdir)/apache2/msc_gsb.c' || echo '$(srcdir)/'`$(top_srcdir)/apache2/msc_gsb.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/msc_test-msc_gsb.Tpo $(DEPDIR)/msc_test-msc_gsb.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/apache2/msc_gsb.c' object='msc_test-msc_gsb.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -c -o msc_test-msc_gsb.o `test -f '$(top_srcdir)/apache2/msc_gsb.c' || echo '$(srcdir)/'`$(top_srcdir)/apache2/msc_gsb.c msc_test-msc_gsb.obj: $(top_srcdir)/apache2/msc_gsb.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -MT msc_test-msc_gsb.obj -MD -MP -MF $(DEPDIR)/msc_test-msc_gsb.Tpo -c -o msc_test-msc_gsb.obj `if test -f '$(top_srcdir)/apache2/msc_gsb.c'; then $(CYGPATH_W) '$(top_srcdir)/apache2/msc_gsb.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/apache2/msc_gsb.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/msc_test-msc_gsb.Tpo $(DEPDIR)/msc_test-msc_gsb.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/apache2/msc_gsb.c' object='msc_test-msc_gsb.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -c -o msc_test-msc_gsb.obj `if test -f '$(top_srcdir)/apache2/msc_gsb.c'; then $(CYGPATH_W) '$(top_srcdir)/apache2/msc_gsb.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/apache2/msc_gsb.c'; fi` msc_test-msc_logging.o: $(top_srcdir)/apache2/msc_logging.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -MT msc_test-msc_logging.o -MD -MP -MF $(DEPDIR)/msc_test-msc_logging.Tpo -c -o msc_test-msc_logging.o `test -f '$(top_srcdir)/apache2/msc_logging.c' || echo '$(srcdir)/'`$(top_srcdir)/apache2/msc_logging.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/msc_test-msc_logging.Tpo $(DEPDIR)/msc_test-msc_logging.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/apache2/msc_logging.c' object='msc_test-msc_logging.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -c -o msc_test-msc_logging.o `test -f '$(top_srcdir)/apache2/msc_logging.c' || echo '$(srcdir)/'`$(top_srcdir)/apache2/msc_logging.c msc_test-msc_logging.obj: $(top_srcdir)/apache2/msc_logging.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -MT msc_test-msc_logging.obj -MD -MP -MF $(DEPDIR)/msc_test-msc_logging.Tpo -c -o msc_test-msc_logging.obj `if test -f '$(top_srcdir)/apache2/msc_logging.c'; then $(CYGPATH_W) '$(top_srcdir)/apache2/msc_logging.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/apache2/msc_logging.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/msc_test-msc_logging.Tpo $(DEPDIR)/msc_test-msc_logging.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/apache2/msc_logging.c' object='msc_test-msc_logging.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -c -o msc_test-msc_logging.obj `if test -f '$(top_srcdir)/apache2/msc_logging.c'; then $(CYGPATH_W) '$(top_srcdir)/apache2/msc_logging.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/apache2/msc_logging.c'; fi` msc_test-msc_lua.o: $(top_srcdir)/apache2/msc_lua.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -MT msc_test-msc_lua.o -MD -MP -MF $(DEPDIR)/msc_test-msc_lua.Tpo -c -o msc_test-msc_lua.o `test -f '$(top_srcdir)/apache2/msc_lua.c' || echo '$(srcdir)/'`$(top_srcdir)/apache2/msc_lua.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/msc_test-msc_lua.Tpo $(DEPDIR)/msc_test-msc_lua.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/apache2/msc_lua.c' object='msc_test-msc_lua.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -c -o msc_test-msc_lua.o `test -f '$(top_srcdir)/apache2/msc_lua.c' || echo '$(srcdir)/'`$(top_srcdir)/apache2/msc_lua.c msc_test-msc_lua.obj: $(top_srcdir)/apache2/msc_lua.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -MT msc_test-msc_lua.obj -MD -MP -MF $(DEPDIR)/msc_test-msc_lua.Tpo -c -o msc_test-msc_lua.obj `if test -f '$(top_srcdir)/apache2/msc_lua.c'; then $(CYGPATH_W) '$(top_srcdir)/apache2/msc_lua.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/apache2/msc_lua.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/msc_test-msc_lua.Tpo $(DEPDIR)/msc_test-msc_lua.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/apache2/msc_lua.c' object='msc_test-msc_lua.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -c -o msc_test-msc_lua.obj `if test -f '$(top_srcdir)/apache2/msc_lua.c'; then $(CYGPATH_W) '$(top_srcdir)/apache2/msc_lua.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/apache2/msc_lua.c'; fi` msc_test-msc_multipart.o: $(top_srcdir)/apache2/msc_multipart.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -MT msc_test-msc_multipart.o -MD -MP -MF $(DEPDIR)/msc_test-msc_multipart.Tpo -c -o msc_test-msc_multipart.o `test -f '$(top_srcdir)/apache2/msc_multipart.c' || echo '$(srcdir)/'`$(top_srcdir)/apache2/msc_multipart.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/msc_test-msc_multipart.Tpo $(DEPDIR)/msc_test-msc_multipart.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/apache2/msc_multipart.c' object='msc_test-msc_multipart.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -c -o msc_test-msc_multipart.o `test -f '$(top_srcdir)/apache2/msc_multipart.c' || echo '$(srcdir)/'`$(top_srcdir)/apache2/msc_multipart.c msc_test-msc_multipart.obj: $(top_srcdir)/apache2/msc_multipart.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -MT msc_test-msc_multipart.obj -MD -MP -MF $(DEPDIR)/msc_test-msc_multipart.Tpo -c -o msc_test-msc_multipart.obj `if test -f '$(top_srcdir)/apache2/msc_multipart.c'; then $(CYGPATH_W) '$(top_srcdir)/apache2/msc_multipart.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/apache2/msc_multipart.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/msc_test-msc_multipart.Tpo $(DEPDIR)/msc_test-msc_multipart.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/apache2/msc_multipart.c' object='msc_test-msc_multipart.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -c -o msc_test-msc_multipart.obj `if test -f '$(top_srcdir)/apache2/msc_multipart.c'; then $(CYGPATH_W) '$(top_srcdir)/apache2/msc_multipart.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/apache2/msc_multipart.c'; fi` msc_test-msc_parsers.o: $(top_srcdir)/apache2/msc_parsers.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -MT msc_test-msc_parsers.o -MD -MP -MF $(DEPDIR)/msc_test-msc_parsers.Tpo -c -o msc_test-msc_parsers.o `test -f '$(top_srcdir)/apache2/msc_parsers.c' || echo '$(srcdir)/'`$(top_srcdir)/apache2/msc_parsers.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/msc_test-msc_parsers.Tpo $(DEPDIR)/msc_test-msc_parsers.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/apache2/msc_parsers.c' object='msc_test-msc_parsers.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -c -o msc_test-msc_parsers.o `test -f '$(top_srcdir)/apache2/msc_parsers.c' || echo '$(srcdir)/'`$(top_srcdir)/apache2/msc_parsers.c msc_test-msc_parsers.obj: $(top_srcdir)/apache2/msc_parsers.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -MT msc_test-msc_parsers.obj -MD -MP -MF $(DEPDIR)/msc_test-msc_parsers.Tpo -c -o msc_test-msc_parsers.obj `if test -f '$(top_srcdir)/apache2/msc_parsers.c'; then $(CYGPATH_W) '$(top_srcdir)/apache2/msc_parsers.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/apache2/msc_parsers.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/msc_test-msc_parsers.Tpo $(DEPDIR)/msc_test-msc_parsers.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/apache2/msc_parsers.c' object='msc_test-msc_parsers.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -c -o msc_test-msc_parsers.obj `if test -f '$(top_srcdir)/apache2/msc_parsers.c'; then $(CYGPATH_W) '$(top_srcdir)/apache2/msc_parsers.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/apache2/msc_parsers.c'; fi` msc_test-msc_pcre.o: $(top_srcdir)/apache2/msc_pcre.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -MT msc_test-msc_pcre.o -MD -MP -MF $(DEPDIR)/msc_test-msc_pcre.Tpo -c -o msc_test-msc_pcre.o `test -f '$(top_srcdir)/apache2/msc_pcre.c' || echo '$(srcdir)/'`$(top_srcdir)/apache2/msc_pcre.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/msc_test-msc_pcre.Tpo $(DEPDIR)/msc_test-msc_pcre.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/apache2/msc_pcre.c' object='msc_test-msc_pcre.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -c -o msc_test-msc_pcre.o `test -f '$(top_srcdir)/apache2/msc_pcre.c' || echo '$(srcdir)/'`$(top_srcdir)/apache2/msc_pcre.c msc_test-msc_pcre.obj: $(top_srcdir)/apache2/msc_pcre.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -MT msc_test-msc_pcre.obj -MD -MP -MF $(DEPDIR)/msc_test-msc_pcre.Tpo -c -o msc_test-msc_pcre.obj `if test -f '$(top_srcdir)/apache2/msc_pcre.c'; then $(CYGPATH_W) '$(top_srcdir)/apache2/msc_pcre.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/apache2/msc_pcre.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/msc_test-msc_pcre.Tpo $(DEPDIR)/msc_test-msc_pcre.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/apache2/msc_pcre.c' object='msc_test-msc_pcre.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -c -o msc_test-msc_pcre.obj `if test -f '$(top_srcdir)/apache2/msc_pcre.c'; then $(CYGPATH_W) '$(top_srcdir)/apache2/msc_pcre.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/apache2/msc_pcre.c'; fi` msc_test-msc_release.o: $(top_srcdir)/apache2/msc_release.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -MT msc_test-msc_release.o -MD -MP -MF $(DEPDIR)/msc_test-msc_release.Tpo -c -o msc_test-msc_release.o `test -f '$(top_srcdir)/apache2/msc_release.c' || echo '$(srcdir)/'`$(top_srcdir)/apache2/msc_release.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/msc_test-msc_release.Tpo $(DEPDIR)/msc_test-msc_release.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/apache2/msc_release.c' object='msc_test-msc_release.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -c -o msc_test-msc_release.o `test -f '$(top_srcdir)/apache2/msc_release.c' || echo '$(srcdir)/'`$(top_srcdir)/apache2/msc_release.c msc_test-msc_release.obj: $(top_srcdir)/apache2/msc_release.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -MT msc_test-msc_release.obj -MD -MP -MF $(DEPDIR)/msc_test-msc_release.Tpo -c -o msc_test-msc_release.obj `if test -f '$(top_srcdir)/apache2/msc_release.c'; then $(CYGPATH_W) '$(top_srcdir)/apache2/msc_release.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/apache2/msc_release.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/msc_test-msc_release.Tpo $(DEPDIR)/msc_test-msc_release.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/apache2/msc_release.c' object='msc_test-msc_release.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -c -o msc_test-msc_release.obj `if test -f '$(top_srcdir)/apache2/msc_release.c'; then $(CYGPATH_W) '$(top_srcdir)/apache2/msc_release.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/apache2/msc_release.c'; fi` msc_test-msc_reqbody.o: $(top_srcdir)/apache2/msc_reqbody.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -MT msc_test-msc_reqbody.o -MD -MP -MF $(DEPDIR)/msc_test-msc_reqbody.Tpo -c -o msc_test-msc_reqbody.o `test -f '$(top_srcdir)/apache2/msc_reqbody.c' || echo '$(srcdir)/'`$(top_srcdir)/apache2/msc_reqbody.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/msc_test-msc_reqbody.Tpo $(DEPDIR)/msc_test-msc_reqbody.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/apache2/msc_reqbody.c' object='msc_test-msc_reqbody.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -c -o msc_test-msc_reqbody.o `test -f '$(top_srcdir)/apache2/msc_reqbody.c' || echo '$(srcdir)/'`$(top_srcdir)/apache2/msc_reqbody.c msc_test-msc_reqbody.obj: $(top_srcdir)/apache2/msc_reqbody.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -MT msc_test-msc_reqbody.obj -MD -MP -MF $(DEPDIR)/msc_test-msc_reqbody.Tpo -c -o msc_test-msc_reqbody.obj `if test -f '$(top_srcdir)/apache2/msc_reqbody.c'; then $(CYGPATH_W) '$(top_srcdir)/apache2/msc_reqbody.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/apache2/msc_reqbody.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/msc_test-msc_reqbody.Tpo $(DEPDIR)/msc_test-msc_reqbody.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/apache2/msc_reqbody.c' object='msc_test-msc_reqbody.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -c -o msc_test-msc_reqbody.obj `if test -f '$(top_srcdir)/apache2/msc_reqbody.c'; then $(CYGPATH_W) '$(top_srcdir)/apache2/msc_reqbody.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/apache2/msc_reqbody.c'; fi` msc_test-msc_tree.o: $(top_srcdir)/apache2/msc_tree.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -MT msc_test-msc_tree.o -MD -MP -MF $(DEPDIR)/msc_test-msc_tree.Tpo -c -o msc_test-msc_tree.o `test -f '$(top_srcdir)/apache2/msc_tree.c' || echo '$(srcdir)/'`$(top_srcdir)/apache2/msc_tree.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/msc_test-msc_tree.Tpo $(DEPDIR)/msc_test-msc_tree.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/apache2/msc_tree.c' object='msc_test-msc_tree.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -c -o msc_test-msc_tree.o `test -f '$(top_srcdir)/apache2/msc_tree.c' || echo '$(srcdir)/'`$(top_srcdir)/apache2/msc_tree.c msc_test-msc_tree.obj: $(top_srcdir)/apache2/msc_tree.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -MT msc_test-msc_tree.obj -MD -MP -MF $(DEPDIR)/msc_test-msc_tree.Tpo -c -o msc_test-msc_tree.obj `if test -f '$(top_srcdir)/apache2/msc_tree.c'; then $(CYGPATH_W) '$(top_srcdir)/apache2/msc_tree.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/apache2/msc_tree.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/msc_test-msc_tree.Tpo $(DEPDIR)/msc_test-msc_tree.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/apache2/msc_tree.c' object='msc_test-msc_tree.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -c -o msc_test-msc_tree.obj `if test -f '$(top_srcdir)/apache2/msc_tree.c'; then $(CYGPATH_W) '$(top_srcdir)/apache2/msc_tree.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/apache2/msc_tree.c'; fi` msc_test-msc_unicode.o: $(top_srcdir)/apache2/msc_unicode.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -MT msc_test-msc_unicode.o -MD -MP -MF $(DEPDIR)/msc_test-msc_unicode.Tpo -c -o msc_test-msc_unicode.o `test -f '$(top_srcdir)/apache2/msc_unicode.c' || echo '$(srcdir)/'`$(top_srcdir)/apache2/msc_unicode.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/msc_test-msc_unicode.Tpo $(DEPDIR)/msc_test-msc_unicode.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/apache2/msc_unicode.c' object='msc_test-msc_unicode.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -c -o msc_test-msc_unicode.o `test -f '$(top_srcdir)/apache2/msc_unicode.c' || echo '$(srcdir)/'`$(top_srcdir)/apache2/msc_unicode.c msc_test-msc_unicode.obj: $(top_srcdir)/apache2/msc_unicode.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -MT msc_test-msc_unicode.obj -MD -MP -MF $(DEPDIR)/msc_test-msc_unicode.Tpo -c -o msc_test-msc_unicode.obj `if test -f '$(top_srcdir)/apache2/msc_unicode.c'; then $(CYGPATH_W) '$(top_srcdir)/apache2/msc_unicode.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/apache2/msc_unicode.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/msc_test-msc_unicode.Tpo $(DEPDIR)/msc_test-msc_unicode.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/apache2/msc_unicode.c' object='msc_test-msc_unicode.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -c -o msc_test-msc_unicode.obj `if test -f '$(top_srcdir)/apache2/msc_unicode.c'; then $(CYGPATH_W) '$(top_srcdir)/apache2/msc_unicode.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/apache2/msc_unicode.c'; fi` msc_test-msc_util.o: $(top_srcdir)/apache2/msc_util.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -MT msc_test-msc_util.o -MD -MP -MF $(DEPDIR)/msc_test-msc_util.Tpo -c -o msc_test-msc_util.o `test -f '$(top_srcdir)/apache2/msc_util.c' || echo '$(srcdir)/'`$(top_srcdir)/apache2/msc_util.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/msc_test-msc_util.Tpo $(DEPDIR)/msc_test-msc_util.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/apache2/msc_util.c' object='msc_test-msc_util.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -c -o msc_test-msc_util.o `test -f '$(top_srcdir)/apache2/msc_util.c' || echo '$(srcdir)/'`$(top_srcdir)/apache2/msc_util.c msc_test-msc_util.obj: $(top_srcdir)/apache2/msc_util.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -MT msc_test-msc_util.obj -MD -MP -MF $(DEPDIR)/msc_test-msc_util.Tpo -c -o msc_test-msc_util.obj `if test -f '$(top_srcdir)/apache2/msc_util.c'; then $(CYGPATH_W) '$(top_srcdir)/apache2/msc_util.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/apache2/msc_util.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/msc_test-msc_util.Tpo $(DEPDIR)/msc_test-msc_util.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/apache2/msc_util.c' object='msc_test-msc_util.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -c -o msc_test-msc_util.obj `if test -f '$(top_srcdir)/apache2/msc_util.c'; then $(CYGPATH_W) '$(top_srcdir)/apache2/msc_util.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/apache2/msc_util.c'; fi` msc_test-msc_xml.o: $(top_srcdir)/apache2/msc_xml.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -MT msc_test-msc_xml.o -MD -MP -MF $(DEPDIR)/msc_test-msc_xml.Tpo -c -o msc_test-msc_xml.o `test -f '$(top_srcdir)/apache2/msc_xml.c' || echo '$(srcdir)/'`$(top_srcdir)/apache2/msc_xml.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/msc_test-msc_xml.Tpo $(DEPDIR)/msc_test-msc_xml.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/apache2/msc_xml.c' object='msc_test-msc_xml.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -c -o msc_test-msc_xml.o `test -f '$(top_srcdir)/apache2/msc_xml.c' || echo '$(srcdir)/'`$(top_srcdir)/apache2/msc_xml.c msc_test-msc_xml.obj: $(top_srcdir)/apache2/msc_xml.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -MT msc_test-msc_xml.obj -MD -MP -MF $(DEPDIR)/msc_test-msc_xml.Tpo -c -o msc_test-msc_xml.obj `if test -f '$(top_srcdir)/apache2/msc_xml.c'; then $(CYGPATH_W) '$(top_srcdir)/apache2/msc_xml.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/apache2/msc_xml.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/msc_test-msc_xml.Tpo $(DEPDIR)/msc_test-msc_xml.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/apache2/msc_xml.c' object='msc_test-msc_xml.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -c -o msc_test-msc_xml.obj `if test -f '$(top_srcdir)/apache2/msc_xml.c'; then $(CYGPATH_W) '$(top_srcdir)/apache2/msc_xml.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/apache2/msc_xml.c'; fi` msc_test-persist_dbm.o: $(top_srcdir)/apache2/persist_dbm.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -MT msc_test-persist_dbm.o -MD -MP -MF $(DEPDIR)/msc_test-persist_dbm.Tpo -c -o msc_test-persist_dbm.o `test -f '$(top_srcdir)/apache2/persist_dbm.c' || echo '$(srcdir)/'`$(top_srcdir)/apache2/persist_dbm.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/msc_test-persist_dbm.Tpo $(DEPDIR)/msc_test-persist_dbm.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/apache2/persist_dbm.c' object='msc_test-persist_dbm.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -c -o msc_test-persist_dbm.o `test -f '$(top_srcdir)/apache2/persist_dbm.c' || echo '$(srcdir)/'`$(top_srcdir)/apache2/persist_dbm.c msc_test-persist_dbm.obj: $(top_srcdir)/apache2/persist_dbm.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -MT msc_test-persist_dbm.obj -MD -MP -MF $(DEPDIR)/msc_test-persist_dbm.Tpo -c -o msc_test-persist_dbm.obj `if test -f '$(top_srcdir)/apache2/persist_dbm.c'; then $(CYGPATH_W) '$(top_srcdir)/apache2/persist_dbm.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/apache2/persist_dbm.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/msc_test-persist_dbm.Tpo $(DEPDIR)/msc_test-persist_dbm.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/apache2/persist_dbm.c' object='msc_test-persist_dbm.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -c -o msc_test-persist_dbm.obj `if test -f '$(top_srcdir)/apache2/persist_dbm.c'; then $(CYGPATH_W) '$(top_srcdir)/apache2/persist_dbm.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/apache2/persist_dbm.c'; fi` msc_test-re_actions.o: $(top_srcdir)/apache2/re_actions.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -MT msc_test-re_actions.o -MD -MP -MF $(DEPDIR)/msc_test-re_actions.Tpo -c -o msc_test-re_actions.o `test -f '$(top_srcdir)/apache2/re_actions.c' || echo '$(srcdir)/'`$(top_srcdir)/apache2/re_actions.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/msc_test-re_actions.Tpo $(DEPDIR)/msc_test-re_actions.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/apache2/re_actions.c' object='msc_test-re_actions.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -c -o msc_test-re_actions.o `test -f '$(top_srcdir)/apache2/re_actions.c' || echo '$(srcdir)/'`$(top_srcdir)/apache2/re_actions.c msc_test-re_actions.obj: $(top_srcdir)/apache2/re_actions.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -MT msc_test-re_actions.obj -MD -MP -MF $(DEPDIR)/msc_test-re_actions.Tpo -c -o msc_test-re_actions.obj `if test -f '$(top_srcdir)/apache2/re_actions.c'; then $(CYGPATH_W) '$(top_srcdir)/apache2/re_actions.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/apache2/re_actions.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/msc_test-re_actions.Tpo $(DEPDIR)/msc_test-re_actions.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/apache2/re_actions.c' object='msc_test-re_actions.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -c -o msc_test-re_actions.obj `if test -f '$(top_srcdir)/apache2/re_actions.c'; then $(CYGPATH_W) '$(top_srcdir)/apache2/re_actions.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/apache2/re_actions.c'; fi` msc_test-re.o: $(top_srcdir)/apache2/re.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -MT msc_test-re.o -MD -MP -MF $(DEPDIR)/msc_test-re.Tpo -c -o msc_test-re.o `test -f '$(top_srcdir)/apache2/re.c' || echo '$(srcdir)/'`$(top_srcdir)/apache2/re.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/msc_test-re.Tpo $(DEPDIR)/msc_test-re.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/apache2/re.c' object='msc_test-re.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -c -o msc_test-re.o `test -f '$(top_srcdir)/apache2/re.c' || echo '$(srcdir)/'`$(top_srcdir)/apache2/re.c msc_test-re.obj: $(top_srcdir)/apache2/re.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -MT msc_test-re.obj -MD -MP -MF $(DEPDIR)/msc_test-re.Tpo -c -o msc_test-re.obj `if test -f '$(top_srcdir)/apache2/re.c'; then $(CYGPATH_W) '$(top_srcdir)/apache2/re.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/apache2/re.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/msc_test-re.Tpo $(DEPDIR)/msc_test-re.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/apache2/re.c' object='msc_test-re.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -c -o msc_test-re.obj `if test -f '$(top_srcdir)/apache2/re.c'; then $(CYGPATH_W) '$(top_srcdir)/apache2/re.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/apache2/re.c'; fi` msc_test-re_operators.o: $(top_srcdir)/apache2/re_operators.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -MT msc_test-re_operators.o -MD -MP -MF $(DEPDIR)/msc_test-re_operators.Tpo -c -o msc_test-re_operators.o `test -f '$(top_srcdir)/apache2/re_operators.c' || echo '$(srcdir)/'`$(top_srcdir)/apache2/re_operators.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/msc_test-re_operators.Tpo $(DEPDIR)/msc_test-re_operators.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/apache2/re_operators.c' object='msc_test-re_operators.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -c -o msc_test-re_operators.o `test -f '$(top_srcdir)/apache2/re_operators.c' || echo '$(srcdir)/'`$(top_srcdir)/apache2/re_operators.c msc_test-re_operators.obj: $(top_srcdir)/apache2/re_operators.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -MT msc_test-re_operators.obj -MD -MP -MF $(DEPDIR)/msc_test-re_operators.Tpo -c -o msc_test-re_operators.obj `if test -f '$(top_srcdir)/apache2/re_operators.c'; then $(CYGPATH_W) '$(top_srcdir)/apache2/re_operators.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/apache2/re_operators.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/msc_test-re_operators.Tpo $(DEPDIR)/msc_test-re_operators.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/apache2/re_operators.c' object='msc_test-re_operators.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -c -o msc_test-re_operators.obj `if test -f '$(top_srcdir)/apache2/re_operators.c'; then $(CYGPATH_W) '$(top_srcdir)/apache2/re_operators.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/apache2/re_operators.c'; fi` msc_test-re_tfns.o: $(top_srcdir)/apache2/re_tfns.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -MT msc_test-re_tfns.o -MD -MP -MF $(DEPDIR)/msc_test-re_tfns.Tpo -c -o msc_test-re_tfns.o `test -f '$(top_srcdir)/apache2/re_tfns.c' || echo '$(srcdir)/'`$(top_srcdir)/apache2/re_tfns.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/msc_test-re_tfns.Tpo $(DEPDIR)/msc_test-re_tfns.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/apache2/re_tfns.c' object='msc_test-re_tfns.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -c -o msc_test-re_tfns.o `test -f '$(top_srcdir)/apache2/re_tfns.c' || echo '$(srcdir)/'`$(top_srcdir)/apache2/re_tfns.c msc_test-re_tfns.obj: $(top_srcdir)/apache2/re_tfns.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -MT msc_test-re_tfns.obj -MD -MP -MF $(DEPDIR)/msc_test-re_tfns.Tpo -c -o msc_test-re_tfns.obj `if test -f '$(top_srcdir)/apache2/re_tfns.c'; then $(CYGPATH_W) '$(top_srcdir)/apache2/re_tfns.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/apache2/re_tfns.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/msc_test-re_tfns.Tpo $(DEPDIR)/msc_test-re_tfns.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/apache2/re_tfns.c' object='msc_test-re_tfns.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -c -o msc_test-re_tfns.obj `if test -f '$(top_srcdir)/apache2/re_tfns.c'; then $(CYGPATH_W) '$(top_srcdir)/apache2/re_tfns.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/apache2/re_tfns.c'; fi` msc_test-re_variables.o: $(top_srcdir)/apache2/re_variables.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -MT msc_test-re_variables.o -MD -MP -MF $(DEPDIR)/msc_test-re_variables.Tpo -c -o msc_test-re_variables.o `test -f '$(top_srcdir)/apache2/re_variables.c' || echo '$(srcdir)/'`$(top_srcdir)/apache2/re_variables.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/msc_test-re_variables.Tpo $(DEPDIR)/msc_test-re_variables.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/apache2/re_variables.c' object='msc_test-re_variables.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -c -o msc_test-re_variables.o `test -f '$(top_srcdir)/apache2/re_variables.c' || echo '$(srcdir)/'`$(top_srcdir)/apache2/re_variables.c msc_test-re_variables.obj: $(top_srcdir)/apache2/re_variables.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -MT msc_test-re_variables.obj -MD -MP -MF $(DEPDIR)/msc_test-re_variables.Tpo -c -o msc_test-re_variables.obj `if test -f '$(top_srcdir)/apache2/re_variables.c'; then $(CYGPATH_W) '$(top_srcdir)/apache2/re_variables.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/apache2/re_variables.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/msc_test-re_variables.Tpo $(DEPDIR)/msc_test-re_variables.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/apache2/re_variables.c' object='msc_test-re_variables.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -c -o msc_test-re_variables.obj `if test -f '$(top_srcdir)/apache2/re_variables.c'; then $(CYGPATH_W) '$(top_srcdir)/apache2/re_variables.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/apache2/re_variables.c'; fi` msc_test-regex.o: $(top_srcdir)/standalone/regex.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -MT msc_test-regex.o -MD -MP -MF $(DEPDIR)/msc_test-regex.Tpo -c -o msc_test-regex.o `test -f '$(top_srcdir)/standalone/regex.c' || echo '$(srcdir)/'`$(top_srcdir)/standalone/regex.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/msc_test-regex.Tpo $(DEPDIR)/msc_test-regex.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/standalone/regex.c' object='msc_test-regex.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -c -o msc_test-regex.o `test -f '$(top_srcdir)/standalone/regex.c' || echo '$(srcdir)/'`$(top_srcdir)/standalone/regex.c msc_test-regex.obj: $(top_srcdir)/standalone/regex.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -MT msc_test-regex.obj -MD -MP -MF $(DEPDIR)/msc_test-regex.Tpo -c -o msc_test-regex.obj `if test -f '$(top_srcdir)/standalone/regex.c'; then $(CYGPATH_W) '$(top_srcdir)/standalone/regex.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/standalone/regex.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/msc_test-regex.Tpo $(DEPDIR)/msc_test-regex.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/standalone/regex.c' object='msc_test-regex.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -c -o msc_test-regex.obj `if test -f '$(top_srcdir)/standalone/regex.c'; then $(CYGPATH_W) '$(top_srcdir)/standalone/regex.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/standalone/regex.c'; fi` msc_test-server.o: $(top_srcdir)/standalone/server.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -MT msc_test-server.o -MD -MP -MF $(DEPDIR)/msc_test-server.Tpo -c -o msc_test-server.o `test -f '$(top_srcdir)/standalone/server.c' || echo '$(srcdir)/'`$(top_srcdir)/standalone/server.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/msc_test-server.Tpo $(DEPDIR)/msc_test-server.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/standalone/server.c' object='msc_test-server.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -c -o msc_test-server.o `test -f '$(top_srcdir)/standalone/server.c' || echo '$(srcdir)/'`$(top_srcdir)/standalone/server.c msc_test-server.obj: $(top_srcdir)/standalone/server.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -MT msc_test-server.obj -MD -MP -MF $(DEPDIR)/msc_test-server.Tpo -c -o msc_test-server.obj `if test -f '$(top_srcdir)/standalone/server.c'; then $(CYGPATH_W) '$(top_srcdir)/standalone/server.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/standalone/server.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/msc_test-server.Tpo $(DEPDIR)/msc_test-server.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/standalone/server.c' object='msc_test-server.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(msc_test_CPPFLAGS) $(CPPFLAGS) $(msc_test_CFLAGS) $(CFLAGS) -c -o msc_test-server.obj `if test -f '$(top_srcdir)/standalone/server.c'; then $(CYGPATH_W) '$(top_srcdir)/standalone/server.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/standalone/server.c'; fi` mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags # Recover from deleted '.trs' file; this should ensure that # "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create # both 'foo.log' and 'foo.trs'. Break the recipe in two subshells # to avoid problems with "make -n". .log.trs: rm -f $< $@ $(MAKE) $(AM_MAKEFLAGS) $< # Leading 'am--fnord' is there to ensure the list of targets does not # expand to empty, as could happen e.g. with make check TESTS=''. am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) am--force-recheck: @: $(TEST_SUITE_LOG): $(TEST_LOGS) @$(am__set_TESTS_bases); \ am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ redo_bases=`for i in $$bases; do \ am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ done`; \ if test -n "$$redo_bases"; then \ redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ if $(am__make_dryrun); then :; else \ rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ fi; \ fi; \ if test -n "$$am__remaking_logs"; then \ echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ "recursion detected" >&2; \ else \ am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ fi; \ if $(am__make_dryrun); then :; else \ st=0; \ errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ for i in $$redo_bases; do \ test -f $$i.trs && test -r $$i.trs \ || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ test -f $$i.log && test -r $$i.log \ || { echo "$$errmsg $$i.log" >&2; st=1; }; \ done; \ test $$st -eq 0 || exit 1; \ fi @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ ws='[ ]'; \ results=`for b in $$bases; do echo $$b.trs; done`; \ test -n "$$results" || results=/dev/null; \ all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ if test `expr $$fail + $$xpass + $$error` -eq 0; then \ success=true; \ else \ success=false; \ fi; \ br='==================='; br=$$br$$br$$br$$br; \ result_count () \ { \ if test x"$$1" = x"--maybe-color"; then \ maybe_colorize=yes; \ elif test x"$$1" = x"--no-color"; then \ maybe_colorize=no; \ else \ echo "$@: invalid 'result_count' usage" >&2; exit 4; \ fi; \ shift; \ desc=$$1 count=$$2; \ if test $$maybe_colorize = yes && test $$count -gt 0; then \ color_start=$$3 color_end=$$std; \ else \ color_start= color_end=; \ fi; \ echo "$${color_start}# $$desc $$count$${color_end}"; \ }; \ create_testsuite_report () \ { \ result_count $$1 "TOTAL:" $$all "$$brg"; \ result_count $$1 "PASS: " $$pass "$$grn"; \ result_count $$1 "SKIP: " $$skip "$$blu"; \ result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ result_count $$1 "FAIL: " $$fail "$$red"; \ result_count $$1 "XPASS:" $$xpass "$$red"; \ result_count $$1 "ERROR:" $$error "$$mgn"; \ }; \ { \ echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ $(am__rst_title); \ create_testsuite_report --no-color; \ echo; \ echo ".. contents:: :depth: 2"; \ echo; \ for b in $$bases; do echo $$b; done \ | $(am__create_global_log); \ } >$(TEST_SUITE_LOG).tmp || exit 1; \ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ if $$success; then \ col="$$grn"; \ else \ col="$$red"; \ test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ fi; \ echo "$${col}$$br$${std}"; \ echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ echo "$${col}$$br$${std}"; \ create_testsuite_report --maybe-color; \ echo "$$col$$br$$std"; \ if $$success; then :; else \ echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ if test -n "$(PACKAGE_BUGREPORT)"; then \ echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ fi; \ echo "$$col$$br$$std"; \ fi; \ $$success || exit 1 check-TESTS: @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ log_list=`for i in $$bases; do echo $$i.log; done`; \ trs_list=`for i in $$bases; do echo $$i.trs; done`; \ log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ exit $$?; recheck: all $(check_PROGRAMS) $(check_SCRIPTS) @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ bases=`for i in $$bases; do echo $$i; done \ | $(am__list_recheck_tests)` || exit 1; \ log_list=`for i in $$bases; do echo $$i.log; done`; \ log_list=`echo $$log_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ am__force_recheck=am--force-recheck \ TEST_LOGS="$$log_list"; \ exit $$? run-unit-tests.pl.log: run-unit-tests.pl @p='run-unit-tests.pl'; \ b='run-unit-tests.pl'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) .test.log: @p='$<'; \ $(am__set_b); \ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) @am__EXEEXT_TRUE@.test$(EXEEXT).log: @am__EXEEXT_TRUE@ @p='$<'; \ @am__EXEEXT_TRUE@ $(am__set_b); \ @am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ @am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ @am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ @am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(check_SCRIPTS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-TESTS check-am clean \ clean-checkPROGRAMS clean-generic clean-libtool cscopelist-am \ ctags ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ recheck tags tags-am uninstall uninstall-am test: check test-regression: run-regression-tests.pl $(PERL) run-regression-tests.pl .PHONY: test test-regression # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: modsecurity-apache_2.7.7/tests/gen_rx-pm.pl.in0000775000175000017500000000354212243422537021646 0ustar zimmerlezimmerle#!@PERL@ # # Generates a test file for comparing @rx and @pm speed. # use strict; use Regexp::Assemble; srand(424242); # We want this static, so we can compare different runs my $MIN = $ARGV[0] || 0; my $MAX = $ARGV[1] || 5000; my $INC = $ARGV[2] || int($MAX * .05); my $ITERATIONS = 10000; my $MINSTRLEN = 2; my $MAXSTRLEN = 8; my $match = join '', ('a' .. 'z'); my @param = (); my $i=$MIN; while ($i <= $MAX) { my $ra = Regexp::Assemble->new; while (@param < $i) { unshift @param, rndstr(); } $ra->add(@param); printf ( "# rx: %6d\n". "{\n". " comment => \"rx1 %6d item(s)\",\n". " type => \"op\",\n". " name => \"rx\",\n". " param => qr/%s/,\n". " input => \"%s\",\n". " ret => " . (@param ? 0 : 1) . ",". " iterations => %d,\n". "},\n", $i, $i, (@param ? '(?:' . join('|', @param) . ')' : ""), $match, $ITERATIONS, ); printf ( "# rx-optimized: %6d\n". "{\n". " comment => \"rx2 %6d item(s)\",\n". " type => \"op\",\n". " name => \"rx\",\n". " param => qr/%s/,\n". " input => \"%s\",\n". " ret => " . (@param ? 0 : 1) . ",". " iterations => %d,\n". "},\n", $i, $i, (@param ? $ra->as_string : ""), $match, $ITERATIONS, ); printf ( "# pm: %6d\n". "{\n". " comment => \"pm1 %6d item(s)\",\n". " type => \"op\",\n". " name => \"pm\",\n". " param => \"%s\",\n". " input => \"%s\",\n". " ret => 0,". " iterations => %d,\n". "},\n", $i, $i, join(' ', @param ? @param : ("''")), $match, $ITERATIONS, ); $i = ($i == $MIN) ? ($i + $INC) - ($i % $INC) : $i + $INC; } sub rndstr { my @c = ('a' .. 'z'); my $rndstr; my $max = int(rand($MAXSTRLEN - $MINSTRLEN)) + $MINSTRLEN; foreach (1 .. $max) { $rndstr .= $c[rand @c]; } # We need a string that is not in another string for "last" if ($match =~ m/$rndstr/) { $rndstr = rndstr(); } return $rndstr; } modsecurity-apache_2.7.7/tools/0000775000175000017500000000000012254306021016766 5ustar zimmerlezimmerlemodsecurity-apache_2.7.7/tools/rules-updater-example.conf0000664000175000017500000000127012243422537024073 0ustar zimmerlezimmerle# This is an example configuration to be used with ruleset-updator.pl -c # The repository URI. RepositoryURI http://username:password@www.example.tld/repository/ # Where to download the rulesets to LocalRepository /path/to/repository # Where to unpack the rulesets (if Unpack is true) LocalRules /path/to/repository # What version (or version prefix) to use #Version 1.5 # Should we unpack the ruleset to LocalRules? Unpack True # Email update notifications #NotifyEmail "modsec-admin@example.tld, someone@example.tld" #NotifyEmailFrom "ModSec Rules Updater " # Output lots of debugging info? Debug False modsecurity-apache_2.7.7/tools/Makefile.am0000664000175000017500000000003712243422537021033 0ustar zimmerlezimmerlebin_SCRIPTS = rules-updater.pl modsecurity-apache_2.7.7/tools/README0000664000175000017500000000031312243422537017654 0ustar zimmerlezimmerleThese tools are built during the ModSecurity configure process run under the apache2 directory. To use them you will first need to run configure under the apache2 directory: ./configure [any options] modsecurity-apache_2.7.7/tools/rules-updater.pl.in0000664000175000017500000003076512243422537022550 0ustar zimmerlezimmerle#!@PERL@ # # Fetches the latest ModSecurity Ruleset # use strict; use Sys::Hostname; use LWP::UserAgent (); use LWP::Debug qw(-); use URI (); use HTTP::Date (); use Cwd qw(getcwd); use Getopt::Std; my $VERSION = "0.0.1"; my($SCRIPT) = ($0 =~ m/([^\/\\]+)$/); my $CRLFRE = qr/\015?\012/; my $HOST = Sys::Hostname::hostname(); my $UNZIP = [qw(unzip -a)]; my $SENDMAIL = [qw(/usr/lib/sendmail -oi -t)]; my $HAVE_GNUPG = 0; my %PREFIX_MAP = ( -dev => 0, -rc => 1, "" => 9, ); my %GPG_TRUST = (); my $REQUIRED_SIG_TRUST; eval "use GnuPG qw(:trust)"; if ($@) { warn "Could not load GnuPG module - cannot verify ruleset signatures\n"; } else { $HAVE_GNUPG = 1; %GPG_TRUST = ( &TRUST_UNDEFINED => "not", &TRUST_NEVER => "not", &TRUST_MARGINAL => "marginally", &TRUST_FULLY => "fully", &TRUST_ULTIMATE => "ultimatly", ); $REQUIRED_SIG_TRUST = &TRUST_FULLY; } ################################################################################ ################################################################################ my @fetched = (); my %opt = (); getopts('c:r:p:s:v:t:e:f:EuS:D:R:U:F:L:ldh', \%opt); usage(1) if(defined $opt{h}); usage(1) if(@ARGV > 1); # Make sure we have an action if (! grep { defined } @opt{qw(S D R U F L l)}) { usage(1, "Action required."); } # Merge config with commandline opts if ($opt{c}) { %opt = parse_config($opt{c}, \%opt); } LWP::Debug::level("+") if ($opt{d}); # Make the version into a regex if (defined $opt{v}) { my($a,$b,$c,$d) = ($opt{v} =~ m/^(\d+)\.?(\d+)?\.?(\d+)?(?:-(\D+\d+$)|($))/); if (defined $d) { (my $key = $d) =~ s/^(\D+)\d+$/-$1/; unless (exists $PREFIX_MAP{$key}) { usage(1, "Invalid version (bad suffix \"$d\"): $opt{v}"); } $opt{v} = qr/^$a\.$b\.$c-$d$/; } elsif (defined $c) { $opt{v} = qr/^$a\.$b\.$c(?:-|$)/; } elsif (defined $b) { $opt{v} = qr/^$a\.$b\./; } elsif (defined $a) { $opt{v} = qr/^$a\./; } else { usage(1, "Invalid version: $opt{v}"); } if ($opt{d}) { print STDERR "Using version regex: $opt{v}\n"; } } else { $opt{v} = qr/^/; } # Remove trailing slashes from uri and path $opt{r} =~ s/\/+$//; $opt{p} =~ s/\/+$//; # Required opts usage(1, "Repository (-r) required.") unless(defined $opt{r}); usage(1, "Local path (-p) required.") unless(defined $opt{p} or defined $opt{l}); my $ua = LWP::UserAgent->new( agent => "ModSecurity Updator/$VERSION", keep_alive => 1, env_proxy => 1, max_redirect => 5, requests_redirectable => [qw(GET HEAD)], timeout => ($opt{t} || 600), ); sub usage { my $rc = defined($$_[0]) ? $_[0] : 0; my $msg = defined($_[1]) ? "\n$_[1]\n\n" : ""; print STDERR << "EOT"; ${msg}Usage: $SCRIPT [-c config_file] [[options] [action] Options (commandline will override config file): -r uri RepositoryURI Repository URI. -p path LocalRepository Local repository path to use as base for downloads. -s path LocalRules Local rules base path to use for unpacking. -v text Version Full/partial version (EX: 1, 1.5, 1.5.2, 1.5.2-dev3) -t secs Timeout Timeout for fetching data in seconds (default 600). -e addr NotifyEmail Notify via email on update (comma separated list). -f addr NotifyEmailFrom From address for notification email. -u Unpack Unpack into LocalRules/version path. -d Debug Print out lots of debugging. Actions: -S name Fetch the latest stable ruleset, "name" -D name Fetch the latest development ruleset, "name" -R name Fetch the latest release candidate ruleset, "name" -U name Fetch the latest unstable (non-stable) ruleset, "name" -F name Fetch the latest ruleset, "name" -l Print listing of what is available Misc: -c Specify a config file for options. -h This help Examples: # Get a list of what the repository contains: $SCRIPT -rhttp://host/repo/ -l # Get a partial list of versions 1.5.x: $SCRIPT -rhttp://host/repo/ -v1.5 -l # Get the latest stable version of "breach_ModSecurityCoreRules": $SCRIPT -rhttp://host/repo/ -p/my/repo -Sbreach_ModSecurityCoreRules # Get the latest stable 1.5 release of "breach_ModSecurityCoreRules": $SCRIPT -rhttp://host/repo/ -p/my/repo -v1.5 -Sbreach_ModSecurityCoreRules EOT exit $rc; } sub sort_versions { (my $A = $a) =~ s/^(\d+)\.(\d+)\.(\d+)(-[^-\d]+|)(\d*)$/sprintf("%03d%03d%03d%03d%03d", $1, $2, $3, $PREFIX_MAP{$4}, $5)/e; (my $B = $b) =~ s/^(\d+)\.(\d+)\.(\d+)(-[^-\d]+|)(\d*)$/sprintf("%03d%03d%03d%03d%03d", $1, $2, $3, $PREFIX_MAP{$4}, $5)/e; return $A cmp $B; } sub parse_config { my($file,$clo) = @_; my %cfg = (); print STDERR "Parsing config: $file\n" if ($opt{d}); open(CFG, "<$file") or die "Failed to open config \"$file\": $!\n"; while() { # Skip comments and empty lines next if (/^\s*(?:#|$)/); # Parse chomp; my($var,$q1,$val,$q2) = (m/^\s*(\S+)\s+(['"]?)(.*)(\2)\s*$/); # Fixup values $var = lc($var); if ($val =~ m/^(?:true|on)$/i) { $val = 1 }; if ($val =~ m/^(?:false|off)$/i) { $val = 0 }; # Set opts if ($var eq "repositoryuri") { $cfg{r} = $val } elsif ($var eq "localrepository") { $cfg{p} = $val } elsif ($var eq "localrules") { $cfg{s} = $val } elsif ($var eq "version") { $cfg{v} = $val } elsif ($var eq "timeout") { $cfg{t} = $val } elsif ($var eq "notifyemail") { $cfg{e} = $val } elsif ($var eq "notifyemailfrom") { $cfg{f} = $val } elsif ($var eq "notifyemaildiff") { $cfg{E} = $val } elsif ($var eq "unpack") { $cfg{u} = $val } elsif ($var eq "debug") { $cfg{d} = $val } else { die "Invalid config directive: $var\n" } } close CFG; my($k, $v); while (($k, $v) = each %{$clo || {}}) { $cfg{$k} = $v if (defined $v); } return %cfg; } sub repository_dump { my @replist = repository_listing(); print STDERR "\nRepository: $opt{r}\n\n"; unless (@replist) { print STDERR "No matching entries.\n"; return; } for my $repo (@replist) { print "$repo {\n"; my @versions = ruleset_available_versions($repo); for my $version (@versions) { if ($version =~ m/$opt{v}/) { printf "%15s: %s_%s.zip\n", $version, $repo, $version; } elsif ($opt{d}) { print STDERR "Skipping version: $version\n"; } } print "}\n"; } } sub repository_listing { my $res = $ua->get("$opt{r}/.listing"); unless ($res->is_success()) { die "Failed to get repository listing \"$opt{r}/.listing\": ".$res->status_line()."\n"; } return grep(/\S/, split(/$CRLFRE/, $res->content)) ; } sub ruleset_listing { my $res = $ua->get("$opt{r}/$_[0]/.listing"); unless ($res->is_success()) { die "Failed to get ruleset listing \"$opt{r}/$_[0]/.listing\": ".$res->status_line()."\n"; } return grep(/\S/, split(/$CRLFRE/, $res->content)) ; } sub ruleset_available_versions { return sort sort_versions map { m/_([^_]+)\.zip.*$/; $1 } ruleset_listing($_[0]); } sub ruleset_fetch { my($repo, $version) = @_; # Create paths if (! -e "$opt{p}" ) { mkdir "$opt{p}" or die "Failed to create \"$opt{p}\": $!\n"; } if (! -e "$opt{p}/$repo" ) { mkdir "$opt{p}/$repo" or die "Failed to create \"$opt{p}/$repo\": $!\n"; } my $fn = "${repo}_$version.zip"; my $ruleset = "$repo/$fn"; my $ruleset_sig = "$repo/$fn.sig"; if (-e "$opt{p}/$ruleset") { die "Refused to overwrite ruleset \"$opt{p}/$ruleset\".\n"; } # Fetch the ruleset print STDERR "Fetching: $ruleset ...\n"; my $res = $ua->get( "$opt{r}/$ruleset", ":content_file" => "$opt{p}/$ruleset", ); die "Failed to retrieve ruleset $ruleset: ".$res->status_line()."\n" unless ($res->is_success()); # Fetch the ruleset signature if (-e "$opt{p}/$ruleset_sig") { die "Refused to overwrite ruleset signature \"$opt{p}/$ruleset_sig\".\n"; } $res = $ua->get( "$opt{r}/$ruleset_sig", ":content_file" => "$opt{p}/$ruleset_sig", ); # Verify the signature if we can if ($HAVE_GNUPG) { die "Failed to retrieve ruleset signature $ruleset_sig: ".$res->status_line()."\n" unless ($res->is_success()); ruleset_verifysig("$opt{p}/$ruleset", "$opt{p}/$ruleset_sig"); } push @fetched, [$repo, $version, $ruleset, undef]; } sub ruleset_unpack { my($repo, $version, $ruleset) = @{ $_[0] || [] }; my $fn = "$opt{p}/$ruleset"; if (! -e "$fn" ) { die "Internal Error: No ruleset to unpack - \"$fn\"\n"; } # Create paths if (! -e "$opt{s}" ) { mkdir "$opt{s}" or die "Failed to create \"$opt{p}\": $!\n"; } if (! -e "$opt{s}/$repo" ) { mkdir "$opt{s}/$repo" or die "Failed to create \"$opt{p}/$repo\": $!\n"; } if (! -e "$opt{s}/$repo/$version" ) { mkdir "$opt{s}/$repo/$version" or die "Failed to create \"$opt{p}/$repo/$version\": $!\n"; } else { die "Refused to overwrite previously unpacked \"$opt{s}/$repo/$version\".\n"; } # TODO: Verify sig my $pwd = getcwd(); my $unpackdir = "$opt{s}/$repo/$version"; chdir "$unpackdir"; if ($@) { my $err = $!; chdir $pwd; die "Failed to chdir to \"$unpackdir\": $err\n"; } undef $!; system(@$UNZIP, $fn); if ($? != 0) { my $err = $!; chdir $pwd; die "Failed to unpack \"$unpackdir\"".($err?": $err":".")."\n"; } chdir $pwd; # Add where we unpacked it $_->[3] = $unpackdir; return 0; } sub ruleset_fetch_latest { my($repo, @type) = @_; my @versions = ruleset_available_versions($repo); my $verre = defined($opt{v}) ? qr/^$opt{v}/ : qr/^/; my $typere = undef; # Figure out what to look for if (@type == 1 and $type[0] ne "") { my $type = $type[0]; if ($type eq "UNSTABLE") { $typere = qr/\d-\D+\d+$/; } else { $typere = qr/\d-$type\d+$/; } } elsif (@type > 1) { my $type; for (@type) { if ($_ eq "") { $type .= ($type?"|":"").qr/\.\d+$/; } elsif ($_ eq "UNSTABLE") { $type .= ($type?"|":"").qr/\d-\D+\d+$/; } else { $type .= ($type?"|":"").qr/\d-$_\d+$/; } } $typere = qr/$type/; } else { $typere = qr/\.\d+$/; } if ($opt{d}) { print STDERR "REPO: $repo\n"; print STDERR "TYPES: ".join(", ", @type)."\n"; print STDERR "VERSIONS: ".join(", ", @versions)."\n"; print STDERR "REGEX: version=$opt{v} type=$typere\n"; } while (@versions) { my $last = pop(@versions); # Check REs on version if ($last =~ m/$opt{v}/ and (!defined($typere) || $last =~ m/$typere/)) { return ruleset_fetch($repo, $last); } if ($opt{d}) { print STDERR "Skipping version: $last\n"; } } die "No '".join("' or '", @type)."' ruleset found.\n"; } sub notify_email { my $version_text = join("\n", map { "$_->[0] v$_->[1]".(defined($_->[3])?": $_->[3]":"") } @_); my $from = $opt{f} ? "From: $opt{f}\n" : ""; my $body = << "EOT"; ModSecurity rulesets updated and ready to install on host $HOST: $version_text ModSecurity - http://www.modsecurity.org/ EOT # TODO: Diffs open(SM, "|-", @$SENDMAIL) or die "Failed to send mail: $!\n"; print STDERR "Sending notification email to: $opt{e}\n"; print SM << "EOT"; ${from}To: $opt{e} Subject: [$HOST] ModSecurity Ruleset Update Notification $body EOT close SM; } sub ruleset_verifysig { my($fn, $sigfn) = @_; print STDERR "Verifying \"$fn\" with signature \"$sigfn\"\n"; my $gpg = new GnuPG(); my $sig = eval { $gpg->verify( signature => $sigfn, file => $fn ) }; if (defined $sig) { print STDERR sig2str($sig)."\n"; } if (!defined($sig)) { die "Signature validation failed.\n"; } if ( $sig->{trust} < $REQUIRED_SIG_TRUST ) { die "Signature is not trusted ".$GPG_TRUST{$REQUIRED_SIG_TRUST}.".\n"; } return; } sub sig2str { my %sig = %{ $_[0] || {} }; "Signature made ".localtime($sig{timestamp})." by $sig{user} (ID: $sig{keyid}) and is $GPG_TRUST{$sig{trust}} trusted."; } ################################################################################ ################################################################################ # List what is there if ($opt{l}) { repository_dump(); exit 0 } # Latest stable elsif (defined($opt{S})) { ruleset_fetch_latest($opt{S}, "") } # Latest development elsif (defined($opt{D})) { ruleset_fetch_latest($opt{D}, "dev") } # Latest release candidate elsif (defined($opt{R})) { ruleset_fetch_latest($opt{R}, "rc") } # Latest unstable elsif (defined($opt{U})) { ruleset_fetch_latest($opt{U}, "UNSTABLE") } # Latest release candidate or stable elsif (defined($opt{L})) { ruleset_fetch_latest($opt{R}, "rc", "") } # Latest (any type) elsif (defined($opt{F})) { ruleset_fetch_latest($opt{F}, undef) } # Unpack if ($opt{u}) { if (! defined $opt{s} ) { usage(1, "LocalRules is required for unpacking.") } for (@fetched) { ruleset_unpack($_); } } # Unpack if ($opt{e}) { notify_email(@fetched); } modsecurity-apache_2.7.7/tools/Makefile.in0000664000175000017500000004160012254306021021034 0ustar zimmerlezimmerle# Makefile.in generated by automake 1.13.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = tools DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(srcdir)/rules-updater.pl.in README ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/build/find_apr.m4 \ $(top_srcdir)/build/find_apu.m4 \ $(top_srcdir)/build/find_curl.m4 \ $(top_srcdir)/build/find_lua.m4 \ $(top_srcdir)/build/find_pcre.m4 \ $(top_srcdir)/build/find_xml.m4 $(top_srcdir)/build/libtool.m4 \ $(top_srcdir)/build/ltoptions.m4 \ $(top_srcdir)/build/ltsugar.m4 \ $(top_srcdir)/build/ltversion.m4 \ $(top_srcdir)/build/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/apache2/modsecurity_config_auto.h CONFIG_CLEAN_FILES = rules-updater.pl CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(bindir)" SCRIPTS = $(bin_SCRIPTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APR_CFLAGS = @APR_CFLAGS@ APR_CONFIG = @APR_CONFIG@ APR_CPPFLAGS = @APR_CPPFLAGS@ APR_INCLUDEDIR = @APR_INCLUDEDIR@ APR_LDADD = @APR_LDADD@ APR_LDFLAGS = @APR_LDFLAGS@ APR_LINKLD = @APR_LINKLD@ APR_VERSION = @APR_VERSION@ APU_CFLAGS = @APU_CFLAGS@ APU_CONFIG = @APU_CONFIG@ APU_INCLUDEDIR = @APU_INCLUDEDIR@ APU_LDADD = @APU_LDADD@ APU_LDFLAGS = @APU_LDFLAGS@ APU_LINKLD = @APU_LINKLD@ APU_VERSION = @APU_VERSION@ APXS = @APXS@ APXS_BINDIR = @APXS_BINDIR@ APXS_CC = @APXS_CC@ APXS_CFLAGS = @APXS_CFLAGS@ APXS_EXTRA_CFLAGS = @APXS_EXTRA_CFLAGS@ APXS_HTTPD = @APXS_HTTPD@ APXS_INCLUDEDIR = @APXS_INCLUDEDIR@ APXS_INCLUDES = @APXS_INCLUDES@ APXS_LDFLAGS = @APXS_LDFLAGS@ APXS_LIBDIR = @APXS_LIBDIR@ APXS_LIBEXECDIR = @APXS_LIBEXECDIR@ APXS_LIBS = @APXS_LIBS@ APXS_LIBTOOL = @APXS_LIBTOOL@ APXS_MODULES = @APXS_MODULES@ APXS_PROGNAME = @APXS_PROGNAME@ APXS_SBINDIR = @APXS_SBINDIR@ APXS_WRAPPER = @APXS_WRAPPER@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CURL_CFLAGS = @CURL_CFLAGS@ CURL_CONFIG = @CURL_CONFIG@ CURL_CPPFLAGS = @CURL_CPPFLAGS@ CURL_LDADD = @CURL_LDADD@ CURL_LDFLAGS = @CURL_LDFLAGS@ CURL_USES_GNUTLS = @CURL_USES_GNUTLS@ CURL_VERSION = @CURL_VERSION@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENV_CMD = @ENV_CMD@ EXEEXT = @EXEEXT@ EXTRA_CFLAGS = @EXTRA_CFLAGS@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ LIBXML2_CONFIG = @LIBXML2_CONFIG@ LIBXML2_CPPFLAGS = @LIBXML2_CPPFLAGS@ LIBXML2_LDADD = @LIBXML2_LDADD@ LIBXML2_LDFLAGS = @LIBXML2_LDFLAGS@ LIBXML2_VERSION = @LIBXML2_VERSION@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LUA_CFLAGS = @LUA_CFLAGS@ LUA_LDADD = @LUA_LDADD@ LUA_LDFLAGS = @LUA_LDFLAGS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MODSEC_APXS_EXTRA_CFLAGS = @MODSEC_APXS_EXTRA_CFLAGS@ MODSEC_EXTRA_CFLAGS = @MODSEC_EXTRA_CFLAGS@ MSC_BASE_DIR = @MSC_BASE_DIR@ MSC_PKGBASE_DIR = @MSC_PKGBASE_DIR@ MSC_REGRESSION_CONF_DIR = @MSC_REGRESSION_CONF_DIR@ MSC_REGRESSION_DIR = @MSC_REGRESSION_DIR@ MSC_REGRESSION_DOCROOT_DIR = @MSC_REGRESSION_DOCROOT_DIR@ MSC_REGRESSION_LOGS_DIR = @MSC_REGRESSION_LOGS_DIR@ MSC_REGRESSION_SERVERROOT_DIR = @MSC_REGRESSION_SERVERROOT_DIR@ MSC_TEST_DIR = @MSC_TEST_DIR@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCRE_CFLAGS = @PCRE_CFLAGS@ PCRE_CONFIG = @PCRE_CONFIG@ PCRE_CPPFLAGS = @PCRE_CPPFLAGS@ PCRE_LDADD = @PCRE_LDADD@ PCRE_LDFLAGS = @PCRE_LDFLAGS@ PCRE_LD_PATH = @PCRE_LD_PATH@ PCRE_VERSION = @PCRE_VERSION@ PERL = @PERL@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOPLEVEL_SUBDIRS = @TOPLEVEL_SUBDIRS@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ bin_SCRIPTS = rules-updater.pl all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tools/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign tools/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): rules-updater.pl: $(top_builddir)/config.status $(srcdir)/rules-updater.pl.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ install-binSCRIPTS: $(bin_SCRIPTS) @$(NORMAL_INSTALL) @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n' \ -e 'h;s|.*|.|' \ -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) { files[d] = files[d] " " $$1; \ if (++n[d] == $(am__install_max)) { \ print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ else { print "f", d "/" $$4, $$1 } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binSCRIPTS: @$(NORMAL_UNINSTALL) @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ dir='$(DESTDIR)$(bindir)'; $(am__uninstall_files_from_dir) mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags TAGS: ctags CTAGS: cscope cscopelist: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(SCRIPTS) installdirs: for dir in "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binSCRIPTS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binSCRIPTS .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ cscopelist-am ctags-am distclean distclean-generic \ distclean-libtool distdir dvi dvi-am html html-am info info-am \ install install-am install-binSCRIPTS install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \ uninstall-am uninstall-binSCRIPTS # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: modsecurity-apache_2.7.7/alp2/0000775000175000017500000000000012254306021016464 5ustar zimmerlezimmerlemodsecurity-apache_2.7.7/alp2/Makefile.am0000664000175000017500000000034512253711345020532 0ustar zimmerlezimmerlelib_LTLIBRARIES = libalp2.la include_HEADERS = alp2.h \ alp2_pp.h libalp2_la_SOURCES = alp2.c \ alp2_pp.c libalp2_la_CFLAGS = @APR_CFLAGS@ \ @APU_CFLAGS@ libalp2_la_LDFLAGS = @APR_LDFLAGS@ \ @APU_LDFLAGS@ modsecurity-apache_2.7.7/alp2/alp2_pp.h0000664000175000017500000000551312243422537020207 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #ifndef _ALP2_LL_H_ #define _ALP2_LL_H_ #include #include #include #include #include /* -- Constants -- */ #define ALP2_MAX_LINE_SIZE 16384 #define ALP2_ERROR_INCORRECT_STATE -1001 #define ALP2_ERROR_FATAL -1002 #define ALP2_DONE 0 #define ALP2_NEED_DATA 1 #define ALP2_EVENT_ENTRY_START 1 #define ALP2_EVENT_ENTRY_END 2 #define ALP2_EVENT_PART_START 3 #define ALP2_EVENT_PART_END 4 #define ALP2_EVENT_PART_DATA 5 /* -- Data structures -- */ typedef struct alp2_pp_part_t alp2_pp_part_t; struct alp2_pp_part_t { int id; // XXX int here but unsigned int other places??? /* Relative to the beginning of the entry, not * including the boundary lines. Just content. */ size_t offset; size_t size; }; typedef struct alp2_pp_entry_t alp2_pp_entry_t; struct alp2_pp_entry_t { apr_pool_t *mp; apr_array_header_t *parts; /* Entry offset and size include * the delimiting boundaries. */ size_t offset; size_t size; const char *boundary; apr_md5_ctx_t *md5_context; uint8_t md5_digest[APR_MD5_DIGESTSIZE]; }; typedef struct alp2_pp_t alp2_pp_t; struct alp2_pp_t { void *user_data; int (*callback)(alp2_pp_t *alp, int event_type); /* The memory pool used during the parsing of * individual audit log entries. Cleared between * entries. */ apr_pool_t *mp; unsigned int errored; unsigned int done; const char *boundary; char *last_processed_part; char *current_line; /* The number of bytes processed since * the beginning or the last reset. */ size_t current_offset; const char *input_buf; size_t input_len; size_t input_pos; char *line_buf; size_t line_pos; size_t line_size; unsigned int line_has_start; size_t line_offset; alp2_pp_part_t *current_part; alp2_pp_entry_t *current_entry; }; /* Functions. */ int alp2_pp_init(alp2_pp_t *alp_pp, void *user_data, int (*callback)(alp2_pp_t *alp, int event_type), apr_pool_t *mp); int alp2_pp_process(alp2_pp_t *alp_pp, const char *data, size_t len); void alp2_pp_terminate(alp2_pp_t *alp_pp); char *alp2_pp_line_chomp(alp2_pp_t *alp_pp); #endif modsecurity-apache_2.7.7/alp2/alp2.c0000775000175000017500000011521312243422537017505 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #include #include #include #include #include #include "alp2.h" #ifdef DEBUG #define alp_debug(...) fprintf(stderr, __VA_ARGS__) #else #define alp_debug(...) #endif /* DEBUG */ /** * Add one error to the audit log entry. */ static void add_error(alp2_t *alp, int is_fatal, const char *text, ...) { char *str = NULL; va_list ap; if (is_fatal) { alp->parse_error = 1; } va_start(ap, text); str = apr_pvsprintf(alp->auditlog->mp, text, ap); va_end(ap); *(char **)apr_array_push(alp->errors) = str; } /** * Parse the Response-Body-Transformed trailer header. */ static int handle_part_H_parse_ResponseTFN(alp2_t *alp, const char *s) { char *capture = NULL; int ovector[33]; int rc; // TODO This header is optional, but is not allowed to appear more than once. return 1; } /** * Parse the Action trailer header. */ static int handle_part_H_parse_Action(alp2_t *alp, const char *s) { char *capture = NULL; int ovector[33]; int rc; // TODO This header is optional, but is not allowed to appear more than once. alp->auditlog->was_intercepted = 1; rc = pcre_exec(alp->trailer_action_pattern, NULL, s, strlen(s), 0, 0, ovector, 30); if (rc < 0) { add_error(alp, 1, "Part H: Failed to parse Action header"); return -1; } capture = apr_pstrmemdup(alp->auditlog->mp, s + ovector[2 * 1], ovector[2 * 1 + 1] - ovector[2 * 1]); alp->auditlog->intercept_phase = atoi(capture); return 1; } /** * Convert two hexadecimal characters into a character. */ static uint8_t x2c(uint8_t *what) { register uint8_t digit; digit = (what[0] >= 'A' ? ((what[0] & 0xdf) - 'A') + 10 : (what[0] - '0')); digit *= 16; digit += (what[1] >= 'A' ? ((what[1] & 0xdf) - 'A') + 10 : (what[1] - '0')); return digit; } /** * Remove a layer of encoding from a string. This function needs to be used * for every piece of data ModSecurity encoded for a message. */ static int remove_slashes(uint8_t *s) { uint8_t *d = s; while(*s != '\0') { if ((*s == '\\')&&(*(s + 1) != '\0')) { s++; switch(*s) { case 'b' : *d = '\b'; break; case 'n' : *d = '\n'; break; case 'r' : *d = '\r'; break; case 't' : *d = '\t'; break; case 'v' : *d = '\v'; break; case '\\' : *d = '\\'; break; case '"' : *d = '"'; break; case 'x' : if ( (*(s + 1) != '\0') &&(*(s + 2) != '\0') &&(isxdigit(*(s + 1))) &&(isxdigit(*(s + 2))) ) { *d = x2c(s + 1); s += 2; } else { /* Invalid encoding. */ return -1; } break; default : /* Invalid encoding. */ return -1; break; } } else { *d = *s; } s++; d++; } *d = '\0'; return 1; } /** * Process one (ModSecurity message) meta-data fragment. */ static int handle_part_H_parse_Message_meta(alp2_t *alp, alp2_msg_t *message, const char *l, const char *string_start, const char *string_end) { const char *value; // XXX if ((*string_start != '"')||(*string_end != '"')||(string_end <= string_start)) { if (string_end <= string_start) { add_error(alp, 1, "Part H: Invalid handle_part_H_parse_Message_meta invocation"); return -1; } if ((*string_start != '"')||(*string_end != '"')) { value = apr_pstrndup(alp->auditlog->mp, string_start, (string_end - string_start) + 1); } else { value = apr_pstrndup(alp->auditlog->mp, string_start + 1, (string_end - string_start - 1)); } if (value == NULL) { return -1; } if (remove_slashes((uint8_t *)value) < 0) { add_error(alp, 1, "Part H: Invalid encoding in meta-data fragment"); return -1; } /* Target ( at THE_TARGET) */ if (strncmp(l, "at ", 3) == 0) { if (message->target != NULL) { add_error(alp, 1, "Part H: Already seen target"); return -1; } message->target = value; return 1; } /* id */ if (strncmp(l, "id ", 3) == 0) { if (message->id != NULL) { add_error(alp, 1, "Part H: Already seen meta-data: id"); return -1; } message->id = value; return 1; } /* rev */ if (strncmp(l, "rev ", 4) == 0) { if (message->rev != NULL) { add_error(alp, 1, "Part H: Already seen meta-data: rev"); return -1; } message->rev = value; return 1; } /* msg */ if (strncmp(l, "msg ", 4) == 0) { if (message->msg != NULL) { add_error(alp, 1, "Part H: Already seen meta-data: msg"); return -1; } message->msg = value; return 1; } /* data */ if (strncmp(l, "data ", 4) == 0) { if (message->data != NULL) { add_error(alp, 1, "Part H: Already seen meta-data: data"); return -1; } message->data = value; return 1; } /* file */ if (strncmp(l, "file ", 5) == 0) { if (message->file != NULL) { add_error(alp, 1, "Part H: Already seen meta-data: file"); return -1; } message->file = value; return 1; } /* line */ if (strncmp(l, "line ", 5) == 0) { if (message->file_line != (unsigned long)-1) { add_error(alp, 1, "Part H: Already seen meta-data: line"); return -1; } // TODO Validate. message->file_line = atoi(value); return 1; } /* tag */ if (strncmp(l, "tag ", 4) == 0) { *(char **)apr_array_push(message->tags) = (char *)value; return 1; } /* severity */ if (strncmp(l, "severity ", 9) == 0) { if ( (strcmp(value, "0") == 0) ||(strcasecmp(value, "EMERGENCY") == 0)) { message->severity = 0; return 1; } if ( (strcmp(value, "1") == 0) ||(strcasecmp(value, "ALERT") == 0)) { message->severity = 1; return 1; } if ( (strcmp(value, "2") == 0) ||(strcasecmp(value, "CRITICAL") == 0)) { message->severity = 2; return 1; } if ( (strcmp(value, "3") == 0) ||(strcasecmp(value, "ERROR") == 0)) { message->severity = 3; return 1; } if ( (strcmp(value, "4") == 0) ||(strcasecmp(value, "WARNING") == 0)) { message->severity = 4; return 1; } if ( (strcmp(value, "5") == 0) ||(strcasecmp(value, "NOTICE") == 0)) { message->severity = 5; return 1; } if ( (strcmp(value, "6") == 0) ||(strcasecmp(value, "INFO") == 0)) { message->severity = 6; return 1; } if ( (strcmp(value, "7") == 0) ||(strcasecmp(value, "DEBUG") == 0)) { message->severity = 7; return 1; } add_error(alp, 1, "Part H: Invalid severity value: %s", value); return -1; } /* offset */ if (strncmp(l, "offset ", 7) == 0) { if (message->offset != (size_t)-1) { /* Already seen "offset". */ add_error(alp, 1, "Part H: Already seen fragment offset"); return -1; } // TODO Validate. message->offset = atoi(value); return 1; } /* Ignore unknown meta-data information. */ return 0; } /** * Parse the Message trailer header. More than one such header * can exist in an audit log, and each represents one ModSecurity * message. */ static int handle_part_H_parse_Message(alp2_t *alp, const char *s) { alp2_msg_t *message = NULL; char *l = (char *)(s + strlen(s) - 1); char *engine_message_start = (char *)s; char *engine_message_end = NULL; char *string_start = NULL, *string_end = NULL; char *fragment_end = NULL; char *tptr; int in_string; int done; /* Create one new message structure. */ message = apr_pcalloc(alp->auditlog->mp, sizeof(alp2_msg_t)); if (message == NULL) { return -1; } message->file_line = (unsigned long)-1; message->offset = (size_t)-1; message->severity = -1; message->warning = 0; if (strncasecmp("warning. ", s, 9) == 0) { message->warning = 1; engine_message_start += 9; } message->tags = apr_array_make(alp->auditlog->mp, 4, sizeof(const char *)); /* Start at the end of the message and go back identifying * the meta-data fragments as we go. Stop when we find the * end of the engine message. */ done = in_string = 0; while ((l >= s)&&(!done)) { if (in_string == 0) { /* Outside string. */ // TODO Make sure this is not an escaped char switch(*l) { case ' ' : /* Do nothing. */ break; case ']' : fragment_end = l; break; case '[' : if (fragment_end) { /* Found one meta-data fragment. */ // TODO This parser implementation allows for invalid // meta-data fragments to be accepted. It would be // nice to check the format of the fragment (e.g. // by matching it against a regular expression // pattern) before we accept any data. At this point // l points to the first byte of the fragment, and // fragment_end to the last. handle_part_H_parse_Message_meta(alp, message, l + 1, string_start, string_end); fragment_end = NULL; string_start = NULL; string_end = NULL; } break; case '"' : /* Found the end of a string. */ in_string = 1; string_end = l; break; default : if (!fragment_end) { /* There are no more meta-data fragments. */ engine_message_end = l; done = 1; } break; } } else { /* In string. We are only interested * in where the string ends. */ if ((*l == '"')&&((l - 1) >= s)&&(*(l - 1) != '\\')) { in_string = 0; string_start = l; } } l--; } /* Target is between " at " and "." */ tptr = engine_message_start; while ((tptr = strstr(tptr, " at ")) && (tptr < engine_message_end)) { char *tend = strchr(tptr, '.'); if ((tend <= engine_message_end) && (tend - tptr > 5)) { int rc = handle_part_H_parse_Message_meta(alp, message, tptr + 1, tptr + 4, tend - 1); if (rc == 1) { /* Remove the target data from the message */ engine_message_end = tptr; } } break; } if (engine_message_end == NULL) { add_error(alp, 1, "Part H: Failed parsing ModSecurity message: %s", s); return -1; } message->engine_message = apr_pstrndup(alp->auditlog->mp, engine_message_start, (engine_message_end - engine_message_start + 1)); /* Add this message to the audit log. */ *(alp2_msg_t **)apr_array_push(alp->auditlog->messages) = message; return 1; } /** * Parse the Stopwatch trailer header. */ static int handle_part_H_parse_Stopwatch(alp2_t *alp, const char *s) { int ovector[33]; int i, rc; // TODO This header is required (a check for its appearance is made when // handling the end of an H part), and is not allowed to appear // more than once. rc = pcre_exec(alp->trailer_stopwatch_pattern, NULL, s, strlen(s), 0, 0, ovector, 30); if (rc < 0) { add_error(alp, 1, "Part H: Failed to parse Stopwatch header"); return -1; } /* Loop through the captures. */ for (i = 0; i < rc; i++) { char *capture = apr_pstrmemdup(alp->auditlog->mp, s + ovector[2 * i], ovector[2 * i + 1] - ovector[2 * i]); switch (i) { case 1 : /* timestamp */ // TODO Validate alp->auditlog->timestamp = apr_atoi64(capture); break; case 2 : /* duration */ // TODO Validate alp->auditlog->duration = apr_atoi64(capture); break; case 3 : /* ignore (group of three further time elements)*/ break; case 4 : /* t1 */ break; case 5 : /* t2 */ break; case 6 : /* t3 */ break; } } return 1; } /** * Parse the WebApp-Info trailer header. */ static int handle_part_H_parse_WebAppInfo(alp2_t *alp, const char *s) { int ovector[33]; int i, rc; // TODO This header is optional, but it is not allowed to appear more than once. rc = pcre_exec(alp->trailer_webappinfo_pattern, NULL, s, strlen(s), 0, 0, ovector, 30); if (rc < 0) { add_error(alp, 1, "Part H: Failed to parse WebApp-Info header"); return -1; } /* Loop through the captures. */ for (i = 0; i < rc; i++) { char *capture = apr_pstrmemdup(alp->auditlog->mp, s + ovector[2 * i], ovector[2 * i + 1] - ovector[2 * i]); switch (i) { case 1 : /* application ID */ // TODO Validate alp->auditlog->application_id = capture; break; case 2 : /* session ID */ // TODO Validate if (strcmp(capture, "-") != 0) { alp->auditlog->session_id = capture; } break; case 3 : /* user ID */ // TODO Validate if (strcmp(capture, "-") != 0) { alp->auditlog->user_id = capture; } break; } } return 1; } /** * Handle part H events. */ static void handle_part_H(alp2_t *alp, int event_type) { /* Part data. */ if (event_type == ALP2_EVENT_PART_DATA) { char *line = alp2_pp_line_chomp(alp->pp); /* This part ends with an empty line. */ if (strlen(line) == 0) { alp->part_data_done = 1; return; } /* Extract the header information. */ { char *name = NULL, *value = NULL; int ovector[33]; int i, rc; /* Header line. */ /* Extract the fields. */ rc = pcre_exec(alp->header_pattern, NULL, line, strlen(line), 0, 0, ovector, 30); if (rc < 0) { add_error(alp, 1, "Part H: Failed to parse header: %i", rc); return; } /* Loop through the captures. */ for (i = 0; i < rc; i++) { char *capture = apr_pstrmemdup(alp->auditlog->mp, line + ovector[2 * i], ovector[2 * i + 1] - ovector[2 * i]); switch(i) { case 1 : name = capture; break; case 2 : value = capture; break; } } /* Add header to the table. */ apr_table_addn(alp->auditlog->trailer_headers, name, value); } return; } /* Part end. */ if (event_type == ALP2_EVENT_PART_END) { const apr_array_header_t *tarr = apr_table_elts(alp->auditlog->trailer_headers); apr_table_entry_t *te = NULL; const char *s = NULL; int stopwatch = 0; int rc = 0; int i; if ((tarr == NULL) || (tarr->nelts == 0)) { return; } /* Here we are going to extract certain headers and * parse them to populate the corresponding fields in * the auditlog structure. */ te = (apr_table_entry_t *)tarr->elts; for (i = 0; i < tarr->nelts; i++) { const char *key = te[i].key; const char *val = te[i].val; if ((key == NULL) || (val == NULL)) { continue; } /* Action: optional */ else if (strcmp("Action", key) == 0) { rc = handle_part_H_parse_Action(alp, val); } /* Message: optional */ else if (strcmp("Message", key) == 0) { rc = handle_part_H_parse_Message(alp, val); } /* Apache-Handler: optional */ else if (strcmp("Apache-Handler", key) == 0) { rc = 0; // TODO Only one allowed alp->auditlog->handler = apr_pstrdup(alp->auditlog->mp, val); } /* Producer: optional */ else if (strcmp("Producer", key) == 0) { rc = 0; // TODO Only one allowed alp->auditlog->producer = apr_pstrdup(alp->auditlog->mp, val); } /* Server: optional */ else if (strcmp("Server", key) == 0) { rc = 0; // TODO Only one allowed alp->auditlog->server = apr_pstrdup(alp->auditlog->mp, val); } /* Response-Body-Transformed: optional */ else if (strcmp("Response-Body-Transformed", key) == 0) { rc = 0; // TODO Only one allowed alp->auditlog->response_tfn = apr_pstrdup(alp->auditlog->mp, val); } /* Stopwatch: required */ else if (strcmp("Stopwatch", key) == 0) { stopwatch = 1; rc = handle_part_H_parse_Stopwatch(alp, val); } /* WebApp-Info: optional */ else if (strcmp("WebApp-Info", key) == 0) { rc = handle_part_H_parse_WebAppInfo(alp, val); } if (rc < 0) { /* No need to report anything, it's already been reported. */ } } if (stopwatch == 0) { add_error(alp, 1, "Part H: Stopwatch header missing"); } return; } } /** * Handle part F events. */ static void handle_part_F(alp2_t *alp, int event_type) { /* Part data. */ if (event_type == ALP2_EVENT_PART_DATA) { char *line = alp2_pp_line_chomp(alp->pp); /* This part ends with an empty line. */ if (strlen(line) == 0) { alp->part_data_done = 1; return; } /* The first line should be the response line. */ if (alp->part_line_counter == 1) { int ovector[33]; int i, rc; /* Response line. */ /* Extract the fields. */ rc = pcre_exec(alp->response_line_pattern, NULL, line, strlen(line), 0, 0, ovector, 30); if (rc < 0) { add_error(alp, 1, "Part F: Failed to parse response line: %i", rc); return; } /* Loop through the captures. */ for (i = 0; i < rc; i++) { char *capture = apr_pstrmemdup(alp->auditlog->mp, line + ovector[2 * i], ovector[2 * i + 1] - ovector[2 * i]); switch(i) { case 1 : alp->auditlog->response_protocol = capture; break; case 2 : alp->auditlog->response_status = atoi(capture); break; case 4 : alp->auditlog->response_message = capture; break; break; } } } else { char *name = NULL, *value = NULL; int ovector[33]; int i, rc; /* Response header line. */ /* Extract the fields. */ rc = pcre_exec(alp->header_pattern, NULL, line, strlen(line), 0, 0, ovector, 30); if (rc < 0) { add_error(alp, 1, "Part F: Failed to parse response header: %i", rc); return; } /* Loop through the captures. */ for (i = 0; i < rc; i++) { char *capture = apr_pstrmemdup(alp->auditlog->mp, line + ovector[2 * i], ovector[2 * i + 1] - ovector[2 * i]); switch(i) { case 1 : name = capture; break; case 2 : value = capture; break; } } /* Add header to the table. */ apr_table_addn(alp->auditlog->response_headers, name, value); } return; } /* Part end. */ if (event_type == ALP2_EVENT_PART_END) { /* If any of the response headers need * special handling, place the code here. */ return; } } /** * Parse the URI. APR-Util does most of the work here. */ static int handle_part_B_parse_uri(alp2_t *alp) { char *u = (char *)alp->auditlog->request_uri; apr_uri_t *uri = NULL; if (( alp->auditlog->request_method == NULL) ||(alp->auditlog->request_uri == NULL)) { return 0; } /* Since this is not a proper URI but a path, handle * the leading double slash. */ while ((u[0] == '/') && (u[1] == '/')) { u++; } uri = apr_pcalloc(alp->auditlog->mp, sizeof(apr_uri_t)); if (strcasecmp(alp->auditlog->request_method, "CONNECT") == 0) { if (apr_uri_parse_hostinfo(alp->auditlog->mp, u, uri) != APR_SUCCESS) { add_error(alp, 0, "Info: Failed to parse request URI (hostinfo)"); return -1; } } else { if (apr_uri_parse(alp->auditlog->mp, u, uri) != APR_SUCCESS) { add_error(alp, 0, "Info: Failed to parse request URI"); return -1; } } alp->auditlog->parsed_uri = uri; return 1; } /** * Handle part B events. */ static void handle_part_B(alp2_t *alp, int event_type) { /* Part data. */ if (event_type == ALP2_EVENT_PART_DATA) { char *line = alp2_pp_line_chomp(alp->pp); /* This part ends with an empty line. */ if (strlen(line) == 0) { alp->part_data_done = 1; return; } /* The first line should be the request line. */ if (alp->part_line_counter == 1) { int ovector[33]; int i, rc; /* Request line. */ /* Extract the fields. */ rc = pcre_exec(alp->request_line_pattern, NULL, line, strlen(line), 0, 0, ovector, 30); if (rc < 0) { add_error(alp, 1, "Part B: Failed to parse request line: %i", rc); return; } alp->auditlog->request_line_valid = 1; /* Loop through the captures. */ for (i = 0; i < rc; i++) { char *capture = apr_pstrmemdup(alp->auditlog->mp, line + ovector[2 * i], ovector[2 * i + 1] - ovector[2 * i]); switch(i) { case 0 : alp->auditlog->request_line = capture; break; case 1 : alp->auditlog->request_method = capture; break; case 2 : alp->auditlog->request_uri = capture; if (handle_part_B_parse_uri(alp) != 1) { // TODO Do we want to do anything on error? } break; case 3 : alp->auditlog->request_protocol = capture; break; } } } else { char *name = NULL, *value = NULL; int ovector[33]; int i, rc; /* Header line. */ /* Extract the fields. */ rc = pcre_exec(alp->header_pattern, NULL, line, strlen(line), 0, 0, ovector, 30); if (rc < 0) { add_error(alp, 1, "Part B: Failed to parse request header: %i", rc); return; } /* Loop through the captures. */ for (i = 0; i < rc; i++) { char *capture = apr_pstrmemdup(alp->auditlog->mp, line + ovector[2 * i], ovector[2 * i + 1] - ovector[2 * i]); switch(i) { case 1 : name = capture; break; case 2 : value = capture; break; } } /* ModSecurity 1.9.x adds some requests headers of * its own, and we don't want them. */ if (strncmp(name, "mod_security-", 13) != 0) { /* Add header to the table. */ apr_table_addn(alp->auditlog->request_headers, name, value); } } return; } /* Part end. */ if (event_type == ALP2_EVENT_PART_END) { /* Determine hostname. */ // TODO I think the right thing to do is use the port numbers // only when the host itself is a numerical IP. /* Try the URI first. */ if ( (alp->auditlog->parsed_uri != NULL) &&(alp->auditlog->parsed_uri->hostname != NULL)) { if ( (alp->auditlog->parsed_uri->port != 0) && (alp->auditlog->parsed_uri->port != 80) && (alp->auditlog->parsed_uri->port != 443) ) { // TODO Do not use the port number if the hostname // is not numeric. alp->auditlog->hostname = apr_psprintf(alp->auditlog->mp, "%s:%i", alp->auditlog->parsed_uri->hostname, alp->auditlog->parsed_uri->port); } else { // TODO Always use the port number if the hostname // is numeric. alp->auditlog->hostname = alp->auditlog->parsed_uri->hostname; } } else { /* Try the Host header. */ char *s = (char *)apr_table_get(alp->auditlog->request_headers, "Host"); if (s != NULL) { // TODO If the hostname is not numeric, remove the port // numbers if present. alp->auditlog->hostname = s; } else { /* Use the destination IP and port. */ alp->auditlog->hostname = apr_psprintf(alp->auditlog->mp, "%s:%i", alp->auditlog->dst_ip, alp->auditlog->dst_port); } } return; } } /** * Handle part A events. */ static void handle_part_A(alp2_t *alp, int event_type) { /* Part data. */ if (event_type == ALP2_EVENT_PART_DATA) { char *line = alp2_pp_line_chomp(alp->pp); int ovector[33]; int i, rc; /* This part can have only one line, * so we don't expect to be here again. */ alp->part_data_done = 1; /* Extract the fields. */ rc = pcre_exec(alp->part_a_pattern, NULL, line, strlen(line), 0, 0, ovector, 30); if (rc < 0) { add_error(alp, 1, "Part A: Parsing failed: %i", rc); return; } /* Loop through the captures. */ for (i = 0; i < rc; i++) { char *capture = apr_pstrmemdup(alp->auditlog->mp, line + ovector[2 * i], ovector[2 * i + 1] - ovector[2 * i]); switch(i) { case 1 : /* timestamp in Apache format */ /* We don't need it as we use the one from the H part. */ break; case 2 : /* transaction ID */ alp->auditlog->id = capture; break; case 3 : /* source address */ // TODO Validate alp->auditlog->src_ip = capture; break; case 4 : /* source port */ // TODO Validate alp->auditlog->src_port = atoi(capture); break; case 5 : /* destination address */ // TODO Validate alp->auditlog->dst_ip = capture; break; case 6 : /* destinatio port */ // TODO Validate alp->auditlog->dst_port = atoi(capture); break; } } return; } /* Part end. */ if (event_type == ALP2_EVENT_PART_END) { /* Place part post-validation here. */ return; } } /** * Create a new audit log data structure, allocating * memory from the provided memory pool. */ auditlog2_t *alp2_auditlog_create(apr_pool_t *mp) { auditlog2_t *al; /* Create a new memory pool and the * auditlog structure in it. We will use the * parent pool of the parser pool, in order to * ensure the auditlog memory structures survive * the death of the parser. */ al = apr_pcalloc(mp, sizeof(auditlog2_t)); al->mp = mp; al->request_headers = apr_table_make(al->mp, 20); al->response_headers = apr_table_make(al->mp, 20); al->trailer_headers = apr_table_make(al->mp, 20); al->messages = apr_array_make(al->mp, 10, sizeof(const alp2_msg_t *)); al->intercept_phase = -1; return al; } /** * Destroy the provided audit log entry. */ void alp2_auditlog_destroy(auditlog2_t *al) { apr_pool_destroy(al->mp); } /** * Handle ALP2_EVENT_ENTRY_START. */ static void handle_entry_start(alp2_t *alp) { /* Create a new data structure to hold the entry. */ alp->auditlog = alp2_auditlog_create(alp->pp->current_entry->mp); alp->auditlog->pp_entry = alp->pp->current_entry; /* Reset entry flags. */ alp->previous_part_id = 0; alp->seen_part_h = 0; alp->parse_error = 0; alp->errors = apr_array_make(alp->auditlog->mp, 4, sizeof(const char *)); } /** * Handle ALP2_EVENT_ENTRY_END. */ static void handle_entry_end(alp2_t *alp) { if (alp->parse_error) { /* No need to validate the entry since we've * previously encountered a problem with it. */ } else { /* Final entry validation. */ /* Have we seen the H part? (We must have seen the A * part, otherwise the entry would have begain in * the first place. */ if (alp->seen_part_h == 0) { add_error(alp, 1, "Entry does not have part H."); } } /* Invoke the upstream callback to handle the entry. */ if (alp->user_callback(alp) == 0) { alp->done = 1; } /* Upstream owns the audit log entry now. */ alp->auditlog = NULL; } /** * Handle ALP2_EVENT_PART_START. */ static void handle_part_start(alp2_t *alp) { if (alp->parse_error) { return; } /* Reset part flags. */ alp->part_line_counter = 0; alp->part_data_done = 0; /* Is this part allowed/expected? */ if (alp->previous_part_id == 0) { if (alp->pp->current_part->id != 'A') { add_error(alp, 1, "Expected part A but got %c.", alp->pp->current_part->id); return; } } /* Invoke the appropriate part handler. */ switch(alp->pp->current_part->id) { case 'A' : handle_part_A(alp, ALP2_EVENT_PART_START); break; case 'B' : handle_part_B(alp, ALP2_EVENT_PART_START); break; case 'F' : handle_part_F(alp, ALP2_EVENT_PART_START); break; case 'H' : alp->seen_part_h = 1; handle_part_H(alp, ALP2_EVENT_PART_START); break; default : /* Ignore unknown part. */ break; } } /* * Handle ALP2_EVENT_PART_END. */ static void handle_part_end(alp2_t *alp) { if (alp->parse_error) { return; } /* Invoke the appropriate part handler. */ switch(alp->pp->current_part->id) { case 'A' : handle_part_A(alp, ALP2_EVENT_PART_END); break; case 'B' : handle_part_B(alp, ALP2_EVENT_PART_END); case 'F' : handle_part_F(alp, ALP2_EVENT_PART_END); break; case 'H' : handle_part_H(alp, ALP2_EVENT_PART_END); break; default : /* Ignore unknown part. */ break; } /* Remember the last part processed. */ alp->previous_part_id = alp->pp->current_part->id; } /* * Handle ALP2_EVENT_PART_DATA. */ static void handle_part_data(alp2_t *alp) { if (alp->parse_error) { return; } alp->part_line_counter++; if (alp->part_data_done) { add_error(alp, 1, "Unexpected data for part %c.", alp->pp->current_part->id); return; } /* Invoke the appropriate part handler. */ switch(alp->pp->current_part->id) { case 'A' : handle_part_A(alp, ALP2_EVENT_PART_DATA); break; case 'B' : handle_part_B(alp, ALP2_EVENT_PART_DATA); break; case 'F' : handle_part_F(alp, ALP2_EVENT_PART_DATA); break; case 'H' : handle_part_H(alp, ALP2_EVENT_PART_DATA); break; default : /* Ignore unknown part. */ break; } } /** * This function handles callbacks from * the lower-level (part) parser. */ static int alp2_callback(alp2_pp_t *pp, int event_type) { alp2_t *alp = (alp2_t *)pp->user_data; /* Choose where to dispatch the event based * on the event type. */ switch(event_type) { case ALP2_EVENT_ENTRY_START : handle_entry_start(alp); break; case ALP2_EVENT_ENTRY_END : handle_entry_end(alp); break; case ALP2_EVENT_PART_START : handle_part_start(alp); break; case ALP2_EVENT_PART_END : handle_part_end(alp); break; case ALP2_EVENT_PART_DATA : handle_part_data(alp); break; default : /* Unexpected event type. */ break; } if (alp->done) { /* Stop parsing. */ return 0; } else { /* Go on. */ return 1; } } /** * Initialise parser. */ // XXX Make callback a typedef int alp2_create(alp2_t **_alp, apr_pool_t *mp, void *user_data, int (*user_callback)(alp2_t *alp)) { alp2_t *alp; apr_pool_t *new_pool; const char *errptr = NULL; int erroffset; /* We require a callback. */ if (user_callback == NULL) { return -1; } /* We will use our own memory pool. */ apr_pool_create(&new_pool, mp); alp = apr_pcalloc(mp, sizeof(alp2_t)); *_alp = alp; alp->mp = new_pool; alp->user_data = user_data; alp->user_callback = user_callback; /* Initialise the part parser. */ alp->pp = apr_pcalloc(mp, sizeof(alp2_pp_t)); if (alp->pp == NULL) return -1; if (alp2_pp_init(alp->pp, alp, alp2_callback, mp) < 0) { return -2; } /* Compile the patterns we use for parsing. */ /* part A pattern */ if ((alp->part_a_pattern = pcre_compile( "^\\[(.+)\\] (\\S+) ([.:0-9a-f]+) (\\d+) ([.:0-9a-f]+) (\\d+)$", PCRE_DOTALL, &errptr, &erroffset, NULL)) == NULL) { return -3; } /* request line pattern */ if ((alp->request_line_pattern = pcre_compile( // TODO Needs improving (e.g. to support simplified HTTP/0.9 requests "^(\\S+) (.*?) (HTTP/\\d\\.\\d)$", PCRE_DOTALL, &errptr, &erroffset, NULL)) == NULL) { return -4; } /* header pattern */ if ((alp->header_pattern = pcre_compile( "^([^:]+):\\s*(.+)$", PCRE_DOTALL, &errptr, &erroffset, NULL)) == NULL) { return -5; } /* response line pattern */ if ((alp->response_line_pattern = pcre_compile( "^(HTTP/\\d\\.\\d) (\\d{3})( (.+))?$", PCRE_DOTALL, &errptr, &erroffset, NULL)) == NULL) { return -6; } /* Action trailer header pattern */ if ((alp->trailer_action_pattern = pcre_compile( "^Intercepted \\(phase (\\d)\\)$", PCRE_DOTALL, &errptr, &erroffset, NULL)) == NULL) { return -7; } /* Stopwatch trailer header pattern */ if ((alp->trailer_stopwatch_pattern = pcre_compile( "^(\\d+) (\\d+)( \\((-|\\d+)\\*? (-|\\d+) (-|\\d+)\\))?$", PCRE_DOTALL, &errptr, &erroffset, NULL)) == NULL) { return -8; } /* WebApp-Info trailer header pattern */ if ((alp->trailer_webappinfo_pattern = pcre_compile( "^\"(.*)\" \"(.*)\" \"(.*)\"$", PCRE_DOTALL, &errptr, &erroffset, NULL)) == NULL) { return -9; } return 1; } /** * Process a piece of a stream of audit log entries. */ int alp2_process(alp2_t *alp, const char *data, size_t len) { alp2_pp_process(alp->pp, data, len); if (alp->done) { return 0; } else { return 1; } } /** * Destroy the parser. */ void alp2_destroy(alp2_t *alp) { apr_pool_destroy(alp->mp); } modsecurity-apache_2.7.7/alp2/alp2.h0000664000175000017500000000737712243422537017522 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #ifndef _ALP2_H_ #define _ALP2_H_ #include #include #include "alp2_pp.h" #include "pcre.h" /* -- Data structures -- */ typedef struct alp2_msg_t alp2_msg_t; struct alp2_msg_t { const char *engine_message; const char *target; const char *id; const char *rev; const char *msg; const char *data; const char *file; unsigned long file_line; size_t offset; int severity; int warning; apr_array_header_t *tags; }; typedef struct auditlog2_t auditlog2_t; struct auditlog2_t { apr_pool_t *mp; /* Transaction data */ const char *id; apr_time_t timestamp; unsigned int duration; const char *src_ip; unsigned int src_port; const char *dst_ip; unsigned int dst_port; /* Request */ unsigned int request_line_valid; const char *request_line; const char *request_method; const char *request_uri; apr_uri_t *parsed_uri; const char *request_protocol; apr_table_t *request_headers; /* Determine the hostname: The hostname from the URI is * used where present, otherwise the value of the Host * request header is used. * * If neither of these two is available we will use the * combination of the destination IP and port as hostname. * * The resulting hostname may have the port attached. */ const char *hostname; /* Response */ const char *response_protocol; unsigned int response_status; const char *response_message; apr_table_t *response_headers; const char *response_tfn; /* Other */ apr_table_t *trailer_headers; unsigned int was_intercepted; unsigned int intercept_phase; /* -1 if interception did not happen */ const char *producer; const char *server; const char *handler; const char *application_id; const char *session_id; const char *user_id; apr_array_header_t *messages; alp2_pp_entry_t *pp_entry; }; typedef struct alp2_t alp2_t; struct alp2_t { apr_pool_t *mp; void *user_data; int (*user_callback)(alp2_t *alp); alp2_pp_t *pp; unsigned int previous_part_id; unsigned int part_line_counter; unsigned int part_data_done; unsigned int seen_part_h; unsigned int done; unsigned int parse_error; apr_array_header_t *errors; /* Regular expression patterns. */ // TODO All these need reviewing pcre *part_a_pattern; pcre *request_line_pattern; pcre *header_pattern; pcre *response_line_pattern; pcre *trailer_action_pattern; pcre *trailer_stopwatch_pattern; pcre *trailer_webappinfo_pattern; auditlog2_t *auditlog; }; /* Higher-level (user) parser. */ /* NOTE Parser will create a subpool for its own use, but each * entry will be created in a separate subpool directly * under the main pool. This allows the created audit log * entries to survive the death of the parser. */ /* -- Functions -- */ int alp2_create(alp2_t **_alp, apr_pool_t *mp, void *user_data, int (*user_callback)(alp2_t *alp)); int alp2_process(alp2_t *alp, const char *data, size_t len); void alp2_destroy(alp2_t *alp); auditlog2_t *alp2_auditlog_create(apr_pool_t *mp); void alp2_auditlog_destroy(auditlog2_t *al); #endif modsecurity-apache_2.7.7/alp2/alp2_pp.c0000775000175000017500000002764312243422537020215 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #include #include #include #include "alp2_pp.h" /** * Take the line in the buffer and replace the new line * at the end with a NUL byte. */ char *alp2_pp_line_chomp(alp2_pp_t *pp) { if (pp->line_pos == 0) { pp->line_buf[0] = '\0'; } else { pp->line_buf[pp->line_pos - 1] = '\0'; } return &(pp->line_buf[0]); } /** * Look into the line buffer to determine if it * contains a boundary line. */ static int alp2_pp_is_boundary_line(alp2_pp_t *alp_pp) { char *new_boundary = NULL; unsigned int id; size_t i; /* A boundary line cannot be less than 14 characters long. */ if (alp_pp->line_pos < 15) { return 0; } /* The first two characters must both be dashes. */ if ((alp_pp->line_buf[0] != '-')||(alp_pp->line_buf[1] != '-')) { return 0; } /* Extract the boundary. */ i = 2; /* Start after the second dash. */ while((isxdigit(alp_pp->line_buf[i]))&&(i < alp_pp->line_pos)) { i++; } /* The boundary cannot be shorter than 8 characters. */ if (i - 2 < 8) { return 0; } // TODO Memory leak; use a single parser buffer to avoid per-entry // allocation from the parser pool. new_boundary = apr_pstrndup(alp_pp->mp, &(alp_pp->line_buf[2]), i - 2); /* Check if the rest of the line is valid. */ if ( (i + 5 < alp_pp->line_pos) /* Need at lest 5 more bytes. */ ||(alp_pp->line_buf[i + 0] != '-') ||(alp_pp->line_buf[i + 1] < 'A') ||(alp_pp->line_buf[i + 1] > 'Z') ||(alp_pp->line_buf[i + 2] != '-') ||(alp_pp->line_buf[i + 3] != '-') ||(alp_pp->line_buf[i + 4] != '\n') ) { return 0; } id = alp_pp->line_buf[i + 1]; /* Are we in a middle of an entry right now? */ if (alp_pp->current_entry == NULL) { /* We will accept a new boundary. */ alp_pp->boundary = new_boundary; return id; } else { /* The boundary must match the boundary of * the entry we are currently working on. */ if (strcmp(alp_pp->current_entry->boundary, new_boundary) != 0) { return 0; } else { return id; } } return 0; } /** * Process data belonging to a single part. */ static void alp2_pp_process_part_data(alp2_pp_t *alp_pp) { if (alp_pp->current_part == NULL) { return; } /* Invoke part processor. */ if (alp_pp->callback != NULL) { if (alp_pp->callback(alp_pp, ALP2_EVENT_PART_DATA) == 0) { alp_pp->done = 1; } } /* Keep track of part size. */ alp_pp->current_part->size += alp_pp->line_pos; /* Update the MD5 hash calculation. */ if ((alp_pp->current_entry != NULL)&&(alp_pp->line_pos > 0)) { apr_md5_update(alp_pp->current_entry->md5_context, &alp_pp->line_buf[0], alp_pp->line_pos - 1); } } /** * Initialise parser. */ int alp2_pp_init(alp2_pp_t *alp_pp, void *user_data, int (*callback)(alp2_pp_t *alp_pp, int event_type), apr_pool_t *mp) { memset(alp_pp, 0, sizeof(alp2_pp_t)); alp_pp->user_data = user_data; alp_pp->callback = callback; alp_pp->mp = mp; /* Use the parent pool directly. */ /* Set-up the line buffer. */ alp_pp->line_buf = apr_pcalloc(mp, ALP2_MAX_LINE_SIZE); alp_pp->line_size = ALP2_MAX_LINE_SIZE; alp_pp->line_has_start = 1; alp_pp->line_offset = 0; return 1; } /** * Process data the parser has stored in the input buffer. */ static apr_status_t alp2_pp_process_internal(alp2_pp_t *alp_pp) { /* Do not proceed if we've previously * encountered a fatal error. */ if (alp_pp->errored != 0) { return ALP2_ERROR_FATAL; } if (alp_pp->done) { return ALP2_DONE; } /* Go back straight away if we don't have anything to work with. */ if (alp_pp->input_len == 0) { return ALP2_NEED_DATA; } while (alp_pp->input_pos < alp_pp->input_len) { int c; if (alp_pp->done) { return ALP2_DONE; } if (alp_pp->line_pos >= alp_pp->line_size) { /* Our line buffer is full with the * line incomplete. */ alp2_pp_process_part_data(alp_pp); /* Reset line buffer . */ alp_pp->line_pos = 0; alp_pp->line_has_start = 0; alp_pp->line_offset = alp_pp->current_offset; } /* Consume one byte. */ c = alp_pp->input_buf[alp_pp->input_pos]; alp_pp->input_pos++; alp_pp->current_offset++; /* Copy the byte to the line buffer. */ alp_pp->line_buf[alp_pp->line_pos] = c; alp_pp->line_pos++; /* Are we at the end of a line? */ if (c == '\n') { if (alp_pp->line_has_start) { /* We have one complete line. */ int id = alp2_pp_is_boundary_line(alp_pp); if (id != 0) { /* The line is a boundary. */ /* Finish with the previous part, if any. */ if (alp_pp->current_part != NULL) { /* Update the MD5 context. */ apr_md5_update(alp_pp->current_entry->md5_context, &alp_pp->line_buf[0], alp_pp->line_pos - 1); /* Event PART_END. */ if (alp_pp->callback != NULL) { if (alp_pp->callback(alp_pp, ALP2_EVENT_PART_END) == 0) { alp_pp->done = 1; } } /* Add part to the current entry. */ *(alp2_pp_part_t **)apr_array_push(alp_pp->current_entry->parts) = alp_pp->current_part; /* Delete part. */ alp_pp->current_part = NULL; /* If the new part is part Z, then finish * with the current entry. */ if (id == 'Z') { alp_pp->current_entry->size = alp_pp->current_offset - alp_pp->current_entry->offset; /* Create the MD5 digest. */ apr_md5_final(alp_pp->current_entry->md5_digest, alp_pp->current_entry->md5_context); /* Event ENTRY_END. */ if (alp_pp->callback != NULL) { if (alp_pp->callback(alp_pp, ALP2_EVENT_ENTRY_END) == 0) { alp_pp->done = 1; } } /* We are about to destroy our only reference to the per-entry * memory pool, but that is all right since we've passed all * responsibility for the entry to the higher-level handler. */ alp_pp->current_entry = NULL; } } if (id != 'Z') { /* Create new entry if necessary. */ if (alp_pp->current_entry == NULL) { apr_pool_t *new_pool = NULL; /* Create a per-entry pool directly from the main memory pool. */ apr_pool_create(&new_pool, apr_pool_parent_get(alp_pp->mp)); alp_pp->current_entry = apr_pcalloc(new_pool, sizeof(alp2_pp_entry_t)); alp_pp->current_entry->mp = new_pool; alp_pp->current_entry->offset = alp_pp->line_offset; alp_pp->current_entry->boundary = apr_pstrdup(new_pool, alp_pp->boundary); alp_pp->boundary = NULL; alp_pp->current_entry->parts = apr_array_make(alp_pp->current_entry->mp, 16, sizeof(alp2_pp_part_t *)); /* Initialise the MD5 context. */ alp_pp->current_entry->md5_context = apr_pcalloc(alp_pp->current_entry->mp, sizeof(apr_md5_ctx_t)); apr_md5_init(alp_pp->current_entry->md5_context); /* Start calculating the has with the first line. */ apr_md5_update(alp_pp->current_entry->md5_context, &alp_pp->line_buf[0], alp_pp->line_pos - 1); /* Event ENTRY_START. */ if (alp_pp->callback != NULL) { if (alp_pp->callback(alp_pp, ALP2_EVENT_ENTRY_START) == 0) { alp_pp->done = 1; } } } /* Create new part, but only if we are not * dealing with an entry terminator. */ alp_pp->current_part = apr_pcalloc(alp_pp->current_entry->mp, sizeof(alp2_pp_part_t)); alp_pp->current_part->id = id; alp_pp->current_part->offset = alp_pp->current_offset; /* Event PART_START. */ if (alp_pp->callback != NULL) { if (alp_pp->callback(alp_pp, ALP2_EVENT_PART_START) == 0) { alp_pp->done = 1; } } } } else { /* The line does not contain a boundary, * so process it as part data. */ alp2_pp_process_part_data(alp_pp); } } else { /* We have a chunk of data that is not a line, which * probably means that our buffer was not big enough, either * because the line (is a line and it) was too big, or because * we are processing binary data. Ideally the latter. */ alp2_pp_process_part_data(alp_pp); } /* Reset the line buffer. */ alp_pp->line_pos = 0; alp_pp->line_has_start = 1; alp_pp->line_offset = alp_pp->current_offset; } } if (alp_pp->done) { return ALP2_DONE; } else { return ALP2_NEED_DATA; } } /** * Process the provided data. */ int alp2_pp_process(alp2_pp_t *alp_pp, const char *data, size_t len) { /* Do not proceed if we've previously * encountered a fatal error. */ if (alp_pp->errored != 0) { return ALP2_ERROR_FATAL; } /* Check that we've used up the existing buffer. */ if (alp_pp->input_pos < alp_pp->input_len) { return ALP2_ERROR_INCORRECT_STATE; } alp_pp->input_buf = data; alp_pp->input_len = len; alp_pp->input_pos = 0; return alp2_pp_process_internal(alp_pp); } /** * Clean-up the parser structures. */ void alp2_pp_terminate(alp2_pp_t *alp_pp) { /* Nothing to do, but we may need * to do something in the future. */ } modsecurity-apache_2.7.7/alp2/Makefile.in0000664000175000017500000006176712254306021020552 0ustar zimmerlezimmerle# Makefile.in generated by automake 1.13.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = alp2 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/build/depcomp $(include_HEADERS) ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/build/find_apr.m4 \ $(top_srcdir)/build/find_apu.m4 \ $(top_srcdir)/build/find_curl.m4 \ $(top_srcdir)/build/find_lua.m4 \ $(top_srcdir)/build/find_pcre.m4 \ $(top_srcdir)/build/find_xml.m4 $(top_srcdir)/build/libtool.m4 \ $(top_srcdir)/build/ltoptions.m4 \ $(top_srcdir)/build/ltsugar.m4 \ $(top_srcdir)/build/ltversion.m4 \ $(top_srcdir)/build/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/apache2/modsecurity_config_auto.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)" LTLIBRARIES = $(lib_LTLIBRARIES) libalp2_la_LIBADD = am_libalp2_la_OBJECTS = libalp2_la-alp2.lo libalp2_la-alp2_pp.lo libalp2_la_OBJECTS = $(am_libalp2_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = libalp2_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libalp2_la_CFLAGS) \ $(CFLAGS) $(libalp2_la_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/apache2 depcomp = $(SHELL) $(top_srcdir)/build/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libalp2_la_SOURCES) DIST_SOURCES = $(libalp2_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac HEADERS = $(include_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APR_CFLAGS = @APR_CFLAGS@ APR_CONFIG = @APR_CONFIG@ APR_CPPFLAGS = @APR_CPPFLAGS@ APR_INCLUDEDIR = @APR_INCLUDEDIR@ APR_LDADD = @APR_LDADD@ APR_LDFLAGS = @APR_LDFLAGS@ APR_LINKLD = @APR_LINKLD@ APR_VERSION = @APR_VERSION@ APU_CFLAGS = @APU_CFLAGS@ APU_CONFIG = @APU_CONFIG@ APU_INCLUDEDIR = @APU_INCLUDEDIR@ APU_LDADD = @APU_LDADD@ APU_LDFLAGS = @APU_LDFLAGS@ APU_LINKLD = @APU_LINKLD@ APU_VERSION = @APU_VERSION@ APXS = @APXS@ APXS_BINDIR = @APXS_BINDIR@ APXS_CC = @APXS_CC@ APXS_CFLAGS = @APXS_CFLAGS@ APXS_EXTRA_CFLAGS = @APXS_EXTRA_CFLAGS@ APXS_HTTPD = @APXS_HTTPD@ APXS_INCLUDEDIR = @APXS_INCLUDEDIR@ APXS_INCLUDES = @APXS_INCLUDES@ APXS_LDFLAGS = @APXS_LDFLAGS@ APXS_LIBDIR = @APXS_LIBDIR@ APXS_LIBEXECDIR = @APXS_LIBEXECDIR@ APXS_LIBS = @APXS_LIBS@ APXS_LIBTOOL = @APXS_LIBTOOL@ APXS_MODULES = @APXS_MODULES@ APXS_PROGNAME = @APXS_PROGNAME@ APXS_SBINDIR = @APXS_SBINDIR@ APXS_WRAPPER = @APXS_WRAPPER@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CURL_CFLAGS = @CURL_CFLAGS@ CURL_CONFIG = @CURL_CONFIG@ CURL_CPPFLAGS = @CURL_CPPFLAGS@ CURL_LDADD = @CURL_LDADD@ CURL_LDFLAGS = @CURL_LDFLAGS@ CURL_USES_GNUTLS = @CURL_USES_GNUTLS@ CURL_VERSION = @CURL_VERSION@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENV_CMD = @ENV_CMD@ EXEEXT = @EXEEXT@ EXTRA_CFLAGS = @EXTRA_CFLAGS@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ LIBXML2_CONFIG = @LIBXML2_CONFIG@ LIBXML2_CPPFLAGS = @LIBXML2_CPPFLAGS@ LIBXML2_LDADD = @LIBXML2_LDADD@ LIBXML2_LDFLAGS = @LIBXML2_LDFLAGS@ LIBXML2_VERSION = @LIBXML2_VERSION@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LUA_CFLAGS = @LUA_CFLAGS@ LUA_LDADD = @LUA_LDADD@ LUA_LDFLAGS = @LUA_LDFLAGS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MODSEC_APXS_EXTRA_CFLAGS = @MODSEC_APXS_EXTRA_CFLAGS@ MODSEC_EXTRA_CFLAGS = @MODSEC_EXTRA_CFLAGS@ MSC_BASE_DIR = @MSC_BASE_DIR@ MSC_PKGBASE_DIR = @MSC_PKGBASE_DIR@ MSC_REGRESSION_CONF_DIR = @MSC_REGRESSION_CONF_DIR@ MSC_REGRESSION_DIR = @MSC_REGRESSION_DIR@ MSC_REGRESSION_DOCROOT_DIR = @MSC_REGRESSION_DOCROOT_DIR@ MSC_REGRESSION_LOGS_DIR = @MSC_REGRESSION_LOGS_DIR@ MSC_REGRESSION_SERVERROOT_DIR = @MSC_REGRESSION_SERVERROOT_DIR@ MSC_TEST_DIR = @MSC_TEST_DIR@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCRE_CFLAGS = @PCRE_CFLAGS@ PCRE_CONFIG = @PCRE_CONFIG@ PCRE_CPPFLAGS = @PCRE_CPPFLAGS@ PCRE_LDADD = @PCRE_LDADD@ PCRE_LDFLAGS = @PCRE_LDFLAGS@ PCRE_LD_PATH = @PCRE_LD_PATH@ PCRE_VERSION = @PCRE_VERSION@ PERL = @PERL@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOPLEVEL_SUBDIRS = @TOPLEVEL_SUBDIRS@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ lib_LTLIBRARIES = libalp2.la include_HEADERS = alp2.h \ alp2_pp.h libalp2_la_SOURCES = alp2.c \ alp2_pp.c libalp2_la_CFLAGS = @APR_CFLAGS@ \ @APU_CFLAGS@ libalp2_la_LDFLAGS = @APR_LDFLAGS@ \ @APU_LDFLAGS@ all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign alp2/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign alp2/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ } uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libalp2.la: $(libalp2_la_OBJECTS) $(libalp2_la_DEPENDENCIES) $(EXTRA_libalp2_la_DEPENDENCIES) $(AM_V_CCLD)$(libalp2_la_LINK) -rpath $(libdir) $(libalp2_la_OBJECTS) $(libalp2_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libalp2_la-alp2.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libalp2_la-alp2_pp.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< libalp2_la-alp2.lo: alp2.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libalp2_la_CFLAGS) $(CFLAGS) -MT libalp2_la-alp2.lo -MD -MP -MF $(DEPDIR)/libalp2_la-alp2.Tpo -c -o libalp2_la-alp2.lo `test -f 'alp2.c' || echo '$(srcdir)/'`alp2.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libalp2_la-alp2.Tpo $(DEPDIR)/libalp2_la-alp2.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='alp2.c' object='libalp2_la-alp2.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libalp2_la_CFLAGS) $(CFLAGS) -c -o libalp2_la-alp2.lo `test -f 'alp2.c' || echo '$(srcdir)/'`alp2.c libalp2_la-alp2_pp.lo: alp2_pp.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libalp2_la_CFLAGS) $(CFLAGS) -MT libalp2_la-alp2_pp.lo -MD -MP -MF $(DEPDIR)/libalp2_la-alp2_pp.Tpo -c -o libalp2_la-alp2_pp.lo `test -f 'alp2_pp.c' || echo '$(srcdir)/'`alp2_pp.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libalp2_la-alp2_pp.Tpo $(DEPDIR)/libalp2_la-alp2_pp.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='alp2_pp.c' object='libalp2_la-alp2_pp.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libalp2_la_CFLAGS) $(CFLAGS) -c -o libalp2_la-alp2_pp.lo `test -f 'alp2_pp.c' || echo '$(srcdir)/'`alp2_pp.c mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-includeHEADERS: $(include_HEADERS) @$(NORMAL_INSTALL) @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \ $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \ done uninstall-includeHEADERS: @$(NORMAL_UNINSTALL) @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir) ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-includeHEADERS install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-libLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-libLTLIBRARIES clean-libtool cscopelist-am ctags \ ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am \ install-includeHEADERS install-info install-info-am \ install-libLTLIBRARIES install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am uninstall-includeHEADERS \ uninstall-libLTLIBRARIES # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: modsecurity-apache_2.7.7/README_WINDOWS.TXT0000664000175000017500000001707512252072467020424 0ustar zimmerlezimmerle===================================================================== MOD_SECURITY 2.6 Command-line Build notes for Windows 4/2/2011 by Tom Donovam ===================================================================== PREREQUISITES: Microsoft Visual Studio C++ tested with Visual Studio 2008 (aka VC9) CMake build system from: http://www.cmake.org/ tested with CMake v2.8.0 Apache 2.2.x from: http://httpd.apache.org/ tested with Apache 2.2.17 Apache must be built from source using the same Visual Studio compiler as mod_security. PCRE Perl Compatible Regular Expression library from: http://www.pcre.org/ tested with PCRE v8.12 LibXML2 from: http://xmlsoft.org/ tested with LibXML2 v2.7.7 Note that LibXML2 v2.7.8 does not build correctly for Windows Lua Scripting Language from: http://www.lua.org/ tested with Lua v5.1.4 cURL multiprotocol file transfer library from: http://curl.haxx.se/ tested with cURL v7.21.4 BEFORE BUILDING The directory where you build software from source ( C:\work in this exmaple) must contain the Apache source you used to build the Apache web serverand the mod_security source Apache source is in C:\work\httpd-2.2.17 in this example. Apache has been installed to C:\Apache2217 in this example. Mod_security source is in C:\work\mod_security in this example. Download and untar the prerequite library sources: Download pcre-8.12.tar.gz from ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/ untar it into C:\work\ creating C:\work\pcre-8.12 Download libxml2-2.7.7.tar.gz from ftp://xmlsoft.org/libxml2/ untar it into C:\work\ creating C:\work\libxml2-2.7.7 Download lua-5.1.4.tar.gz from http://www.lua.org/ftp/ untar it into C:\work\ creating C:\work\lua-5.1.4 Download curl-7.21.4.tar.gz from http://curl.haxx.se/download.html untar it into C:\work\ creating C:\work\curl-7.21.4 Setup your build environment: The PATH environment variable must include the Visual Studio variables as set by vsvars32.bat The PATH environment variable must also include the CMAKE bin\ directory Set an environment variable to the Apache source code directory: SET HTTPD_BUILD=C:\work\httpd-2.2.17 If OpenSSL and Zlib support were included when you built Apache 2.2, and you want them available to LIBXML2 and CURL Ensure that cURL and libXML2 can find the OpenSSL and Zlib includes and libraries that Apache was built with. SET INCLUDE=%INCLUDE%;%HTTPD_BUILD%\srclib\openssl\inc32;%HTTPD_BUILD%\srclib\zlib SET LIB=%LIB%;%HTTPD_BUILD%\srclib\openssl\out32dll;%HTTPD_BUILD%\srclib\zlib Ensure that cURL and libXML2 don't use the static zlib library: zlib.lib. Force cURL and libXML2 to use zdll.lib instead, requiring zlib1.dll at runtime: IF EXIST %HTTPD_BUILD%\srclib\zlib\zlib.lib DEL %HTTPD_BUILD%\srclib\zlib\zlib.lib BUILD PCRE-8.12 CD C:\work\pcre-8.12 CMAKE -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_SHARED_LIBS=True NMAKE BUILD LIBXML2-2.7.7 (note: the more recent version: 2.7.8 does not build correctly on Windows) CD C:\work\libxml2-2.7.7\win32 CSCRIPT configure.js iconv=no vcmanifest=yes zlib=yes NMAKE -f Makefile.msvc BUILD LUA-5.1.4 CD C:\work\lua-5.1.4\src CL /Ox /arch:SSE2 /GF /GL /Gy /FD /EHsc /MD /Zi /TC /wd4005 /D "_MBCS" /D "LUA_CORE" /D "LUA_BUILD_AS_DLL" /D "_CRT_SECURE_NO_WARNINGS" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_WIN32" /D "_WINDLL" /c *.c DEL lua.obj luac.obj LINK /DLL /LTCG /DEBUG /OUT:lua5.1.dll *.obj IF EXIST lua5.1.dll.manifest MT -manifest lua5.1.dll.manifest -outputresource:lua5.1.dll;2 BUILD CURL-7.21.4 CD C:\work\curl-7.21.4 CMAKE -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_SHARED_LIBS=True -DCURL_ZLIB=True NMAKE BUILD MOD_SECURITY-2.6 CD C:\work\mod_security\apache2 NMAKE -f Makefile.win APACHE=C:\Apache2217 PCRE=C:\work\pcre-8.12 LIBXML2=C:\work\libxml2-2.7.7 LUA=C:\work\lua-5.1.4\src INSTALL MOD_SECURITY AND RUN APACHE Copy these five files to C:\Apache2217\bin: C:\work\pcre-8.12\pcre.dll C:\Apache2217\bin\ C:\work\lua-5.1.4\src\lua5.1.dll C:\Apache2217\bin\ C:\work\libxml2-2.7.7\win32\bin.msvc\libxml2.dll C:\Apache2217\bin\ C:\work\curl-7.21.4\libcurl.dll C:\Apache2217\bin\ C:\work\mod_security\apache2\mlogc-src\mlogc.exe Copy this one file to C:\Apache2217\modules: C:\work\mod_security\apache2\mod_security2.so You may also copy C:\work\curl-7.21.4\curl.exe to C:\Apache2217\bin, if you want to use the cURL command-line program. Download the core rules from http://sourceforge.net/projects/mod-security/files/modsecurity-crs/0-CURRENT/ and unzip them into C:\Apache2217\conf\modsecurity_crs Add configuration directives to your Apache conf\httpd.conf: # mod_security requires mod_unique_id LoadModule unique_id_module modules/mod_unique_id.so # mod_security LoadModule security2_module modules/mod_security2.so SecRuleEngine On SecDataDir logs Include conf/modsecurity_crs/*.conf Include conf/modsecurity_crs/base_rules/*.conf SecAuditEngine RelevantOnly SecAuditLogRelevantStatus "^(?:5|4\d[^4])" SecAuditLogType Serial SecAuditLogParts ABCDEFGHZ SecAuditLog logs/modsecurity.log ============================================================================================== OPTIONAL: BUILD AND CONFIGURE THE MOD_SECURITY-2.6 MLOGC piped-logging program Edit the top of C:\work\mod_security\apache2\mlogc-src\Makefile.win and set your local paths # Path to Apache httpd installation BASE = C:\Apache2217 # Paths to required libraries PCRE = C:\work\pcre-8.12 CURL = C:\work\curl-7.21.4 # Linking libraries LIBS = $(BASE)\lib\libapr-1.lib \ $(BASE)\lib\libaprutil-1.lib \ $(PCRE)\pcre.lib \ $(CURL)\libcurl_imp.lib \ wsock32.lib Build the mlogc.exe program: CD C:\work\mod_security_trunk\mlogc NMAKE -f Makefile.win Copy mlocg.exe to C:\Apache2217\bin\ Create a new command file C:\Apache2217\bin\mlogc.bat with one line: C:\Apache2217\bin\mlogc.exe C:\Apache2217\conf\mlogc.conf Create a new configuration file C:\Apache2217\conf\mlogc.conf to control the piped-logging program mlogc.exe. Here is an example conf\mlogc.conf: CollectorRoot "C:/Apache2217/logs" ConsoleURI "https://localhost:8888/rpc/auditLogReceiver" SensorUsername "test" SensorPassword "testtest" LogStorageDir "data" TransactionLog "mlogc-transaction.log" QueuePath "mlogc-queue.log" ErrorLog "mlogc-error.log" LockFile "mlogc.lck" KeepEntries 0 ErrorLogLevel 2 MaxConnections 10 MaxWorkerRequests 1000 TransactionDelay 50 StartupDelay 5000 CheckpointInterval 15 ServerErrorTimeout 60 Change the SecAuditLog directive in conf\httpd.conf to pipe the log data to mlogc instead of writing them to a file: SecAuditLog |C:/Apache2217/bin/mlogc.bat modsecurity-apache_2.7.7/CHANGES0000664000175000017500000016502212254305550016635 0ustar zimmerlezimmerle17 Dec 2013 - 2.7.7 ------------------- Fixes: - Changed release version to 2.7.7 - Got the configure scripts inside the release tarball 16 Dec 2013 - 2.7.6 ------------------- Improvements: - Organizes all Makefile.am - 1cde4d2dd9d96747536c1c25d06ba0677069477f Now using one file per line (sorted). This is the better way to handle it, since it reduces the possibility of merge conflicts. - nginx: generates config file using configure input. - 351b9cc357d439e30ebd61d89a9e38ecf55c6827 The nginx config file was looking for depedencies by its own, by doing that it was ignoring the options that were passed to configure script. This commit deletes this config file and adds a meta-config which is populated by configure whenever the standalone-module is enabled. - nginx: adds lua support - da16d9e5d51d4ef8734687514a4e1368e7fb4284 - iis: Cosmetics fixies on sqli. - 5046c8327ea21c69b4c0d0c0057c692b05b09fef This is needed to get it compiled with VS2011 on Windows8 - Regression tests: makes configuration compatible with 2.2 and 2.4 (try 2) - ae252ee8767069363906e5a611dff487b799b839 - nginx: Trying apxs and apxs2 while compiling nginx module - 65d9272fdc353e1263567b60604542d377d19672 - nginx: Trying apxs and apxs2 while compiling nginx module - 35fd75d859e4a8873b8843da1db13e04a1b08140 - macos: Using glibtoolize instead of libtoolize - 751a9f4e45213cd69f00c62c71edc9d7ad99b82d - regression-tests: makes configuration compatible with 2.2 and 2.4 - 6fc4cac37ab1be8d1232140042b58fe4bd93ee17 - Regression test: get it working with apache 2.4 - e9813cd0d9bfc5b0c9aa5832634ec1b39b805108 Changes in httpd.conf.in to get it working with apache 2.4 - Code cosmetics. - 7366f35c1d80772d739b35da8faa972f92a72b97 Changed to reduce the number of possible fails during Build Bot compilation. - iis: Waiting for 5 seconds before move curl directory - 9bf2959c919587ebc63f5a1b8c0785da8927bff5 Testing buildbot. - Redefines unixd_set_global_mutex_perms on tests - f70f6f4281b806627e0cf0dbb9c84ae5864bdb16 Avoding conflicts with the standalone implementation - Adds verbose quality check - 388943440cc9b8c6fdea09f5e365a2e5a3e792e2 Vera++ and ccpcheck are not outputing to the stderr instead stdout allowing the buildbot to extract some numbers about it. - Adds support for coding style and quality check - b77e90152d119609ac78a7028383c3b79898b2cf Initial effort to get the code on shape. This will be executed by the buildbots as soon as they get ready for it. - iis: New improvements on the Wix installer - 2ea5a74a7bfb00f21312e51e48aa6dac03d84600 * Now the installation is divided in modules: ModSecurity and CRS. * Added default configuration * Configuration was moved to "Program Files" folder * Build_msi script now using candle available in %PATH% - iis: Removes the installer helper dependency - 1a12648c9f6028f251af0f03c889397c7954b74c Now using appcmd directly with WiX instead of calling the installer helper. - iis: Remove readme.html - 550d5aae21cba696cac1ce75ab8113e5255d5a59 This HTML is about "Creating a Native Module for IIS7" not straight related to ModSecurity itself. - iis: Adds batch script to compile Wix - a2c5fc831baf0b324ebb66b0f878dacf1ec2f808 This batch script can be used to generate our msi installer. - iis: Adds Wix installer resources - 3604763e15a665eb7a6ecae1f7e7c65cebbb1d17 This is all about cosmetic changes. - iss: Removes Post-Build event. - 28bbde1bb218b004654cb865fc8563d69b848dc2 There was a copy on Post-Build event using a hard coded path. This patch removes this Post-Build event. - iis: Relative paths on the VS project file - 368617ddb2443f9b6036f80a648d467d07c9a054 There are a ModSecurityIIS solution and project files, those were using hard coded paths to meet the dependencies. As consequence of the last update in our build scripts, now we are able to built the dependencies and load it to our Visual Studio project using relative paths. - iis: Adds release script - 9477118903861ce80c4c27cb581bf3462315e98e - iis: fixies the Installer.cpp coding style - 79875b1af8e8571098345b91557bab9c06eb7c88 - iis: Removes AppWizard remade file - 91738f93bcc82b6ab756c550a66b6cf6af2fa9f8 Apparently the AppWizard was used to generate part of this Installer, the ReadMe.txt created by the AppWizard was removed by this commit - iss: Removes pre-compiled headers - adfbeb85dcfa9466b72eebb8d1bd8eb7728bab79 No need to use the pre-compiled headers in InstallerHelper, removing it, in order to keep the project lean. - iis: Moves installer to InstallerHelper - 6adf25667dd4bfa33010bd6d8ae3d35046a69967 To organize the folder the Installer application was renamed to installer helper. It is not the real installer, it is just an helper which is executed during the installation phase. - iss: Removes fart dependencies - 8c3b8d81b613aaa38f28472af1eb26c90c7fc9da This commit removes the dependency of the fart.exe utility. The utility was responsible to rename contents inside some dependencies build files. Those modifications are not longer needed. - iss: Better err handling in build scripts. - 192599bf63b6ae5aa08e4536a90d5d0a17f969f7 Now checking for errors in every step of the build phase - iis: Moves build_module.bat to build_modsecurity.bat - e25c6b2e85ced7beba4d41867dbdf30e9c1286d3 The build_modsecurity.bat is now on the iis sub-directory, not in the dependencies anymore. Its content was also changed fixing all the paths. - iis: Identifies arch before unzip apache - cf5de78dfb9fffd21edf17af9e1db8f2fd83c804 Currently we need the Apache binary which could be used in 32 or 64 bits. This patch makes usage of 'cl' to identify which architecture is set. - iis: Renamves winbuild to dependencies - 1447766e816a896e88c9c8f053fcc3f62797bac1 Since the directory becomes all about dependencies there is no need to call it winbuild anymore. - iis: Removes unnecessary files from winbuild dir - 9f8cbf6ed8034ba42aa4967699308df09864fd18 Those .mak files seems to be part of an old build system. Since the script are now working fine, this commit removes all those .mac files and also a CMakeList.txt and the Makefile.win. - iis: Improves the iis build system - b277e538f28c87c81c1b50925dd8b82996b88294 Now checking for common errors while building. Refactoring on the build scripts, now there is this build_dependencies.bat script on the iis sub-folder. By calling this script all the dependencies should be build under the winbuild/. This commit also removes build scripts that were not needed anymore. - iis: Fixes the vcxproj file - a946a163f0ad822c760af80ca32dda61f0e6b2a9 Versions of the dependencies were changed, as long as the version of the Visual Studio, now 12. - iis: Removes unecessary files from the build system - 26738d2e34bcc7620047bd23180e0e26a64c71ee The following files were removed: * VCVarsQueryRegistry.bat * vcvars64.bat * vsvars32.bat The visual studio files can be called direcltly, not necessary to distribute those files, at least in VS12. - iss: Changes httpd version 2.4.6 - 0a772cb0748aa51a01800e0473309b9de792b456 Apache version was changed to 2.4.6 to sync with the current apache lounge version. - iis: Changes the version of the dependencies - 3e6fb41d36b7a5e98a55d8f52b88b29d1bd50b64 * pcre from 8.30 to 8.33 * zlib from 1.2.7 to 1.2.8 * libxml2 from 2.7.7 to 2.9.1 * curl from 7.24 to 7.33.0 - Removes standalone/Makefile.in - e3c19d53d23c48fea337aae76a87b2a85c36a1f1 Makefile.in is recommended to be in the repository whenever it is edit manually, in our case the automatically generated Makefile.in is ok. Bug Fixes: - test: Avoids conflict of fuctions definition - cef72855e4106ce29e1d39103ebf9eb9ab28f17e - test: Makes the unit tests to work again - cc982ae42ec86c79a67be1a01c6ee35fb06c272c The unit tests was not working due to lack update. This patch adds the necessary stuff to have it work again. - iis: Avoids directory link while building - ad330a44bfa39430cf6340cb52971568cccdf1d6 Build scripts was creating links allowing the project to be loaded into Visual Studio without care about the dependencies versions. Sometimes windows refuse to delete those links leading the script to fail. This patch moves the sources directories instead of create links to it. - QA: Avoids the utilization of 3rd filedescriptor - 69c5ccac662f4e11a6eefd54a3e912583c067b9d No need to use a 3rd description on the quality check scripts. Stderr is now redirected to stdout and filtered as needed. - Supports WarningCountingShellCommand in cppcheck and vera - baaf502363e68c3240b60adb7f7c91f5b4f0ba03 WarningCountingShellCommand allow us to have some measurements on the buildbot waterfall. - iis: Using base_rules instead of activated_rules - 7b1537058fa451e0df7098cd907ef19f04102f9d - iis: Fix inet_pton build problem - a4202146b8d26b6615bbab986383fe0afae60d77 There is a function named inet_pton on windows API, with different signature. This patch just override the windows function and point the inet_pton to our implementation. - iis: Adds Wix installer xml file.c - b32cb7d9ab397160f0154aa4bd4e9638658b41e6 This commit adds the Wix template to our git repository. - iis: build_modsecurity.bat fixies - 7e03e3f840375ed682c35a5bb67932461cc77013 This commit enable a cleanup on the mod_security build directory avoiding symbols with different architectures. - iis: Fix mlogc build on windows - 9b7663fa79377a0685130a019916d810f31e7478 The libcurl path was not pointing to the correct directory - Fix #154, Uses addn instead of apr_table_setn - 1734221d9d3a78f9aafd68e35717da9ee1a4fe51 The headers are represented in the format of an apr_table, which is able to handle elements with the same key, however the function apr_table_setn checks if the key exists before add the element, if so it replaces the old value with the new one. This was making our implementation to just keep the last added Cookie. The apr_table_addn function, which is now used, just add a new item without check for olders one. - Merge pull request #579 from zimmerle/revert_139 - 61e54f2067ae760808359926ff91d57275df1aac Revert merge request #139 - Revert "Merge pull request #139 from chaizhenhua/remotes/trunk" - 7f7d00fa2c364716691df1b45779304b24a0debb This reverts commit 10fd40fb0d06f6c577d870b6f15d2f6e2a3a5b1b, reversing changes made to 414033aafa94cd50c9b310afd3f164740caccc94. - Merge pull request #578 from client9/remotes/trunk - b0c3977845f60747b15ae10531b7d20355a22627 libinjection sync to v3.8.0 - libinjection sync - a5f175d79fac1e69124da4e1e227b622e7e233d7 - Merge pull request #152 from client9/remotes/trunk - 88ebf8a0bdbc4db1be76f3a2e70df77cc52a5925 Sync to libinjection v3.7.1 - libinjection sync - fcb6dc13ed6efb066fb9b70405eecab8b83a2d96 - libinjection sync - f52242a013f301ca5c17e59b662124833cb7cc6d - Merge pull request #148 from zimmerle/bugfix_charset_missing_string_terminator - b76e26d81ddafc2b99bffad53d1426f8fd33080a Bugfix: missing string terminator while mounting the charset (nginx) - Bugfix: missing string terminator while mounting the charset (nginx) - ff19dcd5c53d4af61d0a9397d4616f47f80ee207 The charset in headers is mounted using ngx_snprintf which does not place the string terminator. This patch adds the terminator at the end of the string. The size was correctly allocated, just missing the terminator. - Merge pull request #141 from client9/remotes/trunk - 9a630eea23a7ead4e77617c86dc937fd7a421a57 libinjection sync to v3.6.0 - libinjection sync - 11217207e8f2e0cf15742273836399866971071a - Fix Chunked string case sensitive issue - CVE-2013-5705 - f8d441cd25172fdfe5b613442fedfc0da3cc333d - Revert "Fix Chuncked string case sensitive issue" - 3901128f17e0763ac1a260106b79859d2aad6d90 This reverts commit 16a815a3c2735f62238ef99af26090a2b8430d3d. - Fix Chuncked string case sensitive issue - 16a815a3c2735f62238ef99af26090a2b8430d3d - Merge pull request #139 from chaizhenhua/remotes/trunk - 10fd40fb0d06f6c577d870b6f15d2f6e2a3a5b1b Fixed fd leackage after reload - Merge pull request #138 from client9/remotes/trunk - 414033aafa94cd50c9b310afd3f164740caccc94 libinjection sync - Fixed fd leackage after reload - e0993fcd7a166ce9e1a279a47d050af1311d9001 - libinjection sync - 2268626c20260e88cab9b7830f8a06101fa7172a - Fix logical disjunction and conjunction issues - 7e0a9ecf7d492e85650671a0cfcfd53e5f15df2c 23 Jul 2013 - 2.7.5 ------------------- Improvements: * SecUnicodeCodePage is deprecated. SecUnicodeMapFile now accepts the code page as a second parameter. * Updated Libinjection to version 3.4.1. Many improvements were made. * Severity action now supports strings (emergency, alert, critical, error, warning, notice, info, debug). Bug Fixes: * Fixed utf8toUnicode tfn null byte conversion. * Fixed NGINX crash when issue reload command. * Fixed flush output buffer before inject modified hashed response body. * Fixed url normalization for Hash Engine. * Fixed NGINX ap_unixd_set_global_perms_mutex compilation error with apache 2.4 devel files. Security Issues: 10 May 2013 - 2.7.4 ------------------- Improvements: * Added Libinjection project http://www.client9.com/projects/libinjection/ as a new operator @detectSQLi. (Thanks Nick Galbreath). * Added new variable SDBM_DELETE_ERROR that will be set to 1 when sdbm engine fails to delete entries. * NGINX is now set to STABLE. Thanks chaizhenhua and all the people in community who help the project testing, sending feedback and patches. Bug Fixes: * Fixed SecRulePerfTime storing unnecessary rules performance times. * Fixed Possible SDBM deadlock condition. * Fixed Possible @rsub memory leak. * Fixed REMOTE_ADDR content will receive the client ip address when mod_remoteip.c is present. * Fixed NGINX Audit engine in Concurrent mode was overwriting existing alert files because a issue with UNIQUE_ID. * Fixed CPU 100% issue in NGINX port. This is also related to an memory leak when loading response body. Security Issues: * Fixed Remote Null Pointer DeReference (CVE-2013-2765). When forceRequestBodyVariable action is triggered and a unknown Content-Type is used, mod_security will crash trying to manipulate msr->msc_reqbody_chunks->elts however msr->msc_reqbody_chunks is NULL. (Thanks Younes JAAIDI). 28 Mar 2013 - 2.7.3 ------------------- * Fixed IIS version race condition when module is initialized. * Fixed IIS version failing config commands in libapr. * Nginx version is now RC quality. The rule engine should works for all phases. We fixed many issues and missing features (for more information please check jira). Code is running well with latest Nginx 1.2.7 stable. Thanks chaizhenhua for your help. * Added MULTIPART_NAME and MULTIPART_FILENAME. Should be used soon by CRS and will help prevent attacks using multipart data. * Added --enable-htaccess-config configure option. It will allow the follow directives to be used into .htaccess files when AllowOverride Options is set: - SecAction - SecRule - SecRuleRemoveByMsg - SecRuleRemoveByTag - SecRuleRemoveById - SecRuleUpdateActionById - SecRuleUpdateTargetById - SecRuleUpdateTargetByTag - SecRuleUpdateTargetByMsg * Improvements in the ID duplicate code checking. Should be faster now. * SECURITY: Added SecXmlExternalEntity (On|Off - default it Off) that will disable by default the external entity load task executed by LibXml2. This is a security issue [CVE-2013-1915] reported by Timur Yunusov, Alexey Osipov (Positive Technologies). 21 Jan 2013 - 2.7.2 ------------------- * IIS version is now stable. * Fixed IIS version does not pass through POST data to ASP.NET when SecRequestBodyAccess is set to On (MODSEC-372). * Fixed IIS version HTTP Request Smuggling protection does not work (MODSEC-344). * Fixed IIS version PHP Injection Attack (958976) protection does not work (MODSEC-346). * Fixed IIS version Request limit protections are not working (MODSEC-349). * Fixed IIS version Outbound protections are not working (MODSEC-350). * Added IIS version better installer. * NGINX version removed ModSecurityPassCommand (Thanks chaizhenhua). * Fixed NGINX version ngx_http_read_client_request_body returned unexpected buffer type (Thanks chaizhenhua). * Fixed NGINX version INCS config directories on fedora (Thanks chaizhenhua). * Added NGINX version Added drop action for nginx (Thanks chaizhenhua). * Fixed bug in cpf_verify operator (Thanks Hideaki Hayashi). * Fixed build modsecurity under Arch Linux. * Fixed make test crashing when JIT pcre is enabled. * Fixed better cookie separator detection code. * Fixed mod_security displaying wrong ip address in error.log using apache 2.4 and mod_remoteip. * Fixed mod_security was not compiling when use apr without ipv6 support. * Fixed mod_security was not compiling when use lua 5.2. * Fixed issue when execute make install under Solaris. * Fixed ipmatchf operator was not working as expected. 01 Nov 2012 - 2.7.1 ------------------- * Changed "Encryption" name of directives and options related to hmac feature to "Hash". SecEncryptionEngine to SecHashEngine SecEncryptionKey to SecHashKey SecEncryptionParam to SecHashParam SecEncryptionMethodRx to SecHashMethodRx SecEncryptionMethodPm to SecHashMethodPm @validateEncryption to @validateHash ctl:EncryptionEnforcement to ctl:HashEnforcement ctl:EncryptionEngine to ctl:HashEngine * Added a better random bytes generator using apr_generate_random_bytes() to create the HMAC key. * Fixed byte conversion issue during logging under Linux s390x platform. * Fixed compilation bug with LibXML2 2.9.0 (Thanks Athmane Madjoudj). * Fixed parsing error with modsecurity-recommended.conf and Apache 2.4. * Fixed DROP action was disabled for Apache 2 module by mistake. * Fixed bug when use ctl:ruleRemoveTargetByTag. * Fixed IIS and NGINX modules bugs. * Fixed bug when @strmatch patterns use invalid escape sequence (Thanks Hideaki Hayashi). * Fixed bugs in @verifySSN (Thanks Hideaki Hayashi). * The doc/ directory now contains the instructions to access online documentation. 15 Oct 2012 - 2.7.0 ------------------- * Fixed Pause action should work as a disruptive action (MODSEC-297). * Fixed Problem loading mod_env variables in phase 2 (MODSEC-226). * Fixed Detect cookie v0 separator and use it for parsing (MODSEC-261). * Fixed Variable REMOTE_ADDR with wrong IP address in NGINX version (MODSEC-337). * Fixed Errors compiling NGINX version. * Added Include directive into standalone module. IIS and NGINX module should support Include directive like Apache2. * Added MULTIPART_INVALID_PART flag. Also used in rule id 200002 for multipart strict validation. https://www.sec-consult.com/fxdata/seccons/prod/temedia/advisories_txt/20121017-0_mod_security_ruleset_bypass.txt). * Updated Reference Manual. 25 Sep 2012 - 2.6.8 ------------------- * Fixed ctl:ruleRemoveTargetByID order issue (MODSEC-333). Thanks to Armadillo Dasypodidae. * Fixed variable HIGHEST_SEVERITY incorrectly gets reset in a chain rule (MODSEC-315). Thanks to Valery Reznic. 10 Sep 2012 - 2.7.0-rc3 ------------------- * Fixed requests bigger than SecRequestBodyNoFilesLimit were truncated even engine mode was detection only. * Fixed double close() for multipart temporary files (Thanks Seema Deepak). * Fixed many small issues reported by Coverity Scanner (Thanks Peter Vrabek). * Fixed format string issue in ngnix experimental code. (Thanks Eldar Zaitov). * Added ctl:ruleRemoveTargetByTag/Msg and removed ctl:ruleUpdateTargetByTag/Msg. * Added IIS and Ngnix platform code. * Added new transformation utf8toUnicode. 23 Jul 2012 - 2.6.7 ------------------- * Fixed explicit target replacement using SecUpdateTargetById was broken. * The ctl:ruleUpdateTargetById is deprecated and will be removed for future versions since there is no safe way to use it per-request. * Added ctl:ruleRemoveTargetById that can be used to exclude targets to be processed per-request. 22 Jun 2012 - 2.7.0-rc2 ------------------- * Fixed compilation errors and warnings under Windows platform. * Fixed SecEncryptionKey was not working as expected. 08 Jun 2012 - 2.7.0-rc1 ------------------- * Added SecEncryptionEngine. Initial crypt engine support, at the momment it will sign some Html and Response Header options. * Added SecEncryptionKey to define the a rand or static key for crypt engine. * Added SecEncryptionParam to define the new parameter name. * Added SecEncryptionMethodRx used with a regular expression to inspect the html in response body/header and decide what to protect. * Added SecEncryptionMethodPm used with multiple or single strings to inspect the html in response body/header and decide what to protect. * Added ctl encryptionEngine as a per transaction version of SecEncryptionEgine diretive. * Added ctl encryptionEnforcement that will allow the engine to sign the data but the enforcement is disabled. * Added validateEncryption operator to enforce the signed elements. * Added rsub operator supports the syntax |hex| allowing users to use special chars like \n \r. * Added SecRuleUpdateTargetById now supports id range. * Added SecRuleUpdateTargetByMsg and its ctl version (Thanks Scott Gifford). * Added SecRuleUpdateTargetByTag and its ctl version (Thanks Scott Gifford). * Added SecRulePerfTime when greater than zero it will fill rule id's execution time into PERF_RULE and log id=usec information in the new Perf-rule-info: line in part H. * Added PERF_RULES variable that contains rule execution time. * Added Engine-mode: section in part H. * Added ruleRemoveByMsg ctl version. * Added removeCommentsChar and removeComments now can work with style. * Added SecArgumentSeparator and SecCookieFormat can be used in different scope locations. * Added Rules must have ID action and must be numeric. * Added The use of tfns are deprecated in SecDefaultAction. Should be forbid in the future. * Added Macro expansion support to the action pause. * Added IpmatchFromFile/IpmatchF operator. * Added New setrsc action, the RESOURCE collection used SecWebAppId Name Space * Added Configure option --enable-cache-lua that allows reuse of Lua VM per transaction. It will only take any effect when ModSecurity has multiple scripts to run per transaction. * Added Configure option --enable-pcre-jit that allows ModSecurity regex engine to use PCRE Jit support. * Added Configure option --enable-request-early that allows ModSecurity run phase 1 in post_read_request hook. * Added RBL operator now support the httpBl api (http://www.projecthoneypot.org/httpbl_api.php). * Added SecHttpBlKey to be used with httpBl api. * Added SecSensorId will specify the modsecurity sensor name into audit log part H. * Added aliases to phase:2 (phase:request), phase:4 (phase:response) and phase:5 (phase:logging). * Added USERAGENT_IP variable. Created when Apache24 is used with mod_remoteip to know the real client ip address. ^ Added new rule metadata actions ver, maturity and accuracy. Also included into RULE collection. * Updated Reference manual into doc/ directory. * Fixed Variable DURATION contains the elapsed time in microseconds for compatible reasons with apache and other variables. * Fixed Preserve names/identity of the variables going into MATCHED_VARS. * Fixed Redirect macro expansion does not work in SecDefaultAction when SecRule uses block action. * Fixed rsub operator does not work as expect if regex contains parentheses (Thanks Jerome Freilinger). * Current Google Safe Browsing implementation is deprecated. Google changed the API and does not allow anymore the malware database for download. 08 Jun 2012 - 2.6.6 ------------------- * Added build system support for KfreeBSD and HURD. * Fixed a multipart bypass issue related to quote parsing Credits to Qualys Vulnerability & Malware Research Labs (VMRL). 20 Mar 2012 - 2.6.5 ------------------- * Fixed increased a specific message debug level in SBDM code (MODSEC-293). * Cleanup build system. 09 Mar 2012 - 2.6.4 ------------------- * Fixed Mlogc 100% CPU consume (Thanks Klaubert Herr and Ebrahim Khalilzadeh). * Fixed ModSecurity cannot load session and user sdbm data. * Fixed updateTargetById was creating rule unparsed content making apache memory grow. * Code cleanup. 23 Feb 2012 - 2.6.4-rc1 ------------------- * Fixed @rsub adding garbage data into stream variables. * Fixed regex for section A into mlogc-batch-load.pl (Thanks Ebrahim Khalilzadeh). * Fixed logdata cuts message without closing it with final chars. * Added sanitizeMatchedBytes support to verifyCPF, verifyCC and verifySSN. 06 Dec 2011 - 2.6.3-rc1 ------------------- * Fixed MATCHED_VARS does not correctly handle multiple VARS with the same name. * Fixed SDBM garbage collection was not working as expected, increasing the size of files. * Fixed wrong timestamp calculation for some time zones in log files. * Fixed SecUpdateTargetById failed to load multiple VARS (MODSEC-270). * Fixed Reverted hexDecode for hexEncode compatibility reason. * Added SecCollectionTimeout to set collection timeout, default is 3600. * Added sqlHexDecode transformation to decode sql hex data. Thanks Marc Stern. 30 Sep 2011 - 2.6.2 ------------------- * Fixed hexDecode test during make. * Updated the reference manual into doc/ directory. 5 Sep 2011 - 2.6.2-rc1 ------------------- * Added support to macro expansion for rx operator. * Added new transformations removeComments and removeCommentsChars * Fixed colletion names are not case-sensitive anymore. * Fixed compilation errors with apache 2.0. * Fixed build system was not using some libraries CFLAGS. * Fixed check for valid hex values into hexDecode transformation. * Fixed ctl:ruleUpdateTargetById appending multiple targets. 18 Jun 2011 - 2.6.1 ------------------- * Updated the reference manual into doc/ directory. 11 Jul 2011 - trunk ------------------- * Add HttpBl support to rbl operator. 30 Jun 2011 - 2.6.1-rc1 ------------------- * Fixed SecUploadFileMode doesn't work with the new build system. * Fixed building with Lua library (Thanks Diego Elio). * Fixed some ./configure --enable* features not being enabled in compilation time. * Improvements on GSB database add/search operations. * Log part K was removed from modsecurity.conf-recommended. * Added SecUnicodeMapFile directive. Must be use to load the unicode.mapping file. * Added SecUnicodeCodePage directive. Used to define the unicode code page. There are a few already available: 1250 (ANSI - Central Europe) 1251 (ANSI - Cyrillic) 1252 (ANSI - Latin I) 1253 (ANSI - Greek) 1254 (ANSI - Turkish) 1255 (ANSI - Hebrew) 1256 (ANSI - Arabic) 1257 (ANSI - Baltic) 1258 (ANSI/OEM - Viet Nam) 20127 (US-ASCII) 20261 (T.61) 20866 (Russian - KOI8) 28591 (ISO 8859-1 Latin I) 28592 (ISO 8859-2 Central Europe) 28605 (ISO 8859-15 Latin 9) 37 (IBM EBCDIC - U.S./Canada) 437 (OEM - United States) 500 (IBM EBCDIC - International) 850 (OEM - Multilingual Latin I) 860 (OEM - Portuguese) 861 (OEM - Icelandic) 863 (OEM - Canadian French) 865 (OEM - Nordic) 874 (ANSI/OEM - Thai) 932 (ANSI/OEM - Japanese Shift-JIS) 936 (ANSI/OEM - Simplified Chinese GBK) 949 (ANSI/OEM - Korean) 950 (ANSI/OEM - Traditional Chinese Big5) Also mapping some extra unicode chars defined at http://tools.ietf.org/html/rfc3490#section-3.1 * Fixed SecRequestBodyLimit was truncating the real request body. 18 May 2011 - 2.6.0 ------------------- * Added SecWriteStateLimit for Slow Post DoS mitigation. * Fix problem when buffering in input filter. * Fix memory leak when use MATCHED_VAR_NAMES. 2 May 2011 - 2.6.0-rc2 ------------------- * Added code optimizations - thanks Diego Elio. * Added support to AIX and HPUX in the build system (untested). * Renamed decodeBase64Ext to base64DecodeExt. * Build system improvements - thanks Diego Elio. * Improvements on gsblookup parser. * Fixed input filter bug when upload files and SecStreamInBodyInspect is enabled. * Logging improvements and bug fix. * Remove extra useless files when make clean and maintainer-clean 18 Apr 2011 - 2.6.0-rc1 ------------------- * Replaced previous GPLv2 License to Apachev2. * Added Google Safe Browsing lookups operator and directive. It should be used to extract and lookup urls from http packets. * Added Data Modification operator. It must be used with STREAM_* variables to replace/add/edit any data from http bodies. * Added STREAM_OUPUT_BODY and STREAM_INPUT_BODY variables to work with data modification operators. * Added fast ip address operator. It supports partial ip address, cidr for IPv4 and IPv6. Thanks Tom Donovan. * Added new sensitive data tracking verifyCPF and verifySSN. * Added MATCHED_VARS and MATCHED_VARS_NAMES. It is similiar to MATCHED_VAR, but now we should see all matched variables. * Added UNIQUE_ID variable. It holds the data created my mod_unique_id. * Added new tranformation cmdline. Thanks Marc Stern. * Added new exception handling operators and directives. It should help users reduce FN and FPs. The directives SecRuleUpdateTargetById, SecRuleRemoveByTag and its ctl actions were included. * Added SecStreamOutBodyInspection and SecStreamInBodyInspection to enable STREAM_* variables. * Added SecGsbLookupDB used to load Google Safe Browsing malware databse into memory. * Added the directive SecInterceptOnError to control what to do if a rule returns values less than zero. * Improvements in DetectionOnly engine mode. Also added SecRequestBodyLimitAction to control what to do if the engine receive a http request over a hard limit. Note that there is now many combinations with SecRuleEngine and the limit action directives for response and request data. Please see the reference manual. * Improvements under RBL operator. It now will parse return code values for some RBL lists. * Added new Log Part J. It should log some informations about uploaded files. * Added new sanitizeMatchedBytes action. It will give more flexibilty for user to sanitize logged data, also improving peformance when sanitize big amount of data. * Improvements on Logging phase. It is possible now see full chains, distinguish between simple rules, chain starters and chain nodes. * Improvements on AutoTools usage. * Improvements on pattern matching operators, pmf, pm and strmatch now supports more flexible input data allowing any kind of special char. * Improvements on SecRuleUpdateActionById to update chain nodes. * Many bugs were fixed. Please see the ModSecurity Jira for more details 19 Mar 2010 - trunk ------------------- * Added SecDisableBackendCompression, which disabled backend compression while keeping the frontend compression enabled (assuming mod_deflate in installed and configured in the proxy). [Ivan Ristic] * Added REQUEST_BODY_LENGTH, which contains the number of request body bytes read. [Ivan Ristic] * Integrate with mod_log_config using the %{VARNAME}M format string. (MODSEC-108) [Ivan Ristic] * Replaced the previous time-measuring mechanism with a new one, which provides the following information: request time, request duration, phase duration (for all 5 phases), time spent dealing with persistent storage, and time spent on audit logging. The new information is now available in the Stopwatch2 audit log header. The Stopwatch header remains for backward compatiblity, although it now only includes the request time and request duration values. Added the following variables: PERF_COMBINED, PERF_PHASE1, PERF_PHASE2, PERF_PHASE3, PERF_PHASE4, PERF_PHASE5, PERF_SREAD, PERF_SWRITE, PERF_LOGGING, PERF_GC. [Ivan Ristic] * Added DURATION, which contains the time ellapsed since the beginning of the current transaction, in milliseconds. [Ivan Ristic] * Adjusted phase 5 to execute just prior to mod_log_config. This should allow phase 5 rules to to implement conditional logging, as well as pave support for allowing access to all ModSecurity variables from mog_log_config. [Ivan Ristic] * Added the URLENCODED_ERROR flag, which is raised whenever invalid URL encoding is encountered in the query string or in the request body (but only if URLENCODED request body processor is used). (MODSEC-111) [Ivan Ristic] * Removed the obsolete PDF UXSS functionality. (MODSEC-96) [Ivan Ristic] * Renamed normalisePath to normalizePath and normalisePathWin to normalizePathWin. Kept the previous names for backward compatibility. (MODSEC-103) [Ivan Ristic] * Moved phase 1 to be run in the same Apache hook as phase 2. This means that you can now have phase 1 rules in tags and, more importantly, override server configuration in and others. (MODSEC-98) [Ivan Ristic] * Renamed the sanitise family of actions to sanitize. Kept the old variants for backward compatibility. (MODSEC-95) [Ivan Ristic] * Improve the logging of the ctl action. (MODSEC-99) [Ivan Ristic] * Cleanup build files that were from the Apache source. 14 Feb 2010 - 2.5.13-dev1 ------------------------- * Cleaned up some mlogc code and debugging output. * Remove the ability to use a relative path to a piped audit logger (i.e. mlogc) as Apache does not support it in their piped loggers and it was breaking Windows and probably other platforms that use spaces in filesystem paths. Discovered by Tom Donovan. * Fix memory leak freeing regex. Discovered by Tom Donovan. * Fix some portability issues on Windows. 04 Feb 2010 - 2.5.12 -------------------- * Fixed SecUploadFileMode to set the correct mode. * Fixed nolog,auditlog/noauditlog/nolog controls for disruptive actions. * Added additional file info definitions introduced in APR 0.9.5 so that build will work with older APRs (IBM HTTP Server v6). * Added SecUploadFileLimit to limit the number of uploaded file parts that will be processed in a multipart POST. The default is 100. * Fixed path normalization to better handle backreferences that extend above root directories. Reported by Sogeti/ESEC R&D. * Trim whitespace around phrases used with @pmFromFile and allow for both LF and CRLF terminated lines. * Allow for more robust parsing for multipart header folding. Reported by Sogeti/ESEC R&D. * Fixed failure to match internally set TX variables with regex (TX:/.../) syntax. * Fixed failure to log full internal TX variable names and populate MATCHED_VAR* vars. * Enabled PCRE "studying" by default. This is now a configure-time option. * Added PCRE match limits (SecPcreMatchLimit/SecPcreMatchLimitRecursion) to aide in REDoS type attacks. A rule that goes over the limits will set TX:MSC_PCRE_LIMITS_EXCEEDED. It is intended that the next major release of ModSecurity (2.6.x) will move these flags to a dedicated collection. * Reduced default PCRE match limits reducing impact of REDoS on poorly written regex rules. Reported by Sogeti/ESEC R&D. * Fixed memory leak in v1 cookie parser. Reported by Sogeti/ESEC R&D. * Now support macro expansion in numeric operators (@eq, @ge, @lt, etc.) * Update copyright to 2010. * Reserved 700,000-799,999 IDs for Ivan Ristic. * Fixed SecAction not working when CONNECT request method is used (MODSEC-110). [Ivan Ristic] * Do not escape quotes in macro resolution and only escape NUL in setenv values. 04 Nov 2009 - 2.5.11 -------------------- * Added a new multipart flag, MULTIPART_INVALID_QUOTING, which will be set true if any invalid quoting is found during multipart parsing. * Fixed parsing quoted strings in multipart Content-Disposition headers. Discovered by Stefan Esser. * Cleanup persistence database locking code. * Added warning during configure if libcurl is found linked against gnutls for SSL. The openssl lib is recommended as gnutls has proven to cause issues with mutexes and may crash. * Cleanup some mlogc (over)logging. * Do not log output filter errors in the error log. * Moved output filter to run before other stock filters (mod_deflate, mod_cache, mod_expires, mod_filter) to avoid analyzing modified data in the response. Patch originally submitted by Ivan Ristic. 18 Sep 2009 - 2.5.10 -------------------- * Cleanup mlogc so that it builds on Windows. * Added more detailed messages to replace "Unknown error" in filters. * Added SecAuditLogDirMode and SecAuditLogFileMode to allow fine tuning auditlog permissions (especially with mpm-itk). * Cleanup SecUploadFileMode implementation. * Cleanup build scripts. * Fixed crash on configuration if SecMarker is used before any rules. * Fixed SecRuleUpdateActionById so that it will work on chain starters. * Cleanup build system for mlogc. * Allow mlogc to periodically flush memory pools. * Using nolog,auditlog will now log the "Message:" line to the auditlog, but nothing to the error log. Prior versions dropped the "Message:" line from both logs. To do this now, just use "nolog" or "nolog,noauditlog". * Forced mlogc to use SSLv3 to avoid some potential auto negotiation issues with some libcurl versions. * Fixed mlogc issue seen on big endian machines where content type could be listed as zero. * Removed extra newline from audit log message line when logging XML errors. This was causing problems parsing audit logs. * Fixed @pm/@pmFromFile case insensitivity. * Truncate long parameters in log message for "Match of ... against ... required" messages. * Correctly resolve chained rule actions in logs. * Cleanup some code for portability. * AIX does not support hidden visibility with xlc compiler. * Allow specifying EXTRA_CFLAGS during configure to override gcc specific values for non-gcc compilers. * Populate GEO:COUNTRY_NAME and GEO:COUNTRY_CONTINENT as documented. * Handle a newer geo database more gracefully, avoiding a potential crash for new countries that ModSecurity is not yet aware. * Allow checking &GEO "@eq 0" for a failed @geoLookup. * Fixed mlogc global mutex locking issue and added more debugging output. * Cleaned up build dependencies and configure options. 05 Mar 2009 - 2.5.9 ------------------- * Fixed parsing multipart content with a missing part header name which would crash Apache. Discovered by "Internet Security Auditors" (isecauditors.com). * Added ability to specify the config script directly using --with-apr and --with-apu. * Updated copyright year to 2009. * Added macro expansion for append/prepend action. * Fixed race condition in concurrent updates of persistent counters. Updates are now atomic. * Cleaned up build, adding an option for verbose configure output and making the mlogc build more portable. 21 Nov 2008 - 2.5.8 ------------------- * Fixed PDF XSS issue where a non-GET request for a PDF file would crash the Apache httpd process. Discovered by Steve Grubb at Red Hat. * Removed an invalid "Internal error: Issuing "%s" for unspecified error." message that was logged when denying with nolog/noauditlog set and causing the request to be audited. 24 Sep 2008 - 2.5.7 ------------------- * Fixed XML DTD/Schema validation which will now fail after request body processing errors, even if the XML parser returns a document tree. * Added ctl:forceRequestBodyVariable=on|off which, when enabled, will force the REQUEST_BODY variable to be set when a request body processor is not set. Previously the REQUEST_BODY target was only populated by the URLENCODED request body processor. * Integrated mlogc source. * Fixed logging the hostname in the error_log which was logging the request hostname instead of the Apache resolved hostname. * Allow for disabling request body limit checks in phase:1. * Added transformations for processing parity for legacy protocols ported to HTTP(S): t:parityEven7bit, t:parityOdd7bit, t:parityZero7bit * Added t:cssDecode transformation to decode CSS escapes. * Now log XML parsing/validation warnings and errors to be in the debug log at levels 3 and 4, respectivly. 31 Jul 2008 - 2.5.6 ------------------- * Transformation caching has been deprecated, and is now off by default. We now advise against using transformation caching in production. * Fixed two separate transformation caching issues that could cause incorrect content inspection in some circumstances. * Fixed an issue with the transformation cache using too much RAM, potentially crashing Apache with a large number of cache entries. Two new configuration options have been added to allow for a finer control of caching: maxitems: Max number of items to cache (default 1024) incremental: Whether to cache incrementally (default off) * Added an experimental regression testing suite. The regression suite may be executed via "make test-regression", however it is strongly advised to only be executed on a non-production machine as it will startup the Apache web server that ModSecurity is compiled against with various configurations in which it will run tests. * Added a licensing exception so that ModSecurity can be used in a derivative work when that derivative is also under an approved open source license. * Updated mlogc to version 1.4.5 which adds a LockFile directive and fixes an issue in which the configuration file may be deleted. 05 Jun 2008 - 2.5.5 ------------------- * Fixed an issue where an alert was not logged in the error log unless "auditlog" was used. * Enable the "auditlog" action by default to help prevent a misconfiguration. The new default is now: "phase:2,log,auditlog,pass" * Improve request body processing error messages. * Handle lack of a new line after the final boundary in a multipart request. This fixes the reported WordPress Flash file uploader problem. * Fixed issue with multithreaded servers where concurrent XML processing could crash the web server (at least under Windows). * Fixed blocking in phase 3. * Force modules "mod_rpaf-2.0.c" and "mod_custom_header.c" to run before ModSecurity so that the correct IP is used. 07 May 2008 - 2.5.4 ------------------- * Fixed issue where transformation cache was using the SecDefaultAction value even when t:none was used within a rule. 24 Apr 2008 - 2.5.3 ------------------- * Fixed issue where the exec action may not be able to execute shell scripts. * Macros are now expanded in expirevar and deprecatevar. * Fixed crash if a persistent variable name was more than 126 characters. * Updated included Core Ruleset to version 1.6.1 which fixes some false negative issues in the migration to using some 2.5 features. 02 Apr 2008 - 2.5.2 ------------------- * Allow HTTP_* targets as an alias for REQUEST_HEADERS:*. * Make sure temporary filehandles are closed after a transaction. * Make sure the apache include directory is included during build. 02 Apr 2008 - 2.1.7 ------------------- * Make sure temporary filehandles are closed after a transaction. 14 Mar 2008 - 2.5.1 ------------------- * Fixed an issue where a match would not occur if transformation caching was enabled. * Using "severity" in a default action is now just a warning. * Cleaned up the "make test" target to better locate headers/libraries. * Now search /usr/lib64 and /usr/lib32 for lua libs. * No longer treat warnings as errors by default (use --enable-strict-compile). 19 Feb 2008 - 2.5.0 ------------------- * Updated included Core Ruleset to version 1.6.0 which uses 2.5 features. * Cleaned up and clarified some documentation. * Updated code to be more portable so it builds with MS VC++. * Added unit tests for most operators and transformations. * Fixed crash on startup when ENV is improperly used without a parameter. * Allow macro resolution in setenv action. * The default action is now a minimal "phase:2,log,pass" with no default transformations performed. * Implemented SecUploadFileMode to allow setting the mode for uploaded files. * Implemented "block" action. * Implemented SecRuleUpdateActionById. * Fixed removal of phase 5 rules via SecRuleRemoveBy* directives. * No longer log the query portion of the URI in the error log as it may contain sensitive data. * Build is now 'configure' based: ./configure && make && make install * Added support for Lua scripting in the following ways: SecRuleScript can be used to specify a script to execute as a rule, the exec action processes Lua scripts internally, as does the @inspectFile operator. Refer to the documentation for more details. * Changed how allow works. Used on its own it now allows phases 1-4. Used with parameter "phase" (e.g. SecAction allow:phase) it only affects the current phase. Used with parameter "request" it allows phases 1-2. * Fixed issue where only the first phase 5 rule would run when the request was intercepted in an earlier phase. * Stricter configuration parsing. Disruptive actions, meta actions and phases are no longer allowed in a chained rule. Disruptive actions, are no longer allowed in a logging phase (phase 5) rule, including inheriting from SecDefaultAction. * More efficient collection persistance. * Fixed t:escapeSeqDecode to better follow ANSI C escapes. * Added t:jsDecode to decode JavScript escape sequences. * Added IS_NEW built-in collection variables. * New audit log part 'K' logs all matching rules. * Implemented SecRequestBodyNoFilesLimit. * Enhance handling of the case where we run out of disk space while writing to audit log entry. * Added SecComponentSignature to allow other components the ability to append to the logged signature. * Added skipAfter: action to allow skipping all rules until a rule with a specified ID is reached. Rule execution then continues after the specified rule. * Added SecMarker directive to allow a fixed target for skipAfter. * Added ctl:ruleRemoveById action to allow rule removal on a match. * Added a @containsWord operator that will match a given string anywhere in the target value, but only on word boundaries. * Added a MATCHED_VAR_NAME variable to store the last matched variable name so that it can be more easily used by rules. * Added a MATCHED_VAR variable to store the last matched variable value so that it can be more easily used by rules. * Fixed expansion of macros when using relative changes with setvar. In addition, added support for expanding macros in the variable name. * Situations where ModSecurity will intercept, generate an error or log a level 1-3 message to the debug log are now marked as 'relevant' and may generate an audit log entry. * Fixed deprecatevar:var=N/S action so that it decrements N every S seconds as documented instead of decrementing by a rate. * Enable ModSecurity to look at partial response bodies. In previous versions, ModSecurity would respond with status code 500 when the response body was too long. Now, if SecResponseBodyLimitAction is set to "ProcessPartial", it will process the part of the response body received up until that point but send the rest without buffering. * ModSecurity will now process phases 3 and 4 even when request processing is interrupted (either by Apache - e.g. by responding with 400, 401 or 403, or by ModSecurity itself). * Fixed the base64decode transformation function to not return extra characters at the end. * Return from the output filter with an error in addition to setting up the HTTP error status in the output data. * Used new Apache API calls to get the server version/banner when available. * Added "logdata" meta action to allow logging of raw transaction data. * Added TX_SEVERITY that keeps track of the highest severity for any matched rules so far. * Added ARGS_GET, ARGS_POST, ARGS_GET_NAMES, ARGS_POST_NAMES variables to allow seperation of GET and POST arguments. * Added an Apache define (MODSEC_2.5) so that you can conditionally include directives based on the ModSecurity major/minor versions with IfDefine. * Added MODSEC_BUILD variable that contains the numeric build value based on the ModSecurity version. * Enhanced debug logging by displaying more data on rule execution. All invoked rules are now logged in the debug log at level 5. * Stricter validation for @validateUtf8Encoding. * No longer process Apache internal subrequests. * Fixed warnings on Solaris and/or 64bit builds. * Added @within string comparison operator with support for macro expansion. * Do not trigger "pause" action for internal requests. * Added matching rule filename and line number to audit log. * Added new phrase matching operators, @pm and @pmFromFile. These use an alternate set based matching engine (Aho-Corasick) to perform faster phrase type matches such as black/white lists, spam keywords, etc. * Allow caching transformations per-request/phase so they are not repeated. * Added Solaris and Cygwin to the list of platforms not supporting the hidden visibility attribute. * Fixed decoding full-width unicode in t:urlDecodeUni. * Add SecGeoLookupDB, @geoLookups and GEO collection to support geographical lookups by IP/host. * Do not try to intercept a request after a failed rule. This fixes the issue associated with an "Internal Error: Asked to intercept request but was_intercepted is zero" error message. * Removed extraneous exported symbols. * Merged the PDF XSS protection functionality into ModSecurity. * Exported API for registering custom variables. Example in api directory. * Added experimental support for content injection. Directive SecContentInjection (On|Off) controls whether injection is taking place. Actions "prepend" and "append" inject content when executed. Do note that it is your responsibility to make sure the response is of the appropriate content type (e.g. HTML, plain text, etc). * Added string comparison operators with support for macro expansion: @contains, @streq, @beginsWith and @endsWith. * Enhanced debug log output to log macro expansion, quote values and correctly display values that contained NULs. * Removed support for %0 - %9 capture macros as they were incorrectly expanding url encoded values. Use %{TX.0} - %{TX.9} instead. * Added t:length to transform a value to its character length. * Added t:trimLeft, t:trimRight, t:trim to remove whitespace from a value on the left, right or both. * Added SecAuditLog2 directive to allow redundent concurrent audit log index files. This will allow sending audit data to two consoles, etc. * Removed CGI style HTTP_* variables in favor of REQUEST_HEADERS:Header-Name. * Store filename/line for each rule and display it and the ID (if available) in the debug log when invoking a rule. Thanks to Christian Bockermann for the idea. * Do not log 'allow' action as intercepted in the debug log. * Fixed some collection variable names not printing with the parameter and/or counting operator in the debug log. 19 Feb 2008 - 2.1.6 ------------------- * Fixed crash on startup when ENV is improperly used without a parameter. * Allow macro resolution in setenv action. * Implemented SecUploadFileMode to allow setting the mode for uploaded files. * No longer log the query portion of the URI in the error log as it may contain sensitive data. 10 Jan 2008 - 2.1.5 ------------------- * Updated included Core Ruleset to version 1.5.1. * Phase 5 rules can now be removed via SecRuleRemoveBy* directives. * Fixed issue where only the first phase 5 rule would run when the request was intercepted in an earlier phase. * Fixed configuration parsing so that disruptive actions, meta actions and phases are not allowed in a chained rule (as originally intended). * Fixed t:escapeSeqDecode to better follow ANSI C escapes. 27 Nov 2007 - 2.1.4 ------------------- * Updated included Core Ruleset to version 1.5 and noted in the docs that XML support is required to use the rules without modification. * Fixed an evasion FP, mistaking a multipart non-boundary for a boundary. * Fixed multiple warnings on Solaris and/or 64bit builds. * Do not process subrequests in phase 2-4, but do hand off the request data. * Fixed a blocking FP in the multipart parser, which affected Safari. 11 Sep 2007 - 2.1.3 ------------------- * Updated multipart parsing code adding variables to allow checking for various parsing issues (request body abnormalities). * Allow mod_rpaf and mod_extract_forwarded2 to work before ModSecurity. * Quiet some compiler warnings. * Do not block internal ErrorDocument requests after blocking request. * Added ability to compile without an external API (use -DNO_MODSEC_API). 27 Jul 2007 - 2.1.2 ------------------- * Cleaned up and clarified some documentation. * Update included core rules to latest version (1.4.3). * Enhanced ability to alert/audit failed requests. * Do not trigger "pause" action for internal requests. * Fixed issue with requests that use internal requests. These had the potential to be intercepted incorrectly when other Apache httpd modules that used internal requests were used with mod_security. * Added Solaris and Cygwin to the list of platforms not supporting the hidden visibility attribute. * Fixed decoding full-width unicode in t:urlDecodeUni. * Lessen some overhead of debugging messages and calculations. * Do not try to intercept a request after a failed rule. This fixes the issue associated with an "Internal Error: Asked to intercept request but was_intercepted is zero" error message. * Added SecAuditLog2 directive to allow redundent concurrent audit log index files. This will allow sending audit data to two consoles, etc. * Small performance improvement in memory management for rule execution. 11 Apr 2007 - 2.1.1 ------------------- * Add the PCRE_DOLLAR_ENDONLY option when compiling regular expression for the @rx operator and variables. * Really set PCRE_DOTALL option when compiling the regular expression for the @rx operator as the docs state. * Fixed potential memory corruption when expanding macros. * Fixed error when a collection was retrieved from storage in the same second as creation by setting the rate to zero. * Fixed ASCIIZ (NUL) parsing for application/x-www-form-urlencoded forms. * Fixed the faulty REQUEST_FILENAME variable, which used to change the internal Apache structures by mistake. * Updates to quiet some compiler warnings. * Fixed some casting issues for compiling on NetWare (patch from Guenter Knauf). 23 Feb 2007 - 2.1.0 ------------------- * Removed the "Connection reset by peer" message, which has nothing to do with us. Actually the message was downgraded from ERROR to NOTICE so it will still appear in the debug log. * Removed the (harmless) message mentioning LAST_UPDATE_TIME missing. * It was not possible to remove a rule placed in phase 4 using SecRuleRemoveById or SecRuleRemoveByMsg. Fixed. * Fixed a problem with incorrectly setting requestBodyProcessor using the ctl action. * Bundled Core Rules 2.1-1.3.2b4. * Updates to the reference manual. * Reversed the return values of @validateDTD and @validateSchema, to make them consistent with other operators. * Added a few helpful debug messages in the XML validation area. * Updates to the reference manual. * Fixed the validateByteRange operator. * Default value for the status action is now 403 (as it was supposed to be but it was effectively 500). * Rule exceptions (removing using an ID range or an regular expression) is now applied to the current context too. (Previously it only worked on rules that are inherited from the parent context.) * Fix of a bug with expired variables. * Fixed regular expression variable selectors for many collections. * Performance improvements - up to two times for real-life work loads! * Memory consumption improvements (not measured but significant). * The allow action did not work in phases 3 and 4. Fixed. * Unlocked collections GLOBAL and RESOURCE. * Added support for variable expansion in the msg action. * New feature: It is now possible to make relative changes to the audit log parts with the ctl action. For example: "ctl:auditLogParts=+E". * New feature: "tag" action. To be used for event categorisation. * XML parser was not reporting errors that occured at the end of XML payload. * Files were not extracted from request if SecUploadKeepFiles was Off. Fixed. * Regular expressions that are too long are truncated to 256 characters before used in error messages. (In order to keep the error messages in the log at a reasonable size.) * Fixed the sha1 transformation function. * Fixed the skip action. * Fixed REQUEST_PROTOCOL, REMOTE_USER, and AUTH_TYPE. * SecRuleEngine did not work in child configuration contexts (e.g. ). * Fixed base64Decode and base64Encode. 15 Nov 2006 - 2.0.4 ------------------- * Fixed the "deprecatevar" action. * Decreasing variable values did not work. * Made "nolog" do what it is supposed to do - cause a rule match to not be logged. Also "nolog" now implies "noauditlog" but it's possible to follow "nolog" with "auditlog" and have the match not logged to the error log but logged to the auditlog. (Not something that strikes me as useful but it's possible.) * Relative paths given to SecDataDir will now be treated as relative to the Apache server root. * Added checks to make sure only correct actions are specified in SecDefaultAction (some actions are required, some don't make any sense) and in rules that are not chain starters (same). This should make the unhelpful "Internal Error: Failed to add rule to the ruleset" message go away. * Fixed the problem when "SecRuleInheritance Off" is used in a context with no rules defined. * Fixed a problem of lost input (request body) data on some redirections, for example when mod_rewrite is used. 26 Oct 2006 - 2.0.3 ------------------- * Fixed a memory leak (all platforms) and a concurrency control problem that could cause a crash (multithreaded platforms only). * Fixed a SecAuditLogRelevantStatus problem, which would not work properly unless the regular expression contained a subexpression. 19 Oct 2006 - 2.0.2 ------------------- * Fixed incorrect permissions on the global mutex, which prevented the mutex from working properly. * Fixed incorrect actionset merging where the status was copied from the child actionset even though it was not defined. * Fixed missing metadata information (in the logs) for warnings. 16 Oct 2006 - 2.0.1 ------------------- * Rules that used operator negation did not work. Fixed. * Fixed bug that prevented invalid regular expressions from being reported. 16 Oct 2006 - 2.0.0 ------------------- * First stable 2.x release. modsecurity-apache_2.7.7/nginx/0000775000175000017500000000000012243422537016762 5ustar zimmerlezimmerlemodsecurity-apache_2.7.7/nginx/modsecurity/0000775000175000017500000000000012254305577021337 5ustar zimmerlezimmerlemodsecurity-apache_2.7.7/nginx/modsecurity/ngx_pool_context.h0000664000175000017500000000067612243422537025104 0ustar zimmerlezimmerle #ifndef _NGX_POOL_CONTEXT_H_INCLUDE_ #define _NGX_POOL_CONTEXT_H_INCLUDE_ void* ngx_pool_get_ctx(ngx_pool_t * pool, ngx_uint_t index); ngx_int_t ngx_pool_set_ctx(ngx_pool_t * pool, ngx_uint_t index,void * data); #define ngx_http_get_module_pool_ctx(r, module) ngx_pool_get_ctx(r->pool, module.index) #define ngx_http_set_pool_ctx(r, c, module) ngx_pool_set_ctx(r->pool, module.index, c) #endif /* _NGX_POOL_CONTEXT_H_INCLUDE_ */ modsecurity-apache_2.7.7/nginx/modsecurity/ngx_http_modsecurity.c0000664000175000017500000012444612254164446025776 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #include #include #include #include #undef CR #undef LF #undef CRLF #include "api.h" #define NOTE_NGINX_REQUEST_CTX "nginx-ctx" typedef struct { ngx_flag_t enable; directory_config *config; ngx_str_t *file; ngx_uint_t line; } ngx_http_modsecurity_loc_conf_t; typedef struct { ngx_http_request_t *r; conn_rec *connection; request_rec *req; apr_bucket_brigade *brigade; unsigned complete; } ngx_http_modsecurity_ctx_t; /* ** Module's registred function/handlers. */ static ngx_int_t ngx_http_modsecurity_handler(ngx_http_request_t *r); static void ngx_http_modsecurity_body_handler(ngx_http_request_t *r); static ngx_int_t ngx_http_modsecurity_header_filter(ngx_http_request_t *r); static ngx_int_t ngx_http_modsecurity_body_filter(ngx_http_request_t *r, ngx_chain_t *in); static ngx_int_t ngx_http_modsecurity_preconfiguration(ngx_conf_t *cf); static ngx_int_t ngx_http_modsecurity_init(ngx_conf_t *cf); static ngx_int_t ngx_http_modsecurity_init_process(ngx_cycle_t *cycle); static void *ngx_http_modsecurity_create_loc_conf(ngx_conf_t *cf); static char *ngx_http_modsecurity_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child); static char *ngx_http_modsecurity_config(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); static char *ngx_http_modsecurity_enable(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); static ngx_http_modsecurity_ctx_t * ngx_http_modsecurity_create_ctx(ngx_http_request_t *r); static int ngx_http_modsecurity_drop_action(request_rec *r); static void ngx_http_modsecurity_terminate(ngx_cycle_t *cycle); static void ngx_http_modsecurity_cleanup(void *data); static int ngx_http_modsecurity_save_headers_in_visitor(void *data, const char *key, const char *value); static int ngx_http_modsecurity_save_headers_out_visitor(void *data, const char *key, const char *value); /* command handled by the module */ static ngx_command_t ngx_http_modsecurity_commands[] = { { ngx_string("ModSecurityConfig"), NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, ngx_http_modsecurity_config, NGX_HTTP_LOC_CONF_OFFSET, 0, NULL }, { ngx_string("ModSecurityEnabled"), NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF |NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_TAKE1, ngx_http_modsecurity_enable, NGX_HTTP_LOC_CONF_OFFSET, offsetof(ngx_http_modsecurity_loc_conf_t, enable), NULL }, ngx_null_command }; /* ** handlers for configuration phases of the module */ static ngx_http_module_t ngx_http_modsecurity_ctx = { ngx_http_modsecurity_preconfiguration, /* preconfiguration */ ngx_http_modsecurity_init, /* postconfiguration */ NULL, /* create main configuration */ NULL, /* init main configuration */ NULL, /* create server configuration */ NULL, /* merge server configuration */ ngx_http_modsecurity_create_loc_conf, /* create location configuration */ ngx_http_modsecurity_merge_loc_conf /* merge location configuration */ }; ngx_module_t ngx_http_modsecurity = { NGX_MODULE_V1, &ngx_http_modsecurity_ctx, /* module context */ ngx_http_modsecurity_commands, /* module directives */ NGX_HTTP_MODULE, /* module type */ NULL, /* init master */ NULL, /* init module */ ngx_http_modsecurity_init_process, /* init process */ NULL, /* init thread */ NULL, /* exit thread */ ngx_http_modsecurity_terminate, /* exit process */ ngx_http_modsecurity_terminate, /* exit master */ NGX_MODULE_V1_PADDING }; static ngx_http_output_header_filter_pt ngx_http_next_header_filter; static ngx_http_output_body_filter_pt ngx_http_next_body_filter; static ngx_http_upstream_t ngx_http_modsecurity_upstream; static struct { char *name; ngx_str_t variable_name; } special_headers_out[] = { {"Content-Type", ngx_string("sent_http_content_type") }, {"Content-Length", ngx_string("sent_http_content_length")}, {"Location", ngx_string("sent_http_location")}, {"Last-Modified", ngx_string("sent_http_last_modified")}, {"Connection", ngx_string("sent_http_connection")}, {"Keep-Alive", ngx_string("sent_http_keep_alive")}, {"Transfer-Encoding", ngx_string("sent_http_transfer_encoding")}, {"Cache-Control", ngx_string("sent_http_cache_control")}, {NULL, ngx_null_string} }; static inline u_char * ngx_pstrdup0(ngx_pool_t *pool, ngx_str_t *src) { u_char *dst; dst = ngx_pnalloc(pool, src->len + 1); if (dst == NULL) { return NULL; } ngx_memcpy(dst, src->data, src->len); dst[src->len] = '\0'; return dst; } static inline int ngx_http_modsecurity_method_number(unsigned int nginx) { /* * http://graphics.stanford.edu/~seander/bithacks.html#ZerosOnRightMultLookup */ static const int MultiplyDeBruijnBitPosition[32] = { M_INVALID, /* 1 >> 0 */ M_GET, M_INVALID, /* 1 >> 28 */ M_GET, /* NGX_HTTP_HEAD */ M_INVALID, /* 1 >> 29 */ M_PATCH, M_INVALID, /* 1 >> 24 */ M_POST, M_INVALID, /* 1 >> 30 */ M_INVALID, /* 1 >> 22 */ M_INVALID, /* 1 >> 20 */ M_TRACE, M_INVALID, /* 1 >> 25 */ M_INVALID, /* 1 >> 17 */ M_PUT, M_MOVE, M_INVALID, /* 1 >> 31 */ M_INVALID, /* 1 >> 27 */ M_UNLOCK, M_INVALID, /* 1 >> 23 */ M_INVALID, /* 1 >> 21 */ M_INVALID, /* 1 >> 19 */ M_INVALID, /* 1 >> 16 */ M_COPY, M_INVALID, /* 1 >> 26 */ M_LOCK, M_INVALID, /* 1 >> 18 */ M_MKCOL, M_PROPPATCH, M_DELETE, M_PROPFIND, M_OPTIONS }; return MultiplyDeBruijnBitPosition[((uint32_t)((nginx & -nginx) * 0x077CB531U)) >> 27]; } static ngx_inline ngx_int_t ngx_http_modsecurity_load_request(ngx_http_request_t *r) { ngx_http_modsecurity_ctx_t *ctx; request_rec *req; ngx_str_t str; size_t root; ngx_str_t path; ctx = ngx_http_get_module_ctx(r, ngx_http_modsecurity); req = ctx->req; /* request line */ req->method = (char *)ngx_pstrdup0(r->pool, &r->method_name); /* TODO: how to use ap_method_number_of ? * req->method_number = ap_method_number_of(req->method); */ req->method_number = ngx_http_modsecurity_method_number(r->method); /* ngx_http_map_uri_to_path() allocates memory for terminating '\0' */ if (ngx_http_map_uri_to_path(r, &path, &root, 0) == NULL) { return NGX_ERROR; } req->filename = (char *) path.data; req->path_info = req->filename; req->args = (char *)ngx_pstrdup0(r->pool, &r->args); req->proto_num = r->http_major *1000 + r->http_minor; req->protocol = (char *)ngx_pstrdup0(r->pool, &r->http_protocol); req->request_time = apr_time_make(r->start_sec, r->start_msec); req->the_request = (char *)ngx_pstrdup0(r->pool, &r->request_line); req->unparsed_uri = (char *)ngx_pstrdup0(r->pool, &r->unparsed_uri); req->uri = (char *)ngx_pstrdup0(r->pool, &r->uri); req->parsed_uri.scheme = "http"; #if (NGX_HTTP_SSL) if (r->connection->ssl) { req->parsed_uri.scheme = "https"; } #endif req->parsed_uri.path = (char *)ngx_pstrdup0(r->pool, &r->uri); req->parsed_uri.is_initialized = 1; str.data = r->port_start; str.len = r->port_end - r->port_start; req->parsed_uri.port = ngx_atoi(str.data, str.len); req->parsed_uri.port_str = (char *)ngx_pstrdup0(r->pool, &str); req->parsed_uri.query = r->args.len ? req->args : NULL; req->parsed_uri.dns_looked_up = 0; req->parsed_uri.dns_resolved = 0; // req->parsed_uri.password = (char *)ngx_pstrdup0(r->pool, &r->headers_in.passwd); // req->parsed_uri.user = (char *)ngx_pstrdup0(r->pool, &r->headers_in.user); req->parsed_uri.fragment = (char *)ngx_pstrdup0(r->pool, &r->exten); req->hostname = (char *)ngx_pstrdup0(r->pool, (ngx_str_t *)&ngx_cycle->hostname); req->header_only = r->header_only ? r->header_only : (r->method == NGX_HTTP_HEAD); return NGX_OK; } /* * TODO: deal more headers. */ static ngx_inline ngx_int_t ngx_http_modsecurity_load_headers_in(ngx_http_request_t *r) { ngx_http_modsecurity_ctx_t *ctx; const char *lang; request_rec *req; ngx_list_part_t *part; ngx_table_elt_t *h; ngx_uint_t i; ctx = ngx_http_get_module_ctx(r, ngx_http_modsecurity); req = ctx->req; part = &r->headers_in.headers.part; h = part->elts; for (i = 0; ; i++) { if (i >= part->nelts) { if (part->next == NULL) break; part = part->next; h = part->elts; i = 0; } apr_table_setn(req->headers_in, (char *)h[i].key.data, (char *)h[i].value.data); ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "ModSecurity: load headers in: \"%V: %V\"", &h[i].key, &h[i].value); } req->clength = r->headers_in.content_length_n; req->range = apr_table_get(req->headers_in, "Range"); req->content_type = apr_table_get(req->headers_in, "Content-Type"); req->content_encoding = apr_table_get(req->headers_in, "Content-Encoding"); lang = apr_table_get(ctx->req->headers_in, "Content-Languages"); if(lang != NULL) { ctx->req->content_languages = apr_array_make(ctx->req->pool, 1, sizeof(const char *)); *(const char **)apr_array_push(ctx->req->content_languages) = lang; } req->ap_auth_type = (char *)apr_table_get(req->headers_in, "Authorization"); req->user = (char *)ngx_pstrdup0(r->pool, &r->headers_in.user); ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "ModSecurity: load headers in done"); return NGX_OK; } static ngx_inline ngx_int_t ngx_http_modsecurity_save_headers_in(ngx_http_request_t *r) { ngx_http_modsecurity_ctx_t *ctx; ctx = ngx_http_get_module_ctx(r, ngx_http_modsecurity); /* clean up headers_in */ ngx_memzero(&r->headers_in, sizeof(ngx_http_headers_in_t)); if (ngx_list_init(&r->headers_in.headers, r->pool, 20, sizeof(ngx_table_elt_t)) != NGX_OK) { return NGX_ERROR; } if (ngx_array_init(&r->headers_in.cookies, r->pool, 2, sizeof(ngx_table_elt_t *)) != NGX_OK) { return NGX_ERROR; } r->headers_in.content_length_n = -1; r->headers_in.keep_alive_n = -1; r->headers_in.headers.part.nelts = 0; r->headers_in.headers.part.next = NULL; r->headers_in.headers.last = &r->headers_in.headers.part; /* shadow copy */ if (apr_table_do(ngx_http_modsecurity_save_headers_in_visitor, r, ctx->req->headers_in, NULL) == 0) { ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "ModSecurity: save headers in error"); return NGX_ERROR; } if (r->headers_in.content_length) { r->headers_in.content_length_n = ngx_atoof(r->headers_in.content_length->value.data, r->headers_in.content_length->value.len); if (r->headers_in.content_length_n == NGX_ERROR) { ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, "ModSecurity: invalid \"Content-Length\" header"); return NGX_ERROR; } } if (r->headers_in.connection_type == NGX_HTTP_CONNECTION_KEEP_ALIVE) { if (r->headers_in.keep_alive) { r->headers_in.keep_alive_n = ngx_atotm(r->headers_in.keep_alive->value.data, r->headers_in.keep_alive->value.len); } } ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "ModSecurity: save headers in done"); return NGX_OK; } static int ngx_http_modsecurity_save_headers_in_visitor(void *data, const char *key, const char *value) { ngx_http_request_t *r = data; ngx_table_elt_t *h; ngx_http_header_t *hh; ngx_http_core_main_conf_t *cmcf; h = ngx_list_push(&r->headers_in.headers); if (h == NULL) { return 0; } h->key.data = (u_char *)key; h->key.len = ngx_strlen(key); h->value.data = (u_char *)value; h->value.len = ngx_strlen(value); h->lowcase_key = ngx_pnalloc(r->pool, h->key.len); if (h->lowcase_key == NULL) { return 0; } ngx_strlow(h->lowcase_key, h->key.data, h->key.len); h->hash = ngx_hash_key(h->lowcase_key, h->key.len); cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module); hh = ngx_hash_find(&cmcf->headers_in_hash, h->hash, h->lowcase_key, h->key.len); if (hh && hh->handler(r, h, hh->offset) != NGX_OK) { return 0; } ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "ModSecurity: save headers in: \"%V: %V\"", &h->key, &h->value); return 1; } static ngx_inline ngx_int_t ngx_http_modsecurity_load_request_body(ngx_http_request_t *r) { ngx_http_modsecurity_ctx_t *ctx; ctx = ngx_http_get_module_ctx(r, ngx_http_modsecurity); modsecSetBodyBrigade(ctx->req, ctx->brigade); if (r->request_body == NULL || r->request_body->bufs == NULL) { return move_chain_to_brigade(NULL, ctx->brigade, r->pool, 1); } if (move_chain_to_brigade(r->request_body->bufs, ctx->brigade, r->pool, 1) != NGX_OK) { return NGX_ERROR; } r->request_body = NULL; return NGX_OK; } static ngx_inline ngx_int_t ngx_http_modsecurity_save_request_body(ngx_http_request_t *r) { ngx_http_modsecurity_ctx_t *ctx; apr_off_t content_length; ngx_buf_t *buf; ngx_http_core_srv_conf_t *cscf; size_t size; ngx_http_connection_t *hc; ctx = ngx_http_get_module_ctx(r, ngx_http_modsecurity); apr_brigade_length(ctx->brigade, 0, &content_length); if (r->header_in->end - r->header_in->last >= content_length) { /* use r->header_in */ if (ngx_buf_size(r->header_in)) { /* move to the end */ ngx_memmove(r->header_in->pos + content_length, r->header_in->pos, ngx_buf_size(r->header_in)); } if (apr_brigade_flatten(ctx->brigade, (char *)r->header_in->pos, (apr_size_t *)&content_length) != APR_SUCCESS) { return NGX_ERROR; } apr_brigade_cleanup(ctx->brigade); r->header_in->last += content_length; return NGX_OK; } if (ngx_buf_size(r->header_in)) { /* * ngx_http_set_keepalive will reuse r->header_in if * (r->header_in != c->buffer && r->header_in.last != r->header_in.end), * so we need this code block. * see ngx_http_set_keepalive, ngx_http_alloc_large_header_buffer */ cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module); size = ngx_max(cscf->large_client_header_buffers.size, (size_t)content_length + ngx_buf_size(r->header_in)); hc = r->http_connection; if (hc->nfree && size == cscf->large_client_header_buffers.size) { buf = hc->free[--hc->nfree]; ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "ModSecurity: use http free large header buffer: %p %uz", buf->pos, buf->end - buf->last); } else if (hc->nbusy < cscf->large_client_header_buffers.num) { if (hc->busy == NULL) { hc->busy = ngx_palloc(r->connection->pool, cscf->large_client_header_buffers.num * sizeof(ngx_buf_t *)); } if (hc->busy == NULL) { return NGX_ERROR; } else { buf = ngx_create_temp_buf(r->connection->pool, size); } } else { /* TODO: how to deal this case ? */ return NGX_ERROR; } } else { buf = ngx_create_temp_buf(r->pool, (size_t) content_length); } if (buf == NULL) { return NGX_ERROR; } if (apr_brigade_flatten(ctx->brigade, (char *)buf->pos, (apr_size_t *)&content_length) != APR_SUCCESS) { return NGX_ERROR; } apr_brigade_cleanup(ctx->brigade); buf->last += content_length; ngx_memcpy(buf->last, r->header_in->pos, ngx_buf_size(r->header_in)); buf->last += ngx_buf_size(r->header_in); r->header_in = buf; return NGX_OK; } static ngx_inline ngx_int_t ngx_http_modsecurity_load_headers_out(ngx_http_request_t *r) { ngx_http_modsecurity_ctx_t *ctx; char *data; request_rec *req; u_char *content_type; ngx_uint_t content_type_len; ngx_http_variable_value_t *vv; ngx_list_part_t *part; ngx_table_elt_t *h; ngx_uint_t i; char *key, *value; u_char *buf = NULL; size_t size = 0; ctx = ngx_http_get_module_ctx(r, ngx_http_modsecurity); req = ctx->req; req->status = r->headers_out.status; req->status_line = (char *)ngx_pstrdup0(r->pool, &r->headers_out.status_line); if (r->headers_out.charset.len) { content_type_len = r->headers_out.content_type.len + r->headers_out.charset.len + ngx_strlen("; charset=") + 1; content_type = ngx_palloc(r->pool, content_type_len); if (content_type == NULL) { return NGX_ERROR; } ngx_snprintf(content_type, content_type_len, "%V; charset=%V\0", &r->headers_out.content_type, &r->headers_out.charset); r->headers_out.content_type.data = content_type; r->headers_out.content_type.len = content_type_len; } /* deep copy */ part = &r->headers_out.headers.part; h = part->elts; for (i = 0; ; i++) { if (i >= part->nelts) { if (part->next == NULL) break; part = part->next; h = part->elts; i = 0; } size += h[i].key.len + h[i].value.len + 2; buf = ngx_palloc(r->pool, size); if (buf == NULL) { return NGX_ERROR; } key = (char *)buf; buf = ngx_cpymem(buf, h[i].key.data, h[i].key.len); *buf++ = '\0'; value = (char *)buf; buf = ngx_cpymem(buf, h[i].value.data, h[i].value.len); *buf++ = '\0'; apr_table_addn(req->headers_out, key, value); ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "ModSecurity: load headers out: \"%V: %V\"", &h[i].key, &h[i].value); } for (i = 0; special_headers_out[i].name; i++) { vv = ngx_http_get_variable(r, &special_headers_out[i].variable_name, ngx_hash_key(special_headers_out[i].variable_name.data, special_headers_out[i].variable_name.len)); if (vv && !vv->not_found) { data = ngx_palloc(r->pool, vv->len + 1); if (data == NULL) { return NGX_ERROR; } ngx_memcpy(data,vv->data, vv->len); data[vv->len] = '\0'; apr_table_setn(req->headers_out, special_headers_out[i].name, data); ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "ModSecurity: load headers out: \"%s: %s\"", special_headers_out[i].name, data); } } req->content_type = apr_table_get(ctx->req->headers_out, "Content-Type"); req->content_encoding = apr_table_get(ctx->req->headers_out, "Content-Encoding"); data = (char *)apr_table_get(ctx->req->headers_out, "Content-Languages"); if(data != NULL) { ctx->req->content_languages = apr_array_make(ctx->req->pool, 1, sizeof(const char *)); *(const char **)apr_array_push(ctx->req->content_languages) = data; } /* req->chunked = r->chunked; may be useless */ req->clength = r->headers_out.content_length_n; req->mtime = apr_time_make(r->headers_out.last_modified_time, 0); ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "ModSecurity: load headers out done"); return NGX_OK; } static ngx_inline ngx_int_t ngx_http_modsecurity_save_headers_out(ngx_http_request_t *r) { ngx_http_modsecurity_ctx_t *ctx; ngx_http_upstream_t *upstream; ctx = ngx_http_get_module_ctx(r, ngx_http_modsecurity); /* r->chunked = ctx->req->chunked; */ ngx_http_clean_header(r); upstream = r->upstream; r->upstream = &ngx_http_modsecurity_upstream; if (apr_table_do(ngx_http_modsecurity_save_headers_out_visitor, r, ctx->req->headers_out, NULL) == 0) { ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "ModSecurity: save headers out error"); return NGX_ERROR; } r->upstream = upstream; r->headers_out.status = ctx->req->status; r->headers_out.status_line.data = (u_char *)ctx->req->status_line; r->headers_out.status_line.len = ctx->req->status_line ? ngx_strlen(ctx->req->status_line) : 0; r->headers_out.content_length_n = ctx->req->clength; r->headers_out.last_modified_time = apr_time_sec(ctx->req->mtime); ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "ModSecurity: save headers out done"); return NGX_OK; } static int ngx_http_modsecurity_save_headers_out_visitor(void *data, const char *key, const char *value) { ngx_http_request_t *r = data; ngx_table_elt_t *h, he; ngx_http_upstream_header_t *hh; ngx_http_upstream_main_conf_t *umcf; umcf = ngx_http_get_module_main_conf(r, ngx_http_upstream_module); h = &he; h->key.data = (u_char *)key; h->key.len = ngx_strlen(key); h->value.data = (u_char *)value; h->value.len = ngx_strlen(value); h->lowcase_key = ngx_palloc(r->pool, h->key.len); if (h->lowcase_key == NULL) { return 0; } ngx_strlow(h->lowcase_key, h->key.data, h->key.len); h->hash = ngx_hash_key(h->lowcase_key, h->key.len); hh = ngx_hash_find(&umcf->headers_in_hash, h->hash, h->lowcase_key, h->key.len); if (hh) { /* copy all */ if (hh->copy_handler(r, h, hh->conf) != NGX_OK) { return 0; } } ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "ModSecurity: save headers out: \"%V: %V\"", &h->key, &h->value); return 1; } static ngx_inline ngx_int_t ngx_http_modsecurity_status(ngx_http_request_t *r, int status) { ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "ModSecurity: status %d", status); if (status == DECLINED || status == APR_SUCCESS) { return NGX_DECLINED; } /* nginx known status */ if ( (status >= 300 && status < 308) /* 3XX */ || (status >= 400 && status < 417) /* 4XX */ || (status >= 500 && status < 508) /* 5XX */ || (status == NGX_HTTP_CREATED || status == NGX_HTTP_NO_CONTENT) ) { return status; } return NGX_HTTP_INTERNAL_SERVER_ERROR; } /* create loc conf struct */ static void * ngx_http_modsecurity_create_loc_conf(ngx_conf_t *cf) { ngx_http_modsecurity_loc_conf_t *conf; conf = (ngx_http_modsecurity_loc_conf_t *) ngx_palloc(cf->pool, sizeof(ngx_http_modsecurity_loc_conf_t)); if (conf == NULL) return NULL; conf->config = NGX_CONF_UNSET_PTR; conf->enable = NGX_CONF_UNSET; return conf; } /* merge loc conf */ static char * ngx_http_modsecurity_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child) { ngx_http_modsecurity_loc_conf_t *prev = parent; ngx_http_modsecurity_loc_conf_t *conf = child; ngx_conf_merge_value(conf->enable, prev->enable, 0); ngx_conf_merge_ptr_value(conf->config, prev->config, NULL); if (conf->enable && conf->config == NULL) { ngx_log_error(NGX_LOG_EMERG, cf->log, 0, "\"ModSecurityEnabled\" in %V:%ui is set to \"on\"" " while directive \"ModSecurityConfig\" is not found" " in the same location", conf->file, conf->line); return NGX_CONF_ERROR; } return NGX_CONF_OK; } static void modsecLog(void *obj, int level, char *str) { if (obj != NULL) { level = (level & APLOG_LEVELMASK) + NGX_LOG_EMERG - APLOG_EMERG; if (level > NGX_LOG_DEBUG) { level = NGX_LOG_DEBUG; } ngx_log_error((ngx_uint_t)level, (ngx_log_t *)obj, 0, "%s", str); } } /* ** This is a temporary hack to make PCRE work with ModSecurity ** nginx hijacks pcre_malloc and pcre_free, so we have to re-hijack them */ extern apr_pool_t *pool; static void * modsec_pcre_malloc(size_t size) { return apr_palloc(pool, size); } static void modsec_pcre_free(void *ptr) { } static server_rec *modsec_server = NULL; static ngx_int_t ngx_http_modsecurity_preconfiguration(ngx_conf_t *cf) { /* XXX: temporary hack, nginx uses pcre as well and hijacks these two */ pcre_malloc = modsec_pcre_malloc; pcre_free = modsec_pcre_free; modsecSetLogHook(cf->log, modsecLog); modsecSetDropAction(ngx_http_modsecurity_drop_action); /* TODO: server_rec per server conf */ modsec_server = modsecInit(); if (modsec_server == NULL) { return NGX_ERROR; } /* set host name */ modsec_server->server_hostname = ngx_palloc(cf->pool, ngx_cycle->hostname.len + 1); if (modsec_server->server_hostname == NULL) { return NGX_ERROR; } ngx_memcpy(modsec_server->server_hostname, ngx_cycle->hostname.data, ngx_cycle->hostname.len); modsec_server->server_hostname[ ngx_cycle->hostname.len] = '\0'; modsecStartConfig(); return NGX_OK; } static void ngx_http_modsecurity_terminate(ngx_cycle_t *cycle) { if (modsec_server) { modsecTerminate(); modsec_server = NULL; } } static ngx_int_t ngx_http_modsecurity_init(ngx_conf_t *cf) { ngx_http_handler_pt *h; ngx_http_core_main_conf_t *cmcf; modsecFinalizeConfig(); cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module); h = ngx_array_push(&cmcf->phases[NGX_HTTP_PREACCESS_PHASE].handlers); if (h == NULL) { return NGX_ERROR; } *h = ngx_http_modsecurity_handler; ngx_http_next_header_filter = ngx_http_top_header_filter; ngx_http_top_header_filter = ngx_http_modsecurity_header_filter; ngx_http_next_body_filter = ngx_http_top_body_filter; ngx_http_top_body_filter = ngx_http_modsecurity_body_filter; ngx_memzero(&ngx_http_modsecurity_upstream, sizeof(ngx_http_upstream_t)); ngx_http_modsecurity_upstream.cacheable = 1; return NGX_OK; } static ngx_int_t ngx_http_modsecurity_init_process(ngx_cycle_t *cycle) { /* must set log hook here cf->log maybe changed */ modsecSetLogHook(cycle->log, modsecLog); modsecInitProcess(); return NGX_OK; } /* ** [ENTRY POINT] does : this function called by nginx from the request handler */ static ngx_int_t ngx_http_modsecurity_handler(ngx_http_request_t *r) { ngx_http_modsecurity_loc_conf_t *cf; ngx_http_modsecurity_ctx_t *ctx; ngx_int_t rc; cf = ngx_http_get_module_loc_conf(r, ngx_http_modsecurity); /* Process only main request */ if (r != r->main || !cf->enable) { return NGX_DECLINED; } ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "modSecurity: handler"); /* create / retrive request ctx */ if (r->internal) { ctx = ngx_http_get_module_pool_ctx(r, ngx_http_modsecurity); if (ctx) { /* we have already processed the request headers */ ngx_http_set_ctx(r, ctx, ngx_http_modsecurity); return NGX_DECLINED; } ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "modSecurity: request pool ctx empty"); } ctx = ngx_http_modsecurity_create_ctx(r); if (ctx == NULL) { return NGX_HTTP_INTERNAL_SERVER_ERROR; } ngx_http_set_ctx(r, ctx, ngx_http_modsecurity); if (ngx_http_set_pool_ctx(r, ctx, ngx_http_modsecurity) != NGX_OK) { return NGX_ERROR; } /* load request to request rec */ if (ngx_http_modsecurity_load_request(r) != NGX_OK || ngx_http_modsecurity_load_headers_in(r) != NGX_OK) { return NGX_HTTP_INTERNAL_SERVER_ERROR; } /* processing request headers */ rc = ngx_http_modsecurity_status(r, modsecProcessRequestHeaders(ctx->req)); if (rc != NGX_DECLINED) { return rc; } if (r->method == NGX_HTTP_POST && modsecIsRequestBodyAccessEnabled(ctx->req) ) { /* read POST request body, should we process PUT? */ rc = ngx_http_read_client_request_body(r, ngx_http_modsecurity_body_handler); if (rc >= NGX_HTTP_SPECIAL_RESPONSE) { return rc; } return NGX_DONE; } /* other method */ return ngx_http_modsecurity_status(r, modsecProcessRequestBody(ctx->req)); } static void ngx_http_modsecurity_body_handler(ngx_http_request_t *r) { ngx_http_modsecurity_ctx_t *ctx; ngx_int_t rc; ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "modSecurity: body handler"); ctx = ngx_http_get_module_ctx(r, ngx_http_modsecurity); if (ngx_http_modsecurity_load_request_body(r) != NGX_OK) { return ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); } rc = ngx_http_modsecurity_status(r, modsecProcessRequestBody(ctx->req)); if (rc != NGX_DECLINED) { return ngx_http_finalize_request(r, rc); } if (ngx_http_modsecurity_save_request_body(r) != NGX_OK || ngx_http_modsecurity_save_headers_in(r) != NGX_OK ) { return ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); } r->phase_handler++; ngx_http_core_run_phases(r); ngx_http_finalize_request(r, NGX_DONE); } static ngx_int_t ngx_http_modsecurity_header_filter(ngx_http_request_t *r) { ngx_http_modsecurity_loc_conf_t *cf; ngx_http_modsecurity_ctx_t *ctx; const char *location; ngx_table_elt_t *h; ngx_int_t rc; cf = ngx_http_get_module_loc_conf(r, ngx_http_modsecurity); ctx = ngx_http_get_module_ctx(r, ngx_http_modsecurity); /* already processed, checking redirect action. */ if (ctx && ctx->complete && r->err_status >= NGX_HTTP_MOVED_PERMANENTLY && r->err_status < 308) { /* 3XX load redirect location header so that we can do redirect in phase 3,4 */ location = apr_table_get(ctx->req->headers_out, "Location"); if (location == NULL) { return NGX_HTTP_INTERNAL_SERVER_ERROR; } h = ngx_list_push(&r->headers_out.headers); if (h == NULL) { return NGX_HTTP_INTERNAL_SERVER_ERROR; } h->hash = 1; h->key.data = (u_char *)"Location"; h->key.len = ngx_strlen("Location"); h->value.data = (u_char *)location; h->value.len = ngx_strlen(location); return ngx_http_next_header_filter(r); } if (r != r->main || !cf->enable || ctx == NULL ||ctx->complete) { return ngx_http_next_header_filter(r); } ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "modSecurity: header filter"); /* header only or SecResponseBodyAccess off */ if (r->header_only || (!modsecIsResponseBodyAccessEnabled(ctx->req)) ) { ctx->complete = 1; if (ngx_http_modsecurity_load_headers_in(r) != NGX_OK || ngx_http_modsecurity_load_headers_out(r) != NGX_OK) { return NGX_HTTP_INTERNAL_SERVER_ERROR; } rc = ngx_http_modsecurity_status(r, modsecProcessResponse(ctx->req)); if (rc != NGX_DECLINED) { return ngx_http_filter_finalize_request(r, &ngx_http_modsecurity, rc); } if (ngx_http_modsecurity_save_headers_in(r) != NGX_OK || ngx_http_modsecurity_save_headers_out(r) != NGX_OK) { return ngx_http_filter_finalize_request(r, &ngx_http_modsecurity, NGX_HTTP_INTERNAL_SERVER_ERROR); } return ngx_http_next_header_filter(r); } /* SecResponseBodyAccess on, process rules in body filter */ /* pretend we are ngx_http_header_filter */ r->header_sent = 1; r->filter_need_in_memory = 1; return NGX_OK; } static ngx_int_t ngx_http_modsecurity_body_filter(ngx_http_request_t *r, ngx_chain_t *in) { ngx_http_modsecurity_loc_conf_t *cf; ngx_http_modsecurity_ctx_t *ctx; ngx_int_t rc; apr_off_t content_length; ngx_chain_t *cl, *out; ngx_int_t last_buf = 0; cf = ngx_http_get_module_loc_conf(r, ngx_http_modsecurity); ctx = ngx_http_get_module_ctx(r, ngx_http_modsecurity); if (r != r->main || !cf->enable || ctx == NULL || ctx->complete) { return ngx_http_next_body_filter(r, in); } ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "modSecurity: body filter"); for (cl = in; cl; cl = cl->next) { apr_bucket *e; ngx_buf_t *buf = cl->buf; apr_bucket_brigade *bb = ctx->brigade; off_t size = ngx_buf_size(buf); if (size) { char *data = apr_pmemdup(bb->p, buf->pos, size); if (data == NULL) { return ngx_http_filter_finalize_request(r, &ngx_http_modsecurity, NGX_HTTP_INTERNAL_SERVER_ERROR); } e = apr_bucket_pool_create(data , size, bb->p, bb->bucket_alloc); if (e == NULL) { return ngx_http_filter_finalize_request(r, &ngx_http_modsecurity, NGX_HTTP_INTERNAL_SERVER_ERROR); } APR_BRIGADE_INSERT_TAIL(bb, e); } if (buf->last_buf) { last_buf = 1; buf->last_buf = 0; e = apr_bucket_eos_create(bb->bucket_alloc); if (e == NULL) { return ngx_http_filter_finalize_request(r, &ngx_http_modsecurity, NGX_HTTP_INTERNAL_SERVER_ERROR); } APR_BRIGADE_INSERT_TAIL(bb, e); break; } buf->pos = buf->last; } if (!last_buf) { return NGX_AGAIN; } /* last buf has been saved */ ctx->complete = 1; modsecSetResponseBrigade(ctx->req, ctx->brigade); if (ngx_http_modsecurity_load_headers_in(r) != NGX_OK || ngx_http_modsecurity_load_headers_out(r) != NGX_OK) { return ngx_http_filter_finalize_request(r, &ngx_http_modsecurity, NGX_HTTP_INTERNAL_SERVER_ERROR); } rc = ngx_http_modsecurity_status(r, modsecProcessResponse(ctx->req)); if (rc != NGX_DECLINED) { return ngx_http_filter_finalize_request(r, &ngx_http_modsecurity, rc); } apr_brigade_length(ctx->brigade, 0, &content_length); rc = move_brigade_to_chain(ctx->brigade, &out, r->pool); if (rc == NGX_ERROR) { return ngx_http_filter_finalize_request(r, &ngx_http_modsecurity, NGX_HTTP_INTERNAL_SERVER_ERROR); } if (ngx_http_modsecurity_save_headers_in(r) != NGX_OK ||ngx_http_modsecurity_save_headers_out(r) != NGX_OK) { return ngx_http_filter_finalize_request(r, &ngx_http_modsecurity, NGX_HTTP_INTERNAL_SERVER_ERROR); } if (r->headers_out.content_length_n != -1) { r->headers_out.content_length_n = content_length; r->headers_out.content_length = NULL; /* header filter will set this */ } r->header_sent = 0; rc = ngx_http_next_header_filter(r); if (rc == NGX_ERROR || rc > NGX_OK) { return ngx_http_filter_finalize_request(r, &ngx_http_modsecurity, rc); } return ngx_http_next_body_filter(r, out); } #define TXID_SIZE 25 static ngx_http_modsecurity_ctx_t * ngx_http_modsecurity_create_ctx(ngx_http_request_t *r) { ngx_http_modsecurity_loc_conf_t *cf; ngx_pool_cleanup_t *cln; ngx_http_modsecurity_ctx_t *ctx; apr_sockaddr_t *asa; struct sockaddr_in *sin; char *txid; unsigned char salt[TXID_SIZE]; int i; #if (NGX_HAVE_INET6) struct sockaddr_in6 *sin6; #endif ctx = ngx_pcalloc(r->pool, sizeof(ngx_http_modsecurity_ctx_t)); if (ctx == NULL) { ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, "modSecurity: ctx memory allocation error"); return NULL; } cln = ngx_pool_cleanup_add(r->pool, sizeof(ngx_http_modsecurity_ctx_t)); if (cln == NULL) { ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, "modSecurity: ctx memory allocation error"); return NULL; } cln->handler = ngx_http_modsecurity_cleanup; cln->data = ctx; ctx->r = r; if (r->connection->requests == 0 || ctx->connection == NULL) { /* TODO: set server_rec, why igonre return value? */ ctx->connection = modsecNewConnection(); /* fill apr_sockaddr_t */ asa = ngx_palloc(r->pool, sizeof(apr_sockaddr_t)); asa->pool = ctx->connection->pool; asa->hostname = (char *)ngx_pstrdup0(r->pool, &r->connection->addr_text); asa->servname = asa->hostname; asa->next = NULL; asa->salen = r->connection->socklen; ngx_memcpy(&asa->sa, r->connection->sockaddr, asa->salen); asa->family = ((struct sockaddr *)&asa->sa)->sa_family; switch ( asa->family) { #if (NGX_HAVE_INET6) case AF_INET6: sin6 = (struct sockaddr_in6 *)&asa->sa; asa->ipaddr_ptr = &sin6->sin6_addr; asa->ipaddr_len = sizeof(sin6->sin6_addr); asa->port = ntohs(sin6->sin6_port); asa->addr_str_len = NGX_INET6_ADDRSTRLEN + 1; break; #endif default: /* AF_INET */ sin = (struct sockaddr_in *) &asa->sa; asa->ipaddr_ptr = &sin->sin_addr; asa->ipaddr_len = sizeof(sin->sin_addr); asa->port = ntohs(sin->sin_port); asa->addr_str_len = NGX_INET_ADDRSTRLEN + 1; break; } #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER < 3 ctx->connection->remote_addr = asa; ctx->connection->remote_ip = asa->hostname; #else ctx->connection->client_addr = asa; ctx->connection->client_ip = asa->hostname; #endif ctx->connection->remote_host = NULL; modsecProcessConnection(ctx->connection); } cf = ngx_http_get_module_loc_conf(r, ngx_http_modsecurity); ctx->req = modsecNewRequest(ctx->connection, cf->config); apr_table_setn(ctx->req->notes, NOTE_NGINX_REQUEST_CTX, (const char *) ctx); apr_generate_random_bytes(salt, TXID_SIZE); txid = apr_pcalloc (ctx->req->pool, TXID_SIZE); apr_base64_encode (txid, (const char*)salt, TXID_SIZE); for(i=0;i= 0x30) && (salt[i] <= 0x39)) {} else if((salt[i] >= 0x40) && (salt[i] <= 0x5A)) {} else if((salt[i] >= 0x61) && (salt[i] <= 0x7A)) {} else { if((i%2)==0) salt[i] = 0x41; else salt[i] = 0x63; } } salt[TXID_SIZE-1] = '\0'; apr_table_setn(ctx->req->subprocess_env, "UNIQUE_ID", apr_psprintf(ctx->req->pool, "%s", salt)); ctx->brigade = apr_brigade_create(ctx->req->pool, ctx->req->connection->bucket_alloc); if (ctx->brigade == NULL) { return NULL; } return ctx; } static void ngx_http_modsecurity_cleanup(void *data) { ngx_http_modsecurity_ctx_t *ctx = data; if (ctx->req != NULL) { (void) modsecFinishRequest(ctx->req); } } static char * ngx_http_modsecurity_config(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) { ngx_http_modsecurity_loc_conf_t *mscf = conf; ngx_str_t *value; const char *msg; if (mscf->config != NGX_CONF_UNSET_PTR) { return "is duplicate"; } value = cf->args->elts; if (ngx_conf_full_name(cf->cycle, &value[1], 1) != NGX_OK) { return NGX_CONF_ERROR; } mscf->config = modsecGetDefaultConfig(); if (mscf->config == NULL) { return NGX_CONF_ERROR; } msg = modsecProcessConfig(mscf->config, (const char *)value[1].data, NULL); if (msg != NULL) { ngx_log_error(NGX_LOG_EMERG, cf->log, 0, "ModSecurityConfig in %s:%ui: %s", cf->conf_file->file.name.data, cf->conf_file->line, msg); return NGX_CONF_ERROR; } return NGX_CONF_OK; } static char * ngx_http_modsecurity_enable(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) { ngx_http_modsecurity_loc_conf_t *mscf = conf; char *rc; rc = ngx_conf_set_flag_slot(cf, cmd, conf); if (rc != NGX_CONF_OK) { return rc; } if (mscf->enable) { mscf->file = &cf->conf_file->file.name; mscf->line = cf->conf_file->line; } return NGX_CONF_OK; } static int ngx_http_modsecurity_drop_action(request_rec *r) { ngx_http_modsecurity_ctx_t *ctx; ctx = (ngx_http_modsecurity_ctx_t *) apr_table_get(r->notes, NOTE_NGINX_REQUEST_CTX); if (ctx == NULL) { return -1; } ctx->r->connection->error = 1; return 0; } modsecurity-apache_2.7.7/nginx/modsecurity/apr_bucket_nginx.c0000664000175000017500000001441212243422537025021 0ustar zimmerlezimmerle #include static apr_status_t nginx_bucket_read(apr_bucket *b, const char **str, apr_size_t *len, apr_read_type_e block); static void nginx_bucket_destroy(void *data); static const apr_bucket_type_t apr_bucket_type_nginx = { "NGINX", 5, APR_BUCKET_DATA, nginx_bucket_destroy, nginx_bucket_read, apr_bucket_setaside_noop, apr_bucket_shared_split, apr_bucket_shared_copy }; typedef struct apr_bucket_nginx { apr_bucket_refcount refcount; ngx_buf_t *buf; } apr_bucket_nginx; /* ngx_buf_t to apr_bucket */ apr_bucket * apr_bucket_nginx_create(ngx_buf_t *buf, apr_pool_t *p, apr_bucket_alloc_t *list) { apr_bucket *b = apr_bucket_alloc(sizeof(*b), list); APR_BUCKET_INIT(b); /* link */ b->free = apr_bucket_free; b->list = list; return apr_bucket_nginx_make(b, buf, p); } apr_bucket * apr_bucket_nginx_make(apr_bucket *b, ngx_buf_t *buf, apr_pool_t *pool) { apr_bucket_nginx *n; n = apr_bucket_alloc(sizeof(*n), b->list); n->buf = buf; b = apr_bucket_shared_make(b, n, 0, ngx_buf_size(buf)); b->type = &apr_bucket_type_nginx; return b; } static apr_status_t nginx_bucket_read(apr_bucket *b, const char **str, apr_size_t *len, apr_read_type_e block) { apr_bucket_nginx *n = b->data; ngx_buf_t *buf = n->buf; u_char *data; ssize_t size; if (buf->pos == NULL && ngx_buf_size(buf) != 0) { data = apr_bucket_alloc(ngx_buf_size(buf), b->list); if (data == NULL) { return APR_EGENERAL; } size = ngx_read_file(buf->file, data, ngx_buf_size(buf), buf->file_pos); if (size != ngx_buf_size(buf)) { apr_bucket_free(data); return APR_EGENERAL; } buf->pos = data; } *str = (char *)buf->pos + b->start; *len = b->length; return APR_SUCCESS; } static void nginx_bucket_destroy(void *data) { apr_bucket_nginx *n = data; ngx_buf_t *buf = n->buf; if (apr_bucket_shared_destroy(n)) { if (!ngx_buf_in_memory(buf) && buf->pos != NULL) { apr_bucket_free(buf->pos); buf->pos = NULL; } apr_bucket_free(n); } } ngx_buf_t * apr_bucket_to_ngx_buf(apr_bucket *e, ngx_pool_t *pool) { ngx_buf_t *buf, *b; apr_bucket_nginx *n; ngx_uint_t len; u_char *data; if (e->type->is_metadata) { return NULL; } if (e->type == &apr_bucket_type_nginx) { n = e->data; b = n->buf; /* whole buf */ if (e->length == (apr_size_t)ngx_buf_size(b)) { b->last_buf = 0; return b; } buf = ngx_palloc(pool, sizeof(ngx_buf_t)); if (buf == NULL) { return NULL; } ngx_memcpy(buf, b, sizeof(ngx_buf_t)); if (ngx_buf_in_memory(buf)) { buf->start = buf->pos = buf->pos + e->start; buf->end = buf->last = buf->pos + e->length; } else { buf->pos = NULL; buf->file_pos += e->start; buf->file_last = buf->file_pos + e->length; } buf->last_buf = 0; return buf; } if (apr_bucket_read(e, (const char **)&data, &len, APR_BLOCK_READ) != APR_SUCCESS) { return NULL; } buf = ngx_calloc_buf(pool); if (buf == NULL) { return NULL; } if (e->type == &apr_bucket_type_pool) { buf->start = data; } else if (len != 0) { buf->start = ngx_palloc(pool, len); ngx_memcpy(buf->start, data, len); } buf->pos = buf->start; buf->end = buf->last = buf->start + len; buf->temporary = 1; return buf; } ngx_int_t move_chain_to_brigade(ngx_chain_t *chain, apr_bucket_brigade *bb, ngx_pool_t *pool, ngx_int_t last_buf) { apr_bucket *e; ngx_chain_t *cl; while (chain) { e = ngx_buf_to_apr_bucket(chain->buf, bb->p, bb->bucket_alloc); if (e == NULL) { return NGX_ERROR; } APR_BRIGADE_INSERT_TAIL(bb, e); if (chain->buf->last_buf) { e = apr_bucket_eos_create(bb->bucket_alloc); APR_BRIGADE_INSERT_TAIL(bb, e); chain->buf->last_buf = 0; return NGX_OK; } cl = chain; chain = chain->next; ngx_free_chain(pool, cl); } if (last_buf) { e = apr_bucket_eos_create(bb->bucket_alloc); APR_BRIGADE_INSERT_TAIL(bb, e); return NGX_OK; } return NGX_AGAIN; } ngx_int_t move_brigade_to_chain(apr_bucket_brigade *bb, ngx_chain_t **ll, ngx_pool_t *pool) { apr_bucket *e; ngx_buf_t *buf; ngx_chain_t *cl; cl = NULL; if (APR_BRIGADE_EMPTY(bb)) { *ll = NULL; return NGX_OK; } for (e = APR_BRIGADE_FIRST(bb); e != APR_BRIGADE_SENTINEL(bb); e = APR_BUCKET_NEXT(e)) { if (APR_BUCKET_IS_EOS(e)) { if (cl == NULL) { cl = ngx_alloc_chain_link(pool); if (cl == NULL) { break; } cl->buf = ngx_calloc_buf(pool); if (cl->buf == NULL) { break; } cl->buf->last_buf = 1; *ll = cl; } else { cl->buf->last_buf = 1; } apr_brigade_cleanup(bb); return NGX_OK; } if (APR_BUCKET_IS_METADATA(e)) { continue; } buf = apr_bucket_to_ngx_buf(e, pool); if (buf == NULL) { break; } cl = ngx_alloc_chain_link(pool); if (cl == NULL) { break; } cl->buf = buf; cl->next = NULL; *ll = cl; ll = &cl->next; } apr_brigade_cleanup(bb); /* no eos or error */ return NGX_ERROR; } modsecurity-apache_2.7.7/nginx/modsecurity/ngx_pool_context.c0000664000175000017500000001350612243422537025073 0ustar zimmerlezimmerle #include #define NGX_POOL_CTX_SIZE 1024 typedef struct ngx_pool_context_node_s ngx_pool_context_node_t; struct ngx_pool_context_node_s { ngx_pool_context_node_t *next; ngx_pool_context_node_t **prev; ngx_pool_t *pool; ngx_uint_t index; void *data; }; static void ngx_pool_context_cleanup(void *data); typedef struct { ngx_uint_t size; } ngx_pool_context_conf_t; static void * ngx_pool_context_create_conf(ngx_cycle_t *cycle); static char * ngx_pool_context_init_conf(ngx_cycle_t *cycle, void *conf); static ngx_core_module_t ngx_pool_context_module_ctx = { ngx_string("pool_context"), ngx_pool_context_create_conf, ngx_pool_context_init_conf, }; static ngx_command_t ngx_pool_context_commands[] = { { ngx_string("pool_context_hash_size"), NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1, ngx_conf_set_num_slot, 0, offsetof(ngx_pool_context_conf_t, size), NULL }, ngx_null_command }; ngx_module_t ngx_pool_context_module = { NGX_MODULE_V1, &ngx_pool_context_module_ctx, /* module context */ ngx_pool_context_commands, /* module directives */ NGX_CORE_MODULE, /* module type */ NULL, /* init master */ NULL, /* init module */ NULL, /* init process */ NULL, /* init thread */ NULL, /* exit thread */ NULL, /* exit process */ NULL, /* exit master */ NGX_MODULE_V1_PADDING }; #define ngx_pool_context_hash_key(r, ctx_index) ((ngx_uint_t) r + ctx_index) #define ngx_pool_context_unlink(node) \ \ *(node->prev) = node->next; \ \ if (node->next) { \ node->next->prev = node->prev; \ } \ \ node->prev = NULL; \ #define ngx_pool_context_link(queue, node) \ \ if (node->prev != NULL) { \ ngx_pool_context_unlink(node); \ } \ node->next = (ngx_pool_context_node_t *) *queue; \ node->prev = (ngx_pool_context_node_t **) queue; \ *queue = node; \ \ if (node->next) { \ node->next->prev = &node->next; \ } static ngx_pool_context_node_t **ngx_pool_context_hash; static ngx_uint_t ngx_pool_context_hash_size; /* Nginx has removed multi-thread support, so we do not need mutex */ void * ngx_pool_get_ctx(ngx_pool_t *pool, ngx_uint_t index) { ngx_uint_t hash; uint32_t key; ngx_pool_context_node_t *node; hash = (ngx_uint_t) pool + index; key = ngx_murmur_hash2((u_char *)&hash, sizeof(hash)) % ngx_pool_context_hash_size; node = ngx_pool_context_hash[key]; while (node) { if (node->pool == pool && node->index == index) { return node->data; } node = node->next; } return NULL; } ngx_int_t ngx_pool_set_ctx(ngx_pool_t *pool, ngx_uint_t index, void *data) { ngx_uint_t hash; uint32_t key; ngx_pool_context_node_t *node; ngx_pool_cleanup_t *cln; hash = (ngx_uint_t) pool + index; key = ngx_murmur_hash2((u_char *)&hash, sizeof(hash)) % ngx_pool_context_hash_size; node = ngx_pool_context_hash[key]; while (node) { if (node->pool == pool && node->index == index) { node->data = data; return NGX_OK; } node = node->next; } cln = ngx_pool_cleanup_add(pool, sizeof(ngx_pool_context_node_t)); if (cln == NULL) { return NGX_ERROR; } cln->handler = ngx_pool_context_cleanup; node = cln->data; node->prev = NULL; node->next = NULL; node->pool = pool; node->index = index; node->data = data; ngx_pool_context_link(&ngx_pool_context_hash[key], node); return NGX_OK; } static void ngx_pool_context_cleanup(void *data) { ngx_pool_context_node_t *node = data; ngx_pool_context_unlink(node); } static void * ngx_pool_context_create_conf(ngx_cycle_t *cycle) { ngx_pool_context_conf_t *pcf; /* create config */ pcf = ngx_pcalloc(cycle->pool, sizeof(ngx_pool_context_conf_t)); if (pcf == NULL) { return NULL; } pcf->size = NGX_CONF_UNSET_UINT; return pcf; } static char * ngx_pool_context_init_conf(ngx_cycle_t *cycle, void *conf) { ngx_pool_context_conf_t *pcf = conf; ngx_conf_init_uint_value(pcf->size, cycle->connection_n); ngx_pool_context_hash_size = pcf->size; ngx_pool_context_hash = ngx_pcalloc(cycle->pool, sizeof(ngx_pool_context_node_t *) * ngx_pool_context_hash_size); if (ngx_pool_context_hash == NULL) { return NGX_CONF_ERROR; } return NGX_CONF_OK; } modsecurity-apache_2.7.7/nginx/modsecurity/config0000664000175000017500000000234112254305577022527 0ustar zimmerlezimmerle#!/bin/sh # This file should be auto-generated whenever modsecurity is configured as standalone. CFLAGS="$CFLAGS \ -I/usr/include/apr-1.0 \ -I/usr/include/apr-1.0 -I/usr/include \ -I/usr/include/apache2 \ -I/usr/include/libxml2 \ -DWITH_LUA -I/usr/include/lua5.1 \ -DWITH_PCRE_STUDY -DMODSEC_PCRE_MATCH_LIMIT=1500 -DMODSEC_PCRE_MATCH_LIMIT_RECURSION=1500 -DREQUEST_EARLY \ " CORE_LIBS="$CORE_LIBS \ -L/usr/lib -lapr-1 \ -L/usr/lib -laprutil-1 \ -I/usr/include/apache2 \ -L/usr/lib/x86_64-linux-gnu -lcurl \ -lxml2 \ -llua5.1 \ -lpcre \ -L/usr/lib -lcap" ngx_addon_name=ngx_http_modsecurity CORE_MODULES="$CORE_MODULES ngx_pool_context_module" HTTP_AUX_FILTER_MODULES="ngx_http_modsecurity $HTTP_AUX_FILTER_MODULES" NGX_ADDON_SRCS="$NGX_ADDON_SRCS \ $ngx_addon_dir/ngx_http_modsecurity.c \ $ngx_addon_dir/apr_bucket_nginx.c \ $ngx_addon_dir/ngx_pool_context.c" NGX_ADDON_DEPS="$NGX_ADDON_DEPS \ $ngx_addon_dir/apr_bucket_nginx.h \ $ngx_addon_dir/ngx_pool_context.h" CORE_LIBS="$ngx_addon_dir/../../standalone/.libs/standalone.a $CORE_LIBS" CORE_INCS="$CORE_INCS \ $ngx_addon_dir \ $ngx_addon_dir/../../standalone \ $ngx_addon_dir/../../apache2" modsecurity-apache_2.7.7/nginx/modsecurity/config.in0000664000175000017500000000170612253711345023131 0ustar zimmerlezimmerle#!/bin/sh CFLAGS="$CFLAGS \ @APR_CFLAGS@ \ @APU_CFLAGS@ \ @APXS_CFLAGS@ \ @LIBXML2_CFLAGS@ \ @LUA_CFLAGS@ \ @MODSEC_EXTRA_CFLAGS@ \ @PCRE_CFLAGS@" CORE_LIBS="$CORE_LIBS \ @APR_LINKLD@ \ @APU_LINKLD@ \ @APXS_CFLAGS@ \ @CURL_LDADD@ \ @LIBXML2_LDADD@ \ @LUA_LDADD@ \ @PCRE_LDADD@ \ @APXS_LIBS@" ngx_addon_name=ngx_http_modsecurity CORE_MODULES="$CORE_MODULES ngx_pool_context_module" HTTP_AUX_FILTER_MODULES="ngx_http_modsecurity $HTTP_AUX_FILTER_MODULES" NGX_ADDON_SRCS="$NGX_ADDON_SRCS \ $ngx_addon_dir/ngx_http_modsecurity.c \ $ngx_addon_dir/apr_bucket_nginx.c \ $ngx_addon_dir/ngx_pool_context.c" NGX_ADDON_DEPS="$NGX_ADDON_DEPS \ $ngx_addon_dir/apr_bucket_nginx.h \ $ngx_addon_dir/ngx_pool_context.h" CORE_LIBS="$ngx_addon_dir/../../standalone/.libs/standalone.a $CORE_LIBS" CORE_INCS="$CORE_INCS \ $ngx_addon_dir \ $ngx_addon_dir/../../standalone \ $ngx_addon_dir/../../apache2" modsecurity-apache_2.7.7/nginx/modsecurity/apr_bucket_nginx.h0000664000175000017500000000130212252332336025015 0ustar zimmerlezimmerle#pragma once #include #include "apr_buckets.h" apr_bucket * apr_bucket_nginx_create(ngx_buf_t *buf, apr_pool_t *p, apr_bucket_alloc_t *list); apr_bucket * apr_bucket_nginx_make(apr_bucket *e, ngx_buf_t *buf, apr_pool_t *pool); #define ngx_buf_to_apr_bucket apr_bucket_nginx_create ngx_buf_t * apr_bucket_to_ngx_buf(apr_bucket *e, ngx_pool_t *pool); ngx_int_t move_chain_to_brigade(ngx_chain_t *chain, apr_bucket_brigade *bb, ngx_pool_t *pool, ngx_int_t last_buf); ngx_int_t move_brigade_to_chain(apr_bucket_brigade *bb, ngx_chain_t **chain, ngx_pool_t *pool); modsecurity-apache_2.7.7/nginx/TODO0000664000175000017500000000054412243422537017455 0ustar zimmerlezimmerleModsecurity NGINX TODO * Code Cleanup * Create a method for action DROP as in Apache * Add CRS Support * Specific NGINX config file * Separate nginx/ IIS/ apache/ and generic/ folders * Source code documentation (insert doxygen headers) * Create better build infrastructure with support for tests and automated regression * Better things for test modsecurity-apache_2.7.7/NOTICE0000664000175000017500000000031012243422537016535 0ustar zimmerlezimmerle ModSecurity (www.modsecurity.org)     Copyright [2004-2013] Trustwave Holdings, Inc     This product includes software developed at     Trustwave Holdings, Inc (http://www.trustwave.com/). modsecurity-apache_2.7.7/build/0000775000175000017500000000000012254306021016725 5ustar zimmerlezimmerlemodsecurity-apache_2.7.7/build/config.guess0000755000175000017500000013036112254306021021247 0ustar zimmerlezimmerle#! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2013 Free Software Foundation, Inc. timestamp='2013-06-10' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # # Originally written by Per Bothner. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD # # Please send patches with a ChangeLog entry to config-patches@gnu.org. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright 1992-2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown case "${UNAME_SYSTEM}" in Linux|GNU|GNU/*) # If the system lacks a compiler, then just pick glibc. # We could probably try harder. LIBC=gnu eval $set_cc_for_build cat <<-EOF > $dummy.c #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #else LIBC=gnu #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` ;; esac # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case ${UNAME_PROCESSOR} in amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW64*:*) echo ${UNAME_MACHINE}-pc-mingw64 exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="gnulibc1" ; fi echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arc:Linux:*:* | arceb:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-${LIBC} else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi else echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf fi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; cris:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; crisv32:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; frv:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; hexagon:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:Linux:*:*) echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; or1k:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; or32:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; padre:Linux:*:*) echo sparc-unknown-linux-${LIBC} exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; *) echo hppa-unknown-linux-${LIBC} ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-${LIBC} exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-${LIBC} exit ;; ppc64le:Linux:*:*) echo powerpc64le-unknown-linux-${LIBC} exit ;; ppcle:Linux:*:*) echo powerpcle-unknown-linux-${LIBC} exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; tile*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; x86_64:Haiku:*:*) echo x86_64-unknown-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown eval $set_cc_for_build if test "$UNAME_PROCESSOR" = unknown ; then UNAME_PROCESSOR=powerpc fi if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi fi echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; x86_64:VMkernel:*:*) echo ${UNAME_MACHINE}-unknown-esx exit ;; esac eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: modsecurity-apache_2.7.7/build/lt~obsolete.m40000644000175000017500000001375612254306004021554 0ustar zimmerlezimmerle# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- # # Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004. # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 5 lt~obsolete.m4 # These exist entirely to fool aclocal when bootstrapping libtool. # # In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN) # which have later been changed to m4_define as they aren't part of the # exported API, or moved to Autoconf or Automake where they belong. # # The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN # in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us # using a macro with the same name in our local m4/libtool.m4 it'll # pull the old libtool.m4 in (it doesn't see our shiny new m4_define # and doesn't know about Autoconf macros at all.) # # So we provide this file, which has a silly filename so it's always # included after everything else. This provides aclocal with the # AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything # because those macros already exist, or will be overwritten later. # We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. # # Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. # Yes, that means every name once taken will need to remain here until # we give up compatibility with versions before 1.7, at which point # we need to keep only those names which we still refer to. # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) modsecurity-apache_2.7.7/build/test-driver0000755000175000017500000000761112254306021021126 0ustar zimmerlezimmerle#! /bin/sh # test-driver - basic testsuite driver script. scriptversion=2012-06-27.10; # UTC # Copyright (C) 2011-2013 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . # Make unconditional expansion of undefined variables an error. This # helps a lot in preventing typo-related bugs. set -u usage_error () { echo "$0: $*" >&2 print_usage >&2 exit 2 } print_usage () { cat <$log_file 2>&1 estatus=$? if test $enable_hard_errors = no && test $estatus -eq 99; then estatus=1 fi case $estatus:$expect_failure in 0:yes) col=$red res=XPASS recheck=yes gcopy=yes;; 0:*) col=$grn res=PASS recheck=no gcopy=no;; 77:*) col=$blu res=SKIP recheck=no gcopy=yes;; 99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;; *:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;; *:*) col=$red res=FAIL recheck=yes gcopy=yes;; esac # Report outcome to console. echo "${col}${res}${std}: $test_name" # Register the test result, and other relevant metadata. echo ":test-result: $res" > $trs_file echo ":global-test-result: $res" >> $trs_file echo ":recheck: $recheck" >> $trs_file echo ":copy-in-global-log: $gcopy" >> $trs_file # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: modsecurity-apache_2.7.7/build/config.sub0000755000175000017500000010535412254306021020716 0ustar zimmerlezimmerle#! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2013 Free Software Foundation, Inc. timestamp='2013-08-10' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches with a ChangeLog entry to config-patches@gnu.org. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright 1992-2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*178) os=-lynxos178 ;; -lynx*5) os=-lynxos5 ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ | be32 | be64 \ | bfin \ | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx \ | epiphany \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ | open8 \ | or1k | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xgate) basic_machine=$basic_machine-unknown os=-none ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze*) basic_machine=microblaze-xilinx ;; mingw64) basic_machine=x86_64-pc os=-mingw64 ;; mingw32) basic_machine=i686-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i686-pc os=-msys ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos | rdos64) basic_machine=x86_64-pc os=-rdos ;; rdos32) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -bitrig* | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; c8051-*) os=-elf ;; hexagon-*) os=-elf ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or1k-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: modsecurity-apache_2.7.7/build/ltsugar.m40000644000175000017500000001042412254306004020650 0ustar zimmerlezimmerle# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- # # Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 6 ltsugar.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) # lt_join(SEP, ARG1, [ARG2...]) # ----------------------------- # Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their # associated separator. # Needed until we can rely on m4_join from Autoconf 2.62, since all earlier # versions in m4sugar had bugs. m4_define([lt_join], [m4_if([$#], [1], [], [$#], [2], [[$2]], [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) m4_define([_lt_join], [m4_if([$#$2], [2], [], [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) # lt_car(LIST) # lt_cdr(LIST) # ------------ # Manipulate m4 lists. # These macros are necessary as long as will still need to support # Autoconf-2.59 which quotes differently. m4_define([lt_car], [[$1]]) m4_define([lt_cdr], [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], [$#], 1, [], [m4_dquote(m4_shift($@))])]) m4_define([lt_unquote], $1) # lt_append(MACRO-NAME, STRING, [SEPARATOR]) # ------------------------------------------ # Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. # Note that neither SEPARATOR nor STRING are expanded; they are appended # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). # No SEPARATOR is output if MACRO-NAME was previously undefined (different # than defined and empty). # # This macro is needed until we can rely on Autoconf 2.62, since earlier # versions of m4sugar mistakenly expanded SEPARATOR but not STRING. m4_define([lt_append], [m4_define([$1], m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) # lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) # ---------------------------------------------------------- # Produce a SEP delimited list of all paired combinations of elements of # PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list # has the form PREFIXmINFIXSUFFIXn. # Needed until we can rely on m4_combine added in Autoconf 2.62. m4_define([lt_combine], [m4_if(m4_eval([$# > 3]), [1], [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl [[m4_foreach([_Lt_prefix], [$2], [m4_foreach([_Lt_suffix], ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) # ----------------------------------------------------------------------- # Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited # by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. m4_define([lt_if_append_uniq], [m4_ifdef([$1], [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], [lt_append([$1], [$2], [$3])$4], [$5])], [lt_append([$1], [$2], [$3])$4])]) # lt_dict_add(DICT, KEY, VALUE) # ----------------------------- m4_define([lt_dict_add], [m4_define([$1($2)], [$3])]) # lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) # -------------------------------------------- m4_define([lt_dict_add_subkey], [m4_define([$1($2:$3)], [$4])]) # lt_dict_fetch(DICT, KEY, [SUBKEY]) # ---------------------------------- m4_define([lt_dict_fetch], [m4_ifval([$3], m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) # lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) # ----------------------------------------------------------------- m4_define([lt_if_dict_fetch], [m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], [$5], [$6])]) # lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) # -------------------------------------------------------------- m4_define([lt_dict_filter], [m4_if([$5], [], [], [lt_join(m4_quote(m4_default([$4], [[, ]])), lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl ]) modsecurity-apache_2.7.7/build/missing0000755000175000017500000001533112254306021020325 0ustar zimmerlezimmerle#! /bin/sh # Common wrapper for a few potentially missing GNU programs. scriptversion=2012-06-26.16; # UTC # Copyright (C) 1996-2013 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try '$0 --help' for more information" exit 1 fi case $1 in --is-lightweight) # Used by our autoconf macros to check whether the available missing # script is modern enough. exit 0 ;; --run) # Back-compat with the calling convention used by older automake. shift ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due to PROGRAM being missing or too old. Options: -h, --help display this help and exit -v, --version output version information and exit Supported PROGRAM values: aclocal autoconf autoheader autom4te automake makeinfo bison yacc flex lex help2man Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 'g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: unknown '$1' option" echo 1>&2 "Try '$0 --help' for more information" exit 1 ;; esac # Run the given program, remember its exit status. "$@"; st=$? # If it succeeded, we are done. test $st -eq 0 && exit 0 # Also exit now if we it failed (or wasn't found), and '--version' was # passed; such an option is passed most likely to detect whether the # program is present and works. case $2 in --version|--help) exit $st;; esac # Exit code 63 means version mismatch. This often happens when the user # tries to use an ancient version of a tool on a file that requires a # minimum version. if test $st -eq 63; then msg="probably too old" elif test $st -eq 127; then # Program was missing. msg="missing on your system" else # Program was found and executed, but failed. Give up. exit $st fi perl_URL=http://www.perl.org/ flex_URL=http://flex.sourceforge.net/ gnu_software_URL=http://www.gnu.org/software program_details () { case $1 in aclocal|automake) echo "The '$1' program is part of the GNU Automake package:" echo "<$gnu_software_URL/automake>" echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/autoconf>" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; autoconf|autom4te|autoheader) echo "The '$1' program is part of the GNU Autoconf package:" echo "<$gnu_software_URL/autoconf/>" echo "It also requires GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; esac } give_advice () { # Normalize program name to check for. normalized_program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` printf '%s\n' "'$1' is $msg." configure_deps="'configure.ac' or m4 files included by 'configure.ac'" case $normalized_program in autoconf*) echo "You should only need it if you modified 'configure.ac'," echo "or m4 files included by it." program_details 'autoconf' ;; autoheader*) echo "You should only need it if you modified 'acconfig.h' or" echo "$configure_deps." program_details 'autoheader' ;; automake*) echo "You should only need it if you modified 'Makefile.am' or" echo "$configure_deps." program_details 'automake' ;; aclocal*) echo "You should only need it if you modified 'acinclude.m4' or" echo "$configure_deps." program_details 'aclocal' ;; autom4te*) echo "You might have modified some maintainer files that require" echo "the 'automa4te' program to be rebuilt." program_details 'autom4te' ;; bison*|yacc*) echo "You should only need it if you modified a '.y' file." echo "You may want to install the GNU Bison package:" echo "<$gnu_software_URL/bison/>" ;; lex*|flex*) echo "You should only need it if you modified a '.l' file." echo "You may want to install the Fast Lexical Analyzer package:" echo "<$flex_URL>" ;; help2man*) echo "You should only need it if you modified a dependency" \ "of a man page." echo "You may want to install the GNU Help2man package:" echo "<$gnu_software_URL/help2man/>" ;; makeinfo*) echo "You should only need it if you modified a '.texi' file, or" echo "any other file indirectly affecting the aspect of the manual." echo "You might want to install the Texinfo package:" echo "<$gnu_software_URL/texinfo/>" echo "The spurious makeinfo call might also be the consequence of" echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" echo "want to install GNU make:" echo "<$gnu_software_URL/make/>" ;; *) echo "You might have modified some files without having the proper" echo "tools for further handling them. Check the 'README' file, it" echo "often tells you about the needed prerequisites for installing" echo "this package. You may also peek at any GNU archive site, in" echo "case some other package contains this missing '$1' program." ;; esac } give_advice "$1" | sed -e '1s/^/WARNING: /' \ -e '2,$s/^/ /' >&2 # Propagate the correct exit status (expected to be 127 for a program # not found, 63 for a program that failed due to version mismatch). exit $st # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: modsecurity-apache_2.7.7/build/ltoptions.m40000644000175000017500000003007312254306003021223 0ustar zimmerlezimmerle# Helper functions for option handling. -*- Autoconf -*- # # Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation, # Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 7 ltoptions.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) # _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) # ------------------------------------------ m4_define([_LT_MANGLE_OPTION], [[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) # _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) # --------------------------------------- # Set option OPTION-NAME for macro MACRO-NAME, and if there is a # matching handler defined, dispatch to it. Other OPTION-NAMEs are # saved as a flag. m4_define([_LT_SET_OPTION], [m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), _LT_MANGLE_DEFUN([$1], [$2]), [m4_warning([Unknown $1 option `$2'])])[]dnl ]) # _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) # ------------------------------------------------------------ # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. m4_define([_LT_IF_OPTION], [m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) # _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) # ------------------------------------------------------- # Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME # are set. m4_define([_LT_UNLESS_OPTIONS], [m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), [m4_define([$0_found])])])[]dnl m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 ])[]dnl ]) # _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) # ---------------------------------------- # OPTION-LIST is a space-separated list of Libtool options associated # with MACRO-NAME. If any OPTION has a matching handler declared with # LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about # the unknown option and exit. m4_defun([_LT_SET_OPTIONS], [# Set options m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [_LT_SET_OPTION([$1], _LT_Option)]) m4_if([$1],[LT_INIT],[ dnl dnl Simply set some default values (i.e off) if boolean options were not dnl specified: _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no ]) _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no ]) dnl dnl If no reference was made to various pairs of opposing options, then dnl we run the default mode handler for the pair. For example, if neither dnl `shared' nor `disable-shared' was passed, we enable building of shared dnl archives by default: _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], [_LT_ENABLE_FAST_INSTALL]) ]) ])# _LT_SET_OPTIONS ## --------------------------------- ## ## Macros to handle LT_INIT options. ## ## --------------------------------- ## # _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) # ----------------------------------------- m4_define([_LT_MANGLE_DEFUN], [[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) # LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) # ----------------------------------------------- m4_define([LT_OPTION_DEFINE], [m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl ])# LT_OPTION_DEFINE # dlopen # ------ LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes ]) AU_DEFUN([AC_LIBTOOL_DLOPEN], [_LT_SET_OPTION([LT_INIT], [dlopen]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `dlopen' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) # win32-dll # --------- # Declare package support for building win32 dll's. LT_OPTION_DEFINE([LT_INIT], [win32-dll], [enable_win32_dll=yes case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) ;; esac test -z "$AS" && AS=as _LT_DECL([], [AS], [1], [Assembler program])dnl test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl ])# win32-dll AU_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_REQUIRE([AC_CANONICAL_HOST])dnl _LT_SET_OPTION([LT_INIT], [win32-dll]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `win32-dll' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) # _LT_ENABLE_SHARED([DEFAULT]) # ---------------------------- # implement the --enable-shared flag, and supports the `shared' and # `disable-shared' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_SHARED], [m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([shared], [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) _LT_DECL([build_libtool_libs], [enable_shared], [0], [Whether or not to build shared libraries]) ])# _LT_ENABLE_SHARED LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) # Old names: AC_DEFUN([AC_ENABLE_SHARED], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) ]) AC_DEFUN([AC_DISABLE_SHARED], [_LT_SET_OPTION([LT_INIT], [disable-shared]) ]) AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_SHARED], []) dnl AC_DEFUN([AM_DISABLE_SHARED], []) # _LT_ENABLE_STATIC([DEFAULT]) # ---------------------------- # implement the --enable-static flag, and support the `static' and # `disable-static' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_STATIC], [m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([static], [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_static=]_LT_ENABLE_STATIC_DEFAULT) _LT_DECL([build_old_libs], [enable_static], [0], [Whether or not to build static libraries]) ])# _LT_ENABLE_STATIC LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) # Old names: AC_DEFUN([AC_ENABLE_STATIC], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) ]) AC_DEFUN([AC_DISABLE_STATIC], [_LT_SET_OPTION([LT_INIT], [disable-static]) ]) AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_STATIC], []) dnl AC_DEFUN([AM_DISABLE_STATIC], []) # _LT_ENABLE_FAST_INSTALL([DEFAULT]) # ---------------------------------- # implement the --enable-fast-install flag, and support the `fast-install' # and `disable-fast-install' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_FAST_INSTALL], [m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([fast-install], [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) _LT_DECL([fast_install], [enable_fast_install], [0], [Whether or not to optimize for fast installation])dnl ])# _LT_ENABLE_FAST_INSTALL LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) # Old names: AU_DEFUN([AC_ENABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `fast-install' option into LT_INIT's first parameter.]) ]) AU_DEFUN([AC_DISABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], [disable-fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `disable-fast-install' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) # _LT_WITH_PIC([MODE]) # -------------------- # implement the --with-pic flag, and support the `pic-only' and `no-pic' # LT_INIT options. # MODE is either `yes' or `no'. If omitted, it defaults to `both'. m4_define([_LT_WITH_PIC], [AC_ARG_WITH([pic], [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@], [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], [lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for lt_pkg in $withval; do IFS="$lt_save_ifs" if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS="$lt_save_ifs" ;; esac], [pic_mode=default]) test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl ])# _LT_WITH_PIC LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) # Old name: AU_DEFUN([AC_LIBTOOL_PICMODE], [_LT_SET_OPTION([LT_INIT], [pic-only]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `pic-only' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) ## ----------------- ## ## LTDL_INIT Options ## ## ----------------- ## m4_define([_LTDL_MODE], []) LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], [m4_define([_LTDL_MODE], [nonrecursive])]) LT_OPTION_DEFINE([LTDL_INIT], [recursive], [m4_define([_LTDL_MODE], [recursive])]) LT_OPTION_DEFINE([LTDL_INIT], [subproject], [m4_define([_LTDL_MODE], [subproject])]) m4_define([_LTDL_TYPE], []) LT_OPTION_DEFINE([LTDL_INIT], [installable], [m4_define([_LTDL_TYPE], [installable])]) LT_OPTION_DEFINE([LTDL_INIT], [convenience], [m4_define([_LTDL_TYPE], [convenience])]) modsecurity-apache_2.7.7/build/ltmain.sh0000644000175000017500000105204412254306003020551 0ustar zimmerlezimmerle # libtool (GNU libtool) 2.4.2 # Written by Gordon Matzigkeit , 1996 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, # 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, # or obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Usage: $progname [OPTION]... [MODE-ARG]... # # Provide generalized library-building support services. # # --config show all configuration variables # --debug enable verbose shell tracing # -n, --dry-run display commands without modifying any files # --features display basic configuration information and exit # --mode=MODE use operation mode MODE # --preserve-dup-deps don't remove duplicate dependency libraries # --quiet, --silent don't print informational messages # --no-quiet, --no-silent # print informational messages (default) # --no-warn don't display warning messages # --tag=TAG use configuration variables from tag TAG # -v, --verbose print more informational messages than default # --no-verbose don't print the extra informational messages # --version print version information # -h, --help, --help-all print short, long, or detailed help message # # MODE must be one of the following: # # clean remove files from the build directory # compile compile a source file into a libtool object # execute automatically set library path, then run a program # finish complete the installation of libtool libraries # install install libraries or executables # link create a library or an executable # uninstall remove libraries from an installed directory # # MODE-ARGS vary depending on the MODE. When passed as first option, # `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. # Try `$progname --help --mode=MODE' for a more detailed description of MODE. # # When reporting a bug, please describe a test case to reproduce it and # include the following information: # # host-triplet: $host # shell: $SHELL # compiler: $LTCC # compiler flags: $LTCFLAGS # linker: $LD (gnu? $with_gnu_ld) # $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1.3ubuntu1 # automake: $automake_version # autoconf: $autoconf_version # # Report bugs to . # GNU libtool home page: . # General help using GNU software: . PROGRAM=libtool PACKAGE=libtool VERSION="2.4.2 Debian-2.4.2-1.3ubuntu1" TIMESTAMP="" package_revision=1.3337 # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } # NLS nuisances: We save the old values to restore during execute mode. lt_user_locale= lt_safe_locale= for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${$lt_var+set}\" = set; then save_$lt_var=\$$lt_var $lt_var=C export $lt_var lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" fi" done LC_ALL=C LANGUAGE=C export LANGUAGE LC_ALL $lt_unset CDPATH # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath="$0" : ${CP="cp -f"} test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} : ${MAKE="make"} : ${MKDIR="mkdir"} : ${MV="mv -f"} : ${RM="rm -f"} : ${SHELL="${CONFIG_SHELL-/bin/sh}"} : ${Xsed="$SED -e 1s/^X//"} # Global variables: EXIT_SUCCESS=0 EXIT_FAILURE=1 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. exit_status=$EXIT_SUCCESS # Make sure IFS has a sensible default lt_nl=' ' IFS=" $lt_nl" dirname="s,/[^/]*$,," basename="s,^.*/,," # func_dirname file append nondir_replacement # Compute the dirname of FILE. If nonempty, add APPEND to the result, # otherwise set result to NONDIR_REPLACEMENT. func_dirname () { func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` if test "X$func_dirname_result" = "X${1}"; then func_dirname_result="${3}" else func_dirname_result="$func_dirname_result${2}" fi } # func_dirname may be replaced by extended shell implementation # func_basename file func_basename () { func_basename_result=`$ECHO "${1}" | $SED "$basename"` } # func_basename may be replaced by extended shell implementation # func_dirname_and_basename file append nondir_replacement # perform func_basename and func_dirname in a single function # call: # dirname: Compute the dirname of FILE. If nonempty, # add APPEND to the result, otherwise set result # to NONDIR_REPLACEMENT. # value returned in "$func_dirname_result" # basename: Compute filename of FILE. # value retuned in "$func_basename_result" # Implementation must be kept synchronized with func_dirname # and func_basename. For efficiency, we do not delegate to # those functions but instead duplicate the functionality here. func_dirname_and_basename () { # Extract subdirectory from the argument. func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` if test "X$func_dirname_result" = "X${1}"; then func_dirname_result="${3}" else func_dirname_result="$func_dirname_result${2}" fi func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` } # func_dirname_and_basename may be replaced by extended shell implementation # func_stripname prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # func_strip_suffix prefix name func_stripname () { case ${2} in .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; esac } # func_stripname may be replaced by extended shell implementation # These SED scripts presuppose an absolute path with a trailing slash. pathcar='s,^/\([^/]*\).*$,\1,' pathcdr='s,^/[^/]*,,' removedotparts=':dotsl s@/\./@/@g t dotsl s,/\.$,/,' collapseslashes='s@/\{1,\}@/@g' finalslash='s,/*$,/,' # func_normal_abspath PATH # Remove doubled-up and trailing slashes, "." path components, # and cancel out any ".." path components in PATH after making # it an absolute path. # value returned in "$func_normal_abspath_result" func_normal_abspath () { # Start from root dir and reassemble the path. func_normal_abspath_result= func_normal_abspath_tpath=$1 func_normal_abspath_altnamespace= case $func_normal_abspath_tpath in "") # Empty path, that just means $cwd. func_stripname '' '/' "`pwd`" func_normal_abspath_result=$func_stripname_result return ;; # The next three entries are used to spot a run of precisely # two leading slashes without using negated character classes; # we take advantage of case's first-match behaviour. ///*) # Unusual form of absolute path, do nothing. ;; //*) # Not necessarily an ordinary path; POSIX reserves leading '//' # and for example Cygwin uses it to access remote file shares # over CIFS/SMB, so we conserve a leading double slash if found. func_normal_abspath_altnamespace=/ ;; /*) # Absolute path, do nothing. ;; *) # Relative path, prepend $cwd. func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath ;; esac # Cancel out all the simple stuff to save iterations. We also want # the path to end with a slash for ease of parsing, so make sure # there is one (and only one) here. func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` while :; do # Processed it all yet? if test "$func_normal_abspath_tpath" = / ; then # If we ascended to the root using ".." the result may be empty now. if test -z "$func_normal_abspath_result" ; then func_normal_abspath_result=/ fi break fi func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$pathcar"` func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$pathcdr"` # Figure out what to do with it case $func_normal_abspath_tcomponent in "") # Trailing empty path component, ignore it. ;; ..) # Parent dir; strip last assembled component from result. func_dirname "$func_normal_abspath_result" func_normal_abspath_result=$func_dirname_result ;; *) # Actual path component, append it. func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent ;; esac done # Restore leading double-slash if one was found on entry. func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result } # func_relative_path SRCDIR DSTDIR # generates a relative path from SRCDIR to DSTDIR, with a trailing # slash if non-empty, suitable for immediately appending a filename # without needing to append a separator. # value returned in "$func_relative_path_result" func_relative_path () { func_relative_path_result= func_normal_abspath "$1" func_relative_path_tlibdir=$func_normal_abspath_result func_normal_abspath "$2" func_relative_path_tbindir=$func_normal_abspath_result # Ascend the tree starting from libdir while :; do # check if we have found a prefix of bindir case $func_relative_path_tbindir in $func_relative_path_tlibdir) # found an exact match func_relative_path_tcancelled= break ;; $func_relative_path_tlibdir*) # found a matching prefix func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" func_relative_path_tcancelled=$func_stripname_result if test -z "$func_relative_path_result"; then func_relative_path_result=. fi break ;; *) func_dirname $func_relative_path_tlibdir func_relative_path_tlibdir=${func_dirname_result} if test "x$func_relative_path_tlibdir" = x ; then # Have to descend all the way to the root! func_relative_path_result=../$func_relative_path_result func_relative_path_tcancelled=$func_relative_path_tbindir break fi func_relative_path_result=../$func_relative_path_result ;; esac done # Now calculate path; take care to avoid doubling-up slashes. func_stripname '' '/' "$func_relative_path_result" func_relative_path_result=$func_stripname_result func_stripname '/' '/' "$func_relative_path_tcancelled" if test "x$func_stripname_result" != x ; then func_relative_path_result=${func_relative_path_result}/${func_stripname_result} fi # Normalisation. If bindir is libdir, return empty string, # else relative path ending with a slash; either way, target # file name can be directly appended. if test ! -z "$func_relative_path_result"; then func_stripname './' '' "$func_relative_path_result/" func_relative_path_result=$func_stripname_result fi } # The name of this program: func_dirname_and_basename "$progpath" progname=$func_basename_result # Make sure we have an absolute path for reexecution: case $progpath in [\\/]*|[A-Za-z]:\\*) ;; *[\\/]*) progdir=$func_dirname_result progdir=`cd "$progdir" && pwd` progpath="$progdir/$progname" ;; *) save_IFS="$IFS" IFS=${PATH_SEPARATOR-:} for progdir in $PATH; do IFS="$save_IFS" test -x "$progdir/$progname" && break done IFS="$save_IFS" test -n "$progdir" || progdir=`pwd` progpath="$progdir/$progname" ;; esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed="${SED}"' -e 1s/^X//' sed_quote_subst='s/\([`"$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution that turns a string into a regex matching for the # string literally. sed_make_literal_regex='s,[].[^$\\*\/],\\&,g' # Sed substitution that converts a w32 file name or path # which contains forward slashes, into one that contains # (escaped) backslashes. A very naive implementation. lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' # Re-`\' parameter expansions in output of double_quote_subst that were # `\'-ed in input to the same. If an odd number of `\' preceded a '$' # in input to double_quote_subst, that '$' was protected from expansion. # Since each input `\' is now two `\'s, look for any number of runs of # four `\'s followed by two `\'s and then a '$'. `\' that '$'. bs='\\' bs2='\\\\' bs4='\\\\\\\\' dollar='\$' sed_double_backslash="\ s/$bs4/&\\ /g s/^$bs2$dollar/$bs&/ s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g s/\n//g" # Standard options: opt_dry_run=false opt_help=false opt_quiet=false opt_verbose=false opt_warning=: # func_echo arg... # Echo program name prefixed message, along with the current mode # name if it has been set yet. func_echo () { $ECHO "$progname: ${opt_mode+$opt_mode: }$*" } # func_verbose arg... # Echo program name prefixed message in verbose mode only. func_verbose () { $opt_verbose && func_echo ${1+"$@"} # A bug in bash halts the script if the last line of a function # fails when set -e is in force, so we need another command to # work around that: : } # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } # func_error arg... # Echo program name prefixed message to standard error. func_error () { $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 } # func_warning arg... # Echo program name prefixed warning message to standard error. func_warning () { $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 # bash bug again: : } # func_fatal_error arg... # Echo program name prefixed message to standard error, and exit. func_fatal_error () { func_error ${1+"$@"} exit $EXIT_FAILURE } # func_fatal_help arg... # Echo program name prefixed message to standard error, followed by # a help hint, and exit. func_fatal_help () { func_error ${1+"$@"} func_fatal_error "$help" } help="Try \`$progname --help' for more information." ## default # func_grep expression filename # Check whether EXPRESSION matches any line of FILENAME, without output. func_grep () { $GREP "$1" "$2" >/dev/null 2>&1 } # func_mkdir_p directory-path # Make sure the entire path to DIRECTORY-PATH is available. func_mkdir_p () { my_directory_path="$1" my_dir_list= if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then # Protect directory names starting with `-' case $my_directory_path in -*) my_directory_path="./$my_directory_path" ;; esac # While some portion of DIR does not yet exist... while test ! -d "$my_directory_path"; do # ...make a list in topmost first order. Use a colon delimited # list incase some portion of path contains whitespace. my_dir_list="$my_directory_path:$my_dir_list" # If the last portion added has no slash in it, the list is done case $my_directory_path in */*) ;; *) break ;; esac # ...otherwise throw away the child directory and loop my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` done my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` save_mkdir_p_IFS="$IFS"; IFS=':' for my_dir in $my_dir_list; do IFS="$save_mkdir_p_IFS" # mkdir can fail with a `File exist' error if two processes # try to create one of the directories concurrently. Don't # stop in that case! $MKDIR "$my_dir" 2>/dev/null || : done IFS="$save_mkdir_p_IFS" # Bail out if we (or some other process) failed to create a directory. test -d "$my_directory_path" || \ func_fatal_error "Failed to create \`$1'" fi } # func_mktempdir [string] # Make a temporary directory that won't clash with other running # libtool processes, and avoids race conditions if possible. If # given, STRING is the basename for that directory. func_mktempdir () { my_template="${TMPDIR-/tmp}/${1-$progname}" if test "$opt_dry_run" = ":"; then # Return a directory name, but don't create it in dry-run mode my_tmpdir="${my_template}-$$" else # If mktemp works, use that first and foremost my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` if test ! -d "$my_tmpdir"; then # Failing that, at least try and use $RANDOM to avoid a race my_tmpdir="${my_template}-${RANDOM-0}$$" save_mktempdir_umask=`umask` umask 0077 $MKDIR "$my_tmpdir" umask $save_mktempdir_umask fi # If we're not in dry-run mode, bomb out on failure test -d "$my_tmpdir" || \ func_fatal_error "cannot create temporary directory \`$my_tmpdir'" fi $ECHO "$my_tmpdir" } # func_quote_for_eval arg # Aesthetically quote ARG to be evaled later. # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT # is double-quoted, suitable for a subsequent eval, whereas # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters # which are still active within double quotes backslashified. func_quote_for_eval () { case $1 in *[\\\`\"\$]*) func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; *) func_quote_for_eval_unquoted_result="$1" ;; esac case $func_quote_for_eval_unquoted_result in # Double-quote args containing shell metacharacters to delay # word splitting, command substitution and and variable # expansion for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" ;; *) func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" esac } # func_quote_for_expand arg # Aesthetically quote ARG to be evaled later; same as above, # but do not quote variable references. func_quote_for_expand () { case $1 in *[\\\`\"]*) my_arg=`$ECHO "$1" | $SED \ -e "$double_quote_subst" -e "$sed_double_backslash"` ;; *) my_arg="$1" ;; esac case $my_arg in # Double-quote args containing shell metacharacters to delay # word splitting and command substitution for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") my_arg="\"$my_arg\"" ;; esac func_quote_for_expand_result="$my_arg" } # func_show_eval cmd [fail_exp] # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. func_show_eval () { my_cmd="$1" my_fail_exp="${2-:}" ${opt_silent-false} || { func_quote_for_expand "$my_cmd" eval "func_echo $func_quote_for_expand_result" } if ${opt_dry_run-false}; then :; else eval "$my_cmd" my_status=$? if test "$my_status" -eq 0; then :; else eval "(exit $my_status); $my_fail_exp" fi fi } # func_show_eval_locale cmd [fail_exp] # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. Use the saved locale for evaluation. func_show_eval_locale () { my_cmd="$1" my_fail_exp="${2-:}" ${opt_silent-false} || { func_quote_for_expand "$my_cmd" eval "func_echo $func_quote_for_expand_result" } if ${opt_dry_run-false}; then :; else eval "$lt_user_locale $my_cmd" my_status=$? eval "$lt_safe_locale" if test "$my_status" -eq 0; then :; else eval "(exit $my_status); $my_fail_exp" fi fi } # func_tr_sh # Turn $1 into a string suitable for a shell variable name. # Result is stored in $func_tr_sh_result. All characters # not in the set a-zA-Z0-9_ are replaced with '_'. Further, # if $1 begins with a digit, a '_' is prepended as well. func_tr_sh () { case $1 in [0-9]* | *[!a-zA-Z0-9_]*) func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'` ;; * ) func_tr_sh_result=$1 ;; esac } # func_version # Echo version message to standard output and exit. func_version () { $opt_debug $SED -n '/(C)/!b go :more /\./!{ N s/\n# / / b more } :go /^# '$PROGRAM' (GNU /,/# warranty; / { s/^# // s/^# *$// s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ p }' < "$progpath" exit $? } # func_usage # Echo short help message to standard output and exit. func_usage () { $opt_debug $SED -n '/^# Usage:/,/^# *.*--help/ { s/^# // s/^# *$// s/\$progname/'$progname'/ p }' < "$progpath" echo $ECHO "run \`$progname --help | more' for full usage" exit $? } # func_help [NOEXIT] # Echo long help message to standard output and exit, # unless 'noexit' is passed as argument. func_help () { $opt_debug $SED -n '/^# Usage:/,/# Report bugs to/ { :print s/^# // s/^# *$// s*\$progname*'$progname'* s*\$host*'"$host"'* s*\$SHELL*'"$SHELL"'* s*\$LTCC*'"$LTCC"'* s*\$LTCFLAGS*'"$LTCFLAGS"'* s*\$LD*'"$LD"'* s/\$with_gnu_ld/'"$with_gnu_ld"'/ s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/ s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/ p d } /^# .* home page:/b print /^# General help using/b print ' < "$progpath" ret=$? if test -z "$1"; then exit $ret fi } # func_missing_arg argname # Echo program name prefixed message to standard error and set global # exit_cmd. func_missing_arg () { $opt_debug func_error "missing argument for $1." exit_cmd=exit } # func_split_short_opt shortopt # Set func_split_short_opt_name and func_split_short_opt_arg shell # variables after splitting SHORTOPT after the 2nd character. func_split_short_opt () { my_sed_short_opt='1s/^\(..\).*$/\1/;q' my_sed_short_rest='1s/^..\(.*\)$/\1/;q' func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"` func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"` } # func_split_short_opt may be replaced by extended shell implementation # func_split_long_opt longopt # Set func_split_long_opt_name and func_split_long_opt_arg shell # variables after splitting LONGOPT at the `=' sign. func_split_long_opt () { my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' my_sed_long_arg='1s/^--[^=]*=//' func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"` func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"` } # func_split_long_opt may be replaced by extended shell implementation exit_cmd=: magic="%%%MAGIC variable%%%" magic_exe="%%%MAGIC EXE variable%%%" # Global variables. nonopt= preserve_args= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" extracted_archives= extracted_serial=0 # If this variable is set in any of the actions, the command in it # will be execed at the end. This prevents here-documents from being # left over by shells. exec_cmd= # func_append var value # Append VALUE to the end of shell variable VAR. func_append () { eval "${1}=\$${1}\${2}" } # func_append may be replaced by extended shell implementation # func_append_quoted var value # Quote VALUE and append to the end of shell variable VAR, separated # by a space. func_append_quoted () { func_quote_for_eval "${2}" eval "${1}=\$${1}\\ \$func_quote_for_eval_result" } # func_append_quoted may be replaced by extended shell implementation # func_arith arithmetic-term... func_arith () { func_arith_result=`expr "${@}"` } # func_arith may be replaced by extended shell implementation # func_len string # STRING may not start with a hyphen. func_len () { func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len` } # func_len may be replaced by extended shell implementation # func_lo2o object func_lo2o () { func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` } # func_lo2o may be replaced by extended shell implementation # func_xform libobj-or-source func_xform () { func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'` } # func_xform may be replaced by extended shell implementation # func_fatal_configuration arg... # Echo program name prefixed message to standard error, followed by # a configuration failure hint, and exit. func_fatal_configuration () { func_error ${1+"$@"} func_error "See the $PACKAGE documentation for more information." func_fatal_error "Fatal configuration error." } # func_config # Display the configuration for all the tags in this script. func_config () { re_begincf='^# ### BEGIN LIBTOOL' re_endcf='^# ### END LIBTOOL' # Default configuration. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" # Now print the configurations for the tags. for tagname in $taglist; do $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" done exit $? } # func_features # Display the features supported by this script. func_features () { echo "host: $host" if test "$build_libtool_libs" = yes; then echo "enable shared libraries" else echo "disable shared libraries" fi if test "$build_old_libs" = yes; then echo "enable static libraries" else echo "disable static libraries" fi exit $? } # func_enable_tag tagname # Verify that TAGNAME is valid, and either flag an error and exit, or # enable the TAGNAME tag. We also add TAGNAME to the global $taglist # variable here. func_enable_tag () { # Global variable: tagname="$1" re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" sed_extractcf="/$re_begincf/,/$re_endcf/p" # Validate tagname. case $tagname in *[!-_A-Za-z0-9,/]*) func_fatal_error "invalid tag name: $tagname" ;; esac # Don't test for the "default" C tag, as we know it's # there but not specially marked. case $tagname in CC) ;; *) if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then taglist="$taglist $tagname" # Evaluate the configuration. Be careful to quote the path # and the sed script, to avoid splitting on whitespace, but # also don't use non-portable quotes within backquotes within # quotes we have to do it in 2 steps: extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` eval "$extractedcf" else func_error "ignoring unknown tag $tagname" fi ;; esac } # func_check_version_match # Ensure that we are using m4 macros, and libtool script from the same # release of libtool. func_check_version_match () { if test "$package_revision" != "$macro_revision"; then if test "$VERSION" != "$macro_version"; then if test -z "$macro_version"; then cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from an older release. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF fi else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, $progname: but the definition of this LT_INIT comes from revision $macro_revision. $progname: You should recreate aclocal.m4 with macros from revision $package_revision $progname: of $PACKAGE $VERSION and run autoconf again. _LT_EOF fi exit $EXIT_MISMATCH fi } # Shorthand for --mode=foo, only valid as the first argument case $1 in clean|clea|cle|cl) shift; set dummy --mode clean ${1+"$@"}; shift ;; compile|compil|compi|comp|com|co|c) shift; set dummy --mode compile ${1+"$@"}; shift ;; execute|execut|execu|exec|exe|ex|e) shift; set dummy --mode execute ${1+"$@"}; shift ;; finish|finis|fini|fin|fi|f) shift; set dummy --mode finish ${1+"$@"}; shift ;; install|instal|insta|inst|ins|in|i) shift; set dummy --mode install ${1+"$@"}; shift ;; link|lin|li|l) shift; set dummy --mode link ${1+"$@"}; shift ;; uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) shift; set dummy --mode uninstall ${1+"$@"}; shift ;; esac # Option defaults: opt_debug=: opt_dry_run=false opt_config=false opt_preserve_dup_deps=false opt_features=false opt_finish=false opt_help=false opt_help_all=false opt_silent=: opt_warning=: opt_verbose=: opt_silent=false opt_verbose=false # Parse options once, thoroughly. This comes as soon as possible in the # script to make things like `--version' happen as quickly as we can. { # this just eases exit handling while test $# -gt 0; do opt="$1" shift case $opt in --debug|-x) opt_debug='set -x' func_echo "enabling shell trace mode" $opt_debug ;; --dry-run|--dryrun|-n) opt_dry_run=: ;; --config) opt_config=: func_config ;; --dlopen|-dlopen) optarg="$1" opt_dlopen="${opt_dlopen+$opt_dlopen }$optarg" shift ;; --preserve-dup-deps) opt_preserve_dup_deps=: ;; --features) opt_features=: func_features ;; --finish) opt_finish=: set dummy --mode finish ${1+"$@"}; shift ;; --help) opt_help=: ;; --help-all) opt_help_all=: opt_help=': help-all' ;; --mode) test $# = 0 && func_missing_arg $opt && break optarg="$1" opt_mode="$optarg" case $optarg in # Valid mode arguments: clean|compile|execute|finish|install|link|relink|uninstall) ;; # Catch anything else as an error *) func_error "invalid argument for $opt" exit_cmd=exit break ;; esac shift ;; --no-silent|--no-quiet) opt_silent=false func_append preserve_args " $opt" ;; --no-warning|--no-warn) opt_warning=false func_append preserve_args " $opt" ;; --no-verbose) opt_verbose=false func_append preserve_args " $opt" ;; --silent|--quiet) opt_silent=: func_append preserve_args " $opt" opt_verbose=false ;; --verbose|-v) opt_verbose=: func_append preserve_args " $opt" opt_silent=false ;; --tag) test $# = 0 && func_missing_arg $opt && break optarg="$1" opt_tag="$optarg" func_append preserve_args " $opt $optarg" func_enable_tag "$optarg" shift ;; -\?|-h) func_usage ;; --help) func_help ;; --version) func_version ;; # Separate optargs to long options: --*=*) func_split_long_opt "$opt" set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"} shift ;; # Separate non-argument short options: -\?*|-h*|-n*|-v*) func_split_short_opt "$opt" set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"} shift ;; --) break ;; -*) func_fatal_help "unrecognized option \`$opt'" ;; *) set dummy "$opt" ${1+"$@"}; shift; break ;; esac done # Validate options: # save first non-option argument if test "$#" -gt 0; then nonopt="$opt" shift fi # preserve --debug test "$opt_debug" = : || func_append preserve_args " --debug" case $host in *cygwin* | *mingw* | *pw32* | *cegcc*) # don't eliminate duplications in $postdeps and $predeps opt_duplicate_compiler_generated_deps=: ;; *) opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps ;; esac $opt_help || { # Sanity checks first: func_check_version_match if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then func_fatal_configuration "not configured to build any kind of library" fi # Darwin sucks eval std_shrext=\"$shrext_cmds\" # Only execute mode is allowed to have -dlopen flags. if test -n "$opt_dlopen" && test "$opt_mode" != execute; then func_error "unrecognized option \`-dlopen'" $ECHO "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help="$help" help="Try \`$progname --help --mode=$opt_mode' for more information." } # Bail if the options were screwed $exit_cmd $EXIT_FAILURE } ## ----------- ## ## Main. ## ## ----------- ## # func_lalib_p file # True iff FILE is a libtool `.la' library or `.lo' object file. # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_lalib_p () { test -f "$1" && $SED -e 4q "$1" 2>/dev/null \ | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 } # func_lalib_unsafe_p file # True iff FILE is a libtool `.la' library or `.lo' object file. # This function implements the same check as func_lalib_p without # resorting to external programs. To this end, it redirects stdin and # closes it afterwards, without saving the original file descriptor. # As a safety measure, use it only where a negative result would be # fatal anyway. Works if `file' does not exist. func_lalib_unsafe_p () { lalib_p=no if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then for lalib_p_l in 1 2 3 4 do read lalib_p_line case "$lalib_p_line" in \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; esac done exec 0<&5 5<&- fi test "$lalib_p" = yes } # func_ltwrapper_script_p file # True iff FILE is a libtool wrapper script # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_script_p () { func_lalib_p "$1" } # func_ltwrapper_executable_p file # True iff FILE is a libtool wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_executable_p () { func_ltwrapper_exec_suffix= case $1 in *.exe) ;; *) func_ltwrapper_exec_suffix=.exe ;; esac $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 } # func_ltwrapper_scriptname file # Assumes file is an ltwrapper_executable # uses $file to determine the appropriate filename for a # temporary ltwrapper_script. func_ltwrapper_scriptname () { func_dirname_and_basename "$1" "" "." func_stripname '' '.exe' "$func_basename_result" func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" } # func_ltwrapper_p file # True iff FILE is a libtool wrapper script or wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_p () { func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" } # func_execute_cmds commands fail_cmd # Execute tilde-delimited COMMANDS. # If FAIL_CMD is given, eval that upon failure. # FAIL_CMD may read-access the current command in variable CMD! func_execute_cmds () { $opt_debug save_ifs=$IFS; IFS='~' for cmd in $1; do IFS=$save_ifs eval cmd=\"$cmd\" func_show_eval "$cmd" "${2-:}" done IFS=$save_ifs } # func_source file # Source FILE, adding directory component if necessary. # Note that it is not necessary on cygwin/mingw to append a dot to # FILE even if both FILE and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # `FILE.' does not work on cygwin managed mounts. func_source () { $opt_debug case $1 in */* | *\\*) . "$1" ;; *) . "./$1" ;; esac } # func_resolve_sysroot PATH # Replace a leading = in PATH with a sysroot. Store the result into # func_resolve_sysroot_result func_resolve_sysroot () { func_resolve_sysroot_result=$1 case $func_resolve_sysroot_result in =*) func_stripname '=' '' "$func_resolve_sysroot_result" func_resolve_sysroot_result=$lt_sysroot$func_stripname_result ;; esac } # func_replace_sysroot PATH # If PATH begins with the sysroot, replace it with = and # store the result into func_replace_sysroot_result. func_replace_sysroot () { case "$lt_sysroot:$1" in ?*:"$lt_sysroot"*) func_stripname "$lt_sysroot" '' "$1" func_replace_sysroot_result="=$func_stripname_result" ;; *) # Including no sysroot. func_replace_sysroot_result=$1 ;; esac } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { $opt_debug if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case "$@ " in " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then func_echo "unable to infer tagged configuration" func_fatal_error "specify a tag with \`--tag'" # else # func_verbose "using $tagname tagged configuration" fi ;; esac fi } # func_write_libtool_object output_name pic_name nonpic_name # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. func_write_libtool_object () { write_libobj=${1} if test "$build_libtool_libs" = yes; then write_lobj=\'${2}\' else write_lobj=none fi if test "$build_old_libs" = yes; then write_oldobj=\'${3}\' else write_oldobj=none fi $opt_dry_run || { cat >${write_libobj}T </dev/null` if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | $SED -e "$lt_sed_naive_backslashify"` else func_convert_core_file_wine_to_w32_result= fi fi } # end: func_convert_core_file_wine_to_w32 # func_convert_core_path_wine_to_w32 ARG # Helper function used by path conversion functions when $build is *nix, and # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly # configured wine environment available, with the winepath program in $build's # $PATH. Assumes ARG has no leading or trailing path separator characters. # # ARG is path to be converted from $build format to win32. # Result is available in $func_convert_core_path_wine_to_w32_result. # Unconvertible file (directory) names in ARG are skipped; if no directory names # are convertible, then the result may be empty. func_convert_core_path_wine_to_w32 () { $opt_debug # unfortunately, winepath doesn't convert paths, only file names func_convert_core_path_wine_to_w32_result="" if test -n "$1"; then oldIFS=$IFS IFS=: for func_convert_core_path_wine_to_w32_f in $1; do IFS=$oldIFS func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" if test -n "$func_convert_core_file_wine_to_w32_result" ; then if test -z "$func_convert_core_path_wine_to_w32_result"; then func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result" else func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" fi fi done IFS=$oldIFS fi } # end: func_convert_core_path_wine_to_w32 # func_cygpath ARGS... # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or # (2), returns the Cygwin file name or path in func_cygpath_result (input # file name or path is assumed to be in w32 format, as previously converted # from $build's *nix or MSYS format). In case (3), returns the w32 file name # or path in func_cygpath_result (input file name or path is assumed to be in # Cygwin format). Returns an empty string on error. # # ARGS are passed to cygpath, with the last one being the file name or path to # be converted. # # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH # environment variable; do not put it in $PATH. func_cygpath () { $opt_debug if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` if test "$?" -ne 0; then # on failure, ensure result is empty func_cygpath_result= fi else func_cygpath_result= func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'" fi } #end: func_cygpath # func_convert_core_msys_to_w32 ARG # Convert file name or path ARG from MSYS format to w32 format. Return # result in func_convert_core_msys_to_w32_result. func_convert_core_msys_to_w32 () { $opt_debug # awkward: cmd appends spaces to result func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` } #end: func_convert_core_msys_to_w32 # func_convert_file_check ARG1 ARG2 # Verify that ARG1 (a file name in $build format) was converted to $host # format in ARG2. Otherwise, emit an error message, but continue (resetting # func_to_host_file_result to ARG1). func_convert_file_check () { $opt_debug if test -z "$2" && test -n "$1" ; then func_error "Could not determine host file name corresponding to" func_error " \`$1'" func_error "Continuing, but uninstalled executables may not work." # Fallback: func_to_host_file_result="$1" fi } # end func_convert_file_check # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH # Verify that FROM_PATH (a path in $build format) was converted to $host # format in TO_PATH. Otherwise, emit an error message, but continue, resetting # func_to_host_file_result to a simplistic fallback value (see below). func_convert_path_check () { $opt_debug if test -z "$4" && test -n "$3"; then func_error "Could not determine the host path corresponding to" func_error " \`$3'" func_error "Continuing, but uninstalled executables may not work." # Fallback. This is a deliberately simplistic "conversion" and # should not be "improved". See libtool.info. if test "x$1" != "x$2"; then lt_replace_pathsep_chars="s|$1|$2|g" func_to_host_path_result=`echo "$3" | $SED -e "$lt_replace_pathsep_chars"` else func_to_host_path_result="$3" fi fi } # end func_convert_path_check # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT # and appending REPL if ORIG matches BACKPAT. func_convert_path_front_back_pathsep () { $opt_debug case $4 in $1 ) func_to_host_path_result="$3$func_to_host_path_result" ;; esac case $4 in $2 ) func_append func_to_host_path_result "$3" ;; esac } # end func_convert_path_front_back_pathsep ################################################## # $build to $host FILE NAME CONVERSION FUNCTIONS # ################################################## # invoked via `$to_host_file_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # Result will be available in $func_to_host_file_result. # func_to_host_file ARG # Converts the file name ARG from $build format to $host format. Return result # in func_to_host_file_result. func_to_host_file () { $opt_debug $to_host_file_cmd "$1" } # end func_to_host_file # func_to_tool_file ARG LAZY # converts the file name ARG from $build format to toolchain format. Return # result in func_to_tool_file_result. If the conversion in use is listed # in (the comma separated) LAZY, no conversion takes place. func_to_tool_file () { $opt_debug case ,$2, in *,"$to_tool_file_cmd",*) func_to_tool_file_result=$1 ;; *) $to_tool_file_cmd "$1" func_to_tool_file_result=$func_to_host_file_result ;; esac } # end func_to_tool_file # func_convert_file_noop ARG # Copy ARG to func_to_host_file_result. func_convert_file_noop () { func_to_host_file_result="$1" } # end func_convert_file_noop # func_convert_file_msys_to_w32 ARG # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_file_result. func_convert_file_msys_to_w32 () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_to_host_file_result="$func_convert_core_msys_to_w32_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_w32 # func_convert_file_cygwin_to_w32 ARG # Convert file name ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_file_cygwin_to_w32 () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then # because $build is cygwin, we call "the" cygpath in $PATH; no need to use # LT_CYGPATH in this case. func_to_host_file_result=`cygpath -m "$1"` fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_cygwin_to_w32 # func_convert_file_nix_to_w32 ARG # Convert file name ARG from *nix to w32 format. Requires a wine environment # and a working winepath. Returns result in func_to_host_file_result. func_convert_file_nix_to_w32 () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then func_convert_core_file_wine_to_w32 "$1" func_to_host_file_result="$func_convert_core_file_wine_to_w32_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_w32 # func_convert_file_msys_to_cygwin ARG # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_file_msys_to_cygwin () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_cygpath -u "$func_convert_core_msys_to_w32_result" func_to_host_file_result="$func_cygpath_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_cygwin # func_convert_file_nix_to_cygwin ARG # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed # in a wine environment, working winepath, and LT_CYGPATH set. Returns result # in func_to_host_file_result. func_convert_file_nix_to_cygwin () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. func_convert_core_file_wine_to_w32 "$1" func_cygpath -u "$func_convert_core_file_wine_to_w32_result" func_to_host_file_result="$func_cygpath_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_cygwin ############################################# # $build to $host PATH CONVERSION FUNCTIONS # ############################################# # invoked via `$to_host_path_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # The result will be available in $func_to_host_path_result. # # Path separators are also converted from $build format to $host format. If # ARG begins or ends with a path separator character, it is preserved (but # converted to $host format) on output. # # All path conversion functions are named using the following convention: # file name conversion function : func_convert_file_X_to_Y () # path conversion function : func_convert_path_X_to_Y () # where, for any given $build/$host combination the 'X_to_Y' value is the # same. If conversion functions are added for new $build/$host combinations, # the two new functions must follow this pattern, or func_init_to_host_path_cmd # will break. # func_init_to_host_path_cmd # Ensures that function "pointer" variable $to_host_path_cmd is set to the # appropriate value, based on the value of $to_host_file_cmd. to_host_path_cmd= func_init_to_host_path_cmd () { $opt_debug if test -z "$to_host_path_cmd"; then func_stripname 'func_convert_file_' '' "$to_host_file_cmd" to_host_path_cmd="func_convert_path_${func_stripname_result}" fi } # func_to_host_path ARG # Converts the path ARG from $build format to $host format. Return result # in func_to_host_path_result. func_to_host_path () { $opt_debug func_init_to_host_path_cmd $to_host_path_cmd "$1" } # end func_to_host_path # func_convert_path_noop ARG # Copy ARG to func_to_host_path_result. func_convert_path_noop () { func_to_host_path_result="$1" } # end func_convert_path_noop # func_convert_path_msys_to_w32 ARG # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_path_result. func_convert_path_msys_to_w32 () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # Remove leading and trailing path separator characters from ARG. MSYS # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; # and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result="$func_convert_core_msys_to_w32_result" func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_msys_to_w32 # func_convert_path_cygwin_to_w32 ARG # Convert path ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_path_cygwin_to_w32 () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_cygwin_to_w32 # func_convert_path_nix_to_w32 ARG # Convert path ARG from *nix to w32 format. Requires a wine environment and # a working winepath. Returns result in func_to_host_file_result. func_convert_path_nix_to_w32 () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result="$func_convert_core_path_wine_to_w32_result" func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_nix_to_w32 # func_convert_path_msys_to_cygwin ARG # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_path_msys_to_cygwin () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_msys_to_w32_result" func_to_host_path_result="$func_cygpath_result" func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_msys_to_cygwin # func_convert_path_nix_to_cygwin ARG # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a # a wine environment, working winepath, and LT_CYGPATH set. Returns result in # func_to_host_file_result. func_convert_path_nix_to_cygwin () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # Remove leading and trailing path separator characters from # ARG. msys behavior is inconsistent here, cygpath turns them # into '.;' and ';.', and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" func_to_host_path_result="$func_cygpath_result" func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_nix_to_cygwin # func_mode_compile arg... func_mode_compile () { $opt_debug # Get the compilation command and the source file. base_compile= srcfile="$nonopt" # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= pie_flag= for arg do case $arg_mode in arg ) # do not "continue". Instead, add this to base_compile lastarg="$arg" arg_mode=normal ;; target ) libobj="$arg" arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) test -n "$libobj" && \ func_fatal_error "you cannot specify \`-o' more than once" arg_mode=target continue ;; -pie | -fpie | -fPIE) func_append pie_flag " $arg" continue ;; -shared | -static | -prefer-pic | -prefer-non-pic) func_append later " $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result lastarg= save_ifs="$IFS"; IFS=',' for arg in $args; do IFS="$save_ifs" func_append_quoted lastarg "$arg" done IFS="$save_ifs" func_stripname ' ' '' "$lastarg" lastarg=$func_stripname_result # Add the arguments to base_compile. func_append base_compile " $lastarg" continue ;; *) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg="$srcfile" srcfile="$arg" ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. func_append_quoted base_compile "$lastarg" done # for arg case $arg_mode in arg) func_fatal_error "you must specify an argument for -Xcompile" ;; target) func_fatal_error "you must specify a target with \`-o'" ;; *) # Get the name of the library object. test -z "$libobj" && { func_basename "$srcfile" libobj="$func_basename_result" } ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo case $libobj in *.[cCFSifmso] | \ *.ada | *.adb | *.ads | *.asm | \ *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) func_xform "$libobj" libobj=$func_xform_result ;; esac case $libobj in *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; *) func_fatal_error "cannot determine name of library object from \`$libobj'" ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no continue ;; -static) build_libtool_libs=no build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done func_quote_for_eval "$libobj" test "X$libobj" != "X$func_quote_for_eval_result" \ && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ && func_warning "libobj name \`$libobj' may not contain shell special characters." func_dirname_and_basename "$obj" "/" "" objname="$func_basename_result" xdir="$func_dirname_result" lobj=${xdir}$objdir/$objname test -z "$base_compile" && \ func_fatal_help "you must specify a compilation command" # Delete any leftover library objects. if test "$build_old_libs" = yes; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2* | cegcc*) pic_mode=default ;; esac if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then $ECHO "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi func_append removelist " $output_obj" $ECHO "$srcfile" > "$lockfile" fi $opt_dry_run || $RM $removelist func_append removelist " $lockfile" trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 srcfile=$func_to_tool_file_result func_quote_for_eval "$srcfile" qsrcfile=$func_quote_for_eval_result # Only build a PIC object if we are building libtool libraries. if test "$build_libtool_libs" = yes; then # Without this assignment, base_compile gets emptied. fbsd_hideous_sh_bug=$base_compile if test "$pic_mode" != no; then command="$base_compile $qsrcfile $pic_flag" else # Don't build PIC code command="$base_compile $qsrcfile" fi func_mkdir_p "$xdir$objdir" if test -z "$output_obj"; then # Place PIC objects in $objdir func_append command " -o $lobj" fi func_show_eval_locale "$command" \ 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' if test "$need_locks" = warn && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then func_show_eval '$MV "$output_obj" "$lobj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi # Allow error messages only from the first compilation. if test "$suppress_opt" = yes; then suppress_output=' >/dev/null 2>&1' fi fi # Only build a position-dependent object if we build old libraries. if test "$build_old_libs" = yes; then if test "$pic_mode" != yes; then # Don't build PIC code command="$base_compile $qsrcfile$pie_flag" else command="$base_compile $qsrcfile $pic_flag" fi if test "$compiler_c_o" = yes; then func_append command " -o $obj" fi # Suppress compiler output if we already did a PIC compilation. func_append command "$suppress_output" func_show_eval_locale "$command" \ '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' if test "$need_locks" = warn && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then func_show_eval '$MV "$output_obj" "$obj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi fi $opt_dry_run || { func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" # Unlock the critical section if it was locked if test "$need_locks" != no; then removelist=$lockfile $RM "$lockfile" fi } exit $EXIT_SUCCESS } $opt_help || { test "$opt_mode" = compile && func_mode_compile ${1+"$@"} } func_mode_help () { # We need to display help for each of the modes. case $opt_mode in "") # Generic help is extracted from the usage comments # at the start of this file. func_help ;; clean) $ECHO \ "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $ECHO \ "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -no-suppress do not suppress compiler output for multiple passes -prefer-pic try to build PIC objects only -prefer-non-pic try to build non-PIC objects only -shared do not build a \`.o' file suitable for static linking -static only build a \`.o' file suitable for static linking -Wc,FLAG pass FLAG directly to the compiler COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix \`.c' with the library object suffix, \`.lo'." ;; execute) $ECHO \ "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to \`-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $ECHO \ "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the \`--dry-run' option if you just want to see what would be executed." ;; install) $ECHO \ "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the \`install' or \`cp' program. The following components of INSTALL-COMMAND are treated specially: -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $ECHO \ "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -bindir BINDIR specify path to binaries directory (for systems where libraries must be found in the PATH setting at runtime) -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE Use a list of object files found in FILE to specify objects -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -shared only do dynamic linking of libtool libraries -shrext SUFFIX override the standard shared library file extension -static do not do any dynamic linking of uninstalled libtool libraries -static-libtool-libs do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] -weak LIBNAME declare that the target provides the LIBNAME interface -Wc,FLAG -Xcompiler FLAG pass linker-specific FLAG directly to the compiler -Wl,FLAG -Xlinker FLAG pass linker-specific FLAG directly to the linker -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) All other options (arguments beginning with \`-') are ignored. Every other argument is treated as a filename. Files ending in \`.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only library objects (\`.lo' files) may be specified, and \`-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created using \`ar' and \`ranlib', or on Windows using \`lib'. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $ECHO \ "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) func_fatal_help "invalid operation mode \`$opt_mode'" ;; esac echo $ECHO "Try \`$progname --help' for more information about other modes." } # Now that we've collected a possible --mode arg, show help if necessary if $opt_help; then if test "$opt_help" = :; then func_mode_help else { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do func_mode_help done } | sed -n '1p; 2,$s/^Usage:/ or: /p' { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do echo func_mode_help done } | sed '1d /^When reporting/,/^Report/{ H d } $x /information about other modes/d /more detailed .*MODE/d s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' fi exit $? fi # func_mode_execute arg... func_mode_execute () { $opt_debug # The first argument is the command name. cmd="$nonopt" test -z "$cmd" && \ func_fatal_help "you must specify a COMMAND" # Handle -dlopen flags immediately. for file in $opt_dlopen; do test -f "$file" \ || func_fatal_help "\`$file' is not a file" dir= case $file in *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "\`$lib' is not a valid libtool archive" # Read the libtool library. dlname= library_names= func_source "$file" # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && \ func_warning "\`$file' was not linked with \`-export-dynamic'" continue fi func_dirname "$file" "" "." dir="$func_dirname_result" if test -f "$dir/$objdir/$dlname"; then func_append dir "/$objdir" else if test ! -f "$dir/$dlname"; then func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" fi fi ;; *.lo) # Just add the directory containing the .lo file. func_dirname "$file" "" "." dir="$func_dirname_result" ;; *) func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir="$absdir" # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic="$magic" # Check if any of the arguments is a wrapper script. args= for file do case $file in -* | *.la | *.lo ) ;; *) # Do a test to see if this is really a libtool program. if func_ltwrapper_script_p "$file"; then func_source "$file" # Transform arg to wrapped name. file="$progdir/$program" elif func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" func_source "$func_ltwrapper_scriptname_result" # Transform arg to wrapped name. file="$progdir/$program" fi ;; esac # Quote arguments (to preserve shell metacharacters). func_append_quoted args "$file" done if test "X$opt_dry_run" = Xfalse; then if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${save_$lt_var+set}\" = set; then $lt_var=\$save_$lt_var; export $lt_var else $lt_unset $lt_var fi" done # Now prepare to actually exec the command. exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" echo "export $shlibpath_var" fi $ECHO "$cmd$args" exit $EXIT_SUCCESS fi } test "$opt_mode" = execute && func_mode_execute ${1+"$@"} # func_mode_finish arg... func_mode_finish () { $opt_debug libs= libdirs= admincmds= for opt in "$nonopt" ${1+"$@"} do if test -d "$opt"; then func_append libdirs " $opt" elif test -f "$opt"; then if func_lalib_unsafe_p "$opt"; then func_append libs " $opt" else func_warning "\`$opt' is not a valid libtool archive" fi else func_fatal_error "invalid argument \`$opt'" fi done if test -n "$libs"; then if test -n "$lt_sysroot"; then sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" else sysroot_cmd= fi # Remove sysroot references if $opt_dry_run; then for lib in $libs; do echo "removing references to $lt_sysroot and \`=' prefixes from $lib" done else tmpdir=`func_mktempdir` for lib in $libs; do sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ > $tmpdir/tmp-la mv -f $tmpdir/tmp-la $lib done ${RM}r "$tmpdir" fi fi if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. func_execute_cmds "$finish_cmds" 'admincmds="$admincmds '"$cmd"'"' fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $opt_dry_run || eval "$cmds" || func_append admincmds " $cmds" fi done fi # Exit here if they wanted silent mode. $opt_silent && exit $EXIT_SUCCESS if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then echo "----------------------------------------------------------------------" echo "Libraries have been installed in:" for libdir in $libdirs; do $ECHO " $libdir" done echo echo "If you ever happen to want to link against installed libraries" echo "in a given directory, LIBDIR, you must either use libtool, and" echo "specify the full pathname of the library, or use the \`-LLIBDIR'" echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then echo " - add LIBDIR to the \`$shlibpath_var' environment variable" echo " during execution" fi if test -n "$runpath_var"; then echo " - add LIBDIR to the \`$runpath_var' environment variable" echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $ECHO " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then $ECHO " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi echo echo "See any operating system documentation about shared libraries for" case $host in solaris2.[6789]|solaris2.1[0-9]) echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" echo "pages." ;; *) echo "more information, such as the ld(1) and ld.so(8) manual pages." ;; esac echo "----------------------------------------------------------------------" fi exit $EXIT_SUCCESS } test "$opt_mode" = finish && func_mode_finish ${1+"$@"} # func_mode_install arg... func_mode_install () { $opt_debug # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. case $nonopt in *shtool*) :;; *) false;; esac; then # Aesthetically quote it. func_quote_for_eval "$nonopt" install_prog="$func_quote_for_eval_result " arg=$1 shift else install_prog= arg=$nonopt fi # The real first argument should be the name of the installation program. # Aesthetically quote it. func_quote_for_eval "$arg" func_append install_prog "$func_quote_for_eval_result" install_shared_prog=$install_prog case " $install_prog " in *[\\\ /]cp\ *) install_cp=: ;; *) install_cp=false ;; esac # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=no stripme= no_mode=: for arg do arg2= if test -n "$dest"; then func_append files " $dest" dest=$arg continue fi case $arg in -d) isdir=yes ;; -f) if $install_cp; then :; else prev=$arg fi ;; -g | -m | -o) prev=$arg ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then if test "x$prev" = x-m && test -n "$install_override_mode"; then arg2=$install_override_mode no_mode=false fi prev= else dest=$arg continue fi ;; esac # Aesthetically quote the argument. func_quote_for_eval "$arg" func_append install_prog " $func_quote_for_eval_result" if test -n "$arg2"; then func_quote_for_eval "$arg2" fi func_append install_shared_prog " $func_quote_for_eval_result" done test -z "$install_prog" && \ func_fatal_help "you must specify an install program" test -n "$prev" && \ func_fatal_help "the \`$prev' option requires an argument" if test -n "$install_override_mode" && $no_mode; then if $install_cp; then :; else func_quote_for_eval "$install_override_mode" func_append install_shared_prog " -m $func_quote_for_eval_result" fi fi if test -z "$files"; then if test -z "$dest"; then func_fatal_help "no file or destination specified" else func_fatal_help "you must specify a destination" fi fi # Strip any trailing slash from the destination. func_stripname '' '/' "$dest" dest=$func_stripname_result # Check to see that the destination is a directory. test -d "$dest" && isdir=yes if test "$isdir" = yes; then destdir="$dest" destname= else func_dirname_and_basename "$dest" "" "." destdir="$func_dirname_result" destname="$func_basename_result" # Not a directory, so check to see that there is only one file specified. set dummy $files; shift test "$#" -gt 1 && \ func_fatal_help "\`$dest' is not a directory" fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) func_fatal_help "\`$destdir' must be an absolute directory name" ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. func_append staticlibs " $file" ;; *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "\`$file' is not a valid libtool archive" library_names= old_library= relink_command= func_source "$file" # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) func_append current_libdirs " $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) func_append future_libdirs " $libdir" ;; esac fi func_dirname "$file" "/" "" dir="$func_dirname_result" func_append dir "$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. test "$inst_prefix_dir" = "$destdir" && \ func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi func_warning "relinking \`$file'" func_show_eval "$relink_command" \ 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' fi # See the names of the shared library. set dummy $library_names; shift if test -n "$1"; then realname="$1" shift srcname="$realname" test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ 'exit $?' tstripme="$stripme" case $host_os in cygwin* | mingw* | pw32* | cegcc*) case $realname in *.dll.a) tstripme="" ;; esac ;; esac if test -n "$tstripme" && test -n "$striplib"; then func_show_eval "$striplib $destdir/$realname" 'exit $?' fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. # Try `ln -sf' first, because the `ln' binary might depend on # the symlink we replace! Solaris /bin/ln does not understand -f, # so we also need to try rm && ln -s. for linkname do test "$linkname" != "$realname" \ && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" done fi # Do each command in the postinstall commands. lib="$destdir/$realname" func_execute_cmds "$postinstall_cmds" 'exit $?' fi # Install the pseudo-library for information purposes. func_basename "$file" name="$func_basename_result" instname="$dir/$name"i func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' # Maybe install the static library, too. test -n "$old_library" && func_append staticlibs " $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else func_basename "$file" destfile="$func_basename_result" destfile="$destdir/$destfile" fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) func_lo2o "$destfile" staticdest=$func_lo2o_result ;; *.$objext) staticdest="$destfile" destfile= ;; *) func_fatal_help "cannot copy a libtool object to \`$destfile'" ;; esac # Install the libtool object if requested. test -n "$destfile" && \ func_show_eval "$install_prog $file $destfile" 'exit $?' # Install the old object if enabled. if test "$build_old_libs" = yes; then # Deduce the name of the old-style object file. func_lo2o "$file" staticobj=$func_lo2o_result func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else func_basename "$file" destfile="$func_basename_result" destfile="$destdir/$destfile" fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext="" case $file in *.exe) if test ! -f "$file"; then func_stripname '' '.exe' "$file" file=$func_stripname_result stripped_ext=".exe" fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin* | *mingw*) if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" wrapper=$func_ltwrapper_scriptname_result else func_stripname '' '.exe' "$file" wrapper=$func_stripname_result fi ;; *) wrapper=$file ;; esac if func_ltwrapper_script_p "$wrapper"; then notinst_deplibs= relink_command= func_source "$wrapper" # Check the variables that should have been set. test -z "$generated_by_libtool_version" && \ func_fatal_error "invalid libtool wrapper script \`$wrapper'" finalize=yes for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then func_source "$lib" fi libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then func_warning "\`$lib' has not been installed in \`$libdir'" finalize=no fi done relink_command= func_source "$wrapper" outputname= if test "$fast_install" = no && test -n "$relink_command"; then $opt_dry_run || { if test "$finalize" = yes; then tmpdir=`func_mktempdir` func_basename "$file$stripped_ext" file="$func_basename_result" outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` $opt_silent || { func_quote_for_expand "$relink_command" eval "func_echo $func_quote_for_expand_result" } if eval "$relink_command"; then : else func_error "error: relink \`$file' with the above command before installing it" $opt_dry_run || ${RM}r "$tmpdir" continue fi file="$outputname" else func_warning "cannot relink \`$file'" fi } else # Install the binary that we compiled earlier. file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyway case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) func_stripname '' '.exe' "$destfile" destfile=$func_stripname_result ;; esac ;; esac func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' $opt_dry_run || if test -n "$outputname"; then ${RM}r "$tmpdir" fi ;; esac done for file in $staticlibs; do func_basename "$file" name="$func_basename_result" # Set up the ranlib parameters. oldlib="$destdir/$name" func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result func_show_eval "$install_prog \$file \$oldlib" 'exit $?' if test -n "$stripme" && test -n "$old_striplib"; then func_show_eval "$old_striplib $tool_oldlib" 'exit $?' fi # Do each command in the postinstall commands. func_execute_cmds "$old_postinstall_cmds" 'exit $?' done test -n "$future_libdirs" && \ func_warning "remember to run \`$progname --finish$future_libdirs'" if test -n "$current_libdirs"; then # Maybe just do a dry run. $opt_dry_run && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi } test "$opt_mode" = install && func_mode_install ${1+"$@"} # func_generate_dlsyms outputname originator pic_p # Extract symbols from dlprefiles and create ${outputname}S.o with # a dlpreopen symbol table. func_generate_dlsyms () { $opt_debug my_outputname="$1" my_originator="$2" my_pic_p="${3-no}" my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` my_dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then my_dlsyms="${my_outputname}S.c" else func_error "not configured to extract global symbols from dlpreopened files" fi fi if test -n "$my_dlsyms"; then case $my_dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist="$output_objdir/${my_outputname}.nm" func_show_eval "$RM $nlist ${nlist}S ${nlist}T" # Parse the name list into a source file. func_verbose "creating $output_objdir/$my_dlsyms" $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ #ifdef __cplusplus extern \"C\" { #endif #if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) #pragma GCC diagnostic ignored \"-Wstrict-prototypes\" #endif /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif /* External symbol declarations for the compiler. */\ " if test "$dlself" = yes; then func_verbose "generating symbol list for \`$output'" $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` for progfile in $progfiles; do func_to_tool_file "$progfile" func_convert_file_msys_to_w32 func_verbose "extracting global C symbols from \`$func_to_tool_file_result'" $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $opt_dry_run || { eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi if test -n "$export_symbols_regex"; then $opt_dry_run || { eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols="$output_objdir/$outputname.exp" $opt_dry_run || { $RM $export_symbols eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' ;; esac } else $opt_dry_run || { eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; esac } fi fi for dlprefile in $dlprefiles; do func_verbose "extracting global C symbols from \`$dlprefile'" func_basename "$dlprefile" name="$func_basename_result" case $host in *cygwin* | *mingw* | *cegcc* ) # if an import library, we need to obtain dlname if func_win32_import_lib_p "$dlprefile"; then func_tr_sh "$dlprefile" eval "curr_lafile=\$libfile_$func_tr_sh_result" dlprefile_dlbasename="" if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then # Use subshell, to avoid clobbering current variable values dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` if test -n "$dlprefile_dlname" ; then func_basename "$dlprefile_dlname" dlprefile_dlbasename="$func_basename_result" else # no lafile. user explicitly requested -dlpreopen . $sharedlib_from_linklib_cmd "$dlprefile" dlprefile_dlbasename=$sharedlib_from_linklib_result fi fi $opt_dry_run || { if test -n "$dlprefile_dlbasename" ; then eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' else func_warning "Could not compute DLL name from $name" eval '$ECHO ": $name " >> "$nlist"' fi func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" } else # not an import lib $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } fi ;; *) $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } ;; esac done $opt_dry_run || { # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $MV "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if $GREP -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else $GREP -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' else echo '/* NONE */' >> "$output_objdir/$my_dlsyms" fi echo >> "$output_objdir/$my_dlsyms" "\ /* The mapping between symbol names and symbols. */ typedef struct { const char *name; void *address; } lt_dlsymlist; extern LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[]; LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[] = {\ { \"$my_originator\", (void *) 0 }," case $need_lib_prefix in no) eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; *) eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; esac echo >> "$output_objdir/$my_dlsyms" "\ {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_${my_prefix}_LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " } # !$opt_dry_run pic_flag_for_symtable= case "$compile_command " in *" -static "*) ;; *) case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; *-*-hpux*) pic_flag_for_symtable=" $pic_flag" ;; *) if test "X$my_pic_p" != Xno; then pic_flag_for_symtable=" $pic_flag" fi ;; esac ;; esac symtab_cflags= for arg in $LTCFLAGS; do case $arg in -pie | -fpie | -fPIE) ;; *) func_append symtab_cflags " $arg" ;; esac done # Now compile the dynamic symbol file. func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' # Clean up the generated files. func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' # Transform the symbol file into the correct name. symfileobj="$output_objdir/${my_outputname}S.$objext" case $host in *cygwin* | *mingw* | *cegcc* ) if test -f "$output_objdir/$my_outputname.def"; then compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` else compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` fi ;; *) compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` ;; esac ;; *) func_fatal_error "unknown suffix for \`$my_dlsyms'" ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` fi } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. # Despite the name, also deal with 64 bit binaries. func_win32_libid () { $opt_debug win32_libid_type="unknown" win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then func_to_tool_file "$1" func_convert_file_msys_to_w32 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | $SED -n -e ' 1,100{ / I /{ s,.*,import, p q } }'` case $win32_nmres in import*) win32_libid_type="x86 archive import";; *) win32_libid_type="x86 archive static";; esac fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $ECHO "$win32_libid_type" } # func_cygming_dll_for_implib ARG # # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib () { $opt_debug sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` } # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs # # The is the core of a fallback implementation of a # platform-specific function to extract the name of the # DLL associated with the specified import library LIBNAME. # # SECTION_NAME is either .idata$6 or .idata$7, depending # on the platform and compiler that created the implib. # # Echos the name of the DLL associated with the # specified import library. func_cygming_dll_for_implib_fallback_core () { $opt_debug match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` $OBJDUMP -s --section "$1" "$2" 2>/dev/null | $SED '/^Contents of section '"$match_literal"':/{ # Place marker at beginning of archive member dllname section s/.*/====MARK====/ p d } # These lines can sometimes be longer than 43 characters, but # are always uninteresting /:[ ]*file format pe[i]\{,1\}-/d /^In archive [^:]*:/d # Ensure marker is printed /^====MARK====/p # Remove all lines with less than 43 characters /^.\{43\}/!d # From remaining lines, remove first 43 characters s/^.\{43\}//' | $SED -n ' # Join marker and all lines until next marker into a single line /^====MARK====/ b para H $ b para b :para x s/\n//g # Remove the marker s/^====MARK====// # Remove trailing dots and whitespace s/[\. \t]*$// # Print /./p' | # we now have a list, one entry per line, of the stringified # contents of the appropriate section of all members of the # archive which possess that section. Heuristic: eliminate # all those which have a first or second character that is # a '.' (that is, objdump's representation of an unprintable # character.) This should work for all archives with less than # 0x302f exports -- but will fail for DLLs whose name actually # begins with a literal '.' or a single character followed by # a '.'. # # Of those that remain, print the first one. $SED -e '/^\./d;/^.\./d;q' } # func_cygming_gnu_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is a GNU/binutils-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_gnu_implib_p () { $opt_debug func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` test -n "$func_cygming_gnu_implib_tmp" } # func_cygming_ms_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is an MS-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_ms_implib_p () { $opt_debug func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` test -n "$func_cygming_ms_implib_tmp" } # func_cygming_dll_for_implib_fallback ARG # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # # This fallback implementation is for use when $DLLTOOL # does not support the --identify-strict option. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib_fallback () { $opt_debug if func_cygming_gnu_implib_p "$1" ; then # binutils import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` elif func_cygming_ms_implib_p "$1" ; then # ms-generated import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` else # unknown sharedlib_from_linklib_result="" fi } # func_extract_an_archive dir oldlib func_extract_an_archive () { $opt_debug f_ex_an_ar_dir="$1"; shift f_ex_an_ar_oldlib="$1" if test "$lock_old_archive_extraction" = yes; then lockfile=$f_ex_an_ar_oldlib.lock until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done fi func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ 'stat=$?; rm -f "$lockfile"; exit $stat' if test "$lock_old_archive_extraction" = yes; then $opt_dry_run || rm -f "$lockfile" fi if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" fi } # func_extract_archives gentop oldlib ... func_extract_archives () { $opt_debug my_gentop="$1"; shift my_oldlibs=${1+"$@"} my_oldobjs="" my_xlib="" my_xabs="" my_xdir="" for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac func_basename "$my_xlib" my_xlib="$func_basename_result" my_xlib_u=$my_xlib while :; do case " $extracted_archives " in *" $my_xlib_u "*) func_arith $extracted_serial + 1 extracted_serial=$func_arith_result my_xlib_u=lt$extracted_serial-$my_xlib ;; *) break ;; esac done extracted_archives="$extracted_archives $my_xlib_u" my_xdir="$my_gentop/$my_xlib_u" func_mkdir_p "$my_xdir" case $host in *-darwin*) func_verbose "Extracting $my_xabs" # Do not bother doing anything if just a dry run $opt_dry_run || { darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` darwin_base_archive=`basename "$darwin_archive"` darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` if test -n "$darwin_arches"; then darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches ; do func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" func_extract_an_archive "`pwd`" "${darwin_base_archive}" cd "$darwin_curdir" $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" done # $darwin_arches ## Okay now we've a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` $LIPO -create -output "$darwin_file" $darwin_files done # $darwin_filelist $RM -rf unfat-$$ cd "$darwin_orig_dir" else cd $darwin_orig_dir func_extract_an_archive "$my_xdir" "$my_xabs" fi # $darwin_arches } # !$opt_dry_run ;; *) func_extract_an_archive "$my_xdir" "$my_xabs" ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` done func_extract_archives_result="$my_oldobjs" } # func_emit_wrapper [arg=no] # # Emit a libtool wrapper script on stdout. # Don't directly open a file because we may want to # incorporate the script contents within a cygwin/mingw # wrapper executable. Must ONLY be called from within # func_mode_link because it depends on a number of variables # set therein. # # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR # variable will take. If 'yes', then the emitted script # will assume that the directory in which it is stored is # the $objdir directory. This is a cygwin/mingw-specific # behavior. func_emit_wrapper () { func_emit_wrapper_arg1=${1-no} $ECHO "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. sed_quote_subst='$sed_quote_subst' # Be Bourne compatible if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variables: generated_by_libtool_version='$macro_version' notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$ECHO are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then file=\"\$0\"" qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` $ECHO "\ # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } ECHO=\"$qECHO\" fi # Very basic option parsing. These options are (a) specific to # the libtool wrapper, (b) are identical between the wrapper # /script/ and the wrapper /executable/ which is used only on # windows platforms, and (c) all begin with the string "--lt-" # (application programs are unlikely to have options which match # this pattern). # # There are only two supported options: --lt-debug and # --lt-dump-script. There is, deliberately, no --lt-help. # # The first argument to this parsing function should be the # script's $0 value, followed by "$@". lt_option_debug= func_parse_lt_options () { lt_script_arg0=\$0 shift for lt_opt do case \"\$lt_opt\" in --lt-debug) lt_option_debug=1 ;; --lt-dump-script) lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` cat \"\$lt_dump_D/\$lt_dump_F\" exit 0 ;; --lt-*) \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 exit 1 ;; esac done # Print the debug banner immediately: if test -n \"\$lt_option_debug\"; then echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 fi } # Used when --lt-debug. Prints its arguments to stdout # (redirection is the responsibility of the caller) func_lt_dump_args () { lt_dump_args_N=1; for lt_arg do \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` done } # Core function for launching the target application func_exec_program_core () { " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2* | *-cegcc*) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} " ;; *) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir/\$program\" \${1+\"\$@\"} " ;; esac $ECHO "\ \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 exit 1 } # A function to encapsulate launching the target application # Strips options in the --lt-* namespace from \$@ and # launches target application with the remaining arguments. func_exec_program () { case \" \$* \" in *\\ --lt-*) for lt_wr_arg do case \$lt_wr_arg in --lt-*) ;; *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; esac shift done ;; esac func_exec_program_core \${1+\"\$@\"} } # Parse options func_parse_lt_options \"\$0\" \${1+\"\$@\"} # Find the directory that this script lives in. thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` done # Usually 'no', except on cygwin/mingw when embedded into # the cwrapper. WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then # special case for '.' if test \"\$thisdir\" = \".\"; then thisdir=\`pwd\` fi # remove .libs from thisdir case \"\$thisdir\" in *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; $objdir ) thisdir=. ;; esac fi # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test "$fast_install" = yes; then $ECHO "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $MKDIR \"\$progdir\" else $RM \"\$progdir/\$file\" fi" $ECHO "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else $ECHO \"\$relink_command_output\" >&2 $RM \"\$progdir/\$file\" exit 1 fi fi $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $RM \"\$progdir/\$program\"; $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } $RM \"\$progdir/\$file\" fi" else $ECHO "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $ECHO "\ if test -f \"\$progdir/\$program\"; then" # fixup the dll searchpath if we need to. # # Fix the DLL searchpath if we need to. Do this before prepending # to shlibpath, because on Windows, both are PATH and uninstalled # libraries must come first. if test -n "$dllsearchpath"; then $ECHO "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $ECHO "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` export $shlibpath_var " fi $ECHO "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. func_exec_program \${1+\"\$@\"} fi else # The program doesn't exist. \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ " } # func_emit_cwrapperexe_src # emit the source code for a wrapper executable on stdout # Must ONLY be called from within func_mode_link because # it depends on a number of variable set therein. func_emit_cwrapperexe_src () { cat < #include #ifdef _MSC_VER # include # include # include #else # include # include # ifdef __CYGWIN__ # include # endif #endif #include #include #include #include #include #include #include #include /* declarations of non-ANSI functions */ #if defined(__MINGW32__) # ifdef __STRICT_ANSI__ int _putenv (const char *); # endif #elif defined(__CYGWIN__) # ifdef __STRICT_ANSI__ char *realpath (const char *, char *); int putenv (char *); int setenv (const char *, const char *, int); # endif /* #elif defined (other platforms) ... */ #endif /* portability defines, excluding path handling macros */ #if defined(_MSC_VER) # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv # define S_IXUSR _S_IEXEC # ifndef _INTPTR_T_DEFINED # define _INTPTR_T_DEFINED # define intptr_t int # endif #elif defined(__MINGW32__) # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv #elif defined(__CYGWIN__) # define HAVE_SETENV # define FOPEN_WB "wb" /* #elif defined (other platforms) ... */ #endif #if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX #elif defined(MAXPATHLEN) # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef S_IXOTH # define S_IXOTH 0 #endif #ifndef S_IXGRP # define S_IXGRP 0 #endif /* path handling portability macros */ #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ defined (__OS2__) # define HAVE_DOS_BASED_FILE_SYSTEM # define FOPEN_WB "wb" # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #ifndef FOPEN_WB # define FOPEN_WB "w" #endif #ifndef _O_BINARY # define _O_BINARY 0 #endif #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free ((void *) stale); stale = 0; } \ } while (0) #if defined(LT_DEBUGWRAPPER) static int lt_debug = 1; #else static int lt_debug = 0; #endif const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ void *xmalloc (size_t num); char *xstrdup (const char *string); const char *base_name (const char *name); char *find_executable (const char *wrapper); char *chase_symlinks (const char *pathspec); int make_executable (const char *path); int check_executable (const char *path); char *strendzap (char *str, const char *pat); void lt_debugprintf (const char *file, int line, const char *fmt, ...); void lt_fatal (const char *file, int line, const char *message, ...); static const char *nonnull (const char *s); static const char *nonempty (const char *s); void lt_setenv (const char *name, const char *value); char *lt_extend_str (const char *orig_value, const char *add, int to_end); void lt_update_exe_path (const char *name, const char *value); void lt_update_lib_path (const char *name, const char *value); char **prepare_spawn (char **argv); void lt_dump_script (FILE *f); EOF cat <= 0) && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) return 1; else return 0; } int make_executable (const char *path) { int rval = 0; struct stat st; lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", nonempty (path)); if ((!path) || (!*path)) return 0; if (stat (path, &st) >= 0) { rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); } return rval; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise Does not chase symlinks, even on platforms that support them. */ char * find_executable (const char *wrapper) { int has_slash = 0; const char *p; const char *p_next; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; int tmp_len; char *concat_name; lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", nonempty (wrapper)); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined (HAVE_DOS_BASED_FILE_SYSTEM) if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } #if defined (HAVE_DOS_BASED_FILE_SYSTEM) } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char *path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char *q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR (*q)) break; p_len = q - p; p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); return NULL; } char * chase_symlinks (const char *pathspec) { #ifndef S_ISLNK return xstrdup (pathspec); #else char buf[LT_PATHMAX]; struct stat s; char *tmp_pathspec = xstrdup (pathspec); char *p; int has_symlinks = 0; while (strlen (tmp_pathspec) && !has_symlinks) { lt_debugprintf (__FILE__, __LINE__, "checking path component for symlinks: %s\n", tmp_pathspec); if (lstat (tmp_pathspec, &s) == 0) { if (S_ISLNK (s.st_mode) != 0) { has_symlinks = 1; break; } /* search backwards for last DIR_SEPARATOR */ p = tmp_pathspec + strlen (tmp_pathspec) - 1; while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) p--; if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) { /* no more DIR_SEPARATORS left */ break; } *p = '\0'; } else { lt_fatal (__FILE__, __LINE__, "error accessing file \"%s\": %s", tmp_pathspec, nonnull (strerror (errno))); } } XFREE (tmp_pathspec); if (!has_symlinks) { return xstrdup (pathspec); } tmp_pathspec = realpath (pathspec, buf); if (tmp_pathspec == 0) { lt_fatal (__FILE__, __LINE__, "could not follow symlinks for %s", pathspec); } return xstrdup (tmp_pathspec); #endif } char * strendzap (char *str, const char *pat) { size_t len, patlen; assert (str != NULL); assert (pat != NULL); len = strlen (str); patlen = strlen (pat); if (patlen <= len) { str += len - patlen; if (strcmp (str, pat) == 0) *str = '\0'; } return str; } void lt_debugprintf (const char *file, int line, const char *fmt, ...) { va_list args; if (lt_debug) { (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); va_start (args, fmt); (void) vfprintf (stderr, fmt, args); va_end (args); } } static void lt_error_core (int exit_status, const char *file, int line, const char *mode, const char *message, va_list ap) { fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *file, int line, const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); va_end (ap); } static const char * nonnull (const char *s) { return s ? s : "(null)"; } static const char * nonempty (const char *s) { return (s && !*s) ? "(empty)" : nonnull (s); } void lt_setenv (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_setenv) setting '%s' to '%s'\n", nonnull (name), nonnull (value)); { #ifdef HAVE_SETENV /* always make a copy, for consistency with !HAVE_SETENV */ char *str = xstrdup (value); setenv (name, str, 1); #else int len = strlen (name) + 1 + strlen (value) + 1; char *str = XMALLOC (char, len); sprintf (str, "%s=%s", name, value); if (putenv (str) != EXIT_SUCCESS) { XFREE (str); } #endif } } char * lt_extend_str (const char *orig_value, const char *add, int to_end) { char *new_value; if (orig_value && *orig_value) { int orig_value_len = strlen (orig_value); int add_len = strlen (add); new_value = XMALLOC (char, add_len + orig_value_len + 1); if (to_end) { strcpy (new_value, orig_value); strcpy (new_value + orig_value_len, add); } else { strcpy (new_value, add); strcpy (new_value + add_len, orig_value); } } else { new_value = xstrdup (add); } return new_value; } void lt_update_exe_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); /* some systems can't cope with a ':'-terminated path #' */ int len = strlen (new_value); while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) { new_value[len-1] = '\0'; } lt_setenv (name, new_value); XFREE (new_value); } } void lt_update_lib_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); lt_setenv (name, new_value); XFREE (new_value); } } EOF case $host_os in mingw*) cat <<"EOF" /* Prepares an argument vector before calling spawn(). Note that spawn() does not by itself call the command interpreter (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx(&v); v.dwPlatformId == VER_PLATFORM_WIN32_NT; }) ? "cmd.exe" : "command.com"). Instead it simply concatenates the arguments, separated by ' ', and calls CreateProcess(). We must quote the arguments since Win32 CreateProcess() interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a special way: - Space and tab are interpreted as delimiters. They are not treated as delimiters if they are surrounded by double quotes: "...". - Unescaped double quotes are removed from the input. Their only effect is that within double quotes, space and tab are treated like normal characters. - Backslashes not followed by double quotes are not special. - But 2*n+1 backslashes followed by a double quote become n backslashes followed by a double quote (n >= 0): \" -> " \\\" -> \" \\\\\" -> \\" */ #define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" #define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" char ** prepare_spawn (char **argv) { size_t argc; char **new_argv; size_t i; /* Count number of arguments. */ for (argc = 0; argv[argc] != NULL; argc++) ; /* Allocate new argument vector. */ new_argv = XMALLOC (char *, argc + 1); /* Put quoted arguments into the new argument vector. */ for (i = 0; i < argc; i++) { const char *string = argv[i]; if (string[0] == '\0') new_argv[i] = xstrdup ("\"\""); else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) { int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); size_t length; unsigned int backslashes; const char *s; char *quoted_string; char *p; length = 0; backslashes = 0; if (quote_around) length++; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') length += backslashes + 1; length++; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) length += backslashes + 1; quoted_string = XMALLOC (char, length + 1); p = quoted_string; backslashes = 0; if (quote_around) *p++ = '"'; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') { unsigned int j; for (j = backslashes + 1; j > 0; j--) *p++ = '\\'; } *p++ = c; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) { unsigned int j; for (j = backslashes; j > 0; j--) *p++ = '\\'; *p++ = '"'; } *p = '\0'; new_argv[i] = quoted_string; } else new_argv[i] = (char *) string; } new_argv[argc] = NULL; return new_argv; } EOF ;; esac cat <<"EOF" void lt_dump_script (FILE* f) { EOF func_emit_wrapper yes | $SED -n -e ' s/^\(.\{79\}\)\(..*\)/\1\ \2/ h s/\([\\"]\)/\\\1/g s/$/\\n/ s/\([^\n]*\).*/ fputs ("\1", f);/p g D' cat <<"EOF" } EOF } # end: func_emit_cwrapperexe_src # func_win32_import_lib_p ARG # True if ARG is an import lib, as indicated by $file_magic_cmd func_win32_import_lib_p () { $opt_debug case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in *import*) : ;; *) false ;; esac } # func_mode_link arg... func_mode_link () { $opt_debug case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # which system we are compiling for in order to pass an extra # flag for every libtool invocation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying # to make a dll which has undefined symbols, in which case not # even a static library is built. For now, we need to specify # -no-undefined on the libtool link line when we can be certain # that all symbols are satisfied, otherwise we get a static library. allow_undefined=yes ;; *) allow_undefined=yes ;; esac libtool_args=$nonopt base_compile="$nonopt $@" compile_command=$nonopt finalize_command=$nonopt compile_rpath= finalize_rpath= compile_shlibpath= finalize_shlibpath= convenience= old_convenience= deplibs= old_deplibs= compiler_flags= linker_flags= dllsearchpath= lib_search_path=`pwd` inst_prefix_dir= new_inherited_linker_flags= avoid_version=no bindir= dlfiles= dlprefiles= dlself=no export_dynamic=no export_symbols= export_symbols_regex= generated= libobjs= ltlibs= module=no no_install=no objs= non_pic_objects= precious_files_regex= prefer_static_libs=no preload=no prev= prevarg= release= rpath= xrpath= perm_rpath= temp_rpath= thread_safe=no vinfo= vinfo_number=no weak_libs= single_module="${wl}-single_module" func_infer_tag $base_compile # We need to know -static, to get the right output filenames. for arg do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no break ;; -all-static | -static | -static-libtool-libs) case $arg in -all-static) if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then func_warning "complete static linking is impossible in this configuration" fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; -static) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=built ;; -static-libtool-libs) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; esac build_libtool_libs=no build_old_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg="$1" shift func_quote_for_eval "$arg" qarg=$func_quote_for_eval_unquoted_result func_append libtool_args " $func_quote_for_eval_result" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) func_append compile_command " @OUTPUT@" func_append finalize_command " @OUTPUT@" ;; esac case $prev in bindir) bindir="$arg" prev= continue ;; dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. func_append compile_command " @SYMFILE@" func_append finalize_command " @SYMFILE@" preload=yes fi case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test "$dlself" = no; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test "$prev" = dlprefiles; then dlself=yes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test "$prev" = dlfiles; then func_append dlfiles " $arg" else func_append dlprefiles " $arg" fi prev= continue ;; esac ;; expsyms) export_symbols="$arg" test -f "$arg" \ || func_fatal_error "symbol file \`$arg' does not exist" prev= continue ;; expsyms_regex) export_symbols_regex="$arg" prev= continue ;; framework) case $host in *-*-darwin*) case "$deplibs " in *" $qarg.ltframework "*) ;; *) func_append deplibs " $qarg.ltframework" # this is fixed later ;; esac ;; esac prev= continue ;; inst_prefix) inst_prefix_dir="$arg" prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat "$save_arg"` do # func_append moreargs " $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "\`$arg' is not a valid libtool object" fi fi done else func_fatal_error "link input file \`$arg' does not exist" fi arg=$save_arg prev= continue ;; precious_regex) precious_files_regex="$arg" prev= continue ;; release) release="-$arg" prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; *) func_append rpath " $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) func_append xrpath " $arg" ;; esac fi prev= continue ;; shrext) shrext_cmds="$arg" prev= continue ;; weak) func_append weak_libs " $arg" prev= continue ;; xcclinker) func_append linker_flags " $qarg" func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xcompiler) func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xlinker) func_append linker_flags " $qarg" func_append compiler_flags " $wl$qarg" prev= func_append compile_command " $wl$qarg" func_append finalize_command " $wl$qarg" continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg="$arg" case $arg in -all-static) if test -n "$link_static_flag"; then # See comment for -static flag below, for more details. func_append compile_command " $link_static_flag" func_append finalize_command " $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. func_fatal_error "\`-allow-undefined' must not be used because it is the default" ;; -avoid-version) avoid_version=yes continue ;; -bindir) prev=bindir continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then func_fatal_error "more than one -exported-symbols argument is not allowed" fi if test "X$arg" = "X-export-symbols"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework) prev=framework continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) func_append compile_command " $arg" func_append finalize_command " $arg" ;; esac continue ;; -L*) func_stripname "-L" '' "$arg" if test -z "$func_stripname_result"; then if test "$#" -gt 0; then func_fatal_error "require no space between \`-L' and \`$1'" else func_fatal_error "need path for \`-L' option" fi fi func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` test -z "$absdir" && \ func_fatal_error "cannot determine absolute directory name of \`$dir'" dir="$absdir" ;; esac case "$deplibs " in *" -L$dir "* | *" $arg "*) # Will only happen for absolute or sysroot arguments ;; *) # Preserve sysroot, but never include relative directories case $dir in [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; *) func_append deplibs " -L$dir" ;; esac func_append lib_search_path " $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; ::) dllsearchpath=$dir;; *) func_append dllsearchpath ":$dir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac continue ;; -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) # These systems don't actually have a C or math library (as such) continue ;; *-*-os2*) # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework func_append deplibs " System.ltframework" continue ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype test "X$arg" = "X-lc" && continue ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work test "X$arg" = "X-lc" && continue ;; esac elif test "X$arg" = "X-lc_r"; then case $host in *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi func_append deplibs " $arg" continue ;; -module) module=yes continue ;; # Tru64 UNIX uses -model [arg] to determine the layout of C++ # classes, name mangling, and exception handling. # Darwin uses the -arch flag to determine output architecture. -model|-arch|-isysroot|--sysroot) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" prev=xcompiler continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" case "$new_inherited_linker_flags " in *" $arg "*) ;; * ) func_append new_inherited_linker_flags " $arg" ;; esac continue ;; -multi_module) single_module="${wl}-multi_module" continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) # The PATH hackery in wrapper scripts is required on Windows # and Darwin in order for the loader to find any dlls it needs. func_warning "\`-no-install' is ignored for $host" func_warning "assuming \`-no-fast-install' instead" fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) func_stripname '-R' '' "$arg" dir=$func_stripname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; =*) func_stripname '=' '' "$dir" dir=$lt_sysroot$func_stripname_result ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac continue ;; -shared) # The effects of -shared are defined in a previous loop. continue ;; -shrext) prev=shrext continue ;; -static | -static-libtool-libs) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -weak) prev=weak continue ;; -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" func_quote_for_eval "$flag" func_append arg " $func_quote_for_eval_result" func_append compiler_flags " $func_quote_for_eval_result" done IFS="$save_ifs" func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Wl,*) func_stripname '-Wl,' '' "$arg" args=$func_stripname_result arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" func_quote_for_eval "$flag" func_append arg " $wl$func_quote_for_eval_result" func_append compiler_flags " $wl$func_quote_for_eval_result" func_append linker_flags " $func_quote_for_eval_result" done IFS="$save_ifs" func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # -msg_* for osf cc -msg_*) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; # Flags to be passed through unchanged, with rationale: # -64, -mips[0-9] enable 64-bit mode for the SGI compiler # -r[0-9][0-9]* specify processor for the SGI compiler # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler # +DA*, +DD* enable 64-bit mode for the HP compiler # -q* compiler args for the IBM compiler # -m*, -t[45]*, -txscale* architecture-specific flags for GCC # -F/path path to uninstalled frameworks, gcc on darwin # -p, -pg, --coverage, -fprofile-* profiling flags for GCC # @file GCC response files # -tp=* Portland pgcc target processor selection # --sysroot=* for sysroot support # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ -O*|-flto*|-fwhopr*|-fuse-linker-plugin) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" func_append compile_command " $arg" func_append finalize_command " $arg" func_append compiler_flags " $arg" continue ;; # Some other compiler flag. -* | +*) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; *.$objext) # A standard object. func_append objs " $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "\`$arg' is not a valid libtool object" fi fi ;; *.$libext) # An archive. func_append deplibs " $arg" func_append old_deplibs " $arg" continue ;; *.la) # A libtool-controlled library. func_resolve_sysroot "$arg" if test "$prev" = dlfiles; then # This library was specified with -dlopen. func_append dlfiles " $func_resolve_sysroot_result" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. func_append dlprefiles " $func_resolve_sysroot_result" prev= else func_append deplibs " $func_resolve_sysroot_result" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then func_append compile_command " $arg" func_append finalize_command " $arg" fi done # argument parsing loop test -n "$prev" && \ func_fatal_help "the \`$prevarg' option requires an argument" if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" func_append compile_command " $arg" func_append finalize_command " $arg" fi oldlibs= # calculate the name of the file, without its directory func_basename "$output" outputname="$func_basename_result" libobjs_save="$libobjs" if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" func_dirname "$output" "/" "" output_objdir="$func_dirname_result$objdir" func_to_tool_file "$output_objdir/" tool_output_objdir=$func_to_tool_file_result # Create the object directory. func_mkdir_p "$output_objdir" # Determine the type of output case $output in "") func_fatal_help "you must specify an output file" ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if $opt_preserve_dup_deps ; then case "$libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append libs " $deplib" done if test "$linkmode" = lib; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if $opt_duplicate_compiler_generated_deps; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; esac func_append pre_post_deps " $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries notinst_path= # paths that contain not-installed libtool libraries case $linkmode in lib) passes="conv dlpreopen link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=no newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do # The preopen pass in lib mode reverses $deplibs; put it back here # so that -L comes before libs that need it for instance... if test "$linkmode,$pass" = "lib,link"; then ## FIXME: Find the place where the list is rebuilt in the wrong ## order, and fix it there properly tmp_deplibs= for deplib in $deplibs; do tmp_deplibs="$deplib $tmp_deplibs" done deplibs="$tmp_deplibs" fi if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan"; then libs="$deplibs" deplibs= fi if test "$linkmode" = prog; then case $pass in dlopen) libs="$dlfiles" ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS%" test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" ;; esac fi if test "$linkmode,$pass" = "lib,dlpreopen"; then # Collect and forward deplibs of preopened libtool libs for lib in $dlprefiles; do # Ignore non-libtool-libs dependency_libs= func_resolve_sysroot "$lib" case $lib in *.la) func_source "$func_resolve_sysroot_result" ;; esac # Collect preopened libtool deplibs, except any this library # has declared as weak libs for deplib in $dependency_libs; do func_basename "$deplib" deplib_base=$func_basename_result case " $weak_libs " in *" $deplib_base "*) ;; *) func_append deplibs " $deplib" ;; esac done done libs="$dlprefiles" fi if test "$pass" = dlopen; then # Collect dlpreopened libraries save_deplibs="$deplibs" deplibs= fi for deplib in $libs; do lib= found=no case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append compiler_flags " $deplib" if test "$linkmode" = lib ; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -l*) if test "$linkmode" != lib && test "$linkmode" != prog; then func_warning "\`-l' is ignored for archives/objects" continue fi func_stripname '-l' '' "$deplib" name=$func_stripname_result if test "$linkmode" = lib; then searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" else searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" fi for searchdir in $searchdirs; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib="$searchdir/lib${name}${search_ext}" if test -f "$lib"; then if test "$search_ext" = ".la"; then found=yes else found=no fi break 2 fi done done if test "$found" != yes; then # deplib doesn't seem to be a libtool library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue else # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $deplib "*) if func_lalib_p "$lib"; then library_names= old_library= func_source "$lib" for l in $old_library $library_names; do ll="$l" done if test "X$ll" = "X$old_library" ; then # only static version available found=no func_dirname "$lib" "" "." ladir="$func_dirname_result" lib=$ladir/$old_library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi fi ;; # -l *.ltframework) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" if test "$linkmode" = lib ; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; prog) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi if test "$pass" = scan; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; *) func_warning "\`-L' is ignored for archives/objects" ;; esac # linkmode continue ;; # -L -R*) if test "$pass" = link; then func_stripname '-R' '' "$deplib" func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) func_resolve_sysroot "$deplib" lib=$func_resolve_sysroot_result ;; *.$libext) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) # Linking convenience modules into shared libraries is allowed, # but linking other static libraries is non-portable. case " $dlpreconveniencelibs " in *" $deplib "*) ;; *) valid_a_lib=no case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=yes fi ;; pass_all) valid_a_lib=yes ;; esac if test "$valid_a_lib" != yes; then echo $ECHO "*** Warning: Trying to link with static lib archive $deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because the file extensions .$libext of this argument makes me believe" echo "*** that it is just a static archive that I should not use here." else echo $ECHO "*** Warning: Linking the shared library $output against the" $ECHO "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi ;; esac continue ;; prog) if test "$pass" != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test "$pass" = conv; then deplibs="$deplib $deplibs" elif test "$linkmode" = prog; then if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. func_append newdlprefiles " $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append newdlfiles " $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=yes continue ;; esac # case $deplib if test "$found" = yes || test -f "$lib"; then : else func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" fi # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$lib" \ || func_fatal_error "\`$lib' is not a valid libtool archive" func_dirname "$lib" "" "." ladir="$func_dirname_result" dlname= dlopen= dlpreopen= libdir= library_names= old_library= inherited_linker_flags= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no avoidtemprpath= # Read the .la file func_source "$lib" # Convert "-framework foo" to "foo.ltframework" if test -n "$inherited_linker_flags"; then tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do case " $new_inherited_linker_flags " in *" $tmp_inherited_linker_flag "*) ;; *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; esac done fi dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" != prog && test "$linkmode" != lib; }; then test -n "$dlopen" && func_append dlfiles " $dlopen" test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" fi if test "$pass" = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # It is a libtool convenience library, so add in its objects. func_append convenience " $ladir/$objdir/$old_library" func_append old_convenience " $ladir/$objdir/$old_library" tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if $opt_preserve_dup_deps ; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done elif test "$linkmode" != prog && test "$linkmode" != lib; then func_fatal_error "\`$lib' is not a convenience library" fi continue fi # $pass = conv # Get the name of the library we link against. linklib= if test -n "$old_library" && { test "$prefer_static_libs" = yes || test "$prefer_static_libs,$installed" = "built,no"; }; then linklib=$old_library else for l in $old_library $library_names; do linklib="$l" done fi if test -z "$linklib"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # This library was specified with -dlopen. if test "$pass" = dlopen; then if test -z "$libdir"; then func_fatal_error "cannot -dlopen a convenience library: \`$lib'" fi if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. func_append dlprefiles " $lib $dependency_libs" else func_append newdlfiles " $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then func_warning "cannot determine absolute directory name of \`$ladir'" func_warning "passing it literally to the linker, although it might fail" abs_ladir="$ladir" fi ;; esac func_basename "$lib" laname="$func_basename_result" # Find the relevant object directory and library name. if test "X$installed" = Xyes; then if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then func_warning "library \`$lib' was moved." dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else dir="$lt_sysroot$libdir" absdir="$lt_sysroot$libdir" fi test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir="$ladir" absdir="$abs_ladir" # Remove this search path later func_append notinst_path " $abs_ladir" else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later func_append notinst_path " $abs_ladir" fi fi # $installed = yes func_stripname 'lib' '.la' "$laname" name=$func_stripname_result # This library was specified with -dlpreopen. if test "$pass" = dlpreopen; then if test -z "$libdir" && test "$linkmode" = prog; then func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" fi case "$host" in # special handling for platforms with PE-DLLs. *cygwin* | *mingw* | *cegcc* ) # Linker will automatically link against shared library if both # static and shared are present. Therefore, ensure we extract # symbols from the import library if a shared library is present # (otherwise, the dlopen module name will be incorrect). We do # this by putting the import library name into $newdlprefiles. # We recover the dlopen module name by 'saving' the la file # name in a special purpose variable, and (later) extracting the # dlname from the la file. if test -n "$dlname"; then func_tr_sh "$dir/$linklib" eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" func_append newdlprefiles " $dir/$linklib" else func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" fi ;; * ) # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then func_append newdlprefiles " $dir/$dlname" else func_append newdlprefiles " $dir/$linklib" fi ;; esac fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test "$linkmode" = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test "$linkmode" = prog && test "$pass" != link; then func_append newlib_search_path " $ladir" deplibs="$lib $deplibs" linkalldeplibs=no if test "$link_all_deplibs" != no || test -z "$library_names" || test "$build_libtool_libs" = no; then linkalldeplibs=yes fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; esac # Need to link against all dependency_libs? if test "$linkalldeplibs" = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if $opt_preserve_dup_deps ; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done # for deplib continue fi # $linkmode = prog... if test "$linkmode,$pass" = "prog,link"; then if test -n "$library_names" && { { test "$prefer_static_libs" = no || test "$prefer_static_libs,$installed" = "built,yes"; } || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then # Make sure the rpath contains only unique directories. case "$temp_rpath:" in *"$absdir:"*) ;; *) func_append temp_rpath "$absdir:" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && { test "$deplibs_check_method" = pass_all || { test "$build_libtool_libs" = yes && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically use_static_libs=$prefer_static_libs if test "$use_static_libs" = built && test "$installed" = yes; then use_static_libs=no fi if test -n "$library_names" && { test "$use_static_libs" = no || test -z "$old_library"; }; then case $host in *cygwin* | *mingw* | *cegcc*) # No point in relinking DLLs because paths are not encoded func_append notinst_deplibs " $lib" need_relink=no ;; *) if test "$installed" = no; then func_append notinst_deplibs " $lib" need_relink=yes fi ;; esac # This is a shared library # Warn about portability, can't link against -module's on some # systems (darwin). Don't bleat about dlopened modules though! dlopenmodule="" for dlpremoduletest in $dlprefiles; do if test "X$dlpremoduletest" = "X$lib"; then dlopenmodule="$dlpremoduletest" break fi done if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then echo if test "$linkmode" = prog; then $ECHO "*** Warning: Linking the executable $output against the loadable module" else $ECHO "*** Warning: Linking the shared library $output against the loadable module" fi $ECHO "*** $linklib is not portable!" fi if test "$linkmode" = lib && test "$hardcode_into_libs" = yes; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names shift realname="$1" shift libname=`eval "\\$ECHO \"$libname_spec\""` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname="$dlname" elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw* | *cegcc*) func_arith $current - $age major=$func_arith_result versuffix="-$major" ;; esac eval soname=\"$soname_spec\" else soname="$realname" fi # Make a new name for the extract_expsyms_cmds to use soroot="$soname" func_basename "$soroot" soname="$func_basename_result" func_stripname 'lib' '.dll' "$soname" newlib=libimp-$func_stripname_result.a # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else func_verbose "extracting exported symbol list from \`$soname'" func_execute_cmds "$extract_expsyms_cmds" 'exit $?' fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else func_verbose "generating import library for \`$soname'" func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test "$linkmode" = prog || test "$opt_mode" != relink; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" case $host in *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; *-*-sysv4*uw2*) add_dir="-L$dir" ;; *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ *-*-unixware7*) add_dir="-L$dir" ;; *-*-darwin* ) # if the lib is a (non-dlopened) module then we can not # link against it, someone is ignoring the earlier warnings if /usr/bin/file -L $add 2> /dev/null | $GREP ": [^:]* bundle" >/dev/null ; then if test "X$dlopenmodule" != "X$lib"; then $ECHO "*** Warning: lib $linklib is a module, not a shared library" if test -z "$old_library" ; then echo echo "*** And there doesn't seem to be a static archive available" echo "*** The link will probably fail, sorry" else add="$dir/$old_library" fi elif test -n "$old_library"; then add="$dir/$old_library" fi fi esac elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; esac add_dir="-L$dir" add="-l$name" elif test "$hardcode_shlibpath_var" = no; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; relink) if test "$hardcode_direct" = yes && test "$hardcode_direct_absolute" = no; then add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$absdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; *) lib_linked=no ;; esac if test "$lib_linked" != yes; then func_fatal_configuration "unsupported hardcode properties" fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) func_append compile_shlibpath "$add_shlibpath:" ;; esac fi if test "$linkmode" = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test "$hardcode_direct" != yes && test "$hardcode_minus_L" != yes && test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac fi fi fi if test "$linkmode" = prog || test "$opt_mode" = relink; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes && test "$hardcode_direct_absolute" = no; then add="$libdir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$libdir" add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac add="-l$name" elif test "$hardcode_automatic" = yes; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then add="$inst_prefix_dir$libdir/$linklib" else add="$libdir/$linklib" fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" fi if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test "$linkmode" = prog; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test "$build_libtool_libs" = yes; then # Not a shared library if test "$deplibs_check_method" != pass_all; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. echo $ECHO "*** Warning: This system can not link to static lib archive $lib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then echo "*** But as you try to build a module library, libtool will still create " echo "*** a static module, that should work as long as the dlopening application" echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using \`nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test "$linkmode" = lib; then if test -n "$dependency_libs" && { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) func_stripname '-R' '' "$libdir" temp_xrpath=$func_stripname_result case " $xrpath " in *" $temp_xrpath "*) ;; *) func_append xrpath " $temp_xrpath";; esac;; *) func_append temp_deplibs " $libdir";; esac done dependency_libs="$temp_deplibs" fi func_append newlib_search_path " $absdir" # Link against this library test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result";; *) func_resolve_sysroot "$deplib" ;; esac if $opt_preserve_dup_deps ; then case "$tmp_libs " in *" $func_resolve_sysroot_result "*) func_append specialdeplibs " $func_resolve_sysroot_result" ;; esac fi func_append tmp_libs " $func_resolve_sysroot_result" done if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do path= case $deplib in -L*) path="$deplib" ;; *.la) func_resolve_sysroot "$deplib" deplib=$func_resolve_sysroot_result func_dirname "$deplib" "" "." dir=$func_dirname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then func_warning "cannot determine absolute directory name of \`$dir'" absdir="$dir" fi ;; esac if $GREP "^installed=no" $deplib > /dev/null; then case $host in *-*-darwin*) depdepl= eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names" ; then for tmp in $deplibrary_names ; do depdepl=$tmp done if test -f "$absdir/$objdir/$depdepl" ; then depdepl="$absdir/$objdir/$depdepl" darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` if test -z "$darwin_install_name"; then darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` fi func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}" path= fi fi ;; *) path="-L$absdir/$objdir" ;; esac else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" test "$absdir" != "$libdir" && \ func_warning "\`$deplib' seems to be moved" path="-L$absdir" fi ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$path $deplibs" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs if test "$pass" = link; then if test "$linkmode" = "prog"; then compile_deplibs="$new_inherited_linker_flags $compile_deplibs" finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" else compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` fi fi dependency_libs="$newdependency_libs" if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test "$pass" != dlopen; then if test "$pass" != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) func_append lib_search_path " $dir" ;; esac done newlib_search_path= fi if test "$linkmode,$pass" != "prog,link"; then vars="deplibs" else vars="compile_deplibs finalize_deplibs" fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) func_append tmp_libs " $deplib" ;; esac ;; *) func_append tmp_libs " $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs ; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i="" ;; esac if test -n "$i" ; then func_append tmp_libs " $i" fi done dependency_libs=$tmp_libs done # for pass if test "$linkmode" = prog; then dlfiles="$newdlfiles" fi if test "$linkmode" = prog || test "$linkmode" = lib; then dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for archives" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "\`-l' and \`-L' are ignored for archives" ;; esac test -n "$rpath" && \ func_warning "\`-rpath' is ignored for archives" test -n "$xrpath" && \ func_warning "\`-R' is ignored for archives" test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for archives" test -n "$release" && \ func_warning "\`-release' is ignored for archives" test -n "$export_symbols$export_symbols_regex" && \ func_warning "\`-export-symbols' is ignored for archives" # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" func_append objs "$old_deplibs" ;; lib) # Make sure we only generate libraries of the form `libNAME.la'. case $outputname in lib*) func_stripname 'lib' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) test "$module" = no && \ func_fatal_help "libtool library \`$output' must begin with \`lib'" if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required func_stripname '' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else func_stripname '' '.la' "$outputname" libname=$func_stripname_result fi ;; esac if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" else echo $ECHO "*** Warning: Linking the shared library $output against the non-libtool" $ECHO "*** objects $objs is not portable!" func_append libobjs " $objs" fi fi test "$dlself" != no && \ func_warning "\`-dlopen self' is ignored for libtool libraries" set dummy $rpath shift test "$#" -gt 1 && \ func_warning "ignoring multiple \`-rpath's for a libtool library" install_libdir="$1" oldlibs= if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. # Some compilers have problems with a `.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for convenience libraries" test -n "$release" && \ func_warning "\`-release' is ignored for convenience libraries" else # Parse the version information argument. save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 shift IFS="$save_ifs" test -n "$7" && \ func_fatal_help "too many parameters to \`-version-info'" # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major="$1" number_minor="$2" number_revision="$3" # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # which has an extra 1 added just for fun # case $version_type in # correct linux to gnu/linux during the next big refactor darwin|linux|osf|windows|none) func_arith $number_major + $number_minor current=$func_arith_result age="$number_minor" revision="$number_revision" ;; freebsd-aout|freebsd-elf|qnx|sunos) current="$number_major" revision="$number_minor" age="0" ;; irix|nonstopux) func_arith $number_major + $number_minor current=$func_arith_result age="$number_minor" revision="$number_minor" lt_irix_increment=no ;; *) func_fatal_configuration "$modename: unknown library version type \`$version_type'" ;; esac ;; no) current="$1" revision="$2" age="$3" ;; esac # Check that each of the things are valid numbers. case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "CURRENT \`$current' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "REVISION \`$revision' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "AGE \`$age' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac if test "$age" -gt "$current"; then func_error "AGE \`$age' is greater than the current interface number \`$current'" func_fatal_error "\`$vinfo' is not valid version information" fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header func_arith $current - $age major=.$func_arith_result versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... func_arith $current + 1 minor_current=$func_arith_result xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" ;; freebsd-aout) major=".$current" versuffix=".$current.$revision"; ;; freebsd-elf) major=".$current" versuffix=".$current" ;; irix | nonstopux) if test "X$lt_irix_increment" = "Xno"; then func_arith $current - $age else func_arith $current - $age + 1 fi major=$func_arith_result case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring="$verstring_prefix$major.$revision" # Add in all the interfaces that we are compatible with. loop=$revision while test "$loop" -ne 0; do func_arith $revision - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring="$verstring_prefix$major.$iface:$verstring" done # Before this point, $major must not contain `.'. major=.$major versuffix="$major.$revision" ;; linux) # correct to gnu/linux during the next big refactor func_arith $current - $age major=.$func_arith_result versuffix="$major.$age.$revision" ;; osf) func_arith $current - $age major=.$func_arith_result versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" # Add in all the interfaces that we are compatible with. loop=$age while test "$loop" -ne 0; do func_arith $current - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring="$verstring:${iface}.0" done # Make executables depend on our current version. func_append verstring ":${current}.0" ;; qnx) major=".$current" versuffix=".$current" ;; sunos) major=".$current" versuffix=".$current.$revision" ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 filesystems. func_arith $current - $age major=$func_arith_result versuffix="-$major" ;; *) func_fatal_configuration "unknown library version type \`$version_type'" ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring="0.0" ;; esac if test "$need_version" = no; then versuffix= else versuffix=".0.0" fi fi # Remove version info from name if versioning should be avoided if test "$avoid_version" = yes && test "$need_version" = no; then major= versuffix= verstring="" fi # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then func_warning "undefined symbols not allowed in $host shared libraries" build_libtool_libs=no build_old_libs=yes fi else # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi fi func_generate_dlsyms "$libname" "$libname" "yes" func_append libobjs " $symfileobj" test "X$libobjs" = "X " && libobjs= if test "$opt_mode" != relink; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$ECHO "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext | *.gcno) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) if test "X$precious_files_regex" != "X"; then if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi func_append removelist " $p" ;; *) ;; esac done test -n "$removelist" && \ func_show_eval "${RM}r \$removelist" fi # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then func_append oldlibs " $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` fi # Eliminate all temporary directories. #for path in $notinst_path; do # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` #done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do func_replace_sysroot "$libdir" func_append temp_xrpath " -R$func_replace_sysroot_result" case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles="$dlfiles" dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) func_append dlfiles " $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles="$dlprefiles" dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) func_append dlprefiles " $lib" ;; esac done if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework func_append deplibs " System.ltframework" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work ;; *) # Add libc to deplibs on all other systems if necessary. if test "$build_libtool_need_lc" = "yes"; then func_append deplibs " -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release="" versuffix="" major="" newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $opt_dry_run || $RM conftest.c cat > conftest.c </dev/null` $nocaseglob else potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` fi for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null | $GREP " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib="$potent_lib" while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | $SED -e 10q | $EGREP "$file_magic_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $ECHO "*** with $libname but no candidates were found. (...for file magic test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a file magic. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` for a_deplib in $deplibs; do case $a_deplib in -l*) func_stripname -l '' "$a_deplib" name=$func_stripname_result if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) func_append newdeplibs " $a_deplib" a_deplib="" ;; esac fi if test -n "$a_deplib" ; then libname=`eval "\\$ECHO \"$libname_spec\""` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib="$potent_lib" # see symlink-check above in file_magic test if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ $EGREP "$match_pattern_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a regex pattern. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then for i in $predeps $postdeps ; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` done fi case $tmp_deplibs in *[!\ \ ]*) echo if test "X$deplibs_check_method" = "Xnone"; then echo "*** Warning: inter-library dependencies are not supported in this platform." else echo "*** Warning: inter-library dependencies are not known to be supported." fi echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes ;; esac ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library with the System framework newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac if test "$droppeddeps" = yes; then if test "$module" = yes; then echo echo "*** Warning: libtool could not satisfy all declared inter-library" $ECHO "*** dependencies of module $libname. Therefore, libtool will create" echo "*** a static module, that should work as long as the dlopening" echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using \`nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else echo "*** The inter-library dependencies that have been dropped here will be" echo "*** automatically added whenever a program is linked with this library" echo "*** or is declared to -dlopen it." if test "$allow_undefined" = no; then echo echo "*** Since this library must not contain undefined symbols," echo "*** because either the platform does not support them or" echo "*** it was explicitly requested with -no-undefined," echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" case $host in *-*-darwin*) newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done deplibs="$new_libs" # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then # Remove ${wl} instances when linking with ld. # FIXME: should test the right _cmds variable. case $archive_cmds in *\$LD\ *) wl= ;; esac if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" test "$opt_mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then func_replace_sysroot "$libdir" libdir=$func_replace_sysroot_result if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append dep_rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath="$finalize_shlibpath" test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names shift realname="$1" shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname="$realname" fi if test -z "$dlname"; then dlname=$soname fi lib="$output_objdir/$realname" linknames= for link do func_append linknames " $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` test "X$libobjs" = "X " && libobjs= delfiles= if test -n "$export_symbols" && test -n "$include_expsyms"; then $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" export_symbols="$output_objdir/$libname.uexp" func_append delfiles " $export_symbols" fi orig_export_symbols= case $host_os in cygwin* | mingw* | cegcc*) if test -n "$export_symbols" && test -z "$export_symbols_regex"; then # exporting using user supplied symfile if test "x`$SED 1q $export_symbols`" != xEXPORTS; then # and it's NOT already a .def file. Must figure out # which of the given symbols are data symbols and tag # them as such. So, trigger use of export_symbols_cmds. # export_symbols gets reassigned inside the "prepare # the list of exported symbols" if statement, so the # include_expsyms logic still works. orig_export_symbols="$export_symbols" export_symbols= always_export_symbols=yes fi fi ;; esac # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then func_verbose "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $opt_dry_run || $RM $export_symbols cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' for cmd1 in $cmds; do IFS="$save_ifs" # Take the normal branch if the nm_file_list_spec branch # doesn't work or if tool conversion is not needed. case $nm_file_list_spec~$to_tool_file_cmd in *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) try_normal_branch=yes eval cmd=\"$cmd1\" func_len " $cmd" len=$func_len_result ;; *) try_normal_branch=no ;; esac if test "$try_normal_branch" = yes \ && { test "$len" -lt "$max_cmd_len" \ || test "$max_cmd_len" -le -1; } then func_show_eval "$cmd" 'exit $?' skipped_export=false elif test -n "$nm_file_list_spec"; then func_basename "$output" output_la=$func_basename_result save_libobjs=$libobjs save_output=$output output=${output_objdir}/${output_la}.nm func_to_tool_file "$output" libobjs=$nm_file_list_spec$func_to_tool_file_result func_append delfiles " $output" func_verbose "creating $NM input file list: $output" for obj in $save_libobjs; do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > "$output" eval cmd=\"$cmd1\" func_show_eval "$cmd" 'exit $?' output=$save_output libobjs=$save_libobjs skipped_export=false else # The command line is too long to execute in one step. func_verbose "using reloadable object file for export list..." skipped_export=: # Break out early, otherwise skipped_export may be # set to false by a later but shorter cmd. break fi done IFS="$save_ifs" if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols="$export_symbols" test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) func_append tmp_deplibs " $test_deplib" ;; esac done deplibs="$tmp_deplibs" if test -n "$convenience"; then if test -n "$whole_archive_flag_spec" && test "$compiler_needs_object" = yes && test -z "$libobjs"; then # extract the archives, so we have objects to list. # TODO: could optimize this to just extract one archive. whole_archive_flag_spec= fi if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= else gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $convenience func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" func_append linker_flags " $flag" fi # Make a backup of the uninstalled library when relinking if test "$opt_mode" = relink; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test "X$skipped_export" != "X:" && func_len " $test_cmds" && len=$func_len_result && test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise # or, if using GNU ld and skipped_export is not :, use a linker # script. # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output func_basename "$output" output_la=$func_basename_result # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= last_robj= k=1 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then output=${output_objdir}/${output_la}.lnkscript func_verbose "creating GNU ld script: $output" echo 'INPUT (' > $output for obj in $save_libobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done echo ')' >> $output func_append delfiles " $output" func_to_tool_file "$output" output=$func_to_tool_file_result elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then output=${output_objdir}/${output_la}.lnk func_verbose "creating linker input file list: $output" : > $output set x $save_libobjs shift firstobj= if test "$compiler_needs_object" = yes; then firstobj="$1 " shift fi for obj do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done func_append delfiles " $output" func_to_tool_file "$output" output=$firstobj\"$file_list_spec$func_to_tool_file_result\" else if test -n "$save_libobjs"; then func_verbose "creating reloadable object files..." output=$output_objdir/$output_la-${k}.$objext eval test_cmds=\"$reload_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 # Loop over the list of objects to be linked. for obj in $save_libobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result if test "X$objlist" = X || test "$len" -lt "$max_cmd_len"; then func_append objlist " $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test "$k" -eq 1 ; then # The first file doesn't have a previous command to add. reload_objs=$objlist eval concat_cmds=\"$reload_cmds\" else # All subsequent reloadable object files will link in # the last one created. reload_objs="$objlist $last_robj" eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" fi last_robj=$output_objdir/$output_la-${k}.$objext func_arith $k + 1 k=$func_arith_result output=$output_objdir/$output_la-${k}.$objext objlist=" $obj" func_len " $last_robj" func_arith $len0 + $func_len_result len=$func_arith_result fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ reload_objs="$objlist $last_robj" eval concat_cmds=\"\${concat_cmds}$reload_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" fi func_append delfiles " $output" else output= fi if ${skipped_export-false}; then func_verbose "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $opt_dry_run || $RM $export_symbols libobjs=$output # Append the command to create the export file. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" fi fi test -n "$save_libobjs" && func_verbose "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs="$IFS"; IFS='~' for cmd in $concat_cmds; do IFS="$save_ifs" $opt_silent || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$opt_mode" = relink; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS="$save_ifs" if test -n "$export_symbols_regex" && ${skipped_export-false}; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi if ${skipped_export-false}; then if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols="$export_symbols" test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi fi libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi fi if test -n "$delfiles"; then # Append the command to remove temporary files to $cmds. eval cmds=\"\$cmds~\$RM $delfiles\" fi # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $opt_silent || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$opt_mode" = relink; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS="$save_ifs" # Restore the uninstalled library and exit if test "$opt_mode" = relink; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then func_show_eval '${RM}r "$gentop"' fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' fi done # If -module or -export-dynamic was specified, set the dlname. if test "$module" = yes || test "$export_dynamic" = yes; then # On all known operating systems, these are identical. dlname="$soname" fi fi ;; obj) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for objects" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "\`-l' and \`-L' are ignored for objects" ;; esac test -n "$rpath" && \ func_warning "\`-rpath' is ignored for objects" test -n "$xrpath" && \ func_warning "\`-R' is ignored for objects" test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for objects" test -n "$release" && \ func_warning "\`-release' is ignored for objects" case $output in *.lo) test -n "$objs$old_deplibs" && \ func_fatal_error "cannot build library object \`$output' from non-libtool objects" libobj=$output func_lo2o "$libobj" obj=$func_lo2o_result ;; *) libobj= obj="$output" ;; esac # Delete the old objects. $opt_dry_run || $RM $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # reload_cmds runs $LD directly, so let us get rid of # -Wl from whole_archive_flag_spec and hope we can get by with # turning comma into space.. wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` else gentop="$output_objdir/${obj}x" func_append generated " $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # If we're not building shared, we need to use non_pic_objs test "$build_libtool_libs" != yes && libobjs="$non_pic_objects" # Create the old-style object. reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" func_execute_cmds "$reload_cmds" 'exit $?' # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS fi if test "$build_libtool_libs" != yes; then if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" func_execute_cmds "$reload_cmds" 'exit $?' fi if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) func_stripname '' '.exe' "$output" output=$func_stripname_result.exe;; esac test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for programs" test -n "$release" && \ func_warning "\`-release' is ignored for programs" test "$preload" = yes \ && test "$dlopen_support" = unknown \ && test "$dlopen_self" = unknown \ && test "$dlopen_self_static" = unknown && \ func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac case $host in *-*-darwin*) # Don't allow lazy linking, it breaks C++ global constructors # But is supposedly fixed on 10.4 or later (yay!). if test "$tagname" = CXX ; then case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 10.[0123]) func_append compile_command " ${wl}-bind_at_load" func_append finalize_command " ${wl}-bind_at_load" ;; esac fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $compile_deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $compile_deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done compile_deplibs="$new_libs" func_append compile_command " $compile_deplibs" func_append finalize_command " $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$libdir:"*) ;; ::) dllsearchpath=$libdir;; *) func_append dllsearchpath ":$libdir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath="$rpath" rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) func_append finalize_perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath="$rpath" if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` fi func_generate_dlsyms "$outputname" "@PROGRAM@" "no" # template prelinking step if test -n "$prelink_cmds"; then func_execute_cmds "$prelink_cmds" 'exit $?' fi wrappers_required=yes case $host in *cegcc* | *mingw32ce*) # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. wrappers_required=no ;; *cygwin* | *mingw* ) if test "$build_libtool_libs" != yes; then wrappers_required=no fi ;; *) if test "$need_relink" = no || test "$build_libtool_libs" != yes; then wrappers_required=no fi ;; esac if test "$wrappers_required" = no; then # Replace the output file specification. compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. exit_status=0 func_show_eval "$link_command" 'exit_status=$?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Delete the generated files. if test -f "$output_objdir/${outputname}S.${objext}"; then func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' fi exit $exit_status fi if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do func_append rpath "$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test "$no_install" = yes; then # We don't need to create a wrapper script. link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $opt_dry_run || $RM $output # Link the executable and exit func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi exit $EXIT_SUCCESS fi if test "$hardcode_action" = relink; then # Fast installation is not supported link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" func_warning "this platform does not like uninstalled shared libraries" func_warning "\`$output' will be relinked during installation" else if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` else # fast_install is set to needless relink_command= fi else link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" fi fi # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output_objdir/$outputname" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Now create the wrapper script. func_verbose "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` fi # Only actually do things if not in dry run mode. $opt_dry_run || { # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) func_stripname '' '.exe' "$output" output=$func_stripname_result ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe func_stripname '' '.exe' "$outputname" outputname=$func_stripname_result ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) func_dirname_and_basename "$output" "" "." output_name=$func_basename_result output_path=$func_dirname_result cwrappersource="$output_path/$objdir/lt-$output_name.c" cwrapper="$output_path/$output_name.exe" $RM $cwrappersource $cwrapper trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 func_emit_cwrapperexe_src > $cwrappersource # The wrapper executable is built using the $host compiler, # because it contains $host paths and files. If cross- # compiling, it, like the target executable, must be # executed on the $host or under an emulation environment. $opt_dry_run || { $LTCC $LTCFLAGS -o $cwrapper $cwrappersource $STRIP $cwrapper } # Now, create the wrapper script for func_source use: func_ltwrapper_scriptname $cwrapper $RM $func_ltwrapper_scriptname_result trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 $opt_dry_run || { # note: this script will not be executed, so do not chmod. if test "x$build" = "x$host" ; then $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result else func_emit_wrapper no > $func_ltwrapper_scriptname_result fi } ;; * ) $RM $output trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 func_emit_wrapper no > $output chmod +x $output ;; esac } exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do if test "$build_libtool_libs" = convenience; then oldobjs="$libobjs_save $symfileobj" addlibs="$convenience" build_libtool_libs=no else if test "$build_libtool_libs" = module; then oldobjs="$libobjs_save" build_libtool_libs=no else oldobjs="$old_deplibs $non_pic_objects" if test "$preload" = yes && test -f "$symfileobj"; then func_append oldobjs " $symfileobj" fi fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $addlibs func_append oldobjs " $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append oldobjs " $func_extract_archives_result" fi # POSIX demands no paths to be encoded in archives. We have # to avoid creating archives with duplicate basenames if we # might have to extract them afterwards, e.g., when creating a # static archive out of a convenience library, or when linking # the entirety of a libtool archive into another (currently # not supported by libtool). if (for obj in $oldobjs do func_basename "$obj" $ECHO "$func_basename_result" done | sort | sort -uc >/dev/null 2>&1); then : else echo "copying selected object files to avoid basename conflicts..." gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_mkdir_p "$gentop" save_oldobjs=$oldobjs oldobjs= counter=1 for obj in $save_oldobjs do func_basename "$obj" objbase="$func_basename_result" case " $oldobjs " in " ") oldobjs=$obj ;; *[\ /]"$objbase "*) while :; do # Make sure we don't pick an alternate name that also # overlaps. newobj=lt$counter-$objbase func_arith $counter + 1 counter=$func_arith_result case " $oldobjs " in *[\ /]"$newobj "*) ;; *) if test ! -f "$gentop/$newobj"; then break; fi ;; esac done func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" func_append oldobjs " $gentop/$newobj" ;; *) func_append oldobjs " $obj" ;; esac done fi func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result eval cmds=\"$old_archive_cmds\" func_len " $cmds" len=$func_len_result if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds elif test -n "$archiver_list_spec"; then func_verbose "using command file archive linking..." for obj in $oldobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > $output_objdir/$libname.libcmd func_to_tool_file "$output_objdir/$libname.libcmd" oldobjs=" $archiver_list_spec$func_to_tool_file_result" cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts func_verbose "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs oldobjs= # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done eval test_cmds=\"$old_archive_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 for obj in $save_oldobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result func_append objlist " $obj" if test "$len" -lt "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj" ; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" objlist= len=$len0 fi done RANLIB=$save_RANLIB oldobjs=$objlist if test "X$oldobjs" = "X" ; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi func_execute_cmds "$cmds" 'exit $?' done test -n "$generated" && \ func_show_eval "${RM}r$generated" # Now create the libtool archive. case $output in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" func_verbose "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` if test "$hardcode_automatic" = yes ; then relink_command= fi # Only create the output if not a dry run. $opt_dry_run || { for installed in no yes; do if test "$installed" = yes; then if test -z "$install_libdir"; then break fi output="$output_objdir/$outputname"i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) func_basename "$deplib" name="$func_basename_result" func_resolve_sysroot "$deplib" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" ;; -L*) func_stripname -L '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -L$func_replace_sysroot_result" ;; -R*) func_stripname -R '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -R$func_replace_sysroot_result" ;; *) func_append newdependency_libs " $deplib" ;; esac done dependency_libs="$newdependency_libs" newdlfiles= for lib in $dlfiles; do case $lib in *.la) func_basename "$lib" name="$func_basename_result" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" ;; *) func_append newdlfiles " $lib" ;; esac done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in *.la) # Only pass preopened files to the pseudo-archive (for # eventual linking with the app. that links it) if we # didn't already link the preopened objects directly into # the library: func_basename "$lib" name="$func_basename_result" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" ;; esac done dlprefiles="$newdlprefiles" else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlfiles " $abs" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlprefiles " $abs" done dlprefiles="$newdlprefiles" fi $RM $output # place dlname in correct position for cygwin # In fact, it would be nice if we could use this code for all target # systems that can't hard-code library paths into their executables # and that have no shared library path variable independent of PATH, # but it turns out we can't easily determine that from inspecting # libtool variables, so we have to hard-code the OSs to which it # applies here; at the moment, that means platforms that use the PE # object format with DLL files. See the long comment at the top of # tests/bindir.at for full details. tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) # If a -bindir argument was supplied, place the dll there. if test "x$bindir" != x ; then func_relative_path "$install_libdir" "$bindir" tdlname=$func_relative_path_result$dlname else # Otherwise fall back on heuristic. tdlname=../bin/$dlname fi ;; esac $ECHO > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Linker flags that can not go in dependency_libs. inherited_linker_flags='$new_inherited_linker_flags' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Names of additional weak libraries provided by this library weak_library_names='$weak_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test "$installed" = no && test "$need_relink" = yes; then $ECHO >> $output "\ relink_command=\"$relink_command\"" fi done } # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' ;; esac exit $EXIT_SUCCESS } { test "$opt_mode" = link || test "$opt_mode" = relink; } && func_mode_link ${1+"$@"} # func_mode_uninstall arg... func_mode_uninstall () { $opt_debug RM="$nonopt" files= rmforce= exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" for arg do case $arg in -f) func_append RM " $arg"; rmforce=yes ;; -*) func_append RM " $arg" ;; *) func_append files " $arg" ;; esac done test -z "$RM" && \ func_fatal_help "you must specify an RM program" rmdirs= for file in $files; do func_dirname "$file" "" "." dir="$func_dirname_result" if test "X$dir" = X.; then odir="$objdir" else odir="$dir/$objdir" fi func_basename "$file" name="$func_basename_result" test "$opt_mode" = uninstall && odir="$dir" # Remember odir for removal later, being careful to avoid duplicates if test "$opt_mode" = clean; then case " $rmdirs " in *" $odir "*) ;; *) func_append rmdirs " $odir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if { test -L "$file"; } >/dev/null 2>&1 || { test -h "$file"; } >/dev/null 2>&1 || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif test "$rmforce" = yes; then continue fi rmfiles="$file" case $name in *.la) # Possibly a libtool archive, so verify it. if func_lalib_p "$file"; then func_source $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do func_append rmfiles " $odir/$n" done test -n "$old_library" && func_append rmfiles " $odir/$old_library" case "$opt_mode" in clean) case " $library_names " in *" $dlname "*) ;; *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; esac test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" ;; uninstall) if test -n "$library_names"; then # Do each command in the postuninstall commands. func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' fi # FIXME: should reinstall the best remaining shared library. ;; esac fi ;; *.lo) # Possibly a libtool object, so verify it. if func_lalib_p "$file"; then # Read the .lo file func_source $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" && test "$pic_object" != none; then func_append rmfiles " $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" && test "$non_pic_object" != none; then func_append rmfiles " $dir/$non_pic_object" fi fi ;; *) if test "$opt_mode" = clean ; then noexename=$name case $file in *.exe) func_stripname '' '.exe' "$file" file=$func_stripname_result func_stripname '' '.exe' "$name" noexename=$func_stripname_result # $file with .exe has already been added to rmfiles, # add $file without .exe func_append rmfiles " $file" ;; esac # Do a test to see if this is a libtool program. if func_ltwrapper_p "$file"; then if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" relink_command= func_source $func_ltwrapper_scriptname_result func_append rmfiles " $func_ltwrapper_scriptname_result" else relink_command= func_source $dir/$noexename fi # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles func_append rmfiles " $odir/$name $odir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then func_append rmfiles " $odir/lt-$name" fi if test "X$noexename" != "X$name" ; then func_append rmfiles " $odir/lt-${noexename}.c" fi fi fi ;; esac func_show_eval "$RM $rmfiles" 'exit_status=1' done # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then func_show_eval "rmdir $dir >/dev/null 2>&1" fi done exit $exit_status } { test "$opt_mode" = uninstall || test "$opt_mode" = clean; } && func_mode_uninstall ${1+"$@"} test -z "$opt_mode" && { help="$generic_help" func_fatal_help "you must specify a MODE" } test -z "$exec_cmd" && \ func_fatal_help "invalid operation mode \`$opt_mode'" if test -n "$exec_cmd"; then eval exec "$exec_cmd" exit $EXIT_FAILURE fi exit $exit_status # The TAGs below are defined such that we never get into a situation # in which we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared build_libtool_libs=no build_old_libs=yes # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: # vi:sw=2 modsecurity-apache_2.7.7/build/apxs-wrapper.in0000775000175000017500000000054712243422537021730 0ustar zimmerlezimmerle#!@SHELL@ WRAPPED_OPTS="" for opt in "$@"; do case "$opt" in # Fix for -R not working w/apxs -R*) WRAPPED_OPTS="$WRAPPED_OPTS -Wl,$opt" ;; # OSF1 compiler option -pthread) WRAPPED_OPTS="$WRAPPED_OPTS -Wc,$opt" ;; # Unwrapped *) WRAPPED_OPTS="$WRAPPED_OPTS $opt" ;; esac done exec @APXS@ $WRAPPED_OPTS modsecurity-apache_2.7.7/build/find_pcre.m40000664000175000017500000000465612243422537021144 0ustar zimmerlezimmerlednl Check for PCRE Libraries dnl CHECK_PCRE(ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]) dnl Sets: dnl PCRE_CFLAGS dnl PCRE_LIBS PCRE_CONFIG="" PCRE_VERSION="" PCRE_CPPFLAGS="" PCRE_CFLAGS="" PCRE_LDFLAGS="" PCRE_LDADD="" PCRE_LD_PATH="" AC_DEFUN([CHECK_PCRE], [dnl AC_ARG_WITH( pcre, [AC_HELP_STRING([--with-pcre=PATH],[Path to pcre prefix or config script])], [test_paths="${with_pcre}"], [test_paths="/usr/local/libpcre /usr/local/pcre /usr/local /opt/libpcre /opt/pcre /opt /usr"]) AC_MSG_CHECKING([for libpcre config script]) dnl # Determine pcre lib directory if test -z "${with_pcre}"; then test_paths="/usr/local/pcre /usr/local /usr" else test_paths="${with_pcre}" fi for x in ${test_paths}; do dnl # Determine if the script was specified and use it directly if test ! -d "$x" -a -e "$x"; then PCRE_CONFIG=$x pcre_path="no" break fi dnl # Try known config script names/locations for PCRE_CONFIG in pcre-config; do if test -e "${x}/bin/${PCRE_CONFIG}"; then pcre_path="${x}/bin" break elif test -e "${x}/${PCRE_CONFIG}"; then pcre_path="${x}" break else pcre_path="" fi done if test -n "$pcre_path"; then break fi done if test -n "${pcre_path}"; then if test "${pcre_path}" != "no"; then PCRE_CONFIG="${pcre_path}/${PCRE_CONFIG}" fi AC_MSG_RESULT([${PCRE_CONFIG}]) PCRE_VERSION="`${PCRE_CONFIG} --version`" if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(pcre VERSION: $PCRE_VERSION); fi PCRE_CFLAGS="`${PCRE_CONFIG} --cflags`" if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(pcre CFLAGS: $PCRE_CFLAGS); fi PCRE_LDADD="`${PCRE_CONFIG} --libs`" if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(pcre LDADD: $PCRE_LDADD); fi PCRE_LD_PATH="/`${PCRE_CONFIG} --libs | cut -d'/' -f2,3,4,5,6 | cut -d ' ' -f1`" if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(pcre PCRE_LD_PATH: $PCRE_LD_PATH); fi else AC_MSG_RESULT([no]) fi AC_SUBST(PCRE_CONFIG) AC_SUBST(PCRE_VERSION) AC_SUBST(PCRE_CPPFLAGS) AC_SUBST(PCRE_CFLAGS) AC_SUBST(PCRE_LDFLAGS) AC_SUBST(PCRE_LDADD) AC_SUBST(PCRE_LD_PATH) if test -z "${PCRE_VERSION}"; then AC_MSG_NOTICE([*** pcre library not found.]) ifelse([$2], , AC_MSG_ERROR([pcre library is required]), $2) else AC_MSG_NOTICE([using pcre v${PCRE_VERSION}]) ifelse([$1], , , $1) fi ]) modsecurity-apache_2.7.7/build/ar-lib0000755000175000017500000001330212254306021020016 0ustar zimmerlezimmerle#! /bin/sh # Wrapper for Microsoft lib.exe me=ar-lib scriptversion=2012-03-01.08; # UTC # Copyright (C) 2010-2013 Free Software Foundation, Inc. # Written by Peter Rosin . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . # func_error message func_error () { echo "$me: $1" 1>&2 exit 1 } file_conv= # func_file_conv build_file # Convert a $build file to $host form and store it in $file # Currently only supports Windows hosts. func_file_conv () { file=$1 case $file in / | /[!/]*) # absolute file, and not a UNC file if test -z "$file_conv"; then # lazily determine how to convert abs files case `uname -s` in MINGW*) file_conv=mingw ;; CYGWIN*) file_conv=cygwin ;; *) file_conv=wine ;; esac fi case $file_conv in mingw) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; cygwin) file=`cygpath -m "$file" || echo "$file"` ;; wine) file=`winepath -w "$file" || echo "$file"` ;; esac ;; esac } # func_at_file at_file operation archive # Iterate over all members in AT_FILE performing OPERATION on ARCHIVE # for each of them. # When interpreting the content of the @FILE, do NOT use func_file_conv, # since the user would need to supply preconverted file names to # binutils ar, at least for MinGW. func_at_file () { operation=$2 archive=$3 at_file_contents=`cat "$1"` eval set x "$at_file_contents" shift for member do $AR -NOLOGO $operation:"$member" "$archive" || exit $? done } case $1 in '') func_error "no command. Try '$0 --help' for more information." ;; -h | --h*) cat <&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) dst_arg=$2 # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) no_target_directory=true;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call 'install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names problematic for 'test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else # Prefer dirname, but fall back on a substitute if dirname fails. dstdir=` (dirname "$dst") 2>/dev/null || expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$dst" : 'X\(//\)[^/]' \| \ X"$dst" : 'X\(//\)$' \| \ X"$dst" : 'X\(/\)' \| . 2>/dev/null || echo X"$dst" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q' ` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 if (umask $mkdir_umask && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/d" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; [-=\(\)!]*) prefix='./';; *) prefix='';; esac eval "$initialize_posix_glob" oIFS=$IFS IFS=/ $posix_glob set -f set fnord $dstdir shift $posix_glob set +f IFS=$oIFS prefixes= for d do test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && eval "$initialize_posix_glob" && $posix_glob set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && $posix_glob set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: modsecurity-apache_2.7.7/build/find_lua.m40000664000175000017500000001350012252374144020760 0ustar zimmerlezimmerlednl Check for LUA Libraries dnl CHECK_LUA(ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]) dnl Sets: dnl LUA_CFLAGS dnl LUA_LIBS AC_DEFUN([CHECK_LUA], [dnl AC_REQUIRE([PKG_PROG_PKG_CONFIG]) LUA_CONFIG="" LUA_VERSION="" LUA_CFLAGS="" LUA_CPPFLAGS="" LUA_LDADD="" LUA_LDFLAGS="" LUA_CONFIG=${PKG_CONFIG} LUA_PKGNAMES="lua5.1 lua-5.1 lua_5.1 lua-51 lua_51 lua51 lua5 lua" LUA_SONAMES="so la sl dll dylib" AC_ARG_WITH( lua, [AC_HELP_STRING([--with-lua=PATH],[Path to lua prefix or config script])] ,, with_lua=yes) AS_CASE(["${with_lua}"], [no], [test_paths=], [yes], [test_paths="/usr/local/liblua /usr/local/lua /usr/local /opt/liblua /opt/lua /opt /usr"], [test_paths="${with_lua}"]) AS_IF([test "x${test_paths}" != "x"], [ AC_MSG_CHECKING([for liblua config script]) for x in ${test_paths}; do dnl # Determine if the script was specified and use it directly if test ! -d "$x" -a -e "$x"; then LUA_CONFIG=$x break fi dnl # Try known config script names/locations for y in $LUA_CONFIG; do if test -e "${x}/bin/${y}"; then LUA_CONFIG="${x}/bin/${y}" lua_config="${LUA_CONFIG}" break elif test -e "${x}/${y}"; then LUA_CONFIG="${x}/${y}" lua_config="${LUA_CONFIG}" break fi done if test -n "${lua_config}"; then break fi done dnl # Try known package names if test -n "${LUA_CONFIG}"; then LUA_PKGNAME="" for x in ${LUA_PKGNAMES}; do if ${LUA_CONFIG} --exists ${x}; then LUA_PKGNAME="$x" break fi done fi if test -n "${LUA_PKGNAME}"; then AC_MSG_RESULT([${LUA_CONFIG}]) LUA_VERSION="`${LUA_CONFIG} ${LUA_PKGNAME} --modversion`" if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(lua VERSION: $LUA_VERSION); fi LUA_CFLAGS="`${LUA_CONFIG} ${LUA_PKGNAME} --cflags`" if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(lua CFLAGS: $LUA_CFLAGS); fi LUA_LDADD="`${LUA_CONFIG} ${LUA_PKGNAME} --libs-only-l`" if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(lua LDADD: $LUA_LDADD); fi LUA_LDFLAGS="`${LUA_CONFIG} ${LUA_PKGNAME} --libs-only-L --libs-only-other`" if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(lua LDFLAGS: $LUA_LDFLAGS); fi else AC_MSG_RESULT([no]) dnl Hack to just try to find the lib and include AC_MSG_CHECKING([for lua install]) for x in ${test_paths}; do for y in ${LUA_SONAMES}; do if test -e "${x}/liblua5.1.${y}"; then lua_lib_path="${x}" lua_lib_name="lua5.1" break elif test -e "${x}/lib/liblua5.1.${y}"; then lua_lib_path="${x}/lib" lua_lib_name="lua5.1" break elif test -e "${x}/lib64/liblua5.1.${y}"; then lua_lib_path="${x}/lib64" lua_lib_name="lua5.1" break elif test -e "${x}/lib32/liblua5.1.${y}"; then lua_lib_path="${x}/lib32" lua_lib_name="lua5.1" break elif test -e "${x}/liblua51.${y}"; then lua_lib_path="${x}" lua_lib_name="lua51" break elif test -e "${x}/lib/liblua51.${y}"; then lua_lib_path="${x}/lib" lua_lib_name="lua51" break elif test -e "${x}/lib64/liblua51.${y}"; then lua_lib_path="${x}/lib64" lua_lib_name="lua51" break elif test -e "${x}/lib32/liblua51.${y}"; then lua_lib_path="${x}/lib32" lua_lib_name="lua51" break elif test -e "${x}/liblua.${y}"; then lua_lib_path="${x}" lua_lib_name="lua" break elif test -e "${x}/lib/liblua.${y}"; then lua_lib_path="${x}/lib" lua_lib_name="lua" break elif test -e "${x}/lib64/liblua.${y}"; then lua_lib_path="${x}/lib64" lua_lib_name="lua" break elif test -e "${x}/lib32/liblua.${y}"; then lua_lib_path="${x}/lib32" lua_lib_name="lua" break else lua_lib_path="" lua_lib_name="" fi done if test -n "$lua_lib_path"; then break fi done for x in ${test_paths}; do if test -e "${x}/include/lua.h"; then lua_inc_path="${x}/include" break elif test -e "${x}/lua.h"; then lua_inc_path="${x}" break fi dnl # Check some sub-paths as well for lua_pkg_name in ${lua_lib_name} ${LUA_PKGNAMES}; do if test -e "${x}/include/${lua_pkg_name}/lua.h"; then lua_inc_path="${x}/include" break elif test -e "${x}/${lua_pkg_name}/lua.h"; then lua_inc_path="${x}" break else lua_inc_path="" fi done if test -n "$lua_inc_path"; then break fi done if test -n "${lua_lib_path}" -a -n "${lua_inc_path}"; then LUA_CONFIG="" AC_MSG_RESULT([${lua_lib_path} ${lua_inc_path}]) LUA_VERSION="5.1" LUA_CFLAGS="-I${lua_inc_path}" LUA_LDADD="-l${lua_lib_name}" LUA_LDFLAGS="-L${lua_lib_path}" else LUA_VERSION="" AC_MSG_RESULT([no]) fi fi ]) AC_SUBST(LUA_CFLAGS) AC_SUBST(LUA_LDADD) AC_SUBST(LUA_LDFLAGS) if test -z "${LUA_VERSION}"; then ifelse([$2], , AC_MSG_NOTICE([optional lua library not found]), $2) else AC_MSG_NOTICE([using lua v${LUA_VERSION}]) LUA_CFLAGS="-DWITH_LUA ${LUA_CFLAGS}" ifelse([$1], , , $1) fi ]) modsecurity-apache_2.7.7/build/ltversion.m40000644000175000017500000000126212254306004021214 0ustar zimmerlezimmerle# ltversion.m4 -- version numbers -*- Autoconf -*- # # Copyright (C) 2004 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # @configure_input@ # serial 3337 ltversion.m4 # This file is part of GNU Libtool m4_define([LT_PACKAGE_VERSION], [2.4.2]) m4_define([LT_PACKAGE_REVISION], [1.3337]) AC_DEFUN([LTVERSION_VERSION], [macro_version='2.4.2' macro_revision='1.3337' _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) _LT_DECL(, macro_revision, 0) ]) modsecurity-apache_2.7.7/build/compile0000775000175000017500000000717312243422537020324 0ustar zimmerlezimmerle#! /bin/sh # Wrapper for compilers which do not understand `-c -o'. scriptversion=2005-05-14.22 # Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . case $1 in '') echo "$0: No command. Try \`$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: compile [--help] [--version] PROGRAM [ARGS] Wrapper for compilers which do not understand `-c -o'. Remove `-o dest.o' from ARGS, run PROGRAM with the remaining arguments, and rename the output as expected. If you are trying to build a whole package this is not the right script to run: please start by reading the file `INSTALL'. Report bugs to . EOF exit $? ;; -v | --v*) echo "compile $scriptversion" exit $? ;; esac ofile= cfile= eat= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as `compile cc -o foo foo.c'. # So we strip `-o arg' only if arg is an object. eat=1 case $2 in *.o | *.obj) ofile=$2 ;; *) set x "$@" -o "$2" shift ;; esac ;; *.c) cfile=$1 set x "$@" "$1" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -z "$ofile" || test -z "$cfile"; then # If no `-o' option was seen then we might have been invoked from a # pattern rule where we don't need one. That is ok -- this is a # normal compilation that the losing compiler can handle. If no # `.c' file was seen then we are probably linking. That is also # ok. exec "$@" fi # Name of file we expect compiler to create. cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'` # Create the lock directory. # Note: use `[/.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d while true; do if mkdir "$lockdir" >/dev/null 2>&1; then break fi sleep 1 done # FIXME: race condition here if user kills between mkdir and trap. trap "rmdir '$lockdir'; exit 1" 1 2 15 # Run the compile. "$@" ret=$? if test -f "$cofile"; then mv "$cofile" "$ofile" elif test -f "${cofile}bj"; then mv "${cofile}bj" "$ofile" fi rmdir "$lockdir" exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: modsecurity-apache_2.7.7/build/depcomp0000755000175000017500000005601612254306021020310 0ustar zimmerlezimmerle#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2013-05-30.07; # UTC # Copyright (C) 1999-2013 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by 'PROGRAMS ARGS'. object Object file output by 'PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputting dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac # Get the directory component of the given path, and save it in the # global variables '$dir'. Note that this directory component will # be either empty or ending with a '/' character. This is deliberate. set_dir_from () { case $1 in */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; *) dir=;; esac } # Get the suffix-stripped basename of the given path, and save it the # global variable '$base'. set_base_from () { base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` } # If no dependency file was actually created by the compiler invocation, # we still have to create a dummy depfile, to avoid errors with the # Makefile "include basename.Plo" scheme. make_dummy_depfile () { echo "#dummy" > "$depfile" } # Factor out some common post-processing of the generated depfile. # Requires the auxiliary global variable '$tmpdepfile' to be set. aix_post_process_depfile () { # If the compiler actually managed to produce a dependency file, # post-process it. if test -f "$tmpdepfile"; then # Each line is of the form 'foo.o: dependency.h'. # Do two passes, one to just change these to # $object: dependency.h # and one to simply output # dependency.h: # which is needed to avoid the deleted-header problem. { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" } > "$depfile" rm -f "$tmpdepfile" else make_dummy_depfile fi } # A tabulation character. tab=' ' # A newline character. nl=' ' # Character ranges might be problematic outside the C locale. # These definitions help. upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ lower=abcdefghijklmnopqrstuvwxyz digits=0123456789 alpha=${upper}${lower} if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Avoid interferences from the environment. gccflag= dashmflag= # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvisualcpp fi if test "$depmode" = msvc7msys; then # This is just like msvc7 but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvc7 fi if test "$depmode" = xlc; then # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. gccflag=-qmakedep=gcc,-MF depmode=gcc fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. ## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. ## (see the conditional assignment to $gccflag above). ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). Also, it might not be ## supported by the other compilers which use the 'gcc' depmode. ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The second -e expression handles DOS-style file names with drive # letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the "deleted header file" problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. ## Some versions of gcc put a space before the ':'. On the theory ## that the space means something, we add a space to the output as ## well. hp depmode also adds that space, but also prefixes the VPATH ## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like '#:fec' to the end of the # dependency line. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ | tr "$nl" ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" ;; xlc) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts '$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done aix_post_process_depfile ;; tcc) # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 # FIXME: That version still under development at the moment of writing. # Make that this statement remains true also for stable, released # versions. # It will wrap lines (doesn't matter whether long or short) with a # trailing '\', as in: # # foo.o : \ # foo.c \ # foo.h \ # # It will put a trailing '\' even on the last line, and will use leading # spaces rather than leading tabs (at least since its commit 0394caf7 # "Emit spaces for -MD"). "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. # We have to change lines of the first kind to '$object: \'. sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" # And for each line of the second kind, we have to emit a 'dep.h:' # dummy dependency, to avoid the deleted-header problem. sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" rm -f "$tmpdepfile" ;; ## The order of this option in the case statement is important, since the ## shell code in configure will try each of these formats in the order ## listed in this file. A plain '-MD' option would be understood by many ## compilers, so we must ensure this comes after the gcc and icc options. pgcc) # Portland's C compiler understands '-MD'. # Will always output deps to 'file.d' where file is the root name of the # source file under compilation, even if file resides in a subdirectory. # The object file name does not affect the name of the '.d' file. # pgcc 10.2 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using '\' : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... set_dir_from "$object" # Use the source, not the object, to determine the base name, since # that's sadly what pgcc will do too. set_base_from "$source" tmpdepfile=$base.d # For projects that build the same source file twice into different object # files, the pgcc approach of using the *source* file root name can cause # problems in parallel builds. Use a locking strategy to avoid stomping on # the same $tmpdepfile. lockdir=$base.d-lock trap " echo '$0: caught signal, cleaning up...' >&2 rmdir '$lockdir' exit 1 " 1 2 13 15 numtries=100 i=$numtries while test $i -gt 0; do # mkdir is a portable test-and-set. if mkdir "$lockdir" 2>/dev/null; then # This process acquired the lock. "$@" -MD stat=$? # Release the lock. rmdir "$lockdir" break else # If the lock is being held by a different process, wait # until the winning process is done or we timeout. while test -d "$lockdir" && test $i -gt 0; do sleep 1 i=`expr $i - 1` done fi i=`expr $i - 1` done trap - 1 2 13 15 if test $i -le 0; then echo "$0: failed to acquire lock after $numtries attempts" >&2 echo "$0: check lockdir '$lockdir'" >&2 exit 1 fi if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" # Add 'dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in 'foo.d' instead, so we check for that too. # Subdirectories are respected. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then # Libtool generates 2 separate objects for the 2 libraries. These # two compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir$base.o.d # libtool 1.5 tmpdepfile2=$dir.libs/$base.o.d # Likewise. tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d "$@" -MD fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done # Same post-processing that is required for AIX mode. aix_post_process_depfile ;; msvc7) if test "$libtool" = yes; then showIncludes=-Wc,-showIncludes else showIncludes=-showIncludes fi "$@" $showIncludes > "$tmpdepfile" stat=$? grep -v '^Note: including file: ' "$tmpdepfile" if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The first sed program below extracts the file names and escapes # backslashes for cygpath. The second sed program outputs the file # name when reading, but also accumulates all include files in the # hold buffer in order to output them again at the end. This only # works with sed implementations that can handle large buffers. sed < "$tmpdepfile" -n ' /^Note: including file: *\(.*\)/ { s//\1/ s/\\/\\\\/g p }' | $cygpath_u | sort -u | sed -n ' s/ /\\ /g s/\(.*\)/'"$tab"'\1 \\/p s/.\(.*\) \\/\1:/ H $ { s/.*/'"$tab"'/ G p }' >> "$depfile" echo >> "$depfile" # make sure the fragment doesn't end with a backslash rm -f "$tmpdepfile" ;; msvc7msys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for ':' # in the target name. This is to cope with DOS-style filenames: # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. "$@" $dashmflag | sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this sed invocation # correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" # makedepend may prepend the VPATH from the source file name to the object. # No need to regex-escape $object, excess matching of '.' is harmless. sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process the last invocation # correctly. Breaking it into two sed invocations is a workaround. sed '1,2d' "$tmpdepfile" \ | tr ' ' "$nl" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E \ | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" echo "$tab" >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: modsecurity-apache_2.7.7/build/libtool.m40000644000175000017500000106000712254306003020635 0ustar zimmerlezimmerle# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. m4_define([_LT_COPYING], [dnl # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. # # GNU Libtool is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License, or (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, or # obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ]) # serial 57 LT_INIT # LT_PREREQ(VERSION) # ------------------ # Complain and exit if this libtool version is less that VERSION. m4_defun([LT_PREREQ], [m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, [m4_default([$3], [m4_fatal([Libtool version $1 or higher is required], 63)])], [$2])]) # _LT_CHECK_BUILDDIR # ------------------ # Complain if the absolute build directory name contains unusual characters m4_defun([_LT_CHECK_BUILDDIR], [case `pwd` in *\ * | *\ *) AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; esac ]) # LT_INIT([OPTIONS]) # ------------------ AC_DEFUN([LT_INIT], [AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl AC_BEFORE([$0], [LT_LANG])dnl AC_BEFORE([$0], [LT_OUTPUT])dnl AC_BEFORE([$0], [LTDL_INIT])dnl m4_require([_LT_CHECK_BUILDDIR])dnl dnl Autoconf doesn't catch unexpanded LT_ macros by default: m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 dnl unless we require an AC_DEFUNed macro: AC_REQUIRE([LTOPTIONS_VERSION])dnl AC_REQUIRE([LTSUGAR_VERSION])dnl AC_REQUIRE([LTVERSION_VERSION])dnl AC_REQUIRE([LTOBSOLETE_VERSION])dnl m4_require([_LT_PROG_LTMAIN])dnl _LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) dnl Parse OPTIONS _LT_SET_OPTIONS([$0], [$1]) # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ltmain" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' AC_SUBST(LIBTOOL)dnl _LT_SETUP # Only expand once: m4_define([LT_INIT]) ])# LT_INIT # Old names: AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PROG_LIBTOOL], []) dnl AC_DEFUN([AM_PROG_LIBTOOL], []) # _LT_CC_BASENAME(CC) # ------------------- # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. m4_defun([_LT_CC_BASENAME], [for cc_temp in $1""; do case $cc_temp in compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` ]) # _LT_FILEUTILS_DEFAULTS # ---------------------- # It is okay to use these file commands and assume they have been set # sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'. m4_defun([_LT_FILEUTILS_DEFAULTS], [: ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} ])# _LT_FILEUTILS_DEFAULTS # _LT_SETUP # --------- m4_defun([_LT_SETUP], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl _LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl dnl _LT_DECL([], [host_alias], [0], [The host system])dnl _LT_DECL([], [host], [0])dnl _LT_DECL([], [host_os], [0])dnl dnl _LT_DECL([], [build_alias], [0], [The build system])dnl _LT_DECL([], [build], [0])dnl _LT_DECL([], [build_os], [0])dnl dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl dnl AC_REQUIRE([AC_PROG_LN_S])dnl test -z "$LN_S" && LN_S="ln -s" _LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl dnl AC_REQUIRE([LT_CMD_MAX_LEN])dnl _LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl _LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl m4_require([_LT_CMD_RELOAD])dnl m4_require([_LT_CHECK_MAGIC_METHOD])dnl m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl m4_require([_LT_CMD_OLD_ARCHIVE])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_WITH_SYSROOT])dnl _LT_CONFIG_LIBTOOL_INIT([ # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi ]) if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi _LT_CHECK_OBJDIR m4_require([_LT_TAG_COMPILER])dnl case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld="$lt_cv_prog_gnu_ld" old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o _LT_CC_BASENAME([$compiler]) # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then _LT_PATH_MAGIC fi ;; esac # Use C for the default configuration in the libtool script LT_SUPPORTED_TAG([CC]) _LT_LANG_C_CONFIG _LT_LANG_DEFAULT_CONFIG _LT_CONFIG_COMMANDS ])# _LT_SETUP # _LT_PREPARE_SED_QUOTE_VARS # -------------------------- # Define a few sed substitution that help us do robust quoting. m4_defun([_LT_PREPARE_SED_QUOTE_VARS], [# Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\([["`\\]]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ]) # _LT_PROG_LTMAIN # --------------- # Note that this code is called both from `configure', and `config.status' # now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, # `config.status' has no value for ac_aux_dir unless we are using Automake, # so we pass a copy along to make sure it has a sensible value anyway. m4_defun([_LT_PROG_LTMAIN], [m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl _LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) ltmain="$ac_aux_dir/ltmain.sh" ])# _LT_PROG_LTMAIN ## ------------------------------------- ## ## Accumulate code for creating libtool. ## ## ------------------------------------- ## # So that we can recreate a full libtool script including additional # tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS # in macros and then make a single call at the end using the `libtool' # label. # _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) # ---------------------------------------- # Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL_INIT], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_INIT], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_INIT]) # _LT_CONFIG_LIBTOOL([COMMANDS]) # ------------------------------ # Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) # _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) # ----------------------------------------------------- m4_defun([_LT_CONFIG_SAVE_COMMANDS], [_LT_CONFIG_LIBTOOL([$1]) _LT_CONFIG_LIBTOOL_INIT([$2]) ]) # _LT_FORMAT_COMMENT([COMMENT]) # ----------------------------- # Add leading comment marks to the start of each line, and a trailing # full-stop to the whole comment if one is not present already. m4_define([_LT_FORMAT_COMMENT], [m4_ifval([$1], [ m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) )]) ## ------------------------ ## ## FIXME: Eliminate VARNAME ## ## ------------------------ ## # _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) # ------------------------------------------------------------------- # CONFIGNAME is the name given to the value in the libtool script. # VARNAME is the (base) name used in the configure script. # VALUE may be 0, 1 or 2 for a computed quote escaped value based on # VARNAME. Any other value will be used directly. m4_define([_LT_DECL], [lt_if_append_uniq([lt_decl_varnames], [$2], [, ], [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], [m4_ifval([$1], [$1], [$2])]) lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) m4_ifval([$4], [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) lt_dict_add_subkey([lt_decl_dict], [$2], [tagged?], [m4_ifval([$5], [yes], [no])])]) ]) # _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) # -------------------------------------------------------- m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) # lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_tag_varnames], [_lt_decl_filter([tagged?], [yes], $@)]) # _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) # --------------------------------------------------------- m4_define([_lt_decl_filter], [m4_case([$#], [0], [m4_fatal([$0: too few arguments: $#])], [1], [m4_fatal([$0: too few arguments: $#: $1])], [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], [lt_dict_filter([lt_decl_dict], $@)])[]dnl ]) # lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) # -------------------------------------------------- m4_define([lt_decl_quote_varnames], [_lt_decl_filter([value], [1], $@)]) # lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_dquote_varnames], [_lt_decl_filter([value], [2], $@)]) # lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_varnames_tagged], [m4_assert([$# <= 2])dnl _$0(m4_quote(m4_default([$1], [[, ]])), m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) m4_define([_lt_decl_varnames_tagged], [m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) # lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_all_varnames], [_$0(m4_quote(m4_default([$1], [[, ]])), m4_if([$2], [], m4_quote(lt_decl_varnames), m4_quote(m4_shift($@))))[]dnl ]) m4_define([_lt_decl_all_varnames], [lt_join($@, lt_decl_varnames_tagged([$1], lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl ]) # _LT_CONFIG_STATUS_DECLARE([VARNAME]) # ------------------------------------ # Quote a variable value, and forward it to `config.status' so that its # declaration there will have the same value as in `configure'. VARNAME # must have a single quote delimited value for this to work. m4_define([_LT_CONFIG_STATUS_DECLARE], [$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) # _LT_CONFIG_STATUS_DECLARATIONS # ------------------------------ # We delimit libtool config variables with single quotes, so when # we write them to config.status, we have to be sure to quote all # embedded single quotes properly. In configure, this macro expands # each variable declared with _LT_DECL (and _LT_TAGDECL) into: # # ='`$ECHO "$" | $SED "$delay_single_quote_subst"`' m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], [m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAGS # ---------------- # Output comment and list of tags supported by the script m4_defun([_LT_LIBTOOL_TAGS], [_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl available_tags="_LT_TAGS"dnl ]) # _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) # ----------------------------------- # Extract the dictionary values for VARNAME (optionally with TAG) and # expand to a commented shell variable setting: # # # Some comment about what VAR is for. # visible_name=$lt_internal_name m4_define([_LT_LIBTOOL_DECLARE], [_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [description])))[]dnl m4_pushdef([_libtool_name], m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), [0], [_libtool_name=[$]$1], [1], [_libtool_name=$lt_[]$1], [2], [_libtool_name=$lt_[]$1], [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl ]) # _LT_LIBTOOL_CONFIG_VARS # ----------------------- # Produce commented declarations of non-tagged libtool config variables # suitable for insertion in the LIBTOOL CONFIG section of the `libtool' # script. Tagged libtool config variables (even for the LIBTOOL CONFIG # section) are produced by _LT_LIBTOOL_TAG_VARS. m4_defun([_LT_LIBTOOL_CONFIG_VARS], [m4_foreach([_lt_var], m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAG_VARS(TAG) # ------------------------- m4_define([_LT_LIBTOOL_TAG_VARS], [m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) # _LT_TAGVAR(VARNAME, [TAGNAME]) # ------------------------------ m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) # _LT_CONFIG_COMMANDS # ------------------- # Send accumulated output to $CONFIG_STATUS. Thanks to the lists of # variables for single and double quote escaping we saved from calls # to _LT_DECL, we can put quote escaped variables declarations # into `config.status', and then the shell code to quote escape them in # for loops in `config.status'. Finally, any additional code accumulated # from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. m4_defun([_LT_CONFIG_COMMANDS], [AC_PROVIDE_IFELSE([LT_OUTPUT], dnl If the libtool generation code has been placed in $CONFIG_LT, dnl instead of duplicating it all over again into config.status, dnl then we will have config.status run $CONFIG_LT later, so it dnl needs to know what name is stored there: [AC_CONFIG_COMMANDS([libtool], [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], dnl If the libtool generation code is destined for config.status, dnl expand the accumulated commands and init code now: [AC_CONFIG_COMMANDS([libtool], [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) ])#_LT_CONFIG_COMMANDS # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], [ # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' _LT_CONFIG_STATUS_DECLARATIONS LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$[]1 _LTECHO_EOF' } # Quote evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_quote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_dquote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done _LT_OUTPUT_LIBTOOL_INIT ]) # _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) # ------------------------------------ # Generate a child script FILE with all initialization necessary to # reuse the environment learned by the parent script, and make the # file executable. If COMMENT is supplied, it is inserted after the # `#!' sequence but before initialization text begins. After this # macro, additional text can be appended to FILE to form the body of # the child script. The macro ends with non-zero status if the # file could not be fully written (such as if the disk is full). m4_ifdef([AS_INIT_GENERATED], [m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], [m4_defun([_LT_GENERATED_FILE_INIT], [m4_require([AS_PREPARE])]dnl [m4_pushdef([AS_MESSAGE_LOG_FD])]dnl [lt_write_fail=0 cat >$1 <<_ASEOF || lt_write_fail=1 #! $SHELL # Generated by $as_me. $2 SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$1 <<\_ASEOF || lt_write_fail=1 AS_SHELL_SANITIZE _AS_PREPARE exec AS_MESSAGE_FD>&1 _ASEOF test $lt_write_fail = 0 && chmod +x $1[]dnl m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT # LT_OUTPUT # --------- # This macro allows early generation of the libtool script (before # AC_OUTPUT is called), incase it is used in configure for compilation # tests. AC_DEFUN([LT_OUTPUT], [: ${CONFIG_LT=./config.lt} AC_MSG_NOTICE([creating $CONFIG_LT]) _LT_GENERATED_FILE_INIT(["$CONFIG_LT"], [# Run this file to recreate a libtool stub with the current configuration.]) cat >>"$CONFIG_LT" <<\_LTEOF lt_cl_silent=false exec AS_MESSAGE_LOG_FD>>config.log { echo AS_BOX([Running $as_me.]) } >&AS_MESSAGE_LOG_FD lt_cl_help="\ \`$as_me' creates a local libtool stub from the current configuration, for use in further configure time tests before the real libtool is generated. Usage: $[0] [[OPTIONS]] -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files Report bugs to ." lt_cl_version="\ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) configured by $[0], generated by m4_PACKAGE_STRING. Copyright (C) 2011 Free Software Foundation, Inc. This config.lt script is free software; the Free Software Foundation gives unlimited permision to copy, distribute and modify it." while test $[#] != 0 do case $[1] in --version | --v* | -V ) echo "$lt_cl_version"; exit 0 ;; --help | --h* | -h ) echo "$lt_cl_help"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --quiet | --q* | --silent | --s* | -q ) lt_cl_silent=: ;; -*) AC_MSG_ERROR([unrecognized option: $[1] Try \`$[0] --help' for more information.]) ;; *) AC_MSG_ERROR([unrecognized argument: $[1] Try \`$[0] --help' for more information.]) ;; esac shift done if $lt_cl_silent; then exec AS_MESSAGE_FD>/dev/null fi _LTEOF cat >>"$CONFIG_LT" <<_LTEOF _LT_OUTPUT_LIBTOOL_COMMANDS_INIT _LTEOF cat >>"$CONFIG_LT" <<\_LTEOF AC_MSG_NOTICE([creating $ofile]) _LT_OUTPUT_LIBTOOL_COMMANDS AS_EXIT(0) _LTEOF chmod +x "$CONFIG_LT" # configure is writing to config.log, but config.lt does its own redirection, # appending to config.log, which fails on DOS, as config.log is still kept # open by configure. Here we exec the FD to /dev/null, effectively closing # config.log, so it can be properly (re)opened and appended to by config.lt. lt_cl_success=: test "$silent" = yes && lt_config_lt_args="$lt_config_lt_args --quiet" exec AS_MESSAGE_LOG_FD>/dev/null $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false exec AS_MESSAGE_LOG_FD>>config.log $lt_cl_success || AS_EXIT(1) ])# LT_OUTPUT # _LT_CONFIG(TAG) # --------------- # If TAG is the built-in tag, create an initial libtool script with a # default configuration from the untagged config vars. Otherwise add code # to config.status for appending the configuration named by TAG from the # matching tagged config vars. m4_defun([_LT_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_CONFIG_SAVE_COMMANDS([ m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl m4_if(_LT_TAG, [C], [ # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi cfgfile="${ofile}T" trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # _LT_COPYING _LT_LIBTOOL_TAGS # ### BEGIN LIBTOOL CONFIG _LT_LIBTOOL_CONFIG_VARS _LT_LIBTOOL_TAG_VARS # ### END LIBTOOL CONFIG _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac _LT_PROG_LTMAIN # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) _LT_PROG_REPLACE_SHELLFNS mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ], [cat <<_LT_EOF >> "$ofile" dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded dnl in a comment (ie after a #). # ### BEGIN LIBTOOL TAG CONFIG: $1 _LT_LIBTOOL_TAG_VARS(_LT_TAG) # ### END LIBTOOL TAG CONFIG: $1 _LT_EOF ])dnl /m4_if ], [m4_if([$1], [], [ PACKAGE='$PACKAGE' VERSION='$VERSION' TIMESTAMP='$TIMESTAMP' RM='$RM' ofile='$ofile'], []) ])dnl /_LT_CONFIG_SAVE_COMMANDS ])# _LT_CONFIG # LT_SUPPORTED_TAG(TAG) # --------------------- # Trace this macro to discover what tags are supported by the libtool # --tag option, using: # autoconf --trace 'LT_SUPPORTED_TAG:$1' AC_DEFUN([LT_SUPPORTED_TAG], []) # C support is built-in for now m4_define([_LT_LANG_C_enabled], []) m4_define([_LT_TAGS], []) # LT_LANG(LANG) # ------------- # Enable libtool support for the given language if not already enabled. AC_DEFUN([LT_LANG], [AC_BEFORE([$0], [LT_OUTPUT])dnl m4_case([$1], [C], [_LT_LANG(C)], [C++], [_LT_LANG(CXX)], [Go], [_LT_LANG(GO)], [Java], [_LT_LANG(GCJ)], [Fortran 77], [_LT_LANG(F77)], [Fortran], [_LT_LANG(FC)], [Windows Resource], [_LT_LANG(RC)], [m4_ifdef([_LT_LANG_]$1[_CONFIG], [_LT_LANG($1)], [m4_fatal([$0: unsupported language: "$1"])])])dnl ])# LT_LANG # _LT_LANG(LANGNAME) # ------------------ m4_defun([_LT_LANG], [m4_ifdef([_LT_LANG_]$1[_enabled], [], [LT_SUPPORTED_TAG([$1])dnl m4_append([_LT_TAGS], [$1 ])dnl m4_define([_LT_LANG_]$1[_enabled], [])dnl _LT_LANG_$1_CONFIG($1)])dnl ])# _LT_LANG m4_ifndef([AC_PROG_GO], [ ############################################################ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_GO. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # ############################################################ m4_defun([AC_PROG_GO], [AC_LANG_PUSH(Go)dnl AC_ARG_VAR([GOC], [Go compiler command])dnl AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl _AC_ARG_VAR_LDFLAGS()dnl AC_CHECK_TOOL(GOC, gccgo) if test -z "$GOC"; then if test -n "$ac_tool_prefix"; then AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo]) fi fi if test -z "$GOC"; then AC_CHECK_PROG(GOC, gccgo, gccgo, false) fi ])#m4_defun ])#m4_ifndef # _LT_LANG_DEFAULT_CONFIG # ----------------------- m4_defun([_LT_LANG_DEFAULT_CONFIG], [AC_PROVIDE_IFELSE([AC_PROG_CXX], [LT_LANG(CXX)], [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) AC_PROVIDE_IFELSE([AC_PROG_F77], [LT_LANG(F77)], [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) AC_PROVIDE_IFELSE([AC_PROG_FC], [LT_LANG(FC)], [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal dnl pulling things in needlessly. AC_PROVIDE_IFELSE([AC_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([LT_PROG_GCJ], [LT_LANG(GCJ)], [m4_ifdef([AC_PROG_GCJ], [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([A][M_PROG_GCJ], [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([LT_PROG_GCJ], [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) AC_PROVIDE_IFELSE([AC_PROG_GO], [LT_LANG(GO)], [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])]) AC_PROVIDE_IFELSE([LT_PROG_RC], [LT_LANG(RC)], [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) ])# _LT_LANG_DEFAULT_CONFIG # Obsolete macros: AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_CXX], []) dnl AC_DEFUN([AC_LIBTOOL_F77], []) dnl AC_DEFUN([AC_LIBTOOL_FC], []) dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) dnl AC_DEFUN([AC_LIBTOOL_RC], []) # _LT_TAG_COMPILER # ---------------- m4_defun([_LT_TAG_COMPILER], [AC_REQUIRE([AC_PROG_CC])dnl _LT_DECL([LTCC], [CC], [1], [A C compiler])dnl _LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl _LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl _LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC ])# _LT_TAG_COMPILER # _LT_COMPILER_BOILERPLATE # ------------------------ # Check for compiler boilerplate output or warnings with # the simple compiler test code. m4_defun([_LT_COMPILER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ])# _LT_COMPILER_BOILERPLATE # _LT_LINKER_BOILERPLATE # ---------------------- # Check for linker boilerplate output or warnings with # the simple link test code. m4_defun([_LT_LINKER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ])# _LT_LINKER_BOILERPLATE # _LT_REQUIRED_DARWIN_CHECKS # ------------------------- m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ case $host_os in rhapsody* | darwin*) AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) AC_CHECK_TOOL([LIPO], [lipo], [:]) AC_CHECK_TOOL([OTOOL], [otool], [:]) AC_CHECK_TOOL([OTOOL64], [otool64], [:]) _LT_DECL([], [DSYMUTIL], [1], [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) _LT_DECL([], [NMEDIT], [1], [Tool to change global to local symbols on Mac OS X]) _LT_DECL([], [LIPO], [1], [Tool to manipulate fat objects and archives on Mac OS X]) _LT_DECL([], [OTOOL], [1], [ldd/readelf like tool for Mach-O binaries on Mac OS X]) _LT_DECL([], [OTOOL64], [1], [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], [lt_cv_apple_cc_single_mod=no if test -z "${LT_MULTI_MODULE}"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? # If there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&AS_MESSAGE_LOG_FD # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test $_lt_result -eq 0; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -rf libconftest.dylib* rm -f conftest.* fi]) AC_CACHE_CHECK([for -exported_symbols_list linker flag], [lt_cv_ld_exported_symbols_list], [lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [lt_cv_ld_exported_symbols_list=yes], [lt_cv_ld_exported_symbols_list=no]) LDFLAGS="$save_LDFLAGS" ]) AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], [lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&AS_MESSAGE_LOG_FD elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then lt_cv_ld_force_load=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM ]) case $host_os in rhapsody* | darwin1.[[012]]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; 10.[[012]]*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test "$lt_cv_apple_cc_single_mod" = "yes"; then _lt_dar_single_mod='$single_module' fi if test "$lt_cv_ld_exported_symbols_list" = "yes"; then _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac ]) # _LT_DARWIN_LINKER_FEATURES([TAG]) # --------------------------------- # Checks for linker and compiler features on darwin m4_defun([_LT_DARWIN_LINKER_FEATURES], [ m4_require([_LT_REQUIRED_DARWIN_CHECKS]) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported if test "$lt_cv_ld_force_load" = "yes"; then _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes], [FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes]) else _LT_TAGVAR(whole_archive_flag_spec, $1)='' fi _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" case $cc_basename in ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" m4_if([$1], [CXX], [ if test "$lt_cv_apple_cc_single_mod" != "yes"; then _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" fi ],[]) else _LT_TAGVAR(ld_shlibs, $1)=no fi ]) # _LT_SYS_MODULE_PATH_AIX([TAGNAME]) # ---------------------------------- # Links a minimal program and checks the executable # for the system default hardcoded library path. In most cases, # this is /usr/lib:/lib, but when the MPI compilers are used # the location of the communication and MPI libs are included too. # If we don't find anything, use the default library path according # to the aix ld manual. # Store the results from the different compilers for each TAGNAME. # Allow to override them for all tags through lt_cv_aix_libpath. m4_defun([_LT_SYS_MODULE_PATH_AIX], [m4_require([_LT_DECL_SED])dnl if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ lt_aix_libpath_sed='[ /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }]' _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi],[]) if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib" fi ]) aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) fi ])# _LT_SYS_MODULE_PATH_AIX # _LT_SHELL_INIT(ARG) # ------------------- m4_define([_LT_SHELL_INIT], [m4_divert_text([M4SH-INIT], [$1 ])])# _LT_SHELL_INIT # _LT_PROG_ECHO_BACKSLASH # ----------------------- # Find how we can fake an echo command that does not interpret backslash. # In particular, with Autoconf 2.60 or later we add some code to the start # of the generated configure script which will find a shell with a builtin # printf (which we can use as an echo command). m4_defun([_LT_PROG_ECHO_BACKSLASH], [ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO AC_MSG_CHECKING([how to print strings]) # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $[]1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } case "$ECHO" in printf*) AC_MSG_RESULT([printf]) ;; print*) AC_MSG_RESULT([print -r]) ;; *) AC_MSG_RESULT([cat]) ;; esac m4_ifdef([_AS_DETECT_SUGGESTED], [_AS_DETECT_SUGGESTED([ test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test "X`printf %s $ECHO`" = "X$ECHO" \ || test "X`print -r -- $ECHO`" = "X$ECHO" )])]) _LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) _LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) ])# _LT_PROG_ECHO_BACKSLASH # _LT_WITH_SYSROOT # ---------------- AC_DEFUN([_LT_WITH_SYSROOT], [AC_MSG_CHECKING([for sysroot]) AC_ARG_WITH([sysroot], [ --with-sysroot[=DIR] Search for dependent libraries within DIR (or the compiler's sysroot if not specified).], [], [with_sysroot=no]) dnl lt_sysroot will always be passed unquoted. We quote it here dnl in case the user passed a directory name. lt_sysroot= case ${with_sysroot} in #( yes) if test "$GCC" = yes; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) AC_MSG_RESULT([${with_sysroot}]) AC_MSG_ERROR([The sysroot must be an absolute path.]) ;; esac AC_MSG_RESULT([${lt_sysroot:-no}]) _LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl [dependent libraries, and in which our libraries should be installed.])]) # _LT_ENABLE_LOCK # --------------- m4_defun([_LT_ENABLE_LOCK], [AC_ARG_ENABLE([libtool-lock], [AS_HELP_STRING([--disable-libtool-lock], [avoid locking (might break parallel builds)])]) test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) case `/usr/bin/file conftest.o` in *x86-64*) LD="${LD-ld} -m elf32_x86_64" ;; *) LD="${LD-ld} -m elf_i386" ;; esac ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, [AC_LANG_PUSH(C) AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) AC_LANG_POP]) if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; *-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD="${LD-ld}_sol2" fi ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks="$enable_libtool_lock" ])# _LT_ENABLE_LOCK # _LT_PROG_AR # ----------- m4_defun([_LT_PROG_AR], [AC_CHECK_TOOLS(AR, [ar], false) : ${AR=ar} : ${AR_FLAGS=cru} _LT_DECL([], [AR], [1], [The archiver]) _LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], [lt_cv_ar_at_file=no AC_COMPILE_IFELSE([AC_LANG_PROGRAM], [echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' AC_TRY_EVAL([lt_ar_try]) if test "$ac_status" -eq 0; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a AC_TRY_EVAL([lt_ar_try]) if test "$ac_status" -ne 0; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a ]) ]) if test "x$lt_cv_ar_at_file" = xno; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi _LT_DECL([], [archiver_list_spec], [1], [How to feed a file listing to the archiver]) ])# _LT_PROG_AR # _LT_CMD_OLD_ARCHIVE # ------------------- m4_defun([_LT_CMD_OLD_ARCHIVE], [_LT_PROG_AR AC_CHECK_TOOL(STRIP, strip, :) test -z "$STRIP" && STRIP=: _LT_DECL([], [STRIP], [1], [A symbol stripping program]) AC_CHECK_TOOL(RANLIB, ranlib, :) test -z "$RANLIB" && RANLIB=: _LT_DECL([], [RANLIB], [1], [Commands used to install an old-style archive]) # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac _LT_DECL([], [old_postinstall_cmds], [2]) _LT_DECL([], [old_postuninstall_cmds], [2]) _LT_TAGDECL([], [old_archive_cmds], [2], [Commands used to build an old-style archive]) _LT_DECL([], [lock_old_archive_extraction], [0], [Whether to use a lock for old archive extraction]) ])# _LT_CMD_OLD_ARCHIVE # _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------------------- # Check whether the given compiler option works AC_DEFUN([_LT_COMPILER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$3" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi fi $RM conftest* ]) if test x"[$]$2" = xyes; then m4_if([$5], , :, [$5]) else m4_if([$6], , :, [$6]) fi ])# _LT_COMPILER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) # _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------- # Check whether the given linker option works AC_DEFUN([_LT_LINKER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $3" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi else $2=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" ]) if test x"[$]$2" = xyes; then m4_if([$4], , :, [$4]) else m4_if([$5], , :, [$5]) fi ])# _LT_LINKER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) # LT_CMD_MAX_LEN #--------------- AC_DEFUN([LT_CMD_MAX_LEN], [AC_REQUIRE([AC_CANONICAL_HOST])dnl # find the maximum length of command line arguments AC_MSG_CHECKING([the maximum length of command line arguments]) AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len" && \ test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8 ; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac ]) if test -n $lt_cv_sys_max_cmd_len ; then AC_MSG_RESULT($lt_cv_sys_max_cmd_len) else AC_MSG_RESULT(none) fi max_cmd_len=$lt_cv_sys_max_cmd_len _LT_DECL([], [max_cmd_len], [0], [What is the maximum length of a command?]) ])# LT_CMD_MAX_LEN # Old name: AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) # _LT_HEADER_DLFCN # ---------------- m4_defun([_LT_HEADER_DLFCN], [AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl ])# _LT_HEADER_DLFCN # _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) # ---------------------------------------------------------------- m4_defun([_LT_TRY_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test "$cross_compiling" = yes; then : [$4] else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF [#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; }] _LT_EOF if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) $1 ;; x$lt_dlneed_uscore) $2 ;; x$lt_dlunknown|x*) $3 ;; esac else : # compilation failed $3 fi fi rm -fr conftest* ])# _LT_TRY_DLOPEN_SELF # LT_SYS_DLOPEN_SELF # ------------------ AC_DEFUN([LT_SYS_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ]) ;; *) AC_CHECK_FUNC([shl_load], [lt_cv_dlopen="shl_load"], [AC_CHECK_LIB([dld], [shl_load], [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"], [AC_CHECK_FUNC([dlopen], [lt_cv_dlopen="dlopen"], [AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], [AC_CHECK_LIB([svld], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], [AC_CHECK_LIB([dld], [dld_link], [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"]) ]) ]) ]) ]) ]) ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" AC_CACHE_CHECK([whether a program can dlopen itself], lt_cv_dlopen_self, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) ]) if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" AC_CACHE_CHECK([whether a statically linked program can dlopen itself], lt_cv_dlopen_self_static, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) ]) fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi _LT_DECL([dlopen_support], [enable_dlopen], [0], [Whether dlopen is supported]) _LT_DECL([dlopen_self], [enable_dlopen_self], [0], [Whether dlopen of programs is supported]) _LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], [Whether dlopen of statically linked programs is supported]) ])# LT_SYS_DLOPEN_SELF # Old name: AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) # _LT_COMPILER_C_O([TAGNAME]) # --------------------------- # Check to see if options -c and -o are simultaneously supported by compiler. # This macro does not hard code the compiler like AC_PROG_CC_C_O. m4_defun([_LT_COMPILER_C_O], [m4_require([_LT_DECL_SED])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes fi fi chmod u+w . 2>&AS_MESSAGE_LOG_FD $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* ]) _LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], [Does compiler simultaneously support -c and -o options?]) ])# _LT_COMPILER_C_O # _LT_COMPILER_FILE_LOCKS([TAGNAME]) # ---------------------------------- # Check to see if we can do hard links to lock some files if needed m4_defun([_LT_COMPILER_FILE_LOCKS], [m4_require([_LT_ENABLE_LOCK])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_COMPILER_C_O([$1]) hard_links="nottested" if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user AC_MSG_CHECKING([if we can lock with hard links]) hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no AC_MSG_RESULT([$hard_links]) if test "$hard_links" = no; then AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) need_locks=warn fi else need_locks=no fi _LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) ])# _LT_COMPILER_FILE_LOCKS # _LT_CHECK_OBJDIR # ---------------- m4_defun([_LT_CHECK_OBJDIR], [AC_CACHE_CHECK([for objdir], [lt_cv_objdir], [rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null]) objdir=$lt_cv_objdir _LT_DECL([], [objdir], [0], [The name of the directory that contains temporary libtool files])dnl m4_pattern_allow([LT_OBJDIR])dnl AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/", [Define to the sub-directory in which libtool stores uninstalled libraries.]) ])# _LT_CHECK_OBJDIR # _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) # -------------------------------------- # Check hardcoding attributes. m4_defun([_LT_LINKER_HARDCODE_LIBPATH], [AC_MSG_CHECKING([how to hardcode library paths into programs]) _LT_TAGVAR(hardcode_action, $1)= if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || test -n "$_LT_TAGVAR(runpath_var, $1)" || test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then # We can hardcode non-existent directories. if test "$_LT_TAGVAR(hardcode_direct, $1)" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no && test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then # Linking always hardcodes the temporary library directory. _LT_TAGVAR(hardcode_action, $1)=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. _LT_TAGVAR(hardcode_action, $1)=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. _LT_TAGVAR(hardcode_action, $1)=unsupported fi AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) if test "$_LT_TAGVAR(hardcode_action, $1)" = relink || test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi _LT_TAGDECL([], [hardcode_action], [0], [How to hardcode a shared library path into an executable]) ])# _LT_LINKER_HARDCODE_LIBPATH # _LT_CMD_STRIPLIB # ---------------- m4_defun([_LT_CMD_STRIPLIB], [m4_require([_LT_DECL_EGREP]) striplib= old_striplib= AC_MSG_CHECKING([whether stripping libraries is possible]) if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" AC_MSG_RESULT([yes]) else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" old_striplib="$STRIP -S" AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) fi ;; *) AC_MSG_RESULT([no]) ;; esac fi _LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) _LT_DECL([], [striplib], [1]) ])# _LT_CMD_STRIPLIB # _LT_SYS_DYNAMIC_LINKER([TAG]) # ----------------------------- # PORTME Fill in your ld.so characteristics m4_defun([_LT_SYS_DYNAMIC_LINKER], [AC_REQUIRE([AC_CANONICAL_HOST])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_OBJDUMP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl AC_MSG_CHECKING([dynamic linker characteristics]) m4_if([$1], [], [ if test "$GCC" = yes; then case $host_os in darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;; *) lt_sed_strip_eq="s,=/,/,g" ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path/$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" else test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo="/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[[lt_foo]]++; } if (lt_freq[[lt_foo]] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's,/\([[A-Za-z]]:\),\1,g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi]) library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[[4-9]]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[[01]] | aix4.[[01]].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[[45]]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' library_names_spec='${libname}.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec="$LIB" if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[[23]].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[[01]]* | freebsdelf3.[[01]]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=yes sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[[3-9]]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], [lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], [lt_cv_shlibpath_overrides_runpath=yes])]) LDFLAGS=$save_LDFLAGS libdir=$save_libdir ]) shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[[89]] | openbsd2.[[89]].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac AC_MSG_RESULT([$dynamic_linker]) test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi _LT_DECL([], [variables_saved_for_relink], [1], [Variables whose values should be saved in libtool wrapper scripts and restored at link time]) _LT_DECL([], [need_lib_prefix], [0], [Do we need the "lib" prefix for modules?]) _LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) _LT_DECL([], [version_type], [0], [Library versioning type]) _LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) _LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) _LT_DECL([], [shlibpath_overrides_runpath], [0], [Is shlibpath searched before the hard-coded library search path?]) _LT_DECL([], [libname_spec], [1], [Format of library name prefix]) _LT_DECL([], [library_names_spec], [1], [[List of archive names. First name is the real one, the rest are links. The last name is the one that the linker finds with -lNAME]]) _LT_DECL([], [soname_spec], [1], [[The coded name of the library, if different from the real name]]) _LT_DECL([], [install_override_mode], [1], [Permission mode override for installation of shared libraries]) _LT_DECL([], [postinstall_cmds], [2], [Command to use after installation of a shared archive]) _LT_DECL([], [postuninstall_cmds], [2], [Command to use after uninstallation of a shared archive]) _LT_DECL([], [finish_cmds], [2], [Commands used to finish a libtool library installation in a directory]) _LT_DECL([], [finish_eval], [1], [[As "finish_cmds", except a single script fragment to be evaled but not shown]]) _LT_DECL([], [hardcode_into_libs], [0], [Whether we should hardcode library paths into libraries]) _LT_DECL([], [sys_lib_search_path_spec], [2], [Compile-time system search path for libraries]) _LT_DECL([], [sys_lib_dlsearch_path_spec], [2], [Run-time system search path for libraries]) ])# _LT_SYS_DYNAMIC_LINKER # _LT_PATH_TOOL_PREFIX(TOOL) # -------------------------- # find a file program which can recognize shared library AC_DEFUN([_LT_PATH_TOOL_PREFIX], [m4_require([_LT_DECL_EGREP])dnl AC_MSG_CHECKING([for $1]) AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, [case $MAGIC_CMD in [[\\/*] | ?:[\\/]*]) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR dnl $ac_dummy forces splitting on constant user-supplied paths. dnl POSIX.2 word splitting is done only on the output of word expansions, dnl not every word. This closes a longstanding sh security hole. ac_dummy="m4_if([$2], , $PATH, [$2])" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$1; then lt_cv_path_MAGIC_CMD="$ac_dir/$1" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac]) MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then AC_MSG_RESULT($MAGIC_CMD) else AC_MSG_RESULT(no) fi _LT_DECL([], [MAGIC_CMD], [0], [Used to examine libraries when file_magic_cmd begins with "file"])dnl ])# _LT_PATH_TOOL_PREFIX # Old name: AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) # _LT_PATH_MAGIC # -------------- # find a file program which can recognize a shared library m4_defun([_LT_PATH_MAGIC], [_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) else MAGIC_CMD=: fi fi ])# _LT_PATH_MAGIC # LT_PATH_LD # ---------- # find the pathname to the GNU or non-GNU linker AC_DEFUN([LT_PATH_LD], [AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PROG_ECHO_BACKSLASH])dnl AC_ARG_WITH([gnu-ld], [AS_HELP_STRING([--with-gnu-ld], [assume the C compiler uses GNU ld @<:@default=no@:>@])], [test "$withval" = no || with_gnu_ld=yes], [with_gnu_ld=no])dnl ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by $CC]) case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [[\\/]]* | ?:[[\\/]]*) re_direlt='/[[^/]][[^/]]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(lt_cv_path_LD, [if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'] lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[[3-9]]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; esac ]) file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown _LT_DECL([], [deplibs_check_method], [1], [Method to check whether dependent libraries are shared objects]) _LT_DECL([], [file_magic_cmd], [1], [Command to use when deplibs_check_method = "file_magic"]) _LT_DECL([], [file_magic_glob], [1], [How to find potential files when deplibs_check_method = "file_magic"]) _LT_DECL([], [want_nocaseglob], [1], [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) ])# _LT_CHECK_MAGIC_METHOD # LT_PATH_NM # ---------- # find the pathname to a BSD- or MS-compatible name lister AC_DEFUN([LT_PATH_NM], [AC_REQUIRE([AC_PROG_CC])dnl AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, [if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done : ${lt_cv_path_NM=no} fi]) if test "$lt_cv_path_NM" != "no"; then NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols" ;; *) DUMPBIN=: ;; esac fi AC_SUBST([DUMPBIN]) if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" fi fi test -z "$NM" && NM=nm AC_SUBST([NM]) _LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], [lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) cat conftest.out >&AS_MESSAGE_LOG_FD if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest*]) ])# LT_PATH_NM # Old names: AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_PROG_NM], []) dnl AC_DEFUN([AC_PROG_NM], []) # _LT_CHECK_SHAREDLIB_FROM_LINKLIB # -------------------------------- # how to determine the name of the shared library # associated with a specific link library. # -- PORTME fill in with the dynamic library characteristics m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], [m4_require([_LT_DECL_EGREP]) m4_require([_LT_DECL_OBJDUMP]) m4_require([_LT_DECL_DLLTOOL]) AC_CACHE_CHECK([how to associate runtime and link libraries], lt_cv_sharedlib_from_linklib_cmd, [lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh # decide which to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd="$ECHO" ;; esac ]) sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO _LT_DECL([], [sharedlib_from_linklib_cmd], [1], [Command to associate shared and link libraries]) ])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB # _LT_PATH_MANIFEST_TOOL # ---------------------- # locate the manifest tool m4_defun([_LT_PATH_MANIFEST_TOOL], [AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], [lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&AS_MESSAGE_LOG_FD if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest*]) if test "x$lt_cv_path_mainfest_tool" != xyes; then MANIFEST_TOOL=: fi _LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl ])# _LT_PATH_MANIFEST_TOOL # LT_LIB_M # -------- # check for math library AC_DEFUN([LT_LIB_M], [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case $host in *-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) # These system don't have libm, or don't need it ;; *-ncr-sysv4.3*) AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") ;; *) AC_CHECK_LIB(m, cos, LIBM="-lm") ;; esac AC_SUBST([LIBM]) ])# LT_LIB_M # Old name: AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_CHECK_LIBM], []) # _LT_COMPILER_NO_RTTI([TAGNAME]) # ------------------------------- m4_defun([_LT_COMPILER_NO_RTTI], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= if test "$GCC" = yes; then case $cc_basename in nvcc*) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; *) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; esac _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], lt_cv_prog_compiler_rtti_exceptions, [-fno-rtti -fno-exceptions], [], [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) fi _LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], [Compiler flag to turn off builtin functions]) ])# _LT_COMPILER_NO_RTTI # _LT_CMD_GLOBAL_SYMBOLS # ---------------------- m4_defun([_LT_CMD_GLOBAL_SYMBOLS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([LT_PATH_NM])dnl AC_REQUIRE([LT_PATH_LD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_TAG_COMPILER])dnl # Check for command to grab the raw symbol name followed by C symbol from nm. AC_MSG_CHECKING([command to parse $NM output from $compiler object]) AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [ # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[[BCDEGRST]]' # Regexp to match symbols that can be accessed directly from C. sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[[BCDT]]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[[ABCDGISTW]]' ;; hpux*) if test "$host_cpu" = ia64; then symcode='[[ABCDEGRST]]' fi ;; irix* | nonstopux*) symcode='[[BCDEGRST]]' ;; osf*) symcode='[[BCDEGQRST]]' ;; solaris*) symcode='[[BDRT]]' ;; sco3.2v5*) symcode='[[DT]]' ;; sysv4.2uw2*) symcode='[[DT]]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[[ABDT]]' ;; sysv4) symcode='[[DFNSTU]]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[[ABCDGIRSTW]]' ;; esac # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function # and D for any global variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK ['"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ " {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ " s[1]~/^[@?]/{print s[1], s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx]" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if AC_TRY_EVAL(ac_compile); then # Now try to grab the symbols. nlist=conftest.nm if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT@&t@_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT@&t@_DLSYM_CONST #else # define LT@&t@_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT@&t@_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[[]] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD fi else echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done ]) if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then AC_MSG_RESULT(failed) else AC_MSG_RESULT(ok) fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then nm_file_list_spec='@' fi _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], [Take the output of nm and produce a listing of raw symbols and C names]) _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], [Transform the output of nm in a proper C declaration]) _LT_DECL([global_symbol_to_c_name_address], [lt_cv_sys_global_symbol_to_c_name_address], [1], [Transform the output of nm in a C name address pair]) _LT_DECL([global_symbol_to_c_name_address_lib_prefix], [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], [Transform the output of nm in a C name address pair when lib prefix is needed]) _LT_DECL([], [nm_file_list_spec], [1], [Specify filename containing input files for $NM]) ]) # _LT_CMD_GLOBAL_SYMBOLS # _LT_COMPILER_PIC([TAGNAME]) # --------------------------- m4_defun([_LT_COMPILER_PIC], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_wl, $1)= _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)= m4_if([$1], [CXX], [ # C++ specific cases for pic, static, wl, etc. if test "$GXX" = yes; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac else case $host_os in aix[[4-9]]*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; dgux*) case $cc_basename in ec++*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; ghcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' if test "$host_cpu" != ia64; then _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; aCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # KAI C++ Compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; ecpc* ) # old Intel C++ for x86_64 which still supported -KPIC. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; icpc* ) # Intel C++, used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; pgCC* | pgcpp*) # Portland Group C++ compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL 8.0, 9.0 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; esac ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' ;; *) ;; esac ;; netbsd* | netbsdelf*-gnu) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; cxx*) # Digital/Compaq C++ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; lcc*) # Lucid _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; *) ;; esac ;; vxworks*) ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ], [ if test "$GCC" = yes; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; hpux9* | hpux10* | hpux11*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC (with -KPIC) is the default. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # Lahey Fortran 8.1. lf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' ;; nagfor*) # NAG Fortran compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; ccc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All Alpha code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='' ;; *Sun\ F* | *Sun*Fortran*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ;; *Intel*\ [[CF]]*Compiler*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; *Portland\ Group*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; esac ;; newsos6) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All OSF/1 code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; rdos*) _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; solaris*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; *) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; esac ;; sunos4*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; unicos*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; uts4*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ]) case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" ;; esac AC_CACHE_CHECK([for $compiler option to produce PIC], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) _LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) # # Check to make sure the PIC flag actually works. # if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in "" | " "*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; esac], [_LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) fi _LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], [Additional compiler flags for building library objects]) _LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], [How to pass a linker flag through the compiler]) # # Check to make sure the static flag actually works. # wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" _LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), $lt_tmp_static_flag, [], [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], [Compiler flag to prevent dynamic linking]) ])# _LT_COMPILER_PIC # _LT_LINKER_SHLIBS([TAGNAME]) # ---------------------------- # See if the linker supports building shared libraries. m4_defun([_LT_LINKER_SHLIBS], [AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) m4_if([$1], [CXX], [ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] case $host_os in aix[[4-9]]*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global defined # symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi ;; pw32*) _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" ;; cygwin* | mingw* | cegcc*) case $cc_basename in cl*) _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] ;; esac ;; linux* | k*bsd*-gnu | gnu*) _LT_TAGVAR(link_all_deplibs, $1)=no ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac ], [ runpath_var= _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_cmds, $1)= _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(old_archive_from_new_cmds, $1)= _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= _LT_TAGVAR(thread_safe_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list _LT_TAGVAR(include_expsyms, $1)= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. dnl Note also adjust exclude_expsyms for C++ above. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; linux* | k*bsd*-gnu | gnu*) _LT_TAGVAR(link_all_deplibs, $1)=no ;; esac _LT_TAGVAR(ld_shlibs, $1)=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test "$with_gnu_ld" = yes; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;; *\ \(GNU\ Binutils\)\ [[3-9]]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test "$lt_use_gnu_ld_interface" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi supports_anon_versioning=no case `$LD -v 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[[3-9]]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 _LT_TAGVAR(whole_archive_flag_spec, $1)= tmp_sharedflag='--shared' ;; xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi case $cc_basename in xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; sunos4*) _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then runpath_var= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. _LT_TAGVAR(hardcode_minus_L, $1)=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. _LT_TAGVAR(hardcode_direct, $1)=unsupported fi ;; aix[[4-9]]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global # defined symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' if test "$GCC" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi _LT_TAGVAR(link_all_deplibs, $1)=no else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. _LT_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; bsdi[[45]]*) _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' # FIXME: Should let the user specify the lib program. _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; hpux9*) if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes fi ;; hpux11*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) m4_if($1, [], [ # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) _LT_LINKER_OPTION([if $CC understands -b], _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) ;; esac fi if test "$with_gnu_ld" = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], [lt_cv_irix_exported_symbol], [save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" AC_LINK_IFELSE( [AC_LANG_SOURCE( [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], [C++], [[int foo (void) { return 0; }]], [Fortran 77], [[ subroutine foo end]], [Fortran], [[ subroutine foo end]])])], [lt_cv_irix_exported_symbol=yes], [lt_cv_irix_exported_symbol=no]) LDFLAGS="$save_LDFLAGS"]) if test "$lt_cv_irix_exported_symbol" = yes; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' fi else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes _LT_TAGVAR(link_all_deplibs, $1)=yes ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; newsos6) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *nto* | *qnx*) ;; openbsd*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' else case $host_os in openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' ;; esac fi else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; solaris*) _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='${wl}' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' fi ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4) case $host_vendor in sni) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' _LT_TAGVAR(hardcode_direct, $1)=no ;; motorola) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4.3*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes _LT_TAGVAR(ld_shlibs, $1)=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(ld_shlibs, $1)=no ;; esac if test x$host_vendor = xsni; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym' ;; esac fi fi ]) AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld _LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl _LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl _LT_DECL([], [extract_expsyms_cmds], [2], [The commands to extract the exported symbol list from a shared archive]) # # Do we need to explicitly link libc? # case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in x|xyes) # Assume -lc should be added _LT_TAGVAR(archive_cmds_need_lc, $1)=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $_LT_TAGVAR(archive_cmds, $1) in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. AC_CACHE_CHECK([whether -lc should be explicitly linked in], [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), [$RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if AC_TRY_EVAL(ac_compile) 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) _LT_TAGVAR(allow_undefined_flag, $1)= if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) then lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no else lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes fi _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* ]) _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) ;; esac fi ;; esac _LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], [Whether or not to add -lc for building shared libraries]) _LT_TAGDECL([allow_libtool_libs_with_static_runtimes], [enable_shared_with_static_runtimes], [0], [Whether or not to disallow shared libs when runtime libs are static]) _LT_TAGDECL([], [export_dynamic_flag_spec], [1], [Compiler flag to allow reflexive dlopens]) _LT_TAGDECL([], [whole_archive_flag_spec], [1], [Compiler flag to generate shared objects directly from archives]) _LT_TAGDECL([], [compiler_needs_object], [1], [Whether the compiler copes with passing no objects directly]) _LT_TAGDECL([], [old_archive_from_new_cmds], [2], [Create an old-style archive from a shared archive]) _LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], [Create a temporary old-style archive to link instead of a shared archive]) _LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) _LT_TAGDECL([], [archive_expsym_cmds], [2]) _LT_TAGDECL([], [module_cmds], [2], [Commands used to build a loadable module if different from building a shared archive.]) _LT_TAGDECL([], [module_expsym_cmds], [2]) _LT_TAGDECL([], [with_gnu_ld], [1], [Whether we are building with GNU ld or not]) _LT_TAGDECL([], [allow_undefined_flag], [1], [Flag that allows shared libraries with undefined symbols to be built]) _LT_TAGDECL([], [no_undefined_flag], [1], [Flag that enforces no undefined symbols]) _LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], [Flag to hardcode $libdir into a binary during linking. This must work even if $libdir does not exist]) _LT_TAGDECL([], [hardcode_libdir_separator], [1], [Whether we need a single "-rpath" flag with a separated argument]) _LT_TAGDECL([], [hardcode_direct], [0], [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_direct_absolute], [0], [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the resulting binary and the resulting library dependency is "absolute", i.e impossible to change by setting ${shlibpath_var} if the library is relocated]) _LT_TAGDECL([], [hardcode_minus_L], [0], [Set to "yes" if using the -LDIR flag during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_shlibpath_var], [0], [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_automatic], [0], [Set to "yes" if building a shared library automatically hardcodes DIR into the library and all subsequent libraries and executables linked against it]) _LT_TAGDECL([], [inherit_rpath], [0], [Set to yes if linker adds runtime paths of dependent libraries to runtime path list]) _LT_TAGDECL([], [link_all_deplibs], [0], [Whether libtool must link a program against all its dependency libraries]) _LT_TAGDECL([], [always_export_symbols], [0], [Set to "yes" if exported symbols are required]) _LT_TAGDECL([], [export_symbols_cmds], [2], [The commands to list exported symbols]) _LT_TAGDECL([], [exclude_expsyms], [1], [Symbols that should not be listed in the preloaded symbols]) _LT_TAGDECL([], [include_expsyms], [1], [Symbols that must always be exported]) _LT_TAGDECL([], [prelink_cmds], [2], [Commands necessary for linking programs (against libraries) with templates]) _LT_TAGDECL([], [postlink_cmds], [2], [Commands necessary for finishing linking programs]) _LT_TAGDECL([], [file_list_spec], [1], [Specify filename containing input files]) dnl FIXME: Not yet implemented dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], dnl [Compiler flag to generate thread safe objects]) ])# _LT_LINKER_SHLIBS # _LT_LANG_C_CONFIG([TAG]) # ------------------------ # Ensure that the configuration variables for a C compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to `libtool'. m4_defun([_LT_LANG_C_CONFIG], [m4_require([_LT_DECL_EGREP])dnl lt_save_CC="$CC" AC_LANG_PUSH(C) # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' _LT_TAG_COMPILER # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) LT_SYS_DLOPEN_SELF _LT_CMD_STRIPLIB # Report which library types will actually be built AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_CONFIG($1) fi AC_LANG_POP CC="$lt_save_CC" ])# _LT_LANG_C_CONFIG # _LT_LANG_CXX_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a C++ compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to `libtool'. m4_defun([_LT_LANG_CXX_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then AC_PROG_CXXCPP else _lt_caught_CXX_error=yes fi AC_LANG_PUSH(C++) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the CXX compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_caught_CXX_error" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} CFLAGS=$CXXFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately if test "$GXX" = yes; then _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' else _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= fi if test "$GXX" = yes; then # Set up default GNU C++ configuration LT_PATH_LD # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test "$with_gnu_ld" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='${wl}' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) _LT_TAGVAR(ld_shlibs, $1)=yes case $host_os in aix3*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aix[[4-9]]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' if test "$GXX" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to # export. _LT_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an empty # executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared # libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; cygwin* | mingw* | pw32* | cegcc*) case $GXX,$cc_basename in ,cl* | no,cl*) # Native MSVC # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ func_to_tool_file "$lt_outputfile"~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # g++ # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; freebsd2.*) # C++ shared libraries reported to be fairly broken before # switch to ELF _LT_TAGVAR(ld_shlibs, $1)=no ;; freebsd-elf*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions _LT_TAGVAR(ld_shlibs, $1)=yes ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; hpux9*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; hpux10*|hpux11*) if test $with_gnu_ld = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) ;; *) _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then if test $with_gnu_ld = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib' fi fi _LT_TAGVAR(link_all_deplibs, $1)=yes ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc* | ecpc* ) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; esac _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ $RANLIB $oldlib' _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; *) # Version 6 and above use weak symbols _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' ;; cxx*) # Compaq C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' ;; xl* | mpixl* | bgxl*) # IBM XL 8.0 on PPC, with GNU ld _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; esac ;; esac ;; lynxos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; m88k*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; *nto* | *qnx*) _LT_TAGVAR(ld_shlibs, $1)=yes ;; openbsd2*) # C++ shared libraries are fairly broken _LT_TAGVAR(ld_shlibs, $1)=no ;; openbsd*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' fi output_verbose_link_cmd=func_echo_all else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Archives containing C++ object files must be created using # the KAI C++ compiler. case $host in osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; esac ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; cxx*) case $host in osf3*) _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' ;; *) _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~ $RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' ;; esac _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' case $host in osf3*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(archive_cmds_need_lc,$1)=yes _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # g++ 2.7 appears to require `-G' NOT `-shared' on this # platform. _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ '"$_LT_TAGVAR(old_archive_cmds, $1)" _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ '"$_LT_TAGVAR(reload_cmds, $1)" ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_TAGVAR(GCC, $1)="$GXX" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld fi # test "$_lt_caught_CXX_error" != yes AC_LANG_POP ])# _LT_LANG_CXX_CONFIG # _LT_FUNC_STRIPNAME_CNF # ---------------------- # func_stripname_cnf prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # # This function is identical to the (non-XSI) version of func_stripname, # except this one can be used by m4 code that may be executed by configure, # rather than the libtool script. m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl AC_REQUIRE([_LT_DECL_SED]) AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) func_stripname_cnf () { case ${2} in .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; esac } # func_stripname_cnf ])# _LT_FUNC_STRIPNAME_CNF # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) # --------------------------------- # Figure out "hidden" library dependencies from verbose # compiler output when linking a shared library. # Parse the compiler output and extract the necessary # objects, libraries and library flags. m4_defun([_LT_SYS_HIDDEN_LIBDEPS], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl # Dependencies to place before and after the object being linked: _LT_TAGVAR(predep_objects, $1)= _LT_TAGVAR(postdep_objects, $1)= _LT_TAGVAR(predeps, $1)= _LT_TAGVAR(postdeps, $1)= _LT_TAGVAR(compiler_lib_search_path, $1)= dnl we can't use the lt_simple_compile_test_code here, dnl because it contains code intended for an executable, dnl not a library. It's possible we should let each dnl tag define a new lt_????_link_test_code variable, dnl but it's only used here... m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF int a; void foo (void) { a = 0; } _LT_EOF ], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF class Foo { public: Foo (void) { a = 0; } private: int a; }; _LT_EOF ], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer*4 a a=0 return end _LT_EOF ], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer a a=0 return end _LT_EOF ], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF public class foo { private int a; public void bar (void) { a = 0; } }; _LT_EOF ], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF package foo func foo() { } _LT_EOF ]) _lt_libdeps_save_CFLAGS=$CFLAGS case "$CC $CFLAGS " in #( *\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; *\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; *\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; esac dnl Parse the compiler output and extract the necessary dnl objects, libraries and library flags. if AC_TRY_EVAL(ac_compile); then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do case ${prev}${p} in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test $p = "-L" || test $p = "-R"; then prev=$p continue fi # Expand the sysroot to ease extracting the directories later. if test -z "$prev"; then case $p in -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; esac fi case $p in =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; esac if test "$pre_test_object_deps_done" = no; then case ${prev} in -L | -R) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" else _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$_LT_TAGVAR(postdeps, $1)"; then _LT_TAGVAR(postdeps, $1)="${prev}${p}" else _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}" fi fi prev= ;; *.lto.$objext) ;; # Ignore GCC LTO objects *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test "$pre_test_object_deps_done" = no; then if test -z "$_LT_TAGVAR(predep_objects, $1)"; then _LT_TAGVAR(predep_objects, $1)="$p" else _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" fi else if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then _LT_TAGVAR(postdep_objects, $1)="$p" else _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling $1 test program" fi $RM -f confest.$objext CFLAGS=$_lt_libdeps_save_CFLAGS # PORTME: override above test on systems where it is broken m4_if([$1], [CXX], [case $host_os in interix[[3-9]]*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. _LT_TAGVAR(predep_objects,$1)= _LT_TAGVAR(postdep_objects,$1)= _LT_TAGVAR(postdeps,$1)= ;; linux*) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac if test "$solaris_use_stlport4" != yes; then _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac # Adding this requires a known-good setup of shared libraries for # Sun compiler versions before 5.6, else PIC objects from an old # archive will be linked into the output, leading to subtle bugs. if test "$solaris_use_stlport4" != yes; then _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; esac ]) case " $_LT_TAGVAR(postdeps, $1) " in *" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; esac _LT_TAGVAR(compiler_lib_search_dirs, $1)= if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` fi _LT_TAGDECL([], [compiler_lib_search_dirs], [1], [The directories searched by this compiler when creating a shared library]) _LT_TAGDECL([], [predep_objects], [1], [Dependencies to place before and after the objects being linked to create a shared library]) _LT_TAGDECL([], [postdep_objects], [1]) _LT_TAGDECL([], [predeps], [1]) _LT_TAGDECL([], [postdeps], [1]) _LT_TAGDECL([], [compiler_lib_search_path], [1], [The library search path used internally by the compiler when linking a shared library]) ])# _LT_SYS_HIDDEN_LIBDEPS # _LT_LANG_F77_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a Fortran 77 compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_F77_CONFIG], [AC_LANG_PUSH(Fortran 77) if test -z "$F77" || test "X$F77" = "Xno"; then _lt_disable_F77=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for f77 test sources. ac_ext=f # Object file extension for compiled f77 test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the F77 compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_disable_F77" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${F77-"f77"} CFLAGS=$FFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) GCC=$G77 if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)="$G77" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC="$lt_save_CC" CFLAGS="$lt_save_CFLAGS" fi # test "$_lt_disable_F77" != yes AC_LANG_POP ])# _LT_LANG_F77_CONFIG # _LT_LANG_FC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for a Fortran compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_FC_CONFIG], [AC_LANG_PUSH(Fortran) if test -z "$FC" || test "X$FC" = "Xno"; then _lt_disable_FC=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for fc test sources. ac_ext=${ac_fc_srcext-f} # Object file extension for compiled fc test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the FC compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_disable_FC" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${FC-"f95"} CFLAGS=$FCFLAGS compiler=$CC GCC=$ac_cv_fc_compiler_gnu _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS fi # test "$_lt_disable_FC" != yes AC_LANG_POP ])# _LT_LANG_FC_CONFIG # _LT_LANG_GCJ_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Java Compiler compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_GCJ_CONFIG], [AC_REQUIRE([LT_PROG_GCJ])dnl AC_LANG_SAVE # Source file extension for Java test sources. ac_ext=java # Object file extension for compiled Java test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="class foo {}" # Code to be used in simple link tests lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GCJ-"gcj"} CFLAGS=$GCJFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)="$LD" _LT_CC_BASENAME([$compiler]) # GCJ did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GCJ_CONFIG # _LT_LANG_GO_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Go compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_GO_CONFIG], [AC_REQUIRE([LT_PROG_GO])dnl AC_LANG_SAVE # Source file extension for Go test sources. ac_ext=go # Object file extension for compiled Go test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="package main; func main() { }" # Code to be used in simple link tests lt_simple_link_test_code='package main; func main() { }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GOC-"gccgo"} CFLAGS=$GOFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)="$LD" _LT_CC_BASENAME([$compiler]) # Go did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GO_CONFIG # _LT_LANG_RC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for the Windows resource compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_RC_CONFIG], [AC_REQUIRE([LT_PROG_RC])dnl AC_LANG_SAVE # Source file extension for RC test sources. ac_ext=rc # Object file extension for compiled RC test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' # Code to be used in simple link tests lt_simple_link_test_code="$lt_simple_compile_test_code" # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC= CC=${RC-"windres"} CFLAGS= compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes if test -n "$compiler"; then : _LT_CONFIG($1) fi GCC=$lt_save_GCC AC_LANG_RESTORE CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_RC_CONFIG # LT_PROG_GCJ # ----------- AC_DEFUN([LT_PROG_GCJ], [m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], [AC_CHECK_TOOL(GCJ, gcj,) test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" AC_SUBST(GCJFLAGS)])])[]dnl ]) # Old name: AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_GCJ], []) # LT_PROG_GO # ---------- AC_DEFUN([LT_PROG_GO], [AC_CHECK_TOOL(GOC, gccgo,) ]) # LT_PROG_RC # ---------- AC_DEFUN([LT_PROG_RC], [AC_CHECK_TOOL(RC, windres,) ]) # Old name: AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_RC], []) # _LT_DECL_EGREP # -------------- # If we don't have a new enough Autoconf to choose the best grep # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_EGREP], [AC_REQUIRE([AC_PROG_EGREP])dnl AC_REQUIRE([AC_PROG_FGREP])dnl test -z "$GREP" && GREP=grep _LT_DECL([], [GREP], [1], [A grep program that handles long lines]) _LT_DECL([], [EGREP], [1], [An ERE matcher]) _LT_DECL([], [FGREP], [1], [A literal string matcher]) dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too AC_SUBST([GREP]) ]) # _LT_DECL_OBJDUMP # -------------- # If we don't have a new enough Autoconf to choose the best objdump # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_OBJDUMP], [AC_CHECK_TOOL(OBJDUMP, objdump, false) test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) AC_SUBST([OBJDUMP]) ]) # _LT_DECL_DLLTOOL # ---------------- # Ensure DLLTOOL variable is set. m4_defun([_LT_DECL_DLLTOOL], [AC_CHECK_TOOL(DLLTOOL, dlltool, false) test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program]) AC_SUBST([DLLTOOL]) ]) # _LT_DECL_SED # ------------ # Check for a fully-functional sed program, that truncates # as few characters as possible. Prefer GNU sed if found. m4_defun([_LT_DECL_SED], [AC_PROG_SED test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" _LT_DECL([], [SED], [1], [A sed program that does not truncate output]) _LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], [Sed that helps us avoid accidentally triggering echo(1) options like -n]) ])# _LT_DECL_SED m4_ifndef([AC_PROG_SED], [ ############################################################ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_SED. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # ############################################################ m4_defun([AC_PROG_SED], [AC_MSG_CHECKING([for a sed that does not truncate output]) AC_CACHE_VAL(lt_cv_path_SED, [# Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done IFS=$as_save_IFS lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do test ! -f $lt_ac_sed && continue cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in # Check for GNU sed and select it if it is found. if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then lt_cv_path_SED=$lt_ac_sed break fi while true; do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo >>conftest.nl $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break cmp -s conftest.out conftest.nl || break # 10000 chars as input seems more than enough test $lt_ac_count -gt 10 && break lt_ac_count=`expr $lt_ac_count + 1` if test $lt_ac_count -gt $lt_ac_max; then lt_ac_max=$lt_ac_count lt_cv_path_SED=$lt_ac_sed fi done done ]) SED=$lt_cv_path_SED AC_SUBST([SED]) AC_MSG_RESULT([$SED]) ])#AC_PROG_SED ])#m4_ifndef # Old name: AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_SED], []) # _LT_CHECK_SHELL_FEATURES # ------------------------ # Find out whether the shell is Bourne or XSI compatible, # or has some other useful features. m4_defun([_LT_CHECK_SHELL_FEATURES], [AC_MSG_CHECKING([whether the shell understands some XSI constructs]) # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ = c,a/b,b/c, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes AC_MSG_RESULT([$xsi_shell]) _LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell']) AC_MSG_CHECKING([whether the shell understands "+="]) lt_shell_append=no ( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \ >/dev/null 2>&1 \ && lt_shell_append=yes AC_MSG_RESULT([$lt_shell_append]) _LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append']) if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi _LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac _LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl _LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl ])# _LT_CHECK_SHELL_FEATURES # _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY) # ------------------------------------------------------ # In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and # '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY. m4_defun([_LT_PROG_FUNCTION_REPLACE], [dnl { sed -e '/^$1 ()$/,/^} # $1 /c\ $1 ()\ {\ m4_bpatsubsts([$2], [$], [\\], [^\([ ]\)], [\\\1]) } # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: ]) # _LT_PROG_REPLACE_SHELLFNS # ------------------------- # Replace existing portable implementations of several shell functions with # equivalent extended shell implementations where those features are available.. m4_defun([_LT_PROG_REPLACE_SHELLFNS], [if test x"$xsi_shell" = xyes; then _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac]) _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl func_basename_result="${1##*/}"]) _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac func_basename_result="${1##*/}"]) _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are # positional parameters, so assign one to ordinary parameter first. func_stripname_result=${3} func_stripname_result=${func_stripname_result#"${1}"} func_stripname_result=${func_stripname_result%"${2}"}]) _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl func_split_long_opt_name=${1%%=*} func_split_long_opt_arg=${1#*=}]) _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl func_split_short_opt_arg=${1#??} func_split_short_opt_name=${1%"$func_split_short_opt_arg"}]) _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl case ${1} in *.lo) func_lo2o_result=${1%.lo}.${objext} ;; *) func_lo2o_result=${1} ;; esac]) _LT_PROG_FUNCTION_REPLACE([func_xform], [ func_xform_result=${1%.*}.lo]) _LT_PROG_FUNCTION_REPLACE([func_arith], [ func_arith_result=$(( $[*] ))]) _LT_PROG_FUNCTION_REPLACE([func_len], [ func_len_result=${#1}]) fi if test x"$lt_shell_append" = xyes; then _LT_PROG_FUNCTION_REPLACE([func_append], [ eval "${1}+=\\${2}"]) _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl func_quote_for_eval "${2}" dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \ eval "${1}+=\\\\ \\$func_quote_for_eval_result"]) # Save a `func_append' function call where possible by direct use of '+=' sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: else # Save a `func_append' function call even when '+=' is not available sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$_lt_function_replace_fail" = x":"; then AC_MSG_WARN([Unable to substitute extended shell functions in $ofile]) fi ]) # _LT_PATH_CONVERSION_FUNCTIONS # ----------------------------- # Determine which file name conversion functions should be used by # func_to_host_file (and, implicitly, by func_to_host_path). These are needed # for certain cross-compile configurations and native mingw. m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_MSG_CHECKING([how to convert $build file names to $host format]) AC_CACHE_VAL(lt_cv_to_host_file_cmd, [case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac ]) to_host_file_cmd=$lt_cv_to_host_file_cmd AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) _LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], [0], [convert $build file names to $host format])dnl AC_MSG_CHECKING([how to convert $build file names to toolchain format]) AC_CACHE_VAL(lt_cv_to_tool_file_cmd, [#assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac ]) to_tool_file_cmd=$lt_cv_to_tool_file_cmd AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) _LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], [0], [convert $build files to toolchain format])dnl ])# _LT_PATH_CONVERSION_FUNCTIONS modsecurity-apache_2.7.7/build/find_xml.m40000664000175000017500000000543612252374147021013 0ustar zimmerlezimmerlednl Check for LIBXML2 Libraries dnl CHECK_LIBXML2(ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]) dnl Sets: dnl LIBXML2_CFLAGS dnl LIBXML2_LIBS LIBXML2_CONFIG="" LIBXML2_VERSION="" LIBXML2_CFLAGS="" LIBXML2_CPPFLAGS="" LIBXML2_LDADD="" LIBXML2_LDFLAGS="" AC_DEFUN([CHECK_LIBXML2], [dnl AC_ARG_WITH( libxml, [AC_HELP_STRING([--with-libxml=PATH],[Path to libxml2 prefix or config script])], [test_paths="${with_libxml}"], [test_paths="/usr/local/libxml2 /usr/local/xml2 /usr/local/xml /usr/local /opt/libxml2 /opt/libxml /opt/xml2 /opt/xml /opt /usr"]) AC_MSG_CHECKING([for libxml2 config script]) for x in ${test_paths}; do dnl # Determine if the script was specified and use it directly if test ! -d "$x" -a -e "$x"; then LIBXML2_CONFIG=$x libxml2_path="no" break fi dnl # Try known config script names/locations for LIBXML2_CONFIG in xml2-config xml-2-config xml-config; do if test -e "${x}/bin/${LIBXML2_CONFIG}"; then libxml2_path="${x}/bin" break elif test -e "${x}/${LIBXML2_CONFIG}"; then libxml2_path="${x}" break else libxml2_path="" fi done if test -n "$libxml2_path"; then break fi done if test -n "${libxml2_path}"; then if test "${libxml2_path}" != "no"; then LIBXML2_CONFIG="${libxml2_path}/${LIBXML2_CONFIG}" fi AC_MSG_RESULT([${LIBXML2_CONFIG}]) LIBXML2_VERSION=`${LIBXML2_CONFIG} --version | sed 's/^[[^0-9]][[^[:space:]]][[^[:space:]]]*[[[:space:]]]*//'` if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(xml VERSION: $LIBXML2_VERSION); fi LIBXML2_CFLAGS="`${LIBXML2_CONFIG} --cflags`" if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(xml CFLAGS: $LIBXML2_CFLAGS); fi LIBXML2_LDADD="`${LIBXML2_CONFIG} --libs`" if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(xml LDADD: $LIBXML2_LDADD); fi AC_MSG_CHECKING([if libxml2 is at least v2.6.29]) libxml2_min_ver=`echo 2.6.29 | awk -F. '{print (\$ 1 * 1000000) + (\$ 2 * 1000) + \$ 3}'` libxml2_ver=`echo ${LIBXML2_VERSION} | awk -F. '{print (\$ 1 * 1000000) + (\$ 2 * 1000) + \$ 3}'` if test "$libxml2_ver" -ge "$libxml2_min_ver"; then AC_MSG_RESULT([yes, $LIBXML2_VERSION]) else AC_MSG_RESULT([no, $LIBXML2_VERSION]) AC_MSG_ERROR([NOTE: libxml2 library must be at least 2.6.29]) fi else AC_MSG_RESULT([no]) fi AC_SUBST(LIBXML2_CONFIG) AC_SUBST(LIBXML2_VERSION) AC_SUBST(LIBXML2_CFLAGS) AC_SUBST(LIBXML2_CPPFLAGS) AC_SUBST(LIBXML2_LDADD) AC_SUBST(LIBXML2_LDFLAGS) if test -z "${LIBXML2_VERSION}"; then AC_MSG_NOTICE([*** xml library not found.]) ifelse([$2], , AC_MSG_ERROR([libxml2 is required]), $2) else AC_MSG_NOTICE([using libxml2 v${LIBXML2_VERSION}]) ifelse([$1], , , $1) fi ]) modsecurity-apache_2.7.7/build/find_apu.m40000664000175000017500000000516212243422537020771 0ustar zimmerlezimmerlednl Check for APU Libraries dnl CHECK_APU(ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]) dnl Sets: dnl APU_CFLAGS dnl APU_LDFLAGS dnl APU_LIBS dnl APU_LINK_LD APU_CONFIG="" APU_CFLAGS="" APU_LDFLAGS="" APU_LDADD="" APU_INCLUDEDIR="" APU_LINKLD="" AC_DEFUN([CHECK_APU], [dnl AC_ARG_WITH( apu, [AC_HELP_STRING([--with-apu=PATH],[Path to apu prefix or config script])], [test_paths="${with_apu}"], [test_paths="/usr/local/libapr-util /usr/local/apr-util /usr/local/libapu /usr/local/apu /usr/local/apr /usr/local /opt/libapr-util /opt/apr-util /opt/libapu /opt/apu /opt /usr"]) AC_MSG_CHECKING([for libapu config script]) for x in ${test_paths}; do dnl # Determine if the script was specified and use it directly if test ! -d "$x" -a -e "$x"; then APU_CONFIG=$x apu_path="no" break fi dnl # Try known config script names/locations for APU_CONFIG in apu-1-mt-config apu-1-config apu-config-1 apu-mt-config-1 apu-mt-config apu-config; do if test -e "${x}/bin/${APU_CONFIG}"; then apu_path="${x}/bin" break elif test -e "${x}/${APU_CONFIG}"; then apu_path="${x}" break else apu_path="" fi done if test -n "$apu_path"; then break fi done if test -n "${apu_path}"; then if test "${apu_path}" != "no"; then APU_CONFIG="${apu_path}/${APU_CONFIG}" fi AC_MSG_RESULT([${APU_CONFIG}]) APU_VERSION="`${APU_CONFIG} --version`" if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(apu VERSION: $APU_VERSION); fi APU_CFLAGS="`${APU_CONFIG} --includes`" if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(apu CFLAGS: $APU_CFLAGS); fi APU_LDFLAGS="`${APU_CONFIG} --libs`" if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(apu LDFLAGS: $APU_LDFLAGS); fi APU_LDADD="`${APU_CONFIG} --link-libtool`" if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(apu LDADD: $APU_LDADD); fi APU_INCLUDEDIR="`${APU_CONFIG} --includedir`" if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(apu INCLUDEDIR: $APU_INCLUDEDIR); fi APU_LINKLD="`${APU_CONFIG} --link-ld`" if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(apu LINKLD: $APU_LINKLD); fi else AC_MSG_RESULT([no]) fi AC_SUBST(APU_CONFIG) AC_SUBST(APU_VERSION) AC_SUBST(APU_CFLAGS) AC_SUBST(APU_LDFLAGS) AC_SUBST(APU_LDADD) AC_SUBST(APU_INCLUDEDIR) AC_SUBST(APU_LINKLD) if test -z "${APU_VERSION}"; then AC_MSG_NOTICE([*** apu library not found.]) ifelse([$2], , AC_MSG_ERROR([apu library is required]), $2) else AC_MSG_NOTICE([using apu v${APU_VERSION}]) ifelse([$1], , , $1) fi ]) modsecurity-apache_2.7.7/build/find_apr.m40000664000175000017500000000530412243422537020764 0ustar zimmerlezimmerlednl Check for APR Libraries dnl CHECK_APR(ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]) dnl Sets: dnl APR_CFLAGS dnl APR_LDFLAGS dnl APR_LIBS dnl APR_LINK_LD APR_CONFIG="" APR_CFLAGS="" APR_CPPFLAGS="" APR_LDFLAGS="" APR_LDADD="" APR_INCLUDEDIR="" APR_LINKLD="" AC_DEFUN([CHECK_APR], [dnl AC_ARG_WITH( apr, [AC_HELP_STRING([--with-apr=PATH],[Path to apr prefix or config script])], [test_paths="${with_apr}"], [test_paths="/usr/local/libapr /usr/local/apr /usr/local /opt/libapr /opt/apr /opt /usr"]) AC_MSG_CHECKING([for libapr config script]) for x in ${test_paths}; do dnl # Determine if the script was specified and use it directly if test ! -d "$x" -a -e "$x"; then APR_CONFIG=$x apr_path=no break fi dnl # Try known config script names/locations for APR_CONFIG in apr-1-mt-config apr-1-config apr-config-1 apr-mt-config-1 apr-mt-config apr-config; do if test -e "${x}/bin/${APR_CONFIG}"; then apr_path="${x}/bin" break elif test -e "${x}/${APR_CONFIG}"; then apr_path="${x}" break else apr_path="" fi done if test -n "$apr_path"; then break fi done if test -n "${apr_path}"; then if test "${apr_path}" != "no"; then APR_CONFIG="${apr_path}/${APR_CONFIG}" fi AC_MSG_RESULT([${APR_CONFIG}]) APR_VERSION="`${APR_CONFIG} --version`" if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(apr VERSION: $APR_VERSION); fi APR_CFLAGS="`${APR_CONFIG} --includes`" if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(apr CFLAGS: $APR_CFLAGS); fi APR_CPPFLAGS="`${APR_CONFIG} --cppflags`" if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(apr CPPFLAGS: $APR_CPPFLAGS); fi APR_LDFLAGS="`${APR_CONFIG} --libs`" if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(apr LDFLAGS: $APR_LDFLAGS); fi APR_LDADD="`${APR_CONFIG} --link-libtool`" if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(apr LDADD: $APR_LDADD); fi APR_INCLUDEDIR="`${APR_CONFIG} --includedir`" if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(apr INCLUDEDIR: $APR_INCLUDEDIR); fi APR_LINKLD="`${APR_CONFIG} --link-ld`" if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(apr LINKLD: $APR_LINKLD); fi else AC_MSG_RESULT([no]) fi AC_SUBST(APR_CONFIG) AC_SUBST(APR_VERSION) AC_SUBST(APR_CFLAGS) AC_SUBST(APR_CPPFLAGS) AC_SUBST(APR_LDFLAGS) AC_SUBST(APR_LDADD) AC_SUBST(APR_INCLUDEDIR) AC_SUBST(APR_LINKLD) if test -z "${APR_VERSION}"; then AC_MSG_NOTICE([*** apr library not found.]) ifelse([$2], , AC_MSG_ERROR([apr library is required]), $2) else AC_MSG_NOTICE([using apr v${APR_VERSION}]) ifelse([$1], , , $1) fi ]) modsecurity-apache_2.7.7/build/find_curl.m40000664000175000017500000000615012243422537021147 0ustar zimmerlezimmerlednl Check for CURL Libraries dnl CHECK_CURL(ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]) dnl Sets: dnl CURL_CFLAGS dnl CURL_LIBS CURL_CONFIG="" CURL_VERSION="" CURL_CPPFLAGS="" CURL_CFLAGS="" CURL_LDFLAGS="" CURL_LDADD="" CURL_MIN_VERSION="7.15.1" AC_DEFUN([CHECK_CURL], [dnl AC_ARG_WITH( curl, [AC_HELP_STRING([--with-curl=PATH],[Path to curl prefix or config script])], [test_paths="${with_curl}"], [test_paths="/usr/local/libcurl /usr/local/curl /usr/local /opt/libcurl /opt/curl /opt /usr"]) AC_MSG_CHECKING([for libcurl config script]) for x in ${test_paths}; do dnl # Determine if the script was specified and use it directly if test ! -d "$x" -a -e "$x"; then CURL_CONFIG=$x curl_path="no" break fi dnl # Try known config script names/locations for CURL_CONFIG in curl-config; do if test -e "${x}/bin/${CURL_CONFIG}"; then curl_path="${x}/bin" break elif test -e "${x}/${CURL_CONFIG}"; then curl_path="${x}" break else curl_path="" fi done if test -n "$curl_path"; then break fi done if test -n "${curl_path}"; then if test "${curl_path}" != "no"; then CURL_CONFIG="${curl_path}/${CURL_CONFIG}" fi AC_MSG_RESULT([${CURL_CONFIG}]) CURL_VERSION=`${CURL_CONFIG} --version | sed 's/^[[^0-9]][[^[:space:]]][[^[:space:]]]*[[[:space:]]]*//'` if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(curl VERSION: $CURL_VERSION); fi CURL_CFLAGS="`${CURL_CONFIG} --cflags`" if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(curl CFLAGS: $CURL_CFLAGS); fi CURL_LDADD="`${CURL_CONFIG} --libs`" if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(curl LDADD: $CURL_LIBS); fi dnl # Check version is ok AC_MSG_CHECKING([if libcurl is at least v${CURL_MIN_VERSION}]) curl_min_ver=`echo ${CURL_MIN_VERSION} | awk -F. '{print (\$ 1 * 1000000) + (\$ 2 * 1000) + \$ 3}'` curl_ver=`echo ${CURL_VERSION} | awk -F. '{print (\$ 1 * 1000000) + (\$ 2 * 1000) + \$ 3}'` if test "$curl_min_ver" -le "$curl_ver"; then AC_MSG_RESULT([yes, $CURL_VERSION]) else AC_MSG_RESULT([no, $CURL_VERSION]) AC_MSG_NOTICE([NOTE: curl library may be too old]) fi dnl # Check/warn if GnuTLS is used AC_MSG_CHECKING([if libcurl is linked with gnutls]) curl_uses_gnutls=`echo ${CURL_LIBS} | grep gnutls | wc -l` if test "$curl_uses_gnutls" -ne 0; then AC_MSG_RESULT([yes]) AC_MSG_NOTICE([NOTE: curl linked with gnutls may be buggy, openssl recommended]) CURL_USES_GNUTLS=yes else AC_MSG_RESULT([no]) CURL_USES_GNUTLS=no fi else AC_MSG_RESULT([no]) fi AC_SUBST(CURL_CONFIG) AC_SUBST(CURL_VERSION) AC_SUBST(CURL_CPPFLAGS) AC_SUBST(CURL_CFLAGS) AC_SUBST(CURL_LDFLAGS) AC_SUBST(CURL_LDADD) AC_SUBST(CURL_USES_GNUTLS) if test -z "${CURL_VERSION}"; then AC_MSG_NOTICE([*** curl library not found.]) ifelse([$2], , AC_MSG_NOTICE([NOTE: curl library is only required for building mlogc]), $2) else AC_MSG_NOTICE([using curl v${CURL_VERSION}]) ifelse([$1], , , $1) fi ]) modsecurity-apache_2.7.7/standalone/0000775000175000017500000000000012254306021017756 5ustar zimmerlezimmerlemodsecurity-apache_2.7.7/standalone/hooks.c0000664000175000017500000000426712243422537021267 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #include #include "http_core.h" #include "http_request.h" #include "modsecurity.h" #include "apache2.h" #include "http_main.h" #include "http_connection.h" #include "apr_optional.h" #include "mod_log_config.h" #include "msc_logging.h" #include "msc_util.h" #include "ap_mpm.h" #include "scoreboard.h" #include "apr_version.h" #include "apr_lib.h" #include "ap_config.h" #include "http_config.h" #define DECLARE_EXTERNAL_HOOK(ns,link,ret,name,args) \ ns##_HOOK_##name##_t *hookfn_##name = NULL; \ link##_DECLARE(void) ns##_hook_##name(ns##_HOOK_##name##_t *pf, \ const char * const *aszPre, \ const char * const *aszSucc, int nOrder) \ { \ hookfn_##name = pf; \ } #define DECLARE_HOOK(ret,name,args) \ DECLARE_EXTERNAL_HOOK(ap,AP,ret,name,args) DECLARE_HOOK(int,pre_config,(apr_pool_t *pconf,apr_pool_t *plog, apr_pool_t *ptemp)) DECLARE_HOOK(int,post_config,(apr_pool_t *pconf,apr_pool_t *plog, apr_pool_t *ptemp,server_rec *s)) DECLARE_HOOK(void,child_init,(apr_pool_t *pchild, server_rec *s)) DECLARE_HOOK(int,process_connection,(conn_rec *c)) DECLARE_HOOK(int,post_read_request,(request_rec *r)) DECLARE_HOOK(int,fixups,(request_rec *r)) DECLARE_HOOK(void, error_log, (const char *file, int line, int level, apr_status_t status, const server_rec *s, const request_rec *r, apr_pool_t *pool, const char *errstr)) DECLARE_HOOK(int,log_transaction,(request_rec *r)) DECLARE_HOOK(void,insert_filter,(request_rec *r)) DECLARE_HOOK(void,insert_error_filter,(request_rec *r)) modsecurity-apache_2.7.7/standalone/standalone.vcxproj.filters0000664000175000017500000001604712243422537025213 0ustar zimmerlezimmerle {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms {93995380-89BD-4b04-88EB-625FBE52EBFB} h;hpp;hxx;hm;inl;inc;xsd {4FC737F1-C7A5-4376-A066-2A32D752A2FF} cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx {2d4a2f57-e994-4dad-888a-e61a65029abf} ModSecurity Sources ModSecurity Sources ModSecurity Sources ModSecurity Sources ModSecurity Sources ModSecurity Sources ModSecurity Sources ModSecurity Sources ModSecurity Sources ModSecurity Sources ModSecurity Sources ModSecurity Sources ModSecurity Sources ModSecurity Sources ModSecurity Sources ModSecurity Sources ModSecurity Sources ModSecurity Sources ModSecurity Sources ModSecurity Sources ModSecurity Sources ModSecurity Sources ModSecurity Sources ModSecurity Sources Standalone Sources Standalone Sources Standalone Sources Standalone Sources Standalone Sources Standalone Sources Standalone Sources Standalone Sources ModSecurity Sources ModSecurity Sources ModSecurity Headers ModSecurity Headers ModSecurity Headers ModSecurity Headers ModSecurity Headers ModSecurity Headers ModSecurity Headers ModSecurity Headers ModSecurity Headers ModSecurity Headers ModSecurity Headers ModSecurity Headers ModSecurity Headers ModSecurity Headers ModSecurity Headers ModSecurity Headers ModSecurity Headers ModSecurity Headers ModSecurity Headers Standalone Sources ModSecurity Headers ModSecurity Headers modsecurity-apache_2.7.7/standalone/modules.mk0000664000175000017500000000137712243422537022000 0ustar zimmerlezimmerleMOD_SECURITY2 = mod_security2 apache2_config apache2_io apache2_util \ re re_operators re_actions re_tfns re_variables \ msc_logging msc_xml msc_multipart modsecurity msc_parsers msc_util msc_pcre \ persist_dbm msc_reqbody pdf_protect msc_geo msc_gsb msc_unicode acmp msc_lua H = re.h modsecurity.h msc_logging.h msc_multipart.h msc_parsers.h \ msc_pcre.h msc_util.h msc_xml.h persist_dbm.h apache2.h pdf_protect.h \ msc_geo.h msc_gsb.h msc_unicode.h acmp.h utf8tables.h msc_lua.h ${MOD_SECURITY2:=.slo}: ${H} ${MOD_SECURITY2:=.lo}: ${H} ${MOD_SECURITY2:=.o}: ${H} mod_security2.la: ${MOD_SECURITY2:=.slo} $(SH_LINK) -rpath $(libexecdir) -module -avoid-version ${MOD_SECURITY2:=.lo} DISTCLEAN_TARGETS = modules.mk shared = mod_security2.la modsecurity-apache_2.7.7/standalone/api.h0000664000175000017500000000667012243422537020722 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #pragma once #include #include "http_core.h" #include "http_request.h" #include "modsecurity.h" #include "apache2.h" #include "http_main.h" #include "http_connection.h" #include "apr_optional.h" #include "mod_log_config.h" #include "msc_logging.h" #include "msc_util.h" #include "ap_mpm.h" #include "scoreboard.h" #include "apr_version.h" #include "apr_lib.h" #include "ap_config.h" #include "http_config.h" #ifdef __cplusplus extern "C" { #endif server_rec *modsecInit(); void modsecTerminate(); void modsecStartConfig(); directory_config *modsecGetDefaultConfig(); const char *modsecProcessConfig(directory_config *config, const char *file, const char *dir); void modsecFinalizeConfig(); void modsecInitProcess(); conn_rec *modsecNewConnection(); void modsecProcessConnection(conn_rec *c); request_rec *modsecNewRequest(conn_rec *connection, directory_config *config); int modsecProcessRequestBody(request_rec *r); int modsecProcessRequestHeaders(request_rec *r); static inline int modsecProcessRequest(request_rec *r) { int status; status = modsecProcessRequestHeaders(r); if (status != DECLINED) { return status; } return modsecProcessRequestBody(r); } int modsecProcessResponse(request_rec *r); int modsecFinishRequest(request_rec *r); void modsecSetLogHook(void *obj, void (*hook)(void *obj, int level, char *str)); #define NOTE_MSR_BRIGADE_REQUEST "modsecurity-brigade-request" #define NOTE_MSR_BRIGADE_RESPONSE "modsecurity-brigade-response" static inline void modsecSetBodyBrigade(request_rec *r, apr_bucket_brigade *b) { apr_table_setn(r->notes, NOTE_MSR_BRIGADE_REQUEST, (char *)b); }; static inline apr_bucket_brigade * modsecGetBodyBrigade(request_rec *r) { return (apr_bucket_brigade *)apr_table_get(r->notes, NOTE_MSR_BRIGADE_REQUEST); }; static inline void modsecSetResponseBrigade(request_rec *r, apr_bucket_brigade *b) { apr_table_setn(r->notes, NOTE_MSR_BRIGADE_RESPONSE, (char *)b); }; static inline apr_bucket_brigade * modsecGetResponseBrigade(request_rec *r) { return (apr_bucket_brigade *)apr_table_get(r->notes, NOTE_MSR_BRIGADE_RESPONSE); }; void modsecSetReadBody(apr_status_t (*func)(request_rec *r, char *buf, unsigned int length, unsigned int *readcnt, int *is_eos)); void modsecSetReadResponse(apr_status_t (*func)(request_rec *r, char *buf, unsigned int length, unsigned int *readcnt, int *is_eos)); void modsecSetWriteBody(apr_status_t (*func)(request_rec *r, char *buf, unsigned int length)); void modsecSetWriteResponse(apr_status_t (*func)(request_rec *r, char *buf, unsigned int length)); void modsecSetDropAction(int (*func)(request_rec *r)); int modsecIsResponseBodyAccessEnabled(request_rec *r); int modsecIsRequestBodyAccessEnabled(request_rec *r); void modsecSetConfigForIISRequestBody(request_rec *r); #ifdef __cplusplus } #endif modsecurity-apache_2.7.7/standalone/standalone.sln0000664000175000017500000000233012243422537022633 0ustar zimmerlezimmerle Microsoft Visual Studio Solution File, Format Version 11.00 # Visual Studio 2010 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "standalone", "standalone.vcxproj", "{20EC871F-B6A0-4398-9B67-A33598A796E8}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 Release|Win32 = Release|Win32 Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {20EC871F-B6A0-4398-9B67-A33598A796E8}.Debug|Win32.ActiveCfg = Debug|Win32 {20EC871F-B6A0-4398-9B67-A33598A796E8}.Debug|Win32.Build.0 = Debug|Win32 {20EC871F-B6A0-4398-9B67-A33598A796E8}.Debug|x64.ActiveCfg = Debug|x64 {20EC871F-B6A0-4398-9B67-A33598A796E8}.Debug|x64.Build.0 = Debug|x64 {20EC871F-B6A0-4398-9B67-A33598A796E8}.Release|Win32.ActiveCfg = Release|Win32 {20EC871F-B6A0-4398-9B67-A33598A796E8}.Release|Win32.Build.0 = Release|Win32 {20EC871F-B6A0-4398-9B67-A33598A796E8}.Release|x64.ActiveCfg = Release|x64 {20EC871F-B6A0-4398-9B67-A33598A796E8}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal modsecurity-apache_2.7.7/standalone/Makefile.am0000664000175000017500000000617212253711345022030 0ustar zimmerlezimmerlepkglibdir = $(prefix)/lib pkglib_LTLIBRARIES = standalone.la standalone_la_SOURCES = ../apache2/acmp.c \ ../apache2/apache2_config.c \ ../apache2/apache2_io.c \ ../apache2/apache2_util.c \ ../apache2/libinjection/libinjection_sqli.c \ ../apache2/mod_security2.c \ ../apache2/modsecurity.c \ ../apache2/msc_crypt.c \ ../apache2/msc_geo.c \ ../apache2/msc_gsb.c \ ../apache2/msc_logging.c \ ../apache2/msc_lua.c \ ../apache2/msc_multipart.c \ ../apache2/msc_parsers.c \ ../apache2/msc_pcre.c \ ../apache2/msc_release.c \ ../apache2/msc_reqbody.c \ ../apache2/msc_tree.c \ ../apache2/msc_unicode.c \ ../apache2/msc_util.c \ ../apache2/msc_xml.c \ ../apache2/persist_dbm.c \ ../apache2/re_actions.c \ ../apache2/re.c \ ../apache2/re_operators.c \ ../apache2/re_tfns.c \ ../apache2/re_variables.c \ api.c \ buckets.c \ config.c \ filters.c \ hooks.c \ regex.c \ server.c # FIXME: Standalone does not mean that it will be a nginx build. standalone_la_CFLAGS = -DVERSION_NGINX \ @APR_CFLAGS@ \ @APU_CFLAGS@ \ @APXS_CFLAGS@ \ @CURL_CFLAGS@ \ @LIBXML2_CFLAGS@ \ @LUA_CFLAGS@ \ @MODSEC_EXTRA_CFLAGS@ \ @PCRE_CFLAGS@ standalone_la_CPPFLAGS = @APR_CPPFLAGS@ \ @LIBXML2_CPPFLAGS@ \ @PCRE_CPPFLAGS@ standalone_la_LIBADD = @APR_LDADD@ \ @APU_LDADD@ \ @LIBXML2_LDADD@ \ @LUA_LDADD@ \ @PCRE_LDADD@ if AIX standalone_la_LDFLAGS = -module -avoid-version \ @APR_LDFLAGS@ \ @APU_LDFLAGS@ \ @APXS_LDFLAGS@ \ @LIBXML2_LDFLAGS@ \ @LUA_LDFLAGS@ \ @PCRE_LDFLAGS@ endif if HPUX standalone_la_LDFLAGS = -module -avoid-version \ @APR_LDFLAGS@ \ @APU_LDFLAGS@ \ @APXS_LDFLAGS@ \ @LIBXML2_LDFLAGS@ \ @LUA_LDFLAGS@ \ @PCRE_LDFLAGS@ endif if MACOSX standalone_la_LDFLAGS = -module -avoid-version \ @APR_LDFLAGS@ \ @APU_LDFLAGS@ \ @APXS_LDFLAGS@ \ @LIBXML2_LDFLAGS@ \ @LUA_LDFLAGS@ \ @PCRE_LDFLAGS@ endif if SOLARIS standalone_la_LDFLAGS = -module -avoid-version \ @APR_LDFLAGS@ \ @APU_LDFLAGS@ \ @APXS_LDFLAGS@ \ @LIBXML2_LDFLAGS@ \ @LUA_LDFLAGS@ \ @PCRE_LDFLAGS@ endif if LINUX standalone_la_LDFLAGS = -no-undefined -module -avoid-version \ @APR_LDFLAGS@ \ @APU_LDFLAGS@ \ @APXS_LDFLAGS@ \ @LIBXML2_LDFLAGS@ \ @LUA_LDFLAGS@ \ @PCRE_LDFLAGS@ endif if FREEBSD standalone_la_LDFLAGS = -no-undefined -module -avoid-version \ @APR_LDFLAGS@ \ @APU_LDFLAGS@ \ @APXS_LDFLAGS@ \ @LIBXML2_LDFLAGS@ \ @LUA_LDFLAGS@ \ @PCRE_LDFLAGS@ endif if OPENBSD standalone_la_LDFLAGS = -no-undefined -module -avoid-version \ @APR_LDFLAGS@ \ @APU_LDFLAGS@ \ @APXS_LDFLAGS@ \ @LIBXML2_LDFLAGS@ \ @LUA_LDFLAGS@ \ @PCRE_LDFLAGS@ endif if NETBSD standalone_la_LDFLAGS = -no-undefined -module -avoid-version \ @APR_LDFLAGS@ \ @APU_LDFLAGS@ \ @APXS_LDFLAGS@ \ @LIBXML2_LDFLAGS@ \ @LUA_LDFLAGS@ \ @PCRE_LDFLAGS@ endif modsecurity-apache_2.7.7/standalone/standalone.vcxproj0000664000175000017500000003563012243422537023543 0ustar zimmerlezimmerle Debug Win32 Debug x64 Release Win32 Release x64 {20EC871F-B6A0-4398-9B67-A33598A796E8} standalone Application true MultiByte Application true MultiByte Application false true MultiByte Application false true MultiByte Level3 Disabled C:\work\pcre-8.30\include;C:\work\pcre-8.30;C:\work\libxml2-2.7.7\include;C:\apache22\include;..\apache2;c:\work\apache24\include _MBCS;%(PreprocessorDefinitions);WIN32;WINNT;inline=APR_INLINE;AP_DECLARE_STATIC;VERSION_STANDALONE 4244;4018 true kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;ws2_32.lib;%(AdditionalDependencies);libapr-1.lib;libaprutil-1.lib;pcre.lib;libxml2.lib c:\drop\x86 Level3 Disabled C:\work\pcre-8.30\include;C:\work\pcre-8.30;C:\work\libxml2-2.7.7\include;C:\apache22\include;..\apache2 _MBCS;%(PreprocessorDefinitions);WIN32;WINNT;inline=APR_INLINE;AP_DECLARE_STATIC 4244;4018 true kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;ws2_32.lib;%(AdditionalDependencies);libapr-1.lib;libaprutil-1.lib;pcre.lib;libxml2.lib c:\drop\amd64 Level3 MaxSpeed true true C:\work\pcre-8.30\include;C:\work\pcre-8.30;C:\work\libxml2-2.7.7\include;C:\apache22\include;..\apache2 true true true kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;ws2_32.lib;%(AdditionalDependencies);libapr-1.lib;libaprutil-1.lib;pcre.lib;libxml2.lib c:\drop\x86 Level3 MaxSpeed true true C:\work\pcre-8.30\include;C:\work\pcre-8.30;C:\work\libxml2-2.7.7\include;C:\apache22\include;..\apache2 true true true kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;ws2_32.lib;%(AdditionalDependencies);libapr-1.lib;libaprutil-1.lib;pcre.lib;libxml2.lib c:\drop\amd64 C:\work\pcre-8.30\include;C:\work\pcre-8.30;C:\work\libxml2-2.7.7\include;C:\apache22\include;;..\apache2 C:\work\pcre-8.30\include;C:\work\pcre-8.30;C:\work\libxml2-2.7.7\include;C:\apache22\include;;..\apache2 C:\work\pcre-8.30\include;C:\work\pcre-8.30;C:\work\libxml2-2.7.7\include;C:\apache22\include;;..\apache2 C:\work\pcre-8.30\include;C:\work\pcre-8.30;C:\work\libxml2-2.7.7\include;C:\apache22\include;..\apache2 C:\work\pcre-8.30\include;C:\work\pcre-8.30;C:\work\libxml2-2.7.7\include;C:\apache22\include;..\apache2 C:\work\pcre-8.30\include;C:\work\pcre-8.30;C:\work\libxml2-2.7.7\include;C:\apache22\include;..\apache2 C:\work\pcre-8.30\include;C:\work\pcre-8.30;C:\work\libxml2-2.7.7\include;C:\apache22\include;..\apache2 C:\work\pcre-8.30\include;C:\work\pcre-8.30;C:\work\libxml2-2.7.7\include;C:\apache22\include;..\apache2 C:\work\pcre-8.30\include;C:\work\pcre-8.30;C:\work\libxml2-2.7.7\include;C:\apache22\include;..\apache2 C:\work\pcre-8.30\include;C:\work\pcre-8.30;C:\work\libxml2-2.7.7\include;C:\apache22\include;..\apache2 C:\work\pcre-8.30\include;C:\work\pcre-8.30;C:\work\libxml2-2.7.7\include;C:\apache22\include;..\apache2 C:\work\pcre-8.30\include;C:\work\pcre-8.30;C:\work\libxml2-2.7.7\include;C:\apache22\include;..\apache2 C:\work\pcre-8.30\include;C:\work\pcre-8.30;C:\work\libxml2-2.7.7\include;C:\apache22\include;..\apache2 C:\work\pcre-8.30\include;C:\work\pcre-8.30;C:\work\libxml2-2.7.7\include;C:\apache22\include;..\apache2 C:\work\pcre-8.30\include;C:\work\pcre-8.30;C:\work\libxml2-2.7.7\include;C:\apache22\include;..\apache2 C:\work\pcre-8.30\include;C:\work\pcre-8.30;C:\work\libxml2-2.7.7\include;C:\apache22\include;..\apache2 C:\work\pcre-8.30\include;C:\work\pcre-8.30;C:\work\libxml2-2.7.7\include;C:\apache22\include;..\apache2 C:\work\pcre-8.30\include;C:\work\pcre-8.30;C:\work\libxml2-2.7.7\include;C:\apache22\include;..\apache2 modsecurity-apache_2.7.7/standalone/filters.c0000664000175000017500000001614312243422537021610 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #include #include "http_core.h" #include "http_request.h" #include "modsecurity.h" #include "apache2.h" #include "http_main.h" #include "http_connection.h" #include "apr_optional.h" #include "mod_log_config.h" #include "msc_logging.h" #include "msc_util.h" #include "ap_mpm.h" #include "scoreboard.h" #include "apr_version.h" #include "apr_lib.h" #include "ap_config.h" #include "http_config.h" #define FILTER_POOL apr_hook_global_pool #include "apr_hooks.h" /* ** This macro returns true/false if a given filter should be inserted BEFORE ** another filter. This will happen when one of: 1) there isn't another ** filter; 2) that filter has a higher filter type (class); 3) that filter ** corresponds to a different request. */ #define INSERT_BEFORE(f, before_this) ((before_this) == NULL \ || (before_this)->frec->ftype > (f)->frec->ftype \ || (before_this)->r != (f)->r) apr_table_t *ms_input_filters = NULL; apr_table_t *ms_output_filters = NULL; void init_filter_tables() { if(ms_input_filters == NULL) { ms_input_filters = apr_table_make(FILTER_POOL, 10); ms_output_filters = apr_table_make(FILTER_POOL, 10); } } AP_DECLARE(ap_filter_rec_t *) ap_register_input_filter(const char *name, ap_in_filter_func filter_func, ap_init_filter_func filter_init, ap_filter_type ftype) { ap_filter_rec_t *f; init_filter_tables(); f = apr_palloc(FILTER_POOL, sizeof(ap_filter_rec_t)); f->filter_func.in_func = filter_func; f->filter_init_func = filter_init; f->ftype = ftype; f->name = name; apr_table_setn(ms_input_filters, name, (const char *)f); return f; } AP_DECLARE(ap_filter_rec_t *) ap_register_output_filter(const char *name, ap_out_filter_func filter_func, ap_init_filter_func filter_init, ap_filter_type ftype) { ap_filter_rec_t *f; init_filter_tables(); f = apr_palloc(FILTER_POOL, sizeof(ap_filter_rec_t)); f->filter_func.out_func = filter_func; f->filter_init_func = filter_init; f->ftype = ftype; f->name = name; apr_table_setn(ms_output_filters, name, (const char *)f); return f; } static ap_filter_t *add_any_filter_handle(ap_filter_rec_t *frec, void *ctx, request_rec *r, conn_rec *c, ap_filter_t **r_filters, ap_filter_t **p_filters, ap_filter_t **c_filters) { apr_pool_t* p = r ? r->pool : c->pool; ap_filter_t *f = apr_palloc(p, sizeof(*f)); ap_filter_t **outf; if (frec->ftype < AP_FTYPE_PROTOCOL) { if (r) { outf = r_filters; } else { ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL, "a content filter was added without a request: %s", frec->name); return NULL; } } else if (frec->ftype < AP_FTYPE_CONNECTION) { if (r) { outf = p_filters; } else { ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL, "a protocol filter was added without a request: %s", frec->name); return NULL; } } else { outf = c_filters; } f->frec = frec; f->ctx = ctx; f->r = r; f->c = c; f->next = NULL; if (INSERT_BEFORE(f, *outf)) { f->next = *outf; if (*outf) { ap_filter_t *first = NULL; if (r) { /* If we are adding our first non-connection filter, * Then don't try to find the right location, it is * automatically first. */ if (*r_filters != *c_filters) { first = *r_filters; while (first && (first->next != (*outf))) { first = first->next; } } } if (first && first != (*outf)) { first->next = f; } } *outf = f; } else { ap_filter_t *fscan = *outf; while (!INSERT_BEFORE(f, fscan->next)) fscan = fscan->next; f->next = fscan->next; fscan->next = f; } if (frec->ftype < AP_FTYPE_CONNECTION && (*r_filters == *c_filters)) { *r_filters = *p_filters; } return f; } AP_DECLARE(ap_filter_t *) ap_add_input_filter(const char *name, void *ctx, request_rec *r, conn_rec *c) { ap_filter_rec_t *f = (ap_filter_rec_t *)apr_table_get(ms_input_filters, name); if(f == NULL) return NULL; return add_any_filter_handle(f, ctx, r, c, r ? &r->input_filters : NULL, r ? &r->proto_input_filters : NULL, &c->input_filters); } AP_DECLARE(ap_filter_t *) ap_add_output_filter(const char *name, void *ctx, request_rec *r, conn_rec *c) { ap_filter_rec_t *f = (ap_filter_rec_t *)apr_table_get(ms_output_filters, name); if(f == NULL) return NULL; return add_any_filter_handle(f, ctx, r, c, r ? &r->output_filters : NULL, r ? &r->proto_output_filters : NULL, &c->output_filters); } static void remove_any_filter(ap_filter_t *f, ap_filter_t **r_filt, ap_filter_t **p_filt, ap_filter_t **c_filt) { ap_filter_t **curr = r_filt ? r_filt : c_filt; ap_filter_t *fscan = *curr; if (p_filt && *p_filt == f) *p_filt = (*p_filt)->next; if (*curr == f) { *curr = (*curr)->next; return; } while (fscan->next != f) { if (!(fscan = fscan->next)) { return; } } fscan->next = f->next; } AP_DECLARE(void) ap_remove_input_filter(ap_filter_t *f) { remove_any_filter(f, f->r ? &f->r->input_filters : NULL, f->r ? &f->r->proto_input_filters : NULL, &f->c->input_filters); } AP_DECLARE(void) ap_remove_output_filter(ap_filter_t *f) { remove_any_filter(f, f->r ? &f->r->output_filters : NULL, f->r ? &f->r->proto_output_filters : NULL, &f->c->output_filters); } modsecurity-apache_2.7.7/standalone/api.c0000664000175000017500000004720212244707122020706 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #include #include #include "http_core.h" #include "http_request.h" #include "modsecurity.h" #include "apache2.h" #include "http_main.h" #include "http_connection.h" #include "apr_optional.h" #include "mod_log_config.h" #include "msc_logging.h" #include "msc_util.h" #include "ap_mpm.h" #include "scoreboard.h" #include "apr_version.h" #include "apr_lib.h" #include "ap_config.h" #include "http_config.h" #include "api.h" extern void *modsecLogObj; extern void (*modsecLogHook)(void *obj, int level, char *str); extern int (*modsecDropAction)(request_rec *r); apr_status_t (*modsecReadBody)(request_rec *r, char *buf, unsigned int length, unsigned int *readcnt, int *is_eos); apr_status_t (*modsecReadResponse)(request_rec *r, char *buf, unsigned int length, unsigned int *readcnt, int *is_eos); apr_status_t (*modsecWriteBody)(request_rec *r, char *buf, unsigned int length); apr_status_t (*modsecWriteResponse)(request_rec *r, char *buf, unsigned int length); extern const char *process_command_config(server_rec *s, void *mconfig, apr_pool_t *p, apr_pool_t *ptemp, const char *filename); #define DECLARE_EXTERNAL_HOOK(ns,link,ret,name,args) \ extern ns##_HOOK_##name##_t *hookfn_##name; #define DECLARE_HOOK(ret,name,args) \ DECLARE_EXTERNAL_HOOK(ap,AP,ret,name,args) DECLARE_HOOK(int,pre_config,(apr_pool_t *pconf,apr_pool_t *plog, apr_pool_t *ptemp)) DECLARE_HOOK(int,post_config,(apr_pool_t *pconf,apr_pool_t *plog, apr_pool_t *ptemp,server_rec *s)) DECLARE_HOOK(void,child_init,(apr_pool_t *pchild, server_rec *s)) DECLARE_HOOK(int,process_connection,(conn_rec *c)) DECLARE_HOOK(int,post_read_request,(request_rec *r)) DECLARE_HOOK(int,fixups,(request_rec *r)) DECLARE_HOOK(void, error_log, (const char *file, int line, int level, apr_status_t status, const server_rec *s, const request_rec *r, apr_pool_t *pool, const char *errstr)) DECLARE_HOOK(int,log_transaction,(request_rec *r)) DECLARE_HOOK(void,insert_filter,(request_rec *r)) DECLARE_HOOK(void,insert_error_filter,(request_rec *r)) char *sa_name = "standalone"; server_rec *server; apr_pool_t *pool = NULL; apr_status_t ap_http_in_filter(ap_filter_t *f, apr_bucket_brigade *b, ap_input_mode_t mode, apr_read_type_e block, apr_off_t readbytes); apr_status_t ap_http_out_filter(ap_filter_t *f, apr_bucket_brigade *b); server_rec *modsecInit() { apr_initialize(); apr_pool_create(&pool, NULL); apr_hook_global_pool = pool; server = apr_palloc(pool, sizeof(server_rec)); server->addrs = apr_palloc(pool, sizeof(server_addr_rec)); server->addrs->host_addr = apr_palloc(pool, sizeof(apr_sockaddr_t)); server->addrs->host_addr->addr_str_len = 16; server->addrs->host_addr->family = AF_INET; server->addrs->host_addr->hostname = sa_name; #ifdef WIN32 server->addrs->host_addr->ipaddr_len = sizeof(IN_ADDR); #else server->addrs->host_addr->ipaddr_len = sizeof(struct in_addr); #endif server->addrs->host_addr->ipaddr_ptr = &server->addrs->host_addr->sa.sin.sin_addr; server->addrs->host_addr->pool = pool; server->addrs->host_addr->port = 80; #ifdef WIN32 server->addrs->host_addr->sa.sin.sin_addr.S_un.S_addr = 0x0100007f; #else server->addrs->host_addr->sa.sin.sin_addr.s_addr = 0x0100007f; #endif server->addrs->host_addr->sa.sin.sin_family = AF_INET; server->addrs->host_addr->sa.sin.sin_port = 80; server->addrs->host_addr->salen = sizeof(server->addrs->host_addr->sa); server->addrs->host_addr->servname = sa_name; server->addrs->host_port = 80; server->error_fname = "error.log"; server->error_log = NULL; server->limit_req_fields = 1024; server->limit_req_fieldsize = 1024; server->limit_req_line = 1024; #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER < 3 server->loglevel = APLOG_DEBUG; #endif server->lookup_defaults = NULL; server->module_config = NULL; server->names = NULL; #ifdef WIN32 server->path = "c:\\inetpub\\wwwroot"; #else server->path = "/var/www"; #endif server->pathlen = strlen(server->path); server->port = 80; server->process = apr_palloc(pool, sizeof(process_rec)); server->process->argc = 1; server->process->argv = &sa_name; server->process->pconf = pool; server->process->pool = pool; server->process->short_name = sa_name; server->server_admin = sa_name; server->server_hostname = sa_name; server->server_scheme = ""; server->timeout = 60 * 1000000;// 60 seconds server->wild_names = NULL; server->is_virtual = 0; ap_server_config_defines = apr_array_make(pool, 1, sizeof(char *)); // here we should add scoreboard handling for multiple processes and threads // ap_scoreboard_image = (scoreboard *)apr_palloc(pool, sizeof(scoreboard)); memset(ap_scoreboard_image, 0, sizeof(scoreboard)); // ---------- security2_module.module_index = 0; security2_module.register_hooks(pool); ap_register_input_filter("HTTP_IN", ap_http_in_filter, NULL, AP_FTYPE_RESOURCE); ap_register_output_filter("HTTP_OUT", ap_http_out_filter, NULL, AP_FTYPE_CONTENT_SET); return server; } apr_status_t ap_http_in_filter(ap_filter_t *f, apr_bucket_brigade *bb_out, ap_input_mode_t mode, apr_read_type_e block, apr_off_t readbytes) { char *tmp = NULL; apr_bucket *e = NULL; unsigned int readcnt = 0; int is_eos = 0; apr_bucket_brigade *bb_in; apr_bucket *after; apr_status_t rv; bb_in = modsecGetBodyBrigade(f->r); /* use request brigade */ if (bb_in != NULL) { if (!APR_BUCKET_IS_EOS(APR_BRIGADE_LAST(bb_in))) { e = apr_bucket_eos_create(f->c->bucket_alloc); APR_BRIGADE_INSERT_TAIL(bb_in, e); } rv = apr_brigade_partition(bb_in, readbytes, &after); if (rv != APR_SUCCESS && rv != APR_INCOMPLETE) { return rv; } for (e = APR_BRIGADE_FIRST(bb_in); e != after; e = APR_BRIGADE_FIRST(bb_in)) { APR_BUCKET_REMOVE(e); APR_BRIGADE_INSERT_TAIL(bb_out, e); } return APR_SUCCESS; } /* call the callback */ if(modsecReadBody != NULL) { tmp = (char *)apr_palloc(f->r->pool, readbytes); modsecReadBody(f->r, tmp, readbytes, &readcnt, &is_eos); e = apr_bucket_pool_create(tmp, readcnt, f->r->pool, f->c->bucket_alloc); APR_BRIGADE_INSERT_TAIL(bb_out, e); if(is_eos) { e = apr_bucket_eos_create(f->c->bucket_alloc); APR_BRIGADE_INSERT_TAIL(bb_out, e); } return APR_SUCCESS; } /* cannot read request body */ e = apr_bucket_eos_create(f->c->bucket_alloc); APR_BRIGADE_INSERT_TAIL(bb_out, e); return APR_SUCCESS; } apr_status_t ap_http_out_filter(ap_filter_t *f, apr_bucket_brigade *b) { apr_status_t rc; apr_bucket_brigade *bb_out = (apr_bucket_brigade *)f->ctx; APR_BRIGADE_CONCAT(bb_out, b); return APR_SUCCESS; } void modsecTerminate() { apr_pool_destroy(pool); pool = NULL; apr_terminate(); } void modsecStartConfig() { apr_pool_t *ptemp = NULL; apr_pool_create(&ptemp, pool); hookfn_pre_config(pool, pool, ptemp); apr_pool_destroy(ptemp); } directory_config *modsecGetDefaultConfig() { return (directory_config *)security2_module.create_dir_config(pool, NULL); } const char *modsecProcessConfig(directory_config *config, const char *file, const char *dir) { apr_pool_t *ptemp = NULL; const char *err; apr_status_t status; const char *rootpath, *incpath; if(dir == NULL || strlen(dir) == 0) #ifdef WIN32 dir = "\\"; #else dir = "/"; #endif incpath = file; /* locate the start of the directories proper */ status = apr_filepath_root(&rootpath, &incpath, APR_FILEPATH_TRUENAME | APR_FILEPATH_NATIVE, pool); /* we allow APR_SUCCESS and APR_EINCOMPLETE */ if (APR_ERELATIVE == status) { int li = strlen(dir) - 1; if(dir[li] != '/' && dir[li] != '\\') #ifdef WIN32 file = apr_pstrcat(pool, dir, "\\", file, NULL); #else file = apr_pstrcat(pool, dir, "/", file, NULL); #endif else file = apr_pstrcat(pool, dir, file, NULL); } else if (APR_EBADPATH == status) { return apr_pstrcat(pool, "Config file has a bad path, ", file, NULL); } apr_pool_create(&ptemp, pool); err = process_command_config(server, config, pool, ptemp, file); apr_pool_destroy(ptemp); return err; } void modsecFinalizeConfig() { apr_pool_t *ptemp = NULL; apr_pool_create(&ptemp, pool); hookfn_post_config(pool, pool, ptemp, server); hookfn_post_config(pool, pool, ptemp, server); apr_pool_destroy(ptemp); } void modsecInitProcess() { hookfn_child_init(pool, server); } conn_rec *modsecNewConnection() { conn_rec *c; apr_pool_t *pc = NULL; apr_pool_create(&pc, pool); c = apr_pcalloc(pc, sizeof(conn_rec)); c->base_server = server; c->id = 1; c->local_addr = server->addrs->host_addr; c->local_host = sa_name; c->local_ip = "127.0.0.1"; c->pool = pc; c->remote_host = sa_name; #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER < 3 c->remote_ip = "127.0.0.1"; c->remote_addr = server->addrs->host_addr; #else c->client_ip = "127.0.0.1"; c->client_addr = server->addrs->host_addr; #endif c->input_filters = NULL; c->output_filters = NULL; c->bucket_alloc = apr_bucket_alloc_create(pc); return c; } void modsecProcessConnection(conn_rec *c) { hookfn_process_connection(c); } request_rec *modsecNewRequest(conn_rec *connection, directory_config *config) { request_rec *r; apr_pool_t *pr = NULL; apr_pool_create(&pr, connection->pool); r = apr_pcalloc(pr, sizeof(request_rec)); r->connection = connection; r->server = server; r->pool = pr; r->main = NULL; r->next = NULL; r->notes = apr_table_make(pr, 10); r->per_dir_config = apr_palloc(pr, sizeof(void *)); ((void **)r->per_dir_config)[0] = config; r->prev = NULL; r->subprocess_env = apr_table_make(pr, 10); apr_table_setn(r->subprocess_env, "UNIQUE_ID", "unique_id"); r->user = NULL; r->headers_in = apr_table_make(pr, 10); r->headers_out = apr_table_make(pr, 10); r->err_headers_out = apr_table_make(pr, 10); //apr_table_setn(r->headers_in, "Host", "www.google.com"); //apr_table_setn(r->headers_in, "", ""); r->the_request = "GET /../../index.html HTTP/1.1"; r->method = "GET"; r->method_number = M_GET; r->protocol = "HTTP/1.1"; r->uri = "http://www.google.com/../../index.html"; r->args = ""; r->filename = "/../../index.html"; r->handler = "IIS"; r->parsed_uri.scheme = "http"; r->parsed_uri.path = "/../../index.html"; r->parsed_uri.hostname = "www.google.com"; r->parsed_uri.is_initialized = 1; r->parsed_uri.port = 1234; r->parsed_uri.port_str = "1234"; r->parsed_uri.query = ""; r->parsed_uri.dns_looked_up = 0; r->parsed_uri.dns_resolved = 0; r->parsed_uri.password = NULL; r->parsed_uri.user = NULL; r->parsed_uri.fragment = ""; r->input_filters = NULL; r->output_filters = NULL; return r; } static modsec_rec *retrieve_msr(request_rec *r) { modsec_rec *msr = NULL; request_rec *rx = NULL; /* Look in the current request first. */ msr = (modsec_rec *)apr_table_get(r->notes, NOTE_MSR); if (msr != NULL) { msr->r = r; return msr; } /* If this is a subrequest then look in the main request. */ if (r->main != NULL) { msr = (modsec_rec *)apr_table_get(r->main->notes, NOTE_MSR); if (msr != NULL) { msr->r = r; return msr; } } /* If the request was redirected then look in the previous requests. */ rx = r->prev; while(rx != NULL) { msr = (modsec_rec *)apr_table_get(rx->notes, NOTE_MSR); if (msr != NULL) { msr->r = r; return msr; } rx = rx->prev; } return NULL; } int modsecProcessRequestHeaders(request_rec *r) { return hookfn_post_read_request(r); } int modsecProcessRequestBody(request_rec *r) { int status = DECLINED; modsec_rec *msr = NULL; ap_filter_t *f = ap_add_input_filter("HTTP_IN", NULL, r, r->connection); apr_bucket_brigade* bb_out; status = hookfn_fixups(r); ap_remove_input_filter(f); if (status != DECLINED) { return status; } hookfn_insert_filter(r); /* Find the transaction context first. */ msr = retrieve_msr(r); if (msr == NULL) return status; bb_out = modsecGetBodyBrigade(r); if (bb_out) { (void) apr_brigade_cleanup(bb_out); status = ap_get_brigade(r->input_filters, bb_out, AP_MODE_READBYTES, APR_BLOCK_READ, -1); if (status == APR_SUCCESS) { return DECLINED; } return status; } if(msr->stream_input_data != NULL && modsecWriteBody != NULL) { // target is responsible for copying the data into correctly managed buffer // modsecWriteBody(r, msr->stream_input_data, msr->stream_input_length); free(msr->stream_input_data); msr->stream_input_data = NULL; } // leftover code possibly for future use // //if(r->input_filters != NULL && r->input_filters->frec->filter_init_func != NULL) //r->input_filters->frec->filter_init_func(r->input_filters); //if(r->input_filters != NULL && r->input_filters->frec->filter_func.in_func != NULL) //r->input_filters->frec->filter_func.in_func(r->input_filters, NULL, 0, 0, 0); return status; } void modsecSetConfigForIISRequestBody(request_rec *r) { modsec_rec *msr = retrieve_msr(r); if(msr == NULL || msr->txcfg == NULL) return; if(msr->txcfg->reqbody_access) msr->txcfg->stream_inbody_inspection = 1; } int modsecIsRequestBodyAccessEnabled(request_rec *r) { modsec_rec *msr = retrieve_msr(r); if(msr == NULL || msr->txcfg == NULL) return 0; return msr->txcfg->reqbody_access; } int modsecIsResponseBodyAccessEnabled(request_rec *r) { modsec_rec *msr = retrieve_msr(r); if(msr == NULL || msr->txcfg == NULL) return 0; return msr->txcfg->resbody_access; } int modsecProcessResponse(request_rec *r) { int status; modsec_rec *msr; apr_bucket *e; ap_filter_t *f; apr_bucket_brigade *bb_in, *bb_out, *bb; if(r->output_filters == NULL) { return DECLINED; } msr = (modsec_rec *)r->output_filters->ctx; if (msr == NULL) { ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r->server, "ModSecurity: Internal Error: msr is null in output filter."); ap_remove_output_filter(r->output_filters); return APR_EGENERAL; } msr->r = r; /* create input response brigade */ bb_in = apr_brigade_create(msr->mp, r->connection->bucket_alloc); if (bb_in == NULL) { msr_log(msr, 1, "Process response: Failed to create brigade."); return APR_EGENERAL; } /* get input response brigade */ bb = modsecGetResponseBrigade(r); if (bb != NULL) { APR_BRIGADE_CONCAT(bb_in, bb); if (!APR_BUCKET_IS_EOS(APR_BRIGADE_LAST(bb_in))) { e = apr_bucket_eos_create(bb_in->bucket_alloc); APR_BRIGADE_INSERT_TAIL(bb_in, e); } } else if (modsecReadResponse != NULL) { unsigned int readcnt = 0; int is_eos = 0; char buf[8192]; while(!is_eos) { modsecReadResponse(r, buf, 8192, &readcnt, &is_eos); if(readcnt > 0) { char *tmp = (char *)apr_palloc(r->pool, readcnt); memcpy(tmp, buf, readcnt); e = apr_bucket_pool_create(tmp, readcnt, r->pool, r->connection->bucket_alloc); APR_BRIGADE_INSERT_TAIL(bb_in, e); } } e = apr_bucket_eos_create(r->connection->bucket_alloc); APR_BRIGADE_INSERT_TAIL(bb_in, e); } else { /* cannot read response body process header only */ e = apr_bucket_eos_create(r->connection->bucket_alloc); APR_BRIGADE_INSERT_TAIL(bb_in, e); } bb_out = bb ? bb : apr_brigade_create(msr->mp, r->connection->bucket_alloc); if (bb_out == NULL) { msr_log(msr, 1, "Process response: Failed to create brigade."); return APR_EGENERAL; } /* concat output bucket to bb_out */ f = ap_add_output_filter("HTTP_OUT", bb_out, r, r->connection); status = ap_pass_brigade(r->output_filters, bb_in); ap_remove_output_filter(f); if (status == APR_EGENERAL) { /* retrive response status from bb_out */ for(e = APR_BRIGADE_FIRST(bb_out); e != APR_BRIGADE_SENTINEL(bb_out); e = APR_BUCKET_NEXT(e)) { if (AP_BUCKET_IS_ERROR(e)) { return ((ap_bucket_error*) e->data)->status; } } return APR_EGENERAL; } if (status != DECLINED) { return status; } /* copy bb_out */ // is there a way to tell whether the response body was modified or not? if (modsecWriteResponse != NULL && (msr->txcfg->content_injection_enabled || msr->content_prepend_len != 0 || msr->content_append_len != 0) && msr->txcfg->resbody_access) { char *data = NULL; apr_size_t length; status = apr_brigade_pflatten(msr->of_brigade, &data, &length, msr->mp); if (status != APR_SUCCESS) { msr_log(msr, 1, "Output filter: Failed to flatten brigade (%d): %s", status, get_apr_error(msr->mp, status)); return APR_EGENERAL; } if ( modsecWriteResponse(msr->r, data, msr->stream_output_length) != APR_SUCCESS) { return APR_EGENERAL; } } return DECLINED; } int modsecFinishRequest(request_rec *r) { // run output filter //if(r->output_filters != NULL && r->output_filters->frec->filter_init_func != NULL) //r->output_filters->frec->filter_init_func(r->output_filters); hookfn_log_transaction(r); // make sure you cleanup before calling apr_terminate() // otherwise double-free might occur, because of the request body pool cleanup function // apr_pool_destroy(r->connection->pool); return DECLINED; } void modsecSetLogHook(void *obj, void (*hook)(void *obj, int level, char *str)) { modsecLogObj = obj; modsecLogHook = hook; } void modsecSetReadBody(apr_status_t (*func)(request_rec *r, char *buf, unsigned int length, unsigned int *readcnt, int *is_eos)) { modsecReadBody = func; } void modsecSetReadResponse(apr_status_t (*func)(request_rec *r, char *buf, unsigned int length, unsigned int *readcnt, int *is_eos)) { modsecReadResponse = func; } void modsecSetWriteBody(apr_status_t (*func)(request_rec *r, char *buf, unsigned int length)) { modsecWriteBody = func; } void modsecSetWriteResponse(apr_status_t (*func)(request_rec *r, char *buf, unsigned int length)) { modsecWriteResponse = func; } void modsecSetDropAction(int (*func)(request_rec *r)) { modsecDropAction = func; } modsecurity-apache_2.7.7/standalone/buckets.c0000664000175000017500000001303612243422537021576 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #include #include "http_core.h" #include "http_request.h" #include "modsecurity.h" #include "apache2.h" #include "http_main.h" #include "http_connection.h" #include "apr_optional.h" #include "mod_log_config.h" #include "msc_logging.h" #include "msc_util.h" #include "ap_mpm.h" #include "scoreboard.h" #include "apr_version.h" #include "apr_lib.h" #include "ap_config.h" #include "http_config.h" #include "apr_buckets.h" AP_DECLARE(apr_status_t) ap_get_brigade(ap_filter_t *next, apr_bucket_brigade *bb, ap_input_mode_t mode, apr_read_type_e block, apr_off_t readbytes) { if (next) { return next->frec->filter_func.in_func(next, bb, mode, block, readbytes); } return AP_NOBODY_READ; } AP_DECLARE(apr_status_t) ap_pass_brigade(ap_filter_t *next, apr_bucket_brigade *bb) { if (next) { apr_bucket *e; if ((e = APR_BRIGADE_LAST(bb)) && APR_BUCKET_IS_EOS(e) && next->r) { /* This is only safe because HTTP_HEADER filter is always in * the filter stack. This ensures that there is ALWAYS a * request-based filter that we can attach this to. If the * HTTP_FILTER is removed, and another filter is not put in its * place, then handlers like mod_cgi, which attach their own * EOS bucket to the brigade will be broken, because we will * get two EOS buckets on the same request. */ next->r->eos_sent = 1; /* remember the eos for internal redirects, too */ if (next->r->prev) { request_rec *prev = next->r->prev; while (prev) { prev->eos_sent = 1; prev = prev->prev; } } } return next->frec->filter_func.out_func(next, bb); } return AP_NOBODY_WROTE; } AP_DECLARE(apr_status_t) ap_save_brigade(ap_filter_t *f, apr_bucket_brigade **saveto, apr_bucket_brigade **b, apr_pool_t *p) { apr_bucket *e; apr_status_t rv, srv = APR_SUCCESS; /* If have never stored any data in the filter, then we had better * create an empty bucket brigade so that we can concat. */ if (!(*saveto)) { *saveto = apr_brigade_create(p, f->c->bucket_alloc); } for (e = APR_BRIGADE_FIRST(*b); e != APR_BRIGADE_SENTINEL(*b); e = APR_BUCKET_NEXT(e)) { rv = apr_bucket_setaside(e, p); /* If the bucket type does not implement setaside, then * (hopefully) morph it into a bucket type which does, and set * *that* aside... */ if (rv == APR_ENOTIMPL) { const char *s; apr_size_t n; rv = apr_bucket_read(e, &s, &n, APR_BLOCK_READ); if (rv == APR_SUCCESS) { rv = apr_bucket_setaside(e, p); } } if (rv != APR_SUCCESS) { srv = rv; /* Return an error but still save the brigade if * ->setaside() is really not implemented. */ if (rv != APR_ENOTIMPL) { return rv; } } } APR_BRIGADE_CONCAT(*saveto, *b); return srv; } static apr_status_t error_bucket_read(apr_bucket *b, const char **str, apr_size_t *len, apr_read_type_e block) { *str = "Unknown error."; *len = strlen(*str); return APR_SUCCESS; } static void error_bucket_destroy(void *data) { ap_bucket_error *h = data; if (apr_bucket_shared_destroy(h)) { apr_bucket_free(h); } } AP_DECLARE_DATA const apr_bucket_type_t ap_bucket_type_error = { "ERROR", 5, APR_BUCKET_METADATA, error_bucket_destroy, error_bucket_read, apr_bucket_setaside_notimpl, apr_bucket_split_notimpl, apr_bucket_shared_copy }; AP_DECLARE(apr_bucket *) ap_bucket_error_make(apr_bucket *b, int error, const char *buf, apr_pool_t *p) { ap_bucket_error *h; h = apr_bucket_alloc(sizeof(*h), b->list); h->status = error; h->data = (buf) ? apr_pstrdup(p, buf) : NULL; b = apr_bucket_shared_make(b, h, 0, 0); b->type = &ap_bucket_type_error; return b; } AP_DECLARE(apr_bucket *) ap_bucket_error_create(int error, const char *buf, apr_pool_t *p, apr_bucket_alloc_t *list) { apr_bucket *b = apr_bucket_alloc(sizeof(*b), list); APR_BUCKET_INIT(b); b->free = apr_bucket_free; b->list = list; return ap_bucket_error_make(b, error, buf, p); } modsecurity-apache_2.7.7/standalone/server.c0000664000175000017500000007537212243422537021457 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #include #include "http_core.h" #include "http_request.h" #include "modsecurity.h" #include "apache2.h" #include "http_main.h" #include "http_connection.h" #include "apr_optional.h" #include "mod_log_config.h" #include "msc_logging.h" #include "msc_util.h" #include "ap_mpm.h" #include "scoreboard.h" #include "apr_version.h" #include "apr_lib.h" #include "ap_config.h" #include "http_config.h" #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_SYS_SEM_H #include #endif //========= /** The default path for CGI scripts if none is currently set */ #ifndef DEFAULT_PATH #define DEFAULT_PATH "/bin:/usr/bin:/usr/ucb:/usr/bsd:/usr/local/bin" #endif //========= AP_DECLARE_DATA scoreboard *ap_scoreboard_image = NULL; AP_DECLARE_DATA apr_array_header_t *ap_server_config_defines = NULL; AP_DECLARE_DATA const char *ap_server_root = "\\"; static int server_limit, thread_limit, lb_limit; static apr_size_t scoreboard_size; void *modsecLogObj = NULL; void (*modsecLogHook)(void *obj, int level, char *str) = NULL; //========= static const char * const status_lines[RESPONSE_CODES] = { "100 Continue", "101 Switching Protocols", "102 Processing", #define LEVEL_200 3 "200 OK", "201 Created", "202 Accepted", "203 Non-Authoritative Information", "204 No Content", "205 Reset Content", "206 Partial Content", "207 Multi-Status", #define LEVEL_300 11 "300 Multiple Choices", "301 Moved Permanently", "302 Found", "303 See Other", "304 Not Modified", "305 Use Proxy", "306 unused", "307 Temporary Redirect", #define LEVEL_400 19 "400 Bad Request", "401 Authorization Required", "402 Payment Required", "403 Forbidden", "404 Not Found", "405 Method Not Allowed", "406 Not Acceptable", "407 Proxy Authentication Required", "408 Request Time-out", "409 Conflict", "410 Gone", "411 Length Required", "412 Precondition Failed", "413 Request Entity Too Large", "414 Request-URI Too Large", "415 Unsupported Media Type", "416 Requested Range Not Satisfiable", "417 Expectation Failed", "418 unused", "419 unused", "420 unused", "421 unused", "422 Unprocessable Entity", "423 Locked", "424 Failed Dependency", /* This is a hack, but it is required for ap_index_of_response * to work with 426. */ "425 No code", "426 Upgrade Required", #define LEVEL_500 46 "500 Internal Server Error", "501 Method Not Implemented", "502 Bad Gateway", "503 Service Temporarily Unavailable", "504 Gateway Time-out", "505 HTTP Version Not Supported", "506 Variant Also Negotiates", "507 Insufficient Storage", "508 unused", "509 unused", "510 Not Extended" }; AP_DECLARE(int) ap_index_of_response(int status) { static int shortcut[6] = {0, LEVEL_200, LEVEL_300, LEVEL_400, LEVEL_500, RESPONSE_CODES}; int i, pos; if (status < 100) { /* Below 100 is illegal for HTTP status */ return LEVEL_500; } for (i = 0; i < 5; i++) { status -= 100; if (status < 100) { pos = (status + shortcut[i]); if (pos < shortcut[i + 1]) { return pos; } else { return LEVEL_500; /* status unknown (falls in gap) */ } } } return LEVEL_500; /* 600 or above is also illegal */ } //========= static char *http2env(apr_pool_t *a, const char *w) { char *res = (char *)apr_palloc(a, sizeof("HTTP_") + strlen(w)); char *cp = res; char c; *cp++ = 'H'; *cp++ = 'T'; *cp++ = 'T'; *cp++ = 'P'; *cp++ = '_'; while ((c = *w++) != 0) { if (!apr_isalnum(c)) { *cp++ = '_'; } else { *cp++ = apr_toupper(c); } } *cp = 0; return res; } AP_DECLARE(char *) ap_escape_html2(apr_pool_t *p, const char *s, int toasc) { int i, j; char *x; /* first, count the number of extra characters */ for (i = 0, j = 0; s[i] != '\0'; i++) if (s[i] == '<' || s[i] == '>') j += 3; else if (s[i] == '&') j += 4; else if (s[i] == '"') j += 5; else if (toasc && !apr_isascii(s[i])) j += 5; if (j == 0) return apr_pstrmemdup(p, s, i); x = apr_palloc(p, i + j + 1); for (i = 0, j = 0; s[i] != '\0'; i++, j++) if (s[i] == '<') { memcpy(&x[j], "<", 4); j += 3; } else if (s[i] == '>') { memcpy(&x[j], ">", 4); j += 3; } else if (s[i] == '&') { memcpy(&x[j], "&", 5); j += 4; } else if (s[i] == '"') { memcpy(&x[j], """, 6); j += 5; } else if (toasc && !apr_isascii(s[i])) { char *esc = apr_psprintf(p, "&#%3.3d;", (unsigned char)s[i]); memcpy(&x[j], esc, 6); j += 5; } else x[j] = s[i]; x[j] = '\0'; return x; } #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER < 3 AP_DECLARE(char *) ap_escape_html(apr_pool_t *p, const char *s) { return ap_escape_html2(p, s, 0); } #endif AP_DECLARE(const char *) ap_psignature(const char *prefix, request_rec *r) { return prefix; } AP_DECLARE(const char *) ap_document_root(request_rec *r) /* Don't use this! */ { return "\\"; } AP_DECLARE(apr_port_t) ap_get_server_port(const request_rec *r) { return 80; } ///////////////////////////////////////////////////////////////////////////////////////////////////// #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER < 3 AP_DECLARE(void) ap_log_error(const char *file, int line, int level, apr_status_t status, const server_rec *s, const char *fmt, ...) // __attribute__((format(printf,6,7))) #else AP_DECLARE(void) ap_log_error_(const char *file, int line, int module_index, int level, apr_status_t status, const server_rec *s, const char *fmt, ...) // __attribute__((format(printf,7,8))) #endif { va_list args; char errstr[MAX_STRING_LEN]; va_start(args, fmt); apr_vsnprintf(errstr, MAX_STRING_LEN, fmt, args); va_end(args); if(modsecLogHook != NULL) modsecLogHook(modsecLogObj, level, errstr); } #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER < 3 AP_DECLARE(void) ap_log_perror(const char *file, int line, int level, apr_status_t status, apr_pool_t *p, const char *fmt, ...) // __attribute__((format(printf,6,7))) #else AP_DECLARE(void) ap_log_perror_(const char *file, int line, int module_index, int level, apr_status_t status, apr_pool_t *p, const char *fmt, ...) #endif { va_list args; char errstr[MAX_STRING_LEN]; va_start(args, fmt); apr_vsnprintf(errstr, MAX_STRING_LEN, fmt, args); va_end(args); if(modsecLogHook != NULL) modsecLogHook(modsecLogObj, level, errstr); } AP_DECLARE(module *) ap_find_linked_module(const char *name) { // only used for ACTION_PROXY to find mod_proxy.c; see mod_security2.c, perform_interception() // return NULL; } AP_DECLARE(const char *) ap_get_server_name(request_rec *r) { return r->server->server_hostname; } AP_DECLARE(void) ap_add_version_component(apr_pool_t *pconf, const char *component) { // appends string to server description string // } AP_DECLARE(const char *) ap_get_status_line(int status) { return status_lines[ap_index_of_response(status)]; } #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER < 3 AP_DECLARE(worker_score *) ap_get_scoreboard_worker(int x, int y) { if (((x < 0) || (server_limit < x)) || ((y < 0) || (thread_limit < y))) { return(NULL); /* Out of range */ } return &ap_scoreboard_image->servers[x][y]; } #else AP_DECLARE(worker_score *) ap_get_scoreboard_worker_from_indexes(int x, int y) { if (((x < 0) || (x >= server_limit)) || ((y < 0) || (y >= thread_limit))) { return(NULL); /* Out of range */ } return &ap_scoreboard_image->servers[x][y]; } AP_DECLARE(worker_score *) ap_get_scoreboard_worker(ap_sb_handle_t *sbh) { //if (!sbh) // return NULL; //return ap_get_scoreboard_worker_from_indexes(sbh->child_num, // sbh->thread_num); return ap_get_scoreboard_worker_from_indexes(0, 0); } #endif AP_DECLARE(apr_status_t) ap_mpm_query(int query_code, int *result) { switch(query_code){ //case AP_MPMQ_MAX_DAEMON_USED: // *result = MAXIMUM_WAIT_OBJECTS; // return APR_SUCCESS; case AP_MPMQ_IS_THREADED: *result = AP_MPMQ_STATIC; return APR_SUCCESS; case AP_MPMQ_IS_FORKED: *result = AP_MPMQ_NOT_SUPPORTED; return APR_SUCCESS; case AP_MPMQ_HARD_LIMIT_DAEMONS: *result = 1; //HARD_SERVER_LIMIT; return APR_SUCCESS; case AP_MPMQ_HARD_LIMIT_THREADS: *result = thread_limit; return APR_SUCCESS; //case AP_MPMQ_MAX_THREADS: // *result = ap_threads_per_child; // return APR_SUCCESS; case AP_MPMQ_MIN_SPARE_DAEMONS: *result = 0; return APR_SUCCESS; case AP_MPMQ_MIN_SPARE_THREADS: *result = 0; return APR_SUCCESS; case AP_MPMQ_MAX_SPARE_DAEMONS: *result = 0; return APR_SUCCESS; case AP_MPMQ_MAX_SPARE_THREADS: *result = 0; return APR_SUCCESS; //case AP_MPMQ_MAX_REQUESTS_DAEMON: // *result = ap_max_requests_per_child; // return APR_SUCCESS; case AP_MPMQ_MAX_DAEMONS: *result = 0; return APR_SUCCESS; //case AP_MPMQ_MPM_STATE: // *result = winnt_mpm_state; // return APR_SUCCESS; } return APR_ENOTIMPL; } AP_DECLARE(const char *) ap_get_server_banner(void) { return "ModSecurity Standalone"; } /* Code from Harald Hanche-Olsen */ static APR_INLINE void do_double_reverse (conn_rec *conn) { apr_sockaddr_t *sa; apr_status_t rv; if (conn->double_reverse) { /* already done */ return; } if (conn->remote_host == NULL || conn->remote_host[0] == '\0') { /* single reverse failed, so don't bother */ conn->double_reverse = -1; return; } rv = apr_sockaddr_info_get(&sa, conn->remote_host, APR_UNSPEC, 0, 0, conn->pool); if (rv == APR_SUCCESS) { while (sa) { #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER < 3 if (apr_sockaddr_equal(sa, conn->remote_addr)) { #else if (apr_sockaddr_equal(sa, conn->client_addr)) { #endif conn->double_reverse = 1; return; } sa = sa->next; } } conn->double_reverse = -1; } #ifndef HOSTNAME_LOOKUP_OFF #define HOSTNAME_LOOKUP_OFF 0 #define HOSTNAME_LOOKUP_ON 1 #define HOSTNAME_LOOKUP_DOUBLE 2 #define HOSTNAME_LOOKUP_UNSET 3 #endif AP_DECLARE(void) ap_str_tolower(char *str) { while (*str) { *str = apr_tolower(*str); ++str; } } AP_DECLARE(const char *) ap_get_remote_host(conn_rec *conn, void *dir_config, int type, int *str_is_ip) { int hostname_lookups = HOSTNAME_LOOKUP_OFF; int ignored_str_is_ip; if (!str_is_ip) { /* caller doesn't want to know */ str_is_ip = &ignored_str_is_ip; } *str_is_ip = 0; /* If we haven't checked the host name, and we want to */ //if (dir_config) { // hostname_lookups = // ((core_dir_config *)ap_get_module_config(dir_config, &core_module)) // ->hostname_lookups; // if (hostname_lookups == HOSTNAME_LOOKUP_UNSET) { // hostname_lookups = HOSTNAME_LOOKUP_OFF; // } //} if (type != REMOTE_NOLOOKUP && conn->remote_host == NULL && (type == REMOTE_DOUBLE_REV || hostname_lookups != HOSTNAME_LOOKUP_OFF)) { #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER < 3 if (apr_getnameinfo(&conn->remote_host, conn->remote_addr, 0) == APR_SUCCESS) { #else if (apr_getnameinfo(&conn->remote_host, conn->client_addr, 0) == APR_SUCCESS) { #endif ap_str_tolower(conn->remote_host); if (hostname_lookups == HOSTNAME_LOOKUP_DOUBLE) { do_double_reverse(conn); if (conn->double_reverse != 1) { conn->remote_host = NULL; } } } /* if failed, set it to the NULL string to indicate error */ if (conn->remote_host == NULL) { conn->remote_host = ""; } } if (type == REMOTE_DOUBLE_REV) { do_double_reverse(conn); if (conn->double_reverse == -1) { return NULL; } } /* * Return the desired information; either the remote DNS name, if found, * or either NULL (if the hostname was requested) or the IP address * (if any identifier was requested). */ if (conn->remote_host != NULL && conn->remote_host[0] != '\0') { return conn->remote_host; } else { if (type == REMOTE_HOST || type == REMOTE_DOUBLE_REV) { return NULL; } else { *str_is_ip = 1; #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER < 3 return conn->remote_ip; #else return conn->client_ip; #endif } } } AP_DECLARE(char *) ap_server_root_relative(apr_pool_t *p, const char *file) { char *newpath = NULL; apr_status_t rv; rv = apr_filepath_merge(&newpath, ap_server_root, file, APR_FILEPATH_TRUENAME, p); if (newpath && (rv == APR_SUCCESS || APR_STATUS_IS_EPATHWILD(rv) || APR_STATUS_IS_ENOENT(rv) || APR_STATUS_IS_ENOTDIR(rv))) { return newpath; } else { return NULL; } } AP_DECLARE(piped_log *) ap_open_piped_log(apr_pool_t *p, const char *program) { return NULL; } #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER > 3 AP_DECLARE(apr_file_t *) ap_piped_log_write_fd(piped_log *pl) { return NULL; } #endif AP_DECLARE(char **) ap_create_environment(apr_pool_t *p, apr_table_t *t) { const apr_array_header_t *env_arr = apr_table_elts(t); const apr_table_entry_t *elts = (const apr_table_entry_t *) env_arr->elts; char **env = (char **) apr_palloc(p, (env_arr->nelts + 2) * sizeof(char *)); int i, j; char *tz; char *whack; j = 0; if (!apr_table_get(t, "TZ")) { tz = getenv("TZ"); if (tz != NULL) { env[j++] = apr_pstrcat(p, "TZ=", tz, NULL); } } for (i = 0; i < env_arr->nelts; ++i) { if (!elts[i].key) { continue; } env[j] = apr_pstrcat(p, elts[i].key, "=", elts[i].val, NULL); whack = env[j]; if (apr_isdigit(*whack)) { *whack++ = '_'; } while (*whack != '=') { if (!apr_isalnum(*whack) && *whack != '_') { *whack = '_'; } ++whack; } ++j; } env[j] = NULL; return env; } /* This "cute" little function comes about because the path info on * filenames and URLs aren't always the same. So we take the two, * and find as much of the two that match as possible. */ AP_DECLARE(int) ap_find_path_info(const char *uri, const char *path_info) { int lu = strlen(uri); int lp = strlen(path_info); while (lu-- && lp-- && uri[lu] == path_info[lp]) { if (path_info[lp] == '/') { while (lu && uri[lu-1] == '/') lu--; } } if (lu == -1) { lu = 0; } while (uri[lu] != '\0' && uri[lu] != '/') { lu++; } return lu; } /* Obtain the Request-URI from the original request-line, returning * a new string from the request pool containing the URI or "". */ static char *original_uri(request_rec *r) { char *first, *last; if (r->the_request == NULL) { return (char *) apr_pcalloc(r->pool, 1); } first = r->the_request; /* use the request-line */ while (*first && !apr_isspace(*first)) { ++first; /* skip over the method */ } while (apr_isspace(*first)) { ++first; /* and the space(s) */ } last = first; while (*last && !apr_isspace(*last)) { ++last; /* end at next whitespace */ } return apr_pstrmemdup(r->pool, first, last - first); } AP_DECLARE(void) ap_add_cgi_vars(request_rec *r) { apr_table_t *e = r->subprocess_env; apr_table_setn(e, "GATEWAY_INTERFACE", "CGI/1.1"); apr_table_setn(e, "SERVER_PROTOCOL", r->protocol); apr_table_setn(e, "REQUEST_METHOD", r->method); apr_table_setn(e, "QUERY_STRING", r->args ? r->args : ""); apr_table_setn(e, "REQUEST_URI", original_uri(r)); /* Note that the code below special-cases scripts run from includes, * because it "knows" that the sub_request has been hacked to have the * args and path_info of the original request, and not any that may have * come with the script URI in the include command. Ugh. */ if (!strcmp(r->protocol, "INCLUDED")) { apr_table_setn(e, "SCRIPT_NAME", r->uri); if (r->path_info && *r->path_info) { apr_table_setn(e, "PATH_INFO", r->path_info); } } else if (!r->path_info || !*r->path_info) { apr_table_setn(e, "SCRIPT_NAME", r->uri); } else { int path_info_start = ap_find_path_info(r->uri, r->path_info); apr_table_setn(e, "SCRIPT_NAME", apr_pstrndup(r->pool, r->uri, path_info_start)); apr_table_setn(e, "PATH_INFO", r->path_info); } //if (r->path_info && r->path_info[0]) { /* * To get PATH_TRANSLATED, treat PATH_INFO as a URI path. * Need to re-escape it for this, since the entire URI was * un-escaped before we determined where the PATH_INFO began. */ // request_rec *pa_req; // pa_req = ap_sub_req_lookup_uri(ap_escape_uri(r->pool, r->path_info), r, // NULL); // if (pa_req->filename) { // char *pt = apr_pstrcat(r->pool, pa_req->filename, pa_req->path_info, // NULL); //#ifdef WIN32 // /* We need to make this a real Windows path name */ // apr_filepath_merge(&pt, "", pt, APR_FILEPATH_NATIVE, r->pool); //#endif // apr_table_setn(e, "PATH_TRANSLATED", pt); // } // ap_destroy_sub_req(pa_req); //} } AP_DECLARE(void) ap_add_common_vars(request_rec *r) { apr_table_t *e; server_rec *s = r->server; conn_rec *c = r->connection; //const char *rem_logname; char *env_path; #if defined(WIN32) || defined(OS2) || defined(BEOS) char *env_temp; #endif const char *host; const apr_array_header_t *hdrs_arr = apr_table_elts(r->headers_in); const apr_table_entry_t *hdrs = (const apr_table_entry_t *) hdrs_arr->elts; int i; apr_port_t rport; /* use a temporary apr_table_t which we'll overlap onto * r->subprocess_env later * (exception: if r->subprocess_env is empty at the start, * write directly into it) */ if (apr_is_empty_table(r->subprocess_env)) { e = r->subprocess_env; } else { e = apr_table_make(r->pool, 25 + hdrs_arr->nelts); } /* First, add environment vars from headers... this is as per * CGI specs, though other sorts of scripting interfaces see * the same vars... */ for (i = 0; i < hdrs_arr->nelts; ++i) { if (!hdrs[i].key) { continue; } /* A few headers are special cased --- Authorization to prevent * rogue scripts from capturing passwords; content-type and -length * for no particular reason. */ if (!strcasecmp(hdrs[i].key, "Content-type")) { apr_table_addn(e, "CONTENT_TYPE", hdrs[i].val); } else if (!strcasecmp(hdrs[i].key, "Content-length")) { apr_table_addn(e, "CONTENT_LENGTH", hdrs[i].val); } /* * You really don't want to disable this check, since it leaves you * wide open to CGIs stealing passwords and people viewing them * in the environment with "ps -e". But, if you must... */ #ifndef SECURITY_HOLE_PASS_AUTHORIZATION else if (!strcasecmp(hdrs[i].key, "Authorization") || !strcasecmp(hdrs[i].key, "Proxy-Authorization")) { continue; } #endif else { apr_table_addn(e, http2env(r->pool, hdrs[i].key), hdrs[i].val); } } if (!(env_path = getenv("PATH"))) { env_path = DEFAULT_PATH; } apr_table_addn(e, "PATH", apr_pstrdup(r->pool, env_path)); #ifdef WIN32 if ((env_temp = getenv("SystemRoot")) != NULL) { apr_table_addn(e, "SystemRoot", env_temp); } if ((env_temp = getenv("COMSPEC")) != NULL) { apr_table_addn(e, "COMSPEC", env_temp); } if ((env_temp = getenv("PATHEXT")) != NULL) { apr_table_addn(e, "PATHEXT", env_temp); } if ((env_temp = getenv("WINDIR")) != NULL) { apr_table_addn(e, "WINDIR", env_temp); } #endif #ifdef OS2 if ((env_temp = getenv("COMSPEC")) != NULL) { apr_table_addn(e, "COMSPEC", env_temp); } if ((env_temp = getenv("ETC")) != NULL) { apr_table_addn(e, "ETC", env_temp); } if ((env_temp = getenv("DPATH")) != NULL) { apr_table_addn(e, "DPATH", env_temp); } if ((env_temp = getenv("PERLLIB_PREFIX")) != NULL) { apr_table_addn(e, "PERLLIB_PREFIX", env_temp); } #endif #ifdef BEOS if ((env_temp = getenv("LIBRARY_PATH")) != NULL) { apr_table_addn(e, "LIBRARY_PATH", env_temp); } #endif apr_table_addn(e, "SERVER_SIGNATURE", ap_psignature("", r)); apr_table_addn(e, "SERVER_SOFTWARE", ap_get_server_banner()); apr_table_addn(e, "SERVER_NAME", ap_escape_html(r->pool, ap_get_server_name(r))); apr_table_addn(e, "SERVER_ADDR", r->connection->local_ip); /* Apache */ apr_table_addn(e, "SERVER_PORT", apr_psprintf(r->pool, "%u", ap_get_server_port(r))); host = ap_get_remote_host(c, r->per_dir_config, REMOTE_HOST, NULL); if (host) { apr_table_addn(e, "REMOTE_HOST", host); } #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER < 3 apr_table_addn(e, "REMOTE_ADDR", c->remote_ip); #else apr_table_addn(e, "REMOTE_ADDR", c->client_ip); #endif apr_table_addn(e, "DOCUMENT_ROOT", ap_document_root(r)); /* Apache */ apr_table_addn(e, "SERVER_ADMIN", s->server_admin); /* Apache */ apr_table_addn(e, "SCRIPT_FILENAME", r->filename); /* Apache */ #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER < 3 rport = c->remote_addr->port; #else rport = c->client_addr->port; #endif apr_table_addn(e, "REMOTE_PORT", apr_itoa(r->pool, rport)); if (r->user) { apr_table_addn(e, "REMOTE_USER", r->user); } else if (r->prev) { request_rec *back = r->prev; while (back) { if (back->user) { apr_table_addn(e, "REDIRECT_REMOTE_USER", back->user); break; } back = back->prev; } } if (r->ap_auth_type) { apr_table_addn(e, "AUTH_TYPE", r->ap_auth_type); } //rem_logname = ap_get_remote_logname(r); //if (rem_logname) { // apr_table_addn(e, "REMOTE_IDENT", apr_pstrdup(r->pool, rem_logname)); //} /* Apache custom error responses. If we have redirected set two new vars */ if (r->prev) { if (r->prev->args) { apr_table_addn(e, "REDIRECT_QUERY_STRING", r->prev->args); } if (r->prev->uri) { apr_table_addn(e, "REDIRECT_URL", r->prev->uri); } } if (e != r->subprocess_env) { apr_table_overlap(r->subprocess_env, e, APR_OVERLAP_TABLES_SET); } } #ifndef WIN32 #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER < 3 unixd_config_rec unixd_config; #else unixd_config_rec ap_unixd_config; #endif const char *ap_server_argv0 = "nginx"; #ifdef HAVE_GETPWNAM AP_DECLARE(uid_t) ap_uname2id(const char *name) { struct passwd *ent; if (name[0] == '#') return (atoi(&name[1])); if (!(ent = getpwnam(name))) { ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, "%s: bad user name %s", ap_server_argv0, name); exit(1); } return (ent->pw_uid); } #endif #ifdef HAVE_GETGRNAM AP_DECLARE(gid_t) ap_gname2id(const char *name) { struct group *ent; if (name[0] == '#') return (atoi(&name[1])); if (!(ent = getgrnam(name))) { ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, "%s: bad group name %s", ap_server_argv0, name); exit(1); } return (ent->gr_gid); } #endif AP_DECLARE(void) unixd_pre_config(apr_pool_t *ptemp) { apr_finfo_t wrapper; #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER < 3 unixd_config.user_name = DEFAULT_USER; unixd_config.user_id = ap_uname2id(DEFAULT_USER); unixd_config.group_id = ap_gname2id(DEFAULT_GROUP); unixd_config.suexec_enabled = 0; #else ap_unixd_config.user_name = DEFAULT_USER; ap_unixd_config.user_id = ap_uname2id(DEFAULT_USER); ap_unixd_config.group_id = ap_gname2id(DEFAULT_GROUP); ap_unixd_config.suexec_enabled = 0; #endif /* if ((apr_stat(&wrapper, SUEXEC_BIN, APR_FINFO_NORM, ptemp)) != APR_SUCCESS) { return; } if ((wrapper.protection & APR_USETID) && wrapper.user == 0) { unixd_config.suexec_enabled = 1; }*/ } /* XXX move to APR and externalize (but implement differently :) ) */ static apr_lockmech_e proc_mutex_mech(apr_proc_mutex_t *pmutex) { const char *mechname = apr_proc_mutex_name(pmutex); if (!strcmp(mechname, "sysvsem")) { return APR_LOCK_SYSVSEM; } else if (!strcmp(mechname, "flock")) { return APR_LOCK_FLOCK; } return APR_LOCK_DEFAULT; } #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER < 3 AP_DECLARE(apr_status_t) unixd_set_proc_mutex_perms(apr_proc_mutex_t *pmutex) { //////////////// if (unixd_config.user_name == NULL) { unixd_pre_config(NULL); } //////////////// if (!geteuid()) { apr_lockmech_e mech = proc_mutex_mech(pmutex); switch(mech) { #if APR_HAS_SYSVSEM_SERIALIZE case APR_LOCK_SYSVSEM: { apr_os_proc_mutex_t ospmutex; #if !APR_HAVE_UNION_SEMUN union semun { long val; struct semid_ds *buf; unsigned short *array; }; #endif union semun ick; struct semid_ds buf; memset(&buf,0,sizeof(buf)); apr_os_proc_mutex_get(&ospmutex, pmutex); buf.sem_perm.uid = unixd_config.user_id; buf.sem_perm.gid = unixd_config.group_id; buf.sem_perm.mode = 0600; ick.buf = &buf; if (semctl(ospmutex.crossproc, 0, IPC_SET, ick) < 0) { return errno; } } break; #endif #if APR_HAS_FLOCK_SERIALIZE case APR_LOCK_FLOCK: { const char *lockfile = apr_proc_mutex_lockfile(pmutex); if (lockfile) { if (chown(lockfile, unixd_config.user_id, -1 /* no gid change */) < 0) { return errno; } } } break; #endif default: /* do nothing */ break; } } return APR_SUCCESS; } AP_DECLARE(apr_status_t) unixd_set_global_mutex_perms(apr_global_mutex_t *gmutex) { #if !APR_PROC_MUTEX_IS_GLOBAL apr_os_global_mutex_t osgmutex; apr_os_global_mutex_get(&osgmutex, gmutex); return unixd_set_proc_mutex_perms(osgmutex.proc_mutex); #else /* APR_PROC_MUTEX_IS_GLOBAL */ /* In this case, apr_proc_mutex_t and apr_global_mutex_t are the same. */ return unixd_set_proc_mutex_perms(gmutex); #endif /* APR_PROC_MUTEX_IS_GLOBAL */ } #else AP_DECLARE(apr_status_t) ap_unixd_set_proc_mutex_perms(apr_proc_mutex_t *pmutex) { if (ap_unixd_config.user_name == NULL) { unixd_pre_config(NULL); } if (!geteuid()) { apr_lockmech_e mech = proc_mutex_mech(pmutex); switch(mech) { #if APR_HAS_SYSVSEM_SERIALIZE case APR_LOCK_SYSVSEM: { apr_os_proc_mutex_t ospmutex; #if !APR_HAVE_UNION_SEMUN union semun { long val; struct semid_ds *buf; unsigned short *array; }; #endif union semun ick; struct semid_ds buf; apr_os_proc_mutex_get(&ospmutex, pmutex); buf.sem_perm.uid = ap_unixd_config.user_id; buf.sem_perm.gid = ap_unixd_config.group_id; buf.sem_perm.mode = 0600; ick.buf = &buf; if (semctl(ospmutex.crossproc, 0, IPC_SET, ick) < 0) { return errno; } } break; #endif #if APR_HAS_FLOCK_SERIALIZE case APR_LOCK_FLOCK: { const char *lockfile = apr_proc_mutex_lockfile(pmutex); if (lockfile) { if (chown(lockfile, ap_unixd_config.user_id, -1 /* no gid change */) < 0) { return errno; } } } break; #endif default: /* do nothing */ break; } } return APR_SUCCESS; } AP_DECLARE(apr_status_t) ap_unixd_set_global_mutex_perms(apr_global_mutex_t *gmutex) { #if !APR_PROC_MUTEX_IS_GLOBAL apr_os_global_mutex_t osgmutex; apr_os_global_mutex_get(&osgmutex, gmutex); return ap_unixd_set_proc_mutex_perms(osgmutex.proc_mutex); #else /* APR_PROC_MUTEX_IS_GLOBAL */ /* In this case, apr_proc_mutex_t and apr_global_mutex_t are the same. */ return ap_unixd_set_proc_mutex_perms(gmutex); #endif /* APR_PROC_MUTEX_IS_GLOBAL */ } #endif #endif modsecurity-apache_2.7.7/standalone/main.cpp0000664000175000017500000002062312243422537021422 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ //#undef inline #define inline inline #include #include #include "api.h" char *config_file = NULL; char *url_file = NULL; char *event_files[1024]; int event_file_cnt; char *event_file = NULL; int event_file_len = 0; char **event_file_lines; int event_line_cnt = 0; int event_file_blocks[256]; #define EVENT_FILE_MAX_SIZE (16*1024*1024) #define MAX_URLS 4096 char urls[MAX_URLS][4096]; int url_cnt = 0; void readeventfile(char *name) { if(event_file == NULL) { event_file = (char *)malloc(EVENT_FILE_MAX_SIZE); event_file_lines = (char **)malloc(EVENT_FILE_MAX_SIZE); } event_file_len = 0; event_line_cnt = 0; memset(event_file_blocks, -1, sizeof(int) * 256); FILE *fr = fopen(name, "rb"); if(fr == NULL) return; event_file_len = fread(event_file, 1, EVENT_FILE_MAX_SIZE - 1, fr); fclose(fr); event_file[event_file_len] = 0; } void parseeventfile() { if(event_file_len == 0 || event_file == NULL) return; char *t = event_file; char *e = event_file + event_file_len; int nocrlf = 1; while(t < e) { event_file_lines[event_line_cnt++] = t; while(t < e && *t != 10 && *t != 13) t++; char ct = *t; *t = 0; int i = event_line_cnt - 1; int l = strlen(event_file_lines[i]); if(l == 14 && event_file_lines[i][0] == '-' && event_file_lines[i][1] == '-' && event_file_lines[i][l-2] == '-' && event_file_lines[i][l-1] == '-') { char blk = event_file_lines[i][l-3]; event_file_blocks[blk] = i; if(blk == 'C' || blk == 'G') { nocrlf = 0; } else { nocrlf = 1; } } *t = ct; if(nocrlf) while(t < e && (*t == 10 || *t == 13)) *t++ = 0; else while(t < e && (*t == 10 || *t == 13)) t++; } } void parseargs(int argc, char *argv[]) { int i = 1; event_file_cnt = 0; while(i < argc) { if(argv[i][0] == '-') { if(argv[i][1] == 'c' && i < argc - 1) { config_file = argv[i + 1]; i += 2; continue; } if(argv[i][1] == 'u' && i < argc - 1) { url_file = argv[i + 1]; i += 2; continue; } i++; continue; } if(event_file_cnt == 1024) { fprintf(stderr, "Too many input files! (limit 1024)\n"); break; } event_files[event_file_cnt++] = argv[i++]; } } void log(void *obj, int level, char *str) { printf("%s\n", str); } unsigned int bodypos = 0; apr_status_t readbody(request_rec *r, char *buf, unsigned int length, unsigned int *readcnt, int *is_eos) { int j = event_file_blocks['C']; if(j < 0) { *is_eos = 1; return APR_SUCCESS; } j++; if(event_file_lines[j][0] == 0) { *is_eos = 1; return APR_SUCCESS; } unsigned int l = strlen(event_file_lines[j]); unsigned int size = length; if(bodypos + size > l) size = l - bodypos; memcpy(buf, &event_file_lines[j][bodypos], size); bodypos += size; *readcnt = size; if(bodypos == l) { *is_eos = 1; } return APR_SUCCESS; } unsigned int responsepos = 0; apr_status_t readresponse(request_rec *r, char *buf, unsigned int length, unsigned int *readcnt, int *is_eos) { int j = event_file_blocks['G']; if(j < 0) { *is_eos = 1; return APR_SUCCESS; } j++; if(event_file_lines[j][0] == 0) { *is_eos = 1; return APR_SUCCESS; } unsigned int l = strlen(event_file_lines[j]); unsigned int size = length; if(responsepos + size > l) size = l - responsepos; memcpy(buf, &event_file_lines[j][responsepos], size); responsepos += size; *readcnt = size; if(responsepos == l) *is_eos = 1; return APR_SUCCESS; } void main(int argc, char *argv[]) { directory_config *config; conn_rec *c; request_rec *r; parseargs(argc, argv); if(config_file == NULL || argc < 3) { printf("Usage:\n"); printf("standalone.exe -c [-u ] [ ...]\n"); return; } modsecSetLogHook(NULL, log); modsecSetReadBody(readbody); modsecSetReadResponse(readresponse); modsecInit(); modsecStartConfig(); config = modsecGetDefaultConfig(); const char * err = modsecProcessConfig(config, config_file, "c:\\inetpub\\wwwroot"); if(err != NULL) { printf("%s\n", err); } modsecFinalizeConfig(); modsecInitProcess(); if(url_file != NULL) { FILE *fr = fopen(url_file, "rb"); int i = 0; while(fgets(urls[i],4096,fr) != NULL) { urls[i][4095] = 0; int l = strlen(urls[i]) - 1; if(l < 8) continue; while(urls[i][l] == 10 || urls[i][l] == 13) l--; urls[i++][l + 1] = 0; } url_cnt = i; fclose(fr); } for(int i = 0; i < event_file_cnt; i++) { if(url_cnt == 0) { urls[0][0] = 0; url_cnt = 1; } for(int ui = 0; ui < url_cnt; ui++) { readeventfile(event_files[i]); parseeventfile(); bodypos = 0; responsepos = 0; c = modsecNewConnection(); modsecProcessConnection(c); r = modsecNewRequest(c, config); int j = event_file_blocks['B']; if(j < 0) continue; j++; if(event_file_lines[j][0] == 0) continue; char *method = event_file_lines[j]; char *url = strchr(method, 32); char *proto = strchr(url + 1, 32); if(url == NULL || proto == NULL) continue; *url++=0; *proto++=0; if(urls[ui][0] != 0) { url = urls[ui]; } #define SETMETHOD(m) if(strcmp(method,#m) == 0){ r->method = method; r->method_number = M_##m; } r->method = "INVALID"; r->method_number = M_INVALID; SETMETHOD(OPTIONS) SETMETHOD(GET) SETMETHOD(POST) SETMETHOD(PUT) SETMETHOD(DELETE) SETMETHOD(TRACE) SETMETHOD(CONNECT) SETMETHOD(MOVE) SETMETHOD(COPY) SETMETHOD(PROPFIND) SETMETHOD(PROPPATCH) SETMETHOD(MKCOL) SETMETHOD(LOCK) SETMETHOD(UNLOCK) r->protocol = proto; while(event_file_lines[++j][0] != 0) { char *value = strchr(event_file_lines[j], ':'); if(value == NULL) break; *value++ = 0; while(*value <=32 && *value != 0) value++; apr_table_setn(r->headers_in, event_file_lines[j], value); } r->content_encoding = apr_table_get(r->headers_in, "Content-Encoding"); r->content_type = apr_table_get(r->headers_in, "Content-Type"); r->hostname = apr_table_get(r->headers_in, "Host"); r->path_info = url; char *query = strchr(url, '?'); char *rawurl = url; if(query != NULL) { rawurl = (char *)apr_palloc(r->pool, strlen(url) + 1); strcpy(rawurl, url); *query++ = 0; r->args = query; } const char *lng = apr_table_get(r->headers_in, "Content-Languages"); if(lng != NULL) { r->content_languages = apr_array_make(r->pool, 1, sizeof(const char *)); *(const char **)apr_array_push(r->content_languages) = lng; } r->request_time = apr_time_now(); r->parsed_uri.scheme = "http"; r->parsed_uri.path = r->path_info; r->parsed_uri.hostname = (char *)r->hostname; r->parsed_uri.is_initialized = 1; r->parsed_uri.port = 80; r->parsed_uri.port_str = "80"; r->parsed_uri.query = r->args; r->parsed_uri.dns_looked_up = 0; r->parsed_uri.dns_resolved = 0; r->parsed_uri.password = NULL; r->parsed_uri.user = NULL; r->parsed_uri.fragment = NULL; r->unparsed_uri = rawurl; r->uri = r->unparsed_uri; r->the_request = (char *)apr_palloc(r->pool, strlen(r->method) + 1 + strlen(r->uri) + 1 + strlen(r->protocol) + 1); strcpy(r->the_request, r->method); strcat(r->the_request, " "); strcat(r->the_request, r->uri); strcat(r->the_request, " "); strcat(r->the_request, r->protocol); apr_table_setn(r->subprocess_env, "UNIQUE_ID", "1"); modsecProcessRequest(r); modsecProcessResponse(r); modsecFinishRequest(r); } } modsecTerminate(); getch(); } modsecurity-apache_2.7.7/standalone/regex.c0000664000175000017500000001023212243422537021243 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #include #include "http_core.h" #include "http_request.h" #include "modsecurity.h" #include "apache2.h" #include "http_main.h" #include "http_connection.h" #include "apr_optional.h" #include "mod_log_config.h" #include "msc_logging.h" #include "msc_util.h" #include "ap_mpm.h" #include "scoreboard.h" #include "apr_version.h" #include "apr_lib.h" #include "ap_config.h" #include "http_config.h" static apr_status_t regex_cleanup(void *preg) { ap_regfree((ap_regex_t *) preg); return APR_SUCCESS; } AP_DECLARE(ap_regex_t *) ap_pregcomp(apr_pool_t *p, const char *pattern, int cflags) { ap_regex_t *preg = apr_palloc(p, sizeof *preg); if (ap_regcomp(preg, pattern, cflags)) { return NULL; } apr_pool_cleanup_register(p, (void *) preg, regex_cleanup, apr_pool_cleanup_null); return preg; } AP_DECLARE(void) ap_regfree(ap_regex_t *preg) { (pcre_free)(preg->re_pcre); } AP_DECLARE(int) ap_regcomp(ap_regex_t *preg, const char *pattern, int cflags) { const char *errorptr; int erroffset; int options = 0; int nsub = 0; if ((cflags & AP_REG_ICASE) != 0) options |= PCRE_CASELESS; if ((cflags & AP_REG_NEWLINE) != 0) options |= PCRE_MULTILINE; preg->re_pcre = pcre_compile(pattern, options, &errorptr, &erroffset, NULL); preg->re_erroffset = erroffset; if (preg->re_pcre == NULL) return AP_REG_INVARG; pcre_fullinfo((const pcre *)preg->re_pcre, NULL, PCRE_INFO_CAPTURECOUNT, &nsub); preg->re_nsub = nsub; return 0; } #ifndef POSIX_MALLOC_THRESHOLD #define POSIX_MALLOC_THRESHOLD (10) #endif AP_DECLARE(int) ap_regexec(const ap_regex_t *preg, const char *string, apr_size_t nmatch, ap_regmatch_t pmatch[], int eflags) { int rc; int options = 0; int *ovector = NULL; int small_ovector[POSIX_MALLOC_THRESHOLD * 3]; int allocated_ovector = 0; if ((eflags & AP_REG_NOTBOL) != 0) options |= PCRE_NOTBOL; if ((eflags & AP_REG_NOTEOL) != 0) options |= PCRE_NOTEOL; ((ap_regex_t *)preg)->re_erroffset = (apr_size_t)(-1); /* Only has meaning after compile */ if (nmatch > 0) { if (nmatch <= POSIX_MALLOC_THRESHOLD) { ovector = &(small_ovector[0]); } else { ovector = (int *)malloc(sizeof(int) * nmatch * 3); if (ovector == NULL) return AP_REG_ESPACE; allocated_ovector = 1; } } rc = pcre_exec((const pcre *)preg->re_pcre, NULL, string, (int)strlen(string), 0, options, ovector, nmatch * 3); if (rc == 0) rc = nmatch; /* All captured slots were filled in */ if (rc >= 0) { apr_size_t i; for (i = 0; i < (apr_size_t)rc; i++) { pmatch[i].rm_so = ovector[i*2]; pmatch[i].rm_eo = ovector[i*2+1]; } if (allocated_ovector) free(ovector); for (; i < nmatch; i++) pmatch[i].rm_so = pmatch[i].rm_eo = -1; return 0; } else { if (allocated_ovector) free(ovector); switch(rc) { case PCRE_ERROR_NOMATCH: return AP_REG_NOMATCH; case PCRE_ERROR_NULL: return AP_REG_INVARG; case PCRE_ERROR_BADOPTION: return AP_REG_INVARG; case PCRE_ERROR_BADMAGIC: return AP_REG_INVARG; case PCRE_ERROR_UNKNOWN_NODE: return AP_REG_ASSERT; case PCRE_ERROR_NOMEMORY: return AP_REG_ESPACE; #ifdef PCRE_ERROR_MATCHLIMIT case PCRE_ERROR_MATCHLIMIT: return AP_REG_ESPACE; #endif #ifdef PCRE_ERROR_BADUTF8 case PCRE_ERROR_BADUTF8: return AP_REG_INVARG; #endif #ifdef PCRE_ERROR_BADUTF8_OFFSET case PCRE_ERROR_BADUTF8_OFFSET: return AP_REG_INVARG; #endif default: return AP_REG_ASSERT; } } } modsecurity-apache_2.7.7/standalone/standalone.vcxproj.user0000664000175000017500000000155212243422537024514 0ustar zimmerlezimmerle -c d:\temp\antixss.conf -u d:\temp\modsec_urls.txt d:\temp\test1.dat WindowsLocalDebugger $(TargetPath) false NativeOnly -c d:\xss.conf d:\test.dat WindowsLocalDebugger modsecurity-apache_2.7.7/standalone/Makefile.in0000664000175000017500000020746312254306021022037 0ustar zimmerlezimmerle# Makefile.in generated by automake 1.13.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = standalone DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/build/depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/build/find_apr.m4 \ $(top_srcdir)/build/find_apu.m4 \ $(top_srcdir)/build/find_curl.m4 \ $(top_srcdir)/build/find_lua.m4 \ $(top_srcdir)/build/find_pcre.m4 \ $(top_srcdir)/build/find_xml.m4 $(top_srcdir)/build/libtool.m4 \ $(top_srcdir)/build/ltoptions.m4 \ $(top_srcdir)/build/ltsugar.m4 \ $(top_srcdir)/build/ltversion.m4 \ $(top_srcdir)/build/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/apache2/modsecurity_config_auto.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(pkglibdir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) standalone_la_DEPENDENCIES = am_standalone_la_OBJECTS = standalone_la-acmp.lo \ standalone_la-apache2_config.lo standalone_la-apache2_io.lo \ standalone_la-apache2_util.lo \ standalone_la-libinjection_sqli.lo \ standalone_la-mod_security2.lo standalone_la-modsecurity.lo \ standalone_la-msc_crypt.lo standalone_la-msc_geo.lo \ standalone_la-msc_gsb.lo standalone_la-msc_logging.lo \ standalone_la-msc_lua.lo standalone_la-msc_multipart.lo \ standalone_la-msc_parsers.lo standalone_la-msc_pcre.lo \ standalone_la-msc_release.lo standalone_la-msc_reqbody.lo \ standalone_la-msc_tree.lo standalone_la-msc_unicode.lo \ standalone_la-msc_util.lo standalone_la-msc_xml.lo \ standalone_la-persist_dbm.lo standalone_la-re_actions.lo \ standalone_la-re.lo standalone_la-re_operators.lo \ standalone_la-re_tfns.lo standalone_la-re_variables.lo \ standalone_la-api.lo standalone_la-buckets.lo \ standalone_la-config.lo standalone_la-filters.lo \ standalone_la-hooks.lo standalone_la-regex.lo \ standalone_la-server.lo standalone_la_OBJECTS = $(am_standalone_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = standalone_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(standalone_la_CFLAGS) \ $(CFLAGS) $(standalone_la_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/apache2 depcomp = $(SHELL) $(top_srcdir)/build/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(standalone_la_SOURCES) DIST_SOURCES = $(standalone_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) pkglibdir = $(prefix)/lib ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APR_CFLAGS = @APR_CFLAGS@ APR_CONFIG = @APR_CONFIG@ APR_CPPFLAGS = @APR_CPPFLAGS@ APR_INCLUDEDIR = @APR_INCLUDEDIR@ APR_LDADD = @APR_LDADD@ APR_LDFLAGS = @APR_LDFLAGS@ APR_LINKLD = @APR_LINKLD@ APR_VERSION = @APR_VERSION@ APU_CFLAGS = @APU_CFLAGS@ APU_CONFIG = @APU_CONFIG@ APU_INCLUDEDIR = @APU_INCLUDEDIR@ APU_LDADD = @APU_LDADD@ APU_LDFLAGS = @APU_LDFLAGS@ APU_LINKLD = @APU_LINKLD@ APU_VERSION = @APU_VERSION@ APXS = @APXS@ APXS_BINDIR = @APXS_BINDIR@ APXS_CC = @APXS_CC@ APXS_CFLAGS = @APXS_CFLAGS@ APXS_EXTRA_CFLAGS = @APXS_EXTRA_CFLAGS@ APXS_HTTPD = @APXS_HTTPD@ APXS_INCLUDEDIR = @APXS_INCLUDEDIR@ APXS_INCLUDES = @APXS_INCLUDES@ APXS_LDFLAGS = @APXS_LDFLAGS@ APXS_LIBDIR = @APXS_LIBDIR@ APXS_LIBEXECDIR = @APXS_LIBEXECDIR@ APXS_LIBS = @APXS_LIBS@ APXS_LIBTOOL = @APXS_LIBTOOL@ APXS_MODULES = @APXS_MODULES@ APXS_PROGNAME = @APXS_PROGNAME@ APXS_SBINDIR = @APXS_SBINDIR@ APXS_WRAPPER = @APXS_WRAPPER@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CURL_CFLAGS = @CURL_CFLAGS@ CURL_CONFIG = @CURL_CONFIG@ CURL_CPPFLAGS = @CURL_CPPFLAGS@ CURL_LDADD = @CURL_LDADD@ CURL_LDFLAGS = @CURL_LDFLAGS@ CURL_USES_GNUTLS = @CURL_USES_GNUTLS@ CURL_VERSION = @CURL_VERSION@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENV_CMD = @ENV_CMD@ EXEEXT = @EXEEXT@ EXTRA_CFLAGS = @EXTRA_CFLAGS@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ LIBXML2_CONFIG = @LIBXML2_CONFIG@ LIBXML2_CPPFLAGS = @LIBXML2_CPPFLAGS@ LIBXML2_LDADD = @LIBXML2_LDADD@ LIBXML2_LDFLAGS = @LIBXML2_LDFLAGS@ LIBXML2_VERSION = @LIBXML2_VERSION@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LUA_CFLAGS = @LUA_CFLAGS@ LUA_LDADD = @LUA_LDADD@ LUA_LDFLAGS = @LUA_LDFLAGS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MODSEC_APXS_EXTRA_CFLAGS = @MODSEC_APXS_EXTRA_CFLAGS@ MODSEC_EXTRA_CFLAGS = @MODSEC_EXTRA_CFLAGS@ MSC_BASE_DIR = @MSC_BASE_DIR@ MSC_PKGBASE_DIR = @MSC_PKGBASE_DIR@ MSC_REGRESSION_CONF_DIR = @MSC_REGRESSION_CONF_DIR@ MSC_REGRESSION_DIR = @MSC_REGRESSION_DIR@ MSC_REGRESSION_DOCROOT_DIR = @MSC_REGRESSION_DOCROOT_DIR@ MSC_REGRESSION_LOGS_DIR = @MSC_REGRESSION_LOGS_DIR@ MSC_REGRESSION_SERVERROOT_DIR = @MSC_REGRESSION_SERVERROOT_DIR@ MSC_TEST_DIR = @MSC_TEST_DIR@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCRE_CFLAGS = @PCRE_CFLAGS@ PCRE_CONFIG = @PCRE_CONFIG@ PCRE_CPPFLAGS = @PCRE_CPPFLAGS@ PCRE_LDADD = @PCRE_LDADD@ PCRE_LDFLAGS = @PCRE_LDFLAGS@ PCRE_LD_PATH = @PCRE_LD_PATH@ PCRE_VERSION = @PCRE_VERSION@ PERL = @PERL@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOPLEVEL_SUBDIRS = @TOPLEVEL_SUBDIRS@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ pkglib_LTLIBRARIES = standalone.la standalone_la_SOURCES = ../apache2/acmp.c \ ../apache2/apache2_config.c \ ../apache2/apache2_io.c \ ../apache2/apache2_util.c \ ../apache2/libinjection/libinjection_sqli.c \ ../apache2/mod_security2.c \ ../apache2/modsecurity.c \ ../apache2/msc_crypt.c \ ../apache2/msc_geo.c \ ../apache2/msc_gsb.c \ ../apache2/msc_logging.c \ ../apache2/msc_lua.c \ ../apache2/msc_multipart.c \ ../apache2/msc_parsers.c \ ../apache2/msc_pcre.c \ ../apache2/msc_release.c \ ../apache2/msc_reqbody.c \ ../apache2/msc_tree.c \ ../apache2/msc_unicode.c \ ../apache2/msc_util.c \ ../apache2/msc_xml.c \ ../apache2/persist_dbm.c \ ../apache2/re_actions.c \ ../apache2/re.c \ ../apache2/re_operators.c \ ../apache2/re_tfns.c \ ../apache2/re_variables.c \ api.c \ buckets.c \ config.c \ filters.c \ hooks.c \ regex.c \ server.c standalone_la_CFLAGS = -DVERSION_NGINX \ @APR_CFLAGS@ \ @APU_CFLAGS@ \ @APXS_CFLAGS@ \ @CURL_CFLAGS@ \ @LIBXML2_CFLAGS@ \ @LUA_CFLAGS@ \ @MODSEC_EXTRA_CFLAGS@ \ @PCRE_CFLAGS@ standalone_la_CPPFLAGS = @APR_CPPFLAGS@ \ @LIBXML2_CPPFLAGS@ \ @PCRE_CPPFLAGS@ standalone_la_LIBADD = @APR_LDADD@ \ @APU_LDADD@ \ @LIBXML2_LDADD@ \ @LUA_LDADD@ \ @PCRE_LDADD@ @AIX_TRUE@standalone_la_LDFLAGS = -module -avoid-version \ @AIX_TRUE@ @APR_LDFLAGS@ \ @AIX_TRUE@ @APU_LDFLAGS@ \ @AIX_TRUE@ @APXS_LDFLAGS@ \ @AIX_TRUE@ @LIBXML2_LDFLAGS@ \ @AIX_TRUE@ @LUA_LDFLAGS@ \ @AIX_TRUE@ @PCRE_LDFLAGS@ @FREEBSD_TRUE@standalone_la_LDFLAGS = -no-undefined -module -avoid-version \ @FREEBSD_TRUE@ @APR_LDFLAGS@ \ @FREEBSD_TRUE@ @APU_LDFLAGS@ \ @FREEBSD_TRUE@ @APXS_LDFLAGS@ \ @FREEBSD_TRUE@ @LIBXML2_LDFLAGS@ \ @FREEBSD_TRUE@ @LUA_LDFLAGS@ \ @FREEBSD_TRUE@ @PCRE_LDFLAGS@ @HPUX_TRUE@standalone_la_LDFLAGS = -module -avoid-version \ @HPUX_TRUE@ @APR_LDFLAGS@ \ @HPUX_TRUE@ @APU_LDFLAGS@ \ @HPUX_TRUE@ @APXS_LDFLAGS@ \ @HPUX_TRUE@ @LIBXML2_LDFLAGS@ \ @HPUX_TRUE@ @LUA_LDFLAGS@ \ @HPUX_TRUE@ @PCRE_LDFLAGS@ @LINUX_TRUE@standalone_la_LDFLAGS = -no-undefined -module -avoid-version \ @LINUX_TRUE@ @APR_LDFLAGS@ \ @LINUX_TRUE@ @APU_LDFLAGS@ \ @LINUX_TRUE@ @APXS_LDFLAGS@ \ @LINUX_TRUE@ @LIBXML2_LDFLAGS@ \ @LINUX_TRUE@ @LUA_LDFLAGS@ \ @LINUX_TRUE@ @PCRE_LDFLAGS@ @MACOSX_TRUE@standalone_la_LDFLAGS = -module -avoid-version \ @MACOSX_TRUE@ @APR_LDFLAGS@ \ @MACOSX_TRUE@ @APU_LDFLAGS@ \ @MACOSX_TRUE@ @APXS_LDFLAGS@ \ @MACOSX_TRUE@ @LIBXML2_LDFLAGS@ \ @MACOSX_TRUE@ @LUA_LDFLAGS@ \ @MACOSX_TRUE@ @PCRE_LDFLAGS@ @NETBSD_TRUE@standalone_la_LDFLAGS = -no-undefined -module -avoid-version \ @NETBSD_TRUE@ @APR_LDFLAGS@ \ @NETBSD_TRUE@ @APU_LDFLAGS@ \ @NETBSD_TRUE@ @APXS_LDFLAGS@ \ @NETBSD_TRUE@ @LIBXML2_LDFLAGS@ \ @NETBSD_TRUE@ @LUA_LDFLAGS@ \ @NETBSD_TRUE@ @PCRE_LDFLAGS@ @OPENBSD_TRUE@standalone_la_LDFLAGS = -no-undefined -module -avoid-version \ @OPENBSD_TRUE@ @APR_LDFLAGS@ \ @OPENBSD_TRUE@ @APU_LDFLAGS@ \ @OPENBSD_TRUE@ @APXS_LDFLAGS@ \ @OPENBSD_TRUE@ @LIBXML2_LDFLAGS@ \ @OPENBSD_TRUE@ @LUA_LDFLAGS@ \ @OPENBSD_TRUE@ @PCRE_LDFLAGS@ @SOLARIS_TRUE@standalone_la_LDFLAGS = -module -avoid-version \ @SOLARIS_TRUE@ @APR_LDFLAGS@ \ @SOLARIS_TRUE@ @APU_LDFLAGS@ \ @SOLARIS_TRUE@ @APXS_LDFLAGS@ \ @SOLARIS_TRUE@ @LIBXML2_LDFLAGS@ \ @SOLARIS_TRUE@ @LUA_LDFLAGS@ \ @SOLARIS_TRUE@ @PCRE_LDFLAGS@ all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign standalone/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign standalone/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(MKDIR_P) '$(DESTDIR)$(pkglibdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ } uninstall-pkglibLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ done clean-pkglibLTLIBRARIES: -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) @list='$(pkglib_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } standalone.la: $(standalone_la_OBJECTS) $(standalone_la_DEPENDENCIES) $(EXTRA_standalone_la_DEPENDENCIES) $(AM_V_CCLD)$(standalone_la_LINK) -rpath $(pkglibdir) $(standalone_la_OBJECTS) $(standalone_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/standalone_la-acmp.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/standalone_la-apache2_config.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/standalone_la-apache2_io.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/standalone_la-apache2_util.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/standalone_la-api.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/standalone_la-buckets.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/standalone_la-config.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/standalone_la-filters.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/standalone_la-hooks.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/standalone_la-libinjection_sqli.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/standalone_la-mod_security2.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/standalone_la-modsecurity.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/standalone_la-msc_crypt.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/standalone_la-msc_geo.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/standalone_la-msc_gsb.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/standalone_la-msc_logging.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/standalone_la-msc_lua.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/standalone_la-msc_multipart.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/standalone_la-msc_parsers.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/standalone_la-msc_pcre.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/standalone_la-msc_release.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/standalone_la-msc_reqbody.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/standalone_la-msc_tree.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/standalone_la-msc_unicode.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/standalone_la-msc_util.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/standalone_la-msc_xml.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/standalone_la-persist_dbm.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/standalone_la-re.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/standalone_la-re_actions.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/standalone_la-re_operators.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/standalone_la-re_tfns.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/standalone_la-re_variables.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/standalone_la-regex.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/standalone_la-server.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< standalone_la-acmp.lo: ../apache2/acmp.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -MT standalone_la-acmp.lo -MD -MP -MF $(DEPDIR)/standalone_la-acmp.Tpo -c -o standalone_la-acmp.lo `test -f '../apache2/acmp.c' || echo '$(srcdir)/'`../apache2/acmp.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/standalone_la-acmp.Tpo $(DEPDIR)/standalone_la-acmp.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../apache2/acmp.c' object='standalone_la-acmp.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -c -o standalone_la-acmp.lo `test -f '../apache2/acmp.c' || echo '$(srcdir)/'`../apache2/acmp.c standalone_la-apache2_config.lo: ../apache2/apache2_config.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -MT standalone_la-apache2_config.lo -MD -MP -MF $(DEPDIR)/standalone_la-apache2_config.Tpo -c -o standalone_la-apache2_config.lo `test -f '../apache2/apache2_config.c' || echo '$(srcdir)/'`../apache2/apache2_config.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/standalone_la-apache2_config.Tpo $(DEPDIR)/standalone_la-apache2_config.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../apache2/apache2_config.c' object='standalone_la-apache2_config.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -c -o standalone_la-apache2_config.lo `test -f '../apache2/apache2_config.c' || echo '$(srcdir)/'`../apache2/apache2_config.c standalone_la-apache2_io.lo: ../apache2/apache2_io.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -MT standalone_la-apache2_io.lo -MD -MP -MF $(DEPDIR)/standalone_la-apache2_io.Tpo -c -o standalone_la-apache2_io.lo `test -f '../apache2/apache2_io.c' || echo '$(srcdir)/'`../apache2/apache2_io.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/standalone_la-apache2_io.Tpo $(DEPDIR)/standalone_la-apache2_io.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../apache2/apache2_io.c' object='standalone_la-apache2_io.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -c -o standalone_la-apache2_io.lo `test -f '../apache2/apache2_io.c' || echo '$(srcdir)/'`../apache2/apache2_io.c standalone_la-apache2_util.lo: ../apache2/apache2_util.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -MT standalone_la-apache2_util.lo -MD -MP -MF $(DEPDIR)/standalone_la-apache2_util.Tpo -c -o standalone_la-apache2_util.lo `test -f '../apache2/apache2_util.c' || echo '$(srcdir)/'`../apache2/apache2_util.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/standalone_la-apache2_util.Tpo $(DEPDIR)/standalone_la-apache2_util.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../apache2/apache2_util.c' object='standalone_la-apache2_util.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -c -o standalone_la-apache2_util.lo `test -f '../apache2/apache2_util.c' || echo '$(srcdir)/'`../apache2/apache2_util.c standalone_la-libinjection_sqli.lo: ../apache2/libinjection/libinjection_sqli.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -MT standalone_la-libinjection_sqli.lo -MD -MP -MF $(DEPDIR)/standalone_la-libinjection_sqli.Tpo -c -o standalone_la-libinjection_sqli.lo `test -f '../apache2/libinjection/libinjection_sqli.c' || echo '$(srcdir)/'`../apache2/libinjection/libinjection_sqli.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/standalone_la-libinjection_sqli.Tpo $(DEPDIR)/standalone_la-libinjection_sqli.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../apache2/libinjection/libinjection_sqli.c' object='standalone_la-libinjection_sqli.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -c -o standalone_la-libinjection_sqli.lo `test -f '../apache2/libinjection/libinjection_sqli.c' || echo '$(srcdir)/'`../apache2/libinjection/libinjection_sqli.c standalone_la-mod_security2.lo: ../apache2/mod_security2.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -MT standalone_la-mod_security2.lo -MD -MP -MF $(DEPDIR)/standalone_la-mod_security2.Tpo -c -o standalone_la-mod_security2.lo `test -f '../apache2/mod_security2.c' || echo '$(srcdir)/'`../apache2/mod_security2.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/standalone_la-mod_security2.Tpo $(DEPDIR)/standalone_la-mod_security2.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../apache2/mod_security2.c' object='standalone_la-mod_security2.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -c -o standalone_la-mod_security2.lo `test -f '../apache2/mod_security2.c' || echo '$(srcdir)/'`../apache2/mod_security2.c standalone_la-modsecurity.lo: ../apache2/modsecurity.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -MT standalone_la-modsecurity.lo -MD -MP -MF $(DEPDIR)/standalone_la-modsecurity.Tpo -c -o standalone_la-modsecurity.lo `test -f '../apache2/modsecurity.c' || echo '$(srcdir)/'`../apache2/modsecurity.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/standalone_la-modsecurity.Tpo $(DEPDIR)/standalone_la-modsecurity.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../apache2/modsecurity.c' object='standalone_la-modsecurity.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -c -o standalone_la-modsecurity.lo `test -f '../apache2/modsecurity.c' || echo '$(srcdir)/'`../apache2/modsecurity.c standalone_la-msc_crypt.lo: ../apache2/msc_crypt.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -MT standalone_la-msc_crypt.lo -MD -MP -MF $(DEPDIR)/standalone_la-msc_crypt.Tpo -c -o standalone_la-msc_crypt.lo `test -f '../apache2/msc_crypt.c' || echo '$(srcdir)/'`../apache2/msc_crypt.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/standalone_la-msc_crypt.Tpo $(DEPDIR)/standalone_la-msc_crypt.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../apache2/msc_crypt.c' object='standalone_la-msc_crypt.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -c -o standalone_la-msc_crypt.lo `test -f '../apache2/msc_crypt.c' || echo '$(srcdir)/'`../apache2/msc_crypt.c standalone_la-msc_geo.lo: ../apache2/msc_geo.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -MT standalone_la-msc_geo.lo -MD -MP -MF $(DEPDIR)/standalone_la-msc_geo.Tpo -c -o standalone_la-msc_geo.lo `test -f '../apache2/msc_geo.c' || echo '$(srcdir)/'`../apache2/msc_geo.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/standalone_la-msc_geo.Tpo $(DEPDIR)/standalone_la-msc_geo.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../apache2/msc_geo.c' object='standalone_la-msc_geo.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -c -o standalone_la-msc_geo.lo `test -f '../apache2/msc_geo.c' || echo '$(srcdir)/'`../apache2/msc_geo.c standalone_la-msc_gsb.lo: ../apache2/msc_gsb.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -MT standalone_la-msc_gsb.lo -MD -MP -MF $(DEPDIR)/standalone_la-msc_gsb.Tpo -c -o standalone_la-msc_gsb.lo `test -f '../apache2/msc_gsb.c' || echo '$(srcdir)/'`../apache2/msc_gsb.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/standalone_la-msc_gsb.Tpo $(DEPDIR)/standalone_la-msc_gsb.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../apache2/msc_gsb.c' object='standalone_la-msc_gsb.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -c -o standalone_la-msc_gsb.lo `test -f '../apache2/msc_gsb.c' || echo '$(srcdir)/'`../apache2/msc_gsb.c standalone_la-msc_logging.lo: ../apache2/msc_logging.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -MT standalone_la-msc_logging.lo -MD -MP -MF $(DEPDIR)/standalone_la-msc_logging.Tpo -c -o standalone_la-msc_logging.lo `test -f '../apache2/msc_logging.c' || echo '$(srcdir)/'`../apache2/msc_logging.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/standalone_la-msc_logging.Tpo $(DEPDIR)/standalone_la-msc_logging.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../apache2/msc_logging.c' object='standalone_la-msc_logging.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -c -o standalone_la-msc_logging.lo `test -f '../apache2/msc_logging.c' || echo '$(srcdir)/'`../apache2/msc_logging.c standalone_la-msc_lua.lo: ../apache2/msc_lua.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -MT standalone_la-msc_lua.lo -MD -MP -MF $(DEPDIR)/standalone_la-msc_lua.Tpo -c -o standalone_la-msc_lua.lo `test -f '../apache2/msc_lua.c' || echo '$(srcdir)/'`../apache2/msc_lua.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/standalone_la-msc_lua.Tpo $(DEPDIR)/standalone_la-msc_lua.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../apache2/msc_lua.c' object='standalone_la-msc_lua.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -c -o standalone_la-msc_lua.lo `test -f '../apache2/msc_lua.c' || echo '$(srcdir)/'`../apache2/msc_lua.c standalone_la-msc_multipart.lo: ../apache2/msc_multipart.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -MT standalone_la-msc_multipart.lo -MD -MP -MF $(DEPDIR)/standalone_la-msc_multipart.Tpo -c -o standalone_la-msc_multipart.lo `test -f '../apache2/msc_multipart.c' || echo '$(srcdir)/'`../apache2/msc_multipart.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/standalone_la-msc_multipart.Tpo $(DEPDIR)/standalone_la-msc_multipart.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../apache2/msc_multipart.c' object='standalone_la-msc_multipart.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -c -o standalone_la-msc_multipart.lo `test -f '../apache2/msc_multipart.c' || echo '$(srcdir)/'`../apache2/msc_multipart.c standalone_la-msc_parsers.lo: ../apache2/msc_parsers.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -MT standalone_la-msc_parsers.lo -MD -MP -MF $(DEPDIR)/standalone_la-msc_parsers.Tpo -c -o standalone_la-msc_parsers.lo `test -f '../apache2/msc_parsers.c' || echo '$(srcdir)/'`../apache2/msc_parsers.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/standalone_la-msc_parsers.Tpo $(DEPDIR)/standalone_la-msc_parsers.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../apache2/msc_parsers.c' object='standalone_la-msc_parsers.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -c -o standalone_la-msc_parsers.lo `test -f '../apache2/msc_parsers.c' || echo '$(srcdir)/'`../apache2/msc_parsers.c standalone_la-msc_pcre.lo: ../apache2/msc_pcre.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -MT standalone_la-msc_pcre.lo -MD -MP -MF $(DEPDIR)/standalone_la-msc_pcre.Tpo -c -o standalone_la-msc_pcre.lo `test -f '../apache2/msc_pcre.c' || echo '$(srcdir)/'`../apache2/msc_pcre.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/standalone_la-msc_pcre.Tpo $(DEPDIR)/standalone_la-msc_pcre.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../apache2/msc_pcre.c' object='standalone_la-msc_pcre.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -c -o standalone_la-msc_pcre.lo `test -f '../apache2/msc_pcre.c' || echo '$(srcdir)/'`../apache2/msc_pcre.c standalone_la-msc_release.lo: ../apache2/msc_release.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -MT standalone_la-msc_release.lo -MD -MP -MF $(DEPDIR)/standalone_la-msc_release.Tpo -c -o standalone_la-msc_release.lo `test -f '../apache2/msc_release.c' || echo '$(srcdir)/'`../apache2/msc_release.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/standalone_la-msc_release.Tpo $(DEPDIR)/standalone_la-msc_release.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../apache2/msc_release.c' object='standalone_la-msc_release.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -c -o standalone_la-msc_release.lo `test -f '../apache2/msc_release.c' || echo '$(srcdir)/'`../apache2/msc_release.c standalone_la-msc_reqbody.lo: ../apache2/msc_reqbody.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -MT standalone_la-msc_reqbody.lo -MD -MP -MF $(DEPDIR)/standalone_la-msc_reqbody.Tpo -c -o standalone_la-msc_reqbody.lo `test -f '../apache2/msc_reqbody.c' || echo '$(srcdir)/'`../apache2/msc_reqbody.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/standalone_la-msc_reqbody.Tpo $(DEPDIR)/standalone_la-msc_reqbody.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../apache2/msc_reqbody.c' object='standalone_la-msc_reqbody.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -c -o standalone_la-msc_reqbody.lo `test -f '../apache2/msc_reqbody.c' || echo '$(srcdir)/'`../apache2/msc_reqbody.c standalone_la-msc_tree.lo: ../apache2/msc_tree.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -MT standalone_la-msc_tree.lo -MD -MP -MF $(DEPDIR)/standalone_la-msc_tree.Tpo -c -o standalone_la-msc_tree.lo `test -f '../apache2/msc_tree.c' || echo '$(srcdir)/'`../apache2/msc_tree.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/standalone_la-msc_tree.Tpo $(DEPDIR)/standalone_la-msc_tree.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../apache2/msc_tree.c' object='standalone_la-msc_tree.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -c -o standalone_la-msc_tree.lo `test -f '../apache2/msc_tree.c' || echo '$(srcdir)/'`../apache2/msc_tree.c standalone_la-msc_unicode.lo: ../apache2/msc_unicode.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -MT standalone_la-msc_unicode.lo -MD -MP -MF $(DEPDIR)/standalone_la-msc_unicode.Tpo -c -o standalone_la-msc_unicode.lo `test -f '../apache2/msc_unicode.c' || echo '$(srcdir)/'`../apache2/msc_unicode.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/standalone_la-msc_unicode.Tpo $(DEPDIR)/standalone_la-msc_unicode.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../apache2/msc_unicode.c' object='standalone_la-msc_unicode.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -c -o standalone_la-msc_unicode.lo `test -f '../apache2/msc_unicode.c' || echo '$(srcdir)/'`../apache2/msc_unicode.c standalone_la-msc_util.lo: ../apache2/msc_util.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -MT standalone_la-msc_util.lo -MD -MP -MF $(DEPDIR)/standalone_la-msc_util.Tpo -c -o standalone_la-msc_util.lo `test -f '../apache2/msc_util.c' || echo '$(srcdir)/'`../apache2/msc_util.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/standalone_la-msc_util.Tpo $(DEPDIR)/standalone_la-msc_util.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../apache2/msc_util.c' object='standalone_la-msc_util.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -c -o standalone_la-msc_util.lo `test -f '../apache2/msc_util.c' || echo '$(srcdir)/'`../apache2/msc_util.c standalone_la-msc_xml.lo: ../apache2/msc_xml.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -MT standalone_la-msc_xml.lo -MD -MP -MF $(DEPDIR)/standalone_la-msc_xml.Tpo -c -o standalone_la-msc_xml.lo `test -f '../apache2/msc_xml.c' || echo '$(srcdir)/'`../apache2/msc_xml.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/standalone_la-msc_xml.Tpo $(DEPDIR)/standalone_la-msc_xml.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../apache2/msc_xml.c' object='standalone_la-msc_xml.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -c -o standalone_la-msc_xml.lo `test -f '../apache2/msc_xml.c' || echo '$(srcdir)/'`../apache2/msc_xml.c standalone_la-persist_dbm.lo: ../apache2/persist_dbm.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -MT standalone_la-persist_dbm.lo -MD -MP -MF $(DEPDIR)/standalone_la-persist_dbm.Tpo -c -o standalone_la-persist_dbm.lo `test -f '../apache2/persist_dbm.c' || echo '$(srcdir)/'`../apache2/persist_dbm.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/standalone_la-persist_dbm.Tpo $(DEPDIR)/standalone_la-persist_dbm.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../apache2/persist_dbm.c' object='standalone_la-persist_dbm.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -c -o standalone_la-persist_dbm.lo `test -f '../apache2/persist_dbm.c' || echo '$(srcdir)/'`../apache2/persist_dbm.c standalone_la-re_actions.lo: ../apache2/re_actions.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -MT standalone_la-re_actions.lo -MD -MP -MF $(DEPDIR)/standalone_la-re_actions.Tpo -c -o standalone_la-re_actions.lo `test -f '../apache2/re_actions.c' || echo '$(srcdir)/'`../apache2/re_actions.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/standalone_la-re_actions.Tpo $(DEPDIR)/standalone_la-re_actions.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../apache2/re_actions.c' object='standalone_la-re_actions.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -c -o standalone_la-re_actions.lo `test -f '../apache2/re_actions.c' || echo '$(srcdir)/'`../apache2/re_actions.c standalone_la-re.lo: ../apache2/re.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -MT standalone_la-re.lo -MD -MP -MF $(DEPDIR)/standalone_la-re.Tpo -c -o standalone_la-re.lo `test -f '../apache2/re.c' || echo '$(srcdir)/'`../apache2/re.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/standalone_la-re.Tpo $(DEPDIR)/standalone_la-re.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../apache2/re.c' object='standalone_la-re.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -c -o standalone_la-re.lo `test -f '../apache2/re.c' || echo '$(srcdir)/'`../apache2/re.c standalone_la-re_operators.lo: ../apache2/re_operators.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -MT standalone_la-re_operators.lo -MD -MP -MF $(DEPDIR)/standalone_la-re_operators.Tpo -c -o standalone_la-re_operators.lo `test -f '../apache2/re_operators.c' || echo '$(srcdir)/'`../apache2/re_operators.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/standalone_la-re_operators.Tpo $(DEPDIR)/standalone_la-re_operators.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../apache2/re_operators.c' object='standalone_la-re_operators.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -c -o standalone_la-re_operators.lo `test -f '../apache2/re_operators.c' || echo '$(srcdir)/'`../apache2/re_operators.c standalone_la-re_tfns.lo: ../apache2/re_tfns.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -MT standalone_la-re_tfns.lo -MD -MP -MF $(DEPDIR)/standalone_la-re_tfns.Tpo -c -o standalone_la-re_tfns.lo `test -f '../apache2/re_tfns.c' || echo '$(srcdir)/'`../apache2/re_tfns.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/standalone_la-re_tfns.Tpo $(DEPDIR)/standalone_la-re_tfns.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../apache2/re_tfns.c' object='standalone_la-re_tfns.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -c -o standalone_la-re_tfns.lo `test -f '../apache2/re_tfns.c' || echo '$(srcdir)/'`../apache2/re_tfns.c standalone_la-re_variables.lo: ../apache2/re_variables.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -MT standalone_la-re_variables.lo -MD -MP -MF $(DEPDIR)/standalone_la-re_variables.Tpo -c -o standalone_la-re_variables.lo `test -f '../apache2/re_variables.c' || echo '$(srcdir)/'`../apache2/re_variables.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/standalone_la-re_variables.Tpo $(DEPDIR)/standalone_la-re_variables.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../apache2/re_variables.c' object='standalone_la-re_variables.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -c -o standalone_la-re_variables.lo `test -f '../apache2/re_variables.c' || echo '$(srcdir)/'`../apache2/re_variables.c standalone_la-api.lo: api.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -MT standalone_la-api.lo -MD -MP -MF $(DEPDIR)/standalone_la-api.Tpo -c -o standalone_la-api.lo `test -f 'api.c' || echo '$(srcdir)/'`api.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/standalone_la-api.Tpo $(DEPDIR)/standalone_la-api.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='api.c' object='standalone_la-api.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -c -o standalone_la-api.lo `test -f 'api.c' || echo '$(srcdir)/'`api.c standalone_la-buckets.lo: buckets.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -MT standalone_la-buckets.lo -MD -MP -MF $(DEPDIR)/standalone_la-buckets.Tpo -c -o standalone_la-buckets.lo `test -f 'buckets.c' || echo '$(srcdir)/'`buckets.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/standalone_la-buckets.Tpo $(DEPDIR)/standalone_la-buckets.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='buckets.c' object='standalone_la-buckets.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -c -o standalone_la-buckets.lo `test -f 'buckets.c' || echo '$(srcdir)/'`buckets.c standalone_la-config.lo: config.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -MT standalone_la-config.lo -MD -MP -MF $(DEPDIR)/standalone_la-config.Tpo -c -o standalone_la-config.lo `test -f 'config.c' || echo '$(srcdir)/'`config.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/standalone_la-config.Tpo $(DEPDIR)/standalone_la-config.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='config.c' object='standalone_la-config.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -c -o standalone_la-config.lo `test -f 'config.c' || echo '$(srcdir)/'`config.c standalone_la-filters.lo: filters.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -MT standalone_la-filters.lo -MD -MP -MF $(DEPDIR)/standalone_la-filters.Tpo -c -o standalone_la-filters.lo `test -f 'filters.c' || echo '$(srcdir)/'`filters.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/standalone_la-filters.Tpo $(DEPDIR)/standalone_la-filters.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='filters.c' object='standalone_la-filters.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -c -o standalone_la-filters.lo `test -f 'filters.c' || echo '$(srcdir)/'`filters.c standalone_la-hooks.lo: hooks.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -MT standalone_la-hooks.lo -MD -MP -MF $(DEPDIR)/standalone_la-hooks.Tpo -c -o standalone_la-hooks.lo `test -f 'hooks.c' || echo '$(srcdir)/'`hooks.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/standalone_la-hooks.Tpo $(DEPDIR)/standalone_la-hooks.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='hooks.c' object='standalone_la-hooks.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -c -o standalone_la-hooks.lo `test -f 'hooks.c' || echo '$(srcdir)/'`hooks.c standalone_la-regex.lo: regex.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -MT standalone_la-regex.lo -MD -MP -MF $(DEPDIR)/standalone_la-regex.Tpo -c -o standalone_la-regex.lo `test -f 'regex.c' || echo '$(srcdir)/'`regex.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/standalone_la-regex.Tpo $(DEPDIR)/standalone_la-regex.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='regex.c' object='standalone_la-regex.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -c -o standalone_la-regex.lo `test -f 'regex.c' || echo '$(srcdir)/'`regex.c standalone_la-server.lo: server.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -MT standalone_la-server.lo -MD -MP -MF $(DEPDIR)/standalone_la-server.Tpo -c -o standalone_la-server.lo `test -f 'server.c' || echo '$(srcdir)/'`server.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/standalone_la-server.Tpo $(DEPDIR)/standalone_la-server.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='server.c' object='standalone_la-server.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(standalone_la_CPPFLAGS) $(CPPFLAGS) $(standalone_la_CFLAGS) $(CFLAGS) -c -o standalone_la-server.lo `test -f 'server.c' || echo '$(srcdir)/'`server.c mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: for dir in "$(DESTDIR)$(pkglibdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-pkglibLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkglibLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-libtool clean-pkglibLTLIBRARIES cscopelist-am ctags \ ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-pkglibLTLIBRARIES install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ uninstall-pkglibLTLIBRARIES # FIXME: Standalone does not mean that it will be a nginx build. # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: modsecurity-apache_2.7.7/standalone/config.c0000664000175000017500000010645312243422537021411 0ustar zimmerlezimmerle/* * ModSecurity for Apache 2.x, http://www.modsecurity.org/ * Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/) * * 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 * * If any of the files related to licensing are missing or if you have any * other questions related to licensing please contact Trustwave Holdings, Inc. * directly using the email address security@modsecurity.org. */ #include #include #include "http_core.h" #include "http_request.h" #include "modsecurity.h" #include "apache2.h" #include "http_main.h" #include "http_connection.h" #include "apr_optional.h" #include "mod_log_config.h" #include "msc_logging.h" #include "msc_util.h" #include "ap_mpm.h" #include "scoreboard.h" #include "apr_version.h" #include "apr_lib.h" #include "ap_config.h" #include "http_config.h" #include "apr_fnmatch.h" AP_DECLARE(int) ap_cfg_closefile(ap_configfile_t *cfp) { #ifdef DEBUG ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, NULL, "Done with config file %s", cfp->name); #endif return (cfp->close == NULL) ? 0 : cfp->close(cfp->param); } #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER < 3 static apr_status_t cfg_close(void *param) { apr_file_t *cfp = (apr_file_t *) param; return (apr_file_close(cfp)); } static int cfg_getch(void *param) { char ch; apr_file_t *cfp = (apr_file_t *) param; if (apr_file_getc(&ch, cfp) == APR_SUCCESS) return ch; return (int)EOF; } static void *cfg_getstr(void *buf, size_t bufsiz, void *param) { apr_file_t *cfp = (apr_file_t *) param; apr_status_t rv; rv = apr_file_gets(buf, bufsiz, cfp); if (rv == APR_SUCCESS) { return buf; } return NULL; } #else /* we can't use apr_file_* directly because of linking issues on Windows */ static apr_status_t cfg_close(void *param) { return apr_file_close(param); } static apr_status_t cfg_getch(char *ch, void *param) { return apr_file_getc(ch, param); } static apr_status_t cfg_getstr(void *buf, apr_size_t bufsiz, void *param) { return apr_file_gets(buf, bufsiz, param); } #endif /* Read one line from open ap_configfile_t, strip LF, increase line number */ /* If custom handler does not define a getstr() function, read char by char */ #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER < 3 AP_DECLARE(int) ap_cfg_getline(char *buf, size_t bufsize, ap_configfile_t *cfp) { /* If a "get string" function is defined, use it */ if (cfp->getstr != NULL) { char *src, *dst; char *cp; char *cbuf = buf; size_t cbufsize = bufsize; while (1) { ++cfp->line_number; if (cfp->getstr(cbuf, cbufsize, cfp->param) == NULL) return 1; /* * check for line continuation, * i.e. match [^\\]\\[\r]\n only */ cp = cbuf; while (cp < cbuf+cbufsize && *cp != '\0') cp++; if (cp > cbuf && cp[-1] == LF) { cp--; if (cp > cbuf && cp[-1] == CR) cp--; if (cp > cbuf && cp[-1] == '\\') { cp--; if (!(cp > cbuf && cp[-1] == '\\')) { /* * line continuation requested - * then remove backslash and continue */ cbufsize -= (cp-cbuf); cbuf = cp; continue; } else { /* * no real continuation because escaped - * then just remove escape character */ for ( ; cp < cbuf+cbufsize && *cp != '\0'; cp++) cp[0] = cp[1]; } } } break; } /* * Leading and trailing white space is eliminated completely */ src = buf; while (apr_isspace(*src)) ++src; /* blast trailing whitespace */ dst = &src[strlen(src)]; while (--dst >= src && apr_isspace(*dst)) *dst = '\0'; /* Zap leading whitespace by shifting */ if (src != buf) for (dst = buf; (*dst++ = *src++) != '\0'; ) ; #ifdef DEBUG_CFG_LINES ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, NULL, "Read config: %s", buf); #endif return 0; } else { /* No "get string" function defined; read character by character */ register int c; register size_t i = 0; buf[0] = '\0'; /* skip leading whitespace */ do { c = cfp->getch(cfp->param); } while (c == '\t' || c == ' '); if (c == EOF) return 1; if(bufsize < 2) { /* too small, assume caller is crazy */ return 1; } while (1) { if ((c == '\t') || (c == ' ')) { buf[i++] = ' '; while ((c == '\t') || (c == ' ')) c = cfp->getch(cfp->param); } if (c == CR) { /* silently ignore CR (_assume_ that a LF follows) */ c = cfp->getch(cfp->param); } if (c == LF) { /* increase line number and return on LF */ ++cfp->line_number; } if (c == EOF || c == 0x4 || c == LF || i >= (bufsize - 2)) { /* * check for line continuation */ if (i > 0 && buf[i-1] == '\\') { i--; if (!(i > 0 && buf[i-1] == '\\')) { /* line is continued */ c = cfp->getch(cfp->param); continue; } /* else nothing needs be done because * then the backslash is escaped and * we just strip to a single one */ } /* blast trailing whitespace */ while (i > 0 && apr_isspace(buf[i - 1])) --i; buf[i] = '\0'; #ifdef DEBUG_CFG_LINES ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, NULL, "Read config: %s", buf); #endif return 0; } buf[i] = c; ++i; c = cfp->getch(cfp->param); } } } #else static apr_status_t ap_cfg_getline_core(char *buf, apr_size_t bufsize, ap_configfile_t *cfp) { apr_status_t rc; /* If a "get string" function is defined, use it */ if (cfp->getstr != NULL) { char *cp; char *cbuf = buf; apr_size_t cbufsize = bufsize; while (1) { ++cfp->line_number; rc = cfp->getstr(cbuf, cbufsize, cfp->param); if (rc == APR_EOF) { if (cbuf != buf) { *cbuf = '\0'; break; } else { return APR_EOF; } } if (rc != APR_SUCCESS) { return rc; } /* * check for line continuation, * i.e. match [^\\]\\[\r]\n only */ cp = cbuf; cp += strlen(cp); if (cp > cbuf && cp[-1] == LF) { cp--; if (cp > cbuf && cp[-1] == CR) cp--; if (cp > cbuf && cp[-1] == '\\') { cp--; /* * line continuation requested - * then remove backslash and continue */ cbufsize -= (cp-cbuf); cbuf = cp; continue; } } else if (cp - buf >= bufsize - 1) { return APR_ENOSPC; } break; } } else { /* No "get string" function defined; read character by character */ apr_size_t i = 0; if (bufsize < 2) { /* too small, assume caller is crazy */ return APR_EINVAL; } buf[0] = '\0'; while (1) { char c; rc = cfp->getch(&c, cfp->param); if (rc == APR_EOF) { if (i > 0) break; else return APR_EOF; } if (rc != APR_SUCCESS) return rc; if (c == LF) { ++cfp->line_number; /* check for line continuation */ if (i > 0 && buf[i-1] == '\\') { i--; continue; } else { break; } } else if (i >= bufsize - 2) { return APR_ENOSPC; } buf[i] = c; ++i; } buf[i] = '\0'; } return APR_SUCCESS; } static int cfg_trim_line(char *buf) { char *start, *end; /* * Leading and trailing white space is eliminated completely */ start = buf; while (apr_isspace(*start)) ++start; /* blast trailing whitespace */ end = &start[strlen(start)]; while (--end >= start && apr_isspace(*end)) *end = '\0'; /* Zap leading whitespace by shifting */ if (start != buf) memmove(buf, start, end - start + 2); #ifdef DEBUG_CFG_LINES ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, NULL, APLOGNO(00555) "Read config: '%s'", buf); #endif return end - start + 1; } AP_DECLARE(apr_status_t) ap_cfg_getline(char *buf, apr_size_t bufsize, ap_configfile_t *cfp) { apr_status_t rc = ap_cfg_getline_core(buf, bufsize, cfp); if (rc == APR_SUCCESS) cfg_trim_line(buf); return rc; } #endif static char *substring_conf(apr_pool_t *p, const char *start, int len, char quote) { char *result = apr_palloc(p, len + 2); char *resp = result; int i; for (i = 0; i < len; ++i) { if (start[i] == '\\' && (start[i + 1] == '\\' || (quote && start[i + 1] == quote))) *resp++ = start[++i]; else *resp++ = start[i]; } *resp++ = '\0'; #if RESOLVE_ENV_PER_TOKEN return (char *)ap_resolve_env(p,result); #else return result; #endif } AP_DECLARE(char *) ap_getword_conf(apr_pool_t *p, const char **line) { const char *str = *line, *strend; char *res; char quote; while (*str && apr_isspace(*str)) ++str; if (!*str) { *line = str; return ""; } if ((quote = *str) == '"' || quote == '\'') { strend = str + 1; while (*strend && *strend != quote) { if (*strend == '\\' && strend[1] && (strend[1] == quote || strend[1] == '\\')) { strend += 2; } else { ++strend; } } res = substring_conf(p, str + 1, strend - str - 1, quote); if (*strend == quote) ++strend; } else { strend = str; while (*strend && !apr_isspace(*strend)) ++strend; res = substring_conf(p, str, strend - str, 0); } while (*strend && apr_isspace(*strend)) ++strend; *line = strend; return res; } /* Open a ap_configfile_t as FILE, return open ap_configfile_t struct pointer */ AP_DECLARE(apr_status_t) ap_pcfg_openfile(ap_configfile_t **ret_cfg, apr_pool_t *p, const char *name) { ap_configfile_t *new_cfg; apr_file_t *file = NULL; apr_finfo_t finfo; apr_status_t status; #ifdef DEBUG char buf[120]; #endif if (name == NULL) { ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL, "Internal error: pcfg_openfile() called with NULL filename"); return APR_EBADF; } status = apr_file_open(&file, name, APR_READ | APR_BUFFERED, APR_OS_DEFAULT, p); #ifdef DEBUG ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, NULL, "Opening config file %s (%s)", name, (status != APR_SUCCESS) ? apr_strerror(status, buf, sizeof(buf)) : "successful"); #endif if (status != APR_SUCCESS) return status; status = apr_file_info_get(&finfo, APR_FINFO_TYPE, file); if (status != APR_SUCCESS) return status; if (finfo.filetype != APR_REG && #if defined(WIN32) || defined(OS2) || defined(NETWARE) strcasecmp(apr_filepath_name_get(name), "nul") != 0) { #else strcmp(name, "/dev/null") != 0) { #endif /* WIN32 || OS2 */ ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL, "Access to file %s denied by server: not a regular file", name); apr_file_close(file); return APR_EBADF; } #ifdef WIN32 /* Some twisted character [no pun intended] at MS decided that a * zero width joiner as the lead wide character would be ideal for * describing Unicode text files. This was further convoluted to * another MSism that the same character mapped into utf-8, EF BB BF * would signify utf-8 text files. * * Since MS configuration files are all protecting utf-8 encoded * Unicode path, file and resource names, we already have the correct * WinNT encoding. But at least eat the stupid three bytes up front. */ { unsigned char buf[4]; apr_size_t len = 3; status = apr_file_read(file, buf, &len); if ((status != APR_SUCCESS) || (len < 3) || memcmp(buf, "\xEF\xBB\xBF", 3) != 0) { apr_off_t zero = 0; apr_file_seek(file, APR_SET, &zero); } } #endif new_cfg = apr_palloc(p, sizeof(*new_cfg)); new_cfg->param = file; new_cfg->name = apr_pstrdup(p, name); #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER < 3 new_cfg->getch = (int (*)(void *)) cfg_getch; new_cfg->getstr = (void *(*)(void *, size_t, void *)) cfg_getstr; new_cfg->close = (int (*)(void *)) cfg_close; #else new_cfg->getch = cfg_getch; new_cfg->getstr = cfg_getstr; new_cfg->close = cfg_close; #endif new_cfg->line_number = 0; *ret_cfg = new_cfg; return APR_SUCCESS; } AP_CORE_DECLARE(const command_rec *) ap_find_command(const char *name, const command_rec *cmds) { while (cmds->name) { if (!strcasecmp(name, cmds->name)) return cmds; ++cmds; } return NULL; } #define AP_MAX_ARGC 64 static const char *invoke_cmd(const command_rec *cmd, cmd_parms *parms, void *mconfig, const char *args) { char *w, *w2, *w3; const char *errmsg = NULL; if ((parms->override & cmd->req_override) == 0) return apr_pstrcat(parms->pool, cmd->name, " not allowed here", NULL); parms->info = cmd->cmd_data; parms->cmd = cmd; switch (cmd->args_how) { case RAW_ARGS: #ifdef RESOLVE_ENV_PER_TOKEN args = ap_resolve_env(parms->pool,args); #endif return cmd->AP_RAW_ARGS(parms, mconfig, args); case TAKE_ARGV: { char *argv[AP_MAX_ARGC]; int argc = 0; do { w = ap_getword_conf(parms->pool, &args); if (*w == '\0' && *args == '\0') { break; } argv[argc] = w; argc++; } while (argc < AP_MAX_ARGC && *args != '\0'); return cmd->AP_TAKE_ARGV(parms, mconfig, argc, argv); } case NO_ARGS: if (*args != 0) return apr_pstrcat(parms->pool, cmd->name, " takes no arguments", NULL); return cmd->AP_NO_ARGS(parms, mconfig); case TAKE1: w = ap_getword_conf(parms->pool, &args); if (*w == '\0' || *args != 0) return apr_pstrcat(parms->pool, cmd->name, " takes one argument", cmd->errmsg ? ", " : NULL, cmd->errmsg, NULL); return cmd->AP_TAKE1(parms, mconfig, w); case TAKE2: w = ap_getword_conf(parms->pool, &args); w2 = ap_getword_conf(parms->pool, &args); if (*w == '\0' || *w2 == '\0' || *args != 0) return apr_pstrcat(parms->pool, cmd->name, " takes two arguments", cmd->errmsg ? ", " : NULL, cmd->errmsg, NULL); return cmd->AP_TAKE2(parms, mconfig, w, w2); case TAKE12: w = ap_getword_conf(parms->pool, &args); w2 = ap_getword_conf(parms->pool, &args); if (*w == '\0' || *args != 0) return apr_pstrcat(parms->pool, cmd->name, " takes 1-2 arguments", cmd->errmsg ? ", " : NULL, cmd->errmsg, NULL); return cmd->AP_TAKE2(parms, mconfig, w, *w2 ? w2 : NULL); case TAKE3: w = ap_getword_conf(parms->pool, &args); w2 = ap_getword_conf(parms->pool, &args); w3 = ap_getword_conf(parms->pool, &args); if (*w == '\0' || *w2 == '\0' || *w3 == '\0' || *args != 0) return apr_pstrcat(parms->pool, cmd->name, " takes three arguments", cmd->errmsg ? ", " : NULL, cmd->errmsg, NULL); return cmd->AP_TAKE3(parms, mconfig, w, w2, w3); case TAKE23: w = ap_getword_conf(parms->pool, &args); w2 = ap_getword_conf(parms->pool, &args); w3 = *args ? ap_getword_conf(parms->pool, &args) : NULL; if (*w == '\0' || *w2 == '\0' || *args != 0) return apr_pstrcat(parms->pool, cmd->name, " takes two or three arguments", cmd->errmsg ? ", " : NULL, cmd->errmsg, NULL); return cmd->AP_TAKE3(parms, mconfig, w, w2, w3); case TAKE123: w = ap_getword_conf(parms->pool, &args); w2 = *args ? ap_getword_conf(parms->pool, &args) : NULL; w3 = *args ? ap_getword_conf(parms->pool, &args) : NULL; if (*w == '\0' || *args != 0) return apr_pstrcat(parms->pool, cmd->name, " takes one, two or three arguments", cmd->errmsg ? ", " : NULL, cmd->errmsg, NULL); return cmd->AP_TAKE3(parms, mconfig, w, w2, w3); case TAKE13: w = ap_getword_conf(parms->pool, &args); w2 = *args ? ap_getword_conf(parms->pool, &args) : NULL; w3 = *args ? ap_getword_conf(parms->pool, &args) : NULL; if (*w == '\0' || (w2 && *w2 && !w3) || *args != 0) return apr_pstrcat(parms->pool, cmd->name, " takes one or three arguments", cmd->errmsg ? ", " : NULL, cmd->errmsg, NULL); return cmd->AP_TAKE3(parms, mconfig, w, w2, w3); case ITERATE: while (*(w = ap_getword_conf(parms->pool, &args)) != '\0') { errmsg = cmd->AP_TAKE1(parms, mconfig, w); if (errmsg && strcmp(errmsg, DECLINE_CMD) != 0) return errmsg; } return errmsg; case ITERATE2: w = ap_getword_conf(parms->pool, &args); if (*w == '\0' || *args == 0) return apr_pstrcat(parms->pool, cmd->name, " requires at least two arguments", cmd->errmsg ? ", " : NULL, cmd->errmsg, NULL); while (*(w2 = ap_getword_conf(parms->pool, &args)) != '\0') { errmsg = cmd->AP_TAKE2(parms, mconfig, w, w2); if (errmsg && strcmp(errmsg, DECLINE_CMD) != 0) return errmsg; } return errmsg; case FLAG: w = ap_getword_conf(parms->pool, &args); if (*w == '\0' || (strcasecmp(w, "on") && strcasecmp(w, "off"))) return apr_pstrcat(parms->pool, cmd->name, " must be On or Off", NULL); return cmd->AP_FLAG(parms, mconfig, strcasecmp(w, "off") != 0); default: return apr_pstrcat(parms->pool, cmd->name, " is improperly configured internally (server bug)", NULL); } } #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER < 3 static cmd_parms default_parms = {NULL, 0, -1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; #endif #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER > 3 static cmd_parms default_parms = {NULL, 0, 0, NULL, -1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; #endif typedef struct { const char *fname; } fnames; AP_DECLARE(int) ap_is_directory(apr_pool_t *p, const char *path) { apr_finfo_t finfo; if (apr_stat(&finfo, path, APR_FINFO_TYPE, p) != APR_SUCCESS) return 0; /* in error condition, just return no */ return (finfo.filetype == APR_DIR); } AP_DECLARE(char *) ap_make_full_path(apr_pool_t *a, const char *src1, const char *src2) { apr_size_t len1, len2; char *path; len1 = strlen(src1); len2 = strlen(src2); /* allocate +3 for '/' delimiter, trailing NULL and overallocate * one extra byte to allow the caller to add a trailing '/' */ path = (char *)apr_palloc(a, len1 + len2 + 3); if (len1 == 0) { *path = '/'; memcpy(path + 1, src2, len2 + 1); } else { char *next; memcpy(path, src1, len1); next = path + len1; if (next[-1] != '/') { *next++ = '/'; } memcpy(next, src2, len2 + 1); } return path; } static int fname_alphasort(const void *fn1, const void *fn2) { const fnames *f1 = fn1; const fnames *f2 = fn2; return strcmp(f1->fname,f2->fname); } int fnmatch_test(const char *pattern) { int nesting; nesting = 0; while (*pattern) { switch (*pattern) { case '?': case '*': return 1; /* case '\\': if (*++pattern == '\0') { return 0; } break;*/ // this breaks on Windows case '[': /* '[' is only a glob if it has a matching ']' */ ++nesting; break; case ']': if (nesting) { return 1; } break; } ++pattern; } return 0; } AP_DECLARE(const char *) process_resource_config(const char *fname, apr_array_header_t *ari, apr_pool_t *ptemp) { *(char **)apr_array_push(ari) = (char *)fname; return NULL; } static const char *process_resource_config_nofnmatch(const char *fname, apr_array_header_t *ari, apr_pool_t *p, apr_pool_t *ptemp, unsigned depth, int optional) { const char *error; apr_status_t rv; if (ap_is_directory(ptemp, fname)) { apr_dir_t *dirp; apr_finfo_t dirent; int current; apr_array_header_t *candidates = NULL; fnames *fnew; char *path = apr_pstrdup(ptemp, fname); if (++depth > 100) { return apr_psprintf(p, "Directory %s exceeds the maximum include " "directory nesting level of %u. You have " "probably a recursion somewhere.", path, 100); } /* * first course of business is to grok all the directory * entries here and store 'em away. Recall we need full pathnames * for this. */ rv = apr_dir_open(&dirp, path, ptemp); if (rv != APR_SUCCESS) { char errmsg[120]; return apr_psprintf(p, "Could not open config directory %s: %s", path, apr_strerror(rv, errmsg, sizeof errmsg)); } candidates = apr_array_make(ptemp, 1, sizeof(fnames)); while (apr_dir_read(&dirent, APR_FINFO_DIRENT, dirp) == APR_SUCCESS) { /* strip out '.' and '..' */ if (strcmp(dirent.name, ".") && strcmp(dirent.name, "..")) { fnew = (fnames *) apr_array_push(candidates); fnew->fname = ap_make_full_path(ptemp, path, dirent.name); } } apr_dir_close(dirp); if (candidates->nelts != 0) { qsort((void *) candidates->elts, candidates->nelts, sizeof(fnames), fname_alphasort); /* * Now recurse these... we handle errors and subdirectories * via the recursion, which is nice */ for (current = 0; current < candidates->nelts; ++current) { fnew = &((fnames *) candidates->elts)[current]; error = process_resource_config_nofnmatch(fnew->fname, ari, p, ptemp, depth, optional); if (error) { return error; } } } return NULL; } return process_resource_config(fname, ari, ptemp); } static const char *process_resource_config_fnmatch(const char *path, const char *fname, apr_array_header_t *ari, apr_pool_t *p, apr_pool_t *ptemp, unsigned depth, int optional) { const char *rest; apr_status_t rv; apr_dir_t *dirp; apr_finfo_t dirent; apr_array_header_t *candidates = NULL; fnames *fnew; int current; /* find the first part of the filename */ rest = ap_strchr_c(fname, '/'); if(rest == NULL) rest = ap_strchr_c(fname, '\\'); if (rest) { fname = apr_pstrndup(ptemp, fname, rest - fname); rest++; } /* optimisation - if the filename isn't a wildcard, process it directly */ if (!fnmatch_test(fname)) { path = ap_make_full_path(ptemp, path, fname); if (!rest) { return process_resource_config_nofnmatch(path, ari, p, ptemp, 0, optional); } else { return process_resource_config_fnmatch(path, rest, ari, p, ptemp, 0, optional); } } /* * first course of business is to grok all the directory * entries here and store 'em away. Recall we need full pathnames * for this. */ rv = apr_dir_open(&dirp, path, ptemp); if (rv != APR_SUCCESS) { char errmsg[120]; return apr_psprintf(p, "Could not open config directory %s: %s", path, apr_strerror(rv, errmsg, sizeof errmsg)); } candidates = apr_array_make(ptemp, 1, sizeof(fnames)); while (apr_dir_read(&dirent, APR_FINFO_DIRENT | APR_FINFO_TYPE, dirp) == APR_SUCCESS) { /* strip out '.' and '..' */ if (strcmp(dirent.name, ".") && strcmp(dirent.name, "..") && (apr_fnmatch(fname, dirent.name, APR_FNM_PERIOD | APR_FNM_NOESCAPE | APR_FNM_PATHNAME) == APR_SUCCESS)) { const char *full_path = ap_make_full_path(ptemp, path, dirent.name); /* If matching internal to path, and we happen to match something * other than a directory, skip it */ if (rest && (rv == APR_SUCCESS) && (dirent.filetype != APR_DIR)) { continue; } fnew = (fnames *) apr_array_push(candidates); fnew->fname = full_path; } } apr_dir_close(dirp); if (candidates->nelts != 0) { const char *error; qsort((void *) candidates->elts, candidates->nelts, sizeof(fnames), fname_alphasort); /* * Now recurse these... we handle errors and subdirectories * via the recursion, which is nice */ for (current = 0; current < candidates->nelts; ++current) { fnew = &((fnames *) candidates->elts)[current]; if (!rest) { error = process_resource_config_nofnmatch(fnew->fname, ari, p, ptemp, 0, optional); } else { error = process_resource_config_fnmatch(fnew->fname, rest, ari, p, ptemp, 0, optional); } if (error) { return error; } } } else { if (!optional) { return apr_psprintf(p, "No matches for the wildcard '%s' in '%s', failing " "(use IncludeOptional if required)", fname, path); } } return NULL; } AP_DECLARE(const char *) process_fnmatch_configs(apr_array_header_t *ari, const char *fname, apr_pool_t *p, apr_pool_t *ptemp, int optional) { if (!fnmatch_test(fname)) { return process_resource_config(fname, ari, p); } else { apr_status_t status; const char *rootpath, *filepath = fname; /* locate the start of the directories proper */ status = apr_filepath_root(&rootpath, &filepath, APR_FILEPATH_TRUENAME | APR_FILEPATH_NATIVE, ptemp); /* we allow APR_SUCCESS and APR_EINCOMPLETE */ if (APR_ERELATIVE == status) { return apr_pstrcat(p, "Include must have an absolute path, ", fname, NULL); } else if (APR_EBADPATH == status) { return apr_pstrcat(p, "Include has a bad path, ", fname, NULL); } /* walk the filepath */ return process_resource_config_fnmatch(rootpath, filepath, ari, p, ptemp, 0, optional); } } const char *populate_include_files(apr_pool_t *p, apr_pool_t *ptemp, apr_array_header_t *ari, const char *fname, int optional) { return process_fnmatch_configs(ari, fname, p, ptemp, optional); } const char *process_command_config(server_rec *s, void *mconfig, apr_pool_t *p, apr_pool_t *ptemp, const char *filename) { const char *errmsg; char *l = apr_palloc (ptemp, MAX_STRING_LEN); const char *args = l; char *cmd_name, *w; const command_rec *cmd; apr_array_header_t *arr = apr_array_make(p, 1, sizeof(cmd_parms)); apr_array_header_t *ari = apr_array_make(p, 1, sizeof(char *)); cmd_parms *parms; apr_status_t status; ap_directive_t *newdir; int optional; char *err = NULL; char *rootpath, *incpath; int li; errmsg = populate_include_files(p, ptemp, ari, filename, 0); if(errmsg != NULL) goto Exit; while(ari->nelts != 0 || arr->nelts != 0) { if(ari->nelts > 0) { char *fn = *(char **)apr_array_pop(ari); parms = (cmd_parms *)apr_array_push(arr); *parms = default_parms; parms->pool = p; parms->temp_pool = ptemp; parms->server = s; parms->override = (RSRC_CONF | OR_ALL) & ~(OR_AUTHCFG | OR_LIMIT); parms->override_opts = OPT_ALL | OPT_SYM_OWNER | OPT_MULTI; status = ap_pcfg_openfile(&parms->config_file, p, fn); if(status != APR_SUCCESS) { apr_array_pop(arr); errmsg = apr_pstrcat(p, "Cannot open config file: ", fn, NULL); goto Exit; } } if (arr->nelts > 1024) { errmsg = "Exceeded the maximum include directory nesting level. You have " "probably a recursion somewhere."; goto Exit; } parms = (cmd_parms *)apr_array_pop(arr); if(parms == NULL) break; while (!(ap_cfg_getline(l, MAX_STRING_LEN, parms->config_file))) { if (*l == '#' || *l == '\0') continue; args = l; cmd_name = ap_getword_conf(p, &args); if (*cmd_name == '\0') continue; if (!strcasecmp(cmd_name, "IncludeOptional")) { optional = 1; goto ProcessInclude; } if (!strcasecmp(cmd_name, "Include")) { optional = 0; ProcessInclude: w = ap_getword_conf(parms->pool, &args); if (*w == '\0' || *args != 0) { ap_cfg_closefile(parms->config_file); errmsg = apr_pstrcat(parms->pool, "Include takes one argument", NULL); goto Exit; } incpath = w; /* locate the start of the directories proper */ status = apr_filepath_root(&rootpath, &incpath, APR_FILEPATH_TRUENAME | APR_FILEPATH_NATIVE, ptemp); /* we allow APR_SUCCESS and APR_EINCOMPLETE */ if (APR_ERELATIVE == status) { rootpath = apr_pstrdup(ptemp, parms->config_file->name); li = strlen(rootpath) - 1; while(li >= 0 && rootpath[li] != '/' && rootpath[li] != '\\') rootpath[li--] = 0; w = apr_pstrcat(p, rootpath, w, NULL); } else if (APR_EBADPATH == status) { ap_cfg_closefile(parms->config_file); errmsg = apr_pstrcat(p, "Include file has a bad path, ", w, NULL); goto Exit; } errmsg = populate_include_files(p, ptemp, ari, w, optional); *(cmd_parms *)apr_array_push(arr) = *parms; if(errmsg != NULL) goto Exit; // we don't want to close the current file yet // parms = NULL; break; } cmd = ap_find_command(cmd_name, security2_module.cmds); if(cmd == NULL) { // unknown command, should error // ap_cfg_closefile(parms->config_file); errmsg = apr_pstrcat(p, "Unknown command in config: ", cmd_name, NULL); goto Exit; } newdir = apr_pcalloc(p, sizeof(ap_directive_t)); newdir->filename = parms->config_file->name; newdir->line_num = parms->config_file->line_number; newdir->directive = cmd_name; newdir->args = apr_pstrdup(p, args); parms->directive = newdir; #ifdef WIN32 // some config commands fail in APR when there are file // permission issues or other OS-specific problems // __try { #endif errmsg = invoke_cmd(cmd, parms, mconfig, args); #ifdef WIN32 } __except(EXCEPTION_EXECUTE_HANDLER) { errmsg = "Command failed to execute (check file/folder permissions, syntax, etc.)."; } #endif if(errmsg != NULL) break; } if(parms != NULL) ap_cfg_closefile(parms->config_file); if(errmsg != NULL) break; } if (errmsg) { err = (char *)apr_palloc(p, 1024); if(parms != NULL) apr_snprintf(err, 1024, "Syntax error in config file %s, line %d: %s", parms->config_file->name, parms->config_file->line_number, errmsg); else apr_snprintf(err, 1024, "Syntax error in config file: %s", errmsg); } errmsg = err; Exit: while((parms = (cmd_parms *)apr_array_pop(arr)) != NULL) { ap_cfg_closefile(parms->config_file); } return errmsg; } modsecurity-apache_2.7.7/autogen.sh0000775000175000017500000000056312253711345017643 0ustar zimmerlezimmerle#!/bin/sh #rm -rf autom4te.cache #automake --add-missing --copy --foreign #autoreconf --install #autoheader rm -rf autom4te.cache rm -f aclocal.m4 case `uname` in Darwin*) glibtoolize --force --copy ;; *) libtoolize --force --copy ;; esac autoreconf --install autoheader automake --add-missing --foreign --copy --force-missing autoconf --force rm -rf autom4te.cache modsecurity-apache_2.7.7/doc/0000775000175000017500000000000012243422537016404 5ustar zimmerlezimmerlemodsecurity-apache_2.7.7/doc/README.txt0000664000175000017500000000055212243422537020104 0ustar zimmerlezimmerlePlease access the ModSecurity Github space to access the below documentation. * ModSecurity 2 Data Formats * ModSecurity Frequently Asked Questions (FAQ) * ModSecurity Migration Matrix * ModSecurity Rules Language Porting Specification * ModSecurity Wiki * Reference Manual * RoadMap https://github.com/SpiderLabs/ModSecurity/wiki/ modsecurity-apache_2.7.7/Makefile.in0000664000175000017500000007000112254306021017671 0ustar zimmerlezimmerle# Makefile.in generated by automake 1.13.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = . DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/configure $(am__configure_deps) \ $(top_srcdir)/nginx/modsecurity/config.in \ $(top_srcdir)/build/apxs-wrapper.in \ $(top_srcdir)/tests/regression/server_root/conf/httpd.conf.in \ build/ar-lib build/compile build/config.guess build/config.sub \ build/depcomp build/install-sh build/missing build/ltmain.sh \ $(top_srcdir)/build/ar-lib $(top_srcdir)/build/config.guess \ $(top_srcdir)/build/config.sub $(top_srcdir)/build/install-sh \ $(top_srcdir)/build/ltmain.sh $(top_srcdir)/build/missing ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/build/find_apr.m4 \ $(top_srcdir)/build/find_apu.m4 \ $(top_srcdir)/build/find_curl.m4 \ $(top_srcdir)/build/find_lua.m4 \ $(top_srcdir)/build/find_pcre.m4 \ $(top_srcdir)/build/find_xml.m4 $(top_srcdir)/build/libtool.m4 \ $(top_srcdir)/build/ltoptions.m4 \ $(top_srcdir)/build/ltsugar.m4 \ $(top_srcdir)/build/ltversion.m4 \ $(top_srcdir)/build/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/apache2/modsecurity_config_auto.h CONFIG_CLEAN_FILES = nginx/modsecurity/config build/apxs-wrapper \ tests/regression/server_root/conf/httpd.conf CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ cscope distdir dist dist-all distcheck am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags CSCOPE = cscope DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ if test -d "$(distdir)"; then \ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi am__post_remove_distdir = $(am__remove_distdir) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best DIST_TARGETS = dist-gzip distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APR_CFLAGS = @APR_CFLAGS@ APR_CONFIG = @APR_CONFIG@ APR_CPPFLAGS = @APR_CPPFLAGS@ APR_INCLUDEDIR = @APR_INCLUDEDIR@ APR_LDADD = @APR_LDADD@ APR_LDFLAGS = @APR_LDFLAGS@ APR_LINKLD = @APR_LINKLD@ APR_VERSION = @APR_VERSION@ APU_CFLAGS = @APU_CFLAGS@ APU_CONFIG = @APU_CONFIG@ APU_INCLUDEDIR = @APU_INCLUDEDIR@ APU_LDADD = @APU_LDADD@ APU_LDFLAGS = @APU_LDFLAGS@ APU_LINKLD = @APU_LINKLD@ APU_VERSION = @APU_VERSION@ APXS = @APXS@ APXS_BINDIR = @APXS_BINDIR@ APXS_CC = @APXS_CC@ APXS_CFLAGS = @APXS_CFLAGS@ APXS_EXTRA_CFLAGS = @APXS_EXTRA_CFLAGS@ APXS_HTTPD = @APXS_HTTPD@ APXS_INCLUDEDIR = @APXS_INCLUDEDIR@ APXS_INCLUDES = @APXS_INCLUDES@ APXS_LDFLAGS = @APXS_LDFLAGS@ APXS_LIBDIR = @APXS_LIBDIR@ APXS_LIBEXECDIR = @APXS_LIBEXECDIR@ APXS_LIBS = @APXS_LIBS@ APXS_LIBTOOL = @APXS_LIBTOOL@ APXS_MODULES = @APXS_MODULES@ APXS_PROGNAME = @APXS_PROGNAME@ APXS_SBINDIR = @APXS_SBINDIR@ APXS_WRAPPER = @APXS_WRAPPER@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CURL_CFLAGS = @CURL_CFLAGS@ CURL_CONFIG = @CURL_CONFIG@ CURL_CPPFLAGS = @CURL_CPPFLAGS@ CURL_LDADD = @CURL_LDADD@ CURL_LDFLAGS = @CURL_LDFLAGS@ CURL_USES_GNUTLS = @CURL_USES_GNUTLS@ CURL_VERSION = @CURL_VERSION@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENV_CMD = @ENV_CMD@ EXEEXT = @EXEEXT@ EXTRA_CFLAGS = @EXTRA_CFLAGS@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ LIBXML2_CONFIG = @LIBXML2_CONFIG@ LIBXML2_CPPFLAGS = @LIBXML2_CPPFLAGS@ LIBXML2_LDADD = @LIBXML2_LDADD@ LIBXML2_LDFLAGS = @LIBXML2_LDFLAGS@ LIBXML2_VERSION = @LIBXML2_VERSION@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LUA_CFLAGS = @LUA_CFLAGS@ LUA_LDADD = @LUA_LDADD@ LUA_LDFLAGS = @LUA_LDFLAGS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MODSEC_APXS_EXTRA_CFLAGS = @MODSEC_APXS_EXTRA_CFLAGS@ MODSEC_EXTRA_CFLAGS = @MODSEC_EXTRA_CFLAGS@ MSC_BASE_DIR = @MSC_BASE_DIR@ MSC_PKGBASE_DIR = @MSC_PKGBASE_DIR@ MSC_REGRESSION_CONF_DIR = @MSC_REGRESSION_CONF_DIR@ MSC_REGRESSION_DIR = @MSC_REGRESSION_DIR@ MSC_REGRESSION_DOCROOT_DIR = @MSC_REGRESSION_DOCROOT_DIR@ MSC_REGRESSION_LOGS_DIR = @MSC_REGRESSION_LOGS_DIR@ MSC_REGRESSION_SERVERROOT_DIR = @MSC_REGRESSION_SERVERROOT_DIR@ MSC_TEST_DIR = @MSC_TEST_DIR@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCRE_CFLAGS = @PCRE_CFLAGS@ PCRE_CONFIG = @PCRE_CONFIG@ PCRE_CPPFLAGS = @PCRE_CPPFLAGS@ PCRE_LDADD = @PCRE_LDADD@ PCRE_LDFLAGS = @PCRE_LDFLAGS@ PCRE_LD_PATH = @PCRE_LD_PATH@ PCRE_VERSION = @PCRE_VERSION@ PERL = @PERL@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOPLEVEL_SUBDIRS = @TOPLEVEL_SUBDIRS@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ ACLOCAL_AMFLAGS = -I build SUBDIRS = @TOPLEVEL_SUBDIRS@ tests CLEANFILES = tests/regression/server_root/conf/*.t_*.conf \ tests/regression/server_root/logs/*.log MAINTAINERCLEANFILES = $(CLEANFILES) aclocal.m4 alp2/Makefile.in \ apache2/Makefile.in build/config.guess build/config.sub \ build/depcomp build/libtool.m4 build/ltmain.sh \ build/lt~obsolete.m4 build/ltoptions.m4 build/ltsugar.m4 \ build/ltversion.m4 build/missing config.log config.status \ configure ext/Makefile.in Makefile Makefile.in \ mlogc/Makefile.in modsecurity_config_auto.h.in~ all: all-recursive .SUFFIXES: am--refresh: Makefile @: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): nginx/modsecurity/config: $(top_builddir)/config.status $(top_srcdir)/nginx/modsecurity/config.in cd $(top_builddir) && $(SHELL) ./config.status $@ build/apxs-wrapper: $(top_builddir)/config.status $(top_srcdir)/build/apxs-wrapper.in cd $(top_builddir) && $(SHELL) ./config.status $@ tests/regression/server_root/conf/httpd.conf: $(top_builddir)/config.status $(top_srcdir)/tests/regression/server_root/conf/httpd.conf.in cd $(top_builddir) && $(SHELL) ./config.status $@ mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool config.lt # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscope: cscope.files test ! -s cscope.files \ || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) clean-cscope: -rm -f cscope.files cscope.files: clean-cscope cscopelist cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f cscope.out cscope.in.out cscope.po.out cscope.files distdir: $(DISTFILES) $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__post_remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__post_remove_distdir) dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__post_remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__post_remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__post_remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__post_remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__post_remove_distdir) dist dist-all: $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' $(am__post_remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lz*) \ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir) chmod u+w $(distdir) mkdir $(distdir)/_build $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__post_remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @test -n '$(distuninstallcheck_dir)' || { \ echo 'ERROR: trying to run $@ with an empty' \ '$$(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ $(am__cd) '$(distuninstallcheck_dir)' || { \ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-libtool \ distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ am--refresh check check-am clean clean-cscope clean-generic \ clean-libtool cscope cscopelist-am ctags ctags-am dist \ dist-all dist-bzip2 dist-gzip dist-lzip dist-shar dist-tarZ \ dist-xz dist-zip distcheck distclean distclean-generic \ distclean-libtool distclean-tags distcleancheck distdir \ distuninstallcheck dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ ps ps-am tags tags-am uninstall uninstall-am test: check test-regression: (cd tests && $(MAKE) test-regression) cppcheck: cppcheck . --enable=all --force 2>&1 | sed 's/^/warning: /g' 1>&2; check-coding-style: for i in `(find . -iname "*.c" ; find . -iname "*.h")`; \ do echo $$i...; \ vera++ -rule L004 -param max-line-length=80 $$i 2>&1 | sed 's/^/warning: /g' 1>&2; \ vera++ -rule L001 $$i 2>&1 | sed 's/^/warning: /g' 1>&2; \ done; .PHONY: test # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: modsecurity-apache_2.7.7/configure0000775000175000017500000175255512254306022017562 0ustar zimmerlezimmerle#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for modsecurity 2.7. # # Report bugs to . # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 as_fn_exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org and $0: support@modsecurity.org about your system, including $0: any error possibly output before this message. Then $0: install a modern shell, or manually run the script $0: under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" SHELL=${CONFIG_SHELL-/bin/sh} test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='modsecurity' PACKAGE_TARNAME='modsecurity' PACKAGE_VERSION='2.7' PACKAGE_STRING='modsecurity 2.7' PACKAGE_BUGREPORT='support@modsecurity.org' PACKAGE_URL='' ac_unique_file="LICENSE" ac_default_prefix=/usr/local/modsecurity # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS CURL_USES_GNUTLS CURL_LDADD CURL_LDFLAGS CURL_CFLAGS CURL_CPPFLAGS CURL_VERSION CURL_CONFIG LUA_LDFLAGS LUA_LDADD LUA_CFLAGS PKG_CONFIG_LIBDIR PKG_CONFIG_PATH PKG_CONFIG LIBXML2_LDFLAGS LIBXML2_LDADD LIBXML2_CPPFLAGS LIBXML2_CFLAGS LIBXML2_VERSION LIBXML2_CONFIG APU_LINKLD APU_INCLUDEDIR APU_LDADD APU_LDFLAGS APU_CFLAGS APU_VERSION APU_CONFIG APR_LINKLD APR_INCLUDEDIR APR_LDADD APR_LDFLAGS APR_CPPFLAGS APR_CFLAGS APR_VERSION APR_CONFIG PCRE_LD_PATH PCRE_LDADD PCRE_LDFLAGS PCRE_CFLAGS PCRE_CPPFLAGS PCRE_VERSION PCRE_CONFIG APXS_HTTPD APXS_MODULES APXS_LIBEXECDIR APXS_PROGNAME APXS_SBINDIR APXS_BINDIR APXS_LIBDIR APXS_CC APXS_LIBTOOL APXS_CFLAGS APXS_LIBS APXS_LDFLAGS MODSEC_APXS_EXTRA_CFLAGS APXS_EXTRA_CFLAGS APXS_INCLUDES APXS_INCLUDEDIR APXS_WRAPPER APXS MODSEC_EXTRA_CFLAGS EXTRA_CFLAGS TOPLEVEL_SUBDIRS BUILD_DOCS_FALSE BUILD_DOCS_TRUE BUILD_ALP2_FALSE BUILD_ALP2_TRUE BUILD_MLOGC_FALSE BUILD_MLOGC_TRUE BUILD_extentions_FALSE BUILD_extentions_TRUE BUILD_STANDALONE_MODULE_FALSE BUILD_STANDALONE_MODULE_TRUE BUILD_APACHE2_MODULE_FALSE BUILD_APACHE2_MODULE_TRUE NETBSD_FALSE NETBSD_TRUE OPENBSD_FALSE OPENBSD_TRUE FREEBSD_FALSE FREEBSD_TRUE SOLARIS_FALSE SOLARIS_TRUE LINUX390_FALSE LINUX390_TRUE LINUX_FALSE LINUX_TRUE MACOSX_FALSE MACOSX_TRUE HPUX_FALSE HPUX_TRUE AIX_FALSE AIX_TRUE MSC_REGRESSION_DOCROOT_DIR MSC_REGRESSION_LOGS_DIR MSC_REGRESSION_CONF_DIR MSC_REGRESSION_SERVERROOT_DIR MSC_REGRESSION_DIR MSC_TEST_DIR MSC_PKGBASE_DIR MSC_BASE_DIR LIBOBJS ENV_CMD PERL CPP OTOOL64 OTOOL LIPO NMEDIT DSYMUTIL MANIFEST_TOOL RANLIB DLLTOOL OBJDUMP LN_S NM ac_ct_DUMPBIN DUMPBIN LD FGREP EGREP GREP SED host_os host_vendor host_cpu host build_os build_vendor build_cpu build LIBTOOL am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__quote am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC ac_ct_AR AR AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_silent_rules enable_dependency_tracking enable_shared enable_static with_pic enable_fast_install with_gnu_ld with_sysroot enable_libtool_lock enable_apache2_module enable_standalone_module enable_extentions enable_mlogc enable_alp2 enable_docs enable_pcre_study enable_pcre_jit enable_pcre_match_limit enable_pcre_match_limit_recursion enable_lua_cache enable_htaccess_config enable_request_early enable_errors enable_verbose_output enable_strict_compile enable_debug_conf enable_debug_cache enable_debug_acmp enable_debug_mem enable_performance_measurement enable_modsec_api with_apxs with_pcre with_apr with_apu with_libxml with_lua with_curl ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP PKG_CONFIG PKG_CONFIG_PATH PKG_CONFIG_LIBDIR' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures modsecurity 2.7 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/modsecurity] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of modsecurity 2.7:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-silent-rules less verbose build output (undo: "make V=1") --disable-silent-rules verbose build output (undo: "make V=0") --enable-dependency-tracking do not reject slow dependency extractors --disable-dependency-tracking speeds up one-time build --enable-shared[=PKGS] build shared libraries [default=yes] --enable-static[=PKGS] build static libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) --disable-apache2-module Disable building Apache2 module. --enable-standalone-module Enable building standalone module. --enable-extentions Enable building extension. --disable-mlogc Disable building mlogc. --enable-alp2 Enable building audit log parser lib. --enable-docs Enable building documentation. --enable-pcre-study Enable PCRE regex studying during configure. --enable-pcre-jit Enable PCRE regex jit support during configure. --enable-pcre-match-limit Enable PCRE regex match limit during configure. --enable-pcre-match-limit-recursion Enable PCRE regex match limit recursion during configure. --enable-lua-cache Enable Lua per transaction cache. --enable-htaccess-config Enable some mod_security directives into htaccess files. --enable-request-early Place phase1 into post_read_request hook. default is hook_request_early --disable-errors Disable errors during configure. --enable-verbose-output Enable more verbose configure output. --enable-strict-compile Enable strict compilation (warnings are errors). --enable-debug-conf Enable debug during configuration. --enable-debug-cache Enable debug for transformation caching. --enable-debug-acmp Enable debugging acmp code. --enable-debug-mem Enable debug during configuration. --enable-performance-measurement Enable performance-measurement stats. --disable-modsec-api Disable the API; compiling against some older Apache versions require this. Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use both] --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-sysroot=DIR Search for dependent libraries within DIR (or the compiler's sysroot if not specified). --with-apxs=FILE FILE is the path to apxs; defaults to "apxs". --with-pcre=PATH Path to pcre prefix or config script --with-apr=PATH Path to apr prefix or config script --with-apu=PATH Path to apu prefix or config script --with-libxml=PATH Path to libxml2 prefix or config script --with-lua=PATH Path to lua prefix or config script --with-curl=PATH Path to curl prefix or config script Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor PKG_CONFIG path to pkg-config utility PKG_CONFIG_PATH directories to add to pkg-config's search path PKG_CONFIG_LIBDIR path overriding pkg-config's built-in search path Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF modsecurity configure 2.7 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ( $as_echo "## -------------------------------------- ## ## Report this to support@modsecurity.org ## ## -------------------------------------- ##" ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type # ac_fn_c_find_uintX_t LINENO BITS VAR # ------------------------------------ # Finds an unsigned integer type with width BITS, setting cache variable VAR # accordingly. ac_fn_c_find_uintX_t () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5 $as_echo_n "checking for uint$2_t... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" # Order is important - never check a type that is potentially smaller # than half of the expected target width. for ac_type in uint$2_t 'unsigned int' 'unsigned long int' \ 'unsigned long long int' 'unsigned short int' 'unsigned char'; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !((($ac_type) -1 >> ($2 / 2 - 1)) >> ($2 / 2 - 1) == 3)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : case $ac_type in #( uint$2_t) : eval "$3=yes" ;; #( *) : eval "$3=\$ac_type" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if eval test \"x\$"$3"\" = x"no"; then : else break fi done fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_find_uintX_t cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by modsecurity $as_me 2.7, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_config_headers="$ac_config_headers apache2/modsecurity_config_auto.h" ac_aux_dir= for ac_dir in build "$srcdir"/build; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in build \"$srcdir\"/build" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. am__api_version='1.13' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi if test "$2" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi rm -f conftest.file test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null # Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; fi case $enable_silent_rules in # ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=1;; esac am_make=${MAKE-make} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 $as_echo_n "checking whether $am_make supports nested variables... " >&6; } if ${am_cv_make_support_nested_variables+:} false; then : $as_echo_n "(cached) " >&6 else if $as_echo 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 $as_echo "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AM_BACKSLASH='\' if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='modsecurity' VERSION='2.7' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # mkdir_p='$(MKDIR_P)' # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar pax cpio none' am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 $as_echo "$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi if test -n "$ac_tool_prefix"; then for ac_prog in ar lib "link -lib" do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AR="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 $as_echo "$AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AR" && break done fi if test -z "$AR"; then ac_ct_AR=$AR for ac_prog in ar lib "link -lib" do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 $as_echo "$ac_ct_AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_AR" && break done if test "x$ac_ct_AR" = x; then AR="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi fi : ${AR=ar} { $as_echo "$as_me:${as_lineno-$LINENO}: checking the archiver ($AR) interface" >&5 $as_echo_n "checking the archiver ($AR) interface... " >&6; } if ${am_cv_ar_interface+:} false; then : $as_echo_n "(cached) " >&6 else am_cv_ar_interface=ar cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int some_variable = 0; _ACEOF if ac_fn_c_try_compile "$LINENO"; then : am_ar_try='$AR cru libconftest.a conftest.$ac_objext >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$am_ar_try\""; } >&5 (eval $am_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test "$ac_status" -eq 0; then am_cv_ar_interface=ar else am_ar_try='$AR -NOLOGO -OUT:conftest.lib conftest.$ac_objext >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$am_ar_try\""; } >&5 (eval $am_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test "$ac_status" -eq 0; then am_cv_ar_interface=lib else am_cv_ar_interface=unknown fi fi rm -f conftest.lib libconftest.a fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_ar_interface" >&5 $as_echo "$am_cv_ar_interface" >&6; } case $am_cv_ar_interface in ar) ;; lib) # Microsoft lib, so override with the ar-lib wrapper script. # FIXME: It is wrong to rewrite AR. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__AR in this case, # and then we could set am__AR="$am_aux_dir/ar-lib \$(AR)" or something # similar. AR="$am_aux_dir/ar-lib $AR" ;; unknown) as_fn_error $? "could not determine $AR interface" "$LINENO" 5 ;; esac case `pwd` in *\ * | *\ *) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 $as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; esac macro_version='2.4.2' macro_revision='1.3337' ltmain="$ac_aux_dir/ltmain.sh" # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac # Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\(["`$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 $as_echo_n "checking how to print strings... " >&6; } # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "" } case "$ECHO" in printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 $as_echo "printf" >&6; } ;; print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 $as_echo "print -r" >&6; } ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 $as_echo "cat" >&6; } ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 $as_echo_n "checking for a sed that does not truncate output... " >&6; } if ${ac_cv_path_SED+:} false; then : $as_echo_n "(cached) " >&6 else ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for ac_i in 1 2 3 4 5 6 7; do ac_script="$ac_script$as_nl$ac_script" done echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed { ac_script=; unset ac_script;} if test -z "$SED"; then ac_path_SED_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_SED" || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED case `"$ac_path_SED" --version 2>&1` in *GNU*) ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo '' >> "conftest.nl" "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_SED_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_SED="$ac_path_SED" ac_path_SED_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_SED_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_SED"; then as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 fi else ac_cv_path_SED=$SED fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 $as_echo "$ac_cv_path_SED" >&6; } SED="$ac_cv_path_SED" rm -f conftest.sed test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 $as_echo_n "checking for fgrep... " >&6; } if ${ac_cv_path_FGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 then ac_cv_path_FGREP="$GREP -F" else if test -z "$FGREP"; then ac_path_FGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in fgrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_FGREP" || continue # Check for GNU ac_path_FGREP and select it if it is found. # Check for GNU $ac_path_FGREP case `"$ac_path_FGREP" --version 2>&1` in *GNU*) ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'FGREP' >> "conftest.nl" "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_FGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_FGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_FGREP"; then as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_FGREP=$FGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 $as_echo "$ac_cv_path_FGREP" >&6; } FGREP="$ac_cv_path_FGREP" test -z "$GREP" && GREP=grep # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then : withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 $as_echo_n "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi if ${lt_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 $as_echo "$LD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if ${lt_cv_prog_gnu_ld+:} false; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 $as_echo "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 $as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } if ${lt_cv_path_NM+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done : ${lt_cv_path_NM=no} fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 $as_echo "$lt_cv_path_NM" >&6; } if test "$lt_cv_path_NM" != "no"; then NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else if test -n "$ac_tool_prefix"; then for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DUMPBIN"; then ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DUMPBIN=$ac_cv_prog_DUMPBIN if test -n "$DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 $as_echo "$DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$DUMPBIN" && break done fi if test -z "$DUMPBIN"; then ac_ct_DUMPBIN=$DUMPBIN for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DUMPBIN"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN if test -n "$ac_ct_DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 $as_echo "$ac_ct_DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_DUMPBIN" && break done if test "x$ac_ct_DUMPBIN" = x; then DUMPBIN=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DUMPBIN=$ac_ct_DUMPBIN fi fi case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols" ;; *) DUMPBIN=: ;; esac fi if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" fi fi test -z "$NM" && NM=nm { $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 $as_echo_n "checking the name lister ($NM) interface... " >&6; } if ${lt_cv_nm_interface+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 $as_echo "$lt_cv_nm_interface" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 $as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 $as_echo "no, using $LN_S" >&6; } fi # find the maximum length of command line arguments { $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 $as_echo_n "checking the maximum length of command line arguments... " >&6; } if ${lt_cv_sys_max_cmd_len+:} false; then : $as_echo_n "(cached) " >&6 else i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len" && \ test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8 ; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac fi if test -n $lt_cv_sys_max_cmd_len ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 $as_echo "$lt_cv_sys_max_cmd_len" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 $as_echo "none" >&6; } fi max_cmd_len=$lt_cv_sys_max_cmd_len : ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5 $as_echo_n "checking whether the shell understands some XSI constructs... " >&6; } # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ = c,a/b,b/c, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5 $as_echo "$xsi_shell" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5 $as_echo_n "checking whether the shell understands \"+=\"... " >&6; } lt_shell_append=no ( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \ >/dev/null 2>&1 \ && lt_shell_append=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5 $as_echo "$lt_shell_append" >&6; } if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 $as_echo_n "checking how to convert $build file names to $host format... " >&6; } if ${lt_cv_to_host_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac fi to_host_file_cmd=$lt_cv_to_host_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 $as_echo "$lt_cv_to_host_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 $as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } if ${lt_cv_to_tool_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else #assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac fi to_tool_file_cmd=$lt_cv_to_tool_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 $as_echo "$lt_cv_to_tool_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 $as_echo_n "checking for $LD option to reload object files... " >&6; } if ${lt_cv_ld_reload_flag+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_reload_flag='-r' fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 $as_echo "$lt_cv_ld_reload_flag" >&6; } reload_flag=$lt_cv_ld_reload_flag case $reload_flag in "" | " "*) ;; *) reload_flag=" $reload_flag" ;; esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in cygwin* | mingw* | pw32* | cegcc*) if test "$GCC" != yes; then reload_cmds=false fi ;; darwin*) if test "$GCC" = yes; then reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' else reload_cmds='$LD$reload_flag -o $output$reload_objs' fi ;; esac if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 $as_echo "$OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OBJDUMP="objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 $as_echo "$ac_ct_OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then OBJDUMP="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP fi else OBJDUMP="$ac_cv_prog_OBJDUMP" fi test -z "$OBJDUMP" && OBJDUMP=objdump { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 $as_echo_n "checking how to recognize dependent libraries... " >&6; } if ${lt_cv_deplibs_check_method+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # `unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # which responds to the $file_magic_cmd with a given extended regex. # If you have `file' or equivalent on your system and you're not sure # whether `pass_all' will *always* work, you probably want this one. case $host_os in aix[4-9]*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[45]*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin. if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[3-9]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 $as_echo "$lt_cv_deplibs_check_method" >&6; } file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 $as_echo "$DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DLLTOOL"; then ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 $as_echo "$ac_ct_DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then DLLTOOL="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL fi else DLLTOOL="$ac_cv_prog_DLLTOOL" fi test -z "$DLLTOOL" && DLLTOOL=dlltool { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 $as_echo_n "checking how to associate runtime and link libraries... " >&6; } if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh # decide which to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd="$ECHO" ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 $as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO if test -n "$ac_tool_prefix"; then for ac_prog in ar do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AR="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 $as_echo "$AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AR" && break done fi if test -z "$AR"; then ac_ct_AR=$AR for ac_prog in ar do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 $as_echo "$ac_ct_AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_AR" && break done if test "x$ac_ct_AR" = x; then AR="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi fi : ${AR=ar} : ${AR_FLAGS=cru} { $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 $as_echo_n "checking for archiver @FILE support... " >&6; } if ${lt_cv_ar_at_file+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ar_at_file=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test "$ac_status" -eq 0; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test "$ac_status" -ne 0; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 $as_echo "$lt_cv_ar_at_file" >&6; } if test "x$lt_cv_ar_at_file" = xno; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi test -z "$STRIP" && STRIP=: if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi test -z "$RANLIB" && RANLIB=: # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Check for command to grab the raw symbol name followed by C symbol from nm. { $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 $as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } if ${lt_cv_sys_global_symbol_pipe+:} false; then : $as_echo_n "(cached) " >&6 else # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[BCDEGRST]' # Regexp to match symbols that can be accessed directly from C. sympat='\([_A-Za-z][_A-Za-z0-9]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[BCDT]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[ABCDGISTW]' ;; hpux*) if test "$host_cpu" = ia64; then symcode='[ABCDEGRST]' fi ;; irix* | nonstopux*) symcode='[BCDEGRST]' ;; osf*) symcode='[BCDEGQRST]' ;; solaris*) symcode='[BDRT]' ;; sco3.2v5*) symcode='[DT]' ;; sysv4.2uw2*) symcode='[DT]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[ABDT]' ;; sysv4) symcode='[DFNSTU]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[ABCDGIRSTW]' ;; esac # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function # and D for any global variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK '"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ " {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ " s[1]~/^[@?]/{print s[1], s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Now try to grab the symbols. nlist=conftest.nm if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&5 fi else echo "cannot find nm_test_var in $nlist" >&5 fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 fi else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done fi if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 $as_echo "failed" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then nm_file_list_spec='@' fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 $as_echo_n "checking for sysroot... " >&6; } # Check whether --with-sysroot was given. if test "${with_sysroot+set}" = set; then : withval=$with_sysroot; else with_sysroot=no fi lt_sysroot= case ${with_sysroot} in #( yes) if test "$GCC" = yes; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5 $as_echo "${with_sysroot}" >&6; } as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 $as_echo "${lt_sysroot:-no}" >&6; } # Check whether --enable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then : enableval=$enable_libtool_lock; fi test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) case `/usr/bin/file conftest.o` in *x86-64*) LD="${LD-ld} -m elf32_x86_64" ;; *) LD="${LD-ld} -m elf_i386" ;; esac ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 $as_echo_n "checking whether the C compiler needs -belf... " >&6; } if ${lt_cv_cc_needs_belf+:} false; then : $as_echo_n "(cached) " >&6 else ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_cc_needs_belf=yes else lt_cv_cc_needs_belf=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 $as_echo "$lt_cv_cc_needs_belf" >&6; } if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; *-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD="${LD-ld}_sol2" fi ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks="$enable_libtool_lock" if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. set dummy ${ac_tool_prefix}mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$MANIFEST_TOOL"; then ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL if test -n "$MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 $as_echo "$MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_MANIFEST_TOOL"; then ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL # Extract the first word of "mt", so it can be a program name with args. set dummy mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_MANIFEST_TOOL"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL if test -n "$ac_ct_MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 $as_echo "$ac_ct_MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_MANIFEST_TOOL" = x; then MANIFEST_TOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL fi else MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" fi test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 $as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } if ${lt_cv_path_mainfest_tool+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&5 if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 $as_echo "$lt_cv_path_mainfest_tool" >&6; } if test "x$lt_cv_path_mainfest_tool" != xyes; then MANIFEST_TOOL=: fi case $host_os in rhapsody* | darwin*) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DSYMUTIL"; then ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DSYMUTIL=$ac_cv_prog_DSYMUTIL if test -n "$DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 $as_echo "$DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DSYMUTIL"; then ac_ct_DSYMUTIL=$DSYMUTIL # Extract the first word of "dsymutil", so it can be a program name with args. set dummy dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DSYMUTIL"; then ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL if test -n "$ac_ct_DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 $as_echo "$ac_ct_DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DSYMUTIL" = x; then DSYMUTIL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DSYMUTIL=$ac_ct_DSYMUTIL fi else DSYMUTIL="$ac_cv_prog_DSYMUTIL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. set dummy ${ac_tool_prefix}nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NMEDIT"; then ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi NMEDIT=$ac_cv_prog_NMEDIT if test -n "$NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 $as_echo "$NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_NMEDIT"; then ac_ct_NMEDIT=$NMEDIT # Extract the first word of "nmedit", so it can be a program name with args. set dummy nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_NMEDIT"; then ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_NMEDIT="nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT if test -n "$ac_ct_NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 $as_echo "$ac_ct_NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_NMEDIT" = x; then NMEDIT=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac NMEDIT=$ac_ct_NMEDIT fi else NMEDIT="$ac_cv_prog_NMEDIT" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. set dummy ${ac_tool_prefix}lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$LIPO"; then ac_cv_prog_LIPO="$LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_LIPO="${ac_tool_prefix}lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LIPO=$ac_cv_prog_LIPO if test -n "$LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 $as_echo "$LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_LIPO"; then ac_ct_LIPO=$LIPO # Extract the first word of "lipo", so it can be a program name with args. set dummy lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_LIPO"; then ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_LIPO="lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO if test -n "$ac_ct_LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 $as_echo "$ac_ct_LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_LIPO" = x; then LIPO=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac LIPO=$ac_ct_LIPO fi else LIPO="$ac_cv_prog_LIPO" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. set dummy ${ac_tool_prefix}otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL"; then ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL="${ac_tool_prefix}otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL=$ac_cv_prog_OTOOL if test -n "$OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 $as_echo "$OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL"; then ac_ct_OTOOL=$OTOOL # Extract the first word of "otool", so it can be a program name with args. set dummy otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL"; then ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL="otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL if test -n "$ac_ct_OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 $as_echo "$ac_ct_OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL" = x; then OTOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL=$ac_ct_OTOOL fi else OTOOL="$ac_cv_prog_OTOOL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. set dummy ${ac_tool_prefix}otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL64"; then ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL64=$ac_cv_prog_OTOOL64 if test -n "$OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 $as_echo "$OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL64"; then ac_ct_OTOOL64=$OTOOL64 # Extract the first word of "otool64", so it can be a program name with args. set dummy otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL64"; then ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL64="otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 if test -n "$ac_ct_OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 $as_echo "$ac_ct_OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL64" = x; then OTOOL64=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL64=$ac_ct_OTOOL64 fi else OTOOL64="$ac_cv_prog_OTOOL64" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 $as_echo_n "checking for -single_module linker flag... " >&6; } if ${lt_cv_apple_cc_single_mod+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_apple_cc_single_mod=no if test -z "${LT_MULTI_MODULE}"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&5 $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? # If there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&5 # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test $_lt_result -eq 0; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&5 fi rm -rf libconftest.dylib* rm -f conftest.* fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 $as_echo "$lt_cv_apple_cc_single_mod" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 $as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } if ${lt_cv_ld_exported_symbols_list+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_ld_exported_symbols_list=yes else lt_cv_ld_exported_symbols_list=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 $as_echo "$lt_cv_ld_exported_symbols_list" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 $as_echo_n "checking for -force_load linker flag... " >&6; } if ${lt_cv_ld_force_load+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 echo "$AR cru libconftest.a conftest.o" >&5 $AR cru libconftest.a conftest.o 2>&5 echo "$RANLIB libconftest.a" >&5 $RANLIB libconftest.a 2>&5 cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&5 elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then lt_cv_ld_force_load=yes else cat conftest.err >&5 fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 $as_echo "$lt_cv_ld_force_load" >&6; } case $host_os in rhapsody* | darwin1.[012]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[91]*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; 10.[012]*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test "$lt_cv_apple_cc_single_mod" = "yes"; then _lt_dar_single_mod='$single_module' fi if test "$lt_cv_ld_exported_symbols_list" = "yes"; then _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in dlfcn.h do : ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default " if test "x$ac_cv_header_dlfcn_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DLFCN_H 1 _ACEOF fi done # Set options enable_dlopen=yes enable_win32_dll=no # Check whether --enable-shared was given. if test "${enable_shared+set}" = set; then : enableval=$enable_shared; p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac else enable_shared=yes fi # Check whether --enable-static was given. if test "${enable_static+set}" = set; then : enableval=$enable_static; p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac else enable_static=yes fi # Check whether --with-pic was given. if test "${with_pic+set}" = set; then : withval=$with_pic; lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for lt_pkg in $withval; do IFS="$lt_save_ifs" if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS="$lt_save_ifs" ;; esac else pic_mode=default fi test -z "$pic_mode" && pic_mode=default # Check whether --enable-fast-install was given. if test "${enable_fast_install+set}" = set; then : enableval=$enable_fast_install; p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac else enable_fast_install=yes fi # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ltmain" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' test -z "$LN_S" && LN_S="ln -s" if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 $as_echo_n "checking for objdir... " >&6; } if ${lt_cv_objdir+:} false; then : $as_echo_n "(cached) " >&6 else rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 $as_echo "$lt_cv_objdir" >&6; } objdir=$lt_cv_objdir cat >>confdefs.h <<_ACEOF #define LT_OBJDIR "$lt_cv_objdir/" _ACEOF case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld="$lt_cv_prog_gnu_ld" old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 $as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/${ac_tool_prefix}file; then lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 $as_echo_n "checking for file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/file; then lt_cv_path_MAGIC_CMD="$ac_dir/file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi else MAGIC_CMD=: fi fi fi ;; esac # Use C for the default configuration in the libtool script lt_save_CC="$CC" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o objext=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then lt_prog_compiler_no_builtin_flag= if test "$GCC" = yes; then case $cc_basename in nvcc*) lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; *) lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 $as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 $as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl= lt_prog_compiler_pic= lt_prog_compiler_static= if test "$GCC" = yes; then lt_prog_compiler_wl='-Wl,' lt_prog_compiler_static='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. lt_prog_compiler_static= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) lt_prog_compiler_pic='-fPIC' ;; esac ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic=-Kconform_pic fi ;; *) lt_prog_compiler_pic='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 lt_prog_compiler_wl='-Xlinker ' if test -n "$lt_prog_compiler_pic"; then lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; # Lahey Fortran 8.1. lf95*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='--shared' lt_prog_compiler_static='--static' ;; nagfor*) # NAG Fortran compiler lt_prog_compiler_wl='-Wl,-Wl,,' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; ccc*) lt_prog_compiler_wl='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-qpic' lt_prog_compiler_static='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='' ;; *Sun\ F* | *Sun*Fortran*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Wl,' ;; *Intel*\ [CF]*Compiler*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; *Portland\ Group*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; esac ;; esac ;; newsos6) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static='-non_shared' ;; rdos*) lt_prog_compiler_static='-non_shared' ;; solaris*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl='-Qoption ld ' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then lt_prog_compiler_pic='-Kconform_pic' lt_prog_compiler_static='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; unicos*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_can_build_shared=no ;; uts4*) lt_prog_compiler_pic='-pic' lt_prog_compiler_static='-Bstatic' ;; *) lt_prog_compiler_can_build_shared=no ;; esac fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic= ;; *) lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 $as_echo_n "checking for $compiler option to produce PIC... " >&6; } if ${lt_cv_prog_compiler_pic+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic=$lt_prog_compiler_pic fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 $as_echo "$lt_cv_prog_compiler_pic" >&6; } lt_prog_compiler_pic=$lt_cv_prog_compiler_pic # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } if ${lt_cv_prog_compiler_pic_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic -DPIC" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 $as_echo "$lt_cv_prog_compiler_pic_works" >&6; } if test x"$lt_cv_prog_compiler_pic_works" = xyes; then case $lt_prog_compiler_pic in "" | " "*) ;; *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; esac else lt_prog_compiler_pic= lt_prog_compiler_can_build_shared=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if ${lt_cv_prog_compiler_static_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works=yes fi else lt_cv_prog_compiler_static_works=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 $as_echo "$lt_cv_prog_compiler_static_works" >&6; } if test x"$lt_cv_prog_compiler_static_works" = xyes; then : else lt_prog_compiler_static= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } hard_links="nottested" if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 $as_echo_n "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 $as_echo "$hard_links" >&6; } if test "$hard_links" = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 $as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } runpath_var= allow_undefined_flag= always_export_symbols=no archive_cmds= archive_expsym_cmds= compiler_needs_object=no enable_shared_with_static_runtimes=no export_dynamic_flag_spec= export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' hardcode_automatic=no hardcode_direct=no hardcode_direct_absolute=no hardcode_libdir_flag_spec= hardcode_libdir_separator= hardcode_minus_L=no hardcode_shlibpath_var=unsupported inherit_rpath=no link_all_deplibs=unknown module_cmds= module_expsym_cmds= old_archive_from_new_cmds= old_archive_from_expsyms_cmds= thread_safe_flag_spec= whole_archive_flag_spec= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; linux* | k*bsd*-gnu | gnu*) link_all_deplibs=no ;; esac ld_shlibs=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test "$with_gnu_ld" = yes; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; *\ \(GNU\ Binutils\)\ [3-9]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test "$lt_use_gnu_ld_interface" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' export_dynamic_flag_spec='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec= fi supports_anon_versioning=no case `$LD -v 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[3-9]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' export_dynamic_flag_spec='${wl}--export-all-symbols' allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs=no fi ;; haiku*) archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' link_all_deplibs=yes ;; interix[3-9]*) hardcode_direct=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 whole_archive_flag_spec= tmp_sharedflag='--shared' ;; xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi case $cc_basename in xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else ld_shlibs=no fi ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac ;; sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct=yes hardcode_shlibpath_var=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac if test "$ld_shlibs" = no; then runpath_var= hardcode_libdir_flag_spec= export_dynamic_flag_spec= whole_archive_flag_spec= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix[4-9]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global # defined symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds='' hardcode_direct=yes hardcode_direct_absolute=yes hardcode_libdir_separator=':' link_all_deplibs=yes file_list_spec='${wl}-f,' if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi link_all_deplibs=no else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi export_dynamic_flag_spec='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_="/usr/lib:/lib" fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag="-z nodefs" archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_="/usr/lib:/lib" fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag=' ${wl}-bernotok' allow_undefined_flag=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec='$convenience' fi archive_cmds_need_lc=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; bsdi[45]*) export_dynamic_flag_spec=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported always_export_symbols=yes file_list_spec='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, )='true' enable_shared_with_static_runtimes=yes exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib old_postinstall_cmds='chmod 644 $oldlib' postlink_cmds='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_from_new_cmds='true' # FIXME: Should let the user specify the lib program. old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' enable_shared_with_static_runtimes=yes ;; esac ;; darwin* | rhapsody*) archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported if test "$lt_cv_ld_force_load" = "yes"; then whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' else whole_archive_flag_spec='' fi link_all_deplibs=yes allow_undefined_flag="$_lt_dar_allow_undefined" case $cc_basename in ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" else ld_shlibs=no fi ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; hpux9*) if test "$GCC" = yes; then archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes export_dynamic_flag_spec='${wl}-E' ;; hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes fi ;; hpux11*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 $as_echo_n "checking if $CC understands -b... " >&6; } if ${lt_cv_prog_compiler__b+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler__b=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -b" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler__b=yes fi else lt_cv_prog_compiler__b=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 $as_echo "$lt_cv_prog_compiler__b" >&6; } if test x"$lt_cv_prog_compiler__b" = xyes; then archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi ;; esac fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_direct=no hardcode_shlibpath_var=no ;; *) hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 $as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } if ${lt_cv_irix_exported_symbol+:} false; then : $as_echo_n "(cached) " >&6 else save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo (void) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_irix_exported_symbol=yes else lt_cv_irix_exported_symbol=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 $as_echo "$lt_cv_irix_exported_symbol" >&6; } if test "$lt_cv_irix_exported_symbol" = yes; then archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' fi else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: inherit_rpath=yes link_all_deplibs=yes ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; newsos6) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: hardcode_shlibpath_var=no ;; *nto* | *qnx*) ;; openbsd*) if test -f /usr/libexec/ld.so; then hardcode_direct=yes hardcode_shlibpath_var=no hardcode_direct_absolute=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' else case $host_os in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-R$libdir' ;; *) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; esac fi else ld_shlibs=no fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi archive_cmds_need_lc='no' hardcode_libdir_separator=: ;; solaris*) no_undefined_flag=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='${wl}' archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else whole_archive_flag_spec='-z allextract$convenience -z defaultextract' fi ;; esac link_all_deplibs=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) case $host_vendor in sni) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds='$CC -r -o $output$reload_objs' hardcode_direct=no ;; motorola) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag='${wl}-z,text' archive_cmds_need_lc=no hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag='${wl}-z,text' allow_undefined_flag='${wl}-z,nodefs' archive_cmds_need_lc=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-R,$libdir' hardcode_libdir_separator=':' link_all_deplibs=yes export_dynamic_flag_spec='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; *) ld_shlibs=no ;; esac if test x$host_vendor = xsni; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) export_dynamic_flag_spec='${wl}-Blargedynsym' ;; esac fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 $as_echo "$ld_shlibs" >&6; } test "$ld_shlibs" = no && can_build_shared=no with_gnu_ld=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc" in x|xyes) # Assume -lc should be added archive_cmds_need_lc=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } if ${lt_cv_archive_cmds_need_lc+:} false; then : $as_echo_n "(cached) " >&6 else $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl pic_flag=$lt_prog_compiler_pic compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag allow_undefined_flag= if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc=no else lt_cv_archive_cmds_need_lc=yes fi allow_undefined_flag=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 $as_echo "$lt_cv_archive_cmds_need_lc" >&6; } archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc ;; esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 $as_echo_n "checking dynamic linker characteristics... " >&6; } if test "$GCC" = yes; then case $host_os in darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;; *) lt_sed_strip_eq="s,=/,/,g" ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path/$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" else test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo="/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[lt_foo]++; } if (lt_freq[lt_foo] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's,/\([A-Za-z]:\),\1,g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[4-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' library_names_spec='${libname}.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec="$LIB" if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[23].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=yes sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[3-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH if ${lt_cv_shlibpath_overrides_runpath+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : lt_cv_shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir fi shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 $as_echo "$dynamic_linker" >&6; } test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 $as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action= if test -n "$hardcode_libdir_flag_spec" || test -n "$runpath_var" || test "X$hardcode_automatic" = "Xyes" ; then # We can hardcode non-existent directories. if test "$hardcode_direct" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no && test "$hardcode_minus_L" != no; then # Linking always hardcodes the temporary library directory. hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action=unsupported fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 $as_echo "$hardcode_action" >&6; } if test "$hardcode_action" = relink || test "$inherit_rpath" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes fi ;; *) ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" if test "x$ac_cv_func_shl_load" = xyes; then : lt_cv_dlopen="shl_load" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 $as_echo_n "checking for shl_load in -ldld... " >&6; } if ${ac_cv_lib_dld_shl_load+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char shl_load (); int main () { return shl_load (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_shl_load=yes else ac_cv_lib_dld_shl_load=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 $as_echo "$ac_cv_lib_dld_shl_load" >&6; } if test "x$ac_cv_lib_dld_shl_load" = xyes; then : lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" else ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" if test "x$ac_cv_func_dlopen" = xyes; then : lt_cv_dlopen="dlopen" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 $as_echo_n "checking for dlopen in -lsvld... " >&6; } if ${ac_cv_lib_svld_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_svld_dlopen=yes else ac_cv_lib_svld_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 $as_echo "$ac_cv_lib_svld_dlopen" >&6; } if test "x$ac_cv_lib_svld_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 $as_echo_n "checking for dld_link in -ldld... " >&6; } if ${ac_cv_lib_dld_dld_link+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dld_link (); int main () { return dld_link (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_dld_link=yes else ac_cv_lib_dld_dld_link=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 $as_echo "$ac_cv_lib_dld_dld_link" >&6; } if test "x$ac_cv_lib_dld_dld_link" = xyes; then : lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" fi fi fi fi fi fi ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 $as_echo_n "checking whether a program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; esac else : # compilation failed lt_cv_dlopen_self=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 $as_echo "$lt_cv_dlopen_self" >&6; } if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 $as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self_static+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self_static=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; esac else : # compilation failed lt_cv_dlopen_self_static=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 $as_echo "$lt_cv_dlopen_self_static" >&6; } fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi striplib= old_striplib= { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 $as_echo_n "checking whether stripping libraries is possible... " >&6; } if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" old_striplib="$STRIP -S" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ;; esac fi # Report which library types will actually be built { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 $as_echo_n "checking if libtool supports shared libraries... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 $as_echo "$can_build_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 $as_echo_n "checking whether to build shared libraries... " >&6; } test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[4-9]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 $as_echo "$enable_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 $as_echo_n "checking whether to build static libraries... " >&6; } # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 $as_echo "$enable_static" >&6; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" ac_config_commands="$ac_config_commands libtool" # Only expand once: # Checks for programs. for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 $as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 $as_echo "no, using $LN_S" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" for ac_prog in perl perl5 do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_PERL+:} false; then : $as_echo_n "(cached) " >&6 else case $PERL in [\\/]* | ?:[\\/]*) ac_cv_path_PERL="$PERL" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_PERL="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi PERL=$ac_cv_path_PERL if test -n "$PERL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL" >&5 $as_echo "$PERL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$PERL" && break done for ac_prog in env printenv do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_ENV_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $ENV_CMD in [\\/]* | ?:[\\/]*) ac_cv_path_ENV_CMD="$ENV_CMD" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_ENV_CMD="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi ENV_CMD=$ac_cv_path_ENV_CMD if test -n "$ENV_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ENV_CMD" >&5 $as_echo "$ENV_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ENV_CMD" && break done # Checks for header files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi for ac_header in fcntl.h limits.h stdlib.h string.h unistd.h sys/types.h sys/stat.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done # Checks for typedefs, structures, and compiler characteristics. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 $as_echo_n "checking for an ANSI C-conforming const... " >&6; } if ${ac_cv_c_const+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __cplusplus /* Ultrix mips cc rejects this sort of thing. */ typedef int charset[2]; const charset cs = { 0, 0 }; /* SunOS 4.1.1 cc rejects this. */ char const *const *pcpcc; char **ppc; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; /* AIX XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; pcpcc = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++pcpcc; ppc = (char**) pcpcc; pcpcc = (char const *const *) ppc; { /* SCO 3.2v4 cc rejects this sort of thing. */ char tx; char *t = &tx; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; if (s) return 0; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; const int *foo = &x[0]; ++foo; } { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ typedef const int *iptr; iptr p = 0; ++p; } { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; } bx; struct s *b = &bx; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; if (!foo) return 0; } return !cs[0] && !zero.x; #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_const=yes else ac_cv_c_const=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 $as_echo "$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then $as_echo "#define const /**/" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 $as_echo_n "checking for inline... " >&6; } if ${ac_cv_c_inline+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __cplusplus typedef int foo_t; static $ac_kw foo_t static_foo () {return 0; } $ac_kw foo_t foo () {return 0; } #endif _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_inline=$ac_kw fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext test "$ac_cv_c_inline" != no && break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 $as_echo "$ac_cv_c_inline" >&6; } case $ac_cv_c_inline in inline | yes) ;; *) case $ac_cv_c_inline in no) ac_val=;; *) ac_val=$ac_cv_c_inline;; esac cat >>confdefs.h <<_ACEOF #ifndef __cplusplus #define inline $ac_val #endif _ACEOF ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C/C++ restrict keyword" >&5 $as_echo_n "checking for C/C++ restrict keyword... " >&6; } if ${ac_cv_c_restrict+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_restrict=no # The order here caters to the fact that C++ does not require restrict. for ac_kw in __restrict __restrict__ _Restrict restrict; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ typedef int * int_ptr; int foo (int_ptr $ac_kw ip) { return ip[0]; } int main () { int s[1]; int * $ac_kw t = s; t[0] = 0; return foo(t) ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_restrict=$ac_kw fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext test "$ac_cv_c_restrict" != no && break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_restrict" >&5 $as_echo "$ac_cv_c_restrict" >&6; } case $ac_cv_c_restrict in restrict) ;; no) $as_echo "#define restrict /**/" >>confdefs.h ;; *) cat >>confdefs.h <<_ACEOF #define restrict $ac_cv_c_restrict _ACEOF ;; esac ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default" if test "x$ac_cv_type_pid_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define pid_t int _ACEOF fi ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define size_t unsigned int _ACEOF fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether struct tm is in sys/time.h or time.h" >&5 $as_echo_n "checking whether struct tm is in sys/time.h or time.h... " >&6; } if ${ac_cv_struct_tm+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { struct tm tm; int *p = &tm.tm_sec; return !p; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_struct_tm=time.h else ac_cv_struct_tm=sys/time.h fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_struct_tm" >&5 $as_echo "$ac_cv_struct_tm" >&6; } if test $ac_cv_struct_tm = sys/time.h; then $as_echo "#define TM_IN_SYS_TIME 1" >>confdefs.h fi ac_fn_c_find_uintX_t "$LINENO" "8" "ac_cv_c_uint8_t" case $ac_cv_c_uint8_t in #( no|yes) ;; #( *) $as_echo "#define _UINT8_T 1" >>confdefs.h cat >>confdefs.h <<_ACEOF #define uint8_t $ac_cv_c_uint8_t _ACEOF ;; esac # Checks for library functions. for ac_header in stdlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" if test "x$ac_cv_header_stdlib_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STDLIB_H 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5 $as_echo_n "checking for GNU libc compatible malloc... " >&6; } if ${ac_cv_func_malloc_0_nonnull+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_malloc_0_nonnull=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined STDC_HEADERS || defined HAVE_STDLIB_H # include #else char *malloc (); #endif int main () { return ! malloc (0); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_malloc_0_nonnull=yes else ac_cv_func_malloc_0_nonnull=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5 $as_echo "$ac_cv_func_malloc_0_nonnull" >&6; } if test $ac_cv_func_malloc_0_nonnull = yes; then : $as_echo "#define HAVE_MALLOC 1" >>confdefs.h else $as_echo "#define HAVE_MALLOC 0" >>confdefs.h case " $LIBOBJS " in *" malloc.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS malloc.$ac_objext" ;; esac $as_echo "#define malloc rpl_malloc" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working memcmp" >&5 $as_echo_n "checking for working memcmp... " >&6; } if ${ac_cv_func_memcmp_working+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_memcmp_working=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { /* Some versions of memcmp are not 8-bit clean. */ char c0 = '\100', c1 = '\200', c2 = '\201'; if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0) return 1; /* The Next x86 OpenStep bug shows up only when comparing 16 bytes or more and with at least one buffer not starting on a 4-byte boundary. William Lewis provided this test program. */ { char foo[21]; char bar[21]; int i; for (i = 0; i < 4; i++) { char *a = foo + i; char *b = bar + i; strcpy (a, "--------01111111"); strcpy (b, "--------10000000"); if (memcmp (a, b, 16) >= 0) return 1; } return 0; } ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_memcmp_working=yes else ac_cv_func_memcmp_working=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_memcmp_working" >&5 $as_echo "$ac_cv_func_memcmp_working" >&6; } test $ac_cv_func_memcmp_working = no && case " $LIBOBJS " in *" memcmp.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS memcmp.$ac_objext" ;; esac for ac_func in atexit getcwd memmove memset strcasecmp strchr strdup strerror strncasecmp strrchr strstr strtol fchmod strcasestr do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done # Some directories MSC_BASE_DIR=`pwd` MSC_PKGBASE_DIR="$MSC_BASE_DIR/.." MSC_TEST_DIR="$MSC_BASE_DIR/tests" MSC_REGRESSION_DIR="$MSC_TEST_DIR/regression" MSC_REGRESSION_SERVERROOT_DIR="$MSC_REGRESSION_DIR/server_root" MSC_REGRESSION_CONF_DIR="$MSC_REGRESSION_SERVERROOT_DIR/conf" MSC_REGRESSION_LOGS_DIR="$MSC_REGRESSION_SERVERROOT_DIR/logs" MSC_REGRESSION_DOCROOT_DIR="$MSC_REGRESSION_SERVERROOT_DIR/htdocs" ### Configure Options #OS type CANONICAL_HOST=$host case $host in *-*-aix*) echo "Checking plataform... Identified as AIX" aixos=true ;; *-*-hpux*) echo "Checking plataform... Identified as HPUX" hpuxos=true ;; *-*-darwin*) echo "Checking plataform... Identified as Macintosh OS X" macos=true ;; *-*-linux*) echo "Checking plataform... Identified as Linux" linuxos=true case "${host_cpu}" in s390x) cpu_type="-DLINUX_S390" ;; esac ;; *-*-solaris*) echo "Checking plataform... Identified as Solaris" solarisos=true ;; *-*-freebsd*) echo "Checking plataform... Identified as FreeBSD" freebsdos=true ;; *-*-netbsd*) echo "Checking plataform... Identified as NetBSD" netbsdos=true ;; *-*-openbsd*) echo "Checking plataform... Identified as OpenBSD" openbsdos=true ;; *-*-kfreebsd*) echo "Checking plataform... Identified as kFreeBSD, treating as linux" linuxos=true ;; *-*-gnu*.*) echo "Checking plataform... Identified as HURD, treating as linux" linuxos=true ;; *) echo "Unknown CANONICAL_HOST $host" exit ;; esac if test x$aixos = xtrue; then AIX_TRUE= AIX_FALSE='#' else AIX_TRUE='#' AIX_FALSE= fi if test x$hpuxos = xtrue; then HPUX_TRUE= HPUX_FALSE='#' else HPUX_TRUE='#' HPUX_FALSE= fi if test x$macos = xtrue; then MACOSX_TRUE= MACOSX_FALSE='#' else MACOSX_TRUE='#' MACOSX_FALSE= fi if test x$linuxos = xtrue; then LINUX_TRUE= LINUX_FALSE='#' else LINUX_TRUE='#' LINUX_FALSE= fi if test x$linuxos390 = xtrue; then LINUX390_TRUE= LINUX390_FALSE='#' else LINUX390_TRUE='#' LINUX390_FALSE= fi if test x$solarisos = xtrue; then SOLARIS_TRUE= SOLARIS_FALSE='#' else SOLARIS_TRUE='#' SOLARIS_FALSE= fi if test x$freebsdos = xtrue; then FREEBSD_TRUE= FREEBSD_FALSE='#' else FREEBSD_TRUE='#' FREEBSD_FALSE= fi if test x$openbsdos = xtrue; then OPENBSD_TRUE= OPENBSD_FALSE='#' else OPENBSD_TRUE='#' OPENBSD_FALSE= fi if test x$netbsdos = xtrue; then NETBSD_TRUE= NETBSD_FALSE='#' else NETBSD_TRUE='#' NETBSD_FALSE= fi #Subdirs TOPLEVEL_SUBDIRS="tools" # Apache2 Module # Check whether --enable-apache2-module was given. if test "${enable_apache2_module+set}" = set; then : enableval=$enable_apache2_module; if test "$enableval" != "no"; then build_apache2_module=1 else build_apache2_module=0 fi else build_apache2_module=1 fi if test "$build_apache2_module" -eq 1; then BUILD_APACHE2_MODULE_TRUE= BUILD_APACHE2_MODULE_FALSE='#' else BUILD_APACHE2_MODULE_TRUE='#' BUILD_APACHE2_MODULE_FALSE= fi if test "$build_apache2_module" -eq 1; then TOPLEVEL_SUBDIRS="$TOPLEVEL_SUBDIRS apache2" fi # Standalone Module # Check whether --enable-standalone-module was given. if test "${enable_standalone_module+set}" = set; then : enableval=$enable_standalone_module; if test "$enableval" != "no"; then build_standalone_module=1 else build_standalone_module=0 fi else build_standalone_module=0 fi if test "$build_standalone_module" -eq 1; then BUILD_STANDALONE_MODULE_TRUE= BUILD_STANDALONE_MODULE_FALSE='#' else BUILD_STANDALONE_MODULE_TRUE='#' BUILD_STANDALONE_MODULE_FALSE= fi if test "$build_standalone_module" -eq 1; then TOPLEVEL_SUBDIRS="$TOPLEVEL_SUBDIRS standalone" fi # Extensions # Check whether --enable-extentions was given. if test "${enable_extentions+set}" = set; then : enableval=$enable_extentions; if test "$enableval" != "no"; then build_extentions=1 else build_extentions=0 fi else build_extentions=0 fi if test "$build_extentions" -eq 1; then BUILD_extentions_TRUE= BUILD_extentions_FALSE='#' else BUILD_extentions_TRUE='#' BUILD_extentions_FALSE= fi if test "$build_extentions" -eq 1; then TOPLEVEL_SUBDIRS="$TOPLEVEL_SUBDIRS ext" fi # Mlogc # Check whether --enable-mlogc was given. if test "${enable_mlogc+set}" = set; then : enableval=$enable_mlogc; if test "$enableval" != "no"; then build_mlogc=1 else build_mlogc=0 fi else build_mlogc=1 fi if test "$build_mlogc" -eq 1; then BUILD_MLOGC_TRUE= BUILD_MLOGC_FALSE='#' else BUILD_MLOGC_TRUE='#' BUILD_MLOGC_FALSE= fi if test "$build_mlogc" -eq 1; then TOPLEVEL_SUBDIRS="$TOPLEVEL_SUBDIRS mlogc" fi # Audit Log Parser v2 (ALP2) # Check whether --enable-alp2 was given. if test "${enable_alp2+set}" = set; then : enableval=$enable_alp2; if test "$enableval" != "no"; then build_alp2=1 else build_alp2=0 fi else build_alp2=0 fi if test "$build_alp2" -eq 1; then BUILD_ALP2_TRUE= BUILD_ALP2_FALSE='#' else BUILD_ALP2_TRUE='#' BUILD_ALP2_FALSE= fi if test "$build_alp2" -eq 1; then TOPLEVEL_SUBDIRS="$TOPLEVEL_SUBDIRS alp2" fi # Documentation # Check whether --enable-docs was given. if test "${enable_docs+set}" = set; then : enableval=$enable_docs; if test "$enableval" != "no"; then build_docs=1 else build_docs=0 fi else build_docs=0 fi if test "$build_docs" -eq 1; then BUILD_DOCS_TRUE= BUILD_DOCS_FALSE='#' else BUILD_DOCS_TRUE='#' BUILD_DOCS_FALSE= fi if test "$build_docs" -eq 1; then TOPLEVEL_SUBDIRS="$TOPLEVEL_SUBDIRS docs" fi # Add PCRE Studying # Check whether --enable-pcre-study was given. if test "${enable_pcre_study+set}" = set; then : enableval=$enable_pcre_study; if test "$enableval" != "no"; then pcre_study='-DWITH_PCRE_STUDY' MODSEC_EXTRA_CFLAGS="$MODSEC_EXTRA_CFLAGS $pcre_study" else pcre_study='' fi else pcre_study='-DWITH_PCRE_STUDY' fi # Add PCRE JIT # Check whether --enable-pcre-jit was given. if test "${enable_pcre_jit+set}" = set; then : enableval=$enable_pcre_jit; if test "$enableval" != "no"; then pcre_jit='-DWITH_PCRE_JIT' MODSEC_EXTRA_CFLAGS="$MODSEC_EXTRA_CFLAGS $pcre_jit" else pcre_jit='' fi else pcre_jit='' fi # Limit PCRE matching # Check whether --enable-pcre-match-limit was given. if test "${enable_pcre_match_limit+set}" = set; then : enableval=$enable_pcre_match_limit; if test "$enableval" = "yes"; then as_fn_error $? "PCRE match limits require a numeric value" "$LINENO" 5 elif test "$enableval" = "no"; then pcre_match_limit='' else pcre_match_limit="-DMODSEC_PCRE_MATCH_LIMIT=$enableval" MODSEC_EXTRA_CFLAGS="$MODSEC_EXTRA_CFLAGS $pcre_match_limit" fi else pcre_match_limit='-DMODSEC_PCRE_MATCH_LIMIT=1500' fi # Limit PCRE matching recursion # Check whether --enable-pcre-match-limit-recursion was given. if test "${enable_pcre_match_limit_recursion+set}" = set; then : enableval=$enable_pcre_match_limit_recursion; if test "$enableval" = "yes"; then as_fn_error $? "PCRE match limits require a numeric value" "$LINENO" 5 elif test "$enableval" = "no"; then pcre_match_limit_recursion='' else pcre_match_limit_recursion="-DMODSEC_PCRE_MATCH_LIMIT_RECURSION=$enableval" MODSEC_EXTRA_CFLAGS="$MODSEC_EXTRA_CFLAGS $pcre_match_limit_recursion" fi else pcre_match_limit_recursion='-DMODSEC_PCRE_MATCH_LIMIT_RECURSION=1500' fi # Enable Lua per transaction cache # Check whether --enable-lua-cache was given. if test "${enable_lua_cache+set}" = set; then : enableval=$enable_lua_cache; if test "$enableval" != "no"; then lua_cache="-DCACHE_LUA" MODSEC_EXTRA_CFLAGS="$MODSEC_EXTRA_CFLAGS $lua_cache" else lua_cache= fi else lua_cache= fi # Enable phase-1 in post_read_request # Check whether --enable-htaccess-config was given. if test "${enable_htaccess_config+set}" = set; then : enableval=$enable_htaccess_config; if test "$enableval" != "no"; then htaccess_config="-DHTACCESS_CONFIG" MODSEC_EXTRA_CFLAGS="$MODSEC_EXTRA_CFLAGS $htaccess_config" else htaccess_config= fi else htaccess_config= fi # Enable phase-1 in post_read_request # Check whether --enable-request-early was given. if test "${enable_request_early+set}" = set; then : enableval=$enable_request_early; if test "$enableval" != "no"; then request_early="-DREQUEST_EARLY" MODSEC_EXTRA_CFLAGS="$MODSEC_EXTRA_CFLAGS $request_early" else request_early= fi else request_early='-DREQUEST_EARLY' fi # Ignore configure errors # Check whether --enable-errors was given. if test "${enable_errors+set}" = set; then : enableval=$enable_errors; if test "$enableval" != "no"; then report_errors=1 else report_errors=0 fi else report_errors=1 fi # Verbose output # Check whether --enable-verbose-output was given. if test "${enable_verbose_output+set}" = set; then : enableval=$enable_verbose_output; if test "$enableval" != "no"; then verbose_output=1 else verbose_output=0 fi else verbose_output=0 fi # Strict Compile # Check whether --enable-strict-compile was given. if test "${enable_strict_compile+set}" = set; then : enableval=$enable_strict_compile; if test "$enableval" != "no"; then strict_compile="-std=c99 -Wstrict-overflow=1 -Wextra -Wno-missing-field-initializers -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wno-unused-parameter -Wformat -Wformat-security -Werror -fstack-protector -D_FORTIFY_SOURCE=2" MODSEC_EXTRA_CFLAGS="$MODSEC_EXTRA_CFLAGS $strict_compile" else strict_compile= fi else strict_compile= fi # DEBUG_CONF # Check whether --enable-debug-conf was given. if test "${enable_debug_conf+set}" = set; then : enableval=$enable_debug_conf; if test "$enableval" != "no"; then debug_conf="-DDEBUG_CONF" MODSEC_EXTRA_CFLAGS="$MODSEC_EXTRA_CFLAGS $debug_conf" else debug_conf= fi else debug_conf= fi # CACHE_DEBUG # Check whether --enable-debug-cache was given. if test "${enable_debug_cache+set}" = set; then : enableval=$enable_debug_cache; if test "$enableval" != "no"; then debug_cache="-DCACHE_DEBUG" MODSEC_EXTRA_CFLAGS="$MODSEC_EXTRA_CFLAGS $debug_cache" else debug_cache= fi else debug_cache= fi # DEBUG_ACMP # Check whether --enable-debug-acmp was given. if test "${enable_debug_acmp+set}" = set; then : enableval=$enable_debug_acmp; if test "$enableval" != "no"; then debug_acmp="-DDEBUG_ACMP" MODSEC_EXTRA_CFLAGS="$MODSEC_EXTRA_CFLAGS $debug_acmp" else debug_acmp= fi else debug_acmp= fi # DEBUG_MEM # Check whether --enable-debug-mem was given. if test "${enable_debug_mem+set}" = set; then : enableval=$enable_debug_mem; if test "$enableval" != "no"; then debug_mem="-DDEBUG_MEM" MODSEC_EXTRA_CFLAGS="$MODSEC_EXTRA_CFLAGS $debug_mem" else debug_mem= fi else debug_mem= fi # PERFORMANCE_MEASUREMENT # Check whether --enable-performance-measurement was given. if test "${enable_performance_measurement+set}" = set; then : enableval=$enable_performance_measurement; if test "$enableval" != "no"; then perf_meas="-DPERFORMANCE_MEASUREMENT" MODSEC_EXTRA_CFLAGS="$MODSEC_EXTRA_CFLAGS $perf_meas" else perf_meas= fi else perf_meas= fi # NO_MODSEC_API # Check whether --enable-modsec-api was given. if test "${enable_modsec_api+set}" = set; then : enableval=$enable_modsec_api; if test "$enableval" != "yes"; then modsec_api="-DNO_MODSEC_API" MODSEC_EXTRA_CFLAGS="$MODSEC_EXTRA_CFLAGS $modsec_api" else modsec_api= fi else modsec_api= fi # Find apxs { $as_echo "$as_me:${as_lineno-$LINENO}: looking for Apache module support via DSO through APXS" >&5 $as_echo "$as_me: looking for Apache module support via DSO through APXS" >&6;} # Check whether --with-apxs was given. if test "${with_apxs+set}" = set; then : withval=$with_apxs; if test "$withval" = "yes"; then APXS=apxs else APXS="$withval" fi fi if test -z "$APXS"; then for i in /usr/local/apache22/bin \ /usr/local/apache2/bin \ /usr/local/apache/bin \ /usr/local/sbin \ /usr/local/bin \ /usr/sbin \ /usr/bin; do if test -f "$i/apxs2"; then APXS="$i/apxs2" break elif test -f "$i/apxs"; then APXS="$i/apxs" break fi done fi # arbitrarily picking the same version subversion looks for, don't know how # accurate this really is, but at least it'll force us to have apache2... HTTPD_WANTED_MMN=20020903 if test -n "$APXS" -a "$APXS" != "no" -a -x "$APXS" ; then APXS_INCLUDE="`$APXS -q INCLUDEDIR`" if test -r $APXS_INCLUDE/httpd.h; then { $as_echo "$as_me:${as_lineno-$LINENO}: found apxs at $APXS" >&5 $as_echo "$as_me: found apxs at $APXS" >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: checking httpd version" >&5 $as_echo "$as_me: checking httpd version" >&6;} cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include "$APXS_INCLUDE/ap_mmn.h" #if AP_MODULE_MAGIC_AT_LEAST($HTTPD_WANTED_MMN,0) VERSION_OK #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "VERSION_OK" >/dev/null 2>&1; then : { $as_echo "$as_me:${as_lineno-$LINENO}: httpd is recent enough" >&5 $as_echo "$as_me: httpd is recent enough" >&6;} else if test "$report_errors" -eq 1; then as_fn_error mmn must be at least $HTTPD_WANTED_MMN "apache is too old" "$LINENO" 5 else { $as_echo "$as_me:${as_lineno-$LINENO}: apache is too old" >&5 $as_echo "$as_me: apache is too old" >&mmn must be at least $HTTPD_WANTED_MMN;} fi fi rm -f conftest* fi APXS_INCLUDEDIR="`$APXS -q INCLUDEDIR`" if test "$verbose_output" -eq 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: apxs INCLUDEDIR: $APXS_INCLUDEDIR" >&5 $as_echo "$as_me: apxs INCLUDEDIR: $APXS_INCLUDEDIR" >&6;}; fi # Make sure the include dir is used if test -n "$APXS_INCLUDEDIR"; then APXS_INCLUDES="-I${APXS_INCLUDEDIR} `$APXS -q INCLUDES` `$APXS -q EXTRA_INCLUDES`" else APXS_INCLUDES="`$APXS -q INCLUDES` `$APXS -q EXTRA_INCLUDES`" fi if test "$verbose_output" -eq 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: apxs INCLUDES: $APXS_INCLUDES" >&5 $as_echo "$as_me: apxs INCLUDES: $APXS_INCLUDES" >&6;}; fi APXS_CFLAGS=-I`$APXS -q INCLUDEDIR` if test "$verbose_output" -eq 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: apxs CFLAGS: $APXS_CFLAGS" >&5 $as_echo "$as_me: apxs CFLAGS: $APXS_CFLAGS" >&6;}; fi APXS_LDFLAGS= if test "$verbose_output" -eq 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: apxs LDFLAGS: $APXS_LDFLAGS" >&5 $as_echo "$as_me: apxs LDFLAGS: $APXS_LDFLAGS" >&6;}; fi APXS_LIBDIR="`$APXS -q LIBDIR`" if test "$verbose_output" -eq 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: apxs LIBDIR: $APXS_LIBDIR" >&5 $as_echo "$as_me: apxs LIBDIR: $APXS_LIBDIR" >&6;}; fi # Make sure the lib dir is used if test -n "$APXS_LIBDIR"; then APXS_LIBS="-L${APXS_LIBDIR} `$APXS -q LIBS` `$APXS -q EXTRA_LIBS`" else APXS_LIBS="`$APXS -q LIBS` `$APXS -q EXTRA_LIBS`" fi if test "$verbose_output" -eq 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: apxs LIBS: $APXS_LIBS" >&5 $as_echo "$as_me: apxs LIBS: $APXS_LIBS" >&6;}; fi APXS_LIBTOOL="`$APXS -q LIBTOOL`" if test "$verbose_output" -eq 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: apxs LIBTOOL: $APXS_LIBTOOL" >&5 $as_echo "$as_me: apxs LIBTOOL: $APXS_LIBTOOL" >&6;}; fi APXS_CC="`$APXS -q CC`" if test "$verbose_output" -eq 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: apxs CC: $APXS_CC" >&5 $as_echo "$as_me: apxs CC: $APXS_CC" >&6;}; fi APXS_BINDIR="`$APXS -q BINDIR`" if test "$verbose_output" -eq 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: apxs BINDIR: $APXS_BINDIR" >&5 $as_echo "$as_me: apxs BINDIR: $APXS_BINDIR" >&6;}; fi APXS_SBINDIR="`$APXS -q SBINDIR`" if test "$verbose_output" -eq 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: apxs SBINDIR: $APXS_SBINDIR" >&5 $as_echo "$as_me: apxs SBINDIR: $APXS_SBINDIR" >&6;}; fi APXS_PROGNAME="`$APXS -q PROGNAME`" if test "$verbose_output" -eq 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: apxs PROGNAME: $APXS_PROGNAME" >&5 $as_echo "$as_me: apxs PROGNAME: $APXS_PROGNAME" >&6;}; fi APXS_LIBEXECDIR="`$APXS -q LIBEXECDIR`" if test "$verbose_output" -eq 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: apxs LIBEXECDIR: $APXS_LIBEXECDIR" >&5 $as_echo "$as_me: apxs LIBEXECDIR: $APXS_LIBEXECDIR" >&6;}; fi APXS_MODULES=$APXS_LIBEXECDIR if test "$verbose_output" -eq 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: apxs MODULES: $APXS_MODULES" >&5 $as_echo "$as_me: apxs MODULES: $APXS_MODULES" >&6;}; fi if test "$APXS_SBINDIR" = "/"; then APXS_HTTPD="$APXS_SBINDIR/$APXS_PROGNAME" else APXS_HTTPD="$APXS_SBINDIR/$APXS_PROGNAME" fi if test "$verbose_output" -eq 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: apxs HTTPD: $APXS_HTTPD" >&5 $as_echo "$as_me: apxs HTTPD: $APXS_HTTPD" >&6;}; fi else if test "$report_errors" -eq 1; then as_fn_error $? "couldn't find APXS" "$LINENO" 5 else { $as_echo "$as_me:${as_lineno-$LINENO}: couldn't find APXS" >&5 $as_echo "$as_me: couldn't find APXS" >&6;} fi fi ### Build *EXTRA_CFLAGS vars # Allow overriding EXTRA_CFLAGS if $ENV_CMD | $GREP "^EXTRA_CFLAGS" > /dev/null 2>&1; then if test -z "$debug_mem"; then EXTRA_CFLAGS="$EXTRA_CFLAGS $strict_compile" fi else if test -n "$debug_mem"; then EXTRA_CFLAGS="-O0 -g -Wall" else EXTRA_CFLAGS="-O2 -g -Wall $strict_compile" fi fi MODSEC_EXTRA_CFLAGS="$pcre_study $pcre_match_limit $pcre_match_limit_recursion $pcre_jit $request_early $htaccess_config $lua_cache $debug_conf $debug_cache $debug_acmp $debug_mem $perf_meas $modsec_api $cpu_type" APXS_WRAPPER=build/apxs-wrapper APXS_EXTRA_CFLAGS="" for f in $EXTRA_CFLAGS; do APXS_EXTRA_CFLAGS="$APXS_EXTRA_CFLAGS -Wc,$f" done; MODSEC_APXS_EXTRA_CFLAGS="" for f in $MODSEC_EXTRA_CFLAGS; do MODSEC_APXS_EXTRA_CFLAGS="$MODSEC_APXS_EXTRA_CFLAGS -Wc,$f" done; ### Substitute the vars # Check whether --with-pcre was given. if test "${with_pcre+set}" = set; then : withval=$with_pcre; test_paths="${with_pcre}" else test_paths="/usr/local/libpcre /usr/local/pcre /usr/local /opt/libpcre /opt/pcre /opt /usr" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libpcre config script" >&5 $as_echo_n "checking for libpcre config script... " >&6; } if test -z "${with_pcre}"; then test_paths="/usr/local/pcre /usr/local /usr" else test_paths="${with_pcre}" fi for x in ${test_paths}; do if test ! -d "$x" -a -e "$x"; then PCRE_CONFIG=$x pcre_path="no" break fi for PCRE_CONFIG in pcre-config; do if test -e "${x}/bin/${PCRE_CONFIG}"; then pcre_path="${x}/bin" break elif test -e "${x}/${PCRE_CONFIG}"; then pcre_path="${x}" break else pcre_path="" fi done if test -n "$pcre_path"; then break fi done if test -n "${pcre_path}"; then if test "${pcre_path}" != "no"; then PCRE_CONFIG="${pcre_path}/${PCRE_CONFIG}" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${PCRE_CONFIG}" >&5 $as_echo "${PCRE_CONFIG}" >&6; } PCRE_VERSION="`${PCRE_CONFIG} --version`" if test "$verbose_output" -eq 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: pcre VERSION: $PCRE_VERSION" >&5 $as_echo "$as_me: pcre VERSION: $PCRE_VERSION" >&6;}; fi PCRE_CFLAGS="`${PCRE_CONFIG} --cflags`" if test "$verbose_output" -eq 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: pcre CFLAGS: $PCRE_CFLAGS" >&5 $as_echo "$as_me: pcre CFLAGS: $PCRE_CFLAGS" >&6;}; fi PCRE_LDADD="`${PCRE_CONFIG} --libs`" if test "$verbose_output" -eq 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: pcre LDADD: $PCRE_LDADD" >&5 $as_echo "$as_me: pcre LDADD: $PCRE_LDADD" >&6;}; fi PCRE_LD_PATH="/`${PCRE_CONFIG} --libs | cut -d'/' -f2,3,4,5,6 | cut -d ' ' -f1`" if test "$verbose_output" -eq 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: pcre PCRE_LD_PATH: $PCRE_LD_PATH" >&5 $as_echo "$as_me: pcre PCRE_LD_PATH: $PCRE_LD_PATH" >&6;}; fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "${PCRE_VERSION}"; then { $as_echo "$as_me:${as_lineno-$LINENO}: *** pcre library not found." >&5 $as_echo "$as_me: *** pcre library not found." >&6;} as_fn_error $? "pcre library is required" "$LINENO" 5 else { $as_echo "$as_me:${as_lineno-$LINENO}: using pcre v${PCRE_VERSION}" >&5 $as_echo "$as_me: using pcre v${PCRE_VERSION}" >&6;} fi if test "$build_apache2_module" -ne 0 -o "$build_mlogc" -ne 0; then # Check whether --with-apr was given. if test "${with_apr+set}" = set; then : withval=$with_apr; test_paths="${with_apr}" else test_paths="/usr/local/libapr /usr/local/apr /usr/local /opt/libapr /opt/apr /opt /usr" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libapr config script" >&5 $as_echo_n "checking for libapr config script... " >&6; } for x in ${test_paths}; do if test ! -d "$x" -a -e "$x"; then APR_CONFIG=$x apr_path=no break fi for APR_CONFIG in apr-1-mt-config apr-1-config apr-config-1 apr-mt-config-1 apr-mt-config apr-config; do if test -e "${x}/bin/${APR_CONFIG}"; then apr_path="${x}/bin" break elif test -e "${x}/${APR_CONFIG}"; then apr_path="${x}" break else apr_path="" fi done if test -n "$apr_path"; then break fi done if test -n "${apr_path}"; then if test "${apr_path}" != "no"; then APR_CONFIG="${apr_path}/${APR_CONFIG}" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${APR_CONFIG}" >&5 $as_echo "${APR_CONFIG}" >&6; } APR_VERSION="`${APR_CONFIG} --version`" if test "$verbose_output" -eq 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: apr VERSION: $APR_VERSION" >&5 $as_echo "$as_me: apr VERSION: $APR_VERSION" >&6;}; fi APR_CFLAGS="`${APR_CONFIG} --includes`" if test "$verbose_output" -eq 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: apr CFLAGS: $APR_CFLAGS" >&5 $as_echo "$as_me: apr CFLAGS: $APR_CFLAGS" >&6;}; fi APR_CPPFLAGS="`${APR_CONFIG} --cppflags`" if test "$verbose_output" -eq 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: apr CPPFLAGS: $APR_CPPFLAGS" >&5 $as_echo "$as_me: apr CPPFLAGS: $APR_CPPFLAGS" >&6;}; fi APR_LDFLAGS="`${APR_CONFIG} --libs`" if test "$verbose_output" -eq 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: apr LDFLAGS: $APR_LDFLAGS" >&5 $as_echo "$as_me: apr LDFLAGS: $APR_LDFLAGS" >&6;}; fi APR_LDADD="`${APR_CONFIG} --link-libtool`" if test "$verbose_output" -eq 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: apr LDADD: $APR_LDADD" >&5 $as_echo "$as_me: apr LDADD: $APR_LDADD" >&6;}; fi APR_INCLUDEDIR="`${APR_CONFIG} --includedir`" if test "$verbose_output" -eq 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: apr INCLUDEDIR: $APR_INCLUDEDIR" >&5 $as_echo "$as_me: apr INCLUDEDIR: $APR_INCLUDEDIR" >&6;}; fi APR_LINKLD="`${APR_CONFIG} --link-ld`" if test "$verbose_output" -eq 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: apr LINKLD: $APR_LINKLD" >&5 $as_echo "$as_me: apr LINKLD: $APR_LINKLD" >&6;}; fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "${APR_VERSION}"; then { $as_echo "$as_me:${as_lineno-$LINENO}: *** apr library not found." >&5 $as_echo "$as_me: *** apr library not found." >&6;} as_fn_error $? "apr library is required" "$LINENO" 5 else { $as_echo "$as_me:${as_lineno-$LINENO}: using apr v${APR_VERSION}" >&5 $as_echo "$as_me: using apr v${APR_VERSION}" >&6;} fi # Check whether --with-apu was given. if test "${with_apu+set}" = set; then : withval=$with_apu; test_paths="${with_apu}" else test_paths="/usr/local/libapr-util /usr/local/apr-util /usr/local/libapu /usr/local/apu /usr/local/apr /usr/local /opt/libapr-util /opt/apr-util /opt/libapu /opt/apu /opt /usr" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libapu config script" >&5 $as_echo_n "checking for libapu config script... " >&6; } for x in ${test_paths}; do if test ! -d "$x" -a -e "$x"; then APU_CONFIG=$x apu_path="no" break fi for APU_CONFIG in apu-1-mt-config apu-1-config apu-config-1 apu-mt-config-1 apu-mt-config apu-config; do if test -e "${x}/bin/${APU_CONFIG}"; then apu_path="${x}/bin" break elif test -e "${x}/${APU_CONFIG}"; then apu_path="${x}" break else apu_path="" fi done if test -n "$apu_path"; then break fi done if test -n "${apu_path}"; then if test "${apu_path}" != "no"; then APU_CONFIG="${apu_path}/${APU_CONFIG}" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${APU_CONFIG}" >&5 $as_echo "${APU_CONFIG}" >&6; } APU_VERSION="`${APU_CONFIG} --version`" if test "$verbose_output" -eq 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: apu VERSION: $APU_VERSION" >&5 $as_echo "$as_me: apu VERSION: $APU_VERSION" >&6;}; fi APU_CFLAGS="`${APU_CONFIG} --includes`" if test "$verbose_output" -eq 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: apu CFLAGS: $APU_CFLAGS" >&5 $as_echo "$as_me: apu CFLAGS: $APU_CFLAGS" >&6;}; fi APU_LDFLAGS="`${APU_CONFIG} --libs`" if test "$verbose_output" -eq 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: apu LDFLAGS: $APU_LDFLAGS" >&5 $as_echo "$as_me: apu LDFLAGS: $APU_LDFLAGS" >&6;}; fi APU_LDADD="`${APU_CONFIG} --link-libtool`" if test "$verbose_output" -eq 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: apu LDADD: $APU_LDADD" >&5 $as_echo "$as_me: apu LDADD: $APU_LDADD" >&6;}; fi APU_INCLUDEDIR="`${APU_CONFIG} --includedir`" if test "$verbose_output" -eq 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: apu INCLUDEDIR: $APU_INCLUDEDIR" >&5 $as_echo "$as_me: apu INCLUDEDIR: $APU_INCLUDEDIR" >&6;}; fi APU_LINKLD="`${APU_CONFIG} --link-ld`" if test "$verbose_output" -eq 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: apu LINKLD: $APU_LINKLD" >&5 $as_echo "$as_me: apu LINKLD: $APU_LINKLD" >&6;}; fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "${APU_VERSION}"; then { $as_echo "$as_me:${as_lineno-$LINENO}: *** apu library not found." >&5 $as_echo "$as_me: *** apu library not found." >&6;} as_fn_error $? "apu library is required" "$LINENO" 5 else { $as_echo "$as_me:${as_lineno-$LINENO}: using apu v${APU_VERSION}" >&5 $as_echo "$as_me: using apu v${APU_VERSION}" >&6;} fi fi # Check whether --with-libxml was given. if test "${with_libxml+set}" = set; then : withval=$with_libxml; test_paths="${with_libxml}" else test_paths="/usr/local/libxml2 /usr/local/xml2 /usr/local/xml /usr/local /opt/libxml2 /opt/libxml /opt/xml2 /opt/xml /opt /usr" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libxml2 config script" >&5 $as_echo_n "checking for libxml2 config script... " >&6; } for x in ${test_paths}; do if test ! -d "$x" -a -e "$x"; then LIBXML2_CONFIG=$x libxml2_path="no" break fi for LIBXML2_CONFIG in xml2-config xml-2-config xml-config; do if test -e "${x}/bin/${LIBXML2_CONFIG}"; then libxml2_path="${x}/bin" break elif test -e "${x}/${LIBXML2_CONFIG}"; then libxml2_path="${x}" break else libxml2_path="" fi done if test -n "$libxml2_path"; then break fi done if test -n "${libxml2_path}"; then if test "${libxml2_path}" != "no"; then LIBXML2_CONFIG="${libxml2_path}/${LIBXML2_CONFIG}" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${LIBXML2_CONFIG}" >&5 $as_echo "${LIBXML2_CONFIG}" >&6; } LIBXML2_VERSION=`${LIBXML2_CONFIG} --version | sed 's/^[^0-9][^[:space:]][^[:space:]]*[[:space:]]*//'` if test "$verbose_output" -eq 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: xml VERSION: $LIBXML2_VERSION" >&5 $as_echo "$as_me: xml VERSION: $LIBXML2_VERSION" >&6;}; fi LIBXML2_CFLAGS="`${LIBXML2_CONFIG} --cflags`" if test "$verbose_output" -eq 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: xml CFLAGS: $LIBXML2_CFLAGS" >&5 $as_echo "$as_me: xml CFLAGS: $LIBXML2_CFLAGS" >&6;}; fi LIBXML2_LDADD="`${LIBXML2_CONFIG} --libs`" if test "$verbose_output" -eq 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: xml LDADD: $LIBXML2_LDADD" >&5 $as_echo "$as_me: xml LDADD: $LIBXML2_LDADD" >&6;}; fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libxml2 is at least v2.6.29" >&5 $as_echo_n "checking if libxml2 is at least v2.6.29... " >&6; } libxml2_min_ver=`echo 2.6.29 | awk -F. '{print (\$ 1 * 1000000) + (\$ 2 * 1000) + \$ 3}'` libxml2_ver=`echo ${LIBXML2_VERSION} | awk -F. '{print (\$ 1 * 1000000) + (\$ 2 * 1000) + \$ 3}'` if test "$libxml2_ver" -ge "$libxml2_min_ver"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, $LIBXML2_VERSION" >&5 $as_echo "yes, $LIBXML2_VERSION" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, $LIBXML2_VERSION" >&5 $as_echo "no, $LIBXML2_VERSION" >&6; } as_fn_error $? "NOTE: libxml2 library must be at least 2.6.29" "$LINENO" 5 fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "${LIBXML2_VERSION}"; then { $as_echo "$as_me:${as_lineno-$LINENO}: *** xml library not found." >&5 $as_echo "$as_me: *** xml library not found." >&6;} as_fn_error $? "libxml2 is required" "$LINENO" 5 else { $as_echo "$as_me:${as_lineno-$LINENO}: using libxml2 v${LIBXML2_VERSION}" >&5 $as_echo "$as_me: using libxml2 v${LIBXML2_VERSION}" >&6;} fi if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi PKG_CONFIG=$ac_cv_path_PKG_CONFIG if test -n "$PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 $as_echo "$PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_path_PKG_CONFIG"; then ac_pt_PKG_CONFIG=$PKG_CONFIG # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $ac_pt_PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG if test -n "$ac_pt_PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 $as_echo "$ac_pt_PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_pt_PKG_CONFIG" = x; then PKG_CONFIG="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac PKG_CONFIG=$ac_pt_PKG_CONFIG fi else PKG_CONFIG="$ac_cv_path_PKG_CONFIG" fi fi if test -n "$PKG_CONFIG"; then _pkg_min_version=0.9.0 { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 $as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } PKG_CONFIG="" fi fi LUA_CONFIG="" LUA_VERSION="" LUA_CFLAGS="" LUA_CPPFLAGS="" LUA_LDADD="" LUA_LDFLAGS="" LUA_CONFIG=${PKG_CONFIG} LUA_PKGNAMES="lua5.1 lua-5.1 lua_5.1 lua-51 lua_51 lua51 lua5 lua" LUA_SONAMES="so la sl dll dylib" # Check whether --with-lua was given. if test "${with_lua+set}" = set; then : withval=$with_lua; else with_lua=yes fi case "${with_lua}" in #( no) : test_paths= ;; #( yes) : test_paths="/usr/local/liblua /usr/local/lua /usr/local /opt/liblua /opt/lua /opt /usr" ;; #( *) : test_paths="${with_lua}" ;; esac if test "x${test_paths}" != "x"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for liblua config script" >&5 $as_echo_n "checking for liblua config script... " >&6; } for x in ${test_paths}; do if test ! -d "$x" -a -e "$x"; then LUA_CONFIG=$x break fi for y in $LUA_CONFIG; do if test -e "${x}/bin/${y}"; then LUA_CONFIG="${x}/bin/${y}" lua_config="${LUA_CONFIG}" break elif test -e "${x}/${y}"; then LUA_CONFIG="${x}/${y}" lua_config="${LUA_CONFIG}" break fi done if test -n "${lua_config}"; then break fi done if test -n "${LUA_CONFIG}"; then LUA_PKGNAME="" for x in ${LUA_PKGNAMES}; do if ${LUA_CONFIG} --exists ${x}; then LUA_PKGNAME="$x" break fi done fi if test -n "${LUA_PKGNAME}"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${LUA_CONFIG}" >&5 $as_echo "${LUA_CONFIG}" >&6; } LUA_VERSION="`${LUA_CONFIG} ${LUA_PKGNAME} --modversion`" if test "$verbose_output" -eq 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: lua VERSION: $LUA_VERSION" >&5 $as_echo "$as_me: lua VERSION: $LUA_VERSION" >&6;}; fi LUA_CFLAGS="`${LUA_CONFIG} ${LUA_PKGNAME} --cflags`" if test "$verbose_output" -eq 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: lua CFLAGS: $LUA_CFLAGS" >&5 $as_echo "$as_me: lua CFLAGS: $LUA_CFLAGS" >&6;}; fi LUA_LDADD="`${LUA_CONFIG} ${LUA_PKGNAME} --libs-only-l`" if test "$verbose_output" -eq 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: lua LDADD: $LUA_LDADD" >&5 $as_echo "$as_me: lua LDADD: $LUA_LDADD" >&6;}; fi LUA_LDFLAGS="`${LUA_CONFIG} ${LUA_PKGNAME} --libs-only-L --libs-only-other`" if test "$verbose_output" -eq 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: lua LDFLAGS: $LUA_LDFLAGS" >&5 $as_echo "$as_me: lua LDFLAGS: $LUA_LDFLAGS" >&6;}; fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lua install" >&5 $as_echo_n "checking for lua install... " >&6; } for x in ${test_paths}; do for y in ${LUA_SONAMES}; do if test -e "${x}/liblua5.1.${y}"; then lua_lib_path="${x}" lua_lib_name="lua5.1" break elif test -e "${x}/lib/liblua5.1.${y}"; then lua_lib_path="${x}/lib" lua_lib_name="lua5.1" break elif test -e "${x}/lib64/liblua5.1.${y}"; then lua_lib_path="${x}/lib64" lua_lib_name="lua5.1" break elif test -e "${x}/lib32/liblua5.1.${y}"; then lua_lib_path="${x}/lib32" lua_lib_name="lua5.1" break elif test -e "${x}/liblua51.${y}"; then lua_lib_path="${x}" lua_lib_name="lua51" break elif test -e "${x}/lib/liblua51.${y}"; then lua_lib_path="${x}/lib" lua_lib_name="lua51" break elif test -e "${x}/lib64/liblua51.${y}"; then lua_lib_path="${x}/lib64" lua_lib_name="lua51" break elif test -e "${x}/lib32/liblua51.${y}"; then lua_lib_path="${x}/lib32" lua_lib_name="lua51" break elif test -e "${x}/liblua.${y}"; then lua_lib_path="${x}" lua_lib_name="lua" break elif test -e "${x}/lib/liblua.${y}"; then lua_lib_path="${x}/lib" lua_lib_name="lua" break elif test -e "${x}/lib64/liblua.${y}"; then lua_lib_path="${x}/lib64" lua_lib_name="lua" break elif test -e "${x}/lib32/liblua.${y}"; then lua_lib_path="${x}/lib32" lua_lib_name="lua" break else lua_lib_path="" lua_lib_name="" fi done if test -n "$lua_lib_path"; then break fi done for x in ${test_paths}; do if test -e "${x}/include/lua.h"; then lua_inc_path="${x}/include" break elif test -e "${x}/lua.h"; then lua_inc_path="${x}" break fi for lua_pkg_name in ${lua_lib_name} ${LUA_PKGNAMES}; do if test -e "${x}/include/${lua_pkg_name}/lua.h"; then lua_inc_path="${x}/include" break elif test -e "${x}/${lua_pkg_name}/lua.h"; then lua_inc_path="${x}" break else lua_inc_path="" fi done if test -n "$lua_inc_path"; then break fi done if test -n "${lua_lib_path}" -a -n "${lua_inc_path}"; then LUA_CONFIG="" { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lua_lib_path} ${lua_inc_path}" >&5 $as_echo "${lua_lib_path} ${lua_inc_path}" >&6; } LUA_VERSION="5.1" LUA_CFLAGS="-I${lua_inc_path}" LUA_LDADD="-l${lua_lib_name}" LUA_LDFLAGS="-L${lua_lib_path}" else LUA_VERSION="" { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "${LUA_VERSION}"; then { $as_echo "$as_me:${as_lineno-$LINENO}: optional lua library not found" >&5 $as_echo "$as_me: optional lua library not found" >&6;} else { $as_echo "$as_me:${as_lineno-$LINENO}: using lua v${LUA_VERSION}" >&5 $as_echo "$as_me: using lua v${LUA_VERSION}" >&6;} LUA_CFLAGS="-DWITH_LUA ${LUA_CFLAGS}" fi if test "$build_mlogc" -ne 0; then # Check whether --with-curl was given. if test "${with_curl+set}" = set; then : withval=$with_curl; test_paths="${with_curl}" else test_paths="/usr/local/libcurl /usr/local/curl /usr/local /opt/libcurl /opt/curl /opt /usr" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libcurl config script" >&5 $as_echo_n "checking for libcurl config script... " >&6; } for x in ${test_paths}; do if test ! -d "$x" -a -e "$x"; then CURL_CONFIG=$x curl_path="no" break fi for CURL_CONFIG in curl-config; do if test -e "${x}/bin/${CURL_CONFIG}"; then curl_path="${x}/bin" break elif test -e "${x}/${CURL_CONFIG}"; then curl_path="${x}" break else curl_path="" fi done if test -n "$curl_path"; then break fi done if test -n "${curl_path}"; then if test "${curl_path}" != "no"; then CURL_CONFIG="${curl_path}/${CURL_CONFIG}" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${CURL_CONFIG}" >&5 $as_echo "${CURL_CONFIG}" >&6; } CURL_VERSION=`${CURL_CONFIG} --version | sed 's/^[^0-9][^[:space:]][^[:space:]]*[[:space:]]*//'` if test "$verbose_output" -eq 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: curl VERSION: $CURL_VERSION" >&5 $as_echo "$as_me: curl VERSION: $CURL_VERSION" >&6;}; fi CURL_CFLAGS="`${CURL_CONFIG} --cflags`" if test "$verbose_output" -eq 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: curl CFLAGS: $CURL_CFLAGS" >&5 $as_echo "$as_me: curl CFLAGS: $CURL_CFLAGS" >&6;}; fi CURL_LDADD="`${CURL_CONFIG} --libs`" if test "$verbose_output" -eq 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: curl LDADD: $CURL_LIBS" >&5 $as_echo "$as_me: curl LDADD: $CURL_LIBS" >&6;}; fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libcurl is at least v${CURL_MIN_VERSION}" >&5 $as_echo_n "checking if libcurl is at least v${CURL_MIN_VERSION}... " >&6; } curl_min_ver=`echo ${CURL_MIN_VERSION} | awk -F. '{print (\$ 1 * 1000000) + (\$ 2 * 1000) + \$ 3}'` curl_ver=`echo ${CURL_VERSION} | awk -F. '{print (\$ 1 * 1000000) + (\$ 2 * 1000) + \$ 3}'` if test "$curl_min_ver" -le "$curl_ver"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, $CURL_VERSION" >&5 $as_echo "yes, $CURL_VERSION" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, $CURL_VERSION" >&5 $as_echo "no, $CURL_VERSION" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: NOTE: curl library may be too old" >&5 $as_echo "$as_me: NOTE: curl library may be too old" >&6;} fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libcurl is linked with gnutls" >&5 $as_echo_n "checking if libcurl is linked with gnutls... " >&6; } curl_uses_gnutls=`echo ${CURL_LIBS} | grep gnutls | wc -l` if test "$curl_uses_gnutls" -ne 0; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: NOTE: curl linked with gnutls may be buggy, openssl recommended" >&5 $as_echo "$as_me: NOTE: curl linked with gnutls may be buggy, openssl recommended" >&6;} CURL_USES_GNUTLS=yes else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } CURL_USES_GNUTLS=no fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "${CURL_VERSION}"; then { $as_echo "$as_me:${as_lineno-$LINENO}: *** curl library not found." >&5 $as_echo "$as_me: *** curl library not found." >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: NOTE: curl library is only required for building mlogc" >&5 $as_echo "$as_me: NOTE: curl library is only required for building mlogc" >&6;} else { $as_echo "$as_me:${as_lineno-$LINENO}: using curl v${CURL_VERSION}" >&5 $as_echo "$as_me: using curl v${CURL_VERSION}" >&6;} fi fi ac_config_files="$ac_config_files Makefile" ac_config_files="$ac_config_files tools/Makefile" if test "$build_alp2" -ne 0; then ac_config_files="$ac_config_files alp2/Makefile" fi if test "$build_apache2_module" -ne 0; then ac_config_files="$ac_config_files apache2/Makefile" fi if test "$build_standalone_module" -ne 0; then ac_config_files="$ac_config_files standalone/Makefile" ac_config_files="$ac_config_files nginx/modsecurity/config" fi if test "$build_extentions" -ne 0; then ac_config_files="$ac_config_files ext/Makefile" fi ac_config_files="$ac_config_files build/apxs-wrapper" if test -e "$PERL"; then if test "$build_mlogc" -ne 0; then ac_config_files="$ac_config_files mlogc/mlogc-batch-load.pl" fi ac_config_files="$ac_config_files tests/run-unit-tests.pl" ac_config_files="$ac_config_files tests/run-regression-tests.pl" ac_config_files="$ac_config_files tests/gen_rx-pm.pl" ac_config_files="$ac_config_files tests/csv_rx-pm.pl" ac_config_files="$ac_config_files tests/regression/server_root/conf/httpd.conf" # Perl based tools ac_config_files="$ac_config_files tools/rules-updater.pl" fi if test "$build_mlogc" -ne 0; then ac_config_files="$ac_config_files mlogc/Makefile" fi ac_config_files="$ac_config_files tests/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs { $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 $as_echo_n "checking that generated files are newer than configure... " >&6; } if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 $as_echo "done" >&6; } if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${AIX_TRUE}" && test -z "${AIX_FALSE}"; then as_fn_error $? "conditional \"AIX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${HPUX_TRUE}" && test -z "${HPUX_FALSE}"; then as_fn_error $? "conditional \"HPUX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${MACOSX_TRUE}" && test -z "${MACOSX_FALSE}"; then as_fn_error $? "conditional \"MACOSX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${LINUX_TRUE}" && test -z "${LINUX_FALSE}"; then as_fn_error $? "conditional \"LINUX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${LINUX390_TRUE}" && test -z "${LINUX390_FALSE}"; then as_fn_error $? "conditional \"LINUX390\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${SOLARIS_TRUE}" && test -z "${SOLARIS_FALSE}"; then as_fn_error $? "conditional \"SOLARIS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${FREEBSD_TRUE}" && test -z "${FREEBSD_FALSE}"; then as_fn_error $? "conditional \"FREEBSD\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${OPENBSD_TRUE}" && test -z "${OPENBSD_FALSE}"; then as_fn_error $? "conditional \"OPENBSD\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${NETBSD_TRUE}" && test -z "${NETBSD_FALSE}"; then as_fn_error $? "conditional \"NETBSD\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${BUILD_APACHE2_MODULE_TRUE}" && test -z "${BUILD_APACHE2_MODULE_FALSE}"; then as_fn_error $? "conditional \"BUILD_APACHE2_MODULE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${BUILD_STANDALONE_MODULE_TRUE}" && test -z "${BUILD_STANDALONE_MODULE_FALSE}"; then as_fn_error $? "conditional \"BUILD_STANDALONE_MODULE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${BUILD_extentions_TRUE}" && test -z "${BUILD_extentions_FALSE}"; then as_fn_error $? "conditional \"BUILD_extentions\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${BUILD_MLOGC_TRUE}" && test -z "${BUILD_MLOGC_FALSE}"; then as_fn_error $? "conditional \"BUILD_MLOGC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${BUILD_ALP2_TRUE}" && test -z "${BUILD_ALP2_FALSE}"; then as_fn_error $? "conditional \"BUILD_ALP2\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${BUILD_DOCS_TRUE}" && test -z "${BUILD_DOCS_FALSE}"; then as_fn_error $? "conditional \"BUILD_DOCS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by modsecurity $as_me 2.7, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ modsecurity config.status 2.7 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`' host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`' hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } # Quote evaled strings. for var in SHELL \ ECHO \ PATH_SEPARATOR \ SED \ GREP \ EGREP \ FGREP \ LD \ NM \ LN_S \ lt_SP2NL \ lt_NL2SP \ reload_flag \ OBJDUMP \ deplibs_check_method \ file_magic_cmd \ file_magic_glob \ want_nocaseglob \ DLLTOOL \ sharedlib_from_linklib_cmd \ AR \ AR_FLAGS \ archiver_list_spec \ STRIP \ RANLIB \ CC \ CFLAGS \ compiler \ lt_cv_sys_global_symbol_pipe \ lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ nm_file_list_spec \ lt_prog_compiler_no_builtin_flag \ lt_prog_compiler_pic \ lt_prog_compiler_wl \ lt_prog_compiler_static \ lt_cv_prog_compiler_c_o \ need_locks \ MANIFEST_TOOL \ DSYMUTIL \ NMEDIT \ LIPO \ OTOOL \ OTOOL64 \ shrext_cmds \ export_dynamic_flag_spec \ whole_archive_flag_spec \ compiler_needs_object \ with_gnu_ld \ allow_undefined_flag \ no_undefined_flag \ hardcode_libdir_flag_spec \ hardcode_libdir_separator \ exclude_expsyms \ include_expsyms \ file_list_spec \ variables_saved_for_relink \ libname_spec \ library_names_spec \ soname_spec \ install_override_mode \ finish_eval \ old_striplib \ striplib; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in reload_cmds \ old_postinstall_cmds \ old_postuninstall_cmds \ old_archive_cmds \ extract_expsyms_cmds \ old_archive_from_new_cmds \ old_archive_from_expsyms_cmds \ archive_cmds \ archive_expsym_cmds \ module_cmds \ module_expsym_cmds \ export_symbols_cmds \ prelink_cmds \ postlink_cmds \ postinstall_cmds \ postuninstall_cmds \ finish_cmds \ sys_lib_search_path_spec \ sys_lib_dlsearch_path_spec; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done ac_aux_dir='$ac_aux_dir' xsi_shell='$xsi_shell' lt_shell_append='$lt_shell_append' # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi PACKAGE='$PACKAGE' VERSION='$VERSION' TIMESTAMP='$TIMESTAMP' RM='$RM' ofile='$ofile' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "apache2/modsecurity_config_auto.h") CONFIG_HEADERS="$CONFIG_HEADERS apache2/modsecurity_config_auto.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "tools/Makefile") CONFIG_FILES="$CONFIG_FILES tools/Makefile" ;; "alp2/Makefile") CONFIG_FILES="$CONFIG_FILES alp2/Makefile" ;; "apache2/Makefile") CONFIG_FILES="$CONFIG_FILES apache2/Makefile" ;; "standalone/Makefile") CONFIG_FILES="$CONFIG_FILES standalone/Makefile" ;; "nginx/modsecurity/config") CONFIG_FILES="$CONFIG_FILES nginx/modsecurity/config" ;; "ext/Makefile") CONFIG_FILES="$CONFIG_FILES ext/Makefile" ;; "build/apxs-wrapper") CONFIG_FILES="$CONFIG_FILES build/apxs-wrapper" ;; "mlogc/mlogc-batch-load.pl") CONFIG_FILES="$CONFIG_FILES mlogc/mlogc-batch-load.pl" ;; "tests/run-unit-tests.pl") CONFIG_FILES="$CONFIG_FILES tests/run-unit-tests.pl" ;; "tests/run-regression-tests.pl") CONFIG_FILES="$CONFIG_FILES tests/run-regression-tests.pl" ;; "tests/gen_rx-pm.pl") CONFIG_FILES="$CONFIG_FILES tests/gen_rx-pm.pl" ;; "tests/csv_rx-pm.pl") CONFIG_FILES="$CONFIG_FILES tests/csv_rx-pm.pl" ;; "tests/regression/server_root/conf/httpd.conf") CONFIG_FILES="$CONFIG_FILES tests/regression/server_root/conf/httpd.conf" ;; "tools/rules-updater.pl") CONFIG_FILES="$CONFIG_FILES tools/rules-updater.pl" ;; "mlogc/Makefile") CONFIG_FILES="$CONFIG_FILES mlogc/Makefile" ;; "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named 'Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "$am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir=$dirpart/$fdir; as_fn_mkdir_p # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ;; "libtool":C) # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi cfgfile="${ofile}T" trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. # # GNU Libtool is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License, or (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, or # obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # The names of the tagged configurations supported by this script. available_tags="" # ### BEGIN LIBTOOL CONFIG # Which release of libtool.m4 was used? macro_version=$macro_version macro_revision=$macro_revision # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # What type of objects to build. pic_mode=$pic_mode # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # An echo program that protects backslashes. ECHO=$lt_ECHO # The PATH separator for the build system. PATH_SEPARATOR=$lt_PATH_SEPARATOR # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="\$SED -e 1s/^X//" # A grep program that handles long lines. GREP=$lt_GREP # An ERE matcher. EGREP=$lt_EGREP # A literal string matcher. FGREP=$lt_FGREP # A BSD- or MS-compatible name lister. NM=$lt_NM # Whether we need soft or hard links. LN_S=$lt_LN_S # What is the maximum length of a command? max_cmd_len=$max_cmd_len # Object file suffix (normally "o"). objext=$ac_objext # Executable file suffix (normally ""). exeext=$exeext # whether the shell understands "unset". lt_unset=$lt_unset # turn spaces into newlines. SP2NL=$lt_lt_SP2NL # turn newlines into spaces. NL2SP=$lt_lt_NL2SP # convert \$build file names to \$host format. to_host_file_cmd=$lt_cv_to_host_file_cmd # convert \$build files to toolchain format. to_tool_file_cmd=$lt_cv_to_tool_file_cmd # An object symbol dumper. OBJDUMP=$lt_OBJDUMP # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method = "file_magic". file_magic_cmd=$lt_file_magic_cmd # How to find potential files when deplibs_check_method = "file_magic". file_magic_glob=$lt_file_magic_glob # Find potential files using nocaseglob when deplibs_check_method = "file_magic". want_nocaseglob=$lt_want_nocaseglob # DLL creation program. DLLTOOL=$lt_DLLTOOL # Command to associate shared and link libraries. sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd # The archiver. AR=$lt_AR # Flags to create an archive. AR_FLAGS=$lt_AR_FLAGS # How to feed a file listing to the archiver. archiver_list_spec=$lt_archiver_list_spec # A symbol stripping program. STRIP=$lt_STRIP # Commands used to install an old-style archive. RANLIB=$lt_RANLIB old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Whether to use a lock for old archive extraction. lock_old_archive_extraction=$lock_old_archive_extraction # A C compiler. LTCC=$lt_CC # LTCC compiler flags. LTCFLAGS=$lt_CFLAGS # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration. global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair. global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix # Specify filename containing input files for \$NM. nm_file_list_spec=$lt_nm_file_list_spec # The root where to search for dependent libraries,and in which our libraries should be installed. lt_sysroot=$lt_sysroot # The name of the directory that contains temporary libtool files. objdir=$objdir # Used to examine libraries when file_magic_cmd begins with "file". MAGIC_CMD=$MAGIC_CMD # Must we lock files when doing compilation? need_locks=$lt_need_locks # Manifest tool. MANIFEST_TOOL=$lt_MANIFEST_TOOL # Tool to manipulate archived DWARF debug symbol files on Mac OS X. DSYMUTIL=$lt_DSYMUTIL # Tool to change global to local symbols on Mac OS X. NMEDIT=$lt_NMEDIT # Tool to manipulate fat objects and archives on Mac OS X. LIPO=$lt_LIPO # ldd/readelf like tool for Mach-O binaries on Mac OS X. OTOOL=$lt_OTOOL # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. OTOOL64=$lt_OTOOL64 # Old archive suffix (normally "a"). libext=$libext # Shared library suffix (normally ".so"). shrext_cmds=$lt_shrext_cmds # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Variables whose values should be saved in libtool wrapper scripts and # restored at link time. variables_saved_for_relink=$lt_variables_saved_for_relink # Do we need the "lib" prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Library versioning type. version_type=$version_type # Shared library runtime path variable. runpath_var=$runpath_var # Shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Permission mode override for installation of shared libraries. install_override_mode=$lt_install_override_mode # Command to use after installation of a shared archive. postinstall_cmds=$lt_postinstall_cmds # Command to use after uninstallation of a shared archive. postuninstall_cmds=$lt_postuninstall_cmds # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # As "finish_cmds", except a single script fragment to be evaled but # not shown. finish_eval=$lt_finish_eval # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Compile-time system search path for libraries. sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries. sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # The linker used to build libraries. LD=$lt_LD # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds # A language specific compiler. CC=$lt_compiler # Is the compiler the GNU compiler? with_gcc=$GCC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds archive_expsym_cmds=$lt_archive_expsym_cmds # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds module_expsym_cmds=$lt_module_expsym_cmds # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting \${shlibpath_var} if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms # Symbols that must always be exported. include_expsyms=$lt_include_expsyms # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds # Commands necessary for finishing linking programs. postlink_cmds=$lt_postlink_cmds # Specify filename containing input files. file_list_spec=$lt_file_list_spec # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action # ### END LIBTOOL CONFIG _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac ltmain="$ac_aux_dir/ltmain.sh" # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) if test x"$xsi_shell" = xyes; then sed -e '/^func_dirname ()$/,/^} # func_dirname /c\ func_dirname ()\ {\ \ case ${1} in\ \ */*) func_dirname_result="${1%/*}${2}" ;;\ \ * ) func_dirname_result="${3}" ;;\ \ esac\ } # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_basename ()$/,/^} # func_basename /c\ func_basename ()\ {\ \ func_basename_result="${1##*/}"\ } # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\ func_dirname_and_basename ()\ {\ \ case ${1} in\ \ */*) func_dirname_result="${1%/*}${2}" ;;\ \ * ) func_dirname_result="${3}" ;;\ \ esac\ \ func_basename_result="${1##*/}"\ } # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_stripname ()$/,/^} # func_stripname /c\ func_stripname ()\ {\ \ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\ \ # positional parameters, so assign one to ordinary parameter first.\ \ func_stripname_result=${3}\ \ func_stripname_result=${func_stripname_result#"${1}"}\ \ func_stripname_result=${func_stripname_result%"${2}"}\ } # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\ func_split_long_opt ()\ {\ \ func_split_long_opt_name=${1%%=*}\ \ func_split_long_opt_arg=${1#*=}\ } # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\ func_split_short_opt ()\ {\ \ func_split_short_opt_arg=${1#??}\ \ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\ } # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\ func_lo2o ()\ {\ \ case ${1} in\ \ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\ \ *) func_lo2o_result=${1} ;;\ \ esac\ } # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_xform ()$/,/^} # func_xform /c\ func_xform ()\ {\ func_xform_result=${1%.*}.lo\ } # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_arith ()$/,/^} # func_arith /c\ func_arith ()\ {\ func_arith_result=$(( $* ))\ } # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_len ()$/,/^} # func_len /c\ func_len ()\ {\ func_len_result=${#1}\ } # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$lt_shell_append" = xyes; then sed -e '/^func_append ()$/,/^} # func_append /c\ func_append ()\ {\ eval "${1}+=\\${2}"\ } # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\ func_append_quoted ()\ {\ \ func_quote_for_eval "${2}"\ \ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\ } # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: # Save a `func_append' function call where possible by direct use of '+=' sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: else # Save a `func_append' function call even when '+=' is not available sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$_lt_function_replace_fail" = x":"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5 $as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;} fi mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ;; "build/apxs-wrapper":F) chmod +x build/apxs-wrapper ;; "mlogc/mlogc-batch-load.pl":F) chmod +x mlogc/mlogc-batch-load.pl ;; "tests/run-unit-tests.pl":F) chmod +x tests/run-unit-tests.pl ;; "tests/run-regression-tests.pl":F) chmod +x tests/run-regression-tests.pl ;; "tests/gen_rx-pm.pl":F) chmod +x tests/gen_rx-pm.pl ;; "tests/csv_rx-pm.pl":F) chmod +x tests/csv_rx-pm.pl ;; "tools/rules-updater.pl":F) chmod +x tools/rules-updater.pl ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi