This file is indexed.

/usr/share/pyshared/PyritePublisher/plugin_jfile.py is in pyrite-publisher 2.1.1-8.

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
#
#  $Id: plugin_jfile.py,v 1.1 2002/03/26 12:56:06 rob Exp $
#
#  Copyright 2001 Rob Tillotson <rob@pyrite.org>
#  All Rights Reserved
#
#  Permission to use, copy, modify, and distribute this software and
#  its documentation for any purpose and without fee or royalty is
#  hereby granted, provided that the above copyright notice appear in
#  all copies and that both the copyright notice and this permission
#  notice appear in supporting documentation or portions thereof,
#  including modifications, that you you make.
#
#  THE AUTHOR ROB TILLOTSON DISCLAIMS ALL WARRANTIES WITH REGARD TO
#  THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
#  AND FITNESS.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
#  SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
#  RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
#  CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
#  CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE!
#
"""
"""

__version__ = '$Id: plugin_jfile.py,v 1.1 2002/03/26 12:56:06 rob Exp $'

__author__ = 'Rob Tillotson <rob@pyrite.org>'

__copyright__ = 'Copyright 2001 Rob Tillotson <rob@pyrite.org>'


from dtkplugins import DTKPlugin, LOG_NORMAL, LOG_DEBUG, LOG_ERROR, LOG_WARNING
from dtkmain import ConversionError

import dtkmain

import struct, string, re

from dbprotocol import *

def pad(s, n):
    return (s[:n]+('\0'*n))[:n]

CURRENT_MARKER = 576

MAX_FIELDS = 50
MAX_FIELD_NAME_LENGTH = 20
MAX_DATA_LENGTH = 4000
MAX_FIND_STRING = 16
MAX_FILTER_STRING = 16

_types = { FLD_STRING : 0x0001,
           FLD_BOOLEAN: 0x0002,
           FLD_DATE   : 0x0004,
           FLD_INT    : 0x0008,
           FLD_FLOAT  : 0x0010,
           FLD_TIME   : 0x0020, }


def make_jfile_appinfo(fieldspecs):
    rec = string.join([pad(x.name,MAX_FIELD_NAME_LENGTH)+'\0' for x in fieldspecs],'')
    for n in range(MAX_FIELDS - len(fieldspecs)):
        rec = rec + ('\0'*(MAX_FIELD_NAME_LENGTH+1))

    # string fields only right now
    for x in fieldspecs:
        rec = rec + struct.pack('>H', _types[x.type])
        
    rec = rec + (struct.pack('>H',0x0000) * (MAX_FIELDS - len(fieldspecs)))

    rec = rec + struct.pack('>H', len(fieldspecs))
    rec = rec + struct.pack('>H', CURRENT_MARKER)

    # column widths
    # boolean only needs 15
    # int needs 5*len+3
    for x in fieldspecs:
        t = x.type
        if t == FLD_BOOLEAN: w = 15
        elif t == FLD_INT: w = x.max_length*5+3
        else: w = 80
        rec = rec + struct.pack('>H',w)
    rec = rec + (struct.pack('>H',80) * (MAX_FIELDS-len(fieldspecs)))

    rec = rec + struct.pack('>H',80) # showDataWidth

    # filters and sorts
    rec = rec + (5 * struct.pack('>H',0))

    rec = rec + '\0' * MAX_FIND_STRING
    rec = rec + '\0' * MAX_FIND_STRING

    # flags defunct in jfile 5
    rec = rec + '\0\0'

    # first column to show
    rec = rec + '\0\0'

    # extra data 1
    rec = rec + '\0\0\0\0' * MAX_FIELDS
    # ... and 2
    rec = rec + '\0\0\0\0' * MAX_FIELDS

    # extra chunk
    rec = rec + '\0\0'

    return rec


            
class Plugin(DTKPlugin):
    name = 'JFile'
    description = 'JFile database converter'
    version = dtkmain.VERSION
    author = 'Rob Tillotson'
    author_email = 'rob@pyrite.org'

    links = [ (-1, 'columnar-database', 'pdb-output') ]
    
    def __init__(self, *a, **kw):
        DTKPlugin.__init__(self, *a, **kw)

        self._add_property('title','Database title')
        self._add_cli_option('title','t','title','Database title',vtype="STR")
        self.title = ''
        
    def open(self, chain, next, *a, **kw):
        self.pdb = next

        inf = {'type': 'JfD5',
               'creator': 'JFi5',
               'version': 0x0801, # no security, jfile 5
               }
        if self.title: inf['name'] = self.title
        self.pdb.updateDBInfo(inf)
        
        self.uid = 0x6f0000
        
        self.field_names = []
        
        self.guesser = TypeGuesser()
        return self

    def define_fields(self, fieldspecs):
        self.fieldspecs = fieldspecs
        
    def feed_record(self, fields):
        rec = string.join([struct.pack('>H',len(str(x))+1) for x in fields], '')
        rec = rec + string.join(map(str, fields), '\0') + '\0'

        self.pdb.setRecord(0x40, self.uid, 0, rec)
        self.uid = self.uid + 1

    def close(self):
        self.pdb.setAppBlock(make_jfile_appinfo(self.fieldspecs))