| 1 | #ifndef cramlib_h |
| 2 | #define cramlib_h |
| 3 | |
| 4 | #include "auth.h" |
| 5 | |
| 6 | /* |
| 7 | ** Copyright 1998 - 2004 Double Precision, Inc. See COPYING for |
| 8 | ** distribution information. |
| 9 | */ |
| 10 | struct cram_callback_info { |
| 11 | struct hmac_hashinfo *h; |
| 12 | char *user; |
| 13 | char *challenge; |
| 14 | char *response; |
| 15 | int (*callback_func)(struct authinfo *, void *); |
| 16 | void *callback_arg; |
| 17 | }; |
| 18 | |
| 19 | extern int auth_cram_callback(struct authinfo *a, void *vp); |
| 20 | /* |
| 21 | ** auth_get_cram parses out an authentication request. It checks whether |
| 22 | ** we have the requisite hash function installed, and, if so, base64decodes |
| 23 | ** the challenge and the response. |
| 24 | */ |
| 25 | |
| 26 | struct hmac_hashinfo; |
| 27 | |
| 28 | int auth_get_cram(const char *authtype, /* authtype */ |
| 29 | char *authdata, /* authdata */ |
| 30 | |
| 31 | struct cram_callback_info *craminfo); |
| 32 | /* Initializes craminfo */ |
| 33 | |
| 34 | /* auth_get_cram_silent() is auth_get_cram(), but without logging */ |
| 35 | |
| 36 | int auth_get_cram_silent(const char *authtype, char *authdata, |
| 37 | struct cram_callback_info *craminfo); |
| 38 | |
| 39 | /* |
| 40 | ** auth_verify_cram attempts to verify the secret cookie. |
| 41 | */ |
| 42 | |
| 43 | int auth_verify_cram(struct hmac_hashinfo *, /* The hash function */ |
| 44 | const char *, /* The challenge */ |
| 45 | const char *, /* The response */ |
| 46 | const char *); /* Hashed secret, in hex */ |
| 47 | |
| 48 | #endif |