Ejemplo n.º 1
0
/*
===============
Netchan_Init

===============
*/
void Netchan_Init( int port ) {

	port &= 0xffff;
	showpackets = Cvar_RegisterBool( "showpackets", qfalse, CVAR_TEMP, "Show all sent and received packets");
	showdrop = Cvar_RegisterBool( "showdrop", qfalse, CVAR_TEMP, "Show dropped packets");
	qport = Cvar_RegisterInt( "net_qport", port, 1, 65535, CVAR_INIT, "The net_chan qport" );
}
Ejemplo n.º 2
0
__cdecl void G_RegisterCvarsCallback( ){

    g_speed = Cvar_RegisterInt("g_speed", 190, 1, 6000, 0, "Player's global movement speed is set here");
    g_disabledefcmdprefix = Cvar_RegisterBool("g_disabledefcmdprefix", qtrue, 0, "Disable the interpretation of the !-sign as command");
    g_allowConsoleSay = Cvar_RegisterBool("g_allowConsoleSay", qtrue, CVAR_ARCHIVE, "Flag whether to allow chat from ingame console");
    //g_maxclients
    *(cvar_t**)0x84bcfe8 = sv_maxclients;
}
__cdecl void G_RegisterCvarsCallback( ){

    cvar_t** tmp;

    g_speed = Cvar_RegisterInt("g_speed", 190, 1, 6000, 0, "Player's global movement speed is set here");
    g_disabledefcmdprefix = Cvar_RegisterBool("g_disabledefcmdprefix", qtrue, 0, "Disable the interpretation of the !-sign as command");
    g_allowConsoleSay = Cvar_RegisterBool("g_allowConsoleSay", qtrue, CVAR_ARCHIVE, "Flag whether to allow chat from ingame console");
    //g_maxclients
    tmp = (cvar_t**)(0x84bcfe8);
    *tmp = Cvar_RegisterInt("sv_maxclients", 32, 1, 64, CVAR_ARCHIVE,"The maximum number of clients that can connect to a server");

}
Ejemplo n.º 4
0
/*
============
Cvar_Init

Reads in all archived cvars
============
*/
void Cvar_Init (void)
{
	Cmd_AddCommand ("toggle", Cvar_Toggle_f);
	Cmd_SetCommandCompletionFunc( "toggle", Cvar_CompleteCvarName );
	Cmd_AddCommand ("togglep", Cvar_TogglePrint_f);
	Cmd_SetCommandCompletionFunc( "togglep", Cvar_CompleteCvarName );
	Cmd_AddCommand ("set", Cvar_Set_f);
	Cmd_SetCommandCompletionFunc( "set", Cvar_CompleteCvarName );
	Cmd_AddCommand ("sets", Cvar_SetS_f);
	Cmd_SetCommandCompletionFunc( "sets", Cvar_CompleteCvarName );
	Cmd_AddCommand ("seta", Cvar_SetA_f);
	Cmd_SetCommandCompletionFunc( "seta", Cvar_CompleteCvarName );
	Cmd_AddCommand ("setfromdvar", Cvar_SetFromCvar_f);
	Cmd_SetCommandCompletionFunc( "setfromdvar", Cvar_CompleteCvarName );
	Cmd_AddCommand ("setfromlocString", Cvar_SetFromLocalizedStr_f);
	Cmd_SetCommandCompletionFunc( "setfromlocString", Cvar_CompleteCvarName );
	Cmd_AddCommand ("setdvartotime", Cvar_SetToTime_f);
	Cmd_SetCommandCompletionFunc( "setdvartotime", Cvar_CompleteCvarName );
	Cmd_AddCommand ("reset", Cvar_Reset_f);
	Cmd_SetCommandCompletionFunc( "reset", Cvar_CompleteCvarName );
	Cmd_AddCommand ("setu", Cvar_SetU_f);
	Cmd_SetCommandCompletionFunc( "setu", Cvar_CompleteCvarName );
	Cmd_AddCommand ("dvarlist", Cvar_List_f);
	Cmd_AddCommand ("dvardump", Cvar_Dump_f);
	Cmd_AddCommand ("dvar_bool", Cvar_RegisterBool_f);
	Cmd_AddCommand ("dvar_int", Cvar_RegisterInt_f);
	Cmd_AddCommand ("dvar_float", Cvar_RegisterFloat_f);
	cvar_t	**tmp = (cvar_t**)(0x14078480);
	*tmp = Cvar_RegisterBool("sv_cheats", qfalse, CVAR_INIT, "Enable cheating on server");
}
Ejemplo n.º 5
0
/*
==================
CON_Init

Initialize the console input (tty mode if possible)
==================
*/
void CON_Init( void )
{
	struct termios tc;
	qboolean stdinIsATTY;
	const char* term = getenv( "TERM" );

	// If the process is backgrounded (running non interactively)
	// then SIGTTIN or SIGTOU is emitted, if not caught, turns into a SIGSTP
	signal(SIGTTIN, SIG_IGN);
	signal(SIGTTOU, SIG_IGN);

	// If SIGCONT is received, reinitialize console
	signal(SIGCONT, CON_SigCont);

	// Make stdin reads non-blocking
	fcntl(STDIN_FILENO, F_SETFL, fcntl(STDIN_FILENO, F_GETFL, 0) | O_NONBLOCK );

	stdinIsATTY = _isatty( STDIN_FILENO ) && !( term && ( !strcmp( term, "raw" ) || !strcmp( term, "dumb" ) ) );

	if (!stdinIsATTY)
	{
		Com_Printf("tty console mode disabled\n");
		ttycon_on = qfalse;
		stdin_active = qtrue;
		return;
	}

	Field_Clear(&TTY_con);
	tcgetattr (STDIN_FILENO, &TTY_tc);
	TTY_erase = TTY_tc.c_cc[VERASE];
	TTY_eof = TTY_tc.c_cc[VEOF];
	tc = TTY_tc;

	/*
	ECHO: don't echo input characters
	ICANON: enable canonical mode.  This  enables  the  special
	characters  EOF,  EOL,  EOL2, ERASE, KILL, REPRINT,
	STATUS, and WERASE, and buffers by lines.
	ISIG: when any of the characters  INTR,  QUIT,  SUSP,  or
	DSUSP are received, generate the corresponding sig­
	nal
	*/
	tc.c_lflag &= ~(ECHO | ICANON);

	/*
	ISTRIP strip off bit 8
	INPCK enable input parity checking
	*/
	tc.c_iflag &= ~(ISTRIP | INPCK);
	tc.c_cc[VMIN] = 1;
	tc.c_cc[VTIME] = 0;
	tcsetattr (STDIN_FILENO, TCSADRAIN, &tc);
	ttycon_on = qtrue;

	com_ansiColor = Cvar_RegisterBool("ttycon_ansiColor", qtrue, CVAR_ARCHIVE, "Use ansi colors for sysconsole output");
}
int OnInit(){	// Funciton called on server initiation

	//G_SayCensor_Init();
	data.maxPlayers = Plugin_GetSlotCount();
	data.maxMPM = Cvar_RegisterFloat("antispam_maxMessagesPerMinute",8,0,30,0,"Count of maximum messages a player can send in a minute. 0 disables the chat completely.");
	data.minAP = Cvar_RegisterInt("antispam_minAdminPower",50,0,100,0,"Minimum power points which disable the player. 0 means enabled for everyone.");
	data.minMD = Cvar_RegisterInt("antispam_minMessageDelay",4,0,60,0,"Ammount of time after sending a message after which the player can chat again. 0 disables the limit.");
	data.renMD = Cvar_RegisterBool("antispam_renewedMessageDelay",qfalse,0,"Do messages sent before minMessageDelay passes make the delay prolonged?");
	Antispam_Initialize();
	return 0;
}
Ejemplo n.º 7
0
void SV_RemoteCmdInit(){
    sv_rconsys = Cvar_RegisterBool("sv_rconsys", qtrue, CVAR_ARCHIVE, "Disable/enable the internal remote-command-system");
    if(!sv_rconsys->boolean) return;
    cmd_function_t *cmd;
    //Init the permission table with default values
    for(cmd = cmd_functions ; cmd ; cmd = cmd->next) cmd->minPower = 100;
    SV_RemoteCmdSetPower("cmdlist", 1);
    SV_RemoteCmdSetPower("serverinfo", 1);
    SV_RemoteCmdSetPower("systeminfo", 1);
    SV_RemoteCmdSetPower("ministatus", 1);
    svse.cmdInvoker.currentCmdPower = 100; //Set the default to 100 to prevent any blocking on local system. If a command gets remotely executed it will be set temporarely to the expected power
    //Now read the rest from file - Changed this will happen by executing nvconfig.cfg (nonvolatile config)
    svse.cmdSystemInitialized = qtrue;
}
Ejemplo n.º 8
0
void Init_CallVote(void){

	g_votedMapName = Cvar_RegisterString("g_votedMapName", "", 0, "Contains the voted mapname");
	g_votedGametype = Cvar_RegisterString("g_votedGametype", "", 0, "Contains the voted gametype");
	g_voteTime = Cvar_RegisterInt("g_voteTime", 30, 10, 90, 0, "Duration a called vote is active");
	g_voteBanTime = Cvar_RegisterInt("g_voteBanTime", 15, 1, 240, 0, "Duration a player is banned after successful votekick");
	g_voteMaxVotes = Cvar_RegisterInt("g_voteMaxVotes", 2, 1, 10, 0, "How many votes a player can call");
	g_voteVoteGametypes = Cvar_RegisterString("g_voteVoteGametypes", "", 0, "Contains a list of gametypes that are allowed to vote. Empty list = all");
	g_voteKickMinPlayers = Cvar_RegisterInt("g_voteKickMinPlayers", 5, 0, 14, 0, "How many active players are needed on server to allow calling a kickvote");
	g_voteAllowMaprotate = Cvar_RegisterBool("g_voteAllowMaprotate", qtrue, 0, "Allow calling map_rotate votes");
	g_voteAllowKick = Cvar_RegisterBool("g_voteAllowKick", qtrue, 0, "Allow calling kick votes");
	g_voteAllowGametype = Cvar_RegisterBool("g_voteAllowGametype", qtrue, 0, "Allow calling gametype votes");
	g_voteAllowMap = Cvar_RegisterInt("g_voteAllowMap", 1, 0, 2, 0, "Allow calling next map setting votes - 0=disabled, 1=only from rotation, 2=Any map");
	g_voteAllowRestart = Cvar_RegisterBool("g_voteAllowRestart", qtrue, 0, "Allow calling map restart votes");

	g_voteFlags = 0;
	g_voteFlags |= g_voteAllowRestart->boolean ? VOTEFLAGS_RESTART : 0;
	g_voteFlags |= g_voteAllowGametype->boolean ? VOTEFLAGS_GAMETYPE : 0;
	g_voteFlags |= g_voteAllowMaprotate->boolean ? VOTEFLAGS_NEXTMAP : 0;
	g_voteFlags |= g_voteAllowMap->boolean && g_voteAllowGametype->boolean ? VOTEFLAGS_TYPE : 0;
	g_voteFlags |= g_voteAllowKick->boolean ? VOTEFLAGS_KICK : 0;
	g_voteFlags |= g_voteAllowMap->integer ? VOTEFLAGS_MAP : 0;
	g_voteFlags |= g_voteAllowMap->integer == 2 ? VOTEFLAGS_ANYMAP : 0;
}
Ejemplo n.º 9
0
void SV_RemoteCmdInit(){

    sv_rconsys = Cvar_RegisterBool("sv_rconsys", qtrue, CVAR_ARCHIVE, "Disable/enable the internal remote-command-system");

    if(!sv_rconsys->boolean) return;

    //Init the permission table with default values
    Cmd_ResetPower();

    Cmd_SetPower("cmdlist", 1);
    Cmd_SetPower("serverinfo", 1);
    Cmd_SetPower("systeminfo", 1);
    Cmd_SetPower("ministatus", 1);
    Cmd_SetPower("status", 30);
    Cmd_SetPower("dumpuser", 40);
    Cmd_SetPower("kick", 35);
    Cmd_SetPower("tempban", 50);
    Cmd_SetPower("unban", 50);
    Cmd_SetPower("permban", 80);
    Cmd_SetPower("btempban", 80);
    Cmd_SetPower("bpermban", 70);
    Cmd_SetPower("map", 60);
    Cmd_SetPower("map_restart", 50);
    Cmd_SetPower("adminlist", 90);
    Cmd_SetPower("cmdpowerlist", 90);
    Cmd_SetPower("tell", 60);
    Cmd_SetPower("say", 60);
    Cmd_SetPower("screentell", 70);
    Cmd_SetPower("screensay", 70);
    Cmd_SetPower("dumpbanlist", 30);
    Cmd_SetPower("setcmdminpower", 95);
    Cmd_SetPower("setadmin", 95);
    Cmd_SetPower("unsetadmin", 95);
    Cbuf_AddText("addCommand gametype \"set g_gametype $arg; map_restart\"\n");
    Cmd_SetPower("gametype", 60);
    Cmd_SetPower("authLogin", 1);
    Cmd_SetPower("authChangePassword", 10);
    Cmd_SetPower("authSetAdmin",95);
    Cmd_SetPower("authUnsetAdmin",95);

    cmdInvoker.currentCmdPower = 100; //Set the default to 100 to prevent any blocking on local system. If a command gets remotely executed it will be set temporarely to the expected power
    //Now read the rest from file - Changed this will happen by executing nvconfig.cfg (nonvolatile config)
    cmdSystemInitialized = qtrue;
}
void Sec_Update( qboolean getbasefiles ){
    char buff[SEC_UPDATE_INITIALBUFFSIZE];
    char *ptr,*ptr2, *testfile;
	char filepathbuf[MAX_OSPATH];
    char baseurl[1024];
    char name1[256],name2[256];
    sec_file_t files, *currFile = &files;
    qboolean dlExec = qfalse;
    int len;
    char hash[128];
    long unsigned size;
	ftRequest_t* filetransferobj;
	ftRequest_t* curfileobj;
	int transret;
	mvabuf;

	
    if(!Sec_Initialized()){
	return;
    }
    
#ifdef CAN_UPDATE
    Com_Printf("\n-----------------------------\n");
    Com_Printf(" CoD4X Auto Update\n");
    Com_Printf(" Current version: %g\n",SEC_VERSION);
    Com_Printf(" Current build: %d\n",BUILD_NUMBER);
    Com_Printf(" Current type: %s\n",SEC_TYPE == 's' ? "stable      " : "experimental");
    Com_Printf("-----------------------------\n\n");

    canupdate = Cvar_RegisterBool("allowupdating", qtrue, 0, "This enables autoupdating of CoD4 server with new versions.");

    if(getbasefiles == qtrue)
    {

        Com_sprintf(buff, sizeof(buff), "http://" SEC_UPDATE_HOST SEC_UPDATE_GETGROUNDVERSION);

    }else{

        if(canupdate->boolean == qfalse)
            return;

        Com_sprintf(buff, sizeof(buff), "http://" SEC_UPDATE_HOST SEC_UPDATE_GETVERSION);
    }
#else
    if(getbasefiles == qtrue)
    {
        Com_sprintf(buff, sizeof(buff), "http://" SEC_UPDATE_HOST SEC_UPDATE_GETGROUNDVERSION);
    }else{
        return;
    }
#endif
	
	filetransferobj = FileDownloadRequest( buff );

    if(filetransferobj == NULL){
		return;
    }

	do {
		transret = FileDownloadSendReceive( filetransferobj );
		usleep(20000);
	} while (transret == 0);

    if(transret < 0)
	{
		FileDownloadFreeRequest(filetransferobj);
		return;
    }
    /* Need to catch errors */
 //   FS_WriteFile("tmp.txt", va("%d", status), 1);

    // TODO: Do something with the status?

//    FS_WriteFile("tmp2.txt", packet.header, packet.headerLength);
//    FS_WriteFile("tmp3.txt", packet.content, packet.contentLength);
    if(filetransferobj->code <= 0){
		Com_PrintError("Receiving data. Error code: %d.\n", filetransferobj->code);
		FileDownloadFreeRequest(filetransferobj);
		return;
    }
    if(filetransferobj->code == 204){
		Com_Printf("\nServer is up to date.\n\n");
		FileDownloadFreeRequest(filetransferobj);
		return;
    }
    else if(filetransferobj->code != 200){
		Com_PrintWarning("The update server's malfunction.\nStatus code: %d.\n", filetransferobj->code);
		FileDownloadFreeRequest(filetransferobj);
		return;
    }

    Com_Memset(&files, 0, sizeof(files));

    /* We need to parse filenames etc */
    ptr = Sec_StrTok((char*)(filetransferobj->recvmsg.data + filetransferobj->headerLength),"\n",42); // Yes, 42.
    if(ptr == NULL || Q_stricmpn("baseurl: ", ptr, 9))
    {
	    Com_PrintWarning("Sec_Update: Corrupt data from update server. Update aborted.\n");
		FileDownloadFreeRequest(filetransferobj);
		return;
    }
    Q_strncpyz(baseurl, ptr +9, sizeof(baseurl));

    ptr = Sec_StrTok(NULL,"\n",42); // Yes, 42 again.

	while(ptr != NULL){
		
		currFile->next = Sec_GMalloc(sec_file_t,1);
		currFile = currFile->next;
		Com_Memset(currFile,0,sizeof(sec_file_t));
		ptr2 = strchr(ptr,' ');
		if(ptr2 == NULL){
			Com_PrintWarning("Sec_Update: Corrupt data from update server. Update aborted.\nDebug:\"%s\"\n",ptr);
			FileDownloadFreeRequest(filetransferobj);
			return;
		}
		*ptr2++ = 0;
		Q_strncpyz(currFile->path,ptr,sizeof(currFile->path));
		ptr = ptr2;
		ptr2 = strchr(ptr,' ');
		if(ptr2 == NULL){
			Com_PrintWarning("Sec_Update: Corrupt data from update server. Update aborted.\nDebug:\"%s\"\n",ptr);
			FileDownloadFreeRequest(filetransferobj);
			return;
		}
		*ptr2++ = 0;
		if(!isInteger(ptr, 0)){
			Com_PrintWarning("Sec_Update: Corrupt data from update server - size is not a number. Update aborted.\nDebug:\"%s\"\n",ptr);
			FileDownloadFreeRequest(filetransferobj);
			return;
		}
		currFile->size = atoi(ptr);
		Q_strncpyz(currFile->hash,ptr2,sizeof(currFile->hash));
		Q_strncpyz(currFile->name,currFile->path, sizeof(currFile->name));
		//printf("DEBUG: File to download: link: \"%s\", name: \"%s\", size: %d, hash: \"%s\"\n\n",file.path,file.name,file.size,file.hash);

		Com_sprintf(buff, sizeof(buff), SEC_UPDATE_DOWNLOAD(baseurl, currFile->path));
		
		curfileobj = FileDownloadRequest(buff);
		if(curfileobj == NULL)
		{
			FileDownloadFreeRequest(filetransferobj);
			return;	
		}

		Com_Printf("Downloading file: \"%s\"\n\n",currFile->name);

		do {
			transret = FileDownloadSendReceive( curfileobj );
			Com_Printf("%s", FileDownloadGenerateProgress( curfileobj ));
			usleep(20000);
		} while (transret == 0);
		
		Com_Printf("\n");

		if(transret < 0)
		{
			FileDownloadFreeRequest(curfileobj);
			FileDownloadFreeRequest(filetransferobj);
			return;
		}

		Q_strncpyz(buff,currFile->name, sizeof(buff));
		Q_strcat(buff, sizeof(buff),".new");

		if(curfileobj->code != 200){
			Com_PrintError("Downloading has failed! Error code: %d. Update aborted.\n", curfileobj->code);
			FileDownloadFreeRequest(filetransferobj);
			FileDownloadFreeRequest(curfileobj);
			return;
		}

		len = FS_SV_BaseWriteFile(buff, curfileobj->recvmsg.data + curfileobj->headerLength, curfileobj->contentLength);
		if(len != curfileobj->contentLength){

			len = FS_SV_HomeWriteFile(buff, curfileobj->recvmsg.data + curfileobj->headerLength, curfileobj->contentLength);
			if(len != curfileobj->contentLength)
			{
				Com_PrintError("Opening \"%s\" for writing! Update aborted.\n",buff);
				FileDownloadFreeRequest(filetransferobj);
				FileDownloadFreeRequest(curfileobj);
				return;
			}
		}

		ptr = Sec_StrTok(NULL,"\n",42); // Yes, 42 again.

		size = sizeof(hash);
		
		if(!Sec_HashMemory(SEC_HASH_SHA256, curfileobj->recvmsg.data + curfileobj->headerLength, curfileobj->contentLength, hash, &size,qfalse)){
			Com_PrintError("Hashing the file \"%s\". Error code: %s.\nUpdate aborted.\n",currFile->name,Sec_CryptErrStr(SecCryptErr));
			FileDownloadFreeRequest(filetransferobj);
			FileDownloadFreeRequest(curfileobj);
			return;
		}

		FileDownloadFreeRequest(curfileobj);
		
		if(!Q_strncmp(hash, currFile->hash, size)){
			Com_Printf("Successfully downloaded file \"%s\".\n", currFile->name);
		}
		else{
			Com_PrintError("File \"%s\" is corrupt!\nUpdate aborted.\n",currFile->name);
			Com_DPrintf("Hash: \"%s\", correct hash: \"%s\".\n",hash,currFile->hash);
			FileDownloadFreeRequest(filetransferobj);
			return;
		}
		
	}

	FileDownloadFreeRequest(filetransferobj);

    Com_Printf("All files downloaded successfully. Applying update...\n");

    currFile = files.next;
    do{
		Com_Printf("Updating file %s...\n", currFile->name);
		Q_strncpyz(name1, currFile->name, sizeof(name1));

		Q_strcat(name1, sizeof(name1), ".old");

		Q_strncpyz(name2, currFile->name, sizeof(name2));

		Q_strcat(name2, sizeof(name2), ".new");

		testfile = FS_SV_GetFilepath(name1, filepathbuf, sizeof(filepathbuf));
		if(testfile != NULL)
		{ // Old file exists, back it up
			FS_SV_BaseRemove( name1 );
			FS_SV_HomeRemove( name1 );
			testfile = FS_SV_GetFilepath(name1, filepathbuf, sizeof(filepathbuf));
			if(testfile != NULL)
			{
				Com_PrintWarning("Couldn't remove backup file: %s\n", testfile);
			}
			if(FS_SV_HomeFileExists(name1) == qtrue)
			{
				Com_PrintError("Couldn't remove backup file from fs_homepath: %s\n", name1);
			}
		}
		// Check if an old file exists with this name
		testfile = FS_SV_GetFilepath(currFile->name, filepathbuf, sizeof(filepathbuf));
		if(testfile != NULL)
		{ // Old file exists, back it up
			FS_SV_Rename(currFile->name, name1);
		}
		testfile = FS_SV_GetFilepath(currFile->name, filepathbuf, sizeof(filepathbuf));
		// We couldn't back it up. Now we try to just delete it.
		if(testfile != NULL)
		{
			FS_SV_BaseRemove( currFile->name );
			FS_SV_HomeRemove( currFile->name );
			testfile = FS_SV_GetFilepath( currFile->name, filepathbuf, sizeof(filepathbuf) );
			if(testfile != NULL)
			{
				Com_PrintWarning("Couldn't remove file: %s\n", testfile);
			}
			if(FS_SV_HomeFileExists(currFile->name) == qtrue)
			{
				Com_PrintError("Couldn't remove file from fs_homepath: %s\n", currFile->name);
				Com_PrintError("Update has failed!\n");
				return;
			}
		}

		if(Q_strncmp(currFile->name, EXECUTABLE_NAME, 15)){
			/* This is not the executable file */
			FS_SV_Rename(name2, currFile->name);
			testfile = FS_SV_GetFilepath(currFile->name, filepathbuf, sizeof(filepathbuf));
			if(testfile == NULL)
			{
				Com_PrintError("Failed to rename file %s to %s\n", name2,currFile->name);
				Com_PrintError("Update has failed!\n");
				return;
			}
			Com_Printf("Update on file %s successfully applied.\n",currFile->name);

		}else{
			/* This is the executable file */
			testfile = FS_SV_GetFilepath(name2, filepathbuf, sizeof(filepathbuf));
			if(testfile == NULL)
			{
				Com_PrintError("Can not find file %s\n", name2);
				Com_PrintError("Update has failed!\n");
				return;
			}
			if(FS_SetPermissionsExec(name2) == qfalse)
			{
				Com_PrintError("CRITICAL ERROR: failed to change mode of the file \"%s\"! Aborting, manual installation might be required.\n", name2);
				return;
			}
			FS_RenameOSPath(Sys_ExeFile(), va("%s.dead", Sys_ExeFile()));
			FS_RemoveOSPath(va("%s.dead", Sys_ExeFile()));
			FS_RemoveOSPath(Sys_ExeFile());
			if(FS_FileExistsOSPath(Sys_ExeFile()))
			{
				Com_PrintError("Failed to delete file %s\n", Sys_ExeFile());
				Com_PrintError("Update has failed!\n");
				return;
			}
			FS_RenameOSPath(testfile, Sys_ExeFile());
			if(!FS_FileExistsOSPath(Sys_ExeFile()))
			{
				Com_PrintError("Failed to rename file %s\n", testfile);
				Com_PrintError("Update has failed! Manual reinstallation of file %s is required. This server is now broken!\n", Sys_ExeFile());
				return;
			}
			Com_Printf("Update on file %s successfully applied.\n", Sys_ExeFile());
			dlExec = qtrue;
		}
		currFile = currFile->next;

    }while(currFile != NULL);

    Sec_FreeFileStruct(files.next);
    Com_Printf("Finalizing update...\n");


    if(dlExec == qtrue)
    {
		Sys_Restart("System has been updated and will restart now.");
    }else{
        FS_Restart( 0 );
    }
}