summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2002-03-27 01:56:31 +0000
committerJeremy Allison <jra@samba.org>2002-03-27 01:56:31 +0000
commit0d87fb91c4385679a104eb9f6110acf10157c0cb (patch)
tree00ab2bd99246331a3c13c66aa5fdada0c8815db5
parent752324ee1a9f73d2de41dd76993af94f6be5a61e (diff)
downloadsamba-0d87fb91c4385679a104eb9f6110acf10157c0cb.tar.gz
samba-0d87fb91c4385679a104eb9f6110acf10157c0cb.tar.bz2
samba-0d87fb91c4385679a104eb9f6110acf10157c0cb.zip
Allow hosts allow/deny to use xx.xx.xx.xx/yy syntax.
Jeremy. (This used to be commit ea60c50109462b35825be1dd3cc6b28f739a1b59)
-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);
}