Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
-AX_CHECK_PAM(AC_DEFINE([USE_PAM], 1, ["Support for Pluggable Authentication Modules"]))
-AM_CONDITIONAL(WITH_PAM, test "x${with_pam}" = "xyes")
+AX_CHECK_PAM(AC_DEFINE([PPP_WITH_PAM], 1, [Support for Pluggable Authentication Modules]))
+AM_CONDITIONAL(PPP_WITH_PAM, test "x${with_pam}" = "xyes")
#
# With libpcap support, activate pppd on network activity
#
# With libpcap support, activate pppd on network activity
pppd_SOURCES += ipv6cp.c eui64.c
endif
pppd_SOURCES += ipv6cp.c eui64.c
endif
-if WITH_PAM
-pppd_LIBS += -lpam -ldl
+if PPP_WITH_PAM
+pppd_CPPFLAGS += $(PAM_CFLAGS)
+pppd_LIBS += $(PAM_LIBS) -ldl
+pppd_LDFLAGS += $(PAM_LDFLAGS)
/* "Have IPv6 support" */
#undef PPP_WITH_IPV6CP
/* "Have IPv6 support" */
#undef PPP_WITH_IPV6CP
-/* "Support for Pluggable Authentication Modules" */
-#undef USE_PAM
+/* Support for Pluggable Authentication Modules */
+#undef PPP_WITH_PAM
-/* "Have EAP-SRP authentication support" */
+/* Have EAP-SRP authentication support */
#undef USE_SRP
/* Have EAP-TLS authentication support */
#undef USE_SRP
/* Have EAP-TLS authentication support */
#include "pppd.h"
#include "session.h"
#include "pppd.h"
#include "session.h"
#include <security/pam_appl.h>
#include <security/pam_appl.h>
-#endif /* #ifdef USE_PAM */
+#endif /* #ifdef PPP_WITH_PAM */
#define SET_MSG(var, msg) if (var != NULL) { var[0] = msg; }
#define COPY_STRING(s) ((s) ? strdup(s) : NULL)
#define SET_MSG(var, msg) if (var != NULL) { var[0] = msg; }
#define COPY_STRING(s) ((s) ? strdup(s) : NULL)
/* We have successfully started a session */
static bool logged_in = 0;
/* We have successfully started a session */
static bool logged_in = 0;
/*
* Static variables used to communicate between the conversation function
* and the server_login function
/*
* Static variables used to communicate between the conversation function
* and the server_login function
-#endif /* #ifdef USE_PAM */
+#endif /* #ifdef PPP_WITH_PAM */
int
session_start(const int flags, const char *user, const char *passwd, const char *ttyName, char **msg)
{
int
session_start(const int flags, const char *user, const char *passwd, const char *ttyName, char **msg)
{
bool ok = 1;
const char *usr;
int pam_error;
bool try_session = 0;
bool ok = 1;
const char *usr;
int pam_error;
bool try_session = 0;
-#else /* #ifdef USE_PAM */
+#else /* #ifdef PPP_WITH_PAM */
struct passwd *pw;
char *cbuf;
#ifdef HAVE_SHADOW_H
struct passwd *pw;
char *cbuf;
#ifdef HAVE_SHADOW_H
struct spwd *getspnam();
long now = 0;
#endif /* #ifdef HAVE_SHADOW_H */
struct spwd *getspnam();
long now = 0;
#endif /* #ifdef HAVE_SHADOW_H */
-#endif /* #ifdef USE_PAM */
+#endif /* #ifdef PPP_WITH_PAM */
SET_MSG(msg, SUCCESS_MSG);
SET_MSG(msg, SUCCESS_MSG);
/* Find the '\\' in the username */
/* This needs to be fixed to support different username schemes */
if ((usr = strchr(user, '\\')) == NULL)
/* Find the '\\' in the username */
/* This needs to be fixed to support different username schemes */
if ((usr = strchr(user, '\\')) == NULL)
/* If our PAM checks have already failed, then we must return a failure */
if (!ok) return SESSION_FAILED;
/* If our PAM checks have already failed, then we must return a failure */
if (!ok) return SESSION_FAILED;
-#else /* #ifdef USE_PAM */
+#else /* #ifdef PPP_WITH_PAM */
/*
* Use the non-PAM methods directly. 'pw' will remain NULL if the user
/*
* Use the non-PAM methods directly. 'pw' will remain NULL if the user
-#endif /* #ifdef USE_PAM */
+#endif /* #ifdef PPP_WITH_PAM */
/*
* Write a wtmp entry for this user.
/*
* Write a wtmp entry for this user.
logwtmp(ttyName, user, ifname); /* Add wtmp login entry */
logged_in = 1;
logwtmp(ttyName, user, ifname); /* Add wtmp login entry */
logged_in = 1;
-#if defined(_PATH_LASTLOG) && !defined(USE_PAM)
+#if defined(_PATH_LASTLOG) && !defined(PPP_WITH_PAM)
/*
* Enter the user in lastlog only if he has been authenticated using
* local system services. If he has not, then we don't know what his
/*
* Enter the user in lastlog only if he has been authenticated using
* local system services. If he has not, then we don't know what his
-#endif /* _PATH_LASTLOG and not USE_PAM */
+#endif /* _PATH_LASTLOG and not PPP_WITH_PAM */
info("user %s logged in on tty %s intf %s", user, ttyName, ifname);
}
info("user %s logged in on tty %s intf %s", user, ttyName, ifname);
}
void
session_end(const char* ttyName)
{
void
session_end(const char* ttyName)
{
int pam_error = PAM_SUCCESS;
if (pamh != NULL) {
int pam_error = PAM_SUCCESS;
if (pamh != NULL) {