Fossil SCM
Fix a bug in the logic that prevents loopback URLs in the synclog.
Commit
3ef61c4782c47b3c7e486c391d9c70ca008092f3a9fde34bd443f8463b8036bd
Parent
d58eebb77f05255…
1 file changed
+8
-3
+8
-3
| --- src/xfer.c | ||
| +++ src/xfer.c | ||
| @@ -1751,11 +1751,13 @@ | ||
| 1751 | 1751 | */ |
| 1752 | 1752 | if( blob_eq(&xfer.aToken[1], "req-synclog") && g.perm.RdSLog ){ |
| 1753 | 1753 | Stmt qSynclog; |
| 1754 | 1754 | if( xfer.nToken>=2 ){ |
| 1755 | 1755 | zClientUrl = blob_str(&xfer.aToken[2]); |
| 1756 | - if( sqlite3_strlike("http%//localhost%", zClientUrl, 0)==0 ){ | |
| 1756 | + if( zClientUrl!=0 | |
| 1757 | + && sqlite3_strlike("http%//localhost%", zClientUrl, 0)==0 | |
| 1758 | + ){ | |
| 1757 | 1759 | zClientUrl = 0; |
| 1758 | 1760 | } |
| 1759 | 1761 | } |
| 1760 | 1762 | db_prepare(&qSynclog, |
| 1761 | 1763 | "SELECT sfrom, sto, unixepoch(stime), stype FROM synclog" |
| @@ -2210,11 +2212,13 @@ | ||
| 2210 | 2212 | } |
| 2211 | 2213 | |
| 2212 | 2214 | /* Transfer SYNCLOG data on the first roundtrip, if appropriate */ |
| 2213 | 2215 | if( nCycle==0 ){ |
| 2214 | 2216 | const char *zSelfUrl = public_url(); |
| 2215 | - if( sqlite3_strlike("http%//localhost%", zSelfUrl, 0)==0 ){ | |
| 2217 | + if( zSelfUrl!=0 | |
| 2218 | + && sqlite3_strlike("http%//localhost%", zSelfUrl, 0)==0 | |
| 2219 | + ){ | |
| 2216 | 2220 | zSelfUrl = 0; |
| 2217 | 2221 | } |
| 2218 | 2222 | if( zSelfUrl==0 ){ |
| 2219 | 2223 | blob_appendf(&send,"pragma req-synclog\n"); |
| 2220 | 2224 | }else{ |
| @@ -2724,11 +2728,12 @@ | ||
| 2724 | 2728 | */ |
| 2725 | 2729 | if( blob_eq(&xfer.aToken[0],"error") && xfer.nToken==2 ){ |
| 2726 | 2730 | char *zMsg = blob_terminate(&xfer.aToken[1]); |
| 2727 | 2731 | defossilize(zMsg); |
| 2728 | 2732 | if( (syncFlags & SYNC_IFABLE)!=0 |
| 2729 | - && sqlite3_strlike("%not authorized to write%",zMsg,0)==0 ){ | |
| 2733 | + && sqlite3_strlike("%not authorized to write%",zMsg,0)==0 | |
| 2734 | + ){ | |
| 2730 | 2735 | autopushFailed = 1; |
| 2731 | 2736 | nErr++; |
| 2732 | 2737 | }else if( (syncFlags & SYNC_CLONE)==0 || nCycle>0 ){ |
| 2733 | 2738 | fossil_force_newline(); |
| 2734 | 2739 | fossil_print("Error: %s\n", zMsg); |
| 2735 | 2740 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -1751,11 +1751,13 @@ | |
| 1751 | */ |
| 1752 | if( blob_eq(&xfer.aToken[1], "req-synclog") && g.perm.RdSLog ){ |
| 1753 | Stmt qSynclog; |
| 1754 | if( xfer.nToken>=2 ){ |
| 1755 | zClientUrl = blob_str(&xfer.aToken[2]); |
| 1756 | if( sqlite3_strlike("http%//localhost%", zClientUrl, 0)==0 ){ |
| 1757 | zClientUrl = 0; |
| 1758 | } |
| 1759 | } |
| 1760 | db_prepare(&qSynclog, |
| 1761 | "SELECT sfrom, sto, unixepoch(stime), stype FROM synclog" |
| @@ -2210,11 +2212,13 @@ | |
| 2210 | } |
| 2211 | |
| 2212 | /* Transfer SYNCLOG data on the first roundtrip, if appropriate */ |
| 2213 | if( nCycle==0 ){ |
| 2214 | const char *zSelfUrl = public_url(); |
| 2215 | if( sqlite3_strlike("http%//localhost%", zSelfUrl, 0)==0 ){ |
| 2216 | zSelfUrl = 0; |
| 2217 | } |
| 2218 | if( zSelfUrl==0 ){ |
| 2219 | blob_appendf(&send,"pragma req-synclog\n"); |
| 2220 | }else{ |
| @@ -2724,11 +2728,12 @@ | |
| 2724 | */ |
| 2725 | if( blob_eq(&xfer.aToken[0],"error") && xfer.nToken==2 ){ |
| 2726 | char *zMsg = blob_terminate(&xfer.aToken[1]); |
| 2727 | defossilize(zMsg); |
| 2728 | if( (syncFlags & SYNC_IFABLE)!=0 |
| 2729 | && sqlite3_strlike("%not authorized to write%",zMsg,0)==0 ){ |
| 2730 | autopushFailed = 1; |
| 2731 | nErr++; |
| 2732 | }else if( (syncFlags & SYNC_CLONE)==0 || nCycle>0 ){ |
| 2733 | fossil_force_newline(); |
| 2734 | fossil_print("Error: %s\n", zMsg); |
| 2735 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -1751,11 +1751,13 @@ | |
| 1751 | */ |
| 1752 | if( blob_eq(&xfer.aToken[1], "req-synclog") && g.perm.RdSLog ){ |
| 1753 | Stmt qSynclog; |
| 1754 | if( xfer.nToken>=2 ){ |
| 1755 | zClientUrl = blob_str(&xfer.aToken[2]); |
| 1756 | if( zClientUrl!=0 |
| 1757 | && sqlite3_strlike("http%//localhost%", zClientUrl, 0)==0 |
| 1758 | ){ |
| 1759 | zClientUrl = 0; |
| 1760 | } |
| 1761 | } |
| 1762 | db_prepare(&qSynclog, |
| 1763 | "SELECT sfrom, sto, unixepoch(stime), stype FROM synclog" |
| @@ -2210,11 +2212,13 @@ | |
| 2212 | } |
| 2213 | |
| 2214 | /* Transfer SYNCLOG data on the first roundtrip, if appropriate */ |
| 2215 | if( nCycle==0 ){ |
| 2216 | const char *zSelfUrl = public_url(); |
| 2217 | if( zSelfUrl!=0 |
| 2218 | && sqlite3_strlike("http%//localhost%", zSelfUrl, 0)==0 |
| 2219 | ){ |
| 2220 | zSelfUrl = 0; |
| 2221 | } |
| 2222 | if( zSelfUrl==0 ){ |
| 2223 | blob_appendf(&send,"pragma req-synclog\n"); |
| 2224 | }else{ |
| @@ -2724,11 +2728,12 @@ | |
| 2728 | */ |
| 2729 | if( blob_eq(&xfer.aToken[0],"error") && xfer.nToken==2 ){ |
| 2730 | char *zMsg = blob_terminate(&xfer.aToken[1]); |
| 2731 | defossilize(zMsg); |
| 2732 | if( (syncFlags & SYNC_IFABLE)!=0 |
| 2733 | && sqlite3_strlike("%not authorized to write%",zMsg,0)==0 |
| 2734 | ){ |
| 2735 | autopushFailed = 1; |
| 2736 | nErr++; |
| 2737 | }else if( (syncFlags & SYNC_CLONE)==0 || nCycle>0 ){ |
| 2738 | fossil_force_newline(); |
| 2739 | fossil_print("Error: %s\n", zMsg); |
| 2740 |