List of commits:
Subject Hash Author Date (UTC)
Latest git breaks anonymous push - fix it by using 'guest' user instead of the empty one b3d1265cc9b44786c0fd7aa2988c5614f62db978 Catalin(ux) M. BOIE 2017-11-26 12:39:43
Lots of changes, but mostly LDAP support 029d34fdc14587b9ef6eb9e87ac36f66caefdacf Catalin(ux) M. BOIE 2017-11-24 19:35:59
Fix state bug which triggered a not needed update of the structure f6118c456bfc960782a53b9dc090046d542f9db9 Catalin(ux) M. BOIE 2017-11-24 19:12:38
Some free_result and unlock only if successfully locked 64666ca1371c004f74376fce2e2a67ee9f608a34 Catalin(ux) M. BOIE 2017-10-01 06:10:47
If git_log_simple returns error, just return error acbbacda0947a3f8496c9b15870db574c08db715 Catalin(ux) M. BOIE 2017-08-31 03:43:25
Be less verbose in rg_rights_test 3cb2d12960b059b61f7c2c47c6198fbbdee8bccd Catalin(ux) M. BOIE 2017-08-10 04:19:34
Remove rg_log_buf stuff because of performance issues e85f70b38c197d44a9b4878dcff78da4f4f56562 Catalin(ux) M. BOIE 2017-08-08 20:08:56
Use a more efficient way to log multi line strings 67923e6760bf26923bd7ce9c9bced7a3f526cecf Catalin(ux) M. BOIE 2017-08-08 19:54:00
css: make border more visible 378b328cde875d1584f3df6d8635b340ee23207a Catalin(ux) M. BOIE 2017-07-22 23:27:29
struct: add itime for commit_labels 67d189b9d3330ab4dc3b6a0580a736522b6c1d36 Catalin(ux) M. BOIE 2017-07-22 23:05:02
wh: builder: we need repo info for clone_url_ssh info 6e95861b22476b0857f98a49025fc060302c2a3f Catalin(ux) M. BOIE 2017-07-22 12:35:52
hints: ssh: make more clear that ssh must be restarted 8c35f89b323d3ea28fad79f4c32d78aadc8618f6 Catalin(ux) M. BOIE 2017-07-22 08:17:37
rg_authorize must be run as rocketgit user - fix permissions to 0755 80db46ae953b72ba521b3cd96c91602e127fc8f8 Catalin(ux) M. BOIE 2017-07-22 08:07:56
build_jobs: Columns with no defaults must be specified bbb1c0036be3c6180d84e0641f41aa60ae1905f1 Catalin(ux) M. BOIE 2017-07-20 20:34:32
Show the suggestion to use https correctly 9656ff5ec3bfe65fc7a573fae254483c31d88501 Catalin(ux) M. BOIE 2017-07-10 20:57:26
rg_template_eval_cond: now supports more operations 2155bedec6e82343d84c8c504c0beb68fdf01dea Catalin(ux) M. BOIE 2017-07-10 20:55:48
Minor corrections dc3ce904f00ce5903ac5614ac870a0529d22ee4a Catalin(ux) M. BOIE 2017-07-10 20:55:03
state_get: Return empty if the state table does not exists 35822bff104ba2133f29a0a69cff4603d990a721 Catalin(ux) M. BOIE 2017-07-09 19:18:11
duilder: add 'samples' dir to the docs 8762f7dbfcec1f3ed5d6d7ba7dbf0ed547a894b7 Catalin(ux) M. BOIE 2017-07-09 06:54:06
Bump version to 0.70 a3524c87b21d22d734626503683e80e51abd574c Catalin(ux) M. BOIE 2017-07-09 06:40:24
Commit b3d1265cc9b44786c0fd7aa2988c5614f62db978 - Latest git breaks anonymous push - fix it by using 'guest' user instead of the empty one
Author: Catalin(ux) M. BOIE
Author date (UTC): 2017-11-26 12:39
Committer name: Catalin(ux) M. BOIE
Committer date (UTC): 2017-11-26 12:39
Parent(s): 029d34fdc14587b9ef6eb9e87ac36f66caefdacf
Signer:
Signing key:
Signing status: N
Tree: f16c125e4abec64b2779f20b219b5fb2804c9324
File Lines added Lines deleted
compare.csv 1 1
inc/user.inc.php 12 6
root/themes/default/features/anonpush.html 1 0
tests/ask_pass_guest 9 0
tests/by_http.php 2 2
tests/user.php 32 9
File compare.csv changed (mode: 100644) (index 19c57cf..f595a9b)
23 23 "OpenSSH AuthorizedKeysCommand","Yes","Yes","Yes","?","No","?" "OpenSSH AuthorizedKeysCommand","Yes","Yes","Yes","?","No","?"
24 24 "OpenSSH filter by key type and bits {Can it disable the keys based on types and number of bits?}","Yes","Yes","?","No","No","Yes" "OpenSSH filter by key type and bits {Can it disable the keys based on types and number of bits?}","Yes","Yes","?","No","No","Yes"
25 25 "Detailed info about the SSH keys {Can it show: type, number of bits, when it was uploaded, when it was first/last used, how many times was used and last command?}","Yes","No","?","No","No","?" "Detailed info about the SSH keys {Can it show: type, number of bits, when it was uploaded, when it was first/last used, how many times was used and last command?}","Yes","No","?","No","No","?"
26 "LDAP user authentication","No","Yes","?","No","No","Yes"
26 "LDAP user authentication","Yes","Yes","?","No","No","Yes"
27 27 "LDAP groups","No","Yes","?","?","?","?" "LDAP groups","No","Yes","?","?","?","?"
28 28 "PAM user authentication","No","?","?","?","?","Yes" "PAM user authentication","No","?","?","?","?","Yes"
29 29 "Git LFS","No","Yes","Yes","Yes","No","No" "Git LFS","No","Yes","Yes","Yes","No","No"
File inc/user.inc.php changed (mode: 100644) (index e6d0a73..f7656db)
... ... function rg_user_http_git($db, $rg, $paras)
2230 2230 && isset($_SERVER['PHP_AUTH_PW'])) { && isset($_SERVER['PHP_AUTH_PW'])) {
2231 2231 $u = $_SERVER['PHP_AUTH_USER']; $u = $_SERVER['PHP_AUTH_USER'];
2232 2232 $p = $_SERVER['PHP_AUTH_PW']; $p = $_SERVER['PHP_AUTH_PW'];
2233 $empty_user = FALSE;
2234 2233 rg_log('DEBUG: HTTP auth: u=' . $u); rg_log('DEBUG: HTTP auth: u=' . $u);
2235 2234
2236 2235 if (empty($u)) if (empty($u))
2237 2236 break; break;
2237 if (strcasecmp($u, 'guest') == 0) {
2238 $u = '';
2239 break;
2240 }
2241
2242 $empty_user = FALSE;
2238 2243
2239 2244 $auth_ui = rg_user_info($db, 0, $u, ''); $auth_ui = rg_user_info($db, 0, $u, '');
2240 2245 if ($auth_ui['ok'] !== 1) { if ($auth_ui['ok'] !== 1) {
 
... ... function rg_user_http_git($db, $rg, $paras)
2252 2257 $host = isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : ''; $host = isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : '';
2253 2258 $r = rg_repo_fetch_push_helper($db, $host, $rg['ip'], $r = rg_repo_fetch_push_helper($db, $host, $rg['ip'],
2254 2259 $rg['login_ui'], $prefix, $user, $repo, $service); $rg['login_ui'], $prefix, $user, $repo, $service);
2255 rg_log_ml('DEBUG: repo_fetch_push_helper: ' . print_r($r, TRUE));
2260 rg_log_ml('DEBUG: repo_fetch_push_helper returns: ' . print_r($r, TRUE));
2256 2261 if ($r['ok'] !== 1) { if ($r['ok'] !== 1) {
2257 2262 rg_log('DEBUG: set errror: ' . $r['errmsg']); rg_log('DEBUG: set errror: ' . $r['errmsg']);
2258 2263 header('X-Rocketgit-Error: ' . $r['errmsg']); header('X-Rocketgit-Error: ' . $r['errmsg']);
 
... ... function rg_user_http_git($db, $rg, $paras)
2294 2299 // user/pass combination. // user/pass combination.
2295 2300 header($protocol . ' 401 Unauthorized status'); header($protocol . ' 401 Unauthorized status');
2296 2301 header('WWW-Authenticate: Basic' header('WWW-Authenticate: Basic'
2297 . ' realm="Use empty user if you have no account"');
2302 . ' realm="Use \'guest\' user if you have no account"');
2298 2303 echo 'RocketGit: Info: == Welcome to RocketGit! ==' . "\n"; echo 'RocketGit: Info: == Welcome to RocketGit! ==' . "\n";
2299 2304 echo 'RocketGit: Info: you are connecting from IP ' . $rg['ip'] . '.' . "\n"; echo 'RocketGit: Info: you are connecting from IP ' . $rg['ip'] . '.' . "\n";
2300 2305 echo 'RocketGit: Error: ' . $r['errmsg'] . '!'; echo 'RocketGit: Error: ' . $r['errmsg'] . '!';
 
... ... function rg_user_http_git($db, $rg, $paras)
2316 2321 rg_log('DEBUG: send 401'); rg_log('DEBUG: send 401');
2317 2322 header($protocol . ' 401 Unauthorized status'); header($protocol . ' 401 Unauthorized status');
2318 2323 header('WWW-Authenticate: Basic' header('WWW-Authenticate: Basic'
2319 . ' realm="Use empty user if you have no account"');
2324 . ' realm="Use \'guest\' user if you have no account"');
2320 2325 echo 'RocketGit: Info: == Welcome to RocketGit! ==' . "\n"; echo 'RocketGit: Info: == Welcome to RocketGit! ==' . "\n";
2321 2326 echo 'RocketGit: Info: you are connecting from IP ' . $rg['ip'] . '.' . "\n"; echo 'RocketGit: Info: you are connecting from IP ' . $rg['ip'] . '.' . "\n";
2327 echo 'RocketGit: Info: Use user \'guest\' with any password if you want to push anonymously.' . "\n";
2322 2328 break; break;
2323 2329 } }
2324 2330 } else if ($r['push'] === 1) { } else if ($r['push'] === 1) {
 
... ... function rg_user_http_git($db, $rg, $paras)
2335 2341
2336 2342 if (strcmp($file, 'info/refs') == 0) { if (strcmp($file, 'info/refs') == 0) {
2337 2343 rg_log('DEBUG: info/refs'); rg_log('DEBUG: info/refs');
2338 // TODO: we should allow this only if the connecting user has
2339 // fetch rights!
2344 // TODO: we should allow this only if the connecting
2345 // user has fetch rights!
2340 2346 header('Content-Type: application/x-' header('Content-Type: application/x-'
2341 2347 . $service . '-advertisement'); . $service . '-advertisement');
2342 2348
File root/themes/default/features/anonpush.html changed (mode: 100644) (index 8a88779..f01bb78)
15 15 # here edit some files<br /> # here edit some files<br />
16 16 git add -p<br /> git add -p<br />
17 17 git commit -m "commit message"<br /> git commit -m "commit message"<br />
18 # use 'guest' as the user and an empty password:<br />
18 19 git push origin master<br /> git push origin master<br />
19 20 </div> </div>
20 21 <br /> <br />
File tests/ask_pass_guest added (mode: 100755) (index 0000000..f21bdcf)
1 #!/bin/bash
2
3 if [ "${1:0:8}" = "Username" ]; then
4 echo -n "guest"
5 fi
6
7 if [ "${1:0:8}" = "Password" ]; then
8 echo -n "not important"
9 fi
File tests/by_http.php changed (mode: 100644) (index e2679b9..07a90c9)
... ... if ($a['ok'] != 1) {
57 57
58 58 rg_log(''); rg_log('');
59 59 rg_log_enter('Trying to push master (without user/pass)...'); rg_log_enter('Trying to push master (without user/pass)...');
60 putenv('GIT_ASKPASS=/bin/true');
60 putenv('GIT_ASKPASS=' . dirname(__FILE__) . '/ask_pass_guest');
61 61 $r = rg_exec('cd .by_http && git push origin master', '', FALSE, FALSE); $r = rg_exec('cd .by_http && git push origin master', '', FALSE, FALSE);
62 62 if ($r['ok'] != 1) { if ($r['ok'] != 1) {
63 63 rg_log_ml('out: ' . print_r($r, TRUE)); rg_log_ml('out: ' . print_r($r, TRUE));
 
... ... rg_log_exit();
110 110
111 111 rg_log(''); rg_log('');
112 112 rg_log_enter('Trying to push master (without user/pass; private repo)...'); rg_log_enter('Trying to push master (without user/pass; private repo)...');
113 putenv('GIT_ASKPASS=/bin/true');
113 putenv('GIT_ASKPASS=' . dirname(__FILE__) . '/ask_pass_guest');
114 114 $r = rg_exec('cd .by_http && strace -s2000 -f -tt -o push_no_user.strace' $r = rg_exec('cd .by_http && strace -s2000 -f -tt -o push_no_user.strace'
115 115 . ' git push --verbose origin2 master', '', FALSE, FALSE); . ' git push --verbose origin2 master', '', FALSE, FALSE);
116 116 if ($r['ok'] == 1) { if ($r['ok'] == 1) {
File tests/user.php changed (mode: 100644) (index 3180e15..e9acd8e)
... ... rg_log_set_file("user.log");
15 15 require_once("common.php"); require_once("common.php");
16 16
17 17 $rg_sql_debug = 1; $rg_sql_debug = 1;
18
18 $rg_cache_debug = TRUE;
19 19
20 20 // Defaults // Defaults
21 21 $rg_repos = "ubase"; $rg_repos = "ubase";
 
... ... if ($_ui['exists'] != 1) {
86 86 } }
87 87 $pass = $_ui['pass']; $pass = $_ui['pass'];
88 88
89 // edit user - empty pass
89
90 rg_log('');
91 rg_log_enter('Editing user - empty pass');
90 92 $_u['uid'] = $uid; $_u['uid'] = $uid;
91 93 $_u['pass'] = ''; $_u['pass'] = '';
92 94 $r = rg_user_edit($db, $_u); $r = rg_user_edit($db, $_u);
 
... ... if (strcmp($pass, $_ui['pass']) != 0) {
104 106 rg_log("Password has been changed! Bad!"); rg_log("Password has been changed! Bad!");
105 107 exit(1); exit(1);
106 108 } }
109 rg_log_exit();
110
107 111
108 // edit user - no empty pass
112 rg_log('');
113 rg_log_enter('Editing user - not empty pass');
109 114 $_u['pass'] = "pass2"; $_u['pass'] = "pass2";
110 115 $_u['pass2'] = "pass2"; $_u['pass2'] = "pass2";
111 116 $r = rg_user_edit($db, $_u); $r = rg_user_edit($db, $_u);
 
... ... if ($r === FALSE) {
115 120 } }
116 121 // the pass should be changed here // the pass should be changed here
117 122 $salt = $_ui['salt']; $salt = $_ui['salt'];
123 rg_log('Getting user info again the user info (after pass change)...');
118 124 $_ui = rg_user_info($db, $uid, "", ""); $_ui = rg_user_info($db, $uid, "", "");
119 125 if ($_ui['exists'] != 1) { if ($_ui['exists'] != 1) {
120 126 rg_log("Seems that user with $uid does not exists!"); rg_log("Seems that user with $uid does not exists!");
 
... ... if (strcmp($salt, $_ui['salt']) == 0) {
125 131 exit(1); exit(1);
126 132 } }
127 133 if (strcmp($pass, $_ui['pass']) == 0) { if (strcmp($pass, $_ui['pass']) == 0) {
128 rg_log("Password has not been changed!");
134 rg_log("Password has not been changed ($pass)!");
129 135 exit(1); exit(1);
130 136 } }
137 rg_log_exit();
131 138
132 // change password
139
140 rg_log('');
141 rg_log_enter('Changing password to \'test3\'...');
133 142 $r = rg_user_set_pass($db, $uid, "pass3"); $r = rg_user_set_pass($db, $uid, "pass3");
134 143 if ($r !== TRUE) { if ($r !== TRUE) {
135 144 rg_log("Cannot change pass!"); rg_log("Cannot change pass!");
136 145 exit(1); exit(1);
137 146 } }
147 rg_log_exit();
148
138 149
139 // get token for e-mail forgot pass feature
150 rg_log('');
151 rg_log_enter('Getting token for e-mail forgot pass feature...');
140 152 $r = rg_user_forgot_pass_mail_prepare($db, "rg@localhost"); $r = rg_user_forgot_pass_mail_prepare($db, "rg@localhost");
141 153 if (empty($r['token'])) { if (empty($r['token'])) {
142 154 rg_log("Could not get token (" . rg_user_error() . ")!"); rg_log("Could not get token (" . rg_user_error() . ")!");
 
... ... if ($r['uid'] != $uid) {
153 165 rg_log("Token returned does not belong to the proper user!"); rg_log("Token returned does not belong to the proper user!");
154 166 exit(1); exit(1);
155 167 } }
168 rg_log_exit();
156 169
157 // test rg_user_path
170
171 rg_log('');
172 rg_log_enter('Testing rg_user_path...');
158 173 $x = sprintf("%08X", $uid); $x = sprintf("%08X", $uid);
159 174 $e = "ubase/by_id/" . substr($x, 0, 2) . "/" . substr($x, 2, 2) $e = "ubase/by_id/" . substr($x, 0, 2) . "/" . substr($x, 2, 2)
160 175 . "/" . substr($x, 4, 2) . "/" . substr($x, 6, 2) . "/" . $x; . "/" . substr($x, 4, 2) . "/" . substr($x, 6, 2) . "/" . $x;
 
... ... if (strcmp($r, $e) != 0) {
163 178 rg_log("path_by_id: e=[$e] != r=[$r]!"); rg_log("path_by_id: e=[$e] != r=[$r]!");
164 179 exit(1); exit(1);
165 180 } }
181 rg_log_exit();
182
166 183
167 // test renames
184 rg_log('');
185 rg_log_enter('Testing renames...');
168 186 $r = rg_user_rename($db, $_ui, "userA2"); $r = rg_user_rename($db, $_ui, "userA2");
169 187 if ($r === FALSE) { if ($r === FALSE) {
170 188 rg_log("Cannot rename user (" . rg_user_error() . ")!"); rg_log("Cannot rename user (" . rg_user_error() . ")!");
171 189 exit(1); exit(1);
172 190 } }
191 rg_log_exit();
173 192
174 rg_log("Testing fixes...");
193
194 rg_log('');
195 rg_log_enter("Testing fixes...");
175 196 // add user5 // add user5
176 197 $_u['uid'] = 0; $_u['uid'] = 0;
177 198 $_u['realname'] = "user5 real name"; $_u['realname'] = "user5 real name";
 
... ... if ($r === FALSE) {
201 222 rg_log("cannot re-index by id!"); rg_log("cannot re-index by id!");
202 223 exit(1); exit(1);
203 224 } }
225 rg_log_exit();
226
204 227
205 228 rg_log("OK!"); rg_log("OK!");
206 229 ?> ?>
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