-/*
- * 'cupsdDeleteLocation()' - Free all memory used by a location.
- */
-
-void
-cupsdDeleteLocation(
- cupsd_location_t *loc) /* I - Location to delete */
-{
- int i; /* Looping var */
- cupsd_authmask_t *mask; /* Current mask */
-
-
- cupsArrayRemove(Locations, loc);
-
- for (i = loc->num_names - 1; i >= 0; i --)
- free(loc->names[i]);
-
- if (loc->num_names > 0)
- free(loc->names);
-
- for (i = loc->num_allow, mask = loc->allow; i > 0; i --, mask ++)
- if (mask->type == AUTH_NAME || mask->type == AUTH_INTERFACE)
- free(mask->mask.name.name);
-
- if (loc->num_allow > 0)
- free(loc->allow);
-
- for (i = loc->num_deny, mask = loc->deny; i > 0; i --, mask ++)
- if (mask->type == AUTH_NAME || mask->type == AUTH_INTERFACE)
- free(mask->mask.name.name);
-
- if (loc->num_deny > 0)
- free(loc->deny);
-
- free(loc->location);
- free(loc);
-}
-
-
-/*
- * 'cupsdDenyHost()' - Add a host name that is not allowed to access the
- * location.
- */
-
-void
-cupsdDenyHost(cupsd_location_t *loc, /* I - Location to add to */
- char *name) /* I - Name of host or domain to add */
-{
- cupsd_authmask_t *temp; /* New host/domain mask */
- char ifname[32], /* Interface name */
- *ifptr; /* Pointer to end of name */
-
-
- cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdDenyHost(loc=%p(%s), name=\"%s\")",
- loc, loc->location ? loc->location : "nil", name);
-
- if ((temp = add_deny(loc)) == NULL)
- return;
-
- if (!strcasecmp(name, "@LOCAL"))
- {
- /*
- * Deny *interface*...
- */
-
- temp->type = AUTH_INTERFACE;
- temp->mask.name.name = strdup("*");
- temp->mask.name.length = 1;
- }
- else if (!strncasecmp(name, "@IF(", 4))
- {
- /*
- * Deny *interface*...
- */
-
- strlcpy(ifname, name + 4, sizeof(ifname));
-
- ifptr = ifname + strlen(ifname);
-
- if (ifptr[-1] == ')')
- {
- ifptr --;
- *ifptr = '\0';
- }
-
- temp->type = AUTH_INTERFACE;
- temp->mask.name.name = strdup(ifname);
- temp->mask.name.length = ifptr - ifname;
- }
- else
- {
- /*
- * Deny name...
- */
-
- temp->type = AUTH_NAME;
- temp->mask.name.name = strdup(name);
- temp->mask.name.length = strlen(name);
- }
-}
-
-
-/*
- * 'cupsdDenyIP()' - Add an IP address or network that is not allowed to
- * access the location.
- */
-
-void
-cupsdDenyIP(cupsd_location_t *loc, /* I - Location to add to */
- unsigned address[4],/* I - IP address to add */
- unsigned netmask[4])/* I - Netmask of address */
-{
- cupsd_authmask_t *temp; /* New host/domain mask */
-
-
- cupsdLogMessage(CUPSD_LOG_DEBUG,
- "cupsdDenyIP(loc=%p(%s), address=%x:%x:%x:%x, netmask=%x:%x:%x:%x)",
- loc, loc->location ? loc->location : "nil",
- address[0], address[1], address[2], address[3],
- netmask[0], netmask[1], netmask[2], netmask[3]);
-
- if ((temp = add_deny(loc)) == NULL)
- return;
-
- temp->type = AUTH_IP;
- memcpy(temp->mask.ip.address, address, sizeof(temp->mask.ip.address));
- memcpy(temp->mask.ip.netmask, netmask, sizeof(temp->mask.ip.netmask));
-}
-
-