From a7b45e56fd3515435bbbc2b57dae4d6f3b20113f Mon Sep 17 00:00:00 2001 From: Arthur de Jong Date: Sun, 8 Jul 2012 08:26:32 +0000 Subject: implement a pam_password_prohibit_message nslcd.conf option to deny password change introducing a NSLCD_ACTION_CONFIG_GET request thanks to Ted Cheng git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd@1715 ef36b2f9-881f-0410-afb5-c4e39611909c --- nslcd/config.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 nslcd/config.c (limited to 'nslcd/config.c') diff --git a/nslcd/config.c b/nslcd/config.c new file mode 100644 index 0000000..d493abc --- /dev/null +++ b/nslcd/config.c @@ -0,0 +1,61 @@ +/* + config.c - pam processing routines + + Copyright (C) 2012 Arthur de Jong + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301 USA +*/ + +#include "config.h" + +#include +#include +#include +#ifdef HAVE_STDINT_H +#include +#endif /* HAVE_STDINT_H */ +#include + +#include "common.h" +#include "log.h" +#include "cfg.h" + +int nslcd_config_get(TFILE *fp,MYLDAP_SESSION *session) +{ + int32_t tmpint32; + int32_t cfgopt; + /* read request parameters */ + READ_INT32(fp,cfgopt); + /* log call */ + log_setrequest("config=%d",(int)cfgopt); + log_log(LOG_DEBUG,"nslcd_config_get(%d)",(int)cfgopt); + /* write the response header */ + WRITE_INT32(fp,NSLCD_VERSION); + WRITE_INT32(fp,NSLCD_ACTION_CONFIG_GET); + WRITE_INT32(fp,NSLCD_RESULT_BEGIN); + /* validate request */ + switch (cfgopt) + { + case NSLCD_CONFIG_PAM_PASSWORD_PROHIBIT_MESSAGE: + WRITE_STRING(fp,nslcd_cfg->pam_password_prohibit_message); + break; + default: + /* all other config options are ignored */ + break; + } + WRITE_INT32(fp,NSLCD_RESULT_END); + return 0; +} -- cgit v1.2.3