dslinux/user/bitchx/dll/identd Makefile.in identd.c identd.sh

stsp stsp at user.in-berlin.de
Sun Jul 2 15:18:36 CEST 2006


Update of /cvsroot/dslinux/dslinux/user/bitchx/dll/identd
In directory antilope:/tmp/cvs-serv9280/dll/identd

Added Files:
	Makefile.in identd.c identd.sh 
Log Message:
Adding pristine copy of BitchX so I can branch from it.


--- NEW FILE: Makefile.in ---
SHELL = @SHELL@

srcdir = @srcdir@
VPATH = @srcdir@
top_srcdir = @top_srcdir@
topdir = @topdir@
prefix = @prefix@
exec_prefix = @exec_prefix@

bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = @oldincludedir@

local_dir = $(HOME)

# Where the BitchX binary will be installed.
# "make install" will compile and install the program.
INSTALL_IRC = @INSTALL_IRC@

# Where the BitchX library will be. Generally this is the place that
# you put the scripts, help pages and translation tables. It is
# very important that you set this correctly.
IRCLIB = @IRCLIB@

CC = @CC@
DEFS = @INCLUDES@
LIBS = @LIBS@

# Tcl library.
TCL_LIBS = @TCL_LIBS@

# These are for Tcl support.
TCL_OBJS = @TCL_OBJS@
# You don't have the following, so you'll want to leave this blank.
TCL_SRCS = @TCL_SRCS@

# Set this to -g if you want to be able to debug the client, otherwise
# use -O to have the compiler do some optimization instead.
CFLAGS = @CFLAGS@

# Set this to -s if you want the binary to be stripped.
LDFLAGS = @LDFLAGS@

# These are for the cd device player.
CD_SRCS = @CD_SRCS@
CD_OBJS = @CD_OBJS@

# This is the executable suffix for the target operating system.
EXEEXT = @EXEEXT@

# Extra files.
DEFAULT_CTOOLZ_DIR = @DEFAULT_CTOOLZ_DIR@
DEFAULT_MSGLOGFILE = @DEFAULT_MSGLOGFILE@
DEFAULT_BITCHX_HELP_FILE = @DEFAULT_BITCHX_HELP_FILE@
DEFAULT_SCRIPT_HELP_FILE = @DEFAULT_SCRIPT_HELP_FILE@
DEFAULT_BITCHX_KICK_FILE = @DEFAULT_BITCHX_KICK_FILE@
DEFAULT_BITCHX_QUIT_FILE = @DEFAULT_BITCHX_QUIT_FILE@
DEFAULT_BITCHX_IRCNAME_FILE = @DEFAULT_BITCHX_IRCNAME_FILE@

# Full path of the directory for BitchX help files.
HELPDIR = @HELPDIR@

# Full path of the directory for the BitchX scripts.
INSTALL_SCRIPT = @INSTALL_SCRIPT@

# Default setting for IRCPATH where BitchX will look for
# its script files if the environment variable is undefined.
# Usually, this should contain the same path as used for INSTALL_SCRIPT in
# the Makefile, but it can contain multiple path elements
# separated by colons. The path MUST lead to an existing directory,
# because the 'global' script is expected to be found there.
IRCPATH = @IRCPATH@

# Path for TRANSLATION variable.
TRANSLATION_PATH = @TRANSLATION_PATH@

# This command will be used to install the BitchX help files. If you don't
# want to install them, replace with the following:
# INSTALL_HELP_CMD = @echo The help files have not been installed.
INSTALL_HELP_CMD = @INSTALL_HELP_CMD@

# This is where the optional plugins will be copied to.
PLUGINDIR = @PLUGINDIR@

# Plugin flags.
SHLIB_LD = @SHLIB_LD@
SHLIB_CFLAGS = @SHLIB_CFLAGS@
SHLIB_SUFFIX = @SHLIB_SUFFIX@

# This command will be used to install the BitchX files on Win32/OS2EMX
# systems.
WINNT_INSTALL = @WINNT_INSTALL@

# This program allows you to use screen/xterm's to put new BitchX windows
# on new screen/xterm windows.
INSTALL_WSERV = @INSTALL_WSERV@

# This program allows you to screen BitchX and reattach to it later.
INSTALL_SCRBX = @INSTALL_SCRBX@

# Set gzip and bzip2 options.
GZIP_ENV = @GZIP_ENV@
BZIP2 = @BZIP2@

# Standard programs.
RM = @RM@
LN = @LN_S@
CP = @CP@
MV = @MV@

INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@

VERSION = @VERSION@
_VERSION_ = @_VERSION_@

MAKE_BIN = @MAKE@
MAKE = $(MAKE_BIN) $(MFLAGS)
MFLAGS = \
	'local_dir=$(HOME)'			\
	'INSTALL_IRC=$(INSTALL_IRC)'		\
	'IRCLIB=$(IRCLIB)'			\
	'CC=$(CC)'				\
	'CFLAGS=$(CFLAGS)'			\
	'HELPDIR=$(HELPDIR)'			\
        'INSTALL_WSERV=$(INSTALL_WSERV)'	\
	'IRCPATH=$(IRCPATH)'			\
	'TRANSLATION_PATH=$(TRANSLATION_PATH)'	\
	'LDFLAGS=$(LDFLAGS)'			\
	'LIBS=$(LIBS)'				\
	'LN=$(LN)'				\
	'RM=$(RM)'				\
	'TCL_SRCS=$(TCL_SRCS)'			\
	'TCL_OBJS=$(TCL_OBJS)'			\
	'CD_PLAY=$(CD_PLAY)'			\
	'CD_SRCS=$(CD_SRCS)'			\
	'CD_OBJS=$(CD_OBJS)'			\
	'TCL_LIBS=$(TCL_LIBS)'			\
	'PLUGINDIR=$(PLUGINDIR)'		\
	'_VERSION_=$(_VERSION_)'		\
	'VERSION=$(VERSION)'			\
	'INSTALL_DATA=$(INSTALL_DATA)'		\
	'INSTALL_SCRIPT=$(INSTALL_SCRIPT)'	\
	'EXEEXT=$(EXEEXT)'			\
	'SHLIB_CFLAGS=$(SHLIB_CFLAGS)'		\
	'SHLIB_SUFFIX=$(SHLIB_SUFFIX)'

## Makefile starts here.

PLUGIN_NAME = identd

all: Makefile identd$(SHLIB_SUFFIX)

Makefile: Makefile.in
	cd $(topdir) \
	  && ./config.status

identd.o: $(srcdir)/identd.c
	$(CC) $(DEFS) $(CFLAGS) -c $(srcdir)/identd.c

identd$(SHLIB_SUFFIX): identd.o ../dllinit.o
	$(SHLIB_LD) identd.o ../dllinit.o $(SHLIB_CFLAGS) -o identd$(SHLIB_SUFFIX)

clean:
	$(RM) *~ *.o *.a *.dll *.so identd$(SHLIB_SUFFIX) *.def .#*

distclean: clean
	$(RM) Makefile

install:
	$(INSTALL) $(PLUGIN_NAME)$(SHLIB_SUFFIX) $(PLUGINDIR)

--- NEW FILE: identd.sh ---
#!/bin/sh
# Make .def file:
export LIBPATH=/usr/local/cygwin-new/i586-pc-cygwin/lib
export LD=/usr/local/cygwin-new/bin/i586-pc-cygwin-ld
export NM=/usr/local/cygwin-new/bin/i586-pc-cygwin-nm
export DLLTOOL=/usr/local/cygwin-new/bin/i586-pc-cygwin-dlltool
export AS=/usr/local/cygwin-new/bin/i586-pc-cygwin-as
export GCC=/usr/local/cygwin-new/bin/i586-pc-cygwin-gcc
CP=cp
RM=rm

$GCC -I../../include -c identd.c

echo EXPORTS > identd.def
$NM identd.o ../init.o ../fixup.o | grep '^........ [T] _' | sed 's/[^_]*_//' >> identd.def

# Link DLL.
$LD --base-file identd.base --dll -o identd.dll identd.o ../init.o ../fixup.o\
 $LIBPATH/libcygwin.a $LIBPATH/libkernel32.a -e _dll_entry at 12
$DLLTOOL --as=$AS --dllname identd.dll --def identd.def --base-file\
 identd.base --output-exp identd.exp
$LD --base-file identd.base identd.exp --dll -o identd.dll identd.o\
 ../init.o ../fixup.o $LIBPATH/libcygwin.a $LIBPATH/libkernel32.a -e _dll_entry at 12
$DLLTOOL --as=$AS --dllname identd.dll --def identd.def --base-file\
 identd.base --output-exp identd.exp
$LD identd.exp --dll -o identd.dll identd.o ../init.o ../fixup.o\
 $LIBPATH/libcygwin.a $LIBPATH/libkernel32.a -e _dll_entry at 12

# Build the identdB.a lib to link to:
$DLLTOOL --as=$AS --dllname identd.dll --def identd.def --output-lib identd.a

$RM *.base *.exp *.def
$CP *.dll ..

--- NEW FILE: identd.c ---
/*
 * experimental identd module for bx. 
 * adds a /set identd on/off toggle.
 * adds a /set identd_user <username>
 * and implements a identd server for bx. This obviously won't work unless
 * your running as root. And is mainly meant for use with os/2 and win95 
 * ports. 
 * Copyright 1998 Colten Edwards. 
 */ 

#include "irc.h"
#include "struct.h"
#include "ircaux.h"
#include "output.h"
#include "vars.h"
#include "module.h"
#define INIT_MODULE
#include "modval.h"

void identd_read(int s)
{
char buffer[100];
char *bufptr;
unsigned int lport = 0, rport = 0;
	*buffer = 0;
	bufptr = buffer;
	if (recv(s, buffer, sizeof(buffer)-1, 0) <=0)
	{
		bitchsay("ERROR in identd request");
		close_socketread(s);
		return;
	}
	if (sscanf(bufptr, "%d , %d", &lport, &rport) == 2)
	{
		if (lport < 1 || rport < 1 || lport > 32767 || rport > 32767)
		{
			close_socketread(s);
			bitchsay("ERROR port for identd bad [%d:%d]", lport, rport);
			return;
		}
		sprintf(buffer, "%hu , %hu : USERID : UNIX : %s", lport, rport, get_dllstring_var("identd_user"));
		dcc_printf(s, "%s\r\n", buffer);
		bitchsay("Sent IDENTD request %s", buffer);
		set_socketflags(identd, now);
	}
	close_socketread(s);
}

void identd_handler(int s)
{
struct  sockaddr_in     remaddr;
int sra = sizeof(struct sockaddr_in);
int sock = -1;
#if 0
	if (!(get_dllint_var("identd")) || !(get_dllstring_var("identd_user")))
	{
		int opt = 0;
		int optlen = sizeof(opt);
		getsockopt(sock, SOL_SOCKET, SO_ERROR, (char *)&opt, optlen);
		return;
	}
#endif
	if ((sock = accept(s, (struct sockaddr *) &remaddr, &sra)) > -1)
	{
		if (!(get_dllint_var("identd")) || !(get_dllstring_var("identd_user")))
		{
			close(sock);
			return;
		}
		add_socketread(sock, s, 0, inet_ntoa(remaddr.sin_addr), identd_read, NULL);
		add_sockettimeout(sock, 20, NULL);
	}
}

int start_identd(void)
{
int sock = -1;
unsigned short port = 113;
	if (identd != -1)
		return -1;
	if ((sock = connect_by_number(NULL, &port, SERVICE_SERVER, PROTOCOL_TCP, 1)) > -1)
		add_socketread(sock, port, 0, NULL, identd_handler, NULL);
	identd = sock;
	return 0;
}

int Identd_Cleanup(IrcCommandDll **intp, Function_ptr *global_table)
{
	if (identd != -1)
	{
		close_socketread(identd);
		identd = -1;
	}
	remove_module_proc(VAR_PROC, MODULENAME, NULL, NULL);
	return 0;
}

int Identd_Init(IrcCommandDll **intp, Function_ptr *global_table)
{
#if !defined(__EMX__) && !defined(WINNT)
	if (getuid() && geteuid())
	{
		return -1;
	}
#endif
	initialize_module("Identd");
	add_module_proc(VAR_PROC, MODULENAME, "identd", NULL, BOOL_TYPE_VAR, 0, NULL, NULL);
	add_module_proc(VAR_PROC, MODULENAME, "identd_user", NULL, STR_TYPE_VAR, 0, NULL, NULL);
	put_it("%s", convert_output_format("$G $0 v$1 by panasync", "%s %s", MODULENAME, "0.01"));
	return start_identd();
}




More information about the dslinux-commit mailing list