Fossil SCM

Coding style tweak.

mistachkin 2018-08-11 23:51 login-with-email
Commit 52b9caa5027e717f02deb6d012ee2a2d99cd968d151f6e4d7b87d1fa8b88cc1b
1 file changed +6 -6
+6 -6
--- src/login.c
+++ src/login.c
@@ -217,40 +217,40 @@
217217
** is diligent enough to check whether its pointer was re-pointed.
218218
**
219219
** zPassword may be either the plain-text form or the encrypted
220220
** form of the user's password.
221221
*/
222
-int login_search_uid(const char **zUsername, const char *zPasswd){
223
- char *zSha1Pw = sha1_shared_secret(zPasswd, *zUsername, 0);
222
+int login_search_uid(const char **pzUsername, const char *zPasswd){
223
+ char *zSha1Pw = sha1_shared_secret(zPasswd, *pzUsername, 0);
224224
int uid = db_int(0,
225225
"SELECT uid FROM user"
226226
" WHERE login=%Q"
227227
" AND length(cap)>0 AND length(pw)>0"
228228
" AND login NOT IN ('anonymous','nobody','developer','reader')"
229229
" AND (pw=%Q OR (length(pw)<>40 AND pw=%Q))"
230230
" AND (info NOT LIKE '%%expires 20%%'"
231231
" OR substr(info,instr(lower(info),'expires')+8,10)>datetime('now'))",
232
- *zUsername, zSha1Pw, zPasswd
232
+ *pzUsername, zSha1Pw, zPasswd
233233
);
234234
235235
/* If we did not find a login on the first attempt, and the username
236236
** looks like an email address, then perhaps the user entered their
237237
** email address instead of their login. Try again to match the user
238238
** against email addresses contained in the "info" field.
239239
*/
240
- if( uid==0 && strchr(*zUsername,'@')!=0 ){
240
+ if( uid==0 && strchr(*pzUsername,'@')!=0 ){
241241
Stmt q;
242242
db_prepare(&q,
243243
"SELECT login FROM user"
244244
" WHERE find_emailaddr(info)=%Q"
245245
" AND instr(login,'@')==0",
246
- *zUsername
246
+ *pzUsername
247247
);
248248
while( db_step(&q)==SQLITE_ROW ){
249249
const char *zLogin = db_column_text(&q,0);
250250
if( (uid = login_search_uid(&zLogin, zPasswd) ) != 0 ){
251
- *zUsername = fossil_strdup(zLogin);
251
+ *pzUsername = fossil_strdup(zLogin);
252252
break;
253253
}
254254
}
255255
db_finalize(&q);
256256
}
257257
--- src/login.c
+++ src/login.c
@@ -217,40 +217,40 @@
217 ** is diligent enough to check whether its pointer was re-pointed.
218 **
219 ** zPassword may be either the plain-text form or the encrypted
220 ** form of the user's password.
221 */
222 int login_search_uid(const char **zUsername, const char *zPasswd){
223 char *zSha1Pw = sha1_shared_secret(zPasswd, *zUsername, 0);
224 int uid = db_int(0,
225 "SELECT uid FROM user"
226 " WHERE login=%Q"
227 " AND length(cap)>0 AND length(pw)>0"
228 " AND login NOT IN ('anonymous','nobody','developer','reader')"
229 " AND (pw=%Q OR (length(pw)<>40 AND pw=%Q))"
230 " AND (info NOT LIKE '%%expires 20%%'"
231 " OR substr(info,instr(lower(info),'expires')+8,10)>datetime('now'))",
232 *zUsername, zSha1Pw, zPasswd
233 );
234
235 /* If we did not find a login on the first attempt, and the username
236 ** looks like an email address, then perhaps the user entered their
237 ** email address instead of their login. Try again to match the user
238 ** against email addresses contained in the "info" field.
239 */
240 if( uid==0 && strchr(*zUsername,'@')!=0 ){
241 Stmt q;
242 db_prepare(&q,
243 "SELECT login FROM user"
244 " WHERE find_emailaddr(info)=%Q"
245 " AND instr(login,'@')==0",
246 *zUsername
247 );
248 while( db_step(&q)==SQLITE_ROW ){
249 const char *zLogin = db_column_text(&q,0);
250 if( (uid = login_search_uid(&zLogin, zPasswd) ) != 0 ){
251 *zUsername = fossil_strdup(zLogin);
252 break;
253 }
254 }
255 db_finalize(&q);
256 }
257
--- src/login.c
+++ src/login.c
@@ -217,40 +217,40 @@
217 ** is diligent enough to check whether its pointer was re-pointed.
218 **
219 ** zPassword may be either the plain-text form or the encrypted
220 ** form of the user's password.
221 */
222 int login_search_uid(const char **pzUsername, const char *zPasswd){
223 char *zSha1Pw = sha1_shared_secret(zPasswd, *pzUsername, 0);
224 int uid = db_int(0,
225 "SELECT uid FROM user"
226 " WHERE login=%Q"
227 " AND length(cap)>0 AND length(pw)>0"
228 " AND login NOT IN ('anonymous','nobody','developer','reader')"
229 " AND (pw=%Q OR (length(pw)<>40 AND pw=%Q))"
230 " AND (info NOT LIKE '%%expires 20%%'"
231 " OR substr(info,instr(lower(info),'expires')+8,10)>datetime('now'))",
232 *pzUsername, zSha1Pw, zPasswd
233 );
234
235 /* If we did not find a login on the first attempt, and the username
236 ** looks like an email address, then perhaps the user entered their
237 ** email address instead of their login. Try again to match the user
238 ** against email addresses contained in the "info" field.
239 */
240 if( uid==0 && strchr(*pzUsername,'@')!=0 ){
241 Stmt q;
242 db_prepare(&q,
243 "SELECT login FROM user"
244 " WHERE find_emailaddr(info)=%Q"
245 " AND instr(login,'@')==0",
246 *pzUsername
247 );
248 while( db_step(&q)==SQLITE_ROW ){
249 const char *zLogin = db_column_text(&q,0);
250 if( (uid = login_search_uid(&zLogin, zPasswd) ) != 0 ){
251 *pzUsername = fossil_strdup(zLogin);
252 break;
253 }
254 }
255 db_finalize(&q);
256 }
257

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button