|
@@ -24,6 +24,7 @@ import os
|
|
|
import os.path
|
|
|
import argparse
|
|
|
import sys
|
|
|
+import re
|
|
|
|
|
|
_saveconfig = True
|
|
|
|
|
@@ -104,12 +105,21 @@ try:
|
|
|
config.set_value("Encryption", "algorithm", args.algo)
|
|
|
_saveconfig = False
|
|
|
# set umask before creating/opening any files
|
|
|
- umask = int(config.get_value("Global", "umask"))
|
|
|
- os.umask(umask)
|
|
|
+ try:
|
|
|
+ umask = config.get_value("Global", "umask")
|
|
|
+ if re.search(r'^\d{4}$', umask):
|
|
|
+ os.umask(int(umask))
|
|
|
+ else:
|
|
|
+ raise ValueError
|
|
|
+ except ValueError:
|
|
|
+ print("Could not determine umask from config!")
|
|
|
+ sys.exit(2)
|
|
|
|
|
|
enc = CryptoEngine.get()
|
|
|
dbtype = config.get_value("Database", "type")
|
|
|
-
|
|
|
+ if not dbtype:
|
|
|
+ printf("Could not read the Database type from the config!")
|
|
|
+ sys.exit(1)
|
|
|
if os.path.exists(config.get_value("Database", "filename")):
|
|
|
dbver = pwman.data.factory.check_db_version(dbtype)
|
|
|
dbver = float(dbver.strip("\'"))
|