Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

smb: Use the correct error code if opening the file was denied #4095


Copy link

commented Jul 7, 2019

I was puzzled by the error code i got when trying to download a protected file over smb:

curl   -u "kodi:$KODI_PW" -v  smb://localhost/kodi/notreadable.txt
curl: (78) Remote file not found

While tshark reports:

tshark -i lo -Y smb
   16 0.008405497          ::1 → ::1          SMB 189 NT Create AndX Request, Path: notreadable.txt
   18 0.008770106          ::1 → ::1          SMB 125 NT Create AndX Response, Error: Access denied

With this commit:

./src/curl   -u "kodi:$KODI_PW" -v  smb://localhost/kodi/notreadable.txt
curl: (9) Access denied to remote resource

@juergenhoetzel juergenhoetzel force-pushed the juergenhoetzel:smb-open-handle-permission-denied branch from 78254c8 to 2020584 Jul 7, 2019

@@ -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)) {
if(h->status == smb_swap32(SMB_ERR_NOACCESS))

This comment has been minimized.

Copy link

danielgustafsson Jul 9, 2019


This seems very reasonable, and match how we handle other similar errors. It would be nice if our testserver could simulate these types of errors, but that's for another PR.


bagder approved these changes Jul 10, 2019

@jay jay closed this in ac3d19a Jul 11, 2019


This comment has been minimized.

Copy link

commented Jul 11, 2019


caraitto added a commit to caraitto/curl that referenced this pull request Jul 23, 2019

smb: Use the correct error code for access denied on file open
- 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 curl#4095
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
4 participants
You can’t perform that action at this time.