On 27.8.2013, at 2.19, C. Mills dovecot@pyropus.ca wrote:
See how imap-login/client-authenticate.c imap_client_auth_begin() sends the command tag to imap process. Or if it's something all login processes need you could modify struct master_auth_request directly.
I do see how it's put into the imap_client->common.master_data_prefix there, but it's not clear to me how to get it back *out* in the imap mail client. The only place I see that data actually used is in /login-common/sasl-server.c.
In imap-login process write it to master_data_prefix. This gets passed through to imap process directly, which reads it in imap/main.c : client_parse_input(). You can use whatever format in there as long as the reading and writing part are compatible with each others. Note that after the master_data_prefix may come some actual IMAP client input that needs to be parsed. So you'll probably want to add your extra string before or after the imap tag string.
For a concrete example, I'd like to pass an additional string/char * of state information from the imap-login code to imap mail client code. I think, based on the above, that you suggest putting it into the imap_client->common struct, which I've done, so that struct is then passed to client_auth_begin(), and presumably goes to the master process. But where does that information/data get passed to the imap mail client? For example, if I wanted to access it in /imap/cmd-fetch.c : cmd_fetch(), cmd->client appears to be a different structure?
I'm beginning to wonder if another way would be better. Why does the data need to be passed before login, why can't it be passed after login so there wouldn't need to be any imap-login <-> imap communication for it?
Or if the information you're passing is coming from an external source and not exactly from the IMAP client, maybe you can get it from auth process userdb lookup? Those fields are also passed to imap process.