Fossil SCM
Better defaults for new databases and clones. Use *CURRENT* to identify the current checkout for TTY timelines.
Commit
097479f99a066273a51e6c2444b2a4b7892d5026
Parent
92291035fe25189…
8 files changed
+5
-3
+1
-1
+27
-13
+1
-2
+1
-1
+1
-1
+16
-23
+3
-2
+5
-3
| --- src/clone.c | ||
| +++ src/clone.c | ||
| @@ -45,23 +45,25 @@ | ||
| 45 | 45 | fossil_panic("file already exists: %s", g.argv[3]); |
| 46 | 46 | } |
| 47 | 47 | url_parse(g.argv[2]); |
| 48 | 48 | db_create_repository(g.argv[3]); |
| 49 | 49 | db_open_repository(g.argv[3]); |
| 50 | + db_begin_transaction(); | |
| 51 | + db_initial_setup(0, 0); | |
| 50 | 52 | user_select(); |
| 51 | 53 | db_set("content-schema", CONTENT_SCHEMA); |
| 52 | 54 | db_set("aux-schema", AUX_SCHEMA); |
| 53 | 55 | if( !g.urlIsFile ){ |
| 54 | 56 | db_set("last-sync-url", g.argv[2]); |
| 55 | 57 | } |
| 56 | 58 | db_multi_exec( |
| 57 | - "INSERT INTO config(name,value) VALUES('server-code', hex(randomblob(20)));" | |
| 59 | + "INSERT INTO config(name,value)" | |
| 60 | + " VALUES('server-code', lower(hex(randomblob(20))));" | |
| 58 | 61 | ); |
| 59 | 62 | if( g.urlIsFile ){ |
| 60 | 63 | Stmt q; |
| 61 | 64 | db_multi_exec("ATTACH DATABASE %Q AS orig", g.urlName); |
| 62 | - db_begin_transaction(); | |
| 63 | 65 | db_prepare(&q, |
| 64 | 66 | "SELECT name FROM orig.sqlite_master" |
| 65 | 67 | " WHERE type='table'" |
| 66 | 68 | ); |
| 67 | 69 | while( db_step(&q)==SQLITE_ROW ){ |
| @@ -68,10 +70,10 @@ | ||
| 68 | 70 | const char *zTab = db_column_text(&q, 0); |
| 69 | 71 | db_multi_exec("INSERT OR IGNORE INTO %Q SELECT * FROM orig.%Q", |
| 70 | 72 | zTab, zTab); |
| 71 | 73 | } |
| 72 | 74 | db_finalize(&q); |
| 73 | - db_end_transaction(0); | |
| 74 | 75 | }else{ |
| 75 | 76 | client_sync(0,0,1); |
| 76 | 77 | } |
| 78 | + db_end_transaction(0); | |
| 77 | 79 | } |
| 78 | 80 |
| --- src/clone.c | |
| +++ src/clone.c | |
| @@ -45,23 +45,25 @@ | |
| 45 | fossil_panic("file already exists: %s", g.argv[3]); |
| 46 | } |
| 47 | url_parse(g.argv[2]); |
| 48 | db_create_repository(g.argv[3]); |
| 49 | db_open_repository(g.argv[3]); |
| 50 | user_select(); |
| 51 | db_set("content-schema", CONTENT_SCHEMA); |
| 52 | db_set("aux-schema", AUX_SCHEMA); |
| 53 | if( !g.urlIsFile ){ |
| 54 | db_set("last-sync-url", g.argv[2]); |
| 55 | } |
| 56 | db_multi_exec( |
| 57 | "INSERT INTO config(name,value) VALUES('server-code', hex(randomblob(20)));" |
| 58 | ); |
| 59 | if( g.urlIsFile ){ |
| 60 | Stmt q; |
| 61 | db_multi_exec("ATTACH DATABASE %Q AS orig", g.urlName); |
| 62 | db_begin_transaction(); |
| 63 | db_prepare(&q, |
| 64 | "SELECT name FROM orig.sqlite_master" |
| 65 | " WHERE type='table'" |
| 66 | ); |
| 67 | while( db_step(&q)==SQLITE_ROW ){ |
| @@ -68,10 +70,10 @@ | |
| 68 | const char *zTab = db_column_text(&q, 0); |
| 69 | db_multi_exec("INSERT OR IGNORE INTO %Q SELECT * FROM orig.%Q", |
| 70 | zTab, zTab); |
| 71 | } |
| 72 | db_finalize(&q); |
| 73 | db_end_transaction(0); |
| 74 | }else{ |
| 75 | client_sync(0,0,1); |
| 76 | } |
| 77 | } |
| 78 |
| --- src/clone.c | |
| +++ src/clone.c | |
| @@ -45,23 +45,25 @@ | |
| 45 | fossil_panic("file already exists: %s", g.argv[3]); |
| 46 | } |
| 47 | url_parse(g.argv[2]); |
| 48 | db_create_repository(g.argv[3]); |
| 49 | db_open_repository(g.argv[3]); |
| 50 | db_begin_transaction(); |
| 51 | db_initial_setup(0, 0); |
| 52 | user_select(); |
| 53 | db_set("content-schema", CONTENT_SCHEMA); |
| 54 | db_set("aux-schema", AUX_SCHEMA); |
| 55 | if( !g.urlIsFile ){ |
| 56 | db_set("last-sync-url", g.argv[2]); |
| 57 | } |
| 58 | db_multi_exec( |
| 59 | "INSERT INTO config(name,value)" |
| 60 | " VALUES('server-code', lower(hex(randomblob(20))));" |
| 61 | ); |
| 62 | if( g.urlIsFile ){ |
| 63 | Stmt q; |
| 64 | db_multi_exec("ATTACH DATABASE %Q AS orig", g.urlName); |
| 65 | db_prepare(&q, |
| 66 | "SELECT name FROM orig.sqlite_master" |
| 67 | " WHERE type='table'" |
| 68 | ); |
| 69 | while( db_step(&q)==SQLITE_ROW ){ |
| @@ -68,10 +70,10 @@ | |
| 70 | const char *zTab = db_column_text(&q, 0); |
| 71 | db_multi_exec("INSERT OR IGNORE INTO %Q SELECT * FROM orig.%Q", |
| 72 | zTab, zTab); |
| 73 | } |
| 74 | db_finalize(&q); |
| 75 | }else{ |
| 76 | client_sync(0,0,1); |
| 77 | } |
| 78 | db_end_transaction(0); |
| 79 | } |
| 80 |
+1
-1
| --- src/construct.c | ||
| +++ src/construct.c | ||
| @@ -140,11 +140,11 @@ | ||
| 140 | 140 | db_create_repository(zRepository); |
| 141 | 141 | db_open_repository(zRepository); |
| 142 | 142 | db_open_config(); |
| 143 | 143 | db_begin_transaction(); |
| 144 | 144 | |
| 145 | - db_initial_setup(0); | |
| 145 | + db_initial_setup(0, 1); | |
| 146 | 146 | |
| 147 | 147 | printf("project-id: %s\n", db_get("project-code", 0)); |
| 148 | 148 | printf("server-id: %s\n", db_get("server-code", 0)); |
| 149 | 149 | printf("admin-user: %s (no password set yet!)\n", g.zLogin); |
| 150 | 150 | printf("baseline: %s\n", db_text(0, "SELECT uuid FROM blob")); |
| 151 | 151 |
| --- src/construct.c | |
| +++ src/construct.c | |
| @@ -140,11 +140,11 @@ | |
| 140 | db_create_repository(zRepository); |
| 141 | db_open_repository(zRepository); |
| 142 | db_open_config(); |
| 143 | db_begin_transaction(); |
| 144 | |
| 145 | db_initial_setup(0); |
| 146 | |
| 147 | printf("project-id: %s\n", db_get("project-code", 0)); |
| 148 | printf("server-id: %s\n", db_get("server-code", 0)); |
| 149 | printf("admin-user: %s (no password set yet!)\n", g.zLogin); |
| 150 | printf("baseline: %s\n", db_text(0, "SELECT uuid FROM blob")); |
| 151 |
| --- src/construct.c | |
| +++ src/construct.c | |
| @@ -140,11 +140,11 @@ | |
| 140 | db_create_repository(zRepository); |
| 141 | db_open_repository(zRepository); |
| 142 | db_open_config(); |
| 143 | db_begin_transaction(); |
| 144 | |
| 145 | db_initial_setup(0, 1); |
| 146 | |
| 147 | printf("project-id: %s\n", db_get("project-code", 0)); |
| 148 | printf("server-id: %s\n", db_get("server-code", 0)); |
| 149 | printf("admin-user: %s (no password set yet!)\n", g.zLogin); |
| 150 | printf("baseline: %s\n", db_text(0, "SELECT uuid FROM blob")); |
| 151 |
M
src/db.c
+27
-13
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -673,27 +673,32 @@ | ||
| 673 | 673 | ** Fill an empty repository database with the basic information for a |
| 674 | 674 | ** repository. This function is shared between 'create_repository_cmd' |
| 675 | 675 | ** ('new') and 'reconstruct_cmd' ('reconstruct'), both of which create |
| 676 | 676 | ** new repositories. |
| 677 | 677 | ** |
| 678 | -** The caller determines wheter the function inserts an empty root | |
| 679 | -** manifest (zRoot == TRUE), or not (zRoot == FALSE). | |
| 678 | +** The makeInitialVersion flag determines whether or not an initial | |
| 679 | +** manifest is created. The makeServerCodes flag determines whether or | |
| 680 | +** not server and project codes are invented for this repository. | |
| 680 | 681 | */ |
| 681 | - | |
| 682 | -void db_initial_setup (int zRoot){ | |
| 682 | +void db_initial_setup (int makeInitialVersion, int makeServerCodes){ | |
| 683 | 683 | char *zDate; |
| 684 | 684 | char *zUser; |
| 685 | 685 | Blob hash; |
| 686 | 686 | Blob manifest; |
| 687 | 687 | |
| 688 | 688 | db_set("content-schema", CONTENT_SCHEMA); |
| 689 | 689 | db_set("aux-schema", AUX_SCHEMA); |
| 690 | - db_set_int("authenticate-localhost", 0); | |
| 691 | - db_multi_exec( | |
| 692 | - "INSERT INTO config(name,value) VALUES('server-code', hex(randomblob(20)));" | |
| 693 | - "INSERT INTO config(name,value) VALUES('project-code',hex(randomblob(20)));" | |
| 694 | - ); | |
| 690 | + if( makeServerCodes ){ | |
| 691 | + db_multi_exec( | |
| 692 | + "INSERT INTO config(name,value)" | |
| 693 | + " VALUES('server-code', lower(hex(randomblob(20))));" | |
| 694 | + "INSERT INTO config(name,value)" | |
| 695 | + " VALUES('project-code', lower(hex(randomblob(20))));" | |
| 696 | + ); | |
| 697 | + } | |
| 698 | + db_set_int("autosync", 1); | |
| 699 | + db_set_int("localauth", 0); | |
| 695 | 700 | zUser = db_global_get("default-user", 0); |
| 696 | 701 | if( zUser==0 ){ |
| 697 | 702 | zUser = getenv("USER"); |
| 698 | 703 | } |
| 699 | 704 | if( zUser==0 ){ |
| @@ -709,11 +714,11 @@ | ||
| 709 | 714 | "INSERT INTO user(login,pw,cap,info)" |
| 710 | 715 | " VALUES('nobody','','jor','Nobody');" |
| 711 | 716 | ); |
| 712 | 717 | user_select(); |
| 713 | 718 | |
| 714 | - if (zRoot){ | |
| 719 | + if (makeInitialVersion){ | |
| 715 | 720 | blob_zero(&manifest); |
| 716 | 721 | blob_appendf(&manifest, "C initial\\sempty\\sbaseline\n"); |
| 717 | 722 | zDate = db_text(0, "SELECT datetime('now')"); |
| 718 | 723 | zDate[10]='T'; |
| 719 | 724 | blob_appendf(&manifest, "D %s\n", zDate); |
| @@ -742,11 +747,11 @@ | ||
| 742 | 747 | } |
| 743 | 748 | db_create_repository(g.argv[2]); |
| 744 | 749 | db_open_repository(g.argv[2]); |
| 745 | 750 | db_open_config(); |
| 746 | 751 | db_begin_transaction(); |
| 747 | - db_initial_setup (1); | |
| 752 | + db_initial_setup(1, 1); | |
| 748 | 753 | db_end_transaction(0); |
| 749 | 754 | printf("project-id: %s\n", db_get("project-code", 0)); |
| 750 | 755 | printf("server-id: %s\n", db_get("server-code", 0)); |
| 751 | 756 | printf("admin-user: %s (no password set yet!)\n", g.zLogin); |
| 752 | 757 | printf("baseline: %s\n", db_text(0, "SELECT uuid FROM blob")); |
| @@ -963,16 +968,25 @@ | ||
| 963 | 968 | ** COMMAND: setting |
| 964 | 969 | ** %fossil setting ?PROPERTY? ?VALUE? |
| 965 | 970 | ** |
| 966 | 971 | ** With no arguments, list all properties and their values. With just |
| 967 | 972 | ** a property name, show the value of that property. With a value |
| 968 | -** arugment, change the property for the current repository. | |
| 973 | +** argument, change the property for the current repository. | |
| 974 | +** | |
| 975 | +** autosync If enabled, automatically pull prior to | |
| 976 | +** commit or update and automatically push | |
| 977 | +** after commit or tag or branch creation. | |
| 978 | +** | |
| 979 | +** localauth If true, require that HTTP connections from | |
| 980 | +** 127.0.0.1 be authenticated by password. If | |
| 981 | +** false, all HTTP requests from localhost have | |
| 982 | +** unrestricted access to the repository. | |
| 969 | 983 | */ |
| 970 | 984 | void setting_cmd(void){ |
| 971 | 985 | static const char *azName[] = { |
| 972 | 986 | "autosync", |
| 973 | - "safemerge" | |
| 987 | + "localauth" | |
| 974 | 988 | }; |
| 975 | 989 | int i; |
| 976 | 990 | db_find_and_open_repository(); |
| 977 | 991 | if( g.argc==2 ){ |
| 978 | 992 | for(i=0; i<sizeof(azName)/sizeof(azName[0]); i++){ |
| 979 | 993 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -673,27 +673,32 @@ | |
| 673 | ** Fill an empty repository database with the basic information for a |
| 674 | ** repository. This function is shared between 'create_repository_cmd' |
| 675 | ** ('new') and 'reconstruct_cmd' ('reconstruct'), both of which create |
| 676 | ** new repositories. |
| 677 | ** |
| 678 | ** The caller determines wheter the function inserts an empty root |
| 679 | ** manifest (zRoot == TRUE), or not (zRoot == FALSE). |
| 680 | */ |
| 681 | |
| 682 | void db_initial_setup (int zRoot){ |
| 683 | char *zDate; |
| 684 | char *zUser; |
| 685 | Blob hash; |
| 686 | Blob manifest; |
| 687 | |
| 688 | db_set("content-schema", CONTENT_SCHEMA); |
| 689 | db_set("aux-schema", AUX_SCHEMA); |
| 690 | db_set_int("authenticate-localhost", 0); |
| 691 | db_multi_exec( |
| 692 | "INSERT INTO config(name,value) VALUES('server-code', hex(randomblob(20)));" |
| 693 | "INSERT INTO config(name,value) VALUES('project-code',hex(randomblob(20)));" |
| 694 | ); |
| 695 | zUser = db_global_get("default-user", 0); |
| 696 | if( zUser==0 ){ |
| 697 | zUser = getenv("USER"); |
| 698 | } |
| 699 | if( zUser==0 ){ |
| @@ -709,11 +714,11 @@ | |
| 709 | "INSERT INTO user(login,pw,cap,info)" |
| 710 | " VALUES('nobody','','jor','Nobody');" |
| 711 | ); |
| 712 | user_select(); |
| 713 | |
| 714 | if (zRoot){ |
| 715 | blob_zero(&manifest); |
| 716 | blob_appendf(&manifest, "C initial\\sempty\\sbaseline\n"); |
| 717 | zDate = db_text(0, "SELECT datetime('now')"); |
| 718 | zDate[10]='T'; |
| 719 | blob_appendf(&manifest, "D %s\n", zDate); |
| @@ -742,11 +747,11 @@ | |
| 742 | } |
| 743 | db_create_repository(g.argv[2]); |
| 744 | db_open_repository(g.argv[2]); |
| 745 | db_open_config(); |
| 746 | db_begin_transaction(); |
| 747 | db_initial_setup (1); |
| 748 | db_end_transaction(0); |
| 749 | printf("project-id: %s\n", db_get("project-code", 0)); |
| 750 | printf("server-id: %s\n", db_get("server-code", 0)); |
| 751 | printf("admin-user: %s (no password set yet!)\n", g.zLogin); |
| 752 | printf("baseline: %s\n", db_text(0, "SELECT uuid FROM blob")); |
| @@ -963,16 +968,25 @@ | |
| 963 | ** COMMAND: setting |
| 964 | ** %fossil setting ?PROPERTY? ?VALUE? |
| 965 | ** |
| 966 | ** With no arguments, list all properties and their values. With just |
| 967 | ** a property name, show the value of that property. With a value |
| 968 | ** arugment, change the property for the current repository. |
| 969 | */ |
| 970 | void setting_cmd(void){ |
| 971 | static const char *azName[] = { |
| 972 | "autosync", |
| 973 | "safemerge" |
| 974 | }; |
| 975 | int i; |
| 976 | db_find_and_open_repository(); |
| 977 | if( g.argc==2 ){ |
| 978 | for(i=0; i<sizeof(azName)/sizeof(azName[0]); i++){ |
| 979 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -673,27 +673,32 @@ | |
| 673 | ** Fill an empty repository database with the basic information for a |
| 674 | ** repository. This function is shared between 'create_repository_cmd' |
| 675 | ** ('new') and 'reconstruct_cmd' ('reconstruct'), both of which create |
| 676 | ** new repositories. |
| 677 | ** |
| 678 | ** The makeInitialVersion flag determines whether or not an initial |
| 679 | ** manifest is created. The makeServerCodes flag determines whether or |
| 680 | ** not server and project codes are invented for this repository. |
| 681 | */ |
| 682 | void db_initial_setup (int makeInitialVersion, int makeServerCodes){ |
| 683 | char *zDate; |
| 684 | char *zUser; |
| 685 | Blob hash; |
| 686 | Blob manifest; |
| 687 | |
| 688 | db_set("content-schema", CONTENT_SCHEMA); |
| 689 | db_set("aux-schema", AUX_SCHEMA); |
| 690 | if( makeServerCodes ){ |
| 691 | db_multi_exec( |
| 692 | "INSERT INTO config(name,value)" |
| 693 | " VALUES('server-code', lower(hex(randomblob(20))));" |
| 694 | "INSERT INTO config(name,value)" |
| 695 | " VALUES('project-code', lower(hex(randomblob(20))));" |
| 696 | ); |
| 697 | } |
| 698 | db_set_int("autosync", 1); |
| 699 | db_set_int("localauth", 0); |
| 700 | zUser = db_global_get("default-user", 0); |
| 701 | if( zUser==0 ){ |
| 702 | zUser = getenv("USER"); |
| 703 | } |
| 704 | if( zUser==0 ){ |
| @@ -709,11 +714,11 @@ | |
| 714 | "INSERT INTO user(login,pw,cap,info)" |
| 715 | " VALUES('nobody','','jor','Nobody');" |
| 716 | ); |
| 717 | user_select(); |
| 718 | |
| 719 | if (makeInitialVersion){ |
| 720 | blob_zero(&manifest); |
| 721 | blob_appendf(&manifest, "C initial\\sempty\\sbaseline\n"); |
| 722 | zDate = db_text(0, "SELECT datetime('now')"); |
| 723 | zDate[10]='T'; |
| 724 | blob_appendf(&manifest, "D %s\n", zDate); |
| @@ -742,11 +747,11 @@ | |
| 747 | } |
| 748 | db_create_repository(g.argv[2]); |
| 749 | db_open_repository(g.argv[2]); |
| 750 | db_open_config(); |
| 751 | db_begin_transaction(); |
| 752 | db_initial_setup(1, 1); |
| 753 | db_end_transaction(0); |
| 754 | printf("project-id: %s\n", db_get("project-code", 0)); |
| 755 | printf("server-id: %s\n", db_get("server-code", 0)); |
| 756 | printf("admin-user: %s (no password set yet!)\n", g.zLogin); |
| 757 | printf("baseline: %s\n", db_text(0, "SELECT uuid FROM blob")); |
| @@ -963,16 +968,25 @@ | |
| 968 | ** COMMAND: setting |
| 969 | ** %fossil setting ?PROPERTY? ?VALUE? |
| 970 | ** |
| 971 | ** With no arguments, list all properties and their values. With just |
| 972 | ** a property name, show the value of that property. With a value |
| 973 | ** argument, change the property for the current repository. |
| 974 | ** |
| 975 | ** autosync If enabled, automatically pull prior to |
| 976 | ** commit or update and automatically push |
| 977 | ** after commit or tag or branch creation. |
| 978 | ** |
| 979 | ** localauth If true, require that HTTP connections from |
| 980 | ** 127.0.0.1 be authenticated by password. If |
| 981 | ** false, all HTTP requests from localhost have |
| 982 | ** unrestricted access to the repository. |
| 983 | */ |
| 984 | void setting_cmd(void){ |
| 985 | static const char *azName[] = { |
| 986 | "autosync", |
| 987 | "localauth" |
| 988 | }; |
| 989 | int i; |
| 990 | db_find_and_open_repository(); |
| 991 | if( g.argc==2 ){ |
| 992 | for(i=0; i<sizeof(azName)/sizeof(azName[0]); i++){ |
| 993 |
+1
-2
| --- src/login.c | ||
| +++ src/login.c | ||
| @@ -228,12 +228,11 @@ | ||
| 228 | 228 | /* If the HTTP connection is coming over 127.0.0.1 and if |
| 229 | 229 | ** local login is disabled, then there is no need to check |
| 230 | 230 | ** user credentials. |
| 231 | 231 | */ |
| 232 | 232 | zRemoteAddr = PD("REMOTE_ADDR","nil"); |
| 233 | - if( strcmp(zRemoteAddr, "127.0.0.1")==0 | |
| 234 | - && db_get_int("authenticate-localhost",1)==0 ){ | |
| 233 | + if( strcmp(zRemoteAddr, "127.0.0.1")==0 && db_get_int("localauth",0)==0 ){ | |
| 235 | 234 | uid = db_int(0, "SELECT uid FROM user WHERE cap LIKE '%%s%%'"); |
| 236 | 235 | g.zLogin = db_text("?", "SELECT login FROM user WHERE uid=%d", uid); |
| 237 | 236 | zCap = "s"; |
| 238 | 237 | g.noPswd = 1; |
| 239 | 238 | } |
| 240 | 239 |
| --- src/login.c | |
| +++ src/login.c | |
| @@ -228,12 +228,11 @@ | |
| 228 | /* If the HTTP connection is coming over 127.0.0.1 and if |
| 229 | ** local login is disabled, then there is no need to check |
| 230 | ** user credentials. |
| 231 | */ |
| 232 | zRemoteAddr = PD("REMOTE_ADDR","nil"); |
| 233 | if( strcmp(zRemoteAddr, "127.0.0.1")==0 |
| 234 | && db_get_int("authenticate-localhost",1)==0 ){ |
| 235 | uid = db_int(0, "SELECT uid FROM user WHERE cap LIKE '%%s%%'"); |
| 236 | g.zLogin = db_text("?", "SELECT login FROM user WHERE uid=%d", uid); |
| 237 | zCap = "s"; |
| 238 | g.noPswd = 1; |
| 239 | } |
| 240 |
| --- src/login.c | |
| +++ src/login.c | |
| @@ -228,12 +228,11 @@ | |
| 228 | /* If the HTTP connection is coming over 127.0.0.1 and if |
| 229 | ** local login is disabled, then there is no need to check |
| 230 | ** user credentials. |
| 231 | */ |
| 232 | zRemoteAddr = PD("REMOTE_ADDR","nil"); |
| 233 | if( strcmp(zRemoteAddr, "127.0.0.1")==0 && db_get_int("localauth",0)==0 ){ |
| 234 | uid = db_int(0, "SELECT uid FROM user WHERE cap LIKE '%%s%%'"); |
| 235 | g.zLogin = db_text("?", "SELECT login FROM user WHERE uid=%d", uid); |
| 236 | zCap = "s"; |
| 237 | g.noPswd = 1; |
| 238 | } |
| 239 |
+1
-1
| --- src/setup.c | ||
| +++ src/setup.c | ||
| @@ -497,11 +497,11 @@ | ||
| 497 | 497 | db_begin_transaction(); |
| 498 | 498 | @ <form action="%s(g.zBaseURL)/setup_access" method="POST"> |
| 499 | 499 | |
| 500 | 500 | @ <hr> |
| 501 | 501 | onoff_attribute("Require password for local access", |
| 502 | - "authenticate-localhost", "localauth", 1); | |
| 502 | + "localauth", "localauth", 1); | |
| 503 | 503 | @ <p>When enabled, the password sign-in is required for |
| 504 | 504 | @ web access coming from 127.0.0.1. When disabled, web access |
| 505 | 505 | @ from 127.0.0.1 is allows without any login - the user id is selected |
| 506 | 506 | @ from the ~/.fossil database. Password login is always required |
| 507 | 507 | @ for incoming web connections on internet addresses other than |
| 508 | 508 |
| --- src/setup.c | |
| +++ src/setup.c | |
| @@ -497,11 +497,11 @@ | |
| 497 | db_begin_transaction(); |
| 498 | @ <form action="%s(g.zBaseURL)/setup_access" method="POST"> |
| 499 | |
| 500 | @ <hr> |
| 501 | onoff_attribute("Require password for local access", |
| 502 | "authenticate-localhost", "localauth", 1); |
| 503 | @ <p>When enabled, the password sign-in is required for |
| 504 | @ web access coming from 127.0.0.1. When disabled, web access |
| 505 | @ from 127.0.0.1 is allows without any login - the user id is selected |
| 506 | @ from the ~/.fossil database. Password login is always required |
| 507 | @ for incoming web connections on internet addresses other than |
| 508 |
| --- src/setup.c | |
| +++ src/setup.c | |
| @@ -497,11 +497,11 @@ | |
| 497 | db_begin_transaction(); |
| 498 | @ <form action="%s(g.zBaseURL)/setup_access" method="POST"> |
| 499 | |
| 500 | @ <hr> |
| 501 | onoff_attribute("Require password for local access", |
| 502 | "localauth", "localauth", 1); |
| 503 | @ <p>When enabled, the password sign-in is required for |
| 504 | @ web access coming from 127.0.0.1. When disabled, web access |
| 505 | @ from 127.0.0.1 is allows without any login - the user id is selected |
| 506 | @ from the ~/.fossil database. Password login is always required |
| 507 | @ for incoming web connections on internet addresses other than |
| 508 |
+1
-1
| --- src/sync.c | ||
| +++ src/sync.c | ||
| @@ -37,11 +37,11 @@ | ||
| 37 | 37 | const char *zUrl; |
| 38 | 38 | if( db_get_int("autosync", 0)==0 ){ |
| 39 | 39 | return 0; |
| 40 | 40 | } |
| 41 | 41 | zUrl = db_get("last-sync-url", 0); |
| 42 | - if( zUrl ){ | |
| 42 | + if( zUrl==0 ){ | |
| 43 | 43 | return 0; /* No default server */ |
| 44 | 44 | } |
| 45 | 45 | url_parse(zUrl); |
| 46 | 46 | if( g.urlIsFile ){ |
| 47 | 47 | return 0; /* Network sync only */ |
| 48 | 48 |
| --- src/sync.c | |
| +++ src/sync.c | |
| @@ -37,11 +37,11 @@ | |
| 37 | const char *zUrl; |
| 38 | if( db_get_int("autosync", 0)==0 ){ |
| 39 | return 0; |
| 40 | } |
| 41 | zUrl = db_get("last-sync-url", 0); |
| 42 | if( zUrl ){ |
| 43 | return 0; /* No default server */ |
| 44 | } |
| 45 | url_parse(zUrl); |
| 46 | if( g.urlIsFile ){ |
| 47 | return 0; /* Network sync only */ |
| 48 |
| --- src/sync.c | |
| +++ src/sync.c | |
| @@ -37,11 +37,11 @@ | |
| 37 | const char *zUrl; |
| 38 | if( db_get_int("autosync", 0)==0 ){ |
| 39 | return 0; |
| 40 | } |
| 41 | zUrl = db_get("last-sync-url", 0); |
| 42 | if( zUrl==0 ){ |
| 43 | return 0; /* No default server */ |
| 44 | } |
| 45 | url_parse(zUrl); |
| 46 | if( g.urlIsFile ){ |
| 47 | return 0; /* Network sync only */ |
| 48 |
+16
-23
| --- src/timeline.c | ||
| +++ src/timeline.c | ||
| @@ -395,11 +395,10 @@ | ||
| 395 | 395 | ** 5. Number of parents |
| 396 | 396 | */ |
| 397 | 397 | void print_timeline(Stmt *q, int mxLine){ |
| 398 | 398 | int nLine = 0; |
| 399 | 399 | char zPrevDate[20]; |
| 400 | - char *delims; | |
| 401 | 400 | const char *zCurrentUuid=0; |
| 402 | 401 | Stmt currentQ; |
| 403 | 402 | int rid = db_lget_int("checkout", 0); |
| 404 | 403 | zPrevDate[0] = 0; |
| 405 | 404 | |
| @@ -416,42 +415,36 @@ | ||
| 416 | 415 | const char *zDate = db_column_text(q, 2); |
| 417 | 416 | const char *zCom = db_column_text(q, 3); |
| 418 | 417 | int nChild = db_column_int(q, 4); |
| 419 | 418 | int nParent = db_column_int(q, 5); |
| 420 | 419 | char *zFree = 0; |
| 420 | + int n = 0; | |
| 421 | + char zPrefix[80]; | |
| 421 | 422 | char zUuid[UUID_SIZE+1]; |
| 422 | 423 | |
| 423 | - if( strcmp(zCurrentUuid, zId)==0 ){ | |
| 424 | - delims = "<>"; | |
| 425 | - }else{ | |
| 426 | - delims = "[]"; | |
| 427 | - } | |
| 428 | - | |
| 429 | 424 | sprintf(zUuid, "%.10s", zId); |
| 430 | 425 | if( memcmp(zDate, zPrevDate, 10) ){ |
| 431 | 426 | printf("=== %.10s ===\n", zDate); |
| 432 | 427 | memcpy(zPrevDate, zDate, 10); |
| 433 | 428 | nLine++; |
| 434 | 429 | } |
| 435 | 430 | if( zCom==0 ) zCom = ""; |
| 436 | 431 | printf("%.8s ", &zDate[11]); |
| 437 | - if( nChild>1 || nParent>1 ){ | |
| 438 | - int n = 0; | |
| 439 | - char zPrefix[50]; | |
| 440 | - if( nParent>1 ){ | |
| 441 | - sqlite3_snprintf(sizeof(zPrefix), zPrefix, "*MERGE* "); | |
| 442 | - n = strlen(zPrefix); | |
| 443 | - } | |
| 444 | - if( nChild>1 ){ | |
| 445 | - sqlite3_snprintf(sizeof(zPrefix)-n, &zPrefix[n], "*FORK* "); | |
| 446 | - n = strlen(zPrefix); | |
| 447 | - } | |
| 448 | - zFree = sqlite3_mprintf("%c%.10s%c %s%s", delims[0], zUuid, delims[1], | |
| 449 | - zPrefix, zCom); | |
| 450 | - }else{ | |
| 451 | - zFree = sqlite3_mprintf("%c%.10s%c %s", delims[0], zUuid, delims[1], zCom); | |
| 452 | - } | |
| 432 | + zPrefix[0] = 0; | |
| 433 | + if( nParent>1 ){ | |
| 434 | + sqlite3_snprintf(sizeof(zPrefix), zPrefix, "*MERGE* "); | |
| 435 | + n = strlen(zPrefix); | |
| 436 | + } | |
| 437 | + if( nChild>1 ){ | |
| 438 | + sqlite3_snprintf(sizeof(zPrefix)-n, &zPrefix[n], "*FORK* "); | |
| 439 | + n = strlen(zPrefix); | |
| 440 | + } | |
| 441 | + if( strcmp(zCurrentUuid,zId)==0 ){ | |
| 442 | + sqlite3_snprintf(sizeof(zPrefix)-n, &zPrefix[n], "*CURRENT* "); | |
| 443 | + n += strlen(zPrefix); | |
| 444 | + } | |
| 445 | + zFree = sqlite3_mprintf("[%.10s] %s%s", zUuid, zPrefix, zCom); | |
| 453 | 446 | nLine += comment_print(zFree, 9, 79); |
| 454 | 447 | sqlite3_free(zFree); |
| 455 | 448 | } |
| 456 | 449 | db_finalize(¤tQ); |
| 457 | 450 | } |
| 458 | 451 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -395,11 +395,10 @@ | |
| 395 | ** 5. Number of parents |
| 396 | */ |
| 397 | void print_timeline(Stmt *q, int mxLine){ |
| 398 | int nLine = 0; |
| 399 | char zPrevDate[20]; |
| 400 | char *delims; |
| 401 | const char *zCurrentUuid=0; |
| 402 | Stmt currentQ; |
| 403 | int rid = db_lget_int("checkout", 0); |
| 404 | zPrevDate[0] = 0; |
| 405 | |
| @@ -416,42 +415,36 @@ | |
| 416 | const char *zDate = db_column_text(q, 2); |
| 417 | const char *zCom = db_column_text(q, 3); |
| 418 | int nChild = db_column_int(q, 4); |
| 419 | int nParent = db_column_int(q, 5); |
| 420 | char *zFree = 0; |
| 421 | char zUuid[UUID_SIZE+1]; |
| 422 | |
| 423 | if( strcmp(zCurrentUuid, zId)==0 ){ |
| 424 | delims = "<>"; |
| 425 | }else{ |
| 426 | delims = "[]"; |
| 427 | } |
| 428 | |
| 429 | sprintf(zUuid, "%.10s", zId); |
| 430 | if( memcmp(zDate, zPrevDate, 10) ){ |
| 431 | printf("=== %.10s ===\n", zDate); |
| 432 | memcpy(zPrevDate, zDate, 10); |
| 433 | nLine++; |
| 434 | } |
| 435 | if( zCom==0 ) zCom = ""; |
| 436 | printf("%.8s ", &zDate[11]); |
| 437 | if( nChild>1 || nParent>1 ){ |
| 438 | int n = 0; |
| 439 | char zPrefix[50]; |
| 440 | if( nParent>1 ){ |
| 441 | sqlite3_snprintf(sizeof(zPrefix), zPrefix, "*MERGE* "); |
| 442 | n = strlen(zPrefix); |
| 443 | } |
| 444 | if( nChild>1 ){ |
| 445 | sqlite3_snprintf(sizeof(zPrefix)-n, &zPrefix[n], "*FORK* "); |
| 446 | n = strlen(zPrefix); |
| 447 | } |
| 448 | zFree = sqlite3_mprintf("%c%.10s%c %s%s", delims[0], zUuid, delims[1], |
| 449 | zPrefix, zCom); |
| 450 | }else{ |
| 451 | zFree = sqlite3_mprintf("%c%.10s%c %s", delims[0], zUuid, delims[1], zCom); |
| 452 | } |
| 453 | nLine += comment_print(zFree, 9, 79); |
| 454 | sqlite3_free(zFree); |
| 455 | } |
| 456 | db_finalize(¤tQ); |
| 457 | } |
| 458 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -395,11 +395,10 @@ | |
| 395 | ** 5. Number of parents |
| 396 | */ |
| 397 | void print_timeline(Stmt *q, int mxLine){ |
| 398 | int nLine = 0; |
| 399 | char zPrevDate[20]; |
| 400 | const char *zCurrentUuid=0; |
| 401 | Stmt currentQ; |
| 402 | int rid = db_lget_int("checkout", 0); |
| 403 | zPrevDate[0] = 0; |
| 404 | |
| @@ -416,42 +415,36 @@ | |
| 415 | const char *zDate = db_column_text(q, 2); |
| 416 | const char *zCom = db_column_text(q, 3); |
| 417 | int nChild = db_column_int(q, 4); |
| 418 | int nParent = db_column_int(q, 5); |
| 419 | char *zFree = 0; |
| 420 | int n = 0; |
| 421 | char zPrefix[80]; |
| 422 | char zUuid[UUID_SIZE+1]; |
| 423 | |
| 424 | sprintf(zUuid, "%.10s", zId); |
| 425 | if( memcmp(zDate, zPrevDate, 10) ){ |
| 426 | printf("=== %.10s ===\n", zDate); |
| 427 | memcpy(zPrevDate, zDate, 10); |
| 428 | nLine++; |
| 429 | } |
| 430 | if( zCom==0 ) zCom = ""; |
| 431 | printf("%.8s ", &zDate[11]); |
| 432 | zPrefix[0] = 0; |
| 433 | if( nParent>1 ){ |
| 434 | sqlite3_snprintf(sizeof(zPrefix), zPrefix, "*MERGE* "); |
| 435 | n = strlen(zPrefix); |
| 436 | } |
| 437 | if( nChild>1 ){ |
| 438 | sqlite3_snprintf(sizeof(zPrefix)-n, &zPrefix[n], "*FORK* "); |
| 439 | n = strlen(zPrefix); |
| 440 | } |
| 441 | if( strcmp(zCurrentUuid,zId)==0 ){ |
| 442 | sqlite3_snprintf(sizeof(zPrefix)-n, &zPrefix[n], "*CURRENT* "); |
| 443 | n += strlen(zPrefix); |
| 444 | } |
| 445 | zFree = sqlite3_mprintf("[%.10s] %s%s", zUuid, zPrefix, zCom); |
| 446 | nLine += comment_print(zFree, 9, 79); |
| 447 | sqlite3_free(zFree); |
| 448 | } |
| 449 | db_finalize(¤tQ); |
| 450 | } |
| 451 |
+3
-2
| --- src/user.c | ||
| +++ src/user.c | ||
| @@ -292,11 +292,12 @@ | ||
| 292 | 292 | |
| 293 | 293 | if( attempt_user(db_get("default-user", 0)) ) return; |
| 294 | 294 | |
| 295 | 295 | if( attempt_user(getenv("USER")) ) return; |
| 296 | 296 | |
| 297 | - db_prepare(&s, "SELECT uid, login FROM user WHERE login<>'anonymous'"); | |
| 297 | + db_prepare(&s, "SELECT uid, login FROM user" | |
| 298 | + " WHERE login NOT IN ('anonymous','nobody')"); | |
| 298 | 299 | if( db_step(&s)==SQLITE_ROW ){ |
| 299 | 300 | g.userUid = db_column_int(&s, 0); |
| 300 | 301 | g.zLogin = mprintf("%s", db_column_text(&s, 1)); |
| 301 | 302 | } |
| 302 | 303 | db_finalize(&s); |
| @@ -311,11 +312,11 @@ | ||
| 311 | 312 | } |
| 312 | 313 | |
| 313 | 314 | if( g.userUid==0 ){ |
| 314 | 315 | db_multi_exec( |
| 315 | 316 | "INSERT INTO user(login, pw, cap, info)" |
| 316 | - "VALUES('anonymous', '', '', '')" | |
| 317 | + "VALUES('anonymous', '', 'cfghjkmnoqw', '')" | |
| 317 | 318 | ); |
| 318 | 319 | g.userUid = db_last_insert_rowid(); |
| 319 | 320 | g.zLogin = "anonymous"; |
| 320 | 321 | } |
| 321 | 322 | } |
| 322 | 323 |
| --- src/user.c | |
| +++ src/user.c | |
| @@ -292,11 +292,12 @@ | |
| 292 | |
| 293 | if( attempt_user(db_get("default-user", 0)) ) return; |
| 294 | |
| 295 | if( attempt_user(getenv("USER")) ) return; |
| 296 | |
| 297 | db_prepare(&s, "SELECT uid, login FROM user WHERE login<>'anonymous'"); |
| 298 | if( db_step(&s)==SQLITE_ROW ){ |
| 299 | g.userUid = db_column_int(&s, 0); |
| 300 | g.zLogin = mprintf("%s", db_column_text(&s, 1)); |
| 301 | } |
| 302 | db_finalize(&s); |
| @@ -311,11 +312,11 @@ | |
| 311 | } |
| 312 | |
| 313 | if( g.userUid==0 ){ |
| 314 | db_multi_exec( |
| 315 | "INSERT INTO user(login, pw, cap, info)" |
| 316 | "VALUES('anonymous', '', '', '')" |
| 317 | ); |
| 318 | g.userUid = db_last_insert_rowid(); |
| 319 | g.zLogin = "anonymous"; |
| 320 | } |
| 321 | } |
| 322 |
| --- src/user.c | |
| +++ src/user.c | |
| @@ -292,11 +292,12 @@ | |
| 292 | |
| 293 | if( attempt_user(db_get("default-user", 0)) ) return; |
| 294 | |
| 295 | if( attempt_user(getenv("USER")) ) return; |
| 296 | |
| 297 | db_prepare(&s, "SELECT uid, login FROM user" |
| 298 | " WHERE login NOT IN ('anonymous','nobody')"); |
| 299 | if( db_step(&s)==SQLITE_ROW ){ |
| 300 | g.userUid = db_column_int(&s, 0); |
| 301 | g.zLogin = mprintf("%s", db_column_text(&s, 1)); |
| 302 | } |
| 303 | db_finalize(&s); |
| @@ -311,11 +312,11 @@ | |
| 312 | } |
| 313 | |
| 314 | if( g.userUid==0 ){ |
| 315 | db_multi_exec( |
| 316 | "INSERT INTO user(login, pw, cap, info)" |
| 317 | "VALUES('anonymous', '', 'cfghjkmnoqw', '')" |
| 318 | ); |
| 319 | g.userUid = db_last_insert_rowid(); |
| 320 | g.zLogin = "anonymous"; |
| 321 | } |
| 322 | } |
| 323 |