]> granicus.if.org Git - curl/commitdiff
smb: Don't try to connect with empty credentials
authorSteve Holme <steve_holme@hotmail.com>
Tue, 2 Dec 2014 21:04:23 +0000 (21:04 +0000)
committerSteve Holme <steve_holme@hotmail.com>
Tue, 2 Dec 2014 21:04:23 +0000 (21:04 +0000)
On some platforms curl would crash if no credentials were used. As such
added detection of such a use case to prevent this from happening.

Reported-by: Gisle Vanem
lib/smb.c

index 326b231c61dcff03758dae9467e98cc63502ea11..d990a892f62e744e7256ae50d5c70d46ba8007cd 100644 (file)
--- a/lib/smb.c
+++ b/lib/smb.c
@@ -216,6 +216,10 @@ static CURLcode smb_connect(struct connectdata *conn, bool *done)
 
   (void) done;
 
+  /* Check we have a username and password to authenticate with */
+  if(!conn->bits.user_passwd)
+    return CURLE_LOGIN_DENIED;
+
   /* Initialize the connection state */
   memset(smbc, 0, sizeof(*smbc));
   smbc->state = SMB_CONNECTING;