]>
git.ipfire.org Git - thirdparty/util-linux.git/blob - lib/shells.c
2 * SPDX-License-Identifier: GPL-2.0-or-later
4 #include <sys/syslog.h>
5 #if defined (HAVE_LIBECONF) && defined (USE_VENDORDIR)
9 #include "closestream.h"
13 * is_known_shell() -- if the given shell appears in /etc/shells
14 * or vendor defined files.
15 * Return 1 if found and return 0 if not found.
17 extern int is_known_shell(const char *shell_name
)
21 #if defined (HAVE_LIBECONF) && defined (USE_VENDORDIR)
25 econf_file
*key_file
= NULL
;
27 error
= econf_readDirs(&key_file
,
36 _("Cannot parse shells files: %s"),
37 econf_errString(error
));
41 error
= econf_getKeys(key_file
, NULL
, &size
, &keys
);
44 _("Cannot evaluate entries in shells files: %s"),
45 econf_errString(error
));
50 for (size_t i
= 0; i
< size
; i
++) {
51 if (strcmp(keys
[i
], shell_name
) == 0) {
65 while ((s
= getusershell())) {
66 if (*s
!= '#' && strcmp(shell_name
, s
) == 0) {