Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Add PORTAUDITE_SITE to allow overriding the auditfile url
Bryan Drewery committed 13 years ago
commit d9aab4d976483ab9c9df590a2a9780b37b65d06b
parent 414bcc0
6 files changed +29 -6
modified libpkg/pkg.h
@@ -257,6 +257,7 @@ typedef enum _pkg_config_key {
	PKG_CONFIG_AUTODEPS = 12,
	PKG_CONFIG_ABI = 13,
	PKG_CONFIG_DEVELOPER_MODE = 14,
+
	PKG_CONFIG_PORTAUDIT_SITE = 15,
} pkg_config_key;

typedef enum {
modified libpkg/pkg_config.c
@@ -151,7 +151,13 @@ static struct config_entry c[] = {
		"DEVELOPER_MODE",
		"NO",
		{ NULL }
-
	}
+
	},
+
	[PKG_CONFIG_PORTAUDIT_SITE] = {
+
		STRING,
+
		"PORTAUDIT_SITE",
+
		"http://portaudit.FreeBSD.org/auditfile.tbz",
+
		{ NULL }
+
	},
};

static bool parsed = false;
modified pkg/audit.c
@@ -44,8 +44,6 @@
#include <pkg.h>
#include "pkgcli.h"

-
#define AUDIT_URL "http://portaudit.FreeBSD.org/auditfile.tbz"
-

#define EQ 1
#define LT 2
#define LTE 3
@@ -326,6 +324,7 @@ exec_audit(int argc, char **argv)
	bool fetch = false;
	int ch;
	int ret = EX_OK;
+
	const char *portaudit_site = NULL;

	if (pkg_config_string(PKG_CONFIG_DBDIR, &db_dir) != EPKG_OK) {
		warnx("PKG_DBIR is missing");
@@ -347,7 +346,10 @@ exec_audit(int argc, char **argv)
	argv += optind;

	if (fetch == true) {
-
		if (fetch_and_extract(AUDIT_URL, audit_file) != EPKG_OK) {
+
		if (pkg_config_string(PKG_CONFIG_PORTAUDIT_SITE, &portaudit_site) != EPKG_OK) {
+
			return (EPKG_FATAL);
+
		}
+
		if (fetch_and_extract(portaudit_site, audit_file) != EPKG_OK) {
			return (EX_IOERR);
		}
	}
modified pkg/pkg-audit.8
@@ -15,7 +15,7 @@
.\"     @(#)pkg.8
.\" $FreeBSD$
.\"
-
.Dd April 12, 2012
+
.Dd June 12, 2012
.Dt PKG-AUDIT 8
.Os
.Sh NAME
@@ -38,6 +38,12 @@ to check if security advisories for any installed packages exist.
Note that a current ports tree (or any local copy of the ports tree) is not
required for operation.
.Pp
+
The URL that is used to fetch the database can be overriden via the PORTAUDIT_SITE
+
config variable.
+
See
+
.Xr pkg.conf 5
+
for more information.
+
.Pp
If you have a vulnerable package installed, you are advised to update or
deinstall it immediately.
.Pp
@@ -59,6 +65,7 @@ See
for further description.
.Bl -tag -width ".Ev NO_DESCRIPTIONS"
.It PKG_DBDIR
+
.It PORTAUDIT_SITE
.El
.Sh FILES
See
modified pkg/pkg.conf.5
@@ -15,7 +15,7 @@
.\"     @(#)pkg.1
.\" $FreeBSD$
.\"
-
.Dd June 2, 2012
+
.Dd June 12, 2012
.Dt PKG.CONF 5
.Os
.Sh NAME
@@ -119,6 +119,12 @@ suggestions to the output of
as an aide to port maintainers, including indicating when the port
might be marked as architecture independent.
default: off
+
.It Cm PORTAUDIT_SITE: string
+
Specifies the remote location to use
+
when fetching the portaudit database.
+
See
+
.Xr pkg-audit 8
+
for more information.
.El
.Sh ENVIRONMENT
An environment variable with the same name as the option in the configuration
modified pkg/pkg.conf.sample
@@ -14,6 +14,7 @@ ASSUME_ALWAYS_YES : NO
SYSLOG		    : YES
SHLIBS		    : NO
AUTODEPS	    : NO
+
PORTAUDIT_SITE	    : http://portaudit.FreeBSD.org/auditfile.tbz

# Repository definitions
repos: