Beispiel #1
0
/**
@internalComponent
*/
TInt CTestVirusHook::VsFileDelete(TFsPluginRequest& aRequest)
	{

	TFileName fileName;
	TInt err = ValidateRequest(aRequest, fileName);
	return err;
	}
Beispiel #2
0
/**
@internalComponent
*/
TInt CTestVirusHook::VsFileOpen(TFsPluginRequest& aRequest)
	{
	TFileName fileName;
	TInt err = ValidateRequest(aRequest, fileName);
	if (err == KErrNone)
		{
		err = ScanFile(fileName);
		if (err != KErrNone)
			{
			// Clean the infected file
			CleanFile(fileName, EFileOpen);
			}
		}	

	return err;
	}
Beispiel #3
0
/**
@internalComponent
*/
TInt CTestVirusHook::VsFileRename(TFsPluginRequest& aRequest)
	{

	TInt err = VsDirRename(aRequest);
	if(err != KErrAccessDenied)
		{
		TFileName fileName;
		err = ValidateRequest(aRequest, fileName);
		if (err == KErrNone)
			{
			err = ScanFile(fileName);
			if (err != KErrNone)
				{
				// Clean the infected file
				CleanFile(fileName, EFileRename);
				}
			}
		}

	return err;
	}
Beispiel #4
0
void CProxy::RequestHandler(char *request)
{
	int	playlistpos = 0;
	char	suppliedPass[255] = "";

	char	variable[255] = "";
	char	value[255] = "";
	int		action = 0;
	int		adminFlag = 0;

	char	msg[255] = "";
	int		valid = 0;
	int		errorCode = 0;

	int	requestFlag = 0;
	if (!strncmp(request, "/request.cgi", strlen("/request.cgi"))) {
		char	*p1;
		p1 = strchr(request, '?');
		if (p1) {
			p1++;
			char	*token;
			token = strtok(p1, "&");
			while (token != NULL) {
				char	*p2;
				p2 = strchr(token, '=');
				if (p2) {
					memset(variable, '\000', sizeof(variable));
					memset(value, '\000', sizeof(value));

					int lengthtocopy = 0;
					if ((p2-token) > (sizeof(variable)-1)) {
						lengthtocopy = sizeof(variable)-1;
					}
					else {
						lengthtocopy = p2-token;
					}
					strncpy(variable, token, lengthtocopy);
					p2++;
					strncpy(value, p2, sizeof(value)-1);
					if (!strcmp(variable, "pass")) {
						strncpy(suppliedPass, value, sizeof(suppliedPass)-1);
					}
					if (!strcmp(variable, "listpos")) {
						playlistpos = atoi(value);
					}
				}
				token = strtok(NULL, "&");
			}
		}
		if (strlen(g_AdminPassword) > 0) {
			if (!strcmp(suppliedPass, g_AdminPassword)) {
					adminFlag = 1;
			}
			else {
				adminFlag = 0;
			}
		}
		requestFlag = 1;
	}

//    if (sscanf(request, "/request.cgi?listpos=%d", &playlistpos) == 1) {
	if (requestFlag) {
		if (adminFlag) {
			errorCode = REQUEST_ACCEPTED;
		}
		else {
			errorCode = ValidateRequest(playlistpos);
		}

		if (errorCode == REQUEST_ACCEPTED) {
				EnterCriticalSection(&GlobalCriticalSection_QueueList); 
				Req_Queue newQueueItem;
				newQueueItem.playlistpos = playlistpos;
				newQueueItem.requestingIP = connectedTo;

				RequestQueue.InsertAt(0, newQueueItem, 1);
				LeaveCriticalSection(&GlobalCriticalSection_QueueList);
		}
	} 

	char	location[1024] = "";
	if (strlen(m_Referrer) > 0) {
		CString  tS = m_Referrer;
		tS.Replace("action=", "actionx=");
		strcpy(m_Referrer, LPCSTR(tS));
		if (errorCode == 0) {
			_snprintf(location, sizeof(location)-1, "Location: %s", m_Referrer);
		}
		else {
			_snprintf(location, sizeof(location)-1,  "Location: %s&errorCode=%d", m_Referrer, errorCode);
		}
	}
	else {
		if (errorCode == 0) {
			_snprintf(location, sizeof(location)-1,  "Location: /playlist.cgi");
		}
		else {
			_snprintf(location, sizeof(location)-1,  "Location: /playlist.cgi?errorCode=%d", errorCode);
		}
	}
	send_headers(302, "Moved Temporarily", (char*) location, 0, -1, -1 );

}