Given a system where the user data comes from e.g. an OpenLDAP database and is not in the /etc/passwd file.
Is it possible to search through the getent passwd database and look up the user id/name by specifying (a part of) the full name?
E.g. getent passwd newbie gives me the following entry
newbie:x:1000:1000:firstname lastname:/home/newbie:/bin/zsh
How can I find all users with "lastname"? Is there something like getpwnam for the gecos field?
Note: I can not use just getent passwd (with no username) and then parse that since my database is too big.