2015-06-29 22:31:39 +00:00
|
|
|
/*
|
2020-02-27 23:26:58 +00:00
|
|
|
Copyright (c) 2015-2020 Roger Light <roger@atchoo.org>
|
2015-06-29 22:31:39 +00:00
|
|
|
|
|
|
|
All rights reserved. This program and the accompanying materials
|
|
|
|
are made available under the terms of the Eclipse Public License v1.0
|
|
|
|
and Eclipse Distribution License v1.0 which accompany this distribution.
|
|
|
|
|
|
|
|
The Eclipse Public License is available at
|
|
|
|
http://www.eclipse.org/legal/epl-v10.html
|
|
|
|
and the Eclipse Distribution License is available at
|
|
|
|
http://www.eclipse.org/org/documents/edl-v10.php.
|
|
|
|
|
|
|
|
Contributors:
|
|
|
|
Roger Light - initial implementation and documentation.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* This is a skeleton authentication and access control plugin that simply defers all checks. */
|
|
|
|
|
2016-07-08 10:50:50 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include "mosquitto_broker.h"
|
2015-06-29 22:31:39 +00:00
|
|
|
#include "mosquitto_plugin.h"
|
|
|
|
#include "mosquitto.h"
|
|
|
|
|
|
|
|
int mosquitto_auth_plugin_version(void)
|
|
|
|
{
|
2020-09-30 08:43:53 +00:00
|
|
|
return 4;
|
2015-06-29 22:31:39 +00:00
|
|
|
}
|
|
|
|
|
2016-07-11 13:29:41 +00:00
|
|
|
int mosquitto_auth_plugin_init(void **user_data, struct mosquitto_opt *auth_opts, int auth_opt_count)
|
2015-06-29 22:31:39 +00:00
|
|
|
{
|
|
|
|
return MOSQ_ERR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2016-07-11 13:29:41 +00:00
|
|
|
int mosquitto_auth_plugin_cleanup(void *user_data, struct mosquitto_opt *auth_opts, int auth_opt_count)
|
2015-06-29 22:31:39 +00:00
|
|
|
{
|
|
|
|
return MOSQ_ERR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2016-07-11 13:29:41 +00:00
|
|
|
int mosquitto_auth_security_init(void *user_data, struct mosquitto_opt *auth_opts, int auth_opt_count, bool reload)
|
2015-06-29 22:31:39 +00:00
|
|
|
{
|
|
|
|
return MOSQ_ERR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2016-07-11 13:29:41 +00:00
|
|
|
int mosquitto_auth_security_cleanup(void *user_data, struct mosquitto_opt *auth_opts, int auth_opt_count, bool reload)
|
2015-06-29 22:31:39 +00:00
|
|
|
{
|
|
|
|
return MOSQ_ERR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2020-09-30 08:43:53 +00:00
|
|
|
int mosquitto_auth_acl_check(void *user_data, int access, struct mosquitto *client, const struct mosquitto_acl_msg *msg)
|
2015-06-29 22:31:39 +00:00
|
|
|
{
|
2016-07-08 10:50:50 +00:00
|
|
|
printf("mosquitto_acl_check(u:%s)\n", mosquitto_client_username(client));
|
2015-09-29 11:34:56 +00:00
|
|
|
return MOSQ_ERR_PLUGIN_DEFER;
|
2015-06-29 22:31:39 +00:00
|
|
|
}
|
|
|
|
|
2020-09-30 08:43:53 +00:00
|
|
|
int mosquitto_auth_unpwd_check(void *user_data, struct mosquitto *client, const char *username, const char *password)
|
2015-06-29 22:31:39 +00:00
|
|
|
{
|
2015-09-29 11:34:56 +00:00
|
|
|
return MOSQ_ERR_PLUGIN_DEFER;
|
2015-06-29 22:31:39 +00:00
|
|
|
}
|
|
|
|
|
2020-09-30 08:43:53 +00:00
|
|
|
int mosquitto_auth_psk_key_get(void *user_data, struct mosquitto *client, const char *hint, const char *identity, char *key, int max_key_len)
|
2015-06-29 22:31:39 +00:00
|
|
|
{
|
2015-09-29 11:34:56 +00:00
|
|
|
return MOSQ_ERR_PLUGIN_DEFER;
|
2015-06-29 22:31:39 +00:00
|
|
|
}
|
|
|
|
|