Skip to content

Commit ca59cb7

Browse files
author
Sascha Schumann
committed
Weep out all recent commits of Yasuo.
I don't have time right now to leave in the good ones and remove only the bad ones. There are some semantical changes which I reject, because they aim at fixing a bug which is at a completely other location. Then SID does not gefined anymore properly. (This broken patch has not been sent to me at all.) Also, there were *so* many whitespace changes which already make these commits bogus.
1 parent d36ddb5 commit ca59cb7

File tree

5 files changed

+108
-183
lines changed

5 files changed

+108
-183
lines changed

ext/session/mod_files.c

+9-8
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,10 @@ static void ps_files_close(ps_files *data)
123123
}
124124
}
125125

126-
static void ps_files_open(ps_files *data, const char *key TSRMLS_DC)
126+
static void ps_files_open(ps_files *data, const char *key)
127127
{
128128
char buf[MAXPATHLEN];
129+
TSRMLS_FETCH();
129130

130131
if (data->fd < 0 || !data->lastkey || strcmp(key, data->lastkey)) {
131132
if (data->lastkey) {
@@ -136,10 +137,8 @@ static void ps_files_open(ps_files *data, const char *key TSRMLS_DC)
136137
ps_files_close(data);
137138

138139
if (!ps_files_valid_key(key) ||
139-
!ps_files_path_create(buf, sizeof(buf), data, key)) {
140-
data->fd = -1;
140+
!ps_files_path_create(buf, sizeof(buf), data, key))
141141
return;
142-
}
143142

144143
data->lastkey = estrdup(key);
145144

@@ -160,7 +159,7 @@ static void ps_files_open(ps_files *data, const char *key TSRMLS_DC)
160159
}
161160
}
162161

163-
static int ps_files_cleanup_dir(const char *dirname, int maxlifetime TSRMLS_DC)
162+
static int ps_files_cleanup_dir(const char *dirname, int maxlifetime)
164163
{
165164
DIR *dir;
166165
char dentry[sizeof(struct dirent) + MAXPATHLEN];
@@ -170,6 +169,7 @@ static int ps_files_cleanup_dir(const char *dirname, int maxlifetime TSRMLS_DC)
170169
time_t now;
171170
int nrdels = 0;
172171
size_t dirname_len;
172+
TSRMLS_FETCH();
173173

174174
dir = opendir(dirname);
175175
if (!dir) {
@@ -254,7 +254,7 @@ PS_READ_FUNC(files)
254254
struct stat sbuf;
255255
PS_FILES_DATA;
256256

257-
ps_files_open(data, key TSRMLS_CC);
257+
ps_files_open(data, key);
258258
if (data->fd < 0)
259259
return FAILURE;
260260

@@ -283,7 +283,7 @@ PS_WRITE_FUNC(files)
283283
long n;
284284
PS_FILES_DATA;
285285

286-
ps_files_open(data, key TSRMLS_CC);
286+
ps_files_open(data, key);
287287
if (data->fd < 0)
288288
return FAILURE;
289289

@@ -314,6 +314,7 @@ PS_DESTROY_FUNC(files)
314314
{
315315
char buf[MAXPATHLEN];
316316
PS_FILES_DATA;
317+
TSRMLS_FETCH();
317318

318319
if (!ps_files_path_create(buf, sizeof(buf), data, key))
319320
return FAILURE;
@@ -336,7 +337,7 @@ PS_GC_FUNC(files)
336337
an external entity (i.e. find -ctime x | xargs rm) */
337338

338339
if (data->dirdepth == 0)
339-
*nrdels = ps_files_cleanup_dir(data->basedir, maxlifetime TSRMLS_CC);
340+
*nrdels = ps_files_cleanup_dir(data->basedir, maxlifetime);
340341

341342
return SUCCESS;
342343
}

ext/session/mod_mm.c

+3-11
Original file line numberDiff line numberDiff line change
@@ -254,15 +254,11 @@ PHP_MINIT_FUNCTION(ps_mm)
254254
int ret;
255255

256256
ps_mm_instance = calloc(sizeof(*ps_mm_instance), 1);
257-
if (!ps_mm_instance) {
258-
php_error(E_WARNING,"mm session save handler cannot allocate shared memory");
257+
if (!ps_mm_instance)
259258
return FAILURE;
260-
}
261259

262-
if (!sprintf(euid,"%d", geteuid())) {
263-
php_error(E_WARNING,"mm session save handler cannot get effective UID");
260+
if (!sprintf(euid,"%d", geteuid()))
264261
return FAILURE;
265-
}
266262

267263
/* '/tmp/' + File + Module Name + Effective UID + \0 */
268264
ps_mm_path = do_alloca(5+sizeof(PS_MM_FILE)+mod_name_len+strlen(euid)+1);
@@ -279,7 +275,6 @@ PHP_MINIT_FUNCTION(ps_mm)
279275
if (ret != SUCCESS) {
280276
free(ps_mm_instance);
281277
ps_mm_instance = NULL;
282-
php_error(E_NOTICE,"mm session save handler failed to initialize. Check your save_path.");
283278
return FAILURE;
284279
}
285280

@@ -331,10 +326,7 @@ PS_READ_FUNC(mm)
331326
(*val)[sd->datalen] = '\0';
332327
ret = SUCCESS;
333328
}
334-
else {
335-
*val = estrdup("");
336-
}
337-
329+
338330
mm_unlock(data->mm);
339331

340332
return ret;

ext/session/mod_user.c

+8-7
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,11 @@ ps_module ps_mod_user = {
5151
}
5252

5353

54-
static zval *ps_call_handler(zval *func, int argc, zval **argv TSRMLS_DC)
54+
static zval *ps_call_handler(zval *func, int argc, zval **argv)
5555
{
5656
int i;
5757
zval *retval = NULL;
58+
TSRMLS_FETCH();
5859

5960
MAKE_STD_ZVAL(retval);
6061
if (call_user_function(EG(function_table), NULL, func, retval,
@@ -95,7 +96,7 @@ PS_OPEN_FUNC(user)
9596
SESS_ZVAL_STRING(save_path, args[0]);
9697
SESS_ZVAL_STRING(session_name, args[1]);
9798

98-
retval = ps_call_handler(PSF(open), 2, args TSRMLS_CC);
99+
retval = ps_call_handler(PSF(open), 2, args);
99100

100101
FINISH;
101102
}
@@ -105,7 +106,7 @@ PS_CLOSE_FUNC(user)
105106
int i;
106107
STDVARS;
107108

108-
retval = ps_call_handler(PSF(close), 0, NULL TSRMLS_CC);
109+
retval = ps_call_handler(PSF(close), 0, NULL);
109110

110111
for (i = 0; i < 6; i++)
111112
zval_ptr_dtor(&mdata->names[i]);
@@ -123,7 +124,7 @@ PS_READ_FUNC(user)
123124

124125
SESS_ZVAL_STRING(key, args[0]);
125126

126-
retval = ps_call_handler(PSF(read), 1, args TSRMLS_CC);
127+
retval = ps_call_handler(PSF(read), 1, args);
127128

128129
if (retval) {
129130
if (Z_TYPE_P(retval) == IS_STRING) {
@@ -145,7 +146,7 @@ PS_WRITE_FUNC(user)
145146
SESS_ZVAL_STRING(key, args[0]);
146147
SESS_ZVAL_STRINGN(val, vallen, args[1]);
147148

148-
retval = ps_call_handler(PSF(write), 2, args TSRMLS_CC);
149+
retval = ps_call_handler(PSF(write), 2, args);
149150

150151
FINISH;
151152
}
@@ -157,7 +158,7 @@ PS_DESTROY_FUNC(user)
157158

158159
SESS_ZVAL_STRING(key, args[0]);
159160

160-
retval = ps_call_handler(PSF(destroy), 1, args TSRMLS_CC);
161+
retval = ps_call_handler(PSF(destroy), 1, args);
161162

162163
FINISH;
163164
}
@@ -169,7 +170,7 @@ PS_GC_FUNC(user)
169170

170171
SESS_ZVAL_LONG(maxlifetime, args[0]);
171172

172-
retval = ps_call_handler(PSF(gc), 1, args TSRMLS_CC);
173+
retval = ps_call_handler(PSF(gc), 1, args);
173174

174175
FINISH;
175176
}

ext/session/php_session.h

+6-6
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@
2121

2222
#include "ext/standard/php_var.h"
2323

24-
#define PS_OPEN_ARGS void **mod_data, const char *save_path, const char *session_name TSRMLS_DC
25-
#define PS_CLOSE_ARGS void **mod_data TSRMLS_DC
26-
#define PS_READ_ARGS void **mod_data, const char *key, char **val, int *vallen TSRMLS_DC
27-
#define PS_WRITE_ARGS void **mod_data, const char *key, const char *val, const int vallen TSRMLS_DC
28-
#define PS_DESTROY_ARGS void **mod_data, const char *key TSRMLS_DC
29-
#define PS_GC_ARGS void **mod_data, int maxlifetime, int *nrdels TSRMLS_DC
24+
#define PS_OPEN_ARGS void **mod_data, const char *save_path, const char *session_name
25+
#define PS_CLOSE_ARGS void **mod_data
26+
#define PS_READ_ARGS void **mod_data, const char *key, char **val, int *vallen
27+
#define PS_WRITE_ARGS void **mod_data, const char *key, const char *val, const int vallen
28+
#define PS_DESTROY_ARGS void **mod_data, const char *key
29+
#define PS_GC_ARGS void **mod_data, int maxlifetime, int *nrdels
3030

3131
typedef struct ps_module_struct {
3232
const char *name;

0 commit comments

Comments
 (0)