Fossil SCM
Merge small-fixes into trunk: fixes for the sync client and server, configuration import and export, artifact checks, and the robot check.
Commit
e38cf10d1267ab8411397a4bbb976e723ca401d670c2e851c922f94f23364b0f
Parent
b500e561aa053ec…
5 files changed
+16
-4
+4
-2
+6
+1
+12
-3
+16
-4
| --- src/configure.c | ||
| +++ src/configure.c | ||
| @@ -828,10 +828,11 @@ | ||
| 828 | 828 | ** |
| 829 | 829 | ** See also: [[settings]], [[unset]] |
| 830 | 830 | */ |
| 831 | 831 | void configuration_cmd(void){ |
| 832 | 832 | int n; |
| 833 | + int nErr = 0; | |
| 833 | 834 | const char *zMethod; |
| 834 | 835 | db_find_and_open_repository(0, 0); |
| 835 | 836 | db_open_config(0, 0); |
| 836 | 837 | if( g.argc<3 ){ |
| 837 | 838 | usage("SUBCOMMAND ..."); |
| @@ -845,11 +846,11 @@ | ||
| 845 | 846 | if( g.argc!=5 ){ |
| 846 | 847 | usage("export AREA FILENAME"); |
| 847 | 848 | } |
| 848 | 849 | mask = configure_name_to_mask(g.argv[3], 1); |
| 849 | 850 | if( zSince ){ |
| 850 | - iStart = db_multi_exec( | |
| 851 | + iStart = db_int64(0, | |
| 851 | 852 | "SELECT coalesce(strftime('%%s',%Q),strftime('%%s','now',%Q))+0", |
| 852 | 853 | zSince, zSince |
| 853 | 854 | ); |
| 854 | 855 | }else{ |
| 855 | 856 | iStart = 0; |
| @@ -897,17 +898,17 @@ | ||
| 897 | 898 | user_select(); |
| 898 | 899 | url_enable_proxy("via proxy: "); |
| 899 | 900 | g.zHttpAuth = get_httpauth(); |
| 900 | 901 | if( overwriteFlag ) mask |= CONFIGSET_OVERWRITE; |
| 901 | 902 | if( strncmp(zMethod, "push", n)==0 ){ |
| 902 | - client_sync(0,0,(unsigned)mask,0,0); | |
| 903 | + nErr = client_sync(0,0,(unsigned)mask,0,0); | |
| 903 | 904 | }else if( strncmp(zMethod, "pull", n)==0 ){ |
| 904 | 905 | if( overwriteFlag ) db_unprotect(PROTECT_USER); |
| 905 | - client_sync(0,(unsigned)mask,0,0,0); | |
| 906 | + nErr = client_sync(0,(unsigned)mask,0,0,0); | |
| 906 | 907 | if( overwriteFlag ) db_protect_pop(); |
| 907 | 908 | }else{ |
| 908 | - client_sync(0,(unsigned)mask,(unsigned)mask,0,0); | |
| 909 | + nErr = client_sync(0,(unsigned)mask,(unsigned)mask,0,0); | |
| 909 | 910 | } |
| 910 | 911 | }else |
| 911 | 912 | if( strncmp(zMethod, "reset", n)==0 ){ |
| 912 | 913 | int mask, i; |
| 913 | 914 | char *zBackup; |
| @@ -944,10 +945,18 @@ | ||
| 944 | 945 | } |
| 945 | 946 | }else if( fossil_strcmp(zName,"@reportfmt")==0 ){ |
| 946 | 947 | db_multi_exec("DELETE FROM reportfmt"); |
| 947 | 948 | assert( strchr(zRepositorySchemaDefaultReports,'%')==0 ); |
| 948 | 949 | db_multi_exec(zRepositorySchemaDefaultReports /*works-like:""*/); |
| 950 | + }else if( fossil_strcmp(zName,"@alias")==0 ){ | |
| 951 | + db_unprotect(PROTECT_CONFIG); | |
| 952 | + db_multi_exec("DELETE FROM config WHERE name GLOB 'walias:/*'"); | |
| 953 | + db_protect_pop(); | |
| 954 | + }else if( fossil_strcmp(zName,"@interwiki")==0 ){ | |
| 955 | + db_unprotect(PROTECT_CONFIG); | |
| 956 | + db_multi_exec("DELETE FROM config WHERE name GLOB 'interwiki:*'"); | |
| 957 | + db_protect_pop(); | |
| 949 | 958 | } |
| 950 | 959 | } |
| 951 | 960 | db_end_transaction(0); |
| 952 | 961 | fossil_print("Configuration reset to factory defaults.\n"); |
| 953 | 962 | fossil_print("To recover, use: %s %s import %s\n", |
| @@ -957,10 +966,11 @@ | ||
| 957 | 966 | { |
| 958 | 967 | fossil_fatal("METHOD should be one of:" |
| 959 | 968 | " export import merge pull push reset"); |
| 960 | 969 | } |
| 961 | 970 | configure_rebuild(); |
| 971 | + if( nErr ) fossil_exit(1); | |
| 962 | 972 | } |
| 963 | 973 | |
| 964 | 974 | |
| 965 | 975 | /* |
| 966 | 976 | ** COMMAND: test-var-list |
| @@ -1055,11 +1065,13 @@ | ||
| 1055 | 1065 | } |
| 1056 | 1066 | db_finalize(&q); |
| 1057 | 1067 | if( zPattern && doUnset ){ |
| 1058 | 1068 | prompt_user("Delete all of the above? (y/N)? ", &ans); |
| 1059 | 1069 | if( blob_str(&ans)[0]=='y' || blob_str(&ans)[0]=='Y' ){ |
| 1070 | + db_unprotect(PROTECT_CONFIG); | |
| 1060 | 1071 | db_multi_exec("DELETE FROM config WHERE name GLOB %Q", zPattern); |
| 1072 | + db_protect_pop(); | |
| 1061 | 1073 | } |
| 1062 | 1074 | blob_reset(&ans); |
| 1063 | 1075 | } |
| 1064 | 1076 | } |
| 1065 | 1077 | |
| 1066 | 1078 |
| --- src/configure.c | |
| +++ src/configure.c | |
| @@ -828,10 +828,11 @@ | |
| 828 | ** |
| 829 | ** See also: [[settings]], [[unset]] |
| 830 | */ |
| 831 | void configuration_cmd(void){ |
| 832 | int n; |
| 833 | const char *zMethod; |
| 834 | db_find_and_open_repository(0, 0); |
| 835 | db_open_config(0, 0); |
| 836 | if( g.argc<3 ){ |
| 837 | usage("SUBCOMMAND ..."); |
| @@ -845,11 +846,11 @@ | |
| 845 | if( g.argc!=5 ){ |
| 846 | usage("export AREA FILENAME"); |
| 847 | } |
| 848 | mask = configure_name_to_mask(g.argv[3], 1); |
| 849 | if( zSince ){ |
| 850 | iStart = db_multi_exec( |
| 851 | "SELECT coalesce(strftime('%%s',%Q),strftime('%%s','now',%Q))+0", |
| 852 | zSince, zSince |
| 853 | ); |
| 854 | }else{ |
| 855 | iStart = 0; |
| @@ -897,17 +898,17 @@ | |
| 897 | user_select(); |
| 898 | url_enable_proxy("via proxy: "); |
| 899 | g.zHttpAuth = get_httpauth(); |
| 900 | if( overwriteFlag ) mask |= CONFIGSET_OVERWRITE; |
| 901 | if( strncmp(zMethod, "push", n)==0 ){ |
| 902 | client_sync(0,0,(unsigned)mask,0,0); |
| 903 | }else if( strncmp(zMethod, "pull", n)==0 ){ |
| 904 | if( overwriteFlag ) db_unprotect(PROTECT_USER); |
| 905 | client_sync(0,(unsigned)mask,0,0,0); |
| 906 | if( overwriteFlag ) db_protect_pop(); |
| 907 | }else{ |
| 908 | client_sync(0,(unsigned)mask,(unsigned)mask,0,0); |
| 909 | } |
| 910 | }else |
| 911 | if( strncmp(zMethod, "reset", n)==0 ){ |
| 912 | int mask, i; |
| 913 | char *zBackup; |
| @@ -944,10 +945,18 @@ | |
| 944 | } |
| 945 | }else if( fossil_strcmp(zName,"@reportfmt")==0 ){ |
| 946 | db_multi_exec("DELETE FROM reportfmt"); |
| 947 | assert( strchr(zRepositorySchemaDefaultReports,'%')==0 ); |
| 948 | db_multi_exec(zRepositorySchemaDefaultReports /*works-like:""*/); |
| 949 | } |
| 950 | } |
| 951 | db_end_transaction(0); |
| 952 | fossil_print("Configuration reset to factory defaults.\n"); |
| 953 | fossil_print("To recover, use: %s %s import %s\n", |
| @@ -957,10 +966,11 @@ | |
| 957 | { |
| 958 | fossil_fatal("METHOD should be one of:" |
| 959 | " export import merge pull push reset"); |
| 960 | } |
| 961 | configure_rebuild(); |
| 962 | } |
| 963 | |
| 964 | |
| 965 | /* |
| 966 | ** COMMAND: test-var-list |
| @@ -1055,11 +1065,13 @@ | |
| 1055 | } |
| 1056 | db_finalize(&q); |
| 1057 | if( zPattern && doUnset ){ |
| 1058 | prompt_user("Delete all of the above? (y/N)? ", &ans); |
| 1059 | if( blob_str(&ans)[0]=='y' || blob_str(&ans)[0]=='Y' ){ |
| 1060 | db_multi_exec("DELETE FROM config WHERE name GLOB %Q", zPattern); |
| 1061 | } |
| 1062 | blob_reset(&ans); |
| 1063 | } |
| 1064 | } |
| 1065 | |
| 1066 |
| --- src/configure.c | |
| +++ src/configure.c | |
| @@ -828,10 +828,11 @@ | |
| 828 | ** |
| 829 | ** See also: [[settings]], [[unset]] |
| 830 | */ |
| 831 | void configuration_cmd(void){ |
| 832 | int n; |
| 833 | int nErr = 0; |
| 834 | const char *zMethod; |
| 835 | db_find_and_open_repository(0, 0); |
| 836 | db_open_config(0, 0); |
| 837 | if( g.argc<3 ){ |
| 838 | usage("SUBCOMMAND ..."); |
| @@ -845,11 +846,11 @@ | |
| 846 | if( g.argc!=5 ){ |
| 847 | usage("export AREA FILENAME"); |
| 848 | } |
| 849 | mask = configure_name_to_mask(g.argv[3], 1); |
| 850 | if( zSince ){ |
| 851 | iStart = db_int64(0, |
| 852 | "SELECT coalesce(strftime('%%s',%Q),strftime('%%s','now',%Q))+0", |
| 853 | zSince, zSince |
| 854 | ); |
| 855 | }else{ |
| 856 | iStart = 0; |
| @@ -897,17 +898,17 @@ | |
| 898 | user_select(); |
| 899 | url_enable_proxy("via proxy: "); |
| 900 | g.zHttpAuth = get_httpauth(); |
| 901 | if( overwriteFlag ) mask |= CONFIGSET_OVERWRITE; |
| 902 | if( strncmp(zMethod, "push", n)==0 ){ |
| 903 | nErr = client_sync(0,0,(unsigned)mask,0,0); |
| 904 | }else if( strncmp(zMethod, "pull", n)==0 ){ |
| 905 | if( overwriteFlag ) db_unprotect(PROTECT_USER); |
| 906 | nErr = client_sync(0,(unsigned)mask,0,0,0); |
| 907 | if( overwriteFlag ) db_protect_pop(); |
| 908 | }else{ |
| 909 | nErr = client_sync(0,(unsigned)mask,(unsigned)mask,0,0); |
| 910 | } |
| 911 | }else |
| 912 | if( strncmp(zMethod, "reset", n)==0 ){ |
| 913 | int mask, i; |
| 914 | char *zBackup; |
| @@ -944,10 +945,18 @@ | |
| 945 | } |
| 946 | }else if( fossil_strcmp(zName,"@reportfmt")==0 ){ |
| 947 | db_multi_exec("DELETE FROM reportfmt"); |
| 948 | assert( strchr(zRepositorySchemaDefaultReports,'%')==0 ); |
| 949 | db_multi_exec(zRepositorySchemaDefaultReports /*works-like:""*/); |
| 950 | }else if( fossil_strcmp(zName,"@alias")==0 ){ |
| 951 | db_unprotect(PROTECT_CONFIG); |
| 952 | db_multi_exec("DELETE FROM config WHERE name GLOB 'walias:/*'"); |
| 953 | db_protect_pop(); |
| 954 | }else if( fossil_strcmp(zName,"@interwiki")==0 ){ |
| 955 | db_unprotect(PROTECT_CONFIG); |
| 956 | db_multi_exec("DELETE FROM config WHERE name GLOB 'interwiki:*'"); |
| 957 | db_protect_pop(); |
| 958 | } |
| 959 | } |
| 960 | db_end_transaction(0); |
| 961 | fossil_print("Configuration reset to factory defaults.\n"); |
| 962 | fossil_print("To recover, use: %s %s import %s\n", |
| @@ -957,10 +966,11 @@ | |
| 966 | { |
| 967 | fossil_fatal("METHOD should be one of:" |
| 968 | " export import merge pull push reset"); |
| 969 | } |
| 970 | configure_rebuild(); |
| 971 | if( nErr ) fossil_exit(1); |
| 972 | } |
| 973 | |
| 974 | |
| 975 | /* |
| 976 | ** COMMAND: test-var-list |
| @@ -1055,11 +1065,13 @@ | |
| 1065 | } |
| 1066 | db_finalize(&q); |
| 1067 | if( zPattern && doUnset ){ |
| 1068 | prompt_user("Delete all of the above? (y/N)? ", &ans); |
| 1069 | if( blob_str(&ans)[0]=='y' || blob_str(&ans)[0]=='Y' ){ |
| 1070 | db_unprotect(PROTECT_CONFIG); |
| 1071 | db_multi_exec("DELETE FROM config WHERE name GLOB %Q", zPattern); |
| 1072 | db_protect_pop(); |
| 1073 | } |
| 1074 | blob_reset(&ans); |
| 1075 | } |
| 1076 | } |
| 1077 | |
| 1078 |
+4
-2
| --- src/manifest.c | ||
| +++ src/manifest.c | ||
| @@ -1209,10 +1209,11 @@ | ||
| 1209 | 1209 | int manifest_is_well_formed(const char *zIn, int nIn){ |
| 1210 | 1210 | int i; |
| 1211 | 1211 | int iRes; |
| 1212 | 1212 | Manifest *pManifest; |
| 1213 | 1213 | Blob copy, errmsg; |
| 1214 | + if( nIn<1 || zIn[nIn-1]!='\n' ) return 0; | |
| 1214 | 1215 | remove_pgp_signature(&zIn, &nIn); |
| 1215 | 1216 | |
| 1216 | 1217 | /* Check to see that the file begins with a "card" */ |
| 1217 | 1218 | if( nIn<3 ) return 0; |
| 1218 | 1219 | if( zIn[0]<'A' || zIn[0]>'M' || zIn[1]!=' ' ) return 0; |
| @@ -1219,11 +1220,12 @@ | ||
| 1219 | 1220 | |
| 1220 | 1221 | /* Check to see that the first card is followed by one more card */ |
| 1221 | 1222 | for(i=2; i<nIn && zIn[i]!='\n'; i++){} |
| 1222 | 1223 | if( i>=nIn-3 ) return 0; |
| 1223 | 1224 | i++; |
| 1224 | - if( !fossil_isupper(zIn[i]) || zIn[i]<zIn[0] || zIn[i+1]!=' ' ) return 0; | |
| 1225 | + if( !fossil_isupper(zIn[i]) || zIn[i]<zIn[0] ) return 0; | |
| 1226 | + if( zIn[i+1]!=' ' && zIn[i+1]!='\n' ) return 0; | |
| 1225 | 1227 | |
| 1226 | 1228 | /* The checks above will eliminate most random inputs. If these |
| 1227 | 1229 | ** quick checks pass, then we could be dealing with a well-formed |
| 1228 | 1230 | ** control artifact. Make a copy, and run it through the official |
| 1229 | 1231 | ** artifact parser. This is the slow path, but it is rarely taken. |
| @@ -2633,11 +2635,11 @@ | ||
| 2633 | 2635 | if( p->type==CFTYPE_ATTACHMENT ){ |
| 2634 | 2636 | char *zComment = 0; |
| 2635 | 2637 | const char isAdd = (p->zAttachSrc && p->zAttachSrc[0]) ? 1 : 0; |
| 2636 | 2638 | char attachToType = 0; |
| 2637 | 2639 | db_multi_exec( |
| 2638 | - "INSERT INTO attachment(attachid, mtime, src, target," | |
| 2640 | + "REPLACE INTO attachment(attachid, mtime, src, target," | |
| 2639 | 2641 | "filename, comment, user)" |
| 2640 | 2642 | "VALUES(%d,%.17g,%Q,%Q,%Q,%Q,%Q);", |
| 2641 | 2643 | rid, p->rDate, p->zAttachSrc, p->zAttachTarget, p->zAttachName, |
| 2642 | 2644 | (p->zComment ? p->zComment : ""), p->zUser |
| 2643 | 2645 | ); |
| 2644 | 2646 |
| --- src/manifest.c | |
| +++ src/manifest.c | |
| @@ -1209,10 +1209,11 @@ | |
| 1209 | int manifest_is_well_formed(const char *zIn, int nIn){ |
| 1210 | int i; |
| 1211 | int iRes; |
| 1212 | Manifest *pManifest; |
| 1213 | Blob copy, errmsg; |
| 1214 | remove_pgp_signature(&zIn, &nIn); |
| 1215 | |
| 1216 | /* Check to see that the file begins with a "card" */ |
| 1217 | if( nIn<3 ) return 0; |
| 1218 | if( zIn[0]<'A' || zIn[0]>'M' || zIn[1]!=' ' ) return 0; |
| @@ -1219,11 +1220,12 @@ | |
| 1219 | |
| 1220 | /* Check to see that the first card is followed by one more card */ |
| 1221 | for(i=2; i<nIn && zIn[i]!='\n'; i++){} |
| 1222 | if( i>=nIn-3 ) return 0; |
| 1223 | i++; |
| 1224 | if( !fossil_isupper(zIn[i]) || zIn[i]<zIn[0] || zIn[i+1]!=' ' ) return 0; |
| 1225 | |
| 1226 | /* The checks above will eliminate most random inputs. If these |
| 1227 | ** quick checks pass, then we could be dealing with a well-formed |
| 1228 | ** control artifact. Make a copy, and run it through the official |
| 1229 | ** artifact parser. This is the slow path, but it is rarely taken. |
| @@ -2633,11 +2635,11 @@ | |
| 2633 | if( p->type==CFTYPE_ATTACHMENT ){ |
| 2634 | char *zComment = 0; |
| 2635 | const char isAdd = (p->zAttachSrc && p->zAttachSrc[0]) ? 1 : 0; |
| 2636 | char attachToType = 0; |
| 2637 | db_multi_exec( |
| 2638 | "INSERT INTO attachment(attachid, mtime, src, target," |
| 2639 | "filename, comment, user)" |
| 2640 | "VALUES(%d,%.17g,%Q,%Q,%Q,%Q,%Q);", |
| 2641 | rid, p->rDate, p->zAttachSrc, p->zAttachTarget, p->zAttachName, |
| 2642 | (p->zComment ? p->zComment : ""), p->zUser |
| 2643 | ); |
| 2644 |
| --- src/manifest.c | |
| +++ src/manifest.c | |
| @@ -1209,10 +1209,11 @@ | |
| 1209 | int manifest_is_well_formed(const char *zIn, int nIn){ |
| 1210 | int i; |
| 1211 | int iRes; |
| 1212 | Manifest *pManifest; |
| 1213 | Blob copy, errmsg; |
| 1214 | if( nIn<1 || zIn[nIn-1]!='\n' ) return 0; |
| 1215 | remove_pgp_signature(&zIn, &nIn); |
| 1216 | |
| 1217 | /* Check to see that the file begins with a "card" */ |
| 1218 | if( nIn<3 ) return 0; |
| 1219 | if( zIn[0]<'A' || zIn[0]>'M' || zIn[1]!=' ' ) return 0; |
| @@ -1219,11 +1220,12 @@ | |
| 1220 | |
| 1221 | /* Check to see that the first card is followed by one more card */ |
| 1222 | for(i=2; i<nIn && zIn[i]!='\n'; i++){} |
| 1223 | if( i>=nIn-3 ) return 0; |
| 1224 | i++; |
| 1225 | if( !fossil_isupper(zIn[i]) || zIn[i]<zIn[0] ) return 0; |
| 1226 | if( zIn[i+1]!=' ' && zIn[i+1]!='\n' ) return 0; |
| 1227 | |
| 1228 | /* The checks above will eliminate most random inputs. If these |
| 1229 | ** quick checks pass, then we could be dealing with a well-formed |
| 1230 | ** control artifact. Make a copy, and run it through the official |
| 1231 | ** artifact parser. This is the slow path, but it is rarely taken. |
| @@ -2633,11 +2635,11 @@ | |
| 2635 | if( p->type==CFTYPE_ATTACHMENT ){ |
| 2636 | char *zComment = 0; |
| 2637 | const char isAdd = (p->zAttachSrc && p->zAttachSrc[0]) ? 1 : 0; |
| 2638 | char attachToType = 0; |
| 2639 | db_multi_exec( |
| 2640 | "REPLACE INTO attachment(attachid, mtime, src, target," |
| 2641 | "filename, comment, user)" |
| 2642 | "VALUES(%d,%.17g,%Q,%Q,%Q,%Q,%Q);", |
| 2643 | rid, p->rDate, p->zAttachSrc, p->zAttachTarget, p->zAttachName, |
| 2644 | (p->zComment ? p->zComment : ""), p->zUser |
| 2645 | ); |
| 2646 |
+6
| --- src/robot.c | ||
| +++ src/robot.c | ||
| @@ -139,10 +139,16 @@ | ||
| 139 | 139 | /* Only do this computation once, then cache the results for future |
| 140 | 140 | ** use */ |
| 141 | 141 | if( robot.resultCache ){ |
| 142 | 142 | return robot.resultCache==MIGHT_BE_ROBOT; |
| 143 | 143 | } |
| 144 | + | |
| 145 | + /* A command run from the command line has no web client. */ | |
| 146 | + if( !g.isHTTP ){ | |
| 147 | + robot.resultCache = KNOWN_NOT_ROBOT; | |
| 148 | + return 0; | |
| 149 | + } | |
| 144 | 150 | |
| 145 | 151 | /* Condition 1: Is there a valid login? |
| 146 | 152 | */ |
| 147 | 153 | if( g.userUid==0 ){ |
| 148 | 154 | login_check_credentials(); |
| 149 | 155 |
| --- src/robot.c | |
| +++ src/robot.c | |
| @@ -139,10 +139,16 @@ | |
| 139 | /* Only do this computation once, then cache the results for future |
| 140 | ** use */ |
| 141 | if( robot.resultCache ){ |
| 142 | return robot.resultCache==MIGHT_BE_ROBOT; |
| 143 | } |
| 144 | |
| 145 | /* Condition 1: Is there a valid login? |
| 146 | */ |
| 147 | if( g.userUid==0 ){ |
| 148 | login_check_credentials(); |
| 149 |
| --- src/robot.c | |
| +++ src/robot.c | |
| @@ -139,10 +139,16 @@ | |
| 139 | /* Only do this computation once, then cache the results for future |
| 140 | ** use */ |
| 141 | if( robot.resultCache ){ |
| 142 | return robot.resultCache==MIGHT_BE_ROBOT; |
| 143 | } |
| 144 | |
| 145 | /* A command run from the command line has no web client. */ |
| 146 | if( !g.isHTTP ){ |
| 147 | robot.resultCache = KNOWN_NOT_ROBOT; |
| 148 | return 0; |
| 149 | } |
| 150 | |
| 151 | /* Condition 1: Is there a valid login? |
| 152 | */ |
| 153 | if( g.userUid==0 ){ |
| 154 | login_check_credentials(); |
| 155 |
+1
| --- src/url.c | ||
| +++ src/url.c | ||
| @@ -235,10 +235,11 @@ | ||
| 235 | 235 | if( c==':' ){ |
| 236 | 236 | pUrlData->port = 0; |
| 237 | 237 | i++; |
| 238 | 238 | while( (c = zUrl[i])!=0 && fossil_isdigit(c) ){ |
| 239 | 239 | pUrlData->port = pUrlData->port*10 + c - '0'; |
| 240 | + if( pUrlData->port>65535 ) fossil_fatal("port number too large in url"); | |
| 240 | 241 | i++; |
| 241 | 242 | } |
| 242 | 243 | if( c!=0 && c!='/' && c!='?' && c!='#' ){ |
| 243 | 244 | fossil_fatal("url missing '/' after port number"); |
| 244 | 245 | } |
| 245 | 246 |
| --- src/url.c | |
| +++ src/url.c | |
| @@ -235,10 +235,11 @@ | |
| 235 | if( c==':' ){ |
| 236 | pUrlData->port = 0; |
| 237 | i++; |
| 238 | while( (c = zUrl[i])!=0 && fossil_isdigit(c) ){ |
| 239 | pUrlData->port = pUrlData->port*10 + c - '0'; |
| 240 | i++; |
| 241 | } |
| 242 | if( c!=0 && c!='/' && c!='?' && c!='#' ){ |
| 243 | fossil_fatal("url missing '/' after port number"); |
| 244 | } |
| 245 |
| --- src/url.c | |
| +++ src/url.c | |
| @@ -235,10 +235,11 @@ | |
| 235 | if( c==':' ){ |
| 236 | pUrlData->port = 0; |
| 237 | i++; |
| 238 | while( (c = zUrl[i])!=0 && fossil_isdigit(c) ){ |
| 239 | pUrlData->port = pUrlData->port*10 + c - '0'; |
| 240 | if( pUrlData->port>65535 ) fossil_fatal("port number too large in url"); |
| 241 | i++; |
| 242 | } |
| 243 | if( c!=0 && c!='/' && c!='?' && c!='#' ){ |
| 244 | fossil_fatal("url missing '/' after port number"); |
| 245 | } |
| 246 |
+12
-3
| --- src/xfer.c | ||
| +++ src/xfer.c | ||
| @@ -1304,11 +1304,15 @@ | ||
| 1304 | 1304 | ** Add a "syncfrom:URL" entry instead of "syncwith:URL" if bSyncFrom is true. |
| 1305 | 1305 | */ |
| 1306 | 1306 | static void xfer_syncwith(const char *zUrl, int bSyncFrom){ |
| 1307 | 1307 | UrlData x; |
| 1308 | 1308 | memset(&x, 0, sizeof(x)); |
| 1309 | - url_parse_local(zUrl, URL_OMIT_USER, &x); | |
| 1309 | + if( fossil_strnicmp(zUrl, "http://", 7)==0 | |
| 1310 | + || fossil_strnicmp(zUrl, "https://", 8)==0 | |
| 1311 | + ){ | |
| 1312 | + url_parse_local(zUrl, URL_OMIT_USER, &x); | |
| 1313 | + } | |
| 1310 | 1314 | if( x.protocol && strncmp(x.protocol,"http",4)==0 |
| 1311 | 1315 | && x.name && sqlite3_strlike("%localhost%", x.name, 0)!=0 |
| 1312 | 1316 | ){ |
| 1313 | 1317 | db_unprotect(PROTECT_CONFIG); |
| 1314 | 1318 | db_multi_exec("REPLACE INTO config(name,value,mtime)" |
| @@ -2023,11 +2027,12 @@ | ||
| 2023 | 2027 | " UNION ALL\n" |
| 2024 | 2028 | " SELECT mtime, substr(name,10), '{}' FROM config\n" |
| 2025 | 2029 | " WHERE name GLOB 'syncfrom:http*'\n" |
| 2026 | 2030 | " UNION ALL\n" |
| 2027 | 2031 | " SELECT mtime, substr(name,9), '{\"type\":\"git\"}' FROM config\n" |
| 2028 | - " WHERE name GLOB 'gitpush:*'\n" | |
| 2032 | + " WHERE name GLOB 'gitpush:http://*'\n" | |
| 2033 | + " OR name GLOB 'gitpush:https://*'\n" | |
| 2029 | 2034 | ")\n" |
| 2030 | 2035 | "SELECT url, json_insert(arg,'$.src',%Q), max(mtime)\n" |
| 2031 | 2036 | " FROM remote WHERE mtime>unixepoch('now','-1 month')\n" |
| 2032 | 2037 | " GROUP BY url;", |
| 2033 | 2038 | g.zBaseURL |
| @@ -3000,11 +3005,15 @@ | ||
| 3000 | 3005 | char *zArg = blob_str(&xfer.aToken[3]); |
| 3001 | 3006 | i64 iTime = strtoll(blob_str(&xfer.aToken[4]),0,0); |
| 3002 | 3007 | memset(&x, 0, sizeof(x)); |
| 3003 | 3008 | defossilize(zUrl); |
| 3004 | 3009 | defossilize(zArg); |
| 3005 | - url_parse_local(zUrl, URL_OMIT_USER, &x); | |
| 3010 | + if( fossil_strnicmp(zUrl, "http://", 7)==0 | |
| 3011 | + || fossil_strnicmp(zUrl, "https://", 8)==0 | |
| 3012 | + ){ | |
| 3013 | + url_parse_local(zUrl, URL_OMIT_USER, &x); | |
| 3014 | + } | |
| 3006 | 3015 | if( x.protocol |
| 3007 | 3016 | && strncmp(x.protocol,"http",4)==0 |
| 3008 | 3017 | && iTime>0 |
| 3009 | 3018 | ){ |
| 3010 | 3019 | db_unprotect(PROTECT_CONFIG); |
| 3011 | 3020 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -1304,11 +1304,15 @@ | |
| 1304 | ** Add a "syncfrom:URL" entry instead of "syncwith:URL" if bSyncFrom is true. |
| 1305 | */ |
| 1306 | static void xfer_syncwith(const char *zUrl, int bSyncFrom){ |
| 1307 | UrlData x; |
| 1308 | memset(&x, 0, sizeof(x)); |
| 1309 | url_parse_local(zUrl, URL_OMIT_USER, &x); |
| 1310 | if( x.protocol && strncmp(x.protocol,"http",4)==0 |
| 1311 | && x.name && sqlite3_strlike("%localhost%", x.name, 0)!=0 |
| 1312 | ){ |
| 1313 | db_unprotect(PROTECT_CONFIG); |
| 1314 | db_multi_exec("REPLACE INTO config(name,value,mtime)" |
| @@ -2023,11 +2027,12 @@ | |
| 2023 | " UNION ALL\n" |
| 2024 | " SELECT mtime, substr(name,10), '{}' FROM config\n" |
| 2025 | " WHERE name GLOB 'syncfrom:http*'\n" |
| 2026 | " UNION ALL\n" |
| 2027 | " SELECT mtime, substr(name,9), '{\"type\":\"git\"}' FROM config\n" |
| 2028 | " WHERE name GLOB 'gitpush:*'\n" |
| 2029 | ")\n" |
| 2030 | "SELECT url, json_insert(arg,'$.src',%Q), max(mtime)\n" |
| 2031 | " FROM remote WHERE mtime>unixepoch('now','-1 month')\n" |
| 2032 | " GROUP BY url;", |
| 2033 | g.zBaseURL |
| @@ -3000,11 +3005,15 @@ | |
| 3000 | char *zArg = blob_str(&xfer.aToken[3]); |
| 3001 | i64 iTime = strtoll(blob_str(&xfer.aToken[4]),0,0); |
| 3002 | memset(&x, 0, sizeof(x)); |
| 3003 | defossilize(zUrl); |
| 3004 | defossilize(zArg); |
| 3005 | url_parse_local(zUrl, URL_OMIT_USER, &x); |
| 3006 | if( x.protocol |
| 3007 | && strncmp(x.protocol,"http",4)==0 |
| 3008 | && iTime>0 |
| 3009 | ){ |
| 3010 | db_unprotect(PROTECT_CONFIG); |
| 3011 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -1304,11 +1304,15 @@ | |
| 1304 | ** Add a "syncfrom:URL" entry instead of "syncwith:URL" if bSyncFrom is true. |
| 1305 | */ |
| 1306 | static void xfer_syncwith(const char *zUrl, int bSyncFrom){ |
| 1307 | UrlData x; |
| 1308 | memset(&x, 0, sizeof(x)); |
| 1309 | if( fossil_strnicmp(zUrl, "http://", 7)==0 |
| 1310 | || fossil_strnicmp(zUrl, "https://", 8)==0 |
| 1311 | ){ |
| 1312 | url_parse_local(zUrl, URL_OMIT_USER, &x); |
| 1313 | } |
| 1314 | if( x.protocol && strncmp(x.protocol,"http",4)==0 |
| 1315 | && x.name && sqlite3_strlike("%localhost%", x.name, 0)!=0 |
| 1316 | ){ |
| 1317 | db_unprotect(PROTECT_CONFIG); |
| 1318 | db_multi_exec("REPLACE INTO config(name,value,mtime)" |
| @@ -2023,11 +2027,12 @@ | |
| 2027 | " UNION ALL\n" |
| 2028 | " SELECT mtime, substr(name,10), '{}' FROM config\n" |
| 2029 | " WHERE name GLOB 'syncfrom:http*'\n" |
| 2030 | " UNION ALL\n" |
| 2031 | " SELECT mtime, substr(name,9), '{\"type\":\"git\"}' FROM config\n" |
| 2032 | " WHERE name GLOB 'gitpush:http://*'\n" |
| 2033 | " OR name GLOB 'gitpush:https://*'\n" |
| 2034 | ")\n" |
| 2035 | "SELECT url, json_insert(arg,'$.src',%Q), max(mtime)\n" |
| 2036 | " FROM remote WHERE mtime>unixepoch('now','-1 month')\n" |
| 2037 | " GROUP BY url;", |
| 2038 | g.zBaseURL |
| @@ -3000,11 +3005,15 @@ | |
| 3005 | char *zArg = blob_str(&xfer.aToken[3]); |
| 3006 | i64 iTime = strtoll(blob_str(&xfer.aToken[4]),0,0); |
| 3007 | memset(&x, 0, sizeof(x)); |
| 3008 | defossilize(zUrl); |
| 3009 | defossilize(zArg); |
| 3010 | if( fossil_strnicmp(zUrl, "http://", 7)==0 |
| 3011 | || fossil_strnicmp(zUrl, "https://", 8)==0 |
| 3012 | ){ |
| 3013 | url_parse_local(zUrl, URL_OMIT_USER, &x); |
| 3014 | } |
| 3015 | if( x.protocol |
| 3016 | && strncmp(x.protocol,"http",4)==0 |
| 3017 | && iTime>0 |
| 3018 | ){ |
| 3019 | db_unprotect(PROTECT_CONFIG); |
| 3020 |