Fossil SCM
Pull the latest trunk changes over into the windows-i18n branch.
Commit
bbba16084079b0aec8fae638dd1b92de28f6677c
Parent
4373976553e95bc…
8 files changed
+4
-1
+4
-1
+19
-11
+3
-2
+3
-2
+11
+1
-1
+1
-1
M
src/db.c
+4
-1
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -685,16 +685,19 @@ | ||
| 685 | 685 | #if defined(_WIN32) |
| 686 | 686 | zHome = getenv("LOCALAPPDATA"); |
| 687 | 687 | if( zHome==0 ){ |
| 688 | 688 | zHome = getenv("APPDATA"); |
| 689 | 689 | if( zHome==0 ){ |
| 690 | + char *zDrive = getenv("HOMEDRIVE"); | |
| 690 | 691 | zHome = getenv("HOMEPATH"); |
| 692 | + if( zDrive && zHome ) zHome = mprintf("%s%s", zDrive, zHome); | |
| 691 | 693 | } |
| 692 | 694 | } |
| 693 | 695 | if( zHome==0 ){ |
| 694 | 696 | fossil_fatal("cannot locate home directory - " |
| 695 | - "please set the HOMEPATH environment variable"); | |
| 697 | + "please set the LOCALAPPDATA or APPDATA or HOMEPATH " | |
| 698 | + "environment variables"); | |
| 696 | 699 | } |
| 697 | 700 | zHome = fossil_mbcs_to_utf8(zHome); |
| 698 | 701 | #else |
| 699 | 702 | zHome = getenv("HOME"); |
| 700 | 703 | if( zHome==0 ){ |
| 701 | 704 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -685,16 +685,19 @@ | |
| 685 | #if defined(_WIN32) |
| 686 | zHome = getenv("LOCALAPPDATA"); |
| 687 | if( zHome==0 ){ |
| 688 | zHome = getenv("APPDATA"); |
| 689 | if( zHome==0 ){ |
| 690 | zHome = getenv("HOMEPATH"); |
| 691 | } |
| 692 | } |
| 693 | if( zHome==0 ){ |
| 694 | fossil_fatal("cannot locate home directory - " |
| 695 | "please set the HOMEPATH environment variable"); |
| 696 | } |
| 697 | zHome = fossil_mbcs_to_utf8(zHome); |
| 698 | #else |
| 699 | zHome = getenv("HOME"); |
| 700 | if( zHome==0 ){ |
| 701 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -685,16 +685,19 @@ | |
| 685 | #if defined(_WIN32) |
| 686 | zHome = getenv("LOCALAPPDATA"); |
| 687 | if( zHome==0 ){ |
| 688 | zHome = getenv("APPDATA"); |
| 689 | if( zHome==0 ){ |
| 690 | char *zDrive = getenv("HOMEDRIVE"); |
| 691 | zHome = getenv("HOMEPATH"); |
| 692 | if( zDrive && zHome ) zHome = mprintf("%s%s", zDrive, zHome); |
| 693 | } |
| 694 | } |
| 695 | if( zHome==0 ){ |
| 696 | fossil_fatal("cannot locate home directory - " |
| 697 | "please set the LOCALAPPDATA or APPDATA or HOMEPATH " |
| 698 | "environment variables"); |
| 699 | } |
| 700 | zHome = fossil_mbcs_to_utf8(zHome); |
| 701 | #else |
| 702 | zHome = getenv("HOME"); |
| 703 | if( zHome==0 ){ |
| 704 |
M
src/db.c
+4
-1
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -685,16 +685,19 @@ | ||
| 685 | 685 | #if defined(_WIN32) |
| 686 | 686 | zHome = getenv("LOCALAPPDATA"); |
| 687 | 687 | if( zHome==0 ){ |
| 688 | 688 | zHome = getenv("APPDATA"); |
| 689 | 689 | if( zHome==0 ){ |
| 690 | + char *zDrive = getenv("HOMEDRIVE"); | |
| 690 | 691 | zHome = getenv("HOMEPATH"); |
| 692 | + if( zDrive && zHome ) zHome = mprintf("%s%s", zDrive, zHome); | |
| 691 | 693 | } |
| 692 | 694 | } |
| 693 | 695 | if( zHome==0 ){ |
| 694 | 696 | fossil_fatal("cannot locate home directory - " |
| 695 | - "please set the HOMEPATH environment variable"); | |
| 697 | + "please set the LOCALAPPDATA or APPDATA or HOMEPATH " | |
| 698 | + "environment variables"); | |
| 696 | 699 | } |
| 697 | 700 | zHome = fossil_mbcs_to_utf8(zHome); |
| 698 | 701 | #else |
| 699 | 702 | zHome = getenv("HOME"); |
| 700 | 703 | if( zHome==0 ){ |
| 701 | 704 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -685,16 +685,19 @@ | |
| 685 | #if defined(_WIN32) |
| 686 | zHome = getenv("LOCALAPPDATA"); |
| 687 | if( zHome==0 ){ |
| 688 | zHome = getenv("APPDATA"); |
| 689 | if( zHome==0 ){ |
| 690 | zHome = getenv("HOMEPATH"); |
| 691 | } |
| 692 | } |
| 693 | if( zHome==0 ){ |
| 694 | fossil_fatal("cannot locate home directory - " |
| 695 | "please set the HOMEPATH environment variable"); |
| 696 | } |
| 697 | zHome = fossil_mbcs_to_utf8(zHome); |
| 698 | #else |
| 699 | zHome = getenv("HOME"); |
| 700 | if( zHome==0 ){ |
| 701 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -685,16 +685,19 @@ | |
| 685 | #if defined(_WIN32) |
| 686 | zHome = getenv("LOCALAPPDATA"); |
| 687 | if( zHome==0 ){ |
| 688 | zHome = getenv("APPDATA"); |
| 689 | if( zHome==0 ){ |
| 690 | char *zDrive = getenv("HOMEDRIVE"); |
| 691 | zHome = getenv("HOMEPATH"); |
| 692 | if( zDrive && zHome ) zHome = mprintf("%s%s", zDrive, zHome); |
| 693 | } |
| 694 | } |
| 695 | if( zHome==0 ){ |
| 696 | fossil_fatal("cannot locate home directory - " |
| 697 | "please set the LOCALAPPDATA or APPDATA or HOMEPATH " |
| 698 | "environment variables"); |
| 699 | } |
| 700 | zHome = fossil_mbcs_to_utf8(zHome); |
| 701 | #else |
| 702 | zHome = getenv("HOME"); |
| 703 | if( zHome==0 ){ |
| 704 |
+19
-11
| --- src/login.c | ||
| +++ src/login.c | ||
| @@ -680,11 +680,11 @@ | ||
| 680 | 680 | if( fossil_strcmp(g.zLogin,"nobody")==0 ){ |
| 681 | 681 | g.zLogin = 0; |
| 682 | 682 | } |
| 683 | 683 | |
| 684 | 684 | /* Set the capabilities */ |
| 685 | - login_set_capabilities(zCap); | |
| 685 | + login_set_capabilities(zCap, 0); | |
| 686 | 686 | login_set_anon_nobody_capabilities(); |
| 687 | 687 | } |
| 688 | 688 | |
| 689 | 689 | /* |
| 690 | 690 | ** Memory of settings |
| @@ -698,26 +698,32 @@ | ||
| 698 | 698 | void login_set_anon_nobody_capabilities(void){ |
| 699 | 699 | if( g.zLogin && login_anon_once ){ |
| 700 | 700 | const char *zCap; |
| 701 | 701 | /* All logged-in users inherit privileges from "nobody" */ |
| 702 | 702 | zCap = db_text("", "SELECT cap FROM user WHERE login = 'nobody'"); |
| 703 | - login_set_capabilities(zCap); | |
| 703 | + login_set_capabilities(zCap, 0); | |
| 704 | 704 | if( fossil_strcmp(g.zLogin, "nobody")!=0 ){ |
| 705 | 705 | /* All logged-in users inherit privileges from "anonymous" */ |
| 706 | 706 | zCap = db_text("", "SELECT cap FROM user WHERE login = 'anonymous'"); |
| 707 | - login_set_capabilities(zCap); | |
| 707 | + login_set_capabilities(zCap, 0); | |
| 708 | 708 | } |
| 709 | 709 | login_anon_once = 0; |
| 710 | 710 | } |
| 711 | 711 | } |
| 712 | 712 | |
| 713 | +/* | |
| 714 | +** Flags passed into the 2nd argument of login_set_capabilities(). | |
| 715 | +*/ | |
| 716 | +#if INTERFACE | |
| 717 | +#define LOGIN_IGNORE_U 0x01 /* Ignore "u" */ | |
| 718 | +#define LOGIN_IGNORE_V 0x01 /* Ignore "v" */ | |
| 719 | +#endif | |
| 720 | + | |
| 713 | 721 | /* |
| 714 | 722 | ** Set the global capability flags based on a capability string. |
| 715 | 723 | */ |
| 716 | -void login_set_capabilities(const char *zCap){ | |
| 717 | - static char *zDev = 0; | |
| 718 | - static char *zUser = 0; | |
| 724 | +void login_set_capabilities(const char *zCap, unsigned flags){ | |
| 719 | 725 | int i; |
| 720 | 726 | for(i=0; zCap[i]; i++){ |
| 721 | 727 | switch( zCap[i] ){ |
| 722 | 728 | case 's': g.okSetup = 1; /* Fall thru into Admin */ |
| 723 | 729 | case 'a': g.okAdmin = g.okRdTkt = g.okWrTkt = g.okZip = |
| @@ -751,23 +757,25 @@ | ||
| 751 | 757 | case 'x': g.okPrivate = 1; break; |
| 752 | 758 | |
| 753 | 759 | /* The "u" privileges is a little different. It recursively |
| 754 | 760 | ** inherits all privileges of the user named "reader" */ |
| 755 | 761 | case 'u': { |
| 756 | - if( zUser==0 ){ | |
| 762 | + if( (flags & LOGIN_IGNORE_U)==0 ){ | |
| 763 | + const char *zUser; | |
| 757 | 764 | zUser = db_text("", "SELECT cap FROM user WHERE login='reader'"); |
| 758 | - login_set_capabilities(zUser); | |
| 765 | + login_set_capabilities(zUser, flags | LOGIN_IGNORE_U); | |
| 759 | 766 | } |
| 760 | 767 | break; |
| 761 | 768 | } |
| 762 | 769 | |
| 763 | 770 | /* The "v" privileges is a little different. It recursively |
| 764 | 771 | ** inherits all privileges of the user named "developer" */ |
| 765 | 772 | case 'v': { |
| 766 | - if( zDev==0 ){ | |
| 773 | + if( (flags & LOGIN_IGNORE_V)==0 ){ | |
| 774 | + const char *zDev; | |
| 767 | 775 | zDev = db_text("", "SELECT cap FROM user WHERE login='developer'"); |
| 768 | - login_set_capabilities(zDev); | |
| 776 | + login_set_capabilities(zDev, flags | LOGIN_IGNORE_V); | |
| 769 | 777 | } |
| 770 | 778 | break; |
| 771 | 779 | } |
| 772 | 780 | } |
| 773 | 781 | } |
| @@ -859,11 +867,11 @@ | ||
| 859 | 867 | } |
| 860 | 868 | if( fossil_strcmp(zUser,"nobody")==0 ) zUser = 0; |
| 861 | 869 | g.zLogin = fossil_strdup(zUser); |
| 862 | 870 | |
| 863 | 871 | /* Set the capabilities */ |
| 864 | - login_set_capabilities(zCap); | |
| 872 | + login_set_capabilities(zCap, 0); | |
| 865 | 873 | login_anon_once = 1; |
| 866 | 874 | login_set_anon_nobody_capabilities(); |
| 867 | 875 | } |
| 868 | 876 | |
| 869 | 877 | /* |
| 870 | 878 |
| --- src/login.c | |
| +++ src/login.c | |
| @@ -680,11 +680,11 @@ | |
| 680 | if( fossil_strcmp(g.zLogin,"nobody")==0 ){ |
| 681 | g.zLogin = 0; |
| 682 | } |
| 683 | |
| 684 | /* Set the capabilities */ |
| 685 | login_set_capabilities(zCap); |
| 686 | login_set_anon_nobody_capabilities(); |
| 687 | } |
| 688 | |
| 689 | /* |
| 690 | ** Memory of settings |
| @@ -698,26 +698,32 @@ | |
| 698 | void login_set_anon_nobody_capabilities(void){ |
| 699 | if( g.zLogin && login_anon_once ){ |
| 700 | const char *zCap; |
| 701 | /* All logged-in users inherit privileges from "nobody" */ |
| 702 | zCap = db_text("", "SELECT cap FROM user WHERE login = 'nobody'"); |
| 703 | login_set_capabilities(zCap); |
| 704 | if( fossil_strcmp(g.zLogin, "nobody")!=0 ){ |
| 705 | /* All logged-in users inherit privileges from "anonymous" */ |
| 706 | zCap = db_text("", "SELECT cap FROM user WHERE login = 'anonymous'"); |
| 707 | login_set_capabilities(zCap); |
| 708 | } |
| 709 | login_anon_once = 0; |
| 710 | } |
| 711 | } |
| 712 | |
| 713 | /* |
| 714 | ** Set the global capability flags based on a capability string. |
| 715 | */ |
| 716 | void login_set_capabilities(const char *zCap){ |
| 717 | static char *zDev = 0; |
| 718 | static char *zUser = 0; |
| 719 | int i; |
| 720 | for(i=0; zCap[i]; i++){ |
| 721 | switch( zCap[i] ){ |
| 722 | case 's': g.okSetup = 1; /* Fall thru into Admin */ |
| 723 | case 'a': g.okAdmin = g.okRdTkt = g.okWrTkt = g.okZip = |
| @@ -751,23 +757,25 @@ | |
| 751 | case 'x': g.okPrivate = 1; break; |
| 752 | |
| 753 | /* The "u" privileges is a little different. It recursively |
| 754 | ** inherits all privileges of the user named "reader" */ |
| 755 | case 'u': { |
| 756 | if( zUser==0 ){ |
| 757 | zUser = db_text("", "SELECT cap FROM user WHERE login='reader'"); |
| 758 | login_set_capabilities(zUser); |
| 759 | } |
| 760 | break; |
| 761 | } |
| 762 | |
| 763 | /* The "v" privileges is a little different. It recursively |
| 764 | ** inherits all privileges of the user named "developer" */ |
| 765 | case 'v': { |
| 766 | if( zDev==0 ){ |
| 767 | zDev = db_text("", "SELECT cap FROM user WHERE login='developer'"); |
| 768 | login_set_capabilities(zDev); |
| 769 | } |
| 770 | break; |
| 771 | } |
| 772 | } |
| 773 | } |
| @@ -859,11 +867,11 @@ | |
| 859 | } |
| 860 | if( fossil_strcmp(zUser,"nobody")==0 ) zUser = 0; |
| 861 | g.zLogin = fossil_strdup(zUser); |
| 862 | |
| 863 | /* Set the capabilities */ |
| 864 | login_set_capabilities(zCap); |
| 865 | login_anon_once = 1; |
| 866 | login_set_anon_nobody_capabilities(); |
| 867 | } |
| 868 | |
| 869 | /* |
| 870 |
| --- src/login.c | |
| +++ src/login.c | |
| @@ -680,11 +680,11 @@ | |
| 680 | if( fossil_strcmp(g.zLogin,"nobody")==0 ){ |
| 681 | g.zLogin = 0; |
| 682 | } |
| 683 | |
| 684 | /* Set the capabilities */ |
| 685 | login_set_capabilities(zCap, 0); |
| 686 | login_set_anon_nobody_capabilities(); |
| 687 | } |
| 688 | |
| 689 | /* |
| 690 | ** Memory of settings |
| @@ -698,26 +698,32 @@ | |
| 698 | void login_set_anon_nobody_capabilities(void){ |
| 699 | if( g.zLogin && login_anon_once ){ |
| 700 | const char *zCap; |
| 701 | /* All logged-in users inherit privileges from "nobody" */ |
| 702 | zCap = db_text("", "SELECT cap FROM user WHERE login = 'nobody'"); |
| 703 | login_set_capabilities(zCap, 0); |
| 704 | if( fossil_strcmp(g.zLogin, "nobody")!=0 ){ |
| 705 | /* All logged-in users inherit privileges from "anonymous" */ |
| 706 | zCap = db_text("", "SELECT cap FROM user WHERE login = 'anonymous'"); |
| 707 | login_set_capabilities(zCap, 0); |
| 708 | } |
| 709 | login_anon_once = 0; |
| 710 | } |
| 711 | } |
| 712 | |
| 713 | /* |
| 714 | ** Flags passed into the 2nd argument of login_set_capabilities(). |
| 715 | */ |
| 716 | #if INTERFACE |
| 717 | #define LOGIN_IGNORE_U 0x01 /* Ignore "u" */ |
| 718 | #define LOGIN_IGNORE_V 0x01 /* Ignore "v" */ |
| 719 | #endif |
| 720 | |
| 721 | /* |
| 722 | ** Set the global capability flags based on a capability string. |
| 723 | */ |
| 724 | void login_set_capabilities(const char *zCap, unsigned flags){ |
| 725 | int i; |
| 726 | for(i=0; zCap[i]; i++){ |
| 727 | switch( zCap[i] ){ |
| 728 | case 's': g.okSetup = 1; /* Fall thru into Admin */ |
| 729 | case 'a': g.okAdmin = g.okRdTkt = g.okWrTkt = g.okZip = |
| @@ -751,23 +757,25 @@ | |
| 757 | case 'x': g.okPrivate = 1; break; |
| 758 | |
| 759 | /* The "u" privileges is a little different. It recursively |
| 760 | ** inherits all privileges of the user named "reader" */ |
| 761 | case 'u': { |
| 762 | if( (flags & LOGIN_IGNORE_U)==0 ){ |
| 763 | const char *zUser; |
| 764 | zUser = db_text("", "SELECT cap FROM user WHERE login='reader'"); |
| 765 | login_set_capabilities(zUser, flags | LOGIN_IGNORE_U); |
| 766 | } |
| 767 | break; |
| 768 | } |
| 769 | |
| 770 | /* The "v" privileges is a little different. It recursively |
| 771 | ** inherits all privileges of the user named "developer" */ |
| 772 | case 'v': { |
| 773 | if( (flags & LOGIN_IGNORE_V)==0 ){ |
| 774 | const char *zDev; |
| 775 | zDev = db_text("", "SELECT cap FROM user WHERE login='developer'"); |
| 776 | login_set_capabilities(zDev, flags | LOGIN_IGNORE_V); |
| 777 | } |
| 778 | break; |
| 779 | } |
| 780 | } |
| 781 | } |
| @@ -859,11 +867,11 @@ | |
| 867 | } |
| 868 | if( fossil_strcmp(zUser,"nobody")==0 ) zUser = 0; |
| 869 | g.zLogin = fossil_strdup(zUser); |
| 870 | |
| 871 | /* Set the capabilities */ |
| 872 | login_set_capabilities(zCap, 0); |
| 873 | login_anon_once = 1; |
| 874 | login_set_anon_nobody_capabilities(); |
| 875 | } |
| 876 | |
| 877 | /* |
| 878 |
+3
-2
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -812,11 +812,11 @@ | ||
| 812 | 812 | zHost = PD("HTTP_HOST",""); |
| 813 | 813 | zMode = PD("HTTPS","off"); |
| 814 | 814 | zCur = PD("SCRIPT_NAME","/"); |
| 815 | 815 | i = strlen(zCur); |
| 816 | 816 | while( i>0 && zCur[i-1]=='/' ) i--; |
| 817 | - if( strcmp(zMode,"on")==0 ){ | |
| 817 | + if( fossil_stricmp(zMode,"on")==0 ){ | |
| 818 | 818 | g.zBaseURL = mprintf("https://%s%.*s", zHost, i, zCur); |
| 819 | 819 | g.zTop = &g.zBaseURL[8+strlen(zHost)]; |
| 820 | 820 | }else{ |
| 821 | 821 | g.zBaseURL = mprintf("http://%s%.*s", zHost, i, zCur); |
| 822 | 822 | g.zTop = &g.zBaseURL[7+strlen(zHost)]; |
| @@ -1007,10 +1007,11 @@ | ||
| 1007 | 1007 | zAltRepo[jj] = 0; |
| 1008 | 1008 | zAltRepo += jj+1; |
| 1009 | 1009 | }else{ |
| 1010 | 1010 | zUser = "nobody"; |
| 1011 | 1011 | } |
| 1012 | + if( g.zLogin==0 ) zUser = "nobody"; | |
| 1012 | 1013 | if( zAltRepo[0]!='/' ){ |
| 1013 | 1014 | zAltRepo = mprintf("%s/../%s", g.zRepositoryName, zAltRepo); |
| 1014 | 1015 | file_simplify_name(zAltRepo, -1); |
| 1015 | 1016 | } |
| 1016 | 1017 | db_close(1); |
| @@ -1307,11 +1308,11 @@ | ||
| 1307 | 1308 | ** |
| 1308 | 1309 | ** COMMAND: test-http |
| 1309 | 1310 | ** Works like the http command but gives setup permission to all users. |
| 1310 | 1311 | */ |
| 1311 | 1312 | void cmd_test_http(void){ |
| 1312 | - login_set_capabilities("s"); | |
| 1313 | + login_set_capabilities("s", 0); | |
| 1313 | 1314 | g.httpIn = stdin; |
| 1314 | 1315 | g.httpOut = stdout; |
| 1315 | 1316 | find_server_repository(0); |
| 1316 | 1317 | g.cgiOutput = 1; |
| 1317 | 1318 | g.fullHttpReply = 1; |
| 1318 | 1319 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -812,11 +812,11 @@ | |
| 812 | zHost = PD("HTTP_HOST",""); |
| 813 | zMode = PD("HTTPS","off"); |
| 814 | zCur = PD("SCRIPT_NAME","/"); |
| 815 | i = strlen(zCur); |
| 816 | while( i>0 && zCur[i-1]=='/' ) i--; |
| 817 | if( strcmp(zMode,"on")==0 ){ |
| 818 | g.zBaseURL = mprintf("https://%s%.*s", zHost, i, zCur); |
| 819 | g.zTop = &g.zBaseURL[8+strlen(zHost)]; |
| 820 | }else{ |
| 821 | g.zBaseURL = mprintf("http://%s%.*s", zHost, i, zCur); |
| 822 | g.zTop = &g.zBaseURL[7+strlen(zHost)]; |
| @@ -1007,10 +1007,11 @@ | |
| 1007 | zAltRepo[jj] = 0; |
| 1008 | zAltRepo += jj+1; |
| 1009 | }else{ |
| 1010 | zUser = "nobody"; |
| 1011 | } |
| 1012 | if( zAltRepo[0]!='/' ){ |
| 1013 | zAltRepo = mprintf("%s/../%s", g.zRepositoryName, zAltRepo); |
| 1014 | file_simplify_name(zAltRepo, -1); |
| 1015 | } |
| 1016 | db_close(1); |
| @@ -1307,11 +1308,11 @@ | |
| 1307 | ** |
| 1308 | ** COMMAND: test-http |
| 1309 | ** Works like the http command but gives setup permission to all users. |
| 1310 | */ |
| 1311 | void cmd_test_http(void){ |
| 1312 | login_set_capabilities("s"); |
| 1313 | g.httpIn = stdin; |
| 1314 | g.httpOut = stdout; |
| 1315 | find_server_repository(0); |
| 1316 | g.cgiOutput = 1; |
| 1317 | g.fullHttpReply = 1; |
| 1318 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -812,11 +812,11 @@ | |
| 812 | zHost = PD("HTTP_HOST",""); |
| 813 | zMode = PD("HTTPS","off"); |
| 814 | zCur = PD("SCRIPT_NAME","/"); |
| 815 | i = strlen(zCur); |
| 816 | while( i>0 && zCur[i-1]=='/' ) i--; |
| 817 | if( fossil_stricmp(zMode,"on")==0 ){ |
| 818 | g.zBaseURL = mprintf("https://%s%.*s", zHost, i, zCur); |
| 819 | g.zTop = &g.zBaseURL[8+strlen(zHost)]; |
| 820 | }else{ |
| 821 | g.zBaseURL = mprintf("http://%s%.*s", zHost, i, zCur); |
| 822 | g.zTop = &g.zBaseURL[7+strlen(zHost)]; |
| @@ -1007,10 +1007,11 @@ | |
| 1007 | zAltRepo[jj] = 0; |
| 1008 | zAltRepo += jj+1; |
| 1009 | }else{ |
| 1010 | zUser = "nobody"; |
| 1011 | } |
| 1012 | if( g.zLogin==0 ) zUser = "nobody"; |
| 1013 | if( zAltRepo[0]!='/' ){ |
| 1014 | zAltRepo = mprintf("%s/../%s", g.zRepositoryName, zAltRepo); |
| 1015 | file_simplify_name(zAltRepo, -1); |
| 1016 | } |
| 1017 | db_close(1); |
| @@ -1307,11 +1308,11 @@ | |
| 1308 | ** |
| 1309 | ** COMMAND: test-http |
| 1310 | ** Works like the http command but gives setup permission to all users. |
| 1311 | */ |
| 1312 | void cmd_test_http(void){ |
| 1313 | login_set_capabilities("s", 0); |
| 1314 | g.httpIn = stdin; |
| 1315 | g.httpOut = stdout; |
| 1316 | find_server_repository(0); |
| 1317 | g.cgiOutput = 1; |
| 1318 | g.fullHttpReply = 1; |
| 1319 |
+3
-2
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -812,11 +812,11 @@ | ||
| 812 | 812 | zHost = PD("HTTP_HOST",""); |
| 813 | 813 | zMode = PD("HTTPS","off"); |
| 814 | 814 | zCur = PD("SCRIPT_NAME","/"); |
| 815 | 815 | i = strlen(zCur); |
| 816 | 816 | while( i>0 && zCur[i-1]=='/' ) i--; |
| 817 | - if( strcmp(zMode,"on")==0 ){ | |
| 817 | + if( fossil_stricmp(zMode,"on")==0 ){ | |
| 818 | 818 | g.zBaseURL = mprintf("https://%s%.*s", zHost, i, zCur); |
| 819 | 819 | g.zTop = &g.zBaseURL[8+strlen(zHost)]; |
| 820 | 820 | }else{ |
| 821 | 821 | g.zBaseURL = mprintf("http://%s%.*s", zHost, i, zCur); |
| 822 | 822 | g.zTop = &g.zBaseURL[7+strlen(zHost)]; |
| @@ -1007,10 +1007,11 @@ | ||
| 1007 | 1007 | zAltRepo[jj] = 0; |
| 1008 | 1008 | zAltRepo += jj+1; |
| 1009 | 1009 | }else{ |
| 1010 | 1010 | zUser = "nobody"; |
| 1011 | 1011 | } |
| 1012 | + if( g.zLogin==0 ) zUser = "nobody"; | |
| 1012 | 1013 | if( zAltRepo[0]!='/' ){ |
| 1013 | 1014 | zAltRepo = mprintf("%s/../%s", g.zRepositoryName, zAltRepo); |
| 1014 | 1015 | file_simplify_name(zAltRepo, -1); |
| 1015 | 1016 | } |
| 1016 | 1017 | db_close(1); |
| @@ -1307,11 +1308,11 @@ | ||
| 1307 | 1308 | ** |
| 1308 | 1309 | ** COMMAND: test-http |
| 1309 | 1310 | ** Works like the http command but gives setup permission to all users. |
| 1310 | 1311 | */ |
| 1311 | 1312 | void cmd_test_http(void){ |
| 1312 | - login_set_capabilities("s"); | |
| 1313 | + login_set_capabilities("s", 0); | |
| 1313 | 1314 | g.httpIn = stdin; |
| 1314 | 1315 | g.httpOut = stdout; |
| 1315 | 1316 | find_server_repository(0); |
| 1316 | 1317 | g.cgiOutput = 1; |
| 1317 | 1318 | g.fullHttpReply = 1; |
| 1318 | 1319 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -812,11 +812,11 @@ | |
| 812 | zHost = PD("HTTP_HOST",""); |
| 813 | zMode = PD("HTTPS","off"); |
| 814 | zCur = PD("SCRIPT_NAME","/"); |
| 815 | i = strlen(zCur); |
| 816 | while( i>0 && zCur[i-1]=='/' ) i--; |
| 817 | if( strcmp(zMode,"on")==0 ){ |
| 818 | g.zBaseURL = mprintf("https://%s%.*s", zHost, i, zCur); |
| 819 | g.zTop = &g.zBaseURL[8+strlen(zHost)]; |
| 820 | }else{ |
| 821 | g.zBaseURL = mprintf("http://%s%.*s", zHost, i, zCur); |
| 822 | g.zTop = &g.zBaseURL[7+strlen(zHost)]; |
| @@ -1007,10 +1007,11 @@ | |
| 1007 | zAltRepo[jj] = 0; |
| 1008 | zAltRepo += jj+1; |
| 1009 | }else{ |
| 1010 | zUser = "nobody"; |
| 1011 | } |
| 1012 | if( zAltRepo[0]!='/' ){ |
| 1013 | zAltRepo = mprintf("%s/../%s", g.zRepositoryName, zAltRepo); |
| 1014 | file_simplify_name(zAltRepo, -1); |
| 1015 | } |
| 1016 | db_close(1); |
| @@ -1307,11 +1308,11 @@ | |
| 1307 | ** |
| 1308 | ** COMMAND: test-http |
| 1309 | ** Works like the http command but gives setup permission to all users. |
| 1310 | */ |
| 1311 | void cmd_test_http(void){ |
| 1312 | login_set_capabilities("s"); |
| 1313 | g.httpIn = stdin; |
| 1314 | g.httpOut = stdout; |
| 1315 | find_server_repository(0); |
| 1316 | g.cgiOutput = 1; |
| 1317 | g.fullHttpReply = 1; |
| 1318 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -812,11 +812,11 @@ | |
| 812 | zHost = PD("HTTP_HOST",""); |
| 813 | zMode = PD("HTTPS","off"); |
| 814 | zCur = PD("SCRIPT_NAME","/"); |
| 815 | i = strlen(zCur); |
| 816 | while( i>0 && zCur[i-1]=='/' ) i--; |
| 817 | if( fossil_stricmp(zMode,"on")==0 ){ |
| 818 | g.zBaseURL = mprintf("https://%s%.*s", zHost, i, zCur); |
| 819 | g.zTop = &g.zBaseURL[8+strlen(zHost)]; |
| 820 | }else{ |
| 821 | g.zBaseURL = mprintf("http://%s%.*s", zHost, i, zCur); |
| 822 | g.zTop = &g.zBaseURL[7+strlen(zHost)]; |
| @@ -1007,10 +1007,11 @@ | |
| 1007 | zAltRepo[jj] = 0; |
| 1008 | zAltRepo += jj+1; |
| 1009 | }else{ |
| 1010 | zUser = "nobody"; |
| 1011 | } |
| 1012 | if( g.zLogin==0 ) zUser = "nobody"; |
| 1013 | if( zAltRepo[0]!='/' ){ |
| 1014 | zAltRepo = mprintf("%s/../%s", g.zRepositoryName, zAltRepo); |
| 1015 | file_simplify_name(zAltRepo, -1); |
| 1016 | } |
| 1017 | db_close(1); |
| @@ -1307,11 +1308,11 @@ | |
| 1308 | ** |
| 1309 | ** COMMAND: test-http |
| 1310 | ** Works like the http command but gives setup permission to all users. |
| 1311 | */ |
| 1312 | void cmd_test_http(void){ |
| 1313 | login_set_capabilities("s", 0); |
| 1314 | g.httpIn = stdin; |
| 1315 | g.httpOut = stdout; |
| 1316 | find_server_repository(0); |
| 1317 | g.cgiOutput = 1; |
| 1318 | g.fullHttpReply = 1; |
| 1319 |
+11
| --- src/style.c | ||
| +++ src/style.c | ||
| @@ -800,17 +800,28 @@ | ||
| 800 | 800 | |
| 801 | 801 | /* |
| 802 | 802 | ** WEBPAGE: test_env |
| 803 | 803 | */ |
| 804 | 804 | void page_test_env(void){ |
| 805 | + char c; | |
| 806 | + int i; | |
| 807 | + char zCap[30]; | |
| 805 | 808 | login_check_credentials(); |
| 806 | 809 | style_header("Environment Test"); |
| 807 | 810 | #if !defined(_WIN32) |
| 808 | 811 | @ uid=%d(getuid()), gid=%d(getgid())<br /> |
| 809 | 812 | #endif |
| 810 | 813 | @ g.zBaseURL = %h(g.zBaseURL)<br /> |
| 811 | 814 | @ g.zTop = %h(g.zTop)<br /> |
| 815 | + for(i=0, c='a'; c<='z'; c++){ | |
| 816 | + if( login_has_capability(&c, 1) ) zCap[i++] = c; | |
| 817 | + } | |
| 818 | + zCap[i] = 0; | |
| 819 | + @ g.userUid = %d(g.userUid)<br /> | |
| 820 | + @ g.zLogin = %h(g.zLogin)<br /> | |
| 821 | + @ capabilities = %s(zCap)<br /> | |
| 822 | + @ <hr> | |
| 812 | 823 | cgi_print_all(); |
| 813 | 824 | if( g.okSetup ){ |
| 814 | 825 | const char *zRedir = P("redirect"); |
| 815 | 826 | if( zRedir ) cgi_redirect(zRedir); |
| 816 | 827 | } |
| 817 | 828 |
| --- src/style.c | |
| +++ src/style.c | |
| @@ -800,17 +800,28 @@ | |
| 800 | |
| 801 | /* |
| 802 | ** WEBPAGE: test_env |
| 803 | */ |
| 804 | void page_test_env(void){ |
| 805 | login_check_credentials(); |
| 806 | style_header("Environment Test"); |
| 807 | #if !defined(_WIN32) |
| 808 | @ uid=%d(getuid()), gid=%d(getgid())<br /> |
| 809 | #endif |
| 810 | @ g.zBaseURL = %h(g.zBaseURL)<br /> |
| 811 | @ g.zTop = %h(g.zTop)<br /> |
| 812 | cgi_print_all(); |
| 813 | if( g.okSetup ){ |
| 814 | const char *zRedir = P("redirect"); |
| 815 | if( zRedir ) cgi_redirect(zRedir); |
| 816 | } |
| 817 |
| --- src/style.c | |
| +++ src/style.c | |
| @@ -800,17 +800,28 @@ | |
| 800 | |
| 801 | /* |
| 802 | ** WEBPAGE: test_env |
| 803 | */ |
| 804 | void page_test_env(void){ |
| 805 | char c; |
| 806 | int i; |
| 807 | char zCap[30]; |
| 808 | login_check_credentials(); |
| 809 | style_header("Environment Test"); |
| 810 | #if !defined(_WIN32) |
| 811 | @ uid=%d(getuid()), gid=%d(getgid())<br /> |
| 812 | #endif |
| 813 | @ g.zBaseURL = %h(g.zBaseURL)<br /> |
| 814 | @ g.zTop = %h(g.zTop)<br /> |
| 815 | for(i=0, c='a'; c<='z'; c++){ |
| 816 | if( login_has_capability(&c, 1) ) zCap[i++] = c; |
| 817 | } |
| 818 | zCap[i] = 0; |
| 819 | @ g.userUid = %d(g.userUid)<br /> |
| 820 | @ g.zLogin = %h(g.zLogin)<br /> |
| 821 | @ capabilities = %s(zCap)<br /> |
| 822 | @ <hr> |
| 823 | cgi_print_all(); |
| 824 | if( g.okSetup ){ |
| 825 | const char *zRedir = P("redirect"); |
| 826 | if( zRedir ) cgi_redirect(zRedir); |
| 827 | } |
| 828 |
+1
-1
| --- src/xfer.c | ||
| +++ src/xfer.c | ||
| @@ -595,11 +595,11 @@ | ||
| 595 | 595 | blob_reset(&combined); |
| 596 | 596 | } |
| 597 | 597 | if( rc==0 ){ |
| 598 | 598 | const char *zCap; |
| 599 | 599 | zCap = db_column_text(&q, 1); |
| 600 | - login_set_capabilities(zCap); | |
| 600 | + login_set_capabilities(zCap, 0); | |
| 601 | 601 | g.userUid = db_column_int(&q, 2); |
| 602 | 602 | g.zLogin = mprintf("%b", pLogin); |
| 603 | 603 | g.zNonce = mprintf("%b", pNonce); |
| 604 | 604 | } |
| 605 | 605 | } |
| 606 | 606 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -595,11 +595,11 @@ | |
| 595 | blob_reset(&combined); |
| 596 | } |
| 597 | if( rc==0 ){ |
| 598 | const char *zCap; |
| 599 | zCap = db_column_text(&q, 1); |
| 600 | login_set_capabilities(zCap); |
| 601 | g.userUid = db_column_int(&q, 2); |
| 602 | g.zLogin = mprintf("%b", pLogin); |
| 603 | g.zNonce = mprintf("%b", pNonce); |
| 604 | } |
| 605 | } |
| 606 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -595,11 +595,11 @@ | |
| 595 | blob_reset(&combined); |
| 596 | } |
| 597 | if( rc==0 ){ |
| 598 | const char *zCap; |
| 599 | zCap = db_column_text(&q, 1); |
| 600 | login_set_capabilities(zCap, 0); |
| 601 | g.userUid = db_column_int(&q, 2); |
| 602 | g.zLogin = mprintf("%b", pLogin); |
| 603 | g.zNonce = mprintf("%b", pNonce); |
| 604 | } |
| 605 | } |
| 606 |
+1
-1
| --- src/xfer.c | ||
| +++ src/xfer.c | ||
| @@ -595,11 +595,11 @@ | ||
| 595 | 595 | blob_reset(&combined); |
| 596 | 596 | } |
| 597 | 597 | if( rc==0 ){ |
| 598 | 598 | const char *zCap; |
| 599 | 599 | zCap = db_column_text(&q, 1); |
| 600 | - login_set_capabilities(zCap); | |
| 600 | + login_set_capabilities(zCap, 0); | |
| 601 | 601 | g.userUid = db_column_int(&q, 2); |
| 602 | 602 | g.zLogin = mprintf("%b", pLogin); |
| 603 | 603 | g.zNonce = mprintf("%b", pNonce); |
| 604 | 604 | } |
| 605 | 605 | } |
| 606 | 606 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -595,11 +595,11 @@ | |
| 595 | blob_reset(&combined); |
| 596 | } |
| 597 | if( rc==0 ){ |
| 598 | const char *zCap; |
| 599 | zCap = db_column_text(&q, 1); |
| 600 | login_set_capabilities(zCap); |
| 601 | g.userUid = db_column_int(&q, 2); |
| 602 | g.zLogin = mprintf("%b", pLogin); |
| 603 | g.zNonce = mprintf("%b", pNonce); |
| 604 | } |
| 605 | } |
| 606 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -595,11 +595,11 @@ | |
| 595 | blob_reset(&combined); |
| 596 | } |
| 597 | if( rc==0 ){ |
| 598 | const char *zCap; |
| 599 | zCap = db_column_text(&q, 1); |
| 600 | login_set_capabilities(zCap, 0); |
| 601 | g.userUid = db_column_int(&q, 2); |
| 602 | g.zLogin = mprintf("%b", pLogin); |
| 603 | g.zNonce = mprintf("%b", pNonce); |
| 604 | } |
| 605 | } |
| 606 |