Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
930c847
Initial commit
michaelortmann Feb 7, 2023
12da7cb
Merge remote-tracking branch 'upstream/develop' into webui.mod
Oct 8, 2023
cd7b272
Merge remote-tracking branch 'upstream/develop' into webui.mod
Dec 3, 2023
7ce5a98
Merge remote-tracking branch 'upstream/develop' into webui.mod
Jan 15, 2024
877f119
Merge remote-tracking branch 'upstream/develop' into webui.mod
May 6, 2024
0524163
Enhance log
May 6, 2024
3758fca
Remove debug log
May 6, 2024
54e10f7
Update Copyright
May 7, 2024
063fc5c
Renamed webui.html -> text/webui.html
May 7, 2024
e23e9f2
add character encoding
May 7, 2024
356c5cc
Remove trailing slash on void element
May 7, 2024
8317e39
Use CSS instead of obsolete elements
May 7, 2024
a61d236
Add lang attribute
May 7, 2024
a2c4224
Fix for sock == -1 if lostdcc() in dcc_telnet_hostresolved2()
May 27, 2024
69fd33a
Merge remote-tracking branch 'upstream/develop' into webui.mod
May 27, 2024
cc6ff81
Merge remote-tracking branch 'upstream/develop' into webui.mod
michaelortmann Jul 6, 2024
17c5636
Merge remote-tracking branch 'upstream/develop' into webui.mod
michaelortmann Jul 10, 2024
9e232d2
Merge remote-tracking branch 'upstream/develop' into webui.mod
michaelortmann Jul 10, 2024
056c153
Fix proto.h / --disable-tls
michaelortmann Jul 10, 2024
8dca49f
Enhance TODO doc
michaelortmann Jul 11, 2024
ebeeebb
Fix --disable-tls
michaelortmann Jul 11, 2024
f7f2417
Fix openssl 0.9.8 even for WIP/testing
michaelortmann Aug 1, 2024
fd12695
Merge remote-tracking branch 'upstream/develop' into webui.mod
michaelortmann Aug 1, 2024
9e3bef5
Fix openssl version < 1.1
michaelortmann Aug 1, 2024
03cf0f7
misc/makedepend
michaelortmann Aug 1, 2024
874f44e
Added experimental http feedback, if user connects http to https port
michaelortmann Aug 1, 2024
bad09ce
misc/makedepend
michaelortmann Aug 1, 2024
6d9502e
Fix format specifier
michaelortmann Aug 1, 2024
f8fde3f
Remove forgotten debug
michaelortmann Aug 1, 2024
8260788
Merge remote-tracking branch 'upstream/develop' into webui.mod
michaelortmann Oct 18, 2024
a3f044c
Merge remote-tracking branch 'upstream/develop' into webui.mod
michaelortmann Dec 2, 2024
8241278
Cleanup
michaelortmann Dec 23, 2024
9c40bcb
Merge remote-tracking branch 'upstream/develop' into webui.mod
michaelortmann Feb 3, 2025
c709c06
const
michaelortmann Mar 18, 2025
780956d
Cleanup
michaelortmann Mar 18, 2025
b7a25ce
Merge remote-tracking branch 'upstream/develop' into webui.mod
michaelortmann Mar 18, 2025
34a8162
Merge remote-tracking branch 'upstream/develop' into webui.mod
michaelortmann Mar 31, 2025
59858f2
Cleanup
michaelortmann Mar 31, 2025
aaaab31
Merge remote-tracking branch 'upstream/develop' into webui.mod
michaelortmann Oct 17, 2025
a614a86
Add html header Content-Type
michaelortmann Oct 17, 2025
5bdda11
Add stealth telnets
michaelortmann Oct 17, 2025
374f78f
Bump version number
michaelortmann Oct 17, 2025
70efa28
Cleanup
michaelortmann Oct 17, 2025
317a198
Fix merge
michaelortmann Oct 17, 2025
fd0a34e
Add naive escape_html()
michaelortmann Oct 17, 2025
f77dfcb
Cleanup webui_frame()
michaelortmann Oct 18, 2025
e7513bf
Enhance webui_frame() API
michaelortmann Oct 18, 2025
01bb825
Cleanup
michaelortmann Oct 18, 2025
e251a08
Use Prettier as a code formatter
michaelortmann Oct 19, 2025
5e07567
Cleanup, remove debug log
michaelortmann Oct 19, 2025
b39fe8b
Handle connection closed by foreign host
michaelortmann Oct 19, 2025
f232267
Update
michaelortmann Oct 19, 2025
3932322
Unset webui http socket option SOCK_BUFFER
michaelortmann Oct 19, 2025
2b28c1d
Fix --disable-tls
michaelortmann Oct 19, 2025
6172169
Cleanup
michaelortmann Oct 19, 2025
683dc02
Cleanup
michaelortmann Oct 19, 2025
4a4666f
Enhance eggdrop.conf
michaelortmann Oct 19, 2025
43aeeed
Enhance code comment
michaelortmann Oct 19, 2025
19b5918
Cleanup
michaelortmann Oct 19, 2025
bc1328c
Update module dependency
michaelortmann Oct 20, 2025
b4163ae
Cleanup
michaelortmann Oct 20, 2025
2ee83a9
Dyn alloc response
michaelortmann Oct 20, 2025
fe23588
Cleanup
michaelortmann Oct 20, 2025
e018572
Add favicon as file and enhance compression using optipng
michaelortmann Oct 21, 2025
de2c75e
Fix webui.html again
michaelortmann Oct 21, 2025
f290693
Fix traffic counting
michaelortmann Oct 22, 2025
5a1b65e
Fix uninitialised value, see #1845
michaelortmann Oct 22, 2025
e01218c
Cleanup
michaelortmann Oct 22, 2025
7ff7c3b
Cherry pick #1846
michaelortmann Oct 23, 2025
7680021
New favicon.ico and apple-touch-icon.png
michaelortmann Oct 23, 2025
cae7444
Re-add console log foer echo on/off
michaelortmann Oct 23, 2025
43a941b
Add 404 and fix indent
michaelortmann Oct 23, 2025
d5274a4
Enhance 404
michaelortmann Oct 23, 2025
adaa3a6
Cleanup
michaelortmann Oct 23, 2025
9d4179b
Cache file data by modification time
michaelortmann Oct 24, 2025
3934102
Cleanup
michaelortmann Oct 24, 2025
e385007
Merge remote-tracking branch 'upstream/develop' into webui.mod
michaelortmann Oct 24, 2025
aa1e19f
Fix module unloading
michaelortmann Oct 24, 2025
162eea8
Log sock instead if idx
michaelortmann Oct 24, 2025
c753d82
Cleanup
michaelortmann Oct 24, 2025
6f139f7
Add comment
michaelortmann Oct 24, 2025
f20bc0c
Cleanup and comment
michaelortmann Oct 24, 2025
b64370c
Indent, also add temp. assert while this PR is in development
michaelortmann Oct 24, 2025
9bebb34
Bufsize
michaelortmann Oct 24, 2025
fb17505
Fix telnet echo and esc bold codes
michaelortmann Oct 26, 2025
739378c
Fix bold - thank you CrazyCat
michaelortmann Oct 26, 2025
185d2ac
Fix format specifier for off_t
michaelortmann Oct 26, 2025
aa8c789
Merge remote-tracking branch 'upstream/develop' into webui.mod
michaelortmann Nov 30, 2025
4562bcf
Update Makefile.in
michaelortmann Nov 30, 2025
457939e
Fix tls
michaelortmann Nov 30, 2025
462a287
Cleanup
michaelortmann Nov 30, 2025
0f1f27c
Merge remote-tracking branch 'upstream/develop' into webui.mod
michaelortmann Dec 7, 2025
fa42d01
Cleanup
michaelortmann Dec 7, 2025
676e842
Disable webui mod by default
michaelortmann Dec 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ sinstall: static
@$(MAKE) ainstall

ainstall: install-bin install-modules install-data install-text \
install-help install-language install-filesys install-doc install-scripts
install-help install-language install-filesys install-webui install-doc install-scripts
@$(install-end)

install-start:
Expand Down Expand Up @@ -485,6 +485,25 @@ install-filesys: install-start
$(MKDIR_P) $(DEST)/filesys/incoming >/dev/null; \
fi

# We cannot do this in webui.mod Makefile because there is no make target and
# we cannot create such make target without breaking every other mod Makefile.
# The only alternative i see would be to hardcode the 3 files into char arrays
# but this is ugly. File systems were invented for a reason.
install-webui: install-start
@if test ! -d $(DEST)/webui; then \
echo "Creating webui subdirectory."; \
$(MKDIR_P) $(DEST)/webui >/dev/null; \
fi && \
if test ! -f $(DEST)/webui/apple-touch-icon.png; then \
$(INSTALL_DATA) $(srcdir)/src/mod/webui.mod/apple-touch-icon.png $(DEST)/webui/; \
fi && \
if test ! -f $(DEST)/webui/favicon.ico; then \
$(INSTALL_DATA) $(srcdir)/src/mod/webui.mod/favicon.ico $(DEST)/webui/; \
fi && \
if test ! -f $(DEST)/webui/index.html; then \
$(INSTALL_DATA) $(srcdir)/src/mod/webui.mod/index.html $(DEST)/webui/; \
fi

install-doc: install-start
+@$(INSTALL_DATA) $(srcdir)/README $(DEST) && \
$(INSTALL_DATA) $(srcdir)/FEATURES $(DEST) && \
Expand Down
1 change: 1 addition & 0 deletions disabled_modules
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# - Lines which start with a '#' character are ignored.
# - Every module name needs to be on its own line

webui
# Woobie only serves as an example for module programming. No need to
# compile it for normal bots ...
woobie
1 change: 1 addition & 0 deletions eggdrop-basic.conf
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ loadmodule console ; # Console setting storage
loadmodule uptime ; # Centralized uptime stat collection (https://www.eggheads.org/uptime/)
#loadmodule ident ; # Ident support
#loadmodule twitch ; # Twitch gaming service support
#loadmodule webui ; # WebUI support


##### BASIC SETTINGS #####
Expand Down
15 changes: 14 additions & 1 deletion eggdrop.conf
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,8 @@ set dcc-flood-thr 3

# Define here how many telnet connection attempts in how many seconds from
# the same host constitute a flood. The correct format is Attempts:Seconds.
set telnet-flood 5:60
# If webui is not used, 5:60 is sane.
set telnet-flood 16:60

# If you want telnet-flood to apply even to +f users, set this setting to 1.
set paranoid-telnet-flood 1
Expand Down Expand Up @@ -1670,6 +1671,18 @@ loadmodule uptime
# Set the ident port to use for ident-method 1.
#set ident-port 113


#### WEBUI MODULE ####

#loadmodule webui

# http port
#listen 8080 webui

# https port, prefix the port with a plus sign and set ssl-certificate, see
# section SSL SETTINGS above.
#listen +8443 webui

##### AUTOSCRIPTS #####

# Load this script to enable the autoscripts functionality for Eggdrop.
Expand Down
3 changes: 2 additions & 1 deletion src/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,8 @@ tcluser.o: tcluser.c main.h ../config.h ../eggint.h ../lush.h lang.h \
tls.o: tls.c main.h ../config.h ../eggint.h ../lush.h lang.h eggdrop.h \
compat/in6.h flags.h proto.h misc_file.h cmdt.h tclegg.h tclhash.h \
chan.h users.h compat/compat.h compat/base64.h compat/inet_aton.h \
../src/main.h compat/snprintf.h compat/explicit_bzero.h compat/strlcpy.h
../src/main.h compat/snprintf.h compat/explicit_bzero.h compat/strlcpy.h \
version.h
userent.o: userent.c main.h ../config.h ../eggint.h ../lush.h lang.h \
eggdrop.h compat/in6.h flags.h proto.h misc_file.h cmdt.h tclegg.h \
tclhash.h chan.h users.h compat/compat.h compat/base64.h \
Expand Down
155 changes: 91 additions & 64 deletions src/dcc.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ int bot_timeout = 60; /* Bot timeout value */
int identtimeout = 5; /* Timeout value for ident lookups */
int dupwait_timeout = 5; /* Timeout for rejecting duplicate entries */
int protect_telnet = 1; /* Even bother with ident lookups :) */
int flood_telnet_thr = 5; /* Number of telnet connections to be
int flood_telnet_thr = 16; /* Number of telnet connections to be
* considered a flood */
int flood_telnet_time = 60; /* In how many seconds? */
char network[41] = "unknown-net"; /* Name of the IRC network you're on */
Expand Down Expand Up @@ -731,7 +731,7 @@ static void dcc_chat_pass(int idx, char *buf, int atr)
dcc[idx].u.chat->con_flags = (atr & USER_MASTER) ? conmask : 0;
dcc[idx].u.chat->channel = -2;
/* Turn echo back on for telnet sessions (send IAC WON'T ECHO). */
if (dcc[idx].status & STAT_TELNET)
if (dcc[idx].status & (STAT_TELNET | STAT_WS))
tputs(dcc[idx].sock, TLN_IAC_C TLN_WONT_C TLN_ECHO_C "\n", 4);
dcc_chatter(idx);
}
Expand Down Expand Up @@ -1277,7 +1277,6 @@ static void dcc_telnet(int idx, char *buf, int i)
return;
}

dcc[i].u.dns->ip = &dcc[i].sockname;
dcc[i].sock = sock;
dcc[i].port = port;
#ifdef TLS
Expand All @@ -1290,11 +1289,18 @@ static void dcc_telnet(int idx, char *buf, int i)
*/
if (!(tls_vfyclients & TLS_VERIFYCN))
threaddata()->socklist[findsock(sock)].flags |= SOCK_VIRTUAL;
else if (ssl_handshake(dcc[i].sock, TLS_LISTEN, tls_vfyclients,
LOG_MISC, NULL, NULL)) {
killsock(dcc[i].sock);
lostdcc(i);
return;
else {
#ifdef TLS
if (!strcmp(dcc[idx].nick, "(webui)"))
ssl_cleanup(); /* reset ssl_ctx for websocket */
#endif /* TLS */
if (ssl_handshake(dcc[i].sock, TLS_LISTEN,
strcmp(dcc[idx].nick, "(webui)") ? tls_vfyclients : 0,
LOG_MISC, NULL, NULL)) {
killsock(dcc[i].sock);
lostdcc(i);
return;
}
}
}
#endif
Expand All @@ -1308,12 +1314,73 @@ static void dcc_telnet(int idx, char *buf, int i)
dcc_dnshostbyip(&dcc[i].sockname);
}

/* we need this for dcc_telnet_hostresolved() could now branch to DCC_TABLE
* and for either branch we need to continue here
*/
void dcc_telnet_hostresolved2(int i, int idx) {
int sock, j;

/* Skip ident lookup if disabled */
if (identtimeout <= 0) {
dcc[i].u.ident_sock = dcc[idx].sock;
dcc_telnet_got_ident(i, dcc[idx].host);
return;
}

changeover_dcc(i, &DCC_IDENTWAIT, 0);
dcc[i].timeval = now;
dcc[i].u.ident_sock = dcc[idx].sock;
sock = -1;
j = new_dcc(&DCC_IDENT, 0);
if (j < 0)
putlog(LOG_MISC, "*", DCC_IDENTFAIL, dcc[i].host, strerror(errno));
else {
memcpy(&dcc[j].sockname, &dcc[i].sockname, sizeof(sockname_t));
dcc[j].sock = getsock(dcc[j].sockname.family, 0);
if (dcc[j].sock >= 0) {
sockname_t name;
name.family = dcc[j].sockname.family;
name.addrlen = sizeof(name.addr);
if (getsockname(dcc[i].sock, &name.addr.sa, &name.addrlen) < 0)
debug2("dcc: dcc_telnet_hostresolved(): getsockname() socket %ld error %s", dcc[i].sock, strerror(errno));
setsnport(name, 0);
if (bind(dcc[j].sock, &name.addr.sa, name.addrlen) < 0)
debug2("dcc: dcc_telnet_hostresolved(): bind() socket %ld error %s", dcc[j].sock, strerror(errno));
setsnport(dcc[j].sockname, 113);
if (connect(dcc[j].sock, &dcc[j].sockname.addr.sa,
dcc[j].sockname.addrlen) < 0 && (errno != EINPROGRESS)) {
killsock(dcc[j].sock);
lostdcc(j);
putlog(LOG_MISC, "*", DCC_IDENTFAIL, dcc[i].host, strerror(errno));
j = 0;
}
sock = dcc[j].sock;
}
}
if (j < 0) {
dcc_telnet_got_ident(i, dcc[idx].host);
return;
}
dcc[j].sock = sock;
dcc[j].port = 113;
dcc[j].addr = dcc[i].addr;
strcpy(dcc[j].host, dcc[i].host);
strcpy(dcc[j].nick, "*");
dcc[j].u.ident_sock = dcc[i].sock;
dcc[j].timeval = now;
#ifdef CYGWIN_HACKS
threaddata()->socklist[findsock(dcc[j].sock)].flags = SOCK_CONNECT;
#endif
dprintf(j, "%d, %d\n", dcc[i].port, dcc[idx].port);
}

/* dcc[i].type == DNSWAIT */
static void dcc_telnet_hostresolved(int i)
{
int idx;
int j = 0, sock;
char s[sizeof lasttelnethost], *userhost;

debug0("dcc_telnet_hostresolved()");
strlcpy(dcc[i].host, dcc[i].u.dns->host, UHOSTLEN);

for (idx = 0; idx < dcc_total; idx++)
Expand Down Expand Up @@ -1372,57 +1439,16 @@ static void dcc_telnet_hostresolved(int i)
return;
}

/* Skip ident lookup if disabled */
if (identtimeout <= 0) {
dcc[i].u.ident_sock = dcc[idx].sock;
dcc_telnet_got_ident(i, userhost);
#ifdef TLS
/* Skip ident lookup for webui http */
if (!strcmp(dcc[idx].nick, "(webui)")) {
webui_dcc_telnet_hostresolved(i);
return;
}
#endif /* TLS */

changeover_dcc(i, &DCC_IDENTWAIT, 0);
dcc[i].timeval = now;
dcc[i].u.ident_sock = dcc[idx].sock;
sock = -1;
j = new_dcc(&DCC_IDENT, 0);
if (j < 0)
putlog(LOG_MISC, "*", DCC_IDENTFAIL, dcc[i].host, strerror(errno));
else {
memcpy(&dcc[j].sockname, &dcc[i].sockname, sizeof(sockname_t));
dcc[j].sock = getsock(dcc[j].sockname.family, 0);
if (dcc[j].sock >= 0) {
sockname_t name;
name.addrlen = sizeof(name.addr);
if (getsockname(dcc[i].sock, &name.addr.sa, &name.addrlen) < 0)
debug2("dcc: dcc_telnet_hostresolved(): getsockname() socket %ld error %s", dcc[i].sock, strerror(errno));
setsnport(name, 0);
if (bind(dcc[j].sock, &name.addr.sa, name.addrlen) < 0)
debug2("dcc: dcc_telnet_hostresolved(): bind() socket %ld error %s", dcc[j].sock, strerror(errno));
setsnport(dcc[j].sockname, 113);
if (connect(dcc[j].sock, &dcc[j].sockname.addr.sa,
dcc[j].sockname.addrlen) < 0 && (errno != EINPROGRESS)) {
killsock(dcc[j].sock);
lostdcc(j);
putlog(LOG_MISC, "*", DCC_IDENTFAIL, dcc[i].host, strerror(errno));
j = 0;
}
sock = dcc[j].sock;
}
}
if (j < 0) {
dcc_telnet_got_ident(i, userhost);
return;
}
dcc[j].sock = sock;
dcc[j].port = 113;
dcc[j].addr = dcc[i].addr;
strcpy(dcc[j].host, dcc[i].host);
strcpy(dcc[j].nick, "*");
dcc[j].u.ident_sock = dcc[i].sock;
dcc[j].timeval = now;
#ifdef CYGWIN_HACKS
threaddata()->socklist[findsock(dcc[j].sock)].flags = SOCK_CONNECT;
#endif
dprintf(j, "%d, %d\n", dcc[i].port, dcc[idx].port);
strlcpy(dcc[i].host, userhost, UHOSTLEN);
dcc_telnet_hostresolved2(i, idx);
}

static void eof_dcc_telnet(int idx)
Expand Down Expand Up @@ -1552,7 +1578,6 @@ static void dcc_telnet_id(int idx, char *buf, int atr)
int ok = 0;
struct flag_record fr = { FR_GLOBAL | FR_CHAN | FR_ANYWH, 0, 0, 0, 0, 0 };
struct dcc_table *old = dcc[idx].type;

if (detect_telnet((unsigned char *) buf)) {
dcc[idx].status |= STAT_TELNET;
strip_telnet(dcc[idx].sock, buf, &atr);
Expand Down Expand Up @@ -1819,7 +1844,7 @@ static void dcc_telnet_pass(int idx, int atr)
*/

/* Turn off remote telnet echo (send IAC WILL ECHO). */
if (dcc[idx].status & STAT_TELNET) {
if (dcc[idx].status & (STAT_TELNET | STAT_WS)) {
char buf[512];
snprintf(buf, sizeof buf, "\n%s%s\r\n", escape_telnet(DCC_ENTERPASS),
TLN_IAC_C TLN_WILL_C TLN_ECHO_C);
Expand Down Expand Up @@ -2385,7 +2410,6 @@ static void dcc_telnet_got_ident(int i, char *host)
/* Do not buffer data anymore. All received and stored data is passed
* over to the dcc functions from now on. */
sockoptions(dcc[i].sock, EGG_OPTION_UNSET, SOCK_BUFFER);

dcc[i].type = &DCC_TELNET_ID;
dcc[i].u.chat = get_data_ptr(sizeof(struct chat_info));
egg_bzero(dcc[i].u.chat, sizeof(struct chat_info));
Expand All @@ -2394,17 +2418,20 @@ static void dcc_telnet_got_ident(int i, char *host)
* STATUS option as a hopefully harmless way to detect if the other
* side is a telnet client or not. */
#ifdef TLS
if (!dcc[i].ssl)
if (!dcc[i].ssl && strcmp(dcc[idx].nick, "(webui)"))
dprintf(i, TLN_IAC_C TLN_WILL_C TLN_STATUS_C);
#endif
/* Copy acceptable-nick/host mask */
dcc[i].status = STAT_TELNET | STAT_ECHO;
if (!strcmp(dcc[idx].nick, "(bots)"))
dcc[i].status |= STAT_BOTONLY;
if (!strcmp(dcc[idx].nick, "(users)"))
dcc[i].status |= STAT_USRONLY;
else if (!strcmp(dcc[idx].nick, "(bots)"))
dcc[i].status |= STAT_BOTONLY;
else if (!strcmp(dcc[idx].nick, "(webui)"))
dcc[i].status |= STAT_WS;
/* Copy acceptable-nick/host mask */
strlcpy(dcc[i].nick, dcc[idx].host, HANDLEN);
strlcpy(dcc[i].nick, dcc[idx].host, sizeof dcc[i].nick);

dcc[i].timeval = now;
strcpy(dcc[i].u.chat->con_chan, chanset ? chanset->dname : "*");
/* Displays a customizable banner. */
Expand Down
9 changes: 3 additions & 6 deletions src/dns.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,11 @@ static void dns_dcchostbyip(sockname_t *ip, char *hostn, int ok, void *other)
(dcc[idx].u.dns->dns_type == RES_HOSTBYIP) && (
#ifdef IPV6
(ip->family == AF_INET6 &&
IN6_ARE_ADDR_EQUAL(&dcc[idx].u.dns->ip->addr.s6.sin6_addr,
IN6_ARE_ADDR_EQUAL(&dcc[idx].sockname.addr.s6.sin6_addr,
&ip->addr.s6.sin6_addr)) ||
(ip->family == AF_INET &&
#endif
(dcc[idx].u.dns->ip->addr.s4.sin_addr.s_addr ==
(dcc[idx].sockname.addr.s4.sin_addr.s_addr ==
ip->addr.s4.sin_addr.s_addr)))
#ifdef IPV6
)
Expand Down Expand Up @@ -180,10 +180,7 @@ static void dns_dccipbyhost(sockname_t *ip, char *hostn, int ok, void *other)
(dcc[idx].u.dns->dns_type == RES_IPBYHOST) &&
!strcasecmp(dcc[idx].u.dns->host, hostn)) {
if (ok) {
if (dcc[idx].u.dns->ip)
memcpy(dcc[idx].u.dns->ip, ip, sizeof(sockname_t));
else
memcpy(&dcc[idx].sockname, ip, sizeof(sockname_t));
memcpy(&dcc[idx].sockname, ip, sizeof(sockname_t));
dcc[idx].u.dns->dns_success(idx);
} else
dcc[idx].u.dns->dns_failure(idx);
Expand Down
6 changes: 5 additions & 1 deletion src/eggdrop.h
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,9 @@ struct dns_info {
char *cbuf; /* temporary buffer. Memory will be free'd
* as soon as dns_info is free'd */
char *cptr; /* temporary pointer */
sockname_t *ip; /* pointer to sockname with ipv4/6 address */
/* sockname with ipv4/6 address is dcc[i].sockname. we must not link that
* pointer here, because dcc array can be realloced
*/
int ibuf; /* temporary buffer for one integer */
char dns_type; /* lookup type, e.g. RES_HOSTBYIP */
struct dcc_table *type; /* type of the dcc table we are making the
Expand Down Expand Up @@ -491,6 +493,7 @@ struct dupwait_info {
#define STAT_USRONLY 0x00040 /* telnet on users-only connect */
#define STAT_PAGE 0x00080 /* page output to the user */
#define STAT_SERV 0x00100 /* this is a server connection */
#define STAT_WS 0x00200 /* webui websocket */

/* For stripping out mIRC codes. */
#define STRIP_COLOR 0x00001 /* remove mIRC color codes */
Expand Down Expand Up @@ -602,6 +605,7 @@ typedef struct {
#define SOCK_VIRTUAL 0x0200 /* not-connected socket (dont read it!) */
#define SOCK_BUFFER 0x0400 /* buffer data; don't notify dcc funcs */
#define SOCK_TCL 0x0800 /* tcl socket, don't do anything on it */
#define SOCK_WS 0x1000 /* webui websocket */

/* Flags to sock_has_data
*/
Expand Down
2 changes: 2 additions & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,8 @@ static void mainloop(int toplevel)
itraffic_irc_today += strlen(buf) + 1;
else if (!strncmp(dcc[idx].type->name, "CHAT", 4))
itraffic_dcc_today += strlen(buf) + 1;
else if (!strncmp(dcc[idx].type->name, "WEBUI", 5))
itraffic_dcc_today += i;
else if (!strncmp(dcc[idx].type->name, "FILES", 5))
itraffic_dcc_today += strlen(buf) + 1;
else if (!strcmp(dcc[idx].type->name, "SEND"))
Expand Down
Loading
Loading