scponly 4.3 が上手く動かない
先日リリースされた scponly ver.4.3 ですが、FreeBSD 環境だと rsync を使った場合に異常終了してしまいます。/var/log/auth.log にでるメッセージはこんな感じです。
Jan 10 13:12:55 firebomber scponly[3479]: option e is not permitted for use with /usr/local/bin/rsync(arg was rver) (username: scponly(5009), IP/port: ::1 50657 22)) Jan 10 13:12:55 firebomber scponly[3479]: requested command (/usr/local/bin/rsync --server -vlogDtprz . incoming) tried to use disallowed argument (username: scponly(5009), IP/port: ::1 50657 22))
どなたもこの問題に遭遇してないですか?
- scp は動く(-r オプションも OK)
- sftp も動く
- rsync はダメ
で、某 K 氏が「ver.4.2 から getopt を使うようになったみたいだけど、FreeBSD の getopt は "--" をオプションの終了として扱うからダメみたい」と言っていたので マニュアル を見ると確かに書いてあります。
The interpretation of options in the argument list may be cancelled by the option `--' (double dash) which causes getopt() to signal the end of argument processing and return -1. When all options have been processed (i.e., up to the first non-option argument), getopt() returns -1.
どうも GNU getopt を使わないとダメみたいですね。ロングオプションが使えるようにしないといけないみたいですが、どうやったら良いのかイマイチ分かってません...