On 10/03/2007 14:15, Timo Sirainen wrote:
On Sun, 2007-02-18 at 15:12 +0000, John Robinson wrote:
Otherwise looks ok. But I think I'll add this to CVS HEAD and not v1.0. I'm at least trying to keep a feature freeze. :) Oh go on, it's not likely to hurt any existing installations...
I added %c to v1.0, but the service name only to CVS HEAD: http://dovecot.org/list/dovecot-cvs/2007-March/008036.html
Here's that service name patch reworked for 1.0.0 (for which many thanks!). Timo, if you haven't already, you may want to change the internal default in CVS HEAD to "%Ls" instead of "%s" (as I have done in the attached), to handle the other PAMs which don't downcase the service name (an issue you fixed for 1.0). Cheers, John. diff -urN dovecot-1.0.0/src/auth/passdb-pam.c dovecot-1.0.0-pamservice/src/auth/passdb-pam.c --- dovecot-1.0.0/src/auth/passdb-pam.c 2007-04-03 04:35:42.000000000 +0100 +++ dovecot-1.0.0-pamservice/src/auth/passdb-pam.c 2007-04-17 11:01:09.000000000 +0100 @@ -15,6 +15,8 @@ #include "buffer.h" #include "ioloop.h" #include "hash.h" +#include "str.h" +#include "var-expand.h" #include "network.h" #include "passdb.h" #include "safe-memset.h" @@ -424,12 +426,16 @@ struct pam_passdb_module *module = (struct pam_passdb_module *)_module; struct pam_auth_request *pam_auth_request; enum passdb_result result; + string_t *expanded_service; const char *service; int fd[2]; pid_t pid; - service = module->service_name != NULL ? - module->service_name : t_str_lcase(request->service); + expanded_service = t_str_new(64); + var_expand(expanded_service, module->service_name, + auth_request_get_var_expand_table(request, NULL)); + service = str_c(expanded_service); + auth_request_log_debug(request, "pam", "lookup service=%s", service); if (worker) { @@ -505,7 +511,8 @@ } else if (strcmp(t_args[i], "blocking=yes") == 0) { module->module.blocking = TRUE; } else if (strcmp(t_args[i], "*") == 0) { - module->service_name = NULL; + /* for backwards compatibility */ + module->service_name = "%Ls"; } else if (t_args[i+1] == NULL) { if (*t_args[i] != '\0') { module->service_name =