1 /* Check handling of missing end-of-line at end of /etc/aliases (bug 24059).
2 Copyright (C) 2019 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
22 #include <support/check.h>
23 #include <support/namespace.h>
24 #include <support/test-driver.h>
25 #include <support/xunistd.h>
28 in_chroot (void *closure
)
30 struct support_chroot
*chroot_env
= closure
;
31 xchroot (chroot_env
->path_chroot
);
33 struct aliasent
*e
= getaliasbyname ("user1");
34 TEST_VERIFY_EXIT (e
!= NULL
);
35 TEST_COMPARE_STRING (e
->alias_name
, "user1");
36 TEST_COMPARE (e
->alias_members_len
, 1);
37 TEST_VERIFY_EXIT (e
->alias_members
!= NULL
);
38 TEST_COMPARE_STRING (e
->alias_members
[0], "alias1");
39 TEST_VERIFY (e
->alias_local
);
45 /* nss_files has already been loaded via DT_NEEDED, outside the
47 __nss_configure_lookup ("aliases", "files");
49 support_become_root ();
50 if (!support_can_chroot ())
51 return EXIT_UNSUPPORTED
;
53 struct support_chroot
*chroot_env
= support_chroot_create
54 ((struct support_chroot_configuration
)
56 .aliases
= "user1: alias1,\n"
57 " " /* Continuation line, but no \n. */
60 support_isolate_in_subprocess (in_chroot
, chroot_env
);
62 support_chroot_free (chroot_env
);
66 #include <support/test-driver.c>