From 28f1b71c9195c23a0b7cc854f9883dca3a1661a0 Mon Sep 17 00:00:00 2001 From: clowwindy Date: Fri, 4 Jan 2013 17:07:18 +0800 Subject: [PATCH] fix password issue --- pytest/config.json | 2 +- pytest/test.py | 2 +- server.c | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pytest/config.json b/pytest/config.json index ae7f636..9c1838d 100644 --- a/pytest/config.json +++ b/pytest/config.json @@ -2,6 +2,6 @@ "server":"localhost", "server_port":8888, "local_port":1080, - "password":"foobar!", + "password":"barfoo!", "timeout":60 } diff --git a/pytest/test.py b/pytest/test.py index 061c87d..960bda0 100644 --- a/pytest/test.py +++ b/pytest/test.py @@ -8,7 +8,7 @@ import string from subprocess import Popen, PIPE -p1 = Popen(['../server'], shell=False, bufsize=0, stdin=PIPE, +p1 = Popen(['../server', '-k', 'barfoo!'], shell=False, bufsize=0, stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True) p2 = Popen(['python', 'local.py'], shell=False, bufsize=0, stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True) diff --git a/server.c b/server.c index 36c1170..c5e103b 100644 --- a/server.c +++ b/server.c @@ -490,7 +490,8 @@ int main(int argc, char *argv[]) server_port = atoi(optarg); break; case 'k': - password = (uint8_t *)optarg; + password = malloc(strlen(optarg + 1)); + strcpy((char *)password, optarg); break; case 'f': pid_path = optarg;