Fossil SCM
Get "configuration push" working. Fix bugs in concealed-field processing of tickets.
Commit
31e94c0a04f2a50007ca6d4dc771cbb532fb4bf1
Parent
6b0b57a924b6643…
5 files changed
+1
-1
+1
-1
+5
-4
+9
-7
+3
-2
+1
-1
| --- src/encode.c | ||
| +++ src/encode.c | ||
| @@ -291,11 +291,11 @@ | ||
| 291 | 291 | default: c = z[i]; break; |
| 292 | 292 | } |
| 293 | 293 | } |
| 294 | 294 | z[j++] = c; |
| 295 | 295 | } |
| 296 | - z[j] = 0; | |
| 296 | + if( z[j] ) z[j] = 0; | |
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | |
| 300 | 300 | /* |
| 301 | 301 | ** The characters used for HTTP base64 encoding. |
| 302 | 302 |
| --- src/encode.c | |
| +++ src/encode.c | |
| @@ -291,11 +291,11 @@ | |
| 291 | default: c = z[i]; break; |
| 292 | } |
| 293 | } |
| 294 | z[j++] = c; |
| 295 | } |
| 296 | z[j] = 0; |
| 297 | } |
| 298 | |
| 299 | |
| 300 | /* |
| 301 | ** The characters used for HTTP base64 encoding. |
| 302 |
| --- src/encode.c | |
| +++ src/encode.c | |
| @@ -291,11 +291,11 @@ | |
| 291 | default: c = z[i]; break; |
| 292 | } |
| 293 | } |
| 294 | z[j++] = c; |
| 295 | } |
| 296 | if( z[j] ) z[j] = 0; |
| 297 | } |
| 298 | |
| 299 | |
| 300 | /* |
| 301 | ** The characters used for HTTP base64 encoding. |
| 302 |
+1
-1
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -708,11 +708,11 @@ | ||
| 708 | 708 | int iPort; |
| 709 | 709 | const char *zPort; |
| 710 | 710 | char *zBrowser; |
| 711 | 711 | char *zBrowserCmd = 0; |
| 712 | 712 | |
| 713 | - g.thTrace = find_option("th_trace", 0, 0)!=0; | |
| 713 | + g.thTrace = find_option("th-trace", 0, 0)!=0; | |
| 714 | 714 | if( g.thTrace ){ |
| 715 | 715 | blob_zero(&g.thLog); |
| 716 | 716 | } |
| 717 | 717 | zPort = find_option("port", "P", 1); |
| 718 | 718 | if( zPort ){ |
| 719 | 719 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -708,11 +708,11 @@ | |
| 708 | int iPort; |
| 709 | const char *zPort; |
| 710 | char *zBrowser; |
| 711 | char *zBrowserCmd = 0; |
| 712 | |
| 713 | g.thTrace = find_option("th_trace", 0, 0)!=0; |
| 714 | if( g.thTrace ){ |
| 715 | blob_zero(&g.thLog); |
| 716 | } |
| 717 | zPort = find_option("port", "P", 1); |
| 718 | if( zPort ){ |
| 719 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -708,11 +708,11 @@ | |
| 708 | int iPort; |
| 709 | const char *zPort; |
| 710 | char *zBrowser; |
| 711 | char *zBrowserCmd = 0; |
| 712 | |
| 713 | g.thTrace = find_option("th-trace", 0, 0)!=0; |
| 714 | if( g.thTrace ){ |
| 715 | blob_zero(&g.thLog); |
| 716 | } |
| 717 | zPort = find_option("port", "P", 1); |
| 718 | if( zPort ){ |
| 719 |
+5
-4
| --- src/manifest.c | ||
| +++ src/manifest.c | ||
| @@ -317,21 +317,22 @@ | ||
| 317 | 317 | } |
| 318 | 318 | break; |
| 319 | 319 | } |
| 320 | 320 | |
| 321 | 321 | /* |
| 322 | - ** J '+'?<name> <value> | |
| 322 | + ** J <name> ?<value>? | |
| 323 | 323 | ** |
| 324 | 324 | ** Specifies a name value pair for ticket. If the first character |
| 325 | - ** of <name> is "+" then the value is appended to any preexisting | |
| 326 | - ** value. | |
| 325 | + ** of <name> is "+" then the <value> is appended to any preexisting | |
| 326 | + ** value. If <value> is omitted then it is understood to be an | |
| 327 | + ** empty string. | |
| 327 | 328 | */ |
| 328 | 329 | case 'J': { |
| 329 | 330 | char *zName, *zValue; |
| 330 | 331 | md5sum_step_text(blob_buffer(&line), blob_size(&line)); |
| 331 | 332 | if( blob_token(&line, &a1)==0 ) goto manifest_syntax_error; |
| 332 | - if( blob_token(&line, &a2)==0 ) goto manifest_syntax_error; | |
| 333 | + blob_token(&line, &a2); | |
| 333 | 334 | if( blob_token(&line, &a3)!=0 ) goto manifest_syntax_error; |
| 334 | 335 | zName = blob_terminate(&a1); |
| 335 | 336 | zValue = blob_terminate(&a2); |
| 336 | 337 | defossilize(zValue); |
| 337 | 338 | if( p->nField>=p->nFieldAlloc ){ |
| 338 | 339 |
| --- src/manifest.c | |
| +++ src/manifest.c | |
| @@ -317,21 +317,22 @@ | |
| 317 | } |
| 318 | break; |
| 319 | } |
| 320 | |
| 321 | /* |
| 322 | ** J '+'?<name> <value> |
| 323 | ** |
| 324 | ** Specifies a name value pair for ticket. If the first character |
| 325 | ** of <name> is "+" then the value is appended to any preexisting |
| 326 | ** value. |
| 327 | */ |
| 328 | case 'J': { |
| 329 | char *zName, *zValue; |
| 330 | md5sum_step_text(blob_buffer(&line), blob_size(&line)); |
| 331 | if( blob_token(&line, &a1)==0 ) goto manifest_syntax_error; |
| 332 | if( blob_token(&line, &a2)==0 ) goto manifest_syntax_error; |
| 333 | if( blob_token(&line, &a3)!=0 ) goto manifest_syntax_error; |
| 334 | zName = blob_terminate(&a1); |
| 335 | zValue = blob_terminate(&a2); |
| 336 | defossilize(zValue); |
| 337 | if( p->nField>=p->nFieldAlloc ){ |
| 338 |
| --- src/manifest.c | |
| +++ src/manifest.c | |
| @@ -317,21 +317,22 @@ | |
| 317 | } |
| 318 | break; |
| 319 | } |
| 320 | |
| 321 | /* |
| 322 | ** J <name> ?<value>? |
| 323 | ** |
| 324 | ** Specifies a name value pair for ticket. If the first character |
| 325 | ** of <name> is "+" then the <value> is appended to any preexisting |
| 326 | ** value. If <value> is omitted then it is understood to be an |
| 327 | ** empty string. |
| 328 | */ |
| 329 | case 'J': { |
| 330 | char *zName, *zValue; |
| 331 | md5sum_step_text(blob_buffer(&line), blob_size(&line)); |
| 332 | if( blob_token(&line, &a1)==0 ) goto manifest_syntax_error; |
| 333 | blob_token(&line, &a2); |
| 334 | if( blob_token(&line, &a3)!=0 ) goto manifest_syntax_error; |
| 335 | zName = blob_terminate(&a1); |
| 336 | zValue = blob_terminate(&a2); |
| 337 | defossilize(zValue); |
| 338 | if( p->nField>=p->nFieldAlloc ){ |
| 339 |
+9
-7
| --- src/tkt.c | ||
| +++ src/tkt.c | ||
| @@ -98,12 +98,13 @@ | ||
| 98 | 98 | ** |
| 99 | 99 | ** Only load those fields which do not already exist as |
| 100 | 100 | ** variables. |
| 101 | 101 | ** |
| 102 | 102 | ** Fields of the TICKET table that begin with "private_" are |
| 103 | -** expanded using the db_reveal() function. This function will | |
| 104 | -** decode the content so that it is legable if g.okRdAddr is true. | |
| 103 | +** expanded using the db_reveal() function. If g.okRdAddr is | |
| 104 | +** true, then the db_reveal() function will decode the content | |
| 105 | +** using the CONCEALED table so that the content legable. | |
| 105 | 106 | ** Otherwise, db_reveal() is a no-op and the content remains |
| 106 | 107 | ** obscured. |
| 107 | 108 | */ |
| 108 | 109 | static void initializeVariablesFromDb(void){ |
| 109 | 110 | const char *zName; |
| @@ -417,16 +418,17 @@ | ||
| 417 | 418 | fossilize(azAppend[i], -1)); |
| 418 | 419 | }else{ |
| 419 | 420 | zValue = Th_Fetch(azField[i], &nValue); |
| 420 | 421 | if( zValue ){ |
| 421 | 422 | while( nValue>0 && isspace(zValue[nValue-1]) ){ nValue--; } |
| 422 | - if( strncmp(azField[i], "private_", 8)==0 ){ | |
| 423 | - zValue = db_conceal(zValue, nValue); | |
| 424 | - nValue = strlen(zValue); | |
| 425 | - } | |
| 426 | 423 | if( strncmp(zValue, azValue[i], nValue) || strlen(azValue[i])!=nValue ){ |
| 427 | - blob_appendf(&tktchng, "J %s %#F\n", azField[i], nValue, zValue); | |
| 424 | + if( strncmp(azField[i], "private_", 8)==0 ){ | |
| 425 | + zValue = db_conceal(zValue, nValue); | |
| 426 | + blob_appendf(&tktchng, "J %s %s\n", azField[i], zValue); | |
| 427 | + }else{ | |
| 428 | + blob_appendf(&tktchng, "J %s %#F\n", azField[i], nValue, zValue); | |
| 429 | + } | |
| 428 | 430 | } |
| 429 | 431 | } |
| 430 | 432 | } |
| 431 | 433 | } |
| 432 | 434 | if( *(char**)pUuid ){ |
| 433 | 435 |
| --- src/tkt.c | |
| +++ src/tkt.c | |
| @@ -98,12 +98,13 @@ | |
| 98 | ** |
| 99 | ** Only load those fields which do not already exist as |
| 100 | ** variables. |
| 101 | ** |
| 102 | ** Fields of the TICKET table that begin with "private_" are |
| 103 | ** expanded using the db_reveal() function. This function will |
| 104 | ** decode the content so that it is legable if g.okRdAddr is true. |
| 105 | ** Otherwise, db_reveal() is a no-op and the content remains |
| 106 | ** obscured. |
| 107 | */ |
| 108 | static void initializeVariablesFromDb(void){ |
| 109 | const char *zName; |
| @@ -417,16 +418,17 @@ | |
| 417 | fossilize(azAppend[i], -1)); |
| 418 | }else{ |
| 419 | zValue = Th_Fetch(azField[i], &nValue); |
| 420 | if( zValue ){ |
| 421 | while( nValue>0 && isspace(zValue[nValue-1]) ){ nValue--; } |
| 422 | if( strncmp(azField[i], "private_", 8)==0 ){ |
| 423 | zValue = db_conceal(zValue, nValue); |
| 424 | nValue = strlen(zValue); |
| 425 | } |
| 426 | if( strncmp(zValue, azValue[i], nValue) || strlen(azValue[i])!=nValue ){ |
| 427 | blob_appendf(&tktchng, "J %s %#F\n", azField[i], nValue, zValue); |
| 428 | } |
| 429 | } |
| 430 | } |
| 431 | } |
| 432 | if( *(char**)pUuid ){ |
| 433 |
| --- src/tkt.c | |
| +++ src/tkt.c | |
| @@ -98,12 +98,13 @@ | |
| 98 | ** |
| 99 | ** Only load those fields which do not already exist as |
| 100 | ** variables. |
| 101 | ** |
| 102 | ** Fields of the TICKET table that begin with "private_" are |
| 103 | ** expanded using the db_reveal() function. If g.okRdAddr is |
| 104 | ** true, then the db_reveal() function will decode the content |
| 105 | ** using the CONCEALED table so that the content legable. |
| 106 | ** Otherwise, db_reveal() is a no-op and the content remains |
| 107 | ** obscured. |
| 108 | */ |
| 109 | static void initializeVariablesFromDb(void){ |
| 110 | const char *zName; |
| @@ -417,16 +418,17 @@ | |
| 418 | fossilize(azAppend[i], -1)); |
| 419 | }else{ |
| 420 | zValue = Th_Fetch(azField[i], &nValue); |
| 421 | if( zValue ){ |
| 422 | while( nValue>0 && isspace(zValue[nValue-1]) ){ nValue--; } |
| 423 | if( strncmp(zValue, azValue[i], nValue) || strlen(azValue[i])!=nValue ){ |
| 424 | if( strncmp(azField[i], "private_", 8)==0 ){ |
| 425 | zValue = db_conceal(zValue, nValue); |
| 426 | blob_appendf(&tktchng, "J %s %s\n", azField[i], zValue); |
| 427 | }else{ |
| 428 | blob_appendf(&tktchng, "J %s %#F\n", azField[i], nValue, zValue); |
| 429 | } |
| 430 | } |
| 431 | } |
| 432 | } |
| 433 | } |
| 434 | if( *(char**)pUuid ){ |
| 435 |
+3
-2
| --- src/xfer.c | ||
| +++ src/xfer.c | ||
| @@ -390,11 +390,11 @@ | ||
| 390 | 390 | g.userUid = db_column_int(&q, 2); |
| 391 | 391 | g.zLogin = mprintf("%b", pLogin); |
| 392 | 392 | g.zNonce = mprintf("%b", pNonce); |
| 393 | 393 | } |
| 394 | 394 | } |
| 395 | - db_reset(&q); | |
| 395 | + db_finalize(&q); | |
| 396 | 396 | } |
| 397 | 397 | |
| 398 | 398 | /* |
| 399 | 399 | ** Send the content of all files in the unsent table. |
| 400 | 400 | ** |
| @@ -720,11 +720,11 @@ | ||
| 720 | 720 | Blob content; |
| 721 | 721 | blob_zero(&content); |
| 722 | 722 | blob_extract(xfer.pIn, size, &content); |
| 723 | 723 | if( !g.okAdmin ){ |
| 724 | 724 | cgi_reset_content(); |
| 725 | - @ error not\sauthorized\sto\spush\sconfiguration\data | |
| 725 | + @ error not\sauthorized\sto\spush\sconfiguration | |
| 726 | 726 | nErr++; |
| 727 | 727 | break; |
| 728 | 728 | } |
| 729 | 729 | if( zName[0]!='@' ){ |
| 730 | 730 | if( !recvConfig ){ |
| @@ -1077,10 +1077,11 @@ | ||
| 1077 | 1077 | && blob_is_int(&xfer.aToken[2], &size) ){ |
| 1078 | 1078 | const char *zName = blob_str(&xfer.aToken[1]); |
| 1079 | 1079 | Blob content; |
| 1080 | 1080 | blob_zero(&content); |
| 1081 | 1081 | blob_extract(xfer.pIn, size, &content); |
| 1082 | + g.okAdmin = g.okRdAddr = 1; | |
| 1082 | 1083 | if( configure_is_exportable(zName) & origConfigRcvMask ){ |
| 1083 | 1084 | if( zName[0]!='@' ){ |
| 1084 | 1085 | db_multi_exec( |
| 1085 | 1086 | "REPLACE INTO config(name,value) VALUES(%Q,%Q)", |
| 1086 | 1087 | zName, blob_str(&content) |
| 1087 | 1088 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -390,11 +390,11 @@ | |
| 390 | g.userUid = db_column_int(&q, 2); |
| 391 | g.zLogin = mprintf("%b", pLogin); |
| 392 | g.zNonce = mprintf("%b", pNonce); |
| 393 | } |
| 394 | } |
| 395 | db_reset(&q); |
| 396 | } |
| 397 | |
| 398 | /* |
| 399 | ** Send the content of all files in the unsent table. |
| 400 | ** |
| @@ -720,11 +720,11 @@ | |
| 720 | Blob content; |
| 721 | blob_zero(&content); |
| 722 | blob_extract(xfer.pIn, size, &content); |
| 723 | if( !g.okAdmin ){ |
| 724 | cgi_reset_content(); |
| 725 | @ error not\sauthorized\sto\spush\sconfiguration\data |
| 726 | nErr++; |
| 727 | break; |
| 728 | } |
| 729 | if( zName[0]!='@' ){ |
| 730 | if( !recvConfig ){ |
| @@ -1077,10 +1077,11 @@ | |
| 1077 | && blob_is_int(&xfer.aToken[2], &size) ){ |
| 1078 | const char *zName = blob_str(&xfer.aToken[1]); |
| 1079 | Blob content; |
| 1080 | blob_zero(&content); |
| 1081 | blob_extract(xfer.pIn, size, &content); |
| 1082 | if( configure_is_exportable(zName) & origConfigRcvMask ){ |
| 1083 | if( zName[0]!='@' ){ |
| 1084 | db_multi_exec( |
| 1085 | "REPLACE INTO config(name,value) VALUES(%Q,%Q)", |
| 1086 | zName, blob_str(&content) |
| 1087 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -390,11 +390,11 @@ | |
| 390 | g.userUid = db_column_int(&q, 2); |
| 391 | g.zLogin = mprintf("%b", pLogin); |
| 392 | g.zNonce = mprintf("%b", pNonce); |
| 393 | } |
| 394 | } |
| 395 | db_finalize(&q); |
| 396 | } |
| 397 | |
| 398 | /* |
| 399 | ** Send the content of all files in the unsent table. |
| 400 | ** |
| @@ -720,11 +720,11 @@ | |
| 720 | Blob content; |
| 721 | blob_zero(&content); |
| 722 | blob_extract(xfer.pIn, size, &content); |
| 723 | if( !g.okAdmin ){ |
| 724 | cgi_reset_content(); |
| 725 | @ error not\sauthorized\sto\spush\sconfiguration |
| 726 | nErr++; |
| 727 | break; |
| 728 | } |
| 729 | if( zName[0]!='@' ){ |
| 730 | if( !recvConfig ){ |
| @@ -1077,10 +1077,11 @@ | |
| 1077 | && blob_is_int(&xfer.aToken[2], &size) ){ |
| 1078 | const char *zName = blob_str(&xfer.aToken[1]); |
| 1079 | Blob content; |
| 1080 | blob_zero(&content); |
| 1081 | blob_extract(xfer.pIn, size, &content); |
| 1082 | g.okAdmin = g.okRdAddr = 1; |
| 1083 | if( configure_is_exportable(zName) & origConfigRcvMask ){ |
| 1084 | if( zName[0]!='@' ){ |
| 1085 | db_multi_exec( |
| 1086 | "REPLACE INTO config(name,value) VALUES(%Q,%Q)", |
| 1087 | zName, blob_str(&content) |
| 1088 |