client-common.c revision bb8d0ec26bdd548624d7a7424071cca693b72f55
96f89d51e8315f644f46804a9f0fc4f685ac48bfTimo Sirainen/* Copyright (c) 2002-2008 Dovecot authors, see the included COPYING file */
96f89d51e8315f644f46804a9f0fc4f685ac48bfTimo Sirainenunsigned int clients_count = 0;
cb3ab2fd5668700a89b274a43595cfbfa1616e4bTimo Sirainenunsigned int clients_get_count(void)
7db7fbea5d8a07463b625f93d69166d56018dadfTimo Sirainenstatic const struct var_expand_table *
96f89d51e8315f644f46804a9f0fc4f685ac48bfTimo Sirainen static struct var_expand_table static_tab[] = {
96f89d51e8315f644f46804a9f0fc4f685ac48bfTimo Sirainen unsigned int i;
cb3ab2fd5668700a89b274a43595cfbfa1616e4bTimo Sirainen tab[1].value = t_strcut(client->virtual_user, '@');
cb3ab2fd5668700a89b274a43595cfbfa1616e4bTimo Sirainen tab[2].value = strchr(client->virtual_user, '@');
4487c66123ca4830f8afbf4efcd7a260848d0e05Timo Sirainen for (i = 0; i < 3; i++)
4487c66123ca4830f8afbf4efcd7a260848d0e05Timo Sirainen tab[i].value = str_sanitize(tab[i].value, 80);
96f89d51e8315f644f46804a9f0fc4f685ac48bfTimo Sirainen tab[5].value = net_ip2addr(&client->local_ip);
96f89d51e8315f644f46804a9f0fc4f685ac48bfTimo Sirainen tab[8].value = client->auth_mech_name == NULL ? NULL :
96f89d51e8315f644f46804a9f0fc4f685ac48bfTimo Sirainen str_sanitize(client->auth_mech_name, MAX_MECH_NAME);
96f89d51e8315f644f46804a9f0fc4f685ac48bfTimo Sirainen tab[11].value = client->secured ? "secured" : NULL;
96f89d51e8315f644f46804a9f0fc4f685ac48bfTimo Sirainen const char *ssl_state = ssl_proxy_is_handshaked(client->proxy) ?
96f89d51e8315f644f46804a9f0fc4f685ac48bfTimo Sirainen const char *ssl_error = ssl_proxy_get_last_error(client->proxy);
96f89d51e8315f644f46804a9f0fc4f685ac48bfTimo Sirainen tab[11].value = ssl_error == NULL ? ssl_state :
009217abb57a24a4076092e8e4e165545747839eStephan Bosch t_strdup_printf("%s: %s", ssl_state, ssl_error);
96f89d51e8315f644f46804a9f0fc4f685ac48bfTimo Sirainenstatic bool have_key(const struct var_expand_table *table, const char *str)
96f89d51e8315f644f46804a9f0fc4f685ac48bfTimo Sirainen unsigned int i;
96f89d51e8315f644f46804a9f0fc4f685ac48bfTimo Sirainenstatic void client_syslog_real(struct client *client, const char *msg)
009217abb57a24a4076092e8e4e165545747839eStephan Bosch static struct var_expand_table static_tab[3] = {
67e0afe62b26d222614b8d817155bf5c74bd7fe0Stephan Bosch const struct var_expand_table *var_expand_table;
96f89d51e8315f644f46804a9f0fc4f685ac48bfTimo Sirainen const char *p, *const *e;
96f89d51e8315f644f46804a9f0fc4f685ac48bfTimo Sirainen var_expand_table = get_var_expand_table(client);
96f89d51e8315f644f46804a9f0fc4f685ac48bfTimo Sirainen for (e = log_format_elements; *e != NULL; e++) {
96f89d51e8315f644f46804a9f0fc4f685ac48bfTimo Sirainen for (p = *e; *p != '\0'; p++) {
T_BEGIN {
} T_END;