From b11b0b206c3f248056518adc387a72e3b7a037c1 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Thu, 8 Sep 2022 23:49:46 +0100 Subject: [PATCH] Function naming consistency --- src/handle_connect.c | 2 +- src/mosquitto_broker_internal.h | 2 +- src/plugin_basic_auth.c | 8 ++++---- src/security_default.c | 14 +++++++------- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/handle_connect.c b/src/handle_connect.c index cc89d58a..2abc4155 100644 --- a/src/handle_connect.c +++ b/src/handle_connect.c @@ -977,7 +977,7 @@ int handle__connect(struct mosquitto *context) }else #endif { - rc = mosquitto_unpwd_check(context); + rc = mosquitto_basic_auth(context); switch(rc){ case MOSQ_ERR_SUCCESS: break; diff --git a/src/mosquitto_broker_internal.h b/src/mosquitto_broker_internal.h index 689e1e18..50d1ba49 100644 --- a/src/mosquitto_broker_internal.h +++ b/src/mosquitto_broker_internal.h @@ -916,7 +916,7 @@ int mosquitto_security_module_cleanup(void); int mosquitto_security_init(bool reload); int mosquitto_security_cleanup(bool reload); int mosquitto_acl_check(struct mosquitto *context, const char *topic, uint32_t payloadlen, void* payload, uint8_t qos, bool retain, int access); -int mosquitto_unpwd_check(struct mosquitto *context); +int mosquitto_basic_auth(struct mosquitto *context); int mosquitto_psk_key_get(struct mosquitto *context, const char *hint, const char *identity, char *key, int max_key_len); int mosquitto_security_init_default(bool reload); diff --git a/src/plugin_basic_auth.c b/src/plugin_basic_auth.c index 5d0e2224..97ce865d 100644 --- a/src/plugin_basic_auth.c +++ b/src/plugin_basic_auth.c @@ -28,7 +28,7 @@ Contributors: #include "lib_load.h" #include "utlist.h" -static int plugin__unpwd_check(struct mosquitto__security_options *opts, struct mosquitto *context) +static int plugin__basic_auth(struct mosquitto__security_options *opts, struct mosquitto *context) { struct mosquitto_evt_basic_auth event_data; struct mosquitto__callback *cb_base; @@ -53,14 +53,14 @@ static int plugin__unpwd_check(struct mosquitto__security_options *opts, struct } -int mosquitto_unpwd_check(struct mosquitto *context) +int mosquitto_basic_auth(struct mosquitto *context) { int rc; bool plugin_used = false; /* Global plugins */ if(db.config->security_options.plugin_callbacks.basic_auth){ - rc = plugin__unpwd_check(&db.config->security_options, context); + rc = plugin__basic_auth(&db.config->security_options, context); if(rc == MOSQ_ERR_PLUGIN_IGNORE){ /* Do nothing */ @@ -77,7 +77,7 @@ int mosquitto_unpwd_check(struct mosquitto *context) return MOSQ_ERR_AUTH; } if(context->listener->security_options.plugin_callbacks.basic_auth){ - rc = plugin__unpwd_check(&context->listener->security_options, context); + rc = plugin__basic_auth(&context->listener->security_options, context); if(rc == MOSQ_ERR_PLUGIN_IGNORE){ /* Do nothing */ diff --git a/src/security_default.c b/src/security_default.c index c1ad1cfc..07227be7 100644 --- a/src/security_default.c +++ b/src/security_default.c @@ -38,7 +38,7 @@ static int psk__file_parse(struct mosquitto__unpwd **psk_id, const char *psk_fil #ifdef WITH_TLS static int pw__digest(const char *password, const unsigned char *salt, unsigned int salt_len, unsigned char *hash, unsigned int *hash_len, enum mosquitto_pwhash_type hashtype, int iterations); #endif -static int mosquitto_unpwd_check_default(int event, void *event_data, void *userdata); +static int mosquitto_basic_auth_default(int event, void *event_data, void *userdata); static int mosquitto_acl_check_default(int event, void *event_data, void *userdata); @@ -81,7 +81,7 @@ int mosquitto_security_init_default(bool reload) return rc; } mosquitto_callback_register(db.config->listeners[i].security_options.pid, - MOSQ_EVT_BASIC_AUTH, mosquitto_unpwd_check_default, NULL, NULL); + MOSQ_EVT_BASIC_AUTH, mosquitto_basic_auth_default, NULL, NULL); } } }else{ @@ -95,7 +95,7 @@ int mosquitto_security_init_default(bool reload) } } mosquitto_callback_register(db.config->security_options.pid, - MOSQ_EVT_BASIC_AUTH, mosquitto_unpwd_check_default, NULL, NULL); + MOSQ_EVT_BASIC_AUTH, mosquitto_basic_auth_default, NULL, NULL); } } @@ -182,7 +182,7 @@ int mosquitto_security_cleanup_default(bool reload) for(i=0; ilistener_count; i++){ if(db.config->listeners[i].security_options.pid){ mosquitto_callback_unregister(db.config->listeners[i].security_options.pid, - MOSQ_EVT_BASIC_AUTH, mosquitto_unpwd_check_default, NULL); + MOSQ_EVT_BASIC_AUTH, mosquitto_basic_auth_default, NULL); mosquitto_callback_unregister(db.config->listeners[i].security_options.pid, MOSQ_EVT_ACL_CHECK, mosquitto_acl_check_default, NULL); @@ -192,7 +192,7 @@ int mosquitto_security_cleanup_default(bool reload) }else{ if(db.config->security_options.pid){ mosquitto_callback_unregister(db.config->security_options.pid, - MOSQ_EVT_BASIC_AUTH, mosquitto_unpwd_check_default, NULL); + MOSQ_EVT_BASIC_AUTH, mosquitto_basic_auth_default, NULL); mosquitto_callback_unregister(db.config->security_options.pid, MOSQ_EVT_ACL_CHECK, mosquitto_acl_check_default, NULL); @@ -935,7 +935,7 @@ static int psk__file_parse(struct mosquitto__unpwd **psk_id, const char *psk_fil } -static int mosquitto_unpwd_check_default(int event, void *event_data, void *userdata) +static int mosquitto_basic_auth_default(int event, void *event_data, void *userdata) { struct mosquitto_evt_basic_auth *ed = event_data; struct mosquitto__unpwd *u; @@ -1195,7 +1195,7 @@ int mosquitto_security_apply_default(void) #endif { /* Username/password check only if the identity/subject check not used */ - if(mosquitto_unpwd_check(context) != MOSQ_ERR_SUCCESS){ + if(mosquitto_basic_auth(context) != MOSQ_ERR_SUCCESS){ mosquitto__set_state(context, mosq_cs_disconnecting); do_disconnect(context, MOSQ_ERR_AUTH); continue;