+/*
+* send authentication failure message text to frontend
+*/
+static void pool_send_auth_fail(POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *cp)
+{
+ int messagelen;
+ char *errmessage;
+ int protoMajor;
+
+ bool send_error_to_frontend = true;
+
+ protoMajor = MAJOR(cp);
+
+ messagelen = strlen(MASTER_CONNECTION(cp)->sp->user) + 100;
+ if ((errmessage = (char *)malloc(messagelen+1)) == NULL)
+ {
+ pool_error("pool_send_auth_fail_failed: malloc failed: %s", strerror(errno));
+ child_exit(1);
+ }
+
+ snprintf(errmessage, messagelen, "password authentication failed for user \"%s\"",
+ MASTER_CONNECTION(cp)->sp->user);
+ if (send_error_to_frontend)
+ pool_send_fatal_message(frontend, protoMajor, "XX000", errmessage,
+ "", "", __FILE__, __LINE__);
+ free(errmessage);
+}
+