diff options
| author | Christian Breunig <christian@breunig.cc> | 2025-12-17 21:36:47 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-17 21:36:47 +0100 |
| commit | 5a22bd6e6ba87c6666b8cacecb1e8c071b81f2cd (patch) | |
| tree | 6e044b10e3fa1648de2b6e8c6a3838da8e4dfa0d /src/op_mode | |
| parent | 3d5ebd5956c4e4333e66097d6d339c2329c21295 (diff) | |
| parent | 197809bf77d841fe57bdcbaeeb3b078145aab140 (diff) | |
| download | vyos-1x-5a22bd6e6ba87c6666b8cacecb1e8c071b81f2cd.tar.gz vyos-1x-5a22bd6e6ba87c6666b8cacecb1e8c071b81f2cd.zip | |
Merge pull request #4892 from c-po/getpwall
login: T8086: replace getpwall() based user enumeration to avoid NSS/TACACS timeouts
Diffstat (limited to 'src/op_mode')
| -rwxr-xr-x | src/op_mode/show_users.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/op_mode/show_users.py b/src/op_mode/show_users.py index bccfaf991..086c8b1e2 100755 --- a/src/op_mode/show_users.py +++ b/src/op_mode/show_users.py @@ -13,15 +13,15 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. + import argparse -import pwd import struct import sys from time import ctime from tabulate import tabulate from vyos.config import Config - +from vyos.utils.auth import get_local_passwd_entries class UserInfo: def __init__(self, uid, name, user_type, is_locked, login_time, tty, host): @@ -79,7 +79,9 @@ def list_users(): vyos_users = cfg.list_effective_nodes('system login user') users = [] with open('/var/log/lastlog', 'rb') as lastlog_file: - for (name, _, uid, _, _, _, _) in pwd.getpwall(): + for entry in get_local_passwd_entries(): + name = entry.pw_name + uid = entry.pw_uid lastlog_info = decode_lastlog(lastlog_file, uid) if lastlog_info is None: continue |
