Fossil SCM

Fix a bug in the logic that prevents loopback URLs in the synclog.

drh 2021-12-20 10:04 synclog
Commit 3ef61c4782c47b3c7e486c391d9c70ca008092f3a9fde34bd443f8463b8036bd
1 file changed +8 -3
+8 -3
--- src/xfer.c
+++ src/xfer.c
@@ -1751,11 +1751,13 @@
17511751
*/
17521752
if( blob_eq(&xfer.aToken[1], "req-synclog") && g.perm.RdSLog ){
17531753
Stmt qSynclog;
17541754
if( xfer.nToken>=2 ){
17551755
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
+ ){
17571759
zClientUrl = 0;
17581760
}
17591761
}
17601762
db_prepare(&qSynclog,
17611763
"SELECT sfrom, sto, unixepoch(stime), stype FROM synclog"
@@ -2210,11 +2212,13 @@
22102212
}
22112213
22122214
/* Transfer SYNCLOG data on the first roundtrip, if appropriate */
22132215
if( nCycle==0 ){
22142216
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
+ ){
22162220
zSelfUrl = 0;
22172221
}
22182222
if( zSelfUrl==0 ){
22192223
blob_appendf(&send,"pragma req-synclog\n");
22202224
}else{
@@ -2724,11 +2728,12 @@
27242728
*/
27252729
if( blob_eq(&xfer.aToken[0],"error") && xfer.nToken==2 ){
27262730
char *zMsg = blob_terminate(&xfer.aToken[1]);
27272731
defossilize(zMsg);
27282732
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
+ ){
27302735
autopushFailed = 1;
27312736
nErr++;
27322737
}else if( (syncFlags & SYNC_CLONE)==0 || nCycle>0 ){
27332738
fossil_force_newline();
27342739
fossil_print("Error: %s\n", zMsg);
27352740
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button