mirror of
https://github.com/3proxy/3proxy.git
synced 2026-11-26 23:59:41 +08:00
Logs: no ODBC user and password in messages about a log
A log string is shown only up to its first comma, where an ODBC string goes on with the user and the password: in the message on a log which failed, and in the errors on a log or -l which cannot be opened. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d613750b94
commit
e87ffcd7e1
4 files changed
+16
-3
No files matched your search
@@ -808,6 +808,14 @@ static void logfallback(struct logger *lg, struct clientparam *param, const unsi
|
||||
logput(to);
|
||||
}
|
||||
|
||||
/* The part of a log string fit to be shown: up to a comma, an ODBC string
|
||||
going on with the user and the password, and at most 200 bytes. */
|
||||
size_t logselen(const unsigned char *selector){
|
||||
size_t len = strcspn((char *)selector, ",");
|
||||
|
||||
return len > 200? 200 : len;
|
||||
}
|
||||
|
||||
static void logwrite(struct logger *lg, struct clientparam *param, const unsigned char *buf, int len){
|
||||
int res = 0, failed, report = 0;
|
||||
time_t t;
|
||||
@@ -838,7 +846,8 @@ static void logwrite(struct logger *lg, struct clientparam *param, const unsigne
|
||||
if(report){
|
||||
unsigned char msg[300];
|
||||
|
||||
sprintf((char *)msg, "Log %.200s failed, its lines go to the error log", lg->selector);
|
||||
/* up to a comma: an ODBC string goes on with user and password */
|
||||
sprintf((char *)msg, "Log %.*s failed, its lines go to the error log", (int)logselen(lg->selector), lg->selector);
|
||||
logerror(msg);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user