summaryrefslogtreecommitdiff
path: root/src/login_sql/login.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-08-10 14:25:32 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-08-10 14:25:32 +0000
commit5ab87d86bb158110fc7b32d9e1cd9ff39ace37cf (patch)
tree17dffecbf004bda824dc805f29e0bc71a128c2dd /src/login_sql/login.c
parent911c7aa759e427e78185e370512886c36dfab83f (diff)
downloadhercules-5ab87d86bb158110fc7b32d9e1cd9ff39ace37cf.tar.gz
hercules-5ab87d86bb158110fc7b32d9e1cd9ff39ace37cf.tar.bz2
hercules-5ab87d86bb158110fc7b32d9e1cd9ff39ace37cf.tar.xz
hercules-5ab87d86bb158110fc7b32d9e1cd9ff39ace37cf.zip
- Fixed two instances in the login-sql server where the ip in the log-login table was being stored backwards.
- Now when a skill's range is 0 and the skill is NOT casted on self, it will take the basic weapon's range (without Vulture/Snake Eye bonus). - Now when a duration is not specified, sc_start/sc_start2/sc_start4 will try to guess the duration by extracting it from the skill_db (it uses skill_get_time on whatever skill is associated to the status-change using val1 as skill-level) - Corrected that extra comma at the end of the Kaensin layout setup. - Some cleanups on trade_tradeaccept to prevent packets being resent when they shouldn't. - Corrected that ALLOW NULL thingie on main.sql git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@8229 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/login_sql/login.c')
-rw-r--r--src/login_sql/login.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/login_sql/login.c b/src/login_sql/login.c
index 4c9393bc8..7cc240dcf 100644
--- a/src/login_sql/login.c
+++ b/src/login_sql/login.c
@@ -906,6 +906,7 @@ int parse_fromchar(int fd){
MYSQL_ROW sql_row = NULL;
unsigned char *p = (unsigned char *) &session[fd]->client_addr.sin_addr.s_addr;
+ unsigned long ipl = session[fd]->client_addr.sin_addr.s_addr;
char ip[16];
sprintf(ip, "%d.%d.%d.%d", p[0], p[1], p[2], p[3]);
@@ -941,7 +942,7 @@ int parse_fromchar(int fd){
case 0x2709:
if (log_login)
{
- sprintf(tmpsql,"INSERT DELAYED INTO `%s`(`time`,`ip`,`user`,`rcode`,`log`) VALUES (NOW(), '%u', '%s','%s', 'GM reload request')", loginlog_db, *((unsigned int*)p),server[id].name, RETCODE);
+ sprintf(tmpsql,"INSERT DELAYED INTO `%s`(`time`,`ip`,`user`,`rcode`,`log`) VALUES (NOW(), '%u', '%s','%s', 'GM reload request')", loginlog_db, (unsigned int)ntohl(ipl),server[id].name, RETCODE);
if (mysql_query(&mysql_handle, tmpsql)) {
ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
@@ -1452,7 +1453,7 @@ int lan_subnetcheck(long p) {
return 0;
}
-int login_ip_ban_check(unsigned char *p)
+int login_ip_ban_check(unsigned char *p, unsigned long ipl)
{
MYSQL_RES* sql_res;
MYSQL_ROW sql_row;
@@ -1483,7 +1484,7 @@ int login_ip_ban_check(unsigned char *p)
if (log_login)
{
- sprintf(tmpsql,"INSERT DELAYED INTO `%s`(`time`,`ip`,`user`,`rcode`,`log`) VALUES (NOW(), '%u', 'unknown','-3', 'ip banned')", loginlog_db, *((unsigned int *)p));
+ sprintf(tmpsql,"INSERT DELAYED INTO `%s`(`time`,`ip`,`user`,`rcode`,`log`) VALUES (NOW(), '%u', 'unknown','-3', 'ip banned')", loginlog_db, (unsigned int)ntohl(ipl));
// query
if(mysql_query(&mysql_handle, tmpsql)) {
ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
@@ -1547,7 +1548,7 @@ int parse_login(int fd) {
packet_len = RFIFOREST(fd);
//Perform ip-ban check ONLY on login packets
- if (ipban > 0 && login_ip_ban_check(p))
+ if (ipban > 0 && login_ip_ban_check(p,ipl))
{
RFIFOSKIP(fd,packet_len);
session[fd]->eof = 1;