diff options
Diffstat (limited to 'src/pies.c')
-rw-r--r-- | src/pies.c | 63 |
1 files changed, 47 insertions, 16 deletions
@@ -18,6 +18,7 @@ | |||
18 | #include <locale.h> | 18 | #include <locale.h> |
19 | #include <configmake.h> | 19 | #include <configmake.h> |
20 | #include "meta1lex.h" | 20 | #include "meta1lex.h" |
21 | #include "identity.h" | ||
21 | 22 | ||
22 | int preprocess_only; /* Preprocess config, do nothing more */ | 23 | int preprocess_only; /* Preprocess config, do nothing more */ |
23 | int lint_mode; /* Test configuration syntax and exit */ | 24 | int lint_mode; /* Test configuration syntax and exit */ |
@@ -1541,9 +1542,15 @@ struct grecs_keyword control_keywords[] = { | |||
1541 | &control.url, 0, _cb_url}, | 1542 | &control.url, 0, _cb_url}, |
1542 | {"acl", | 1543 | {"acl", |
1543 | N_("name: string"), | 1544 | N_("name: string"), |
1544 | N_("Set ACL."), | 1545 | N_("Set connection ACL."), |
1546 | grecs_type_section, GRECS_DFLT, | ||
1547 | &control.conn_acl, 0, | ||
1548 | acl_section_parser, NULL, acl_keywords}, | ||
1549 | {"identity-acl", | ||
1550 | N_("name: string"), | ||
1551 | N_("Set identity ACL."), | ||
1545 | grecs_type_section, GRECS_DFLT, | 1552 | grecs_type_section, GRECS_DFLT, |
1546 | &control.acl, 0, | 1553 | &control.id_acl, 0, |
1547 | acl_section_parser, NULL, acl_keywords}, | 1554 | acl_section_parser, NULL, acl_keywords}, |
1548 | {"idle-timeout", | 1555 | {"idle-timeout", |
1549 | "n", | 1556 | "n", |
@@ -1760,6 +1767,8 @@ struct grecs_keyword pies_keywords[] = { | |||
1760 | &mailer_command_line, 0, | 1767 | &mailer_command_line, 0, |
1761 | NULL | 1768 | NULL |
1762 | }, | 1769 | }, |
1770 | { "identity-provider", "name: string", "Configure identity provider", | ||
1771 | grecs_type_section, GRECS_INAC | GRECS_HIDDEN }, | ||
1763 | {NULL} | 1772 | {NULL} |
1764 | }; | 1773 | }; |
1765 | 1774 | ||
@@ -1775,6 +1784,39 @@ config_init () | |||
1775 | obstack_grow (&pp_stk, DEFAULT_PREPROCESSOR, | 1784 | obstack_grow (&pp_stk, DEFAULT_PREPROCESSOR, |
1776 | sizeof (DEFAULT_PREPROCESSOR) - 1); | 1785 | sizeof (DEFAULT_PREPROCESSOR) - 1); |
1777 | } | 1786 | } |
1787 | pies_identity_mechanism_register (&system_identity_mechanism); | ||
1788 | #ifdef WITH_PAM | ||
1789 | pies_identity_mechanism_register (&pam_identity_mechanism); | ||
1790 | #endif | ||
1791 | } | ||
1792 | |||
1793 | static void | ||
1794 | config_error () | ||
1795 | { | ||
1796 | if (!init_process) | ||
1797 | exit (EX_CONFIG); | ||
1798 | } | ||
1799 | |||
1800 | void | ||
1801 | config_parse (char const *name) | ||
1802 | { | ||
1803 | struct grecs_node *node; | ||
1804 | struct grecs_node *tree = grecs_parse (name); | ||
1805 | if (!tree) | ||
1806 | config_error (); | ||
1807 | |||
1808 | for (node = tree; node; node = node->next) | ||
1809 | { | ||
1810 | node = grecs_find_node (node, "identity-provider"); | ||
1811 | if (!node) | ||
1812 | break; | ||
1813 | pies_config_provider (node); | ||
1814 | } | ||
1815 | |||
1816 | if (grecs_tree_process (tree, pies_keywords)) | ||
1817 | config_error (); | ||
1818 | |||
1819 | grecs_tree_free (tree); | ||
1778 | } | 1820 | } |
1779 | 1821 | ||
1780 | void | 1822 | void |
@@ -1786,6 +1828,7 @@ config_help () | |||
1786 | "For more information, use `info pies configuration'."); | 1828 | "For more information, use `info pies configuration'."); |
1787 | grecs_print_docstring (docstring, 0, stdout); | 1829 | grecs_print_docstring (docstring, 0, stdout); |
1788 | grecs_print_statement_array (pies_keywords, 1, 0, stdout); | 1830 | grecs_print_statement_array (pies_keywords, 1, 0, stdout); |
1831 | pies_config_identity_mechanisms_help (); | ||
1789 | } | 1832 | } |
1790 | 1833 | ||
1791 | static enum config_syntax current_syntax = CONF_PIES; | 1834 | static enum config_syntax current_syntax = CONF_PIES; |
@@ -2241,13 +2284,6 @@ set_state_file_names (const char *base) | |||
2241 | qotdfile = mkfilename (statedir, base, ".qotd"); | 2284 | qotdfile = mkfilename (statedir, base, ".qotd"); |
2242 | } | 2285 | } |
2243 | 2286 | ||
2244 | static void | ||
2245 | config_error () | ||
2246 | { | ||
2247 | if (!init_process) | ||
2248 | exit (EX_CONFIG); | ||
2249 | } | ||
2250 | |||
2251 | int | 2287 | int |
2252 | main (int argc, char **argv) | 2288 | main (int argc, char **argv) |
2253 | { | 2289 | { |
@@ -2367,13 +2403,8 @@ main (int argc, char **argv) | |||
2367 | switch (file->syntax) | 2403 | switch (file->syntax) |
2368 | { | 2404 | { |
2369 | case CONF_PIES: | 2405 | case CONF_PIES: |
2370 | { | 2406 | config_parse (file->name); |
2371 | struct grecs_node *tree = grecs_parse (file->name); | 2407 | break; |
2372 | if (!tree || grecs_tree_process (tree, pies_keywords)) | ||
2373 | config_error (); | ||
2374 | grecs_tree_free (tree); | ||
2375 | break; | ||
2376 | } | ||
2377 | 2408 | ||
2378 | case CONF_INETD: | 2409 | case CONF_INETD: |
2379 | if (inetd_parse_conf (file->name)) | 2410 | if (inetd_parse_conf (file->name)) |