- if(!IsOperUnkline(source_p))
- {
- sendto_one(source_p, form_str(ERR_NOPRIVS),
- me.name, source_p->name, "unkline");
- return 0;
- }
-
- cidr = parv[1];
-
- if(parse_netmask(cidr, NULL, NULL) == HM_HOST)
- {
- sendto_one_notice(source_p, ":Invalid D-Line");
- return 0;
- }
-
- if(remove_temp_dline(cidr))
- {
- sendto_one(source_p,
- ":%s NOTICE %s :Un-dlined [%s] from temporary D-lines",
- me.name, parv[0], cidr);
- sendto_realops_snomask(SNO_GENERAL, L_ALL,
- "%s has removed the temporary D-Line for: [%s]",
- get_oper_name(source_p), cidr);
- ilog(L_KLINE, "UD %s %s", get_oper_name(source_p), cidr);
- return 0;
- }
-
- filename = get_conf_name(DLINE_TYPE);
-
- if((in = fopen(filename, "r")) == 0)
- {
- sendto_one(source_p, ":%s NOTICE %s :Cannot open %s", me.name, parv[0], filename);
- return 0;
- }
-
- oldumask = umask(0);
- if((out = fopen(temppath, "w")) == 0)
- {
- sendto_one(source_p, ":%s NOTICE %s :Cannot open %s", me.name, parv[0], temppath);
- fclose(in);
- umask(oldumask);
- return 0;
- }
-
- umask(oldumask);
-
- while (fgets(buf, sizeof(buf), in))
- {
- strlcpy(buff, buf, sizeof(buff));
-
- if((p = strchr(buff, '\n')) != NULL)
- *p = '\0';
-
- if((*buff == '\0') || (*buff == '#'))
- {
- if(!error_on_write)
- flush_write(source_p, out, buf, temppath);
- continue;
- }
-
- if((found_cidr = getfield(buff)) == NULL)
- {
- if(!error_on_write)
- flush_write(source_p, out, buf, temppath);
- continue;
- }
-
- if(irccmp(found_cidr, cidr) == 0)