ykpers, bump version, move to ykpers (#5526)

This commit is contained in:
Schrijvers Luc
2020-12-27 09:30:08 +01:00
committed by GitHub
parent 3cff48ffa7
commit 0bbcd431ab
3 changed files with 95 additions and 41 deletions

View File

@@ -0,0 +1,83 @@
From 0aa2e2cae2e1777863993a10c809bb50f4cde7f8 Mon Sep 17 00:00:00 2001
From: Christian Hesse <mail@eworm.de>
Date: Sat, 25 Apr 2020 20:55:28 +0200
Subject: [PATCH 1/1] fix boolean value with json-c 0.14
Upstream removed the TRUE and FALSE defines in commit
0992aac61f8b087efd7094e9ac2b84fa9c040fcd.
---
ykpers-json.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/ykpers-json.c b/ykpers-json.c
index a62e907..15ad380 100644
--- a/ykpers-json.c
+++ b/ykpers-json.c
@@ -40,7 +40,7 @@
#define yk_json_object_object_get(obj, key, value) json_object_object_get_ex(obj, key, &value)
#else
typedef int json_bool;
-#define yk_json_object_object_get(obj, key, value) (value = json_object_object_get(obj, key)) == NULL ? (json_bool)FALSE : (json_bool)TRUE
+#define yk_json_object_object_get(obj, key, value) (value = json_object_object_get(obj, key)) == NULL ? 0 : 1
#endif
static void set_json_value(struct map_st *p, int mode, json_object *options, YKP_CONFIG *cfg) {
@@ -50,7 +50,7 @@ static void set_json_value(struct map_st *p, int mode, json_object *options, YKP
if(p->mode && (mode & p->mode) == mode) {
json_object *joption;
json_bool ret = yk_json_object_object_get(options, p->json_text, joption);
- if(ret == TRUE && json_object_get_type(joption) == json_type_boolean) {
+ if(ret == 1 && json_object_get_type(joption) == json_type_boolean) {
int value = json_object_get_boolean(joption);
if(value == 1) {
p->setter(cfg, true);
@@ -230,20 +230,20 @@ int _ykp_json_import_cfg(YKP_CONFIG *cfg, const char *json, size_t len) {
ykp_errno = YKP_EINVAL;
goto out;
}
- if(yk_json_object_object_get(jobj, "yubiProdConfig", yprod_json) == FALSE) {
+ if(yk_json_object_object_get(jobj, "yubiProdConfig", yprod_json) == 0) {
ykp_errno = YKP_EINVAL;
goto out;
}
- if(yk_json_object_object_get(yprod_json, "mode", jmode) == FALSE) {
+ if(yk_json_object_object_get(yprod_json, "mode", jmode) == 0) {
ykp_errno = YKP_EINVAL;
goto out;
}
- if(yk_json_object_object_get(yprod_json, "options", options) == FALSE) {
+ if(yk_json_object_object_get(yprod_json, "options", options) == 0) {
ykp_errno = YKP_EINVAL;
goto out;
}
- if(yk_json_object_object_get(yprod_json, "targetConfig", jtarget) == TRUE) {
+ if(yk_json_object_object_get(yprod_json, "targetConfig", jtarget) == 1) {
int target_config = json_object_get_int(jtarget);
int command;
if(target_config == 1) {
@@ -275,13 +275,13 @@ int _ykp_json_import_cfg(YKP_CONFIG *cfg, const char *json, size_t len) {
if(mode == MODE_OATH_HOTP) {
json_object *jdigits, *jrandom;
ykp_set_tktflag_OATH_HOTP(cfg, true);
- if(yk_json_object_object_get(options, "oathDigits", jdigits) == TRUE) {
+ if(yk_json_object_object_get(options, "oathDigits", jdigits) == 1) {
int digits = json_object_get_int(jdigits);
if(digits == 8) {
ykp_set_cfgflag_OATH_HOTP8(cfg, true);
}
}
- if(yk_json_object_object_get(options, "randomSeed", jrandom) == TRUE) {
+ if(yk_json_object_object_get(options, "randomSeed", jrandom) == 1) {
int random = json_object_get_boolean(jrandom);
int seed = 0;
if(random == 1) {
@@ -290,7 +290,7 @@ int _ykp_json_import_cfg(YKP_CONFIG *cfg, const char *json, size_t len) {
goto out;
} else {
json_object *jseed;
- if(yk_json_object_object_get(options, "fixedSeedvalue", jseed) == TRUE) {
+ if(yk_json_object_object_get(options, "fixedSeedvalue", jseed) == 1) {
seed = json_object_get_int(jseed);
}
}

View File

@@ -2,24 +2,26 @@ SUMMARY="YubiKey Personalization package"
DESCRIPTION="A library and command line tool used to personalize \
(i.e., set a AES key) YubiKeys."
HOMEPAGE="https://developers.yubico.com/yubico-c-client/"
COPYRIGHT="2008-2018 Yubico AB"
COPYRIGHT="2008-2019 Yubico AB"
LICENSE="BSD (2-clause)"
REVISION="3"
REVISION="1"
SOURCE_URI="https://developers.yubico.com/yubikey-personalization/Releases/ykpers-$portVersion.tar.gz"
CHECKSUM_SHA256="2bc8afa16d495a486582bad916d16de1f67c0cce9bb0a35c3123376c2d609480"
SOURCE_FILENAME="libykpers-$portVersion.tar.gz"
SOURCE_DIR="ykpers-$portVersion"
PATCHES="libykpers-$portVersion.patchset"
CHECKSUM_SHA256="0ec84d0ea862f45a7d85a1a3afe5e60b8da42df211bb7d27a50f486e31a79b93"
# patch taken from Arch Linux
PATCHES="0001-fix-boolean-value-with-json-c-0.14.patch"
ARCHITECTURES="?x86_gcc2 x86 x86_64"
SECONDARY_ARCHITECTURES="x86"
libVersion="$portVersion"
libVersionCompat="$libVersion compat >= ${libVersion%%.*}"
PROVIDES="
libykpers$secondaryArchSuffix = $portVersion
ykpers$secondaryArchSuffix = $portVersion
cmd:ykchalresp$secondaryArchSuffix = $portVersion
cmd:ykinfo$secondaryArchSuffix = $portVersion
cmd:ykpersonalize$secondaryArchSuffix = $portVersion
lib:libykpers_1$secondaryArchSuffix = 1.19.0 compat >= 0
lib:libykpers_1$secondaryArchSuffix = $libVersionCompat
"
REQUIRES="
haiku$secondaryArchSuffix
@@ -30,8 +32,8 @@ REQUIRES="
"
PROVIDES_devel="
libykpers${secondaryArchSuffix}_devel = $portVersion
devel:libykpers_1$secondaryArchSuffix = 1.19.0 compat >= 0
ykpers${secondaryArchSuffix}_devel = $portVersion
devel:libykpers_1$secondaryArchSuffix = $libVersionCompat
"
REQUIRES_devel="
libykpers$secondaryArchSuffix == $portVersion base

View File

@@ -1,31 +0,0 @@
From 4c227676bf627d8cc5213d1d6afb79fc763ba7bf Mon Sep 17 00:00:00 2001
From: begasus <begasus@gmail.com>
Date: Thu, 20 Sep 2018 11:50:07 +0200
Subject: add #define(__HAIKU__) to complete the test
diff --git a/tests/test_args_to_config.c b/tests/test_args_to_config.c
index d0bf261..1481f27 100644
--- a/tests/test_args_to_config.c
+++ b/tests/test_args_to_config.c
@@ -132,7 +132,7 @@ static int _test_config (YKP_CONFIG *cfg, YK_STATUS *st, int argc, char **argv)
ykp_errno = 0;
/* getopt reinit (BSD systems use optreset and a different optind value) */
-#if defined(__GLIBC__) || defined(_WIN32)
+#if defined(__GLIBC__) || defined(_WIN32) || defined(__HAIKU__)
optind = 0;
#else
optind = optreset = 1;
@@ -329,7 +329,7 @@ static void _test_non_config_args(void)
ykp_errno = 0;
/* getopt reinit (BSD systems use optreset and a different optind value) */
-#if defined(__GLIBC__) || defined(_WIN32)
+#if defined(__GLIBC__) || defined(_WIN32) || defined(__HAIKU__)
optind = 0;
#else
optind = optreset = 1;
--
2.19.0