You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lshw/SOURCES/0002-make-version-check-opt...

69 lines
1.6 KiB

From d76afbaaf40e953243da921844cddff8185324f3 Mon Sep 17 00:00:00 2001
From: Lyonel Vincent <lyonel@ezix.org>
Date: Tue, 28 Jun 2022 10:22:38 +0200
Subject: [PATCH 2/2] make version check optional
cf. Github PR#86
Rather than using an LSM such as SELinux to limit network access, or
having to add exceptions into network monitoring, allow lshw to be built
so that it doesn't do the DNS lookup to check for upstream version
updates.
Signed-off-by: Stewart Smith trawets@amazon.com
---
src/core/version.cc | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/src/core/version.cc b/src/core/version.cc
index 1f64b3a..ea8dd4a 100644
--- a/src/core/version.cc
+++ b/src/core/version.cc
@@ -13,6 +13,7 @@
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
+#ifdef REMOTE_VERSION_CHECK
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <resolv.h>
@@ -21,7 +22,7 @@
#ifndef PACKETSZ
#define PACKETSZ 512
#endif
-
+#endif
const char *getpackageversion()
{
@@ -31,6 +32,7 @@ const char *getpackageversion()
return "unknown";
}
+#ifdef REMOTE_VERSION_CHECK
static char *txtquery(const char *name, const char *domain, unsigned int *ttl)
{
unsigned char answer[PACKETSZ], *pt;
@@ -84,13 +86,18 @@ static char *txtquery(const char *name, const char *domain, unsigned int *ttl)
return txt;
}
+#endif
const char * checkupdates()
{
+#ifdef REMOTE_VERSION_CHECK
static char *latest = NULL;
if(!latest)
latest = txtquery(PACKAGE, "ezix.org", NULL);
return latest;
+#else
+ return NULL;
+#endif
}
--
2.33.1