<em><a href="../rewrite/flags.html#flag_unsafe_prefix_stat">details ...</a></em>
</td>
</tr>
+ <tr>
+ <td>UNC</td>
+ <td>Prevents the merging of multiple leading slashes, as used by Windows UNC paths.
+ <em><a href="../rewrite/flags.html#flag_unc">details ...</a></em>
+ </td>
+ </tr>
+
</table>
<note><title>Home directory expansion</title>
This protects from a malicious URL causing the expanded substitution to
map to an unexpected filesystem location.</p>
</section>
-
+<section id="flag_unc"><title>UNC</title>
+ <p> Setting this flag prevents the merging of multiple leading slashes,
+ as used in Windows UNC paths. The flag is not necessary when the rules
+ substitution starts with multiple literal slashes. </p>
+</section>
</manualpage>
#define RULEFLAG_ESCAPECTLS (1<<21)
#define RULEFLAG_UNSAFE_PREFIX_STAT (1<<22)
#define RULEFLAG_UNSAFE_ALLOW3F (1<<23)
+#define RULEFLAG_UNC (1<<24)
/* return code of the rewrite rule
* the result may be escaped - or not
else if(!strcasecmp(key, "nsafeAllow3F")) {
cfg->flags |= RULEFLAG_UNSAFE_ALLOW3F;
}
+ else if(!strcasecmp(key, "NC")) {
+ cfg->flags |= RULEFLAG_UNC;
+ }
else {
++error;
}
return RULE_RC_MATCH;
}
+ if (!(p->flags & RULEFLAG_UNC)) {
+ /* merge leading slashes, unless they were literals in the sub */
+ if (!AP_IS_SLASH(p->output[0]) || !AP_IS_SLASH(p->output[1])) {
+ while (AP_IS_SLASH(r->filename[0]) &&
+ AP_IS_SLASH(r->filename[1])) {
+ r->filename++;
+ }
+ }
+ }
+
/* Finally remember the forced mime-type */
force_type_handler(p, ctx);