1
  "   ˆl–Ým_J*j"Tâ�nãM\TÅ£Áƒh¹À¿      online
     �_’I|¥‰ÓMjqØ‚¦ð¬÷ÁÀ      File not found.
  *   ˆl–Ðz¾”êe¶¥6 ]¸&n *bÑ¿Ãƒy±5_†I|¥�+ÃÂ !L    /*
 * ProFTPD - FTP server daemon
 * Copyright (c) 2001-2023 The ProFTPD Project team
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
 *
 * As a special exemption, Public Flood Software/MacGyver aka Habeeb J. Dihu
 * and other respective copyright holders give permission to link this program
 * with OpenSSL, and distribute the resulting executable, without including
 * the source code for OpenSSL in the source distribution.
 */

/* Controls API definitions */

#ifndef PR_CTRLS_H
#define PR_CTRLS_H

#include <sys/un.h>

#include "conf.h"

/* Controls API build-time necessities
 */

/* mode for control socket */
#define PR_CTRLS_MODE		0777

/* mode for client sockets */
#define PR_CTRLS_CL_MODE	S_IRWXU

/* Controls API objects
 */

/* Controls client object */
typedef struct cl_obj {
  struct cl_obj *cl_next, *cl_prev;

  /* Pool for this object's use */
  pool *cl_pool;

  /* Client socket file descriptor */
  int cl_fd;

  /* Credentials of the connecting client */
  uid_t cl_uid;
  const char *cl_user;
  gid_t cl_gid;
  const char *cl_group;
  pid_t cl_pid;

  /* For internal use only */
  volatile unsigned long cl_flags;

  /* Pointers to all controls matching client request */
  array_header *cl_ctrls;

} pr_ctrls_cl_t;

/* Controls client flag values
 */
#define PR_CTRLS_CL_HAVEREQ     0x001
#define PR_CTRLS_CL_HAVERESP    0x002
#define PR_CTRLS_CL_NOACCESS    0x004
#define PR_CTRLS_CL_NOACTION    0x010
#define PR_CTRLS_CL_BLOCKED     0x020

/* Controls handler object */
typedef struct ctrls_obj {
  struct ctrls_obj *ctrls_next, *ctrls_prev;

  /* Object ID */
  unsigned int ctrls_id;

  /* Registering module */
  const module *ctrls_module;

  /* Requesting client */
  pr_ctrls_cl_t *ctrls_cl;

  /* Control "action" */
  const char *ctrls_action;

  /* Control trigger time.  If 0, triggers immediately */
  time_t ctrls_when;

  /* Simple description/help text */
  const char *ctrls_desc;

  /* Temporary pool */
  pool *ctrls_tmp_pool;

  /* Control handler callback */
  int (*ctrls_cb)(struct ctrls_obj *, int, char **);

  /* Control handler callback arguments */
  array_header *ctrls_cb_args;

  /* Control handler callback return value.  Used to determine when to clear
   * this object from the requested list
   */
  int ctrls_cb_retval;

  /* Control handler callback responses */
  array_header *ctrls_cb_resps;

  /* For possibly passing data among control handlers */
  void *ctrls_data;

  /* For internal use */
  volatile unsigned long ctrls_flags;

} pr_ctrls_t;

#define PR_CTRLS_FL_REQUESTED		0x00001
#define PR_CTRLS_FL_HANDLED		0x00002
#define PR_CTRLS_FL_PENDING		0x00004

#define PR_CTRLS_ACT_SOLITARY		0x00010
#define PR_CTRLS_ACT_DISABLED		0x00020

#define CTRLS_GET_ACTION_ALL		7
#define CTRLS_GET_ACTION_ENABLED	8
#define CTRLS_GET_DESC			9

/* Controls API */

/* Control action exit status values */

/* Note: For internal use only */
#define PR_CTRLS_STATUS_PENDING			1
#define PR_CTRLS_STATUS_OK			0
/* Note: Used for backward compatibility */
#define PR_CTRLS_STATUS_GENERIC_ERROR		-1
#define PR_CTRLS_STATUS_ACCESS_DENIED		-2
#define PR_CTRLS_STATUS_WRONG_PARAMETERS 	-3
/* Example: "no such server/address", "unknown module" */
#define PR_CTRLS_STATUS_SUBJECT_NOT_FOUND 	-4
#d