Fossil SCM
In client_sync(), accept file and cfile cards only in a sync that pulls. A server could otherwise add artifacts to the client in answer to a push.
Commit
7c052d3a719382a9a7c29d9c2c384606866d133d31e4c05faf13f718f78d5953
Parent
0526c85d7b6eec2…
1 file changed
+6
-2
+6
-2
| --- src/xfer.c | ||
| +++ src/xfer.c | ||
| @@ -2563,21 +2563,25 @@ | ||
| 2563 | 2563 | /* file HASH SIZE \n CONTENT |
| 2564 | 2564 | ** file HASH DELTASRC SIZE \n CONTENT |
| 2565 | 2565 | ** |
| 2566 | 2566 | ** Client receives a file transmitted from the server. |
| 2567 | 2567 | */ |
| 2568 | - if( blob_eq(&xfer.aToken[0],"file") ){ | |
| 2568 | + if( blob_eq(&xfer.aToken[0],"file") | |
| 2569 | + && (syncFlags & (SYNC_PULL|SYNC_CLONE))!=0 | |
| 2570 | + ){ | |
| 2569 | 2571 | xfer_accept_file(&xfer, (syncFlags & SYNC_CLONE)!=0, 0, 0); |
| 2570 | 2572 | nArtifactRcvd++; |
| 2571 | 2573 | }else |
| 2572 | 2574 | |
| 2573 | 2575 | /* cfile HASH USIZE CSIZE \n CONTENT |
| 2574 | 2576 | ** cfile HASH DELTASRC USIZE CSIZE \n CONTENT |
| 2575 | 2577 | ** |
| 2576 | 2578 | ** Client receives a compressed file transmitted from the server. |
| 2577 | 2579 | */ |
| 2578 | - if( blob_eq(&xfer.aToken[0],"cfile") ){ | |
| 2580 | + if( blob_eq(&xfer.aToken[0],"cfile") | |
| 2581 | + && (syncFlags & (SYNC_PULL|SYNC_CLONE))!=0 | |
| 2582 | + ){ | |
| 2579 | 2583 | xfer_accept_compressed_file(&xfer, 0, 0); |
| 2580 | 2584 | nArtifactRcvd++; |
| 2581 | 2585 | }else |
| 2582 | 2586 | |
| 2583 | 2587 | /* uvfile NAME MTIME HASH SIZE FLAGS \n CONTENT |
| 2584 | 2588 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -2563,21 +2563,25 @@ | |
| 2563 | /* file HASH SIZE \n CONTENT |
| 2564 | ** file HASH DELTASRC SIZE \n CONTENT |
| 2565 | ** |
| 2566 | ** Client receives a file transmitted from the server. |
| 2567 | */ |
| 2568 | if( blob_eq(&xfer.aToken[0],"file") ){ |
| 2569 | xfer_accept_file(&xfer, (syncFlags & SYNC_CLONE)!=0, 0, 0); |
| 2570 | nArtifactRcvd++; |
| 2571 | }else |
| 2572 | |
| 2573 | /* cfile HASH USIZE CSIZE \n CONTENT |
| 2574 | ** cfile HASH DELTASRC USIZE CSIZE \n CONTENT |
| 2575 | ** |
| 2576 | ** Client receives a compressed file transmitted from the server. |
| 2577 | */ |
| 2578 | if( blob_eq(&xfer.aToken[0],"cfile") ){ |
| 2579 | xfer_accept_compressed_file(&xfer, 0, 0); |
| 2580 | nArtifactRcvd++; |
| 2581 | }else |
| 2582 | |
| 2583 | /* uvfile NAME MTIME HASH SIZE FLAGS \n CONTENT |
| 2584 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -2563,21 +2563,25 @@ | |
| 2563 | /* file HASH SIZE \n CONTENT |
| 2564 | ** file HASH DELTASRC SIZE \n CONTENT |
| 2565 | ** |
| 2566 | ** Client receives a file transmitted from the server. |
| 2567 | */ |
| 2568 | if( blob_eq(&xfer.aToken[0],"file") |
| 2569 | && (syncFlags & (SYNC_PULL|SYNC_CLONE))!=0 |
| 2570 | ){ |
| 2571 | xfer_accept_file(&xfer, (syncFlags & SYNC_CLONE)!=0, 0, 0); |
| 2572 | nArtifactRcvd++; |
| 2573 | }else |
| 2574 | |
| 2575 | /* cfile HASH USIZE CSIZE \n CONTENT |
| 2576 | ** cfile HASH DELTASRC USIZE CSIZE \n CONTENT |
| 2577 | ** |
| 2578 | ** Client receives a compressed file transmitted from the server. |
| 2579 | */ |
| 2580 | if( blob_eq(&xfer.aToken[0],"cfile") |
| 2581 | && (syncFlags & (SYNC_PULL|SYNC_CLONE))!=0 |
| 2582 | ){ |
| 2583 | xfer_accept_compressed_file(&xfer, 0, 0); |
| 2584 | nArtifactRcvd++; |
| 2585 | }else |
| 2586 | |
| 2587 | /* uvfile NAME MTIME HASH SIZE FLAGS \n CONTENT |
| 2588 |