summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--configure.ac5
-rw-r--r--openbsd-compat/Makefile.in4
-rw-r--r--openbsd-compat/openbsd-compat.h6
-rw-r--r--openbsd-compat/strtoull.c110
5 files changed, 123 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index b4abe75fc..0a5c5059d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,9 @@
3 Iain Morgan 3 Iain Morgan
4 - (dtucker) [configure.ac openbsd-compat/bsd-misc.c openbsd-compat/bsd-misc.h] 4 - (dtucker) [configure.ac openbsd-compat/bsd-misc.c openbsd-compat/bsd-misc.h]
5 Use getpgrp() if we don't have getpgid() (old BSDs, maybe others). 5 Use getpgrp() if we don't have getpgid() (old BSDs, maybe others).
6 - (dtucker) [configure.ac openbsd-compat/Makefile.in openbsd-compat/strtoull.c
7 openbsd-compat/openbsd-compat.h] Add strtoull to compat library for
8 platforms that don't have it.
6 - (djm) OpenBSD CVS Sync 9 - (djm) OpenBSD CVS Sync
7 - djm@cvs.openbsd.org 2013/02/14 21:35:59 10 - djm@cvs.openbsd.org 2013/02/14 21:35:59
8 [auth2-pubkey.c] 11 [auth2-pubkey.c]
diff --git a/configure.ac b/configure.ac
index def34fa0b..d62323d97 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
1# $Id: configure.ac,v 1.504 2013/02/15 00:41:35 dtucker Exp $ 1# $Id: configure.ac,v 1.505 2013/02/15 01:13:01 dtucker Exp $
2# 2#
3# Copyright (c) 1999-2004 Damien Miller 3# Copyright (c) 1999-2004 Damien Miller
4# 4#
@@ -15,7 +15,7 @@
15# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 16
17AC_INIT([OpenSSH], [Portable], [openssh-unix-dev@mindrot.org]) 17AC_INIT([OpenSSH], [Portable], [openssh-unix-dev@mindrot.org])
18AC_REVISION($Revision: 1.504 $) 18AC_REVISION($Revision: 1.505 $)
19AC_CONFIG_SRCDIR([ssh.c]) 19AC_CONFIG_SRCDIR([ssh.c])
20AC_LANG([C]) 20AC_LANG([C])
21 21
@@ -1611,6 +1611,7 @@ AC_CHECK_FUNCS([ \
1611 strtonum \ 1611 strtonum \
1612 strtoll \ 1612 strtoll \
1613 strtoul \ 1613 strtoul \
1614 strtoull \
1614 swap32 \ 1615 swap32 \
1615 sysconf \ 1616 sysconf \
1616 tcgetpgrp \ 1617 tcgetpgrp \
diff --git a/openbsd-compat/Makefile.in b/openbsd-compat/Makefile.in
index 992b9743b..e1c3651e8 100644
--- a/openbsd-compat/Makefile.in
+++ b/openbsd-compat/Makefile.in
@@ -1,4 +1,4 @@
1# $Id: Makefile.in,v 1.49 2012/11/05 06:04:37 dtucker Exp $ 1# $Id: Makefile.in,v 1.50 2013/02/15 01:13:02 dtucker Exp $
2 2
3sysconfdir=@sysconfdir@ 3sysconfdir=@sysconfdir@
4piddir=@piddir@ 4piddir=@piddir@
@@ -16,7 +16,7 @@ RANLIB=@RANLIB@
16INSTALL=@INSTALL@ 16INSTALL=@INSTALL@
17LDFLAGS=-L. @LDFLAGS@ 17LDFLAGS=-L. @LDFLAGS@
18 18
19OPENBSD=base64.o basename.o bindresvport.o daemon.o dirname.o fmt_scaled.o getcwd.o getgrouplist.o getopt.o getrrsetbyname.o glob.o inet_aton.o inet_ntoa.o inet_ntop.o mktemp.o pwcache.o readpassphrase.o realpath.o rresvport.o setenv.o setproctitle.o sha2.o sigact.o strlcat.o strlcpy.o strmode.o strnlen.o strptime.o strsep.o strtonum.o strtoll.o strtoul.o timingsafe_bcmp.o vis.o 19OPENBSD=base64.o basename.o bindresvport.o daemon.o dirname.o fmt_scaled.o getcwd.o getgrouplist.o getopt.o getrrsetbyname.o glob.o inet_aton.o inet_ntoa.o inet_ntop.o mktemp.o pwcache.o readpassphrase.o realpath.o rresvport.o setenv.o setproctitle.o sha2.o sigact.o strlcat.o strlcpy.o strmode.o strnlen.o strptime.o strsep.o strtonum.o strtoll.o strtoul.o strtoull.o timingsafe_bcmp.o vis.o
20 20
21COMPAT=bsd-arc4random.o bsd-asprintf.o bsd-closefrom.o bsd-cray.o bsd-cygwin_util.o bsd-getpeereid.o getrrsetbyname-ldns.o bsd-misc.o bsd-nextstep.o bsd-openpty.o bsd-poll.o bsd-setres_id.o bsd-snprintf.o bsd-statvfs.o bsd-waitpid.o fake-rfc2553.o openssl-compat.o xmmap.o xcrypt.o 21COMPAT=bsd-arc4random.o bsd-asprintf.o bsd-closefrom.o bsd-cray.o bsd-cygwin_util.o bsd-getpeereid.o getrrsetbyname-ldns.o bsd-misc.o bsd-nextstep.o bsd-openpty.o bsd-poll.o bsd-setres_id.o bsd-snprintf.o bsd-statvfs.o bsd-waitpid.o fake-rfc2553.o openssl-compat.o xmmap.o xcrypt.o
22 22
diff --git a/openbsd-compat/openbsd-compat.h b/openbsd-compat/openbsd-compat.h
index 664cb0445..99cebef71 100644
--- a/openbsd-compat/openbsd-compat.h
+++ b/openbsd-compat/openbsd-compat.h
@@ -1,4 +1,4 @@
1/* $Id: openbsd-compat.h,v 1.53 2012/11/05 06:04:38 dtucker Exp $ */ 1/* $Id: openbsd-compat.h,v 1.54 2013/02/15 01:13:02 dtucker Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1999-2003 Damien Miller. All rights reserved. 4 * Copyright (c) 1999-2003 Damien Miller. All rights reserved.
@@ -218,6 +218,10 @@ char *group_from_gid(gid_t, int);
218int timingsafe_bcmp(const void *, const void *, size_t); 218int timingsafe_bcmp(const void *, const void *, size_t);
219#endif 219#endif
220 220
221#ifndef HAVE_STRTOULL
222unsigned long long strtoull(const char *, char **, int);
223#endif
224
221void *xmmap(size_t size); 225void *xmmap(size_t size);
222char *xcrypt(const char *password, const char *salt); 226char *xcrypt(const char *password, const char *salt);
223char *shadow_pw(struct passwd *pw); 227char *shadow_pw(struct passwd *pw);
diff --git a/openbsd-compat/strtoull.c b/openbsd-compat/strtoull.c
new file mode 100644
index 000000000..f7c818c52
--- /dev/null
+++ b/openbsd-compat/strtoull.c
@@ -0,0 +1,110 @@
1/* $OpenBSD: strtoull.c,v 1.5 2005/08/08 08:05:37 espie Exp $ */
2/*-
3 * Copyright (c) 1992 The Regents of the University of California.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. Neither the name of the University nor the names of its contributors
15 * may be used to endorse or promote products derived from this software
16 * without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 */
30
31/* OPENBSD ORIGINAL: lib/libc/stdlib/strtoull.c */
32
33#include "includes.h"
34#ifndef HAVE_STRTOULL
35
36#include <sys/types.h>
37
38#include <ctype.h>
39#include <errno.h>
40#include <limits.h>
41#include <stdlib.h>
42
43/*
44 * Convert a string to an unsigned long long.
45 *
46 * Ignores `locale' stuff. Assumes that the upper and lower case
47 * alphabets and digits are each contiguous.
48 */
49unsigned long long
50strtoull(const char *nptr, char **endptr, int base)
51{
52 const char *s;
53 unsigned long long acc, cutoff;
54 int c;
55 int neg, any, cutlim;
56
57 /*
58 * See strtoq for comments as to the logic used.
59 */
60 s = nptr;
61 do {
62 c = (unsigned char) *s++;
63 } while (isspace(c));
64 if (c == '-') {
65 neg = 1;
66 c = *s++;
67 } else {
68 neg = 0;
69 if (c == '+')
70 c = *s++;
71 }
72 if ((base == 0 || base == 16) &&
73 c == '0' && (*s == 'x' || *s == 'X')) {
74 c = s[1];
75 s += 2;
76 base = 16;
77 }
78 if (base == 0)
79 base = c == '0' ? 8 : 10;
80
81 cutoff = ULLONG_MAX / (unsigned long long)base;
82 cutlim = ULLONG_MAX % (unsigned long long)base;
83 for (acc = 0, any = 0;; c = (unsigned char) *s++) {
84 if (isdigit(c))
85 c -= '0';
86 else if (isalpha(c))
87 c -= isupper(c) ? 'A' - 10 : 'a' - 10;
88 else
89 break;
90 if (c >= base)
91 break;
92 if (any < 0)
93 continue;
94 if (acc > cutoff || (acc == cutoff && c > cutlim)) {
95 any = -1;
96 acc = ULLONG_MAX;
97 errno = ERANGE;
98 } else {
99 any = 1;
100 acc *= (unsigned long long)base;
101 acc += c;
102 }
103 }
104 if (neg && any > 0)
105 acc = -acc;
106 if (endptr != 0)
107 *endptr = (char *) (any ? s - 1 : nptr);
108 return (acc);
109}
110#endif /* !HAVE_STRTOULL */