Commit Graph

27 Commits

Author SHA1 Message Date
Stefan Siegel d74392c365 Pass char* to Go and convert with C.GoString, avoiding unsafe use
Using the char* passed by Mosquitto in a GoString struct is unsafe.
The memory it points to is managed by Mosquitto, but Go will keep the
pointer around for an indefinite duration, even when Mosquitto might
free the memory.

By passing the actual char* to Go, we can use C.GoString to convert it,
which copies the bytes into a buffer managed by Go. That way we can use
it safely at any time in the future.
2023-06-11 18:50:31 +02:00
Paul Traylor 5dc063f104
Add user-agent to requests (#176)
* Add default 'mosquitto' user-agent to http/jwt requests

* Add libmosquitto version ofr http and jwt remote user agent.

Add more room for extended versions.

Co-authored-by: Ignacio Gómez <iegomez@uc.cl>
2021-07-11 21:52:22 -04:00
Pierre Fersing e2f384916c Use switch and cover all plugin possible reply 2021-02-13 13:59:07 +01:00
Pierre Fersing 4be4a085d8 Merge branch 'master' into backend-error 2021-02-11 16:04:00 +01:00
Manuel Maurer bbfd75559f Fix include order for mosquitto 2.x 2021-01-12 20:34:00 +01:00
Pierre Fersing dc1edd8963 Improve handling of backend failure
* No longer cache response from backend when the backend fail.
* Reply to Mosquitto using "MOSQ_ERR_UNKNOWN" which will disconnect
  client and avoid silent data loss when the error occure for ACL
  checks.
2020-11-13 17:04:34 +01:00
Ignacio Gómez 1762e1a5ee Fix indentation. 2020-10-23 20:17:46 -03:00
Ignacio Gómez 4a8e33fcf1 Fix indentation. 2020-10-23 20:17:24 -03:00
Ignacio Gómez 838fd670e4 Check if plugin version is defined to return the right version. 2020-10-23 20:10:19 -03:00
Ignacio Gómez 65287cd288
Define MOSQ_AUTH_PLUGIN_VERSION if not defined to support 1.4.x and older versions. 2020-10-22 20:49:20 -03:00
Ignacio Gómez 70c0cacf58
Return version 4 to support new interface. 2020-10-07 20:06:58 -03:00
Ignacio Gómez 0e39a99963
Finish getuser clientid support. 2020-02-21 23:27:51 -03:00
Ignacio Gómez 4ce413ab81 Add 1.6 support (MOSQ_AUTH_PLUGIN_VERSION 4). 2019-05-02 09:43:34 -04:00
Ignacio Gómez 042687d17b Mosquitto 1.5.x support by exporting flags. 2018-10-11 16:13:01 -03:00
Ignacio Gómez 1bf4f1b864 Checking why mosquitto_broker isn't getting included. 2018-10-04 18:32:45 -03:00
Ignacio Gómez 4ad5744919 Added broker import. 2018-10-04 18:23:50 -03:00
Ignacio Gómez 03d81e082b Handle new acl msg and client for 1.5 2018-10-04 18:20:40 -03:00
Ignacio Gómez 998923fd8f Testing support for mosquitto 1.5 > 2018-10-04 18:15:22 -03:00
Ignacio Gómez 3ec9ac5b9f Remove C logging. 2018-09-29 15:22:44 -03:00
Ignacio Gómez 173da5f400 Specific ACL message for debugging. 2018-03-06 15:51:59 -03:00
Ignacio Gómez d5f9f7b254 ACL debug messages. 2018-03-06 11:28:40 -03:00
Ignacio Gómez 44fdcb8769 Fixed auth error response. 2018-02-06 11:31:08 -03:00
Ignacio Gómez bbe2e6b42a Included plugin cleanup on mosquitto halt. 2018-01-09 12:13:18 -03:00
Ignacio Gómez 00737c22a1 Opts passed as char* arrays. 2017-11-22 23:26:40 -03:00
Ignacio Gómez f40e332947 Tetsing void pointer from C to Go. 2017-11-22 22:08:37 -03:00
Ignacio Gómez a79f0da256 Passing params. 2017-11-16 20:53:26 -03:00
Ignacio Gómez 6c2954f40a Mocking up functions. 2017-11-15 22:00:45 -03:00