1
0
mirror of https://github.com/osmarks/ngircd.git synced 2025-09-23 12:44:04 +00:00

Compare commits

...

256 Commits

Author SHA1 Message Date
Alexander Barton
4726e36efc Changed version string back to "0.6.x-CVS". 2003-03-09 22:33:19 +00:00
Alexander Barton
3105bd9fff Updated documentation. 2003-03-09 20:16:57 +00:00
Alexander Barton
cb8ed9d5da ngIRCd now handles recursive calls to Conn_Close() correctly (from HEAD). 2003-03-09 20:16:46 +00:00
Alexander Barton
a156641afd Updated version number to 0.6.1 :-) 2003-01-21 21:23:34 +00:00
Alexander Barton
78752bbff8 Updated documentation. 2003-01-21 21:20:19 +00:00
Alexander Barton
90e6ec3f89 The server didn't validate weather the target user of a channel user mode
change is a valid channel member or not (from HEAD).
2003-01-21 21:05:19 +00:00
Alexander Barton
9810da343c - Non-memers of a channel could crash the server when trying to change its modes. (HEAD) 2003-01-17 19:08:57 +00:00
Alexander Barton
e8b99f4d3a - Updated documentation. 2003-01-17 19:07:15 +00:00
Alexander Barton
84efd5e969 - Removed strl[cat|cpy]() function calls ... 2003-01-08 23:13:45 +00:00
Alexander Barton
33927ee854 - Fixed up previous CHANINFO patch ... 2003-01-08 23:09:34 +00:00
Alexander Barton
3d46fc6036 - Changed semantics of Client_SetAway() [from HEAD]. 2003-01-08 23:09:04 +00:00
Alexander Barton
ac587adc69 - MODE returns the key and user limit for channel members correctly now. [Head] 2003-01-08 23:08:12 +00:00
Alexander Barton
2688829ddd - Updated documentation. 2003-01-08 23:07:57 +00:00
Alexander Barton
4294dd8043 - Updated documentation. 2003-01-08 20:36:57 +00:00
Alexander Barton
6b9ce1cb72 - Fixed up broken patch (once again -- *ARGL*) ... 2003-01-08 20:32:17 +00:00
Alexander Barton
72a4c0489f - CHANINFO: Fixed up broken fix ... 2003-01-08 20:22:57 +00:00
Alexander Barton
60a4085c38 - fixed up propagation of modes with arguments between servers. 2003-01-08 17:47:48 +00:00
Alexander Barton
5206ab302d - Updated documentation. 2003-01-08 17:47:43 +00:00
Alexander Barton
635afd660d - Updated documentation. 2003-01-05 23:04:12 +00:00
Alexander Barton
5b3d89312e - CVS date is in ISO format now (YYYY-MM-DD) [from HEAD]. 2003-01-04 10:58:15 +00:00
Alexander Barton
f7c1242979 - the server sets a correct default AWAY message when receiving a "MODE +a". 2003-01-02 18:03:05 +00:00
Alexander Barton
822d3d12c8 - Adjusted copyright banner to include 2003 :-) 2003-01-01 13:47:42 +00:00
Alexander Barton
7de53b1903 - Fixed up command forwarding: only to servers! (from CVS-HEAD) 2003-01-01 13:46:37 +00:00
Alexander Barton
9e3def72e0 - Updated documentation. 2003-01-01 13:46:06 +00:00
Alexander Barton
3da58202e6 - Fixed up bad test if we are still connected in KILL. 2002-12-31 15:48:33 +00:00
Alexander Barton
ec016a89e2 - Fixed up KILL once more: it can't kill other clients than valid users now. 2002-12-27 13:37:43 +00:00
Alexander Barton
1bcc64721f - Fixed KILL: you can't crash the server by killing yourself any more;
and ngIRCd no longer sends a QUIT to other servers after the KILL. (HEAD)
2002-12-26 19:01:29 +00:00
Alexander Barton
939ec25f72 - Changed version string to "0.6.x-CVS". 2002-12-26 18:48:44 +00:00
Alexander Barton
1f7024cb36 - Version 0.6.0 2002-12-24 13:54:09 +00:00
Alexander Barton
c2fcc98a55 - Updated Documentation for version 0.6.0 2002-12-24 13:53:54 +00:00
Alexander Barton
fe06c3200e - Dokumentation aktualisiert. 2002-12-22 23:50:59 +00:00
Alexander Barton
dd7ff82b8f - Version 0.6.0-pre2 2002-12-22 23:43:16 +00:00
Alexander Barton
f84cd22fe1 - Backports from CVS-HEAD (005-numeric, extended LUSERS reply). 2002-12-22 23:42:28 +00:00
Alexander Barton
3544d1bc40 - Version 0.6.0-pre1 2002-12-18 16:50:29 +00:00
Alexander Barton
6c88184b58 - Updated documentation. 2002-12-18 16:27:14 +00:00
Alexander Barton
b9d6a03e25 - Updated documentation. 2002-12-18 14:19:58 +00:00
Alexander Barton
8841d87365 - fixed user mode propagation over server-links (IRC operator, away, ...) 2002-12-18 14:16:21 +00:00
Alexander Barton
d9e3f834d7 - fixed RPL_STATSCOMMANDS_MSG 2002-12-18 14:03:14 +00:00
Alexander Barton
210282d00f - implemented subfunction "m" of STATS command. 2002-12-18 13:55:41 +00:00
Alexander Barton
17f7c6d3ed - new function Parse_GetCommandStruct(). 2002-12-18 13:53:20 +00:00
Alexander Barton
a02bf31d50 - new functions Conn_ResetWCounter() and Conn_WCounter(). 2002-12-18 13:50:22 +00:00
Alexander Barton
98677b4348 - "STATS l" now only shows server-server-links and the own connection. 2002-12-18 13:07:46 +00:00
Alexander Barton
03d5fd6cb7 - Updated documentation. 2002-12-18 12:19:07 +00:00
Alexander Barton
3a811ef563 - Validate_Config(): removed unused variable "i". 2002-12-18 02:53:36 +00:00
Alexander Barton
3e4f58e416 - If Conf_MaxConnections is "ulimited" (<1) it is limited to FD_SETSIZE. 2002-12-18 02:52:51 +00:00
Alexander Barton
b7be46ed8a - validate Conf_MaxConnections against FD_SETSIZE if available;
- fixed up some log messages and enhanced configuration validation.
2002-12-18 02:47:12 +00:00
Alexander Barton
902ad91212 - new allocated connection structures will be initialized correctly now. 2002-12-17 11:46:54 +00:00
Alexander Barton
ca584143c6 - Dokumentation aktualisiert. 2002-12-16 23:13:10 +00:00
Alexander Barton
892144dc71 - new constant RPL_YOURESERVICE_MSG, ERR_CHANNELISFULL_MSG, ERR_BADCHANNELKEY_MSG.
- fixed ERR_PASSWDMISMATCH_MSG.
2002-12-16 23:11:59 +00:00
Alexander Barton
8d024d05d2 - new constant MAX_SERVICES,
- added k and l modes to CHANMODES.
2002-12-16 23:10:56 +00:00
Alexander Barton
69ad0e386e - Implemented channel modes k (key) and l (user limit). 2002-12-16 23:06:46 +00:00
Alexander Barton
2e88dd72d1 - New functions Channel_[Set]Key(), Channel_[Set]MaxUsers. 2002-12-16 23:05:24 +00:00
Alexander Barton
7924fafb25 - fixed some error messages and prefixes. 2002-12-16 17:14:57 +00:00
Alexander Barton
7f61f413f4 - fixed broken handling of modes received from other servers. 2002-12-16 10:52:53 +00:00
Alexander Barton
865c43080a - Updated documentation. 2002-12-15 16:30:33 +00:00
Alexander Barton
c0d74a3860 - fixed some parsing bugs.
- better logging.
2002-12-15 16:29:18 +00:00
Alexander Barton
3c7909ccec - Dokumentation aktualisiert. 2002-12-15 15:54:11 +00:00
Alexander Barton
48ec815e99 - modified test suite to reflect changes in MODE parser. 2002-12-15 15:52:34 +00:00
Alexander Barton
80c6dc86ed - new (and much more flexible!) MODE parser 2002-12-15 15:51:24 +00:00
Alexander Barton
25ca2b3cc5 - removed Conf_MaxPChannels and reverted to old behavior. 2002-12-14 13:36:19 +00:00
Alexander Barton
f7fe170a5e Dokumentation aktualisiert. 2002-12-14 13:33:44 +00:00
Alexander Barton
e65ab4a3f7 - Dokumentation aktualisiert. 2002-12-14 13:32:30 +00:00
Alexander Barton
2694017426 - Conf_MaxPChannels is considered properly in channel mode changes now. 2002-12-14 13:24:09 +00:00
Alexander Barton
00e75ccd7d - fixed up Conf_MaxJoins test on JOIN. 2002-12-14 13:23:11 +00:00
Alexander Barton
e907816380 - fixed up Channel_PCount() and Channel_CountForUser(). 2002-12-14 13:21:56 +00:00
Alexander Barton
b55915c1fe - Dokumentation aktualisiert. 2002-12-14 13:19:39 +00:00
Alexander Barton
5b8b3b8384 - maximum channels per user limit implemented. 2002-12-13 17:53:32 +00:00
Alexander Barton
9f74b95015 - new message ERR_TOOMANYCHANNELS_MSG. 2002-12-13 17:51:41 +00:00
Alexander Barton
8b7b23cf8f - new configuration variables: MaxJoins, MaxPChannels. 2002-12-13 17:32:33 +00:00
Alexander Barton
b7eb5f66dc - new function Channel_CountForUser(). 2002-12-13 17:22:57 +00:00
Alexander Barton
427be23b6e - adjusted generation of cvs-version.h to new file header format. 2002-12-12 12:36:41 +00:00
Alexander Barton
ba767481d9 - removed old ID tag 2002-12-12 12:33:14 +00:00
Alexander Barton
490f28ffd1 - new file header format (in english);
- new file ident semantics.
2002-12-12 12:24:18 +00:00
Alexander Barton
c7f075236b - new file header format (in english). 2002-12-12 12:23:43 +00:00
Alexander Barton
44a2b3cf69 - added missing include of stdio.h header for sprintf(). 2002-12-12 11:40:41 +00:00
Alexander Barton
f0d633b5ac - new file header format. 2002-12-12 11:37:11 +00:00
Alexander Barton
0f3f03b51d - fixed up broken $Id field in new file header ... 2002-12-12 11:31:21 +00:00
Alexander Barton
fa7b3f0e4c - new file header format. 2002-12-12 11:30:23 +00:00
Alexander Barton
6725d7893c - translated file header and comments to english;
- new file ident semantics.
2002-12-12 11:26:08 +00:00
Alexander Barton
11c4e786fa - Dokumentation aktualisiert. 2002-12-06 17:03:46 +00:00
Alexander Barton
b99af4fa47 - IRC Operators can KILL users now. 2002-12-06 17:02:39 +00:00
Alexander Barton
6591f17f0a - Logging von Verbindungen, die geschlossen werden/wurden verbessert. 2002-12-03 18:57:10 +00:00
Alexander Barton
9f122037ae - Logging von doppelten ID's verbessert. 2002-12-03 18:56:33 +00:00
Alexander Barton
cde9dfdb77 - Verhalten von Conn_RecvQ() und Conn_SendQ() bei Kompression korrigiert. 2002-12-02 13:56:24 +00:00
Alexander Barton
f0349f5266 - bei ISON und USERHOST fehlte im Ergebnis-String der korrekte Absender. 2002-12-02 13:45:51 +00:00
Alexander Barton
4807c4e636 - Dokumentation aktualisiert. 2002-12-02 13:44:36 +00:00
Alexander Barton
c1cafbddfe - Dokumentation aktualisiert. 2002-12-02 13:20:41 +00:00
Alexander Barton
bad7ac62a7 - STATS: Unterfunktion "L" implementiert. 2002-12-02 13:20:02 +00:00
Alexander Barton
39219230b2 - neue Befehle: Conn_StartTime(), Conn_SendQ(), Conn_RecvQ(), Conn_SendMsg(),
Conn_RecvMsg(), Conn_SendBytes[Zip](), Conn_RecvBytes[Zip]().
2002-12-02 13:19:37 +00:00
Alexander Barton
1e5fa014ba - RPL_STATSLINKINFO_MSG ueberarbeitet, RPL_STATSLINKINFOZIP_MSG eingefuehrt. 2002-12-02 13:17:46 +00:00
Alexander Barton
0efec7c094 - Dokumentation aktualisiert. 2002-12-01 13:00:50 +00:00
Alexander Barton
c3a892e165 - Dokumentation aktualisiert. 2002-11-30 22:18:09 +00:00
Alexander Barton
2e02da291a - Konfiguration wird nun besser validiert (Laenge, Zahlen). 2002-11-30 22:15:49 +00:00
Alexander Barton
a39f479163 - Tests auf ctype.h und isdigit() hinzugefuegt. 2002-11-30 22:14:47 +00:00
Alexander Barton
e50d568f25 - bei STATS wurde der Target-Server aus dem falschen Argument bestimmt. 2002-11-30 18:10:01 +00:00
Alexander Barton
0c471b84f7 - neues Source-Modul "irc-info"; neuer Befehl STATS. 2002-11-30 17:39:56 +00:00
Alexander Barton
1e59617d2c - Parser auf Befehlstabelle umgestellt. 2002-11-30 15:04:57 +00:00
Alexander Barton
e93f545c74 - "Text-Prefix" fuer Server-Notices auf "" gesetzt. 2002-11-29 17:38:17 +00:00
Alexander Barton
a1437f1ad0 - der Server verschickt keine "NOTICE AUTH"'s mehr. 2002-11-29 17:36:50 +00:00
Alexander Barton
1d8cb34bc8 - "NOTICE AUTH" und Statistiken werden im Strict-RFC-Modus nicht mehr erzeugt. 2002-11-29 13:13:42 +00:00
Alexander Barton
7a6f99a607 - Dokumentation aktualisiert. 2002-11-29 11:42:58 +00:00
Alexander Barton
93a39e8782 - Vor dem Schliessen einer Verbindung wird versucht, den Buffer zu leeren. 2002-11-28 16:56:20 +00:00
Alexander Barton
a1dff15252 - Dokumentation aktualisiert. 2002-11-28 14:32:18 +00:00
Alexander Barton
ee2c0f7701 - SQUIT wird nicht mehr zweimal fuer einen Server verschickt. 2002-11-28 14:31:43 +00:00
Alexander Barton
d3a6537fce - beim Umschalten auf Kompression wurden evtl. bereits gelesene Daten nicht
entpackt, der Datenstrom war somit dann korrumpiert.
2002-11-28 12:17:38 +00:00
Alexander Barton
b0b797b396 - Logging bei Prefix-Fehlern verbessert. 2002-11-28 11:02:50 +00:00
Alexander Barton
2de5b5cf4a - Dokumentation aktualisiert. 2002-11-26 23:28:49 +00:00
Alexander Barton
2625ce7875 - Dokumentation aktualisiert. 2002-11-26 23:20:19 +00:00
Alexander Barton
65f3adca21 - Unterstuetzung fuer komprimierte Server-Server-Links implementiert. 2002-11-26 23:07:24 +00:00
Alexander Barton
ecde730ec4 - neue Funktionen: Conn_SetOption(), Conn_UnsetOption(), Conn_Options().
- wenn mit zlib-Support: Conn_InitZip().
2002-11-26 23:06:51 +00:00
Alexander Barton
e553829a59 - Test auf zlib sowie neue Option "--disable-zlib". 2002-11-26 23:05:06 +00:00
Alexander Barton
7cc12a3d63 - Projektdatei aktualisiert (u.a. Compiler- und Linker-Flags) 2002-11-26 08:37:35 +00:00
Alexander Barton
ad98f2c20d - Falsche Variable korrigiert ... 2002-11-26 08:36:34 +00:00
Alexander Barton
dc8ca3dfaf - nun ueberfluessige Meldung entfernt. 2002-11-25 01:01:59 +00:00
Alexander Barton
ae128734ac - Dokumentation aktualisiert. 2002-11-24 18:47:15 +00:00
Alexander Barton
f86bbd718d - neuer Befehl IRC_TIME(). 2002-11-24 18:45:53 +00:00
Alexander Barton
283aed75cf - neuer IRC-Befehl "TIME". 2002-11-24 18:45:43 +00:00
Alexander Barton
15d78412bc - neue Konstante RPL_TIME_MSG. 2002-11-24 18:45:31 +00:00
Alexander Barton
1fd9216ca4 - MOTD kann nun auch an andere Server delegiert werden. 2002-11-24 16:36:03 +00:00
Alexander Barton
a7eb18db4e - Dokumentation aktualisiert. 2002-11-24 16:14:54 +00:00
Alexander Barton
5ecb00ed23 - volle Lesebuffer und Timeouts behandelt Conn_Handle() nun besser.
- Handle_Buffer() liefert nun ein Ergebnis.
2002-11-23 17:04:07 +00:00
Alexander Barton
5e89b0c82d - Dokumentation aktualisiert. 2002-11-23 16:19:38 +00:00
Alexander Barton
22b7b07932 - select() in Try_Write() hat falschen (keinen!) Timeout verwendet;
- der Timeout fuer das select() in Conn_Handler() ist nun TIME_RES (=2).
2002-11-23 16:09:57 +00:00
Alexander Barton
57bc0d7895 - neue Konstante TIME_RES: "Zeitaufloesung" des Servers. 2002-11-23 16:08:18 +00:00
Alexander Barton
5334778dbd - Dokumentation aktualisiert ... 2002-11-23 15:04:28 +00:00
Alexander Barton
1dd953b0c0 - Test-Suite an korrigiertest RPL_UMODEIS angepasst. 2002-11-22 23:45:51 +00:00
Alexander Barton
fa3dbfd8d6 - RELOAD in REHASH umbenannt.
- neue Funktion WHOWAS.
2002-11-22 23:33:00 +00:00
Alexander Barton
4eb57b590b - IRC_RELOAD() in IRC_REHASH() umbenannt. 2002-11-22 23:32:29 +00:00
Alexander Barton
12bf203167 - neue Funktion IRC_WHOWAS() begonnen. 2002-11-22 23:31:56 +00:00
Alexander Barton
cf2d479437 - NGIRCd_Reload() in NGIRCd_Rehash() umbenannt. 2002-11-22 23:31:23 +00:00
Alexander Barton
413fed9858 - Dokumentation aktualisiert. 2002-11-22 23:30:36 +00:00
Alexander Barton
60f14cca38 - neue Meldungen: RPL_STATSLINKINFO, RPL_STATSCOMMANDS, RPL_ENDOFSTATS,
RPL_WHOWASUSER, RPL_ENDOFWHOWAS und ERR_WASNOSUCHNICK.
2002-11-22 23:08:04 +00:00
Alexander Barton
4f54760c4b - Dokumentation aktualisiert [RPL_UMODEIS] 2002-11-22 22:57:14 +00:00
Alexander Barton
c0e7a0124d - RPL_UMODEIS hat Code 221, nicht 211 ... *argl* 2002-11-22 22:56:58 +00:00
Alexander Barton
b8cf379fd6 - Dokumentation aktualisiert [ChanMode P nur noch fuer IRC-Op's] 2002-11-22 18:29:46 +00:00
Alexander Barton
085a03d107 - Channel-Mode "P" ("persistent") kann nur noch von IRC-Ops gesetzt werden. 2002-11-22 18:28:22 +00:00
Alexander Barton
ab788a2ed1 - Dokumentation aktualisiert [RELOAD]. 2002-11-22 18:01:59 +00:00
Alexander Barton
4c6e07c309 - neue Funktion NGIRCd_Reload(). 2002-11-22 17:59:54 +00:00
Alexander Barton
e311cc0140 - Listen-Sockets werden ueber neue Funktion Conn_InitListeners() erzeugt.
- neue Funktion NGIRCd_Reload().
- Logging bei empfangenen Signalen verbessert.
- SIGHUP ruft nun NGIRCd_Reload() auf.
2002-11-22 17:59:43 +00:00
Alexander Barton
a5c9229084 - neue Funktion IRC_RELOAD(). 2002-11-22 17:58:41 +00:00
Alexander Barton
a0c032b2ff - neue Funktionen Conn_InitListeners() und Conn_ExitListeners(). 2002-11-22 17:58:19 +00:00
Alexander Barton
03ec91f943 - bessere Log-Meldungen. 2002-11-22 17:57:40 +00:00
Alexander Barton
7233b72145 - Channel_InitPredefined() prueft nun, ob ein Channel bereits existiert. 2002-11-22 17:57:15 +00:00
Alexander Barton
1656841f25 - neuer Befehl IRC_RELOAD(). 2002-11-22 16:36:43 +00:00
Alexander Barton
799511d472 - Befehle sortiert,
- neuer Befehl RELOAD.
2002-11-22 16:36:02 +00:00
Alexander Barton
ffb90f4cb5 - Logging vom Resolver und Connection-Statistiken verbessert. 2002-11-22 16:35:19 +00:00
Alexander Barton
e46b124ca4 - Dokumentation aktualisiert. 2002-11-20 15:50:13 +00:00
Alexander Barton
c6b9f3a13d - angenommene Socketes werden nun korrekt auf "non-blocking" gestellt;
- beim Senden und Empfangen wird EAGAIN ("Blockierung") nun abgefangen.
2002-11-20 15:48:41 +00:00
Alexander Barton
6d5b606c46 - Dokumentation aktualisiert. 2002-11-20 11:14:16 +00:00
Alexander Barton
dd09b17eae - Fehler-Ausgaben verbessert (Prefix-Fehler). 2002-11-20 10:54:24 +00:00
Alexander Barton
caa7049e2b - Dokumentation aktualisiert [asyncrone Server-Passwoerter]. 2002-11-19 12:50:48 +00:00
Alexander Barton
b2615bcc76 - Server identifizieren sich nun mit asyncronen Passwoertern. 2002-11-19 12:50:20 +00:00
Alexander Barton
1c0ded41af - Rechtschreibfehler korrigiert ;-) 2002-11-18 18:49:34 +00:00
Alexander Barton
7bbdfb3d84 - anstelle von "ListenPorts" wird nun korrekt "Ports" ausgegeben. 2002-11-18 18:47:42 +00:00
Alexander Barton
0086d2771d - corrected a permission problem (Sean Reifschneider). 2002-11-18 14:11:45 +00:00
Alexander Barton
98bc7d4fb7 - ProjectBuilder-Projektdatei aktualisiert. 2002-11-18 14:06:47 +00:00
Alexander Barton
be9df69116 - doc/en/sample-ngircd.conf in Makefile-System ergaenzt. 2002-11-18 14:06:29 +00:00
Alexander Barton
f80a5ae1de - Dokumentation aktualisiert. 2002-11-15 22:08:30 +00:00
Alexander Barton
b1a148905a - unter HP-UX wird nun _XOPEN_SOURCE_EXTENDED definiert. Fuer den gcc
unter 11.11 ist dies erforderlich.
2002-11-15 22:08:19 +00:00
Alexander Barton
8457fca570 - Dokumentation aktualisiert. 2002-11-11 13:07:27 +00:00
Alexander Barton
999897f587 - Dokumentation aktualisiert. 2002-11-11 01:08:55 +00:00
Alexander Barton
ab2d1ca41e - Dokumentation fuer A/UX ueberarbeitet. 2002-11-11 00:59:11 +00:00
Alexander Barton
ee489ee6d7 - Dokumentation aktualisiert. 2002-11-11 00:54:44 +00:00
Alexander Barton
6250dcb1dc - Fehler-Handling von connect() gefixed: der Server kann sich nun auch
unter A/UX wieder zu anderen verbinden.
2002-11-11 00:54:25 +00:00
Alexander Barton
797f9170d7 - Test-Suite an A/UX angepasst. 2002-11-10 14:28:06 +00:00
Alexander Barton
071686ac6e - Dokumentation aktualisiert. 2002-11-10 13:39:17 +00:00
Alexander Barton
70c9c05153 - User und Gruppe werden nun sowohl numerisch als auch namentlich angezeigt. 2002-11-10 13:38:41 +00:00
Alexander Barton
bf84670aaa - Dokumentation aktualisiert bzw. begonnen. 2002-11-08 23:24:54 +00:00
Alexander Barton
d35c0137b7 - Dokumentation aktualisiert. 2002-11-08 23:11:48 +00:00
Alexander Barton
ae39724a63 - in ServerUID und ServerGID kann nun jeweils auch der Name (und nicht nur
die numerische ID) verwendet werden.
2002-11-08 23:09:26 +00:00
Alexander Barton
8da254ea74 - Dokumentation aktualisiert. 2002-11-08 22:19:48 +00:00
Alexander Barton
47c8bcc8c9 - Dokumentation aktualisiert. 2002-11-05 14:30:52 +00:00
Alexander Barton
9523e28179 - IRC_Server() ruft nun Conn_SetServer() zur Server-Registrierung auf. 2002-11-05 14:18:59 +00:00
Alexander Barton
a4d5ca633a - Neue Funktion Conn_SetServer().
- Einige assert()'s aufgeraumt.
2002-11-05 14:18:39 +00:00
Alexander Barton
3102c550ff - neue Funktion Conn_SetServer(). 2002-11-05 14:18:13 +00:00
Alexander Barton
51dd80c48b - Dokumentation aktualisiert. 2002-11-04 20:04:18 +00:00
Alexander Barton
14e870e2ec - Code-Formatierung korrigiert (da waren Tabs wo keine hin gehoerten). 2002-11-04 19:25:26 +00:00
Alexander Barton
a6265aa0df - falsche Konstante korrigiert ... *argl*! 2002-11-04 13:26:00 +00:00
Alexander Barton
4c870f4be9 - Server und "normale" Clients werden wieder korrekt unterschieden. 2002-11-04 12:34:22 +00:00
Alexander Barton
a29e37a4c1 - Semantik der Conn_xxxFlag()-Funktionen geaendert. 2002-11-04 12:31:27 +00:00
Alexander Barton
aabe013dd0 - Dokumentation aktualisiert: neue Variable MaxConnections. 2002-11-02 23:13:18 +00:00
Alexander Barton
07984e0b81 - Dokumentation aktualisiert. 2002-11-02 23:11:38 +00:00
Alexander Barton
7ec3603996 - Dokumentation aktualisiert. 2002-11-02 23:01:27 +00:00
Alexander Barton
b991de0f15 - Connection-Strukturen werden nun "pool-weise" verwaltet; der Pool wird
bei Bedarf bis zu einem konfigurierten Limit vergroessert.
- neue Funktionen Conn_First(), Conn_Next(), Conn_ClearFlags(), Conn_Flag()
  und Conn_SetFlag().
2002-11-02 23:00:45 +00:00
Alexander Barton
601f0ede61 - Modul an neues Connection-Handling angepasst. 2002-11-02 22:59:41 +00:00
Alexander Barton
0d32a3b4fe - neue Konfigurationsvariable "MaxConnections". 2002-11-02 22:59:01 +00:00
Alexander Barton
650f9a2d9e - neue Konfigurationsvariable "Conf_MaxConnections". 2002-11-02 22:58:41 +00:00
Alexander Barton
05839597bf Neue Funktionen: Conn_First(), Conn_Next(), Conn_ClearFlags(), Conn_SetFlag() und Conn_Flag(). 2002-11-02 22:58:19 +00:00
Alexander Barton
8eac8bcbfc MAX_CONNECTIONS durch CONNECTION_POOL ersetzt. 2002-11-02 22:57:41 +00:00
Alexander Barton
8dd5ea0729 - GCC-Option "-ansi" hat sich leider nicht bewaehrt ... wieder entfernt. 2002-10-22 23:36:04 +00:00
Alexander Barton
d98e7def76 - beim GCC wird nun die "-ansi"-Option gesetzt. 2002-10-22 23:26:28 +00:00
Alexander Barton
5b25c8ccd0 - Verbindungsstatistik ein wenig klarer formuliert. 2002-10-22 23:25:29 +00:00
Alexander Barton
135abb5d74 - AdminEMail ist nun auch korrekt gesetzt. 2002-10-21 13:45:23 +00:00
Alexander Barton
12cad28ee8 - Anpassungen bzw. Fixes fuer "strict RFC"-Mode. 2002-10-21 13:45:07 +00:00
Alexander Barton
b840be9875 - ausgehende Verbindungen mit ID 0 konnten nicht aufgebaut werden ... :-/
- einige Debug-Ausgaben erweitert.
2002-10-15 09:24:54 +00:00
Alexander Barton
863daa29cb - Dokumentation aktualisiert. 2002-10-14 22:53:41 +00:00
Alexander Barton
3cf845fbfb - Segfault unter hoher Netzaktivitaet behoben: in Conn_Close() wird die
Connection-Struktur nun frueher als "ungueltig" markiert.
- besseres Error-Logging.
2002-10-14 22:21:00 +00:00
Alexander Barton
c49bee8d0b - RPL_YOURHOST_MSG nochmals leicht geaendert ... 2002-10-11 02:32:09 +00:00
Alexander Barton
0dfb771671 - Dokumentation aktualisiert. 2002-10-11 02:27:33 +00:00
Alexander Barton
452d98f329 - RPL_YOURHOST_MSG ist nun ircII-kompatibel :-) 2002-10-11 02:16:14 +00:00
Alexander Barton
a981f517f3 - in der Uebersicht werden die Pfad-Defines nicht mehr in CFLAGS angezeigt. 2002-10-11 00:49:49 +00:00
Alexander Barton
736bacde90 - Es wird nun laenger auf Resolver-Ergebnisse gewartet, der Login aber
sofort fortgesetzt, so ein Ergebnis eintrifft.
2002-10-10 15:01:12 +00:00
Alexander Barton
df0eb17172 - neue Funktion Conn_ResetPenalty(). 2002-10-10 15:00:33 +00:00
Alexander Barton
f274ec0652 - Dokumentation aktualisiert. 2002-10-10 15:00:09 +00:00
Alexander Barton
b7593369fb - Dokumentation aktualisiert. 2002-10-09 21:17:50 +00:00
Alexander Barton
ef407ea50c - Dokumentation aktualisiert. 2002-10-09 17:10:15 +00:00
Alexander Barton
345b9a3217 - "schneller Server-Reconnect" wird nun nur dann ausgefuehrt, wenn die
Verbindung zuvor "lange genug" aufgebaut war (z.B. also nicht mehr, wenn
  der Peer sofort beim Connect ein fatales ERROR liefert).
2002-10-09 17:07:22 +00:00
Alexander Barton
af719e60c5 - double in DOUBLE geaendert (ist in portab.h nun definiert). 2002-10-09 17:02:49 +00:00
Alexander Barton
84022a12fd - neue Datentypen LONG, ULONG und DOUBLE. 2002-10-09 16:53:30 +00:00
Alexander Barton
c7b55aa6f4 - verwendete Datentypen aufgeraumt: beispielsweise INT32 ist nun oft ein LONG. 2002-10-09 16:53:02 +00:00
Alexander Barton
5e70a131e9 - Dokumentation aktualisiert. 2002-10-09 13:42:32 +00:00
Alexander Barton
1e83e6662f - fehlenden Return-Wert ergaenzt (ich Dubel). 2002-10-09 13:35:32 +00:00
Alexander Barton
b6c049cb3c - Client wird nun via NOTICEs ueber Resolver-Status informiert. 2002-10-09 13:34:19 +00:00
Alexander Barton
39d7b014cf - NOTICE liefert nun nie(!) einen Fehler, auch nicht, wenn Client noch nicht registriert. 2002-10-09 13:33:19 +00:00
Alexander Barton
bd645f5095 - neue Konstante NOTICE_TXTPREFIX. 2002-10-09 13:15:45 +00:00
Alexander Barton
856f24eb7e - Server-NOTICEs haben nun ein "Text-Prefix". 2002-10-09 13:15:18 +00:00
Alexander Barton
f060db5ec5 - Connection-Statistik implementiert.
- Server-NOTICEs haben nun ein "Text-Prefix".
2002-10-09 13:15:08 +00:00
Alexander Barton
180eb810cf - "make distcheck" lief seit der Aenderung gestern nicht mehr durch. Fixed. 2002-10-08 18:30:03 +00:00
Alexander Barton
25f32ce8b8 - bei CVS-Versionen wird nun das Datum der letzten CVS-Aenderung angezeigt,
Versionsnummer entsprechend angepasst.
2002-10-07 21:16:12 +00:00
Alexander Barton
5eaf15574a - Dokumentation aktualisiert. 2002-10-04 12:43:27 +00:00
Alexander Barton
467e76aa32 - der Puffer fuer das Prefix war zu klein. 2002-10-04 12:39:58 +00:00
Alexander Barton
63bda7de11 - Dokumentation aktualisiert. 2002-10-04 11:22:20 +00:00
Alexander Barton
ec474a4bd2 - "format-string-bugs", die zum Abbruch des Servers fuehrten, behoben. 2002-10-04 11:21:46 +00:00
Alexander Barton
74ff9828de - kleinere "code cleanups". 2002-10-03 21:49:59 +00:00
Alexander Barton
25530fff71 - Dokumentation aktualisiert. 2002-10-03 21:03:59 +00:00
Alexander Barton
df2bd0e6fb - buffer overflow behoben. 2002-10-03 21:03:11 +00:00
Alexander Barton
1ed0c6926e - Dokumentation aktualisiert. 2002-10-03 16:10:43 +00:00
Alexander Barton
7a2b49a629 - Dokumentation aktualisiert. 2002-10-03 16:04:29 +00:00
Alexander Barton
a33105dcd1 - Syntax von RPL_MYINFO_MSG korrigiert (liefert nun vier Parameter). 2002-10-03 15:49:17 +00:00
Alexander Barton
a5b5952598 - RPM "Spec-File" in Source-Tree aufgenommen. 2002-10-01 09:58:29 +00:00
Alexander Barton
c6e936d6c2 - Dokumentation aktualisiert. 2002-10-01 09:57:26 +00:00
Alexander Barton
ab2abee1fe - neues Verzeichnis "contrib" angelegt. 2002-10-01 09:57:08 +00:00
Alexander Barton
67d79b92e6 - fehlerhaften "Socket-Test-Patch" korrigiert. 2002-09-26 16:11:26 +00:00
Alexander Barton
9ba956ca8b - Dokumentation aktualisiert. 2002-09-26 16:02:38 +00:00
Alexander Barton
c50ecda715 - Conn_Write() prueft nun, ob der Socket noch offen ist, ehe Daten gesendet werden. 2002-09-26 15:59:02 +00:00
Alexander Barton
9d928b240b - Dokumentation aktualisiert. 2002-09-23 22:07:42 +00:00
Alexander Barton
870fa2797c - Dokumentation aktualisiert. 2002-09-23 21:52:58 +00:00
Alexander Barton
8d1efc81f6 - per Default werden nun nur noch 5 Sessions parallel gestartet. 2002-09-23 20:54:17 +00:00
Alexander Barton
2b6dbb07e8 - in RPL_YOURHOST_MSG wurde ein fehlerhafter Versionsstring geliefert. 2002-09-22 21:40:33 +00:00
Alexander Barton
7caf3f8429 - Dokumentation aktualisiert. 2002-09-22 21:40:15 +00:00
Alexander Barton
1a6f88f218 - Dokumentation aktualisiert. 2002-09-20 15:45:02 +00:00
Alexander Barton
06cb16580e - getpid.sh wird nun auf bei "make distcheck" gefunden. 2002-09-20 15:39:24 +00:00
Alexander Barton
2b690fff78 - Dokumentation aktualisiert. 2002-09-20 15:26:26 +00:00
Alexander Barton
7058a8c006 - das Test-Binary wurde nicht immer kopiert. 2002-09-20 15:12:42 +00:00
Alexander Barton
b71db1a9a5 - auch unter Cygwin wird ngircd-TEST bei "make clean" nun entfernt. 2002-09-20 15:09:44 +00:00
Alexander Barton
420c96d17b - das ngIRCd-Binary fuer die Tests wird nun kopiert, nicht mehr verlinkt. 2002-09-20 15:08:12 +00:00
Alexander Barton
6817978ddb - Dokumentation aktualisiert. 2002-09-20 14:57:17 +00:00
Alexander Barton
efedfe12ff - Die PID des Test-Servers wird nun mit dem Script "getpid.sh" ermittelt. 2002-09-20 14:46:55 +00:00
Alexander Barton
90ab7c7c48 - die ermittelte PID des ngIRCd wird besser validiert (leer?). 2002-09-20 13:57:01 +00:00
Alexander Barton
fa9e38b36f - Dokumentation aktualisiert. 2002-09-19 10:19:32 +00:00
Alexander Barton
33bda862da - Fehler bei Validierung von "AdminInfo2" behoben. 2002-09-19 10:19:12 +00:00
Alexander Barton
ef2b5eea53 - Versionsnummer fuer CVS-HEAD wieder auf "CurrentCVS" gesetzt. 2002-09-19 09:59:47 +00:00
Alexander Barton
45279951aa - Dokumentation aktualisiert. 2002-09-19 09:35:05 +00:00
Alexander Barton
47b4581907 - Dokumentation aktualisiert. 2002-09-19 09:27:26 +00:00
Alexander Barton
b5d6597c0a - Parameter fuer ps werden in anderer (besserer) Reihenfolge getestet. 2002-09-18 20:58:56 +00:00
Alexander Barton
4a87df8e79 - Dokumentation aktualisiert. 2002-09-17 17:30:09 +00:00
72 changed files with 4417 additions and 2255 deletions

152
ChangeLog
View File

@@ -1,17 +1,158 @@
ngIRCd - Next Generation IRC Server
(c)2001,2002 by Alexander Barton,
(c)2001-2003 by Alexander Barton,
alex@barton.de, http://www.barton.de/
ngIRCd ist freie Software und steht unter
der GNU General Public License.
ngIRCd is free software and published under the
terms of the GNU General Public License.
-- ChangeLog / Aenderungen --
ngIRCd CVS-HEAD
ngIRCd 0.6.x
- Conn_Close() now handles recurisive calls for the same link correctly.
ngIRCd 0.6.1, 2002-01-21
- Fixed KILL: you can't crash the server by killing yourself any more,
ngIRCd no longer sends a QUIT to other servers after the KILL, and you
can kill only valid users now.
- The server no longer forwards commands to ordinary users, instead it
answers with the correct error message ("no such server") now.
- WHOIS commands weren't always forwarded as requested.
- The server sets a correct default AWAY message now when propagating
between servers (bug introduced in 0.6.0).
- Fixed up and enhanced CHANINFO command: channel keys and user limits
are syncronized between servers now, too.
- MODE returns the key and user limit for channel members correctly now.
- Non-members of a channel could crash the server when trying to change
its modes or modes of its members.
- The server didn't validate weather a target user is a valid channel
member when changing his channel user modes which could crash ngIRCd.
Older changes (sorry, only available in german language):
ngIRCd 0.6.0, 2002-12-24
ngIRCd 0.6.0-pre2, 2002-12-23
- neuer Numeric 005 ("Features") beim Connect.
- LUSERS erweitert: nun wird die maximale Anzahl der lokalen und globalen
Clients, die dem Server bzw. im Netzwerk seit dem letzten (Re-)Start
dem Server gleichzeitig bekannt waren, angezeigt.
ngIRCd 0.6.0-pre1, 2002-12-18
- beim Schliessen einer Verbindung zeigt der Server nun vor dem ERROR
noch eine Statistik ueber die empfangene und gesendete Datenmenge an.
- der Server wartet bei einer eingehenden Verbindung nun laenger auf den
Resolver (4 Sekunden), wenn das Ergebnis eintrifft setzt er aber den
Login sofort fort (bisher wurde immer mind. 1 Sekunde gewartet).
- Connection-Strukturen werden nun "pool-weise" verwaltet; der Pool wird
bei Bedarf bis zu einem konfigurierten Limit vergroessert.
- Mit der neuen Konfigurationsvariable "MaxConnections" (Sektion "Global")
kann die maximale Anzahl gleichzeitiger Verbindungen begrenzt werden.
Der Default ist -1, "unlimitiert".
- der Server erkennt nun, ob bereits eine eingehende Verbindung von einem
Peer-Server besteht und versucht dann nicht mehr, selber eine eigene
ausgehende Verbindung zu diesem auufzubauen. Dadurch kann nun auf beiden
Servern in der Konfiguration ein Port fuer den Connect konfiguriert
werden (beide Server versuchen sich dann gegenseitig zu connectieren).
- Test-Suite und Dokumentation an A/UX angepasst.
- unter HP-UX definiert das configure-Script nun _XOPEN_SOURCE_EXTENDED.
- Server identifizieren sich nun mit asyncronen Passwoertern, d.h. das
Passwort, welches A an B schickt, kann ein anderes sein als das, welches
B als Antwort an A sendet. In der Konfig.-Datei, Abschnitt "Server",
wurde "Password" dazu durch "MyPassword" und "PeerPassword" ersetzt.
- Der Server kann nun zur Laufzeit die Konfiguration neu einlesen: dies
macht er nach dem Befehl REHASH oder wenn ein HUP-Signal empfangen wird.
- Channel-Mode "P" ("persistent") kann nur noch von IRC-Operatoren gesetzt
werden. Grund: User koennen den Server sonst leicht "Channel-Flooden".
- MOTD kann nun an andere Server geforwarded werden.
- IRC-Befehl "TIME" implementiert.
- Server-Server-Links koennen nun komprimiert werden, dazu wird die zlib
(www.zlib.org) benoetigt. Unterstuetzt die Gegenseite die Komprimierung
nicht, wird automatisch unkomprimiert kommuniziert. Das Verfahren ist
kompatibel mit dem Original-ircd 2.10.3, d.h. beide Server koennen
miteinander ueber komprimiert Links kommunizieren.
- Handling der Schreibpuffer umgestellt: Server sollte schneller arbeiten.
- Prefix-Fehler werden besser protokolliert (mit verursachendem Befehl).
- SQUIT wird nicht mehr doppelt an andere Server weitergeleitet.
- Der Server versucht nun vor dem Schliessen einer Verbindung Daten, die
noch im Schreibpuffer stehen, zu senden.
- Source in weiteres Modul "irc-info" aufgespalten.
- Konfigurationsvariablen werden besser validiert: Laengen, Zahlen, ...
- neuen Befehl STATS begonnen: bisher unterstuetzt wird "l" und "m".
- bei ISON und USERHOST fehlte im Ergebnis-String der korrekte Absender.
- IRC Operatoren koennen nun mit KILL User toeten. Achtung: ein Grund muss
zwingend als zweiter Parameter angegeben werden!
- neue Konfigurations-Variable "MaxJoins": Hiermit kann die maximale Zahl
der Channels, in denen ein User Mitglied sein kann, begrent werden.
- neuer, deutlich flexiblerer Parser fuer den MODE Befehl.
- neue Channel-Modes l (User-Limit) und k (Channel-Key) implementiert.
ngIRCd 0.5.4, 24.11.2002
- Fehler-Handling von connect() gefixed: der Server kann sich nun auch
unter A/UX wieder zu anderen verbinden.
- in den Konfigurationsvariablen ServerUID und ServerGID kann nun nicht
nur die numerische ID, sondern auch der Name des Users bzw. der Gruppe
verwendet werden. Beim Start des Daemons wird nun beides angezeigt.
- Besseres Logging von Prefix-Fehlern.
- angenommene Sockets werden nun korrekt auf "non-blocking" konfiguriert,
beim Senden und Empfangen werden Blockierungen besser abgefangen.
- RPL_UMODEIS hat Code 221, nicht 211 ... *argl*
- select() in Try_Write() hat falschen (keinen!) Timeout verwendet;
die "Zeit-Aufloesung" des Servers sind zudem nun 2 Sekunden (TIME_RES).
Insgesamt sollte die Reaktionszeit des Server nun besser sein.
ngIRCd 0.5.3, 08.11.2002
- NOTICE liefert nun wirklich nie mehr einen Fehler, auch dann nicht,
wenn der sendende Client noch gar nicht registriert ist.
- ein "schneller Server-Reconnect" wird nur noch dann versucht, wenn die
Verbindung zuvor ordentlich (="lange genug") in Ordnung war; somit also
nicht meht, wenn der Peer-Server gleich beim Connect ein ERROR liefert.
Das vermeidet "Connect-Orgien".
- einige Datentypen aufgeraumt: z.B. sind viele INT32s nun LONGs. Das ist
auf Platformen mit 8-Byte-Integern kompatibler.
- RPL_YOURHOST_MSG ist nun ircII- und RFC-kompatibel ;-)
- Segfault unter hoher Netzaktivitaet behoben: in Conn_Close() wird die
Connection-Struktur nun frueher als "ungueltig" markiert.
ngIRCd 0.5.2, 04.10.2002
- Buffer Overflow in Read_Resolver_Result() behoben.
- Format-String-Bugs, die zum Abbruch des Servers fuehrten, behoben.
- Maximale Laenge eines IRC-Prefix wurde falsch berechnet.
ngIRCd 0.5.1, 03.10.2002
- in RPL_YOURHOST_MSG wurde ein fehlerhafter Versionsstring geliefert.
- Test-Suite: start-server.sh, stop-server.sh und stress-server.sh koennen
nun "manuell" von der Kommandozeile gestartet werden, stress-server.sh
startet per Default nur noch 5 Sessions, eine andere Zahl kann auf der
Kommandozeile uebergeben werden (Syntax: "stress-server.sh <count>").
- In bestimmten Faellen hat der Server versucht auf einen bereits wieder
geschlossenen Socket Daten zu schreiben; das fuehrte zu einem Abbruch des
Servers durch ein assert(). Nun wird geprueft, ob der Socket noch ok ist.
- im "contrib"-Verzeichnis befindet sich nun eine RPM-Spec-Datei, aus den
.tar.gz's koennen nun mit "rpm -ta <archiv>" RPM's erzeugt werden. Danke
an Sean Reifschneider <jafo@tummy.com>!
- Syntax von RPL_MYINFO_MSG korrigiert: liefert nun vier Parameter.
ngIRCd 0.5.0, 20.09.2002
- Dokumentation aktualisiert.
- Fehler bei Validierung von "AdminInfo2" behoben.
- Test der Flags fuer "ps" in der Testsuite verbessert, ist nun zu mehr
Plattformen kompatibler.
ngIRCd 0.5.0-pre2, 17.09.2002
- Fix in IRC_WriteStrServersPrefix() war "badly broken" -- behoben.
ngIRCd 0.5.0-pre1, 16.09.2002
- Manual-Pages ngircd.8 und ngircd.conf.5 begonnen.
- Wird der Netzwerk-Sniffer aktiviert (--sniffer), so schaltet der
ngIRCd nun automatisch in den Debug-Modus.
@@ -207,7 +348,6 @@ ngIRCd 0.1.0, 29.01.2002
- Clients werden nun korrekt sowohl nur ueber den Nickname als auch die
komplette "Host Mask" erkannt.
ngIRCd 0.0.3, 16.01.2002
- Server-Links vollstaendig implementiert: der ngIRCd kann nun auch
@@ -254,4 +394,4 @@ ngIRCd 0.0.1, 31.12.2001
--
$Id: ChangeLog,v 1.87 2002/09/16 10:00:28 alex Exp $
$Id: ChangeLog,v 1.147.2.14 2003/03/09 20:16:57 alex Exp $

16
INSTALL
View File

@@ -18,6 +18,20 @@
+-----------------------------------------------------------------------+
0. Update von frueheren Versionen
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Unterschiede zu Version 0.5.x
- Ab Version 0.6.0 werden asyncrone Passwoerter zur Identifikation anderer
Server, die Variable "Password" in [Server]-Abschnitten wird nicht mehr
unterstuetzt. Passwoerter fuer Server-Server-Links werden nun mit den
Variablen "MyPassword" und "PeerPassword" angegeben.
- Neue Konfigurationsvariablen, Sektion [Global]: MaxConnections, MaxJoins
(vgl. auch Beispiel-Konfiguration "doc/sample-ngircd.conf"!)
I. Standard-Installation
~~~~~~~~~~~~~~~~~~~~~~~~
@@ -145,4 +159,4 @@ Server nach der Ausgabe wieder.
--
$Id: INSTALL,v 1.8 2002/09/16 11:03:05 alex Exp $
$Id: INSTALL,v 1.9 2002/12/18 12:19:07 alex Exp $

View File

@@ -66,9 +66,10 @@
08FB7794FE84155DC02AAC07 = {
children = (
1AB674ADFE9D54B511CA2CBB,
F56D8B9E01E0BFA00155ADA7,
F5D3536103892A8A01A85B04,
F51F791401DFD0DE01D13771,
F520AF150335F1B801A85B04,
F56D8B9E01E0BFA00155ADA7,
F52162B301C7B904012300F4,
F52162C301C7B904012300F4,
F52162C401C7B904012300F4,
@@ -93,11 +94,13 @@
);
buildSettings = {
FRAMEWORK_SEARCH_PATHS = "";
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
HEADER_SEARCH_PATHS = "";
INSTALL_PATH = "$(HOME)/bin";
LIBRARY_SEARCH_PATHS = "";
OTHER_CFLAGS = "-DLOCALSTATEDIR=\\\\\\\"/usr/local/var\\\\\\\" -DSYSCONFDIR=\\\\\\\"/usr/local/etc\\\\\\\"";
OTHER_LDFLAGS = "";
OPTIMIZATION_CFLAGS = "-O2";
OTHER_CFLAGS = "-DSYSCONFDIR=\\\\\\\"/usr/local/etc\\\\\\\"";
OTHER_LDFLAGS = "-lz";
OTHER_REZFLAGS = "";
PRODUCT_NAME = ngircd;
REZ_EXECUTABLE = YES;
@@ -143,6 +146,7 @@
F5BEF12E02A1169C01A85B03,
F5BEF13302A12AFE01A85B03,
F5E9448502C9F49D01A85B04,
F5D5CC9403990FED0155B873,
);
isa = PBXHeadersBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
@@ -171,6 +175,7 @@
F5BEF12F02A1169C01A85B03,
F5BEF13502A24F1001A85B03,
F5E9448602C9F49D01A85B04,
F5D5CC9603990FFA0155B873,
);
isa = PBXSourcesBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
@@ -579,6 +584,8 @@
F51D180301C8FDD001E11C2E,
F57C888D02328D7201A85B04,
F57C888E02328D7201A85B04,
F5D5CC9503990FFA0155B873,
F5D5CC9303990FED0155B873,
F51DBB1B022D9D8F01A85B04,
F51DBB1C022D9D8F01A85B04,
F51DBB17022D995501A85B04,
@@ -820,6 +827,8 @@
F5382426024F89BC01A85B04,
);
buildSettings = {
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
OPTIMIZATION_CFLAGS = "-O2";
OTHER_CFLAGS = "";
OTHER_LDFLAGS = "";
OTHER_REZFLAGS = "";
@@ -1140,11 +1149,61 @@
settings = {
};
};
F5D3536103892A8A01A85B04 = {
children = (
F5D3536203892AD201A85B04,
F5D3536303892AD201A85B04,
);
isa = PBXGroup;
name = contrib;
refType = 4;
};
F5D3536203892AD201A85B04 = {
isa = PBXFileReference;
name = Makefile.am;
path = /Users/alex/Develop/ngircd/contrib/Makefile.am;
refType = 0;
};
F5D3536303892AD201A85B04 = {
isa = PBXFileReference;
name = ngircd.spec;
path = /Users/alex/Develop/ngircd/contrib/ngircd.spec;
refType = 0;
};
F5D3536403892AFE01A85B04 = {
isa = PBXFileReference;
name = "sample-ngircd.conf";
path = "en/sample-ngircd.conf";
refType = 4;
};
F5D5CC9303990FED0155B873 = {
isa = PBXFileReference;
path = "irc-info.h";
refType = 4;
};
F5D5CC9403990FED0155B873 = {
fileRef = F5D5CC9303990FED0155B873;
isa = PBXBuildFile;
settings = {
};
};
F5D5CC9503990FFA0155B873 = {
isa = PBXFileReference;
path = "irc-info.c";
refType = 4;
};
F5D5CC9603990FFA0155B873 = {
fileRef = F5D5CC9503990FFA0155B873;
isa = PBXBuildFile;
settings = {
};
};
F5E9447B02C9EE0E01A85B04 = {
children = (
F5E9448002C9EE4901A85B04,
F5E9448202C9EE4901A85B04,
F5E9448102C9EE4901A85B04,
F5D3536403892AFE01A85B04,
);
isa = PBXGroup;
name = en;

View File

@@ -9,12 +9,12 @@
# Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
# der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
#
# $Id: Makefile.am,v 1.9 2002/03/31 20:23:06 alex Exp $
# $Id: Makefile.am,v 1.10 2002/10/01 09:57:08 alex Exp $
#
AUTOMAKE_OPTIONS = gnu
SUBDIRS = doc MacOSX src man
SUBDIRS = doc MacOSX src man contrib
maintainer-clean-local:
rm -rf autom4te.cache
@@ -25,4 +25,7 @@ maintainer-clean-local:
lint:
make -C src/ngircd lint
rpm: distcheck
rpm -ta ngircd-*.tar.gz
# -eof-

59
NEWS
View File

@@ -10,31 +10,54 @@
-- NEWS / Neuigkeiten --
ngIRCd CVS-HEAD
ngIRCd 0.6.0, 2002-12-24
- beim Schliessen einer Verbindung zeigt der Server nun vor dem ERROR
noch eine Statistik ueber die empfangene und gesendete Datenmenge an.
- Connection-Strukturen werden nun "pool-weise" verwaltet; der Pool wird
bei Bedarf bis zu einem konfigurierten Limit vergroessert.
- Mit der neuen Konfigurationsvariable "MaxConnections" (Sekion "Global")
kann die maximale Anzahl gleichzeitiger Verbindungen begrenzt werden.
Der Default ist -1, "unlimitiert".
- der Server erkennt nun, ob bereits eine eingehende Verbindung von einem
Peer-Server besteht und versucht dann nicht mehr, selber eine eigene
ausgehende Verbindung zu diesem auufzubauen. Dadurch kann nun auf beiden
Servern in der Konfiguration ein Port fuer den Connect konfiguriert
werden (beide Server versuchen sich dann gegenseitig zu connectieren).
- Server identifizieren sich nun mit asyncronen Passwoertern, d.h. das
Passwort, welches A an B schickt, kann ein anderes sein als das, welches
B als Antwort an A sendet. In der Konfig.-Datei, Abschnitt "Server",
wurde "Password" dazu durch "MyPassword" und "PeerPassword" ersetzt.
- Der Server kann nun zur Laufzeit die Konfiguration neu einlesen: dies
macht er nach dem Befehl REHASH oder wenn ein HUP-Signal empfangen wird.
- Server-Server-Links koennen nun komprimiert werden, dazu wird die zlib
(www.zlib.org) benoetigt. Unterstuetzt die Gegenseite die Komprimierung
nicht, wird automatisch unkomprimiert kommuniziert. Das Verfahren ist
kompatibel mit dem Original-ircd 2.10.3, d.h. beide Server koennen
miteinander ueber komprimiert Links kommunizieren.
- neue Konfigurations-Variable "MaxJoins": Hiermit kann die maximale Zahl
der Channels, in denen ein User Mitglied sein kann, begrent werden.
- neue Channel-Modes l (User-Limit) und k (Channel-Key) implementiert.
ngIRCd 0.5.0, 20.09.2002
- Manual-Pages ngircd.8 und ngircd.conf.5 begonnen.
- AIX (3.2.5), HP-UX (10.20), IRIX (6.5), NetBSD (1.5.3/m68k) und Solaris
(2.5.1, 2.6) gehoeren nun auch zu den unterstuetzten Platformen.
- Unter A/UX (und evtl. weiteren Systemen) kompiliert der ngIRCd nun mit
dem "nativen" (ggf. pre-ANSI) Compiler.
- "persistente Channels" (Mode 'P') implementiert: diese koennen in der
Konfigurationsdatei definiert werden (Sektion "Channel", vgl. Beispiel-
Konfiguration "sample-ngircd.conf") und bleiben auch dann bestehen,
wenn kein User mehr im Channel ist. Zu Channel-Operatoren werden bisher
nur IRC-Operatoren, die den Channel betreten. Die persistenten Channels
werden durch das Flag "P" gelennzeichnet, welches normal durch Channel-
Op's gesetzt und geloescht werden kann.
- KICK implementiert (bisher kann nur ein User aus einem Channel geckicked
werden, Listen, wir im RFC vorgesehen, werden bisher nicht unterstuetzt).
- INVITE, den Channel-Mode "i" sowie Invite-Lists ueber den MODE-Befehl
(setzen, erfragen und loeschen) implementiert.
- Unter A/UX (und evtl. weiteren Systemen) kompiliert der ngIRCd nun mit
dem "nativen" (ggf. pre-ANSI) Compiler.
- LIST versteht nun Wildcards und kann an andere Server geforwarded werden.
wenn kein User mehr im Channel ist.
- neue IRC-Befehle: KICK, INVITE, ADMIN, CHANINFO; LIST wurde erweitert.
Mit dem neuen Befehl CHANINFO syncronisieren Server, die das IRC+-
Protokoll unterstuetzen, Channel-Modes und Topics. Fuer den ADMIN-Befehl
gibt es neue Konfigurationsoptionen (Sektion "Global"): "AdminInfo1",
"AdminInfo2" und "AdminEMail".
- Invite- und Ban-Lists implementiert.
- neue Konfigurationsoption "OperCanUseMode" (Sektion "Global"):
ist sie aktiv, koennen IRC-Operatoren immer Channel-Modes setzen.
- mit dem neuen Befehl CHANINFO syncronisieren Server, die das IRC+-
Protokoll unterstuetzen, Channel-Modes und Topics.
- Ban-Lists (setzen, erfragen und loeschen) implementiert.
- ADMIN-Befehl implementiert.
- "Test-Suite" begonnen: mit "make check" wird sie durchlaufen.
ngIRCd 0.4.2, 29.04.2002
@@ -116,4 +139,4 @@ ngIRCd 0.0.1, 31.12.2001
--
$Id: NEWS,v 1.38 2002/09/16 11:03:05 alex Exp $
$Id: NEWS,v 1.45.2.2 2002/12/24 13:53:54 alex Exp $

6
README
View File

@@ -38,8 +38,8 @@ Bisher (mehr oder wenig vollstaendig) implementierte IRC-Befehle:
ADMIN, AWAY, CHANINFO, CONNECT, DIE, ERROR, INVITE, ISON, JOIN, KICK, KILL,
LINKS, LIST, LUSERS, MODE, MOTD, NAMES, NICK, NJOIN, NOTICE, OPER, PART,
PASS, PING, PONG, PRIVMSG, QUIT, RESTART, SERVER, SQUIT, TOPIC, USERHOST,
USER, VERSION, WHO, WHOIS.
PASS, PING, PONG, PRIVMSG, QUIT, RESTART, SERVER, SQUIT, TIME, TOPIC,
USERHOST, USER, VERSION, WHO, WHOIS.
III. Features (oder: warum gerade ngIRCd?)
@@ -102,4 +102,4 @@ schreiben.
--
$Id: README,v 1.13 2002/09/16 11:03:05 alex Exp $
$Id: README,v 1.14 2002/11/24 18:48:59 alex Exp $

View File

@@ -1,15 +1,14 @@
#
# ngIRCd -- The Next Generation IRC Daemon
# Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
# Copyright (c)2001-2003 by Alexander Barton (alex@barton.de)
#
# Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
# der GNU General Public License (GPL), wie von der Free Software Foundation
# herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
# der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
# Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
# der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# Please read the file COPYING, README and AUTHORS for more information.
#
# $Id: configure.in,v 1.59 2002/09/17 17:12:24 alex Exp $
# $Id: configure.in,v 1.69.2.6 2003/03/09 22:33:19 alex Exp $
#
# -- Initialisierung --
@@ -18,7 +17,7 @@ AC_INIT
AC_PREREQ(2.50)
AC_CANONICAL_TARGET
AC_CONFIG_SRCDIR(src/config.h.in)
AM_INIT_AUTOMAKE(ngircd,0.5.0-pre2)
AM_INIT_AUTOMAKE(ngircd,0.6.x-CVS)
AM_CONFIG_HEADER(src/config.h)
# -- Templates fuer config.h --
@@ -28,6 +27,7 @@ AH_TEMPLATE([HAVE_socklen_t], [Define if socklen_t exists])
AH_TEMPLATE([SNIFFER], [Define if IRC sniffer should be enabled])
AH_TEMPLATE([STRICT_RFC], [Define if ngIRCd should behave strict RFC compliant])
AH_TEMPLATE([USE_SYSLOG], [Define if syslog should be used for logging])
AH_TEMPLATE([USE_ZLIB], [Define if zlib compression should be enabled])
AH_TEMPLATE([IRCPLUS], [Define if IRC+ protocol should be used])
AH_TEMPLATE([TARGET_OS], [Target operating system name])
@@ -53,6 +53,20 @@ AC_LANG_C
AM_C_PROTOTYPES
AC_C_CONST
# -- Defines --
if test `uname` = "A/UX"; then
# unter A/UX sollte _POSIX_SOURCE definiert sein.
AC_MSG_RESULT([detected A/UX, defining _POSIX_SOURCE])
CFLAGS="$CFLAGS -D_POSIX_SOURCE"
fi
if test `uname` = "HP-UX"; then
# unter HP-UX 11.11 muss _XOPEN_SOURCE_EXTENDED definiert sein.
AC_MSG_RESULT([detected HP-UX, defining _XOPEN_SOURCE_EXTENDED])
CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED"
fi
# -- Header --
AC_HEADER_STDC
@@ -66,7 +80,7 @@ AC_CHECK_HEADERS([ \
strings.h sys/socket.h sys/time.h unistd.h \
],,AC_MSG_ERROR([required C header missing!]))
AC_CHECK_HEADERS(arpa/inet.h malloc.h stdint.h sys/select.h varargs.h)
AC_CHECK_HEADERS(arpa/inet.h ctype.h malloc.h stdint.h sys/select.h varargs.h)
# -- Datentypen --
@@ -107,7 +121,7 @@ AC_CHECK_FUNCS([ \
strstr waitpid \
],,AC_MSG_ERROR([required function missing!]))
AC_CHECK_FUNCS(inet_aton sigaction snprintf vsnprintf)
AC_CHECK_FUNCS(inet_aton isdigit sigaction snprintf vsnprintf)
# -- Konfigurationsoptionen --
@@ -127,6 +141,22 @@ if test "$x_syslog_on" = "yes"; then
AC_CHECK_LIB(be,syslog)
fi
x_zlib_on=no
AC_ARG_ENABLE(zlib,
[ --disable-zlib disable zlib compression (autodetected by default)],
[ if test "$enableval" = "yes"; then
AC_CHECK_HEADER(zlib.h, x_zlib_on=yes,
AC_MSG_ERROR([Can't enable zlib: zlib.h not found!])
)
fi
],
[ AC_CHECK_HEADER(zlib.h, x_zlib_on=yes) ]
)
if test "$x_zlib_on" = "yes"; then
AC_DEFINE(USE_ZLIB, 1)
AC_CHECK_LIB(z,deflate)
fi
x_ircplus_on=yes
AC_ARG_ENABLE(ircplus,
[ --disable-ircplus disable IRC+ protocol],
@@ -167,18 +197,14 @@ AC_DEFINE_UNQUOTED(TARGET_CPU, "$target_cpu" )
AC_DEFINE_UNQUOTED(TARGET_VENDOR, "$target_vendor" )
AC_DEFINE_UNQUOTED(TARGET_OS, "$target_os" )
if test `uname` = "A/UX"; then
# unter A/UX sollte _POSIX_SOURCE definiert sein.
AC_MSG_RESULT([detected A/UX, defining _POSIX_SOURCE])
CFLAGS="$CFLAGS -D_POSIX_SOURCE"
fi
# -- Variablen --
if test "$GCC" = "yes"; then
CFLAGS="-Wall $CFLAGS"
fi
the_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -DSYSCONFDIR='\"\$(sysconfdir)\"'"
# -- Ausgabe der Dateien --
@@ -194,6 +220,7 @@ AC_OUTPUT([ \
src/ngircd/Makefile \
src/testsuite/Makefile \
man/Makefile \
contrib/Makefile \
])
# -- Ergebnis --
@@ -208,12 +235,11 @@ M=`eval echo ${mandir}` ; M=`eval echo ${M}`
echo " host: ${host}"
echo " compiler: ${CC}"
echo " compiler flags: ${CFLAGS}"
echo " compiler flags: ${the_CFLAGS}"
echo " preprocessor flags: ${CPPFLAGS}"
echo " linker flags: ${LDFLAGS}"
echo " libraries: ${LIBS}"
echo
echo " 'ngircd' binary: $S"
echo " configuration file: $C"
echo " manual pages: $M"
@@ -221,6 +247,7 @@ echo
echo $ECHO_N " active options: $ECHO_C"
test "$x_syslog_on" = "yes" && echo $ECHO_N "Syslog $ECHO_C"
test "$x_zlib_on" = "yes" && echo $ECHO_N "zLib $ECHO_C"
test "$x_debug_on" = "yes" && echo $ECHO_N "Debug $ECHO_C"
test "$x_sniffer_on" = "yes" && echo $ECHO_N "Sniffer $ECHO_C"
test "$x_strict_rfc_on" = "yes" && echo $ECHO_N "Strict-RFC $ECHO_C"

20
contrib/Makefile.am Normal file
View File

@@ -0,0 +1,20 @@
#
# ngIRCd -- The Next Generation IRC Daemon
# Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
#
# Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
# der GNU General Public License (GPL), wie von der Free Software Foundation
# herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
# der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
# Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
# der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
#
# $Id: Makefile.am,v 1.1 2002/10/01 09:57:08 alex Exp $
#
EXTRA_DIST = ngircd.spec
maintainer-clean-local:
rm -f Makefile Makefile.in
# -eof-

54
contrib/ngircd.spec Normal file
View File

@@ -0,0 +1,54 @@
%define name ngircd
%define version 0.6.1
%define release 1
%define prefix %{_prefix}
Summary: Next Generation Internet Relay Chat Daemon
Name: %{name}
Version: %{version}
Release: %{release}
Copyright: GPL
Group: Networking/Daemons
URL: http://arthur.ath.cx/~alex/ngircd/
Source: %{name}-%{version}.tar.gz
Packager: Sean Reifschneider <jafo-rpms@tummy.com>
BuildRoot: /var/tmp/%{name}-root
%description
ngIRCd is a free open source daemon for Internet Relay Chat (IRC),
developed under the GNU General Public License (GPL). It's written from
scratch and is not based upon the original IRCd like many others.
Why should you use ngIRCd? Because ...
* ... there are no problems with servers on changing or non-static IP
addresses.
* ... there is a small and lean configuration file.
* ... there is a free, modern and open source C source code.
* ... it is still under active development.
%prep
%setup
%build
%configure
make
%install
[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf "$RPM_BUILD_ROOT"
%makeinstall
(
cd "$RPM_BUILD_ROOT"
( cd usr/sbin; mv *-ngircd ngircd )
( cd usr/share/man/man5; mv *-ngircd.conf.5 ngircd.conf.5 )
( cd usr/share/man/man8; mv *-ngircd.8 ngircd.8 )
)
%clean
[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf "$RPM_BUILD_ROOT"
%files
%defattr(755,root,root)
%doc AUTHORS COPYING ChangeLog INSTALL NEWS README
%config(noreplace) /etc
%{_prefix}/sbin
%{_prefix}/share/man/

View File

@@ -90,11 +90,11 @@ Folgende <serverflags> sind zur Zeit definiert:
II.2 Channel-Modes, persistente Channel und Topic austauschen
Befehl: CHANINFO
Parameter: <channel> +<mode> [<topic>]
Parameter: <channel> +<modes> [[<key> <maxusers>] <topic>]
Fuer: Server
Mit CHANINFO Informiert ein Server den anderen ueber einen Channel: dessen
Modes und dessen Topic. <topic> ist optional.
Modes, Channel-Key, User-Limit und dessen Topic. <topic> ist optional.
Existiert auf dem Server, der das CHANINFO empfaengt, der Channel bereits,
so uebernimmt er die Werte jeweils nur dann, wenn er selber noch keine
@@ -104,6 +104,12 @@ ignoriert.
Existiert der Channel noch nicht, so wird er mit den entsprechenden Angaben
erzeugt.
Hat ein Channel keinen Key (in <modes> ist der Mode "k" nicht vorhanden),
so muss der Parameter <key> ignoriert werden (da <key> vorhanden sein muss,
sollte in diesem Fall "*" uebergeben werden). Hat er kein User-Limit (kein
"l" in <modes>), so muss <limit> ignoriert werden (<limit> sollte hierbei
als "0" uebergeben werden).
--
$Id: Protocol.txt,v 1.5 2002/09/04 00:06:19 alex Exp $
$Id: Protocol.txt,v 1.5.4.1 2003/01/08 20:36:57 alex Exp $

View File

@@ -11,37 +11,33 @@
Seit Version 0.2.2-pre gehoert Apple A/UX zu den offiziell unterstuetzten
Platformen. Er ist im vollen Funktionsumfang nutzbar.
Plattformen. Er ist im vollen Funktionsumfang nutzbar.
Ab Version 0.5.0 compiliert zudem der ngIRCd mit dem nativen A/UX-Compiler,
d.h. GNU C wird nicht mehr zwingend vorausgesetzt.
Folgende Software wird jedoch benoetigt:
- GNU C Compiler (gcc)
Bezugsquellen:
http://www.rezepte-im-web.de/appleux/gcc281.tar.gz
ftp://arthur.ath.cx/pub/AUX/Software/Development/gcc-2.8.1-auxbin.tar.gz
- GNU make
Bezugsquellen:
http://www.rezepte-im-web.de/appleux/make-3.79.tar.gz
ftp://arthur.ath.cx/pub/AUX/Software/Development/make-3.79.tar.gz
- GNU sed
Bezugsquellen:
http://www.rezepte-im-web.de/appleux/sed-3.02.tar.gz
ftp://arthur.ath.cx/pub/AUX/Software/Tools/sed-3.02.tar.gz
- install (z.B. aus den GNU fileutils)
Ein install, welches entweder so "broken" ist, dass configure das eigene
Shell-Script waehlt, oder eines, das funktioniert. Leider ist mindestens
ein Binary im Umlauf, das Probleme macht.
Bezugsquelle:
ftp://arthur.ath.cx/pub/UNIX/AUX/Software/Tools/fileutils-4.0.tar.gz
A/UX beinhaltet ein /bin/sed, dieses unterstuetzt jedoch leider nicht
alle Funktionen, die GNU automake/autoconf nutzen.
Achtung: bitte bei der Installation von GNU sed sicherstellen, dass
immer dieses und nie das von A/UX verwendet wird (also $PATH entsprechend
anpassen bzw. die A/UX-Version komplett ersetzen)!
- libUTIL.a
Bezugsquellen:
http://ftp.mayn.de/pub/apple/apple_unix/Sys_stuff/libUTIL-2.1.tar.gz
ftp://arthur.ath.cx/pub/AUX/Software/Libraries/libUTIL-2.1.tar.gz
Diese Library beinhaltet Systemfunktionen, die auf UNIXoiden Systemen
gaengig, unter A/UX jedoch leider nicht verfuegbar sind. Dazu gehoert
u.a. memmove(), strerror() und strdup().
Nachdem diese Pakete entsprechend installiert sind, reicht ein ganz normales
"./configure" und "make" aus, um den ngIRCd unter A/UX zu compilieren.
@@ -59,13 +55,14 @@ Noch ein paar Hinweise, wenn es doch (noch) nicht klappt:
unbedingt ausserhalb von /bin (z.B. unter /usr/local/bin) installiert
werden. Ansonsten waehlt es das configure-Script als Shell aus, leider
funktioniert das aber nicht.
Das config.status-Script sollte mit der ksh als Interpreter erstellt
worden sein (siehe erste Zeile davon!).
Hier die Zeiten von Alex System (Macintosh SE/30, 32 MB, A/UX 3.0.1):
configure: 7:33, make: 12:02
- da die /bin/sh von A/UX recht limitiert ist, kann sie u.a. nicht zum
Erzeugen des "config.status"-Scripts verwendet werden.
Abhilfe: /bin/sh umbenennen (z.B. in "/bin/sh.AUX") und durch einen (am
besten symbolischen) Link auf /bin/ksh ersetzen.
Dieser Schritt sollte keine Probleme nach sich ziehen und ist daher immer,
auch unabhaengig vom ngIRCd, empfehlenswert.
--
$Id: README-AUX.txt,v 1.3 2002/04/29 14:19:48 alex Exp $
$Id: README-AUX.txt,v 1.4 2002/11/11 00:59:11 alex Exp $

View File

@@ -11,6 +11,19 @@
0. Upgrade Information
~~~~~~~~~~~~~~~~~~~~~~
Differences to version 0.5.x
- Starting with version 0.6.0, other servers are identified using asyncronous
passwords: therefore the variable "Password" in [Server]-sections has been
replaced by "MyPassword" and "PeerPassword".
- New configuration variables, section [Global]: MaxConnections, MaxJoins
(see example configuration file "doc/en/sample-ngircd.conf"!).
I. Standard-Installation
~~~~~~~~~~~~~~~~~~~~~~~~
@@ -123,4 +136,4 @@ number. In both cases the server exits after the output.
--
$Id: INSTALL,v 1.2 2002/05/20 12:02:58 alex Exp $
$Id: INSTALL,v 1.3 2002/12/18 12:19:07 alex Exp $

View File

@@ -9,10 +9,10 @@
# Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
# der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
#
# $Id: Makefile.am,v 1.1 2002/05/09 10:17:05 alex Exp $
# $Id: Makefile.am,v 1.2 2002/11/18 14:06:29 alex Exp $
#
EXTRA_DIST = INSTALL README
EXTRA_DIST = INSTALL README sample-ngircd.conf
maintainer-clean-local:
rm -f Makefile Makefile.in

View File

@@ -32,8 +32,8 @@ Till today (more or less complete) implemented IRC-commands:
ADMIN, AWAY, CHANINFO, CONNECT, DIE, ERROR, INVITE, ISON, JOIN, KICK, KILL,
LINKS, LIST, LUSERS, MODE, MOTD, NAMES, NICK, NJOIN, NOTICE, OPER, PART,
PASS, PING, PONG, PRIVMSG, QUIT, RESTART, SERVER, SQUIT, TOPIC, USERHOST,
USER, VERSION, WHO, WHOIS.
PASS, PING, PONG, PRIVMSG, QUIT, RESTART, SERVER, SQUIT, TIME, TOPIC,
USERHOST, USER, VERSION, WHO, WHOIS.
III. Features (or: why use ngIRCd?)
@@ -98,4 +98,4 @@ to post a mail to: <alex@barton.de> or <alex@arthur.ath.cx>
--
$Id: README,v 1.6 2002/09/16 11:03:05 alex Exp $
$Id: README,v 1.7 2002/11/24 18:48:59 alex Exp $

138
doc/en/sample-ngircd.conf Normal file
View File

@@ -0,0 +1,138 @@
# $Id: sample-ngircd.conf,v 1.4 2002/12/18 12:19:07 alex Exp $
#
# This is a sample configuration for the ngIRCd, which must adept to the
# local preferences and needs.
#
# Comments are started with "#" or ";".
#
# Author: Alexander Barton, <alex@barton.de>
# Translation by Ilja Osthoff, <ilja@glide.ath.cx>
#
[Global]
# In the [global] section of this file, there is the place of the
# main server configuration. Needed is only the variable "Name",
# Info you can adjust, if you like to. For all the others variables,
# you can use the defaults, this means you can leave it by default.
# Server name in the IRC-network
Name = irc.the.net
# Info-text of the server. This will be shown i.e. by a WHOIS- or
# LINKS-request.
Info = Server Info Text
# Information about the server and administrator in the ADMIN-request
;AdminInfo1 = Description
;AdminInfo2 = Location
;AdminEMail = admin@irc.server
# Ports, on which the server will listen. There may be more than
# one port, separated with ";". (Default: 6667)
;Ports = 6667, 6668, 66694
# Textfile with the "message of the day" (MOTD). This will be shown
# on a user connection with the server.
;MotdFile = /usr/local/etc/ngircd.motd
# User-ID, under which the server is started (for that the server
# must be started with root-rights). You can use the name of the
# user or the numerical ID.
# ATTENTION: the configuration and the MOTD file must be readable
# by this user, otherwise RESTART won't work!
;ServerUID = 65534
# Group-ID, under which the server is running (for that the server
# must be started with root-rights). You can use the name of the
# group or the numerical ID.
;ServerGID = 65534
# After <PingTimeout> seconds, the server will send a ping after
# inactivity of this client.
;PingTimeout = 120
# If there is an answer of a client, to which the ping was sended,
# not after <PongTimeout> seconds, it will be disconnected.
;PongTimeout = 20
# The server tries every <ConnectRetry> seconds, not yet connected
# or not anymore connected servers to connect.
;ConnectRetry = 60
# Should IRC-operators be allowed to use the MODE command even if
# they are not(!) channel-operators?
;OperCanUseMode = no
# Maximum number of simultanous connection the server is allowed
# to accept (<=0: unlimited):
;MaxConnections = -1
# Maximum number of channels a user can be member of (<=0: no limit):
;MaxJoins = 10
[Operator]
# In this [operator]-section, there will be the configuration of
# the name and password of an IRC operator. There may be more than
# one operator-block (for each operator one).
# ID of the operator (may be different of the nick)
;Name = TheOper
# Password of the operator
;Password = ThePwd
[Server]
# In this [Server] section, there is the configuration of the
# servers, which are allowed to connect to your own server.
# There may be more than one server-block.
# If you configured a port for the connection, then the ngIRCd
# tries to connect to this port. If not, it waits for the other
# server.
#
# Server-groups:
# The ngIRCd allows "server-groups": that means, that you can assign
# server-groups for every server, to which you want the ngIRCd to
# connect to. If one server of a server-group won't answer, the
# ngIRCd tries the next one of this group.
# ATTENTION: Server-groups will only work if you defined a port!
# IRC-name of the server
;Name = irc2.the.net
# Hostname of the server
;Host = connect-to-host.the.net
# Port of the server, to which the ngIRCd should connect. If you
# assign no port, the ngIRCd waits for an answer of that server.
;Port = 6666
# Own password for the connection. This password has to be configured
# as "PeerPassword" on the other server.
;MyPassword = MySecret
# Foreign password for this connection. This password has to be
# configured as "MyPassword" on the other server.
;PeerPassword = PeerSecret
# Group of that server (optional)
;Group = 123
[Channel]
# In the [Channel] there can be defined "persistent channels". This
# means, that the server creates the channel and even if all users
# left this channel, it will persist. There may be more than one
# block. Signed with the mode "P", which can be set or unset, like
# normal modes.
# Name of the channel
;Name = #TheName
# Topic for the channel
;Topic = a great topic
# Channel-modes
;Modes = tn
# -eof-

View File

@@ -1,4 +1,4 @@
# $Id: sample-ngircd.conf,v 1.11 2002/09/16 10:33:09 alex Exp $
# $Id: sample-ngircd.conf,v 1.17 2002/12/18 12:19:07 alex Exp $
#
# Das ist eine Beispiel-Konfiguration fuer den ngIRCd, die an die
@@ -6,6 +6,11 @@
#
# Kommentare werden mit "#" oder ";" eingeleitet.
#
# +-----------------------------------------------------------------------+
# | Please note: English translations of some of the german documentation |
# | files can be found in the directory "doc/en" -- please have a look! |
# +-----------------------------------------------------------------------+
#
# Autor: Alexander Barton, <alex@barton.de>
# Erweiterungen von Ilja Osthoff, <ilja@glide.ath.cx>
#
@@ -42,14 +47,16 @@
;MotdFile = /usr/local/etc/ngircd.motd
# User-ID, unter der der Daemon laufen soll (dazu muss der Server
# jedoch mit root-Rechten gestartet werden).
# jedoch mit root-Rechten gestartet werden). Es kann der Name oder
# die numerische ID angegeben werden.
# ACHTUNG: Die Konfigurations- und MOTD-Datei muessen fuer diesen
# Benutzer lesbar sein, ansonsten schlaegt ein RESTART fehl!
;ServerUID = 65534
;ServerUID = ircd
# Group-ID, zu der der Daemon wechseln soll (hierzu muss der Server
# jedoch mit root-Rechten gestartet werden)
;ServerGID = 65534
# jedoch mit root-Rechten gestartet werden). Es kann der Name oder
# die numerische ID angegeben werden.
;ServerGID = daemon
# Nach <PingTimeout> Sekunden verschickt der Server bei Inaktivitaet
# von einem Client diesem ein PING.
@@ -67,6 +74,14 @@
# koennen, auch wenn sie kein(!) Channel-Operator sind?
;OperCanUseMode = no
# Maximale Anzahl von gleichzeitigen Verbindungen, die dieser
# Server annehmen darf (<=0: unlimitiert).
;MaxConnections = -1
# Maximale Anzahl von Channels, in denen ein User zeitgleich
# Mitglied sein kann (<=0: unlimitiert).
;MaxJoins = 10
[Operator]
#
@@ -104,19 +119,24 @@
# die Gegenseite angegeben hat!
#
# Hostname des Servers
;Host = connect-to-host.the.net
# IRC-Name des Servers
;Name = irc2.the.net
# DNS-Hostname des Servers
;Host = connect-to-host.the.net
# Port, zu dem dieser Server eine Verbindung herstellen soll. Wird
# kein Port angegeben, so wird auf eine Verbindung der Gegenseite
# gewartet.
;Port = 6666
# Passwort fuer diese Verbindung
;Password = ThePwd1
# Eigenes Passwort fuer diese Verbindung. Dieses Passwort muss auf
# dem anderen Server als "PeerPassword" konfiguriert werden.
;MyPassword = MySecret
# Passwort des Peer-Servers fuer diese Verbindung. Dieses Passwort
# muss auf dem anderen Server als "MyPassword" konfiguriert sein.
;PeerPassword = PeerSecret
# Gruppe, zu der dieser Server gehoert (optional).
;Group = 123

View File

@@ -1,5 +1,5 @@
.\"
.\" $Id: ngircd.8,v 1.4 2002/09/16 11:11:21 alex Exp $
.\" $Id: ngircd.8,v 1.5 2002/11/18 18:49:34 alex Exp $
.\"
.TH ngircd 8 "September 2002" ngircd "ngIRCd Manual"
.SH NAME
@@ -24,7 +24,7 @@ use
.I file
as configuration file.
.IP "-n, --nodaemon"
don't fork and don't detatch from controlling terminal.
don't fork and don't detach from controlling terminal.
.IP "-p, --passive"
disable automatic connections to other servers.
.IP --version

View File

@@ -9,7 +9,7 @@
# Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
# der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
#
# $Id: Makefile.am,v 1.27 2002/09/07 18:06:29 alex Exp $
# $Id: Makefile.am,v 1.31.2.1 2003/01/04 10:58:15 alex Exp $
#
AUTOMAKE_OPTIONS = ../portab/ansi2knr
@@ -21,20 +21,20 @@ LINTARGS = -weak -warnunixlib +unixlib -booltype BOOLEAN
sbin_PROGRAMS = ngircd
ngircd_SOURCES = ngircd.c channel.c client.c conf.c conn.c hash.c irc.c \
irc-channel.c irc-login.c irc-mode.c irc-op.c irc-oper.c irc-server.c \
irc-write.c lists.c log.c match.c parse.c resolve.c tool.c
irc-channel.c irc-info.c irc-login.c irc-mode.c irc-op.c irc-oper.c \
irc-server.c irc-write.c lists.c log.c match.c parse.c resolve.c tool.c
ngircd_LDFLAGS = -L../portab
ngircd_LDADD = -lngportab
noinst_HEADERS = ngircd.h channel.h client.h conf.h conn.h hash.h irc.h \
irc-channel.h irc-login.h irc-mode.h irc-op.h irc-oper.h irc-server.h \
irc-write.h lists.h log.h match.h parse.h resolve.h tool.h \
irc-channel.h irc-info.h irc-login.h irc-mode.h irc-op.h irc-oper.h \
irc-server.h irc-write.h lists.h log.h match.h parse.h resolve.h tool.h \
messages.h defines.h
clean-local:
rm -f check-version check-help lint.out
rm -f check-version check-help lint.out cvs-version.*
maintainer-clean-local:
rm -f Makefile Makefile.in
@@ -60,6 +60,16 @@ lint:
fi; \
done;
ngircd.c: cvs-date cvs-version.h
cvs-date:
grep VERSION ../config.h | grep "CVS" \
&& echo "#define CVSDATE \"$$( grep "\$$Id" $(srcdir)/*.c \
| $(AWK) "{ print \$$9 }" | sort | tail -1 \
| sed -e "s/\//-/g" )\"" > cvs-version.new \
|| echo "" > cvs-version.new
diff cvs-version.h cvs-version.new || cp cvs-version.new cvs-version.h
TESTS = check-version check-help
# -eof-

View File

@@ -2,16 +2,13 @@
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
*
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* der GNU General Public License (GPL), wie von der Free Software Foundation
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: channel.c,v 1.32 2002/09/03 23:57:57 alex Exp $
*
* channel.c: Management der Channels
* Channel management
*/
@@ -20,6 +17,8 @@
#include "portab.h"
static char UNUSED id[] = "$Id: channel.c,v 1.38 2002/12/16 23:05:24 alex Exp $";
#include "imp.h"
#include <assert.h>
#include <stdlib.h>
@@ -89,6 +88,14 @@ Channel_InitPredefined( VOID )
continue;
}
/* Gibt es den Channel bereits? */
chan = Channel_Search( Conf_Channel[i].name );
if( chan )
{
Log( LOG_INFO, "Can't create pre-defined channel \"%s\": name already in use.", Conf_Channel[i].name );
continue;
}
/* Channel anlegen */
chan = Channel_Create( Conf_Channel[i].name );
if( chan )
@@ -249,11 +256,11 @@ Channel_Quit( CLIENT *Client, CHAR *Reason )
} /* Channel_Quit */
GLOBAL INT
GLOBAL LONG
Channel_Count( VOID )
{
CHANNEL *c;
INT count;
LONG count;
count = 0;
c = My_Channels;
@@ -266,11 +273,11 @@ Channel_Count( VOID )
} /* Channel_Count */
GLOBAL INT
GLOBAL LONG
Channel_MemberCount( CHANNEL *Chan )
{
CL2CHAN *cl2chan;
INT count;
LONG count;
assert( Chan != NULL );
@@ -285,6 +292,48 @@ Channel_MemberCount( CHANNEL *Chan )
} /* Channel_MemberCount */
GLOBAL INT
Channel_CountForUser( CLIENT *Client )
{
/* Count number of channels a user is member of. */
CL2CHAN *cl2chan;
INT count;
assert( Client != NULL );
count = 0;
cl2chan = My_Cl2Chan;
while( cl2chan )
{
if( cl2chan->client == Client ) count++;
cl2chan = cl2chan->next;
}
return count;
} /* Channel_CountForUser */
GLOBAL INT
Channel_PCount( VOID )
{
/* Count the number of persistent (mode 'P') channels */
CHANNEL *chan;
INT count;
count = 0;
chan = My_Channels;
while( chan )
{
if( strchr( chan->modes, 'P' )) count++;
chan = chan->next;
}
return count;
} /* Channel_PCount */
GLOBAL CHAR *
Channel_Name( CHANNEL *Chan )
{
@@ -301,6 +350,22 @@ Channel_Modes( CHANNEL *Chan )
} /* Channel_Modes */
GLOBAL CHAR *
Channel_Key( CHANNEL *Chan )
{
assert( Chan != NULL );
return Chan->key;
} /* Channel_Key */
GLOBAL LONG
Channel_MaxUsers( CHANNEL *Chan )
{
assert( Chan != NULL );
return Chan->maxusers;
} /* Channel_MaxUsers */
GLOBAL CHANNEL *
Channel_First( VOID )
{
@@ -580,6 +645,27 @@ Channel_SetModes( CHANNEL *Chan, CHAR *Modes )
} /* Channel_SetModes */
GLOBAL VOID
Channel_SetKey( CHANNEL *Chan, CHAR *Key )
{
assert( Chan != NULL );
assert( Key != NULL );
strncpy( Chan->key, Key, CLIENT_PASS_LEN - 1 );
Chan->key[CLIENT_PASS_LEN - 1] = '\0';
Log( LOG_DEBUG, "Channel %s: Key is now \"%s\".", Chan->name, Chan->key );
} /* Channel_SetKey */
GLOBAL VOID
Channel_SetMaxUsers( CHANNEL *Chan, LONG Count )
{
assert( Chan != NULL );
Chan->maxusers = Count;
Log( LOG_DEBUG, "Channel %s: Member limit is now %ld.", Chan->name, Chan->maxusers );
} /* Channel_SetMaxUsers */
GLOBAL BOOLEAN
Channel_Write( CHANNEL *Chan, CLIENT *From, CLIENT *Client, CHAR *Text )
@@ -629,6 +715,8 @@ Channel_Create( CHAR *Name )
strcpy( c->modes, "" );
strcpy( c->topic, "" );
c->hash = Hash( c->name );
strcpy( c->key, "" );
c->maxusers = 0;
/* Verketten */
c->next = My_Channels;

View File

@@ -2,16 +2,15 @@
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
*
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* der GNU General Public License (GPL), wie von der Free Software Foundation
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: channel.h,v 1.21 2002/09/03 23:57:57 alex Exp $
* $Id: channel.h,v 1.26 2002/12/16 23:05:24 alex Exp $
*
* channel.h: Management der Channels (Header)
* Channel management (header)
*/
@@ -26,10 +25,12 @@
typedef struct _CHANNEL
{
struct _CHANNEL *next;
CHAR name[CHANNEL_NAME_LEN]; /* Name des Channel */
UINT32 hash; /* Hash ueber (kleingeschrieben) Namen */
CHAR modes[CHANNEL_MODE_LEN]; /* Channel-Modes */
CHAR topic[CHANNEL_TOPIC_LEN]; /* Topic des Channels */
CHAR name[CHANNEL_NAME_LEN]; /* Name of the channel */
UINT32 hash; /* Hash of the (lowecase!) name */
CHAR modes[CHANNEL_MODE_LEN]; /* Channel modes */
CHAR topic[CHANNEL_TOPIC_LEN]; /* Topic of the channel */
CHAR key[CLIENT_PASS_LEN]; /* Channel key ("password", mode "k" ) */
LONG maxusers; /* Maximum number of members (mode "l") */
} CHANNEL;
typedef struct _CLIENT2CHAN
@@ -48,54 +49,60 @@ typedef POINTER CL2CHAN;
#endif
GLOBAL VOID Channel_Init PARAMS((VOID ));
GLOBAL VOID Channel_Init PARAMS(( VOID ));
GLOBAL VOID Channel_InitPredefined PARAMS(( VOID ));
GLOBAL VOID Channel_Exit PARAMS((VOID ));
GLOBAL VOID Channel_Exit PARAMS(( VOID ));
GLOBAL BOOLEAN Channel_Join PARAMS((CLIENT *Client, CHAR *Name ));
GLOBAL BOOLEAN Channel_Part PARAMS((CLIENT *Client, CLIENT *Origin, CHAR *Name, CHAR *Reason ));
GLOBAL BOOLEAN Channel_Join PARAMS(( CLIENT *Client, CHAR *Name ));
GLOBAL BOOLEAN Channel_Part PARAMS(( CLIENT *Client, CLIENT *Origin, CHAR *Name, CHAR *Reason ));
GLOBAL VOID Channel_Quit PARAMS((CLIENT *Client, CHAR *Reason ));
GLOBAL VOID Channel_Quit PARAMS(( CLIENT *Client, CHAR *Reason ));
GLOBAL VOID Channel_Kick PARAMS(( CLIENT *Client, CLIENT *Origin, CHAR *Name, CHAR *Reason ));
GLOBAL INT Channel_Count PARAMS((VOID ));
GLOBAL INT Channel_MemberCount PARAMS((CHANNEL *Chan ));
GLOBAL LONG Channel_Count PARAMS(( VOID ));
GLOBAL LONG Channel_MemberCount PARAMS(( CHANNEL *Chan ));
GLOBAL INT Channel_CountForUser PARAMS(( CLIENT *Client ));
GLOBAL INT Channel_PCount PARAMS(( VOID ));
GLOBAL CHAR *Channel_Name PARAMS((CHANNEL *Chan ));
GLOBAL CHAR *Channel_Modes PARAMS((CHANNEL *Chan ));
GLOBAL CHAR *Channel_Topic PARAMS((CHANNEL *Chan ));
GLOBAL CHAR *Channel_Name PARAMS(( CHANNEL *Chan ));
GLOBAL CHAR *Channel_Modes PARAMS(( CHANNEL *Chan ));
GLOBAL CHAR *Channel_Topic PARAMS(( CHANNEL *Chan ));
GLOBAL CHAR *Channel_Key PARAMS(( CHANNEL *Chan ));
GLOBAL LONG Channel_MaxUsers PARAMS(( CHANNEL *Chan ));
GLOBAL VOID Channel_SetTopic PARAMS((CHANNEL *Chan, CHAR *Topic ));
GLOBAL VOID Channel_SetModes PARAMS((CHANNEL *Chan, CHAR *Modes ));
GLOBAL VOID Channel_SetTopic PARAMS(( CHANNEL *Chan, CHAR *Topic ));
GLOBAL VOID Channel_SetModes PARAMS(( CHANNEL *Chan, CHAR *Modes ));
GLOBAL VOID Channel_SetKey PARAMS(( CHANNEL *Chan, CHAR *Key ));
GLOBAL VOID Channel_SetMaxUsers PARAMS(( CHANNEL *Chan, LONG Count ));
GLOBAL CHANNEL *Channel_Search PARAMS((CHAR *Name ));
GLOBAL CHANNEL *Channel_Search PARAMS(( CHAR *Name ));
GLOBAL CHANNEL *Channel_First PARAMS((VOID ));
GLOBAL CHANNEL *Channel_Next PARAMS((CHANNEL *Chan ));
GLOBAL CHANNEL *Channel_First PARAMS(( VOID ));
GLOBAL CHANNEL *Channel_Next PARAMS(( CHANNEL *Chan ));
GLOBAL CL2CHAN *Channel_FirstMember PARAMS((CHANNEL *Chan ));
GLOBAL CL2CHAN *Channel_NextMember PARAMS((CHANNEL *Chan, CL2CHAN *Cl2Chan ));
GLOBAL CL2CHAN *Channel_FirstChannelOf PARAMS((CLIENT *Client ));
GLOBAL CL2CHAN *Channel_NextChannelOf PARAMS((CLIENT *Client, CL2CHAN *Cl2Chan ));
GLOBAL CL2CHAN *Channel_FirstMember PARAMS(( CHANNEL *Chan ));
GLOBAL CL2CHAN *Channel_NextMember PARAMS(( CHANNEL *Chan, CL2CHAN *Cl2Chan ));
GLOBAL CL2CHAN *Channel_FirstChannelOf PARAMS(( CLIENT *Client ));
GLOBAL CL2CHAN *Channel_NextChannelOf PARAMS(( CLIENT *Client, CL2CHAN *Cl2Chan ));
GLOBAL CLIENT *Channel_GetClient PARAMS((CL2CHAN *Cl2Chan ));
GLOBAL CHANNEL *Channel_GetChannel PARAMS((CL2CHAN *Cl2Chan ));
GLOBAL CLIENT *Channel_GetClient PARAMS(( CL2CHAN *Cl2Chan ));
GLOBAL CHANNEL *Channel_GetChannel PARAMS(( CL2CHAN *Cl2Chan ));
GLOBAL BOOLEAN Channel_IsValidName PARAMS((CHAR *Name ));
GLOBAL BOOLEAN Channel_IsValidName PARAMS(( CHAR *Name ));
GLOBAL BOOLEAN Channel_ModeAdd PARAMS((CHANNEL *Chan, CHAR Mode ));
GLOBAL BOOLEAN Channel_ModeDel PARAMS((CHANNEL *Chan, CHAR Mode ));
GLOBAL BOOLEAN Channel_ModeAdd PARAMS(( CHANNEL *Chan, CHAR Mode ));
GLOBAL BOOLEAN Channel_ModeDel PARAMS(( CHANNEL *Chan, CHAR Mode ));
GLOBAL BOOLEAN Channel_UserModeAdd PARAMS((CHANNEL *Chan, CLIENT *Client, CHAR Mode ));
GLOBAL BOOLEAN Channel_UserModeDel PARAMS((CHANNEL *Chan, CLIENT *Client, CHAR Mode ));
GLOBAL CHAR *Channel_UserModes PARAMS((CHANNEL *Chan, CLIENT *Client ));
GLOBAL BOOLEAN Channel_UserModeAdd PARAMS(( CHANNEL *Chan, CLIENT *Client, CHAR Mode ));
GLOBAL BOOLEAN Channel_UserModeDel PARAMS(( CHANNEL *Chan, CLIENT *Client, CHAR Mode ));
GLOBAL CHAR *Channel_UserModes PARAMS(( CHANNEL *Chan, CLIENT *Client ));
GLOBAL BOOLEAN Channel_IsMemberOf PARAMS((CHANNEL *Chan, CLIENT *Client ));
GLOBAL BOOLEAN Channel_IsMemberOf PARAMS(( CHANNEL *Chan, CLIENT *Client ));
GLOBAL BOOLEAN Channel_Write PARAMS((CHANNEL *Chan, CLIENT *From, CLIENT *Client, CHAR *Text ));
GLOBAL BOOLEAN Channel_Write PARAMS(( CHANNEL *Chan, CLIENT *From, CLIENT *Client, CHAR *Text ));
GLOBAL CHANNEL *Channel_Create PARAMS((CHAR *Name ));
GLOBAL CHANNEL *Channel_Create PARAMS(( CHAR *Name ));
#endif

View File

@@ -2,23 +2,13 @@
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
*
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* der GNU General Public License (GPL), wie von der Free Software Foundation
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: client.c,v 1.60 2002/09/03 18:54:31 alex Exp $
*
* client.c: Management aller Clients
*
* Der Begriff "Client" ist in diesem Fall evtl. etwas verwirrend: Clients sind
* alle Verbindungen, die im gesamten(!) IRC-Netzwerk bekannt sind. Das sind IRC-
* Clients (User), andere Server und IRC-Services.
* Ueber welchen IRC-Server die Verbindung nun tatsaechlich in das Netzwerk her-
* gestellt wurde, muss der jeweiligen Struktur entnommen werden. Ist es dieser
* Server gewesen, so existiert eine entsprechende CONNECTION-Struktur.
* Client management.
*/
@@ -27,6 +17,8 @@
#include "portab.h"
static char UNUSED id[] = "$Id: client.c,v 1.65.2.3 2003/01/08 23:13:45 alex Exp $";
#include "imp.h"
#include <assert.h>
#include <unistd.h>
@@ -53,15 +45,22 @@
#include <exp.h>
#define GETID_LEN (CLIENT_NICK_LEN-1) + 1 + (CLIENT_USER_LEN-1) + 1 + (CLIENT_HOST_LEN-1) + 1
LOCAL CLIENT *This_Server, *My_Clients;
LOCAL CHAR GetID_Buffer[CLIENT_ID_LEN];
LOCAL CHAR GetID_Buffer[GETID_LEN];
LOCAL INT Count PARAMS(( CLIENT_TYPE Type ));
LOCAL INT MyCount PARAMS(( CLIENT_TYPE Type ));
LOCAL LONG Count PARAMS(( CLIENT_TYPE Type ));
LOCAL LONG MyCount PARAMS(( CLIENT_TYPE Type ));
LOCAL CLIENT *New_Client_Struct PARAMS(( VOID ));
LOCAL VOID Generate_MyToken PARAMS(( CLIENT *Client ));
LOCAL VOID Adjust_Counters PARAMS(( CLIENT *Client ));
LONG Max_Users = 0, My_Max_Users = 0;
GLOBAL VOID
@@ -182,6 +181,9 @@ Client_New( CONN_ID Idx, CLIENT *Introducer, CLIENT *TopServer, INT Type, CHAR *
client->next = (POINTER *)My_Clients;
My_Clients = client;
/* Adjust counters */
Adjust_Counters( client );
return client;
} /* Client_New */
@@ -372,7 +374,7 @@ Client_SetFlags( CLIENT *Client, CHAR *Flags )
assert( Flags != NULL );
strncpy( Client->flags, Flags, CLIENT_FLAGS_LEN - 1 );
Client->modes[CLIENT_FLAGS_LEN - 1] = '\0';
Client->flags[CLIENT_FLAGS_LEN - 1] = '\0';
} /* Client_SetFlags */
@@ -392,24 +394,14 @@ Client_SetPassword( CLIENT *Client, CHAR *Pwd )
GLOBAL VOID
Client_SetAway( CLIENT *Client, CHAR *Txt )
{
/* Von einem Client gelieferte AWAY-Nachricht */
/* Set AWAY reason of client */
assert( Client != NULL );
assert( Txt != NULL );
if( Txt )
{
/* Client AWAY setzen */
strncpy( Client->away, Txt, CLIENT_AWAY_LEN - 1 );
Client->away[CLIENT_AWAY_LEN - 1] = '\0';
Client_ModeAdd( Client, 'a' );
Log( LOG_DEBUG, "User \"%s\" is away: %s", Client_Mask( Client ), Txt );
}
else
{
/* AWAY loeschen */
Client_ModeDel( Client, 'a' );
Log( LOG_DEBUG, "User \"%s\" is no longer away.", Client_Mask( Client ));
}
} /* Client_SetAway */
@@ -419,6 +411,7 @@ Client_SetType( CLIENT *Client, INT Type )
assert( Client != NULL );
Client->type = Type;
if( Type == CLIENT_SERVER ) Generate_MyToken( Client );
Adjust_Counters( Client );
} /* Client_SetType */
@@ -713,7 +706,7 @@ Client_Mask( CLIENT *Client )
if( Client->type == CLIENT_SERVER ) return Client->id;
sprintf( GetID_Buffer, "%s!%s@%s", Client->id, Client->user, Client->host );
snprintf( GetID_Buffer, GETID_LEN, "%s!%s@%s", Client->id, Client->user, Client->host );
return GetID_Buffer;
} /* Client_Mask */
@@ -805,8 +798,9 @@ Client_CheckID( CLIENT *Client, CHAR *ID )
if( strcasecmp( c->id, ID ) == 0 )
{
/* die Server-ID gibt es bereits */
sprintf( str, "ID \"%s\" already registered!", ID );
Log( LOG_ERR, "%s (on connection %d)", str, Client->conn_id );
sprintf( str, "ID \"%s\" already registered", ID );
if( Client->conn_id != c->conn_id ) Log( LOG_ERR, "%s (on connection %d)!", str, c->conn_id );
else Log( LOG_ERR, "%s (via network)!", str );
Conn_Close( Client->conn_id, str, str, TRUE );
return FALSE;
}
@@ -837,46 +831,46 @@ Client_Next( CLIENT *c )
} /* Client_Next */
GLOBAL INT
GLOBAL LONG
Client_UserCount( VOID )
{
return Count( CLIENT_USER );
} /* Client_UserCount */
GLOBAL INT
GLOBAL LONG
Client_ServiceCount( VOID )
{
return Count( CLIENT_SERVICE );;
} /* Client_ServiceCount */
GLOBAL INT
GLOBAL LONG
Client_ServerCount( VOID )
{
return Count( CLIENT_SERVER );
} /* Client_ServerCount */
GLOBAL INT
GLOBAL LONG
Client_MyUserCount( VOID )
{
return MyCount( CLIENT_USER );
} /* Client_MyUserCount */
GLOBAL INT
GLOBAL LONG
Client_MyServiceCount( VOID )
{
return MyCount( CLIENT_SERVICE );
} /* Client_MyServiceCount */
GLOBAL INT
GLOBAL LONG
Client_MyServerCount( VOID )
{
CLIENT *c;
INT cnt;
LONG cnt;
cnt = 0;
c = My_Clients;
@@ -889,11 +883,11 @@ Client_MyServerCount( VOID )
} /* Client_MyServerCount */
GLOBAL INT
GLOBAL LONG
Client_OperCount( VOID )
{
CLIENT *c;
INT cnt;
LONG cnt;
cnt = 0;
c = My_Clients;
@@ -906,11 +900,11 @@ Client_OperCount( VOID )
} /* Client_OperCount */
GLOBAL INT
GLOBAL LONG
Client_UnknownCount( VOID )
{
CLIENT *c;
INT cnt;
LONG cnt;
cnt = 0;
c = My_Clients;
@@ -923,6 +917,20 @@ Client_UnknownCount( VOID )
} /* Client_UnknownCount */
GLOBAL LONG
Client_MaxUserCount( VOID )
{
return Max_Users;
} /* Client_MaxUserCount */
GLOBAL LONG
Client_MyMaxUserCount( VOID )
{
return My_Max_Users;
} /* Client_MyMaxUserCount */
GLOBAL BOOLEAN
Client_IsValidNick( CHAR *Nick )
{
@@ -950,11 +958,11 @@ Client_IsValidNick( CHAR *Nick )
} /* Client_IsValidNick */
LOCAL INT
LOCAL LONG
Count( CLIENT_TYPE Type )
{
CLIENT *c;
INT cnt;
LONG cnt;
cnt = 0;
c = My_Clients;
@@ -967,11 +975,11 @@ Count( CLIENT_TYPE Type )
} /* Count */
LOCAL INT
LOCAL LONG
MyCount( CLIENT_TYPE Type )
{
CLIENT *c;
INT cnt;
LONG cnt;
cnt = 0;
c = My_Clients;
@@ -1045,4 +1053,24 @@ Generate_MyToken( CLIENT *Client )
} /* Generate_MyToken */
LOCAL VOID
Adjust_Counters( CLIENT *Client )
{
LONG count;
assert( Client != NULL );
if( Client->type != CLIENT_USER ) return;
if( Client->conn_id != NONE )
{
/* Local connection */
count = Client_MyUserCount( );
if( count > My_Max_Users ) My_Max_Users = count;
}
count = Client_UserCount( );
if( count > Max_Users ) Max_Users = count;
} /* Adjust_Counters */
/* -eof- */

View File

@@ -2,16 +2,15 @@
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
*
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* der GNU General Public License (GPL), wie von der Free Software Foundation
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: client.h,v 1.29 2002/09/03 18:54:31 alex Exp $
* $Id: client.h,v 1.32.2.1 2002/12/22 23:42:28 alex Exp $
*
* client.h: Konfiguration des ngircd (Header)
* Client management (header)
*/
@@ -19,18 +18,17 @@
#define __client_h__
typedef enum
{
CLIENT_UNKNOWN, /* Verbindung mit (noch) unbekanntem Typ */
CLIENT_GOTPASS, /* Client hat PASS gesendet */
CLIENT_GOTNICK, /* Client hat NICK gesendet */
CLIENT_GOTUSER, /* Client hat USER gesendet */
CLIENT_USER, /* Client ist ein Benutzer (USER wurde gesendet) */
CLIENT_UNKNOWNSERVER, /* unregistrierte Server-Verbindung */
CLIENT_GOTPASSSERVER, /* Client hat PASS nach "Server-Art" gesendet */
CLIENT_SERVER, /* Client ist ein Server */
CLIENT_SERVICE /* Client ist ein Service */
} CLIENT_TYPE;
#define CLIENT_UNKNOWN 1 /* connection of unknown type */
#define CLIENT_GOTPASS 2 /* client did send PASS */
#define CLIENT_GOTNICK 4 /* client did send NICK */
#define CLIENT_GOTUSER 8 /* client did send USER */
#define CLIENT_USER 16 /* client is an IRC user */
#define CLIENT_UNKNOWNSERVER 32 /* unregistered server connection */
#define CLIENT_GOTPASSSERVER 64 /* client did send PASS in "server style" */
#define CLIENT_SERVER 128 /* client is a server */
#define CLIENT_SERVICE 256 /* client is a service */
#define CLIENT_TYPE INT
#if defined(__client_c__) | defined(S_SPLINT_S)
@@ -39,22 +37,22 @@ typedef enum
typedef struct _CLIENT
{
CHAR id[CLIENT_ID_LEN]; /* Nick (User) bzw. ID (Server) */
UINT32 hash; /* Hash ueber die (kleingeschriebene) ID */
POINTER *next; /* Zeiger auf naechste Client-Struktur */
CLIENT_TYPE type; /* Typ des Client, vgl. CLIENT_TYPE */
CONN_ID conn_id; /* ID der Connection (wenn lokal) bzw. NONE (remote) */
struct _CLIENT *introducer; /* ID des Servers, der die Verbindung hat */
struct _CLIENT *topserver; /* Toplevel-Servers (nur gueltig, wenn Client ein Server ist) */
CHAR pwd[CLIENT_PASS_LEN]; /* Passwort, welches der Client angegeben hat */
CHAR host[CLIENT_HOST_LEN]; /* Hostname des Client */
CHAR user[CLIENT_USER_LEN]; /* Benutzername ("Login") */
CHAR info[CLIENT_INFO_LEN]; /* Langer Benutzername (User) bzw. Infotext (Server) */
CHAR modes[CLIENT_MODE_LEN]; /* Client Modes */
INT hops, token, mytoken; /* "Hops" und "Token" (-> SERVER-Befehl) */
BOOLEAN oper_by_me; /* IRC-Operator-Status durch diesen Server? */
CHAR away[CLIENT_AWAY_LEN]; /* AWAY-Text, wenn Mode 'a' gesetzt */
CHAR flags[CLIENT_FLAGS_LEN]; /* Flags des Client (aktuell nur bei Servern) */
CHAR id[CLIENT_ID_LEN]; /* nick (user) / ID (server) */
UINT32 hash; /* hash of lower-case ID */
POINTER *next; /* pointer to next client structure */
CLIENT_TYPE type; /* type of client, see CLIENT_xxx */
CONN_ID conn_id; /* ID of the connection (if local) or NONE (remote) */
struct _CLIENT *introducer; /* ID of the servers which the client is connected to */
struct _CLIENT *topserver; /* toplevel servers (only valid if client is a server) */
CHAR pwd[CLIENT_PASS_LEN]; /* password received of the client */
CHAR host[CLIENT_HOST_LEN]; /* hostname of the client */
CHAR user[CLIENT_USER_LEN]; /* user name ("login") */
CHAR info[CLIENT_INFO_LEN]; /* long user name (user) / info text (server) */
CHAR modes[CLIENT_MODE_LEN]; /* client modes */
INT hops, token, mytoken; /* "hops" and "Token" (see SERVER command) */
BOOLEAN oper_by_me; /* client is local IRC operator on this server? */
CHAR away[CLIENT_AWAY_LEN]; /* AWAY text (valid if mode 'a' is set) */
CHAR flags[CLIENT_FLAGS_LEN]; /* flags of the client */
} CLIENT;
#else
@@ -124,14 +122,16 @@ GLOBAL BOOLEAN Client_ModeDel PARAMS((CLIENT *Client, CHAR Mode ));
GLOBAL BOOLEAN Client_CheckNick PARAMS((CLIENT *Client, CHAR *Nick ));
GLOBAL BOOLEAN Client_CheckID PARAMS((CLIENT *Client, CHAR *ID ));
GLOBAL INT Client_UserCount PARAMS((VOID ));
GLOBAL INT Client_ServiceCount PARAMS((VOID ));
GLOBAL INT Client_ServerCount PARAMS((VOID ));
GLOBAL INT Client_OperCount PARAMS((VOID ));
GLOBAL INT Client_UnknownCount PARAMS((VOID ));
GLOBAL INT Client_MyUserCount PARAMS((VOID ));
GLOBAL INT Client_MyServiceCount PARAMS((VOID ));
GLOBAL INT Client_MyServerCount PARAMS((VOID ));
GLOBAL LONG Client_UserCount PARAMS((VOID ));
GLOBAL LONG Client_ServiceCount PARAMS((VOID ));
GLOBAL LONG Client_ServerCount PARAMS((VOID ));
GLOBAL LONG Client_OperCount PARAMS((VOID ));
GLOBAL LONG Client_UnknownCount PARAMS((VOID ));
GLOBAL LONG Client_MyUserCount PARAMS((VOID ));
GLOBAL LONG Client_MyServiceCount PARAMS((VOID ));
GLOBAL LONG Client_MyServerCount PARAMS((VOID ));
GLOBAL LONG Client_MaxUserCount PARAMS(( VOID ));
GLOBAL LONG Client_MyMaxUserCount PARAMS(( VOID ));
GLOBAL BOOLEAN Client_IsValidNick PARAMS((CHAR *Nick ));

View File

@@ -1,22 +1,21 @@
/*
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
* Copyright (c)2001,2002 Alexander Barton (alex@barton.de)
*
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* der GNU General Public License (GPL), wie von der Free Software Foundation
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: conf.c,v 1.29 2002/09/16 09:13:06 alex Exp $
*
* conf.h: Konfiguration des ngircd
* Configuration management (reading, parsing & validation)
*/
#include "portab.h"
static char UNUSED id[] = "$Id: conf.c,v 1.47 2002/12/18 02:53:36 alex Exp $";
#include "imp.h"
#include <assert.h>
#include <errno.h>
@@ -25,6 +24,14 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <pwd.h>
#include <grp.h>
#include <sys/types.h>
#include <unistd.h>
#ifdef HAVE_CTYPE_H
# include <ctype.h>
#endif
#include "ngircd.h"
#include "conn.h"
@@ -43,7 +50,7 @@ LOCAL BOOLEAN Use_Log = TRUE;
LOCAL VOID Set_Defaults PARAMS(( VOID ));
LOCAL VOID Read_Config PARAMS(( VOID ));
LOCAL VOID Validate_Config PARAMS(( VOID ));
LOCAL VOID Validate_Config PARAMS(( BOOLEAN TestOnly ));
LOCAL VOID Handle_GLOBAL PARAMS(( INT Line, CHAR *Var, CHAR *Arg ));
LOCAL VOID Handle_OPERATOR PARAMS(( INT Line, CHAR *Var, CHAR *Arg ));
@@ -58,24 +65,26 @@ Conf_Init( VOID )
{
Set_Defaults( );
Read_Config( );
Validate_Config( );
Validate_Config( FALSE );
} /* Config_Init */
GLOBAL INT
Conf_Test( VOID )
{
/* Konfiguration einlesen, ueberpruefen und ausgeben. */
/* Read configuration, validate and output it. */
UINT i;
struct passwd *pwd;
struct group *grp;
INT i;
Use_Log = FALSE;
Set_Defaults( );
printf( "Using \"%s\" as configuration file ...\n", NGIRCd_ConfFile );
Read_Config( );
Validate_Config( TRUE );
/* Wenn stdin ein ein TTY ist: auf Taste warten */
/* If stdin is a valid tty wait for a key: */
if( isatty( fileno( stdout )))
{
puts( "OK, press enter to see a dump of your service configuration ..." );
@@ -91,26 +100,34 @@ Conf_Test( VOID )
printf( " AdminInfo2 = %s\n", Conf_ServerAdmin2 );
printf( " AdminEMail = %s\n", Conf_ServerAdminMail );
printf( " MotdFile = %s\n", Conf_MotdFile );
printf( " ListenPorts = " );
printf( " Ports = " );
for( i = 0; i < Conf_ListenPorts_Count; i++ )
{
if( i != 0 ) printf( ", " );
printf( "%u", Conf_ListenPorts[i] );
}
puts( "" );
printf( " ServerUID = %ld\n", (INT32)Conf_UID );
printf( " ServerGID = %ld\n", (INT32)Conf_GID );
pwd = getpwuid( Conf_UID );
if( pwd ) printf( " ServerUID = %s\n", pwd->pw_name );
else printf( " ServerUID = %ld\n", (LONG)Conf_UID );
grp = getgrgid( Conf_GID );
if( grp ) printf( " ServerGID = %s\n", grp->gr_name );
else printf( " ServerGID = %ld\n", (LONG)Conf_GID );
printf( " PingTimeout = %d\n", Conf_PingTimeout );
printf( " PongTimeout = %d\n", Conf_PongTimeout );
printf( " ConnectRetry = %d\n", Conf_ConnectRetry );
printf( " OperCanUseMode = %s\n", Conf_OperCanMode == TRUE ? "yes" : "no" );
if( Conf_MaxConnections > 0 ) printf( " MaxConnections = %ld\n", Conf_MaxConnections );
else printf( " MaxConnections = -1\n" );
if( Conf_MaxJoins > 0 ) printf( " MaxJoins = %d\n", Conf_MaxJoins );
else printf( " MaxJoins = -1\n" );
puts( "" );
for( i = 0; i < Conf_Oper_Count; i++ )
{
if( ! Conf_Oper[i].name[0] ) continue;
/* gueltiger Operator-Block: ausgeben */
/* Valid "Operator" section */
puts( "[OPERATOR]" );
printf( " Name = %s\n", Conf_Oper[i].name );
printf( " Password = %s\n", Conf_Oper[i].pwd );
@@ -120,14 +137,14 @@ Conf_Test( VOID )
for( i = 0; i < Conf_Server_Count; i++ )
{
if( ! Conf_Server[i].name[0] ) continue;
if( ! Conf_Server[i].host[0] ) continue;
/* gueltiger Server-Block: ausgeben */
/* Valid "Server" section */
puts( "[SERVER]" );
printf( " Name = %s\n", Conf_Server[i].name );
printf( " Host = %s\n", Conf_Server[i].host );
printf( " Port = %d\n", Conf_Server[i].port );
printf( " Password = %s\n", Conf_Server[i].pwd );
printf( " MyPassword = %s\n", Conf_Server[i].pwd_in );
printf( " PeerPassword = %s\n", Conf_Server[i].pwd_out );
printf( " Group = %d\n", Conf_Server[i].group );
puts( "" );
}
@@ -136,7 +153,7 @@ Conf_Test( VOID )
{
if( ! Conf_Channel[i].name[0] ) continue;
/* gueltiger Channel-Block: ausgeben */
/* Valid "Channel" section */
puts( "[CHANNEL]" );
printf( " Name = %s\n", Conf_Channel[i].name );
printf( " Modes = %s\n", Conf_Channel[i].modes );
@@ -151,7 +168,7 @@ Conf_Test( VOID )
LOCAL VOID
Set_Defaults( VOID )
{
/* Konfigurationsvariablen initialisieren, d.h. auf Default-Werte setzen. */
/* Initialize configuration variables with default values. */
strcpy( Conf_ServerName, "" );
sprintf( Conf_ServerInfo, "%s %s", PACKAGE, VERSION );
@@ -177,13 +194,16 @@ Set_Defaults( VOID )
Conf_Channel_Count = 0;
Conf_OperCanMode = FALSE;
Conf_MaxConnections = -1;
Conf_MaxJoins = 10;
} /* Set_Defaults */
LOCAL VOID
Read_Config( VOID )
{
/* Konfigurationsdatei einlesen. */
/* Read configuration file. */
CHAR section[LINE_LEN], str[LINE_LEN], *var, *arg, *ptr;
INT line;
@@ -192,12 +212,14 @@ Read_Config( VOID )
fd = fopen( NGIRCd_ConfFile, "r" );
if( ! fd )
{
/* Keine Konfigurationsdatei gefunden */
/* No configuration file found! */
Config_Error( LOG_ALERT, "Can't read configuration \"%s\": %s", NGIRCd_ConfFile, strerror( errno ));
Config_Error( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE );
exit( 1 );
}
Config_Error( LOG_INFO, "Reading configuration from \"%s\" ...", NGIRCd_ConfFile );
line = 0;
strcpy( section, "" );
while( TRUE )
@@ -206,10 +228,10 @@ Read_Config( VOID )
ngt_TrimStr( str );
line++;
/* Kommentarzeilen und leere Zeilen ueberspringen */
/* Skip comments and empty lines */
if( str[0] == ';' || str[0] == '#' || str[0] == '\0' ) continue;
/* Anfang eines Abschnittes? */
/* Is this the beginning of a new section? */
if(( str[0] == '[' ) && ( str[strlen( str ) - 1] == ']' ))
{
strcpy( section, str );
@@ -219,7 +241,7 @@ Read_Config( VOID )
if( Conf_Oper_Count + 1 > MAX_OPERATORS ) Config_Error( LOG_ERR, "Too many operators configured." );
else
{
/* neuen Operator initialisieren */
/* Initialize new operator structure */
strcpy( Conf_Oper[Conf_Oper_Count].name, "" );
strcpy( Conf_Oper[Conf_Oper_Count].pwd, "" );
Conf_Oper_Count++;
@@ -231,11 +253,12 @@ Read_Config( VOID )
if( Conf_Server_Count + 1 > MAX_SERVERS ) Config_Error( LOG_ERR, "Too many servers configured." );
else
{
/* neuen Server ("Peer") initialisieren */
/* Initialize new server structure */
strcpy( Conf_Server[Conf_Server_Count].host, "" );
strcpy( Conf_Server[Conf_Server_Count].ip, "" );
strcpy( Conf_Server[Conf_Server_Count].name, "" );
strcpy( Conf_Server[Conf_Server_Count].pwd, "" );
strcpy( Conf_Server[Conf_Server_Count].pwd_in, "" );
strcpy( Conf_Server[Conf_Server_Count].pwd_out, "" );
Conf_Server[Conf_Server_Count].port = 0;
Conf_Server[Conf_Server_Count].group = -1;
Conf_Server[Conf_Server_Count].lasttry = time( NULL ) - Conf_ConnectRetry + STARTUP_DELAY;
@@ -249,7 +272,7 @@ Read_Config( VOID )
if( Conf_Channel_Count + 1 > MAX_DEFCHANNELS ) Config_Error( LOG_ERR, "Too many pre-defined channels configured." );
else
{
/* neuen vordefinierten Channel initialisieren */
/* Initialize new channel structure */
strcpy( Conf_Channel[Conf_Channel_Count].name, "" );
strcpy( Conf_Channel[Conf_Channel_Count].modes, "" );
strcpy( Conf_Channel[Conf_Channel_Count].topic, "" );
@@ -262,7 +285,7 @@ Read_Config( VOID )
}
if( section[0] == 0x1 ) continue;
/* In Variable und Argument zerlegen */
/* Split line into variable name and parameters */
ptr = strchr( str, '=' );
if( ! ptr )
{
@@ -282,7 +305,7 @@ Read_Config( VOID )
fclose( fd );
/* Wenn kein Port definiert wurde, Port 6667 als Default benutzen */
/* If there are no ports configured use the default: 6667 */
if( Conf_ListenPorts_Count < 1 )
{
Conf_ListenPorts_Count = 1;
@@ -294,8 +317,10 @@ Read_Config( VOID )
LOCAL VOID
Handle_GLOBAL( INT Line, CHAR *Var, CHAR *Arg )
{
struct passwd *pwd;
struct group *grp;
CHAR *ptr;
INT32 port;
LONG port;
assert( Line > 0 );
assert( Var != NULL );
@@ -303,50 +328,56 @@ Handle_GLOBAL( INT Line, CHAR *Var, CHAR *Arg )
if( strcasecmp( Var, "Name" ) == 0 )
{
/* Der Server-Name */
/* Server name */
strncpy( Conf_ServerName, Arg, CLIENT_ID_LEN - 1 );
Conf_ServerName[CLIENT_ID_LEN - 1] = '\0';
if( strlen( Arg ) > CLIENT_ID_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Name\" too long!", NGIRCd_ConfFile, Line );
return;
}
if( strcasecmp( Var, "Info" ) == 0 )
{
/* Server-Info-Text */
/* Info text of server */
strncpy( Conf_ServerInfo, Arg, CLIENT_INFO_LEN - 1 );
Conf_ServerInfo[CLIENT_INFO_LEN - 1] = '\0';
if( strlen( Arg ) > CLIENT_INFO_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Info\" too long!", NGIRCd_ConfFile, Line );
return;
}
if( strcasecmp( Var, "Password" ) == 0 )
{
/* Server-Passwort */
/* Global server password */
strncpy( Conf_ServerPwd, Arg, CLIENT_PASS_LEN - 1 );
Conf_ServerPwd[CLIENT_PASS_LEN - 1] = '\0';
if( strlen( Arg ) > CLIENT_PASS_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Password\" too long!", NGIRCd_ConfFile, Line );
return;
}
if( strcasecmp( Var, "AdminInfo1" ) == 0 )
{
/* Server-Info-Text */
/* Administrative info #1 */
strncpy( Conf_ServerAdmin1, Arg, CLIENT_INFO_LEN - 1 );
Conf_ServerAdmin1[CLIENT_INFO_LEN - 1] = '\0';
if( strlen( Arg ) > CLIENT_INFO_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"AdminInfo1\" too long!", NGIRCd_ConfFile, Line );
return;
}
if( strcasecmp( Var, "AdminInfo2" ) == 0 )
{
/* Server-Info-Text */
/* Administrative info #2 */
strncpy( Conf_ServerAdmin2, Arg, CLIENT_INFO_LEN - 1 );
Conf_ServerAdmin2[CLIENT_INFO_LEN - 1] = '\0';
if( strlen( Arg ) > CLIENT_INFO_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"AdminInfo2\" too long!", NGIRCd_ConfFile, Line );
return;
}
if( strcasecmp( Var, "AdminEMail" ) == 0 )
{
/* Server-Info-Text */
/* Administrative email contact */
strncpy( Conf_ServerAdminMail, Arg, CLIENT_INFO_LEN - 1 );
Conf_ServerAdminMail[CLIENT_INFO_LEN - 1] = '\0';
if( strlen( Arg ) > CLIENT_INFO_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"AdminEMail\" too long!", NGIRCd_ConfFile, Line );
return;
}
if( strcasecmp( Var, "Ports" ) == 0 )
{
/* Ports, durch "," getrennt, auf denen der Server
* Verbindungen annehmen soll */
/* Ports on that the server should listen. More port numbers
* must be separated by "," */
ptr = strtok( Arg, "," );
while( ptr )
{
@@ -364,53 +395,104 @@ Handle_GLOBAL( INT Line, CHAR *Var, CHAR *Arg )
}
if( strcasecmp( Var, "MotdFile" ) == 0 )
{
/* Datei mit der "message of the day" (MOTD) */
/* "Message of the day" (MOTD) file */
strncpy( Conf_MotdFile, Arg, FNAME_LEN - 1 );
Conf_MotdFile[FNAME_LEN - 1] = '\0';
if( strlen( Arg ) > FNAME_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"MotdFile\" too long!", NGIRCd_ConfFile, Line );
return;
}
if( strcasecmp( Var, "ServerUID" ) == 0 )
{
/* UID, mit der der Daemon laufen soll */
/* UID the daemon should switch to */
pwd = getpwnam( Arg );
if( pwd ) Conf_UID = pwd->pw_uid;
else
{
#ifdef HAVE_ISDIGIT
if( ! isdigit( *Arg )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"ServerUID\" is not a number!", NGIRCd_ConfFile, Line );
else
#endif
Conf_UID = (UINT)atoi( Arg );
}
return;
}
if( strcasecmp( Var, "ServerGID" ) == 0 )
{
/* GID, mit der der Daemon laufen soll */
/* GID the daemon should use */
grp = getgrnam( Arg );
if( grp ) Conf_GID = grp->gr_gid;
else
{
#ifdef HAVE_ISDIGIT
if( ! isdigit( *Arg )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"ServerGID\" is not a number!", NGIRCd_ConfFile, Line );
else
#endif
Conf_GID = (UINT)atoi( Arg );
}
return;
}
if( strcasecmp( Var, "PingTimeout" ) == 0 )
{
/* PING-Timeout */
/* PING timeout */
Conf_PingTimeout = atoi( Arg );
if(( Conf_PingTimeout ) < 5 ) Conf_PingTimeout = 5;
if( Conf_PingTimeout < 5 )
{
Config_Error( LOG_WARNING, "%s, line %d: Value of \"PingTimeout\" too low!", NGIRCd_ConfFile, Line );
Conf_PingTimeout = 5;
}
return;
}
if( strcasecmp( Var, "PongTimeout" ) == 0 )
{
/* PONG-Timeout */
/* PONG timeout */
Conf_PongTimeout = atoi( Arg );
if(( Conf_PongTimeout ) < 5 ) Conf_PongTimeout = 5;
if( Conf_PongTimeout < 5 )
{
Config_Error( LOG_WARNING, "%s, line %d: Value of \"PongTimeout\" too low!", NGIRCd_ConfFile, Line );
Conf_PongTimeout = 5;
}
return;
}
if( strcasecmp( Var, "ConnectRetry" ) == 0 )
{
/* Sekunden zwischen Verbindungsversuchen zu anderen Servern */
/* Seconds between connection attempts to other servers */
Conf_ConnectRetry = atoi( Arg );
if(( Conf_ConnectRetry ) < 5 ) Conf_ConnectRetry = 5;
if( Conf_ConnectRetry < 5 )
{
Config_Error( LOG_WARNING, "%s, line %d: Value of \"ConnectRetry\" too low!", NGIRCd_ConfFile, Line );
Conf_ConnectRetry = 5;
}
return;
}
if( strcasecmp( Var, "OperCanUseMode" ) == 0 )
{
/* Koennen IRC-Operatoren immer MODE benutzen? */
/* Are IRC operators allowed to use MODE in channels they aren't Op in? */
if( strcasecmp( Arg, "yes" ) == 0 ) Conf_OperCanMode = TRUE;
else if( strcasecmp( Arg, "true" ) == 0 ) Conf_OperCanMode = TRUE;
else if( atoi( Arg ) != 0 ) Conf_OperCanMode = TRUE;
else Conf_OperCanMode = FALSE;
return;
}
if( strcasecmp( Var, "MaxConnections" ) == 0 )
{
/* Maximum number of connections. Values <= 0 are equal to "no limit". */
#ifdef HAVE_ISDIGIT
if( ! isdigit( *Arg )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"MaxConnections\" is not a number!", NGIRCd_ConfFile, Line );
else
#endif
Conf_MaxConnections = atol( Arg );
return;
}
if( strcasecmp( Var, "MaxJoins" ) == 0 )
{
/* Maximum number of channels a user can join. Values <= 0 are equal to "no limit". */
#ifdef HAVE_ISDIGIT
if( ! isdigit( *Arg )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"MaxJoins\" is not a number!", NGIRCd_ConfFile, Line );
else
#endif
Conf_MaxJoins = atoi( Arg );
return;
}
Config_Error( LOG_ERR, "%s, line %d (section \"Global\"): Unknown variable \"%s\"!", NGIRCd_ConfFile, Line, Var );
} /* Handle_GLOBAL */
@@ -426,16 +508,18 @@ Handle_OPERATOR( INT Line, CHAR *Var, CHAR *Arg )
if( strcasecmp( Var, "Name" ) == 0 )
{
/* Name des IRC Operator */
/* Name of IRC operator */
strncpy( Conf_Oper[Conf_Oper_Count - 1].name, Arg, CLIENT_PASS_LEN - 1 );
Conf_Oper[Conf_Oper_Count - 1].name[CLIENT_PASS_LEN - 1] = '\0';
if( strlen( Arg ) > CLIENT_PASS_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Name\" too long!", NGIRCd_ConfFile, Line );
return;
}
if( strcasecmp( Var, "Password" ) == 0 )
{
/* Passwort des IRC Operator */
/* Password of IRC operator */
strncpy( Conf_Oper[Conf_Oper_Count - 1].pwd, Arg, CLIENT_PASS_LEN - 1 );
Conf_Oper[Conf_Oper_Count - 1].pwd[CLIENT_PASS_LEN - 1] = '\0';
if( strlen( Arg ) > CLIENT_PASS_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Password\" too long!", NGIRCd_ConfFile, Line );
return;
}
@@ -446,7 +530,7 @@ Handle_OPERATOR( INT Line, CHAR *Var, CHAR *Arg )
LOCAL VOID
Handle_SERVER( INT Line, CHAR *Var, CHAR *Arg )
{
INT32 port;
LONG port;
assert( Line > 0 );
assert( Var != NULL );
@@ -454,28 +538,39 @@ Handle_SERVER( INT Line, CHAR *Var, CHAR *Arg )
if( strcasecmp( Var, "Host" ) == 0 )
{
/* Hostname des Servers */
/* Hostname of the server */
strncpy( Conf_Server[Conf_Server_Count - 1].host, Arg, HOST_LEN - 1 );
Conf_Server[Conf_Server_Count - 1].host[HOST_LEN - 1] = '\0';
if( strlen( Arg ) > HOST_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Host\" too long!", NGIRCd_ConfFile, Line );
return;
}
if( strcasecmp( Var, "Name" ) == 0 )
{
/* Name des Servers ("Nick") */
/* Name of the server ("Nick"/"ID") */
strncpy( Conf_Server[Conf_Server_Count - 1].name, Arg, CLIENT_ID_LEN - 1 );
Conf_Server[Conf_Server_Count - 1].name[CLIENT_ID_LEN - 1] = '\0';
if( strlen( Arg ) > CLIENT_ID_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Name\" too long!", NGIRCd_ConfFile, Line );
return;
}
if( strcasecmp( Var, "Password" ) == 0 )
if( strcasecmp( Var, "MyPassword" ) == 0 )
{
/* Passwort des Servers */
strncpy( Conf_Server[Conf_Server_Count - 1].pwd, Arg, CLIENT_PASS_LEN - 1 );
Conf_Server[Conf_Server_Count - 1].pwd[CLIENT_PASS_LEN - 1] = '\0';
/* Password of this server which is sent to the peer */
strncpy( Conf_Server[Conf_Server_Count - 1].pwd_in, Arg, CLIENT_PASS_LEN - 1 );
Conf_Server[Conf_Server_Count - 1].pwd_in[CLIENT_PASS_LEN - 1] = '\0';
if( strlen( Arg ) > CLIENT_PASS_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"MyPassword\" too long!", NGIRCd_ConfFile, Line );
return;
}
if( strcasecmp( Var, "PeerPassword" ) == 0 )
{
/* Passwort of the peer which must be received */
strncpy( Conf_Server[Conf_Server_Count - 1].pwd_out, Arg, CLIENT_PASS_LEN - 1 );
Conf_Server[Conf_Server_Count - 1].pwd_out[CLIENT_PASS_LEN - 1] = '\0';
if( strlen( Arg ) > CLIENT_PASS_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"PeerPassword\" too long!", NGIRCd_ConfFile, Line );
return;
}
if( strcasecmp( Var, "Port" ) == 0 )
{
/* Port, zu dem Verbunden werden soll */
/* Port to which this server should connect */
port = atol( Arg );
if( port > 0 && port < 0xFFFF ) Conf_Server[Conf_Server_Count - 1].port = (INT)port;
else Config_Error( LOG_ERR, "%s, line %d (section \"Server\"): Illegal port number %ld!", NGIRCd_ConfFile, Line, port );
@@ -483,7 +578,11 @@ Handle_SERVER( INT Line, CHAR *Var, CHAR *Arg )
}
if( strcasecmp( Var, "Group" ) == 0 )
{
/* Server-Gruppe */
/* Server group */
#ifdef HAVE_ISDIGIT
if( ! isdigit( *Arg )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Group\" is not a number!", NGIRCd_ConfFile, Line );
else
#endif
Conf_Server[Conf_Server_Count - 1].group = atoi( Arg );
return;
}
@@ -501,23 +600,26 @@ Handle_CHANNEL( INT Line, CHAR *Var, CHAR *Arg )
if( strcasecmp( Var, "Name" ) == 0 )
{
/* Hostname des Servers */
/* Name of the channel */
strncpy( Conf_Channel[Conf_Channel_Count - 1].name, Arg, CHANNEL_NAME_LEN - 1 );
Conf_Channel[Conf_Channel_Count - 1].name[CHANNEL_NAME_LEN - 1] = '\0';
if( strlen( Arg ) > CHANNEL_NAME_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Name\" too long!", NGIRCd_ConfFile, Line );
return;
}
if( strcasecmp( Var, "Modes" ) == 0 )
{
/* Name des Servers ("Nick") */
/* Initial modes */
strncpy( Conf_Channel[Conf_Channel_Count - 1].modes, Arg, CHANNEL_MODE_LEN - 1 );
Conf_Channel[Conf_Channel_Count - 1].modes[CHANNEL_MODE_LEN - 1] = '\0';
if( strlen( Arg ) > CHANNEL_MODE_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Modes\" too long!", NGIRCd_ConfFile, Line );
return;
}
if( strcasecmp( Var, "Topic" ) == 0 )
{
/* Passwort des Servers */
/* Initial topic */
strncpy( Conf_Channel[Conf_Channel_Count - 1].topic, Arg, CHANNEL_TOPIC_LEN - 1 );
Conf_Channel[Conf_Channel_Count - 1].topic[CHANNEL_TOPIC_LEN - 1] = '\0';
if( strlen( Arg ) > CHANNEL_TOPIC_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Topic\" too long!", NGIRCd_ConfFile, Line );
return;
}
@@ -526,33 +628,48 @@ Handle_CHANNEL( INT Line, CHAR *Var, CHAR *Arg )
LOCAL VOID
Validate_Config( VOID )
Validate_Config( BOOLEAN Configtest )
{
/* Konfiguration ueberpruefen */
/* Validate configuration settings. */
if( ! Conf_ServerName[0] )
{
/* Kein Servername konfiguriert */
/* No server name configured! */
Config_Error( LOG_ALERT, "No server name configured in \"%s\" ('ServerName')!", NGIRCd_ConfFile );
if( ! Configtest )
{
Config_Error( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE );
exit( 1 );
}
}
#ifdef STRICT_RFC
if( ! ConfAdminMail[0] )
if( ! Conf_ServerAdminMail[0] )
{
/* Keine Server-Information konfiguriert */
/* No administrative contact configured! */
Config_Error( LOG_ALERT, "No administrator email address configured in \"%s\" ('AdminEMail')!", NGIRCd_ConfFile );
if( ! Configtest )
{
Config_Error( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE );
exit( 1 );
}
}
#endif
if( ! Conf_ServerAdmin1[0] && ! Conf_ServerAdmin1[0] && ! Conf_ServerAdminMail[0] )
if( ! Conf_ServerAdmin1[0] && ! Conf_ServerAdmin2[0] && ! Conf_ServerAdminMail[0] )
{
/* Keine Server-Information konfiguriert */
Log( LOG_WARNING, "No server information configured but required by RFC!" );
/* No administrative information configured! */
Config_Error( LOG_WARNING, "No administrative information configured but required by RFC!" );
}
#ifdef FD_SETSIZE
if(( Conf_MaxConnections > (LONG)FD_SETSIZE ) || ( Conf_MaxConnections < 1 ))
{
Conf_MaxConnections = (LONG)FD_SETSIZE;
Config_Error( LOG_ERR, "Setting MaxConnections to %ld, select() can't handle more file descriptors!", Conf_MaxConnections );
}
#else
Config_Error( LOG_WARN, "Don't know how many file descriptors select() can handle on this system, don't set MaxConnections too high!" );
#endif
} /* Validate_Config */
@@ -565,14 +682,13 @@ CONST CHAR *Format;
va_dcl
#endif
{
/* Fehler! Auf Console und/oder ins Log schreiben */
/* Error! Write to console and/or logfile. */
CHAR msg[MAX_LOG_MSG_LEN];
va_list ap;
assert( Format != NULL );
/* String mit variablen Argumenten zusammenbauen ... */
#ifdef PROTOTYPES
va_start( ap, Format );
#else
@@ -581,10 +697,10 @@ va_dcl
vsnprintf( msg, MAX_LOG_MSG_LEN, Format, ap );
va_end( ap );
/* Im "normalen Betrieb" soll der Log-Mechanismus des ngIRCd verwendet
* werden, beim Testen der Konfiguration jedoch nicht, hier sollen alle
* Meldungen direkt auf die Konsole ausgegeben werden: */
if( Use_Log ) Log( Level, msg );
/* During "normal operations" the log functions of the daemon should
* be used, but during testing of the configuration file, all messages
* should go directly to the console: */
if( Use_Log ) Log( Level, "%s", msg );
else puts( msg );
} /* Config_Error */

View File

@@ -2,16 +2,15 @@
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
*
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* der GNU General Public License (GPL), wie von der Free Software Foundation
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: conf.h,v 1.19 2002/09/16 09:13:40 alex Exp $
* $Id: conf.h,v 1.24 2002/12/14 13:36:19 alex Exp $
*
* conf.h: Konfiguration des ngircd (Header)
* Configuration management (header)
*/
@@ -25,77 +24,85 @@
typedef struct _Conf_Oper
{
CHAR name[CLIENT_PASS_LEN]; /* Name (ID) des IRC-OPs */
CHAR pwd[CLIENT_PASS_LEN]; /* Passwort */
CHAR name[CLIENT_PASS_LEN]; /* Name (ID) of IRC operator */
CHAR pwd[CLIENT_PASS_LEN]; /* Password */
} CONF_OPER;
typedef struct _Conf_Server
{
CHAR host[HOST_LEN]; /* Hostname */
CHAR ip[16]; /* IP-Adresse (von Resolver) */
CHAR ip[16]; /* IP address (Resolver) */
CHAR name[CLIENT_ID_LEN]; /* IRC-Client-ID */
CHAR pwd[CLIENT_PASS_LEN]; /* Passwort */
INT port; /* Server-Port */
INT group; /* Gruppe des Servers */
time_t lasttry; /* Letzter Connect-Versuch */
RES_STAT *res_stat; /* Status des Resolver */
CHAR pwd_in[CLIENT_PASS_LEN]; /* Password which must be received */
CHAR pwd_out[CLIENT_PASS_LEN]; /* Password to send to peer */
INT port; /* Server port */
INT group; /* Group of server */
time_t lasttry; /* Last connect attempt */
RES_STAT *res_stat; /* Status of the resolver */
} CONF_SERVER;
typedef struct _Conf_Channel
{
CHAR name[CHANNEL_NAME_LEN]; /* Name des Channel */
CHAR modes[CHANNEL_MODE_LEN]; /* Channel-Modes */
CHAR topic[CHANNEL_TOPIC_LEN]; /* Topic des Channels */
CHAR name[CHANNEL_NAME_LEN]; /* Name of the channel */
CHAR modes[CHANNEL_MODE_LEN]; /* Initial channel modes */
CHAR topic[CHANNEL_TOPIC_LEN]; /* Initial topic */
} CONF_CHANNEL;
/* Name ("Nick") des Servers */
/* Name ("Nick") of the servers */
GLOBAL CHAR Conf_ServerName[CLIENT_ID_LEN];
/* Server-Info-Text */
/* Server info text */
GLOBAL CHAR Conf_ServerInfo[CLIENT_INFO_LEN];
/* Server-Passwort */
/* Global server passwort */
GLOBAL CHAR Conf_ServerPwd[CLIENT_PASS_LEN];
/* Admin-Info-Texte */
/* Administrative information */
GLOBAL CHAR Conf_ServerAdmin1[CLIENT_INFO_LEN];
GLOBAL CHAR Conf_ServerAdmin2[CLIENT_INFO_LEN];
GLOBAL CHAR Conf_ServerAdminMail[CLIENT_INFO_LEN];
/* Datei mit MOTD-Text */
/* File with MOTD text */
GLOBAL CHAR Conf_MotdFile[FNAME_LEN];
/* Ports, auf denen der Server Verbindungen entgegen nimmt */
/* Ports the server should listen on */
GLOBAL UINT Conf_ListenPorts[MAX_LISTEN_PORTS];
GLOBAL INT Conf_ListenPorts_Count;
/* User- und Group-ID, zu denen der Daemon wechseln soll */
/* User and group ID the server should run with */
GLOBAL UINT Conf_UID;
GLOBAL UINT Conf_GID;
/* Timeouts fuer PING und PONG */
/* Timeouts for PING and PONG */
GLOBAL INT Conf_PingTimeout;
GLOBAL INT Conf_PongTimeout;
/* Sekunden zwischen Verbindungsversuchen zu anderen Servern */
/* Seconds between connect attempts to other servers */
GLOBAL INT Conf_ConnectRetry;
/* Operatoren */
/* Operators */
GLOBAL CONF_OPER Conf_Oper[MAX_OPERATORS];
GLOBAL INT Conf_Oper_Count;
/* Server */
/* Servers */
GLOBAL CONF_SERVER Conf_Server[MAX_SERVERS];
GLOBAL INT Conf_Server_Count;
/* Vorkonfigurierte Channels */
/* Pre-defined channels */
GLOBAL CONF_CHANNEL Conf_Channel[MAX_DEFCHANNELS];
GLOBAL INT Conf_Channel_Count;
/* Koennen IRC OPs immer Modes setzen? */
/* Are IRC operators allowed to always use MODE? */
GLOBAL BOOLEAN Conf_OperCanMode;
/* Maximum number of connections to this server */
GLOBAL LONG Conf_MaxConnections;
/* Maximum number of channels a user can join */
GLOBAL INT Conf_MaxJoins;
GLOBAL VOID Conf_Init PARAMS((VOID ));
GLOBAL INT Conf_Test PARAMS((VOID ));

File diff suppressed because it is too large Load Diff

View File

@@ -2,16 +2,15 @@
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
*
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* der GNU General Public License (GPL), wie von der Free Software Foundation
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: conn.h,v 1.17 2002/08/26 00:03:15 alex Exp $
* $Id: conn.h,v 1.26.2.1 2003/03/09 20:16:46 alex Exp $
*
* conn.h: Verwaltung aller Netz-Verbindungen ("connections") (Header)
* Connection management (header)
*/
@@ -19,7 +18,14 @@
#define __conn_h__
#include <time.h>
#include <time.h> /* fro time_t, see below */
#define CONN_ISCLOSING 1 /* Conn_Close() already called */
#ifdef USE_ZLIB
#define CONN_ZIP 2 /* zlib compressed link */
#endif
typedef INT CONN_ID;
@@ -28,6 +34,9 @@ typedef INT CONN_ID;
GLOBAL VOID Conn_Init PARAMS((VOID ));
GLOBAL VOID Conn_Exit PARAMS(( VOID ));
GLOBAL INT Conn_InitListeners PARAMS(( VOID ));
GLOBAL VOID Conn_ExitListeners PARAMS(( VOID ));
GLOBAL BOOLEAN Conn_NewListener PARAMS(( CONST UINT Port ));
GLOBAL VOID Conn_Handler PARAMS(( VOID ));
@@ -40,8 +49,38 @@ GLOBAL VOID Conn_Close PARAMS(( CONN_ID Idx, CHAR *LogMsg, CHAR *FwdMsg, BOOLEAN
GLOBAL VOID Conn_UpdateIdle PARAMS(( CONN_ID Idx ));
GLOBAL time_t Conn_GetIdle PARAMS(( CONN_ID Idx ));
GLOBAL time_t Conn_LastPing PARAMS(( CONN_ID Idx ));
GLOBAL time_t Conn_StartTime PARAMS(( CONN_ID Idx ));
GLOBAL INT Conn_SendQ PARAMS(( CONN_ID Idx ));
GLOBAL INT Conn_RecvQ PARAMS(( CONN_ID Idx ));
GLOBAL LONG Conn_SendMsg PARAMS(( CONN_ID Idx ));
GLOBAL LONG Conn_RecvMsg PARAMS(( CONN_ID Idx ));
GLOBAL LONG Conn_SendBytes PARAMS(( CONN_ID Idx ));
GLOBAL LONG Conn_RecvBytes PARAMS(( CONN_ID Idx ));
GLOBAL VOID Conn_SetPenalty PARAMS(( CONN_ID Idx, time_t Seconds ));
GLOBAL VOID Conn_ResetPenalty PARAMS(( CONN_ID Idx ));
GLOBAL VOID Conn_ClearFlags PARAMS(( VOID ));
GLOBAL INT Conn_Flag PARAMS(( CONN_ID Idx ));
GLOBAL VOID Conn_SetFlag PARAMS(( CONN_ID Idx, INT Flag ));
GLOBAL VOID Conn_SetServer PARAMS(( CONN_ID Idx, INT ConfServer ));
GLOBAL CONN_ID Conn_First PARAMS(( VOID ));
GLOBAL CONN_ID Conn_Next PARAMS(( CONN_ID Idx ));
GLOBAL VOID Conn_SetOption PARAMS(( CONN_ID Idx, INT Option ));
GLOBAL VOID Conn_UnsetOption PARAMS(( CONN_ID Idx, INT Option ));
GLOBAL INT Conn_Options PARAMS(( CONN_ID Idx ));
#ifdef USE_ZLIB
GLOBAL BOOLEAN Conn_InitZip PARAMS(( CONN_ID Idx ));
GLOBAL LONG Conn_SendBytesZip PARAMS(( CONN_ID Idx ));
GLOBAL LONG Conn_RecvBytesZip PARAMS(( CONN_ID Idx ));
#endif
GLOBAL VOID Conn_ResetWCounter PARAMS(( VOID ));
GLOBAL LONG Conn_WCounter PARAMS(( VOID ));
GLOBAL INT Conn_MaxFD;

View File

@@ -2,16 +2,15 @@
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
*
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* der GNU General Public License (GPL), wie von der Free Software Foundation
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: defines.h,v 1.33 2002/09/07 17:58:00 alex Exp $
* $Id: defines.h,v 1.40 2002/12/16 23:10:56 alex Exp $
*
* defines.h: (globale) Konstanten
* Global defines of ngIRCd.
*/
#ifndef __defines_h__
@@ -20,6 +19,8 @@
#define NONE -1
#define TIME_RES 2 /* Zeit-Aufloesung des Servers in Sekunden */
#define FNAME_LEN 256 /* max. Laenge eines Dateinamen */
#define LINE_LEN 256 /* max. Laenge einer Konfigurationszeile */
@@ -34,7 +35,9 @@
#define MAX_DEFCHANNELS 16 /* max. Anzahl vorkonfigurierbarerr Channels */
#define MAX_CONNECTIONS 100 /* max. Anzahl von Verbindungen an diesem Server */
#define MAX_SERVICES 8 /* maximum number of configurable services */
#define CONNECTION_POOL 100 /* Anzahl Verbindungs-Strukturen, die blockweise alloziert werden */
#define CLIENT_ID_LEN 64 /* max. ID-Laenge; vgl. RFC 2812, 1.1 und 1.2.1 */
#define CLIENT_NICK_LEN 10 /* max. Nick-Laenge; vgl. RFC 2812, 1.2.1 */
@@ -53,9 +56,14 @@
#define COMMAND_LEN 513 /* max. Laenge eines Befehls, vgl. RFC 2812, 3.2 */
#define READBUFFER_LEN 2 * COMMAND_LEN /* Laenge des Lesepuffers je Verbindung (Bytes) */
#define READBUFFER_LEN 2048 /* Laenge des Lesepuffers je Verbindung (Bytes) */
#define WRITEBUFFER_LEN 4096 /* Laenge des Schreibpuffers je Verbindung (Bytes) */
#ifdef USE_ZLIB
#define ZREADBUFFER_LEN 1024 /* Laenge des Lesepuffers je Verbindung (Bytes) */
#define ZWRITEBUFFER_LEN 4096 /* Laenge des Schreibpuffers fuer Kompression (Bytes) */
#endif
#define PROTOVER "0210" /* implementierte Protokoll-Version (RFC 2813, 4.1.1) */
#define PROTOIRC "-IRC" /* Protokoll-Suffix (RFC 2813, 4.1.1) */
#define PROTOIRCPLUS "-IRC+" /* Protokoll-Suffix f<>r IRC+-Protokoll */
@@ -68,7 +76,7 @@
#define RECONNECT_DELAY 3 /* Server-Links erst nach 3 Sekunden versuchen, wieder aufzubauen */
#define USERMODES "aios" /* unterstuetzte User-Modes */
#define CHANMODES "biImnoPtv" /* unterstuetzte Channel-Modes */
#define CHANMODES "biklImnoPtv" /* unterstuetzte Channel-Modes */
#define CONNECTED TRUE /* fuer die irc-xxx-Module */
#define DISCONNECTED FALSE
@@ -88,6 +96,8 @@
#define TOKEN_OUTBOUND -2 /* Kennzeichnung fuer ausgehende Server-Links im Aufbau */
#define NOTICE_TXTPREFIX "" /* Kennzeichnung fuer Server-NOTICEs an User */
#endif

View File

@@ -2,21 +2,20 @@
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
*
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* der GNU General Public License (GPL), wie von der Free Software Foundation
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: hash.c,v 1.5 2002/05/27 12:54:07 alex Exp $
*
* hash.c: Hash-Werte berechnen
* Hash calculation
*/
#include "portab.h"
static char UNUSED id[] = "$Id: hash.c,v 1.6 2002/12/12 12:24:18 alex Exp $";
#include "imp.h"
#include <assert.h>
#include <string.h>

View File

@@ -2,16 +2,15 @@
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
*
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* der GNU General Public License (GPL), wie von der Free Software Foundation
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: hash.h,v 1.3 2002/05/27 12:54:07 alex Exp $
* $Id: hash.h,v 1.4 2002/12/12 12:23:43 alex Exp $
*
* hash.h: Hash-Werte berechnen (Header)
* Hash calculation (header)
*/

View File

@@ -2,21 +2,20 @@
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
*
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* der GNU General Public License (GPL), wie von der Free Software Foundation
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: irc-channel.c,v 1.15 2002/09/16 09:16:17 alex Exp $
*
* irc-channel.c: IRC-Channel-Befehle
* IRC channel commands
*/
#include "portab.h"
static char UNUSED id[] = "$Id: irc-channel.c,v 1.21.2.5 2003/01/08 23:09:34 alex Exp $";
#include "imp.h"
#include <assert.h>
#include <string.h>
@@ -30,8 +29,10 @@
#include "match.h"
#include "messages.h"
#include "parse.h"
#include "irc.h"
#include "irc-info.h"
#include "irc-write.h"
#include "resolve.h"
#include "conf.h"
#include "exp.h"
#include "irc-channel.h"
@@ -40,7 +41,7 @@
GLOBAL BOOLEAN
IRC_JOIN( CLIENT *Client, REQUEST *Req )
{
CHAR *channame, *flags, *topic, modes[8];
CHAR *channame, *key, *flags, *topic, modes[8];
BOOLEAN is_new_chan, is_invited, is_banned;
CLIENT *target;
CHANNEL *chan;
@@ -48,16 +49,18 @@ IRC_JOIN( CLIENT *Client, REQUEST *Req )
assert( Client != NULL );
assert( Req != NULL );
if(( Client_Type( Client ) != CLIENT_USER ) && ( Client_Type( Client ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
/* Bad number of arguments? */
if(( Req->argc > 2 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
/* Falsche Anzahl Parameter? */
if(( Req->argc > 1 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
/* Wer ist der Absender? */
/* Who is the sender? */
if( Client_Type( Client ) == CLIENT_SERVER ) target = Client_Search( Req->prefix );
else target = Client;
if( ! target ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
/* Are channel keys given? */
if( Req->argc > 1 ) key = Req->argv[1];
else key = NULL;
/* Channel-Namen durchgehen */
chan = NULL;
channame = strtok( Req->argv[0], "," );
@@ -84,6 +87,16 @@ IRC_JOIN( CLIENT *Client, REQUEST *Req )
/* Lokaler Client? */
if( Client_Type( Client ) == CLIENT_USER )
{
/* Test if the user has reached his maximum channel count */
if( Client_Type( Client ) == CLIENT_USER )
{
if(( Conf_MaxJoins > 0 ) && ( Channel_CountForUser( Client ) >= Conf_MaxJoins ))
{
IRC_WriteStrClient( Client, ERR_TOOMANYCHANNELS_MSG, Client_ID( Client ), channame );
return CONNECTED;
}
}
/* Existiert der Channel bereits, oder wird er im Moment neu erzeugt? */
if( is_new_chan )
{
@@ -105,18 +118,40 @@ IRC_JOIN( CLIENT *Client, REQUEST *Req )
/* Client ist gebanned (und nicht invited): */
IRC_WriteStrClient( Client, ERR_BANNEDFROMCHAN_MSG, Client_ID( Client ), channame );
/* naechsten Namen ermitteln */
/* Try next name, if any */
channame = strtok( NULL, "," );
continue;
}
/* Ist der Channel "invite-only"? */
if(( strchr( Channel_Modes( chan ), 'i' ) != NULL ) && ( is_invited == FALSE ))
if(( strchr( Channel_Modes( chan ), 'i' )) && ( is_invited == FALSE ))
{
/* Channel ist "invite-only" und Client wurde nicht invited: */
IRC_WriteStrClient( Client, ERR_INVITEONLYCHAN_MSG, Client_ID( Client ), channame );
/* naechsten Namen ermitteln */
/* Try next name, if any */
channame = strtok( NULL, "," );
continue;
}
/* Is the channel protected by a key? */
if(( strchr( Channel_Modes( chan ), 'k' )) && ( strcmp( Channel_Key( chan ), key ? key : "" ) != 0 ))
{
/* Bad channel key! */
IRC_WriteStrClient( Client, ERR_BADCHANNELKEY_MSG, Client_ID( Client ), channame );
/* Try next name, if any */
channame = strtok( NULL, "," );
continue;
}
/* Are there already too many members? */
if(( strchr( Channel_Modes( chan ), 'l' )) && ( Channel_MaxUsers( chan ) <= Channel_MemberCount( chan )))
{
/* Bad channel key! */
IRC_WriteStrClient( Client, ERR_CHANNELISFULL_MSG, Client_ID( Client ), channame );
/* Try next name, if any */
channame = strtok( NULL, "," );
continue;
}
@@ -189,8 +224,6 @@ IRC_PART( CLIENT *Client, REQUEST *Req )
assert( Client != NULL );
assert( Req != NULL );
if(( Client_Type( Client ) != CLIENT_USER ) && ( Client_Type( Client ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
/* Falsche Anzahl Parameter? */
if(( Req->argc > 2 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
@@ -227,8 +260,6 @@ IRC_TOPIC( CLIENT *Client, REQUEST *Req )
assert( Client != NULL );
assert( Req != NULL );
if(( Client_Type( Client ) != CLIENT_USER ) && ( Client_Type( Client ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
/* Falsche Anzahl Parameter? */
if(( Req->argc < 1 ) || ( Req->argc > 2 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
@@ -280,8 +311,6 @@ IRC_LIST( CLIENT *Client, REQUEST *Req )
assert( Client != NULL );
assert( Req != NULL );
if(( Client_Type( Client ) != CLIENT_USER ) && ( Client_Type( Client ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
/* Falsche Anzahl Parameter? */
if( Req->argc > 2 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
@@ -297,7 +326,7 @@ IRC_LIST( CLIENT *Client, REQUEST *Req )
{
/* an anderen Server forwarden */
target = Client_Search( Req->argv[1] );
if( ! target ) return IRC_WriteStrClient( from, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[1] );
if(( ! target ) || ( Client_Type( target ) != CLIENT_SERVER )) return IRC_WriteStrClient( from, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[1] );
if( target != Client_ThisServer( ))
{
@@ -336,20 +365,24 @@ IRC_CHANINFO( CLIENT *Client, REQUEST *Req )
CLIENT *from;
CHANNEL *chan;
CHAR *ptr;
INT arg_topic;
assert( Client != NULL );
assert( Req != NULL );
if( Client_Type( Client ) != CLIENT_SERVER ) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
/* Bad number of parameters? */
if(( Req->argc < 2 ) || ( Req->argc == 4 ) || ( Req->argc > 5 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
/* Falsche Anzahl Parameter? */
if(( Req->argc < 1 ) || ( Req->argc > 3 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
/* Compatibility kludge */
if( Req->argc == 5 ) arg_topic = 4;
else if( Req->argc == 3 ) arg_topic = 2;
else arg_topic = -1;
/* From-Server suchen */
/* Search origin */
from = Client_Search( Req->prefix );
if( ! from ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
/* Channel suchen bzw. erzeugen */
/* Search or create channel */
chan = Channel_Search( Req->argv[0] );
if( ! chan ) chan = Channel_Create( Req->argv[0] );
if( ! chan ) return CONNECTED;
@@ -359,27 +392,36 @@ IRC_CHANINFO( CLIENT *Client, REQUEST *Req )
ptr = Channel_Modes( chan );
if( ! *ptr )
{
/* OK, es sind noch keine Modes gesetzt */
/* OK, this channel doesn't have modes jet, set the received ones: */
Channel_SetModes( chan, &Req->argv[1][1] );
IRC_WriteStrChannelPrefix( Client, chan, from, FALSE, "MODE %s +%s", Req->argv[0], &Req->argv[1][1] );
/* Delete modes which we never want to inherit */
Channel_ModeDel( chan, 'l' );
Channel_ModeDel( chan, 'k' );
/* Inform members of this channel */
IRC_WriteStrChannelPrefix( Client, chan, from, FALSE, "MODE %s +%s", Req->argv[0], Channel_Modes( chan ));
}
}
else Log( LOG_WARNING, "CHANNELINFO: invalid MODE format ignored!" );
if( Req->argc == 3 )
if( arg_topic > 0 )
{
/* Es wurde auch ein Topic mit uebermittelt */
/* We got a topic */
ptr = Channel_Topic( chan );
if( ! *ptr )
if(( ! *ptr ) && ( Req->argv[arg_topic][0] ))
{
/* OK, es ist bisher kein Topic gesetzt */
Channel_SetTopic( chan, Req->argv[2] );
IRC_WriteStrChannelPrefix( Client, chan, from, FALSE, "TOPIC %s :%s", Req->argv[0], Req->argv[2] );
/* OK, there is no topic jet */
Channel_SetTopic( chan, Req->argv[arg_topic] );
IRC_WriteStrChannelPrefix( Client, chan, from, FALSE, "TOPIC %s :%s", Req->argv[0], Channel_Topic( chan ));
}
}
/* an andere Server forwarden */
IRC_WriteStrServersPrefixFlag( Client, from, 'C', "CHANINFO %s %s :%s", Req->argv[0], Req->argv[1], Req->argv[2] );
/* Forward CHANINFO to other serevrs */
if( Req->argc == 5 ) IRC_WriteStrServersPrefixFlag( Client, from, 'C', "CHANINFO %s %s %s %s :%s", Req->argv[0], Req->argv[1], Req->argv[2], Req->argv[3], Req->argv[4] );
else if( Req->argc == 3 ) IRC_WriteStrServersPrefixFlag( Client, from, 'C', "CHANINFO %s %s :%s", Req->argv[0], Req->argv[1], Req->argv[2] );
else IRC_WriteStrServersPrefixFlag( Client, from, 'C', "CHANINFO %s %s", Req->argv[0], Req->argv[1] );
return CONNECTED;
} /* IRC_CHANINFO */

View File

@@ -2,16 +2,15 @@
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
*
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* der GNU General Public License (GPL), wie von der Free Software Foundation
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: irc-channel.h,v 1.5 2002/09/03 23:56:55 alex Exp $
* $Id: irc-channel.h,v 1.6 2002/12/12 12:23:43 alex Exp $
*
* irc-channel.h: IRC-Channel-Befehle (Header)
* IRC channel commands (header)
*/

879
src/ngircd/irc-info.c Normal file
View File

@@ -0,0 +1,879 @@
/*
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* IRC info commands
*/
#include "portab.h"
static char UNUSED id[] = "$Id: irc-info.c,v 1.8.2.2 2003/01/01 13:46:37 alex Exp $";
#include "imp.h"
#include <assert.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include "ngircd.h"
#include "conn.h"
#include "client.h"
#include "channel.h"
#include "resolve.h"
#include "conf.h"
#include "defines.h"
#include "log.h"
#include "messages.h"
#include "tool.h"
#include "parse.h"
#include "irc-write.h"
#include "exp.h"
#include "irc-info.h"
GLOBAL BOOLEAN
IRC_ADMIN(CLIENT *Client, REQUEST *Req )
{
CLIENT *target, *prefix;
assert( Client != NULL );
assert( Req != NULL );
/* Falsche Anzahl Parameter? */
if(( Req->argc > 1 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
/* Ziel suchen */
if( Req->argc == 1 ) target = Client_Search( Req->argv[0] );
else target = Client_ThisServer( );
/* Prefix ermitteln */
if( Client_Type( Client ) == CLIENT_SERVER ) prefix = Client_Search( Req->prefix );
else prefix = Client;
if( ! prefix ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
/* An anderen Server weiterleiten? */
if( target != Client_ThisServer( ))
{
if(( ! target ) || ( Client_Type( target ) != CLIENT_SERVER )) return IRC_WriteStrClient( prefix, ERR_NOSUCHSERVER_MSG, Client_ID( prefix ), Req->argv[0] );
/* forwarden */
IRC_WriteStrClientPrefix( target, prefix, "ADMIN %s", Req->argv[0] );
return CONNECTED;
}
/* mit Versionsinfo antworten */
if( ! IRC_WriteStrClient( Client, RPL_ADMINME_MSG, Client_ID( prefix ), Conf_ServerName )) return DISCONNECTED;
if( ! IRC_WriteStrClient( Client, RPL_ADMINLOC1_MSG, Client_ID( prefix ), Conf_ServerAdmin1 )) return DISCONNECTED;
if( ! IRC_WriteStrClient( Client, RPL_ADMINLOC2_MSG, Client_ID( prefix ), Conf_ServerAdmin2 )) return DISCONNECTED;
if( ! IRC_WriteStrClient( Client, RPL_ADMINEMAIL_MSG, Client_ID( prefix ), Conf_ServerAdminMail )) return DISCONNECTED;
return CONNECTED;
} /* IRC_ADMIN */
GLOBAL BOOLEAN
IRC_ISON( CLIENT *Client, REQUEST *Req )
{
CHAR rpl[COMMAND_LEN];
CLIENT *c;
CHAR *ptr;
INT i;
assert( Client != NULL );
assert( Req != NULL );
/* Falsche Anzahl Parameter? */
if(( Req->argc < 1 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
strcpy( rpl, RPL_ISON_MSG );
for( i = 0; i < Req->argc; i++ )
{
ptr = strtok( Req->argv[i], " " );
while( ptr )
{
ngt_TrimStr( ptr );
c = Client_Search( ptr );
if( c && ( Client_Type( c ) == CLIENT_USER ))
{
/* Dieser Nick ist "online" */
strcat( rpl, ptr );
strcat( rpl, " " );
}
ptr = strtok( NULL, " " );
}
}
if( rpl[strlen( rpl ) - 1] == ' ' ) rpl[strlen( rpl ) - 1] = '\0';
return IRC_WriteStrClient( Client, rpl, Client_ID( Client ) );
} /* IRC_ISON */
GLOBAL BOOLEAN
IRC_LINKS( CLIENT *Client, REQUEST *Req )
{
CLIENT *target, *from, *c;
CHAR *mask;
assert( Client != NULL );
assert( Req != NULL );
/* Falsche Anzahl Parameter? */
if(( Req->argc > 2 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
/* Server-Mask ermitteln */
if( Req->argc > 0 ) mask = Req->argv[Req->argc - 1];
else mask = "*";
/* Absender ermitteln */
if( Client_Type( Client ) == CLIENT_SERVER ) from = Client_Search( Req->prefix );
else from = Client;
if( ! from ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
/* An anderen Server forwarden? */
if( Req->argc == 2 )
{
target = Client_Search( Req->argv[0] );
if(( ! target ) || ( Client_Type( target ) != CLIENT_SERVER )) return IRC_WriteStrClient( from, ERR_NOSUCHSERVER_MSG, Client_ID( from ), Req->argv[0] );
else if( target != Client_ThisServer( )) return IRC_WriteStrClientPrefix( target, from, "LINKS %s %s", Req->argv[0], Req->argv[1] );
}
/* Wer ist der Absender? */
if( Client_Type( Client ) == CLIENT_SERVER ) target = Client_Search( Req->prefix );
else target = Client;
if( ! target ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
c = Client_First( );
while( c )
{
if( Client_Type( c ) == CLIENT_SERVER )
{
if( ! IRC_WriteStrClient( target, RPL_LINKS_MSG, Client_ID( target ), Client_ID( c ), Client_ID( Client_TopServer( c ) ? Client_TopServer( c ) : Client_ThisServer( )), Client_Hops( c ), Client_Info( c ))) return DISCONNECTED;
}
c = Client_Next( c );
}
return IRC_WriteStrClient( target, RPL_ENDOFLINKS_MSG, Client_ID( target ), mask );
} /* IRC_LINKS */
GLOBAL BOOLEAN
IRC_LUSERS( CLIENT *Client, REQUEST *Req )
{
CLIENT *target, *from;
assert( Client != NULL );
assert( Req != NULL );
/* Falsche Anzahl Parameter? */
if(( Req->argc > 2 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
/* Absender ermitteln */
if( Client_Type( Client ) == CLIENT_SERVER ) from = Client_Search( Req->prefix );
else from = Client;
if( ! from ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
/* An anderen Server forwarden? */
if( Req->argc == 2 )
{
target = Client_Search( Req->argv[1] );
if(( ! target ) || ( Client_Type( target ) != CLIENT_SERVER )) return IRC_WriteStrClient( from, ERR_NOSUCHSERVER_MSG, Client_ID( from ), Req->argv[1] );
else if( target != Client_ThisServer( )) return IRC_WriteStrClientPrefix( target, from, "LUSERS %s %s", Req->argv[0], Req->argv[1] );
}
/* Wer ist der Absender? */
if( Client_Type( Client ) == CLIENT_SERVER ) target = Client_Search( Req->prefix );
else target = Client;
if( ! target ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
IRC_Send_LUSERS( target );
return CONNECTED;
} /* IRC_LUSERS */
GLOBAL BOOLEAN
IRC_MOTD( CLIENT *Client, REQUEST *Req )
{
CLIENT *from, *target;
assert( Client != NULL );
assert( Req != NULL );
/* Falsche Anzahl Parameter? */
if( Req->argc > 1 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
/* From aus Prefix ermitteln */
if( Client_Type( Client ) == CLIENT_SERVER ) from = Client_Search( Req->prefix );
else from = Client;
if( ! from ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
if( Req->argc == 1 )
{
/* an anderen Server forwarden */
target = Client_Search( Req->argv[0] );
if(( ! target ) || ( Client_Type( target ) != CLIENT_SERVER )) return IRC_WriteStrClient( from, ERR_NOSUCHSERVER_MSG, Client_ID( from ), Req->argv[0] );
if( target != Client_ThisServer( ))
{
/* Ok, anderer Server ist das Ziel: forwarden */
return IRC_WriteStrClientPrefix( target, from, "MOTD %s", Req->argv[0] );
}
}
return IRC_Show_MOTD( from );
} /* IRC_MOTD */
GLOBAL BOOLEAN
IRC_NAMES( CLIENT *Client, REQUEST *Req )
{
CHAR rpl[COMMAND_LEN], *ptr;
CLIENT *target, *from, *c;
CHANNEL *chan;
assert( Client != NULL );
assert( Req != NULL );
/* Falsche Anzahl Parameter? */
if( Req->argc > 2 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
/* From aus Prefix ermitteln */
if( Client_Type( Client ) == CLIENT_SERVER ) from = Client_Search( Req->prefix );
else from = Client;
if( ! from ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
if( Req->argc == 2 )
{
/* an anderen Server forwarden */
target = Client_Search( Req->argv[1] );
if(( ! target ) || ( Client_Type( target ) != CLIENT_SERVER )) return IRC_WriteStrClient( from, ERR_NOSUCHSERVER_MSG, Client_ID( from ), Req->argv[1] );
if( target != Client_ThisServer( ))
{
/* Ok, anderer Server ist das Ziel: forwarden */
return IRC_WriteStrClientPrefix( target, from, "NAMES %s :%s", Req->argv[0], Req->argv[1] );
}
}
if( Req->argc > 0 )
{
/* bestimmte Channels durchgehen */
ptr = strtok( Req->argv[0], "," );
while( ptr )
{
chan = Channel_Search( ptr );
if( chan )
{
/* Namen ausgeben */
if( ! IRC_Send_NAMES( from, chan )) return DISCONNECTED;
}
if( ! IRC_WriteStrClient( from, RPL_ENDOFNAMES_MSG, Client_ID( from ), ptr )) return DISCONNECTED;
/* naechsten Namen ermitteln */
ptr = strtok( NULL, "," );
}
return CONNECTED;
}
/* alle Channels durchgehen */
chan = Channel_First( );
while( chan )
{
/* Namen ausgeben */
if( ! IRC_Send_NAMES( from, chan )) return DISCONNECTED;
/* naechster Channel */
chan = Channel_Next( chan );
}
/* Nun noch alle Clients ausgeben, die in keinem Channel sind */
c = Client_First( );
sprintf( rpl, RPL_NAMREPLY_MSG, Client_ID( from ), "*", "*" );
while( c )
{
if(( Client_Type( c ) == CLIENT_USER ) && ( Channel_FirstChannelOf( c ) == NULL ) && ( ! strchr( Client_Modes( c ), 'i' )))
{
/* Okay, das ist ein User: anhaengen */
if( rpl[strlen( rpl ) - 1] != ':' ) strcat( rpl, " " );
strcat( rpl, Client_ID( c ));
if( strlen( rpl ) > ( LINE_LEN - CLIENT_NICK_LEN - 4 ))
{
/* Zeile wird zu lang: senden! */
if( ! IRC_WriteStrClient( from, "%s", rpl )) return DISCONNECTED;
sprintf( rpl, RPL_NAMREPLY_MSG, Client_ID( from ), "*", "*" );
}
}
/* naechster Client */
c = Client_Next( c );
}
if( rpl[strlen( rpl ) - 1] != ':')
{
/* es wurden User gefunden */
if( ! IRC_WriteStrClient( from, "%s", rpl )) return DISCONNECTED;
}
return IRC_WriteStrClient( from, RPL_ENDOFNAMES_MSG, Client_ID( from ), "*" );
} /* IRC_NAMES */
GLOBAL BOOLEAN
IRC_STATS( CLIENT *Client, REQUEST *Req )
{
CLIENT *from, *target, *cl;
CONN_ID con;
CHAR query;
COMMAND *cmd;
assert( Client != NULL );
assert( Req != NULL );
/* Falsche Anzahl Parameter? */
if( Req->argc > 2 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
/* From aus Prefix ermitteln */
if( Client_Type( Client ) == CLIENT_SERVER ) from = Client_Search( Req->prefix );
else from = Client;
if( ! from ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
if( Req->argc == 2 )
{
/* an anderen Server forwarden */
target = Client_Search( Req->argv[1] );
if(( ! target ) || ( Client_Type( target ) != CLIENT_SERVER )) return IRC_WriteStrClient( from, ERR_NOSUCHSERVER_MSG, Client_ID( from ), Req->argv[1] );
if( target != Client_ThisServer( ))
{
/* Ok, anderer Server ist das Ziel: forwarden */
return IRC_WriteStrClientPrefix( target, from, "STATS %s %s", Req->argv[0], Req->argv[1] );
}
}
if( Req->argc > 0 ) query = Req->argv[0][0] ? Req->argv[0][0] : '*';
else query = '*';
switch ( query )
{
case 'l': /* Links */
case 'L':
con = Conn_First( );
while( con != NONE )
{
cl = Client_GetFromConn( con );
if( cl && (( Client_Type( cl ) == CLIENT_SERVER ) || ( cl == Client )))
{
/* Server link or our own connection */
#ifdef USE_ZLIB
if( Conn_Options( con ) & CONN_ZIP )
{
if( ! IRC_WriteStrClient( from, RPL_STATSLINKINFOZIP_MSG, Client_ID( from ), Client_Mask( cl ), Conn_SendQ( con ), Conn_SendMsg( con ), Conn_SendBytesZip( con ), Conn_SendBytes( con ), Conn_RecvMsg( con ), Conn_RecvBytesZip( con ), Conn_RecvBytes( con ), (LONG)( time( NULL ) - Conn_StartTime( con )))) return DISCONNECTED;
}
else
#endif
{
if( ! IRC_WriteStrClient( from, RPL_STATSLINKINFO_MSG, Client_ID( from ), Client_Mask( cl ), Conn_SendQ( con ), Conn_SendMsg( con ), Conn_SendBytes( con ), Conn_RecvMsg( con ), Conn_RecvBytes( con ), (LONG)( time( NULL ) - Conn_StartTime( con )))) return DISCONNECTED;
}
}
con = Conn_Next( con );
}
break;
case 'm': /* IRC-Befehle */
case 'M':
cmd = Parse_GetCommandStruct( );
while( cmd->name )
{
if( cmd->lcount > 0 || cmd->rcount > 0 )
{
if( ! IRC_WriteStrClient( from, RPL_STATSCOMMANDS_MSG, Client_ID( from ), cmd->name, cmd->lcount, cmd->bytes, cmd->rcount )) return DISCONNECTED;
}
cmd++;
}
break;
}
return IRC_WriteStrClient( from, RPL_ENDOFSTATS_MSG, Client_ID( from ), query );
} /* IRC_STATS */
GLOBAL BOOLEAN
IRC_TIME( CLIENT *Client, REQUEST *Req )
{
CLIENT *from, *target;
CHAR t_str[64];
time_t t;
assert( Client != NULL );
assert( Req != NULL );
/* Falsche Anzahl Parameter? */
if( Req->argc > 1 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
/* From aus Prefix ermitteln */
if( Client_Type( Client ) == CLIENT_SERVER ) from = Client_Search( Req->prefix );
else from = Client;
if( ! from ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
if( Req->argc == 1 )
{
/* an anderen Server forwarden */
target = Client_Search( Req->argv[0] );
if(( ! target ) || ( Client_Type( target ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[0] );
if( target != Client_ThisServer( ))
{
/* Ok, anderer Server ist das Ziel: forwarden */
return IRC_WriteStrClientPrefix( target, from, "TIME %s", Req->argv[0] );
}
}
t = time( NULL );
(VOID)strftime( t_str, 60, "%A %B %d %Y -- %H:%M %z", localtime( &t ));
return IRC_WriteStrClient( from, RPL_TIME_MSG, Client_ID( from ), Client_ID( Client_ThisServer( )), t_str );
} /* IRC_TIME */
GLOBAL BOOLEAN
IRC_USERHOST( CLIENT *Client, REQUEST *Req )
{
CHAR rpl[COMMAND_LEN];
CLIENT *c;
INT max, i;
assert( Client != NULL );
assert( Req != NULL );
/* Falsche Anzahl Parameter? */
if(( Req->argc < 1 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
if( Req->argc > 5 ) max = 5;
else max = Req->argc;
strcpy( rpl, RPL_USERHOST_MSG );
for( i = 0; i < max; i++ )
{
c = Client_Search( Req->argv[i] );
if( c && ( Client_Type( c ) == CLIENT_USER ))
{
/* Dieser Nick ist "online" */
strcat( rpl, Client_ID( c ));
if( Client_HasMode( c, 'o' )) strcat( rpl, "*" );
strcat( rpl, "=" );
if( Client_HasMode( c, 'a' )) strcat( rpl, "-" );
else strcat( rpl, "+" );
strcat( rpl, Client_User( c ));
strcat( rpl, "@" );
strcat( rpl, Client_Hostname( c ));
strcat( rpl, " " );
}
}
if( rpl[strlen( rpl ) - 1] == ' ' ) rpl[strlen( rpl ) - 1] = '\0';
return IRC_WriteStrClient( Client, rpl, Client_ID( Client ) );
} /* IRC_USERHOST */
GLOBAL BOOLEAN
IRC_VERSION( CLIENT *Client, REQUEST *Req )
{
CLIENT *target, *prefix;
assert( Client != NULL );
assert( Req != NULL );
/* Falsche Anzahl Parameter? */
if(( Req->argc > 1 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
/* Ziel suchen */
if( Req->argc == 1 ) target = Client_Search( Req->argv[0] );
else target = Client_ThisServer( );
/* Prefix ermitteln */
if( Client_Type( Client ) == CLIENT_SERVER ) prefix = Client_Search( Req->prefix );
else prefix = Client;
if( ! prefix ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
/* An anderen Server weiterleiten? */
if( target != Client_ThisServer( ))
{
if(( ! target ) || ( Client_Type( target ) != CLIENT_SERVER )) return IRC_WriteStrClient( prefix, ERR_NOSUCHSERVER_MSG, Client_ID( prefix ), Req->argv[0] );
/* forwarden */
IRC_WriteStrClientPrefix( target, prefix, "VERSION %s", Req->argv[0] );
return CONNECTED;
}
/* mit Versionsinfo antworten */
return IRC_WriteStrClient( Client, RPL_VERSION_MSG, Client_ID( prefix ), PACKAGE, VERSION, NGIRCd_DebugLevel, Conf_ServerName, NGIRCd_VersionAddition( ));
} /* IRC_VERSION */
GLOBAL BOOLEAN
IRC_WHO( CLIENT *Client, REQUEST *Req )
{
BOOLEAN ok, only_ops;
CHAR flags[8], *ptr;
CL2CHAN *cl2chan;
CHANNEL *chan;
CLIENT *c;
assert( Client != NULL );
assert( Req != NULL );
/* Falsche Anzahl Parameter? */
if(( Req->argc > 2 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
only_ops = FALSE;
chan = NULL;
if( Req->argc == 2 )
{
/* Nur OPs anzeigen? */
if( strcmp( Req->argv[1], "o" ) == 0 ) only_ops = TRUE;
#ifdef STRICT_RFC
else return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
#endif
}
if( Req->argc >= 1 )
{
/* wurde ein Channel oder Nick-Mask angegeben? */
chan = Channel_Search( Req->argv[0] );
}
if( chan )
{
/* User eines Channels ausgeben */
if( ! IRC_Send_WHO( Client, chan, only_ops )) return DISCONNECTED;
}
c = Client_First( );
while( c )
{
if(( Client_Type( c ) == CLIENT_USER ) && ( ! strchr( Client_Modes( c ), 'i' )))
{
ok = FALSE;
if( Req->argc == 0 ) ok = TRUE;
else
{
if( strcasecmp( Req->argv[0], Client_ID( c )) == 0 ) ok = TRUE;
else if( strcmp( Req->argv[0], "0" ) == 0 ) ok = TRUE;
}
if( ok && (( ! only_ops ) || ( strchr( Client_Modes( c ), 'o' ))))
{
/* Flags zusammenbasteln */
strcpy( flags, "H" );
if( strchr( Client_Modes( c ), 'o' )) strcat( flags, "*" );
/* ausgeben */
cl2chan = Channel_FirstChannelOf( c );
if( cl2chan ) ptr = Channel_Name( Channel_GetChannel( cl2chan ));
else ptr = "*";
if( ! IRC_WriteStrClient( Client, RPL_WHOREPLY_MSG, Client_ID( Client ), ptr, Client_User( c ), Client_Hostname( c ), Client_ID( Client_Introducer( c )), Client_ID( c ), flags, Client_Hops( c ), Client_Info( c ))) return DISCONNECTED;
}
}
/* naechster Client */
c = Client_Next( c );
}
if( chan ) return IRC_WriteStrClient( Client, RPL_ENDOFWHO_MSG, Client_ID( Client ), Channel_Name( chan ));
else if( Req->argc == 0 ) return IRC_WriteStrClient( Client, RPL_ENDOFWHO_MSG, Client_ID( Client ), "*" );
else return IRC_WriteStrClient( Client, RPL_ENDOFWHO_MSG, Client_ID( Client ), Req->argv[0] );
} /* IRC_WHO */
GLOBAL BOOLEAN
IRC_WHOIS( CLIENT *Client, REQUEST *Req )
{
CLIENT *from, *target, *c;
CHAR str[LINE_LEN + 1];
CL2CHAN *cl2chan;
CHANNEL *chan;
assert( Client != NULL );
assert( Req != NULL );
/* Bad number of parameters? */
if(( Req->argc < 1 ) || ( Req->argc > 2 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
/* Search client */
c = Client_Search( Req->argv[Req->argc - 1] );
if(( ! c ) || ( Client_Type( c ) != CLIENT_USER )) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->argv[Req->argc - 1] );
/* Search sender of the WHOIS */
if( Client_Type( Client ) == CLIENT_SERVER ) from = Client_Search( Req->prefix );
else from = Client;
if( ! from ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
/* Forward to other server? */
if( Req->argc > 1 )
{
/* Search target server (can be specified as nick of that server!) */
target = Client_Search( Req->argv[0] );
if( ! target ) return IRC_WriteStrClient( from, ERR_NOSUCHSERVER_MSG, Client_ID( from ), Req->argv[0] );
}
else target = Client_ThisServer( );
assert( target != NULL );
if(( Client_NextHop( target ) != Client_ThisServer( )) && ( Client_Type( Client_NextHop( target )) == CLIENT_SERVER )) return IRC_WriteStrClientPrefix( target, from, "WHOIS %s :%s", Req->argv[0], Req->argv[1] );
/* Nick, user and name */
if( ! IRC_WriteStrClient( from, RPL_WHOISUSER_MSG, Client_ID( from ), Client_ID( c ), Client_User( c ), Client_Hostname( c ), Client_Info( c ))) return DISCONNECTED;
/* Server */
if( ! IRC_WriteStrClient( from, RPL_WHOISSERVER_MSG, Client_ID( from ), Client_ID( c ), Client_ID( Client_Introducer( c )), Client_Info( Client_Introducer( c )))) return DISCONNECTED;
/* Channels */
sprintf( str, RPL_WHOISCHANNELS_MSG, Client_ID( from ), Client_ID( c ));
cl2chan = Channel_FirstChannelOf( c );
while( cl2chan )
{
chan = Channel_GetChannel( cl2chan );
assert( chan != NULL );
/* Concatenate channel names */
if( str[strlen( str ) - 1] != ':' ) strcat( str, " " );
if( strchr( Channel_UserModes( chan, c ), 'o' )) strcat( str, "@" );
else if( strchr( Channel_UserModes( chan, c ), 'v' )) strcat( str, "+" );
strcat( str, Channel_Name( chan ));
if( strlen( str ) > ( LINE_LEN - CHANNEL_NAME_LEN - 4 ))
{
/* Line becomes too long: send it! */
if( ! IRC_WriteStrClient( Client, "%s", str )) return DISCONNECTED;
sprintf( str, RPL_WHOISCHANNELS_MSG, Client_ID( from ), Client_ID( c ));
}
/* next */
cl2chan = Channel_NextChannelOf( c, cl2chan );
}
if( str[strlen( str ) - 1] != ':')
{
/* There is data left to send: */
if( ! IRC_WriteStrClient( Client, "%s", str )) return DISCONNECTED;
}
/* IRC-Operator? */
if( Client_HasMode( c, 'o' ))
{
if( ! IRC_WriteStrClient( from, RPL_WHOISOPERATOR_MSG, Client_ID( from ), Client_ID( c ))) return DISCONNECTED;
}
/* Idle (only local clients) */
if( Client_Conn( c ) > NONE )
{
if( ! IRC_WriteStrClient( from, RPL_WHOISIDLE_MSG, Client_ID( from ), Client_ID( c ), Conn_GetIdle( Client_Conn ( c )))) return DISCONNECTED;
}
/* Away? */
if( Client_HasMode( c, 'a' ))
{
if( ! IRC_WriteStrClient( from, RPL_AWAY_MSG, Client_ID( from ), Client_ID( c ), Client_Away( c ))) return DISCONNECTED;
}
/* End of Whois */
return IRC_WriteStrClient( from, RPL_ENDOFWHOIS_MSG, Client_ID( from ), Client_ID( c ));
} /* IRC_WHOIS */
GLOBAL BOOLEAN
IRC_WHOWAS( CLIENT *Client, REQUEST *Req )
{
assert( Client != NULL );
assert( Req != NULL );
/* Falsche Anzahl Parameter? */
if(( Req->argc < 1 ) || ( Req->argc > 3 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
/* ... */
return CONNECTED;
} /* IRC_WHOWAS */
GLOBAL BOOLEAN
IRC_Send_LUSERS( CLIENT *Client )
{
LONG cnt;
assert( Client != NULL );
/* Users, services and serevers in the network */
if( ! IRC_WriteStrClient( Client, RPL_LUSERCLIENT_MSG, Client_ID( Client ), Client_UserCount( ), Client_ServiceCount( ), Client_ServerCount( ))) return DISCONNECTED;
/* Number of IRC operators */
cnt = Client_OperCount( );
if( cnt > 0 )
{
if( ! IRC_WriteStrClient( Client, RPL_LUSEROP_MSG, Client_ID( Client ), cnt )) return DISCONNECTED;
}
/* Unknown connections */
cnt = Client_UnknownCount( );
if( cnt > 0 )
{
if( ! IRC_WriteStrClient( Client, RPL_LUSERUNKNOWN_MSG, Client_ID( Client ), cnt )) return DISCONNECTED;
}
/* Number of created channels */
if( ! IRC_WriteStrClient( Client, RPL_LUSERCHANNELS_MSG, Client_ID( Client ), Channel_Count( ))) return DISCONNECTED;
/* Number of local users, services and servers */
if( ! IRC_WriteStrClient( Client, RPL_LUSERME_MSG, Client_ID( Client ), Client_MyUserCount( ), Client_MyServiceCount( ), Client_MyServerCount( ))) return DISCONNECTED;
#ifndef STRICT_RFC
/* Maximum number of local users */
if( ! IRC_WriteStrClient( Client, RPL_LOCALUSERS_MSG, Client_ID( Client ), Client_MyUserCount( ), Client_MyMaxUserCount( ))) return DISCONNECTED;
/* Maximum number of users in the network */
if( ! IRC_WriteStrClient( Client, RPL_NETUSERS_MSG, Client_ID( Client ), Client_UserCount( ), Client_MaxUserCount( ))) return DISCONNECTED;
#endif
return CONNECTED;
} /* IRC_Send_LUSERS */
GLOBAL BOOLEAN
IRC_Show_MOTD( CLIENT *Client )
{
BOOLEAN ok;
CHAR line[127];
FILE *fd;
assert( Client != NULL );
fd = fopen( Conf_MotdFile, "r" );
if( ! fd )
{
Log( LOG_WARNING, "Can't read MOTD file \"%s\": %s", Conf_MotdFile, strerror( errno ));
return IRC_WriteStrClient( Client, ERR_NOMOTD_MSG, Client_ID( Client ) );
}
IRC_WriteStrClient( Client, RPL_MOTDSTART_MSG, Client_ID( Client ), Client_ID( Client_ThisServer( )));
while( TRUE )
{
if( ! fgets( line, 126, fd )) break;
if( line[strlen( line ) - 1] == '\n' ) line[strlen( line ) - 1] = '\0';
if( ! IRC_WriteStrClient( Client, RPL_MOTD_MSG, Client_ID( Client ), line ))
{
fclose( fd );
return FALSE;
}
}
ok = IRC_WriteStrClient( Client, RPL_ENDOFMOTD_MSG, Client_ID( Client ) );
fclose( fd );
return ok;
} /* IRC_Show_MOTD */
GLOBAL BOOLEAN
IRC_Send_NAMES( CLIENT *Client, CHANNEL *Chan )
{
BOOLEAN is_visible, is_member;
CHAR str[LINE_LEN + 1];
CL2CHAN *cl2chan;
CLIENT *cl;
assert( Client != NULL );
assert( Chan != NULL );
if( Channel_IsMemberOf( Chan, Client )) is_member = TRUE;
else is_member = FALSE;
/* Alle Mitglieder suchen */
sprintf( str, RPL_NAMREPLY_MSG, Client_ID( Client ), "=", Channel_Name( Chan ));
cl2chan = Channel_FirstMember( Chan );
while( cl2chan )
{
cl = Channel_GetClient( cl2chan );
if( strchr( Client_Modes( cl ), 'i' )) is_visible = FALSE;
else is_visible = TRUE;
if( is_member || is_visible )
{
/* Nick anhaengen */
if( str[strlen( str ) - 1] != ':' ) strcat( str, " " );
if( strchr( Channel_UserModes( Chan, cl ), 'o' )) strcat( str, "@" );
else if( strchr( Channel_UserModes( Chan, cl ), 'v' )) strcat( str, "+" );
strcat( str, Client_ID( cl ));
if( strlen( str ) > ( LINE_LEN - CLIENT_NICK_LEN - 4 ))
{
/* Zeile wird zu lang: senden! */
if( ! IRC_WriteStrClient( Client, "%s", str )) return DISCONNECTED;
sprintf( str, RPL_NAMREPLY_MSG, Client_ID( Client ), "=", Channel_Name( Chan ));
}
}
/* naechstes Mitglied suchen */
cl2chan = Channel_NextMember( Chan, cl2chan );
}
if( str[strlen( str ) - 1] != ':')
{
/* Es sind noch Daten da, die gesendet werden muessen */
if( ! IRC_WriteStrClient( Client, "%s", str )) return DISCONNECTED;
}
return CONNECTED;
} /* IRC_Send_NAMES */
GLOBAL BOOLEAN
IRC_Send_WHO( CLIENT *Client, CHANNEL *Chan, BOOLEAN OnlyOps )
{
BOOLEAN is_visible, is_member;
CL2CHAN *cl2chan;
CHAR flags[8];
CLIENT *c;
assert( Client != NULL );
assert( Chan != NULL );
if( Channel_IsMemberOf( Chan, Client )) is_member = TRUE;
else is_member = FALSE;
/* Alle Mitglieder suchen */
cl2chan = Channel_FirstMember( Chan );
while( cl2chan )
{
c = Channel_GetClient( cl2chan );
if( strchr( Client_Modes( c ), 'i' )) is_visible = FALSE;
else is_visible = TRUE;
if( is_member || is_visible )
{
/* Flags zusammenbasteln */
strcpy( flags, "H" );
if( strchr( Client_Modes( c ), 'o' )) strcat( flags, "*" );
if( strchr( Channel_UserModes( Chan, c ), 'o' )) strcat( flags, "@" );
else if( strchr( Channel_UserModes( Chan, c ), 'v' )) strcat( flags, "+" );
/* ausgeben */
if(( ! OnlyOps ) || ( strchr( Client_Modes( c ), 'o' )))
{
if( ! IRC_WriteStrClient( Client, RPL_WHOREPLY_MSG, Client_ID( Client ), Channel_Name( Chan ), Client_User( c ), Client_Hostname( c ), Client_ID( Client_Introducer( c )), Client_ID( c ), flags, Client_Hops( c ), Client_Info( c ))) return DISCONNECTED;
}
}
/* naechstes Mitglied suchen */
cl2chan = Channel_NextMember( Chan, cl2chan );
}
return CONNECTED;
} /* IRC_Send_WHO */
/* -eof- */

44
src/ngircd/irc-info.h Normal file
View File

@@ -0,0 +1,44 @@
/*
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: irc-info.h,v 1.2 2002/12/12 12:23:43 alex Exp $
*
* IRC info commands (header)
*/
#ifndef __irc_info_h__
#define __irc_info_h__
GLOBAL BOOLEAN IRC_ADMIN PARAMS(( CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_ISON PARAMS(( CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_LINKS PARAMS(( CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_LUSERS PARAMS(( CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_MOTD PARAMS(( CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_NAMES PARAMS(( CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_STATS PARAMS(( CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_TIME PARAMS(( CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_USERHOST PARAMS(( CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_VERSION PARAMS(( CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_WHO PARAMS(( CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_WHOIS PARAMS(( CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_WHOWAS PARAMS(( CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_Send_LUSERS PARAMS(( CLIENT *Client ));
GLOBAL BOOLEAN IRC_Send_NAMES PARAMS(( CLIENT *Client, CHANNEL *Chan ));
GLOBAL BOOLEAN IRC_Show_MOTD PARAMS(( CLIENT *Client ));
GLOBAL BOOLEAN IRC_Send_WHO PARAMS(( CLIENT *Client, CHANNEL *Chan, BOOLEAN OnlyOps ));
#endif
/* -eof- */

View File

@@ -2,21 +2,20 @@
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
*
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* der GNU General Public License (GPL), wie von der Free Software Foundation
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: irc-login.c,v 1.21 2002/09/09 03:34:33 alex Exp $
*
* irc-login.c: Anmeldung und Abmeldung im IRC
* Login and logout
*/
#include "portab.h"
static char UNUSED id[] = "$Id: irc-login.c,v 1.27.2.2 2003/01/01 13:46:37 alex Exp $";
#include "imp.h"
#include <assert.h>
#include <stdio.h>
@@ -32,7 +31,7 @@
#include "log.h"
#include "messages.h"
#include "parse.h"
#include "irc.h"
#include "irc-info.h"
#include "irc-write.h"
#include "exp.h"
@@ -65,7 +64,7 @@ IRC_PASS( CLIENT *Client, REQUEST *Req )
}
else if((( Client_Type( Client ) == CLIENT_UNKNOWN ) || ( Client_Type( Client ) == CLIENT_UNKNOWNSERVER )) && (( Req->argc == 3 ) || ( Req->argc == 4 )))
{
CHAR c2, c4, *type, *impl, *serverver, *flags, *ptr;
CHAR c2, c4, *type, *impl, *serverver, *flags, *ptr, *ircflags;
INT protohigh, protolow;
/* noch nicht registrierte Server-Verbindung */
@@ -94,6 +93,10 @@ IRC_PASS( CLIENT *Client, REQUEST *Req )
if( strlen( Req->argv[1] ) > 4 ) type = &Req->argv[1][4];
else type = NULL;
/* IRC-Flags (nach RFC 2813) */
if( Req->argc >= 4 ) ircflags = Req->argv[3];
else ircflags = "";
/* Implementation, Version und ngIRCd-Flags */
impl = Req->argv[2];
ptr = strchr( impl, '|' );
@@ -111,12 +114,16 @@ IRC_PASS( CLIENT *Client, REQUEST *Req )
flags++;
}
else flags = "";
Log( LOG_INFO, "Connection %d: Peer announces itself as %s-%s using protocol %d.%d/IRC+ (flags: \"%s\").", Client_Conn( Client ), impl, serverver, protohigh, protolow, flags );
Log( LOG_INFO, "Peer announces itself as %s-%s using protocol %d.%d/IRC+ (flags: \"%s\").", impl, serverver, protohigh, protolow, flags );
}
else
{
serverver = flags = "";
Log( LOG_INFO, "Connection %d: Peer announces itself as \"%s\" using protocol %d.%d.", Client_Conn( Client ), impl, protohigh, protolow );
/* auf der anderen Seite laeuft ein Server, der
* nur das Originalprotokoll unterstuetzt */
serverver = "";
if( strchr( ircflags, 'Z' )) flags = "Z";
else flags = "";
Log( LOG_INFO, "Peer announces itself as \"%s\" using protocol %d.%d (flags: \"%s\").", impl, protohigh, protolow, flags );
}
Client_SetType( Client, CLIENT_GOTPASSSERVER );
@@ -354,8 +361,6 @@ IRC_PING( CLIENT *Client, REQUEST *Req )
assert( Client != NULL );
assert( Req != NULL );
if(( Client_Type( Client ) != CLIENT_USER ) && ( Client_Type( Client ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
/* Falsche Anzahl Parameter? */
if( Req->argc < 1 ) return IRC_WriteStrClient( Client, ERR_NOORIGIN_MSG, Client_ID( Client ));
#ifdef STRICT_RFC
@@ -366,7 +371,7 @@ IRC_PING( CLIENT *Client, REQUEST *Req )
{
/* es wurde ein Ziel-Client angegeben */
target = Client_Search( Req->argv[1] );
if( ! target ) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[1] );
if(( ! target ) || ( Client_Type( target ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[1] );
if( target != Client_ThisServer( ))
{
/* ok, forwarden */
@@ -390,8 +395,6 @@ IRC_PONG( CLIENT *Client, REQUEST *Req )
assert( Client != NULL );
assert( Req != NULL );
if(( Client_Type( Client ) != CLIENT_USER ) && ( Client_Type( Client ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
/* Falsche Anzahl Parameter? */
if( Req->argc < 1 ) return IRC_WriteStrClient( Client, ERR_NOORIGIN_MSG, Client_ID( Client ));
if( Req->argc > 2 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
@@ -400,7 +403,7 @@ IRC_PONG( CLIENT *Client, REQUEST *Req )
if( Req->argc == 2 )
{
target = Client_Search( Req->argv[1] );
if( ! target ) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[1] );
if(( ! target ) || ( Client_Type( target ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[1] );
if( target != Client_ThisServer( ))
{
/* ok, forwarden */
@@ -441,10 +444,13 @@ Hello_User( CLIENT *Client )
IRC_WriteStrServers( NULL, "NICK %s 1 %s %s 1 +%s :%s", Client_ID( Client ), Client_User( Client ), Client_Hostname( Client ), Client_Modes( Client ), Client_Info( Client ));
if( ! IRC_WriteStrClient( Client, RPL_WELCOME_MSG, Client_ID( Client ), Client_Mask( Client ))) return FALSE;
if( ! IRC_WriteStrClient( Client, RPL_YOURHOST_MSG, Client_ID( Client ), Client_ID( Client_ThisServer( )), VERSION, TARGET_CPU, TARGET_CPU, TARGET_OS )) return FALSE;
if( ! IRC_WriteStrClient( Client, RPL_YOURHOST_MSG, Client_ID( Client ), Client_ID( Client_ThisServer( )), VERSION, TARGET_CPU, TARGET_VENDOR, TARGET_OS )) return FALSE;
if( ! IRC_WriteStrClient( Client, RPL_CREATED_MSG, Client_ID( Client ), NGIRCd_StartStr )) return FALSE;
if( ! IRC_WriteStrClient( Client, RPL_MYINFO_MSG, Client_ID( Client ), Client_ID( Client_ThisServer( )), VERSION, USERMODES, CHANMODES )) return FALSE;
/* Features */
if( ! IRC_WriteStrClient( Client, RPL_FEATURE_MSG, Client_ID( Client ), CLIENT_NICK_LEN - 1, CHANNEL_TOPIC_LEN - 1, CLIENT_AWAY_LEN - 1, Conf_MaxJoins )) return DISCONNECTED;
Client_SetType( Client, CLIENT_USER );
if( ! IRC_Send_LUSERS( Client )) return DISCONNECTED;

View File

@@ -2,16 +2,15 @@
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
*
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* der GNU General Public License (GPL), wie von der Free Software Foundation
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: irc-login.h,v 1.4 2002/05/27 13:09:27 alex Exp $
* $Id: irc-login.h,v 1.5 2002/12/12 12:23:43 alex Exp $
*
* irc-login.h: Anmeldung und Abmeldung im IRC (Header)
* Login and logout (header)
*/

View File

@@ -2,23 +2,24 @@
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
*
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* der GNU General Public License (GPL), wie von der Free Software Foundation
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: irc-mode.c,v 1.14 2002/09/08 17:07:14 alex Exp $
*
* irc-mode.c: IRC-Befehle zur Mode-Aenderung (MODE, AWAY, ...)
* IRC commands for mode changes (MODE, AWAY, ...)
*/
#include "portab.h"
static char UNUSED id[] = "$Id: irc-mode.c,v 1.24.2.5 2003/01/21 21:05:19 alex Exp $";
#include "imp.h"
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "conn.h"
@@ -37,6 +38,9 @@
#include "irc-mode.h"
LOCAL BOOLEAN Client_Mode PARAMS(( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CLIENT *Target ));
LOCAL BOOLEAN Channel_Mode PARAMS(( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel ));
LOCAL BOOLEAN Add_Invite PARAMS(( CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, CHAR *Pattern ));
LOCAL BOOLEAN Add_Ban PARAMS(( CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, CHAR *Pattern ));
@@ -49,383 +53,549 @@ LOCAL BOOLEAN Send_ListChange PARAMS(( CHAR *Mode, CLIENT *Prefix, CLIENT *Clien
GLOBAL BOOLEAN
IRC_MODE( CLIENT *Client, REQUEST *Req )
{
CHAR *mode_ptr, the_modes[CLIENT_MODE_LEN], x[2];
CLIENT *cl, *chan_cl, *prefix;
BOOLEAN set, ok, modeok;
CLIENT *cl, *origin;
CHANNEL *chan;
assert( Client != NULL );
assert( Req != NULL );
cl = chan_cl = prefix = NULL;
chan = NULL;
/* Valider Client? */
if(( Client_Type( Client ) != CLIENT_USER ) && ( Client_Type( Client ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
/* Keine Parameter? */
/* No parameters? */
if( Req->argc < 1 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
/* Ziel suchen: Client bzw. Channel */
/* Origin for answers */
if( Client_Type( Client ) == CLIENT_SERVER )
{
origin = Client_Search( Req->prefix );
if( ! origin ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
}
else origin = Client;
/* Channel or user mode? */
cl = chan = NULL;
if( Client_IsValidNick( Req->argv[0] )) cl = Client_Search( Req->argv[0] );
if( Channel_IsValidName( Req->argv[0] )) chan = Channel_Search( Req->argv[0] );
/* Kein Ziel gefunden? */
if(( ! cl ) && ( ! chan )) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->argv[0] );
if( cl ) return Client_Mode( Client, Req, origin, cl );
if( chan ) return Channel_Mode( Client, Req, origin, chan );
assert(( cl && chan ) != TRUE );
/* No target found! */
return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->argv[0] );
} /* IRC_MODE */
/* Falsche Anzahl Parameter? */
if(( cl ) && ( Req->argc > 2 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
if(( chan ) && ( Req->argc > 3 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
/* Prefix fuer Antworten etc. ermitteln */
if( Client_Type( Client ) == CLIENT_SERVER )
{
prefix = Client_Search( Req->prefix );
if( ! prefix ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
}
else prefix = Client;
LOCAL BOOLEAN
Client_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CLIENT *Target )
{
/* Handle client mode requests */
if(( chan ) && (( Req->argc == 2 ) || ( Req->argc == 3 )))
{
/* pruefen, ob "Listen-Operation": Invite, Ban */
if(( Req->argv[1][0] == '-' ) || ( Req->argv[1][0] == '+' )) mode_ptr = &Req->argv[1][1];
else mode_ptr = &Req->argv[1][0];
if( Req->argc == 2 )
{
/* Liste anzeigen */
if( *mode_ptr == 'I' ) return Lists_ShowInvites( prefix, chan );
if( *mode_ptr == 'b' ) return Lists_ShowBans( prefix, chan );
}
else
{
/* Listen veraendern */
CHAR the_modes[COMMAND_LEN], x[2], *mode_ptr;
BOOLEAN ok, set;
INT mode_arg;
/* Is the client allowed to request or change the modes? */
if( Client_Type( Client ) == CLIENT_USER )
{
/* Ist der User Channel-Operator? */
modeok = FALSE;
if( strchr( Channel_UserModes( chan, Client ), 'o' )) modeok = TRUE;
if( Conf_OperCanMode )
{
/* auch IRC-Operatoren duerfen MODE verwenden */
if( Client_OperByMe( Client )) modeok = TRUE;
/* Users are only allowed to manipulate their own modes! */
if( Target != Client ) return IRC_WriteStrClient( Client, ERR_USERSDONTMATCH_MSG, Client_ID( Client ));
}
if( ! modeok )
{
Log( LOG_DEBUG, "Can't change modes: \"%s\" is not operator on %s!", Client_ID( Client ), Channel_Name( chan ));
return IRC_WriteStrClient( Client, ERR_CHANOPRIVSNEEDED_MSG, Client_ID( Client ), Channel_Name( chan ));
}
}
/* Mode request: let's answer it :-) */
if( Req->argc == 1 ) return IRC_WriteStrClient( Origin, RPL_UMODEIS_MSG, Client_ID( Origin ), Client_Modes( Target ));
if( Req->argv[1][0] == '+' )
{
/* Listen-Eintrag hinzufuegen */
if( *mode_ptr == 'I' ) return Add_Invite( prefix, Client, chan, Req->argv[2] );
if( *mode_ptr == 'b' ) return Add_Ban( prefix, Client, chan, Req->argv[2] );
}
else if( Req->argv[1][0] == '-' )
{
/* Listen-Eintrag loeschen */
if( *mode_ptr == 'I' ) return Del_Invite( prefix, Client, chan, Req->argv[2] );
if( *mode_ptr == 'b' ) return Del_Ban( prefix, Client, chan, Req->argv[2] );
}
}
}
mode_arg = 1;
mode_ptr = Req->argv[mode_arg];
/* Client ermitteln, wenn bei Channel-Modes mit 3 Parametern */
if(( chan ) && (Req->argc == 3 ))
{
chan_cl = Client_Search( Req->argv[2] );
if( ! chan_cl ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->argv[0] );
}
/* Wenn Anfragender ein User ist: Zugriff erlaubt? */
if( Client_Type( Client ) == CLIENT_USER )
{
if( cl )
{
/* MODE ist nur fuer sich selber zulaessig! */
if( cl != Client ) return IRC_WriteStrClient( Client, ERR_USERSDONTMATCH_MSG, Client_ID( Client ));
}
if( chan )
{
/* Darf der User die Channel-Modes ermitteln? */
}
}
/* Werden die Modes "nur" erfragt? */
if(( cl ) && ( Req->argc == 1 )) return IRC_WriteStrClient( Client, RPL_UMODEIS_MSG, Client_ID( Client ), Client_Modes( cl ));
if(( chan ) && ( Req->argc == 1 )) return IRC_WriteStrClient( Client, RPL_CHANNELMODEIS_MSG, Client_ID( Client ), Channel_Name( chan ), Channel_Modes( chan ));
mode_ptr = Req->argv[1];
/* Sollen Modes gesetzt oder geloescht werden? */
if( cl )
{
/* Initial state: set or unset modes? */
if( *mode_ptr == '+' ) set = TRUE;
else if( *mode_ptr == '-' ) set = FALSE;
else return IRC_WriteStrClient( Client, ERR_UMODEUNKNOWNFLAG_MSG, Client_ID( Client ));
mode_ptr++;
}
else
{
if( *mode_ptr == '-' ) set = FALSE;
else set = TRUE;
if(( *mode_ptr == '-' ) || ( *mode_ptr == '+' )) mode_ptr++;
}
else return IRC_WriteStrClient( Origin, ERR_UMODEUNKNOWNFLAG_MSG, Client_ID( Origin ));
/* Reply-String mit Aenderungen vorbereiten */
/* Prepare reply string */
if( set ) strcpy( the_modes, "+" );
else strcpy( the_modes, "-" );
ok = TRUE;
x[1] = '\0';
while( *mode_ptr )
ok = CONNECTED;
while( mode_ptr )
{
x[0] = '\0';
if( Client_Type( Client ) == CLIENT_SERVER )
mode_ptr++;
if( ! *mode_ptr )
{
/* Befehl kommt von einem Server, daher
* trauen wir ihm "unbesehen" ... */
x[0] = *mode_ptr;
/* Try next argument if there's any */
mode_arg++;
if( mode_arg < Req->argc ) mode_ptr = Req->argv[mode_arg];
else break;
}
switch( *mode_ptr )
{
case '+':
case '-':
if((( *mode_ptr == '+' ) && ( ! set )) || (( *mode_ptr == '-' ) && ( set )))
{
/* Action modifier ("+"/"-") must be changed ... */
if(( the_modes[strlen( the_modes ) - 1] == '+' ) || ( the_modes[strlen( the_modes ) - 1] == '-' ))
{
/* Adjust last action modifier in result */
the_modes[strlen( the_modes ) - 1] = *mode_ptr;
}
else
{
/* Modes validieren */
if( cl )
{
/* User-Modes */
/* Append modifier character to result string */
x[0] = *mode_ptr; strcat( the_modes, x );
}
if( *mode_ptr == '+' ) set = TRUE;
else set = FALSE;
}
continue;
}
/* Validate modes */
x[0] = '\0';
switch( *mode_ptr )
{
case 'a':
/* Away */
if( Client_Type( Client ) == CLIENT_SERVER )
{
x[0] = 'a';
Client_SetAway( Client, DEFAULT_AWAY_MSG );
}
else ok = IRC_WriteStrClient( Origin, ERR_NOPRIVILEGES_MSG, Client_ID( Origin ));
break;
case 'i':
/* invisible */
/* Invisible */
x[0] = 'i';
break;
case 'o':
/* operator (kann nur geloescht werden) */
if( ! set )
/* IRC operator (only unsetable!) */
if(( ! set ) || ( Client_Type( Client ) == CLIENT_SERVER ))
{
Client_SetOperByMe( Client, FALSE );
Client_SetOperByMe( Target, FALSE );
x[0] = 'o';
}
else ok = IRC_WriteStrClient( Client, ERR_UMODEUNKNOWNFLAG_MSG, Client_ID( Client ));
else ok = IRC_WriteStrClient( Origin, ERR_NOPRIVILEGES_MSG, Client_ID( Origin ));
break;
case 'r':
/* restricted (kann nur gesetzt werden) */
if( set ) x[0] = 'r';
else ok = IRC_WriteStrClient( Client, ERR_RESTRICTED_MSG, Client_ID( Client ));
/* Restricted (only setable) */
if(( set ) || ( Client_Type( Client ) == CLIENT_SERVER )) x[0] = 'r';
else ok = IRC_WriteStrClient( Origin, ERR_RESTRICTED_MSG, Client_ID( Origin ));
break;
case 's':
/* server messages */
/* Server messages */
x[0] = 's';
break;
default:
Log( LOG_DEBUG, "Unknown mode \"%c%c\" from \"%s\"!?", set ? '+' : '-', *mode_ptr, Client_ID( Client ));
ok = IRC_WriteStrClient( Client, ERR_UMODEUNKNOWNFLAG2_MSG, Client_ID( Client ), set ? '+' : '-', *mode_ptr );
Log( LOG_DEBUG, "Unknown mode \"%c%c\" from \"%s\"!?", set ? '+' : '-', *mode_ptr, Client_ID( Origin ));
if( Client_Type( Client ) != CLIENT_SERVER ) ok = IRC_WriteStrClient( Origin, ERR_UMODEUNKNOWNFLAG2_MSG, Client_ID( Origin ), set ? '+' : '-', *mode_ptr );
x[0] = '\0';
}
}
if( chan )
{
/* Ist der User ein Channel Operator? */
modeok = FALSE;
if( strchr( Channel_UserModes( chan, Client ), 'o' )) modeok = TRUE;
if( Conf_OperCanMode )
{
/* auch IRC-Operatoren duerfen MODE verwenden */
if( Client_OperByMe( Client )) modeok = TRUE;
}
if( ! modeok )
{
Log( LOG_DEBUG, "Can't change modes: \"%s\" is not operator on %s!", Client_ID( Client ), Channel_Name( chan ));
ok = IRC_WriteStrClient( Client, ERR_CHANOPRIVSNEEDED_MSG, Client_ID( Client ), Channel_Name( chan ));
break;
}
/* Channel-Modes oder Channel-User-Modes */
if( chan_cl )
{
/* Channel-User-Modes */
switch( *mode_ptr )
{
case 'o':
/* Channel Operator */
x[0] = 'o';
break;
case 'v':
/* Voice */
x[0] = 'v';
break;
default:
Log( LOG_DEBUG, "Unknown channel-user-mode \"%c%c\" from \"%s\" on \"%s\" at %s!?", set ? '+' : '-', *mode_ptr, Client_ID( Client ), Client_ID( chan_cl ), Channel_Name( chan ));
ok = IRC_WriteStrClient( Client, ERR_UMODEUNKNOWNFLAG2_MSG, Client_ID( Client ), set ? '+' : '-', *mode_ptr );
x[0] = '\0';
}
}
else
{
/* Channel-Modes */
switch( *mode_ptr )
{
case 'i':
/* Invite-Only */
x[0] = 'i';
break;
case 'm':
/* Moderated */
x[0] = 'm';
break;
case 'n':
/* kein Schreiben in den Channel von aussen */
x[0] = 'n';
break;
case 't':
/* Topic Lock */
x[0] = 't';
break;
case 'P':
/* Persistent */
x[0] = 'P';
break;
default:
Log( LOG_DEBUG, "Unknown channel-mode \"%c%c\" from \"%s\" at %s!?", set ? '+' : '-', *mode_ptr, Client_ID( Client ), Channel_Name( chan ));
ok = IRC_WriteStrClient( Client, ERR_UMODEUNKNOWNFLAG2_MSG, Client_ID( Client ), set ? '+' : '-', *mode_ptr );
x[0] = '\0';
}
}
}
goto client_exit;
}
if( ! ok ) break;
mode_ptr++;
/* Is there a valid mode change? */
if( ! x[0] ) continue;
/* Okay, gueltigen Mode gefunden */
if( cl )
{
/* Es geht um User-Modes */
if( set )
{
/* Mode setzen. Wenn der Client ihn noch nicht hatte: merken */
if( Client_ModeAdd( cl, x[0] )) strcat( the_modes, x );
/* Set mode */
if( Client_ModeAdd( Target, x[0] )) strcat( the_modes, x );
}
else
{
/* Modes geloescht. Wenn der Client ihn hatte: merken */
if( Client_ModeDel( cl, x[0] )) strcat( the_modes, x );
/* Unset mode */
if( Client_ModeDel( Target, x[0] )) strcat( the_modes, x );
}
}
client_exit:
/* "nachbearbeiten" */
if( x[0] == 'a' )
{
/* away */
if( set ) Client_SetAway( cl, DEFAULT_AWAY_MSG );
else Client_SetAway( cl, NULL );
}
}
if( chan )
{
/* Es geht um Channel-Modes oder Channel-User-Modes */
if( chan_cl )
{
/* Channel-User-Modes */
if( set )
{
/* Mode setzen. Wenn der Channel ihn noch nicht hatte: merken */
if( Channel_UserModeAdd( chan, chan_cl, x[0] )) strcat( the_modes, x );
}
else
{
/* Mode setzen. Wenn der Channel ihn noch nicht hatte: merken */
if( Channel_UserModeDel( chan, chan_cl, x[0] )) strcat( the_modes, x );
}
}
else
{
/* Channel-Mode */
if( set )
{
/* Mode setzen. Wenn der Channel ihn noch nicht hatte: merken */
if( Channel_ModeAdd( chan, x[0] )) strcat( the_modes, x );
}
else
{
/* Mode setzen. Wenn der Channel ihn noch nicht hatte: merken */
if( Channel_ModeDel( chan, x[0] )) strcat( the_modes, x );
}
}
}
}
/* Wurden Modes geaendert? */
/* Are there changed modes? */
if( the_modes[1] )
{
if( cl )
{
/* Client-Mode */
/* Remoce needless action modifier characters */
if(( the_modes[strlen( the_modes ) - 1] == '+' ) || ( the_modes[strlen( the_modes ) - 1] == '-' )) the_modes[strlen( the_modes ) - 1] = '\0';
if( Client_Type( Client ) == CLIENT_SERVER )
{
/* Modes an andere Server forwarden */
IRC_WriteStrServersPrefix( Client, prefix, "MODE %s :%s", Client_ID( cl ), the_modes );
/* Forward modes to other servers */
IRC_WriteStrServersPrefix( Client, Origin, "MODE %s :%s", Client_ID( Target ), the_modes );
}
else
{
/* Bestaetigung an Client schicken & andere Server informieren */
ok = IRC_WriteStrClientPrefix( Client, prefix, "MODE %s %s", Client_ID( cl ), the_modes );
IRC_WriteStrServersPrefix( Client, prefix, "MODE %s :%s", Client_ID( cl ), the_modes );
}
Log( LOG_DEBUG, "User \"%s\": Mode change, now \"%s\".", Client_Mask( cl ), Client_Modes( cl ));
}
if( chan )
{
/* Channel-Modes oder Channel-User-Mode */
if( chan_cl )
{
/* Channel-User-Mode */
if( Client_Type( Client ) == CLIENT_SERVER )
{
/* Modes an andere Server und Channel-User forwarden */
IRC_WriteStrServersPrefix( Client, prefix, "MODE %s %s :%s", Channel_Name( chan ), the_modes, Client_ID( chan_cl));
IRC_WriteStrChannelPrefix( Client, chan, prefix, FALSE, "MODE %s %s %s", Channel_Name( chan ), the_modes, Client_ID( chan_cl));
}
else
{
/* Bestaetigung an Client schicken & andere Server sowie Channel-User informieren */
ok = IRC_WriteStrClientPrefix( Client, prefix, "MODE %s %s %s", Channel_Name( chan ), the_modes, Client_ID( chan_cl));
IRC_WriteStrServersPrefix( Client, prefix, "MODE %s %s :%s", Channel_Name( chan ), the_modes, Client_ID( chan_cl));
IRC_WriteStrChannelPrefix( Client, chan, prefix, FALSE, "MODE %s %s %s", Channel_Name( chan ), the_modes, Client_ID( chan_cl));
}
Log( LOG_DEBUG, "User \"%s\" on %s: Mode change, now \"%s\".", Client_Mask( chan_cl), Channel_Name( chan ), Channel_UserModes( chan, chan_cl ));
}
else
{
/* Channel-Mode */
if( Client_Type( Client ) == CLIENT_SERVER )
{
/* Modes an andere Server und Channel-User forwarden */
IRC_WriteStrServersPrefix( Client, prefix, "MODE %s :%s", Channel_Name( chan ), the_modes );
IRC_WriteStrChannelPrefix( Client, chan, prefix, FALSE, "MODE %s %s", Channel_Name( chan ), the_modes );
}
else
{
/* Bestaetigung an Client schicken & andere Server sowie Channel-User informieren */
ok = IRC_WriteStrClientPrefix( Client, prefix, "MODE %s %s", Channel_Name( chan ), the_modes );
IRC_WriteStrServersPrefix( Client, prefix, "MODE %s :%s", Channel_Name( chan ), the_modes );
IRC_WriteStrChannelPrefix( Client, chan, prefix, FALSE, "MODE %s %s", Channel_Name( chan ), the_modes );
}
Log( LOG_DEBUG, "Channel \"%s\": Mode change, now \"%s\".", Channel_Name( chan ), Channel_Modes( chan ));
}
/* Send reply to client and inform other servers */
ok = IRC_WriteStrClientPrefix( Client, Origin, "MODE %s %s", Client_ID( Target ), the_modes );
IRC_WriteStrServersPrefix( Client, Origin, "MODE %s :%s", Client_ID( Target ), the_modes );
}
Log( LOG_DEBUG, "User \"%s\": Mode change, now \"%s\".", Client_Mask( Target ), Client_Modes( Target ));
}
return ok;
} /* IRC_MODE */
} /* Client_Mode */
LOCAL BOOLEAN
Channel_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel )
{
/* Handle channel and channel-user modes */
CHAR the_modes[COMMAND_LEN], the_args[COMMAND_LEN], x[2], argadd[CLIENT_PASS_LEN], *mode_ptr;
BOOLEAN ok, set, modeok, skiponce;
INT mode_arg, arg_arg;
CLIENT *client;
LONG l;
/* Mode request: let's answer it :-) */
if( Req->argc == 1 )
{
/* Member or not? -- That's the question! */
if( ! Channel_IsMemberOf( Channel, Origin )) return IRC_WriteStrClient( Origin, RPL_CHANNELMODEIS_MSG, Client_ID( Origin ), Channel_Name( Channel ), Channel_Modes( Channel ));
/* The sender is a member: generate extended reply */
strcpy( the_modes, Channel_Modes( Channel ));
mode_ptr = the_modes;
strcpy( the_args, "" );
while( *mode_ptr )
{
switch( *mode_ptr )
{
case 'l':
snprintf( argadd, sizeof( argadd ), " %ld", Channel_MaxUsers( Channel ));
strcat( the_args, argadd );
break;
case 'k':
strcat( the_args, " " );
strcat( the_args, Channel_Key( Channel ));
break;
}
mode_ptr++;
}
if( the_args[0] ) strcat( the_modes, the_args );
return IRC_WriteStrClient( Origin, RPL_CHANNELMODEIS_MSG, Client_ID( Origin ), Channel_Name( Channel ), the_modes );
}
/* Is the user allowed to change modes? */
if( Client_Type( Client ) == CLIENT_USER )
{
/* Is the originating user on that channel? */
if( ! Channel_IsMemberOf( Channel, Origin )) return IRC_WriteStrClient( Origin, ERR_NOTONCHANNEL_MSG, Client_ID( Origin ), Channel_Name( Channel ));
/* Is he channel operator? */
if( strchr( Channel_UserModes( Channel, Origin ), 'o' )) modeok = TRUE;
else modeok = FALSE;
if( Conf_OperCanMode )
{
/* auch IRC-Operatoren duerfen MODE verwenden */
if( Client_OperByMe( Origin )) modeok = TRUE;
}
}
else modeok = TRUE;
mode_arg = 1;
mode_ptr = Req->argv[mode_arg];
if( Req->argc > mode_arg + 1 ) arg_arg = mode_arg + 1;
else arg_arg = -1;
/* Initial state: set or unset modes? */
skiponce = FALSE;
if( *mode_ptr == '-' ) set = FALSE;
else if( *mode_ptr == '+' ) set = TRUE;
else set = skiponce = TRUE;
/* Prepare reply string */
if( set ) strcpy( the_modes, "+" );
else strcpy( the_modes, "-" );
strcpy( the_args, " " );
x[1] = '\0';
ok = CONNECTED;
while( mode_ptr )
{
if( ! skiponce ) mode_ptr++;
if( ! *mode_ptr )
{
/* Try next argument if there's any */
if( arg_arg > mode_arg ) mode_arg = arg_arg;
else mode_arg++;
if( mode_arg < Req->argc ) mode_ptr = Req->argv[mode_arg];
else break;
if( Req->argc > mode_arg + 1 ) arg_arg = mode_arg + 1;
else arg_arg = -1;
}
skiponce = FALSE;
switch( *mode_ptr )
{
case '+':
case '-':
if((( *mode_ptr == '+' ) && ( ! set )) || (( *mode_ptr == '-' ) && ( set )))
{
/* Action modifier ("+"/"-") must be changed ... */
if(( the_modes[strlen( the_modes ) - 1] == '+' ) || ( the_modes[strlen( the_modes ) - 1] == '-' ))
{
/* Adjust last action modifier in result */
the_modes[strlen( the_modes ) - 1] = *mode_ptr;
}
else
{
/* Append modifier character to result string */
x[0] = *mode_ptr; strcat( the_modes, x );
}
if( *mode_ptr == '+' ) set = TRUE;
else set = FALSE;
}
continue;
}
/* Are there arguments left? */
if( arg_arg >= Req->argc ) arg_arg = -1;
/* Validate modes */
x[0] = '\0';
argadd[0] = '\0';
client = NULL;
switch( *mode_ptr )
{
/* Channel modes */
case 'i':
/* Invite-Only */
if( modeok ) x[0] = 'i';
else ok = IRC_WriteStrClient( Origin, ERR_CHANOPRIVSNEEDED_MSG, Client_ID( Origin ), Channel_Name( Channel ));
break;
case 'm':
/* Moderated */
if( modeok ) x[0] = 'm';
else ok = IRC_WriteStrClient( Origin, ERR_CHANOPRIVSNEEDED_MSG, Client_ID( Origin ), Channel_Name( Channel ));
break;
case 'n':
/* kein Schreiben in den Channel von aussen */
if( modeok ) x[0] = 'n';
else ok = IRC_WriteStrClient( Origin, ERR_CHANOPRIVSNEEDED_MSG, Client_ID( Origin ), Channel_Name( Channel ));
break;
case 't':
/* Topic Lock */
if( modeok ) x[0] = 't';
else ok = IRC_WriteStrClient( Origin, ERR_CHANOPRIVSNEEDED_MSG, Client_ID( Origin ), Channel_Name( Channel ));
break;
case 'P':
/* Persistent channel */
if( modeok )
{
if( set && ( ! Client_OperByMe( Client )))
{
/* Only IRC operators are allowed to set P mode */
ok = IRC_WriteStrClient( Origin, ERR_NOPRIVILEGES_MSG, Client_ID( Origin ));
}
else x[0] = 'P';
}
else ok = IRC_WriteStrClient( Origin, ERR_CHANOPRIVSNEEDED_MSG, Client_ID( Origin ), Channel_Name( Channel ));
break;
/* Channel user modes */
case 'o':
/* Channel operator */
case 'v':
/* Voice */
if( arg_arg > mode_arg )
{
if( modeok )
{
client = Client_Search( Req->argv[arg_arg] );
if( client ) x[0] = *mode_ptr;
else ok = IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->argv[arg_arg] );
}
else ok = IRC_WriteStrClient( Origin, ERR_CHANOPRIVSNEEDED_MSG, Client_ID( Origin ), Channel_Name( Channel ));
Req->argv[arg_arg][0] = '\0';
arg_arg++;
}
else ok = IRC_WriteStrClient( Origin, ERR_NEEDMOREPARAMS_MSG, Client_ID( Origin ), Req->command );
break;
case 'k':
/* Channel key */
if( ! set )
{
if( modeok ) x[0] = *mode_ptr;
else ok = IRC_WriteStrClient( Origin, ERR_CHANOPRIVSNEEDED_MSG, Client_ID( Origin ), Channel_Name( Channel ));
break;
}
if( arg_arg > mode_arg )
{
if( modeok )
{
Channel_ModeDel( Channel, 'k' );
Channel_SetKey( Channel, Req->argv[arg_arg] );
strcpy( argadd, Channel_Key( Channel ));
x[0] = *mode_ptr;
}
else ok = IRC_WriteStrClient( Origin, ERR_CHANOPRIVSNEEDED_MSG, Client_ID( Origin ), Channel_Name( Channel ));
Req->argv[arg_arg][0] = '\0';
arg_arg++;
}
else ok = IRC_WriteStrClient( Origin, ERR_NEEDMOREPARAMS_MSG, Client_ID( Origin ), Req->command );
break;
case 'l':
/* Member limit */
if( ! set )
{
if( modeok ) x[0] = *mode_ptr;
else ok = IRC_WriteStrClient( Origin, ERR_CHANOPRIVSNEEDED_MSG, Client_ID( Origin ), Channel_Name( Channel ));
break;
}
if( arg_arg > mode_arg )
{
if( modeok )
{
l = atol( Req->argv[arg_arg] );
if( l > 0 && l < 0xFFFF )
{
Channel_ModeDel( Channel, 'l' );
Channel_SetMaxUsers( Channel, l );
sprintf( argadd, "%ld", l );
x[0] = *mode_ptr;
}
}
else ok = IRC_WriteStrClient( Origin, ERR_CHANOPRIVSNEEDED_MSG, Client_ID( Origin ), Channel_Name( Channel ));
Req->argv[arg_arg][0] = '\0';
arg_arg++;
}
else ok = IRC_WriteStrClient( Origin, ERR_NEEDMOREPARAMS_MSG, Client_ID( Origin ), Req->command );
break;
/* Channel lists */
case 'I':
/* Invite lists */
if( arg_arg > mode_arg )
{
/* modify list */
if( modeok )
{
if( set ) Add_Invite( Origin, Client, Channel, Req->argv[arg_arg] );
else Del_Invite( Origin, Client, Channel, Req->argv[arg_arg] );
}
else ok = IRC_WriteStrClient( Origin, ERR_CHANOPRIVSNEEDED_MSG, Client_ID( Origin ), Channel_Name( Channel ));
Req->argv[arg_arg][0] = '\0';
arg_arg++;
}
else Lists_ShowInvites( Origin, Channel );
break;
case 'b':
/* Ban lists */
if( arg_arg > mode_arg )
{
/* modify list */
if( modeok )
{
if( set ) Add_Ban( Origin, Client, Channel, Req->argv[arg_arg] );
else Del_Ban( Origin, Client, Channel, Req->argv[arg_arg] );
}
else ok = IRC_WriteStrClient( Origin, ERR_CHANOPRIVSNEEDED_MSG, Client_ID( Origin ), Channel_Name( Channel ));
Req->argv[arg_arg][0] = '\0';
arg_arg++;
}
else Lists_ShowBans( Origin, Channel );
break;
default:
Log( LOG_DEBUG, "Unknown mode \"%c%c\" from \"%s\" on %s!?", set ? '+' : '-', *mode_ptr, Client_ID( Origin ), Channel_Name( Channel ));
if( Client_Type( Client ) != CLIENT_SERVER ) ok = IRC_WriteStrClient( Origin, ERR_UMODEUNKNOWNFLAG2_MSG, Client_ID( Origin ), set ? '+' : '-', *mode_ptr );
x[0] = '\0';
goto chan_exit;
}
if( ! ok ) break;
/* Is there a valid mode change? */
if( ! x[0] ) continue;
/* Validate target client */
if( client && ( ! Channel_IsMemberOf( Channel, client )))
{
if( ! IRC_WriteStrClient( Origin, ERR_USERNOTINCHANNEL_MSG, Client_ID( Origin ), Client_ID( client ), Channel_Name( Channel ))) break;
continue;
}
if( set )
{
/* Set mode */
if( client )
{
/* Channel-User-Mode */
if( Channel_UserModeAdd( Channel, client, x[0] ))
{
strcat( the_args, Client_ID( client ));
strcat( the_args, " " ); strcat( the_modes, x );
Log( LOG_DEBUG, "User \"%s\": Mode change on %s, now \"%s\"", Client_Mask( client ), Channel_Name( Channel ), Channel_UserModes( Channel, client ));
}
}
else
{
/* Channel-Mode */
if( Channel_ModeAdd( Channel, x[0] ))
{
strcat( the_modes, x );
Log( LOG_DEBUG, "Channel %s: Mode change, now \"%s\".", Channel_Name( Channel ), Channel_Modes( Channel ));
}
}
}
else
{
/* Unset mode */
if( client )
{
/* Channel-User-Mode */
if( Channel_UserModeDel( Channel, client, x[0] ))
{
strcat( the_args, Client_ID( client ));
strcat( the_args, " " ); strcat( the_modes, x );
Log( LOG_DEBUG, "User \"%s\": Mode change on %s, now \"%s\"", Client_Mask( client ), Channel_Name( Channel ), Channel_UserModes( Channel, client ));
}
}
else
{
/* Channel-Mode */
if( Channel_ModeDel( Channel, x[0] ))
{
strcat( the_modes, x );
Log( LOG_DEBUG, "Channel %s: Mode change, now \"%s\".", Channel_Name( Channel ), Channel_Modes( Channel ));
}
}
}
/* Are there additional arguments to add? */
if( argadd[0] )
{
if( the_args[strlen( the_args ) - 1] != ' ' ) strcat( the_args, " " );
strcat( the_args, argadd );
}
}
chan_exit:
/* Are there changed modes? */
if( the_modes[1] )
{
/* Clean up mode string */
if(( the_modes[strlen( the_modes ) - 1] == '+' ) || ( the_modes[strlen( the_modes ) - 1] == '-' )) the_modes[strlen( the_modes ) - 1] = '\0';
/* Clean up argument string if there are none */
if( ! the_args[1] ) the_args[0] = '\0';
if( Client_Type( Client ) == CLIENT_SERVER )
{
/* Forward mode changes to channel users and other servers */
IRC_WriteStrServersPrefix( Client, Origin, "MODE %s %s%s", Channel_Name( Channel ), the_modes, the_args );
IRC_WriteStrChannelPrefix( Client, Channel, Origin, FALSE, "MODE %s %s%s", Channel_Name( Channel ), the_modes, the_args );
}
else
{
/* Send reply to client and inform other servers and channel users */
ok = IRC_WriteStrClientPrefix( Client, Origin, "MODE %s %s%s", Channel_Name( Channel ), the_modes, the_args );
IRC_WriteStrServersPrefix( Client, Origin, "MODE %s %s%s", Channel_Name( Channel ), the_modes, the_args );
IRC_WriteStrChannelPrefix( Client, Channel, Origin, FALSE, "MODE %s %s%s", Channel_Name( Channel ), the_modes, the_args );
}
}
return CONNECTED;
} /* Channel_Mode */
GLOBAL BOOLEAN
@@ -434,8 +604,6 @@ IRC_AWAY( CLIENT *Client, REQUEST *Req )
assert( Client != NULL );
assert( Req != NULL );
if( Client_Type( Client ) != CLIENT_USER ) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
/* Falsche Anzahl Parameter? */
if( Req->argc > 1 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
@@ -443,13 +611,14 @@ IRC_AWAY( CLIENT *Client, REQUEST *Req )
{
/* AWAY setzen */
Client_SetAway( Client, Req->argv[0] );
Client_ModeAdd( Client, 'a' );
IRC_WriteStrServersPrefix( Client, Client, "MODE %s :+a", Client_ID( Client ));
return IRC_WriteStrClient( Client, RPL_NOWAWAY_MSG, Client_ID( Client ));
}
else
{
/* AWAY loeschen */
Client_SetAway( Client, NULL );
Client_ModeDel( Client, 'a' );
IRC_WriteStrServersPrefix( Client, Client, "MODE %s :-a", Client_ID( Client ));
return IRC_WriteStrClient( Client, RPL_UNAWAY_MSG, Client_ID( Client ));
}

View File

@@ -2,16 +2,15 @@
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
*
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* der GNU General Public License (GPL), wie von der Free Software Foundation
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: irc-mode.h,v 1.4 2002/05/27 13:09:27 alex Exp $
* $Id: irc-mode.h,v 1.5 2002/12/12 12:23:43 alex Exp $
*
* irc-mode.h: IRC-Befehle zur Mode-Aenderung (MODE, AWAY, ...) (Header)
* IRC commands for mode changes (header)
*/

View File

@@ -2,21 +2,20 @@
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
*
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* der GNU General Public License (GPL), wie von der Free Software Foundation
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: irc-op.c,v 1.9 2002/09/08 17:06:54 alex Exp $
*
* irc-op.c: Befehle zur Channel-Verwaltung
* Channel operator commands
*/
#include "portab.h"
static char UNUSED id[] = "$Id: irc-op.c,v 1.11 2002/12/12 12:24:18 alex Exp $";
#include "imp.h"
#include <assert.h>
#include <string.h>
@@ -44,9 +43,6 @@ IRC_KICK( CLIENT *Client, REQUEST *Req )
assert( Client != NULL );
assert( Req != NULL );
/* Valider Client? */
if(( Client_Type( Client ) != CLIENT_USER ) && ( Client_Type( Client ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
/* Falsche Anzahl Parameter? */
if(( Req->argc < 2) || ( Req->argc > 3 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
@@ -73,9 +69,6 @@ IRC_INVITE( CLIENT *Client, REQUEST *Req )
assert( Client != NULL );
assert( Req != NULL );
/* Valider Client? */
if(( Client_Type( Client ) != CLIENT_USER ) && ( Client_Type( Client ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
/* Falsche Anzahl Parameter? */
if( Req->argc != 2 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );

View File

@@ -2,16 +2,15 @@
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
*
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* der GNU General Public License (GPL), wie von der Free Software Foundation
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: irc-op.h,v 1.2 2002/09/08 00:52:55 alex Exp $
* $Id: irc-op.h,v 1.3 2002/12/12 12:23:43 alex Exp $
*
* irc-op.h: Befehle zur Channel-Verwaltung (Header)
* Channel operator commands (header)
*/

View File

@@ -2,21 +2,20 @@
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
*
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* der GNU General Public License (GPL), wie von der Free Software Foundation
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: irc-oper.c,v 1.8 2002/09/03 23:54:59 alex Exp $
*
* irc-oper.c: IRC-Operator-Befehle
* IRC operator commands
*/
#include "portab.h"
static char UNUSED id[] = "$Id: irc-oper.c,v 1.13 2002/12/12 12:33:14 alex Exp $";
#include "imp.h"
#include <assert.h>
#include <string.h>
@@ -44,8 +43,6 @@ IRC_OPER( CLIENT *Client, REQUEST *Req )
assert( Client != NULL );
assert( Req != NULL );
if( Client_Type( Client ) != CLIENT_USER ) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
/* Falsche Anzahl Parameter? */
if( Req->argc != 2 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
@@ -88,8 +85,6 @@ IRC_DIE( CLIENT *Client, REQUEST *Req )
assert( Client != NULL );
assert( Req != NULL );
if( Client_Type( Client ) != CLIENT_USER ) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
/* Falsche Anzahl Parameter? */
if( Req->argc != 0 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
@@ -102,12 +97,28 @@ IRC_DIE( CLIENT *Client, REQUEST *Req )
GLOBAL BOOLEAN
IRC_RESTART( CLIENT *Client, REQUEST *Req )
IRC_REHASH( CLIENT *Client, REQUEST *Req )
{
assert( Client != NULL );
assert( Req != NULL );
if( Client_Type( Client ) != CLIENT_USER ) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
/* Falsche Anzahl Parameter? */
if( Req->argc != 0 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
if(( ! Client_HasMode( Client, 'o' )) || ( ! Client_OperByMe( Client ))) return IRC_WriteStrClient( Client, ERR_NOPRIVILEGES_MSG, Client_ID( Client ));
Log( LOG_NOTICE|LOG_snotice, "Got REHASH command from \"%s\", re-reading configuration ...", Client_Mask( Client ));
NGIRCd_Rehash( );
return CONNECTED;
} /* IRC_REHASH */
GLOBAL BOOLEAN
IRC_RESTART( CLIENT *Client, REQUEST *Req )
{
assert( Client != NULL );
assert( Req != NULL );
/* Falsche Anzahl Parameter? */
if( Req->argc != 0 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
@@ -129,8 +140,6 @@ IRC_CONNECT(CLIENT *Client, REQUEST *Req )
assert( Client != NULL );
assert( Req != NULL );
if( Client_Type( Client ) != CLIENT_USER ) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
/* Falsche Anzahl Parameter? */
if( Req->argc != 0 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
if(( ! Client_HasMode( Client, 'o' )) || ( ! Client_OperByMe( Client ))) return IRC_WriteStrClient( Client, ERR_NOPRIVILEGES_MSG, Client_ID( Client ));

View File

@@ -2,16 +2,15 @@
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
*
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* der GNU General Public License (GPL), wie von der Free Software Foundation
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: irc-oper.h,v 1.6 2002/09/03 23:54:59 alex Exp $
* $Id: irc-oper.h,v 1.9 2002/12/12 12:23:43 alex Exp $
*
* irc-oper.h: IRC-Operator-Befehle (Header)
* IRC operator commands (header)
*/
@@ -21,6 +20,7 @@
GLOBAL BOOLEAN IRC_OPER PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_DIE PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_REHASH PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_RESTART PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_CONNECT PARAMS((CLIENT *Client, REQUEST *Req ));

View File

@@ -2,21 +2,20 @@
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
*
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* der GNU General Public License (GPL), wie von der Free Software Foundation
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: irc-server.c,v 1.17 2002/09/07 17:57:31 alex Exp $
*
* irc-server.c: IRC-Befehle fuer Server-Links
* IRC commands for server links
*/
#include "portab.h"
static char UNUSED id[] = "$Id: irc-server.c,v 1.24 2002/12/12 12:24:18 alex Exp $";
#include "imp.h"
#include <assert.h>
#include <stdio.h>
@@ -47,6 +46,7 @@ IRC_SERVER( CLIENT *Client, REQUEST *Req )
INT max_hops, i;
CHANNEL *chan;
BOOLEAN ok;
CONN_ID con;
assert( Client != NULL );
assert( Req != NULL );
@@ -71,10 +71,10 @@ IRC_SERVER( CLIENT *Client, REQUEST *Req )
Conn_Close( Client_Conn( Client ), NULL, "Server not configured here", TRUE );
return DISCONNECTED;
}
if( strcmp( Client_Password( Client ), Conf_Server[i].pwd ) != 0 )
if( strcmp( Client_Password( Client ), Conf_Server[i].pwd_in ) != 0 )
{
/* Falsches Passwort */
Log( LOG_ERR, "Connection %d: Bad password for server \"%s\"!", Client_Conn( Client ), Req->argv[0] );
Log( LOG_ERR, "Connection %d: Got bad password from server \"%s\"!", Client_Conn( Client ), Req->argv[0] );
Conn_Close( Client_Conn( Client ), NULL, "Bad password", TRUE );
return DISCONNECTED;
}
@@ -89,15 +89,16 @@ IRC_SERVER( CLIENT *Client, REQUEST *Req )
/* Meldet sich der Server bei uns an (d.h., bauen nicht wir
* selber die Verbindung zu einem anderen Server auf)? */
con = Client_Conn( Client );
if( Client_Token( Client ) != TOKEN_OUTBOUND )
{
/* Eingehende Verbindung: Unseren SERVER- und PASS-Befehl senden */
ok = TRUE;
if( ! IRC_WriteStrClient( Client, "PASS %s %s", Conf_Server[i].pwd, NGIRCd_ProtoID )) ok = FALSE;
if( ! IRC_WriteStrClient( Client, "PASS %s %s", Conf_Server[i].pwd_out, NGIRCd_ProtoID )) ok = FALSE;
else ok = IRC_WriteStrClient( Client, "SERVER %s 1 :%s", Conf_ServerName, Conf_ServerInfo );
if( ! ok )
{
Conn_Close( Client_Conn( Client ), "Unexpected server behavior!", NULL, FALSE );
Conn_Close( con, "Unexpected server behavior!", NULL, FALSE );
return DISCONNECTED;
}
Client_SetIntroducer( Client, Client );
@@ -110,9 +111,23 @@ IRC_SERVER( CLIENT *Client, REQUEST *Req )
Client_SetToken( Client, atoi( Req->argv[1] ));
}
Log( LOG_NOTICE|LOG_snotice, "Server \"%s\" registered (connection %d, 1 hop - direct link).", Client_ID( Client ), Client_Conn( Client ));
Log( LOG_NOTICE|LOG_snotice, "Server \"%s\" registered (connection %d, 1 hop - direct link).", Client_ID( Client ), con );
Client_SetType( Client, CLIENT_SERVER );
Conn_SetServer( con, i );
#ifdef USE_ZLIB
/* Kompression initialisieren, wenn erforderlich */
if( strchr( Client_Flags( Client ), 'Z' ))
{
if( ! Conn_InitZip( con ))
{
/* Fehler! */
Conn_Close( con, "Can't inizialize compression (zlib)!", NULL, FALSE );
return DISCONNECTED;
}
}
#endif
/* maximalen Hop Count ermitteln */
max_hops = 0;
@@ -188,7 +203,7 @@ IRC_SERVER( CLIENT *Client, REQUEST *Req )
if( strlen( str ) > ( LINE_LEN - CLIENT_NICK_LEN - 8 ))
{
/* Zeile senden */
if( ! IRC_WriteStrClient( Client, str )) return DISCONNECTED;
if( ! IRC_WriteStrClient( Client, "%s", str )) return DISCONNECTED;
sprintf( str, "NJOIN %s :", Channel_Name( chan ));
}
@@ -199,7 +214,7 @@ IRC_SERVER( CLIENT *Client, REQUEST *Req )
if( str[strlen( str ) - 1] != ':')
{
/* Ja; Also senden ... */
if( ! IRC_WriteStrClient( Client, str )) return DISCONNECTED;
if( ! IRC_WriteStrClient( Client, "%s", str )) return DISCONNECTED;
}
/* naechsten Channel suchen */
@@ -266,8 +281,6 @@ IRC_NJOIN( CLIENT *Client, REQUEST *Req )
assert( Client != NULL );
assert( Req != NULL );
if( Client_Type( Client ) != CLIENT_SERVER ) return IRC_WriteStrClient( Client, ERR_NOTREGISTEREDSERVER_MSG, Client_ID( Client ));
/* Falsche Anzahl Parameter? */
if( Req->argc != 2 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
@@ -331,17 +344,11 @@ IRC_SQUIT( CLIENT *Client, REQUEST *Req )
assert( Client != NULL );
assert( Req != NULL );
/* SQUIT ist nur fuer Server erlaubt */
if( Client_Type( Client ) != CLIENT_SERVER ) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
/* Falsche Anzahl Parameter? */
if( Req->argc != 2 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
Log( LOG_DEBUG, "Got SQUIT from %s for \"%s\": \"%s\" ...", Client_ID( Client ), Req->argv[0], Req->argv[1] );
/* SQUIT an alle Server weiterleiten */
IRC_WriteStrServers( Client, "SQUIT %s :%s", Req->argv[0], Req->argv[1] );
target = Client_Search( Req->argv[0] );
if( ! target )
{

View File

@@ -2,16 +2,15 @@
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
*
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* der GNU General Public License (GPL), wie von der Free Software Foundation
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: irc-server.h,v 1.3 2002/05/27 13:09:27 alex Exp $
* $Id: irc-server.h,v 1.4 2002/12/12 12:23:43 alex Exp $
*
* irc-server.h: IRC-Befehle fuer Server-Links (Header)
* IRC commands for server links (header)
*/

View File

@@ -2,21 +2,20 @@
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
*
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* der GNU General Public License (GPL), wie von der Free Software Foundation
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: irc-write.c,v 1.8 2002/09/17 17:11:56 alex Exp $
*
* irc-write.c: IRC-Texte und Befehle ueber Netzwerk versenden
* Sending IRC commands over the network
*/
#include "portab.h"
static char UNUSED id[] = "$Id: irc-write.c,v 1.13 2002/12/12 12:24:18 alex Exp $";
#include "imp.h"
#include <assert.h>
#include <stdarg.h>
@@ -32,6 +31,10 @@
#include "irc-write.h"
#define SEND_TO_USER 1
#define SEND_TO_SERVER 2
LOCAL CHAR *Get_Prefix PARAMS(( CLIENT *Target, CLIENT *Client ));
@@ -62,7 +65,7 @@ va_dcl
va_end( ap );
/* an den Client selber */
ok = IRC_WriteStrClientPrefix( Client, Client_ThisServer( ), buffer );
ok = IRC_WriteStrClientPrefix( Client, Client_ThisServer( ), "%s", buffer );
return ok;
} /* IRC_WriteStrClient */
@@ -128,7 +131,7 @@ va_dcl
vsnprintf( buffer, 1000, Format, ap );
va_end( ap );
return IRC_WriteStrChannelPrefix( Client, Chan, Client_ThisServer( ), Remote, buffer );
return IRC_WriteStrChannelPrefix( Client, Chan, Client_ThisServer( ), Remote, "%s", buffer );
} /* IRC_WriteStrChannel */
@@ -146,11 +149,11 @@ CHAR *Format;
va_dcl
#endif
{
BOOLEAN sock[MAX_CONNECTIONS], is_server[MAX_CONNECTIONS], ok = CONNECTED;
BOOLEAN ok = CONNECTED;
CHAR buffer[1000];
CL2CHAN *cl2chan;
CONN_ID conn;
CLIENT *c;
INT s, i;
va_list ap;
assert( Client != NULL );
@@ -166,7 +169,7 @@ va_dcl
vsnprintf( buffer, 1000, Format, ap );
va_end( ap );
for( i = 0; i < MAX_CONNECTIONS; i++ ) sock[i] = FALSE;
Conn_ClearFlags( );
/* An alle Clients, die in den selben Channels sind.
* Dabei aber nur einmal je Remote-Server */
@@ -184,26 +187,26 @@ va_dcl
if( c && ( c != Client ))
{
/* Ok, anderer Client */
s = Client_Conn( c );
assert( s >= 0 );
assert( s < MAX_CONNECTIONS );
sock[s] = TRUE;
if( Client_Type( c ) == CLIENT_SERVER ) is_server[s] = TRUE;
else is_server[s] = FALSE;
conn = Client_Conn( c );
if( Client_Type( c ) == CLIENT_SERVER ) Conn_SetFlag( conn, SEND_TO_SERVER );
else Conn_SetFlag( conn, SEND_TO_USER );
}
cl2chan = Channel_NextMember( Chan, cl2chan );
}
/* Senden ... */
for( i = 0; i < MAX_CONNECTIONS; i++ )
/* Senden: alle Verbindungen durchgehen ... */
conn = Conn_First( );
while( conn != NONE )
{
if( sock[i] )
{
if( is_server[i] ) ok = Conn_WriteStr( i, ":%s %s", Client_ID( Prefix ), buffer );
else ok = Conn_WriteStr( i, ":%s %s", Client_Mask( Prefix ), buffer );
/* muessen Daten ueber diese Verbindung verschickt werden? */
if( Conn_Flag( conn ) == SEND_TO_SERVER) ok = Conn_WriteStr( conn, ":%s %s", Client_ID( Prefix ), buffer );
else if( Conn_Flag( conn ) == SEND_TO_USER ) ok = Conn_WriteStr( conn, ":%s %s", Client_Mask( Prefix ), buffer );
if( ! ok ) break;
/* naechste Verbindung testen */
conn = Conn_Next( conn );
}
}
return ok;
} /* IRC_WriteStrChannelPrefix */
@@ -233,7 +236,7 @@ va_dcl
va_end( ap );
/* an den Client selber */
IRC_WriteStrServersPrefix( ExceptOf, Client_ThisServer( ), buffer );
IRC_WriteStrServersPrefix( ExceptOf, Client_ThisServer( ), "%s", buffer );
} /* IRC_WriteStrServers */
@@ -263,7 +266,7 @@ va_dcl
vsnprintf( buffer, 1000, Format, ap );
va_end( ap );
IRC_WriteStrServersPrefixFlag( ExceptOf, Prefix, '\0', buffer );
IRC_WriteStrServersPrefixFlag( ExceptOf, Prefix, '\0', "%s", buffer );
} /* IRC_WriteStrServersPrefix */
@@ -301,7 +304,7 @@ va_dcl
if(( Client_Type( c ) == CLIENT_SERVER ) && ( Client_Conn( c ) > NONE ) && ( c != Client_ThisServer( )) && ( c != ExceptOf ))
{
/* Ziel-Server gefunden. Nun noch pruefen, ob Flags stimmen */
if(( Flag == '\0' ) || ( strchr( Client_Flags( c ), Flag ) != NULL )) IRC_WriteStrClientPrefix( c, Prefix, buffer );
if(( Flag == '\0' ) || ( strchr( Client_Flags( c ), Flag ) != NULL )) IRC_WriteStrClientPrefix( c, Prefix, "%s", buffer );
}
c = Client_Next( c );
}
@@ -321,13 +324,13 @@ CHAR *Format;
va_dcl
#endif
{
BOOLEAN sock[MAX_CONNECTIONS], is_server[MAX_CONNECTIONS], ok = CONNECTED;
BOOLEAN ok = CONNECTED;
CL2CHAN *chan_cl2chan, *cl2chan;
CHAR buffer[1000];
CHANNEL *chan;
CONN_ID conn;
va_list ap;
CLIENT *c;
INT i, s;
assert( Client != NULL );
assert( Prefix != NULL );
@@ -342,7 +345,7 @@ va_dcl
va_end( ap );
/* initialisieren */
for( i = 0; i < MAX_CONNECTIONS; i++ ) sock[i] = FALSE;
Conn_ClearFlags( );
/* An alle Clients, die in einem Channel mit dem "Ausloeser" sind,
* den Text schicken. An Remote-Server aber jeweils nur einmal. */
@@ -365,12 +368,9 @@ va_dcl
if( c && ( c != Client ))
{
/* Ok, anderer Client */
s = Client_Conn( c );
assert( s >= 0 );
assert( s < MAX_CONNECTIONS );
sock[s] = TRUE;
if( Client_Type( c ) == CLIENT_SERVER ) is_server[s] = TRUE;
else is_server[s] = FALSE;
conn = Client_Conn( c );
if( Client_Type( c ) == CLIENT_SERVER ) Conn_SetFlag( conn, SEND_TO_SERVER );
else Conn_SetFlag( conn, SEND_TO_USER );
}
cl2chan = Channel_NextMember( chan, cl2chan );
}
@@ -379,15 +379,17 @@ va_dcl
chan_cl2chan = Channel_NextChannelOf( Client, chan_cl2chan );
}
/* Senden ... */
for( i = 0; i < MAX_CONNECTIONS; i++ )
/* Senden: alle Verbindungen durchgehen ... */
conn = Conn_First( );
while( conn != NONE )
{
if( sock[i] )
{
if( is_server[i] ) ok = Conn_WriteStr( i, ":%s %s", Client_ID( Prefix ), buffer );
else ok = Conn_WriteStr( i, ":%s %s", Client_Mask( Prefix ), buffer );
/* muessen ueber diese Verbindung Daten gesendet werden? */
if( Conn_Flag( conn ) == SEND_TO_SERVER ) ok = Conn_WriteStr( conn, ":%s %s", Client_ID( Prefix ), buffer );
else if( Conn_Flag( conn ) == SEND_TO_USER ) ok = Conn_WriteStr( conn, ":%s %s", Client_Mask( Prefix ), buffer );
if( ! ok ) break;
}
/* naechste Verbindung testen */
conn = Conn_Next( conn );
}
return ok;
} /* IRC_WriteStrRelatedPrefix */

View File

@@ -2,16 +2,15 @@
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
*
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* der GNU General Public License (GPL), wie von der Free Software Foundation
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: irc-write.h,v 1.4 2002/09/03 23:56:06 alex Exp $
* $Id: irc-write.h,v 1.5 2002/12/12 12:23:43 alex Exp $
*
* irc-write.h: IRC-Texte und Befehle ueber Netzwerk versenden (Header)
* Sending IRC commands over the network (header)
*/

View File

@@ -2,58 +2,129 @@
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
*
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* der GNU General Public License (GPL), wie von der Free Software Foundation
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: irc.c,v 1.95 2002/09/16 09:14:45 alex Exp $
*
* irc.c: IRC-Befehle
* IRC commands
*/
#include "portab.h"
static char UNUSED id[] = "$Id: irc.c,v 1.107.2.3 2002/12/31 15:48:33 alex Exp $";
#include "imp.h"
#include <assert.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "ngircd.h"
#include "conn.h"
#include "client.h"
#include "channel.h"
#include "resolve.h"
#include "conf.h"
#include "conn.h"
#include "defines.h"
#include "irc-write.h"
#include "log.h"
#include "messages.h"
#include "parse.h"
#include "tool.h"
#include "exp.h"
#include "irc.h"
GLOBAL BOOLEAN
IRC_MOTD( CLIENT *Client, REQUEST *Req )
IRC_ERROR( CLIENT *Client, REQUEST *Req )
{
assert( Client != NULL );
assert( Req != NULL );
if( Client_Type( Client ) != CLIENT_USER ) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
if( Req->argc < 1 ) Log( LOG_NOTICE, "Got ERROR from \"%s\"!", Client_Mask( Client ));
else Log( LOG_NOTICE, "Got ERROR from \"%s\": %s!", Client_Mask( Client ), Req->argv[0] );
return CONNECTED;
} /* IRC_ERROR */
GLOBAL BOOLEAN
IRC_KILL( CLIENT *Client, REQUEST *Req )
{
CLIENT *prefix, *c;
CHAR reason[COMMAND_LEN];
CONN_ID my_conn, conn;
assert( Client != NULL );
assert( Req != NULL );
/* Is the user an IRC operator? */
if(( Client_Type( Client ) != CLIENT_SERVER ) && ( ! Client_OperByMe( Client ))) return IRC_WriteStrClient( Client, ERR_NOPRIVILEGES_MSG, Client_ID( Client ));
/* Bad number of parameters? */
if(( Req->argc != 2 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
if( Req->prefix ) prefix = Client_Search( Req->prefix );
else prefix = Client;
if( ! prefix )
{
Log( LOG_WARNING, "Got KILL with invalid prefix: \"%s\"!", Req->prefix );
prefix = Client_ThisServer( );
}
Log( LOG_NOTICE|LOG_snotice, "Got KILL command from \"%s\" for \"%s\": %s", Client_Mask( prefix ), Req->argv[0], Req->argv[1] );
/* Build reason string */
if( Client_Type( Client ) == CLIENT_USER ) sprintf( reason, "KILLed by %s: %s", Client_ID( Client ), Req->argv[1] );
else strcpy( reason, Req->argv[1] );
/* Inform other servers */
IRC_WriteStrServersPrefix( Client, prefix, "KILL %s :%s", Req->argv[0], reason );
/* Save ID of this connection */
my_conn = Client_Conn( Client );
/* Do we host such a client? */
c = Client_Search( Req->argv[0] );
if( c && Client_Type( c ) == CLIENT_USER )
{
/* Yes, I found it! */
conn = Client_Conn( c );
Client_Destroy( c, NULL, reason, FALSE );
if( conn != NONE ) Conn_Close( Client_Conn( c ), NULL, reason, TRUE );
}
else Log( LOG_NOTICE, "Client with nick \"%s\" is unknown here.", Req->argv[0] );
/* Are we still connected or were we killed, too? */
if( Client_GetFromConn( my_conn )) return CONNECTED;
else return DISCONNECTED;
} /* IRC_KILL */
GLOBAL BOOLEAN
IRC_NOTICE( CLIENT *Client, REQUEST *Req )
{
CLIENT *to, *from;
assert( Client != NULL );
assert( Req != NULL );
if(( Client_Type( Client ) != CLIENT_USER ) && ( Client_Type( Client ) != CLIENT_SERVER )) return CONNECTED;
/* Falsche Anzahl Parameter? */
if( Req->argc != 0 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
if( Req->argc != 2 ) return CONNECTED;
return IRC_Show_MOTD( Client );
} /* IRC_MOTD */
if( Client_Type( Client ) == CLIENT_SERVER ) from = Client_Search( Req->prefix );
else from = Client;
if( ! from ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
to = Client_Search( Req->argv[0] );
if(( to ) && ( Client_Type( to ) == CLIENT_USER ))
{
/* Okay, Ziel ist ein User */
return IRC_WriteStrClientPrefix( to, from, "NOTICE %s :%s", Client_ID( to ), Req->argv[1] );
}
else return CONNECTED;
} /* IRC_NOTICE */
GLOBAL BOOLEAN
@@ -65,8 +136,6 @@ IRC_PRIVMSG( CLIENT *Client, REQUEST *Req )
assert( Client != NULL );
assert( Req != NULL );
if(( Client_Type( Client ) != CLIENT_USER ) && ( Client_Type( Client ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
/* Falsche Anzahl Parameter? */
if( Req->argc == 0 ) return IRC_WriteStrClient( Client, ERR_NORECIPIENT_MSG, Client_ID( Client ), Req->command );
if( Req->argc == 1 ) return IRC_WriteStrClient( Client, ERR_NOTEXTTOSEND_MSG, Client_ID( Client ));
@@ -101,768 +170,4 @@ IRC_PRIVMSG( CLIENT *Client, REQUEST *Req )
} /* IRC_PRIVMSG */
GLOBAL BOOLEAN
IRC_NOTICE( CLIENT *Client, REQUEST *Req )
{
CLIENT *to, *from;
assert( Client != NULL );
assert( Req != NULL );
if(( Client_Type( Client ) != CLIENT_USER ) && ( Client_Type( Client ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
/* Falsche Anzahl Parameter? */
if( Req->argc != 2 ) return CONNECTED;
if( Client_Type( Client ) == CLIENT_SERVER ) from = Client_Search( Req->prefix );
else from = Client;
if( ! from ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
to = Client_Search( Req->argv[0] );
if(( to ) && ( Client_Type( to ) == CLIENT_USER ))
{
/* Okay, Ziel ist ein User */
return IRC_WriteStrClientPrefix( to, from, "NOTICE %s :%s", Client_ID( to ), Req->argv[1] );
}
else return CONNECTED;
} /* IRC_NOTICE */
GLOBAL BOOLEAN
IRC_NAMES( CLIENT *Client, REQUEST *Req )
{
CHAR rpl[COMMAND_LEN], *ptr;
CLIENT *target, *from, *c;
CHANNEL *chan;
assert( Client != NULL );
assert( Req != NULL );
if(( Client_Type( Client ) != CLIENT_USER ) && ( Client_Type( Client ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
/* Falsche Anzahl Parameter? */
if( Req->argc > 2 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
/* From aus Prefix ermitteln */
if( Client_Type( Client ) == CLIENT_SERVER ) from = Client_Search( Req->prefix );
else from = Client;
if( ! from ) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->prefix );
if( Req->argc == 2 )
{
/* an anderen Server forwarden */
target = Client_Search( Req->argv[1] );
if( ! target ) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[1] );
if( target != Client_ThisServer( ))
{
/* Ok, anderer Server ist das Ziel: forwarden */
return IRC_WriteStrClientPrefix( target, from, "NAMES %s :%s", Req->argv[0], Req->argv[1] );
}
}
if( Req->argc > 0 )
{
/* bestimmte Channels durchgehen */
ptr = strtok( Req->argv[0], "," );
while( ptr )
{
chan = Channel_Search( ptr );
if( chan )
{
/* Namen ausgeben */
if( ! IRC_Send_NAMES( from, chan )) return DISCONNECTED;
}
if( ! IRC_WriteStrClient( from, RPL_ENDOFNAMES_MSG, Client_ID( from ), ptr )) return DISCONNECTED;
/* naechsten Namen ermitteln */
ptr = strtok( NULL, "," );
}
return CONNECTED;
}
/* alle Channels durchgehen */
chan = Channel_First( );
while( chan )
{
/* Namen ausgeben */
if( ! IRC_Send_NAMES( from, chan )) return DISCONNECTED;
/* naechster Channel */
chan = Channel_Next( chan );
}
/* Nun noch alle Clients ausgeben, die in keinem Channel sind */
c = Client_First( );
sprintf( rpl, RPL_NAMREPLY_MSG, Client_ID( from ), "*", "*" );
while( c )
{
if(( Client_Type( c ) == CLIENT_USER ) && ( Channel_FirstChannelOf( c ) == NULL ) && ( ! strchr( Client_Modes( c ), 'i' )))
{
/* Okay, das ist ein User: anhaengen */
if( rpl[strlen( rpl ) - 1] != ':' ) strcat( rpl, " " );
strcat( rpl, Client_ID( c ));
if( strlen( rpl ) > ( LINE_LEN - CLIENT_NICK_LEN - 4 ))
{
/* Zeile wird zu lang: senden! */
if( ! IRC_WriteStrClient( from, rpl )) return DISCONNECTED;
sprintf( rpl, RPL_NAMREPLY_MSG, Client_ID( from ), "*", "*" );
}
}
/* naechster Client */
c = Client_Next( c );
}
if( rpl[strlen( rpl ) - 1] != ':')
{
/* es wurden User gefunden */
if( ! IRC_WriteStrClient( from, rpl )) return DISCONNECTED;
}
return IRC_WriteStrClient( from, RPL_ENDOFNAMES_MSG, Client_ID( from ), "*" );
} /* IRC_NAMES */
GLOBAL BOOLEAN
IRC_ISON( CLIENT *Client, REQUEST *Req )
{
CHAR rpl[COMMAND_LEN];
CLIENT *c;
CHAR *ptr;
INT i;
assert( Client != NULL );
assert( Req != NULL );
if( Client_Type( Client ) != CLIENT_USER ) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
/* Falsche Anzahl Parameter? */
if(( Req->argc < 1 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
strcpy( rpl, RPL_ISON_MSG );
for( i = 0; i < Req->argc; i++ )
{
ptr = strtok( Req->argv[i], " " );
while( ptr )
{
ngt_TrimStr( ptr );
c = Client_Search( ptr );
if( c && ( Client_Type( c ) == CLIENT_USER ))
{
/* Dieser Nick ist "online" */
strcat( rpl, ptr );
strcat( rpl, " " );
}
ptr = strtok( NULL, " " );
}
}
if( rpl[strlen( rpl ) - 1] == ' ' ) rpl[strlen( rpl ) - 1] = '\0';
return IRC_WriteStrClient( Client, rpl, Client_ID( Client ) );
} /* IRC_ISON */
GLOBAL BOOLEAN
IRC_WHOIS( CLIENT *Client, REQUEST *Req )
{
CLIENT *from, *target, *c;
CHAR str[LINE_LEN + 1], *ptr = NULL;
CL2CHAN *cl2chan;
CHANNEL *chan;
assert( Client != NULL );
assert( Req != NULL );
if(( Client_Type( Client ) != CLIENT_USER ) && ( Client_Type( Client ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
/* Falsche Anzahl Parameter? */
if(( Req->argc < 1 ) || ( Req->argc > 2 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
/* Client suchen */
c = Client_Search( Req->argv[Req->argc - 1] );
if(( ! c ) || ( Client_Type( c ) != CLIENT_USER )) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->argv[Req->argc - 1] );
/* Empfaenger des WHOIS suchen */
if( Client_Type( Client ) == CLIENT_SERVER ) from = Client_Search( Req->prefix );
else from = Client;
if( ! from ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
/* Forwarden an anderen Server? */
if( Req->argc > 1 )
{
/* angegebenen Ziel-Server suchen */
target = Client_Search( Req->argv[1] );
if( ! target ) return IRC_WriteStrClient( from, ERR_NOSUCHSERVER_MSG, Client_ID( from ), Req->argv[1] );
ptr = Req->argv[1];
}
else target = Client_ThisServer( );
assert( target != NULL );
if(( Client_NextHop( target ) != Client_ThisServer( )) && ( Client_Type( Client_NextHop( target )) == CLIENT_SERVER )) return IRC_WriteStrClientPrefix( target, from, "WHOIS %s :%s", Req->argv[0], ptr );
/* Nick, User und Name */
if( ! IRC_WriteStrClient( from, RPL_WHOISUSER_MSG, Client_ID( from ), Client_ID( c ), Client_User( c ), Client_Hostname( c ), Client_Info( c ))) return DISCONNECTED;
/* Server */
if( ! IRC_WriteStrClient( from, RPL_WHOISSERVER_MSG, Client_ID( from ), Client_ID( c ), Client_ID( Client_Introducer( c )), Client_Info( Client_Introducer( c )))) return DISCONNECTED;
/* Channels */
sprintf( str, RPL_WHOISCHANNELS_MSG, Client_ID( from ), Client_ID( c ));
cl2chan = Channel_FirstChannelOf( c );
while( cl2chan )
{
chan = Channel_GetChannel( cl2chan );
assert( chan != NULL );
/* Channel-Name anhaengen */
if( str[strlen( str ) - 1] != ':' ) strcat( str, " " );
if( strchr( Channel_UserModes( chan, c ), 'o' )) strcat( str, "@" );
else if( strchr( Channel_UserModes( chan, c ), 'v' )) strcat( str, "+" );
strcat( str, Channel_Name( chan ));
if( strlen( str ) > ( LINE_LEN - CHANNEL_NAME_LEN - 4 ))
{
/* Zeile wird zu lang: senden! */
if( ! IRC_WriteStrClient( Client, str )) return DISCONNECTED;
sprintf( str, RPL_WHOISCHANNELS_MSG, Client_ID( from ), Client_ID( c ));
}
/* naechstes Mitglied suchen */
cl2chan = Channel_NextChannelOf( c, cl2chan );
}
if( str[strlen( str ) - 1] != ':')
{
/* Es sind noch Daten da, die gesendet werden muessen */
if( ! IRC_WriteStrClient( Client, str )) return DISCONNECTED;
}
/* IRC-Operator? */
if( Client_HasMode( c, 'o' ))
{
if( ! IRC_WriteStrClient( from, RPL_WHOISOPERATOR_MSG, Client_ID( from ), Client_ID( c ))) return DISCONNECTED;
}
/* Idle (nur lokale Clients) */
if( Client_Conn( c ) > NONE )
{
if( ! IRC_WriteStrClient( from, RPL_WHOISIDLE_MSG, Client_ID( from ), Client_ID( c ), Conn_GetIdle( Client_Conn ( c )))) return DISCONNECTED;
}
/* Away? */
if( Client_HasMode( c, 'a' ))
{
if( ! IRC_WriteStrClient( from, RPL_AWAY_MSG, Client_ID( from ), Client_ID( c ), Client_Away( c ))) return DISCONNECTED;
}
/* End of Whois */
return IRC_WriteStrClient( from, RPL_ENDOFWHOIS_MSG, Client_ID( from ), Client_ID( c ));
} /* IRC_WHOIS */
GLOBAL BOOLEAN
IRC_WHO( CLIENT *Client, REQUEST *Req )
{
BOOLEAN ok, only_ops;
CHAR flags[8], *ptr;
CL2CHAN *cl2chan;
CHANNEL *chan;
CLIENT *c;
assert( Client != NULL );
assert( Req != NULL );
if( Client_Type( Client ) != CLIENT_USER ) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
/* Falsche Anzahl Parameter? */
if(( Req->argc > 2 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
only_ops = FALSE;
chan = NULL;
if( Req->argc == 2 )
{
/* Nur OPs anzeigen? */
if( strcmp( Req->argv[1], "o" ) == 0 ) only_ops = TRUE;
#ifdef STRICT_RFC
else return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
#endif
}
if( Req->argc >= 1 )
{
/* wurde ein Channel oder Nick-Mask angegeben? */
chan = Channel_Search( Req->argv[0] );
}
if( chan )
{
/* User eines Channels ausgeben */
if( ! IRC_Send_WHO( Client, chan, only_ops )) return DISCONNECTED;
}
c = Client_First( );
while( c )
{
if(( Client_Type( c ) == CLIENT_USER ) && ( ! strchr( Client_Modes( c ), 'i' )))
{
ok = FALSE;
if( Req->argc == 0 ) ok = TRUE;
else
{
if( strcasecmp( Req->argv[0], Client_ID( c )) == 0 ) ok = TRUE;
else if( strcmp( Req->argv[0], "0" ) == 0 ) ok = TRUE;
}
if( ok && (( ! only_ops ) || ( strchr( Client_Modes( c ), 'o' ))))
{
/* Flags zusammenbasteln */
strcpy( flags, "H" );
if( strchr( Client_Modes( c ), 'o' )) strcat( flags, "*" );
/* ausgeben */
cl2chan = Channel_FirstChannelOf( c );
if( cl2chan ) ptr = Channel_Name( Channel_GetChannel( cl2chan ));
else ptr = "*";
if( ! IRC_WriteStrClient( Client, RPL_WHOREPLY_MSG, Client_ID( Client ), ptr, Client_User( c ), Client_Hostname( c ), Client_ID( Client_Introducer( c )), Client_ID( c ), flags, Client_Hops( c ), Client_Info( c ))) return DISCONNECTED;
}
}
/* naechster Client */
c = Client_Next( c );
}
if( chan ) return IRC_WriteStrClient( Client, RPL_ENDOFWHO_MSG, Client_ID( Client ), Channel_Name( chan ));
else if( Req->argc == 0 ) return IRC_WriteStrClient( Client, RPL_ENDOFWHO_MSG, Client_ID( Client ), "*" );
else return IRC_WriteStrClient( Client, RPL_ENDOFWHO_MSG, Client_ID( Client ), Req->argv[0] );
} /* IRC_WHO */
GLOBAL BOOLEAN
IRC_USERHOST( CLIENT *Client, REQUEST *Req )
{
CHAR rpl[COMMAND_LEN];
CLIENT *c;
INT max, i;
assert( Client != NULL );
assert( Req != NULL );
if( Client_Type( Client ) != CLIENT_USER ) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
/* Falsche Anzahl Parameter? */
if(( Req->argc < 1 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
if( Req->argc > 5 ) max = 5;
else max = Req->argc;
strcpy( rpl, RPL_USERHOST_MSG );
for( i = 0; i < max; i++ )
{
c = Client_Search( Req->argv[i] );
if( c && ( Client_Type( c ) == CLIENT_USER ))
{
/* Dieser Nick ist "online" */
strcat( rpl, Client_ID( c ));
if( Client_HasMode( c, 'o' )) strcat( rpl, "*" );
strcat( rpl, "=" );
if( Client_HasMode( c, 'a' )) strcat( rpl, "-" );
else strcat( rpl, "+" );
strcat( rpl, Client_User( c ));
strcat( rpl, "@" );
strcat( rpl, Client_Hostname( c ));
strcat( rpl, " " );
}
}
if( rpl[strlen( rpl ) - 1] == ' ' ) rpl[strlen( rpl ) - 1] = '\0';
return IRC_WriteStrClient( Client, rpl, Client_ID( Client ) );
} /* IRC_USERHOST */
GLOBAL BOOLEAN
IRC_ERROR( CLIENT *Client, REQUEST *Req )
{
assert( Client != NULL );
assert( Req != NULL );
if( Req->argc < 1 ) Log( LOG_NOTICE, "Got ERROR from \"%s\"!", Client_Mask( Client ));
else Log( LOG_NOTICE, "Got ERROR from \"%s\": %s!", Client_Mask( Client ), Req->argv[0] );
return CONNECTED;
} /* IRC_ERROR */
GLOBAL BOOLEAN
IRC_LUSERS( CLIENT *Client, REQUEST *Req )
{
CLIENT *target, *from;
assert( Client != NULL );
assert( Req != NULL );
if(( Client_Type( Client ) != CLIENT_USER ) && ( Client_Type( Client ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
/* Falsche Anzahl Parameter? */
if(( Req->argc > 2 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
/* Absender ermitteln */
if( Client_Type( Client ) == CLIENT_SERVER ) from = Client_Search( Req->prefix );
else from = Client;
if( ! from ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
/* An anderen Server forwarden? */
if( Req->argc == 2 )
{
target = Client_Search( Req->argv[1] );
if( ! target ) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[1] );
else if( target != Client_ThisServer( )) return IRC_WriteStrClientPrefix( target, from, "LUSERS %s %s", Req->argv[0], Req->argv[1] );
}
/* Wer ist der Absender? */
if( Client_Type( Client ) == CLIENT_SERVER ) target = Client_Search( Req->prefix );
else target = Client;
if( ! target ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
IRC_Send_LUSERS( target );
return CONNECTED;
} /* IRC_LUSERS */
GLOBAL BOOLEAN
IRC_LINKS( CLIENT *Client, REQUEST *Req )
{
CLIENT *target, *from, *c;
CHAR *mask;
assert( Client != NULL );
assert( Req != NULL );
if(( Client_Type( Client ) != CLIENT_USER ) && ( Client_Type( Client ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
/* Falsche Anzahl Parameter? */
if(( Req->argc > 2 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
/* Server-Mask ermitteln */
if( Req->argc > 0 ) mask = Req->argv[Req->argc - 1];
else mask = "*";
/* Absender ermitteln */
if( Client_Type( Client ) == CLIENT_SERVER ) from = Client_Search( Req->prefix );
else from = Client;
if( ! from ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
/* An anderen Server forwarden? */
if( Req->argc == 2 )
{
target = Client_Search( Req->argv[0] );
if( ! target ) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[0] );
else if( target != Client_ThisServer( )) return IRC_WriteStrClientPrefix( target, from, "LINKS %s %s", Req->argv[0], Req->argv[1] );
}
/* Wer ist der Absender? */
if( Client_Type( Client ) == CLIENT_SERVER ) target = Client_Search( Req->prefix );
else target = Client;
if( ! target ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
c = Client_First( );
while( c )
{
if( Client_Type( c ) == CLIENT_SERVER )
{
if( ! IRC_WriteStrClient( target, RPL_LINKS_MSG, Client_ID( target ), Client_ID( c ), Client_ID( Client_TopServer( c ) ? Client_TopServer( c ) : Client_ThisServer( )), Client_Hops( c ), Client_Info( c ))) return DISCONNECTED;
}
c = Client_Next( c );
}
return IRC_WriteStrClient( target, RPL_ENDOFLINKS_MSG, Client_ID( target ), mask );
} /* IRC_LINKS */
GLOBAL BOOLEAN
IRC_VERSION( CLIENT *Client, REQUEST *Req )
{
CLIENT *target, *prefix;
assert( Client != NULL );
assert( Req != NULL );
/* Falsche Anzahl Parameter? */
if(( Req->argc > 1 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
/* Ziel suchen */
if( Req->argc == 1 ) target = Client_Search( Req->argv[0] );
else target = Client_ThisServer( );
/* Prefix ermitteln */
if( Client_Type( Client ) == CLIENT_SERVER ) prefix = Client_Search( Req->prefix );
else prefix = Client;
if( ! prefix ) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->prefix );
/* An anderen Server weiterleiten? */
if( target != Client_ThisServer( ))
{
if( ! target ) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[0] );
/* forwarden */
IRC_WriteStrClientPrefix( target, prefix, "VERSION %s", Req->argv[0] );
return CONNECTED;
}
/* mit Versionsinfo antworten */
return IRC_WriteStrClient( Client, RPL_VERSION_MSG, Client_ID( prefix ), PACKAGE, VERSION, NGIRCd_DebugLevel, Conf_ServerName, NGIRCd_VersionAddition( ));
} /* IRC_VERSION */
GLOBAL BOOLEAN
IRC_KILL( CLIENT *Client, REQUEST *Req )
{
CLIENT *prefix, *c;
assert( Client != NULL );
assert( Req != NULL );
if( Client_Type( Client ) != CLIENT_SERVER ) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
/* Falsche Anzahl Parameter? */
if(( Req->argc != 2 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
prefix = Client_Search( Req->prefix );
if( ! prefix )
{
Log( LOG_WARNING, "Got KILL with invalid prefix: \"%s\"!", Req->prefix );
prefix = Client_ThisServer( );
}
Log( LOG_NOTICE, "Got KILL command from \"%s\" for \"%s\": %s", Client_Mask( prefix ), Req->argv[0], Req->argv[1] );
/* andere Server benachrichtigen */
IRC_WriteStrServersPrefix( Client, prefix, "KILL %s :%s", Req->argv[0], Req->argv[1] );
/* haben wir selber einen solchen Client? */
c = Client_Search( Req->argv[0] );
if( c )
{
/* Ja, wir haben einen solchen Client */
if( Client_Conn( c ) != NONE ) Conn_Close( Client_Conn( c ), NULL, Req->argv[1], TRUE );
else Client_Destroy( c, NULL, Req->argv[1], TRUE );
}
else Log( LOG_NOTICE, "Client with nick \"%s\" is unknown here.", Req->argv[0] );
return CONNECTED;
} /* IRC_KILL */
GLOBAL BOOLEAN
IRC_ADMIN(CLIENT *Client, REQUEST *Req )
{
CLIENT *target, *prefix;
assert( Client != NULL );
assert( Req != NULL );
if(( Client_Type( Client ) != CLIENT_USER ) && ( Client_Type( Client ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
/* Falsche Anzahl Parameter? */
if(( Req->argc > 1 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
/* Ziel suchen */
if( Req->argc == 1 ) target = Client_Search( Req->argv[0] );
else target = Client_ThisServer( );
/* Prefix ermitteln */
if( Client_Type( Client ) == CLIENT_SERVER ) prefix = Client_Search( Req->prefix );
else prefix = Client;
if( ! prefix ) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->prefix );
/* An anderen Server weiterleiten? */
if( target != Client_ThisServer( ))
{
if( ! target ) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[0] );
/* forwarden */
IRC_WriteStrClientPrefix( target, prefix, "ADMIN %s", Req->argv[0] );
return CONNECTED;
}
/* mit Versionsinfo antworten */
if( ! IRC_WriteStrClient( Client, RPL_ADMINME_MSG, Client_ID( prefix ), Conf_ServerName )) return DISCONNECTED;
if( ! IRC_WriteStrClient( Client, RPL_ADMINLOC1_MSG, Client_ID( prefix ), Conf_ServerAdmin1 )) return DISCONNECTED;
if( ! IRC_WriteStrClient( Client, RPL_ADMINLOC2_MSG, Client_ID( prefix ), Conf_ServerAdmin2 )) return DISCONNECTED;
if( ! IRC_WriteStrClient( Client, RPL_ADMINEMAIL_MSG, Client_ID( prefix ), Conf_ServerAdminMail )) return DISCONNECTED;
return CONNECTED;
} /* IRC_ADMIN */
GLOBAL BOOLEAN
IRC_Show_MOTD( CLIENT *Client )
{
BOOLEAN ok;
CHAR line[127];
FILE *fd;
assert( Client != NULL );
fd = fopen( Conf_MotdFile, "r" );
if( ! fd )
{
Log( LOG_WARNING, "Can't read MOTD file \"%s\": %s", Conf_MotdFile, strerror( errno ));
return IRC_WriteStrClient( Client, ERR_NOMOTD_MSG, Client_ID( Client ) );
}
IRC_WriteStrClient( Client, RPL_MOTDSTART_MSG, Client_ID( Client ), Client_ID( Client_ThisServer( )));
while( TRUE )
{
if( ! fgets( line, 126, fd )) break;
if( line[strlen( line ) - 1] == '\n' ) line[strlen( line ) - 1] = '\0';
if( ! IRC_WriteStrClient( Client, RPL_MOTD_MSG, Client_ID( Client ), line ))
{
fclose( fd );
return FALSE;
}
}
ok = IRC_WriteStrClient( Client, RPL_ENDOFMOTD_MSG, Client_ID( Client ) );
fclose( fd );
return ok;
} /* IRC_Show_MOTD */
GLOBAL BOOLEAN
IRC_Send_NAMES( CLIENT *Client, CHANNEL *Chan )
{
BOOLEAN is_visible, is_member;
CHAR str[LINE_LEN + 1];
CL2CHAN *cl2chan;
CLIENT *cl;
assert( Client != NULL );
assert( Chan != NULL );
if( Channel_IsMemberOf( Chan, Client )) is_member = TRUE;
else is_member = FALSE;
/* Alle Mitglieder suchen */
sprintf( str, RPL_NAMREPLY_MSG, Client_ID( Client ), "=", Channel_Name( Chan ));
cl2chan = Channel_FirstMember( Chan );
while( cl2chan )
{
cl = Channel_GetClient( cl2chan );
if( strchr( Client_Modes( cl ), 'i' )) is_visible = FALSE;
else is_visible = TRUE;
if( is_member || is_visible )
{
/* Nick anhaengen */
if( str[strlen( str ) - 1] != ':' ) strcat( str, " " );
if( strchr( Channel_UserModes( Chan, cl ), 'o' )) strcat( str, "@" );
else if( strchr( Channel_UserModes( Chan, cl ), 'v' )) strcat( str, "+" );
strcat( str, Client_ID( cl ));
if( strlen( str ) > ( LINE_LEN - CLIENT_NICK_LEN - 4 ))
{
/* Zeile wird zu lang: senden! */
if( ! IRC_WriteStrClient( Client, str )) return DISCONNECTED;
sprintf( str, RPL_NAMREPLY_MSG, Client_ID( Client ), "=", Channel_Name( Chan ));
}
}
/* naechstes Mitglied suchen */
cl2chan = Channel_NextMember( Chan, cl2chan );
}
if( str[strlen( str ) - 1] != ':')
{
/* Es sind noch Daten da, die gesendet werden muessen */
if( ! IRC_WriteStrClient( Client, str )) return DISCONNECTED;
}
return CONNECTED;
} /* IRC_Send_NAMES */
GLOBAL BOOLEAN
IRC_Send_WHO( CLIENT *Client, CHANNEL *Chan, BOOLEAN OnlyOps )
{
BOOLEAN is_visible, is_member;
CL2CHAN *cl2chan;
CHAR flags[8];
CLIENT *c;
assert( Client != NULL );
assert( Chan != NULL );
if( Channel_IsMemberOf( Chan, Client )) is_member = TRUE;
else is_member = FALSE;
/* Alle Mitglieder suchen */
cl2chan = Channel_FirstMember( Chan );
while( cl2chan )
{
c = Channel_GetClient( cl2chan );
if( strchr( Client_Modes( c ), 'i' )) is_visible = FALSE;
else is_visible = TRUE;
if( is_member || is_visible )
{
/* Flags zusammenbasteln */
strcpy( flags, "H" );
if( strchr( Client_Modes( c ), 'o' )) strcat( flags, "*" );
if( strchr( Channel_UserModes( Chan, c ), 'o' )) strcat( flags, "@" );
else if( strchr( Channel_UserModes( Chan, c ), 'v' )) strcat( flags, "+" );
/* ausgeben */
if(( ! OnlyOps ) || ( strchr( Client_Modes( c ), 'o' )))
{
if( ! IRC_WriteStrClient( Client, RPL_WHOREPLY_MSG, Client_ID( Client ), Channel_Name( Chan ), Client_User( c ), Client_Hostname( c ), Client_ID( Client_Introducer( c )), Client_ID( c ), flags, Client_Hops( c ), Client_Info( c ))) return DISCONNECTED;
}
}
/* naechstes Mitglied suchen */
cl2chan = Channel_NextMember( Chan, cl2chan );
}
return CONNECTED;
} /* IRC_Send_WHO */
GLOBAL BOOLEAN
IRC_Send_LUSERS( CLIENT *Client )
{
INT cnt;
assert( Client != NULL );
/* Users, Services und Serevr im Netz */
if( ! IRC_WriteStrClient( Client, RPL_LUSERCLIENT_MSG, Client_ID( Client ), Client_UserCount( ), Client_ServiceCount( ), Client_ServerCount( ))) return DISCONNECTED;
/* IRC-Operatoren im Netz */
cnt = Client_OperCount( );
if( cnt > 0 )
{
if( ! IRC_WriteStrClient( Client, RPL_LUSEROP_MSG, Client_ID( Client ), cnt )) return DISCONNECTED;
}
/* Unbekannt Verbindungen */
cnt = Client_UnknownCount( );
if( cnt > 0 )
{
if( ! IRC_WriteStrClient( Client, RPL_LUSERUNKNOWN_MSG, Client_ID( Client ), cnt )) return DISCONNECTED;
}
/* Channels im Netz */
if( ! IRC_WriteStrClient( Client, RPL_LUSERCHANNELS_MSG, Client_ID( Client ), Channel_Count( ))) return DISCONNECTED;
/* Channels im Netz */
if( ! IRC_WriteStrClient( Client, RPL_LUSERME_MSG, Client_ID( Client ), Client_MyUserCount( ), Client_MyServiceCount( ), Client_MyServerCount( ))) return DISCONNECTED;
return CONNECTED;
} /* IRC_Send_LUSERS */
/* -eof- */

View File

@@ -2,16 +2,15 @@
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
*
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* der GNU General Public License (GPL), wie von der Free Software Foundation
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: irc.h,v 1.32 2002/09/16 09:14:45 alex Exp $
* $Id: irc.h,v 1.36 2002/12/12 12:23:43 alex Exp $
*
* irc.h: IRC-Befehle (Header)
* IRC commands (header)
*/
@@ -19,28 +18,10 @@
#define __irc_h__
GLOBAL BOOLEAN IRC_MOTD PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_LUSERS PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_LINKS PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_VERSION PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_ADMIN PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_PRIVMSG PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_NOTICE PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_NAMES PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_ISON PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_WHOIS PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_USERHOST PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_WHO PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_ERROR PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_KILL PARAMS((CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_Send_NAMES PARAMS((CLIENT *Client, CHANNEL *Chan ));
GLOBAL BOOLEAN IRC_Send_LUSERS PARAMS((CLIENT *Client ));
GLOBAL BOOLEAN IRC_Show_MOTD PARAMS((CLIENT *Client ));
GLOBAL BOOLEAN IRC_Send_WHO PARAMS((CLIENT *Client, CHANNEL *Chan, BOOLEAN OnlyOps ));
GLOBAL BOOLEAN IRC_ERROR PARAMS(( CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_KILL PARAMS(( CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_NOTICE PARAMS(( CLIENT *Client, REQUEST *Req ));
GLOBAL BOOLEAN IRC_PRIVMSG PARAMS(( CLIENT *Client, REQUEST *Req ));
#endif

View File

@@ -2,21 +2,20 @@
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
*
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* der GNU General Public License (GPL), wie von der Free Software Foundation
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: lists.c,v 1.8 2002/09/08 17:06:07 alex Exp $
*
* lists.c: Verwaltung der "IRC-Listen": Ban, Invite, ...
* Management of IRC lists: ban, invite, ...
*/
#include "portab.h"
static char UNUSED id[] = "$Id: lists.c,v 1.10 2002/12/12 12:24:18 alex Exp $";
#include "imp.h"
#include <assert.h>
@@ -323,7 +322,7 @@ Lists_MakeMask( CHAR *Pattern )
STATIC CHAR TheMask[MASK_LEN];
CHAR *excl, *at;
assert( Pattern );
assert( Pattern != NULL );
excl = strchr( Pattern, '!' );
at = strchr( Pattern, '@' );

View File

@@ -2,16 +2,15 @@
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
*
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* der GNU General Public License (GPL), wie von der Free Software Foundation
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: lists.h,v 1.8 2002/09/08 17:05:25 alex Exp $
* $Id: lists.h,v 1.9 2002/12/12 12:23:43 alex Exp $
*
* lists.h: Verwaltung der "IRC-Listen": Ban, Invite, ... (Header)
* Management of IRC lists: ban, invite, ... (header)
*/

View File

@@ -2,21 +2,20 @@
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
*
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* der GNU General Public License (GPL), wie von der Free Software Foundation
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: log.c,v 1.37 2002/09/09 22:55:21 alex Exp $
*
* log.c: Logging-Funktionen
* Logging functions
*/
#include "portab.h"
static char UNUSED id[] = "$Id: log.c,v 1.41 2002/12/12 12:24:18 alex Exp $";
#include "imp.h"
#include <assert.h>
#include <errno.h>
@@ -96,7 +95,7 @@ Log_InitErrorfile( VOID )
* landen z.B. alle Ausgaben von assert()-Aufrufen. */
/* Dateiname zusammen bauen */
sprintf( Error_File, "%s/%s-%ld.err", ERROR_DIR, PACKAGE, (INT32)getpid( ));
sprintf( Error_File, "%s/%s-%ld.err", ERROR_DIR, PACKAGE, (LONG)getpid( ));
/* stderr umlenken */
fflush( stderr );
@@ -185,7 +184,7 @@ va_dcl
else
{
/* Syslog */
syslog( Level, msg );
syslog( Level, "%s", msg );
}
#endif
@@ -280,7 +279,7 @@ Wall_ServerNotice( CHAR *Msg )
c = Client_First( );
while( c )
{
if(( Client_Conn( c ) > NONE ) && ( Client_HasMode( c, 's' ))) IRC_WriteStrClient( c, "NOTICE %s :%s", Client_ThisServer( ), Msg );
if(( Client_Conn( c ) > NONE ) && ( Client_HasMode( c, 's' ))) IRC_WriteStrClient( c, "NOTICE %s :%s%s", Client_ThisServer( ), NOTICE_TXTPREFIX, Msg );
c = Client_Next( c );
}
} /* Wall_ServerNotice */

View File

@@ -2,16 +2,15 @@
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
*
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* der GNU General Public License (GPL), wie von der Free Software Foundation
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: log.h,v 1.12 2002/05/27 13:09:27 alex Exp $
* $Id: log.h,v 1.13 2002/12/12 12:23:43 alex Exp $
*
* log.h: Logging-Funktionen (Header)
* Logging functions (header)
*/

View File

@@ -2,21 +2,20 @@
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
*
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* der GNU General Public License (GPL), wie von der Free Software Foundation
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: match.c,v 1.1 2002/06/26 15:42:58 alex Exp $
*
* match.c: Wildcard Pattern Matching
* Wildcard pattern matching
*/
#include "portab.h"
static char UNUSED id[] = "$Id: match.c,v 1.2 2002/12/12 12:24:18 alex Exp $";
#include "imp.h"
#include <assert.h>
#include <string.h>

View File

@@ -2,16 +2,15 @@
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
*
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* der GNU General Public License (GPL), wie von der Free Software Foundation
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: match.h,v 1.1 2002/06/26 15:42:58 alex Exp $
* $Id: match.h,v 1.2 2002/12/12 12:23:43 alex Exp $
*
* match.h: Wildcard Pattern Matching (Header)
* Wildcard pattern matching (header)
*/

View File

@@ -2,16 +2,15 @@
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
*
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* der GNU General Public License (GPL), wie von der Free Software Foundation
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: messages.h,v 1.46 2002/09/16 09:23:40 alex Exp $
* $Id: messages.h,v 1.59.2.1 2002/12/22 23:42:28 alex Exp $
*
* irc.h: IRC-Befehle (Header)
* IRC numerics (Header)
*/
@@ -20,19 +19,25 @@
#define RPL_WELCOME_MSG "001 %s :Welcome to the Internet Relay Network %s"
#define RPL_YOURHOST_MSG "002 %s :Your host is %s, running ngircd %s-%s/%s/%s"
#define RPL_CREATED_MSG "003 %s :This server was started %s"
#define RPL_MYINFO_MSG "004 %s :%s ngircd-%s %s %s"
#define RPL_UMODEIS_MSG "211 %s +%s"
#define RPL_LUSERCLIENT_MSG "251 %s :There are %d users and %d services on %d servers"
#define RPL_LUSEROP_MSG "252 %s %d :operator(s) online"
#define RPL_LUSERUNKNOWN_MSG "253 %s %d :unknown connection(s)"
#define RPL_LUSERCHANNELS_MSG "254 %s %d :channels formed"
#define RPL_LUSERME_MSG "255 %s :I have %d users, %d services and %d servers"
#define RPL_YOURHOST_MSG "002 %s :Your host is %s, running version ngircd-%s (%s/%s/%s)"
#define RPL_CREATED_MSG "003 %s :This server has been started %s"
#define RPL_MYINFO_MSG "004 %s %s ngircd-%s %s %s"
#define RPL_FEATURE_MSG "005 %s NICKLEN=%d TOPICLEN=%d AWAYLEN=%d MAXCHANNELS=%d :are supported on this server"
#define RPL_STATSLINKINFO_MSG "211 %s %s %d %ld %ld %ld %ld :%ld"
#define RPL_STATSCOMMANDS_MSG "212 %s %s %ld %ld %ld"
#define RPL_ENDOFSTATS_MSG "219 %s %c :End of STATS report"
#define RPL_UMODEIS_MSG "221 %s +%s"
#define RPL_LUSERCLIENT_MSG "251 %s :There are %ld users and %ld services on %ld servers"
#define RPL_LUSEROP_MSG "252 %s %ld :operator(s) online"
#define RPL_LUSERUNKNOWN_MSG "253 %s %ld :unknown connection(s)"
#define RPL_LUSERCHANNELS_MSG "254 %s %ld :channels formed"
#define RPL_LUSERME_MSG "255 %s :I have %ld users, %ld services and %ld servers"
#define RPL_ADMINME_MSG "256 %s %s :Administrative info"
#define RPL_ADMINLOC1_MSG "257 %s :%s"
#define RPL_ADMINLOC2_MSG "258 %s :%s"
#define RPL_ADMINEMAIL_MSG "259 %s :%s"
#define RPL_LOCALUSERS_MSG "265 %s :Current local users: %ld, Max: %ld"
#define RPL_NETUSERS_MSG "266 %s :Current global users: %ld, Max: %ld"
#define RPL_AWAY_MSG "301 %s %s :%s"
#define RPL_USERHOST_MSG "302 %s :"
@@ -42,11 +47,12 @@
#define RPL_WHOISUSER_MSG "311 %s %s %s %s * :%s"
#define RPL_WHOISSERVER_MSG "312 %s %s %s :%s"
#define RPL_WHOISOPERATOR_MSG "313 %s %s :is an IRC operator"
#define RPL_WHOWASUSER_MSG "314 %s %s %s %s * :%s"
#define RPL_ENDOFWHO_MSG "315 %s %s :End of WHO list"
#define RPL_WHOISIDLE_MSG "317 %s %s %ld :seconds idle"
#define RPL_ENDOFWHOIS_MSG "318 %s %s :End of WHOIS list"
#define RPL_WHOISCHANNELS_MSG "319 %s %s :"
#define RPL_LIST_MSG "322 %s %s %d :%s"
#define RPL_LIST_MSG "322 %s %s %ld :%s"
#define RPL_LISTEND_MSG "323 %s :End of LIST"
#define RPL_CHANNELMODEIS_MSG "324 %s %s +%s"
#define RPL_NOTOPIC_MSG "331 %s %s :No topic is set"
@@ -62,15 +68,20 @@
#define RPL_ENDOFNAMES_MSG "366 %s %s :End of NAMES list"
#define RPL_BANLIST_MSG "367 %s %s %s"
#define RPL_ENDOFBANLIST_MSG "368 %s %s :End of channel ban list"
#define RPL_ENDOFWHOWAS_MSG "369 %s %s :End of WHOWAS list"
#define RPL_MOTD_MSG "372 %s :- %s"
#define RPL_MOTDSTART_MSG "375 %s :- %s message of the day"
#define RPL_ENDOFMOTD_MSG "376 %s :End of MOTD command"
#define RPL_YOUREOPER_MSG "381 %s :You are now an IRC Operator"
#define RPL_YOURESERVICE_MSG "383 %s :You are service %s"
#define RPL_TIME_MSG "391 %s %s :%s"
#define ERR_NOSUCHNICK_MSG "401 %s %s :No such nick or channel name"
#define ERR_NOSUCHSERVER_MSG "402 %s %s :No such server"
#define ERR_NOSUCHCHANNEL_MSG "403 %s %s :No such channel"
#define ERR_CANNOTSENDTOCHAN_MSG "404 %s %s :Cannot send to channel"
#define ERR_TOOMANYCHANNELS_MSG "405 %s %s :You have joined too many channels"
#define ERR_WASNOSUCHNICK_MSG "406 %s %s :There was no such nickname"
#define ERR_NOORIGIN_MSG "409 %s :No origin specified"
#define ERR_NORECIPIENT_MSG "411 %s :No receipient given (%s)"
#define ERR_NOTEXTTOSEND_MSG "412 %s :No text to send"
@@ -85,10 +96,12 @@
#define ERR_NOTREGISTEREDSERVER_MSG "451 %s :Connection not registered as server link"
#define ERR_NEEDMOREPARAMS_MSG "461 %s %s :Syntax error"
#define ERR_ALREADYREGISTRED_MSG "462 %s :Connection already registered"
#define ERR_PASSWDMISMATCH_MSG "464 %s: Invalid password"
#define ERR_PASSWDMISMATCH_MSG "464 %s :Invalid password"
#define ERR_CHANNELISFULL_MSG "471 %s %s :Cannot join channel (+l)"
#define ERR_UNKNOWNMODE_MSG "472 %s: %c :is unknown mode char for %s"
#define ERR_INVITEONLYCHAN_MSG "473 %s %s :Cannot join channel (+i)"
#define ERR_BANNEDFROMCHAN_MSG "474 %s %s :Cannot join channel (+b)"
#define ERR_BADCHANNELKEY_MSG "475 %s %s :Cannot join channel (+k)"
#define ERR_NOPRIVILEGES_MSG "481 %s :Permission denied"
#define ERR_CHANOPRIVSNEEDED_MSG "482 %s %s :You are not channel operator"
#define ERR_RESTRICTED_MSG "484 %s :Your connection is restricted"
@@ -98,6 +111,10 @@
#define ERR_UMODEUNKNOWNFLAG2_MSG "501 %s :Unknown mode \"%c%c\""
#define ERR_USERSDONTMATCH_MSG "502 %s :Can't set/get mode for other users"
#ifdef USE_ZLIB
#define RPL_STATSLINKINFOZIP_MSG "211 %s %s %d %ld %ld/%ld %ld %ld/%ld :%ld"
#endif
#endif

View File

@@ -1,22 +1,21 @@
/*
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
* Copyright (c)2001-2003 by Alexander Barton (alex@barton.de)
*
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* der GNU General Public License (GPL), wie von der Free Software Foundation
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: ngircd.c,v 1.54 2002/09/07 17:57:17 alex Exp $
*
* ngircd.c: Hier beginnt alles ;-)
* Main program -- main()
*/
#include "portab.h"
static char UNUSED id[] = "$Id: ngircd.c,v 1.64.2.1 2003/01/01 13:47:42 alex Exp $";
#include "imp.h"
#include <assert.h>
#include <errno.h>
@@ -29,12 +28,15 @@
#include <sys/stat.h>
#include <sys/wait.h>
#include <time.h>
#include <pwd.h>
#include <grp.h>
#include "resolve.h"
#include "conn.h"
#include "client.h"
#include "channel.h"
#include "conf.h"
#include "cvs-version.h"
#include "defines.h"
#include "lists.h"
#include "log.h"
@@ -48,8 +50,6 @@
LOCAL VOID Initialize_Signal_Handler PARAMS(( VOID ));
LOCAL VOID Signal_Handler PARAMS(( INT Signal ));
LOCAL VOID Initialize_Listen_Ports PARAMS(( VOID ));
LOCAL VOID Show_Version PARAMS(( VOID ));
LOCAL VOID Show_Help PARAMS(( VOID ));
@@ -57,8 +57,10 @@ LOCAL VOID Show_Help PARAMS(( VOID ));
GLOBAL int
main( int argc, const char *argv[] )
{
struct passwd *pwd;
struct group *grp;
BOOLEAN ok, configtest = FALSE;
INT32 pid, n;
LONG pid, n;
INT i;
umask( 0077 );
@@ -140,7 +142,7 @@ main( int argc, const char *argv[] )
{
/* Kurze Option */
for( n = 1; n < (INT32)strlen( argv[i] ); n++ )
for( n = 1; n < (LONG)strlen( argv[i] ); n++ )
{
ok = FALSE;
#ifdef DEBUG
@@ -159,7 +161,7 @@ main( int argc, const char *argv[] )
NGIRCd_ConfFile[FNAME_LEN - 1] = '\0';
/* zum uebernaechsten Parameter */
i++; n = strlen( argv[i] );
i++; n = (LONG)strlen( argv[i] );
ok = TRUE;
}
}
@@ -227,7 +229,7 @@ main( int argc, const char *argv[] )
if( ! NGIRCd_NoDaemon )
{
/* Daemon im Hintergrund erzeugen */
pid = (INT32)fork( );
pid = (LONG)fork( );
if( pid > 0 )
{
/* "alter" Prozess */
@@ -275,8 +277,12 @@ main( int argc, const char *argv[] )
if( setuid( Conf_UID ) != 0 ) Log( LOG_ERR, "Can't change User-ID to %u: %s", Conf_UID, strerror( errno ));
}
}
Log( LOG_INFO, "Running as user %ld, group %ld, with PID %ld.", (INT32)getuid( ), (INT32)getgid( ), (INT32)getpid( ));
/* User, Gruppe und Prozess-ID des Daemon ausgeben */
pwd = getpwuid( getuid( )); grp = getgrgid( getgid( ));
Log( LOG_INFO, "Running as user %s(%ld), group %s(%ld), with PID %ld.", pwd ? pwd->pw_name : "unknown", (LONG)getuid( ), grp ? grp->gr_name : "unknown", (LONG)getgid( ), (LONG)getpid( ));
/* stderr in "Error-File" umlenken */
Log_InitErrorfile( );
/* Signal-Handler initialisieren */
@@ -287,18 +293,29 @@ main( int argc, const char *argv[] )
* sind in doc/Protocol.txt beschrieben. */
#ifdef IRCPLUS
sprintf( NGIRCd_ProtoID, "%s%s %s|%s:%s", PROTOVER, PROTOIRCPLUS, PACKAGE, VERSION, IRCPLUSFLAGS );
#ifdef USE_ZLIB
strcat( NGIRCd_ProtoID, "Z" );
#endif
if( Conf_OperCanMode ) strcat( NGIRCd_ProtoID, "o" );
#else
sprintf( NGIRCd_ProtoID, "%s%s %s|%s", PROTOVER, PROTOIRC, PACKAGE, VERSION );
#endif
strcat( NGIRCd_ProtoID, " P" );
#ifdef USE_ZLIB
strcat( NGIRCd_ProtoID, "Z" );
#endif
Log( LOG_DEBUG, "Protocol and server ID is \"%s\".", NGIRCd_ProtoID );
/* Vordefinierte Channels anlegen */
Channel_InitPredefined( );
/* Listen-Ports initialisieren */
Initialize_Listen_Ports( );
if( Conn_InitListeners( ) < 1 )
{
Log( LOG_ALERT, "Server isn't listening on a single port!" );
Log( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE );
exit( 1 );
}
/* Hauptschleife */
Conn_Handler( );
@@ -320,7 +337,11 @@ NGIRCd_Version( VOID )
{
STATIC CHAR version[126];
#ifdef CVSDATE
sprintf( version, "%s %s(%s)-%s", PACKAGE, VERSION, CVSDATE, NGIRCd_VersionAddition( ));
#else
sprintf( version, "%s %s-%s", PACKAGE, VERSION, NGIRCd_VersionAddition( ));
#endif
return version;
} /* NGIRCd_Version */
@@ -336,6 +357,10 @@ NGIRCd_VersionAddition( VOID )
if( txt[0] ) strcat( txt, "+" );
strcat( txt, "SYSLOG" );
#endif
#ifdef USE_ZLIB
if( txt[0] ) strcat( txt, "+" );
strcat( txt, "ZLIB" );
#endif
#ifdef DEBUG
if( txt[0] ) strcat( txt, "+" );
strcat( txt, "DEBUG" );
@@ -364,6 +389,38 @@ NGIRCd_VersionAddition( VOID )
} /* NGIRCd_VersionAddition */
GLOBAL VOID
NGIRCd_Rehash( VOID )
{
CHAR old_name[CLIENT_ID_LEN];
/* Alle Listen-Sockets schliessen */
Conn_ExitListeners( );
/* Alten Server-Namen merken */
strcpy( old_name, Conf_ServerName );
/* Konfiguration neu lesen ... */
Conf_Init( );
/* Alten Server-Namen wiederherstellen: dieser
* kann nicht zur Laufzeit geaendert werden ... */
if( strcmp( old_name, Conf_ServerName ) != 0 )
{
strcpy( Conf_ServerName, old_name );
Log( LOG_ERR, "Can't change \"ServerName\" on runtime! Ignored new name." );
}
/* neue pre-defined Channel anlegen: */
Channel_InitPredefined( );
/* Listen-Sockets neu anlegen: */
Conn_InitListeners( );
Log( LOG_INFO, "Re-reading of configuration done." );
} /* NGIRCd_Rehash */
LOCAL VOID
Initialize_Signal_Handler( VOID )
{
@@ -424,15 +481,15 @@ Signal_Handler( INT Signal )
case SIGINT:
case SIGQUIT:
/* wir soll(t)en uns wohl beenden ... */
if( Signal == SIGTERM ) Log( LOG_WARNING, "Got TERM signal, terminating now ..." );
else if( Signal == SIGINT ) Log( LOG_WARNING, "Got INT signal, terminating now ..." );
else if( Signal == SIGQUIT ) Log( LOG_WARNING, "Got QUIT signal, terminating now ..." );
if( Signal == SIGTERM ) Log( LOG_WARNING|LOG_snotice, "Got TERM signal, terminating now ..." );
else if( Signal == SIGINT ) Log( LOG_WARNING|LOG_snotice, "Got INT signal, terminating now ..." );
else if( Signal == SIGQUIT ) Log( LOG_WARNING|LOG_snotice, "Got QUIT signal, terminating now ..." );
NGIRCd_Quit = TRUE;
break;
case SIGHUP:
/* neu starten */
Log( LOG_WARNING, "Got HUP signal, restarting now ..." );
NGIRCd_Restart = TRUE;
/* Konfiguration neu einlesen: */
Log( LOG_WARNING|LOG_snotice, "Got HUP signal, re-reading configuration ..." );
NGIRCd_Rehash( );
break;
case SIGCHLD:
/* Child-Prozess wurde beendet. Zombies vermeiden: */
@@ -445,35 +502,11 @@ Signal_Handler( INT Signal )
} /* Signal_Handler */
LOCAL VOID
Initialize_Listen_Ports( VOID )
{
/* Ports, auf denen der Server Verbindungen entgegennehmen
* soll, initialisieren */
UINT created, i;
created = 0;
for( i = 0; i < Conf_ListenPorts_Count; i++ )
{
if( Conn_NewListener( Conf_ListenPorts[i] )) created++;
else Log( LOG_ERR, "Can't listen on port %u!", Conf_ListenPorts[i] );
}
if( created < 1 )
{
Log( LOG_ALERT, "Server isn't listening on a single port!" );
Log( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE );
exit( 1 );
}
} /* Initialize_Listen_Ports */
LOCAL VOID
Show_Version( VOID )
{
puts( NGIRCd_Version( ));
puts( "Copyright (c)2001,2002 by Alexander Barton (<alex@barton.de>)." );
puts( "Copyright (c)2001-2003 by Alexander Barton (<alex@barton.de>)." );
puts( "Homepage: <http://arthur.ath.cx/~alex/ngircd/>\n" );
puts( "This is free software; see the source for copying conditions. There is NO" );
puts( "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." );
@@ -487,7 +520,7 @@ Show_Help( VOID )
puts( " -d, --debug log extra debug messages" );
#endif
puts( " -f, --config <f> use file <f> as configuration file" );
puts( " -n, --nodaemon don't fork and don't detatch from controlling terminal" );
puts( " -n, --nodaemon don't fork and don't detach from controlling terminal" );
puts( " -p, --passive disable automatic connections to other servers" );
#ifdef SNIFFER
puts( " -s, --sniffer enable network sniffer and display all IRC traffic" );

View File

@@ -2,16 +2,15 @@
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
*
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* der GNU General Public License (GPL), wie von der Free Software Foundation
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: ngircd.h,v 1.14 2002/09/02 19:01:11 alex Exp $
* $Id: ngircd.h,v 1.17 2002/12/12 11:30:23 alex Exp $
*
* ngircd.h: Prototypen aus dem "Haupt-Modul"
* Prototypes of the "main module".
*/
@@ -47,9 +46,12 @@ GLOBAL CHAR NGIRCd_ConfFile[FNAME_LEN]; /* Konfigurationsdatei */
GLOBAL CHAR NGIRCd_ProtoID[1024]; /* Protokoll- und Server-Identifikation */
GLOBAL CHAR *NGIRCd_Version PARAMS((VOID ));
GLOBAL CHAR *NGIRCd_VersionAddition PARAMS((VOID ));
GLOBAL VOID NGIRCd_Rehash PARAMS(( VOID ));
#endif

View File

@@ -2,21 +2,20 @@
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
*
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* der GNU General Public License (GPL), wie von der Free Software Foundation
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: parse.c,v 1.41 2002/09/16 09:20:27 alex Exp $
*
* parse.c: Parsen der Client-Anfragen
* IRC command parser and validator
*/
#include "portab.h"
static char UNUSED id[] = "$Id: parse.c,v 1.52 2002/12/18 13:53:20 alex Exp $";
#include "imp.h"
#include <assert.h>
#include <stdlib.h>
@@ -38,6 +37,7 @@
#include "imp.h"
#include "irc.h"
#include "irc-channel.h"
#include "irc-info.h"
#include "irc-login.h"
#include "irc-mode.h"
#include "irc-op.h"
@@ -48,6 +48,54 @@
#include "exp.h"
COMMAND My_Commands[] =
{
{ "ADMIN", IRC_ADMIN, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
{ "AWAY", IRC_AWAY, CLIENT_USER, 0, 0, 0 },
{ "CONNECT", IRC_CONNECT, CLIENT_USER, 0, 0, 0 },
{ "DIE", IRC_DIE, CLIENT_USER, 0, 0, 0 },
{ "ERROR", IRC_ERROR, 0xFFFF, 0, 0, 0 },
{ "INVITE", IRC_INVITE, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
{ "ISON", IRC_ISON, CLIENT_USER, 0, 0, 0 },
{ "JOIN", IRC_JOIN, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
{ "KICK", IRC_KICK, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
{ "KILL", IRC_KILL, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
{ "LINKS", IRC_LINKS, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
{ "LIST", IRC_LIST, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
{ "LUSERS", IRC_LUSERS, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
{ "MODE", IRC_MODE, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
{ "MOTD", IRC_MOTD, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
{ "NAMES", IRC_NAMES, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
{ "NICK", IRC_NICK, 0xFFFF, 0, 0, 0 },
{ "NJOIN", IRC_NJOIN, CLIENT_SERVER, 0, 0, 0 },
{ "NOTICE", IRC_NOTICE, 0xFFFF, 0, 0, 0 },
{ "OPER", IRC_OPER, CLIENT_USER, 0, 0, 0 },
{ "PART", IRC_PART, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
{ "PASS", IRC_PASS, 0xFFFF, 0, 0, 0 },
{ "PING", IRC_PING, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
{ "PONG", IRC_PONG, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
{ "PRIVMSG", IRC_PRIVMSG, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
{ "QUIT", IRC_QUIT, 0xFFFF, 0, 0, 0 },
{ "REHASH", IRC_REHASH, CLIENT_USER, 0, 0, 0 },
{ "RESTART", IRC_RESTART, CLIENT_USER, 0, 0, 0 },
{ "SERVER", IRC_SERVER, 0xFFFF, 0, 0, 0 },
{ "SQUIT", IRC_SQUIT, CLIENT_SERVER, 0, 0, 0 },
{ "STATS", IRC_STATS, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
{ "TIME", IRC_TIME, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
{ "TOPIC", IRC_TOPIC, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
{ "USER", IRC_USER, 0xFFFF, 0, 0, 0 },
{ "USERHOST", IRC_USERHOST, CLIENT_USER, 0, 0, 0 },
{ "VERSION", IRC_VERSION, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
{ "WHO", IRC_WHO, CLIENT_USER, 0, 0, 0 },
{ "WHOIS", IRC_WHOIS, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
{ "WHOWAS", IRC_WHOWAS, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
#ifdef IRCPLUS
{ "CHANINFO", IRC_CHANINFO, CLIENT_SERVER, 0, 0, 0 },
#endif
{ NULL, NULL, 0x0, 0, 0, 0 } /* Ende-Marke */
};
LOCAL VOID Init_Request PARAMS(( REQUEST *Req ));
LOCAL BOOLEAN Validate_Prefix PARAMS(( CONN_ID Idx, REQUEST *Req, BOOLEAN *Closed ));
@@ -57,6 +105,13 @@ LOCAL BOOLEAN Validate_Args PARAMS(( CONN_ID Idx, REQUEST *Req, BOOLEAN *Closed
LOCAL BOOLEAN Handle_Request PARAMS(( CONN_ID Idx, REQUEST *Req ));
GLOBAL COMMAND *
Parse_GetCommandStruct( VOID )
{
return My_Commands;
} /* Parse_GetCommandStruct */
GLOBAL BOOLEAN
Parse_Request( CONN_ID Idx, CHAR *Request )
{
@@ -101,8 +156,6 @@ Parse_Request( CONN_ID Idx, CHAR *Request )
}
else start = Request;
if( ! Validate_Prefix( Idx, &req, &closed )) return ! closed;
/* Befehl */
ptr = strchr( start, ' ' );
if( ptr )
@@ -116,8 +169,6 @@ Parse_Request( CONN_ID Idx, CHAR *Request )
}
req.command = start;
if( ! Validate_Command( Idx, &req, &closed )) return ! closed;
/* Argumente, Parameter */
if( ptr )
{
@@ -156,6 +207,9 @@ Parse_Request( CONN_ID Idx, CHAR *Request )
}
}
/* Daten validieren */
if( ! Validate_Prefix( Idx, &req, &closed )) return ! closed;
if( ! Validate_Command( Idx, &req, &closed )) return ! closed;
if( ! Validate_Args( Idx, &req, &closed )) return ! closed;
return Handle_Request( Idx, &req );
@@ -209,8 +263,8 @@ Validate_Prefix( CONN_ID Idx, REQUEST *Req, BOOLEAN *Closed )
if( ! c )
{
/* im Prefix angegebener Client ist nicht bekannt */
Log( LOG_ERR, "Invalid prefix, client not known (connection %d)!?", Idx );
if( ! Conn_WriteStr( Idx, "ERROR :Invalid prefix, client not known!?" )) *Closed = TRUE;
Log( LOG_ERR, "Invalid prefix \"%s\", client not known (connection %d, command %s)!?", Req->prefix, Idx, Req->command );
if( ! Conn_WriteStr( Idx, "ERROR :Invalid prefix \"%s\", client not known!?", Req->prefix )) *Closed = TRUE;
return FALSE;
}
@@ -221,7 +275,7 @@ Validate_Prefix( CONN_ID Idx, REQUEST *Req, BOOLEAN *Closed )
{
/* das angegebene Prefix ist aus dieser Richtung, also
* aus der gegebenen Connection, ungueltig! */
Log( LOG_ERR, "Spoofed prefix \"%s\" from \"%s\" (connection %d)!", Req->prefix, Client_Mask( Client_GetFromConn( Idx )), Idx );
Log( LOG_ERR, "Spoofed prefix \"%s\" from \"%s\" (connection %d, command %s)!", Req->prefix, Client_Mask( Client_GetFromConn( Idx )), Idx, Req->command );
Conn_Close( Idx, NULL, "Spoofed prefix", TRUE );
*Closed = TRUE;
return FALSE;
@@ -261,6 +315,8 @@ Handle_Request( CONN_ID Idx, REQUEST *Req )
CLIENT *client, *target, *prefix;
CHAR str[LINE_LEN];
BOOLEAN result;
COMMAND *cmd;
INT i;
assert( Idx >= 0 );
@@ -280,8 +336,8 @@ Handle_Request( CONN_ID Idx, REQUEST *Req )
else target = NULL;
if( ! target )
{
if( Req->argc > 0 ) Log( LOG_WARNING, "Unknown target for status code: \"%s\"", Req->argv[0] );
else Log( LOG_WARNING, "Unknown target for status code!" );
if( Req->argc > 0 ) Log( LOG_WARNING, "Unknown target for status code %s: \"%s\"", Req->command, Req->argv[0] );
else Log( LOG_WARNING, "Unknown target for status code %s!", Req->command );
return TRUE;
}
if( target == Client_ThisServer( ))
@@ -311,53 +367,42 @@ Handle_Request( CONN_ID Idx, REQUEST *Req )
else strcat( str, " :" );
strcat( str, Req->argv[i] );
}
return IRC_WriteStrClientPrefix( target, prefix, str );
return IRC_WriteStrClientPrefix( target, prefix, "%s", str );
}
if( strcasecmp( Req->command, "PASS" ) == 0 ) return IRC_PASS( client, Req );
else if( strcasecmp( Req->command, "NICK" ) == 0 ) return IRC_NICK( client, Req );
else if( strcasecmp( Req->command, "USER" ) == 0 ) return IRC_USER( client, Req );
else if( strcasecmp( Req->command, "SERVER" ) == 0 ) return IRC_SERVER( client, Req );
else if( strcasecmp( Req->command, "NJOIN" ) == 0 ) return IRC_NJOIN( client, Req );
else if( strcasecmp( Req->command, "QUIT" ) == 0 ) return IRC_QUIT( client, Req );
else if( strcasecmp( Req->command, "SQUIT" ) == 0 ) return IRC_SQUIT( client, Req );
else if( strcasecmp( Req->command, "PING" ) == 0 ) return IRC_PING( client, Req );
else if( strcasecmp( Req->command, "PONG" ) == 0 ) return IRC_PONG( client, Req );
else if( strcasecmp( Req->command, "MOTD" ) == 0 ) return IRC_MOTD( client, Req );
else if( strcasecmp( Req->command, "PRIVMSG" ) == 0 ) return IRC_PRIVMSG( client, Req );
else if( strcasecmp( Req->command, "NOTICE" ) == 0 ) return IRC_NOTICE( client, Req );
else if( strcasecmp( Req->command, "MODE" ) == 0 ) return IRC_MODE( client, Req );
else if( strcasecmp( Req->command, "NAMES" ) == 0 ) return IRC_NAMES( client, Req );
else if( strcasecmp( Req->command, "ISON" ) == 0 ) return IRC_ISON( client, Req );
else if( strcasecmp( Req->command, "WHOIS" ) == 0 ) return IRC_WHOIS( client, Req );
else if( strcasecmp( Req->command, "USERHOST" ) == 0 ) return IRC_USERHOST( client, Req );
else if( strcasecmp( Req->command, "OPER" ) == 0 ) return IRC_OPER( client, Req );
else if( strcasecmp( Req->command, "DIE" ) == 0 ) return IRC_DIE( client, Req );
else if( strcasecmp( Req->command, "RESTART" ) == 0 ) return IRC_RESTART( client, Req );
else if( strcasecmp( Req->command, "ERROR" ) == 0 ) return IRC_ERROR( client, Req );
else if( strcasecmp( Req->command, "LUSERS" ) == 0 ) return IRC_LUSERS( client, Req );
else if( strcasecmp( Req->command, "LINKS" ) == 0 ) return IRC_LINKS( client, Req );
else if( strcasecmp( Req->command, "JOIN" ) == 0 ) return IRC_JOIN( client, Req );
else if( strcasecmp( Req->command, "PART" ) == 0 ) return IRC_PART( client, Req );
else if( strcasecmp( Req->command, "VERSION" ) == 0 ) return IRC_VERSION( client, Req );
else if( strcasecmp( Req->command, "KILL" ) == 0 ) return IRC_KILL( client, Req );
else if( strcasecmp( Req->command, "AWAY" ) == 0 ) return IRC_AWAY( client, Req );
else if( strcasecmp( Req->command, "TOPIC" ) == 0 ) return IRC_TOPIC( client, Req );
else if( strcasecmp( Req->command, "WHO" ) == 0 ) return IRC_WHO( client, Req );
else if( strcasecmp( Req->command, "LIST" ) == 0 ) return IRC_LIST( client, Req );
else if( strcasecmp( Req->command, "INVITE" ) == 0 ) return IRC_INVITE( client, Req );
else if( strcasecmp( Req->command, "KICK" ) == 0 ) return IRC_KICK( client, Req );
else if( strcasecmp( Req->command, "CONNECT" ) == 0 ) return IRC_CONNECT( client, Req );
else if( strcasecmp( Req->command, "ADMIN" ) == 0 ) return IRC_ADMIN( client, Req );
#ifdef IRCPLUS
else if( strcasecmp( Req->command, "CHANINFO" ) == 0 ) return IRC_CHANINFO( client, Req );
#endif
cmd = My_Commands;
while( cmd->name )
{
/* Befehl suchen */
if( strcasecmp( Req->command, cmd->name ) != 0 )
{
cmd++; continue;
}
if( Client_Type( client ) & cmd->type )
{
/* Command is allowed for this client: call it and count produced bytes */
Conn_ResetWCounter( );
result = (cmd->function)( client, Req );
cmd->bytes += Conn_WCounter( );
/* Adjust counters */
if( Client_Type( client ) != CLIENT_SERVER ) cmd->lcount++;
else cmd->rcount++;
return result;
}
else
{
/* Befehl ist fuer diesen Client-Typ nicht erlaubt! */
return IRC_WriteStrClient( client, ERR_NOTREGISTERED_MSG, Client_ID( client ));
}
}
/* Unbekannter Befehl */
if( Client_Type( client ) != CLIENT_SERVER ) IRC_WriteStrClient( client, ERR_UNKNOWNCOMMAND_MSG, Client_ID( client ), Req->command );
Log( LOG_DEBUG, "Connection %d: Unknown command \"%s\", %d %s,%s prefix.", Client_Conn( client ), Req->command, Req->argc, Req->argc == 1 ? "parameter" : "parameters", Req->prefix ? "" : " no" );
return TRUE;
if( Client_Type( client ) != CLIENT_SERVER ) return IRC_WriteStrClient( client, ERR_UNKNOWNCOMMAND_MSG, Client_ID( client ), Req->command );
else return TRUE;
} /* Handle_Request */

View File

@@ -2,16 +2,15 @@
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
*
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* der GNU General Public License (GPL), wie von der Free Software Foundation
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: parse.h,v 1.7 2002/05/27 13:09:27 alex Exp $
* $Id: parse.h,v 1.9 2002/12/18 13:53:20 alex Exp $
*
* parse.h: Parsen der Client-Anfragen (Header)
* IRC command parser and validator (header)
*/
@@ -28,8 +27,20 @@ typedef struct _REQUEST /* vgl. RFC 2812, 2.3 */
} REQUEST;
typedef struct _COMMAND
{
CHAR *name; /* command name */
BOOLEAN (*function)( CLIENT *Client, REQUEST *Request );
CLIENT_TYPE type; /* valid client types (bit mask) */
LONG lcount, rcount; /* number of local and remote calls */
LONG bytes; /* number of bytes created */
} COMMAND;
GLOBAL BOOLEAN Parse_Request PARAMS((CONN_ID Idx, CHAR *Request ));
GLOBAL COMMAND *Parse_GetCommandStruct PARAMS(( VOID ));
#endif

View File

@@ -2,21 +2,20 @@
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
*
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* der GNU General Public License (GPL), wie von der Free Software Foundation
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: resolve.c,v 1.3 2002/06/09 13:19:08 alex Exp $
*
* resolve.c: asyncroner Resolver
* Asynchronous resolver
*/
#include "portab.h"
static char UNUSED id[] = "$Id: resolve.c,v 1.4 2002/12/12 12:24:18 alex Exp $";
#include "imp.h"
#include <assert.h>
#include <errno.h>

View File

@@ -2,16 +2,15 @@
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
*
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* der GNU General Public License (GPL), wie von der Free Software Foundation
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: resolve.h,v 1.2 2002/09/16 09:22:41 alex Exp $
* $Id: resolve.h,v 1.3 2002/12/12 12:23:43 alex Exp $
*
* resolve.h: asyncroner Resolver (Header)
* Asynchronous resolver (header)
*/

View File

@@ -2,21 +2,20 @@
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
*
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* der GNU General Public License (GPL), wie von der Free Software Foundation
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: tool.c,v 1.9 2002/05/27 13:09:27 alex Exp $
*
* tool.c: Hilfsfunktionen, ggf. Platformabhaengig
* Tool functions
*/
#include "portab.h"
static char UNUSED id[] = "$Id: tool.c,v 1.10 2002/12/12 12:24:18 alex Exp $";
#include "imp.h"
#include <assert.h>
#include <ctype.h>

View File

@@ -2,16 +2,15 @@
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
*
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* der GNU General Public License (GPL), wie von der Free Software Foundation
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: tool.h,v 1.8 2002/05/27 13:09:27 alex Exp $
* $Id: tool.h,v 1.9 2002/12/12 12:23:43 alex Exp $
*
* log.h: Hilfsfunktionen (Header)
* Tool functions (Header)
*/

View File

@@ -9,7 +9,7 @@
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
*
* $Id: portab.h,v 1.7 2002/06/26 15:43:38 alex Exp $
* $Id: portab.h,v 1.9 2002/12/12 11:26:08 alex Exp $
*
* portab.h: "Portabilitaets-Definitionen"
*/
@@ -24,6 +24,13 @@
/* Compiler Features */
#ifdef __GNUC__
# define PUNUSED(x) __attribute__ ((unused)) x
# define UNUSED __attribute__ ((unused))
#else
# define PUNUSED(x) x
# define UNUSED
#endif
#ifndef PARAMS
# if PROTOTYPES
@@ -56,6 +63,9 @@ typedef void POINTER;
typedef signed int INT;
typedef unsigned int UINT;
typedef signed long LONG;
typedef unsigned long ULONG;
typedef signed char INT8;
typedef unsigned char UINT8;
typedef signed short INT16;
@@ -63,6 +73,7 @@ typedef unsigned short UINT16;
typedef signed long INT32;
typedef unsigned long UINT32;
typedef double DOUBLE;
typedef float FLOAT;
typedef char CHAR;

View File

@@ -2,21 +2,20 @@
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
*
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* der GNU General Public License (GPL), wie von der Free Software Foundation
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: portabtest.c,v 1.8 2002/09/09 10:05:10 alex Exp $
*
* portabtest.c: Testprogramm fuer portab.h
* test program for portab.h and friends ;-)
*/
#include "portab.h"
static char UNUSED id[] = "$Id: portabtest.c,v 1.9 2002/12/12 11:38:46 alex Exp $";
#include "imp.h"
#include <stdio.h>

View File

@@ -2,20 +2,20 @@
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
*
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
* der GNU General Public License (GPL), wie von der Free Software Foundation
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: vsnprintf.c,v 1.3 2002/05/27 13:01:04 alex Exp $
*
* vsnprintf.c: u.a. Ersatz fuer vsnprintf()
* snprintf() and vsnprintf() replacement functions
*/
#include "portab.h"
static char UNUSED id[] = "$Id: vsnprintf.c,v 1.4 2002/12/12 11:37:11 alex Exp $";
#include "imp.h"
#include "exp.h"

View File

@@ -9,7 +9,7 @@
# Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
# der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
#
# $Id: Makefile.am,v 1.3 2002/09/12 02:26:17 alex Exp $
# $Id: Makefile.am,v 1.9 2002/11/10 14:28:06 alex Exp $
#
AUTOMAKE_OPTIONS = ../portab/ansi2knr
@@ -17,21 +17,24 @@ AUTOMAKE_OPTIONS = ../portab/ansi2knr
INCLUDES = -I$(srcdir)/../portab
EXTRA_DIST = \
getpid.sh \
start-server.sh stop-server.sh tests.sh stress-server.sh \
connect-test.e channel-test.e mode-test.e \
stress-A.e stress-B.e check-idle.e \
ngircd-test.conf
clean-local:
rm -rf logs tests *-test ngircd-test.log ngircd-test.motd ngircd-TEST procs.tmp
rm -rf logs tests *-test ngircd-test.log ngircd-test.motd \
T-ngircd procs.tmp
maintainer-clean-local:
rm -f Makefile Makefile.in
check_SCRIPTS = ngircd-TEST tests.sh
check_SCRIPTS = ngircd-TEST-Binary tests.sh
ngircd-TEST:
ln -s ../ngircd/ngircd ngircd-TEST
ngircd-TEST-Binary:
cp ../ngircd/ngircd T-ngircd
[ -f getpid.sh ] || ln -s $(srcdir)/getpid.sh .
connect-test: tests.sh
ln -s $(srcdir)/tests.sh connect-test

30
src/testsuite/getpid.sh Executable file
View File

@@ -0,0 +1,30 @@
#!/bin/sh
# ngIRCd Test Suite
# $Id: getpid.sh,v 1.2 2002/11/10 14:28:06 alex Exp $
# wurde ein Name uebergeben?
[ $# -ne 1 ] && exit 1
# Flags fuer "ps" ermitteln
if [ `uname` = "FreeBSD" ]; then
PS_FLAGS="-a"; PS_PIDCOL="1"; HEAD_FLAGS="-n 1"
elif [ `uname` = "A/UX" ]; then
PS_FLAGS="-ae"; PS_PIDCOL="1"; HEAD_FLAGS="-1"
else
PS_FLAGS="-f"; PS_PIDCOL="2"; HEAD_FLAGS="-n 1"
ps $PS_FLAGS > /dev/null 2>&1
if [ $? -ne 0 ]; then PS_FLAGS="a"; PS_PIDCOL="1"; fi
fi
# PID ermitteln
ps $PS_FLAGS > procs.tmp
pid=$( cat procs.tmp | grep "$1" | awk "{print \$$PS_PIDCOL}" | sort -n | head $HEAD_FLAGS )
# ermittelte PID validieren
[ "$pid" -gt 1 ] > /dev/null 2>&1
[ $? -ne 0 ] && exit 1
echo $pid
exit 0
# -eof-

View File

@@ -1,4 +1,4 @@
# $Id: mode-test.e,v 1.2 2002/09/09 21:26:00 alex Exp $
# $Id: mode-test.e,v 1.4 2002/12/15 15:52:34 alex Exp $
spawn telnet localhost 6789
expect {
@@ -22,7 +22,7 @@ expect {
send "mode nick\r"
expect {
timeout { exit 1 }
"211 nick +i"
"221 nick +i"
}
send "mode nick -i\r"
@@ -44,7 +44,7 @@ expect {
send "mode nick\r"
expect {
timeout { exit 1 }
"211 nick +o"
"221 nick +o"
}
send "join #channel\r"
@@ -93,10 +93,10 @@ expect {
":nick!~user@* MODE #channel +I nick3!user@*"
}
send "mode #channel -vo nick\r"
send "mode #channel -vo nick nick\r"
expect {
timeout { exit 1 }
":nick!~user@* MODE #channel -vo nick"
":nick!~user@* MODE #channel -vo nick nick"
}
send "quit\r"

View File

@@ -1,10 +1,11 @@
# $Id: ngircd-test.conf,v 1.2 2002/09/09 21:25:50 alex Exp $
# $Id: ngircd-test.conf,v 1.3 2002/10/21 13:45:23 alex Exp $
[Global]
Name = ngircd.test.server
Info = ngIRCd Test-Server
Ports = 6789
MotdFile = ngircd-test.motd
AdminEMail = admin@irc.server
[Operator]
Name = TestOp

View File

@@ -1,22 +1,32 @@
#!/bin/sh
# ngIRCd Test Suite
# $Id: start-server.sh,v 1.5 2002/09/16 09:53:16 alex Exp $
# $Id: start-server.sh,v 1.10 2002/11/10 14:28:06 alex Exp $
[ -z "$srcdir" ] && srcdir=`dirname $0`
echo " starting server ..."
rm -rf logs
# alte Logfiles loeschen
rm -rf logs *.log
# pruefen, ob getpid.sh gueltige PID's liefert. Wenn dem nicht so ist,
# wird kein ngIRCd gestartet, da dieser ansonsten nicht mehr am Ende
# des Testlaufs beendet werden koennte!
./getpid.sh sh > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo " error: getpid.sh FAILED!"
exit 1
fi
# MOTD fuer Test-Server erzeugen
echo "This is an ngIRCd Test Server" > ngircd-test.motd
./ngircd-TEST -np -f ${srcdir}/ngircd-test.conf > ngircd-test.log 2>&1 &
# Test-Server starten ...
./T-ngircd -np -f ${srcdir}/ngircd-test.conf > ngircd-test.log 2>&1 &
sleep 1
PS_FLAGS=a; PS_PIDCOL=1
ps a > /dev/null 2>&1
if [ $? -ne 0 ]; then PS_FLAGS=-f; PS_PIDCOL=2; fi
ps $PS_FLAGS > procs.tmp
pid=`cat procs.tmp | grep ngircd-TEST | awk "{ print \\\$$PS_PIDCOL }"`
kill -0 $pid > /dev/null 2>&1
# validieren, dass Server laeuft
pid=`./getpid.sh T-ngircd`
[ -n "$pid" ] && kill -0 $pid > /dev/null 2>&1 || exit 1
# -eof-

View File

@@ -1,15 +1,17 @@
#!/bin/sh
# ngIRCd Test Suite
# $Id: stop-server.sh,v 1.4 2002/09/16 09:53:16 alex Exp $
# $Id: stop-server.sh,v 1.9 2002/11/10 14:28:06 alex Exp $
[ -z "$srcdir" ] && srcdir=`dirname $0`
echo " stopping server ..."
PS_FLAGS=a; PS_PIDCOL=1
ps a > /dev/null 2>&1
if [ $? -ne 0 ]; then PS_FLAGS=-f; PS_PIDCOL=2; fi
# Test-Server stoppen ...
pid=`./getpid.sh T-ngircd`
[ -n "$pid" ] && kill $pid > /dev/null 2>&1 || exit 1
sleep 1
ps $PS_FLAGS > procs.tmp
pid=`cat procs.tmp | grep ngircd-TEST | awk "{ print \\\$$PS_PIDCOL }"`
kill $pid > /dev/null 2>&1
# jetzt duerfte der Prozess nicht mehr laufen
kill -0 $pid > /dev/null 2>&1 && exit 1 || exit 0
# -eof-

View File

@@ -1,9 +1,10 @@
#!/bin/sh
# ngIRCd Test Suite
# $Id: stress-server.sh,v 1.4 2002/09/16 09:54:17 alex Exp $
# $Id: stress-server.sh,v 1.6 2002/09/23 22:07:43 alex Exp $
if [ `uname` = "Darwin" -o `uname` = "IRIX" -o `uname` = "IRIX64" ]; then CLIENTS=5
else CLIENTS=50; fi
[ -z "$srcdir" ] && srcdir=`dirname $0`
[ $1 -gt 0 ] 2> /dev/null && CLIENTS=$1 || CLIENTS=5
name=`basename $0`
test=`echo ${name} | cut -d '.' -f 1`