aboutsummaryrefslogtreecommitdiff
path: root/nss/nss_test.h
diff options
context:
space:
mode:
authorDJ Delorie <dj@redhat.com>2020-11-09 22:08:04 -0500
committerDJ Delorie <dj@redhat.com>2020-12-04 17:16:01 -0500
commit6eceded941bb6dcc097291757e2aef5cd7212133 (patch)
tree36e148aa9721dfed3a8a39a96126d70c5b27f444 /nss/nss_test.h
parentf8847d83e17774ed5e9c0f75ef693680b91bcae4 (diff)
downloadglibc-6eceded941bb6dcc097291757e2aef5cd7212133.tar.xz
glibc-6eceded941bb6dcc097291757e2aef5cd7212133.zip
nsswitch: user new internal API (tests)
Testsuite support and new test for new API. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Diffstat (limited to 'nss/nss_test.h')
-rw-r--r--nss/nss_test.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/nss/nss_test.h b/nss/nss_test.h
index 49a9aff2fd..b6c6ad2333 100644
--- a/nss/nss_test.h
+++ b/nss/nss_test.h
@@ -33,10 +33,12 @@
#include <pwd.h>
#include <grp.h>
+#include <netdb.h>
typedef struct test_tables {
struct passwd *pwd_table;
struct group *grp_table;
+ struct hostent *host_table;
} test_tables;
extern void _nss_test1_init_hook (test_tables *) __attribute__((weak));
@@ -44,9 +46,11 @@ extern void _nss_test2_init_hook (test_tables *) __attribute__((weak));
#define PWD_LAST() { .pw_name = NULL, .pw_uid = 0 }
#define GRP_LAST() { .gr_name = NULL, .gr_gid = 0 }
+#define HOST_LAST() { .h_name = NULL, .h_aliases = NULL, .h_length = 0, .h_addr_list = NULL }
#define PWD_ISLAST(p) ((p)->pw_name == NULL && (p)->pw_uid == 0)
#define GRP_ISLAST(g) ((g)->gr_name == NULL && (g)->gr_gid == 0)
+#define HOST_ISLAST(h) ((h)->h_name == NULL && (h)->h_length == 0)
/* Macros to fill in the tables easily. */
@@ -72,6 +76,11 @@ extern void _nss_test2_init_hook (test_tables *) __attribute__((weak));
{ .gr_name = (char *) n, .gr_passwd = (char *) "*", .gr_gid = u, \
.gr_mem = (char **) m }
+#define HOST(u) \
+ { .h_name = (char *) "name" #u, .h_aliases = NULL, .h_addrtype = u, \
+ .h_length = 4, \
+ .h_addr_list = (char **) hostaddr_##u }
+
/*------------------------------------------------------------*/
/* Helper functions for testing passwd entries. Call