| |
@@ -21,6 +21,7 @@
|
| |
from lib389.cli_ctl import instance as cli_instance
|
| |
from lib389.cli_ctl import dbtasks as cli_dbtasks
|
| |
from lib389.cli_base import disconnect_instance, setup_script_logger
|
| |
+ from lib389.cli_base import format_error_to_dict
|
| |
from lib389.cli_ctl.instance import instance_remove_all
|
| |
from lib389._constants import DSRC_CONTAINER
|
| |
|
| |
@@ -106,10 +107,12 @@
|
| |
insts = inst.list(serverid=args.instance)
|
| |
except (PermissionError, IOError) as e:
|
| |
log.error("Unable to access instance information. Are you running as the correct user? (usually dirsrv or root)")
|
| |
- log.error("Error: %s" % str(e))
|
| |
+ msg = format_error_to_dict(e)
|
| |
+ log.error("Error: %s" % " - ".join(msg.values()))
|
| |
sys.exit(1)
|
| |
except Exception as e:
|
| |
- log.error("Error: %s" % str(e))
|
| |
+ msg = format_error_to_dict(e)
|
| |
+ log.error("Error: %s" % " - ".join(msg.values()))
|
| |
sys.exit(1)
|
| |
if len(insts) != 1:
|
| |
log.error("No such instance '%s'" % args.instance)
|
| |
@@ -123,11 +126,11 @@
|
| |
result = args.func(inst, log, args)
|
| |
except Exception as e:
|
| |
log.debug(e, exc_info=True)
|
| |
- log.error("Error: %s" % str(e))
|
| |
+ msg = format_error_to_dict(e)
|
| |
+ log.error("Error: %s" % " - ".join(msg.values()))
|
| |
result = False
|
| |
disconnect_instance(inst)
|
| |
|
| |
# Done!
|
| |
if result is False:
|
| |
sys.exit(1)
|
| |
-
|
| |
This is a security risk, because if an attacker can control any input that becomes put into an error message, it will be run here. This is not safe.