[SSSD] [PATCH] Make sss_userdel check for logged in users
Sumit Bose
sbose at redhat.com
Fri Mar 19 14:13:57 UTC 2010
On Fri, Mar 19, 2010 at 02:35:46PM +0100, Jakub Hrozek wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> sss_userdel now refuses to delete users who are logged in unless --force
> is used.
>
> Fixes: #229
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (GNU/Linux)
> Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAkujfbIACgkQHsardTLnvCX4sACfZOYnwyRdRwP3vp6bSZXl0DbA
> 1oQAoK0FJuq6nnLl2pW4apXLhqK86PDS
> =OKSx
> -----END PGP SIGNATURE-----
>
> +static bool is_logged_in(TALLOC_CTX *mem_ctx, uid_t uid)
> +{
> + int ret;
> + hash_key_t key;
> + hash_value_t value;
> + hash_table_t *uid_table;
> +
> + ret = get_uid_table(mem_ctx, &uid_table);
> + /* get_uid_table returns ENOSYS on non-Linux platforms. We proceed
> + * in that case
> + */
> + if (ret == ENOSYS) return false;
I would return true here. Then the user can still be deleted with
--force, but the admin will know that he has to be careful on this
plattform.
bye,
Sumit
> + if (ret != EOK) {
> + DEBUG(1, ("Cannot initialize hash table.\n"));
> + return false;
> + }
> +
> + key.type = HASH_KEY_ULONG;
> + key.ul = (unsigned long) uid;
> +
> + ret = hash_lookup(uid_table, &key, &value);
> + talloc_zfree(uid_table);
> + return ret == HASH_SUCCESS;
> +}
> +
More information about the sssd-devel
mailing list