+ apply_undline(source_p, cidr);
+
+ return 0;
+}
+
+static int
+me_dline(struct Client *client_p, struct Client *source_p, int parc, const char **parv)
+{
+ int tdline_time = atoi(parv[1]);
+ /* Since this is coming over a server link, assume that the originating
+ * server did the relevant permission/sanity checks...
+ */
+
+ if(!IsPerson(source_p))
+ return 0;
+
+ if(!find_shared_conf(source_p->username, source_p->host,
+ source_p->servptr->name,
+ tdline_time > 0 ? SHARED_TDLINE : SHARED_PDLINE))
+ return 0;
+
+ apply_dline(source_p, parv[2], tdline_time, LOCAL_COPY(parv[3]));
+
+ check_dlines();
+ return 0;
+}
+
+static int
+me_undline(struct Client *client_p, struct Client *source_p, int parc, const char **parv)
+{
+ if(!IsPerson(source_p))
+ return 0;
+
+ if(!find_shared_conf(source_p->username, source_p->host,
+ source_p->servptr->name, SHARED_UNDLINE))
+ return 0;
+
+ apply_undline(source_p, parv[1]);
+
+ return 0;
+}
+
+static int
+apply_dline(struct Client *source_p, const char *dlhost, int tdline_time, char *reason)
+{
+ struct ConfItem *aconf;
+ char *oper_reason;
+ struct rb_sockaddr_storage daddr;
+ int t = AF_INET, ty, b;
+ const char *creason;
+
+ ty = parse_netmask(dlhost, (struct sockaddr *) &daddr, &b);
+ if(ty == HM_HOST)
+ {
+ sendto_one(source_p, ":%s NOTICE %s :Invalid D-Line", me.name, source_p->name);
+ return 0;
+ }
+#ifdef RB_IPV6
+ if(ty == HM_IPV6)
+ t = AF_INET6;
+ else
+#endif
+ t = AF_INET;
+
+ /* This means dlines wider than /16 cannot be set remotely */