You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

142 lines
5.1 KiB

From cd586dfa4ade4ea574aae0fa6ac034c07c77b25a Mon Sep 17 00:00:00 2001
From: Dominic Cleal <dcleal@redhat.com>
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 4f06bad9..a13682e3 100644
--- a/lenses/jaas.aug
+++ b/lenses/jaas.aug
@@ -1,36 +1,31 @@
(* Module Jaas *)
-(* Original Author: Simon Vocella <voxsim@gmail.com> *)
-(* Updated by: Steve Shipway <steve@steveshipway.org> *)
-(* 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 <voxsim@gmail.com> *)
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 5f2bfb13..d5ede698 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;" }
}
}
- { }
}
--
2.13.6