fprintf(9 removed
This commit is contained in:
@ -136,7 +136,6 @@ int gw_read_gwbuff(DCB *dcb, GWBUF **head, int b) {
|
|||||||
int n = -1;
|
int n = -1;
|
||||||
|
|
||||||
if (b <= 0) {
|
if (b <= 0) {
|
||||||
//fprintf(stderr, "||| read_gwbuff called with 0 bytes for %i, closing\n", dcb->fd);
|
|
||||||
ss_dassert(false);
|
ss_dassert(false);
|
||||||
#if 0
|
#if 0
|
||||||
dcb->func.close(dcb);
|
dcb->func.close(dcb);
|
||||||
@ -157,11 +156,9 @@ int gw_read_gwbuff(DCB *dcb, GWBUF **head, int b) {
|
|||||||
|
|
||||||
if (n < 0) {
|
if (n < 0) {
|
||||||
if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) {
|
if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) {
|
||||||
/* fprintf(stderr, "Client connection %i: continue for %i, %s\n", dcb->fd, errno, strerror(errno)); */
|
|
||||||
gwbuf_free(buffer);
|
gwbuf_free(buffer);
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
/* fprintf(stderr, "Client connection %i error: %i, %s\n", dcb->fd, errno, strerror(errno)); */
|
|
||||||
gwbuf_free(buffer);
|
gwbuf_free(buffer);
|
||||||
(dcb->func).close(dcb);
|
(dcb->func).close(dcb);
|
||||||
return 1;
|
return 1;
|
||||||
@ -170,7 +167,6 @@ int gw_read_gwbuff(DCB *dcb, GWBUF **head, int b) {
|
|||||||
|
|
||||||
if (n == 0) {
|
if (n == 0) {
|
||||||
// socket closed
|
// socket closed
|
||||||
/* fprintf(stderr, "Client connection %i closed: %i, %s\n", dcb->fd, errno, strerror(errno)); */
|
|
||||||
gwbuf_free(buffer);
|
gwbuf_free(buffer);
|
||||||
#if 1
|
#if 1
|
||||||
(dcb->func).close(dcb);
|
(dcb->func).close(dcb);
|
||||||
|
|||||||
@ -204,7 +204,6 @@ HTTPD_session *client_data = NULL;
|
|||||||
if (strncasecmp(buf, "useragent", 9) == 0) {
|
if (strncasecmp(buf, "useragent", 9) == 0) {
|
||||||
strcpy(client_data->useragent, value);
|
strcpy(client_data->useragent, value);
|
||||||
}
|
}
|
||||||
//fprintf(stderr, "<<< Header [%s:%s]\n", buf, value);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -862,7 +862,6 @@ static int gw_change_user(DCB *backend, SERVER *server, SESSION *in_session, GWB
|
|||||||
|
|
||||||
if (auth_ret != 0) {
|
if (auth_ret != 0) {
|
||||||
/*< vraa : errorHandle */
|
/*< vraa : errorHandle */
|
||||||
fprintf(stderr, "<<< CLIENT AUTH FAILED for user [%s], user session will not change!\n", username);
|
|
||||||
|
|
||||||
// send the error packet
|
// send the error packet
|
||||||
mysql_send_auth_error(backend->session->client, 1, 0, "Authorization failed on change_user");
|
mysql_send_auth_error(backend->session->client, 1, 0, "Authorization failed on change_user");
|
||||||
|
|||||||
@ -28,7 +28,9 @@
|
|||||||
* 17/06/2013 Massimiliano Pinto Added Client To Gateway routines
|
* 17/06/2013 Massimiliano Pinto Added Client To Gateway routines
|
||||||
* 24/06/2013 Massimiliano Pinto Added: fetch passwords from service users' hashtable
|
* 24/06/2013 Massimiliano Pinto Added: fetch passwords from service users' hashtable
|
||||||
* 02/09/2013 Massimiliano Pinto Added: session refcount
|
* 02/09/2013 Massimiliano Pinto Added: session refcount
|
||||||
|
* 16/12/2013 Massimiliano Pinto Added: client closed socket detection with recv(..., MSG_PEEK)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <skygw_utils.h>
|
#include <skygw_utils.h>
|
||||||
#include <log_manager.h>
|
#include <log_manager.h>
|
||||||
#include <mysql_client_server_protocol.h>
|
#include <mysql_client_server_protocol.h>
|
||||||
@ -382,7 +384,6 @@ static int gw_mysql_do_authentication(DCB *dcb, GWBUF *queue) {
|
|||||||
*/
|
*/
|
||||||
// now get the user
|
// now get the user
|
||||||
strcpy(username, (char *)(client_auth_packet + 4 + 4 + 4 + 1 + 23));
|
strcpy(username, (char *)(client_auth_packet + 4 + 4 + 4 + 1 + 23));
|
||||||
/* fprintf(stderr, "<<< Client username is [%s]\n", username); */
|
|
||||||
|
|
||||||
// get the auth token len
|
// get the auth token len
|
||||||
memcpy(&auth_token_len,
|
memcpy(&auth_token_len,
|
||||||
@ -394,7 +395,6 @@ static int gw_mysql_do_authentication(DCB *dcb, GWBUF *queue) {
|
|||||||
strcpy(database,
|
strcpy(database,
|
||||||
(char *)(client_auth_packet + 4 + 4 + 4 + 1 + 23 + strlen(username) +
|
(char *)(client_auth_packet + 4 + 4 + 4 + 1 + 23 + strlen(username) +
|
||||||
1 + 1 + auth_token_len));
|
1 + 1 + auth_token_len));
|
||||||
/* fprintf(stderr, "<<< Client selected db is [%s]\n", database); */
|
|
||||||
} else {
|
} else {
|
||||||
/* fprintf(stderr, "<<< Client is NOT connected with db\n"); */
|
/* fprintf(stderr, "<<< Client is NOT connected with db\n"); */
|
||||||
}
|
}
|
||||||
@ -730,7 +730,6 @@ int gw_write_client_event(DCB *dcb)
|
|||||||
ss_dassert(dcb->state != DCB_STATE_DISCONNECTED);
|
ss_dassert(dcb->state != DCB_STATE_DISCONNECTED);
|
||||||
|
|
||||||
if (dcb == NULL) {
|
if (dcb == NULL) {
|
||||||
fprintf(stderr, "DCB is NULL, return\n");
|
|
||||||
goto return_1;
|
goto return_1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -106,29 +106,17 @@ void gw_mysql_close(MySQLProtocol **ptr) {
|
|||||||
if (*ptr == NULL)
|
if (*ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef MYSQL_CONN_DEBUG
|
|
||||||
fprintf(stderr, "Closing MySQL connection %i, [%s]\n", conn->fd, conn->scramble);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (conn->fd > 0) {
|
if (conn->fd > 0) {
|
||||||
/* COM_QUIT will not be sent here, but from the caller of this routine! */
|
/* COM_QUIT will not be sent here, but from the caller of this routine! */
|
||||||
#ifdef MYSQL_CONN_DEBUG
|
|
||||||
fprintf(stderr, "mysqlgw_mysql_close() called for %i\n", conn->fd);
|
|
||||||
#endif
|
|
||||||
close(conn->fd);
|
close(conn->fd);
|
||||||
} else {
|
} else {
|
||||||
#ifdef MYSQL_CONN_DEBUG
|
// no socket here
|
||||||
fprintf(stderr, "mysqlgw_mysql_close() called, no socket %i\n", conn->fd);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
free(*ptr);
|
free(*ptr);
|
||||||
|
|
||||||
*ptr = NULL;
|
*ptr = NULL;
|
||||||
|
|
||||||
#ifdef MYSQL_CONN_DEBUG
|
|
||||||
fprintf(stderr, "mysqlgw_mysql_close() free(conn) done\n");
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -429,10 +417,6 @@ int gw_send_authentication_to_backend(
|
|||||||
|
|
||||||
dcb = conn->owner_dcb;
|
dcb = conn->owner_dcb;
|
||||||
|
|
||||||
#ifdef DEBUG_MYSQL_CONN
|
|
||||||
fprintf(stderr, ">> Sending credentials %s, %s, db %s\n", user, passwd, dbname);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Zero the vars
|
// Zero the vars
|
||||||
memset(&server_capabilities, '\0', sizeof(server_capabilities));
|
memset(&server_capabilities, '\0', sizeof(server_capabilities));
|
||||||
memset(&final_capabilities, '\0', sizeof(final_capabilities));
|
memset(&final_capabilities, '\0', sizeof(final_capabilities));
|
||||||
@ -844,10 +828,6 @@ int gw_send_change_user_to_backend(char *dbname, char *user, uint8_t *passwd, My
|
|||||||
|
|
||||||
dcb = conn->owner_dcb;
|
dcb = conn->owner_dcb;
|
||||||
|
|
||||||
#ifdef DEBUG_MYSQL_CONN
|
|
||||||
fprintf(stderr, ">> Sending credentials %s, %s, db %s\n", user, passwd, dbname);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Zero the vars
|
// Zero the vars
|
||||||
memset(&server_capabilities, '\0', sizeof(server_capabilities));
|
memset(&server_capabilities, '\0', sizeof(server_capabilities));
|
||||||
memset(&final_capabilities, '\0', sizeof(final_capabilities));
|
memset(&final_capabilities, '\0', sizeof(final_capabilities));
|
||||||
@ -1029,7 +1009,6 @@ int gw_check_mysql_scramble_data(DCB *dcb, uint8_t *token, unsigned int token_le
|
|||||||
ret_val = gw_find_mysql_user_password_sha1(username, password, (DCB *) dcb);
|
ret_val = gw_find_mysql_user_password_sha1(username, password, (DCB *) dcb);
|
||||||
|
|
||||||
if (ret_val) {
|
if (ret_val) {
|
||||||
fprintf(stderr, "<<<< User [%s] was not found\n", username);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1044,7 +1023,6 @@ int gw_check_mysql_scramble_data(DCB *dcb, uint8_t *token, unsigned int token_le
|
|||||||
/* check if the password is not set in the user table */
|
/* check if the password is not set in the user table */
|
||||||
if (!strlen((char *)password)) {
|
if (!strlen((char *)password)) {
|
||||||
/* Username without password */
|
/* Username without password */
|
||||||
//fprintf(stderr, ">>> continue WITHOUT auth, no password\n");
|
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user