Skip to content

Commit

Permalink
Remove the libbsd dependency
Browse files Browse the repository at this point in the history
Use snprintf() instead of strlcpy() such that the libbsd dependency can be
dropped.

Signed-off-by: Bart Van Assche <[email protected]>
  • Loading branch information
bvanassche committed Aug 18, 2021
1 parent c364c1c commit 57c7f59
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .ci/dockerfiles/deb-build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
FROM debian:stable
RUN apt-get update && apt-get -y install eatmydata && eatmydata apt-get -y install --no-install-recommends autoconf-archive autoconf automake libtool libpcsclite-dev libp11-kit-dev libgtk-3-dev libassuan-dev libgpg-error-dev libssl-dev libxml2-dev libcurl4-openssl-dev libproxy-dev libbsd-dev plantuml zip gettext build-essential g++ git graphviz && apt-get clean
RUN apt-get update && apt-get -y install eatmydata && eatmydata apt-get -y install --no-install-recommends autoconf-archive autoconf automake libtool libpcsclite-dev libp11-kit-dev libgtk-3-dev libassuan-dev libgpg-error-dev libssl-dev libxml2-dev libcurl4-openssl-dev libproxy-dev plantuml zip gettext build-essential g++ git graphviz && apt-get clean
2 changes: 1 addition & 1 deletion .ci/dockerfiles/deb-repro/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
FROM debian:stable
RUN apt-get update && apt-get -y install eatmydata && eatmydata apt-get -y install reprotest diffoscope equivs devscripts faketime disorderfs sudo autoconf automake libtool libpcsclite-dev libp11-kit-dev libgtk-3-dev libassuan-dev libgpg-error-dev libssl-dev libxml2-dev libcurl4-openssl-dev libproxy-dev plantuml zip gettext build-essential g++ git graphviz autoconf-archive libbsd-dev && apt-get clean
RUN apt-get update && apt-get -y install eatmydata && eatmydata apt-get -y install reprotest diffoscope equivs devscripts faketime disorderfs sudo autoconf automake libtool libpcsclite-dev libp11-kit-dev libgtk-3-dev libassuan-dev libgpg-error-dev libssl-dev libxml2-dev libcurl4-openssl-dev libproxy-dev plantuml zip gettext build-essential g++ git graphviz autoconf-archive && apt-get clean
2 changes: 1 addition & 1 deletion .ci/dockerfiles/deb-scan-build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
FROM debian:stable
RUN apt-get update && apt-get -y install eatmydata && eatmydata apt-get -y --no-install-recommends install clang-tools autoconf automake libtool libassuan-dev libgpg-error-dev libpcsclite-dev libp11-kit-dev libgtk-3-dev libssl-dev libxml2-dev libcurl4-openssl-dev libproxy-dev libbsd-dev plantuml zip gettext build-essential git g++ graphviz curl && apt-get clean
RUN apt-get update && apt-get -y install eatmydata && eatmydata apt-get -y --no-install-recommends install clang-tools autoconf automake libtool libassuan-dev libgpg-error-dev libpcsclite-dev libp11-kit-dev libgtk-3-dev libssl-dev libxml2-dev libcurl4-openssl-dev libproxy-dev plantuml zip gettext build-essential git g++ graphviz curl && apt-get clean
2 changes: 1 addition & 1 deletion .ci/dockerfiles/gtk4-build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
FROM debian:unstable
COPY experimental.list /etc/apt/sources.list.d/
RUN apt-get update && apt-get -y install eatmydata && eatmydata apt-get -y install --no-install-recommends autoconf automake autoconf-archive gettext libtool libpcsclite-dev libp11-kit-dev libassuan-dev libssl-dev libxml2-dev libcurl4-openssl-dev libproxy-dev plantuml zip gettext build-essential g++ git graphviz libbsd-dev && eatmydata apt-get -y -t experimental install libxml2-dev libgtk-4-dev libgtk-3-dev- && apt-get clean
RUN apt-get update && apt-get -y install eatmydata && eatmydata apt-get -y install --no-install-recommends autoconf automake autoconf-archive gettext libtool libpcsclite-dev libp11-kit-dev libassuan-dev libssl-dev libxml2-dev libcurl4-openssl-dev libproxy-dev plantuml zip gettext build-essential g++ git graphviz && eatmydata apt-get -y -t experimental install libxml2-dev libgtk-4-dev libgtk-3-dev- && apt-get clean
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ installed:
For the PKCS#11 authentication module:

- [PC/SC Lite](https://pcsclite.alioth.debian.org)
- [libbsd](https://libbsd.freedesktop.org/)
- (Optionally) [p11-kit](https://p11-glue.freedesktop.org/p11-kit.html)

If the dialogs and/or the viewer are not disabled:
Expand Down
1 change: 0 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ fi

AM_CONDITIONAL(ASSUAN,[test x"$ASSUAN" = x"y"])

AC_SEARCH_LIBS([strlcpy], [bsd], AC_DEFINE_UNQUOTED([HAVE_LIBBSD], 1, [Set to 1 (just set to 1)]), AC_ERROR([libbsd not found]))
###### pcsc-lite ##########
PKG_CHECK_MODULES([PCSC],[libpcsclite >= 1.4.4],
[
Expand Down
2 changes: 1 addition & 1 deletion debian/control
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Source: eid-mw
Priority: optional
Maintainer: FedICT Servicedesk <[email protected]>
Build-Depends: debhelper (>= 9), autotools-dev, libpcsclite-dev, libgtk-3-dev | libgtk2.0-dev (<= 2.24.11), libtool, lsb-release, libssl-dev, libxml2-dev, libcurl4-openssl-dev, libproxy-dev, openssl, libp11-kit-dev, libassuan-dev, libgpg-error-dev, libbsd-dev
Build-Depends: debhelper (>= 9), autotools-dev, libpcsclite-dev, libgtk-3-dev | libgtk2.0-dev (<= 2.24.11), libtool, lsb-release, libssl-dev, libxml2-dev, libcurl4-openssl-dev, libproxy-dev, openssl, libp11-kit-dev, libassuan-dev, libgpg-error-dev
Standards-Version: 3.8.3
Section: libs
Vcs-Browser: https://github.com/Fedict/eid-mw
Expand Down
5 changes: 4 additions & 1 deletion plugins_tools/eid-viewer/test/testlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ int robot_unit;
#ifdef WIN32
char *strndup(const char *s, size_t n) {
char *rv = malloc(n + 1);
strlcpy(rv, s, n + 1);

if (!rv)
return rv;
snprintf(rv, n + 1, "%.*s", n, s);
return rv;
}
#endif
Expand Down
6 changes: 1 addition & 5 deletions plugins_tools/eid-viewer/verify.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@
#include <config.h>
#endif

#ifdef HAVE_LIBBSD
#include <bsd/bsd.h>
#endif

#ifdef __APPLE__
#include "trustdirname.h"
#define CERTTRUSTDIR eid_vwr_osl_objc_trustdirname()
Expand Down Expand Up @@ -393,7 +389,7 @@ char* eid_vwr_x509_get_details(const void* certificate, size_t certlen) {
X509_print_ex(b, cert, 0, 0);
BIO_get_mem_ptr(b, &p);
rv = malloc(p->length + 1);
strlcpy(rv, p->data, p->length + 1);
snprintf(rv, p->length + 1, "%.*s", p->length, p->data);

BIO_free(b);

Expand Down
1 change: 0 additions & 1 deletion rpm/eid-mw.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ BuildRequires: openssl-perl
BuildRequires: libcurl-devel
BuildRequires: libproxy-devel
BuildRequires: libxml2-devel
BuildRequires: libbsd-devel
BuildRequires: openssl
Conflicts: openct

Expand Down

0 comments on commit 57c7f59

Please sign in to comment.