summaryrefslogtreecommitdiffhomepage
path: root/common-runopts.c
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2004-08-06 16:18:01 +0000
committerMatt Johnston <matt@ucc.asn.au>2004-08-06 16:18:01 +0000
commit0bbe2fa8627de1614b4b6992a7ee4290ec572e4d (patch)
tree77444ba92dd6eb2e6c968e2447647c35e1ea8f91 /common-runopts.c
parent68f816e8cf5d0ad253a4a20537ae2bda128e0893 (diff)
- client pubkey auth works
- rearrange the runopts code for client and server (hostkey reading is needed by both (if the client is doing pubkey auth. otherwise....)) --HG-- extra : convert_revision : 5420858803bfff1e27dfe7fa877ba6fdd747e0c5
Diffstat (limited to 'common-runopts.c')
-rw-r--r--common-runopts.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/common-runopts.c b/common-runopts.c
index 097ab12..2de036e 100644
--- a/common-runopts.c
+++ b/common-runopts.c
@@ -24,5 +24,34 @@
#include "includes.h"
#include "runopts.h"
+#include "signkey.h"
+#include "buffer.h"
+#include "dbutil.h"
+#include "auth.h"
runopts opts; /* GLOBAL */
+
+/* returns success or failure, and the keytype in *type. If we want
+ * to restrict the type, type can contain a type to return */
+int readhostkey(const char * filename, sign_key * hostkey, int *type) {
+
+ int ret = DROPBEAR_FAILURE;
+ buffer *buf;
+
+ buf = buf_new(MAX_PRIVKEY_SIZE);
+
+ if (buf_readfile(buf, filename) == DROPBEAR_FAILURE) {
+ goto out;
+ }
+ buf_setpos(buf, 0);
+ if (buf_get_priv_key(buf, hostkey, type) == DROPBEAR_FAILURE) {
+ goto out;
+ }
+
+ ret = DROPBEAR_SUCCESS;
+out:
+
+ buf_burn(buf);
+ buf_free(buf);
+ return ret;
+}