/*
* ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001-2010 Alexander Barton (alex@barton.de).
+ * Copyright (c)2001-2014 Alexander Barton (alex@barton.de) and Contributors.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
- *
- * PAM User Authentification
*/
#include "portab.h"
#ifdef PAM
-#include "imp.h"
-#include <assert.h>
-
-#include "defines.h"
-#include "log.h"
-#include "conn.h"
-#include "client.h"
+/**
+ * @file
+ * PAM User Authentication
+ */
+#include <assert.h>
#include <stdlib.h>
#include <string.h>
-
#ifdef HAVE_SECURITY_PAM_APPL_H
-#include <security/pam_appl.h>
+# include <security/pam_appl.h>
#endif
-
#ifdef HAVE_PAM_PAM_APPL_H
-#include <pam/pam_appl.h>
+# include <pam/pam_appl.h>
#endif
-#include "exp.h"
+#include "defines.h"
+#include "log.h"
+#include "conn.h"
+#include "client.h"
+#include "conf.h"
+
#include "pam.h"
static char *password;
};
/**
- * Authenticate a connectiong client using PAM.
+ * Authenticate a connecting client using PAM.
* @param Client The client to authenticate.
* @return true when authentication succeeded, false otherwise.
*/
/* Set supplied client password */
if (password)
free(password);
- password = strdup(Client_Password(Client));
- conv.appdata_ptr = password;
+ password = strdup(Conn_Password(Client_Conn(Client)));
+ conv.appdata_ptr = Conn_Password(Client_Conn(Client));
/* Initialize PAM */
- retval = pam_start("ngircd", Client_OrigUser(Client), &conv, &pam);
+ retval = pam_start(Conf_PAMServiceName, Client_OrigUser(Client), &conv, &pam);
if (retval != PAM_SUCCESS) {
Log(LOG_ERR, "PAM: Failed to create authenticator! (%d)", retval);
return false;