aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2013-11-15 15:48:19 +0100
committerAndreas Schneider <asn@cryptomilk.org>2013-11-15 16:29:49 +0100
commitf5d1d813fb6dac5771bead197c2528dd46eab7b3 (patch)
treea49d5f2bb4a5055c750c2de47822d7e898a70615
parent92928a7d8d4a2873ba1d26450e97f4435791ebc8 (diff)
downloadlibssh-f5d1d813fb6dac5771bead197c2528dd46eab7b3.tar.gz
libssh-f5d1d813fb6dac5771bead197c2528dd46eab7b3.tar.xz
libssh-f5d1d813fb6dac5771bead197c2528dd46eab7b3.zip
options: Add SSH_OPTIONS_GSSAPI_CLIENT_IDENTITY option.
-rw-r--r--include/libssh/libssh.h3
-rw-r--r--include/libssh/session.h1
-rw-r--r--src/options.c18
-rw-r--r--src/session.c1
4 files changed, 22 insertions, 1 deletions
diff --git a/include/libssh/libssh.h b/include/libssh/libssh.h
index 25923e13..d71a6936 100644
--- a/include/libssh/libssh.h
+++ b/include/libssh/libssh.h
@@ -332,7 +332,8 @@ enum ssh_options_e {
SSH_OPTIONS_COMPRESSION_LEVEL,
SSH_OPTIONS_KEY_EXCHANGE,
SSH_OPTIONS_HOSTKEYS,
- SSH_OPTIONS_GSSAPI_SERVER_IDENTITY
+ SSH_OPTIONS_GSSAPI_SERVER_IDENTITY,
+ SSH_OPTIONS_GSSAPI_CLIENT_IDENTITY
};
enum {
diff --git a/include/libssh/session.h b/include/libssh/session.h
index d3ca4086..86f94dfa 100644
--- a/include/libssh/session.h
+++ b/include/libssh/session.h
@@ -184,6 +184,7 @@ struct ssh_session_struct {
int ssh1;
char compressionlevel;
char *gss_server_identity;
+ char *gss_client_identity;
} opts;
};
diff --git a/src/options.c b/src/options.c
index d43e25d4..4791e156 100644
--- a/src/options.c
+++ b/src/options.c
@@ -371,6 +371,10 @@ int ssh_options_set_algo(ssh_session session, int algo,
* Set it to specify the GSSAPI server identity that libssh
* should expect when connecting to the server (const char *).
*
+ * - SSH_OPTIONS_GSSAPI_CLIENT_IDENTITY
+ * Set it to specify the GSSAPI client identity that libssh
+ * should expect when connecting to the server (const char *).
+ *
* @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.
@@ -810,6 +814,20 @@ int ssh_options_set(ssh_session session, enum ssh_options_e type,
}
}
break;
+ case SSH_OPTIONS_GSSAPI_CLIENT_IDENTITY:
+ v = value;
+ if (v == NULL || v[0] == '\0') {
+ ssh_set_error_invalid(session);
+ return -1;
+ } else {
+ SAFE_FREE(session->opts.gss_client_identity);
+ session->opts.gss_client_identity = strdup(v);
+ if (session->opts.gss_client_identity == NULL) {
+ ssh_set_error_oom(session);
+ return -1;
+ }
+ }
+ break;
default:
ssh_set_error(session, SSH_REQUEST_DENIED, "Unknown ssh option %d", type);
return -1;
diff --git a/src/session.c b/src/session.c
index d0691106..ebf48d8d 100644
--- a/src/session.c
+++ b/src/session.c
@@ -266,6 +266,7 @@ void ssh_free(ssh_session session) {
SAFE_FREE(session->opts.knownhosts);
SAFE_FREE(session->opts.ProxyCommand);
SAFE_FREE(session->opts.gss_server_identity);
+ SAFE_FREE(session->opts.gss_client_identity);
for (i = 0; i < 10; i++) {
if (session->opts.wanted_methods[i]) {