diff options
Diffstat (limited to 'lib/keychain.c')
| -rw-r--r-- | lib/keychain.c | 1310 |
1 files changed, 658 insertions, 652 deletions
diff --git a/lib/keychain.c b/lib/keychain.c index 95a2c8e599..aca3b9e2ea 100644 --- a/lib/keychain.c +++ b/lib/keychain.c @@ -25,7 +25,7 @@ Boston, MA 02111-1307, USA. */ #include "linklist.h" #include "keychain.h" -DEFINE_MTYPE_STATIC(LIB, KEY, "Key") +DEFINE_MTYPE_STATIC(LIB, KEY, "Key") DEFINE_MTYPE_STATIC(LIB, KEYCHAIN, "Key chain") DEFINE_QOBJ_TYPE(keychain) @@ -34,210 +34,192 @@ DEFINE_QOBJ_TYPE(key) /* Master list of key chain. */ struct list *keychain_list; -static struct keychain * -keychain_new (void) +static struct keychain *keychain_new(void) { - struct keychain *keychain; - keychain = XCALLOC (MTYPE_KEYCHAIN, sizeof (struct keychain)); - QOBJ_REG (keychain, keychain); - return keychain; + struct keychain *keychain; + keychain = XCALLOC(MTYPE_KEYCHAIN, sizeof(struct keychain)); + QOBJ_REG(keychain, keychain); + return keychain; } -static void -keychain_free (struct keychain *keychain) +static void keychain_free(struct keychain *keychain) { - QOBJ_UNREG (keychain); - XFREE (MTYPE_KEYCHAIN, keychain); + QOBJ_UNREG(keychain); + XFREE(MTYPE_KEYCHAIN, keychain); } -static struct key * -key_new (void) +static struct key *key_new(void) { - struct key *key = XCALLOC (MTYPE_KEY, sizeof (struct key)); - QOBJ_REG (key, key); - return key; + struct key *key = XCALLOC(MTYPE_KEY, sizeof(struct key)); + QOBJ_REG(key, key); + return key; } -static void -key_free (struct key *key) +static void key_free(struct key *key) { - QOBJ_UNREG (key); - XFREE (MTYPE_KEY, key); + QOBJ_UNREG(key); + XFREE(MTYPE_KEY, key); } -struct keychain * -keychain_lookup (const char *name) +struct keychain *keychain_lookup(const char *name) { - struct listnode *node; - struct keychain *keychain; + struct listnode *node; + struct keychain *keychain; - if (name == NULL) - return NULL; + if (name == NULL) + return NULL; - for (ALL_LIST_ELEMENTS_RO (keychain_list, node, keychain)) - { - if (strcmp (keychain->name, name) == 0) - return keychain; - } - return NULL; + for (ALL_LIST_ELEMENTS_RO(keychain_list, node, keychain)) { + if (strcmp(keychain->name, name) == 0) + return keychain; + } + return NULL; } -static int -key_cmp_func (void *arg1, void *arg2) +static int key_cmp_func(void *arg1, void *arg2) { - const struct key *k1 = arg1; - const struct key *k2 = arg2; - - if (k1->index > k2->index) - return 1; - if (k1->index < k2->index) - return -1; - return 0; + const struct key *k1 = arg1; + const struct key *k2 = arg2; + + if (k1->index > k2->index) + return 1; + if (k1->index < k2->index) + return -1; + return 0; } -static void -key_delete_func (struct key *key) +static void key_delete_func(struct key *key) { - if (key->string) - free (key->string); - key_free (key); + if (key->string) + free(key->string); + key_free(key); } -static struct keychain * -keychain_get (const char *name) +static struct keychain *keychain_get(const char *name) { - struct keychain *keychain; + struct keychain *keychain; - keychain = keychain_lookup (name); + keychain = keychain_lookup(name); - if (keychain) - return keychain; + if (keychain) + return keychain; - keychain = keychain_new (); - keychain->name = XSTRDUP(MTYPE_KEYCHAIN, name); - keychain->key = list_new (); - keychain->key->cmp = (int (*)(void *, void *)) key_cmp_func; - keychain->key->del = (void (*)(void *)) key_delete_func; - listnode_add (keychain_list, keychain); + keychain = keychain_new(); + keychain->name = XSTRDUP(MTYPE_KEYCHAIN, name); + keychain->key = list_new(); + keychain->key->cmp = (int (*)(void *, void *))key_cmp_func; + keychain->key->del = (void (*)(void *))key_delete_func; + listnode_add(keychain_list, keychain); - return keychain; + return keychain; } -static void -keychain_delete (struct keychain *keychain) +static void keychain_delete(struct keychain *keychain) { - if (keychain->name) - XFREE(MTYPE_KEYCHAIN, keychain->name); + if (keychain->name) + XFREE(MTYPE_KEYCHAIN, keychain->name); - list_delete (keychain->key); - listnode_delete (keychain_list, keychain); - keychain_free (keychain); + list_delete(keychain->key); + listnode_delete(keychain_list, keychain); + keychain_free(keychain); } -static struct key * -key_lookup (const struct keychain *keychain, u_int32_t index) +static struct key *key_lookup(const struct keychain *keychain, u_int32_t index) { - struct listnode *node; - struct key *key; + struct listnode *node; + struct key *key; - for (ALL_LIST_ELEMENTS_RO (keychain->key, node, key)) - { - if (key->index == index) - return key; - } - return NULL; + for (ALL_LIST_ELEMENTS_RO(keychain->key, node, key)) { + if (key->index == index) + return key; + } + return NULL; } -struct key * -key_lookup_for_accept (const struct keychain *keychain, u_int32_t index) +struct key *key_lookup_for_accept(const struct keychain *keychain, + u_int32_t index) { - struct listnode *node; - struct key *key; - time_t now; - - now = time (NULL); - - for (ALL_LIST_ELEMENTS_RO (keychain->key, node, key)) - { - if (key->index >= index) - { - if (key->accept.start == 0) - return key; - - if (key->accept.start <= now) - if (key->accept.end >= now || key->accept.end == -1) - return key; + struct listnode *node; + struct key *key; + time_t now; + + now = time(NULL); + + for (ALL_LIST_ELEMENTS_RO(keychain->key, node, key)) { + if (key->index >= index) { + if (key->accept.start == 0) + return key; + + if (key->accept.start <= now) + if (key->accept.end >= now + || key->accept.end == -1) + return key; + } } - } - return NULL; + return NULL; } -struct key * -key_match_for_accept (const struct keychain *keychain, const char *auth_str) +struct key *key_match_for_accept(const struct keychain *keychain, + const char *auth_str) { - struct listnode *node; - struct key *key; - time_t now; - - now = time (NULL); - - for (ALL_LIST_ELEMENTS_RO (keychain->key, node, key)) - { - if (key->accept.start == 0 || - (key->accept.start <= now && - (key->accept.end >= now || key->accept.end == -1))) - if (strncmp (key->string, auth_str, 16) == 0) - return key; - } - return NULL; + struct listnode *node; + struct key *key; + time_t now; + + now = time(NULL); + + for (ALL_LIST_ELEMENTS_RO(keychain->key, node, key)) { + if (key->accept.start == 0 + || (key->accept.start <= now + && (key->accept.end >= now || key->accept.end == -1))) + if (strncmp(key->string, auth_str, 16) == 0) + return key; + } + return NULL; } -struct key * -key_lookup_for_send (const struct keychain *keychain) +struct key *key_lookup_for_send(const struct keychain *keychain) { - struct listnode *node; - struct key *key; - time_t now; + struct listnode *node; + struct key *key; + time_t now; - now = time (NULL); + now = time(NULL); - for (ALL_LIST_ELEMENTS_RO (keychain->key, node, key)) - { - if (key->send.start == 0) - return key; + for (ALL_LIST_ELEMENTS_RO(keychain->key, node, key)) { + if (key->send.start == 0) + return key; - if (key->send.start <= now) - if (key->send.end >= now || key->send.end == -1) - return key; - } - return NULL; + if (key->send.start <= now) + if (key->send.end >= now || key->send.end == -1) + return key; + } + return NULL; } -static struct key * -key_get (const struct keychain *keychain, u_int32_t index) +static struct key *key_get(const struct keychain *keychain, u_int32_t index) { - struct key *key; + struct key *key; - key = key_lookup (keychain, index); + key = key_lookup(keychain, index); - if (key) - return key; + if (key) + return key; - key = key_new (); - key->index = index; - listnode_add_sort (keychain->key, key); + key = key_new(); + key->index = index; + listnode_add_sort(keychain->key, key); - return key; + return key; } -static void -key_delete (struct keychain *keychain, struct key *key) +static void key_delete(struct keychain *keychain, struct key *key) { - listnode_delete (keychain->key, key); + listnode_delete(keychain->key, key); - if (key->string) - XFREE(MTYPE_KEY, key->string); - key_free (key); + if (key->string) + XFREE(MTYPE_KEY, key->string); + key_free(key); } DEFUN_NOSH (key_chain, @@ -247,13 +229,13 @@ DEFUN_NOSH (key_chain, "Key-chain management\n" "Key-chain name\n") { - int idx_word = 2; - struct keychain *keychain; + int idx_word = 2; + struct keychain *keychain; - keychain = keychain_get (argv[idx_word]->arg); - VTY_PUSH_CONTEXT (KEYCHAIN_NODE, keychain); + keychain = keychain_get(argv[idx_word]->arg); + VTY_PUSH_CONTEXT(KEYCHAIN_NODE, keychain); - return CMD_SUCCESS; + return CMD_SUCCESS; } DEFUN (no_key_chain, @@ -264,20 +246,20 @@ DEFUN (no_key_chain, "Key-chain management\n" "Key-chain name\n") { - int idx_word = 3; - struct keychain *keychain; + int idx_word = 3; + struct keychain *keychain; - keychain = keychain_lookup (argv[idx_word]->arg); + keychain = keychain_lookup(argv[idx_word]->arg); - if (! keychain) - { - vty_out (vty, "Can't find keychain %s%s", argv[idx_word]->arg, VTY_NEWLINE); - return CMD_WARNING; - } + if (!keychain) { + vty_out(vty, "Can't find keychain %s%s", argv[idx_word]->arg, + VTY_NEWLINE); + return CMD_WARNING; + } - keychain_delete (keychain); + keychain_delete(keychain); - return CMD_SUCCESS; + return CMD_SUCCESS; } DEFUN_NOSH (key, @@ -286,16 +268,16 @@ DEFUN_NOSH (key, "Configure a key\n" "Key identifier number\n") { - int idx_number = 1; - VTY_DECLVAR_CONTEXT (keychain, keychain); - struct key *key; - u_int32_t index; - - VTY_GET_INTEGER ("key identifier", index, argv[idx_number]->arg); - key = key_get (keychain, index); - VTY_PUSH_CONTEXT_SUB (KEYCHAIN_KEY_NODE, key); - - return CMD_SUCCESS; + int idx_number = 1; + VTY_DECLVAR_CONTEXT(keychain, keychain); + struct key *key; + u_int32_t index; + + VTY_GET_INTEGER("key identifier", index, argv[idx_number]->arg); + key = key_get(keychain, index); + VTY_PUSH_CONTEXT_SUB(KEYCHAIN_KEY_NODE, key); + + return CMD_SUCCESS; } DEFUN (no_key, @@ -305,24 +287,23 @@ DEFUN (no_key, "Delete a key\n" "Key identifier number\n") { - int idx_number = 2; - VTY_DECLVAR_CONTEXT (keychain, keychain); - struct key *key; - u_int32_t index; - - VTY_GET_INTEGER ("key identifier", index, argv[idx_number]->arg); - key = key_lookup (keychain, index); - if (! key) - { - vty_out (vty, "Can't find key %d%s", index, VTY_NEWLINE); - return CMD_WARNING; - } - - key_delete (keychain, key); - - vty->node = KEYCHAIN_NODE; - - return CMD_SUCCESS; + int idx_number = 2; + VTY_DECLVAR_CONTEXT(keychain, keychain); + struct key *key; + u_int32_t index; + + VTY_GET_INTEGER("key identifier", index, argv[idx_number]->arg); + key = key_lookup(keychain, index); + if (!key) { + vty_out(vty, "Can't find key %d%s", index, VTY_NEWLINE); + return CMD_WARNING; + } + + key_delete(keychain, key); + + vty->node = KEYCHAIN_NODE; + + return CMD_SUCCESS; } DEFUN (key_string, @@ -331,14 +312,14 @@ DEFUN (key_string, "Set key string\n" "The key\n") { - int idx_line = 1; - VTY_DECLVAR_CONTEXT_SUB (key, key); + int idx_line = 1; + VTY_DECLVAR_CONTEXT_SUB(key, key); - if (key->string) - XFREE(MTYPE_KEY, key->string); - key->string = XSTRDUP(MTYPE_KEY, argv[idx_line]->arg); + if (key->string) + XFREE(MTYPE_KEY, key->string); + key->string = XSTRDUP(MTYPE_KEY, argv[idx_line]->arg); - return CMD_SUCCESS; + return CMD_SUCCESS; } DEFUN (no_key_string, @@ -348,200 +329,182 @@ DEFUN (no_key_string, "Unset key string\n" "The key\n") { - VTY_DECLVAR_CONTEXT_SUB (key, key); + VTY_DECLVAR_CONTEXT_SUB(key, key); - if (key->string) - { - XFREE(MTYPE_KEY, key->string); - key->string = NULL; - } + if (key->string) { + XFREE(MTYPE_KEY, key->string); + key->string = NULL; + } - return CMD_SUCCESS; + return CMD_SUCCESS; } /* Convert HH:MM:SS MON DAY YEAR to time_t value. -1 is returned when given string is malformed. */ -static time_t -key_str2time (const char *time_str, const char *day_str, const char *month_str, - const char *year_str) +static time_t key_str2time(const char *time_str, const char *day_str, + const char *month_str, const char *year_str) { - int i = 0; - char *colon; - struct tm tm; - time_t time; - unsigned int sec, min, hour; - unsigned int day, month, year; - - const char *month_name[] = - { - "January", - "February", - "March", - "April", - "May", - "June", - "July", - "August", - "September", - "October", - "November", - "December", - NULL - }; - -#define _GET_LONG_RANGE(V,STR,MMCOND) \ -{ \ - unsigned long tmpl; \ - char *endptr = NULL; \ - tmpl = strtoul ((STR), &endptr, 10); \ - if (*endptr != '\0' || tmpl == ULONG_MAX) \ - return -1; \ - if (MMCOND) \ - return -1; \ - (V) = tmpl; \ -} -#define GET_LONG_RANGE(V,STR,MIN,MAX) \ - _GET_LONG_RANGE(V,STR,tmpl < (MIN) || tmpl > (MAX)) -#define GET_LONG_RANGE0(V,STR,MAX) \ - _GET_LONG_RANGE(V,STR,tmpl > (MAX)) - - /* Check hour field of time_str. */ - colon = strchr (time_str, ':'); - if (colon == NULL) - return -1; - *colon = '\0'; - - /* Hour must be between 0 and 23. */ - GET_LONG_RANGE0 (hour, time_str, 23); - - /* Check min field of time_str. */ - time_str = colon + 1; - colon = strchr (time_str, ':'); - if (*time_str == '\0' || colon == NULL) - return -1; - *colon = '\0'; - - /* Min must be between 0 and 59. */ - GET_LONG_RANGE0 (min, time_str, 59); - - /* Check sec field of time_str. */ - time_str = colon + 1; - if (*time_str == '\0') - return -1; - - /* Sec must be between 0 and 59. */ - GET_LONG_RANGE0 (sec, time_str, 59); - - /* Check day_str. Day must be <1-31>. */ - GET_LONG_RANGE (day, day_str, 1, 31); - - /* Check month_str. Month must match month_name. */ - month = 0; - if (strlen (month_str) >= 3) - for (i = 0; month_name[i]; i++) - if (strncmp (month_str, month_name[i], strlen (month_str)) == 0) - { - month = i; - break; + int i = 0; + char *colon; + struct tm tm; + time_t time; + unsigned int sec, min, hour; + unsigned int day, month, year; + + const char *month_name[] = { + "January", "February", "March", "April", "May", + "June", "July", "August", "September", "October", + "November", "December", NULL}; + +#define _GET_LONG_RANGE(V, STR, MMCOND) \ + { \ + unsigned long tmpl; \ + char *endptr = NULL; \ + tmpl = strtoul((STR), &endptr, 10); \ + if (*endptr != '\0' || tmpl == ULONG_MAX) \ + return -1; \ + if (MMCOND) \ + return -1; \ + (V) = tmpl; \ } - if (! month_name[i]) - return -1; - - /* Check year_str. Year must be <1993-2035>. */ - GET_LONG_RANGE (year, year_str, 1993, 2035); - - memset (&tm, 0, sizeof (struct tm)); - tm.tm_sec = sec; - tm.tm_min = min; - tm.tm_hour = hour; - tm.tm_mon = month; - tm.tm_mday = day; - tm.tm_year = year - 1900; - - time = mktime (&tm); - - return time; +#define GET_LONG_RANGE(V, STR, MIN, MAX) \ + _GET_LONG_RANGE(V, STR, tmpl<(MIN) || tmpl>(MAX)) +#define GET_LONG_RANGE0(V, STR, MAX) _GET_LONG_RANGE(V, STR, tmpl > (MAX)) + + /* Check hour field of time_str. */ + colon = strchr(time_str, ':'); + if (colon == NULL) + return -1; + *colon = '\0'; + + /* Hour must be between 0 and 23. */ + GET_LONG_RANGE0(hour, time_str, 23); + + /* Check min field of time_str. */ + time_str = colon + 1; + colon = strchr(time_str, ':'); + if (*time_str == '\0' || colon == NULL) + return -1; + *colon = '\0'; + + /* Min must be between 0 and 59. */ + GET_LONG_RANGE0(min, time_str, 59); + + /* Check sec field of time_str. */ + time_str = colon + 1; + if (*time_str == '\0') + return -1; + + /* Sec must be between 0 and 59. */ + GET_LONG_RANGE0(sec, time_str, 59); + + /* Check day_str. Day must be <1-31>. */ + GET_LONG_RANGE(day, day_str, 1, 31); + + /* Check month_str. Month must match month_name. */ + month = 0; + if (strlen(month_str) >= 3) + for (i = 0; month_name[i]; i++) + if (strncmp(month_str, month_name[i], strlen(month_str)) + == 0) { + month = i; + break; + } + if (!month_name[i]) + return -1; + + /* Check year_str. Year must be <1993-2035>. */ + GET_LONG_RANGE(year, year_str, 1993, 2035); + + memset(&tm, 0, sizeof(struct tm)); + tm.tm_sec = sec; + tm.tm_min = min; + tm.tm_hour = hour; + tm.tm_mon = month; + tm.tm_mday = day; + tm.tm_year = year - 1900; + + time = mktime(&tm); + + return time; #undef GET_LONG_RANGE } -static int -key_lifetime_set (struct vty *vty, struct key_range *krange, - const char *stime_str, const char *sday_str, - const char *smonth_str, const char *syear_str, - const char *etime_str, const char *eday_str, - const char *emonth_str, const char *eyear_str) +static int key_lifetime_set(struct vty *vty, struct key_range *krange, + const char *stime_str, const char *sday_str, + const char *smonth_str, const char *syear_str, + const char *etime_str, const char *eday_str, + const char *emonth_str, const char *eyear_str) { - time_t time_start; - time_t time_end; - - time_start = key_str2time (stime_str, sday_str, smonth_str, syear_str); - if (time_start < 0) - { - vty_out (vty, "Malformed time value%s", VTY_NEWLINE); - return CMD_WARNING; - } - time_end = key_str2time (etime_str, eday_str, emonth_str, eyear_str); - - if (time_end < 0) - { - vty_out (vty, "Malformed time value%s", VTY_NEWLINE); - return CMD_WARNING; - } - - if (time_end <= time_start) - { - vty_out (vty, "Expire time is not later than start time%s", VTY_NEWLINE); - return CMD_WARNING; - } - - krange->start = time_start; - krange->end = time_end; - - return CMD_SUCCESS; + time_t time_start; + time_t time_end; + + time_start = key_str2time(stime_str, sday_str, smonth_str, syear_str); + if (time_start < 0) { + vty_out(vty, "Malformed time value%s", VTY_NEWLINE); + return CMD_WARNING; + } + time_end = key_str2time(etime_str, eday_str, emonth_str, eyear_str); + + if (time_end < 0) { + vty_out(vty, "Malformed time value%s", VTY_NEWLINE); + return CMD_WARNING; + } + + if (time_end <= time_start) { + vty_out(vty, "Expire time is not later than start time%s", + VTY_NEWLINE); + return CMD_WARNING; + } + + krange->start = time_start; + krange->end = time_end; + + return CMD_SUCCESS; } -static int -key_lifetime_duration_set (struct vty *vty, struct key_range *krange, - const char *stime_str, const char *sday_str, - const char *smonth_str, const char *syear_str, - const char *duration_str) +static int key_lifetime_duration_set(struct vty *vty, struct key_range *krange, + const char *stime_str, + const char *sday_str, + const char *smonth_str, + const char *syear_str, + const char *duration_str) { - time_t time_start; - u_int32_t duration; - - time_start = key_str2time (stime_str, sday_str, smonth_str, syear_str); - if (time_start < 0) - { - vty_out (vty, "Malformed time value%s", VTY_NEWLINE); - return CMD_WARNING; - } - krange->start = time_start; - - VTY_GET_INTEGER ("duration", duration, duration_str); - krange->duration = 1; - krange->end = time_start + duration; - - return CMD_SUCCESS; + time_t time_start; + u_int32_t duration; + + time_start = key_str2time(stime_str, sday_str, smonth_str, syear_str); + if (time_start < 0) { + vty_out(vty, "Malformed time value%s", VTY_NEWLINE); + return CMD_WARNING; + } + krange->start = time_start; + + VTY_GET_INTEGER("duration", duration, duration_str); + krange->duration = 1; + krange->end = time_start + duration; + + return CMD_SUCCESS; } -static int -key_lifetime_infinite_set (struct vty *vty, struct key_range *krange, - const char *stime_str, const char *sday_str, - const char *smonth_str, const char *syear_str) +static int key_lifetime_infinite_set(struct vty *vty, struct key_range *krange, + const char *stime_str, + const char *sday_str, + const char *smonth_str, + const char *syear_str) { - time_t time_start; - - time_start = key_str2time (stime_str, sday_str, smonth_str, syear_str); - if (time_start < 0) - { - vty_out (vty, "Malformed time value%s", VTY_NEWLINE); - return CMD_WARNING; - } - krange->start = time_start; - - krange->end = -1; - - return CMD_SUCCESS; + time_t time_start; + + time_start = key_str2time(stime_str, sday_str, smonth_str, syear_str); + if (time_start < 0) { + vty_out(vty, "Malformed time value%s", VTY_NEWLINE); + return CMD_WARNING; + } + krange->start = time_start; + + krange->end = -1; + + return CMD_SUCCESS; } DEFUN (accept_lifetime_day_month_day_month, @@ -557,18 +520,21 @@ DEFUN (accept_lifetime_day_month_day_month, "Month of the year to expire\n" "Year to expire\n") { - int idx_hhmmss = 1; - int idx_number = 2; - int idx_month = 3; - int idx_number_2 = 4; - int idx_hhmmss_2 = 5; - int idx_number_3 = 6; - int idx_month_2 = 7; - int idx_number_4 = 8; - VTY_DECLVAR_CONTEXT_SUB (key, key); - - return key_lifetime_set (vty, &key->accept, argv[idx_hhmmss]->arg, argv[idx_number]->arg, argv[idx_month]->arg, - argv[idx_number_2]->arg, argv[idx_hhmmss_2]->arg, argv[idx_number_3]->arg, argv[idx_month_2]->arg, argv[idx_number_4]->arg); + int idx_hhmmss = 1; + int idx_number = 2; + int idx_month = 3; + int idx_number_2 = 4; + int idx_hhmmss_2 = 5; + int idx_number_3 = 6; + int idx_month_2 = 7; + int idx_number_4 = 8; + VTY_DECLVAR_CONTEXT_SUB(key, key); + + return key_lifetime_set( + vty, &key->accept, argv[idx_hhmmss]->arg, argv[idx_number]->arg, + argv[idx_month]->arg, argv[idx_number_2]->arg, + argv[idx_hhmmss_2]->arg, argv[idx_number_3]->arg, + argv[idx_month_2]->arg, argv[idx_number_4]->arg); } DEFUN (accept_lifetime_day_month_month_day, @@ -584,18 +550,21 @@ DEFUN (accept_lifetime_day_month_month_day, "Day of th month to expire\n" "Year to expire\n") { - int idx_hhmmss = 1; - int idx_number = 2; - int idx_month = 3; - int idx_number_2 = 4; - int idx_hhmmss_2 = 5; - int idx_month_2 = 6; - int idx_number_3 = 7; - int idx_number_4 = 8; - VTY_DECLVAR_CONTEXT_SUB (key, key); - - return key_lifetime_set (vty, &key->accept, argv[idx_hhmmss]->arg, argv[idx_number]->arg, argv[idx_month]->arg, - argv[idx_number_2]->arg, argv[idx_hhmmss_2]->arg, argv[idx_number_3]->arg, argv[idx_month_2]->arg, argv[idx_number_4]->arg); + int idx_hhmmss = 1; + int idx_number = 2; + int idx_month = 3; + int idx_number_2 = 4; + int idx_hhmmss_2 = 5; + int idx_month_2 = 6; + int idx_number_3 = 7; + int idx_number_4 = 8; + VTY_DECLVAR_CONTEXT_SUB(key, key); + + return key_lifetime_set( + vty, &key->accept, argv[idx_hhmmss]->arg, argv[idx_number]->arg, + argv[idx_month]->arg, argv[idx_number_2]->arg, + argv[idx_hhmmss_2]->arg, argv[idx_number_3]->arg, + argv[idx_month_2]->arg, argv[idx_number_4]->arg); } DEFUN (accept_lifetime_month_day_day_month, @@ -611,18 +580,21 @@ DEFUN (accept_lifetime_month_day_day_month, "Month of the year to expire\n" "Year to expire\n") { - int idx_hhmmss = 1; - int idx_month = 2; - int idx_number = 3; - int idx_number_2 = 4; - int idx_hhmmss_2 = 5; - int idx_number_3 = 6; - int idx_month_2 = 7; - int idx_number_4 = 8; - VTY_DECLVAR_CONTEXT_SUB (key, key); - - return key_lifetime_set (vty, &key->accept, argv[idx_hhmmss]->arg, argv[idx_number]->arg, argv[idx_month]->arg, - argv[idx_number_2]->arg, argv[idx_hhmmss_2]->arg, argv[idx_number_3]->arg, argv[idx_month_2]->arg, argv[idx_number_4]->arg); + int idx_hhmmss = 1; + int idx_month = 2; + int idx_number = 3; + int idx_number_2 = 4; + int idx_hhmmss_2 = 5; + int idx_number_3 = 6; + int idx_month_2 = 7; + int idx_number_4 = 8; + VTY_DECLVAR_CONTEXT_SUB(key, key); + + return key_lifetime_set( + vty, &key->accept, argv[idx_hhmmss]->arg, argv[idx_number]->arg, + argv[idx_month]->arg, argv[idx_number_2]->arg, + argv[idx_hhmmss_2]->arg, argv[idx_number_3]->arg, + argv[idx_month_2]->arg, argv[idx_number_4]->arg); } DEFUN (accept_lifetime_month_day_month_day, @@ -638,18 +610,21 @@ DEFUN (accept_lifetime_month_day_month_day, "Day of th month to expire\n" "Year to expire\n") { - int idx_hhmmss = 1; - int idx_month = 2; - int idx_number = 3; - int idx_number_2 = 4; - int idx_hhmmss_2 = 5; - int idx_month_2 = 6; - int idx_number_3 = 7; - int idx_number_4 = 8; - VTY_DECLVAR_CONTEXT_SUB (key, key); - - return key_lifetime_set (vty, &key->accept, argv[idx_hhmmss]->arg, argv[idx_number]->arg, argv[idx_month]->arg, - argv[idx_number_2]->arg, argv[idx_hhmmss_2]->arg, argv[idx_number_3]->arg, argv[idx_month_2]->arg, argv[idx_number_4]->arg); + int idx_hhmmss = 1; + int idx_month = 2; + int idx_number = 3; + int idx_number_2 = 4; + int idx_hhmmss_2 = 5; + int idx_month_2 = 6; + int idx_number_3 = 7; + int idx_number_4 = 8; + VTY_DECLVAR_CONTEXT_SUB(key, key); + + return key_lifetime_set( + vty, &key->accept, argv[idx_hhmmss]->arg, argv[idx_number]->arg, + argv[idx_month]->arg, argv[idx_number_2]->arg, + argv[idx_hhmmss_2]->arg, argv[idx_number_3]->arg, + argv[idx_month_2]->arg, argv[idx_number_4]->arg); } DEFUN (accept_lifetime_infinite_day_month, @@ -662,14 +637,15 @@ DEFUN (accept_lifetime_infinite_day_month, "Year to start\n" "Never expires") { - int idx_hhmmss = 1; - int idx_number = 2; - int idx_month = 3; - int idx_number_2 = 4; - VTY_DECLVAR_CONTEXT_SUB (key, key); - - return key_lifetime_infinite_set (vty, &key->accept, argv[idx_hhmmss]->arg, argv[idx_number]->arg, - argv[idx_month]->arg, argv[idx_number_2]->arg); + int idx_hhmmss = 1; + int idx_number = 2; + int idx_month = 3; + int idx_number_2 = 4; + VTY_DECLVAR_CONTEXT_SUB(key, key); + + return key_lifetime_infinite_set( + vty, &key->accept, argv[idx_hhmmss]->arg, argv[idx_number]->arg, + argv[idx_month]->arg, argv[idx_number_2]->arg); } DEFUN (accept_lifetime_infinite_month_day, @@ -682,14 +658,15 @@ DEFUN (accept_lifetime_infinite_month_day, "Year to start\n" "Never expires") { - int idx_hhmmss = 1; - int idx_month = 2; - int idx_number = 3; - int idx_number_2 = 4; - VTY_DECLVAR_CONTEXT_SUB (key, key); - - return key_lifetime_infinite_set (vty, &key->accept, argv[idx_hhmmss]->arg, argv[idx_number]->arg, - argv[idx_month]->arg, argv[idx_number_2]->arg); + int idx_hhmmss = 1; + int idx_month = 2; + int idx_number = 3; + int idx_number_2 = 4; + VTY_DECLVAR_CONTEXT_SUB(key, key); + + return key_lifetime_infinite_set( + vty, &key->accept, argv[idx_hhmmss]->arg, argv[idx_number]->arg, + argv[idx_month]->arg, argv[idx_number_2]->arg); } DEFUN (accept_lifetime_duration_day_month, @@ -703,15 +680,17 @@ DEFUN (accept_lifetime_duration_day_month, "Duration of the key\n" "Duration seconds\n") { - int idx_hhmmss = 1; - int idx_number = 2; - int idx_month = 3; - int idx_number_2 = 4; - int idx_number_3 = 6; - VTY_DECLVAR_CONTEXT_SUB (key, key); - - return key_lifetime_duration_set (vty, &key->accept, argv[idx_hhmmss]->arg, argv[idx_number]->arg, - argv[idx_month]->arg, argv[idx_number_2]->arg, argv[idx_number_3]->arg); + int idx_hhmmss = 1; + int idx_number = 2; + int idx_month = 3; + int idx_number_2 = 4; + int idx_number_3 = 6; + VTY_DECLVAR_CONTEXT_SUB(key, key); + + return key_lifetime_duration_set( + vty, &key->accept, argv[idx_hhmmss]->arg, argv[idx_number]->arg, + argv[idx_month]->arg, argv[idx_number_2]->arg, + argv[idx_number_3]->arg); } DEFUN (accept_lifetime_duration_month_day, @@ -725,15 +704,17 @@ DEFUN (accept_lifetime_duration_month_day, "Duration of the key\n" "Duration seconds\n") { - int idx_hhmmss = 1; - int idx_month = 2; - int idx_number = 3; - int idx_number_2 = 4; - int idx_number_3 = 6; - VTY_DECLVAR_CONTEXT_SUB (key, key); - - return key_lifetime_duration_set (vty, &key->accept, argv[idx_hhmmss]->arg, argv[idx_number]->arg, - argv[idx_month]->arg, argv[idx_number_2]->arg, argv[idx_number_3]->arg); + int idx_hhmmss = 1; + int idx_month = 2; + int idx_number = 3; + int idx_number_2 = 4; + int idx_number_3 = 6; + VTY_DECLVAR_CONTEXT_SUB(key, key); + + return key_lifetime_duration_set( + vty, &key->accept, argv[idx_hhmmss]->arg, argv[idx_number]->arg, + argv[idx_month]->arg, argv[idx_number_2]->arg, + argv[idx_number_3]->arg); } DEFUN (send_lifetime_day_month_day_month, @@ -749,18 +730,21 @@ DEFUN (send_lifetime_day_month_day_month, "Month of the year to expire\n" "Year to expire\n") { - int idx_hhmmss = 1; - int idx_number = 2; - int idx_month = 3; - int idx_number_2 = 4; - int idx_hhmmss_2 = 5; - int idx_number_3 = 6; - int idx_month_2 = 7; - int idx_number_4 = 8; - VTY_DECLVAR_CONTEXT_SUB (key, key); - - return key_lifetime_set (vty, &key->send, argv[idx_hhmmss]->arg, argv[idx_number]->arg, argv[idx_month]->arg, argv[idx_number_2]->arg, - argv[idx_hhmmss_2]->arg, argv[idx_number_3]->arg, argv[idx_month_2]->arg, argv[idx_number_4]->arg); + int idx_hhmmss = 1; + int idx_number = 2; + int idx_month = 3; + int idx_number_2 = 4; + int idx_hhmmss_2 = 5; + int idx_number_3 = 6; + int idx_month_2 = 7; + int idx_number_4 = 8; + VTY_DECLVAR_CONTEXT_SUB(key, key); + + return key_lifetime_set( + vty, &key->send, argv[idx_hhmmss]->arg, argv[idx_number]->arg, + argv[idx_month]->arg, argv[idx_number_2]->arg, + argv[idx_hhmmss_2]->arg, argv[idx_number_3]->arg, + argv[idx_month_2]->arg, argv[idx_number_4]->arg); } DEFUN (send_lifetime_day_month_month_day, @@ -776,18 +760,21 @@ DEFUN (send_lifetime_day_month_month_day, "Day of th month to expire\n" "Year to expire\n") { - int idx_hhmmss = 1; - int idx_number = 2; - int idx_month = 3; - int idx_number_2 = 4; - int idx_hhmmss_2 = 5; - int idx_month_2 = 6; - int idx_number_3 = 7; - int idx_number_4 = 8; - VTY_DECLVAR_CONTEXT_SUB (key, key); - - return key_lifetime_set (vty, &key->send, argv[idx_hhmmss]->arg, argv[idx_number]->arg, argv[idx_month]->arg, argv[idx_number_2]->arg, - argv[idx_hhmmss_2]->arg, argv[idx_number_3]->arg, argv[idx_month_2]->arg, argv[idx_number_4]->arg); + int idx_hhmmss = 1; + int idx_number = 2; + int idx_month = 3; + int idx_number_2 = 4; + int idx_hhmmss_2 = 5; + int idx_month_2 = 6; + int idx_number_3 = 7; + int idx_number_4 = 8; + VTY_DECLVAR_CONTEXT_SUB(key, key); + + return key_lifetime_set( + vty, &key->send, argv[idx_hhmmss]->arg, argv[idx_number]->arg, + argv[idx_month]->arg, argv[idx_number_2]->arg, + argv[idx_hhmmss_2]->arg, argv[idx_number_3]->arg, + argv[idx_month_2]->arg, argv[idx_number_4]->arg); } DEFUN (send_lifetime_month_day_day_month, @@ -803,18 +790,21 @@ DEFUN (send_lifetime_month_day_day_month, "Month of the year to expire\n" "Year to expire\n") { - int idx_hhmmss = 1; - int idx_month = 2; - int idx_number = 3; - int idx_number_2 = 4; - int idx_hhmmss_2 = 5; - int idx_number_3 = 6; - int idx_month_2 = 7; - int idx_number_4 = 8; - VTY_DECLVAR_CONTEXT_SUB (key, key); - - return key_lifetime_set (vty, &key->send, argv[idx_hhmmss]->arg, argv[idx_number]->arg, argv[idx_month]->arg, argv[idx_number_2]->arg, - argv[idx_hhmmss_2]->arg, argv[idx_number_3]->arg, argv[idx_month_2]->arg, argv[idx_number_4]->arg); + int idx_hhmmss = 1; + int idx_month = 2; + int idx_number = 3; + int idx_number_2 = 4; + int idx_hhmmss_2 = 5; + int idx_number_3 = 6; + int idx_month_2 = 7; + int idx_number_4 = 8; + VTY_DECLVAR_CONTEXT_SUB(key, key); + + return key_lifetime_set( + vty, &key->send, argv[idx_hhmmss]->arg, argv[idx_number]->arg, + argv[idx_month]->arg, argv[idx_number_2]->arg, + argv[idx_hhmmss_2]->arg, argv[idx_number_3]->arg, + argv[idx_month_2]->arg, argv[idx_number_4]->arg); } DEFUN (send_lifetime_month_day_month_day, @@ -830,18 +820,21 @@ DEFUN (send_lifetime_month_day_month_day, "Day of th month to expire\n" "Year to expire\n") { - int idx_hhmmss = 1; - int idx_month = 2; - int idx_number = 3; - int idx_number_2 = 4; - int idx_hhmmss_2 = 5; - int idx_month_2 = 6; - int idx_number_3 = 7; - int idx_number_4 = 8; - VTY_DECLVAR_CONTEXT_SUB (key, key); - - return key_lifetime_set (vty, &key->send, argv[idx_hhmmss]->arg, argv[idx_number]->arg, argv[idx_month]->arg, argv[idx_number_2]->arg, - argv[idx_hhmmss_2]->arg, argv[idx_number_3]->arg, argv[idx_month_2]->arg, argv[idx_number_4]->arg); + int idx_hhmmss = 1; + int idx_month = 2; + int idx_number = 3; + int idx_number_2 = 4; + int idx_hhmmss_2 = 5; + int idx_month_2 = 6; + int idx_number_3 = 7; + int idx_number_4 = 8; + VTY_DECLVAR_CONTEXT_SUB(key, key); + + return key_lifetime_set( + vty, &key->send, argv[idx_hhmmss]->arg, argv[idx_number]->arg, + argv[idx_month]->arg, argv[idx_number_2]->arg, + argv[idx_hhmmss_2]->arg, argv[idx_number_3]->arg, + argv[idx_month_2]->arg, argv[idx_number_4]->arg); } DEFUN (send_lifetime_infinite_day_month, @@ -854,14 +847,15 @@ DEFUN (send_lifetime_infinite_day_month, "Year to start\n" "Never expires") { - int idx_hhmmss = 1; - int idx_number = 2; - int idx_month = 3; - int idx_number_2 = 4; - VTY_DECLVAR_CONTEXT_SUB (key, key); - - return key_lifetime_infinite_set (vty, &key->send, argv[idx_hhmmss]->arg, argv[idx_number]->arg, argv[idx_month]->arg, - argv[idx_number_2]->arg); + int idx_hhmmss = 1; + int idx_number = 2; + int idx_month = 3; + int idx_number_2 = 4; + VTY_DECLVAR_CONTEXT_SUB(key, key); + + return key_lifetime_infinite_set( + vty, &key->send, argv[idx_hhmmss]->arg, argv[idx_number]->arg, + argv[idx_month]->arg, argv[idx_number_2]->arg); } DEFUN (send_lifetime_infinite_month_day, @@ -874,14 +868,15 @@ DEFUN (send_lifetime_infinite_month_day, "Year to start\n" "Never expires") { - int idx_hhmmss = 1; - int idx_month = 2; - int idx_number = 3; - int idx_number_2 = 4; - VTY_DECLVAR_CONTEXT_SUB (key, key); - - return key_lifetime_infinite_set (vty, &key->send, argv[idx_hhmmss]->arg, argv[idx_number]->arg, argv[idx_month]->arg, - argv[idx_number_2]->arg); + int idx_hhmmss = 1; + int idx_month = 2; + int idx_number = 3; + int idx_number_2 = 4; + VTY_DECLVAR_CONTEXT_SUB(key, key); + + return key_lifetime_infinite_set( + vty, &key->send, argv[idx_hhmmss]->arg, argv[idx_number]->arg, + argv[idx_month]->arg, argv[idx_number_2]->arg); } DEFUN (send_lifetime_duration_day_month, @@ -895,15 +890,17 @@ DEFUN (send_lifetime_duration_day_month, "Duration of the key\n" "Duration seconds\n") { - int idx_hhmmss = 1; - int idx_number = 2; - int idx_month = 3; - int idx_number_2 = 4; - int idx_number_3 = 6; - VTY_DECLVAR_CONTEXT_SUB (key, key); - - return key_lifetime_duration_set (vty, &key->send, argv[idx_hhmmss]->arg, argv[idx_number]->arg, argv[idx_month]->arg, - argv[idx_number_2]->arg, argv[idx_number_3]->arg); + int idx_hhmmss = 1; + int idx_number = 2; + int idx_month = 3; + int idx_number_2 = 4; + int idx_number_3 = 6; + VTY_DECLVAR_CONTEXT_SUB(key, key); + + return key_lifetime_duration_set( + vty, &key->send, argv[idx_hhmmss]->arg, argv[idx_number]->arg, + argv[idx_month]->arg, argv[idx_number_2]->arg, + argv[idx_number_3]->arg); } DEFUN (send_lifetime_duration_month_day, @@ -917,148 +914,157 @@ DEFUN (send_lifetime_duration_month_day, "Duration of the key\n" "Duration seconds\n") { - int idx_hhmmss = 1; - int idx_month = 2; - int idx_number = 3; - int idx_number_2 = 4; - int idx_number_3 = 6; - VTY_DECLVAR_CONTEXT_SUB (key, key); - - return key_lifetime_duration_set (vty, &key->send, argv[idx_hhmmss]->arg, argv[idx_number]->arg, argv[idx_month]->arg, - argv[idx_number_2]->arg, argv[idx_number_3]->arg); + int idx_hhmmss = 1; + int idx_month = 2; + int idx_number = 3; + int idx_number_2 = 4; + int idx_number_3 = 6; + VTY_DECLVAR_CONTEXT_SUB(key, key); + + return key_lifetime_duration_set( + vty, &key->send, argv[idx_hhmmss]->arg, argv[idx_number]->arg, + argv[idx_month]->arg, argv[idx_number_2]->arg, + argv[idx_number_3]->arg); } -static struct cmd_node keychain_node = -{ - KEYCHAIN_NODE, - "%s(config-keychain)# ", - 1 -}; +static struct cmd_node keychain_node = {KEYCHAIN_NODE, "%s(config-keychain)# ", + 1}; -static struct cmd_node keychain_key_node = -{ - KEYCHAIN_KEY_NODE, - "%s(config-keychain-key)# ", - 1 -}; +static struct cmd_node keychain_key_node = {KEYCHAIN_KEY_NODE, + "%s(config-keychain-key)# ", 1}; -static int -keychain_strftime (char *buf, int bufsiz, time_t *time) +static int keychain_strftime(char *buf, int bufsiz, time_t *time) { - struct tm *tm; - size_t len; + struct tm *tm; + size_t len; - tm = localtime (time); + tm = localtime(time); - len = strftime (buf, bufsiz, "%T %b %d %Y", tm); + len = strftime(buf, bufsiz, "%T %b %d %Y", tm); - return len; + return len; } -static int -keychain_config_write (struct vty *vty) +static int keychain_config_write(struct vty *vty) { - struct keychain *keychain; - struct key *key; - struct listnode *node; - struct listnode *knode; - char buf[BUFSIZ]; - - for (ALL_LIST_ELEMENTS_RO (keychain_list, node, keychain)) - { - vty_out (vty, "key chain %s%s", keychain->name, VTY_NEWLINE); - - for (ALL_LIST_ELEMENTS_RO (keychain->key, knode, key)) - { - vty_out (vty, " key %d%s", key->index, VTY_NEWLINE); - - if (key->string) - vty_out (vty, " key-string %s%s", key->string, VTY_NEWLINE); - - if (key->accept.start) - { - keychain_strftime (buf, BUFSIZ, &key->accept.start); - vty_out (vty, " accept-lifetime %s", buf); - - if (key->accept.end == -1) - vty_out (vty, " infinite"); - else if (key->accept.duration) - vty_out (vty, " duration %ld", - (long)(key->accept.end - key->accept.start)); - else - { - keychain_strftime (buf, BUFSIZ, &key->accept.end); - vty_out (vty, " %s", buf); - } - vty_out (vty, "%s", VTY_NEWLINE); - } - - if (key->send.start) - { - keychain_strftime (buf, BUFSIZ, &key->send.start); - vty_out (vty, " send-lifetime %s", buf); - - if (key->send.end == -1) - vty_out (vty, " infinite"); - else if (key->send.duration) - vty_out (vty, " duration %ld", (long)(key->send.end - key->send.start)); - else - { - keychain_strftime (buf, BUFSIZ, &key->send.end); - vty_out (vty, " %s", buf); + struct keychain *keychain; + struct key *key; + struct listnode *node; + struct listnode *knode; + char buf[BUFSIZ]; + + for (ALL_LIST_ELEMENTS_RO(keychain_list, node, keychain)) { + vty_out(vty, "key chain %s%s", keychain->name, VTY_NEWLINE); + + for (ALL_LIST_ELEMENTS_RO(keychain->key, knode, key)) { + vty_out(vty, " key %d%s", key->index, VTY_NEWLINE); + + if (key->string) + vty_out(vty, " key-string %s%s", key->string, + VTY_NEWLINE); + + if (key->accept.start) { + keychain_strftime(buf, BUFSIZ, + &key->accept.start); + vty_out(vty, " accept-lifetime %s", buf); + + if (key->accept.end == -1) + vty_out(vty, " infinite"); + else if (key->accept.duration) + vty_out(vty, " duration %ld", + (long)(key->accept.end + - key->accept.start)); + else { + keychain_strftime(buf, BUFSIZ, + &key->accept.end); + vty_out(vty, " %s", buf); + } + vty_out(vty, "%s", VTY_NEWLINE); + } + + if (key->send.start) { + keychain_strftime(buf, BUFSIZ, + &key->send.start); + vty_out(vty, " send-lifetime %s", buf); + + if (key->send.end == -1) + vty_out(vty, " infinite"); + else if (key->send.duration) + vty_out(vty, " duration %ld", + (long)(key->send.end + - key->send.start)); + else { + keychain_strftime(buf, BUFSIZ, + &key->send.end); + vty_out(vty, " %s", buf); + } + vty_out(vty, "%s", VTY_NEWLINE); + } } - vty_out (vty, "%s", VTY_NEWLINE); - } + vty_out(vty, "!%s", VTY_NEWLINE); } - vty_out (vty, "!%s", VTY_NEWLINE); - } - return 0; + return 0; } -void -keychain_init () +void keychain_init() { - keychain_list = list_new (); - - install_node (&keychain_node, keychain_config_write); - install_node (&keychain_key_node, NULL); - - install_default (KEYCHAIN_NODE); - install_default (KEYCHAIN_KEY_NODE); - - install_element (CONFIG_NODE, &key_chain_cmd); - install_element (CONFIG_NODE, &no_key_chain_cmd); - install_element (KEYCHAIN_NODE, &key_cmd); - install_element (KEYCHAIN_NODE, &no_key_cmd); - - install_element (KEYCHAIN_NODE, &key_chain_cmd); - install_element (KEYCHAIN_NODE, &no_key_chain_cmd); - - install_element (KEYCHAIN_KEY_NODE, &key_string_cmd); - install_element (KEYCHAIN_KEY_NODE, &no_key_string_cmd); - - install_element (KEYCHAIN_KEY_NODE, &key_chain_cmd); - install_element (KEYCHAIN_KEY_NODE, &no_key_chain_cmd); - - install_element (KEYCHAIN_KEY_NODE, &key_cmd); - install_element (KEYCHAIN_KEY_NODE, &no_key_cmd); - - install_element (KEYCHAIN_KEY_NODE, &accept_lifetime_day_month_day_month_cmd); - install_element (KEYCHAIN_KEY_NODE, &accept_lifetime_day_month_month_day_cmd); - install_element (KEYCHAIN_KEY_NODE, &accept_lifetime_month_day_day_month_cmd); - install_element (KEYCHAIN_KEY_NODE, &accept_lifetime_month_day_month_day_cmd); - install_element (KEYCHAIN_KEY_NODE, &accept_lifetime_infinite_day_month_cmd); - install_element (KEYCHAIN_KEY_NODE, &accept_lifetime_infinite_month_day_cmd); - install_element (KEYCHAIN_KEY_NODE, &accept_lifetime_duration_day_month_cmd); - install_element (KEYCHAIN_KEY_NODE, &accept_lifetime_duration_month_day_cmd); - - install_element (KEYCHAIN_KEY_NODE, &send_lifetime_day_month_day_month_cmd); - install_element (KEYCHAIN_KEY_NODE, &send_lifetime_day_month_month_day_cmd); - install_element (KEYCHAIN_KEY_NODE, &send_lifetime_month_day_day_month_cmd); - install_element (KEYCHAIN_KEY_NODE, &send_lifetime_month_day_month_day_cmd); - install_element (KEYCHAIN_KEY_NODE, &send_lifetime_infinite_day_month_cmd); - install_element (KEYCHAIN_KEY_NODE, &send_lifetime_infinite_month_day_cmd); - install_element (KEYCHAIN_KEY_NODE, &send_lifetime_duration_day_month_cmd); - install_element (KEYCHAIN_KEY_NODE, &send_lifetime_duration_month_day_cmd); + keychain_list = list_new(); + + install_node(&keychain_node, keychain_config_write); + install_node(&keychain_key_node, NULL); + + install_default(KEYCHAIN_NODE); + install_default(KEYCHAIN_KEY_NODE); + + install_element(CONFIG_NODE, &key_chain_cmd); + install_element(CONFIG_NODE, &no_key_chain_cmd); + install_element(KEYCHAIN_NODE, &key_cmd); + install_element(KEYCHAIN_NODE, &no_key_cmd); + + install_element(KEYCHAIN_NODE, &key_chain_cmd); + install_element(KEYCHAIN_NODE, &no_key_chain_cmd); + + install_element(KEYCHAIN_KEY_NODE, &key_string_cmd); + install_element(KEYCHAIN_KEY_NODE, &no_key_string_cmd); + + install_element(KEYCHAIN_KEY_NODE, &key_chain_cmd); + install_element(KEYCHAIN_KEY_NODE, &no_key_chain_cmd); + + install_element(KEYCHAIN_KEY_NODE, &key_cmd); + install_element(KEYCHAIN_KEY_NODE, &no_key_cmd); + + install_element(KEYCHAIN_KEY_NODE, + &accept_lifetime_day_month_day_month_cmd); + install_element(KEYCHAIN_KEY_NODE, + &accept_lifetime_day_month_month_day_cmd); + install_element(KEYCHAIN_KEY_NODE, + &accept_lifetime_month_day_day_month_cmd); + install_element(KEYCHAIN_KEY_NODE, + &accept_lifetime_month_day_month_day_cmd); + install_element(KEYCHAIN_KEY_NODE, + &accept_lifetime_infinite_day_month_cmd); + install_element(KEYCHAIN_KEY_NODE, + &accept_lifetime_infinite_month_day_cmd); + install_element(KEYCHAIN_KEY_NODE, + &accept_lifetime_duration_day_month_cmd); + install_element(KEYCHAIN_KEY_NODE, + &accept_lifetime_duration_month_day_cmd); + + install_element(KEYCHAIN_KEY_NODE, + &send_lifetime_day_month_day_month_cmd); + install_element(KEYCHAIN_KEY_NODE, + &send_lifetime_day_month_month_day_cmd); + install_element(KEYCHAIN_KEY_NODE, + &send_lifetime_month_day_day_month_cmd); + install_element(KEYCHAIN_KEY_NODE, + &send_lifetime_month_day_month_day_cmd); + install_element(KEYCHAIN_KEY_NODE, + &send_lifetime_infinite_day_month_cmd); + install_element(KEYCHAIN_KEY_NODE, + &send_lifetime_infinite_month_day_cmd); + install_element(KEYCHAIN_KEY_NODE, + &send_lifetime_duration_day_month_cmd); + install_element(KEYCHAIN_KEY_NODE, + &send_lifetime_duration_month_day_cmd); } |
