summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordtucker <dtucker@openbsd.org>2013-05-16 09:12:31 +0000
committerdtucker <dtucker@openbsd.org>2013-05-16 09:12:31 +0000
commitef2ed092f6ba554763d9c493db15b8f9d0cabbb9 (patch)
tree3091020d8678a894d3b65591a0fe3317458bc3fa
parentFix some "unused result" warnings found via clang and -portable. ok markus@ (diff)
downloadwireguard-openbsd-ef2ed092f6ba554763d9c493db15b8f9d0cabbb9.tar.xz
wireguard-openbsd-ef2ed092f6ba554763d9c493db15b8f9d0cabbb9.zip
switch RekeyLimit traffic volume parsing to scan_scaled. ok djm@
-rw-r--r--usr.bin/ssh/readconf.c35
-rw-r--r--usr.bin/ssh/servconf.c35
-rw-r--r--usr.bin/ssh/ssh-keysign/Makefile4
-rw-r--r--usr.bin/ssh/ssh/Makefile4
4 files changed, 18 insertions, 60 deletions
diff --git a/usr.bin/ssh/readconf.c b/usr.bin/ssh/readconf.c
index ef740ece5ef..eb5e64fbda4 100644
--- a/usr.bin/ssh/readconf.c
+++ b/usr.bin/ssh/readconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: readconf.c,v 1.199 2013/05/16 04:27:50 djm Exp $ */
+/* $OpenBSD: readconf.c,v 1.200 2013/05/16 09:12:31 dtucker Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -27,6 +27,7 @@
#include <stdio.h>
#include <string.h>
#include <unistd.h>
+#include <util.h>
#include "xmalloc.h"
#include "ssh.h"
@@ -575,33 +576,11 @@ parse_yesnoask:
if (strcmp(arg, "default") == 0) {
val64 = 0;
} else {
- if (arg[0] < '0' || arg[0] > '9')
- fatal("%.200s line %d: Bad number.", filename,
- linenum);
- orig = val64 = strtoll(arg, &endofnumber, 10);
- if (arg == endofnumber)
- fatal("%.200s line %d: Bad number.", filename,
- linenum);
- switch (toupper(*endofnumber)) {
- case '\0':
- scale = 1;
- break;
- case 'K':
- scale = 1<<10;
- break;
- case 'M':
- scale = 1<<20;
- break;
- case 'G':
- scale = 1<<30;
- break;
- default:
- fatal("%.200s line %d: Invalid RekeyLimit "
- "suffix", filename, linenum);
- }
- val64 *= scale;
- /* detect integer wrap and too-large limits */
- if ((val64 / scale) != orig || val64 > UINT_MAX)
+ if (scan_scaled(arg, &val64) == -1)
+ fatal("%.200s line %d: Bad number '%s': %s",
+ filename, linenum, arg, strerror(errno));
+ /* check for too-large or too-small limits */
+ if (val64 > UINT_MAX)
fatal("%.200s line %d: RekeyLimit too large",
filename, linenum);
if (val64 != 0 && val64 < 16)
diff --git a/usr.bin/ssh/servconf.c b/usr.bin/ssh/servconf.c
index 640eaf06606..88982444308 100644
--- a/usr.bin/ssh/servconf.c
+++ b/usr.bin/ssh/servconf.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: servconf.c,v 1.235 2013/05/16 04:09:14 dtucker Exp $ */
+/* $OpenBSD: servconf.c,v 1.236 2013/05/16 09:12:31 dtucker Exp $ */
/*
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
* All rights reserved
@@ -29,6 +29,7 @@
#include <unistd.h>
#include <stdarg.h>
#include <errno.h>
+#include <util.h>
#include "xmalloc.h"
#include "ssh.h"
@@ -1089,33 +1090,11 @@ process_server_config_line(ServerOptions *options, char *line,
if (strcmp(arg, "default") == 0) {
val64 = 0;
} else {
- if (arg[0] < '0' || arg[0] > '9')
- fatal("%.200s line %d: Bad number.", filename,
- linenum);
- orig = val64 = strtoll(arg, &endofnumber, 10);
- if (arg == endofnumber)
- fatal("%.200s line %d: Bad number.", filename,
- linenum);
- switch (toupper(*endofnumber)) {
- case '\0':
- scale = 1;
- break;
- case 'K':
- scale = 1<<10;
- break;
- case 'M':
- scale = 1<<20;
- break;
- case 'G':
- scale = 1<<30;
- break;
- default:
- fatal("%.200s line %d: Invalid RekeyLimit "
- "suffix", filename, linenum);
- }
- val64 *= scale;
- /* detect integer wrap and too-large limits */
- if ((val64 / scale) != orig || val64 > UINT_MAX)
+ if (scan_scaled(arg, &val64) == -1)
+ fatal("%.200s line %d: Bad number '%s': %s",
+ filename, linenum, arg, strerror(errno));
+ /* check for too-large or too-small limits */
+ if (val64 > UINT_MAX)
fatal("%.200s line %d: RekeyLimit too large",
filename, linenum);
if (val64 != 0 && val64 < 16)
diff --git a/usr.bin/ssh/ssh-keysign/Makefile b/usr.bin/ssh/ssh-keysign/Makefile
index 5ef23ca1e5b..0627c0bf906 100644
--- a/usr.bin/ssh/ssh-keysign/Makefile
+++ b/usr.bin/ssh/ssh-keysign/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.6 2009/05/28 16:50:16 andreas Exp $
+# $OpenBSD: Makefile,v 1.7 2013/05/16 09:12:31 dtucker Exp $
.PATH: ${.CURDIR}/..
@@ -14,5 +14,5 @@ SRCS= ssh-keysign.c readconf.c roaming_dummy.c
.include <bsd.prog.mk>
-LDADD+= -lcrypto -lz
+LDADD+= -lcrypto -lutil -lz
DPADD+= ${LIBCRYPTO} ${LIBZ}
diff --git a/usr.bin/ssh/ssh/Makefile b/usr.bin/ssh/ssh/Makefile
index 08aff14c3dd..4261a7c0b2d 100644
--- a/usr.bin/ssh/ssh/Makefile
+++ b/usr.bin/ssh/ssh/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.56 2012/08/24 19:50:19 deraadt Exp $
+# $OpenBSD: Makefile,v 1.57 2013/05/16 09:12:31 dtucker Exp $
.PATH: ${.CURDIR}/..
@@ -30,4 +30,4 @@ LDADD+= -lgssapi -lkrb5
.endif # KERBEROS5
DPADD+= ${LIBCRYPTO} ${LIBZ}
-LDADD+= -lcrypto -lz
+LDADD+= -lcrypto -lutil -lz