z3APA3A 7 жил өмнө
parent
commit
b76b3b49fa
2 өөрчлөгдсөн 9 нэмэгдсэн , 8 устгасан
  1. 9 7
      src/auth.c
  2. 0 1
      src/proxy.h

+ 9 - 7
src/auth.c

@@ -1402,6 +1402,8 @@ void sqlerr (char *buf){
 	pthread_mutex_unlock(&log_mutex);
 }
 
+unsigned char statbuf[8192];
+
 void logsql(struct clientparam * param, const unsigned char *s) {
 	SQLRETURN ret;
 	int len;
@@ -1409,35 +1411,35 @@ void logsql(struct clientparam * param, const unsigned char *s) {
 
 	if(param->nolog) return;
 	pthread_mutex_lock(&log_mutex);
-	len = dobuf(param, tmpbuf, s, (unsigned char *)"\'");
+	len = dobuf(param, statbuf, s, (unsigned char *)"\'");
 
 	if(attempt > 5){
 		time_t t;
 
 		t = time(0);
 		if (t - attempt_time < 180){
-			sqlerr((char *)tmpbuf);
+			sqlerr((char *)statbuf);
 			return;
 		}
 	}
 	if(!hstmt){
 		if(!init_sql(sqlstring)) {
-			sqlerr((char *)tmpbuf);
+			sqlerr((char *)statbuf);
 			return;
 		}
 	}
 	if(hstmt){
-		ret = SQLExecDirect(hstmt, (SQLCHAR *)tmpbuf, (SQLINTEGER)len);
+		ret = SQLExecDirect(hstmt, (SQLCHAR *)statbuf, (SQLINTEGER)len);
 		if(ret != SQL_SUCCESS && ret != SQL_SUCCESS_WITH_INFO){
 			close_sql();
 			if(!init_sql(sqlstring)){
-				sqlerr((char *)tmpbuf);
+				sqlerr((char *)statbuf);
 				return;
 			}
 			if(hstmt) {
-				ret = SQLExecDirect(hstmt, (SQLCHAR *)tmpbuf, (SQLINTEGER)len);
+				ret = SQLExecDirect(hstmt, (SQLCHAR *)statbuf, (SQLINTEGER)len);
 				if(ret != SQL_SUCCESS && ret != SQL_SUCCESS_WITH_INFO){
-					sqlerr((char *)tmpbuf);
+					sqlerr((char *)statbuf);
 					return;
 				}
 				attempt = 0;

+ 0 - 1
src/proxy.h

@@ -311,7 +311,6 @@ struct datatype;
 struct dictionary;
 struct node;
 struct property;
-extern unsigned char tmpbuf[8192];
 extern pthread_mutex_t config_mutex;
 extern pthread_mutex_t bandlim_mutex;
 extern pthread_mutex_t connlim_mutex;