検証環境は Samba 3.3.3。
smb_browser.php の 192-194 行目(実質的には 194 行目のみ)を、次のように修正した。
- $cmd = 'net share -W "'.$workgroup.'" -S "'.$location.'" -I "'.$ip.'" -U "'.$uname.'%***"';
- report("Command",$cmd);
- $cmd = 'net share -W "'.$workgroup.'" -S "'.$location.'" -I "'.$ip.'" -U "'.$uname.'%'.$pwd.'"';
+ $cmd = 'net rpc share -s /dev/null -W "'.$workgroup.'" -S "'.$location.'" -I "'.$ip.'" -U "'.$uname.'%***"';
+ report("Command",$cmd);
+ $cmd = 'net rpc share -s /dev/null -W "'.$workgroup.'" -S "'.$location.'" -I "'.$ip.'" -U "'.$uname.'%'.$pwd.'"';
Samba 3.3 系では、net share の利用時にメソッドの指定が必須になった模様(ヘルプだと auto-detected if not specified っと書いてあるのでバグかもしれない?)なので、rpc を追加。
また、net コマンドの使用時に smb.conf を読めないと処理を中断するようになったみたいなので、とりあえず /dev/null でも食っとけ、ということで(追記: これは権限を落としている環境のみ。apache ユーザの権限で smb.conf が読める環境では不要なはずです)。
*
Apache の気持ちになれる、秘密の呪文。
# su -s /bin/sh - apache