Changeset 22 in Main for trunk/Server/config.c
- Timestamp:
- Sep 14, 2024, 10:25:38 PM (2 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Server/config.c
r21 r22 31 31 } 32 32 33 bool tw_permission_allowed(const char* path, SOCKADDR addr, struct tw_http_request req, struct tw_config_entry* vhost) {33 bool tw_permission_allowed(const char* path, SOCKADDR addr, struct tw_http_request req, struct tw_config_entry* vhost) { 34 34 int i; 35 35 bool found = false; … … 37 37 bool perm = false; 38 38 again: 39 for(i = 0; i < vhost->dir_count; i++) {39 for(i = 0; i < vhost->dir_count; i++) { 40 40 struct tw_dir_entry* e = &vhost->dirs[i]; 41 41 pathstart = false; 42 if(strlen(path) >= strlen(e->dir)) {42 if(strlen(path) >= strlen(e->dir)) { 43 43 pathstart = true; 44 44 int j; 45 for(j = 0; path[j] != 0 && e->dir[j] != 0; j++) {46 if(path[j] != e->dir[j]) {45 for(j = 0; path[j] != 0 && e->dir[j] != 0; j++) { 46 if(path[j] != e->dir[j]) { 47 47 pathstart = false; 48 48 break; … … 52 52 char* noslash = cm_strdup(e->dir); 53 53 noslash[strlen(noslash) - 1] = 0; 54 if(strcmp(e->dir, path) == 0 || strcmp(noslash, path) == 0 || pathstart) {54 if(strcmp(e->dir, path) == 0 || strcmp(noslash, path) == 0 || pathstart) { 55 55 found = true; 56 if(strcmp(e->name, "all") == 0) {56 if(strcmp(e->name, "all") == 0) { 57 57 perm = e->type == TW_DIR_ALLOW; 58 58 } … … 60 60 free(noslash); 61 61 } 62 if(!found && vhost != &config.root) {62 if(!found && vhost != &config.root) { 63 63 vhost = &config.root; 64 64 goto again; … … 82 82 config.root.mime_count = 0; 83 83 config.root.dir_count = 0; 84 config.root.icon_count = 0; 84 85 config.vhost_count = 0; 85 86 config.module_count = 0; … … 180 181 current->dir_count = 0; 181 182 current->mime_count = 0; 183 current->icon_count = 0; 182 184 int i; 183 185 current->name = cm_strdup(vhost); … … 247 249 cm_log("Config", "Missing extension at line %d", ln); 248 250 stop = 1; 249 } else if(r[2] == NULL) {251 } else if(r[2] == NULL) { 250 252 cm_log("Config", "Missing MIME at line %d", ln); 251 253 stop = 1; … … 254 256 e->ext = cm_strdup(r[1]); 255 257 e->mime = cm_strdup(r[2]); 258 } 259 } else if(cm_strcaseequ(r[0], "Icon")) { 260 if(r[1] == NULL) { 261 cm_log("Config", "Missing MIME at line %d", ln); 262 stop = 1; 263 } else if(r[2] == NULL) { 264 cm_log("Config", "Missing path at line %d", ln); 265 stop = 1; 266 } else { 267 struct tw_icon_entry* e = ¤t->icons[current->icon_count++]; 268 e->mime = cm_strdup(r[1]); 269 e->icon = cm_strdup(r[2]); 256 270 } 257 271 } else if(cm_strcaseequ(r[0], "LoadModule")) {
Note:
See TracChangeset
for help on using the changeset viewer.