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 | 8bb17e9de5d8ceca7051d4cd5dabd7447ff68390 (patch) | |
tree | 4f8a53699a17d0f0341acd43b8ab9bb9bf7f756d | |
parent | e86cbff0a9f463eef7c3b92081908be4f83f595b (diff) | |
download | samba-8bb17e9de5d8ceca7051d4cd5dabd7447ff68390.tar.gz samba-8bb17e9de5d8ceca7051d4cd5dabd7447ff68390.tar.bz2 samba-8bb17e9de5d8ceca7051d4cd5dabd7447ff68390.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.
(This used to be commit 9255e526244578e092abc306491d5862469da775)
-rw-r--r-- | source3/smbwrapper/smbw_stat.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/source3/smbwrapper/smbw_stat.c b/source3/smbwrapper/smbw_stat.c index c84140f362..926075c864 100644 --- a/source3/smbwrapper/smbw_stat.c +++ b/source3/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; } |