aboutsummaryrefslogtreecommitdiff
path: root/src/channels.c
diff options
context:
space:
mode:
authorAris Adamantiadis <aris@0xbadc0de.be>2013-03-13 22:08:49 +0100
committerAndreas Schneider <asn@cryptomilk.org>2013-07-13 14:55:58 +0200
commit7e306a9ec68558d74cf89160675094fe5d66e66c (patch)
tree3c7be3db2ec7edda8291a9cbb5e2870cf68e8eca /src/channels.c
parent81e769ec6a75c679694e6b7e6e1288ae63b96991 (diff)
downloadlibssh-7e306a9ec68558d74cf89160675094fe5d66e66c.tar.gz
libssh-7e306a9ec68558d74cf89160675094fe5d66e66c.tar.xz
libssh-7e306a9ec68558d74cf89160675094fe5d66e66c.zip
server: implement server-side of agent forwarding
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'src/channels.c')
-rw-r--r--src/channels.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/channels.c b/src/channels.c
index dd0f0ff1..0e514324 100644
--- a/src/channels.c
+++ b/src/channels.c
@@ -949,6 +949,40 @@ int ssh_channel_open_session(ssh_channel channel) {
}
/**
+ * @brief Open an agent authentication forwarding channel. This type of channel
+ * can be opened by a server towards a client in order to provide SSH-Agent services
+ * to the server-side process. This channel can only be opened if the client
+ * claimed support by sending a channel request beforehand.
+ *
+ * @param[in] channel An allocated channel.
+ *
+ * @return SSH_OK on success,
+ * SSH_ERROR if an error occurred,
+ * SSH_AGAIN if in nonblocking mode and call has
+ * to be done again.
+ *
+ * @see channel_open_forward()
+ */
+int ssh_channel_open_auth_agent(ssh_channel channel){
+ if(channel == NULL) {
+ return SSH_ERROR;
+ }
+
+#ifdef WITH_SSH1
+ if (channel->session->version == 1) {
+ return SSH_ERROR;
+ }
+#endif
+
+ return channel_open(channel,
+ "auth-agent",
+ CHANNEL_INITIAL_WINDOW,
+ CHANNEL_MAX_PACKET,
+ NULL);
+}
+
+
+/**
* @brief Open a TCP/IP forwarding channel.
*
* @param[in] channel An allocated channel.