55 int do_delete,
const char* zonelist_path)
62 int database_error = 0;
94 client_printf_err(sockfd,
"Unable to fetch all the current zones in the database!\n");
101 client_printf_err(sockfd,
"Memory allocation error!\n");
106 for (zone2 = zones; zone2; zone2 = zones) {
126 client_printf_err(sockfd,
"Unable to validate the zonelist XML!\n");
127 for (zone2 = zones; zone2; zone2 = zones) {
135 if (!(doc = xmlParseFile(zonelist_path))) {
136 client_printf_err(sockfd,
"Unable to read/parse zonelist XML file %s!\n",
138 for (zone2 = zones; zone2; zone2 = zones) {
146 if (!(root = xmlDocGetRootElement(doc))) {
147 client_printf_err(sockfd,
"Unable to get the root element in the zonelist XML!\n");
149 for (zone2 = zones; zone2; zone2 = zones) {
157 for (; root; root = root->next) {
158 if (root->type != XML_ELEMENT_NODE) {
162 if (!strcmp((
char*)root->name,
"ZoneList")) {
163 for (node = root->children; node; node = node->next) {
164 if (node->type != XML_ELEMENT_NODE) {
167 if (strcmp((
char*)node->name,
"Zone")) {
171 if (!(
name = xmlGetProp(node, (
const xmlChar*)
"name"))) {
172 client_printf_err(sockfd,
"Invalid Zone element in zonelist XML!\n");
174 for (zone2 = zones; zone2; zone2 = zones) {
183 client_printf_err(sockfd,
"Memory allocation error!\n");
186 for (zone2 = zones; zone2; zone2 = zones) {
200 client_printf_err(sockfd,
201 "Unable to create zone %s from XML, XML content may be invalid!\n",
210 client_printf_err(sockfd,
211 "Unable to create zone %s in the database!\n",
221 client_printf_err(sockfd,
"WARNING: The input file %s for zone %s does not currently exist. The zone will be added to the database anyway.\n",
zone_db_input_adapter_uri(zone),
zone_db_name(zone));
222 ods_log_warning(
"[%s] WARNING: The input file %s for zone %s does not currently exist. The zone will be added to the database anyway.", module_str,
zone_db_input_adapter_uri(zone),
zone_db_name(zone));
230 ods_log_info(
"[%s] zone %s created", module_str, (
char*)
name);
231 client_printf(sockfd,
"Zone %s created successfully\n",
239 for (zone2 = zones; zone2; zone2 = zone2->
next) {
243 if (!strcmp(zone2->
name, (
char*)
name)) {
254 client_printf_err(sockfd,
255 "Unable to update zone %s from XML, XML content may be invalid!\n",
260 for (zone2 = zones; zone2; zone2 = zones) {
273 client_printf_err(sockfd,
"Unable to update zone %s in database!\n",
281 ods_log_info(
"[%s] zone %s updated", module_str, (
char*)
name);
282 client_printf(sockfd,
"Updated zone %s successfully\n",
287 client_printf(sockfd,
"Zone %s already up-to-date\n",
301 for (zone2 = zones; zone2; zone2 = zone2->
next) {
307 client_printf_err(sockfd,
"Memory allocation error!\n");
309 for (zone2 = zones; zone2; zone2 = zones) {
326 client_printf_err(sockfd,
"Unable to get key data for zone %s from database!\n", zone2->
name);
370 client_printf_err(sockfd,
"Unable to delete zone %s from database!\n", zone2->
name);
376 ods_log_info(
"[%s] zone %s deleted", module_str, zone2->
name);
377 client_printf(sockfd,
"Deleted zone %s successfully\n", zone2->
name);
380 client_printf_err(sockfd,
"Unable to delete zone %s from database!\n", zone2->
name);
391 for (zone2 = zones; zone2; zone2 = zones) {
397 if (database_error) {