#define AUTH_DNS_DEFAULT_TIMEOUT_MSECS (1000*10)
#define AUTH_DNS_WARN_MSECS 500
#define CACHED_PASSWORD_SCHEME "SHA1"
-#define AUTH_REQUEST_KEY_IGNORE " "
struct auth_request_proxy_dns_lookup_ctx {
struct auth_request *request;
if (str_len(str) == 0) {
/* no userdb fields. but we can't save an empty string,
since that means "user unknown". */
- str_append(str, AUTH_REQUEST_KEY_IGNORE);
+ str_append(str, AUTH_REQUEST_USER_KEY_IGNORE);
}
cache_value = str_c(str);
}
warned = TRUE;
}
name = "system_groups_user";
- } else if (strcmp(name, AUTH_REQUEST_KEY_IGNORE) == 0) {
+ } else if (strcmp(name, AUTH_REQUEST_USER_KEY_IGNORE) == 0) {
return;
}
o_stream_nsend(client->output, str_data(str), str_len(str));
}
+static void
+reply_append_extra_fields(string_t *str, struct auth_request *request)
+{
+ if (!auth_fields_is_empty(request->extra_fields)) {
+ str_append_c(str, '\t');
+ auth_fields_append(request->extra_fields, str, 0, 0);
+ }
+ if (request->userdb_reply != NULL &&
+ auth_fields_is_empty(request->userdb_reply)) {
+ /* all userdb_* fields had NULL values. we'll still
+ need to tell this to the master */
+ str_append(str, "\tuserdb_"AUTH_REQUEST_USER_KEY_IGNORE);
+ }
+}
+
static void verify_plain_callback(enum passdb_result result,
struct auth_request *request)
{
str_append_c(str, '\t');
if (request->passdb_password != NULL)
str_append_tabescaped(str, request->passdb_password);
- if (!auth_fields_is_empty(request->extra_fields)) {
- str_append_c(str, '\t');
- auth_fields_append(request->extra_fields, str, 0, 0);
- }
+ reply_append_extra_fields(str, request);
}
str_append_c(str, '\n');
auth_worker_send_reply(client, str);
str_append_tabescaped(str, request->user);
str_printfa(str, "\t{%s.b64}", request->credentials_scheme);
base64_encode(credentials, size, str);
-
- if (!auth_fields_is_empty(request->extra_fields)) {
- str_append_c(str, '\t');
- auth_fields_append(request->extra_fields, str, 0, 0);
- }
+ reply_append_extra_fields(str, request);
}
str_append_c(str, '\n');
auth_worker_send_reply(client, str);