diff --git a/secrules/getMailObjectInfo.py b/secrules/getMailObjectInfo.py new file mode 100644 index 0000000000000000000000000000000000000000..d2155fa445bd2f0b44b4cc92b7e2b39e82bc4836_c2VjcnVsZXMvZ2V0TWFpbE9iamVjdEluZm8ucHk= --- /dev/null +++ b/secrules/getMailObjectInfo.py @@ -0,0 +1,35 @@ +import os +from vms import starlet, syidef +from vms.rtl import lib +from vms import user +from FindFile import FindFile + +def getMailObjectInfo(): + all_users = user.all_users() + maxsysgroup = lib.getsyi(syidef.SYI__MAXSYSGROUP)[1] + + def file_exists(fn): + try: + with FindFile (fn) as ifn: + ifn.__next__() + return True + except VMSError, e: + return False + + objectMailPresent = False + objectMailAccount = False + objectMailUser = '' + + with os.popen('MCR NCL SHOW SESSION CONTROL APPLICATION MAIL') as p: + r = [x[:-1] for x in p] + for l in r: + if '= MAIL' in l: + objectMailPresent = True + + if objectMailPresent: + for u in all_users.values(): + if u.username == 'MAIL$SERVER': + objectMailUser = u + objectMailAccount = True + + return objectMailPresent, objectMailAccount, objectMailUser