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