#include <packer.h>
+extern char * FascistLook(PWDICT *pwp, char *instring);
+extern int PWClose(PWDICT *pwp);
+
ZEND_DECLARE_MODULE_GLOBALS(crack)
/* True global resources - no need for thread safety here */
long resource;
if (CRACKG(current_id) != -1) {
- zend_error(E_WARNING, "Can not use more than one open dictionary with this implementation of libcrack");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can not use more than one open dictionary with this implementation of libcrack");
return -1;
}
+
+ if ((PG(safe_mode) && (!php_checkuid(dictpath, NULL, CHECKUID_CHECK_FILE_AND_DIR))) || php_check_open_basedir(dictpath TSRMLS_CC)) {
+ return -1;
+ }
+
if (NULL == (pwdict = PWOpen(dictpath, "r"))) {
- zend_error(E_WARNING, "Unable to open a crack dictionary");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to open a crack dictionary");
return -1;
}
if (-1 == (resource = _crack_open_dict(Z_STRVAL_PP(dictpath) TSRMLS_CC))) {
RETURN_FALSE;
}
-
+
RETURN_RESOURCE(resource);
}
/* }}} */
break;
}
+ if (id < 1) {
+ RETURN_FALSE;
+ }
+
ZEND_FETCH_RESOURCE(pwdict, PWDICT *, dictionary, id, "cracklib dictionary", le_crack);
if (CRACKG(current_id) == id) {
CRACKG(current_id) = -1;
if (zend_get_parameters_ex(2, &dictionary, &password) == FAILURE) {
RETURN_FALSE;
}
- id = -1;
break;
default:
WRONG_PARAM_COUNT;
}
if (NULL == CRACKG(last_message)) {
- zend_error(E_WARNING, "No obscure checks in this session");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "No obscure checks in this session");
RETURN_FALSE;
}