Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
path: root/nslcd/config.c
blob: d493abc25efec04d952fba00adcf23b89f4becad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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;
}