summaryrefslogtreecommitdiff
path: root/source3/libsmb/namequery.c
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1999-11-26 23:04:19 +0000
committerLuke Leighton <lkcl@samba.org>1999-11-26 23:04:19 +0000
commit9b683054751866af4fb2ac79c092392e31effaff (patch)
treee9648db6efbff69ff731c1df466f59fd21cc853e /source3/libsmb/namequery.c
parent5e3bc7875656362770b0c9a2a45d2f83c985c6e5 (diff)
downloadsamba-9b683054751866af4fb2ac79c092392e31effaff.tar.gz
samba-9b683054751866af4fb2ac79c092392e31effaff.tar.bz2
samba-9b683054751866af4fb2ac79c092392e31effaff.zip
whoa. _major_ restructure of rpcclient. fixed some buuugs, created a few.
found out that getopt() _must_ have optind set to 0 before reuse. still haven't decided what to do with the net* api yet... (This used to be commit 29c480085e786905bfd92ea3cd93658f94e96e47)
Diffstat (limited to 'source3/libsmb/namequery.c')
-rw-r--r--source3/libsmb/namequery.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c
index 149b977746..114f656d8c 100644
--- a/source3/libsmb/namequery.c
+++ b/source3/libsmb/namequery.c
@@ -23,6 +23,7 @@
#include "includes.h"
extern pstring scope;
+extern pstring global_myname;
extern int DEBUGLEVEL;
/* nmbd.c sets this to True. */
@@ -646,7 +647,30 @@ BOOL resolve_name(const char *name, struct in_addr *return_ip, int name_type)
return False;
}
+/********************************************************
+ resolve a name of format \\server_name or \\ipaddress
+ into a name. also, cut the \\ from the front for us.
+*********************************************************/
+BOOL resolve_srv_name(const char* srv_name, fstring dest_host,
+ struct in_addr *ip)
+{
+ DEBUG(10,("resolve_srv_name: %s\n", srv_name));
+ if (srv_name == NULL || strequal("\\\\.", srv_name))
+ {
+ fstrcpy(dest_host, global_myname);
+ ip = interpret_addr2("127.0.0.1");
+ return True;
+ }
+
+ if (!strnequal("\\\\", srv_name, 2))
+ {
+ return False;
+ }
+
+ fstrcpy(dest_host, &srv_name[2]);
+ return resolve_name(dest_host, ip, 0x20);
+}
/********************************************************
find the IP address of the master browser or DMB for a workgroup