aboutsummaryrefslogtreecommitdiff
path: root/src/options.c
diff options
context:
space:
mode:
authorAris Adamantiadis <aris@0xbadc0de.be>2014-08-03 22:29:49 +0200
committerAndreas Schneider <asn@cryptomilk.org>2017-12-15 12:00:49 +0100
commitf818e63f8f3efaea3daf737d280450209c806541 (patch)
tree4b0067b810f9c67d4d4f88f80f18a35a72acb55d /src/options.c
parent094aa5eb024582d23b8e0cd5ebfea3cb29ed188d (diff)
downloadlibssh-f818e63f8f3efaea3daf737d280450209c806541.tar.gz
libssh-f818e63f8f3efaea3daf737d280450209c806541.tar.xz
libssh-f818e63f8f3efaea3daf737d280450209c806541.zip
Add new options
Pair-Programmed-With: Jakub Jelen <jjelen@redhat.com> Signed-off-by: Aris Adamantiadis <aris@0xbadc0de.be> Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'src/options.c')
-rw-r--r--src/options.c61
1 files changed, 61 insertions, 0 deletions
diff --git a/src/options.c b/src/options.c
index 9346b6d1..0bc15497 100644
--- a/src/options.c
+++ b/src/options.c
@@ -374,6 +374,28 @@ int ssh_options_set_algo(ssh_session session,
* Set it to specify that GSSAPI should delegate credentials
* to the server (int, 0 = false).
*
+ * - SSH_OPTIONS_PASSWORD_AUTH
+ * Set it if password authentication should be used
+ * in ssh_userauth_auto_pubkey(). (int, 0=false).
+ * Currently without effect (ssh_userauth_auto_pubkey doesn't use
+ * password authentication).
+ *
+ * - SSH_OPTIONS_PUBKEY_AUTH
+ * Set it if pubkey authentication should be used
+ * in ssh_userauth_auto_pubkey(). (int, 0=false).
+ *
+ * - SSH_OPTIONS_KBDINT_AUTH
+ * Set it if keyboard-interactive authentication should be used
+ * in ssh_userauth_auto_pubkey(). (int, 0=false).
+ * Currently without effect (ssh_userauth_auto_pubkey doesn't use
+ * keyboard-interactive authentication).
+ *
+ * - SSH_OPTIONS_GSSAPI_AUTH
+ * Set it if gssapi authentication should be used
+ * in ssh_userauth_auto_pubkey(). (int, 0=false).
+ * Currently without effect (ssh_userauth_auto_pubkey doesn't use
+ * gssapi authentication).
+ *
* @param value The value to set. This is a generic pointer and the
* datatype which is used should be set according to the
* type set.
@@ -385,6 +407,7 @@ int ssh_options_set(ssh_session session, enum ssh_options_e type,
const char *v;
char *p, *q;
long int i;
+ unsigned int u;
int rc;
if (session == NULL) {
@@ -574,6 +597,20 @@ int ssh_options_set(ssh_session session, enum ssh_options_e type,
}
}
break;
+ case SSH_OPTIONS_GLOBAL_KNOWNHOSTS:
+ v = value;
+ SAFE_FREE(session->opts.global_knownhosts);
+ if (v == NULL || v[0] == '\0') {
+ ssh_set_error_invalid(session);
+ return -1;
+ } else {
+ session->opts.global_knownhosts = strdup(v);
+ if (session->opts.global_knownhosts == NULL) {
+ ssh_set_error_oom(session);
+ return -1;
+ }
+ }
+ break;
case SSH_OPTIONS_TIMEOUT:
if (value == NULL) {
ssh_set_error_invalid(session);
@@ -858,6 +895,30 @@ int ssh_options_set(ssh_session session, enum ssh_options_e type,
session->opts.gss_delegate_creds = (x & 0xff);
}
break;
+ case SSH_OPTIONS_PASSWORD_AUTH:
+ case SSH_OPTIONS_PUBKEY_AUTH:
+ case SSH_OPTIONS_KBDINT_AUTH:
+ case SSH_OPTIONS_GSSAPI_AUTH:
+ u = 0;
+ if (value == NULL) {
+ ssh_set_error_invalid(session);
+ return -1;
+ } else {
+ int x = *(int *)value;
+ u = type == SSH_OPTIONS_PASSWORD_AUTH ?
+ SSH_OPT_FLAG_PASSWORD_AUTH:
+ type == SSH_OPTIONS_PUBKEY_AUTH ?
+ SSH_OPT_FLAG_PUBKEY_AUTH:
+ type == SSH_OPTIONS_KBDINT_AUTH ?
+ SSH_OPT_FLAG_KBDINT_AUTH:
+ SSH_OPT_FLAG_GSSAPI_AUTH;
+ if (x != 0){
+ session->opts.flags |= u;
+ } else {
+ session->opts.flags &= ~u;
+ }
+ }
+ break;
default:
ssh_set_error(session, SSH_REQUEST_DENIED, "Unknown ssh option %d", type);