summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2000-02-09 15:43:09 +0000
committerJeremy Allison <jra@samba.org>2000-02-09 15:43:09 +0000
commitf452de7ed622669ce203b58e5a528a0933da58ac (patch)
tree16255414069022927ab4dcd157aeb5df4253c2af /source3
parent2768aecae653929d89d7cd402d953571fe51486e (diff)
downloadsamba-f452de7ed622669ce203b58e5a528a0933da58ac.tar.gz
samba-f452de7ed622669ce203b58e5a528a0933da58ac.tar.bz2
samba-f452de7ed622669ce203b58e5a528a0933da58ac.zip
Correct for for core dump in smbpasswd with cli_errstr().
Jeremy.<F4>plit the test for NetBIOS name being *SMBSERVER. (This used to be commit 34b0e2acb050e384c132ddfb50ec84157fb430c6)
Diffstat (limited to 'source3')
-rw-r--r--source3/libsmb/clientgen.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c
index b1d8f8aa73..0b669715b9 100644
--- a/source3/libsmb/clientgen.c
+++ b/source3/libsmb/clientgen.c
@@ -2693,9 +2693,12 @@ int cli_error(struct cli_state *cli, uint8 *eclass, uint32 *num, uint32 *nt_rpc_
if (num ) *num = 0;
if (nt_rpc_error) *nt_rpc_error = 0;
- if(!cli || !cli->initialised || !cli->inbuf)
+ if(cli->initialised)
return EINVAL;
+ if(!cli->inbuf)
+ return ENOMEM;
+
flgs2 = SVAL(cli->inbuf,smb_flg2);
if (nt_rpc_error) *nt_rpc_error = cli->nt_error;
@@ -3225,7 +3228,7 @@ BOOL cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail)
****************************************************************************/
BOOL attempt_netbios_session_request(struct cli_state *cli, char *srchost, char *desthost,
- struct in_addr *pdest_ip)
+ struct in_addr *pdest_ip)
{
struct nmb_name calling, called;
@@ -3244,21 +3247,32 @@ BOOL attempt_netbios_session_request(struct cli_state *cli, char *srchost, char
if (!cli_session_request(cli, &calling, &called)) {
struct nmb_name smbservername;
+ make_nmb_name(&smbservername , "*SMBSERVER", 0x20);
+
/*
* If the name wasn't *SMBSERVER then
* try with *SMBSERVER if the first name fails.
*/
- cli_shutdown(cli);
+ if (nmb_name_equal(&called, &smbservername)) {
- make_nmb_name(&smbservername , "*SMBSERVER", 0x20);
+ /*
+ * The name used was *SMBSERVER, don't bother with another name.
+ */
+
+ DEBUG(0,("attempt_netbios_session_request: %s rejected the session for name %s \
+with error %s.\n", desthost, cli_errstr(cli) ));
+ cli_shutdown(cli);
+ return False;
+ }
+
+ cli_shutdown(cli);
- if (!nmb_name_equal(&called, &smbservername) ||
- !cli_initialise(cli) ||
+ if (!cli_initialise(cli) ||
!cli_connect(cli, desthost, pdest_ip) ||
!cli_session_request(cli, &calling, &smbservername)) {
- DEBUG(0,("attempt_netbios_session_request: %s rejected the session for name *SMBSERVER.\n",
- desthost));
+ DEBUG(0,("attempt_netbios_session_request: %s rejected the session for \
+name *SMBSERVER with error %s\n", desthost, cli_errstr(cli) ));
cli_shutdown(cli);
return False;
}