Some small changes in LAN support code.
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@5410 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
8c972c35d1
commit
e1a7d73f8d
@ -2984,17 +2984,16 @@ int parse_admin(int fd) {
|
|||||||
int lan_subnetcheck(unsigned char *p) {
|
int lan_subnetcheck(unsigned char *p) {
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
char *sbn, *msk;
|
unsigned char *sbn, *msk;
|
||||||
|
|
||||||
for(i=0; i<subnet_count; i++) {
|
for(i=0; i<subnet_count; i++) {
|
||||||
|
|
||||||
printf("%ld - %ld - %ld", subnet[i].subnet, subnet[i].mask, (long)p);
|
|
||||||
if((subnet[i].subnet & subnet[i].mask) == ((long)p & subnet[i].mask)) {
|
if((subnet[i].subnet & subnet[i].mask) == ((long)p & subnet[i].mask)) {
|
||||||
|
|
||||||
sbn = (char *)&subnet[i].subnet;
|
sbn = (char *)&subnet[i].subnet;
|
||||||
msk = (char *)&subnet[i].mask;
|
msk = (char *)&subnet[i].mask;
|
||||||
|
|
||||||
ShowMessage("Subnet check result: "CL_CYAN"%d.%d.%d.%d/%d.%d.%d.%d"CL_RESET"\n",
|
ShowMessage("Subnet check result: "CL_CYAN"%u.%u.%u.%u/%u.%u.%u.%u"CL_RESET"\n",
|
||||||
sbn[0], sbn[1], sbn[2], sbn[3], msk[0], msk[1], msk[2], msk[3]);
|
sbn[0], sbn[1], sbn[2], sbn[3], msk[0], msk[1], msk[2], msk[3]);
|
||||||
|
|
||||||
return subnet[i].char_ip;
|
return subnet[i].char_ip;
|
||||||
@ -3466,6 +3465,7 @@ int config_switch(const char *str) {
|
|||||||
int login_lan_config_read(const char *lancfgName) {
|
int login_lan_config_read(const char *lancfgName) {
|
||||||
|
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
int line_num = 0;
|
||||||
char line[1024], w1[64], w2[64], w3[64], w4[64], w5[64];
|
char line[1024], w1[64], w2[64], w3[64], w4[64], w5[64];
|
||||||
|
|
||||||
if((fp = fopen(lancfgName, "r")) == NULL) {
|
if((fp = fopen(lancfgName, "r")) == NULL) {
|
||||||
@ -3477,13 +3477,14 @@ int login_lan_config_read(const char *lancfgName) {
|
|||||||
|
|
||||||
while(fgets(line, sizeof(line)-1, fp)) {
|
while(fgets(line, sizeof(line)-1, fp)) {
|
||||||
|
|
||||||
if (line[0] == '/' && line[1] == '/')
|
line_num++;
|
||||||
|
if ((line[0] == '/' && line[1] == '/') || line[0] == '\n' || line[1] == '\n')
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
line[sizeof(line)-1] = '\0';
|
line[sizeof(line)-1] = '\0';
|
||||||
if(sscanf(line,"%[^:]: %[^/]/%[^:]:%[^:]:%[^\r\n]", w1, w2, w3, w4, w5) != 5) {
|
if(sscanf(line,"%[^:]: %[^/]/%[^:]:%[^:]:%[^\r\n]", w1, w2, w3, w4, w5) != 5) {
|
||||||
|
|
||||||
ShowWarning("Error syntax of configuration file %s. Line skipped.\n", lancfgName);
|
ShowWarning("Error syntax of configuration file %s in line %d.\n", lancfgName, line_num);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3510,6 +3511,7 @@ int login_lan_config_read(const char *lancfgName) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------
|
//-----------------------------------
|
||||||
// Reading general configuration file
|
// Reading general configuration file
|
||||||
//-----------------------------------
|
//-----------------------------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user