X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=pppd%2Fchap-new.h;h=b4b0ee23eb6d5bf6121e842d236a1e2214a745bb;hb=bdd34ab1f2f87acb23c6d92feee7354ac53005ff;hp=141667ba13531e20c33b52a9e394b2946ef0a2d1;hpb=71d3de90eae52087b405e962ca650b71cec79c67;p=ppp.git diff --git a/pppd/chap-new.h b/pppd/chap-new.h index 141667b..b4b0ee2 100644 --- a/pppd/chap-new.h +++ b/pppd/chap-new.h @@ -10,16 +10,11 @@ * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The name(s) of the authors of this software must not be used to + * 2. The name(s) of the authors of this software must not be used to * endorse or promote products derived from this software without * prior written permission. * - * 4. Redistributions of any form whatsoever must retain the following + * 3. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by Paul Mackerras * ". @@ -33,6 +28,8 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "pppdconf.h" + /* * CHAP packets begin with a standard header with code, id, len (2 bytes). */ @@ -63,19 +60,16 @@ #define MDTYPE_MICROSOFT_V2 0x1 #define MDTYPE_MICROSOFT 0x2 #define MDTYPE_MD5 0x4 +#define MDTYPE_NONE 0 -#ifdef CHAPMS -#define MDTYPE_ALL (MDTYPE_MICROSOFT_V2 | MDTYPE_MICROSOFT | MDTYPE_MD5) -#else -#define MDTYPE_ALL (MDTYPE_MD5) -#endif -#define MDTYPE_NONE 0 +/* hashes supported by this instance of pppd */ +extern int chap_mdtype_all; /* Return the digest alg. ID for the most preferred digest type. */ #define CHAP_DIGEST(mdtype) \ + ((mdtype) & MDTYPE_MD5)? CHAP_MD5: \ ((mdtype) & MDTYPE_MICROSOFT_V2)? CHAP_MICROSOFT_V2: \ ((mdtype) & MDTYPE_MICROSOFT)? CHAP_MICROSOFT: \ - ((mdtype) & MDTYPE_MD5)? CHAP_MD5: \ 0 /* Return the bit flag (lsb set) for our most preferred digest type. */ @@ -113,7 +107,7 @@ struct chap_digest_type { void (*make_response)(unsigned char *response, int id, char *our_name, unsigned char *challenge, char *secret, int secret_len, unsigned char *priv); - int (*check_success)(unsigned char *pkt, int len, unsigned char *priv); + int (*check_success)(int id, unsigned char *pkt, int len); void (*handle_failure)(unsigned char *pkt, int len); struct chap_digest_type *next; @@ -123,11 +117,14 @@ struct chap_digest_type { extern int (*chap_verify_hook)(char *name, char *ourname, int id, struct chap_digest_type *digest, unsigned char *challenge, unsigned char *response, - unsigned char *message, int message_space); + char *message, int message_space); /* Called by digest code to register a digest type */ extern void chap_register_digest(struct chap_digest_type *); +/* Lookup a digest handler by type */ +extern struct chap_digest_type *chap_find_digest(int digest_code); + /* Called by authentication code to start authenticating the peer. */ extern void chap_auth_peer(int unit, char *our_name, int digest_code);