d9898ee8 |
1 | /* $Id: authsaslclientcramsha1.c,v 1.3 2005/02/21 03:34:19 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 *, |
25 | const char *, |
26 | const struct hmac_hashinfo *); |
27 | |
28 | int authsaslclient_cramsha1(const struct authsaslclientinfo *info) |
29 | { |
30 | const char *p=(*info->start_conv_func)("CRAM-SHA1", NULL, info->conv_func_arg); |
31 | |
32 | if (!p) return (AUTHSASL_CANCELLED); |
33 | return ( authsaslclient_cram(info, p, &hmac_sha1)); |
34 | } |
35 | |
36 | int authsaslclient_cramsha256(const struct authsaslclientinfo *info) |
37 | { |
38 | const char *p=(*info->start_conv_func)("CRAM-SHA256", NULL, |
39 | info->conv_func_arg); |
40 | |
41 | if (!p) return (AUTHSASL_CANCELLED); |
42 | return ( authsaslclient_cram(info, p, &hmac_sha256)); |
43 | } |
44 | |
45 | #else |
46 | int authsaslclient_cramsha1(const struct authsaslclientinfo *info) |
47 | { |
48 | return (AUTHSASL_NOMETHODS); |
49 | } |
50 | |
51 | int authsaslclient_cramsha256(const struct authsaslclientinfo *info) |
52 | { |
53 | return (AUTHSASL_NOMETHODS); |
54 | } |
55 | |
56 | #endif |
57 | |