summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorZeev Suraski <zeev@php.net>1999-06-06 19:53:59 +0000
committerZeev Suraski <zeev@php.net>1999-06-06 19:53:59 +0000
commit34b3dc9b470946bc35d8a33e49a6d8d8ab74c3f1 (patch)
treeb7690d1e59126829ac9f407675f537f2bf7aee93 /ext
parent82806ea2544efef60be82bbe6051d35b932bed34 (diff)
downloadphp-git-34b3dc9b470946bc35d8a33e49a6d8d8ab74c3f1.tar.gz
- Fix PSLS issues
- Add a standard info function for the session module (use them!) - Replace PATH_MAX with MAXPATHLEN (that's our platform indepedent constant)
Diffstat (limited to 'ext')
-rw-r--r--ext/session/mod_files.c10
-rw-r--r--ext/session/session.c28
2 files changed, 25 insertions, 13 deletions
diff --git a/ext/session/mod_files.c b/ext/session/mod_files.c
index 9ec9ef6998..6d998827c1 100644
--- a/ext/session/mod_files.c
+++ b/ext/session/mod_files.c
@@ -42,10 +42,12 @@ typedef struct {
char *basedir;
} ps_files;
+
ps_module ps_mod_files = {
PS_MOD(files)
};
+
#define PS_FILES_DATA ps_files *data = *mod_data
PS_OPEN_FUNC(files)
@@ -76,7 +78,7 @@ PS_CLOSE_FUNC(files)
static void _ps_files_open(ps_files *data, const char *key)
{
- char buf[PATH_MAX];
+ char buf[MAXPATHLEN];
if(data->fd < 0 || !data->lastkey || strcmp(key, data->lastkey)) {
if(data->lastkey) efree(data->lastkey);
@@ -84,7 +86,7 @@ static void _ps_files_open(ps_files *data, const char *key)
data->lastkey = estrdup(key);
- snprintf(buf, PATH_MAX, "%s/%s", data->basedir, key);
+ snprintf(buf, MAXPATHLEN, "%s/%s", data->basedir, key);
data->fd = open(buf, O_CREAT | O_RDWR, 0600);
if(data->fd > -1) {
flock(data->fd, LOCK_EX);
@@ -137,10 +139,10 @@ PS_WRITE_FUNC(files)
PS_DELETE_FUNC(files)
{
- char buf[PATH_MAX];
+ char buf[MAXPATHLEN];
PS_FILES_DATA;
- snprintf(buf, PATH_MAX, "%s/%s", data->basedir, key);
+ snprintf(buf, MAXPATHLEN, "%s/%s", data->basedir, key);
unlink(buf);
return SUCCESS;
diff --git a/ext/session/session.c b/ext/session/session.c
index 2d5bf0cdac..3895c26b4e 100644
--- a/ext/session/session.c
+++ b/ext/session/session.c
@@ -38,15 +38,17 @@
*/
#if !(WIN32|WINNT)
#include <sys/time.h>
+#else
+#include "win32/time.h"
#endif
#include "php.h"
#include "php_ini.h"
#include "SAPI.h"
-
#include "php_session.h"
-#include "../standard/md5.h"
+#include "ext/standard/md5.h"
+#include "ext/standard/php3_var.h"
#ifdef ZTS
@@ -77,17 +79,19 @@ PHP_INI_BEGIN()
PHP_INI_ENTRY("session_auto_start", "0", PHP_INI_ALL, NULL)
PHP_INI_END()
+
static int php_minit_session(INIT_FUNC_ARGS);
static int php_rinit_session(INIT_FUNC_ARGS);
static int php_mshutdown_session(SHUTDOWN_FUNC_ARGS);
static int php_rshutdown_session(SHUTDOWN_FUNC_ARGS);
+static void php_info_isapi(ZEND_MODULE_INFO_FUNC_ARGS);
zend_module_entry session_module_entry = {
"session",
session_functions,
php_minit_session, php_mshutdown_session,
php_rinit_session, php_rshutdown_session,
- NULL,
+ php_info_isapi,
STANDARD_MODULE_PROPERTIES,
};
@@ -279,8 +283,6 @@ static void _php_session_start(PSLS_D)
{
pval **ppid;
int send_cookie = 1;
- char *session_data;
- int datalen;
ELS_FETCH();
if(!PS(id) &&
@@ -347,7 +349,7 @@ PHP_FUNCTION(session_module_name)
ps_module *tempmod;
convert_to_string(p_name);
- tempmod = _php_find_ps_module(p_name->value.str.val);
+ tempmod = _php_find_ps_module(p_name->value.str.val PSLS_CC);
if(tempmod) {
if(PS(mod_data))
PS(mod)->close(&PS(mod_data));
@@ -458,6 +460,7 @@ PHP_FUNCTION(session_encode)
{
int len;
char *enc;
+ PSLS_FETCH();
enc = _php_session_encode(&len PSLS_CC);
RETVAL_STRINGL(enc, len, 0);
@@ -469,6 +472,7 @@ PHP_FUNCTION(session_encode)
PHP_FUNCTION(session_decode)
{
pval *str;
+ PSLS_FETCH();
if(ARG_COUNT(ht) != 1 || getParameters(ht, 1, &str) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -490,7 +494,7 @@ PHP_FUNCTION(session_start)
void php_rinit_globals(PSLS_D)
{
- PS(mod) = _php_find_ps_module(INI_STR("session_module_name"));
+ PS(mod) = _php_find_ps_module(INI_STR("session_module_name") PSLS_CC);
zend_hash_init(&PS(vars), 0, NULL, NULL, 0);
PS(save_path) = estrdup(INI_STR("session_save_path"));
@@ -517,7 +521,7 @@ int php_rinit_session(INIT_FUNC_ARGS)
php_rinit_globals(PSLS_C);
if(INI_INT("session_auto_start")) {
- _php_session_start();
+ _php_session_start(PSLS_C);
}
if(PS(mod) == NULL)
return FAILURE;
@@ -530,7 +534,7 @@ int php_rshutdown_session(SHUTDOWN_FUNC_ARGS)
PSLS_FETCH();
if(PS(nr_open_sessions) > 0) {
- _php_session_save_current_state();
+ _php_session_save_current_state(PSLS_C);
}
php_rshutdown_globals(PSLS_C);
return SUCCESS;
@@ -550,3 +554,9 @@ int php_mshutdown_session(SHUTDOWN_FUNC_ARGS)
UNREGISTER_INI_ENTRIES();
return SUCCESS;
}
+
+
+static void php_info_isapi(ZEND_MODULE_INFO_FUNC_ARGS)
+{
+ DISPLAY_INI_ENTRIES();
+}