-#include <stdlib.h>
-
-static int decode64tab_init=0;
-static char decode64tab[256];
-
/*
-** Copyright 1998 - 1999 Double Precision, Inc.
+** Copyright 1998 - 2008 Double Precision, Inc.
** See COPYING for distribution information.
*/
+#include <stdlib.h>
+
+static const char decode64tab[256]= {
+ 100, 100, 100, 100, 100, 100, 100, 100,
+ 100, 100, 100, 100, 100, 100, 100, 100,
+ 100, 100, 100, 100, 100, 100, 100, 100,
+ 100, 100, 100, 100, 100, 100, 100, 100,
+ 100, 100, 100, 100, 100, 100, 100, 100,
+ 100, 100, 100, 62, 100, 100, 100, 63,
+ 52, 53, 54, 55, 56, 57, 58, 59,
+ 60, 61, 100, 100, 100, 100, 100, 100,
+ 100, 0, 1, 2, 3, 4, 5, 6,
+ 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22,
+ 23, 24, 25, 100, 100, 100, 100, 100,
+ 100, 26, 27, 28, 29, 30, 31, 32,
+ 33, 34, 35, 36, 37, 38, 39, 40,
+ 41, 42, 43, 44, 45, 46, 47, 48,
+ 49, 50, 51, 100, 100, 100, 100, 100,
+ 100, 100, 100, 100, 100, 100, 100, 100,
+ 100, 100, 100, 100, 100, 100, 100, 100,
+ 100, 100, 100, 100, 100, 100, 100, 100,
+ 100, 100, 100, 100, 100, 100, 100, 100,
+ 100, 100, 100, 100, 100, 100, 100, 100,
+ 100, 100, 100, 100, 100, 100, 100, 100,
+ 100, 100, 100, 100, 100, 100, 100, 100,
+ 100, 100, 100, 100, 100, 100, 100, 100,
+ 100, 100, 100, 100, 100, 100, 100, 100,
+ 100, 100, 100, 100, 100, 100, 100, 100,
+ 100, 100, 100, 100, 100, 100, 100, 100,
+ 100, 100, 100, 100, 100, 100, 100, 100,
+ 100, 100, 100, 100, 100, 100, 100, 100,
+ 100, 100, 100, 100, 100, 100, 100, 100,
+ 100, 100, 100, 100, 100, 100, 100, 100,
+ 100, 100, 100, 100, 100, 100, 100, 100};
+
int authsasl_frombase64(char *base64buf)
{
-int i, j, k;
-
- if (!decode64tab_init)
- {
- for (i=0; i<256; i++) decode64tab[i]=100;
- for (i=0; i<64; i++)
- decode64tab[ (int)
- ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[i]) ]=i;
- decode64tab_init=1;
- }
+ int i, j, k;
for (j=0; base64buf[j]; j++)
if (decode64tab[(unsigned char)base64buf[j]] >= 100)