• Main Page
  • Data Structures
  • Files
  • File List
  • Globals

/srv/bpo/opendnssec/opendnssec-1.3.2/enforcer/common/kaspaccess.c

Go to the documentation of this file.
00001 /*
00002  * $Id: kaspaccess.c 4141 2010-10-25 15:26:40Z sion $
00003  *
00004  * Copyright (c) 2008-2009 Nominet UK. All rights reserved.
00005  *
00006  * Redistribution and use in source and binary forms, with or without
00007  * modification, are permitted provided that the following conditions
00008  * are met:
00009  * 1. Redistributions of source code must retain the above copyright
00010  *    notice, this list of conditions and the following disclaimer.
00011  * 2. Redistributions in binary form must reproduce the above copyright
00012  *    notice, this list of conditions and the following disclaimer in the
00013  *    documentation and/or other materials provided with the distribution.
00014  *
00015  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
00016  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00017  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00018  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
00019  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00020  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
00021  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00022  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
00023  * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
00024  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
00025  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00026  *
00027  */
00028 
00029 /* 
00030  * kaspaccess.c kasp acccess functions needed by keygend
00031  */
00032 
00033 
00034 #include <syslog.h>
00035 #include <stdlib.h>
00036 
00037 #include "daemon.h"
00038 #include "daemon_util.h"
00039 #include "kaspaccess.h"
00040 #include "ksm/string_util.h"
00041 #include "ksm/string_util2.h"
00042 
00043 /*
00044 * Set defaults for policies
00045 * Make sure that we set everything, any new policy items need to be added here.
00046 */
00047 void
00048 kaspSetPolicyDefaults(KSM_POLICY *policy, char *name)
00049 {
00050     if (policy == NULL) {
00051         log_msg(NULL, LOG_ERR, "Error in kaspSetPolicyDefaults, no policy provided");
00052         return;
00053     }
00054 
00055         if (name) {
00056         snprintf(policy->name, KSM_NAME_LENGTH, "%s", name);
00057     }
00058 
00059         policy->signer->refresh = 0;
00060         policy->signer->jitter = 0;
00061         policy->signer->propdelay = 0;
00062         policy->signer->soamin = 0;
00063         policy->signer->soattl = 0;
00064         policy->signer->serial = 0;
00065 
00066         policy->signature->clockskew = 0;
00067         policy->signature->resign = 0;
00068         policy->signature->valdefault = 0;
00069         policy->signature->valdenial = 0;
00070 
00071         policy->denial->version = 0;
00072         policy->denial->resalt = 0;
00073         policy->denial->algorithm = 0;
00074         policy->denial->iteration = 0;
00075         policy->denial->optout = 0;
00076         policy->denial->ttl = 0;
00077         policy->denial->saltlength = 0;
00078 
00079     policy->keys->ttl = 0;
00080     policy->keys->retire_safety = 0;
00081     policy->keys->publish_safety = 0;
00082     policy->keys->share_keys = 0;
00083     policy->keys->purge = -1;
00084 
00085         policy->ksk->algorithm = 0;
00086         policy->ksk->bits = 0;
00087         policy->ksk->lifetime = 0;
00088         policy->ksk->sm = 0;
00089         policy->ksk->overlap = 0;
00090         policy->ksk->ttl = 0;
00091         policy->ksk->rfc5011 = 0;
00092         policy->ksk->type = KSM_TYPE_KSK;
00093         policy->ksk->standby_keys = 0;
00094     policy->ksk->manual_rollover = 0;
00095     policy->ksk->rollover_scheme = KSM_ROLL_DEFAULT;
00096 
00097         policy->zsk->algorithm = 0;
00098         policy->zsk->bits = 0;
00099         policy->zsk->lifetime = 0;
00100         policy->zsk->sm = 0;
00101         policy->zsk->overlap = 0;
00102         policy->zsk->ttl = 0;
00103         policy->zsk->rfc5011 = 0;
00104         policy->zsk->type = KSM_TYPE_ZSK;
00105         policy->zsk->standby_keys = 0;
00106     policy->zsk->manual_rollover = 0;
00107     policy->zsk->rollover_scheme = 0;
00108 
00109         policy->enforcer->keycreate = 0;
00110         policy->enforcer->backup_interval = 0;
00111         policy->enforcer->keygeninterval = 0;
00112 
00113     policy->zone->propdelay = 0;
00114     policy->zone->soa_ttl = 0;
00115     policy->zone->soa_min = 0;
00116     policy->zone->serial = 0;
00117 
00118     policy->parent->propdelay = 0;
00119     policy->parent->ds_ttl = 0;
00120     policy->parent->soa_ttl = 0;
00121     policy->parent->soa_min = 0;
00122 
00123 }
00124 
00125 /*
00126 * Connect to the DB
00127 */
00128 void
00129 kaspConnect(DAEMONCONFIG* config, DB_HANDLE     *handle)
00130 {
00131     /* Note that all these XML derived strings are unsigned chars */
00132         if (DbConnect(handle, (char *)config->schema, (char *)config->host, (char *)config->password, (char *)config->user, (char *)config->port) != 0) {
00133         unlink(config->pidfile);
00134         exit(-1);
00135     }
00136 
00137 }
00138 
00139 /*
00140 * Disconnect from the DB
00141 */
00142 void
00143 kaspDisconnect(DB_HANDLE*handle)
00144 {
00145     (void) DbDisconnect(*handle); 
00146 }
00147 
00148 /*
00149 * Read a policy
00150 */
00151 int
00152 kaspReadPolicy(KSM_POLICY* policy)
00153 {
00154     /* This fn checks that the policy exists for us */
00155     return KsmPolicyRead(policy);
00156 }

Generated on Mon Oct 31 2011 14:38:30 for OpenDNSSEC-enforcer by  doxygen 1.7.1