File: smd-restricted-shell

package info (click to toggle)
syncmaildir 1.2.5-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 1,104 kB
  • sloc: ansic: 6,643; sh: 1,780; makefile: 247
file content (26 lines) | stat: -rwxr-xr-x 601 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/sh
#
# Released under the terms of GPLv3 or at your option any later version.
# No warranties.
# Copyright Enrico Tassi <gares@fettunta.org>

set -e
#set -x

PREFIX="@PREFIX@"
if [ `echo "$PREFIX" | cut -c -1` = "@" ]; then
	echo "smd-restricted-shell not installed, assuming PREFIX=."
	WHERE="./"
else
	WHERE="$PREFIX/bin"
fi

# check that SSH_ORIGINAL_COMMAND contains only
# smd-client/smd-server
C=`echo $SSH_ORIGINAL_COMMAND | cut -f 1 -d ' '`
if [ "$C" != "$WHERE/smd-client" -a "$C" != "$WHERE/smd-server" ]; then
      exit 1
fi

# we now run the smd command
exec $SSH_ORIGINAL_COMMAND