1
0
mirror of https://github.com/osmarks/ngircd.git synced 2025-09-23 20:54:02 +00:00

Compare commits

...

11 Commits

Author SHA1 Message Date
Alexander Barton
b715a5f061 ngIRCd 0.9.0-pre1 2005-07-09 11:57:07 +00:00
Alexander Barton
0b31b46353 Preparations for ngIRCd 0.9.0 :-) 2005-07-09 11:50:29 +00:00
Alexander Barton
8a7ae2dfc1 Prepare for "new upstream release". 2005-07-09 11:20:05 +00:00
Alexander Barton
01ee1bdf2c Updated documentation. 2005-07-09 11:16:38 +00:00
Alexander Barton
13ee3e62be Only setuid()/setgid() if it differs from current UID/GID.
Solves problems with Cygwin. [from HEAD]
2005-07-08 23:20:04 +00:00
Alexander Barton
fc038ae444 Use "ServerUID" (and not internal variable name) for error message. [HEAD] 2005-07-08 21:05:19 +00:00
Alexander Barton
8d1fe3b89a Updated documentation. 2005-07-08 12:50:43 +00:00
Alexander Barton
d74029851f Fixed maximum length of user names, now allow up to 9 characters. [from HEAD] 2005-07-05 22:58:25 +00:00
Alexander Barton
8ff1a4b666 Cut off oversized IRC messages that should be sent to the network instead
of shuttding down the (wrong) connection. [from HEAD]
2005-07-02 14:45:07 +00:00
Alexander Barton
5f68d5f1e1 New constant "CUT_TXTSUFFIX". [from HEAD] 2005-07-02 14:44:36 +00:00
Alexander Barton
db2a41e5bc Moving towards ngIRCd 0.0.9! :-) 2005-06-27 16:12:51 +00:00
8 changed files with 89 additions and 43 deletions

View File

@@ -10,8 +10,11 @@
-- ChangeLog --
ngIRCd CVSHEAD
ngIRCd 0.9.0-pre1 (2005-07-09)
- Fixed maximum length of user names, now allow up to 9 characters.
- Cut off oversized IRC messages that should be sent to the network instead
of shuttding down the (wrong) connection.
- Don't generate error messages for unknown commands received before the
client is registered with the server (like the original ircd).
- Never run with root privileges but always switch the user ID.
@@ -608,4 +611,4 @@ ngIRCd 0.0.1, 31.12.2001
--
$Id: ChangeLog,v 1.276 2005/06/26 21:54:01 alex Exp $
$Id: ChangeLog,v 1.276.2.4 2005/07/09 11:57:07 alex Exp $

View File

@@ -8,13 +8,13 @@
# (at your option) any later version.
# Please read the file COPYING, README and AUTHORS for more information.
#
# $Id: configure.in,v 1.111 2005/06/26 13:42:11 alex Exp $
# $Id: configure.in,v 1.111.2.2 2005/07/09 11:57:07 alex Exp $
#
# -- Initialisation --
AC_PREREQ(2.50)
AC_INIT(ngircd, CVSHEAD)
AC_INIT(ngircd, 0.9.0-pre1)
AC_CONFIG_SRCDIR(src/ngircd/ngircd.c)
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE(1.6)

View File

@@ -1,3 +1,9 @@
ngircd (0.9.0-0ab1) unstable; urgency=low
* New "upstream release".
-- Alexander Barton <alex@Pollux> Sat, 9 Jul 2005 13:18:05 +0200
ngircd (0.8.3-0ab1) unstable; urgency=high
* New "upstream release", including security fixes.

View File

@@ -1,5 +1,5 @@
%define name ngircd
%define version CVSHEAD
%define version 0.9.0
%define release 1
%define prefix %{_prefix}

View File

@@ -1,7 +1,7 @@
ngIRCd - Next Generation IRC Server
(c)2001-2004 Alexander Barton
(c)2001-2005 Alexander Barton
alex@barton.de, http://www.barton.de/
ngIRCd is free software and published under the
@@ -28,18 +28,20 @@ Platform Compiler ngIRCd Date Tester C M T R See
--------------------------- ------------ ---------- -------- ------ - - - - ---
hppa/unknown/openbsd3.5 gcc 2.95.3 CVSHEAD 04-05-25 alex Y Y Y Y
hppa1.1/unknown/linux-gnu gcc 3.3.3 0.8.0 04-05-30 alex Y Y Y Y
hppa2.0/unknown/linux-gnu gcc 3.3.5 0.9.x-CVS 05-06-27 alex Y Y Y Y
i386/pc/solaris2.9 gcc 3.2.2 CVSHEAD 04-02-24 alex Y Y Y Y
i386/unknown/freebsd5.2.1 gcc 3.3.3 0.8.0 04-05-30 alex Y Y Y Y
i386/unknown/gnu0.3 gcc 3.3.3 0.8.0 04-05-30 alex Y Y n Y
i386/unknown/netbsdelf1.6.1 gcc 2.95.3 CVSHEAD 04-02-24 alex Y Y Y Y
i686/pc/cygwin gcc 3.3.1 0.8.0 04-05-30 alex Y Y n Y
i686/pc/cygwin gcc 3.3.1 0.9.x-CVS 05-07-08 alex Y Y n Y
i686/pc/linux-gnu gcc 2.95.4 0.8.0 04-05-30 alex Y Y Y Y (1)
i686/pc/linux-gnu gcc 3.3.3 0.8.0 04-05-30 alex Y Y Y Y (1)
i686/pc/linux-gnu gcc 3.3.5 0.9.x-CVS 05-07-09 alex Y Y Y Y (1)
m68k/apple/aux3.1.1 Orig. A/UX 0.7.x-CVS 03-04-22 alex Y Y Y Y (2)
m68k/hp/hp-ux9.10 Orig. HPUX 0.7.x-CVS 03-04-30 goetz Y Y Y Y
m88k/dg/dgux5.4R3.10 gcc 2.5.8 CVSHEAD 04-03-15 alex Y Y ? ?
powerpc/apple/darwin6.5 gcc 3.1 0.7.x-CVS 03-04-23 alex Y Y Y Y
powerpc/apple/darwin7.4.0 gcc 3.3 0.8.0 04-05-30 alex Y Y Y Y
powerpc/apple/darwin8.1.0 gcc 4.0 0.9.x-CVS 05-06-27 alex Y Y Y Y
powerpc/unknown/linux-gnu gcc 3.3.3 0.8.0 04-05-30 alex Y Y Y Y
sparc/sun/solaris2.6 gcc 2.95.3 0.7.x-CVS 03-04-22 alex Y Y Y Y
sparc/sun/solaris2.7 gcc 3.3 0.8.0 04-05-30 alex Y Y Y Y
@@ -60,4 +62,4 @@ Notes
--
$Id: Platforms.txt,v 1.13 2004/11/09 11:00:33 alex Exp $
$Id: Platforms.txt,v 1.13.2.2 2005/07/09 11:16:38 alex Exp $

View File

@@ -1,6 +1,6 @@
/*
* ngIRCd -- The Next Generation IRC Daemon
* Copyright (c)2001-2004 Alexander Barton <alex@barton.de>
* Copyright (c)2001-2005 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
@@ -16,7 +16,7 @@
#include "portab.h"
static char UNUSED id[] = "$Id: conn.c,v 1.155 2005/06/26 13:43:59 alex Exp $";
static char UNUSED id[] = "$Id: conn.c,v 1.155.2.1 2005/07/02 14:45:07 alex Exp $";
#include "imp.h"
#include <assert.h>
@@ -517,6 +517,15 @@ Conn_Handler( void )
} /* Conn_Handler */
/**
* Write a text string into the socket of a connection.
* This function automatically appends CR+LF to the string and validates that
* the result is a valid IRC message (oversized messages are shortened, for
* example). Then it calls the Conn_Write() function to do the actual sending.
* @param Idx Index fo the connection.
* @param Format Format string, see printf().
* @return true on success, false otherwise.
*/
#ifdef PROTOTYPES
GLOBAL bool
Conn_WriteStr( CONN_ID Idx, char *Format, ... )
@@ -528,10 +537,6 @@ char *Format;
va_dcl
#endif
{
/* String in Socket schreiben. CR+LF wird von dieser Funktion
* automatisch angehaengt. Im Fehlerfall wird dir Verbindung
* getrennt und false geliefert. */
char buffer[COMMAND_LEN];
bool ok;
va_list ap;
@@ -544,15 +549,38 @@ va_dcl
#else
va_start( ap );
#endif
if( vsnprintf( buffer, COMMAND_LEN - 2, Format, ap ) >= COMMAND_LEN - 2 )
{
Log( LOG_CRIT, "Text too long to send (connection %d)!", Idx );
Conn_Close( Idx, "Text too long to send!", NULL, false );
return false;
if (vsnprintf(buffer, COMMAND_LEN - 2, Format, ap) >= COMMAND_LEN - 2) {
/*
* The string that should be written to the socket is longer
* than the allowed size of COMMAND_LEN bytes (including both
* the CR and LF characters). This can be caused by the
* IRC_WriteXXX() functions when the prefix of this server had
* to be added to an already "quite long" command line which
* has been received from a regular IRC client, for example.
*
* We are not allowed to send such "oversized" messages to
* other servers and clients, see RFC 2812 2.3 and 2813 3.3
* ("these messages SHALL NOT exceed 512 characters in length,
* counting all characters including the trailing CR-LF").
*
* So we have a big problem here: we should send more bytes
* to the network than we are allowed to and we don't know
* the originator (any more). The "old" behaviour of blaming
* the receiver ("next hop") is a bad idea (it could be just
* an other server only routing the message!), so the only
* option left is to shorten the string and to hope that the
* result is still somewhat useful ...
* -alex-
*/
strcpy (buffer + sizeof(buffer) - strlen(CUT_TXTSUFFIX) - 2 - 1,
CUT_TXTSUFFIX);
}
#ifdef SNIFFER
if( NGIRCd_Sniffer ) Log( LOG_DEBUG, " -> connection %d: '%s'.", Idx, buffer );
if (NGIRCd_Sniffer)
Log(LOG_DEBUG, " -> connection %d: '%s'.", Idx, buffer);
#endif
strlcat( buffer, "\r\n", sizeof( buffer ));

View File

@@ -8,7 +8,7 @@
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: defines.h,v 1.52 2005/05/16 12:22:32 alex Exp $
* $Id: defines.h,v 1.52.2.2 2005/07/05 22:58:25 alex Exp $
*
* Global defines of ngIRCd.
*/
@@ -43,7 +43,8 @@
#define CLIENT_ID_LEN 64 /* max. length of an IRC ID; see RFC 2812, 1.1 and 1.2.1 */
#define CLIENT_NICK_LEN 10 /* max. nick length; see. RFC 2812, 1.2.1 */
#define CLIENT_PASS_LEN 21 /* max. password length */
#define CLIENT_USER_LEN 9 /* max. length of user name ("login") */
#define CLIENT_USER_LEN 10 /* Max. length of user name ("login")
see RFC 2812, section 1.2.1 */
#define CLIENT_NAME_LEN 32 /* max. length of "real names" */
#define CLIENT_HOST_LEN 64 /* max. host name length */
#define CLIENT_MODE_LEN 8 /* max. lenth of all client modes */
@@ -98,6 +99,8 @@
#define NOTICE_TXTPREFIX "" /* prefix for NOTICEs from the server to users */
#define CUT_TXTSUFFIX "[CUT]" /* Suffix for oversized messages that
have been shortened and cut off. */
#ifdef RENDEZVOUS
#define RENDEZVOUS_TYPE "_ircu._tcp." /* service type to register with Rendezvous */
#endif

View File

@@ -12,7 +12,7 @@
#include "portab.h"
static char UNUSED id[] = "$Id: ngircd.c,v 1.102 2005/06/24 19:55:10 alex Exp $";
static char UNUSED id[] = "$Id: ngircd.c,v 1.102.2.2 2005/07/08 23:20:04 alex Exp $";
/**
* @file
@@ -712,28 +712,34 @@ NGIRCd_Init( bool NGIRCd_NoDaemon )
}
}
if ( Conf_UID == 0 ) {
Log( LOG_INFO, "Conf_UID must not be 0, switching to user nobody", Conf_UID );
if (Conf_UID == 0) {
Log(LOG_INFO, "ServerUID must not be 0, using \"nobody\" instead.", Conf_UID);
if (!NGIRCd_getNobodyID(&Conf_UID, &Conf_GID )) {
Log( LOG_WARNING, "Could not get uid/gid of user nobody: %s",
if (! NGIRCd_getNobodyID(&Conf_UID, &Conf_GID)) {
Log(LOG_WARNING, "Could not get user/group ID of user \"nobody\": %s",
errno ? strerror(errno) : "not found" );
return false;
}
}
if( setgid( Conf_GID ) != 0 ) {
real_errno = errno;
Log( LOG_ERR, "Can't change group ID to %u: %s", Conf_GID, strerror( errno ));
if (real_errno != EPERM)
return false;
if (getgid() != Conf_GID) {
/* Change group ID */
if (setgid(Conf_GID) != 0) {
real_errno = errno;
Log( LOG_ERR, "Can't change group ID to %u: %s", Conf_GID, strerror( errno ));
if (real_errno != EPERM)
return false;
}
}
if( setuid( Conf_UID ) != 0 ) {
real_errno = errno;
Log( LOG_ERR, "Can't change user ID to %u: %s", Conf_UID, strerror( errno ));
if (real_errno != EPERM)
return false;
if (getuid() != Conf_UID) {
/* Change user ID */
if (setuid(Conf_UID) != 0) {
real_errno = errno;
Log(LOG_ERR, "Can't change user ID to %u: %s", Conf_UID, strerror(errno));
if (real_errno != EPERM)
return false;
}
}
initialized = true;
@@ -765,16 +771,14 @@ NGIRCd_Init( bool NGIRCd_NoDaemon )
Pidfile_Create( pid );
/* check uid we are running as, can be different from values configured (e.g. if we were already
started with a uid > 0 */
/* Check UID/GID we are running as, can be different from values
* configured (e. g. if we were already started with a UID>0. */
Conf_UID = getuid();
Conf_GID = getgid();
assert( Conf_GID > 0);
assert( Conf_UID > 0);
pwd = getpwuid( Conf_UID );
grp = getgrgid( Conf_GID );
Log( LOG_INFO, "Running as user %s(%ld), group %s(%ld), with PID %ld.",
pwd ? pwd->pw_name : "unknown", Conf_UID,
grp ? grp->gr_name : "unknown", Conf_GID, pid);