You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
1.8 KiB

# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: package/.../uclibc/pkg_patch/shadow-11-uclibc-l64a.patch
# Copyright (C) 2006 The OpenSDE Project
# Copyright (C) 2004 - 2006 The T2 SDE Project
#
# More information can be found in the files COPYING and README.
#
# This patch file is dual-licensed. It is available under the license the
# patched project is licensed under, as long as it is an OpenSource license
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
# of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
# --- SDE-COPYRIGHT-NOTE-END ---
uClibc does not contain l64a/a64l conversion
Michael Tross <michael (at) tross . org>
--- shadow-4.0.11.1/libmisc/salt.c.orig 2005-06-14 22:27:35.000000000 +0200
+++ shadow-4.0.11.1/libmisc/salt.c 2005-07-27 12:18:22.000000000 +0200
@@ -14,6 +14,38 @@
#include "prototypes.h"
#include "defines.h"
#include "getdef.h"
+
+/*
+ * l64a - convert between long and base-64
+ */
+char *l64a(long value)
+{
+ long int n = (long int) value & 0xffffffff; /* convert only 32 bits */
+ int i, j;
+ static char b64[7];
+
+ /* return empty string in case of 0 */
+ if (n == 0ul)
+ return (char *) "";
+
+ for (i=0; n>0; i++) {
+ j = n & 0x3f;
+ if (j == 0)
+ b64[i] = '.';
+ else if (j == 1)
+ b64[i] = '/';
+ else if (j <= 11)
+ b64[i] = (j - 2) + '0';
+ else if (j <= 37)
+ b64[i] = (j - 12) + 'A';
+ else
+ b64[i] = (j - 38) + 'a';
+ n >>= 6;
+ }
+ b64[i] = '\0';
+ return (char *) b64;
+}
+
/*
* Generate 8 base64 ASCII characters of random salt. If MD5_CRYPT_ENAB
* in /etc/login.defs is "yes", the salt string will be prefixed by "$1$"