git.samba.org
/
metze
/
samba
/
wip.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
b7ea274
)
s3: Convert is_visible_file to use talloc_asprintf instead of malloc
author
Tim Prouty
<tprouty@samba.org>
Thu, 18 Jun 2009 18:38:42 +0000
(11:38 -0700)
committer
Tim Prouty
<tprouty@samba.org>
Thu, 25 Jun 2009 04:15:24 +0000
(21:15 -0700)
source3/smbd/dir.c
patch
|
blob
|
history
diff --git
a/source3/smbd/dir.c
b/source3/smbd/dir.c
index f5a9e22d1477d9c8c2c2d4cb40c97e93b8c648cd..fb246cdf8c5755ce7e320e6142c8a45129f09556 100644
(file)
--- a/
source3/smbd/dir.c
+++ b/
source3/smbd/dir.c
@@
-1043,16
+1043,17
@@
bool is_visible_file(connection_struct *conn, const char *dir_path,
if (hide_unreadable || hide_unwriteable || hide_special) {
char *entry = NULL;
if (hide_unreadable || hide_unwriteable || hide_special) {
char *entry = NULL;
- if (asprintf(&entry, "%s/%s", dir_path, name) == -1) {
- return False;
+ entry = talloc_asprintf(talloc_tos(), "%s/%s", dir_path, name);
+ if (!entry)
+ return false;
}
/* If it's a dfs symlink, ignore _hide xxxx_ options */
if (lp_host_msdfs() &&
lp_msdfs_root(SNUM(conn)) &&
is_msdfs_link(conn, entry, NULL)) {
}
/* If it's a dfs symlink, ignore _hide xxxx_ options */
if (lp_host_msdfs() &&
lp_msdfs_root(SNUM(conn)) &&
is_msdfs_link(conn, entry, NULL)) {
-
SAFE
_FREE(entry);
- return
T
rue;
+
TALLOC
_FREE(entry);
+ return
t
rue;
}
/* If the file name does not exist, there's no point checking
}
/* If the file name does not exist, there's no point checking
@@
-1061,34
+1062,34
@@
bool is_visible_file(connection_struct *conn, const char *dir_path,
*/
if (!VALID_STAT(*pst) && (SMB_VFS_STAT(conn, entry, pst) != 0))
{
*/
if (!VALID_STAT(*pst) && (SMB_VFS_STAT(conn, entry, pst) != 0))
{
-
SAFE
_FREE(entry);
- return
T
rue;
+
TALLOC
_FREE(entry);
+ return
t
rue;
}
/* Honour _hide unreadable_ option */
if (hide_unreadable && !user_can_read_file(conn, entry)) {
DEBUG(10,("is_visible_file: file %s is unreadable.\n",
entry ));
}
/* Honour _hide unreadable_ option */
if (hide_unreadable && !user_can_read_file(conn, entry)) {
DEBUG(10,("is_visible_file: file %s is unreadable.\n",
entry ));
-
SAFE
_FREE(entry);
- return
F
alse;
+
TALLOC
_FREE(entry);
+ return
f
alse;
}
/* Honour _hide unwriteable_ option */
if (hide_unwriteable && !user_can_write_file(conn, entry, pst)) {
DEBUG(10,("is_visible_file: file %s is unwritable.\n",
entry ));
}
/* Honour _hide unwriteable_ option */
if (hide_unwriteable && !user_can_write_file(conn, entry, pst)) {
DEBUG(10,("is_visible_file: file %s is unwritable.\n",
entry ));
-
SAFE
_FREE(entry);
- return
F
alse;
+
TALLOC
_FREE(entry);
+ return
f
alse;
}
/* Honour _hide_special_ option */
if (hide_special && file_is_special(conn, entry, pst)) {
DEBUG(10,("is_visible_file: file %s is special.\n",
entry ));
}
/* Honour _hide_special_ option */
if (hide_special && file_is_special(conn, entry, pst)) {
DEBUG(10,("is_visible_file: file %s is special.\n",
entry ));
-
SAFE
_FREE(entry);
- return
F
alse;
+
TALLOC
_FREE(entry);
+ return
f
alse;
}
}
-
SAFE
_FREE(entry);
+
TALLOC
_FREE(entry);
}
}
- return
T
rue;
+ return
t
rue;
}
static int smb_Dir_destructor(struct smb_Dir *dirp)
}
static int smb_Dir_destructor(struct smb_Dir *dirp)