116 sql =
DqsSpecifyInit(
"policies p, parameters_policies x, parameters y, categories c ",
"y.name, c.name, x.value");
206 else if (status == -1) {}
237 if (policy == NULL) {
253 while (status == 0) {
254 if (strncmp(data.
category,
"enforcer", 8) == 0) {
259 if (strncmp(data.
category,
"zone", 4) == 0) {
269 if (strncmp(data.
category,
"parent", 6) == 0) {
274 if (strncmp(data.
name,
"ttlds", 5) == 0) {
277 else if (strncmp(data.
name,
"ttl", 3) == 0) {
281 if (strncmp(data.
category,
"signature", 9) == 0) {
289 if (strncmp(data.
category,
"denial", 6) == 0) {
298 if (strncmp(data.
category,
"zsk", 3) == 0) {
301 if (strncmp(data.
name,
"repository",10) == 0) policy->
zsk->
sm=data.
value;
307 if (strncmp(data.
category,
"ksk", 3) == 0) {
310 if (strncmp(data.
name,
"repository",10) == 0) policy->
ksk->
sm=data.
value;
318 if (strncmp(data.
category,
"keys", 4) == 0) {
394 else if (status == -1) {}
440 if (policy == NULL) {
466 else if (status == -1) {}
513 char* hex_chars =
"0123456789abcdef";
516 if (policy == NULL) {
523 if (datetime_now == NULL) {
524 printf(
"Couldn't turn \"now\" into a date, quitting...\n");
561 else if (status == -1) {
601 #ifdef HAVE_ARC4RANDOM
603 salt[i] = hex_chars[arc4random()%strlen(hex_chars)];
608 salt[i] = hex_chars[rand()%strlen(hex_chars)];
624 nchar = snprintf(buffer,
sizeof(buffer),
625 "UPDATE policies SET salt = '%s', salt_stamp = '%s' WHERE ID = %lu",
628 nchar = snprintf(buffer,
sizeof(buffer),
629 "UPDATE policies SET salt = '%s', salt_stamp = DATETIME('%s') WHERE ID = %lu",
632 if (nchar <
sizeof(buffer)) {
689 nchar = snprintf(buffer,
sizeof(buffer),
690 "UPDATE policies SET salt_stamp = NULL WHERE ID = %lu",
691 (
unsigned long) policy_id);
693 if (nchar <
sizeof(buffer)) {
721 if (policy == NULL) {
748 else if (status == -1) {}
785 else if (status == -1) {}
817 if (policy == NULL || policy->
name[0] ==
'\0') {
830 else if (status == -1) {
893 DbInt(row, 1, policy_id);
895 else if (status == -1) {}
930 if (policy_id <= 0) {
958 if (policy == NULL) {
978 policy->
keys == NULL ||
979 policy->
ksk == NULL ||
980 policy->
zsk == NULL ||
982 policy->
zone == NULL ||
void DbFreeResult(DB_RESULT result)
int KsmPolicy(DB_RESULT result, KSM_POLICY *data)
char name[KSM_NAME_LENGTH]
int KsmPolicyNameFromId(KSM_POLICY *policy)
int KsmPolicySetIdFromName(KSM_POLICY *policy)
unsigned long sm_capacity
KSM_POLICY * KsmPolicyAlloc()
int DbFetchRow(DB_RESULT result, DB_ROW *row)
#define DB_SECURITY_MODULE_NAME
char category[KSM_NAME_LENGTH]
char * DqsSpecifyInit(const char *table, const char *fields)
#define DB_SECURITY_MODULE_FIELDS
#define DB_SECURITY_MODULE_TABLE
void KsmPolicyFree(KSM_POLICY *policy)
int KsmPolicyUpdateDesc(int policy_id, const char *policy_description)
KSM_COMMON_KEY_POLICY * keys
void DqsConditionKeyword(char **query, const char *field, DQS_COMPARISON compare, const char *value, int index)
int KsmPolicyReadFromId(KSM_POLICY *policy)
void DqsOrderBy(char **query, const char *field)
char sm_name[KSM_NAME_LENGTH]
int MsgLog(int status,...)
#define DB_SECURITY_MODULE_REQUIREBACKUP
void DqsFree(char *query)
int KsmPolicyUpdateSalt(KSM_POLICY *policy)
#define DB_POLICY_PARAMETER_CATEGORY
void DusConditionInt(char **query, const char *field, DQS_COMPARISON compare, int value, int clause)
int KsmPolicyRead(KSM_POLICY *policy)
char salt_stamp[KSM_TIME_LENGTH]
int KsmPolicyParametersInit(DB_RESULT *result, const char *name)
void DqsConditionInt(char **query, const char *field, DQS_COMPARISON compare, int value, int index)
char salt[KSM_SALT_LENGTH]
int DbQuoteString(DB_HANDLE handle, const char *in, char *buffer, size_t buflen)
char * DtParseDateTimeString(const char *string)
KSM_PARENT_POLICY * parent
KSM_DENIAL_POLICY * denial
void StrStrncpy(char *dest, const char *src, size_t destlen)
int KsmPolicyParameter(DB_RESULT result, KSM_POLICY_PARAMETER *data)
const char * DbErrmsg(DB_HANDLE handle)
void DbFreeRow(DB_ROW row)
KSM_SIGNER_POLICY * signer
int DbExecuteSql(DB_HANDLE handle, const char *stmt_str, DB_RESULT *result)
#define KSM_POLICY_DESC_LENGTH
int DbStringBuffer(DB_ROW row, int field_index, char *buffer, size_t buflen)
#define DB_POLICY_PARAMETER_VALUE
int KsmPolicyInit(DB_RESULT *result, const char *name)
int DbUnsignedLong(DB_ROW row, int field_index, unsigned long *value)
char * DusInit(const char *table)
#define DB_SECURITY_MODULE_CAPACITY
void KsmParameterEnd(DB_RESULT result)
char name[KSM_NAME_LENGTH]
#define DB_POLICY_SALT_STAMP
int KsmPolicyIdFromZoneId(int zone_id, int *policy_id)
#define DB_POLICY_DESCRIPTION
KSM_ENFORCER_POLICY * enforcer
int DbInt(DB_ROW row, int field_index, int *value)
int KsmPolicyNullSaltStamp(int policy_id)
int KsmPolicyExists(const char *name)
void DusSetString(char **sql, const char *field, const char *data, int clause)
int DtDateDiff(const char *date1, const char *date2, int *result)
int DbExecuteSqlNoResult(DB_HANDLE handle, const char *stmt_str)
int KsmPolicyPopulateSMFromIds(KSM_POLICY *policy)
void DqsConditionString(char **query, const char *field, DQS_COMPARISON compare, const char *value, int index)
#define DB_POLICY_PARAMETER_NAME
KSM_SIGNATURE_POLICY * signature