summaryrefslogtreecommitdiff
path: root/source3/lib/util.c
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2001-11-28 21:51:11 +0000
committerGerald Carter <jerry@samba.org>2001-11-28 21:51:11 +0000
commitbd8e916cb520d89a14a1cd13b2b261253729ac9b (patch)
tree3e7a728e8825d3c1acfdcbec8306c60b0bb8d724 /source3/lib/util.c
parent7d2d605f0db0c3689a263d6857721eac66a1b9c1 (diff)
downloadsamba-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/util.c')
-rw-r--r--source3/lib/util.c41
1 files changed, 41 insertions, 0 deletions
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.
********************************************************************/