summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-12-11 07:32:49 +0000
committerJeremy Allison <jra@samba.org>2001-12-11 07:32:49 +0000
commit0879a7647d61baf53b9f23ad08401bc858b6976b (patch)
tree8abc6a93996c723785b5a7da74973d491997ac02
parent9fb37917147f8a9f6dde3066cbce5a5690650df4 (diff)
downloadsamba-0879a7647d61baf53b9f23ad08401bc858b6976b.tar.gz
samba-0879a7647d61baf53b9f23ad08401bc858b6976b.tar.xz
samba-0879a7647d61baf53b9f23ad08401bc858b6976b.zip
Indeed. Very useful :-).
Jeremy.
-rw-r--r--source/libsmb/cliconnect.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/source/libsmb/cliconnect.c b/source/libsmb/cliconnect.c
index 6f2ccc8139c..b6e90a869de 100644
--- a/source/libsmb/cliconnect.c
+++ b/source/libsmb/cliconnect.c
@@ -732,14 +732,27 @@ BOOL cli_connect(struct cli_state *cli, const char *host, struct in_addr *ip)
{
extern struct in_addr ipzero;
extern pstring user_socket_options;
+ int name_type = 0x20;
+ char *p;
+
+ /* reasonable default hostname */
+ if (!host)
+ host = "*SMBSERVER";
fstrcpy(cli->desthost, host);
+ /* allow hostnames of the form NAME#xx and do a netbios lookup */
+ if ((p = strchr(cli->desthost, '#'))) {
+ name_type = strtol(p+1, NULL, 16);
+ *p = 0;
+ }
+
if (!ip || ip_equal(*ip, ipzero)) {
- if (!resolve_name( cli->desthost, &cli->dest_ip, 0x20)) {
- return False;
- }
- if (ip) *ip = cli->dest_ip;
+ if (!resolve_name(cli->desthost, &cli->dest_ip, name_type)) {
+ return False;
+ }
+ if (ip)
+ *ip = cli->dest_ip;
} else {
cli->dest_ip = *ip;
}