OpenDNSSEC-enforcer  2.1.10
policy_ext.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014 Jerry Lundström <lundstrom.jerry@gmail.com>
3  * Copyright (c) 2014 .SE (The Internet Infrastructure Foundation).
4  * Copyright (c) 2014 OpenDNSSEC AB (svb)
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  * notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
20  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
22  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
24  * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
25  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
26  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  *
28  */
29 
30 #include "policy.h"
31 
32 #include "db_error.h"
33 #include "duration.h"
34 #include "log.h"
35 
36 #include <string.h>
37 
38 static int __xmlNode2policy(policy_t* policy, xmlNodePtr policy_node, int* updated) {
39  xmlNodePtr node;
40  xmlNodePtr node2;
41  xmlNodePtr node3;
42  xmlNodePtr node4;
43  xmlChar* xml_text = NULL;
44  duration_type* duration = NULL;
45  int check_if_updated = 0;
46  int update_this = 1;
47  int denial_optout = 0;
48  int keys_shared = 0;
49  int signatures_max_zone_ttl = 0;
50  int keys_purge = 0;
51  int denial_ttl = 0;
52  unsigned int passthrough = 0;
53 
54  if (!policy) {
55  return DB_ERROR_UNKNOWN;
56  }
57  if (!policy_node) {
58  return DB_ERROR_UNKNOWN;
59  }
60 
61  /*
62  * If updated is set we will check if the content is changed and set the
63  * integer pointed by updated to non-zero.
64  */
65  if (updated) {
66  *updated = 0;
67  check_if_updated = 1;
68  }
69 
70  if (!(xml_text = xmlGetProp(policy_node, (xmlChar*)"name"))) {
71  return DB_ERROR_UNKNOWN;
72  }
73  ods_log_deeebug("[policy_*_from_xml] policy %s", (char*)xml_text);
74  if (check_if_updated) {
75  update_this = 0;
76  if (!policy_name(policy)) {
77  *updated = 1;
78  update_this = 1;
79  }
80  else if (strcmp(policy_name(policy), (char*)xml_text)) {
81  *updated = 1;
82  update_this = 1;
83  }
84  }
85  if (update_this) {
86  if (policy_set_name(policy, (char*)xml_text)) {
87  if (xml_text) {
88  xmlFree(xml_text);
89  }
90  return DB_ERROR_UNKNOWN;
91  }
92  }
93  if (xml_text) {
94  xmlFree(xml_text);
95  xml_text = NULL;
96  }
97 
98  for (node = policy_node->children; node; node = node->next) {
99  if (node->type != XML_ELEMENT_NODE) {
100  continue;
101  }
102 
103  if (!strcmp((char*)node->name, "Description")) {
104  if (!(xml_text = xmlNodeGetContent(node))) {
105  return DB_ERROR_UNKNOWN;
106  }
107  ods_log_deeebug("[policy_*_from_xml] description %s", (char*)xml_text);
108  if (check_if_updated) {
109  update_this = 0;
110  if (!policy_description(policy)) {
111  *updated = 1;
112  update_this = 1;
113  }
114  else if (strcmp(policy_description(policy), (char*)xml_text)) {
115  *updated = 1;
116  update_this = 1;
117  }
118  }
119  if (update_this) {
120  if (policy_set_description(policy, (char*)xml_text)) {
121  if (xml_text) {
122  xmlFree(xml_text);
123  }
124  return DB_ERROR_UNKNOWN;
125  }
126  }
127  if (xml_text) {
128  xmlFree(xml_text);
129  xml_text = NULL;
130  }
131  }
132  else if (!strcmp((char*)node->name, "Passthrough")) {
133  passthrough = 1;
134  }
135  else if (!strcmp((char*)node->name, "Signatures")) {
136  for (node2 = node->children; node2; node2 = node2->next) {
137  if (node2->type != XML_ELEMENT_NODE) {
138  continue;
139  }
140 
141  if (!strcmp((char*)node2->name, "Resign")) {
142  if (!(xml_text = xmlNodeGetContent(node2))) {
143  return DB_ERROR_UNKNOWN;
144  }
145  ods_log_deeebug("[policy_*_from_xml] signature resign %s", (char*)xml_text);
146  if (!(duration = duration_create_from_string((char*)xml_text))) {
147  if (xml_text) {
148  xmlFree(xml_text);
149  }
150  return DB_ERROR_UNKNOWN;
151  }
152  if (xml_text) {
153  xmlFree(xml_text);
154  xml_text = NULL;
155  }
156  if (check_if_updated) {
157  update_this = 0;
158  if (policy_signatures_resign(policy) != duration2time(duration)) {
159  *updated = 1;
160  update_this = 1;
161  }
162  }
163  if (update_this) {
164  if (policy_set_signatures_resign(policy, duration2time(duration))) {
165  duration_cleanup(duration);
166  return DB_ERROR_UNKNOWN;
167  }
168  }
169  duration_cleanup(duration);
170  duration = NULL;
171  }
172  else if (!strcmp((char*)node2->name, "Refresh")) {
173  if (!(xml_text = xmlNodeGetContent(node2))) {
174  return DB_ERROR_UNKNOWN;
175  }
176  ods_log_deeebug("[policy_*_from_xml] signature refresh %s", (char*)xml_text);
177  if (!(duration = duration_create_from_string((char*)xml_text))) {
178  if (xml_text) {
179  xmlFree(xml_text);
180  }
181  return DB_ERROR_UNKNOWN;
182  }
183  if (xml_text) {
184  xmlFree(xml_text);
185  xml_text = NULL;
186  }
187  if (check_if_updated) {
188  update_this = 0;
189  if (policy_signatures_refresh(policy) != duration2time(duration)) {
190  *updated = 1;
191  update_this = 1;
192  }
193  }
194  if (update_this) {
195  if (policy_set_signatures_refresh(policy, duration2time(duration))) {
196  duration_cleanup(duration);
197  return DB_ERROR_UNKNOWN;
198  }
199  }
200  duration_cleanup(duration);
201  duration = NULL;
202  }
203  else if (!strcmp((char*)node2->name, "Validity")) {
204  for (node3 = node2->children; node3; node3 = node3->next) {
205  if (node3->type != XML_ELEMENT_NODE) {
206  continue;
207  }
208 
209  if (!strcmp((char*)node3->name, "Default")) {
210  if (!(xml_text = xmlNodeGetContent(node3))) {
211  return DB_ERROR_UNKNOWN;
212  }
213  ods_log_deeebug("[policy_*_from_xml] signature validity default %s", (char*)xml_text);
214  if (!(duration = duration_create_from_string((char*)xml_text))) {
215  if (xml_text) {
216  xmlFree(xml_text);
217  }
218  return DB_ERROR_UNKNOWN;
219  }
220  if (xml_text) {
221  xmlFree(xml_text);
222  xml_text = NULL;
223  }
224  if (check_if_updated) {
225  update_this = 0;
226  if (policy_signatures_validity_default(policy) != duration2time(duration)) {
227  *updated = 1;
228  update_this = 1;
229  }
230  }
231  if (update_this) {
232  if (policy_set_signatures_validity_default(policy, duration2time(duration))) {
233  duration_cleanup(duration);
234  return DB_ERROR_UNKNOWN;
235  }
236  }
237  duration_cleanup(duration);
238  duration = NULL;
239  }
240  else if (!strcmp((char*)node3->name, "Denial")) {
241  if (!(xml_text = xmlNodeGetContent(node3))) {
242  return DB_ERROR_UNKNOWN;
243  }
244  ods_log_deeebug("[policy_*_from_xml] signature validity denial %s", (char*)xml_text);
245  if (!(duration = duration_create_from_string((char*)xml_text))) {
246  if (xml_text) {
247  xmlFree(xml_text);
248  }
249  return DB_ERROR_UNKNOWN;
250  }
251  if (xml_text) {
252  xmlFree(xml_text);
253  xml_text = NULL;
254  }
255  if (check_if_updated) {
256  update_this = 0;
257  if (policy_signatures_validity_denial(policy) != duration2time(duration)) {
258  *updated = 1;
259  update_this = 1;
260  }
261  }
262  if (update_this) {
263  if (policy_set_signatures_validity_denial(policy, duration2time(duration))) {
264  duration_cleanup(duration);
265  return DB_ERROR_UNKNOWN;
266  }
267  }
268  duration_cleanup(duration);
269  duration = NULL;
270  }
271  else if (!strcmp((char*)node3->name, "Keyset")) {
272  if (!(xml_text = xmlNodeGetContent(node3))) {
273  return DB_ERROR_UNKNOWN;
274  }
275  ods_log_deeebug("[policy_*_from_xml] signature validity keyset %s", (char*)xml_text);
276  if (!(duration = duration_create_from_string((char*)xml_text))) {
277  if (xml_text) {
278  xmlFree(xml_text);
279  }
280  return DB_ERROR_UNKNOWN;
281  }
282  if (xml_text) {
283  xmlFree(xml_text);
284  xml_text = NULL;
285  }
286  if (check_if_updated) {
287  update_this = 0;
288  if (policy_signatures_validity_keyset(policy) != duration2time(duration)) {
289  *updated = 1;
290  update_this = 1;
291  }
292  }
293  if (update_this) {
294  if (policy_set_signatures_validity_keyset(policy, duration2time(duration))) {
295  duration_cleanup(duration);
296  return DB_ERROR_UNKNOWN;
297  }
298  }
299  duration_cleanup(duration);
300  duration = NULL;
301  }
302  else {
303  ods_log_deeebug("[policy_*_from_xml] unknown %s", (char*)node3->name);
304  return DB_ERROR_UNKNOWN;
305  }
306  }
307  }
308  else if (!strcmp((char*)node2->name, "Jitter")) {
309  if (!(xml_text = xmlNodeGetContent(node2))) {
310  return DB_ERROR_UNKNOWN;
311  }
312  ods_log_deeebug("[policy_*_from_xml] signature jitter %s", (char*)xml_text);
313  if (!(duration = duration_create_from_string((char*)xml_text))) {
314  if (xml_text) {
315  xmlFree(xml_text);
316  }
317  return DB_ERROR_UNKNOWN;
318  }
319  if (xml_text) {
320  xmlFree(xml_text);
321  xml_text = NULL;
322  }
323  if (check_if_updated) {
324  update_this = 0;
325  if (policy_signatures_jitter(policy) != duration2time(duration)) {
326  *updated = 1;
327  update_this = 1;
328  }
329  }
330  if (update_this) {
331  if (policy_set_signatures_jitter(policy, duration2time(duration))) {
332  duration_cleanup(duration);
333  return DB_ERROR_UNKNOWN;
334  }
335  }
336  duration_cleanup(duration);
337  duration = NULL;
338  }
339  else if (!strcmp((char*)node2->name, "InceptionOffset")) {
340  if (!(xml_text = xmlNodeGetContent(node2))) {
341  return DB_ERROR_UNKNOWN;
342  }
343  ods_log_deeebug("[policy_*_from_xml] signature inception offset %s", (char*)xml_text);
344  if (!(duration = duration_create_from_string((char*)xml_text))) {
345  if (xml_text) {
346  xmlFree(xml_text);
347  }
348  return DB_ERROR_UNKNOWN;
349  }
350  if (xml_text) {
351  xmlFree(xml_text);
352  xml_text = NULL;
353  }
354  if (check_if_updated) {
355  update_this = 0;
356  if (policy_signatures_inception_offset(policy) != duration2time(duration)) {
357  *updated = 1;
358  update_this = 1;
359  }
360  }
361  if (update_this) {
362  if (policy_set_signatures_inception_offset(policy, duration2time(duration))) {
363  duration_cleanup(duration);
364  return DB_ERROR_UNKNOWN;
365  }
366  }
367  duration_cleanup(duration);
368  duration = NULL;
369  }
370  else if (!strcmp((char*)node2->name, "MaxZoneTTL")) {
371  signatures_max_zone_ttl = 1;
372  if (!(xml_text = xmlNodeGetContent(node2))) {
373  return DB_ERROR_UNKNOWN;
374  }
375  ods_log_deeebug("[policy_*_from_xml] signature max zone ttl %s", (char*)xml_text);
376  if (!(duration = duration_create_from_string((char*)xml_text))) {
377  if (xml_text) {
378  xmlFree(xml_text);
379  }
380  return DB_ERROR_UNKNOWN;
381  }
382  if (xml_text) {
383  xmlFree(xml_text);
384  xml_text = NULL;
385  }
386  if (check_if_updated) {
387  update_this = 0;
388  if (policy_signatures_max_zone_ttl(policy) != duration2time(duration)) {
389  *updated = 1;
390  update_this = 1;
391  }
392  }
393  if (update_this) {
394  if (policy_set_signatures_max_zone_ttl(policy, duration2time(duration))) {
395  duration_cleanup(duration);
396  return DB_ERROR_UNKNOWN;
397  }
398  }
399  duration_cleanup(duration);
400  duration = NULL;
401  }
402  else {
403  ods_log_deeebug("[policy_*_from_xml] unknown %s", (char*)node2->name);
404  return DB_ERROR_UNKNOWN;
405  }
406  }
407  }
408  else if (!strcmp((char*)node->name, "Denial")) {
409  for (node2 = node->children; node2; node2 = node2->next) {
410  if (node2->type != XML_ELEMENT_NODE) {
411  continue;
412  }
413 
414  if (!strcmp((char*)node2->name, "NSEC")) {
415  ods_log_deeebug("[policy_*_from_xml] denial nsec");
416  if (check_if_updated) {
417  update_this = 0;
419  *updated = 1;
420  update_this = 1;
421  }
422  }
423  if (update_this) {
425  return DB_ERROR_UNKNOWN;
426  }
427  }
428  }
429  else if (!strcmp((char*)node2->name, "NSEC3")) {
430  ods_log_deeebug("[policy_*_from_xml] denial nsec3");
431  if (check_if_updated) {
432  update_this = 0;
434  *updated = 1;
435  update_this = 1;
436  }
437  }
438  if (update_this) {
440  return DB_ERROR_UNKNOWN;
441  }
442  }
443 
444  for (node3 = node2->children; node3; node3 = node3->next) {
445  if (node3->type != XML_ELEMENT_NODE) {
446  continue;
447  }
448 
449  if (!strcmp((char*)node3->name, "TTL")) {
450  denial_ttl = 1;
451  if (!(xml_text = xmlNodeGetContent(node3))) {
452  return DB_ERROR_UNKNOWN;
453  }
454  ods_log_deeebug("[policy_*_from_xml] denial ttl %s", (char*)xml_text);
455  if (!(duration = duration_create_from_string((char*)xml_text))) {
456  if (xml_text) {
457  xmlFree(xml_text);
458  }
459  return DB_ERROR_UNKNOWN;
460  }
461  if (xml_text) {
462  xmlFree(xml_text);
463  xml_text = NULL;
464  }
465  if (policy_denial_ttl(policy) != duration2time(duration)) {
466  if (policy_set_denial_ttl(policy, duration2time(duration))) {
467  duration_cleanup(duration);
468  return DB_ERROR_UNKNOWN;
469  }
470  if (check_if_updated) *updated = 1;
471  }
472  duration_cleanup(duration);
473  duration = NULL;
474  }
475  else if (!strcmp((char*)node3->name, "OptOut")) {
476  denial_optout = 1;
477  ods_log_deeebug("[policy_*_from_xml] denial optout");
478  if (check_if_updated) {
479  update_this = 0;
481  *updated = 1;
482  update_this = 1;
483  }
484  }
485  if (update_this) {
487  return DB_ERROR_UNKNOWN;
488  }
489  }
490  }
491  else if (!strcmp((char*)node3->name, "Resalt")) {
492  if (!(xml_text = xmlNodeGetContent(node3))) {
493  return DB_ERROR_UNKNOWN;
494  }
495  ods_log_deeebug("[policy_*_from_xml] denial resalt %s", (char*)xml_text);
496  if (!(duration = duration_create_from_string((char*)xml_text))) {
497  if (xml_text) {
498  xmlFree(xml_text);
499  }
500  return DB_ERROR_UNKNOWN;
501  }
502  if (xml_text) {
503  xmlFree(xml_text);
504  xml_text = NULL;
505  }
506  if (check_if_updated) {
507  update_this = 0;
508  if (policy_denial_resalt(policy) != duration2time(duration)) {
509  *updated = 1;
510  update_this = 1;
511  }
512  }
513  if (update_this) {
514  if (policy_set_denial_resalt(policy, duration2time(duration))) {
515  duration_cleanup(duration);
516  return DB_ERROR_UNKNOWN;
517  }
518  }
519  duration_cleanup(duration);
520  duration = NULL;
521  }
522  else if (!strcmp((char*)node3->name, "Hash")) {
523  for (node4 = node3->children; node4; node4 = node4->next) {
524  if (node4->type != XML_ELEMENT_NODE) {
525  continue;
526  }
527 
528  if (!strcmp((char*)node4->name, "Algorithm")) {
529  if (!(xml_text = xmlNodeGetContent(node4))) {
530  return DB_ERROR_UNKNOWN;
531  }
532  ods_log_deeebug("[policy_*_from_xml] denial algorithm %s", (char*)xml_text);
533  if (check_if_updated) {
534  update_this = 0;
535  if (policy_denial_algorithm(policy) != (unsigned int)atoi((char*)xml_text)) {
536  *updated = 1;
537  update_this = 1;
538  }
539  }
540  if (update_this) {
541  if (policy_set_denial_algorithm(policy, (unsigned int)atoi((char*)xml_text))) {
542  if (xml_text) {
543  xmlFree(xml_text);
544  }
545  return DB_ERROR_UNKNOWN;
546  }
547  }
548  if (xml_text) {
549  xmlFree(xml_text);
550  xml_text = NULL;
551  }
552  }
553  else if (!strcmp((char*)node4->name, "Iterations")) {
554  if (!(xml_text = xmlNodeGetContent(node4))) {
555  return DB_ERROR_UNKNOWN;
556  }
557  ods_log_deeebug("[policy_*_from_xml] denial iterations %s", (char*)xml_text);
558  if (check_if_updated) {
559  update_this = 0;
560  if (policy_denial_iterations(policy) != (unsigned int)atoi((char*)xml_text)) {
561  *updated = 1;
562  update_this = 1;
563  }
564  }
565  if (update_this) {
566  if (policy_set_denial_iterations(policy, (unsigned int)atoi((char*)xml_text))) {
567  if (xml_text) {
568  xmlFree(xml_text);
569  }
570  return DB_ERROR_UNKNOWN;
571  }
572  }
573  if (xml_text) {
574  xmlFree(xml_text);
575  xml_text = NULL;
576  }
577  }
578  else if (!strcmp((char*)node4->name, "Salt")) {
579  if (!(xml_text = xmlGetProp(node4, (xmlChar*)"length"))) {
580  return DB_ERROR_UNKNOWN;
581  }
582  ods_log_deeebug("[policy_*_from_xml] denial salt length %s", (char*)xml_text);
583  if (check_if_updated) {
584  update_this = 0;
585  if (policy_denial_salt_length(policy) != (unsigned int)atoi((char*)xml_text)) {
586  *updated = 1;
587  update_this = 1;
588  }
589  }
590  if (update_this) {
591  if (policy_set_denial_salt_length(policy, (unsigned int)atoi((char*)xml_text))) {
592  if (xml_text) {
593  xmlFree(xml_text);
594  }
595  return DB_ERROR_UNKNOWN;
596  }
597  }
598  if (xml_text) {
599  xmlFree(xml_text);
600  xml_text = NULL;
601  }
602  }
603  else {
604  ods_log_deeebug("[policy_*_from_xml] unknown %s", (char*)node4->name);
605  return DB_ERROR_UNKNOWN;
606  }
607  }
608  }
609  else {
610  ods_log_deeebug("[policy_*_from_xml] unknown %s", (char*)node3->name);
611  return DB_ERROR_UNKNOWN;
612  }
613  }
614  }
615  else {
616  ods_log_deeebug("[policy_*_from_xml] unknown %s", (char*)node2->name);
617  return DB_ERROR_UNKNOWN;
618  }
619  }
620  }
621  else if (!strcmp((char*)node->name, "Keys")) {
622  for (node2 = node->children; node2; node2 = node2->next) {
623  if (node2->type != XML_ELEMENT_NODE) {
624  continue;
625  }
626 
627  if (!strcmp((char*)node2->name, "TTL")) {
628  if (!(xml_text = xmlNodeGetContent(node2))) {
629  return DB_ERROR_UNKNOWN;
630  }
631  ods_log_deeebug("[policy_*_from_xml] keys ttl %s", (char*)xml_text);
632  if (!(duration = duration_create_from_string((char*)xml_text))) {
633  if (xml_text) {
634  xmlFree(xml_text);
635  }
636  return DB_ERROR_UNKNOWN;
637  }
638  if (xml_text) {
639  xmlFree(xml_text);
640  xml_text = NULL;
641  }
642  if (check_if_updated) {
643  update_this = 0;
644  if (policy_keys_ttl(policy) != duration2time(duration)) {
645  *updated = 1;
646  update_this = 1;
647  }
648  }
649  if (update_this) {
650  if (policy_set_keys_ttl(policy, duration2time(duration))) {
651  duration_cleanup(duration);
652  return DB_ERROR_UNKNOWN;
653  }
654  }
655  duration_cleanup(duration);
656  duration = NULL;
657  }
658  else if (!strcmp((char*)node2->name, "RetireSafety")) {
659  if (!(xml_text = xmlNodeGetContent(node2))) {
660  return DB_ERROR_UNKNOWN;
661  }
662  ods_log_deeebug("[policy_*_from_xml] keys retire safety %s", (char*)xml_text);
663  if (!(duration = duration_create_from_string((char*)xml_text))) {
664  if (xml_text) {
665  xmlFree(xml_text);
666  }
667  return DB_ERROR_UNKNOWN;
668  }
669  if (xml_text) {
670  xmlFree(xml_text);
671  xml_text = NULL;
672  }
673  if (check_if_updated) {
674  update_this = 0;
675  if (policy_keys_retire_safety(policy) != duration2time(duration)) {
676  *updated = 1;
677  update_this = 1;
678  }
679  }
680  if (update_this) {
681  if (policy_set_keys_retire_safety(policy, duration2time(duration))) {
682  duration_cleanup(duration);
683  return DB_ERROR_UNKNOWN;
684  }
685  }
686  duration_cleanup(duration);
687  duration = NULL;
688  }
689  else if (!strcmp((char*)node2->name, "PublishSafety")) {
690  if (!(xml_text = xmlNodeGetContent(node2))) {
691  return DB_ERROR_UNKNOWN;
692  }
693  ods_log_deeebug("[policy_*_from_xml] keys publish safety %s", (char*)xml_text);
694  if (!(duration = duration_create_from_string((char*)xml_text))) {
695  if (xml_text) {
696  xmlFree(xml_text);
697  }
698  return DB_ERROR_UNKNOWN;
699  }
700  if (xml_text) {
701  xmlFree(xml_text);
702  xml_text = NULL;
703  }
704  if (check_if_updated) {
705  update_this = 0;
706  if (policy_keys_publish_safety(policy) != duration2time(duration)) {
707  *updated = 1;
708  update_this = 1;
709  }
710  }
711  if (update_this) {
712  if (policy_set_keys_publish_safety(policy, duration2time(duration))) {
713  duration_cleanup(duration);
714  return DB_ERROR_UNKNOWN;
715  }
716  }
717  duration_cleanup(duration);
718  duration = NULL;
719  }
720  else if (!strcmp((char*)node2->name, "ShareKeys")) {
721  keys_shared = 1;
722  ods_log_deeebug("[policy_*_from_xml] keys shared keys");
723  if (check_if_updated) {
724  update_this = 0;
725  if (!policy_keys_shared(policy)) {
726  *updated = 1;
727  update_this = 1;
728  }
729  }
730  if (update_this) {
731  if (policy_set_keys_shared(policy, 1)) {
732  return DB_ERROR_UNKNOWN;
733  }
734  }
735  }
736  else if (!strcmp((char*)node2->name, "Purge")) {
737  keys_purge = 1;
738  if (!(xml_text = xmlNodeGetContent(node2))) {
739  return DB_ERROR_UNKNOWN;
740  }
741  ods_log_deeebug("[policy_*_from_xml] keys purge %s", (char*)xml_text);
742  if (!(duration = duration_create_from_string((char*)xml_text))) {
743  if (xml_text) {
744  xmlFree(xml_text);
745  }
746  return DB_ERROR_UNKNOWN;
747  }
748  if (xml_text) {
749  xmlFree(xml_text);
750  xml_text = NULL;
751  }
752  if (check_if_updated) {
753  update_this = 0;
754  if (policy_keys_purge_after(policy) != duration2time(duration)) {
755  *updated = 1;
756  update_this = 1;
757  }
758  }
759  if (update_this) {
760  if (policy_set_keys_purge_after(policy, duration2time(duration))) {
761  duration_cleanup(duration);
762  return DB_ERROR_UNKNOWN;
763  }
764  }
765  duration_cleanup(duration);
766  duration = NULL;
767  }
768  else if (!strcmp((char*)node2->name, "KSK")) {
769  continue;
770  }
771  else if (!strcmp((char*)node2->name, "ZSK")) {
772  continue;
773  }
774  else if (!strcmp((char*)node2->name, "CSK")) {
775  continue;
776  }
777  else {
778  ods_log_deeebug("[policy_*_from_xml] unknown %s", (char*)node2->name);
779  return DB_ERROR_UNKNOWN;
780  }
781  }
782  }
783  else if (!strcmp((char*)node->name, "Zone")) {
784  for (node2 = node->children; node2; node2 = node2->next) {
785  if (node2->type != XML_ELEMENT_NODE) {
786  continue;
787  }
788 
789  if (!strcmp((char*)node2->name, "PropagationDelay")) {
790  if (!(xml_text = xmlNodeGetContent(node2))) {
791  return DB_ERROR_UNKNOWN;
792  }
793  ods_log_deeebug("[policy_*_from_xml] zone propagation delay %s", (char*)xml_text);
794  if (!(duration = duration_create_from_string((char*)xml_text))) {
795  if (xml_text) {
796  xmlFree(xml_text);
797  }
798  return DB_ERROR_UNKNOWN;
799  }
800  if (xml_text) {
801  xmlFree(xml_text);
802  xml_text = NULL;
803  }
804  if (check_if_updated) {
805  update_this = 0;
806  if (policy_zone_propagation_delay(policy) != duration2time(duration)) {
807  *updated = 1;
808  update_this = 1;
809  }
810  }
811  if (update_this) {
812  if (policy_set_zone_propagation_delay(policy, duration2time(duration))) {
813  duration_cleanup(duration);
814  return DB_ERROR_UNKNOWN;
815  }
816  }
817  duration_cleanup(duration);
818  duration = NULL;
819  }
820  else if (!strcmp((char*)node2->name, "SOA")) {
821  for (node3 = node2->children; node3; node3 = node3->next) {
822  if (node3->type != XML_ELEMENT_NODE) {
823  continue;
824  }
825 
826  if (!strcmp((char*)node3->name, "TTL")) {
827  if (!(xml_text = xmlNodeGetContent(node3))) {
828  return DB_ERROR_UNKNOWN;
829  }
830  ods_log_deeebug("[policy_*_from_xml] zone soa ttl %s", (char*)xml_text);
831  if (!(duration = duration_create_from_string((char*)xml_text))) {
832  if (xml_text) {
833  xmlFree(xml_text);
834  }
835  return DB_ERROR_UNKNOWN;
836  }
837  if (xml_text) {
838  xmlFree(xml_text);
839  xml_text = NULL;
840  }
841  if (check_if_updated) {
842  update_this = 0;
843  if (policy_zone_soa_ttl(policy) != duration2time(duration)) {
844  *updated = 1;
845  update_this = 1;
846  }
847  }
848  if (update_this) {
849  if (policy_set_zone_soa_ttl(policy, duration2time(duration))) {
850  duration_cleanup(duration);
851  return DB_ERROR_UNKNOWN;
852  }
853  }
854  duration_cleanup(duration);
855  duration = NULL;
856  }
857  else if (!strcmp((char*)node3->name, "Minimum")) {
858  if (!(xml_text = xmlNodeGetContent(node3))) {
859  return DB_ERROR_UNKNOWN;
860  }
861  ods_log_deeebug("[policy_*_from_xml] zone soa minimum %s", (char*)xml_text);
862  if (!(duration = duration_create_from_string((char*)xml_text))) {
863  if (xml_text) {
864  xmlFree(xml_text);
865  }
866  return DB_ERROR_UNKNOWN;
867  }
868  if (xml_text) {
869  xmlFree(xml_text);
870  xml_text = NULL;
871  }
872  if (check_if_updated) {
873  update_this = 0;
874  if (policy_zone_soa_minimum(policy) != duration2time(duration)) {
875  *updated = 1;
876  update_this = 1;
877  }
878  }
879  if (update_this) {
880  if (policy_set_zone_soa_minimum(policy, duration2time(duration))) {
881  duration_cleanup(duration);
882  return DB_ERROR_UNKNOWN;
883  }
884  }
885  duration_cleanup(duration);
886  duration = NULL;
887  }
888  else if (!strcmp((char*)node3->name, "Serial")) {
889  if (!(xml_text = xmlNodeGetContent(node3))) {
890  return DB_ERROR_UNKNOWN;
891  }
892  ods_log_deeebug("[policy_*_from_xml] zone soa serial %s", (char*)xml_text);
893  if (check_if_updated) {
894  update_this = 0;
895  if (strcmp(policy_zone_soa_serial_text(policy), (char*)xml_text)) {
896  *updated = 1;
897  update_this = 1;
898  }
899  }
900  if (update_this) {
901  if (policy_set_zone_soa_serial_text(policy, (char*)xml_text)) {
902  if (xml_text) {
903  xmlFree(xml_text);
904  }
905  return DB_ERROR_UNKNOWN;
906  }
907  }
908  if (xml_text) {
909  xmlFree(xml_text);
910  xml_text = NULL;
911  }
912  }
913  else {
914  ods_log_deeebug("[policy_*_from_xml] unknown %s", (char*)node3->name);
915  return DB_ERROR_UNKNOWN;
916  }
917  }
918  }
919  else {
920  ods_log_deeebug("[policy_*_from_xml] unknown %s", (char*)node2->name);
921  return DB_ERROR_UNKNOWN;
922  }
923  }
924  }
925  else if (!strcmp((char*)node->name, "Parent")) {
926  for (node2 = node->children; node2; node2 = node2->next) {
927  if (node2->type != XML_ELEMENT_NODE) {
928  continue;
929  }
930 
931  if (!strcmp((char*)node2->name, "RegistrationDelay")) {
932  if (!(xml_text = xmlNodeGetContent(node2))) {
933  return DB_ERROR_UNKNOWN;
934  }
935  ods_log_deeebug("[policy_*_from_xml] parent registration delay %s", (char*)xml_text);
936  if (!(duration = duration_create_from_string((char*)xml_text))) {
937  if (xml_text) {
938  xmlFree(xml_text);
939  }
940  return DB_ERROR_UNKNOWN;
941  }
942  if (xml_text) {
943  xmlFree(xml_text);
944  xml_text = NULL;
945  }
946  if (check_if_updated) {
947  update_this = 0;
948  if (policy_parent_registration_delay(policy) != duration2time(duration)) {
949  *updated = 1;
950  update_this = 1;
951  }
952  }
953  if (update_this) {
954  if (policy_set_parent_registration_delay(policy, duration2time(duration))) {
955  duration_cleanup(duration);
956  return DB_ERROR_UNKNOWN;
957  }
958  }
959  duration_cleanup(duration);
960  duration = NULL;
961  }
962  else if (!strcmp((char*)node2->name, "PropagationDelay")) {
963  if (!(xml_text = xmlNodeGetContent(node2))) {
964  return DB_ERROR_UNKNOWN;
965  }
966  ods_log_deeebug("[policy_*_from_xml] parent propagation delay %s", (char*)xml_text);
967  if (!(duration = duration_create_from_string((char*)xml_text))) {
968  if (xml_text) {
969  xmlFree(xml_text);
970  }
971  return DB_ERROR_UNKNOWN;
972  }
973  if (xml_text) {
974  xmlFree(xml_text);
975  xml_text = NULL;
976  }
977  if (check_if_updated) {
978  update_this = 0;
979  if (policy_parent_propagation_delay(policy) != duration2time(duration)) {
980  *updated = 1;
981  update_this = 1;
982  }
983  }
984  if (update_this) {
985  if (policy_set_parent_propagation_delay(policy, duration2time(duration))) {
986  duration_cleanup(duration);
987  return DB_ERROR_UNKNOWN;
988  }
989  }
990  duration_cleanup(duration);
991  duration = NULL;
992  }
993  else if (!strcmp((char*)node2->name, "SOA")) {
994  for (node3 = node2->children; node3; node3 = node3->next) {
995  if (node3->type != XML_ELEMENT_NODE) {
996  continue;
997  }
998 
999  if (!strcmp((char*)node3->name, "TTL")) {
1000  if (!(xml_text = xmlNodeGetContent(node3))) {
1001  return DB_ERROR_UNKNOWN;
1002  }
1003  ods_log_deeebug("[policy_*_from_xml] parent soa ttl %s", (char*)xml_text);
1004  if (!(duration = duration_create_from_string((char*)xml_text))) {
1005  if (xml_text) {
1006  xmlFree(xml_text);
1007  }
1008  return DB_ERROR_UNKNOWN;
1009  }
1010  if (xml_text) {
1011  xmlFree(xml_text);
1012  xml_text = NULL;
1013  }
1014  if (check_if_updated) {
1015  update_this = 0;
1016  if (policy_parent_soa_ttl(policy) != duration2time(duration)) {
1017  *updated = 1;
1018  update_this = 1;
1019  }
1020  }
1021  if (update_this) {
1022  if (policy_set_parent_soa_ttl(policy, duration2time(duration))) {
1023  duration_cleanup(duration);
1024  return DB_ERROR_UNKNOWN;
1025  }
1026  }
1027  duration_cleanup(duration);
1028  duration = NULL;
1029  }
1030  else if (!strcmp((char*)node3->name, "Minimum")) {
1031  if (!(xml_text = xmlNodeGetContent(node3))) {
1032  return DB_ERROR_UNKNOWN;
1033  }
1034  ods_log_deeebug("[policy_*_from_xml] parent soa minimum %s", (char*)xml_text);
1035  if (!(duration = duration_create_from_string((char*)xml_text))) {
1036  if (xml_text) {
1037  xmlFree(xml_text);
1038  }
1039  return DB_ERROR_UNKNOWN;
1040  }
1041  if (xml_text) {
1042  xmlFree(xml_text);
1043  xml_text = NULL;
1044  }
1045  if (check_if_updated) {
1046  update_this = 0;
1047  if (policy_parent_soa_minimum(policy) != duration2time(duration)) {
1048  *updated = 1;
1049  update_this = 1;
1050  }
1051  }
1052  if (update_this) {
1053  if (policy_set_parent_soa_minimum(policy, duration2time(duration))) {
1054  duration_cleanup(duration);
1055  return DB_ERROR_UNKNOWN;
1056  }
1057  }
1058  duration_cleanup(duration);
1059  duration = NULL;
1060  }
1061  else {
1062  ods_log_deeebug("[policy_*_from_xml] unknown %s", (char*)node3->name);
1063  return DB_ERROR_UNKNOWN;
1064  }
1065  }
1066  }
1067  else if (!strcmp((char*)node2->name, "DS")) {
1068  for (node3 = node2->children; node3; node3 = node3->next) {
1069  if (node3->type != XML_ELEMENT_NODE) {
1070  continue;
1071  }
1072 
1073  if (!strcmp((char*)node3->name, "TTL")) {
1074  if (!(xml_text = xmlNodeGetContent(node3))) {
1075  return DB_ERROR_UNKNOWN;
1076  }
1077  ods_log_deeebug("[policy_*_from_xml] parent ds ttl %s", (char*)xml_text);
1078  if (!(duration = duration_create_from_string((char*)xml_text))) {
1079  if (xml_text) {
1080  xmlFree(xml_text);
1081  }
1082  return DB_ERROR_UNKNOWN;
1083  }
1084  if (xml_text) {
1085  xmlFree(xml_text);
1086  xml_text = NULL;
1087  }
1088  if (check_if_updated) {
1089  update_this = 0;
1090  if (policy_parent_ds_ttl(policy) != duration2time(duration)) {
1091  *updated = 1;
1092  update_this = 1;
1093  }
1094  }
1095  if (update_this) {
1096  if (policy_set_parent_ds_ttl(policy, duration2time(duration))) {
1097  duration_cleanup(duration);
1098  return DB_ERROR_UNKNOWN;
1099  }
1100  }
1101  duration_cleanup(duration);
1102  duration = NULL;
1103  }
1104  else {
1105  ods_log_deeebug("[policy_*_from_xml] unknown %s", (char*)node3->name);
1106  return DB_ERROR_UNKNOWN;
1107  }
1108  }
1109  }
1110  else {
1111  ods_log_deeebug("[policy_*_from_xml] unknown %s", (char*)node2->name);
1112  return DB_ERROR_UNKNOWN;
1113  }
1114  }
1115  }
1116  else {
1117  ods_log_deeebug("[policy_*_from_xml] unknown %s", (char*)node->name);
1118  return DB_ERROR_UNKNOWN;
1119  }
1120  }
1121 
1122  if (xml_text) {
1123  xmlFree(xml_text);
1124  xml_text = NULL;
1125  }
1126  duration_cleanup(duration);
1127  duration = NULL;
1128 
1129  /*
1130  * If we did not find these XML elements we need to disable them
1131  */
1132  if (!denial_optout) {
1133  ods_log_deeebug("[policy_*_from_xml] - denial optout");
1134  if (check_if_updated) {
1135  update_this = 0;
1137  *updated = 1;
1138  update_this = 1;
1139  }
1140  }
1141  if (update_this) {
1142  if (policy_set_denial_optout(policy, 0)) {
1143  return DB_ERROR_UNKNOWN;
1144  }
1145  }
1146  }
1147  if (!keys_shared) {
1148  ods_log_deeebug("[policy_*_from_xml] - keys shared keys");
1149  if (check_if_updated) {
1150  update_this = 0;
1151  if (policy_keys_shared(policy)) {
1152  *updated = 1;
1153  update_this = 1;
1154  }
1155  }
1156  if (update_this) {
1157  if (policy_set_keys_shared(policy, 0)) {
1158  return DB_ERROR_UNKNOWN;
1159  }
1160  }
1161  }
1162  if (!signatures_max_zone_ttl) {
1163  ods_log_deeebug("[policy_*_from_xml] - signatures max zone ttl");
1164 
1165  if (policy_signatures_max_zone_ttl(policy) != 86400)
1166  {
1168  return DB_ERROR_UNKNOWN;
1169  }
1170  if (check_if_updated) *updated = 1;
1171  }
1172  }
1173  if (!keys_purge) {
1174  ods_log_deeebug("[policy_*_from_xml] - keys purge");
1175  if (check_if_updated) {
1176  update_this = 0;
1178  *updated = 1;
1179  update_this = 1;
1180  }
1181  }
1182  if (update_this) {
1184  return DB_ERROR_UNKNOWN;
1185  }
1186  }
1187  }
1188  if (!denial_ttl) {
1189  ods_log_deeebug("[policy_*_from_xml] - denial ttl");
1190  update_this = 0;
1191  if (policy_denial_ttl(policy)) {
1192  /* it was not mentioned in kasp. set it to 0 */
1193  update_this = 1;
1194  }
1195  if (update_this) {
1196  if (policy_set_denial_ttl(policy, 0)) {
1197  return DB_ERROR_UNKNOWN;
1198  }
1199  if (check_if_updated) *updated = 1;
1200  }
1201  }
1202  /* Check if passtrough has toggled */
1203  if (passthrough != policy_passthrough(policy)) {
1204  ods_log_deeebug("[policy_*_from_xml] - passthrough set to %d",
1205  passthrough);
1206  if (check_if_updated)
1207  *updated = 1;
1208  if (policy_set_passthrough(policy, passthrough)) {
1209  return DB_ERROR_UNKNOWN;
1210  }
1211  }
1212 
1213  return DB_OK;
1214 }
1215 
1216 int policy_create_from_xml(policy_t* policy, xmlNodePtr policy_node) {
1217  if (!policy) {
1218  return DB_ERROR_UNKNOWN;
1219  }
1220  if (!policy_node) {
1221  return DB_ERROR_UNKNOWN;
1222  }
1223 
1224  return __xmlNode2policy(policy, policy_node, NULL);
1225 }
1226 
1227 int policy_update_from_xml(policy_t* policy, xmlNodePtr policy_node, int* updated) {
1228  if (!policy) {
1229  return DB_ERROR_UNKNOWN;
1230  }
1231  if (!policy_node) {
1232  return DB_ERROR_UNKNOWN;
1233  }
1234  if (!updated) {
1235  return DB_ERROR_UNKNOWN;
1236  }
1237 
1238  return __xmlNode2policy(policy, policy_node, updated);
1239 }
1240 
1242  if (!policy) {
1243  return NULL;
1244  }
1245  if (!policy->dbo) {
1246  return NULL;
1247  }
1248  if (db_value_not_empty(&(policy->id))) {
1249  return NULL;
1250  }
1251 
1253  &(policy->id));
1254 }
#define DB_ERROR_UNKNOWN
Definition: db_error.h:40
#define DB_OK
Definition: db_error.h:36
const db_connection_t * db_object_connection(const db_object_t *object)
Definition: db_object.c:320
int db_value_not_empty(const db_value_t *value)
Definition: db_value.c:347
const char * policy_name(const policy_t *policy)
Definition: policy.c:813
unsigned int policy_denial_salt_length(const policy_t *policy)
Definition: policy.c:941
int policy_set_name(policy_t *policy, const char *name_text)
Definition: policy.c:1142
unsigned int policy_zone_propagation_delay(const policy_t *policy)
Definition: policy.c:1005
unsigned int policy_denial_iterations(const policy_t *policy)
Definition: policy.c:933
int policy_set_parent_ds_ttl(policy_t *policy, unsigned int parent_ds_ttl)
Definition: policy.c:1500
int policy_set_denial_type(policy_t *policy, policy_denial_type_t denial_type)
Definition: policy.c:1266
int policy_set_denial_ttl(policy_t *policy, unsigned int denial_ttl)
Definition: policy.c:1289
unsigned int policy_denial_optout(const policy_t *policy)
Definition: policy.c:901
unsigned int policy_parent_soa_minimum(const policy_t *policy)
Definition: policy.c:1077
int policy_set_signatures_resign(policy_t *policy, unsigned int signatures_resign)
Definition: policy.c:1186
unsigned int policy_signatures_validity_denial(const policy_t *policy)
Definition: policy.c:869
unsigned int policy_keys_purge_after(const policy_t *policy)
Definition: policy.c:997
int policy_set_denial_iterations(policy_t *policy, unsigned int denial_iterations)
Definition: policy.c:1323
unsigned int policy_parent_ds_ttl(const policy_t *policy)
Definition: policy.c:1061
unsigned int policy_signatures_resign(const policy_t *policy)
Definition: policy.c:829
int policy_set_parent_soa_minimum(policy_t *policy, unsigned int parent_soa_minimum)
Definition: policy.c:1520
int policy_set_signatures_inception_offset(policy_t *policy, unsigned int signatures_inception_offset)
Definition: policy.c:1216
int policy_set_zone_propagation_delay(policy_t *policy, unsigned int zone_propagation_delay)
Definition: policy.c:1433
unsigned int policy_keys_ttl(const policy_t *policy)
Definition: policy.c:965
unsigned int policy_parent_propagation_delay(const policy_t *policy)
Definition: policy.c:1053
int policy_set_keys_purge_after(policy_t *policy, unsigned int keys_purge_after)
Definition: policy.c:1423
unsigned int policy_zone_soa_ttl(const policy_t *policy)
Definition: policy.c:1013
unsigned int policy_zone_soa_minimum(const policy_t *policy)
Definition: policy.c:1021
unsigned int policy_passthrough(const policy_t *policy)
Definition: policy.c:1085
unsigned int policy_signatures_refresh(const policy_t *policy)
Definition: policy.c:837
unsigned int policy_denial_ttl(const policy_t *policy)
Definition: policy.c:909
unsigned int policy_signatures_max_zone_ttl(const policy_t *policy)
Definition: policy.c:885
int policy_set_parent_soa_ttl(policy_t *policy, unsigned int parent_soa_ttl)
Definition: policy.c:1510
int policy_set_denial_resalt(policy_t *policy, unsigned int denial_resalt)
Definition: policy.c:1299
unsigned int policy_keys_shared(const policy_t *policy)
Definition: policy.c:989
int policy_set_denial_algorithm(policy_t *policy, unsigned int denial_algorithm)
Definition: policy.c:1309
int policy_set_parent_registration_delay(policy_t *policy, unsigned int parent_registration_delay)
Definition: policy.c:1480
int policy_set_zone_soa_serial_text(policy_t *policy, const char *zone_soa_serial)
Definition: policy.c:1463
unsigned int policy_signatures_jitter(const policy_t *policy)
Definition: policy.c:845
unsigned int policy_parent_registration_delay(const policy_t *policy)
Definition: policy.c:1045
const char * policy_description(const policy_t *policy)
Definition: policy.c:821
int policy_set_parent_propagation_delay(policy_t *policy, unsigned int parent_propagation_delay)
Definition: policy.c:1490
int policy_set_denial_optout(policy_t *policy, unsigned int denial_optout)
Definition: policy.c:1279
unsigned int policy_signatures_inception_offset(const policy_t *policy)
Definition: policy.c:853
int policy_set_signatures_max_zone_ttl(policy_t *policy, unsigned int signatures_max_zone_ttl)
Definition: policy.c:1256
int policy_set_signatures_jitter(policy_t *policy, unsigned int signatures_jitter)
Definition: policy.c:1206
int policy_set_description(policy_t *policy, const char *description_text)
Definition: policy.c:1164
int policy_set_keys_shared(policy_t *policy, unsigned int keys_shared)
Definition: policy.c:1413
unsigned int policy_parent_soa_ttl(const policy_t *policy)
Definition: policy.c:1069
int policy_set_denial_salt_length(policy_t *policy, unsigned int denial_salt_length)
Definition: policy.c:1337
int policy_set_signatures_validity_keyset(policy_t *policy, unsigned int signatures_validity_keyset)
Definition: policy.c:1246
int policy_set_signatures_validity_default(policy_t *policy, unsigned int signatures_validity_default)
Definition: policy.c:1226
unsigned int policy_denial_algorithm(const policy_t *policy)
Definition: policy.c:925
unsigned int policy_signatures_validity_default(const policy_t *policy)
Definition: policy.c:861
int policy_set_signatures_refresh(policy_t *policy, unsigned int signatures_refresh)
Definition: policy.c:1196
int policy_set_keys_ttl(policy_t *policy, unsigned int keys_ttl)
Definition: policy.c:1383
const char * policy_zone_soa_serial_text(const policy_t *policy)
Definition: policy.c:1029
int policy_set_signatures_validity_denial(policy_t *policy, unsigned int signatures_validity_denial)
Definition: policy.c:1236
int policy_set_passthrough(policy_t *policy, unsigned int passthrough)
Definition: policy.c:1530
unsigned int policy_denial_resalt(const policy_t *policy)
Definition: policy.c:917
unsigned int policy_keys_publish_safety(const policy_t *policy)
Definition: policy.c:981
int policy_set_zone_soa_minimum(policy_t *policy, unsigned int zone_soa_minimum)
Definition: policy.c:1453
int policy_set_keys_publish_safety(policy_t *policy, unsigned int keys_publish_safety)
Definition: policy.c:1403
unsigned int policy_keys_retire_safety(const policy_t *policy)
Definition: policy.c:973
int policy_set_keys_retire_safety(policy_t *policy, unsigned int keys_retire_safety)
Definition: policy.c:1393
unsigned int policy_signatures_validity_keyset(const policy_t *policy)
Definition: policy.c:877
int policy_set_zone_soa_ttl(policy_t *policy, unsigned int zone_soa_ttl)
Definition: policy.c:1443
policy_denial_type
Definition: policy.h:40
@ POLICY_DENIAL_TYPE_NSEC
Definition: policy.h:42
@ POLICY_DENIAL_TYPE_NSEC3
Definition: policy.h:43
policy_key_list_t * policy_get_policy_keys(const policy_t *policy)
Definition: policy_ext.c:1241
int policy_update_from_xml(policy_t *policy, xmlNodePtr policy_node, int *updated)
Definition: policy_ext.c:1227
int policy_create_from_xml(policy_t *policy, xmlNodePtr policy_node)
Definition: policy_ext.c:1216
policy_key_list_t * policy_key_list_new_get_by_policy_id(const db_connection_t *connection, const db_value_t *policy_id)
Definition: policy_key.c:1299
Definition: policy.h:60
db_value_t id
Definition: policy.h:62
db_object_t * dbo
Definition: policy.h:61