1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-09 08:58:35 +03:00

Allow hosts allow/deny to use xx.xx.xx.xx/yy syntax.

Jeremy.
(This used to be commit ea60c50109462b35825be1dd3cc6b28f739a1b59)
This commit is contained in:
Jeremy Allison 2002-03-27 01:56:31 +00:00
parent 752324ee1a
commit 0d87fb91c4

View File

@ -12,6 +12,8 @@
#define FAIL (-1)
#define ALLONES ((uint32)0xFFFFFFFF)
/* masked_match - match address against netnumber/netmask */
static int masked_match(char *tok, char *slash, char *s)
{
@ -24,8 +26,14 @@ static int masked_match(char *tok, char *slash, char *s)
*slash = 0;
net = interpret_addr(tok);
*slash = '/';
if (net == INADDR_NONE ||
(mask = interpret_addr(slash + 1)) == INADDR_NONE) {
if (strlen(slash + 1) > 2) {
mask = interpret_addr(slash + 1);
} else {
mask = (uint32)((ALLONES >> atoi(slash + 1)) ^ ALLONES);
}
if (net == INADDR_NONE || mask == INADDR_NONE) {
DEBUG(0,("access: bad net/mask access control: %s\n", tok));
return (False);
}