diff options
author | Andrew Bartlett <abartlet@samba.org> | 2011-06-24 16:26:23 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2011-06-24 16:26:23 +1000 |
commit | 6da26870e0ae5acd6ff49a30ec2f6886b44d095e (patch) | |
tree | 850c71039563c16a5d563c47e7ba2ab645baf198 /source3/lib/access.c | |
parent | 6925a799d04c6fa59dd2ddef1f5510f9bb7d17d1 (diff) | |
parent | 2610c05b5b95cc7036b3d6dfb894c6cfbdb68483 (diff) | |
download | samba-6da26870e0ae5acd6ff49a30ec2f6886b44d095e.tar.gz samba-6da26870e0ae5acd6ff49a30ec2f6886b44d095e.tar.xz samba-6da26870e0ae5acd6ff49a30ec2f6886b44d095e.zip |
Merge 2610c05b5b95cc7036b3d6dfb894c6cfbdb68483 as Samba-4.0alpha16samba-4.0.0alpha16
Diffstat (limited to 'source3/lib/access.c')
-rw-r--r-- | source3/lib/access.c | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/source3/lib/access.c b/source3/lib/access.c index a7475a5edc3..044c079cc5e 100644 --- a/source3/lib/access.c +++ b/source3/lib/access.c @@ -12,7 +12,7 @@ #include "includes.h" #include "memcache.h" -#include "interfaces.h" +#include "lib/socket/interfaces.h" #define NAME_INDEX 0 #define ADDR_INDEX 1 @@ -182,29 +182,32 @@ static bool string_match(const char *tok,const char *s) bool client_match(const char *tok, const void *item) { const char **client = (const char **)item; + const char *tok_addr = tok; + const char *cli_addr = client[ADDR_INDEX]; + + /* + * tok and client[ADDR_INDEX] can be an IPv4 mapped to IPv6, + * we try and match the IPv4 part of address only. + * Bug #5311 and #7383. + */ + + if (strnequal(tok_addr, "::ffff:",7)) { + tok_addr += 7; + } + + if (strnequal(cli_addr,"::ffff:",7)) { + cli_addr += 7; + } /* * Try to match the address first. If that fails, try to match the host * name if available. */ - if (string_match(tok, client[ADDR_INDEX])) { + if (string_match(tok_addr, cli_addr)) { return true; } - if (strnequal(client[ADDR_INDEX],"::ffff:",7) && - !strnequal(tok, "::ffff:",7)) { - /* client[ADDR_INDEX] is an IPv4 mapped to IPv6, but - * the list item is not. Try and match the IPv4 part of - * address only. This will happen a lot on IPv6 enabled - * systems with IPv4 allow/deny lists in smb.conf. - * Bug #5311. JRA. - */ - if (string_match(tok, (client[ADDR_INDEX])+7)) { - return true; - } - } - if (client[NAME_INDEX][0] != 0) { if (string_match(tok, client[NAME_INDEX])) { return true; |