- Timestamp:
- 11/19/08 13:23:17 (17 years ago)
- Location:
- trunk
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/configure.ac
r8 r16 19 19 # Turn on all warnings and error messages, and enforce GNU 20 20 # standards for the package. 21 AM_INIT_AUTOMAKE([-Wall -Werror ])21 AM_INIT_AUTOMAKE([-Wall -Werror gnu]) 22 22 AM_MAINTAINER_MODE 23 23 … … 25 25 # configuration is being performed in the top-level directory. 26 26 # The idea is to prevent this ,because some maintainers tend 27 # to break "off src dir" builds.27 # to break parallel build trees (a.k.a. VPATH builds). 28 28 if test "$srcdir" = "." && test "$enable_maintainer_mode" != "yes"; then 29 29 AC_MSG_ERROR( … … 31 31 Please configure and build in a directory other than the 32 32 top-level source directory. This is needed because a lot 33 of maintainers tend to break "off src dir" builds. This 34 is kinda real ensurance they wont do it. 33 of maintainers tend to break parallel build trees 34 (a.k.a. VPATH builds). This is kinda real ensurance they 35 will not do it (by enforcing everybody to do VPATH builds). 35 36 36 37 For example, try the following from the top-level source … … 45 46 start a build in that directory. 46 47 47 If however you realy want to build in src dir,48 thenuse --enable-maintainer-mode switch.48 If however you realy want to disable this error, 49 use --enable-maintainer-mode switch. 49 50 ]) 50 51 fi -
trunk/src/game/WorldSocket.cpp
r6 r16 19 19 #include "Common.h" 20 20 #include "WorldSocket.h" 21 21 22 #include <ace/Message_Block.h> 22 23 #include <ace/OS_NS_string.h> … … 68 69 #endif 69 70 70 // used when testing to alow login without password and encryption71 // #define _NETCODE_FAKE_AUTH72 73 71 WorldSocket::WorldSocket (void) : 74 72 WorldHandler (), … … 159 157 { 160 158 for (uint32 j = 0; j < 16 && p < pct.size (); j++) 161 sWorldLog.Log ("%.2X ", const_cast<WorldPacket&> (pct)[p++]);159 sWorldLog.Log ("%.2X ", const_cast<WorldPacket&> (pct)[p++]); 162 160 163 161 sWorldLog.Log ("\n"); … … 312 310 if (send_len == 0) 313 311 return this->cancel_wakeup_output (Guard); 314 315 // TODO SO_NOSIGPIPE on platforms that support it312 313 // TODO SO_NOSIGPIPE on platforms that support it 316 314 #ifdef MSG_NOSIGNAL 317 315 ssize_t n = this->peer ().send (m_OutBuffer->rd_ptr (), send_len, MSG_NOSIGNAL); … … 319 317 ssize_t n = this->peer ().send (m_OutBuffer->rd_ptr (), send_len); 320 318 #endif // MSG_NOSIGNAL 321 319 322 320 if (n == 0) 323 321 return -1; … … 426 424 ACE_NEW_RETURN (m_RecvWPct, WorldPacket ((uint16) header.cmd, header.size), -1); 427 425 428 if (header.size > 0)429 {430 m_RecvWPct->resize (header.size);431 m_RecvPct.base ((char*) m_RecvWPct->contents (), m_RecvWPct->size ());432 }426 if (header.size > 0) 427 { 428 m_RecvWPct->resize (header.size); 429 m_RecvPct.base ((char*) m_RecvWPct->contents (), m_RecvWPct->size ()); 430 } 433 431 else 434 {435 ACE_ASSERT(m_RecvPct.space() == 0);436 }432 { 433 ACE_ASSERT (m_RecvPct.space () == 0); 434 } 437 435 438 436 … … 599 597 { 600 598 ACE_ASSERT (new_pct); 601 599 602 600 // manage memory ;) 603 601 ACE_Auto_Ptr<WorldPacket> aptr (new_pct); … … 713 711 account.c_str (), 714 712 clientSeed); 715 716 #if defined _NETCODE_FAKE_AUTH717 bool dontchechtheacc = false;718 uint8 digest_fake[sizeof (digest)];719 memset ((void*) digest_fake, '\0', sizeof (digest_fake));720 if (memcmp ((void*) digest, (void*) digest_fake, sizeof (digest_fake)) == 0)721 {722 dontchechtheacc = true;723 }724 #endif //_NETCODE_FAKE_AUTH725 713 726 714 // Get the account information from the realmd database … … 786 774 const char* vold = fields[6].GetString (); 787 775 788 DEBUG_LOG ("WorldSocket::HandleAuthSession: (s,v) check s: %s v_old: %s v_new: %s", 776 DEBUG_LOG ("WorldSocket::HandleAuthSession: " 777 "(s,v) check s: %s v_old: %s v_new: %s", 789 778 sStr, 790 779 vold, … … 798 787 safe_account.c_str ()); 799 788 800 #if defined _NETCODE_FAKE_AUTH 801 if (!dontchechtheacc) 802 { 803 #endif 804 if (!vold || strcmp (vStr, vold)) 805 { 806 packet.Initialize (SMSG_AUTH_RESPONSE, 1); 807 packet << uint8 (AUTH_UNKNOWN_ACCOUNT); 808 SendPacket (packet); 809 delete result; 810 OPENSSL_free ((void*) sStr); 811 OPENSSL_free ((void*) vStr); 812 813 sLog.outError ("WorldSocket::HandleAuthSession: User not logged."); 814 return -1; 815 } 816 #if defined _NETCODE_FAKE_AUTH 817 } 818 #endif 789 if (!vold || strcmp (vStr, vold)) 790 { 791 packet.Initialize (SMSG_AUTH_RESPONSE, 1); 792 packet << uint8 (AUTH_UNKNOWN_ACCOUNT); 793 SendPacket (packet); 794 delete result; 795 OPENSSL_free ((void*) sStr); 796 OPENSSL_free ((void*) vStr); 797 798 sLog.outBasic ("WorldSocket::HandleAuthSession: User not logged."); 799 return -1; 800 } 819 801 820 802 OPENSSL_free ((void*) sStr); … … 831 813 832 814 delete result; 833 sLog.out Error("WorldSocket::HandleAuthSession: Sent Auth Response (Account IP differs).");815 sLog.outBasic ("WorldSocket::HandleAuthSession: Sent Auth Response (Account IP differs)."); 834 816 return -1; 835 817 } … … 848 830 delete result; 849 831 850 #if defined _NETCODE_FAKE_AUTH 851 if (!dontchechtheacc) 852 { 853 #endif 854 // Re-check account ban (same check as in realmd) 855 QueryResult *banresult = 856 loginDatabase.PQuery ("SELECT " 857 "bandate, " 858 "unbandate " 859 "FROM account_banned " 860 "WHERE id = '%u' " 861 "AND active = 1", 862 id); 863 864 if (banresult) // if account banned 865 { 866 packet.Initialize (SMSG_AUTH_RESPONSE, 1); 867 packet << uint8 (AUTH_BANNED); 868 SendPacket (packet); 869 870 delete banresult; 871 872 sLog.outError ("WorldSocket::HandleAuthSession: Sent Auth Response (Account banned)."); 873 return -1; 874 } 875 876 // Check locked state for server 877 AccountTypes allowedAccountType = sWorld.GetPlayerSecurityLimit (); 878 879 if (allowedAccountType > SEC_PLAYER && security < allowedAccountType) 880 { 881 WorldPacket Packet (SMSG_AUTH_RESPONSE, 1); 882 Packet << uint8 (AUTH_UNAVAILABLE); 883 884 SendPacket (packet); 885 886 sLog.outBasic ("WorldSocket::HandleAuthSession: User tryes to login but his security level is not enough"); 887 return -1; 888 } 889 890 // Check that Key and account name are the same on client and server 891 Sha1Hash sha; 892 893 uint32 t = 0; 894 uint32 seed = m_Seed; 895 896 sha.UpdateData (account); 897 sha.UpdateData ((uint8 *) & t, 4); 898 sha.UpdateData ((uint8 *) & clientSeed, 4); 899 sha.UpdateData ((uint8 *) & seed, 4); 900 sha.UpdateBigNumbers (&K, NULL); 901 sha.Finalize (); 902 903 if (memcmp (sha.GetDigest (), digest, 20)) 904 { 905 packet.Initialize (SMSG_AUTH_RESPONSE, 1); 906 packet << uint8 (AUTH_FAILED); 907 908 SendPacket (packet); 909 910 sLog.outError ("WorldSocket::HandleAuthSession: Sent Auth Response (authentification failed)."); 911 return -1; 912 } 913 #if defined _NETCODE_FAKE_AUTH 914 } 915 #endif 832 // Re-check account ban (same check as in realmd) 833 QueryResult *banresult = 834 loginDatabase.PQuery ("SELECT " 835 "bandate, " 836 "unbandate " 837 "FROM account_banned " 838 "WHERE id = '%u' " 839 "AND active = 1", 840 id); 841 842 if (banresult) // if account banned 843 { 844 packet.Initialize (SMSG_AUTH_RESPONSE, 1); 845 packet << uint8 (AUTH_BANNED); 846 SendPacket (packet); 847 848 delete banresult; 849 850 sLog.outBasic ("WorldSocket::HandleAuthSession: Sent Auth Response (Account banned)."); 851 return -1; 852 } 853 854 // Check locked state for server 855 AccountTypes allowedAccountType = sWorld.GetPlayerSecurityLimit (); 856 857 if (allowedAccountType > SEC_PLAYER && security < allowedAccountType) 858 { 859 WorldPacket Packet (SMSG_AUTH_RESPONSE, 1); 860 Packet << uint8 (AUTH_UNAVAILABLE); 861 862 SendPacket (packet); 863 864 sLog.outBasic ("WorldSocket::HandleAuthSession: User tryes to login but his security level is not enough"); 865 return -1; 866 } 867 868 // Check that Key and account name are the same on client and server 869 Sha1Hash sha; 870 871 uint32 t = 0; 872 uint32 seed = m_Seed; 873 874 sha.UpdateData (account); 875 sha.UpdateData ((uint8 *) & t, 4); 876 sha.UpdateData ((uint8 *) & clientSeed, 4); 877 sha.UpdateData ((uint8 *) & seed, 4); 878 sha.UpdateBigNumbers (&K, NULL); 879 sha.Finalize (); 880 881 if (memcmp (sha.GetDigest (), digest, 20)) 882 { 883 packet.Initialize (SMSG_AUTH_RESPONSE, 1); 884 packet << uint8 (AUTH_FAILED); 885 886 SendPacket (packet); 887 888 sLog.outBasic ("WorldSocket::HandleAuthSession: Sent Auth Response (authentification failed)."); 889 return -1; 890 } 916 891 917 892 std::string address = this->GetRemoteAddress (); … … 935 910 ACE_NEW_RETURN (m_Session, WorldSession (id, this, security, tbc, mutetime, locale), -1); 936 911 937 #if defined _NETCODE_FAKE_AUTH 938 if (!dontchechtheacc) 939 { 940 #endif 941 this->m_Crypt.SetKey (&K); 942 this->m_Crypt.Init (); 943 #if defined _NETCODE_FAKE_AUTH 944 } 945 #endif 912 m_Crypt.SetKey (&K); 913 m_Crypt.Init (); 946 914 947 915 // In case needed sometime the second arg is in microseconds 1 000 000 = 1 sec … … 1044 1012 header.cmd = ACE_SWAP_WORD (header.cmd) 1045 1013 #endif 1046 1047 header.size = (uint16) pct.size () + 2;1014 1015 header.size = (uint16) pct.size () + 2; 1048 1016 header.size = ACE_HTONS (header.size); 1049 1017