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 | c60aa6c06f376684b6d6d9a2c14305ca9f4657ef (patch) | |
tree | f93175c6473784c2eb4f26565d8934549e41f4d9 /source/lib | |
parent | c7dd0364f2b084d9a372ac885fd788bbb5113125 (diff) | |
download | samba-c60aa6c06f376684b6d6d9a2c14305ca9f4657ef.tar.gz samba-c60aa6c06f376684b6d6d9a2c14305ca9f4657ef.tar.xz samba-c60aa6c06f376684b6d6d9a2c14305ca9f4657ef.zip |
merge from APPLIANCE_HEAD
Diffstat (limited to 'source/lib')
-rw-r--r-- | source/lib/interface.c | 2 | ||||
-rw-r--r-- | source/lib/util.c | 41 |
2 files changed, 41 insertions, 2 deletions
diff --git a/source/lib/interface.c b/source/lib/interface.c index a93390e643c..08636fa3067 100644 --- a/source/lib/interface.c +++ b/source/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/source/lib/util.c b/source/lib/util.c index 7bd2ed8441a..ca99f985edf 100644 --- a/source/lib/util.c +++ b/source/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. ********************************************************************/ |