V0.93 DLL crashte nog bij SAML
User-id maar enkel loggen als hij dubbel in de header stond (API's) svn path=/FcltISAPI/trunk/; revision=20249
This commit is contained in:
@@ -4,10 +4,12 @@
|
||||
#include "tchar.h"
|
||||
#include "time.h"
|
||||
|
||||
#define FCLT_ISAPI_VERSION "0.92"
|
||||
#define FCLT_ISAPI_VERSION "0.93"
|
||||
// http://believeinmiraclesx.wordpress.com/2013/11/19/isapi-filter-set-httponly-for-mulitple-cookies/
|
||||
// http://stackoverflow.com/questions/17649213/how-to-set-multiple-cookies-in-isapi-filter
|
||||
|
||||
// TODO: Bij API's blijft er van de dubbele userid nog eentje over volgens Fiddler?
|
||||
|
||||
#define bufferSize 4096 // increase size if using many cookies
|
||||
#define FCLT_USERID "FCLT_USERID:"
|
||||
|
||||
@@ -26,7 +28,7 @@ public:
|
||||
if (strstr(szCookie, "7.0"))
|
||||
ie_version = 7;
|
||||
}
|
||||
|
||||
|
||||
clock_t GetStartTime()
|
||||
{
|
||||
return startTime;
|
||||
@@ -34,10 +36,20 @@ public:
|
||||
|
||||
void get_userid(HTTP_FILTER_CONTEXT* pFC, HTTP_FILTER_SEND_RESPONSE* pResponseInfo)
|
||||
{
|
||||
DWORD dwUserid = sizeof(userid) / sizeof(userid[0]);
|
||||
pResponseInfo->GetHeader(pFC,FCLT_USERID,userid,&dwUserid);
|
||||
CHAR uid[32];
|
||||
uid[0] = '\0';
|
||||
DWORD dwuid = sizeof(uid) / sizeof(uid[0]);
|
||||
pResponseInfo->GetHeader(pFC,FCLT_USERID, &uid, &dwuid);
|
||||
// Bij API's staat er wel eens eentje dubbel in de header
|
||||
char *next_token = NULL;
|
||||
char *token = strtok_s (uid, ",", &next_token);
|
||||
if (token != NULL)
|
||||
{
|
||||
strcpy_s(userid, token);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
clock_t startTime;
|
||||
|
||||
@@ -61,6 +73,8 @@ DWORD OnSendResponse (HTTP_FILTER_CONTEXT* pFC,
|
||||
HTTP_FILTER_SEND_RESPONSE* pResponseInfo)
|
||||
{
|
||||
CMyContext* pContext = (CMyContext *)pFC->pFilterContext;
|
||||
if (!pContext)
|
||||
return SF_STATUS_REQ_NEXT_NOTIFICATION;
|
||||
|
||||
// Hard coded cookie length (2k bytes)
|
||||
CHAR szCookie[2048];
|
||||
@@ -68,7 +82,7 @@ DWORD OnSendResponse (HTTP_FILTER_CONTEXT* pFC,
|
||||
|
||||
// Bij IE6 moeten we de cookies stuk voor stuk vervangen met SetHeader
|
||||
// Bij IE7 moeten we de cookies wissen via eenmalig SetHeader en toevoegen met AddHeader
|
||||
|
||||
|
||||
CHAR *szHeader = "Set-Cookie:";
|
||||
CHAR *szHttpOnly = "; HttpOnly";
|
||||
if (pResponseInfo->GetHeader(pFC,szHeader,szCookie,&cbCookie))
|
||||
@@ -139,6 +153,11 @@ DWORD OnLog(HTTP_FILTER_CONTEXT* pFC, PHTTP_FILTER_LOG pLog)
|
||||
{
|
||||
// OnSendResponse heeft de userid voor ons bewaard
|
||||
CMyContext* pContext = (CMyContext *)pFC->pFilterContext;
|
||||
// SF_NOTIFY_PREPROC_HEADERS schijnt niet aangeroepen te worden tijdens SAML
|
||||
// en dan was pFC->pFilterContext nog leeg
|
||||
if (!pContext)
|
||||
return SF_STATUS_REQ_NEXT_NOTIFICATION;
|
||||
|
||||
if (pContext->userid[0])
|
||||
{
|
||||
pLog->pszClientUserName = pContext->userid;
|
||||
@@ -152,7 +171,7 @@ BOOL WINAPI GetFilterVersion(
|
||||
)
|
||||
{
|
||||
pVer->dwFilterVersion = HTTP_FILTER_REVISION;
|
||||
strncpy_s( pVer->lpszFilterDesc, "FACILITOR ISAPI Filter", SF_MAX_FILTER_DESC_LEN );
|
||||
strncpy_s( pVer->lpszFilterDesc, "FCLTISAPI_" FCLT_ISAPI_VERSION, SF_MAX_FILTER_DESC_LEN );
|
||||
|
||||
/* Notify me when headers have been processed */
|
||||
pVer->dwFlags = SF_NOTIFY_ORDER_DEFAULT |
|
||||
@@ -171,7 +190,6 @@ DWORD WINAPI HttpFilterProc(
|
||||
|
||||
DWORD dwRet = SF_STATUS_REQ_NEXT_NOTIFICATION;
|
||||
|
||||
CMyContext* pContext = NULL;
|
||||
switch (dwNotificationType)
|
||||
{
|
||||
case SF_NOTIFY_PREPROC_HEADERS:
|
||||
@@ -192,7 +210,7 @@ DWORD WINAPI HttpFilterProc(
|
||||
break;
|
||||
case SF_NOTIFY_END_OF_REQUEST:
|
||||
// time = clock() - pContext->GetStartTime();
|
||||
|
||||
|
||||
//
|
||||
// pContext wordt vanzelf opgeruimd
|
||||
//
|
||||
|
||||
@@ -175,6 +175,7 @@
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
ModuleDefinitionFile=".\fcltisapi.def"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile=".\Release/fcltisapi.pdb"
|
||||
SubSystem="2"
|
||||
ImportLibrary=".\Release/fcltisapi.lib"
|
||||
|
||||
Reference in New Issue
Block a user