Passing information from passdb to userdb

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Passing information from passdb to userdb

qmail-4
I'm trying to hack together a new authentication back-end and I wanted to know if it's possible to pass values from passdb to userdb in the auth_request structure at authentication time. I modified struct auth_request in auth-request.h to contain a new variable and it gets set properly in my passdb, however the value is not there when checking for it userdb.
I'm very novice when it comes to Dovecot programming so any help is appreciated.
Thanks!
Reply | Threaded
Open this post in threaded view
|

Re: Passing information from passdb to userdb

Aki Tuomi-2
The best way to is to use auth_request_set_userdb_field(request, key,
value);

and it will be available in userdb.

Aki

On 22.11.2017 01:57, Qmail wrote:
> I'm trying to hack together a new authentication back-end and I wanted to know if it's possible to pass values from passdb to userdb in the auth_request structure at authentication time. I modified struct auth_request in auth-request.h to contain a new variable and it gets set properly in my passdb, however the value is not there when checking for it userdb.
> I'm very novice when it comes to Dovecot programming so any help is appreciated.
> Thanks!
Reply | Threaded
Open this post in threaded view
|

Re[2]: Passing information from passdb to userdb

qmail-4
Thanks. If I do that in my passdb-test.c file, it core dumps. I did something simple like:
auth_request_set_userdb_field(auth_request, "customFlag", dec2str(50));
However, auth_request_set_field() used like this: auth_request_set_field(auth_request, "customFlag", dec2str(50), NULL); doesn't core dump.
What's the difference between both functions and finally, how do I retrieve values from auth_request ?

Thank you

On Wed, Nov 22, 2017 at 02:08 AM, Aki Tuomi  wrote:
The best way to is to use auth_request_set_userdb_field(request, key,
value);

and it will be available in userdb.

Aki

On 22.11.2017 01:57, Qmail wrote:
I'm trying to hack together a new authentication back-end and I wanted to know if it's possible to pass values from passdb to userdb in the auth_request structure at authentication time. I modified struct auth_request in auth-request.h to contain a new variable and it gets set properly in my passdb, however the value is not there when checking for it userdb.
I'm very novice when it comes to Dovecot programming so any help is appreciated.
Thanks!
Reply | Threaded
Open this post in threaded view
|

Re[2]: Passing information from passdb to userdb

qmail-4
In reply to this post by Aki Tuomi-2
I found a working solution, replying here to confirm it's the proper way of doing it and in case others might need the same
setting the value in passdb:
auth_request_set_field(request, "authlocation", dec2str(9),NULL);
reading the value in userdb:
auth_fields_find(auth_request->extra_fields, "authlocation")
On Wed, Nov 22, 2017 at 02:08 AM, Aki Tuomi  wrote:
The best way to is to use auth_request_set_userdb_field(request, key,
value);

and it will be available in userdb.

Aki

On 22.11.2017 01:57, Qmail wrote:
I'm trying to hack together a new authentication back-end and I wanted to know if it's possible to pass values from passdb to userdb in the auth_request structure at authentication time. I modified struct auth_request in auth-request.h to contain a new variable and it gets set properly in my passdb, however the value is not there when checking for it userdb.
I'm very novice when it comes to Dovecot programming so any help is appreciated.
Thanks!