Gentoo Archives: gentoo-commits

From: Brian Evans <grknight@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-php/pecl-pam/files/, dev-php/pecl-pam/
Date: Thu, 01 Dec 2016 19:53:45
Message-Id: 1480622009.8f113e301d3d56ef3c9623c40014000a102db15c.grknight@gentoo
1 commit: 8f113e301d3d56ef3c9623c40014000a102db15c
2 Author: Brian Evans <grknight <AT> gentoo <DOT> org>
3 AuthorDate: Thu Dec 1 19:51:56 2016 +0000
4 Commit: Brian Evans <grknight <AT> gentoo <DOT> org>
5 CommitDate: Thu Dec 1 19:53:29 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8f113e30
7
8 dev-php/pecl-pam: Revision bump to support PHP 7 and drop 5.4 and 5.5
9
10 PHP 7 patch created by me as it was rather trivial changes
11
12 Package-Manager: portage-2.3.2
13
14 dev-php/pecl-pam/files/1.0.3-php7.patch | 118 ++++++++++++++++++++++++++++++
15 dev-php/pecl-pam/pecl-pam-1.0.3-r2.ebuild | 45 ++++++++++++
16 2 files changed, 163 insertions(+)
17
18 diff --git a/dev-php/pecl-pam/files/1.0.3-php7.patch b/dev-php/pecl-pam/files/1.0.3-php7.patch
19 new file mode 100644
20 index 00000000..d56fffb
21 --- /dev/null
22 +++ b/dev-php/pecl-pam/files/1.0.3-php7.patch
23 @@ -0,0 +1,118 @@
24 +--- a/pam.c 2016-12-01 14:29:27.453904230 -0500
25 ++++ b/pam.c 2016-12-01 14:27:26.496109755 -0500
26 +@@ -227,8 +227,13 @@
27 + PHP_FUNCTION(pam_auth)
28 + {
29 + char *username, *password;
30 ++#if PHP_MAJOR_VERSION >= 7
31 ++ size_t username_len, password_len;
32 ++ zval *status = NULL, *server, *remote_addr;
33 ++#else
34 + int username_len, password_len;
35 + zval *status = NULL, **server, **remote_addr;
36 ++#endif
37 + zend_bool checkacctmgmt = 1;
38 +
39 + pam_auth_t userinfo = {NULL, NULL};
40 +@@ -248,22 +253,37 @@
41 + if (status) {
42 + spprintf(&error_msg, 0, "%s (in %s)", (char *) pam_strerror(pamh, result), "pam_start");
43 + zval_dtor(status);
44 ++#if PHP_MAJOR_VERSION >= 7
45 ++ ZVAL_STRING(status, error_msg);
46 ++ efree(error_msg);
47 ++#else
48 + ZVAL_STRING(status, error_msg, 0);
49 ++#endif
50 + }
51 + RETURN_FALSE;
52 + }
53 +
54 ++#if PHP_MAJOR_VERSION >= 7
55 ++ if ((remote_addr = zend_hash_str_find(Z_ARR(PG(http_globals)[TRACK_VARS_SERVER]), "REMOTE_ADDR", sizeof("REMOTE_ADDR")-1)) != NULL && Z_TYPE_P(remote_addr) == IS_STRING) {
56 ++ pam_set_item(pamh, PAM_RHOST, Z_STRVAL_P(remote_addr));
57 ++#else
58 + if (zend_hash_find(&EG(symbol_table), "_SERVER", sizeof("_SERVER"), (void **)&server) == SUCCESS && Z_TYPE_PP(server) == IS_ARRAY) {
59 + if (zend_hash_find(Z_ARRVAL_PP(server), "REMOTE_ADDR", sizeof("REMOTE_ADDR"), (void **)&remote_addr) == SUCCESS && Z_TYPE_PP(remote_addr) == IS_STRING) {
60 + pam_set_item(pamh, PAM_RHOST, Z_STRVAL_PP(remote_addr));
61 + }
62 ++#endif
63 + }
64 +
65 + if ((result = pam_authenticate(pamh, PAM_DISALLOW_NULL_AUTHTOK)) != PAM_SUCCESS) {
66 + if (status) {
67 + spprintf(&error_msg, 0, "%s (in %s)", (char *) pam_strerror(pamh, result), "pam_authenticate");
68 + zval_dtor(status);
69 ++#if PHP_MAJOR_VERSION >= 7
70 ++ ZVAL_STRING(status, error_msg);
71 ++ efree(error_msg);
72 ++#else
73 + ZVAL_STRING(status, error_msg, 0);
74 ++#endif
75 + }
76 + pam_end(pamh, PAM_SUCCESS);
77 + RETURN_FALSE;
78 +@@ -274,7 +294,12 @@
79 + if (status) {
80 + spprintf(&error_msg, 0, "%s (in %s)", (char *) pam_strerror(pamh, result), "pam_acct_mgmt");
81 + zval_dtor(status);
82 ++#if PHP_MAJOR_VERSION >= 7
83 ++ ZVAL_STRING(status, error_msg);
84 ++ efree(error_msg);
85 ++#else
86 + ZVAL_STRING(status, error_msg, 0);
87 ++#endif
88 + }
89 + pam_end(pamh, PAM_SUCCESS);
90 + RETURN_FALSE;
91 +@@ -291,7 +316,11 @@
92 + PHP_FUNCTION(pam_chpass)
93 + {
94 + char *username, *oldpass, *newpass;
95 ++#if PHP_MAJOR_VERSION >= 7
96 ++ size_t username_len, oldpass_len, newpass_len;
97 ++#else
98 + int username_len, oldpass_len, newpass_len;
99 ++#endif
100 + zval *status = NULL;
101 +
102 + pam_chpass_t userinfo = {NULL, NULL, NULL, 0};
103 +@@ -312,7 +341,12 @@
104 + if (status) {
105 + spprintf(&error_msg, 0, "%s (in %s)", (char *) pam_strerror(pamh, result), "pam_start");
106 + zval_dtor(status);
107 ++#if PHP_MAJOR_VERSION >= 7
108 ++ ZVAL_STRING(status, error_msg);
109 ++ efree(error_msg);
110 ++#else
111 + ZVAL_STRING(status, error_msg, 0);
112 ++#endif
113 + }
114 + RETURN_FALSE;
115 + }
116 +@@ -321,7 +355,12 @@
117 + if (status) {
118 + spprintf(&error_msg, 0, "%s (in %s)", (char *) pam_strerror(pamh, result), "pam_authenticate");
119 + zval_dtor(status);
120 ++#if PHP_MAJOR_VERSION >= 7
121 ++ ZVAL_STRING(status, error_msg);
122 ++ efree(error_msg);
123 ++#else
124 + ZVAL_STRING(status, error_msg, 0);
125 ++#endif
126 + }
127 + pam_end(pamh, PAM_SUCCESS);
128 + RETURN_FALSE;
129 +@@ -331,7 +370,12 @@
130 + if (status) {
131 + spprintf(&error_msg, 0, "%s (in %s)", (char *) pam_strerror(pamh, result), "pam_chauthtok");
132 + zval_dtor(status);
133 ++#if PHP_MAJOR_VERSION >= 7
134 ++ ZVAL_STRING(status, error_msg);
135 ++ efree(error_msg);
136 ++#else
137 + ZVAL_STRING(status, error_msg, 0);
138 ++#endif
139 + }
140 + pam_end(pamh, PAM_SUCCESS);
141 + RETURN_FALSE;
142
143 diff --git a/dev-php/pecl-pam/pecl-pam-1.0.3-r2.ebuild b/dev-php/pecl-pam/pecl-pam-1.0.3-r2.ebuild
144 new file mode 100644
145 index 00000000..2679757
146 --- /dev/null
147 +++ b/dev-php/pecl-pam/pecl-pam-1.0.3-r2.ebuild
148 @@ -0,0 +1,45 @@
149 +# Copyright 1999-2016 Gentoo Foundation
150 +# Distributed under the terms of the GNU General Public License v2
151 +# $Id$
152 +
153 +EAPI=6
154 +
155 +PHP_EXT_NAME="pam"
156 +PHP_EXT_INI="yes"
157 +PHP_EXT_ZENDEXT="no"
158 +DOCS=( README )
159 +
160 +USE_PHP="php5-6 php7-0"
161 +
162 +inherit php-ext-pecl-r3 pam
163 +
164 +KEYWORDS="~amd64 ~x86"
165 +
166 +DESCRIPTION="This extension provides PAM (Pluggable Authentication Modules) integration"
167 +LICENSE="PHP-2.02"
168 +SLOT="0"
169 +IUSE="debug"
170 +
171 +DEPEND="sys-libs/pam"
172 +RDEPEND="${DEPEND}"
173 +
174 +PATCHES=( "${FILESDIR}/${PV}-php7.patch" )
175 +
176 +src_prepare() {
177 + #Fix DOS line endings
178 + for slot in $(php_get_slots); do
179 + php_init_slot_env "${slot}"
180 + sed -i 's/\r$//' -- pam.c || die
181 + done
182 + php-ext-source-r3_src_prepare
183 +}
184 +
185 +src_configure() {
186 + local PHP_EXT_ECONF_ARGS=( --with-pam=/usr $(use_enable debug) )
187 + php-ext-source-r3_src_configure
188 +}
189 +
190 +src_install() {
191 + pamd_mimic_system php auth account password
192 + php-ext-pecl-r3_src_install
193 +}