mirror of
https://github.com/PowerShell/openssh-portable.git
synced 2025-07-27 07:44:29 +02:00
- (dtucker) [configure.ac openbsd-compat/Makefile.in openbsd-compat/strtoull.c
openbsd-compat/openbsd-compat.h] Add strtoull to compat library for platforms that don't have it.
This commit is contained in:
parent
62e4edc797
commit
8e6fb780e5
@ -3,6 +3,9 @@
|
|||||||
Iain Morgan
|
Iain Morgan
|
||||||
- (dtucker) [configure.ac openbsd-compat/bsd-misc.c openbsd-compat/bsd-misc.h]
|
- (dtucker) [configure.ac openbsd-compat/bsd-misc.c openbsd-compat/bsd-misc.h]
|
||||||
Use getpgrp() if we don't have getpgid() (old BSDs, maybe others).
|
Use getpgrp() if we don't have getpgid() (old BSDs, maybe others).
|
||||||
|
- (dtucker) [configure.ac openbsd-compat/Makefile.in openbsd-compat/strtoull.c
|
||||||
|
openbsd-compat/openbsd-compat.h] Add strtoull to compat library for
|
||||||
|
platforms that don't have it.
|
||||||
- (djm) OpenBSD CVS Sync
|
- (djm) OpenBSD CVS Sync
|
||||||
- djm@cvs.openbsd.org 2013/02/14 21:35:59
|
- djm@cvs.openbsd.org 2013/02/14 21:35:59
|
||||||
[auth2-pubkey.c]
|
[auth2-pubkey.c]
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# $Id: configure.ac,v 1.504 2013/02/15 00:41:35 dtucker Exp $
|
# $Id: configure.ac,v 1.505 2013/02/15 01:13:01 dtucker Exp $
|
||||||
#
|
#
|
||||||
# Copyright (c) 1999-2004 Damien Miller
|
# Copyright (c) 1999-2004 Damien Miller
|
||||||
#
|
#
|
||||||
@ -15,7 +15,7 @@
|
|||||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
AC_INIT([OpenSSH], [Portable], [openssh-unix-dev@mindrot.org])
|
AC_INIT([OpenSSH], [Portable], [openssh-unix-dev@mindrot.org])
|
||||||
AC_REVISION($Revision: 1.504 $)
|
AC_REVISION($Revision: 1.505 $)
|
||||||
AC_CONFIG_SRCDIR([ssh.c])
|
AC_CONFIG_SRCDIR([ssh.c])
|
||||||
AC_LANG([C])
|
AC_LANG([C])
|
||||||
|
|
||||||
@ -1611,6 +1611,7 @@ AC_CHECK_FUNCS([ \
|
|||||||
strtonum \
|
strtonum \
|
||||||
strtoll \
|
strtoll \
|
||||||
strtoul \
|
strtoul \
|
||||||
|
strtoull \
|
||||||
swap32 \
|
swap32 \
|
||||||
sysconf \
|
sysconf \
|
||||||
tcgetpgrp \
|
tcgetpgrp \
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# $Id: Makefile.in,v 1.49 2012/11/05 06:04:37 dtucker Exp $
|
# $Id: Makefile.in,v 1.50 2013/02/15 01:13:02 dtucker Exp $
|
||||||
|
|
||||||
sysconfdir=@sysconfdir@
|
sysconfdir=@sysconfdir@
|
||||||
piddir=@piddir@
|
piddir=@piddir@
|
||||||
@ -16,7 +16,7 @@ RANLIB=@RANLIB@
|
|||||||
INSTALL=@INSTALL@
|
INSTALL=@INSTALL@
|
||||||
LDFLAGS=-L. @LDFLAGS@
|
LDFLAGS=-L. @LDFLAGS@
|
||||||
|
|
||||||
OPENBSD=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
|
OPENBSD=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
|
||||||
|
|
||||||
COMPAT=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
|
COMPAT=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
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Id: openbsd-compat.h,v 1.53 2012/11/05 06:04:38 dtucker Exp $ */
|
/* $Id: openbsd-compat.h,v 1.54 2013/02/15 01:13:02 dtucker Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1999-2003 Damien Miller. All rights reserved.
|
* Copyright (c) 1999-2003 Damien Miller. All rights reserved.
|
||||||
@ -218,6 +218,10 @@ char *group_from_gid(gid_t, int);
|
|||||||
int timingsafe_bcmp(const void *, const void *, size_t);
|
int timingsafe_bcmp(const void *, const void *, size_t);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef HAVE_STRTOULL
|
||||||
|
unsigned long long strtoull(const char *, char **, int);
|
||||||
|
#endif
|
||||||
|
|
||||||
void *xmmap(size_t size);
|
void *xmmap(size_t size);
|
||||||
char *xcrypt(const char *password, const char *salt);
|
char *xcrypt(const char *password, const char *salt);
|
||||||
char *shadow_pw(struct passwd *pw);
|
char *shadow_pw(struct passwd *pw);
|
||||||
|
110
openbsd-compat/strtoull.c
Normal file
110
openbsd-compat/strtoull.c
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
/* $OpenBSD: strtoull.c,v 1.5 2005/08/08 08:05:37 espie Exp $ */
|
||||||
|
/*-
|
||||||
|
* Copyright (c) 1992 The Regents of the University of California.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* 3. Neither the name of the University nor the names of its contributors
|
||||||
|
* may be used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* OPENBSD ORIGINAL: lib/libc/stdlib/strtoull.c */
|
||||||
|
|
||||||
|
#include "includes.h"
|
||||||
|
#ifndef HAVE_STRTOULL
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <limits.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Convert a string to an unsigned long long.
|
||||||
|
*
|
||||||
|
* Ignores `locale' stuff. Assumes that the upper and lower case
|
||||||
|
* alphabets and digits are each contiguous.
|
||||||
|
*/
|
||||||
|
unsigned long long
|
||||||
|
strtoull(const char *nptr, char **endptr, int base)
|
||||||
|
{
|
||||||
|
const char *s;
|
||||||
|
unsigned long long acc, cutoff;
|
||||||
|
int c;
|
||||||
|
int neg, any, cutlim;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* See strtoq for comments as to the logic used.
|
||||||
|
*/
|
||||||
|
s = nptr;
|
||||||
|
do {
|
||||||
|
c = (unsigned char) *s++;
|
||||||
|
} while (isspace(c));
|
||||||
|
if (c == '-') {
|
||||||
|
neg = 1;
|
||||||
|
c = *s++;
|
||||||
|
} else {
|
||||||
|
neg = 0;
|
||||||
|
if (c == '+')
|
||||||
|
c = *s++;
|
||||||
|
}
|
||||||
|
if ((base == 0 || base == 16) &&
|
||||||
|
c == '0' && (*s == 'x' || *s == 'X')) {
|
||||||
|
c = s[1];
|
||||||
|
s += 2;
|
||||||
|
base = 16;
|
||||||
|
}
|
||||||
|
if (base == 0)
|
||||||
|
base = c == '0' ? 8 : 10;
|
||||||
|
|
||||||
|
cutoff = ULLONG_MAX / (unsigned long long)base;
|
||||||
|
cutlim = ULLONG_MAX % (unsigned long long)base;
|
||||||
|
for (acc = 0, any = 0;; c = (unsigned char) *s++) {
|
||||||
|
if (isdigit(c))
|
||||||
|
c -= '0';
|
||||||
|
else if (isalpha(c))
|
||||||
|
c -= isupper(c) ? 'A' - 10 : 'a' - 10;
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
if (c >= base)
|
||||||
|
break;
|
||||||
|
if (any < 0)
|
||||||
|
continue;
|
||||||
|
if (acc > cutoff || (acc == cutoff && c > cutlim)) {
|
||||||
|
any = -1;
|
||||||
|
acc = ULLONG_MAX;
|
||||||
|
errno = ERANGE;
|
||||||
|
} else {
|
||||||
|
any = 1;
|
||||||
|
acc *= (unsigned long long)base;
|
||||||
|
acc += c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (neg && any > 0)
|
||||||
|
acc = -acc;
|
||||||
|
if (endptr != 0)
|
||||||
|
*endptr = (char *) (any ? s - 1 : nptr);
|
||||||
|
return (acc);
|
||||||
|
}
|
||||||
|
#endif /* !HAVE_STRTOULL */
|
Loading…
x
Reference in New Issue
Block a user