| 2628 | } |
| 2629 | |
| 2630 | static const char *filesection(cmd_parms *cmd, void *mconfig, const char *arg) |
| 2631 | { |
| 2632 | const char *errmsg; |
| 2633 | const char *endp = ap_strrchr_c(arg, '>'); |
| 2634 | int old_overrides = cmd->override; |
| 2635 | char *old_path = cmd->path; |
| 2636 | core_dir_config *conf; |
| 2637 | ap_regex_t *r = NULL; |
| 2638 | const command_rec *thiscmd = cmd->cmd; |
| 2639 | ap_conf_vector_t *new_file_conf = ap_create_per_dir_config(cmd->pool); |
| 2640 | const char *err = ap_check_cmd_context(cmd, |
| 2641 | NOT_IN_LOCATION | NOT_IN_LIMIT); |
| 2642 | |
| 2643 | if (err != NULL) { |
| 2644 | return err; |
| 2645 | } |
| 2646 | |
| 2647 | if (endp == NULL) { |
| 2648 | return unclosed_directive(cmd); |
| 2649 | } |
| 2650 | |
| 2651 | arg = apr_pstrndup(cmd->temp_pool, arg, endp - arg); |
| 2652 | |
| 2653 | if (!arg[0]) { |
| 2654 | return missing_container_arg(cmd); |
| 2655 | } |
| 2656 | |
| 2657 | cmd->path = ap_getword_conf(cmd->pool, &arg); |
| 2658 | /* Only if not an .htaccess file */ |
| 2659 | if (!old_path) { |
| 2660 | cmd->override = OR_ALL|ACCESS_CONF; |
| 2661 | } |
| 2662 | |
| 2663 | if (thiscmd->cmd_data) { /* <FilesMatch> */ |
| 2664 | r = ap_pregcomp(cmd->pool, cmd->path, AP_REG_EXTENDED|USE_ICASE); |
| 2665 | if (!r) { |
| 2666 | return "Regex could not be compiled"; |
| 2667 | } |
| 2668 | } |
| 2669 | else if (!strcmp(cmd->path, "~")) { |
| 2670 | cmd->path = ap_getword_conf(cmd->pool, &arg); |
| 2671 | r = ap_pregcomp(cmd->pool, cmd->path, AP_REG_EXTENDED|USE_ICASE); |
| 2672 | if (!r) { |
| 2673 | return "Regex could not be compiled"; |
| 2674 | } |
| 2675 | } |
| 2676 | else { |
| 2677 | char *newpath; |
| 2678 | /* Ensure that the pathname is canonical, but we |
| 2679 | * can't test the case/aliases without a fixed path */ |
| 2680 | if (apr_filepath_merge(&newpath, "", cmd->path, |
| 2681 | 0, cmd->pool) != APR_SUCCESS) |
| 2682 | return apr_pstrcat(cmd->pool, "<Files \"", cmd->path, |
| 2683 | "\"> is invalid.", NULL); |
| 2684 | cmd->path = newpath; |
| 2685 | } |
| 2686 | |
| 2687 | /* initialize our config and fetch it */ |
nothing calls this directly
no test coverage detected