MCPcopy Create free account
hub / github.com/apache/httpd / ap_process_fnmatch_configs

Function ap_process_fnmatch_configs

server/config.c:1902–1954  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1900}
1901
1902AP_DECLARE(const char *) ap_process_fnmatch_configs(server_rec *s,
1903 const char *fname,
1904 ap_directive_t **conftree,
1905 apr_pool_t *p,
1906 apr_pool_t *ptemp,
1907 int optional)
1908{
1909 configs cfgs;
1910 ap_dir_match_t w;
1911
1912 cfgs.s = s;
1913 cfgs.conftree = conftree;
1914
1915 w.prefix = "Include/IncludeOptional: ";
1916 w.p = p;
1917 w.ptemp = ptemp;
1918 w.flags = (optional ? AP_DIR_FLAG_OPTIONAL : AP_DIR_FLAG_NONE) | AP_DIR_FLAG_RECURSIVE;
1919 w.cb = process_resource_config_cb;
1920 w.ctx = &cfgs;
1921 w.depth = 0;
1922
1923 /* don't require conf/httpd.conf if we have a -C or -c switch */
1924 if ((ap_server_pre_read_config->nelts
1925 || ap_server_post_read_config->nelts)
1926 && !(strcmp(fname, ap_server_root_relative(ptemp, SERVER_CONFIG_FILE)))) {
1927 apr_finfo_t finfo;
1928
1929 if (apr_stat(&finfo, fname, APR_FINFO_LINK | APR_FINFO_TYPE, ptemp) != APR_SUCCESS)
1930 return NULL;
1931 }
1932
1933 if (!apr_fnmatch_test(fname)) {
1934 return ap_dir_nofnmatch(&w, fname);
1935 }
1936 else {
1937 apr_status_t status;
1938 const char *rootpath, *filepath = fname;
1939
1940 /* locate the start of the directories proper */
1941 status = apr_filepath_root(&rootpath, &filepath, APR_FILEPATH_TRUENAME, ptemp);
1942
1943 /* we allow APR_SUCCESS and APR_EINCOMPLETE */
1944 if (APR_ERELATIVE == status) {
1945 return apr_pstrcat(p, "Include must have an absolute path, ", fname, NULL);
1946 }
1947 else if (APR_EBADPATH == status) {
1948 return apr_pstrcat(p, "Include has a bad path, ", fname, NULL);
1949 }
1950
1951 /* walk the filepath */
1952 return ap_dir_fnmatch(&w, rootpath, filepath);
1953 }
1954}
1955
1956AP_DECLARE(int) ap_process_config_tree(server_rec *s,
1957 ap_directive_t *conftree,

Callers 1

include_configFunction · 0.85

Calls 3

ap_server_root_relativeFunction · 0.85
ap_dir_nofnmatchFunction · 0.85
ap_dir_fnmatchFunction · 0.85

Tested by

no test coverage detected