aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Bram Matthys2013-11-20 12:44:26 +0100
committerGravatar Bram Matthys2013-11-20 12:44:26 +0100
commitd8645f710d1fc2cbd28bc8545b16b82248bf092f (patch)
tree41d93d69bfd736bbbe419b70cd70dae557e55bfb
parentFrench doc: fix typos (diff)
downloadunrealircd-d8645f710d1fc2cbd28bc8545b16b82248bf092f.tar.gz
unrealircd-d8645f710d1fc2cbd28bc8545b16b82248bf092f.tar.bz2
unrealircd-d8645f710d1fc2cbd28bc8545b16b82248bf092f.zip
Various fixes, more info later.
-rw-r--r--src/modules/m_cap.c35
-rw-r--r--src/modules/m_nick.c12
-rw-r--r--src/s_bsd.c29
-rw-r--r--src/s_serv.c28
-rw-r--r--src/win32/unrealinst.iss4
5 files changed, 76 insertions, 32 deletions
diff --git a/src/modules/m_cap.c b/src/modules/m_cap.c
index 8d519bb6f..acb6dacff 100644
--- a/src/modules/m_cap.c
+++ b/src/modules/m_cap.c
@@ -232,14 +232,14 @@ static void clicap_generate(aClient *sptr, const char *subcmd, int flags, int cl
sendto_one(sptr, "%s :%s", buf, capbuf);
}
-static void cap_ack(aClient *sptr, const char *arg)
+static int cap_ack(aClient *sptr, const char *arg)
{
struct clicap *cap;
int capadd = 0, capdel = 0;
int finished = 0, negate;
if (BadPtr(arg))
- return;
+ return 0;
for(cap = clicap_find(arg, &negate, &finished); cap;
cap = clicap_find(NULL, &negate, &finished))
@@ -262,40 +262,47 @@ static void cap_ack(aClient *sptr, const char *arg)
sptr->proto |= capadd;
sptr->proto &= ~capdel;
+ return 0;
}
-static void cap_clear(aClient *sptr, const char *arg)
+static int cap_clear(aClient *sptr, const char *arg)
{
clicap_generate(sptr, "ACK", sptr->proto ? sptr->proto : -1, 1);
sptr->proto = 0;
+ return 0;
}
-static void cap_end(aClient *sptr, const char *arg)
+static int cap_end(aClient *sptr, const char *arg)
{
if (IsRegisteredUser(sptr))
- return;
+ return 0;
sptr->proto &= ~PROTO_CLICAP;
if (sptr->name[0] && sptr->user != NULL)
- register_user(sptr, sptr, sptr->name, sptr->user->username, NULL, NULL, NULL);
+ return register_user(sptr, sptr, sptr->name, sptr->user->username, NULL, NULL, NULL);
+
+ return 0;
}
-static void cap_list(aClient *sptr, const char *arg)
+static int cap_list(aClient *sptr, const char *arg)
{
clicap_generate(sptr, "LIST", sptr->proto ? sptr->proto : -1, 0);
+ return 0;
}
-static void cap_ls(aClient *sptr, const char *arg)
+static int cap_ls(aClient *sptr, const char *arg)
{
if (!IsRegisteredUser(sptr))
sptr->proto |= PROTO_CLICAP;
clicap_generate(sptr, "LS", 0, 0);
+
+ return 0;
}
-static void cap_req(aClient *sptr, const char *arg)
+static int cap_req(aClient *sptr, const char *arg)
{
char buf[BUFSIZE];
char pbuf[2][BUFSIZE];
@@ -309,7 +316,7 @@ static void cap_req(aClient *sptr, const char *arg)
sptr->proto |= PROTO_CLICAP;
if (BadPtr(arg))
- return;
+ return 0;
buflen = snprintf(buf, sizeof(buf), ":%s CAP %s ACK",
me.name, BadPtr(sptr->name) ? "*" : sptr->name);
@@ -369,7 +376,7 @@ static void cap_req(aClient *sptr, const char *arg)
if (!finished)
{
sendto_one(sptr, ":%s CAP %s NAK :%s", me.name, BadPtr(sptr->name) ? "*" : sptr->name, arg);
- return;
+ return 0;
}
if (i)
@@ -382,11 +389,12 @@ static void cap_req(aClient *sptr, const char *arg)
sptr->proto |= capadd;
sptr->proto &= ~capdel;
+ return 0;
}
struct clicap_cmd {
const char *cmd;
- void (*func)(struct Client *source_p, const char *arg);
+ int (*func)(struct Client *source_p, const char *arg);
};
static struct clicap_cmd clicap_cmdtable[] = {
@@ -437,8 +445,7 @@ DLLFUNC int m_cap(aClient *cptr, aClient *sptr, int parc, char *parv[])
return 0;
}
- (cmd->func)(sptr, parv[2]);
- return 0;
+ return (cmd->func)(sptr, parv[2]);
}
/* This is called on module init, before Server Ready */
diff --git a/src/modules/m_nick.c b/src/modules/m_nick.c
index 3c34f176c..bb0cdbee0 100644
--- a/src/modules/m_nick.c
+++ b/src/modules/m_nick.c
@@ -864,6 +864,8 @@ int _register_user(aClient *cptr, aClient *sptr, char *nick, char *username, cha
if (MyConnect(sptr))
{
+ char temp[USERLEN + 1];
+
if ((i = check_client(sptr, username))) {
/* This had return i; before -McSkaf */
if (i == -5)
@@ -909,16 +911,16 @@ int _register_user(aClient *cptr, aClient *sptr, char *nick, char *username, cha
*
* Moved the noident stuff here. -OnyxDragon
*/
+
+ /* because username may point to user->username */
+ strncpyzt(temp, username, USERLEN + 1);
+
if (!(sptr->flags & FLAGS_DOID))
- strncpyzt(user->username, username, USERLEN + 1);
+ strncpyzt(user->username, temp, USERLEN + 1);
else if (sptr->flags & FLAGS_GOTID)
strncpyzt(user->username, sptr->username, USERLEN + 1);
else
{
-
- /* because username may point to user->username */
- char temp[USERLEN + 1];
- strncpyzt(temp, username, USERLEN + 1);
if (IDENT_CHECK == 0) {
strncpyzt(user->username, temp, USERLEN + 1);
}
diff --git a/src/s_bsd.c b/src/s_bsd.c
index 0c9bdb892..3f06fc88c 100644
--- a/src/s_bsd.c
+++ b/src/s_bsd.c
@@ -2138,20 +2138,27 @@ deadsocket:
}
length = 1; /* for fall through case */
+ if (!DoingDNS(cptr) && !DoingAuth(cptr)
+#ifdef USE_SSL
+ && !IsSSLHandshake(cptr)
+#endif
+ )
+ {
#ifdef USE_POLL
- if (pfd->revents & POLLIN)
+ if (pfd->revents & POLLIN)
#else
- if (FD_ISSET(cptr->fd, &read_set))
+ if (FD_ISSET(cptr->fd, &read_set))
#endif
- length = read_packet(cptr, 1);
- /* If we don't have anything to read and we have any recvQ, then
- * read_packet must still be called, but this time with the 2nd parameter
- * being 0 (=don't read). This is so we check if anything needs to
- * be dequeued from the receive queue (due to fake lag). -- Syzop
- */
- else if (DBufLength(&cptr->recvQ) > 0)
- length = read_packet(cptr, 0);
-
+ length = read_packet(cptr, 1);
+ /* If we don't have anything to read and we have any recvQ, then
+ * read_packet must still be called, but this time with the 2nd parameter
+ * being 0 (=don't read). This is so we check if anything needs to
+ * be dequeued from the receive queue (due to fake lag). -- Syzop
+ */
+ else if (DBufLength(&cptr->recvQ) > 0)
+ length = read_packet(cptr, 0);
+ }
+
#ifdef USE_SSL
if ((length != FLUSH_BUFFER) && (cptr->ssl != NULL) &&
IsSSLHandshake(cptr) &&
diff --git a/src/s_serv.c b/src/s_serv.c
index 7a079aa74..11fa2ab7f 100644
--- a/src/s_serv.c
+++ b/src/s_serv.c
@@ -249,6 +249,23 @@ char buf[1024];
#define IRCDTOTALVERSION BASE_VERSION PATCH1 PATCH2 PATCH3 PATCH4 PATCH5 PATCH6 PATCH7 PATCH8 PATCH9
#endif
+int remotecmdfilter(aClient *sptr, int parc, char *parv[])
+{
+ /* no remote requests permitted from non-ircops */
+ if (MyClient(sptr) && !IsOper(sptr) && !BadPtr(parv[1]))
+ {
+ parv[1] = NULL;
+ parc = 1;
+ }
+
+ /* same as above, but in case an old server forwards a request to us: we ignore it */
+ if (!MyClient(sptr) && !IsOper(sptr))
+ return 1; /* STOP (return) */
+
+ return 0; /* Continue */
+}
+
+
/*
* sends m_info into to sptr
*/
@@ -327,6 +344,8 @@ char **text = unrealinfo;
CMD_FUNC(m_info)
{
+ if (remotecmdfilter(sptr, parc, parv))
+ return 0;
if (hunt_server_token(cptr, sptr, MSG_INFO, TOK_INFO, ":%s", 1, parc,
parv) == HUNTED_ISME)
@@ -346,6 +365,9 @@ CMD_FUNC(m_dalinfo)
{
char **text = dalinfotext;
+ if (remotecmdfilter(sptr, parc, parv))
+ return 0;
+
if (hunt_server_token(cptr, sptr, MSG_DALINFO, TOK_DALINFO, ":%s", 1, parc,
parv) == HUNTED_ISME)
{
@@ -374,6 +396,9 @@ CMD_FUNC(m_license)
{
char **text = gnulicense;
+ if (remotecmdfilter(sptr, parc, parv))
+ return 0;
+
if (hunt_server_token(cptr, sptr, MSG_LICENSE, TOK_LICENSE, ":%s", 1, parc,
parv) == HUNTED_ISME)
{
@@ -397,6 +422,9 @@ CMD_FUNC(m_credits)
{
char **text = unrealcredits;
+ if (remotecmdfilter(sptr, parc, parv))
+ return 0;
+
if (hunt_server_token(cptr, sptr, MSG_CREDITS, TOK_CREDITS, ":%s", 1, parc,
parv) == HUNTED_ISME)
{
diff --git a/src/win32/unrealinst.iss b/src/win32/unrealinst.iss
index 12d707d8c..ac600c712 100644
--- a/src/win32/unrealinst.iss
+++ b/src/win32/unrealinst.iss
@@ -84,13 +84,13 @@ Source: "c:\dev\zlib\zlibwapi.dll"; DestDir: "{app}"; Flags: ignoreversion
#ifdef USE_SSL
#ifdef USE_CURL
; curl with ssl support
-Source: "C:\dev\curl-ssl\builds\libcurl-release-dll-sspi-spnego\bin\libcurl.dll"; DestDir: "{app}"; Flags: ignoreversion
+Source: "C:\dev\curl-ssl\builds\libcurl-vc-x86-release-dll-sspi-spnego\bin\libcurl.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\..\curl-ca-bundle.crt"; DestDir: "{app}"; Flags: ignoreversion
#endif
#else
#ifdef USE_CURL
; curl without ssl support
-Source: "C:\dev\curl\builds\libcurl-release-dll-sspi-spnego\bin\libcurl.dll"; DestDir: "{app}"; Flags: ignoreversion
+Source: "C:\dev\curl\builds\libcurl-vc-x86-release-dll-sspi-spnego\bin\libcurl.dll"; DestDir: "{app}"; Flags: ignoreversion
#endif
#endif
Source: isxdl.dll; DestDir: {tmp}; Flags: dontcopy