static int
master_input_auth_request(struct auth_master_connection *conn, const char *args,
			  const char *cmd, struct auth_request **request_r,
			  const char **error_r)
{
	struct auth_request *auth_request;
	const char *const *list, *name, *arg, *username;
	unsigned int id;

	/* <id> <userid> [<parameters>] */
	list = t_strsplit_tab(args);
	if (list[0] == NULL || list[1] == NULL ||
	    str_to_uint(list[0], &id) < 0) {
		i_error("BUG: Master sent broken %s", cmd);
		return -1;
	}

	auth_request = auth_request_new_dummy();
	auth_request->id = id;
	auth_request->master = conn;
	auth_master_connection_ref(conn);
	username = list[1];

	for (list += 2; *list != NULL; list++) {
		arg = strchr(*list, '=');
		if (arg == NULL) {
			name = *list;
			arg = "";
		} else {
			name = t_strdup_until(*list, arg);
			arg++;
		}

		(void)auth_request_import_info(auth_request, name, arg);
	}

	if (auth_request->service == NULL) {
		i_error("BUG: Master sent %s request without service", cmd);
		auth_request_unref(&auth_request);
		auth_master_connection_unref(&conn);
		return -1;
	}

	auth_request_init(auth_request);

	if (!auth_request_set_username(auth_request, username, error_r)) {
		*request_r = auth_request;
		return 0;
	}
	*request_r = auth_request;
	return 1;
}
static int
postfix_input_auth_request(struct auth_postfix_connection *conn,
			   const char *username,
			   struct auth_request **request_r, const char **error_r)
{
	struct auth_request *auth_request;

	auth_request = auth_request_new_dummy();
	auth_request->id = 1;
	auth_request->context = conn;
	auth_postfix_connection_ref(conn);

	if (!auth_request_set_username(auth_request, username, error_r)) {
		*request_r = auth_request;
		return FALSE;
	}
	(void)auth_request_import_info(auth_request, "service", "postfix");

	auth_request_init(auth_request);
	*request_r = auth_request;
	return TRUE;
}