CVS commit: src/lib/libresolv

2018-12-13 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Thu Dec 13 08:39:34 UTC 2018

Modified Files:
src/lib/libresolv: ns_date.c

Log Message:
Remove unused macro.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libresolv/ns_date.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libresolv/ns_date.c
diff -u src/lib/libresolv/ns_date.c:1.1 src/lib/libresolv/ns_date.c:1.2
--- src/lib/libresolv/ns_date.c:1.1	Thu Nov 15 18:48:48 2012
+++ src/lib/libresolv/ns_date.c	Thu Dec 13 08:39:34 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ns_date.c,v 1.1 2012/11/15 18:48:48 christos Exp $	*/
+/*	$NetBSD: ns_date.c,v 1.2 2018/12/13 08:39:34 maya Exp $	*/
 
 /*
  * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
@@ -21,7 +21,7 @@
 #if 0
 static const char rcsid[] = "Id: ns_date.c,v 1.6 2005/04/27 04:56:39 sra Exp ";
 #else
-__RCSID("$NetBSD: ns_date.c,v 1.1 2012/11/15 18:48:48 christos Exp $");
+__RCSID("$NetBSD: ns_date.c,v 1.2 2018/12/13 08:39:34 maya Exp $");
 #endif
 
 /* Import. */
@@ -38,12 +38,6 @@ __RCSID("$NetBSD: ns_date.c,v 1.1 2012/1
 
 #include "port_after.h"
 
-#ifdef SPRINTF_CHAR
-# define SPRINTF(x) strlen(sprintf/**/x)
-#else
-# define SPRINTF(x) ((size_t)sprintf x)
-#endif
-
 /* Forward. */
 
 static int	datepart(const char *, int, int, int, int *);



CVS commit: src/lib/libresolv

2016-03-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar  7 14:35:39 UTC 2016

Modified Files:
src/lib/libresolv: hmac_link.c

Log Message:
PR/50907: David Binderman: Remove useless strlen()'s and memcpy()'s.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libresolv/hmac_link.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libresolv/hmac_link.c
diff -u src/lib/libresolv/hmac_link.c:1.2 src/lib/libresolv/hmac_link.c:1.3
--- src/lib/libresolv/hmac_link.c:1.2	Thu Nov 15 21:16:38 2012
+++ src/lib/libresolv/hmac_link.c	Mon Mar  7 09:35:39 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: hmac_link.c,v 1.2 2012/11/16 02:16:38 christos Exp $	*/
+/*	$NetBSD: hmac_link.c,v 1.3 2016/03/07 14:35:39 christos Exp $	*/
 
 /*
  * Portions Copyright (c) 1995-1998 by Trusted Information Systems, Inc.
@@ -20,7 +20,7 @@
 #if 0
 static const char rcsid[] = "Header: /proj/cvs/prod/libbind/dst/hmac_link.c,v 1.8 2007/09/24 17:18:25 each Exp ";
 #else
-__RCSID("$NetBSD: hmac_link.c,v 1.2 2012/11/16 02:16:38 christos Exp $");
+__RCSID("$NetBSD: hmac_link.c,v 1.3 2016/03/07 14:35:39 christos Exp $");
 #endif
 
 /*%
@@ -268,48 +268,48 @@ dst_hmac_md5_key_to_file_format(const DS
 			const int buff_len)
 {
 	char *bp;
-	int len, i, key_len;
+#define BUF_LEFT (size_t)(buff_len - (bp - buff))
+	int len, key_len;
 	u_char key[HMAC_LEN];
 	HMAC_Key *hkey;
+	static const char keystr[] = "Key: ";
+
+	if (buff == NULL)
+		return -1;	/*%< no output area */
 
 	if (dkey == NULL || dkey->dk_KEY_struct == NULL) 
-		return (0);
-	/*
-	 * Using snprintf() would be so much simpler here.
-	 */
-	if (buff == NULL ||
-	buff_len <= (int)(strlen(KEY_FILE_FMT_STR) +
-			  strlen(KEY_FILE_FORMAT) + 4))
-		return (-1);	/*%< no OR not enough space in output area */
-	hkey = (HMAC_Key *) dkey->dk_KEY_struct;
-	memset(buff, 0, buff_len);	/*%< just in case */
+		return 0;
+
 	/* write file header */
-	snprintf(buff, buff_len, KEY_FILE_FMT_STR, KEY_FILE_FORMAT,
+	hkey = (HMAC_Key *) dkey->dk_KEY_struct;
+	len = snprintf(buff, buff_len, KEY_FILE_FMT_STR, KEY_FILE_FORMAT,
 	KEY_HMAC_MD5, "HMAC");
-
-	bp = buff + strlen(buff);
-
-	memset(key, 0, HMAC_LEN);
-	for (i = 0; i < HMAC_LEN; i++)
-		key[i] = hkey->hk_ipad[i] ^ HMAC_IPAD;
-	for (i = HMAC_LEN - 1; i >= 0; i--)
-		if (key[i] != 0)
+	if (len < 0 || len >= buff_len)
+		return -1; 	/*%< not enough space in output area */
+	bp = buff + len;
+	if (BUF_LEFT < sizeof(keystr))
+		return -1;
+
+	memcpy(bp, keystr, sizeof(keystr) - 1);
+	bp += sizeof(keystr) - 1;
+
+	for (key_len = 0; key_len < HMAC_LEN; key_len++)
+		key[key_len] = hkey->hk_ipad[key_len] ^ HMAC_IPAD;
+	for (key_len = HMAC_LEN - 1; key_len >= 0; key_len--)
+		if (key[key_len] != 0)
 			break;
-	key_len = i + 1;
+	key_len++;
 
-	if (buff_len - (bp - buff) < 6)
-		return (-1);
-	strcat(bp, "Key: ");
-	bp += strlen("Key: ");
-
-	len = b64_ntop(key, key_len, bp, (size_t)(buff_len - (bp - buff)));
+	len = b64_ntop(key, key_len, bp, BUF_LEFT);
 	if (len < 0) 
-		return (-1);
+		return -1;
 	bp += len;
-	if (buff_len - (bp - buff) < 2)
-		return (-1);
+
+	if (BUF_LEFT < 2)
+		return -1;
 	*(bp++) = '\n';
-	*bp = '\0';
+
+	memset(bp, 0, BUF_LEFT);
 
 	return (int)(bp - buff);
 }



CVS commit: src/lib/libresolv

2013-09-13 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri Sep 13 19:29:47 UTC 2013

Modified Files:
src/lib/libresolv: ns_verify.c

Log Message:
Use __RCSID.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libresolv/ns_verify.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libresolv/ns_verify.c
diff -u src/lib/libresolv/ns_verify.c:1.2 src/lib/libresolv/ns_verify.c:1.3
--- src/lib/libresolv/ns_verify.c:1.2	Fri Nov 16 02:16:38 2012
+++ src/lib/libresolv/ns_verify.c	Fri Sep 13 19:29:47 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: ns_verify.c,v 1.2 2012/11/16 02:16:38 christos Exp $	*/
+/*	$NetBSD: ns_verify.c,v 1.3 2013/09/13 19:29:47 joerg Exp $	*/
 
 /*
  * Copyright (c) 2004 by Internet Systems Consortium, Inc. (ISC)
@@ -17,9 +17,8 @@
  * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#ifndef lint
-static const char rcsid[] = Id: ns_verify.c,v 1.5 2006/03/09 23:57:56 marka Exp ;
-#endif
+#include sys/cdefs.h
+__RCSID(Id: ns_verify.c,v 1.5 2006/03/09 23:57:56 marka Exp );
 
 /* Import. */
 



CVS commit: src/lib/libresolv

2012-11-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Nov 19 13:45:01 UTC 2012

Modified Files:
src/lib/libresolv: res_mkupdate.c

Log Message:
Add void between the parenthesis. Why only vax complains? From martin.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libresolv/res_mkupdate.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libresolv/res_mkupdate.c
diff -u src/lib/libresolv/res_mkupdate.c:1.1 src/lib/libresolv/res_mkupdate.c:1.2
--- src/lib/libresolv/res_mkupdate.c:1.1	Thu Nov 15 13:48:48 2012
+++ src/lib/libresolv/res_mkupdate.c	Mon Nov 19 08:45:00 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: res_mkupdate.c,v 1.1 2012/11/15 18:48:48 christos Exp $	*/
+/*	$NetBSD: res_mkupdate.c,v 1.2 2012/11/19 13:45:00 christos Exp $	*/
 
 /*
  * Copyright (c) 2004 by Internet Systems Consortium, Inc. (ISC)
@@ -26,7 +26,7 @@
 #if 0
 static const char rcsid[] = Id: res_mkupdate.c,v 1.10 2008/12/11 09:59:00 marka Exp ;
 #else
-__RCSID($NetBSD: res_mkupdate.c,v 1.1 2012/11/15 18:48:48 christos Exp $);
+__RCSID($NetBSD: res_mkupdate.c,v 1.2 2012/11/19 13:45:00 christos Exp $);
 #endif
 
 #include port_before.h
@@ -992,7 +992,7 @@ res_buildservicelist(void) {
 }
 
 void
-res_destroyservicelist() {
+res_destroyservicelist(void) {
 	struct valuelist *slp, *slp_next;
 
 	for (slp = servicelist; slp != NULL; slp = slp_next) {



CVS commit: src/lib/libresolv

2012-11-15 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri Nov 16 02:10:27 UTC 2012

Modified Files:
src/lib/libresolv: dst_api.c

Log Message:
SAFE_FREE sets key_st to NULL, so use that explicitly.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libresolv/dst_api.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libresolv/dst_api.c
diff -u src/lib/libresolv/dst_api.c:1.1 src/lib/libresolv/dst_api.c:1.2
--- src/lib/libresolv/dst_api.c:1.1	Thu Nov 15 18:48:48 2012
+++ src/lib/libresolv/dst_api.c	Fri Nov 16 02:10:26 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: dst_api.c,v 1.1 2012/11/15 18:48:48 christos Exp $	*/
+/*	$NetBSD: dst_api.c,v 1.2 2012/11/16 02:10:26 joerg Exp $	*/
 
 /*
  * Portions Copyright (c) 1995-1998 by Trusted Information Systems, Inc.
@@ -40,7 +40,7 @@
 #if 0
 static const char rcsid[] = Header: /proj/cvs/prod/libbind/dst/dst_api.c,v 1.17 2007/09/24 17:18:25 each Exp ;
 #else
-__RCSID($NetBSD: dst_api.c,v 1.1 2012/11/15 18:48:48 christos Exp $);
+__RCSID($NetBSD: dst_api.c,v 1.2 2012/11/16 02:10:26 joerg Exp $);
 #endif
 
 
@@ -691,7 +691,7 @@ dst_dnskey_to_key(const char *in_name, c
 			 alg));
 
 	SAFE_FREE(key_st);
-	return (key_st);
+	return (NULL);
 }
 
 /*%



CVS commit: src/lib/libresolv

2012-11-15 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri Nov 16 02:11:05 UTC 2012

Modified Files:
src/lib/libresolv: dst_internal.h

Log Message:
Use the size of the object pointed to, not the size of the pointer.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libresolv/dst_internal.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libresolv/dst_internal.h
diff -u src/lib/libresolv/dst_internal.h:1.1 src/lib/libresolv/dst_internal.h:1.2
--- src/lib/libresolv/dst_internal.h:1.1	Thu Nov 15 18:48:48 2012
+++ src/lib/libresolv/dst_internal.h	Fri Nov 16 02:11:05 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: dst_internal.h,v 1.1 2012/11/15 18:48:48 christos Exp $	*/
+/*	$NetBSD: dst_internal.h,v 1.2 2012/11/16 02:11:05 joerg Exp $	*/
 
 #ifndef DST_INTERNAL_H
 #define DST_INTERNAL_H
@@ -83,7 +83,7 @@ typedef struct dst_key {
 #endif
 
 #ifndef SAFE_FREE
-#define SAFE_FREE(a) SAFE_FREE2((a), sizeof(a))
+#define SAFE_FREE(a) SAFE_FREE2((a), sizeof(*(a)))
 #endif
 
 typedef struct dst_func {



CVS commit: src/lib/libresolv

2012-11-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Nov 16 02:16:38 UTC 2012

Modified Files:
src/lib/libresolv: dst_api.c hmac_link.c ns_verify.c

Log Message:
fix lint


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libresolv/dst_api.c
cvs rdiff -u -r1.1 -r1.2 src/lib/libresolv/hmac_link.c \
src/lib/libresolv/ns_verify.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libresolv/dst_api.c
diff -u src/lib/libresolv/dst_api.c:1.2 src/lib/libresolv/dst_api.c:1.3
--- src/lib/libresolv/dst_api.c:1.2	Thu Nov 15 21:10:26 2012
+++ src/lib/libresolv/dst_api.c	Thu Nov 15 21:16:38 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: dst_api.c,v 1.2 2012/11/16 02:10:26 joerg Exp $	*/
+/*	$NetBSD: dst_api.c,v 1.3 2012/11/16 02:16:38 christos Exp $	*/
 
 /*
  * Portions Copyright (c) 1995-1998 by Trusted Information Systems, Inc.
@@ -40,7 +40,7 @@
 #if 0
 static const char rcsid[] = Header: /proj/cvs/prod/libbind/dst/dst_api.c,v 1.17 2007/09/24 17:18:25 each Exp ;
 #else
-__RCSID($NetBSD: dst_api.c,v 1.2 2012/11/16 02:10:26 joerg Exp $);
+__RCSID($NetBSD: dst_api.c,v 1.3 2012/11/16 02:16:38 christos Exp $);
 #endif
 
 
@@ -437,10 +437,11 @@ dst_s_write_private_key(const DST_KEY *k
 	/* Do not overwrite an existing file */
 	if ((fp = dst_s_fopen(file, w, 0600)) != NULL) {
 		ssize_t nn;
-		/*LINTED*/
-		if ((nn = fwrite(encoded_block, 1, len, fp)) != len) {
+		nn = fwrite(encoded_block, 1, len, fp);
+		if (nn != len) {
 			EREPORT((%s: Write failure on %s %d != %zd
 			 errno=%d\n, __func__, file, len, nn, errno));
+
 			fclose(fp);
 			return (-5);
 		}

Index: src/lib/libresolv/hmac_link.c
diff -u src/lib/libresolv/hmac_link.c:1.1 src/lib/libresolv/hmac_link.c:1.2
--- src/lib/libresolv/hmac_link.c:1.1	Thu Nov 15 13:48:48 2012
+++ src/lib/libresolv/hmac_link.c	Thu Nov 15 21:16:38 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: hmac_link.c,v 1.1 2012/11/15 18:48:48 christos Exp $	*/
+/*	$NetBSD: hmac_link.c,v 1.2 2012/11/16 02:16:38 christos Exp $	*/
 
 /*
  * Portions Copyright (c) 1995-1998 by Trusted Information Systems, Inc.
@@ -20,7 +20,7 @@
 #if 0
 static const char rcsid[] = Header: /proj/cvs/prod/libbind/dst/hmac_link.c,v 1.8 2007/09/24 17:18:25 each Exp ;
 #else
-__RCSID($NetBSD: hmac_link.c,v 1.1 2012/11/15 18:48:48 christos Exp $);
+__RCSID($NetBSD: hmac_link.c,v 1.2 2012/11/16 02:16:38 christos Exp $);
 #endif
 
 /*%
@@ -103,7 +103,7 @@ dst_hmac_md5_sign(const int mode, DST_KE
 	}
 
 	if ((mode  SIG_MODE_UPDATE)  (data  len  0))
-		MD5Update(ctx, data, len);
+		MD5Update(ctx, data, (unsigned int)len);
 
 	if (mode  SIG_MODE_FINAL) {
 		if (signature == NULL || sig_len  MD5_LEN)
Index: src/lib/libresolv/ns_verify.c
diff -u src/lib/libresolv/ns_verify.c:1.1 src/lib/libresolv/ns_verify.c:1.2
--- src/lib/libresolv/ns_verify.c:1.1	Thu Nov 15 13:48:48 2012
+++ src/lib/libresolv/ns_verify.c	Thu Nov 15 21:16:38 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ns_verify.c,v 1.1 2012/11/15 18:48:48 christos Exp $	*/
+/*	$NetBSD: ns_verify.c,v 1.2 2012/11/16 02:16:38 christos Exp $	*/
 
 /*
  * Copyright (c) 2004 by Internet Systems Consortium, Inc. (ISC)
@@ -461,7 +461,7 @@ ns_verify_tcp(u_char *msg, int *msglen, 
 			buf, (int)(cp2 - buf), NULL, 0);
 
 	n = dst_verify_data(SIG_MODE_FINAL, state-key, state-ctx, NULL, 0,
-			sigstart, sigfieldlen);
+			sigstart, (int)sigfieldlen);
 	if (n  0)
 		return (-ns_r_badsig);