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 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 |
?> |
?> |