38
38
#define ISAPI_SERVER_VAR_BUF_SIZE 1024
39
39
#define ISAPI_POST_DATA_BUF 1024
40
40
41
- int IWasLoaded = 0 ;
41
+ static int isapi_globals_id = -1 ;
42
42
43
43
static char * isapi_server_variables [] = {
44
44
"ALL_HTTP" ,
@@ -392,8 +392,15 @@ static sapi_module_struct sapi_module = {
392
392
};
393
393
394
394
395
+ typedef struct _php_isapi_globals {
396
+ char * auth_user ;
397
+ char * auth_password ;
398
+ } php_isapi_globals ;
399
+
400
+
395
401
BOOL WINAPI GetFilterVersion (PHTTP_FILTER_VERSION pFilterVersion )
396
402
{
403
+ isapi_globals_id = ts_allocate_id (sizeof (php_isapi_globals ), NULL , NULL );
397
404
pFilterVersion -> dwFilterVersion = HTTP_FILTER_REVISION ;
398
405
strcpy (pFilterVersion -> lpszFilterDesc , sapi_module .name );
399
406
pFilterVersion -> dwFlags = (SF_NOTIFY_AUTHENTICATION | SF_NOTIFY_PREPROC_HEADERS );
@@ -403,22 +410,22 @@ BOOL WINAPI GetFilterVersion(PHTTP_FILTER_VERSION pFilterVersion)
403
410
404
411
DWORD WINAPI HttpFilterProc (PHTTP_FILTER_CONTEXT pfc , DWORD notificationType , LPVOID pvNotification )
405
412
{
406
- SLS_FETCH ( );
413
+ php_isapi_globals * isapi_globals = ts_resource ( isapi_globals_id );
407
414
408
415
switch (notificationType ) {
409
416
case SF_NOTIFY_PREPROC_HEADERS :
410
- SG ( request_info ). auth_user = NULL ;
411
- SG ( request_info ). auth_password = NULL ;
417
+ isapi_globals -> auth_user = NULL ;
418
+ isapi_globals -> auth_password = NULL ;
412
419
break ;
413
420
case SF_NOTIFY_AUTHENTICATION : {
414
421
char * auth_user = ((HTTP_FILTER_AUTHENT * ) pvNotification )-> pszUser ;
415
422
char * auth_password = ((HTTP_FILTER_AUTHENT * ) pvNotification )-> pszPassword ;
416
423
417
424
if (auth_user && auth_user [0 ]) {
418
- SG ( request_info ). auth_user = estrdup (auth_user );
425
+ isapi_globals -> auth_user = estrdup (auth_user );
419
426
}
420
427
if (auth_password && auth_password [0 ]) {
421
- SG ( request_info ). auth_password = estrdup (auth_password );
428
+ isapi_globals -> auth_password = estrdup (auth_password );
422
429
}
423
430
auth_user [0 ] = 0 ;
424
431
auth_password [0 ] = 0 ;
@@ -447,6 +454,12 @@ static void init_request_info(sapi_globals_struct *sapi_globals, LPEXTENSION_CON
447
454
* path_end = '\\' ;
448
455
}
449
456
}
457
+ if (isapi_globals_id != -1 ) { /* we have valid ISAPI Filter information */
458
+ php_isapi_globals * isapi_globals = ts_resource (isapi_globals_id );
459
+
460
+ SG (request_info ).auth_user = isapi_globals -> auth_user ;
461
+ SG (request_info ).auth_password = isapi_globals -> auth_password ;
462
+ }
450
463
}
451
464
452
465
@@ -564,7 +577,6 @@ __declspec(dllexport) BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, L
564
577
if (sapi_module .startup ) {
565
578
sapi_module .startup (& sapi_module );
566
579
}
567
- IWasLoaded = 1 ;
568
580
break ;
569
581
case DLL_THREAD_ATTACH :
570
582
break ;
0 commit comments