pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/security/netpgpverify/files Update netpgpverify and li...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/1951b7ef84b6
branches:  trunk
changeset: 349534:1951b7ef84b6
user:      agc <agc%pkgsrc.org@localhost>
date:      Sat Jul 09 17:44:44 2016 +0000

description:
Update netpgpverify and libnetpgpverify to 20160709

+ free resources associated with the cursor when verifying,
gets rid of 2 more loss records under valgrind.

diffstat:

 security/netpgpverify/files/main.c   |  16 ++++++++++------
 security/netpgpverify/files/verify.h |   4 ++--
 2 files changed, 12 insertions(+), 8 deletions(-)

diffs (64 lines):

diff -r 4cdcbade3ce8 -r 1951b7ef84b6 security/netpgpverify/files/main.c
--- a/security/netpgpverify/files/main.c        Sat Jul 09 17:20:17 2016 +0000
+++ b/security/netpgpverify/files/main.c        Sat Jul 09 17:44:44 2016 +0000
@@ -95,20 +95,22 @@
        size_t           cookie;
        char            *data;
        int              el;
+       int              ok;
 
        cursor = pgpv_new_cursor();
+       ok = 0;
        if (strcasecmp(cmd, "cat") == 0) {
                if ((cookie = pgpv_verify(cursor, pgp, in, cc)) != 0) {
                        if ((size = pgpv_get_verified(cursor, cookie, &data)) > 0) {
                                write(STDOUT_FILENO, data, size);
                        }
-                       return 1;
+                       ok = 1;
                }
        } else if (strcasecmp(cmd, "dump") == 0) {
                if ((cookie = pgpv_verify(cursor, pgp, in, cc)) != 0) {
                        size = pgpv_dump(pgp, &data);
                        write(STDOUT_FILENO, data, size);
-                       return 1;
+                       ok = 1;
                }
        } else if (strcasecmp(cmd, "verify") == 0 || strcasecmp(cmd, "trust") == 0) {
                modifiers = (strcasecmp(cmd, "trust") == 0) ? "trust" : NULL;
@@ -117,14 +119,16 @@
                        ptime(pgpv_get_cursor_num(cursor, "sigtime"));
                        el = pgpv_get_cursor_element(cursor, 0);
                        pentry(pgp, el, modifiers);
-                       return 1;
+                       ok = 1;
+               } else {
+                       fprintf(stderr, "Signature did not match contents -- %s\n",
+                               pgpv_get_cursor_str(cursor, "why"));
                }
-               fprintf(stderr, "Signature did not match contents -- %s\n",
-                       pgpv_get_cursor_str(cursor, "why"));
        } else {
                fprintf(stderr, "unrecognised command \"%s\"\n", cmd);
        }
-       return 0;
+       pgpv_cursor_close(cursor);
+       return ok;
 }
 
 int
diff -r 4cdcbade3ce8 -r 1951b7ef84b6 security/netpgpverify/files/verify.h
--- a/security/netpgpverify/files/verify.h      Sat Jul 09 17:20:17 2016 +0000
+++ b/security/netpgpverify/files/verify.h      Sat Jul 09 17:44:44 2016 +0000
@@ -23,9 +23,9 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 #ifndef NETPGP_VERIFY_H_
-#define NETPGP_VERIFY_H_       20160708
+#define NETPGP_VERIFY_H_       20160709
 
-#define NETPGPVERIFY_VERSION   "netpgpverify portable 20160708"
+#define NETPGPVERIFY_VERSION   "netpgpverify portable 20160709"
 
 #include <sys/types.h>
 



Home | Main Index | Thread Index | Old Index