Fossil SCM

Fix issues with file-to-file sync. Allow --localauth to enable --private syncing.

drh 2011-02-27 21:03 UTC private-sync
Commit bbf257dc9e633c29c6b2d2cae8f5c7da50e43241
--- src/http_transport.c
+++ src/http_transport.c
@@ -302,11 +302,11 @@
302302
if( g.urlIsSsh ){
303303
fprintf(sshOut, "\n\n");
304304
}else if( g.urlIsFile ){
305305
char *zCmd;
306306
fclose(transport.pFile);
307
- zCmd = mprintf("\"%s\" http \"%s\" \"%s\" \"%s\" 127.0.0.1",
307
+ zCmd = mprintf("\"%s\" http \"%s\" \"%s\" \"%s\" 127.0.0.1 --localauth",
308308
fossil_nameofexe(), g.urlName, transport.zOutFile, transport.zInFile
309309
);
310310
fossil_system(zCmd);
311311
free(zCmd);
312312
transport.pFile = fopen(transport.zInFile, "rb");
313313
--- src/http_transport.c
+++ src/http_transport.c
@@ -302,11 +302,11 @@
302 if( g.urlIsSsh ){
303 fprintf(sshOut, "\n\n");
304 }else if( g.urlIsFile ){
305 char *zCmd;
306 fclose(transport.pFile);
307 zCmd = mprintf("\"%s\" http \"%s\" \"%s\" \"%s\" 127.0.0.1",
308 fossil_nameofexe(), g.urlName, transport.zOutFile, transport.zInFile
309 );
310 fossil_system(zCmd);
311 free(zCmd);
312 transport.pFile = fopen(transport.zInFile, "rb");
313
--- src/http_transport.c
+++ src/http_transport.c
@@ -302,11 +302,11 @@
302 if( g.urlIsSsh ){
303 fprintf(sshOut, "\n\n");
304 }else if( g.urlIsFile ){
305 char *zCmd;
306 fclose(transport.pFile);
307 zCmd = mprintf("\"%s\" http \"%s\" \"%s\" \"%s\" 127.0.0.1 --localauth",
308 fossil_nameofexe(), g.urlName, transport.zOutFile, transport.zInFile
309 );
310 fossil_system(zCmd);
311 free(zCmd);
312 transport.pFile = fopen(transport.zInFile, "rb");
313
+4
--- src/xfer.c
+++ src/xfer.c
@@ -423,13 +423,15 @@
423423
pXfer->nDeltaSent++;
424424
}
425425
}
426426
remote_has(rid);
427427
blob_reset(&uuid);
428
+#if 0
428429
if( blob_buffer(pXfer->pOut)[blob_size(pXfer->pOut)-1]!='\n' ){
429430
blob_appendf(pXfer->pOut, "\n", 1);
430431
}
432
+#endif
431433
}
432434
433435
/*
434436
** Send the file identified by rid as a compressed artifact. Basically,
435437
** send the content exactly as it appears in the BLOB table using
@@ -821,10 +823,11 @@
821823
"CREATE TEMP TABLE onremote(rid INTEGER PRIMARY KEY);"
822824
);
823825
manifest_crosslink_begin();
824826
while( blob_line(xfer.pIn, &xfer.line) ){
825827
if( blob_buffer(&xfer.line)[0]=='#' ) continue;
828
+ if( blob_size(&xfer.line)==0 ) continue;
826829
xfer.nToken = blob_tokenize(&xfer.line, xfer.aToken, count(xfer.aToken));
827830
828831
/* file UUID SIZE \n CONTENT
829832
** file UUID DELTASRC SIZE \n CONTENT
830833
**
@@ -1129,10 +1132,11 @@
11291132
** If the user has the "x" privilege (which must be set explicitly -
11301133
** it is not automatic with "a" or "s") then this pragma causes
11311134
** private information to be pulled in addition to public records.
11321135
*/
11331136
if( blob_eq(&xfer.aToken[1], "send-private") ){
1137
+ login_check_credentials();
11341138
if( !g.okPrivate ){
11351139
server_private_xfer_not_authorized();
11361140
}else{
11371141
xfer.syncPrivate = 1;
11381142
}
11391143
--- src/xfer.c
+++ src/xfer.c
@@ -423,13 +423,15 @@
423 pXfer->nDeltaSent++;
424 }
425 }
426 remote_has(rid);
427 blob_reset(&uuid);
 
428 if( blob_buffer(pXfer->pOut)[blob_size(pXfer->pOut)-1]!='\n' ){
429 blob_appendf(pXfer->pOut, "\n", 1);
430 }
 
431 }
432
433 /*
434 ** Send the file identified by rid as a compressed artifact. Basically,
435 ** send the content exactly as it appears in the BLOB table using
@@ -821,10 +823,11 @@
821 "CREATE TEMP TABLE onremote(rid INTEGER PRIMARY KEY);"
822 );
823 manifest_crosslink_begin();
824 while( blob_line(xfer.pIn, &xfer.line) ){
825 if( blob_buffer(&xfer.line)[0]=='#' ) continue;
 
826 xfer.nToken = blob_tokenize(&xfer.line, xfer.aToken, count(xfer.aToken));
827
828 /* file UUID SIZE \n CONTENT
829 ** file UUID DELTASRC SIZE \n CONTENT
830 **
@@ -1129,10 +1132,11 @@
1129 ** If the user has the "x" privilege (which must be set explicitly -
1130 ** it is not automatic with "a" or "s") then this pragma causes
1131 ** private information to be pulled in addition to public records.
1132 */
1133 if( blob_eq(&xfer.aToken[1], "send-private") ){
 
1134 if( !g.okPrivate ){
1135 server_private_xfer_not_authorized();
1136 }else{
1137 xfer.syncPrivate = 1;
1138 }
1139
--- src/xfer.c
+++ src/xfer.c
@@ -423,13 +423,15 @@
423 pXfer->nDeltaSent++;
424 }
425 }
426 remote_has(rid);
427 blob_reset(&uuid);
428 #if 0
429 if( blob_buffer(pXfer->pOut)[blob_size(pXfer->pOut)-1]!='\n' ){
430 blob_appendf(pXfer->pOut, "\n", 1);
431 }
432 #endif
433 }
434
435 /*
436 ** Send the file identified by rid as a compressed artifact. Basically,
437 ** send the content exactly as it appears in the BLOB table using
@@ -821,10 +823,11 @@
823 "CREATE TEMP TABLE onremote(rid INTEGER PRIMARY KEY);"
824 );
825 manifest_crosslink_begin();
826 while( blob_line(xfer.pIn, &xfer.line) ){
827 if( blob_buffer(&xfer.line)[0]=='#' ) continue;
828 if( blob_size(&xfer.line)==0 ) continue;
829 xfer.nToken = blob_tokenize(&xfer.line, xfer.aToken, count(xfer.aToken));
830
831 /* file UUID SIZE \n CONTENT
832 ** file UUID DELTASRC SIZE \n CONTENT
833 **
@@ -1129,10 +1132,11 @@
1132 ** If the user has the "x" privilege (which must be set explicitly -
1133 ** it is not automatic with "a" or "s") then this pragma causes
1134 ** private information to be pulled in addition to public records.
1135 */
1136 if( blob_eq(&xfer.aToken[1], "send-private") ){
1137 login_check_credentials();
1138 if( !g.okPrivate ){
1139 server_private_xfer_not_authorized();
1140 }else{
1141 xfer.syncPrivate = 1;
1142 }
1143

Keyboard Shortcuts

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