As a note, using "#rpc" nodes would prevent from breaking compatibility, but I'm really not in favor of using "#field" nodes, as I'd rather keep them for special uses (such as "#comment").
On Wed, Oct 27, 2010 at 10:48 PM, Raphael Pinson <[email protected]> wrote: > This patch adds support for RPC service lines in inetd.aug (fixes ticket > #109). This requires to change the logic of the lens, because the services > are currently mapped using key, so mapping rpc lines leads to a union.put > conflict. > > The normal service lines are now mapped with a "service" label, while RPC > services are mapped using a "rpc_service" label. Once this change is made, > the "#address" special label is not necessary anymore (it used "#" to > prevent conflicts with normal services nodes) and is thus renamed as > "address". > > I believe this lens could get a bit of refactoring love still while we're > busy breaking compatibility, but at least this fixes the reported issue. > > --- > lenses/inetd.aug | 42 +++++++++++++++++++++++++++----- > lenses/tests/test_inetd.aug | 55 > ++++++++++++++++++++++++++++--------------- > 2 files changed, 71 insertions(+), 26 deletions(-) > > diff --git a/lenses/inetd.aug b/lenses/inetd.aug > index 356a8df..c2d0879 100644 > --- a/lenses/inetd.aug > +++ b/lenses/inetd.aug > @@ -58,9 +58,8 @@ arguments -- A sequence of arguments to pass to the > command. > > In addition to this straightforward tree, inetd has the ability to set > "default" listen addresses; this is a little used feature which > nonetheless > -comes in handy sometimes. The key for entries of this type is "#address" > -(to prevent collision with any real services that might one day be called > -"address"), and the subtree should be a sequence of addresses. "*" can > +comes in handy sometimes. The key for entries of this type is "address" > +, and the subtree should be a sequence of addresses. "*" can > always be used to return the default behaviour of listening on INADDR_ANY. > > *) > @@ -97,7 +96,7 @@ module Inetd = > * ELEMENTS > ***************************) > > - let service = ( [label "address" . address_list . del_str ":" ]? . > key /[^ \t\n\/:#]+/ ) > + let service (l:string) = ( label l . [label "address" . > address_list . del_str ":" ]? . store /[^ \t\n\/:#]+/ ) > > let socket = [ label "socket" . store /[^ \t\n#]+/ ] > > @@ -122,7 +121,7 @@ module Inetd = > * SERVICE LINES > ***************************) > > - let service_line = [ service > + let service_line = [ service "service" > . sep > . socket > . sep > @@ -136,11 +135,40 @@ module Inetd = > . eol > ] > > + > + (*************************** > + * RPC LINES > + ***************************) > + > + let rpc_service = service "rpc_service" . Util.del_str "/" > + . [ label "version" . store Rx.integer ] > + > + let rpc_endpoint = [ label "endpoint-type" . store Rx.word ] > + let rpc_protocol = Util.del_str "rpc/" > + . (Build.opt_list > + [label "protocol" . store /[^ \t\n,#]+/ ] > + Sep.comma) > + > + let rpc_line = [ rpc_service > + . sep > + . rpc_endpoint > + . sep > + . rpc_protocol > + . sep > + . wait > + . sep > + . usergroup > + . sep > + . command > + . eol > + ] > + > + > (*************************** > * DEFAULT LISTEN ADDRESSES > ***************************) > > - let default_listen_address = [ label "#address" > + let default_listen_address = [ label "address" > . address_list > . del_str ":" > . eol > @@ -150,7 +178,7 @@ module Inetd = > * LENS / FILTER > ***********************) > > - let lns = (comment|empty|service_line|default_listen_address)* > + let lns = > (comment|empty|service_line|rpc_line|default_listen_address)* > > let filter = incl "/etc/inetd.conf" > > diff --git a/lenses/tests/test_inetd.aug b/lenses/tests/test_inetd.aug > index cc9c6ad..8f9f656 100644 > --- a/lenses/tests/test_inetd.aug > +++ b/lenses/tests/test_inetd.aug > @@ -22,19 +22,21 @@ dotgroupsrv stream tcp nowait fred.wilma > /usr/bin/dotgroupsrv > colongroupsrv stream tcp nowait fred:wilma > /usr/bin/colongroupsrv > > maxsrv stream tcp nowait.20 fred /usr/bin/maxsrv > + > +dummy/1 tli rpc/circuit_v,udp wait root > /tmp/test_svc test_svc > " > > test Inetd.lns get conf = > { "#comment" = "Blah di blah comment" } > {} > - { "simplesrv" > + { "service" = "simplesrv" > { "socket" = "stream" } > { "protocol" = "tcp" } > { "wait" = "nowait" } > { "user" = "fred" } > { "command" = "/usr/bin/simplesrv" } > } > - { "arguserve" > + { "service" = "arguserve" > { "socket" = "dgram" } > { "protocol" = "udp" } > { "wait" = "wait" } > @@ -47,7 +49,7 @@ maxsrv stream tcp nowait.20 > fred /usr/bin/maxsrv > } > } > {} > - { "1234" > + { "service" = "1234" > { "socket" = "stream" } > { "protocol" = "tcp" } > { "wait" = "nowait" } > @@ -55,7 +57,7 @@ maxsrv stream tcp nowait.20 > fred /usr/bin/maxsrv > { "command" = "/usr/bin/numbersrv" } > } > {} > - { "addrsrv" > + { "service" = "addrsrv" > { "address" > { "1" = "127.0.0.1" } > } > @@ -65,7 +67,7 @@ maxsrv stream tcp nowait.20 > fred /usr/bin/maxsrv > { "user" = "fred" } > { "command" = "/usr/bin/addrsrv" } > } > - { "multiaddrsrv" > + { "service" = "multiaddrsrv" > { "address" > { "1" = "127.0.0.1" } > { "2" = "10.0.0.1" } > @@ -76,18 +78,18 @@ maxsrv stream tcp nowait.20 > fred /usr/bin/maxsrv > { "user" = "fred" } > { "command" = "/usr/bin/multiaddrsrv" } > } > - { "#address" > + { "address" > { "1" = "faff.fred.com" } > } > - { "#address" > + { "address" > { "1" = "127.0.0.1" } > { "2" = "faff.fred.com" } > } > - { "#address" > + { "address" > { "1" = "*" } > } > {} > - { "sndbufsrv" > + { "service" = "sndbufsrv" > { "socket" = "stream" } > { "protocol" = "tcp" } > { "sndbuf" = "12k" } > @@ -95,7 +97,7 @@ maxsrv stream tcp nowait.20 > fred /usr/bin/maxsrv > { "user" = "fred" } > { "command" = "/usr/bin/sndbufsrv" } > } > - { "rcvbufsrv" > + { "service" = "rcvbufsrv" > { "socket" = "stream" } > { "protocol" = "tcp" } > { "rcvbuf" = "24k" } > @@ -103,7 +105,7 @@ maxsrv stream tcp nowait.20 > fred /usr/bin/maxsrv > { "user" = "fred" } > { "command" = "/usr/bin/rcvbufsrv" } > } > - { "allbufsrv" > + { "service" = "allbufsrv" > { "socket" = "stream" } > { "protocol" = "tcp" } > { "sndbuf" = "1m" } > @@ -113,7 +115,7 @@ maxsrv stream tcp nowait.20 > fred /usr/bin/maxsrv > { "command" = "/usr/bin/allbufsrv" } > } > {} > - { "dotgroupsrv" > + { "service" = "dotgroupsrv" > { "socket" = "stream" } > { "protocol" = "tcp" } > { "wait" = "nowait" } > @@ -121,7 +123,7 @@ maxsrv stream tcp nowait.20 > fred /usr/bin/maxsrv > { "group" = "wilma" } > { "command" = "/usr/bin/dotgroupsrv" } > } > - { "colongroupsrv" > + { "service" = "colongroupsrv" > { "socket" = "stream" } > { "protocol" = "tcp" } > { "wait" = "nowait" } > @@ -130,7 +132,7 @@ maxsrv stream tcp nowait.20 > fred /usr/bin/maxsrv > { "command" = "/usr/bin/colongroupsrv" } > } > {} > - { "maxsrv" > + { "service" = "maxsrv" > { "socket" = "stream" } > { "protocol" = "tcp" } > { "wait" = "nowait" } > @@ -138,6 +140,18 @@ maxsrv stream tcp nowait.20 > fred /usr/bin/maxsrv > { "user" = "fred" } > { "command" = "/usr/bin/maxsrv" } > } > + {} > + { "rpc_service" = "dummy" > + { "version" = "1" } > + { "endpoint-type" = "tli" } > + { "protocol" = "circuit_v" } > + { "protocol" = "udp" } > + { "wait" = "wait" } > + { "user" = "root" } > + { "command" = "/tmp/test_svc" } > + { "arguments" > + { "1" = "test_svc" } } > + } > > > > (**************************************************************************) > @@ -145,9 +159,12 @@ maxsrv stream tcp nowait.20 > fred /usr/bin/maxsrv > (* Test new file creation *) > > test Inetd.lns put "" after > - set "/faffsrv/socket" "stream"; > - set "/faffsrv/protocol" "tcp"; > - set "/faffsrv/wait" "nowait"; > - set "/faffsrv/user" "george"; > - set "/faffsrv/command" "/sbin/faffsrv" > + set "/service" "faffsrv"; > + set "/service/socket" "stream"; > + set "/service/protocol" "tcp"; > + set "/service/wait" "nowait"; > + set "/service/user" "george"; > + set "/service/command" "/sbin/faffsrv" > = "faffsrv stream tcp nowait george /sbin/faffsrv\n" > + > + > -- > 1.7.0.4 > >
_______________________________________________ augeas-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/augeas-devel
