| 1247 | } |
| 1248 | |
| 1249 | static struct ent *make_parent_entry(apr_int32_t autoindex_opts, |
| 1250 | autoindex_config_rec *d, |
| 1251 | request_rec *r, char keyid, |
| 1252 | char direction) |
| 1253 | { |
| 1254 | struct ent *p = (struct ent *) apr_pcalloc(r->pool, sizeof(struct ent)); |
| 1255 | char *testpath; |
| 1256 | /* |
| 1257 | * p->name is now the true parent URI. |
| 1258 | * testpath is a crafted lie, so that the syntax '/some/..' |
| 1259 | * (or simply '..')be used to describe 'up' from '/some/' |
| 1260 | * when processeing IndexIgnore, and Icon|Alt|Desc configs. |
| 1261 | */ |
| 1262 | |
| 1263 | /* The output has always been to the parent. Don't make ourself |
| 1264 | * our own parent (worthless cyclical reference). |
| 1265 | */ |
| 1266 | if (!(p->name = ap_make_full_path(r->pool, r->uri, "../"))) { |
| 1267 | return (NULL); |
| 1268 | } |
| 1269 | if (!ap_normalize_path(p->name, AP_NORMALIZE_ALLOW_RELATIVE | |
| 1270 | AP_NORMALIZE_NOT_ABOVE_ROOT) |
| 1271 | || p->name[0] == '\0') { |
| 1272 | return (NULL); |
| 1273 | } |
| 1274 | |
| 1275 | /* IndexIgnore has always compared "/thispath/.." */ |
| 1276 | testpath = ap_make_full_path(r->pool, r->filename, ".."); |
| 1277 | if (ignore_entry(d, testpath)) { |
| 1278 | return (NULL); |
| 1279 | } |
| 1280 | |
| 1281 | p->size = -1; |
| 1282 | p->lm = -1; |
| 1283 | p->key = apr_toupper(keyid); |
| 1284 | p->ascending = (apr_toupper(direction) == D_ASCENDING); |
| 1285 | p->version_sort = autoindex_opts & VERSION_SORT; |
| 1286 | if (autoindex_opts & FANCY_INDEXING) { |
| 1287 | if (!(p->icon = find_default_icon(d, testpath))) { |
| 1288 | p->icon = find_default_icon(d, "^^DIRECTORY^^"); |
| 1289 | } |
| 1290 | if (!(p->alt = find_default_alt(d, testpath))) { |
| 1291 | if (!(p->alt = find_default_alt(d, "^^DIRECTORY^^"))) { |
| 1292 | /* Special alt text for parent dir to distinguish it from other directories |
| 1293 | this is essential when trying to style this dir entry via AddAltClass */ |
| 1294 | p->alt = "PARENTDIR"; |
| 1295 | } |
| 1296 | } |
| 1297 | p->desc = find_desc(d, testpath); |
| 1298 | } |
| 1299 | return p; |
| 1300 | } |
| 1301 | |
| 1302 | static struct ent *make_autoindex_entry(const apr_finfo_t *dirent, |
| 1303 | int autoindex_opts, |
no test coverage detected