| 1 | /* $Id: authsaslclientcrammd5.c,v 1.2 2004/10/21 00:10:49 mrsam Exp $ */ |
| 2 | |
| 3 | /* |
| 4 | ** Copyright 2000 Double Precision, Inc. See COPYING for |
| 5 | ** distribution information. |
| 6 | */ |
| 7 | |
| 8 | #include "courier_auth_config.h" |
| 9 | #include "courierauthsasl.h" |
| 10 | |
| 11 | #if HAVE_HMACLIB |
| 12 | #include "libhmac/hmac.h" |
| 13 | #endif |
| 14 | |
| 15 | #include "authsaslclient.h" |
| 16 | #include <stdlib.h> |
| 17 | #include <stdio.h> |
| 18 | #include <ctype.h> |
| 19 | #include <string.h> |
| 20 | #include <errno.h> |
| 21 | |
| 22 | #if HAVE_HMACLIB |
| 23 | |
| 24 | extern int authsaslclient_cram(const struct authsaslclientinfo *info, |
| 25 | const char *p, |
| 26 | const struct hmac_hashinfo *); |
| 27 | |
| 28 | int authsaslclient_crammd5(const struct authsaslclientinfo *info) |
| 29 | { |
| 30 | const char *p=(*info->start_conv_func)("CRAM-MD5", NULL, info->conv_func_arg); |
| 31 | |
| 32 | if (!p) return (AUTHSASL_CANCELLED); |
| 33 | return ( authsaslclient_cram(info, p, &hmac_md5)); |
| 34 | } |
| 35 | |
| 36 | #else |
| 37 | int authsaslclient_crammd5(const struct authsaslclientinfo *info) |
| 38 | { |
| 39 | return (AUTHSASL_NOMETHODS); |
| 40 | } |
| 41 | |
| 42 | #endif |
| 43 | |