[EMAIL PROTECTED] wrote: > From: [EMAIL PROTECTED] > Operating system: Linux > PHP version: 4.0CVS-2002-01-02 > PHP Bug Type: Session related > Bug description: "mm" module for session saving uses hardcoded path > > The session saving module in ext/session uses a hardcoded > path for its session file (/tmp/mm_session). This is bad > in environments where lots of php interpreters run in > different webservers and User IDs (and different php.ini) > files. the attached patch fixes this problem and uses > session.save_path for this file. > > >
--- php4-200201021200/ext/session/mod_mm.c Tue Dec 11 16:36:29 2001 +++ php-4.1.0/ext/session/mod_mm.c Wed Jan 2 22:04:29 2002 @@ -35,7 +35,7 @@ # error mm is not thread-safe #endif -#define PS_MM_PATH "/tmp/session_mm" +#define PS_MM_FILE "session_mm" /* For php_uint32 */ #include "ext/standard/basic_functions.h" @@ -247,8 +247,18 @@ PHP_MINIT_FUNCTION(ps_mm) { + char *ps_mm_path = calloc(strlen(PS(save_path))+1+strlen(PS_MM_FILE)+1, 1); /* +Directory + '/' + File + \0 */ + ps_mm_instance = calloc(sizeof(*ps_mm_instance), 1); - if (ps_mm_initialize(ps_mm_instance, PS_MM_PATH) != SUCCESS) { + + strcpy(ps_mm_path, PS(save_path)); + + if((strlen(ps_mm_path) > 0) && (ps_mm_path[strlen(ps_mm_path)-1] != '/')) + strcat(ps_mm_path, "/"); /* Fixme Windows */ + + strcat(ps_mm_path, PS_MM_FILE); + + if (ps_mm_initialize(ps_mm_instance, ps_mm_path) != SUCCESS) { ps_mm_instance = NULL; return FAILURE; }
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]