diff options
author | Tim Potter <tpot@samba.org> | 2001-01-02 23:42:36 +0000 |
---|---|---|
committer | Tim Potter <tpot@samba.org> | 2001-01-02 23:42:36 +0000 |
commit | 9255e526244578e092abc306491d5862469da775 (patch) | |
tree | 8914524619fdd4a9de9ceb0cea912bdd30ebb205 /source/smbwrapper | |
parent | 143006d32f0a0d339b870741b811ec49795b7099 (diff) | |
download | samba-9255e526244578e092abc306491d5862469da775.tar.gz samba-9255e526244578e092abc306491d5862469da775.tar.xz samba-9255e526244578e092abc306491d5862469da775.zip |
Return an empty directory for a stat on a share we aren't allowed to
connect to. This gives a permission denied when a cd is attempted, but
not a permission denied in the directory listing one level up.
Diffstat (limited to 'source/smbwrapper')
-rw-r--r-- | source/smbwrapper/smbw_stat.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/source/smbwrapper/smbw_stat.c b/source/smbwrapper/smbw_stat.c index c84140f3629..926075c864f 100644 --- a/source/smbwrapper/smbw_stat.c +++ b/source/smbwrapper/smbw_stat.c @@ -180,6 +180,7 @@ int smbw_stat(const char *fname, struct stat *st) size_t size=0; uint16 mode=0; SMB_INO_T ino = 0; + int result = 0; ZERO_STRUCTP(st); @@ -200,8 +201,19 @@ int smbw_stat(const char *fname, struct stat *st) /* get a connection to the server */ srv = smbw_server(server, share); if (!srv) { + + /* For shares we aren't allowed to connect to, return + an empty directory */ + + if (server[0] && share[0] && !path[0] && errno == EACCES) { + mode = aDIR | aRONLY; + smbw_setup_stat(st, path, size, mode); + goto done; + } + /* smbw_server sets errno */ - goto failed; + result = -1; + goto done; } DEBUG(4,("smbw_stat\n")); @@ -221,7 +233,8 @@ int smbw_stat(const char *fname, struct stat *st) &mode, &size, &c_time, &a_time, &m_time, &ino)) { errno = smbw_errno(&srv->cli); - goto failed; + result = -1; + goto done; } } @@ -234,10 +247,7 @@ int smbw_stat(const char *fname, struct stat *st) st->st_mtime = m_time; st->st_dev = srv->dev; + done: smbw_busy--; - return 0; - - failed: - smbw_busy--; - return -1; + return result; } |