Fossil SCM
Merge updates from trunk.
Commit
c42071515891e484704979b4485976a56f395cf8
Parent
5d251b673983cd9…
13 files changed
+1
+1
-1
+1
-1
+1
-1
+3
-2
+1
-1
+41
-10
+1
-1
+24
-24
+2
+40
-2
+2
-1
+2
-1
+1
| --- a/Dockerfile | ||
| +++ b/Dockerfile | ||
| @@ -0,0 +1 @@ | ||
| 1 | +trunk |
| --- a/Dockerfile | |
| +++ b/Dockerfile | |
| @@ -0,0 +1 @@ | |
| --- a/Dockerfile | |
| +++ b/Dockerfile | |
| @@ -0,0 +1 @@ | |
| 1 | trunk |
+1
-1
| --- src/bisect.c | ||
| +++ src/bisect.c | ||
| @@ -396,11 +396,11 @@ | ||
| 396 | 396 | } |
| 397 | 397 | }else if( g.argc==4 || g.argc==5 ){ |
| 398 | 398 | unsigned int i; |
| 399 | 399 | n = strlen(g.argv[3]); |
| 400 | 400 | for(i=0; i<sizeof(aBisectOption)/sizeof(aBisectOption[0]); i++){ |
| 401 | - if( memcmp(g.argv[3], aBisectOption[i].zName, n)==0 ){ | |
| 401 | + if( strncmp(g.argv[3], aBisectOption[i].zName, n)==0 ){ | |
| 402 | 402 | char *z = mprintf("bisect-%s", aBisectOption[i].zName); |
| 403 | 403 | if( g.argc==5 ){ |
| 404 | 404 | db_lset(z, g.argv[4]); |
| 405 | 405 | } |
| 406 | 406 | fossil_print("%s\n", db_lget(z, (char*)aBisectOption[i].zDefault)); |
| 407 | 407 |
| --- src/bisect.c | |
| +++ src/bisect.c | |
| @@ -396,11 +396,11 @@ | |
| 396 | } |
| 397 | }else if( g.argc==4 || g.argc==5 ){ |
| 398 | unsigned int i; |
| 399 | n = strlen(g.argv[3]); |
| 400 | for(i=0; i<sizeof(aBisectOption)/sizeof(aBisectOption[0]); i++){ |
| 401 | if( memcmp(g.argv[3], aBisectOption[i].zName, n)==0 ){ |
| 402 | char *z = mprintf("bisect-%s", aBisectOption[i].zName); |
| 403 | if( g.argc==5 ){ |
| 404 | db_lset(z, g.argv[4]); |
| 405 | } |
| 406 | fossil_print("%s\n", db_lget(z, (char*)aBisectOption[i].zDefault)); |
| 407 |
| --- src/bisect.c | |
| +++ src/bisect.c | |
| @@ -396,11 +396,11 @@ | |
| 396 | } |
| 397 | }else if( g.argc==4 || g.argc==5 ){ |
| 398 | unsigned int i; |
| 399 | n = strlen(g.argv[3]); |
| 400 | for(i=0; i<sizeof(aBisectOption)/sizeof(aBisectOption[0]); i++){ |
| 401 | if( strncmp(g.argv[3], aBisectOption[i].zName, n)==0 ){ |
| 402 | char *z = mprintf("bisect-%s", aBisectOption[i].zName); |
| 403 | if( g.argc==5 ){ |
| 404 | db_lset(z, g.argv[4]); |
| 405 | } |
| 406 | fossil_print("%s\n", db_lget(z, (char*)aBisectOption[i].zDefault)); |
| 407 |
+1
-1
| --- src/captcha.c | ||
| +++ src/captcha.c | ||
| @@ -517,11 +517,11 @@ | ||
| 517 | 517 | char c = zEntered[i]; |
| 518 | 518 | if( c>='A' && c<='F' ) c += 'a' - 'A'; |
| 519 | 519 | if( c=='O' ) c = '0'; |
| 520 | 520 | z[i] = c; |
| 521 | 521 | } |
| 522 | - if( memcmp(zDecode,z,8)!=0 ) return 0; | |
| 522 | + if( strncmp(zDecode,z,8)!=0 ) return 0; | |
| 523 | 523 | return 1; |
| 524 | 524 | } |
| 525 | 525 | |
| 526 | 526 | /* |
| 527 | 527 | ** Generate a captcha display together with the necessary hidden parameter |
| 528 | 528 |
| --- src/captcha.c | |
| +++ src/captcha.c | |
| @@ -517,11 +517,11 @@ | |
| 517 | char c = zEntered[i]; |
| 518 | if( c>='A' && c<='F' ) c += 'a' - 'A'; |
| 519 | if( c=='O' ) c = '0'; |
| 520 | z[i] = c; |
| 521 | } |
| 522 | if( memcmp(zDecode,z,8)!=0 ) return 0; |
| 523 | return 1; |
| 524 | } |
| 525 | |
| 526 | /* |
| 527 | ** Generate a captcha display together with the necessary hidden parameter |
| 528 |
| --- src/captcha.c | |
| +++ src/captcha.c | |
| @@ -517,11 +517,11 @@ | |
| 517 | char c = zEntered[i]; |
| 518 | if( c>='A' && c<='F' ) c += 'a' - 'A'; |
| 519 | if( c=='O' ) c = '0'; |
| 520 | z[i] = c; |
| 521 | } |
| 522 | if( strncmp(zDecode,z,8)!=0 ) return 0; |
| 523 | return 1; |
| 524 | } |
| 525 | |
| 526 | /* |
| 527 | ** Generate a captcha display together with the necessary hidden parameter |
| 528 |
+1
-1
| --- src/cgi.c | ||
| +++ src/cgi.c | ||
| @@ -1715,11 +1715,11 @@ | ||
| 1715 | 1715 | fflush(stdout); |
| 1716 | 1716 | if( zBrowser ){ |
| 1717 | 1717 | zBrowser = mprintf(zBrowser, iPort); |
| 1718 | 1718 | #if defined(__CYGWIN__) |
| 1719 | 1719 | /* On Cygwin, we can do better than "echo" */ |
| 1720 | - if( memcmp(zBrowser, "echo ", 5)==0 ){ | |
| 1720 | + if( strncmp(zBrowser, "echo ", 5)==0 ){ | |
| 1721 | 1721 | wchar_t *wUrl = fossil_utf8_to_unicode(zBrowser+5); |
| 1722 | 1722 | wUrl[wcslen(wUrl)-2] = 0; /* Strip terminating " &" */ |
| 1723 | 1723 | if( (size_t)ShellExecuteW(0, L"open", wUrl, 0, 0, 1)<33 ){ |
| 1724 | 1724 | fossil_warning("cannot start browser\n"); |
| 1725 | 1725 | } |
| 1726 | 1726 |
| --- src/cgi.c | |
| +++ src/cgi.c | |
| @@ -1715,11 +1715,11 @@ | |
| 1715 | fflush(stdout); |
| 1716 | if( zBrowser ){ |
| 1717 | zBrowser = mprintf(zBrowser, iPort); |
| 1718 | #if defined(__CYGWIN__) |
| 1719 | /* On Cygwin, we can do better than "echo" */ |
| 1720 | if( memcmp(zBrowser, "echo ", 5)==0 ){ |
| 1721 | wchar_t *wUrl = fossil_utf8_to_unicode(zBrowser+5); |
| 1722 | wUrl[wcslen(wUrl)-2] = 0; /* Strip terminating " &" */ |
| 1723 | if( (size_t)ShellExecuteW(0, L"open", wUrl, 0, 0, 1)<33 ){ |
| 1724 | fossil_warning("cannot start browser\n"); |
| 1725 | } |
| 1726 |
| --- src/cgi.c | |
| +++ src/cgi.c | |
| @@ -1715,11 +1715,11 @@ | |
| 1715 | fflush(stdout); |
| 1716 | if( zBrowser ){ |
| 1717 | zBrowser = mprintf(zBrowser, iPort); |
| 1718 | #if defined(__CYGWIN__) |
| 1719 | /* On Cygwin, we can do better than "echo" */ |
| 1720 | if( strncmp(zBrowser, "echo ", 5)==0 ){ |
| 1721 | wchar_t *wUrl = fossil_utf8_to_unicode(zBrowser+5); |
| 1722 | wUrl[wcslen(wUrl)-2] = 0; /* Strip terminating " &" */ |
| 1723 | if( (size_t)ShellExecuteW(0, L"open", wUrl, 0, 0, 1)<33 ){ |
| 1724 | fossil_warning("cannot start browser\n"); |
| 1725 | } |
| 1726 |
+3
-2
| --- src/checkout.c | ||
| +++ src/checkout.c | ||
| @@ -137,14 +137,15 @@ | ||
| 137 | 137 | |
| 138 | 138 | if( db_get_boolean("manifest",0) ){ |
| 139 | 139 | blob_zero(&manifest); |
| 140 | 140 | content_get(vid, &manifest); |
| 141 | 141 | zManFile = mprintf("%smanifest", g.zLocalRoot); |
| 142 | - blob_write_to_file(&manifest, zManFile); | |
| 143 | - free(zManFile); | |
| 144 | 142 | blob_zero(&hash); |
| 145 | 143 | sha1sum_blob(&manifest, &hash); |
| 144 | + sterilize_manifest(&manifest); | |
| 145 | + blob_write_to_file(&manifest, zManFile); | |
| 146 | + free(zManFile); | |
| 146 | 147 | zManFile = mprintf("%smanifest.uuid", g.zLocalRoot); |
| 147 | 148 | blob_append(&hash, "\n", 1); |
| 148 | 149 | blob_write_to_file(&hash, zManFile); |
| 149 | 150 | free(zManFile); |
| 150 | 151 | blob_reset(&hash); |
| 151 | 152 |
| --- src/checkout.c | |
| +++ src/checkout.c | |
| @@ -137,14 +137,15 @@ | |
| 137 | |
| 138 | if( db_get_boolean("manifest",0) ){ |
| 139 | blob_zero(&manifest); |
| 140 | content_get(vid, &manifest); |
| 141 | zManFile = mprintf("%smanifest", g.zLocalRoot); |
| 142 | blob_write_to_file(&manifest, zManFile); |
| 143 | free(zManFile); |
| 144 | blob_zero(&hash); |
| 145 | sha1sum_blob(&manifest, &hash); |
| 146 | zManFile = mprintf("%smanifest.uuid", g.zLocalRoot); |
| 147 | blob_append(&hash, "\n", 1); |
| 148 | blob_write_to_file(&hash, zManFile); |
| 149 | free(zManFile); |
| 150 | blob_reset(&hash); |
| 151 |
| --- src/checkout.c | |
| +++ src/checkout.c | |
| @@ -137,14 +137,15 @@ | |
| 137 | |
| 138 | if( db_get_boolean("manifest",0) ){ |
| 139 | blob_zero(&manifest); |
| 140 | content_get(vid, &manifest); |
| 141 | zManFile = mprintf("%smanifest", g.zLocalRoot); |
| 142 | blob_zero(&hash); |
| 143 | sha1sum_blob(&manifest, &hash); |
| 144 | sterilize_manifest(&manifest); |
| 145 | blob_write_to_file(&manifest, zManFile); |
| 146 | free(zManFile); |
| 147 | zManFile = mprintf("%smanifest.uuid", g.zLocalRoot); |
| 148 | blob_append(&hash, "\n", 1); |
| 149 | blob_write_to_file(&hash, zManFile); |
| 150 | free(zManFile); |
| 151 | blob_reset(&hash); |
| 152 |
+1
-1
| --- src/configure.c | ||
| +++ src/configure.c | ||
| @@ -222,11 +222,11 @@ | ||
| 222 | 222 | if( n>2 && zName[0]=='\'' && zName[n-1]=='\'' ){ |
| 223 | 223 | zName++; |
| 224 | 224 | n -= 2; |
| 225 | 225 | } |
| 226 | 226 | for(i=0; i<count(aConfig); i++){ |
| 227 | - if( memcmp(zName, aConfig[i].zName, n)==0 && aConfig[i].zName[n]==0 ){ | |
| 227 | + if( strncmp(zName, aConfig[i].zName, n)==0 && aConfig[i].zName[n]==0 ){ | |
| 228 | 228 | int m = aConfig[i].groupMask; |
| 229 | 229 | if( !g.perm.Admin ){ |
| 230 | 230 | m &= ~CONFIGSET_USER; |
| 231 | 231 | } |
| 232 | 232 | if( !g.perm.RdAddr ){ |
| 233 | 233 |
| --- src/configure.c | |
| +++ src/configure.c | |
| @@ -222,11 +222,11 @@ | |
| 222 | if( n>2 && zName[0]=='\'' && zName[n-1]=='\'' ){ |
| 223 | zName++; |
| 224 | n -= 2; |
| 225 | } |
| 226 | for(i=0; i<count(aConfig); i++){ |
| 227 | if( memcmp(zName, aConfig[i].zName, n)==0 && aConfig[i].zName[n]==0 ){ |
| 228 | int m = aConfig[i].groupMask; |
| 229 | if( !g.perm.Admin ){ |
| 230 | m &= ~CONFIGSET_USER; |
| 231 | } |
| 232 | if( !g.perm.RdAddr ){ |
| 233 |
| --- src/configure.c | |
| +++ src/configure.c | |
| @@ -222,11 +222,11 @@ | |
| 222 | if( n>2 && zName[0]=='\'' && zName[n-1]=='\'' ){ |
| 223 | zName++; |
| 224 | n -= 2; |
| 225 | } |
| 226 | for(i=0; i<count(aConfig); i++){ |
| 227 | if( strncmp(zName, aConfig[i].zName, n)==0 && aConfig[i].zName[n]==0 ){ |
| 228 | int m = aConfig[i].groupMask; |
| 229 | if( !g.perm.Admin ){ |
| 230 | m &= ~CONFIGSET_USER; |
| 231 | } |
| 232 | if( !g.perm.RdAddr ){ |
| 233 |
M
src/db.c
+41
-10
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -1311,10 +1311,42 @@ | ||
| 1311 | 1311 | "INSERT OR IGNORE INTO user(login,pw,cap,info)" |
| 1312 | 1312 | " VALUES('reader','','kptw','Reader');" |
| 1313 | 1313 | ); |
| 1314 | 1314 | } |
| 1315 | 1315 | } |
| 1316 | + | |
| 1317 | +/* | |
| 1318 | +** This function sets the server and project codes if they do not already | |
| 1319 | +** exist. Currently, it should be called only by the db_initial_setup() | |
| 1320 | +** or cmd_webserver() functions, the latter being used to facilitate more | |
| 1321 | +** robust integration with "canned image" environments (e.g. Docker). | |
| 1322 | +*/ | |
| 1323 | +void db_setup_server_and_project_codes( | |
| 1324 | + int optional | |
| 1325 | +){ | |
| 1326 | + if( !optional ){ | |
| 1327 | + db_multi_exec( | |
| 1328 | + "INSERT INTO config(name,value,mtime)" | |
| 1329 | + " VALUES('server-code', lower(hex(randomblob(20))),now());" | |
| 1330 | + "INSERT INTO config(name,value,mtime)" | |
| 1331 | + " VALUES('project-code', lower(hex(randomblob(20))),now());" | |
| 1332 | + ); | |
| 1333 | + }else{ | |
| 1334 | + if( db_get("server-code", 0)==0 ) { | |
| 1335 | + db_optional_sql("repository", | |
| 1336 | + "INSERT INTO config(name,value,mtime)" | |
| 1337 | + " VALUES('server-code', lower(hex(randomblob(20))),now());" | |
| 1338 | + ); | |
| 1339 | + } | |
| 1340 | + if( db_get("project-code", 0)==0 ) { | |
| 1341 | + db_optional_sql("repository", | |
| 1342 | + "INSERT INTO config(name,value,mtime)" | |
| 1343 | + " VALUES('project-code', lower(hex(randomblob(20))),now());" | |
| 1344 | + ); | |
| 1345 | + } | |
| 1346 | + } | |
| 1347 | +} | |
| 1316 | 1348 | |
| 1317 | 1349 | /* |
| 1318 | 1350 | ** Return a pointer to a string that contains the RHS of an IN operator |
| 1319 | 1351 | ** that will select CONFIG table names that are in the list of control |
| 1320 | 1352 | ** settings. |
| @@ -1364,16 +1396,11 @@ | ||
| 1364 | 1396 | |
| 1365 | 1397 | db_set("content-schema", CONTENT_SCHEMA, 0); |
| 1366 | 1398 | db_set("aux-schema", AUX_SCHEMA, 0); |
| 1367 | 1399 | db_set("rebuilt", get_version(), 0); |
| 1368 | 1400 | if( makeServerCodes ){ |
| 1369 | - db_multi_exec( | |
| 1370 | - "INSERT INTO config(name,value,mtime)" | |
| 1371 | - " VALUES('server-code', lower(hex(randomblob(20))),now());" | |
| 1372 | - "INSERT INTO config(name,value,mtime)" | |
| 1373 | - " VALUES('project-code', lower(hex(randomblob(20))),now());" | |
| 1374 | - ); | |
| 1401 | + db_setup_server_and_project_codes(0); | |
| 1375 | 1402 | } |
| 1376 | 1403 | if( !db_is_global("autosync") ) db_set_int("autosync", 1, 0); |
| 1377 | 1404 | if( !db_is_global("localauth") ) db_set_int("localauth", 0, 0); |
| 1378 | 1405 | if( !db_is_global("timeline-plaintext") ){ |
| 1379 | 1406 | db_set_int("timeline-plaintext", 1, 0); |
| @@ -1469,23 +1496,25 @@ | ||
| 1469 | 1496 | ** Options: |
| 1470 | 1497 | ** --template FILE copy settings from repository file |
| 1471 | 1498 | ** --admin-user|-A USERNAME select given USERNAME as admin user |
| 1472 | 1499 | ** --date-override DATETIME use DATETIME as time of the initial checkin |
| 1473 | 1500 | ** (default: do not create an initial checkin) |
| 1501 | +** --empty create repository without project-id/server-id | |
| 1474 | 1502 | ** |
| 1475 | 1503 | ** See also: clone |
| 1476 | 1504 | */ |
| 1477 | 1505 | void create_repository_cmd(void){ |
| 1478 | 1506 | char *zPassword; |
| 1479 | 1507 | const char *zTemplate; /* Repository from which to copy settings */ |
| 1480 | 1508 | const char *zDate; /* Date of the initial check-in */ |
| 1481 | 1509 | const char *zDefaultUser; /* Optional name of the default user */ |
| 1510 | + int makeServerCodes; | |
| 1482 | 1511 | |
| 1483 | 1512 | zTemplate = find_option("template",0,1); |
| 1484 | 1513 | zDate = find_option("date-override",0,1); |
| 1485 | 1514 | zDefaultUser = find_option("admin-user","A",1); |
| 1486 | - find_option("empty", 0, 0); /* deprecated */ | |
| 1515 | + makeServerCodes = find_option("empty", 0, 0)==0; | |
| 1487 | 1516 | |
| 1488 | 1517 | /* We should be done with options.. */ |
| 1489 | 1518 | verify_all_options(); |
| 1490 | 1519 | |
| 1491 | 1520 | if( g.argc!=3 ){ |
| @@ -1494,15 +1523,17 @@ | ||
| 1494 | 1523 | db_create_repository(g.argv[2]); |
| 1495 | 1524 | db_open_repository(g.argv[2]); |
| 1496 | 1525 | db_open_config(0); |
| 1497 | 1526 | if( zTemplate ) db_attach(zTemplate, "settingSrc"); |
| 1498 | 1527 | db_begin_transaction(); |
| 1499 | - db_initial_setup(zTemplate, zDate, zDefaultUser, 1); | |
| 1528 | + db_initial_setup(zTemplate, zDate, zDefaultUser, makeServerCodes); | |
| 1500 | 1529 | db_end_transaction(0); |
| 1501 | 1530 | if( zTemplate ) db_detach("settingSrc"); |
| 1502 | - fossil_print("project-id: %s\n", db_get("project-code", 0)); | |
| 1503 | - fossil_print("server-id: %s\n", db_get("server-code", 0)); | |
| 1531 | + if( makeServerCodes ){ | |
| 1532 | + fossil_print("project-id: %s\n", db_get("project-code", 0)); | |
| 1533 | + fossil_print("server-id: %s\n", db_get("server-code", 0)); | |
| 1534 | + } | |
| 1504 | 1535 | zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin); |
| 1505 | 1536 | fossil_print("admin-user: %s (initial password is \"%s\")\n", |
| 1506 | 1537 | g.zLogin, zPassword); |
| 1507 | 1538 | } |
| 1508 | 1539 | |
| 1509 | 1540 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -1311,10 +1311,42 @@ | |
| 1311 | "INSERT OR IGNORE INTO user(login,pw,cap,info)" |
| 1312 | " VALUES('reader','','kptw','Reader');" |
| 1313 | ); |
| 1314 | } |
| 1315 | } |
| 1316 | |
| 1317 | /* |
| 1318 | ** Return a pointer to a string that contains the RHS of an IN operator |
| 1319 | ** that will select CONFIG table names that are in the list of control |
| 1320 | ** settings. |
| @@ -1364,16 +1396,11 @@ | |
| 1364 | |
| 1365 | db_set("content-schema", CONTENT_SCHEMA, 0); |
| 1366 | db_set("aux-schema", AUX_SCHEMA, 0); |
| 1367 | db_set("rebuilt", get_version(), 0); |
| 1368 | if( makeServerCodes ){ |
| 1369 | db_multi_exec( |
| 1370 | "INSERT INTO config(name,value,mtime)" |
| 1371 | " VALUES('server-code', lower(hex(randomblob(20))),now());" |
| 1372 | "INSERT INTO config(name,value,mtime)" |
| 1373 | " VALUES('project-code', lower(hex(randomblob(20))),now());" |
| 1374 | ); |
| 1375 | } |
| 1376 | if( !db_is_global("autosync") ) db_set_int("autosync", 1, 0); |
| 1377 | if( !db_is_global("localauth") ) db_set_int("localauth", 0, 0); |
| 1378 | if( !db_is_global("timeline-plaintext") ){ |
| 1379 | db_set_int("timeline-plaintext", 1, 0); |
| @@ -1469,23 +1496,25 @@ | |
| 1469 | ** Options: |
| 1470 | ** --template FILE copy settings from repository file |
| 1471 | ** --admin-user|-A USERNAME select given USERNAME as admin user |
| 1472 | ** --date-override DATETIME use DATETIME as time of the initial checkin |
| 1473 | ** (default: do not create an initial checkin) |
| 1474 | ** |
| 1475 | ** See also: clone |
| 1476 | */ |
| 1477 | void create_repository_cmd(void){ |
| 1478 | char *zPassword; |
| 1479 | const char *zTemplate; /* Repository from which to copy settings */ |
| 1480 | const char *zDate; /* Date of the initial check-in */ |
| 1481 | const char *zDefaultUser; /* Optional name of the default user */ |
| 1482 | |
| 1483 | zTemplate = find_option("template",0,1); |
| 1484 | zDate = find_option("date-override",0,1); |
| 1485 | zDefaultUser = find_option("admin-user","A",1); |
| 1486 | find_option("empty", 0, 0); /* deprecated */ |
| 1487 | |
| 1488 | /* We should be done with options.. */ |
| 1489 | verify_all_options(); |
| 1490 | |
| 1491 | if( g.argc!=3 ){ |
| @@ -1494,15 +1523,17 @@ | |
| 1494 | db_create_repository(g.argv[2]); |
| 1495 | db_open_repository(g.argv[2]); |
| 1496 | db_open_config(0); |
| 1497 | if( zTemplate ) db_attach(zTemplate, "settingSrc"); |
| 1498 | db_begin_transaction(); |
| 1499 | db_initial_setup(zTemplate, zDate, zDefaultUser, 1); |
| 1500 | db_end_transaction(0); |
| 1501 | if( zTemplate ) db_detach("settingSrc"); |
| 1502 | fossil_print("project-id: %s\n", db_get("project-code", 0)); |
| 1503 | fossil_print("server-id: %s\n", db_get("server-code", 0)); |
| 1504 | zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin); |
| 1505 | fossil_print("admin-user: %s (initial password is \"%s\")\n", |
| 1506 | g.zLogin, zPassword); |
| 1507 | } |
| 1508 | |
| 1509 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -1311,10 +1311,42 @@ | |
| 1311 | "INSERT OR IGNORE INTO user(login,pw,cap,info)" |
| 1312 | " VALUES('reader','','kptw','Reader');" |
| 1313 | ); |
| 1314 | } |
| 1315 | } |
| 1316 | |
| 1317 | /* |
| 1318 | ** This function sets the server and project codes if they do not already |
| 1319 | ** exist. Currently, it should be called only by the db_initial_setup() |
| 1320 | ** or cmd_webserver() functions, the latter being used to facilitate more |
| 1321 | ** robust integration with "canned image" environments (e.g. Docker). |
| 1322 | */ |
| 1323 | void db_setup_server_and_project_codes( |
| 1324 | int optional |
| 1325 | ){ |
| 1326 | if( !optional ){ |
| 1327 | db_multi_exec( |
| 1328 | "INSERT INTO config(name,value,mtime)" |
| 1329 | " VALUES('server-code', lower(hex(randomblob(20))),now());" |
| 1330 | "INSERT INTO config(name,value,mtime)" |
| 1331 | " VALUES('project-code', lower(hex(randomblob(20))),now());" |
| 1332 | ); |
| 1333 | }else{ |
| 1334 | if( db_get("server-code", 0)==0 ) { |
| 1335 | db_optional_sql("repository", |
| 1336 | "INSERT INTO config(name,value,mtime)" |
| 1337 | " VALUES('server-code', lower(hex(randomblob(20))),now());" |
| 1338 | ); |
| 1339 | } |
| 1340 | if( db_get("project-code", 0)==0 ) { |
| 1341 | db_optional_sql("repository", |
| 1342 | "INSERT INTO config(name,value,mtime)" |
| 1343 | " VALUES('project-code', lower(hex(randomblob(20))),now());" |
| 1344 | ); |
| 1345 | } |
| 1346 | } |
| 1347 | } |
| 1348 | |
| 1349 | /* |
| 1350 | ** Return a pointer to a string that contains the RHS of an IN operator |
| 1351 | ** that will select CONFIG table names that are in the list of control |
| 1352 | ** settings. |
| @@ -1364,16 +1396,11 @@ | |
| 1396 | |
| 1397 | db_set("content-schema", CONTENT_SCHEMA, 0); |
| 1398 | db_set("aux-schema", AUX_SCHEMA, 0); |
| 1399 | db_set("rebuilt", get_version(), 0); |
| 1400 | if( makeServerCodes ){ |
| 1401 | db_setup_server_and_project_codes(0); |
| 1402 | } |
| 1403 | if( !db_is_global("autosync") ) db_set_int("autosync", 1, 0); |
| 1404 | if( !db_is_global("localauth") ) db_set_int("localauth", 0, 0); |
| 1405 | if( !db_is_global("timeline-plaintext") ){ |
| 1406 | db_set_int("timeline-plaintext", 1, 0); |
| @@ -1469,23 +1496,25 @@ | |
| 1496 | ** Options: |
| 1497 | ** --template FILE copy settings from repository file |
| 1498 | ** --admin-user|-A USERNAME select given USERNAME as admin user |
| 1499 | ** --date-override DATETIME use DATETIME as time of the initial checkin |
| 1500 | ** (default: do not create an initial checkin) |
| 1501 | ** --empty create repository without project-id/server-id |
| 1502 | ** |
| 1503 | ** See also: clone |
| 1504 | */ |
| 1505 | void create_repository_cmd(void){ |
| 1506 | char *zPassword; |
| 1507 | const char *zTemplate; /* Repository from which to copy settings */ |
| 1508 | const char *zDate; /* Date of the initial check-in */ |
| 1509 | const char *zDefaultUser; /* Optional name of the default user */ |
| 1510 | int makeServerCodes; |
| 1511 | |
| 1512 | zTemplate = find_option("template",0,1); |
| 1513 | zDate = find_option("date-override",0,1); |
| 1514 | zDefaultUser = find_option("admin-user","A",1); |
| 1515 | makeServerCodes = find_option("empty", 0, 0)==0; |
| 1516 | |
| 1517 | /* We should be done with options.. */ |
| 1518 | verify_all_options(); |
| 1519 | |
| 1520 | if( g.argc!=3 ){ |
| @@ -1494,15 +1523,17 @@ | |
| 1523 | db_create_repository(g.argv[2]); |
| 1524 | db_open_repository(g.argv[2]); |
| 1525 | db_open_config(0); |
| 1526 | if( zTemplate ) db_attach(zTemplate, "settingSrc"); |
| 1527 | db_begin_transaction(); |
| 1528 | db_initial_setup(zTemplate, zDate, zDefaultUser, makeServerCodes); |
| 1529 | db_end_transaction(0); |
| 1530 | if( zTemplate ) db_detach("settingSrc"); |
| 1531 | if( makeServerCodes ){ |
| 1532 | fossil_print("project-id: %s\n", db_get("project-code", 0)); |
| 1533 | fossil_print("server-id: %s\n", db_get("server-code", 0)); |
| 1534 | } |
| 1535 | zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin); |
| 1536 | fossil_print("admin-user: %s (initial password is \"%s\")\n", |
| 1537 | g.zLogin, zPassword); |
| 1538 | } |
| 1539 | |
| 1540 |
+1
-1
| --- src/finfo.c | ||
| +++ src/finfo.c | ||
| @@ -430,11 +430,11 @@ | ||
| 430 | 430 | }else if( brBg || zBgClr==0 || zBgClr[0]==0 ){ |
| 431 | 431 | zBgClr = strcmp(zBr,"trunk")==0 ? "" : hash_color(zBr); |
| 432 | 432 | } |
| 433 | 433 | gidx = graph_add_row(pGraph, frid, fpid>0 ? 1 : 0, &fpid, zBr, zBgClr, |
| 434 | 434 | zUuid, 0); |
| 435 | - if( memcmp(zDate, zPrevDate, 10) ){ | |
| 435 | + if( strncmp(zDate, zPrevDate, 10) ){ | |
| 436 | 436 | sqlite3_snprintf(sizeof(zPrevDate), zPrevDate, "%.10s", zDate); |
| 437 | 437 | @ <tr><td> |
| 438 | 438 | @ <div class="divider">%s(zPrevDate)</div> |
| 439 | 439 | @ </td><td></td><td></td></tr> |
| 440 | 440 | } |
| 441 | 441 |
| --- src/finfo.c | |
| +++ src/finfo.c | |
| @@ -430,11 +430,11 @@ | |
| 430 | }else if( brBg || zBgClr==0 || zBgClr[0]==0 ){ |
| 431 | zBgClr = strcmp(zBr,"trunk")==0 ? "" : hash_color(zBr); |
| 432 | } |
| 433 | gidx = graph_add_row(pGraph, frid, fpid>0 ? 1 : 0, &fpid, zBr, zBgClr, |
| 434 | zUuid, 0); |
| 435 | if( memcmp(zDate, zPrevDate, 10) ){ |
| 436 | sqlite3_snprintf(sizeof(zPrevDate), zPrevDate, "%.10s", zDate); |
| 437 | @ <tr><td> |
| 438 | @ <div class="divider">%s(zPrevDate)</div> |
| 439 | @ </td><td></td><td></td></tr> |
| 440 | } |
| 441 |
| --- src/finfo.c | |
| +++ src/finfo.c | |
| @@ -430,11 +430,11 @@ | |
| 430 | }else if( brBg || zBgClr==0 || zBgClr[0]==0 ){ |
| 431 | zBgClr = strcmp(zBr,"trunk")==0 ? "" : hash_color(zBr); |
| 432 | } |
| 433 | gidx = graph_add_row(pGraph, frid, fpid>0 ? 1 : 0, &fpid, zBr, zBgClr, |
| 434 | zUuid, 0); |
| 435 | if( strncmp(zDate, zPrevDate, 10) ){ |
| 436 | sqlite3_snprintf(sizeof(zPrevDate), zPrevDate, "%.10s", zDate); |
| 437 | @ <tr><td> |
| 438 | @ <div class="divider">%s(zPrevDate)</div> |
| 439 | @ </td><td></td><td></td></tr> |
| 440 | } |
| 441 |
+24
-24
| --- src/import.c | ||
| +++ src/import.c | ||
| @@ -443,11 +443,11 @@ | ||
| 443 | 443 | static ImportFile *import_find_file(const char *zName, int *pI, int mx){ |
| 444 | 444 | int i = *pI; |
| 445 | 445 | int nName = strlen(zName); |
| 446 | 446 | while( i<mx ){ |
| 447 | 447 | const char *z = gg.aFile[i].zName; |
| 448 | - if( memcmp(zName, z, nName)==0 && (z[nName]==0 || z[nName]=='/') ){ | |
| 448 | + if( strncmp(zName, z, nName)==0 && (z[nName]==0 || z[nName]=='/') ){ | |
| 449 | 449 | *pI = i+1; |
| 450 | 450 | return &gg.aFile[i]; |
| 451 | 451 | } |
| 452 | 452 | i++; |
| 453 | 453 | } |
| @@ -488,15 +488,15 @@ | ||
| 488 | 488 | char zLine[1000]; |
| 489 | 489 | |
| 490 | 490 | gg.xFinish = finish_noop; |
| 491 | 491 | while( fgets(zLine, sizeof(zLine), pIn) ){ |
| 492 | 492 | if( zLine[0]=='\n' || zLine[0]=='#' ) continue; |
| 493 | - if( memcmp(zLine, "blob", 4)==0 ){ | |
| 493 | + if( strncmp(zLine, "blob", 4)==0 ){ | |
| 494 | 494 | gg.xFinish(); |
| 495 | 495 | gg.xFinish = finish_blob; |
| 496 | 496 | }else |
| 497 | - if( memcmp(zLine, "commit ", 7)==0 ){ | |
| 497 | + if( strncmp(zLine, "commit ", 7)==0 ){ | |
| 498 | 498 | gg.xFinish(); |
| 499 | 499 | gg.xFinish = finish_commit; |
| 500 | 500 | trim_newline(&zLine[7]); |
| 501 | 501 | z = &zLine[7]; |
| 502 | 502 | |
| @@ -517,41 +517,41 @@ | ||
| 517 | 517 | ** |
| 518 | 518 | ** None of the above is explained in the git-fast-export |
| 519 | 519 | ** documentation. We had to figure it out via trial and error. |
| 520 | 520 | */ |
| 521 | 521 | for(i=strlen(z)-1; i>=0 && z[i]!='/'; i--){} |
| 522 | - gg.tagCommit = memcmp(&z[i-4], "tags", 4)==0; /* True for pattern B */ | |
| 522 | + gg.tagCommit = strncmp(&z[i-4], "tags", 4)==0; /* True for pattern B */ | |
| 523 | 523 | if( z[i+1]!=0 ) z += i+1; |
| 524 | 524 | if( fossil_strcmp(z, "master")==0 ) z = "trunk"; |
| 525 | 525 | gg.zBranch = fossil_strdup(z); |
| 526 | 526 | gg.fromLoaded = 0; |
| 527 | 527 | }else |
| 528 | - if( memcmp(zLine, "tag ", 4)==0 ){ | |
| 528 | + if( strncmp(zLine, "tag ", 4)==0 ){ | |
| 529 | 529 | gg.xFinish(); |
| 530 | 530 | gg.xFinish = finish_tag; |
| 531 | 531 | trim_newline(&zLine[4]); |
| 532 | 532 | gg.zTag = fossil_strdup(&zLine[4]); |
| 533 | 533 | }else |
| 534 | - if( memcmp(zLine, "reset ", 4)==0 ){ | |
| 534 | + if( strncmp(zLine, "reset ", 4)==0 ){ | |
| 535 | + gg.xFinish(); | |
| 536 | + }else | |
| 537 | + if( strncmp(zLine, "checkpoint", 10)==0 ){ | |
| 535 | 538 | gg.xFinish(); |
| 536 | 539 | }else |
| 537 | - if( memcmp(zLine, "checkpoint", 10)==0 ){ | |
| 540 | + if( strncmp(zLine, "feature", 7)==0 ){ | |
| 538 | 541 | gg.xFinish(); |
| 539 | 542 | }else |
| 540 | - if( memcmp(zLine, "feature", 7)==0 ){ | |
| 543 | + if( strncmp(zLine, "option", 6)==0 ){ | |
| 541 | 544 | gg.xFinish(); |
| 542 | 545 | }else |
| 543 | - if( memcmp(zLine, "option", 6)==0 ){ | |
| 544 | - gg.xFinish(); | |
| 545 | - }else | |
| 546 | - if( memcmp(zLine, "progress ", 9)==0 ){ | |
| 546 | + if( strncmp(zLine, "progress ", 9)==0 ){ | |
| 547 | 547 | gg.xFinish(); |
| 548 | 548 | trim_newline(&zLine[9]); |
| 549 | 549 | fossil_print("%s\n", &zLine[9]); |
| 550 | 550 | fflush(stdout); |
| 551 | 551 | }else |
| 552 | - if( memcmp(zLine, "data ", 5)==0 ){ | |
| 552 | + if( strncmp(zLine, "data ", 5)==0 ){ | |
| 553 | 553 | fossil_free(gg.aData); gg.aData = 0; |
| 554 | 554 | gg.nData = atoi(&zLine[5]); |
| 555 | 555 | if( gg.nData ){ |
| 556 | 556 | int got; |
| 557 | 557 | gg.aData = fossil_malloc( gg.nData+1 ); |
| @@ -565,19 +565,19 @@ | ||
| 565 | 565 | gg.aData = 0; |
| 566 | 566 | gg.nData = 0; |
| 567 | 567 | } |
| 568 | 568 | } |
| 569 | 569 | }else |
| 570 | - if( memcmp(zLine, "author ", 7)==0 ){ | |
| 570 | + if( strncmp(zLine, "author ", 7)==0 ){ | |
| 571 | 571 | /* No-op */ |
| 572 | 572 | }else |
| 573 | - if( memcmp(zLine, "mark ", 5)==0 ){ | |
| 573 | + if( strncmp(zLine, "mark ", 5)==0 ){ | |
| 574 | 574 | trim_newline(&zLine[5]); |
| 575 | 575 | fossil_free(gg.zMark); |
| 576 | 576 | gg.zMark = fossil_strdup(&zLine[5]); |
| 577 | 577 | }else |
| 578 | - if( memcmp(zLine, "tagger ", 7)==0 || memcmp(zLine, "committer ",10)==0 ){ | |
| 578 | + if( strncmp(zLine, "tagger ", 7)==0 || strncmp(zLine, "committer ",10)==0 ){ | |
| 579 | 579 | sqlite3_int64 secSince1970; |
| 580 | 580 | for(i=0; zLine[i] && zLine[i]!='<'; i++){} |
| 581 | 581 | if( zLine[i]==0 ) goto malformed_line; |
| 582 | 582 | z = &zLine[i+1]; |
| 583 | 583 | for(i=i+1; zLine[i] && zLine[i]!='>'; i++){} |
| @@ -591,27 +591,27 @@ | ||
| 591 | 591 | } |
| 592 | 592 | fossil_free(gg.zDate); |
| 593 | 593 | gg.zDate = db_text(0, "SELECT datetime(%lld, 'unixepoch')", secSince1970); |
| 594 | 594 | gg.zDate[10] = 'T'; |
| 595 | 595 | }else |
| 596 | - if( memcmp(zLine, "from ", 5)==0 ){ | |
| 596 | + if( strncmp(zLine, "from ", 5)==0 ){ | |
| 597 | 597 | trim_newline(&zLine[5]); |
| 598 | 598 | fossil_free(gg.zFromMark); |
| 599 | 599 | gg.zFromMark = fossil_strdup(&zLine[5]); |
| 600 | 600 | fossil_free(gg.zFrom); |
| 601 | 601 | gg.zFrom = resolve_committish(&zLine[5]); |
| 602 | 602 | }else |
| 603 | - if( memcmp(zLine, "merge ", 6)==0 ){ | |
| 603 | + if( strncmp(zLine, "merge ", 6)==0 ){ | |
| 604 | 604 | trim_newline(&zLine[6]); |
| 605 | 605 | if( gg.nMerge>=gg.nMergeAlloc ){ |
| 606 | 606 | gg.nMergeAlloc = gg.nMergeAlloc*2 + 10; |
| 607 | 607 | gg.azMerge = fossil_realloc(gg.azMerge, gg.nMergeAlloc*sizeof(char*)); |
| 608 | 608 | } |
| 609 | 609 | gg.azMerge[gg.nMerge] = resolve_committish(&zLine[6]); |
| 610 | 610 | if( gg.azMerge[gg.nMerge] ) gg.nMerge++; |
| 611 | 611 | }else |
| 612 | - if( memcmp(zLine, "M ", 2)==0 ){ | |
| 612 | + if( strncmp(zLine, "M ", 2)==0 ){ | |
| 613 | 613 | import_prior_files(); |
| 614 | 614 | z = &zLine[2]; |
| 615 | 615 | zPerm = next_token(&z); |
| 616 | 616 | zUuid = next_token(&z); |
| 617 | 617 | zName = rest_of_line(&z); |
| @@ -626,11 +626,11 @@ | ||
| 626 | 626 | pFile->isLink = (fossil_strcmp(zPerm, "120000")==0); |
| 627 | 627 | fossil_free(pFile->zUuid); |
| 628 | 628 | pFile->zUuid = resolve_committish(zUuid); |
| 629 | 629 | pFile->isFrom = 0; |
| 630 | 630 | }else |
| 631 | - if( memcmp(zLine, "D ", 2)==0 ){ | |
| 631 | + if( strncmp(zLine, "D ", 2)==0 ){ | |
| 632 | 632 | import_prior_files(); |
| 633 | 633 | z = &zLine[2]; |
| 634 | 634 | zName = rest_of_line(&z); |
| 635 | 635 | dequote_git_filename(zName); |
| 636 | 636 | i = 0; |
| @@ -641,11 +641,11 @@ | ||
| 641 | 641 | fossil_free(pFile->zUuid); |
| 642 | 642 | *pFile = gg.aFile[--gg.nFile]; |
| 643 | 643 | i--; |
| 644 | 644 | } |
| 645 | 645 | }else |
| 646 | - if( memcmp(zLine, "C ", 2)==0 ){ | |
| 646 | + if( strncmp(zLine, "C ", 2)==0 ){ | |
| 647 | 647 | int nFrom; |
| 648 | 648 | import_prior_files(); |
| 649 | 649 | z = &zLine[2]; |
| 650 | 650 | zFrom = next_token(&z); |
| 651 | 651 | zTo = rest_of_line(&z); |
| @@ -665,11 +665,11 @@ | ||
| 665 | 665 | pNew->isLink = pFile->isLink; |
| 666 | 666 | pNew->zUuid = fossil_strdup(pFile->zUuid); |
| 667 | 667 | pNew->isFrom = 0; |
| 668 | 668 | } |
| 669 | 669 | }else |
| 670 | - if( memcmp(zLine, "R ", 2)==0 ){ | |
| 670 | + if( strncmp(zLine, "R ", 2)==0 ){ | |
| 671 | 671 | int nFrom; |
| 672 | 672 | import_prior_files(); |
| 673 | 673 | z = &zLine[2]; |
| 674 | 674 | zFrom = next_token(&z); |
| 675 | 675 | zTo = rest_of_line(&z); |
| @@ -693,14 +693,14 @@ | ||
| 693 | 693 | *pFile = *pNew; |
| 694 | 694 | memset(pNew, 0, sizeof(*pNew)); |
| 695 | 695 | } |
| 696 | 696 | fossil_fatal("cannot handle R records, use --full-tree"); |
| 697 | 697 | }else |
| 698 | - if( memcmp(zLine, "deleteall", 9)==0 ){ | |
| 698 | + if( strncmp(zLine, "deleteall", 9)==0 ){ | |
| 699 | 699 | gg.fromLoaded = 1; |
| 700 | 700 | }else |
| 701 | - if( memcmp(zLine, "N ", 2)==0 ){ | |
| 701 | + if( strncmp(zLine, "N ", 2)==0 ){ | |
| 702 | 702 | /* No-op */ |
| 703 | 703 | }else |
| 704 | 704 | |
| 705 | 705 | { |
| 706 | 706 | goto malformed_line; |
| 707 | 707 |
| --- src/import.c | |
| +++ src/import.c | |
| @@ -443,11 +443,11 @@ | |
| 443 | static ImportFile *import_find_file(const char *zName, int *pI, int mx){ |
| 444 | int i = *pI; |
| 445 | int nName = strlen(zName); |
| 446 | while( i<mx ){ |
| 447 | const char *z = gg.aFile[i].zName; |
| 448 | if( memcmp(zName, z, nName)==0 && (z[nName]==0 || z[nName]=='/') ){ |
| 449 | *pI = i+1; |
| 450 | return &gg.aFile[i]; |
| 451 | } |
| 452 | i++; |
| 453 | } |
| @@ -488,15 +488,15 @@ | |
| 488 | char zLine[1000]; |
| 489 | |
| 490 | gg.xFinish = finish_noop; |
| 491 | while( fgets(zLine, sizeof(zLine), pIn) ){ |
| 492 | if( zLine[0]=='\n' || zLine[0]=='#' ) continue; |
| 493 | if( memcmp(zLine, "blob", 4)==0 ){ |
| 494 | gg.xFinish(); |
| 495 | gg.xFinish = finish_blob; |
| 496 | }else |
| 497 | if( memcmp(zLine, "commit ", 7)==0 ){ |
| 498 | gg.xFinish(); |
| 499 | gg.xFinish = finish_commit; |
| 500 | trim_newline(&zLine[7]); |
| 501 | z = &zLine[7]; |
| 502 | |
| @@ -517,41 +517,41 @@ | |
| 517 | ** |
| 518 | ** None of the above is explained in the git-fast-export |
| 519 | ** documentation. We had to figure it out via trial and error. |
| 520 | */ |
| 521 | for(i=strlen(z)-1; i>=0 && z[i]!='/'; i--){} |
| 522 | gg.tagCommit = memcmp(&z[i-4], "tags", 4)==0; /* True for pattern B */ |
| 523 | if( z[i+1]!=0 ) z += i+1; |
| 524 | if( fossil_strcmp(z, "master")==0 ) z = "trunk"; |
| 525 | gg.zBranch = fossil_strdup(z); |
| 526 | gg.fromLoaded = 0; |
| 527 | }else |
| 528 | if( memcmp(zLine, "tag ", 4)==0 ){ |
| 529 | gg.xFinish(); |
| 530 | gg.xFinish = finish_tag; |
| 531 | trim_newline(&zLine[4]); |
| 532 | gg.zTag = fossil_strdup(&zLine[4]); |
| 533 | }else |
| 534 | if( memcmp(zLine, "reset ", 4)==0 ){ |
| 535 | gg.xFinish(); |
| 536 | }else |
| 537 | if( memcmp(zLine, "checkpoint", 10)==0 ){ |
| 538 | gg.xFinish(); |
| 539 | }else |
| 540 | if( memcmp(zLine, "feature", 7)==0 ){ |
| 541 | gg.xFinish(); |
| 542 | }else |
| 543 | if( memcmp(zLine, "option", 6)==0 ){ |
| 544 | gg.xFinish(); |
| 545 | }else |
| 546 | if( memcmp(zLine, "progress ", 9)==0 ){ |
| 547 | gg.xFinish(); |
| 548 | trim_newline(&zLine[9]); |
| 549 | fossil_print("%s\n", &zLine[9]); |
| 550 | fflush(stdout); |
| 551 | }else |
| 552 | if( memcmp(zLine, "data ", 5)==0 ){ |
| 553 | fossil_free(gg.aData); gg.aData = 0; |
| 554 | gg.nData = atoi(&zLine[5]); |
| 555 | if( gg.nData ){ |
| 556 | int got; |
| 557 | gg.aData = fossil_malloc( gg.nData+1 ); |
| @@ -565,19 +565,19 @@ | |
| 565 | gg.aData = 0; |
| 566 | gg.nData = 0; |
| 567 | } |
| 568 | } |
| 569 | }else |
| 570 | if( memcmp(zLine, "author ", 7)==0 ){ |
| 571 | /* No-op */ |
| 572 | }else |
| 573 | if( memcmp(zLine, "mark ", 5)==0 ){ |
| 574 | trim_newline(&zLine[5]); |
| 575 | fossil_free(gg.zMark); |
| 576 | gg.zMark = fossil_strdup(&zLine[5]); |
| 577 | }else |
| 578 | if( memcmp(zLine, "tagger ", 7)==0 || memcmp(zLine, "committer ",10)==0 ){ |
| 579 | sqlite3_int64 secSince1970; |
| 580 | for(i=0; zLine[i] && zLine[i]!='<'; i++){} |
| 581 | if( zLine[i]==0 ) goto malformed_line; |
| 582 | z = &zLine[i+1]; |
| 583 | for(i=i+1; zLine[i] && zLine[i]!='>'; i++){} |
| @@ -591,27 +591,27 @@ | |
| 591 | } |
| 592 | fossil_free(gg.zDate); |
| 593 | gg.zDate = db_text(0, "SELECT datetime(%lld, 'unixepoch')", secSince1970); |
| 594 | gg.zDate[10] = 'T'; |
| 595 | }else |
| 596 | if( memcmp(zLine, "from ", 5)==0 ){ |
| 597 | trim_newline(&zLine[5]); |
| 598 | fossil_free(gg.zFromMark); |
| 599 | gg.zFromMark = fossil_strdup(&zLine[5]); |
| 600 | fossil_free(gg.zFrom); |
| 601 | gg.zFrom = resolve_committish(&zLine[5]); |
| 602 | }else |
| 603 | if( memcmp(zLine, "merge ", 6)==0 ){ |
| 604 | trim_newline(&zLine[6]); |
| 605 | if( gg.nMerge>=gg.nMergeAlloc ){ |
| 606 | gg.nMergeAlloc = gg.nMergeAlloc*2 + 10; |
| 607 | gg.azMerge = fossil_realloc(gg.azMerge, gg.nMergeAlloc*sizeof(char*)); |
| 608 | } |
| 609 | gg.azMerge[gg.nMerge] = resolve_committish(&zLine[6]); |
| 610 | if( gg.azMerge[gg.nMerge] ) gg.nMerge++; |
| 611 | }else |
| 612 | if( memcmp(zLine, "M ", 2)==0 ){ |
| 613 | import_prior_files(); |
| 614 | z = &zLine[2]; |
| 615 | zPerm = next_token(&z); |
| 616 | zUuid = next_token(&z); |
| 617 | zName = rest_of_line(&z); |
| @@ -626,11 +626,11 @@ | |
| 626 | pFile->isLink = (fossil_strcmp(zPerm, "120000")==0); |
| 627 | fossil_free(pFile->zUuid); |
| 628 | pFile->zUuid = resolve_committish(zUuid); |
| 629 | pFile->isFrom = 0; |
| 630 | }else |
| 631 | if( memcmp(zLine, "D ", 2)==0 ){ |
| 632 | import_prior_files(); |
| 633 | z = &zLine[2]; |
| 634 | zName = rest_of_line(&z); |
| 635 | dequote_git_filename(zName); |
| 636 | i = 0; |
| @@ -641,11 +641,11 @@ | |
| 641 | fossil_free(pFile->zUuid); |
| 642 | *pFile = gg.aFile[--gg.nFile]; |
| 643 | i--; |
| 644 | } |
| 645 | }else |
| 646 | if( memcmp(zLine, "C ", 2)==0 ){ |
| 647 | int nFrom; |
| 648 | import_prior_files(); |
| 649 | z = &zLine[2]; |
| 650 | zFrom = next_token(&z); |
| 651 | zTo = rest_of_line(&z); |
| @@ -665,11 +665,11 @@ | |
| 665 | pNew->isLink = pFile->isLink; |
| 666 | pNew->zUuid = fossil_strdup(pFile->zUuid); |
| 667 | pNew->isFrom = 0; |
| 668 | } |
| 669 | }else |
| 670 | if( memcmp(zLine, "R ", 2)==0 ){ |
| 671 | int nFrom; |
| 672 | import_prior_files(); |
| 673 | z = &zLine[2]; |
| 674 | zFrom = next_token(&z); |
| 675 | zTo = rest_of_line(&z); |
| @@ -693,14 +693,14 @@ | |
| 693 | *pFile = *pNew; |
| 694 | memset(pNew, 0, sizeof(*pNew)); |
| 695 | } |
| 696 | fossil_fatal("cannot handle R records, use --full-tree"); |
| 697 | }else |
| 698 | if( memcmp(zLine, "deleteall", 9)==0 ){ |
| 699 | gg.fromLoaded = 1; |
| 700 | }else |
| 701 | if( memcmp(zLine, "N ", 2)==0 ){ |
| 702 | /* No-op */ |
| 703 | }else |
| 704 | |
| 705 | { |
| 706 | goto malformed_line; |
| 707 |
| --- src/import.c | |
| +++ src/import.c | |
| @@ -443,11 +443,11 @@ | |
| 443 | static ImportFile *import_find_file(const char *zName, int *pI, int mx){ |
| 444 | int i = *pI; |
| 445 | int nName = strlen(zName); |
| 446 | while( i<mx ){ |
| 447 | const char *z = gg.aFile[i].zName; |
| 448 | if( strncmp(zName, z, nName)==0 && (z[nName]==0 || z[nName]=='/') ){ |
| 449 | *pI = i+1; |
| 450 | return &gg.aFile[i]; |
| 451 | } |
| 452 | i++; |
| 453 | } |
| @@ -488,15 +488,15 @@ | |
| 488 | char zLine[1000]; |
| 489 | |
| 490 | gg.xFinish = finish_noop; |
| 491 | while( fgets(zLine, sizeof(zLine), pIn) ){ |
| 492 | if( zLine[0]=='\n' || zLine[0]=='#' ) continue; |
| 493 | if( strncmp(zLine, "blob", 4)==0 ){ |
| 494 | gg.xFinish(); |
| 495 | gg.xFinish = finish_blob; |
| 496 | }else |
| 497 | if( strncmp(zLine, "commit ", 7)==0 ){ |
| 498 | gg.xFinish(); |
| 499 | gg.xFinish = finish_commit; |
| 500 | trim_newline(&zLine[7]); |
| 501 | z = &zLine[7]; |
| 502 | |
| @@ -517,41 +517,41 @@ | |
| 517 | ** |
| 518 | ** None of the above is explained in the git-fast-export |
| 519 | ** documentation. We had to figure it out via trial and error. |
| 520 | */ |
| 521 | for(i=strlen(z)-1; i>=0 && z[i]!='/'; i--){} |
| 522 | gg.tagCommit = strncmp(&z[i-4], "tags", 4)==0; /* True for pattern B */ |
| 523 | if( z[i+1]!=0 ) z += i+1; |
| 524 | if( fossil_strcmp(z, "master")==0 ) z = "trunk"; |
| 525 | gg.zBranch = fossil_strdup(z); |
| 526 | gg.fromLoaded = 0; |
| 527 | }else |
| 528 | if( strncmp(zLine, "tag ", 4)==0 ){ |
| 529 | gg.xFinish(); |
| 530 | gg.xFinish = finish_tag; |
| 531 | trim_newline(&zLine[4]); |
| 532 | gg.zTag = fossil_strdup(&zLine[4]); |
| 533 | }else |
| 534 | if( strncmp(zLine, "reset ", 4)==0 ){ |
| 535 | gg.xFinish(); |
| 536 | }else |
| 537 | if( strncmp(zLine, "checkpoint", 10)==0 ){ |
| 538 | gg.xFinish(); |
| 539 | }else |
| 540 | if( strncmp(zLine, "feature", 7)==0 ){ |
| 541 | gg.xFinish(); |
| 542 | }else |
| 543 | if( strncmp(zLine, "option", 6)==0 ){ |
| 544 | gg.xFinish(); |
| 545 | }else |
| 546 | if( strncmp(zLine, "progress ", 9)==0 ){ |
| 547 | gg.xFinish(); |
| 548 | trim_newline(&zLine[9]); |
| 549 | fossil_print("%s\n", &zLine[9]); |
| 550 | fflush(stdout); |
| 551 | }else |
| 552 | if( strncmp(zLine, "data ", 5)==0 ){ |
| 553 | fossil_free(gg.aData); gg.aData = 0; |
| 554 | gg.nData = atoi(&zLine[5]); |
| 555 | if( gg.nData ){ |
| 556 | int got; |
| 557 | gg.aData = fossil_malloc( gg.nData+1 ); |
| @@ -565,19 +565,19 @@ | |
| 565 | gg.aData = 0; |
| 566 | gg.nData = 0; |
| 567 | } |
| 568 | } |
| 569 | }else |
| 570 | if( strncmp(zLine, "author ", 7)==0 ){ |
| 571 | /* No-op */ |
| 572 | }else |
| 573 | if( strncmp(zLine, "mark ", 5)==0 ){ |
| 574 | trim_newline(&zLine[5]); |
| 575 | fossil_free(gg.zMark); |
| 576 | gg.zMark = fossil_strdup(&zLine[5]); |
| 577 | }else |
| 578 | if( strncmp(zLine, "tagger ", 7)==0 || strncmp(zLine, "committer ",10)==0 ){ |
| 579 | sqlite3_int64 secSince1970; |
| 580 | for(i=0; zLine[i] && zLine[i]!='<'; i++){} |
| 581 | if( zLine[i]==0 ) goto malformed_line; |
| 582 | z = &zLine[i+1]; |
| 583 | for(i=i+1; zLine[i] && zLine[i]!='>'; i++){} |
| @@ -591,27 +591,27 @@ | |
| 591 | } |
| 592 | fossil_free(gg.zDate); |
| 593 | gg.zDate = db_text(0, "SELECT datetime(%lld, 'unixepoch')", secSince1970); |
| 594 | gg.zDate[10] = 'T'; |
| 595 | }else |
| 596 | if( strncmp(zLine, "from ", 5)==0 ){ |
| 597 | trim_newline(&zLine[5]); |
| 598 | fossil_free(gg.zFromMark); |
| 599 | gg.zFromMark = fossil_strdup(&zLine[5]); |
| 600 | fossil_free(gg.zFrom); |
| 601 | gg.zFrom = resolve_committish(&zLine[5]); |
| 602 | }else |
| 603 | if( strncmp(zLine, "merge ", 6)==0 ){ |
| 604 | trim_newline(&zLine[6]); |
| 605 | if( gg.nMerge>=gg.nMergeAlloc ){ |
| 606 | gg.nMergeAlloc = gg.nMergeAlloc*2 + 10; |
| 607 | gg.azMerge = fossil_realloc(gg.azMerge, gg.nMergeAlloc*sizeof(char*)); |
| 608 | } |
| 609 | gg.azMerge[gg.nMerge] = resolve_committish(&zLine[6]); |
| 610 | if( gg.azMerge[gg.nMerge] ) gg.nMerge++; |
| 611 | }else |
| 612 | if( strncmp(zLine, "M ", 2)==0 ){ |
| 613 | import_prior_files(); |
| 614 | z = &zLine[2]; |
| 615 | zPerm = next_token(&z); |
| 616 | zUuid = next_token(&z); |
| 617 | zName = rest_of_line(&z); |
| @@ -626,11 +626,11 @@ | |
| 626 | pFile->isLink = (fossil_strcmp(zPerm, "120000")==0); |
| 627 | fossil_free(pFile->zUuid); |
| 628 | pFile->zUuid = resolve_committish(zUuid); |
| 629 | pFile->isFrom = 0; |
| 630 | }else |
| 631 | if( strncmp(zLine, "D ", 2)==0 ){ |
| 632 | import_prior_files(); |
| 633 | z = &zLine[2]; |
| 634 | zName = rest_of_line(&z); |
| 635 | dequote_git_filename(zName); |
| 636 | i = 0; |
| @@ -641,11 +641,11 @@ | |
| 641 | fossil_free(pFile->zUuid); |
| 642 | *pFile = gg.aFile[--gg.nFile]; |
| 643 | i--; |
| 644 | } |
| 645 | }else |
| 646 | if( strncmp(zLine, "C ", 2)==0 ){ |
| 647 | int nFrom; |
| 648 | import_prior_files(); |
| 649 | z = &zLine[2]; |
| 650 | zFrom = next_token(&z); |
| 651 | zTo = rest_of_line(&z); |
| @@ -665,11 +665,11 @@ | |
| 665 | pNew->isLink = pFile->isLink; |
| 666 | pNew->zUuid = fossil_strdup(pFile->zUuid); |
| 667 | pNew->isFrom = 0; |
| 668 | } |
| 669 | }else |
| 670 | if( strncmp(zLine, "R ", 2)==0 ){ |
| 671 | int nFrom; |
| 672 | import_prior_files(); |
| 673 | z = &zLine[2]; |
| 674 | zFrom = next_token(&z); |
| 675 | zTo = rest_of_line(&z); |
| @@ -693,14 +693,14 @@ | |
| 693 | *pFile = *pNew; |
| 694 | memset(pNew, 0, sizeof(*pNew)); |
| 695 | } |
| 696 | fossil_fatal("cannot handle R records, use --full-tree"); |
| 697 | }else |
| 698 | if( strncmp(zLine, "deleteall", 9)==0 ){ |
| 699 | gg.fromLoaded = 1; |
| 700 | }else |
| 701 | if( strncmp(zLine, "N ", 2)==0 ){ |
| 702 | /* No-op */ |
| 703 | }else |
| 704 | |
| 705 | { |
| 706 | goto malformed_line; |
| 707 |
+2
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -2197,10 +2197,12 @@ | ||
| 2197 | 2197 | }else{ |
| 2198 | 2198 | zBrowserCmd = mprintf("%s http://localhost:%%d/ &", zBrowser); |
| 2199 | 2199 | } |
| 2200 | 2200 | if( g.repositoryOpen ) flags |= HTTP_SERVER_HAD_REPOSITORY; |
| 2201 | 2201 | if( g.localOpen ) flags |= HTTP_SERVER_HAD_CHECKOUT; |
| 2202 | + }else{ | |
| 2203 | + db_setup_server_and_project_codes(1); | |
| 2202 | 2204 | } |
| 2203 | 2205 | db_close(1); |
| 2204 | 2206 | if( cgi_http_server(iPort, mxPort, zBrowserCmd, zIpAddr, flags) ){ |
| 2205 | 2207 | fossil_fatal("unable to listen on TCP socket %d", iPort); |
| 2206 | 2208 | } |
| 2207 | 2209 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -2197,10 +2197,12 @@ | |
| 2197 | }else{ |
| 2198 | zBrowserCmd = mprintf("%s http://localhost:%%d/ &", zBrowser); |
| 2199 | } |
| 2200 | if( g.repositoryOpen ) flags |= HTTP_SERVER_HAD_REPOSITORY; |
| 2201 | if( g.localOpen ) flags |= HTTP_SERVER_HAD_CHECKOUT; |
| 2202 | } |
| 2203 | db_close(1); |
| 2204 | if( cgi_http_server(iPort, mxPort, zBrowserCmd, zIpAddr, flags) ){ |
| 2205 | fossil_fatal("unable to listen on TCP socket %d", iPort); |
| 2206 | } |
| 2207 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -2197,10 +2197,12 @@ | |
| 2197 | }else{ |
| 2198 | zBrowserCmd = mprintf("%s http://localhost:%%d/ &", zBrowser); |
| 2199 | } |
| 2200 | if( g.repositoryOpen ) flags |= HTTP_SERVER_HAD_REPOSITORY; |
| 2201 | if( g.localOpen ) flags |= HTTP_SERVER_HAD_CHECKOUT; |
| 2202 | }else{ |
| 2203 | db_setup_server_and_project_codes(1); |
| 2204 | } |
| 2205 | db_close(1); |
| 2206 | if( cgi_http_server(iPort, mxPort, zBrowserCmd, zIpAddr, flags) ){ |
| 2207 | fossil_fatal("unable to listen on TCP socket %d", iPort); |
| 2208 | } |
| 2209 |
+40
-2
| --- src/manifest.c | ||
| +++ src/manifest.c | ||
| @@ -229,18 +229,18 @@ | ||
| 229 | 229 | */ |
| 230 | 230 | static void remove_pgp_signature(char **pz, int *pn){ |
| 231 | 231 | char *z = *pz; |
| 232 | 232 | int n = *pn; |
| 233 | 233 | int i; |
| 234 | - if( memcmp(z, "-----BEGIN PGP SIGNED MESSAGE-----", 34)!=0 ) return; | |
| 234 | + if( strncmp(z, "-----BEGIN PGP SIGNED MESSAGE-----", 34)!=0 ) return; | |
| 235 | 235 | for(i=34; i<n && !after_blank_line(z+i); i++){} |
| 236 | 236 | if( i>=n ) return; |
| 237 | 237 | z += i; |
| 238 | 238 | n -= i; |
| 239 | 239 | *pz = z; |
| 240 | 240 | for(i=n-1; i>=0; i--){ |
| 241 | - if( z[i]=='\n' && memcmp(&z[i],"\n-----BEGIN PGP SIGNATURE-", 25)==0 ){ | |
| 241 | + if( z[i]=='\n' && strncmp(&z[i],"\n-----BEGIN PGP SIGNATURE-", 25)==0 ){ | |
| 242 | 242 | n = i+1; |
| 243 | 243 | break; |
| 244 | 244 | } |
| 245 | 245 | } |
| 246 | 246 | *pn = n; |
| @@ -1641,10 +1641,48 @@ | ||
| 1641 | 1641 | blob_str(&comment), blob_str(&brief) |
| 1642 | 1642 | ); |
| 1643 | 1643 | blob_reset(&comment); |
| 1644 | 1644 | blob_reset(&brief); |
| 1645 | 1645 | } |
| 1646 | + | |
| 1647 | +/* | |
| 1648 | +** Add an extra line of text to the end of a manifest to prevent it being | |
| 1649 | +** recognized as a valid manifest. | |
| 1650 | +** | |
| 1651 | +** This routine is called prior to writing out the text of a manifest as | |
| 1652 | +** the "manifest" file in the root of a repository when | |
| 1653 | +** "fossil setting manifest on" is enabled. That way, if the files of | |
| 1654 | +** the project are imported into a different Fossil project, the manifest | |
| 1655 | +** file will not be interpreted as a control artifact in that other project. | |
| 1656 | +** | |
| 1657 | +** Normally it is sufficient to simply append the extra line of text. | |
| 1658 | +** However, if the manifest is PGP signed then the extra line has to be | |
| 1659 | +** inserted before the PGP signature (thus invalidating the signature). | |
| 1660 | +*/ | |
| 1661 | +void sterilize_manifest(Blob *p){ | |
| 1662 | + char *z, *zOrig; | |
| 1663 | + int n, nOrig; | |
| 1664 | + static const char zExtraLine[] = | |
| 1665 | + "# Remove this line to create a well-formed manifest.\n"; | |
| 1666 | + | |
| 1667 | + z = zOrig = blob_materialize(p); | |
| 1668 | + n = nOrig = blob_size(p); | |
| 1669 | + remove_pgp_signature(&z, &n); | |
| 1670 | + if( z==zOrig ){ | |
| 1671 | + blob_append(p, zExtraLine, -1); | |
| 1672 | + }else{ | |
| 1673 | + int iEnd; | |
| 1674 | + Blob copy; | |
| 1675 | + memcpy(©, p, sizeof(copy)); | |
| 1676 | + blob_init(p, 0, 0); | |
| 1677 | + iEnd = (int)(&z[n] - zOrig); | |
| 1678 | + blob_append(p, zOrig, iEnd); | |
| 1679 | + blob_append(p, zExtraLine, -1); | |
| 1680 | + blob_append(p, &zOrig[iEnd], -1); | |
| 1681 | + blob_zero(©); | |
| 1682 | + } | |
| 1683 | +} | |
| 1646 | 1684 | |
| 1647 | 1685 | /* |
| 1648 | 1686 | ** This is the comparison function used to sort the tag array. |
| 1649 | 1687 | */ |
| 1650 | 1688 | static int tag_compare(const void *a, const void *b){ |
| 1651 | 1689 |
| --- src/manifest.c | |
| +++ src/manifest.c | |
| @@ -229,18 +229,18 @@ | |
| 229 | */ |
| 230 | static void remove_pgp_signature(char **pz, int *pn){ |
| 231 | char *z = *pz; |
| 232 | int n = *pn; |
| 233 | int i; |
| 234 | if( memcmp(z, "-----BEGIN PGP SIGNED MESSAGE-----", 34)!=0 ) return; |
| 235 | for(i=34; i<n && !after_blank_line(z+i); i++){} |
| 236 | if( i>=n ) return; |
| 237 | z += i; |
| 238 | n -= i; |
| 239 | *pz = z; |
| 240 | for(i=n-1; i>=0; i--){ |
| 241 | if( z[i]=='\n' && memcmp(&z[i],"\n-----BEGIN PGP SIGNATURE-", 25)==0 ){ |
| 242 | n = i+1; |
| 243 | break; |
| 244 | } |
| 245 | } |
| 246 | *pn = n; |
| @@ -1641,10 +1641,48 @@ | |
| 1641 | blob_str(&comment), blob_str(&brief) |
| 1642 | ); |
| 1643 | blob_reset(&comment); |
| 1644 | blob_reset(&brief); |
| 1645 | } |
| 1646 | |
| 1647 | /* |
| 1648 | ** This is the comparison function used to sort the tag array. |
| 1649 | */ |
| 1650 | static int tag_compare(const void *a, const void *b){ |
| 1651 |
| --- src/manifest.c | |
| +++ src/manifest.c | |
| @@ -229,18 +229,18 @@ | |
| 229 | */ |
| 230 | static void remove_pgp_signature(char **pz, int *pn){ |
| 231 | char *z = *pz; |
| 232 | int n = *pn; |
| 233 | int i; |
| 234 | if( strncmp(z, "-----BEGIN PGP SIGNED MESSAGE-----", 34)!=0 ) return; |
| 235 | for(i=34; i<n && !after_blank_line(z+i); i++){} |
| 236 | if( i>=n ) return; |
| 237 | z += i; |
| 238 | n -= i; |
| 239 | *pz = z; |
| 240 | for(i=n-1; i>=0; i--){ |
| 241 | if( z[i]=='\n' && strncmp(&z[i],"\n-----BEGIN PGP SIGNATURE-", 25)==0 ){ |
| 242 | n = i+1; |
| 243 | break; |
| 244 | } |
| 245 | } |
| 246 | *pn = n; |
| @@ -1641,10 +1641,48 @@ | |
| 1641 | blob_str(&comment), blob_str(&brief) |
| 1642 | ); |
| 1643 | blob_reset(&comment); |
| 1644 | blob_reset(&brief); |
| 1645 | } |
| 1646 | |
| 1647 | /* |
| 1648 | ** Add an extra line of text to the end of a manifest to prevent it being |
| 1649 | ** recognized as a valid manifest. |
| 1650 | ** |
| 1651 | ** This routine is called prior to writing out the text of a manifest as |
| 1652 | ** the "manifest" file in the root of a repository when |
| 1653 | ** "fossil setting manifest on" is enabled. That way, if the files of |
| 1654 | ** the project are imported into a different Fossil project, the manifest |
| 1655 | ** file will not be interpreted as a control artifact in that other project. |
| 1656 | ** |
| 1657 | ** Normally it is sufficient to simply append the extra line of text. |
| 1658 | ** However, if the manifest is PGP signed then the extra line has to be |
| 1659 | ** inserted before the PGP signature (thus invalidating the signature). |
| 1660 | */ |
| 1661 | void sterilize_manifest(Blob *p){ |
| 1662 | char *z, *zOrig; |
| 1663 | int n, nOrig; |
| 1664 | static const char zExtraLine[] = |
| 1665 | "# Remove this line to create a well-formed manifest.\n"; |
| 1666 | |
| 1667 | z = zOrig = blob_materialize(p); |
| 1668 | n = nOrig = blob_size(p); |
| 1669 | remove_pgp_signature(&z, &n); |
| 1670 | if( z==zOrig ){ |
| 1671 | blob_append(p, zExtraLine, -1); |
| 1672 | }else{ |
| 1673 | int iEnd; |
| 1674 | Blob copy; |
| 1675 | memcpy(©, p, sizeof(copy)); |
| 1676 | blob_init(p, 0, 0); |
| 1677 | iEnd = (int)(&z[n] - zOrig); |
| 1678 | blob_append(p, zOrig, iEnd); |
| 1679 | blob_append(p, zExtraLine, -1); |
| 1680 | blob_append(p, &zOrig[iEnd], -1); |
| 1681 | blob_zero(©); |
| 1682 | } |
| 1683 | } |
| 1684 | |
| 1685 | /* |
| 1686 | ** This is the comparison function used to sort the tag array. |
| 1687 | */ |
| 1688 | static int tag_compare(const void *a, const void *b){ |
| 1689 |
+2
-1
| --- src/tar.c | ||
| +++ src/tar.c | ||
| @@ -492,12 +492,13 @@ | ||
| 492 | 492 | mTime = (pManifest->rDate - 2440587.5)*86400.0; |
| 493 | 493 | tar_begin(mTime); |
| 494 | 494 | if( db_get_boolean("manifest", 0) ){ |
| 495 | 495 | blob_append(&filename, "manifest", -1); |
| 496 | 496 | zName = blob_str(&filename); |
| 497 | - tar_add_file(zName, &mfile, 0, mTime); | |
| 498 | 497 | sha1sum_blob(&mfile, &hash); |
| 498 | + sterilize_manifest(&mfile); | |
| 499 | + tar_add_file(zName, &mfile, 0, mTime); | |
| 499 | 500 | blob_reset(&mfile); |
| 500 | 501 | blob_append(&hash, "\n", 1); |
| 501 | 502 | blob_resize(&filename, nPrefix); |
| 502 | 503 | blob_append(&filename, "manifest.uuid", -1); |
| 503 | 504 | zName = blob_str(&filename); |
| 504 | 505 |
| --- src/tar.c | |
| +++ src/tar.c | |
| @@ -492,12 +492,13 @@ | |
| 492 | mTime = (pManifest->rDate - 2440587.5)*86400.0; |
| 493 | tar_begin(mTime); |
| 494 | if( db_get_boolean("manifest", 0) ){ |
| 495 | blob_append(&filename, "manifest", -1); |
| 496 | zName = blob_str(&filename); |
| 497 | tar_add_file(zName, &mfile, 0, mTime); |
| 498 | sha1sum_blob(&mfile, &hash); |
| 499 | blob_reset(&mfile); |
| 500 | blob_append(&hash, "\n", 1); |
| 501 | blob_resize(&filename, nPrefix); |
| 502 | blob_append(&filename, "manifest.uuid", -1); |
| 503 | zName = blob_str(&filename); |
| 504 |
| --- src/tar.c | |
| +++ src/tar.c | |
| @@ -492,12 +492,13 @@ | |
| 492 | mTime = (pManifest->rDate - 2440587.5)*86400.0; |
| 493 | tar_begin(mTime); |
| 494 | if( db_get_boolean("manifest", 0) ){ |
| 495 | blob_append(&filename, "manifest", -1); |
| 496 | zName = blob_str(&filename); |
| 497 | sha1sum_blob(&mfile, &hash); |
| 498 | sterilize_manifest(&mfile); |
| 499 | tar_add_file(zName, &mfile, 0, mTime); |
| 500 | blob_reset(&mfile); |
| 501 | blob_append(&hash, "\n", 1); |
| 502 | blob_resize(&filename, nPrefix); |
| 503 | blob_append(&filename, "manifest.uuid", -1); |
| 504 | zName = blob_str(&filename); |
| 505 |
+2
-1
| --- src/zip.c | ||
| +++ src/zip.c | ||
| @@ -350,12 +350,13 @@ | ||
| 350 | 350 | zip_set_timedate(pManifest->rDate); |
| 351 | 351 | if( db_get_boolean("manifest", 0) ){ |
| 352 | 352 | blob_append(&filename, "manifest", -1); |
| 353 | 353 | zName = blob_str(&filename); |
| 354 | 354 | zip_add_folders(zName); |
| 355 | - zip_add_file(zName, &mfile, 0); | |
| 356 | 355 | sha1sum_blob(&mfile, &hash); |
| 356 | + sterilize_manifest(&mfile); | |
| 357 | + zip_add_file(zName, &mfile, 0); | |
| 357 | 358 | blob_reset(&mfile); |
| 358 | 359 | blob_append(&hash, "\n", 1); |
| 359 | 360 | blob_resize(&filename, nPrefix); |
| 360 | 361 | blob_append(&filename, "manifest.uuid", -1); |
| 361 | 362 | zName = blob_str(&filename); |
| 362 | 363 |
| --- src/zip.c | |
| +++ src/zip.c | |
| @@ -350,12 +350,13 @@ | |
| 350 | zip_set_timedate(pManifest->rDate); |
| 351 | if( db_get_boolean("manifest", 0) ){ |
| 352 | blob_append(&filename, "manifest", -1); |
| 353 | zName = blob_str(&filename); |
| 354 | zip_add_folders(zName); |
| 355 | zip_add_file(zName, &mfile, 0); |
| 356 | sha1sum_blob(&mfile, &hash); |
| 357 | blob_reset(&mfile); |
| 358 | blob_append(&hash, "\n", 1); |
| 359 | blob_resize(&filename, nPrefix); |
| 360 | blob_append(&filename, "manifest.uuid", -1); |
| 361 | zName = blob_str(&filename); |
| 362 |
| --- src/zip.c | |
| +++ src/zip.c | |
| @@ -350,12 +350,13 @@ | |
| 350 | zip_set_timedate(pManifest->rDate); |
| 351 | if( db_get_boolean("manifest", 0) ){ |
| 352 | blob_append(&filename, "manifest", -1); |
| 353 | zName = blob_str(&filename); |
| 354 | zip_add_folders(zName); |
| 355 | sha1sum_blob(&mfile, &hash); |
| 356 | sterilize_manifest(&mfile); |
| 357 | zip_add_file(zName, &mfile, 0); |
| 358 | blob_reset(&mfile); |
| 359 | blob_append(&hash, "\n", 1); |
| 360 | blob_resize(&filename, nPrefix); |
| 361 | blob_append(&filename, "manifest.uuid", -1); |
| 362 | zName = blob_str(&filename); |
| 363 |