diff options
author | Gerald Carter <jerry@samba.org> | 2001-11-28 21:51:11 +0000 |
---|---|---|
committer | Gerald Carter <jerry@samba.org> | 2001-11-28 21:51:11 +0000 |
commit | bd8e916cb520d89a14a1cd13b2b261253729ac9b (patch) | |
tree | 3e7a728e8825d3c1acfdcbec8306c60b0bb8d724 /source3/lib | |
parent | 7d2d605f0db0c3689a263d6857721eac66a1b9c1 (diff) | |
download | samba-bd8e916cb520d89a14a1cd13b2b261253729ac9b.tar.gz samba-bd8e916cb520d89a14a1cd13b2b261253729ac9b.tar.bz2 samba-bd8e916cb520d89a14a1cd13b2b261253729ac9b.zip |
merge from APPLIANCE_HEAD
(This used to be commit c60aa6c06f376684b6d6d9a2c14305ca9f4657ef)
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/interface.c | 2 | ||||
-rw-r--r-- | source3/lib/util.c | 41 |
2 files changed, 41 insertions, 2 deletions
diff --git a/source3/lib/interface.c b/source3/lib/interface.c index a93390e643..08636fa306 100644 --- a/source3/lib/interface.c +++ b/source3/lib/interface.c @@ -21,8 +21,6 @@ #include "includes.h" -#define MAX_INTERFACES 128 - static struct iface_struct *probed_ifaces; static int total_probed; diff --git a/source3/lib/util.c b/source3/lib/util.c index 7bd2ed8441..ca99f985ed 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -1391,6 +1391,47 @@ BOOL is_myname(char *s) return(ret); } +BOOL is_myname_or_ipaddr(char *s) +{ + char **ptr; + + /* optimize for the common case */ + if (strequal(s, global_myname)) + return True; + + /* maybe its an IP address? */ + if (is_ipaddress(s)) + { + struct iface_struct nics[MAX_INTERFACES]; + int i, n; + uint32 ip; + + ip = interpret_addr(s); + if ((ip==0) || (ip==0xffffffff)) + return False; + + n = get_interfaces(nics, MAX_INTERFACES); + for (i=0; i<n; i++) { + if (ip == nics[i].ip.s_addr) + return True; + } + } + + /* check for an alias */ + ptr = lp_netbios_aliases(); + for ( ; *ptr; ptr++ ) + { + if (StrCaseCmp(s, *ptr) == 0) + return True; + } + + + /* no match */ + return False; + +} + + /******************************************************************* set the horrid remote_arch string based on an enum. ********************************************************************/ |