summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/lib/access.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/source3/lib/access.c b/source3/lib/access.c
index c7ca164c39..f12ee92799 100644
--- a/source3/lib/access.c
+++ b/source3/lib/access.c
@@ -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);
}