]> granicus.if.org Git - curl/commitdiff
smb: Use the correct error code for access denied on file open
authorJuergen Hoetzel <juergen@archlinux.org>
Sun, 7 Jul 2019 15:10:24 +0000 (17:10 +0200)
committerJay Satiro <raysatiro@yahoo.com>
Thu, 11 Jul 2019 06:57:40 +0000 (02:57 -0400)
- Return CURLE_REMOTE_ACCESS_DENIED for SMB access denied on file open.

Prior to this change CURLE_REMOTE_FILE_NOT_FOUND was returned instead.

Closes https://github.com/curl/curl/pull/4095

lib/smb.c

index 5a4b7804db877718fc1a0d6e1fa5afd6cf7849d7..870244cb72ee6f29006167af75485ae956039278 100644 (file)
--- a/lib/smb.c
+++ b/lib/smb.c
@@ -785,6 +785,8 @@ static CURLcode smb_request_state(struct connectdata *conn, bool *done)
   case SMB_OPEN:
     if(h->status || smbc->got < sizeof(struct smb_nt_create_response)) {
       req->result = CURLE_REMOTE_FILE_NOT_FOUND;
+      if(h->status == smb_swap32(SMB_ERR_NOACCESS))
+        req->result = CURLE_REMOTE_ACCESS_DENIED;
       next_state = SMB_TREE_DISCONNECT;
       break;
     }