localedata: Convert day names in nn_NO locale to UTF-8
[glibc.git] / nss / tst-nss-compat1.c
blobfd495815991ebc50d63388cdf605ef0981274633
1 /* Test error checking for group entries.
2 Copyright (C) 2021-2023 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 <https://www.gnu.org/licenses/>. */
19 #include <nss.h>
20 #include <stdio.h>
21 #include <stdlib.h>
22 #include <string.h>
24 #include <shadow.h>
26 #include <support/support.h>
27 #include <support/check.h>
29 #include "nss_test.h"
31 static struct passwd pwd_table[] = {
32 PWD (100),
33 PWD (30),
34 PWD_LAST ()
37 static struct spwd spwd_table[] = {
38 SPWD (100),
39 SPWD (30),
40 SPWD_LAST ()
43 void
44 _nss_test1_init_hook(test_tables *t)
46 t->pwd_table = pwd_table;
47 t->spwd_table = spwd_table;
50 static int
51 do_test (void)
53 struct passwd *p = NULL;
54 struct spwd *s = NULL;
55 struct group *g = NULL;
57 /* Test that compat-to-test works. */
58 p = getpwuid (100);
59 if (p == NULL)
60 FAIL_EXIT1("getpwuid-compat-test1 p");
61 else if (strcmp (p->pw_name, "name100") != 0)
62 FAIL_EXIT1("getpwuid-compat-test1 name100");
64 /* Shadow compat should use passwd via the alternate name. */
65 s = getspnam ("name30");
66 if (s == NULL)
67 FAIL_EXIT1("getspnam-compat-test1 s");
68 else if (strcmp (s->sp_namp, "name30") != 0)
69 FAIL_EXIT1("getpwuid-compat-test1 name30");
71 /* Test that internal defconfig works. */
72 g = getgrgid (100);
73 if (g == NULL)
74 FAIL_EXIT1("getgrgid-compat-null");
75 if (strcmp (g->gr_name, "wilma") != 0)
76 FAIL_EXIT1("getgrgid-compat-name");
78 return 0;
81 #include <support/test-driver.c>