diff options
author | Andrew Tridgell <tridge@samba.org> | 1998-10-04 10:46:52 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 1998-10-04 10:46:52 +0000 |
commit | 147d49dade3901835b5d60b02c495bea544ff5e9 (patch) | |
tree | e42840e7a4e63ea89359820aa329e9c24da48180 | |
parent | 7bd738c30a09a211fd14a8544309efeec17c66f5 (diff) | |
download | samba-147d49dade3901835b5d60b02c495bea544ff5e9.tar.gz samba-147d49dade3901835b5d60b02c495bea544ff5e9.tar.xz samba-147d49dade3901835b5d60b02c495bea544ff5e9.zip |
use *SMBSERVER convention in smbwrapper to allow us to connect to
servers that we don't know the netbios name of.
-rw-r--r-- | source/lib/util.c | 2 | ||||
-rw-r--r-- | source/libsmb/clientgen.c | 2 | ||||
-rw-r--r-- | source/libsmb/nmblib.c | 2 | ||||
-rw-r--r-- | source/smbwrapper/smbw.c | 12 |
4 files changed, 12 insertions, 6 deletions
diff --git a/source/lib/util.c b/source/lib/util.c index ccbaebf4ea6..c36eb8a6679 100644 --- a/source/lib/util.c +++ b/source/lib/util.c @@ -500,7 +500,7 @@ int name_mangle( char *In, char *Out, char name_type ) /* Safely copy the input string, In, into buf[]. */ (void)memset( buf, 0, 20 ); - if( '*' == In[0] ) + if (strcmp(In,"*") == 0) buf[0] = '*'; else (void)slprintf( buf, sizeof(buf) - 1, "%-15.15s%c", In, name_type ); diff --git a/source/libsmb/clientgen.c b/source/libsmb/clientgen.c index e4aa15c6eb8..20c0c361664 100644 --- a/source/libsmb/clientgen.c +++ b/source/libsmb/clientgen.c @@ -2134,7 +2134,7 @@ BOOL cli_negprot(struct cli_state *cli) send a session request. see rfc1002.txt 4.3 and 4.3.2 ****************************************************************************/ BOOL cli_session_request(struct cli_state *cli, - struct nmb_name *calling, struct nmb_name *called) + struct nmb_name *calling, struct nmb_name *called) { char *p; int len = 4; diff --git a/source/libsmb/nmblib.c b/source/libsmb/nmblib.c index d08003133f1..87f483e9fd8 100644 --- a/source/libsmb/nmblib.c +++ b/source/libsmb/nmblib.c @@ -248,7 +248,7 @@ static int put_nmb_name(char *buf,int offset,struct nmb_name *name) fstring buf1; char *p; - if (name->name[0] == '*') { + if (strcmp(name->name,"*") == 0) { /* special case for wildcard name */ bzero(buf1,20); buf1[0] = '*'; diff --git a/source/smbwrapper/smbw.c b/source/smbwrapper/smbw.c index 0abe823e299..054b694c415 100644 --- a/source/smbwrapper/smbw.c +++ b/source/smbwrapper/smbw.c @@ -360,21 +360,27 @@ struct smbw_server *smbw_server(char *server, char *share) return NULL; } + make_nmb_name(&calling, global_myname, 0x0, ""); + make_nmb_name(&called , server, 0x20, ""); + + again: /* have to open a new connection */ if (!cli_initialise(&c) || !cli_connect(&c, server, NULL)) { errno = ENOENT; return NULL; } - make_nmb_name(&calling, global_myname, 0x0, ""); - make_nmb_name(&called , server, 0x20, ""); - if (!cli_session_request(&c, &calling, &called)) { cli_shutdown(&c); + if (strcmp(called.name, "*SMBSERVER")) { + make_nmb_name(&called , "*SMBSERVER", 0x20, ""); + goto again; + } errno = ENOENT; return NULL; } + if (!cli_negprot(&c)) { cli_shutdown(&c); errno = ENOENT; |