diff options
author | Arthur de Jong <arthur@arthurdejong.org> | 2012-07-08 10:26:32 +0200 |
---|---|---|
committer | Arthur de Jong <arthur@arthurdejong.org> | 2012-07-08 10:26:32 +0200 |
commit | a7b45e56fd3515435bbbc2b57dae4d6f3b20113f (patch) | |
tree | 536db2d4c36e444351b00d41ec0efffdc395a18b /nslcd/config.c | |
parent | c8f4cef2c40a3a84cb83badc65618afa16c9b3ab (diff) |
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
Diffstat (limited to 'nslcd/config.c')
-rw-r--r-- | nslcd/config.c | 61 |
1 files changed, 61 insertions, 0 deletions
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 <stdio.h> +#include <stdlib.h> +#include <string.h> +#ifdef HAVE_STDINT_H +#include <stdint.h> +#endif /* HAVE_STDINT_H */ +#include <unistd.h> + +#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; +} |