diff cli-authpubkey.c @ 552:de3653483ac0 agent-client

- Client auth using an agent's key works. Still need to implement client agent forwarding.
author Matt Johnston <matt@ucc.asn.au>
date Mon, 06 Jul 2009 14:02:45 +0000
parents c3f2ec71e3d4
children 52d7301e46bd
line wrap: on
line diff
--- a/cli-authpubkey.c	Mon Jul 06 12:59:13 2009 +0000
+++ b/cli-authpubkey.c	Mon Jul 06 14:02:45 2009 +0000
@@ -174,7 +174,7 @@
 		sigbuf = buf_new(4 + SHA1_HASH_SIZE + ses.writepayload->len);
 		buf_putstring(sigbuf, ses.session_id, SHA1_HASH_SIZE);
 		buf_putbytes(sigbuf, ses.writepayload->data, ses.writepayload->len);
-		buf_put_sign(ses.writepayload, key, type, sigbuf->data, sigbuf->len);
+		cli_buf_put_sign(ses.writepayload, key, type, sigbuf->data, sigbuf->len);
 		buf_free(sigbuf); /* Nothing confidential in the buffer */
 	}
 
@@ -202,8 +202,22 @@
 		TRACE(("leave cli_auth_pubkey-success"))
 		return 1;
 	} else {
+		/* no more keys left */
 		TRACE(("leave cli_auth_pubkey-failure"))
 		return 0;
 	}
 }
+
+void cli_auth_pubkey_cleanup() {
+
+#ifdef ENABLE_CLI_AGENTFWD
+	m_close(cli_opts.agent_fd);
+	cli_opts.agent_fd = -1;
+#endif
+
+	while (cli_opts.privkeys->first) {
+		sign_key * key = list_remove(cli_opts.privkeys->first);
+		sign_key_free(key);
+	}
+}
 #endif /* Pubkey auth */