Fossil SCM
When a server records the URL a client gives for itself, parse it only if it begins with http:// or https://, as for links the server sends. Any other text was parsed as a path on the server and, if no repository was there, ended the request with an error.
Commit
f56a138ee179e152235338b5db4399a373244db85419cebaa26601b7535f5785
Parent
77cabadca801cf5…
1 file changed
+5
-1
+5
-1
| --- 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)" |
| 1315 | 1319 |
| --- 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)" |
| 1315 |
| --- 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)" |
| 1319 |