Fossil SCM
Use the new octet_length() SQL function in place of length() where it is appropriate to do so.
Commit
604e1a67d38a5e6e3c3d42f49c3fbd1fab84259fa6ac1e70e2f6a803a837d13b
Parent
9f8e9cbd174884e…
5 files changed
+2
-2
+2
-2
+1
-1
+10
-9
+5
-5
+2
-2
| --- src/bundle.c | ||
| +++ src/bundle.c | ||
| @@ -114,11 +114,11 @@ | ||
| 114 | 114 | db_finalize(&q); |
| 115 | 115 | fossil_print("%.78c\n",'-'); |
| 116 | 116 | if( bDetails ){ |
| 117 | 117 | db_prepare(&q, |
| 118 | 118 | "SELECT blobid, substr(uuid,1,10), coalesce(substr(delta,1,10),'')," |
| 119 | - " sz, length(data), notes" | |
| 119 | + " sz, octet_length(data), notes" | |
| 120 | 120 | " FROM bblob" |
| 121 | 121 | ); |
| 122 | 122 | while( db_step(&q)==SQLITE_ROW ){ |
| 123 | 123 | fossil_print("%4d %10s %10s %8d %8d %s\n", |
| 124 | 124 | db_column_int(&q,0), |
| @@ -591,11 +591,11 @@ | ||
| 591 | 591 | ** repo, then the delta encodings cannot be decoded and the bundle cannot |
| 592 | 592 | ** be extracted. */ |
| 593 | 593 | zMissingDeltas = db_text(0, |
| 594 | 594 | "SELECT group_concat(substr(delta,1,10),' ')" |
| 595 | 595 | " FROM bblob" |
| 596 | - " WHERE typeof(delta)='text' AND length(delta)>=%d" | |
| 596 | + " WHERE typeof(delta)='text' AND octet_length(delta)>=%d" | |
| 597 | 597 | " AND NOT EXISTS(SELECT 1 FROM blob WHERE uuid=bblob.delta)", |
| 598 | 598 | HNAME_MIN); |
| 599 | 599 | if( zMissingDeltas && zMissingDeltas[0] ){ |
| 600 | 600 | fossil_fatal("delta basis artifacts not found in repository: %s", |
| 601 | 601 | zMissingDeltas); |
| 602 | 602 |
| --- src/bundle.c | |
| +++ src/bundle.c | |
| @@ -114,11 +114,11 @@ | |
| 114 | db_finalize(&q); |
| 115 | fossil_print("%.78c\n",'-'); |
| 116 | if( bDetails ){ |
| 117 | db_prepare(&q, |
| 118 | "SELECT blobid, substr(uuid,1,10), coalesce(substr(delta,1,10),'')," |
| 119 | " sz, length(data), notes" |
| 120 | " FROM bblob" |
| 121 | ); |
| 122 | while( db_step(&q)==SQLITE_ROW ){ |
| 123 | fossil_print("%4d %10s %10s %8d %8d %s\n", |
| 124 | db_column_int(&q,0), |
| @@ -591,11 +591,11 @@ | |
| 591 | ** repo, then the delta encodings cannot be decoded and the bundle cannot |
| 592 | ** be extracted. */ |
| 593 | zMissingDeltas = db_text(0, |
| 594 | "SELECT group_concat(substr(delta,1,10),' ')" |
| 595 | " FROM bblob" |
| 596 | " WHERE typeof(delta)='text' AND length(delta)>=%d" |
| 597 | " AND NOT EXISTS(SELECT 1 FROM blob WHERE uuid=bblob.delta)", |
| 598 | HNAME_MIN); |
| 599 | if( zMissingDeltas && zMissingDeltas[0] ){ |
| 600 | fossil_fatal("delta basis artifacts not found in repository: %s", |
| 601 | zMissingDeltas); |
| 602 |
| --- src/bundle.c | |
| +++ src/bundle.c | |
| @@ -114,11 +114,11 @@ | |
| 114 | db_finalize(&q); |
| 115 | fossil_print("%.78c\n",'-'); |
| 116 | if( bDetails ){ |
| 117 | db_prepare(&q, |
| 118 | "SELECT blobid, substr(uuid,1,10), coalesce(substr(delta,1,10),'')," |
| 119 | " sz, octet_length(data), notes" |
| 120 | " FROM bblob" |
| 121 | ); |
| 122 | while( db_step(&q)==SQLITE_ROW ){ |
| 123 | fossil_print("%4d %10s %10s %8d %8d %s\n", |
| 124 | db_column_int(&q,0), |
| @@ -591,11 +591,11 @@ | |
| 591 | ** repo, then the delta encodings cannot be decoded and the bundle cannot |
| 592 | ** be extracted. */ |
| 593 | zMissingDeltas = db_text(0, |
| 594 | "SELECT group_concat(substr(delta,1,10),' ')" |
| 595 | " FROM bblob" |
| 596 | " WHERE typeof(delta)='text' AND octet_length(delta)>=%d" |
| 597 | " AND NOT EXISTS(SELECT 1 FROM blob WHERE uuid=bblob.delta)", |
| 598 | HNAME_MIN); |
| 599 | if( zMissingDeltas && zMissingDeltas[0] ){ |
| 600 | fossil_fatal("delta basis artifacts not found in repository: %s", |
| 601 | zMissingDeltas); |
| 602 |
+2
-2
| --- src/chat.c | ||
| +++ src/chat.c | ||
| @@ -588,11 +588,11 @@ | ||
| 588 | 588 | zChatUser = db_get("chat-timeline-user",0); |
| 589 | 589 | chat_create_tables(); |
| 590 | 590 | cgi_set_content_type("application/json"); |
| 591 | 591 | dataVersion = db_int64(0, "PRAGMA data_version"); |
| 592 | 592 | blob_append_sql(&sql, |
| 593 | - "SELECT msgid, datetime(mtime), xfrom, xmsg, length(file)," | |
| 593 | + "SELECT msgid, datetime(mtime), xfrom, xmsg, octet_length(file)," | |
| 594 | 594 | " fname, fmime, %s, lmtime" |
| 595 | 595 | " FROM chat ", |
| 596 | 596 | msgBefore>0 ? "0 as mdel" : "mdel"); |
| 597 | 597 | if( msgid<=0 || msgBefore>0 ){ |
| 598 | 598 | db_begin_write(); |
| @@ -727,11 +727,11 @@ | ||
| 727 | 727 | } |
| 728 | 728 | zChatUser = db_get("chat-timeline-user",0); |
| 729 | 729 | chat_create_tables(); |
| 730 | 730 | cgi_set_content_type("application/json"); |
| 731 | 731 | db_prepare(&q, |
| 732 | - "SELECT datetime(mtime), xfrom, xmsg, length(file)," | |
| 732 | + "SELECT datetime(mtime), xfrom, xmsg, octet_length(file)," | |
| 733 | 733 | " fname, fmime, lmtime" |
| 734 | 734 | " FROM chat WHERE msgid=%d AND mdel IS NULL", |
| 735 | 735 | msgid); |
| 736 | 736 | if(SQLITE_ROW==db_step(&q)){ |
| 737 | 737 | const char *zDate = db_column_text(&q, 0); |
| 738 | 738 |
| --- src/chat.c | |
| +++ src/chat.c | |
| @@ -588,11 +588,11 @@ | |
| 588 | zChatUser = db_get("chat-timeline-user",0); |
| 589 | chat_create_tables(); |
| 590 | cgi_set_content_type("application/json"); |
| 591 | dataVersion = db_int64(0, "PRAGMA data_version"); |
| 592 | blob_append_sql(&sql, |
| 593 | "SELECT msgid, datetime(mtime), xfrom, xmsg, length(file)," |
| 594 | " fname, fmime, %s, lmtime" |
| 595 | " FROM chat ", |
| 596 | msgBefore>0 ? "0 as mdel" : "mdel"); |
| 597 | if( msgid<=0 || msgBefore>0 ){ |
| 598 | db_begin_write(); |
| @@ -727,11 +727,11 @@ | |
| 727 | } |
| 728 | zChatUser = db_get("chat-timeline-user",0); |
| 729 | chat_create_tables(); |
| 730 | cgi_set_content_type("application/json"); |
| 731 | db_prepare(&q, |
| 732 | "SELECT datetime(mtime), xfrom, xmsg, length(file)," |
| 733 | " fname, fmime, lmtime" |
| 734 | " FROM chat WHERE msgid=%d AND mdel IS NULL", |
| 735 | msgid); |
| 736 | if(SQLITE_ROW==db_step(&q)){ |
| 737 | const char *zDate = db_column_text(&q, 0); |
| 738 |
| --- src/chat.c | |
| +++ src/chat.c | |
| @@ -588,11 +588,11 @@ | |
| 588 | zChatUser = db_get("chat-timeline-user",0); |
| 589 | chat_create_tables(); |
| 590 | cgi_set_content_type("application/json"); |
| 591 | dataVersion = db_int64(0, "PRAGMA data_version"); |
| 592 | blob_append_sql(&sql, |
| 593 | "SELECT msgid, datetime(mtime), xfrom, xmsg, octet_length(file)," |
| 594 | " fname, fmime, %s, lmtime" |
| 595 | " FROM chat ", |
| 596 | msgBefore>0 ? "0 as mdel" : "mdel"); |
| 597 | if( msgid<=0 || msgBefore>0 ){ |
| 598 | db_begin_write(); |
| @@ -727,11 +727,11 @@ | |
| 727 | } |
| 728 | zChatUser = db_get("chat-timeline-user",0); |
| 729 | chat_create_tables(); |
| 730 | cgi_set_content_type("application/json"); |
| 731 | db_prepare(&q, |
| 732 | "SELECT datetime(mtime), xfrom, xmsg, octet_length(file)," |
| 733 | " fname, fmime, lmtime" |
| 734 | " FROM chat WHERE msgid=%d AND mdel IS NULL", |
| 735 | msgid); |
| 736 | if(SQLITE_ROW==db_step(&q)){ |
| 737 | const char *zDate = db_column_text(&q, 0); |
| 738 |
+1
-1
| --- src/content.c | ||
| +++ src/content.c | ||
| @@ -904,11 +904,11 @@ | ||
| 904 | 904 | blob_compress(&bestDelta, &bestDelta); |
| 905 | 905 | db_prepare(&s1, "UPDATE blob SET content=:data WHERE rid=%d", rid); |
| 906 | 906 | db_prepare(&s2, "REPLACE INTO delta(rid,srcid)VALUES(%d,%d)", rid, bestSrc); |
| 907 | 907 | db_bind_blob(&s1, ":data", &bestDelta); |
| 908 | 908 | db_begin_transaction(); |
| 909 | - rc = db_int(0, "SELECT length(content) FROM blob WHERE rid=%d", rid); | |
| 909 | + rc = db_int(0, "SELECT octet_length(content) FROM blob WHERE rid=%d", rid); | |
| 910 | 910 | db_exec(&s1); |
| 911 | 911 | db_exec(&s2); |
| 912 | 912 | db_end_transaction(0); |
| 913 | 913 | db_finalize(&s1); |
| 914 | 914 | db_finalize(&s2); |
| 915 | 915 |
| --- src/content.c | |
| +++ src/content.c | |
| @@ -904,11 +904,11 @@ | |
| 904 | blob_compress(&bestDelta, &bestDelta); |
| 905 | db_prepare(&s1, "UPDATE blob SET content=:data WHERE rid=%d", rid); |
| 906 | db_prepare(&s2, "REPLACE INTO delta(rid,srcid)VALUES(%d,%d)", rid, bestSrc); |
| 907 | db_bind_blob(&s1, ":data", &bestDelta); |
| 908 | db_begin_transaction(); |
| 909 | rc = db_int(0, "SELECT length(content) FROM blob WHERE rid=%d", rid); |
| 910 | db_exec(&s1); |
| 911 | db_exec(&s2); |
| 912 | db_end_transaction(0); |
| 913 | db_finalize(&s1); |
| 914 | db_finalize(&s2); |
| 915 |
| --- src/content.c | |
| +++ src/content.c | |
| @@ -904,11 +904,11 @@ | |
| 904 | blob_compress(&bestDelta, &bestDelta); |
| 905 | db_prepare(&s1, "UPDATE blob SET content=:data WHERE rid=%d", rid); |
| 906 | db_prepare(&s2, "REPLACE INTO delta(rid,srcid)VALUES(%d,%d)", rid, bestSrc); |
| 907 | db_bind_blob(&s1, ":data", &bestDelta); |
| 908 | db_begin_transaction(); |
| 909 | rc = db_int(0, "SELECT octet_length(content) FROM blob WHERE rid=%d", rid); |
| 910 | db_exec(&s1); |
| 911 | db_exec(&s2); |
| 912 | db_end_transaction(0); |
| 913 | db_finalize(&s1); |
| 914 | db_finalize(&s2); |
| 915 |
+10
-9
| --- src/login.c | ||
| +++ src/login.c | ||
| @@ -144,11 +144,11 @@ | ||
| 144 | 144 | else if( zCS==0 ) return 0; |
| 145 | 145 | else if( fossil_strcmp(zUsername,"anonymous")!=0 ) return 0; |
| 146 | 146 | zPw = captcha_decode((unsigned int)atoi(zCS)); |
| 147 | 147 | if( fossil_stricmp(zPw, zPassword)!=0 ) return 0; |
| 148 | 148 | uid = db_int(0, "SELECT uid FROM user WHERE login='anonymous'" |
| 149 | - " AND length(pw)>0 AND length(cap)>0"); | |
| 149 | + " AND octet_length(pw)>0 AND octet_length(cap)>0"); | |
| 150 | 150 | return uid; |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | /* |
| 154 | 154 | ** Make sure the accesslog table exists. Create it if it does not |
| @@ -210,11 +210,11 @@ | ||
| 210 | 210 | int login_search_uid(const char **pzUsername, const char *zPasswd){ |
| 211 | 211 | char *zSha1Pw = sha1_shared_secret(zPasswd, *pzUsername, 0); |
| 212 | 212 | int uid = db_int(0, |
| 213 | 213 | "SELECT uid FROM user" |
| 214 | 214 | " WHERE login=%Q" |
| 215 | - " AND length(cap)>0 AND length(pw)>0" | |
| 215 | + " AND octet_length(cap)>0 AND octet_length(pw)>0" | |
| 216 | 216 | " AND login NOT IN ('anonymous','nobody','developer','reader')" |
| 217 | 217 | " AND (pw=%Q OR (length(pw)<>40 AND pw=%Q))" |
| 218 | 218 | " AND (info NOT LIKE '%%expires 20%%'" |
| 219 | 219 | " OR substr(info,instr(lower(info),'expires')+8,10)>datetime('now'))", |
| 220 | 220 | *pzUsername, zSha1Pw, zPasswd |
| @@ -1134,12 +1134,12 @@ | ||
| 1134 | 1134 | constant_time_cmp_function, 0, 0); |
| 1135 | 1135 | sqlite3_busy_timeout(pOther, 5000); |
| 1136 | 1136 | zSQL = mprintf( |
| 1137 | 1137 | "SELECT cexpire FROM user" |
| 1138 | 1138 | " WHERE login=%Q" |
| 1139 | - " AND length(cap)>0" | |
| 1140 | - " AND length(pw)>0" | |
| 1139 | + " AND octet_length(cap)>0" | |
| 1140 | + " AND octet_length(pw)>0" | |
| 1141 | 1141 | " AND cexpire>julianday('now')" |
| 1142 | 1142 | " AND constant_time_cmp(cookie,%Q)=0", |
| 1143 | 1143 | zLogin, zHash |
| 1144 | 1144 | ); |
| 1145 | 1145 | pStmt = 0; |
| @@ -1188,12 +1188,12 @@ | ||
| 1188 | 1188 | if( login_is_special(zLogin) ) return 0; |
| 1189 | 1189 | uid = db_int(0, |
| 1190 | 1190 | "SELECT uid FROM user" |
| 1191 | 1191 | " WHERE login=%Q" |
| 1192 | 1192 | " AND cexpire>julianday('now')" |
| 1193 | - " AND length(cap)>0" | |
| 1194 | - " AND length(pw)>0" | |
| 1193 | + " AND octet_length(cap)>0" | |
| 1194 | + " AND octet_length(pw)>0" | |
| 1195 | 1195 | " AND constant_time_cmp(cookie,%Q)=0", |
| 1196 | 1196 | zLogin, zCookie |
| 1197 | 1197 | ); |
| 1198 | 1198 | return uid; |
| 1199 | 1199 | } |
| @@ -1335,12 +1335,12 @@ | ||
| 1335 | 1335 | blob_appendf(&b, "%s/%s", zArg, db_get("captcha-secret","")); |
| 1336 | 1336 | sha1sum_blob(&b, &b); |
| 1337 | 1337 | if( fossil_strcmp(zHash, blob_str(&b))==0 ){ |
| 1338 | 1338 | uid = db_int(0, |
| 1339 | 1339 | "SELECT uid FROM user WHERE login='anonymous'" |
| 1340 | - " AND length(cap)>0" | |
| 1341 | - " AND length(pw)>0" | |
| 1340 | + " AND octet_length(cap)>0" | |
| 1341 | + " AND octet_length(pw)>0" | |
| 1342 | 1342 | " AND %.17g+0.25>julianday('now')", |
| 1343 | 1343 | rTime |
| 1344 | 1344 | ); |
| 1345 | 1345 | } |
| 1346 | 1346 | blob_reset(&b); |
| @@ -1363,11 +1363,12 @@ | ||
| 1363 | 1363 | */ |
| 1364 | 1364 | if( uid==0 ){ |
| 1365 | 1365 | const char *zRemoteUser = P("REMOTE_USER"); |
| 1366 | 1366 | if( zRemoteUser && db_get_boolean("remote_user_ok",0) ){ |
| 1367 | 1367 | uid = db_int(0, "SELECT uid FROM user WHERE login=%Q" |
| 1368 | - " AND length(cap)>0 AND length(pw)>0", zRemoteUser); | |
| 1368 | + " AND octet_length(cap)>0 AND octet_length(pw)>0", | |
| 1369 | + zRemoteUser); | |
| 1369 | 1370 | } |
| 1370 | 1371 | } |
| 1371 | 1372 | |
| 1372 | 1373 | /* If the request didn't provide a login cookie or the login cookie didn't |
| 1373 | 1374 | ** match a known valid user, check the HTTP "Authorization" header and |
| 1374 | 1375 |
| --- src/login.c | |
| +++ src/login.c | |
| @@ -144,11 +144,11 @@ | |
| 144 | else if( zCS==0 ) return 0; |
| 145 | else if( fossil_strcmp(zUsername,"anonymous")!=0 ) return 0; |
| 146 | zPw = captcha_decode((unsigned int)atoi(zCS)); |
| 147 | if( fossil_stricmp(zPw, zPassword)!=0 ) return 0; |
| 148 | uid = db_int(0, "SELECT uid FROM user WHERE login='anonymous'" |
| 149 | " AND length(pw)>0 AND length(cap)>0"); |
| 150 | return uid; |
| 151 | } |
| 152 | |
| 153 | /* |
| 154 | ** Make sure the accesslog table exists. Create it if it does not |
| @@ -210,11 +210,11 @@ | |
| 210 | int login_search_uid(const char **pzUsername, const char *zPasswd){ |
| 211 | char *zSha1Pw = sha1_shared_secret(zPasswd, *pzUsername, 0); |
| 212 | int uid = db_int(0, |
| 213 | "SELECT uid FROM user" |
| 214 | " WHERE login=%Q" |
| 215 | " AND length(cap)>0 AND length(pw)>0" |
| 216 | " AND login NOT IN ('anonymous','nobody','developer','reader')" |
| 217 | " AND (pw=%Q OR (length(pw)<>40 AND pw=%Q))" |
| 218 | " AND (info NOT LIKE '%%expires 20%%'" |
| 219 | " OR substr(info,instr(lower(info),'expires')+8,10)>datetime('now'))", |
| 220 | *pzUsername, zSha1Pw, zPasswd |
| @@ -1134,12 +1134,12 @@ | |
| 1134 | constant_time_cmp_function, 0, 0); |
| 1135 | sqlite3_busy_timeout(pOther, 5000); |
| 1136 | zSQL = mprintf( |
| 1137 | "SELECT cexpire FROM user" |
| 1138 | " WHERE login=%Q" |
| 1139 | " AND length(cap)>0" |
| 1140 | " AND length(pw)>0" |
| 1141 | " AND cexpire>julianday('now')" |
| 1142 | " AND constant_time_cmp(cookie,%Q)=0", |
| 1143 | zLogin, zHash |
| 1144 | ); |
| 1145 | pStmt = 0; |
| @@ -1188,12 +1188,12 @@ | |
| 1188 | if( login_is_special(zLogin) ) return 0; |
| 1189 | uid = db_int(0, |
| 1190 | "SELECT uid FROM user" |
| 1191 | " WHERE login=%Q" |
| 1192 | " AND cexpire>julianday('now')" |
| 1193 | " AND length(cap)>0" |
| 1194 | " AND length(pw)>0" |
| 1195 | " AND constant_time_cmp(cookie,%Q)=0", |
| 1196 | zLogin, zCookie |
| 1197 | ); |
| 1198 | return uid; |
| 1199 | } |
| @@ -1335,12 +1335,12 @@ | |
| 1335 | blob_appendf(&b, "%s/%s", zArg, db_get("captcha-secret","")); |
| 1336 | sha1sum_blob(&b, &b); |
| 1337 | if( fossil_strcmp(zHash, blob_str(&b))==0 ){ |
| 1338 | uid = db_int(0, |
| 1339 | "SELECT uid FROM user WHERE login='anonymous'" |
| 1340 | " AND length(cap)>0" |
| 1341 | " AND length(pw)>0" |
| 1342 | " AND %.17g+0.25>julianday('now')", |
| 1343 | rTime |
| 1344 | ); |
| 1345 | } |
| 1346 | blob_reset(&b); |
| @@ -1363,11 +1363,12 @@ | |
| 1363 | */ |
| 1364 | if( uid==0 ){ |
| 1365 | const char *zRemoteUser = P("REMOTE_USER"); |
| 1366 | if( zRemoteUser && db_get_boolean("remote_user_ok",0) ){ |
| 1367 | uid = db_int(0, "SELECT uid FROM user WHERE login=%Q" |
| 1368 | " AND length(cap)>0 AND length(pw)>0", zRemoteUser); |
| 1369 | } |
| 1370 | } |
| 1371 | |
| 1372 | /* If the request didn't provide a login cookie or the login cookie didn't |
| 1373 | ** match a known valid user, check the HTTP "Authorization" header and |
| 1374 |
| --- src/login.c | |
| +++ src/login.c | |
| @@ -144,11 +144,11 @@ | |
| 144 | else if( zCS==0 ) return 0; |
| 145 | else if( fossil_strcmp(zUsername,"anonymous")!=0 ) return 0; |
| 146 | zPw = captcha_decode((unsigned int)atoi(zCS)); |
| 147 | if( fossil_stricmp(zPw, zPassword)!=0 ) return 0; |
| 148 | uid = db_int(0, "SELECT uid FROM user WHERE login='anonymous'" |
| 149 | " AND octet_length(pw)>0 AND octet_length(cap)>0"); |
| 150 | return uid; |
| 151 | } |
| 152 | |
| 153 | /* |
| 154 | ** Make sure the accesslog table exists. Create it if it does not |
| @@ -210,11 +210,11 @@ | |
| 210 | int login_search_uid(const char **pzUsername, const char *zPasswd){ |
| 211 | char *zSha1Pw = sha1_shared_secret(zPasswd, *pzUsername, 0); |
| 212 | int uid = db_int(0, |
| 213 | "SELECT uid FROM user" |
| 214 | " WHERE login=%Q" |
| 215 | " AND octet_length(cap)>0 AND octet_length(pw)>0" |
| 216 | " AND login NOT IN ('anonymous','nobody','developer','reader')" |
| 217 | " AND (pw=%Q OR (length(pw)<>40 AND pw=%Q))" |
| 218 | " AND (info NOT LIKE '%%expires 20%%'" |
| 219 | " OR substr(info,instr(lower(info),'expires')+8,10)>datetime('now'))", |
| 220 | *pzUsername, zSha1Pw, zPasswd |
| @@ -1134,12 +1134,12 @@ | |
| 1134 | constant_time_cmp_function, 0, 0); |
| 1135 | sqlite3_busy_timeout(pOther, 5000); |
| 1136 | zSQL = mprintf( |
| 1137 | "SELECT cexpire FROM user" |
| 1138 | " WHERE login=%Q" |
| 1139 | " AND octet_length(cap)>0" |
| 1140 | " AND octet_length(pw)>0" |
| 1141 | " AND cexpire>julianday('now')" |
| 1142 | " AND constant_time_cmp(cookie,%Q)=0", |
| 1143 | zLogin, zHash |
| 1144 | ); |
| 1145 | pStmt = 0; |
| @@ -1188,12 +1188,12 @@ | |
| 1188 | if( login_is_special(zLogin) ) return 0; |
| 1189 | uid = db_int(0, |
| 1190 | "SELECT uid FROM user" |
| 1191 | " WHERE login=%Q" |
| 1192 | " AND cexpire>julianday('now')" |
| 1193 | " AND octet_length(cap)>0" |
| 1194 | " AND octet_length(pw)>0" |
| 1195 | " AND constant_time_cmp(cookie,%Q)=0", |
| 1196 | zLogin, zCookie |
| 1197 | ); |
| 1198 | return uid; |
| 1199 | } |
| @@ -1335,12 +1335,12 @@ | |
| 1335 | blob_appendf(&b, "%s/%s", zArg, db_get("captcha-secret","")); |
| 1336 | sha1sum_blob(&b, &b); |
| 1337 | if( fossil_strcmp(zHash, blob_str(&b))==0 ){ |
| 1338 | uid = db_int(0, |
| 1339 | "SELECT uid FROM user WHERE login='anonymous'" |
| 1340 | " AND octet_length(cap)>0" |
| 1341 | " AND octet_length(pw)>0" |
| 1342 | " AND %.17g+0.25>julianday('now')", |
| 1343 | rTime |
| 1344 | ); |
| 1345 | } |
| 1346 | blob_reset(&b); |
| @@ -1363,11 +1363,12 @@ | |
| 1363 | */ |
| 1364 | if( uid==0 ){ |
| 1365 | const char *zRemoteUser = P("REMOTE_USER"); |
| 1366 | if( zRemoteUser && db_get_boolean("remote_user_ok",0) ){ |
| 1367 | uid = db_int(0, "SELECT uid FROM user WHERE login=%Q" |
| 1368 | " AND octet_length(cap)>0 AND octet_length(pw)>0", |
| 1369 | zRemoteUser); |
| 1370 | } |
| 1371 | } |
| 1372 | |
| 1373 | /* If the request didn't provide a login cookie or the login cookie didn't |
| 1374 | ** match a known valid user, check the HTTP "Authorization" header and |
| 1375 |
+5
-5
| --- src/stat.c | ||
| +++ src/stat.c | ||
| @@ -119,11 +119,11 @@ | ||
| 119 | 119 | @ <tr><th>Subscribers:</th><td> |
| 120 | 120 | } |
| 121 | 121 | nSub = db_int(0, "SELECT count(*) FROM subscriber"); |
| 122 | 122 | iCutoff = db_get_int("email-renew-cutoff",0); |
| 123 | 123 | nASub = db_int(0, "SELECT count(*) FROM subscriber WHERE sverified" |
| 124 | - " AND NOT sdonotcall AND length(ssub)>1" | |
| 124 | + " AND NOT sdonotcall AND octet_length(ssub)>1" | |
| 125 | 125 | " AND lastContact>=%d;", iCutoff); |
| 126 | 126 | @ %,d(nASub) active, %,d(nSub) total |
| 127 | 127 | @ </td></tr> |
| 128 | 128 | rDigest = db_double(-1.0, "SELECT (julianday('now') - value)*24.0" |
| 129 | 129 | " FROM config WHERE name='email-last-digest'"); |
| @@ -209,11 +209,11 @@ | ||
| 209 | 209 | } |
| 210 | 210 | if( db_table_exists("repository","unversioned") ){ |
| 211 | 211 | Stmt q; |
| 212 | 212 | char zStored[100]; |
| 213 | 213 | db_prepare(&q, |
| 214 | - "SELECT count(*), sum(sz), sum(length(content))" | |
| 214 | + "SELECT count(*), sum(sz), sum(octet_length(content))" | |
| 215 | 215 | " FROM unversioned" |
| 216 | 216 | " WHERE length(hash)>1" |
| 217 | 217 | ); |
| 218 | 218 | if( db_step(&q)==SQLITE_ROW && (n = db_column_int(&q,0))>0 ){ |
| 219 | 219 | sqlite3_int64 iStored, pct; |
| @@ -243,12 +243,12 @@ | ||
| 243 | 243 | if( g.perm.Chat && db_table_exists("repository","chat") ){ |
| 244 | 244 | sqlite3_int64 sz = 0; |
| 245 | 245 | char zSz[100]; |
| 246 | 246 | n = db_int(0, "SELECT max(msgid) FROM chat"); |
| 247 | 247 | m = db_int(0, "SELECT count(*) FROM chat WHERE mdel IS NOT TRUE"); |
| 248 | - sz = db_int64(0, "SELECT sum(coalesce(length(xmsg),0)+" | |
| 249 | - "coalesce(length(file),0)) FROM chat"); | |
| 248 | + sz = db_int64(0, "SELECT sum(coalesce(octet_length(xmsg),0)+" | |
| 249 | + "coalesce(octet_length(file),0)) FROM chat"); | |
| 250 | 250 | approxSizeName(sizeof(zSz), zSz, sz); |
| 251 | 251 | @ <tr><th>Number Of Chat Messages:</th> |
| 252 | 252 | @ <td>%,d(n) (%,d(m) still alive, %s(zSz) in size)</td></tr> |
| 253 | 253 | } |
| 254 | 254 | n = db_int(0, "SELECT count(*) FROM tag /*scan*/" |
| @@ -885,11 +885,11 @@ | ||
| 885 | 885 | @ szCmpr -- size as stored on disk |
| 886 | 886 | @ ); |
| 887 | 887 | @ INSERT INTO artstat(id,atype,isDelta,szExp,szCmpr) |
| 888 | 888 | @ SELECT blob.rid, NULL, |
| 889 | 889 | @ delta.rid IS NOT NULL, |
| 890 | - @ size, length(content) | |
| 890 | + @ size, octet_length(content) | |
| 891 | 891 | @ FROM blob LEFT JOIN delta ON blob.rid=delta.rid |
| 892 | 892 | @ WHERE content IS NOT NULL; |
| 893 | 893 | ; |
| 894 | 894 | static const char zSql2[] = |
| 895 | 895 | @ UPDATE artstat SET atype='file' |
| 896 | 896 |
| --- src/stat.c | |
| +++ src/stat.c | |
| @@ -119,11 +119,11 @@ | |
| 119 | @ <tr><th>Subscribers:</th><td> |
| 120 | } |
| 121 | nSub = db_int(0, "SELECT count(*) FROM subscriber"); |
| 122 | iCutoff = db_get_int("email-renew-cutoff",0); |
| 123 | nASub = db_int(0, "SELECT count(*) FROM subscriber WHERE sverified" |
| 124 | " AND NOT sdonotcall AND length(ssub)>1" |
| 125 | " AND lastContact>=%d;", iCutoff); |
| 126 | @ %,d(nASub) active, %,d(nSub) total |
| 127 | @ </td></tr> |
| 128 | rDigest = db_double(-1.0, "SELECT (julianday('now') - value)*24.0" |
| 129 | " FROM config WHERE name='email-last-digest'"); |
| @@ -209,11 +209,11 @@ | |
| 209 | } |
| 210 | if( db_table_exists("repository","unversioned") ){ |
| 211 | Stmt q; |
| 212 | char zStored[100]; |
| 213 | db_prepare(&q, |
| 214 | "SELECT count(*), sum(sz), sum(length(content))" |
| 215 | " FROM unversioned" |
| 216 | " WHERE length(hash)>1" |
| 217 | ); |
| 218 | if( db_step(&q)==SQLITE_ROW && (n = db_column_int(&q,0))>0 ){ |
| 219 | sqlite3_int64 iStored, pct; |
| @@ -243,12 +243,12 @@ | |
| 243 | if( g.perm.Chat && db_table_exists("repository","chat") ){ |
| 244 | sqlite3_int64 sz = 0; |
| 245 | char zSz[100]; |
| 246 | n = db_int(0, "SELECT max(msgid) FROM chat"); |
| 247 | m = db_int(0, "SELECT count(*) FROM chat WHERE mdel IS NOT TRUE"); |
| 248 | sz = db_int64(0, "SELECT sum(coalesce(length(xmsg),0)+" |
| 249 | "coalesce(length(file),0)) FROM chat"); |
| 250 | approxSizeName(sizeof(zSz), zSz, sz); |
| 251 | @ <tr><th>Number Of Chat Messages:</th> |
| 252 | @ <td>%,d(n) (%,d(m) still alive, %s(zSz) in size)</td></tr> |
| 253 | } |
| 254 | n = db_int(0, "SELECT count(*) FROM tag /*scan*/" |
| @@ -885,11 +885,11 @@ | |
| 885 | @ szCmpr -- size as stored on disk |
| 886 | @ ); |
| 887 | @ INSERT INTO artstat(id,atype,isDelta,szExp,szCmpr) |
| 888 | @ SELECT blob.rid, NULL, |
| 889 | @ delta.rid IS NOT NULL, |
| 890 | @ size, length(content) |
| 891 | @ FROM blob LEFT JOIN delta ON blob.rid=delta.rid |
| 892 | @ WHERE content IS NOT NULL; |
| 893 | ; |
| 894 | static const char zSql2[] = |
| 895 | @ UPDATE artstat SET atype='file' |
| 896 |
| --- src/stat.c | |
| +++ src/stat.c | |
| @@ -119,11 +119,11 @@ | |
| 119 | @ <tr><th>Subscribers:</th><td> |
| 120 | } |
| 121 | nSub = db_int(0, "SELECT count(*) FROM subscriber"); |
| 122 | iCutoff = db_get_int("email-renew-cutoff",0); |
| 123 | nASub = db_int(0, "SELECT count(*) FROM subscriber WHERE sverified" |
| 124 | " AND NOT sdonotcall AND octet_length(ssub)>1" |
| 125 | " AND lastContact>=%d;", iCutoff); |
| 126 | @ %,d(nASub) active, %,d(nSub) total |
| 127 | @ </td></tr> |
| 128 | rDigest = db_double(-1.0, "SELECT (julianday('now') - value)*24.0" |
| 129 | " FROM config WHERE name='email-last-digest'"); |
| @@ -209,11 +209,11 @@ | |
| 209 | } |
| 210 | if( db_table_exists("repository","unversioned") ){ |
| 211 | Stmt q; |
| 212 | char zStored[100]; |
| 213 | db_prepare(&q, |
| 214 | "SELECT count(*), sum(sz), sum(octet_length(content))" |
| 215 | " FROM unversioned" |
| 216 | " WHERE length(hash)>1" |
| 217 | ); |
| 218 | if( db_step(&q)==SQLITE_ROW && (n = db_column_int(&q,0))>0 ){ |
| 219 | sqlite3_int64 iStored, pct; |
| @@ -243,12 +243,12 @@ | |
| 243 | if( g.perm.Chat && db_table_exists("repository","chat") ){ |
| 244 | sqlite3_int64 sz = 0; |
| 245 | char zSz[100]; |
| 246 | n = db_int(0, "SELECT max(msgid) FROM chat"); |
| 247 | m = db_int(0, "SELECT count(*) FROM chat WHERE mdel IS NOT TRUE"); |
| 248 | sz = db_int64(0, "SELECT sum(coalesce(octet_length(xmsg),0)+" |
| 249 | "coalesce(octet_length(file),0)) FROM chat"); |
| 250 | approxSizeName(sizeof(zSz), zSz, sz); |
| 251 | @ <tr><th>Number Of Chat Messages:</th> |
| 252 | @ <td>%,d(n) (%,d(m) still alive, %s(zSz) in size)</td></tr> |
| 253 | } |
| 254 | n = db_int(0, "SELECT count(*) FROM tag /*scan*/" |
| @@ -885,11 +885,11 @@ | |
| 885 | @ szCmpr -- size as stored on disk |
| 886 | @ ); |
| 887 | @ INSERT INTO artstat(id,atype,isDelta,szExp,szCmpr) |
| 888 | @ SELECT blob.rid, NULL, |
| 889 | @ delta.rid IS NOT NULL, |
| 890 | @ size, octet_length(content) |
| 891 | @ FROM blob LEFT JOIN delta ON blob.rid=delta.rid |
| 892 | @ WHERE content IS NOT NULL; |
| 893 | ; |
| 894 | static const char zSql2[] = |
| 895 | @ UPDATE artstat SET atype='file' |
| 896 |