summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBhasker Allam <abr5427@gmail.com>2015-04-04 14:49:08 -0700
committerAlan Antonuk <alan.antonuk@gmail.com>2015-04-05 23:37:23 -0700
commitce0ce3a6cb3405d7bcbfbb497023a3f9e1630318 (patch)
tree09496535bd56e99fcff077d757571e3d560ca597
parenta16ad45bdd44f3a71ec7e5d7099ee075817285c9 (diff)
downloadrabbitmq-c-ce0ce3a6cb3405d7bcbfbb497023a3f9e1630318.tar.gz
Add error codes for unsupported SASL type.
Add error codes and associated error strings when the broker does not support the desired SASL method.
-rw-r--r--librabbitmq/amqp.h1
-rw-r--r--librabbitmq/amqp_api.c3
-rw-r--r--librabbitmq/amqp_socket.c1
3 files changed, 4 insertions, 1 deletions
diff --git a/librabbitmq/amqp.h b/librabbitmq/amqp.h
index 1473ccd..fae2658 100644
--- a/librabbitmq/amqp.h
+++ b/librabbitmq/amqp.h
@@ -634,6 +634,7 @@ typedef struct amqp_rpc_reply_t_ {
* \since v0.1
*/
typedef enum amqp_sasl_method_enum_ {
+ AMQP_SASL_METHOD_UNDEFINED = -1, /**< Invalid SASL method */
AMQP_SASL_METHOD_PLAIN = 0, /**< the PLAIN SASL method for authentication to the broker */
AMQP_SASL_METHOD_EXTERNAL = 1 /**< the EXTERNAL SASL method for authentication to the broker */
} amqp_sasl_method_enum;
diff --git a/librabbitmq/amqp_api.c b/librabbitmq/amqp_api.c
index 0516c02..79e78c5 100644
--- a/librabbitmq/amqp_api.c
+++ b/librabbitmq/amqp_api.c
@@ -75,7 +75,8 @@ static const char *base_error_strings[] = {
"heartbeat timeout, connection closed",/* AMQP_STATUS_HEARTBEAT_TIMEOUT -0x000F */
"unexpected protocol state", /* AMQP_STATUS_UNEXPECTED STATE -0x0010 */
"socket is closed", /* AMQP_STATUS_SOCKET_CLOSED -0x0011 */
- "socket already open" /* AMQP_STATUS_SOCKET_INUSE -0x0012 */
+ "socket already open", /* AMQP_STATUS_SOCKET_INUSE -0x0012 */
+ "unsupported sasl method requested" /* AMQP_STATUS_BROKER_UNSUPPORTED_SASL_METHOD -0x0013 */
};
static const char *tcp_error_strings[] = {
diff --git a/librabbitmq/amqp_socket.c b/librabbitmq/amqp_socket.c
index b789784..03a8161 100644
--- a/librabbitmq/amqp_socket.c
+++ b/librabbitmq/amqp_socket.c
@@ -494,6 +494,7 @@ static int bytes_equal(amqp_bytes_t l, amqp_bytes_t r)
}
return 0;
}
+
static int sasl_mechanism_in_list(amqp_bytes_t mechanisms,
amqp_sasl_method_enum method)
{