pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/pkgtools/pkg_install/files/audit-packages Fix a bug in...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/18852cf04db2
branches:  trunk
changeset: 532536:18852cf04db2
user:      adrianp <adrianp%pkgsrc.org@localhost>
date:      Wed Aug 22 23:23:22 2007 +0000

description:
Fix a bug in the processing of GPG in audit-packages.conf.  This should fix
PR# 36773 opened by David A. Holland.
While we're here look for settings with no values in audit-packages.conf
and ignore them.
Tighten up processing of audit-packages.conf for the situation where
settings are specified multiple times. (report from joerg@).

diffstat:

 pkgtools/pkg_install/files/audit-packages/audit-packages.c |  36 ++++++++++---
 1 files changed, 28 insertions(+), 8 deletions(-)

diffs (78 lines):

diff -r f441ef5823be -r 18852cf04db2 pkgtools/pkg_install/files/audit-packages/audit-packages.c
--- a/pkgtools/pkg_install/files/audit-packages/audit-packages.c        Wed Aug 22 22:49:12 2007 +0000
+++ b/pkgtools/pkg_install/files/audit-packages/audit-packages.c        Wed Aug 22 23:23:22 2007 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: audit-packages.c,v 1.10 2007/08/15 01:49:02 joerg Exp $ */
+/* $NetBSD: audit-packages.c,v 1.11 2007/08/22 23:23:22 adrianp Exp $ */
 
 /*
  * Copyright (c) 2007 Adrian Portelli <adrianp%NetBSD.org@localhost>.
@@ -574,6 +574,7 @@
 clean_conf(char *conf_line)
 {
        int i = 0;
+       size_t len = 0;
        char *token = NULL;
        char *cp;
 
@@ -600,6 +601,13 @@
                }
        }
 
+       len = strlen(token);
+
+       /* look for entries with no associated value */
+       if (len == 0) {
+               token = NULL;
+       }
+
        return token;
 }
 
@@ -611,6 +619,9 @@
        char *line_ptr = NULL;
        char *line = NULL;
        char *retval = NULL;
+       Boolean f_ignore = FALSE;
+       Boolean f_verify_bin = FALSE;
+       Boolean f_set_pvfile = FALSE;
 
        if ((conf = fopen(conf_file, "r")) == NULL) {
                if (verbose >= 2)
@@ -629,20 +640,29 @@
                if ((line[0] == '#') || (line[0] == '\n'))
                        continue;
 
-               if (strncmp(line, "IGNORE_URLS", 11) == 0) {
+               if ((strncmp(line, "IGNORE_URLS", 11) == 0) && 
+                   (f_ignore == FALSE)) {
                        retval = clean_conf(line);
-                       if (retval != NULL)
+                       if (retval != NULL) {
                                ignore = safe_strdup(retval);
+                               f_ignore = TRUE;
+                       }
                }
-               else if (strncmp(line, "GPG", 3) == 0) {
+               else if ((strncmp(line, "GPG", 3) == 0) &&
+                   (f_verify_bin == FALSE)) {
                        retval = clean_conf(line);
-                       if (retval != NULL)
-                               verify_bin = retval;
+                       if (retval != NULL) {
+                               verify_bin = safe_strdup(retval);
+                               f_verify_bin = TRUE;
+                       }
                }
-               else if (strncmp(line, "PKGVULNDIR", 9) == 0) {
+               else if ((strncmp(line, "PKGVULNDIR", 9) == 0) && 
+                   (f_set_pvfile == FALSE)) {
                        retval = clean_conf(line);
-                       if (retval != NULL)
+                       if (retval != NULL) {
                                set_pvfile(retval);
+                               f_set_pvfile = TRUE;
+                       }
                }
 
                retval = NULL;



Home | Main Index | Thread Index | Old Index