[Midnightbsd-cvs] src [11059] trunk/contrib/pam_modules/pam_passwdqc/pam_passwdqc.c: update pam modules
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Mon Jun 18 23:16:00 EDT 2018
Revision: 11059
http://svnweb.midnightbsd.org/src/?rev=11059
Author: laffer1
Date: 2018-06-18 23:15:59 -0400 (Mon, 18 Jun 2018)
Log Message:
-----------
update pam modules
Modified Paths:
--------------
trunk/contrib/pam_modules/pam_passwdqc/pam_passwdqc.c
Modified: trunk/contrib/pam_modules/pam_passwdqc/pam_passwdqc.c
===================================================================
--- trunk/contrib/pam_modules/pam_passwdqc/pam_passwdqc.c 2018-06-19 00:49:18 UTC (rev 11058)
+++ trunk/contrib/pam_modules/pam_passwdqc/pam_passwdqc.c 2018-06-19 03:15:59 UTC (rev 11059)
@@ -2,9 +2,9 @@
* Copyright (c) 2000-2002 by Solar Designer. See LICENSE.
*/
-#define _XOPEN_SOURCE 500
+#define _XOPEN_SOURCE 600
#define _XOPEN_SOURCE_EXTENDED
-#define _XOPEN_VERSION 500
+#define _XOPEN_VERSION 600
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
@@ -132,17 +132,19 @@
static int converse(pam_handle_t *pamh, int style, lo_const char *text,
struct pam_response **resp)
{
- struct pam_conv *conv;
+ pam_item_t item;
+ lo_const struct pam_conv *conv;
struct pam_message msg, *pmsg;
int status;
- status = pam_get_item(pamh, PAM_CONV, (pam_item_t *)&conv);
+ status = pam_get_item(pamh, PAM_CONV, &item);
if (status != PAM_SUCCESS)
return status;
+ conv = item;
pmsg = &msg;
msg.msg_style = style;
- msg.msg = text;
+ msg.msg = (char *)text;
*resp = NULL;
return conv->conv(1, (lo_const struct pam_message **)&pmsg, resp,
@@ -294,8 +296,11 @@
}
if (argc) {
- say(pamh, PAM_ERROR_MSG, getuid() != 0 ?
- MESSAGE_MISCONFIGURED : MESSAGE_INVALID_OPTION, *argv);
+ if (getuid() != 0) {
+ say(pamh, PAM_ERROR_MSG, MESSAGE_MISCONFIGURED);
+ } else {
+ say(pamh, PAM_ERROR_MSG, MESSAGE_INVALID_OPTION, *argv);
+ }
return PAM_ABORT;
}
@@ -311,7 +316,9 @@
#ifdef HAVE_SHADOW
struct spwd *spw;
#endif
- char *user, *oldpass, *newpass, *randompass;
+ pam_item_t item;
+ lo_const char *user, *oldpass, *curpass;
+ char *newpass, *randompass;
const char *reason;
int ask_oldauthtok;
int randomonly, enforce, retries_left, retry_wanted;
@@ -353,17 +360,19 @@
if (flags & PAM_PRELIM_CHECK)
return status;
- status = pam_get_item(pamh, PAM_USER, (pam_item_t *)&user);
+ status = pam_get_item(pamh, PAM_USER, &item);
if (status != PAM_SUCCESS)
return status;
+ user = item;
- status = pam_get_item(pamh, PAM_OLDAUTHTOK, (pam_item_t *)&oldpass);
+ status = pam_get_item(pamh, PAM_OLDAUTHTOK, &item);
if (status != PAM_SUCCESS)
return status;
+ oldpass = item;
if (params.flags & F_NON_UNIX) {
pw = &fake_pw;
- pw->pw_name = user;
+ pw->pw_name = (char *)user;
pw->pw_gecos = "";
} else {
pw = getpwnam(user);
@@ -405,13 +414,13 @@
enforce = params.flags & F_ENFORCE_ROOT;
if (params.flags & F_USE_AUTHTOK) {
- status = pam_get_item(pamh, PAM_AUTHTOK,
- (pam_item_t *)&newpass);
+ status = pam_get_item(pamh, PAM_AUTHTOK, &item);
if (status != PAM_SUCCESS)
return status;
- if (!newpass || (check_max(¶ms, pamh, newpass) && enforce))
+ curpass = item;
+ if (!curpass || (check_max(¶ms, pamh, curpass) && enforce))
return PAM_AUTHTOK_ERR;
- reason = _passwdqc_check(¶ms.qc, newpass, oldpass, pw);
+ reason = _passwdqc_check(¶ms.qc, curpass, oldpass, pw);
if (reason) {
say(pamh, PAM_ERROR_MSG, MESSAGE_WEAKPASS, reason);
if (enforce)
@@ -487,7 +496,7 @@
if (!newpass) {
if (randompass) _pam_overwrite(randompass);
- return PAM_AUTHTOK_ERR;
+ return status;
}
if (check_max(¶ms, pamh, newpass) && enforce) {
More information about the Midnightbsd-cvs
mailing list