Fossil SCM

Fixes to the login processing for "clone".

drh 2010-01-24 17:55 UTC trunk
Commit c4c231069e4bde488725c80689c834106a969b44
2 files changed +3 -2 +4 -1
+3 -2
--- src/http.c
+++ src/http.c
@@ -125,11 +125,11 @@
125125
**
126126
** The server address is contain in the "g" global structure. The
127127
** url_parse() routine should have been called prior to this routine
128128
** in order to fill this structure appropriately.
129129
*/
130
-void http_exchange(Blob *pSend, Blob *pReply){
130
+void http_exchange(Blob *pSend, Blob *pReply, int useLogin){
131131
Blob login; /* The login card */
132132
Blob payload; /* The complete payload including login card */
133133
Blob hdr; /* The HTTP request header */
134134
int closeConnection; /* True to close the connection when done */
135135
int iLength; /* Length of the reply payload */
@@ -141,11 +141,12 @@
141141
if( transport_open() ){
142142
fossil_fatal(transport_errmsg());
143143
}
144144
145145
/* Construct the login card and prepare the complete payload */
146
- http_build_login_card(pSend, &login);
146
+ blob_zero(&login);
147
+ if( useLogin ) http_build_login_card(pSend, &login);
147148
if( g.fHttpTrace ){
148149
payload = login;
149150
blob_append(&payload, blob_buffer(pSend), blob_size(pSend));
150151
}else{
151152
blob_compress2(&login, pSend, &payload);
152153
--- src/http.c
+++ src/http.c
@@ -125,11 +125,11 @@
125 **
126 ** The server address is contain in the "g" global structure. The
127 ** url_parse() routine should have been called prior to this routine
128 ** in order to fill this structure appropriately.
129 */
130 void http_exchange(Blob *pSend, Blob *pReply){
131 Blob login; /* The login card */
132 Blob payload; /* The complete payload including login card */
133 Blob hdr; /* The HTTP request header */
134 int closeConnection; /* True to close the connection when done */
135 int iLength; /* Length of the reply payload */
@@ -141,11 +141,12 @@
141 if( transport_open() ){
142 fossil_fatal(transport_errmsg());
143 }
144
145 /* Construct the login card and prepare the complete payload */
146 http_build_login_card(pSend, &login);
 
147 if( g.fHttpTrace ){
148 payload = login;
149 blob_append(&payload, blob_buffer(pSend), blob_size(pSend));
150 }else{
151 blob_compress2(&login, pSend, &payload);
152
--- src/http.c
+++ src/http.c
@@ -125,11 +125,11 @@
125 **
126 ** The server address is contain in the "g" global structure. The
127 ** url_parse() routine should have been called prior to this routine
128 ** in order to fill this structure appropriately.
129 */
130 void http_exchange(Blob *pSend, Blob *pReply, int useLogin){
131 Blob login; /* The login card */
132 Blob payload; /* The complete payload including login card */
133 Blob hdr; /* The HTTP request header */
134 int closeConnection; /* True to close the connection when done */
135 int iLength; /* Length of the reply payload */
@@ -141,11 +141,12 @@
141 if( transport_open() ){
142 fossil_fatal(transport_errmsg());
143 }
144
145 /* Construct the login card and prepare the complete payload */
146 blob_zero(&login);
147 if( useLogin ) http_build_login_card(pSend, &login);
148 if( g.fHttpTrace ){
149 payload = login;
150 blob_append(&payload, blob_buffer(pSend), blob_size(pSend));
151 }else{
152 blob_compress2(&login, pSend, &payload);
153
+4 -1
--- src/xfer.c
+++ src/xfer.c
@@ -386,10 +386,13 @@
386386
Stmt q;
387387
int rc = -1;
388388
char *zLogin = blob_terminate(pLogin);
389389
defossilize(zLogin);
390390
391
+ if( strcmp(zLogin, "nobody")==0 || strcmp(zLogin,"anonymous")==0 ){
392
+ return 0; /* Anybody is allowed to sync as "nobody" or "anonymous" */
393
+ }
391394
db_prepare(&q,
392395
"SELECT pw, cap, uid FROM user"
393396
" WHERE login=%Q"
394397
" AND login NOT IN ('anonymous','nobody','developer','reader')"
395398
" AND length(pw)>0",
@@ -1062,11 +1065,11 @@
10621065
nCardRcvd = 0;
10631066
xfer.nFileSent = 0;
10641067
xfer.nDeltaSent = 0;
10651068
xfer.nGimmeSent = 0;
10661069
fflush(stdout);
1067
- http_exchange(&send, &recv);
1070
+ http_exchange(&send, &recv, cloneFlag==0 || nCycle>0);
10681071
blob_reset(&send);
10691072
10701073
/* Begin constructing the next message (which might never be
10711074
** sent) by beginning with the pull or push cards
10721075
*/
10731076
--- src/xfer.c
+++ src/xfer.c
@@ -386,10 +386,13 @@
386 Stmt q;
387 int rc = -1;
388 char *zLogin = blob_terminate(pLogin);
389 defossilize(zLogin);
390
 
 
 
391 db_prepare(&q,
392 "SELECT pw, cap, uid FROM user"
393 " WHERE login=%Q"
394 " AND login NOT IN ('anonymous','nobody','developer','reader')"
395 " AND length(pw)>0",
@@ -1062,11 +1065,11 @@
1062 nCardRcvd = 0;
1063 xfer.nFileSent = 0;
1064 xfer.nDeltaSent = 0;
1065 xfer.nGimmeSent = 0;
1066 fflush(stdout);
1067 http_exchange(&send, &recv);
1068 blob_reset(&send);
1069
1070 /* Begin constructing the next message (which might never be
1071 ** sent) by beginning with the pull or push cards
1072 */
1073
--- src/xfer.c
+++ src/xfer.c
@@ -386,10 +386,13 @@
386 Stmt q;
387 int rc = -1;
388 char *zLogin = blob_terminate(pLogin);
389 defossilize(zLogin);
390
391 if( strcmp(zLogin, "nobody")==0 || strcmp(zLogin,"anonymous")==0 ){
392 return 0; /* Anybody is allowed to sync as "nobody" or "anonymous" */
393 }
394 db_prepare(&q,
395 "SELECT pw, cap, uid FROM user"
396 " WHERE login=%Q"
397 " AND login NOT IN ('anonymous','nobody','developer','reader')"
398 " AND length(pw)>0",
@@ -1062,11 +1065,11 @@
1065 nCardRcvd = 0;
1066 xfer.nFileSent = 0;
1067 xfer.nDeltaSent = 0;
1068 xfer.nGimmeSent = 0;
1069 fflush(stdout);
1070 http_exchange(&send, &recv, cloneFlag==0 || nCycle>0);
1071 blob_reset(&send);
1072
1073 /* Begin constructing the next message (which might never be
1074 ** sent) by beginning with the pull or push cards
1075 */
1076

Keyboard Shortcuts

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