Skip to content
This repository has been archived by the owner on Sep 13, 2021. It is now read-only.

auth_on_register username/password are "undefined" #5

Closed
baranga opened this issue Jun 3, 2016 · 5 comments · Fixed by #24
Closed

auth_on_register username/password are "undefined" #5

baranga opened this issue Jun 3, 2016 · 5 comments · Fixed by #24

Comments

@baranga
Copy link

baranga commented Jun 3, 2016

Username/password parameter in auth_on_register hook are strings with value "undefined" if connecting client doesn't send username/password.

How can I distinguish between client send nothing and client really send "undefined" as username/password? Maybe a empty username/password should be represented by nil or false.

@harmoniqpunk
Copy link

@baranga

Hi Henning,

I also had same question and I decided to not handle unknown clients. I only handle recognizable clients. Otherwise I return false. Erlio encourages you to pass the handler to the next handler in the chain if you don't recognize the client:

In case the plugin doesn't know the client it is best to return next as this would allow subsequent plugins in the chain to validate this client. If no plugin is able to validate the client it gets automatically rejected.

From here

@baranga
Copy link
Author

baranga commented Jul 14, 2016

@georgepoenaru
Hi George,
I want pass to next handler as fast as possible without expensive credential lookup if username is empty. Also if somehow "undefined"/"undefined" ends up in your backend then clients without credentials would pass the check.

@dergraf
Copy link
Contributor

dergraf commented Jul 14, 2016

I guess the proper solution would pass an empty string as the username and nil if no username is set. Afaict this is how it works for Erlang plugins. Have to check the situation for diversity.

@harmoniqpunk
Copy link

@baranga Fair enough. I'm in control of all clients and I handled there. I guess is just a matter of how lua wrapper handle the Peer object in diversity.

@larshesel
Copy link
Contributor

We just merged a fix for this. Instead of a string with value "undefined", nil is now passed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants