List of commits:
Subject Hash Author Date (UTC)
Pass uid for all events; more fixes for unit tests 866e43baf739ae7072949559d1c7e089c086af76 Catalin(ux) M. BOIE 2015-11-19 19:28:26
404 http error was receive for showing blobs ending in .php or .html ff87d956360a86e88a751d4c391585c84bb1e132 Catalin(ux) M. BOIE 2015-11-18 20:32:50
When creating an array, last_bug_id is set now correctly f679840c7ac3879aae69f488c561a5bd73ce71f1 Catalin(ux) M. BOIE 2015-11-18 19:14:48
We allow empty description for bugs c5a1b4057963eac575cc3d0d4872c4519fea80b0 Catalin(ux) M. BOIE 2015-11-18 18:26:39
Show the repo # on main repo page c72f4d8627ab577a92c5531ed7afb9e55a6bfd1b Catalin(ux) M. BOIE 2015-11-18 18:25:00
Bumped version to 0.42 8e9fab68ff08040402c0aa25539d1e8b29258f7d Catalin(ux) M. BOIE 2015-11-18 18:14:40
Renamed the virtual machines files 040c9f3a87826a52713b3b5f48d19c83236f8aa8 Catalin(ux) M. BOIE 2015-11-18 18:13:57
Admin user must not confirm the account by e-mail 0a81a2824087d9dcd2d1981c860946fd49cc8bf7 Catalin(ux) M. BOIE 2015-11-18 18:04:26
Bump the version to 0.41 363368555480d4c79c13867805c59541fd59e37c Catalin(ux) M. BOIE 2015-11-18 16:37:16
Mostly debug signaling by cache 2cd13a1f01403ebe733ef64ff2446b93e2cd46af Catalin(ux) M. BOIE 2015-11-18 16:36:40
Only texts changes. 37b6e035a5027c99a8b21672cef5431673320892 Catalin(ux) M. BOIE 2015-11-17 17:58:52
webhooks fixes 422d74f1cd4133e73ceb3edbb7a7da6d48c102f2 Catalin(ux) M. BOIE 2015-11-17 15:53:10
Checkpoint: ip/user fixes for remote connections, some pull request fixes and unit test start c8ac332f2ffda6149048dd17eaef8ff2f2920650 Catalin(ux) M. BOIE 2015-11-07 05:30:04
Added webhooks c2b73a8e494c4c61ce2d3f0d4101f0836a5a0df6 Catalin(ux) M. BOIE 2015-10-29 03:55:44
Mostly totp fixes; all tests pass; css fixes b4e220bf8823cad220183930949e80a6ec7f2fb3 Catalin(ux) M. BOIE 2015-10-17 12:02:14
Correct some gramatical problems 9078444271ce3e4fa25cff60afdb4efa8741fa01 Catalin(ux) M. BOIE 2015-09-13 08:43:38
Added weeks for ssh IP validity 6a8679ab22c25fd60504d2b21d57e9f1e2aaa254 Catalin(ux) M. BOIE 2015-09-13 08:03:51
Do not on any event if the protocol match. Assume is stable now. 69912910f5c0bbddc73ced992d8b3a652a8ff526 Catalin(ux) M. BOIE 2015-09-11 05:06:16
Bump version to 0.40 89d2ee4c3cae790d05a8b853de8427298dcbb9e1 Catalin(ux) M. BOIE 2015-09-11 04:59:49
Fix repo stats when there is no commit inside. 621b0a317b65d9a751d221908b8e1664d96011fa Catalin(ux) M. BOIE 2015-09-11 04:58:31
Commit 866e43baf739ae7072949559d1c7e089c086af76 - Pass uid for all events; more fixes for unit tests
Author: Catalin(ux) M. BOIE
Author date (UTC): 2015-11-19 19:28
Committer name: Catalin(ux) M. BOIE
Committer date (UTC): 2015-11-19 19:28
Parent(s): ff87d956360a86e88a751d4c391585c84bb1e132
Signer:
Signing key:
Signing status: N
Tree: a178d6565e635f115ae11f9850b831bbb5806e49
File Lines added Lines deleted
AUTHORS 1 0
History.txt 1 0
TODO 8 0
inc/keys.inc.php 8 2
inc/mail.inc.php 3 0
inc/repo.inc.php 2 1
inc/user.inc.php 10 3
inc/webhooks.inc.php 4 0
root/themes/default/main.html 2 2
scripts/cache.php 1 1
tests/cache.php 7 7
tests/http_create_account.php 2 1
tests/http_settings.php 3 3
tests/wh-stunnel.conf 2 2
tests/wh.php 67 3
File AUTHORS changed (mode: 100644) (index e14603f..08460cb)
... ... Nicolae Tipeiu
9 9 Bogdan Vatra Bogdan Vatra
10 10 James Dean James Dean
11 11 Seby Marinescu (VMware ESX help) Seby Marinescu (VMware ESX help)
12 Paul Gabor-Iliescu
File History.txt changed (mode: 100644) (index 76ae4b6..5ac9bb6)
3 3 2015-01-24 - Created first official RocketGit server (rg2), thanks to Petre. 2015-01-24 - Created first official RocketGit server (rg2), thanks to Petre.
4 4 2015-03-04 - Gitorious acquired by Gitlab 2015-03-04 - Gitorious acquired by Gitlab
5 5 2015-03-13 - Google Code closing the gates. 2015-03-13 - Google Code closing the gates.
6 2015-11-18 - rocketgit 0.42 installed on rocketgit.com
File TODO changed (mode: 100644) (index 19988dc..5013ef2)
2 2 [ ] [ ]
3 3
4 4 == BEFORE NEXT RELEASE == == BEFORE NEXT RELEASE ==
5 [ ] Paul: Notify all users (watchers and maybe the ones that had access)
6 that a repo was deleted.
7 [ ] Paul: Add (per project) an "invite" form. The user receiving the e-mail
8 will be able to follow the repo link and "create account" link?
9 [ ] Paul: Allow users to ask for access on a repo?
10 [ ] Paul: submenus are the same color => they do not seem to stack.
11 [ ] Paul: More detailed description for repo rights.
12 [ ] Add phone number for security reasons (if user lost 2fa device etc.)
5 13 [ ] Clicking "Discovery" and no repo is present should not invite the user [ ] Clicking "Discovery" and no repo is present should not invite the user
6 14 to create one... to create one...
7 15 [ ] css: #profiling still used? [ ] css: #profiling still used?
File inc/keys.inc.php changed (mode: 100644) (index c2e75a2..c146b8b)
... ... function rg_keys_remove($db, $ui, $list)
297 297 rg_sql_free_result($res); rg_sql_free_result($res);
298 298
299 299 $event = array("category" => 1001, "prio" => 50, $event = array("category" => 1001, "prio" => 50,
300 'ui' => array('email' => $ui['confirmed'] > 0 ? $ui['email'] : ""),
300 'ui' => array(
301 'uid' => $ui['uid'],
302 'email' => $ui['confirmed'] > 0 ? $ui['email'] : "",
303 ),
301 304 "keys" => implode(",", $my_list)); "keys" => implode(",", $my_list));
302 305 $r = rg_event_add($db, $event); $r = rg_event_add($db, $event);
303 306 if ($r !== TRUE) { if ($r !== TRUE) {
 
... ... function rg_keys_add($db, $ui, $key)
403 406 rg_sql_free_result($res); rg_sql_free_result($res);
404 407
405 408 $event = array("category" => 1000, "prio" => 50, $event = array("category" => 1000, "prio" => 50,
406 'ui' => array('email' => $ui['confirmed'] > 0 ? $ui['email'] : ""),
409 'ui' => array(
410 'uid' => $ui['uid'],
411 'email' => $ui['confirmed'] > 0 ? $ui['email'] : ""
412 ),
407 413 'ki' => $ki, 'ki' => $ki,
408 414 'key_id' => $key_id); 'key_id' => $key_id);
409 415 $r = rg_event_add($db, $event); $r = rg_event_add($db, $event);
File inc/mail.inc.php changed (mode: 100644) (index 24dc5b0..54da215)
... ... function rg_mail_template($template, $more)
33 33 if (empty($more['ui']['email'])) if (empty($more['ui']['email']))
34 34 return TRUE; return TRUE;
35 35
36 if (!isset($more['debug']))
37 $more['debug'] = 0;
38
36 39 $more['HTML:rg_admin_email'] = $rg_admin_email; $more['HTML:rg_admin_email'] = $rg_admin_email;
37 40 $more['HTML:utf8_rg_admin_name'] = "=?UTF-8?B?" $more['HTML:utf8_rg_admin_name'] = "=?UTF-8?B?"
38 41 . base64_encode($rg_admin_name) . "?="; . base64_encode($rg_admin_name) . "?=";
File inc/repo.inc.php changed (mode: 100644) (index e877bfb..80f6ce7)
... ... function rg_repo_delete($db, $repo_id, $ui)
789 789
790 790 $event = array("category" => 3001, "prio" => 50, $event = array("category" => 3001, "prio" => 50,
791 791 'ui' => array( 'ui' => array(
792 'email' => $ui['confirmed'] > 0 ? $ui['email'] : ""),
792 'email' => $ui['confirmed'] > 0 ? $ui['email'] : "",
793 'uid' => $ui['uid']),
793 794 'ri' => array( 'ri' => array(
794 795 'name' => $ri['name'], 'name' => $ri['name'],
795 796 'repo_id' => $repo_id 'repo_id' => $repo_id
File inc/user.inc.php changed (mode: 100644) (index b7511a6..e739774)
... ... function rg_user_event_login($db, $event)
74 74 { {
75 75 $ret = FALSE; $ret = FALSE;
76 76 while (1) { while (1) {
77 $r = rg_user_set_last_seen($db, $event['uid'], $event['itime'],
77 $r = rg_user_set_last_seen($db, $event['ui']['uid'], $event['itime'],
78 78 $event['ip']); $event['ip']);
79 79 if ($r !== TRUE) if ($r !== TRUE)
80 80 break; break;
 
... ... function rg_user_login_by_user_pass($db, $user, $pass, $login_token, $lock_ip,
925 925 } }
926 926
927 927 $event = array( $event = array(
928 'ui' => array('uid' => $ui0['uid']),
928 929 'category' => 2001, 'category' => 2001,
929 930 'prio' => 100, 'prio' => 100,
930 'uid' => $ui0['uid'],
931 931 'itime' => time()); 'itime' => time());
932 932 $r = rg_event_add($db, $event); $r = rg_event_add($db, $event);
933 933 if ($r !== TRUE) { if ($r !== TRUE) {
 
... ... function rg_user_forgot_pass_uid($db, $token)
1190 1190 */ */
1191 1191 function rg_user_forgot_pass_mail_prepare($db, $email) function rg_user_forgot_pass_mail_prepare($db, $email)
1192 1192 { {
1193 rg_prof_start('user_forgot_pass_mail_prepare');
1193 1194 rg_log_enter("user_forgot_pass_mail_prepare: email=$email"); rg_log_enter("user_forgot_pass_mail_prepare: email=$email");
1194 1195
1195 1196 $ret = array(); $ret = array();
 
... ... function rg_user_forgot_pass_mail_prepare($db, $email)
1234 1235 rg_log("DEBUG: user_forgot_pass_mail_prepare: ret=" . rg_array2string($ret)); rg_log("DEBUG: user_forgot_pass_mail_prepare: ret=" . rg_array2string($ret));
1235 1236
1236 1237 rg_log_exit(); rg_log_exit();
1238 rg_prof_end('user_forgot_pass_mail_prepare');
1237 1239 return $ret; return $ret;
1238 1240 } }
1239 1241
1240 1242 /* /*
1241 1243 * Reset password function (send mail) * Reset password function (send mail)
1244 * TODO: Convert to rg_mail_template! Maybe also other functions!
1242 1245 */ */
1243 1246 function rg_user_forgot_pass_mail($db, $email) function rg_user_forgot_pass_mail($db, $email)
1244 1247 { {
1245 1248 global $php_errormsg; global $php_errormsg;
1246 1249 global $rg_admin_name, $rg_admin_email; global $rg_admin_name, $rg_admin_email;
1247 1250
1248 rg_log("user_forgot_pass_mail: email=$email");
1251 rg_prof_start('user_forgot_pass_mail');
1252 rg_log_enter("user_forgot_pass_mail: email=$email");
1249 1253
1250 1254 $ret = array(); $ret = array();
1251 1255 $ret['ok'] = 0; $ret['ok'] = 0;
 
... ... function rg_user_forgot_pass_mail($db, $email)
1284 1288
1285 1289 rg_log("DEBUG: user_forgot_pass_mail: ret=" . rg_array2string($ret) . "."); rg_log("DEBUG: user_forgot_pass_mail: ret=" . rg_array2string($ret) . ".");
1286 1290 rg_log_exit(); rg_log_exit();
1291 rg_prof_end('user_forgot_pass_mail');
1287 1292 return $ret; return $ret;
1288 1293 } }
1289 1294
 
... ... function rg_user_forgot_pass_mail($db, $email)
1292 1297 */ */
1293 1298 function rg_user_forgot_pass_destroy($db, $uid) function rg_user_forgot_pass_destroy($db, $uid)
1294 1299 { {
1300 rg_prof_start('user_forgot_pass_destroy');
1295 1301 rg_log_enter("user_forgot_pass_destroy: uid=$uid"); rg_log_enter("user_forgot_pass_destroy: uid=$uid");
1296 1302
1297 1303 $ret = FALSE; $ret = FALSE;
 
... ... function rg_user_forgot_pass_destroy($db, $uid)
1310 1316 } }
1311 1317
1312 1318 rg_log_exit(); rg_log_exit();
1319 rg_prof_end('user_forgot_pass_destroy');
1313 1320 return $ret; return $ret;
1314 1321 } }
1315 1322
File inc/webhooks.inc.php changed (mode: 100644) (index 4306a6f..29610f0)
... ... function rg_wh_send_one($db, $event)
93 93 curl_setopt($c, CURLOPT_SSLCERT, $cert_file); curl_setopt($c, CURLOPT_SSLCERT, $cert_file);
94 94 } else { } else {
95 95 rg_log('DEBUG: will NOT provide client cert...'); rg_log('DEBUG: will NOT provide client cert...');
96 // TODO: Somehow, without next line, the cert is still sent!
97 curl_setopt($c, CURLOPT_SSLCERT, FALSE);
96 98 } }
97 99
98 100 if (!empty($info['client_ca_cert'])) { if (!empty($info['client_ca_cert'])) {
 
... ... function rg_wh_send_one($db, $event)
102 104 break; break;
103 105
104 106 curl_setopt($c, CURLOPT_CAINFO, $ca_file); curl_setopt($c, CURLOPT_CAINFO, $ca_file);
107 } else {
108 curl_setopt($c, CURLOPT_CAINFO, FALSE);
105 109 } }
106 110
107 111 $r = curl_exec($c); $r = curl_exec($c);
File root/themes/default/main.html changed (mode: 100644) (index 8263e9a..66e0003)
47 47 <div class="island_title">Business</div> <div class="island_title">Business</div>
48 48 Perhaps you want to know how we intend to sustain this business without Perhaps you want to know how we intend to sustain this business without
49 49 a mandatory fee for using our software. We plan to do this by a mandatory fee for using our software. We plan to do this by
50 offering paid support, by charging for customization, by accepting ads
51 (very targeted and no Flash/JavaScript) and
50 offering paid support, by charging for customizations,
51 by accepting ads (very targeted and no Flash/JavaScript) and
52 52 <a href="/op/donate">donations</a>. <a href="/op/donate">donations</a>.
53 53 Please support us to be able to keep this project going. Please support us to be able to keep this project going.
54 54 </div> </div>
File scripts/cache.php changed (mode: 100644) (index c84af51..7d4a27c)
... ... function rg_handle_command($k, &$conn_table, $cmd)
194 194 if (strcmp($cmd, "SLEEP") == 0) { if (strcmp($cmd, "SLEEP") == 0) {
195 195 rg_log('Sleeping...'); rg_log('Sleeping...');
196 196 $buf = 'OK ' . $id . "\n"; $buf = 'OK ' . $id . "\n";
197 sleep(1);
197 sleep(3);
198 198 } }
199 199
200 200 break; break;
File tests/cache.php changed (mode: 100644) (index 137abe8..69233f4)
... ... rg_cache_core_unset("x::y::z");
49 49 $e = FALSE; $e = FALSE;
50 50 $r = rg_cache_core_get("x::y::z"); $r = rg_cache_core_get("x::y::z");
51 51 if ($r !== $e) { if ($r !== $e) {
52 print_r($rg_cache);
52 rg_log_ml('rg_cache: ' . print_r($rg_cache, TRUE));
53 53 rg_log("r must be FALSE ($r)!"); rg_log("r must be FALSE ($r)!");
54 54 exit(1); exit(1);
55 55 } }
 
... ... rg_cache_core_apush("v", "aa");
62 62 $e = "0=[1] 1=[2] 2=[aa]"; $e = "0=[1] 1=[2] 2=[aa]";
63 63 $r = rg_cache_core_adump("v"); $r = rg_cache_core_adump("v");
64 64 if ($r !== $e) { if ($r !== $e) {
65 print_r($rg_cache);
65 rg_log_ml('rg_cache: ' . print_r($rg_cache, TRUE));
66 66 rg_log("[$r] != [$e]!"); rg_log("[$r] != [$e]!");
67 67 exit(1); exit(1);
68 68 } }
 
... ... if ($r !== $e) {
70 70 $e = "aa"; $e = "aa";
71 71 $r = rg_cache_core_apop("v"); $r = rg_cache_core_apop("v");
72 72 if ($r !== $e) { if ($r !== $e) {
73 print_r($rg_cache);
73 rg_log_ml('rg_cache: ' . print_r($rg_cache, TRUE));
74 74 rg_log("[$r] != [$e]!"); rg_log("[$r] != [$e]!");
75 75 exit(1); exit(1);
76 76 } }
 
... ... if ($r !== $e) {
78 78 $e = "1"; $e = "1";
79 79 $r = rg_cache_core_ashift("v"); $r = rg_cache_core_ashift("v");
80 80 if ($r !== $e) { if ($r !== $e) {
81 print_r($rg_cache);
81 rg_log_ml('rg_cache: ' . print_r($rg_cache, TRUE));
82 82 rg_log("[$r] != [$e]!"); rg_log("[$r] != [$e]!");
83 83 exit(1); exit(1);
84 84 } }
 
... ... $e = FALSE;
87 87 $r = rg_cache_core_ashift("v"); $r = rg_cache_core_ashift("v");
88 88 $r = rg_cache_core_ashift("v"); $r = rg_cache_core_ashift("v");
89 89 if ($r !== $e) { if ($r !== $e) {
90 print_r($rg_cache);
90 rg_log_ml('rg_cache: ' . print_r($rg_cache, TRUE));
91 91 rg_log("r is not FALSE ($r)!"); rg_log("r is not FALSE ($r)!");
92 92 exit(1); exit(1);
93 93 } }
 
... ... rg_cache_set('test::B', 'B', 0);
101 101 rg_cache_sleep(); rg_cache_sleep();
102 102 $rg_cache = array(); $rg_cache = array();
103 103 rg_cache_get('test::B'); rg_cache_get('test::B');
104 $rg_cache_timeout = 3000;
104 $rg_cache_timeout = 6000;
105 105 $r = rg_cache_get('test::A'); $r = rg_cache_get('test::A');
106 106 if ($r !== 'A') { if ($r !== 'A') {
107 rg_log('Small timeout test failed! r=' . print_r($r));
107 rg_log('Small timeout test failed! r=' . print_r($r, TRUE));
108 108 exit(1); exit(1);
109 109 } }
110 110
File tests/http_create_account.php changed (mode: 100644) (index afeb93d..a8c2f9e)
... ... $data['token'] = $r['tokens']['user_edit_hl'];
53 53 $data['tos'] = 1; $data['tos'] = 1;
54 54 $headers = array("Cookie: sid=" . $good_sid); $headers = array("Cookie: sid=" . $good_sid);
55 55 $r = do_req($test_url . "/op/create_account?t=create_account", $data, $headers); $r = do_req($test_url . "/op/create_account?t=create_account", $data, $headers);
56 if (!strstr($r['body'], "Your account has been created")) {
56 if (!strstr($r['body'], "Your account has been successfully created")) {
57 rg_log_ml('body: ' . print_r($r['body'], TRUE));
57 58 rg_log("Cannot create account"); rg_log("Cannot create account");
58 59 exit(1); exit(1);
59 60 } }
File tests/http_settings.php changed (mode: 100644) (index 3bc0787..8cc001c)
... ... $data = array(
70 70 ); );
71 71 $headers = array("Cookie: sid=" . $good_sid); $headers = array("Cookie: sid=" . $good_sid);
72 72 $r = do_req($test_url . "/op/settings/change_pass?t=post_change_pass_form", $data, $headers); $r = do_req($test_url . "/op/settings/change_pass?t=post_change_pass_form", $data, $headers);
73 if (!strstr($r['body'], "Password has been updated with success")) {
73 if (!strstr($r['body'], "Password has been successfully updated")) {
74 74 rg_log_ml('r: ' . print_r($r, TRUE)); rg_log_ml('r: ' . print_r($r, TRUE));
75 75 rg_log("Cannot change pass!"); rg_log("Cannot change pass!");
76 76 exit(1); exit(1);
 
... ... $data = array(
141 141 ); );
142 142 $headers = array("Cookie: sid=" . $good_sid); $headers = array("Cookie: sid=" . $good_sid);
143 143 $r = do_req($test_url . "/op/settings/edit_info?t=post_edit_info_form", $data, $headers); $r = do_req($test_url . "/op/settings/edit_info?t=post_edit_info_form", $data, $headers);
144 if (!strstr($r['body'], "Information has been updated with success")) {
144 if (!strstr($r['body'], "Information has been successfully updated")) {
145 145 rg_log_ml('r: ' . print_r($r, TRUE)); rg_log_ml('r: ' . print_r($r, TRUE));
146 rg_log("Cannot change back the pass to aaaa!");
146 rg_log("Cannot change account info!");
147 147 exit(1); exit(1);
148 148 } }
149 149
File tests/wh-stunnel.conf changed (mode: 100644) (index 15a129b..8fce8b8)
... ... log = overwrite
3 3 CAfile = ca/wh/certs/cacert.pem CAfile = ca/wh/certs/cacert.pem
4 4 cert = ca/wh/certs/localhost.pem cert = ca/wh/certs/localhost.pem
5 5 key = ca/wh/private/localhost.key key = ca/wh/private/localhost.key
6 output = wh-stunnel-@@port@@.log
6 output = wh-stunnel-@@id@@.log
7 7 foreground = yes foreground = yes
8 8 exec = ./wh-helper.sh exec = ./wh-helper.sh
9 9 syslog = no syslog = no
 
... ... socket = a:SO_REUSEADDR=yes
11 11
12 12 [me] [me]
13 13 accept = 127.0.0.1:@@port@@ accept = 127.0.0.1:@@port@@
14 verify = 2
14 verify = @@verify@@
File tests/wh.php changed (mode: 100644) (index 0bbf288..9c902f0)
... ... $rg_event_socket = "/var/lib/rocketgit/sockets/event.sock";
22 22
23 23 $port1 = 64000 + (rand(0, 100000) + time()) % 1000; $port1 = 64000 + (rand(0, 100000) + time()) % 1000;
24 24 $port2 = $port1 + 1; $port2 = $port1 + 1;
25 rg_log('port1=' . $port1 . ' port2=' . $port2);
25 $port3 = $port2 + 1;
26 rg_log('port1=' . $port1 . ' port2=' . $port2 . ' port3=' . $port3);
26 27
27 28 function clean() function clean()
28 29 { {
29 system('fuser -k wh-stunnel-1.log 1>/dev/null 2>&1');
30 system('fuser -k wh-stunnel-2.log 1>/dev/null 2>&1');
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');
31 33
32 34 @unlink('wh-stunnel.conf-1.tmp'); @unlink('wh-stunnel.conf-1.tmp');
33 35 @unlink('wh-stunnel.conf-2.tmp'); @unlink('wh-stunnel.conf-2.tmp');
36 @unlink('wh-stunnel.conf-3.tmp');
34 37 } }
35 38 register_shutdown_function('clean'); register_shutdown_function('clean');
36 39
 
... ... if ($x === FALSE) {
52 55 rg_log('Cannot load conf file'); rg_log('Cannot load conf file');
53 56 exit(1); exit(1);
54 57 } }
58
55 59 $y = str_replace('@@port@@', $port1, $x); $y = str_replace('@@port@@', $port1, $x);
60 $y = str_replace('@@verify@@', '2', $y);
61 $y = str_replace('@@id@@', '1', $y);
56 62 file_put_contents('wh-stunnel.conf-1.tmp', $y); file_put_contents('wh-stunnel.conf-1.tmp', $y);
63
57 64 $y = str_replace('@@port@@', $port2, $x); $y = str_replace('@@port@@', $port2, $x);
65 $y = str_replace('@@verify@@', '2', $y);
66 $y = str_replace('@@id@@', '2', $y);
58 67 file_put_contents('wh-stunnel.conf-2.tmp', $y); file_put_contents('wh-stunnel.conf-2.tmp', $y);
59 68
69 $y = str_replace('@@port@@', $port3, $x);
70 $y = str_replace('@@verify@@', '0', $y);
71 $y = str_replace('@@id@@', '3', $y);
72 file_put_contents('wh-stunnel.conf-3.tmp', $y);
73
60 74
61 75 rg_log(''); rg_log('');
62 76 rg_log('Starting stunnel1...'); rg_log('Starting stunnel1...');
 
... ... if ($pid == 0) { //child
86 100 rg_log('Started stunnel with pid ' . $pid); rg_log('Started stunnel with pid ' . $pid);
87 101
88 102
103 rg_log('');
104 rg_log('Starting stunnel3...');
105 $pid = pcntl_fork();
106 if ($pid == -1) {
107 rg_log('Cannot fork');
108 exit(1);
109 }
110 if ($pid == 0) { //child
111 $r = exec('stunnel wh-stunnel.conf-3.tmp 2>/dev/null');
112 exit(0);
113 }
114 rg_log('Started stunnel with pid ' . $pid);
115
116
89 117 rg_log(''); rg_log('');
90 118 rg_log("Creating a user..."); rg_log("Creating a user...");
91 119 rg_test_create_user($db, $rg_ui); rg_test_create_user($db, $rg_ui);
92 120 $key1 = 'DEBUG::' . $rg_ui['uid'] . '::webhooks::' . $port1; $key1 = 'DEBUG::' . $rg_ui['uid'] . '::webhooks::' . $port1;
93 121 $key2 = 'DEBUG::' . $rg_ui['uid'] . '::webhooks::' . $port2; $key2 = 'DEBUG::' . $rg_ui['uid'] . '::webhooks::' . $port2;
122 $key3 = 'DEBUG::' . $rg_ui['uid'] . '::webhooks::' . $port3;
94 123
95 124
96 125 rg_log(''); rg_log('');
 
... ... $extra = array(
137 166 rg_test_wh_add_edit($db, $rg_ui, $good_sid, $extra); rg_test_wh_add_edit($db, $rg_ui, $good_sid, $extra);
138 167
139 168
169 rg_log('');
170 rg_log('Registering webhook3...');
171 $extra = array(
172 'wh::url' => 'https://localhost:' . $port3 . '/wh.html',
173 'wh::type' => 1,
174 'wh::events[C]' => 'on',
175 'wh::events[P]' => 'on',
176 'wh::events[B]' => 'on',
177 'wh::description' => 'description1 <xss>',
178 'wh::key' => 'key2 <xss>',
179 'wh::opaque' => $port3,
180 'wh::client_cert' => '',
181 'wh::client_ca_cert' => file_get_contents('ca/wh/certs/cacert.pem')
182 );
183 rg_test_wh_add_edit($db, $rg_ui, $good_sid, $extra);
184
185
140 186 rg_log('Finding out the ids...'); rg_log('Finding out the ids...');
141 187 for ($i = 0; $i < 10; $i++) { for ($i = 0; $i < 10; $i++) {
142 188 $r = rg_cache_get('user::' . $rg_ui['uid'] . '::wh'); $r = rg_cache_get('user::' . $rg_ui['uid'] . '::wh');
 
... ... rg_log_ml('r=' . print_r($r, TRUE));
152 198 $t = array_keys($r); $t = array_keys($r);
153 199 $wh_id1 = $t[0]; $wh_id1 = $t[0];
154 200 $wh_id2 = $t[1]; $wh_id2 = $t[1];
201 $wh_id3 = $t[2];
155 202 rg_log('wh_id1=' . $wh_id1); rg_log('wh_id1=' . $wh_id1);
156 203 rg_log('wh_id2=' . $wh_id2); rg_log('wh_id2=' . $wh_id2);
204 rg_log('wh_id3=' . $wh_id3);
157 205
158 206
159 207 rg_log(''); rg_log('');
 
... ... if (strcmp($r, "OK") != 0) {
198 246 } }
199 247
200 248
249 rg_log('');
250 rg_log('Testing if the curl posted with success (wh3)');
251 for ($i = 0; $i < 10; $i++) {
252 $r = rg_cache_get($key3 . '::' . $wh_id3);
253 rg_log_ml('cache: ' . print_r($r, TRUE));
254 if ($r !== FALSE)
255 break;
256 sleep(1);
257 }
258 if (strcmp($r, "OK") != 0) {
259 rg_log('Seems wh3 did not returned success'
260 . ' (r=' . $r . ')!');
261 exit(1);
262 }
263
264
201 265 rg_log(''); rg_log('');
202 266 rg_log('Testing the edit of webhook1...'); rg_log('Testing the edit of webhook1...');
203 267 $extra = array( $extra = array(
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/catalinux/rocketgit

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/catalinux/rocketgit

Clone this repository using git:
git clone git://git.rocketgit.com/user/catalinux/rocketgit

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main