/usr/share/pyshared/pwman/data/database.py is in pwman3 0.4.2-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 83 84 85 86 87 88 89 90 91 92 93 94 95 | #============================================================================
# This file is part of Pwman3.
#
# Pwman3 is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2
# as published by the Free Software Foundation;
#
# Pwman3 is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Pwman3; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#============================================================================
# Copyright (C) 2012 Oz Nahum <nahumoz@gmail.com>
#============================================================================
# Copyright (C) 2006 Ivan Kelly <ivan@ivankelly.net>
#============================================================================
from pwman.data.nodes import Node
from pwman.util.crypto import CryptoEngine
class DatabaseException(Exception):
pass
class Database:
def __init__(self):
self._filtertags = []
def open(self):
"""
Open the database, by calling the _open method of the
class inherited for the specific database.
When done validation that the file is OK, check if it has
encryption key, by calling
enc = CryptoEngine.get()
key = self.loadkey()
"""
self._open()
enc = CryptoEngine.get()
key = self.loadkey()
if (key != None):
enc.set_cryptedkey(key)
else:
self.changepassword()
def close(self):
pass
def changepassword(self):
"""
Change the databases password.
"""
enc = CryptoEngine.get()
newkey = enc.changepassword()
return self.savekey(newkey)
def listtags(self, all=False):
pass
def currenttags(self):
return self._filtertags
def filter(self, tags):
for tag in tags:
if not (tag in self._filtertags):
self._filtertags.append(tag)
def clearfilter(self):
self._filtertags = []
def getnodes(self, ids):
pass
def addnodes(self, nodes):
pass
def editnode(self, id, node):
pass
def removenodes(self, nodes):
pass
def listnodes(self):
pass
def savekey(self, key):
pass
def loadkey(self):
pass
|