]> andersk Git - openssh.git/commitdiff
- Added OpenBSD bsd-strlcat.c, created bsd-strlcat.h
authordamien <damien>
Mon, 22 Nov 1999 02:57:07 +0000 (02:57 +0000)
committerdamien <damien>
Mon, 22 Nov 1999 02:57:07 +0000 (02:57 +0000)
 - Added timersum() macro
 - Tidy RCSIDs of bsd-*.c

ChangeLog
Makefile.in
acconfig.h
bsd-login.c
bsd-strlcat.c [new file with mode: 0644]
bsd-strlcat.h [new file with mode: 0644]
configure.in
includes.h

index 98033171127f9d52272bf04070c402b164cd23b8..4c016a32b19287c0a64d185ff18776d17adc4342 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,9 @@
      don't create ~/.ssh only if the user wants to store the private 
      key there. show fingerprint instead of public-key after 
      keygeneration. ok niels@
+ - Added OpenBSD bsd-strlcat.c, created bsd-strlcat.h
+ - Added timersum() macro
+ - Tidy RCSIDs of bsd-*.c
 
 19991121
  - OpenBSD CVS Changes:
index b338c9ca8282dcd82d84dffe38262be711171716..4400c258cc78edcf575e049a8855c0f0ea34421f 100644 (file)
@@ -28,12 +28,12 @@ OBJS=       authfd.o authfile.o auth-passwd.o auth-rhosts.o auth-rh-rsa.o \
                hostfile.o log-client.o login.o log-server.o match.o mpaux.o \
                packet.o pty.o readconf.o readpass.o rsa.o servconf.o serverloop.o \
                sshconnect.o tildexpand.o ttymodes.o uidswap.o xmalloc.o \
-               helper.o bsd-mktemp.o bsd-strlcpy.o bsd-daemon.o bsd-login.o rc4.o \
-               md5crypt.o
+               helper.o bsd-mktemp.o bsd-strlcpy.o bsd-strlcat.o bsd-daemon.o \
+               bsd-login.o rc4.o md5crypt.o
 
 all: $(OBJS) $(TARGETS)
 
-libssh.a: authfd.o authfile.o bufaux.o buffer.o canohost.o channels.o cipher.o compat.o compress.o crc32.o deattack.o hostfile.o match.o mpaux.o nchan.o packet.o readpass.o rsa.o tildexpand.o ttymodes.o uidswap.o xmalloc.o helper.o rc4.o bsd-mktemp.o bsd-strlcpy.o log.o fingerprint.o
+libssh.a: authfd.o authfile.o bufaux.o buffer.o canohost.o channels.o cipher.o compat.o compress.o crc32.o deattack.o hostfile.o match.o mpaux.o nchan.o packet.o readpass.o rsa.o tildexpand.o ttymodes.o uidswap.o xmalloc.o helper.o rc4.o bsd-mktemp.o bsd-strlcpy.o bsd-strlcat.o log.o fingerprint.o
        $(AR) rv $@ $^
        $(RANLIB) $@
 
index a37c0823c9f5023e3445e7621ed2b43c02e02853..db7fd18b1de94fd58b272cc4e7109a22cfa39b30 100644 (file)
 # include <paths.h> /* For _PATH_XXX */
 #endif 
 
+#ifdef HAVE_SYS_TIME_H
+# include <sys/time.h> /* For timersub */
+#endif
+
 #ifndef SHUT_RDWR
 enum
 {
@@ -178,3 +182,16 @@ enum
 # define MAX(a,b) (((a)>(b))?(a):(b))
 # define MIN(a,b) (((a)<(b))?(a):(b))
 #endif
+
+#ifndef timersub
+#define timersub(a, b, result)                                                                           \
+   do {                                                                                                                                                  \
+      (result)->tv_sec = (a)->tv_sec - (b)->tv_sec;           \
+      (result)->tv_usec = (a)->tv_usec - (b)->tv_usec;        \
+      if ((result)->tv_usec < 0) {                            \
+         --(result)->tv_sec;                                  \
+         (result)->tv_usec += 1000000;                        \
+      }                                                       \
+   } while (0)
+
+#endif
index 2f0ee3f3dd6a2b06b252d09de84cd1f82741476b..93f230266490f2496ca7b0417d79c60cf383b42e 100644 (file)
@@ -37,7 +37,7 @@
 
 #if defined(LIBC_SCCS) && !defined(lint)
 /* from: static char sccsid[] = "@(#)login.c   8.1 (Berkeley) 6/4/93"; */
-static char *rcsid = "$Id$";
+static char *rcsid = "$OpenBSD: login.c,v 1.5 1998/07/13 02:11:12 millert Exp $";
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/types.h>
diff --git a/bsd-strlcat.c b/bsd-strlcat.c
new file mode 100644 (file)
index 0000000..10ad9e7
--- /dev/null
@@ -0,0 +1,76 @@
+/*     $OpenBSD: strlcat.c,v 1.2 1999/06/17 16:28:58 millert Exp $     */
+
+/*
+ * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
+ * 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. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED ``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 AUTHOR 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.
+ */
+
+#include "config.h"
+#ifndef HAVE_STRLCAT
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char *rcsid = "$OpenBSD: strlcat.c,v 1.2 1999/06/17 16:28:58 millert Exp $";
+#endif /* LIBC_SCCS and not lint */
+
+#include <sys/types.h>
+#include <string.h>
+
+/*
+ * Appends src to string dst of size siz (unlike strncat, siz is the
+ * full size of dst, not space left).  At most siz-1 characters
+ * will be copied.  Always NUL terminates (unless siz == 0).
+ * Returns strlen(src); if retval >= siz, truncation occurred.
+ */
+size_t strlcat(dst, src, siz)
+       char *dst;
+       const char *src;
+       size_t siz;
+{
+       register char *d = dst;
+       register const char *s = src;
+       register size_t n = siz;
+       size_t dlen;
+
+       /* Find the end of dst and adjust bytes left but don't go past end */
+       while (*d != '\0' && n-- != 0)
+               d++;
+       dlen = d - dst;
+       n = siz - dlen;
+
+       if (n == 0)
+               return(dlen + strlen(s));
+       while (*s != '\0') {
+               if (n != 1) {
+                       *d++ = *s;
+                       n--;
+               }
+               s++;
+       }
+       *d = '\0';
+
+       return(dlen + (s - src));       /* count does not include NUL */
+}
+
+#endif /* !HAVE_STRLCAT */
diff --git a/bsd-strlcat.h b/bsd-strlcat.h
new file mode 100644 (file)
index 0000000..562dc70
--- /dev/null
@@ -0,0 +1,10 @@
+#ifndef _BSD_STRLCAT_H
+#define _BSD_STRLCAT_H
+
+#include "config.h"
+#ifndef HAVE_STRLCAT
+#include <sys/types.h>
+size_t strlcat(char *dst, const char *src, size_t siz);
+#endif /* !HAVE_STRLCAT */
+
+#endif /* _BSD_STRLCAT_H */
index 2a4a2c7de1952e7095afdd6d164e9c1822cdbc40..1fe0c30b4451992661feba65d158b8ca718471ea 100644 (file)
@@ -55,10 +55,10 @@ AC_CHECK_LIB(dl, dlopen, , )
 AC_CHECK_LIB(pam, pam_authenticate, , )
 
 dnl Checks for header files.
-AC_CHECK_HEADERS(pty.h endian.h paths.h lastlog.h shadow.h netgroup.h maillock.h sys/select.h)
+AC_CHECK_HEADERS(pty.h endian.h paths.h lastlog.h shadow.h netgroup.h maillock.h sys/select.h sys/time.h)
 
 dnl Checks for library functions.
-AC_CHECK_FUNCS(openpty strlcpy mkdtemp arc4random setproctitle setlogin)
+AC_CHECK_FUNCS(openpty strlcpy strlcat mkdtemp arc4random setproctitle setlogin)
 
 AC_CHECK_FUNC(login, 
        [AC_DEFINE(HAVE_LOGIN)],
index 06245fdce8beed7fded8837d04466888ff2d8f29..722c6b3bd5d4b88456d706ebc03fe3dfcc9a6dc1 100644 (file)
@@ -27,7 +27,6 @@ static /**/const char *const rcsid[] = { (char *)rcsid, "\100(#)" msg }
 #include <sys/ioctl.h>
 #include <sys/stat.h>
 #include <sys/wait.h>
-#include <sys/time.h>
 #include <sys/un.h>
 #include <sys/resource.h>
 
@@ -65,6 +64,9 @@ static /**/const char *const rcsid[] = { (char *)rcsid, "\100(#)" msg }
 #ifdef HAVE_SYS_SELECT_H
 # include <sys/select.h>
 #endif
+#ifdef HAVE_SYS_TIME_H
+# include <sys/time.h>
+#endif
 #ifdef HAVE_LIBPAM
 # include <security/pam_appl.h>
 #endif
@@ -72,6 +74,7 @@ static /**/const char *const rcsid[] = { (char *)rcsid, "\100(#)" msg }
 #include "version.h"
 #include "helper.h"
 #include "bsd-strlcpy.h"
+#include "bsd-strlcat.h"
 #include "bsd-mktemp.h"
 
 /* Define this to be the path of the xauth program. */
This page took 0.050579 seconds and 5 git commands to generate.