forked from pool/shadowsocks-libev
- Add fix-Command-Execution-in-ss-manager.patch * Fix boo#1065619 and CVE-2017-15924 OBS-URL: https://build.opensuse.org/request/show/537770 OBS-URL: https://build.opensuse.org/package/show/server:proxy/shadowsocks-libev?expand=0&rev=10
66 lines
2.6 KiB
Diff
66 lines
2.6 KiB
Diff
diff -Nur shadowsocks-libev-3.1.0/src/manager.c shadowsocks-libev-3.1.0-new/src/manager.c
|
|
--- shadowsocks-libev-3.1.0/src/manager.c 2017-09-06 09:19:47.000000000 +0800
|
|
+++ shadowsocks-libev-3.1.0-new/src/manager.c 2017-10-31 11:29:51.122235135 +0800
|
|
@@ -92,7 +92,7 @@
|
|
}
|
|
|
|
static void
|
|
-build_config(char *prefix, struct server *server)
|
|
+build_config(char *prefix, struct manager_ctx *manager, struct server *server)
|
|
{
|
|
char *path = NULL;
|
|
int path_size = strlen(prefix) + strlen(server->port) + 20;
|
|
@@ -110,11 +110,18 @@
|
|
fprintf(f, "{\n");
|
|
fprintf(f, "\"server_port\":%d,\n", atoi(server->port));
|
|
fprintf(f, "\"password\":\"%s\"", server->password);
|
|
- if (server->fast_open[0]) fprintf(f, ",\n\"fast_open\": %s", server->fast_open);
|
|
- if (server->mode) fprintf(f, ",\n\"mode\":\"%s\"", server->mode);
|
|
- if (server->method) fprintf(f, ",\n\"method\":\"%s\"", server->method);
|
|
- if (server->plugin) fprintf(f, ",\n\"plugin\":\"%s\"", server->plugin);
|
|
- if (server->plugin_opts) fprintf(f, ",\n\"plugin_opts\":\"%s\"", server->plugin_opts);
|
|
+ if (server->method)
|
|
+ fprintf(f, ",\n\"method\":\"%s\"", server->method);
|
|
+ else if (manager->method)
|
|
+ fprintf(f, ",\n\"method\":\"%s\"", manager->method);
|
|
+ if (server->fast_open[0])
|
|
+ fprintf(f, ",\n\"fast_open\": %s", server->fast_open);
|
|
+ if (server->mode)
|
|
+ fprintf(f, ",\n\"mode\":\"%s\"", server->mode);
|
|
+ if (server->plugin)
|
|
+ fprintf(f, ",\n\"plugin\":\"%s\"", server->plugin);
|
|
+ if (server->plugin_opts)
|
|
+ fprintf(f, ",\n\"plugin_opts\":\"%s\"", server->plugin_opts);
|
|
fprintf(f, "\n}\n");
|
|
fclose(f);
|
|
ss_free(path);
|
|
@@ -124,17 +131,17 @@
|
|
construct_command_line(struct manager_ctx *manager, struct server *server)
|
|
{
|
|
static char cmd[BUF_SIZE];
|
|
- char *method = manager->method;
|
|
int i;
|
|
+ int port;
|
|
|
|
- build_config(working_dir, server);
|
|
+ port = atoi(server->port);
|
|
+
|
|
+ build_config(working_dir, manager, server);
|
|
|
|
- if (server->method) method = server->method;
|
|
memset(cmd, 0, BUF_SIZE);
|
|
snprintf(cmd, BUF_SIZE,
|
|
- "%s -m %s --manager-address %s -f %s/.shadowsocks_%s.pid -c %s/.shadowsocks_%s.conf",
|
|
- executable, method, manager->manager_address,
|
|
- working_dir, server->port, working_dir, server->port);
|
|
+ "%s --manager-address %s -f %s/.shadowsocks_%d.pid -c %s/.shadowsocks_%d.conf",
|
|
+ executable, manager->manager_address, working_dir, port, working_dir, port);
|
|
|
|
if (manager->acl != NULL) {
|
|
int len = strlen(cmd);
|
|
@@ -1211,3 +1218,4 @@
|
|
|
|
return 0;
|
|
}
|
|
+
|