Fossil SCM

Detect authorization looping and exit fatally when limit exceeded.

andybradford 2014-02-01 05:02 UTC http-auth
Commit 08d487ed732e4dbb0b44e3c072a9d2efa56fc74c
1 file changed +3
+3
--- src/http.c
+++ src/http.c
@@ -202,10 +202,13 @@
202202
if( fossil_strnicmp(zLine, "http/1.", 7)==0 ){
203203
if( sscanf(zLine, "HTTP/1.%d %d", &iHttpVersion, &rc)!=2 ) goto write_err;
204204
if( rc==401 ){
205205
g.fUseHttpAuth = 1;
206206
transport_close(GLOBAL_URL());
207
+ if( --maxRedirect == 0 ){
208
+ fossil_fatal("http authorization limit exceeded");
209
+ }
207210
return http_exchange(pSend, pReply, useLogin, maxRedirect);
208211
}
209212
if( rc!=200 && rc!=302 ){
210213
int ii;
211214
for(ii=7; zLine[ii] && zLine[ii]!=' '; ii++){}
212215
--- src/http.c
+++ src/http.c
@@ -202,10 +202,13 @@
202 if( fossil_strnicmp(zLine, "http/1.", 7)==0 ){
203 if( sscanf(zLine, "HTTP/1.%d %d", &iHttpVersion, &rc)!=2 ) goto write_err;
204 if( rc==401 ){
205 g.fUseHttpAuth = 1;
206 transport_close(GLOBAL_URL());
 
 
 
207 return http_exchange(pSend, pReply, useLogin, maxRedirect);
208 }
209 if( rc!=200 && rc!=302 ){
210 int ii;
211 for(ii=7; zLine[ii] && zLine[ii]!=' '; ii++){}
212
--- src/http.c
+++ src/http.c
@@ -202,10 +202,13 @@
202 if( fossil_strnicmp(zLine, "http/1.", 7)==0 ){
203 if( sscanf(zLine, "HTTP/1.%d %d", &iHttpVersion, &rc)!=2 ) goto write_err;
204 if( rc==401 ){
205 g.fUseHttpAuth = 1;
206 transport_close(GLOBAL_URL());
207 if( --maxRedirect == 0 ){
208 fossil_fatal("http authorization limit exceeded");
209 }
210 return http_exchange(pSend, pReply, useLogin, maxRedirect);
211 }
212 if( rc!=200 && rc!=302 ){
213 int ii;
214 for(ii=7; zLine[ii] && zLine[ii]!=' '; ii++){}
215

Keyboard Shortcuts

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