Merge branch 'release-1.0beta-refresh' into cmake_build
This commit is contained in:
@ -185,5 +185,26 @@ do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
filters=`maxadmin -pskysql list filters | awk -F\| '{ if ( NF > 1 ) print $1 }'| grep -v Options`
|
||||||
|
if [ $? -eq "1" ]; then
|
||||||
|
echo "Get Filter list: Failed"
|
||||||
|
failure=`expr $failure + 1`
|
||||||
|
else
|
||||||
|
passed=`expr $passed + 1`
|
||||||
|
echo "Get filter list: Passed"
|
||||||
|
fi
|
||||||
|
|
||||||
|
for i in $filters
|
||||||
|
do
|
||||||
|
maxadmin -pskysql show filter $i | grep -s 'Filter' >& /dev/null
|
||||||
|
if [ $? -eq "1" ]; then
|
||||||
|
echo "show filter: Failed"
|
||||||
|
failure=`expr $failure + 1`
|
||||||
|
else
|
||||||
|
passed=`expr $passed + 1`
|
||||||
|
echo "show filter: Passed"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
echo "Test run complete. $passed passes, $failure failures"
|
echo "Test run complete. $passed passes, $failure failures"
|
||||||
exit $failure
|
exit $failure
|
||||||
|
@ -76,7 +76,7 @@ unsigned char *ptr;
|
|||||||
ptr = GWBUF_DATA(buf);
|
ptr = GWBUF_DATA(buf);
|
||||||
*length = *ptr++;
|
*length = *ptr++;
|
||||||
*length += (*ptr++ << 8);
|
*length += (*ptr++ << 8);
|
||||||
*length += (*ptr++ << 8);
|
*length += (*ptr++ << 16);
|
||||||
ptr += 2; // Skip sequence id and COM_QUERY byte
|
ptr += 2; // Skip sequence id and COM_QUERY byte
|
||||||
*length = *length - 1;
|
*length = *length - 1;
|
||||||
*sql = (char *)ptr;
|
*sql = (char *)ptr;
|
||||||
@ -111,7 +111,7 @@ unsigned char *ptr;
|
|||||||
ptr = GWBUF_DATA(buf);
|
ptr = GWBUF_DATA(buf);
|
||||||
*residual = *ptr++;
|
*residual = *ptr++;
|
||||||
*residual += (*ptr++ << 8);
|
*residual += (*ptr++ << 8);
|
||||||
*residual += (*ptr++ << 8);
|
*residual += (*ptr++ << 16);
|
||||||
ptr += 2; // Skip sequence id and COM_QUERY byte
|
ptr += 2; // Skip sequence id and COM_QUERY byte
|
||||||
*residual = *residual - 1;
|
*residual = *residual - 1;
|
||||||
*length = GWBUF_LENGTH(buf) - 5;
|
*length = GWBUF_LENGTH(buf) - 5;
|
||||||
@ -143,7 +143,7 @@ GWBUF *addition;
|
|||||||
ptr = GWBUF_DATA(orig);
|
ptr = GWBUF_DATA(orig);
|
||||||
length = *ptr++;
|
length = *ptr++;
|
||||||
length += (*ptr++ << 8);
|
length += (*ptr++ << 8);
|
||||||
length += (*ptr++ << 8);
|
length += (*ptr++ << 16);
|
||||||
ptr += 2; // Skip sequence id and COM_QUERY byte
|
ptr += 2; // Skip sequence id and COM_QUERY byte
|
||||||
|
|
||||||
newlength = strlen(sql);
|
newlength = strlen(sql);
|
||||||
@ -178,11 +178,11 @@ GWBUF *addition;
|
|||||||
*
|
*
|
||||||
* @param buf GWBUF buffer including the query
|
* @param buf GWBUF buffer including the query
|
||||||
*
|
*
|
||||||
* @return Plaint text query if the packet type is COM_QUERY. Otherwise return
|
* @return Plain text query if the packet type is COM_QUERY. Otherwise return
|
||||||
* a string including the packet type.
|
* a string including the packet type.
|
||||||
*/
|
*/
|
||||||
char* modutil_get_query(
|
char *
|
||||||
GWBUF* buf)
|
modutil_get_query(GWBUF *buf)
|
||||||
{
|
{
|
||||||
uint8_t* packet;
|
uint8_t* packet;
|
||||||
mysql_server_cmd_t packet_type;
|
mysql_server_cmd_t packet_type;
|
||||||
|
@ -30,13 +30,15 @@
|
|||||||
* @endverbatim
|
* @endverbatim
|
||||||
*/
|
*/
|
||||||
#include <dcb.h>
|
#include <dcb.h>
|
||||||
|
#include <spinlock.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The telnetd specific protocol structure to put in the DCB.
|
* The telnetd specific protocol structure to put in the DCB.
|
||||||
*/
|
*/
|
||||||
typedef struct maxscaled {
|
typedef struct maxscaled {
|
||||||
int state; /**< The connection state */
|
SPINLOCK lock; /**< Protocol structure lock */
|
||||||
char *username; /**< The login name of the user */
|
int state; /**< The connection state */
|
||||||
|
char *username; /**< The login name of the user */
|
||||||
} MAXSCALED;
|
} MAXSCALED;
|
||||||
|
|
||||||
#define MAXSCALED_STATE_LOGIN 1 /**< Issued login prompt */
|
#define MAXSCALED_STATE_LOGIN 1 /**< Issued login prompt */
|
||||||
|
@ -166,7 +166,6 @@ char *password;
|
|||||||
{
|
{
|
||||||
dcb_printf(dcb, "FAILED");
|
dcb_printf(dcb, "FAILED");
|
||||||
maxscaled->state = MAXSCALED_STATE_LOGIN;
|
maxscaled->state = MAXSCALED_STATE_LOGIN;
|
||||||
free(maxscaled->username);
|
|
||||||
}
|
}
|
||||||
gwbuf_consume(head, GWBUF_LENGTH(head));
|
gwbuf_consume(head, GWBUF_LENGTH(head));
|
||||||
free(password);
|
free(password);
|
||||||
@ -276,17 +275,18 @@ int n_connect = 0;
|
|||||||
client_dcb->fd = so;
|
client_dcb->fd = so;
|
||||||
client_dcb->remote = strdup(inet_ntoa(addr.sin_addr));
|
client_dcb->remote = strdup(inet_ntoa(addr.sin_addr));
|
||||||
memcpy(&client_dcb->func, &MyObject, sizeof(GWPROTOCOL));
|
memcpy(&client_dcb->func, &MyObject, sizeof(GWPROTOCOL));
|
||||||
client_dcb->session =
|
if ((maxscaled_pr = (MAXSCALED *)malloc(sizeof(MAXSCALED))) == NULL)
|
||||||
session_alloc(dcb->session->service, client_dcb);
|
{
|
||||||
maxscaled_pr = (MAXSCALED *)malloc(sizeof(MAXSCALED));
|
client_dcb->protocol = NULL;
|
||||||
maxscaled_pr->username = NULL;
|
|
||||||
client_dcb->protocol = (void *)maxscaled_pr;
|
|
||||||
|
|
||||||
if (maxscaled_pr == NULL)
|
|
||||||
{
|
|
||||||
dcb_add_to_zombieslist(client_dcb);
|
dcb_add_to_zombieslist(client_dcb);
|
||||||
return n_connect;
|
return n_connect;
|
||||||
}
|
}
|
||||||
|
maxscaled_pr->username = NULL;
|
||||||
|
spinlock_init(&maxscaled_pr->lock);
|
||||||
|
client_dcb->protocol = (void *)maxscaled_pr;
|
||||||
|
|
||||||
|
client_dcb->session =
|
||||||
|
session_alloc(dcb->session->service, client_dcb);
|
||||||
|
|
||||||
if (poll_add_dcb(client_dcb) == -1)
|
if (poll_add_dcb(client_dcb) == -1)
|
||||||
{
|
{
|
||||||
@ -313,11 +313,16 @@ maxscaled_close(DCB *dcb)
|
|||||||
{
|
{
|
||||||
MAXSCALED *maxscaled = dcb->protocol;
|
MAXSCALED *maxscaled = dcb->protocol;
|
||||||
|
|
||||||
if (maxscaled && maxscaled->username)
|
if (!maxscaled)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
spinlock_acquire(&maxscaled->lock);
|
||||||
|
if (maxscaled->username)
|
||||||
{
|
{
|
||||||
free(maxscaled->username);
|
free(maxscaled->username);
|
||||||
maxscaled->username = NULL;
|
maxscaled->username = NULL;
|
||||||
}
|
}
|
||||||
|
spinlock_release(&maxscaled->lock);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user