Fossil SCM

Code to randomize messages from client to the server.

drh 2008-07-26 14:02 trunk
Commit 3cb547be2c7db73b523813b42fe5cd0d82f429e4
1 file changed +9
+9
--- src/xfer.c
+++ src/xfer.c
@@ -521,10 +521,11 @@
521521
db_begin_transaction();
522522
db_multi_exec(
523523
"CREATE TEMP TABLE onremote(rid INTEGER PRIMARY KEY);"
524524
);
525525
while( blob_line(xfer.pIn, &xfer.line) ){
526
+ if( blob_buffer(&xfer.line)[0]=='#' ) continue;
526527
xfer.nToken = blob_tokenize(&xfer.line, xfer.aToken, count(xfer.aToken));
527528
528529
/* file UUID SIZE \n CONTENT
529530
** file UUID DELTASRC SIZE \n CONTENT
530531
**
@@ -839,10 +840,11 @@
839840
}
840841
printf(zLabelFormat, "", "Bytes", "Cards", "Artifacts", "Deltas");
841842
842843
while( go ){
843844
int newPhantom = 0;
845
+ char *zRandomness;
844846
845847
/* Send make the most recently received cookie. Let the server
846848
** figure out if this is a cookie that it cares about.
847849
*/
848850
zCookie = db_get("cookie", 0);
@@ -870,10 +872,17 @@
870872
zName = configure_next_name(configMask);
871873
nCard++;
872874
}
873875
configMask = 0;
874876
}
877
+
878
+ /* Append randomness to the end of the message */
879
+#if 0 /* Enable this after all servers have upgraded */
880
+ zRandomness = db_text(0, "SELECT hex(randomblob(20))");
881
+ blob_appendf(&send, "# %s\n", zRandomness);
882
+ free(zRandomness);
883
+#endif
875884
876885
/* Exchange messages with the server */
877886
nFileSend = xfer.nFileSent + xfer.nDeltaSent;
878887
printf(zValueFormat, "Send:",
879888
blob_size(&send), nCard+xfer.nGimmeSent+xfer.nIGotSent,
880889
--- src/xfer.c
+++ src/xfer.c
@@ -521,10 +521,11 @@
521 db_begin_transaction();
522 db_multi_exec(
523 "CREATE TEMP TABLE onremote(rid INTEGER PRIMARY KEY);"
524 );
525 while( blob_line(xfer.pIn, &xfer.line) ){
 
526 xfer.nToken = blob_tokenize(&xfer.line, xfer.aToken, count(xfer.aToken));
527
528 /* file UUID SIZE \n CONTENT
529 ** file UUID DELTASRC SIZE \n CONTENT
530 **
@@ -839,10 +840,11 @@
839 }
840 printf(zLabelFormat, "", "Bytes", "Cards", "Artifacts", "Deltas");
841
842 while( go ){
843 int newPhantom = 0;
 
844
845 /* Send make the most recently received cookie. Let the server
846 ** figure out if this is a cookie that it cares about.
847 */
848 zCookie = db_get("cookie", 0);
@@ -870,10 +872,17 @@
870 zName = configure_next_name(configMask);
871 nCard++;
872 }
873 configMask = 0;
874 }
 
 
 
 
 
 
 
875
876 /* Exchange messages with the server */
877 nFileSend = xfer.nFileSent + xfer.nDeltaSent;
878 printf(zValueFormat, "Send:",
879 blob_size(&send), nCard+xfer.nGimmeSent+xfer.nIGotSent,
880
--- src/xfer.c
+++ src/xfer.c
@@ -521,10 +521,11 @@
521 db_begin_transaction();
522 db_multi_exec(
523 "CREATE TEMP TABLE onremote(rid INTEGER PRIMARY KEY);"
524 );
525 while( blob_line(xfer.pIn, &xfer.line) ){
526 if( blob_buffer(&xfer.line)[0]=='#' ) continue;
527 xfer.nToken = blob_tokenize(&xfer.line, xfer.aToken, count(xfer.aToken));
528
529 /* file UUID SIZE \n CONTENT
530 ** file UUID DELTASRC SIZE \n CONTENT
531 **
@@ -839,10 +840,11 @@
840 }
841 printf(zLabelFormat, "", "Bytes", "Cards", "Artifacts", "Deltas");
842
843 while( go ){
844 int newPhantom = 0;
845 char *zRandomness;
846
847 /* Send make the most recently received cookie. Let the server
848 ** figure out if this is a cookie that it cares about.
849 */
850 zCookie = db_get("cookie", 0);
@@ -870,10 +872,17 @@
872 zName = configure_next_name(configMask);
873 nCard++;
874 }
875 configMask = 0;
876 }
877
878 /* Append randomness to the end of the message */
879 #if 0 /* Enable this after all servers have upgraded */
880 zRandomness = db_text(0, "SELECT hex(randomblob(20))");
881 blob_appendf(&send, "# %s\n", zRandomness);
882 free(zRandomness);
883 #endif
884
885 /* Exchange messages with the server */
886 nFileSend = xfer.nFileSent + xfer.nDeltaSent;
887 printf(zValueFormat, "Send:",
888 blob_size(&send), nCard+xfer.nGimmeSent+xfer.nIGotSent,
889

Keyboard Shortcuts

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