Line data Source code
1 : // SPDX-License-Identifier: LGPL-2.1-or-later
2 18 : import cockpit from 'cockpit';
3 :
4 1 : export const get_locked = name =>
5 1 : cockpit.spawn(["passwd", "-S", name], { environ: ["LC_ALL=C"], superuser: "require" })
6 1 : .then(content => {
7 1 : const status = content.split(" ")[1];
8 : // libuser uses "LK", shadow-utils use "L".
9 1 : return status == "LK" || status == "L";
10 1 : })
11 0 : .catch(exc => {
12 0 : if (exc.problem !== "access-denied") {
13 0 : console.warn(`Failed to obtain account lock information for ${name}`, exc);
14 0 : }
15 0 : });
|