X-Git-Url: http://git.hcoop.net/hcoop/debian/courier-authlib.git/blobdiff_plain/d9898ee81388d1eff40cf71e85d9ce9b5c1401fe..0e333c05cada796fa75ceebdfc4b3e20d48f87ec:/authsaslfrombase64.c diff --git a/authsaslfrombase64.c b/authsaslfrombase64.c index a316d6a..96a6a71 100644 --- a/authsaslfrombase64.c +++ b/authsaslfrombase64.c @@ -1,25 +1,47 @@ -#include - -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 + +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)