diff options
author | Luke Leighton <lkcl@samba.org> | 1999-11-27 22:34:12 +0000 |
---|---|---|
committer | Luke Leighton <lkcl@samba.org> | 1999-11-27 22:34:12 +0000 |
commit | 9fef73c27e07dbf658681e6c1027602328ed0add (patch) | |
tree | 5ef358490d5a4d922a650a574e9b55e6fb63c04e /source3/libsmb | |
parent | 4a6761a58d5718c386c7ab4fa89c34fa08dca53b (diff) | |
download | samba-9fef73c27e07dbf658681e6c1027602328ed0add.tar.gz samba-9fef73c27e07dbf658681e6c1027602328ed0add.tar.bz2 samba-9fef73c27e07dbf658681e6c1027602328ed0add.zip |
updated \PIPE\wkssvc commands to use new abstracted connection system.
modified resolve_srv_name() to return dest host of *SMBSERVER if
server name is \\ip.add.ress.format
(This used to be commit 3204829225792974c8b20efb6ba6e24661a4f658)
Diffstat (limited to 'source3/libsmb')
-rw-r--r-- | source3/libsmb/namequery.c | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c index 114f656d8c..e774dbae15 100644 --- a/source3/libsmb/namequery.c +++ b/source3/libsmb/namequery.c @@ -589,10 +589,24 @@ static BOOL resolve_hosts(const char *name, struct in_addr *return_ip) or NetBIOS name. This uses the name switch in the smb.conf to determine the order of name resolution. *********************************************************/ -BOOL resolve_name(const char *name, struct in_addr *return_ip, int name_type) +BOOL is_ip_address(const char *name) { int i; - BOOL pure_address = True; + for (i=0; name[i]; i++) + if (!(isdigit((int)name[i]) || name[i] == '.')) + return False; + + return True; +} + +/******************************************************** + Resolve a name into an IP address. Use this function if + the string is either an IP address, DNS or host name + or NetBIOS name. This uses the name switch in the + smb.conf to determine the order of name resolution. +*********************************************************/ +BOOL resolve_name(const char *name, struct in_addr *return_ip, int name_type) +{ pstring name_resolve_list; fstring tok; char *ptr; @@ -606,12 +620,8 @@ BOOL resolve_name(const char *name, struct in_addr *return_ip, int name_type) return True; } - for (i=0; pure_address && name[i]; i++) - if (!(isdigit((int)name[i]) || name[i] == '.')) - pure_address = False; - /* if it's in the form of an IP address then get the lib to interpret it */ - if (pure_address) { + if (is_ip_address(name)) { return_ip->s_addr = inet_addr(name); return True; } @@ -654,6 +664,7 @@ BOOL resolve_name(const char *name, struct in_addr *return_ip, int name_type) BOOL resolve_srv_name(const char* srv_name, fstring dest_host, struct in_addr *ip) { + BOOL ret; DEBUG(10,("resolve_srv_name: %s\n", srv_name)); if (srv_name == NULL || strequal("\\\\.", srv_name)) @@ -669,7 +680,14 @@ BOOL resolve_srv_name(const char* srv_name, fstring dest_host, } fstrcpy(dest_host, &srv_name[2]); - return resolve_name(dest_host, ip, 0x20); + ret = resolve_name(dest_host, ip, 0x20); + + if (is_ip_address(dest_host)) + { + fstrcpy(dest_host, "*SMBSERVER"); + } + + return ret; } /******************************************************** |