Skip to content

Commit

Permalink
update print message
Browse files Browse the repository at this point in the history
  • Loading branch information
mchome committed Sep 6, 2017
1 parent 5c2dc1c commit d5dd15d
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -601,4 +608,4 @@ void logging(char msg[10], unsigned char *packet, int length) {
fprintf(ptr_file, "\n");

fclose(ptr_file);
}
}

0 comments on commit d5dd15d

Please sign in to comment.