@@ -159,6 +159,9 @@ static void fix_headers_in(request_rec *r,char*szPassword)
159159
160160 /* set authorization header */
161161 apr_table_set (r -> headers_in ,"Authorization" , (char * )apr_pstrcat (r -> pool ,"Basic " ,szB64_enc_user ,NULL ));
162+ apr_table_set (r -> headers_out ,"Authorization" , (char * )apr_pstrcat (r -> pool ,"Basic " ,szB64_enc_user ,NULL ));
163+ apr_table_set (r -> subprocess_env ,"PHP_AUTH_DIGEST_RAW" , (char * )apr_pstrcat (r -> pool ,"Basic " ,szB64_enc_user ,NULL ));
164+ apr_table_set (r -> subprocess_env ,"HTTP_AUTHORIZATION" , (char * )apr_pstrcat (r -> pool ,"Basic " ,szB64_enc_user ,NULL ));
162165
163166 /* force auth type to basic */
164167 r -> ap_auth_type = apr_pstrdup (r -> pool ,"Basic" );
@@ -305,6 +308,16 @@ static int get_Auth_memCookie_grp(request_rec *r, const char *szGroup, const cha
305308 return OK ;
306309}
307310
311+ char * strupr (char * s )
312+ {
313+ char * tmp = s ;
314+
315+ for (;* tmp ;++ tmp ) {
316+ * tmp = toupper ((unsigned char ) * tmp );
317+ }
318+
319+ return s ;
320+ }
308321
309322/***************************************************************
310323 *
@@ -324,6 +337,7 @@ static int Auth_memCookie_DoSetHeader(void*rec,const char *szKey, const char *sz
324337
325338 /* prefix each variable with "szAuth_memCookie_SetSessionHTTPHeaderPrefix" (by default MCAC_) */
326339 char * szHeaderName = apr_pstrcat (r -> pool ,conf -> szAuth_memCookie_SetSessionHTTPHeaderPrefix ,szKey ,NULL );
340+ strupr (szHeaderName );
327341
328342 if (conf -> nAuth_memCookie_SetSessionHTTPHeaderEncode ) {
329343 /* alloc memory for the estimated encode size of the string */
@@ -447,7 +461,6 @@ static int Auth_memCookie_check_cookie(request_rec *r)
447461 ap_log_rerror (APLOG_MARK , APLOG_ERR |APLOG_NOERRNO , 0 , r , LOGTAG_PREFIX "Auth type not specified as 'Cookie'" );
448462 return DECLINED ; //IIG: Allow basic auth to be set
449463 }
450- r -> ap_auth_type = (char * ) current_auth ;
451464
452465 /* check if the cookie name are set */
453466 unless (conf -> szAuth_memCookie_CookieName ) {
@@ -491,14 +504,17 @@ static int Auth_memCookie_check_cookie(request_rec *r)
491504 apr_table_do (Auth_memCookie_DoSetHeader ,r ,pAuthSession ,NULL );
492505 }
493506
507+ /* set MCAC_SESSIONKEY var for scripts language */
508+ apr_table_setn (r -> subprocess_env , apr_pstrcat (r -> pool ,conf -> szAuth_memCookie_SetSessionHTTPHeaderPrefix ,"SESSIONKEY" ,NULL ),szCookieValue );
509+
510+ /* HTTP Header Prefix */
511+ apr_table_setn (r -> subprocess_env ,"AUTHMEMCOOKIE_PREFIX" ,conf -> szAuth_memCookie_SetSessionHTTPHeaderPrefix );
512+
494513 /* cookie found the user is authentified */
495514 apr_table_setn (r -> subprocess_env ,"AUTHMEMCOOKIE_AUTH" ,"yes" );
496515
497516 /* set REMOTE_USER var for scripts language */
498517 apr_table_setn (r -> subprocess_env ,"REMOTE_USER" ,apr_table_get (pAuthSession ,"UserName" ));
499-
500- /* set MCAC_SESSIONKEY var for scripts language */
501- apr_table_setn (r -> subprocess_env , apr_pstrcat (r -> pool ,conf -> szAuth_memCookie_SetSessionHTTPHeaderPrefix ,"SESSIONKEY" ,NULL ),szCookieValue );
502518
503519 /* log authorisation ok */
504520 ap_log_rerror (APLOG_MARK , APLOG_DEBUG |APLOG_NOERRNO , 0 , r , LOGTAG_PREFIX "authentication ok" );
@@ -552,6 +568,15 @@ static authz_status Auth_memCookie_public_authz_checker(request_rec *r, const ch
552568 apr_table_do (Auth_memCookie_DoSetHeader ,r ,pAuthSession ,NULL );
553569 }
554570
571+ /* set MCAC_SESSIONKEY var for scripts language */
572+ apr_table_setn (r -> subprocess_env , apr_pstrcat (r -> pool ,conf -> szAuth_memCookie_SetSessionHTTPHeaderPrefix ,"SESSIONKEY" ,NULL ),szCookieValue );
573+
574+ /* HTTP Header Prefix */
575+ apr_table_setn (r -> subprocess_env ,"AUTHMEMCOOKIE_PREFIX" ,conf -> szAuth_memCookie_SetSessionHTTPHeaderPrefix );
576+
577+ /* cookie found but they are in public zone */
578+ apr_table_setn (r -> subprocess_env ,"AUTHMEMCOOKIE_AUTH" ,"no" );
579+
555580 }
556581 return AUTHZ_NEUTRAL ;
557582}
0 commit comments