mirror of
				https://github.com/osmarks/ngircd.git
				synced 2025-11-04 07:52:59 +00:00 
			
		
		
		
	Compare commits
	
		
			6 Commits
		
	
	
		
			rel-14
			...
			rel-0-8-0-
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					3c33a41fe8 | ||
| 
						 | 
					0d0cdf4831 | ||
| 
						 | 
					030fef4a8a | ||
| 
						 | 
					15d31d31db | ||
| 
						 | 
					2a3ec21702 | ||
| 
						 | 
					9f9576ce31 | 
							
								
								
									
										2
									
								
								AUTHORS
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								AUTHORS
									
									
									
									
									
								
							@@ -31,4 +31,4 @@ Andrew Tridgell & Martin Pool: strl{cpy|cat}()-functions
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
-- 
 | 
			
		||||
$Id: AUTHORS,v 1.9 2004/05/07 11:19:20 alex Exp $
 | 
			
		||||
$Id: AUTHORS,v 1.8.2.1 2004/05/07 11:24:17 alex Exp $
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										11
									
								
								ChangeLog
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								ChangeLog
									
									
									
									
									
								
							@@ -10,7 +10,14 @@
 | 
			
		||||
                               -- ChangeLog --
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
ngIRCd CVSHEAD
 | 
			
		||||
ngircd 0.8.0-pre2 (2004-05-16)
 | 
			
		||||
 | 
			
		||||
  - Enhanced logging to console when running in "no-detached mode": added
 | 
			
		||||
    PID and log messages of resolver sub-processes.
 | 
			
		||||
  - Fixed host name lookups when using IDENT user lookups.
 | 
			
		||||
  - "make clean" and "make maintainer-clean" remove more files mow.
 | 
			
		||||
 | 
			
		||||
ngIRCd 0.8.0-pre1 (2004-05-07)
 | 
			
		||||
 | 
			
		||||
  - Two new configuration options: "ChrootDir" and "MotdPhrase", thanks to
 | 
			
		||||
    Benjamin Pineau <ben@zouh.org>. Now you can force the daemon to change
 | 
			
		||||
@@ -521,4 +528,4 @@ ngIRCd 0.0.1, 31.12.2001
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
-- 
 | 
			
		||||
$Id: ChangeLog,v 1.234 2004/05/07 11:19:20 alex Exp $
 | 
			
		||||
$Id: ChangeLog,v 1.233.2.4 2004/05/15 23:55:48 alex Exp $
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								INSTALL
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								INSTALL
									
									
									
									
									
								
							@@ -163,4 +163,4 @@ number. In both cases the server exits after the output.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
-- 
 | 
			
		||||
$Id: INSTALL,v 1.19 2004/05/07 11:19:20 alex Exp $
 | 
			
		||||
$Id: INSTALL,v 1.18.2.1 2004/05/07 11:24:17 alex Exp $
 | 
			
		||||
 
 | 
			
		||||
@@ -8,18 +8,21 @@
 | 
			
		||||
# (at your option) any later version.
 | 
			
		||||
# Please read the file COPYING, README and AUTHORS for more information.
 | 
			
		||||
#
 | 
			
		||||
# $Id: Makefile.am,v 1.14 2004/01/01 22:24:48 alex Exp $
 | 
			
		||||
# $Id: Makefile.am,v 1.14.2.1 2004/05/11 00:38:17 alex Exp $
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
AUTOMAKE_OPTIONS = gnu
 | 
			
		||||
 | 
			
		||||
SUBDIRS = doc src man contrib
 | 
			
		||||
 | 
			
		||||
clean-local:
 | 
			
		||||
	rm -f build-stamp*
 | 
			
		||||
 | 
			
		||||
maintainer-clean-local:
 | 
			
		||||
	rm -rf autom4te.cache
 | 
			
		||||
	rm -f Makefile.in Makefile aclocal.m4 configure
 | 
			
		||||
	rm -f mkinstalldirs missing depcomp install-sh
 | 
			
		||||
	rm -f config.log build-stamp* debian
 | 
			
		||||
	rm -f config.log debian
 | 
			
		||||
 | 
			
		||||
lint:
 | 
			
		||||
	make -C src/ngircd lint
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										4
									
								
								NEWS
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								NEWS
									
									
									
									
									
								
							@@ -10,7 +10,7 @@
 | 
			
		||||
                                  -- NEWS --
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
ngIRCd CVSHEAD
 | 
			
		||||
ngIRCd 0.8.0-pre1 (2004-05-07)
 | 
			
		||||
 | 
			
		||||
  - Two new configuration options: "ChrootDir" and "MotdPhrase", thanks to
 | 
			
		||||
    Benjamin Pineau <ben@zouh.org>. Now you can force the daemon to change
 | 
			
		||||
@@ -189,4 +189,4 @@ ngIRCd 0.0.1, 31.12.2001
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
-- 
 | 
			
		||||
$Id: NEWS,v 1.65 2004/05/07 11:19:20 alex Exp $
 | 
			
		||||
$Id: NEWS,v 1.64.2.2 2004/05/07 11:56:19 alex Exp $
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								README
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								README
									
									
									
									
									
								
							@@ -84,4 +84,4 @@ mail to: <alex@barton.de> or <alex@arthur.ath.cx>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
-- 
 | 
			
		||||
$Id: README,v 1.19 2004/05/07 11:19:20 alex Exp $
 | 
			
		||||
$Id: README,v 1.18.2.1 2004/05/07 11:24:17 alex Exp $
 | 
			
		||||
 
 | 
			
		||||
@@ -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.102 2004/04/11 13:20:24 alex Exp $
 | 
			
		||||
# $Id: configure.in,v 1.102.2.2 2004/05/15 23:55:48 alex Exp $
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
# -- Initialisation --
 | 
			
		||||
 | 
			
		||||
AC_PREREQ(2.50)
 | 
			
		||||
AC_INIT(ngircd, CVSHEAD)
 | 
			
		||||
AC_INIT(ngircd, 0.8.0-pre2)
 | 
			
		||||
AC_CONFIG_SRCDIR(src/ngircd/ngircd.c)
 | 
			
		||||
AC_CANONICAL_TARGET
 | 
			
		||||
AM_INIT_AUTOMAKE(1.6)
 | 
			
		||||
 
 | 
			
		||||
@@ -8,7 +8,7 @@
 | 
			
		||||
# (at your option) any later version.
 | 
			
		||||
# Please read the file COPYING, README and AUTHORS for more information.
 | 
			
		||||
#
 | 
			
		||||
# $Id: Makefile.am,v 1.3 2004/01/13 01:10:11 alex Exp $
 | 
			
		||||
# $Id: Makefile.am,v 1.3.2.1 2004/05/11 00:38:17 alex Exp $
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
EXTRA_DIST = rules changelog compat control copyright \
 | 
			
		||||
@@ -16,11 +16,12 @@ EXTRA_DIST = rules changelog compat control copyright \
 | 
			
		||||
 | 
			
		||||
maintainer-clean-local:
 | 
			
		||||
	rm -f Makefile Makefile.in
 | 
			
		||||
 | 
			
		||||
clean-local:
 | 
			
		||||
	rm -f ngircd.postinst.debhelper ngircd.postrm.debhelper \
 | 
			
		||||
	 ngircd.prerm.debhelper ngircd.substvars
 | 
			
		||||
	rm -f ngircd-full.postinst.debhelper ngircd-full.postrm.debhelper \
 | 
			
		||||
	 ngircd-full.prerm.debhelper ngircd-full.substvars
 | 
			
		||||
 | 
			
		||||
	rm -rf ngircd ngircd-full
 | 
			
		||||
	rm -f files
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -8,10 +8,13 @@
 | 
			
		||||
# (at your option) any later version.
 | 
			
		||||
# Please read the file COPYING, README and AUTHORS for more information.
 | 
			
		||||
#
 | 
			
		||||
# $Id: Makefile.am,v 1.1 2004/02/29 17:19:43 alex Exp $
 | 
			
		||||
# $Id: Makefile.am,v 1.1.2.1 2004/05/11 00:38:17 alex Exp $
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
clean-local:
 | 
			
		||||
	rm -rf build
 | 
			
		||||
 | 
			
		||||
maintainer-clean-local:
 | 
			
		||||
	rm -f Makefile Makefile.in
 | 
			
		||||
 | 
			
		||||
# -eof-
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
%define name    ngircd
 | 
			
		||||
%define version CVSHEAD
 | 
			
		||||
%define version 0.8.0-pre2
 | 
			
		||||
%define release 1
 | 
			
		||||
%define prefix  %{_prefix}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
# $Id: sample-ngircd.conf,v 1.26 2004/05/07 11:19:20 alex Exp $
 | 
			
		||||
# $Id: sample-ngircd.conf,v 1.25.2.1 2004/05/07 11:24:17 alex Exp $
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# This is a sample configuration file for the ngIRCd, which must be adepted
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
.\"
 | 
			
		||||
.\" $Id: ngircd.conf.5,v 1.13 2004/05/07 11:19:20 alex Exp $
 | 
			
		||||
.\" $Id: ngircd.conf.5,v 1.12.2.1 2004/05/07 11:24:18 alex Exp $
 | 
			
		||||
.\"
 | 
			
		||||
.TH ngircd.conf 5 "Mai 2003" ngircd "ngIRCd Manual"
 | 
			
		||||
.SH NAME
 | 
			
		||||
 
 | 
			
		||||
@@ -14,7 +14,7 @@
 | 
			
		||||
 | 
			
		||||
#include "portab.h"
 | 
			
		||||
 | 
			
		||||
static char UNUSED id[] = "$Id: conf.c,v 1.64 2004/05/07 11:19:21 alex Exp $";
 | 
			
		||||
static char UNUSED id[] = "$Id: conf.c,v 1.63.2.1 2004/05/07 11:24:18 alex Exp $";
 | 
			
		||||
 | 
			
		||||
#include "imp.h"
 | 
			
		||||
#include <assert.h>
 | 
			
		||||
 
 | 
			
		||||
@@ -8,7 +8,7 @@
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 * Please read the file COPYING, README and AUTHORS for more information.
 | 
			
		||||
 *
 | 
			
		||||
 * $Id: conf.h,v 1.29 2004/05/07 11:19:21 alex Exp $
 | 
			
		||||
 * $Id: conf.h,v 1.28.2.1 2004/05/07 11:24:18 alex Exp $
 | 
			
		||||
 *
 | 
			
		||||
 * Configuration management (header)
 | 
			
		||||
 */
 | 
			
		||||
 
 | 
			
		||||
@@ -16,7 +16,7 @@
 | 
			
		||||
 | 
			
		||||
#include "portab.h"
 | 
			
		||||
 | 
			
		||||
static char UNUSED id[] = "$Id: conn.c,v 1.134 2004/04/25 14:06:12 alex Exp $";
 | 
			
		||||
static char UNUSED id[] = "$Id: conn.c,v 1.134.2.1 2004/05/15 23:52:17 alex Exp $";
 | 
			
		||||
 | 
			
		||||
#include "imp.h"
 | 
			
		||||
#include <assert.h>
 | 
			
		||||
@@ -1600,35 +1600,28 @@ Init_Socket( INT Sock )
 | 
			
		||||
LOCAL VOID
 | 
			
		||||
Read_Resolver_Result( INT r_fd )
 | 
			
		||||
{
 | 
			
		||||
	/* Ergebnis von Resolver Sub-Prozess aus Pipe lesen
 | 
			
		||||
	 * und entsprechende Connection aktualisieren */
 | 
			
		||||
	/* Read result of resolver sub-process from pipe and update the
 | 
			
		||||
	 * apropriate connection/client structure(s): hostname and/or
 | 
			
		||||
	 * IDENT user name.*/
 | 
			
		||||
 | 
			
		||||
	CHAR result[HOST_LEN];
 | 
			
		||||
	CLIENT *c;
 | 
			
		||||
	INT len, i, n;
 | 
			
		||||
 | 
			
		||||
	FD_CLR( r_fd, &Resolver_FDs );
 | 
			
		||||
 | 
			
		||||
	/* Read result from pipe */
 | 
			
		||||
	len = read( r_fd, result, HOST_LEN - 1 );
 | 
			
		||||
	if( len < 0 )
 | 
			
		||||
	{
 | 
			
		||||
		/* Error! */
 | 
			
		||||
		close( r_fd );
 | 
			
		||||
		Log( LOG_CRIT, "Resolver: Can't read result: %s!", strerror( errno ));
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
	result[len] = '\0';
 | 
			
		||||
	RES_STAT *s;
 | 
			
		||||
	CHAR *ptr;
 | 
			
		||||
 | 
			
		||||
	/* Search associated connection ... */
 | 
			
		||||
	for( i = 0; i < Pool_Size; i++ )
 | 
			
		||||
	{
 | 
			
		||||
		if(( My_Connections[i].sock != NONE ) && ( My_Connections[i].res_stat ) && ( My_Connections[i].res_stat->pipe[0] == r_fd )) break;
 | 
			
		||||
		if(( My_Connections[i].sock != NONE )
 | 
			
		||||
		  && ( My_Connections[i].res_stat != NULL )
 | 
			
		||||
		  && ( My_Connections[i].res_stat->pipe[0] == r_fd ))
 | 
			
		||||
			break;
 | 
			
		||||
	}
 | 
			
		||||
	if( i >= Pool_Size )
 | 
			
		||||
	{
 | 
			
		||||
		/* Ops, none found? Probably the connection has already
 | 
			
		||||
		 * been closed. */
 | 
			
		||||
		 * been closed!? We'll ignore that ... */
 | 
			
		||||
		FD_CLR( r_fd, &Resolver_FDs );
 | 
			
		||||
		close( r_fd );
 | 
			
		||||
#ifdef DEBUG
 | 
			
		||||
		Log( LOG_DEBUG, "Resolver: Got result for unknown connection!?" );
 | 
			
		||||
@@ -1636,61 +1629,102 @@ Read_Resolver_Result( INT r_fd )
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* Get resolver structure */
 | 
			
		||||
	s = My_Connections[i].res_stat;
 | 
			
		||||
	assert( s != NULL );
 | 
			
		||||
 | 
			
		||||
	/* Read result from pipe */
 | 
			
		||||
	len = read( r_fd, s->buffer + s->bufpos, sizeof( s->buffer ) - HOST_LEN - 1 );
 | 
			
		||||
	if( len < 0 )
 | 
			
		||||
	{
 | 
			
		||||
		/* Error! */
 | 
			
		||||
		close( r_fd );
 | 
			
		||||
		Log( LOG_CRIT, "Resolver: Can't read result: %s!", strerror( errno ));
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
	s->bufpos += len;
 | 
			
		||||
	s->buffer[s->bufpos] = '\0';
 | 
			
		||||
 | 
			
		||||
	/* If the result string is incomplete, return to main loop and
 | 
			
		||||
	 * wait until we can read in more bytes. */
 | 
			
		||||
#ifdef IDENTAUTH
 | 
			
		||||
try_resolve:
 | 
			
		||||
#endif
 | 
			
		||||
	ptr = strchr( s->buffer, '\n' );
 | 
			
		||||
	if( ! ptr ) return;
 | 
			
		||||
	*ptr = '\0';
 | 
			
		||||
 | 
			
		||||
#ifdef DEBUG
 | 
			
		||||
	Log( LOG_DEBUG, "Resolver: %s is \"%s\".", My_Connections[i].host, result );
 | 
			
		||||
	Log( LOG_DEBUG, "Got result from resolver: \"%s\" (%d bytes), stage %d.", s->buffer, len, s->stage );
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	/* Clean up ... */
 | 
			
		||||
	close( My_Connections[i].res_stat->pipe[0] );
 | 
			
		||||
	close( My_Connections[i].res_stat->pipe[1] );
 | 
			
		||||
	free( My_Connections[i].res_stat );
 | 
			
		||||
	My_Connections[i].res_stat = NULL;
 | 
			
		||||
 | 
			
		||||
	/* Okay, we got a complete result: this is a host name for outgoing
 | 
			
		||||
	 * connections and a host name or IDENT user name (if enabled) for
 | 
			
		||||
	 * incoming conneciions.*/
 | 
			
		||||
	if( My_Connections[i].sock > NONE )
 | 
			
		||||
	{
 | 
			
		||||
		/* Incoming connection */
 | 
			
		||||
#ifdef IDENTAUTH
 | 
			
		||||
		CHAR *ident;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
		/* Search client ... */
 | 
			
		||||
		c = Client_GetFromConn( i );
 | 
			
		||||
		assert( c != NULL );
 | 
			
		||||
 | 
			
		||||
		/* Only update client information of unregistered clients */
 | 
			
		||||
		if( Client_Type( c ) != CLIENT_UNKNOWN )
 | 
			
		||||
		if( Client_Type( c ) == CLIENT_UNKNOWN )
 | 
			
		||||
		{
 | 
			
		||||
#ifdef DEBUG
 | 
			
		||||
			Log( LOG_DEBUG, "Resolver: discarding result for already registered connection %d.", i );
 | 
			
		||||
#endif
 | 
			
		||||
			return;
 | 
			
		||||
		}		
 | 
			
		||||
 | 
			
		||||
		/* Set hostname */
 | 
			
		||||
		strlcpy( My_Connections[i].host, result, sizeof( My_Connections[i].host ));
 | 
			
		||||
		Client_SetHostname( c, result );
 | 
			
		||||
			if( s->stage == 0 )
 | 
			
		||||
			{
 | 
			
		||||
				/* host name */
 | 
			
		||||
				strlcpy( My_Connections[i].host, s->buffer, sizeof( My_Connections[i].host ));
 | 
			
		||||
				Client_SetHostname( c, s->buffer );
 | 
			
		||||
 | 
			
		||||
#ifdef IDENTAUTH
 | 
			
		||||
		ident = strchr( result, 0 );
 | 
			
		||||
		ident++;
 | 
			
		||||
				/* clean up buffer for IDENT result */
 | 
			
		||||
				len = strlen( s->buffer ) + 1;
 | 
			
		||||
				memmove( s->buffer, s->buffer + len, sizeof( s->buffer ) - len );
 | 
			
		||||
				s->bufpos -= len;
 | 
			
		||||
 | 
			
		||||
		/* Do we have a result of the IDENT lookup? If so, set it as the user name */
 | 
			
		||||
		if( *ident )
 | 
			
		||||
				/* Don't close pipe and clean up, but
 | 
			
		||||
				 * instead wait for IDENT result */
 | 
			
		||||
				s->stage = 1;
 | 
			
		||||
				goto try_resolve;
 | 
			
		||||
			}
 | 
			
		||||
			else if( s->stage == 1 )
 | 
			
		||||
			{
 | 
			
		||||
			Log( LOG_INFO, "IDENT lookup for connection %ld: \"%s\".", i, ident );
 | 
			
		||||
			Client_SetUser( c, ident, TRUE );
 | 
			
		||||
				/* IDENT user name */
 | 
			
		||||
				if( s->buffer[0] )
 | 
			
		||||
				{
 | 
			
		||||
					Log( LOG_INFO, "IDENT lookup for connection %ld: \"%s\".", i, s->buffer );
 | 
			
		||||
					Client_SetUser( c, s->buffer, TRUE );
 | 
			
		||||
				}
 | 
			
		||||
				else Log( LOG_INFO, "IDENT lookup for connection %ld: no result.", i );
 | 
			
		||||
#endif
 | 
			
		||||
			}
 | 
			
		||||
			else Log( LOG_ERR, "Resolver: got result for unknown stage %d!?", s->stage );
 | 
			
		||||
		}
 | 
			
		||||
#ifdef DEBUG
 | 
			
		||||
		else Log( LOG_DEBUG, "Resolver: discarding result for already registered connection %d.", i );
 | 
			
		||||
#endif
 | 
			
		||||
	}
 | 
			
		||||
	else
 | 
			
		||||
	{
 | 
			
		||||
		/* Outgoing connection (server link!): set IP address */
 | 
			
		||||
		/* Outgoing connection (server link): set the IP address
 | 
			
		||||
		 * so that we can connect to it in the main loop. */
 | 
			
		||||
 | 
			
		||||
		/* Search server ... */
 | 
			
		||||
		n = Conf_GetServer( i );
 | 
			
		||||
		assert( n > NONE );
 | 
			
		||||
		strlcpy( Conf_Server[n].ip, result, sizeof( Conf_Server[n].ip ));
 | 
			
		||||
 | 
			
		||||
		strlcpy( Conf_Server[n].ip, s->buffer, sizeof( Conf_Server[n].ip ));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* Clean up ... */
 | 
			
		||||
	FD_CLR( r_fd, &Resolver_FDs );
 | 
			
		||||
	close( My_Connections[i].res_stat->pipe[0] );
 | 
			
		||||
	close( My_Connections[i].res_stat->pipe[1] );
 | 
			
		||||
	free( My_Connections[i].res_stat );
 | 
			
		||||
	My_Connections[i].res_stat = NULL;
 | 
			
		||||
 | 
			
		||||
	/* Reset penalty time */
 | 
			
		||||
	Conn_ResetPenalty( i );
 | 
			
		||||
} /* Read_Resolver_Result */
 | 
			
		||||
 
 | 
			
		||||
@@ -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.46 2004/05/07 11:19:21 alex Exp $
 | 
			
		||||
 * $Id: defines.h,v 1.45.2.1 2004/05/07 11:24:18 alex Exp $
 | 
			
		||||
 *
 | 
			
		||||
 * Global defines of ngIRCd.
 | 
			
		||||
 */
 | 
			
		||||
 
 | 
			
		||||
@@ -14,7 +14,7 @@
 | 
			
		||||
 | 
			
		||||
#include "portab.h"
 | 
			
		||||
 | 
			
		||||
static char UNUSED id[] = "$Id: irc-info.c,v 1.22 2004/05/07 11:19:21 alex Exp $";
 | 
			
		||||
static char UNUSED id[] = "$Id: irc-info.c,v 1.21.2.1 2004/05/07 11:24:18 alex Exp $";
 | 
			
		||||
 | 
			
		||||
#include "imp.h"
 | 
			
		||||
#include <assert.h>
 | 
			
		||||
 
 | 
			
		||||
@@ -14,7 +14,7 @@
 | 
			
		||||
 | 
			
		||||
#include "portab.h"
 | 
			
		||||
 | 
			
		||||
static char UNUSED id[] = "$Id: irc-server.c,v 1.36 2004/04/25 15:43:18 alex Exp $";
 | 
			
		||||
static char UNUSED id[] = "$Id: irc-server.c,v 1.36.2.1 2004/05/15 23:52:17 alex Exp $";
 | 
			
		||||
 | 
			
		||||
#include "imp.h"
 | 
			
		||||
#include <assert.h>
 | 
			
		||||
@@ -23,6 +23,7 @@ static char UNUSED id[] = "$Id: irc-server.c,v 1.36 2004/04/25 15:43:18 alex Exp
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include <strings.h>
 | 
			
		||||
 | 
			
		||||
#include "defines.h"
 | 
			
		||||
#include "resolve.h"
 | 
			
		||||
#include "conn.h"
 | 
			
		||||
#include "conn-zip.h"
 | 
			
		||||
 
 | 
			
		||||
@@ -14,7 +14,7 @@
 | 
			
		||||
 | 
			
		||||
#include "portab.h"
 | 
			
		||||
 | 
			
		||||
static char UNUSED id[] = "$Id: log.c,v 1.45 2004/05/07 11:19:21 alex Exp $";
 | 
			
		||||
static char UNUSED id[] = "$Id: log.c,v 1.44.2.2 2004/05/15 23:51:13 alex Exp $";
 | 
			
		||||
 | 
			
		||||
#include "imp.h"
 | 
			
		||||
#include <assert.h>
 | 
			
		||||
@@ -182,7 +182,7 @@ va_dcl
 | 
			
		||||
	if( NGIRCd_NoDaemon )
 | 
			
		||||
	{
 | 
			
		||||
		/* auf Konsole ausgeben */
 | 
			
		||||
		fprintf( stdout, "[%d] %s\n", Level, msg );
 | 
			
		||||
		fprintf( stdout, "[%d:%d] %s\n", getpid( ), Level, msg );
 | 
			
		||||
		fflush( stdout );
 | 
			
		||||
	}
 | 
			
		||||
#ifdef SYSLOG
 | 
			
		||||
@@ -214,12 +214,14 @@ Log_Init_Resolver( VOID )
 | 
			
		||||
#ifdef SYSLOG
 | 
			
		||||
	openlog( PACKAGE_NAME, LOG_CONS|LOG_PID, LOG_LOCAL5 );
 | 
			
		||||
#endif
 | 
			
		||||
	Log_Resolver( LOG_DEBUG, "Resolver sub-process starting, PID %d.", getpid( ));
 | 
			
		||||
} /* Log_Init_Resolver */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
GLOBAL VOID
 | 
			
		||||
Log_Exit_Resolver( VOID )
 | 
			
		||||
{
 | 
			
		||||
	Log_Resolver( LOG_DEBUG, "Resolver sub-process %d done.", getpid( ));
 | 
			
		||||
#ifdef SYSLOG
 | 
			
		||||
	closelog( );
 | 
			
		||||
#endif
 | 
			
		||||
@@ -239,17 +241,11 @@ va_dcl
 | 
			
		||||
{
 | 
			
		||||
	/* Eintrag des Resolver in Logfile(s) schreiben */
 | 
			
		||||
 | 
			
		||||
#ifndef SYSLOG
 | 
			
		||||
	return;
 | 
			
		||||
#else
 | 
			
		||||
 | 
			
		||||
	CHAR msg[MAX_LOG_MSG_LEN];
 | 
			
		||||
	va_list ap;
 | 
			
		||||
 | 
			
		||||
	assert( Format != NULL );
 | 
			
		||||
 | 
			
		||||
	if( NGIRCd_NoDaemon ) return;
 | 
			
		||||
 | 
			
		||||
#ifdef DEBUG
 | 
			
		||||
	if(( Level == LOG_DEBUG ) && ( ! NGIRCd_Debug )) return;
 | 
			
		||||
#else
 | 
			
		||||
@@ -265,9 +261,15 @@ va_dcl
 | 
			
		||||
	vsnprintf( msg, MAX_LOG_MSG_LEN, Format, ap );
 | 
			
		||||
	va_end( ap );
 | 
			
		||||
 | 
			
		||||
	/* ... und ausgeben */
 | 
			
		||||
	syslog( Level, msg );
 | 
			
		||||
 | 
			
		||||
	/* Output */
 | 
			
		||||
	if( NGIRCd_NoDaemon )
 | 
			
		||||
	{
 | 
			
		||||
		/* Output to console */
 | 
			
		||||
		fprintf( stdout, "[%d:%d] %s\n", getpid( ), Level, msg );
 | 
			
		||||
		fflush( stdout );
 | 
			
		||||
	}
 | 
			
		||||
#ifdef SYSLOG
 | 
			
		||||
	else syslog( Level, msg );
 | 
			
		||||
#endif
 | 
			
		||||
} /* Log_Resolver */
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -14,7 +14,7 @@
 | 
			
		||||
 | 
			
		||||
#include "portab.h"
 | 
			
		||||
 | 
			
		||||
static char UNUSED id[] = "$Id: ngircd.c,v 1.84 2004/05/07 11:19:21 alex Exp $";
 | 
			
		||||
static char UNUSED id[] = "$Id: ngircd.c,v 1.83.2.2 2004/05/15 23:52:17 alex Exp $";
 | 
			
		||||
 | 
			
		||||
#include "imp.h"
 | 
			
		||||
#include <assert.h>
 | 
			
		||||
@@ -31,13 +31,13 @@ static char UNUSED id[] = "$Id: ngircd.c,v 1.84 2004/05/07 11:19:21 alex Exp $";
 | 
			
		||||
#include <pwd.h>
 | 
			
		||||
#include <grp.h>
 | 
			
		||||
 | 
			
		||||
#include "defines.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"
 | 
			
		||||
#include "parse.h"
 | 
			
		||||
 
 | 
			
		||||
@@ -14,7 +14,7 @@
 | 
			
		||||
 | 
			
		||||
#include "portab.h"
 | 
			
		||||
 | 
			
		||||
static char UNUSED id[] = "$Id: resolve.c,v 1.8 2004/03/11 22:16:31 alex Exp $";
 | 
			
		||||
static char UNUSED id[] = "$Id: resolve.c,v 1.8.2.1 2004/05/15 23:52:17 alex Exp $";
 | 
			
		||||
 | 
			
		||||
#include "imp.h"
 | 
			
		||||
#include <assert.h>
 | 
			
		||||
@@ -102,6 +102,8 @@ Resolve_Addr( struct sockaddr_in *Addr )
 | 
			
		||||
		FD_SET( s->pipe[0], &Resolver_FDs );
 | 
			
		||||
		if( s->pipe[0] > Conn_MaxFD ) Conn_MaxFD = s->pipe[0];
 | 
			
		||||
		s->pid = pid;
 | 
			
		||||
		s->stage = 0;
 | 
			
		||||
		s->bufpos = 0;
 | 
			
		||||
		return s;
 | 
			
		||||
	}
 | 
			
		||||
	else if( pid == 0 )
 | 
			
		||||
@@ -160,6 +162,8 @@ Resolve_Name( CHAR *Host )
 | 
			
		||||
		FD_SET( s->pipe[0], &Resolver_FDs );
 | 
			
		||||
		if( s->pipe[0] > Conn_MaxFD ) Conn_MaxFD = s->pipe[0];
 | 
			
		||||
		s->pid = pid;
 | 
			
		||||
		s->stage = 0;
 | 
			
		||||
		s->bufpos = 0;
 | 
			
		||||
		return s;
 | 
			
		||||
	}
 | 
			
		||||
	else if( pid == 0 )
 | 
			
		||||
@@ -193,13 +197,13 @@ Do_ResolveAddr( struct sockaddr_in *Addr, INT w_fd )
 | 
			
		||||
 | 
			
		||||
	CHAR hostname[HOST_LEN];
 | 
			
		||||
	struct hostent *h;
 | 
			
		||||
	INT len;
 | 
			
		||||
#ifdef IDENTAUTH
 | 
			
		||||
	CHAR *res;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	Log_Resolver( LOG_DEBUG, "Now resolving %s ...", inet_ntoa( Addr->sin_addr ));
 | 
			
		||||
 | 
			
		||||
	/* Resolve IP address */
 | 
			
		||||
	Log_Resolver( LOG_DEBUG, "Now resolving %s ...", inet_ntoa( Addr->sin_addr ));
 | 
			
		||||
	h = gethostbyaddr( (CHAR *)&Addr->sin_addr, sizeof( Addr->sin_addr ), AF_INET );
 | 
			
		||||
	if( h ) strlcpy( hostname, h->h_name, sizeof( hostname ));
 | 
			
		||||
	else
 | 
			
		||||
@@ -211,33 +215,35 @@ Do_ResolveAddr( struct sockaddr_in *Addr, INT w_fd )
 | 
			
		||||
#endif	
 | 
			
		||||
		strlcpy( hostname, inet_ntoa( Addr->sin_addr ), sizeof( hostname ));
 | 
			
		||||
	}
 | 
			
		||||
	Log_Resolver( LOG_DEBUG, "Ok, translated %s to \"%s\".", inet_ntoa( Addr->sin_addr ), hostname );
 | 
			
		||||
 | 
			
		||||
#ifdef IDENTAUTH
 | 
			
		||||
	/* Do "IDENT" (aka "AUTH") lookup and write result to parent */
 | 
			
		||||
	Log_Resolver( LOG_DEBUG, "Doing IDENT lookup on socket %d ...", Sock );
 | 
			
		||||
	res = ident_id( Sock, 10 );
 | 
			
		||||
	Log_Resolver( LOG_DEBUG, "IDENT lookup on socket %d done.", Sock );
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	/* Write result into pipe to parent */
 | 
			
		||||
	if( (size_t)write( w_fd, hostname, strlen( hostname ) + 1 ) != (size_t)( strlen( hostname ) + 1 ))
 | 
			
		||||
	/* Write resolver result into pipe to parent */
 | 
			
		||||
	len = strlen( hostname ); 
 | 
			
		||||
	hostname[len] = '\n'; len++;
 | 
			
		||||
	if( (size_t)write( w_fd, hostname, len ) != (size_t)len )
 | 
			
		||||
	{
 | 
			
		||||
		Log_Resolver( LOG_CRIT, "Resolver: Can't write to parent: %s!", strerror( errno ));
 | 
			
		||||
		close( w_fd );
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
#ifdef IDENTAUTH
 | 
			
		||||
	if( (size_t)write( w_fd, res ? res : "", strlen( res ? res : "" ) + 1 ) != (size_t)( strlen( res ? res : "" ) + 1 ))
 | 
			
		||||
	/* Do "IDENT" (aka "AUTH") lookup and write result to parent */
 | 
			
		||||
	Log_Resolver( LOG_DEBUG, "Doing IDENT lookup on socket %d ...", Sock );
 | 
			
		||||
	res = ident_id( Sock, 10 );
 | 
			
		||||
	Log_Resolver( LOG_DEBUG, "Ok, IDENT lookup on socket %d done: \"%s\"", Sock, res ? res : "" );
 | 
			
		||||
 | 
			
		||||
	/* Write IDENT result into pipe to parent */
 | 
			
		||||
	len = strlen( res ? res : "" );
 | 
			
		||||
	if( res != NULL ) res[len] = '\n';
 | 
			
		||||
	len++;
 | 
			
		||||
	if( (size_t)write( w_fd, res ? res : "\n", len ) != (size_t)len )
 | 
			
		||||
	{
 | 
			
		||||
		Log_Resolver( LOG_CRIT, "Resolver: Can't write to parent (IDENT): %s!", strerror( errno ));
 | 
			
		||||
		close( w_fd );
 | 
			
		||||
		free( res );
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
	free( res );
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	Log_Resolver( LOG_DEBUG, "Ok, translated %s to \"%s\".", inet_ntoa( Addr->sin_addr ), hostname );
 | 
			
		||||
} /* Do_ResolveAddr */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -250,6 +256,7 @@ Do_ResolveName( CHAR *Host, INT w_fd )
 | 
			
		||||
	CHAR ip[16];
 | 
			
		||||
	struct hostent *h;
 | 
			
		||||
	struct in_addr *addr;
 | 
			
		||||
	INT len;
 | 
			
		||||
 | 
			
		||||
	Log_Resolver( LOG_DEBUG, "Now resolving \"%s\" ...", Host );
 | 
			
		||||
 | 
			
		||||
@@ -269,16 +276,16 @@ Do_ResolveName( CHAR *Host, INT w_fd )
 | 
			
		||||
#endif
 | 
			
		||||
		strcpy( ip, "" );
 | 
			
		||||
	}
 | 
			
		||||
	if( ip[0] ) Log_Resolver( LOG_DEBUG, "Ok, translated \"%s\" to %s.", Host, ip );
 | 
			
		||||
 | 
			
		||||
	/* Write result into pipe to parent */
 | 
			
		||||
	if( (size_t)write( w_fd, ip, strlen( ip ) + 1 ) != (size_t)( strlen( ip ) + 1 ))
 | 
			
		||||
	len = strlen( ip );
 | 
			
		||||
	ip[len] = '\n'; len++;
 | 
			
		||||
	if( (size_t)write( w_fd, ip, len ) != (size_t)len )
 | 
			
		||||
	{
 | 
			
		||||
		Log_Resolver( LOG_CRIT, "Resolver: Can't write to parent: %s!", strerror( errno ));
 | 
			
		||||
		close( w_fd );
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if( ip[0] ) Log_Resolver( LOG_DEBUG, "Ok, translated \"%s\" to %s.", Host, ip );
 | 
			
		||||
} /* Do_ResolveName */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -8,7 +8,7 @@
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 * Please read the file COPYING, README and AUTHORS for more information.
 | 
			
		||||
 *
 | 
			
		||||
 * $Id: resolve.h,v 1.6 2003/12/27 13:01:12 alex Exp $
 | 
			
		||||
 * $Id: resolve.h,v 1.6.2.1 2004/05/15 23:52:17 alex Exp $
 | 
			
		||||
 *
 | 
			
		||||
 * Asynchronous resolver (header)
 | 
			
		||||
 */
 | 
			
		||||
@@ -29,6 +29,9 @@ typedef struct _Res_Stat
 | 
			
		||||
{
 | 
			
		||||
	INT pid;			/* PID des Child-Prozess */
 | 
			
		||||
	INT pipe[2];			/* Pipe fuer IPC */
 | 
			
		||||
	INT stage;			/* Hostname/IP(0) or IDENT(1)? */
 | 
			
		||||
	INT bufpos;			/* Position in buffer */
 | 
			
		||||
	CHAR buffer[HOST_LEN];		/* Buffer */
 | 
			
		||||
} RES_STAT;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user