commit:     35167ff4b12c7285fcfed384d4a3bac2ca6eed85
Author:     Christian Göttsche <cgzones <AT> googlemail <DOT> com>
AuthorDate: Thu Feb 22 16:27:36 2024 +0000
Commit:     Kenton Groombridge <concord <AT> gentoo <DOT> org>
CommitDate: Fri Mar  1 17:05:35 2024 +0000
URL:        
https://gitweb.gentoo.org/proj/hardened-refpolicy.git/commit/?id=35167ff4

Support multi-line interface calls

Support splitting the call of an interface over multiple lines, e.g. for
interfaces with a long list as argument:

    term_control_unallocated_ttys(udev_t, {
            ioctl_kdgkbtype
            ioctl_kdgetmode
            ioctl_pio_unimap
            ioctl_pio_unimapclr
            ioctl_kdfontop
            ioctl_tcgets
    })

Signed-off-by: Christian Göttsche <cgzones <AT> googlemail.com>
Signed-off-by: Kenton Groombridge <concord <AT> gentoo.org>

 policy/support/loadable_module.spt | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/policy/support/loadable_module.spt 
b/policy/support/loadable_module.spt
index 1f6163054..93e793961 100644
--- a/policy/support/loadable_module.spt
+++ b/policy/support/loadable_module.spt
@@ -53,6 +53,11 @@ define(`policy_m4_comment',`
 ##### $2 depth: $1
 ')dnl
 
+define(NL,`
+')dnl
+
+define(`chomp', `translit(`$1',NL,` ')')dnl
+
 ##############################
 #
 # In the future interfaces should be in loadable modules
@@ -63,10 +68,10 @@ define(`template',` dnl
        ifdef(`$1',`refpolicyerr(`duplicate definition of $1(). Original 
definition on '$1.) define(`__if_error')',`define(`$1',__file__:__line__)') dnl
        `define(`$1',` dnl
        pushdef(`policy_call_depth',incr(policy_call_depth)) dnl
-       policy_m4_comment(policy_call_depth,begin `$1'(dollarsstar)) dnl
+       policy_m4_comment(policy_call_depth,begin `$1'(chomp(dollarsstar))) dnl
        $2 dnl
        popdef(`policy_call_depth') dnl
-       policy_m4_comment(policy_call_depth,end `$1'(dollarsstar)) dnl
+       policy_m4_comment(policy_call_depth,end `$1'(chomp(dollarsstar))) dnl
        '')
 ')
 
@@ -80,10 +85,10 @@ define(`interface',` dnl
        ifdef(`$1',`refpolicyerr(`duplicate definition of $1(). Original 
definition on '$1.) define(`__if_error')',`define(`$1',__file__:__line__)') dnl
        `define(`$1',` dnl
        pushdef(`policy_call_depth',incr(policy_call_depth)) dnl
-       policy_m4_comment(policy_call_depth,begin `$1'(dollarsstar)) dnl
+       policy_m4_comment(policy_call_depth,begin `$1'(chomp(dollarsstar))) dnl
        $2 dnl
        popdef(`policy_call_depth') dnl
-       policy_m4_comment(policy_call_depth,end `$1'(dollarsstar)) dnl
+       policy_m4_comment(policy_call_depth,end `$1'(chomp(dollarsstar))) dnl
        '')
 ')
 

Reply via email to