Comment 4 for bug 1940233

Revision history for this message
Paride Legovini (paride) wrote :

Thanks Christian for filing this.

Yes there's where we introduced the problem. I think we are missing a check in check_create_path() so that directories under the home directory are created as user-owned. Something like:

    newparent_uid = root_pwent.pw_uid
    newparent_gid = root_pwent.pw_gid
    if parent.startswith(home_folder):
        newparent_uid = user_pwent.pw_uid
        newparent_gid = user_pwent.pw_gid

and then:

    util.chownbyid(parent_folder, newparent_uid, newparent_gid)

Maybe we should also check/test how check_create_path() behaves when the user's home directory does not exist, or it is not user-owned and user-readable-and-writable. I'd say that check_create_path() should return False, as it is not this module's duty to create the home directory.