Fossil SCM

Pull the latest trunk changes over into the windows-i18n branch.

drh 2011-05-09 15:50 windows-i18n merge
Commit bbba16084079b0aec8fae638dd1b92de28f6677c
+4 -1
--- src/db.c
+++ src/db.c
@@ -685,16 +685,19 @@
685685
#if defined(_WIN32)
686686
zHome = getenv("LOCALAPPDATA");
687687
if( zHome==0 ){
688688
zHome = getenv("APPDATA");
689689
if( zHome==0 ){
690
+ char *zDrive = getenv("HOMEDRIVE");
690691
zHome = getenv("HOMEPATH");
692
+ if( zDrive && zHome ) zHome = mprintf("%s%s", zDrive, zHome);
691693
}
692694
}
693695
if( zHome==0 ){
694696
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");
696699
}
697700
zHome = fossil_mbcs_to_utf8(zHome);
698701
#else
699702
zHome = getenv("HOME");
700703
if( zHome==0 ){
701704
--- 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
+4 -1
--- src/db.c
+++ src/db.c
@@ -685,16 +685,19 @@
685685
#if defined(_WIN32)
686686
zHome = getenv("LOCALAPPDATA");
687687
if( zHome==0 ){
688688
zHome = getenv("APPDATA");
689689
if( zHome==0 ){
690
+ char *zDrive = getenv("HOMEDRIVE");
690691
zHome = getenv("HOMEPATH");
692
+ if( zDrive && zHome ) zHome = mprintf("%s%s", zDrive, zHome);
691693
}
692694
}
693695
if( zHome==0 ){
694696
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");
696699
}
697700
zHome = fossil_mbcs_to_utf8(zHome);
698701
#else
699702
zHome = getenv("HOME");
700703
if( zHome==0 ){
701704
--- 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 @@
680680
if( fossil_strcmp(g.zLogin,"nobody")==0 ){
681681
g.zLogin = 0;
682682
}
683683
684684
/* Set the capabilities */
685
- login_set_capabilities(zCap);
685
+ login_set_capabilities(zCap, 0);
686686
login_set_anon_nobody_capabilities();
687687
}
688688
689689
/*
690690
** Memory of settings
@@ -698,26 +698,32 @@
698698
void login_set_anon_nobody_capabilities(void){
699699
if( g.zLogin && login_anon_once ){
700700
const char *zCap;
701701
/* All logged-in users inherit privileges from "nobody" */
702702
zCap = db_text("", "SELECT cap FROM user WHERE login = 'nobody'");
703
- login_set_capabilities(zCap);
703
+ login_set_capabilities(zCap, 0);
704704
if( fossil_strcmp(g.zLogin, "nobody")!=0 ){
705705
/* All logged-in users inherit privileges from "anonymous" */
706706
zCap = db_text("", "SELECT cap FROM user WHERE login = 'anonymous'");
707
- login_set_capabilities(zCap);
707
+ login_set_capabilities(zCap, 0);
708708
}
709709
login_anon_once = 0;
710710
}
711711
}
712712
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
+
713721
/*
714722
** Set the global capability flags based on a capability string.
715723
*/
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){
719725
int i;
720726
for(i=0; zCap[i]; i++){
721727
switch( zCap[i] ){
722728
case 's': g.okSetup = 1; /* Fall thru into Admin */
723729
case 'a': g.okAdmin = g.okRdTkt = g.okWrTkt = g.okZip =
@@ -751,23 +757,25 @@
751757
case 'x': g.okPrivate = 1; break;
752758
753759
/* The "u" privileges is a little different. It recursively
754760
** inherits all privileges of the user named "reader" */
755761
case 'u': {
756
- if( zUser==0 ){
762
+ if( (flags & LOGIN_IGNORE_U)==0 ){
763
+ const char *zUser;
757764
zUser = db_text("", "SELECT cap FROM user WHERE login='reader'");
758
- login_set_capabilities(zUser);
765
+ login_set_capabilities(zUser, flags | LOGIN_IGNORE_U);
759766
}
760767
break;
761768
}
762769
763770
/* The "v" privileges is a little different. It recursively
764771
** inherits all privileges of the user named "developer" */
765772
case 'v': {
766
- if( zDev==0 ){
773
+ if( (flags & LOGIN_IGNORE_V)==0 ){
774
+ const char *zDev;
767775
zDev = db_text("", "SELECT cap FROM user WHERE login='developer'");
768
- login_set_capabilities(zDev);
776
+ login_set_capabilities(zDev, flags | LOGIN_IGNORE_V);
769777
}
770778
break;
771779
}
772780
}
773781
}
@@ -859,11 +867,11 @@
859867
}
860868
if( fossil_strcmp(zUser,"nobody")==0 ) zUser = 0;
861869
g.zLogin = fossil_strdup(zUser);
862870
863871
/* Set the capabilities */
864
- login_set_capabilities(zCap);
872
+ login_set_capabilities(zCap, 0);
865873
login_anon_once = 1;
866874
login_set_anon_nobody_capabilities();
867875
}
868876
869877
/*
870878
--- 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 @@
812812
zHost = PD("HTTP_HOST","");
813813
zMode = PD("HTTPS","off");
814814
zCur = PD("SCRIPT_NAME","/");
815815
i = strlen(zCur);
816816
while( i>0 && zCur[i-1]=='/' ) i--;
817
- if( strcmp(zMode,"on")==0 ){
817
+ if( fossil_stricmp(zMode,"on")==0 ){
818818
g.zBaseURL = mprintf("https://%s%.*s", zHost, i, zCur);
819819
g.zTop = &g.zBaseURL[8+strlen(zHost)];
820820
}else{
821821
g.zBaseURL = mprintf("http://%s%.*s", zHost, i, zCur);
822822
g.zTop = &g.zBaseURL[7+strlen(zHost)];
@@ -1007,10 +1007,11 @@
10071007
zAltRepo[jj] = 0;
10081008
zAltRepo += jj+1;
10091009
}else{
10101010
zUser = "nobody";
10111011
}
1012
+ if( g.zLogin==0 ) zUser = "nobody";
10121013
if( zAltRepo[0]!='/' ){
10131014
zAltRepo = mprintf("%s/../%s", g.zRepositoryName, zAltRepo);
10141015
file_simplify_name(zAltRepo, -1);
10151016
}
10161017
db_close(1);
@@ -1307,11 +1308,11 @@
13071308
**
13081309
** COMMAND: test-http
13091310
** Works like the http command but gives setup permission to all users.
13101311
*/
13111312
void cmd_test_http(void){
1312
- login_set_capabilities("s");
1313
+ login_set_capabilities("s", 0);
13131314
g.httpIn = stdin;
13141315
g.httpOut = stdout;
13151316
find_server_repository(0);
13161317
g.cgiOutput = 1;
13171318
g.fullHttpReply = 1;
13181319
--- 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 @@
812812
zHost = PD("HTTP_HOST","");
813813
zMode = PD("HTTPS","off");
814814
zCur = PD("SCRIPT_NAME","/");
815815
i = strlen(zCur);
816816
while( i>0 && zCur[i-1]=='/' ) i--;
817
- if( strcmp(zMode,"on")==0 ){
817
+ if( fossil_stricmp(zMode,"on")==0 ){
818818
g.zBaseURL = mprintf("https://%s%.*s", zHost, i, zCur);
819819
g.zTop = &g.zBaseURL[8+strlen(zHost)];
820820
}else{
821821
g.zBaseURL = mprintf("http://%s%.*s", zHost, i, zCur);
822822
g.zTop = &g.zBaseURL[7+strlen(zHost)];
@@ -1007,10 +1007,11 @@
10071007
zAltRepo[jj] = 0;
10081008
zAltRepo += jj+1;
10091009
}else{
10101010
zUser = "nobody";
10111011
}
1012
+ if( g.zLogin==0 ) zUser = "nobody";
10121013
if( zAltRepo[0]!='/' ){
10131014
zAltRepo = mprintf("%s/../%s", g.zRepositoryName, zAltRepo);
10141015
file_simplify_name(zAltRepo, -1);
10151016
}
10161017
db_close(1);
@@ -1307,11 +1308,11 @@
13071308
**
13081309
** COMMAND: test-http
13091310
** Works like the http command but gives setup permission to all users.
13101311
*/
13111312
void cmd_test_http(void){
1312
- login_set_capabilities("s");
1313
+ login_set_capabilities("s", 0);
13131314
g.httpIn = stdin;
13141315
g.httpOut = stdout;
13151316
find_server_repository(0);
13161317
g.cgiOutput = 1;
13171318
g.fullHttpReply = 1;
13181319
--- 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 @@
800800
801801
/*
802802
** WEBPAGE: test_env
803803
*/
804804
void page_test_env(void){
805
+ char c;
806
+ int i;
807
+ char zCap[30];
805808
login_check_credentials();
806809
style_header("Environment Test");
807810
#if !defined(_WIN32)
808811
@ uid=%d(getuid()), gid=%d(getgid())<br />
809812
#endif
810813
@ g.zBaseURL = %h(g.zBaseURL)<br />
811814
@ 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>
812823
cgi_print_all();
813824
if( g.okSetup ){
814825
const char *zRedir = P("redirect");
815826
if( zRedir ) cgi_redirect(zRedir);
816827
}
817828
--- 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 @@
595595
blob_reset(&combined);
596596
}
597597
if( rc==0 ){
598598
const char *zCap;
599599
zCap = db_column_text(&q, 1);
600
- login_set_capabilities(zCap);
600
+ login_set_capabilities(zCap, 0);
601601
g.userUid = db_column_int(&q, 2);
602602
g.zLogin = mprintf("%b", pLogin);
603603
g.zNonce = mprintf("%b", pNonce);
604604
}
605605
}
606606
--- 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 @@
595595
blob_reset(&combined);
596596
}
597597
if( rc==0 ){
598598
const char *zCap;
599599
zCap = db_column_text(&q, 1);
600
- login_set_capabilities(zCap);
600
+ login_set_capabilities(zCap, 0);
601601
g.userUid = db_column_int(&q, 2);
602602
g.zLogin = mprintf("%b", pLogin);
603603
g.zNonce = mprintf("%b", pNonce);
604604
}
605605
}
606606
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button