|
120 | 120 | var_ref="var_{{{ _RULE_ID }}}_log_files_paths"/> |
121 | 121 | </unix:file_object> |
122 | 122 |
|
| 123 | + {{% if ATTRIBUTE == "groupowner" %}} |
| 124 | + {{% if VALUE is number %}} |
| 125 | + <!-- store groupowner GID in variable --> |
| 126 | + <constant_variable id="var_{{{ _RULE_ID }}}_{{{ ATTRIBUTE }}}_gid" datatype="int" version="1" comment="GID of {{{ ATTRIBUTE }}}"><value>{{{ VALUE }}}</value></constant_variable> |
| 127 | + |
| 128 | + {{% else %}} |
| 129 | + <!-- get groupowner GID from name --> |
| 130 | + <ind:textfilecontent54_object id="obj_{{{ _RULE_ID }}}_{{{ ATTRIBUTE }}}_gid" version="1" comment="GID of group {{{ VALUE }}}"> |
| 131 | + {{# Copied from file_groupowner template, assuming logic is still valid #}} |
| 132 | + {{%- if product in ["rhcos4","ocp4"] %}} |
| 133 | + <ind:filepath>/usr/lib/group</ind:filepath> |
| 134 | + {{%- else %}} |
| 135 | + <ind:filepath>/etc/group</ind:filepath> |
| 136 | + {{%- endif %}} |
| 137 | + <ind:pattern operation="pattern match">^{{{ VALUE }}}:\w+:(\w+):.*</ind:pattern> |
| 138 | + <ind:instance datatype="int" operation="equals">1</ind:instance> |
| 139 | + </ind:textfilecontent54_object> |
| 140 | + |
| 141 | + <local_variable id="var_{{{ _RULE_ID }}}_{{{ ATTRIBUTE }}}_gid" datatype="int" version="1" |
| 142 | + comment="GID of group {{{ VALUE }}}"> |
| 143 | + <object_component item_field="subexpression" object_ref="obj_{{{ _RULE_ID }}}_{{{ ATTRIBUTE }}}_gid"/> |
| 144 | + </local_variable> |
| 145 | + {{% endif %}} |
| 146 | + |
| 147 | + {{% elif ATTRIBUTE == "owner" %}} |
| 148 | + {{% if VALUE is number %}} |
| 149 | + <!-- store owner UID in variable --> |
| 150 | + <constant_variable id="var_{{{ _RULE_ID }}}_{{{ ATTRIBUTE }}}_uid" datatype="int" version="1" comment="UID of {{{ ATTRIBUTE }}}"><value>{{{ VALUE }}}</value></constant_variable> |
| 151 | + |
| 152 | + {{% else %}} |
| 153 | + <!-- get owner UID from name --> |
| 154 | + <ind:textfilecontent54_object id="obj_{{{ _RULE_ID }}}_{{{ ATTRIBUTE }}}_uid" version="1" comment="UID of user {{{ VALUE }}}"> |
| 155 | + {{# Assuming same logic as above applies to users #}} |
| 156 | + {{%- if product in ["rhcos4","ocp4"] %}} |
| 157 | + <ind:filepath>/usr/lib/passwd</ind:filepath> |
| 158 | + {{%- else %}} |
| 159 | + <ind:filepath>/etc/passwd</ind:filepath> |
| 160 | + {{%- endif %}} |
| 161 | + <ind:pattern operation="pattern match">^{{{ VALUE }}}:\w+:(\w+):.*</ind:pattern> |
| 162 | + <ind:instance datatype="int" operation="equals">1</ind:instance> |
| 163 | + </ind:textfilecontent54_object> |
| 164 | + |
| 165 | + <local_variable id="var_{{{ _RULE_ID }}}_{{{ ATTRIBUTE }}}_uid" datatype="int" version="1" |
| 166 | + comment="UID of user {{{ VALUE }}}"> |
| 167 | + <object_component item_field="subexpression" object_ref="obj_{{{ _RULE_ID }}}_{{{ ATTRIBUTE }}}_uid"/> |
| 168 | + </local_variable> |
| 169 | + {{% endif %}} |
| 170 | + {{% endif %}} |
| 171 | + |
123 | 172 | <unix:file_state id="state_{{{ _RULE_ID }}}" version="1"> |
124 | 173 | <unix:type operation="equals">regular</unix:type> |
125 | 174 | {{% if ATTRIBUTE == "groupowner" %}} |
126 | | - <unix:group_id datatype="int">{{{ VALUE }}}</unix:group_id> |
| 175 | + <unix:group_id datatype="int" var_ref="var_{{{ _RULE_ID }}}_{{{ ATTRIBUTE }}}_gid"></unix:group_id> |
127 | 176 | {{% elif ATTRIBUTE == "owner" %}} |
128 | | - <unix:user_id datatype="int">{{{ VALUE }}}</unix:user_id> |
| 177 | + <unix:user_id datatype="int" var_ref="var_{{{ _RULE_ID }}}_{{{ ATTRIBUTE }}}_uid"></unix:user_id> |
129 | 178 | {{% else %}} |
130 | 179 | {{{ STATEMODE | indent(4) }}} |
131 | 180 | {{% endif %}} |
|
0 commit comments