Page 1 of 1

Coding own services, hostname problems

Posted: Tue Aug 17, 2004 8:37 am
by QuietGuy
If I've posted this in the wrong subforum, I hope a moderator will move it to the correct forum.

I am currently building my own services package in PHP for my own IRC project. I am using Unreal3.2.1.

When the services connects I get this:

Code: Select all

[12:00:21] NICK nickname 1 1092740344 ident myhost.adsl.xs4all.nl irc.myserver.nl 0 :QuietGuy
[12:00:21] nickname MODE nickname :+ix
[12:00:21] nickname SETHOST dc-9C0FEF79.adsl.xs4all.nl
I can use this to fill my user table with the user modes, host and real host.

But if the services are already connected to the IRCd, I only get the NICK and MODE-lines:

Code: Select all

[12:59:04] NICK nickname 1 1092740344 ident myhost.adsl.xs4all.nl irc.myserver.nl 0 :QuietGuy
[12:59:04] nickname MODE nickname :+ix
because I receive a mode +x I can hide the host in NICKSERV info, but I want to reply with the fake host, and use that host in my user table. Also required for channel bans via CHANSERV.

Does anybody know how can I find out the correct VHOST or how to recalculate it with PHP?

Posted: Tue Aug 17, 2004 12:22 pm
by AngryWolf
There's no need to recalculate the cloaked host, Unreal can send it to you. Send "PROTOCTL VHP" to the remote side before issuing the SERVER command, and you'll always see the SETHOST messages. (By the way, I can't see VHP documented anywhere in Unreal3.2/doc/technical/protoctl.txt.

Posted: Tue Aug 17, 2004 1:11 pm
by QuietGuy
AngryWolf wrote:There's no need to recalculate the cloaked host, Unreal can send it to you. Send "PROTOCTL VHP" to the remote side before issuing the SERVER command, and you'll always see the SETHOST messages. (By the way, I can't see VHP documented anywhere in Unreal3.2/doc/technical/protoctl.txt.
Thank you for the reply.
I've tried it, but when a user connects, my ircd crashes. Latest entries in the ircd.log file:
[Tue Aug 17 17:47:05 2004] - SERVER services.myserver.nl
[Tue Aug 17 17:47:09 2004] - Connect - QuietGuy![email protected] [VHOST dc-9C0FEF59.adsl.xs4all.nl]
My current code (only the connection) is:

Code: Select all

function send_data($data) {
        global $irc;
        fputs($irc,$data);
        // some lines for logging
}
if(!$irc=fsockopen($ircserver_host,$ircserver_port)) { die("Cannot connect"); }
stream_set_blocking($irc,false);
send_data("PASS :".$ircserver_pass."\n");
send_data("PROTOCTL VHP\n");
send_data("SERVER ".$ircservices_host." 0 :[".$ircservices_host."] ".$ircservices_description."\n");
Indeed, not all PROTOCTL-tags are documented...

Posted: Tue Aug 17, 2004 1:26 pm
by AngryWolf
Perhaps you sent a message to the ircd that made it crash. Have you ever used GDB to debug crashes? If not, it's time to start getting familiar with it... Or try to figure out what's wrong with your commands, because ircd.log won't tell you a single word about the crash.

Posted: Tue Aug 17, 2004 1:29 pm
by QuietGuy
AngryWolf wrote:Perhaps you sent a message to the ircd that made it crash. Have you ever used GDB to debug crashes? If not, it's time to start getting familiar with it... Or try to figure out what's wrong with your commands, because ircd.log won't tell you a single word about the crash.
I found out when I do:

Code: Select all

send_data("PROTOCTL NICKv2 VHP\n");
the server won't crash. I have never used GDB, but as you may notice, I am experimenting and have an idea, but need to learn a few more things to get it working :D

Posted: Tue Aug 17, 2004 1:36 pm
by QuietGuy
This topic may be closed, it works now, thanks to AngryWolf :idea: