diff --git a/.augeas.metadata b/.augeas.metadata index 589ff29..066252a 100644 --- a/.augeas.metadata +++ b/.augeas.metadata @@ -1 +1 @@ -2c5ec65a30ab21b175d612b4dc6350d75b9d6a7c SOURCES/augeas-1.1.0.tar.gz +27b563bb173eed6163d76b5b21f3a1566c82351b SOURCES/augeas-1.4.0.tar.gz diff --git a/.gitignore b/.gitignore index 25eac37..eeed9c4 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/augeas-1.1.0.tar.gz +SOURCES/augeas-1.4.0.tar.gz diff --git a/SOURCES/0001-Grub-support-the-setkey-directive.patch b/SOURCES/0001-Grub-support-the-setkey-directive.patch deleted file mode 100644 index 5cc956a..0000000 --- a/SOURCES/0001-Grub-support-the-setkey-directive.patch +++ /dev/null @@ -1,160 +0,0 @@ -From bc46ce8269a89a55b87a906226cfe8b54e9e5d11 Mon Sep 17 00:00:00 2001 -From: Matthew Booth -Date: Tue, 27 Aug 2013 15:24:48 +0100 -Subject: [PATCH 1/3] Grub: support the 'setkey' directive - ---- - lenses/grub.aug | 7 +++++++ - lenses/tests/test_grub.aug | 6 ++++++ - 2 files changed, 13 insertions(+) - -diff --git a/lenses/grub.aug b/lenses/grub.aug -index 2c19ffa..d8fd5ed 100644 ---- a/lenses/grub.aug -+++ b/lenses/grub.aug -@@ -132,6 +132,12 @@ module Grub = - |[ spc . switch_arg /timeout|lines/ ])* . - [ spc . key /console|serial|hercules/ ]* . eol ] - -+ (* View: setkey *) -+ let setkey = [ command "setkey" "" . -+ ( spc . [ label "to" . store Rx.no_spaces ] . -+ spc . [ label "from" . store Rx.no_spaces ] )? . -+ eol ] -+ - (* View: menu_setting *) - let menu_setting = kw_menu_arg "default" - | kw_menu_arg "fallback" -@@ -145,6 +151,7 @@ module Grub = - | password_arg - | color - | device -+ | setkey - - (* View: title *) - let title = del /title[ \t=]+/ "title " . value_to_eol . eol -diff --git a/lenses/tests/test_grub.aug b/lenses/tests/test_grub.aug -index 3eba710..e4dc228 100644 ---- a/lenses/tests/test_grub.aug -+++ b/lenses/tests/test_grub.aug -@@ -12,6 +12,8 @@ module Test_grub = - device (hd0) HD(1,800,64000,9895c137-d4b2-4e3b-a93b-dc9ac4) - password --md5 $1$M9NLj$p2gs87vwNv48BUu.wAfVw0 - default=0 -+setkey -+setkey less backquote - background 103332 - timeout=5 - splashimage=(hd0,0)/grub/splash.xpm.gz -@@ -54,6 +56,10 @@ title othermenu - { "password" = "$1$M9NLj$p2gs87vwNv48BUu.wAfVw0" - { "md5" } } - { "default" = "0" } -+ { "setkey" } -+ { "setkey" -+ { "to" = "less" } -+ { "from" = "backquote" } } - { "background" = "103332" } - { "timeout" = "5" } - { "splashimage" = "(hd0,0)/grub/splash.xpm.gz" } --- -1.8.3.1 - - -From f55175ed0e17a5a4f50a32d9ad5cba5f486eb577 Mon Sep 17 00:00:00 2001 -From: Matthew Booth -Date: Tue, 27 Aug 2013 15:24:49 +0100 -Subject: [PATCH 2/3] Grub: NFC fix whitespace errors introduced by 4e09d15 - -Kill tabs! ---- - lenses/grub.aug | 6 +++--- - lenses/tests/test_grub.aug | 2 +- - 2 files changed, 4 insertions(+), 4 deletions(-) - -diff --git a/lenses/grub.aug b/lenses/grub.aug -index d8fd5ed..a64a572 100644 ---- a/lenses/grub.aug -+++ b/lenses/grub.aug -@@ -102,8 +102,8 @@ module Grub = - * This is a shell-only directive in upstream grub; the grub versions - * in at least Fedora/RHEL use this to find devices for UEFI boot *) - let device = -- [ command "device" "" . Sep.space . store /\([A-Za-z0-9_.-]+\)/ . spc . -- [ label "file" . value_to_eol ] . Util.eol ] -+ [ command "device" "" . Sep.space . store /\([A-Za-z0-9_.-]+\)/ . spc . -+ [ label "file" . value_to_eol ] . Util.eol ] - - (* View: color *) - let color = -@@ -150,7 +150,7 @@ module Grub = - | terminal - | password_arg - | color -- | device -+ | device - | setkey - - (* View: title *) -diff --git a/lenses/tests/test_grub.aug b/lenses/tests/test_grub.aug -index e4dc228..87bb243 100644 ---- a/lenses/tests/test_grub.aug -+++ b/lenses/tests/test_grub.aug -@@ -52,7 +52,7 @@ title othermenu - { "#comment" = "initrd /initrd-version.img" } - { "#comment" = "boot=/dev/sda" } - { "device" = "(hd0)" -- { "file" = "HD(1,800,64000,9895c137-d4b2-4e3b-a93b-dc9ac4)" } } -+ { "file" = "HD(1,800,64000,9895c137-d4b2-4e3b-a93b-dc9ac4)" } } - { "password" = "$1$M9NLj$p2gs87vwNv48BUu.wAfVw0" - { "md5" } } - { "default" = "0" } --- -1.8.3.1 - - -From e3f1c15155fba5c10e74b400f2b06c8a31372420 Mon Sep 17 00:00:00 2001 -From: Matthew Booth -Date: Tue, 27 Aug 2013 15:24:50 +0100 -Subject: [PATCH 3/3] Grub: support the 'lock' directive - ---- - lenses/grub.aug | 1 + - lenses/tests/test_grub.aug | 2 ++ - 2 files changed, 3 insertions(+) - -diff --git a/lenses/grub.aug b/lenses/grub.aug -index a64a572..9f8d6af 100644 ---- a/lenses/grub.aug -+++ b/lenses/grub.aug -@@ -216,6 +216,7 @@ module Grub = - | configfile - | module_line - | map_line -+ | kw_pres "lock" - - (* View: boot *) - let boot = -diff --git a/lenses/tests/test_grub.aug b/lenses/tests/test_grub.aug -index 87bb243..de6397d 100644 ---- a/lenses/tests/test_grub.aug -+++ b/lenses/tests/test_grub.aug -@@ -38,6 +38,7 @@ title Fedora (2.6.24.3-34.fc8) - initrd /initrd-2.6.24.3-34.fc8.img - map (hd0) (hd1) - title othermenu -+ lock - configfile /boot/grub/othergrub.conf - " - -@@ -88,6 +89,7 @@ title othermenu - { "initrd" = "/initrd-2.6.24.3-34.fc8.img" } - { "map" { "from" = "(hd0)" } { "to" = "(hd1)" } } } - { "title" = "othermenu" -+ { "lock" } - { "configfile" = "/boot/grub/othergrub.conf" } } - - --- -1.8.3.1 - diff --git a/SOURCES/0001-Syslog-restored-Augeas-1.1.0-tree-compatibility-for-.patch b/SOURCES/0001-Syslog-restored-Augeas-1.1.0-tree-compatibility-for-.patch new file mode 100644 index 0000000..f994daf --- /dev/null +++ b/SOURCES/0001-Syslog-restored-Augeas-1.1.0-tree-compatibility-for-.patch @@ -0,0 +1,98 @@ +From 0fb77ec16c1e19dbcc21eedd5b26860d12463329 Mon Sep 17 00:00:00 2001 +From: Yanis Guenane +Date: Sun, 8 Sep 2013 09:30:17 -0400 +Subject: [PATCH] Syslog: restored Augeas 1.1.0 tree compatibility for UDP + hosts + +UDP host entries don't require the { "protocol" = "@" } node, it's only +used for TCP hosts. +--- + lenses/syslog.aug | 10 +++++++--- + lenses/tests/test_rsyslog.aug | 1 - + lenses/tests/test_syslog.aug | 7 +++---- + 3 files changed, 10 insertions(+), 8 deletions(-) + +diff --git a/lenses/syslog.aug b/lenses/syslog.aug +index f8b99c4..17c0f90 100644 +--- a/lenses/syslog.aug ++++ b/lenses/syslog.aug +@@ -66,6 +66,10 @@ module Syslog = + Deletes a semicolon and default to it + *) + let semicolon = sep_tab_opt . Util.del_str ";" . sep_tab_opt ++ (* Variable: at ++ Deletes a at and default to it ++ *) ++ let at = Util.del_str "@" + (* Variable: dot + Deletes a dot and default to it + *) +@@ -105,10 +109,10 @@ module Syslog = + let comparison = /(!|[<=>]+|![<=>]+)/ + + (* Variable: protocol +- @ means UDP ++ @ means UDP (removed, no protocol node is used for compatibility with 1.1.0) + @@ means TCP + *) +- let protocol = /@{1,2}/ ++ let protocol = /@@/ + + (* Variable: token + alphanum or "*" +@@ -185,7 +189,7 @@ module Syslog = + (* View: loghost + a loghost is an @ sign followed by the hostname and a possible port + *) +- let loghost = [label "protocol" . store protocol] . [ label "hostname" . store loghost_r ] . ++ let loghost = ([label "protocol" . store protocol] | at) . [ label "hostname" . store loghost_r ] . + (colon . [ label "port" . store /[0-9]+/ ] )? + + (* View: users +diff --git a/lenses/tests/test_rsyslog.aug b/lenses/tests/test_rsyslog.aug +index e696139..46b24c3 100644 +--- a/lenses/tests/test_rsyslog.aug ++++ b/lenses/tests/test_rsyslog.aug +@@ -86,7 +86,6 @@ test Rsyslog.lns get conf = + { "level" = "*" } + } + { "action" +- { "protocol" = "@" } + { "hostname" = "2.7.4.1" } + } + } +diff --git a/lenses/tests/test_syslog.aug b/lenses/tests/test_syslog.aug +index 2ad1c16..329d121 100644 +--- a/lenses/tests/test_syslog.aug ++++ b/lenses/tests/test_syslog.aug +@@ -91,11 +91,11 @@ daemon.info /var/log/cvsupd.log + } + { "entry" + { "selector" { "facility" = "*" } { "level" = "*" } } +- { "action" { "protocol" = "@" } { "hostname" = "syslog.far.away" } } ++ { "action" { "hostname" = "syslog.far.away" } } + } + { "entry" + { "selector" { "facility" = "*" } { "level" = "*" } } +- { "action" { "protocol" = "@" } { "hostname" = "syslog.far.away" } { "port" = "123" } } ++ { "action" { "hostname" = "syslog.far.away" } { "port" = "123" } } + } + { "entry" + { "selector" { "facility" = "*" } { "level" = "*" } } +@@ -107,7 +107,7 @@ daemon.info /var/log/cvsupd.log + } + { "entry" + { "selector" { "facility" = "*" } { "level" = "*" } } +- { "action" { "protocol" = "@" } { "hostname" = "[2001::1]" } { "port" = "514" } } ++ { "action" { "hostname" = "[2001::1]" } { "port" = "514" } } + } + { "entry" + { "selector" { "facility" = "*" } { "level" = "*" } } +@@ -260,7 +260,6 @@ daemon.info /var/log/cvsupd.log + (* changing file to remote host *) + test Syslog.lns put "*.* /var\n" after + rm "/entry/action/file" ; +- set "/entry/action/protocol" "@" ; + set "/entry/action/hostname" "far.far.away" + = "*.* @far.far.away\n" + diff --git a/SOURCES/0002-Revert-Use-Quote-module-in-dovecot.patch b/SOURCES/0002-Revert-Use-Quote-module-in-dovecot.patch new file mode 100644 index 0000000..c83697d --- /dev/null +++ b/SOURCES/0002-Revert-Use-Quote-module-in-dovecot.patch @@ -0,0 +1,83 @@ +From 0a636285f8aad3099c65e16d649c248262a54ef8 Mon Sep 17 00:00:00 2001 +From: Dominic Cleal +Date: Fri, 12 Jun 2015 09:32:56 +0100 +Subject: [PATCH] Revert "Use Quote module in dovecot" + +This reverts commit 735caf587959019d214a51a7c0cce57da9bb88f6 for +compatibility with Augeas 1.1.0. + +Values will have quotes in them as they did in 1.1.0, not stripped out. + +Conflicts: + lenses/dovecot.aug +--- + lenses/dovecot.aug | 28 +++++----------------------- + lenses/tests/test_dovecot.aug | 2 +- + 2 files changed, 6 insertions(+), 24 deletions(-) + +diff --git a/lenses/dovecot.aug b/lenses/dovecot.aug +index f7afc8f..c6376e4 100644 +--- a/lenses/dovecot.aug ++++ b/lenses/dovecot.aug +@@ -56,6 +56,9 @@ let value = any . (Rx.space . any)* + (* View: command_start *) + let command_start = Util.del_str "!" + ++(* View: block_args ++Map block arguments after block name and before "{" *) ++let block_args = Sep.space . store /([A-Za-z0-9\/\\_-]+|\"[A-Za-z0-9 ]*\")/ + + (****************************************************************** + * Group: ENTRIES +@@ -79,28 +82,7 @@ let entry = [ indent . key keys. eq . (Sep.opt_space . store value)? . eol ] + Map commands started with "!". *) + let command = [ command_start . key commands . Sep.space . store Rx.fspath . eol ] + +-(* +-View: dquote_spaces +- Make double quotes mandatory if value contains spaces, +- and optional if value doesn't contain spaces. +- +-Based off Quote.dquote_spaces +- +-Parameters: +- lns1:lens - the lens before +- lns2:lens - the lens after +-*) +-let dquote_spaces (lns1:lens) (lns2:lens) = +- (* bare has no spaces, and is optionally quoted *) +- let bare = Quote.do_dquote_opt (store /[^" \t\n]+/) +- (* quoted has at least one space, and must be quoted *) +- in let quoted = Quote.do_dquote (store /[^"\n]*[ \t]+[^"\n]*/) +- in [ lns1 . bare . lns2 ] | [ lns1 . quoted . lns2 ] +- +-let mailbox = indent +- . dquote_spaces +- (key /mailbox/ . Sep.space) +- (Build.block_newlines_spc entry comment . eol) ++let mailbox = [ indent . key /mailbox/ . block_args? . Build.block_newlines_spc (entry) comment . eol ] + + let block_ldelim_newlines_re = /[ \t]+\{([ \t\n]*\n)?/ + +@@ -114,7 +96,7 @@ let block_newlines (entry:lens) (comment:lens) = + Map block enclosed in brackets recursively. + Block may be indented and have optional argument. + Block body may have entries, comments, empty lines, and nested blocks recursively. *) +-let rec block = [ indent . key block_names . (Sep.space . Quote.do_dquote_opt (store /[\/A-Za-z0-9_-]+/))? . block_newlines (entry|block|mailbox) comment . eol ] ++let rec block = [ indent . key block_names . block_args? . block_newlines (entry|block|mailbox) comment . eol ] + + + (****************************************************************** +diff --git a/lenses/tests/test_dovecot.aug b/lenses/tests/test_dovecot.aug +index 33ea16f..8e8c083 100644 +--- a/lenses/tests/test_dovecot.aug ++++ b/lenses/tests/test_dovecot.aug +@@ -536,7 +536,7 @@ test Dovecot.lns get mail_conf = + { "hidden" = "no" } + { "list" = "yes" } + { "subscriptions" = "yes" } +- { "mailbox" = "Sent Messages" ++ { "mailbox" = "\"Sent Messages\"" + { "special_use" = "\Sent" } + } + } diff --git a/SOURCES/0002-src-transform.c-filter_matches-wrap-fnmatch-to-ensur.patch b/SOURCES/0002-src-transform.c-filter_matches-wrap-fnmatch-to-ensur.patch deleted file mode 100644 index 58c9b54..0000000 --- a/SOURCES/0002-src-transform.c-filter_matches-wrap-fnmatch-to-ensur.patch +++ /dev/null @@ -1,143 +0,0 @@ -From 361adbf9e520d695ae13efe6084cbcdebe4779e2 Mon Sep 17 00:00:00 2001 -From: Dominic Cleal -Date: Tue, 19 Nov 2013 09:39:23 +0000 -Subject: [PATCH] * src/transform.c (filter_matches): wrap fnmatch to ensure - that an incl pattern containing "//" matches file paths - -Fixes RHBZ#1031084 ---- - src/transform.c | 38 ++++++++++++++++++++++++++++++++++---- - tests/test-save.c | 39 +++++++++++++++++++++++++++++++++++++++ - 2 files changed, 73 insertions(+), 4 deletions(-) - -diff --git a/src/transform.c b/src/transform.c -index 1ee8da8..ccbe422 100644 ---- a/src/transform.c -+++ b/src/transform.c -@@ -142,6 +142,33 @@ static char *mtime_as_string(struct augeas *aug, const char *fname) { - return NULL; - } - -+/* fnmatch(3) which will match // in a pattern to a path, like glob(3) does */ -+static int fnmatch_normalize(const char *pattern, const char *string, int flags) { -+ int i, j, r; -+ char *pattern_norm = NULL; -+ -+ r = ALLOC_N(pattern_norm, strlen(pattern) + 1); -+ if (r < 0) -+ goto error; -+ -+ for (i = 0, j = 0; i < strlen(pattern); i++) { -+ if (pattern[i] != '/' || pattern[i+1] != '/') { -+ pattern_norm[j] = pattern[i]; -+ j++; -+ } -+ } -+ pattern_norm[j] = 0; -+ -+ r = fnmatch(pattern_norm, string, flags); -+ FREE(pattern_norm); -+ return r; -+ -+ error: -+ if (pattern_norm != NULL) -+ FREE(pattern_norm); -+ return -1; -+} -+ - static bool file_current(struct augeas *aug, const char *fname, - struct tree *finfo) { - struct tree *mtime = tree_child(finfo, s_mtime); -@@ -217,9 +244,12 @@ static int filter_generate(struct tree *xfm, const char *root, - - if (strchr(e->value, SEP) == NULL) - path = pathbase(path); -- if ((r = fnmatch(e->value, path, fnm_flags)) == 0) { -+ -+ r = fnmatch_normalize(e->value, path, fnm_flags); -+ if (r < 0) -+ goto error; -+ else if (r == 0) - include = false; -- } - } - - if (include) -@@ -254,7 +284,7 @@ static int filter_generate(struct tree *xfm, const char *root, - static int filter_matches(struct tree *xfm, const char *path) { - int found = 0; - list_for_each(f, xfm->children) { -- if (is_incl(f) && fnmatch(f->value, path, fnm_flags) == 0) { -+ if (is_incl(f) && fnmatch_normalize(f->value, path, fnm_flags) == 0) { - found = 1; - break; - } -@@ -262,7 +292,7 @@ static int filter_matches(struct tree *xfm, const char *path) { - if (! found) - return 0; - list_for_each(f, xfm->children) { -- if (is_excl(f) && (fnmatch(f->value, path, fnm_flags) == 0)) -+ if (is_excl(f) && (fnmatch_normalize(f->value, path, fnm_flags) == 0)) - return 0; - } - return 1; -diff --git a/tests/test-save.c b/tests/test-save.c -index 04b86f7..617ef31 100644 ---- a/tests/test-save.c -+++ b/tests/test-save.c -@@ -183,6 +183,44 @@ static void testRelPath(CuTest *tc) { - CuAssertIntEquals(tc, 1, r); - } - -+/* Check that loading and saving a file with // in the incl pattern works. -+ * RHBZ#1031084 -+ */ -+static void testDoubleSlashPath(CuTest *tc) { -+ int r; -+ -+ r = aug_rm(aug, "/augeas/load/*"); -+ CuAssertPositive(tc, r); -+ -+ r = aug_set(aug, "/augeas/load/Hosts/lens", "Hosts.lns"); -+ CuAssertRetSuccess(tc, r); -+ r = aug_set(aug, "/augeas/load/Hosts/incl", "/etc//hosts"); -+ CuAssertRetSuccess(tc, r); -+ r = aug_load(aug); -+ CuAssertRetSuccess(tc, r); -+ -+ r = aug_match(aug, "/files/etc/hosts/1/alias[ . = 'new']", NULL); -+ CuAssertIntEquals(tc, 0, r); -+ -+ r = aug_set(aug, "/files/etc/hosts/1/alias[last() + 1]", "new"); -+ CuAssertRetSuccess(tc, r); -+ -+ r = aug_save(aug); -+ CuAssertRetSuccess(tc, r); -+ r = aug_match(aug, "/augeas//error", NULL); -+ CuAssertIntEquals(tc, 0, r); -+ -+ /* Force reloading the file */ -+ r = aug_rm(aug, "/augeas/files//mtime"); -+ CuAssertPositive(tc, r); -+ -+ r = aug_load(aug); -+ CuAssertRetSuccess(tc, r); -+ -+ r = aug_match(aug, "/files/etc/hosts/1/alias[. = 'new']", NULL); -+ CuAssertIntEquals(tc, 1, r); -+} -+ - int main(void) { - char *output = NULL; - CuSuite* suite = CuSuiteNew(); -@@ -206,6 +244,7 @@ int main(void) { - SUITE_ADD_TEST(suite, testMultipleXfm); - SUITE_ADD_TEST(suite, testMtime); - SUITE_ADD_TEST(suite, testRelPath); -+ SUITE_ADD_TEST(suite, testDoubleSlashPath); - - CuSuiteRun(suite); - CuSuiteSummary(suite, &output); --- -1.8.3.1 - diff --git a/SOURCES/0003-Revert-Jaas-add-several-improvements-to-cover-more-v.patch b/SOURCES/0003-Revert-Jaas-add-several-improvements-to-cover-more-v.patch new file mode 100644 index 0000000..77670e2 --- /dev/null +++ b/SOURCES/0003-Revert-Jaas-add-several-improvements-to-cover-more-v.patch @@ -0,0 +1,140 @@ +From 62bb0dacd9ed721e5fdb2342a30b50f35f7ba3b3 Mon Sep 17 00:00:00 2001 +From: Dominic Cleal +Date: Fri, 12 Jun 2015 09:47:48 +0100 +Subject: [PATCH] Revert "Jaas: add several improvements to cover more valid + syntax" + +This partially reverts commit d17f2fbc30a52edb3719fc6df4c24f01552dd203 +for compatibility with Augeas 1.1.0. + +Trailing semicolons remain part of the last value. Only support for +"naked" booleans has been kept from 1.4.0. + +Conflicts: + NEWS +--- + lenses/jaas.aug | 29 ++++++++++++----------------- + lenses/tests/test_jaas.aug | 21 ++++++++++----------- + 2 files changed, 22 insertions(+), 28 deletions(-) + +diff --git a/lenses/jaas.aug b/lenses/jaas.aug +index 4f06bad..a13682e 100644 +--- a/lenses/jaas.aug ++++ b/lenses/jaas.aug +@@ -1,36 +1,31 @@ + (* Module Jaas *) +-(* Original Author: Simon Vocella *) +-(* Updated by: Steve Shipway *) +-(* Changes: allow comments within Modules, allow optionless flags, *) +-(* allow options without linebreaks, allow naked true/false options *) +-(* Trailing ';' terminator should not be included in option value *) +-(* Note: requires latest Util.aug for multiline comments to work *) ++(* Author: Simon Vocella *) + + module Jaas = + + autoload xfm + + let space_equal = del (/[ \t]*/ . "=" . /[ \t]*/) (" = ") +-let lbrace = del (/[ \t\n]*\{[ \t]*\n/) " {\n" +-let rbrace = del (/[ \t]*}[ \t]*;/) " };" ++let lbrace = del (/[ \t\n]*/ . "{") "{" ++let rbrace = del ("};") "};" + let word = /[A-Za-z0-9_.-]+/ +-let wsnl = del (/[ \t\n]+/) ("\n") +-let endflag = del ( /[ \t]*;/ ) ( ";" ) ++let wordonly = /[A-Za-z0-9_.-]+;/ + + let value_re = + let value_squote = /'[^\n']*'/ ++ in let value_squote_2 = /'[^\n']*';/ + in let value_dquote = /"[^\n"]*"/ +- in let value_tf = /(true|false)/ +- in value_squote | value_dquote | value_tf ++ in let value_dquote_2 = /"[^\n"]*";/ ++ in let value_tf = /(true|false);/ ++ in let value_tf_2 = /(true|false);/ ++ in value_squote | value_squote_2 | value_dquote | value_dquote_2 | value_tf | value_tf_2 + +-let moduleOption = [ wsnl . key word . space_equal . (store value_re) ] +-let moduleSuffix = ( moduleOption | Util.eol . Util.comment_c_style | Util.comment_multiline ) +-let flag = [ Util.del_ws_spc . label "flag" . (store word) . moduleSuffix* . endflag ] +-let loginModuleClass = [( Util.del_opt_ws "" . label "loginModuleClass" . (store word) . flag ) ] ++let moduleOption = [Util.del_opt_ws "" . key word . space_equal . (store value_re . Util.comment_or_eol)] ++let flag = [label "flag" . ((store word . Util.eol . moduleOption+) | (store wordonly . Util.eol))] ++let loginModuleClass = [Util.del_opt_ws "" . label "loginModuleClass" . (store word . Util.del_ws_spc) . flag] + + let content = (Util.empty | Util.comment_c_style | Util.comment_multiline | loginModuleClass)* + let loginModule = [Util.del_opt_ws "" . label "login" . (store word . lbrace) . (content . rbrace)] +- + let lns = (Util.empty | Util.comment_c_style | Util.comment_multiline | loginModule)* + let filter = incl "/opt/shibboleth-idp/conf/login.config" + let xfm = transform lns filter +diff --git a/lenses/tests/test_jaas.aug b/lenses/tests/test_jaas.aug +index 5f2bfb1..d5ede69 100644 +--- a/lenses/tests/test_jaas.aug ++++ b/lenses/tests/test_jaas.aug +@@ -54,7 +54,6 @@ ShibUserPassAuth { + serviceCredential = \"ldappassword\" + ssl = \"false\" + userField = \"uid\" +- // Example comment within definition + subtreeSearch = \"true\"; + }; + +@@ -64,8 +63,9 @@ NetAccountAuth { + }; + + com.sun.security.jgss.krb5.initiate { +- // Test of omitted linebreaks and naked boolean +- com.sun.security.auth.module.Krb5LoginModule required useTicketCache=true; ++ // Test of naked boolean ++ com.sun.security.auth.module.Krb5LoginModule required ++ useTicketCache=true; + };" + + test Jaas.lns get conf = +@@ -90,6 +90,7 @@ test Jaas.lns get conf = + { } + { "login" = "ShibUserPassAuth" + { } ++ { } + { "#comment" = "Example LDAP authentication" } + { "#comment" = "See: https://wiki.shibboleth.net/confluence/display/SHIB2/IdPAuthUserPass" } + { "#mcomment" +@@ -116,29 +117,27 @@ test Jaas.lns get conf = + { "serviceCredential" = "\"ldappassword\"" } + { "ssl" = "\"false\"" } + { "userField" = "\"uid\"" } +- { "#comment" = "Example comment within definition" } +- { "subtreeSearch" = "\"true\"" } ++ { "subtreeSearch" = "\"true\";" } + } + } +- { } + } + { } + { } + { "login" = "NetAccountAuth" ++ { } + { "#comment" = "Test of optionless flag" } + { "loginModuleClass" = "nz.ac.auckland.jaas.Krb5LoginModule" +- { "flag" = "required" } ++ { "flag" = "required;" } + } +- { } + } + { } + { } + { "login" = "com.sun.security.jgss.krb5.initiate" +- { "#comment" = "Test of omitted linebreaks and naked boolean" } ++ { } ++ { "#comment" = "Test of naked boolean" } + { "loginModuleClass" = "com.sun.security.auth.module.Krb5LoginModule" + { "flag" = "required" +- { "useTicketCache" = "true" } ++ { "useTicketCache" = "true;" } + } + } +- { } + } diff --git a/SOURCES/0003-Sysconfig-permit-empty-comments-after-comment-lines.patch b/SOURCES/0003-Sysconfig-permit-empty-comments-after-comment-lines.patch deleted file mode 100644 index acd63ce..0000000 --- a/SOURCES/0003-Sysconfig-permit-empty-comments-after-comment-lines.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 92274bd3ff47d3cc4511d934dae06f16b59db7ad Mon Sep 17 00:00:00 2001 -From: Dominic Cleal -Date: Mon, 16 Dec 2013 20:45:36 +0000 -Subject: [PATCH] Sysconfig: permit empty comments after comment lines - -Fixes RHBZ#1043636 ---- - lenses/sysconfig.aug | 3 ++- - lenses/tests/test_sysconfig.aug | 4 ++++ - 2 files changed, 6 insertions(+), 1 deletion(-) - -diff --git a/lenses/sysconfig.aug b/lenses/sysconfig.aug -index a39d7f3..ee83af1 100644 ---- a/lenses/sysconfig.aug -+++ b/lenses/sysconfig.aug -@@ -11,7 +11,8 @@ module Sysconfig = - let key_re = Shellvars.key_re - let eq = Util.del_str "=" - -- let comment = Util.comment -+ let eol_for_comment = del /([ \t]*\n)([ \t]*(#[ \t]*)?\n)*/ "\n" -+ let comment = Util.comment_generic_seteol /[ \t]*#[ \t]*/ "# " eol_for_comment - let comment_or_eol = Shellvars.comment_or_eol - - let empty = Util.empty -diff --git a/lenses/tests/test_sysconfig.aug b/lenses/tests/test_sysconfig.aug -index 3e9356d..539ad99 100644 ---- a/lenses/tests/test_sysconfig.aug -+++ b/lenses/tests/test_sysconfig.aug -@@ -142,6 +142,10 @@ unset ONBOOT # We do not want this var - test lns put "var=v\n" after set "/var" "v\"w"= - "var='v\"w'\n" - -+ (* RHBZ#1043636: empty comment lines after comments *) -+ test lns get "#MOUNTD_NFS_V3\n#\n" = -+ { "#comment" = "MOUNTD_NFS_V3" } -+ - (* Local Variables: *) - (* mode: caml *) - (* End: *) --- -1.8.4.2 - diff --git a/SOURCES/0004-UpdateDB-autoload-etc-updatedb.conf-with-Simplevars.patch b/SOURCES/0004-UpdateDB-autoload-etc-updatedb.conf-with-Simplevars.patch new file mode 100644 index 0000000..0a27c25 --- /dev/null +++ b/SOURCES/0004-UpdateDB-autoload-etc-updatedb.conf-with-Simplevars.patch @@ -0,0 +1,48 @@ +From 8bf9bc98456ffa456127e87721461d0aeedd090d Mon Sep 17 00:00:00 2001 +From: Dominic Cleal +Date: Fri, 12 Jun 2015 10:46:57 +0100 +Subject: [PATCH] UpdateDB: autoload /etc/updatedb.conf with Simplevars + +updatedb.conf was loaded with Simplevars in Augeas 1.1.0, so continue +for compatibility. Use aug_transform, augtool --transform etc. to use +the newer, different, UpdateDB lens. +--- + lenses/simplevars.aug | 1 + + lenses/updatedb.aug | 8 -------- + 2 files changed, 1 insertion(+), 8 deletions(-) + +diff --git a/lenses/simplevars.aug b/lenses/simplevars.aug +index ad9795f..ff0602c 100644 +--- a/lenses/simplevars.aug ++++ b/lenses/simplevars.aug +@@ -41,6 +41,7 @@ let lns = (Util.empty | Util.comment | entry)* + (* Variable: filter *) + let filter = incl "/etc/kernel-img.conf" + . incl "/etc/kerneloops.conf" ++ . incl "/etc/updatedb.conf" + . incl "/etc/wgetrc" + . incl "/etc/zabbix/*.conf" + . incl "/etc/audit/auditd.conf" +diff --git a/lenses/updatedb.aug b/lenses/updatedb.aug +index 40cd26f..c7309b1 100644 +--- a/lenses/updatedb.aug ++++ b/lenses/updatedb.aug +@@ -22,8 +22,6 @@ About: Examples + + module UpdateDB = + +-autoload xfm +- + (* View: list + A list entry *) + let list = +@@ -41,9 +39,3 @@ let bool = [ key "PRUNE_BIND_MOUNTS" . Sep.space_equal + (* View: lns + The lens *) + let lns = (Util.empty|Util.comment|list|bool)* +- +-(* Variable: filter +- The filter *) +-let filter = incl "/etc/updatedb.conf" +- +-let xfm = transform lns filter diff --git a/SOURCES/0004-tests-test-load.c-testPermsErrorReported-skip-permis.patch b/SOURCES/0004-tests-test-load.c-testPermsErrorReported-skip-permis.patch deleted file mode 100644 index 97f65a7..0000000 --- a/SOURCES/0004-tests-test-load.c-testPermsErrorReported-skip-permis.patch +++ /dev/null @@ -1,38 +0,0 @@ -From b0fa354ecada84f7a4fdf586c08ae99ca2dd9a65 Mon Sep 17 00:00:00 2001 -From: Dominic Cleal -Date: Mon, 2 Sep 2013 18:29:49 +0100 -Subject: [PATCH] * tests/test-load.c (testPermsErrorReported): skip - permissions test when root - ---- - tests/test-load.c | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/tests/test-load.c b/tests/test-load.c -index ef6c01a..fb63a62 100644 ---- a/tests/test-load.c -+++ b/tests/test-load.c -@@ -21,6 +21,8 @@ - */ - - #include -+#include -+#include - - #include "augeas.h" - -@@ -529,6 +531,11 @@ static void testParseErrorReported(CuTest *tc) { - - /* Test failed file opening is reported, e.g. EACCES */ - static void testPermsErrorReported(CuTest *tc) { -+ if (getuid() == 0) { -+ puts("pending (testPermsErrorReported): can't test permissions under root account"); -+ return; -+ } -+ - augeas *aug = NULL; - int r; - const char *s; --- -1.8.4.2 - diff --git a/SOURCES/0005-Revert-Dnsmasq-add-structure-to-address-and-server-o.patch b/SOURCES/0005-Revert-Dnsmasq-add-structure-to-address-and-server-o.patch new file mode 100644 index 0000000..057a905 --- /dev/null +++ b/SOURCES/0005-Revert-Dnsmasq-add-structure-to-address-and-server-o.patch @@ -0,0 +1,135 @@ +From 0bd17cf52195d54e28eb0e2d47e219615c62ebb9 Mon Sep 17 00:00:00 2001 +From: Dominic Cleal +Date: Fri, 12 Jun 2015 10:48:58 +0100 +Subject: [PATCH] Revert "Dnsmasq: add structure to 'address' and 'server' + options" + +This reverts commit 3e20740056bd548f714cd50e4adc6b76a249ddfc for tree +compatibility with Augeas 1.1.0. address and server options will be +unstructured. + +Conflicts: + NEWS +--- + lenses/dnsmasq.aug | 34 +++++++++---------------------- + lenses/tests/test_dnsmasq.aug | 47 ------------------------------------------- + 2 files changed, 9 insertions(+), 72 deletions(-) + +diff --git a/lenses/dnsmasq.aug b/lenses/dnsmasq.aug +index f7ef907..e19aab8 100644 +--- a/lenses/dnsmasq.aug ++++ b/lenses/dnsmasq.aug +@@ -17,42 +17,26 @@ module Dnsmasq = + * USEFUL PRIMITIVES + *************************************************************************) + +-let eol = Util.eol +-let spc = Util.del_ws_spc +-let comment = Util.comment +-let empty = Util.empty ++let eol = Util.eol ++let spc = Util.del_ws_spc ++let comment = Util.comment ++let empty = Util.empty + +-let sep_eq = Sep.equal +-let sto_to_eol = store /([^ \t\n].*[^ \t\n]|[^ \t\n])/ +- +-let slash = Util.del_str "/" +-let sto_no_slash = store /([^\/ \t\n]+)/ +-let domains = slash . [ label "domain" . sto_no_slash . slash ]+ ++let sep_eq = del /=/ "=" ++let sto_to_eol = store /([^ \t\n].*[^ \t\n]|[^ \t\n])/ + + (************************************************************************ +- * SIMPLE ENTRIES ++ * ENTRIES + *************************************************************************) + +-let entry_re = Rx.word - /(address|server)/ ++let entry_re = /[A-Za-z0-9._-]+/ + let entry = [ key entry_re . (sep_eq . sto_to_eol)? . eol ] + + (************************************************************************ +- * STRUCTURED ENTRIES +- *************************************************************************) +- +-let address = [ key "address" . sep_eq . domains . sto_no_slash . eol ] +- +-let server = +- let port = [ Build.xchgs "#" "port" . store Rx.integer ] +- in let source = [ Build.xchgs "@" "source" . store /[^#\/ \t\n]+/ . port? ] +- in let srv_spec = store /(#|([^#@\/ \t\n]+))/ . port? . source? +- in [ key "server" . sep_eq . domains? . srv_spec? . eol ] +- +-(************************************************************************ + * LENS + *************************************************************************) + +-let lns = (comment|empty|address|server|entry) * ++let lns = (comment|empty|entry) * + + let filter = incl "/etc/dnsmasq.conf" + . incl "/etc/dnsmasq.d/*" +diff --git a/lenses/tests/test_dnsmasq.aug b/lenses/tests/test_dnsmasq.aug +index c6a63d9..0abfa6b 100644 +--- a/lenses/tests/test_dnsmasq.aug ++++ b/lenses/tests/test_dnsmasq.aug +@@ -6,16 +6,6 @@ let conf = "# Configuration file for dnsmasq. + + conf-dir=/etc/dnsmasq.d + selfmx +- +-address=/foo.com/bar.net/10.1.2.3 +- +-server=10.4.5.6#1234 +-server=/bar.com/foo.net/10.7.8.9 +-server=/foo.org/bar.org/10.3.2.1@eth0#5678 +-server=/baz.org/# +-server=/baz.net/#@eth1 +-server=10.6.5.4#1234@eth0#5678 +-server=/qux.com/qux.net/ + " + + test Dnsmasq.lns get conf = +@@ -25,40 +15,3 @@ test Dnsmasq.lns get conf = + {} + { "conf-dir" = "/etc/dnsmasq.d" } + { "selfmx" } +- {} +- { "address" = "10.1.2.3" +- { "domain" = "foo.com" } +- { "domain" = "bar.net" } +- } +- {} +- { "server" = "10.4.5.6" +- { "port" = "1234" } +- } +- { "server" = "10.7.8.9" +- { "domain" = "bar.com" } +- { "domain" = "foo.net" } +- } +- { "server" = "10.3.2.1" +- { "domain" = "foo.org" } +- { "domain" = "bar.org" } +- { "source" = "eth0" +- { "port" = "5678" } +- } +- } +- { "server" = "#" +- { "domain" = "baz.org" } +- } +- { "server" = "#" +- { "domain" = "baz.net" } +- { "source" = "eth1" } +- } +- { "server" = "10.6.5.4" +- { "port" = "1234" } +- { "source" = "eth0" +- { "port" = "5678" } +- } +- } +- { "server" +- { "domain" = "qux.com" } +- { "domain" = "qux.net" } +- } diff --git a/SOURCES/0005-Shellvars-Sysconfig-map-bare-export-and-unset-lines-.patch b/SOURCES/0005-Shellvars-Sysconfig-map-bare-export-and-unset-lines-.patch deleted file mode 100644 index 7ce0fad..0000000 --- a/SOURCES/0005-Shellvars-Sysconfig-map-bare-export-and-unset-lines-.patch +++ /dev/null @@ -1,132 +0,0 @@ -From c40fc2b24f9f3b104603e3d19ff2b0975b1af9cc Mon Sep 17 00:00:00 2001 -From: Dominic Cleal -Date: Thu, 2 Jan 2014 13:50:41 +0000 -Subject: [PATCH] Shellvars, Sysconfig: map "bare" export and unset lines using - seq to handle multiple variables - -Fixes RHBZ#1033795 - -(cherry picked from commit 15ec3753b0ba82e155426288572f6b92c3cafc59) - -Conflicts: - NEWS - lenses/tests/test_shellvars.aug ---- - lenses/shellvars.aug | 6 ++++-- - lenses/tests/test_shellvars.aug | 21 ++++++++++++++++----- - lenses/tests/test_sysconfig.aug | 8 +++++--- - 3 files changed, 25 insertions(+), 10 deletions(-) - -diff --git a/lenses/shellvars.aug b/lenses/shellvars.aug -index a88ad83..da19379 100644 ---- a/lenses/shellvars.aug -+++ b/lenses/shellvars.aug -@@ -63,8 +63,10 @@ module Shellvars = - . eq . (simple_value | array) . comment_or_eol ] - - let var_action (name:string) = -- [ Util.indent . xchgs name ("@" . name) . Util.del_ws_spc -- . store (key_re | matching_re) . comment_or_eol ] -+ Util.indent . del name name . Util.del_ws_spc . -+ [ label ("@" . name) . counter "var_action" -+ . Build.opt_list [ seq "var_action" . store (key_re | matching_re) ] Util.del_ws_spc -+ . comment_or_eol ] - - let unset = var_action "unset" - let bare_export = var_action "export" -diff --git a/lenses/tests/test_shellvars.aug b/lenses/tests/test_shellvars.aug -index 9aea433..79a5a4e 100644 ---- a/lenses/tests/test_shellvars.aug -+++ b/lenses/tests/test_shellvars.aug -@@ -30,7 +30,8 @@ unset ONBOOT # We do not want this var - { "#comment" = "DHCP_HOSTNAME=host.example.com" } - { "NETMASK" = "255.255.255.0" } - { "NETWORK" = "172.31.0.0" } -- { "@unset" = "ONBOOT" -+ { "@unset" -+ { "1" = "ONBOOT" } - { "#comment" = "We do not want this var" } } - - test lns put eth_static after -@@ -147,7 +148,8 @@ unset ONBOOT # We do not want this var - - (* Bug 109: allow a bare export *) - test lns get "export FOO\n" = -- { "@export" = "FOO" } -+ { "@export" -+ { "1" = "FOO" } } - - (* Bug 73: allow ulimit builtin *) - test lns get "ulimit -c unlimited\n" = -@@ -259,7 +261,8 @@ esac\n" = - { "@case_entry" = "/tmp/file2" - { ".source" = "/tmp/file2" } } - { "@case_entry" = "*" -- { "@unset" = "f" } } } -+ { "@unset" -+ { "1" = "f" } } } } - - (* Select *) - test lns get "select i in a b c; do . /tmp/file$i -@@ -346,7 +349,8 @@ esac\n" = - { "#comment" = "comment before 2" } - { "@case_entry" = "*" - { "#comment" = "comment in 2" } -- { "@unset" = "f" } } -+ { "@unset" -+ { "1" = "f" } } } - { "#comment" = "comment after" } } - - (* Empty case *) -@@ -397,7 +401,8 @@ esac\n" = - - (* unset can be used on wildcard variables *) - test Shellvars.lns get "unset ${!LC_*}\n" = -- { "@unset" = "${!LC_*}" } -+ { "@unset" -+ { "1" = "${!LC_*}" } } - - (* Empty comment before entries *) - test Shellvars.lns get "# \nfoo=bar\n" = -@@ -435,6 +440,12 @@ esac\n" = - { "#comment" = "foo" } - { "foo" = "bar" } - -+ (* Export of multiple variables, RHBZ#1033795 *) -+ test lns get "export TestVar1 TestVar2\n" = -+ { "@export" -+ { "1" = "TestVar1" } -+ { "2" = "TestVar2" } } -+ - (* Local Variables: *) - (* mode: caml *) - (* End: *) -diff --git a/lenses/tests/test_sysconfig.aug b/lenses/tests/test_sysconfig.aug -index 539ad99..fa1601a 100644 ---- a/lenses/tests/test_sysconfig.aug -+++ b/lenses/tests/test_sysconfig.aug -@@ -30,8 +30,9 @@ unset ONBOOT # We do not want this var - { "#comment" = "DHCP_HOSTNAME=host.example.com" } - { "NETMASK" = "255.255.255.0" } - { "NETWORK" = "172.31.0.0" } -- { "@unset" = "ONBOOT" -- { "#comment" = "We do not want this var" } } -+ { "@unset" -+ { "1" = "ONBOOT" } -+ { "#comment" = "We do not want this var" } } - - test lns put eth_static after - set "BOOTPROTO" "dhcp" ; -@@ -124,7 +125,8 @@ unset ONBOOT # We do not want this var - - (* Bug 109: allow a bare export *) - test lns get "export FOO\n" = -- { "@export" = "FOO" } -+ { "@export" -+ { "1" = "FOO" } } - - (* Check we put quotes in when changes require them *) - test lns put "var=\"v\"\n" after rm "/foo" = --- -1.8.4.2 - diff --git a/SOURCES/0006-Fix-umask-handling-when-creating-new-files.patch b/SOURCES/0006-Fix-umask-handling-when-creating-new-files.patch deleted file mode 100644 index 1496bc0..0000000 --- a/SOURCES/0006-Fix-umask-handling-when-creating-new-files.patch +++ /dev/null @@ -1,113 +0,0 @@ -From 0f7c1ef8e06413679928746c7206786210d3df1e Mon Sep 17 00:00:00 2001 -From: Dominic Cleal -Date: Mon, 2 Dec 2013 17:49:35 +0000 -Subject: [PATCH] Fix umask handling when creating new files - - * src/transform.c (transform_save): faulty umask arithmetic would cause - overly-open file modes when the umask contains "7", as the umask was - incorrectly subtracted from the target file mode - -Fixes CVE-2013-6412, RHBZ#1034261 - -(cherry picked from commit f5b4fc0ceb0e5a2be5f3a19f63ad936897a3ac26) ---- - src/transform.c | 2 +- - tests/test-save.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 49 insertions(+), 1 deletion(-) - -diff --git a/src/transform.c b/src/transform.c -index ccbe422..b0288fc 100644 ---- a/src/transform.c -+++ b/src/transform.c -@@ -1144,7 +1144,7 @@ int transform_save(struct augeas *aug, struct tree *xfm, - mode_t curumsk = umask(022); - umask(curumsk); - -- if (fchmod(fileno(fp), 0666 - curumsk) < 0) { -+ if (fchmod(fileno(fp), 0666 & ~curumsk) < 0) { - err_status = "create_chmod"; - return -1; - } -diff --git a/tests/test-save.c b/tests/test-save.c -index 617ef31..f28f626 100644 ---- a/tests/test-save.c -+++ b/tests/test-save.c -@@ -26,6 +26,7 @@ - #include "cutest.h" - - #include -+#include - #include - #include - -@@ -51,6 +52,7 @@ static void setup(CuTest *tc) { - if (asprintf(&lensdir, "%s/lenses", abs_top_srcdir) < 0) - CuFail(tc, "asprintf lensdir failed"); - -+ umask(0022); - run(tc, "test -d %s && chmod -R u+w %s || :", root, root); - run(tc, "rm -rf %s", root); - run(tc, "mkdir -p %s", root); -@@ -221,6 +223,49 @@ static void testDoubleSlashPath(CuTest *tc) { - CuAssertIntEquals(tc, 1, r); - } - -+/* Check the umask is followed when creating files -+ */ -+static void testUmask(CuTest *tc, int tumask, mode_t expected_mode) { -+ int r; -+ struct stat buf; -+ char* fpath = NULL; -+ -+ if (asprintf(&fpath, "%s/etc/test", root) < 0) { -+ CuFail(tc, "failed to set root"); -+ } -+ -+ umask(tumask); -+ -+ r = aug_rm(aug, "/augeas/load/*"); -+ CuAssertPositive(tc, r); -+ -+ r = aug_set(aug, "/augeas/load/Test/lens", "Simplelines.lns"); -+ CuAssertRetSuccess(tc, r); -+ r = aug_set(aug, "/augeas/load/Test/incl", "/etc/test"); -+ CuAssertRetSuccess(tc, r); -+ r = aug_load(aug); -+ CuAssertRetSuccess(tc, r); -+ r = aug_set(aug, "/files/etc/test/1", "test"); -+ CuAssertRetSuccess(tc, r); -+ -+ r = aug_save(aug); -+ CuAssertRetSuccess(tc, r); -+ r = aug_match(aug, "/augeas//error", NULL); -+ CuAssertIntEquals(tc, 0, r); -+ -+ CuAssertIntEquals(tc, 0, stat(fpath, &buf)); -+ CuAssertIntEquals(tc, expected_mode, buf.st_mode & 0777); -+} -+static void testUmask077(CuTest *tc) { -+ testUmask(tc, 0077, 0600); -+} -+static void testUmask027(CuTest *tc) { -+ testUmask(tc, 0027, 0640); -+} -+static void testUmask022(CuTest *tc) { -+ testUmask(tc, 0022, 0644); -+} -+ - int main(void) { - char *output = NULL; - CuSuite* suite = CuSuiteNew(); -@@ -245,6 +290,9 @@ int main(void) { - SUITE_ADD_TEST(suite, testMtime); - SUITE_ADD_TEST(suite, testRelPath); - SUITE_ADD_TEST(suite, testDoubleSlashPath); -+ SUITE_ADD_TEST(suite, testUmask077); -+ SUITE_ADD_TEST(suite, testUmask027); -+ SUITE_ADD_TEST(suite, testUmask022); - - CuSuiteRun(suite); - CuSuiteSummary(suite, &output); --- -1.8.4.2 - diff --git a/SOURCES/0006-Sshd-revert-Sshd-module-to-1.1.0-compatible-add-Sshd.patch b/SOURCES/0006-Sshd-revert-Sshd-module-to-1.1.0-compatible-add-Sshd.patch new file mode 100644 index 0000000..4bf007c --- /dev/null +++ b/SOURCES/0006-Sshd-revert-Sshd-module-to-1.1.0-compatible-add-Sshd.patch @@ -0,0 +1,487 @@ +From 0ee63c599098d6ee401bfbc994b2e7e3bfb3dd42 Mon Sep 17 00:00:00 2001 +From: Dominic Cleal +Date: Fri, 12 Jun 2015 11:01:57 +0100 +Subject: [PATCH] Sshd: revert Sshd module to 1.1.0-compatible, add Sshd_140 + +In order to keep the default sshd config lens compatible with 1.1.0, +the lens from 1.4.0 has been kept in the Sshd_140 module and is not +loaded by default. Use aug_transform, augtool --transform etc. to use +it instead of Sshd. +--- + lenses/sshd.aug | 52 ++++++--------- + lenses/sshd_140.aug | 141 +++++++++++++++++++++++++++++++++++++++++ + lenses/tests/test_sshd.aug | 56 ---------------- + lenses/tests/test_sshd_140.aug | 136 +++++++++++++++++++++++++++++++++++++++ + tests/Makefile.am | 1 + + 5 files changed, 298 insertions(+), 88 deletions(-) + create mode 100644 lenses/sshd_140.aug + create mode 100644 lenses/tests/test_sshd_140.aug + +diff --git a/lenses/sshd.aug b/lenses/sshd.aug +index 55f6c4f..785102e 100644 +--- a/lenses/sshd.aug ++++ b/lenses/sshd.aug +@@ -70,55 +70,41 @@ module Sshd = + + let sep = Util.del_ws_spc + +- let indent = del /[ \t]*/ " " +- + let key_re = /[A-Za-z0-9]+/ +- - /MACs|Match|AcceptEnv|Subsystem|Ciphers|KexAlgorithms|(Allow|Deny)(Groups|Users)/i ++ - /MACs|Match|AcceptEnv|Subsystem|(Allow|Deny)(Groups|Users)/ + + let comment = Util.comment +- let comment_noindent = Util.comment_noindent + let empty = Util.empty + +- let array_entry (kw:regexp) (sq:string) = ++ let array_entry (k:string) = + let value = store /[^ \t\n]+/ in +- [ key kw . [ sep . seq sq . value]* . eol ] ++ [ key k . [ sep . seq k . value]* . eol ] + + let other_entry = + let value = store /[^ \t\n]+([ \t]+[^ \t\n]+)*/ in + [ key key_re . sep . value . eol ] + +- let accept_env = array_entry /AcceptEnv/i "AcceptEnv" ++ let accept_env = array_entry "AcceptEnv" + +- let allow_groups = array_entry /AllowGroups/i "AllowGroups" +- let allow_users = array_entry /AllowUsers/i "AllowUsers" +- let deny_groups = array_entry /DenyGroups/i "DenyGroups" +- let deny_users = array_entry /DenyUsers/i "DenyUsers" ++ let allow_groups = array_entry "AllowGroups" ++ let allow_users = array_entry "AllowUsers" ++ let deny_groups = array_entry "DenyGroups" ++ let deny_users = array_entry "DenyUsers" + + let subsystemvalue = + let value = store (/[^ \t\n](.*[^ \t\n])?/) in + [ key /[A-Za-z0-9\-]+/ . sep . value . eol ] + + let subsystem = +- [ key /Subsystem/i . sep . subsystemvalue ] ++ [ key "Subsystem" . sep . subsystemvalue ] + +- let list (kw:regexp) (sq:string) = +- let value = store /[^, \t\n]+/ in +- [ key kw . sep . +- [ seq sq . value ] . +- ([ seq sq . Util.del_str "," . value])* . ++ let macs = ++ let mac_value = store /[^, \t\n]+/ in ++ [ key "MACs" . sep . ++ [ seq "macs" . mac_value ] . ++ ([ seq "macs" . Util.del_str "," . mac_value])* . + eol ] + +- let macs = list /MACs/i "MACs" +- +- let ciphers = list /Ciphers/i "Ciphers" +- +- let kexalgorithms = list /KexAlgorithms/i "KexAlgorithms" +- +- let entry = accept_env | allow_groups | allow_users +- | deny_groups | subsystem | deny_users +- | macs | ciphers | kexalgorithms +- | other_entry +- + let condition_entry = + let value = store /[^ \t\n]+/ in + [ sep . key /[A-Za-z0-9]+/ . sep . value ] +@@ -126,15 +112,17 @@ module Sshd = + let match_cond = + [ label "Condition" . condition_entry+ . eol ] + +- let match_entry = indent . (entry | comment_noindent) +- | empty ++ let match_entry = ++ ( comment | empty | (Util.indent . other_entry) ) + + let match = +- [ key /Match/i . match_cond ++ [ key "Match" . match_cond + . [ label "Settings" . match_entry+ ] + ] + +- let lns = (entry | comment | empty)* . match* ++ let lns = (comment | empty | accept_env | allow_groups | allow_users ++ | deny_groups | subsystem | deny_users | macs ++ | other_entry ) * . match* + + let xfm = transform lns (incl "/etc/ssh/sshd_config") + +diff --git a/lenses/sshd_140.aug b/lenses/sshd_140.aug +new file mode 100644 +index 0000000..8a7f176 +--- /dev/null ++++ b/lenses/sshd_140.aug +@@ -0,0 +1,141 @@ ++(* ++Module: Sshd_140 ++ Parses /etc/ssh/sshd_config ++ ++ This module is compatible with Augeas 1.4.0, but is not loaded by default. ++ ++Author: David Lutterkort lutter@redhat.com ++ Dominique Dumont dominique.dumont@hp.com ++ ++About: Reference ++ sshd_config man page. ++ See http://www.openbsd.org/cgi-bin/man.cgi?query=sshd_config&sektion=5 ++ ++About: License ++ This file is licensed under the LGPL v2+. ++ ++About: Lens Usage ++ Sample usage of this lens in augtool: ++ ++ * Get your current setup ++ > print /files/etc/ssh/sshd_config ++ ... ++ ++ * Set X11Forwarding to "no" ++ > set /files/etc/ssh/sshd_config/X11Forwarding "no" ++ ++ More advanced usage: ++ ++ * Set a Match section ++ > set /files/etc/ssh/sshd_config/Match[1]/Condition/User "foo" ++ > set /files/etc/ssh/sshd_config/Match[1]/Settings/X11Forwarding "yes" ++ ++ Saving your file: ++ ++ > save ++ ++ ++About: CAVEATS ++ ++ In sshd_config, Match blocks must be located at the end of the file. ++ This means that any new "global" parameters (i.e. outside of a Match ++ block) must be written before the first Match block. By default, ++ Augeas will write new parameters at the end of the file. ++ ++ I.e. if you have a Match section and no ChrootDirectory parameter, ++ this command: ++ ++ > set /files/etc/ssh/sshd_config/ChrootDirectory "foo" ++ ++ will be stored in a new node after the Match section and Augeas will ++ refuse to save sshd_config file. ++ ++ To create a new parameter as the right place, you must first create ++ a new Augeas node before the Match section: ++ ++ > ins ChrootDirectory before /files/etc/ssh/sshd_config/Match ++ ++ Then, you can set the parameter ++ ++ > set /files/etc/ssh/sshd_config/ChrootDirectory "foo" ++ ++ ++About: Configuration files ++ This lens applies to /etc/ssh/sshd_config ++ ++*) ++ ++module Sshd_140 = ++ let eol = del /[ \t]*\n/ "\n" ++ ++ let sep = Util.del_ws_spc ++ ++ let indent = del /[ \t]*/ " " ++ ++ let key_re = /[A-Za-z0-9]+/ ++ - /MACs|Match|AcceptEnv|Subsystem|Ciphers|KexAlgorithms|(Allow|Deny)(Groups|Users)/i ++ ++ let comment = Util.comment ++ let comment_noindent = Util.comment_noindent ++ let empty = Util.empty ++ ++ let array_entry (kw:regexp) (sq:string) = ++ let value = store /[^ \t\n]+/ in ++ [ key kw . [ sep . seq sq . value]* . eol ] ++ ++ let other_entry = ++ let value = store /[^ \t\n]+([ \t]+[^ \t\n]+)*/ in ++ [ key key_re . sep . value . eol ] ++ ++ let accept_env = array_entry /AcceptEnv/i "AcceptEnv" ++ ++ let allow_groups = array_entry /AllowGroups/i "AllowGroups" ++ let allow_users = array_entry /AllowUsers/i "AllowUsers" ++ let deny_groups = array_entry /DenyGroups/i "DenyGroups" ++ let deny_users = array_entry /DenyUsers/i "DenyUsers" ++ ++ let subsystemvalue = ++ let value = store (/[^ \t\n](.*[^ \t\n])?/) in ++ [ key /[A-Za-z0-9\-]+/ . sep . value . eol ] ++ ++ let subsystem = ++ [ key /Subsystem/i . sep . subsystemvalue ] ++ ++ let list (kw:regexp) (sq:string) = ++ let value = store /[^, \t\n]+/ in ++ [ key kw . sep . ++ [ seq sq . value ] . ++ ([ seq sq . Util.del_str "," . value])* . ++ eol ] ++ ++ let macs = list /MACs/i "MACs" ++ ++ let ciphers = list /Ciphers/i "Ciphers" ++ ++ let kexalgorithms = list /KexAlgorithms/i "KexAlgorithms" ++ ++ let entry = accept_env | allow_groups | allow_users ++ | deny_groups | subsystem | deny_users ++ | macs | ciphers | kexalgorithms ++ | other_entry ++ ++ let condition_entry = ++ let value = store /[^ \t\n]+/ in ++ [ sep . key /[A-Za-z0-9]+/ . sep . value ] ++ ++ let match_cond = ++ [ label "Condition" . condition_entry+ . eol ] ++ ++ let match_entry = indent . (entry | comment_noindent) ++ | empty ++ ++ let match = ++ [ key /Match/i . match_cond ++ . [ label "Settings" . match_entry+ ] ++ ] ++ ++ let lns = (entry | comment | empty)* . match* ++ ++(* Local Variables: *) ++(* mode: caml *) ++(* End: *) +diff --git a/lenses/tests/test_sshd.aug b/lenses/tests/test_sshd.aug +index 5954e16..788a12f 100644 +--- a/lenses/tests/test_sshd.aug ++++ b/lenses/tests/test_sshd.aug +@@ -1,4 +1,3 @@ +-(* Module: Test_sshd *) + module Test_sshd = + + let accept_env = "Protocol 2 +@@ -75,61 +74,6 @@ Match User sarko Group pres.* + Match User bush Group pres.* Host white.house.* + Banner /etc/welcome.txt\n" + +-(* Test: Sshd.lns +- Indent when adding to a Match group *) +- test Sshd.lns put match_blocks after +- set "Match[1]/Settings/PermitRootLogin" "yes"; +- set "Match[1]/Settings/#comment" "a comment" = +-"X11Forwarding yes +-Match User sarko Group pres.* +- Banner /etc/bienvenue.txt +- X11Forwarding no +- PermitRootLogin yes +- # a comment +-Match User bush Group pres.* Host white.house.* +-Banner /etc/welcome.txt\n" +- +- +-(* Test: Sshd.lns +- Parse Ciphers and KexAlgorithms as lists (GH issue #69) *) +-test Sshd.lns get "Ciphers aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes128-ctr +-KexAlgorithms diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1\n" = +- { "Ciphers" +- { "1" = "aes256-gcm@openssh.com" } +- { "2" = "aes128-gcm@openssh.com" } +- { "3" = "aes256-ctr" } +- { "4" = "aes128-ctr" } +- } +- { "KexAlgorithms" +- { "1" = "diffie-hellman-group-exchange-sha256" } +- { "2" = "diffie-hellman-group14-sha1" } +- { "3" = "diffie-hellman-group-exchange-sha1" } +- } +- +-(* Test: Sshd.lns +- Keys are case-insensitive *) +-test Sshd.lns get "ciPheRs aes256-gcm@openssh.com,aes128-ctr +-maTcH User foo +- x11forwarding no\n" = +- { "ciPheRs" +- { "1" = "aes256-gcm@openssh.com" } +- { "2" = "aes128-ctr" } +- } +- { "maTcH" +- { "Condition" +- { "User" = "foo" } +- } +- { "Settings" +- { "x11forwarding" = "no" } +- } +- } +- +-(* Test: Sshd.lns +- Allow AllowGroups in Match groups (GH issue #75) *) +-test Sshd.lns get "Match User foo +-AllowGroups users\n" = +- { "Match" { "Condition" { "User" = "foo" } } +- { "Settings" { "AllowGroups" { "1" = "users" } } } } + + (* Local Variables: *) + (* mode: caml *) +diff --git a/lenses/tests/test_sshd_140.aug b/lenses/tests/test_sshd_140.aug +new file mode 100644 +index 0000000..056c53f +--- /dev/null ++++ b/lenses/tests/test_sshd_140.aug +@@ -0,0 +1,136 @@ ++(* Module: Test_sshd_140 *) ++module Test_sshd_140 = ++ ++ let accept_env = "Protocol 2 ++AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT ++AcceptEnv LC_IDENTIFICATION LC_ALL\n" ++ ++ test Sshd_140.lns get accept_env = ++ { "Protocol" = "2" } ++ { "AcceptEnv" ++ { "1" = "LC_PAPER" } ++ { "2" = "LC_NAME" } ++ { "3" = "LC_ADDRESS" } ++ { "4" = "LC_TELEPHONE" } ++ { "5" = "LC_MEASUREMENT" } } ++ { "AcceptEnv" ++ { "6" = "LC_IDENTIFICATION" } ++ { "7" = "LC_ALL" } } ++ ++ ++ test Sshd_140.lns get "HostKey /etc/ssh/ssh_host_rsa_key ++HostKey /etc/ssh/ssh_host_dsa_key\n" = ++ { "HostKey" = "/etc/ssh/ssh_host_rsa_key" } ++ { "HostKey" = "/etc/ssh/ssh_host_dsa_key" } ++ ++ ++ test Sshd_140.lns put accept_env after ++ rm "AcceptEnv"; ++ rm "AcceptEnv"; ++ set "Protocol" "1.5"; ++ set "X11Forwarding" "yes" ++ = "Protocol 1.5\nX11Forwarding yes\n" ++ ++ test Sshd_140.lns get "AuthorizedKeysFile %h/.ssh/authorized_keys\n" = ++ { "AuthorizedKeysFile" = "%h/.ssh/authorized_keys" } ++ ++ test Sshd_140.lns get "Subsystem sftp /usr/lib/openssh/sftp-server\n" = ++ { "Subsystem" ++ { "sftp" = "/usr/lib/openssh/sftp-server" } } ++ ++ test Sshd_140.lns get "Subsystem sftp-test /usr/lib/openssh/sftp-server\n" = ++ { "Subsystem" ++ { "sftp-test" = "/usr/lib/openssh/sftp-server" } } ++ ++ ++ ++ let match_blocks = "X11Forwarding yes ++Match User sarko Group pres.* ++ Banner /etc/bienvenue.txt ++ X11Forwarding no ++Match User bush Group pres.* Host white.house.* ++Banner /etc/welcome.txt ++" ++ test Sshd_140.lns get match_blocks = ++ { "X11Forwarding" = "yes"} ++ { "Match" ++ { "Condition" { "User" = "sarko" } ++ { "Group" = "pres.*" } } ++ { "Settings" { "Banner" = "/etc/bienvenue.txt" } ++ { "X11Forwarding" = "no" } } } ++ { "Match" ++ { "Condition" { "User" = "bush" } ++ { "Group" = "pres.*" } ++ { "Host" = "white.house.*" } } ++ { "Settings" { "Banner" = "/etc/welcome.txt" } } } ++ ++ test Sshd_140.lns put match_blocks after ++ insb "Subsystem" "/Match[1]"; ++ set "/Subsystem/sftp" "/usr/libexec/openssh/sftp-server" ++ = "X11Forwarding yes ++Subsystem sftp /usr/libexec/openssh/sftp-server ++Match User sarko Group pres.* ++ Banner /etc/bienvenue.txt ++ X11Forwarding no ++Match User bush Group pres.* Host white.house.* ++Banner /etc/welcome.txt\n" ++ ++(* Test: Sshd_140.lns ++ Indent when adding to a Match group *) ++ test Sshd_140.lns put match_blocks after ++ set "Match[1]/Settings/PermitRootLogin" "yes"; ++ set "Match[1]/Settings/#comment" "a comment" = ++"X11Forwarding yes ++Match User sarko Group pres.* ++ Banner /etc/bienvenue.txt ++ X11Forwarding no ++ PermitRootLogin yes ++ # a comment ++Match User bush Group pres.* Host white.house.* ++Banner /etc/welcome.txt\n" ++ ++ ++(* Test: Sshd_140.lns ++ Parse Ciphers and KexAlgorithms as lists (GH issue #69) *) ++test Sshd_140.lns get "Ciphers aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes128-ctr ++KexAlgorithms diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1\n" = ++ { "Ciphers" ++ { "1" = "aes256-gcm@openssh.com" } ++ { "2" = "aes128-gcm@openssh.com" } ++ { "3" = "aes256-ctr" } ++ { "4" = "aes128-ctr" } ++ } ++ { "KexAlgorithms" ++ { "1" = "diffie-hellman-group-exchange-sha256" } ++ { "2" = "diffie-hellman-group14-sha1" } ++ { "3" = "diffie-hellman-group-exchange-sha1" } ++ } ++ ++(* Test: Sshd_140.lns ++ Keys are case-insensitive *) ++test Sshd_140.lns get "ciPheRs aes256-gcm@openssh.com,aes128-ctr ++maTcH User foo ++ x11forwarding no\n" = ++ { "ciPheRs" ++ { "1" = "aes256-gcm@openssh.com" } ++ { "2" = "aes128-ctr" } ++ } ++ { "maTcH" ++ { "Condition" ++ { "User" = "foo" } ++ } ++ { "Settings" ++ { "x11forwarding" = "no" } ++ } ++ } ++ ++(* Test: Sshd_140.lns ++ Allow AllowGroups in Match groups (GH issue #75) *) ++test Sshd_140.lns get "Match User foo ++AllowGroups users\n" = ++ { "Match" { "Condition" { "User" = "foo" } } ++ { "Settings" { "AllowGroups" { "1" = "users" } } } } ++ ++(* Local Variables: *) ++(* mode: caml *) ++(* End: *) +diff --git a/tests/Makefile.am b/tests/Makefile.am +index b456354..387ac7d 100644 +--- a/tests/Makefile.am ++++ b/tests/Makefile.am +@@ -189,6 +189,7 @@ lens_tests = \ + lens-squid.sh \ + lens-ssh.sh \ + lens-sshd.sh \ ++ lens-sshd_140.sh \ + lens-sssd.sh \ + lens-stunnel.sh \ + lens-subversion.sh \ diff --git a/SOURCES/0007-Dhcpd-revert-Dhcpd-module-to-1.1.0-compatible-add-Dh.patch b/SOURCES/0007-Dhcpd-revert-Dhcpd-module-to-1.1.0-compatible-add-Dh.patch new file mode 100644 index 0000000..81176fd --- /dev/null +++ b/SOURCES/0007-Dhcpd-revert-Dhcpd-module-to-1.1.0-compatible-add-Dh.patch @@ -0,0 +1,1747 @@ +From 8cd5f1fc7917039f946098fd2c576f95df00a68f Mon Sep 17 00:00:00 2001 +From: Dominic Cleal +Date: Fri, 12 Jun 2015 11:09:09 +0100 +Subject: [PATCH] Dhcpd: revert Dhcpd module to 1.1.0-compatible, add Dhcpd_140 + +In order to keep the default sshd config lens compatible with 1.1.0, +the lens from 1.4.0 has been kept in the Dhcpd_140 module and is not +loaded by default. Use aug_transform, augtool --transform etc. to use +it instead of Dhcpd. +--- + lenses/dhcpd.aug | 182 +++--------- + lenses/dhcpd_140.aug | 512 +++++++++++++++++++++++++++++++++ + lenses/tests/test_dhcpd.aug | 214 +------------- + lenses/tests/test_dhcpd_140.aug | 606 ++++++++++++++++++++++++++++++++++++++++ + tests/Makefile.am | 1 + + 5 files changed, 1152 insertions(+), 363 deletions(-) + create mode 100644 lenses/dhcpd_140.aug + create mode 100644 lenses/tests/test_dhcpd_140.aug + +diff --git a/lenses/dhcpd.aug b/lenses/dhcpd.aug +index f84a409..21a5ce6 100644 +--- a/lenses/dhcpd.aug ++++ b/lenses/dhcpd.aug +@@ -65,12 +65,12 @@ let eos = comment? + let sep_spc = del /[ \t]+/ " " + let sep_osp = del /[ \t]*/ "" + let sep_scl = del /[ \t]*;([ \t]*\n)*/ ";\n" +-let sep_obr = del /[ \t\n]*\{([ \t]*\n)*/ " {\n" ++let sep_obr = del /[ \t]*\{([ \t]*\n)*/ " {\n" + let sep_cbr = del /[ \t]*\}([ \t]*\n)*/ "}\n" + let sep_com = del /[ \t\n]*,[ \t\n]*/ ", " + let sep_slh = del "\/" "/" + let sep_col = del ":" ":" +-let sep_eq = del /[ \t\n]*=[ \t\n]*/ "=" ++let sep_eq = del /[ \t]*=[ \t]*/ "=" + let scl = del ";" ";" + + (* Define basic types *) +@@ -94,11 +94,6 @@ let ip = Rx.ipv4 + let bare = del qchar? "" . store (bchar+) . del qchar? "" + let quote = Quote.do_quote (store (bchar* . /[ \t'\/]/ . bchar*)+) + let dquote = Quote.do_dquote (store (bchar+)) +- (* these two are for special cases. bare_to_scl is for any bareword that is +- * space or semicolon terminated. dquote_any allows almost any character in +- * between the quotes. *) +- let bare_to_scl = Quote.do_dquote_opt (store /[^" \t\n;]+/) +- let dquote_any = Quote.do_dquote (store /[^"\n]*[ \t]+[^"\n]*/) + + let sto_to_spc = store /[^\\#,;\{\}" \t\n]+|"[^\\#"\n]+"/ + let sto_to_scl = store /[^ \t;][^;\n=]+[^ \t;]|[^ \t;=]+/ +@@ -197,7 +192,6 @@ let stmt_string_re = "ddns-update-style" + | "use-lease-addr-for-default-route" + | "vendor-option-space" + | "primary" +- | "omapi-key" + + let stmt_string_tpl (kw:regexp) (l:lens) = [ indent + . key kw +@@ -230,51 +224,26 @@ let stmt_range = [ indent + let stmt_hardware = [ indent + . key "hardware" + . sep_spc +- . [ label "type" . store /ethernet|tokenring|fddi/ ] ++ . [ label "type" . store /ethernet|tokenring/ ] + . sep_spc + . [ label "address" . store /[a-fA-F0-9:-]+/ ] + . sep_scl + . eos ] + + (************************************************************************ +- * SET STATEMENTS +- *************************************************************************) +-let stmt_set = [ indent +- . key "set" +- . sep_spc +- . store word +- . sep_spc +- . Sep.equal +- . sep_spc +- . [ label "value" . sto_to_scl ] +- . sep_scl +- . eos ] +- +-(************************************************************************ + * OPTION STATEMENTS + *************************************************************************) + (* The general case is considering options as a list *) + ++let stmt_option_code = [ label "label" . store word . sep_spc ] ++ . [ key "code" . sep_spc . store word ] ++ . sep_eq ++ . [ label "type" . store word ] + +-let stmt_option_value = /((array of[ \t]+)?(((un)?signed[ \t]+)?integer (8|16|32)|string|ip6?-address|boolean|domain-list|text)|encapsulate [A-Za-z0-9_.-]+)/ + + let stmt_option_list = ([ label "arg" . bare ] | [ label "arg" . quote ]) + . ( sep_com . ([ label "arg" . bare ] | [ label "arg" . quote ]))* + +-let del_trail_spc = del /[ \t\n]*/ "" +- +-let stmt_record = counter "record" . Util.del_str "{" +- . sep_spc +- . ([seq "record" . store stmt_option_value . sep_com]* +- . [seq "record" . store stmt_option_value . del_trail_spc])? +- . Util.del_str "}" +- +-let stmt_option_code = [ label "label" . store word . sep_spc ] +- . [ key "code" . sep_spc . store word ] +- . sep_eq +- . ([ label "type" . store stmt_option_value ] +- |[ label "record" . stmt_record ]) +- + let stmt_option_basic = [ key word . sep_spc . stmt_option_list ] + let stmt_option_extra = [ key word . sep_spc . store /true|false/ . sep_spc . stmt_option_list ] + +@@ -302,13 +271,10 @@ let stmt_option = stmt_option1 | stmt_option2 + (* this statement is not well documented in the manual dhcpd.conf + we support basic use case *) + +-let stmt_subclass = [ indent . key "subclass" . sep_spc +- . ( [ label "name" . bare_to_scl ]|[ label "name" . dquote_any ] ) +- . sep_spc +- . ( [ label "value" . bare_to_scl ]|[ label "value" . dquote_any ] ) +- . sep_scl +- . eos ] +- ++let stmt_subclass = [ indent . key "subclass" . sep_spc . ++ ([ label "name" . quote ]| ++ [ label "name" . bare ]) . sep_spc . ++ [ label "value" . bare ] . sep_scl . eos ] + + (************************************************************************ + * ALLOW/DENY STATEMENTS +@@ -316,18 +282,10 @@ let stmt_subclass = [ indent . key "subclass" . sep_spc + (* We have to use special key for allow/deny members of + to avoid ambiguity in the put direction *) + +-let allow_deny_re = /unknown(-|[ ]+)clients/ +- | /known(-|[ ]+)clients/ +- | /all[ ]+clients/ ++let allow_deny_re = "unknown-clients" + | /dynamic[ ]+bootp[ ]+clients/ + | /authenticated[ ]+clients/ + | /unauthenticated[ ]+clients/ +- | "bootp" +- | "booting" +- | "duplicates" +- | "declines" +- | "client-updates" +- | "leasequery" + + let stmt_secu_re = "allow" + | "deny" +@@ -335,17 +293,9 @@ let stmt_secu_re = "allow" + let del_allow = del /allow[ ]+members[ ]+of/ "allow members of" + let del_deny = del /deny[ \t]+members[ \t]+of/ "deny members of" + +-(* bare is anything but whitespace, quote marks or semicolon. +- * technically this should be locked down to mostly alphanumerics, but the +- * idea right now is just to make things work. Also ideally I would use +- * dquote_space but I had a whale of a time with it. It doesn't like +- * semicolon termination and my attempts to fix that led me to 3 hours of +- * frustration and back to this :) +- *) + let stmt_secu_tpl (l:lens) (s:string) = +- [ indent . l . sep_spc . label s . bare_to_scl . sep_scl . eos ] | +- [ indent . l . sep_spc . label s . dquote_any . sep_scl . eos ] +- ++ [ indent . l . sep_spc . label s . bare . sep_scl . eos ] | ++ [ indent . l . sep_spc . label s . quote . sep_scl . eos ] + + let stmt_secu = [ indent . key stmt_secu_re . sep_spc . + store allow_deny_re . sep_scl . eos ] | +@@ -356,62 +306,17 @@ let stmt_secu = [ indent . key stmt_secu_re . sep_spc . + * MATCH STATEMENTS + *************************************************************************) + ++let sto_fct = store (word . /[ \t]*\([^)]*\)/) ++let sto_option = store (/option[ ]+/ . word) + let sto_com = /[^ \t\n,\(\)][^,\(\)]*[^ \t\n,\(\)]|[^ \t\n,\(\)]+/ | word . /[ \t]*\([^)]*\)/ +-(* this is already the most complicated part of this module and it's about to +- * get worse. match statements can be way more complicated than this +- * +- * examples: +- * using or: +- * match if ((option vendor-class-identifier="Banana Bready") or (option vendor-class-identifier="Cherry Sunfire")); +- * unneeded parenthesis: +- * match if (option vendor-class-identifier="Hello"); +- * +- * and of course the fact that the above two rules used one of infinately +- * many potential options instead of a builtin function. +- *) +-(* sto_com doesn't support quoted strings as arguments. It also doesn't +- support single arguments (needs to match a comma) It will need to be +- updated for lcase, ucase and log to be workable. +- +- it also doesn't support no arguments, so gethostbyname() doesn't work. +- +- option and config-option are considered operators. They should be matched +- in stmt_entry but also available under "match if" and "if" conditionals +- leased-address, host-decl-name, both take no args and return a value. We +- might need to treat them as variable names in the parser. +- +- things like this may be near-impossible to parse even with recursion +- because we have no way of knowing when or if a subfunction takes arguments +- set ClientMac = binary-to-ascii(16, 8, ":", substring(hardware, 1, 6)); +- +- even if we could parse it, they could get arbitrarily complicated like: +- binary-to-ascii(16, 8, ":", substring(hardware, 1, 6) and substring(hardware, 2, 3)); +- +- so at some point we may need to programmatically knock it off and tell +- people to put weird stuff in an include file that augeas doesn't parse. +- +- the other option is to change the API to not parse the if statement at all, +- just pull in the conditional as a string. +- *) +- +-let fct_re = "substring" | "binary-to-ascii" | "suffix" | "lcase" | "ucase" +- | "gethostbyname" | "packet" +- | "concat" | "reverse" | "encode-int" +- | "extract-int" | "lease-time" | "client-state" | "exists" | "known" | "static" +- | "pick-first-value" | "log" | "execute" +- +-(* not needs to be different because it's a negation of whatever happens next *) +-let op_re = "~="|"="|"~~"|"and"|"or" ++let fct_re = "substring" | "binary-to-ascii" + + let fct_args = [ label "args" . dels "(" . sep_osp . + ([ label "arg" . store sto_com ] . [ label "arg" . sep_com . store sto_com ]+) . + sep_osp . dels ")" ] + +-let stmt_match_ifopt = [ dels "if" . sep_spc . key "option" . sep_spc . store word . +- sep_eq . ([ label "value" . bare_to_scl ]|[ label "value" . dquote_any ]) ] +- +-let stmt_match_func = [ store fct_re . sep_osp . label "function" . fct_args ] . +- sep_eq . ([ label "value" . bare_to_scl ]|[ label "value" . dquote_any ]) ++let stmt_match_if = [ dels "if" . sep_spc . store fct_re . sep_osp . label "function" . fct_args ] . ++ sep_eq . ([ label "value" . bare ]|[ label "value" . quote ]) + + let stmt_match_pfv = [ label "function" . store "pick-first-value" . sep_spc . + dels "(" . sep_osp . +@@ -422,7 +327,7 @@ let stmt_match_pfv = [ label "function" . store "pick-first-value" . sep_spc . + + let stmt_match_tpl (l:lens) = [ indent . key "match" . sep_spc . l . sep_scl . eos ] + +-let stmt_match = stmt_match_tpl (dels "if" . sep_spc . stmt_match_func | stmt_match_pfv | stmt_match_ifopt) ++let stmt_match = stmt_match_tpl (stmt_match_if | stmt_match_pfv ) + + (************************************************************************ + * BLOCK STATEMENTS +@@ -438,11 +343,12 @@ let stmt_entry = stmt_secu + | stmt_noarg + | stmt_match + | stmt_subclass +- | stmt_set + | empty + | comment + +-let stmt_block_noarg_re = "pool" | "group" ++let stmt_block_noarg_re = "pool" ++ | "group" ++ | "allow-update" + + let stmt_block_noarg (body:lens) + = [ indent +@@ -456,14 +362,16 @@ let stmt_block_arg_re = "host" + | "shared-network" + | /failover[ ]+peer/ + | "zone" +- | "group" +- | "on" ++ | "key" + + let stmt_block_arg (body:lens) +- = ([ indent . key stmt_block_arg_re . sep_spc . dquote_any . sep_obr . body* . sep_cbr ] +- |[ indent . key stmt_block_arg_re . sep_spc . bare_to_scl . sep_obr . body* . sep_cbr ] +- |[ indent . del /key/ "key" . label "key_block" . sep_spc . dquote_any . sep_obr . body* . sep_cbr . del /(;([ \t]*\n)*)?/ "" ] +- |[ indent . del /key/ "key" . label "key_block" . sep_spc . bare_to_scl . sep_obr . body* . sep_cbr . del /(;([ \t]*\n)*)?/ "" ]) ++ = [ indent ++ . key stmt_block_arg_re ++ . sep_spc ++ . sto_to_spc ++ . sep_obr ++ . body* ++ . sep_cbr ] + + let stmt_block_subnet (body:lens) + = [ indent +@@ -476,37 +384,11 @@ let stmt_block_subnet (body:lens) + . body* + . sep_cbr ] + +-let conditional (body:lens) = +- let condition = /[^{ \r\t\n][^{\n]*[^{ \r\t\n]|[^{ \t\n\r]/ +- in let elsif = [ indent +- . Build.xchgs "elsif" "@elsif" +- . sep_spc +- . store condition +- . sep_obr +- . body* +- . sep_cbr ] +- in let else = [ indent +- . Build.xchgs "else" "@else" +- . sep_obr +- . body* +- . sep_cbr ] +- in [ indent +- . Build.xchgs "if" "@if" +- . sep_spc +- . store condition +- . sep_obr +- . body* +- . sep_cbr +- . elsif* +- . else? ] +- +- + let all_block (body:lens) = + let lns1 = stmt_block_subnet body in + let lns2 = stmt_block_arg body in + let lns3 = stmt_block_noarg body in +- let lns4 = conditional body in +- (lns1 | lns2 | lns3 | lns4 | stmt_entry) ++ (lns1 | lns2 | lns3 | stmt_entry) + + let rec lns_staging = stmt_entry|all_block lns_staging + let lns = (lns_staging)* +diff --git a/lenses/dhcpd_140.aug b/lenses/dhcpd_140.aug +new file mode 100644 +index 0000000..c907299 +--- /dev/null ++++ b/lenses/dhcpd_140.aug +@@ -0,0 +1,512 @@ ++(* ++Module: Dhcpd_140 ++ BIND dhcp 3 server configuration module for Augeas ++ ++ This module is compatible with Augeas 1.4.0, but is not loaded by default. ++ ++Author: Francis Giraldeau ++ ++About: Reference ++ Reference: manual of dhcpd.conf and dhcp-eval ++ Follow dhclient module for tree structure ++ ++About: License ++ This file is licensed under the GPL. ++ ++About: Lens Usage ++ Sample usage of this lens in augtool ++ ++ Directive without argument. ++ Set this dhcpd server authoritative on the domain. ++ > clear /files/etc/dhcp3/dhcpd.conf/authoritative ++ ++ Directives with integer or string argument. ++ Set max-lease-time to one hour: ++ > set /files/etc/dhcp3/dhcpd.conf/max-lease-time 3600 ++ ++ Options are declared as a list, even for single values. ++ Set the domain of the network: ++ > set /files/etc/dhcp3/dhcpd.conf/option/domain-name/arg example.org ++ Set two name server: ++ > set /files/etc/dhcp3/dhcpd.conf/option/domain-name-servers/arg[1] foo.example.org ++ > set /files/etc/dhcp3/dhcpd.conf/option/domain-name-servers/arg[2] bar.example.org ++ ++ Create the subnet 172.16.0.1 with 10 addresses: ++ > clear /files/etc/dhcp3/dhcpd.conf/subnet[last() + 1] ++ > set /files/etc/dhcp3/dhcpd.conf/subnet[last()]/network 172.16.0.0 ++ > set /files/etc/dhcp3/dhcpd.conf/subnet[last()]/netmask 255.255.255.0 ++ > set /files/etc/dhcp3/dhcpd.conf/subnet[last()]/range/from 172.16.0.10 ++ > set /files/etc/dhcp3/dhcpd.conf/subnet[last()]/range/to 172.16.0.20 ++ ++ Create a new group "foo" with one static host. Nodes type and address are ordered. ++ > ins group after /files/etc/dhcp3/dhcpd.conf/subnet[network='172.16.0.0']/*[last()] ++ > set /files/etc/dhcp3/dhcpd.conf/subnet[network='172.16.0.0']/group[last()]/host foo ++ > set /files/etc/dhcp3/dhcpd.conf/subnet[network='172.16.0.0']/group[host='foo']/host/hardware/type "ethernet" ++ > set /files/etc/dhcp3/dhcpd.conf/subnet[network='172.16.0.0']/group[host='foo']/host/hardware/address "00:00:00:aa:bb:cc" ++ > set /files/etc/dhcp3/dhcpd.conf/subnet[network='172.16.0.0']/group[host='foo']/host/fixed-address 172.16.0.100 ++ ++About: Configuration files ++ This lens applies to /etc/dhcpd3/dhcpd.conf. See . ++*) ++ ++module Dhcpd_140 = ++ ++(************************************************************************ ++ * USEFUL PRIMITIVES ++ *************************************************************************) ++let dels (s:string) = del s s ++let eol = Util.eol ++let comment = Util.comment ++let empty = Util.empty ++let indent = Util.indent ++let eos = comment? ++ ++(* Define separators *) ++let sep_spc = del /[ \t]+/ " " ++let sep_osp = del /[ \t]*/ "" ++let sep_scl = del /[ \t]*;([ \t]*\n)*/ ";\n" ++let sep_obr = del /[ \t\n]*\{([ \t]*\n)*/ " {\n" ++let sep_cbr = del /[ \t]*\}([ \t]*\n)*/ "}\n" ++let sep_com = del /[ \t\n]*,[ \t\n]*/ ", " ++let sep_slh = del "\/" "/" ++let sep_col = del ":" ":" ++let sep_eq = del /[ \t\n]*=[ \t\n]*/ "=" ++let scl = del ";" ";" ++ ++(* Define basic types *) ++let word = /[A-Za-z0-9_.-]+(\[[0-9]+\])?/ ++let ip = Rx.ipv4 ++ ++(* Define fields *) ++ ++(* adapted from sysconfig.aug *) ++ (* Chars allowed in a bare string *) ++ let bchar = /[^ \t\n"'\\{}#,()\/]|\\\\./ ++ let qchar = /["']/ (* " *) ++ ++ (* We split the handling of right hand sides into a few cases: ++ * bare - strings that contain no spaces, optionally enclosed in ++ * single or double quotes ++ * dquot - strings that contain at least one space, apostrophe or slash ++ * which must be enclosed in double quotes ++ * squot - strings that contain an unescaped double quote ++ *) ++ let bare = del qchar? "" . store (bchar+) . del qchar? "" ++ let quote = Quote.do_quote (store (bchar* . /[ \t'\/]/ . bchar*)+) ++ let dquote = Quote.do_dquote (store (bchar+)) ++ (* these two are for special cases. bare_to_scl is for any bareword that is ++ * space or semicolon terminated. dquote_any allows almost any character in ++ * between the quotes. *) ++ let bare_to_scl = Quote.do_dquote_opt (store /[^" \t\n;]+/) ++ let dquote_any = Quote.do_dquote (store /[^"\n]*[ \t]+[^"\n]*/) ++ ++let sto_to_spc = store /[^\\#,;\{\}" \t\n]+|"[^\\#"\n]+"/ ++let sto_to_scl = store /[^ \t;][^;\n=]+[^ \t;]|[^ \t;=]+/ ++ ++let sto_number = store /[0-9][0-9]*/ ++ ++(************************************************************************ ++ * NO ARG STATEMENTS ++ *************************************************************************) ++ ++let stmt_noarg_re = "authoritative" ++ | "primary" ++ | "secondary" ++ ++let stmt_noarg = [ indent ++ . key stmt_noarg_re ++ . sep_scl ++ . eos ] ++ ++(************************************************************************ ++ * INT ARG STATEMENTS ++ *************************************************************************) ++ ++let stmt_integer_re = "default-lease-time" ++ | "max-lease-time" ++ | "min-lease-time" ++ | /lease[ ]+limit/ ++ | "port" ++ | /peer[ ]+port/ ++ | "max-response-delay" ++ | "max-unacked-updates" ++ | "mclt" ++ | "split" ++ | /load[ ]+balance[ ]+max[ ]+seconds/ ++ | "max-lease-misbalance" ++ | "max-lease-ownership" ++ | "min-balance" ++ | "max-balance" ++ | "adaptive-lease-time-threshold" ++ | "dynamic-bootp-lease-length" ++ | "local-port" ++ | "min-sec" ++ | "omapi-port" ++ | "ping-timeout" ++ | "remote-port" ++ ++let stmt_integer = [ indent ++ . key stmt_integer_re ++ . sep_spc ++ . sto_number ++ . sep_scl ++ . eos ] ++ ++(************************************************************************ ++ * STRING ARG STATEMENTS ++ *************************************************************************) ++ ++let stmt_string_re = "ddns-update-style" ++ | "ddns-updates" ++ | "ddns-hostname" ++ | "ddns-domainname" ++ | "ddns-rev-domainname" ++ | "log-facility" ++ | "server-name" ++ | "fixed-address" ++ | /failover[ ]+peer/ ++ | "use-host-decl-names" ++ | "next-server" ++ | "address" ++ | /peer[ ]+address/ ++ | "type" ++ | "file" ++ | "algorithm" ++ | "secret" ++ | "key" ++ | "include" ++ | "hba" ++ | "boot-unknown-clients" ++ | "db-time-format" ++ | "do-forward-updates" ++ | "dynamic-bootp-lease-cutoff" ++ | "get-lease-hostnames" ++ | "infinite-is-reserved" ++ | "lease-file-name" ++ | "local-address" ++ | "one-lease-per-client" ++ | "pid-file-name" ++ | "ping-check" ++ | "server-identifier" ++ | "site-option-space" ++ | "stash-agent-options" ++ | "update-conflict-detection" ++ | "update-optimization" ++ | "update-static-leases" ++ | "use-host-decl-names" ++ | "use-lease-addr-for-default-route" ++ | "vendor-option-space" ++ | "primary" ++ | "omapi-key" ++ ++let stmt_string_tpl (kw:regexp) (l:lens) = [ indent ++ . key kw ++ . sep_spc ++ . l ++ . sep_scl ++ . eos ] ++ ++let stmt_string = stmt_string_tpl stmt_string_re bare ++ | stmt_string_tpl stmt_string_re quote ++ | stmt_string_tpl "filename" dquote ++ ++(************************************************************************ ++ * RANGE STATEMENTS ++ *************************************************************************) ++ ++let stmt_range = [ indent ++ . key "range" ++ . sep_spc ++ . [ label "flag" . store /dynamic-bootp/ . sep_spc ]? ++ . [ label "from" . store ip . sep_spc ]? ++ . [ label "to" . store ip ] ++ . sep_scl ++ . eos ] ++ ++(************************************************************************ ++ * HARDWARE STATEMENTS ++ *************************************************************************) ++ ++let stmt_hardware = [ indent ++ . key "hardware" ++ . sep_spc ++ . [ label "type" . store /ethernet|tokenring|fddi/ ] ++ . sep_spc ++ . [ label "address" . store /[a-fA-F0-9:-]+/ ] ++ . sep_scl ++ . eos ] ++ ++(************************************************************************ ++ * SET STATEMENTS ++ *************************************************************************) ++let stmt_set = [ indent ++ . key "set" ++ . sep_spc ++ . store word ++ . sep_spc ++ . Sep.equal ++ . sep_spc ++ . [ label "value" . sto_to_scl ] ++ . sep_scl ++ . eos ] ++ ++(************************************************************************ ++ * OPTION STATEMENTS ++ *************************************************************************) ++(* The general case is considering options as a list *) ++ ++ ++let stmt_option_value = /((array of[ \t]+)?(((un)?signed[ \t]+)?integer (8|16|32)|string|ip6?-address|boolean|domain-list|text)|encapsulate [A-Za-z0-9_.-]+)/ ++ ++let stmt_option_list = ([ label "arg" . bare ] | [ label "arg" . quote ]) ++ . ( sep_com . ([ label "arg" . bare ] | [ label "arg" . quote ]))* ++ ++let del_trail_spc = del /[ \t\n]*/ "" ++ ++let stmt_record = counter "record" . Util.del_str "{" ++ . sep_spc ++ . ([seq "record" . store stmt_option_value . sep_com]* ++ . [seq "record" . store stmt_option_value . del_trail_spc])? ++ . Util.del_str "}" ++ ++let stmt_option_code = [ label "label" . store word . sep_spc ] ++ . [ key "code" . sep_spc . store word ] ++ . sep_eq ++ . ([ label "type" . store stmt_option_value ] ++ |[ label "record" . stmt_record ]) ++ ++let stmt_option_basic = [ key word . sep_spc . stmt_option_list ] ++let stmt_option_extra = [ key word . sep_spc . store /true|false/ . sep_spc . stmt_option_list ] ++ ++let stmt_option_body = stmt_option_basic | stmt_option_extra ++ ++let stmt_option1 = [ indent ++ . key "option" ++ . sep_spc ++ . stmt_option_body ++ . sep_scl ++ . eos ] ++ ++let stmt_option2 = [ indent ++ . dels "option" . label "rfc-code" ++ . sep_spc ++ . stmt_option_code ++ . sep_scl ++ . eos ] ++ ++let stmt_option = stmt_option1 | stmt_option2 ++ ++(************************************************************************ ++ * SUBCLASS STATEMENTS ++ *************************************************************************) ++(* this statement is not well documented in the manual dhcpd.conf ++ we support basic use case *) ++ ++let stmt_subclass = [ indent . key "subclass" . sep_spc ++ . ( [ label "name" . bare_to_scl ]|[ label "name" . dquote_any ] ) ++ . sep_spc ++ . ( [ label "value" . bare_to_scl ]|[ label "value" . dquote_any ] ) ++ . sep_scl ++ . eos ] ++ ++ ++(************************************************************************ ++ * ALLOW/DENY STATEMENTS ++ *************************************************************************) ++(* We have to use special key for allow/deny members of ++ to avoid ambiguity in the put direction *) ++ ++let allow_deny_re = /unknown(-|[ ]+)clients/ ++ | /known(-|[ ]+)clients/ ++ | /all[ ]+clients/ ++ | /dynamic[ ]+bootp[ ]+clients/ ++ | /authenticated[ ]+clients/ ++ | /unauthenticated[ ]+clients/ ++ | "bootp" ++ | "booting" ++ | "duplicates" ++ | "declines" ++ | "client-updates" ++ | "leasequery" ++ ++let stmt_secu_re = "allow" ++ | "deny" ++ ++let del_allow = del /allow[ ]+members[ ]+of/ "allow members of" ++let del_deny = del /deny[ \t]+members[ \t]+of/ "deny members of" ++ ++(* bare is anything but whitespace, quote marks or semicolon. ++ * technically this should be locked down to mostly alphanumerics, but the ++ * idea right now is just to make things work. Also ideally I would use ++ * dquote_space but I had a whale of a time with it. It doesn't like ++ * semicolon termination and my attempts to fix that led me to 3 hours of ++ * frustration and back to this :) ++ *) ++let stmt_secu_tpl (l:lens) (s:string) = ++ [ indent . l . sep_spc . label s . bare_to_scl . sep_scl . eos ] | ++ [ indent . l . sep_spc . label s . dquote_any . sep_scl . eos ] ++ ++ ++let stmt_secu = [ indent . key stmt_secu_re . sep_spc . ++ store allow_deny_re . sep_scl . eos ] | ++ stmt_secu_tpl del_allow "allow-members-of" | ++ stmt_secu_tpl del_deny "deny-members-of" ++ ++(************************************************************************ ++ * MATCH STATEMENTS ++ *************************************************************************) ++ ++let sto_com = /[^ \t\n,\(\)][^,\(\)]*[^ \t\n,\(\)]|[^ \t\n,\(\)]+/ | word . /[ \t]*\([^)]*\)/ ++(* this is already the most complicated part of this module and it's about to ++ * get worse. match statements can be way more complicated than this ++ * ++ * examples: ++ * using or: ++ * match if ((option vendor-class-identifier="Banana Bready") or (option vendor-class-identifier="Cherry Sunfire")); ++ * unneeded parenthesis: ++ * match if (option vendor-class-identifier="Hello"); ++ * ++ * and of course the fact that the above two rules used one of infinately ++ * many potential options instead of a builtin function. ++ *) ++(* sto_com doesn't support quoted strings as arguments. It also doesn't ++ support single arguments (needs to match a comma) It will need to be ++ updated for lcase, ucase and log to be workable. ++ ++ it also doesn't support no arguments, so gethostbyname() doesn't work. ++ ++ option and config-option are considered operators. They should be matched ++ in stmt_entry but also available under "match if" and "if" conditionals ++ leased-address, host-decl-name, both take no args and return a value. We ++ might need to treat them as variable names in the parser. ++ ++ things like this may be near-impossible to parse even with recursion ++ because we have no way of knowing when or if a subfunction takes arguments ++ set ClientMac = binary-to-ascii(16, 8, ":", substring(hardware, 1, 6)); ++ ++ even if we could parse it, they could get arbitrarily complicated like: ++ binary-to-ascii(16, 8, ":", substring(hardware, 1, 6) and substring(hardware, 2, 3)); ++ ++ so at some point we may need to programmatically knock it off and tell ++ people to put weird stuff in an include file that augeas doesn't parse. ++ ++ the other option is to change the API to not parse the if statement at all, ++ just pull in the conditional as a string. ++ *) ++ ++let fct_re = "substring" | "binary-to-ascii" | "suffix" | "lcase" | "ucase" ++ | "gethostbyname" | "packet" ++ | "concat" | "reverse" | "encode-int" ++ | "extract-int" | "lease-time" | "client-state" | "exists" | "known" | "static" ++ | "pick-first-value" | "log" | "execute" ++ ++(* not needs to be different because it's a negation of whatever happens next *) ++let op_re = "~="|"="|"~~"|"and"|"or" ++ ++let fct_args = [ label "args" . dels "(" . sep_osp . ++ ([ label "arg" . store sto_com ] . [ label "arg" . sep_com . store sto_com ]+) . ++ sep_osp . dels ")" ] ++ ++let stmt_match_ifopt = [ dels "if" . sep_spc . key "option" . sep_spc . store word . ++ sep_eq . ([ label "value" . bare_to_scl ]|[ label "value" . dquote_any ]) ] ++ ++let stmt_match_func = [ store fct_re . sep_osp . label "function" . fct_args ] . ++ sep_eq . ([ label "value" . bare_to_scl ]|[ label "value" . dquote_any ]) ++ ++let stmt_match_pfv = [ label "function" . store "pick-first-value" . sep_spc . ++ dels "(" . sep_osp . ++ [ label "args" . ++ [ label "arg" . store sto_com ] . ++ [ sep_com . label "arg" . store sto_com ]+ ] . ++ dels ")" ] ++ ++let stmt_match_tpl (l:lens) = [ indent . key "match" . sep_spc . l . sep_scl . eos ] ++ ++let stmt_match = stmt_match_tpl (dels "if" . sep_spc . stmt_match_func | stmt_match_pfv | stmt_match_ifopt) ++ ++(************************************************************************ ++ * BLOCK STATEMENTS ++ *************************************************************************) ++(* Blocks doesn't support comments at the end of the closing bracket *) ++ ++let stmt_entry = stmt_secu ++ | stmt_option ++ | stmt_hardware ++ | stmt_range ++ | stmt_string ++ | stmt_integer ++ | stmt_noarg ++ | stmt_match ++ | stmt_subclass ++ | stmt_set ++ | empty ++ | comment ++ ++let stmt_block_noarg_re = "pool" | "group" ++ ++let stmt_block_noarg (body:lens) ++ = [ indent ++ . key stmt_block_noarg_re ++ . sep_obr ++ . body* ++ . sep_cbr ] ++ ++let stmt_block_arg_re = "host" ++ | "class" ++ | "shared-network" ++ | /failover[ ]+peer/ ++ | "zone" ++ | "group" ++ | "on" ++ ++let stmt_block_arg (body:lens) ++ = ([ indent . key stmt_block_arg_re . sep_spc . dquote_any . sep_obr . body* . sep_cbr ] ++ |[ indent . key stmt_block_arg_re . sep_spc . bare_to_scl . sep_obr . body* . sep_cbr ] ++ |[ indent . del /key/ "key" . label "key_block" . sep_spc . dquote_any . sep_obr . body* . sep_cbr . del /(;([ \t]*\n)*)?/ "" ] ++ |[ indent . del /key/ "key" . label "key_block" . sep_spc . bare_to_scl . sep_obr . body* . sep_cbr . del /(;([ \t]*\n)*)?/ "" ]) ++ ++let stmt_block_subnet (body:lens) ++ = [ indent ++ . key "subnet" ++ . sep_spc ++ . [ label "network" . store ip ] ++ . sep_spc ++ . [ key "netmask" . sep_spc . store ip ] ++ . sep_obr ++ . body* ++ . sep_cbr ] ++ ++let conditional (body:lens) = ++ let condition = /[^{ \r\t\n][^{\n]*[^{ \r\t\n]|[^{ \t\n\r]/ ++ in let elsif = [ indent ++ . Build.xchgs "elsif" "@elsif" ++ . sep_spc ++ . store condition ++ . sep_obr ++ . body* ++ . sep_cbr ] ++ in let else = [ indent ++ . Build.xchgs "else" "@else" ++ . sep_obr ++ . body* ++ . sep_cbr ] ++ in [ indent ++ . Build.xchgs "if" "@if" ++ . sep_spc ++ . store condition ++ . sep_obr ++ . body* ++ . sep_cbr ++ . elsif* ++ . else? ] ++ ++ ++let all_block (body:lens) = ++ let lns1 = stmt_block_subnet body in ++ let lns2 = stmt_block_arg body in ++ let lns3 = stmt_block_noarg body in ++ let lns4 = conditional body in ++ (lns1 | lns2 | lns3 | lns4 | stmt_entry) ++ ++let rec lns_staging = stmt_entry|all_block lns_staging ++let lns = (lns_staging)* +diff --git a/lenses/tests/test_dhcpd.aug b/lenses/tests/test_dhcpd.aug +index 0af337c..9663029 100644 +--- a/lenses/tests/test_dhcpd.aug ++++ b/lenses/tests/test_dhcpd.aug +@@ -28,9 +28,6 @@ max-lease-time 7200; + # network, the authoritative directive should be uncommented. + authoritative; + +-allow booting; +-allow bootp; +- + # Use this to send dhcp log messages to a different log file (you also + # have to hack syslog.conf to complete the redirection). + log-facility local7; +@@ -182,12 +179,7 @@ fixed-address 10.1.1.1;}}" = + } + } + +-test lns get "group fan-tas_tic { }" = +- { "group" = "fan-tas_tic" } +- + test Dhcpd.stmt_secu get "allow members of \"foo\";" = { "allow-members-of" = "foo" } +-test Dhcpd.stmt_secu get "allow booting;" = { "allow" = "booting" } +-test Dhcpd.stmt_secu get "allow bootp;" = { "allow" = "bootp" } + test Dhcpd.stmt_option get "option voip-boot-server code 66 = string;" = + { "rfc-code" + { "label" = "voip-boot-server" } +@@ -195,30 +187,6 @@ test Dhcpd.stmt_option get "option voip-boot-server code 66 = string;" = + { "type" = "string" } + } + +-test Dhcpd.stmt_option get "option special-option code 25 = array of string;" = +- { "rfc-code" +- { "label" = "special-option" } +- { "code" = "25" } +- { "type" = "array of string" } +- } +- +-test Dhcpd.stmt_option get "option special-option code 25 = integer 32;" = +- { "rfc-code" +- { "label" = "special-option" } +- { "code" = "25" } +- { "type" = "integer 32" } +- } +- +- +-test Dhcpd.stmt_option get "option special-option code 25 = array of integer 32;" = +- { "rfc-code" +- { "label" = "special-option" } +- { "code" = "25" } +- { "type" = "array of integer 32" } +- } +- +- +- + test Dhcpd.lns get "authoritative; + log-facility local7; + ddns-update-style none; +@@ -274,7 +242,7 @@ failover peer \"redondance01\" { + } + } + { "next-server" = "10.1.1.1" } +- { "failover peer" = "redondance01" ++ { "failover peer" = "\"redondance01\"" + { "primary" } + { "address" = "10.1.1.1" } + { "port" = "647" } +@@ -291,26 +259,6 @@ failover peer \"redondance01\" { + { "load balance max seconds" = "3" } + } + +- +-(* test get and put for record types *) +-let record_test = "option test_records code 123 = { string, ip-address, integer 32, ip6-address, domain-list };" +- +-test Dhcpd.lns get record_test = +- { "rfc-code" +- { "label" = "test_records" } +- { "code" = "123" } +- { "record" +- { "1" = "string" } +- { "2" = "ip-address" } +- { "3" = "integer 32" } +- { "4" = "ip6-address" } +- { "5" = "domain-list" } +- } +- } +- +-test Dhcpd.lns put record_test after set "/rfc-code[1]/code" "124" = +- "option test_records code 124 = { string, ip-address, integer 32, ip6-address, domain-list };" +- + test Dhcpd.lns get " + option CallManager code 150 = ip-address; + option slp-directory-agent true 10.1.1.1, 10.2.2.2; +@@ -386,25 +334,6 @@ test Dhcpd.stmt_match get "match if substring (option dhcp-client-identifier, 1, + { "value" = "RAS" } + } + +-test Dhcpd.stmt_match get "match if suffix (option dhcp-client-identifier, 4) = \"RAS\";" = +- { "match" +- { "function" = "suffix" +- { "args" +- { "arg" = "option dhcp-client-identifier" } +- { "arg" = "4" } +- } +- } +- { "value" = "RAS" } +- } +- +-test Dhcpd.stmt_match get "match if option vendor-class-identifier=\"RAS\";" = +- { "match" +- { "option" = "vendor-class-identifier" +- { "value" = "RAS" } +- } +- } +- +- + test Dhcpd.lns get "match pick-first-value (option dhcp-client-identifier, hardware);" = + { "match" + { "function" = "pick-first-value" +@@ -436,26 +365,12 @@ test Dhcpd.stmt_match get "match if binary-to-ascii(16, 32, \"\", substring(hard + { "value" = "1525400" } + } + +-test Dhcpd.lns get "subclass allocation-class-1 1:8:0:2b:4c:39:ad;" = +- { "subclass" +- { "name" = "allocation-class-1" } +- { "value" = "1:8:0:2b:4c:39:ad" } +- } +- +- + test Dhcpd.lns get "subclass \"allocation-class-1\" 1:8:0:2b:4c:39:ad;" = + { "subclass" + { "name" = "allocation-class-1" } + { "value" = "1:8:0:2b:4c:39:ad" } + } + +-test Dhcpd.lns get "subclass \"quoted class\" \"quoted value\";" = +- { "subclass" +- { "name" = "quoted class" } +- { "value" = "quoted value" } +- } +- +- + (* overall test *) + test Dhcpd.lns put conf after rm "/x" = conf + +@@ -477,130 +392,3 @@ filename \"pxelinux.0\"; + test Dhcpd.lns put "subnet 172.16.0.0 netmask 255.255.255.0 { + }" after + set "subnet/filename" "pxelinux.0" = input311 +- +-(* GH issue #34: support conditional structures *) +-let gh34_empty = "if exists dhcp-parameter-request-list { +-}\n" +- +-test Dhcpd.lns get gh34_empty = +- { "@if" = "exists dhcp-parameter-request-list" } +- +-let gh34_empty_multi = "subnet 192.168.100.0 netmask 255.255.255.0 { +- if true { +- } elsif false { +- } else { +- } +-}\n" +- +-test Dhcpd.lns get gh34_empty_multi = +- { "subnet" +- { "network" = "192.168.100.0" } +- { "netmask" = "255.255.255.0" } +- { "@if" = "true" +- { "@elsif" = "false" } +- { "@else" } } +- } +- +-let gh34_simple = "if exists dhcp-parameter-request-list { +- default-lease-time 600; +- } else { +-default-lease-time 200; +-}\n" +- +-test Dhcpd.lns get gh34_simple = +- { "@if" = "exists dhcp-parameter-request-list" +- { "default-lease-time" = "600" } +- { "@else" +- { "default-lease-time" = "200" } } } +- +-test Dhcpd.lns get "omapi-key fookey;" = +- { "omapi-key" = "fookey" } +- +-(* almost all DHCP groups should support braces starting on the next line *) +-test Dhcpd.lns get "class introduction +-{ +-}" = +- { "class" = "introduction" } +- +-(* equals should work the same *) +-test Dhcpd.lns get "option test_records code 123 = +- string;" = +- { "rfc-code" +- { "label" = "test_records" } +- { "code" = "123" } +- { "type" = "string" } +- } +- +-test Dhcpd.lns get "deny members of \"Are things like () allowed?\";" = +- { "deny-members-of" = "Are things like () allowed?" } +- +-test Dhcpd.lns get "deny unknown clients;" = +- { "deny" = "unknown clients" } +-test Dhcpd.lns get "deny known-clients;" = +- { "deny" = "known-clients" } +- +-test Dhcpd.lns get "set ClientMac = binary-to-ascii(16, 8, \":\" , substring(hardware, 1, 6));" = +- { "set" = "ClientMac" +- { "value" = "binary-to-ascii(16, 8, \":\" , substring(hardware, 1, 6))" } +- } +- +-test Dhcpd.lns get "set myvariable = foo;" = +- { "set" = "myvariable" +- { "value" = "foo" } +- } +- +-test Dhcpd.stmt_hardware get "hardware fddi 00:01:02:03:04:05;" = +- { "hardware" +- { "type" = "fddi" } +- { "address" = "00:01:02:03:04:05" } +- } +- +-test Dhcpd.lns get "on commit +-{ +- set test = thing; +-}" = +- { "on" = "commit" +- { "set" = "test" +- { "value" = "thing" } +- } +- } +- +-(* key block get/put/set test *) +-let key_tests = "key sample { +- algorithm hmac-md5; +- secret \"secret==\"; +-} +- +-key \"interesting\" { }; +- +-key \"third key\" { +- secret \"two==\"; +-}" +- +-test Dhcpd.lns get key_tests = +- { "key_block" = "sample" +- { "algorithm" = "hmac-md5" } +- { "secret" = "secret==" } +- } +- { "key_block" = "interesting" } +- { "key_block" = "third key" +- { "secret" = "two==" } +- } +- +-test Dhcpd.lns put key_tests after set "/key_block[1]" "sample2" = +- "key sample2 { +- algorithm hmac-md5; +- secret \"secret==\"; +-} +- +-key \"interesting\" { }; +- +-key \"third key\" { +- secret \"two==\"; +-}" +- +-test Dhcpd.lns get "group \"hello\" { }" = +- { "group" = "hello" } +- +-test Dhcpd.lns get "class \"testing class with spaces and quotes and ()\" {}" = +- { "class" = "testing class with spaces and quotes and ()" } +diff --git a/lenses/tests/test_dhcpd_140.aug b/lenses/tests/test_dhcpd_140.aug +new file mode 100644 +index 0000000..9d6fdc8 +--- /dev/null ++++ b/lenses/tests/test_dhcpd_140.aug +@@ -0,0 +1,606 @@ ++module Test_dhcpd_140 = ++ ++let lns = Dhcpd_140.lns ++ ++let conf = "# ++# Sample configuration file for ISC dhcpd for Debian ++# ++# Attention: If /etc/ltsp/dhcpd.conf exists, that will be used as ++# configuration file instead of this file. ++# ++# $Id: dhcpd.conf,v 1.1.1.1 2002/05/21 00:07:44 peloy Exp $ ++# ++ ++# The ddns-updates-style parameter controls whether or not the server will ++# attempt to do a DNS update when a lease is confirmed. We default to the ++# behavior of the version 2 packages ('none', since DHCP v2 didn't ++# have support for DDNS.) ++ddns-update-style none; ++ ++# option definitions common to all supported networks... ++option domain-name \"example.org\"; ++option domain-name-servers ns1.example.org, ns2.example.org; ++ ++default-lease-time 600; ++max-lease-time 7200; ++ ++# If this DHCP server is the official DHCP server for the local ++# network, the authoritative directive should be uncommented. ++authoritative; ++ ++allow booting; ++allow bootp; ++ ++# Use this to send dhcp log messages to a different log file (you also ++# have to hack syslog.conf to complete the redirection). ++log-facility local7; ++ ++# No service will be given on this subnet, but declaring it helps the ++# DHCP server to understand the network topology. ++ ++subnet 10.152.187.0 netmask 255.255.255.0 { ++} ++ ++# This is a very basic subnet declaration. ++ ++subnet 10.254.239.0 netmask 255.255.255.224 { ++ range 10.254.239.10 10.254.239.20; ++ option routers rtr-239-0-1.example.org, rtr-239-0-2.example.org; ++} ++ ++# This declaration allows BOOTP clients to get dynamic addresses, ++# which we don't really recommend. ++ ++subnet 10.254.239.32 netmask 255.255.255.224 { ++ range dynamic-bootp 10.254.239.40 10.254.239.60; ++ option broadcast-address 10.254.239.31; ++ option routers rtr-239-32-1.example.org; ++} ++ ++# A slightly different configuration for an internal subnet. ++subnet 10.5.5.0 netmask 255.255.255.224 { ++ range 10.5.5.26 10.5.5.30; ++ option domain-name-servers ns1.internal.example.org; ++ option domain-name \"internal.example.org\"; ++ option routers 10.5.5.1; ++ option broadcast-address 10.5.5.31; ++ default-lease-time 600; ++ max-lease-time 7200; ++} ++ ++# Hosts which require special configuration options can be listed in ++# host statements. If no address is specified, the address will be ++# allocated dynamically (if possible), but the host-specific information ++# will still come from the host declaration. ++ ++host passacaglia { ++ hardware ethernet 0:0:c0:5d:bd:95; ++ filename \"vmunix.passacaglia\"; ++ server-name \"toccata.fugue.com\"; ++} ++ ++# Fixed IP addresses can also be specified for hosts. These addresses ++# should not also be listed as being available for dynamic assignment. ++# Hosts for which fixed IP addresses have been specified can boot using ++# BOOTP or DHCP. Hosts for which no fixed address is specified can only ++# be booted with DHCP, unless there is an address range on the subnet ++# to which a BOOTP client is connected which has the dynamic-bootp flag ++# set. ++host fantasia { ++ hardware ethernet 08:00:07:26:c0:a5; ++ fixed-address fantasia.fugue.com; ++} ++ ++# You can declare a class of clients and then do address allocation ++# based on that. The example below shows a case where all clients ++# in a certain class get addresses on the 10.17.224/24 subnet, and all ++# other clients get addresses on the 10.0.29/24 subnet. ++ ++#class \"foo\" { ++# match if substring (option vendor-class-identifier, 0, 4) = \"SUNW\"; ++#} ++ ++shared-network 224-29 { ++ subnet 10.17.224.0 netmask 255.255.255.0 { ++ option routers rtr-224.example.org; ++ } ++ subnet 10.0.29.0 netmask 255.255.255.0 { ++ option routers rtr-29.example.org; ++ } ++ pool { ++ allow members of \"foo\"; ++ range 10.17.224.10 10.17.224.250; ++ } ++ pool { ++ deny members of \"foo\"; ++ range 10.0.29.10 10.0.29.230; ++ } ++} ++" ++ ++test lns get "authoritative;" = { "authoritative" } ++test lns get "ddns-update-style none;" = { "ddns-update-style" = "none" } ++test lns get "option domain-name \"example.org\";" = ++ { "option" ++ { "domain-name" ++ { "arg" = "example.org" } ++ } ++ } ++ ++test lns get "option domain-name-servers ns1.example.org, ns2.example.org;" = ++ { "option" ++ { "domain-name-servers" ++ { "arg" = "ns1.example.org" } ++ { "arg" = "ns2.example.org" } ++ } ++ } ++ ++test lns get "default-lease-time 600;" = { "default-lease-time" = "600" } ++test lns get "range 10.254.239.60;" = ++{ "range" ++ { "to" = "10.254.239.60" } ++ } ++ ++test lns get "range dynamic-bootp 10.254.239.60;" = ++ { "range" ++ { "flag" = "dynamic-bootp" } ++ { "to" = "10.254.239.60" } ++ } ++ ++test lns get "range dynamic-bootp 10.254.239.40 10.254.239.60;" = ++ { "range" ++ { "flag" = "dynamic-bootp" } ++ { "from" = "10.254.239.40" } ++ { "to" = "10.254.239.60" } ++ } ++ ++test lns get "subnet 10.152.187.0 netmask 255.255.255.0 {}\n" = ++ { "subnet" ++ { "network" = "10.152.187.0" } ++ { "netmask" = "255.255.255.0" } ++ } ++ ++test lns get " pool { ++ pool { ++ ++ } ++} ++" = ++ { "pool" ++ { "pool" } ++ } ++ ++test lns get "group { host some-host {hardware ethernet 00:00:aa:bb:cc:dd; ++fixed-address 10.1.1.1;}}" = ++ { "group" ++ { "host" = "some-host" ++ { "hardware" ++ { "type" = "ethernet" } ++ { "address" = "00:00:aa:bb:cc:dd" } ++ } ++ { "fixed-address" = "10.1.1.1" } ++ } ++ } ++ ++test lns get "group fan-tas_tic { }" = ++ { "group" = "fan-tas_tic" } ++ ++test Dhcpd_140.stmt_secu get "allow members of \"foo\";" = { "allow-members-of" = "foo" } ++test Dhcpd_140.stmt_secu get "allow booting;" = { "allow" = "booting" } ++test Dhcpd_140.stmt_secu get "allow bootp;" = { "allow" = "bootp" } ++test Dhcpd_140.stmt_option get "option voip-boot-server code 66 = string;" = ++ { "rfc-code" ++ { "label" = "voip-boot-server" } ++ { "code" = "66" } ++ { "type" = "string" } ++ } ++ ++test Dhcpd_140.stmt_option get "option special-option code 25 = array of string;" = ++ { "rfc-code" ++ { "label" = "special-option" } ++ { "code" = "25" } ++ { "type" = "array of string" } ++ } ++ ++test Dhcpd_140.stmt_option get "option special-option code 25 = integer 32;" = ++ { "rfc-code" ++ { "label" = "special-option" } ++ { "code" = "25" } ++ { "type" = "integer 32" } ++ } ++ ++ ++test Dhcpd_140.stmt_option get "option special-option code 25 = array of integer 32;" = ++ { "rfc-code" ++ { "label" = "special-option" } ++ { "code" = "25" } ++ { "type" = "array of integer 32" } ++ } ++ ++ ++ ++test Dhcpd_140.lns get "authoritative; ++log-facility local7; ++ddns-update-style none; ++default-lease-time 21600; ++max-lease-time 43200; ++ ++# Additional options for VOIP ++option voip-boot-server code 66 = string; ++option voip-vlan-id code 128 = string; ++" = ++ { "authoritative" } ++ { "log-facility" = "local7" } ++ { "ddns-update-style" = "none" } ++ { "default-lease-time" = "21600" } ++ { "max-lease-time" = "43200" ++ { "#comment" = "Additional options for VOIP" } ++ } ++ { "rfc-code" ++ { "label" = "voip-boot-server" } ++ { "code" = "66" } ++ { "type" = "string" } ++ } ++ { "rfc-code" ++ { "label" = "voip-vlan-id" } ++ { "code" = "128" } ++ { "type" = "string" } ++ } ++ ++ ++test Dhcpd_140.lns get " ++option domain-name-servers 10.1.1.1, 10.11.2.1, 10.1.3.1; ++next-server 10.1.1.1; ++ ++failover peer \"redondance01\" { ++ primary; ++ address 10.1.1.1; ++ port 647; ++ peer address 10.1.1.1; ++ peer port 647; ++ max-response-delay 20; ++ max-unacked-updates 10; ++ mclt 3600; #comment. ++ split 128; #comment. ++ load balance max seconds 3; ++ } ++" = ++ { } ++ { "option" ++ { "domain-name-servers" ++ { "arg" = "10.1.1.1" } ++ { "arg" = "10.11.2.1" } ++ { "arg" = "10.1.3.1" } ++ } ++ } ++ { "next-server" = "10.1.1.1" } ++ { "failover peer" = "redondance01" ++ { "primary" } ++ { "address" = "10.1.1.1" } ++ { "port" = "647" } ++ { "peer address" = "10.1.1.1" } ++ { "peer port" = "647" } ++ { "max-response-delay" = "20" } ++ { "max-unacked-updates" = "10" } ++ { "mclt" = "3600" ++ { "#comment" = "comment." } ++ } ++ { "split" = "128" ++ { "#comment" = "comment." } ++ } ++ { "load balance max seconds" = "3" } ++ } ++ ++ ++(* test get and put for record types *) ++let record_test = "option test_records code 123 = { string, ip-address, integer 32, ip6-address, domain-list };" ++ ++test Dhcpd_140.lns get record_test = ++ { "rfc-code" ++ { "label" = "test_records" } ++ { "code" = "123" } ++ { "record" ++ { "1" = "string" } ++ { "2" = "ip-address" } ++ { "3" = "integer 32" } ++ { "4" = "ip6-address" } ++ { "5" = "domain-list" } ++ } ++ } ++ ++test Dhcpd_140.lns put record_test after set "/rfc-code[1]/code" "124" = ++ "option test_records code 124 = { string, ip-address, integer 32, ip6-address, domain-list };" ++ ++test Dhcpd_140.lns get " ++option CallManager code 150 = ip-address; ++option slp-directory-agent true 10.1.1.1, 10.2.2.2; ++option slp-service-scope true \"SLP-GLOBAL\"; ++option nds-context \"EXAMPLE\"; ++option nds-tree-name \"EXAMPLE\"; ++" = ++ { } ++ { "rfc-code" ++ { "label" = "CallManager" } ++ { "code" = "150" } ++ { "type" = "ip-address" } ++ } ++ { "option" ++ { "slp-directory-agent" = "true" ++ { "arg" = "10.1.1.1" } ++ { "arg" = "10.2.2.2" } ++ } ++ } ++ { "option" ++ { "slp-service-scope" = "true" ++ { "arg" = "SLP-GLOBAL" } ++ } ++ } ++ { "option" ++ { "nds-context" ++ { "arg" = "EXAMPLE" } ++ } ++ } ++ { "option" ++ { "nds-tree-name" ++ { "arg" = "EXAMPLE" } ++ } ++ } ++ ++ ++test Dhcpd_140.lns get "option voip-vlan-id \"VLAN=1234;\";" = ++ { "option" ++ { "voip-vlan-id" ++ { "arg" = "VLAN=1234;" } ++ } ++ } ++ ++test Dhcpd_140.lns get "option domain-name \"x.example.com y.example.com z.example.com\";" = ++ { "option" ++ { "domain-name" ++ { "arg" = "x.example.com y.example.com z.example.com" } ++ } ++ } ++ ++test Dhcpd_140.lns get "include \"/etc/dhcpd.master\";" = ++ { "include" = "/etc/dhcpd.master" } ++ ++test Dhcpd_140.lns put "\n" after set "/include" "/etc/dhcpd.master" = ++ "\ninclude \"/etc/dhcpd.master\";\n" ++ ++test Dhcpd_140.fct_args get "(option dhcp-client-identifier, 1, 3)" = ++ { "args" ++ { "arg" = "option dhcp-client-identifier" } ++ { "arg" = "1" } ++ { "arg" = "3" } ++ } ++ ++test Dhcpd_140.stmt_match get "match if substring (option dhcp-client-identifier, 1, 3) = \"RAS\";" = ++ { "match" ++ { "function" = "substring" ++ { "args" ++ { "arg" = "option dhcp-client-identifier" } ++ { "arg" = "1" } ++ { "arg" = "3" } ++ } ++ } ++ { "value" = "RAS" } ++ } ++ ++test Dhcpd_140.stmt_match get "match if suffix (option dhcp-client-identifier, 4) = \"RAS\";" = ++ { "match" ++ { "function" = "suffix" ++ { "args" ++ { "arg" = "option dhcp-client-identifier" } ++ { "arg" = "4" } ++ } ++ } ++ { "value" = "RAS" } ++ } ++ ++test Dhcpd_140.stmt_match get "match if option vendor-class-identifier=\"RAS\";" = ++ { "match" ++ { "option" = "vendor-class-identifier" ++ { "value" = "RAS" } ++ } ++ } ++ ++ ++test Dhcpd_140.lns get "match pick-first-value (option dhcp-client-identifier, hardware);" = ++ { "match" ++ { "function" = "pick-first-value" ++ { "args" ++ { "arg" = "option dhcp-client-identifier" } ++ { "arg" = "hardware" } ++ } ++ } ++ } ++ ++test Dhcpd_140.fct_args get "(16, 32, \"\", substring(hardware, 0, 4))" = ++ { "args" ++ { "arg" = "16" } ++ { "arg" = "32" } ++ { "arg" = "\"\"" } ++ { "arg" = "substring(hardware, 0, 4)" } ++ } ++ ++test Dhcpd_140.stmt_match get "match if binary-to-ascii(16, 32, \"\", substring(hardware, 0, 4)) = \"1525400\";" = ++ { "match" ++ { "function" = "binary-to-ascii" ++ { "args" ++ { "arg" = "16" } ++ { "arg" = "32" } ++ { "arg" = "\"\"" } ++ { "arg" = "substring(hardware, 0, 4)" } ++ } ++ } ++ { "value" = "1525400" } ++ } ++ ++test Dhcpd_140.lns get "subclass allocation-class-1 1:8:0:2b:4c:39:ad;" = ++ { "subclass" ++ { "name" = "allocation-class-1" } ++ { "value" = "1:8:0:2b:4c:39:ad" } ++ } ++ ++ ++test Dhcpd_140.lns get "subclass \"allocation-class-1\" 1:8:0:2b:4c:39:ad;" = ++ { "subclass" ++ { "name" = "allocation-class-1" } ++ { "value" = "1:8:0:2b:4c:39:ad" } ++ } ++ ++test Dhcpd_140.lns get "subclass \"quoted class\" \"quoted value\";" = ++ { "subclass" ++ { "name" = "quoted class" } ++ { "value" = "quoted value" } ++ } ++ ++ ++(* overall test *) ++test Dhcpd_140.lns put conf after rm "/x" = conf ++ ++(* bug #293: primary should support argument *) ++let input293 = "zone EXAMPLE.ORG. { ++ primary 127.0.0.1; ++}" ++ ++test Dhcpd_140.lns get input293 = ++ { "zone" = "EXAMPLE.ORG." ++ { "primary" = "127.0.0.1" } ++ } ++ ++(* bug #311: filename should be quoted *) ++let input311 = "subnet 172.16.0.0 netmask 255.255.255.0 { ++filename \"pxelinux.0\"; ++}" ++ ++test Dhcpd_140.lns put "subnet 172.16.0.0 netmask 255.255.255.0 { ++}" after ++ set "subnet/filename" "pxelinux.0" = input311 ++ ++(* GH issue #34: support conditional structures *) ++let gh34_empty = "if exists dhcp-parameter-request-list { ++}\n" ++ ++test Dhcpd_140.lns get gh34_empty = ++ { "@if" = "exists dhcp-parameter-request-list" } ++ ++let gh34_empty_multi = "subnet 192.168.100.0 netmask 255.255.255.0 { ++ if true { ++ } elsif false { ++ } else { ++ } ++}\n" ++ ++test Dhcpd_140.lns get gh34_empty_multi = ++ { "subnet" ++ { "network" = "192.168.100.0" } ++ { "netmask" = "255.255.255.0" } ++ { "@if" = "true" ++ { "@elsif" = "false" } ++ { "@else" } } ++ } ++ ++let gh34_simple = "if exists dhcp-parameter-request-list { ++ default-lease-time 600; ++ } else { ++default-lease-time 200; ++}\n" ++ ++test Dhcpd_140.lns get gh34_simple = ++ { "@if" = "exists dhcp-parameter-request-list" ++ { "default-lease-time" = "600" } ++ { "@else" ++ { "default-lease-time" = "200" } } } ++ ++test Dhcpd_140.lns get "omapi-key fookey;" = ++ { "omapi-key" = "fookey" } ++ ++(* almost all DHCP groups should support braces starting on the next line *) ++test Dhcpd_140.lns get "class introduction ++{ ++}" = ++ { "class" = "introduction" } ++ ++(* equals should work the same *) ++test Dhcpd_140.lns get "option test_records code 123 = ++ string;" = ++ { "rfc-code" ++ { "label" = "test_records" } ++ { "code" = "123" } ++ { "type" = "string" } ++ } ++ ++test Dhcpd_140.lns get "deny members of \"Are things like () allowed?\";" = ++ { "deny-members-of" = "Are things like () allowed?" } ++ ++test Dhcpd_140.lns get "deny unknown clients;" = ++ { "deny" = "unknown clients" } ++test Dhcpd_140.lns get "deny known-clients;" = ++ { "deny" = "known-clients" } ++ ++test Dhcpd_140.lns get "set ClientMac = binary-to-ascii(16, 8, \":\" , substring(hardware, 1, 6));" = ++ { "set" = "ClientMac" ++ { "value" = "binary-to-ascii(16, 8, \":\" , substring(hardware, 1, 6))" } ++ } ++ ++test Dhcpd_140.lns get "set myvariable = foo;" = ++ { "set" = "myvariable" ++ { "value" = "foo" } ++ } ++ ++test Dhcpd_140.stmt_hardware get "hardware fddi 00:01:02:03:04:05;" = ++ { "hardware" ++ { "type" = "fddi" } ++ { "address" = "00:01:02:03:04:05" } ++ } ++ ++test Dhcpd_140.lns get "on commit ++{ ++ set test = thing; ++}" = ++ { "on" = "commit" ++ { "set" = "test" ++ { "value" = "thing" } ++ } ++ } ++ ++(* key block get/put/set test *) ++let key_tests = "key sample { ++ algorithm hmac-md5; ++ secret \"secret==\"; ++} ++ ++key \"interesting\" { }; ++ ++key \"third key\" { ++ secret \"two==\"; ++}" ++ ++test Dhcpd_140.lns get key_tests = ++ { "key_block" = "sample" ++ { "algorithm" = "hmac-md5" } ++ { "secret" = "secret==" } ++ } ++ { "key_block" = "interesting" } ++ { "key_block" = "third key" ++ { "secret" = "two==" } ++ } ++ ++test Dhcpd_140.lns put key_tests after set "/key_block[1]" "sample2" = ++ "key sample2 { ++ algorithm hmac-md5; ++ secret \"secret==\"; ++} ++ ++key \"interesting\" { }; ++ ++key \"third key\" { ++ secret \"two==\"; ++}" ++ ++test Dhcpd_140.lns get "group \"hello\" { }" = ++ { "group" = "hello" } ++ ++test Dhcpd_140.lns get "class \"testing class with spaces and quotes and ()\" {}" = ++ { "class" = "testing class with spaces and quotes and ()" } +diff --git a/tests/Makefile.am b/tests/Makefile.am +index 387ac7d..315cac9 100644 +--- a/tests/Makefile.am ++++ b/tests/Makefile.am +@@ -58,6 +58,7 @@ lens_tests = \ + lens-device_map.sh \ + lens-dhclient.sh \ + lens-dhcpd.sh \ ++ lens-dhcpd_140.sh \ + lens-dns_zone.sh \ + lens-dnsmasq.sh \ + lens-dovecot.sh \ diff --git a/SOURCES/0007-Yum-add-yum-cron-.conf-files.patch b/SOURCES/0007-Yum-add-yum-cron-.conf-files.patch deleted file mode 100644 index 4bd183e..0000000 --- a/SOURCES/0007-Yum-add-yum-cron-.conf-files.patch +++ /dev/null @@ -1,25 +0,0 @@ -From f1cad0ba3df9d8231cc0651302c7b638d6fdfcb7 Mon Sep 17 00:00:00 2001 -From: Pat Riehecky -Date: Tue, 27 Aug 2013 20:03:31 +0100 -Subject: [PATCH 1/5] Yum: add yum-cron*.conf files - -(cherry picked from commit 148330ac79660e35b8726c7ec6fc8b6916c8a23e) ---- - lenses/yum.aug | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/lenses/yum.aug b/lenses/yum.aug -index 31d4776..585695f 100644 ---- a/lenses/yum.aug -+++ b/lenses/yum.aug -@@ -50,6 +50,7 @@ let lns = (empty | comment)* . record* - - let filter = (incl "/etc/yum.conf") - . (incl "/etc/yum.repos.d/*") -+ . (incl "/etc/yum/yum-cron*.conf") - . (incl "/etc/yum/pluginconf.d/*") - . (excl "/etc/yum/pluginconf.d/versionlock.list") - . Util.stdexcl --- -1.8.5.3 - diff --git a/SOURCES/0008-Shellvars-read-etc-firewalld-firewalld.conf.patch b/SOURCES/0008-Shellvars-read-etc-firewalld-firewalld.conf.patch deleted file mode 100644 index 1d75bab..0000000 --- a/SOURCES/0008-Shellvars-read-etc-firewalld-firewalld.conf.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 620d73fdec0aa82f2d04d9d3263e036f2bd6d9e2 Mon Sep 17 00:00:00 2001 -From: David Lutterkort -Date: Tue, 27 Aug 2013 10:39:45 -0700 -Subject: [PATCH 2/5] Shellvars: read /etc/firewalld/firewalld.conf - -Fixes https://fedorahosted.org/augeas/ticket/363 - -(cherry picked from commit 63e322699272dd26fc9014c672ea5ce9e4fb21e8) ---- - lenses/shellvars.aug | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/lenses/shellvars.aug b/lenses/shellvars.aug -index da19379..4111ee6 100644 ---- a/lenses/shellvars.aug -+++ b/lenses/shellvars.aug -@@ -205,6 +205,7 @@ module Shellvars = - let filter_misc = incl "/etc/arno-iptables-firewall/debconf.cfg" - . incl "/etc/cron-apt/config" - . incl "/etc/environment" -+ . incl "/etc/firewalld/firewalld.conf" - . incl "/etc/blkid.conf" - . incl "/etc/adduser.conf" - . incl "/etc/cowpoke.conf" --- -1.8.5.3 - diff --git a/SOURCES/0008-Slapd-revert-Slapd-module-to-1.1.0-compatible-add-Sl.patch b/SOURCES/0008-Slapd-revert-Slapd-module-to-1.1.0-compatible-add-Sl.patch new file mode 100644 index 0000000..5056639 --- /dev/null +++ b/SOURCES/0008-Slapd-revert-Slapd-module-to-1.1.0-compatible-add-Sl.patch @@ -0,0 +1,415 @@ +From 945ff8cc4b9e544c7a06c4a977c9d9c2f49821cc Mon Sep 17 00:00:00 2001 +From: Dominic Cleal +Date: Fri, 12 Jun 2015 11:14:32 +0100 +Subject: [PATCH] Slapd: revert Slapd module to 1.1.0-compatible, add Slapd_140 + +In order to keep the default sshd config lens compatible with 1.1.0, +the lens from 1.4.0 has been kept in the Slapd_140 module and is not +loaded by default. Use aug_transform, augtool --transform etc. to use +it instead of Slapd. +--- + lenses/slapd.aug | 18 ++--- + lenses/slapd_140.aug | 158 ++++++++++++++++++++++++++++++++++++++++ + lenses/tests/test_slapd.aug | 55 ++++---------- + lenses/tests/test_slapd_140.aug | 94 ++++++++++++++++++++++++ + tests/Makefile.am | 1 + + 5 files changed, 273 insertions(+), 53 deletions(-) + create mode 100644 lenses/slapd_140.aug + create mode 100644 lenses/tests/test_slapd_140.aug + +diff --git a/lenses/slapd.aug b/lenses/slapd.aug +index e119565..afe074b 100644 +--- a/lenses/slapd.aug ++++ b/lenses/slapd.aug +@@ -18,6 +18,7 @@ let sep = del /[ \t\n]+/ " " + + let sto_to_eol = store /([^ \t\n].*[^ \t\n]|[^ \t\n])/ + let sto_to_spc = store /[^\\# \t\n]+/ ++let sto_to_by = store (/[^\\# \t\n]+/ - "by") + + let comment = Util.comment + let empty = Util.empty +@@ -27,14 +28,12 @@ let empty = Util.empty + *************************************************************************) + + let access_re = "access to" +-let control_re = "stop" | "continue" | "break" +-let what = [ spc . label "access" +- . store (/[^\\# \t\n]+/ - ("by" | control_re)) ] ++let who = [ spc . label "who" . sto_to_spc ] ++let what = [ spc . label "what" . sto_to_spc ] + + (* TODO: parse the control field, see man slapd.access (5) *) +-let control = [ spc . label "control" . store control_re ] +-let by = [ sep . key "by" . spc . sto_to_spc +- . what? . control? ] ++let control = [ spc . label "control" . sto_to_by ] ++let by = [ sep . key "by". who . what. control? ] + + let access = [ key access_re . spc. sto_to_spc . by+ . eol ] + +@@ -134,21 +133,18 @@ let database_re = "suffix" + | "restrict" + | "rootdn" + | "rootpw" ++ | "suffix" + | "subordinate" + | "syncrepl rid" + | "updatedn" + | "updateref" + | database_hdb + +-let database_entry = +- let val = Quote.double_opt +- in Build.key_value_line database_re Sep.space val +- + let database = [ key "database" + . spc + . sto_to_eol + . eol +- . (comment|empty|database_entry|access)* ] ++ . (comment|empty|Build.key_ws_value database_re|access)* ] + + (************************************************************************ + * LENS +diff --git a/lenses/slapd_140.aug b/lenses/slapd_140.aug +new file mode 100644 +index 0000000..8d1cd07 +--- /dev/null ++++ b/lenses/slapd_140.aug +@@ -0,0 +1,158 @@ ++(* Slapd module for Augeas ++ This module is compatible with Augeas 1.4.0, but is not loaded by default. ++ ++ Author: Free Ekanayaka ++ ++ Reference: man slapd.conf(5), man slapd.access (5) ++ ++*) ++ ++module Slapd_140 = ++ ++(************************************************************************ ++ * USEFUL PRIMITIVES ++ *************************************************************************) ++ ++let eol = Util.eol ++let spc = Util.del_ws_spc ++let sep = del /[ \t\n]+/ " " ++ ++let sto_to_eol = store /([^ \t\n].*[^ \t\n]|[^ \t\n])/ ++let sto_to_spc = store /[^\\# \t\n]+/ ++ ++let comment = Util.comment ++let empty = Util.empty ++ ++(************************************************************************ ++ * ACCESS TO ++ *************************************************************************) ++ ++let access_re = "access to" ++let control_re = "stop" | "continue" | "break" ++let what = [ spc . label "access" ++ . store (/[^\\# \t\n]+/ - ("by" | control_re)) ] ++ ++(* TODO: parse the control field, see man slapd.access (5) *) ++let control = [ spc . label "control" . store control_re ] ++let by = [ sep . key "by" . spc . sto_to_spc ++ . what? . control? ] ++ ++let access = [ key access_re . spc. sto_to_spc . by+ . eol ] ++ ++(************************************************************************ ++ * GLOBAL ++ *************************************************************************) ++ ++(* TODO: parse special field separately, see man slapd.conf (5) *) ++let global_re = "allow" ++ | "argsfile" ++ | "attributeoptions" ++ | "attributetype" ++ | "authz-policy" ++ | "ldap" ++ | "dn" ++ | "concurrency" ++ | "cron_max_pending" ++ | "conn_max_pending_auth" ++ | "defaultsearchbase" ++ | "disallow" ++ | "ditcontentrule" ++ | "gentlehup" ++ | "idletimeout" ++ | "include" ++ | "index_substr_if_minlen" ++ | "index_substr_if_maxlen" ++ | "index_substr_any_len" ++ | "index_substr_any_step" ++ | "localSSF" ++ | "loglevel" ++ | "moduleload" ++ | "modulepath" ++ | "objectclass" ++ | "objectidentifier" ++ | "password-hash" ++ | "password-crypt-salt-format" ++ | "pidfile" ++ | "referral" ++ | "replica-argsfile" ++ | "replica-pidfile" ++ | "replicationinterval" ++ | "require" ++ | "reverse-lookup" ++ | "rootDSE" ++ | "sasl-host " ++ | "sasl-realm" ++ | "sasl-secprops" ++ | "schemadn" ++ | "security" ++ | "sizelimit" ++ | "sockbuf_max_incoming " ++ | "sockbuf_max_incoming_auth" ++ | "threads" ++ | "timelimit time" ++ | "tool-threads" ++ | "TLSCipherSuite" ++ | "TLSCACertificateFile" ++ | "TLSCACertificatePath" ++ | "TLSCertificateFile" ++ | "TLSCertificateKeyFile" ++ | "TLSDHParamFile" ++ | "TLSRandFile" ++ | "TLSVerifyClient" ++ | "TLSCRLCheck" ++ | "backend" ++ ++let global = Build.key_ws_value global_re ++ ++(************************************************************************ ++ * DATABASE ++ *************************************************************************) ++ ++(* TODO: support all types of database backend *) ++let database_hdb = "cachesize" ++ | "cachefree" ++ | "checkpoint" ++ | "dbconfig" ++ | "dbnosync" ++ | "directory" ++ | "dirtyread" ++ | "idlcachesize" ++ | "index" ++ | "linearindex" ++ | "lockdetect" ++ | "mode" ++ | "searchstack" ++ | "shm_key" ++ ++let database_re = "suffix" ++ | "lastmod" ++ | "limits" ++ | "maxderefdepth" ++ | "overlay" ++ | "readonly" ++ | "replica uri" ++ | "replogfile" ++ | "restrict" ++ | "rootdn" ++ | "rootpw" ++ | "subordinate" ++ | "syncrepl rid" ++ | "updatedn" ++ | "updateref" ++ | database_hdb ++ ++let database_entry = ++ let val = Quote.double_opt ++ in Build.key_value_line database_re Sep.space val ++ ++let database = [ key "database" ++ . spc ++ . sto_to_eol ++ . eol ++ . (comment|empty|database_entry|access)* ] ++ ++(************************************************************************ ++ * LENS ++ *************************************************************************) ++ ++let lns = (comment|empty|global|access)* . (database)* +diff --git a/lenses/tests/test_slapd.aug b/lenses/tests/test_slapd.aug +index a4bbb4e..e477342 100644 +--- a/lenses/tests/test_slapd.aug ++++ b/lenses/tests/test_slapd.aug +@@ -48,47 +48,18 @@ test Slapd.lns get conf = + { "database" = "hdb" + {} + { "#comment" = "The base of your directory in database #1" } +- { "suffix" = "dc=nodomain" } ++ { "suffix" = "\"dc=nodomain\"" } + {} + { "access to" = "attrs=userPassword,shadowLastChange" +- { "by" = "dn=\"cn=admin,dc=nodomain\"" +- { "access" = "write" } } +- { "by" = "anonymous" +- { "access" = "auth" } } +- { "by" = "self" +- { "access" = "write" } } +- { "by" = "*" +- { "access" = "none" } } } } +- +-(* Test: Slapd.lns +- Full access test with who/access/control *) +-test Slapd.lns get "access to dn.subtree=\"dc=example,dc=com\" +- by self write stop\n" = +- { "access to" = "dn.subtree=\"dc=example,dc=com\"" +- { "by" = "self" +- { "access" = "write" } +- { "control" = "stop" } } } +- +-(* Test: Slapd.lns +- access test with who *) +-test Slapd.lns get "access to dn.subtree=\"dc=example,dc=com\" +- by self\n" = +- { "access to" = "dn.subtree=\"dc=example,dc=com\"" +- { "by" = "self" } } +- +-(* Test: Slapd.lns +- access test with who/access *) +-test Slapd.lns get "access to dn.subtree=\"dc=example,dc=com\" +- by self write\n" = +- { "access to" = "dn.subtree=\"dc=example,dc=com\"" +- { "by" = "self" +- { "access" = "write" } } } +- +-(* Test: Slapd.lns +- access test with who/control *) +-test Slapd.lns get "access to dn.subtree=\"dc=example,dc=com\" +- by self stop\n" = +- { "access to" = "dn.subtree=\"dc=example,dc=com\"" +- { "by" = "self" +- { "control" = "stop" } } } +- ++ { "by" ++ { "who" = "dn=\"cn=admin,dc=nodomain\"" } ++ { "what" = "write" } } ++ { "by" ++ { "who" = "anonymous" } ++ { "what" = "auth" } } ++ { "by" ++ { "who" = "self" } ++ { "what" = "write" } } ++ { "by" ++ { "who" = "*" } ++ { "what" = "none" } } } } +diff --git a/lenses/tests/test_slapd_140.aug b/lenses/tests/test_slapd_140.aug +new file mode 100644 +index 0000000..0118f03 +--- /dev/null ++++ b/lenses/tests/test_slapd_140.aug +@@ -0,0 +1,94 @@ ++module Test_slapd_140 = ++ ++let conf = "# This is the main slapd configuration file. See slapd.conf(5) for more ++# info on the configuration options. ++ ++####################################################################### ++# Global Directives: ++ ++# Features to permit ++#allow bind_v2 ++ ++# Schema and objectClass definitions ++include /etc/ldap/schema/core.schema ++ ++####################################################################### ++# Specific Directives for database #1, of type hdb: ++# Database specific directives apply to this databasse until another ++# 'database' directive occurs ++database hdb ++ ++# The base of your directory in database #1 ++suffix \"dc=nodomain\" ++ ++access to attrs=userPassword,shadowLastChange ++ by dn=\"cn=admin,dc=nodomain\" write ++ by anonymous auth ++ by self write ++ by * none ++" ++ ++test Slapd_140.lns get conf = ++ { "#comment" = "This is the main slapd configuration file. See slapd.conf(5) for more" } ++ { "#comment" = "info on the configuration options." } ++ {} ++ { "#comment" = "######################################################################" } ++ { "#comment" = "Global Directives:"} ++ {} ++ { "#comment" = "Features to permit" } ++ { "#comment" = "allow bind_v2" } ++ {} ++ { "#comment" = "Schema and objectClass definitions" } ++ { "include" = "/etc/ldap/schema/core.schema" } ++ {} ++ { "#comment" = "######################################################################" } ++ { "#comment" = "Specific Directives for database #1, of type hdb:" } ++ { "#comment" = "Database specific directives apply to this databasse until another" } ++ { "#comment" = "'database' directive occurs" } ++ { "database" = "hdb" ++ {} ++ { "#comment" = "The base of your directory in database #1" } ++ { "suffix" = "dc=nodomain" } ++ {} ++ { "access to" = "attrs=userPassword,shadowLastChange" ++ { "by" = "dn=\"cn=admin,dc=nodomain\"" ++ { "access" = "write" } } ++ { "by" = "anonymous" ++ { "access" = "auth" } } ++ { "by" = "self" ++ { "access" = "write" } } ++ { "by" = "*" ++ { "access" = "none" } } } } ++ ++(* Test: Slapd_140.lns ++ Full access test with who/access/control *) ++test Slapd_140.lns get "access to dn.subtree=\"dc=example,dc=com\" ++ by self write stop\n" = ++ { "access to" = "dn.subtree=\"dc=example,dc=com\"" ++ { "by" = "self" ++ { "access" = "write" } ++ { "control" = "stop" } } } ++ ++(* Test: Slapd_140.lns ++ access test with who *) ++test Slapd_140.lns get "access to dn.subtree=\"dc=example,dc=com\" ++ by self\n" = ++ { "access to" = "dn.subtree=\"dc=example,dc=com\"" ++ { "by" = "self" } } ++ ++(* Test: Slapd_140.lns ++ access test with who/access *) ++test Slapd_140.lns get "access to dn.subtree=\"dc=example,dc=com\" ++ by self write\n" = ++ { "access to" = "dn.subtree=\"dc=example,dc=com\"" ++ { "by" = "self" ++ { "access" = "write" } } } ++ ++(* Test: Slapd_140.lns ++ access test with who/control *) ++test Slapd_140.lns get "access to dn.subtree=\"dc=example,dc=com\" ++ by self stop\n" = ++ { "access to" = "dn.subtree=\"dc=example,dc=com\"" ++ { "by" = "self" ++ { "control" = "stop" } } } ++ +diff --git a/tests/Makefile.am b/tests/Makefile.am +index 315cac9..65d8993 100644 +--- a/tests/Makefile.am ++++ b/tests/Makefile.am +@@ -182,6 +182,7 @@ lens_tests = \ + lens-simplevars.sh \ + lens-sip_conf.sh \ + lens-slapd.sh \ ++ lens-slapd_140.sh \ + lens-smbusers.sh \ + lens-solaris_system.sh \ + lens-soma.sh \ diff --git a/SOURCES/0009-Grub-handle-foreground-option.patch b/SOURCES/0009-Grub-handle-foreground-option.patch deleted file mode 100644 index cebb6dc..0000000 --- a/SOURCES/0009-Grub-handle-foreground-option.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 2556648fdd45887246658579dd576b25e7af874d Mon Sep 17 00:00:00 2001 -From: Miguel Armas -Date: Thu, 30 Jan 2014 09:23:27 +0000 -Subject: [PATCH 3/5] Grub: handle "foreground" option - -Fixes RHBZ#1059383 - -(cherry picked from commit a370d9ccfbd0b6b6f927880014b29569c58b03c0) ---- - lenses/grub.aug | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/lenses/grub.aug b/lenses/grub.aug -index 9f8d6af..81fb9d3 100644 ---- a/lenses/grub.aug -+++ b/lenses/grub.aug -@@ -145,6 +145,7 @@ module Grub = - | kw_menu_arg "timeout" - | kw_menu_arg "splashimage" - | kw_menu_arg "gfxmenu" -+ | kw_menu_arg "foreground" - | kw_menu_arg "background" - | serial - | terminal --- -1.8.5.3 - diff --git a/SOURCES/0009-Rhsm-new-lens-to-parse-subscription-manager-s-rhsm.c.patch b/SOURCES/0009-Rhsm-new-lens-to-parse-subscription-manager-s-rhsm.c.patch new file mode 100644 index 0000000..1de97f4 --- /dev/null +++ b/SOURCES/0009-Rhsm-new-lens-to-parse-subscription-manager-s-rhsm.c.patch @@ -0,0 +1,258 @@ +From 73ad666d797eb8b1957a0fd4126bb916be4081f0 Mon Sep 17 00:00:00 2001 +From: Dominic Cleal +Date: Fri, 3 Jul 2015 12:05:30 +0100 +Subject: [PATCH] Rhsm: new lens to parse subscription-manager's rhsm.conf + +(cherry picked from commit abdb9fbc4e8c0975f51a62e34ee2e22ed2d5c39f) + +Conflicts: + NEWS +--- + doc/naturaldocs/conf/lenses/Menu.txt | 2 + + lenses/rhsm.aug | 42 ++++++++++ + lenses/tests/test_rhsm.aug | 151 +++++++++++++++++++++++++++++++++++ + tests/Makefile.am | 1 + + 4 files changed, 196 insertions(+) + create mode 100644 lenses/rhsm.aug + create mode 100644 lenses/tests/test_rhsm.aug + +diff --git a/doc/naturaldocs/conf/lenses/Menu.txt b/doc/naturaldocs/conf/lenses/Menu.txt +index c245446..e74cd13 100644 +--- a/doc/naturaldocs/conf/lenses/Menu.txt ++++ b/doc/naturaldocs/conf/lenses/Menu.txt +@@ -151,6 +151,7 @@ Group: Specific Modules { + File: Redis (redis.aug) + File: Reprepro_Uploaders (reprepro_uploaders.aug) + File: Resolv (resolv.aug) ++ File: Rhsm (rhsm.aug) + File: Rmt (rmt.aug) + File: Rsyslog (rsyslog.aug) + File: Schroot (schroot.aug) +@@ -261,6 +262,7 @@ Group: Tests and Examples { + File: Test_Rabbitmq (tests/test_rabbitmq.aug) + File: Test_Redis (tests/test_redis.aug) + File: Test_Reprepro_Uploaders (tests/test_reprepro_uploaders.aug) ++ File: Test_Rhsm (tests/test_rhsm.aug) + File: Test_Rmt (tests/test_rmt.aug) + File: Test_Rsyslog (tests/test_rsyslog.aug) + File: Test_Simplelines (tests/test_simplelines.aug) +diff --git a/lenses/rhsm.aug b/lenses/rhsm.aug +new file mode 100644 +index 0000000..56cc82e +--- /dev/null ++++ b/lenses/rhsm.aug +@@ -0,0 +1,42 @@ ++(* ++Module: Rhsm ++ Parses subscription-manager config files ++ ++Author: Dominic Cleal ++ ++About: Reference ++ This lens tries to keep as close as possible to rhsm.conf(5) and ++ Python's SafeConfigParser. All settings must be in sections without ++ indentation. Semicolons and hashes are permitted for comments. ++ ++About: License ++ This file is licenced under the LGPL v2+, like the rest of Augeas. ++ ++About: Lens Usage ++ To be documented ++ ++About: Configuration files ++ This lens applies to: ++ /etc/rhsm/rhsm.conf ++ ++ See . ++*) ++ ++module Rhsm = ++ autoload xfm ++ ++(* Semicolons and hashes are permitted for comments *) ++let comment = IniFile.comment IniFile.comment_re "#" ++(* Equals and colons are permitted for separators *) ++let sep = IniFile.sep IniFile.sep_re IniFile.sep_default ++ ++(* All settings must be in sections without indentation *) ++let entry = IniFile.entry_multiline IniFile.entry_re sep comment ++let title = IniFile.title IniFile.record_re ++let record = IniFile.record title entry ++ ++let lns = IniFile.lns record comment ++ ++let filter = incl "/etc/rhsm/rhsm.conf" ++ ++let xfm = transform lns filter +diff --git a/lenses/tests/test_rhsm.aug b/lenses/tests/test_rhsm.aug +new file mode 100644 +index 0000000..219a5be +--- /dev/null ++++ b/lenses/tests/test_rhsm.aug +@@ -0,0 +1,151 @@ ++(* ++Module: Test_Rhsm ++ Provides unit tests and examples for the lens. ++*) ++ ++module Test_rhsm = ++ ++ (* Variable: conf ++ A full rhsm.conf *) ++ let conf = "# Red Hat Subscription Manager Configuration File: ++ ++# Unified Entitlement Platform Configuration ++[server] ++# Server hostname: ++hostname = subscription.rhn.redhat.com ++ ++# Server prefix: ++prefix = /subscription ++ ++# Server port: ++port = 443 ++ ++# Set to 1 to disable certificate validation: ++insecure = 0 ++ ++# Set the depth of certs which should be checked ++# when validating a certificate ++ssl_verify_depth = 3 ++ ++# an http proxy server to use ++proxy_hostname = ++ ++# port for http proxy server ++proxy_port = ++ ++# user name for authenticating to an http proxy, if needed ++proxy_user = ++ ++# password for basic http proxy auth, if needed ++proxy_password = ++ ++[rhsm] ++# Content base URL: ++baseurl= https://cdn.redhat.com ++ ++# Server CA certificate location: ++ca_cert_dir = /etc/rhsm/ca/ ++ ++# Default CA cert to use when generating yum repo configs: ++repo_ca_cert = %(ca_cert_dir)sredhat-uep.pem ++ ++# Where the certificates should be stored ++productCertDir = /etc/pki/product ++entitlementCertDir = /etc/pki/entitlement ++consumerCertDir = /etc/pki/consumer ++ ++# Manage generation of yum repositories for subscribed content: ++manage_repos = 1 ++ ++# Refresh repo files with server overrides on every yum command ++full_refresh_on_yum = 0 ++ ++# If set to zero, the client will not report the package profile to ++# the subscription management service. ++report_package_profile = 1 ++ ++# The directory to search for subscription manager plugins ++pluginDir = /usr/share/rhsm-plugins ++ ++# The directory to search for plugin configuration files ++pluginConfDir = /etc/rhsm/pluginconf.d ++ ++[rhsmcertd] ++# Interval to run cert check (in minutes): ++certCheckInterval = 240 ++# Interval to run auto-attach (in minutes): ++autoAttachInterval = 1440 ++" ++ ++ test Rhsm.lns get conf = ++ { "#comment" = "Red Hat Subscription Manager Configuration File:" } ++ { } ++ { "#comment" = "Unified Entitlement Platform Configuration" } ++ { "server" ++ { "#comment" = "Server hostname:" } ++ { "hostname" = "subscription.rhn.redhat.com" } ++ { } ++ { "#comment" = "Server prefix:" } ++ { "prefix" = "/subscription" } ++ { } ++ { "#comment" = "Server port:" } ++ { "port" = "443" } ++ { } ++ { "#comment" = "Set to 1 to disable certificate validation:" } ++ { "insecure" = "0" } ++ { } ++ { "#comment" = "Set the depth of certs which should be checked" } ++ { "#comment" = "when validating a certificate" } ++ { "ssl_verify_depth" = "3" } ++ { } ++ { "#comment" = "an http proxy server to use" } ++ { "proxy_hostname" } ++ { } ++ { "#comment" = "port for http proxy server" } ++ { "proxy_port" } ++ { } ++ { "#comment" = "user name for authenticating to an http proxy, if needed" } ++ { "proxy_user" } ++ { } ++ { "#comment" = "password for basic http proxy auth, if needed" } ++ { "proxy_password" } ++ { } ++ } ++ { "rhsm" ++ { "#comment" = "Content base URL:" } ++ { "baseurl" = "https://cdn.redhat.com" } ++ { } ++ { "#comment" = "Server CA certificate location:" } ++ { "ca_cert_dir" = "/etc/rhsm/ca/" } ++ { } ++ { "#comment" = "Default CA cert to use when generating yum repo configs:" } ++ { "repo_ca_cert" = "%(ca_cert_dir)sredhat-uep.pem" } ++ { } ++ { "#comment" = "Where the certificates should be stored" } ++ { "productCertDir" = "/etc/pki/product" } ++ { "entitlementCertDir" = "/etc/pki/entitlement" } ++ { "consumerCertDir" = "/etc/pki/consumer" } ++ { } ++ { "#comment" = "Manage generation of yum repositories for subscribed content:" } ++ { "manage_repos" = "1" } ++ { } ++ { "#comment" = "Refresh repo files with server overrides on every yum command" } ++ { "full_refresh_on_yum" = "0" } ++ { } ++ { "#comment" = "If set to zero, the client will not report the package profile to" } ++ { "#comment" = "the subscription management service." } ++ { "report_package_profile" = "1" } ++ { } ++ { "#comment" = "The directory to search for subscription manager plugins" } ++ { "pluginDir" = "/usr/share/rhsm-plugins" } ++ { } ++ { "#comment" = "The directory to search for plugin configuration files" } ++ { "pluginConfDir" = "/etc/rhsm/pluginconf.d" } ++ { } ++ } ++ { "rhsmcertd" ++ { "#comment" = "Interval to run cert check (in minutes):" } ++ { "certCheckInterval" = "240" } ++ { "#comment" = "Interval to run auto-attach (in minutes):" } ++ { "autoAttachInterval" = "1440" } ++ } +diff --git a/tests/Makefile.am b/tests/Makefile.am +index 65d8993..4d2b260 100644 +--- a/tests/Makefile.am ++++ b/tests/Makefile.am +@@ -167,6 +167,7 @@ lens_tests = \ + lens-redis.sh \ + lens-reprepro_uploaders.sh \ + lens-resolv.sh \ ++ lens-rhsm.sh \ + lens-rmt.sh \ + lens-rsyncd.sh \ + lens-rsyslog.sh \ +-- +2.1.0 + diff --git a/SOURCES/0010-Yum-permit-spaces-after-equals-sign-in-list-options.patch b/SOURCES/0010-Yum-permit-spaces-after-equals-sign-in-list-options.patch deleted file mode 100644 index 52a2045..0000000 --- a/SOURCES/0010-Yum-permit-spaces-after-equals-sign-in-list-options.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 897c3c97b6d70bc739eb58cee2c5430c9619ce56 Mon Sep 17 00:00:00 2001 -From: Dominic Cleal -Date: Sat, 9 Nov 2013 12:33:00 +0000 -Subject: [PATCH 4/5] Yum: permit spaces after equals sign in list options - -Fixes GitHub issue #45 - -(cherry picked from commit deb73b5f284db09e3c63f2d7698ab140e2337a3d) ---- - lenses/tests/test_yum.aug | 10 ++++++++++ - lenses/yum.aug | 2 +- - 2 files changed, 11 insertions(+), 1 deletion(-) - -diff --git a/lenses/tests/test_yum.aug b/lenses/tests/test_yum.aug -index 660a46c..17d4ea2 100644 ---- a/lenses/tests/test_yum.aug -+++ b/lenses/tests/test_yum.aug -@@ -201,6 +201,16 @@ gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi - Check that we can parse an empty line, to fix test-save *) - test Yum.lns get "\n" = { } - -+ (* Test: Yum.lns -+ Issue #45: allow spaces around equals sign *) -+ test Yum.lns get "[rpmforge] -+name = RHEL $releasever - RPMforge.net - dag -+baseurl = http://apt.sw.be/redhat/el6/en/$basearch/rpmforge\n" = -+ { "rpmforge" -+ { "name" = "RHEL $releasever - RPMforge.net - dag" } -+ { "baseurl" = "http://apt.sw.be/redhat/el6/en/$basearch/rpmforge" } -+ } -+ - (* Local Variables: *) - (* mode: caml *) - (* End: *) -diff --git a/lenses/yum.aug b/lenses/yum.aug -index 585695f..1b13833 100644 ---- a/lenses/yum.aug -+++ b/lenses/yum.aug -@@ -19,7 +19,7 @@ let eol = IniFile.eol - let list_entry (list_key:string) = - let list_value = store /[^# \t\r\n,][^ \t\r\n,]*[^# \t\r\n,]|[^# \t\r\n,]/ in - let list_sep = del /([ \t]*(,[ \t]*|\r?\n[ \t]+))|[ \t]+/ "\n\t" in -- [ key list_key . sep . list_value ] -+ [ key list_key . sep . Sep.opt_space . list_value ] - . (list_sep . Build.opt_list [ label list_key . list_value ] list_sep)? - . eol - --- -1.8.5.3 - diff --git a/SOURCES/0011-Shellvars-handle-case-statements-with-same-line-toke.patch b/SOURCES/0011-Shellvars-handle-case-statements-with-same-line-toke.patch deleted file mode 100644 index eb87110..0000000 --- a/SOURCES/0011-Shellvars-handle-case-statements-with-same-line-toke.patch +++ /dev/null @@ -1,180 +0,0 @@ -From 0cce971fabef13af3a9592ef93a505378f73338a Mon Sep 17 00:00:00 2001 -From: Dominic Cleal -Date: Wed, 29 Jan 2014 22:57:02 +0000 -Subject: [PATCH 5/5] Shellvars: handle case statements with same-line ;; - tokens - -Fixes RHBZ#1033799 - -(cherry picked from commit a1b9831d14f22f81cf7dc840160c08cc14234ee9) - -Conflicts: - NEWS - lenses/shellvars.aug ---- - lenses/shellvars.aug | 65 +++++++++++++++++++++++++---------------- - lenses/sysconfig.aug | 6 ++-- - lenses/tests/test_shellvars.aug | 11 +++++++ - 3 files changed, 54 insertions(+), 28 deletions(-) - -diff --git a/lenses/shellvars.aug b/lenses/shellvars.aug -index 4111ee6..eff933a 100644 ---- a/lenses/shellvars.aug -+++ b/lenses/shellvars.aug -@@ -59,40 +59,37 @@ module Shellvars = - | bquot | dbquot | dollar_assign | empty_array) - - let export = [ key "export" . Util.del_ws_spc ] -- let kv = [ Util.indent . export? . key key_re -- . eq . (simple_value | array) . comment_or_eol ] -+ let kv = Util.indent . export? . key key_re -+ . eq . (simple_value | array) - - let var_action (name:string) = -- Util.indent . del name name . Util.del_ws_spc . -- [ label ("@" . name) . counter "var_action" -- . Build.opt_list [ seq "var_action" . store (key_re | matching_re) ] Util.del_ws_spc -- . comment_or_eol ] -+ Util.indent . del name name . Util.del_ws_spc -+ . label ("@" . name) . counter "var_action" -+ . Build.opt_list [ seq "var_action" . store (key_re | matching_re) ] Util.del_ws_spc - - let unset = var_action "unset" - let bare_export = var_action "export" - - let source = -- [ Util.indent -- . del /\.|source/ "." . label ".source" -- . Util.del_ws_spc . store /[^;=# \t\n]+/ . comment_or_eol ] -+ Util.indent -+ . del /\.|source/ "." . label ".source" -+ . Util.del_ws_spc . store /[^;=# \t\n]+/ - - let shell_builtin_cmds = "ulimit" | "shift" | "exit" - - let builtin = -- [ Util.indent . label "@builtin" -- . store shell_builtin_cmds -- . (Util.del_ws_spc -- . [ label "args" . sto_to_semicol ])? -- . comment_or_eol ] -+ Util.indent . label "@builtin" -+ . store shell_builtin_cmds -+ . (Util.del_ws_spc -+ . [ label "args" . sto_to_semicol ])? - - let keyword (kw:string) = Util.indent . Util.del_str kw - let keyword_label (kw:string) (lbl:string) = keyword kw . label lbl - - let return = -- [ Util.indent . label "@return" -- . Util.del_str "return" -- . ( Util.del_ws_spc . store Rx.integer )? -- . comment_or_eol ] -+ Util.indent . label "@return" -+ . Util.del_str "return" -+ . ( Util.del_ws_spc . store Rx.integer )? - - - (************************************************************************ -@@ -128,11 +125,11 @@ module Shellvars = - let loop_select (entry:lens) = - generic_cond "select" "@select" "do" entry+ "done" - -- let case (entry:lens) = -+ let case (entry:lens) (entry_noeol:lens) = - let case_entry = [ label "@case_entry" - . Util.indent . store /[^ \t\n\)]+/ - . Util.del_str ")" . eol -- . entry* -+ . ( entry+ | entry_noeol )? - . Util.indent . Util.del_str ";;" . eol ] in - [ keyword_label "case" "@case" . Sep.space - . store (char+ | ("\"" . char+ . "\"")) -@@ -149,20 +146,38 @@ module Shellvars = - . entry+ - . Util.indent . Util.del_str "}" . eol ] - -+ let entry_eol = -+ let entry_eol_item (item:lens) = -+ [ item . comment_or_eol ] in -+ entry_eol_item source -+ | entry_eol_item kv -+ | entry_eol_item unset -+ | entry_eol_item bare_export -+ | entry_eol_item builtin -+ | entry_eol_item return -+ -+ let entry_noeol = -+ let entry_item (item:lens) = [ item ] in -+ entry_item source -+ | entry_item kv -+ | entry_item unset -+ | entry_item bare_export -+ | entry_item builtin -+ | entry_item return -+ - let rec rec_entry = -- let entry = comment | source | kv -- | unset | bare_export | builtin | return | rec_entry in -+ let entry = comment | entry_eol | rec_entry in - cond_if entry - | loop_for entry - | loop_select entry - | loop_while entry - | loop_until entry -- | case entry -+ | case entry entry_noeol - | function entry - -- let lns_norec = empty* . (comment | source | kv | unset | bare_export | builtin | return) * -+ let lns_norec = empty* . (comment | entry_eol) * - -- let lns = empty* . (comment | source | kv | unset | bare_export | builtin | return | rec_entry) * -+ let lns = empty* . (comment | entry_eol | rec_entry) * - - let sc_incl (n:string) = (incl ("/etc/sysconfig/" . n)) - let sc_excl (n:string) = (excl ("/etc/sysconfig/" . n)) -diff --git a/lenses/sysconfig.aug b/lenses/sysconfig.aug -index ee83af1..8c505b3 100644 ---- a/lenses/sysconfig.aug -+++ b/lenses/sysconfig.aug -@@ -55,10 +55,10 @@ module Sysconfig = - - let var_action = Shellvars.var_action - -- let unset = var_action "unset" -- let bare_export = var_action "export" -+ let unset = [ var_action "unset" . comment_or_eol ] -+ let bare_export = [ var_action "export" . comment_or_eol ] - -- let source = Shellvars.source -+ let source = [ Shellvars.source . comment_or_eol ] - - let lns = empty* . (comment | source | assign | unset | bare_export)* - -diff --git a/lenses/tests/test_shellvars.aug b/lenses/tests/test_shellvars.aug -index 79a5a4e..18fd361 100644 ---- a/lenses/tests/test_shellvars.aug -+++ b/lenses/tests/test_shellvars.aug -@@ -446,6 +446,17 @@ esac\n" = - { "1" = "TestVar1" } - { "2" = "TestVar2" } } - -+ (* Support ;; on same line as a case statement entry, RHBZ#1033799 *) -+ test lns get "case $ARG in -+ 0) TestVar=\"test0\" ;; -+ 1) TestVar=\"test1\" ;; -+esac\n" = -+ { "@case" = "$ARG" -+ { "@case_entry" = "0" -+ { "TestVar" = "\"test0\"" } } -+ { "@case_entry" = "1" -+ { "TestVar" = "\"test1\"" } } } -+ - (* Local Variables: *) - (* mode: caml *) - (* End: *) --- -1.8.5.3 - diff --git a/SOURCES/0012-IPRoute2-handle-hex-IDs-and-hyphens-in-names-as-pres.patch b/SOURCES/0012-IPRoute2-handle-hex-IDs-and-hyphens-in-names-as-pres.patch deleted file mode 100644 index 1cf85e1..0000000 --- a/SOURCES/0012-IPRoute2-handle-hex-IDs-and-hyphens-in-names-as-pres.patch +++ /dev/null @@ -1,59 +0,0 @@ -From e27a4f34800d8420a01ee3e7d4182c1d48489182 Mon Sep 17 00:00:00 2001 -From: Dominic Cleal -Date: Wed, 12 Feb 2014 09:49:03 +0000 -Subject: [PATCH 1/2] IPRoute2: handle hex IDs and hyphens in names, as present - in rt_dsfield - -Fixes RHBZ#1063961 - -(cherry picked from commit 2686edf4bcc0a2110ef5a2e8c01045ab0081b04e) - -Conflicts: - NEWS ---- - lenses/iproute2.aug | 3 ++- - lenses/tests/test_iproute2.aug | 10 ++++++++++ - 2 files changed, 12 insertions(+), 1 deletion(-) - -diff --git a/lenses/iproute2.aug b/lenses/iproute2.aug -index 66b4a2c..6f6b1ba 100644 ---- a/lenses/iproute2.aug -+++ b/lenses/iproute2.aug -@@ -2,7 +2,8 @@ module IPRoute2 = - autoload xfm - - let empty = [ del /[ \t]*#?[ \t]*\n/ "\n" ] -- let record = [ store /[0-9]+/ . del /[ \t]+/ "\t" . key /[a-zA-Z0-9]+/ . Util.comment_or_eol ] -+ let id = Rx.hex | Rx.integer -+ let record = [ store id . del /[ \t]+/ "\t" . key /[a-zA-Z0-9-]+/ . Util.comment_or_eol ] - - let lns = ( empty | Util.comment | record ) * - -diff --git a/lenses/tests/test_iproute2.aug b/lenses/tests/test_iproute2.aug -index cbd7802..cc24efe 100644 ---- a/lenses/tests/test_iproute2.aug -+++ b/lenses/tests/test_iproute2.aug -@@ -19,6 +19,11 @@ let conf = " - 203 adsl3 - 204 adsl4 - 205 wifi0 -+# -+# From rt_dsfield -+# -+0x00 default -+0x80 flash-override - " - - test IPRoute2.lns get conf = -@@ -41,3 +46,8 @@ test IPRoute2.lns get conf = - { "adsl3" = "203" } - { "adsl4" = "204" } - { "wifi0" = "205" } -+ { } -+ { "#comment" = "From rt_dsfield" } -+ { } -+ { "default" = "0x00" } -+ { "flash-override" = "0x80" } --- -1.8.5.3 - diff --git a/SOURCES/0013-IPRoute2-handle-in-protocol-names-swap-ID-and-name-f.patch b/SOURCES/0013-IPRoute2-handle-in-protocol-names-swap-ID-and-name-f.patch deleted file mode 100644 index 2756eae..0000000 --- a/SOURCES/0013-IPRoute2-handle-in-protocol-names-swap-ID-and-name-f.patch +++ /dev/null @@ -1,91 +0,0 @@ -From 13a5a36d4da2cb456b338b94025150d8e3847a5f Mon Sep 17 00:00:00 2001 -From: Dominic Cleal -Date: Wed, 12 Feb 2014 10:19:21 +0000 -Subject: [PATCH 2/2] IPRoute2: handle "/" in protocol names, swap ID and name - fields - -This is an incompatible change. - -Fixes RHBZ#1063968 - -(cherry picked from commit bd6c783dc05ccf66af02fe24af703737823a99ad) - -Conflicts: - NEWS ---- - lenses/iproute2.aug | 2 +- - lenses/tests/test_iproute2.aug | 34 ++++++++++++++++++++++------------ - 2 files changed, 23 insertions(+), 13 deletions(-) - -diff --git a/lenses/iproute2.aug b/lenses/iproute2.aug -index 6f6b1ba..fa3dcb7 100644 ---- a/lenses/iproute2.aug -+++ b/lenses/iproute2.aug -@@ -3,7 +3,7 @@ module IPRoute2 = - - let empty = [ del /[ \t]*#?[ \t]*\n/ "\n" ] - let id = Rx.hex | Rx.integer -- let record = [ store id . del /[ \t]+/ "\t" . key /[a-zA-Z0-9-]+/ . Util.comment_or_eol ] -+ let record = [ key id . del /[ \t]+/ "\t" . store /[a-zA-Z0-9\/-]+/ . Util.comment_or_eol ] - - let lns = ( empty | Util.comment | record ) * - -diff --git a/lenses/tests/test_iproute2.aug b/lenses/tests/test_iproute2.aug -index cc24efe..2acd367 100644 ---- a/lenses/tests/test_iproute2.aug -+++ b/lenses/tests/test_iproute2.aug -@@ -24,6 +24,11 @@ let conf = " - # - 0x00 default - 0x80 flash-override -+ -+# From rt_protos -+# -+254 gated/aggr -+253 gated/bgp - " - - test IPRoute2.lns get conf = -@@ -32,22 +37,27 @@ test IPRoute2.lns get conf = - { } - { "#comment" = "reserved values" } - { } -- { "local" = "255" } -- { "main" = "254" } -- { "default" = "253" } -- { "unspec" = "0" } -+ { "255" = "local" } -+ { "254" = "main" } -+ { "253" = "default" } -+ { "0" = "unspec" } - { } - { "#comment" = "local" } - { } - { "#comment" = "1 inr.ruhep" } -- { "h3g0" = "200" } -- { "adsl1" = "201" } -- { "adsl2" = "202" } -- { "adsl3" = "203" } -- { "adsl4" = "204" } -- { "wifi0" = "205" } -+ { "200" = "h3g0" } -+ { "201" = "adsl1" } -+ { "202" = "adsl2" } -+ { "203" = "adsl3" } -+ { "204" = "adsl4" } -+ { "205" = "wifi0" } - { } - { "#comment" = "From rt_dsfield" } - { } -- { "default" = "0x00" } -- { "flash-override" = "0x80" } -+ { "0x00" = "default" } -+ { "0x80" = "flash-override" } -+ { } -+ { "#comment" = "From rt_protos" } -+ { } -+ { "254" = "gated/aggr" } -+ { "253" = "gated/bgp" } --- -1.8.5.3 - diff --git a/SOURCES/0014-Yum.lns-simplify-code-for-combinatory-logic-of-list_.patch b/SOURCES/0014-Yum.lns-simplify-code-for-combinatory-logic-of-list_.patch deleted file mode 100644 index 89c94b7..0000000 --- a/SOURCES/0014-Yum.lns-simplify-code-for-combinatory-logic-of-list_.patch +++ /dev/null @@ -1,231 +0,0 @@ -From 50792ee989e81b52ed886be967843d85433f0ce5 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rapha=C3=ABl=20Pinson?= -Date: Tue, 3 Dec 2013 10:11:38 +0100 -Subject: [PATCH] Yum.lns: simplify code for combinatory logic of list_entry - elements - -(cherry picked from commit 9c645afbde88a2bdb5f8b139fde44968b019234c) - -Build: Add combinatorics group - -(cherry picked from commit 3f57641d8df3ed1edf89cd7641c4c6e84c3a3429) - -Yum.lns: split excludes as lists (ticket #275) - -(cherry picked from commit c16ccfd64045cb5f9c8793bc7589fc80fc027064) ---- - lenses/build.aug | 57 +++++++++++++++++++++++++++++++++++ - lenses/tests/test_build.aug | 73 +++++++++++++++++++++++++++++++++++++++++++++ - lenses/tests/test_yum.aug | 11 +++++++ - lenses/yum.aug | 16 +++++----- - 4 files changed, 149 insertions(+), 8 deletions(-) - -diff --git a/lenses/build.aug b/lenses/build.aug -index 2e57356..efc8814 100644 ---- a/lenses/build.aug -+++ b/lenses/build.aug -@@ -298,3 +298,60 @@ let block_newlines (entry:lens) (comment:lens) = - ************************************************************************) - let named_block (kw:regexp) (entry:lens) = [ key kw . block entry . eol ] - -+ -+(************************************************************************ -+ * Group: COMBINATORICS -+ ************************************************************************) -+ -+(************************************************************************ -+ * View: combine_two_opt_ord -+ * Combine two lenses optionally, ensuring first lens is first -+ * (a, and optionally b) -+ * -+ * Parameters: -+ * a:lens - the first lens -+ * b:lens - the second lens -+ ************************************************************************) -+let combine_two_opt_ord (a:lens) (b:lens) = a . b? -+ -+(************************************************************************ -+ * View: combine_two_opt -+ * Combine two lenses optionally -+ * (either a, b, or both, in any order) -+ * -+ * Parameters: -+ * a:lens - the first lens -+ * b:lens - the second lens -+ ************************************************************************) -+let combine_two_opt (a:lens) (b:lens) = -+ combine_two_opt_ord a b | combine_two_opt_ord b a -+ -+ -+(************************************************************************ -+ * View: combine_three_opt_ord -+ * Combine three lenses optionally, ensuring first lens is first -+ * (a followed by either b, c, or any of them, in any order) -+ * -+ * Parameters: -+ * a:lens - the first lens -+ * b:lens - the second lens -+ * c:lens - the third lens -+ ************************************************************************) -+let combine_three_opt_ord (a:lens) (b:lens) (c:lens) = -+ combine_two_opt_ord a (combine_two_opt b c) -+ -+(************************************************************************ -+ * View: combine_three_opt -+ * Combine three lenses optionally -+ * (either a, b, c, or any of them, in any order) -+ * -+ * Parameters: -+ * a:lens - the first lens -+ * b:lens - the second lens -+ * c:lens - the third lens -+ ************************************************************************) -+let combine_three_opt (a:lens) (b:lens) (c:lens) = -+ combine_three_opt_ord a b c -+ | combine_three_opt_ord b a c -+ | combine_three_opt_ord c b a -+ -diff --git a/lenses/tests/test_build.aug b/lenses/tests/test_build.aug -index b9b09fa..bc565f3 100644 ---- a/lenses/tests/test_build.aug -+++ b/lenses/tests/test_build.aug -@@ -174,3 +174,76 @@ test logrotate_block get "/var/log/wtmp\n/var/log/wtmp2\n{ - { "monthly" } - } - -+ -+(************************************************************************ -+ * Group: COMBINATORICS -+ ************************************************************************) -+ -+(* View: combine_two_opt -+ A minimalistic optional combination lens *) -+let combine_two_opt = -+ let entry (k:string) = [ key k ] -+ in Build.combine_two_opt (entry "a") (entry "b") -+ -+(* Test: combine_two_opt -+ Should parse ab *) -+test combine_two_opt get "ab" = { "a" } { "b" } -+ -+(* Test: combine_two_opt -+ Should parse ba *) -+test combine_two_opt get "ba" = { "b" } { "a" } -+ -+(* Test: combine_two_opt -+ Should parse a *) -+test combine_two_opt get "a" = { "a" } -+ -+(* Test: combine_two_opt -+ Should parse b *) -+test combine_two_opt get "b" = { "b" } -+ -+(* Test: combine_two_opt -+ Should not parse aa *) -+test combine_two_opt get "aa" = * -+ -+(* Test: combine_two_opt -+ Should not parse bb *) -+test combine_two_opt get "bb" = * -+ -+ -+(* View: combine_three_opt -+ A minimalistic optional combination lens *) -+let combine_three_opt = -+ let entry (k:string) = [ key k ] -+ in Build.combine_three_opt (entry "a") (entry "b") (entry "c") -+ -+(* Test: combine_three_opt -+ Should parse ab *) -+test combine_three_opt get "ab" = { "a" } { "b" } -+ -+(* Test: combine_three_opt -+ Should parse ba *) -+test combine_three_opt get "ba" = { "b" } { "a" } -+ -+(* Test: combine_three_opt -+ Should parse a *) -+test combine_three_opt get "a" = { "a" } -+ -+(* Test: combine_three_opt -+ Should parse b *) -+test combine_three_opt get "b" = { "b" } -+ -+(* Test: combine_three_opt -+ Should not parse aa *) -+test combine_three_opt get "aa" = * -+ -+(* Test: combine_three_opt -+ Should not parse bbc *) -+test combine_three_opt get "bbc" = * -+ -+(* Test: combine_three_opt -+ Should parse abc *) -+test combine_three_opt get "abc" = { "a" } { "b" } { "c" } -+ -+(* Test: combine_three_opt -+ Should parse cab *) -+test combine_three_opt get "cab" = { "c" } { "a" } { "b" } -diff --git a/lenses/tests/test_yum.aug b/lenses/tests/test_yum.aug -index 17d4ea2..2688182 100644 ---- a/lenses/tests/test_yum.aug -+++ b/lenses/tests/test_yum.aug -@@ -211,6 +211,17 @@ baseurl = http://apt.sw.be/redhat/el6/en/$basearch/rpmforge\n" = - { "baseurl" = "http://apt.sw.be/redhat/el6/en/$basearch/rpmforge" } - } - -+ (* Test: Yum.lns -+ Issue #275: parse excludes as a list *) -+ test Yum.lns get "[epel] -+name=Extra Packages for Enterprise Linux 6 - $basearch -+exclude=ocs* clamav* -+" = -+ { "epel" -+ { "name" = "Extra Packages for Enterprise Linux 6 - $basearch" } -+ { "exclude" = "ocs*" } -+ { "exclude" = "clamav*" } } -+ - (* Local Variables: *) - (* mode: caml *) - (* End: *) -diff --git a/lenses/yum.aug b/lenses/yum.aug -index 1b13833..030d944 100644 ---- a/lenses/yum.aug -+++ b/lenses/yum.aug -@@ -11,7 +11,6 @@ let sep = IniFile.sep "=" "=" - let empty = Util.empty - let eol = IniFile.eol - -- - (************************************************************************ - * ENTRY - *************************************************************************) -@@ -23,17 +22,18 @@ let list_entry (list_key:string) = - . (list_sep . Build.opt_list [ label list_key . list_value ] list_sep)? - . eol - --let entry_re = IniFile.entry_re - ("baseurl" | "gpgkey") -+let entry_re = IniFile.entry_re - ("baseurl" | "gpgkey" | "exclude") - - let entry = IniFile.entry entry_re sep comment - | empty - --let entries = entry* -- | entry* . list_entry "baseurl" . entry* -- | entry* . list_entry "gpgkey" . entry* -- | entry* . list_entry "baseurl" . entry* . list_entry "gpgkey" . entry* -- | entry* . list_entry "gpgkey" . entry* . list_entry "baseurl" . entry* -- -+let entries = -+ let list_entry_elem (k:string) = list_entry k . entry* -+ in entry* -+ | entry* . Build.combine_three_opt -+ (list_entry_elem "baseurl") -+ (list_entry_elem "gpgkey") -+ (list_entry_elem "exclude") - - - (***********************************************************************a --- -1.8.5.3 - diff --git a/SOURCES/0015-dovecot-enchancement-and-bug-fixes.patch b/SOURCES/0015-dovecot-enchancement-and-bug-fixes.patch deleted file mode 100644 index 136102e..0000000 --- a/SOURCES/0015-dovecot-enchancement-and-bug-fixes.patch +++ /dev/null @@ -1,111 +0,0 @@ -From 24364f9c9955ea10b094d6892e8c91d6b308ffe2 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Michael=20Haslgr=C3=BCbler?= -Date: Wed, 21 Aug 2013 23:19:04 +0200 -Subject: [PATCH 1/3] dovecot enchancement and bug fixes - -* add mailbox to block_names -* fix for block_args in quotes -* fix for block's brackets upon write -* fixes broken tests for mailbox -* fixes indention -* test case for block_args with " -* fixes broken indention - -(cherry picked from commit e6ff9449e5af1759d6b7828ceb118882e955dca4) - -Use Quote module in dovecot - -* use Quote.dquote_spaces for quoting - -(cherry picked from commit 735caf587959019d214a51a7c0cce57da9bb88f6) ---- - lenses/dovecot.aug | 37 +++++++++++++++++++++++++++++++++---- - lenses/tests/test_dovecot.aug | 6 ++++++ - 2 files changed, 39 insertions(+), 4 deletions(-) - -diff --git a/lenses/dovecot.aug b/lenses/dovecot.aug -index 6e5ccc9..e3558d0 100644 ---- a/lenses/dovecot.aug -+++ b/lenses/dovecot.aug -@@ -56,9 +56,6 @@ let value = any . (Rx.space . any)* - (* View: command_start *) - let command_start = Util.del_str "!" - --(* View: block_args --Map block arguments after block name and before "{" *) --let block_args = Sep.space . store /[A-Za-z0-9\/\\_-]+/ - - (****************************************************************** - * Group: ENTRIES -@@ -82,11 +79,43 @@ let entry = [ indent . key keys. eq . (Sep.opt_space . store value)? . eol ] - Map commands started with "!". *) - let command = [ command_start . key commands . Sep.space . store Rx.fspath . eol ] - -+(* -+View: dquote_spaces -+ Make double quotes mandatory if value contains spaces, -+ and optional if value doesn't contain spaces. -+ -+Based off Quote.dquote_spaces -+ -+Parameters: -+ lns1:lens - the lens before -+ lns2:lens - the lens after -+*) -+let dquote_spaces (lns1:lens) (lns2:lens) = -+ (* bare has no spaces, and is optionally quoted *) -+ let bare = Quote.do_dquote_opt (store /[^" \t\n]+/) -+ (* quoted has at least one space, and must be quoted *) -+ in let quoted = Quote.do_dquote (store /[^"\n]*[ \t]+[^"\n]*/) -+ in [ lns1 . bare . lns2 ] | [ lns1 . quoted . lns2 ] -+ -+let mailbox = indent -+ . dquote_spaces -+ (key /mailbox/ . Sep.space) -+ (Build.block_newlines (entry) comment . eol) -+ -+let block_ldelim_newlines_re = /[ \t]+\{([ \t\n]*\n)?/ -+ -+let block_newlines (entry:lens) (comment:lens) = -+ let indent = del Rx.opt_space "\t" -+ in del block_ldelim_newlines_re Build.block_ldelim_default -+ . ((entry | comment) . (Util.empty | entry | comment)*)? -+ . del Build.block_rdelim_newlines_re Build.block_rdelim_newlines_default -+ - (* View: block - Map block enclosed in brackets recursively. - Block may be indented and have optional argument. - Block body may have entries, comments, empty lines, and nested blocks recursively. *) --let rec block = [ indent . key block_names . block_args? . Build.block_newlines (entry|block) comment . eol ] -+let rec block = [ indent . key block_names . (Sep.space . Quote.do_dquote_opt (store /[\/A-Za-z0-9_-]+/))? . block_newlines (entry|block|mailbox) comment . eol ] -+ - - (****************************************************************** - * Group: LENS AND FILTER -diff --git a/lenses/tests/test_dovecot.aug b/lenses/tests/test_dovecot.aug -index 2201735..33ea16f 100644 ---- a/lenses/tests/test_dovecot.aug -+++ b/lenses/tests/test_dovecot.aug -@@ -465,6 +465,9 @@ namespace { - hidden = no - list = yes - subscriptions = yes -+ mailbox \"Sent Messages\" { -+ special_use = \Sent -+ } - } - - # Example shared namespace configuration -@@ -533,6 +536,9 @@ test Dovecot.lns get mail_conf = - { "hidden" = "no" } - { "list" = "yes" } - { "subscriptions" = "yes" } -+ { "mailbox" = "Sent Messages" -+ { "special_use" = "\Sent" } -+ } - } - { } - { "#comment" = "Example shared namespace configuration" } --- -1.8.5.3 - diff --git a/SOURCES/0016-Keepalived-add-more-virtual-real-server-settings-and.patch b/SOURCES/0016-Keepalived-add-more-virtual-real-server-settings-and.patch deleted file mode 100644 index a5d046d..0000000 --- a/SOURCES/0016-Keepalived-add-more-virtual-real-server-settings-and.patch +++ /dev/null @@ -1,279 +0,0 @@ -From 6eba1a21df59cc1638a2047f24080ebe657b497e Mon Sep 17 00:00:00 2001 -From: Dominic Cleal -Date: Fri, 21 Feb 2014 10:56:57 +0000 -Subject: [PATCH 2/3] Keepalived: add more virtual/real server settings and - checks - -Fixes RHBZ#1064388 - -(cherry picked from commit 1f6ec69ffcd46a5b6937025973a2f2337df2727d) - -Conflicts: - NEWS ---- - lenses/keepalived.aug | 81 +++++++++++++++++++++++-- - lenses/tests/test_keepalived.aug | 128 +++++++++++++++++++++++++++++++++++++++ - 2 files changed, 203 insertions(+), 6 deletions(-) - -diff --git a/lenses/keepalived.aug b/lenses/keepalived.aug -index 1fe3aa2..9fd02ff 100644 ---- a/lenses/keepalived.aug -+++ b/lenses/keepalived.aug -@@ -83,6 +83,10 @@ let field (kw:regexp) (sto:lens) = indent . Build.key_value_line_comment kw sep_ - A single word *) - let flag (kw:regexp) = [ indent . key kw . comment_or_eol ] - -+(* View: ip_port -+ An IP port pair *) -+let ip_port = [ label "ip" . sto_word ] . sep_spc . [ label "port" . sto_num ] -+ - (* View: lens_block - A generic block with a title lens. - The definition is very similar to Build.block_newlines -@@ -220,22 +224,87 @@ let vrrpd_conf = vrrp_sync_group | vrrp_instance | vrrp_script - - - (************************************************************************ -- * Group: LVS CONFIGURATION -+ * Group: REAL SERVER CHECKS CONFIGURATION - *************************************************************************) - - (* View: tcp_check_field *) --let tcp_check_field = field /connect_(timeout|port)/ sto_num -+let tcp_check_field = -+ let word_re = "bindto" -+ in let num_re = /connect_(timeout|port)/ -+ in field word_re sto_word -+ | field num_re sto_num -+ -+(* View: misc_check_field *) -+let misc_check_field = -+ let flag_re = "misc_dynamic" -+ in let num_re = "misc_timeout" -+ in let to_eol_re = "misc_path" -+ in field num_re sto_num -+ | flag flag_re -+ | field to_eol_re sto_to_eol -+ -+(* View: smtp_host_check_field *) -+let smtp_host_check_field = -+ let word_re = "connect_ip" | "bindto" -+ in let num_re = "connect_port" -+ in field word_re sto_word -+ | field num_re sto_num -+ -+(* View: smtp_check_field *) -+let smtp_check_field = -+ let word_re = "connect_ip" | "bindto" -+ in let num_re = "connect_timeout" | "retry" | "delay_before_retry" -+ in let to_eol_re = "helo_name" -+ in field word_re sto_word -+ | field num_re sto_num -+ | field to_eol_re sto_to_eol -+ | block "host" smtp_host_check_field -+ -+(* View: http_url_check_field *) -+let http_url_check_field = -+ let word_re = "digest" -+ in let num_re = "status_code" -+ in let to_eol_re = "path" -+ in field word_re sto_word -+ | field num_re sto_num -+ | field to_eol_re sto_to_eol -+ -+(* View: http_check_field *) -+let http_check_field = -+ let num_re = /connect_(timeout|port)/ | "nb_get_retry" | "delay_before_retry" -+ in field num_re sto_num -+ | block "url" http_url_check_field - - (* View: real_server_field *) --let real_server_field = field "weight" sto_num -- | block "TCP_CHECK" tcp_check_field -+let real_server_field = -+ let num_re = "weight" -+ in let flag_re = "inhibit_on_failure" -+ in let to_eol_re = /notify_(up|down)/ -+ in field num_re sto_num -+ | flag flag_re -+ | field to_eol_re sto_to_eol -+ | block "TCP_CHECK" tcp_check_field -+ | block "MISC_CHECK" misc_check_field -+ | block "SMTP_CHECK" smtp_check_field -+ | block /(HTTP|SSL)_GET/ http_check_field -+ -+(************************************************************************ -+ * Group: LVS CONFIGURATION -+ *************************************************************************) - - (* View: virtual_server_field *) - let virtual_server_field = -- let num_re = "delay_loop" -- in let word_re = /lb_(algo|kind)/ | "nat_mask" | "protocol" -+ let num_re = "delay_loop" | "persistence_timeout" | "quorum" | "hysteresis" -+ in let word_re = /lb_(algo|kind)/ | "nat_mask" | "protocol" | "persistence_granularity" -+ | "virtualhost" -+ in let flag_re = "ops" | "ha_suspend" | "alpha" | "omega" -+ in let to_eol_re = /quorum_(up|down)/ -+ in let ip_port_re = "sorry_server" - in field num_re sto_num - | field word_re sto_word -+ | flag flag_re -+ | field to_eol_re sto_to_eol -+ | field ip_port_re ip_port - | named_block_arg "real_server" "ip" "port" real_server_field - - (* View: virtual_server *) -diff --git a/lenses/tests/test_keepalived.aug b/lenses/tests/test_keepalived.aug -index 615509e..371df25 100644 ---- a/lenses/tests/test_keepalived.aug -+++ b/lenses/tests/test_keepalived.aug -@@ -118,6 +118,8 @@ virtual_server 192.168.1.11 22 { - - protocol TCP - -+ sorry_server 10.20.40.30 22 -+ - ! there can be as many real_server blocks as you need - - real_server 10.20.40.10 22 { -@@ -269,6 +271,10 @@ weight 2 # add 2 points of prio if OK - { } - { "protocol" = "TCP" } - { } -+ { "sorry_server" -+ { "ip" = "10.20.40.30" } -+ { "port" = "22" } } -+ { } - { "#comment" = "there can be as many real_server blocks as you need" } - { } - { "real_server" -@@ -312,3 +318,125 @@ weight 2 # add 2 points of prio if OK - { } - { "#comment" = "that's all" } - -+(* Variable: tcp_check -+ An example of a TCP health checker *) -+let tcp_check = "virtual_server 192.168.1.11 22 { -+ real_server 10.20.40.10 22 { -+ TCP_CHECK { -+ connect_timeout 3 -+ connect_port 22 -+ bindto 192.168.1.1 -+ } -+ } -+} -+" -+test Keepalived.lns get tcp_check = -+ { "virtual_server" -+ { "ip" = "192.168.1.11" } -+ { "port" = "22" } -+ { "real_server" -+ { "ip" = "10.20.40.10" } -+ { "port" = "22" } -+ { "TCP_CHECK" -+ { "connect_timeout" = "3" } -+ { "connect_port" = "22" } -+ { "bindto" = "192.168.1.1" } } } } -+ -+(* Variable: misc_check -+ An example of a MISC health checker *) -+let misc_check = "virtual_server 192.168.1.11 22 { -+ real_server 10.20.40.10 22 { -+ MISC_CHECK { -+ misc_path /usr/local/bin/server_test -+ misc_timeout 3 -+ misc_dynamic -+ } -+ } -+} -+" -+test Keepalived.lns get misc_check = -+ { "virtual_server" -+ { "ip" = "192.168.1.11" } -+ { "port" = "22" } -+ { "real_server" -+ { "ip" = "10.20.40.10" } -+ { "port" = "22" } -+ { "MISC_CHECK" -+ { "misc_path" = "/usr/local/bin/server_test" } -+ { "misc_timeout" = "3" } -+ { "misc_dynamic" } } } } -+ -+(* Variable: smtp_check -+ An example of an SMTP health checker *) -+let smtp_check = "virtual_server 192.168.1.11 22 { -+ real_server 10.20.40.10 22 { -+ SMTP_CHECK { -+ host { -+ connect_ip 10.20.40.11 -+ connect_port 587 -+ bindto 192.168.1.1 -+ } -+ connect_timeout 3 -+ retry 5 -+ delay_before_retry 10 -+ helo_name \"Testing Augeas\" -+ } -+ } -+} -+" -+test Keepalived.lns get smtp_check = -+ { "virtual_server" -+ { "ip" = "192.168.1.11" } -+ { "port" = "22" } -+ { "real_server" -+ { "ip" = "10.20.40.10" } -+ { "port" = "22" } -+ { "SMTP_CHECK" -+ { "host" -+ { "connect_ip" = "10.20.40.11" } -+ { "connect_port" = "587" } -+ { "bindto" = "192.168.1.1" } } -+ { "connect_timeout" = "3" } -+ { "retry" = "5" } -+ { "delay_before_retry" = "10" } -+ { "helo_name" = "\"Testing Augeas\"" } } } } -+ -+(* Variable: http_check -+ An example of an HTTP health checker *) -+let http_check = "virtual_server 192.168.1.11 22 { -+ real_server 10.20.40.10 22 { -+ HTTP_GET { -+ url { -+ path /mrtg2/ -+ digest 9b3a0c85a887a256d6939da88aabd8cd -+ status_code 200 -+ } -+ connect_timeout 3 -+ connect_port 8080 -+ nb_get_retry 5 -+ delay_before_retry 10 -+ } -+ SSL_GET { -+ connect_port 8443 -+ } -+ } -+} -+" -+test Keepalived.lns get http_check = -+ { "virtual_server" -+ { "ip" = "192.168.1.11" } -+ { "port" = "22" } -+ { "real_server" -+ { "ip" = "10.20.40.10" } -+ { "port" = "22" } -+ { "HTTP_GET" -+ { "url" -+ { "path" = "/mrtg2/" } -+ { "digest" = "9b3a0c85a887a256d6939da88aabd8cd" } -+ { "status_code" = "200" } } -+ { "connect_timeout" = "3" } -+ { "connect_port" = "8080" } -+ { "nb_get_retry" = "5" } -+ { "delay_before_retry" = "10" } } -+ { "SSL_GET" -+ { "connect_port" = "8443" } } } } --- -1.8.5.3 - diff --git a/SOURCES/0017-Krb5-permit-braces-in-values-when-not-in-sub-section.patch b/SOURCES/0017-Krb5-permit-braces-in-values-when-not-in-sub-section.patch deleted file mode 100644 index 1d54714..0000000 --- a/SOURCES/0017-Krb5-permit-braces-in-values-when-not-in-sub-section.patch +++ /dev/null @@ -1,87 +0,0 @@ -From 1ac63d941a60816799b7c70941fefbafdb4d79de Mon Sep 17 00:00:00 2001 -From: Dominic Cleal -Date: Tue, 25 Feb 2014 16:19:51 +0000 -Subject: [PATCH 3/3] Krb5: permit braces in values when not in sub-section - -Fixes RHBZ#1066419 - -(cherry picked from commit d9465ab8e88f91cb5a29eb9f04044876ce45a2d9) - -Conflicts: - NEWS ---- - lenses/krb5.aug | 15 ++++++++------- - lenses/tests/test_krb5.aug | 7 +++++++ - 2 files changed, 15 insertions(+), 7 deletions(-) - -diff --git a/lenses/krb5.aug b/lenses/krb5.aug -index 8d26cfe..8b4ebe4 100644 ---- a/lenses/krb5.aug -+++ b/lenses/krb5.aug -@@ -25,16 +25,17 @@ let realm_re = /[A-Z][.a-zA-Z0-9-]*/ - let app_re = /[a-z][a-zA-Z0-9_]*/ - let name_re = /[.a-zA-Z0-9_-]+/ - --let value = store /[^;# \t\r\n{}]+/ --let entry (kw:regexp) (sep:lens) (comment:lens) -+let value_br = store /[^;# \t\r\n{}]+/ -+let value = store /[^;# \t\r\n]+/ -+let entry (kw:regexp) (sep:lens) (value:lens) (comment:lens) - = [ indent . key kw . sep . value . (comment|eol) ] | comment - - let subsec_entry (kw:regexp) (sep:lens) (comment:lens) -- = ( entry kw sep comment ) | empty -+ = ( entry kw sep value_br comment ) | empty - - let simple_section (n:string) (k:regexp) = - let title = Inifile.indented_title n in -- let entry = entry k eq comment in -+ let entry = entry k eq value comment in - Inifile.record title entry - - let record (t:string) (e:lens) = -@@ -59,7 +60,7 @@ let enctype_list (nr:regexp) (ns:string) = - . (comment|eol) . [ label "#eol" ] - - let libdefaults = -- let option = entry (name_re - ("v4_name_convert" |enctypes)) eq comment in -+ let option = entry (name_re - ("v4_name_convert" |enctypes)) eq value comment in - let enctype_lists = enctype_list /permitted_enctypes/i "permitted_enctypes" - | enctype_list /default_tgs_enctypes/i "default_tgs_enctypes" - | enctype_list /default_tkt_enctypes/i "default_tkt_enctypes" in -@@ -73,7 +74,7 @@ let login = - simple_section "login" keys - - let appdefaults = -- let option = entry (name_re - ("realm" | "application")) eq comment in -+ let option = entry (name_re - ("realm" | "application")) eq value_br comment in - let realm = [ indent . label "realm" . store realm_re . - eq_openbr . (option|empty)* . closebr . eol ] in - let app = [ indent . label "application" . store app_re . -@@ -117,7 +118,7 @@ let logging = - let capaths = - let realm = [ indent . key realm_re . - eq_openbr . -- (entry realm_re eq comment)* . closebr . eol ] in -+ (entry realm_re eq value_br comment)* . closebr . eol ] in - record "capaths" (realm|comment) - - let dbdefaults = -diff --git a/lenses/tests/test_krb5.aug b/lenses/tests/test_krb5.aug -index 0547b65..b0ec6d6 100644 ---- a/lenses/tests/test_krb5.aug -+++ b/lenses/tests/test_krb5.aug -@@ -995,3 +995,10 @@ test Krb5.lns get v4_name_convert = - (* Ticket #288: semicolons for comments *) - test Krb5.lns get "; AD : This Kerberos configuration is for CERN's Active Directory realm.\n" = - { "#comment" = "AD : This Kerberos configuration is for CERN's Active Directory realm." } -+ -+(* RHBZ#1066419: braces in values *) -+test Krb5.lns get "[libdefaults]\n -+default_ccache_name = KEYRING:persistent:%{uid}\n" = -+ { "libdefaults" -+ { } -+ { "default_ccache_name" = "KEYRING:persistent:%{uid}" } } --- -1.8.5.3 - diff --git a/SOURCES/0018-Exports-permit-colons-for-IPv6-client-addresses.patch b/SOURCES/0018-Exports-permit-colons-for-IPv6-client-addresses.patch deleted file mode 100644 index fb14b33..0000000 --- a/SOURCES/0018-Exports-permit-colons-for-IPv6-client-addresses.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 8fb02d5decac12c9b06b5e420e36e9d46c538c54 Mon Sep 17 00:00:00 2001 -From: Dominic Cleal -Date: Sat, 5 Oct 2013 17:04:15 +0100 -Subject: [PATCH] Exports: permit colons for IPv6 client addresses - -Fixes ticket #366 - -(cherry picked from commit 68955992ae548f9a65a4fb4cdbf2ffbe5520a50e) ---- - lenses/exports.aug | 2 +- - lenses/tests/test_exports.aug | 4 ++++ - 2 files changed, 5 insertions(+), 1 deletion(-) - -diff --git a/lenses/exports.aug b/lenses/exports.aug -index 4e134c8..3de0de1 100644 ---- a/lenses/exports.aug -+++ b/lenses/exports.aug -@@ -76,7 +76,7 @@ About: Limitations - module Exports = - autoload xfm - -- let client_re = /[a-zA-Z0-9.@*?\/-]+/ -+ let client_re = /[a-zA-Z0-9.@*?\/:-]+/ - - let eol = Util.eol - let lbracket = Util.del_str "(" -diff --git a/lenses/tests/test_exports.aug b/lenses/tests/test_exports.aug -index 14a51e8..3d0e9c2 100644 ---- a/lenses/tests/test_exports.aug -+++ b/lenses/tests/test_exports.aug -@@ -8,6 +8,7 @@ let s = "/local 172.31.0.0/16(rw,sync) \t - /local2 somehost(rw,sync) - /local3 some-host(rw,sync) - /local3 an-other-host(rw,sync) -+/local4 2000:123:456::/64(rw) - " - - test Exports.lns get s = -@@ -43,3 +44,6 @@ test Exports.lns get s = - { "client" = "an-other-host" - { "option" = "rw" } - { "option" = "sync" } } } -+ { "dir" = "/local4" -+ { "client" = "2000:123:456::/64" -+ { "option" = "rw" } } } diff --git a/SOURCES/0019-Added-chrony-lense.patch b/SOURCES/0019-Added-chrony-lense.patch deleted file mode 100644 index 14d80e6..0000000 --- a/SOURCES/0019-Added-chrony-lense.patch +++ /dev/null @@ -1,468 +0,0 @@ -From f6d87cb468845c498e42e7285099d5b295ee936b Mon Sep 17 00:00:00 2001 -From: Pat Riehecky -Date: Wed, 12 Feb 2014 11:43:16 -0600 -Subject: [PATCH] Added chrony lense - -(cherry picked from commit 319e30fcbea54aadc97430809cea6fb7b398b4b6) ---- - doc/naturaldocs/conf/lenses/Menu.txt | 2 + - lenses/chrony.aug | 266 +++++++++++++++++++++++++++++++++++ - lenses/tests/test_chrony.aug | 143 +++++++++++++++++++ - tests/Makefile.am | 1 + - 4 files changed, 412 insertions(+) - create mode 100644 lenses/chrony.aug - create mode 100644 lenses/tests/test_chrony.aug - -diff --git a/doc/naturaldocs/conf/lenses/Menu.txt b/doc/naturaldocs/conf/lenses/Menu.txt -index a6fa0f0..34e0bf6 100644 ---- a/doc/naturaldocs/conf/lenses/Menu.txt -+++ b/doc/naturaldocs/conf/lenses/Menu.txt -@@ -74,6 +74,7 @@ Group: Specific Modules { - File: Cgconfig (no auto-title, cgconfig.aug) - File: Cgrules (no auto-title, cgrules.aug) - File: Channels (channels.aug) -+ File: Chrony (chrony.aug) - File: Collectd (collectd.aug) - File: Cron (cron.aug) - File: Crypttab (crypttab.aug) -@@ -191,6 +192,7 @@ Group: Tests and Examples { - File: Test_Build (tests/test_build.aug) - File: Test_Carbon (tests/test_carbon.aug) - File: Test_Channels (tests/test_channels.aug) -+ File: Test_Chrony (tests/test_chrony.aug) - File: Test_Collectd (tests/test_collectd.aug) - File: Test_Cups (tests/test_cups.aug) - File: Test_Dovecot (tests/test_dovecot.aug) -diff --git a/lenses/chrony.aug b/lenses/chrony.aug -new file mode 100644 -index 0000000..ede2c94 ---- /dev/null -+++ b/lenses/chrony.aug -@@ -0,0 +1,266 @@ -+(* -+Module: Chrony -+ Parses the chrony config file -+ -+Author: Pat Riehecky -+ -+About: Reference -+ This lens tries to keep as close as possible to chrony config syntax -+ -+ See http://chrony.tuxfamily.org/manual.html#Configuration-file -+ -+About: Limitations -+ Does not (currently) support -+ - include -+ - manual -+ - refclock -+ - tempcomp -+ -+About: License -+ This file is licenced under the LGPL v2+, like the rest of Augeas. -+ -+About: Lens Usage -+ To be documented -+ -+About: Configuration files -+ This lens applies to /etc/chrony.conf -+ -+ See . -+*) -+ -+module Chrony = -+ autoload xfm -+ -+(************************************************************************ -+ * Group: Import provided expressions -+ ************************************************************************) -+ (* View: empty *) -+ let empty = Util.empty -+ -+ (* View: eol *) -+ let eol = Util.eol -+ -+ (* View: space *) -+ let space = Sep.space -+ -+ (* Variable: email_addr *) -+ let email_addr = Rx.email_addr -+ -+ (* Variable: word *) -+ let word = Rx.word -+ -+ (* Variable: integer *) -+ let integer = Rx.integer -+ -+ (* Variable: decimal *) -+ let decimal = Rx.decimal -+ -+ (* Variable: ip *) -+ let ip = Rx.ip -+ -+(************************************************************************ -+ * Group: Create required expressions -+ ************************************************************************) -+ (* Variable: number *) -+ let number = integer | decimal -+ -+ (* Variable: address_re *) -+ let address_re = Rx.ip | Rx.hostname -+ -+ (* -+ View: comment -+ from 4.2.1 of the upstream doc -+ Chrony comments start with: ! ; # or % and must be on their own line -+ *) -+ let comment = Util.comment_generic /[ \t]*[!;#%][ \t]*/ "# " -+ -+ (* Variable: no_space -+ No spaces or comment characters -+ *) -+ let no_space = /[^ \t\r\n!;#%]+/ -+ -+ (* Variable: cmd_options -+ Server/Peer options with values -+ *) -+ let cmd_options = "key" -+ | /maxdelay((dev)?ratio)?/ -+ | /(min|max)poll/ -+ | "polltarget" -+ | "port" -+ | "presend" -+ -+ (* Variable: cmd_flags -+ Server/Peer options without values -+ *) -+ let cmd_flags = "auto_offline"|"iburst"|"noselect"|"offline"|"prefer" -+ -+ (* Variable: server_peer -+ Server/Peer key names -+ *) -+ let server_peer = "server"|"peer" -+ -+ (* Variable: flags -+ Options without values -+ *) -+ let flags = "dumponexit" -+ | "generatecommandkey" -+ | "lock_all" -+ | "noclientlog" -+ | "rtconutc" -+ | "rtcsync" -+ -+ (* Variable: log_flags -+ log has a specific options list -+ *) -+ let log_flags = /measurments|statistics|tracking|rtc|refclocks|tempcomp/ -+ -+ (* Variable: simple_keys -+ Options with single values -+ *) -+ let simple_keys = "acquisitionport" | "allow" | "bindaddress" -+ | "bindcmdaddress" | "cmdallow" | "cmddeny" -+ | "combinelimit" | "commandkey" | "cmdport" -+ | "corrtimeratio" | "deny" | "driftfile" -+ | "dumpdir" | "keyfile" | "leapsectz" | "linux_hz" -+ | "linux_freq_scale" | "logbanner" | "logchange" -+ | "logdir" | "maxclockerror" | "maxsamples" -+ | "maxupdateskew" | "minsamples" | "clientloglimit" -+ | "pidfile" | "port" | "reselectdist" | "rtcdevice" -+ | "rtcfile" | "sched_priority" | "stratumweight" | "user" -+ -+(************************************************************************ -+ * Group: Make some sub-lenses for use in later lenses -+ ************************************************************************) -+ (* View: host_flags *) -+ let host_flags = [ space . key cmd_flags ] -+ (* View: host_options *) -+ let host_options = [ space . key cmd_options . space . store integer ] -+ (* View: log_flag_list *) -+ let log_flag_list = [ space . key log_flags ] -+ (* View: store_address *) -+ let store_address = [ label "address" . store address_re ] -+ -+(************************************************************************ -+ * Group: Lenses for parsing out sections -+ ************************************************************************) -+ (* View: all_flags -+ match all flags using Build.flag_line -+ *) -+ let all_flags = Build.flag_line flags -+ -+ (* View: kv -+ options with only one arg can be directly mapped to key = value -+ *) -+ let kv = Build.key_value_line_comment simple_keys space (store no_space) comment -+ -+ (* Property: Options with multiple values -+ -+ Each of these gets their own parsing block -+ - server|peer
-+ - log -+ - broadcast
-+ - fallbackdrift -+ - initstepslew -+ - local stratum -+ - mailonchange -+ - makestep -+ - maxchange -+ *) -+ -+ (* View: host_list -+ Find all ntp servers/peers and their flags/options -+ *) -+ let host_list = [ Util.indent . key server_peer -+ . space . store address_re -+ . ( host_flags | host_options )* -+ . eol ] -+ -+ (* View: log_list -+ log has a specific options list -+ *) -+ let log_list = [ Util.indent . key "log" . log_flag_list+ . eol ] -+ -+ (* View: bcast -+ broadcast has specific syntax -+ *) -+ let bcast = [ Util.indent . key "broadcast" -+ . space . [ label "interval" . store integer ] -+ . space . store_address -+ . ( space . [ label "port" . store integer] | eol) ] -+ -+ (* View: fdrift -+ fallbackdrift has specific syntax -+ *) -+ let fdrift = [ Util.indent . key "fallbackdrift" -+ . space . [ label "min" . store integer ] -+ . space . [ label "max" . store integer ] -+ . eol ] -+ -+ (* View: istepslew -+ initstepslew has specific syntax -+ *) -+ let istepslew = [ Util.indent . key "initstepslew" -+ . space . [ label "threshold" . store number ] -+ . ( space . store_address )+ -+ . eol ] -+ -+ (* View: local -+ local has specific syntax -+ *) -+ let local = [ Util.indent . key "local" . space -+ . [ key "stratum" . space . store integer ] -+ . eol ] -+ -+ (* View: email -+ mailonchange has specific syntax -+ *) -+ let email = [ Util.indent . key "mailonchange" . space -+ . [ label "emailaddress" . store email_addr ] -+ . space -+ . [ label "threshold" . store number ] -+ . eol ] -+ -+ (* View: makestep -+ makestep has specific syntax -+ *) -+ let makestep = [ Util.indent . key "makestep" -+ . space -+ . [ label "threshold" . store number ] -+ . space -+ . [ label "limit" . store integer ] -+ . eol ] -+ -+ (* View: maxchange -+ maxchange has specific syntax -+ *) -+ let maxchange = [ Util.indent . key "maxchange" -+ . space -+ . [ label "threshold" . store number ] -+ . space -+ . [ label "delay" . store integer ] -+ . space -+ . [ label "limit" . store integer ] -+ . eol ] -+ -+(************************************************************************ -+ * Group: Final lense summary -+ ************************************************************************) -+(* View: settings -+ * All supported chrony settings -+ *) -+let settings = host_list | log_list | bcast | fdrift | istepslew -+ | local | email | makestep | maxchange | kv | all_flags -+ -+(* -+ * View: lns -+ * The crony lens -+ *) -+let lns = ( empty | comment | settings )* -+ -+(* View: filter -+ * The files parsed by default -+ *) -+let filter = incl "/etc/chrony.conf" -+ -+let xfm = transform lns filter -+ -diff --git a/lenses/tests/test_chrony.aug b/lenses/tests/test_chrony.aug -new file mode 100644 -index 0000000..4917358 ---- /dev/null -+++ b/lenses/tests/test_chrony.aug -@@ -0,0 +1,143 @@ -+(* -+Module: Test_Chrony -+ Provides unit tests and examples for the lens. -+*) -+ -+module Test_Chrony = -+ -+ let exampleconf = "# Comment -+#Comment -+! Comment -+!Comment -+; Comment -+;Comment -+% Comment -+%Comment -+ -+server ntp1.example.com -+server ntp2.example.com iburst -+server ntp3.example.com presend 2 -+server ntp4.example.com offline polltarget 4 -+server ntp5.example.com maxdelay 2 offline -+server ntp6.example.com maxdelay 2 iburst presend 2 -+server ntp7.example.com iburst presend 2 offline -+peer ntpc1.example.com -+stratumweight 0 -+driftfile /var/lib/chrony/drift -+rtcsync -+makestep 10 3 -+bindcmdaddress 127.0.0.1 -+bindcmdaddress ::1 -+local stratum 10 -+keyfile /etc/chrony.keys -+commandkey 1 -+generatecommandkey -+noclientlog -+logchange 0.5 -+logdir /var/log/chrony -+log rtc -+leapsectz right/UTC -+broadcast 10 192.168.1.255 -+broadcast 10 192.168.100.255 123 -+fallbackdrift 16 19 -+mailonchange root@localhost 0.5 -+maxchange 1000 1 2 -+initstepslew 30 foo.bar.com -+initstepslew 30 foo.bar.com baz.quz.com -+" -+ -+ test Chrony.lns get exampleconf = -+ { "#comment" = "Comment" } -+ { "#comment" = "Comment" } -+ { "#comment" = "Comment" } -+ { "#comment" = "Comment" } -+ { "#comment" = "Comment" } -+ { "#comment" = "Comment" } -+ { "#comment" = "Comment" } -+ { "#comment" = "Comment" } -+ { } -+ { "server" = "ntp1.example.com" } -+ { "server" = "ntp2.example.com" -+ { "iburst" } -+ } -+ { "server" = "ntp3.example.com" -+ { "presend" = "2" } -+ } -+ { "server" = "ntp4.example.com" -+ { "offline" } -+ { "polltarget" = "4" } -+ } -+ { "server" = "ntp5.example.com" -+ { "maxdelay" = "2" } -+ { "offline" } -+ } -+ { "server" = "ntp6.example.com" -+ { "maxdelay" = "2" } -+ { "iburst" } -+ { "presend" = "2" } -+ } -+ { "server" = "ntp7.example.com" -+ { "iburst" } -+ { "presend" = "2" } -+ { "offline" } -+ } -+ { "peer" = "ntpc1.example.com" } -+ { "stratumweight" = "0" } -+ { "driftfile" = "/var/lib/chrony/drift" } -+ { "rtcsync" } -+ { "makestep" -+ { "threshold" = "10" } -+ { "limit" = "3" } -+ } -+ { "bindcmdaddress" = "127.0.0.1" } -+ { "bindcmdaddress" = "::1" } -+ { "local" -+ { "stratum" = "10" } -+ } -+ { "keyfile" = "/etc/chrony.keys" } -+ { "commandkey" = "1" } -+ { "generatecommandkey" } -+ { "noclientlog" } -+ { "logchange" = "0.5" } -+ { "logdir" = "/var/log/chrony" } -+ { "log" -+ { "rtc" } -+ } -+ { "leapsectz" = "right/UTC" } -+ { "broadcast" -+ { "interval" = "10" } -+ { "address" = "192.168.1.255" } -+ } -+ { "broadcast" -+ { "interval" = "10" } -+ { "address" = "192.168.100.255" } -+ { "port" = "123" } -+ } -+ { } -+ { "fallbackdrift" -+ { "min" = "16" } -+ { "max" = "19" } -+ } -+ { "mailonchange" -+ { "emailaddress" = "root@localhost" } -+ { "threshold" = "0.5" } -+ } -+ { "maxchange" -+ { "threshold" = "1000" } -+ { "delay" = "1" } -+ { "limit" = "2" } -+ } -+ { "initstepslew" -+ { "threshold" = "30" } -+ { "address" = "foo.bar.com" } -+ } -+ { "initstepslew" -+ { "threshold" = "30" } -+ { "address" = "foo.bar.com" } -+ { "address" = "baz.quz.com" } -+ } -+ -+ -+(* Local Variables: *) -+(* mode: caml *) -+(* End: *) -diff --git a/tests/Makefile.am b/tests/Makefile.am -index 180a19d..1b79629 100644 ---- a/tests/Makefile.am -+++ b/tests/Makefile.am -@@ -41,6 +41,7 @@ lens_tests = \ - lens-cgconfig.sh \ - lens-cgrules.sh \ - lens-channels.sh \ -+ lens-chrony.sh \ - lens-cobblersettings.sh \ - lens-cobblermodules.sh \ - lens-collectd.sh \ diff --git a/SOURCES/0020-Fixes-27-Automounter-lens-does-not-handle-hostnames-.patch b/SOURCES/0020-Fixes-27-Automounter-lens-does-not-handle-hostnames-.patch deleted file mode 100644 index 6c755e3..0000000 --- a/SOURCES/0020-Fixes-27-Automounter-lens-does-not-handle-hostnames-.patch +++ /dev/null @@ -1,60 +0,0 @@ -From ed0594ef0bfd796bcebd8ac38e54c991553d509a Mon Sep 17 00:00:00 2001 -From: Jan Vansteenkiste -Date: Thu, 27 Jun 2013 14:10:26 +0200 -Subject: [PATCH] Fixes #27: Automounter lens does not handle hostnames with - dashes in them - -(cherry picked from commit e6643d81a480d99886070243455456e5d0147885) ---- - lenses/automounter.aug | 2 +- - lenses/tests/test_automounter.aug | 16 +++++++++++++++- - 2 files changed, 16 insertions(+), 2 deletions(-) - -diff --git a/lenses/automounter.aug b/lenses/automounter.aug -index 029acbf..f830c7d 100644 ---- a/lenses/automounter.aug -+++ b/lenses/automounter.aug -@@ -40,7 +40,7 @@ let comment = Util.comment - let path = /[^-+#: \t\n][^#: \t\n]*/ - - (* View: hostname *) --let hostname = /[^-:#\(\), \n\t]+/ -+let hostname = /[^-:#\(\), \n\t][^:#\(\), \n\t]*/ - - (* An option label can't contain comma, comment, equals, or space *) - let optlabel = /[^,#:\(\)= \n\t]+/ -diff --git a/lenses/tests/test_automounter.aug b/lenses/tests/test_automounter.aug -index 7c2db86..c84fc0a 100644 ---- a/lenses/tests/test_automounter.aug -+++ b/lenses/tests/test_automounter.aug -@@ -25,6 +25,8 @@ server -rw,hard,intr / -ro myserver.me.org:/ \ - /usr myserver.me.org:/usr \ - /home myserver.me.org:/home - -+server -rw,hard,intr / -ro my-with-dash-server.me.org:/ -+ - # included maps - +auto_home - " -@@ -148,8 +150,20 @@ server -rw,hard,intr / -ro myserver.me.org:/ \ - { "host" = "myserver.me.org" } - { "path" = "/home" } } } } } } - { } -+ { "11" = "server" -+ { "opt" = "rw" } -+ { "opt" = "hard" } -+ { "opt" = "intr" } -+ { "mount" -+ { "1" = "/" -+ { "opt" = "ro" } -+ { "location" -+ { "1" -+ { "host" = "my-with-dash-server.me.org" } -+ { "path" = "/" } } } } } } -+ { } - { "#comment" = "included maps" } -- { "11" = "+" -+ { "12" = "+" - { "map" = "auto_home" } } - - (* Local Variables: *) diff --git a/SOURCES/0021-Systemd-parse-etc-sysconfig-.systemd-as-used-in-389-.patch b/SOURCES/0021-Systemd-parse-etc-sysconfig-.systemd-as-used-in-389-.patch deleted file mode 100644 index 0a91778..0000000 --- a/SOURCES/0021-Systemd-parse-etc-sysconfig-.systemd-as-used-in-389-.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 2f5770c038c9fdb158b456ca105276968d84514e Mon Sep 17 00:00:00 2001 -From: Dominic Cleal -Date: Wed, 9 Jul 2014 09:45:19 +0100 -Subject: [PATCH] Systemd: parse /etc/sysconfig/*.systemd as used in 389-ds - -Fixes RHBZ#1083022 - -(cherry picked from commit 9073aa57a7003bad3f8b9886675f155e5b374892) - -Conflicts: - NEWS ---- - lenses/shellvars.aug | 3 ++- - lenses/systemd.aug | 1 + - 2 files changed, 3 insertions(+), 1 deletion(-) - -diff --git a/lenses/shellvars.aug b/lenses/shellvars.aug -index eff933a..784ce6e 100644 ---- a/lenses/shellvars.aug -+++ b/lenses/shellvars.aug -@@ -212,7 +212,8 @@ module Shellvars = - sc_excl "SuSEfirewall2.d" . - sc_incl "SuSEfirewall2.d/cobbler" . - sc_incl "SuSEfirewall2.d/services/*" . -- sc_excl "SuSEfirewall2.d/services/TEMPLATE" -+ sc_excl "SuSEfirewall2.d/services/TEMPLATE" . -+ sc_excl "*.systemd" - - let filter_default = incl "/etc/default/*" - . excl "/etc/default/grub_installdevice*" -diff --git a/lenses/systemd.aug b/lenses/systemd.aug -index aba1001..c7f9f9d 100644 ---- a/lenses/systemd.aug -+++ b/lenses/systemd.aug -@@ -159,6 +159,7 @@ let filter = incl "/lib/systemd/system/*" - . incl "/lib/systemd/system/*/*" - . incl "/etc/systemd/system/*" - . incl "/etc/systemd/system/*/*" -+ . incl "/etc/sysconfig/*.systemd" - . Util.stdexcl - - let xfm = transform lns filter diff --git a/SOURCES/0022-src-augeas.c-unlink_removed_files-ensure-aug_save-re.patch b/SOURCES/0022-src-augeas.c-unlink_removed_files-ensure-aug_save-re.patch deleted file mode 100644 index 97fbf4b..0000000 --- a/SOURCES/0022-src-augeas.c-unlink_removed_files-ensure-aug_save-re.patch +++ /dev/null @@ -1,82 +0,0 @@ -From 4d69d88f20a7aa87d81004db44c1094ad1afea80 Mon Sep 17 00:00:00 2001 -From: Dominic Cleal -Date: Thu, 4 Sep 2014 08:44:20 +0100 -Subject: [PATCH] * src/augeas.c (unlink_removed_files): ensure aug_save - returns non-zero result when unable to delete files - -Fixes RHBZ#1091143 - -(cherry picked from commit b61a78d2e629e4f1395270a1ee72876e27b12990) - -Conflicts: - NEWS ---- - src/augeas.c | 3 ++- - tests/test-save.c | 26 ++++++++++++++++++++++++++ - 2 files changed, 28 insertions(+), 1 deletion(-) - -diff --git a/src/augeas.c b/src/augeas.c -index 3c12443..014e145 100644 ---- a/src/augeas.c -+++ b/src/augeas.c -@@ -1488,7 +1488,8 @@ static int unlink_removed_files(struct augeas *aug, - for (struct tree *t = pathx_first(px); - t != NULL; - t = pathx_next(px)) { -- remove_file(aug, t); -+ if (remove_file(aug, t) < 0) -+ result = -1; - } - free_pathx(px); - } else if (tf->dirty && ! tree_child(tm, "path")) { -diff --git a/tests/test-save.c b/tests/test-save.c -index f28f626..1dac75d 100644 ---- a/tests/test-save.c -+++ b/tests/test-save.c -@@ -29,6 +29,7 @@ - #include - #include - #include -+#include - - const char *abs_top_srcdir; - const char *abs_top_builddir; -@@ -70,6 +71,30 @@ static void teardown(ATTRIBUTE_UNUSED CuTest *tc) { - root = NULL; - } - -+static void testRemoveNoPermission(CuTest *tc) { -+ if (getuid() == 0) { -+ puts("pending (testRemoveNoPermission): can't test permissions under root account"); -+ return; -+ } -+ -+ int r; -+ const char *errmsg; -+ -+ // Prevent deletion of files -+ run(tc, "chmod 0500 %s/etc", root); -+ -+ r = aug_rm(aug, "/files/etc/hosts"); -+ CuAssertTrue(tc, r > 0); -+ -+ r = aug_save(aug); -+ CuAssertIntEquals(tc, -1, r); -+ -+ r = aug_get(aug, "/augeas/files/etc/hosts/error", &errmsg); -+ CuAssertIntEquals(tc, 1, r); -+ CuAssertPtrNotNull(tc, errmsg); -+ CuAssertStrEquals(tc, "unlink_orig", errmsg); -+} -+ - static void testSaveNewFile(CuTest *tc) { - int r; - -@@ -285,6 +310,7 @@ int main(void) { - CuSuiteSetup(suite, setup, teardown); - - SUITE_ADD_TEST(suite, testSaveNewFile); -+ SUITE_ADD_TEST(suite, testRemoveNoPermission); - SUITE_ADD_TEST(suite, testNonExistentLens); - SUITE_ADD_TEST(suite, testMultipleXfm); - SUITE_ADD_TEST(suite, testMtime); diff --git a/SOURCES/0023-src-augtool.c-add-command-aliases-to-autocomplete.patch b/SOURCES/0023-src-augtool.c-add-command-aliases-to-autocomplete.patch deleted file mode 100644 index 377d363..0000000 --- a/SOURCES/0023-src-augtool.c-add-command-aliases-to-autocomplete.patch +++ /dev/null @@ -1,28 +0,0 @@ -From f153c132ad5b8987c86b472eb73b1607a5223f42 Mon Sep 17 00:00:00 2001 -From: Dominic Cleal -Date: Mon, 2 Jun 2014 13:35:30 +0100 -Subject: [PATCH] * src/augtool.c: add command aliases to autocomplete - -Fixes RHBZ#1100184 - -(cherry picked from commit 0d540378e3e319607a078bcce520dd74e2f71013) - -Conflicts: - NEWS ---- - src/augtool.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/augtool.c b/src/augtool.c -index 9ec3839..54fc507 100644 ---- a/src/augtool.c -+++ b/src/augtool.c -@@ -171,7 +171,7 @@ static char *readline_command_generator(const char *text, int state) { - "get", "label", "ins", "load", "ls", "match", - "mv", "rename", "print", "dump-xml", "rm", "save", "set", "setm", - "clearm", "span", "store", "retrieve", "transform", -- "help", NULL }; -+ "help", "touch", "insert", "move", "copy", NULL }; - - static int current = 0; - const char *name; diff --git a/SOURCES/0024-man-augtool.pod-update-man-page-with-new-commands.patch b/SOURCES/0024-man-augtool.pod-update-man-page-with-new-commands.patch deleted file mode 100644 index c7cf657..0000000 --- a/SOURCES/0024-man-augtool.pod-update-man-page-with-new-commands.patch +++ /dev/null @@ -1,260 +0,0 @@ -From 24fb307289750ec948dad249020d69143b98303a Mon Sep 17 00:00:00 2001 -From: Dominic Cleal -Date: Mon, 2 Jun 2014 14:14:18 +0100 -Subject: [PATCH] * man/augtool.pod: update man page with new commands - -Fixes RHBZ#1100077 - -(cherry picked from commit 242acb210d87e94f6244d85f22301caa630885c0) - -Conflicts: - NEWS - man/augtool.1 - man/augtool.pod - -* man/augtool.pod: update man page with --span option - -(cherry picked from commit 3c5a185afbfee4e3156ba9e0c6e2a5b32233b0cf) - -Conflicts: - NEWS - man/augtool.1 ---- - man/augtool.pod | 169 +++++++++++++++++++++++++++++++++++++++++--------------- - 1 file changed, 124 insertions(+), 45 deletions(-) - -diff --git a/man/augtool.pod b/man/augtool.pod -index c145032..28f8563 100644 ---- a/man/augtool.pod -+++ b/man/augtool.pod -@@ -92,6 +92,11 @@ creates no entries under C whatsoever; to read any files, - they need to be set up manually and loading must be initiated with a - C command. Using this option gives the fastest startup. - -+=item B<--span> -+ -+Load span positions for nodes in the tree, as they relate to the original -+file. Enables the use of the B command to retrieve position data. -+ - =item B<--version> - - Print version information and exit. The version is also in the tree under -@@ -111,12 +116,69 @@ be distinguished by appending C<[N]> to their label to match the N-th - sibling with such a label. The last sibling with a specific label can be - reached as C<[last()]>. See L for some examples of this. - -+=head2 ADMIN COMMANDS -+ -+The following commands control the behavior of Augeas and augtool itself. -+ - =over 4 - -+=item B -+ -+Print this help text -+ -+=item B -+ -+Load files according to the transforms in C. -+ - =item B - - Exit the program - -+=item B ELENSE ENODE_INE EPATHE ENODE_OUTE -+ -+Transform tree at PATH back into text using lens LENS and store the -+resulting string at NODE_OUT. Assume that the tree was initially read in -+with the same lens and the string stored at NODE_IN as input. -+ -+=item B -+ -+Save all pending changes to disk. Unless either the B<-b> or B<-n> -+command line options are given, files are changed in place. -+ -+=item B ELENSE ENODEE EPATHE -+ -+Parse NODE using LENS and store the resulting tree at PATH. -+ -+=item B ELENSE EFILTERE EFILEE -+ -+Add a transform for FILE using LENS. The LENS may be a module name or a -+full lens name. If a module name is given, then "lns" will be the lens -+assumed. The FILTER must be either "incl" or "excl". If the filter is -+"incl", the FILE will be parsed by the LENS. If the filter is "excl", -+the FILE will be excluded from the LENS. FILE may contain wildcards. -+ -+=back -+ -+=head2 READ COMMANDS -+ -+The following commands are used to retrieve data from the Augeas tree. -+ -+=over 4 -+ -+=item B I<[EPATHE]> I<[EFILENAMEE]> -+ -+Print entries in the tree as XML. If PATH is given, printing starts there, -+otherwise the whole tree is printed. If FILENAME is given, the XML is saved -+to the given file. -+ -+=item B EPATHE -+ -+Print the value associated with PATH -+ -+=item B