diff --git a/SOURCES/0001-Grub-support-in-kernel-command-line-option-names-647.patch b/SOURCES/0001-Grub-support-in-kernel-command-line-option-names-647.patch index 1e84d52..9fa5246 100644 --- a/SOURCES/0001-Grub-support-in-kernel-command-line-option-names-647.patch +++ b/SOURCES/0001-Grub-support-in-kernel-command-line-option-names-647.patch @@ -54,5 +54,5 @@ index 75657203..e50bdc4f 100644 test Grub.lns get "default=0\ncrud=no\n" = { "default" = "0" } -- -2.21.0 +2.24.1 diff --git a/SOURCES/0002-Rsyslog-support-multiple-actions-in-filters-and-sele.patch b/SOURCES/0002-Rsyslog-support-multiple-actions-in-filters-and-sele.patch index f75eca1..26045d1 100644 --- a/SOURCES/0002-Rsyslog-support-multiple-actions-in-filters-and-sele.patch +++ b/SOURCES/0002-Rsyslog-support-multiple-actions-in-filters-and-sele.patch @@ -90,5 +90,5 @@ index 9011a2b3..e83613a2 100644 + { } + -- -2.21.0 +2.24.1 diff --git a/SOURCES/0003-src-augrun.c-nexttoken-add-more-escape-characters.patch b/SOURCES/0003-src-augrun.c-nexttoken-add-more-escape-characters.patch new file mode 100644 index 0000000..3f34bda --- /dev/null +++ b/SOURCES/0003-src-augrun.c-nexttoken-add-more-escape-characters.patch @@ -0,0 +1,37 @@ +From d37c8aabc29c3989d5f961d8b742b246a5f64cdf Mon Sep 17 00:00:00 2001 +From: Pino Toscano +Date: Fri, 17 May 2019 13:47:20 +0200 +Subject: [PATCH] * src/augrun.c (nexttoken): add more escape characters + +Synchonize the list of "pass-through" characters with the set in the +'name_follow' variable in pathx.c: as pathx_escape_name() escapes them, +make sure that aug_srun() accepts them as arguments. +--- + src/augrun.c | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/src/augrun.c b/src/augrun.c +index 07f865a9..fd710c5f 100644 +--- a/src/augrun.c ++++ b/src/augrun.c +@@ -133,8 +133,16 @@ static char *nexttoken(struct command *cmd, char **line, bool path) { + copy = true; + if (*s == '\\') { + switch (*(s+1)) { ++ case ']': + case '[': +- case ']': /* pass both literally */ ++ case '|': ++ case '/': ++ case '=': ++ case '(': ++ case ')': ++ case '!': ++ case ',': /* pass them literally; ++ * see 'name_follow' in pathx.c */ + nescaped = 2; + break; + case 't': /* insert tab */ +-- +2.24.1 + diff --git a/SOURCES/0004-src-augtool.c-hopefully-fix-readline-quoting-issues.patch b/SOURCES/0004-src-augtool.c-hopefully-fix-readline-quoting-issues.patch new file mode 100644 index 0000000..c76fdb4 --- /dev/null +++ b/SOURCES/0004-src-augtool.c-hopefully-fix-readline-quoting-issues.patch @@ -0,0 +1,42 @@ +From f224dd99c7dc4d2ce4340b2d16cae6b1e0ed7c8d Mon Sep 17 00:00:00 2001 +From: Pino Toscano +Date: Fri, 17 May 2019 15:18:50 +0200 +Subject: [PATCH] * src/augtool.c: hopefully fix readline quoting issues + +Configure the quoting (also using a detector) and word break characters, +so it is possible to autocomplete paths with special characters (like +spaces, which are already quoted by augeas). +--- + src/augtool.c | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/src/augtool.c b/src/augtool.c +index b42ef630..31a991eb 100644 +--- a/src/augtool.c ++++ b/src/augtool.c +@@ -267,10 +267,22 @@ static char *get_home_dir(uid_t uid) { + return result; + } + ++/* Inspired from: ++ * https://thoughtbot.com/blog/tab-completion-in-gnu-readline ++ */ ++static int quote_detector(char *str, int index) { ++ return index > 0 ++ && str[index - 1] == '\\' ++ && quote_detector(str, index - 1) == 0; ++} ++ + static void readline_init(void) { + rl_readline_name = "augtool"; + rl_attempted_completion_function = readline_completion; + rl_completion_entry_function = readline_path_generator; ++ rl_completer_quote_characters = "\"'"; ++ rl_completer_word_break_characters = (char *) " "; ++ rl_char_is_quoted_p = "e_detector; + + /* Set up persistent history */ + char *home_dir = get_home_dir(getuid()); +-- +2.24.1 + diff --git a/SOURCES/0005-Krb5-improve-dbmodules-and-includes-630.patch b/SOURCES/0005-Krb5-improve-dbmodules-and-includes-630.patch new file mode 100644 index 0000000..283490d --- /dev/null +++ b/SOURCES/0005-Krb5-improve-dbmodules-and-includes-630.patch @@ -0,0 +1,133 @@ +From 63786a83b2e4b14772ee8742fa95d70063ba7b6c Mon Sep 17 00:00:00 2001 +From: Pino Toscano +Date: Tue, 4 Feb 2020 17:54:22 +0100 +Subject: [PATCH] Krb5: improve [dbmodules] and includes (#630) + +* Krb5: fix/revamp parsing of [dbmodules] subsection + +The [dbmodules] subsection so far was parsed much like the [dbdefaults] +one, and thus it did not handle realms. + +Revamp it a bit to handle realms, and specify the only keyword not in +realm subsections. + +* Krb5: allow include/includedir directives everywhere + +MIT Kerberos allows this, so do not restrict them only before any other +section. +--- + lenses/krb5.aug | 27 +++++++++++++++++++-------- + lenses/tests/test_krb5.aug | 36 +++++++++++++++++++++++++++++++++++- + 2 files changed, 54 insertions(+), 9 deletions(-) + +diff --git a/lenses/krb5.aug b/lenses/krb5.aug +index 46c22656..6b509c42 100644 +--- a/lenses/krb5.aug ++++ b/lenses/krb5.aug +@@ -21,10 +21,11 @@ let closebr = del /[ \t]*\}/ "}" + and realms in the [appdefaults] section. + *) + ++let include_re = /include(dir)?/ + let realm_re = /[A-Z0-9][.a-zA-Z0-9-]*/ + let realm_anycase_re = /[A-Za-z0-9][.a-zA-Z0-9-]*/ + let app_re = /[a-z][a-zA-Z0-9_]*/ +-let name_re = /[.a-zA-Z0-9_-]+/ ++let name_re = /[.a-zA-Z0-9_-]+/ - include_re + + let value_br = store /[^;# \t\r\n{}]+/ + let value = store /[^;# \t\r\n]+/ +@@ -130,10 +131,19 @@ let dbdefaults = + simple_section "dbdefaults" keys + + let dbmodules = +- let keys = /db_library|ldap_kerberos_container_dn|ldap_kdc_dn/ +- |/ldap_kadmind_dn|ldap_service_password_file|ldap_servers/ +- |/ldap_conns_per_server/ in +- simple_section "dbmodules" keys ++ let subsec_key = /database_name|db_library|disable_last_success/ ++ |/disable_lockout|ldap_conns_per_server|ldap_(kdc|kadmind)_dn/ ++ |/ldap_(kdc|kadmind)_sasl_mech|ldap_(kdc|kadmind)_sasl_authcid/ ++ |/ldap_(kdc|kadmind)_sasl_authzid|ldap_(kdc|kadmind)_sasl_realm/ ++ |/ldap_kerberos_container_dn|ldap_servers/ ++ |/ldap_service_password_file|mapsize|max_readers|nosync/ ++ |/unlockiter/ in ++ let subsec_option = subsec_entry subsec_key eq comment in ++ let key = /db_module_dir/ in ++ let option = entry key eq value comment in ++ let realm = [ indent . label "realm" . store realm_re . ++ eq_openbr . (subsec_option)* . closebr . eol ] in ++ record "dbmodules" (option|realm) + + (* This section is not documented in the krb5.conf manpage, + but the Fermi example uses it. *) +@@ -152,11 +162,12 @@ let kdc = + let pam = + simple_section "pam" name_re + +-let includes = Build.key_value_line /include(dir)?/ Sep.space (store Rx.fspath) ++let includes = Build.key_value_line include_re Sep.space (store Rx.fspath) ++let include_lines = includes . (comment|empty)* + +-let lns = (comment|empty|includes)* . ++let lns = (comment|empty)* . + (libdefaults|login|appdefaults|realms|domain_realm +- |logging|capaths|dbdefaults|dbmodules|instance_mapping|kdc|pam)* ++ |logging|capaths|dbdefaults|dbmodules|instance_mapping|kdc|pam|include_lines)* + + let filter = (incl "/etc/krb5.conf.d/*.conf") + . (incl "/etc/krb5.conf") +diff --git a/lenses/tests/test_krb5.aug b/lenses/tests/test_krb5.aug +index f746543b..10b87605 100644 +--- a/lenses/tests/test_krb5.aug ++++ b/lenses/tests/test_krb5.aug +@@ -1029,7 +1029,7 @@ default_ccache_name = KEYRING:persistent:%{uid}\n" = + { } + { "default_ccache_name" = "KEYRING:persistent:%{uid}" } } + +-(* Include(dir) test *) ++(* Include(dir) tests *) + let include_test = "include /etc/krb5.other_conf.d/other.conf + includedir /etc/krb5.conf.d/ + " +@@ -1037,3 +1037,37 @@ includedir /etc/krb5.conf.d/ + test Krb5.lns get include_test = + { "include" = "/etc/krb5.other_conf.d/other.conf" } + { "includedir" = "/etc/krb5.conf.d/" } ++ ++let include2_test = "[logging] ++ default = FILE:/var/log/krb5libs.log ++ ++include /etc/krb5.other_conf.d/other.conf ++ ++includedir /etc/krb5.conf.d/ ++" ++ ++test Krb5.lns get include2_test = ++ { "logging" ++ { "default" ++ { "file" = "/var/log/krb5libs.log" } } ++ { } ++ } ++ { "include" = "/etc/krb5.other_conf.d/other.conf" } ++ { } ++ { "includedir" = "/etc/krb5.conf.d/" } ++ ++(* [dbmodules] test *) ++let dbmodules_test = "[dbmodules] ++ ATHENA.MIT.EDU = { ++ disable_last_success = true ++ } ++ db_module_dir = /some/path ++" ++ ++test Krb5.lns get dbmodules_test = ++ { "dbmodules" ++ { "realm" = "ATHENA.MIT.EDU" ++ { "disable_last_success" = "true" } ++ } ++ { "db_module_dir" = "/some/path" } ++ } +-- +2.24.1 + diff --git a/SOURCES/0006-Systemd-fix-parsing-of-envvars-with-spaces-659.patch b/SOURCES/0006-Systemd-fix-parsing-of-envvars-with-spaces-659.patch new file mode 100644 index 0000000..65be7da --- /dev/null +++ b/SOURCES/0006-Systemd-fix-parsing-of-envvars-with-spaces-659.patch @@ -0,0 +1,59 @@ +From 472a143b427afc89ab2fd843cea1f1f97193ceef Mon Sep 17 00:00:00 2001 +From: Pino Toscano +Date: Tue, 4 Feb 2020 18:05:05 +0100 +Subject: [PATCH] Systemd: fix parsing of envvars with spaces (#659) + +Allow spaces inside of values quoted with single or double quotes. + +This amends commit f64d8bc7a7670f3af2549fdcefb64c2b5f22cd0d that added +support for quoted values. +--- + lenses/systemd.aug | 4 ++-- + lenses/tests/test_systemd.aug | 9 +++++++++ + 2 files changed, 11 insertions(+), 2 deletions(-) + +diff --git a/lenses/systemd.aug b/lenses/systemd.aug +index b868e86f..77434367 100644 +--- a/lenses/systemd.aug ++++ b/lenses/systemd.aug +@@ -132,8 +132,8 @@ let entry_env = + let envkv (env_val:lens) = key env_key . Util.del_str "=" . env_val + (* bare has no spaces, and is optionally quoted *) + in let bare = Quote.do_quote_opt (envkv (store /[^#'" \t\n]*[^#'" \t\n\\]/)?) +- in let bare_dqval = envkv (store /"[^#" \t\n]*[^#" \t\n\\]"/) +- in let bare_sqval = envkv (store /'[^#' \t\n]*[^#' \t\n\\]'/) ++ in let bare_dqval = envkv (store /"[^#"\t\n]*[^#"\t\n\\]"/) ++ in let bare_sqval = envkv (store /'[^#'\t\n]*[^#'\t\n\\]'/) + (* quoted has at least one space, and must be quoted *) + in let quoted = Quote.do_quote (envkv (store /[^#"'\n]*[ \t]+[^#"'\n]*/)) + in let envkv_quoted = [ bare ] | [ bare_dqval ] | [ bare_sqval ] | [ quoted ] +diff --git a/lenses/tests/test_systemd.aug b/lenses/tests/test_systemd.aug +index 3397456e..19c57075 100644 +--- a/lenses/tests/test_systemd.aug ++++ b/lenses/tests/test_systemd.aug +@@ -206,6 +206,8 @@ FOO=BAR + Environment=\"LANG=foo bar\" FOO=BAR + Environment=OPTIONS=\"-LS0-6d\" + Environment=OPTIONS='-LS0-6d' ++Environment=VAR=\"with some spaces\" VAR2='more spaces' ++Environment=VAR='with some spaces' + " + (* Test: Systemd.lns *) + test Systemd.lns get env = +@@ -247,6 +249,13 @@ test Systemd.lns get env = + { "Environment" + { "OPTIONS" = "'-LS0-6d'" } + } ++ { "Environment" ++ { "VAR" = "\"with some spaces\"" } ++ { "VAR2" = "'more spaces'" } ++ } ++ { "Environment" ++ { "VAR" = "'with some spaces'" } ++ } + } + + (* Variable: unit *) +-- +2.24.1 + diff --git a/SPECS/augeas.spec b/SPECS/augeas.spec index 7d57449..a4bf7fb 100644 --- a/SPECS/augeas.spec +++ b/SPECS/augeas.spec @@ -1,6 +1,6 @@ Name: augeas Version: 1.12.0 -Release: 4%{?dist} +Release: 5%{?dist} Summary: A library for changing configuration files Group: System Environment/Libraries @@ -9,6 +9,10 @@ URL: http://augeas.net/ Source0: http://download.augeas.net/%{name}-%{version}.tar.gz Patch1: 0001-Grub-support-in-kernel-command-line-option-names-647.patch Patch2: 0002-Rsyslog-support-multiple-actions-in-filters-and-sele.patch +Patch3: 0003-src-augrun.c-nexttoken-add-more-escape-characters.patch +Patch4: 0004-src-augtool.c-hopefully-fix-readline-quoting-issues.patch +Patch5: 0005-Krb5-improve-dbmodules-and-includes-630.patch +Patch6: 0006-Systemd-fix-parsing-of-envvars-with-spaces-659.patch BuildRequires: readline-devel libselinux-devel libxml2-devel BuildRequires: autoconf, automake @@ -52,9 +56,7 @@ read files. %prep -%setup -q -%patch1 -p1 -%patch2 -p1 +%autosetup -p1 %build %configure \ @@ -117,6 +119,12 @@ rm -rf $RPM_BUILD_ROOT %{_libdir}/pkgconfig/augeas.pc %changelog +* Mon Feb 10 2020 Pino Toscano - 1.12.0-5 +- Fix completion with special characters in augtool. (RHBZ#1232224) +- Krb5: improve handling of [dbmodules]; allow include/includedir directives + everywhere (RHBZ#1798486) +- Systemd: improve parsing of quoted variables of Environment (RHBZ#1798922) + * Thu Nov 14 2019 Pino Toscano - 1.12.0-4 - Rsyslog: support multiple actions in filters and selectors (RHBZ#1660884)