aboutsummaryrefslogtreecommitdiff
path: root/include/libssh/bind_config.h
diff options
context:
space:
mode:
authorAnderson Toshiyuki Sasaki <ansasaki@redhat.com>2019-02-22 17:02:34 +0100
committerAndreas Schneider <asn@cryptomilk.org>2019-04-01 08:38:15 +0200
commit55a713cb04550e340afaabc4073212b872ff37e2 (patch)
treeb405fa492bcb801343a6246bf860446cd2d2351e /include/libssh/bind_config.h
parent79049981a513f9a10fac0f153e9b0b588326021f (diff)
downloadlibssh-55a713cb04550e340afaabc4073212b872ff37e2.tar.gz
libssh-55a713cb04550e340afaabc4073212b872ff37e2.tar.xz
libssh-55a713cb04550e340afaabc4073212b872ff37e2.zip
bind_config: Support server side configuration
Introduced the support to set options for a given ssh_bind through a configuration file. For options set more than once in a single file (or by files included in it recursively) the first value set will be kept. Differently from the session options configuration, if an option previously set in one configuration file is redefined in a later processed file, the latest will be kept. Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'include/libssh/bind_config.h')
-rw-r--r--include/libssh/bind_config.h59
1 files changed, 59 insertions, 0 deletions
diff --git a/include/libssh/bind_config.h b/include/libssh/bind_config.h
new file mode 100644
index 00000000..0a1a6d75
--- /dev/null
+++ b/include/libssh/bind_config.h
@@ -0,0 +1,59 @@
+/*
+ * bind_config.h - Parse the SSH server configuration file
+ *
+ * This file is part of the SSH Library
+ *
+ * Copyright (c) 2019 by Red Hat, Inc.
+ *
+ * Author: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
+ *
+ * The SSH 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.
+ *
+ * The SSH 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 the SSH Library; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA.
+ */
+
+#ifndef BIND_CONFIG_H_
+#define BIND_CONFIG_H_
+
+#include "libssh/server.h"
+
+enum ssh_bind_config_opcode_e {
+ /* Unknown opcode */
+ BIND_CFG_UNKNOWN = -3,
+ /* Known and not applicable to libssh */
+ BIND_CFG_NA = -2,
+ /* Known but not supported by current libssh version */
+ BIND_CFG_UNSUPPORTED = -1,
+ BIND_CFG_INCLUDE,
+ BIND_CFG_HOSTKEY,
+ BIND_CFG_LISTENADDRESS,
+ BIND_CFG_PORT,
+ BIND_CFG_LOGLEVEL,
+ BIND_CFG_CIPHERS,
+ BIND_CFG_MACS,
+ BIND_CFG_KEXALGORITHMS,
+
+ BIND_CFG_MAX /* Keep this one last in the list */
+};
+
+/* @brief Parse configuration file and set the options to the given ssh_bind
+ *
+ * @params[in] sshbind The ssh_bind context to be configured
+ * @params[in] filename The path to the configuration file
+ *
+ * @returns 0 on successful parsing the configuration file, -1 on error
+ */
+int ssh_bind_config_parse_file(ssh_bind sshbind, const char *filename);
+
+#endif /* BIND_CONFIG_H_ */