List of commits:
Subject Hash Author Date (UTC)
Added rg_sid global variable to simplify the function calling 0047908fcd2ed0302a826487ddd15ca2579a9a83 Catalin(ux) M. BOIE 2023-06-14 17:06:39
Removed delta support for rpms because Fedora will remove it 2c26be90f4bc08a06ab03ab016e9ccaa843780e5 Catalin(ux) M. BOIE 2023-05-03 05:04:40
Added first payments option; fixes all around 7102aed9f239d529723799171553e8c4bd018440 Catalin(ux) M. BOIE 2023-05-02 22:36:28
Fixed a nasty typo in the build system; doc update; cosmetic 1934732b297d6476be7954fabdcaf9eb87678f5e Catalin(ux) M. BOIE 2022-12-21 12:51:53
Send client features to the builder dcf648353662409b9e39a422228ddb6a7c43358c Catalin(ux) M. BOIE 2022-12-21 11:10:00
Add support for SHA-256 git repos 8b88927d353c7b588909d0b1220c8922b32129c0 Catalin(ux) M. BOIE 2022-12-21 11:03:19
Look-up pkg_repo using pkg_repo uid f2b188b8cb151c376d8ee8c81f8e82c02ed93cd1 Catalin(ux) M. BOIE 2022-12-12 05:29:13
Cosmetic 04ae5ac6b9805198966a21755d1d430ef5b6a6dd Catalin(ux) M. BOIE 2022-12-11 17:17:39
Keep-alive mechanism for builder/worker 7e3add2ab41feefe37a858439934b8599fb30933 Catalin(ux) M. BOIE 2022-12-10 19:36:53
Bumped version to 0.76 09bb0cc92a9dfce513ce1289a22e71faf4ad1fe1 Catalin(ux) M. BOIE 2022-10-22 06:27:35
Cosmetic 45c59081c97489ccccd35efffa522607fee25a63 Catalin(ux) M. BOIE 2022-10-22 05:52:56
Mostly worker stuff ccf3a8d8da2ad1b0d97418fabb5028b40721835f Catalin(ux) M. BOIE 2022-10-22 05:50:04
wh: lambda: seems we cannot pass x-Amz-Client-Context header empty anymore 7f065b0fb6ceed5d2339afd7590f5a795ed3582e Catalin(ux) M. BOIE 2022-10-21 19:33:58
workers: wrong URL for delete a2b2ff5925b1ee9b4a033da93084c008b7af8c64 Catalin(ux) M. BOIE 2022-10-21 16:03:56
Typo 4557595fb985fb2a0a482a387ef0a61293b511ed Catalin(ux) M. BOIE 2022-03-29 17:06:57
Builder improvements 2c27620922c4990454dc3039b2f1c4a86388501f Catalin(ux) M. BOIE 2022-03-29 06:28:16
Extra space in debian/conffiles preventing Debian build 416ed9995151c29bffb4ca3f0f6901aab7cbaa8e Catalin(ux) M. BOIE 2022-03-28 19:36:06
Show global pkg sub repos; cosmetic 43f60158b760b2789261e703ff2fa0781f590e04 Catalin(ux) M. BOIE 2022-03-28 18:21:07
Cosmetic a60d33914b8a1754c84ddc5440533df9b89337ad Catalin(ux) M. BOIE 2022-03-16 07:40:37
Cosmetic 8bb684cb885e0ad0f24519990a564031ea0e43a9 Catalin(ux) M. BOIE 2022-02-19 08:12:45
Commit 0047908fcd2ed0302a826487ddd15ca2579a9a83 - Added rg_sid global variable to simplify the function calling
Author: Catalin(ux) M. BOIE
Author date (UTC): 2023-06-14 17:06
Committer name: Catalin(ux) M. BOIE
Committer date (UTC): 2023-06-14 17:06
Parent(s): 2c26be90f4bc08a06ab03ab016e9ccaa843780e5
Signer:
Signing key:
Signing status: N
Tree: 04240d71ec9df47dd8e254f17ff15e49b7985c1c
File Lines added Lines deleted
inc/dispatch/dispatch.php 1 1
inc/sess.inc.php 36 14
inc/token.inc.php 19 13
inc/user.inc.php 7 15
root/index.php 7 7
tests/token.php 9 8
File inc/dispatch/dispatch.php changed (mode: 100644) (index 4b93d76..995502b)
... ... case 'logout':
26 26
27 27 rg_user_set_last_seen($db, $ui_login['uid'], time(), rg_ip()); rg_user_set_last_seen($db, $ui_login['uid'], time(), rg_ip());
28 28
29 if (rg_sess_destroy($db, $rg['sid'])) {
29 if (rg_sess_destroy($db)) {
30 30 $body .= rg_template('user/logout.html', $rg, TRUE /*xss*/); $body .= rg_template('user/logout.html', $rg, TRUE /*xss*/);
31 31 } else { } else {
32 32 $body .= rg_template('user/logout_err.html', $rg, TRUE /*xss*/); $body .= rg_template('user/logout_err.html', $rg, TRUE /*xss*/);
File inc/sess.inc.php changed (mode: 100644) (index ef7eb3a..9a30936)
... ... require_once(__DIR__ . '/sql.inc.php');
4 4 require_once(__DIR__ . '/token.inc.php'); require_once(__DIR__ . '/token.inc.php');
5 5 require_once(__DIR__ . '/prof.inc.php'); require_once(__DIR__ . '/prof.inc.php');
6 6
7 $rg_sid = '';
8
7 9 /* /*
8 10 * Add a session * Add a session
9 11 */ */
10 12 function rg_sess_add($db, $uid, $sid, $session_time, $lock_ip) function rg_sess_add($db, $uid, $sid, $session_time, $lock_ip)
11 13 { {
14 global $rg_sid;
15
12 16 rg_prof_start("sess_add"); rg_prof_start("sess_add");
13 17 rg_log_enter("sess_add: uid=$uid, sid=$sid, session_time=$session_time" rg_log_enter("sess_add: uid=$uid, sid=$sid, session_time=$session_time"
14 18 . " lock_ip=$lock_ip"); . " lock_ip=$lock_ip");
 
... ... function rg_sess_add($db, $uid, $sid, $session_time, $lock_ip)
40 44 rg_cache_set('sess' . '::' . $sid . '::' . 'info', rg_cache_set('sess' . '::' . $sid . '::' . 'info',
41 45 $params, RG_SOCKET_NO_WAIT); $params, RG_SOCKET_NO_WAIT);
42 46
47 $rg_sid = $sid;
48
43 49 $ret = TRUE; $ret = TRUE;
44 50 break; break;
45 51 } }
 
... ... function rg_sess_add($db, $uid, $sid, $session_time, $lock_ip)
53 59 * Tests if a session is still valid. Will return FALSE on error or session * Tests if a session is still valid. Will return FALSE on error or session
54 60 * info. * info.
55 61 */ */
56 function rg_sess_valid($db, $sid)
62 function rg_sess_valid($db)
57 63 { {
64 global $rg_sid;
65
58 66 rg_prof_start("sess_valid"); rg_prof_start("sess_valid");
59 rg_log_enter("sess_valid: sid=$sid...");
67 rg_log_enter("sess_valid: sid=$rg_sid...");
60 68
61 69 $ret = FALSE; $ret = FALSE;
62 70 while (1) { while (1) {
63 $r = rg_cache_get('sess' . '::' . $sid . '::' . 'info');
71 if (empty($rg_sid))
72 break;
73
74 // Is a pre-login session?
75 if (strncmp($rg_sid, 'X', 1) == 0)
76 break;
77
78 $r = rg_cache_get('sess' . '::' . $rg_sid . '::' . 'info');
64 79 if ($r === FALSE) { if ($r === FALSE) {
65 $params = array("sid" => $sid);
80 $params = array("sid" => $rg_sid);
66 81 $sql = "SELECT * FROM sess WHERE sid = @@sid@@"; $sql = "SELECT * FROM sess WHERE sid = @@sid@@";
67 82 $res = rg_sql_query_params($db, $sql, $params); $res = rg_sql_query_params($db, $sql, $params);
68 83 if ($res === FALSE) { if ($res === FALSE) {
 
... ... function rg_sess_valid($db, $sid)
73 88 if ($rows > 0) { if ($rows > 0) {
74 89 $r = rg_sql_fetch_array($res); $r = rg_sql_fetch_array($res);
75 90 $r['last_db_write'] = $r['expire'] - $r['session_time']; $r['last_db_write'] = $r['expire'] - $r['session_time'];
76 rg_cache_set('sess' . '::' . $sid . '::' . 'info',
91 rg_cache_set('sess' . '::' . $rg_sid . '::' . 'info',
77 92 $r, RG_SOCKET_NO_WAIT); $r, RG_SOCKET_NO_WAIT);
78 93 } }
79 94 rg_sql_free_result($res); rg_sql_free_result($res);
 
... ... function rg_sess_valid($db, $sid)
101 116 rg_log("Session valid, uid=$uid, expire=+" rg_log("Session valid, uid=$uid, expire=+"
102 117 . ($r['expire'] - $now) . "s"); . ($r['expire'] - $now) . "s");
103 118 $ret = $r; $ret = $r;
119 unset($ret['sid']);
104 120 break; break;
105 121 } }
106 122
 
... ... function rg_sess_valid($db, $sid)
116 132 */ */
117 133 function rg_sess_update($db, $sess) function rg_sess_update($db, $sess)
118 134 { {
135 global $rg_sid;
136
119 137 rg_prof_start("sess_update"); rg_prof_start("sess_update");
120 138 rg_log_enter("sess_update: sess=" . rg_array2string($sess)); rg_log_enter("sess_update: sess=" . rg_array2string($sess));
121 139
 
... ... function rg_sess_update($db, $sess)
131 149 } }
132 150
133 151 $sess['expire'] = $now + $sess['session_time']; $sess['expire'] = $now + $sess['session_time'];
152 $params = $sess;
153 $params['sid'] = $rg_sid;
134 154 $sql = "UPDATE sess SET expire = @@expire@@" $sql = "UPDATE sess SET expire = @@expire@@"
135 155 . " WHERE sid = @@sid@@"; . " WHERE sid = @@sid@@";
136 $res = rg_sql_query_params($db, $sql, $sess);
156 $res = rg_sql_query_params($db, $sql, $params);
137 157 if ($res === FALSE) { if ($res === FALSE) {
138 158 rg_log("Cannot update (" . rg_sql_error() . ")!"); rg_log("Cannot update (" . rg_sql_error() . ")!");
139 159 // We will not exit here. At least in cache to be ok // We will not exit here. At least in cache to be ok
 
... ... function rg_sess_update($db, $sess)
142 162 rg_sql_free_result($res); rg_sql_free_result($res);
143 163 } }
144 164
145 rg_cache_set('sess' . '::' . $sess['sid'] . '::' . 'info',
165 rg_cache_set('sess' . '::' . $rg_sid . '::' . 'info',
146 166 $sess, RG_SOCKET_NO_WAIT); $sess, RG_SOCKET_NO_WAIT);
147 167
148 168 $ret = TRUE; $ret = TRUE;
 
... ... function rg_sess_update($db, $sess)
157 177 /* /*
158 178 * Destroy session * Destroy session
159 179 */ */
160 function rg_sess_destroy($db, $sid)
180 function rg_sess_destroy($db)
161 181 { {
162 rg_prof_start("sess_destroy");
163 rg_log_enter("sess_destroy: sid=$sid...");
182 global $rg_sid;
183
184 rg_prof_start('sess_destroy');
185 rg_log_enter('sess_destroy: sid=' . $rg_sid);
164 186
165 187 $ret = FALSE; $ret = FALSE;
166 188 while (1) { while (1) {
167 $params = array("sid" => $sid);
189 $params = array("sid" => $rg_sid);
168 190 $sql = "DELETE FROM sess WHERE sid = @@sid@@"; $sql = "DELETE FROM sess WHERE sid = @@sid@@";
169 191 $res = rg_sql_query_params($db, $sql, $params); $res = rg_sql_query_params($db, $sql, $params);
170 192 if ($res === FALSE) { if ($res === FALSE) {
 
... ... function rg_sess_destroy($db, $sid)
174 196 rg_sql_free_result($res); rg_sql_free_result($res);
175 197
176 198 // Delete all tokens associated with this session // Delete all tokens associated with this session
177 rg_token_delete($db, $sid, '');
199 rg_token_delete($db, $rg_sid, '');
178 200
179 201 rg_ui_login_reset(); rg_ui_login_reset();
180 202
181 rg_cache_unset('sess' . '::' . $sid . '::'. 'info',
203 rg_cache_unset('sess' . '::' . $rg_sid . '::'. 'info',
182 204 RG_SOCKET_NO_WAIT); RG_SOCKET_NO_WAIT);
183 205
184 206 $ret = TRUE; $ret = TRUE;
 
... ... function rg_sess_destroy($db, $sid)
186 208 } }
187 209
188 210 rg_log_exit(); rg_log_exit();
189 rg_prof_end("sess_destroy");
211 rg_prof_end('sess_destroy');
190 212 return $ret; return $ret;
191 213 } }
192 214
File inc/token.inc.php changed (mode: 100644) (index 8a5336c..b13fc12)
... ... function rg_token_get_master($db)
100 100 */ */
101 101 function rg_token_valid($db, $rg, $tag, $double_allowed) function rg_token_valid($db, $rg, $tag, $double_allowed)
102 102 { {
103 global $rg_sid; // TODO: sess depends on token...
104
103 105 rg_prof_start("token_valid"); rg_prof_start("token_valid");
104 rg_log_enter('token_valid: sid=' . $rg['sid'] . ' token=' . $rg['token']
106 rg_log_enter('token_valid: sid=' . $rg_sid . ' token=' . $rg['token']
105 107 . ' tag=' . $tag); . ' tag=' . $tag);
106 108
107 109 $ret = FALSE; $ret = FALSE;
 
... ... function rg_token_valid($db, $rg, $tag, $double_allowed)
121 123 $rand = substr($rg['token'], 0, 16); $rand = substr($rg['token'], 0, 16);
122 124 $sign = substr($rg['token'], 16, 16); $sign = substr($rg['token'], 16, 16);
123 125
124 $data = $rand . $rg['sid'] . $tag;
126 $data = $rand . $rg_sid . $tag;
125 127 $hash = hash_hmac('sha512', $data, $key); $hash = hash_hmac('sha512', $data, $key);
126 128 if ($hash === FALSE) { if ($hash === FALSE) {
127 129 rg_token_set_error("cannot compute hmac"); rg_token_set_error("cannot compute hmac");
 
... ... function rg_token_valid($db, $rg, $tag, $double_allowed)
137 139 break; break;
138 140 } }
139 141
140 $ukey = 'sess' . '::' . $rg['sid'] . '::' . 'used_tokens'
142 $ukey = 'sess' . '::' . $rg_sid . '::' . 'used_tokens'
141 143 . '::' . $rg['token']; . '::' . $rg['token'];
142 144 $c = rg_cache_get($ukey); $c = rg_cache_get($ukey);
143 145 if ($c === '1') { if ($c === '1') {
 
... ... function rg_token_valid($db, $rg, $tag, $double_allowed)
145 147 break; break;
146 148 } }
147 149
148 $params = array("sid" => $rg['sid'],
150 $params = array("sid" => $rg_sid,
149 151 "token" => $rg['token'], "token" => $rg['token'],
150 152 "expire" => time() + 24 * 3600); "expire" => time() + 24 * 3600);
151 153
 
... ... function rg_token_valid($db, $rg, $tag, $double_allowed)
168 170 } }
169 171 } }
170 172
171 if (strncmp($rg['sid'], "X", 1) == 0) {
173 // TODO: shouldn't we move this before the above query?!
174 if (strncmp($rg_sid, "X", 1) == 0) {
172 175 // We have a pre-login session: we do not have to mark // We have a pre-login session: we do not have to mark
173 176 // the token as used. // the token as used.
174 177 $ret = TRUE; $ret = TRUE;
 
... ... function rg_token_valid($db, $rg, $tag, $double_allowed)
181 184 } }
182 185
183 186 // Unset cached token to generate a new one for this tag // Unset cached token to generate a new one for this tag
184 $tkey = 'sess' . '::' . $rg['sid'] . '::' . 'token'
187 $tkey = 'sess' . '::' . $rg_sid . '::' . 'token'
185 188 . '::' . $tag; . '::' . $tag;
186 189 rg_cache_unset($tkey, RG_SOCKET_NO_WAIT); rg_cache_unset($tkey, RG_SOCKET_NO_WAIT);
187 190
 
... ... function rg_token_valid($db, $rg, $tag, $double_allowed)
213 216 */ */
214 217 function rg_token_get($db, $rg, $tag) function rg_token_get($db, $rg, $tag)
215 218 { {
216 rg_log_enter('token_get: sid=' . $rg['sid'] . ' tag=' . $tag);
219 global $rg_sid;
220
221 rg_log_enter('token_get: sid=' . $rg_sid . ' tag=' . $tag);
217 222
218 223 $ret = FALSE; $ret = FALSE;
219 224 while (1) { while (1) {
220 if (empty($rg['sid']))
225 if (empty($rg_sid)) {
226 rg_token_set_error('empty sid');
221 227 break; break;
228 }
222 229
223 $key = 'sess' . '::' . $rg['sid'] . '::' . 'token' . '::' . $tag;
230 $key = 'sess' . '::' . $rg_sid . '::' . 'token' . '::' . $tag;
224 231 $c = rg_cache_get($key); $c = rg_cache_get($key);
225 232 if ($c !== FALSE) { if ($c !== FALSE) {
226 233 $ret = $c; $ret = $c;
 
... ... function rg_token_get($db, $rg, $tag)
233 240
234 241 // Add a random string to protect against BREACH attack // Add a random string to protect against BREACH attack
235 242 $rand = rg_id(16); $rand = rg_id(16);
236 $data = $rand . $rg['sid'] . $tag;
243 $data = $rand . $rg_sid . $tag;
237 244 $sign = hash_hmac('sha512', $data, $sign_key); $sign = hash_hmac('sha512', $data, $sign_key);
238 245 if ($sign === FALSE) { if ($sign === FALSE) {
239 rg_token_set_error("cannot compute hmac");
246 rg_token_set_error('cannot compute hmac');
240 247 break; break;
241 248 } }
242 249 $sign = substr($sign, 0, 16); $sign = substr($sign, 0, 16);
 
... ... function rg_token_get($db, $rg, $tag)
250 257 rg_cache_set($key, $ret2, RG_SOCKET_NO_WAIT); rg_cache_set($key, $ret2, RG_SOCKET_NO_WAIT);
251 258
252 259 // Optimization to not look in database next time // Optimization to not look in database next time
253 $key = 'sess' . '::' . $rg['sid'] . '::' . 'used_tokens'
260 $key = 'sess' . '::' . $rg_sid . '::' . 'used_tokens'
254 261 . '::' . $ret; . '::' . $ret;
255 262 rg_cache_set($key, '0', RG_SOCKET_NO_WAIT); rg_cache_set($key, '0', RG_SOCKET_NO_WAIT);
256 263
 
... ... function rg_token_get($db, $rg, $tag)
262 269 return $ret; return $ret;
263 270 } }
264 271
265
File inc/user.inc.php changed (mode: 100644) (index 51e07ab..88dbfa4)
... ... function rg_user_remove($db, $rg, $uid)
786 786 rg_sql_free_result($res); rg_sql_free_result($res);
787 787
788 788 // update cache // update cache
789 rg_cache_set('user' . '::' . $uid . '::' . 'info'
789 rg_cache_set('user' . '::' . $ui_login['uid'] . '::' . 'info'
790 790 . '::' . 'deleted', $now, RG_SOCKET_NO_WAIT); . '::' . 'deleted', $now, RG_SOCKET_NO_WAIT);
791 791
792 792 // invalidate session // invalidate session
793 rg_sess_destroy($db, $rg['sid']);
793 rg_sess_destroy($db);
794 794
795 795 $ret = TRUE; $ret = TRUE;
796 796 break; break;
 
... ... function rg_user_set_last_seen($db, $uid, $ts, $ip)
928 928 /* /*
929 929 * Loads ui based on sid, if possible * Loads ui based on sid, if possible
930 930 */ */
931 function rg_user_login_by_sid($db, $rg)
931 function rg_user_login_by_sid($db)
932 932 { {
933 933 rg_prof_start("user_login_by_sid"); rg_prof_start("user_login_by_sid");
934 rg_log_enter("user_login_by_sid: sid=" . $rg['sid']);
934 rg_log_enter('user_login_by_sid');
935 935
936 936 $ret = FALSE; $ret = FALSE;
937 937 while (1) { while (1) {
938 if (empty($rg['sid']))
939 break;
940
941 // Is a pre login sesison?
942 if (strncmp($rg['sid'], "X", 1) == 0)
943 break;
944
945 $sess = rg_sess_valid($db, $rg['sid']);
946 if ($sess == FALSE)
938 $sess = rg_sess_valid($db);
939 if ($sess === FALSE)
947 940 break; break;
948 941
949 942 $uid = $sess['uid']; $uid = $sess['uid'];
 
... ... function rg_user_delete_account_high_level($db, $rg, $paras)
2772 2765 break; break;
2773 2766 } }
2774 2767
2775 $ui_login = rg_ui_login();
2776 $r = rg_user_remove($db, $rg, $ui_login['uid']);
2768 $r = rg_user_remove($db);
2777 2769 if ($r !== TRUE) { if ($r !== TRUE) {
2778 2770 $errmsg[] = rg_user_error(); $errmsg[] = rg_user_error();
2779 2771 break; break;
File root/index.php changed (mode: 100644) (index 4368f76..0166d0c)
... ... if (strcmp($_t, "op") == 0) {
80 80
81 81 $rg['doit'] = rg_var_uint("doit"); $rg['doit'] = rg_var_uint("doit");
82 82 $rg['sid_cookie_name'] = $rg['https'] == 1 ? 'sids' : 'sidu'; $rg['sid_cookie_name'] = $rg['https'] == 1 ? 'sids' : 'sidu';
83 $rg['sid'] = rg_var_cookie_re($rg['sid_cookie_name'], '/[^A-Za-z0-9]/');
83 $rg_sid = rg_var_cookie_re($rg['sid_cookie_name'], '/[^A-Za-z0-9]/');
84 84 $rg['token'] = rg_var_re("token", "A-Za-z0-9"); $rg['token'] = rg_var_re("token", "A-Za-z0-9");
85 85 $user = ""; $repo = ""; $organization = 0; // TODO: those are really used? $user = ""; $repo = ""; $organization = 0; // TODO: those are really used?
86 86
 
... ... $rg['https_allow'] = $https_allow;
196 196 $rg['base_url'] = rg_base_url($db, '', ''); $rg['base_url'] = rg_base_url($db, '', '');
197 197
198 198
199 rg_user_login_by_sid($db, $rg);
199 rg_user_login_by_sid($db);
200 200 // If user provided an old/expired sid, we generate a new one, pre-login // If user provided an old/expired sid, we generate a new one, pre-login
201 201 $ui_login = rg_ui_login(); $ui_login = rg_ui_login();
202 if (($ui_login['uid'] == 0) && (strncmp($rg['sid'], 'X', 1) != 0))
203 $rg['sid'] = '';
204 if (empty($rg['sid'])) {
205 $rg['sid'] = rg_user_set_session_cookie($db, 0 /*uid*/, 600,
202 if (($ui_login['uid'] == 0) && (strncmp($rg_sid, 'X', 1) != 0))
203 $rg_sid = '';
204 if (empty($rg_sid)) {
205 $rg_sid = rg_user_set_session_cookie($db, 0 /*uid*/, 600,
206 206 FALSE /*lock_ip*/, $rg['https'], $rg['hostname']); FALSE /*lock_ip*/, $rg['https'], $rg['hostname']);
207 rg_log('User has no sid, generate one [' . $rg['sid'] . ']');
207 rg_log('User has no sid, generate one [' . $rg_sid . ']');
208 208 } }
209 209
210 210 if (isset($_SERVER['CONTENT_LENGTH'])) if (isset($_SERVER['CONTENT_LENGTH']))
File tests/token.php changed (mode: 100644) (index 4c8fcd7..5aa4595)
... ... rg_log_set_file("token.log");
14 14 $rg_no_db = TRUE; $rg_no_db = TRUE;
15 15 require_once("common.php"); require_once("common.php");
16 16
17 $a = array("ua" => "user-agent1", "sid" => "session1", 'debug' => 1);
17 $rg_sid = 'session1';
18 $a = array('ua' => 'user-agent1', 'debug' => 1);
18 19 $token = rg_token_get($db, $a, 'tag1'); $token = rg_token_get($db, $a, 'tag1');
19 20 if ($token === FALSE) { if ($token === FALSE) {
20 rg_log("Generating a token should not fail (" . rg_token_error() . ")!");
21 rg_log("Generating a token should not fail [A] (" . rg_token_error() . ")!");
21 22 exit(1); exit(1);
22 23 } }
23 24 rg_log("Correct token: $token"); rg_log("Correct token: $token");
 
... ... if ($r === FALSE) {
32 33
33 34 rg_log_enter("Now, test pre-login sessions..."); rg_log_enter("Now, test pre-login sessions...");
34 35 $rg_token = FALSE; /* we must remove it from memory */ $rg_token = FALSE; /* we must remove it from memory */
35 $a = array("ua" => "user-agent1", "sid" => "Xsession2", 'debug' => 1);
36 $rg_sid = 'Xsession2';
37 $a = array("ua" => 'user-agent1', 'debug' => 1);
36 38 $token = rg_token_get($db, $a, 'tag2'); $token = rg_token_get($db, $a, 'tag2');
37 39 if ($token === FALSE) { if ($token === FALSE) {
38 rg_log("Generating a token should not fail (" . rg_token_error() . ")!");
40 rg_log("Generating a token should not fail [B] (" . rg_token_error() . ")!");
39 41 exit(1); exit(1);
40 42 } }
41 43 rg_log("Correct token: $token"); rg_log("Correct token: $token");
 
... ... rg_log_exit();
62 64
63 65 rg_log_enter('Testing double posting...'); rg_log_enter('Testing double posting...');
64 66 $rg_token = FALSE; /* we must remove it from memory */ $rg_token = FALSE; /* we must remove it from memory */
65 $a = array("ua" => "user-agent3",
66 "sid" => "session_double",
67 'debug' => 1);
67 $rg_sid = 'session_double';
68 $a = array('ua' => 'user-agent3', 'debug' => 1);
68 69 $token = rg_token_get($db, $a, 'tag3'); $token = rg_token_get($db, $a, 'tag3');
69 70 if ($token === FALSE) { if ($token === FALSE) {
70 rg_log("Generating a token should not fail (" . rg_token_error() . ")!");
71 rg_log('Generating a token should not fail [C] (' . rg_token_error() . ')!');
71 72 exit(1); exit(1);
72 73 } }
73 74 $a['token'] = $token; $a['token'] = $token;
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