Added some API commands for use with a mobile app #391
|
@ -37,12 +37,10 @@ def createDefaultKnownNodes(appdata):
|
||||||
#print stream1
|
#print stream1
|
||||||
#print allKnownNodes
|
#print allKnownNodes
|
||||||
|
|
||||||
output = open(appdata + 'knownnodes.dat', 'wb')
|
with open(appdata + 'knownnodes.dat', 'wb) as output:
|
||||||
|
|
||||||
# Pickle dictionary using protocol 0.
|
# Pickle dictionary using protocol 0.
|
||||||
pickle.dump(allKnownNodes, output)
|
pickle.dump(allKnownNodes, output)
|
||||||
|
|
||||||
output.close()
|
|
||||||
return allKnownNodes
|
return allKnownNodes
|
||||||
|
|
||||||
def readDefaultKnownNodes(appdata):
|
def readDefaultKnownNodes(appdata):
|
||||||
|
|
|
@ -343,6 +343,19 @@ def checkSensitiveFilePermissions(filename):
|
||||||
# Windows systems.
|
# Windows systems.
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
|
try:
|
||||||
|
# Skip known problems for non-Win32 filesystems without POSIX permissions.
|
||||||
|
import subprocess
|
||||||
|
fstype = subprocess.check_output('stat -f -c "%%T" %s' % (filename),
|
||||||
|
shell=True,
|
||||||
|
stderr=subprocess.STDOUT)
|
||||||
|
if 'fuseblk' in fstype:
|
||||||
|
logger.info('Skipping file permissions check for %s. Filesystem fuseblk detected.',
|
||||||
|
filename)
|
||||||
|
return True
|
||||||
|
except:
|
||||||
|
# Swallow exception here, but we might run into trouble later!
|
||||||
|
logger.error('Could not determine filesystem type.', filename)
|
||||||
present_permissions = os.stat(filename)[0]
|
present_permissions = os.stat(filename)[0]
|
||||||
disallowed_permissions = stat.S_IRWXG | stat.S_IRWXO
|
disallowed_permissions = stat.S_IRWXG | stat.S_IRWXO
|
||||||
return present_permissions & disallowed_permissions == 0
|
return present_permissions & disallowed_permissions == 0
|
||||||
|
|
Reference in New Issue
Block a user