projects
/
ircu2.10.12-pk.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix SF bug #2721107 (Gline lifetime changes from servers change the reason.)
[ircu2.10.12-pk.git]
/
ircd
/
m_gline.c
diff --git
a/ircd/m_gline.c
b/ircd/m_gline.c
index 95e2ac173b29471b0898194b303e27d3543f98e9..549ae140db667df9ebac742cc6efb0ec0ec25635 100644
(file)
--- a/
ircd/m_gline.c
+++ b/
ircd/m_gline.c
@@
-1,4
+1,4
@@
-/*
+
\
/*
* IRC - Internet Relay Chat, ircd/m_gline.c
* Copyright (C) 1990 Jarkko Oikarinen and
* University of Oulu, Computing Center
* IRC - Internet Relay Chat, ircd/m_gline.c
* Copyright (C) 1990 Jarkko Oikarinen and
* University of Oulu, Computing Center
@@
-279,6
+279,7
@@
ms_gline(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
case GLINE_LOCAL_DEACTIVATE: /* locally deactivating a G-line */
if (!agline) /* no G-line to locally activate or deactivate? */
return send_reply(sptr, ERR_NOSUCHGLINE, mask);
case GLINE_LOCAL_DEACTIVATE: /* locally deactivating a G-line */
if (!agline) /* no G-line to locally activate or deactivate? */
return send_reply(sptr, ERR_NOSUCHGLINE, mask);
+ lastmod = agline->gl_lastmod;
break; /* no additional parameters to manipulate */
case GLINE_ACTIVATE: /* activating a G-line */
break; /* no additional parameters to manipulate */
case GLINE_ACTIVATE: /* activating a G-line */
@@
-307,7
+308,7
@@
ms_gline(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
if (!agline || /* gline creation, has to be the reason */
/* trial-convert as lifetime, and if it doesn't fully convert,
* it must be the reason */
if (!agline || /* gline creation, has to be the reason */
/* trial-convert as lifetime, and if it doesn't fully convert,
* it must be the reason */
- ((lifetime = strtoul(parv[5], &tmp, 10)) && !*tmp)) {
+ (
!
(lifetime = strtoul(parv[5], &tmp, 10)) && !*tmp)) {
lifetime = 0;
reason = parv[5];
lifetime = 0;
reason = parv[5];
@@
-379,7
+380,7
@@
mo_gline(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
unsigned int flags = 0;
enum GlineAction action = GLINE_MODIFY;
time_t expire = 0;
unsigned int flags = 0;
enum GlineAction action = GLINE_MODIFY;
time_t expire = 0;
- char *mask = parv[1], *target = 0, *reason = 0;
+ char *mask = parv[1], *target = 0, *reason = 0
, *end
;
if (parc < 2)
return gline_list(sptr, 0);
if (parc < 2)
return gline_list(sptr, 0);
@@
-422,7
+423,9
@@
mo_gline(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
return need_more_params(sptr, "GLINE");
target = parv[2]; /* get the target... */
return need_more_params(sptr, "GLINE");
target = parv[2]; /* get the target... */
- expire = atoi(parv[3]) + CurrentTime; /* and the expiration */
+ expire = strtol(parv[3], &end, 10) + CurrentTime; /* and the expiration */
+ if (*end != '\0')
+ return send_reply(sptr, SND_EXPLICIT | ERR_BADEXPIRE, "%s :Bad expire time", parv[3]);
flags |= GLINE_EXPIRE; /* remember that we got an expire time */
flags |= GLINE_EXPIRE; /* remember that we got an expire time */
@@
-442,8
+445,11
@@
mo_gline(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
case GLINE_LOCAL_ACTIVATE: /* locally activate a G-line */
case GLINE_LOCAL_DEACTIVATE: /* locally deactivate a G-line */
case GLINE_LOCAL_ACTIVATE: /* locally activate a G-line */
case GLINE_LOCAL_DEACTIVATE: /* locally deactivate a G-line */
- if (parc > 2) /* if target is available, pick it */
+ if (parc > 2)
{
/* if target is available, pick it */
target = parv[2];
target = parv[2];
+ if (target[0] == '*' && target[1] == '\0')
+ return send_reply(sptr, ERR_NOSUCHSERVER, target);
+ }
break;
case GLINE_ACTIVATE: /* activating/adding a G-line */
break;
case GLINE_ACTIVATE: /* activating/adding a G-line */
@@
-453,8
+459,10
@@
mo_gline(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
if (parc > 3) {
/* get expiration and target */
if (parc > 3) {
/* get expiration and target */
- expire = atoi(parv[parc - 2]) + CurrentTime;
reason = parv[parc - 1];
reason = parv[parc - 1];
+ expire = strtol(parv[parc - 2], &end, 10) + CurrentTime;
+ if (*end != '\0')
+ return send_reply(sptr, SND_EXPLICIT | ERR_BADEXPIRE, "%s :Bad expire time", parv[parc - 2]);
flags |= GLINE_EXPIRE | GLINE_REASON; /* remember that we got 'em */
flags |= GLINE_EXPIRE | GLINE_REASON; /* remember that we got 'em */
@@
-499,8
+507,8
@@
mo_gline(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
action == GLINE_LOCAL_ACTIVATE ? '>' : '<'));
sendcmdto_one(sptr, CMD_GLINE, acptr, "%C %s%c%s", acptr,
action == GLINE_LOCAL_ACTIVATE ? '>' : '<'));
sendcmdto_one(sptr, CMD_GLINE, acptr, "%C %s%c%s", acptr,
- flags & GLINE_OPERFORCE ? "!" : "",
- action == GLINE_LOCAL_ACTIVATE ? '>' : '<', mask);
+
flags & GLINE_OPERFORCE ? "!" : "",
+
action == GLINE_LOCAL_ACTIVATE ? '>' : '<', mask);
return 0; /* all done */
}
return 0; /* all done */
}
@@
-582,10
+590,12
@@
mo_gline(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
}
}
}
}
- /* can't modify a G-line that doesn't exist... */
+ /* can't modify a G-line that doesn't exist...
+ * (and if we are creating a new one, we need a reason and expiration)
+ */
if (!agline &&
(action == GLINE_MODIFY || action == GLINE_LOCAL_ACTIVATE ||
if (!agline &&
(action == GLINE_MODIFY || action == GLINE_LOCAL_ACTIVATE ||
- action == GLINE_LOCAL_DEACTIVATE))
+ action == GLINE_LOCAL_DEACTIVATE
|| !reason || !expire
))
return send_reply(sptr, ERR_NOSUCHGLINE, mask);
/* check for G-line permissions... */
return send_reply(sptr, ERR_NOSUCHGLINE, mask);
/* check for G-line permissions... */