Blame nslcd/config.c

Packit 6bd9ab
/*
Packit 6bd9ab
   config.c - routines for getting configuration information
Packit 6bd9ab
Packit 6bd9ab
   Copyright (C) 2012, 2013 Arthur de Jong
Packit 6bd9ab
Packit 6bd9ab
   This library is free software; you can redistribute it and/or
Packit 6bd9ab
   modify it under the terms of the GNU Lesser General Public
Packit 6bd9ab
   License as published by the Free Software Foundation; either
Packit 6bd9ab
   version 2.1 of the License, or (at your option) any later version.
Packit 6bd9ab
Packit 6bd9ab
   This library is distributed in the hope that it will be useful,
Packit 6bd9ab
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6bd9ab
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 6bd9ab
   Lesser General Public License for more details.
Packit 6bd9ab
Packit 6bd9ab
   You should have received a copy of the GNU Lesser General Public
Packit 6bd9ab
   License along with this library; if not, write to the Free Software
Packit 6bd9ab
   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
Packit 6bd9ab
   02110-1301 USA
Packit 6bd9ab
*/
Packit 6bd9ab
Packit 6bd9ab
#include "config.h"
Packit 6bd9ab
Packit 6bd9ab
#include <stdio.h>
Packit 6bd9ab
#include <stdlib.h>
Packit 6bd9ab
#include <string.h>
Packit 6bd9ab
#ifdef HAVE_STDINT_H
Packit 6bd9ab
#include <stdint.h>
Packit 6bd9ab
#endif /* HAVE_STDINT_H */
Packit 6bd9ab
#include <unistd.h>
Packit 6bd9ab
Packit 6bd9ab
#include "common.h"
Packit 6bd9ab
#include "log.h"
Packit 6bd9ab
#include "cfg.h"
Packit 6bd9ab
Packit 6bd9ab
int nslcd_config_get(TFILE *fp, MYLDAP_SESSION UNUSED(*session))
Packit 6bd9ab
{
Packit 6bd9ab
  int32_t tmpint32;
Packit 6bd9ab
  int32_t cfgopt;
Packit 6bd9ab
  /* read request parameters */
Packit 6bd9ab
  READ_INT32(fp, cfgopt);
Packit 6bd9ab
  /* log call */
Packit 6bd9ab
  log_setrequest("config=%d", (int)cfgopt);
Packit 6bd9ab
  log_log(LOG_DEBUG, "nslcd_config_get(%d)", (int)cfgopt);
Packit 6bd9ab
  /* write the response header */
Packit 6bd9ab
  WRITE_INT32(fp, NSLCD_VERSION);
Packit 6bd9ab
  WRITE_INT32(fp, NSLCD_ACTION_CONFIG_GET);
Packit 6bd9ab
  WRITE_INT32(fp, NSLCD_RESULT_BEGIN);
Packit 6bd9ab
  /* validate request */
Packit 6bd9ab
  switch (cfgopt)
Packit 6bd9ab
  {
Packit 6bd9ab
    case NSLCD_CONFIG_PAM_PASSWORD_PROHIBIT_MESSAGE:
Packit 6bd9ab
      WRITE_STRING(fp, nslcd_cfg->pam_password_prohibit_message);
Packit 6bd9ab
      break;
Packit 6bd9ab
    default:
Packit 6bd9ab
      /* all other config options are ignored */
Packit 6bd9ab
      break;
Packit 6bd9ab
  }
Packit 6bd9ab
  WRITE_INT32(fp, NSLCD_RESULT_END);
Packit 6bd9ab
  return 0;
Packit 6bd9ab
}