aboutsummaryrefslogtreecommitdiff
path: root/lib/smb.c
diff options
context:
space:
mode:
authorSteve Holme <steve_holme@hotmail.com>2014-12-06 20:46:54 +0000
committerSteve Holme <steve_holme@hotmail.com>2014-12-06 20:56:59 +0000
commit864f17d894d0e4d2d790613d42ca5c89aad5bb05 (patch)
treea12464310187a587884e1ed1f0c0417f02ba1d62 /lib/smb.c
parent58b317c9dabcb2b6ed83714f45dbd5caee5c1ea9 (diff)
smb: Fixed URL encoded URLs not working
Diffstat (limited to 'lib/smb.c')
-rw-r--r--lib/smb.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/lib/smb.c b/lib/smb.c
index 07a5c642b..b75b1b333 100644
--- a/lib/smb.c
+++ b/lib/smb.c
@@ -42,6 +42,7 @@
#include "vtls/vtls.h"
#include "curl_ntlm_core.h"
#include "curl_memory.h"
+#include "escape.h"
/* The last #include file should be: */
#include "memdebug.h"
@@ -175,6 +176,7 @@ struct smb_request {
static CURLcode smb_setup(struct connectdata *conn)
{
+ CURLcode result = CURLE_OK;
struct smb_request *req;
char *slash;
char *path;
@@ -187,18 +189,29 @@ static CURLcode smb_setup(struct connectdata *conn)
req->state = SMB_REQUESTING;
req->result = CURLE_OK;
+ /* URL decode the path */
+ result = Curl_urldecode(conn->data, conn->data->state.path, 0, &path, NULL,
+ TRUE);
+ if(result)
+ return result;
+
/* Parse the share and path */
- path = conn->data->state.path;
req->share = strdup((*path == '/' || *path == '\\') ? path + 1 : path);
- if(!req->share)
+ if(!req->share) {
+ Curl_safefree(path);
+
return CURLE_OUT_OF_MEMORY;
+ }
slash = strchr(req->share, '/');
if(!slash)
slash = strchr(req->share, '\\');
- if(!slash)
+ if(!slash) {
+ Curl_safefree(path);
+
return CURLE_URL_MALFORMAT;
+ }
*slash++ = 0;
req->path = slash;
@@ -207,6 +220,8 @@ static CURLcode smb_setup(struct connectdata *conn)
*slash = '\\';
}
+ Curl_safefree(path);
+
return CURLE_OK;
}