Raised This Month: $9 Target: $400
 2% 

Solved [CSGO] Error Log


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Dr.Mohammad
Senior Member
Join Date: Jan 2016
Location: CSGO Servers
Old 08-07-2020 , 11:20   [CSGO] Error Log
Reply With Quote #1

hi guys!

i have error log on my server:

L 08/07/2020 - 17:56:25: SourceMod error session started
L 08/07/2020 - 17:56:25: [Addons_localbans.smx] DB_CreateBan_Callback: near "s": syntax error
L 08/07/2020 - 17:598: [Addons_localbans.smx] DB_CreateBan_Callback: near "s": syntax error
L 08/07/2020 - 18:18:01: Error log file session closed.


i used last version of sm and mm.

thank you for any help. :X

Last edited by Dr.Mohammad; 08-11-2020 at 09:14.
Dr.Mohammad is offline
Fyren
FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren
Join Date: Feb 2106
Old 08-08-2020 , 13:03   Re: [CSGO] Error Log
Reply With Quote #2

If you don't know how to write SP, you should just find a different plugin because that one is insecure.

If you can or someone cares enough to fix it, it should not use plain Format/FormatEx to create SQL queries because that leads to SQL injection vulnerabilities.
Fyren is offline
Dr.Mohammad
Senior Member
Join Date: Jan 2016
Location: CSGO Servers
Old 08-09-2020 , 00:07   Re: [CSGO] Error Log
Reply With Quote #3

Quote:
Originally Posted by Fyren View Post
If you don't know how to write SP, you should just find a different plugin because that one is insecure.

If you can or someone cares enough to fix it, it should not use plain Format/FormatEx to create SQL queries because that leads to SQL injection vulnerabilities.
this plugin best ban manager for server. but i have this problem
can you fix this?
PHP Code:
void DB_CreateBan(const char[] auth "N/A", const char[] ip "N/A"int timeBanType type, const char[] name "N/A"int timestamp, const char[] reason "N/A", const char[] adminAuth, const char[] adminName)
{
    
Call_StartForward(g_hOnBanCreated_Pre);
    
Call_PushString(auth);
    
Call_PushString(ip);
    
    
Action result;
    
Call_Finish(result);
    
    if(
result != Plugin_Handled)
    {
        
DataPack data = new DataPack();
        
data.WriteString(auth);
        
data.WriteString(ip);
        
data.WriteCell(time);
        
data.WriteCell(type);
        
data.WriteString(name);
        
data.WriteCell(timestamp);
        
data.WriteString(reason);
        
data.WriteString(adminAuth);
        
data.WriteString(adminName);
        
        
char sQuery[500];
        
FormatEx(sQuerysizeof(sQuery), "INSERT INTO `%s` (`Auth`, `Ip`, `Time`, `Type`, `Name`, `Timestamp`, `Reason`, `AdminAuth`, `AdminName`) VALUES ('%s', '%s', '%d', '%d', '%s', '%d', '%s', '%s', '%s');"
            
DBName,
            
auth,
            
ip,
            
time,
            
type,
            
name,
            
timestamp,
            
reason,
            
adminAuth,
            
adminName);
            
        
g_hDB.Query(DB_CreateBan_CallbacksQuerydata);
    }
}

public 
void DB_CreateBan_Callback(Database dbDBResultSet results, const char[] errorDataPack data)
{
    if(
results != null)
    {
        
char sAuth[32], sIp[16], sName[MAX_NAME_LENGTH], sReason[MAX_REASON_LENGTH], sAdminAuth[32], sAdminName[MAX_NAME_LENGTH], sKey[16];
        
        
data.Reset();
        
data.ReadString(sAuthsizeof(sAuth));
        
data.ReadString(sIpsizeof(sIp));
        
int time data.ReadCell();
        
BanType type data.ReadCell();
        
data.ReadString(sNamesizeof(sName));
        
int timestamp data.ReadCell();
        
data.ReadString(sReasonsizeof(sReason));
        
data.ReadString(sAdminAuthsizeof(sAdminAuth));
        
data.ReadString(sAdminNamesizeof(sAdminName));
        
        
any[] pack = new any[BanCache];
        
        
FormatEx(pack[Auth], 32"%s"sAuth);
        
FormatEx(pack[Ip], 16"%s"sIp);
        
pack[Time] = time;
        
pack[Type] = type;
        
FormatEx(pack[Name], MAX_NAME_LENGTH"%s"sName);
        
pack[Timestamp] = timestamp;
        
FormatEx(pack[Reason], MAX_REASON_LENGTH"%s"sReason);
        
FormatEx(pack[AdminAuth], 32"%s"sAdminAuth);
        
FormatEx(pack[AdminName], MAX_NAME_LENGTH"%s"sAdminName);

        
IntToString(g_hBanCache.SizesKeysizeof(sKey));
        
g_hBanCache.SetArray(sKeypackview_as<int>(BanCache));
        
        
Call_StartForward(g_hOnBanCreated_Post);
        
Call_PushString(sAuth);
        
Call_PushString(sIp);
        
Call_Finish();
    }
    else
    {
        
LogError("DB_CreateBan_Callback: %s"error);
    }
    
    
delete data;

ty :X
Dr.Mohammad is offline
DJ Tsunami
DJ Post Spammer
Join Date: Feb 2008
Old 08-09-2020 , 03:35   Re: [CSGO] Error Log
Reply With Quote #4

Replace FormatEx with g_hDB.Format on this line:
PHP Code:
FormatEx(sQuerysizeof(sQuery), "INSERT INTO `%s` (`Auth`, `Ip`, `Time`, `Type`, `Name`, `Timestamp`, `Reason`, `AdminAuth`, `AdminName`) VALUES ('%s', '%s', '%d', '%d', '%s', '%d', '%s', '%s', '%s');"
__________________

Last edited by DJ Tsunami; 08-09-2020 at 08:52.
DJ Tsunami is offline
Dr.Mohammad
Senior Member
Join Date: Jan 2016
Location: CSGO Servers
Old 08-09-2020 , 12:00   Re: [CSGO] Error Log
Reply With Quote #5

Quote:
Originally Posted by DJ Tsunami View Post
Replace FormatEx with g_hDB.Format on this line:
PHP Code:
FormatEx(sQuerysizeof(sQuery), "INSERT INTO `%s` (`Auth`, `Ip`, `Time`, `Type`, `Name`, `Timestamp`, `Reason`, `AdminAuth`, `AdminName`) VALUES ('%s', '%s', '%d', '%d', '%s', '%d', '%s', '%s', '%s');"
wow. ty

i changed this line and i testing soon.

----------------------

Solved!

thank you guys :X

Last edited by Dr.Mohammad; 08-11-2020 at 09:13. Reason: solved :D
Dr.Mohammad is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 17:44.


Powered by vBulletin®
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Theme made by Freecode