Revision: 214
http://svn.sourceforge.net/nmailserver/?rev=214&view=rev
Author: tmyroadctfig
Date: 2007-06-09 20:37:14 -0700 (Sat, 09 Jun 2007)
Log Message:
-----------
Added some checks to local store to prevent initial mail domain from being deleted.
Modified Paths:
--------------
NMail/trunk/NMail.LocalStore/LocalStore.cs
Modified: NMail/trunk/NMail.LocalStore/LocalStore.cs
===================================================================
--- NMail/trunk/NMail.LocalStore/LocalStore.cs 2007-06-10 03:34:19 UTC (rev 213)
+++ NMail/trunk/NMail.LocalStore/LocalStore.cs 2007-06-10 03:37:14 UTC (rev 214)
@@ -1273,7 +1273,7 @@
/// <param name="authToken">The authentication credentials.</param>
/// <param name="mailDomainId">The Id of the mail domain to delete.</param>
public void DeleteMailDomain(IAuthenticationToken authToken, int mailDomainId) {
- if (hasSystemPrivilege(authToken.Username, SystemPrivilege.DeleteMailDomain)) {
+ if (mailDomainId != 1 && hasSystemPrivilege(authToken.Username, SystemPrivilege.DeleteMailDomain)) {
this.LocalStoreData.DeleteMailDomain(mailDomainId);
} else {
@@ -1288,6 +1288,12 @@
/// <param name="mailDomain">The mail domain to update.</param>
public void UpdateMailDomain(IAuthenticationToken authToken, MailDomain mailDomain) {
if (hasSystemPrivilege(authToken.Username, SystemPrivilege.UpdateMailDomain)) {
+
+ // Ensure the first mail domain is for localhost
+ if (mailDomain.MailDomainId == 1 && mailDomain.PrimaryHost != Domain.LocalHost) {
+ throw new InvalidOperationException("Not permitted to alter this mail domain's primary host.");
+ }
+
this.LocalStoreData.UpdateMailDomain(mailDomain);
} else {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|