Bug 10307 - libsmbclient not reporting host unreachable error back to the caller of its API
Summary: libsmbclient not reporting host unreachable error back to the caller of its API
Status: NEW
Alias: None
Product: Samba 3.6
Classification: Unclassified
Component: libsmbclient (show other bugs)
Version: 3.6.3
Hardware: All All
: P5 major
Target Milestone: ---
Assignee: Samba Bugzilla Account
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-12-05 08:24 UTC by hargagan
Modified: 2013-12-05 08:24 UTC (History)
0 users

See Also:


Attachments
Patch fixing the issue of host unreachable error in libsmbclient (5.24 KB, patch)
2013-12-05 08:24 UTC, hargagan
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description hargagan 2013-12-05 08:24:39 UTC
Created attachment 9503 [details]
Patch fixing the issue of host unreachable error in libsmbclient

We are using libsmbclient in our application, which is contacting AD and its member file servers. In cases where the file server is down, and we are trying to access the files, the api SMBC_stat_ctx() doesn't return host unreachable (errno 113). Instead it always return ENOENT (2), which is file not found. This is creating confusion with the case where the file is actually deleted. This is the same observation with few other APIs as well which we are using like SMBC_write_ctx, SMBC_read_ctx etc.

I tried to understand the code flow and these are my understanding. Please correct me if I have misread it. Most of the APIs exposed by libsmbclient, calls cli_resolve_path() which does the actual connection to the share in the cli_cm_open(). But this error is not returned eventually to the caller of the API. Instead it sets errno as ENOENT, and returns -1. This way it is not capturing the host unreachable state of the file server.

Based on this understanding, I created a patch and with that I could get the desired result. I am attaching the patch which is working for me. Please review this change. This is based on master branch code base.