diff options
Diffstat (limited to 'ext/crack')
-rw-r--r-- | ext/crack/CREDITS | 4 | ||||
-rw-r--r-- | ext/crack/EXPERIMENTAL | 5 | ||||
-rw-r--r-- | ext/crack/config.m4 | 33 | ||||
-rw-r--r-- | ext/crack/crack.c | 277 | ||||
-rw-r--r-- | ext/crack/crack.dsp | 114 | ||||
-rw-r--r-- | ext/crack/php_crack.h | 72 | ||||
-rw-r--r-- | ext/crack/tests/001.phpt | 23 |
7 files changed, 0 insertions, 528 deletions
diff --git a/ext/crack/CREDITS b/ext/crack/CREDITS deleted file mode 100644 index d9421275c0..0000000000 --- a/ext/crack/CREDITS +++ /dev/null @@ -1,4 +0,0 @@ -crack -Alexander Feldman -Windows Port: -Joseph Tate diff --git a/ext/crack/EXPERIMENTAL b/ext/crack/EXPERIMENTAL deleted file mode 100644 index 6443e99646..0000000000 --- a/ext/crack/EXPERIMENTAL +++ /dev/null @@ -1,5 +0,0 @@ -this extension is experimental, -its functions may change their names -or move to extension all together -so do not rely to much on them -you have been warned! diff --git a/ext/crack/config.m4 b/ext/crack/config.m4 deleted file mode 100644 index d88ccb14bf..0000000000 --- a/ext/crack/config.m4 +++ /dev/null @@ -1,33 +0,0 @@ -dnl -dnl $Id$ -dnl - -PHP_ARG_WITH(crack, for CRACKlib support, -[ --with-crack[=DIR] Include crack support.]) - -if test "$PHP_CRACK" != "no"; then - - for i in /usr/local/lib /usr/lib $PHP_CRACK/lib $PHP_CRACK/cracklib; do - test -f $i/libcrack.$SHLIB_SUFFIX_NAME -o -f $i/libcrack.a && CRACK_LIBDIR=$i - done - - for i in /usr/local/include /usr/include $PHP_CRACK/include $PHP_CRACK/cracklib; do - test -f $i/packer.h && CRACK_INCLUDEDIR=$i - done - - if test -z "$CRACK_LIBDIR"; then - AC_MSG_ERROR(Cannot find the cracklib library file) - fi - - if test -z "$CRACK_INCLUDEDIR"; then - AC_MSG_ERROR(Cannot find a cracklib header file) - fi - - PHP_ADD_INCLUDE($CRACK_INCLUDEDIR) - PHP_ADD_LIBRARY_WITH_PATH(crack, $CRACK_LIBDIR, CRACK_SHARED_LIBADD) - - PHP_NEW_EXTENSION(crack, crack.c, $ext_shared) - PHP_SUBST(CRACK_SHARED_LIBADD) - AC_DEFINE(HAVE_CRACK, 1, [ ]) -fi - diff --git a/ext/crack/crack.c b/ext/crack/crack.c deleted file mode 100644 index 5bd362d0f5..0000000000 --- a/ext/crack/crack.c +++ /dev/null @@ -1,277 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 4 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2003 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.02 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_02.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Alexander Feldman | - +----------------------------------------------------------------------+ - */ -/* $Id$ */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "php.h" -#include "php_ini.h" -#include "ext/standard/info.h" -#include "php_crack.h" - -#if HAVE_CRACK - -#include <packer.h> - -ZEND_DECLARE_MODULE_GLOBALS(crack) - -/* True global resources - no need for thread safety here */ -static int le_crack; - -function_entry crack_functions[] = { - ZEND_FE(crack_opendict, NULL) - ZEND_FE(crack_closedict, NULL) - ZEND_FE(crack_check, NULL) - ZEND_FE(crack_getlastmessage, NULL) - {NULL, NULL, NULL} -}; - -zend_module_entry crack_module_entry = { - STANDARD_MODULE_HEADER, - "crack", - crack_functions, - ZEND_MODULE_STARTUP_N(crack), - ZEND_MODULE_SHUTDOWN_N(crack), - ZEND_MODULE_ACTIVATE_N(crack), - ZEND_MODULE_DEACTIVATE_N(crack), - ZEND_MODULE_INFO_N(crack), - NO_VERSION_YET, - STANDARD_MODULE_PROPERTIES -}; - -#ifdef COMPILE_DL_CRACK -ZEND_GET_MODULE(crack) -#endif - -PHP_INI_BEGIN() - STD_PHP_INI_ENTRY("crack.default_dictionary", NULL, PHP_INI_SYSTEM, OnUpdateString, default_dictionary, zend_crack_globals, crack_globals) -PHP_INI_END() - -long _crack_open_dict(char *dictpath TSRMLS_DC) -{ - PWDICT *pwdict; - long resource; - - if (CRACKG(current_id) != -1) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can not use more than one open dictionary with this implementation of libcrack"); - return -1; - } - if (NULL == (pwdict = PWOpen(dictpath, "r"))) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to open a crack dictionary"); - return -1; - } - - resource = zend_list_insert(pwdict, le_crack); - -/* if (CRACKG(current_id) != -1) { - zend_list_delete(CRACKG(current_id)); - } -*/ - CRACKG(current_id) = resource; - - return resource; -} - -void _close_crack_dict(PWDICT *pwdict) -{ - PWClose(pwdict); -} - -ZEND_MODULE_STARTUP_D(crack) -{ -#ifdef ZTS - zend_crack_globals *crack_globals; - - ts_allocate_id(&crack_globals_id, sizeof(zend_crack_globals), NULL, NULL); - crack_globals = ts_resource(crack_globals_id); -#endif - - REGISTER_INI_ENTRIES(); - - le_crack = register_list_destructors(_close_crack_dict, NULL); - - return SUCCESS; -} - -ZEND_MODULE_SHUTDOWN_D(crack) -{ - UNREGISTER_INI_ENTRIES(); - return SUCCESS; -} - -ZEND_MODULE_ACTIVATE_D(crack) -{ - CRACKG(last_message) = NULL; - CRACKG(current_id) = -1; - - return SUCCESS; -} - -ZEND_MODULE_DEACTIVATE_D(crack) -{ - if (NULL != CRACKG(last_message)) { - efree(CRACKG(last_message)); - } - return SUCCESS; -} - -ZEND_MODULE_INFO_D(crack) -{ - php_info_print_table_start(); - php_info_print_table_header(2, "crack support", "enabled"); - php_info_print_table_end(); - - DISPLAY_INI_ENTRIES(); -} - -/* {{{ proto string crack_opendict(string dictionary) - Opens a new cracklib dictionary */ -ZEND_FUNCTION(crack_opendict) -{ - zval **dictpath; - long resource; - - if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &dictpath) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_string_ex(dictpath); - - if (-1 == (resource = _crack_open_dict(Z_STRVAL_PP(dictpath) TSRMLS_CC))) { - RETURN_FALSE; - } - - RETURN_RESOURCE(resource); -} -/* }}} */ - -/* {{{ proto string crack_closedict([int link_identifier]) - Closes an open cracklib dictionary */ -ZEND_FUNCTION(crack_closedict) -{ - PWDICT *pwdict; - zval **dictionary; - long id; - - switch (ZEND_NUM_ARGS()) { - case 0: - id = CRACKG(current_id); - break; - case 1: - if (zend_get_parameters_ex(1, &dictionary) == FAILURE) { - WRONG_PARAM_COUNT; - } - id = Z_LVAL_PP(dictionary); - break; - default: - WRONG_PARAM_COUNT; - break; - } - - ZEND_FETCH_RESOURCE(pwdict, PWDICT *, dictionary, id, "cracklib dictionary", le_crack); - if (CRACKG(current_id) == id) { - CRACKG(current_id) = -1; - } - zend_list_delete(id); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto string crack_check([int dictionary,] string password) - Performs an obscure check with the given password */ -ZEND_FUNCTION(crack_check) -{ - zval **dictionary = NULL, **password; - char pwtrunced[STRINGSIZE]; - char *message; - PWDICT *pwdict; - long id; - - switch (ZEND_NUM_ARGS()) { - case 1: - if (zend_get_parameters_ex(1, &password) == FAILURE) { - RETURN_FALSE; - } - if (NULL != CRACKG(default_dictionary) && CRACKG(current_id) == -1) { - _crack_open_dict(CRACKG(default_dictionary) TSRMLS_CC); - } - id = CRACKG(current_id); - break; - case 2: - if (zend_get_parameters_ex(2, &dictionary, &password) == FAILURE) { - RETURN_FALSE; - } - id = -1; - break; - default: - WRONG_PARAM_COUNT; - break; - } - - ZEND_FETCH_RESOURCE(pwdict, PWDICT *, dictionary, id, "cracklib dictionary", le_crack); - convert_to_string_ex(password); - - /* Prevent buffer overflow attacks. */ - strlcpy(pwtrunced, Z_STRVAL_PP(password), sizeof(pwtrunced)); - - message = (char *)FascistLook(pwdict, pwtrunced); - - if (NULL != CRACKG(last_message)) { - efree(CRACKG(last_message)); - } - - if (NULL == message) { - CRACKG(last_message) = estrdup("strong password"); - RETURN_TRUE; - } - - CRACKG(last_message) = estrdup(message); - RETURN_FALSE; -} -/* }}} */ - -/* {{{ proto string crack_getlastmessage(void) - Returns the message from the last obscure check */ -ZEND_FUNCTION(crack_getlastmessage) -{ - if (ZEND_NUM_ARGS() != 0) { - WRONG_PARAM_COUNT; - } - - if (NULL == CRACKG(last_message)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "No obscure checks in this session"); - RETURN_FALSE; - } - - RETURN_STRING(CRACKG(last_message), 1); -} -/* }}} */ - -#endif /* HAVE_CRACK */ - - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: sw=4 ts=4 fdm=marker - * vim<600: sw=4 ts=4 - */ diff --git a/ext/crack/crack.dsp b/ext/crack/crack.dsp deleted file mode 100644 index bf0e0d9e2d..0000000000 --- a/ext/crack/crack.dsp +++ /dev/null @@ -1,114 +0,0 @@ -# Microsoft Developer Studio Project File - Name="crack" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=crack - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "crack.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "crack.mak" CFG="crack - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "crack - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "crack - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "crack - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_CRACK" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D "WIN32" /D "CRACK_EXPORTS" /D "COMPILE_DL_CRACK" /D ZTS=1 /D HAVE_CRACK=1 /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386
-# ADD LINK32 cracklib_Win32.lib wsock32.lib php4ts.lib resolv.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 /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_crack.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF "$(CFG)" == "crack - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "mssql-70" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_CRACK" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CRACK_EXPORTS" /D "COMPILE_DL_CRACK" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_CRACK=1 /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386
-# ADD LINK32 cracklib_Win32.lib php4ts_debug.lib resolv.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 /nologo /dll /incremental:yes /debug /machine:I386 /out:"..\..\Debug_TS/php_crack.dll" /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "crack - Win32 Release_TS"
-# Name "crack - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\crack.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_crack.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/ext/crack/php_crack.h b/ext/crack/php_crack.h deleted file mode 100644 index 22f0510cce..0000000000 --- a/ext/crack/php_crack.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 4 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.02 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_02.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Alexander Feldman | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - -#ifndef ZEND_CRACK_H -#define ZEND_CRACK_H - -#if HAVE_CRACK - -extern zend_module_entry crack_module_entry; -#define phpext_crack_ptr &crack_module_entry - -#ifdef ZEND_WIN32 -#define ZEND_CRACK_API __declspec(dllexport) -#else -#define ZEND_CRACK_API -#endif - -ZEND_MINIT_FUNCTION(crack); -ZEND_MSHUTDOWN_FUNCTION(crack); -ZEND_RINIT_FUNCTION(crack); -ZEND_RSHUTDOWN_FUNCTION(crack); -PHP_MINFO_FUNCTION(crack); - -ZEND_FUNCTION(crack_opendict); -ZEND_FUNCTION(crack_closedict); -ZEND_FUNCTION(crack_check); -ZEND_FUNCTION(crack_getlastmessage); - -ZEND_BEGIN_MODULE_GLOBALS(crack) - char *default_dictionary; - char *last_message; - long current_id; -ZEND_END_MODULE_GLOBALS(crack) - -#ifdef ZTS -#define CRACKG(v) TSRMG(crack_globals_id, zend_crack_globals *, v) -#else -#define CRACKG(v) (crack_globals.v) -#endif - -#else - -#define phpext_crack_ptr NULL - -#endif - -#endif /* ZEND_CRACK_H */ - - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ diff --git a/ext/crack/tests/001.phpt b/ext/crack/tests/001.phpt deleted file mode 100644 index dc18ef5559..0000000000 --- a/ext/crack/tests/001.phpt +++ /dev/null @@ -1,23 +0,0 @@ ---TEST-- -Check for crack presence ---SKIPIF-- -<?php if (!extension_loaded("crack")) print "skip"; ?> ---POST-- ---GET-- ---FILE-- -<?php -echo "crack extension is available"; -/* - you can add regression tests for your extension here - - the output of your test code has to be equal to the - text in the --EXPECT-- section below for the tests - to pass, differences between the output and the - expected text are interpreted as failure - - see php4/tests/README for further information on - writing regression tests -*/ -?> ---EXPECT-- -crack extension is available
\ No newline at end of file |