Skip to content

Commit e7e6d4f

Browse files
committed
1 parent 2086d01 commit e7e6d4f

File tree

16 files changed

+1299
-415
lines changed

16 files changed

+1299
-415
lines changed

CHANGES

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
2.8.8
2+
(1) Added support for setting a specific IP to listen on
3+
(listen <[host:]port> [maxusers])
4+
(2) Enhanced bncsetup to use new conf format and new question to handle
5+
specific host entering.
6+
(3) Changed the Makefile to list libraries last, some crypt libraries
7+
predefined their own main function which prevented compiling.
8+
(4) Reorganized the connection code to fix a bug where a user gets
9+
disconnected while connecting to an irc server.
10+
(5) Socket length was not being set before accept. (Thanks chris)
11+
(6) Removed old hack code for systems that do not support snprintf.
12+
(7) Increased error checking in recv code.
13+
(8) Better parsing of messages
14+
(9) Server buffers always cleared when connecting to a new server.
15+
116
2.8.6
217
(1) Bnc now lists all docked sessions
318
(2) Rewrote the send/recv code

Makefile.in

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,29 @@
1-
LIBS = @LIBS@
2-
OPTS = -O3
3-
COPT = -Wall
4-
OOPT =
5-
STRIP = strip
6-
CC = gcc
1+
LIBS=@LIBS@
2+
CFLAGS=-O3 -Wall
3+
OFLAGS=-O3
4+
CC=@CC@
75

86
ALL: bnc mkpasswd
97

108
mkpasswd:mkpasswd.c
11-
${CC} ${OPTS} ${COPT} ${LIBS} -o mkpasswd mkpasswd.c
12-
bnc: bnc.o conf.o server.o cmds.o send.o sbuf.o Makefile
13-
${CC} ${OPTS} ${OOPT} -o bnc bnc.o conf.o server.o cmds.o sbuf.o send.o ${LIBS}
14-
# ${STRIP} bnc
9+
${CC} ${CFLAGS} -o mkpasswd mkpasswd.c ${LIBS}
10+
bnc: bnc.o conf.o server.o cmds.o ctcp.o send.o sbuf.o Makefile
11+
${CC} ${OFLAGS} -o bnc bnc.o conf.o server.o cmds.o ctcp.o sbuf.o send.o ${LIBS}
1512

1613
bnc.o: config.h struct.h bnc.c Makefile
17-
${CC} ${OPTS} ${COPT} -c bnc.c
14+
${CC} ${CFLAGS} -c bnc.c
1815
conf.o: config.h struct.h conf.c Makefile
19-
${CC} ${OPTS} ${COPT} -c conf.c
16+
${CC} ${CFLAGS} -c conf.c
2017
cmds.o: config.h struct.h cmds.c Makefile
21-
${CC} ${OPTS} ${COPT} -c cmds.c
18+
${CC} ${CFLAGS} -c cmds.c
19+
ctcp.o: config.h ctcp.c Makefile
20+
${CC} ${CFLAGS} -c ctcp.c
2221
server.o: config.h struct.h server.c Makefile
23-
${CC} ${OPTS} ${COPT} -c server.c
22+
${CC} ${CFLAGS} -c server.c
2423
send.o: send.c send.h Makefile
25-
${CC} ${OPTS} ${COPT} -c send.c
24+
${CC} ${CFLAGS} -c send.c
2625
sbuf.o: sbuf.c
27-
${CC} ${OPTS} ${COPT} -c sbuf.c
26+
${CC} ${CFLAGS} -c sbuf.c
2827

2928
clean:
3029
rm -rf *.o *~ core bnc mkpasswd

README

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
\ \_______/ \ \__\\ \ __\ \ \_______\
77
\/_______/ \/__/ \/__/ \/_______/ IRC PROXY
88

9-
BNC 2.8.6 (c) 1998-2002 by James Seter AKA Pharos on efnet
9+
BNC 2.8.8 (c) 1998-2002 by James Seter AKA Pharos on efnet
1010
Site:
1111
http://gotbnc.com
1212

bnc.c

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ extern int initproxy (confetti * jr);
3838

3939
extern char buffer[];
4040

41-
41+
#if 0
4242
int bnclog (confetti * jr, char *logbuff)
4343
{
4444
static long tata;
@@ -48,7 +48,7 @@ int bnclog (confetti * jr, char *logbuff)
4848
if (jr->logf != 1)
4949
return 0;
5050
tata = time ((long *) 0);
51-
snprintf (tmpa, 40, "%s", ctime (&tata));
51+
sprintf(tmpa, "%.26s", ctime (&tata));
5252
for (p = 0; p < 40; p++)
5353
{
5454
switch (tmpa[p])
@@ -66,6 +66,8 @@ int bnclog (confetti * jr, char *logbuff)
6666
fflush (jr->logfile);
6767
return 0;
6868
}
69+
#endif
70+
6971
struct deathwish
7072
{
7173
int reason;
@@ -178,18 +180,21 @@ int main (int argc, char **argv)
178180
bnckill (tmps);
179181
}
180182

181-
printf ("--Configuration:\n");
182-
printf (" Daemon port......: %u\n Maxusers.........: %u\n Default conn port: %u\n Pid File.........: %s\n",
183-
bncconf.dport, bncconf.maxusers, bncconf.cport, bncconf.pidfile);
183+
printf("--Configuration:\n");
184+
if(*bncconf.dhost)
185+
printf(" Daemon host......: %s\n", bncconf.dhost);
186+
printf(" Daemon port......: %u\n", bncconf.dport);
187+
if(bncconf.maxusers == 0)
188+
printf(" Maxusers.........: unlimited\n");
189+
else
190+
printf(" Maxusers.........: %u\n", bncconf.maxusers);
191+
printf(" Default conn port: %u\n", bncconf.cport);
192+
printf(" Pid File.........: %s\n", bncconf.pidfile);
184193

185194
if (bncconf.vhostdefault[0] == '\0')
186-
{
187-
printf (" Vhost Default....: -SYSTEM DEFAULT-\n");
188-
}
195+
printf(" Vhost Default....: -SYSTEM DEFAULT-\n");
189196
else
190-
{
191-
printf (" Vhost Default....: %s\n", bncconf.vhostdefault);
192-
}
197+
printf(" Vhost Default....: %s\n", bncconf.vhostdefault);
193198

194199
if (bncconf.vhostlist != NULL)
195200
{

bncsetup

Lines changed: 63 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ MYPID=$$
44
TMPFILE=.bnc$MYPID.tmp
55
RSLFILE=.bnc$MYPID.rsl
66
VHTFILE=.bnc$MYPID.vht
7-
BSVERSION="0.3 for BNC2.6.4"
7+
BSVERSION="0.4 for BNC2.8.8"
88
SAVEFILE=./bnc.conf
99

1010
bsclean()
@@ -16,29 +16,51 @@ bsclean()
1616
saveit()
1717
{
1818
echo "Writing your configuration to $SAVEFILE"
19+
20+
if [ -z $BNCHOST ]
21+
then
22+
BNCHOST="$BNCPORT"
23+
else
24+
BNCHOST="$BNCHOST:$BNCPORT"
25+
fi
26+
27+
if [ -z $BNCPASS ]
28+
then
29+
usepass=
30+
else
31+
usepass="password $BNCPASS"
32+
fi
33+
1934
cat << EOF > $TMPFILE
2035
#!/home/myhome/bnc
2136
# BNCSetup $BSVERSION by IceWizard and pharos
2237
# automaticly generated configuration file.
23-
# edit the first line and chmod +x this file if you like to load bnc
24-
# by running its .conf file
25-
# Here are additional options you may add:
26-
# C:6667 Default Irc Server Port to Connect to
27-
# X:default.vhost.com Default Virtual Host to Use
28-
# V:another.vhost.com Other Vhosts That Can Be Used
29-
# V:different.vhost.com As Many Vhosts as You Want
30-
# P:pid.bnc Name of PID File
31-
# *NOTE PID file is required if bnc is to be
32-
# *used with crontab
33-
# L:bnc.log Name of Log File
34-
# W:1 enable dynamic idents on servers with
35-
# identwd installed
36-
# A:1:*.addy.net Allow list of ip addresses that can use BNC
37-
S:$SUPERPASS
38-
D:$BNCPORT:$MAXUSERS:$BNCPASS
39-
38+
# <REQUIRED>
39+
# listen <port> [maxusers] Port to listen for connections on
40+
# adminpass <password> Password for Supervisor Access
41+
#
42+
# [Optional]
43+
# password <password> Password required for general connection (recommended)
44+
# allow <address> [address ...] list of ip/dns's that can use the bnc
45+
# vhost <address> [address ...] Other Vhosts That Can Be Used (display only)
46+
# defaultvhost <address> Default Virtual Host to Use
47+
# pidfile <filename> Name of PID File (recommended if you use crontab)
48+
# motdfile <filename> Message of the day, displayed on connection of valid user
49+
# logfile <filename> Filename where to store logs
50+
#
51+
# EXAMPLE CONFIG - CHANGE THIS:
52+
# if your pass starts with + it is encrypted, if not it is a normal pass
53+
#
54+
listen $BNCHOST $MAXUSERS
55+
adminpass $SUPERPASS
56+
$usepass
4057
EOF
4158

59+
# S:$SUPERPASS
60+
# D:$BNCPORT:$MAXUSERS:$BNCPASS
61+
62+
63+
4264
cat $TMPFILE $VHTFILE > $SAVEFILE
4365
echo "Finished! You may now edit $SAVEFILE to make any special changes"
4466

@@ -129,6 +151,21 @@ do
129151
fi
130152
done
131153

154+
BNCHOST=
155+
cat << EOF > $TMPFILE
156+
Enter the host IP or DNS that bnc will use.
157+
EOF
158+
159+
dialog --yesno "Enter a host for BNC to listen on (default all hosts)?" 5 60
160+
ERRORLEVEL=$?
161+
162+
if [ x$ERRORLEVEL = x0 ]
163+
then
164+
dialog --title "Enter host" --inputbox "$(cat $TMPFILE)" 10 62 2> $RSLFILE
165+
BNCHOST="$(head -1 $RSLFILE)"
166+
fi
167+
168+
132169

133170
cat << EOF > $TMPFILE
134171
How many users would you like to be allowed on BNC at the same time?
@@ -243,15 +280,15 @@ BDONE=
243280
then
244281
if ! [ x$BDONE = xq ]
245282
then
246-
echo "A:1:$BDONE" >> $VHTFILE
283+
echo "allow $BDONE" >> $VHTFILE
247284
fi
248285
fi
249286
done
250287
fi
251288

252289
if ! [ -e "$VHTFILE" ]
253290
then
254-
echo "A:1:*" > $VHTFILE
291+
echo "allow *" > $VHTFILE
255292
fi
256293

257294

@@ -268,7 +305,7 @@ then
268305
BDONE="$(head -1 $RSLFILE)"
269306
if ! [ -z BDONE ]
270307
then
271-
echo "X:$BDONE" >> $VHTFILE
308+
echo "defaultvhost $BDONE" >> $VHTFILE
272309
fi
273310
fi
274311

@@ -294,7 +331,7 @@ BDONE=
294331
then
295332
if ! [ x$BDONE = xq ]
296333
then
297-
echo "V:$BDONE" >> $VHTFILE
334+
echo "vhost $BDONE" >> $VHTFILE
298335
fi
299336
fi
300337
done
@@ -316,7 +353,7 @@ then
316353
BDONE="$(head -1 $RSLFILE)"
317354
if ! [ -z BDONE ]
318355
then
319-
echo "L:$BDONE" >> $VHTFILE
356+
echo "logfile $BDONE" >> $VHTFILE
320357
fi
321358
fi
322359

@@ -331,19 +368,19 @@ EOF
331368

332369
if [ x$ERRORLEVEL = x0 ]
333370
then
334-
dialog --title "Enter logfile Filename" --inputbox "$(cat $TMPFILE)" 10 62 "motd" 2> $RSLFILE
371+
dialog --title "Enter motd Filename" --inputbox "$(cat $TMPFILE)" 10 62 "motd" 2> $RSLFILE
335372
BDONE="$(head -1 $RSLFILE)"
336373
if ! [ -z BDONE ]
337374
then
338-
echo "M:$BDONE" >> $VHTFILE
375+
echo "motdfile $BDONE" >> $VHTFILE
339376
fi
340377
fi
341378

342379
dialog --title "Requires Identwd to be installed." --yesno "Do you want bnc's dynamic ident support?" 5 60
343380
ERRORLEVEL=$?
344381
if [ x$ERRORLEVEL = x0 ]
345382
then
346-
echo "W:1" >> $VHTFILE
383+
echo "useidentwd 1" >> $VHTFILE
347384
fi
348385

349386

0 commit comments

Comments
 (0)