Gentoo Archives: gentoo-commits

From: "Jason A. Donenfeld" <zx2c4@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-auth/ykpers/files/, sys-auth/ykpers/
Date: Sat, 02 May 2020 06:15:33
Message-Id: 1588400116.347db99528e0d86c6b0e665d6153fb602b4a70ec.zx2c4@gentoo
1 commit: 347db99528e0d86c6b0e665d6153fb602b4a70ec
2 Author: Jason A. Donenfeld <zx2c4 <AT> gentoo <DOT> org>
3 AuthorDate: Sat May 2 06:15:06 2020 +0000
4 Commit: Jason A. Donenfeld <zx2c4 <AT> gentoo <DOT> org>
5 CommitDate: Sat May 2 06:15:16 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=347db995
7
8 sys-auth/ykpers: account for c-json changes
9
10 Package-Manager: Portage-2.3.99, Repoman-2.3.22
11 Signed-off-by: Jason A. Donenfeld <zx2c4 <AT> gentoo.org>
12
13 .../ykpers/files/ykpers-1.20.0-json-boolean.patch | 83 ++++++++++++++++++++++
14 sys-auth/ykpers/ykpers-1.20.0.ebuild | 5 +-
15 2 files changed, 87 insertions(+), 1 deletion(-)
16
17 diff --git a/sys-auth/ykpers/files/ykpers-1.20.0-json-boolean.patch b/sys-auth/ykpers/files/ykpers-1.20.0-json-boolean.patch
18 new file mode 100644
19 index 00000000000..ca5a918d21f
20 --- /dev/null
21 +++ b/sys-auth/ykpers/files/ykpers-1.20.0-json-boolean.patch
22 @@ -0,0 +1,83 @@
23 +From 0aa2e2cae2e1777863993a10c809bb50f4cde7f8 Mon Sep 17 00:00:00 2001
24 +From: Christian Hesse <mail@×××××.de>
25 +Date: Sat, 25 Apr 2020 20:55:28 +0200
26 +Subject: [PATCH] fix boolean value with json-c 0.14
27 +
28 +Upstream removed the TRUE and FALSE defines in commit
29 +0992aac61f8b087efd7094e9ac2b84fa9c040fcd.
30 +---
31 + ykpers-json.c | 18 +++++++++---------
32 + 1 file changed, 9 insertions(+), 9 deletions(-)
33 +
34 +diff --git a/ykpers-json.c b/ykpers-json.c
35 +index a62e907..15ad380 100644
36 +--- a/ykpers-json.c
37 ++++ b/ykpers-json.c
38 +@@ -40,7 +40,7 @@
39 + #define yk_json_object_object_get(obj, key, value) json_object_object_get_ex(obj, key, &value)
40 + #else
41 + typedef int json_bool;
42 +-#define yk_json_object_object_get(obj, key, value) (value = json_object_object_get(obj, key)) == NULL ? (json_bool)FALSE : (json_bool)TRUE
43 ++#define yk_json_object_object_get(obj, key, value) (value = json_object_object_get(obj, key)) == NULL ? 0 : 1
44 + #endif
45 +
46 + static void set_json_value(struct map_st *p, int mode, json_object *options, YKP_CONFIG *cfg) {
47 +@@ -50,7 +50,7 @@ static void set_json_value(struct map_st *p, int mode, json_object *options, YKP
48 + if(p->mode && (mode & p->mode) == mode) {
49 + json_object *joption;
50 + json_bool ret = yk_json_object_object_get(options, p->json_text, joption);
51 +- if(ret == TRUE && json_object_get_type(joption) == json_type_boolean) {
52 ++ if(ret == 1 && json_object_get_type(joption) == json_type_boolean) {
53 + int value = json_object_get_boolean(joption);
54 + if(value == 1) {
55 + p->setter(cfg, true);
56 +@@ -230,20 +230,20 @@ int _ykp_json_import_cfg(YKP_CONFIG *cfg, const char *json, size_t len) {
57 + ykp_errno = YKP_EINVAL;
58 + goto out;
59 + }
60 +- if(yk_json_object_object_get(jobj, "yubiProdConfig", yprod_json) == FALSE) {
61 ++ if(yk_json_object_object_get(jobj, "yubiProdConfig", yprod_json) == 0) {
62 + ykp_errno = YKP_EINVAL;
63 + goto out;
64 + }
65 +- if(yk_json_object_object_get(yprod_json, "mode", jmode) == FALSE) {
66 ++ if(yk_json_object_object_get(yprod_json, "mode", jmode) == 0) {
67 + ykp_errno = YKP_EINVAL;
68 + goto out;
69 + }
70 +- if(yk_json_object_object_get(yprod_json, "options", options) == FALSE) {
71 ++ if(yk_json_object_object_get(yprod_json, "options", options) == 0) {
72 + ykp_errno = YKP_EINVAL;
73 + goto out;
74 + }
75 +
76 +- if(yk_json_object_object_get(yprod_json, "targetConfig", jtarget) == TRUE) {
77 ++ if(yk_json_object_object_get(yprod_json, "targetConfig", jtarget) == 1) {
78 + int target_config = json_object_get_int(jtarget);
79 + int command;
80 + if(target_config == 1) {
81 +@@ -275,13 +275,13 @@ int _ykp_json_import_cfg(YKP_CONFIG *cfg, const char *json, size_t len) {
82 + if(mode == MODE_OATH_HOTP) {
83 + json_object *jdigits, *jrandom;
84 + ykp_set_tktflag_OATH_HOTP(cfg, true);
85 +- if(yk_json_object_object_get(options, "oathDigits", jdigits) == TRUE) {
86 ++ if(yk_json_object_object_get(options, "oathDigits", jdigits) == 1) {
87 + int digits = json_object_get_int(jdigits);
88 + if(digits == 8) {
89 + ykp_set_cfgflag_OATH_HOTP8(cfg, true);
90 + }
91 + }
92 +- if(yk_json_object_object_get(options, "randomSeed", jrandom) == TRUE) {
93 ++ if(yk_json_object_object_get(options, "randomSeed", jrandom) == 1) {
94 + int random = json_object_get_boolean(jrandom);
95 + int seed = 0;
96 + if(random == 1) {
97 +@@ -290,7 +290,7 @@ int _ykp_json_import_cfg(YKP_CONFIG *cfg, const char *json, size_t len) {
98 + goto out;
99 + } else {
100 + json_object *jseed;
101 +- if(yk_json_object_object_get(options, "fixedSeedvalue", jseed) == TRUE) {
102 ++ if(yk_json_object_object_get(options, "fixedSeedvalue", jseed) == 1) {
103 + seed = json_object_get_int(jseed);
104 + }
105 + }
106
107 diff --git a/sys-auth/ykpers/ykpers-1.20.0.ebuild b/sys-auth/ykpers/ykpers-1.20.0.ebuild
108 index 37d5abec3c5..ec05491e8e0 100644
109 --- a/sys-auth/ykpers/ykpers-1.20.0.ebuild
110 +++ b/sys-auth/ykpers/ykpers-1.20.0.ebuild
111 @@ -26,7 +26,10 @@ RDEPEND="${DEPEND}
112 "
113
114 S="${WORKDIR}/yubikey-personalization-${PV}"
115 -PATCHES=( "${FILESDIR}"/${PN}-1.20.0-fix-gcc10-fno-common.patch )
116 +PATCHES=(
117 + "${FILESDIR}"/${PN}-1.20.0-fix-gcc10-fno-common.patch
118 + "${FILESDIR}"/${PN}-1.20.0-json-boolean.patch
119 +)
120
121 DOCS=( doc/. AUTHORS NEWS README )