X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=pppd%2Fsession.c;h=3d1fb6d7ccc1f912e1454eacdd10e20f2a22626d;hb=2883dd07101bf851e2ea368f0c04c91aea85cff2;hp=473e51e1912f63074eb7c1d058a601f17fc2749e;hpb=3ea9de913739667e2131d67d979ff175ec394e67;p=ppp.git diff --git a/pppd/session.c b/pppd/session.c index 473e51e..3d1fb6d 100644 --- a/pppd/session.c +++ b/pppd/session.c @@ -68,14 +68,23 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include #include + +#ifdef HAVE_CRYPT_H #include -#ifdef HAS_SHADOW +#endif + +#ifdef HAVE_SHADOW_H #include #endif + #include #include #include @@ -116,10 +125,7 @@ static pam_handle_t *pamh = NULL; */ static int conversation (int num_msg, -#ifndef SOL2 - const -#endif - struct pam_message **msg, + const struct pam_message **msg, struct pam_response **resp, void *appdata_ptr) { int replies = 0; @@ -164,12 +170,7 @@ static struct pam_conv pam_conv_data = { #endif /* #ifdef USE_PAM */ int -session_start(flags, user, passwd, ttyName, msg) - const int flags; - const char *user; - const char *passwd; - const char *ttyName; - char **msg; +session_start(const int flags, const char *user, const char *passwd, const char *ttyName, char **msg) { #ifdef USE_PAM bool ok = 1; @@ -179,11 +180,11 @@ session_start(flags, user, passwd, ttyName, msg) #else /* #ifdef USE_PAM */ struct passwd *pw; char *cbuf; -#ifdef HAS_SHADOW +#ifdef HAVE_SHADOW_H struct spwd *spwd; struct spwd *getspnam(); long now = 0; -#endif /* #ifdef HAS_SHADOW */ +#endif /* #ifdef HAVE_SHADOW_H */ #endif /* #ifdef USE_PAM */ SET_MSG(msg, SUCCESS_MSG); @@ -313,7 +314,7 @@ session_start(flags, user, passwd, ttyName, msg) if (pw == NULL) return SESSION_FAILED; -#ifdef HAS_SHADOW +#ifdef HAVE_SHADOW_H spwd = getspnam(user); endspent(); @@ -344,15 +345,17 @@ session_start(flags, user, passwd, ttyName, msg) /* We have a valid shadow entry, keep the password */ pw->pw_passwd = spwd->sp_pwdp; -#endif /* #ifdef HAS_SHADOW */ +#endif /* #ifdef HAVE_SHADOW_H */ /* * If no passwd, don't let them login if we're authenticating. */ if (pw->pw_passwd == NULL || strlen(pw->pw_passwd) < 2) return SESSION_FAILED; +#ifdef HAVE_CRYPT_H cbuf = crypt(passwd, pw->pw_passwd); if (!cbuf || strcmp(cbuf, pw->pw_passwd) != 0) +#endif return SESSION_FAILED; }