summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2009-01-06 16:05:28 -0800
committerJeremy Allison <jra@samba.org>2009-01-06 16:05:28 -0800
commite13983870f00f83420cca554a541165214dc4e06 (patch)
treeff119e588ebef156546f82947ca7ba480c3a5bed /source3/smbd
parent7b77ac5365a05d5de359e1e8d8ca7ac7e40a09f0 (diff)
downloadsamba-e13983870f00f83420cca554a541165214dc4e06.tar.gz
samba-e13983870f00f83420cca554a541165214dc4e06.tar.bz2
samba-e13983870f00f83420cca554a541165214dc4e06.zip
Fix bug #6017, - magic script does not work. based on a patch from monyo@samba.gr.jp.
Jeremy.
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/close.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/source3/smbd/close.c b/source3/smbd/close.c
index f91f1fcf8f..a6dff20ec7 100644
--- a/source3/smbd/close.c
+++ b/source3/smbd/close.c
@@ -67,10 +67,20 @@ static void check_magic(struct files_struct *fsp)
return;
}
- chmod(fsp->fsp_name,0755);
- ret = smbrun(fsp->fsp_name,&tmp_fd);
+ /* Ensure we don't depend on user's PATH. */
+ p = talloc_asprintf(ctx, "./%s", fsp->fsp_name);
+ if (!p) {
+ TALLOC_FREE(ctx);
+ return;
+ }
+
+ if (chmod(fsp->fsp_name,0755) == -1) {
+ TALLOC_FREE(ctx);
+ return;
+ }
+ ret = smbrun(p,&tmp_fd);
DEBUG(3,("Invoking magic command %s gave %d\n",
- fsp->fsp_name,ret));
+ p,ret));
unlink(fsp->fsp_name);
if (ret != 0 || tmp_fd == -1) {