Fossil SCM

Test of latest feature branches, do not merge.

mistachkin 2016-02-01 04:38 trunk merge
Commit 1a164e5fb76a46ba6d811ce67245e0b5a9e43054
+11 -10
--- src/login.c
+++ src/login.c
@@ -1075,29 +1075,30 @@
10751075
if(NULL==zCap){
10761076
return;
10771077
}
10781078
for(i=0; zCap[i]; i++){
10791079
switch( zCap[i] ){
1080
- case 's': p->Setup = 1; /* Fall thru into Admin */
1080
+ case 's': p->Setup = 1; /* Fall thru into Admin */
10811081
case 'a': p->Admin = p->RdTkt = p->WrTkt = p->Zip =
1082
- p->RdWiki = p->WrWiki = p->NewWiki =
1083
- p->ApndWiki = p->Hyperlink = p->Clone =
1084
- p->NewTkt = p->Password = p->RdAddr =
1085
- p->TktFmt = p->Attach = p->ApndTkt =
1086
- p->ModWiki = p->ModTkt = 1;
1087
- /* Fall thru into Read/Write */
1088
- case 'i': p->Read = p->Write = 1; break;
1082
+ p->RdWiki = p->WrWiki = p->NewWiki =
1083
+ p->ApndWiki = p->Hyperlink = p->Clone =
1084
+ p->NewTkt = p->Password = p->RdAddr =
1085
+ p->TktFmt = p->Attach = p->ApndTkt =
1086
+ p->ModWiki = p->ModTkt = p->Delete =
1087
+ p->Private = 1;
1088
+ /* Fall thru into Read/Write */
1089
+ case 'i': p->Read = p->Write = 1; break;
10891090
case 'o': p->Read = 1; break;
10901091
case 'z': p->Zip = 1; break;
10911092
10921093
case 'd': p->Delete = 1; break;
10931094
case 'h': p->Hyperlink = 1; break;
10941095
case 'g': p->Clone = 1; break;
10951096
case 'p': p->Password = 1; break;
10961097
10971098
case 'j': p->RdWiki = 1; break;
1098
- case 'k': p->WrWiki = p->RdWiki = p->ApndWiki =1; break;
1099
+ case 'k': p->WrWiki = p->RdWiki = p->ApndWiki =1; break;
10991100
case 'm': p->ApndWiki = 1; break;
11001101
case 'f': p->NewWiki = 1; break;
11011102
case 'l': p->ModWiki = 1; break;
11021103
11031104
case 'e': p->RdAddr = 1; break;
@@ -1181,11 +1182,11 @@
11811182
/* case 'v': DEVELOPER */
11821183
case 'w': rc = p->WrTkt; break;
11831184
case 'x': rc = p->Private; break;
11841185
/* case 'y': */
11851186
case 'z': rc = p->Zip; break;
1186
- default: rc = 0; break;
1187
+ default: rc = 0; break;
11871188
}
11881189
}
11891190
return rc;
11901191
}
11911192
11921193
--- src/login.c
+++ src/login.c
@@ -1075,29 +1075,30 @@
1075 if(NULL==zCap){
1076 return;
1077 }
1078 for(i=0; zCap[i]; i++){
1079 switch( zCap[i] ){
1080 case 's': p->Setup = 1; /* Fall thru into Admin */
1081 case 'a': p->Admin = p->RdTkt = p->WrTkt = p->Zip =
1082 p->RdWiki = p->WrWiki = p->NewWiki =
1083 p->ApndWiki = p->Hyperlink = p->Clone =
1084 p->NewTkt = p->Password = p->RdAddr =
1085 p->TktFmt = p->Attach = p->ApndTkt =
1086 p->ModWiki = p->ModTkt = 1;
1087 /* Fall thru into Read/Write */
1088 case 'i': p->Read = p->Write = 1; break;
 
1089 case 'o': p->Read = 1; break;
1090 case 'z': p->Zip = 1; break;
1091
1092 case 'd': p->Delete = 1; break;
1093 case 'h': p->Hyperlink = 1; break;
1094 case 'g': p->Clone = 1; break;
1095 case 'p': p->Password = 1; break;
1096
1097 case 'j': p->RdWiki = 1; break;
1098 case 'k': p->WrWiki = p->RdWiki = p->ApndWiki =1; break;
1099 case 'm': p->ApndWiki = 1; break;
1100 case 'f': p->NewWiki = 1; break;
1101 case 'l': p->ModWiki = 1; break;
1102
1103 case 'e': p->RdAddr = 1; break;
@@ -1181,11 +1182,11 @@
1181 /* case 'v': DEVELOPER */
1182 case 'w': rc = p->WrTkt; break;
1183 case 'x': rc = p->Private; break;
1184 /* case 'y': */
1185 case 'z': rc = p->Zip; break;
1186 default: rc = 0; break;
1187 }
1188 }
1189 return rc;
1190 }
1191
1192
--- src/login.c
+++ src/login.c
@@ -1075,29 +1075,30 @@
1075 if(NULL==zCap){
1076 return;
1077 }
1078 for(i=0; zCap[i]; i++){
1079 switch( zCap[i] ){
1080 case 's': p->Setup = 1; /* Fall thru into Admin */
1081 case 'a': p->Admin = p->RdTkt = p->WrTkt = p->Zip =
1082 p->RdWiki = p->WrWiki = p->NewWiki =
1083 p->ApndWiki = p->Hyperlink = p->Clone =
1084 p->NewTkt = p->Password = p->RdAddr =
1085 p->TktFmt = p->Attach = p->ApndTkt =
1086 p->ModWiki = p->ModTkt = p->Delete =
1087 p->Private = 1;
1088 /* Fall thru into Read/Write */
1089 case 'i': p->Read = p->Write = 1; break;
1090 case 'o': p->Read = 1; break;
1091 case 'z': p->Zip = 1; break;
1092
1093 case 'd': p->Delete = 1; break;
1094 case 'h': p->Hyperlink = 1; break;
1095 case 'g': p->Clone = 1; break;
1096 case 'p': p->Password = 1; break;
1097
1098 case 'j': p->RdWiki = 1; break;
1099 case 'k': p->WrWiki = p->RdWiki = p->ApndWiki =1; break;
1100 case 'm': p->ApndWiki = 1; break;
1101 case 'f': p->NewWiki = 1; break;
1102 case 'l': p->ModWiki = 1; break;
1103
1104 case 'e': p->RdAddr = 1; break;
@@ -1181,11 +1182,11 @@
1182 /* case 'v': DEVELOPER */
1183 case 'w': rc = p->WrTkt; break;
1184 case 'x': rc = p->Private; break;
1185 /* case 'y': */
1186 case 'z': rc = p->Zip; break;
1187 default: rc = 0; break;
1188 }
1189 }
1190 return rc;
1191 }
1192
1193
+11 -10
--- src/login.c
+++ src/login.c
@@ -1075,29 +1075,30 @@
10751075
if(NULL==zCap){
10761076
return;
10771077
}
10781078
for(i=0; zCap[i]; i++){
10791079
switch( zCap[i] ){
1080
- case 's': p->Setup = 1; /* Fall thru into Admin */
1080
+ case 's': p->Setup = 1; /* Fall thru into Admin */
10811081
case 'a': p->Admin = p->RdTkt = p->WrTkt = p->Zip =
1082
- p->RdWiki = p->WrWiki = p->NewWiki =
1083
- p->ApndWiki = p->Hyperlink = p->Clone =
1084
- p->NewTkt = p->Password = p->RdAddr =
1085
- p->TktFmt = p->Attach = p->ApndTkt =
1086
- p->ModWiki = p->ModTkt = 1;
1087
- /* Fall thru into Read/Write */
1088
- case 'i': p->Read = p->Write = 1; break;
1082
+ p->RdWiki = p->WrWiki = p->NewWiki =
1083
+ p->ApndWiki = p->Hyperlink = p->Clone =
1084
+ p->NewTkt = p->Password = p->RdAddr =
1085
+ p->TktFmt = p->Attach = p->ApndTkt =
1086
+ p->ModWiki = p->ModTkt = p->Delete =
1087
+ p->Private = 1;
1088
+ /* Fall thru into Read/Write */
1089
+ case 'i': p->Read = p->Write = 1; break;
10891090
case 'o': p->Read = 1; break;
10901091
case 'z': p->Zip = 1; break;
10911092
10921093
case 'd': p->Delete = 1; break;
10931094
case 'h': p->Hyperlink = 1; break;
10941095
case 'g': p->Clone = 1; break;
10951096
case 'p': p->Password = 1; break;
10961097
10971098
case 'j': p->RdWiki = 1; break;
1098
- case 'k': p->WrWiki = p->RdWiki = p->ApndWiki =1; break;
1099
+ case 'k': p->WrWiki = p->RdWiki = p->ApndWiki =1; break;
10991100
case 'm': p->ApndWiki = 1; break;
11001101
case 'f': p->NewWiki = 1; break;
11011102
case 'l': p->ModWiki = 1; break;
11021103
11031104
case 'e': p->RdAddr = 1; break;
@@ -1181,11 +1182,11 @@
11811182
/* case 'v': DEVELOPER */
11821183
case 'w': rc = p->WrTkt; break;
11831184
case 'x': rc = p->Private; break;
11841185
/* case 'y': */
11851186
case 'z': rc = p->Zip; break;
1186
- default: rc = 0; break;
1187
+ default: rc = 0; break;
11871188
}
11881189
}
11891190
return rc;
11901191
}
11911192
11921193
--- src/login.c
+++ src/login.c
@@ -1075,29 +1075,30 @@
1075 if(NULL==zCap){
1076 return;
1077 }
1078 for(i=0; zCap[i]; i++){
1079 switch( zCap[i] ){
1080 case 's': p->Setup = 1; /* Fall thru into Admin */
1081 case 'a': p->Admin = p->RdTkt = p->WrTkt = p->Zip =
1082 p->RdWiki = p->WrWiki = p->NewWiki =
1083 p->ApndWiki = p->Hyperlink = p->Clone =
1084 p->NewTkt = p->Password = p->RdAddr =
1085 p->TktFmt = p->Attach = p->ApndTkt =
1086 p->ModWiki = p->ModTkt = 1;
1087 /* Fall thru into Read/Write */
1088 case 'i': p->Read = p->Write = 1; break;
 
1089 case 'o': p->Read = 1; break;
1090 case 'z': p->Zip = 1; break;
1091
1092 case 'd': p->Delete = 1; break;
1093 case 'h': p->Hyperlink = 1; break;
1094 case 'g': p->Clone = 1; break;
1095 case 'p': p->Password = 1; break;
1096
1097 case 'j': p->RdWiki = 1; break;
1098 case 'k': p->WrWiki = p->RdWiki = p->ApndWiki =1; break;
1099 case 'm': p->ApndWiki = 1; break;
1100 case 'f': p->NewWiki = 1; break;
1101 case 'l': p->ModWiki = 1; break;
1102
1103 case 'e': p->RdAddr = 1; break;
@@ -1181,11 +1182,11 @@
1181 /* case 'v': DEVELOPER */
1182 case 'w': rc = p->WrTkt; break;
1183 case 'x': rc = p->Private; break;
1184 /* case 'y': */
1185 case 'z': rc = p->Zip; break;
1186 default: rc = 0; break;
1187 }
1188 }
1189 return rc;
1190 }
1191
1192
--- src/login.c
+++ src/login.c
@@ -1075,29 +1075,30 @@
1075 if(NULL==zCap){
1076 return;
1077 }
1078 for(i=0; zCap[i]; i++){
1079 switch( zCap[i] ){
1080 case 's': p->Setup = 1; /* Fall thru into Admin */
1081 case 'a': p->Admin = p->RdTkt = p->WrTkt = p->Zip =
1082 p->RdWiki = p->WrWiki = p->NewWiki =
1083 p->ApndWiki = p->Hyperlink = p->Clone =
1084 p->NewTkt = p->Password = p->RdAddr =
1085 p->TktFmt = p->Attach = p->ApndTkt =
1086 p->ModWiki = p->ModTkt = p->Delete =
1087 p->Private = 1;
1088 /* Fall thru into Read/Write */
1089 case 'i': p->Read = p->Write = 1; break;
1090 case 'o': p->Read = 1; break;
1091 case 'z': p->Zip = 1; break;
1092
1093 case 'd': p->Delete = 1; break;
1094 case 'h': p->Hyperlink = 1; break;
1095 case 'g': p->Clone = 1; break;
1096 case 'p': p->Password = 1; break;
1097
1098 case 'j': p->RdWiki = 1; break;
1099 case 'k': p->WrWiki = p->RdWiki = p->ApndWiki =1; break;
1100 case 'm': p->ApndWiki = 1; break;
1101 case 'f': p->NewWiki = 1; break;
1102 case 'l': p->ModWiki = 1; break;
1103
1104 case 'e': p->RdAddr = 1; break;
@@ -1181,11 +1182,11 @@
1182 /* case 'v': DEVELOPER */
1183 case 'w': rc = p->WrTkt; break;
1184 case 'x': rc = p->Private; break;
1185 /* case 'y': */
1186 case 'z': rc = p->Zip; break;
1187 default: rc = 0; break;
1188 }
1189 }
1190 return rc;
1191 }
1192
1193
+11 -10
--- src/login.c
+++ src/login.c
@@ -1075,29 +1075,30 @@
10751075
if(NULL==zCap){
10761076
return;
10771077
}
10781078
for(i=0; zCap[i]; i++){
10791079
switch( zCap[i] ){
1080
- case 's': p->Setup = 1; /* Fall thru into Admin */
1080
+ case 's': p->Setup = 1; /* Fall thru into Admin */
10811081
case 'a': p->Admin = p->RdTkt = p->WrTkt = p->Zip =
1082
- p->RdWiki = p->WrWiki = p->NewWiki =
1083
- p->ApndWiki = p->Hyperlink = p->Clone =
1084
- p->NewTkt = p->Password = p->RdAddr =
1085
- p->TktFmt = p->Attach = p->ApndTkt =
1086
- p->ModWiki = p->ModTkt = 1;
1087
- /* Fall thru into Read/Write */
1088
- case 'i': p->Read = p->Write = 1; break;
1082
+ p->RdWiki = p->WrWiki = p->NewWiki =
1083
+ p->ApndWiki = p->Hyperlink = p->Clone =
1084
+ p->NewTkt = p->Password = p->RdAddr =
1085
+ p->TktFmt = p->Attach = p->ApndTkt =
1086
+ p->ModWiki = p->ModTkt = p->Delete =
1087
+ p->Private = 1;
1088
+ /* Fall thru into Read/Write */
1089
+ case 'i': p->Read = p->Write = 1; break;
10891090
case 'o': p->Read = 1; break;
10901091
case 'z': p->Zip = 1; break;
10911092
10921093
case 'd': p->Delete = 1; break;
10931094
case 'h': p->Hyperlink = 1; break;
10941095
case 'g': p->Clone = 1; break;
10951096
case 'p': p->Password = 1; break;
10961097
10971098
case 'j': p->RdWiki = 1; break;
1098
- case 'k': p->WrWiki = p->RdWiki = p->ApndWiki =1; break;
1099
+ case 'k': p->WrWiki = p->RdWiki = p->ApndWiki =1; break;
10991100
case 'm': p->ApndWiki = 1; break;
11001101
case 'f': p->NewWiki = 1; break;
11011102
case 'l': p->ModWiki = 1; break;
11021103
11031104
case 'e': p->RdAddr = 1; break;
@@ -1181,11 +1182,11 @@
11811182
/* case 'v': DEVELOPER */
11821183
case 'w': rc = p->WrTkt; break;
11831184
case 'x': rc = p->Private; break;
11841185
/* case 'y': */
11851186
case 'z': rc = p->Zip; break;
1186
- default: rc = 0; break;
1187
+ default: rc = 0; break;
11871188
}
11881189
}
11891190
return rc;
11901191
}
11911192
11921193
--- src/login.c
+++ src/login.c
@@ -1075,29 +1075,30 @@
1075 if(NULL==zCap){
1076 return;
1077 }
1078 for(i=0; zCap[i]; i++){
1079 switch( zCap[i] ){
1080 case 's': p->Setup = 1; /* Fall thru into Admin */
1081 case 'a': p->Admin = p->RdTkt = p->WrTkt = p->Zip =
1082 p->RdWiki = p->WrWiki = p->NewWiki =
1083 p->ApndWiki = p->Hyperlink = p->Clone =
1084 p->NewTkt = p->Password = p->RdAddr =
1085 p->TktFmt = p->Attach = p->ApndTkt =
1086 p->ModWiki = p->ModTkt = 1;
1087 /* Fall thru into Read/Write */
1088 case 'i': p->Read = p->Write = 1; break;
 
1089 case 'o': p->Read = 1; break;
1090 case 'z': p->Zip = 1; break;
1091
1092 case 'd': p->Delete = 1; break;
1093 case 'h': p->Hyperlink = 1; break;
1094 case 'g': p->Clone = 1; break;
1095 case 'p': p->Password = 1; break;
1096
1097 case 'j': p->RdWiki = 1; break;
1098 case 'k': p->WrWiki = p->RdWiki = p->ApndWiki =1; break;
1099 case 'm': p->ApndWiki = 1; break;
1100 case 'f': p->NewWiki = 1; break;
1101 case 'l': p->ModWiki = 1; break;
1102
1103 case 'e': p->RdAddr = 1; break;
@@ -1181,11 +1182,11 @@
1181 /* case 'v': DEVELOPER */
1182 case 'w': rc = p->WrTkt; break;
1183 case 'x': rc = p->Private; break;
1184 /* case 'y': */
1185 case 'z': rc = p->Zip; break;
1186 default: rc = 0; break;
1187 }
1188 }
1189 return rc;
1190 }
1191
1192
--- src/login.c
+++ src/login.c
@@ -1075,29 +1075,30 @@
1075 if(NULL==zCap){
1076 return;
1077 }
1078 for(i=0; zCap[i]; i++){
1079 switch( zCap[i] ){
1080 case 's': p->Setup = 1; /* Fall thru into Admin */
1081 case 'a': p->Admin = p->RdTkt = p->WrTkt = p->Zip =
1082 p->RdWiki = p->WrWiki = p->NewWiki =
1083 p->ApndWiki = p->Hyperlink = p->Clone =
1084 p->NewTkt = p->Password = p->RdAddr =
1085 p->TktFmt = p->Attach = p->ApndTkt =
1086 p->ModWiki = p->ModTkt = p->Delete =
1087 p->Private = 1;
1088 /* Fall thru into Read/Write */
1089 case 'i': p->Read = p->Write = 1; break;
1090 case 'o': p->Read = 1; break;
1091 case 'z': p->Zip = 1; break;
1092
1093 case 'd': p->Delete = 1; break;
1094 case 'h': p->Hyperlink = 1; break;
1095 case 'g': p->Clone = 1; break;
1096 case 'p': p->Password = 1; break;
1097
1098 case 'j': p->RdWiki = 1; break;
1099 case 'k': p->WrWiki = p->RdWiki = p->ApndWiki =1; break;
1100 case 'm': p->ApndWiki = 1; break;
1101 case 'f': p->NewWiki = 1; break;
1102 case 'l': p->ModWiki = 1; break;
1103
1104 case 'e': p->RdAddr = 1; break;
@@ -1181,11 +1182,11 @@
1182 /* case 'v': DEVELOPER */
1183 case 'w': rc = p->WrTkt; break;
1184 case 'x': rc = p->Private; break;
1185 /* case 'y': */
1186 case 'z': rc = p->Zip; break;
1187 default: rc = 0; break;
1188 }
1189 }
1190 return rc;
1191 }
1192
1193
+11 -10
--- src/login.c
+++ src/login.c
@@ -1075,29 +1075,30 @@
10751075
if(NULL==zCap){
10761076
return;
10771077
}
10781078
for(i=0; zCap[i]; i++){
10791079
switch( zCap[i] ){
1080
- case 's': p->Setup = 1; /* Fall thru into Admin */
1080
+ case 's': p->Setup = 1; /* Fall thru into Admin */
10811081
case 'a': p->Admin = p->RdTkt = p->WrTkt = p->Zip =
1082
- p->RdWiki = p->WrWiki = p->NewWiki =
1083
- p->ApndWiki = p->Hyperlink = p->Clone =
1084
- p->NewTkt = p->Password = p->RdAddr =
1085
- p->TktFmt = p->Attach = p->ApndTkt =
1086
- p->ModWiki = p->ModTkt = 1;
1087
- /* Fall thru into Read/Write */
1088
- case 'i': p->Read = p->Write = 1; break;
1082
+ p->RdWiki = p->WrWiki = p->NewWiki =
1083
+ p->ApndWiki = p->Hyperlink = p->Clone =
1084
+ p->NewTkt = p->Password = p->RdAddr =
1085
+ p->TktFmt = p->Attach = p->ApndTkt =
1086
+ p->ModWiki = p->ModTkt = p->Delete =
1087
+ p->Private = 1;
1088
+ /* Fall thru into Read/Write */
1089
+ case 'i': p->Read = p->Write = 1; break;
10891090
case 'o': p->Read = 1; break;
10901091
case 'z': p->Zip = 1; break;
10911092
10921093
case 'd': p->Delete = 1; break;
10931094
case 'h': p->Hyperlink = 1; break;
10941095
case 'g': p->Clone = 1; break;
10951096
case 'p': p->Password = 1; break;
10961097
10971098
case 'j': p->RdWiki = 1; break;
1098
- case 'k': p->WrWiki = p->RdWiki = p->ApndWiki =1; break;
1099
+ case 'k': p->WrWiki = p->RdWiki = p->ApndWiki =1; break;
10991100
case 'm': p->ApndWiki = 1; break;
11001101
case 'f': p->NewWiki = 1; break;
11011102
case 'l': p->ModWiki = 1; break;
11021103
11031104
case 'e': p->RdAddr = 1; break;
@@ -1181,11 +1182,11 @@
11811182
/* case 'v': DEVELOPER */
11821183
case 'w': rc = p->WrTkt; break;
11831184
case 'x': rc = p->Private; break;
11841185
/* case 'y': */
11851186
case 'z': rc = p->Zip; break;
1186
- default: rc = 0; break;
1187
+ default: rc = 0; break;
11871188
}
11881189
}
11891190
return rc;
11901191
}
11911192
11921193
--- src/login.c
+++ src/login.c
@@ -1075,29 +1075,30 @@
1075 if(NULL==zCap){
1076 return;
1077 }
1078 for(i=0; zCap[i]; i++){
1079 switch( zCap[i] ){
1080 case 's': p->Setup = 1; /* Fall thru into Admin */
1081 case 'a': p->Admin = p->RdTkt = p->WrTkt = p->Zip =
1082 p->RdWiki = p->WrWiki = p->NewWiki =
1083 p->ApndWiki = p->Hyperlink = p->Clone =
1084 p->NewTkt = p->Password = p->RdAddr =
1085 p->TktFmt = p->Attach = p->ApndTkt =
1086 p->ModWiki = p->ModTkt = 1;
1087 /* Fall thru into Read/Write */
1088 case 'i': p->Read = p->Write = 1; break;
 
1089 case 'o': p->Read = 1; break;
1090 case 'z': p->Zip = 1; break;
1091
1092 case 'd': p->Delete = 1; break;
1093 case 'h': p->Hyperlink = 1; break;
1094 case 'g': p->Clone = 1; break;
1095 case 'p': p->Password = 1; break;
1096
1097 case 'j': p->RdWiki = 1; break;
1098 case 'k': p->WrWiki = p->RdWiki = p->ApndWiki =1; break;
1099 case 'm': p->ApndWiki = 1; break;
1100 case 'f': p->NewWiki = 1; break;
1101 case 'l': p->ModWiki = 1; break;
1102
1103 case 'e': p->RdAddr = 1; break;
@@ -1181,11 +1182,11 @@
1181 /* case 'v': DEVELOPER */
1182 case 'w': rc = p->WrTkt; break;
1183 case 'x': rc = p->Private; break;
1184 /* case 'y': */
1185 case 'z': rc = p->Zip; break;
1186 default: rc = 0; break;
1187 }
1188 }
1189 return rc;
1190 }
1191
1192
--- src/login.c
+++ src/login.c
@@ -1075,29 +1075,30 @@
1075 if(NULL==zCap){
1076 return;
1077 }
1078 for(i=0; zCap[i]; i++){
1079 switch( zCap[i] ){
1080 case 's': p->Setup = 1; /* Fall thru into Admin */
1081 case 'a': p->Admin = p->RdTkt = p->WrTkt = p->Zip =
1082 p->RdWiki = p->WrWiki = p->NewWiki =
1083 p->ApndWiki = p->Hyperlink = p->Clone =
1084 p->NewTkt = p->Password = p->RdAddr =
1085 p->TktFmt = p->Attach = p->ApndTkt =
1086 p->ModWiki = p->ModTkt = p->Delete =
1087 p->Private = 1;
1088 /* Fall thru into Read/Write */
1089 case 'i': p->Read = p->Write = 1; break;
1090 case 'o': p->Read = 1; break;
1091 case 'z': p->Zip = 1; break;
1092
1093 case 'd': p->Delete = 1; break;
1094 case 'h': p->Hyperlink = 1; break;
1095 case 'g': p->Clone = 1; break;
1096 case 'p': p->Password = 1; break;
1097
1098 case 'j': p->RdWiki = 1; break;
1099 case 'k': p->WrWiki = p->RdWiki = p->ApndWiki =1; break;
1100 case 'm': p->ApndWiki = 1; break;
1101 case 'f': p->NewWiki = 1; break;
1102 case 'l': p->ModWiki = 1; break;
1103
1104 case 'e': p->RdAddr = 1; break;
@@ -1181,11 +1182,11 @@
1182 /* case 'v': DEVELOPER */
1183 case 'w': rc = p->WrTkt; break;
1184 case 'x': rc = p->Private; break;
1185 /* case 'y': */
1186 case 'z': rc = p->Zip; break;
1187 default: rc = 0; break;
1188 }
1189 }
1190 return rc;
1191 }
1192
1193
+16 -2
--- src/main.c
+++ src/main.c
@@ -1397,11 +1397,17 @@
13971397
13981398
if( g.zBaseURL!=0 ) return;
13991399
if( zAltBase ){
14001400
int i, n, c;
14011401
g.zTop = g.zBaseURL = mprintf("%s", zAltBase);
1402
- if( memcmp(g.zTop, "http://", 7)!=0 && memcmp(g.zTop,"https://",8)!=0 ){
1402
+ if( memcmp(g.zTop, "http://", 7)==0 ){
1403
+ /* it is HTTP, replace prefix with HTTPS. */
1404
+ g.zHttpsURL = mprintf("https://%s", &g.zTop[7]);
1405
+ }else if( memcmp(g.zTop,"https://",8)==0 ){
1406
+ /* it is already HTTPS, use it. */
1407
+ g.zHttpsURL = mprintf("%s", g.zTop);
1408
+ }else{
14031409
fossil_fatal("argument to --baseurl should be 'http://host/path'"
14041410
" or 'https://host/path'");
14051411
}
14061412
for(i=n=0; (c = g.zTop[i])!=0; i++){
14071413
if( c=='/' ){
@@ -2429,11 +2435,13 @@
24292435
** --create Create a new REPOSITORY if it does not already exist
24302436
** --page PAGE Start "ui" on PAGE. ex: --page "timeline?y=ci"
24312437
** --files GLOBLIST Comma-separated list of glob patterns for static files
24322438
** --localauth enable automatic login for requests from localhost
24332439
** --localhost listen on 127.0.0.1 only (always true for "ui")
2440
+** --https signal a request coming in via https
24342441
** --nojail Drop root privileges but do not enter the chroot jail
2442
+** --nossl signal that no SSL connections are available
24352443
** --notfound URL Redirect
24362444
** -P|--port TCPPORT listen to request on port TCPPORT
24372445
** --th-trace trace TH1 execution (for debugging purposes)
24382446
** --repolist If REPOSITORY is dir, URL "/" lists repos.
24392447
** --scgi Accept SCGI rather than HTTP
@@ -2490,10 +2498,17 @@
24902498
zAltBase = find_option("baseurl", 0, 1);
24912499
fCreate = find_option("create",0,0)!=0;
24922500
if( find_option("scgi", 0, 0)!=0 ) flags |= HTTP_SERVER_SCGI;
24932501
if( zAltBase ){
24942502
set_base_url(zAltBase);
2503
+ }
2504
+ g.sslNotAvailable = find_option("nossl", 0, 0)!=0;
2505
+ if( find_option("https",0,0)!=0 ){
2506
+ cgi_replace_parameter("HTTPS","on");
2507
+ }else{
2508
+ /* without --https, defaults to not available. */
2509
+ g.sslNotAvailable = 1;
24952510
}
24962511
if( find_option("localhost", 0, 0)!=0 ){
24972512
flags |= HTTP_SERVER_LOCALHOST;
24982513
}
24992514
@@ -2551,11 +2566,10 @@
25512566
if( g.localOpen ) flags |= HTTP_SERVER_HAD_CHECKOUT;
25522567
db_close(1);
25532568
if( cgi_http_server(iPort, mxPort, zBrowserCmd, zIpAddr, flags) ){
25542569
fossil_fatal("unable to listen on TCP socket %d", iPort);
25552570
}
2556
- g.sslNotAvailable = 1;
25572571
g.httpIn = stdin;
25582572
g.httpOut = stdout;
25592573
if( g.fHttpTrace || g.fSqlTrace ){
25602574
fprintf(stderr, "====== SERVER pid %d =======\n", getpid());
25612575
}
25622576
--- src/main.c
+++ src/main.c
@@ -1397,11 +1397,17 @@
1397
1398 if( g.zBaseURL!=0 ) return;
1399 if( zAltBase ){
1400 int i, n, c;
1401 g.zTop = g.zBaseURL = mprintf("%s", zAltBase);
1402 if( memcmp(g.zTop, "http://", 7)!=0 && memcmp(g.zTop,"https://",8)!=0 ){
 
 
 
 
 
 
1403 fossil_fatal("argument to --baseurl should be 'http://host/path'"
1404 " or 'https://host/path'");
1405 }
1406 for(i=n=0; (c = g.zTop[i])!=0; i++){
1407 if( c=='/' ){
@@ -2429,11 +2435,13 @@
2429 ** --create Create a new REPOSITORY if it does not already exist
2430 ** --page PAGE Start "ui" on PAGE. ex: --page "timeline?y=ci"
2431 ** --files GLOBLIST Comma-separated list of glob patterns for static files
2432 ** --localauth enable automatic login for requests from localhost
2433 ** --localhost listen on 127.0.0.1 only (always true for "ui")
 
2434 ** --nojail Drop root privileges but do not enter the chroot jail
 
2435 ** --notfound URL Redirect
2436 ** -P|--port TCPPORT listen to request on port TCPPORT
2437 ** --th-trace trace TH1 execution (for debugging purposes)
2438 ** --repolist If REPOSITORY is dir, URL "/" lists repos.
2439 ** --scgi Accept SCGI rather than HTTP
@@ -2490,10 +2498,17 @@
2490 zAltBase = find_option("baseurl", 0, 1);
2491 fCreate = find_option("create",0,0)!=0;
2492 if( find_option("scgi", 0, 0)!=0 ) flags |= HTTP_SERVER_SCGI;
2493 if( zAltBase ){
2494 set_base_url(zAltBase);
 
 
 
 
 
 
 
2495 }
2496 if( find_option("localhost", 0, 0)!=0 ){
2497 flags |= HTTP_SERVER_LOCALHOST;
2498 }
2499
@@ -2551,11 +2566,10 @@
2551 if( g.localOpen ) flags |= HTTP_SERVER_HAD_CHECKOUT;
2552 db_close(1);
2553 if( cgi_http_server(iPort, mxPort, zBrowserCmd, zIpAddr, flags) ){
2554 fossil_fatal("unable to listen on TCP socket %d", iPort);
2555 }
2556 g.sslNotAvailable = 1;
2557 g.httpIn = stdin;
2558 g.httpOut = stdout;
2559 if( g.fHttpTrace || g.fSqlTrace ){
2560 fprintf(stderr, "====== SERVER pid %d =======\n", getpid());
2561 }
2562
--- src/main.c
+++ src/main.c
@@ -1397,11 +1397,17 @@
1397
1398 if( g.zBaseURL!=0 ) return;
1399 if( zAltBase ){
1400 int i, n, c;
1401 g.zTop = g.zBaseURL = mprintf("%s", zAltBase);
1402 if( memcmp(g.zTop, "http://", 7)==0 ){
1403 /* it is HTTP, replace prefix with HTTPS. */
1404 g.zHttpsURL = mprintf("https://%s", &g.zTop[7]);
1405 }else if( memcmp(g.zTop,"https://",8)==0 ){
1406 /* it is already HTTPS, use it. */
1407 g.zHttpsURL = mprintf("%s", g.zTop);
1408 }else{
1409 fossil_fatal("argument to --baseurl should be 'http://host/path'"
1410 " or 'https://host/path'");
1411 }
1412 for(i=n=0; (c = g.zTop[i])!=0; i++){
1413 if( c=='/' ){
@@ -2429,11 +2435,13 @@
2435 ** --create Create a new REPOSITORY if it does not already exist
2436 ** --page PAGE Start "ui" on PAGE. ex: --page "timeline?y=ci"
2437 ** --files GLOBLIST Comma-separated list of glob patterns for static files
2438 ** --localauth enable automatic login for requests from localhost
2439 ** --localhost listen on 127.0.0.1 only (always true for "ui")
2440 ** --https signal a request coming in via https
2441 ** --nojail Drop root privileges but do not enter the chroot jail
2442 ** --nossl signal that no SSL connections are available
2443 ** --notfound URL Redirect
2444 ** -P|--port TCPPORT listen to request on port TCPPORT
2445 ** --th-trace trace TH1 execution (for debugging purposes)
2446 ** --repolist If REPOSITORY is dir, URL "/" lists repos.
2447 ** --scgi Accept SCGI rather than HTTP
@@ -2490,10 +2498,17 @@
2498 zAltBase = find_option("baseurl", 0, 1);
2499 fCreate = find_option("create",0,0)!=0;
2500 if( find_option("scgi", 0, 0)!=0 ) flags |= HTTP_SERVER_SCGI;
2501 if( zAltBase ){
2502 set_base_url(zAltBase);
2503 }
2504 g.sslNotAvailable = find_option("nossl", 0, 0)!=0;
2505 if( find_option("https",0,0)!=0 ){
2506 cgi_replace_parameter("HTTPS","on");
2507 }else{
2508 /* without --https, defaults to not available. */
2509 g.sslNotAvailable = 1;
2510 }
2511 if( find_option("localhost", 0, 0)!=0 ){
2512 flags |= HTTP_SERVER_LOCALHOST;
2513 }
2514
@@ -2551,11 +2566,10 @@
2566 if( g.localOpen ) flags |= HTTP_SERVER_HAD_CHECKOUT;
2567 db_close(1);
2568 if( cgi_http_server(iPort, mxPort, zBrowserCmd, zIpAddr, flags) ){
2569 fossil_fatal("unable to listen on TCP socket %d", iPort);
2570 }
 
2571 g.httpIn = stdin;
2572 g.httpOut = stdout;
2573 if( g.fHttpTrace || g.fSqlTrace ){
2574 fprintf(stderr, "====== SERVER pid %d =======\n", getpid());
2575 }
2576
+16 -2
--- src/main.c
+++ src/main.c
@@ -1397,11 +1397,17 @@
13971397
13981398
if( g.zBaseURL!=0 ) return;
13991399
if( zAltBase ){
14001400
int i, n, c;
14011401
g.zTop = g.zBaseURL = mprintf("%s", zAltBase);
1402
- if( memcmp(g.zTop, "http://", 7)!=0 && memcmp(g.zTop,"https://",8)!=0 ){
1402
+ if( memcmp(g.zTop, "http://", 7)==0 ){
1403
+ /* it is HTTP, replace prefix with HTTPS. */
1404
+ g.zHttpsURL = mprintf("https://%s", &g.zTop[7]);
1405
+ }else if( memcmp(g.zTop,"https://",8)==0 ){
1406
+ /* it is already HTTPS, use it. */
1407
+ g.zHttpsURL = mprintf("%s", g.zTop);
1408
+ }else{
14031409
fossil_fatal("argument to --baseurl should be 'http://host/path'"
14041410
" or 'https://host/path'");
14051411
}
14061412
for(i=n=0; (c = g.zTop[i])!=0; i++){
14071413
if( c=='/' ){
@@ -2429,11 +2435,13 @@
24292435
** --create Create a new REPOSITORY if it does not already exist
24302436
** --page PAGE Start "ui" on PAGE. ex: --page "timeline?y=ci"
24312437
** --files GLOBLIST Comma-separated list of glob patterns for static files
24322438
** --localauth enable automatic login for requests from localhost
24332439
** --localhost listen on 127.0.0.1 only (always true for "ui")
2440
+** --https signal a request coming in via https
24342441
** --nojail Drop root privileges but do not enter the chroot jail
2442
+** --nossl signal that no SSL connections are available
24352443
** --notfound URL Redirect
24362444
** -P|--port TCPPORT listen to request on port TCPPORT
24372445
** --th-trace trace TH1 execution (for debugging purposes)
24382446
** --repolist If REPOSITORY is dir, URL "/" lists repos.
24392447
** --scgi Accept SCGI rather than HTTP
@@ -2490,10 +2498,17 @@
24902498
zAltBase = find_option("baseurl", 0, 1);
24912499
fCreate = find_option("create",0,0)!=0;
24922500
if( find_option("scgi", 0, 0)!=0 ) flags |= HTTP_SERVER_SCGI;
24932501
if( zAltBase ){
24942502
set_base_url(zAltBase);
2503
+ }
2504
+ g.sslNotAvailable = find_option("nossl", 0, 0)!=0;
2505
+ if( find_option("https",0,0)!=0 ){
2506
+ cgi_replace_parameter("HTTPS","on");
2507
+ }else{
2508
+ /* without --https, defaults to not available. */
2509
+ g.sslNotAvailable = 1;
24952510
}
24962511
if( find_option("localhost", 0, 0)!=0 ){
24972512
flags |= HTTP_SERVER_LOCALHOST;
24982513
}
24992514
@@ -2551,11 +2566,10 @@
25512566
if( g.localOpen ) flags |= HTTP_SERVER_HAD_CHECKOUT;
25522567
db_close(1);
25532568
if( cgi_http_server(iPort, mxPort, zBrowserCmd, zIpAddr, flags) ){
25542569
fossil_fatal("unable to listen on TCP socket %d", iPort);
25552570
}
2556
- g.sslNotAvailable = 1;
25572571
g.httpIn = stdin;
25582572
g.httpOut = stdout;
25592573
if( g.fHttpTrace || g.fSqlTrace ){
25602574
fprintf(stderr, "====== SERVER pid %d =======\n", getpid());
25612575
}
25622576
--- src/main.c
+++ src/main.c
@@ -1397,11 +1397,17 @@
1397
1398 if( g.zBaseURL!=0 ) return;
1399 if( zAltBase ){
1400 int i, n, c;
1401 g.zTop = g.zBaseURL = mprintf("%s", zAltBase);
1402 if( memcmp(g.zTop, "http://", 7)!=0 && memcmp(g.zTop,"https://",8)!=0 ){
 
 
 
 
 
 
1403 fossil_fatal("argument to --baseurl should be 'http://host/path'"
1404 " or 'https://host/path'");
1405 }
1406 for(i=n=0; (c = g.zTop[i])!=0; i++){
1407 if( c=='/' ){
@@ -2429,11 +2435,13 @@
2429 ** --create Create a new REPOSITORY if it does not already exist
2430 ** --page PAGE Start "ui" on PAGE. ex: --page "timeline?y=ci"
2431 ** --files GLOBLIST Comma-separated list of glob patterns for static files
2432 ** --localauth enable automatic login for requests from localhost
2433 ** --localhost listen on 127.0.0.1 only (always true for "ui")
 
2434 ** --nojail Drop root privileges but do not enter the chroot jail
 
2435 ** --notfound URL Redirect
2436 ** -P|--port TCPPORT listen to request on port TCPPORT
2437 ** --th-trace trace TH1 execution (for debugging purposes)
2438 ** --repolist If REPOSITORY is dir, URL "/" lists repos.
2439 ** --scgi Accept SCGI rather than HTTP
@@ -2490,10 +2498,17 @@
2490 zAltBase = find_option("baseurl", 0, 1);
2491 fCreate = find_option("create",0,0)!=0;
2492 if( find_option("scgi", 0, 0)!=0 ) flags |= HTTP_SERVER_SCGI;
2493 if( zAltBase ){
2494 set_base_url(zAltBase);
 
 
 
 
 
 
 
2495 }
2496 if( find_option("localhost", 0, 0)!=0 ){
2497 flags |= HTTP_SERVER_LOCALHOST;
2498 }
2499
@@ -2551,11 +2566,10 @@
2551 if( g.localOpen ) flags |= HTTP_SERVER_HAD_CHECKOUT;
2552 db_close(1);
2553 if( cgi_http_server(iPort, mxPort, zBrowserCmd, zIpAddr, flags) ){
2554 fossil_fatal("unable to listen on TCP socket %d", iPort);
2555 }
2556 g.sslNotAvailable = 1;
2557 g.httpIn = stdin;
2558 g.httpOut = stdout;
2559 if( g.fHttpTrace || g.fSqlTrace ){
2560 fprintf(stderr, "====== SERVER pid %d =======\n", getpid());
2561 }
2562
--- src/main.c
+++ src/main.c
@@ -1397,11 +1397,17 @@
1397
1398 if( g.zBaseURL!=0 ) return;
1399 if( zAltBase ){
1400 int i, n, c;
1401 g.zTop = g.zBaseURL = mprintf("%s", zAltBase);
1402 if( memcmp(g.zTop, "http://", 7)==0 ){
1403 /* it is HTTP, replace prefix with HTTPS. */
1404 g.zHttpsURL = mprintf("https://%s", &g.zTop[7]);
1405 }else if( memcmp(g.zTop,"https://",8)==0 ){
1406 /* it is already HTTPS, use it. */
1407 g.zHttpsURL = mprintf("%s", g.zTop);
1408 }else{
1409 fossil_fatal("argument to --baseurl should be 'http://host/path'"
1410 " or 'https://host/path'");
1411 }
1412 for(i=n=0; (c = g.zTop[i])!=0; i++){
1413 if( c=='/' ){
@@ -2429,11 +2435,13 @@
2435 ** --create Create a new REPOSITORY if it does not already exist
2436 ** --page PAGE Start "ui" on PAGE. ex: --page "timeline?y=ci"
2437 ** --files GLOBLIST Comma-separated list of glob patterns for static files
2438 ** --localauth enable automatic login for requests from localhost
2439 ** --localhost listen on 127.0.0.1 only (always true for "ui")
2440 ** --https signal a request coming in via https
2441 ** --nojail Drop root privileges but do not enter the chroot jail
2442 ** --nossl signal that no SSL connections are available
2443 ** --notfound URL Redirect
2444 ** -P|--port TCPPORT listen to request on port TCPPORT
2445 ** --th-trace trace TH1 execution (for debugging purposes)
2446 ** --repolist If REPOSITORY is dir, URL "/" lists repos.
2447 ** --scgi Accept SCGI rather than HTTP
@@ -2490,10 +2498,17 @@
2498 zAltBase = find_option("baseurl", 0, 1);
2499 fCreate = find_option("create",0,0)!=0;
2500 if( find_option("scgi", 0, 0)!=0 ) flags |= HTTP_SERVER_SCGI;
2501 if( zAltBase ){
2502 set_base_url(zAltBase);
2503 }
2504 g.sslNotAvailable = find_option("nossl", 0, 0)!=0;
2505 if( find_option("https",0,0)!=0 ){
2506 cgi_replace_parameter("HTTPS","on");
2507 }else{
2508 /* without --https, defaults to not available. */
2509 g.sslNotAvailable = 1;
2510 }
2511 if( find_option("localhost", 0, 0)!=0 ){
2512 flags |= HTTP_SERVER_LOCALHOST;
2513 }
2514
@@ -2551,11 +2566,10 @@
2566 if( g.localOpen ) flags |= HTTP_SERVER_HAD_CHECKOUT;
2567 db_close(1);
2568 if( cgi_http_server(iPort, mxPort, zBrowserCmd, zIpAddr, flags) ){
2569 fossil_fatal("unable to listen on TCP socket %d", iPort);
2570 }
 
2571 g.httpIn = stdin;
2572 g.httpOut = stdout;
2573 if( g.fHttpTrace || g.fSqlTrace ){
2574 fprintf(stderr, "====== SERVER pid %d =======\n", getpid());
2575 }
2576
+16 -2
--- src/main.c
+++ src/main.c
@@ -1397,11 +1397,17 @@
13971397
13981398
if( g.zBaseURL!=0 ) return;
13991399
if( zAltBase ){
14001400
int i, n, c;
14011401
g.zTop = g.zBaseURL = mprintf("%s", zAltBase);
1402
- if( memcmp(g.zTop, "http://", 7)!=0 && memcmp(g.zTop,"https://",8)!=0 ){
1402
+ if( memcmp(g.zTop, "http://", 7)==0 ){
1403
+ /* it is HTTP, replace prefix with HTTPS. */
1404
+ g.zHttpsURL = mprintf("https://%s", &g.zTop[7]);
1405
+ }else if( memcmp(g.zTop,"https://",8)==0 ){
1406
+ /* it is already HTTPS, use it. */
1407
+ g.zHttpsURL = mprintf("%s", g.zTop);
1408
+ }else{
14031409
fossil_fatal("argument to --baseurl should be 'http://host/path'"
14041410
" or 'https://host/path'");
14051411
}
14061412
for(i=n=0; (c = g.zTop[i])!=0; i++){
14071413
if( c=='/' ){
@@ -2429,11 +2435,13 @@
24292435
** --create Create a new REPOSITORY if it does not already exist
24302436
** --page PAGE Start "ui" on PAGE. ex: --page "timeline?y=ci"
24312437
** --files GLOBLIST Comma-separated list of glob patterns for static files
24322438
** --localauth enable automatic login for requests from localhost
24332439
** --localhost listen on 127.0.0.1 only (always true for "ui")
2440
+** --https signal a request coming in via https
24342441
** --nojail Drop root privileges but do not enter the chroot jail
2442
+** --nossl signal that no SSL connections are available
24352443
** --notfound URL Redirect
24362444
** -P|--port TCPPORT listen to request on port TCPPORT
24372445
** --th-trace trace TH1 execution (for debugging purposes)
24382446
** --repolist If REPOSITORY is dir, URL "/" lists repos.
24392447
** --scgi Accept SCGI rather than HTTP
@@ -2490,10 +2498,17 @@
24902498
zAltBase = find_option("baseurl", 0, 1);
24912499
fCreate = find_option("create",0,0)!=0;
24922500
if( find_option("scgi", 0, 0)!=0 ) flags |= HTTP_SERVER_SCGI;
24932501
if( zAltBase ){
24942502
set_base_url(zAltBase);
2503
+ }
2504
+ g.sslNotAvailable = find_option("nossl", 0, 0)!=0;
2505
+ if( find_option("https",0,0)!=0 ){
2506
+ cgi_replace_parameter("HTTPS","on");
2507
+ }else{
2508
+ /* without --https, defaults to not available. */
2509
+ g.sslNotAvailable = 1;
24952510
}
24962511
if( find_option("localhost", 0, 0)!=0 ){
24972512
flags |= HTTP_SERVER_LOCALHOST;
24982513
}
24992514
@@ -2551,11 +2566,10 @@
25512566
if( g.localOpen ) flags |= HTTP_SERVER_HAD_CHECKOUT;
25522567
db_close(1);
25532568
if( cgi_http_server(iPort, mxPort, zBrowserCmd, zIpAddr, flags) ){
25542569
fossil_fatal("unable to listen on TCP socket %d", iPort);
25552570
}
2556
- g.sslNotAvailable = 1;
25572571
g.httpIn = stdin;
25582572
g.httpOut = stdout;
25592573
if( g.fHttpTrace || g.fSqlTrace ){
25602574
fprintf(stderr, "====== SERVER pid %d =======\n", getpid());
25612575
}
25622576
--- src/main.c
+++ src/main.c
@@ -1397,11 +1397,17 @@
1397
1398 if( g.zBaseURL!=0 ) return;
1399 if( zAltBase ){
1400 int i, n, c;
1401 g.zTop = g.zBaseURL = mprintf("%s", zAltBase);
1402 if( memcmp(g.zTop, "http://", 7)!=0 && memcmp(g.zTop,"https://",8)!=0 ){
 
 
 
 
 
 
1403 fossil_fatal("argument to --baseurl should be 'http://host/path'"
1404 " or 'https://host/path'");
1405 }
1406 for(i=n=0; (c = g.zTop[i])!=0; i++){
1407 if( c=='/' ){
@@ -2429,11 +2435,13 @@
2429 ** --create Create a new REPOSITORY if it does not already exist
2430 ** --page PAGE Start "ui" on PAGE. ex: --page "timeline?y=ci"
2431 ** --files GLOBLIST Comma-separated list of glob patterns for static files
2432 ** --localauth enable automatic login for requests from localhost
2433 ** --localhost listen on 127.0.0.1 only (always true for "ui")
 
2434 ** --nojail Drop root privileges but do not enter the chroot jail
 
2435 ** --notfound URL Redirect
2436 ** -P|--port TCPPORT listen to request on port TCPPORT
2437 ** --th-trace trace TH1 execution (for debugging purposes)
2438 ** --repolist If REPOSITORY is dir, URL "/" lists repos.
2439 ** --scgi Accept SCGI rather than HTTP
@@ -2490,10 +2498,17 @@
2490 zAltBase = find_option("baseurl", 0, 1);
2491 fCreate = find_option("create",0,0)!=0;
2492 if( find_option("scgi", 0, 0)!=0 ) flags |= HTTP_SERVER_SCGI;
2493 if( zAltBase ){
2494 set_base_url(zAltBase);
 
 
 
 
 
 
 
2495 }
2496 if( find_option("localhost", 0, 0)!=0 ){
2497 flags |= HTTP_SERVER_LOCALHOST;
2498 }
2499
@@ -2551,11 +2566,10 @@
2551 if( g.localOpen ) flags |= HTTP_SERVER_HAD_CHECKOUT;
2552 db_close(1);
2553 if( cgi_http_server(iPort, mxPort, zBrowserCmd, zIpAddr, flags) ){
2554 fossil_fatal("unable to listen on TCP socket %d", iPort);
2555 }
2556 g.sslNotAvailable = 1;
2557 g.httpIn = stdin;
2558 g.httpOut = stdout;
2559 if( g.fHttpTrace || g.fSqlTrace ){
2560 fprintf(stderr, "====== SERVER pid %d =======\n", getpid());
2561 }
2562
--- src/main.c
+++ src/main.c
@@ -1397,11 +1397,17 @@
1397
1398 if( g.zBaseURL!=0 ) return;
1399 if( zAltBase ){
1400 int i, n, c;
1401 g.zTop = g.zBaseURL = mprintf("%s", zAltBase);
1402 if( memcmp(g.zTop, "http://", 7)==0 ){
1403 /* it is HTTP, replace prefix with HTTPS. */
1404 g.zHttpsURL = mprintf("https://%s", &g.zTop[7]);
1405 }else if( memcmp(g.zTop,"https://",8)==0 ){
1406 /* it is already HTTPS, use it. */
1407 g.zHttpsURL = mprintf("%s", g.zTop);
1408 }else{
1409 fossil_fatal("argument to --baseurl should be 'http://host/path'"
1410 " or 'https://host/path'");
1411 }
1412 for(i=n=0; (c = g.zTop[i])!=0; i++){
1413 if( c=='/' ){
@@ -2429,11 +2435,13 @@
2435 ** --create Create a new REPOSITORY if it does not already exist
2436 ** --page PAGE Start "ui" on PAGE. ex: --page "timeline?y=ci"
2437 ** --files GLOBLIST Comma-separated list of glob patterns for static files
2438 ** --localauth enable automatic login for requests from localhost
2439 ** --localhost listen on 127.0.0.1 only (always true for "ui")
2440 ** --https signal a request coming in via https
2441 ** --nojail Drop root privileges but do not enter the chroot jail
2442 ** --nossl signal that no SSL connections are available
2443 ** --notfound URL Redirect
2444 ** -P|--port TCPPORT listen to request on port TCPPORT
2445 ** --th-trace trace TH1 execution (for debugging purposes)
2446 ** --repolist If REPOSITORY is dir, URL "/" lists repos.
2447 ** --scgi Accept SCGI rather than HTTP
@@ -2490,10 +2498,17 @@
2498 zAltBase = find_option("baseurl", 0, 1);
2499 fCreate = find_option("create",0,0)!=0;
2500 if( find_option("scgi", 0, 0)!=0 ) flags |= HTTP_SERVER_SCGI;
2501 if( zAltBase ){
2502 set_base_url(zAltBase);
2503 }
2504 g.sslNotAvailable = find_option("nossl", 0, 0)!=0;
2505 if( find_option("https",0,0)!=0 ){
2506 cgi_replace_parameter("HTTPS","on");
2507 }else{
2508 /* without --https, defaults to not available. */
2509 g.sslNotAvailable = 1;
2510 }
2511 if( find_option("localhost", 0, 0)!=0 ){
2512 flags |= HTTP_SERVER_LOCALHOST;
2513 }
2514
@@ -2551,11 +2566,10 @@
2566 if( g.localOpen ) flags |= HTTP_SERVER_HAD_CHECKOUT;
2567 db_close(1);
2568 if( cgi_http_server(iPort, mxPort, zBrowserCmd, zIpAddr, flags) ){
2569 fossil_fatal("unable to listen on TCP socket %d", iPort);
2570 }
 
2571 g.httpIn = stdin;
2572 g.httpOut = stdout;
2573 if( g.fHttpTrace || g.fSqlTrace ){
2574 fprintf(stderr, "====== SERVER pid %d =======\n", getpid());
2575 }
2576
+16 -2
--- src/main.c
+++ src/main.c
@@ -1397,11 +1397,17 @@
13971397
13981398
if( g.zBaseURL!=0 ) return;
13991399
if( zAltBase ){
14001400
int i, n, c;
14011401
g.zTop = g.zBaseURL = mprintf("%s", zAltBase);
1402
- if( memcmp(g.zTop, "http://", 7)!=0 && memcmp(g.zTop,"https://",8)!=0 ){
1402
+ if( memcmp(g.zTop, "http://", 7)==0 ){
1403
+ /* it is HTTP, replace prefix with HTTPS. */
1404
+ g.zHttpsURL = mprintf("https://%s", &g.zTop[7]);
1405
+ }else if( memcmp(g.zTop,"https://",8)==0 ){
1406
+ /* it is already HTTPS, use it. */
1407
+ g.zHttpsURL = mprintf("%s", g.zTop);
1408
+ }else{
14031409
fossil_fatal("argument to --baseurl should be 'http://host/path'"
14041410
" or 'https://host/path'");
14051411
}
14061412
for(i=n=0; (c = g.zTop[i])!=0; i++){
14071413
if( c=='/' ){
@@ -2429,11 +2435,13 @@
24292435
** --create Create a new REPOSITORY if it does not already exist
24302436
** --page PAGE Start "ui" on PAGE. ex: --page "timeline?y=ci"
24312437
** --files GLOBLIST Comma-separated list of glob patterns for static files
24322438
** --localauth enable automatic login for requests from localhost
24332439
** --localhost listen on 127.0.0.1 only (always true for "ui")
2440
+** --https signal a request coming in via https
24342441
** --nojail Drop root privileges but do not enter the chroot jail
2442
+** --nossl signal that no SSL connections are available
24352443
** --notfound URL Redirect
24362444
** -P|--port TCPPORT listen to request on port TCPPORT
24372445
** --th-trace trace TH1 execution (for debugging purposes)
24382446
** --repolist If REPOSITORY is dir, URL "/" lists repos.
24392447
** --scgi Accept SCGI rather than HTTP
@@ -2490,10 +2498,17 @@
24902498
zAltBase = find_option("baseurl", 0, 1);
24912499
fCreate = find_option("create",0,0)!=0;
24922500
if( find_option("scgi", 0, 0)!=0 ) flags |= HTTP_SERVER_SCGI;
24932501
if( zAltBase ){
24942502
set_base_url(zAltBase);
2503
+ }
2504
+ g.sslNotAvailable = find_option("nossl", 0, 0)!=0;
2505
+ if( find_option("https",0,0)!=0 ){
2506
+ cgi_replace_parameter("HTTPS","on");
2507
+ }else{
2508
+ /* without --https, defaults to not available. */
2509
+ g.sslNotAvailable = 1;
24952510
}
24962511
if( find_option("localhost", 0, 0)!=0 ){
24972512
flags |= HTTP_SERVER_LOCALHOST;
24982513
}
24992514
@@ -2551,11 +2566,10 @@
25512566
if( g.localOpen ) flags |= HTTP_SERVER_HAD_CHECKOUT;
25522567
db_close(1);
25532568
if( cgi_http_server(iPort, mxPort, zBrowserCmd, zIpAddr, flags) ){
25542569
fossil_fatal("unable to listen on TCP socket %d", iPort);
25552570
}
2556
- g.sslNotAvailable = 1;
25572571
g.httpIn = stdin;
25582572
g.httpOut = stdout;
25592573
if( g.fHttpTrace || g.fSqlTrace ){
25602574
fprintf(stderr, "====== SERVER pid %d =======\n", getpid());
25612575
}
25622576
--- src/main.c
+++ src/main.c
@@ -1397,11 +1397,17 @@
1397
1398 if( g.zBaseURL!=0 ) return;
1399 if( zAltBase ){
1400 int i, n, c;
1401 g.zTop = g.zBaseURL = mprintf("%s", zAltBase);
1402 if( memcmp(g.zTop, "http://", 7)!=0 && memcmp(g.zTop,"https://",8)!=0 ){
 
 
 
 
 
 
1403 fossil_fatal("argument to --baseurl should be 'http://host/path'"
1404 " or 'https://host/path'");
1405 }
1406 for(i=n=0; (c = g.zTop[i])!=0; i++){
1407 if( c=='/' ){
@@ -2429,11 +2435,13 @@
2429 ** --create Create a new REPOSITORY if it does not already exist
2430 ** --page PAGE Start "ui" on PAGE. ex: --page "timeline?y=ci"
2431 ** --files GLOBLIST Comma-separated list of glob patterns for static files
2432 ** --localauth enable automatic login for requests from localhost
2433 ** --localhost listen on 127.0.0.1 only (always true for "ui")
 
2434 ** --nojail Drop root privileges but do not enter the chroot jail
 
2435 ** --notfound URL Redirect
2436 ** -P|--port TCPPORT listen to request on port TCPPORT
2437 ** --th-trace trace TH1 execution (for debugging purposes)
2438 ** --repolist If REPOSITORY is dir, URL "/" lists repos.
2439 ** --scgi Accept SCGI rather than HTTP
@@ -2490,10 +2498,17 @@
2490 zAltBase = find_option("baseurl", 0, 1);
2491 fCreate = find_option("create",0,0)!=0;
2492 if( find_option("scgi", 0, 0)!=0 ) flags |= HTTP_SERVER_SCGI;
2493 if( zAltBase ){
2494 set_base_url(zAltBase);
 
 
 
 
 
 
 
2495 }
2496 if( find_option("localhost", 0, 0)!=0 ){
2497 flags |= HTTP_SERVER_LOCALHOST;
2498 }
2499
@@ -2551,11 +2566,10 @@
2551 if( g.localOpen ) flags |= HTTP_SERVER_HAD_CHECKOUT;
2552 db_close(1);
2553 if( cgi_http_server(iPort, mxPort, zBrowserCmd, zIpAddr, flags) ){
2554 fossil_fatal("unable to listen on TCP socket %d", iPort);
2555 }
2556 g.sslNotAvailable = 1;
2557 g.httpIn = stdin;
2558 g.httpOut = stdout;
2559 if( g.fHttpTrace || g.fSqlTrace ){
2560 fprintf(stderr, "====== SERVER pid %d =======\n", getpid());
2561 }
2562
--- src/main.c
+++ src/main.c
@@ -1397,11 +1397,17 @@
1397
1398 if( g.zBaseURL!=0 ) return;
1399 if( zAltBase ){
1400 int i, n, c;
1401 g.zTop = g.zBaseURL = mprintf("%s", zAltBase);
1402 if( memcmp(g.zTop, "http://", 7)==0 ){
1403 /* it is HTTP, replace prefix with HTTPS. */
1404 g.zHttpsURL = mprintf("https://%s", &g.zTop[7]);
1405 }else if( memcmp(g.zTop,"https://",8)==0 ){
1406 /* it is already HTTPS, use it. */
1407 g.zHttpsURL = mprintf("%s", g.zTop);
1408 }else{
1409 fossil_fatal("argument to --baseurl should be 'http://host/path'"
1410 " or 'https://host/path'");
1411 }
1412 for(i=n=0; (c = g.zTop[i])!=0; i++){
1413 if( c=='/' ){
@@ -2429,11 +2435,13 @@
2435 ** --create Create a new REPOSITORY if it does not already exist
2436 ** --page PAGE Start "ui" on PAGE. ex: --page "timeline?y=ci"
2437 ** --files GLOBLIST Comma-separated list of glob patterns for static files
2438 ** --localauth enable automatic login for requests from localhost
2439 ** --localhost listen on 127.0.0.1 only (always true for "ui")
2440 ** --https signal a request coming in via https
2441 ** --nojail Drop root privileges but do not enter the chroot jail
2442 ** --nossl signal that no SSL connections are available
2443 ** --notfound URL Redirect
2444 ** -P|--port TCPPORT listen to request on port TCPPORT
2445 ** --th-trace trace TH1 execution (for debugging purposes)
2446 ** --repolist If REPOSITORY is dir, URL "/" lists repos.
2447 ** --scgi Accept SCGI rather than HTTP
@@ -2490,10 +2498,17 @@
2498 zAltBase = find_option("baseurl", 0, 1);
2499 fCreate = find_option("create",0,0)!=0;
2500 if( find_option("scgi", 0, 0)!=0 ) flags |= HTTP_SERVER_SCGI;
2501 if( zAltBase ){
2502 set_base_url(zAltBase);
2503 }
2504 g.sslNotAvailable = find_option("nossl", 0, 0)!=0;
2505 if( find_option("https",0,0)!=0 ){
2506 cgi_replace_parameter("HTTPS","on");
2507 }else{
2508 /* without --https, defaults to not available. */
2509 g.sslNotAvailable = 1;
2510 }
2511 if( find_option("localhost", 0, 0)!=0 ){
2512 flags |= HTTP_SERVER_LOCALHOST;
2513 }
2514
@@ -2551,11 +2566,10 @@
2566 if( g.localOpen ) flags |= HTTP_SERVER_HAD_CHECKOUT;
2567 db_close(1);
2568 if( cgi_http_server(iPort, mxPort, zBrowserCmd, zIpAddr, flags) ){
2569 fossil_fatal("unable to listen on TCP socket %d", iPort);
2570 }
 
2571 g.httpIn = stdin;
2572 g.httpOut = stdout;
2573 if( g.fHttpTrace || g.fSqlTrace ){
2574 fprintf(stderr, "====== SERVER pid %d =======\n", getpid());
2575 }
2576
+16 -2
--- src/main.c
+++ src/main.c
@@ -1397,11 +1397,17 @@
13971397
13981398
if( g.zBaseURL!=0 ) return;
13991399
if( zAltBase ){
14001400
int i, n, c;
14011401
g.zTop = g.zBaseURL = mprintf("%s", zAltBase);
1402
- if( memcmp(g.zTop, "http://", 7)!=0 && memcmp(g.zTop,"https://",8)!=0 ){
1402
+ if( memcmp(g.zTop, "http://", 7)==0 ){
1403
+ /* it is HTTP, replace prefix with HTTPS. */
1404
+ g.zHttpsURL = mprintf("https://%s", &g.zTop[7]);
1405
+ }else if( memcmp(g.zTop,"https://",8)==0 ){
1406
+ /* it is already HTTPS, use it. */
1407
+ g.zHttpsURL = mprintf("%s", g.zTop);
1408
+ }else{
14031409
fossil_fatal("argument to --baseurl should be 'http://host/path'"
14041410
" or 'https://host/path'");
14051411
}
14061412
for(i=n=0; (c = g.zTop[i])!=0; i++){
14071413
if( c=='/' ){
@@ -2429,11 +2435,13 @@
24292435
** --create Create a new REPOSITORY if it does not already exist
24302436
** --page PAGE Start "ui" on PAGE. ex: --page "timeline?y=ci"
24312437
** --files GLOBLIST Comma-separated list of glob patterns for static files
24322438
** --localauth enable automatic login for requests from localhost
24332439
** --localhost listen on 127.0.0.1 only (always true for "ui")
2440
+** --https signal a request coming in via https
24342441
** --nojail Drop root privileges but do not enter the chroot jail
2442
+** --nossl signal that no SSL connections are available
24352443
** --notfound URL Redirect
24362444
** -P|--port TCPPORT listen to request on port TCPPORT
24372445
** --th-trace trace TH1 execution (for debugging purposes)
24382446
** --repolist If REPOSITORY is dir, URL "/" lists repos.
24392447
** --scgi Accept SCGI rather than HTTP
@@ -2490,10 +2498,17 @@
24902498
zAltBase = find_option("baseurl", 0, 1);
24912499
fCreate = find_option("create",0,0)!=0;
24922500
if( find_option("scgi", 0, 0)!=0 ) flags |= HTTP_SERVER_SCGI;
24932501
if( zAltBase ){
24942502
set_base_url(zAltBase);
2503
+ }
2504
+ g.sslNotAvailable = find_option("nossl", 0, 0)!=0;
2505
+ if( find_option("https",0,0)!=0 ){
2506
+ cgi_replace_parameter("HTTPS","on");
2507
+ }else{
2508
+ /* without --https, defaults to not available. */
2509
+ g.sslNotAvailable = 1;
24952510
}
24962511
if( find_option("localhost", 0, 0)!=0 ){
24972512
flags |= HTTP_SERVER_LOCALHOST;
24982513
}
24992514
@@ -2551,11 +2566,10 @@
25512566
if( g.localOpen ) flags |= HTTP_SERVER_HAD_CHECKOUT;
25522567
db_close(1);
25532568
if( cgi_http_server(iPort, mxPort, zBrowserCmd, zIpAddr, flags) ){
25542569
fossil_fatal("unable to listen on TCP socket %d", iPort);
25552570
}
2556
- g.sslNotAvailable = 1;
25572571
g.httpIn = stdin;
25582572
g.httpOut = stdout;
25592573
if( g.fHttpTrace || g.fSqlTrace ){
25602574
fprintf(stderr, "====== SERVER pid %d =======\n", getpid());
25612575
}
25622576
--- src/main.c
+++ src/main.c
@@ -1397,11 +1397,17 @@
1397
1398 if( g.zBaseURL!=0 ) return;
1399 if( zAltBase ){
1400 int i, n, c;
1401 g.zTop = g.zBaseURL = mprintf("%s", zAltBase);
1402 if( memcmp(g.zTop, "http://", 7)!=0 && memcmp(g.zTop,"https://",8)!=0 ){
 
 
 
 
 
 
1403 fossil_fatal("argument to --baseurl should be 'http://host/path'"
1404 " or 'https://host/path'");
1405 }
1406 for(i=n=0; (c = g.zTop[i])!=0; i++){
1407 if( c=='/' ){
@@ -2429,11 +2435,13 @@
2429 ** --create Create a new REPOSITORY if it does not already exist
2430 ** --page PAGE Start "ui" on PAGE. ex: --page "timeline?y=ci"
2431 ** --files GLOBLIST Comma-separated list of glob patterns for static files
2432 ** --localauth enable automatic login for requests from localhost
2433 ** --localhost listen on 127.0.0.1 only (always true for "ui")
 
2434 ** --nojail Drop root privileges but do not enter the chroot jail
 
2435 ** --notfound URL Redirect
2436 ** -P|--port TCPPORT listen to request on port TCPPORT
2437 ** --th-trace trace TH1 execution (for debugging purposes)
2438 ** --repolist If REPOSITORY is dir, URL "/" lists repos.
2439 ** --scgi Accept SCGI rather than HTTP
@@ -2490,10 +2498,17 @@
2490 zAltBase = find_option("baseurl", 0, 1);
2491 fCreate = find_option("create",0,0)!=0;
2492 if( find_option("scgi", 0, 0)!=0 ) flags |= HTTP_SERVER_SCGI;
2493 if( zAltBase ){
2494 set_base_url(zAltBase);
 
 
 
 
 
 
 
2495 }
2496 if( find_option("localhost", 0, 0)!=0 ){
2497 flags |= HTTP_SERVER_LOCALHOST;
2498 }
2499
@@ -2551,11 +2566,10 @@
2551 if( g.localOpen ) flags |= HTTP_SERVER_HAD_CHECKOUT;
2552 db_close(1);
2553 if( cgi_http_server(iPort, mxPort, zBrowserCmd, zIpAddr, flags) ){
2554 fossil_fatal("unable to listen on TCP socket %d", iPort);
2555 }
2556 g.sslNotAvailable = 1;
2557 g.httpIn = stdin;
2558 g.httpOut = stdout;
2559 if( g.fHttpTrace || g.fSqlTrace ){
2560 fprintf(stderr, "====== SERVER pid %d =======\n", getpid());
2561 }
2562
--- src/main.c
+++ src/main.c
@@ -1397,11 +1397,17 @@
1397
1398 if( g.zBaseURL!=0 ) return;
1399 if( zAltBase ){
1400 int i, n, c;
1401 g.zTop = g.zBaseURL = mprintf("%s", zAltBase);
1402 if( memcmp(g.zTop, "http://", 7)==0 ){
1403 /* it is HTTP, replace prefix with HTTPS. */
1404 g.zHttpsURL = mprintf("https://%s", &g.zTop[7]);
1405 }else if( memcmp(g.zTop,"https://",8)==0 ){
1406 /* it is already HTTPS, use it. */
1407 g.zHttpsURL = mprintf("%s", g.zTop);
1408 }else{
1409 fossil_fatal("argument to --baseurl should be 'http://host/path'"
1410 " or 'https://host/path'");
1411 }
1412 for(i=n=0; (c = g.zTop[i])!=0; i++){
1413 if( c=='/' ){
@@ -2429,11 +2435,13 @@
2435 ** --create Create a new REPOSITORY if it does not already exist
2436 ** --page PAGE Start "ui" on PAGE. ex: --page "timeline?y=ci"
2437 ** --files GLOBLIST Comma-separated list of glob patterns for static files
2438 ** --localauth enable automatic login for requests from localhost
2439 ** --localhost listen on 127.0.0.1 only (always true for "ui")
2440 ** --https signal a request coming in via https
2441 ** --nojail Drop root privileges but do not enter the chroot jail
2442 ** --nossl signal that no SSL connections are available
2443 ** --notfound URL Redirect
2444 ** -P|--port TCPPORT listen to request on port TCPPORT
2445 ** --th-trace trace TH1 execution (for debugging purposes)
2446 ** --repolist If REPOSITORY is dir, URL "/" lists repos.
2447 ** --scgi Accept SCGI rather than HTTP
@@ -2490,10 +2498,17 @@
2498 zAltBase = find_option("baseurl", 0, 1);
2499 fCreate = find_option("create",0,0)!=0;
2500 if( find_option("scgi", 0, 0)!=0 ) flags |= HTTP_SERVER_SCGI;
2501 if( zAltBase ){
2502 set_base_url(zAltBase);
2503 }
2504 g.sslNotAvailable = find_option("nossl", 0, 0)!=0;
2505 if( find_option("https",0,0)!=0 ){
2506 cgi_replace_parameter("HTTPS","on");
2507 }else{
2508 /* without --https, defaults to not available. */
2509 g.sslNotAvailable = 1;
2510 }
2511 if( find_option("localhost", 0, 0)!=0 ){
2512 flags |= HTTP_SERVER_LOCALHOST;
2513 }
2514
@@ -2551,11 +2566,10 @@
2566 if( g.localOpen ) flags |= HTTP_SERVER_HAD_CHECKOUT;
2567 db_close(1);
2568 if( cgi_http_server(iPort, mxPort, zBrowserCmd, zIpAddr, flags) ){
2569 fossil_fatal("unable to listen on TCP socket %d", iPort);
2570 }
 
2571 g.httpIn = stdin;
2572 g.httpOut = stdout;
2573 if( g.fHttpTrace || g.fSqlTrace ){
2574 fprintf(stderr, "====== SERVER pid %d =======\n", getpid());
2575 }
2576
--- src/th_main.c
+++ src/th_main.c
@@ -451,10 +451,53 @@
451451
}
452452
cgi_redirect(argv[1]);
453453
Th_SetResult(interp, argv[1], argl[1]); /* NOT REACHED */
454454
return TH_OK;
455455
}
456
+
457
+/*
458
+** TH1 command: insertCsrf
459
+**
460
+** While rendering a form, call this command to add the Anti-CSRF token
461
+** as a hidden element of the form.
462
+*/
463
+static int insertCsrfCmd(
464
+ Th_Interp *interp,
465
+ void *p,
466
+ int argc,
467
+ const char **argv,
468
+ int *argl
469
+){
470
+ if( argc!=1 ){
471
+ return Th_WrongNumArgs(interp, "insertCsrf");
472
+ }
473
+ login_insert_csrf_secret();
474
+ return TH_OK;
475
+}
476
+
477
+/*
478
+** TH1 command: verifyCsrf
479
+**
480
+** Before using the results of a form, first call this command to verify
481
+** that this Anti-CSRF token is present and is valid. If the Anti-CSRF token
482
+** is missing or is incorrect, that indicates a cross-site scripting attack.
483
+** If the event of an attack is detected, an error message is generated and
484
+** all further processing is aborted.
485
+*/
486
+static int verifyCsrfCmd(
487
+ Th_Interp *interp,
488
+ void *p,
489
+ int argc,
490
+ const char **argv,
491
+ int *argl
492
+){
493
+ if( argc!=1 ){
494
+ return Th_WrongNumArgs(interp, "verifyCsrf");
495
+ }
496
+ login_verify_csrf_secret();
497
+ return TH_OK;
498
+}
456499
457500
/*
458501
** TH1 command: markdown STRING
459502
**
460503
** Renders the input string as markdown. The result is a two-element list.
@@ -1788,10 +1831,11 @@
17881831
{"hascap", hascapCmd, (void*)&zeroInt},
17891832
{"hasfeature", hasfeatureCmd, 0},
17901833
{"html", putsCmd, (void*)&aFlags[0]},
17911834
{"htmlize", htmlizeCmd, 0},
17921835
{"http", httpCmd, 0},
1836
+ {"insertCsrf", insertCsrfCmd, 0},
17931837
{"linecount", linecntCmd, 0},
17941838
{"markdown", markdownCmd, 0},
17951839
{"puts", putsCmd, (void*)&aFlags[1]},
17961840
{"query", queryCmd, 0},
17971841
{"randhex", randhexCmd, 0},
@@ -1807,10 +1851,11 @@
18071851
{"styleFooter", styleFooterCmd, 0},
18081852
{"tclReady", tclReadyCmd, 0},
18091853
{"trace", traceCmd, 0},
18101854
{"stime", stimeCmd, 0},
18111855
{"utime", utimeCmd, 0},
1856
+ {"verifyCsrf", verifyCsrfCmd, 0},
18121857
{"wiki", wikiCmd, (void*)&aFlags[0]},
18131858
{0, 0, 0}
18141859
};
18151860
if( g.thTrace ){
18161861
Th_Trace("th1-init 0x%x => 0x%x<br />\n", g.th1Flags, flags);
18171862
--- src/th_main.c
+++ src/th_main.c
@@ -451,10 +451,53 @@
451 }
452 cgi_redirect(argv[1]);
453 Th_SetResult(interp, argv[1], argl[1]); /* NOT REACHED */
454 return TH_OK;
455 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
456
457 /*
458 ** TH1 command: markdown STRING
459 **
460 ** Renders the input string as markdown. The result is a two-element list.
@@ -1788,10 +1831,11 @@
1788 {"hascap", hascapCmd, (void*)&zeroInt},
1789 {"hasfeature", hasfeatureCmd, 0},
1790 {"html", putsCmd, (void*)&aFlags[0]},
1791 {"htmlize", htmlizeCmd, 0},
1792 {"http", httpCmd, 0},
 
1793 {"linecount", linecntCmd, 0},
1794 {"markdown", markdownCmd, 0},
1795 {"puts", putsCmd, (void*)&aFlags[1]},
1796 {"query", queryCmd, 0},
1797 {"randhex", randhexCmd, 0},
@@ -1807,10 +1851,11 @@
1807 {"styleFooter", styleFooterCmd, 0},
1808 {"tclReady", tclReadyCmd, 0},
1809 {"trace", traceCmd, 0},
1810 {"stime", stimeCmd, 0},
1811 {"utime", utimeCmd, 0},
 
1812 {"wiki", wikiCmd, (void*)&aFlags[0]},
1813 {0, 0, 0}
1814 };
1815 if( g.thTrace ){
1816 Th_Trace("th1-init 0x%x => 0x%x<br />\n", g.th1Flags, flags);
1817
--- src/th_main.c
+++ src/th_main.c
@@ -451,10 +451,53 @@
451 }
452 cgi_redirect(argv[1]);
453 Th_SetResult(interp, argv[1], argl[1]); /* NOT REACHED */
454 return TH_OK;
455 }
456
457 /*
458 ** TH1 command: insertCsrf
459 **
460 ** While rendering a form, call this command to add the Anti-CSRF token
461 ** as a hidden element of the form.
462 */
463 static int insertCsrfCmd(
464 Th_Interp *interp,
465 void *p,
466 int argc,
467 const char **argv,
468 int *argl
469 ){
470 if( argc!=1 ){
471 return Th_WrongNumArgs(interp, "insertCsrf");
472 }
473 login_insert_csrf_secret();
474 return TH_OK;
475 }
476
477 /*
478 ** TH1 command: verifyCsrf
479 **
480 ** Before using the results of a form, first call this command to verify
481 ** that this Anti-CSRF token is present and is valid. If the Anti-CSRF token
482 ** is missing or is incorrect, that indicates a cross-site scripting attack.
483 ** If the event of an attack is detected, an error message is generated and
484 ** all further processing is aborted.
485 */
486 static int verifyCsrfCmd(
487 Th_Interp *interp,
488 void *p,
489 int argc,
490 const char **argv,
491 int *argl
492 ){
493 if( argc!=1 ){
494 return Th_WrongNumArgs(interp, "verifyCsrf");
495 }
496 login_verify_csrf_secret();
497 return TH_OK;
498 }
499
500 /*
501 ** TH1 command: markdown STRING
502 **
503 ** Renders the input string as markdown. The result is a two-element list.
@@ -1788,10 +1831,11 @@
1831 {"hascap", hascapCmd, (void*)&zeroInt},
1832 {"hasfeature", hasfeatureCmd, 0},
1833 {"html", putsCmd, (void*)&aFlags[0]},
1834 {"htmlize", htmlizeCmd, 0},
1835 {"http", httpCmd, 0},
1836 {"insertCsrf", insertCsrfCmd, 0},
1837 {"linecount", linecntCmd, 0},
1838 {"markdown", markdownCmd, 0},
1839 {"puts", putsCmd, (void*)&aFlags[1]},
1840 {"query", queryCmd, 0},
1841 {"randhex", randhexCmd, 0},
@@ -1807,10 +1851,11 @@
1851 {"styleFooter", styleFooterCmd, 0},
1852 {"tclReady", tclReadyCmd, 0},
1853 {"trace", traceCmd, 0},
1854 {"stime", stimeCmd, 0},
1855 {"utime", utimeCmd, 0},
1856 {"verifyCsrf", verifyCsrfCmd, 0},
1857 {"wiki", wikiCmd, (void*)&aFlags[0]},
1858 {0, 0, 0}
1859 };
1860 if( g.thTrace ){
1861 Th_Trace("th1-init 0x%x => 0x%x<br />\n", g.th1Flags, flags);
1862
--- src/th_main.c
+++ src/th_main.c
@@ -451,10 +451,53 @@
451451
}
452452
cgi_redirect(argv[1]);
453453
Th_SetResult(interp, argv[1], argl[1]); /* NOT REACHED */
454454
return TH_OK;
455455
}
456
+
457
+/*
458
+** TH1 command: insertCsrf
459
+**
460
+** While rendering a form, call this command to add the Anti-CSRF token
461
+** as a hidden element of the form.
462
+*/
463
+static int insertCsrfCmd(
464
+ Th_Interp *interp,
465
+ void *p,
466
+ int argc,
467
+ const char **argv,
468
+ int *argl
469
+){
470
+ if( argc!=1 ){
471
+ return Th_WrongNumArgs(interp, "insertCsrf");
472
+ }
473
+ login_insert_csrf_secret();
474
+ return TH_OK;
475
+}
476
+
477
+/*
478
+** TH1 command: verifyCsrf
479
+**
480
+** Before using the results of a form, first call this command to verify
481
+** that this Anti-CSRF token is present and is valid. If the Anti-CSRF token
482
+** is missing or is incorrect, that indicates a cross-site scripting attack.
483
+** If the event of an attack is detected, an error message is generated and
484
+** all further processing is aborted.
485
+*/
486
+static int verifyCsrfCmd(
487
+ Th_Interp *interp,
488
+ void *p,
489
+ int argc,
490
+ const char **argv,
491
+ int *argl
492
+){
493
+ if( argc!=1 ){
494
+ return Th_WrongNumArgs(interp, "verifyCsrf");
495
+ }
496
+ login_verify_csrf_secret();
497
+ return TH_OK;
498
+}
456499
457500
/*
458501
** TH1 command: markdown STRING
459502
**
460503
** Renders the input string as markdown. The result is a two-element list.
@@ -1788,10 +1831,11 @@
17881831
{"hascap", hascapCmd, (void*)&zeroInt},
17891832
{"hasfeature", hasfeatureCmd, 0},
17901833
{"html", putsCmd, (void*)&aFlags[0]},
17911834
{"htmlize", htmlizeCmd, 0},
17921835
{"http", httpCmd, 0},
1836
+ {"insertCsrf", insertCsrfCmd, 0},
17931837
{"linecount", linecntCmd, 0},
17941838
{"markdown", markdownCmd, 0},
17951839
{"puts", putsCmd, (void*)&aFlags[1]},
17961840
{"query", queryCmd, 0},
17971841
{"randhex", randhexCmd, 0},
@@ -1807,10 +1851,11 @@
18071851
{"styleFooter", styleFooterCmd, 0},
18081852
{"tclReady", tclReadyCmd, 0},
18091853
{"trace", traceCmd, 0},
18101854
{"stime", stimeCmd, 0},
18111855
{"utime", utimeCmd, 0},
1856
+ {"verifyCsrf", verifyCsrfCmd, 0},
18121857
{"wiki", wikiCmd, (void*)&aFlags[0]},
18131858
{0, 0, 0}
18141859
};
18151860
if( g.thTrace ){
18161861
Th_Trace("th1-init 0x%x => 0x%x<br />\n", g.th1Flags, flags);
18171862
--- src/th_main.c
+++ src/th_main.c
@@ -451,10 +451,53 @@
451 }
452 cgi_redirect(argv[1]);
453 Th_SetResult(interp, argv[1], argl[1]); /* NOT REACHED */
454 return TH_OK;
455 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
456
457 /*
458 ** TH1 command: markdown STRING
459 **
460 ** Renders the input string as markdown. The result is a two-element list.
@@ -1788,10 +1831,11 @@
1788 {"hascap", hascapCmd, (void*)&zeroInt},
1789 {"hasfeature", hasfeatureCmd, 0},
1790 {"html", putsCmd, (void*)&aFlags[0]},
1791 {"htmlize", htmlizeCmd, 0},
1792 {"http", httpCmd, 0},
 
1793 {"linecount", linecntCmd, 0},
1794 {"markdown", markdownCmd, 0},
1795 {"puts", putsCmd, (void*)&aFlags[1]},
1796 {"query", queryCmd, 0},
1797 {"randhex", randhexCmd, 0},
@@ -1807,10 +1851,11 @@
1807 {"styleFooter", styleFooterCmd, 0},
1808 {"tclReady", tclReadyCmd, 0},
1809 {"trace", traceCmd, 0},
1810 {"stime", stimeCmd, 0},
1811 {"utime", utimeCmd, 0},
 
1812 {"wiki", wikiCmd, (void*)&aFlags[0]},
1813 {0, 0, 0}
1814 };
1815 if( g.thTrace ){
1816 Th_Trace("th1-init 0x%x => 0x%x<br />\n", g.th1Flags, flags);
1817
--- src/th_main.c
+++ src/th_main.c
@@ -451,10 +451,53 @@
451 }
452 cgi_redirect(argv[1]);
453 Th_SetResult(interp, argv[1], argl[1]); /* NOT REACHED */
454 return TH_OK;
455 }
456
457 /*
458 ** TH1 command: insertCsrf
459 **
460 ** While rendering a form, call this command to add the Anti-CSRF token
461 ** as a hidden element of the form.
462 */
463 static int insertCsrfCmd(
464 Th_Interp *interp,
465 void *p,
466 int argc,
467 const char **argv,
468 int *argl
469 ){
470 if( argc!=1 ){
471 return Th_WrongNumArgs(interp, "insertCsrf");
472 }
473 login_insert_csrf_secret();
474 return TH_OK;
475 }
476
477 /*
478 ** TH1 command: verifyCsrf
479 **
480 ** Before using the results of a form, first call this command to verify
481 ** that this Anti-CSRF token is present and is valid. If the Anti-CSRF token
482 ** is missing or is incorrect, that indicates a cross-site scripting attack.
483 ** If the event of an attack is detected, an error message is generated and
484 ** all further processing is aborted.
485 */
486 static int verifyCsrfCmd(
487 Th_Interp *interp,
488 void *p,
489 int argc,
490 const char **argv,
491 int *argl
492 ){
493 if( argc!=1 ){
494 return Th_WrongNumArgs(interp, "verifyCsrf");
495 }
496 login_verify_csrf_secret();
497 return TH_OK;
498 }
499
500 /*
501 ** TH1 command: markdown STRING
502 **
503 ** Renders the input string as markdown. The result is a two-element list.
@@ -1788,10 +1831,11 @@
1831 {"hascap", hascapCmd, (void*)&zeroInt},
1832 {"hasfeature", hasfeatureCmd, 0},
1833 {"html", putsCmd, (void*)&aFlags[0]},
1834 {"htmlize", htmlizeCmd, 0},
1835 {"http", httpCmd, 0},
1836 {"insertCsrf", insertCsrfCmd, 0},
1837 {"linecount", linecntCmd, 0},
1838 {"markdown", markdownCmd, 0},
1839 {"puts", putsCmd, (void*)&aFlags[1]},
1840 {"query", queryCmd, 0},
1841 {"randhex", randhexCmd, 0},
@@ -1807,10 +1851,11 @@
1851 {"styleFooter", styleFooterCmd, 0},
1852 {"tclReady", tclReadyCmd, 0},
1853 {"trace", traceCmd, 0},
1854 {"stime", stimeCmd, 0},
1855 {"utime", utimeCmd, 0},
1856 {"verifyCsrf", verifyCsrfCmd, 0},
1857 {"wiki", wikiCmd, (void*)&aFlags[0]},
1858 {0, 0, 0}
1859 };
1860 if( g.thTrace ){
1861 Th_Trace("th1-init 0x%x => 0x%x<br />\n", g.th1Flags, flags);
1862
--- src/th_main.c
+++ src/th_main.c
@@ -451,10 +451,53 @@
451451
}
452452
cgi_redirect(argv[1]);
453453
Th_SetResult(interp, argv[1], argl[1]); /* NOT REACHED */
454454
return TH_OK;
455455
}
456
+
457
+/*
458
+** TH1 command: insertCsrf
459
+**
460
+** While rendering a form, call this command to add the Anti-CSRF token
461
+** as a hidden element of the form.
462
+*/
463
+static int insertCsrfCmd(
464
+ Th_Interp *interp,
465
+ void *p,
466
+ int argc,
467
+ const char **argv,
468
+ int *argl
469
+){
470
+ if( argc!=1 ){
471
+ return Th_WrongNumArgs(interp, "insertCsrf");
472
+ }
473
+ login_insert_csrf_secret();
474
+ return TH_OK;
475
+}
476
+
477
+/*
478
+** TH1 command: verifyCsrf
479
+**
480
+** Before using the results of a form, first call this command to verify
481
+** that this Anti-CSRF token is present and is valid. If the Anti-CSRF token
482
+** is missing or is incorrect, that indicates a cross-site scripting attack.
483
+** If the event of an attack is detected, an error message is generated and
484
+** all further processing is aborted.
485
+*/
486
+static int verifyCsrfCmd(
487
+ Th_Interp *interp,
488
+ void *p,
489
+ int argc,
490
+ const char **argv,
491
+ int *argl
492
+){
493
+ if( argc!=1 ){
494
+ return Th_WrongNumArgs(interp, "verifyCsrf");
495
+ }
496
+ login_verify_csrf_secret();
497
+ return TH_OK;
498
+}
456499
457500
/*
458501
** TH1 command: markdown STRING
459502
**
460503
** Renders the input string as markdown. The result is a two-element list.
@@ -1788,10 +1831,11 @@
17881831
{"hascap", hascapCmd, (void*)&zeroInt},
17891832
{"hasfeature", hasfeatureCmd, 0},
17901833
{"html", putsCmd, (void*)&aFlags[0]},
17911834
{"htmlize", htmlizeCmd, 0},
17921835
{"http", httpCmd, 0},
1836
+ {"insertCsrf", insertCsrfCmd, 0},
17931837
{"linecount", linecntCmd, 0},
17941838
{"markdown", markdownCmd, 0},
17951839
{"puts", putsCmd, (void*)&aFlags[1]},
17961840
{"query", queryCmd, 0},
17971841
{"randhex", randhexCmd, 0},
@@ -1807,10 +1851,11 @@
18071851
{"styleFooter", styleFooterCmd, 0},
18081852
{"tclReady", tclReadyCmd, 0},
18091853
{"trace", traceCmd, 0},
18101854
{"stime", stimeCmd, 0},
18111855
{"utime", utimeCmd, 0},
1856
+ {"verifyCsrf", verifyCsrfCmd, 0},
18121857
{"wiki", wikiCmd, (void*)&aFlags[0]},
18131858
{0, 0, 0}
18141859
};
18151860
if( g.thTrace ){
18161861
Th_Trace("th1-init 0x%x => 0x%x<br />\n", g.th1Flags, flags);
18171862
--- src/th_main.c
+++ src/th_main.c
@@ -451,10 +451,53 @@
451 }
452 cgi_redirect(argv[1]);
453 Th_SetResult(interp, argv[1], argl[1]); /* NOT REACHED */
454 return TH_OK;
455 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
456
457 /*
458 ** TH1 command: markdown STRING
459 **
460 ** Renders the input string as markdown. The result is a two-element list.
@@ -1788,10 +1831,11 @@
1788 {"hascap", hascapCmd, (void*)&zeroInt},
1789 {"hasfeature", hasfeatureCmd, 0},
1790 {"html", putsCmd, (void*)&aFlags[0]},
1791 {"htmlize", htmlizeCmd, 0},
1792 {"http", httpCmd, 0},
 
1793 {"linecount", linecntCmd, 0},
1794 {"markdown", markdownCmd, 0},
1795 {"puts", putsCmd, (void*)&aFlags[1]},
1796 {"query", queryCmd, 0},
1797 {"randhex", randhexCmd, 0},
@@ -1807,10 +1851,11 @@
1807 {"styleFooter", styleFooterCmd, 0},
1808 {"tclReady", tclReadyCmd, 0},
1809 {"trace", traceCmd, 0},
1810 {"stime", stimeCmd, 0},
1811 {"utime", utimeCmd, 0},
 
1812 {"wiki", wikiCmd, (void*)&aFlags[0]},
1813 {0, 0, 0}
1814 };
1815 if( g.thTrace ){
1816 Th_Trace("th1-init 0x%x => 0x%x<br />\n", g.th1Flags, flags);
1817
--- src/th_main.c
+++ src/th_main.c
@@ -451,10 +451,53 @@
451 }
452 cgi_redirect(argv[1]);
453 Th_SetResult(interp, argv[1], argl[1]); /* NOT REACHED */
454 return TH_OK;
455 }
456
457 /*
458 ** TH1 command: insertCsrf
459 **
460 ** While rendering a form, call this command to add the Anti-CSRF token
461 ** as a hidden element of the form.
462 */
463 static int insertCsrfCmd(
464 Th_Interp *interp,
465 void *p,
466 int argc,
467 const char **argv,
468 int *argl
469 ){
470 if( argc!=1 ){
471 return Th_WrongNumArgs(interp, "insertCsrf");
472 }
473 login_insert_csrf_secret();
474 return TH_OK;
475 }
476
477 /*
478 ** TH1 command: verifyCsrf
479 **
480 ** Before using the results of a form, first call this command to verify
481 ** that this Anti-CSRF token is present and is valid. If the Anti-CSRF token
482 ** is missing or is incorrect, that indicates a cross-site scripting attack.
483 ** If the event of an attack is detected, an error message is generated and
484 ** all further processing is aborted.
485 */
486 static int verifyCsrfCmd(
487 Th_Interp *interp,
488 void *p,
489 int argc,
490 const char **argv,
491 int *argl
492 ){
493 if( argc!=1 ){
494 return Th_WrongNumArgs(interp, "verifyCsrf");
495 }
496 login_verify_csrf_secret();
497 return TH_OK;
498 }
499
500 /*
501 ** TH1 command: markdown STRING
502 **
503 ** Renders the input string as markdown. The result is a two-element list.
@@ -1788,10 +1831,11 @@
1831 {"hascap", hascapCmd, (void*)&zeroInt},
1832 {"hasfeature", hasfeatureCmd, 0},
1833 {"html", putsCmd, (void*)&aFlags[0]},
1834 {"htmlize", htmlizeCmd, 0},
1835 {"http", httpCmd, 0},
1836 {"insertCsrf", insertCsrfCmd, 0},
1837 {"linecount", linecntCmd, 0},
1838 {"markdown", markdownCmd, 0},
1839 {"puts", putsCmd, (void*)&aFlags[1]},
1840 {"query", queryCmd, 0},
1841 {"randhex", randhexCmd, 0},
@@ -1807,10 +1851,11 @@
1851 {"styleFooter", styleFooterCmd, 0},
1852 {"tclReady", tclReadyCmd, 0},
1853 {"trace", traceCmd, 0},
1854 {"stime", stimeCmd, 0},
1855 {"utime", utimeCmd, 0},
1856 {"verifyCsrf", verifyCsrfCmd, 0},
1857 {"wiki", wikiCmd, (void*)&aFlags[0]},
1858 {0, 0, 0}
1859 };
1860 if( g.thTrace ){
1861 Th_Trace("th1-init 0x%x => 0x%x<br />\n", g.th1Flags, flags);
1862
--- src/th_main.c
+++ src/th_main.c
@@ -451,10 +451,53 @@
451451
}
452452
cgi_redirect(argv[1]);
453453
Th_SetResult(interp, argv[1], argl[1]); /* NOT REACHED */
454454
return TH_OK;
455455
}
456
+
457
+/*
458
+** TH1 command: insertCsrf
459
+**
460
+** While rendering a form, call this command to add the Anti-CSRF token
461
+** as a hidden element of the form.
462
+*/
463
+static int insertCsrfCmd(
464
+ Th_Interp *interp,
465
+ void *p,
466
+ int argc,
467
+ const char **argv,
468
+ int *argl
469
+){
470
+ if( argc!=1 ){
471
+ return Th_WrongNumArgs(interp, "insertCsrf");
472
+ }
473
+ login_insert_csrf_secret();
474
+ return TH_OK;
475
+}
476
+
477
+/*
478
+** TH1 command: verifyCsrf
479
+**
480
+** Before using the results of a form, first call this command to verify
481
+** that this Anti-CSRF token is present and is valid. If the Anti-CSRF token
482
+** is missing or is incorrect, that indicates a cross-site scripting attack.
483
+** If the event of an attack is detected, an error message is generated and
484
+** all further processing is aborted.
485
+*/
486
+static int verifyCsrfCmd(
487
+ Th_Interp *interp,
488
+ void *p,
489
+ int argc,
490
+ const char **argv,
491
+ int *argl
492
+){
493
+ if( argc!=1 ){
494
+ return Th_WrongNumArgs(interp, "verifyCsrf");
495
+ }
496
+ login_verify_csrf_secret();
497
+ return TH_OK;
498
+}
456499
457500
/*
458501
** TH1 command: markdown STRING
459502
**
460503
** Renders the input string as markdown. The result is a two-element list.
@@ -1788,10 +1831,11 @@
17881831
{"hascap", hascapCmd, (void*)&zeroInt},
17891832
{"hasfeature", hasfeatureCmd, 0},
17901833
{"html", putsCmd, (void*)&aFlags[0]},
17911834
{"htmlize", htmlizeCmd, 0},
17921835
{"http", httpCmd, 0},
1836
+ {"insertCsrf", insertCsrfCmd, 0},
17931837
{"linecount", linecntCmd, 0},
17941838
{"markdown", markdownCmd, 0},
17951839
{"puts", putsCmd, (void*)&aFlags[1]},
17961840
{"query", queryCmd, 0},
17971841
{"randhex", randhexCmd, 0},
@@ -1807,10 +1851,11 @@
18071851
{"styleFooter", styleFooterCmd, 0},
18081852
{"tclReady", tclReadyCmd, 0},
18091853
{"trace", traceCmd, 0},
18101854
{"stime", stimeCmd, 0},
18111855
{"utime", utimeCmd, 0},
1856
+ {"verifyCsrf", verifyCsrfCmd, 0},
18121857
{"wiki", wikiCmd, (void*)&aFlags[0]},
18131858
{0, 0, 0}
18141859
};
18151860
if( g.thTrace ){
18161861
Th_Trace("th1-init 0x%x => 0x%x<br />\n", g.th1Flags, flags);
18171862
--- src/th_main.c
+++ src/th_main.c
@@ -451,10 +451,53 @@
451 }
452 cgi_redirect(argv[1]);
453 Th_SetResult(interp, argv[1], argl[1]); /* NOT REACHED */
454 return TH_OK;
455 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
456
457 /*
458 ** TH1 command: markdown STRING
459 **
460 ** Renders the input string as markdown. The result is a two-element list.
@@ -1788,10 +1831,11 @@
1788 {"hascap", hascapCmd, (void*)&zeroInt},
1789 {"hasfeature", hasfeatureCmd, 0},
1790 {"html", putsCmd, (void*)&aFlags[0]},
1791 {"htmlize", htmlizeCmd, 0},
1792 {"http", httpCmd, 0},
 
1793 {"linecount", linecntCmd, 0},
1794 {"markdown", markdownCmd, 0},
1795 {"puts", putsCmd, (void*)&aFlags[1]},
1796 {"query", queryCmd, 0},
1797 {"randhex", randhexCmd, 0},
@@ -1807,10 +1851,11 @@
1807 {"styleFooter", styleFooterCmd, 0},
1808 {"tclReady", tclReadyCmd, 0},
1809 {"trace", traceCmd, 0},
1810 {"stime", stimeCmd, 0},
1811 {"utime", utimeCmd, 0},
 
1812 {"wiki", wikiCmd, (void*)&aFlags[0]},
1813 {0, 0, 0}
1814 };
1815 if( g.thTrace ){
1816 Th_Trace("th1-init 0x%x => 0x%x<br />\n", g.th1Flags, flags);
1817
--- src/th_main.c
+++ src/th_main.c
@@ -451,10 +451,53 @@
451 }
452 cgi_redirect(argv[1]);
453 Th_SetResult(interp, argv[1], argl[1]); /* NOT REACHED */
454 return TH_OK;
455 }
456
457 /*
458 ** TH1 command: insertCsrf
459 **
460 ** While rendering a form, call this command to add the Anti-CSRF token
461 ** as a hidden element of the form.
462 */
463 static int insertCsrfCmd(
464 Th_Interp *interp,
465 void *p,
466 int argc,
467 const char **argv,
468 int *argl
469 ){
470 if( argc!=1 ){
471 return Th_WrongNumArgs(interp, "insertCsrf");
472 }
473 login_insert_csrf_secret();
474 return TH_OK;
475 }
476
477 /*
478 ** TH1 command: verifyCsrf
479 **
480 ** Before using the results of a form, first call this command to verify
481 ** that this Anti-CSRF token is present and is valid. If the Anti-CSRF token
482 ** is missing or is incorrect, that indicates a cross-site scripting attack.
483 ** If the event of an attack is detected, an error message is generated and
484 ** all further processing is aborted.
485 */
486 static int verifyCsrfCmd(
487 Th_Interp *interp,
488 void *p,
489 int argc,
490 const char **argv,
491 int *argl
492 ){
493 if( argc!=1 ){
494 return Th_WrongNumArgs(interp, "verifyCsrf");
495 }
496 login_verify_csrf_secret();
497 return TH_OK;
498 }
499
500 /*
501 ** TH1 command: markdown STRING
502 **
503 ** Renders the input string as markdown. The result is a two-element list.
@@ -1788,10 +1831,11 @@
1831 {"hascap", hascapCmd, (void*)&zeroInt},
1832 {"hasfeature", hasfeatureCmd, 0},
1833 {"html", putsCmd, (void*)&aFlags[0]},
1834 {"htmlize", htmlizeCmd, 0},
1835 {"http", httpCmd, 0},
1836 {"insertCsrf", insertCsrfCmd, 0},
1837 {"linecount", linecntCmd, 0},
1838 {"markdown", markdownCmd, 0},
1839 {"puts", putsCmd, (void*)&aFlags[1]},
1840 {"query", queryCmd, 0},
1841 {"randhex", randhexCmd, 0},
@@ -1807,10 +1851,11 @@
1851 {"styleFooter", styleFooterCmd, 0},
1852 {"tclReady", tclReadyCmd, 0},
1853 {"trace", traceCmd, 0},
1854 {"stime", stimeCmd, 0},
1855 {"utime", utimeCmd, 0},
1856 {"verifyCsrf", verifyCsrfCmd, 0},
1857 {"wiki", wikiCmd, (void*)&aFlags[0]},
1858 {0, 0, 0}
1859 };
1860 if( g.thTrace ){
1861 Th_Trace("th1-init 0x%x => 0x%x<br />\n", g.th1Flags, flags);
1862
+21
--- www/th1.md
+++ www/th1.md
@@ -150,10 +150,11 @@
150150
* hasfeature
151151
* html
152152
* htmlize
153153
* http
154154
* httpize
155
+ * insertCsrf
155156
* linecount
156157
* markdown
157158
* puts
158159
* query
159160
* randhex
@@ -174,10 +175,11 @@
174175
* tclMakeSafe
175176
* tclReady
176177
* trace
177178
* stime
178179
* utime
180
+ * verifyCsrf
179181
* wiki
180182
181183
Each of the commands above is documented by a block comment above their
182184
implementation in the th\_main.c or th\_tcl.c source files.
183185
@@ -379,10 +381,18 @@
379381
380382
* httpize STRING
381383
382384
Escape all characters of STRING which have special meaning in URI
383385
components. Returns the escaped string.
386
+
387
+<a name="insertCsrf"></a>TH1 insertCsrf Command
388
+-----------------------------------------------
389
+
390
+ * insertCsrf
391
+
392
+While rendering a form, call this command to add the Anti-CSRF token
393
+as a hidden element of the form.
384394
385395
<a name="linecount"></a>TH1 linecount Command
386396
---------------------------------------------
387397
388398
* linecount STRING MAX MIN
@@ -607,10 +617,21 @@
607617
608618
* utime
609619
610620
Returns the number of microseconds of CPU time consumed by the current
611621
process in user space.
622
+
623
+<a name="verifyCsrf"></a>TH1 verifyCsrf Command
624
+-----------------------------------------------
625
+
626
+ * verifyCsrf
627
+
628
+Before using the results of a form, first call this command to verify
629
+that this Anti-CSRF token is present and is valid. If the Anti-CSRF token
630
+is missing or is incorrect, that indicates a cross-site scripting attack.
631
+If the event of an attack is detected, an error message is generated and
632
+all further processing is aborted.
612633
613634
<a name="wiki"></a>TH1 wiki Command
614635
-----------------------------------
615636
616637
* wiki STRING
617638
--- www/th1.md
+++ www/th1.md
@@ -150,10 +150,11 @@
150 * hasfeature
151 * html
152 * htmlize
153 * http
154 * httpize
 
155 * linecount
156 * markdown
157 * puts
158 * query
159 * randhex
@@ -174,10 +175,11 @@
174 * tclMakeSafe
175 * tclReady
176 * trace
177 * stime
178 * utime
 
179 * wiki
180
181 Each of the commands above is documented by a block comment above their
182 implementation in the th\_main.c or th\_tcl.c source files.
183
@@ -379,10 +381,18 @@
379
380 * httpize STRING
381
382 Escape all characters of STRING which have special meaning in URI
383 components. Returns the escaped string.
 
 
 
 
 
 
 
 
384
385 <a name="linecount"></a>TH1 linecount Command
386 ---------------------------------------------
387
388 * linecount STRING MAX MIN
@@ -607,10 +617,21 @@
607
608 * utime
609
610 Returns the number of microseconds of CPU time consumed by the current
611 process in user space.
 
 
 
 
 
 
 
 
 
 
 
612
613 <a name="wiki"></a>TH1 wiki Command
614 -----------------------------------
615
616 * wiki STRING
617
--- www/th1.md
+++ www/th1.md
@@ -150,10 +150,11 @@
150 * hasfeature
151 * html
152 * htmlize
153 * http
154 * httpize
155 * insertCsrf
156 * linecount
157 * markdown
158 * puts
159 * query
160 * randhex
@@ -174,10 +175,11 @@
175 * tclMakeSafe
176 * tclReady
177 * trace
178 * stime
179 * utime
180 * verifyCsrf
181 * wiki
182
183 Each of the commands above is documented by a block comment above their
184 implementation in the th\_main.c or th\_tcl.c source files.
185
@@ -379,10 +381,18 @@
381
382 * httpize STRING
383
384 Escape all characters of STRING which have special meaning in URI
385 components. Returns the escaped string.
386
387 <a name="insertCsrf"></a>TH1 insertCsrf Command
388 -----------------------------------------------
389
390 * insertCsrf
391
392 While rendering a form, call this command to add the Anti-CSRF token
393 as a hidden element of the form.
394
395 <a name="linecount"></a>TH1 linecount Command
396 ---------------------------------------------
397
398 * linecount STRING MAX MIN
@@ -607,10 +617,21 @@
617
618 * utime
619
620 Returns the number of microseconds of CPU time consumed by the current
621 process in user space.
622
623 <a name="verifyCsrf"></a>TH1 verifyCsrf Command
624 -----------------------------------------------
625
626 * verifyCsrf
627
628 Before using the results of a form, first call this command to verify
629 that this Anti-CSRF token is present and is valid. If the Anti-CSRF token
630 is missing or is incorrect, that indicates a cross-site scripting attack.
631 If the event of an attack is detected, an error message is generated and
632 all further processing is aborted.
633
634 <a name="wiki"></a>TH1 wiki Command
635 -----------------------------------
636
637 * wiki STRING
638
+21
--- www/th1.md
+++ www/th1.md
@@ -150,10 +150,11 @@
150150
* hasfeature
151151
* html
152152
* htmlize
153153
* http
154154
* httpize
155
+ * insertCsrf
155156
* linecount
156157
* markdown
157158
* puts
158159
* query
159160
* randhex
@@ -174,10 +175,11 @@
174175
* tclMakeSafe
175176
* tclReady
176177
* trace
177178
* stime
178179
* utime
180
+ * verifyCsrf
179181
* wiki
180182
181183
Each of the commands above is documented by a block comment above their
182184
implementation in the th\_main.c or th\_tcl.c source files.
183185
@@ -379,10 +381,18 @@
379381
380382
* httpize STRING
381383
382384
Escape all characters of STRING which have special meaning in URI
383385
components. Returns the escaped string.
386
+
387
+<a name="insertCsrf"></a>TH1 insertCsrf Command
388
+-----------------------------------------------
389
+
390
+ * insertCsrf
391
+
392
+While rendering a form, call this command to add the Anti-CSRF token
393
+as a hidden element of the form.
384394
385395
<a name="linecount"></a>TH1 linecount Command
386396
---------------------------------------------
387397
388398
* linecount STRING MAX MIN
@@ -607,10 +617,21 @@
607617
608618
* utime
609619
610620
Returns the number of microseconds of CPU time consumed by the current
611621
process in user space.
622
+
623
+<a name="verifyCsrf"></a>TH1 verifyCsrf Command
624
+-----------------------------------------------
625
+
626
+ * verifyCsrf
627
+
628
+Before using the results of a form, first call this command to verify
629
+that this Anti-CSRF token is present and is valid. If the Anti-CSRF token
630
+is missing or is incorrect, that indicates a cross-site scripting attack.
631
+If the event of an attack is detected, an error message is generated and
632
+all further processing is aborted.
612633
613634
<a name="wiki"></a>TH1 wiki Command
614635
-----------------------------------
615636
616637
* wiki STRING
617638
--- www/th1.md
+++ www/th1.md
@@ -150,10 +150,11 @@
150 * hasfeature
151 * html
152 * htmlize
153 * http
154 * httpize
 
155 * linecount
156 * markdown
157 * puts
158 * query
159 * randhex
@@ -174,10 +175,11 @@
174 * tclMakeSafe
175 * tclReady
176 * trace
177 * stime
178 * utime
 
179 * wiki
180
181 Each of the commands above is documented by a block comment above their
182 implementation in the th\_main.c or th\_tcl.c source files.
183
@@ -379,10 +381,18 @@
379
380 * httpize STRING
381
382 Escape all characters of STRING which have special meaning in URI
383 components. Returns the escaped string.
 
 
 
 
 
 
 
 
384
385 <a name="linecount"></a>TH1 linecount Command
386 ---------------------------------------------
387
388 * linecount STRING MAX MIN
@@ -607,10 +617,21 @@
607
608 * utime
609
610 Returns the number of microseconds of CPU time consumed by the current
611 process in user space.
 
 
 
 
 
 
 
 
 
 
 
612
613 <a name="wiki"></a>TH1 wiki Command
614 -----------------------------------
615
616 * wiki STRING
617
--- www/th1.md
+++ www/th1.md
@@ -150,10 +150,11 @@
150 * hasfeature
151 * html
152 * htmlize
153 * http
154 * httpize
155 * insertCsrf
156 * linecount
157 * markdown
158 * puts
159 * query
160 * randhex
@@ -174,10 +175,11 @@
175 * tclMakeSafe
176 * tclReady
177 * trace
178 * stime
179 * utime
180 * verifyCsrf
181 * wiki
182
183 Each of the commands above is documented by a block comment above their
184 implementation in the th\_main.c or th\_tcl.c source files.
185
@@ -379,10 +381,18 @@
381
382 * httpize STRING
383
384 Escape all characters of STRING which have special meaning in URI
385 components. Returns the escaped string.
386
387 <a name="insertCsrf"></a>TH1 insertCsrf Command
388 -----------------------------------------------
389
390 * insertCsrf
391
392 While rendering a form, call this command to add the Anti-CSRF token
393 as a hidden element of the form.
394
395 <a name="linecount"></a>TH1 linecount Command
396 ---------------------------------------------
397
398 * linecount STRING MAX MIN
@@ -607,10 +617,21 @@
617
618 * utime
619
620 Returns the number of microseconds of CPU time consumed by the current
621 process in user space.
622
623 <a name="verifyCsrf"></a>TH1 verifyCsrf Command
624 -----------------------------------------------
625
626 * verifyCsrf
627
628 Before using the results of a form, first call this command to verify
629 that this Anti-CSRF token is present and is valid. If the Anti-CSRF token
630 is missing or is incorrect, that indicates a cross-site scripting attack.
631 If the event of an attack is detected, an error message is generated and
632 all further processing is aborted.
633
634 <a name="wiki"></a>TH1 wiki Command
635 -----------------------------------
636
637 * wiki STRING
638
+21
--- www/th1.md
+++ www/th1.md
@@ -150,10 +150,11 @@
150150
* hasfeature
151151
* html
152152
* htmlize
153153
* http
154154
* httpize
155
+ * insertCsrf
155156
* linecount
156157
* markdown
157158
* puts
158159
* query
159160
* randhex
@@ -174,10 +175,11 @@
174175
* tclMakeSafe
175176
* tclReady
176177
* trace
177178
* stime
178179
* utime
180
+ * verifyCsrf
179181
* wiki
180182
181183
Each of the commands above is documented by a block comment above their
182184
implementation in the th\_main.c or th\_tcl.c source files.
183185
@@ -379,10 +381,18 @@
379381
380382
* httpize STRING
381383
382384
Escape all characters of STRING which have special meaning in URI
383385
components. Returns the escaped string.
386
+
387
+<a name="insertCsrf"></a>TH1 insertCsrf Command
388
+-----------------------------------------------
389
+
390
+ * insertCsrf
391
+
392
+While rendering a form, call this command to add the Anti-CSRF token
393
+as a hidden element of the form.
384394
385395
<a name="linecount"></a>TH1 linecount Command
386396
---------------------------------------------
387397
388398
* linecount STRING MAX MIN
@@ -607,10 +617,21 @@
607617
608618
* utime
609619
610620
Returns the number of microseconds of CPU time consumed by the current
611621
process in user space.
622
+
623
+<a name="verifyCsrf"></a>TH1 verifyCsrf Command
624
+-----------------------------------------------
625
+
626
+ * verifyCsrf
627
+
628
+Before using the results of a form, first call this command to verify
629
+that this Anti-CSRF token is present and is valid. If the Anti-CSRF token
630
+is missing or is incorrect, that indicates a cross-site scripting attack.
631
+If the event of an attack is detected, an error message is generated and
632
+all further processing is aborted.
612633
613634
<a name="wiki"></a>TH1 wiki Command
614635
-----------------------------------
615636
616637
* wiki STRING
617638
--- www/th1.md
+++ www/th1.md
@@ -150,10 +150,11 @@
150 * hasfeature
151 * html
152 * htmlize
153 * http
154 * httpize
 
155 * linecount
156 * markdown
157 * puts
158 * query
159 * randhex
@@ -174,10 +175,11 @@
174 * tclMakeSafe
175 * tclReady
176 * trace
177 * stime
178 * utime
 
179 * wiki
180
181 Each of the commands above is documented by a block comment above their
182 implementation in the th\_main.c or th\_tcl.c source files.
183
@@ -379,10 +381,18 @@
379
380 * httpize STRING
381
382 Escape all characters of STRING which have special meaning in URI
383 components. Returns the escaped string.
 
 
 
 
 
 
 
 
384
385 <a name="linecount"></a>TH1 linecount Command
386 ---------------------------------------------
387
388 * linecount STRING MAX MIN
@@ -607,10 +617,21 @@
607
608 * utime
609
610 Returns the number of microseconds of CPU time consumed by the current
611 process in user space.
 
 
 
 
 
 
 
 
 
 
 
612
613 <a name="wiki"></a>TH1 wiki Command
614 -----------------------------------
615
616 * wiki STRING
617
--- www/th1.md
+++ www/th1.md
@@ -150,10 +150,11 @@
150 * hasfeature
151 * html
152 * htmlize
153 * http
154 * httpize
155 * insertCsrf
156 * linecount
157 * markdown
158 * puts
159 * query
160 * randhex
@@ -174,10 +175,11 @@
175 * tclMakeSafe
176 * tclReady
177 * trace
178 * stime
179 * utime
180 * verifyCsrf
181 * wiki
182
183 Each of the commands above is documented by a block comment above their
184 implementation in the th\_main.c or th\_tcl.c source files.
185
@@ -379,10 +381,18 @@
381
382 * httpize STRING
383
384 Escape all characters of STRING which have special meaning in URI
385 components. Returns the escaped string.
386
387 <a name="insertCsrf"></a>TH1 insertCsrf Command
388 -----------------------------------------------
389
390 * insertCsrf
391
392 While rendering a form, call this command to add the Anti-CSRF token
393 as a hidden element of the form.
394
395 <a name="linecount"></a>TH1 linecount Command
396 ---------------------------------------------
397
398 * linecount STRING MAX MIN
@@ -607,10 +617,21 @@
617
618 * utime
619
620 Returns the number of microseconds of CPU time consumed by the current
621 process in user space.
622
623 <a name="verifyCsrf"></a>TH1 verifyCsrf Command
624 -----------------------------------------------
625
626 * verifyCsrf
627
628 Before using the results of a form, first call this command to verify
629 that this Anti-CSRF token is present and is valid. If the Anti-CSRF token
630 is missing or is incorrect, that indicates a cross-site scripting attack.
631 If the event of an attack is detected, an error message is generated and
632 all further processing is aborted.
633
634 <a name="wiki"></a>TH1 wiki Command
635 -----------------------------------
636
637 * wiki STRING
638
+21
--- www/th1.md
+++ www/th1.md
@@ -150,10 +150,11 @@
150150
* hasfeature
151151
* html
152152
* htmlize
153153
* http
154154
* httpize
155
+ * insertCsrf
155156
* linecount
156157
* markdown
157158
* puts
158159
* query
159160
* randhex
@@ -174,10 +175,11 @@
174175
* tclMakeSafe
175176
* tclReady
176177
* trace
177178
* stime
178179
* utime
180
+ * verifyCsrf
179181
* wiki
180182
181183
Each of the commands above is documented by a block comment above their
182184
implementation in the th\_main.c or th\_tcl.c source files.
183185
@@ -379,10 +381,18 @@
379381
380382
* httpize STRING
381383
382384
Escape all characters of STRING which have special meaning in URI
383385
components. Returns the escaped string.
386
+
387
+<a name="insertCsrf"></a>TH1 insertCsrf Command
388
+-----------------------------------------------
389
+
390
+ * insertCsrf
391
+
392
+While rendering a form, call this command to add the Anti-CSRF token
393
+as a hidden element of the form.
384394
385395
<a name="linecount"></a>TH1 linecount Command
386396
---------------------------------------------
387397
388398
* linecount STRING MAX MIN
@@ -607,10 +617,21 @@
607617
608618
* utime
609619
610620
Returns the number of microseconds of CPU time consumed by the current
611621
process in user space.
622
+
623
+<a name="verifyCsrf"></a>TH1 verifyCsrf Command
624
+-----------------------------------------------
625
+
626
+ * verifyCsrf
627
+
628
+Before using the results of a form, first call this command to verify
629
+that this Anti-CSRF token is present and is valid. If the Anti-CSRF token
630
+is missing or is incorrect, that indicates a cross-site scripting attack.
631
+If the event of an attack is detected, an error message is generated and
632
+all further processing is aborted.
612633
613634
<a name="wiki"></a>TH1 wiki Command
614635
-----------------------------------
615636
616637
* wiki STRING
617638
--- www/th1.md
+++ www/th1.md
@@ -150,10 +150,11 @@
150 * hasfeature
151 * html
152 * htmlize
153 * http
154 * httpize
 
155 * linecount
156 * markdown
157 * puts
158 * query
159 * randhex
@@ -174,10 +175,11 @@
174 * tclMakeSafe
175 * tclReady
176 * trace
177 * stime
178 * utime
 
179 * wiki
180
181 Each of the commands above is documented by a block comment above their
182 implementation in the th\_main.c or th\_tcl.c source files.
183
@@ -379,10 +381,18 @@
379
380 * httpize STRING
381
382 Escape all characters of STRING which have special meaning in URI
383 components. Returns the escaped string.
 
 
 
 
 
 
 
 
384
385 <a name="linecount"></a>TH1 linecount Command
386 ---------------------------------------------
387
388 * linecount STRING MAX MIN
@@ -607,10 +617,21 @@
607
608 * utime
609
610 Returns the number of microseconds of CPU time consumed by the current
611 process in user space.
 
 
 
 
 
 
 
 
 
 
 
612
613 <a name="wiki"></a>TH1 wiki Command
614 -----------------------------------
615
616 * wiki STRING
617
--- www/th1.md
+++ www/th1.md
@@ -150,10 +150,11 @@
150 * hasfeature
151 * html
152 * htmlize
153 * http
154 * httpize
155 * insertCsrf
156 * linecount
157 * markdown
158 * puts
159 * query
160 * randhex
@@ -174,10 +175,11 @@
175 * tclMakeSafe
176 * tclReady
177 * trace
178 * stime
179 * utime
180 * verifyCsrf
181 * wiki
182
183 Each of the commands above is documented by a block comment above their
184 implementation in the th\_main.c or th\_tcl.c source files.
185
@@ -379,10 +381,18 @@
381
382 * httpize STRING
383
384 Escape all characters of STRING which have special meaning in URI
385 components. Returns the escaped string.
386
387 <a name="insertCsrf"></a>TH1 insertCsrf Command
388 -----------------------------------------------
389
390 * insertCsrf
391
392 While rendering a form, call this command to add the Anti-CSRF token
393 as a hidden element of the form.
394
395 <a name="linecount"></a>TH1 linecount Command
396 ---------------------------------------------
397
398 * linecount STRING MAX MIN
@@ -607,10 +617,21 @@
617
618 * utime
619
620 Returns the number of microseconds of CPU time consumed by the current
621 process in user space.
622
623 <a name="verifyCsrf"></a>TH1 verifyCsrf Command
624 -----------------------------------------------
625
626 * verifyCsrf
627
628 Before using the results of a form, first call this command to verify
629 that this Anti-CSRF token is present and is valid. If the Anti-CSRF token
630 is missing or is incorrect, that indicates a cross-site scripting attack.
631 If the event of an attack is detected, an error message is generated and
632 all further processing is aborted.
633
634 <a name="wiki"></a>TH1 wiki Command
635 -----------------------------------
636
637 * wiki STRING
638

Keyboard Shortcuts

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