mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-04-22 10:01:45 +00:00
users: Flush nscd cache after user operations
nscd monitors files in /etc and invalidates the cache automatically when they change. However, for other mechanisms it recommends issuing a manual flush in its manual page. Flush nscd passwd and group database caches after all user operations (not just rename operation, just to be sure).
This commit is contained in:
parent
0e4a722147
commit
d9197111d8
@ -11,6 +11,7 @@ All notable changes to this project will be documented in this file.
|
||||
- help: Minor updates and fixes to status log.
|
||||
- Updated translations to fix weblate errors.
|
||||
- Fixed spelling errors in datetime and letsencrypt modules.
|
||||
- users: Flush nscd cache after user operations.
|
||||
|
||||
### Changed
|
||||
- dynamicdns, transmission, upgrades: Allowed Plinth to run as non-root.
|
||||
|
||||
18
actions/ldap
18
actions/ldap
@ -34,6 +34,8 @@ create_user()
|
||||
ldapadduser $username users > /dev/null
|
||||
|
||||
set_user_password $username $password
|
||||
|
||||
flush_cache
|
||||
}
|
||||
|
||||
|
||||
@ -48,6 +50,8 @@ delete_user()
|
||||
while read -r group; do
|
||||
ldapdeleteuserfromgroup $username $group > /dev/null || true
|
||||
done <<< "$groups"
|
||||
|
||||
flush_cache
|
||||
}
|
||||
|
||||
|
||||
@ -64,6 +68,8 @@ rename_user()
|
||||
ldapdeleteuserfromgroup $old_username $group > /dev/null || true
|
||||
ldapaddusertogroup $new_username $group > /dev/null || true
|
||||
done <<< "$groups"
|
||||
|
||||
flush_cache
|
||||
}
|
||||
|
||||
|
||||
@ -95,6 +101,8 @@ add_user_to_group()
|
||||
ldapaddgroup $groupname > /dev/null 2>&1 || true
|
||||
|
||||
ldapaddusertogroup $username $groupname > /dev/null
|
||||
|
||||
flush_cache
|
||||
}
|
||||
|
||||
|
||||
@ -104,6 +112,16 @@ remove_user_from_group()
|
||||
groupname="$2"
|
||||
|
||||
ldapdeleteuserfromgroup $username $groupname > /dev/null
|
||||
|
||||
flush_cache
|
||||
}
|
||||
|
||||
|
||||
flush_cache()
|
||||
{
|
||||
# Flush nscd cache
|
||||
nscd --invalidate=passwd
|
||||
nscd --invalidate=group
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user