collapse collapse
* User Info
 
 
Welcome, Guest. Please login or register.
* Search

* Board Stats
  • stats Total Members: 989
  • stats Total Posts: 18366
  • stats Total Topics: 2501
  • stats Total Categories: 7
  • stats Total Boards: 35
  • stats Most Online: 1144

Author Topic: AOChat: not expecting login.  (Read 124584 times)

0 Members and 2 Guests are viewing this topic.

Offline Khalem

  • BeBot Founder
  • Administrator
  • ********
  • Posts: 1169
  • Karma: +0/-0
    • http://www.ancarim.com
AOChat: not expecting login.
« on: December 19, 2005, 12:36:17 am »
And everything was going so well until this error cropped up...

So what is causing this?
It would seem that later versions of php (5.0.x and later in particular) have had changes done which breaks backwards compactibilities. In addition 64bit CPU systems also display this behaviour.
Basically, the key generated by PHP for the login is invalid. Auno currently have no plans on fixing AOChat.php, but have provided a workaround using a C based PHP Extention.

Unfortunately, no one has yet compiled this extention for Windows, so unless you run *nix your still sol.

Start by grabbing the aokex extention from http://auno.org/dev/aochat/php-aokex-0.1.tar.gz or from the bottom of this post for a local mirror.
Please note that you will need the phpize program which is by default not installed on most Linux distros. The package that provides this for RPM based distros is php-devel.
Fedora and CentOS uses can simply issue as root:
yum install php-devel

Follow the instructions included in the archive for compiling aokex. Once compiled, you can normally do:
make install
This will install aokex to the system wide extention location.

The important step is to add the following line to the top of your AOChat.php:
Code: [Select]
dl("aokex.so");

Save and fire up your bot. Provided the aokex extention resides where php can find it, that should do the trick and your bot should now work :)
« Last Edit: June 15, 2006, 11:12:09 am by Khalem »
BeBot Founder and Fixer Kingpin

Offline craized

  • Contributor
  • *******
  • Posts: 165
  • Karma: +0/-0
    • http://www.craized.net
Re: AOChat: not expecting login.
« Reply #1 on: December 26, 2005, 11:41:01 pm »
I'm not at home, so I'm not running 64bit, but if this works for me you're my hero! 64bit runs BeBot so quick, broke my heart that it didn't work.
Trailin [213/14][ADVENTURER][RK2]
Bigburtha [216/17][NT][RK2][FROZEN]
Abeham [199/7][TRADER][RK2][FROZEN]


Offline Plac3bo

  • BeBot User
  • **
  • Posts: 50
  • Karma: +0/-0
Re: AOChat: not expecting login.
« Reply #2 on: December 29, 2005, 02:37:39 pm »
ok.. edited my post.. got a bit further now..
phpize goes good, so does configure.. then im at the make part

Quote
/root/php-aokex/aokex-gmp.c:37:17: error: gmp.h: No such file or directory
/root/php-aokex/aokex-gmp.c:44: error: syntax error before 'gmp_randstate_t'
/root/php-aokex/aokex-gmp.c:44: warning: no semicolon at end of struct or union
/root/php-aokex/aokex-gmp.c:45: warning: data definition has no type or storage class
/root/php-aokex/aokex-gmp.c:46: error: syntax error before 'dh_g'
/root/php-aokex/aokex-gmp.c:46: warning: data definition has no type or storage class
/root/php-aokex/aokex-gmp.c:47: error: syntax error before '}' token
/root/php-aokex/aokex-gmp.c: In function 'aokex_math_init':

and it goes on and on with errors.. :x
« Last Edit: December 29, 2005, 02:56:01 pm by Plac3bo »

Offline Khalem

  • BeBot Founder
  • Administrator
  • ********
  • Posts: 1169
  • Karma: +0/-0
    • http://www.ancarim.com
Re: AOChat: not expecting login.
« Reply #3 on: December 31, 2005, 12:05:55 pm »
ok.. edited my post.. got a bit further now..
phpize goes good, so does configure.. then im at the make part

Quote
/root/php-aokex/aokex-gmp.c:37:17: error: gmp.h: No such file or directory
/root/php-aokex/aokex-gmp.c:44: error: syntax error before 'gmp_randstate_t'
/root/php-aokex/aokex-gmp.c:44: warning: no semicolon at end of struct or union
/root/php-aokex/aokex-gmp.c:45: warning: data definition has no type or storage class
/root/php-aokex/aokex-gmp.c:46: error: syntax error before 'dh_g'
/root/php-aokex/aokex-gmp.c:46: warning: data definition has no type or storage class
/root/php-aokex/aokex-gmp.c:47: error: syntax error before '}' token
/root/php-aokex/aokex-gmp.c: In function 'aokex_math_init':

and it goes on and on with errors.. :x


You need the GMP library headers installed as per the AOkex documentation.
See http://www.swox.com/gmp/
BeBot Founder and Fixer Kingpin

Offline Heffalomp

  • BeBot Apprentice
  • ***
  • Posts: 80
  • Karma: +0/-0
Re: AOChat: not expecting login.
« Reply #4 on: January 18, 2006, 01:02:49 am »
I've done this with no errors during compiling but when i load the bot it still gives the:
    AOChat: not expecting login.

php.ini
Code: [Select]
memory_limit = 20M
extension_dir = ./php_extension/

extension = sockets.so
extension = bz2.so
extension = gmp.so
anny modules I am forgetting?
also added the
 
Code: [Select]
dl("aokex.so");
to the begining of the AOChat.php file and changed the $key =
Code: [Select]
/* Login functions */
    function authenticate($username, $password)
    {
      if($this->state != "auth")
        die("AOChat: not expecting authentication.\n");
     
      $key = aokex_login_key($this->serverseed, $username, $password);
      /*
      $key = $this->generate_login_key($this->serverseed, $username, $password);
      */
      $pak = new AOChatPacket("out", AOCP_LOGIN_REQUEST, array(0, $username, $key));
      $this->send_packet($pak);
      $packet = $this->get_packet();
      if($packet->type != AOCP_LOGIN_CHARLIST)
      {
        return false;
      }

Running Ubuntu 5.10 with PHP 4.4.2
« Last Edit: January 18, 2006, 01:27:50 am by johskar »
"Ubuntu" is an ancient African word, meaning "I can't configure Slackware"

Offline Ainen

  • BeBot User
  • **
  • Posts: 22
  • Karma: +0/-0
Re: AOChat: not expecting login.
« Reply #5 on: January 18, 2006, 02:10:36 am »
I couldn't get it to work until I moved the dl() statement down into the authenticate function. The extension was compiled properly and loading because I made little test PHP files just to check for aokex_login_key and they were successful, but until I made the move, I got errors about aokex_login_key not existing as a function. Go figure.

Code: [Select]
if($this->state != "auth")
        die("AOChat: not expecting authentication.\n");
     
      dl("aokex.so");
      $key = aokex_login_key($this->serverseed, $username, $password);
BeBot 0.3.4 svn 91 // PHP 4.3.9 // MySQL 4.1.12

Offline Heffalomp

  • BeBot Apprentice
  • ***
  • Posts: 80
  • Karma: +0/-0
Re: AOChat: not expecting login.
« Reply #6 on: January 18, 2006, 03:56:07 pm »
Tried that, and didn't work for me :/
"Ubuntu" is an ancient African word, meaning "I can't configure Slackware"

Offline craized

  • Contributor
  • *******
  • Posts: 165
  • Karma: +0/-0
    • http://www.craized.net
Re: AOChat: not expecting login.
« Reply #7 on: January 18, 2006, 11:04:56 pm »
I know this doesn't help anyone, but I just wanted to say that I got this working just fine on a 64bit gentoo install from just Khalem's original steps.

GL to the rest of you.
Trailin [213/14][ADVENTURER][RK2]
Bigburtha [216/17][NT][RK2][FROZEN]
Abeham [199/7][TRADER][RK2][FROZEN]


Offline sentry

  • BeBot Rookie
  • *
  • Posts: 9
  • Karma: +0/-0
Re: AOChat: not expecting login.
« Reply #8 on: February 27, 2006, 04:32:51 am »
Any word if anyone has compiled the extensions for windows yet?

Thanks
« Last Edit: February 28, 2006, 01:17:54 am by sentry »

Offline Mawerick

  • BeBot Rookie
  • *
  • Posts: 6
  • Karma: +0/-0
Re: AOChat: not expecting login.
« Reply #9 on: March 02, 2006, 04:07:56 am »
Here's an aokex php extension that works for windows:
http://www.wrongplace.net/ao/aokex.zip

Just change
Code: [Select]
dl("aokex.so") to
Code: [Select]
dl("aokex.dll")
It includes the gmp.dll that is needed to load it.
« Last Edit: March 02, 2006, 04:16:10 am by Mawerick »

Offline sentry

  • BeBot Rookie
  • *
  • Posts: 9
  • Karma: +0/-0
Re: AOChat: not expecting login.
« Reply #10 on: March 02, 2006, 01:02:27 pm »
Thanks Mawerick, now up and running on windows with php5 and the latest aochat.php from auno.org

Offline Khalem

  • BeBot Founder
  • Administrator
  • ********
  • Posts: 1169
  • Karma: +0/-0
    • http://www.ancarim.com
Re: AOChat: not expecting login.
« Reply #11 on: March 03, 2006, 05:35:25 am »
Thats awesome Mawerick :)

Next version will work out of the box on windows now aside from the MySQL setup.
I dont suppose you have a MySQL connector compiled for php 4.4.2 and MySQL 4.1/5.0? =)
BeBot Founder and Fixer Kingpin

Offline Mawerick

  • BeBot Rookie
  • *
  • Posts: 6
  • Karma: +0/-0
Re: AOChat: not expecting login.
« Reply #12 on: March 03, 2006, 05:39:32 pm »
Sorry, no. Don't have either of those installed on my windows box.

Offline Khalem

  • BeBot Founder
  • Administrator
  • ********
  • Posts: 1169
  • Karma: +0/-0
    • http://www.ancarim.com
Re: AOChat: not expecting login.
« Reply #13 on: March 04, 2006, 09:37:50 am »
No biggie. I decided on upgrading the bundled php to 5.1 to make life easier on everyone. Since we have aokex for windows now thats no longer an issue with php 5, and php5 ships with MySQL connetor that supports the new authentication of MySQL 4.1 and newer.
BeBot Founder and Fixer Kingpin

Offline Xenixa

  • Contributor
  • *******
  • Posts: 307
  • Karma: +0/-0
Re: AOChat: not expecting login.
« Reply #14 on: March 17, 2006, 01:15:21 am »
I believe the MySQL extention (since PHP4.4 and greater) for Win32 is compiled in the PHP.exe CLI.

That is I don't have any mysql.dll's defined in my php.ini and it connects. *shrug*
<<< Hack's in Zend Studio

All my Custom Bebot files may be Found Here <-clicky

 

* Recent Posts
Com bot module by bitnykk
[November 25, 2024, 05:36:11 pm ]


0.8.x updates for AO by bitnykk
[June 23, 2024, 03:19:47 pm ]


0.8.x updates for AoC by bitnykk
[June 23, 2024, 03:19:44 pm ]


[AoC] special char for items module by bitnykk
[February 09, 2024, 09:41:18 pm ]


BeBot still alive & kicking ! by bitnykk
[December 17, 2023, 12:58:44 am ]

* Who's Online
  • Dot Guests: 112
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.
* Forum Staff
bitnykk admin bitnykk
Administrator
Khalem admin Khalem
Administrator
WeZoN gmod WeZoN
Global Moderator
SimplePortal 2.3.7 © 2008-2024, SimplePortal