[rabbitmq-discuss] Creating an auth plugin (Kerberos)

Simon Lundström simlu at su.se
Wed Dec 5 15:55:30 GMT 2012

On Wed, 2012-12-05 at 15:04:42 +0000, Tim Watson wrote:
> Personally, I think you should do this another way. Write a Native Implemented Function (NIF) in C and wrap it up as an Erlang module. Then you can just call the NIF directly from your auth module. You don't have to do all this spawning and looping and exit handling and insulating. It's *much* easier.

Looks like that way.

"It is a simpler and more efficient way of calling C-code than using
port drivers. NIFs are most suitable for synchronous functions like foo
and bar in the example, that does some relatively short calculations
without side effects and return the result."

Since auth is blocking/synchronous this is suitable I'd reckon.

> Having said that, I can't help you with writing a NIF at the moment as we're all quite busy getting 3.0.1 ready.

No worries! I appreciate all the help you and Simon have given me!

http://www.erlang.org/doc/tutorial/nif.html looks like enough to get me

> I'd suggest going over to the erlang-questions mailing list and saying "I want to do kerberos authentication using a NIF - can somebody point me in the right direction...". Honestly it's much simpler than all this open_port malarky, especially if you're comfortable writing C, which you do seem to be.

Oh Tim, you make me blush! ; P Actually, this is only the second
C-project that I've done (ever).

> The erlang part of it is minimal, and the rabbit auth module you've written just calls the NIF stub functions as though they were regular erlang functions. No processes, no message handling: simple.

Yep, looks really simple!

What is that saying... "to stumble on the finish line"? = )

- Simon

More information about the rabbitmq-discuss mailing list