[rabbitmq-discuss] Creating an auth plugin (Kerberos)
Simon MacMullen
simon at rabbitmq.com
Fri Nov 23 11:06:24 GMT 2012
On 22/11/12 16:14, Simon Lundström wrote:
> I'm starting to get somewhere now, still hitting walls = )
>
> Is there a reason why the module is named, e.g.,
> rabbit_auth_backend_kerberos and that the folder/plugin is named, e.g.,
> rabbitmq_auth_backend_kerberos?
The folder and plugin have to have the same naming pattern, so they
share "rabbitmq". I think the rest is just history.
> I just did this:
> <https://github.com/simmel/rabbitmq-auth-backend-kerberos/commit/a3bab882988771b6d07f1a436844c47426d0c7b6/src/rabbitmq_auth_backend_kerberos.erl#L2L1>
> and it seems to work. I mainly do it because I want to be able to use
> ?MODULE in code:priv_dir.
Well, bear in mind that code:priv_dir/1 does *not* take the name of a
module, but the name of an application. So using ?MODULE and then
changing the module name to be the same as the application seems...
misleading. I would just define ?APPLICATION and have done.
> Is there another way do do it and to use alot of code?
> I saw that you guys did:
> {file, Path} = code:is_loaded(?MODULE),
> Dir = filename:join(filename:dirname(Path), "../priv"),
Yeah, code:priv_dir/1 feels more right. But ISTR we ran into problems
with the plugin system. Maybe that's fixed now.
> Another issue (and the reason why
> <https://github.com/simmel/rabbitmq-auth-backend-kerberos/commit/a3bab882988771b6d07f1a436844c47426d0c7b6/src/rabbitmq_auth_backend_kerberos.erl#L2R41>
> exists), is that it seems that when rabbitmq-server unzips the plugins
> (here:
> <https://github.com/rabbitmq/rabbitmq-server/blob/rabbitmq_v2_8_x/src/rabbit_prelaunch.erl#L176>)
> the erlang zip lib doesn't preserve the file modes?
Quite possibly - we've never needed to depend on file modes being preserved.
> If I run unzip on my
> .ez-file I do get the correct permissions. Is this a known issue? Can I
> expect this to be fixed? How can I work around it other than I have done
> now?
Having looked at zip.erl I don't see any attempt being made to preserve
permissions. So I think your workaround is needed.
Cheers, Simon
--
Simon MacMullen
RabbitMQ, VMware
More information about the rabbitmq-discuss
mailing list