diff options
author | Andreas Schneider <mail@cynapses.org> | 2010-03-28 23:46:34 +0200 |
---|---|---|
committer | Andreas Schneider <mail@cynapses.org> | 2010-03-28 23:46:56 +0200 |
commit | b5eb08ad09abe726d5c973f8437ab60b1190b258 (patch) | |
tree | 9697b6ddde23d39f9738b076b4e9365d94aa2ada /tests/unittests/torture_keyfiles.c | |
parent | 3ce7d7a28c057bbe72f55d221657fd0d6d54f246 (diff) | |
download | libssh-b5eb08ad09abe726d5c973f8437ab60b1190b258.tar.gz libssh-b5eb08ad09abe726d5c973f8437ab60b1190b258.tar.xz libssh-b5eb08ad09abe726d5c973f8437ab60b1190b258.zip |
Fixed the torture_keyfiles test.
Diffstat (limited to 'tests/unittests/torture_keyfiles.c')
-rw-r--r-- | tests/unittests/torture_keyfiles.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/tests/unittests/torture_keyfiles.c b/tests/unittests/torture_keyfiles.c index b8418ecf..a98ade29 100644 --- a/tests/unittests/torture_keyfiles.c +++ b/tests/unittests/torture_keyfiles.c @@ -8,19 +8,24 @@ ssh_session session; +#if 0 static void setup(void) { session = ssh_new(); } +#endif static void setup_rsa_key(void) { + int rc; + unlink(LIBSSH_RSA_TESTKEY); unlink(LIBSSH_RSA_TESTKEY ".pub"); - system("ssh-keygen -t rsa -N \"\" -f " LIBSSH_RSA_TESTKEY); + rc = system("ssh-keygen -t rsa -N \"\" -f " LIBSSH_RSA_TESTKEY); session = ssh_new(); } +#if 0 static void setup_dsa_key(void) { unlink(LIBSSH_DSA_TESTKEY); unlink(LIBSSH_DSA_TESTKEY ".pub"); @@ -29,6 +34,7 @@ static void setup_dsa_key(void) { session = ssh_new(); } +#endif static void teardown(void) { unlink(LIBSSH_DSA_TESTKEY); @@ -122,7 +128,10 @@ START_TEST (torture_pubkey_generate_from_privkey) publickey_free(pubkey); ck_assert(pubkey_new != NULL); - ck_assert(memcmp(pubkey_orig->string, pubkey_new->string, pubkey_orig->size)); + + ck_assert(string_len(pubkey_orig) == string_len(pubkey_new)); + ck_assert(memcmp(string_data(pubkey_orig), string_data(pubkey_new), + string_len(pubkey_orig)) == 0); rc = ssh_publickey_to_file(session, LIBSSH_RSA_TESTKEY ".pub", pubkey_new, type_new); ck_assert(rc == 0); |