[PATCH 2/3] drv_imap: add ability to script user query

2018-01-30 Thread Patrick Steinhardt
Right now, it is already possible to script retrieving passwords from arbitrary scripts. This goes only half the way though to allowing automated derival of login details, as some environments may also have different user names based on the system. Add a new option UserCmd, which acts exactly the

[PATCH 1/3] drv_imap: extract function to get command output

2018-01-30 Thread Patrick Steinhardt
The function to retrieve the password has inline-code for spawning an external process and reading its stdout in order to handle the PassCmd option. Extract that function into its own to make it re-usable for a UserCmd option. --- src/drv_imap.c | 71 ---

[PATCH 3/3] drv_imap: avoid multiple invocations of pass/user command

2018-01-30 Thread Patrick Steinhardt
Unset the `pass_cmd` and `user_cmd` fields as soon as their respective value have been computed. Besides being a bit more efficient as we will now only ever invoke the respective command once, this also fixes a real issue: when calling `ensure_password` or `ensure_user` for a second time, the previ

[PATCH 0/3] Add ability to script user query

2018-01-30 Thread Patrick Steinhardt
Hi, currently, it is only possible to script one part of the authentication by using PassCmd for IMAP backends. On some systems, though, it is not only the password that needs to be retrieved via a script, but also the user part. This may for example be the case in systems where the username is de