aboutsummaryrefslogtreecommitdiff
path: root/include/libssh
diff options
context:
space:
mode:
authorJakub Jelen <jjelen@redhat.com>2018-12-05 12:09:07 +0100
committerAndreas Schneider <asn@cryptomilk.org>2018-12-07 14:08:27 +0100
commit21e252236018ce10958b0623837a48f354d5b155 (patch)
tree05ff6fcf631dbc147bd232f1eda5d7311acb1daa /include/libssh
parent8f887e82c75a92942dea903d9239981f20136efb (diff)
downloadlibssh-21e252236018ce10958b0623837a48f354d5b155.tar.gz
libssh-21e252236018ce10958b0623837a48f354d5b155.tar.xz
libssh-21e252236018ce10958b0623837a48f354d5b155.zip
config: Get rid of the dynamic seen array
* This makes the array constant in the session structure, avoiding allocations and frees while parsing the file * It also drops passing the seen array to all the functions, because it is already part of the passed session * The test cases are adjusted to match these changes Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'include/libssh')
-rw-r--r--include/libssh/config.h66
-rw-r--r--include/libssh/session.h3
2 files changed, 68 insertions, 1 deletions
diff --git a/include/libssh/config.h b/include/libssh/config.h
new file mode 100644
index 00000000..ce78f4ef
--- /dev/null
+++ b/include/libssh/config.h
@@ -0,0 +1,66 @@
+/*
+ * config.h - parse the ssh config file
+ *
+ * This file is part of the SSH Library
+ *
+ * Copyright (c) 2009-2018 by Andreas Schneider <asn@cryptomilk.org>
+ *
+ * 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 LIBSSH_CONFIG_H_
+#define LIBSSH_CONFIG_H_
+
+
+enum ssh_config_opcode_e {
+ /* Unknown opcode */
+ SOC_UNKNOWN = -3,
+ /* Known and not applicable to libssh */
+ SOC_NA = -2,
+ /* Known but not supported by current libssh version */
+ SOC_UNSUPPORTED = -1,
+ SOC_HOST,
+ SOC_MATCH,
+ SOC_HOSTNAME,
+ SOC_PORT,
+ SOC_USERNAME,
+ SOC_IDENTITY,
+ SOC_CIPHERS,
+ SOC_MACS,
+ SOC_COMPRESSION,
+ SOC_TIMEOUT,
+ SOC_PROTOCOL,
+ SOC_STRICTHOSTKEYCHECK,
+ SOC_KNOWNHOSTS,
+ SOC_PROXYCOMMAND,
+ SOC_GSSAPISERVERIDENTITY,
+ SOC_GSSAPICLIENTIDENTITY,
+ SOC_GSSAPIDELEGATECREDENTIALS,
+ SOC_INCLUDE,
+ SOC_BINDADDRESS,
+ SOC_GLOBALKNOWNHOSTSFILE,
+ SOC_LOGLEVEL,
+ SOC_HOSTKEYALGORITHMS,
+ SOC_KEXALGORITHMS,
+ SOC_GSSAPIAUTHENTICATION,
+ SOC_KBDINTERACTIVEAUTHENTICATION,
+ SOC_PASSWORDAUTHENTICATION,
+ SOC_PUBKEYAUTHENTICATION,
+ SOC_PUBKEYACCEPTEDTYPES,
+
+ SOC_MAX /* Keep this one last in the list */
+};
+#endif /* LIBSSH_CONFIG_H_ */
diff --git a/include/libssh/session.h b/include/libssh/session.h
index c846dc47..f0ad951b 100644
--- a/include/libssh/session.h
+++ b/include/libssh/session.h
@@ -29,6 +29,7 @@
#include "libssh/auth.h"
#include "libssh/channels.h"
#include "libssh/poll.h"
+#include "libssh/config.h"
/* These are the different states a SSH session can be into its life */
enum ssh_session_state_e {
@@ -220,7 +221,7 @@ struct ssh_session_struct {
int flags;
int nodelay;
bool config_processed;
- uint8_t *options_seen;
+ uint8_t options_seen[SOC_MAX];
} opts;
/* counters */
ssh_counter socket_counter;