This file is indexed.

/usr/share/fwbuilder-5.1.0.3599/migration/FWObjectDatabase_0.10.4.xslt is in fwbuilder-common 5.1.0-4.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
<!--
   Filename:     0.10.4/FWObjectDatabase.xslt
   Author:       Vadim Kurland
   Build date:   01/17/2002
   Last changed: 03/01/2002
   Version:      1.0.0
   Description:  translates fwbuilder object database from v0.10.4 to v0.10.5

		 adds group "Address Ranges" (ID='stdid14')

		 adds subelement Management to Host and Firewall and moves
		 attributes snmp_read_community and snmp_write_community to
		 Management/SNMPManagement

                 moves attributes inst_script and inst_cmdline to the element
                 PolicyInstallScript

		 fixes Interface elements that have address element but it
		 is an empty string

		 adds missing TCP flags 'PSH' and 'URG' to all TCPService
		 elements

		 changes platform name 'ipfilter' -> 'ipf'

****************************************************************************
*                                                                          *
*   Files of versions 0.10.3 and older did not have namespace. Files       *
*   starting from v 0.10.4 have namespace defined in the element           *
*   FWObjectDatabase as follows:                                           *
*                                                                          *
*   <FWObjectDatabase xmlns="http://www.fwbuilder.org/1.0/"                *
*	    version="0.10.4" id="root">                                    *
*                                                                          *
*   I've replaced transformation for upgrade 0.10.3->0.10.4 so the new one *
*   now adds namespace in the same way. People who upgrade from older      *
*   versions will use this new transormation and will get intermediate     *
*   data tree (of version 0.10.4) with namespace defined in it.            *
*                                                                          *
*   Therefore I could build transformation for upgrade 0.10.4->0.10.5      *
*   assuming that the namespace declaration is always there.               *
*                                                                          *
*   Transformation 0.10.3->0.10.4 does not add namespace prefixes to the   *
*   elements. It only adds namespace declaration using xmlns in the root   *
*   element.                                                               *
*                                                                          *
*   This transformation (0.10.4->0.10.5) uses its own loacally defined     *
*   prefix 'fwb' to be able to match on elements with the namespace. This  *
*   prefix is defined in xsl:stylesheet element. This prefix won't be      *
*   added to the output data, it is used only within this transformation.  *
*                                                                          *
****************************************************************************

-->

<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:fwb="http://www.fwbuilder.org/1.0/">



<xsl:output method="xml" version="1.0" 
   doctype-system="fwbuilder.dtd" indent="yes" encoding="utf-8"/>




<xsl:template match="@*" mode="copy">
<xsl:copy>
  <xsl:apply-templates select="@*" mode="copy"/>
</xsl:copy>
</xsl:template>

<xsl:template match="*" mode="copy">
<xsl:copy>
  <xsl:apply-templates select="@*" mode="copy"/>
  <xsl:apply-templates mode="copy"/>
</xsl:copy>
</xsl:template>

<!--
<xsl:template match="*">
<xsl:copy-of select="."/>
</xsl:template>
-->


<xsl:template match="*[attribute::id='sysid0']" mode="copy">
<xsl:copy-of select="."/>
</xsl:template>

<xsl:template match="*[attribute::id='sysid1']" mode="copy">
<xsl:copy-of select="."/>
</xsl:template>

<xsl:template match="*[attribute::id='sysid2']" mode="copy">
<xsl:copy-of select="."/>
</xsl:template>

<xsl:template match="*[attribute::id='sysid3']" mode="copy">
<xsl:copy-of select="."/>
</xsl:template>

<!--
***************************************************************************
* This template corrects end of port range for UDP service traceroute     *
***************************************************************************
-->
<xsl:template match="fwb:UDPService[@id='id3AED0D8C']" mode="copy">
<UDPService>

<xsl:for-each select="@*">
<xsl:choose>
<xsl:when test="name()='dst_range_end'">
  <xsl:attribute name="dst_range_end">33524</xsl:attribute>
</xsl:when>
<xsl:otherwise>
  <xsl:copy-of select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>

</UDPService>
</xsl:template>

<!--
***************************************************************************
* This template adds missing TCP flags to TCPService                      *
***************************************************************************
-->
<xsl:template match="fwb:TCPService" mode="copy">
<TCPService>

<xsl:choose>
<xsl:when test="@urg_flag"></xsl:when>
<xsl:otherwise>
  <xsl:attribute name="urg_flag">False</xsl:attribute>
</xsl:otherwise>
</xsl:choose>

<xsl:choose>
<xsl:when test="@psh_flag"></xsl:when>
<xsl:otherwise>
  <xsl:attribute name="psh_flag">False</xsl:attribute>
</xsl:otherwise>
</xsl:choose>

<xsl:for-each select="@*">
  <xsl:copy-of select="."/>
</xsl:for-each>

</TCPService>
</xsl:template>

<!--
***************************************************************************
* This template fixes Interface elements that have address attribute      *
* but it is an empty string                                               *
***************************************************************************
-->
<xsl:template match="fwb:Interface" mode="copy">
<xsl:text>
</xsl:text>

<Interface>

<xsl:choose>
<xsl:when test="@address=''">
  <xsl:attribute name="address">
  <xsl:value-of select="../@address"/>
  </xsl:attribute>
</xsl:when>
<xsl:otherwise>
  <xsl:attribute name="address">
  <xsl:value-of select="@address"/>
  </xsl:attribute>
</xsl:otherwise>
</xsl:choose>

<xsl:for-each select="@*">
<xsl:choose>
<xsl:when test="name()='address'"></xsl:when>
<xsl:otherwise>
  <xsl:copy-of select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>


  <xsl:apply-templates mode="copy"/>

</Interface>

</xsl:template>


<!--
***************************************************************************
* This template works for hosts that have attributes 'snmp_read_community'*
* or 'snmp_write_community'. These attributes now move to a child element *
* Management/SNMPManagement                                               *
* Since we match only on elements that have attribute snmp_read_community *
* or snmp_write_community, and these attributes disappear in the output,  *
* this transformation can be ran multiple times on the same data          *
***************************************************************************
-->

<xsl:template match="fwb:Host[@snmp_read_community]|fwb:Host[@snmp_write_community]" mode="copy">

<xsl:variable name="snmp_read"   select="@snmp_read_community"/>
<xsl:variable name="snmp_write"  select="@snmp_write_community"/>
<xsl:variable name="address"     select="@address"/>

<Host>

<xsl:for-each select="@*">
<xsl:choose>
<xsl:when test="name()='snmp_read_community'"></xsl:when>
<xsl:when test="name()='snmp_write_community'"></xsl:when>
<xsl:otherwise>
  <xsl:copy-of select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>

<xsl:apply-templates select="fwb:Interface" mode="copy"/>

<xsl:text>
</xsl:text>
<Management>
<xsl:attribute name="address">
  <xsl:value-of select="$address"/>
</xsl:attribute>

  <xsl:text>
  </xsl:text>
  <SNMPManagement>
  <xsl:attribute name="snmp_read_community"><xsl:value-of select="$snmp_read"/></xsl:attribute>
  <xsl:attribute name="snmp_write_community"><xsl:value-of select="$snmp_write"/></xsl:attribute>
</SNMPManagement>

<xsl:text>
</xsl:text>
</Management>

<xsl:for-each select="fwb:HostOptions">
<xsl:text>
</xsl:text>
  <xsl:copy-of select="."/>
</xsl:for-each>

<xsl:text>
</xsl:text>
</Host>

</xsl:template>

<!--
***************************************************************************
* This template works for firewalls that have attributes                  *
* 'snmp_read_community' or 'snmp_write_community'. These attributes       *
* moved to a child element Management/SNMPManagement                      *
* Since we match only on elements that have attribute snmp_read_community *
* or snmp_write_community, and these attributes disappear in the output,  *
* this transformation can be ran multiple times on the same data          *
*                                                                         *
*                                                                         *
* These templates work for firewalls that have elements                   *
* FirewallOptions/Option[name="inst_cmdline"] or                          *
* FirewallOptions/Option[name="inst_script"]                              *
* Both elements moved to a child element Management/PolicyInstallScript   *
*                                                                         *
* Since we check for presence of attribute snmp_read_community or         *
* snmp_write_communityelement or FirewallOptions/Option[name="inst_cmdline"] 
* and these elements disappear in the output, this transformation can be  *
* ran multiple times on the same data                                     *
*                                                                         *
***************************************************************************
-->
<xsl:template match="fwb:Firewall" mode="copy">

<xsl:variable name="snmp_read"    select="@snmp_read_community"/>
<xsl:variable name="snmp_write"   select="@snmp_write_community"/>
<xsl:variable name="address"      select="@address"/>
<xsl:variable name="platform"     select="@platform"/>

<xsl:variable name="inst_script" >
<xsl:value-of select="fwb:FirewallOptions/fwb:Option[@name='inst_script']"/>
</xsl:variable>

<xsl:variable name="inst_cmdline">
<xsl:value-of select="fwb:FirewallOptions/fwb:Option[@name='inst_cmdline']"/>
</xsl:variable>

<Firewall>

<!-- copy attributes -->
<xsl:for-each select="@*">
<xsl:choose>
<xsl:when test="name()='snmp_read_community'"></xsl:when>
<xsl:when test="name()='snmp_write_community'"></xsl:when>
<xsl:when test="name()='platform'">
  <xsl:choose>
    <xsl:when test="$platform='ipfilter'">
	<xsl:attribute name="platform">ipf</xsl:attribute>
    </xsl:when>
    <xsl:otherwise>
      <xsl:copy-of select="."/>
    </xsl:otherwise>
  </xsl:choose>
</xsl:when>
<xsl:otherwise>
  <xsl:copy-of select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>

<xsl:for-each select="fwb:NAT">
  <xsl:text>
  </xsl:text>
  <xsl:copy-of select="."/>
</xsl:for-each>

<xsl:for-each select="fwb:Policy">
<xsl:text>
</xsl:text>
  <xsl:copy-of select="."/>
</xsl:for-each>

<xsl:apply-templates select="fwb:Interface" mode="copy"/>


<xsl:choose>
  <xsl:when test="Manamement">
<!-- element Management is present, add children elements is needed -->

  </xsl:when>
  <xsl:otherwise>


<xsl:text>
</xsl:text>
<Management>
<xsl:attribute name="address">
  <xsl:value-of select="$address"/>
</xsl:attribute>

<xsl:text>
</xsl:text>
<SNMPManagement>
  <xsl:attribute name="snmp_read_community"><xsl:value-of select="$snmp_read"/></xsl:attribute>
  <xsl:attribute name="snmp_write_community"><xsl:value-of select="$snmp_write"/></xsl:attribute>
</SNMPManagement>

<xsl:text>
</xsl:text>
<PolicyInstallScript>
    <xsl:choose>
      <xsl:when test="$inst_script=''">
  <xsl:attribute name="enabled">False</xsl:attribute>
      </xsl:when>
      <xsl:otherwise>
  <xsl:attribute name="enabled">True</xsl:attribute>
  <xsl:attribute name="command">  <xsl:value-of select="$inst_script"/></xsl:attribute>
  <xsl:attribute name="arguments"><xsl:value-of select="$inst_cmdline"/></xsl:attribute>
      </xsl:otherwise>
    </xsl:choose>
</PolicyInstallScript>



<xsl:text>
</xsl:text>
</Management>

  </xsl:otherwise>
</xsl:choose>

<xsl:for-each select="fwb:FirewallOptions">
<xsl:text>
</xsl:text>
  <xsl:copy-of select="."/>
</xsl:for-each>

<xsl:text>
</xsl:text>
</Firewall>
</xsl:template>


<!--
*************************************************************************
*  the following template recusrively copies ObjectGroup "Objects" and  *
*  adds child element "ObjectGroup" with id='stdid15' and name="Address *
*  Ranges" if it did not exist there before. Checking for existance of  *
*  this child element allows us to run this transformation multiple     *
*  times on the same data file                                          *
************************************************************************* 
-->
<xsl:template match="*[attribute::id='stdid01']" mode="copy">
<xsl:choose>
<xsl:when test="*[attribute::id='stdid15']">
  <ObjectGroup id="stdid01" library="Standard" name="Objects">
  <xsl:apply-templates mode="copy"/>
  </ObjectGroup>
</xsl:when>
<xsl:otherwise>
  <ObjectGroup id="stdid01" library="Standard" name="Objects">
  <xsl:apply-templates mode="copy"/>
  <ObjectGroup id="stdid15" library="Standard" name="Address Ranges"/>
  <xsl:text>
  </xsl:text>
  </ObjectGroup>
</xsl:otherwise>
</xsl:choose>

</xsl:template>

<!-- Group 'Services' -->
<xsl:template match="*[attribute::id='stdid05']" mode="copy">
<ServiceGroup id="stdid05" library="Standard" name="Services">
<xsl:apply-templates mode="copy"/>
</ServiceGroup>
</xsl:template>

<!-- Group 'UDP Services' -->
<xsl:template match="*[attribute::id='stdid08']" mode="copy">
<ServiceGroup id="stdid08" library="Standard" name="UDP">
<xsl:apply-templates mode="copy"/>
</ServiceGroup>
</xsl:template>

<!-- Group 'TCP Services' -->
<xsl:template match="*[attribute::id='stdid09']" mode="copy">
<ServiceGroup id="stdid09" library="Standard" name="TCP">
<xsl:apply-templates mode="copy"/>
</ServiceGroup>
</xsl:template>

<!-- Group 'Firewalls' -->
<xsl:template match="*[attribute::id='stdid12']" mode="copy">
<ObjectGroup id="stdid12" library="Standard" name="Firewalls">
<xsl:apply-templates mode="copy"/>
</ObjectGroup>
</xsl:template>

<xsl:template match="*[attribute::id='stdid11']" mode="copy">
<xsl:copy-of select="."/>
</xsl:template>



<xsl:template match="*[attribute::id='root']">

  <FWObjectDatabase xmlns="http://www.fwbuilder.org/1.0/">

  <xsl:attribute name="version">0.10.5</xsl:attribute>
  <xsl:attribute name="id">root</xsl:attribute>

  <xsl:apply-templates select="*" mode="copy"/>

  </FWObjectDatabase>
</xsl:template>

</xsl:stylesheet>