File tests/helpers.inc.php changed (mode: 100644) (index b1172c9..10cade7) |
... |
... |
function rg_test_upload_ssh_key($db, $rg_ui, $key_name, $good_sid) |
276 |
276 |
unlink('keys/' . $key_name); |
unlink('keys/' . $key_name); |
277 |
277 |
if (file_exists('keys/' . $key_name . '.pub')) |
if (file_exists('keys/' . $key_name . '.pub')) |
278 |
278 |
unlink('keys/' . $key_name . '.pub'); |
unlink('keys/' . $key_name . '.pub'); |
279 |
|
$out = shell_exec("ssh-keygen -t rsa -N '' -b 4096 -C \"Key for RocketGit\"" |
|
280 |
|
. " -f keys/" . escapeshellarg($key_name) . " </dev/null"); |
|
|
279 |
|
$r = rg_exec("ssh-keygen -t rsa -N '' -b 4096 -C \"Key for RocketGit\"" |
|
280 |
|
. " -f keys/" . escapeshellarg($key_name) . " </dev/null", |
|
281 |
|
'', FALSE, FALSE); |
|
282 |
|
if ($r['ok'] != 1) { |
|
283 |
|
rg_log('Cannot generate key: ' . $r['stderr']); |
|
284 |
|
exit(1); |
|
285 |
|
} |
281 |
286 |
if (!file_exists("keys/" . $key_name . ".pub")) { |
if (!file_exists("keys/" . $key_name . ".pub")) { |
282 |
|
rg_log("Could not generate ssh key: " . $out); |
|
|
287 |
|
rg_log("Could not find the ssh key!"); |
283 |
288 |
exit(1); |
exit(1); |
284 |
289 |
} |
} |
285 |
290 |
|
|
File tests/http.inc.php changed (mode: 100644) (index 4b78082..c33e330) |
... |
... |
function do_req($url, &$data, &$headers) |
88 |
88 |
$ret['body'] = str_replace('<xss>', '|xss|', $ret['body']); |
$ret['body'] = str_replace('<xss>', '|xss|', $ret['body']); |
89 |
89 |
file_put_contents("http.tidy.in", $ret['body']); |
file_put_contents("http.tidy.in", $ret['body']); |
90 |
90 |
$cmd = "tidy -errors -utf8 -file http.tidy.out http.tidy.in"; |
$cmd = "tidy -errors -utf8 -file http.tidy.out http.tidy.in"; |
91 |
|
system($cmd, $ec); |
|
92 |
|
if ($ec != 0) { |
|
93 |
|
rg_log('tidy ec=' . $ec); |
|
|
91 |
|
$r = rg_exec($cmd, '', FALSE, FALSE); |
|
92 |
|
if ($r['ok'] != 1) { |
|
93 |
|
rg_log_ml('tidy error: ' . $r['stderr']); |
94 |
94 |
rg_log_ml(file_get_contents('http.tidy.out')); |
rg_log_ml(file_get_contents('http.tidy.out')); |
95 |
95 |
exit(1); |
exit(1); |
96 |
96 |
} |
} |
File tests/wh_http.php changed (mode: 100644) (index 85daba0..839572c) |
... |
... |
rg_log('port1=' . $port1 . ' port2=' . $port2 . ' port3=' . $port3); |
27 |
27 |
|
|
28 |
28 |
function clean() |
function clean() |
29 |
29 |
{ |
{ |
30 |
|
system('fuser -k -9 wh-stunnel-1.log 1>/dev/null 2>&1'); |
|
31 |
|
system('fuser -k -9 wh-stunnel-2.log 1>/dev/null 2>&1'); |
|
32 |
|
system('fuser -k -9 wh-stunnel-3.log 1>/dev/null 2>&1'); |
|
|
30 |
|
rg_exec('fuser -k -9 wh-stunnel-1.log', '', FALSE, FALSE); |
|
31 |
|
rg_exec('fuser -k -9 wh-stunnel-2.log', '', FALSE, FALSE); |
|
32 |
|
rg_exec('fuser -k -9 wh-stunnel-3.log', '', FALSE, FALSE); |
33 |
33 |
|
|
34 |
34 |
@unlink('wh-stunnel.conf-1.tmp'); |
@unlink('wh-stunnel.conf-1.tmp'); |
35 |
35 |
@unlink('wh-stunnel.conf-2.tmp'); |
@unlink('wh-stunnel.conf-2.tmp'); |
|
... |
... |
register_shutdown_function('clean'); |
40 |
40 |
|
|
41 |
41 |
rg_log(''); |
rg_log(''); |
42 |
42 |
rg_log('Generating certificates...'); |
rg_log('Generating certificates...'); |
43 |
|
$r = shell_exec('./ca.sh wh'); |
|
44 |
|
if (!strstr($r, 'CA_SH_OK')) { |
|
45 |
|
rg_log_ml('r: ' . print_r($r, TRUE)); |
|
|
43 |
|
$r = rg_exec('./ca.sh wh', '', FALSE, FALSE); |
|
44 |
|
if (!strstr($r['data'], 'CA_SH_OK')) { |
|
45 |
|
rg_log_ml('data: ' . $r['data']); |
46 |
46 |
rg_log('Cannot generate certificates!'); |
rg_log('Cannot generate certificates!'); |
47 |
47 |
exit(1); |
exit(1); |
48 |
48 |
} |
} |
|
... |
... |
if ($pid == -1) { |
80 |
80 |
exit(1); |
exit(1); |
81 |
81 |
} |
} |
82 |
82 |
if ($pid == 0) { //child |
if ($pid == 0) { //child |
83 |
|
$r = exec('stunnel wh-stunnel.conf-1.tmp 2>/dev/null'); |
|
|
83 |
|
rg_exec('stunnel wh-stunnel.conf-1.tmp 1>wh-stunnel-1-1.log 2>wh-stunnel-1-2.log', '', FALSE, FALSE); |
84 |
84 |
exit(0); |
exit(0); |
85 |
85 |
} |
} |
86 |
86 |
rg_log('Started stunnel with pid ' . $pid); |
rg_log('Started stunnel with pid ' . $pid); |
|
... |
... |
if ($pid == -1) { |
94 |
94 |
exit(1); |
exit(1); |
95 |
95 |
} |
} |
96 |
96 |
if ($pid == 0) { //child |
if ($pid == 0) { //child |
97 |
|
$r = exec('stunnel wh-stunnel.conf-2.tmp 2>/dev/null'); |
|
|
97 |
|
rg_exec('stunnel wh-stunnel.conf-2.tmp 1>wh-stunnel-2-1.log 2>wh-stunnel-2-2.log', '', FALSE, FALSE); |
98 |
98 |
exit(0); |
exit(0); |
99 |
99 |
} |
} |
100 |
100 |
rg_log('Started stunnel with pid ' . $pid); |
rg_log('Started stunnel with pid ' . $pid); |
|
... |
... |
if ($pid == -1) { |
108 |
108 |
exit(1); |
exit(1); |
109 |
109 |
} |
} |
110 |
110 |
if ($pid == 0) { //child |
if ($pid == 0) { //child |
111 |
|
$r = exec('stunnel wh-stunnel.conf-3.tmp 2>/dev/null'); |
|
|
111 |
|
rg_exec('stunnel wh-stunnel.conf-3.tmp 1>wh-stunnel-3-1.log 2>wh-stunnel-3-2.log', '', FALSE, FALSE); |
112 |
112 |
exit(0); |
exit(0); |
113 |
113 |
} |
} |
114 |
114 |
rg_log('Started stunnel with pid ' . $pid); |
rg_log('Started stunnel with pid ' . $pid); |