summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2001-04-28 12:43:15 +0000
committerAndrew Tridgell <tridge@samba.org>2001-04-28 12:43:15 +0000
commit944aeb7de472e0654561f7d8f37a5703487a973e (patch)
tree2f181621cdb9482eee0d40f6ad06bac8a94f2e22 /source3
parentfd5c6d72d333a967480be834abb611120c1ae0b6 (diff)
downloadsamba-944aeb7de472e0654561f7d8f37a5703487a973e.tar.gz
samba-944aeb7de472e0654561f7d8f37a5703487a973e.tar.bz2
samba-944aeb7de472e0654561f7d8f37a5703487a973e.zip
use asprintf for hideunreadable option
(This used to be commit 338d5ca8addb3079e0ab4a68338596d6e3b17ddb)
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/dir.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c
index 1d497574a6..fa9cbdc4a2 100644
--- a/source3/smbd/dir.c
+++ b/source3/smbd/dir.c
@@ -727,21 +727,15 @@ void *OpenDir(connection_struct *conn, char *name, BOOL use_veto)
if (use_veto && conn && IS_VETO_PATH(conn, n)) continue;
/* Honour _hide unreadable_ option */
- if (conn && lp_hideunreadable(SNUM(conn)))
- {
- char *entry;
- int ret;
+ if (conn && lp_hideunreadable(SNUM(conn))) {
+ char *entry;
+ int ret=0;
- entry = (char *)malloc(PATH_MAX);
- if (!entry) {
- DEBUG(0,("Out of memory in OpenDir\n"));
- conn->vfs_ops.closedir(conn,p);
- return(NULL);
- }
- slprintf(entry, PATH_MAX, "%s/%s/%s", conn->origpath, name, n);
- ret = user_can_read_file(conn, entry);
- free(entry);
- if (!ret) continue;
+ if (asprintf(&entry, "%s/%s/%s", conn->origpath, name, n) > 0) {
+ ret = user_can_read_file(conn, entry);
+ free(entry);
+ }
+ if (!ret) continue;
}
if (used + l > dirp->mallocsize) {