From: Alan T. DeKok Date: Fri, 1 Mar 2013 01:22:37 +0000 (-0500) Subject: Properly track absolute / relative paths X-Git-Tag: release_3_0_0_beta1~891 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=49e865d24691c806a996e688eb2956a84eaa9280;p=thirdparty%2Ffreeradius-server.git Properly track absolute / relative paths --- diff --git a/raddb/mods-available/cui b/raddb/mods-available/cui index 6b0d6b61098..5d022a123b0 100644 --- a/raddb/mods-available/cui +++ b/raddb/mods-available/cui @@ -46,5 +46,5 @@ sql cuisql { cui_table = "cui" sql_user_name = "%{User-Name}" - $INCLUDE sql/cui/${dialect}/queries.conf + $INCLUDE ../sql/cui/${dialect}/queries.conf } diff --git a/src/main/conffile.c b/src/main/conffile.c index 9e0f960bd95..e1fb613cf07 100644 --- a/src/main/conffile.c +++ b/src/main/conffile.c @@ -1194,24 +1194,23 @@ static int condition_looks_ok(const char **ptr) } -static const char *cf_local_file(CONF_SECTION *cs, const char *local, +static const char *cf_local_file(const char *base, const char *filename, char *buffer, size_t bufsize) { size_t dirsize; const char *p; - CONF_SECTION *parentcs = cf_top_section(cs); - p = strrchr(parentcs->item.filename, FR_DIR_SEP); - if (!p) return local; + p = strrchr(base, FR_DIR_SEP); + if (!p) return filename; - dirsize = (p - parentcs->item.filename) + 1; + dirsize = (p - base) + 1; - if ((dirsize + strlen(local)) >= bufsize) { + if ((dirsize + strlen(filename)) >= bufsize) { return NULL; } - memcpy(buffer, parentcs->item.filename, dirsize); - strlcpy(buffer + dirsize, local, bufsize - dirsize); + memcpy(buffer, base, dirsize); + strlcpy(buffer + dirsize, filename, bufsize - dirsize); return buffer; } @@ -1416,7 +1415,7 @@ static int cf_section_read(const char *filename, int *lineno, FILE *fp, if (!FR_DIR_IS_RELATIVE(value)) relative = 0; if (relative) { - value = cf_local_file(current, value, buf3, + value = cf_local_file(filename, value, buf3, sizeof(buf3)); if (!value) { radlog(L_ERR, "%s[%d]: Directories too deep.",