Commit 37b65f1c authored by Timo Teräs's avatar Timo Teräs

fix directory permissions loading

commit 941fc1b1 uncovered a bug that directory permissions are
not updated properly at db load time if it's the default acl.
parent eef2e02b
......@@ -137,7 +137,7 @@ static int audit_directory(struct audit_ctx *actx,
return actx->recursive ? 'd' : 'D';
if (actx->check_permissions &&
(dbd->mode != 0 || dbd->uid != 0 || dbd->gid != 0)) {
((dbd->mode & ~S_SEENFLAG) || dbd->uid || dbd->gid)) {
if ((fi->mode & 07777) != (dbd->mode & 07777))
return 'm';
if (fi->uid != dbd->uid || fi->gid != dbd->gid)
......
......@@ -758,6 +758,8 @@ int apk_db_index_read(struct apk_database *db, struct apk_bstream *bs, int repo)
if (pkg == NULL)
continue;
if (diri) apk_db_dir_apply_diri_permissions(diri);
if (repo >= 0) {
pkg->repos |= BIT(repo);
} else if (repo == -2) {
......@@ -806,6 +808,7 @@ int apk_db_index_read(struct apk_database *db, struct apk_bstream *bs, int repo)
/* Check FDB special entries */
switch (field) {
case 'F':
if (diri) apk_db_dir_apply_diri_permissions(diri);
if (pkg->name == NULL) goto bad_entry;
diri = apk_db_diri_new(db, pkg, l, &diri_node);
file_diri_node = &diri->owned_files.first;
......@@ -826,7 +829,7 @@ int apk_db_index_read(struct apk_database *db, struct apk_bstream *bs, int repo)
acl = apk_db_acl_atomize(mode, uid, gid, &xattr_csum);
if (field == 'M')
apk_db_diri_set(diri, acl);
diri->acl = acl;
else
file->acl = acl;
break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment