Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Improve the validation of the sequence number in clone messages in the sync protocol. |
|---|---|
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
295b396036097842e322aaa2a24ea886 |
| User & Date: | stephan 2024-09-23 22:06:18.131 |
Context
|
2024-09-24
| ||
| 11:13 | More work on making the xfer protocol fail fast for certain invalid inputs. check-in: f9f90d9b15 user: stephan tags: trunk | |
|
2024-09-23
| ||
| 22:06 | Improve the validation of the sequence number in clone messages in the sync protocol. check-in: 295b396036 user: stephan tags: trunk | |
|
2024-09-21
| ||
| 15:59 | Update the built-in SQLite to the latest trunk version for testing. check-in: 5de7ce9a06 user: drh tags: trunk | |
Changes
Changes to src/xfer.c.
| ︙ | ︙ | |||
1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 |
/*
** Return the TH1 code to evaluate when a ticket change is processed.
*/
const char *xfer_ticket_code(void){
return db_get("xfer-ticket-script", 0);
}
/*
** Run the specified TH1 script, if any, and returns 1 on error.
*/
int xfer_run_script(
const char *zScript,
const char *zUuidOrList,
| > > > > > > > > > > > > > | 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 |
/*
** Return the TH1 code to evaluate when a ticket change is processed.
*/
const char *xfer_ticket_code(void){
return db_get("xfer-ticket-script", 0);
}
/*
** Reset the CGI content, roll back any pending db transaction, and
** emit an "error" xfer message, which must be pre-fossilized by the
** caller.
*/
static void xfer_error(const char *zFossilizedMsg){
cgi_reset_content();
if( db_transaction_nesting_depth() > 0 ){
db_rollback_transaction();
}
@ error %s(zFossilizedMsg)
}
/*
** Run the specified TH1 script, if any, and returns 1 on error.
*/
int xfer_run_script(
const char *zScript,
const char *zUuidOrList,
|
| ︙ | ︙ | |||
1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 |
&& iVers>=2
){
int seqno, max;
if( iVers>=3 ){
cgi_set_content_type("application/x-fossil-uncompressed");
}
blob_is_int(&xfer.aToken[2], &seqno);
max = db_int(0, "SELECT max(rid) FROM blob");
while( xfer.mxSend>(int)blob_size(xfer.pOut) && seqno<=max){
if( time(NULL) >= xfer.maxTime ) break;
if( iVers>=3 ){
send_compressed_file(&xfer, seqno);
}else{
send_file(&xfer, seqno, 0, 1);
| > > > > | 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 |
&& iVers>=2
){
int seqno, max;
if( iVers>=3 ){
cgi_set_content_type("application/x-fossil-uncompressed");
}
blob_is_int(&xfer.aToken[2], &seqno);
if( seqno<=0 ){
xfer_error("invalid\\sclone\\ssequence\\snumber");
return;
}
max = db_int(0, "SELECT max(rid) FROM blob");
while( xfer.mxSend>(int)blob_size(xfer.pOut) && seqno<=max){
if( time(NULL) >= xfer.maxTime ) break;
if( iVers>=3 ){
send_compressed_file(&xfer, seqno);
}else{
send_file(&xfer, seqno, 0, 1);
|
| ︙ | ︙ | |||
1842 1843 1844 1845 1846 1847 1848 |
}
/* Send the server timestamp last, in case prior processing happened
** to use up a significant fraction of our time window.
*/
zNow = db_text(0, "SELECT strftime('%%Y-%%m-%%dT%%H:%%M:%%S', 'now')");
@ # timestamp %s(zNow) errors %d(nErr)
| | | 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 |
}
/* Send the server timestamp last, in case prior processing happened
** to use up a significant fraction of our time window.
*/
zNow = db_text(0, "SELECT strftime('%%Y-%%m-%%dT%%H:%%M:%%S', 'now')");
@ # timestamp %s(zNow) errors %d(nErr)
fossil_free(zNow);
db_commit_transaction();
configure_rebuild();
}
/*
** COMMAND: test-xfer
|
| ︙ | ︙ |