Fossil SCM
Fixes to the login processing for "clone".
Commit
c4c231069e4bde488725c80689c834106a969b44
Parent
6bbb22d4fa4285e…
2 files changed
+3
-2
+4
-1
+3
-2
| --- src/http.c | ||
| +++ src/http.c | ||
| @@ -125,11 +125,11 @@ | ||
| 125 | 125 | ** |
| 126 | 126 | ** The server address is contain in the "g" global structure. The |
| 127 | 127 | ** url_parse() routine should have been called prior to this routine |
| 128 | 128 | ** in order to fill this structure appropriately. |
| 129 | 129 | */ |
| 130 | -void http_exchange(Blob *pSend, Blob *pReply){ | |
| 130 | +void http_exchange(Blob *pSend, Blob *pReply, int useLogin){ | |
| 131 | 131 | Blob login; /* The login card */ |
| 132 | 132 | Blob payload; /* The complete payload including login card */ |
| 133 | 133 | Blob hdr; /* The HTTP request header */ |
| 134 | 134 | int closeConnection; /* True to close the connection when done */ |
| 135 | 135 | int iLength; /* Length of the reply payload */ |
| @@ -141,11 +141,12 @@ | ||
| 141 | 141 | if( transport_open() ){ |
| 142 | 142 | fossil_fatal(transport_errmsg()); |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | /* 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); | |
| 147 | 148 | if( g.fHttpTrace ){ |
| 148 | 149 | payload = login; |
| 149 | 150 | blob_append(&payload, blob_buffer(pSend), blob_size(pSend)); |
| 150 | 151 | }else{ |
| 151 | 152 | blob_compress2(&login, pSend, &payload); |
| 152 | 153 |
| --- 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 @@ | ||
| 386 | 386 | Stmt q; |
| 387 | 387 | int rc = -1; |
| 388 | 388 | char *zLogin = blob_terminate(pLogin); |
| 389 | 389 | defossilize(zLogin); |
| 390 | 390 | |
| 391 | + if( strcmp(zLogin, "nobody")==0 || strcmp(zLogin,"anonymous")==0 ){ | |
| 392 | + return 0; /* Anybody is allowed to sync as "nobody" or "anonymous" */ | |
| 393 | + } | |
| 391 | 394 | db_prepare(&q, |
| 392 | 395 | "SELECT pw, cap, uid FROM user" |
| 393 | 396 | " WHERE login=%Q" |
| 394 | 397 | " AND login NOT IN ('anonymous','nobody','developer','reader')" |
| 395 | 398 | " AND length(pw)>0", |
| @@ -1062,11 +1065,11 @@ | ||
| 1062 | 1065 | nCardRcvd = 0; |
| 1063 | 1066 | xfer.nFileSent = 0; |
| 1064 | 1067 | xfer.nDeltaSent = 0; |
| 1065 | 1068 | xfer.nGimmeSent = 0; |
| 1066 | 1069 | fflush(stdout); |
| 1067 | - http_exchange(&send, &recv); | |
| 1070 | + http_exchange(&send, &recv, cloneFlag==0 || nCycle>0); | |
| 1068 | 1071 | blob_reset(&send); |
| 1069 | 1072 | |
| 1070 | 1073 | /* Begin constructing the next message (which might never be |
| 1071 | 1074 | ** sent) by beginning with the pull or push cards |
| 1072 | 1075 | */ |
| 1073 | 1076 |
| --- 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 |