diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e51993..41746e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ #### Version history: +###### 0.7.3 + - Add support to Valve style rcon authentication + ###### 0.7.2 - Quit gracefully when Ctrl-D or Ctrl+C is pressed - Remove "exit" and "quit" as quitting commands diff --git a/LICENSE b/LICENSE index 86bda18..e382f8b 100644 --- a/LICENSE +++ b/LICENSE @@ -18,4 +18,3 @@ freely, subject to the following restrictions: 3. This notice may not be removed or altered from any source distribution. - \ No newline at end of file diff --git a/mcrcon.1 b/mcrcon.1 index 9255407..f41d1c4 100644 --- a/mcrcon.1 +++ b/mcrcon.1 @@ -1,7 +1,7 @@ .\" Process this file with .\" groff -man -Tascii mcrcon.1 .\" -.TH MCRCON 1 "October 2021" "Version 0.7.2" +.TH MCRCON 1 "November 2024" "Version 0.7.3" .SH NAME mcrcon \- send rcon commands to a Minecraft server .SH SYNOPSIS diff --git a/mcrcon.c b/mcrcon.c index 79c8aba..c27beea 100644 --- a/mcrcon.c +++ b/mcrcon.c @@ -47,7 +47,7 @@ #include #endif -#define VERSION "0.7.2" +#define VERSION "0.7.3" #define IN_NAME "mcrcon" #define VER_STR IN_NAME" "VERSION" (built: "__DATE__" "__TIME__")" @@ -595,10 +595,18 @@ int rcon_auth(int sock, char *passwd) if (!ret) return 0; // send failed +receive: packet = net_recv_packet(sock); if (packet == NULL) return 0; + /* Valve rcon sends empty "RCON_RESPONSEVALUE" packet before real auth response + * so we have to check packet type and try again if necessary. + */ + if (packet->cmd != RCON_AUTH_RESPONSE) { + goto receive; + } + // return 1 if authentication OK return packet->id == -1 ? 0 : 1; }