Skip to content

Commit

Permalink
v1.1(release candidate 1)
Browse files Browse the repository at this point in the history
1. Fixed bug on solving request from and sending error message to a client which with version 13w41a and 13w41b.
2. Fixed bug on reading vhost name in a login request from a client which with version 12w18a - 13w39b.
3. Increased the success rate of reading vhost name in a status request from a client which with version 1.6.1 - 13w39b.
  • Loading branch information
bilintsui committed Nov 10, 2020
1 parent dd44d36 commit 0778c39
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 10 deletions.
26 changes: 22 additions & 4 deletions mcrelay.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
A component of Minecraft Relay Server.
Minecraft Relay Server, version 1.1-beta3
Minecraft Relay Server, version 1.1-rc1
Copyright (c) 2020 Bilin Tsui. All right reserved.
This is a Free Software, absolutely no warranty.
Licensed with GNU General Public License Version 3 (GNU GPL v3).
Expand All @@ -16,7 +16,7 @@
#include "mod/network.h"
#include "mod/proto_legacy.h"
#include "mod/proto_modern.h"
const char version_str[]="1.1-beta3";
const char version_str[]="1.1-rc1";
struct conf config;
char configfile[512],cwd[512],config_logfull[BUFSIZ];
unsigned short config_runmode;
Expand Down Expand Up @@ -303,6 +303,24 @@ int main(int argc, char ** argv)
int motd_version=legacy_motd_protocol_identify(inbound);
if(motd_version==PVER_M_LEGACY3)
{
unsigned char tmp[BUFSIZ];
int packlen_tmp;
int packet_should_length=0x20;
int is_host_found=0;
while(packlen_inbound<packet_should_length)
{
bzero(tmp,BUFSIZ);
packlen_tmp=recv(socket_inbound_client,tmp,BUFSIZ,MSG_DONTWAIT);
if(packlen_tmp>0)
{
packlen_inbound=datcat(inbound,packlen_inbound,tmp,packlen_tmp);
}
if((inbound[0x1F]!=0)&&(is_host_found==0))
{
is_host_found=1;
packet_should_length=packet_should_length+inbound[0x1F]*2+4;
}
}
struct p_motd_legacy inbound_info=packet_read_legacy_motd(inbound,packlen_inbound);
struct conf_map * proxyinfo=getproxyinfo(&config,inbound_info.address);
if(proxyinfo==NULL)
Expand Down Expand Up @@ -580,12 +598,12 @@ int main(int argc, char ** argv)
{
mksysmsg(0,config_logfull,config_runmode,config.loglevel,1,"src: %s:%d, ",inet_ntoa(addr_inbound_client.sin_addr),ntohs(addr_inbound_client.sin_port));
}
if(inbound_info.nextstate==1)
if(inbound[inbound[0]]==1)
{
mksysmsg(1,config_logfull,config_runmode,config.loglevel,1,"type: status, status: reject_motdrelayrestricted_13w41*\n");
packlen_rewrited=make_motd(inbound_info.version,"[Proxy] Use 13w42a or later to play!",rewrited);
}
else if(inbound_info.nextstate==2)
else if(inbound[inbound[0]]==2)
{
mksysmsg(1,config_logfull,config_runmode,config.loglevel,1,"type: login, status: reject_gamerelayrestricted_13w41*\n");
packlen_rewrited=make_kickreason("Proxy: Unsupported client, use 13w42a or later!",rewrited);
Expand Down
2 changes: 1 addition & 1 deletion mod/basic.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
A component of Minecraft Relay Server.
Minecraft Relay Server, version 1.1-beta3
Minecraft Relay Server, version 1.1-rc1
Copyright (c) 2020 Bilin Tsui. All right reserved.
This is a Free Software, absolutely no warranty.
Licensed with GNU General Public License Version 3 (GNU GPL v3).
Expand Down
2 changes: 1 addition & 1 deletion mod/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
A component of Minecraft Relay Server.
Requires: mod/basic.h, please manually include it in main source code.
Minecraft Relay Server, version 1.1-beta3
Minecraft Relay Server, version 1.1-rc1
Copyright (c) 2020 Bilin Tsui. All right reserved.
This is a Free Software, absolutely no warranty.
Licensed with GNU General Public License Version 3 (GNU GPL v3).
Expand Down
2 changes: 1 addition & 1 deletion mod/network.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
A component of Minecraft Relay Server.
Requires: mod/basic.h, please manually include it in main source code. Also require libresolv.so, use option: -lresolv in gcc compile.
Minecraft Relay Server, version 1.1-beta3
Minecraft Relay Server, version 1.1-rc1
Copyright (c) 2020 Bilin Tsui. All right reserved.
This is a Free Software, absolutely no warranty.
Licensed with GNU General Public License Version 3 (GNU GPL v3).
Expand Down
4 changes: 2 additions & 2 deletions mod/proto_legacy.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
A component of Minecraft Relay Server.
Requires: mod/basic.h, please manually include it in main source code.
Minecraft Relay Server, version 1.1-beta3
Minecraft Relay Server, version 1.1-rc1
Copyright (c) 2020 Bilin Tsui. All right reserved.
This is a Free Software, absolutely no warranty.
Licensed with GNU General Public License Version 3 (GNU GPL v3).
Expand Down Expand Up @@ -71,7 +71,7 @@ struct p_login_legacy packet_read_legacy_login(unsigned char * sourcepacket, int
{
address_length=*ptr_source;
ptr_source++;
for(recidx=0;recidx<username_length;recidx++)
for(recidx=0;recidx<address_length;recidx++)
{
result.address[recidx]=*ptr_source;
ptr_source++;
Expand Down
2 changes: 1 addition & 1 deletion mod/proto_modern.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
A component of Minecraft Relay Server.
Requires: mod/basic.h, please manually include it in main source code.
Minecraft Relay Server, version 1.1-beta3
Minecraft Relay Server, version 1.1-rc1
Copyright (c) 2020 Bilin Tsui. All right reserved.
This is a Free Software, absolutely no warranty.
Licensed with GNU General Public License Version 3 (GNU GPL v3).
Expand Down

0 comments on commit 0778c39

Please sign in to comment.