1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
From dbe134e9eed77bfbbbbf80fa97f2b02b869bcf9c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
Date: Mon, 22 Oct 2018 22:34:13 +0200
Subject: Adapt to Gentoo-specific /etc/mail/aliases
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Patch by pacho2
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
(cherry picked from commit 4e616cda056f471b799beba2b1cedc787ad4ecc0)
---
nss/nss_files/files-alias.c | 2 +-
nss/tst-nss-files-alias-leak.c | 18 +++++++++---------
support/support_chroot.c | 8 +++++++-
3 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/nss/nss_files/files-alias.c b/nss/nss_files/files-alias.c
index 43fb2c49a5..26b2cc86ad 100644
--- a/nss/nss_files/files-alias.c
+++ b/nss/nss_files/files-alias.c
@@ -50,7 +50,7 @@ internal_setent (FILE **stream)
if (*stream == NULL)
{
- *stream = __nss_files_fopen ("/etc/aliases");
+ *stream = __nss_files_fopen ("/etc/mail/aliases");
if (*stream == NULL)
status = errno == EAGAIN ? NSS_STATUS_TRYAGAIN : NSS_STATUS_UNAVAIL;
diff --git a/nss/tst-nss-files-alias-leak.c b/nss/tst-nss-files-alias-leak.c
index daebbf4ed4..095bb753a6 100644
--- a/nss/tst-nss-files-alias-leak.c
+++ b/nss/tst-nss-files-alias-leak.c
@@ -45,27 +45,27 @@ prepare (int argc, char **argv)
chroot_env = support_chroot_create
((struct support_chroot_configuration) { } );
- char *path = xasprintf ("%s/etc/aliases", chroot_env->path_chroot);
+ char *path = xasprintf ("%s/etc/mail/aliases", chroot_env->path_chroot);
add_temp_file (path);
support_write_file_string
(path,
- "user1: :include:/etc/aliases.user1\n"
- "user2: :include:/etc/aliases.user2\n"
- "comment: comment1, :include:/etc/aliases.comment\n"
- "many: :include:/etc/aliases.many\n");
+ "user1: :include:/etc/mail/aliases.user1\n"
+ "user2: :include:/etc/mail/aliases.user2\n"
+ "comment: comment1, :include:/etc/mail/aliases.comment\n"
+ "many: :include:/etc/mail/aliases.many\n");
free (path);
- path = xasprintf ("%s/etc/aliases.user1", chroot_env->path_chroot);
+ path = xasprintf ("%s/etc/mail/aliases.user1", chroot_env->path_chroot);
add_temp_file (path);
support_write_file_string (path, "alias1\n");
free (path);
- path = xasprintf ("%s/etc/aliases.user2", chroot_env->path_chroot);
+ path = xasprintf ("%s/etc/mail/aliases.user2", chroot_env->path_chroot);
add_temp_file (path);
support_write_file_string (path, "alias1a, alias2\n");
free (path);
- path = xasprintf ("%s/etc/aliases.comment", chroot_env->path_chroot);
+ path = xasprintf ("%s/etc/mail/aliases.comment", chroot_env->path_chroot);
add_temp_file (path);
support_write_file_string
(path,
@@ -75,7 +75,7 @@ prepare (int argc, char **argv)
"comment2\n");
free (path);
- path = xasprintf ("%s/etc/aliases.many", chroot_env->path_chroot);
+ path = xasprintf ("%s/etc/mail/aliases.many", chroot_env->path_chroot);
add_temp_file (path);
FILE *fp = xfopen (path, "w");
for (int i = 0; i < many_aliases; ++i)
diff --git a/support/support_chroot.c b/support/support_chroot.c
index 4f435c1ac1..e7ca2c714b 100644
--- a/support/support_chroot.c
+++ b/support/support_chroot.c
@@ -52,13 +52,19 @@ support_chroot_create (struct support_chroot_configuration conf)
xmkdir (path_etc, 0777);
add_temp_file (path_etc);
+ /* Create the /etc/mail directory in the chroot environment. */
+ char *path_etc_mail = xasprintf ("%s/etc/mail", chroot->path_chroot);
+ xmkdir (path_etc_mail, 0777);
+ add_temp_file (path_etc_mail);
+
write_file (path_etc, "resolv.conf", conf.resolv_conf,
&chroot->path_resolv_conf);
write_file (path_etc, "hosts", conf.hosts, &chroot->path_hosts);
write_file (path_etc, "host.conf", conf.host_conf, &chroot->path_host_conf);
- write_file (path_etc, "aliases", conf.aliases, &chroot->path_aliases);
+ write_file (path_etc_mail, "aliases", conf.aliases, &chroot->path_aliases);
free (path_etc);
+ free (path_etc_mail);
/* valgrind needs a temporary directory in the chroot. */
{
|