summaryrefslogtreecommitdiff
path: root/lib/smb.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2023-02-12 13:24:08 +0100
committerDaniel Stenberg <daniel@haxx.se>2023-02-12 18:04:41 +0100
commitefbf02111aa66bda9288506b7d5cc0226bf5453e (patch)
treec12eb7f755db7c321e6834fa6dc821a69debe9ec /lib/smb.c
parent5309e32141a144187dcdc97e61cf8f39c4288dea (diff)
downloadcurl-efbf02111aa66bda9288506b7d5cc0226bf5453e.tar.gz
smb: return error on upload without size
The protocol needs to know the size ahead of time, this is now a known restriction and not a bug. Also output a clearer error if the URL path does not contain proper share. Ref: #7896 Closes #10484
Diffstat (limited to 'lib/smb.c')
-rw-r--r--lib/smb.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/smb.c b/lib/smb.c
index 8a76763c1..dc0abe784 100644
--- a/lib/smb.c
+++ b/lib/smb.c
@@ -763,6 +763,11 @@ static CURLcode smb_request_state(struct Curl_easy *data, bool *done)
void *msg = NULL;
const struct smb_nt_create_response *smb_m;
+ if(data->set.upload && (data->state.infilesize < 0)) {
+ failf(data, "SMB upload needs to know the size up front");
+ return CURLE_SEND_ERROR;
+ }
+
/* Start the request */
if(req->state == SMB_REQUESTING) {
result = smb_send_tree_connect(data);
@@ -993,6 +998,7 @@ static CURLcode smb_parse_url_path(struct Curl_easy *data,
/* The share must be present */
if(!slash) {
Curl_safefree(smbc->share);
+ failf(data, "missing share in URL path for SMB");
return CURLE_URL_MALFORMAT;
}