Mercurial > dropbear
comparison common-runopts.c @ 47:4b53a43f0082
- 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....))
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Fri, 06 Aug 2004 16:18:01 +0000 |
parents | f789045062e6 |
children | 4edea9f363d0 |
comparison
equal
deleted
inserted
replaced
46:3bea78e1b175 | 47:4b53a43f0082 |
---|---|
22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | 22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
23 * SOFTWARE. */ | 23 * SOFTWARE. */ |
24 | 24 |
25 #include "includes.h" | 25 #include "includes.h" |
26 #include "runopts.h" | 26 #include "runopts.h" |
27 #include "signkey.h" | |
28 #include "buffer.h" | |
29 #include "dbutil.h" | |
30 #include "auth.h" | |
27 | 31 |
28 runopts opts; /* GLOBAL */ | 32 runopts opts; /* GLOBAL */ |
33 | |
34 /* returns success or failure, and the keytype in *type. If we want | |
35 * to restrict the type, type can contain a type to return */ | |
36 int readhostkey(const char * filename, sign_key * hostkey, int *type) { | |
37 | |
38 int ret = DROPBEAR_FAILURE; | |
39 buffer *buf; | |
40 | |
41 buf = buf_new(MAX_PRIVKEY_SIZE); | |
42 | |
43 if (buf_readfile(buf, filename) == DROPBEAR_FAILURE) { | |
44 goto out; | |
45 } | |
46 buf_setpos(buf, 0); | |
47 if (buf_get_priv_key(buf, hostkey, type) == DROPBEAR_FAILURE) { | |
48 goto out; | |
49 } | |
50 | |
51 ret = DROPBEAR_SUCCESS; | |
52 out: | |
53 | |
54 buf_burn(buf); | |
55 buf_free(buf); | |
56 return ret; | |
57 } |