summaryrefslogtreecommitdiff
path: root/src/op_mode
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2025-12-17 21:36:47 +0100
committerGitHub <noreply@github.com>2025-12-17 21:36:47 +0100
commit5a22bd6e6ba87c6666b8cacecb1e8c071b81f2cd (patch)
tree6e044b10e3fa1648de2b6e8c6a3838da8e4dfa0d /src/op_mode
parent3d5ebd5956c4e4333e66097d6d339c2329c21295 (diff)
parent197809bf77d841fe57bdcbaeeb3b078145aab140 (diff)
downloadvyos-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-xsrc/op_mode/show_users.py8
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