Skip to content

Commit b9342a9

Browse files
committed
securify fix: CP-29: Manage Website – SMTP Hosts – Verify
1 parent be9f5d7 commit b9342a9

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

emailMarketing/emailMarketingManager.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,7 @@ def smtpHostOperations(self):
599599

600600
userID = self.request.session['userID']
601601
admin = Administrator.objects.get(pk=userID)
602+
currentACL = ACLManager.loadedACL(userID)
602603

603604
if emACL.checkIfEMEnabled(admin.userName) == 0:
604605
return ACLManager.loadErrorJson()
@@ -610,6 +611,10 @@ def smtpHostOperations(self):
610611

611612
if operation == 'delete':
612613
delHost = SMTPHosts.objects.get(id=id)
614+
615+
if ACLManager.VerifySMTPHost(currentACL, delHost.owner, admin) == 0:
616+
return ACLManager.loadErrorJson()
617+
613618
currentACL = ACLManager.loadedACL(userID)
614619
if currentACL['admin'] == 1:
615620
pass
@@ -622,6 +627,10 @@ def smtpHostOperations(self):
622627
else:
623628
try:
624629
verifyHost = SMTPHosts.objects.get(id=id)
630+
631+
if ACLManager.VerifySMTPHost(currentACL, verifyHost.owner, admin) == 0:
632+
return ACLManager.loadErrorJson()
633+
625634
verifyLogin = smtplib.SMTP(str(verifyHost.host), int(verifyHost.port))
626635

627636
if int(verifyHost.port) == 587:

plogical/acl.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,16 @@ class ACLManager:
4343
'"dkimManager": 1, "createFTPAccount": 1, "deleteFTPAccount": 1, "listFTPAccounts": 1, "createBackup": 1,' \
4444
' "restoreBackup": 0, "addDeleteDestinations": 0, "scheduleBackups": 0, "remoteBackups": 0, "googleDriveBackups": 1, "manageSSL": 1, ' \
4545
'"hostnameSSL": 0, "mailServerSSL": 0 }'
46+
47+
@staticmethod
48+
def VerifySMTPHost(currentACL, owner, user):
49+
if currentACL['admin'] == 1:
50+
return 1
51+
elif owner == user:
52+
return 1
53+
else:
54+
return 0
55+
4656
@staticmethod
4757
def FindIfChild():
4858
try:

0 commit comments

Comments
 (0)