This file is indexed.

/usr/share/lua/5.1/xavante/davFileProps.lua is in xavante 2.3.0-1.

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
-----------------------------------------------------------------------------
-- Xavante webDAV Properties with file backend
-- Author: Javier Guerra
-- Copyright (c) 2005 Javier Guerra
-----------------------------------------------------------------------------

local lfs = require "lfs"

local props_mt = { __index = {} }
local props = props_mt.__index

-- equivalent to 'mkdir -p path'
local function mkdir_p (path)
	local walk = ""
	for p in string.gfind (path, "[^/]+") do
		walk = walk.."/"..p
		attr = lfs.attributes (walk)
		if not attr then
			lfs.mkdir (walk)
		else
			if attr.mode ~= "directory" then
				return nil, string.format ("%s existe y no es directorio", walk)
			end
		end
	end
end

function props:getPropNames (path)
	path = self.rootDir..path
	local function gen ()
		local attr = lfs.attributes (path)
		if not attr or attr.mode ~= "directory" then return nil end

		for prop in lfs.dir (path) do
			if string.sub (prop, 1,1) ~= "." then
				coroutine.yield (prop)
			end
		end
	end

	return coroutine.wrap (gen)
end

function props:getProp (path, propname)
	local f = io.open (self.rootDir..path.."/"..propname)
	if not f then return nil end

	local val = f:read ("*a")
	f:close ()

	return val
end

function props:setProp (path, propname, value)
	if not value then
		os.remove (self.rootDir..path.."/"..propname)
		return
	end
	
	mkdir_p (self.rootDir..path)
	local f = assert (io.open (self.rootDir..path.."/"..propname, "wb"))
	
	f:write (value)
	f:close ()
end

function props:delete (path)
	os.remove (self.rootDir..path..'/')
end

local M = {}

function M.makeProps (params)
	params = params or {}
	
	params.rootDir = params.rootDir or ".PROPS/"
	mkdir_p (params.rootDir)

	return setmetatable (params, props_mt)
end

return M