View Issue Details

IDProjectCategoryView StatusLast Update
0002282unrealdocumentationpublic2005-02-03 20:46
Reporterseneces Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionopen 
Summary0002282: Server to server parsing problems..
DescriptionI know this isn't proper - OPER messages (:Client OPER username password) shouldn't be sent from server to server.

However, missing this fact one day while coding a little addon package, I found out: Sending an OPER message from a remote server will crash the server you send it to. For whatever reason, OPER messages are parsed (seemingly) as if they are from a local client, which creates an error somewhere.

Its a really minor problem, but should be fixed all the same.
Steps To ReproduceAdd a linkblock and link with telnet (or with some script), create a fake client on your server (NICK message) and then send :Nick OPER test test. The remote server will crash.
3rd party modules

Activities

seneces

2005-01-15 15:46

reporter   ~0008819

err, forgot to change it from documentation for the catagory.

codemastr

2005-01-16 12:45

reporter   ~0008820

Many commands can crash the server. The server<->server protocol is considered to be "trusted". The reason is, if someone you don't trust manages to link a server, you have MUCH bigger problems than a crashing server (like having nickserv passwords stolen, divulging the real IP/hosts of all users, etc.). Could we add protection against these kinds of things? Yes. But, I'm not sure it is worth it. Adding such protection would result in slower processing (we need to add code to check for error conditions).

seneces

2005-01-16 14:41

reporter   ~0008821

why are these commands recognized as real commands? Are you parsing with the same function as data from clients?

codemastr

2005-01-16 15:22

reporter   ~0008822

Yes. Internally, there is no distinction between "this is a client" and "this is a server", in fact, if you look at the code you'll see that everything (both user and server) are referred to as clients.

aquanight

2005-01-16 22:52

reporter   ~0008825

Last edited: 2005-01-16 22:52

But there is an IsServer() macro... a simple if (IsServer(sptr)) return 0; would probably be a nice addition to any m_ commands that are only valid for clients :) . (Heck, maybe just do (sptr == cptr) (or MyClient(sptr) or whatever it is) if it's only valid for local clients (like in OPER's case).) I can't imagine too much of a slowdown (it's just an extra equality test/bit check, right?) especially since most likely most of the commands that actually cause crashes (again, like OPER) aren't used *that* often...

I know servers are assumed to be sane, but... having buggy or incompatible services or services modules crash the hub isn't fun :) (especially when it's not 100% clear it's incompatible).

codemastr

2005-01-17 12:30

reporter   ~0008826

[quote] I can't imagine too much of a slowdown (it's just an extra equality test/bit check, right?) especially since most likely most of the commands that actually cause crashes (again, like OPER) aren't used *that* often...[/quote]
And that's exactly why it *is* a waste. A "good" server will NEVER send out an OPER. So we're adding an if () statement, it is checked everytime a user /oper's. Each time it says "it's ok, let it through." The code is executed each time /oper is used, even though 1 out of every 20 billion times is when it is actually needed.

aquanight

2005-01-17 12:48

reporter   ~0008831

You're right, a sane server (iow, unreal (sane versions, of course), or compatible services) would never cause these things, but it is annoying for those people who are, for example, developing services, or the like, and it isn't just OPER that's like this. There are other commands that seem to set this off as well, like USER, for example.

I suppose you could add the check for debug mode only (eg #ifdef DEBUGMODE), since one doesn't really use a debugmode server for a production network... :) (usually for developing services, modules, bots, etc)

codemastr

2005-01-17 12:54

reporter   ~0008832

[quote]but it is annoying for those people who are, for example, developing services, or the like[/quote]
But you shouldn't be using a live server to develop on in the first place.

aquanight

2005-01-17 12:56

reporter   ~0008833

I never said I'd use a live server? Live or not, it'll still crash, and it's still annoying (though less so, since there's no real users except maybe other developers/testers).

Issue History

Date Modified Username Field Change
2005-01-15 15:45 seneces New Issue
2005-01-15 15:46 seneces Note Added: 0008819
2005-01-16 12:45 codemastr Note Added: 0008820
2005-01-16 14:41 seneces Note Added: 0008821
2005-01-16 15:22 codemastr Note Added: 0008822
2005-01-16 22:52 aquanight Note Added: 0008825
2005-01-16 22:52 aquanight Note Edited: 0008825
2005-01-17 12:30 codemastr Note Added: 0008826
2005-01-17 12:48 aquanight Note Added: 0008831
2005-01-17 12:54 codemastr Note Added: 0008832
2005-01-17 12:56 aquanight Note Added: 0008833
2005-02-03 20:46 syzop Status new => closed