|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-06-09 09:42 UTC] pablo_sole at myp dot net dot ar
testing the new session_regenerate_id i see that after upgrade de SID, not unlink the old session file so, when you regenerate many times the session could be used to make a DoS, or at least is not what it's expected from the function. Checking the source code, the routine free the SID and assign the new, but not unlink the old file (just like in the php_session_destroy routine). A workaround could be unlink manualy on the fly, or patch the session.c file. Sorry my poor english, but is not my native language. Any question, mail me. pablo. PD: I not have any "specific setup" or extra modules compiled in, and for that reason i don't put it here. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Nov 07 11:00:01 2025 UTC |
Don't know if this works on PHP 4, but this is what I did to get session_regenerate_id to delete the old session file in PHP 5. Replace the session_regenerate_id function in session.c with this function I modded: PHP_FUNCTION(session_regenerate_id) { char *oldID = empty_string; if (PS(session_status) == php_session_active) { if (PS(id)) { oldID = PS(id); //save old id efree(PS(id)); } PS(id) = PS(mod)->s_create_sid(&PS(mod_data), NULL TSRMLS_CC); php_session_reset_id(TSRMLS_C); if (oldID != empty_string) PS(mod)->s_destroy(&PS(mod_data), oldID TSRMLS_CC); //delete old session file RETURN_TRUE; } RETURN_FALSE; }