Match for Class C,B,A in hosts with %
Match for Class C,B,A in hosts with %
This commit is contained in:
@ -28,6 +28,8 @@
|
|||||||
* 06/02/2014 Massimiliano Pinto Mysql user root selected based on configuration flag
|
* 06/02/2014 Massimiliano Pinto Mysql user root selected based on configuration flag
|
||||||
* 26/02/2014 Massimiliano Pinto Addd: replace_mysql_users() routine may replace users' table based on a checksum
|
* 26/02/2014 Massimiliano Pinto Addd: replace_mysql_users() routine may replace users' table based on a checksum
|
||||||
* 28/02/2014 Massimiliano Pinto Added Mysql user@host authentication
|
* 28/02/2014 Massimiliano Pinto Added Mysql user@host authentication
|
||||||
|
* 29/07/2014 Massimiliano Pinto Added Mysql user@host authentication with wildcard in IPv4 hosts:
|
||||||
|
* x.y.z.%, x.y.%.%, x.%.%.%
|
||||||
*
|
*
|
||||||
* @endverbatim
|
* @endverbatim
|
||||||
*/
|
*/
|
||||||
@ -342,7 +344,7 @@ getUsers(SERVICE *service, struct users *users)
|
|||||||
} else {
|
} else {
|
||||||
char *tmp;
|
char *tmp;
|
||||||
strcpy(ret_ip, row[1]);
|
strcpy(ret_ip, row[1]);
|
||||||
tmp = ret_ip+strlen(ret_ip);
|
tmp = ret_ip+strlen(ret_ip)-1;
|
||||||
|
|
||||||
while(*tmp) {
|
while(*tmp) {
|
||||||
if (*tmp == '%') {
|
if (*tmp == '%') {
|
||||||
@ -350,16 +352,14 @@ getUsers(SERVICE *service, struct users *users)
|
|||||||
* avoiding setipadress failure
|
* avoiding setipadress failure
|
||||||
* for Class C address
|
* for Class C address
|
||||||
*/
|
*/
|
||||||
|
found_range++;
|
||||||
if (found_range == 1)
|
if (found_range == 1)
|
||||||
*tmp = '1';
|
*tmp = '1';
|
||||||
else
|
else
|
||||||
*tmp = '0';
|
*tmp = '0';
|
||||||
|
|
||||||
found_range++;
|
|
||||||
}
|
}
|
||||||
tmp--;
|
tmp--;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (setipaddress(&serv_addr.sin_addr, ret_ip)) {
|
if (setipaddress(&serv_addr.sin_addr, ret_ip)) {
|
||||||
|
|||||||
@ -31,6 +31,8 @@
|
|||||||
* localhost entry should be added for the selected user in the backends.
|
* localhost entry should be added for the selected user in the backends.
|
||||||
* Setting to 1 allow localhost (127.0.0.1 or socket) to match the any host grant via
|
* Setting to 1 allow localhost (127.0.0.1 or socket) to match the any host grant via
|
||||||
* user@%
|
* user@%
|
||||||
|
* 29/07/2014 Massimiliano Pinto Added Mysql user@host authentication with wildcard in IPv4 hosts:
|
||||||
|
* x.y.z.%, x.y.%.%, x.%.%.%
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -1382,6 +1384,8 @@ int gw_find_mysql_user_password_sha1(char *username, uint8_t *gateway_password,
|
|||||||
if (strlen(user_password))
|
if (strlen(user_password))
|
||||||
gw_hex2bin(gateway_password, user_password, SHA_DIGEST_LENGTH * 2);
|
gw_hex2bin(gateway_password, user_password, SHA_DIGEST_LENGTH * 2);
|
||||||
|
|
||||||
|
fprintf(stderr, "+++ Matched Class C for %s\n", dcb->remote);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1394,6 +1398,8 @@ int gw_find_mysql_user_password_sha1(char *username, uint8_t *gateway_password,
|
|||||||
if (strlen(user_password))
|
if (strlen(user_password))
|
||||||
gw_hex2bin(gateway_password, user_password, SHA_DIGEST_LENGTH * 2);
|
gw_hex2bin(gateway_password, user_password, SHA_DIGEST_LENGTH * 2);
|
||||||
|
|
||||||
|
fprintf(stderr, "++ Matched Class B for %s\n", dcb->remote);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1406,6 +1412,8 @@ int gw_find_mysql_user_password_sha1(char *username, uint8_t *gateway_password,
|
|||||||
if (strlen(user_password))
|
if (strlen(user_password))
|
||||||
gw_hex2bin(gateway_password, user_password, SHA_DIGEST_LENGTH * 2);
|
gw_hex2bin(gateway_password, user_password, SHA_DIGEST_LENGTH * 2);
|
||||||
|
|
||||||
|
fprintf(stderr, "+ Matched Class A for %s\n", dcb->remote);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1438,6 +1446,8 @@ int gw_find_mysql_user_password_sha1(char *username, uint8_t *gateway_password,
|
|||||||
dcb->remote)));
|
dcb->remote)));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fprintf(stderr, "%% Matched ANY for %s\n", dcb->remote);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* user@host found: now check the password
|
/* user@host found: now check the password
|
||||||
|
|||||||
Reference in New Issue
Block a user