[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
tramp-parse-passwd does not seem to work if getent is available?
From: |
Tim Landscheidt |
Subject: |
tramp-parse-passwd does not seem to work if getent is available? |
Date: |
Mon, 22 Jan 2024 01:19:08 +0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.3 (gnu/linux) |
Hi,
I was playing around with some of TRAMP's internals
(2.5.4-pre as part of GNU Emacs 28.3) and noticed:
| ELISP> (tramp-parse-passwd "/etc/passwd")
| (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil
nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil
nil nil nil nil nil nil nil nil nil nil nil nil)
| ELISP>
Curiously, I then executed the alternative branch in
tramp-parse-passwd that would get called if the getent exe-
cutable is not available:
| ELISP> (tramp-parse-file "/etc/passwd" #'tramp-parse-passwd-group)
| (("root" "localhost")
| ("bin" "localhost")
| ("daemon" "localhost")
| ("adm" "localhost")
| […])
| ELISP>
Looking at the code:
| (defun tramp-parse-passwd (filename)
| "Return a list of (user host) tuples allowed to access.
| Host is always \"localhost\"."
| (with-tramp-connection-property nil "parse-passwd"
| (if (executable-find "getent")
| (with-temp-buffer
| (when (zerop (tramp-call-process nil "getent" nil t nil "passwd"))
| (goto-char (point-min))
| (cl-loop while (not (eobp)) collect
| (tramp-parse-etc-group-group))))
| (tramp-parse-file filename #'tramp-parse-passwd-group))))
it is not clear to me why the output of "getent passwd" and
the contents of /etc/passwd are parsed differently.
Shouldn't the output of "getent passwd" (and its other vari-
ants) be of the same structure as /etc/passwd?
Tim
- tramp-parse-passwd does not seem to work if getent is available?,
Tim Landscheidt <=