]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/session.c
pppd: Add support for registering ppp interface via Linux rtnetlink API
[ppp.git] / pppd / session.c
index 2f1c83e5552cd3afd59813e82d6b8bdf3de6294b..3d1fb6d7ccc1f912e1454eacdd10e20f2a22626d 100644 (file)
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <pwd.h>
+
+#ifdef HAVE_CRYPT_H
 #include <crypt.h>
-#ifdef HAS_SHADOW
+#endif
+
+#ifdef HAVE_SHADOW_H
 #include <shadow.h>
 #endif
+
 #include <time.h>
 #include <utmp.h>
 #include <fcntl.h>
@@ -171,11 +180,11 @@ session_start(const int flags, const char *user, const char *passwd, const char
 #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);
@@ -305,7 +314,7 @@ session_start(const int flags, const char *user, const char *passwd, const char
        if (pw == NULL)
            return SESSION_FAILED;
 
-#ifdef HAS_SHADOW
+#ifdef HAVE_SHADOW_H
 
        spwd = getspnam(user);
        endspent();
@@ -336,15 +345,17 @@ session_start(const int flags, const char *user, const char *passwd, const char
        /* 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;
     }