Fossil SCM
Test of latest feature branches, do not merge.
Commit
1a164e5fb76a46ba6d811ce67245e0b5a9e43054
Parent
3c47e0c66a60c2c…
17 files changed
+11
-10
+11
-10
+11
-10
+11
-10
+16
-2
+16
-2
+16
-2
+16
-2
+16
-2
+45
+45
+45
+45
+21
+21
+21
+21
+11
-10
| --- src/login.c | ||
| +++ src/login.c | ||
| @@ -1075,29 +1075,30 @@ | ||
| 1075 | 1075 | if(NULL==zCap){ |
| 1076 | 1076 | return; |
| 1077 | 1077 | } |
| 1078 | 1078 | for(i=0; zCap[i]; i++){ |
| 1079 | 1079 | switch( zCap[i] ){ |
| 1080 | - case 's': p->Setup = 1; /* Fall thru into Admin */ | |
| 1080 | + case 's': p->Setup = 1; /* Fall thru into Admin */ | |
| 1081 | 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; | |
| 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; | |
| 1089 | 1090 | case 'o': p->Read = 1; break; |
| 1090 | 1091 | case 'z': p->Zip = 1; break; |
| 1091 | 1092 | |
| 1092 | 1093 | case 'd': p->Delete = 1; break; |
| 1093 | 1094 | case 'h': p->Hyperlink = 1; break; |
| 1094 | 1095 | case 'g': p->Clone = 1; break; |
| 1095 | 1096 | case 'p': p->Password = 1; break; |
| 1096 | 1097 | |
| 1097 | 1098 | 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; | |
| 1099 | 1100 | case 'm': p->ApndWiki = 1; break; |
| 1100 | 1101 | case 'f': p->NewWiki = 1; break; |
| 1101 | 1102 | case 'l': p->ModWiki = 1; break; |
| 1102 | 1103 | |
| 1103 | 1104 | case 'e': p->RdAddr = 1; break; |
| @@ -1181,11 +1182,11 @@ | ||
| 1181 | 1182 | /* case 'v': DEVELOPER */ |
| 1182 | 1183 | case 'w': rc = p->WrTkt; break; |
| 1183 | 1184 | case 'x': rc = p->Private; break; |
| 1184 | 1185 | /* case 'y': */ |
| 1185 | 1186 | case 'z': rc = p->Zip; break; |
| 1186 | - default: rc = 0; break; | |
| 1187 | + default: rc = 0; break; | |
| 1187 | 1188 | } |
| 1188 | 1189 | } |
| 1189 | 1190 | return rc; |
| 1190 | 1191 | } |
| 1191 | 1192 | |
| 1192 | 1193 |
| --- 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 @@ | ||
| 1075 | 1075 | if(NULL==zCap){ |
| 1076 | 1076 | return; |
| 1077 | 1077 | } |
| 1078 | 1078 | for(i=0; zCap[i]; i++){ |
| 1079 | 1079 | switch( zCap[i] ){ |
| 1080 | - case 's': p->Setup = 1; /* Fall thru into Admin */ | |
| 1080 | + case 's': p->Setup = 1; /* Fall thru into Admin */ | |
| 1081 | 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; | |
| 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; | |
| 1089 | 1090 | case 'o': p->Read = 1; break; |
| 1090 | 1091 | case 'z': p->Zip = 1; break; |
| 1091 | 1092 | |
| 1092 | 1093 | case 'd': p->Delete = 1; break; |
| 1093 | 1094 | case 'h': p->Hyperlink = 1; break; |
| 1094 | 1095 | case 'g': p->Clone = 1; break; |
| 1095 | 1096 | case 'p': p->Password = 1; break; |
| 1096 | 1097 | |
| 1097 | 1098 | 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; | |
| 1099 | 1100 | case 'm': p->ApndWiki = 1; break; |
| 1100 | 1101 | case 'f': p->NewWiki = 1; break; |
| 1101 | 1102 | case 'l': p->ModWiki = 1; break; |
| 1102 | 1103 | |
| 1103 | 1104 | case 'e': p->RdAddr = 1; break; |
| @@ -1181,11 +1182,11 @@ | ||
| 1181 | 1182 | /* case 'v': DEVELOPER */ |
| 1182 | 1183 | case 'w': rc = p->WrTkt; break; |
| 1183 | 1184 | case 'x': rc = p->Private; break; |
| 1184 | 1185 | /* case 'y': */ |
| 1185 | 1186 | case 'z': rc = p->Zip; break; |
| 1186 | - default: rc = 0; break; | |
| 1187 | + default: rc = 0; break; | |
| 1187 | 1188 | } |
| 1188 | 1189 | } |
| 1189 | 1190 | return rc; |
| 1190 | 1191 | } |
| 1191 | 1192 | |
| 1192 | 1193 |
| --- 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 @@ | ||
| 1075 | 1075 | if(NULL==zCap){ |
| 1076 | 1076 | return; |
| 1077 | 1077 | } |
| 1078 | 1078 | for(i=0; zCap[i]; i++){ |
| 1079 | 1079 | switch( zCap[i] ){ |
| 1080 | - case 's': p->Setup = 1; /* Fall thru into Admin */ | |
| 1080 | + case 's': p->Setup = 1; /* Fall thru into Admin */ | |
| 1081 | 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; | |
| 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; | |
| 1089 | 1090 | case 'o': p->Read = 1; break; |
| 1090 | 1091 | case 'z': p->Zip = 1; break; |
| 1091 | 1092 | |
| 1092 | 1093 | case 'd': p->Delete = 1; break; |
| 1093 | 1094 | case 'h': p->Hyperlink = 1; break; |
| 1094 | 1095 | case 'g': p->Clone = 1; break; |
| 1095 | 1096 | case 'p': p->Password = 1; break; |
| 1096 | 1097 | |
| 1097 | 1098 | 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; | |
| 1099 | 1100 | case 'm': p->ApndWiki = 1; break; |
| 1100 | 1101 | case 'f': p->NewWiki = 1; break; |
| 1101 | 1102 | case 'l': p->ModWiki = 1; break; |
| 1102 | 1103 | |
| 1103 | 1104 | case 'e': p->RdAddr = 1; break; |
| @@ -1181,11 +1182,11 @@ | ||
| 1181 | 1182 | /* case 'v': DEVELOPER */ |
| 1182 | 1183 | case 'w': rc = p->WrTkt; break; |
| 1183 | 1184 | case 'x': rc = p->Private; break; |
| 1184 | 1185 | /* case 'y': */ |
| 1185 | 1186 | case 'z': rc = p->Zip; break; |
| 1186 | - default: rc = 0; break; | |
| 1187 | + default: rc = 0; break; | |
| 1187 | 1188 | } |
| 1188 | 1189 | } |
| 1189 | 1190 | return rc; |
| 1190 | 1191 | } |
| 1191 | 1192 | |
| 1192 | 1193 |
| --- 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 @@ | ||
| 1075 | 1075 | if(NULL==zCap){ |
| 1076 | 1076 | return; |
| 1077 | 1077 | } |
| 1078 | 1078 | for(i=0; zCap[i]; i++){ |
| 1079 | 1079 | switch( zCap[i] ){ |
| 1080 | - case 's': p->Setup = 1; /* Fall thru into Admin */ | |
| 1080 | + case 's': p->Setup = 1; /* Fall thru into Admin */ | |
| 1081 | 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; | |
| 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; | |
| 1089 | 1090 | case 'o': p->Read = 1; break; |
| 1090 | 1091 | case 'z': p->Zip = 1; break; |
| 1091 | 1092 | |
| 1092 | 1093 | case 'd': p->Delete = 1; break; |
| 1093 | 1094 | case 'h': p->Hyperlink = 1; break; |
| 1094 | 1095 | case 'g': p->Clone = 1; break; |
| 1095 | 1096 | case 'p': p->Password = 1; break; |
| 1096 | 1097 | |
| 1097 | 1098 | 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; | |
| 1099 | 1100 | case 'm': p->ApndWiki = 1; break; |
| 1100 | 1101 | case 'f': p->NewWiki = 1; break; |
| 1101 | 1102 | case 'l': p->ModWiki = 1; break; |
| 1102 | 1103 | |
| 1103 | 1104 | case 'e': p->RdAddr = 1; break; |
| @@ -1181,11 +1182,11 @@ | ||
| 1181 | 1182 | /* case 'v': DEVELOPER */ |
| 1182 | 1183 | case 'w': rc = p->WrTkt; break; |
| 1183 | 1184 | case 'x': rc = p->Private; break; |
| 1184 | 1185 | /* case 'y': */ |
| 1185 | 1186 | case 'z': rc = p->Zip; break; |
| 1186 | - default: rc = 0; break; | |
| 1187 | + default: rc = 0; break; | |
| 1187 | 1188 | } |
| 1188 | 1189 | } |
| 1189 | 1190 | return rc; |
| 1190 | 1191 | } |
| 1191 | 1192 | |
| 1192 | 1193 |
| --- 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 @@ | ||
| 1397 | 1397 | |
| 1398 | 1398 | if( g.zBaseURL!=0 ) return; |
| 1399 | 1399 | if( zAltBase ){ |
| 1400 | 1400 | int i, n, c; |
| 1401 | 1401 | 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{ | |
| 1403 | 1409 | fossil_fatal("argument to --baseurl should be 'http://host/path'" |
| 1404 | 1410 | " or 'https://host/path'"); |
| 1405 | 1411 | } |
| 1406 | 1412 | for(i=n=0; (c = g.zTop[i])!=0; i++){ |
| 1407 | 1413 | if( c=='/' ){ |
| @@ -2429,11 +2435,13 @@ | ||
| 2429 | 2435 | ** --create Create a new REPOSITORY if it does not already exist |
| 2430 | 2436 | ** --page PAGE Start "ui" on PAGE. ex: --page "timeline?y=ci" |
| 2431 | 2437 | ** --files GLOBLIST Comma-separated list of glob patterns for static files |
| 2432 | 2438 | ** --localauth enable automatic login for requests from localhost |
| 2433 | 2439 | ** --localhost listen on 127.0.0.1 only (always true for "ui") |
| 2440 | +** --https signal a request coming in via https | |
| 2434 | 2441 | ** --nojail Drop root privileges but do not enter the chroot jail |
| 2442 | +** --nossl signal that no SSL connections are available | |
| 2435 | 2443 | ** --notfound URL Redirect |
| 2436 | 2444 | ** -P|--port TCPPORT listen to request on port TCPPORT |
| 2437 | 2445 | ** --th-trace trace TH1 execution (for debugging purposes) |
| 2438 | 2446 | ** --repolist If REPOSITORY is dir, URL "/" lists repos. |
| 2439 | 2447 | ** --scgi Accept SCGI rather than HTTP |
| @@ -2490,10 +2498,17 @@ | ||
| 2490 | 2498 | zAltBase = find_option("baseurl", 0, 1); |
| 2491 | 2499 | fCreate = find_option("create",0,0)!=0; |
| 2492 | 2500 | if( find_option("scgi", 0, 0)!=0 ) flags |= HTTP_SERVER_SCGI; |
| 2493 | 2501 | if( zAltBase ){ |
| 2494 | 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; | |
| 2495 | 2510 | } |
| 2496 | 2511 | if( find_option("localhost", 0, 0)!=0 ){ |
| 2497 | 2512 | flags |= HTTP_SERVER_LOCALHOST; |
| 2498 | 2513 | } |
| 2499 | 2514 | |
| @@ -2551,11 +2566,10 @@ | ||
| 2551 | 2566 | if( g.localOpen ) flags |= HTTP_SERVER_HAD_CHECKOUT; |
| 2552 | 2567 | db_close(1); |
| 2553 | 2568 | if( cgi_http_server(iPort, mxPort, zBrowserCmd, zIpAddr, flags) ){ |
| 2554 | 2569 | fossil_fatal("unable to listen on TCP socket %d", iPort); |
| 2555 | 2570 | } |
| 2556 | - g.sslNotAvailable = 1; | |
| 2557 | 2571 | g.httpIn = stdin; |
| 2558 | 2572 | g.httpOut = stdout; |
| 2559 | 2573 | if( g.fHttpTrace || g.fSqlTrace ){ |
| 2560 | 2574 | fprintf(stderr, "====== SERVER pid %d =======\n", getpid()); |
| 2561 | 2575 | } |
| 2562 | 2576 |
| --- 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 @@ | ||
| 1397 | 1397 | |
| 1398 | 1398 | if( g.zBaseURL!=0 ) return; |
| 1399 | 1399 | if( zAltBase ){ |
| 1400 | 1400 | int i, n, c; |
| 1401 | 1401 | 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{ | |
| 1403 | 1409 | fossil_fatal("argument to --baseurl should be 'http://host/path'" |
| 1404 | 1410 | " or 'https://host/path'"); |
| 1405 | 1411 | } |
| 1406 | 1412 | for(i=n=0; (c = g.zTop[i])!=0; i++){ |
| 1407 | 1413 | if( c=='/' ){ |
| @@ -2429,11 +2435,13 @@ | ||
| 2429 | 2435 | ** --create Create a new REPOSITORY if it does not already exist |
| 2430 | 2436 | ** --page PAGE Start "ui" on PAGE. ex: --page "timeline?y=ci" |
| 2431 | 2437 | ** --files GLOBLIST Comma-separated list of glob patterns for static files |
| 2432 | 2438 | ** --localauth enable automatic login for requests from localhost |
| 2433 | 2439 | ** --localhost listen on 127.0.0.1 only (always true for "ui") |
| 2440 | +** --https signal a request coming in via https | |
| 2434 | 2441 | ** --nojail Drop root privileges but do not enter the chroot jail |
| 2442 | +** --nossl signal that no SSL connections are available | |
| 2435 | 2443 | ** --notfound URL Redirect |
| 2436 | 2444 | ** -P|--port TCPPORT listen to request on port TCPPORT |
| 2437 | 2445 | ** --th-trace trace TH1 execution (for debugging purposes) |
| 2438 | 2446 | ** --repolist If REPOSITORY is dir, URL "/" lists repos. |
| 2439 | 2447 | ** --scgi Accept SCGI rather than HTTP |
| @@ -2490,10 +2498,17 @@ | ||
| 2490 | 2498 | zAltBase = find_option("baseurl", 0, 1); |
| 2491 | 2499 | fCreate = find_option("create",0,0)!=0; |
| 2492 | 2500 | if( find_option("scgi", 0, 0)!=0 ) flags |= HTTP_SERVER_SCGI; |
| 2493 | 2501 | if( zAltBase ){ |
| 2494 | 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; | |
| 2495 | 2510 | } |
| 2496 | 2511 | if( find_option("localhost", 0, 0)!=0 ){ |
| 2497 | 2512 | flags |= HTTP_SERVER_LOCALHOST; |
| 2498 | 2513 | } |
| 2499 | 2514 | |
| @@ -2551,11 +2566,10 @@ | ||
| 2551 | 2566 | if( g.localOpen ) flags |= HTTP_SERVER_HAD_CHECKOUT; |
| 2552 | 2567 | db_close(1); |
| 2553 | 2568 | if( cgi_http_server(iPort, mxPort, zBrowserCmd, zIpAddr, flags) ){ |
| 2554 | 2569 | fossil_fatal("unable to listen on TCP socket %d", iPort); |
| 2555 | 2570 | } |
| 2556 | - g.sslNotAvailable = 1; | |
| 2557 | 2571 | g.httpIn = stdin; |
| 2558 | 2572 | g.httpOut = stdout; |
| 2559 | 2573 | if( g.fHttpTrace || g.fSqlTrace ){ |
| 2560 | 2574 | fprintf(stderr, "====== SERVER pid %d =======\n", getpid()); |
| 2561 | 2575 | } |
| 2562 | 2576 |
| --- 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 @@ | ||
| 1397 | 1397 | |
| 1398 | 1398 | if( g.zBaseURL!=0 ) return; |
| 1399 | 1399 | if( zAltBase ){ |
| 1400 | 1400 | int i, n, c; |
| 1401 | 1401 | 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{ | |
| 1403 | 1409 | fossil_fatal("argument to --baseurl should be 'http://host/path'" |
| 1404 | 1410 | " or 'https://host/path'"); |
| 1405 | 1411 | } |
| 1406 | 1412 | for(i=n=0; (c = g.zTop[i])!=0; i++){ |
| 1407 | 1413 | if( c=='/' ){ |
| @@ -2429,11 +2435,13 @@ | ||
| 2429 | 2435 | ** --create Create a new REPOSITORY if it does not already exist |
| 2430 | 2436 | ** --page PAGE Start "ui" on PAGE. ex: --page "timeline?y=ci" |
| 2431 | 2437 | ** --files GLOBLIST Comma-separated list of glob patterns for static files |
| 2432 | 2438 | ** --localauth enable automatic login for requests from localhost |
| 2433 | 2439 | ** --localhost listen on 127.0.0.1 only (always true for "ui") |
| 2440 | +** --https signal a request coming in via https | |
| 2434 | 2441 | ** --nojail Drop root privileges but do not enter the chroot jail |
| 2442 | +** --nossl signal that no SSL connections are available | |
| 2435 | 2443 | ** --notfound URL Redirect |
| 2436 | 2444 | ** -P|--port TCPPORT listen to request on port TCPPORT |
| 2437 | 2445 | ** --th-trace trace TH1 execution (for debugging purposes) |
| 2438 | 2446 | ** --repolist If REPOSITORY is dir, URL "/" lists repos. |
| 2439 | 2447 | ** --scgi Accept SCGI rather than HTTP |
| @@ -2490,10 +2498,17 @@ | ||
| 2490 | 2498 | zAltBase = find_option("baseurl", 0, 1); |
| 2491 | 2499 | fCreate = find_option("create",0,0)!=0; |
| 2492 | 2500 | if( find_option("scgi", 0, 0)!=0 ) flags |= HTTP_SERVER_SCGI; |
| 2493 | 2501 | if( zAltBase ){ |
| 2494 | 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; | |
| 2495 | 2510 | } |
| 2496 | 2511 | if( find_option("localhost", 0, 0)!=0 ){ |
| 2497 | 2512 | flags |= HTTP_SERVER_LOCALHOST; |
| 2498 | 2513 | } |
| 2499 | 2514 | |
| @@ -2551,11 +2566,10 @@ | ||
| 2551 | 2566 | if( g.localOpen ) flags |= HTTP_SERVER_HAD_CHECKOUT; |
| 2552 | 2567 | db_close(1); |
| 2553 | 2568 | if( cgi_http_server(iPort, mxPort, zBrowserCmd, zIpAddr, flags) ){ |
| 2554 | 2569 | fossil_fatal("unable to listen on TCP socket %d", iPort); |
| 2555 | 2570 | } |
| 2556 | - g.sslNotAvailable = 1; | |
| 2557 | 2571 | g.httpIn = stdin; |
| 2558 | 2572 | g.httpOut = stdout; |
| 2559 | 2573 | if( g.fHttpTrace || g.fSqlTrace ){ |
| 2560 | 2574 | fprintf(stderr, "====== SERVER pid %d =======\n", getpid()); |
| 2561 | 2575 | } |
| 2562 | 2576 |
| --- 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 @@ | ||
| 1397 | 1397 | |
| 1398 | 1398 | if( g.zBaseURL!=0 ) return; |
| 1399 | 1399 | if( zAltBase ){ |
| 1400 | 1400 | int i, n, c; |
| 1401 | 1401 | 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{ | |
| 1403 | 1409 | fossil_fatal("argument to --baseurl should be 'http://host/path'" |
| 1404 | 1410 | " or 'https://host/path'"); |
| 1405 | 1411 | } |
| 1406 | 1412 | for(i=n=0; (c = g.zTop[i])!=0; i++){ |
| 1407 | 1413 | if( c=='/' ){ |
| @@ -2429,11 +2435,13 @@ | ||
| 2429 | 2435 | ** --create Create a new REPOSITORY if it does not already exist |
| 2430 | 2436 | ** --page PAGE Start "ui" on PAGE. ex: --page "timeline?y=ci" |
| 2431 | 2437 | ** --files GLOBLIST Comma-separated list of glob patterns for static files |
| 2432 | 2438 | ** --localauth enable automatic login for requests from localhost |
| 2433 | 2439 | ** --localhost listen on 127.0.0.1 only (always true for "ui") |
| 2440 | +** --https signal a request coming in via https | |
| 2434 | 2441 | ** --nojail Drop root privileges but do not enter the chroot jail |
| 2442 | +** --nossl signal that no SSL connections are available | |
| 2435 | 2443 | ** --notfound URL Redirect |
| 2436 | 2444 | ** -P|--port TCPPORT listen to request on port TCPPORT |
| 2437 | 2445 | ** --th-trace trace TH1 execution (for debugging purposes) |
| 2438 | 2446 | ** --repolist If REPOSITORY is dir, URL "/" lists repos. |
| 2439 | 2447 | ** --scgi Accept SCGI rather than HTTP |
| @@ -2490,10 +2498,17 @@ | ||
| 2490 | 2498 | zAltBase = find_option("baseurl", 0, 1); |
| 2491 | 2499 | fCreate = find_option("create",0,0)!=0; |
| 2492 | 2500 | if( find_option("scgi", 0, 0)!=0 ) flags |= HTTP_SERVER_SCGI; |
| 2493 | 2501 | if( zAltBase ){ |
| 2494 | 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; | |
| 2495 | 2510 | } |
| 2496 | 2511 | if( find_option("localhost", 0, 0)!=0 ){ |
| 2497 | 2512 | flags |= HTTP_SERVER_LOCALHOST; |
| 2498 | 2513 | } |
| 2499 | 2514 | |
| @@ -2551,11 +2566,10 @@ | ||
| 2551 | 2566 | if( g.localOpen ) flags |= HTTP_SERVER_HAD_CHECKOUT; |
| 2552 | 2567 | db_close(1); |
| 2553 | 2568 | if( cgi_http_server(iPort, mxPort, zBrowserCmd, zIpAddr, flags) ){ |
| 2554 | 2569 | fossil_fatal("unable to listen on TCP socket %d", iPort); |
| 2555 | 2570 | } |
| 2556 | - g.sslNotAvailable = 1; | |
| 2557 | 2571 | g.httpIn = stdin; |
| 2558 | 2572 | g.httpOut = stdout; |
| 2559 | 2573 | if( g.fHttpTrace || g.fSqlTrace ){ |
| 2560 | 2574 | fprintf(stderr, "====== SERVER pid %d =======\n", getpid()); |
| 2561 | 2575 | } |
| 2562 | 2576 |
| --- 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 @@ | ||
| 1397 | 1397 | |
| 1398 | 1398 | if( g.zBaseURL!=0 ) return; |
| 1399 | 1399 | if( zAltBase ){ |
| 1400 | 1400 | int i, n, c; |
| 1401 | 1401 | 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{ | |
| 1403 | 1409 | fossil_fatal("argument to --baseurl should be 'http://host/path'" |
| 1404 | 1410 | " or 'https://host/path'"); |
| 1405 | 1411 | } |
| 1406 | 1412 | for(i=n=0; (c = g.zTop[i])!=0; i++){ |
| 1407 | 1413 | if( c=='/' ){ |
| @@ -2429,11 +2435,13 @@ | ||
| 2429 | 2435 | ** --create Create a new REPOSITORY if it does not already exist |
| 2430 | 2436 | ** --page PAGE Start "ui" on PAGE. ex: --page "timeline?y=ci" |
| 2431 | 2437 | ** --files GLOBLIST Comma-separated list of glob patterns for static files |
| 2432 | 2438 | ** --localauth enable automatic login for requests from localhost |
| 2433 | 2439 | ** --localhost listen on 127.0.0.1 only (always true for "ui") |
| 2440 | +** --https signal a request coming in via https | |
| 2434 | 2441 | ** --nojail Drop root privileges but do not enter the chroot jail |
| 2442 | +** --nossl signal that no SSL connections are available | |
| 2435 | 2443 | ** --notfound URL Redirect |
| 2436 | 2444 | ** -P|--port TCPPORT listen to request on port TCPPORT |
| 2437 | 2445 | ** --th-trace trace TH1 execution (for debugging purposes) |
| 2438 | 2446 | ** --repolist If REPOSITORY is dir, URL "/" lists repos. |
| 2439 | 2447 | ** --scgi Accept SCGI rather than HTTP |
| @@ -2490,10 +2498,17 @@ | ||
| 2490 | 2498 | zAltBase = find_option("baseurl", 0, 1); |
| 2491 | 2499 | fCreate = find_option("create",0,0)!=0; |
| 2492 | 2500 | if( find_option("scgi", 0, 0)!=0 ) flags |= HTTP_SERVER_SCGI; |
| 2493 | 2501 | if( zAltBase ){ |
| 2494 | 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; | |
| 2495 | 2510 | } |
| 2496 | 2511 | if( find_option("localhost", 0, 0)!=0 ){ |
| 2497 | 2512 | flags |= HTTP_SERVER_LOCALHOST; |
| 2498 | 2513 | } |
| 2499 | 2514 | |
| @@ -2551,11 +2566,10 @@ | ||
| 2551 | 2566 | if( g.localOpen ) flags |= HTTP_SERVER_HAD_CHECKOUT; |
| 2552 | 2567 | db_close(1); |
| 2553 | 2568 | if( cgi_http_server(iPort, mxPort, zBrowserCmd, zIpAddr, flags) ){ |
| 2554 | 2569 | fossil_fatal("unable to listen on TCP socket %d", iPort); |
| 2555 | 2570 | } |
| 2556 | - g.sslNotAvailable = 1; | |
| 2557 | 2571 | g.httpIn = stdin; |
| 2558 | 2572 | g.httpOut = stdout; |
| 2559 | 2573 | if( g.fHttpTrace || g.fSqlTrace ){ |
| 2560 | 2574 | fprintf(stderr, "====== SERVER pid %d =======\n", getpid()); |
| 2561 | 2575 | } |
| 2562 | 2576 |
| --- 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 |
+45
| --- src/th_main.c | ||
| +++ src/th_main.c | ||
| @@ -451,10 +451,53 @@ | ||
| 451 | 451 | } |
| 452 | 452 | cgi_redirect(argv[1]); |
| 453 | 453 | Th_SetResult(interp, argv[1], argl[1]); /* NOT REACHED */ |
| 454 | 454 | return TH_OK; |
| 455 | 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 | +} | |
| 456 | 499 | |
| 457 | 500 | /* |
| 458 | 501 | ** TH1 command: markdown STRING |
| 459 | 502 | ** |
| 460 | 503 | ** Renders the input string as markdown. The result is a two-element list. |
| @@ -1788,10 +1831,11 @@ | ||
| 1788 | 1831 | {"hascap", hascapCmd, (void*)&zeroInt}, |
| 1789 | 1832 | {"hasfeature", hasfeatureCmd, 0}, |
| 1790 | 1833 | {"html", putsCmd, (void*)&aFlags[0]}, |
| 1791 | 1834 | {"htmlize", htmlizeCmd, 0}, |
| 1792 | 1835 | {"http", httpCmd, 0}, |
| 1836 | + {"insertCsrf", insertCsrfCmd, 0}, | |
| 1793 | 1837 | {"linecount", linecntCmd, 0}, |
| 1794 | 1838 | {"markdown", markdownCmd, 0}, |
| 1795 | 1839 | {"puts", putsCmd, (void*)&aFlags[1]}, |
| 1796 | 1840 | {"query", queryCmd, 0}, |
| 1797 | 1841 | {"randhex", randhexCmd, 0}, |
| @@ -1807,10 +1851,11 @@ | ||
| 1807 | 1851 | {"styleFooter", styleFooterCmd, 0}, |
| 1808 | 1852 | {"tclReady", tclReadyCmd, 0}, |
| 1809 | 1853 | {"trace", traceCmd, 0}, |
| 1810 | 1854 | {"stime", stimeCmd, 0}, |
| 1811 | 1855 | {"utime", utimeCmd, 0}, |
| 1856 | + {"verifyCsrf", verifyCsrfCmd, 0}, | |
| 1812 | 1857 | {"wiki", wikiCmd, (void*)&aFlags[0]}, |
| 1813 | 1858 | {0, 0, 0} |
| 1814 | 1859 | }; |
| 1815 | 1860 | if( g.thTrace ){ |
| 1816 | 1861 | Th_Trace("th1-init 0x%x => 0x%x<br />\n", g.th1Flags, flags); |
| 1817 | 1862 |
| --- 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 |
+45
| --- src/th_main.c | ||
| +++ src/th_main.c | ||
| @@ -451,10 +451,53 @@ | ||
| 451 | 451 | } |
| 452 | 452 | cgi_redirect(argv[1]); |
| 453 | 453 | Th_SetResult(interp, argv[1], argl[1]); /* NOT REACHED */ |
| 454 | 454 | return TH_OK; |
| 455 | 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 | +} | |
| 456 | 499 | |
| 457 | 500 | /* |
| 458 | 501 | ** TH1 command: markdown STRING |
| 459 | 502 | ** |
| 460 | 503 | ** Renders the input string as markdown. The result is a two-element list. |
| @@ -1788,10 +1831,11 @@ | ||
| 1788 | 1831 | {"hascap", hascapCmd, (void*)&zeroInt}, |
| 1789 | 1832 | {"hasfeature", hasfeatureCmd, 0}, |
| 1790 | 1833 | {"html", putsCmd, (void*)&aFlags[0]}, |
| 1791 | 1834 | {"htmlize", htmlizeCmd, 0}, |
| 1792 | 1835 | {"http", httpCmd, 0}, |
| 1836 | + {"insertCsrf", insertCsrfCmd, 0}, | |
| 1793 | 1837 | {"linecount", linecntCmd, 0}, |
| 1794 | 1838 | {"markdown", markdownCmd, 0}, |
| 1795 | 1839 | {"puts", putsCmd, (void*)&aFlags[1]}, |
| 1796 | 1840 | {"query", queryCmd, 0}, |
| 1797 | 1841 | {"randhex", randhexCmd, 0}, |
| @@ -1807,10 +1851,11 @@ | ||
| 1807 | 1851 | {"styleFooter", styleFooterCmd, 0}, |
| 1808 | 1852 | {"tclReady", tclReadyCmd, 0}, |
| 1809 | 1853 | {"trace", traceCmd, 0}, |
| 1810 | 1854 | {"stime", stimeCmd, 0}, |
| 1811 | 1855 | {"utime", utimeCmd, 0}, |
| 1856 | + {"verifyCsrf", verifyCsrfCmd, 0}, | |
| 1812 | 1857 | {"wiki", wikiCmd, (void*)&aFlags[0]}, |
| 1813 | 1858 | {0, 0, 0} |
| 1814 | 1859 | }; |
| 1815 | 1860 | if( g.thTrace ){ |
| 1816 | 1861 | Th_Trace("th1-init 0x%x => 0x%x<br />\n", g.th1Flags, flags); |
| 1817 | 1862 |
| --- 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 |
+45
| --- src/th_main.c | ||
| +++ src/th_main.c | ||
| @@ -451,10 +451,53 @@ | ||
| 451 | 451 | } |
| 452 | 452 | cgi_redirect(argv[1]); |
| 453 | 453 | Th_SetResult(interp, argv[1], argl[1]); /* NOT REACHED */ |
| 454 | 454 | return TH_OK; |
| 455 | 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 | +} | |
| 456 | 499 | |
| 457 | 500 | /* |
| 458 | 501 | ** TH1 command: markdown STRING |
| 459 | 502 | ** |
| 460 | 503 | ** Renders the input string as markdown. The result is a two-element list. |
| @@ -1788,10 +1831,11 @@ | ||
| 1788 | 1831 | {"hascap", hascapCmd, (void*)&zeroInt}, |
| 1789 | 1832 | {"hasfeature", hasfeatureCmd, 0}, |
| 1790 | 1833 | {"html", putsCmd, (void*)&aFlags[0]}, |
| 1791 | 1834 | {"htmlize", htmlizeCmd, 0}, |
| 1792 | 1835 | {"http", httpCmd, 0}, |
| 1836 | + {"insertCsrf", insertCsrfCmd, 0}, | |
| 1793 | 1837 | {"linecount", linecntCmd, 0}, |
| 1794 | 1838 | {"markdown", markdownCmd, 0}, |
| 1795 | 1839 | {"puts", putsCmd, (void*)&aFlags[1]}, |
| 1796 | 1840 | {"query", queryCmd, 0}, |
| 1797 | 1841 | {"randhex", randhexCmd, 0}, |
| @@ -1807,10 +1851,11 @@ | ||
| 1807 | 1851 | {"styleFooter", styleFooterCmd, 0}, |
| 1808 | 1852 | {"tclReady", tclReadyCmd, 0}, |
| 1809 | 1853 | {"trace", traceCmd, 0}, |
| 1810 | 1854 | {"stime", stimeCmd, 0}, |
| 1811 | 1855 | {"utime", utimeCmd, 0}, |
| 1856 | + {"verifyCsrf", verifyCsrfCmd, 0}, | |
| 1812 | 1857 | {"wiki", wikiCmd, (void*)&aFlags[0]}, |
| 1813 | 1858 | {0, 0, 0} |
| 1814 | 1859 | }; |
| 1815 | 1860 | if( g.thTrace ){ |
| 1816 | 1861 | Th_Trace("th1-init 0x%x => 0x%x<br />\n", g.th1Flags, flags); |
| 1817 | 1862 |
| --- 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 |
+45
| --- src/th_main.c | ||
| +++ src/th_main.c | ||
| @@ -451,10 +451,53 @@ | ||
| 451 | 451 | } |
| 452 | 452 | cgi_redirect(argv[1]); |
| 453 | 453 | Th_SetResult(interp, argv[1], argl[1]); /* NOT REACHED */ |
| 454 | 454 | return TH_OK; |
| 455 | 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 | +} | |
| 456 | 499 | |
| 457 | 500 | /* |
| 458 | 501 | ** TH1 command: markdown STRING |
| 459 | 502 | ** |
| 460 | 503 | ** Renders the input string as markdown. The result is a two-element list. |
| @@ -1788,10 +1831,11 @@ | ||
| 1788 | 1831 | {"hascap", hascapCmd, (void*)&zeroInt}, |
| 1789 | 1832 | {"hasfeature", hasfeatureCmd, 0}, |
| 1790 | 1833 | {"html", putsCmd, (void*)&aFlags[0]}, |
| 1791 | 1834 | {"htmlize", htmlizeCmd, 0}, |
| 1792 | 1835 | {"http", httpCmd, 0}, |
| 1836 | + {"insertCsrf", insertCsrfCmd, 0}, | |
| 1793 | 1837 | {"linecount", linecntCmd, 0}, |
| 1794 | 1838 | {"markdown", markdownCmd, 0}, |
| 1795 | 1839 | {"puts", putsCmd, (void*)&aFlags[1]}, |
| 1796 | 1840 | {"query", queryCmd, 0}, |
| 1797 | 1841 | {"randhex", randhexCmd, 0}, |
| @@ -1807,10 +1851,11 @@ | ||
| 1807 | 1851 | {"styleFooter", styleFooterCmd, 0}, |
| 1808 | 1852 | {"tclReady", tclReadyCmd, 0}, |
| 1809 | 1853 | {"trace", traceCmd, 0}, |
| 1810 | 1854 | {"stime", stimeCmd, 0}, |
| 1811 | 1855 | {"utime", utimeCmd, 0}, |
| 1856 | + {"verifyCsrf", verifyCsrfCmd, 0}, | |
| 1812 | 1857 | {"wiki", wikiCmd, (void*)&aFlags[0]}, |
| 1813 | 1858 | {0, 0, 0} |
| 1814 | 1859 | }; |
| 1815 | 1860 | if( g.thTrace ){ |
| 1816 | 1861 | Th_Trace("th1-init 0x%x => 0x%x<br />\n", g.th1Flags, flags); |
| 1817 | 1862 |
| --- 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 @@ | ||
| 150 | 150 | * hasfeature |
| 151 | 151 | * html |
| 152 | 152 | * htmlize |
| 153 | 153 | * http |
| 154 | 154 | * httpize |
| 155 | + * insertCsrf | |
| 155 | 156 | * linecount |
| 156 | 157 | * markdown |
| 157 | 158 | * puts |
| 158 | 159 | * query |
| 159 | 160 | * randhex |
| @@ -174,10 +175,11 @@ | ||
| 174 | 175 | * tclMakeSafe |
| 175 | 176 | * tclReady |
| 176 | 177 | * trace |
| 177 | 178 | * stime |
| 178 | 179 | * utime |
| 180 | + * verifyCsrf | |
| 179 | 181 | * wiki |
| 180 | 182 | |
| 181 | 183 | Each of the commands above is documented by a block comment above their |
| 182 | 184 | implementation in the th\_main.c or th\_tcl.c source files. |
| 183 | 185 | |
| @@ -379,10 +381,18 @@ | ||
| 379 | 381 | |
| 380 | 382 | * httpize STRING |
| 381 | 383 | |
| 382 | 384 | Escape all characters of STRING which have special meaning in URI |
| 383 | 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. | |
| 384 | 394 | |
| 385 | 395 | <a name="linecount"></a>TH1 linecount Command |
| 386 | 396 | --------------------------------------------- |
| 387 | 397 | |
| 388 | 398 | * linecount STRING MAX MIN |
| @@ -607,10 +617,21 @@ | ||
| 607 | 617 | |
| 608 | 618 | * utime |
| 609 | 619 | |
| 610 | 620 | Returns the number of microseconds of CPU time consumed by the current |
| 611 | 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. | |
| 612 | 633 | |
| 613 | 634 | <a name="wiki"></a>TH1 wiki Command |
| 614 | 635 | ----------------------------------- |
| 615 | 636 | |
| 616 | 637 | * wiki STRING |
| 617 | 638 |
| --- 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 @@ | ||
| 150 | 150 | * hasfeature |
| 151 | 151 | * html |
| 152 | 152 | * htmlize |
| 153 | 153 | * http |
| 154 | 154 | * httpize |
| 155 | + * insertCsrf | |
| 155 | 156 | * linecount |
| 156 | 157 | * markdown |
| 157 | 158 | * puts |
| 158 | 159 | * query |
| 159 | 160 | * randhex |
| @@ -174,10 +175,11 @@ | ||
| 174 | 175 | * tclMakeSafe |
| 175 | 176 | * tclReady |
| 176 | 177 | * trace |
| 177 | 178 | * stime |
| 178 | 179 | * utime |
| 180 | + * verifyCsrf | |
| 179 | 181 | * wiki |
| 180 | 182 | |
| 181 | 183 | Each of the commands above is documented by a block comment above their |
| 182 | 184 | implementation in the th\_main.c or th\_tcl.c source files. |
| 183 | 185 | |
| @@ -379,10 +381,18 @@ | ||
| 379 | 381 | |
| 380 | 382 | * httpize STRING |
| 381 | 383 | |
| 382 | 384 | Escape all characters of STRING which have special meaning in URI |
| 383 | 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. | |
| 384 | 394 | |
| 385 | 395 | <a name="linecount"></a>TH1 linecount Command |
| 386 | 396 | --------------------------------------------- |
| 387 | 397 | |
| 388 | 398 | * linecount STRING MAX MIN |
| @@ -607,10 +617,21 @@ | ||
| 607 | 617 | |
| 608 | 618 | * utime |
| 609 | 619 | |
| 610 | 620 | Returns the number of microseconds of CPU time consumed by the current |
| 611 | 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. | |
| 612 | 633 | |
| 613 | 634 | <a name="wiki"></a>TH1 wiki Command |
| 614 | 635 | ----------------------------------- |
| 615 | 636 | |
| 616 | 637 | * wiki STRING |
| 617 | 638 |
| --- 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 @@ | ||
| 150 | 150 | * hasfeature |
| 151 | 151 | * html |
| 152 | 152 | * htmlize |
| 153 | 153 | * http |
| 154 | 154 | * httpize |
| 155 | + * insertCsrf | |
| 155 | 156 | * linecount |
| 156 | 157 | * markdown |
| 157 | 158 | * puts |
| 158 | 159 | * query |
| 159 | 160 | * randhex |
| @@ -174,10 +175,11 @@ | ||
| 174 | 175 | * tclMakeSafe |
| 175 | 176 | * tclReady |
| 176 | 177 | * trace |
| 177 | 178 | * stime |
| 178 | 179 | * utime |
| 180 | + * verifyCsrf | |
| 179 | 181 | * wiki |
| 180 | 182 | |
| 181 | 183 | Each of the commands above is documented by a block comment above their |
| 182 | 184 | implementation in the th\_main.c or th\_tcl.c source files. |
| 183 | 185 | |
| @@ -379,10 +381,18 @@ | ||
| 379 | 381 | |
| 380 | 382 | * httpize STRING |
| 381 | 383 | |
| 382 | 384 | Escape all characters of STRING which have special meaning in URI |
| 383 | 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. | |
| 384 | 394 | |
| 385 | 395 | <a name="linecount"></a>TH1 linecount Command |
| 386 | 396 | --------------------------------------------- |
| 387 | 397 | |
| 388 | 398 | * linecount STRING MAX MIN |
| @@ -607,10 +617,21 @@ | ||
| 607 | 617 | |
| 608 | 618 | * utime |
| 609 | 619 | |
| 610 | 620 | Returns the number of microseconds of CPU time consumed by the current |
| 611 | 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. | |
| 612 | 633 | |
| 613 | 634 | <a name="wiki"></a>TH1 wiki Command |
| 614 | 635 | ----------------------------------- |
| 615 | 636 | |
| 616 | 637 | * wiki STRING |
| 617 | 638 |
| --- 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 @@ | ||
| 150 | 150 | * hasfeature |
| 151 | 151 | * html |
| 152 | 152 | * htmlize |
| 153 | 153 | * http |
| 154 | 154 | * httpize |
| 155 | + * insertCsrf | |
| 155 | 156 | * linecount |
| 156 | 157 | * markdown |
| 157 | 158 | * puts |
| 158 | 159 | * query |
| 159 | 160 | * randhex |
| @@ -174,10 +175,11 @@ | ||
| 174 | 175 | * tclMakeSafe |
| 175 | 176 | * tclReady |
| 176 | 177 | * trace |
| 177 | 178 | * stime |
| 178 | 179 | * utime |
| 180 | + * verifyCsrf | |
| 179 | 181 | * wiki |
| 180 | 182 | |
| 181 | 183 | Each of the commands above is documented by a block comment above their |
| 182 | 184 | implementation in the th\_main.c or th\_tcl.c source files. |
| 183 | 185 | |
| @@ -379,10 +381,18 @@ | ||
| 379 | 381 | |
| 380 | 382 | * httpize STRING |
| 381 | 383 | |
| 382 | 384 | Escape all characters of STRING which have special meaning in URI |
| 383 | 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. | |
| 384 | 394 | |
| 385 | 395 | <a name="linecount"></a>TH1 linecount Command |
| 386 | 396 | --------------------------------------------- |
| 387 | 397 | |
| 388 | 398 | * linecount STRING MAX MIN |
| @@ -607,10 +617,21 @@ | ||
| 607 | 617 | |
| 608 | 618 | * utime |
| 609 | 619 | |
| 610 | 620 | Returns the number of microseconds of CPU time consumed by the current |
| 611 | 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. | |
| 612 | 633 | |
| 613 | 634 | <a name="wiki"></a>TH1 wiki Command |
| 614 | 635 | ----------------------------------- |
| 615 | 636 | |
| 616 | 637 | * wiki STRING |
| 617 | 638 |
| --- 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 |