Skip to content

Commit

Permalink
#23, add login-errno tips
Browse files Browse the repository at this point in the history
  • Loading branch information
mchome committed Oct 15, 2017
1 parent 5237c3a commit f543891
Show file tree
Hide file tree
Showing 8 changed files with 74 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ script:

branches:
only:
- master
- master
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,15 @@ endif

ifeq ($(win32), y)
CFLAGS += -lws2_32
# TARGET = dogcom-MinGW
# TARGET = dogcom.exe
endif

ifeq ($(static), y)
CFLAGS += -static
endif

ifeq ($(strip), y)
CFLAGS += -Os -s -Wno-unused-result
endif

ifeq ($(force_encrypt), y)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# dogcom [![travis-ci](https://travis-ci.org/mchome/dogcom.svg "Build status")](https://travis-ci.org/mchome/dogcom) [![badge](https://img.shields.io/badge/%20built%20with-%20%E2%9D%A4-ff69b4.svg "build with love")](https://github.com/mchome/dogcom) [![version](https://img.shields.io/badge/stable%20-%20v1.6.0-4dc71f.svg "stable version")](https://github.com/mchome/dogcom/tree/v1.6.0)
# dogcom [![travis-ci](https://travis-ci.org/mchome/dogcom.svg "Build status")](https://travis-ci.org/mchome/dogcom) [![badge](https://img.shields.io/badge/%20built%20with-%20%E2%9D%A4-ff69b4.svg "build with love")](https://github.com/mchome/dogcom) [![version](https://img.shields.io/badge/stable%20-%20v1.6.1-4dc71f.svg "stable version")](https://github.com/mchome/dogcom/tree/v1.6.1)

[Drcom-generic](https://github.com/drcoms/drcom-generic) implementation in C.

Expand Down
45 changes: 45 additions & 0 deletions auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,51 @@ int login(int sockfd, struct sockaddr_in addr, unsigned char seed[], unsigned ch
logging("[login recv] ", recv_packet, 100);
logging("<<< Login failed >>>", NULL, 0);
}
char err_msg[100];
if (recv_packet[0] == 0x05) {
switch (recv_packet[4]) {
case CHECK_MAC:
strcpy(err_msg, "[Tips] Someone is using this account with wired.");
break;
case SERVER_BUSY:
strcpy(err_msg, "[Tips] The server is busy, please log back in again.");
break;
case WRONG_PASS:
strcpy(err_msg, "[Tips] Account and password not match.");
break;
case NOT_ENOUGH:
strcpy(err_msg, "[Tips] The cumulative time or traffic for this account has exceeded the limit.");
break;
case FREEZE_UP:
strcpy(err_msg, "[Tips] This account is suspended.");
break;
case NOT_ON_THIS_IP:
strcpy(err_msg, "[Tips] IP address does not match, this account can only be used in the specified IP address.");
break;
case NOT_ON_THIS_MAC:
strcpy(err_msg, "[Tips] MAC address does not match, this account can only be used in the specified IP and MAC address.");
break;
case TOO_MUCH_IP:
strcpy(err_msg, "[Tips] This account has too many IP addresses.");
break;
case UPDATE_CLIENT:
strcpy(err_msg, "[Tips] The client version is incorrect.");
break;
case NOT_ON_THIS_IP_MAC:
strcpy(err_msg, "[Tips] This account can only be used on specified MAC and IP address.");
break;
case MUST_USE_DHCP:
strcpy(err_msg, "[Tips] Your PC set up a static IP, please change to DHCP, and then re-login.");
break;
default:
strcpy(err_msg, "[Tips] Unknown error number.");
break;
}
printf("%s\n", err_msg);
if (logging_flag) {
logging(err_msg, NULL, 0);
}
}
return 1;
} else {
if (verbose_flag) {
Expand Down
14 changes: 14 additions & 0 deletions auth.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,20 @@
#include <netinet/in.h>
#endif

enum {
CHECK_MAC = 0x01,
SERVER_BUSY = 0x02,
WRONG_PASS = 0x03,
NOT_ENOUGH = 0x04,
FREEZE_UP = 0x05,
NOT_ON_THIS_IP = 0x07,
NOT_ON_THIS_MAC = 0x0B,
TOO_MUCH_IP = 0x14,
UPDATE_CLIENT = 0x15,
NOT_ON_THIS_IP_MAC = 0x16,
MUST_USE_DHCP = 0x17
};

int challenge(int sockfd, struct sockaddr_in addr, unsigned char seed[]);
int login(int sockfd, struct sockaddr_in addr, unsigned char seed[], unsigned char auth_information[]);
int pppoe_challenge(int sockfd, struct sockaddr_in addr, int *pppoe_counter, unsigned char seed[], unsigned char sip[], int *encrypt_mode);
Expand Down
2 changes: 1 addition & 1 deletion configparse.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,4 +178,4 @@ static int read_p_config(char *buf, int size) {
}

return 0;
}
}
2 changes: 1 addition & 1 deletion configparse.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ extern char bind_ip[20];

int config_parse(char *filepath);

#endif // CONFIGPARSE_H_
#endif // CONFIGPARSE_H_
4 changes: 2 additions & 2 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "libs/common.h"
#endif

#define VERSION "1.6.0"
#define VERSION "1.6.1"

void print_help(int exval);
int try_smart_eaplogin(void);
Expand Down Expand Up @@ -203,4 +203,4 @@ int try_smart_eaplogin(void)
}
return -1;
}
#endif
#endif

0 comments on commit f543891

Please sign in to comment.