OpenSDE Packages Database (without history before r20070)
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.

61 lines
1.8 KiB

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