Gentoo Archives: gentoo-commits

From: "Jason Donenfeld (zx2c4)" <zx2c4@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in mail-mta/opensmtpd/files: build-warnings.patch pam.patch smtpd.initd smtpd.pam
Date: Thu, 28 Feb 2013 17:57:19
Message-Id: 20130228175715.C673D2171D@flycatcher.gentoo.org
1 zx2c4 13/02/28 17:57:15
2
3 Added: build-warnings.patch pam.patch smtpd.initd
4 smtpd.pam
5 Log:
6 Initial import.
7
8 (Portage version: 2.2.0_alpha163/cvs/Linux x86_64, signed Manifest commit with key A5DE03AE)
9
10 Revision Changes Path
11 1.1 mail-mta/opensmtpd/files/build-warnings.patch
12
13 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/mail-mta/opensmtpd/files/build-warnings.patch?rev=1.1&view=markup
14 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/mail-mta/opensmtpd/files/build-warnings.patch?rev=1.1&content-type=text/plain
15
16 Index: build-warnings.patch
17 ===================================================================
18 diff --git a/openbsd-compat/entropy.c b/openbsd-compat/entropy.c
19 index 2d4e151..ac1ab37 100644
20 --- a/openbsd-compat/entropy.c
21 +++ b/openbsd-compat/entropy.c
22 @@ -48,7 +48,7 @@
23 //#include "xmalloc.h"
24 //#include "atomicio.h"
25 //#include "pathnames.h"
26 -//#include "log.h"
27 +#include "log.h"
28 //#include "buffer.h"
29
30 /* wrapper for signal interface */
31 diff --git a/openbsd-compat/imsg-buffer.c b/openbsd-compat/imsg-buffer.c
32 index 7223ad7..7c4d686 100644
33 --- a/openbsd-compat/imsg-buffer.c
34 +++ b/openbsd-compat/imsg-buffer.c
35 @@ -256,7 +256,7 @@ msgbuf_write(struct msgbuf *msgbuf)
36 cmsg->cmsg_len = CMSG_LEN(sizeof(int));
37 cmsg->cmsg_level = SOL_SOCKET;
38 cmsg->cmsg_type = SCM_RIGHTS;
39 - *(int *)CMSG_DATA(cmsg) = buf->fd;
40 + memcpy(CMSG_DATA(cmsg), &buf->fd, sizeof(int));
41 }
42
43 again:
44 diff --git a/smtpd/mproc.c b/smtpd/mproc.c
45 index 7d9e593..d152784 100644
46 --- a/smtpd/mproc.c
47 +++ b/smtpd/mproc.c
48 @@ -230,7 +230,7 @@ msgbuf_write2(struct msgbuf *msgbuf)
49 cmsg->cmsg_len = CMSG_LEN(sizeof(int));
50 cmsg->cmsg_level = SOL_SOCKET;
51 cmsg->cmsg_type = SCM_RIGHTS;
52 - *(int *)CMSG_DATA(cmsg) = buf->fd;
53 + memcpy(CMSG_DATA(cmsg), &buf->fd, sizeof(int));
54 }
55
56 again:
57
58
59
60 1.1 mail-mta/opensmtpd/files/pam.patch
61
62 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/mail-mta/opensmtpd/files/pam.patch?rev=1.1&view=markup
63 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/mail-mta/opensmtpd/files/pam.patch?rev=1.1&content-type=text/plain
64
65 Index: pam.patch
66 ===================================================================
67 diff -ru opensmtpd-5.2.xp1/smtpd/smtpd.c opensmtpd-5.2.xp1-pam/smtpd/smtpd.c
68 --- opensmtpd-5.2.xp1/smtpd/smtpd.c 2013-02-21 20:13:32.000000000 +0100
69 +++ opensmtpd-5.2.xp1-pam/smtpd/smtpd.c 2013-02-28 06:02:51.034730193 +0100
70 @@ -34,6 +34,15 @@
71 #ifdef BSD_AUTH
72 #include <bsd_auth.h>
73 #endif
74 +
75 +#ifdef USE_PAM
76 +#if defined(HAVE_SECURITY_PAM_APPL_H)
77 +#include <security/pam_appl.h>
78 +#elif defined (HAVE_PAM_PAM_APPL_H)
79 +#include <pam/pam_appl.h>
80 +#endif
81 +#endif
82 +
83 #ifdef HAVE_CRYPT_H
84 #include <crypt.h> /* needed for crypt() */
85 #endif
86 @@ -1639,6 +1648,53 @@
87 }
88 #endif
89
90 +#ifdef USE_PAM
91 +int
92 +pam_conv_password(int num_msg, const struct pam_message **msg, struct pam_response **respp, const char *password)
93 +{
94 + struct pam_response *response;
95 + if (num_msg != 1)
96 + return PAM_CONV_ERR;
97 + response = malloc(sizeof(struct pam_response));
98 + if (!response)
99 + return PAM_BUF_ERR;
100 + memset(response, 0, sizeof(struct pam_response));
101 + response->resp = strdup(password);
102 + if (!response->resp)
103 + return PAM_BUF_ERR;
104 + *respp = response;
105 + return PAM_SUCCESS;
106 +}
107 +int
108 +parent_auth_pam(const char *username, const char *password)
109 +{
110 + int rc;
111 + pam_handle_t *pamh = NULL;
112 + struct pam_conv conv = { pam_conv_password, password };
113 +
114 + if ((rc = pam_start("smtpd", username, &conv, &pamh)) != PAM_SUCCESS)
115 + goto end;
116 + if ((rc = pam_authenticate(pamh, 0)) != PAM_SUCCESS)
117 + goto end;
118 + if ((rc = pam_acct_mgmt(pamh, 0)) != PAM_SUCCESS)
119 + goto end;
120 +end:
121 + pam_end(pamh, rc);
122 +
123 + switch (rc) {
124 + case PAM_SUCCESS:
125 + return LKA_OK;
126 + case PAM_SYSTEM_ERR:
127 + case PAM_ABORT:
128 + case PAM_AUTHINFO_UNAVAIL:
129 + return LKA_TEMPFAIL;
130 + default:
131 + return LKA_PERMFAIL;
132 +
133 + }
134 +}
135 +#endif
136 +
137 int
138 parent_auth_pwd(const char *username, const char *password)
139 {
140 @@ -1664,8 +1720,10 @@
141 int
142 parent_auth_user(const char *username, const char *password)
143 {
144 -#ifdef BSD_AUTH
145 +#if defined(BSD_AUTH)
146 return (parent_auth_bsd(username, password));
147 +#elif defined(USE_PAM)
148 + return (parent_auth_pam(username, password));
149 #else
150 return (parent_auth_pwd(username, password));
151 #endif
152
153
154
155 1.1 mail-mta/opensmtpd/files/smtpd.initd
156
157 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/mail-mta/opensmtpd/files/smtpd.initd?rev=1.1&view=markup
158 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/mail-mta/opensmtpd/files/smtpd.initd?rev=1.1&content-type=text/plain
159
160 Index: smtpd.initd
161 ===================================================================
162 #!/sbin/runscript
163 # Copyright 1999-2013 Gentoo Foundation
164 # Distributed under the terms of the GNU General Public License v2
165 # $Header: /var/cvsroot/gentoo-x86/mail-mta/opensmtpd/files/smtpd.initd,v 1.1 2013/02/28 17:57:15 zx2c4 Exp $
166
167 depend() {
168 need net
169 }
170
171 start() {
172 ebegin "Starting OpenSMTPD"
173 start-stop-daemon --start --quiet --exec /usr/sbin/smtpd
174 eend ${?}
175 }
176
177 stop() {
178 ebegin "Stopping OpenSMTPD"
179 /usr/sbin/smtpctl stop
180 eend ${?}
181 }
182
183
184
185 1.1 mail-mta/opensmtpd/files/smtpd.pam
186
187 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/mail-mta/opensmtpd/files/smtpd.pam?rev=1.1&view=markup
188 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/mail-mta/opensmtpd/files/smtpd.pam?rev=1.1&content-type=text/plain
189
190 Index: smtpd.pam
191 ===================================================================
192 auth required pam_nologin.so
193 auth include system-auth
194 account include system-auth
195 session include system-auth