]> andersk Git - openssh.git/blobdiff - openbsd-compat/base64.c
- (tim) [defines.h] Fix regression in long password support on OpenServer 6.
[openssh.git] / openbsd-compat / base64.c
index d12b993b7cab3e188344b1ad31729b3773771432..9a60f583b7e7d3ee6a4c0b1acaa007a29cca81ca 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: base64.c,v 1.3 1997/11/08 20:46:55 deraadt Exp $      */
+/*     $OpenBSD: base64.c,v 1.4 2002/01/02 23:00:10 deraadt Exp $      */
 
 /*
  * Copyright (c) 1996 by Internet Software Consortium.
  * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES.
  */
 
-#include "config.h"
+/* OPENBSD ORIGINAL: lib/libc/net/base64.c */
 
-#if !defined(HAVE_B64_NTOP) && !defined(HAVE___B64_NTOP)
+#include "includes.h"
+
+#if (!defined(HAVE_B64_NTOP) && !defined(HAVE___B64_NTOP)) || (!defined(HAVE_B64_PTON) && !defined(HAVE___B64_PTON))
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -60,6 +62,7 @@
 
 #include "base64.h"
 
+/* XXX abort illegal in library */
 #define Assert(Cond) if (!(Cond)) abort()
 
 static const char Base64[] =
@@ -129,13 +132,14 @@ static const char Pad64 = '=';
           characters followed by one "=" padding character.
    */
 
+#if !defined(HAVE_B64_NTOP) && !defined(HAVE___B64_NTOP) 
 int
 b64_ntop(u_char const *src, size_t srclength, char *target, size_t targsize)
 {
        size_t datalength = 0;
        u_char input[3];
        u_char output[4];
-       int i;
+       u_int i;
 
        while (2 < srclength) {
                input[0] = *src++;
@@ -189,6 +193,9 @@ b64_ntop(u_char const *src, size_t srclength, char *target, size_t targsize)
        target[datalength] = '\0';      /* Returned value doesn't count \0. */
        return (datalength);
 }
+#endif /* !defined(HAVE_B64_NTOP) && !defined(HAVE___B64_NTOP) */
+
+#if !defined(HAVE_B64_PTON) && !defined(HAVE___B64_PTON)
 
 /* skips all whitespace anywhere.
    converts characters, four at a time, starting at (or after)
@@ -199,7 +206,8 @@ b64_ntop(u_char const *src, size_t srclength, char *target, size_t targsize)
 int
 b64_pton(char const *src, u_char *target, size_t targsize)
 {
-       int tarindex, state, ch;
+       u_int tarindex, state;
+       int ch;
        char *pos;
 
        state = 0;
@@ -313,4 +321,5 @@ b64_pton(char const *src, u_char *target, size_t targsize)
        return (tarindex);
 }
 
-#endif /* !defined(HAVE_B64_NTOP) && !defined(HAVE___B64_NTOP) */
+#endif /* !defined(HAVE_B64_PTON) && !defined(HAVE___B64_PTON) */
+#endif 
This page took 0.035895 seconds and 4 git commands to generate.