diff options
author | joerg <joerg> | 2009-02-02 11:55:15 +0000 |
---|---|---|
committer | joerg <joerg> | 2009-02-02 11:55:15 +0000 |
commit | 577c2e940ccd3ed1d467b9fa0a83970d940451f8 (patch) | |
tree | 2728b4a0c301dd03b81eb827849d18ab6c2a2b72 /pkgtools/pkg_install/files/admin/audit.c | |
parent | 0e13be61a1d6400317bbbcbedb12f83edb11b0f0 (diff) | |
download | pkgsrc-pkg_install_renovation.tar.gz |
pkg_install-20090201:pkg_install_renovation
- sync DESCR and MESSAGE with HEAD and the branch state
- sync Makefile
- regen configure
- cleanup __RCSID
- merge audit logic in pkg_add and pkg_admin into new audit_packages
function. As side effect, pkg_add will list all vulnerabilities before
asking the user whether it should continue
- sort config_variable array
Diffstat (limited to 'pkgtools/pkg_install/files/admin/audit.c')
-rw-r--r-- | pkgtools/pkg_install/files/admin/audit.c | 66 |
1 files changed, 4 insertions, 62 deletions
diff --git a/pkgtools/pkg_install/files/admin/audit.c b/pkgtools/pkg_install/files/admin/audit.c index b421703a610..fe6fd14c9e8 100644 --- a/pkgtools/pkg_install/files/admin/audit.c +++ b/pkgtools/pkg_install/files/admin/audit.c @@ -1,4 +1,4 @@ -/* $NetBSD: audit.c,v 1.8.2.6 2008/11/27 19:24:13 joerg Exp $ */ +/* $NetBSD: audit.c,v 1.8.2.7 2009/02/02 11:55:16 joerg Exp $ */ #if HAVE_CONFIG_H #include "config.h" @@ -7,9 +7,7 @@ #if HAVE_SYS_CDEFS_H #include <sys/cdefs.h> #endif -#ifndef lint -__RCSID("$NetBSD: audit.c,v 1.8.2.6 2008/11/27 19:24:13 joerg Exp $"); -#endif +__RCSID("$NetBSD: audit.c,v 1.8.2.7 2009/02/02 11:55:16 joerg Exp $"); /*- * Copyright (c) 2008 Joerg Sonnenberger <joerg@NetBSD.org>. @@ -117,66 +115,10 @@ parse_options(int argc, char **argv) } static int -check_ignored_entry(size_t i) -{ - const char *iter, *next; - size_t entry_len, url_len; - - if (ignore_advisories == NULL) - return 0; - - url_len = strlen(pv->advisory[i]); - - for (iter = ignore_advisories; *iter; iter = next) { - if ((next = strchr(iter, '\n')) == NULL) { - entry_len = strlen(iter); - next = iter + entry_len; - } else { - entry_len = next - iter; - ++next; - } - if (url_len != entry_len) - continue; - if (strncmp(pv->advisory[i], iter, entry_len) == 0) - return 1; - } - return 0; -} - -static int check_exact_pkg(const char *pkg) { - int ret; - size_t i; - - ret = 0; - for (i = 0; i < pv->entries; ++i) { - if (check_ignored_entry(i)) - continue; - if (limit_vul_types != NULL && - strcmp(limit_vul_types, pv->classification[i])) - continue; - if (!pkg_match(pv->vulnerability[i], pkg)) - continue; - if (strcmp("eol", pv->classification[i]) == 0) { - if (!check_eol) - continue; - if (quiet) - puts(pkg); - else - printf("Package %s has reached end-of-life (eol), " - "see %s/eol-packages\n", pkg, - tnf_vulnerability_base); - continue; - } - if (quiet) - puts(pkg); - else - printf("Package %s has a %s vulnerability, see %s\n", - pkg, pv->classification[i], pv->advisory[i]); - ret = 1; - } - return ret; + return audit_package(pv, pkg, limit_vul_types, check_eol, + quiet ? 0 : 1); } static int |