Compare commits

...

2 Commits
rawhide ... f36

Author SHA1 Message Date
Sergio Correia af552d6853
Report error details when json_load_file() fails 2022-12-07 08:34:30 -03:00
Sergio Arroutbi 2f3ef1c478 Adopt systemd-sysusers format
Signed-off-by: Sergio Arroutbi <sarroutb@redhat.com>
2022-09-08 08:34:28 -03:00
3 changed files with 51 additions and 5 deletions

View File

@ -0,0 +1,36 @@
From dac0dd6f729ed6cbdd4c92f5a8b2f5e1c66127fb Mon Sep 17 00:00:00 2001
From: Barry <barry@barrys-emacs.org>
Date: Fri, 25 Nov 2022 16:36:26 +0000
Subject: [PATCH] When json_load_file fails report the error details
information (#103)
* When json_load_file fails report the error details information returned.
This allows for file I/O issues as well as JSON parsing issues
to be reported.
---
src/keys.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/keys.c b/src/keys.c
index 205bbe5..bbfc374 100644
--- a/src/keys.c
+++ b/src/keys.c
@@ -369,9 +369,12 @@ load_keys(const char* jwkdir)
continue;
}
filepath[sizeof(filepath) - 1] = '\0';
- json_auto_t* json = json_load_file(filepath, 0, NULL);
+ json_error_t error;
+ json_auto_t* json = json_load_file(filepath, 0, &error);
if (!json) {
- fprintf(stderr, "Invalid JSON file (%s); skipping\n", filepath);
+ fprintf(stderr, "Cannot load JSON file (%s); skipping\n", filepath);
+ fprintf(stderr, "error text %s, line %d, col %d, pos %d\n",
+ error.text, error.line, error.column, error.position);
continue;
}
--
2.38.1

View File

@ -1,11 +1,14 @@
Name: tang
Version: 11
Release: 2%{?dist}
Release: 4%{?dist}
Summary: Network Presence Binding Daemon
License: GPLv3+
URL: https://github.com/latchset/%{name}
Source0: https://github.com/latchset/%{name}/releases/download/v%{version}/%{name}-%{version}.tar.xz
Source1: tang.sysusers
Patch: 0001-When-json_load_file-fails-report-the-error-details-i.patch
BuildRequires: gcc
BuildRequires: meson
@ -20,6 +23,7 @@ BuildRequires: systemd-devel
BuildRequires: pkgconfig
BuildRequires: systemd
BuildRequires: systemd-rpm-macros
BuildRequires: curl
BuildRequires: asciidoc
@ -48,16 +52,14 @@ Tang is a small daemon for binding data to the presence of a third party.
%install
%meson_install
install -p -D -m 0644 %{SOURCE1} %{buildroot}%{_sysusersdir}/tang.conf
%{__mkdir_p} $RPM_BUILD_ROOT/%{_localstatedir}/db/%{name}
%check
%meson_test
%pre
getent group %{name} >/dev/null || groupadd -r %{name}
getent passwd %{name} >/dev/null || \
useradd -r -g %{name} -d %{_localstatedir}/cache/%{name} -s /sbin/nologin \
-c "Tang Network Presence Daemon user" %{name}
%sysusers_create_compat %{SOURCE1}
exit 0
%post
@ -95,8 +97,15 @@ fi
%{_bindir}/%{name}-show-keys
%{_mandir}/man1/tang-show-keys.1*
%{_mandir}/man1/tangd-rotate-keys.1.*
%{_sysusersdir}/tang.conf
%changelog
* Wed Dec 07 2022 Sergio Correia <scorreia@redhat.com> - 11-4
- Report error details when json_load_file() fails
* Wed Aug 17 2022 Sergio Arroutbi <sarroutb@redhat.com> - 11-3
- Adopt systemd-sysusers format
* Sat Jan 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 11-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

1
tang.sysusers Normal file
View File

@ -0,0 +1 @@
u tang - "Tang Network Presence Daemon user" /var/cache/tang -