+ /* 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);
+ }
+
+ /* If globally disabling a G-line that we do not already have, avoid
+ * creating a temporary one. */
+ if (!agline && action == GLINE_DEACTIVATE) {
+ return gline_forward_deactivation(cptr, sptr, mask, expire, CurrentTime, 0, flags);
+ }
+