X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=pppd%2Fauth.c;h=fa32fea781362687c767442501afbdd7a6706c8c;hb=4a54e34cf5629f9fed61f0b7d69ee3ba4d874bc6;hp=0a49f53e9f3711ef481856b6fbdffeae29ba496c;hpb=5749374dc2accc607b1aa2b3a4c6c71c0fb9f5cf;p=ppp.git diff --git a/pppd/auth.c b/pppd/auth.c index 0a49f53..fa32fea 100644 --- a/pppd/auth.c +++ b/pppd/auth.c @@ -70,6 +70,10 @@ #define RCSID "$Id: auth.c,v 1.117 2008/07/01 12:27:56 paulus Exp $" +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include @@ -93,7 +97,7 @@ #include -#ifdef HAS_SHADOW +#ifdef HAVE_SHADOW_H #include #ifndef PW_PPP #define PW_PPP PW_LOGIN @@ -101,6 +105,10 @@ #endif #include +#ifdef HAVE_CRYPT_H +#include +#endif + #ifdef SYSTEMD #include #endif @@ -250,23 +258,25 @@ bool explicit_remote = 0; /* User specified explicit remote name */ bool explicit_user = 0; /* Set if "user" option supplied */ bool explicit_passwd = 0; /* Set if "password" option supplied */ char remote_name[MAXNAMELEN]; /* Peer's name for authentication */ -#ifdef USE_EAPTLS -char *cacert_file = NULL; /* CA certificate file (pem format) */ -char *ca_path = NULL; /* directory with CA certificates */ -char *cert_file = NULL; /* client certificate file (pem format) */ -char *privkey_file = NULL; /* client private key file (pem format) */ -char *pkcs12_file = NULL; /* client private key envelope file (pkcs12 format) */ -char *crl_dir = NULL; /* directory containing CRL files */ -char *crl_file = NULL; /* Certificate Revocation List (CRL) file (pem format) */ -char *max_tls_version = NULL; /* Maximum TLS protocol version (default=1.2) */ -char *tls_verify_method = NULL; -bool tls_verify_key_usage = 0; -bool need_peer_eap = 0; /* Require peer to authenticate us */ + +#if defined(USE_EAPTLS) || defined(USE_PEAP) +char *cacert_file = NULL; /* CA certificate file (pem format) */ +char *ca_path = NULL; /* Directory with CA certificates */ +char *crl_dir = NULL; /* Directory containing CRL files */ +char *crl_file = NULL; /* Certificate Revocation List (CRL) file (pem format) */ +char *max_tls_version = NULL; /* Maximum TLS protocol version (default=1.2) */ +char *tls_verify_method = NULL; /* Verify certificate method */ +bool tls_verify_key_usage = 0; /* Verify peer certificate key usage */ #endif -static char *uafname; /* name of most recent +ua file */ +#if defined(USE_EAPTLS) +char *cert_file = NULL; /* Client certificate file (pem format) */ +char *privkey_file = NULL; /* Client private key file (pem format) */ +char *pkcs12_file = NULL; /* Client private key envelope file (pkcs12 format) */ +bool need_peer_eap = 0; /* Require peer to authenticate us */ +#endif -extern char *crypt (const char *, const char *); +static char *uafname; /* name of most recent +ua file */ /* Prototypes for procedures local to this file. */ @@ -439,23 +449,26 @@ option_t auth_options[] = { "Set telephone number(s) which are allowed to connect", OPT_PRIV | OPT_A2LIST }, -#ifdef USE_EAPTLS - { "ca", o_string, &cacert_file, "EAP-TLS CA certificate in PEM format" }, - { "capath", o_string, &ca_path, "EAP-TLS CA certificate directory" }, - { "cert", o_string, &cert_file, "EAP-TLS client certificate in PEM format" }, - { "key", o_string, &privkey_file, "EAP-TLS client private key in PEM format" }, - { "crl-dir", o_string, &crl_dir, "Use CRLs in directory" }, - { "crl", o_string, &crl_file, "Use specific CRL file" }, - { "pkcs12", o_string, &pkcs12_file, "EAP-TLS client credentials in PKCS12 format" }, +#if defined(USE_EAPTLS) || defined(USE_PEAP) + { "ca", o_string, &cacert_file, "CA certificate in PEM format" }, + { "capath", o_string, &ca_path, "TLS CA certificate directory" }, + { "crl-dir", o_string, &crl_dir, "Use CRLs in directory" }, + { "crl", o_string, &crl_file, "Use specific CRL file" }, { "max-tls-version", o_string, &max_tls_version, "Maximum TLS version (1.0/1.1/1.2 (default)/1.3)" }, { "tls-verify-key-usage", o_bool, &tls_verify_key_usage, "Verify certificate type and extended key usage" }, { "tls-verify-method", o_string, &tls_verify_method, "Verify peer by method (none|subject|name|suffix)" }, +#endif + +#if defined(USE_EAPTLS) + { "cert", o_string, &cert_file, "client certificate in PEM format" }, + { "key", o_string, &privkey_file, "client private key in PEM format" }, + { "pkcs12", o_string, &pkcs12_file, "EAP-TLS client credentials in PKCS12 format" }, { "need-peer-eap", o_bool, &need_peer_eap, "Require the peer to authenticate us", 1 }, -#endif /* USE_EAPTLS */ +#endif { NULL } }; @@ -1517,8 +1530,10 @@ check_passwd(int unit, if (secret[0] != 0 && !login_secret) { /* password given in pap-secrets - must match */ if (cryptpap || strcmp(passwd, secret) != 0) { +#ifdef HAVE_CRYPT_H char *cbuf = crypt(passwd, secret); if (!cbuf || strcmp(cbuf, secret) != 0) +#endif ret = UPAP_AUTHNAK; } } @@ -2392,7 +2407,8 @@ auth_script(char *script) argv[3] = user_name; argv[4] = devnam; argv[5] = strspeed; - argv[6] = NULL; + argv[6] = ipparam; + argv[7] = NULL; auth_script_pid = run_program(script, argv, 0, auth_script_done, NULL, 0); }