Fossil SCM
More removals of unnecessary end-of-line spaces
Commit
45f35169f2e2897f9b178ed0610d77fa10c07531
Parent
22262e75533d448…
14 files changed
+16
-16
+1
-1
+32
-32
+1
-1
+1
-1
+1
-1
+1
-1
+22
-22
+1
-1
+14
-14
+1
-1
+1
-1
+12
-12
+39
-39
+16
-16
| --- src/cgi.c | ||
| +++ src/cgi.c | ||
| @@ -266,11 +266,11 @@ | ||
| 266 | 266 | zTok = strtok_r(0, ",\"",&zPos)){} |
| 267 | 267 | fossil_free(zBuf); |
| 268 | 268 | if(zTok) return 1; |
| 269 | 269 | } |
| 270 | 270 | } |
| 271 | - | |
| 271 | + | |
| 272 | 272 | return 0; |
| 273 | 273 | } |
| 274 | 274 | #endif |
| 275 | 275 | |
| 276 | 276 | /* |
| @@ -497,11 +497,11 @@ | ||
| 497 | 497 | ** must be made of zValue. |
| 498 | 498 | */ |
| 499 | 499 | void cgi_setenv(const char *zName, const char *zValue){ |
| 500 | 500 | cgi_set_parameter_nocopy(zName, mprintf("%s",zValue), 0); |
| 501 | 501 | } |
| 502 | - | |
| 502 | + | |
| 503 | 503 | |
| 504 | 504 | /* |
| 505 | 505 | ** Add a list of query parameters or cookies to the parameter set. |
| 506 | 506 | ** |
| 507 | 507 | ** Each parameter is of the form NAME=VALUE. Both the NAME and the |
| @@ -615,11 +615,11 @@ | ||
| 615 | 615 | break; |
| 616 | 616 | } |
| 617 | 617 | } |
| 618 | 618 | *pz = &z[i]; |
| 619 | 619 | get_line_from_string(pz, pLen); |
| 620 | - return z; | |
| 620 | + return z; | |
| 621 | 621 | } |
| 622 | 622 | |
| 623 | 623 | /* |
| 624 | 624 | ** Tokenize a line of text into as many as nArg tokens. Make |
| 625 | 625 | ** azArg[] point to the start of each token. |
| @@ -722,11 +722,11 @@ | ||
| 722 | 722 | cgi_set_parameter_nocopy(mprintf("%s:mimetype",zName), z, 1); |
| 723 | 723 | } |
| 724 | 724 | } |
| 725 | 725 | } |
| 726 | 726 | } |
| 727 | - } | |
| 727 | + } | |
| 728 | 728 | } |
| 729 | 729 | |
| 730 | 730 | |
| 731 | 731 | #ifdef FOSSIL_ENABLE_JSON |
| 732 | 732 | /* |
| @@ -903,11 +903,11 @@ | ||
| 903 | 903 | z = (char*)P("HTTP_COOKIE"); |
| 904 | 904 | if( z ){ |
| 905 | 905 | z = mprintf("%s",z); |
| 906 | 906 | add_param_list(z, ';'); |
| 907 | 907 | } |
| 908 | - | |
| 908 | + | |
| 909 | 909 | z = (char*)P("QUERY_STRING"); |
| 910 | 910 | if( z ){ |
| 911 | 911 | z = mprintf("%s",z); |
| 912 | 912 | add_param_list(z, '&'); |
| 913 | 913 | } |
| @@ -919,11 +919,11 @@ | ||
| 919 | 919 | |
| 920 | 920 | len = atoi(PD("CONTENT_LENGTH", "0")); |
| 921 | 921 | g.zContentType = zType = P("CONTENT_TYPE"); |
| 922 | 922 | blob_zero(&g.cgiIn); |
| 923 | 923 | if( len>0 && zType ){ |
| 924 | - if( fossil_strcmp(zType,"application/x-www-form-urlencoded")==0 | |
| 924 | + if( fossil_strcmp(zType,"application/x-www-form-urlencoded")==0 | |
| 925 | 925 | || strncmp(zType,"multipart/form-data",19)==0 ){ |
| 926 | 926 | z = fossil_malloc( len+1 ); |
| 927 | 927 | len = fread(z, 1, len, g.httpIn); |
| 928 | 928 | z[len] = 0; |
| 929 | 929 | cgi_trace(z); |
| @@ -949,11 +949,11 @@ | ||
| 949 | 949 | /* FIXMEs: |
| 950 | 950 | |
| 951 | 951 | - See if fossil really needs g.cgiIn to be set for this purpose |
| 952 | 952 | (i don't think it does). If it does then fill g.cgiIn and |
| 953 | 953 | refactor to parse the JSON from there. |
| 954 | - | |
| 954 | + | |
| 955 | 955 | - After parsing POST JSON, copy the "first layer" of keys/values |
| 956 | 956 | to cgi_setenv(), honoring the upper-case distinction used |
| 957 | 957 | in add_param_list(). However... |
| 958 | 958 | |
| 959 | 959 | - If we do that then we might get a disconnect in precedence of |
| @@ -1225,11 +1225,11 @@ | ||
| 1225 | 1225 | ** loaded into g.zIpAddr. |
| 1226 | 1226 | */ |
| 1227 | 1227 | static const char *cgi_accept_forwarded_for(const char *z){ |
| 1228 | 1228 | int i; |
| 1229 | 1229 | if( fossil_strcmp(g.zIpAddr, "127.0.0.1")!=0 ) return 0; |
| 1230 | - | |
| 1230 | + | |
| 1231 | 1231 | i = strlen(z)-1; |
| 1232 | 1232 | while( i>=0 && z[i]!=',' && !fossil_isspace(z[i]) ) i--; |
| 1233 | 1233 | return &z[++i]; |
| 1234 | 1234 | } |
| 1235 | 1235 | |
| @@ -1297,20 +1297,20 @@ | ||
| 1297 | 1297 | for(i=0; zToken[i] && zToken[i]!='?'; i++){} |
| 1298 | 1298 | if( zToken[i] ) zToken[i++] = 0; |
| 1299 | 1299 | cgi_setenv("PATH_INFO", zToken); |
| 1300 | 1300 | cgi_setenv("QUERY_STRING", &zToken[i]); |
| 1301 | 1301 | if( zIpAddr==0 && |
| 1302 | - getpeername(fileno(g.httpIn), (struct sockaddr*)&remoteName, | |
| 1302 | + getpeername(fileno(g.httpIn), (struct sockaddr*)&remoteName, | |
| 1303 | 1303 | &size)>=0 |
| 1304 | 1304 | ){ |
| 1305 | 1305 | zIpAddr = inet_ntoa(remoteName.sin_addr); |
| 1306 | 1306 | } |
| 1307 | - if( zIpAddr ){ | |
| 1307 | + if( zIpAddr ){ | |
| 1308 | 1308 | cgi_setenv("REMOTE_ADDR", zIpAddr); |
| 1309 | 1309 | g.zIpAddr = mprintf("%s", zIpAddr); |
| 1310 | 1310 | } |
| 1311 | - | |
| 1311 | + | |
| 1312 | 1312 | /* Get all the optional fields that follow the first line. |
| 1313 | 1313 | */ |
| 1314 | 1314 | while( fgets(zLine,sizeof(zLine),g.httpIn) ){ |
| 1315 | 1315 | char *zFieldName; |
| 1316 | 1316 | char *zVal; |
| @@ -1376,11 +1376,11 @@ | ||
| 1376 | 1376 | const char *zType = 0; |
| 1377 | 1377 | int i, content_length = 0; |
| 1378 | 1378 | char zLine[2000]; /* A single line of input. */ |
| 1379 | 1379 | |
| 1380 | 1380 | if( zIpAddr ){ |
| 1381 | - if( nCycles==0 ){ | |
| 1381 | + if( nCycles==0 ){ | |
| 1382 | 1382 | cgi_setenv("REMOTE_ADDR", zIpAddr); |
| 1383 | 1383 | g.zIpAddr = mprintf("%s", zIpAddr); |
| 1384 | 1384 | } |
| 1385 | 1385 | }else{ |
| 1386 | 1386 | fossil_panic("missing SSH IP address"); |
| @@ -1442,11 +1442,11 @@ | ||
| 1442 | 1442 | if( nCycles==0 ){ |
| 1443 | 1443 | cgi_setenv("PATH_INFO", zToken); |
| 1444 | 1444 | }else{ |
| 1445 | 1445 | cgi_replace_parameter("PATH_INFO", mprintf("%s",zToken)); |
| 1446 | 1446 | } |
| 1447 | - | |
| 1447 | + | |
| 1448 | 1448 | /* Get all the optional fields that follow the first line. |
| 1449 | 1449 | */ |
| 1450 | 1450 | while( fgets(zLine,sizeof(zLine),g.httpIn) ){ |
| 1451 | 1451 | char *zFieldName; |
| 1452 | 1452 | char *zVal; |
| @@ -1623,11 +1623,11 @@ | ||
| 1623 | 1623 | cgi_init(); |
| 1624 | 1624 | } |
| 1625 | 1625 | |
| 1626 | 1626 | |
| 1627 | 1627 | #if INTERFACE |
| 1628 | -/* | |
| 1628 | +/* | |
| 1629 | 1629 | ** Bitmap values for the flags parameter to cgi_http_server(). |
| 1630 | 1630 | */ |
| 1631 | 1631 | #define HTTP_SERVER_LOCALHOST 0x0001 /* Bind to 127.0.0.1 only */ |
| 1632 | 1632 | #define HTTP_SERVER_SCGI 0x0002 /* SCGI instead of HTTP */ |
| 1633 | 1633 | |
| @@ -1771,11 +1771,11 @@ | ||
| 1771 | 1771 | /* Bury dead children */ |
| 1772 | 1772 | while( waitpid(0, 0, WNOHANG)>0 ){ |
| 1773 | 1773 | nchildren--; |
| 1774 | 1774 | } |
| 1775 | 1775 | } |
| 1776 | - /* NOT REACHED */ | |
| 1776 | + /* NOT REACHED */ | |
| 1777 | 1777 | fossil_exit(1); |
| 1778 | 1778 | #endif |
| 1779 | 1779 | /* NOT REACHED */ |
| 1780 | 1780 | return 0; |
| 1781 | 1781 | } |
| @@ -1859,11 +1859,11 @@ | ||
| 1859 | 1859 | p->tm_mon %= 12; |
| 1860 | 1860 | } |
| 1861 | 1861 | isLeapYr = p->tm_year%4==0 && (p->tm_year%100!=0 || (p->tm_year+300)%400==0); |
| 1862 | 1862 | p->tm_yday = priorDays[p->tm_mon] + p->tm_mday - 1; |
| 1863 | 1863 | if( isLeapYr && p->tm_mon>1 ) p->tm_yday++; |
| 1864 | - nDay = (p->tm_year-70)*365 + (p->tm_year-69)/4 -p->tm_year/100 + | |
| 1864 | + nDay = (p->tm_year-70)*365 + (p->tm_year-69)/4 -p->tm_year/100 + | |
| 1865 | 1865 | (p->tm_year+300)/400 + p->tm_yday; |
| 1866 | 1866 | t = ((nDay*24 + p->tm_hour)*60 + p->tm_min)*60 + p->tm_sec; |
| 1867 | 1867 | return t; |
| 1868 | 1868 | } |
| 1869 | 1869 | |
| 1870 | 1870 |
| --- src/cgi.c | |
| +++ src/cgi.c | |
| @@ -266,11 +266,11 @@ | |
| 266 | zTok = strtok_r(0, ",\"",&zPos)){} |
| 267 | fossil_free(zBuf); |
| 268 | if(zTok) return 1; |
| 269 | } |
| 270 | } |
| 271 | |
| 272 | return 0; |
| 273 | } |
| 274 | #endif |
| 275 | |
| 276 | /* |
| @@ -497,11 +497,11 @@ | |
| 497 | ** must be made of zValue. |
| 498 | */ |
| 499 | void cgi_setenv(const char *zName, const char *zValue){ |
| 500 | cgi_set_parameter_nocopy(zName, mprintf("%s",zValue), 0); |
| 501 | } |
| 502 | |
| 503 | |
| 504 | /* |
| 505 | ** Add a list of query parameters or cookies to the parameter set. |
| 506 | ** |
| 507 | ** Each parameter is of the form NAME=VALUE. Both the NAME and the |
| @@ -615,11 +615,11 @@ | |
| 615 | break; |
| 616 | } |
| 617 | } |
| 618 | *pz = &z[i]; |
| 619 | get_line_from_string(pz, pLen); |
| 620 | return z; |
| 621 | } |
| 622 | |
| 623 | /* |
| 624 | ** Tokenize a line of text into as many as nArg tokens. Make |
| 625 | ** azArg[] point to the start of each token. |
| @@ -722,11 +722,11 @@ | |
| 722 | cgi_set_parameter_nocopy(mprintf("%s:mimetype",zName), z, 1); |
| 723 | } |
| 724 | } |
| 725 | } |
| 726 | } |
| 727 | } |
| 728 | } |
| 729 | |
| 730 | |
| 731 | #ifdef FOSSIL_ENABLE_JSON |
| 732 | /* |
| @@ -903,11 +903,11 @@ | |
| 903 | z = (char*)P("HTTP_COOKIE"); |
| 904 | if( z ){ |
| 905 | z = mprintf("%s",z); |
| 906 | add_param_list(z, ';'); |
| 907 | } |
| 908 | |
| 909 | z = (char*)P("QUERY_STRING"); |
| 910 | if( z ){ |
| 911 | z = mprintf("%s",z); |
| 912 | add_param_list(z, '&'); |
| 913 | } |
| @@ -919,11 +919,11 @@ | |
| 919 | |
| 920 | len = atoi(PD("CONTENT_LENGTH", "0")); |
| 921 | g.zContentType = zType = P("CONTENT_TYPE"); |
| 922 | blob_zero(&g.cgiIn); |
| 923 | if( len>0 && zType ){ |
| 924 | if( fossil_strcmp(zType,"application/x-www-form-urlencoded")==0 |
| 925 | || strncmp(zType,"multipart/form-data",19)==0 ){ |
| 926 | z = fossil_malloc( len+1 ); |
| 927 | len = fread(z, 1, len, g.httpIn); |
| 928 | z[len] = 0; |
| 929 | cgi_trace(z); |
| @@ -949,11 +949,11 @@ | |
| 949 | /* FIXMEs: |
| 950 | |
| 951 | - See if fossil really needs g.cgiIn to be set for this purpose |
| 952 | (i don't think it does). If it does then fill g.cgiIn and |
| 953 | refactor to parse the JSON from there. |
| 954 | |
| 955 | - After parsing POST JSON, copy the "first layer" of keys/values |
| 956 | to cgi_setenv(), honoring the upper-case distinction used |
| 957 | in add_param_list(). However... |
| 958 | |
| 959 | - If we do that then we might get a disconnect in precedence of |
| @@ -1225,11 +1225,11 @@ | |
| 1225 | ** loaded into g.zIpAddr. |
| 1226 | */ |
| 1227 | static const char *cgi_accept_forwarded_for(const char *z){ |
| 1228 | int i; |
| 1229 | if( fossil_strcmp(g.zIpAddr, "127.0.0.1")!=0 ) return 0; |
| 1230 | |
| 1231 | i = strlen(z)-1; |
| 1232 | while( i>=0 && z[i]!=',' && !fossil_isspace(z[i]) ) i--; |
| 1233 | return &z[++i]; |
| 1234 | } |
| 1235 | |
| @@ -1297,20 +1297,20 @@ | |
| 1297 | for(i=0; zToken[i] && zToken[i]!='?'; i++){} |
| 1298 | if( zToken[i] ) zToken[i++] = 0; |
| 1299 | cgi_setenv("PATH_INFO", zToken); |
| 1300 | cgi_setenv("QUERY_STRING", &zToken[i]); |
| 1301 | if( zIpAddr==0 && |
| 1302 | getpeername(fileno(g.httpIn), (struct sockaddr*)&remoteName, |
| 1303 | &size)>=0 |
| 1304 | ){ |
| 1305 | zIpAddr = inet_ntoa(remoteName.sin_addr); |
| 1306 | } |
| 1307 | if( zIpAddr ){ |
| 1308 | cgi_setenv("REMOTE_ADDR", zIpAddr); |
| 1309 | g.zIpAddr = mprintf("%s", zIpAddr); |
| 1310 | } |
| 1311 | |
| 1312 | /* Get all the optional fields that follow the first line. |
| 1313 | */ |
| 1314 | while( fgets(zLine,sizeof(zLine),g.httpIn) ){ |
| 1315 | char *zFieldName; |
| 1316 | char *zVal; |
| @@ -1376,11 +1376,11 @@ | |
| 1376 | const char *zType = 0; |
| 1377 | int i, content_length = 0; |
| 1378 | char zLine[2000]; /* A single line of input. */ |
| 1379 | |
| 1380 | if( zIpAddr ){ |
| 1381 | if( nCycles==0 ){ |
| 1382 | cgi_setenv("REMOTE_ADDR", zIpAddr); |
| 1383 | g.zIpAddr = mprintf("%s", zIpAddr); |
| 1384 | } |
| 1385 | }else{ |
| 1386 | fossil_panic("missing SSH IP address"); |
| @@ -1442,11 +1442,11 @@ | |
| 1442 | if( nCycles==0 ){ |
| 1443 | cgi_setenv("PATH_INFO", zToken); |
| 1444 | }else{ |
| 1445 | cgi_replace_parameter("PATH_INFO", mprintf("%s",zToken)); |
| 1446 | } |
| 1447 | |
| 1448 | /* Get all the optional fields that follow the first line. |
| 1449 | */ |
| 1450 | while( fgets(zLine,sizeof(zLine),g.httpIn) ){ |
| 1451 | char *zFieldName; |
| 1452 | char *zVal; |
| @@ -1623,11 +1623,11 @@ | |
| 1623 | cgi_init(); |
| 1624 | } |
| 1625 | |
| 1626 | |
| 1627 | #if INTERFACE |
| 1628 | /* |
| 1629 | ** Bitmap values for the flags parameter to cgi_http_server(). |
| 1630 | */ |
| 1631 | #define HTTP_SERVER_LOCALHOST 0x0001 /* Bind to 127.0.0.1 only */ |
| 1632 | #define HTTP_SERVER_SCGI 0x0002 /* SCGI instead of HTTP */ |
| 1633 | |
| @@ -1771,11 +1771,11 @@ | |
| 1771 | /* Bury dead children */ |
| 1772 | while( waitpid(0, 0, WNOHANG)>0 ){ |
| 1773 | nchildren--; |
| 1774 | } |
| 1775 | } |
| 1776 | /* NOT REACHED */ |
| 1777 | fossil_exit(1); |
| 1778 | #endif |
| 1779 | /* NOT REACHED */ |
| 1780 | return 0; |
| 1781 | } |
| @@ -1859,11 +1859,11 @@ | |
| 1859 | p->tm_mon %= 12; |
| 1860 | } |
| 1861 | isLeapYr = p->tm_year%4==0 && (p->tm_year%100!=0 || (p->tm_year+300)%400==0); |
| 1862 | p->tm_yday = priorDays[p->tm_mon] + p->tm_mday - 1; |
| 1863 | if( isLeapYr && p->tm_mon>1 ) p->tm_yday++; |
| 1864 | nDay = (p->tm_year-70)*365 + (p->tm_year-69)/4 -p->tm_year/100 + |
| 1865 | (p->tm_year+300)/400 + p->tm_yday; |
| 1866 | t = ((nDay*24 + p->tm_hour)*60 + p->tm_min)*60 + p->tm_sec; |
| 1867 | return t; |
| 1868 | } |
| 1869 | |
| 1870 |
| --- src/cgi.c | |
| +++ src/cgi.c | |
| @@ -266,11 +266,11 @@ | |
| 266 | zTok = strtok_r(0, ",\"",&zPos)){} |
| 267 | fossil_free(zBuf); |
| 268 | if(zTok) return 1; |
| 269 | } |
| 270 | } |
| 271 | |
| 272 | return 0; |
| 273 | } |
| 274 | #endif |
| 275 | |
| 276 | /* |
| @@ -497,11 +497,11 @@ | |
| 497 | ** must be made of zValue. |
| 498 | */ |
| 499 | void cgi_setenv(const char *zName, const char *zValue){ |
| 500 | cgi_set_parameter_nocopy(zName, mprintf("%s",zValue), 0); |
| 501 | } |
| 502 | |
| 503 | |
| 504 | /* |
| 505 | ** Add a list of query parameters or cookies to the parameter set. |
| 506 | ** |
| 507 | ** Each parameter is of the form NAME=VALUE. Both the NAME and the |
| @@ -615,11 +615,11 @@ | |
| 615 | break; |
| 616 | } |
| 617 | } |
| 618 | *pz = &z[i]; |
| 619 | get_line_from_string(pz, pLen); |
| 620 | return z; |
| 621 | } |
| 622 | |
| 623 | /* |
| 624 | ** Tokenize a line of text into as many as nArg tokens. Make |
| 625 | ** azArg[] point to the start of each token. |
| @@ -722,11 +722,11 @@ | |
| 722 | cgi_set_parameter_nocopy(mprintf("%s:mimetype",zName), z, 1); |
| 723 | } |
| 724 | } |
| 725 | } |
| 726 | } |
| 727 | } |
| 728 | } |
| 729 | |
| 730 | |
| 731 | #ifdef FOSSIL_ENABLE_JSON |
| 732 | /* |
| @@ -903,11 +903,11 @@ | |
| 903 | z = (char*)P("HTTP_COOKIE"); |
| 904 | if( z ){ |
| 905 | z = mprintf("%s",z); |
| 906 | add_param_list(z, ';'); |
| 907 | } |
| 908 | |
| 909 | z = (char*)P("QUERY_STRING"); |
| 910 | if( z ){ |
| 911 | z = mprintf("%s",z); |
| 912 | add_param_list(z, '&'); |
| 913 | } |
| @@ -919,11 +919,11 @@ | |
| 919 | |
| 920 | len = atoi(PD("CONTENT_LENGTH", "0")); |
| 921 | g.zContentType = zType = P("CONTENT_TYPE"); |
| 922 | blob_zero(&g.cgiIn); |
| 923 | if( len>0 && zType ){ |
| 924 | if( fossil_strcmp(zType,"application/x-www-form-urlencoded")==0 |
| 925 | || strncmp(zType,"multipart/form-data",19)==0 ){ |
| 926 | z = fossil_malloc( len+1 ); |
| 927 | len = fread(z, 1, len, g.httpIn); |
| 928 | z[len] = 0; |
| 929 | cgi_trace(z); |
| @@ -949,11 +949,11 @@ | |
| 949 | /* FIXMEs: |
| 950 | |
| 951 | - See if fossil really needs g.cgiIn to be set for this purpose |
| 952 | (i don't think it does). If it does then fill g.cgiIn and |
| 953 | refactor to parse the JSON from there. |
| 954 | |
| 955 | - After parsing POST JSON, copy the "first layer" of keys/values |
| 956 | to cgi_setenv(), honoring the upper-case distinction used |
| 957 | in add_param_list(). However... |
| 958 | |
| 959 | - If we do that then we might get a disconnect in precedence of |
| @@ -1225,11 +1225,11 @@ | |
| 1225 | ** loaded into g.zIpAddr. |
| 1226 | */ |
| 1227 | static const char *cgi_accept_forwarded_for(const char *z){ |
| 1228 | int i; |
| 1229 | if( fossil_strcmp(g.zIpAddr, "127.0.0.1")!=0 ) return 0; |
| 1230 | |
| 1231 | i = strlen(z)-1; |
| 1232 | while( i>=0 && z[i]!=',' && !fossil_isspace(z[i]) ) i--; |
| 1233 | return &z[++i]; |
| 1234 | } |
| 1235 | |
| @@ -1297,20 +1297,20 @@ | |
| 1297 | for(i=0; zToken[i] && zToken[i]!='?'; i++){} |
| 1298 | if( zToken[i] ) zToken[i++] = 0; |
| 1299 | cgi_setenv("PATH_INFO", zToken); |
| 1300 | cgi_setenv("QUERY_STRING", &zToken[i]); |
| 1301 | if( zIpAddr==0 && |
| 1302 | getpeername(fileno(g.httpIn), (struct sockaddr*)&remoteName, |
| 1303 | &size)>=0 |
| 1304 | ){ |
| 1305 | zIpAddr = inet_ntoa(remoteName.sin_addr); |
| 1306 | } |
| 1307 | if( zIpAddr ){ |
| 1308 | cgi_setenv("REMOTE_ADDR", zIpAddr); |
| 1309 | g.zIpAddr = mprintf("%s", zIpAddr); |
| 1310 | } |
| 1311 | |
| 1312 | /* Get all the optional fields that follow the first line. |
| 1313 | */ |
| 1314 | while( fgets(zLine,sizeof(zLine),g.httpIn) ){ |
| 1315 | char *zFieldName; |
| 1316 | char *zVal; |
| @@ -1376,11 +1376,11 @@ | |
| 1376 | const char *zType = 0; |
| 1377 | int i, content_length = 0; |
| 1378 | char zLine[2000]; /* A single line of input. */ |
| 1379 | |
| 1380 | if( zIpAddr ){ |
| 1381 | if( nCycles==0 ){ |
| 1382 | cgi_setenv("REMOTE_ADDR", zIpAddr); |
| 1383 | g.zIpAddr = mprintf("%s", zIpAddr); |
| 1384 | } |
| 1385 | }else{ |
| 1386 | fossil_panic("missing SSH IP address"); |
| @@ -1442,11 +1442,11 @@ | |
| 1442 | if( nCycles==0 ){ |
| 1443 | cgi_setenv("PATH_INFO", zToken); |
| 1444 | }else{ |
| 1445 | cgi_replace_parameter("PATH_INFO", mprintf("%s",zToken)); |
| 1446 | } |
| 1447 | |
| 1448 | /* Get all the optional fields that follow the first line. |
| 1449 | */ |
| 1450 | while( fgets(zLine,sizeof(zLine),g.httpIn) ){ |
| 1451 | char *zFieldName; |
| 1452 | char *zVal; |
| @@ -1623,11 +1623,11 @@ | |
| 1623 | cgi_init(); |
| 1624 | } |
| 1625 | |
| 1626 | |
| 1627 | #if INTERFACE |
| 1628 | /* |
| 1629 | ** Bitmap values for the flags parameter to cgi_http_server(). |
| 1630 | */ |
| 1631 | #define HTTP_SERVER_LOCALHOST 0x0001 /* Bind to 127.0.0.1 only */ |
| 1632 | #define HTTP_SERVER_SCGI 0x0002 /* SCGI instead of HTTP */ |
| 1633 | |
| @@ -1771,11 +1771,11 @@ | |
| 1771 | /* Bury dead children */ |
| 1772 | while( waitpid(0, 0, WNOHANG)>0 ){ |
| 1773 | nchildren--; |
| 1774 | } |
| 1775 | } |
| 1776 | /* NOT REACHED */ |
| 1777 | fossil_exit(1); |
| 1778 | #endif |
| 1779 | /* NOT REACHED */ |
| 1780 | return 0; |
| 1781 | } |
| @@ -1859,11 +1859,11 @@ | |
| 1859 | p->tm_mon %= 12; |
| 1860 | } |
| 1861 | isLeapYr = p->tm_year%4==0 && (p->tm_year%100!=0 || (p->tm_year+300)%400==0); |
| 1862 | p->tm_yday = priorDays[p->tm_mon] + p->tm_mday - 1; |
| 1863 | if( isLeapYr && p->tm_mon>1 ) p->tm_yday++; |
| 1864 | nDay = (p->tm_year-70)*365 + (p->tm_year-69)/4 -p->tm_year/100 + |
| 1865 | (p->tm_year+300)/400 + p->tm_yday; |
| 1866 | t = ((nDay*24 + p->tm_hour)*60 + p->tm_min)*60 + p->tm_sec; |
| 1867 | return t; |
| 1868 | } |
| 1869 | |
| 1870 |
+1
-1
| --- src/comformat.c | ||
| +++ src/comformat.c | ||
| @@ -34,11 +34,11 @@ | ||
| 34 | 34 | int tlen = lineLength - indent; |
| 35 | 35 | int si, sk, i, k; |
| 36 | 36 | int doIndent = 0; |
| 37 | 37 | char *zBuf; |
| 38 | 38 | char zBuffer[400]; |
| 39 | - int lineCnt = 0; | |
| 39 | + int lineCnt = 0; | |
| 40 | 40 | |
| 41 | 41 | if( tlen<=0 ){ |
| 42 | 42 | tlen = strlen(zText); |
| 43 | 43 | } |
| 44 | 44 | if( tlen >= (sizeof(zBuffer)) ){ |
| 45 | 45 |
| --- src/comformat.c | |
| +++ src/comformat.c | |
| @@ -34,11 +34,11 @@ | |
| 34 | int tlen = lineLength - indent; |
| 35 | int si, sk, i, k; |
| 36 | int doIndent = 0; |
| 37 | char *zBuf; |
| 38 | char zBuffer[400]; |
| 39 | int lineCnt = 0; |
| 40 | |
| 41 | if( tlen<=0 ){ |
| 42 | tlen = strlen(zText); |
| 43 | } |
| 44 | if( tlen >= (sizeof(zBuffer)) ){ |
| 45 |
| --- src/comformat.c | |
| +++ src/comformat.c | |
| @@ -34,11 +34,11 @@ | |
| 34 | int tlen = lineLength - indent; |
| 35 | int si, sk, i, k; |
| 36 | int doIndent = 0; |
| 37 | char *zBuf; |
| 38 | char zBuffer[400]; |
| 39 | int lineCnt = 0; |
| 40 | |
| 41 | if( tlen<=0 ){ |
| 42 | tlen = strlen(zText); |
| 43 | } |
| 44 | if( tlen >= (sizeof(zBuffer)) ){ |
| 45 |
+32
-32
| --- src/diffcmd.c | ||
| +++ src/diffcmd.c | ||
| @@ -599,11 +599,11 @@ | ||
| 599 | 599 | |
| 600 | 600 | /* A Tcl/Tk script used to render diff output. |
| 601 | 601 | */ |
| 602 | 602 | static const char zDiffScript[] = |
| 603 | 603 | @ package require Tk |
| 604 | -@ | |
| 604 | +@ | |
| 605 | 605 | @ array set CFG { |
| 606 | 606 | @ TITLE {Fossil Diff} |
| 607 | 607 | @ LN_COL_BG #dddddd |
| 608 | 608 | @ LN_COL_FG #444444 |
| 609 | 609 | @ TXT_COL_BG #ffffff |
| @@ -622,30 +622,30 @@ | ||
| 622 | 622 | @ PADX 5 |
| 623 | 623 | @ WIDTH 80 |
| 624 | 624 | @ HEIGHT 45 |
| 625 | 625 | @ LB_HEIGHT 25 |
| 626 | 626 | @ } |
| 627 | -@ | |
| 627 | +@ | |
| 628 | 628 | @ if {![namespace exists ttk]} { |
| 629 | 629 | @ interp alias {} ::ttk::scrollbar {} ::scrollbar |
| 630 | 630 | @ interp alias {} ::ttk::menubutton {} ::menubutton |
| 631 | 631 | @ } |
| 632 | -@ | |
| 632 | +@ | |
| 633 | 633 | @ proc dehtml {x} { |
| 634 | 634 | @ set x [regsub -all {<[^>]*>} $x {}] |
| 635 | 635 | @ return [string map {& & < < > > ' ' " \"} $x] |
| 636 | 636 | @ } |
| 637 | -@ | |
| 637 | +@ | |
| 638 | 638 | @ proc cols {} { |
| 639 | 639 | @ return [list .lnA .txtA .mkr .lnB .txtB] |
| 640 | 640 | @ } |
| 641 | -@ | |
| 641 | +@ | |
| 642 | 642 | @ proc colType {c} { |
| 643 | 643 | @ regexp {[a-z]+} $c type |
| 644 | 644 | @ return $type |
| 645 | 645 | @ } |
| 646 | -@ | |
| 646 | +@ | |
| 647 | 647 | @ proc readDiffs {fossilcmd} { |
| 648 | 648 | @ set in [open $fossilcmd r] |
| 649 | 649 | @ fconfigure $in -encoding utf-8 |
| 650 | 650 | @ set nDiffs 0 |
| 651 | 651 | @ array set widths {txt 0 ln 0 mkr 0} |
| @@ -657,34 +657,34 @@ | ||
| 657 | 657 | @ continue |
| 658 | 658 | @ } |
| 659 | 659 | @ incr nDiffs |
| 660 | 660 | @ set idx [expr {$nDiffs > 1 ? [.txtA index end] : "1.0"}] |
| 661 | 661 | @ .wfiles.lb insert end $fn |
| 662 | -@ | |
| 662 | +@ | |
| 663 | 663 | @ foreach c [cols] { |
| 664 | 664 | @ while {[gets $in] ne "<pre>"} continue |
| 665 | -@ | |
| 665 | +@ | |
| 666 | 666 | @ if {$nDiffs > 1} { |
| 667 | 667 | @ $c insert end \n - |
| 668 | 668 | @ } |
| 669 | 669 | @ if {[colType $c] eq "txt"} { |
| 670 | 670 | @ $c insert end $fn\n fn |
| 671 | 671 | @ } else { |
| 672 | 672 | @ $c insert end \n fn |
| 673 | 673 | @ } |
| 674 | 674 | @ $c insert end \n - |
| 675 | -@ | |
| 675 | +@ | |
| 676 | 676 | @ set type [colType $c] |
| 677 | 677 | @ set str {} |
| 678 | 678 | @ while {[set line [gets $in]] ne "</pre>"} { |
| 679 | 679 | @ set len [string length [dehtml $line]] |
| 680 | 680 | @ if {$len > $widths($type)} { |
| 681 | 681 | @ set widths($type) $len |
| 682 | 682 | @ } |
| 683 | 683 | @ append str $line\n |
| 684 | 684 | @ } |
| 685 | -@ | |
| 685 | +@ | |
| 686 | 686 | @ set re {<span class="diff([a-z]+)">([^<]*)</span>} |
| 687 | 687 | @ # Use \r as separator since it can't appear in the diff output (it gets |
| 688 | 688 | @ # converted to a space). |
| 689 | 689 | @ set str [regsub -all $re $str "\r\\1\r\\2\r"] |
| 690 | 690 | @ foreach {pre class mid} [split $str \r] { |
| @@ -695,11 +695,11 @@ | ||
| 695 | 695 | @ } |
| 696 | 696 | @ } |
| 697 | 697 | @ } |
| 698 | 698 | @ } |
| 699 | 699 | @ close $in |
| 700 | -@ | |
| 700 | +@ | |
| 701 | 701 | @ foreach c [cols] { |
| 702 | 702 | @ set type [colType $c] |
| 703 | 703 | @ if {$type ne "txt"} { |
| 704 | 704 | @ $c config -width $widths($type) |
| 705 | 705 | @ } |
| @@ -707,19 +707,19 @@ | ||
| 707 | 707 | @ } |
| 708 | 708 | @ if {$nDiffs <= [.wfiles.lb cget -height]} { |
| 709 | 709 | @ .wfiles.lb config -height $nDiffs |
| 710 | 710 | @ grid remove .wfiles.sb |
| 711 | 711 | @ } |
| 712 | -@ | |
| 712 | +@ | |
| 713 | 713 | @ return $nDiffs |
| 714 | 714 | @ } |
| 715 | -@ | |
| 715 | +@ | |
| 716 | 716 | @ proc viewDiff {idx} { |
| 717 | 717 | @ .txtA yview $idx |
| 718 | 718 | @ .txtA xview moveto 0 |
| 719 | 719 | @ } |
| 720 | -@ | |
| 720 | +@ | |
| 721 | 721 | @ proc cycleDiffs {{reverse 0}} { |
| 722 | 722 | @ if {$reverse} { |
| 723 | 723 | @ set range [.txtA tag prevrange fn @0,0 1.0] |
| 724 | 724 | @ if {$range eq ""} { |
| 725 | 725 | @ viewDiff {fn.last -1c} |
| @@ -733,36 +733,36 @@ | ||
| 733 | 733 | @ } else { |
| 734 | 734 | @ viewDiff [lindex $range 0] |
| 735 | 735 | @ } |
| 736 | 736 | @ } |
| 737 | 737 | @ } |
| 738 | -@ | |
| 738 | +@ | |
| 739 | 739 | @ proc xvis {col} { |
| 740 | 740 | @ set view [$col xview] |
| 741 | 741 | @ return [expr {[lindex $view 1]-[lindex $view 0]}] |
| 742 | 742 | @ } |
| 743 | -@ | |
| 743 | +@ | |
| 744 | 744 | @ proc scroll-x {args} { |
| 745 | 745 | @ set c .txt[expr {[xvis .txtA] < [xvis .txtB] ? "A" : "B"}] |
| 746 | 746 | @ eval $c xview $args |
| 747 | 747 | @ } |
| 748 | -@ | |
| 748 | +@ | |
| 749 | 749 | @ interp alias {} scroll-y {} .txtA yview |
| 750 | -@ | |
| 750 | +@ | |
| 751 | 751 | @ proc noop {args} {} |
| 752 | -@ | |
| 752 | +@ | |
| 753 | 753 | @ proc enableSync {axis} { |
| 754 | 754 | @ update idletasks |
| 755 | 755 | @ interp alias {} sync-$axis {} |
| 756 | 756 | @ rename _sync-$axis sync-$axis |
| 757 | 757 | @ } |
| 758 | -@ | |
| 758 | +@ | |
| 759 | 759 | @ proc disableSync {axis} { |
| 760 | 760 | @ rename sync-$axis _sync-$axis |
| 761 | 761 | @ interp alias {} sync-$axis {} noop |
| 762 | 762 | @ } |
| 763 | -@ | |
| 763 | +@ | |
| 764 | 764 | @ proc sync-x {col first last} { |
| 765 | 765 | @ disableSync x |
| 766 | 766 | @ $col xview moveto [expr {$first*[xvis $col]/($last-$first)}] |
| 767 | 767 | @ foreach side {A B} { |
| 768 | 768 | @ set sb .sbx$side |
| @@ -788,11 +788,11 @@ | ||
| 788 | 788 | @ } else { |
| 789 | 789 | @ grid remove .sby |
| 790 | 790 | @ } |
| 791 | 791 | @ enableSync y |
| 792 | 792 | @ } |
| 793 | -@ | |
| 793 | +@ | |
| 794 | 794 | @ wm withdraw . |
| 795 | 795 | @ wm title . $CFG(TITLE) |
| 796 | 796 | @ wm iconname . $CFG(TITLE) |
| 797 | 797 | @ bind . <q> exit |
| 798 | 798 | @ bind . <Tab> {cycleDiffs; break} |
| @@ -813,11 +813,11 @@ | ||
| 813 | 813 | @ End y {moveto 1} |
| 814 | 814 | @ } { |
| 815 | 815 | @ bind . <$key> "scroll-$axis $args; break" |
| 816 | 816 | @ bind . <Shift-$key> continue |
| 817 | 817 | @ } |
| 818 | -@ | |
| 818 | +@ | |
| 819 | 819 | @ ::ttk::menubutton .files -text "Files" |
| 820 | 820 | @ toplevel .wfiles |
| 821 | 821 | @ wm withdraw .wfiles |
| 822 | 822 | @ update idletasks |
| 823 | 823 | @ wm transient .wfiles . |
| @@ -847,16 +847,16 @@ | ||
| 847 | 847 | @ } |
| 848 | 848 | @ bind .wfiles.lb <Motion> { |
| 849 | 849 | @ %W selection clear 0 end |
| 850 | 850 | @ %W selection set @%x,%y |
| 851 | 851 | @ } |
| 852 | -@ | |
| 852 | +@ | |
| 853 | 853 | @ foreach {side syncCol} {A .txtB B .txtA} { |
| 854 | 854 | @ set ln .ln$side |
| 855 | 855 | @ text $ln |
| 856 | 856 | @ $ln tag config - -justify right |
| 857 | -@ | |
| 857 | +@ | |
| 858 | 858 | @ set txt .txt$side |
| 859 | 859 | @ text $txt -width $CFG(WIDTH) -height $CFG(HEIGHT) -wrap none \ |
| 860 | 860 | @ -xscroll "sync-x $syncCol" |
| 861 | 861 | @ catch {$txt config -tabstyle wordprocessor} ;# Required for Tk>=8.5 |
| 862 | 862 | @ foreach tag {add rm chng} { |
| @@ -865,11 +865,11 @@ | ||
| 865 | 865 | @ } |
| 866 | 866 | @ $txt tag config fn -background $CFG(FN_BG) -foreground $CFG(FN_FG) \ |
| 867 | 867 | @ -justify center |
| 868 | 868 | @ } |
| 869 | 869 | @ text .mkr |
| 870 | -@ | |
| 870 | +@ | |
| 871 | 871 | @ foreach c [cols] { |
| 872 | 872 | @ set keyPrefix [string toupper [colType $c]]_COL_ |
| 873 | 873 | @ if {[tk windowingsystem] eq "win32"} {$c config -font {courier 9}} |
| 874 | 874 | @ $c config -bg $CFG(${keyPrefix}BG) -fg $CFG(${keyPrefix}FG) -borderwidth 0 \ |
| 875 | 875 | @ -padx $CFG(PADX) -yscroll sync-y |
| @@ -877,22 +877,22 @@ | ||
| 877 | 877 | @ -foreground $CFG(HR_FG) |
| 878 | 878 | @ $c tag config fn -spacing1 $CFG(FN_PAD) -spacing3 $CFG(FN_PAD) |
| 879 | 879 | @ bindtags $c ". $c Text all" |
| 880 | 880 | @ bind $c <1> {focus %W} |
| 881 | 881 | @ } |
| 882 | -@ | |
| 882 | +@ | |
| 883 | 883 | @ ::ttk::scrollbar .sby -command {.txtA yview} -orient vertical |
| 884 | 884 | @ ::ttk::scrollbar .sbxA -command {.txtA xview} -orient horizontal |
| 885 | 885 | @ ::ttk::scrollbar .sbxB -command {.txtB xview} -orient horizontal |
| 886 | 886 | @ frame .spacer |
| 887 | -@ | |
| 887 | +@ | |
| 888 | 888 | @ if {[readDiffs $fossilcmd] == 0} { |
| 889 | 889 | @ tk_messageBox -type ok -title $CFG(TITLE) -message "No changes" |
| 890 | 890 | @ exit |
| 891 | 891 | @ } |
| 892 | 892 | @ update idletasks |
| 893 | -@ | |
| 893 | +@ | |
| 894 | 894 | @ grid rowconfigure . 1 -weight 1 |
| 895 | 895 | @ grid columnconfigure . 1 -weight 1 |
| 896 | 896 | @ grid columnconfigure . 4 -weight 1 |
| 897 | 897 | @ grid .files -row 0 -columnspan 6 |
| 898 | 898 | @ eval grid [cols] -row 1 -sticky nsew |
| @@ -906,11 +906,11 @@ | ||
| 906 | 906 | ; |
| 907 | 907 | |
| 908 | 908 | /* |
| 909 | 909 | ** Show diff output in a Tcl/Tk window, in response to the --tk option |
| 910 | 910 | ** to the diff command. |
| 911 | -** | |
| 911 | +** | |
| 912 | 912 | ** Steps: |
| 913 | 913 | ** (1) Write the Tcl/Tk script used for rendering into a temp file. |
| 914 | 914 | ** (2) Invoke "wish" on the temp file using fossil_system(). |
| 915 | 915 | ** (3) Delete the temp file. |
| 916 | 916 | */ |
| @@ -988,11 +988,11 @@ | ||
| 988 | 988 | ** specified (as they exist on disk) and that same file as it was checked |
| 989 | 989 | ** out. Or if the FILE arguments are omitted, show the unsaved changed |
| 990 | 990 | ** currently in the working check-out. |
| 991 | 991 | ** |
| 992 | 992 | ** If the "--from VERSION" or "-r VERSION" option is used it specifies |
| 993 | -** the source check-in for the diff operation. If not specified, the | |
| 993 | +** the source check-in for the diff operation. If not specified, the | |
| 994 | 994 | ** source check-in is the base check-in for the current check-out. |
| 995 | 995 | ** |
| 996 | 996 | ** If the "--to VERSION" option appears, it specifies the check-in from |
| 997 | 997 | ** which the second version of the file or files is taken. If there is |
| 998 | 998 | ** no "--to" option then the (possibly edited) files in the current check-out |
| @@ -1015,11 +1015,11 @@ | ||
| 1015 | 1015 | ** |
| 1016 | 1016 | ** Options: |
| 1017 | 1017 | ** --binary PATTERN Treat files that match the glob PATTERN as binary |
| 1018 | 1018 | ** --branch BRANCH Show diff of all changes on BRANCH |
| 1019 | 1019 | ** --brief Show filenames only |
| 1020 | -** --context|-c N Use N lines of context | |
| 1020 | +** --context|-c N Use N lines of context | |
| 1021 | 1021 | ** --diff-binary BOOL Include binary files when using external commands |
| 1022 | 1022 | ** --from|-r VERSION select VERSION as source for the diff |
| 1023 | 1023 | ** --internal|-i use internal diff logic |
| 1024 | 1024 | ** --side-by-side|-y side-by-side diff |
| 1025 | 1025 | ** --tk Launch a Tcl/Tk GUI for display |
| 1026 | 1026 |
| --- src/diffcmd.c | |
| +++ src/diffcmd.c | |
| @@ -599,11 +599,11 @@ | |
| 599 | |
| 600 | /* A Tcl/Tk script used to render diff output. |
| 601 | */ |
| 602 | static const char zDiffScript[] = |
| 603 | @ package require Tk |
| 604 | @ |
| 605 | @ array set CFG { |
| 606 | @ TITLE {Fossil Diff} |
| 607 | @ LN_COL_BG #dddddd |
| 608 | @ LN_COL_FG #444444 |
| 609 | @ TXT_COL_BG #ffffff |
| @@ -622,30 +622,30 @@ | |
| 622 | @ PADX 5 |
| 623 | @ WIDTH 80 |
| 624 | @ HEIGHT 45 |
| 625 | @ LB_HEIGHT 25 |
| 626 | @ } |
| 627 | @ |
| 628 | @ if {![namespace exists ttk]} { |
| 629 | @ interp alias {} ::ttk::scrollbar {} ::scrollbar |
| 630 | @ interp alias {} ::ttk::menubutton {} ::menubutton |
| 631 | @ } |
| 632 | @ |
| 633 | @ proc dehtml {x} { |
| 634 | @ set x [regsub -all {<[^>]*>} $x {}] |
| 635 | @ return [string map {& & < < > > ' ' " \"} $x] |
| 636 | @ } |
| 637 | @ |
| 638 | @ proc cols {} { |
| 639 | @ return [list .lnA .txtA .mkr .lnB .txtB] |
| 640 | @ } |
| 641 | @ |
| 642 | @ proc colType {c} { |
| 643 | @ regexp {[a-z]+} $c type |
| 644 | @ return $type |
| 645 | @ } |
| 646 | @ |
| 647 | @ proc readDiffs {fossilcmd} { |
| 648 | @ set in [open $fossilcmd r] |
| 649 | @ fconfigure $in -encoding utf-8 |
| 650 | @ set nDiffs 0 |
| 651 | @ array set widths {txt 0 ln 0 mkr 0} |
| @@ -657,34 +657,34 @@ | |
| 657 | @ continue |
| 658 | @ } |
| 659 | @ incr nDiffs |
| 660 | @ set idx [expr {$nDiffs > 1 ? [.txtA index end] : "1.0"}] |
| 661 | @ .wfiles.lb insert end $fn |
| 662 | @ |
| 663 | @ foreach c [cols] { |
| 664 | @ while {[gets $in] ne "<pre>"} continue |
| 665 | @ |
| 666 | @ if {$nDiffs > 1} { |
| 667 | @ $c insert end \n - |
| 668 | @ } |
| 669 | @ if {[colType $c] eq "txt"} { |
| 670 | @ $c insert end $fn\n fn |
| 671 | @ } else { |
| 672 | @ $c insert end \n fn |
| 673 | @ } |
| 674 | @ $c insert end \n - |
| 675 | @ |
| 676 | @ set type [colType $c] |
| 677 | @ set str {} |
| 678 | @ while {[set line [gets $in]] ne "</pre>"} { |
| 679 | @ set len [string length [dehtml $line]] |
| 680 | @ if {$len > $widths($type)} { |
| 681 | @ set widths($type) $len |
| 682 | @ } |
| 683 | @ append str $line\n |
| 684 | @ } |
| 685 | @ |
| 686 | @ set re {<span class="diff([a-z]+)">([^<]*)</span>} |
| 687 | @ # Use \r as separator since it can't appear in the diff output (it gets |
| 688 | @ # converted to a space). |
| 689 | @ set str [regsub -all $re $str "\r\\1\r\\2\r"] |
| 690 | @ foreach {pre class mid} [split $str \r] { |
| @@ -695,11 +695,11 @@ | |
| 695 | @ } |
| 696 | @ } |
| 697 | @ } |
| 698 | @ } |
| 699 | @ close $in |
| 700 | @ |
| 701 | @ foreach c [cols] { |
| 702 | @ set type [colType $c] |
| 703 | @ if {$type ne "txt"} { |
| 704 | @ $c config -width $widths($type) |
| 705 | @ } |
| @@ -707,19 +707,19 @@ | |
| 707 | @ } |
| 708 | @ if {$nDiffs <= [.wfiles.lb cget -height]} { |
| 709 | @ .wfiles.lb config -height $nDiffs |
| 710 | @ grid remove .wfiles.sb |
| 711 | @ } |
| 712 | @ |
| 713 | @ return $nDiffs |
| 714 | @ } |
| 715 | @ |
| 716 | @ proc viewDiff {idx} { |
| 717 | @ .txtA yview $idx |
| 718 | @ .txtA xview moveto 0 |
| 719 | @ } |
| 720 | @ |
| 721 | @ proc cycleDiffs {{reverse 0}} { |
| 722 | @ if {$reverse} { |
| 723 | @ set range [.txtA tag prevrange fn @0,0 1.0] |
| 724 | @ if {$range eq ""} { |
| 725 | @ viewDiff {fn.last -1c} |
| @@ -733,36 +733,36 @@ | |
| 733 | @ } else { |
| 734 | @ viewDiff [lindex $range 0] |
| 735 | @ } |
| 736 | @ } |
| 737 | @ } |
| 738 | @ |
| 739 | @ proc xvis {col} { |
| 740 | @ set view [$col xview] |
| 741 | @ return [expr {[lindex $view 1]-[lindex $view 0]}] |
| 742 | @ } |
| 743 | @ |
| 744 | @ proc scroll-x {args} { |
| 745 | @ set c .txt[expr {[xvis .txtA] < [xvis .txtB] ? "A" : "B"}] |
| 746 | @ eval $c xview $args |
| 747 | @ } |
| 748 | @ |
| 749 | @ interp alias {} scroll-y {} .txtA yview |
| 750 | @ |
| 751 | @ proc noop {args} {} |
| 752 | @ |
| 753 | @ proc enableSync {axis} { |
| 754 | @ update idletasks |
| 755 | @ interp alias {} sync-$axis {} |
| 756 | @ rename _sync-$axis sync-$axis |
| 757 | @ } |
| 758 | @ |
| 759 | @ proc disableSync {axis} { |
| 760 | @ rename sync-$axis _sync-$axis |
| 761 | @ interp alias {} sync-$axis {} noop |
| 762 | @ } |
| 763 | @ |
| 764 | @ proc sync-x {col first last} { |
| 765 | @ disableSync x |
| 766 | @ $col xview moveto [expr {$first*[xvis $col]/($last-$first)}] |
| 767 | @ foreach side {A B} { |
| 768 | @ set sb .sbx$side |
| @@ -788,11 +788,11 @@ | |
| 788 | @ } else { |
| 789 | @ grid remove .sby |
| 790 | @ } |
| 791 | @ enableSync y |
| 792 | @ } |
| 793 | @ |
| 794 | @ wm withdraw . |
| 795 | @ wm title . $CFG(TITLE) |
| 796 | @ wm iconname . $CFG(TITLE) |
| 797 | @ bind . <q> exit |
| 798 | @ bind . <Tab> {cycleDiffs; break} |
| @@ -813,11 +813,11 @@ | |
| 813 | @ End y {moveto 1} |
| 814 | @ } { |
| 815 | @ bind . <$key> "scroll-$axis $args; break" |
| 816 | @ bind . <Shift-$key> continue |
| 817 | @ } |
| 818 | @ |
| 819 | @ ::ttk::menubutton .files -text "Files" |
| 820 | @ toplevel .wfiles |
| 821 | @ wm withdraw .wfiles |
| 822 | @ update idletasks |
| 823 | @ wm transient .wfiles . |
| @@ -847,16 +847,16 @@ | |
| 847 | @ } |
| 848 | @ bind .wfiles.lb <Motion> { |
| 849 | @ %W selection clear 0 end |
| 850 | @ %W selection set @%x,%y |
| 851 | @ } |
| 852 | @ |
| 853 | @ foreach {side syncCol} {A .txtB B .txtA} { |
| 854 | @ set ln .ln$side |
| 855 | @ text $ln |
| 856 | @ $ln tag config - -justify right |
| 857 | @ |
| 858 | @ set txt .txt$side |
| 859 | @ text $txt -width $CFG(WIDTH) -height $CFG(HEIGHT) -wrap none \ |
| 860 | @ -xscroll "sync-x $syncCol" |
| 861 | @ catch {$txt config -tabstyle wordprocessor} ;# Required for Tk>=8.5 |
| 862 | @ foreach tag {add rm chng} { |
| @@ -865,11 +865,11 @@ | |
| 865 | @ } |
| 866 | @ $txt tag config fn -background $CFG(FN_BG) -foreground $CFG(FN_FG) \ |
| 867 | @ -justify center |
| 868 | @ } |
| 869 | @ text .mkr |
| 870 | @ |
| 871 | @ foreach c [cols] { |
| 872 | @ set keyPrefix [string toupper [colType $c]]_COL_ |
| 873 | @ if {[tk windowingsystem] eq "win32"} {$c config -font {courier 9}} |
| 874 | @ $c config -bg $CFG(${keyPrefix}BG) -fg $CFG(${keyPrefix}FG) -borderwidth 0 \ |
| 875 | @ -padx $CFG(PADX) -yscroll sync-y |
| @@ -877,22 +877,22 @@ | |
| 877 | @ -foreground $CFG(HR_FG) |
| 878 | @ $c tag config fn -spacing1 $CFG(FN_PAD) -spacing3 $CFG(FN_PAD) |
| 879 | @ bindtags $c ". $c Text all" |
| 880 | @ bind $c <1> {focus %W} |
| 881 | @ } |
| 882 | @ |
| 883 | @ ::ttk::scrollbar .sby -command {.txtA yview} -orient vertical |
| 884 | @ ::ttk::scrollbar .sbxA -command {.txtA xview} -orient horizontal |
| 885 | @ ::ttk::scrollbar .sbxB -command {.txtB xview} -orient horizontal |
| 886 | @ frame .spacer |
| 887 | @ |
| 888 | @ if {[readDiffs $fossilcmd] == 0} { |
| 889 | @ tk_messageBox -type ok -title $CFG(TITLE) -message "No changes" |
| 890 | @ exit |
| 891 | @ } |
| 892 | @ update idletasks |
| 893 | @ |
| 894 | @ grid rowconfigure . 1 -weight 1 |
| 895 | @ grid columnconfigure . 1 -weight 1 |
| 896 | @ grid columnconfigure . 4 -weight 1 |
| 897 | @ grid .files -row 0 -columnspan 6 |
| 898 | @ eval grid [cols] -row 1 -sticky nsew |
| @@ -906,11 +906,11 @@ | |
| 906 | ; |
| 907 | |
| 908 | /* |
| 909 | ** Show diff output in a Tcl/Tk window, in response to the --tk option |
| 910 | ** to the diff command. |
| 911 | ** |
| 912 | ** Steps: |
| 913 | ** (1) Write the Tcl/Tk script used for rendering into a temp file. |
| 914 | ** (2) Invoke "wish" on the temp file using fossil_system(). |
| 915 | ** (3) Delete the temp file. |
| 916 | */ |
| @@ -988,11 +988,11 @@ | |
| 988 | ** specified (as they exist on disk) and that same file as it was checked |
| 989 | ** out. Or if the FILE arguments are omitted, show the unsaved changed |
| 990 | ** currently in the working check-out. |
| 991 | ** |
| 992 | ** If the "--from VERSION" or "-r VERSION" option is used it specifies |
| 993 | ** the source check-in for the diff operation. If not specified, the |
| 994 | ** source check-in is the base check-in for the current check-out. |
| 995 | ** |
| 996 | ** If the "--to VERSION" option appears, it specifies the check-in from |
| 997 | ** which the second version of the file or files is taken. If there is |
| 998 | ** no "--to" option then the (possibly edited) files in the current check-out |
| @@ -1015,11 +1015,11 @@ | |
| 1015 | ** |
| 1016 | ** Options: |
| 1017 | ** --binary PATTERN Treat files that match the glob PATTERN as binary |
| 1018 | ** --branch BRANCH Show diff of all changes on BRANCH |
| 1019 | ** --brief Show filenames only |
| 1020 | ** --context|-c N Use N lines of context |
| 1021 | ** --diff-binary BOOL Include binary files when using external commands |
| 1022 | ** --from|-r VERSION select VERSION as source for the diff |
| 1023 | ** --internal|-i use internal diff logic |
| 1024 | ** --side-by-side|-y side-by-side diff |
| 1025 | ** --tk Launch a Tcl/Tk GUI for display |
| 1026 |
| --- src/diffcmd.c | |
| +++ src/diffcmd.c | |
| @@ -599,11 +599,11 @@ | |
| 599 | |
| 600 | /* A Tcl/Tk script used to render diff output. |
| 601 | */ |
| 602 | static const char zDiffScript[] = |
| 603 | @ package require Tk |
| 604 | @ |
| 605 | @ array set CFG { |
| 606 | @ TITLE {Fossil Diff} |
| 607 | @ LN_COL_BG #dddddd |
| 608 | @ LN_COL_FG #444444 |
| 609 | @ TXT_COL_BG #ffffff |
| @@ -622,30 +622,30 @@ | |
| 622 | @ PADX 5 |
| 623 | @ WIDTH 80 |
| 624 | @ HEIGHT 45 |
| 625 | @ LB_HEIGHT 25 |
| 626 | @ } |
| 627 | @ |
| 628 | @ if {![namespace exists ttk]} { |
| 629 | @ interp alias {} ::ttk::scrollbar {} ::scrollbar |
| 630 | @ interp alias {} ::ttk::menubutton {} ::menubutton |
| 631 | @ } |
| 632 | @ |
| 633 | @ proc dehtml {x} { |
| 634 | @ set x [regsub -all {<[^>]*>} $x {}] |
| 635 | @ return [string map {& & < < > > ' ' " \"} $x] |
| 636 | @ } |
| 637 | @ |
| 638 | @ proc cols {} { |
| 639 | @ return [list .lnA .txtA .mkr .lnB .txtB] |
| 640 | @ } |
| 641 | @ |
| 642 | @ proc colType {c} { |
| 643 | @ regexp {[a-z]+} $c type |
| 644 | @ return $type |
| 645 | @ } |
| 646 | @ |
| 647 | @ proc readDiffs {fossilcmd} { |
| 648 | @ set in [open $fossilcmd r] |
| 649 | @ fconfigure $in -encoding utf-8 |
| 650 | @ set nDiffs 0 |
| 651 | @ array set widths {txt 0 ln 0 mkr 0} |
| @@ -657,34 +657,34 @@ | |
| 657 | @ continue |
| 658 | @ } |
| 659 | @ incr nDiffs |
| 660 | @ set idx [expr {$nDiffs > 1 ? [.txtA index end] : "1.0"}] |
| 661 | @ .wfiles.lb insert end $fn |
| 662 | @ |
| 663 | @ foreach c [cols] { |
| 664 | @ while {[gets $in] ne "<pre>"} continue |
| 665 | @ |
| 666 | @ if {$nDiffs > 1} { |
| 667 | @ $c insert end \n - |
| 668 | @ } |
| 669 | @ if {[colType $c] eq "txt"} { |
| 670 | @ $c insert end $fn\n fn |
| 671 | @ } else { |
| 672 | @ $c insert end \n fn |
| 673 | @ } |
| 674 | @ $c insert end \n - |
| 675 | @ |
| 676 | @ set type [colType $c] |
| 677 | @ set str {} |
| 678 | @ while {[set line [gets $in]] ne "</pre>"} { |
| 679 | @ set len [string length [dehtml $line]] |
| 680 | @ if {$len > $widths($type)} { |
| 681 | @ set widths($type) $len |
| 682 | @ } |
| 683 | @ append str $line\n |
| 684 | @ } |
| 685 | @ |
| 686 | @ set re {<span class="diff([a-z]+)">([^<]*)</span>} |
| 687 | @ # Use \r as separator since it can't appear in the diff output (it gets |
| 688 | @ # converted to a space). |
| 689 | @ set str [regsub -all $re $str "\r\\1\r\\2\r"] |
| 690 | @ foreach {pre class mid} [split $str \r] { |
| @@ -695,11 +695,11 @@ | |
| 695 | @ } |
| 696 | @ } |
| 697 | @ } |
| 698 | @ } |
| 699 | @ close $in |
| 700 | @ |
| 701 | @ foreach c [cols] { |
| 702 | @ set type [colType $c] |
| 703 | @ if {$type ne "txt"} { |
| 704 | @ $c config -width $widths($type) |
| 705 | @ } |
| @@ -707,19 +707,19 @@ | |
| 707 | @ } |
| 708 | @ if {$nDiffs <= [.wfiles.lb cget -height]} { |
| 709 | @ .wfiles.lb config -height $nDiffs |
| 710 | @ grid remove .wfiles.sb |
| 711 | @ } |
| 712 | @ |
| 713 | @ return $nDiffs |
| 714 | @ } |
| 715 | @ |
| 716 | @ proc viewDiff {idx} { |
| 717 | @ .txtA yview $idx |
| 718 | @ .txtA xview moveto 0 |
| 719 | @ } |
| 720 | @ |
| 721 | @ proc cycleDiffs {{reverse 0}} { |
| 722 | @ if {$reverse} { |
| 723 | @ set range [.txtA tag prevrange fn @0,0 1.0] |
| 724 | @ if {$range eq ""} { |
| 725 | @ viewDiff {fn.last -1c} |
| @@ -733,36 +733,36 @@ | |
| 733 | @ } else { |
| 734 | @ viewDiff [lindex $range 0] |
| 735 | @ } |
| 736 | @ } |
| 737 | @ } |
| 738 | @ |
| 739 | @ proc xvis {col} { |
| 740 | @ set view [$col xview] |
| 741 | @ return [expr {[lindex $view 1]-[lindex $view 0]}] |
| 742 | @ } |
| 743 | @ |
| 744 | @ proc scroll-x {args} { |
| 745 | @ set c .txt[expr {[xvis .txtA] < [xvis .txtB] ? "A" : "B"}] |
| 746 | @ eval $c xview $args |
| 747 | @ } |
| 748 | @ |
| 749 | @ interp alias {} scroll-y {} .txtA yview |
| 750 | @ |
| 751 | @ proc noop {args} {} |
| 752 | @ |
| 753 | @ proc enableSync {axis} { |
| 754 | @ update idletasks |
| 755 | @ interp alias {} sync-$axis {} |
| 756 | @ rename _sync-$axis sync-$axis |
| 757 | @ } |
| 758 | @ |
| 759 | @ proc disableSync {axis} { |
| 760 | @ rename sync-$axis _sync-$axis |
| 761 | @ interp alias {} sync-$axis {} noop |
| 762 | @ } |
| 763 | @ |
| 764 | @ proc sync-x {col first last} { |
| 765 | @ disableSync x |
| 766 | @ $col xview moveto [expr {$first*[xvis $col]/($last-$first)}] |
| 767 | @ foreach side {A B} { |
| 768 | @ set sb .sbx$side |
| @@ -788,11 +788,11 @@ | |
| 788 | @ } else { |
| 789 | @ grid remove .sby |
| 790 | @ } |
| 791 | @ enableSync y |
| 792 | @ } |
| 793 | @ |
| 794 | @ wm withdraw . |
| 795 | @ wm title . $CFG(TITLE) |
| 796 | @ wm iconname . $CFG(TITLE) |
| 797 | @ bind . <q> exit |
| 798 | @ bind . <Tab> {cycleDiffs; break} |
| @@ -813,11 +813,11 @@ | |
| 813 | @ End y {moveto 1} |
| 814 | @ } { |
| 815 | @ bind . <$key> "scroll-$axis $args; break" |
| 816 | @ bind . <Shift-$key> continue |
| 817 | @ } |
| 818 | @ |
| 819 | @ ::ttk::menubutton .files -text "Files" |
| 820 | @ toplevel .wfiles |
| 821 | @ wm withdraw .wfiles |
| 822 | @ update idletasks |
| 823 | @ wm transient .wfiles . |
| @@ -847,16 +847,16 @@ | |
| 847 | @ } |
| 848 | @ bind .wfiles.lb <Motion> { |
| 849 | @ %W selection clear 0 end |
| 850 | @ %W selection set @%x,%y |
| 851 | @ } |
| 852 | @ |
| 853 | @ foreach {side syncCol} {A .txtB B .txtA} { |
| 854 | @ set ln .ln$side |
| 855 | @ text $ln |
| 856 | @ $ln tag config - -justify right |
| 857 | @ |
| 858 | @ set txt .txt$side |
| 859 | @ text $txt -width $CFG(WIDTH) -height $CFG(HEIGHT) -wrap none \ |
| 860 | @ -xscroll "sync-x $syncCol" |
| 861 | @ catch {$txt config -tabstyle wordprocessor} ;# Required for Tk>=8.5 |
| 862 | @ foreach tag {add rm chng} { |
| @@ -865,11 +865,11 @@ | |
| 865 | @ } |
| 866 | @ $txt tag config fn -background $CFG(FN_BG) -foreground $CFG(FN_FG) \ |
| 867 | @ -justify center |
| 868 | @ } |
| 869 | @ text .mkr |
| 870 | @ |
| 871 | @ foreach c [cols] { |
| 872 | @ set keyPrefix [string toupper [colType $c]]_COL_ |
| 873 | @ if {[tk windowingsystem] eq "win32"} {$c config -font {courier 9}} |
| 874 | @ $c config -bg $CFG(${keyPrefix}BG) -fg $CFG(${keyPrefix}FG) -borderwidth 0 \ |
| 875 | @ -padx $CFG(PADX) -yscroll sync-y |
| @@ -877,22 +877,22 @@ | |
| 877 | @ -foreground $CFG(HR_FG) |
| 878 | @ $c tag config fn -spacing1 $CFG(FN_PAD) -spacing3 $CFG(FN_PAD) |
| 879 | @ bindtags $c ". $c Text all" |
| 880 | @ bind $c <1> {focus %W} |
| 881 | @ } |
| 882 | @ |
| 883 | @ ::ttk::scrollbar .sby -command {.txtA yview} -orient vertical |
| 884 | @ ::ttk::scrollbar .sbxA -command {.txtA xview} -orient horizontal |
| 885 | @ ::ttk::scrollbar .sbxB -command {.txtB xview} -orient horizontal |
| 886 | @ frame .spacer |
| 887 | @ |
| 888 | @ if {[readDiffs $fossilcmd] == 0} { |
| 889 | @ tk_messageBox -type ok -title $CFG(TITLE) -message "No changes" |
| 890 | @ exit |
| 891 | @ } |
| 892 | @ update idletasks |
| 893 | @ |
| 894 | @ grid rowconfigure . 1 -weight 1 |
| 895 | @ grid columnconfigure . 1 -weight 1 |
| 896 | @ grid columnconfigure . 4 -weight 1 |
| 897 | @ grid .files -row 0 -columnspan 6 |
| 898 | @ eval grid [cols] -row 1 -sticky nsew |
| @@ -906,11 +906,11 @@ | |
| 906 | ; |
| 907 | |
| 908 | /* |
| 909 | ** Show diff output in a Tcl/Tk window, in response to the --tk option |
| 910 | ** to the diff command. |
| 911 | ** |
| 912 | ** Steps: |
| 913 | ** (1) Write the Tcl/Tk script used for rendering into a temp file. |
| 914 | ** (2) Invoke "wish" on the temp file using fossil_system(). |
| 915 | ** (3) Delete the temp file. |
| 916 | */ |
| @@ -988,11 +988,11 @@ | |
| 988 | ** specified (as they exist on disk) and that same file as it was checked |
| 989 | ** out. Or if the FILE arguments are omitted, show the unsaved changed |
| 990 | ** currently in the working check-out. |
| 991 | ** |
| 992 | ** If the "--from VERSION" or "-r VERSION" option is used it specifies |
| 993 | ** the source check-in for the diff operation. If not specified, the |
| 994 | ** source check-in is the base check-in for the current check-out. |
| 995 | ** |
| 996 | ** If the "--to VERSION" option appears, it specifies the check-in from |
| 997 | ** which the second version of the file or files is taken. If there is |
| 998 | ** no "--to" option then the (possibly edited) files in the current check-out |
| @@ -1015,11 +1015,11 @@ | |
| 1015 | ** |
| 1016 | ** Options: |
| 1017 | ** --binary PATTERN Treat files that match the glob PATTERN as binary |
| 1018 | ** --branch BRANCH Show diff of all changes on BRANCH |
| 1019 | ** --brief Show filenames only |
| 1020 | ** --context|-c N Use N lines of context |
| 1021 | ** --diff-binary BOOL Include binary files when using external commands |
| 1022 | ** --from|-r VERSION select VERSION as source for the diff |
| 1023 | ** --internal|-i use internal diff logic |
| 1024 | ** --side-by-side|-y side-by-side diff |
| 1025 | ** --tk Launch a Tcl/Tk GUI for display |
| 1026 |
+1
-1
| --- src/file.c | ||
| +++ src/file.c | ||
| @@ -996,11 +996,11 @@ | ||
| 996 | 996 | }else{ |
| 997 | 997 | xCmp = fossil_strnicmp; |
| 998 | 998 | } |
| 999 | 999 | |
| 1000 | 1000 | /* Special case. zOrigName refers to g.zLocalRoot directory. */ |
| 1001 | - if( (nFull==nLocalRoot-1 && xCmp(zLocalRoot, zFull, nFull)==0) | |
| 1001 | + if( (nFull==nLocalRoot-1 && xCmp(zLocalRoot, zFull, nFull)==0) | |
| 1002 | 1002 | || (nFull==1 && zFull[0]=='/' && nLocalRoot==1 && zLocalRoot[0]=='/') ){ |
| 1003 | 1003 | blob_append(pOut, ".", 1); |
| 1004 | 1004 | blob_reset(&localRoot); |
| 1005 | 1005 | blob_reset(&full); |
| 1006 | 1006 | return 1; |
| 1007 | 1007 |
| --- src/file.c | |
| +++ src/file.c | |
| @@ -996,11 +996,11 @@ | |
| 996 | }else{ |
| 997 | xCmp = fossil_strnicmp; |
| 998 | } |
| 999 | |
| 1000 | /* Special case. zOrigName refers to g.zLocalRoot directory. */ |
| 1001 | if( (nFull==nLocalRoot-1 && xCmp(zLocalRoot, zFull, nFull)==0) |
| 1002 | || (nFull==1 && zFull[0]=='/' && nLocalRoot==1 && zLocalRoot[0]=='/') ){ |
| 1003 | blob_append(pOut, ".", 1); |
| 1004 | blob_reset(&localRoot); |
| 1005 | blob_reset(&full); |
| 1006 | return 1; |
| 1007 |
| --- src/file.c | |
| +++ src/file.c | |
| @@ -996,11 +996,11 @@ | |
| 996 | }else{ |
| 997 | xCmp = fossil_strnicmp; |
| 998 | } |
| 999 | |
| 1000 | /* Special case. zOrigName refers to g.zLocalRoot directory. */ |
| 1001 | if( (nFull==nLocalRoot-1 && xCmp(zLocalRoot, zFull, nFull)==0) |
| 1002 | || (nFull==1 && zFull[0]=='/' && nLocalRoot==1 && zLocalRoot[0]=='/') ){ |
| 1003 | blob_append(pOut, ".", 1); |
| 1004 | blob_reset(&localRoot); |
| 1005 | blob_reset(&full); |
| 1006 | return 1; |
| 1007 |
+1
-1
| --- src/finfo.c | ||
| +++ src/finfo.c | ||
| @@ -322,11 +322,11 @@ | ||
| 322 | 322 | ); |
| 323 | 323 | if( firstChngOnly ){ |
| 324 | 324 | #if 0 |
| 325 | 325 | blob_appendf(&sql, ", min(event.mtime)"); |
| 326 | 326 | #else |
| 327 | - blob_appendf(&sql, | |
| 327 | + blob_appendf(&sql, | |
| 328 | 328 | ", min(CASE (SELECT value FROM tagxref" |
| 329 | 329 | " WHERE tagtype>0 AND tagid=%d" |
| 330 | 330 | " AND tagxref.rid=mlink.mid)" |
| 331 | 331 | " WHEN 'trunk' THEN event.mtime-10000 ELSE event.mtime END)", |
| 332 | 332 | TAG_BRANCH); |
| 333 | 333 |
| --- src/finfo.c | |
| +++ src/finfo.c | |
| @@ -322,11 +322,11 @@ | |
| 322 | ); |
| 323 | if( firstChngOnly ){ |
| 324 | #if 0 |
| 325 | blob_appendf(&sql, ", min(event.mtime)"); |
| 326 | #else |
| 327 | blob_appendf(&sql, |
| 328 | ", min(CASE (SELECT value FROM tagxref" |
| 329 | " WHERE tagtype>0 AND tagid=%d" |
| 330 | " AND tagxref.rid=mlink.mid)" |
| 331 | " WHEN 'trunk' THEN event.mtime-10000 ELSE event.mtime END)", |
| 332 | TAG_BRANCH); |
| 333 |
| --- src/finfo.c | |
| +++ src/finfo.c | |
| @@ -322,11 +322,11 @@ | |
| 322 | ); |
| 323 | if( firstChngOnly ){ |
| 324 | #if 0 |
| 325 | blob_appendf(&sql, ", min(event.mtime)"); |
| 326 | #else |
| 327 | blob_appendf(&sql, |
| 328 | ", min(CASE (SELECT value FROM tagxref" |
| 329 | " WHERE tagtype>0 AND tagid=%d" |
| 330 | " AND tagxref.rid=mlink.mid)" |
| 331 | " WHEN 'trunk' THEN event.mtime-10000 ELSE event.mtime END)", |
| 332 | TAG_BRANCH); |
| 333 |
+1
-1
| --- src/gzip.c | ||
| +++ src/gzip.c | ||
| @@ -73,11 +73,11 @@ | ||
| 73 | 73 | */ |
| 74 | 74 | #define GZIP_BUFSZ 100000 |
| 75 | 75 | void gzip_step(const char *pIn, int nIn){ |
| 76 | 76 | char *zOutBuf; |
| 77 | 77 | int nOut; |
| 78 | - | |
| 78 | + | |
| 79 | 79 | nOut = nIn + nIn/10 + 100; |
| 80 | 80 | if( nOut<100000 ) nOut = 100000; |
| 81 | 81 | zOutBuf = fossil_malloc(nOut); |
| 82 | 82 | gzip.stream.avail_in = nIn; |
| 83 | 83 | gzip.stream.next_in = (unsigned char*)pIn; |
| 84 | 84 |
| --- src/gzip.c | |
| +++ src/gzip.c | |
| @@ -73,11 +73,11 @@ | |
| 73 | */ |
| 74 | #define GZIP_BUFSZ 100000 |
| 75 | void gzip_step(const char *pIn, int nIn){ |
| 76 | char *zOutBuf; |
| 77 | int nOut; |
| 78 | |
| 79 | nOut = nIn + nIn/10 + 100; |
| 80 | if( nOut<100000 ) nOut = 100000; |
| 81 | zOutBuf = fossil_malloc(nOut); |
| 82 | gzip.stream.avail_in = nIn; |
| 83 | gzip.stream.next_in = (unsigned char*)pIn; |
| 84 |
| --- src/gzip.c | |
| +++ src/gzip.c | |
| @@ -73,11 +73,11 @@ | |
| 73 | */ |
| 74 | #define GZIP_BUFSZ 100000 |
| 75 | void gzip_step(const char *pIn, int nIn){ |
| 76 | char *zOutBuf; |
| 77 | int nOut; |
| 78 | |
| 79 | nOut = nIn + nIn/10 + 100; |
| 80 | if( nOut<100000 ) nOut = 100000; |
| 81 | zOutBuf = fossil_malloc(nOut); |
| 82 | gzip.stream.avail_in = nIn; |
| 83 | gzip.stream.next_in = (unsigned char*)pIn; |
| 84 |
+1
-1
| --- src/info.c | ||
| +++ src/info.c | ||
| @@ -2394,11 +2394,11 @@ | ||
| 2394 | 2394 | @ onkeyup="chgbn(this.value.trim(),'%h(zBranchName)')" /></td></tr> |
| 2395 | 2395 | if( !fHasHidden ){ |
| 2396 | 2396 | @ <tr><th align="right" valign="top">Branch Hiding:</th> |
| 2397 | 2397 | @ <td valign="top"> |
| 2398 | 2398 | @ <label><input type="checkbox" id="hidebr" name="hide"%s(zHideFlag) /> |
| 2399 | - @ Hide branch | |
| 2399 | + @ Hide branch | |
| 2400 | 2400 | @ <span style="font-weight:bold" id="hbranch">%h(zBranchName)</span> |
| 2401 | 2401 | @ from the timeline starting from this check-in</label> |
| 2402 | 2402 | @ </td></tr> |
| 2403 | 2403 | } |
| 2404 | 2404 | if( !fHasClosed ){ |
| 2405 | 2405 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -2394,11 +2394,11 @@ | |
| 2394 | @ onkeyup="chgbn(this.value.trim(),'%h(zBranchName)')" /></td></tr> |
| 2395 | if( !fHasHidden ){ |
| 2396 | @ <tr><th align="right" valign="top">Branch Hiding:</th> |
| 2397 | @ <td valign="top"> |
| 2398 | @ <label><input type="checkbox" id="hidebr" name="hide"%s(zHideFlag) /> |
| 2399 | @ Hide branch |
| 2400 | @ <span style="font-weight:bold" id="hbranch">%h(zBranchName)</span> |
| 2401 | @ from the timeline starting from this check-in</label> |
| 2402 | @ </td></tr> |
| 2403 | } |
| 2404 | if( !fHasClosed ){ |
| 2405 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -2394,11 +2394,11 @@ | |
| 2394 | @ onkeyup="chgbn(this.value.trim(),'%h(zBranchName)')" /></td></tr> |
| 2395 | if( !fHasHidden ){ |
| 2396 | @ <tr><th align="right" valign="top">Branch Hiding:</th> |
| 2397 | @ <td valign="top"> |
| 2398 | @ <label><input type="checkbox" id="hidebr" name="hide"%s(zHideFlag) /> |
| 2399 | @ Hide branch |
| 2400 | @ <span style="font-weight:bold" id="hbranch">%h(zBranchName)</span> |
| 2401 | @ from the timeline starting from this check-in</label> |
| 2402 | @ </td></tr> |
| 2403 | } |
| 2404 | if( !fHasClosed ){ |
| 2405 |
+22
-22
| --- src/login.c | ||
| +++ src/login.c | ||
| @@ -41,11 +41,11 @@ | ||
| 41 | 41 | ** logs and downloading diffs of very version of the archive that |
| 42 | 42 | ** has ever existed, and things like that. |
| 43 | 43 | */ |
| 44 | 44 | #include "config.h" |
| 45 | 45 | #include "login.h" |
| 46 | -#if defined(_WIN32) | |
| 46 | +#if defined(_WIN32) | |
| 47 | 47 | # include <windows.h> /* for Sleep */ |
| 48 | 48 | # if defined(__MINGW32__) || defined(_MSC_VER) |
| 49 | 49 | # define sleep Sleep /* windows does not have sleep, but Sleep */ |
| 50 | 50 | # endif |
| 51 | 51 | #endif |
| @@ -112,13 +112,13 @@ | ||
| 112 | 112 | } |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | /* |
| 116 | 116 | ** The IP address of the client is stored as part of login cookies. |
| 117 | -** But some clients are behind firewalls that shift the IP address | |
| 118 | -** with each HTTP request. To allow such (broken) clients to log in, | |
| 119 | -** extract just a prefix of the IP address. | |
| 117 | +** But some clients are behind firewalls that shift the IP address | |
| 118 | +** with each HTTP request. To allow such (broken) clients to log in, | |
| 119 | +** extract just a prefix of the IP address. | |
| 120 | 120 | */ |
| 121 | 121 | static char *ipPrefix(const char *zIP){ |
| 122 | 122 | int i, j; |
| 123 | 123 | static int ip_prefix_terms = -1; |
| 124 | 124 | if( ip_prefix_terms<0 ){ |
| @@ -344,11 +344,11 @@ | ||
| 344 | 344 | */ |
| 345 | 345 | void login_clear_login_data(){ |
| 346 | 346 | if(!g.userUid){ |
| 347 | 347 | return; |
| 348 | 348 | }else{ |
| 349 | - char const * cookie = login_cookie_name(); | |
| 349 | + char const * cookie = login_cookie_name(); | |
| 350 | 350 | /* To logout, change the cookie value to an empty string */ |
| 351 | 351 | cgi_set_cookie(cookie, "", |
| 352 | 352 | login_cookie_path(), -86400); |
| 353 | 353 | db_multi_exec("UPDATE user SET cookie=NULL, ipaddr=NULL, " |
| 354 | 354 | " cexpire=0 WHERE uid=%d" |
| @@ -491,21 +491,21 @@ | ||
| 491 | 491 | /* The user requests a password change */ |
| 492 | 492 | zSha1Pw = sha1_shared_secret(zPasswd, g.zLogin, 0); |
| 493 | 493 | if( db_int(1, "SELECT 0 FROM user" |
| 494 | 494 | " WHERE uid=%d" |
| 495 | 495 | " AND (constant_time_cmp(pw,%Q)=0" |
| 496 | - " OR constant_time_cmp(pw,%Q)=0)", | |
| 496 | + " OR constant_time_cmp(pw,%Q)=0)", | |
| 497 | 497 | g.userUid, zSha1Pw, zPasswd) ){ |
| 498 | 498 | sleep(1); |
| 499 | - zErrMsg = | |
| 499 | + zErrMsg = | |
| 500 | 500 | @ <p><span class="loginError"> |
| 501 | 501 | @ You entered an incorrect old password while attempting to change |
| 502 | 502 | @ your password. Your password is unchanged. |
| 503 | 503 | @ </span></p> |
| 504 | 504 | ; |
| 505 | 505 | }else if( fossil_strcmp(zNew1,zNew2)!=0 ){ |
| 506 | - zErrMsg = | |
| 506 | + zErrMsg = | |
| 507 | 507 | @ <p><span class="loginError"> |
| 508 | 508 | @ The two copies of your new passwords do not match. |
| 509 | 509 | @ Your password is unchanged. |
| 510 | 510 | @ </span></p> |
| 511 | 511 | ; |
| @@ -544,11 +544,11 @@ | ||
| 544 | 544 | /* Attempting to log in as a user other than anonymous. |
| 545 | 545 | */ |
| 546 | 546 | uid = login_search_uid(zUsername, zPasswd); |
| 547 | 547 | if( uid<=0 ){ |
| 548 | 548 | sleep(1); |
| 549 | - zErrMsg = | |
| 549 | + zErrMsg = | |
| 550 | 550 | @ <p><span class="loginError"> |
| 551 | 551 | @ You entered an unknown user or an incorrect password. |
| 552 | 552 | @ </span></p> |
| 553 | 553 | ; |
| 554 | 554 | record_login_attempt(zUsername, zIpAddr, 0); |
| @@ -620,11 +620,11 @@ | ||
| 620 | 620 | @ your user-id and password at the left and press the |
| 621 | 621 | @ "Login" button. Your user name will be stored in a browser cookie. |
| 622 | 622 | @ You must configure your web browser to accept cookies in order for |
| 623 | 623 | @ the login to take.</p> |
| 624 | 624 | if( db_get_boolean("self-register", 0) ){ |
| 625 | - @ <p>If you do not have an account, you can | |
| 625 | + @ <p>If you do not have an account, you can | |
| 626 | 626 | @ <a href="%s(g.zTop)/register?g=%T(P("G"))">create one</a>. |
| 627 | 627 | } |
| 628 | 628 | if( zAnonPw ){ |
| 629 | 629 | unsigned int uSeed = captcha_seed(); |
| 630 | 630 | char const *zDecoded = captcha_decode(uSeed); |
| @@ -672,11 +672,11 @@ | ||
| 672 | 672 | style_footer(); |
| 673 | 673 | } |
| 674 | 674 | |
| 675 | 675 | /* |
| 676 | 676 | ** Attempt to find login credentials for user zLogin on a peer repository |
| 677 | -** with project code zCode. Transfer those credentials to the local | |
| 677 | +** with project code zCode. Transfer those credentials to the local | |
| 678 | 678 | ** repository. |
| 679 | 679 | ** |
| 680 | 680 | ** Return true if a transfer was made and false if not. |
| 681 | 681 | */ |
| 682 | 682 | static int login_transfer_credentials( |
| @@ -690,11 +690,11 @@ | ||
| 690 | 690 | char *zSQL; /* SQL of the query against other repo */ |
| 691 | 691 | char *zOtherRepo; /* Filename of the other repository */ |
| 692 | 692 | int rc; /* Result code from SQLite library functions */ |
| 693 | 693 | int nXfer = 0; /* Number of credentials transferred */ |
| 694 | 694 | |
| 695 | - zOtherRepo = db_text(0, | |
| 695 | + zOtherRepo = db_text(0, | |
| 696 | 696 | "SELECT value FROM config WHERE name='peer-repo-%q'", |
| 697 | 697 | zCode |
| 698 | 698 | ); |
| 699 | 699 | if( zOtherRepo==0 ) return 0; /* No such peer repository */ |
| 700 | 700 | |
| @@ -752,11 +752,11 @@ | ||
| 752 | 752 | int uid; |
| 753 | 753 | if( fossil_strcmp(zLogin, "anonymous")==0 ) return 0; |
| 754 | 754 | if( fossil_strcmp(zLogin, "nobody")==0 ) return 0; |
| 755 | 755 | if( fossil_strcmp(zLogin, "developer")==0 ) return 0; |
| 756 | 756 | if( fossil_strcmp(zLogin, "reader")==0 ) return 0; |
| 757 | - uid = db_int(0, | |
| 757 | + uid = db_int(0, | |
| 758 | 758 | "SELECT uid FROM user" |
| 759 | 759 | " WHERE login=%Q" |
| 760 | 760 | " AND ipaddr=%Q" |
| 761 | 761 | " AND cexpire>julianday('now')" |
| 762 | 762 | " AND length(cap)>0" |
| @@ -792,11 +792,11 @@ | ||
| 792 | 792 | |
| 793 | 793 | sqlite3_create_function(g.db, "constant_time_cmp", 2, SQLITE_UTF8, 0, |
| 794 | 794 | constant_time_cmp_function, 0, 0); |
| 795 | 795 | |
| 796 | 796 | /* If the HTTP connection is coming over 127.0.0.1 and if |
| 797 | - ** local login is disabled and if we are using HTTP and not HTTPS, | |
| 797 | + ** local login is disabled and if we are using HTTP and not HTTPS, | |
| 798 | 798 | ** then there is no need to check user credentials. |
| 799 | 799 | ** |
| 800 | 800 | ** This feature allows the "fossil ui" command to give the user |
| 801 | 801 | ** full access rights without having to log in. |
| 802 | 802 | */ |
| @@ -847,15 +847,15 @@ | ||
| 847 | 847 | ** SECRET is the "captcha-secret" value in the repository. |
| 848 | 848 | */ |
| 849 | 849 | double rTime = atof(zArg); |
| 850 | 850 | Blob b; |
| 851 | 851 | blob_zero(&b); |
| 852 | - blob_appendf(&b, "%s/%s/%s", | |
| 852 | + blob_appendf(&b, "%s/%s/%s", | |
| 853 | 853 | zArg, zRemoteAddr, db_get("captcha-secret","")); |
| 854 | 854 | sha1sum_blob(&b, &b); |
| 855 | 855 | if( fossil_strcmp(zHash, blob_str(&b))==0 ){ |
| 856 | - uid = db_int(0, | |
| 856 | + uid = db_int(0, | |
| 857 | 857 | "SELECT uid FROM user WHERE login='anonymous'" |
| 858 | 858 | " AND length(cap)>0" |
| 859 | 859 | " AND length(pw)>0" |
| 860 | 860 | " AND %.17g+0.25>julianday('now')", |
| 861 | 861 | rTime |
| @@ -1002,11 +1002,11 @@ | ||
| 1002 | 1002 | for(i=0; zCap[i]; i++){ |
| 1003 | 1003 | switch( zCap[i] ){ |
| 1004 | 1004 | case 's': g.perm.Setup = 1; /* Fall thru into Admin */ |
| 1005 | 1005 | case 'a': g.perm.Admin = g.perm.RdTkt = g.perm.WrTkt = g.perm.Zip = |
| 1006 | 1006 | g.perm.RdWiki = g.perm.WrWiki = g.perm.NewWiki = |
| 1007 | - g.perm.ApndWiki = g.perm.Hyperlink = g.perm.Clone = | |
| 1007 | + g.perm.ApndWiki = g.perm.Hyperlink = g.perm.Clone = | |
| 1008 | 1008 | g.perm.NewTkt = g.perm.Password = g.perm.RdAddr = |
| 1009 | 1009 | g.perm.TktFmt = g.perm.Attach = g.perm.ApndTkt = |
| 1010 | 1010 | g.perm.ModWiki = g.perm.ModTkt = 1; |
| 1011 | 1011 | /* Fall thru into Read/Write */ |
| 1012 | 1012 | case 'i': g.perm.Read = g.perm.Write = 1; break; |
| @@ -1025,19 +1025,19 @@ | ||
| 1025 | 1025 | case 'l': g.perm.ModWiki = 1; break; |
| 1026 | 1026 | |
| 1027 | 1027 | case 'e': g.perm.RdAddr = 1; break; |
| 1028 | 1028 | case 'r': g.perm.RdTkt = 1; break; |
| 1029 | 1029 | case 'n': g.perm.NewTkt = 1; break; |
| 1030 | - case 'w': g.perm.WrTkt = g.perm.RdTkt = g.perm.NewTkt = | |
| 1030 | + case 'w': g.perm.WrTkt = g.perm.RdTkt = g.perm.NewTkt = | |
| 1031 | 1031 | g.perm.ApndTkt = 1; break; |
| 1032 | 1032 | case 'c': g.perm.ApndTkt = 1; break; |
| 1033 | 1033 | case 'q': g.perm.ModTkt = 1; break; |
| 1034 | 1034 | case 't': g.perm.TktFmt = 1; break; |
| 1035 | 1035 | case 'b': g.perm.Attach = 1; break; |
| 1036 | 1036 | case 'x': g.perm.Private = 1; break; |
| 1037 | 1037 | |
| 1038 | - /* The "u" privileges is a little different. It recursively | |
| 1038 | + /* The "u" privileges is a little different. It recursively | |
| 1039 | 1039 | ** inherits all privileges of the user named "reader" */ |
| 1040 | 1040 | case 'u': { |
| 1041 | 1041 | if( (flags & LOGIN_IGNORE_UV)==0 ){ |
| 1042 | 1042 | const char *zUser; |
| 1043 | 1043 | zUser = db_text("", "SELECT cap FROM user WHERE login='reader'"); |
| @@ -1044,11 +1044,11 @@ | ||
| 1044 | 1044 | login_set_capabilities(zUser, flags | LOGIN_IGNORE_UV); |
| 1045 | 1045 | } |
| 1046 | 1046 | break; |
| 1047 | 1047 | } |
| 1048 | 1048 | |
| 1049 | - /* The "v" privileges is a little different. It recursively | |
| 1049 | + /* The "v" privileges is a little different. It recursively | |
| 1050 | 1050 | ** inherits all privileges of the user named "developer" */ |
| 1051 | 1051 | case 'v': { |
| 1052 | 1052 | if( (flags & LOGIN_IGNORE_UV)==0 ){ |
| 1053 | 1053 | const char *zDev; |
| 1054 | 1054 | zDev = db_text("", "SELECT cap FROM user WHERE login='developer'"); |
| @@ -1359,11 +1359,11 @@ | ||
| 1359 | 1359 | if( zPrefix==0 ) zPrefix = ""; |
| 1360 | 1360 | if( zSuffix==0 ) zSuffix = ""; |
| 1361 | 1361 | if( pzErrorMsg ) *pzErrorMsg = 0; |
| 1362 | 1362 | zSelfCode = abbreviated_project_code(db_get("project-code", "x")); |
| 1363 | 1363 | blob_zero(&err); |
| 1364 | - db_prepare(&q, | |
| 1364 | + db_prepare(&q, | |
| 1365 | 1365 | "SELECT name, value FROM config" |
| 1366 | 1366 | " WHERE name GLOB 'peer-repo-*'" |
| 1367 | 1367 | " AND name <> 'peer-repo-%q'" |
| 1368 | 1368 | " ORDER BY +value", |
| 1369 | 1369 | zSelfCode |
| @@ -1441,11 +1441,11 @@ | ||
| 1441 | 1441 | const char *zSelf; /* The ATTACH name of our repository */ |
| 1442 | 1442 | |
| 1443 | 1443 | *pzErrMsg = 0; /* Default to no errors */ |
| 1444 | 1444 | zSelf = db_name("repository"); |
| 1445 | 1445 | |
| 1446 | - /* Get the full pathname of the other repository */ | |
| 1446 | + /* Get the full pathname of the other repository */ | |
| 1447 | 1447 | file_canonical_name(zRepo, &fullName, 0); |
| 1448 | 1448 | zRepo = mprintf(blob_str(&fullName)); |
| 1449 | 1449 | blob_reset(&fullName); |
| 1450 | 1450 | |
| 1451 | 1451 | /* Get the full pathname for our repository. Also the project code |
| 1452 | 1452 |
| --- src/login.c | |
| +++ src/login.c | |
| @@ -41,11 +41,11 @@ | |
| 41 | ** logs and downloading diffs of very version of the archive that |
| 42 | ** has ever existed, and things like that. |
| 43 | */ |
| 44 | #include "config.h" |
| 45 | #include "login.h" |
| 46 | #if defined(_WIN32) |
| 47 | # include <windows.h> /* for Sleep */ |
| 48 | # if defined(__MINGW32__) || defined(_MSC_VER) |
| 49 | # define sleep Sleep /* windows does not have sleep, but Sleep */ |
| 50 | # endif |
| 51 | #endif |
| @@ -112,13 +112,13 @@ | |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | /* |
| 116 | ** The IP address of the client is stored as part of login cookies. |
| 117 | ** But some clients are behind firewalls that shift the IP address |
| 118 | ** with each HTTP request. To allow such (broken) clients to log in, |
| 119 | ** extract just a prefix of the IP address. |
| 120 | */ |
| 121 | static char *ipPrefix(const char *zIP){ |
| 122 | int i, j; |
| 123 | static int ip_prefix_terms = -1; |
| 124 | if( ip_prefix_terms<0 ){ |
| @@ -344,11 +344,11 @@ | |
| 344 | */ |
| 345 | void login_clear_login_data(){ |
| 346 | if(!g.userUid){ |
| 347 | return; |
| 348 | }else{ |
| 349 | char const * cookie = login_cookie_name(); |
| 350 | /* To logout, change the cookie value to an empty string */ |
| 351 | cgi_set_cookie(cookie, "", |
| 352 | login_cookie_path(), -86400); |
| 353 | db_multi_exec("UPDATE user SET cookie=NULL, ipaddr=NULL, " |
| 354 | " cexpire=0 WHERE uid=%d" |
| @@ -491,21 +491,21 @@ | |
| 491 | /* The user requests a password change */ |
| 492 | zSha1Pw = sha1_shared_secret(zPasswd, g.zLogin, 0); |
| 493 | if( db_int(1, "SELECT 0 FROM user" |
| 494 | " WHERE uid=%d" |
| 495 | " AND (constant_time_cmp(pw,%Q)=0" |
| 496 | " OR constant_time_cmp(pw,%Q)=0)", |
| 497 | g.userUid, zSha1Pw, zPasswd) ){ |
| 498 | sleep(1); |
| 499 | zErrMsg = |
| 500 | @ <p><span class="loginError"> |
| 501 | @ You entered an incorrect old password while attempting to change |
| 502 | @ your password. Your password is unchanged. |
| 503 | @ </span></p> |
| 504 | ; |
| 505 | }else if( fossil_strcmp(zNew1,zNew2)!=0 ){ |
| 506 | zErrMsg = |
| 507 | @ <p><span class="loginError"> |
| 508 | @ The two copies of your new passwords do not match. |
| 509 | @ Your password is unchanged. |
| 510 | @ </span></p> |
| 511 | ; |
| @@ -544,11 +544,11 @@ | |
| 544 | /* Attempting to log in as a user other than anonymous. |
| 545 | */ |
| 546 | uid = login_search_uid(zUsername, zPasswd); |
| 547 | if( uid<=0 ){ |
| 548 | sleep(1); |
| 549 | zErrMsg = |
| 550 | @ <p><span class="loginError"> |
| 551 | @ You entered an unknown user or an incorrect password. |
| 552 | @ </span></p> |
| 553 | ; |
| 554 | record_login_attempt(zUsername, zIpAddr, 0); |
| @@ -620,11 +620,11 @@ | |
| 620 | @ your user-id and password at the left and press the |
| 621 | @ "Login" button. Your user name will be stored in a browser cookie. |
| 622 | @ You must configure your web browser to accept cookies in order for |
| 623 | @ the login to take.</p> |
| 624 | if( db_get_boolean("self-register", 0) ){ |
| 625 | @ <p>If you do not have an account, you can |
| 626 | @ <a href="%s(g.zTop)/register?g=%T(P("G"))">create one</a>. |
| 627 | } |
| 628 | if( zAnonPw ){ |
| 629 | unsigned int uSeed = captcha_seed(); |
| 630 | char const *zDecoded = captcha_decode(uSeed); |
| @@ -672,11 +672,11 @@ | |
| 672 | style_footer(); |
| 673 | } |
| 674 | |
| 675 | /* |
| 676 | ** Attempt to find login credentials for user zLogin on a peer repository |
| 677 | ** with project code zCode. Transfer those credentials to the local |
| 678 | ** repository. |
| 679 | ** |
| 680 | ** Return true if a transfer was made and false if not. |
| 681 | */ |
| 682 | static int login_transfer_credentials( |
| @@ -690,11 +690,11 @@ | |
| 690 | char *zSQL; /* SQL of the query against other repo */ |
| 691 | char *zOtherRepo; /* Filename of the other repository */ |
| 692 | int rc; /* Result code from SQLite library functions */ |
| 693 | int nXfer = 0; /* Number of credentials transferred */ |
| 694 | |
| 695 | zOtherRepo = db_text(0, |
| 696 | "SELECT value FROM config WHERE name='peer-repo-%q'", |
| 697 | zCode |
| 698 | ); |
| 699 | if( zOtherRepo==0 ) return 0; /* No such peer repository */ |
| 700 | |
| @@ -752,11 +752,11 @@ | |
| 752 | int uid; |
| 753 | if( fossil_strcmp(zLogin, "anonymous")==0 ) return 0; |
| 754 | if( fossil_strcmp(zLogin, "nobody")==0 ) return 0; |
| 755 | if( fossil_strcmp(zLogin, "developer")==0 ) return 0; |
| 756 | if( fossil_strcmp(zLogin, "reader")==0 ) return 0; |
| 757 | uid = db_int(0, |
| 758 | "SELECT uid FROM user" |
| 759 | " WHERE login=%Q" |
| 760 | " AND ipaddr=%Q" |
| 761 | " AND cexpire>julianday('now')" |
| 762 | " AND length(cap)>0" |
| @@ -792,11 +792,11 @@ | |
| 792 | |
| 793 | sqlite3_create_function(g.db, "constant_time_cmp", 2, SQLITE_UTF8, 0, |
| 794 | constant_time_cmp_function, 0, 0); |
| 795 | |
| 796 | /* If the HTTP connection is coming over 127.0.0.1 and if |
| 797 | ** local login is disabled and if we are using HTTP and not HTTPS, |
| 798 | ** then there is no need to check user credentials. |
| 799 | ** |
| 800 | ** This feature allows the "fossil ui" command to give the user |
| 801 | ** full access rights without having to log in. |
| 802 | */ |
| @@ -847,15 +847,15 @@ | |
| 847 | ** SECRET is the "captcha-secret" value in the repository. |
| 848 | */ |
| 849 | double rTime = atof(zArg); |
| 850 | Blob b; |
| 851 | blob_zero(&b); |
| 852 | blob_appendf(&b, "%s/%s/%s", |
| 853 | zArg, zRemoteAddr, db_get("captcha-secret","")); |
| 854 | sha1sum_blob(&b, &b); |
| 855 | if( fossil_strcmp(zHash, blob_str(&b))==0 ){ |
| 856 | uid = db_int(0, |
| 857 | "SELECT uid FROM user WHERE login='anonymous'" |
| 858 | " AND length(cap)>0" |
| 859 | " AND length(pw)>0" |
| 860 | " AND %.17g+0.25>julianday('now')", |
| 861 | rTime |
| @@ -1002,11 +1002,11 @@ | |
| 1002 | for(i=0; zCap[i]; i++){ |
| 1003 | switch( zCap[i] ){ |
| 1004 | case 's': g.perm.Setup = 1; /* Fall thru into Admin */ |
| 1005 | case 'a': g.perm.Admin = g.perm.RdTkt = g.perm.WrTkt = g.perm.Zip = |
| 1006 | g.perm.RdWiki = g.perm.WrWiki = g.perm.NewWiki = |
| 1007 | g.perm.ApndWiki = g.perm.Hyperlink = g.perm.Clone = |
| 1008 | g.perm.NewTkt = g.perm.Password = g.perm.RdAddr = |
| 1009 | g.perm.TktFmt = g.perm.Attach = g.perm.ApndTkt = |
| 1010 | g.perm.ModWiki = g.perm.ModTkt = 1; |
| 1011 | /* Fall thru into Read/Write */ |
| 1012 | case 'i': g.perm.Read = g.perm.Write = 1; break; |
| @@ -1025,19 +1025,19 @@ | |
| 1025 | case 'l': g.perm.ModWiki = 1; break; |
| 1026 | |
| 1027 | case 'e': g.perm.RdAddr = 1; break; |
| 1028 | case 'r': g.perm.RdTkt = 1; break; |
| 1029 | case 'n': g.perm.NewTkt = 1; break; |
| 1030 | case 'w': g.perm.WrTkt = g.perm.RdTkt = g.perm.NewTkt = |
| 1031 | g.perm.ApndTkt = 1; break; |
| 1032 | case 'c': g.perm.ApndTkt = 1; break; |
| 1033 | case 'q': g.perm.ModTkt = 1; break; |
| 1034 | case 't': g.perm.TktFmt = 1; break; |
| 1035 | case 'b': g.perm.Attach = 1; break; |
| 1036 | case 'x': g.perm.Private = 1; break; |
| 1037 | |
| 1038 | /* The "u" privileges is a little different. It recursively |
| 1039 | ** inherits all privileges of the user named "reader" */ |
| 1040 | case 'u': { |
| 1041 | if( (flags & LOGIN_IGNORE_UV)==0 ){ |
| 1042 | const char *zUser; |
| 1043 | zUser = db_text("", "SELECT cap FROM user WHERE login='reader'"); |
| @@ -1044,11 +1044,11 @@ | |
| 1044 | login_set_capabilities(zUser, flags | LOGIN_IGNORE_UV); |
| 1045 | } |
| 1046 | break; |
| 1047 | } |
| 1048 | |
| 1049 | /* The "v" privileges is a little different. It recursively |
| 1050 | ** inherits all privileges of the user named "developer" */ |
| 1051 | case 'v': { |
| 1052 | if( (flags & LOGIN_IGNORE_UV)==0 ){ |
| 1053 | const char *zDev; |
| 1054 | zDev = db_text("", "SELECT cap FROM user WHERE login='developer'"); |
| @@ -1359,11 +1359,11 @@ | |
| 1359 | if( zPrefix==0 ) zPrefix = ""; |
| 1360 | if( zSuffix==0 ) zSuffix = ""; |
| 1361 | if( pzErrorMsg ) *pzErrorMsg = 0; |
| 1362 | zSelfCode = abbreviated_project_code(db_get("project-code", "x")); |
| 1363 | blob_zero(&err); |
| 1364 | db_prepare(&q, |
| 1365 | "SELECT name, value FROM config" |
| 1366 | " WHERE name GLOB 'peer-repo-*'" |
| 1367 | " AND name <> 'peer-repo-%q'" |
| 1368 | " ORDER BY +value", |
| 1369 | zSelfCode |
| @@ -1441,11 +1441,11 @@ | |
| 1441 | const char *zSelf; /* The ATTACH name of our repository */ |
| 1442 | |
| 1443 | *pzErrMsg = 0; /* Default to no errors */ |
| 1444 | zSelf = db_name("repository"); |
| 1445 | |
| 1446 | /* Get the full pathname of the other repository */ |
| 1447 | file_canonical_name(zRepo, &fullName, 0); |
| 1448 | zRepo = mprintf(blob_str(&fullName)); |
| 1449 | blob_reset(&fullName); |
| 1450 | |
| 1451 | /* Get the full pathname for our repository. Also the project code |
| 1452 |
| --- src/login.c | |
| +++ src/login.c | |
| @@ -41,11 +41,11 @@ | |
| 41 | ** logs and downloading diffs of very version of the archive that |
| 42 | ** has ever existed, and things like that. |
| 43 | */ |
| 44 | #include "config.h" |
| 45 | #include "login.h" |
| 46 | #if defined(_WIN32) |
| 47 | # include <windows.h> /* for Sleep */ |
| 48 | # if defined(__MINGW32__) || defined(_MSC_VER) |
| 49 | # define sleep Sleep /* windows does not have sleep, but Sleep */ |
| 50 | # endif |
| 51 | #endif |
| @@ -112,13 +112,13 @@ | |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | /* |
| 116 | ** The IP address of the client is stored as part of login cookies. |
| 117 | ** But some clients are behind firewalls that shift the IP address |
| 118 | ** with each HTTP request. To allow such (broken) clients to log in, |
| 119 | ** extract just a prefix of the IP address. |
| 120 | */ |
| 121 | static char *ipPrefix(const char *zIP){ |
| 122 | int i, j; |
| 123 | static int ip_prefix_terms = -1; |
| 124 | if( ip_prefix_terms<0 ){ |
| @@ -344,11 +344,11 @@ | |
| 344 | */ |
| 345 | void login_clear_login_data(){ |
| 346 | if(!g.userUid){ |
| 347 | return; |
| 348 | }else{ |
| 349 | char const * cookie = login_cookie_name(); |
| 350 | /* To logout, change the cookie value to an empty string */ |
| 351 | cgi_set_cookie(cookie, "", |
| 352 | login_cookie_path(), -86400); |
| 353 | db_multi_exec("UPDATE user SET cookie=NULL, ipaddr=NULL, " |
| 354 | " cexpire=0 WHERE uid=%d" |
| @@ -491,21 +491,21 @@ | |
| 491 | /* The user requests a password change */ |
| 492 | zSha1Pw = sha1_shared_secret(zPasswd, g.zLogin, 0); |
| 493 | if( db_int(1, "SELECT 0 FROM user" |
| 494 | " WHERE uid=%d" |
| 495 | " AND (constant_time_cmp(pw,%Q)=0" |
| 496 | " OR constant_time_cmp(pw,%Q)=0)", |
| 497 | g.userUid, zSha1Pw, zPasswd) ){ |
| 498 | sleep(1); |
| 499 | zErrMsg = |
| 500 | @ <p><span class="loginError"> |
| 501 | @ You entered an incorrect old password while attempting to change |
| 502 | @ your password. Your password is unchanged. |
| 503 | @ </span></p> |
| 504 | ; |
| 505 | }else if( fossil_strcmp(zNew1,zNew2)!=0 ){ |
| 506 | zErrMsg = |
| 507 | @ <p><span class="loginError"> |
| 508 | @ The two copies of your new passwords do not match. |
| 509 | @ Your password is unchanged. |
| 510 | @ </span></p> |
| 511 | ; |
| @@ -544,11 +544,11 @@ | |
| 544 | /* Attempting to log in as a user other than anonymous. |
| 545 | */ |
| 546 | uid = login_search_uid(zUsername, zPasswd); |
| 547 | if( uid<=0 ){ |
| 548 | sleep(1); |
| 549 | zErrMsg = |
| 550 | @ <p><span class="loginError"> |
| 551 | @ You entered an unknown user or an incorrect password. |
| 552 | @ </span></p> |
| 553 | ; |
| 554 | record_login_attempt(zUsername, zIpAddr, 0); |
| @@ -620,11 +620,11 @@ | |
| 620 | @ your user-id and password at the left and press the |
| 621 | @ "Login" button. Your user name will be stored in a browser cookie. |
| 622 | @ You must configure your web browser to accept cookies in order for |
| 623 | @ the login to take.</p> |
| 624 | if( db_get_boolean("self-register", 0) ){ |
| 625 | @ <p>If you do not have an account, you can |
| 626 | @ <a href="%s(g.zTop)/register?g=%T(P("G"))">create one</a>. |
| 627 | } |
| 628 | if( zAnonPw ){ |
| 629 | unsigned int uSeed = captcha_seed(); |
| 630 | char const *zDecoded = captcha_decode(uSeed); |
| @@ -672,11 +672,11 @@ | |
| 672 | style_footer(); |
| 673 | } |
| 674 | |
| 675 | /* |
| 676 | ** Attempt to find login credentials for user zLogin on a peer repository |
| 677 | ** with project code zCode. Transfer those credentials to the local |
| 678 | ** repository. |
| 679 | ** |
| 680 | ** Return true if a transfer was made and false if not. |
| 681 | */ |
| 682 | static int login_transfer_credentials( |
| @@ -690,11 +690,11 @@ | |
| 690 | char *zSQL; /* SQL of the query against other repo */ |
| 691 | char *zOtherRepo; /* Filename of the other repository */ |
| 692 | int rc; /* Result code from SQLite library functions */ |
| 693 | int nXfer = 0; /* Number of credentials transferred */ |
| 694 | |
| 695 | zOtherRepo = db_text(0, |
| 696 | "SELECT value FROM config WHERE name='peer-repo-%q'", |
| 697 | zCode |
| 698 | ); |
| 699 | if( zOtherRepo==0 ) return 0; /* No such peer repository */ |
| 700 | |
| @@ -752,11 +752,11 @@ | |
| 752 | int uid; |
| 753 | if( fossil_strcmp(zLogin, "anonymous")==0 ) return 0; |
| 754 | if( fossil_strcmp(zLogin, "nobody")==0 ) return 0; |
| 755 | if( fossil_strcmp(zLogin, "developer")==0 ) return 0; |
| 756 | if( fossil_strcmp(zLogin, "reader")==0 ) return 0; |
| 757 | uid = db_int(0, |
| 758 | "SELECT uid FROM user" |
| 759 | " WHERE login=%Q" |
| 760 | " AND ipaddr=%Q" |
| 761 | " AND cexpire>julianday('now')" |
| 762 | " AND length(cap)>0" |
| @@ -792,11 +792,11 @@ | |
| 792 | |
| 793 | sqlite3_create_function(g.db, "constant_time_cmp", 2, SQLITE_UTF8, 0, |
| 794 | constant_time_cmp_function, 0, 0); |
| 795 | |
| 796 | /* If the HTTP connection is coming over 127.0.0.1 and if |
| 797 | ** local login is disabled and if we are using HTTP and not HTTPS, |
| 798 | ** then there is no need to check user credentials. |
| 799 | ** |
| 800 | ** This feature allows the "fossil ui" command to give the user |
| 801 | ** full access rights without having to log in. |
| 802 | */ |
| @@ -847,15 +847,15 @@ | |
| 847 | ** SECRET is the "captcha-secret" value in the repository. |
| 848 | */ |
| 849 | double rTime = atof(zArg); |
| 850 | Blob b; |
| 851 | blob_zero(&b); |
| 852 | blob_appendf(&b, "%s/%s/%s", |
| 853 | zArg, zRemoteAddr, db_get("captcha-secret","")); |
| 854 | sha1sum_blob(&b, &b); |
| 855 | if( fossil_strcmp(zHash, blob_str(&b))==0 ){ |
| 856 | uid = db_int(0, |
| 857 | "SELECT uid FROM user WHERE login='anonymous'" |
| 858 | " AND length(cap)>0" |
| 859 | " AND length(pw)>0" |
| 860 | " AND %.17g+0.25>julianday('now')", |
| 861 | rTime |
| @@ -1002,11 +1002,11 @@ | |
| 1002 | for(i=0; zCap[i]; i++){ |
| 1003 | switch( zCap[i] ){ |
| 1004 | case 's': g.perm.Setup = 1; /* Fall thru into Admin */ |
| 1005 | case 'a': g.perm.Admin = g.perm.RdTkt = g.perm.WrTkt = g.perm.Zip = |
| 1006 | g.perm.RdWiki = g.perm.WrWiki = g.perm.NewWiki = |
| 1007 | g.perm.ApndWiki = g.perm.Hyperlink = g.perm.Clone = |
| 1008 | g.perm.NewTkt = g.perm.Password = g.perm.RdAddr = |
| 1009 | g.perm.TktFmt = g.perm.Attach = g.perm.ApndTkt = |
| 1010 | g.perm.ModWiki = g.perm.ModTkt = 1; |
| 1011 | /* Fall thru into Read/Write */ |
| 1012 | case 'i': g.perm.Read = g.perm.Write = 1; break; |
| @@ -1025,19 +1025,19 @@ | |
| 1025 | case 'l': g.perm.ModWiki = 1; break; |
| 1026 | |
| 1027 | case 'e': g.perm.RdAddr = 1; break; |
| 1028 | case 'r': g.perm.RdTkt = 1; break; |
| 1029 | case 'n': g.perm.NewTkt = 1; break; |
| 1030 | case 'w': g.perm.WrTkt = g.perm.RdTkt = g.perm.NewTkt = |
| 1031 | g.perm.ApndTkt = 1; break; |
| 1032 | case 'c': g.perm.ApndTkt = 1; break; |
| 1033 | case 'q': g.perm.ModTkt = 1; break; |
| 1034 | case 't': g.perm.TktFmt = 1; break; |
| 1035 | case 'b': g.perm.Attach = 1; break; |
| 1036 | case 'x': g.perm.Private = 1; break; |
| 1037 | |
| 1038 | /* The "u" privileges is a little different. It recursively |
| 1039 | ** inherits all privileges of the user named "reader" */ |
| 1040 | case 'u': { |
| 1041 | if( (flags & LOGIN_IGNORE_UV)==0 ){ |
| 1042 | const char *zUser; |
| 1043 | zUser = db_text("", "SELECT cap FROM user WHERE login='reader'"); |
| @@ -1044,11 +1044,11 @@ | |
| 1044 | login_set_capabilities(zUser, flags | LOGIN_IGNORE_UV); |
| 1045 | } |
| 1046 | break; |
| 1047 | } |
| 1048 | |
| 1049 | /* The "v" privileges is a little different. It recursively |
| 1050 | ** inherits all privileges of the user named "developer" */ |
| 1051 | case 'v': { |
| 1052 | if( (flags & LOGIN_IGNORE_UV)==0 ){ |
| 1053 | const char *zDev; |
| 1054 | zDev = db_text("", "SELECT cap FROM user WHERE login='developer'"); |
| @@ -1359,11 +1359,11 @@ | |
| 1359 | if( zPrefix==0 ) zPrefix = ""; |
| 1360 | if( zSuffix==0 ) zSuffix = ""; |
| 1361 | if( pzErrorMsg ) *pzErrorMsg = 0; |
| 1362 | zSelfCode = abbreviated_project_code(db_get("project-code", "x")); |
| 1363 | blob_zero(&err); |
| 1364 | db_prepare(&q, |
| 1365 | "SELECT name, value FROM config" |
| 1366 | " WHERE name GLOB 'peer-repo-*'" |
| 1367 | " AND name <> 'peer-repo-%q'" |
| 1368 | " ORDER BY +value", |
| 1369 | zSelfCode |
| @@ -1441,11 +1441,11 @@ | |
| 1441 | const char *zSelf; /* The ATTACH name of our repository */ |
| 1442 | |
| 1443 | *pzErrMsg = 0; /* Default to no errors */ |
| 1444 | zSelf = db_name("repository"); |
| 1445 | |
| 1446 | /* Get the full pathname of the other repository */ |
| 1447 | file_canonical_name(zRepo, &fullName, 0); |
| 1448 | zRepo = mprintf(blob_str(&fullName)); |
| 1449 | blob_reset(&fullName); |
| 1450 | |
| 1451 | /* Get the full pathname for our repository. Also the project code |
| 1452 |
+1
-1
| --- src/merge3.c | ||
| +++ src/merge3.c | ||
| @@ -364,11 +364,11 @@ | ||
| 364 | 364 | ** |
| 365 | 365 | ** fossil 3-way-merge Xbase.c Xlocal.c Xup.c Xlocal.c |
| 366 | 366 | ** cp Xup.c Xbase.c |
| 367 | 367 | ** # Verify that everything still works |
| 368 | 368 | ** fossil commit |
| 369 | -** | |
| 369 | +** | |
| 370 | 370 | */ |
| 371 | 371 | void delta_3waymerge_cmd(void){ |
| 372 | 372 | Blob pivot, v1, v2, merged; |
| 373 | 373 | if( g.argc!=6 ){ |
| 374 | 374 | usage("PIVOT V1 V2 MERGED"); |
| 375 | 375 |
| --- src/merge3.c | |
| +++ src/merge3.c | |
| @@ -364,11 +364,11 @@ | |
| 364 | ** |
| 365 | ** fossil 3-way-merge Xbase.c Xlocal.c Xup.c Xlocal.c |
| 366 | ** cp Xup.c Xbase.c |
| 367 | ** # Verify that everything still works |
| 368 | ** fossil commit |
| 369 | ** |
| 370 | */ |
| 371 | void delta_3waymerge_cmd(void){ |
| 372 | Blob pivot, v1, v2, merged; |
| 373 | if( g.argc!=6 ){ |
| 374 | usage("PIVOT V1 V2 MERGED"); |
| 375 |
| --- src/merge3.c | |
| +++ src/merge3.c | |
| @@ -364,11 +364,11 @@ | |
| 364 | ** |
| 365 | ** fossil 3-way-merge Xbase.c Xlocal.c Xup.c Xlocal.c |
| 366 | ** cp Xup.c Xbase.c |
| 367 | ** # Verify that everything still works |
| 368 | ** fossil commit |
| 369 | ** |
| 370 | */ |
| 371 | void delta_3waymerge_cmd(void){ |
| 372 | Blob pivot, v1, v2, merged; |
| 373 | if( g.argc!=6 ){ |
| 374 | usage("PIVOT V1 V2 MERGED"); |
| 375 |
+14
-14
| --- src/report.c | ||
| +++ src/report.c | ||
| @@ -12,11 +12,11 @@ | ||
| 12 | 12 | ** Author contact information: |
| 13 | 13 | ** [email protected] |
| 14 | 14 | ** http://www.hwaci.com/drh/ |
| 15 | 15 | ** |
| 16 | 16 | ******************************************************************************* |
| 17 | -** | |
| 17 | +** | |
| 18 | 18 | ** Code to generate the ticket listings |
| 19 | 19 | */ |
| 20 | 20 | #include "config.h" |
| 21 | 21 | #include <time.h> |
| 22 | 22 | #include "report.h" |
| @@ -43,11 +43,11 @@ | ||
| 43 | 43 | if( !g.perm.RdTkt && !g.perm.NewTkt ){ login_needed(); return; } |
| 44 | 44 | style_header("Ticket Main Menu"); |
| 45 | 45 | if( g.thTrace ) Th_Trace("BEGIN_REPORTLIST<br />\n", -1); |
| 46 | 46 | zScript = ticket_reportlist_code(); |
| 47 | 47 | if( g.thTrace ) Th_Trace("BEGIN_REPORTLIST_SCRIPT<br />\n", -1); |
| 48 | - | |
| 48 | + | |
| 49 | 49 | blob_zero(&ril); |
| 50 | 50 | ticket_init(); |
| 51 | 51 | |
| 52 | 52 | db_prepare(&q, "SELECT rn, title, owner FROM reportfmt ORDER BY title"); |
| 53 | 53 | while( db_step(&q)==SQLITE_ROW ){ |
| @@ -70,14 +70,14 @@ | ||
| 70 | 70 | } |
| 71 | 71 | if( g.perm.TktFmt ){ |
| 72 | 72 | blob_appendf(&ril, "[%zcopy</a>] ", |
| 73 | 73 | href("%R/rptedit?rn=%d©=1", rn)); |
| 74 | 74 | } |
| 75 | - if( g.perm.Admin | |
| 75 | + if( g.perm.Admin | |
| 76 | 76 | || (g.perm.WrTkt && zOwner && fossil_strcmp(g.zLogin,zOwner)==0) |
| 77 | 77 | ){ |
| 78 | - blob_appendf(&ril, "[%zedit</a>]", | |
| 78 | + blob_appendf(&ril, "[%zedit</a>]", | |
| 79 | 79 | href("%R/rptedit?rn=%d", rn)); |
| 80 | 80 | } |
| 81 | 81 | if( g.perm.TktFmt ){ |
| 82 | 82 | blob_appendf(&ril, "[%zsql</a>]", |
| 83 | 83 | href("%R/rptsql?rn=%d", rn)); |
| @@ -85,13 +85,13 @@ | ||
| 85 | 85 | blob_appendf(&ril, "</li>\n"); |
| 86 | 86 | } |
| 87 | 87 | db_finalize(&q); |
| 88 | 88 | |
| 89 | 89 | Th_Store("report_items", blob_str(&ril)); |
| 90 | - | |
| 90 | + | |
| 91 | 91 | Th_Render(zScript); |
| 92 | - | |
| 92 | + | |
| 93 | 93 | blob_reset(&ril); |
| 94 | 94 | if( g.thTrace ) Th_Trace("END_REPORTLIST<br />\n", -1); |
| 95 | 95 | |
| 96 | 96 | style_footer(); |
| 97 | 97 | } |
| @@ -205,11 +205,11 @@ | ||
| 205 | 205 | } |
| 206 | 206 | case SQLITE_RECURSIVE: { |
| 207 | 207 | *(char**)pError = mprintf("recursive queries are not allowed"); |
| 208 | 208 | rc = SQLITE_DENY; |
| 209 | 209 | break; |
| 210 | - } | |
| 210 | + } | |
| 211 | 211 | default: { |
| 212 | 212 | *(char**)pError = mprintf("only SELECT statements are allowed"); |
| 213 | 213 | rc = SQLITE_DENY; |
| 214 | 214 | break; |
| 215 | 215 | } |
| @@ -262,11 +262,11 @@ | ||
| 262 | 262 | return mprintf("Semi-colon detected! " |
| 263 | 263 | "Only a single SQL statement is allowed"); |
| 264 | 264 | } |
| 265 | 265 | } |
| 266 | 266 | } |
| 267 | - | |
| 267 | + | |
| 268 | 268 | /* Compile the statement and check for illegal accesses or syntax errors. */ |
| 269 | 269 | report_restrict_sql(&zErr); |
| 270 | 270 | rc = sqlite3_prepare(g.db, zSql, -1, &pStmt, &zTail); |
| 271 | 271 | if( rc!=SQLITE_OK ){ |
| 272 | 272 | zErr = mprintf("Syntax error: %s", sqlite3_errmsg(g.db)); |
| @@ -383,11 +383,11 @@ | ||
| 383 | 383 | } |
| 384 | 384 | if( zTitle && zSQL ){ |
| 385 | 385 | if( zSQL[0]==0 ){ |
| 386 | 386 | zErr = "Please supply an SQL query statement"; |
| 387 | 387 | }else if( (zTitle = trim_string(zTitle))[0]==0 ){ |
| 388 | - zErr = "Please supply a title"; | |
| 388 | + zErr = "Please supply a title"; | |
| 389 | 389 | }else{ |
| 390 | 390 | zErr = verify_sql_statement(zSQL); |
| 391 | 391 | } |
| 392 | 392 | if( zErr==0 |
| 393 | 393 | && db_exists("SELECT 1 FROM reportfmt WHERE title=%Q and rn<>%d", |
| @@ -1065,13 +1065,13 @@ | ||
| 1065 | 1065 | count = 0; |
| 1066 | 1066 | if( !tabs ){ |
| 1067 | 1067 | struct GenerateHTML sState; |
| 1068 | 1068 | |
| 1069 | 1069 | db_multi_exec("PRAGMA empty_result_callbacks=ON"); |
| 1070 | - style_submenu_element("Raw", "Raw", | |
| 1070 | + style_submenu_element("Raw", "Raw", | |
| 1071 | 1071 | "rptview?tablist=1&%h", PD("QUERY_STRING","")); |
| 1072 | - if( g.perm.Admin | |
| 1072 | + if( g.perm.Admin | |
| 1073 | 1073 | || (g.perm.TktFmt && g.zLogin && fossil_strcmp(g.zLogin,zOwner)==0) ){ |
| 1074 | 1074 | style_submenu_element("Edit", "Edit", "rptedit?rn=%d", rn); |
| 1075 | 1075 | } |
| 1076 | 1076 | if( g.perm.TktFmt ){ |
| 1077 | 1077 | style_submenu_element("SQL", "SQL", "rptsql?rn=%d",rn); |
| @@ -1079,11 +1079,11 @@ | ||
| 1079 | 1079 | if( g.perm.NewTkt ){ |
| 1080 | 1080 | style_submenu_element("New Ticket", "Create a new ticket", |
| 1081 | 1081 | "%s/tktnew", g.zTop); |
| 1082 | 1082 | } |
| 1083 | 1083 | style_header(zTitle); |
| 1084 | - output_color_key(zClrKey, 1, | |
| 1084 | + output_color_key(zClrKey, 1, | |
| 1085 | 1085 | "border=\"0\" cellpadding=\"3\" cellspacing=\"0\" class=\"report\""); |
| 1086 | 1086 | @ <table border="1" cellpadding="2" cellspacing="0" class="report" |
| 1087 | 1087 | @ id="reportTable"> |
| 1088 | 1088 | sState.rn = rn; |
| 1089 | 1089 | sState.nCount = 0; |
| @@ -1177,11 +1177,11 @@ | ||
| 1177 | 1177 | if( j>i ){ |
| 1178 | 1178 | fossil_print("%*s", j-i, ""); |
| 1179 | 1179 | } |
| 1180 | 1180 | z += j; |
| 1181 | 1181 | } |
| 1182 | - break; | |
| 1182 | + break; | |
| 1183 | 1183 | } |
| 1184 | 1184 | } |
| 1185 | 1185 | |
| 1186 | 1186 | /* |
| 1187 | 1187 | ** Output a row as a tab-separated line of text. |
| @@ -1212,11 +1212,11 @@ | ||
| 1212 | 1212 | /* |
| 1213 | 1213 | ** Generate a report. The rn query parameter is the report number. |
| 1214 | 1214 | ** The output is written to stdout as flat file. The zFilter parameter |
| 1215 | 1215 | ** is a full WHERE-condition. |
| 1216 | 1216 | */ |
| 1217 | -void rptshow( | |
| 1217 | +void rptshow( | |
| 1218 | 1218 | const char *zRep, |
| 1219 | 1219 | const char *zSepIn, |
| 1220 | 1220 | const char *zFilter, |
| 1221 | 1221 | tTktShowEncoding enc |
| 1222 | 1222 | ){ |
| 1223 | 1223 |
| --- src/report.c | |
| +++ src/report.c | |
| @@ -12,11 +12,11 @@ | |
| 12 | ** Author contact information: |
| 13 | ** [email protected] |
| 14 | ** http://www.hwaci.com/drh/ |
| 15 | ** |
| 16 | ******************************************************************************* |
| 17 | ** |
| 18 | ** Code to generate the ticket listings |
| 19 | */ |
| 20 | #include "config.h" |
| 21 | #include <time.h> |
| 22 | #include "report.h" |
| @@ -43,11 +43,11 @@ | |
| 43 | if( !g.perm.RdTkt && !g.perm.NewTkt ){ login_needed(); return; } |
| 44 | style_header("Ticket Main Menu"); |
| 45 | if( g.thTrace ) Th_Trace("BEGIN_REPORTLIST<br />\n", -1); |
| 46 | zScript = ticket_reportlist_code(); |
| 47 | if( g.thTrace ) Th_Trace("BEGIN_REPORTLIST_SCRIPT<br />\n", -1); |
| 48 | |
| 49 | blob_zero(&ril); |
| 50 | ticket_init(); |
| 51 | |
| 52 | db_prepare(&q, "SELECT rn, title, owner FROM reportfmt ORDER BY title"); |
| 53 | while( db_step(&q)==SQLITE_ROW ){ |
| @@ -70,14 +70,14 @@ | |
| 70 | } |
| 71 | if( g.perm.TktFmt ){ |
| 72 | blob_appendf(&ril, "[%zcopy</a>] ", |
| 73 | href("%R/rptedit?rn=%d©=1", rn)); |
| 74 | } |
| 75 | if( g.perm.Admin |
| 76 | || (g.perm.WrTkt && zOwner && fossil_strcmp(g.zLogin,zOwner)==0) |
| 77 | ){ |
| 78 | blob_appendf(&ril, "[%zedit</a>]", |
| 79 | href("%R/rptedit?rn=%d", rn)); |
| 80 | } |
| 81 | if( g.perm.TktFmt ){ |
| 82 | blob_appendf(&ril, "[%zsql</a>]", |
| 83 | href("%R/rptsql?rn=%d", rn)); |
| @@ -85,13 +85,13 @@ | |
| 85 | blob_appendf(&ril, "</li>\n"); |
| 86 | } |
| 87 | db_finalize(&q); |
| 88 | |
| 89 | Th_Store("report_items", blob_str(&ril)); |
| 90 | |
| 91 | Th_Render(zScript); |
| 92 | |
| 93 | blob_reset(&ril); |
| 94 | if( g.thTrace ) Th_Trace("END_REPORTLIST<br />\n", -1); |
| 95 | |
| 96 | style_footer(); |
| 97 | } |
| @@ -205,11 +205,11 @@ | |
| 205 | } |
| 206 | case SQLITE_RECURSIVE: { |
| 207 | *(char**)pError = mprintf("recursive queries are not allowed"); |
| 208 | rc = SQLITE_DENY; |
| 209 | break; |
| 210 | } |
| 211 | default: { |
| 212 | *(char**)pError = mprintf("only SELECT statements are allowed"); |
| 213 | rc = SQLITE_DENY; |
| 214 | break; |
| 215 | } |
| @@ -262,11 +262,11 @@ | |
| 262 | return mprintf("Semi-colon detected! " |
| 263 | "Only a single SQL statement is allowed"); |
| 264 | } |
| 265 | } |
| 266 | } |
| 267 | |
| 268 | /* Compile the statement and check for illegal accesses or syntax errors. */ |
| 269 | report_restrict_sql(&zErr); |
| 270 | rc = sqlite3_prepare(g.db, zSql, -1, &pStmt, &zTail); |
| 271 | if( rc!=SQLITE_OK ){ |
| 272 | zErr = mprintf("Syntax error: %s", sqlite3_errmsg(g.db)); |
| @@ -383,11 +383,11 @@ | |
| 383 | } |
| 384 | if( zTitle && zSQL ){ |
| 385 | if( zSQL[0]==0 ){ |
| 386 | zErr = "Please supply an SQL query statement"; |
| 387 | }else if( (zTitle = trim_string(zTitle))[0]==0 ){ |
| 388 | zErr = "Please supply a title"; |
| 389 | }else{ |
| 390 | zErr = verify_sql_statement(zSQL); |
| 391 | } |
| 392 | if( zErr==0 |
| 393 | && db_exists("SELECT 1 FROM reportfmt WHERE title=%Q and rn<>%d", |
| @@ -1065,13 +1065,13 @@ | |
| 1065 | count = 0; |
| 1066 | if( !tabs ){ |
| 1067 | struct GenerateHTML sState; |
| 1068 | |
| 1069 | db_multi_exec("PRAGMA empty_result_callbacks=ON"); |
| 1070 | style_submenu_element("Raw", "Raw", |
| 1071 | "rptview?tablist=1&%h", PD("QUERY_STRING","")); |
| 1072 | if( g.perm.Admin |
| 1073 | || (g.perm.TktFmt && g.zLogin && fossil_strcmp(g.zLogin,zOwner)==0) ){ |
| 1074 | style_submenu_element("Edit", "Edit", "rptedit?rn=%d", rn); |
| 1075 | } |
| 1076 | if( g.perm.TktFmt ){ |
| 1077 | style_submenu_element("SQL", "SQL", "rptsql?rn=%d",rn); |
| @@ -1079,11 +1079,11 @@ | |
| 1079 | if( g.perm.NewTkt ){ |
| 1080 | style_submenu_element("New Ticket", "Create a new ticket", |
| 1081 | "%s/tktnew", g.zTop); |
| 1082 | } |
| 1083 | style_header(zTitle); |
| 1084 | output_color_key(zClrKey, 1, |
| 1085 | "border=\"0\" cellpadding=\"3\" cellspacing=\"0\" class=\"report\""); |
| 1086 | @ <table border="1" cellpadding="2" cellspacing="0" class="report" |
| 1087 | @ id="reportTable"> |
| 1088 | sState.rn = rn; |
| 1089 | sState.nCount = 0; |
| @@ -1177,11 +1177,11 @@ | |
| 1177 | if( j>i ){ |
| 1178 | fossil_print("%*s", j-i, ""); |
| 1179 | } |
| 1180 | z += j; |
| 1181 | } |
| 1182 | break; |
| 1183 | } |
| 1184 | } |
| 1185 | |
| 1186 | /* |
| 1187 | ** Output a row as a tab-separated line of text. |
| @@ -1212,11 +1212,11 @@ | |
| 1212 | /* |
| 1213 | ** Generate a report. The rn query parameter is the report number. |
| 1214 | ** The output is written to stdout as flat file. The zFilter parameter |
| 1215 | ** is a full WHERE-condition. |
| 1216 | */ |
| 1217 | void rptshow( |
| 1218 | const char *zRep, |
| 1219 | const char *zSepIn, |
| 1220 | const char *zFilter, |
| 1221 | tTktShowEncoding enc |
| 1222 | ){ |
| 1223 |
| --- src/report.c | |
| +++ src/report.c | |
| @@ -12,11 +12,11 @@ | |
| 12 | ** Author contact information: |
| 13 | ** [email protected] |
| 14 | ** http://www.hwaci.com/drh/ |
| 15 | ** |
| 16 | ******************************************************************************* |
| 17 | ** |
| 18 | ** Code to generate the ticket listings |
| 19 | */ |
| 20 | #include "config.h" |
| 21 | #include <time.h> |
| 22 | #include "report.h" |
| @@ -43,11 +43,11 @@ | |
| 43 | if( !g.perm.RdTkt && !g.perm.NewTkt ){ login_needed(); return; } |
| 44 | style_header("Ticket Main Menu"); |
| 45 | if( g.thTrace ) Th_Trace("BEGIN_REPORTLIST<br />\n", -1); |
| 46 | zScript = ticket_reportlist_code(); |
| 47 | if( g.thTrace ) Th_Trace("BEGIN_REPORTLIST_SCRIPT<br />\n", -1); |
| 48 | |
| 49 | blob_zero(&ril); |
| 50 | ticket_init(); |
| 51 | |
| 52 | db_prepare(&q, "SELECT rn, title, owner FROM reportfmt ORDER BY title"); |
| 53 | while( db_step(&q)==SQLITE_ROW ){ |
| @@ -70,14 +70,14 @@ | |
| 70 | } |
| 71 | if( g.perm.TktFmt ){ |
| 72 | blob_appendf(&ril, "[%zcopy</a>] ", |
| 73 | href("%R/rptedit?rn=%d©=1", rn)); |
| 74 | } |
| 75 | if( g.perm.Admin |
| 76 | || (g.perm.WrTkt && zOwner && fossil_strcmp(g.zLogin,zOwner)==0) |
| 77 | ){ |
| 78 | blob_appendf(&ril, "[%zedit</a>]", |
| 79 | href("%R/rptedit?rn=%d", rn)); |
| 80 | } |
| 81 | if( g.perm.TktFmt ){ |
| 82 | blob_appendf(&ril, "[%zsql</a>]", |
| 83 | href("%R/rptsql?rn=%d", rn)); |
| @@ -85,13 +85,13 @@ | |
| 85 | blob_appendf(&ril, "</li>\n"); |
| 86 | } |
| 87 | db_finalize(&q); |
| 88 | |
| 89 | Th_Store("report_items", blob_str(&ril)); |
| 90 | |
| 91 | Th_Render(zScript); |
| 92 | |
| 93 | blob_reset(&ril); |
| 94 | if( g.thTrace ) Th_Trace("END_REPORTLIST<br />\n", -1); |
| 95 | |
| 96 | style_footer(); |
| 97 | } |
| @@ -205,11 +205,11 @@ | |
| 205 | } |
| 206 | case SQLITE_RECURSIVE: { |
| 207 | *(char**)pError = mprintf("recursive queries are not allowed"); |
| 208 | rc = SQLITE_DENY; |
| 209 | break; |
| 210 | } |
| 211 | default: { |
| 212 | *(char**)pError = mprintf("only SELECT statements are allowed"); |
| 213 | rc = SQLITE_DENY; |
| 214 | break; |
| 215 | } |
| @@ -262,11 +262,11 @@ | |
| 262 | return mprintf("Semi-colon detected! " |
| 263 | "Only a single SQL statement is allowed"); |
| 264 | } |
| 265 | } |
| 266 | } |
| 267 | |
| 268 | /* Compile the statement and check for illegal accesses or syntax errors. */ |
| 269 | report_restrict_sql(&zErr); |
| 270 | rc = sqlite3_prepare(g.db, zSql, -1, &pStmt, &zTail); |
| 271 | if( rc!=SQLITE_OK ){ |
| 272 | zErr = mprintf("Syntax error: %s", sqlite3_errmsg(g.db)); |
| @@ -383,11 +383,11 @@ | |
| 383 | } |
| 384 | if( zTitle && zSQL ){ |
| 385 | if( zSQL[0]==0 ){ |
| 386 | zErr = "Please supply an SQL query statement"; |
| 387 | }else if( (zTitle = trim_string(zTitle))[0]==0 ){ |
| 388 | zErr = "Please supply a title"; |
| 389 | }else{ |
| 390 | zErr = verify_sql_statement(zSQL); |
| 391 | } |
| 392 | if( zErr==0 |
| 393 | && db_exists("SELECT 1 FROM reportfmt WHERE title=%Q and rn<>%d", |
| @@ -1065,13 +1065,13 @@ | |
| 1065 | count = 0; |
| 1066 | if( !tabs ){ |
| 1067 | struct GenerateHTML sState; |
| 1068 | |
| 1069 | db_multi_exec("PRAGMA empty_result_callbacks=ON"); |
| 1070 | style_submenu_element("Raw", "Raw", |
| 1071 | "rptview?tablist=1&%h", PD("QUERY_STRING","")); |
| 1072 | if( g.perm.Admin |
| 1073 | || (g.perm.TktFmt && g.zLogin && fossil_strcmp(g.zLogin,zOwner)==0) ){ |
| 1074 | style_submenu_element("Edit", "Edit", "rptedit?rn=%d", rn); |
| 1075 | } |
| 1076 | if( g.perm.TktFmt ){ |
| 1077 | style_submenu_element("SQL", "SQL", "rptsql?rn=%d",rn); |
| @@ -1079,11 +1079,11 @@ | |
| 1079 | if( g.perm.NewTkt ){ |
| 1080 | style_submenu_element("New Ticket", "Create a new ticket", |
| 1081 | "%s/tktnew", g.zTop); |
| 1082 | } |
| 1083 | style_header(zTitle); |
| 1084 | output_color_key(zClrKey, 1, |
| 1085 | "border=\"0\" cellpadding=\"3\" cellspacing=\"0\" class=\"report\""); |
| 1086 | @ <table border="1" cellpadding="2" cellspacing="0" class="report" |
| 1087 | @ id="reportTable"> |
| 1088 | sState.rn = rn; |
| 1089 | sState.nCount = 0; |
| @@ -1177,11 +1177,11 @@ | |
| 1177 | if( j>i ){ |
| 1178 | fossil_print("%*s", j-i, ""); |
| 1179 | } |
| 1180 | z += j; |
| 1181 | } |
| 1182 | break; |
| 1183 | } |
| 1184 | } |
| 1185 | |
| 1186 | /* |
| 1187 | ** Output a row as a tab-separated line of text. |
| @@ -1212,11 +1212,11 @@ | |
| 1212 | /* |
| 1213 | ** Generate a report. The rn query parameter is the report number. |
| 1214 | ** The output is written to stdout as flat file. The zFilter parameter |
| 1215 | ** is a full WHERE-condition. |
| 1216 | */ |
| 1217 | void rptshow( |
| 1218 | const char *zRep, |
| 1219 | const char *zSepIn, |
| 1220 | const char *zFilter, |
| 1221 | tTktShowEncoding enc |
| 1222 | ){ |
| 1223 |
+1
-1
| --- src/search.c | ||
| +++ src/search.c | ||
| @@ -135,11 +135,11 @@ | ||
| 135 | 135 | |
| 136 | 136 | /* Every term must be seen or else the score is zero */ |
| 137 | 137 | for(j=0; j<p->nTerm; j++){ |
| 138 | 138 | if( !seen[j] ) return 0; |
| 139 | 139 | } |
| 140 | - | |
| 140 | + | |
| 141 | 141 | return score; |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | /* |
| 145 | 145 | ** This is an SQLite function that scores its input using |
| 146 | 146 |
| --- src/search.c | |
| +++ src/search.c | |
| @@ -135,11 +135,11 @@ | |
| 135 | |
| 136 | /* Every term must be seen or else the score is zero */ |
| 137 | for(j=0; j<p->nTerm; j++){ |
| 138 | if( !seen[j] ) return 0; |
| 139 | } |
| 140 | |
| 141 | return score; |
| 142 | } |
| 143 | |
| 144 | /* |
| 145 | ** This is an SQLite function that scores its input using |
| 146 |
| --- src/search.c | |
| +++ src/search.c | |
| @@ -135,11 +135,11 @@ | |
| 135 | |
| 136 | /* Every term must be seen or else the score is zero */ |
| 137 | for(j=0; j<p->nTerm; j++){ |
| 138 | if( !seen[j] ) return 0; |
| 139 | } |
| 140 | |
| 141 | return score; |
| 142 | } |
| 143 | |
| 144 | /* |
| 145 | ** This is an SQLite function that scores its input using |
| 146 |
+1
-1
| --- src/sqlcmd.c | ||
| +++ src/sqlcmd.c | ||
| @@ -42,11 +42,11 @@ | ||
| 42 | 42 | g.db = sqlite3_context_db_handle(context); |
| 43 | 43 | g.repositoryOpen = 1; |
| 44 | 44 | rid = name_to_rid(zName); |
| 45 | 45 | if( rid==0 ) return; |
| 46 | 46 | if( content_get(rid, &cx) ){ |
| 47 | - sqlite3_result_blob(context, blob_buffer(&cx), blob_size(&cx), | |
| 47 | + sqlite3_result_blob(context, blob_buffer(&cx), blob_size(&cx), | |
| 48 | 48 | SQLITE_TRANSIENT); |
| 49 | 49 | blob_reset(&cx); |
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 |
| --- src/sqlcmd.c | |
| +++ src/sqlcmd.c | |
| @@ -42,11 +42,11 @@ | |
| 42 | g.db = sqlite3_context_db_handle(context); |
| 43 | g.repositoryOpen = 1; |
| 44 | rid = name_to_rid(zName); |
| 45 | if( rid==0 ) return; |
| 46 | if( content_get(rid, &cx) ){ |
| 47 | sqlite3_result_blob(context, blob_buffer(&cx), blob_size(&cx), |
| 48 | SQLITE_TRANSIENT); |
| 49 | blob_reset(&cx); |
| 50 | } |
| 51 | } |
| 52 | |
| 53 |
| --- src/sqlcmd.c | |
| +++ src/sqlcmd.c | |
| @@ -42,11 +42,11 @@ | |
| 42 | g.db = sqlite3_context_db_handle(context); |
| 43 | g.repositoryOpen = 1; |
| 44 | rid = name_to_rid(zName); |
| 45 | if( rid==0 ) return; |
| 46 | if( content_get(rid, &cx) ){ |
| 47 | sqlite3_result_blob(context, blob_buffer(&cx), blob_size(&cx), |
| 48 | SQLITE_TRANSIENT); |
| 49 | blob_reset(&cx); |
| 50 | } |
| 51 | } |
| 52 | |
| 53 |
+12
-12
| --- src/vfile.c | ||
| +++ src/vfile.c | ||
| @@ -45,18 +45,18 @@ | ||
| 45 | 45 | ** does not exist, then return 0. |
| 46 | 46 | ** |
| 47 | 47 | ** For this routine, the UUID must be exact. For a match against |
| 48 | 48 | ** user input with mixed case, use resolve_uuid(). |
| 49 | 49 | ** |
| 50 | -** If the UUID is not found and phantomize is 1 or 2, then attempt to | |
| 50 | +** If the UUID is not found and phantomize is 1 or 2, then attempt to | |
| 51 | 51 | ** create a phantom record. A private phantom is created for 2 and |
| 52 | 52 | ** a public phantom is created for 1. |
| 53 | 53 | */ |
| 54 | 54 | int uuid_to_rid(const char *zUuid, int phantomize){ |
| 55 | 55 | int rid, sz; |
| 56 | 56 | char z[UUID_SIZE+1]; |
| 57 | - | |
| 57 | + | |
| 58 | 58 | sz = strlen(zUuid); |
| 59 | 59 | if( sz!=UUID_SIZE || !validate16(zUuid, sz) ){ |
| 60 | 60 | return 0; |
| 61 | 61 | } |
| 62 | 62 | memcpy(z, zUuid, UUID_SIZE+1); |
| @@ -140,11 +140,11 @@ | ||
| 140 | 140 | ** the file has changed due to a merge. 3 means the file was added |
| 141 | 141 | ** by a merge. |
| 142 | 142 | ** |
| 143 | 143 | ** If VFILE.DELETED is true or if VFILE.RID is zero, then the file was either |
| 144 | 144 | ** removed from configuration management via "fossil rm" or added via |
| 145 | -** "fossil add", respectively, and in both cases we always know that | |
| 145 | +** "fossil add", respectively, and in both cases we always know that | |
| 146 | 146 | ** the file has changed without having the check the size, mtime, |
| 147 | 147 | ** or on-disk content. |
| 148 | 148 | ** |
| 149 | 149 | ** If the size of the file has changed, then we always know that the file |
| 150 | 150 | ** changed without having to look at the mtime or on-disk content. |
| @@ -315,11 +315,11 @@ | ||
| 315 | 315 | } |
| 316 | 316 | if( verbose ) fossil_print("%s\n", &zName[nRepos]); |
| 317 | 317 | if( file_wd_isdir(zName) == 1 ){ |
| 318 | 318 | /*TODO(dchest): remove directories? */ |
| 319 | 319 | fossil_fatal("%s is directory, cannot overwrite\n", zName); |
| 320 | - } | |
| 320 | + } | |
| 321 | 321 | if( file_wd_size(zName)>=0 && (isLink || file_wd_islink(zName)) ){ |
| 322 | 322 | file_delete(zName); |
| 323 | 323 | } |
| 324 | 324 | if( isLink ){ |
| 325 | 325 | symlink_create(blob_str(&content), zName); |
| @@ -392,11 +392,11 @@ | ||
| 392 | 392 | "merge", |
| 393 | 393 | "original", |
| 394 | 394 | "output", |
| 395 | 395 | }; |
| 396 | 396 | int i, j, n; |
| 397 | - | |
| 397 | + | |
| 398 | 398 | if( strglob("ci-comment-????????????.txt", zName) ) return 1; |
| 399 | 399 | for(; zName[0]!=0; zName++){ |
| 400 | 400 | if( zName[0]=='/' && strglob("/ci-comment-????????????.txt", zName) ){ |
| 401 | 401 | return 1; |
| 402 | 402 | } |
| @@ -407,11 +407,11 @@ | ||
| 407 | 407 | if( zName[n+1]==0 ) return 1; |
| 408 | 408 | if( zName[n+1]=='-' ){ |
| 409 | 409 | for(j=n+2; zName[j] && fossil_isdigit(zName[j]); j++){} |
| 410 | 410 | if( zName[j]==0 ) return 1; |
| 411 | 411 | } |
| 412 | - } | |
| 412 | + } | |
| 413 | 413 | } |
| 414 | 414 | return 0; |
| 415 | 415 | } |
| 416 | 416 | |
| 417 | 417 | #if INTERFACE |
| @@ -654,11 +654,11 @@ | ||
| 654 | 654 | FILE *in; |
| 655 | 655 | Stmt q; |
| 656 | 656 | char zBuf[4096]; |
| 657 | 657 | |
| 658 | 658 | db_must_be_within_tree(); |
| 659 | - db_prepare(&q, | |
| 659 | + db_prepare(&q, | |
| 660 | 660 | "SELECT %Q || pathname, pathname, origname, is_selected(id), rid" |
| 661 | 661 | " FROM vfile" |
| 662 | 662 | " WHERE (NOT deleted OR NOT is_selected(id)) AND vid=%d" |
| 663 | 663 | " ORDER BY if_selected(id, pathname, origname) /*scan*/", |
| 664 | 664 | g.zLocalRoot, vid |
| @@ -673,11 +673,11 @@ | ||
| 673 | 673 | md5sum_step_text(zName, -1); |
| 674 | 674 | if( file_wd_islink(zFullpath) ){ |
| 675 | 675 | /* Instead of file content, use link destination path */ |
| 676 | 676 | Blob pathBuf; |
| 677 | 677 | |
| 678 | - sqlite3_snprintf(sizeof(zBuf), zBuf, " %ld\n", | |
| 678 | + sqlite3_snprintf(sizeof(zBuf), zBuf, " %ld\n", | |
| 679 | 679 | blob_read_link(&pathBuf, zFullpath)); |
| 680 | 680 | md5sum_step_text(zBuf, -1); |
| 681 | 681 | md5sum_step_text(blob_str(&pathBuf), -1); |
| 682 | 682 | blob_reset(&pathBuf); |
| 683 | 683 | }else{ |
| @@ -743,13 +743,13 @@ | ||
| 743 | 743 | void vfile_compare_repository_to_disk(int vid){ |
| 744 | 744 | int rc; |
| 745 | 745 | Stmt q; |
| 746 | 746 | Blob disk, repo; |
| 747 | 747 | char *zOut; |
| 748 | - | |
| 748 | + | |
| 749 | 749 | db_must_be_within_tree(); |
| 750 | - db_prepare(&q, | |
| 750 | + db_prepare(&q, | |
| 751 | 751 | "SELECT %Q || pathname, pathname, rid FROM vfile" |
| 752 | 752 | " WHERE NOT deleted AND vid=%d AND is_selected(id)" |
| 753 | 753 | " ORDER BY if_selected(id, pathname, origname) /*scan*/", |
| 754 | 754 | g.zLocalRoot, vid |
| 755 | 755 | ); |
| @@ -809,11 +809,11 @@ | ||
| 809 | 809 | Blob file; |
| 810 | 810 | Stmt q; |
| 811 | 811 | char zBuf[100]; |
| 812 | 812 | |
| 813 | 813 | db_must_be_within_tree(); |
| 814 | - | |
| 814 | + | |
| 815 | 815 | db_prepare(&q, "SELECT pathname, origname, rid, is_selected(id)" |
| 816 | 816 | " FROM vfile" |
| 817 | 817 | " WHERE (NOT deleted OR NOT is_selected(id))" |
| 818 | 818 | " AND rid>0 AND vid=%d" |
| 819 | 819 | " ORDER BY if_selected(id,pathname,origname) /*scan*/", |
| @@ -847,11 +847,11 @@ | ||
| 847 | 847 | ** |
| 848 | 848 | ** If pManOut is not NULL then fill it with the checksum found in the |
| 849 | 849 | ** "R" card near the end of the manifest. |
| 850 | 850 | ** |
| 851 | 851 | ** In a well-formed manifest, the two checksums computed here, pOut and |
| 852 | -** pManOut, should be identical. | |
| 852 | +** pManOut, should be identical. | |
| 853 | 853 | */ |
| 854 | 854 | void vfile_aggregate_checksum_manifest(int vid, Blob *pOut, Blob *pManOut){ |
| 855 | 855 | int fid; |
| 856 | 856 | Blob file; |
| 857 | 857 | Blob err; |
| 858 | 858 |
| --- src/vfile.c | |
| +++ src/vfile.c | |
| @@ -45,18 +45,18 @@ | |
| 45 | ** does not exist, then return 0. |
| 46 | ** |
| 47 | ** For this routine, the UUID must be exact. For a match against |
| 48 | ** user input with mixed case, use resolve_uuid(). |
| 49 | ** |
| 50 | ** If the UUID is not found and phantomize is 1 or 2, then attempt to |
| 51 | ** create a phantom record. A private phantom is created for 2 and |
| 52 | ** a public phantom is created for 1. |
| 53 | */ |
| 54 | int uuid_to_rid(const char *zUuid, int phantomize){ |
| 55 | int rid, sz; |
| 56 | char z[UUID_SIZE+1]; |
| 57 | |
| 58 | sz = strlen(zUuid); |
| 59 | if( sz!=UUID_SIZE || !validate16(zUuid, sz) ){ |
| 60 | return 0; |
| 61 | } |
| 62 | memcpy(z, zUuid, UUID_SIZE+1); |
| @@ -140,11 +140,11 @@ | |
| 140 | ** the file has changed due to a merge. 3 means the file was added |
| 141 | ** by a merge. |
| 142 | ** |
| 143 | ** If VFILE.DELETED is true or if VFILE.RID is zero, then the file was either |
| 144 | ** removed from configuration management via "fossil rm" or added via |
| 145 | ** "fossil add", respectively, and in both cases we always know that |
| 146 | ** the file has changed without having the check the size, mtime, |
| 147 | ** or on-disk content. |
| 148 | ** |
| 149 | ** If the size of the file has changed, then we always know that the file |
| 150 | ** changed without having to look at the mtime or on-disk content. |
| @@ -315,11 +315,11 @@ | |
| 315 | } |
| 316 | if( verbose ) fossil_print("%s\n", &zName[nRepos]); |
| 317 | if( file_wd_isdir(zName) == 1 ){ |
| 318 | /*TODO(dchest): remove directories? */ |
| 319 | fossil_fatal("%s is directory, cannot overwrite\n", zName); |
| 320 | } |
| 321 | if( file_wd_size(zName)>=0 && (isLink || file_wd_islink(zName)) ){ |
| 322 | file_delete(zName); |
| 323 | } |
| 324 | if( isLink ){ |
| 325 | symlink_create(blob_str(&content), zName); |
| @@ -392,11 +392,11 @@ | |
| 392 | "merge", |
| 393 | "original", |
| 394 | "output", |
| 395 | }; |
| 396 | int i, j, n; |
| 397 | |
| 398 | if( strglob("ci-comment-????????????.txt", zName) ) return 1; |
| 399 | for(; zName[0]!=0; zName++){ |
| 400 | if( zName[0]=='/' && strglob("/ci-comment-????????????.txt", zName) ){ |
| 401 | return 1; |
| 402 | } |
| @@ -407,11 +407,11 @@ | |
| 407 | if( zName[n+1]==0 ) return 1; |
| 408 | if( zName[n+1]=='-' ){ |
| 409 | for(j=n+2; zName[j] && fossil_isdigit(zName[j]); j++){} |
| 410 | if( zName[j]==0 ) return 1; |
| 411 | } |
| 412 | } |
| 413 | } |
| 414 | return 0; |
| 415 | } |
| 416 | |
| 417 | #if INTERFACE |
| @@ -654,11 +654,11 @@ | |
| 654 | FILE *in; |
| 655 | Stmt q; |
| 656 | char zBuf[4096]; |
| 657 | |
| 658 | db_must_be_within_tree(); |
| 659 | db_prepare(&q, |
| 660 | "SELECT %Q || pathname, pathname, origname, is_selected(id), rid" |
| 661 | " FROM vfile" |
| 662 | " WHERE (NOT deleted OR NOT is_selected(id)) AND vid=%d" |
| 663 | " ORDER BY if_selected(id, pathname, origname) /*scan*/", |
| 664 | g.zLocalRoot, vid |
| @@ -673,11 +673,11 @@ | |
| 673 | md5sum_step_text(zName, -1); |
| 674 | if( file_wd_islink(zFullpath) ){ |
| 675 | /* Instead of file content, use link destination path */ |
| 676 | Blob pathBuf; |
| 677 | |
| 678 | sqlite3_snprintf(sizeof(zBuf), zBuf, " %ld\n", |
| 679 | blob_read_link(&pathBuf, zFullpath)); |
| 680 | md5sum_step_text(zBuf, -1); |
| 681 | md5sum_step_text(blob_str(&pathBuf), -1); |
| 682 | blob_reset(&pathBuf); |
| 683 | }else{ |
| @@ -743,13 +743,13 @@ | |
| 743 | void vfile_compare_repository_to_disk(int vid){ |
| 744 | int rc; |
| 745 | Stmt q; |
| 746 | Blob disk, repo; |
| 747 | char *zOut; |
| 748 | |
| 749 | db_must_be_within_tree(); |
| 750 | db_prepare(&q, |
| 751 | "SELECT %Q || pathname, pathname, rid FROM vfile" |
| 752 | " WHERE NOT deleted AND vid=%d AND is_selected(id)" |
| 753 | " ORDER BY if_selected(id, pathname, origname) /*scan*/", |
| 754 | g.zLocalRoot, vid |
| 755 | ); |
| @@ -809,11 +809,11 @@ | |
| 809 | Blob file; |
| 810 | Stmt q; |
| 811 | char zBuf[100]; |
| 812 | |
| 813 | db_must_be_within_tree(); |
| 814 | |
| 815 | db_prepare(&q, "SELECT pathname, origname, rid, is_selected(id)" |
| 816 | " FROM vfile" |
| 817 | " WHERE (NOT deleted OR NOT is_selected(id))" |
| 818 | " AND rid>0 AND vid=%d" |
| 819 | " ORDER BY if_selected(id,pathname,origname) /*scan*/", |
| @@ -847,11 +847,11 @@ | |
| 847 | ** |
| 848 | ** If pManOut is not NULL then fill it with the checksum found in the |
| 849 | ** "R" card near the end of the manifest. |
| 850 | ** |
| 851 | ** In a well-formed manifest, the two checksums computed here, pOut and |
| 852 | ** pManOut, should be identical. |
| 853 | */ |
| 854 | void vfile_aggregate_checksum_manifest(int vid, Blob *pOut, Blob *pManOut){ |
| 855 | int fid; |
| 856 | Blob file; |
| 857 | Blob err; |
| 858 |
| --- src/vfile.c | |
| +++ src/vfile.c | |
| @@ -45,18 +45,18 @@ | |
| 45 | ** does not exist, then return 0. |
| 46 | ** |
| 47 | ** For this routine, the UUID must be exact. For a match against |
| 48 | ** user input with mixed case, use resolve_uuid(). |
| 49 | ** |
| 50 | ** If the UUID is not found and phantomize is 1 or 2, then attempt to |
| 51 | ** create a phantom record. A private phantom is created for 2 and |
| 52 | ** a public phantom is created for 1. |
| 53 | */ |
| 54 | int uuid_to_rid(const char *zUuid, int phantomize){ |
| 55 | int rid, sz; |
| 56 | char z[UUID_SIZE+1]; |
| 57 | |
| 58 | sz = strlen(zUuid); |
| 59 | if( sz!=UUID_SIZE || !validate16(zUuid, sz) ){ |
| 60 | return 0; |
| 61 | } |
| 62 | memcpy(z, zUuid, UUID_SIZE+1); |
| @@ -140,11 +140,11 @@ | |
| 140 | ** the file has changed due to a merge. 3 means the file was added |
| 141 | ** by a merge. |
| 142 | ** |
| 143 | ** If VFILE.DELETED is true or if VFILE.RID is zero, then the file was either |
| 144 | ** removed from configuration management via "fossil rm" or added via |
| 145 | ** "fossil add", respectively, and in both cases we always know that |
| 146 | ** the file has changed without having the check the size, mtime, |
| 147 | ** or on-disk content. |
| 148 | ** |
| 149 | ** If the size of the file has changed, then we always know that the file |
| 150 | ** changed without having to look at the mtime or on-disk content. |
| @@ -315,11 +315,11 @@ | |
| 315 | } |
| 316 | if( verbose ) fossil_print("%s\n", &zName[nRepos]); |
| 317 | if( file_wd_isdir(zName) == 1 ){ |
| 318 | /*TODO(dchest): remove directories? */ |
| 319 | fossil_fatal("%s is directory, cannot overwrite\n", zName); |
| 320 | } |
| 321 | if( file_wd_size(zName)>=0 && (isLink || file_wd_islink(zName)) ){ |
| 322 | file_delete(zName); |
| 323 | } |
| 324 | if( isLink ){ |
| 325 | symlink_create(blob_str(&content), zName); |
| @@ -392,11 +392,11 @@ | |
| 392 | "merge", |
| 393 | "original", |
| 394 | "output", |
| 395 | }; |
| 396 | int i, j, n; |
| 397 | |
| 398 | if( strglob("ci-comment-????????????.txt", zName) ) return 1; |
| 399 | for(; zName[0]!=0; zName++){ |
| 400 | if( zName[0]=='/' && strglob("/ci-comment-????????????.txt", zName) ){ |
| 401 | return 1; |
| 402 | } |
| @@ -407,11 +407,11 @@ | |
| 407 | if( zName[n+1]==0 ) return 1; |
| 408 | if( zName[n+1]=='-' ){ |
| 409 | for(j=n+2; zName[j] && fossil_isdigit(zName[j]); j++){} |
| 410 | if( zName[j]==0 ) return 1; |
| 411 | } |
| 412 | } |
| 413 | } |
| 414 | return 0; |
| 415 | } |
| 416 | |
| 417 | #if INTERFACE |
| @@ -654,11 +654,11 @@ | |
| 654 | FILE *in; |
| 655 | Stmt q; |
| 656 | char zBuf[4096]; |
| 657 | |
| 658 | db_must_be_within_tree(); |
| 659 | db_prepare(&q, |
| 660 | "SELECT %Q || pathname, pathname, origname, is_selected(id), rid" |
| 661 | " FROM vfile" |
| 662 | " WHERE (NOT deleted OR NOT is_selected(id)) AND vid=%d" |
| 663 | " ORDER BY if_selected(id, pathname, origname) /*scan*/", |
| 664 | g.zLocalRoot, vid |
| @@ -673,11 +673,11 @@ | |
| 673 | md5sum_step_text(zName, -1); |
| 674 | if( file_wd_islink(zFullpath) ){ |
| 675 | /* Instead of file content, use link destination path */ |
| 676 | Blob pathBuf; |
| 677 | |
| 678 | sqlite3_snprintf(sizeof(zBuf), zBuf, " %ld\n", |
| 679 | blob_read_link(&pathBuf, zFullpath)); |
| 680 | md5sum_step_text(zBuf, -1); |
| 681 | md5sum_step_text(blob_str(&pathBuf), -1); |
| 682 | blob_reset(&pathBuf); |
| 683 | }else{ |
| @@ -743,13 +743,13 @@ | |
| 743 | void vfile_compare_repository_to_disk(int vid){ |
| 744 | int rc; |
| 745 | Stmt q; |
| 746 | Blob disk, repo; |
| 747 | char *zOut; |
| 748 | |
| 749 | db_must_be_within_tree(); |
| 750 | db_prepare(&q, |
| 751 | "SELECT %Q || pathname, pathname, rid FROM vfile" |
| 752 | " WHERE NOT deleted AND vid=%d AND is_selected(id)" |
| 753 | " ORDER BY if_selected(id, pathname, origname) /*scan*/", |
| 754 | g.zLocalRoot, vid |
| 755 | ); |
| @@ -809,11 +809,11 @@ | |
| 809 | Blob file; |
| 810 | Stmt q; |
| 811 | char zBuf[100]; |
| 812 | |
| 813 | db_must_be_within_tree(); |
| 814 | |
| 815 | db_prepare(&q, "SELECT pathname, origname, rid, is_selected(id)" |
| 816 | " FROM vfile" |
| 817 | " WHERE (NOT deleted OR NOT is_selected(id))" |
| 818 | " AND rid>0 AND vid=%d" |
| 819 | " ORDER BY if_selected(id,pathname,origname) /*scan*/", |
| @@ -847,11 +847,11 @@ | |
| 847 | ** |
| 848 | ** If pManOut is not NULL then fill it with the checksum found in the |
| 849 | ** "R" card near the end of the manifest. |
| 850 | ** |
| 851 | ** In a well-formed manifest, the two checksums computed here, pOut and |
| 852 | ** pManOut, should be identical. |
| 853 | */ |
| 854 | void vfile_aggregate_checksum_manifest(int vid, Blob *pOut, Blob *pManOut){ |
| 855 | int fid; |
| 856 | Blob file; |
| 857 | Blob err; |
| 858 |
+39
-39
| --- src/xfer.c | ||
| +++ src/xfer.c | ||
| @@ -94,11 +94,11 @@ | ||
| 94 | 94 | db_reset(&q); |
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | /* |
| 99 | -** The aToken[0..nToken-1] blob array is a parse of a "file" line | |
| 99 | +** The aToken[0..nToken-1] blob array is a parse of a "file" line | |
| 100 | 100 | ** message. This routine finishes parsing that message and does |
| 101 | 101 | ** a record insert of the file. |
| 102 | 102 | ** |
| 103 | 103 | ** The file line is in one of the following two forms: |
| 104 | 104 | ** |
| @@ -119,14 +119,14 @@ | ||
| 119 | 119 | int n; |
| 120 | 120 | int rid; |
| 121 | 121 | int srcid = 0; |
| 122 | 122 | Blob content, hash; |
| 123 | 123 | int isPriv; |
| 124 | - | |
| 124 | + | |
| 125 | 125 | isPriv = pXfer->nextIsPrivate; |
| 126 | 126 | pXfer->nextIsPrivate = 0; |
| 127 | - if( pXfer->nToken<3 | |
| 127 | + if( pXfer->nToken<3 | |
| 128 | 128 | || pXfer->nToken>4 |
| 129 | 129 | || !blob_is_uuid(&pXfer->aToken[1]) |
| 130 | 130 | || !blob_is_int(&pXfer->aToken[pXfer->nToken-1], &n) |
| 131 | 131 | || n<0 |
| 132 | 132 | || (pXfer->nToken==4 && !blob_is_uuid(&pXfer->aToken[2])) |
| @@ -198,11 +198,11 @@ | ||
| 198 | 198 | assert( blob_is_reset(&content) ); |
| 199 | 199 | remote_has(rid); |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | /* |
| 203 | -** The aToken[0..nToken-1] blob array is a parse of a "cfile" line | |
| 203 | +** The aToken[0..nToken-1] blob array is a parse of a "cfile" line | |
| 204 | 204 | ** message. This routine finishes parsing that message and does |
| 205 | 205 | ** a record insert of the file. The difference between "file" and |
| 206 | 206 | ** "cfile" is that with "cfile" the content is already compressed. |
| 207 | 207 | ** |
| 208 | 208 | ** The file line is in one of the following two forms: |
| @@ -227,14 +227,14 @@ | ||
| 227 | 227 | int szU; /* USIZE */ |
| 228 | 228 | int rid; |
| 229 | 229 | int srcid = 0; |
| 230 | 230 | Blob content; |
| 231 | 231 | int isPriv; |
| 232 | - | |
| 232 | + | |
| 233 | 233 | isPriv = pXfer->nextIsPrivate; |
| 234 | 234 | pXfer->nextIsPrivate = 0; |
| 235 | - if( pXfer->nToken<4 | |
| 235 | + if( pXfer->nToken<4 | |
| 236 | 236 | || pXfer->nToken>5 |
| 237 | 237 | || !blob_is_uuid(&pXfer->aToken[1]) |
| 238 | 238 | || !blob_is_int(&pXfer->aToken[pXfer->nToken-2], &szU) |
| 239 | 239 | || !blob_is_int(&pXfer->aToken[pXfer->nToken-1], &szC) |
| 240 | 240 | || szC<0 || szU<0 |
| @@ -284,11 +284,11 @@ | ||
| 284 | 284 | ){ |
| 285 | 285 | static const char *const azQuery[] = { |
| 286 | 286 | "SELECT pid FROM plink x" |
| 287 | 287 | " WHERE cid=%d" |
| 288 | 288 | " AND NOT EXISTS(SELECT 1 FROM phantom WHERE rid=pid)", |
| 289 | - | |
| 289 | + | |
| 290 | 290 | "SELECT pid, min(mtime) FROM mlink, event ON mlink.mid=event.objid" |
| 291 | 291 | " WHERE fid=%d" |
| 292 | 292 | " AND NOT EXISTS(SELECT 1 FROM phantom WHERE rid=pid)" |
| 293 | 293 | }; |
| 294 | 294 | int i; |
| @@ -321,11 +321,11 @@ | ||
| 321 | 321 | } |
| 322 | 322 | return size; |
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | /* |
| 326 | -** Try to send a file as a native delta. | |
| 326 | +** Try to send a file as a native delta. | |
| 327 | 327 | ** If successful, return the number of bytes in the delta. |
| 328 | 328 | ** If we cannot generate an appropriate delta, then send |
| 329 | 329 | ** nothing and return zero. |
| 330 | 330 | ** |
| 331 | 331 | ** Never send a delta against a private artifact. |
| @@ -403,11 +403,11 @@ | ||
| 403 | 403 | } |
| 404 | 404 | if( uuid_is_shunned(blob_str(pUuid)) ){ |
| 405 | 405 | blob_reset(&uuid); |
| 406 | 406 | return; |
| 407 | 407 | } |
| 408 | - if( (pXfer->maxTime != -1 && time(NULL) >= pXfer->maxTime) || | |
| 408 | + if( (pXfer->maxTime != -1 && time(NULL) >= pXfer->maxTime) || | |
| 409 | 409 | pXfer->mxSend<=blob_size(pXfer->pOut) ){ |
| 410 | 410 | const char *zFormat = isPriv ? "igot %b 1\n" : "igot %b\n"; |
| 411 | 411 | blob_appendf(pXfer->pOut, zFormat, pUuid); |
| 412 | 412 | pXfer->nIGotSent++; |
| 413 | 413 | blob_reset(&uuid); |
| @@ -445,11 +445,11 @@ | ||
| 445 | 445 | #endif |
| 446 | 446 | } |
| 447 | 447 | |
| 448 | 448 | /* |
| 449 | 449 | ** Send the file identified by rid as a compressed artifact. Basically, |
| 450 | -** send the content exactly as it appears in the BLOB table using | |
| 450 | +** send the content exactly as it appears in the BLOB table using | |
| 451 | 451 | ** a "cfile" card. |
| 452 | 452 | */ |
| 453 | 453 | static void send_compressed_file(Xfer *pXfer, int rid){ |
| 454 | 454 | const char *zContent; |
| 455 | 455 | const char *zUuid; |
| @@ -515,11 +515,11 @@ | ||
| 515 | 515 | ** Except: do not request shunned artifacts. And do not request |
| 516 | 516 | ** private artifacts if we are not doing a private transfer. |
| 517 | 517 | */ |
| 518 | 518 | static void request_phantoms(Xfer *pXfer, int maxReq){ |
| 519 | 519 | Stmt q; |
| 520 | - db_prepare(&q, | |
| 520 | + db_prepare(&q, | |
| 521 | 521 | "SELECT uuid FROM phantom JOIN blob USING(rid)" |
| 522 | 522 | " WHERE NOT EXISTS(SELECT 1 FROM shun WHERE uuid=blob.uuid) %s", |
| 523 | 523 | (pXfer->syncPrivate ? "" : |
| 524 | 524 | " AND NOT EXISTS(SELECT 1 FROM private WHERE rid=blob.rid)") |
| 525 | 525 | ); |
| @@ -551,12 +551,12 @@ | ||
| 551 | 551 | ** Check the signature on an application/x-fossil payload received by |
| 552 | 552 | ** the HTTP server. The signature is a line of the following form: |
| 553 | 553 | ** |
| 554 | 554 | ** login LOGIN NONCE SIGNATURE |
| 555 | 555 | ** |
| 556 | -** The NONCE is the SHA1 hash of the remainder of the input. | |
| 557 | -** SIGNATURE is the SHA1 checksum of the NONCE concatenated | |
| 556 | +** The NONCE is the SHA1 hash of the remainder of the input. | |
| 557 | +** SIGNATURE is the SHA1 checksum of the NONCE concatenated | |
| 558 | 558 | ** with the users password. |
| 559 | 559 | ** |
| 560 | 560 | ** The parameters to this routine are ephemeral blobs holding the |
| 561 | 561 | ** LOGIN, NONCE and SIGNATURE. |
| 562 | 562 | ** |
| @@ -564,11 +564,11 @@ | ||
| 564 | 564 | ** If everything checks out, the USER.CAP column for the USER table |
| 565 | 565 | ** is consulted to set privileges in the global g variable. |
| 566 | 566 | ** |
| 567 | 567 | ** If anything fails to check out, no changes are made to privileges. |
| 568 | 568 | ** |
| 569 | -** Signature generation on the client side is handled by the | |
| 569 | +** Signature generation on the client side is handled by the | |
| 570 | 570 | ** http_exchange() routine. |
| 571 | 571 | ** |
| 572 | 572 | ** Return non-zero for a login failure and zero for success. |
| 573 | 573 | */ |
| 574 | 574 | int check_login(Blob *pLogin, Blob *pNonce, Blob *pSig){ |
| @@ -699,11 +699,11 @@ | ||
| 699 | 699 | blob_appendf(&deleteWhere, ",%d", rid); |
| 700 | 700 | } |
| 701 | 701 | } |
| 702 | 702 | db_finalize(&q); |
| 703 | 703 | db_multi_exec( |
| 704 | - "DELETE FROM unclustered WHERE rid NOT IN (0 %s)", | |
| 704 | + "DELETE FROM unclustered WHERE rid NOT IN (0 %s)", | |
| 705 | 705 | blob_str(&deleteWhere) |
| 706 | 706 | ); |
| 707 | 707 | blob_reset(&deleteWhere); |
| 708 | 708 | if( nRow>0 ){ |
| 709 | 709 | md5sum_blob(&cluster, &cksum); |
| @@ -738,21 +738,21 @@ | ||
| 738 | 738 | */ |
| 739 | 739 | static int send_unclustered(Xfer *pXfer){ |
| 740 | 740 | Stmt q; |
| 741 | 741 | int cnt = 0; |
| 742 | 742 | if( pXfer->resync ){ |
| 743 | - db_prepare(&q, | |
| 743 | + db_prepare(&q, | |
| 744 | 744 | "SELECT uuid, rid FROM blob" |
| 745 | 745 | " WHERE NOT EXISTS(SELECT 1 FROM shun WHERE uuid=blob.uuid)" |
| 746 | 746 | " AND NOT EXISTS(SELECT 1 FROM phantom WHERE rid=blob.rid)" |
| 747 | 747 | " AND NOT EXISTS(SELECT 1 FROM private WHERE rid=blob.rid)" |
| 748 | 748 | " AND blob.rid<=%d" |
| 749 | 749 | " ORDER BY blob.rid DESC", |
| 750 | 750 | pXfer->resync |
| 751 | 751 | ); |
| 752 | 752 | }else{ |
| 753 | - db_prepare(&q, | |
| 753 | + db_prepare(&q, | |
| 754 | 754 | "SELECT uuid FROM unclustered JOIN blob USING(rid)" |
| 755 | 755 | " WHERE NOT EXISTS(SELECT 1 FROM shun WHERE uuid=blob.uuid)" |
| 756 | 756 | " AND NOT EXISTS(SELECT 1 FROM phantom WHERE rid=blob.rid)" |
| 757 | 757 | " AND NOT EXISTS(SELECT 1 FROM private WHERE rid=blob.rid)" |
| 758 | 758 | ); |
| @@ -772,11 +772,11 @@ | ||
| 772 | 772 | /* |
| 773 | 773 | ** Send an igot message for every artifact. |
| 774 | 774 | */ |
| 775 | 775 | static void send_all(Xfer *pXfer){ |
| 776 | 776 | Stmt q; |
| 777 | - db_prepare(&q, | |
| 777 | + db_prepare(&q, | |
| 778 | 778 | "SELECT uuid FROM blob " |
| 779 | 779 | " WHERE NOT EXISTS(SELECT 1 FROM shun WHERE uuid=blob.uuid)" |
| 780 | 780 | " AND NOT EXISTS(SELECT 1 FROM private WHERE rid=blob.rid)" |
| 781 | 781 | " AND NOT EXISTS(SELECT 1 FROM phantom WHERE rid=blob.rid)" |
| 782 | 782 | ); |
| @@ -1033,12 +1033,12 @@ | ||
| 1033 | 1033 | }else{ |
| 1034 | 1034 | server_private_xfer_not_authorized(); |
| 1035 | 1035 | } |
| 1036 | 1036 | } |
| 1037 | 1037 | }else |
| 1038 | - | |
| 1039 | - | |
| 1038 | + | |
| 1039 | + | |
| 1040 | 1040 | /* pull SERVERCODE PROJECTCODE |
| 1041 | 1041 | ** push SERVERCODE PROJECTCODE |
| 1042 | 1042 | ** |
| 1043 | 1043 | ** The client wants either send or receive. The server should |
| 1044 | 1044 | ** verify that the project code matches. |
| @@ -1142,14 +1142,14 @@ | ||
| 1142 | 1142 | ){ |
| 1143 | 1143 | cgi_reset_content(); |
| 1144 | 1144 | @ error login\sfailed |
| 1145 | 1145 | nErr++; |
| 1146 | 1146 | break; |
| 1147 | - } | |
| 1147 | + } | |
| 1148 | 1148 | } |
| 1149 | 1149 | }else |
| 1150 | - | |
| 1150 | + | |
| 1151 | 1151 | /* reqconfig NAME |
| 1152 | 1152 | ** |
| 1153 | 1153 | ** Request a configuration value |
| 1154 | 1154 | */ |
| 1155 | 1155 | if( blob_eq(&xfer.aToken[0], "reqconfig") |
| @@ -1167,11 +1167,11 @@ | ||
| 1167 | 1167 | /* Old style configuration transfer */ |
| 1168 | 1168 | send_legacy_config_card(&xfer, zName); |
| 1169 | 1169 | } |
| 1170 | 1170 | } |
| 1171 | 1171 | }else |
| 1172 | - | |
| 1172 | + | |
| 1173 | 1173 | /* config NAME SIZE \n CONTENT |
| 1174 | 1174 | ** |
| 1175 | 1175 | ** Receive a configuration value from the client. This is only |
| 1176 | 1176 | ** permitted for high-privilege users. |
| 1177 | 1177 | */ |
| @@ -1194,11 +1194,11 @@ | ||
| 1194 | 1194 | configure_receive(zName, &content, CONFIGSET_ALL); |
| 1195 | 1195 | blob_reset(&content); |
| 1196 | 1196 | blob_seek(xfer.pIn, 1, BLOB_SEEK_CUR); |
| 1197 | 1197 | }else |
| 1198 | 1198 | |
| 1199 | - | |
| 1199 | + | |
| 1200 | 1200 | |
| 1201 | 1201 | /* cookie TEXT |
| 1202 | 1202 | ** |
| 1203 | 1203 | ** A cookie contains a arbitrary-length argument that is server-defined. |
| 1204 | 1204 | ** The argument must be encoded so as not to contain any whitespace. |
| @@ -1413,11 +1413,11 @@ | ||
| 1413 | 1413 | int nArtifactRcvd = 0; /* Total artifacts received */ |
| 1414 | 1414 | const char *zOpType = 0;/* Push, Pull, Sync, Clone */ |
| 1415 | 1415 | double rSkew = 0.0; /* Maximum time skew */ |
| 1416 | 1416 | |
| 1417 | 1417 | if( db_get_boolean("dont-push", 0) ) syncFlags &= ~SYNC_PUSH; |
| 1418 | - if( (syncFlags & (SYNC_PUSH|SYNC_PULL|SYNC_CLONE))==0 | |
| 1418 | + if( (syncFlags & (SYNC_PUSH|SYNC_PULL|SYNC_CLONE))==0 | |
| 1419 | 1419 | && configRcvMask==0 && configSendMask==0 ) return 0; |
| 1420 | 1420 | |
| 1421 | 1421 | transport_stats(0, 0, 1); |
| 1422 | 1422 | socket_global_init(); |
| 1423 | 1423 | memset(&xfer, 0, sizeof(xfer)); |
| @@ -1487,11 +1487,11 @@ | ||
| 1487 | 1487 | */ |
| 1488 | 1488 | zCookie = db_get("cookie", 0); |
| 1489 | 1489 | if( zCookie ){ |
| 1490 | 1490 | blob_appendf(&send, "cookie %s\n", zCookie); |
| 1491 | 1491 | } |
| 1492 | - | |
| 1492 | + | |
| 1493 | 1493 | /* Generate gimme cards for phantoms and leaf cards |
| 1494 | 1494 | ** for all leaves. |
| 1495 | 1495 | */ |
| 1496 | 1496 | if( (syncFlags & SYNC_PULL)!=0 |
| 1497 | 1497 | || ((syncFlags & SYNC_CLONE)!=0 && cloneSeqno==1) |
| @@ -1503,11 +1503,11 @@ | ||
| 1503 | 1503 | nCardSent += send_unclustered(&xfer); |
| 1504 | 1504 | if( syncFlags & SYNC_PRIVATE ) send_private(&xfer); |
| 1505 | 1505 | } |
| 1506 | 1506 | |
| 1507 | 1507 | /* Send configuration parameter requests. On a clone, delay sending |
| 1508 | - ** this until the second cycle since the login card might fail on | |
| 1508 | + ** this until the second cycle since the login card might fail on | |
| 1509 | 1509 | ** the first cycle. |
| 1510 | 1510 | */ |
| 1511 | 1511 | if( configRcvMask && ((syncFlags & SYNC_CLONE)==0 || nCycle>0) ){ |
| 1512 | 1512 | const char *zName; |
| 1513 | 1513 | if( zOpType==0 ) zOpType = "Pull"; |
| @@ -1663,20 +1663,20 @@ | ||
| 1663 | 1663 | if( syncFlags & SYNC_PUSH ){ |
| 1664 | 1664 | int rid = rid_from_uuid(&xfer.aToken[1], 0, 0); |
| 1665 | 1665 | if( rid ) send_file(&xfer, rid, &xfer.aToken[1], 0); |
| 1666 | 1666 | } |
| 1667 | 1667 | }else |
| 1668 | - | |
| 1668 | + | |
| 1669 | 1669 | /* igot UUID ?PRIVATEFLAG? |
| 1670 | 1670 | ** |
| 1671 | 1671 | ** Server announces that it has a particular file. If this is |
| 1672 | 1672 | ** not a file that we have and we are pulling, then create a |
| 1673 | 1673 | ** phantom to cause this file to be requested on the next cycle. |
| 1674 | 1674 | ** Always remember that the server has this file so that we do |
| 1675 | 1675 | ** not transmit it by accident. |
| 1676 | 1676 | ** |
| 1677 | - ** If the PRIVATE argument exists and is 1, then the file is | |
| 1677 | + ** If the PRIVATE argument exists and is 1, then the file is | |
| 1678 | 1678 | ** private. Pretend it does not exists if we are not pulling |
| 1679 | 1679 | ** private files. |
| 1680 | 1680 | */ |
| 1681 | 1681 | if( xfer.nToken>=2 |
| 1682 | 1682 | && blob_eq(&xfer.aToken[0], "igot") |
| @@ -1693,12 +1693,12 @@ | ||
| 1693 | 1693 | rid = content_new(blob_str(&xfer.aToken[1]), isPriv); |
| 1694 | 1694 | if( rid ) newPhantom = 1; |
| 1695 | 1695 | } |
| 1696 | 1696 | remote_has(rid); |
| 1697 | 1697 | }else |
| 1698 | - | |
| 1699 | - | |
| 1698 | + | |
| 1699 | + | |
| 1700 | 1700 | /* push SERVERCODE PRODUCTCODE |
| 1701 | 1701 | ** |
| 1702 | 1702 | ** Should only happen in response to a clone. This message tells |
| 1703 | 1703 | ** the client what product to use for the new database. |
| 1704 | 1704 | */ |
| @@ -1716,11 +1716,11 @@ | ||
| 1716 | 1716 | db_set("project-code", zPCode, 0); |
| 1717 | 1717 | } |
| 1718 | 1718 | if( cloneSeqno>0 ) blob_appendf(&send, "clone 3 %d\n", cloneSeqno); |
| 1719 | 1719 | nCardSent++; |
| 1720 | 1720 | }else |
| 1721 | - | |
| 1721 | + | |
| 1722 | 1722 | /* config NAME SIZE \n CONTENT |
| 1723 | 1723 | ** |
| 1724 | 1724 | ** Receive a configuration value from the server. |
| 1725 | 1725 | ** |
| 1726 | 1726 | ** The received configuration setting is silently ignored if it was |
| @@ -1738,11 +1738,11 @@ | ||
| 1738 | 1738 | nArtifactRcvd++; |
| 1739 | 1739 | blob_reset(&content); |
| 1740 | 1740 | blob_seek(xfer.pIn, 1, BLOB_SEEK_CUR); |
| 1741 | 1741 | }else |
| 1742 | 1742 | |
| 1743 | - | |
| 1743 | + | |
| 1744 | 1744 | /* cookie TEXT |
| 1745 | 1745 | ** |
| 1746 | 1746 | ** The server might include a cookie in its reply. The client |
| 1747 | 1747 | ** should remember this cookie and send it back to the server |
| 1748 | 1748 | ** in its next query. |
| @@ -1780,11 +1780,11 @@ | ||
| 1780 | 1780 | ** |
| 1781 | 1781 | ** Print a message. Similar to "error" but does not stop processing. |
| 1782 | 1782 | ** |
| 1783 | 1783 | ** If the "login failed" message is seen, clear the sync password prior |
| 1784 | 1784 | ** to the next cycle. |
| 1785 | - */ | |
| 1785 | + */ | |
| 1786 | 1786 | if( blob_eq(&xfer.aToken[0],"message") && xfer.nToken==2 ){ |
| 1787 | 1787 | char *zMsg = blob_terminate(&xfer.aToken[1]); |
| 1788 | 1788 | defossilize(zMsg); |
| 1789 | 1789 | if( (syncFlags & SYNC_PUSH) && zMsg && strglob("pull only *", zMsg) ){ |
| 1790 | 1790 | syncFlags &= ~SYNC_PUSH; |
| @@ -1797,11 +1797,11 @@ | ||
| 1797 | 1797 | }else |
| 1798 | 1798 | |
| 1799 | 1799 | /* pragma NAME VALUE... |
| 1800 | 1800 | ** |
| 1801 | 1801 | ** The server can send pragmas to try to convey meta-information to |
| 1802 | - ** the client. These are informational only. Unknown pragmas are | |
| 1802 | + ** the client. These are informational only. Unknown pragmas are | |
| 1803 | 1803 | ** silently ignored. |
| 1804 | 1804 | */ |
| 1805 | 1805 | if( blob_eq(&xfer.aToken[0], "pragma") && xfer.nToken>=2 ){ |
| 1806 | 1806 | }else |
| 1807 | 1807 | |
| @@ -1810,14 +1810,14 @@ | ||
| 1810 | 1810 | ** Report an error and abandon the sync session. |
| 1811 | 1811 | ** |
| 1812 | 1812 | ** Except, when cloning we will sometimes get an error on the |
| 1813 | 1813 | ** first message exchange because the project-code is unknown |
| 1814 | 1814 | ** and so the login card on the request was invalid. The project-code |
| 1815 | - ** is returned in the reply before the error card, so second and | |
| 1815 | + ** is returned in the reply before the error card, so second and | |
| 1816 | 1816 | ** subsequent messages should be OK. Nevertheless, we need to ignore |
| 1817 | 1817 | ** the error card on the first message of a clone. |
| 1818 | - */ | |
| 1818 | + */ | |
| 1819 | 1819 | if( blob_eq(&xfer.aToken[0],"error") && xfer.nToken==2 ){ |
| 1820 | 1820 | if( (syncFlags & SYNC_CLONE)==0 || nCycle>0 ){ |
| 1821 | 1821 | char *zMsg = blob_terminate(&xfer.aToken[1]); |
| 1822 | 1822 | defossilize(zMsg); |
| 1823 | 1823 | fossil_force_newline(); |
| @@ -1894,11 +1894,11 @@ | ||
| 1894 | 1894 | xfer.nFileRcvd = 0; |
| 1895 | 1895 | xfer.nDeltaRcvd = 0; |
| 1896 | 1896 | xfer.nDanglingFile = 0; |
| 1897 | 1897 | |
| 1898 | 1898 | /* If we have one or more files queued to send, then go |
| 1899 | - ** another round | |
| 1899 | + ** another round | |
| 1900 | 1900 | */ |
| 1901 | 1901 | if( xfer.nFileSent+xfer.nDeltaSent>0 ){ |
| 1902 | 1902 | go = 1; |
| 1903 | 1903 | } |
| 1904 | 1904 | |
| @@ -1908,11 +1908,11 @@ | ||
| 1908 | 1908 | /* Stop the cycle if the server sends a "clone_seqno 0" card and |
| 1909 | 1909 | ** we have gone at least two rounds. Always go at least two rounds |
| 1910 | 1910 | ** on a clone in order to be sure to retrieve the configuration |
| 1911 | 1911 | ** information which is only sent on the second round. |
| 1912 | 1912 | */ |
| 1913 | - if( cloneSeqno<=0 && nCycle>1 ) go = 0; | |
| 1913 | + if( cloneSeqno<=0 && nCycle>1 ) go = 0; | |
| 1914 | 1914 | }; |
| 1915 | 1915 | transport_stats(&nSent, &nRcvd, 1); |
| 1916 | 1916 | if( (rSkew*24.0*3600.0) > 10.0 ){ |
| 1917 | 1917 | fossil_warning("*** time skew *** server is fast by %s", |
| 1918 | 1918 | db_timespan_name(rSkew)); |
| 1919 | 1919 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -94,11 +94,11 @@ | |
| 94 | db_reset(&q); |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | /* |
| 99 | ** The aToken[0..nToken-1] blob array is a parse of a "file" line |
| 100 | ** message. This routine finishes parsing that message and does |
| 101 | ** a record insert of the file. |
| 102 | ** |
| 103 | ** The file line is in one of the following two forms: |
| 104 | ** |
| @@ -119,14 +119,14 @@ | |
| 119 | int n; |
| 120 | int rid; |
| 121 | int srcid = 0; |
| 122 | Blob content, hash; |
| 123 | int isPriv; |
| 124 | |
| 125 | isPriv = pXfer->nextIsPrivate; |
| 126 | pXfer->nextIsPrivate = 0; |
| 127 | if( pXfer->nToken<3 |
| 128 | || pXfer->nToken>4 |
| 129 | || !blob_is_uuid(&pXfer->aToken[1]) |
| 130 | || !blob_is_int(&pXfer->aToken[pXfer->nToken-1], &n) |
| 131 | || n<0 |
| 132 | || (pXfer->nToken==4 && !blob_is_uuid(&pXfer->aToken[2])) |
| @@ -198,11 +198,11 @@ | |
| 198 | assert( blob_is_reset(&content) ); |
| 199 | remote_has(rid); |
| 200 | } |
| 201 | |
| 202 | /* |
| 203 | ** The aToken[0..nToken-1] blob array is a parse of a "cfile" line |
| 204 | ** message. This routine finishes parsing that message and does |
| 205 | ** a record insert of the file. The difference between "file" and |
| 206 | ** "cfile" is that with "cfile" the content is already compressed. |
| 207 | ** |
| 208 | ** The file line is in one of the following two forms: |
| @@ -227,14 +227,14 @@ | |
| 227 | int szU; /* USIZE */ |
| 228 | int rid; |
| 229 | int srcid = 0; |
| 230 | Blob content; |
| 231 | int isPriv; |
| 232 | |
| 233 | isPriv = pXfer->nextIsPrivate; |
| 234 | pXfer->nextIsPrivate = 0; |
| 235 | if( pXfer->nToken<4 |
| 236 | || pXfer->nToken>5 |
| 237 | || !blob_is_uuid(&pXfer->aToken[1]) |
| 238 | || !blob_is_int(&pXfer->aToken[pXfer->nToken-2], &szU) |
| 239 | || !blob_is_int(&pXfer->aToken[pXfer->nToken-1], &szC) |
| 240 | || szC<0 || szU<0 |
| @@ -284,11 +284,11 @@ | |
| 284 | ){ |
| 285 | static const char *const azQuery[] = { |
| 286 | "SELECT pid FROM plink x" |
| 287 | " WHERE cid=%d" |
| 288 | " AND NOT EXISTS(SELECT 1 FROM phantom WHERE rid=pid)", |
| 289 | |
| 290 | "SELECT pid, min(mtime) FROM mlink, event ON mlink.mid=event.objid" |
| 291 | " WHERE fid=%d" |
| 292 | " AND NOT EXISTS(SELECT 1 FROM phantom WHERE rid=pid)" |
| 293 | }; |
| 294 | int i; |
| @@ -321,11 +321,11 @@ | |
| 321 | } |
| 322 | return size; |
| 323 | } |
| 324 | |
| 325 | /* |
| 326 | ** Try to send a file as a native delta. |
| 327 | ** If successful, return the number of bytes in the delta. |
| 328 | ** If we cannot generate an appropriate delta, then send |
| 329 | ** nothing and return zero. |
| 330 | ** |
| 331 | ** Never send a delta against a private artifact. |
| @@ -403,11 +403,11 @@ | |
| 403 | } |
| 404 | if( uuid_is_shunned(blob_str(pUuid)) ){ |
| 405 | blob_reset(&uuid); |
| 406 | return; |
| 407 | } |
| 408 | if( (pXfer->maxTime != -1 && time(NULL) >= pXfer->maxTime) || |
| 409 | pXfer->mxSend<=blob_size(pXfer->pOut) ){ |
| 410 | const char *zFormat = isPriv ? "igot %b 1\n" : "igot %b\n"; |
| 411 | blob_appendf(pXfer->pOut, zFormat, pUuid); |
| 412 | pXfer->nIGotSent++; |
| 413 | blob_reset(&uuid); |
| @@ -445,11 +445,11 @@ | |
| 445 | #endif |
| 446 | } |
| 447 | |
| 448 | /* |
| 449 | ** Send the file identified by rid as a compressed artifact. Basically, |
| 450 | ** send the content exactly as it appears in the BLOB table using |
| 451 | ** a "cfile" card. |
| 452 | */ |
| 453 | static void send_compressed_file(Xfer *pXfer, int rid){ |
| 454 | const char *zContent; |
| 455 | const char *zUuid; |
| @@ -515,11 +515,11 @@ | |
| 515 | ** Except: do not request shunned artifacts. And do not request |
| 516 | ** private artifacts if we are not doing a private transfer. |
| 517 | */ |
| 518 | static void request_phantoms(Xfer *pXfer, int maxReq){ |
| 519 | Stmt q; |
| 520 | db_prepare(&q, |
| 521 | "SELECT uuid FROM phantom JOIN blob USING(rid)" |
| 522 | " WHERE NOT EXISTS(SELECT 1 FROM shun WHERE uuid=blob.uuid) %s", |
| 523 | (pXfer->syncPrivate ? "" : |
| 524 | " AND NOT EXISTS(SELECT 1 FROM private WHERE rid=blob.rid)") |
| 525 | ); |
| @@ -551,12 +551,12 @@ | |
| 551 | ** Check the signature on an application/x-fossil payload received by |
| 552 | ** the HTTP server. The signature is a line of the following form: |
| 553 | ** |
| 554 | ** login LOGIN NONCE SIGNATURE |
| 555 | ** |
| 556 | ** The NONCE is the SHA1 hash of the remainder of the input. |
| 557 | ** SIGNATURE is the SHA1 checksum of the NONCE concatenated |
| 558 | ** with the users password. |
| 559 | ** |
| 560 | ** The parameters to this routine are ephemeral blobs holding the |
| 561 | ** LOGIN, NONCE and SIGNATURE. |
| 562 | ** |
| @@ -564,11 +564,11 @@ | |
| 564 | ** If everything checks out, the USER.CAP column for the USER table |
| 565 | ** is consulted to set privileges in the global g variable. |
| 566 | ** |
| 567 | ** If anything fails to check out, no changes are made to privileges. |
| 568 | ** |
| 569 | ** Signature generation on the client side is handled by the |
| 570 | ** http_exchange() routine. |
| 571 | ** |
| 572 | ** Return non-zero for a login failure and zero for success. |
| 573 | */ |
| 574 | int check_login(Blob *pLogin, Blob *pNonce, Blob *pSig){ |
| @@ -699,11 +699,11 @@ | |
| 699 | blob_appendf(&deleteWhere, ",%d", rid); |
| 700 | } |
| 701 | } |
| 702 | db_finalize(&q); |
| 703 | db_multi_exec( |
| 704 | "DELETE FROM unclustered WHERE rid NOT IN (0 %s)", |
| 705 | blob_str(&deleteWhere) |
| 706 | ); |
| 707 | blob_reset(&deleteWhere); |
| 708 | if( nRow>0 ){ |
| 709 | md5sum_blob(&cluster, &cksum); |
| @@ -738,21 +738,21 @@ | |
| 738 | */ |
| 739 | static int send_unclustered(Xfer *pXfer){ |
| 740 | Stmt q; |
| 741 | int cnt = 0; |
| 742 | if( pXfer->resync ){ |
| 743 | db_prepare(&q, |
| 744 | "SELECT uuid, rid FROM blob" |
| 745 | " WHERE NOT EXISTS(SELECT 1 FROM shun WHERE uuid=blob.uuid)" |
| 746 | " AND NOT EXISTS(SELECT 1 FROM phantom WHERE rid=blob.rid)" |
| 747 | " AND NOT EXISTS(SELECT 1 FROM private WHERE rid=blob.rid)" |
| 748 | " AND blob.rid<=%d" |
| 749 | " ORDER BY blob.rid DESC", |
| 750 | pXfer->resync |
| 751 | ); |
| 752 | }else{ |
| 753 | db_prepare(&q, |
| 754 | "SELECT uuid FROM unclustered JOIN blob USING(rid)" |
| 755 | " WHERE NOT EXISTS(SELECT 1 FROM shun WHERE uuid=blob.uuid)" |
| 756 | " AND NOT EXISTS(SELECT 1 FROM phantom WHERE rid=blob.rid)" |
| 757 | " AND NOT EXISTS(SELECT 1 FROM private WHERE rid=blob.rid)" |
| 758 | ); |
| @@ -772,11 +772,11 @@ | |
| 772 | /* |
| 773 | ** Send an igot message for every artifact. |
| 774 | */ |
| 775 | static void send_all(Xfer *pXfer){ |
| 776 | Stmt q; |
| 777 | db_prepare(&q, |
| 778 | "SELECT uuid FROM blob " |
| 779 | " WHERE NOT EXISTS(SELECT 1 FROM shun WHERE uuid=blob.uuid)" |
| 780 | " AND NOT EXISTS(SELECT 1 FROM private WHERE rid=blob.rid)" |
| 781 | " AND NOT EXISTS(SELECT 1 FROM phantom WHERE rid=blob.rid)" |
| 782 | ); |
| @@ -1033,12 +1033,12 @@ | |
| 1033 | }else{ |
| 1034 | server_private_xfer_not_authorized(); |
| 1035 | } |
| 1036 | } |
| 1037 | }else |
| 1038 | |
| 1039 | |
| 1040 | /* pull SERVERCODE PROJECTCODE |
| 1041 | ** push SERVERCODE PROJECTCODE |
| 1042 | ** |
| 1043 | ** The client wants either send or receive. The server should |
| 1044 | ** verify that the project code matches. |
| @@ -1142,14 +1142,14 @@ | |
| 1142 | ){ |
| 1143 | cgi_reset_content(); |
| 1144 | @ error login\sfailed |
| 1145 | nErr++; |
| 1146 | break; |
| 1147 | } |
| 1148 | } |
| 1149 | }else |
| 1150 | |
| 1151 | /* reqconfig NAME |
| 1152 | ** |
| 1153 | ** Request a configuration value |
| 1154 | */ |
| 1155 | if( blob_eq(&xfer.aToken[0], "reqconfig") |
| @@ -1167,11 +1167,11 @@ | |
| 1167 | /* Old style configuration transfer */ |
| 1168 | send_legacy_config_card(&xfer, zName); |
| 1169 | } |
| 1170 | } |
| 1171 | }else |
| 1172 | |
| 1173 | /* config NAME SIZE \n CONTENT |
| 1174 | ** |
| 1175 | ** Receive a configuration value from the client. This is only |
| 1176 | ** permitted for high-privilege users. |
| 1177 | */ |
| @@ -1194,11 +1194,11 @@ | |
| 1194 | configure_receive(zName, &content, CONFIGSET_ALL); |
| 1195 | blob_reset(&content); |
| 1196 | blob_seek(xfer.pIn, 1, BLOB_SEEK_CUR); |
| 1197 | }else |
| 1198 | |
| 1199 | |
| 1200 | |
| 1201 | /* cookie TEXT |
| 1202 | ** |
| 1203 | ** A cookie contains a arbitrary-length argument that is server-defined. |
| 1204 | ** The argument must be encoded so as not to contain any whitespace. |
| @@ -1413,11 +1413,11 @@ | |
| 1413 | int nArtifactRcvd = 0; /* Total artifacts received */ |
| 1414 | const char *zOpType = 0;/* Push, Pull, Sync, Clone */ |
| 1415 | double rSkew = 0.0; /* Maximum time skew */ |
| 1416 | |
| 1417 | if( db_get_boolean("dont-push", 0) ) syncFlags &= ~SYNC_PUSH; |
| 1418 | if( (syncFlags & (SYNC_PUSH|SYNC_PULL|SYNC_CLONE))==0 |
| 1419 | && configRcvMask==0 && configSendMask==0 ) return 0; |
| 1420 | |
| 1421 | transport_stats(0, 0, 1); |
| 1422 | socket_global_init(); |
| 1423 | memset(&xfer, 0, sizeof(xfer)); |
| @@ -1487,11 +1487,11 @@ | |
| 1487 | */ |
| 1488 | zCookie = db_get("cookie", 0); |
| 1489 | if( zCookie ){ |
| 1490 | blob_appendf(&send, "cookie %s\n", zCookie); |
| 1491 | } |
| 1492 | |
| 1493 | /* Generate gimme cards for phantoms and leaf cards |
| 1494 | ** for all leaves. |
| 1495 | */ |
| 1496 | if( (syncFlags & SYNC_PULL)!=0 |
| 1497 | || ((syncFlags & SYNC_CLONE)!=0 && cloneSeqno==1) |
| @@ -1503,11 +1503,11 @@ | |
| 1503 | nCardSent += send_unclustered(&xfer); |
| 1504 | if( syncFlags & SYNC_PRIVATE ) send_private(&xfer); |
| 1505 | } |
| 1506 | |
| 1507 | /* Send configuration parameter requests. On a clone, delay sending |
| 1508 | ** this until the second cycle since the login card might fail on |
| 1509 | ** the first cycle. |
| 1510 | */ |
| 1511 | if( configRcvMask && ((syncFlags & SYNC_CLONE)==0 || nCycle>0) ){ |
| 1512 | const char *zName; |
| 1513 | if( zOpType==0 ) zOpType = "Pull"; |
| @@ -1663,20 +1663,20 @@ | |
| 1663 | if( syncFlags & SYNC_PUSH ){ |
| 1664 | int rid = rid_from_uuid(&xfer.aToken[1], 0, 0); |
| 1665 | if( rid ) send_file(&xfer, rid, &xfer.aToken[1], 0); |
| 1666 | } |
| 1667 | }else |
| 1668 | |
| 1669 | /* igot UUID ?PRIVATEFLAG? |
| 1670 | ** |
| 1671 | ** Server announces that it has a particular file. If this is |
| 1672 | ** not a file that we have and we are pulling, then create a |
| 1673 | ** phantom to cause this file to be requested on the next cycle. |
| 1674 | ** Always remember that the server has this file so that we do |
| 1675 | ** not transmit it by accident. |
| 1676 | ** |
| 1677 | ** If the PRIVATE argument exists and is 1, then the file is |
| 1678 | ** private. Pretend it does not exists if we are not pulling |
| 1679 | ** private files. |
| 1680 | */ |
| 1681 | if( xfer.nToken>=2 |
| 1682 | && blob_eq(&xfer.aToken[0], "igot") |
| @@ -1693,12 +1693,12 @@ | |
| 1693 | rid = content_new(blob_str(&xfer.aToken[1]), isPriv); |
| 1694 | if( rid ) newPhantom = 1; |
| 1695 | } |
| 1696 | remote_has(rid); |
| 1697 | }else |
| 1698 | |
| 1699 | |
| 1700 | /* push SERVERCODE PRODUCTCODE |
| 1701 | ** |
| 1702 | ** Should only happen in response to a clone. This message tells |
| 1703 | ** the client what product to use for the new database. |
| 1704 | */ |
| @@ -1716,11 +1716,11 @@ | |
| 1716 | db_set("project-code", zPCode, 0); |
| 1717 | } |
| 1718 | if( cloneSeqno>0 ) blob_appendf(&send, "clone 3 %d\n", cloneSeqno); |
| 1719 | nCardSent++; |
| 1720 | }else |
| 1721 | |
| 1722 | /* config NAME SIZE \n CONTENT |
| 1723 | ** |
| 1724 | ** Receive a configuration value from the server. |
| 1725 | ** |
| 1726 | ** The received configuration setting is silently ignored if it was |
| @@ -1738,11 +1738,11 @@ | |
| 1738 | nArtifactRcvd++; |
| 1739 | blob_reset(&content); |
| 1740 | blob_seek(xfer.pIn, 1, BLOB_SEEK_CUR); |
| 1741 | }else |
| 1742 | |
| 1743 | |
| 1744 | /* cookie TEXT |
| 1745 | ** |
| 1746 | ** The server might include a cookie in its reply. The client |
| 1747 | ** should remember this cookie and send it back to the server |
| 1748 | ** in its next query. |
| @@ -1780,11 +1780,11 @@ | |
| 1780 | ** |
| 1781 | ** Print a message. Similar to "error" but does not stop processing. |
| 1782 | ** |
| 1783 | ** If the "login failed" message is seen, clear the sync password prior |
| 1784 | ** to the next cycle. |
| 1785 | */ |
| 1786 | if( blob_eq(&xfer.aToken[0],"message") && xfer.nToken==2 ){ |
| 1787 | char *zMsg = blob_terminate(&xfer.aToken[1]); |
| 1788 | defossilize(zMsg); |
| 1789 | if( (syncFlags & SYNC_PUSH) && zMsg && strglob("pull only *", zMsg) ){ |
| 1790 | syncFlags &= ~SYNC_PUSH; |
| @@ -1797,11 +1797,11 @@ | |
| 1797 | }else |
| 1798 | |
| 1799 | /* pragma NAME VALUE... |
| 1800 | ** |
| 1801 | ** The server can send pragmas to try to convey meta-information to |
| 1802 | ** the client. These are informational only. Unknown pragmas are |
| 1803 | ** silently ignored. |
| 1804 | */ |
| 1805 | if( blob_eq(&xfer.aToken[0], "pragma") && xfer.nToken>=2 ){ |
| 1806 | }else |
| 1807 | |
| @@ -1810,14 +1810,14 @@ | |
| 1810 | ** Report an error and abandon the sync session. |
| 1811 | ** |
| 1812 | ** Except, when cloning we will sometimes get an error on the |
| 1813 | ** first message exchange because the project-code is unknown |
| 1814 | ** and so the login card on the request was invalid. The project-code |
| 1815 | ** is returned in the reply before the error card, so second and |
| 1816 | ** subsequent messages should be OK. Nevertheless, we need to ignore |
| 1817 | ** the error card on the first message of a clone. |
| 1818 | */ |
| 1819 | if( blob_eq(&xfer.aToken[0],"error") && xfer.nToken==2 ){ |
| 1820 | if( (syncFlags & SYNC_CLONE)==0 || nCycle>0 ){ |
| 1821 | char *zMsg = blob_terminate(&xfer.aToken[1]); |
| 1822 | defossilize(zMsg); |
| 1823 | fossil_force_newline(); |
| @@ -1894,11 +1894,11 @@ | |
| 1894 | xfer.nFileRcvd = 0; |
| 1895 | xfer.nDeltaRcvd = 0; |
| 1896 | xfer.nDanglingFile = 0; |
| 1897 | |
| 1898 | /* If we have one or more files queued to send, then go |
| 1899 | ** another round |
| 1900 | */ |
| 1901 | if( xfer.nFileSent+xfer.nDeltaSent>0 ){ |
| 1902 | go = 1; |
| 1903 | } |
| 1904 | |
| @@ -1908,11 +1908,11 @@ | |
| 1908 | /* Stop the cycle if the server sends a "clone_seqno 0" card and |
| 1909 | ** we have gone at least two rounds. Always go at least two rounds |
| 1910 | ** on a clone in order to be sure to retrieve the configuration |
| 1911 | ** information which is only sent on the second round. |
| 1912 | */ |
| 1913 | if( cloneSeqno<=0 && nCycle>1 ) go = 0; |
| 1914 | }; |
| 1915 | transport_stats(&nSent, &nRcvd, 1); |
| 1916 | if( (rSkew*24.0*3600.0) > 10.0 ){ |
| 1917 | fossil_warning("*** time skew *** server is fast by %s", |
| 1918 | db_timespan_name(rSkew)); |
| 1919 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -94,11 +94,11 @@ | |
| 94 | db_reset(&q); |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | /* |
| 99 | ** The aToken[0..nToken-1] blob array is a parse of a "file" line |
| 100 | ** message. This routine finishes parsing that message and does |
| 101 | ** a record insert of the file. |
| 102 | ** |
| 103 | ** The file line is in one of the following two forms: |
| 104 | ** |
| @@ -119,14 +119,14 @@ | |
| 119 | int n; |
| 120 | int rid; |
| 121 | int srcid = 0; |
| 122 | Blob content, hash; |
| 123 | int isPriv; |
| 124 | |
| 125 | isPriv = pXfer->nextIsPrivate; |
| 126 | pXfer->nextIsPrivate = 0; |
| 127 | if( pXfer->nToken<3 |
| 128 | || pXfer->nToken>4 |
| 129 | || !blob_is_uuid(&pXfer->aToken[1]) |
| 130 | || !blob_is_int(&pXfer->aToken[pXfer->nToken-1], &n) |
| 131 | || n<0 |
| 132 | || (pXfer->nToken==4 && !blob_is_uuid(&pXfer->aToken[2])) |
| @@ -198,11 +198,11 @@ | |
| 198 | assert( blob_is_reset(&content) ); |
| 199 | remote_has(rid); |
| 200 | } |
| 201 | |
| 202 | /* |
| 203 | ** The aToken[0..nToken-1] blob array is a parse of a "cfile" line |
| 204 | ** message. This routine finishes parsing that message and does |
| 205 | ** a record insert of the file. The difference between "file" and |
| 206 | ** "cfile" is that with "cfile" the content is already compressed. |
| 207 | ** |
| 208 | ** The file line is in one of the following two forms: |
| @@ -227,14 +227,14 @@ | |
| 227 | int szU; /* USIZE */ |
| 228 | int rid; |
| 229 | int srcid = 0; |
| 230 | Blob content; |
| 231 | int isPriv; |
| 232 | |
| 233 | isPriv = pXfer->nextIsPrivate; |
| 234 | pXfer->nextIsPrivate = 0; |
| 235 | if( pXfer->nToken<4 |
| 236 | || pXfer->nToken>5 |
| 237 | || !blob_is_uuid(&pXfer->aToken[1]) |
| 238 | || !blob_is_int(&pXfer->aToken[pXfer->nToken-2], &szU) |
| 239 | || !blob_is_int(&pXfer->aToken[pXfer->nToken-1], &szC) |
| 240 | || szC<0 || szU<0 |
| @@ -284,11 +284,11 @@ | |
| 284 | ){ |
| 285 | static const char *const azQuery[] = { |
| 286 | "SELECT pid FROM plink x" |
| 287 | " WHERE cid=%d" |
| 288 | " AND NOT EXISTS(SELECT 1 FROM phantom WHERE rid=pid)", |
| 289 | |
| 290 | "SELECT pid, min(mtime) FROM mlink, event ON mlink.mid=event.objid" |
| 291 | " WHERE fid=%d" |
| 292 | " AND NOT EXISTS(SELECT 1 FROM phantom WHERE rid=pid)" |
| 293 | }; |
| 294 | int i; |
| @@ -321,11 +321,11 @@ | |
| 321 | } |
| 322 | return size; |
| 323 | } |
| 324 | |
| 325 | /* |
| 326 | ** Try to send a file as a native delta. |
| 327 | ** If successful, return the number of bytes in the delta. |
| 328 | ** If we cannot generate an appropriate delta, then send |
| 329 | ** nothing and return zero. |
| 330 | ** |
| 331 | ** Never send a delta against a private artifact. |
| @@ -403,11 +403,11 @@ | |
| 403 | } |
| 404 | if( uuid_is_shunned(blob_str(pUuid)) ){ |
| 405 | blob_reset(&uuid); |
| 406 | return; |
| 407 | } |
| 408 | if( (pXfer->maxTime != -1 && time(NULL) >= pXfer->maxTime) || |
| 409 | pXfer->mxSend<=blob_size(pXfer->pOut) ){ |
| 410 | const char *zFormat = isPriv ? "igot %b 1\n" : "igot %b\n"; |
| 411 | blob_appendf(pXfer->pOut, zFormat, pUuid); |
| 412 | pXfer->nIGotSent++; |
| 413 | blob_reset(&uuid); |
| @@ -445,11 +445,11 @@ | |
| 445 | #endif |
| 446 | } |
| 447 | |
| 448 | /* |
| 449 | ** Send the file identified by rid as a compressed artifact. Basically, |
| 450 | ** send the content exactly as it appears in the BLOB table using |
| 451 | ** a "cfile" card. |
| 452 | */ |
| 453 | static void send_compressed_file(Xfer *pXfer, int rid){ |
| 454 | const char *zContent; |
| 455 | const char *zUuid; |
| @@ -515,11 +515,11 @@ | |
| 515 | ** Except: do not request shunned artifacts. And do not request |
| 516 | ** private artifacts if we are not doing a private transfer. |
| 517 | */ |
| 518 | static void request_phantoms(Xfer *pXfer, int maxReq){ |
| 519 | Stmt q; |
| 520 | db_prepare(&q, |
| 521 | "SELECT uuid FROM phantom JOIN blob USING(rid)" |
| 522 | " WHERE NOT EXISTS(SELECT 1 FROM shun WHERE uuid=blob.uuid) %s", |
| 523 | (pXfer->syncPrivate ? "" : |
| 524 | " AND NOT EXISTS(SELECT 1 FROM private WHERE rid=blob.rid)") |
| 525 | ); |
| @@ -551,12 +551,12 @@ | |
| 551 | ** Check the signature on an application/x-fossil payload received by |
| 552 | ** the HTTP server. The signature is a line of the following form: |
| 553 | ** |
| 554 | ** login LOGIN NONCE SIGNATURE |
| 555 | ** |
| 556 | ** The NONCE is the SHA1 hash of the remainder of the input. |
| 557 | ** SIGNATURE is the SHA1 checksum of the NONCE concatenated |
| 558 | ** with the users password. |
| 559 | ** |
| 560 | ** The parameters to this routine are ephemeral blobs holding the |
| 561 | ** LOGIN, NONCE and SIGNATURE. |
| 562 | ** |
| @@ -564,11 +564,11 @@ | |
| 564 | ** If everything checks out, the USER.CAP column for the USER table |
| 565 | ** is consulted to set privileges in the global g variable. |
| 566 | ** |
| 567 | ** If anything fails to check out, no changes are made to privileges. |
| 568 | ** |
| 569 | ** Signature generation on the client side is handled by the |
| 570 | ** http_exchange() routine. |
| 571 | ** |
| 572 | ** Return non-zero for a login failure and zero for success. |
| 573 | */ |
| 574 | int check_login(Blob *pLogin, Blob *pNonce, Blob *pSig){ |
| @@ -699,11 +699,11 @@ | |
| 699 | blob_appendf(&deleteWhere, ",%d", rid); |
| 700 | } |
| 701 | } |
| 702 | db_finalize(&q); |
| 703 | db_multi_exec( |
| 704 | "DELETE FROM unclustered WHERE rid NOT IN (0 %s)", |
| 705 | blob_str(&deleteWhere) |
| 706 | ); |
| 707 | blob_reset(&deleteWhere); |
| 708 | if( nRow>0 ){ |
| 709 | md5sum_blob(&cluster, &cksum); |
| @@ -738,21 +738,21 @@ | |
| 738 | */ |
| 739 | static int send_unclustered(Xfer *pXfer){ |
| 740 | Stmt q; |
| 741 | int cnt = 0; |
| 742 | if( pXfer->resync ){ |
| 743 | db_prepare(&q, |
| 744 | "SELECT uuid, rid FROM blob" |
| 745 | " WHERE NOT EXISTS(SELECT 1 FROM shun WHERE uuid=blob.uuid)" |
| 746 | " AND NOT EXISTS(SELECT 1 FROM phantom WHERE rid=blob.rid)" |
| 747 | " AND NOT EXISTS(SELECT 1 FROM private WHERE rid=blob.rid)" |
| 748 | " AND blob.rid<=%d" |
| 749 | " ORDER BY blob.rid DESC", |
| 750 | pXfer->resync |
| 751 | ); |
| 752 | }else{ |
| 753 | db_prepare(&q, |
| 754 | "SELECT uuid FROM unclustered JOIN blob USING(rid)" |
| 755 | " WHERE NOT EXISTS(SELECT 1 FROM shun WHERE uuid=blob.uuid)" |
| 756 | " AND NOT EXISTS(SELECT 1 FROM phantom WHERE rid=blob.rid)" |
| 757 | " AND NOT EXISTS(SELECT 1 FROM private WHERE rid=blob.rid)" |
| 758 | ); |
| @@ -772,11 +772,11 @@ | |
| 772 | /* |
| 773 | ** Send an igot message for every artifact. |
| 774 | */ |
| 775 | static void send_all(Xfer *pXfer){ |
| 776 | Stmt q; |
| 777 | db_prepare(&q, |
| 778 | "SELECT uuid FROM blob " |
| 779 | " WHERE NOT EXISTS(SELECT 1 FROM shun WHERE uuid=blob.uuid)" |
| 780 | " AND NOT EXISTS(SELECT 1 FROM private WHERE rid=blob.rid)" |
| 781 | " AND NOT EXISTS(SELECT 1 FROM phantom WHERE rid=blob.rid)" |
| 782 | ); |
| @@ -1033,12 +1033,12 @@ | |
| 1033 | }else{ |
| 1034 | server_private_xfer_not_authorized(); |
| 1035 | } |
| 1036 | } |
| 1037 | }else |
| 1038 | |
| 1039 | |
| 1040 | /* pull SERVERCODE PROJECTCODE |
| 1041 | ** push SERVERCODE PROJECTCODE |
| 1042 | ** |
| 1043 | ** The client wants either send or receive. The server should |
| 1044 | ** verify that the project code matches. |
| @@ -1142,14 +1142,14 @@ | |
| 1142 | ){ |
| 1143 | cgi_reset_content(); |
| 1144 | @ error login\sfailed |
| 1145 | nErr++; |
| 1146 | break; |
| 1147 | } |
| 1148 | } |
| 1149 | }else |
| 1150 | |
| 1151 | /* reqconfig NAME |
| 1152 | ** |
| 1153 | ** Request a configuration value |
| 1154 | */ |
| 1155 | if( blob_eq(&xfer.aToken[0], "reqconfig") |
| @@ -1167,11 +1167,11 @@ | |
| 1167 | /* Old style configuration transfer */ |
| 1168 | send_legacy_config_card(&xfer, zName); |
| 1169 | } |
| 1170 | } |
| 1171 | }else |
| 1172 | |
| 1173 | /* config NAME SIZE \n CONTENT |
| 1174 | ** |
| 1175 | ** Receive a configuration value from the client. This is only |
| 1176 | ** permitted for high-privilege users. |
| 1177 | */ |
| @@ -1194,11 +1194,11 @@ | |
| 1194 | configure_receive(zName, &content, CONFIGSET_ALL); |
| 1195 | blob_reset(&content); |
| 1196 | blob_seek(xfer.pIn, 1, BLOB_SEEK_CUR); |
| 1197 | }else |
| 1198 | |
| 1199 | |
| 1200 | |
| 1201 | /* cookie TEXT |
| 1202 | ** |
| 1203 | ** A cookie contains a arbitrary-length argument that is server-defined. |
| 1204 | ** The argument must be encoded so as not to contain any whitespace. |
| @@ -1413,11 +1413,11 @@ | |
| 1413 | int nArtifactRcvd = 0; /* Total artifacts received */ |
| 1414 | const char *zOpType = 0;/* Push, Pull, Sync, Clone */ |
| 1415 | double rSkew = 0.0; /* Maximum time skew */ |
| 1416 | |
| 1417 | if( db_get_boolean("dont-push", 0) ) syncFlags &= ~SYNC_PUSH; |
| 1418 | if( (syncFlags & (SYNC_PUSH|SYNC_PULL|SYNC_CLONE))==0 |
| 1419 | && configRcvMask==0 && configSendMask==0 ) return 0; |
| 1420 | |
| 1421 | transport_stats(0, 0, 1); |
| 1422 | socket_global_init(); |
| 1423 | memset(&xfer, 0, sizeof(xfer)); |
| @@ -1487,11 +1487,11 @@ | |
| 1487 | */ |
| 1488 | zCookie = db_get("cookie", 0); |
| 1489 | if( zCookie ){ |
| 1490 | blob_appendf(&send, "cookie %s\n", zCookie); |
| 1491 | } |
| 1492 | |
| 1493 | /* Generate gimme cards for phantoms and leaf cards |
| 1494 | ** for all leaves. |
| 1495 | */ |
| 1496 | if( (syncFlags & SYNC_PULL)!=0 |
| 1497 | || ((syncFlags & SYNC_CLONE)!=0 && cloneSeqno==1) |
| @@ -1503,11 +1503,11 @@ | |
| 1503 | nCardSent += send_unclustered(&xfer); |
| 1504 | if( syncFlags & SYNC_PRIVATE ) send_private(&xfer); |
| 1505 | } |
| 1506 | |
| 1507 | /* Send configuration parameter requests. On a clone, delay sending |
| 1508 | ** this until the second cycle since the login card might fail on |
| 1509 | ** the first cycle. |
| 1510 | */ |
| 1511 | if( configRcvMask && ((syncFlags & SYNC_CLONE)==0 || nCycle>0) ){ |
| 1512 | const char *zName; |
| 1513 | if( zOpType==0 ) zOpType = "Pull"; |
| @@ -1663,20 +1663,20 @@ | |
| 1663 | if( syncFlags & SYNC_PUSH ){ |
| 1664 | int rid = rid_from_uuid(&xfer.aToken[1], 0, 0); |
| 1665 | if( rid ) send_file(&xfer, rid, &xfer.aToken[1], 0); |
| 1666 | } |
| 1667 | }else |
| 1668 | |
| 1669 | /* igot UUID ?PRIVATEFLAG? |
| 1670 | ** |
| 1671 | ** Server announces that it has a particular file. If this is |
| 1672 | ** not a file that we have and we are pulling, then create a |
| 1673 | ** phantom to cause this file to be requested on the next cycle. |
| 1674 | ** Always remember that the server has this file so that we do |
| 1675 | ** not transmit it by accident. |
| 1676 | ** |
| 1677 | ** If the PRIVATE argument exists and is 1, then the file is |
| 1678 | ** private. Pretend it does not exists if we are not pulling |
| 1679 | ** private files. |
| 1680 | */ |
| 1681 | if( xfer.nToken>=2 |
| 1682 | && blob_eq(&xfer.aToken[0], "igot") |
| @@ -1693,12 +1693,12 @@ | |
| 1693 | rid = content_new(blob_str(&xfer.aToken[1]), isPriv); |
| 1694 | if( rid ) newPhantom = 1; |
| 1695 | } |
| 1696 | remote_has(rid); |
| 1697 | }else |
| 1698 | |
| 1699 | |
| 1700 | /* push SERVERCODE PRODUCTCODE |
| 1701 | ** |
| 1702 | ** Should only happen in response to a clone. This message tells |
| 1703 | ** the client what product to use for the new database. |
| 1704 | */ |
| @@ -1716,11 +1716,11 @@ | |
| 1716 | db_set("project-code", zPCode, 0); |
| 1717 | } |
| 1718 | if( cloneSeqno>0 ) blob_appendf(&send, "clone 3 %d\n", cloneSeqno); |
| 1719 | nCardSent++; |
| 1720 | }else |
| 1721 | |
| 1722 | /* config NAME SIZE \n CONTENT |
| 1723 | ** |
| 1724 | ** Receive a configuration value from the server. |
| 1725 | ** |
| 1726 | ** The received configuration setting is silently ignored if it was |
| @@ -1738,11 +1738,11 @@ | |
| 1738 | nArtifactRcvd++; |
| 1739 | blob_reset(&content); |
| 1740 | blob_seek(xfer.pIn, 1, BLOB_SEEK_CUR); |
| 1741 | }else |
| 1742 | |
| 1743 | |
| 1744 | /* cookie TEXT |
| 1745 | ** |
| 1746 | ** The server might include a cookie in its reply. The client |
| 1747 | ** should remember this cookie and send it back to the server |
| 1748 | ** in its next query. |
| @@ -1780,11 +1780,11 @@ | |
| 1780 | ** |
| 1781 | ** Print a message. Similar to "error" but does not stop processing. |
| 1782 | ** |
| 1783 | ** If the "login failed" message is seen, clear the sync password prior |
| 1784 | ** to the next cycle. |
| 1785 | */ |
| 1786 | if( blob_eq(&xfer.aToken[0],"message") && xfer.nToken==2 ){ |
| 1787 | char *zMsg = blob_terminate(&xfer.aToken[1]); |
| 1788 | defossilize(zMsg); |
| 1789 | if( (syncFlags & SYNC_PUSH) && zMsg && strglob("pull only *", zMsg) ){ |
| 1790 | syncFlags &= ~SYNC_PUSH; |
| @@ -1797,11 +1797,11 @@ | |
| 1797 | }else |
| 1798 | |
| 1799 | /* pragma NAME VALUE... |
| 1800 | ** |
| 1801 | ** The server can send pragmas to try to convey meta-information to |
| 1802 | ** the client. These are informational only. Unknown pragmas are |
| 1803 | ** silently ignored. |
| 1804 | */ |
| 1805 | if( blob_eq(&xfer.aToken[0], "pragma") && xfer.nToken>=2 ){ |
| 1806 | }else |
| 1807 | |
| @@ -1810,14 +1810,14 @@ | |
| 1810 | ** Report an error and abandon the sync session. |
| 1811 | ** |
| 1812 | ** Except, when cloning we will sometimes get an error on the |
| 1813 | ** first message exchange because the project-code is unknown |
| 1814 | ** and so the login card on the request was invalid. The project-code |
| 1815 | ** is returned in the reply before the error card, so second and |
| 1816 | ** subsequent messages should be OK. Nevertheless, we need to ignore |
| 1817 | ** the error card on the first message of a clone. |
| 1818 | */ |
| 1819 | if( blob_eq(&xfer.aToken[0],"error") && xfer.nToken==2 ){ |
| 1820 | if( (syncFlags & SYNC_CLONE)==0 || nCycle>0 ){ |
| 1821 | char *zMsg = blob_terminate(&xfer.aToken[1]); |
| 1822 | defossilize(zMsg); |
| 1823 | fossil_force_newline(); |
| @@ -1894,11 +1894,11 @@ | |
| 1894 | xfer.nFileRcvd = 0; |
| 1895 | xfer.nDeltaRcvd = 0; |
| 1896 | xfer.nDanglingFile = 0; |
| 1897 | |
| 1898 | /* If we have one or more files queued to send, then go |
| 1899 | ** another round |
| 1900 | */ |
| 1901 | if( xfer.nFileSent+xfer.nDeltaSent>0 ){ |
| 1902 | go = 1; |
| 1903 | } |
| 1904 | |
| @@ -1908,11 +1908,11 @@ | |
| 1908 | /* Stop the cycle if the server sends a "clone_seqno 0" card and |
| 1909 | ** we have gone at least two rounds. Always go at least two rounds |
| 1910 | ** on a clone in order to be sure to retrieve the configuration |
| 1911 | ** information which is only sent on the second round. |
| 1912 | */ |
| 1913 | if( cloneSeqno<=0 && nCycle>1 ) go = 0; |
| 1914 | }; |
| 1915 | transport_stats(&nSent, &nRcvd, 1); |
| 1916 | if( (rSkew*24.0*3600.0) > 10.0 ){ |
| 1917 | fossil_warning("*** time skew *** server is fast by %s", |
| 1918 | db_timespan_name(rSkew)); |
| 1919 |