1 #include <stdio.h>
2 #include <string.h>
3 #include <mosquitto.h>
4 #include <mosquitto_broker.h>
5 #include <mosquitto_plugin.h>
6 
mosquitto_auth_plugin_version(void)7 int mosquitto_auth_plugin_version(void)
8 {
9 	return MOSQ_AUTH_PLUGIN_VERSION;
10 }
11 
mosquitto_auth_plugin_init(void ** user_data,struct mosquitto_opt * auth_opts,int auth_opt_count)12 int mosquitto_auth_plugin_init(void **user_data, struct mosquitto_opt *auth_opts, int auth_opt_count)
13 {
14 	return MOSQ_ERR_SUCCESS;
15 }
16 
mosquitto_auth_plugin_cleanup(void * user_data,struct mosquitto_opt * auth_opts,int auth_opt_count)17 int mosquitto_auth_plugin_cleanup(void *user_data, struct mosquitto_opt *auth_opts, int auth_opt_count)
18 {
19 	return MOSQ_ERR_SUCCESS;
20 }
21 
mosquitto_auth_security_init(void * user_data,struct mosquitto_opt * auth_opts,int auth_opt_count,bool reload)22 int mosquitto_auth_security_init(void *user_data, struct mosquitto_opt *auth_opts, int auth_opt_count, bool reload)
23 {
24 	return MOSQ_ERR_SUCCESS;
25 }
26 
mosquitto_auth_security_cleanup(void * user_data,struct mosquitto_opt * auth_opts,int auth_opt_count,bool reload)27 int mosquitto_auth_security_cleanup(void *user_data, struct mosquitto_opt *auth_opts, int auth_opt_count, bool reload)
28 {
29 	return MOSQ_ERR_SUCCESS;
30 }
31 
mosquitto_auth_acl_check(void * user_data,int access,struct mosquitto * client,const struct mosquitto_acl_msg * msg)32 int mosquitto_auth_acl_check(void *user_data, int access, struct mosquitto *client, const struct mosquitto_acl_msg *msg)
33 {
34 	if(access == MOSQ_ACL_SUBSCRIBE){
35 		return MOSQ_ERR_ACL_DENIED;
36 	}else{
37 		return MOSQ_ERR_SUCCESS;
38 	}
39 }
40 
mosquitto_auth_unpwd_check(void * user_data,struct mosquitto * client,const char * username,const char * password)41 int mosquitto_auth_unpwd_check(void *user_data, struct mosquitto *client, const char *username, const char *password)
42 {
43 	return MOSQ_ERR_SUCCESS;
44 }
45 
mosquitto_auth_psk_key_get(void * user_data,struct mosquitto * client,const char * hint,const char * identity,char * key,int max_key_len)46 int mosquitto_auth_psk_key_get(void *user_data, struct mosquitto *client, const char *hint, const char *identity, char *key, int max_key_len)
47 {
48 	return MOSQ_ERR_AUTH;
49 }
50