From 91081a3e534ad6885bac1fae3013444f9fb2c67e Mon Sep 17 00:00:00 2001
From: Louis-Antoine <lamr@free.fr>
Date: Mon, 4 Jun 2018 22:14:01 +0200
Subject: [PATCH] Disable admin password by default

---
 src/d_main.c   | 9 ---------
 src/d_netcmd.c | 9 +++++++--
 2 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/src/d_main.c b/src/d_main.c
index fbec5f7d8d..df33987525 100644
--- a/src/d_main.c
+++ b/src/d_main.c
@@ -1051,15 +1051,6 @@ void D_SRB2Main(void)
 
 	if (M_CheckParm("-password") && M_IsNextParm())
 		D_SetPassword(M_GetNextParm());
-	else
-	{
-		size_t z;
-		char junkpw[25];
-		for (z = 0; z < 24; z++)
-			junkpw[z] = (char)(rand() & 64)+32;
-		junkpw[24] = '\0';
-		D_SetPassword(junkpw);
-	}
 
 	// add any files specified on the command line with -file wadfile
 	// to the wad list
diff --git a/src/d_netcmd.c b/src/d_netcmd.c
index 673d64fd82..876a385233 100644
--- a/src/d_netcmd.c
+++ b/src/d_netcmd.c
@@ -2656,10 +2656,12 @@ static void D_MD5PasswordPass(const UINT8 *buffer, size_t len, const char *salt,
 
 #define BASESALT "basepasswordstorage"
 static UINT8 adminpassmd5[16];
+static boolean adminpasswordset = false;
 
 void D_SetPassword(const char *pw)
 {
 	D_MD5PasswordPass((const UINT8 *)pw, strlen(pw), BASESALT, &adminpassmd5);
+	adminpasswordset = true;
 }
 
 // Remote Administration
@@ -2728,6 +2730,9 @@ static void Got_Login(UINT8 **cp, INT32 playernum)
 
 	READMEM(*cp, sentmd5, 16);
 
+	if (!adminpasswordset)
+		CONS_Printf(M_GetText("Password from %s failed (no password set).\n"), player_names[playernum]);
+
 	if (client)
 		return;
 
@@ -3951,7 +3956,7 @@ static void Command_RestartAudio_f(void)
 	I_ShutdownSound();
 	I_StartupSound();
 	I_InitMusic();
-	
+
 // These must be called or no sound and music until manually set.
 
 	I_SetSfxVolume(cv_soundvolume.value);
@@ -3959,7 +3964,7 @@ static void Command_RestartAudio_f(void)
 	I_SetMIDIMusicVolume(cv_midimusicvolume.value);
 	if (Playing()) // Gotta make sure the player is in a level
 		P_RestoreMusic(&players[consoleplayer]);
-	
+
 }
 
 /** Quits a game and returns to the title screen.
-- 
GitLab