Bug 6017 - magic script does not work
Summary: magic script does not work
Status: RESOLVED FIXED
Alias: None
Product: Samba 3.2
Classification: Unclassified
Component: File services (show other bugs)
Version: 3.2.6
Hardware: x86 Linux
: P3 trivial
Target Milestone: ---
Assignee: Samba Bugzilla Account
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-01-06 17:40 UTC by TAKAHASHI Motonobu
Modified: 2009-01-06 18:07 UTC (History)
0 users

See Also:


Attachments
Patch to fix this bug (432 bytes, patch)
2009-01-06 17:43 UTC, TAKAHASHI Motonobu
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description TAKAHASHI Motonobu 2009-01-06 17:40:39 UTC
magic script parameter does not work.

To reproduce

(1) create a smb.conf like:

-----
[share1]
  path = /some/where
  magic script = user.sh
-----

(2) create "user.sh" at /some/where like:

-----
#!/bin/sh

date
-----

and chmod +x user.sh

(3) access to "share1", open user.sh and close. Then nothing is created.
Log says

-----
[2009/01/06 16:28:58,  5] smbd/close.c:check_magic(44)
  checking magic for user.sh
sh: user.sh: command not found
[2009/01/06 16:28:58,  3] smbd/close.c:check_magic(73)
  Invoking magic command user.sh gave 127
[2009/01/06 16:28:58,  2] smbd/close.c:close_normal_file(584)
  local closed file user.sh (numopen=0) NT_STATUS_OK
-----
Comment 1 TAKAHASHI Motonobu 2009-01-06 17:43:24 UTC
Created attachment 3859 [details]
Patch to fix this bug

This bug causes because Samba tries to run user.sh via "sh -c user.sh", but usually /some/where is not included in that users's PATH variable.
Instead "sh -c ./user.sh" works.
Comment 2 Jeremy Allison 2009-01-06 18:07:38 UTC
Fix applied - thanks a *lot* !
Jeremy.