From d5dd15d43caa7653bf157bd704acae88cf216ebf Mon Sep 17 00:00:00 2001 From: mchome <280604399@qq.com> Date: Wed, 6 Sep 2017 13:46:35 +0800 Subject: [PATCH] update print message --- auth.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/auth.c b/auth.c index e5aa51a..8da8314 100644 --- a/auth.c +++ b/auth.c @@ -228,18 +228,25 @@ int login(int sockfd, struct sockaddr_in addr, unsigned char seed[], unsigned ch return 1; } - if (verbose_flag) { - print_packet("[login recv] ", recv_packet, 100); - printf("<<< Logged in >>>\n"); - } - if (logging_flag) { - logging("[login recv] ", recv_packet, 100); - logging("<<< Logged in >>>", NULL, 0); - } - if (recv_packet[0] != 0x04) { - printf("<<< login failed >>>\n"); + if (verbose_flag) { + print_packet("[login recv] ", recv_packet, 100); + } + printf("<<< Login failed >>>\n"); + if (logging_flag) { + logging("[login recv] ", recv_packet, 100); + logging("<<< Login failed >>>", NULL, 0); + } return 1; + } else { + if (verbose_flag) { + print_packet("[login recv] ", recv_packet, 100); + } + printf("<<< Logged in >>>\n"); + if (logging_flag) { + logging("[login recv] ", recv_packet, 100); + logging("<<< Logged in >>>", NULL, 0); + } } memcpy(auth_information, &recv_packet[23], 16); @@ -601,4 +608,4 @@ void logging(char msg[10], unsigned char *packet, int length) { fprintf(ptr_file, "\n"); fclose(ptr_file); -} +} \ No newline at end of file