Fossil SCM
Code to randomize messages from client to the server.
Commit
3cb547be2c7db73b523813b42fe5cd0d82f429e4
Parent
f6d3d89e76a5214…
1 file changed
+9
+9
| --- src/xfer.c | ||
| +++ src/xfer.c | ||
| @@ -521,10 +521,11 @@ | ||
| 521 | 521 | db_begin_transaction(); |
| 522 | 522 | db_multi_exec( |
| 523 | 523 | "CREATE TEMP TABLE onremote(rid INTEGER PRIMARY KEY);" |
| 524 | 524 | ); |
| 525 | 525 | while( blob_line(xfer.pIn, &xfer.line) ){ |
| 526 | + if( blob_buffer(&xfer.line)[0]=='#' ) continue; | |
| 526 | 527 | xfer.nToken = blob_tokenize(&xfer.line, xfer.aToken, count(xfer.aToken)); |
| 527 | 528 | |
| 528 | 529 | /* file UUID SIZE \n CONTENT |
| 529 | 530 | ** file UUID DELTASRC SIZE \n CONTENT |
| 530 | 531 | ** |
| @@ -839,10 +840,11 @@ | ||
| 839 | 840 | } |
| 840 | 841 | printf(zLabelFormat, "", "Bytes", "Cards", "Artifacts", "Deltas"); |
| 841 | 842 | |
| 842 | 843 | while( go ){ |
| 843 | 844 | int newPhantom = 0; |
| 845 | + char *zRandomness; | |
| 844 | 846 | |
| 845 | 847 | /* Send make the most recently received cookie. Let the server |
| 846 | 848 | ** figure out if this is a cookie that it cares about. |
| 847 | 849 | */ |
| 848 | 850 | zCookie = db_get("cookie", 0); |
| @@ -870,10 +872,17 @@ | ||
| 870 | 872 | zName = configure_next_name(configMask); |
| 871 | 873 | nCard++; |
| 872 | 874 | } |
| 873 | 875 | configMask = 0; |
| 874 | 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 | |
| 875 | 884 | |
| 876 | 885 | /* Exchange messages with the server */ |
| 877 | 886 | nFileSend = xfer.nFileSent + xfer.nDeltaSent; |
| 878 | 887 | printf(zValueFormat, "Send:", |
| 879 | 888 | blob_size(&send), nCard+xfer.nGimmeSent+xfer.nIGotSent, |
| 880 | 889 |
| --- 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 |