From dc835960a2773485094306b557e5fc2aa1f43c60 Mon Sep 17 00:00:00 2001 From: Michael Steinert Date: Thu, 29 Nov 2012 12:08:59 -0700 Subject: Set the client key/cert in one API call It doesn't make much sense to have separate APIs to set the client key/cert pair. This change also make it easier to port to other backends. Signed-off-by: Michael Steinert --- examples/amqps_bind.c | 9 +-------- examples/amqps_consumer.c | 9 +-------- examples/amqps_exchange_declare.c | 9 +-------- examples/amqps_listen.c | 9 +-------- examples/amqps_listenq.c | 9 +-------- examples/amqps_producer.c | 9 +-------- examples/amqps_sendstring.c | 9 +-------- examples/amqps_unbind.c | 9 +-------- 8 files changed, 8 insertions(+), 64 deletions(-) (limited to 'examples') diff --git a/examples/amqps_bind.c b/examples/amqps_bind.c index 04db414..050be73 100644 --- a/examples/amqps_bind.c +++ b/examples/amqps_bind.c @@ -75,15 +75,8 @@ int main(int argc, char const * const *argv) { } } - if (argc > 7) { - status = amqp_ssl_socket_set_key(socket, argv[7]); - if (status) { - die("setting client key"); - } - } - if (argc > 8) { - status = amqp_ssl_socket_set_cert(socket, argv[8]); + status = amqp_ssl_socket_set_key(socket, argv[8], argv[7]); if (status) { die("setting client cert"); } diff --git a/examples/amqps_consumer.c b/examples/amqps_consumer.c index 86c9d9f..cccbe33 100644 --- a/examples/amqps_consumer.c +++ b/examples/amqps_consumer.c @@ -147,15 +147,8 @@ int main(int argc, char const * const *argv) { } } - if (argc > 4) { - status = amqp_ssl_socket_set_key(socket, argv[4]); - if (status) { - die("setting client key/cert"); - } - } - if (argc > 5) { - status = amqp_ssl_socket_set_cert(socket, argv[5]); + status = amqp_ssl_socket_set_key(socket, argv[5], argv[4]); if (status) { die("setting client key"); } diff --git a/examples/amqps_exchange_declare.c b/examples/amqps_exchange_declare.c index 12c814b..bcf30b1 100644 --- a/examples/amqps_exchange_declare.c +++ b/examples/amqps_exchange_declare.c @@ -73,15 +73,8 @@ int main(int argc, char const * const *argv) { } } - if (argc > 6) { - status = amqp_ssl_socket_set_key(socket, argv[6]); - if (status) { - die("setting client key/cert"); - } - } - if (argc > 7) { - status = amqp_ssl_socket_set_cert(socket, argv[7]); + status = amqp_ssl_socket_set_key(socket, argv[7], argv[6]); if (status) { die("setting client key/cert"); } diff --git a/examples/amqps_listen.c b/examples/amqps_listen.c index 876bad9..25f8371 100644 --- a/examples/amqps_listen.c +++ b/examples/amqps_listen.c @@ -77,15 +77,8 @@ int main(int argc, char const * const *argv) { } } - if (argc > 6) { - status = amqp_ssl_socket_set_key(socket, argv[6]); - if (status) { - die("setting client key"); - } - } - if (argc > 7) { - status = amqp_ssl_socket_set_cert(socket, argv[7]); + status = amqp_ssl_socket_set_key(socket, argv[7], argv[6]); if (status) { die("setting client cert"); } diff --git a/examples/amqps_listenq.c b/examples/amqps_listenq.c index 9d910c9..2bb1760 100644 --- a/examples/amqps_listenq.c +++ b/examples/amqps_listenq.c @@ -73,15 +73,8 @@ int main(int argc, char const * const *argv) { } } - if (argc > 5) { - status = amqp_ssl_socket_set_key(socket, argv[5]); - if (status) { - die("setting client key"); - } - } - if (argc > 6) { - status = amqp_ssl_socket_set_cert(socket, argv[5]); + status = amqp_ssl_socket_set_key(socket, argv[6], argv[5]); if (status) { die("setting client cert"); } diff --git a/examples/amqps_producer.c b/examples/amqps_producer.c index 18f0b3f..866f8f8 100644 --- a/examples/amqps_producer.c +++ b/examples/amqps_producer.c @@ -137,15 +137,8 @@ int main(int argc, char const * const *argv) { } } - if (argc > 6) { - status = amqp_ssl_socket_set_key(socket, argv[6]); - if (status) { - die("setting client key"); - } - } - if (argc > 7) { - status = amqp_ssl_socket_set_cert(socket, argv[7]); + status = amqp_ssl_socket_set_key(socket, argv[7], argv[6]); if (status) { die("setting client cert"); } diff --git a/examples/amqps_sendstring.c b/examples/amqps_sendstring.c index 1133dcf..c1f10df 100644 --- a/examples/amqps_sendstring.c +++ b/examples/amqps_sendstring.c @@ -75,15 +75,8 @@ int main(int argc, char const * const *argv) { } } - if (argc > 7) { - status = amqp_ssl_socket_set_key(socket, argv[7]); - if (status) { - die("setting client key"); - } - } - if (argc > 8) { - status = amqp_ssl_socket_set_cert(socket, argv[8]); + status = amqp_ssl_socket_set_key(socket, argv[8], argv[7]); if (status) { die("setting client cert"); } diff --git a/examples/amqps_unbind.c b/examples/amqps_unbind.c index 5c8a4b5..58a6730 100644 --- a/examples/amqps_unbind.c +++ b/examples/amqps_unbind.c @@ -75,15 +75,8 @@ int main(int argc, char const * const *argv) { } } - if (argc > 7) { - status = amqp_ssl_socket_set_key(socket, argv[7]); - if (status) { - die("setting client key"); - } - } - if (argc > 8) { - status = amqp_ssl_socket_set_cert(socket, argv[8]); + status = amqp_ssl_socket_set_key(socket, argv[8], argv[7]); if (status) { die("setting client cert"); } -- cgit v1.2.1