Browse Source

update scripts

pull/59/head
Max Lv 10 years ago
parent
commit
d14da247dc
6 changed files with 11 additions and 37 deletions
  1. 3
      debian/shadowsocks.default
  2. 5
      debian/shadowsocks.init
  3. 10
      src/local.c
  4. 10
      src/redir.c
  5. 10
      src/server.c
  6. 10
      src/tunnel.c

3
debian/shadowsocks.default

@ -18,3 +18,6 @@ DAEMON_ARGS=""
# User and group to run the server as
USER=root
GROUP=root
# Number of maximum file descriptors
MAXFD=1024

5
debian/shadowsocks.init

@ -45,6 +45,9 @@ SCRIPTNAME=/etc/init.d/$NAME
#
do_start()
{
# Modify the file descriptor limit
ulimit -n ${MAXFD}
# Take care of pidfile permissions
mkdir /var/run/$NAME 2>/dev/null || true
chown "$USER:$GROUP" /var/run/$NAME
@ -56,7 +59,7 @@ do_start()
start-stop-daemon --start --quiet --pidfile $PIDFILE --chuid $USER:$GROUP --exec $DAEMON --test > /dev/null \
|| return 1
start-stop-daemon --start --quiet --pidfile $PIDFILE --chuid $USER:$GROUP --exec $DAEMON -- \
-c "$CONFFILE" -a "$USER" -u -f $PIDFILE $DAEMON_ARGS \
-c "$CONFFILE" -u -f $PIDFILE $DAEMON_ARGS \
|| return 2
}

10
src/local.c

@ -797,7 +797,6 @@ int main (int argc, char **argv)
int i, c;
int pid_flags = 0;
char *user = NULL;
char *local_port = NULL;
char *local_addr = NULL;
char *password = NULL;
@ -813,7 +812,7 @@ int main (int argc, char **argv)
opterr = 0;
while ((c = getopt (argc, argv, "f:s:p:l:k:t:m:i:c:b:a:uv")) != -1)
while ((c = getopt (argc, argv, "f:s:p:l:k:t:m:i:c:b:uv")) != -1)
{
switch (c)
{
@ -849,9 +848,6 @@ int main (int argc, char **argv)
case 'b':
local_addr = optarg;
break;
case 'a':
user = optarg;
break;
case 'u':
udprelay = 1;
break;
@ -959,10 +955,6 @@ int main (int argc, char **argv)
udprelay_init(local_addr, local_port, remote_addr[0].host, remote_addr[0].port, m, listen_ctx.timeout, iface);
}
// setuid
if (user != NULL)
run_as(user);
ev_run (loop, 0);
#ifdef __MINGW32__

10
src/redir.c

@ -660,7 +660,6 @@ int main (int argc, char **argv)
int i, c;
int pid_flags = 0;
char *user = NULL;
char *local_port = NULL;
char *local_addr = NULL;
char *password = NULL;
@ -675,7 +674,7 @@ int main (int argc, char **argv)
opterr = 0;
while ((c = getopt (argc, argv, "f:s:p:l:k:t:m:c:b:a:")) != -1)
while ((c = getopt (argc, argv, "f:s:p:l:k:t:m:c:b:")) != -1)
{
switch (c)
{
@ -708,9 +707,6 @@ int main (int argc, char **argv)
case 'b':
local_addr = optarg;
break;
case 'a':
user = optarg;
break;
}
}
@ -800,10 +796,6 @@ int main (int argc, char **argv)
ev_io_init (&listen_ctx.io, accept_cb, listenfd, EV_READ);
ev_io_start (loop, &listen_ctx.io);
// setuid
if (user != NULL)
run_as(user);
ev_run (loop, 0);
return 0;

10
src/server.c

@ -898,7 +898,6 @@ int main (int argc, char **argv)
int i, c;
int pid_flags = 0;
char *user = NULL;
char *password = NULL;
char *timeout = NULL;
char *method = NULL;
@ -914,7 +913,7 @@ int main (int argc, char **argv)
opterr = 0;
while ((c = getopt (argc, argv, "f:s:p:l:k:t:m:c:i:d:a:uv")) != -1)
while ((c = getopt (argc, argv, "f:s:p:l:k:t:m:c:i:d:uv")) != -1)
{
switch (c)
{
@ -947,9 +946,6 @@ int main (int argc, char **argv)
dns_thread_num = atoi(optarg);
if (!dns_thread_num) FATAL("Invalid DNS thread number");
break;
case 'a':
user = optarg;
break;
case 'u':
udprelay = 1;
break;
@ -1056,10 +1052,6 @@ int main (int argc, char **argv)
udprelay_init(server_host[0], server_port, asyncns, m, listen_ctx.timeout, iface);
}
// setuid
if (user != NULL)
run_as(user);
// start ev loop
ev_run (loop, 0);
return 0;

10
src/tunnel.c

@ -704,7 +704,6 @@ int main (int argc, char **argv)
int i, c;
int pid_flags = 0;
char *user = NULL;
char *local_port = NULL;
char *local_addr = NULL;
char *password = NULL;
@ -723,7 +722,7 @@ int main (int argc, char **argv)
opterr = 0;
while ((c = getopt (argc, argv, "f:s:p:l:k:t:m:i:c:b:L:a:uv")) != -1)
while ((c = getopt (argc, argv, "f:s:p:l:k:t:m:i:c:b:L:uv")) != -1)
{
switch (c)
{
@ -765,9 +764,6 @@ int main (int argc, char **argv)
case 'L':
tunnel_addr_str = optarg;
break;
case 'a':
user = optarg;
break;
case 'v':
verbose = 1;
break;
@ -877,10 +873,6 @@ int main (int argc, char **argv)
tunnel_addr, m, listen_ctx.timeout, iface);
}
// setuid
if (user != NULL)
run_as(user);
ev_run (loop, 0);
#ifdef __MINGW32__

Loading…
Cancel
Save