Sat Jul 9 17:44:44 2016 UTC ()
Update netpgpverify and libnetpgpverify to 20160709

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


(agc)
diff -r1.7 -r1.8 pkgsrc/security/netpgpverify/files/main.c
diff -r1.34 -r1.35 pkgsrc/security/netpgpverify/files/verify.h

cvs diff -r1.7 -r1.8 pkgsrc/security/netpgpverify/files/main.c (expand / switch to unified diff)

--- pkgsrc/security/netpgpverify/files/main.c 2016/07/05 20:18:03 1.7
+++ pkgsrc/security/netpgpverify/files/main.c 2016/07/09 17:44:44 1.8
@@ -85,56 +85,60 @@ getstdin(ssize_t *cc, size_t *size) @@ -85,56 +85,60 @@ getstdin(ssize_t *cc, size_t *size)
85 return in; 85 return in;
86} 86}
87 87
88/* verify memory or file */ 88/* verify memory or file */
89static int 89static int
90verify_data(pgpv_t *pgp, const char *cmd, const char *inname, char *in, ssize_t cc) 90verify_data(pgpv_t *pgp, const char *cmd, const char *inname, char *in, ssize_t cc)
91{ 91{
92 pgpv_cursor_t *cursor; 92 pgpv_cursor_t *cursor;
93 const char *modifiers; 93 const char *modifiers;
94 size_t size; 94 size_t size;
95 size_t cookie; 95 size_t cookie;
96 char *data; 96 char *data;
97 int el; 97 int el;
 98 int ok;
98 99
99 cursor = pgpv_new_cursor(); 100 cursor = pgpv_new_cursor();
 101 ok = 0;
100 if (strcasecmp(cmd, "cat") == 0) { 102 if (strcasecmp(cmd, "cat") == 0) {
101 if ((cookie = pgpv_verify(cursor, pgp, in, cc)) != 0) { 103 if ((cookie = pgpv_verify(cursor, pgp, in, cc)) != 0) {
102 if ((size = pgpv_get_verified(cursor, cookie, &data)) > 0) { 104 if ((size = pgpv_get_verified(cursor, cookie, &data)) > 0) {
103 write(STDOUT_FILENO, data, size); 105 write(STDOUT_FILENO, data, size);
104 } 106 }
105 return 1; 107 ok = 1;
106 } 108 }
107 } else if (strcasecmp(cmd, "dump") == 0) { 109 } else if (strcasecmp(cmd, "dump") == 0) {
108 if ((cookie = pgpv_verify(cursor, pgp, in, cc)) != 0) { 110 if ((cookie = pgpv_verify(cursor, pgp, in, cc)) != 0) {
109 size = pgpv_dump(pgp, &data); 111 size = pgpv_dump(pgp, &data);
110 write(STDOUT_FILENO, data, size); 112 write(STDOUT_FILENO, data, size);
111 return 1; 113 ok = 1;
112 } 114 }
113 } else if (strcasecmp(cmd, "verify") == 0 || strcasecmp(cmd, "trust") == 0) { 115 } else if (strcasecmp(cmd, "verify") == 0 || strcasecmp(cmd, "trust") == 0) {
114 modifiers = (strcasecmp(cmd, "trust") == 0) ? "trust" : NULL; 116 modifiers = (strcasecmp(cmd, "trust") == 0) ? "trust" : NULL;
115 if (pgpv_verify(cursor, pgp, in, cc)) { 117 if (pgpv_verify(cursor, pgp, in, cc)) {
116 printf("Good signature for %s made ", inname); 118 printf("Good signature for %s made ", inname);
117 ptime(pgpv_get_cursor_num(cursor, "sigtime")); 119 ptime(pgpv_get_cursor_num(cursor, "sigtime"));
118 el = pgpv_get_cursor_element(cursor, 0); 120 el = pgpv_get_cursor_element(cursor, 0);
119 pentry(pgp, el, modifiers); 121 pentry(pgp, el, modifiers);
120 return 1; 122 ok = 1;
 123 } else {
 124 fprintf(stderr, "Signature did not match contents -- %s\n",
 125 pgpv_get_cursor_str(cursor, "why"));
121 } 126 }
122 fprintf(stderr, "Signature did not match contents -- %s\n", 
123 pgpv_get_cursor_str(cursor, "why")); 
124 } else { 127 } else {
125 fprintf(stderr, "unrecognised command \"%s\"\n", cmd); 128 fprintf(stderr, "unrecognised command \"%s\"\n", cmd);
126 } 129 }
127 return 0; 130 pgpv_cursor_close(cursor);
 131 return ok;
128} 132}
129 133
130int 134int
131main(int argc, char **argv) 135main(int argc, char **argv)
132{ 136{
133 const char *keyring; 137 const char *keyring;
134 const char *cmd; 138 const char *cmd;
135 ssize_t cc; 139 ssize_t cc;
136 size_t size; 140 size_t size;
137 pgpv_t *pgp; 141 pgpv_t *pgp;
138 char *in; 142 char *in;
139 int ssh; 143 int ssh;
140 int ok; 144 int ok;

cvs diff -r1.34 -r1.35 pkgsrc/security/netpgpverify/files/verify.h (expand / switch to unified diff)

--- pkgsrc/security/netpgpverify/files/verify.h 2016/07/09 17:18:24 1.34
+++ pkgsrc/security/netpgpverify/files/verify.h 2016/07/09 17:44:44 1.35
@@ -13,29 +13,29 @@ @@ -13,29 +13,29 @@
13 * 13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 16 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 17 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25#ifndef NETPGP_VERIFY_H_ 25#ifndef NETPGP_VERIFY_H_
26#define NETPGP_VERIFY_H_ 20160708 26#define NETPGP_VERIFY_H_ 20160709
27 27
28#define NETPGPVERIFY_VERSION "netpgpverify portable 20160708" 28#define NETPGPVERIFY_VERSION "netpgpverify portable 20160709"
29 29
30#include <sys/types.h> 30#include <sys/types.h>
31 31
32#include <inttypes.h> 32#include <inttypes.h>
33 33
34struct pgpv_t; 34struct pgpv_t;
35typedef struct pgpv_t pgpv_t; 35typedef struct pgpv_t pgpv_t;
36 36
37struct pgpv_cursor_t; 37struct pgpv_cursor_t;
38typedef struct pgpv_cursor_t pgpv_cursor_t; 38typedef struct pgpv_cursor_t pgpv_cursor_t;
39 39
40#ifndef __BEGIN_DECLS 40#ifndef __BEGIN_DECLS
41# if defined(__cplusplus) 41# if defined(__cplusplus)