if ((action == GLINE_LOCAL_ACTIVATE || action == GLINE_LOCAL_DEACTIVATE) &&
!IsMe(acptr)) {
Debug((DEBUG_DEBUG, "I am forwarding a local change to a global gline "
- "to a remote server; target %s, mask %s, operforce %s, action %s",
+ "to a remote server; target %s, mask %s, operforce %s, action %c",
target, mask, flags & GLINE_OPERFORCE ? "YES" : "NO",
- action == GLINE_LOCAL_ACTIVATE ? ">" : "<"));
+ action == GLINE_LOCAL_ACTIVATE ? '>' : '<'));
sendcmdto_one(sptr, CMD_GLINE, acptr, "%C %s%c%s", acptr,
flags & GLINE_OPERFORCE ? "!" : "",
- action == GLINE_LOCAL_ACTIVATE ? ">" : "<", mask);
+ action == GLINE_LOCAL_ACTIVATE ? '>' : '<', mask);
return 0; /* all done */
}
assert(!IsMe(acptr));
Debug((DEBUG_DEBUG, "I am forwarding a local G-line to a remote server; "
- "target %s, mask %s, operforce %s, action %s, expire %Tu, "
+ "target %s, mask %s, operforce %s, action %c, expire %Tu, "
"lastmod %Tu, reason: %s", target, mask,
flags & GLINE_OPERFORCE ? "YES" : "NO",
- action == GLINE_ACTIVATE ? "+" : "-", expire_off, CurrentTime,
+ action == GLINE_ACTIVATE ? '+' : '-', expire_off, CurrentTime,
reason));
sendcmdto_one(sptr, CMD_GLINE, acptr, "%C %s%c%s %Tu %Tu :%s",
}
}
+ if (!lastmod) /* must have a lastmod parameter by now */
+ return need_more_params(sptr, "GLINE");
+
Debug((DEBUG_DEBUG, "I have a global G-line I am acting upon now; "
"target %s, mask %s, operforce %s, action %s, expire %Tu, "
"lastmod %Tu, lifetime %Tu, reason: %s; gline %s! (fields "
/* If it's a local activate/deactivate and server isn't me, propagate it */
if ((action == GLINE_LOCAL_ACTIVATE || action == GLINE_LOCAL_DEACTIVATE) &&
!IsMe(acptr)) {
+ /* check for permissions... */
+ if (!feature_bool(FEAT_CONFIG_OPERCMDS))
+ return send_reply(sptr, ERR_DISABLED, "GLINE");
+ else if (!HasPriv(sptr, PRIV_GLINE))
+ return send_reply(sptr, ERR_NOPRIVILEGES);
+
Debug((DEBUG_DEBUG, "I am forwarding a local change to a global gline "
- "to a remote server; target %s, mask %s, operforce %s, action %s",
+ "to a remote server; target %s, mask %s, operforce %s, action %c",
cli_name(acptr), mask, flags & GLINE_OPERFORCE ? "YES" : "NO",
- action == GLINE_LOCAL_ACTIVATE ? ">" : "<"));
+ action == GLINE_LOCAL_ACTIVATE ? '>' : '<'));
sendcmdto_one(sptr, CMD_GLINE, acptr, "%C %s%c%s", acptr,
flags & GLINE_OPERFORCE ? "!" : "",
- action == GLINE_LOCAL_ACTIVATE ? ">" : "<", mask);
+ action == GLINE_LOCAL_ACTIVATE ? '>' : '<', mask);
return 0; /* all done */
}
*/
if (!IsMe(acptr)) {
+ /* check for permissions... */
+ if (!feature_bool(FEAT_CONFIG_OPERCMDS))
+ return send_reply(sptr, ERR_DISABLED, "GLINE");
+ else if (!HasPriv(sptr, PRIV_GLINE))
+ return send_reply(sptr, ERR_NOPRIVILEGES);
+
Debug((DEBUG_DEBUG, "I am forwarding a local G-line to a remote "
- "server; target %s, mask %s, operforce %s, action %s, "
+ "server; target %s, mask %s, operforce %s, action %c, "
"expire %Tu, reason %s", target, mask,
flags & GLINE_OPERFORCE ? "YES" : "NO",
- action == GLINE_ACTIVATE ? "+" : "-", expire_off, reason));
+ action == GLINE_ACTIVATE ? '+' : '-', expire_off, reason));
sendcmdto_one(sptr, CMD_GLINE, acptr, "%C %s%c%s %Tu %Tu :%s",
acptr, flags & GLINE_OPERFORCE ? "!" : "",
- action == GLINE_ACTIVATE ? "+" : "-", mask, expire_off,
+ action == GLINE_ACTIVATE ? '+' : '-', mask, expire_off,
CurrentTime, reason);
return 0; /* all done */
}
+ /* check local G-line permissions... */
+ if (!HasPriv(sptr, PRIV_LOCAL_GLINE))
+ return send_reply(sptr, ERR_NOPRIVILEGES);
+
/* let's handle activation... */
if (action == GLINE_ACTIVATE) {
if (agline) /* G-line already exists, so let's ignore it... */
action == GLINE_LOCAL_DEACTIVATE))
return send_reply(sptr, ERR_NOSUCHGLINE, mask);
+ /* check for G-line permissions... */
+ if (action == GLINE_LOCAL_ACTIVATE || action == GLINE_LOCAL_DEACTIVATE) {
+ /* only need local privileges for locally-limited status changes */
+ if (!HasPriv(sptr, PRIV_LOCAL_GLINE))
+ return send_reply(sptr, ERR_NOPRIVILEGES);
+ } else { /* global privileges required */
+ if (!feature_bool(FEAT_CONFIG_OPERCMDS))
+ return send_reply(sptr, ERR_DISABLED, "GLINE");
+ else if (!HasPriv(sptr, PRIV_GLINE))
+ return send_reply(sptr, ERR_NOPRIVILEGES);
+ }
+
Debug((DEBUG_DEBUG, "I have a global G-line I am acting upon now; "
"target %s, mask %s, operforce %s, action %s, expire %Tu, "
"reason: %s; gline %s! (fields present: %s %s)", target,