1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-06-29 08:56:38 +02:00

Various fixes, more info later.

This commit is contained in:
Bram Matthys
2013-11-20 12:44:26 +01:00
parent 50afecfaa7
commit d8645f710d
5 changed files with 78 additions and 34 deletions
+21 -14
View File
@@ -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 */
+7 -5
View File
@@ -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);
}
+20 -13
View File
@@ -2138,20 +2138,27 @@ deadsocket:
}
length = 1; /* for fall through case */
#ifdef USE_POLL
if (pfd->revents & POLLIN)
#else
if (FD_ISSET(cptr->fd, &read_set))
if (!DoingDNS(cptr) && !DoingAuth(cptr)
#ifdef USE_SSL
&& !IsSSLHandshake(cptr)
#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);
)
{
#ifdef USE_POLL
if (pfd->revents & POLLIN)
#else
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);
}
#ifdef USE_SSL
if ((length != FLUSH_BUFFER) && (cptr->ssl != NULL) &&
IsSSLHandshake(cptr) &&
+28
View File
@@ -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)
{
+2 -2
View File
@@ -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