Gentoo Archives: gentoo-commits

From: Bernard Cafarelli <voyageur@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-misc/rdesktop/files/, net-misc/rdesktop/
Date: Mon, 20 Aug 2018 16:14:18
Message-Id: 1534781632.3368f33b04e6c2368ecc2b5de7099783947a512e.voyageur@gentoo
1 commit: 3368f33b04e6c2368ecc2b5de7099783947a512e
2 Author: Bernard Cafarelli <voyageur <AT> gentoo <DOT> org>
3 AuthorDate: Mon Aug 20 16:09:35 2018 +0000
4 Commit: Bernard Cafarelli <voyageur <AT> gentoo <DOT> org>
5 CommitDate: Mon Aug 20 16:13:52 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3368f33b
7
8 net-misc/rdesktop: openssl 1.1 support and EAPI bump
9
10 Simplify and clean ebuild
11
12 Package-Manager: Portage-2.3.47, Repoman-2.3.10
13
14 .../files/rdesktop-1.6.0-sound_configure.patch | 4 +-
15 .../rdesktop/files/rdesktop-1.8.3-no_strip.patch | 12 ++
16 .../files/rdesktop-1.8.3-openssl-1.1.patch | 125 +++++++++++++++++++++
17 .../files/rdesktop-1.8.3-xrandr_configure.patch | 4 +-
18 net-misc/rdesktop/rdesktop-1.8.3-r3.ebuild | 70 ++++++++++++
19 5 files changed, 211 insertions(+), 4 deletions(-)
20
21 diff --git a/net-misc/rdesktop/files/rdesktop-1.6.0-sound_configure.patch b/net-misc/rdesktop/files/rdesktop-1.6.0-sound_configure.patch
22 index 8e64ba8b48c..b2f492b1071 100644
23 --- a/net-misc/rdesktop/files/rdesktop-1.6.0-sound_configure.patch
24 +++ b/net-misc/rdesktop/files/rdesktop-1.6.0-sound_configure.patch
25 @@ -1,5 +1,5 @@
26 ---- configure.ac.orig 2009-06-30 10:35:14.000000000 +0200
27 -+++ configure.ac 2009-06-30 11:35:10.000000000 +0200
28 +--- rdesktop.orig/configure.ac 2009-06-30 10:35:14.000000000 +0200
29 ++++ rdesktop/configure.ac 2009-06-30 11:35:10.000000000 +0200
30 @@ -228,7 +228,11 @@
31 if test -n "$PKG_CONFIG"; then
32 PKG_CHECK_MODULES(LIBAO, ao, [HAVE_LIBAO=1], [HAVE_LIBAO=0])
33
34 diff --git a/net-misc/rdesktop/files/rdesktop-1.8.3-no_strip.patch b/net-misc/rdesktop/files/rdesktop-1.8.3-no_strip.patch
35 new file mode 100644
36 index 00000000000..018ceeedacf
37 --- /dev/null
38 +++ b/net-misc/rdesktop/files/rdesktop-1.8.3-no_strip.patch
39 @@ -0,0 +1,12 @@
40 +diff -Naur rdesktop-1.8.3.orig/Makefile.in rdesktop-1.8.3/Makefile.in
41 +--- rdesktop-1.8.3.orig/Makefile.in 2013-01-21 13:28:14.000000000 +0100
42 ++++ rdesktop-1.8.3/Makefile.in 2018-08-20 18:05:38.401218002 +0200
43 +@@ -60,7 +60,7 @@
44 + installbin: rdesktop
45 + mkdir -p $(DESTDIR)$(bindir)
46 + $(INSTALL) rdesktop $(DESTDIR)$(bindir)
47 +- $(STRIP) $(DESTDIR)$(bindir)/rdesktop
48 ++
49 + chmod 755 $(DESTDIR)$(bindir)/rdesktop
50 +
51 + .PHONY: installman
52
53 diff --git a/net-misc/rdesktop/files/rdesktop-1.8.3-openssl-1.1.patch b/net-misc/rdesktop/files/rdesktop-1.8.3-openssl-1.1.patch
54 new file mode 100644
55 index 00000000000..bea047cce9a
56 --- /dev/null
57 +++ b/net-misc/rdesktop/files/rdesktop-1.8.3-openssl-1.1.patch
58 @@ -0,0 +1,125 @@
59 +From bd6aa6acddf0ba640a49834807872f4cc0d0a773 Mon Sep 17 00:00:00 2001
60 +From: Jani Hakala <jjhakala@×××××.com>
61 +Date: Thu, 16 Jun 2016 14:28:15 +0300
62 +Subject: [PATCH] Fix OpenSSL 1.1 compability issues
63 +
64 +Some data types have been made opaque in OpenSSL version 1.1 so
65 +stack allocation and accessing struct fields directly does not work.
66 +---
67 + ssl.c | 65 ++++++++++++++++++++++++++++++++++++-----------------------
68 + 1 file changed, 40 insertions(+), 25 deletions(-)
69 +
70 +diff --git a/ssl.c b/ssl.c
71 +index 48751255..032e9b9e 100644
72 +--- a/ssl.c
73 ++++ b/ssl.c
74 +@@ -88,7 +88,7 @@ rdssl_rsa_encrypt(uint8 * out, uint8 * in, int len, uint32 modulus_size, uint8 *
75 + uint8 * exponent)
76 + {
77 + BN_CTX *ctx;
78 +- BIGNUM mod, exp, x, y;
79 ++ BIGNUM *mod, *exp, *x, *y;
80 + uint8 inr[SEC_MAX_MODULUS_SIZE];
81 + int outlen;
82 +
83 +@@ -98,24 +98,24 @@ rdssl_rsa_encrypt(uint8 * out, uint8 * in, int len, uint32 modulus_size, uint8 *
84 + reverse(inr, len);
85 +
86 + ctx = BN_CTX_new();
87 +- BN_init(&mod);
88 +- BN_init(&exp);
89 +- BN_init(&x);
90 +- BN_init(&y);
91 +-
92 +- BN_bin2bn(modulus, modulus_size, &mod);
93 +- BN_bin2bn(exponent, SEC_EXPONENT_SIZE, &exp);
94 +- BN_bin2bn(inr, len, &x);
95 +- BN_mod_exp(&y, &x, &exp, &mod, ctx);
96 +- outlen = BN_bn2bin(&y, out);
97 ++ mod = BN_new();
98 ++ exp = BN_new();
99 ++ x = BN_new();
100 ++ y = BN_new();
101 ++
102 ++ BN_bin2bn(modulus, modulus_size, mod);
103 ++ BN_bin2bn(exponent, SEC_EXPONENT_SIZE, exp);
104 ++ BN_bin2bn(inr, len, x);
105 ++ BN_mod_exp(y, x, exp, mod, ctx);
106 ++ outlen = BN_bn2bin(y, out);
107 + reverse(out, outlen);
108 + if (outlen < (int) modulus_size)
109 + memset(out + outlen, 0, modulus_size - outlen);
110 +
111 +- BN_free(&y);
112 +- BN_clear_free(&x);
113 +- BN_free(&exp);
114 +- BN_free(&mod);
115 ++ BN_free(y);
116 ++ BN_clear_free(x);
117 ++ BN_free(exp);
118 ++ BN_free(mod);
119 + BN_CTX_free(ctx);
120 + }
121 +
122 +@@ -146,12 +146,20 @@ rdssl_cert_to_rkey(RDSSL_CERT * cert, uint32 * key_len)
123 +
124 + Kudos to Richard Levitte for the following (. intiutive .)
125 + lines of code that resets the OID and let's us extract the key. */
126 +- nid = OBJ_obj2nid(cert->cert_info->key->algor->algorithm);
127 ++
128 ++ X509_PUBKEY *key = NULL;
129 ++ X509_ALGOR *algor = NULL;
130 ++
131 ++ key = X509_get_X509_PUBKEY(cert);
132 ++ algor = X509_PUBKEY_get0_param(NULL, NULL, 0, &algor, key);
133 ++
134 ++ nid = OBJ_obj2nid(algor->algorithm);
135 ++
136 + if ((nid == NID_md5WithRSAEncryption) || (nid == NID_shaWithRSAEncryption))
137 + {
138 + DEBUG_RDP5(("Re-setting algorithm type to RSA in server certificate\n"));
139 +- ASN1_OBJECT_free(cert->cert_info->key->algor->algorithm);
140 +- cert->cert_info->key->algor->algorithm = OBJ_nid2obj(NID_rsaEncryption);
141 ++ X509_PUBKEY_set0_param(key, OBJ_nid2obj(NID_rsaEncryption),
142 ++ 0, NULL, NULL, 0);
143 + }
144 + epk = X509_get_pubkey(cert);
145 + if (NULL == epk)
146 +@@ -201,14 +209,24 @@ rdssl_rkey_get_exp_mod(RDSSL_RKEY * rkey, uint8 * exponent, uint32 max_exp_len,
147 + {
148 + int len;
149 +
150 +- if ((BN_num_bytes(rkey->e) > (int) max_exp_len) ||
151 +- (BN_num_bytes(rkey->n) > (int) max_mod_len))
152 ++ BIGNUM *e = NULL;
153 ++ BIGNUM *n = NULL;
154 ++
155 ++#if OPENSSL_VERSION_NUMBER < 0x10100000L
156 ++ e = rkey->e;
157 ++ n = rkey->n;
158 ++#else
159 ++ RSA_get0_key(rkey, &e, &n, NULL);
160 ++#endif
161 ++
162 ++ if ((BN_num_bytes(e) > (int) max_exp_len) ||
163 ++ (BN_num_bytes(n) > (int) max_mod_len))
164 + {
165 + return 1;
166 + }
167 +- len = BN_bn2bin(rkey->e, exponent);
168 ++ len = BN_bn2bin(e, exponent);
169 + reverse(exponent, len);
170 +- len = BN_bn2bin(rkey->n, modulus);
171 ++ len = BN_bn2bin(n, modulus);
172 + reverse(modulus, len);
173 + return 0;
174 + }
175 +@@ -229,8 +247,5 @@ void
176 + rdssl_hmac_md5(const void *key, int key_len, const unsigned char *msg, int msg_len,
177 + unsigned char *md)
178 + {
179 +- HMAC_CTX ctx;
180 +- HMAC_CTX_init(&ctx);
181 + HMAC(EVP_md5(), key, key_len, msg, msg_len, md, NULL);
182 +- HMAC_CTX_cleanup(&ctx);
183 + }
184
185 diff --git a/net-misc/rdesktop/files/rdesktop-1.8.3-xrandr_configure.patch b/net-misc/rdesktop/files/rdesktop-1.8.3-xrandr_configure.patch
186 index f57a86b4315..fea0b975260 100644
187 --- a/net-misc/rdesktop/files/rdesktop-1.8.3-xrandr_configure.patch
188 +++ b/net-misc/rdesktop/files/rdesktop-1.8.3-xrandr_configure.patch
189 @@ -1,5 +1,5 @@
190 ---- configure.ac.orig 2015-09-14 11:27:54.974472081 +0200
191 -+++ configure.ac 2015-09-14 11:34:37.729155044 +0200
192 +--- rdesktop.orig/configure.ac 2015-09-14 11:27:54.974472081 +0200
193 ++++ rdesktop/configure.ac 2015-09-14 11:34:37.729155044 +0200
194 @@ -151,9 +151,12 @@
195 AC_SUBST(CREDSSPOBJ)
196
197
198 diff --git a/net-misc/rdesktop/rdesktop-1.8.3-r3.ebuild b/net-misc/rdesktop/rdesktop-1.8.3-r3.ebuild
199 new file mode 100644
200 index 00000000000..d8c5ec13872
201 --- /dev/null
202 +++ b/net-misc/rdesktop/rdesktop-1.8.3-r3.ebuild
203 @@ -0,0 +1,70 @@
204 +# Copyright 1999-2018 Gentoo Foundation
205 +# Distributed under the terms of the GNU General Public License v2
206 +
207 +EAPI=7
208 +inherit autotools eutils
209 +
210 +MY_PV=${PV/_/-}
211 +
212 +DESCRIPTION="A Remote Desktop Protocol Client"
213 +HOMEPAGE="http://rdesktop.sourceforge.net/"
214 +SRC_URI="mirror://sourceforge/${PN}/${PN}-${MY_PV}.tar.gz"
215 +
216 +LICENSE="GPL-3"
217 +SLOT="0"
218 +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux ~sparc-solaris ~x64-solaris ~x86-solaris"
219 +IUSE="alsa ao debug ipv6 kerberos libressl libsamplerate oss pcsc-lite xrandr"
220 +
221 +S=${WORKDIR}/${PN}-${MY_PV}
222 +
223 +RDEPEND="
224 + !libressl? ( dev-libs/openssl:0= )
225 + libressl? ( dev-libs/libressl:= )
226 + x11-libs/libX11
227 + x11-libs/libXext
228 + x11-libs/libXau
229 + x11-libs/libXdmcp
230 + alsa? ( media-libs/alsa-lib )
231 + ao? ( >=media-libs/libao-0.8.6 )
232 + kerberos? ( net-libs/libgssglue )
233 + libsamplerate? ( media-libs/libsamplerate )
234 + pcsc-lite? ( >=sys-apps/pcsc-lite-1.6.6 )
235 + xrandr? ( x11-libs/libXrandr )"
236 +DEPEND="${RDEPEND}
237 + x11-libs/libXt"
238 +BDEPEND=virtual/pkgconfig
239 +
240 +PATCHES=(
241 + "${FILESDIR}"/${PN}-1.6.0-sound_configure.patch
242 + "${FILESDIR}"/${P}-no_strip.patch
243 + "${FILESDIR}"/${P}-xrandr_configure.patch
244 + "${FILESDIR}"/${P}-openssl-1.1.patch
245 +)
246 +
247 +DOCS=( doc/HACKING doc/TODO doc/keymapping.txt )
248 +
249 +src_prepare() {
250 + default
251 + eautoreconf
252 +}
253 +
254 +src_configure() {
255 + if use ao; then
256 + sound_conf=$(use_with ao sound libao)
257 + else if use alsa; then
258 + sound_conf=$(use_with alsa sound alsa)
259 + else
260 + sound_conf=$(use_with oss sound oss)
261 + fi
262 + fi
263 +
264 + econf \
265 + --with-openssl="${EPREFIX}"/usr \
266 + $(use_with debug) \
267 + $(use_with ipv6) \
268 + $(use_with libsamplerate) \
269 + $(use_with xrandr) \
270 + $(use_enable kerberos credssp) \
271 + $(use_enable pcsc-lite smartcard) \
272 + ${sound_conf}
273 +}