Fossil SCM
Integrate the small-fixes branch. Change auto-shun setting's default from on to off to match what the code does.
Commit
0e1be49ef018af100323faf909618a8d0d76cc8ad87cc4219f1f5e72221c99d4
Parent
45889598287f2db…
27 files changed
+27
-11
+6
-1
+19
-3
+19
-3
+10
-1
+10
-1
+3
+3
+3
-3
+1
-1
+2
-7
+1
-1
+25
-23
-1
+12
-2
+3
-3
+1
-1
+4
-4
+5
-5
+2
-1
+1
-1
+51
+8
-8
+8
-8
+1
+47
-9
-3
~
src/attach.c
~
src/builtin.c
~
src/content.c
~
src/content.c
~
src/db.c
~
src/db.c
~
src/default.css
~
src/default.css
~
src/delta.c
~
src/deltacmd.c
~
src/export.c
~
src/file.c
~
src/forum.c
~
src/fossil.attach.js
~
src/fossil.page.forumpost.js
~
src/manifest.c
~
src/markdown.c
~
src/markdown_html.c
~
src/name.c
~
src/security_audit.c
~
src/style.c
~
src/timeline.c
~
src/tkt.c
~
src/tkt.c
~
src/user.c
~
src/xfer.c
~
tools/translate.c
+27
-11
| --- src/attach.c | ||
| +++ src/attach.c | ||
| @@ -177,11 +177,12 @@ | ||
| 177 | 177 | int attach_user_may(int rid, int eArtifactType){ |
| 178 | 178 | if( g.perm.Admin ) return 1; |
| 179 | 179 | if( !login_is_individual() ) return 0; |
| 180 | 180 | switch(eArtifactType){ |
| 181 | 181 | case CFTYPE_FORUM: |
| 182 | - return g.perm.AttachForum && forumpost_is_owner(rid, 0); | |
| 182 | + return (g.perm.AttachForum || g.perm.WrTForum) | |
| 183 | + && forumpost_is_owner(rid, 0); | |
| 183 | 184 | case CFTYPE_WIKI: |
| 184 | 185 | return g.perm.ApndWiki && g.perm.Attach; |
| 185 | 186 | case CFTYPE_TICKET: |
| 186 | 187 | return g.perm.ApndTkt && g.perm.Attach; |
| 187 | 188 | case CFTYPE_EVENT: |
| @@ -645,11 +646,11 @@ | ||
| 645 | 646 | char *zTargetType = 0; |
| 646 | 647 | char *zExtraFree = 0; |
| 647 | 648 | int szContent; |
| 648 | 649 | int goodCaptcha = 1; |
| 649 | 650 | int szLimit = 0; |
| 650 | - | |
| 651 | + int bNeedsModeration = -1; /* -1==don't yet know */ | |
| 651 | 652 | if( P("target")!=0 ){ |
| 652 | 653 | attachaddV2_page(); |
| 653 | 654 | return; |
| 654 | 655 | } |
| 655 | 656 | zPage = P("page"); |
| @@ -670,12 +671,16 @@ | ||
| 670 | 671 | } |
| 671 | 672 | login_check_credentials(); |
| 672 | 673 | if( zForumPost ){ |
| 673 | 674 | int fpid; |
| 674 | 675 | if( g.perm.AttachForum==0 ){ |
| 675 | - login_needed(g.anon.AttachForum); | |
| 676 | - return; | |
| 676 | + if( g.perm.WrTForum ){ | |
| 677 | + bNeedsModeration = 1; | |
| 678 | + }else{ | |
| 679 | + login_needed(g.anon.AttachForum); | |
| 680 | + return; | |
| 681 | + } | |
| 677 | 682 | } |
| 678 | 683 | fpid = forumpost_head_rid2(zForumPost); |
| 679 | 684 | if( fpid<=0 ){ |
| 680 | 685 | webpage_error("Invalid forum post ID: %h", zForumPost); |
| 681 | 686 | }else if( !g.perm.Admin && !forumpost_is_owner(fpid, 0) ){ |
| @@ -737,14 +742,17 @@ | ||
| 737 | 742 | /* Fall through and render form. */ |
| 738 | 743 | }else if( P("ok") |
| 739 | 744 | && cgi_csrf_safe(2) |
| 740 | 745 | && szContent>0 |
| 741 | 746 | && (goodCaptcha = captcha_is_correct(0)) ){ |
| 742 | - int needModerator = (zForumPost!=0 && forum_need_moderation()) || | |
| 743 | - (zTkt!=0 && ticket_need_moderation(0)) || | |
| 744 | - (zPage!=0 && wiki_need_moderation(0)); | |
| 745 | - attach_commit(zName, zTarget, aContent, szContent, needModerator, zComment); | |
| 747 | + if( bNeedsModeration<0 ){ | |
| 748 | + bNeedsModeration = (zForumPost!=0 && forum_need_moderation()) || | |
| 749 | + (zTkt!=0 && ticket_need_moderation(0)) || | |
| 750 | + (zPage!=0 && wiki_need_moderation(0)); | |
| 751 | + } | |
| 752 | + attach_commit(zName, zTarget, aContent, szContent, | |
| 753 | + bNeedsModeration, zComment); | |
| 746 | 754 | cgi_redirect(zTo ? zTo : zFrom); |
| 747 | 755 | } |
| 748 | 756 | |
| 749 | 757 | style_set_current_feature("attach"); |
| 750 | 758 | style_header("Add Attachment"); |
| @@ -804,11 +812,17 @@ | ||
| 804 | 812 | db_rollback_transaction(); |
| 805 | 813 | return; |
| 806 | 814 | case CFTYPE_FORUM:{ |
| 807 | 815 | int fpid; |
| 808 | 816 | if( g.perm.AttachForum==0 ){ |
| 809 | - goto ajax_err_403; | |
| 817 | + if( g.perm.WrTForum ){ | |
| 818 | + bNeedsModeration = 1; | |
| 819 | + }else{ | |
| 820 | + goto ajax_err_403; | |
| 821 | + } | |
| 822 | + }else{ | |
| 823 | + bNeedsModeration = -1; | |
| 810 | 824 | } |
| 811 | 825 | fpid = forumpost_head_rid2(zTarget); |
| 812 | 826 | if( fpid<=0 ){ |
| 813 | 827 | goto ajax_err_404; |
| 814 | 828 | }else if( !g.perm.Admin && !forumpost_is_owner(fpid, 0) ){ |
| @@ -816,11 +830,13 @@ | ||
| 816 | 830 | "other users' forum posts."); |
| 817 | 831 | db_rollback_transaction(); |
| 818 | 832 | return; |
| 819 | 833 | } |
| 820 | 834 | zTarget = zExtraFree = rid_to_uuid(fpid); |
| 821 | - bNeedsModeration = forum_need_moderation(); | |
| 835 | + if( bNeedsModeration < 0 ){ | |
| 836 | + bNeedsModeration = forum_need_moderation(); | |
| 837 | + } | |
| 822 | 838 | break; |
| 823 | 839 | } |
| 824 | 840 | case CFTYPE_EVENT:{ |
| 825 | 841 | if( g.perm.Write==0 || g.perm.ApndWiki==0 || g.perm.Attach==0 ){ |
| 826 | 842 | goto ajax_err_403; |
| @@ -1006,11 +1022,11 @@ | ||
| 1006 | 1022 | case 0: |
| 1007 | 1023 | webpage_error("Cannot resolve target=%h.", zTarget); |
| 1008 | 1024 | break; |
| 1009 | 1025 | case CFTYPE_FORUM:{ |
| 1010 | 1026 | int fpid; |
| 1011 | - if( g.perm.AttachForum==0 ){ | |
| 1027 | + if( 0==g.perm.AttachForum && 0==g.perm.WrTForum ){ | |
| 1012 | 1028 | login_needed(g.anon.AttachForum); |
| 1013 | 1029 | return; |
| 1014 | 1030 | } |
| 1015 | 1031 | fpid = forumpost_head_rid2(zTarget); |
| 1016 | 1032 | if( fpid<=0 ){ |
| 1017 | 1033 |
| --- src/attach.c | |
| +++ src/attach.c | |
| @@ -177,11 +177,12 @@ | |
| 177 | int attach_user_may(int rid, int eArtifactType){ |
| 178 | if( g.perm.Admin ) return 1; |
| 179 | if( !login_is_individual() ) return 0; |
| 180 | switch(eArtifactType){ |
| 181 | case CFTYPE_FORUM: |
| 182 | return g.perm.AttachForum && forumpost_is_owner(rid, 0); |
| 183 | case CFTYPE_WIKI: |
| 184 | return g.perm.ApndWiki && g.perm.Attach; |
| 185 | case CFTYPE_TICKET: |
| 186 | return g.perm.ApndTkt && g.perm.Attach; |
| 187 | case CFTYPE_EVENT: |
| @@ -645,11 +646,11 @@ | |
| 645 | char *zTargetType = 0; |
| 646 | char *zExtraFree = 0; |
| 647 | int szContent; |
| 648 | int goodCaptcha = 1; |
| 649 | int szLimit = 0; |
| 650 | |
| 651 | if( P("target")!=0 ){ |
| 652 | attachaddV2_page(); |
| 653 | return; |
| 654 | } |
| 655 | zPage = P("page"); |
| @@ -670,12 +671,16 @@ | |
| 670 | } |
| 671 | login_check_credentials(); |
| 672 | if( zForumPost ){ |
| 673 | int fpid; |
| 674 | if( g.perm.AttachForum==0 ){ |
| 675 | login_needed(g.anon.AttachForum); |
| 676 | return; |
| 677 | } |
| 678 | fpid = forumpost_head_rid2(zForumPost); |
| 679 | if( fpid<=0 ){ |
| 680 | webpage_error("Invalid forum post ID: %h", zForumPost); |
| 681 | }else if( !g.perm.Admin && !forumpost_is_owner(fpid, 0) ){ |
| @@ -737,14 +742,17 @@ | |
| 737 | /* Fall through and render form. */ |
| 738 | }else if( P("ok") |
| 739 | && cgi_csrf_safe(2) |
| 740 | && szContent>0 |
| 741 | && (goodCaptcha = captcha_is_correct(0)) ){ |
| 742 | int needModerator = (zForumPost!=0 && forum_need_moderation()) || |
| 743 | (zTkt!=0 && ticket_need_moderation(0)) || |
| 744 | (zPage!=0 && wiki_need_moderation(0)); |
| 745 | attach_commit(zName, zTarget, aContent, szContent, needModerator, zComment); |
| 746 | cgi_redirect(zTo ? zTo : zFrom); |
| 747 | } |
| 748 | |
| 749 | style_set_current_feature("attach"); |
| 750 | style_header("Add Attachment"); |
| @@ -804,11 +812,17 @@ | |
| 804 | db_rollback_transaction(); |
| 805 | return; |
| 806 | case CFTYPE_FORUM:{ |
| 807 | int fpid; |
| 808 | if( g.perm.AttachForum==0 ){ |
| 809 | goto ajax_err_403; |
| 810 | } |
| 811 | fpid = forumpost_head_rid2(zTarget); |
| 812 | if( fpid<=0 ){ |
| 813 | goto ajax_err_404; |
| 814 | }else if( !g.perm.Admin && !forumpost_is_owner(fpid, 0) ){ |
| @@ -816,11 +830,13 @@ | |
| 816 | "other users' forum posts."); |
| 817 | db_rollback_transaction(); |
| 818 | return; |
| 819 | } |
| 820 | zTarget = zExtraFree = rid_to_uuid(fpid); |
| 821 | bNeedsModeration = forum_need_moderation(); |
| 822 | break; |
| 823 | } |
| 824 | case CFTYPE_EVENT:{ |
| 825 | if( g.perm.Write==0 || g.perm.ApndWiki==0 || g.perm.Attach==0 ){ |
| 826 | goto ajax_err_403; |
| @@ -1006,11 +1022,11 @@ | |
| 1006 | case 0: |
| 1007 | webpage_error("Cannot resolve target=%h.", zTarget); |
| 1008 | break; |
| 1009 | case CFTYPE_FORUM:{ |
| 1010 | int fpid; |
| 1011 | if( g.perm.AttachForum==0 ){ |
| 1012 | login_needed(g.anon.AttachForum); |
| 1013 | return; |
| 1014 | } |
| 1015 | fpid = forumpost_head_rid2(zTarget); |
| 1016 | if( fpid<=0 ){ |
| 1017 |
| --- src/attach.c | |
| +++ src/attach.c | |
| @@ -177,11 +177,12 @@ | |
| 177 | int attach_user_may(int rid, int eArtifactType){ |
| 178 | if( g.perm.Admin ) return 1; |
| 179 | if( !login_is_individual() ) return 0; |
| 180 | switch(eArtifactType){ |
| 181 | case CFTYPE_FORUM: |
| 182 | return (g.perm.AttachForum || g.perm.WrTForum) |
| 183 | && forumpost_is_owner(rid, 0); |
| 184 | case CFTYPE_WIKI: |
| 185 | return g.perm.ApndWiki && g.perm.Attach; |
| 186 | case CFTYPE_TICKET: |
| 187 | return g.perm.ApndTkt && g.perm.Attach; |
| 188 | case CFTYPE_EVENT: |
| @@ -645,11 +646,11 @@ | |
| 646 | char *zTargetType = 0; |
| 647 | char *zExtraFree = 0; |
| 648 | int szContent; |
| 649 | int goodCaptcha = 1; |
| 650 | int szLimit = 0; |
| 651 | int bNeedsModeration = -1; /* -1==don't yet know */ |
| 652 | if( P("target")!=0 ){ |
| 653 | attachaddV2_page(); |
| 654 | return; |
| 655 | } |
| 656 | zPage = P("page"); |
| @@ -670,12 +671,16 @@ | |
| 671 | } |
| 672 | login_check_credentials(); |
| 673 | if( zForumPost ){ |
| 674 | int fpid; |
| 675 | if( g.perm.AttachForum==0 ){ |
| 676 | if( g.perm.WrTForum ){ |
| 677 | bNeedsModeration = 1; |
| 678 | }else{ |
| 679 | login_needed(g.anon.AttachForum); |
| 680 | return; |
| 681 | } |
| 682 | } |
| 683 | fpid = forumpost_head_rid2(zForumPost); |
| 684 | if( fpid<=0 ){ |
| 685 | webpage_error("Invalid forum post ID: %h", zForumPost); |
| 686 | }else if( !g.perm.Admin && !forumpost_is_owner(fpid, 0) ){ |
| @@ -737,14 +742,17 @@ | |
| 742 | /* Fall through and render form. */ |
| 743 | }else if( P("ok") |
| 744 | && cgi_csrf_safe(2) |
| 745 | && szContent>0 |
| 746 | && (goodCaptcha = captcha_is_correct(0)) ){ |
| 747 | if( bNeedsModeration<0 ){ |
| 748 | bNeedsModeration = (zForumPost!=0 && forum_need_moderation()) || |
| 749 | (zTkt!=0 && ticket_need_moderation(0)) || |
| 750 | (zPage!=0 && wiki_need_moderation(0)); |
| 751 | } |
| 752 | attach_commit(zName, zTarget, aContent, szContent, |
| 753 | bNeedsModeration, zComment); |
| 754 | cgi_redirect(zTo ? zTo : zFrom); |
| 755 | } |
| 756 | |
| 757 | style_set_current_feature("attach"); |
| 758 | style_header("Add Attachment"); |
| @@ -804,11 +812,17 @@ | |
| 812 | db_rollback_transaction(); |
| 813 | return; |
| 814 | case CFTYPE_FORUM:{ |
| 815 | int fpid; |
| 816 | if( g.perm.AttachForum==0 ){ |
| 817 | if( g.perm.WrTForum ){ |
| 818 | bNeedsModeration = 1; |
| 819 | }else{ |
| 820 | goto ajax_err_403; |
| 821 | } |
| 822 | }else{ |
| 823 | bNeedsModeration = -1; |
| 824 | } |
| 825 | fpid = forumpost_head_rid2(zTarget); |
| 826 | if( fpid<=0 ){ |
| 827 | goto ajax_err_404; |
| 828 | }else if( !g.perm.Admin && !forumpost_is_owner(fpid, 0) ){ |
| @@ -816,11 +830,13 @@ | |
| 830 | "other users' forum posts."); |
| 831 | db_rollback_transaction(); |
| 832 | return; |
| 833 | } |
| 834 | zTarget = zExtraFree = rid_to_uuid(fpid); |
| 835 | if( bNeedsModeration < 0 ){ |
| 836 | bNeedsModeration = forum_need_moderation(); |
| 837 | } |
| 838 | break; |
| 839 | } |
| 840 | case CFTYPE_EVENT:{ |
| 841 | if( g.perm.Write==0 || g.perm.ApndWiki==0 || g.perm.Attach==0 ){ |
| 842 | goto ajax_err_403; |
| @@ -1006,11 +1022,11 @@ | |
| 1022 | case 0: |
| 1023 | webpage_error("Cannot resolve target=%h.", zTarget); |
| 1024 | break; |
| 1025 | case CFTYPE_FORUM:{ |
| 1026 | int fpid; |
| 1027 | if( 0==g.perm.AttachForum && 0==g.perm.WrTForum ){ |
| 1028 | login_needed(g.anon.AttachForum); |
| 1029 | return; |
| 1030 | } |
| 1031 | fpid = forumpost_head_rid2(zTarget); |
| 1032 | if( fpid<=0 ){ |
| 1033 |
+6
-1
| --- src/builtin.c | ||
| +++ src/builtin.c | ||
| @@ -697,11 +697,16 @@ | ||
| 697 | 697 | CX("};\n"/*window.fossil.config.forum*/); |
| 698 | 698 | #define JBOOL(COND) ((COND) ? "true" : "false") |
| 699 | 699 | CX("window.fossil.user = {"); |
| 700 | 700 | CX("name: %!j,", (g.zLogin&&*g.zLogin) ? g.zLogin : "guest"); |
| 701 | 701 | CX("isAdmin: %s,", JBOOL(g.perm.Admin || g.perm.Setup)); |
| 702 | - CX("mayAttachForum: %s,", JBOOL(g.perm.AttachForum)); | |
| 702 | + CX("mayAttachForum: %d,", g.perm.AttachForum | |
| 703 | + ? 1 : (g.perm.WrTForum | |
| 704 | + ? -1 : 0)) | |
| 705 | + /* 0 = no, 1 = 'B' permissions, | |
| 706 | + ** -1 = moderated attachments. Potential TODO is a setting | |
| 707 | + ** to enable this. */; | |
| 703 | 708 | CX("enableDebug: %s,", JBOOL(g.perm.Debug || g.perm.Admin)); |
| 704 | 709 | CX("isIndividual: %s", JBOOL(login_is_individual())); |
| 705 | 710 | CX("};\n"/*fossil.user*/); |
| 706 | 711 | { /* Workaround for cases like: |
| 707 | 712 | ** https://fossil-scm.org/forum/forumpost/31cc00b361496cb8 |
| 708 | 713 |
| --- src/builtin.c | |
| +++ src/builtin.c | |
| @@ -697,11 +697,16 @@ | |
| 697 | CX("};\n"/*window.fossil.config.forum*/); |
| 698 | #define JBOOL(COND) ((COND) ? "true" : "false") |
| 699 | CX("window.fossil.user = {"); |
| 700 | CX("name: %!j,", (g.zLogin&&*g.zLogin) ? g.zLogin : "guest"); |
| 701 | CX("isAdmin: %s,", JBOOL(g.perm.Admin || g.perm.Setup)); |
| 702 | CX("mayAttachForum: %s,", JBOOL(g.perm.AttachForum)); |
| 703 | CX("enableDebug: %s,", JBOOL(g.perm.Debug || g.perm.Admin)); |
| 704 | CX("isIndividual: %s", JBOOL(login_is_individual())); |
| 705 | CX("};\n"/*fossil.user*/); |
| 706 | { /* Workaround for cases like: |
| 707 | ** https://fossil-scm.org/forum/forumpost/31cc00b361496cb8 |
| 708 |
| --- src/builtin.c | |
| +++ src/builtin.c | |
| @@ -697,11 +697,16 @@ | |
| 697 | CX("};\n"/*window.fossil.config.forum*/); |
| 698 | #define JBOOL(COND) ((COND) ? "true" : "false") |
| 699 | CX("window.fossil.user = {"); |
| 700 | CX("name: %!j,", (g.zLogin&&*g.zLogin) ? g.zLogin : "guest"); |
| 701 | CX("isAdmin: %s,", JBOOL(g.perm.Admin || g.perm.Setup)); |
| 702 | CX("mayAttachForum: %d,", g.perm.AttachForum |
| 703 | ? 1 : (g.perm.WrTForum |
| 704 | ? -1 : 0)) |
| 705 | /* 0 = no, 1 = 'B' permissions, |
| 706 | ** -1 = moderated attachments. Potential TODO is a setting |
| 707 | ** to enable this. */; |
| 708 | CX("enableDebug: %s,", JBOOL(g.perm.Debug || g.perm.Admin)); |
| 709 | CX("isIndividual: %s", JBOOL(login_is_individual())); |
| 710 | CX("};\n"/*fossil.user*/); |
| 711 | { /* Workaround for cases like: |
| 712 | ** https://fossil-scm.org/forum/forumpost/31cc00b361496cb8 |
| 713 |
+19
-3
| --- src/content.c | ||
| +++ src/content.c | ||
| @@ -989,10 +989,12 @@ | ||
| 989 | 989 | ** |
| 990 | 990 | ** Verify that all content can be extracted from the BLOB table correctly. |
| 991 | 991 | ** If the BLOB table is correct, then the repository can always be |
| 992 | 992 | ** successfully reconstructed using "fossil rebuild". |
| 993 | 993 | ** |
| 994 | +** The exit status is 1 if any error is found. | |
| 995 | +** | |
| 994 | 996 | ** Options: |
| 995 | 997 | ** -d|--db-only Run "PRAGMA integrity_check" on the database only. |
| 996 | 998 | ** No other validation is performed. |
| 997 | 999 | ** --parse Parse all manifests, wikis, tickets, events, and |
| 998 | 1000 | ** so forth, reporting any errors found. |
| @@ -1011,14 +1013,14 @@ | ||
| 1011 | 1013 | int nPhantom = 0; |
| 1012 | 1014 | int anCA[10]; |
| 1013 | 1015 | int bParse = find_option("parse",0,0)!=0; |
| 1014 | 1016 | int bDbOnly = find_option("db-only","d",0)!=0; |
| 1015 | 1017 | int bQuick = find_option("quick",0,0)!=0; |
| 1018 | + char *zRes; | |
| 1016 | 1019 | db_find_and_open_repository(OPEN_ANY_SCHEMA, 2); |
| 1017 | 1020 | if( bDbOnly || bQuick ){ |
| 1018 | 1021 | const char *zType = bQuick ? "quick" : "integrity"; |
| 1019 | - char *zRes; | |
| 1020 | 1022 | zRes = db_text(0,"PRAGMA repository.%s_check", zType/*safe-for-%s*/); |
| 1021 | 1023 | if( fossil_strcmp(zRes,"ok")!=0 ){ |
| 1022 | 1024 | fossil_print("%s_check failed!\n", zType); |
| 1023 | 1025 | exit(1); |
| 1024 | 1026 | }else{ |
| @@ -1091,10 +1093,19 @@ | ||
| 1091 | 1093 | p = manifest_parse(&content, 0, &err); |
| 1092 | 1094 | if( p==0 ){ |
| 1093 | 1095 | fossil_print("\nmanifest_parse failed for %s:\n%s\n", |
| 1094 | 1096 | zUuid, blob_str(&err)); |
| 1095 | 1097 | nParseErr++; |
| 1098 | + /* An ordinary file can look like a control artifact and fail to | |
| 1099 | + ** parse. That is an error only if the repository has it down | |
| 1100 | + ** as a check-in, wiki page, ticket or the like, or as a cluster. */ | |
| 1101 | + if( db_exists("SELECT 1 FROM event WHERE objid=%d" | |
| 1102 | + " UNION ALL" | |
| 1103 | + " SELECT 1 FROM tagxref WHERE rid=%d AND tagid=%d", | |
| 1104 | + rid, rid, TAG_CLUSTER) ){ | |
| 1105 | + nErr++; | |
| 1106 | + } | |
| 1096 | 1107 | if( strncmp(blob_str(&err), "line 1:", 7)==0 ){ |
| 1097 | 1108 | fossil_print("\"%s\"\n", zFirstLine); |
| 1098 | 1109 | } |
| 1099 | 1110 | }else{ |
| 1100 | 1111 | anCA[p->type]++; |
| @@ -1123,11 +1134,15 @@ | ||
| 1123 | 1134 | for(i=1; i<count(azType); i++){ |
| 1124 | 1135 | if( anCA[i] ) fossil_print(" %d %ss\n", anCA[i], azType[i]); |
| 1125 | 1136 | } |
| 1126 | 1137 | } |
| 1127 | 1138 | fossil_print("low-level database integrity-check: "); |
| 1128 | - fossil_print("%s\n", db_text(0, "PRAGMA integrity_check(10)")); | |
| 1139 | + zRes = db_text(0, "PRAGMA repository.integrity_check(10)"); | |
| 1140 | + fossil_print("%s\n", zRes); | |
| 1141 | + if( fossil_strcmp(zRes,"ok")!=0 ) nErr++; | |
| 1142 | + fossil_free(zRes); | |
| 1143 | + if( nErr ) fossil_exit(1); | |
| 1129 | 1144 | } |
| 1130 | 1145 | |
| 1131 | 1146 | /* |
| 1132 | 1147 | ** COMMAND: test-orphans |
| 1133 | 1148 | ** |
| @@ -1234,11 +1249,11 @@ | ||
| 1234 | 1249 | ** |
| 1235 | 1250 | ** Usage: %fossil test-missing |
| 1236 | 1251 | ** |
| 1237 | 1252 | ** Look at every artifact in the repository and verify that |
| 1238 | 1253 | ** all references are satisfied. Report any referenced artifacts |
| 1239 | -** that are missing or shunned. | |
| 1254 | +** that are missing or shunned. The exit status is 1 if any are found. | |
| 1240 | 1255 | ** |
| 1241 | 1256 | ** Options: |
| 1242 | 1257 | ** --notshunned Do not report shunned artifacts |
| 1243 | 1258 | ** -q|--quiet Only show output if there are errors |
| 1244 | 1259 | */ |
| @@ -1294,10 +1309,11 @@ | ||
| 1294 | 1309 | db_finalize(&q); |
| 1295 | 1310 | if( nErr>0 || quietFlag==0 ){ |
| 1296 | 1311 | fossil_print("%d missing or shunned references in %d control artifacts\n", |
| 1297 | 1312 | nErr, nArtifact); |
| 1298 | 1313 | } |
| 1314 | + if( nErr ) fossil_exit(1); | |
| 1299 | 1315 | } |
| 1300 | 1316 | |
| 1301 | 1317 | /* |
| 1302 | 1318 | ** COMMAND: test-content-erase |
| 1303 | 1319 | ** |
| 1304 | 1320 |
| --- src/content.c | |
| +++ src/content.c | |
| @@ -989,10 +989,12 @@ | |
| 989 | ** |
| 990 | ** Verify that all content can be extracted from the BLOB table correctly. |
| 991 | ** If the BLOB table is correct, then the repository can always be |
| 992 | ** successfully reconstructed using "fossil rebuild". |
| 993 | ** |
| 994 | ** Options: |
| 995 | ** -d|--db-only Run "PRAGMA integrity_check" on the database only. |
| 996 | ** No other validation is performed. |
| 997 | ** --parse Parse all manifests, wikis, tickets, events, and |
| 998 | ** so forth, reporting any errors found. |
| @@ -1011,14 +1013,14 @@ | |
| 1011 | int nPhantom = 0; |
| 1012 | int anCA[10]; |
| 1013 | int bParse = find_option("parse",0,0)!=0; |
| 1014 | int bDbOnly = find_option("db-only","d",0)!=0; |
| 1015 | int bQuick = find_option("quick",0,0)!=0; |
| 1016 | db_find_and_open_repository(OPEN_ANY_SCHEMA, 2); |
| 1017 | if( bDbOnly || bQuick ){ |
| 1018 | const char *zType = bQuick ? "quick" : "integrity"; |
| 1019 | char *zRes; |
| 1020 | zRes = db_text(0,"PRAGMA repository.%s_check", zType/*safe-for-%s*/); |
| 1021 | if( fossil_strcmp(zRes,"ok")!=0 ){ |
| 1022 | fossil_print("%s_check failed!\n", zType); |
| 1023 | exit(1); |
| 1024 | }else{ |
| @@ -1091,10 +1093,19 @@ | |
| 1091 | p = manifest_parse(&content, 0, &err); |
| 1092 | if( p==0 ){ |
| 1093 | fossil_print("\nmanifest_parse failed for %s:\n%s\n", |
| 1094 | zUuid, blob_str(&err)); |
| 1095 | nParseErr++; |
| 1096 | if( strncmp(blob_str(&err), "line 1:", 7)==0 ){ |
| 1097 | fossil_print("\"%s\"\n", zFirstLine); |
| 1098 | } |
| 1099 | }else{ |
| 1100 | anCA[p->type]++; |
| @@ -1123,11 +1134,15 @@ | |
| 1123 | for(i=1; i<count(azType); i++){ |
| 1124 | if( anCA[i] ) fossil_print(" %d %ss\n", anCA[i], azType[i]); |
| 1125 | } |
| 1126 | } |
| 1127 | fossil_print("low-level database integrity-check: "); |
| 1128 | fossil_print("%s\n", db_text(0, "PRAGMA integrity_check(10)")); |
| 1129 | } |
| 1130 | |
| 1131 | /* |
| 1132 | ** COMMAND: test-orphans |
| 1133 | ** |
| @@ -1234,11 +1249,11 @@ | |
| 1234 | ** |
| 1235 | ** Usage: %fossil test-missing |
| 1236 | ** |
| 1237 | ** Look at every artifact in the repository and verify that |
| 1238 | ** all references are satisfied. Report any referenced artifacts |
| 1239 | ** that are missing or shunned. |
| 1240 | ** |
| 1241 | ** Options: |
| 1242 | ** --notshunned Do not report shunned artifacts |
| 1243 | ** -q|--quiet Only show output if there are errors |
| 1244 | */ |
| @@ -1294,10 +1309,11 @@ | |
| 1294 | db_finalize(&q); |
| 1295 | if( nErr>0 || quietFlag==0 ){ |
| 1296 | fossil_print("%d missing or shunned references in %d control artifacts\n", |
| 1297 | nErr, nArtifact); |
| 1298 | } |
| 1299 | } |
| 1300 | |
| 1301 | /* |
| 1302 | ** COMMAND: test-content-erase |
| 1303 | ** |
| 1304 |
| --- src/content.c | |
| +++ src/content.c | |
| @@ -989,10 +989,12 @@ | |
| 989 | ** |
| 990 | ** Verify that all content can be extracted from the BLOB table correctly. |
| 991 | ** If the BLOB table is correct, then the repository can always be |
| 992 | ** successfully reconstructed using "fossil rebuild". |
| 993 | ** |
| 994 | ** The exit status is 1 if any error is found. |
| 995 | ** |
| 996 | ** Options: |
| 997 | ** -d|--db-only Run "PRAGMA integrity_check" on the database only. |
| 998 | ** No other validation is performed. |
| 999 | ** --parse Parse all manifests, wikis, tickets, events, and |
| 1000 | ** so forth, reporting any errors found. |
| @@ -1011,14 +1013,14 @@ | |
| 1013 | int nPhantom = 0; |
| 1014 | int anCA[10]; |
| 1015 | int bParse = find_option("parse",0,0)!=0; |
| 1016 | int bDbOnly = find_option("db-only","d",0)!=0; |
| 1017 | int bQuick = find_option("quick",0,0)!=0; |
| 1018 | char *zRes; |
| 1019 | db_find_and_open_repository(OPEN_ANY_SCHEMA, 2); |
| 1020 | if( bDbOnly || bQuick ){ |
| 1021 | const char *zType = bQuick ? "quick" : "integrity"; |
| 1022 | zRes = db_text(0,"PRAGMA repository.%s_check", zType/*safe-for-%s*/); |
| 1023 | if( fossil_strcmp(zRes,"ok")!=0 ){ |
| 1024 | fossil_print("%s_check failed!\n", zType); |
| 1025 | exit(1); |
| 1026 | }else{ |
| @@ -1091,10 +1093,19 @@ | |
| 1093 | p = manifest_parse(&content, 0, &err); |
| 1094 | if( p==0 ){ |
| 1095 | fossil_print("\nmanifest_parse failed for %s:\n%s\n", |
| 1096 | zUuid, blob_str(&err)); |
| 1097 | nParseErr++; |
| 1098 | /* An ordinary file can look like a control artifact and fail to |
| 1099 | ** parse. That is an error only if the repository has it down |
| 1100 | ** as a check-in, wiki page, ticket or the like, or as a cluster. */ |
| 1101 | if( db_exists("SELECT 1 FROM event WHERE objid=%d" |
| 1102 | " UNION ALL" |
| 1103 | " SELECT 1 FROM tagxref WHERE rid=%d AND tagid=%d", |
| 1104 | rid, rid, TAG_CLUSTER) ){ |
| 1105 | nErr++; |
| 1106 | } |
| 1107 | if( strncmp(blob_str(&err), "line 1:", 7)==0 ){ |
| 1108 | fossil_print("\"%s\"\n", zFirstLine); |
| 1109 | } |
| 1110 | }else{ |
| 1111 | anCA[p->type]++; |
| @@ -1123,11 +1134,15 @@ | |
| 1134 | for(i=1; i<count(azType); i++){ |
| 1135 | if( anCA[i] ) fossil_print(" %d %ss\n", anCA[i], azType[i]); |
| 1136 | } |
| 1137 | } |
| 1138 | fossil_print("low-level database integrity-check: "); |
| 1139 | zRes = db_text(0, "PRAGMA repository.integrity_check(10)"); |
| 1140 | fossil_print("%s\n", zRes); |
| 1141 | if( fossil_strcmp(zRes,"ok")!=0 ) nErr++; |
| 1142 | fossil_free(zRes); |
| 1143 | if( nErr ) fossil_exit(1); |
| 1144 | } |
| 1145 | |
| 1146 | /* |
| 1147 | ** COMMAND: test-orphans |
| 1148 | ** |
| @@ -1234,11 +1249,11 @@ | |
| 1249 | ** |
| 1250 | ** Usage: %fossil test-missing |
| 1251 | ** |
| 1252 | ** Look at every artifact in the repository and verify that |
| 1253 | ** all references are satisfied. Report any referenced artifacts |
| 1254 | ** that are missing or shunned. The exit status is 1 if any are found. |
| 1255 | ** |
| 1256 | ** Options: |
| 1257 | ** --notshunned Do not report shunned artifacts |
| 1258 | ** -q|--quiet Only show output if there are errors |
| 1259 | */ |
| @@ -1294,10 +1309,11 @@ | |
| 1309 | db_finalize(&q); |
| 1310 | if( nErr>0 || quietFlag==0 ){ |
| 1311 | fossil_print("%d missing or shunned references in %d control artifacts\n", |
| 1312 | nErr, nArtifact); |
| 1313 | } |
| 1314 | if( nErr ) fossil_exit(1); |
| 1315 | } |
| 1316 | |
| 1317 | /* |
| 1318 | ** COMMAND: test-content-erase |
| 1319 | ** |
| 1320 |
+19
-3
| --- src/content.c | ||
| +++ src/content.c | ||
| @@ -989,10 +989,12 @@ | ||
| 989 | 989 | ** |
| 990 | 990 | ** Verify that all content can be extracted from the BLOB table correctly. |
| 991 | 991 | ** If the BLOB table is correct, then the repository can always be |
| 992 | 992 | ** successfully reconstructed using "fossil rebuild". |
| 993 | 993 | ** |
| 994 | +** The exit status is 1 if any error is found. | |
| 995 | +** | |
| 994 | 996 | ** Options: |
| 995 | 997 | ** -d|--db-only Run "PRAGMA integrity_check" on the database only. |
| 996 | 998 | ** No other validation is performed. |
| 997 | 999 | ** --parse Parse all manifests, wikis, tickets, events, and |
| 998 | 1000 | ** so forth, reporting any errors found. |
| @@ -1011,14 +1013,14 @@ | ||
| 1011 | 1013 | int nPhantom = 0; |
| 1012 | 1014 | int anCA[10]; |
| 1013 | 1015 | int bParse = find_option("parse",0,0)!=0; |
| 1014 | 1016 | int bDbOnly = find_option("db-only","d",0)!=0; |
| 1015 | 1017 | int bQuick = find_option("quick",0,0)!=0; |
| 1018 | + char *zRes; | |
| 1016 | 1019 | db_find_and_open_repository(OPEN_ANY_SCHEMA, 2); |
| 1017 | 1020 | if( bDbOnly || bQuick ){ |
| 1018 | 1021 | const char *zType = bQuick ? "quick" : "integrity"; |
| 1019 | - char *zRes; | |
| 1020 | 1022 | zRes = db_text(0,"PRAGMA repository.%s_check", zType/*safe-for-%s*/); |
| 1021 | 1023 | if( fossil_strcmp(zRes,"ok")!=0 ){ |
| 1022 | 1024 | fossil_print("%s_check failed!\n", zType); |
| 1023 | 1025 | exit(1); |
| 1024 | 1026 | }else{ |
| @@ -1091,10 +1093,19 @@ | ||
| 1091 | 1093 | p = manifest_parse(&content, 0, &err); |
| 1092 | 1094 | if( p==0 ){ |
| 1093 | 1095 | fossil_print("\nmanifest_parse failed for %s:\n%s\n", |
| 1094 | 1096 | zUuid, blob_str(&err)); |
| 1095 | 1097 | nParseErr++; |
| 1098 | + /* An ordinary file can look like a control artifact and fail to | |
| 1099 | + ** parse. That is an error only if the repository has it down | |
| 1100 | + ** as a check-in, wiki page, ticket or the like, or as a cluster. */ | |
| 1101 | + if( db_exists("SELECT 1 FROM event WHERE objid=%d" | |
| 1102 | + " UNION ALL" | |
| 1103 | + " SELECT 1 FROM tagxref WHERE rid=%d AND tagid=%d", | |
| 1104 | + rid, rid, TAG_CLUSTER) ){ | |
| 1105 | + nErr++; | |
| 1106 | + } | |
| 1096 | 1107 | if( strncmp(blob_str(&err), "line 1:", 7)==0 ){ |
| 1097 | 1108 | fossil_print("\"%s\"\n", zFirstLine); |
| 1098 | 1109 | } |
| 1099 | 1110 | }else{ |
| 1100 | 1111 | anCA[p->type]++; |
| @@ -1123,11 +1134,15 @@ | ||
| 1123 | 1134 | for(i=1; i<count(azType); i++){ |
| 1124 | 1135 | if( anCA[i] ) fossil_print(" %d %ss\n", anCA[i], azType[i]); |
| 1125 | 1136 | } |
| 1126 | 1137 | } |
| 1127 | 1138 | fossil_print("low-level database integrity-check: "); |
| 1128 | - fossil_print("%s\n", db_text(0, "PRAGMA integrity_check(10)")); | |
| 1139 | + zRes = db_text(0, "PRAGMA repository.integrity_check(10)"); | |
| 1140 | + fossil_print("%s\n", zRes); | |
| 1141 | + if( fossil_strcmp(zRes,"ok")!=0 ) nErr++; | |
| 1142 | + fossil_free(zRes); | |
| 1143 | + if( nErr ) fossil_exit(1); | |
| 1129 | 1144 | } |
| 1130 | 1145 | |
| 1131 | 1146 | /* |
| 1132 | 1147 | ** COMMAND: test-orphans |
| 1133 | 1148 | ** |
| @@ -1234,11 +1249,11 @@ | ||
| 1234 | 1249 | ** |
| 1235 | 1250 | ** Usage: %fossil test-missing |
| 1236 | 1251 | ** |
| 1237 | 1252 | ** Look at every artifact in the repository and verify that |
| 1238 | 1253 | ** all references are satisfied. Report any referenced artifacts |
| 1239 | -** that are missing or shunned. | |
| 1254 | +** that are missing or shunned. The exit status is 1 if any are found. | |
| 1240 | 1255 | ** |
| 1241 | 1256 | ** Options: |
| 1242 | 1257 | ** --notshunned Do not report shunned artifacts |
| 1243 | 1258 | ** -q|--quiet Only show output if there are errors |
| 1244 | 1259 | */ |
| @@ -1294,10 +1309,11 @@ | ||
| 1294 | 1309 | db_finalize(&q); |
| 1295 | 1310 | if( nErr>0 || quietFlag==0 ){ |
| 1296 | 1311 | fossil_print("%d missing or shunned references in %d control artifacts\n", |
| 1297 | 1312 | nErr, nArtifact); |
| 1298 | 1313 | } |
| 1314 | + if( nErr ) fossil_exit(1); | |
| 1299 | 1315 | } |
| 1300 | 1316 | |
| 1301 | 1317 | /* |
| 1302 | 1318 | ** COMMAND: test-content-erase |
| 1303 | 1319 | ** |
| 1304 | 1320 |
| --- src/content.c | |
| +++ src/content.c | |
| @@ -989,10 +989,12 @@ | |
| 989 | ** |
| 990 | ** Verify that all content can be extracted from the BLOB table correctly. |
| 991 | ** If the BLOB table is correct, then the repository can always be |
| 992 | ** successfully reconstructed using "fossil rebuild". |
| 993 | ** |
| 994 | ** Options: |
| 995 | ** -d|--db-only Run "PRAGMA integrity_check" on the database only. |
| 996 | ** No other validation is performed. |
| 997 | ** --parse Parse all manifests, wikis, tickets, events, and |
| 998 | ** so forth, reporting any errors found. |
| @@ -1011,14 +1013,14 @@ | |
| 1011 | int nPhantom = 0; |
| 1012 | int anCA[10]; |
| 1013 | int bParse = find_option("parse",0,0)!=0; |
| 1014 | int bDbOnly = find_option("db-only","d",0)!=0; |
| 1015 | int bQuick = find_option("quick",0,0)!=0; |
| 1016 | db_find_and_open_repository(OPEN_ANY_SCHEMA, 2); |
| 1017 | if( bDbOnly || bQuick ){ |
| 1018 | const char *zType = bQuick ? "quick" : "integrity"; |
| 1019 | char *zRes; |
| 1020 | zRes = db_text(0,"PRAGMA repository.%s_check", zType/*safe-for-%s*/); |
| 1021 | if( fossil_strcmp(zRes,"ok")!=0 ){ |
| 1022 | fossil_print("%s_check failed!\n", zType); |
| 1023 | exit(1); |
| 1024 | }else{ |
| @@ -1091,10 +1093,19 @@ | |
| 1091 | p = manifest_parse(&content, 0, &err); |
| 1092 | if( p==0 ){ |
| 1093 | fossil_print("\nmanifest_parse failed for %s:\n%s\n", |
| 1094 | zUuid, blob_str(&err)); |
| 1095 | nParseErr++; |
| 1096 | if( strncmp(blob_str(&err), "line 1:", 7)==0 ){ |
| 1097 | fossil_print("\"%s\"\n", zFirstLine); |
| 1098 | } |
| 1099 | }else{ |
| 1100 | anCA[p->type]++; |
| @@ -1123,11 +1134,15 @@ | |
| 1123 | for(i=1; i<count(azType); i++){ |
| 1124 | if( anCA[i] ) fossil_print(" %d %ss\n", anCA[i], azType[i]); |
| 1125 | } |
| 1126 | } |
| 1127 | fossil_print("low-level database integrity-check: "); |
| 1128 | fossil_print("%s\n", db_text(0, "PRAGMA integrity_check(10)")); |
| 1129 | } |
| 1130 | |
| 1131 | /* |
| 1132 | ** COMMAND: test-orphans |
| 1133 | ** |
| @@ -1234,11 +1249,11 @@ | |
| 1234 | ** |
| 1235 | ** Usage: %fossil test-missing |
| 1236 | ** |
| 1237 | ** Look at every artifact in the repository and verify that |
| 1238 | ** all references are satisfied. Report any referenced artifacts |
| 1239 | ** that are missing or shunned. |
| 1240 | ** |
| 1241 | ** Options: |
| 1242 | ** --notshunned Do not report shunned artifacts |
| 1243 | ** -q|--quiet Only show output if there are errors |
| 1244 | */ |
| @@ -1294,10 +1309,11 @@ | |
| 1294 | db_finalize(&q); |
| 1295 | if( nErr>0 || quietFlag==0 ){ |
| 1296 | fossil_print("%d missing or shunned references in %d control artifacts\n", |
| 1297 | nErr, nArtifact); |
| 1298 | } |
| 1299 | } |
| 1300 | |
| 1301 | /* |
| 1302 | ** COMMAND: test-content-erase |
| 1303 | ** |
| 1304 |
| --- src/content.c | |
| +++ src/content.c | |
| @@ -989,10 +989,12 @@ | |
| 989 | ** |
| 990 | ** Verify that all content can be extracted from the BLOB table correctly. |
| 991 | ** If the BLOB table is correct, then the repository can always be |
| 992 | ** successfully reconstructed using "fossil rebuild". |
| 993 | ** |
| 994 | ** The exit status is 1 if any error is found. |
| 995 | ** |
| 996 | ** Options: |
| 997 | ** -d|--db-only Run "PRAGMA integrity_check" on the database only. |
| 998 | ** No other validation is performed. |
| 999 | ** --parse Parse all manifests, wikis, tickets, events, and |
| 1000 | ** so forth, reporting any errors found. |
| @@ -1011,14 +1013,14 @@ | |
| 1013 | int nPhantom = 0; |
| 1014 | int anCA[10]; |
| 1015 | int bParse = find_option("parse",0,0)!=0; |
| 1016 | int bDbOnly = find_option("db-only","d",0)!=0; |
| 1017 | int bQuick = find_option("quick",0,0)!=0; |
| 1018 | char *zRes; |
| 1019 | db_find_and_open_repository(OPEN_ANY_SCHEMA, 2); |
| 1020 | if( bDbOnly || bQuick ){ |
| 1021 | const char *zType = bQuick ? "quick" : "integrity"; |
| 1022 | zRes = db_text(0,"PRAGMA repository.%s_check", zType/*safe-for-%s*/); |
| 1023 | if( fossil_strcmp(zRes,"ok")!=0 ){ |
| 1024 | fossil_print("%s_check failed!\n", zType); |
| 1025 | exit(1); |
| 1026 | }else{ |
| @@ -1091,10 +1093,19 @@ | |
| 1093 | p = manifest_parse(&content, 0, &err); |
| 1094 | if( p==0 ){ |
| 1095 | fossil_print("\nmanifest_parse failed for %s:\n%s\n", |
| 1096 | zUuid, blob_str(&err)); |
| 1097 | nParseErr++; |
| 1098 | /* An ordinary file can look like a control artifact and fail to |
| 1099 | ** parse. That is an error only if the repository has it down |
| 1100 | ** as a check-in, wiki page, ticket or the like, or as a cluster. */ |
| 1101 | if( db_exists("SELECT 1 FROM event WHERE objid=%d" |
| 1102 | " UNION ALL" |
| 1103 | " SELECT 1 FROM tagxref WHERE rid=%d AND tagid=%d", |
| 1104 | rid, rid, TAG_CLUSTER) ){ |
| 1105 | nErr++; |
| 1106 | } |
| 1107 | if( strncmp(blob_str(&err), "line 1:", 7)==0 ){ |
| 1108 | fossil_print("\"%s\"\n", zFirstLine); |
| 1109 | } |
| 1110 | }else{ |
| 1111 | anCA[p->type]++; |
| @@ -1123,11 +1134,15 @@ | |
| 1134 | for(i=1; i<count(azType); i++){ |
| 1135 | if( anCA[i] ) fossil_print(" %d %ss\n", anCA[i], azType[i]); |
| 1136 | } |
| 1137 | } |
| 1138 | fossil_print("low-level database integrity-check: "); |
| 1139 | zRes = db_text(0, "PRAGMA repository.integrity_check(10)"); |
| 1140 | fossil_print("%s\n", zRes); |
| 1141 | if( fossil_strcmp(zRes,"ok")!=0 ) nErr++; |
| 1142 | fossil_free(zRes); |
| 1143 | if( nErr ) fossil_exit(1); |
| 1144 | } |
| 1145 | |
| 1146 | /* |
| 1147 | ** COMMAND: test-orphans |
| 1148 | ** |
| @@ -1234,11 +1249,11 @@ | |
| 1249 | ** |
| 1250 | ** Usage: %fossil test-missing |
| 1251 | ** |
| 1252 | ** Look at every artifact in the repository and verify that |
| 1253 | ** all references are satisfied. Report any referenced artifacts |
| 1254 | ** that are missing or shunned. The exit status is 1 if any are found. |
| 1255 | ** |
| 1256 | ** Options: |
| 1257 | ** --notshunned Do not report shunned artifacts |
| 1258 | ** -q|--quiet Only show output if there are errors |
| 1259 | */ |
| @@ -1294,10 +1309,11 @@ | |
| 1309 | db_finalize(&q); |
| 1310 | if( nErr>0 || quietFlag==0 ){ |
| 1311 | fossil_print("%d missing or shunned references in %d control artifacts\n", |
| 1312 | nErr, nArtifact); |
| 1313 | } |
| 1314 | if( nErr ) fossil_exit(1); |
| 1315 | } |
| 1316 | |
| 1317 | /* |
| 1318 | ** COMMAND: test-content-erase |
| 1319 | ** |
| 1320 |
M
src/db.c
+10
-1
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -4676,11 +4676,11 @@ | ||
| 4676 | 4676 | ** until either a mousedown or mousemove event is seen. This helps |
| 4677 | 4677 | ** to distinguish real users from robots. For maximum robot defense, |
| 4678 | 4678 | ** the recommended setting is ON. |
| 4679 | 4679 | */ |
| 4680 | 4680 | /* |
| 4681 | -** SETTING: auto-shun boolean default=on | |
| 4681 | +** SETTING: auto-shun boolean default=off | |
| 4682 | 4682 | ** If enabled, automatically pull the shunning list |
| 4683 | 4683 | ** from a server to which the client autosyncs. |
| 4684 | 4684 | */ |
| 4685 | 4685 | /* |
| 4686 | 4686 | ** SETTING: autosync width=16 default=on |
| @@ -4927,10 +4927,19 @@ | ||
| 4927 | 4927 | /* |
| 4928 | 4928 | ** SETTING: http-port width=16 default=8080 |
| 4929 | 4929 | ** The default TCP/IP port number to use by the "server" |
| 4930 | 4930 | ** and "ui" commands. |
| 4931 | 4931 | */ |
| 4932 | +/* | |
| 4933 | +** SETTING: hide-by-user width=40 block-text | |
| 4934 | +** The VALUE of this setting is a list of GLOB patterns. On the /timeline | |
| 4935 | +** page, any check-in whose user login name matches one of these patterns | |
| 4936 | +** is treated as if it carried the "hidden" tag, and is omitted unless the | |
| 4937 | +** "unhide=on" query parameter is used. Example: bot-*,*-robot | |
| 4938 | +** The parsing rules are complex; see | |
| 4939 | +** https://fossil-scm.org/home/doc/trunk/www/globs.md#syntax | |
| 4940 | +*/ | |
| 4932 | 4941 | /* |
| 4933 | 4942 | ** SETTING: https-login boolean default=off |
| 4934 | 4943 | ** If true, then the Fossil web server will redirect unencrypted |
| 4935 | 4944 | ** login screen requests to HTTPS. |
| 4936 | 4945 | */ |
| 4937 | 4946 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -4676,11 +4676,11 @@ | |
| 4676 | ** until either a mousedown or mousemove event is seen. This helps |
| 4677 | ** to distinguish real users from robots. For maximum robot defense, |
| 4678 | ** the recommended setting is ON. |
| 4679 | */ |
| 4680 | /* |
| 4681 | ** SETTING: auto-shun boolean default=on |
| 4682 | ** If enabled, automatically pull the shunning list |
| 4683 | ** from a server to which the client autosyncs. |
| 4684 | */ |
| 4685 | /* |
| 4686 | ** SETTING: autosync width=16 default=on |
| @@ -4927,10 +4927,19 @@ | |
| 4927 | /* |
| 4928 | ** SETTING: http-port width=16 default=8080 |
| 4929 | ** The default TCP/IP port number to use by the "server" |
| 4930 | ** and "ui" commands. |
| 4931 | */ |
| 4932 | /* |
| 4933 | ** SETTING: https-login boolean default=off |
| 4934 | ** If true, then the Fossil web server will redirect unencrypted |
| 4935 | ** login screen requests to HTTPS. |
| 4936 | */ |
| 4937 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -4676,11 +4676,11 @@ | |
| 4676 | ** until either a mousedown or mousemove event is seen. This helps |
| 4677 | ** to distinguish real users from robots. For maximum robot defense, |
| 4678 | ** the recommended setting is ON. |
| 4679 | */ |
| 4680 | /* |
| 4681 | ** SETTING: auto-shun boolean default=off |
| 4682 | ** If enabled, automatically pull the shunning list |
| 4683 | ** from a server to which the client autosyncs. |
| 4684 | */ |
| 4685 | /* |
| 4686 | ** SETTING: autosync width=16 default=on |
| @@ -4927,10 +4927,19 @@ | |
| 4927 | /* |
| 4928 | ** SETTING: http-port width=16 default=8080 |
| 4929 | ** The default TCP/IP port number to use by the "server" |
| 4930 | ** and "ui" commands. |
| 4931 | */ |
| 4932 | /* |
| 4933 | ** SETTING: hide-by-user width=40 block-text |
| 4934 | ** The VALUE of this setting is a list of GLOB patterns. On the /timeline |
| 4935 | ** page, any check-in whose user login name matches one of these patterns |
| 4936 | ** is treated as if it carried the "hidden" tag, and is omitted unless the |
| 4937 | ** "unhide=on" query parameter is used. Example: bot-*,*-robot |
| 4938 | ** The parsing rules are complex; see |
| 4939 | ** https://fossil-scm.org/home/doc/trunk/www/globs.md#syntax |
| 4940 | */ |
| 4941 | /* |
| 4942 | ** SETTING: https-login boolean default=off |
| 4943 | ** If true, then the Fossil web server will redirect unencrypted |
| 4944 | ** login screen requests to HTTPS. |
| 4945 | */ |
| 4946 |
M
src/db.c
+10
-1
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -4676,11 +4676,11 @@ | ||
| 4676 | 4676 | ** until either a mousedown or mousemove event is seen. This helps |
| 4677 | 4677 | ** to distinguish real users from robots. For maximum robot defense, |
| 4678 | 4678 | ** the recommended setting is ON. |
| 4679 | 4679 | */ |
| 4680 | 4680 | /* |
| 4681 | -** SETTING: auto-shun boolean default=on | |
| 4681 | +** SETTING: auto-shun boolean default=off | |
| 4682 | 4682 | ** If enabled, automatically pull the shunning list |
| 4683 | 4683 | ** from a server to which the client autosyncs. |
| 4684 | 4684 | */ |
| 4685 | 4685 | /* |
| 4686 | 4686 | ** SETTING: autosync width=16 default=on |
| @@ -4927,10 +4927,19 @@ | ||
| 4927 | 4927 | /* |
| 4928 | 4928 | ** SETTING: http-port width=16 default=8080 |
| 4929 | 4929 | ** The default TCP/IP port number to use by the "server" |
| 4930 | 4930 | ** and "ui" commands. |
| 4931 | 4931 | */ |
| 4932 | +/* | |
| 4933 | +** SETTING: hide-by-user width=40 block-text | |
| 4934 | +** The VALUE of this setting is a list of GLOB patterns. On the /timeline | |
| 4935 | +** page, any check-in whose user login name matches one of these patterns | |
| 4936 | +** is treated as if it carried the "hidden" tag, and is omitted unless the | |
| 4937 | +** "unhide=on" query parameter is used. Example: bot-*,*-robot | |
| 4938 | +** The parsing rules are complex; see | |
| 4939 | +** https://fossil-scm.org/home/doc/trunk/www/globs.md#syntax | |
| 4940 | +*/ | |
| 4932 | 4941 | /* |
| 4933 | 4942 | ** SETTING: https-login boolean default=off |
| 4934 | 4943 | ** If true, then the Fossil web server will redirect unencrypted |
| 4935 | 4944 | ** login screen requests to HTTPS. |
| 4936 | 4945 | */ |
| 4937 | 4946 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -4676,11 +4676,11 @@ | |
| 4676 | ** until either a mousedown or mousemove event is seen. This helps |
| 4677 | ** to distinguish real users from robots. For maximum robot defense, |
| 4678 | ** the recommended setting is ON. |
| 4679 | */ |
| 4680 | /* |
| 4681 | ** SETTING: auto-shun boolean default=on |
| 4682 | ** If enabled, automatically pull the shunning list |
| 4683 | ** from a server to which the client autosyncs. |
| 4684 | */ |
| 4685 | /* |
| 4686 | ** SETTING: autosync width=16 default=on |
| @@ -4927,10 +4927,19 @@ | |
| 4927 | /* |
| 4928 | ** SETTING: http-port width=16 default=8080 |
| 4929 | ** The default TCP/IP port number to use by the "server" |
| 4930 | ** and "ui" commands. |
| 4931 | */ |
| 4932 | /* |
| 4933 | ** SETTING: https-login boolean default=off |
| 4934 | ** If true, then the Fossil web server will redirect unencrypted |
| 4935 | ** login screen requests to HTTPS. |
| 4936 | */ |
| 4937 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -4676,11 +4676,11 @@ | |
| 4676 | ** until either a mousedown or mousemove event is seen. This helps |
| 4677 | ** to distinguish real users from robots. For maximum robot defense, |
| 4678 | ** the recommended setting is ON. |
| 4679 | */ |
| 4680 | /* |
| 4681 | ** SETTING: auto-shun boolean default=off |
| 4682 | ** If enabled, automatically pull the shunning list |
| 4683 | ** from a server to which the client autosyncs. |
| 4684 | */ |
| 4685 | /* |
| 4686 | ** SETTING: autosync width=16 default=on |
| @@ -4927,10 +4927,19 @@ | |
| 4927 | /* |
| 4928 | ** SETTING: http-port width=16 default=8080 |
| 4929 | ** The default TCP/IP port number to use by the "server" |
| 4930 | ** and "ui" commands. |
| 4931 | */ |
| 4932 | /* |
| 4933 | ** SETTING: hide-by-user width=40 block-text |
| 4934 | ** The VALUE of this setting is a list of GLOB patterns. On the /timeline |
| 4935 | ** page, any check-in whose user login name matches one of these patterns |
| 4936 | ** is treated as if it carried the "hidden" tag, and is omitted unless the |
| 4937 | ** "unhide=on" query parameter is used. Example: bot-*,*-robot |
| 4938 | ** The parsing rules are complex; see |
| 4939 | ** https://fossil-scm.org/home/doc/trunk/www/globs.md#syntax |
| 4940 | */ |
| 4941 | /* |
| 4942 | ** SETTING: https-login boolean default=off |
| 4943 | ** If true, then the Fossil web server will redirect unencrypted |
| 4944 | ** login screen requests to HTTPS. |
| 4945 | */ |
| 4946 |
+3
| --- src/default.css | ||
| +++ src/default.css | ||
| @@ -2019,10 +2019,13 @@ | ||
| 2019 | 2019 | /* .attach* = styles for file attachments */ |
| 2020 | 2020 | section.attachlist {} |
| 2021 | 2021 | details.attachlist > summary { |
| 2022 | 2022 | cursor: pointer; |
| 2023 | 2023 | } |
| 2024 | +div.forumpost > details.attachlist { | |
| 2025 | + margin-bottom: 0.5em/*else too cramped with the buttons*/; | |
| 2026 | +} | |
| 2024 | 2027 | /* .Attacher is the top container element used by the JS Attacher |
| 2025 | 2028 | class in fossil.attach.js. */ |
| 2026 | 2029 | .Attacher { |
| 2027 | 2030 | margin-bottom: 1em; |
| 2028 | 2031 | display: flex; |
| 2029 | 2032 |
| --- src/default.css | |
| +++ src/default.css | |
| @@ -2019,10 +2019,13 @@ | |
| 2019 | /* .attach* = styles for file attachments */ |
| 2020 | section.attachlist {} |
| 2021 | details.attachlist > summary { |
| 2022 | cursor: pointer; |
| 2023 | } |
| 2024 | /* .Attacher is the top container element used by the JS Attacher |
| 2025 | class in fossil.attach.js. */ |
| 2026 | .Attacher { |
| 2027 | margin-bottom: 1em; |
| 2028 | display: flex; |
| 2029 |
| --- src/default.css | |
| +++ src/default.css | |
| @@ -2019,10 +2019,13 @@ | |
| 2019 | /* .attach* = styles for file attachments */ |
| 2020 | section.attachlist {} |
| 2021 | details.attachlist > summary { |
| 2022 | cursor: pointer; |
| 2023 | } |
| 2024 | div.forumpost > details.attachlist { |
| 2025 | margin-bottom: 0.5em/*else too cramped with the buttons*/; |
| 2026 | } |
| 2027 | /* .Attacher is the top container element used by the JS Attacher |
| 2028 | class in fossil.attach.js. */ |
| 2029 | .Attacher { |
| 2030 | margin-bottom: 1em; |
| 2031 | display: flex; |
| 2032 |
+3
| --- src/default.css | ||
| +++ src/default.css | ||
| @@ -2019,10 +2019,13 @@ | ||
| 2019 | 2019 | /* .attach* = styles for file attachments */ |
| 2020 | 2020 | section.attachlist {} |
| 2021 | 2021 | details.attachlist > summary { |
| 2022 | 2022 | cursor: pointer; |
| 2023 | 2023 | } |
| 2024 | +div.forumpost > details.attachlist { | |
| 2025 | + margin-bottom: 0.5em/*else too cramped with the buttons*/; | |
| 2026 | +} | |
| 2024 | 2027 | /* .Attacher is the top container element used by the JS Attacher |
| 2025 | 2028 | class in fossil.attach.js. */ |
| 2026 | 2029 | .Attacher { |
| 2027 | 2030 | margin-bottom: 1em; |
| 2028 | 2031 | display: flex; |
| 2029 | 2032 |
| --- src/default.css | |
| +++ src/default.css | |
| @@ -2019,10 +2019,13 @@ | |
| 2019 | /* .attach* = styles for file attachments */ |
| 2020 | section.attachlist {} |
| 2021 | details.attachlist > summary { |
| 2022 | cursor: pointer; |
| 2023 | } |
| 2024 | /* .Attacher is the top container element used by the JS Attacher |
| 2025 | class in fossil.attach.js. */ |
| 2026 | .Attacher { |
| 2027 | margin-bottom: 1em; |
| 2028 | display: flex; |
| 2029 |
| --- src/default.css | |
| +++ src/default.css | |
| @@ -2019,10 +2019,13 @@ | |
| 2019 | /* .attach* = styles for file attachments */ |
| 2020 | section.attachlist {} |
| 2021 | details.attachlist > summary { |
| 2022 | cursor: pointer; |
| 2023 | } |
| 2024 | div.forumpost > details.attachlist { |
| 2025 | margin-bottom: 0.5em/*else too cramped with the buttons*/; |
| 2026 | } |
| 2027 | /* .Attacher is the top container element used by the JS Attacher |
| 2028 | class in fossil.attach.js. */ |
| 2029 | .Attacher { |
| 2030 | margin-bottom: 1em; |
| 2031 | display: flex; |
| 2032 |
+3
-3
| --- src/delta.c | ||
| +++ src/delta.c | ||
| @@ -280,13 +280,13 @@ | ||
| 280 | 280 | } |
| 281 | 281 | sum += (sum2 << 8) + (sum1 << 16) + (sum0 << 24); |
| 282 | 282 | #endif |
| 283 | 283 | } |
| 284 | 284 | switch(N&3){ |
| 285 | - case 3: sum += (z[2] << 8); | |
| 286 | - case 2: sum += (z[1] << 16); | |
| 287 | - case 1: sum += (z[0] << 24); | |
| 285 | + case 3: sum += ((unsigned)z[2] << 8); | |
| 286 | + case 2: sum += ((unsigned)z[1] << 16); | |
| 287 | + case 1: sum += ((unsigned)z[0] << 24); | |
| 288 | 288 | default: ; |
| 289 | 289 | } |
| 290 | 290 | } |
| 291 | 291 | return sum; |
| 292 | 292 | } |
| 293 | 293 |
| --- src/delta.c | |
| +++ src/delta.c | |
| @@ -280,13 +280,13 @@ | |
| 280 | } |
| 281 | sum += (sum2 << 8) + (sum1 << 16) + (sum0 << 24); |
| 282 | #endif |
| 283 | } |
| 284 | switch(N&3){ |
| 285 | case 3: sum += (z[2] << 8); |
| 286 | case 2: sum += (z[1] << 16); |
| 287 | case 1: sum += (z[0] << 24); |
| 288 | default: ; |
| 289 | } |
| 290 | } |
| 291 | return sum; |
| 292 | } |
| 293 |
| --- src/delta.c | |
| +++ src/delta.c | |
| @@ -280,13 +280,13 @@ | |
| 280 | } |
| 281 | sum += (sum2 << 8) + (sum1 << 16) + (sum0 << 24); |
| 282 | #endif |
| 283 | } |
| 284 | switch(N&3){ |
| 285 | case 3: sum += ((unsigned)z[2] << 8); |
| 286 | case 2: sum += ((unsigned)z[1] << 16); |
| 287 | case 1: sum += ((unsigned)z[0] << 24); |
| 288 | default: ; |
| 289 | } |
| 290 | } |
| 291 | return sum; |
| 292 | } |
| 293 |
+1
-1
| --- src/deltacmd.c | ||
| +++ src/deltacmd.c | ||
| @@ -33,11 +33,11 @@ | ||
| 33 | 33 | blob_zero(pDelta); |
| 34 | 34 | zOrig = blob_materialize(pOriginal); |
| 35 | 35 | lenOrig = blob_size(pOriginal); |
| 36 | 36 | zTarg = blob_materialize(pTarget); |
| 37 | 37 | lenTarg = blob_size(pTarget); |
| 38 | - blob_resize(pDelta, lenTarg+16); | |
| 38 | + blob_resize(pDelta, lenTarg+60); | |
| 39 | 39 | zRes = blob_materialize(pDelta); |
| 40 | 40 | len = delta_create(zOrig, lenOrig, zTarg, lenTarg, zRes); |
| 41 | 41 | blob_resize(pDelta, len); |
| 42 | 42 | return 0; |
| 43 | 43 | } |
| 44 | 44 |
| --- src/deltacmd.c | |
| +++ src/deltacmd.c | |
| @@ -33,11 +33,11 @@ | |
| 33 | blob_zero(pDelta); |
| 34 | zOrig = blob_materialize(pOriginal); |
| 35 | lenOrig = blob_size(pOriginal); |
| 36 | zTarg = blob_materialize(pTarget); |
| 37 | lenTarg = blob_size(pTarget); |
| 38 | blob_resize(pDelta, lenTarg+16); |
| 39 | zRes = blob_materialize(pDelta); |
| 40 | len = delta_create(zOrig, lenOrig, zTarg, lenTarg, zRes); |
| 41 | blob_resize(pDelta, len); |
| 42 | return 0; |
| 43 | } |
| 44 |
| --- src/deltacmd.c | |
| +++ src/deltacmd.c | |
| @@ -33,11 +33,11 @@ | |
| 33 | blob_zero(pDelta); |
| 34 | zOrig = blob_materialize(pOriginal); |
| 35 | lenOrig = blob_size(pOriginal); |
| 36 | zTarg = blob_materialize(pTarget); |
| 37 | lenTarg = blob_size(pTarget); |
| 38 | blob_resize(pDelta, lenTarg+60); |
| 39 | zRes = blob_materialize(pDelta); |
| 40 | len = delta_create(zOrig, lenOrig, zTarg, lenTarg, zRes); |
| 41 | blob_resize(pDelta, len); |
| 42 | return 0; |
| 43 | } |
| 44 |
+2
-7
| --- src/export.c | ||
| +++ src/export.c | ||
| @@ -1007,13 +1007,10 @@ | ||
| 1007 | 1007 | db_reset(&sIns); |
| 1008 | 1008 | return mprintf(":%d", db_last_insert_rowid()); |
| 1009 | 1009 | } |
| 1010 | 1010 | |
| 1011 | 1011 | /* This is the SHA3-256 hash of an empty file */ |
| 1012 | -static const char zEmptySha3[] = | |
| 1013 | - "a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a"; | |
| 1014 | - | |
| 1015 | 1012 | /* |
| 1016 | 1013 | ** Export a single file named by zUuid. |
| 1017 | 1014 | ** |
| 1018 | 1015 | ** Return 0 on success and non-zero on any failure. |
| 1019 | 1016 | ** |
| @@ -1024,26 +1021,24 @@ | ||
| 1024 | 1021 | */ |
| 1025 | 1022 | static int gitmirror_send_file(FILE *xCmd, const char *zUuid, int bPhantomOk){ |
| 1026 | 1023 | char *zMark; |
| 1027 | 1024 | int rid; |
| 1028 | 1025 | int rc; |
| 1029 | - Blob data; | |
| 1026 | + Blob data = BLOB_INITIALIZER; | |
| 1030 | 1027 | rid = fast_uuid_to_rid(zUuid); |
| 1031 | - if( rid<0 ){ | |
| 1028 | + if( rid<=0 ){ | |
| 1032 | 1029 | if( bPhantomOk || uuid_is_shunned(zUuid) ){ |
| 1033 | 1030 | gitmirror_message(VERB_EXTRA, "missing file: %s\n", zUuid); |
| 1034 | - zUuid = zEmptySha3; | |
| 1035 | 1031 | }else{ |
| 1036 | 1032 | return 1; |
| 1037 | 1033 | } |
| 1038 | 1034 | }else{ |
| 1039 | 1035 | rc = content_get(rid, &data); |
| 1040 | 1036 | if( rc==0 ){ |
| 1041 | 1037 | if( bPhantomOk ){ |
| 1042 | 1038 | blob_init(&data, 0, 0); |
| 1043 | 1039 | gitmirror_message(VERB_EXTRA, "missing file: %s\n", zUuid); |
| 1044 | - zUuid = zEmptySha3; | |
| 1045 | 1040 | }else{ |
| 1046 | 1041 | return 1; |
| 1047 | 1042 | } |
| 1048 | 1043 | } |
| 1049 | 1044 | } |
| 1050 | 1045 |
| --- src/export.c | |
| +++ src/export.c | |
| @@ -1007,13 +1007,10 @@ | |
| 1007 | db_reset(&sIns); |
| 1008 | return mprintf(":%d", db_last_insert_rowid()); |
| 1009 | } |
| 1010 | |
| 1011 | /* This is the SHA3-256 hash of an empty file */ |
| 1012 | static const char zEmptySha3[] = |
| 1013 | "a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a"; |
| 1014 | |
| 1015 | /* |
| 1016 | ** Export a single file named by zUuid. |
| 1017 | ** |
| 1018 | ** Return 0 on success and non-zero on any failure. |
| 1019 | ** |
| @@ -1024,26 +1021,24 @@ | |
| 1024 | */ |
| 1025 | static int gitmirror_send_file(FILE *xCmd, const char *zUuid, int bPhantomOk){ |
| 1026 | char *zMark; |
| 1027 | int rid; |
| 1028 | int rc; |
| 1029 | Blob data; |
| 1030 | rid = fast_uuid_to_rid(zUuid); |
| 1031 | if( rid<0 ){ |
| 1032 | if( bPhantomOk || uuid_is_shunned(zUuid) ){ |
| 1033 | gitmirror_message(VERB_EXTRA, "missing file: %s\n", zUuid); |
| 1034 | zUuid = zEmptySha3; |
| 1035 | }else{ |
| 1036 | return 1; |
| 1037 | } |
| 1038 | }else{ |
| 1039 | rc = content_get(rid, &data); |
| 1040 | if( rc==0 ){ |
| 1041 | if( bPhantomOk ){ |
| 1042 | blob_init(&data, 0, 0); |
| 1043 | gitmirror_message(VERB_EXTRA, "missing file: %s\n", zUuid); |
| 1044 | zUuid = zEmptySha3; |
| 1045 | }else{ |
| 1046 | return 1; |
| 1047 | } |
| 1048 | } |
| 1049 | } |
| 1050 |
| --- src/export.c | |
| +++ src/export.c | |
| @@ -1007,13 +1007,10 @@ | |
| 1007 | db_reset(&sIns); |
| 1008 | return mprintf(":%d", db_last_insert_rowid()); |
| 1009 | } |
| 1010 | |
| 1011 | /* This is the SHA3-256 hash of an empty file */ |
| 1012 | /* |
| 1013 | ** Export a single file named by zUuid. |
| 1014 | ** |
| 1015 | ** Return 0 on success and non-zero on any failure. |
| 1016 | ** |
| @@ -1024,26 +1021,24 @@ | |
| 1021 | */ |
| 1022 | static int gitmirror_send_file(FILE *xCmd, const char *zUuid, int bPhantomOk){ |
| 1023 | char *zMark; |
| 1024 | int rid; |
| 1025 | int rc; |
| 1026 | Blob data = BLOB_INITIALIZER; |
| 1027 | rid = fast_uuid_to_rid(zUuid); |
| 1028 | if( rid<=0 ){ |
| 1029 | if( bPhantomOk || uuid_is_shunned(zUuid) ){ |
| 1030 | gitmirror_message(VERB_EXTRA, "missing file: %s\n", zUuid); |
| 1031 | }else{ |
| 1032 | return 1; |
| 1033 | } |
| 1034 | }else{ |
| 1035 | rc = content_get(rid, &data); |
| 1036 | if( rc==0 ){ |
| 1037 | if( bPhantomOk ){ |
| 1038 | blob_init(&data, 0, 0); |
| 1039 | gitmirror_message(VERB_EXTRA, "missing file: %s\n", zUuid); |
| 1040 | }else{ |
| 1041 | return 1; |
| 1042 | } |
| 1043 | } |
| 1044 | } |
| 1045 |
+1
-1
| --- src/file.c | ||
| +++ src/file.c | ||
| @@ -2613,11 +2613,11 @@ | ||
| 2613 | 2613 | if( nLimit>0 && n>=nLimit ) break; |
| 2614 | 2614 | } |
| 2615 | 2615 | closedir(d); |
| 2616 | 2616 | } |
| 2617 | 2617 | fossil_path_free(zNative); |
| 2618 | - if( pazList ) (*pazList)[n] = 0; | |
| 2618 | + if( pazList && *pazList ) (*pazList)[n] = 0; | |
| 2619 | 2619 | return n; |
| 2620 | 2620 | } |
| 2621 | 2621 | void file_directory_list_free(char **azList){ |
| 2622 | 2622 | char **az; |
| 2623 | 2623 | if( azList==0 ) return; |
| 2624 | 2624 |
| --- src/file.c | |
| +++ src/file.c | |
| @@ -2613,11 +2613,11 @@ | |
| 2613 | if( nLimit>0 && n>=nLimit ) break; |
| 2614 | } |
| 2615 | closedir(d); |
| 2616 | } |
| 2617 | fossil_path_free(zNative); |
| 2618 | if( pazList ) (*pazList)[n] = 0; |
| 2619 | return n; |
| 2620 | } |
| 2621 | void file_directory_list_free(char **azList){ |
| 2622 | char **az; |
| 2623 | if( azList==0 ) return; |
| 2624 |
| --- src/file.c | |
| +++ src/file.c | |
| @@ -2613,11 +2613,11 @@ | |
| 2613 | if( nLimit>0 && n>=nLimit ) break; |
| 2614 | } |
| 2615 | closedir(d); |
| 2616 | } |
| 2617 | fossil_path_free(zNative); |
| 2618 | if( pazList && *pazList ) (*pazList)[n] = 0; |
| 2619 | return n; |
| 2620 | } |
| 2621 | void file_directory_list_free(char **azList){ |
| 2622 | char **az; |
| 2623 | if( azList==0 ) return; |
| 2624 |
+25
-23
| --- src/forum.c | ||
| +++ src/forum.c | ||
| @@ -2191,11 +2191,11 @@ | ||
| 2191 | 2191 | ** its list of attachments. We only emit this for No-JS environments, |
| 2192 | 2192 | ** as in JS environments the interactive forum editor includes |
| 2193 | 2193 | ** attachment support. |
| 2194 | 2194 | */ |
| 2195 | 2195 | static void forum_render_attachment_notice(void){ |
| 2196 | - if( g.perm.AttachForum ){ | |
| 2196 | + if( g.perm.AttachForum || g.perm.WrTForum ){ | |
| 2197 | 2197 | @ <noscript><div>You will be able to attach files to this post |
| 2198 | 2198 | @ after saving it.</div></noscript> |
| 2199 | 2199 | } |
| 2200 | 2200 | } |
| 2201 | 2201 | |
| @@ -2238,12 +2238,12 @@ | ||
| 2238 | 2238 | } |
| 2239 | 2239 | forum_render_debug_options(); |
| 2240 | 2240 | login_insert_csrf_secret(); |
| 2241 | 2241 | @ </form> |
| 2242 | 2242 | /* When JS is disabled the block above will work. When it's |
| 2243 | - enabled, the above will be removed and JS will render the editor | |
| 2244 | - form in the next element. */ | |
| 2243 | + ** enabled, the above will be removed and JS will render the editor | |
| 2244 | + ** form in the next element. */ | |
| 2245 | 2245 | @ <div hidden id='forumnew-placeholder'> |
| 2246 | 2246 | @ <input type='hidden' name='title' value='%h(zTitle)'> |
| 2247 | 2247 | login_insert_csrf_secret(); |
| 2248 | 2248 | @ </div> |
| 2249 | 2249 | forum_render_attachment_notice(); |
| @@ -3044,14 +3044,14 @@ | ||
| 3044 | 3044 | ** The caller must have started a transaction and must roll it back if |
| 3045 | 3045 | ** this call returns <=0, noting that only the negative-value case is |
| 3046 | 3046 | ** an error. |
| 3047 | 3047 | ** |
| 3048 | 3048 | ** This function does some work to try to ensure that duplicate |
| 3049 | -** entries are not save (this can happen as a side effect of the forum | |
| 3050 | -** post editor added in 2026-06). If the given post will not have been | |
| 3051 | -** materially edited by these changes, they are not applied and the | |
| 3052 | -** rid of the existing entry is used. | |
| 3049 | +** entries are not saved (this can happen as a side effect of the | |
| 3050 | +** forum post editor added in 2026-06). If the given post will not | |
| 3051 | +** have been materially edited by these changes, they are not applied | |
| 3052 | +** and the rid of the existing entry is used. | |
| 3053 | 3053 | ** |
| 3054 | 3054 | ** Maintenance reminders: |
| 3055 | 3055 | ** |
| 3056 | 3056 | ** - iInReplyTo==0 && iEdit==0: new thread |
| 3057 | 3057 | ** - iInReplyTo==0 && iEdit>0 : edit top post or response |
| @@ -3243,15 +3243,15 @@ | ||
| 3243 | 3243 | return rc; |
| 3244 | 3244 | } |
| 3245 | 3245 | /* |
| 3246 | 3246 | ** WEBPAGE: forumajax_save hidden |
| 3247 | 3247 | ** |
| 3248 | -** WIP | |
| 3248 | +** Used by the forum JS pages to save a post. | |
| 3249 | 3249 | ** |
| 3250 | 3250 | ** Response JSON: |
| 3251 | 3251 | ** |
| 3252 | -** { uuid: hash, ...tbd } | |
| 3252 | +** { uuid: hash, ...TO DOCUMENT } | |
| 3253 | 3253 | */ |
| 3254 | 3254 | void forum_ajax_save_page(void){ |
| 3255 | 3255 | const char *zFpid; |
| 3256 | 3256 | const char *zTitle; |
| 3257 | 3257 | const char *zIrt; |
| @@ -3267,15 +3267,17 @@ | ||
| 3267 | 3267 | int nrid = 0; /* New artifact rid. */ |
| 3268 | 3268 | int iPostFlags; /* forum_post_flags() (after perms check) */ |
| 3269 | 3269 | int bRollback; /* True = roll back. */ |
| 3270 | 3270 | int nAttach = 0; /* Number of attachments added */ |
| 3271 | 3271 | int bStatusSet = 0; /* True if status tag set. */ |
| 3272 | + int bModPost = 0; /* Moderate post? */ | |
| 3273 | + int bModAttach; /* Moderate attachment? */ | |
| 3272 | 3274 | |
| 3273 | 3275 | if( !ajax_route_bootstrap(0, 1) ){ |
| 3274 | 3276 | return; |
| 3275 | - }else if( !g.perm.WrForum | |
| 3276 | - || (bHasAttachment && !g.perm.AttachForum) ){ | |
| 3277 | + }else if( !g.perm.WrForum || | |
| 3278 | + (bHasAttachment && !g.perm.WrTForum) ){ | |
| 3277 | 3279 | ajax_route_error_forbidden(); |
| 3278 | 3280 | return; |
| 3279 | 3281 | }else if( !ajax_check_csrf(2) ){ |
| 3280 | 3282 | ajax_route_error_csrf(); |
| 3281 | 3283 | return; |
| @@ -3322,17 +3324,18 @@ | ||
| 3322 | 3324 | rc = -ajax_route_error(404, "Cannot resolve in-reply-do ID."); |
| 3323 | 3325 | goto ajax_save_end; |
| 3324 | 3326 | } |
| 3325 | 3327 | } |
| 3326 | 3328 | |
| 3327 | - if( 0 ){ | |
| 3328 | - rc = -ajax_route_error(400, "Save is TODO. " | |
| 3329 | - "iPostFlags=%d debug=%d", | |
| 3330 | - iPostFlags, g.perm.Debug); | |
| 3331 | - goto ajax_save_end; | |
| 3329 | + bModPost = forum_need_moderation(); | |
| 3330 | + if( bHasAttachment && !g.perm.AttachForum && g.perm.WrTForum ){ | |
| 3331 | + /* A user with WrTForum but not AttachForum may attach but | |
| 3332 | + ** the attachments will be moderated. */ | |
| 3333 | + bModAttach = 1; | |
| 3334 | + }else{ | |
| 3335 | + bModAttach = bModPost; | |
| 3332 | 3336 | } |
| 3333 | - | |
| 3334 | 3337 | zTitle = firt ? 0 : P("title"); |
| 3335 | 3338 | nrid = forum_post_ajax(zTitle, firt, fpid, 0, zMimetype, |
| 3336 | 3339 | zContent, iPostFlags); |
| 3337 | 3340 | if( nrid<0 ){ |
| 3338 | 3341 | rc = nrid; |
| @@ -3345,24 +3348,23 @@ | ||
| 3345 | 3348 | CX("{\"message\": \"Rolled back for dry-run.\"," |
| 3346 | 3349 | "\"iPostFlags\":%d}\n", iPostFlags); |
| 3347 | 3350 | } |
| 3348 | 3351 | goto ajax_save_end; |
| 3349 | 3352 | }else{ |
| 3350 | - const int bNeedsModeration = forum_need_moderation(); | |
| 3351 | 3353 | const int fpHead = forumpost_head_rid(nrid); |
| 3352 | 3354 | assert( nrid>0 ); |
| 3353 | 3355 | assert( fpHead>0 ); |
| 3354 | 3356 | zNewUuid = rid_to_uuid(nrid); |
| 3355 | - if( 0!=P("file1") ){ | |
| 3357 | + if( bHasAttachment ){ | |
| 3356 | 3358 | /* Attachments */ |
| 3357 | - if( !g.perm.Admin && !g.perm.AttachForum ){ | |
| 3358 | - rc = -ajax_route_error(403, "No permission no attach files."); | |
| 3359 | + if( !g.perm.Admin && !(g.perm.AttachForum ||g.perm.WrTForum) ){ | |
| 3360 | + rc = -ajax_route_error(403, "No permission to attach files."); | |
| 3359 | 3361 | goto ajax_save_end; |
| 3360 | 3362 | }else{ |
| 3361 | 3363 | char *zRoot = (nrid==fpHead) ? 0 : rid_to_uuid(fpHead); |
| 3362 | 3364 | nAttach = attachments_ajax_from_POST(zRoot ? zRoot : zNewUuid, |
| 3363 | - bNeedsModeration); | |
| 3365 | + bModAttach); | |
| 3364 | 3366 | fossil_free(zRoot); |
| 3365 | 3367 | if( nAttach<0 ){ |
| 3366 | 3368 | rc = nAttach; |
| 3367 | 3369 | goto ajax_save_end; |
| 3368 | 3370 | } |
| @@ -3385,11 +3387,11 @@ | ||
| 3385 | 3387 | fpHead, fpHead |
| 3386 | 3388 | ); |
| 3387 | 3389 | } |
| 3388 | 3390 | } |
| 3389 | 3391 | } |
| 3390 | - if( 0==bNeedsModeration | |
| 3392 | + if( 0==bModPost | |
| 3391 | 3393 | /* ^^^ Do not allow a status tag on a pending-moderation post |
| 3392 | 3394 | ** because it will introduce a reference to an artifact which |
| 3393 | 3395 | ** will become a phantom if it is rejected by a moderator. */ |
| 3394 | 3396 | && zStatus!=0 && zStatus[0]!=0 |
| 3395 | 3397 | && forum_may_set_status(nrid) |
| 3396 | 3398 |
| --- src/forum.c | |
| +++ src/forum.c | |
| @@ -2191,11 +2191,11 @@ | |
| 2191 | ** its list of attachments. We only emit this for No-JS environments, |
| 2192 | ** as in JS environments the interactive forum editor includes |
| 2193 | ** attachment support. |
| 2194 | */ |
| 2195 | static void forum_render_attachment_notice(void){ |
| 2196 | if( g.perm.AttachForum ){ |
| 2197 | @ <noscript><div>You will be able to attach files to this post |
| 2198 | @ after saving it.</div></noscript> |
| 2199 | } |
| 2200 | } |
| 2201 | |
| @@ -2238,12 +2238,12 @@ | |
| 2238 | } |
| 2239 | forum_render_debug_options(); |
| 2240 | login_insert_csrf_secret(); |
| 2241 | @ </form> |
| 2242 | /* When JS is disabled the block above will work. When it's |
| 2243 | enabled, the above will be removed and JS will render the editor |
| 2244 | form in the next element. */ |
| 2245 | @ <div hidden id='forumnew-placeholder'> |
| 2246 | @ <input type='hidden' name='title' value='%h(zTitle)'> |
| 2247 | login_insert_csrf_secret(); |
| 2248 | @ </div> |
| 2249 | forum_render_attachment_notice(); |
| @@ -3044,14 +3044,14 @@ | |
| 3044 | ** The caller must have started a transaction and must roll it back if |
| 3045 | ** this call returns <=0, noting that only the negative-value case is |
| 3046 | ** an error. |
| 3047 | ** |
| 3048 | ** This function does some work to try to ensure that duplicate |
| 3049 | ** entries are not save (this can happen as a side effect of the forum |
| 3050 | ** post editor added in 2026-06). If the given post will not have been |
| 3051 | ** materially edited by these changes, they are not applied and the |
| 3052 | ** rid of the existing entry is used. |
| 3053 | ** |
| 3054 | ** Maintenance reminders: |
| 3055 | ** |
| 3056 | ** - iInReplyTo==0 && iEdit==0: new thread |
| 3057 | ** - iInReplyTo==0 && iEdit>0 : edit top post or response |
| @@ -3243,15 +3243,15 @@ | |
| 3243 | return rc; |
| 3244 | } |
| 3245 | /* |
| 3246 | ** WEBPAGE: forumajax_save hidden |
| 3247 | ** |
| 3248 | ** WIP |
| 3249 | ** |
| 3250 | ** Response JSON: |
| 3251 | ** |
| 3252 | ** { uuid: hash, ...tbd } |
| 3253 | */ |
| 3254 | void forum_ajax_save_page(void){ |
| 3255 | const char *zFpid; |
| 3256 | const char *zTitle; |
| 3257 | const char *zIrt; |
| @@ -3267,15 +3267,17 @@ | |
| 3267 | int nrid = 0; /* New artifact rid. */ |
| 3268 | int iPostFlags; /* forum_post_flags() (after perms check) */ |
| 3269 | int bRollback; /* True = roll back. */ |
| 3270 | int nAttach = 0; /* Number of attachments added */ |
| 3271 | int bStatusSet = 0; /* True if status tag set. */ |
| 3272 | |
| 3273 | if( !ajax_route_bootstrap(0, 1) ){ |
| 3274 | return; |
| 3275 | }else if( !g.perm.WrForum |
| 3276 | || (bHasAttachment && !g.perm.AttachForum) ){ |
| 3277 | ajax_route_error_forbidden(); |
| 3278 | return; |
| 3279 | }else if( !ajax_check_csrf(2) ){ |
| 3280 | ajax_route_error_csrf(); |
| 3281 | return; |
| @@ -3322,17 +3324,18 @@ | |
| 3322 | rc = -ajax_route_error(404, "Cannot resolve in-reply-do ID."); |
| 3323 | goto ajax_save_end; |
| 3324 | } |
| 3325 | } |
| 3326 | |
| 3327 | if( 0 ){ |
| 3328 | rc = -ajax_route_error(400, "Save is TODO. " |
| 3329 | "iPostFlags=%d debug=%d", |
| 3330 | iPostFlags, g.perm.Debug); |
| 3331 | goto ajax_save_end; |
| 3332 | } |
| 3333 | |
| 3334 | zTitle = firt ? 0 : P("title"); |
| 3335 | nrid = forum_post_ajax(zTitle, firt, fpid, 0, zMimetype, |
| 3336 | zContent, iPostFlags); |
| 3337 | if( nrid<0 ){ |
| 3338 | rc = nrid; |
| @@ -3345,24 +3348,23 @@ | |
| 3345 | CX("{\"message\": \"Rolled back for dry-run.\"," |
| 3346 | "\"iPostFlags\":%d}\n", iPostFlags); |
| 3347 | } |
| 3348 | goto ajax_save_end; |
| 3349 | }else{ |
| 3350 | const int bNeedsModeration = forum_need_moderation(); |
| 3351 | const int fpHead = forumpost_head_rid(nrid); |
| 3352 | assert( nrid>0 ); |
| 3353 | assert( fpHead>0 ); |
| 3354 | zNewUuid = rid_to_uuid(nrid); |
| 3355 | if( 0!=P("file1") ){ |
| 3356 | /* Attachments */ |
| 3357 | if( !g.perm.Admin && !g.perm.AttachForum ){ |
| 3358 | rc = -ajax_route_error(403, "No permission no attach files."); |
| 3359 | goto ajax_save_end; |
| 3360 | }else{ |
| 3361 | char *zRoot = (nrid==fpHead) ? 0 : rid_to_uuid(fpHead); |
| 3362 | nAttach = attachments_ajax_from_POST(zRoot ? zRoot : zNewUuid, |
| 3363 | bNeedsModeration); |
| 3364 | fossil_free(zRoot); |
| 3365 | if( nAttach<0 ){ |
| 3366 | rc = nAttach; |
| 3367 | goto ajax_save_end; |
| 3368 | } |
| @@ -3385,11 +3387,11 @@ | |
| 3385 | fpHead, fpHead |
| 3386 | ); |
| 3387 | } |
| 3388 | } |
| 3389 | } |
| 3390 | if( 0==bNeedsModeration |
| 3391 | /* ^^^ Do not allow a status tag on a pending-moderation post |
| 3392 | ** because it will introduce a reference to an artifact which |
| 3393 | ** will become a phantom if it is rejected by a moderator. */ |
| 3394 | && zStatus!=0 && zStatus[0]!=0 |
| 3395 | && forum_may_set_status(nrid) |
| 3396 |
| --- src/forum.c | |
| +++ src/forum.c | |
| @@ -2191,11 +2191,11 @@ | |
| 2191 | ** its list of attachments. We only emit this for No-JS environments, |
| 2192 | ** as in JS environments the interactive forum editor includes |
| 2193 | ** attachment support. |
| 2194 | */ |
| 2195 | static void forum_render_attachment_notice(void){ |
| 2196 | if( g.perm.AttachForum || g.perm.WrTForum ){ |
| 2197 | @ <noscript><div>You will be able to attach files to this post |
| 2198 | @ after saving it.</div></noscript> |
| 2199 | } |
| 2200 | } |
| 2201 | |
| @@ -2238,12 +2238,12 @@ | |
| 2238 | } |
| 2239 | forum_render_debug_options(); |
| 2240 | login_insert_csrf_secret(); |
| 2241 | @ </form> |
| 2242 | /* When JS is disabled the block above will work. When it's |
| 2243 | ** enabled, the above will be removed and JS will render the editor |
| 2244 | ** form in the next element. */ |
| 2245 | @ <div hidden id='forumnew-placeholder'> |
| 2246 | @ <input type='hidden' name='title' value='%h(zTitle)'> |
| 2247 | login_insert_csrf_secret(); |
| 2248 | @ </div> |
| 2249 | forum_render_attachment_notice(); |
| @@ -3044,14 +3044,14 @@ | |
| 3044 | ** The caller must have started a transaction and must roll it back if |
| 3045 | ** this call returns <=0, noting that only the negative-value case is |
| 3046 | ** an error. |
| 3047 | ** |
| 3048 | ** This function does some work to try to ensure that duplicate |
| 3049 | ** entries are not saved (this can happen as a side effect of the |
| 3050 | ** forum post editor added in 2026-06). If the given post will not |
| 3051 | ** have been materially edited by these changes, they are not applied |
| 3052 | ** and the rid of the existing entry is used. |
| 3053 | ** |
| 3054 | ** Maintenance reminders: |
| 3055 | ** |
| 3056 | ** - iInReplyTo==0 && iEdit==0: new thread |
| 3057 | ** - iInReplyTo==0 && iEdit>0 : edit top post or response |
| @@ -3243,15 +3243,15 @@ | |
| 3243 | return rc; |
| 3244 | } |
| 3245 | /* |
| 3246 | ** WEBPAGE: forumajax_save hidden |
| 3247 | ** |
| 3248 | ** Used by the forum JS pages to save a post. |
| 3249 | ** |
| 3250 | ** Response JSON: |
| 3251 | ** |
| 3252 | ** { uuid: hash, ...TO DOCUMENT } |
| 3253 | */ |
| 3254 | void forum_ajax_save_page(void){ |
| 3255 | const char *zFpid; |
| 3256 | const char *zTitle; |
| 3257 | const char *zIrt; |
| @@ -3267,15 +3267,17 @@ | |
| 3267 | int nrid = 0; /* New artifact rid. */ |
| 3268 | int iPostFlags; /* forum_post_flags() (after perms check) */ |
| 3269 | int bRollback; /* True = roll back. */ |
| 3270 | int nAttach = 0; /* Number of attachments added */ |
| 3271 | int bStatusSet = 0; /* True if status tag set. */ |
| 3272 | int bModPost = 0; /* Moderate post? */ |
| 3273 | int bModAttach; /* Moderate attachment? */ |
| 3274 | |
| 3275 | if( !ajax_route_bootstrap(0, 1) ){ |
| 3276 | return; |
| 3277 | }else if( !g.perm.WrForum || |
| 3278 | (bHasAttachment && !g.perm.WrTForum) ){ |
| 3279 | ajax_route_error_forbidden(); |
| 3280 | return; |
| 3281 | }else if( !ajax_check_csrf(2) ){ |
| 3282 | ajax_route_error_csrf(); |
| 3283 | return; |
| @@ -3322,17 +3324,18 @@ | |
| 3324 | rc = -ajax_route_error(404, "Cannot resolve in-reply-do ID."); |
| 3325 | goto ajax_save_end; |
| 3326 | } |
| 3327 | } |
| 3328 | |
| 3329 | bModPost = forum_need_moderation(); |
| 3330 | if( bHasAttachment && !g.perm.AttachForum && g.perm.WrTForum ){ |
| 3331 | /* A user with WrTForum but not AttachForum may attach but |
| 3332 | ** the attachments will be moderated. */ |
| 3333 | bModAttach = 1; |
| 3334 | }else{ |
| 3335 | bModAttach = bModPost; |
| 3336 | } |
| 3337 | zTitle = firt ? 0 : P("title"); |
| 3338 | nrid = forum_post_ajax(zTitle, firt, fpid, 0, zMimetype, |
| 3339 | zContent, iPostFlags); |
| 3340 | if( nrid<0 ){ |
| 3341 | rc = nrid; |
| @@ -3345,24 +3348,23 @@ | |
| 3348 | CX("{\"message\": \"Rolled back for dry-run.\"," |
| 3349 | "\"iPostFlags\":%d}\n", iPostFlags); |
| 3350 | } |
| 3351 | goto ajax_save_end; |
| 3352 | }else{ |
| 3353 | const int fpHead = forumpost_head_rid(nrid); |
| 3354 | assert( nrid>0 ); |
| 3355 | assert( fpHead>0 ); |
| 3356 | zNewUuid = rid_to_uuid(nrid); |
| 3357 | if( bHasAttachment ){ |
| 3358 | /* Attachments */ |
| 3359 | if( !g.perm.Admin && !(g.perm.AttachForum ||g.perm.WrTForum) ){ |
| 3360 | rc = -ajax_route_error(403, "No permission to attach files."); |
| 3361 | goto ajax_save_end; |
| 3362 | }else{ |
| 3363 | char *zRoot = (nrid==fpHead) ? 0 : rid_to_uuid(fpHead); |
| 3364 | nAttach = attachments_ajax_from_POST(zRoot ? zRoot : zNewUuid, |
| 3365 | bModAttach); |
| 3366 | fossil_free(zRoot); |
| 3367 | if( nAttach<0 ){ |
| 3368 | rc = nAttach; |
| 3369 | goto ajax_save_end; |
| 3370 | } |
| @@ -3385,11 +3387,11 @@ | |
| 3387 | fpHead, fpHead |
| 3388 | ); |
| 3389 | } |
| 3390 | } |
| 3391 | } |
| 3392 | if( 0==bModPost |
| 3393 | /* ^^^ Do not allow a status tag on a pending-moderation post |
| 3394 | ** because it will introduce a reference to an artifact which |
| 3395 | ** will become a phantom if it is rejected by a moderator. */ |
| 3396 | && zStatus!=0 && zStatus[0]!=0 |
| 3397 | && forum_may_set_status(nrid) |
| 3398 |
-1
| --- src/fossil.attach.js | ||
| +++ src/fossil.attach.js | ||
| @@ -138,11 +138,10 @@ | ||
| 138 | 138 | } |
| 139 | 139 | }else{ |
| 140 | 140 | this.#updateControls(); |
| 141 | 141 | } |
| 142 | 142 | } |
| 143 | - | |
| 144 | 143 | |
| 145 | 144 | get widget(){ |
| 146 | 145 | return this.#e.body; |
| 147 | 146 | } |
| 148 | 147 | |
| 149 | 148 |
| --- src/fossil.attach.js | |
| +++ src/fossil.attach.js | |
| @@ -138,11 +138,10 @@ | |
| 138 | } |
| 139 | }else{ |
| 140 | this.#updateControls(); |
| 141 | } |
| 142 | } |
| 143 | |
| 144 | |
| 145 | get widget(){ |
| 146 | return this.#e.body; |
| 147 | } |
| 148 | |
| 149 |
| --- src/fossil.attach.js | |
| +++ src/fossil.attach.js | |
| @@ -138,11 +138,10 @@ | |
| 138 | } |
| 139 | }else{ |
| 140 | this.#updateControls(); |
| 141 | } |
| 142 | } |
| 143 | |
| 144 | get widget(){ |
| 145 | return this.#e.body; |
| 146 | } |
| 147 | |
| 148 |
+12
-2
| --- src/fossil.page.forumpost.js | ||
| +++ src/fossil.page.forumpost.js | ||
| @@ -337,11 +337,11 @@ | ||
| 337 | 337 | } |
| 338 | 338 | }); |
| 339 | 339 | } |
| 340 | 340 | }/*e.status*/ |
| 341 | 341 | |
| 342 | - if( F.user.mayAttachForum ){ | |
| 342 | + if( 0!==F.user.mayAttachForum ){ | |
| 343 | 343 | //e.buttons.append( e.button.addAttach = this.#att.takeAddButton() ); |
| 344 | 344 | e.tabAttach = D.div(); |
| 345 | 345 | e.tabAttach.setAttribute('id', idPrefix+'-attach'); |
| 346 | 346 | e.tabAttach.dataset.tabLabel = 'Attachments'; |
| 347 | 347 | this.#tabs.addTab(e.tabAttach); |
| @@ -598,13 +598,23 @@ | ||
| 598 | 598 | D.attr( |
| 599 | 599 | D.a(F.repoUrl('attachadd?target='+this.#opt.edit.uuid), '/attachadd'), |
| 600 | 600 | 'target', |
| 601 | 601 | '_new' |
| 602 | 602 | ), |
| 603 | - ".", | |
| 603 | + "." | |
| 604 | 604 | ); |
| 605 | 605 | this.#e.tabAttach.append(eNote); |
| 606 | + } | |
| 607 | + if( F.user.mayAttachForum < 0 ){ | |
| 608 | + /* Users with permission '4' (forum unmoderated) but not 'B' | |
| 609 | + ** (forum-attach) may attach files but they will undergo | |
| 610 | + ** moderation. */ | |
| 611 | + const w = D.div(); | |
| 612 | + w.append("Your attachments will be held "+ | |
| 613 | + "for moderation."); | |
| 614 | + w.classList.add('warning'); | |
| 615 | + this.#e.tabAttach.append(w); | |
| 606 | 616 | } |
| 607 | 617 | this.#e.tabAttach.append(this.#att.widget); |
| 608 | 618 | } |
| 609 | 619 | |
| 610 | 620 | #newFormData(addThisContent){ |
| 611 | 621 |
| --- src/fossil.page.forumpost.js | |
| +++ src/fossil.page.forumpost.js | |
| @@ -337,11 +337,11 @@ | |
| 337 | } |
| 338 | }); |
| 339 | } |
| 340 | }/*e.status*/ |
| 341 | |
| 342 | if( F.user.mayAttachForum ){ |
| 343 | //e.buttons.append( e.button.addAttach = this.#att.takeAddButton() ); |
| 344 | e.tabAttach = D.div(); |
| 345 | e.tabAttach.setAttribute('id', idPrefix+'-attach'); |
| 346 | e.tabAttach.dataset.tabLabel = 'Attachments'; |
| 347 | this.#tabs.addTab(e.tabAttach); |
| @@ -598,13 +598,23 @@ | |
| 598 | D.attr( |
| 599 | D.a(F.repoUrl('attachadd?target='+this.#opt.edit.uuid), '/attachadd'), |
| 600 | 'target', |
| 601 | '_new' |
| 602 | ), |
| 603 | ".", |
| 604 | ); |
| 605 | this.#e.tabAttach.append(eNote); |
| 606 | } |
| 607 | this.#e.tabAttach.append(this.#att.widget); |
| 608 | } |
| 609 | |
| 610 | #newFormData(addThisContent){ |
| 611 |
| --- src/fossil.page.forumpost.js | |
| +++ src/fossil.page.forumpost.js | |
| @@ -337,11 +337,11 @@ | |
| 337 | } |
| 338 | }); |
| 339 | } |
| 340 | }/*e.status*/ |
| 341 | |
| 342 | if( 0!==F.user.mayAttachForum ){ |
| 343 | //e.buttons.append( e.button.addAttach = this.#att.takeAddButton() ); |
| 344 | e.tabAttach = D.div(); |
| 345 | e.tabAttach.setAttribute('id', idPrefix+'-attach'); |
| 346 | e.tabAttach.dataset.tabLabel = 'Attachments'; |
| 347 | this.#tabs.addTab(e.tabAttach); |
| @@ -598,13 +598,23 @@ | |
| 598 | D.attr( |
| 599 | D.a(F.repoUrl('attachadd?target='+this.#opt.edit.uuid), '/attachadd'), |
| 600 | 'target', |
| 601 | '_new' |
| 602 | ), |
| 603 | "." |
| 604 | ); |
| 605 | this.#e.tabAttach.append(eNote); |
| 606 | } |
| 607 | if( F.user.mayAttachForum < 0 ){ |
| 608 | /* Users with permission '4' (forum unmoderated) but not 'B' |
| 609 | ** (forum-attach) may attach files but they will undergo |
| 610 | ** moderation. */ |
| 611 | const w = D.div(); |
| 612 | w.append("Your attachments will be held "+ |
| 613 | "for moderation."); |
| 614 | w.classList.add('warning'); |
| 615 | this.#e.tabAttach.append(w); |
| 616 | } |
| 617 | this.#e.tabAttach.append(this.#att.widget); |
| 618 | } |
| 619 | |
| 620 | #newFormData(addThisContent){ |
| 621 |
+3
-3
| --- src/manifest.c | ||
| +++ src/manifest.c | ||
| @@ -2779,23 +2779,23 @@ | ||
| 2779 | 2779 | blob_appendf(&comment, " Change user to \"%h\".", zValue); |
| 2780 | 2780 | continue; |
| 2781 | 2781 | }else if( strcmp(zName, "+date")==0 ){ |
| 2782 | 2782 | blob_appendf(&comment, " Timestamp %h.", zValue); |
| 2783 | 2783 | continue; |
| 2784 | - }else if( memcmp(zName, "-sym-",5)==0 ){ | |
| 2784 | + }else if( strncmp(zName, "-sym-",5)==0 ){ | |
| 2785 | 2785 | if( !branchMove ){ |
| 2786 | 2786 | blob_appendf(&comment, " Cancel tag \"%h\"", &zName[5]); |
| 2787 | 2787 | }else{ |
| 2788 | 2788 | continue; |
| 2789 | 2789 | } |
| 2790 | - }else if( memcmp(zName, "*sym-",5)==0 ){ | |
| 2790 | + }else if( strncmp(zName, "*sym-",5)==0 ){ | |
| 2791 | 2791 | if( !branchMove ){ |
| 2792 | 2792 | blob_appendf(&comment, " Add propagating tag \"%h\"", &zName[5]); |
| 2793 | 2793 | }else{ |
| 2794 | 2794 | continue; |
| 2795 | 2795 | } |
| 2796 | - }else if( memcmp(zName, "+sym-",5)==0 ){ | |
| 2796 | + }else if( strncmp(zName, "+sym-",5)==0 ){ | |
| 2797 | 2797 | blob_appendf(&comment, " Add tag \"%h\"", &zName[5]); |
| 2798 | 2798 | }else if( strcmp(zName, "+closed")==0 ){ |
| 2799 | 2799 | blob_append(&comment, " Mark \"Closed\"", -1); |
| 2800 | 2800 | }else if( strcmp(zName, "-closed")==0 ){ |
| 2801 | 2801 | blob_append(&comment, " Remove the \"Closed\" mark", -1); |
| 2802 | 2802 |
| --- src/manifest.c | |
| +++ src/manifest.c | |
| @@ -2779,23 +2779,23 @@ | |
| 2779 | blob_appendf(&comment, " Change user to \"%h\".", zValue); |
| 2780 | continue; |
| 2781 | }else if( strcmp(zName, "+date")==0 ){ |
| 2782 | blob_appendf(&comment, " Timestamp %h.", zValue); |
| 2783 | continue; |
| 2784 | }else if( memcmp(zName, "-sym-",5)==0 ){ |
| 2785 | if( !branchMove ){ |
| 2786 | blob_appendf(&comment, " Cancel tag \"%h\"", &zName[5]); |
| 2787 | }else{ |
| 2788 | continue; |
| 2789 | } |
| 2790 | }else if( memcmp(zName, "*sym-",5)==0 ){ |
| 2791 | if( !branchMove ){ |
| 2792 | blob_appendf(&comment, " Add propagating tag \"%h\"", &zName[5]); |
| 2793 | }else{ |
| 2794 | continue; |
| 2795 | } |
| 2796 | }else if( memcmp(zName, "+sym-",5)==0 ){ |
| 2797 | blob_appendf(&comment, " Add tag \"%h\"", &zName[5]); |
| 2798 | }else if( strcmp(zName, "+closed")==0 ){ |
| 2799 | blob_append(&comment, " Mark \"Closed\"", -1); |
| 2800 | }else if( strcmp(zName, "-closed")==0 ){ |
| 2801 | blob_append(&comment, " Remove the \"Closed\" mark", -1); |
| 2802 |
| --- src/manifest.c | |
| +++ src/manifest.c | |
| @@ -2779,23 +2779,23 @@ | |
| 2779 | blob_appendf(&comment, " Change user to \"%h\".", zValue); |
| 2780 | continue; |
| 2781 | }else if( strcmp(zName, "+date")==0 ){ |
| 2782 | blob_appendf(&comment, " Timestamp %h.", zValue); |
| 2783 | continue; |
| 2784 | }else if( strncmp(zName, "-sym-",5)==0 ){ |
| 2785 | if( !branchMove ){ |
| 2786 | blob_appendf(&comment, " Cancel tag \"%h\"", &zName[5]); |
| 2787 | }else{ |
| 2788 | continue; |
| 2789 | } |
| 2790 | }else if( strncmp(zName, "*sym-",5)==0 ){ |
| 2791 | if( !branchMove ){ |
| 2792 | blob_appendf(&comment, " Add propagating tag \"%h\"", &zName[5]); |
| 2793 | }else{ |
| 2794 | continue; |
| 2795 | } |
| 2796 | }else if( strncmp(zName, "+sym-",5)==0 ){ |
| 2797 | blob_appendf(&comment, " Add tag \"%h\"", &zName[5]); |
| 2798 | }else if( strcmp(zName, "+closed")==0 ){ |
| 2799 | blob_append(&comment, " Mark \"Closed\"", -1); |
| 2800 | }else if( strcmp(zName, "-closed")==0 ){ |
| 2801 | blob_append(&comment, " Remove the \"Closed\" mark", -1); |
| 2802 |
+1
-1
| --- src/markdown.c | ||
| +++ src/markdown.c | ||
| @@ -1803,11 +1803,11 @@ | ||
| 1803 | 1803 | ** If this is a quoted fenced block, then set endFence to be the |
| 1804 | 1804 | ** offset of the end of the fenced block. |
| 1805 | 1805 | */ |
| 1806 | 1806 | pre = prefix_quote(data,size); |
| 1807 | 1807 | pre += is_empty(data+pre,size-pre); |
| 1808 | - nb = prefix_fencedcode(data+pre,size-pre); | |
| 1808 | + nb = pre<size ? prefix_fencedcode(data+pre,size-pre) : 0; | |
| 1809 | 1809 | if( nb ){ |
| 1810 | 1810 | size_t i = 0; |
| 1811 | 1811 | char delim = data[pre]; |
| 1812 | 1812 | for(end=pre+nb; end<size && i<nb; end++){ |
| 1813 | 1813 | if( data[end]==delim ) i++; else i = 0; |
| 1814 | 1814 |
| --- src/markdown.c | |
| +++ src/markdown.c | |
| @@ -1803,11 +1803,11 @@ | |
| 1803 | ** If this is a quoted fenced block, then set endFence to be the |
| 1804 | ** offset of the end of the fenced block. |
| 1805 | */ |
| 1806 | pre = prefix_quote(data,size); |
| 1807 | pre += is_empty(data+pre,size-pre); |
| 1808 | nb = prefix_fencedcode(data+pre,size-pre); |
| 1809 | if( nb ){ |
| 1810 | size_t i = 0; |
| 1811 | char delim = data[pre]; |
| 1812 | for(end=pre+nb; end<size && i<nb; end++){ |
| 1813 | if( data[end]==delim ) i++; else i = 0; |
| 1814 |
| --- src/markdown.c | |
| +++ src/markdown.c | |
| @@ -1803,11 +1803,11 @@ | |
| 1803 | ** If this is a quoted fenced block, then set endFence to be the |
| 1804 | ** offset of the end of the fenced block. |
| 1805 | */ |
| 1806 | pre = prefix_quote(data,size); |
| 1807 | pre += is_empty(data+pre,size-pre); |
| 1808 | nb = pre<size ? prefix_fencedcode(data+pre,size-pre) : 0; |
| 1809 | if( nb ){ |
| 1810 | size_t i = 0; |
| 1811 | char delim = data[pre]; |
| 1812 | for(end=pre+nb; end<size && i<nb; end++){ |
| 1813 | if( data[end]==delim ) i++; else i = 0; |
| 1814 |
+4
-4
| --- src/markdown_html.c | ||
| +++ src/markdown_html.c | ||
| @@ -1027,20 +1027,20 @@ | ||
| 1027 | 1027 | z[k++] = (char)x; |
| 1028 | 1028 | j += n; |
| 1029 | 1029 | }else{ |
| 1030 | 1030 | z[k++] = c; |
| 1031 | 1031 | } |
| 1032 | - }else if( memcmp(&z[j],"<",4)==0 ){ | |
| 1032 | + }else if( p->nUsed-j>=4 && memcmp(&z[j],"<",4)==0 ){ | |
| 1033 | 1033 | z[k++] = '<'; |
| 1034 | 1034 | j += 3; |
| 1035 | - }else if( memcmp(&z[j],">",4)==0 ){ | |
| 1035 | + }else if( p->nUsed-j>=4 && memcmp(&z[j],">",4)==0 ){ | |
| 1036 | 1036 | z[k++] = '>'; |
| 1037 | 1037 | j += 3; |
| 1038 | - }else if( memcmp(&z[j],""",6)==0 ){ | |
| 1038 | + }else if( p->nUsed-j>=6 && memcmp(&z[j],""",6)==0 ){ | |
| 1039 | 1039 | z[k++] = '"'; |
| 1040 | 1040 | j += 5; |
| 1041 | - }else if( memcmp(&z[j],"&",5)==0 ){ | |
| 1041 | + }else if( p->nUsed-j>=5 && memcmp(&z[j],"&",5)==0 ){ | |
| 1042 | 1042 | z[k++] = '&'; |
| 1043 | 1043 | j += 4; |
| 1044 | 1044 | }else{ |
| 1045 | 1045 | z[k++] = c; |
| 1046 | 1046 | } |
| 1047 | 1047 |
| --- src/markdown_html.c | |
| +++ src/markdown_html.c | |
| @@ -1027,20 +1027,20 @@ | |
| 1027 | z[k++] = (char)x; |
| 1028 | j += n; |
| 1029 | }else{ |
| 1030 | z[k++] = c; |
| 1031 | } |
| 1032 | }else if( memcmp(&z[j],"<",4)==0 ){ |
| 1033 | z[k++] = '<'; |
| 1034 | j += 3; |
| 1035 | }else if( memcmp(&z[j],">",4)==0 ){ |
| 1036 | z[k++] = '>'; |
| 1037 | j += 3; |
| 1038 | }else if( memcmp(&z[j],""",6)==0 ){ |
| 1039 | z[k++] = '"'; |
| 1040 | j += 5; |
| 1041 | }else if( memcmp(&z[j],"&",5)==0 ){ |
| 1042 | z[k++] = '&'; |
| 1043 | j += 4; |
| 1044 | }else{ |
| 1045 | z[k++] = c; |
| 1046 | } |
| 1047 |
| --- src/markdown_html.c | |
| +++ src/markdown_html.c | |
| @@ -1027,20 +1027,20 @@ | |
| 1027 | z[k++] = (char)x; |
| 1028 | j += n; |
| 1029 | }else{ |
| 1030 | z[k++] = c; |
| 1031 | } |
| 1032 | }else if( p->nUsed-j>=4 && memcmp(&z[j],"<",4)==0 ){ |
| 1033 | z[k++] = '<'; |
| 1034 | j += 3; |
| 1035 | }else if( p->nUsed-j>=4 && memcmp(&z[j],">",4)==0 ){ |
| 1036 | z[k++] = '>'; |
| 1037 | j += 3; |
| 1038 | }else if( p->nUsed-j>=6 && memcmp(&z[j],""",6)==0 ){ |
| 1039 | z[k++] = '"'; |
| 1040 | j += 5; |
| 1041 | }else if( p->nUsed-j>=5 && memcmp(&z[j],"&",5)==0 ){ |
| 1042 | z[k++] = '&'; |
| 1043 | j += 4; |
| 1044 | }else{ |
| 1045 | z[k++] = c; |
| 1046 | } |
| 1047 |
+5
-5
| --- src/name.c | ||
| +++ src/name.c | ||
| @@ -533,11 +533,11 @@ | ||
| 533 | 533 | } |
| 534 | 534 | if( rid ) return rid; |
| 535 | 535 | } |
| 536 | 536 | |
| 537 | 537 | /* Date and times */ |
| 538 | - if( memcmp(zTag, "date:", 5)==0 ){ | |
| 538 | + if( strncmp(zTag, "date:", 5)==0 ){ | |
| 539 | 539 | zDate = fossil_expand_datetime(&zTag[5],0,1); |
| 540 | 540 | if( zDate==0 ) zDate = &zTag[5]; |
| 541 | 541 | rid = db_int(0, |
| 542 | 542 | "SELECT objid FROM event" |
| 543 | 543 | " WHERE mtime<=julianday(%Q,fromLocal()) AND type GLOB '%q'" |
| @@ -554,29 +554,29 @@ | ||
| 554 | 554 | if( rid) return rid; |
| 555 | 555 | } |
| 556 | 556 | |
| 557 | 557 | /* Deprecated date & time formats: "local:" + date-time and |
| 558 | 558 | ** "utc:" + date-time */ |
| 559 | - if( memcmp(zTag, "local:", 6)==0 ){ | |
| 559 | + if( strncmp(zTag, "local:", 6)==0 ){ | |
| 560 | 560 | rid = db_int(0, |
| 561 | 561 | "SELECT objid FROM event" |
| 562 | 562 | " WHERE mtime<=julianday(%Q) AND type GLOB '%q'" |
| 563 | 563 | " ORDER BY mtime DESC LIMIT 1", |
| 564 | 564 | &zTag[6], zType); |
| 565 | 565 | return rid; |
| 566 | 566 | } |
| 567 | - if( memcmp(zTag, "utc:", 4)==0 ){ | |
| 567 | + if( strncmp(zTag, "utc:", 4)==0 ){ | |
| 568 | 568 | rid = db_int(0, |
| 569 | 569 | "SELECT objid FROM event" |
| 570 | 570 | " WHERE mtime<=julianday('%qz') AND type GLOB '%q'" |
| 571 | 571 | " ORDER BY mtime DESC LIMIT 1", |
| 572 | 572 | fossil_roundup_date(&zTag[4]), zType); |
| 573 | 573 | return rid; |
| 574 | 574 | } |
| 575 | 575 | |
| 576 | 576 | /* "tag:" + symbolic-name */ |
| 577 | - if( memcmp(zTag, "tag:", 4)==0 ){ | |
| 577 | + if( strncmp(zTag, "tag:", 4)==0 ){ | |
| 578 | 578 | rid = most_recent_event_with_tag(&zTag[4], zType); |
| 579 | 579 | if( startOfBranch ) rid = start_of_branch(rid,1); |
| 580 | 580 | return rid; |
| 581 | 581 | } |
| 582 | 582 | |
| @@ -698,11 +698,11 @@ | ||
| 698 | 698 | if( rid) return rid; |
| 699 | 699 | } |
| 700 | 700 | |
| 701 | 701 | |
| 702 | 702 | /* Undocumented: numeric tags get translated directly into the RID */ |
| 703 | - if( memcmp(zTag, "rid:", 4)==0 ){ | |
| 703 | + if( strncmp(zTag, "rid:", 4)==0 ){ | |
| 704 | 704 | zTag += 4; |
| 705 | 705 | for(i=0; fossil_isdigit(zTag[i]); i++){} |
| 706 | 706 | if( zTag[i]==0 ){ |
| 707 | 707 | if( strcmp(zType,"*")==0 ){ |
| 708 | 708 | rid = atoi(zTag); |
| 709 | 709 |
| --- src/name.c | |
| +++ src/name.c | |
| @@ -533,11 +533,11 @@ | |
| 533 | } |
| 534 | if( rid ) return rid; |
| 535 | } |
| 536 | |
| 537 | /* Date and times */ |
| 538 | if( memcmp(zTag, "date:", 5)==0 ){ |
| 539 | zDate = fossil_expand_datetime(&zTag[5],0,1); |
| 540 | if( zDate==0 ) zDate = &zTag[5]; |
| 541 | rid = db_int(0, |
| 542 | "SELECT objid FROM event" |
| 543 | " WHERE mtime<=julianday(%Q,fromLocal()) AND type GLOB '%q'" |
| @@ -554,29 +554,29 @@ | |
| 554 | if( rid) return rid; |
| 555 | } |
| 556 | |
| 557 | /* Deprecated date & time formats: "local:" + date-time and |
| 558 | ** "utc:" + date-time */ |
| 559 | if( memcmp(zTag, "local:", 6)==0 ){ |
| 560 | rid = db_int(0, |
| 561 | "SELECT objid FROM event" |
| 562 | " WHERE mtime<=julianday(%Q) AND type GLOB '%q'" |
| 563 | " ORDER BY mtime DESC LIMIT 1", |
| 564 | &zTag[6], zType); |
| 565 | return rid; |
| 566 | } |
| 567 | if( memcmp(zTag, "utc:", 4)==0 ){ |
| 568 | rid = db_int(0, |
| 569 | "SELECT objid FROM event" |
| 570 | " WHERE mtime<=julianday('%qz') AND type GLOB '%q'" |
| 571 | " ORDER BY mtime DESC LIMIT 1", |
| 572 | fossil_roundup_date(&zTag[4]), zType); |
| 573 | return rid; |
| 574 | } |
| 575 | |
| 576 | /* "tag:" + symbolic-name */ |
| 577 | if( memcmp(zTag, "tag:", 4)==0 ){ |
| 578 | rid = most_recent_event_with_tag(&zTag[4], zType); |
| 579 | if( startOfBranch ) rid = start_of_branch(rid,1); |
| 580 | return rid; |
| 581 | } |
| 582 | |
| @@ -698,11 +698,11 @@ | |
| 698 | if( rid) return rid; |
| 699 | } |
| 700 | |
| 701 | |
| 702 | /* Undocumented: numeric tags get translated directly into the RID */ |
| 703 | if( memcmp(zTag, "rid:", 4)==0 ){ |
| 704 | zTag += 4; |
| 705 | for(i=0; fossil_isdigit(zTag[i]); i++){} |
| 706 | if( zTag[i]==0 ){ |
| 707 | if( strcmp(zType,"*")==0 ){ |
| 708 | rid = atoi(zTag); |
| 709 |
| --- src/name.c | |
| +++ src/name.c | |
| @@ -533,11 +533,11 @@ | |
| 533 | } |
| 534 | if( rid ) return rid; |
| 535 | } |
| 536 | |
| 537 | /* Date and times */ |
| 538 | if( strncmp(zTag, "date:", 5)==0 ){ |
| 539 | zDate = fossil_expand_datetime(&zTag[5],0,1); |
| 540 | if( zDate==0 ) zDate = &zTag[5]; |
| 541 | rid = db_int(0, |
| 542 | "SELECT objid FROM event" |
| 543 | " WHERE mtime<=julianday(%Q,fromLocal()) AND type GLOB '%q'" |
| @@ -554,29 +554,29 @@ | |
| 554 | if( rid) return rid; |
| 555 | } |
| 556 | |
| 557 | /* Deprecated date & time formats: "local:" + date-time and |
| 558 | ** "utc:" + date-time */ |
| 559 | if( strncmp(zTag, "local:", 6)==0 ){ |
| 560 | rid = db_int(0, |
| 561 | "SELECT objid FROM event" |
| 562 | " WHERE mtime<=julianday(%Q) AND type GLOB '%q'" |
| 563 | " ORDER BY mtime DESC LIMIT 1", |
| 564 | &zTag[6], zType); |
| 565 | return rid; |
| 566 | } |
| 567 | if( strncmp(zTag, "utc:", 4)==0 ){ |
| 568 | rid = db_int(0, |
| 569 | "SELECT objid FROM event" |
| 570 | " WHERE mtime<=julianday('%qz') AND type GLOB '%q'" |
| 571 | " ORDER BY mtime DESC LIMIT 1", |
| 572 | fossil_roundup_date(&zTag[4]), zType); |
| 573 | return rid; |
| 574 | } |
| 575 | |
| 576 | /* "tag:" + symbolic-name */ |
| 577 | if( strncmp(zTag, "tag:", 4)==0 ){ |
| 578 | rid = most_recent_event_with_tag(&zTag[4], zType); |
| 579 | if( startOfBranch ) rid = start_of_branch(rid,1); |
| 580 | return rid; |
| 581 | } |
| 582 | |
| @@ -698,11 +698,11 @@ | |
| 698 | if( rid) return rid; |
| 699 | } |
| 700 | |
| 701 | |
| 702 | /* Undocumented: numeric tags get translated directly into the RID */ |
| 703 | if( strncmp(zTag, "rid:", 4)==0 ){ |
| 704 | zTag += 4; |
| 705 | for(i=0; fossil_isdigit(zTag[i]); i++){} |
| 706 | if( zTag[i]==0 ){ |
| 707 | if( strcmp(zType,"*")==0 ){ |
| 708 | rid = atoi(zTag); |
| 709 |
+2
-1
| --- src/security_audit.c | ||
| +++ src/security_audit.c | ||
| @@ -897,11 +897,12 @@ | ||
| 897 | 897 | no_error_log_available(); |
| 898 | 898 | style_finish_page(); |
| 899 | 899 | return; |
| 900 | 900 | } |
| 901 | 901 | if( P("truncate1") && cgi_csrf_safe(2) ){ |
| 902 | - fclose(fopen(g.zErrlog,"w")); | |
| 902 | + FILE *pLog = fopen(g.zErrlog,"w"); | |
| 903 | + if( pLog ) fclose(pLog); | |
| 903 | 904 | } |
| 904 | 905 | if( P("download") ){ |
| 905 | 906 | Blob log; |
| 906 | 907 | blob_read_from_file(&log, g.zErrlog, ExtFILE); |
| 907 | 908 | cgi_set_content_type("text/plain"); |
| 908 | 909 |
| --- src/security_audit.c | |
| +++ src/security_audit.c | |
| @@ -897,11 +897,12 @@ | |
| 897 | no_error_log_available(); |
| 898 | style_finish_page(); |
| 899 | return; |
| 900 | } |
| 901 | if( P("truncate1") && cgi_csrf_safe(2) ){ |
| 902 | fclose(fopen(g.zErrlog,"w")); |
| 903 | } |
| 904 | if( P("download") ){ |
| 905 | Blob log; |
| 906 | blob_read_from_file(&log, g.zErrlog, ExtFILE); |
| 907 | cgi_set_content_type("text/plain"); |
| 908 |
| --- src/security_audit.c | |
| +++ src/security_audit.c | |
| @@ -897,11 +897,12 @@ | |
| 897 | no_error_log_available(); |
| 898 | style_finish_page(); |
| 899 | return; |
| 900 | } |
| 901 | if( P("truncate1") && cgi_csrf_safe(2) ){ |
| 902 | FILE *pLog = fopen(g.zErrlog,"w"); |
| 903 | if( pLog ) fclose(pLog); |
| 904 | } |
| 905 | if( P("download") ){ |
| 906 | Blob log; |
| 907 | blob_read_from_file(&log, g.zErrlog, ExtFILE); |
| 908 | cgi_set_content_type("text/plain"); |
| 909 |
+1
-1
| --- src/style.c | ||
| +++ src/style.c | ||
| @@ -505,11 +505,11 @@ | ||
| 505 | 505 | ** the ID of the <span> that surrounds the display text and the ID |
| 506 | 506 | ** of the <button> becomes "copy-%s" where %s is filled in by zTargetId. |
| 507 | 507 | ** If zTargetId is NULL (the usual case) then IDs are selected automatically. |
| 508 | 508 | ** |
| 509 | 509 | ** The bOutputCGI parameter is usually true, meaning that the output |
| 510 | -** is appended to the CGI result under construction. However, if | |
| 510 | +** is appended to the CGI result under construction. However, if | |
| 511 | 511 | ** bOutputCGI is false, the generated HTML is written into memory |
| 512 | 512 | ** obtained from fossil_malloc() and returned. |
| 513 | 513 | ** |
| 514 | 514 | ** If the bAfter argument is non-zero, the copy button is displayed |
| 515 | 515 | ** after the text. Normally the copy button comes before the text. |
| 516 | 516 |
| --- src/style.c | |
| +++ src/style.c | |
| @@ -505,11 +505,11 @@ | |
| 505 | ** the ID of the <span> that surrounds the display text and the ID |
| 506 | ** of the <button> becomes "copy-%s" where %s is filled in by zTargetId. |
| 507 | ** If zTargetId is NULL (the usual case) then IDs are selected automatically. |
| 508 | ** |
| 509 | ** The bOutputCGI parameter is usually true, meaning that the output |
| 510 | ** is appended to the CGI result under construction. However, if |
| 511 | ** bOutputCGI is false, the generated HTML is written into memory |
| 512 | ** obtained from fossil_malloc() and returned. |
| 513 | ** |
| 514 | ** If the bAfter argument is non-zero, the copy button is displayed |
| 515 | ** after the text. Normally the copy button comes before the text. |
| 516 |
| --- src/style.c | |
| +++ src/style.c | |
| @@ -505,11 +505,11 @@ | |
| 505 | ** the ID of the <span> that surrounds the display text and the ID |
| 506 | ** of the <button> becomes "copy-%s" where %s is filled in by zTargetId. |
| 507 | ** If zTargetId is NULL (the usual case) then IDs are selected automatically. |
| 508 | ** |
| 509 | ** The bOutputCGI parameter is usually true, meaning that the output |
| 510 | ** is appended to the CGI result under construction. However, if |
| 511 | ** bOutputCGI is false, the generated HTML is written into memory |
| 512 | ** obtained from fossil_malloc() and returned. |
| 513 | ** |
| 514 | ** If the bAfter argument is non-zero, the copy button is displayed |
| 515 | ** after the text. Normally the copy button comes before the text. |
| 516 |
+51
| --- src/timeline.c | ||
| +++ src/timeline.c | ||
| @@ -1237,10 +1237,46 @@ | ||
| 1237 | 1237 | @ FROM event CROSS JOIN blob |
| 1238 | 1238 | @ WHERE blob.rid=event.objid |
| 1239 | 1239 | ; |
| 1240 | 1240 | return zBase; |
| 1241 | 1241 | } |
| 1242 | + | |
| 1243 | +/* | |
| 1244 | +** SQL function: hidden_by_user(X) | |
| 1245 | +** | |
| 1246 | +** Return true if X matches one of the GLOB patterns in the "hide-by-user" | |
| 1247 | +** setting. | |
| 1248 | +*/ | |
| 1249 | +static void timeline_hidden_by_user_func( | |
| 1250 | + sqlite3_context *context, | |
| 1251 | + int argc, | |
| 1252 | + sqlite3_value **argv | |
| 1253 | +){ | |
| 1254 | + static Glob *pGlob = 0; | |
| 1255 | + static int isInit = 0; | |
| 1256 | + const char *zUser; | |
| 1257 | + if( !isInit ){ | |
| 1258 | + const char *zPat = db_get("hide-by-user", 0); | |
| 1259 | + pGlob = zPat ? glob_create(zPat) : 0; | |
| 1260 | + isInit = 1; | |
| 1261 | + } | |
| 1262 | + zUser = (const char*)sqlite3_value_text(argv[0]); | |
| 1263 | + sqlite3_result_int(context, | |
| 1264 | + pGlob!=0 && zUser!=0 && glob_match(pGlob, zUser)!=0); | |
| 1265 | +} | |
| 1266 | + | |
| 1267 | +/* | |
| 1268 | +** Register hidden_by_user() and return true if the "hide-by-user" | |
| 1269 | +** setting is non-empty. | |
| 1270 | +*/ | |
| 1271 | +static int timeline_enable_hide_by_user(void){ | |
| 1272 | + const char *zPat = db_get("hide-by-user", 0); | |
| 1273 | + if( zPat==0 || zPat[0]==0 ) return 0; | |
| 1274 | + sqlite3_create_function(g.db, "hidden_by_user", 1, SQLITE_UTF8, 0, | |
| 1275 | + timeline_hidden_by_user_func, 0, 0); | |
| 1276 | + return 1; | |
| 1277 | +} | |
| 1242 | 1278 | |
| 1243 | 1279 | /* |
| 1244 | 1280 | ** zDate is a localtime date. Insert records into the |
| 1245 | 1281 | ** "timeline" table to cause <hr> to be inserted on zDate. |
| 1246 | 1282 | */ |
| @@ -2261,10 +2297,15 @@ | ||
| 2261 | 2297 | blob_append_sql(&sql, |
| 2262 | 2298 | " AND NOT EXISTS(SELECT 1 FROM tagxref" |
| 2263 | 2299 | " WHERE tagid=%d AND tagtype>0 AND rid=blob.rid)\n", |
| 2264 | 2300 | TAG_HIDDEN |
| 2265 | 2301 | ); |
| 2302 | + if( timeline_enable_hide_by_user() ){ | |
| 2303 | + blob_append_sql(&sql, | |
| 2304 | + " AND NOT (event.type='ci' AND hidden_by_user(coalesce(euser,user)))\n" | |
| 2305 | + ); | |
| 2306 | + } | |
| 2266 | 2307 | } |
| 2267 | 2308 | if( from_rid && !to_rid && (P("ft")!=0 || P("bt")!=0) ){ |
| 2268 | 2309 | const char *zTo = P("ft"); |
| 2269 | 2310 | if( zTo ){ |
| 2270 | 2311 | from_to_mode = 1; |
| @@ -3049,10 +3090,20 @@ | ||
| 3049 | 3090 | " FROM related_nodes, tagxref\n" |
| 3050 | 3091 | " WHERE tagid=%d AND tagtype>0\n" |
| 3051 | 3092 | " AND tagxref.rid=related_nodes.rid)", |
| 3052 | 3093 | TAG_HIDDEN |
| 3053 | 3094 | ); |
| 3095 | + if( timeline_enable_hide_by_user() ){ | |
| 3096 | + db_multi_exec( | |
| 3097 | + "DELETE FROM related_nodes\n" | |
| 3098 | + " WHERE rid IN (SELECT related_nodes.rid\n" | |
| 3099 | + " FROM related_nodes, event\n" | |
| 3100 | + " WHERE event.objid=related_nodes.rid\n" | |
| 3101 | + " AND event.type='ci'\n" | |
| 3102 | + " AND hidden_by_user(coalesce(euser,user)))" | |
| 3103 | + ); | |
| 3104 | + } | |
| 3054 | 3105 | } |
| 3055 | 3106 | } |
| 3056 | 3107 | } |
| 3057 | 3108 | if( (zType[0]=='w' && !g.perm.RdWiki) |
| 3058 | 3109 | || (zType[0]=='t' && !g.perm.RdTkt) |
| 3059 | 3110 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -1237,10 +1237,46 @@ | |
| 1237 | @ FROM event CROSS JOIN blob |
| 1238 | @ WHERE blob.rid=event.objid |
| 1239 | ; |
| 1240 | return zBase; |
| 1241 | } |
| 1242 | |
| 1243 | /* |
| 1244 | ** zDate is a localtime date. Insert records into the |
| 1245 | ** "timeline" table to cause <hr> to be inserted on zDate. |
| 1246 | */ |
| @@ -2261,10 +2297,15 @@ | |
| 2261 | blob_append_sql(&sql, |
| 2262 | " AND NOT EXISTS(SELECT 1 FROM tagxref" |
| 2263 | " WHERE tagid=%d AND tagtype>0 AND rid=blob.rid)\n", |
| 2264 | TAG_HIDDEN |
| 2265 | ); |
| 2266 | } |
| 2267 | if( from_rid && !to_rid && (P("ft")!=0 || P("bt")!=0) ){ |
| 2268 | const char *zTo = P("ft"); |
| 2269 | if( zTo ){ |
| 2270 | from_to_mode = 1; |
| @@ -3049,10 +3090,20 @@ | |
| 3049 | " FROM related_nodes, tagxref\n" |
| 3050 | " WHERE tagid=%d AND tagtype>0\n" |
| 3051 | " AND tagxref.rid=related_nodes.rid)", |
| 3052 | TAG_HIDDEN |
| 3053 | ); |
| 3054 | } |
| 3055 | } |
| 3056 | } |
| 3057 | if( (zType[0]=='w' && !g.perm.RdWiki) |
| 3058 | || (zType[0]=='t' && !g.perm.RdTkt) |
| 3059 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -1237,10 +1237,46 @@ | |
| 1237 | @ FROM event CROSS JOIN blob |
| 1238 | @ WHERE blob.rid=event.objid |
| 1239 | ; |
| 1240 | return zBase; |
| 1241 | } |
| 1242 | |
| 1243 | /* |
| 1244 | ** SQL function: hidden_by_user(X) |
| 1245 | ** |
| 1246 | ** Return true if X matches one of the GLOB patterns in the "hide-by-user" |
| 1247 | ** setting. |
| 1248 | */ |
| 1249 | static void timeline_hidden_by_user_func( |
| 1250 | sqlite3_context *context, |
| 1251 | int argc, |
| 1252 | sqlite3_value **argv |
| 1253 | ){ |
| 1254 | static Glob *pGlob = 0; |
| 1255 | static int isInit = 0; |
| 1256 | const char *zUser; |
| 1257 | if( !isInit ){ |
| 1258 | const char *zPat = db_get("hide-by-user", 0); |
| 1259 | pGlob = zPat ? glob_create(zPat) : 0; |
| 1260 | isInit = 1; |
| 1261 | } |
| 1262 | zUser = (const char*)sqlite3_value_text(argv[0]); |
| 1263 | sqlite3_result_int(context, |
| 1264 | pGlob!=0 && zUser!=0 && glob_match(pGlob, zUser)!=0); |
| 1265 | } |
| 1266 | |
| 1267 | /* |
| 1268 | ** Register hidden_by_user() and return true if the "hide-by-user" |
| 1269 | ** setting is non-empty. |
| 1270 | */ |
| 1271 | static int timeline_enable_hide_by_user(void){ |
| 1272 | const char *zPat = db_get("hide-by-user", 0); |
| 1273 | if( zPat==0 || zPat[0]==0 ) return 0; |
| 1274 | sqlite3_create_function(g.db, "hidden_by_user", 1, SQLITE_UTF8, 0, |
| 1275 | timeline_hidden_by_user_func, 0, 0); |
| 1276 | return 1; |
| 1277 | } |
| 1278 | |
| 1279 | /* |
| 1280 | ** zDate is a localtime date. Insert records into the |
| 1281 | ** "timeline" table to cause <hr> to be inserted on zDate. |
| 1282 | */ |
| @@ -2261,10 +2297,15 @@ | |
| 2297 | blob_append_sql(&sql, |
| 2298 | " AND NOT EXISTS(SELECT 1 FROM tagxref" |
| 2299 | " WHERE tagid=%d AND tagtype>0 AND rid=blob.rid)\n", |
| 2300 | TAG_HIDDEN |
| 2301 | ); |
| 2302 | if( timeline_enable_hide_by_user() ){ |
| 2303 | blob_append_sql(&sql, |
| 2304 | " AND NOT (event.type='ci' AND hidden_by_user(coalesce(euser,user)))\n" |
| 2305 | ); |
| 2306 | } |
| 2307 | } |
| 2308 | if( from_rid && !to_rid && (P("ft")!=0 || P("bt")!=0) ){ |
| 2309 | const char *zTo = P("ft"); |
| 2310 | if( zTo ){ |
| 2311 | from_to_mode = 1; |
| @@ -3049,10 +3090,20 @@ | |
| 3090 | " FROM related_nodes, tagxref\n" |
| 3091 | " WHERE tagid=%d AND tagtype>0\n" |
| 3092 | " AND tagxref.rid=related_nodes.rid)", |
| 3093 | TAG_HIDDEN |
| 3094 | ); |
| 3095 | if( timeline_enable_hide_by_user() ){ |
| 3096 | db_multi_exec( |
| 3097 | "DELETE FROM related_nodes\n" |
| 3098 | " WHERE rid IN (SELECT related_nodes.rid\n" |
| 3099 | " FROM related_nodes, event\n" |
| 3100 | " WHERE event.objid=related_nodes.rid\n" |
| 3101 | " AND event.type='ci'\n" |
| 3102 | " AND hidden_by_user(coalesce(euser,user)))" |
| 3103 | ); |
| 3104 | } |
| 3105 | } |
| 3106 | } |
| 3107 | } |
| 3108 | if( (zType[0]=='w' && !g.perm.RdWiki) |
| 3109 | || (zType[0]=='t' && !g.perm.RdTkt) |
| 3110 |
+8
-8
| --- src/tkt.c | ||
| +++ src/tkt.c | ||
| @@ -87,15 +87,15 @@ | ||
| 87 | 87 | nBaselines = 0; |
| 88 | 88 | db_prepare(&q, "PRAGMA table_info(ticket)"); |
| 89 | 89 | while( db_step(&q)==SQLITE_ROW ){ |
| 90 | 90 | const char *zFieldName = db_column_text(&q, 1); |
| 91 | 91 | haveTicket = 1; |
| 92 | - if( memcmp(zFieldName,"tkt_",4)==0 ){ | |
| 92 | + if( strncmp(zFieldName,"tkt_",4)==0 ){ | |
| 93 | 93 | if( strcmp(zFieldName, "tkt_ctime")==0 ) haveTicketCTime = 1; |
| 94 | 94 | continue; |
| 95 | 95 | } |
| 96 | - if( memcmp(zFieldName,"baseline for ",13)==0 ){ | |
| 96 | + if( strncmp(zFieldName,"baseline for ",13)==0 ){ | |
| 97 | 97 | if( strcmp(db_column_text(&q,2),"INTEGER")==0 ){ |
| 98 | 98 | nBaselines++; |
| 99 | 99 | } |
| 100 | 100 | continue; |
| 101 | 101 | } |
| @@ -128,11 +128,11 @@ | ||
| 128 | 128 | } |
| 129 | 129 | db_prepare(&q, "PRAGMA table_info(ticketchng)"); |
| 130 | 130 | while( db_step(&q)==SQLITE_ROW ){ |
| 131 | 131 | const char *zFieldName = db_column_text(&q, 1); |
| 132 | 132 | haveTicketChng = 1; |
| 133 | - if( memcmp(zFieldName,"tkt_",4)==0 ){ | |
| 133 | + if( strncmp(zFieldName,"tkt_",4)==0 ){ | |
| 134 | 134 | if( strcmp(zFieldName+4,"rid")==0 ){ |
| 135 | 135 | haveTicketChngRid = 1; /* tkt_rid */ |
| 136 | 136 | }else if( strcmp(zFieldName+4,"user")==0 ){ |
| 137 | 137 | haveTicketChngUser = 1; /* tkt_user */ |
| 138 | 138 | } |
| @@ -211,11 +211,11 @@ | ||
| 211 | 211 | }else if( strncmp(zName, "private_", 8)==0 ){ |
| 212 | 212 | zVal = zRevealed = db_reveal(zVal); |
| 213 | 213 | } |
| 214 | 214 | if( (j = fieldId(zName))>=0 ){ |
| 215 | 215 | aField[j].zValue = fossil_strdup(zVal); |
| 216 | - }else if( memcmp(zName, "tkt_", 4)==0 && Th_Fetch(zName, &size)==0 ){ | |
| 216 | + }else if( strncmp(zName, "tkt_", 4)==0 && Th_Fetch(zName, &size)==0 ){ | |
| 217 | 217 | /* TICKET table columns that begin with "tkt_" are always safe */ |
| 218 | 218 | Th_Store(zName, zVal); |
| 219 | 219 | } |
| 220 | 220 | free(zRevealed); |
| 221 | 221 | } |
| @@ -843,11 +843,11 @@ | ||
| 843 | 843 | if( g.thTrace ){ |
| 844 | 844 | Th_Trace("append_field %#h {%#h}<br>\n", |
| 845 | 845 | TH1_LEN(argl[1]), argv[1], TH1_LEN(argl[2]), argv[2]); |
| 846 | 846 | } |
| 847 | 847 | for(idx=0; idx<nField; idx++){ |
| 848 | - if( memcmp(aField[idx].zName, argv[1], TH1_LEN(argl[1]))==0 | |
| 848 | + if( strncmp(aField[idx].zName, argv[1], TH1_LEN(argl[1]))==0 | |
| 849 | 849 | && aField[idx].zName[TH1_LEN(argl[1])]==0 ){ |
| 850 | 850 | break; |
| 851 | 851 | } |
| 852 | 852 | } |
| 853 | 853 | if( idx>=nField ){ |
| @@ -963,14 +963,14 @@ | ||
| 963 | 963 | zValue = Th_Fetch(aField[i].zName, &nValue); |
| 964 | 964 | if( zValue ){ |
| 965 | 965 | nValue = TH1_LEN(nValue); |
| 966 | 966 | while( nValue>0 && fossil_isspace(zValue[nValue-1]) ){ nValue--; } |
| 967 | 967 | if( ((aField[i].mUsed & USEDBY_TICKETCHNG)!=0 && nValue>0) |
| 968 | - || memcmp(zValue, aField[i].zValue, nValue)!=0 | |
| 969 | 968 | ||(int)strlen(aField[i].zValue)!=nValue |
| 969 | + || memcmp(zValue, aField[i].zValue, nValue)!=0 | |
| 970 | 970 | ){ |
| 971 | - if( memcmp(aField[i].zName, "private_", 8)==0 ){ | |
| 971 | + if( strncmp(aField[i].zName, "private_", 8)==0 ){ | |
| 972 | 972 | zValue = db_conceal(zValue, nValue); |
| 973 | 973 | blob_appendf(&tktchng, "J %s %s\n", aField[i].zName, zValue); |
| 974 | 974 | aUsed[i] = JCARD_PRIVATE; |
| 975 | 975 | }else{ |
| 976 | 976 | blob_appendf(&tktchng, "J %s %#F\n", aField[i].zName, nValue, zValue); |
| @@ -1857,11 +1857,11 @@ | ||
| 1857 | 1857 | zValue = aField[iF].zValue; |
| 1858 | 1858 | aUsed[iF] = JCARD_ASSIGN; |
| 1859 | 1859 | }else{ |
| 1860 | 1860 | continue; |
| 1861 | 1861 | } |
| 1862 | - if( memcmp(aField[iF].zName, "private_", 8)==0 ){ | |
| 1862 | + if( strncmp(aField[i].zName, "private_", 8)==0 ){ | |
| 1863 | 1863 | zValue = db_conceal(zValue, strlen(zValue)); |
| 1864 | 1864 | blob_appendf(&tktchng, "J%s%s %s\n", zPfx, aField[iF].zName, zValue); |
| 1865 | 1865 | aUsed[iF] = JCARD_PRIVATE; |
| 1866 | 1866 | }else{ |
| 1867 | 1867 | blob_appendf(&tktchng, "J%s%s %#F\n", zPfx, |
| 1868 | 1868 |
| --- src/tkt.c | |
| +++ src/tkt.c | |
| @@ -87,15 +87,15 @@ | |
| 87 | nBaselines = 0; |
| 88 | db_prepare(&q, "PRAGMA table_info(ticket)"); |
| 89 | while( db_step(&q)==SQLITE_ROW ){ |
| 90 | const char *zFieldName = db_column_text(&q, 1); |
| 91 | haveTicket = 1; |
| 92 | if( memcmp(zFieldName,"tkt_",4)==0 ){ |
| 93 | if( strcmp(zFieldName, "tkt_ctime")==0 ) haveTicketCTime = 1; |
| 94 | continue; |
| 95 | } |
| 96 | if( memcmp(zFieldName,"baseline for ",13)==0 ){ |
| 97 | if( strcmp(db_column_text(&q,2),"INTEGER")==0 ){ |
| 98 | nBaselines++; |
| 99 | } |
| 100 | continue; |
| 101 | } |
| @@ -128,11 +128,11 @@ | |
| 128 | } |
| 129 | db_prepare(&q, "PRAGMA table_info(ticketchng)"); |
| 130 | while( db_step(&q)==SQLITE_ROW ){ |
| 131 | const char *zFieldName = db_column_text(&q, 1); |
| 132 | haveTicketChng = 1; |
| 133 | if( memcmp(zFieldName,"tkt_",4)==0 ){ |
| 134 | if( strcmp(zFieldName+4,"rid")==0 ){ |
| 135 | haveTicketChngRid = 1; /* tkt_rid */ |
| 136 | }else if( strcmp(zFieldName+4,"user")==0 ){ |
| 137 | haveTicketChngUser = 1; /* tkt_user */ |
| 138 | } |
| @@ -211,11 +211,11 @@ | |
| 211 | }else if( strncmp(zName, "private_", 8)==0 ){ |
| 212 | zVal = zRevealed = db_reveal(zVal); |
| 213 | } |
| 214 | if( (j = fieldId(zName))>=0 ){ |
| 215 | aField[j].zValue = fossil_strdup(zVal); |
| 216 | }else if( memcmp(zName, "tkt_", 4)==0 && Th_Fetch(zName, &size)==0 ){ |
| 217 | /* TICKET table columns that begin with "tkt_" are always safe */ |
| 218 | Th_Store(zName, zVal); |
| 219 | } |
| 220 | free(zRevealed); |
| 221 | } |
| @@ -843,11 +843,11 @@ | |
| 843 | if( g.thTrace ){ |
| 844 | Th_Trace("append_field %#h {%#h}<br>\n", |
| 845 | TH1_LEN(argl[1]), argv[1], TH1_LEN(argl[2]), argv[2]); |
| 846 | } |
| 847 | for(idx=0; idx<nField; idx++){ |
| 848 | if( memcmp(aField[idx].zName, argv[1], TH1_LEN(argl[1]))==0 |
| 849 | && aField[idx].zName[TH1_LEN(argl[1])]==0 ){ |
| 850 | break; |
| 851 | } |
| 852 | } |
| 853 | if( idx>=nField ){ |
| @@ -963,14 +963,14 @@ | |
| 963 | zValue = Th_Fetch(aField[i].zName, &nValue); |
| 964 | if( zValue ){ |
| 965 | nValue = TH1_LEN(nValue); |
| 966 | while( nValue>0 && fossil_isspace(zValue[nValue-1]) ){ nValue--; } |
| 967 | if( ((aField[i].mUsed & USEDBY_TICKETCHNG)!=0 && nValue>0) |
| 968 | || memcmp(zValue, aField[i].zValue, nValue)!=0 |
| 969 | ||(int)strlen(aField[i].zValue)!=nValue |
| 970 | ){ |
| 971 | if( memcmp(aField[i].zName, "private_", 8)==0 ){ |
| 972 | zValue = db_conceal(zValue, nValue); |
| 973 | blob_appendf(&tktchng, "J %s %s\n", aField[i].zName, zValue); |
| 974 | aUsed[i] = JCARD_PRIVATE; |
| 975 | }else{ |
| 976 | blob_appendf(&tktchng, "J %s %#F\n", aField[i].zName, nValue, zValue); |
| @@ -1857,11 +1857,11 @@ | |
| 1857 | zValue = aField[iF].zValue; |
| 1858 | aUsed[iF] = JCARD_ASSIGN; |
| 1859 | }else{ |
| 1860 | continue; |
| 1861 | } |
| 1862 | if( memcmp(aField[iF].zName, "private_", 8)==0 ){ |
| 1863 | zValue = db_conceal(zValue, strlen(zValue)); |
| 1864 | blob_appendf(&tktchng, "J%s%s %s\n", zPfx, aField[iF].zName, zValue); |
| 1865 | aUsed[iF] = JCARD_PRIVATE; |
| 1866 | }else{ |
| 1867 | blob_appendf(&tktchng, "J%s%s %#F\n", zPfx, |
| 1868 |
| --- src/tkt.c | |
| +++ src/tkt.c | |
| @@ -87,15 +87,15 @@ | |
| 87 | nBaselines = 0; |
| 88 | db_prepare(&q, "PRAGMA table_info(ticket)"); |
| 89 | while( db_step(&q)==SQLITE_ROW ){ |
| 90 | const char *zFieldName = db_column_text(&q, 1); |
| 91 | haveTicket = 1; |
| 92 | if( strncmp(zFieldName,"tkt_",4)==0 ){ |
| 93 | if( strcmp(zFieldName, "tkt_ctime")==0 ) haveTicketCTime = 1; |
| 94 | continue; |
| 95 | } |
| 96 | if( strncmp(zFieldName,"baseline for ",13)==0 ){ |
| 97 | if( strcmp(db_column_text(&q,2),"INTEGER")==0 ){ |
| 98 | nBaselines++; |
| 99 | } |
| 100 | continue; |
| 101 | } |
| @@ -128,11 +128,11 @@ | |
| 128 | } |
| 129 | db_prepare(&q, "PRAGMA table_info(ticketchng)"); |
| 130 | while( db_step(&q)==SQLITE_ROW ){ |
| 131 | const char *zFieldName = db_column_text(&q, 1); |
| 132 | haveTicketChng = 1; |
| 133 | if( strncmp(zFieldName,"tkt_",4)==0 ){ |
| 134 | if( strcmp(zFieldName+4,"rid")==0 ){ |
| 135 | haveTicketChngRid = 1; /* tkt_rid */ |
| 136 | }else if( strcmp(zFieldName+4,"user")==0 ){ |
| 137 | haveTicketChngUser = 1; /* tkt_user */ |
| 138 | } |
| @@ -211,11 +211,11 @@ | |
| 211 | }else if( strncmp(zName, "private_", 8)==0 ){ |
| 212 | zVal = zRevealed = db_reveal(zVal); |
| 213 | } |
| 214 | if( (j = fieldId(zName))>=0 ){ |
| 215 | aField[j].zValue = fossil_strdup(zVal); |
| 216 | }else if( strncmp(zName, "tkt_", 4)==0 && Th_Fetch(zName, &size)==0 ){ |
| 217 | /* TICKET table columns that begin with "tkt_" are always safe */ |
| 218 | Th_Store(zName, zVal); |
| 219 | } |
| 220 | free(zRevealed); |
| 221 | } |
| @@ -843,11 +843,11 @@ | |
| 843 | if( g.thTrace ){ |
| 844 | Th_Trace("append_field %#h {%#h}<br>\n", |
| 845 | TH1_LEN(argl[1]), argv[1], TH1_LEN(argl[2]), argv[2]); |
| 846 | } |
| 847 | for(idx=0; idx<nField; idx++){ |
| 848 | if( strncmp(aField[idx].zName, argv[1], TH1_LEN(argl[1]))==0 |
| 849 | && aField[idx].zName[TH1_LEN(argl[1])]==0 ){ |
| 850 | break; |
| 851 | } |
| 852 | } |
| 853 | if( idx>=nField ){ |
| @@ -963,14 +963,14 @@ | |
| 963 | zValue = Th_Fetch(aField[i].zName, &nValue); |
| 964 | if( zValue ){ |
| 965 | nValue = TH1_LEN(nValue); |
| 966 | while( nValue>0 && fossil_isspace(zValue[nValue-1]) ){ nValue--; } |
| 967 | if( ((aField[i].mUsed & USEDBY_TICKETCHNG)!=0 && nValue>0) |
| 968 | ||(int)strlen(aField[i].zValue)!=nValue |
| 969 | || memcmp(zValue, aField[i].zValue, nValue)!=0 |
| 970 | ){ |
| 971 | if( strncmp(aField[i].zName, "private_", 8)==0 ){ |
| 972 | zValue = db_conceal(zValue, nValue); |
| 973 | blob_appendf(&tktchng, "J %s %s\n", aField[i].zName, zValue); |
| 974 | aUsed[i] = JCARD_PRIVATE; |
| 975 | }else{ |
| 976 | blob_appendf(&tktchng, "J %s %#F\n", aField[i].zName, nValue, zValue); |
| @@ -1857,11 +1857,11 @@ | |
| 1857 | zValue = aField[iF].zValue; |
| 1858 | aUsed[iF] = JCARD_ASSIGN; |
| 1859 | }else{ |
| 1860 | continue; |
| 1861 | } |
| 1862 | if( strncmp(aField[i].zName, "private_", 8)==0 ){ |
| 1863 | zValue = db_conceal(zValue, strlen(zValue)); |
| 1864 | blob_appendf(&tktchng, "J%s%s %s\n", zPfx, aField[iF].zName, zValue); |
| 1865 | aUsed[iF] = JCARD_PRIVATE; |
| 1866 | }else{ |
| 1867 | blob_appendf(&tktchng, "J%s%s %#F\n", zPfx, |
| 1868 |
+8
-8
| --- src/tkt.c | ||
| +++ src/tkt.c | ||
| @@ -87,15 +87,15 @@ | ||
| 87 | 87 | nBaselines = 0; |
| 88 | 88 | db_prepare(&q, "PRAGMA table_info(ticket)"); |
| 89 | 89 | while( db_step(&q)==SQLITE_ROW ){ |
| 90 | 90 | const char *zFieldName = db_column_text(&q, 1); |
| 91 | 91 | haveTicket = 1; |
| 92 | - if( memcmp(zFieldName,"tkt_",4)==0 ){ | |
| 92 | + if( strncmp(zFieldName,"tkt_",4)==0 ){ | |
| 93 | 93 | if( strcmp(zFieldName, "tkt_ctime")==0 ) haveTicketCTime = 1; |
| 94 | 94 | continue; |
| 95 | 95 | } |
| 96 | - if( memcmp(zFieldName,"baseline for ",13)==0 ){ | |
| 96 | + if( strncmp(zFieldName,"baseline for ",13)==0 ){ | |
| 97 | 97 | if( strcmp(db_column_text(&q,2),"INTEGER")==0 ){ |
| 98 | 98 | nBaselines++; |
| 99 | 99 | } |
| 100 | 100 | continue; |
| 101 | 101 | } |
| @@ -128,11 +128,11 @@ | ||
| 128 | 128 | } |
| 129 | 129 | db_prepare(&q, "PRAGMA table_info(ticketchng)"); |
| 130 | 130 | while( db_step(&q)==SQLITE_ROW ){ |
| 131 | 131 | const char *zFieldName = db_column_text(&q, 1); |
| 132 | 132 | haveTicketChng = 1; |
| 133 | - if( memcmp(zFieldName,"tkt_",4)==0 ){ | |
| 133 | + if( strncmp(zFieldName,"tkt_",4)==0 ){ | |
| 134 | 134 | if( strcmp(zFieldName+4,"rid")==0 ){ |
| 135 | 135 | haveTicketChngRid = 1; /* tkt_rid */ |
| 136 | 136 | }else if( strcmp(zFieldName+4,"user")==0 ){ |
| 137 | 137 | haveTicketChngUser = 1; /* tkt_user */ |
| 138 | 138 | } |
| @@ -211,11 +211,11 @@ | ||
| 211 | 211 | }else if( strncmp(zName, "private_", 8)==0 ){ |
| 212 | 212 | zVal = zRevealed = db_reveal(zVal); |
| 213 | 213 | } |
| 214 | 214 | if( (j = fieldId(zName))>=0 ){ |
| 215 | 215 | aField[j].zValue = fossil_strdup(zVal); |
| 216 | - }else if( memcmp(zName, "tkt_", 4)==0 && Th_Fetch(zName, &size)==0 ){ | |
| 216 | + }else if( strncmp(zName, "tkt_", 4)==0 && Th_Fetch(zName, &size)==0 ){ | |
| 217 | 217 | /* TICKET table columns that begin with "tkt_" are always safe */ |
| 218 | 218 | Th_Store(zName, zVal); |
| 219 | 219 | } |
| 220 | 220 | free(zRevealed); |
| 221 | 221 | } |
| @@ -843,11 +843,11 @@ | ||
| 843 | 843 | if( g.thTrace ){ |
| 844 | 844 | Th_Trace("append_field %#h {%#h}<br>\n", |
| 845 | 845 | TH1_LEN(argl[1]), argv[1], TH1_LEN(argl[2]), argv[2]); |
| 846 | 846 | } |
| 847 | 847 | for(idx=0; idx<nField; idx++){ |
| 848 | - if( memcmp(aField[idx].zName, argv[1], TH1_LEN(argl[1]))==0 | |
| 848 | + if( strncmp(aField[idx].zName, argv[1], TH1_LEN(argl[1]))==0 | |
| 849 | 849 | && aField[idx].zName[TH1_LEN(argl[1])]==0 ){ |
| 850 | 850 | break; |
| 851 | 851 | } |
| 852 | 852 | } |
| 853 | 853 | if( idx>=nField ){ |
| @@ -963,14 +963,14 @@ | ||
| 963 | 963 | zValue = Th_Fetch(aField[i].zName, &nValue); |
| 964 | 964 | if( zValue ){ |
| 965 | 965 | nValue = TH1_LEN(nValue); |
| 966 | 966 | while( nValue>0 && fossil_isspace(zValue[nValue-1]) ){ nValue--; } |
| 967 | 967 | if( ((aField[i].mUsed & USEDBY_TICKETCHNG)!=0 && nValue>0) |
| 968 | - || memcmp(zValue, aField[i].zValue, nValue)!=0 | |
| 969 | 968 | ||(int)strlen(aField[i].zValue)!=nValue |
| 969 | + || memcmp(zValue, aField[i].zValue, nValue)!=0 | |
| 970 | 970 | ){ |
| 971 | - if( memcmp(aField[i].zName, "private_", 8)==0 ){ | |
| 971 | + if( strncmp(aField[i].zName, "private_", 8)==0 ){ | |
| 972 | 972 | zValue = db_conceal(zValue, nValue); |
| 973 | 973 | blob_appendf(&tktchng, "J %s %s\n", aField[i].zName, zValue); |
| 974 | 974 | aUsed[i] = JCARD_PRIVATE; |
| 975 | 975 | }else{ |
| 976 | 976 | blob_appendf(&tktchng, "J %s %#F\n", aField[i].zName, nValue, zValue); |
| @@ -1857,11 +1857,11 @@ | ||
| 1857 | 1857 | zValue = aField[iF].zValue; |
| 1858 | 1858 | aUsed[iF] = JCARD_ASSIGN; |
| 1859 | 1859 | }else{ |
| 1860 | 1860 | continue; |
| 1861 | 1861 | } |
| 1862 | - if( memcmp(aField[iF].zName, "private_", 8)==0 ){ | |
| 1862 | + if( strncmp(aField[i].zName, "private_", 8)==0 ){ | |
| 1863 | 1863 | zValue = db_conceal(zValue, strlen(zValue)); |
| 1864 | 1864 | blob_appendf(&tktchng, "J%s%s %s\n", zPfx, aField[iF].zName, zValue); |
| 1865 | 1865 | aUsed[iF] = JCARD_PRIVATE; |
| 1866 | 1866 | }else{ |
| 1867 | 1867 | blob_appendf(&tktchng, "J%s%s %#F\n", zPfx, |
| 1868 | 1868 |
| --- src/tkt.c | |
| +++ src/tkt.c | |
| @@ -87,15 +87,15 @@ | |
| 87 | nBaselines = 0; |
| 88 | db_prepare(&q, "PRAGMA table_info(ticket)"); |
| 89 | while( db_step(&q)==SQLITE_ROW ){ |
| 90 | const char *zFieldName = db_column_text(&q, 1); |
| 91 | haveTicket = 1; |
| 92 | if( memcmp(zFieldName,"tkt_",4)==0 ){ |
| 93 | if( strcmp(zFieldName, "tkt_ctime")==0 ) haveTicketCTime = 1; |
| 94 | continue; |
| 95 | } |
| 96 | if( memcmp(zFieldName,"baseline for ",13)==0 ){ |
| 97 | if( strcmp(db_column_text(&q,2),"INTEGER")==0 ){ |
| 98 | nBaselines++; |
| 99 | } |
| 100 | continue; |
| 101 | } |
| @@ -128,11 +128,11 @@ | |
| 128 | } |
| 129 | db_prepare(&q, "PRAGMA table_info(ticketchng)"); |
| 130 | while( db_step(&q)==SQLITE_ROW ){ |
| 131 | const char *zFieldName = db_column_text(&q, 1); |
| 132 | haveTicketChng = 1; |
| 133 | if( memcmp(zFieldName,"tkt_",4)==0 ){ |
| 134 | if( strcmp(zFieldName+4,"rid")==0 ){ |
| 135 | haveTicketChngRid = 1; /* tkt_rid */ |
| 136 | }else if( strcmp(zFieldName+4,"user")==0 ){ |
| 137 | haveTicketChngUser = 1; /* tkt_user */ |
| 138 | } |
| @@ -211,11 +211,11 @@ | |
| 211 | }else if( strncmp(zName, "private_", 8)==0 ){ |
| 212 | zVal = zRevealed = db_reveal(zVal); |
| 213 | } |
| 214 | if( (j = fieldId(zName))>=0 ){ |
| 215 | aField[j].zValue = fossil_strdup(zVal); |
| 216 | }else if( memcmp(zName, "tkt_", 4)==0 && Th_Fetch(zName, &size)==0 ){ |
| 217 | /* TICKET table columns that begin with "tkt_" are always safe */ |
| 218 | Th_Store(zName, zVal); |
| 219 | } |
| 220 | free(zRevealed); |
| 221 | } |
| @@ -843,11 +843,11 @@ | |
| 843 | if( g.thTrace ){ |
| 844 | Th_Trace("append_field %#h {%#h}<br>\n", |
| 845 | TH1_LEN(argl[1]), argv[1], TH1_LEN(argl[2]), argv[2]); |
| 846 | } |
| 847 | for(idx=0; idx<nField; idx++){ |
| 848 | if( memcmp(aField[idx].zName, argv[1], TH1_LEN(argl[1]))==0 |
| 849 | && aField[idx].zName[TH1_LEN(argl[1])]==0 ){ |
| 850 | break; |
| 851 | } |
| 852 | } |
| 853 | if( idx>=nField ){ |
| @@ -963,14 +963,14 @@ | |
| 963 | zValue = Th_Fetch(aField[i].zName, &nValue); |
| 964 | if( zValue ){ |
| 965 | nValue = TH1_LEN(nValue); |
| 966 | while( nValue>0 && fossil_isspace(zValue[nValue-1]) ){ nValue--; } |
| 967 | if( ((aField[i].mUsed & USEDBY_TICKETCHNG)!=0 && nValue>0) |
| 968 | || memcmp(zValue, aField[i].zValue, nValue)!=0 |
| 969 | ||(int)strlen(aField[i].zValue)!=nValue |
| 970 | ){ |
| 971 | if( memcmp(aField[i].zName, "private_", 8)==0 ){ |
| 972 | zValue = db_conceal(zValue, nValue); |
| 973 | blob_appendf(&tktchng, "J %s %s\n", aField[i].zName, zValue); |
| 974 | aUsed[i] = JCARD_PRIVATE; |
| 975 | }else{ |
| 976 | blob_appendf(&tktchng, "J %s %#F\n", aField[i].zName, nValue, zValue); |
| @@ -1857,11 +1857,11 @@ | |
| 1857 | zValue = aField[iF].zValue; |
| 1858 | aUsed[iF] = JCARD_ASSIGN; |
| 1859 | }else{ |
| 1860 | continue; |
| 1861 | } |
| 1862 | if( memcmp(aField[iF].zName, "private_", 8)==0 ){ |
| 1863 | zValue = db_conceal(zValue, strlen(zValue)); |
| 1864 | blob_appendf(&tktchng, "J%s%s %s\n", zPfx, aField[iF].zName, zValue); |
| 1865 | aUsed[iF] = JCARD_PRIVATE; |
| 1866 | }else{ |
| 1867 | blob_appendf(&tktchng, "J%s%s %#F\n", zPfx, |
| 1868 |
| --- src/tkt.c | |
| +++ src/tkt.c | |
| @@ -87,15 +87,15 @@ | |
| 87 | nBaselines = 0; |
| 88 | db_prepare(&q, "PRAGMA table_info(ticket)"); |
| 89 | while( db_step(&q)==SQLITE_ROW ){ |
| 90 | const char *zFieldName = db_column_text(&q, 1); |
| 91 | haveTicket = 1; |
| 92 | if( strncmp(zFieldName,"tkt_",4)==0 ){ |
| 93 | if( strcmp(zFieldName, "tkt_ctime")==0 ) haveTicketCTime = 1; |
| 94 | continue; |
| 95 | } |
| 96 | if( strncmp(zFieldName,"baseline for ",13)==0 ){ |
| 97 | if( strcmp(db_column_text(&q,2),"INTEGER")==0 ){ |
| 98 | nBaselines++; |
| 99 | } |
| 100 | continue; |
| 101 | } |
| @@ -128,11 +128,11 @@ | |
| 128 | } |
| 129 | db_prepare(&q, "PRAGMA table_info(ticketchng)"); |
| 130 | while( db_step(&q)==SQLITE_ROW ){ |
| 131 | const char *zFieldName = db_column_text(&q, 1); |
| 132 | haveTicketChng = 1; |
| 133 | if( strncmp(zFieldName,"tkt_",4)==0 ){ |
| 134 | if( strcmp(zFieldName+4,"rid")==0 ){ |
| 135 | haveTicketChngRid = 1; /* tkt_rid */ |
| 136 | }else if( strcmp(zFieldName+4,"user")==0 ){ |
| 137 | haveTicketChngUser = 1; /* tkt_user */ |
| 138 | } |
| @@ -211,11 +211,11 @@ | |
| 211 | }else if( strncmp(zName, "private_", 8)==0 ){ |
| 212 | zVal = zRevealed = db_reveal(zVal); |
| 213 | } |
| 214 | if( (j = fieldId(zName))>=0 ){ |
| 215 | aField[j].zValue = fossil_strdup(zVal); |
| 216 | }else if( strncmp(zName, "tkt_", 4)==0 && Th_Fetch(zName, &size)==0 ){ |
| 217 | /* TICKET table columns that begin with "tkt_" are always safe */ |
| 218 | Th_Store(zName, zVal); |
| 219 | } |
| 220 | free(zRevealed); |
| 221 | } |
| @@ -843,11 +843,11 @@ | |
| 843 | if( g.thTrace ){ |
| 844 | Th_Trace("append_field %#h {%#h}<br>\n", |
| 845 | TH1_LEN(argl[1]), argv[1], TH1_LEN(argl[2]), argv[2]); |
| 846 | } |
| 847 | for(idx=0; idx<nField; idx++){ |
| 848 | if( strncmp(aField[idx].zName, argv[1], TH1_LEN(argl[1]))==0 |
| 849 | && aField[idx].zName[TH1_LEN(argl[1])]==0 ){ |
| 850 | break; |
| 851 | } |
| 852 | } |
| 853 | if( idx>=nField ){ |
| @@ -963,14 +963,14 @@ | |
| 963 | zValue = Th_Fetch(aField[i].zName, &nValue); |
| 964 | if( zValue ){ |
| 965 | nValue = TH1_LEN(nValue); |
| 966 | while( nValue>0 && fossil_isspace(zValue[nValue-1]) ){ nValue--; } |
| 967 | if( ((aField[i].mUsed & USEDBY_TICKETCHNG)!=0 && nValue>0) |
| 968 | ||(int)strlen(aField[i].zValue)!=nValue |
| 969 | || memcmp(zValue, aField[i].zValue, nValue)!=0 |
| 970 | ){ |
| 971 | if( strncmp(aField[i].zName, "private_", 8)==0 ){ |
| 972 | zValue = db_conceal(zValue, nValue); |
| 973 | blob_appendf(&tktchng, "J %s %s\n", aField[i].zName, zValue); |
| 974 | aUsed[i] = JCARD_PRIVATE; |
| 975 | }else{ |
| 976 | blob_appendf(&tktchng, "J %s %#F\n", aField[i].zName, nValue, zValue); |
| @@ -1857,11 +1857,11 @@ | |
| 1857 | zValue = aField[iF].zValue; |
| 1858 | aUsed[iF] = JCARD_ASSIGN; |
| 1859 | }else{ |
| 1860 | continue; |
| 1861 | } |
| 1862 | if( strncmp(aField[i].zName, "private_", 8)==0 ){ |
| 1863 | zValue = db_conceal(zValue, strlen(zValue)); |
| 1864 | blob_appendf(&tktchng, "J%s%s %s\n", zPfx, aField[iF].zName, zValue); |
| 1865 | aUsed[iF] = JCARD_PRIVATE; |
| 1866 | }else{ |
| 1867 | blob_appendf(&tktchng, "J%s%s %#F\n", zPfx, |
| 1868 |
+1
| --- src/user.c | ||
| +++ src/user.c | ||
| @@ -227,10 +227,11 @@ | ||
| 227 | 227 | if( z ) userDescramble(z); |
| 228 | 228 | printf("\033[3A\033[J"); /* Erase previous three lines */ |
| 229 | 229 | fflush(stdout); |
| 230 | 230 | }else{ |
| 231 | 231 | z = getpass(zPrompt); |
| 232 | + if( z==0 ) fossil_fatal("unable to read a password"); | |
| 232 | 233 | } |
| 233 | 234 | strip_string(pPassphrase, z); |
| 234 | 235 | } |
| 235 | 236 | |
| 236 | 237 | /* |
| 237 | 238 |
| --- src/user.c | |
| +++ src/user.c | |
| @@ -227,10 +227,11 @@ | |
| 227 | if( z ) userDescramble(z); |
| 228 | printf("\033[3A\033[J"); /* Erase previous three lines */ |
| 229 | fflush(stdout); |
| 230 | }else{ |
| 231 | z = getpass(zPrompt); |
| 232 | } |
| 233 | strip_string(pPassphrase, z); |
| 234 | } |
| 235 | |
| 236 | /* |
| 237 |
| --- src/user.c | |
| +++ src/user.c | |
| @@ -227,10 +227,11 @@ | |
| 227 | if( z ) userDescramble(z); |
| 228 | printf("\033[3A\033[J"); /* Erase previous three lines */ |
| 229 | fflush(stdout); |
| 230 | }else{ |
| 231 | z = getpass(zPrompt); |
| 232 | if( z==0 ) fossil_fatal("unable to read a password"); |
| 233 | } |
| 234 | strip_string(pPassphrase, z); |
| 235 | } |
| 236 | |
| 237 | /* |
| 238 |
+47
-9
| --- src/xfer.c | ||
| +++ src/xfer.c | ||
| @@ -155,11 +155,18 @@ | ||
| 155 | 155 | ){ |
| 156 | 156 | blob_appendf(&pXfer->err, "malformed file line"); |
| 157 | 157 | return; |
| 158 | 158 | } |
| 159 | 159 | blob_zero(&content); |
| 160 | - blob_extract(pXfer->pIn, n, &content); | |
| 160 | + if( blob_extract(pXfer->pIn, n, &content)!=n ){ | |
| 161 | + /* The message ends before the content does. What there is must not | |
| 162 | + ** be stored: if it is a delta whose source has not arrived, nothing | |
| 163 | + ** would ever check it. */ | |
| 164 | + blob_appendf(&pXfer->err, "truncated file card"); | |
| 165 | + blob_reset(&content); | |
| 166 | + return; | |
| 167 | + } | |
| 161 | 168 | pUuid = &pXfer->aToken[1]; |
| 162 | 169 | if( !cloneFlag && uuid_is_shunned(blob_str(pUuid)) ){ |
| 163 | 170 | /* Ignore files that have been shunned */ |
| 164 | 171 | blob_reset(&content); |
| 165 | 172 | return; |
| @@ -277,11 +284,15 @@ | ||
| 277 | 284 | if( isPriv && !g.perm.Private ){ |
| 278 | 285 | /* Do not accept private files if not authorized */ |
| 279 | 286 | return; |
| 280 | 287 | } |
| 281 | 288 | blob_zero(&content); |
| 282 | - blob_extract(pXfer->pIn, szC, &content); | |
| 289 | + if( blob_extract(pXfer->pIn, szC, &content)!=szC ){ | |
| 290 | + blob_appendf(&pXfer->err, "truncated cfile card"); | |
| 291 | + blob_reset(&content); | |
| 292 | + return; | |
| 293 | + } | |
| 283 | 294 | if( uuid_is_shunned(blob_str(&pXfer->aToken[1])) ){ |
| 284 | 295 | /* Ignore files that have been shunned */ |
| 285 | 296 | blob_reset(&content); |
| 286 | 297 | return; |
| 287 | 298 | } |
| @@ -597,11 +608,17 @@ | ||
| 597 | 608 | if( size ){ |
| 598 | 609 | pXfer->nDeltaSent++; |
| 599 | 610 | } |
| 600 | 611 | } |
| 601 | 612 | if( size==0 ){ |
| 602 | - content_get(rid, &content); | |
| 613 | + if( content_get(rid, &content)==0 ){ | |
| 614 | + /* A delta whose source has not arrived yet. The content cannot | |
| 615 | + ** be rebuilt, so there is nothing that can be sent. */ | |
| 616 | + blob_reset(&content); | |
| 617 | + blob_reset(&uuid); | |
| 618 | + return; | |
| 619 | + } | |
| 603 | 620 | |
| 604 | 621 | if( !nativeDelta && blob_size(&content)>100 ){ |
| 605 | 622 | size = send_delta_parent(pXfer, rid, isPriv, &content, pUuid); |
| 606 | 623 | } |
| 607 | 624 | if( size==0 ){ |
| @@ -699,19 +716,26 @@ | ||
| 699 | 716 | ** |
| 700 | 717 | ** uvfile NAME MTIME HASH SIZE FLAGS \n CONTENT |
| 701 | 718 | ** |
| 702 | 719 | ** If the noContent flag is set, omit the CONTENT and set the 0x0004 |
| 703 | 720 | ** flag in FLAGS. |
| 721 | +** | |
| 722 | +** A server that has already reached its send size limit sends a short | |
| 723 | +** "uvigot" card in place of the file, and the client asks again. A | |
| 724 | +** client must not do that, because a server does not accept "uvigot". | |
| 725 | +** So the client sets isClient and always gets a "uvfile" card. | |
| 704 | 726 | */ |
| 705 | 727 | static void send_unversioned_file( |
| 706 | 728 | Xfer *pXfer, /* Transfer context */ |
| 707 | 729 | const char *zName, /* Name of unversioned file to be sent */ |
| 708 | - int noContent /* True to omit the content */ | |
| 730 | + int noContent, /* True to omit the content */ | |
| 731 | + int isClient /* True if sending from client to server */ | |
| 709 | 732 | ){ |
| 710 | 733 | Stmt q1; |
| 734 | + int isFull = !isClient && (int)blob_size(pXfer->pOut)>=pXfer->mxSend; | |
| 711 | 735 | |
| 712 | - if( (int)blob_size(pXfer->pOut)>=pXfer->mxSend ) noContent = 1; | |
| 736 | + if( isFull ) noContent = 1; | |
| 713 | 737 | if( noContent ){ |
| 714 | 738 | db_prepare(&q1, |
| 715 | 739 | "SELECT mtime, hash, encoding, sz FROM unversioned WHERE name=%Q", |
| 716 | 740 | zName |
| 717 | 741 | ); |
| @@ -728,11 +752,11 @@ | ||
| 728 | 752 | if( pXfer->remoteVersion<20000 && db_column_bytes(&q1,1)>HNAME_LEN_SHA1 ){ |
| 729 | 753 | xfer_cannot_send_sha3_error(pXfer); |
| 730 | 754 | db_reset(&q1); |
| 731 | 755 | return; |
| 732 | 756 | } |
| 733 | - if( (int)blob_size(pXfer->pOut)>=pXfer->mxSend ){ | |
| 757 | + if( isFull ){ | |
| 734 | 758 | /* If we have already reached the send size limit, send a (short) |
| 735 | 759 | ** uvigot card rather than a uvfile card. This only happens on the |
| 736 | 760 | ** server side. The uvigot card will provoke the client to resend |
| 737 | 761 | ** another uvgimme on the next cycle. */ |
| 738 | 762 | blob_appendf(pXfer->pOut, "uvigot %s %lld %s %d\n", |
| @@ -1436,11 +1460,11 @@ | ||
| 1436 | 1460 | if( blob_eq(&xfer.aToken[0], "uvgimme") |
| 1437 | 1461 | && xfer.nToken==2 |
| 1438 | 1462 | && blob_is_filename(&xfer.aToken[1]) |
| 1439 | 1463 | ){ |
| 1440 | 1464 | if( g.perm.Read ){ |
| 1441 | - send_unversioned_file(&xfer, blob_str(&xfer.aToken[1]), 0); | |
| 1465 | + send_unversioned_file(&xfer, blob_str(&xfer.aToken[1]), 0, 0); | |
| 1442 | 1466 | } |
| 1443 | 1467 | }else |
| 1444 | 1468 | |
| 1445 | 1469 | /* igot HASH ?ISPRIVATE? |
| 1446 | 1470 | ** |
| @@ -2019,10 +2043,12 @@ | ||
| 2019 | 2043 | } |
| 2020 | 2044 | if( zHost==0 ) zHost = "localhost:8080"; |
| 2021 | 2045 | g.zBaseURL = mprintf("http://%s", zHost); |
| 2022 | 2046 | g.zHttpsURL = mprintf("https://%s", zHost); |
| 2023 | 2047 | g.zTop = mprintf(""); |
| 2048 | + g.zPath = "xfer"; /* So that robot_restrict() sees this as a sync request */ | |
| 2049 | + g.zContentType = "application/x-fossil-uncompressed"; | |
| 2024 | 2050 | blob_zero(&g.cgiIn); |
| 2025 | 2051 | blob_read_from_file(&g.cgiIn, g.argc==2 ? "-" : g.argv[2], ExtFILE); |
| 2026 | 2052 | disableLogin = 1; |
| 2027 | 2053 | page_xfer(); |
| 2028 | 2054 | fossil_print("%s", cgi_extract_content()); |
| @@ -2367,11 +2393,11 @@ | ||
| 2367 | 2393 | Stmt uvq; |
| 2368 | 2394 | int rc = SQLITE_OK; |
| 2369 | 2395 | db_prepare(&uvq, "SELECT name, mtimeOnly FROM uv_tosend"); |
| 2370 | 2396 | while( (rc = db_step(&uvq))==SQLITE_ROW ){ |
| 2371 | 2397 | const char *zName = db_column_text(&uvq, 0); |
| 2372 | - send_unversioned_file(&xfer, zName, db_column_int(&uvq,1)); | |
| 2398 | + send_unversioned_file(&xfer, zName, db_column_int(&uvq,1), 1); | |
| 2373 | 2399 | nCardSent++; |
| 2374 | 2400 | nArtifactSent++; |
| 2375 | 2401 | db_multi_exec("DELETE FROM uv_tosend WHERE name=%Q", zName); |
| 2376 | 2402 | if( syncFlags & SYNC_VERBOSE ){ |
| 2377 | 2403 | fossil_print("\rUnversioned-file sent: %s\n", zName); |
| @@ -2429,10 +2455,22 @@ | ||
| 2429 | 2455 | if( http_exchange(&send, &recv, mHttpFlags, MAX_REDIRECTS, 0) ){ |
| 2430 | 2456 | nErr++; |
| 2431 | 2457 | go = 2; |
| 2432 | 2458 | break; |
| 2433 | 2459 | } |
| 2460 | + | |
| 2461 | + /* Every reply from a Fossil server holds at least one card: the | |
| 2462 | + ** "# timestamp" line that ends a normal reply, or an "error" card. | |
| 2463 | + ** A reply with no content at all means that the request never reached | |
| 2464 | + ** a Fossil server, or that the reply was lost on the way back. Either | |
| 2465 | + ** way the round-trip failed. */ | |
| 2466 | + if( blob_size(&recv)==0 ){ | |
| 2467 | + fossil_warning("server sent an empty reply"); | |
| 2468 | + nErr++; | |
| 2469 | + go = 2; | |
| 2470 | + break; | |
| 2471 | + } | |
| 2434 | 2472 | |
| 2435 | 2473 | /* Remember the URL of the sync target in the config file on the |
| 2436 | 2474 | ** first successful round-trip */ |
| 2437 | 2475 | if( nCycle==0 && db_is_writeable("repository") ){ |
| 2438 | 2476 | xfer_syncwith(g.url.canonical, 0); |
| @@ -2494,11 +2532,11 @@ | ||
| 2494 | 2532 | |
| 2495 | 2533 | /* Process the reply that came back from the server */ |
| 2496 | 2534 | while( blob_line(&recv, &xfer.line) ){ |
| 2497 | 2535 | if( blob_buffer(&xfer.line)[0]=='#' ){ |
| 2498 | 2536 | const char *zLine = blob_buffer(&xfer.line); |
| 2499 | - if( memcmp(zLine, "# timestamp ", 12)==0 ){ | |
| 2537 | + if( strncmp(zLine, "# timestamp ", 12)==0 ){ | |
| 2500 | 2538 | char zTime[20]; |
| 2501 | 2539 | double rDiff; |
| 2502 | 2540 | sqlite3_snprintf(sizeof(zTime), zTime, "%.19s", &zLine[12]); |
| 2503 | 2541 | rDiff = db_double(9e99, "SELECT julianday('%q') - %.17g", |
| 2504 | 2542 | zTime, rArrivalTime); |
| 2505 | 2543 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -155,11 +155,18 @@ | |
| 155 | ){ |
| 156 | blob_appendf(&pXfer->err, "malformed file line"); |
| 157 | return; |
| 158 | } |
| 159 | blob_zero(&content); |
| 160 | blob_extract(pXfer->pIn, n, &content); |
| 161 | pUuid = &pXfer->aToken[1]; |
| 162 | if( !cloneFlag && uuid_is_shunned(blob_str(pUuid)) ){ |
| 163 | /* Ignore files that have been shunned */ |
| 164 | blob_reset(&content); |
| 165 | return; |
| @@ -277,11 +284,15 @@ | |
| 277 | if( isPriv && !g.perm.Private ){ |
| 278 | /* Do not accept private files if not authorized */ |
| 279 | return; |
| 280 | } |
| 281 | blob_zero(&content); |
| 282 | blob_extract(pXfer->pIn, szC, &content); |
| 283 | if( uuid_is_shunned(blob_str(&pXfer->aToken[1])) ){ |
| 284 | /* Ignore files that have been shunned */ |
| 285 | blob_reset(&content); |
| 286 | return; |
| 287 | } |
| @@ -597,11 +608,17 @@ | |
| 597 | if( size ){ |
| 598 | pXfer->nDeltaSent++; |
| 599 | } |
| 600 | } |
| 601 | if( size==0 ){ |
| 602 | content_get(rid, &content); |
| 603 | |
| 604 | if( !nativeDelta && blob_size(&content)>100 ){ |
| 605 | size = send_delta_parent(pXfer, rid, isPriv, &content, pUuid); |
| 606 | } |
| 607 | if( size==0 ){ |
| @@ -699,19 +716,26 @@ | |
| 699 | ** |
| 700 | ** uvfile NAME MTIME HASH SIZE FLAGS \n CONTENT |
| 701 | ** |
| 702 | ** If the noContent flag is set, omit the CONTENT and set the 0x0004 |
| 703 | ** flag in FLAGS. |
| 704 | */ |
| 705 | static void send_unversioned_file( |
| 706 | Xfer *pXfer, /* Transfer context */ |
| 707 | const char *zName, /* Name of unversioned file to be sent */ |
| 708 | int noContent /* True to omit the content */ |
| 709 | ){ |
| 710 | Stmt q1; |
| 711 | |
| 712 | if( (int)blob_size(pXfer->pOut)>=pXfer->mxSend ) noContent = 1; |
| 713 | if( noContent ){ |
| 714 | db_prepare(&q1, |
| 715 | "SELECT mtime, hash, encoding, sz FROM unversioned WHERE name=%Q", |
| 716 | zName |
| 717 | ); |
| @@ -728,11 +752,11 @@ | |
| 728 | if( pXfer->remoteVersion<20000 && db_column_bytes(&q1,1)>HNAME_LEN_SHA1 ){ |
| 729 | xfer_cannot_send_sha3_error(pXfer); |
| 730 | db_reset(&q1); |
| 731 | return; |
| 732 | } |
| 733 | if( (int)blob_size(pXfer->pOut)>=pXfer->mxSend ){ |
| 734 | /* If we have already reached the send size limit, send a (short) |
| 735 | ** uvigot card rather than a uvfile card. This only happens on the |
| 736 | ** server side. The uvigot card will provoke the client to resend |
| 737 | ** another uvgimme on the next cycle. */ |
| 738 | blob_appendf(pXfer->pOut, "uvigot %s %lld %s %d\n", |
| @@ -1436,11 +1460,11 @@ | |
| 1436 | if( blob_eq(&xfer.aToken[0], "uvgimme") |
| 1437 | && xfer.nToken==2 |
| 1438 | && blob_is_filename(&xfer.aToken[1]) |
| 1439 | ){ |
| 1440 | if( g.perm.Read ){ |
| 1441 | send_unversioned_file(&xfer, blob_str(&xfer.aToken[1]), 0); |
| 1442 | } |
| 1443 | }else |
| 1444 | |
| 1445 | /* igot HASH ?ISPRIVATE? |
| 1446 | ** |
| @@ -2019,10 +2043,12 @@ | |
| 2019 | } |
| 2020 | if( zHost==0 ) zHost = "localhost:8080"; |
| 2021 | g.zBaseURL = mprintf("http://%s", zHost); |
| 2022 | g.zHttpsURL = mprintf("https://%s", zHost); |
| 2023 | g.zTop = mprintf(""); |
| 2024 | blob_zero(&g.cgiIn); |
| 2025 | blob_read_from_file(&g.cgiIn, g.argc==2 ? "-" : g.argv[2], ExtFILE); |
| 2026 | disableLogin = 1; |
| 2027 | page_xfer(); |
| 2028 | fossil_print("%s", cgi_extract_content()); |
| @@ -2367,11 +2393,11 @@ | |
| 2367 | Stmt uvq; |
| 2368 | int rc = SQLITE_OK; |
| 2369 | db_prepare(&uvq, "SELECT name, mtimeOnly FROM uv_tosend"); |
| 2370 | while( (rc = db_step(&uvq))==SQLITE_ROW ){ |
| 2371 | const char *zName = db_column_text(&uvq, 0); |
| 2372 | send_unversioned_file(&xfer, zName, db_column_int(&uvq,1)); |
| 2373 | nCardSent++; |
| 2374 | nArtifactSent++; |
| 2375 | db_multi_exec("DELETE FROM uv_tosend WHERE name=%Q", zName); |
| 2376 | if( syncFlags & SYNC_VERBOSE ){ |
| 2377 | fossil_print("\rUnversioned-file sent: %s\n", zName); |
| @@ -2429,10 +2455,22 @@ | |
| 2429 | if( http_exchange(&send, &recv, mHttpFlags, MAX_REDIRECTS, 0) ){ |
| 2430 | nErr++; |
| 2431 | go = 2; |
| 2432 | break; |
| 2433 | } |
| 2434 | |
| 2435 | /* Remember the URL of the sync target in the config file on the |
| 2436 | ** first successful round-trip */ |
| 2437 | if( nCycle==0 && db_is_writeable("repository") ){ |
| 2438 | xfer_syncwith(g.url.canonical, 0); |
| @@ -2494,11 +2532,11 @@ | |
| 2494 | |
| 2495 | /* Process the reply that came back from the server */ |
| 2496 | while( blob_line(&recv, &xfer.line) ){ |
| 2497 | if( blob_buffer(&xfer.line)[0]=='#' ){ |
| 2498 | const char *zLine = blob_buffer(&xfer.line); |
| 2499 | if( memcmp(zLine, "# timestamp ", 12)==0 ){ |
| 2500 | char zTime[20]; |
| 2501 | double rDiff; |
| 2502 | sqlite3_snprintf(sizeof(zTime), zTime, "%.19s", &zLine[12]); |
| 2503 | rDiff = db_double(9e99, "SELECT julianday('%q') - %.17g", |
| 2504 | zTime, rArrivalTime); |
| 2505 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -155,11 +155,18 @@ | |
| 155 | ){ |
| 156 | blob_appendf(&pXfer->err, "malformed file line"); |
| 157 | return; |
| 158 | } |
| 159 | blob_zero(&content); |
| 160 | if( blob_extract(pXfer->pIn, n, &content)!=n ){ |
| 161 | /* The message ends before the content does. What there is must not |
| 162 | ** be stored: if it is a delta whose source has not arrived, nothing |
| 163 | ** would ever check it. */ |
| 164 | blob_appendf(&pXfer->err, "truncated file card"); |
| 165 | blob_reset(&content); |
| 166 | return; |
| 167 | } |
| 168 | pUuid = &pXfer->aToken[1]; |
| 169 | if( !cloneFlag && uuid_is_shunned(blob_str(pUuid)) ){ |
| 170 | /* Ignore files that have been shunned */ |
| 171 | blob_reset(&content); |
| 172 | return; |
| @@ -277,11 +284,15 @@ | |
| 284 | if( isPriv && !g.perm.Private ){ |
| 285 | /* Do not accept private files if not authorized */ |
| 286 | return; |
| 287 | } |
| 288 | blob_zero(&content); |
| 289 | if( blob_extract(pXfer->pIn, szC, &content)!=szC ){ |
| 290 | blob_appendf(&pXfer->err, "truncated cfile card"); |
| 291 | blob_reset(&content); |
| 292 | return; |
| 293 | } |
| 294 | if( uuid_is_shunned(blob_str(&pXfer->aToken[1])) ){ |
| 295 | /* Ignore files that have been shunned */ |
| 296 | blob_reset(&content); |
| 297 | return; |
| 298 | } |
| @@ -597,11 +608,17 @@ | |
| 608 | if( size ){ |
| 609 | pXfer->nDeltaSent++; |
| 610 | } |
| 611 | } |
| 612 | if( size==0 ){ |
| 613 | if( content_get(rid, &content)==0 ){ |
| 614 | /* A delta whose source has not arrived yet. The content cannot |
| 615 | ** be rebuilt, so there is nothing that can be sent. */ |
| 616 | blob_reset(&content); |
| 617 | blob_reset(&uuid); |
| 618 | return; |
| 619 | } |
| 620 | |
| 621 | if( !nativeDelta && blob_size(&content)>100 ){ |
| 622 | size = send_delta_parent(pXfer, rid, isPriv, &content, pUuid); |
| 623 | } |
| 624 | if( size==0 ){ |
| @@ -699,19 +716,26 @@ | |
| 716 | ** |
| 717 | ** uvfile NAME MTIME HASH SIZE FLAGS \n CONTENT |
| 718 | ** |
| 719 | ** If the noContent flag is set, omit the CONTENT and set the 0x0004 |
| 720 | ** flag in FLAGS. |
| 721 | ** |
| 722 | ** A server that has already reached its send size limit sends a short |
| 723 | ** "uvigot" card in place of the file, and the client asks again. A |
| 724 | ** client must not do that, because a server does not accept "uvigot". |
| 725 | ** So the client sets isClient and always gets a "uvfile" card. |
| 726 | */ |
| 727 | static void send_unversioned_file( |
| 728 | Xfer *pXfer, /* Transfer context */ |
| 729 | const char *zName, /* Name of unversioned file to be sent */ |
| 730 | int noContent, /* True to omit the content */ |
| 731 | int isClient /* True if sending from client to server */ |
| 732 | ){ |
| 733 | Stmt q1; |
| 734 | int isFull = !isClient && (int)blob_size(pXfer->pOut)>=pXfer->mxSend; |
| 735 | |
| 736 | if( isFull ) noContent = 1; |
| 737 | if( noContent ){ |
| 738 | db_prepare(&q1, |
| 739 | "SELECT mtime, hash, encoding, sz FROM unversioned WHERE name=%Q", |
| 740 | zName |
| 741 | ); |
| @@ -728,11 +752,11 @@ | |
| 752 | if( pXfer->remoteVersion<20000 && db_column_bytes(&q1,1)>HNAME_LEN_SHA1 ){ |
| 753 | xfer_cannot_send_sha3_error(pXfer); |
| 754 | db_reset(&q1); |
| 755 | return; |
| 756 | } |
| 757 | if( isFull ){ |
| 758 | /* If we have already reached the send size limit, send a (short) |
| 759 | ** uvigot card rather than a uvfile card. This only happens on the |
| 760 | ** server side. The uvigot card will provoke the client to resend |
| 761 | ** another uvgimme on the next cycle. */ |
| 762 | blob_appendf(pXfer->pOut, "uvigot %s %lld %s %d\n", |
| @@ -1436,11 +1460,11 @@ | |
| 1460 | if( blob_eq(&xfer.aToken[0], "uvgimme") |
| 1461 | && xfer.nToken==2 |
| 1462 | && blob_is_filename(&xfer.aToken[1]) |
| 1463 | ){ |
| 1464 | if( g.perm.Read ){ |
| 1465 | send_unversioned_file(&xfer, blob_str(&xfer.aToken[1]), 0, 0); |
| 1466 | } |
| 1467 | }else |
| 1468 | |
| 1469 | /* igot HASH ?ISPRIVATE? |
| 1470 | ** |
| @@ -2019,10 +2043,12 @@ | |
| 2043 | } |
| 2044 | if( zHost==0 ) zHost = "localhost:8080"; |
| 2045 | g.zBaseURL = mprintf("http://%s", zHost); |
| 2046 | g.zHttpsURL = mprintf("https://%s", zHost); |
| 2047 | g.zTop = mprintf(""); |
| 2048 | g.zPath = "xfer"; /* So that robot_restrict() sees this as a sync request */ |
| 2049 | g.zContentType = "application/x-fossil-uncompressed"; |
| 2050 | blob_zero(&g.cgiIn); |
| 2051 | blob_read_from_file(&g.cgiIn, g.argc==2 ? "-" : g.argv[2], ExtFILE); |
| 2052 | disableLogin = 1; |
| 2053 | page_xfer(); |
| 2054 | fossil_print("%s", cgi_extract_content()); |
| @@ -2367,11 +2393,11 @@ | |
| 2393 | Stmt uvq; |
| 2394 | int rc = SQLITE_OK; |
| 2395 | db_prepare(&uvq, "SELECT name, mtimeOnly FROM uv_tosend"); |
| 2396 | while( (rc = db_step(&uvq))==SQLITE_ROW ){ |
| 2397 | const char *zName = db_column_text(&uvq, 0); |
| 2398 | send_unversioned_file(&xfer, zName, db_column_int(&uvq,1), 1); |
| 2399 | nCardSent++; |
| 2400 | nArtifactSent++; |
| 2401 | db_multi_exec("DELETE FROM uv_tosend WHERE name=%Q", zName); |
| 2402 | if( syncFlags & SYNC_VERBOSE ){ |
| 2403 | fossil_print("\rUnversioned-file sent: %s\n", zName); |
| @@ -2429,10 +2455,22 @@ | |
| 2455 | if( http_exchange(&send, &recv, mHttpFlags, MAX_REDIRECTS, 0) ){ |
| 2456 | nErr++; |
| 2457 | go = 2; |
| 2458 | break; |
| 2459 | } |
| 2460 | |
| 2461 | /* Every reply from a Fossil server holds at least one card: the |
| 2462 | ** "# timestamp" line that ends a normal reply, or an "error" card. |
| 2463 | ** A reply with no content at all means that the request never reached |
| 2464 | ** a Fossil server, or that the reply was lost on the way back. Either |
| 2465 | ** way the round-trip failed. */ |
| 2466 | if( blob_size(&recv)==0 ){ |
| 2467 | fossil_warning("server sent an empty reply"); |
| 2468 | nErr++; |
| 2469 | go = 2; |
| 2470 | break; |
| 2471 | } |
| 2472 | |
| 2473 | /* Remember the URL of the sync target in the config file on the |
| 2474 | ** first successful round-trip */ |
| 2475 | if( nCycle==0 && db_is_writeable("repository") ){ |
| 2476 | xfer_syncwith(g.url.canonical, 0); |
| @@ -2494,11 +2532,11 @@ | |
| 2532 | |
| 2533 | /* Process the reply that came back from the server */ |
| 2534 | while( blob_line(&recv, &xfer.line) ){ |
| 2535 | if( blob_buffer(&xfer.line)[0]=='#' ){ |
| 2536 | const char *zLine = blob_buffer(&xfer.line); |
| 2537 | if( strncmp(zLine, "# timestamp ", 12)==0 ){ |
| 2538 | char zTime[20]; |
| 2539 | double rDiff; |
| 2540 | sqlite3_snprintf(sizeof(zTime), zTime, "%.19s", &zLine[12]); |
| 2541 | rDiff = db_double(9e99, "SELECT julianday('%q') - %.17g", |
| 2542 | zTime, rArrivalTime); |
| 2543 |
-3
| --- tools/translate.c | ||
| +++ tools/translate.c | ||
| @@ -110,17 +110,15 @@ | ||
| 110 | 110 | static void trans(FILE *in, FILE *out){ |
| 111 | 111 | int i, j, k; /* Loop counters */ |
| 112 | 112 | char c1, c2; /* Characters used to start a comment */ |
| 113 | 113 | int lastWasEq = 0; /* True if last non-whitespace character was "=" */ |
| 114 | 114 | int lastWasComma = 0; /* True if last non-whitespace character was "," */ |
| 115 | - int lineNo = 0; /* Line number */ | |
| 116 | 115 | char zLine[2000]; /* A single line of input */ |
| 117 | 116 | char zOut[4000]; /* The input line translated into appropriate output */ |
| 118 | 117 | |
| 119 | 118 | c1 = c2 = '-'; |
| 120 | 119 | while( fgets(zLine, sizeof(zLine), in) ){ |
| 121 | - lineNo++; | |
| 122 | 120 | for(i=0; zLine[i] && fossil_isspace(zLine[i]); i++){} |
| 123 | 121 | if( zLine[i]!='@' ){ |
| 124 | 122 | if( inPrint || inStr ) end_block(out); |
| 125 | 123 | fprintf(out,"%s",zLine); |
| 126 | 124 | /* 0123456789 12345 */ |
| @@ -152,11 +150,10 @@ | ||
| 152 | 150 | } |
| 153 | 151 | if( zLine[i]=='\\' && (zLine[i+1]==0 || zLine[i+1]=='\r' |
| 154 | 152 | || zLine[i+1]=='\n') ){ |
| 155 | 153 | zLine[i] = 0; |
| 156 | 154 | zNewline = ""; |
| 157 | - /* fprintf(stderr, "%s:%d: omit newline\n", zInFile, lineNo); */ | |
| 158 | 155 | break; |
| 159 | 156 | } |
| 160 | 157 | if( zLine[i]=='\\' || zLine[i]=='"' ){ zOut[j++] = '\\'; } |
| 161 | 158 | zOut[j++] = zLine[i]; |
| 162 | 159 | } |
| 163 | 160 |
| --- tools/translate.c | |
| +++ tools/translate.c | |
| @@ -110,17 +110,15 @@ | |
| 110 | static void trans(FILE *in, FILE *out){ |
| 111 | int i, j, k; /* Loop counters */ |
| 112 | char c1, c2; /* Characters used to start a comment */ |
| 113 | int lastWasEq = 0; /* True if last non-whitespace character was "=" */ |
| 114 | int lastWasComma = 0; /* True if last non-whitespace character was "," */ |
| 115 | int lineNo = 0; /* Line number */ |
| 116 | char zLine[2000]; /* A single line of input */ |
| 117 | char zOut[4000]; /* The input line translated into appropriate output */ |
| 118 | |
| 119 | c1 = c2 = '-'; |
| 120 | while( fgets(zLine, sizeof(zLine), in) ){ |
| 121 | lineNo++; |
| 122 | for(i=0; zLine[i] && fossil_isspace(zLine[i]); i++){} |
| 123 | if( zLine[i]!='@' ){ |
| 124 | if( inPrint || inStr ) end_block(out); |
| 125 | fprintf(out,"%s",zLine); |
| 126 | /* 0123456789 12345 */ |
| @@ -152,11 +150,10 @@ | |
| 152 | } |
| 153 | if( zLine[i]=='\\' && (zLine[i+1]==0 || zLine[i+1]=='\r' |
| 154 | || zLine[i+1]=='\n') ){ |
| 155 | zLine[i] = 0; |
| 156 | zNewline = ""; |
| 157 | /* fprintf(stderr, "%s:%d: omit newline\n", zInFile, lineNo); */ |
| 158 | break; |
| 159 | } |
| 160 | if( zLine[i]=='\\' || zLine[i]=='"' ){ zOut[j++] = '\\'; } |
| 161 | zOut[j++] = zLine[i]; |
| 162 | } |
| 163 |
| --- tools/translate.c | |
| +++ tools/translate.c | |
| @@ -110,17 +110,15 @@ | |
| 110 | static void trans(FILE *in, FILE *out){ |
| 111 | int i, j, k; /* Loop counters */ |
| 112 | char c1, c2; /* Characters used to start a comment */ |
| 113 | int lastWasEq = 0; /* True if last non-whitespace character was "=" */ |
| 114 | int lastWasComma = 0; /* True if last non-whitespace character was "," */ |
| 115 | char zLine[2000]; /* A single line of input */ |
| 116 | char zOut[4000]; /* The input line translated into appropriate output */ |
| 117 | |
| 118 | c1 = c2 = '-'; |
| 119 | while( fgets(zLine, sizeof(zLine), in) ){ |
| 120 | for(i=0; zLine[i] && fossil_isspace(zLine[i]); i++){} |
| 121 | if( zLine[i]!='@' ){ |
| 122 | if( inPrint || inStr ) end_block(out); |
| 123 | fprintf(out,"%s",zLine); |
| 124 | /* 0123456789 12345 */ |
| @@ -152,11 +150,10 @@ | |
| 150 | } |
| 151 | if( zLine[i]=='\\' && (zLine[i+1]==0 || zLine[i+1]=='\r' |
| 152 | || zLine[i+1]=='\n') ){ |
| 153 | zLine[i] = 0; |
| 154 | zNewline = ""; |
| 155 | break; |
| 156 | } |
| 157 | if( zLine[i]=='\\' || zLine[i]=='"' ){ zOut[j++] = '\\'; } |
| 158 | zOut[j++] = zLine[i]; |
| 159 | } |
| 160 |