nmailserver-commits Mailing List for NMail (Page 8)
Brought to you by:
dframpton-oss,
tmyroadctfig
You can subscribe to this list here.
| 2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(13) |
Jun
(14) |
Jul
(8) |
Aug
|
Sep
|
Oct
(8) |
Nov
(22) |
Dec
(9) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 |
Jan
(21) |
Feb
(31) |
Mar
(24) |
Apr
(8) |
May
(23) |
Jun
(40) |
Jul
(14) |
Aug
(5) |
Sep
(7) |
Oct
(10) |
Nov
|
Dec
|
| 2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <tmy...@us...> - 2007-01-10 09:10:40
|
Revision: 112
http://svn.sourceforge.net/nmailserver/?rev=112&view=rev
Author: tmyroadctfig
Date: 2007-01-10 01:10:39 -0800 (Wed, 10 Jan 2007)
Log Message:
-----------
Added authorization requirement to NMail.Administration.Web pages.
Modified Paths:
--------------
NMail/trunk/NMail.Administration.Web/web.config
Modified: NMail/trunk/NMail.Administration.Web/web.config
===================================================================
--- NMail/trunk/NMail.Administration.Web/web.config 2007-01-10 09:09:26 UTC (rev 111)
+++ NMail/trunk/NMail.Administration.Web/web.config 2007-01-10 09:10:39 UTC (rev 112)
@@ -33,6 +33,12 @@
protection="All"
slidingExpiration="true"/>
</authentication>
+
+ <!-- Deny any un-authenticated users. -->
+ <authorization>
+ <deny users="?" />
+ </authorization>
+
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tmy...@us...> - 2007-01-10 09:09:28
|
Revision: 111
http://svn.sourceforge.net/nmailserver/?rev=111&view=rev
Author: tmyroadctfig
Date: 2007-01-10 01:09:26 -0800 (Wed, 10 Jan 2007)
Log Message:
-----------
Renamed Folder.FullName to FullyQualifiedName and added FullName. Also changed API for ILocalStore and ILocalStoreData. Added migration script to MySqlLocalStoreData.
Modified Paths:
--------------
NMail/trunk/NMail/DataTypes/Folder.cs
NMail/trunk/NMail/DataTypes/LocalStore/ILocalStore.cs
NMail/trunk/NMail/DataTypes/LocalStore/ILocalStoreData.cs
NMail/trunk/NMail.Administration.Web/CreateFolder.aspx
NMail/trunk/NMail.Administration.Web/CreateFolder.aspx.cs
NMail/trunk/NMail.Administration.Web/FolderDetails.aspx
NMail/trunk/NMail.Administration.Web/UserDetails.aspx
NMail/trunk/NMail.Administration.Web/ViewFolders.aspx
NMail/trunk/NMail.ImapService/Response/AclResponse.cs
NMail/trunk/NMail.ImapService/Response/ListResponse.cs
NMail/trunk/NMail.ImapService/State/AuthenticatedState.cs
NMail/trunk/NMail.LocalStore/LocalStore.cs
NMail/trunk/NMail.LocalStoreData.MySql/MySqlLocalStore.sql
NMail/trunk/NMail.LocalStoreData.MySql/MySqlLocalStoreData.cs
NMail/trunk/NMail.LocalStoreData.MySql/NMail.LocalStoreData.MySql.csproj
NMail/trunk/NMail.RemoteAccessService.Serializers/DataTypes/LocalStore/StoreFolderSerializer.cs
Added Paths:
-----------
NMail/trunk/NMail.LocalStoreData.MySql/MySqlLocalStoreData-1-to-2.sql
Modified: NMail/trunk/NMail/DataTypes/Folder.cs
===================================================================
--- NMail/trunk/NMail/DataTypes/Folder.cs 2007-01-08 12:58:59 UTC (rev 110)
+++ NMail/trunk/NMail/DataTypes/Folder.cs 2007-01-10 09:09:26 UTC (rev 111)
@@ -199,15 +199,29 @@
}
}
}
+
private string folder;
/// <summary>
- /// Gets the folder name for this folder.
+ /// Gets the folder name for this folder. E.g. "Inbox".
/// </summary>
+ /// <see cref="FullFolderName"/>
public string FolderName {
get {
+ int length = (this.Parent == null) ? 0 : this.Parent.FullFolderName.Length + 1;
+ return this.folder.Remove(0, length);
+ }
+ }
+
+ /// <summary>
+ /// Gets the full folder name for this folder. E.g. "Joe.Inbox".
+ /// </summary>
+ /// <see cref="FolderName"/>
+ public string FullFolderName {
+ get {
return this.folder;
}
+
}
private string nameSpace;
@@ -222,9 +236,9 @@
}
/// <summary>
- /// The fully qualified name for this folder.
+ /// The fully qualified name for this folder. E.g. "#LocalMail.Joe.Inbox".
/// </summary>
- public string QualifiedName {
+ public string FullyQualifiedName {
get {
return "#" + nameSpace + delimiter + folder;
}
Modified: NMail/trunk/NMail/DataTypes/LocalStore/ILocalStore.cs
===================================================================
--- NMail/trunk/NMail/DataTypes/LocalStore/ILocalStore.cs 2007-01-08 12:58:59 UTC (rev 110)
+++ NMail/trunk/NMail/DataTypes/LocalStore/ILocalStore.cs 2007-01-10 09:09:26 UTC (rev 111)
@@ -298,12 +298,13 @@
int? GetMessageCount(IAuthenticationToken authToken, StoreFolder folder);
/// <summary>
- /// Gets the number of messages with the RECENT flag set.
+ /// Gets the number of messages with the specified flags set.
/// </summary>
/// <param name="authToken">The authentication credentials.</param>
- /// <param name="folder">The folder to count the recent messages in.</param>
- /// <returns>The number of recent messages or null if invalid folder or privileges.</returns>
- int? GetRecentMessageCount(IAuthenticationToken authToken, StoreFolder folder);
+ /// <param name="folder">The folder to count the flagged messages in.</param>
+ /// <param name="flags">The flags to check for when counting.</param>
+ /// <returns>The number of messages or null if invalid folder or privileges.</returns>
+ int? GetMessageCountWithFlags(IAuthenticationToken authToken, StoreFolder folder, StoreMessageFlags flags);
#endregion
/// <summary>
Modified: NMail/trunk/NMail/DataTypes/LocalStore/ILocalStoreData.cs
===================================================================
--- NMail/trunk/NMail/DataTypes/LocalStore/ILocalStoreData.cs 2007-01-08 12:58:59 UTC (rev 110)
+++ NMail/trunk/NMail/DataTypes/LocalStore/ILocalStoreData.cs 2007-01-10 09:09:26 UTC (rev 111)
@@ -237,11 +237,12 @@
int GetMessageCount(StoreFolder folder);
/// <summary>
- /// Gets the number of messages with the RECENT flag set.
+ /// Gets the number of messages with the specified flag set.
/// </summary>
- /// <param name="folder">The folder to count the recent messages in.</param>
- /// <returns>The number of recent messages.</returns>
- int GetRecentMessageCount(StoreFolder folder);
+ /// <param name="folder">The folder to count the flagged messages in.</param>
+ /// <param name="flags">The flags to check for when counting.</param>
+ /// <returns>The number of messages.</returns>
+ int GetMessageCountWithFlags(StoreFolder folder, StoreMessageFlags flags);
#endregion
/// <summary>
Modified: NMail/trunk/NMail.Administration.Web/CreateFolder.aspx
===================================================================
--- NMail/trunk/NMail.Administration.Web/CreateFolder.aspx 2007-01-08 12:58:59 UTC (rev 110)
+++ NMail/trunk/NMail.Administration.Web/CreateFolder.aspx 2007-01-10 09:09:26 UTC (rev 111)
@@ -6,7 +6,7 @@
<asp:DetailsView ID="FolderDetailsView" runat="server" AutoGenerateRows="False"
DefaultMode="Insert" DataSourceID="CreateFolderDataSource" AutoGenerateInsertButton="True" OnModeChanging="FolderDetailsView_ModeChanging">
<Fields>
- <asp:BoundField DataField="FolderName" HeaderText="Folder Name" SortExpression="FolderName" />
+ <asp:BoundField DataField="FullFolderName" HeaderText="Folder Name" SortExpression="FolderName" />
</Fields>
</asp:DetailsView>
<asp:ObjectDataSource ID="CreateFolderDataSource" runat="server" InsertMethod="CreateFolder"
Modified: NMail/trunk/NMail.Administration.Web/CreateFolder.aspx.cs
===================================================================
--- NMail/trunk/NMail.Administration.Web/CreateFolder.aspx.cs 2007-01-08 12:58:59 UTC (rev 110)
+++ NMail/trunk/NMail.Administration.Web/CreateFolder.aspx.cs 2007-01-10 09:09:26 UTC (rev 111)
@@ -20,7 +20,7 @@
protected void FolderDataSource_Inserting(object sender, ObjectDataSourceMethodEventArgs e)
{
// Save the folder name to display in the insert callback below
- this.folderName = (string) e.InputParameters["FolderName"];
+ this.folderName = (string) e.InputParameters["FullFolderName"];
}
protected void FolderDataSource_Inserted(object sender, ObjectDataSourceStatusEventArgs e)
Modified: NMail/trunk/NMail.Administration.Web/FolderDetails.aspx
===================================================================
--- NMail/trunk/NMail.Administration.Web/FolderDetails.aspx 2007-01-08 12:58:59 UTC (rev 110)
+++ NMail/trunk/NMail.Administration.Web/FolderDetails.aspx 2007-01-10 09:09:26 UTC (rev 111)
@@ -19,7 +19,7 @@
<asp:BoundField DataField="FolderId" HeaderText="Folder Id" SortExpression="FolderId" InsertVisible="False" ReadOnly="True" />
<asp:HyperLinkField DataNavigateUrlFields="ParentId" DataNavigateUrlFormatString="FolderDetails.aspx?FolderId={0}"
DataTextField="ParentId" HeaderText="Parent Id" />
- <asp:BoundField DataField="FolderName" HeaderText="Folder Name" ReadOnly="True" SortExpression="FolderName" />
+ <asp:BoundField DataField="FullFolderName" HeaderText="Folder Name" ReadOnly="True" SortExpression="FolderName" />
<asp:BoundField DataField="NameSpace" HeaderText="Namespace" ReadOnly="True" SortExpression="NameSpace" InsertVisible="False" />
<asp:CheckBoxField DataField="HasChildren" HeaderText="Has Children" SortExpression="HasChildren" InsertVisible="False" ReadOnly="True" />
<asp:CommandField ShowDeleteButton="True" />
@@ -42,7 +42,7 @@
<asp:GridView ID="SubFoldersGridView" runat="server" AutoGenerateColumns="False" DataSourceID="FolderChildrenDataSource">
<Columns>
<asp:BoundField DataField="FolderId" HeaderText="Folder Id" SortExpression="FolderId" />
- <asp:BoundField DataField="FolderName" HeaderText="Folder Name" ReadOnly="True" SortExpression="FolderName" />
+ <asp:BoundField DataField="FullFolderName" HeaderText="Folder Name" ReadOnly="True" SortExpression="FolderName" />
<asp:BoundField DataField="NameSpace" HeaderText="Namespace" ReadOnly="True" SortExpression="NameSpace" />
<asp:CheckBoxField DataField="HasChildren" HeaderText="HasChildren" SortExpression="HasChildren" />
<asp:HyperLinkField DataNavigateUrlFields="FolderId" DataNavigateUrlFormatString="FolderDetails.aspx?FolderId={0}"
Modified: NMail/trunk/NMail.Administration.Web/UserDetails.aspx
===================================================================
--- NMail/trunk/NMail.Administration.Web/UserDetails.aspx 2007-01-08 12:58:59 UTC (rev 110)
+++ NMail/trunk/NMail.Administration.Web/UserDetails.aspx 2007-01-10 09:09:26 UTC (rev 111)
@@ -41,7 +41,7 @@
<asp:GridView ID="UserFoldersGridView" runat="server" AutoGenerateColumns="False" DataSourceID="UserFolderDataSource">
<Columns>
<asp:BoundField DataField="FolderId" HeaderText="Folder Id" SortExpression="FolderId" />
- <asp:BoundField DataField="FolderName" HeaderText="Folder Name" ReadOnly="True" SortExpression="FolderName" />
+ <asp:BoundField DataField="FullFolderName" HeaderText="Folder Name" ReadOnly="True" SortExpression="FolderName" />
<asp:BoundField DataField="NameSpace" HeaderText="Namespace" ReadOnly="True" SortExpression="NameSpace" />
<asp:CheckBoxField DataField="HasChildren" HeaderText="Has Children" SortExpression="HasChildren" />
<asp:HyperLinkField DataNavigateUrlFields="FolderId" DataNavigateUrlFormatString="FolderDetails.aspx?FolderId={0}"
Modified: NMail/trunk/NMail.Administration.Web/ViewFolders.aspx
===================================================================
--- NMail/trunk/NMail.Administration.Web/ViewFolders.aspx 2007-01-08 12:58:59 UTC (rev 110)
+++ NMail/trunk/NMail.Administration.Web/ViewFolders.aspx 2007-01-10 09:09:26 UTC (rev 111)
@@ -7,7 +7,7 @@
<asp:BoundField DataField="FolderId" HeaderText="Folder Id" SortExpression="FolderId" />
<asp:HyperLinkField DataNavigateUrlFields="ParentId" DataNavigateUrlFormatString="FolderDetails.aspx?FolderId={0}"
DataTextField="ParentId" HeaderText="Parent Id" />
- <asp:BoundField DataField="FolderName" HeaderText="Folder Name" ReadOnly="True" SortExpression="FolderName" />
+ <asp:BoundField DataField="FullFolderName" HeaderText="Folder Name" ReadOnly="True" SortExpression="FolderName" />
<asp:BoundField DataField="NameSpace" HeaderText="Namespace" ReadOnly="True" SortExpression="NameSpace" />
<asp:CheckBoxField DataField="HasChildren" HeaderText="Has Children" SortExpression="HasChildren" />
<asp:HyperLinkField DataNavigateUrlFields="FolderId" DataNavigateUrlFormatString="FolderDetails.aspx?FolderId={0}" Text="details" />
Modified: NMail/trunk/NMail.ImapService/Response/AclResponse.cs
===================================================================
--- NMail/trunk/NMail.ImapService/Response/AclResponse.cs 2007-01-08 12:58:59 UTC (rev 110)
+++ NMail/trunk/NMail.ImapService/Response/AclResponse.cs 2007-01-10 09:09:26 UTC (rev 111)
@@ -37,7 +37,7 @@
private Folder folder;
public override void WriteResponse(ImapServiceConnection cnn) {
- cnn.WriteLine("* {0} {1} {2} {3}", this.cmdString, this.folder.FolderName, this.ace.Identifier, StoreFolderPrivilegeHelper.ToImapString(this.ace.Privilege));
+ cnn.WriteLine("* {0} {1} {2} {3}", this.cmdString, this.folder.FullFolderName, this.ace.Identifier, StoreFolderPrivilegeHelper.ToImapString(this.ace.Privilege));
}
}
}
Modified: NMail/trunk/NMail.ImapService/Response/ListResponse.cs
===================================================================
--- NMail/trunk/NMail.ImapService/Response/ListResponse.cs 2007-01-08 12:58:59 UTC (rev 110)
+++ NMail/trunk/NMail.ImapService/Response/ListResponse.cs 2007-01-10 09:09:26 UTC (rev 111)
@@ -36,7 +36,7 @@
public ListResponse(StoreFolder folder) {
this.delimiter = folder.Delimiter;
- this.folder = folder.FolderName;
+ this.folder = folder.FullFolderName;
ListResponseType type = (folder.HasChildren)
? ListResponseType.HasChildren
: ListResponseType.HasNoChildren;
Modified: NMail/trunk/NMail.ImapService/State/AuthenticatedState.cs
===================================================================
--- NMail/trunk/NMail.ImapService/State/AuthenticatedState.cs 2007-01-08 12:58:59 UTC (rev 110)
+++ NMail/trunk/NMail.ImapService/State/AuthenticatedState.cs 2007-01-10 09:09:26 UTC (rev 111)
@@ -192,7 +192,7 @@
protected void sendSelectResponses(StoreFolder folder) {
QueueResponse(new SimpleResponse(ResponseType.Flags, @"(\Answered \Flagged \Deleted \Seen \Draft)"));
QueueResponse(new SimpleResponse(LocalStore.GetMessageCount(Session.AuthenticationToken, folder) + " EXISTS"));
- QueueResponse(new SimpleResponse(LocalStore.GetRecentMessageCount(Session.AuthenticationToken, folder) + " RECENT"));
+ QueueResponse(new SimpleResponse(LocalStore.GetMessageCountWithFlags(Session.AuthenticationToken, folder, StoreMessageFlags.Recent) + " RECENT"));
QueueResponse(new SimpleResponse(ResponseType.Ok, "[UIDNEXT " + LocalStore.GetNextMessageId(Session.AuthenticationToken, folder) + "]"));
QueueResponse(new SimpleResponse(ResponseType.Ok, "[UIDVALIDITY " + folder.FolderId + "]"));
@@ -253,7 +253,7 @@
response.AppendResponseItem("MESSAGES " + LocalStore.GetMessageCount(Session.AuthenticationToken, folder));
}
if ((cmd.Items & StatusItems.Recent) != StatusItems.None) {
- response.AppendResponseItem("RECENT " + LocalStore.GetRecentMessageCount(Session.AuthenticationToken, folder));
+ response.AppendResponseItem("RECENT " + LocalStore.GetMessageCountWithFlags(Session.AuthenticationToken, folder, StoreMessageFlags.Recent));
}
if ((cmd.Items & StatusItems.UidNext) != StatusItems.None) {
response.AppendResponseItem("UIDNEXT " + LocalStore.GetNextMessageId(Session.AuthenticationToken, folder));
Modified: NMail/trunk/NMail.LocalStore/LocalStore.cs
===================================================================
--- NMail/trunk/NMail.LocalStore/LocalStore.cs 2007-01-08 12:58:59 UTC (rev 110)
+++ NMail/trunk/NMail.LocalStore/LocalStore.cs 2007-01-10 09:09:26 UTC (rev 111)
@@ -350,7 +350,7 @@
Folder resolvedFolder = getResolvedFolder(authToken, newFolder);
if (resolvedFolder.Parent != null) {
- StoreFolder parent = GetStoreFolder(authToken, resolvedFolder.Parent.QualifiedName);
+ StoreFolder parent = GetStoreFolder(authToken, resolvedFolder.Parent.FullyQualifiedName);
if (parent != null) {
// Ensure the user has rights to get the message flags
@@ -922,18 +922,19 @@
#region Get Recent Message Count
/// <summary>
- /// Gets the number of messages with the RECENT flag set.
+ /// Gets the number of messages with the specified flags set.
/// </summary>
/// <param name="authToken">The authentication credentials.</param>
- /// <param name="folder">The folder to count the recent messages in.</param>
- /// <returns>The number of recent messages or null if invalid folder or privileges.</returns>
- public int? GetRecentMessageCount(IAuthenticationToken authToken, StoreFolder folder) {
+ /// <param name="folder">The folder to count the flagged messages in.</param>
+ /// <param name="flags">The flags to check for when counting.</param>
+ /// <returns>The number of messages or null if invalid folder or privileges.</returns>
+ public int? GetMessageCountWithFlags(IAuthenticationToken authToken, StoreFolder folder, StoreMessageFlags flags) {
// Ensure the user has rights to get the message count
if (hasFolderPrivilege(authToken.Username, folder.FolderId, StoreFolderPrivilege.Lookup)) {
// Return the count
- return LocalStoreData.GetRecentMessageCount(folder);
+ return LocalStoreData.GetMessageCountWithFlags(folder, flags);
} else {
return null;
Modified: NMail/trunk/NMail.LocalStoreData.MySql/MySqlLocalStore.sql
===================================================================
--- NMail/trunk/NMail.LocalStoreData.MySql/MySqlLocalStore.sql 2007-01-08 12:58:59 UTC (rev 110)
+++ NMail/trunk/NMail.LocalStoreData.MySql/MySqlLocalStore.sql 2007-01-10 09:09:26 UTC (rev 111)
@@ -8,7 +8,7 @@
Version INT NOT NULL
);
-INSERT INTO SchemaVersion (Version) VALUES (1);
+INSERT INTO SchemaVersion (Version) VALUES (2);
-- -----------------------------------------------------------------------
@@ -121,12 +121,7 @@
Headers LONGBLOB NOT NULL,
Preamble LONGBLOB,
Postamble LONGBLOB,
- SeenFlag BOOLEAN NOT NULL,
- AnsweredFlag BOOLEAN NOT NULL,
- FlaggedFlag BOOLEAN NOT NULL,
- DeletedFlag BOOLEAN NOT NULL,
- DraftFlag BOOLEAN NOT NULL,
- RecentFlag BOOLEAN NOT NULL,
+ MessageFlags INT NOT NULL,
Size INT NOT NULL,
InternalDate DATETIME NOT NULL,
PRIMARY KEY(MessageId),
Added: NMail/trunk/NMail.LocalStoreData.MySql/MySqlLocalStoreData-1-to-2.sql
===================================================================
--- NMail/trunk/NMail.LocalStoreData.MySql/MySqlLocalStoreData-1-to-2.sql (rev 0)
+++ NMail/trunk/NMail.LocalStoreData.MySql/MySqlLocalStoreData-1-to-2.sql 2007-01-10 09:09:26 UTC (rev 111)
@@ -0,0 +1,15 @@
+ALTER TABLE Message ADD COLUMN MessageFlags INT NOT NULL AFTER Postamble;
+
+UPDATE Message SET MessageFlags = 1 WHERE AnsweredFlag = 1;
+UPDATE Message SET MessageFlags = MessageFlags + 2 WHERE FlaggedFlag = 1;
+UPDATE Message SET MessageFlags = MessageFlags + 4 WHERE DeletedFlag = 1;
+UPDATE Message SET MessageFlags = MessageFlags + 8 WHERE SeenFlag = 1;
+UPDATE Message SET MessageFlags = MessageFlags + 16 WHERE DraftFlag = 1;
+UPDATE Message SET MessageFlags = MessageFlags + 32 WHERE RecentFlag = 1;
+
+ALTER TABLE Message DROP COLUMN AnsweredFlag;
+ALTER TABLE Message DROP COLUMN FlaggedFlag;
+ALTER TABLE Message DROP COLUMN DeletedFlag;
+ALTER TABLE Message DROP COLUMN SeenFlag;
+ALTER TABLE Message DROP COLUMN DraftFlag;
+ALTER TABLE Message DROP COLUMN RecentFlag;
\ No newline at end of file
Modified: NMail/trunk/NMail.LocalStoreData.MySql/MySqlLocalStoreData.cs
===================================================================
--- NMail/trunk/NMail.LocalStoreData.MySql/MySqlLocalStoreData.cs 2007-01-08 12:58:59 UTC (rev 110)
+++ NMail/trunk/NMail.LocalStoreData.MySql/MySqlLocalStoreData.cs 2007-01-10 09:09:26 UTC (rev 111)
@@ -80,20 +80,15 @@
cmd = cnn.CreateCommand();
cmd.Transaction = transaction;
cmd.Connection = cnn;
- cmd.CommandText = "INSERT INTO Message (FolderId, FolderMessageId, MimeMessage, Headers, Preamble, Postamble, SeenFlag, AnsweredFlag, FlaggedFlag, DeletedFlag, DraftFlag, RecentFlag, Size, InternalDate) " +
- "VALUES (?FolderId, ?FolderMessageId, ?MimeMessage, ?Headers, ?Preamble, ?Postamble, ?SeenFlag, ?AnsweredFlag, ?FlaggedFlag, ?DeletedFlag, ?DraftFlag, ?RecentFlag, ?Size, ?InternalDate)";
+ cmd.CommandText = "INSERT INTO Message (FolderId, FolderMessageId, MimeMessage, Headers, Preamble, Postamble, MessageFlags, Size, InternalDate) " +
+ "VALUES (?FolderId, ?FolderMessageId, ?MimeMessage, ?Headers, ?Preamble, ?Postamble, ?MessageFlags, ?Size, ?InternalDate)";
cmd.Parameters.Add("?FolderId", folder.FolderId);
cmd.Parameters.Add("?FolderMessageId", folderMessageId);
cmd.Parameters.Add("?MimeMessage", message.MultipartBody);
cmd.Parameters.Add("?Headers", message.Headers.Data.Bytes);
cmd.Parameters.Add("?Preamble", (message.Preamble != null) ? message.Preamble.Data.Bytes : null);
cmd.Parameters.Add("?Postamble", (message.Postamble != null) ? message.Postamble.Data.Bytes : null);
- cmd.Parameters.Add("?SeenFlag", false);
- cmd.Parameters.Add("?AnsweredFlag", false);
- cmd.Parameters.Add("?FlaggedFlag", false);
- cmd.Parameters.Add("?DeletedFlag", false);
- cmd.Parameters.Add("?DraftFlag", false);
- cmd.Parameters.Add("?RecentFlag", true);
+ cmd.Parameters.Add("?MessageFlags", StoreMessageFlags.Recent);
cmd.Parameters.Add("?Size", message.Size);
cmd.Parameters.Add("?InternalDate", DateTime.Now);
count = cmd.ExecuteNonQuery();
@@ -172,7 +167,7 @@
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "GetFolderId";
cmd.Parameters.Add("?FolderId", MySqlDbType.Int32);
- cmd.Parameters.Add("?Name", folder.FolderName);
+ cmd.Parameters.Add("?Name", folder.FullFolderName);
cmd.Parameters.Add("?NameSpace", folder.NameSpace);
cmd.Parameters["FolderId"].Direction = ParameterDirection.Output;
@@ -259,7 +254,7 @@
cmd.CommandText = "CreateFolder";
cmd.Parameters.Add("?ParentId", parentFolderId);
cmd.Parameters.Add("?NamespaceId", 1);
- cmd.Parameters.Add("?Name", newFolder.FolderName);
+ cmd.Parameters.Add("?Name", newFolder.FullFolderName);
cmd.Parameters.Add("?UserId", userId);
cmd.Parameters.Add("?FolderId", MySqlDbType.Int32);
cmd.Parameters.Add("?Result", MySqlDbType.Int32);
@@ -319,7 +314,7 @@
// Check only the top level folder is being renamed
char[] delim = { NMailConfiguration.Current.LocalStore.FolderDelimiter };
- string[] folderParts = folder.FolderName.Split(delim);
+ string[] folderParts = folder.FullFolderName.Split(delim);
string[] newParts = newFolderName.Split(delim);
if (folderParts.Length != newParts.Length) {
@@ -589,31 +584,13 @@
using (MySqlConnection cnn = MySqlHelper.GetConnection()) {
using (MySqlCommand cmd = cnn.CreateCommand()) {
- cmd.CommandText = "SELECT SeenFlag, AnsweredFlag, FlaggedFlag, DeletedFlag, DraftFlag, RecentFlag FROM Message WHERE FolderId = ?FolderId AND FolderMessageId = ?FolderMessageId";
+ cmd.CommandText = "SELECT MessageFlags FROM Message WHERE FolderId = ?FolderId AND FolderMessageId = ?FolderMessageId";
cmd.Parameters.Add("?FolderId", folder.FolderId);
cmd.Parameters.Add("?FolderMessageId", messageId);
+ object o = cmd.ExecuteScalar();
- using (MySqlDataReader reader = cmd.ExecuteReader()) {
- if (reader.Read()) {
- if ((sbyte) reader["SeenFlag"] == 1) {
- flags |= StoreMessageFlags.Seen;
- }
- if ((sbyte) reader["AnsweredFlag"] == 1) {
- flags |= StoreMessageFlags.Answered;
- }
- if ((sbyte) reader["FlaggedFlag"] == 1) {
- flags |= StoreMessageFlags.Flagged;
- }
- if ((sbyte) reader["DeletedFlag"] == 1) {
- flags |= StoreMessageFlags.Deleted;
- }
- if ((sbyte) reader["DraftFlag"] == 1) {
- flags |= StoreMessageFlags.Draft;
- }
- if ((sbyte) reader["RecentFlag"] == 1) {
- flags |= StoreMessageFlags.Recent;
- }
- }
+ if (!Convert.IsDBNull(o)) {
+ flags = (StoreMessageFlags) o;
}
}
}
@@ -626,15 +603,10 @@
public void SetMessageFlags(int messageId, StoreFolder folder, StoreMessageFlags flags) {
using (MySqlConnection cnn = MySqlHelper.GetConnection()) {
using (MySqlCommand cmd = cnn.CreateCommand()) {
- cmd.CommandText = "UPDATE Message SET SeenFlag = ?SeenFlag, AnsweredFlag = ?AnsweredFlag, FlaggedFlag = ?FlaggedFlag, DeletedFlag = ?DeletedFlag, DraftFlag = ?DraftFlag, RecentFlag = ?RecentFlag WHERE FolderId = ?FolderId AND FolderMessageId = ?FolderMessageId";
+ cmd.CommandText = "UPDATE Message SET MessageFlags = ?MessageFlags WHERE FolderId = ?FolderId AND FolderMessageId = ?FolderMessageId";
cmd.Parameters.Add("?FolderId", folder.FolderId);
cmd.Parameters.Add("?FolderMessageId", messageId);
- cmd.Parameters.Add("?SeenFlag", ((flags & StoreMessageFlags.Seen) != StoreMessageFlags.None));
- cmd.Parameters.Add("?AnsweredFlag", ((flags & StoreMessageFlags.Answered) != StoreMessageFlags.None));
- cmd.Parameters.Add("?FlaggedFlag", ((flags & StoreMessageFlags.Flagged) != StoreMessageFlags.None));
- cmd.Parameters.Add("?DeletedFlag", ((flags & StoreMessageFlags.Deleted) != StoreMessageFlags.None));
- cmd.Parameters.Add("?DraftFlag", ((flags & StoreMessageFlags.Draft) != StoreMessageFlags.None));
- cmd.Parameters.Add("?RecentFlag", ((flags & StoreMessageFlags.Recent) != StoreMessageFlags.None));
+ cmd.Parameters.Add("?MessageFlags", (int) flags);
if (cmd.ExecuteNonQuery() != 1) {
throw new Exception("Error updating message flags.");
@@ -785,13 +757,14 @@
}
#endregion
- #region GetRecentMessageCount
- public int GetRecentMessageCount(StoreFolder folder) {
+ #region GetMessageCountWithFlags
+ public int GetMessageCountWithFlags(StoreFolder folder, StoreMessageFlags flags) {
using (MySqlConnection cnn = MySqlHelper.GetConnection()) {
using (MySqlCommand cmd = cnn.CreateCommand()) {
- cmd.CommandText = "SELECT COUNT(*) FROM Message WHERE FolderId = ?FolderId AND RecentFlag = true";
+ cmd.CommandText = "SELECT COUNT(*) FROM Message WHERE FolderId = ?FolderId AND MessageFlags & ?MessageFlags = ?MessageFlags";
cmd.Parameters.Add("?FolderId", folder.FolderId);
- return Convert.ToInt32((long)cmd.ExecuteScalar());
+ cmd.Parameters.Add("?MessageFlags", flags);
+ return Convert.ToInt32((long) cmd.ExecuteScalar());
}
}
}
Modified: NMail/trunk/NMail.LocalStoreData.MySql/NMail.LocalStoreData.MySql.csproj
===================================================================
--- NMail/trunk/NMail.LocalStoreData.MySql/NMail.LocalStoreData.MySql.csproj 2007-01-08 12:58:59 UTC (rev 110)
+++ NMail/trunk/NMail.LocalStoreData.MySql/NMail.LocalStoreData.MySql.csproj 2007-01-10 09:09:26 UTC (rev 111)
@@ -116,6 +116,9 @@
</Content>
<Content Include="NMail.LocalStoreData.Mysql.build" />
</ItemGroup>
+ <ItemGroup>
+ <None Include="MySqlLocalStoreData-1-to-2.sql" />
+ </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>
Modified: NMail/trunk/NMail.RemoteAccessService.Serializers/DataTypes/LocalStore/StoreFolderSerializer.cs
===================================================================
--- NMail/trunk/NMail.RemoteAccessService.Serializers/DataTypes/LocalStore/StoreFolderSerializer.cs 2007-01-08 12:58:59 UTC (rev 110)
+++ NMail/trunk/NMail.RemoteAccessService.Serializers/DataTypes/LocalStore/StoreFolderSerializer.cs 2007-01-10 09:09:26 UTC (rev 111)
@@ -18,7 +18,7 @@
public StoreFolderSerializer(StoreFolder storeFolder) {
this.folderId = storeFolder.FolderId;
- this.name = storeFolder.FolderName;
+ this.name = storeFolder.FullFolderName;
this.nameSpace = storeFolder.NameSpace;
this.hasChildren = storeFolder.HasChildren;
this.parentId = storeFolder.ParentId;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tmy...@us...> - 2007-01-08 12:59:00
|
Revision: 110
http://svn.sourceforge.net/nmailserver/?rev=110&view=rev
Author: tmyroadctfig
Date: 2007-01-08 04:58:59 -0800 (Mon, 08 Jan 2007)
Log Message:
-----------
Added web access references.
Modified Paths:
--------------
NMail/trunk/NMail.WebAccess/App_WebReferences/RemoteAccessService/RemoteAccessService.wsdl
Added Paths:
-----------
NMail/trunk/NMail.WebAccess/Bin/NMail.LocalStore.dll.refresh
NMail/trunk/NMail.WebAccess/Bin/NMail.dll.refresh
Removed Paths:
-------------
NMail/trunk/NMail.WebAccess/Bin/NMail.RemoteAccessService.Serializers.dll.refresh
Property Changed:
----------------
NMail/trunk/NMail.WebAccess/Bin/
Modified: NMail/trunk/NMail.WebAccess/App_WebReferences/RemoteAccessService/RemoteAccessService.wsdl
===================================================================
--- NMail/trunk/NMail.WebAccess/App_WebReferences/RemoteAccessService/RemoteAccessService.wsdl 2007-01-08 12:56:49 UTC (rev 109)
+++ NMail/trunk/NMail.WebAccess/App_WebReferences/RemoteAccessService/RemoteAccessService.wsdl 2007-01-08 12:58:59 UTC (rev 110)
@@ -2,7 +2,6 @@
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://nmailserver.sf.net/RemoteAccessService/1.0" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://nmailserver.sf.net/RemoteAccessService/1.0" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://nmailserver.sf.net/RemoteAccessService/1.0">
- <s:import namespace="http://www.w3.org/2001/XMLSchema" />
<s:element name="Authenticate">
<s:complexType>
<s:sequence>
@@ -28,17 +27,38 @@
<s:element name="GetNominalFolderResponse">
<s:complexType>
<s:sequence>
- <s:element minOccurs="0" maxOccurs="1" name="GetNominalFolderResult">
- <s:complexType>
- <s:sequence>
- <s:element ref="s:schema" />
- <s:any />
- </s:sequence>
- </s:complexType>
- </s:element>
+ <s:element minOccurs="1" maxOccurs="1" name="StoreFolder" nillable="true" type="tns:StoreFolderSerializer" />
</s:sequence>
</s:complexType>
</s:element>
+ <s:complexType name="StoreFolderSerializer">
+ <s:sequence>
+ <s:element minOccurs="1" maxOccurs="1" name="FolderId" type="s:int" />
+ <s:element minOccurs="0" maxOccurs="1" name="Name" type="s:string" />
+ <s:element minOccurs="0" maxOccurs="1" name="NameSpace" type="s:string" />
+ <s:element minOccurs="1" maxOccurs="1" name="HasChildren" type="s:boolean" />
+ <s:element minOccurs="1" maxOccurs="1" name="ParentId" nillable="true" type="s:int" />
+ </s:sequence>
+ </s:complexType>
+ <s:element name="GetSubscribedFolders">
+ <s:complexType>
+ <s:sequence>
+ <s:element minOccurs="0" maxOccurs="1" name="authToken" type="s:string" />
+ </s:sequence>
+ </s:complexType>
+ </s:element>
+ <s:element name="GetSubscribedFoldersResponse">
+ <s:complexType>
+ <s:sequence>
+ <s:element minOccurs="0" maxOccurs="1" name="GetSubscribedFoldersResult" type="tns:ArrayOfStoreFolderSerializer" />
+ </s:sequence>
+ </s:complexType>
+ </s:element>
+ <s:complexType name="ArrayOfStoreFolderSerializer">
+ <s:sequence>
+ <s:element minOccurs="0" maxOccurs="unbounded" name="StoreFolderSerializer" nillable="true" type="tns:StoreFolderSerializer" />
+ </s:sequence>
+ </s:complexType>
</s:schema>
</wsdl:types>
<wsdl:message name="AuthenticateSoapIn">
@@ -53,6 +73,12 @@
<wsdl:message name="GetNominalFolderSoapOut">
<wsdl:part name="parameters" element="tns:GetNominalFolderResponse" />
</wsdl:message>
+ <wsdl:message name="GetSubscribedFoldersSoapIn">
+ <wsdl:part name="parameters" element="tns:GetSubscribedFolders" />
+ </wsdl:message>
+ <wsdl:message name="GetSubscribedFoldersSoapOut">
+ <wsdl:part name="parameters" element="tns:GetSubscribedFoldersResponse" />
+ </wsdl:message>
<wsdl:portType name="RemoteAccessServiceSoap">
<wsdl:operation name="Authenticate">
<wsdl:input message="tns:AuthenticateSoapIn" />
@@ -62,6 +88,10 @@
<wsdl:input message="tns:GetNominalFolderSoapIn" />
<wsdl:output message="tns:GetNominalFolderSoapOut" />
</wsdl:operation>
+ <wsdl:operation name="GetSubscribedFolders">
+ <wsdl:input message="tns:GetSubscribedFoldersSoapIn" />
+ <wsdl:output message="tns:GetSubscribedFoldersSoapOut" />
+ </wsdl:operation>
</wsdl:portType>
<wsdl:binding name="RemoteAccessServiceSoap" type="tns:RemoteAccessServiceSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
@@ -83,6 +113,15 @@
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
+ <wsdl:operation name="GetSubscribedFolders">
+ <soap:operation soapAction="http://nmailserver.sf.net/RemoteAccessService/1.0/GetSubscribedFolders" style="document" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
</wsdl:binding>
<wsdl:binding name="RemoteAccessServiceSoap12" type="tns:RemoteAccessServiceSoap">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
@@ -104,6 +143,15 @@
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
+ <wsdl:operation name="GetSubscribedFolders">
+ <soap12:operation soapAction="http://nmailserver.sf.net/RemoteAccessService/1.0/GetSubscribedFolders" style="document" />
+ <wsdl:input>
+ <soap12:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap12:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
</wsdl:binding>
<wsdl:service name="RemoteAccessService">
<wsdl:port name="RemoteAccessServiceSoap" binding="tns:RemoteAccessServiceSoap">
Property changes on: NMail/trunk/NMail.WebAccess/Bin
___________________________________________________________________
Name: svn:ignore
- log4net.dll
NMail.dll
NMail.RemoteAccessService.Serializers.dll
NMail.RemoteAccessService.Serializers.pdb
+ log4net.dll
NMail.dll
NMail.RemoteAccessService.Serializers.dll
NMail.RemoteAccessService.Serializers.pdb
NMail.LocalStore.dll
Added: NMail/trunk/NMail.WebAccess/Bin/NMail.LocalStore.dll.refresh
===================================================================
(Binary files differ)
Property changes on: NMail/trunk/NMail.WebAccess/Bin/NMail.LocalStore.dll.refresh
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: NMail/trunk/NMail.WebAccess/Bin/NMail.RemoteAccessService.Serializers.dll.refresh
===================================================================
(Binary files differ)
Added: NMail/trunk/NMail.WebAccess/Bin/NMail.dll.refresh
===================================================================
(Binary files differ)
Property changes on: NMail/trunk/NMail.WebAccess/Bin/NMail.dll.refresh
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tmy...@us...> - 2007-01-08 12:56:49
|
Revision: 109
http://svn.sourceforge.net/nmailserver/?rev=109&view=rev
Author: tmyroadctfig
Date: 2007-01-08 04:56:49 -0800 (Mon, 08 Jan 2007)
Log Message:
-----------
Fixed defect in assigning next delivery attempt.
Modified Paths:
--------------
NMail/trunk/NMail/DataTypes/Spool/SpoolRecipient.cs
Modified: NMail/trunk/NMail/DataTypes/Spool/SpoolRecipient.cs
===================================================================
--- NMail/trunk/NMail/DataTypes/Spool/SpoolRecipient.cs 2007-01-08 12:54:11 UTC (rev 108)
+++ NMail/trunk/NMail/DataTypes/Spool/SpoolRecipient.cs 2007-01-08 12:56:49 UTC (rev 109)
@@ -35,7 +35,7 @@
public SpoolRecipient(EmailAddress address, int recipientId, DateTime nextDelivery, int deliveryAttempts) {
this.address = address;
this.recipientId = recipientId;
- this.nextDeliveryAttempt = nextDeliveryAttempt;
+ this.nextDeliveryAttempt = nextDelivery;
this.deliveryAttempts = deliveryAttempts;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tmy...@us...> - 2007-01-08 12:54:11
|
Revision: 108
http://svn.sourceforge.net/nmailserver/?rev=108&view=rev
Author: tmyroadctfig
Date: 2007-01-08 04:54:11 -0800 (Mon, 08 Jan 2007)
Log Message:
-----------
Changed to work with webservices. Work on remote access webservice.
Modified Paths:
--------------
NMail/trunk/NMail.RemoteAccessService/App_Code/RemoteAccessService.cs
NMail/trunk/NMail.RemoteAccessService.Serializers/DataTypes/LocalStore/StoreFolderSerializer.cs
Modified: NMail/trunk/NMail.RemoteAccessService/App_Code/RemoteAccessService.cs
===================================================================
--- NMail/trunk/NMail.RemoteAccessService/App_Code/RemoteAccessService.cs 2007-01-03 01:49:14 UTC (rev 107)
+++ NMail/trunk/NMail.RemoteAccessService/App_Code/RemoteAccessService.cs 2007-01-08 12:54:11 UTC (rev 108)
@@ -63,8 +63,23 @@
}
[WebMethod]
- public void DoSomething(StoreFolderSerializer folder)
+ public List<StoreFolderSerializer> GetSubscribedFolders(string authToken)
{
+ IAuthenticationToken token = ValidateAuthenticationToken(authToken);
+ if (token != null)
+ {
+ List<StoreFolder> subscribed = new List<StoreFolder>(ServiceState.remoteAdmin.NMailServer.LocalStore.GetSubscribed(token, "*"));
+ List<StoreFolderSerializer> result = new List<StoreFolderSerializer>();
+
+ foreach (StoreFolder folder in subscribed)
+ {
+ result.Add(new StoreFolderSerializer(folder));
+ }
+
+ return result;
+ }
+
+ throw new InvalidOperationException("Authentication token is not valid.");
}
protected IAuthenticationToken ValidateAuthenticationToken(string authToken)
Modified: NMail/trunk/NMail.RemoteAccessService.Serializers/DataTypes/LocalStore/StoreFolderSerializer.cs
===================================================================
--- NMail/trunk/NMail.RemoteAccessService.Serializers/DataTypes/LocalStore/StoreFolderSerializer.cs 2007-01-03 01:49:14 UTC (rev 107)
+++ NMail/trunk/NMail.RemoteAccessService.Serializers/DataTypes/LocalStore/StoreFolderSerializer.cs 2007-01-08 12:54:11 UTC (rev 108)
@@ -11,59 +11,61 @@
/// A simple XML serializer for the store folder type.
/// </summary>
[XmlRoot("StoreFolder")]
- public class StoreFolderSerializer : IXmlSerializable {
+ [SoapType(IncludeInSchema=true, Namespace="http://nmailserver.sf.net/RemoteAccessService/1.0", TypeName="StoreFolder")]
+ public class StoreFolderSerializer {
public StoreFolderSerializer() { }
public StoreFolderSerializer(StoreFolder storeFolder) {
- this.storeFolder = storeFolder;
+ this.folderId = storeFolder.FolderId;
+ this.name = storeFolder.FolderName;
+ this.nameSpace = storeFolder.NameSpace;
+ this.hasChildren = storeFolder.HasChildren;
+ this.parentId = storeFolder.ParentId;
}
- private StoreFolder storeFolder;
+ private int folderId;
- public StoreFolder StoreFolder {
- get { return storeFolder; }
- set { storeFolder = value; }
- }
+ public int FolderId
+ {
+ get { return folderId;}
+ set { folderId = value;}
+ }
+
+ private string name;
- #region IXmlSerializable Members
+ public string Name
+ {
+ get { return name;}
+ set { name = value;}
+ }
+
+ private string nameSpace;
- public System.Xml.Schema.XmlSchema GetSchema() {
- return null;
+ public string NameSpace
+ {
+ get { return nameSpace;}
+ set { nameSpace = value;}
}
- public void ReadXml(XmlReader reader) {
- //reader.ReadStartElement("StoreFolder");
+ private bool hasChildren;
- reader.MoveToAttribute("FolderId");
- int folderId = Int32.Parse(reader.Value);
-
- reader.MoveToAttribute("Name");
- string name = reader.Value;
-
- reader.MoveToAttribute("NameSpace");
- string nameSpace = reader.Value;
-
- int? parentId = null;
- if (reader.MoveToAttribute("ParentId")) {
- parentId = Int32.Parse(reader.Value);
- }
-
- reader.MoveToAttribute("HasChildren");
- bool hasChildren = Boolean.Parse(reader.Value);
-
- this.storeFolder = new StoreFolder(nameSpace, name, folderId, parentId, hasChildren);
+ public bool HasChildren
+ {
+ get { return hasChildren;}
+ set { hasChildren = value;}
}
+
+ private int? parentId;
- public void WriteXml(XmlWriter writer) {
- writer.WriteAttributeString("FolderId", this.storeFolder.FolderId.ToString());
- writer.WriteAttributeString("Name", this.storeFolder.FolderName);
- writer.WriteAttributeString("NameSpace", this.storeFolder.NameSpace);
- writer.WriteAttributeString("HasChildren", this.storeFolder.HasChildren.ToString());
- if (this.storeFolder.ParentId.HasValue) {
- writer.WriteAttributeString("ParentId", this.storeFolder.ParentId.Value.ToString());
- }
+ public int? ParentId
+ {
+ get { return parentId;}
+ set { parentId = value;}
}
- #endregion
+
+ public StoreFolder GetStoreFolder() {
+ return new StoreFolder(this.nameSpace, this.name, this.folderId, this.parentId, this.hasChildren);
+ }
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tmy...@us...> - 2007-01-03 01:49:14
|
Revision: 107
http://svn.sourceforge.net/nmailserver/?rev=107&view=rev
Author: tmyroadctfig
Date: 2007-01-02 17:49:14 -0800 (Tue, 02 Jan 2007)
Log Message:
-----------
Renamed field to avoid hiding inherited field.
Modified Paths:
--------------
NMail/trunk/NMail/DataTypes/Spool/SpoolEnvelope.cs
NMail/trunk/NMail.SpoolData.MySql/MySqlSpoolData.cs
Modified: NMail/trunk/NMail/DataTypes/Spool/SpoolEnvelope.cs
===================================================================
--- NMail/trunk/NMail/DataTypes/Spool/SpoolEnvelope.cs 2007-01-02 12:56:34 UTC (rev 106)
+++ NMail/trunk/NMail/DataTypes/Spool/SpoolEnvelope.cs 2007-01-03 01:49:14 UTC (rev 107)
@@ -56,7 +56,7 @@
/// The Id of this message in the spool.
/// </summary>
/// <remarks>This is different to the Id stored in the message headers.</remarks>
- public int MessageId {
+ public int SpoolMessageId {
get {
return this.messageId;
}
Modified: NMail/trunk/NMail.SpoolData.MySql/MySqlSpoolData.cs
===================================================================
--- NMail/trunk/NMail.SpoolData.MySql/MySqlSpoolData.cs 2007-01-02 12:56:34 UTC (rev 106)
+++ NMail/trunk/NMail.SpoolData.MySql/MySqlSpoolData.cs 2007-01-03 01:49:14 UTC (rev 107)
@@ -539,7 +539,7 @@
// Add the message's recipients
foreach (SpoolEnvelope spoolEnvelope in result) {
- spoolEnvelope.Recipients = getSpoolRecipients(spoolEnvelope.MessageId);
+ spoolEnvelope.Recipients = getSpoolRecipients(spoolEnvelope.SpoolMessageId);
}
return result;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tmy...@us...> - 2007-01-02 12:56:33
|
Revision: 106
http://svn.sourceforge.net/nmailserver/?rev=106&view=rev
Author: tmyroadctfig
Date: 2007-01-02 04:56:34 -0800 (Tue, 02 Jan 2007)
Log Message:
-----------
Added some SSH RFCs.
Added Paths:
-----------
NMail/trunk/doc/RFC/SSH/
NMail/trunk/doc/RFC/SSH/rfc4251_protocol_architecture.txt
NMail/trunk/doc/RFC/SSH/rfc4252_auth_protocol.txt
NMail/trunk/doc/RFC/SSH/rfc4253_transport_layer_protocol.txt
NMail/trunk/doc/RFC/SSH/rfc4254_connection_protocol.txt
NMail/trunk/doc/RFC/SSH/rfc4256.txt
Added: NMail/trunk/doc/RFC/SSH/rfc4251_protocol_architecture.txt
===================================================================
--- NMail/trunk/doc/RFC/SSH/rfc4251_protocol_architecture.txt (rev 0)
+++ NMail/trunk/doc/RFC/SSH/rfc4251_protocol_architecture.txt 2007-01-02 12:56:34 UTC (rev 106)
@@ -0,0 +1,1683 @@
+
+
+
+
+
+
+Network Working Group T. Ylonen
+Request for Comments: 4251 SSH Communications Security Corp
+Category: Standards Track C. Lonvick, Ed.
+ Cisco Systems, Inc.
+ January 2006
+
+
+ The Secure Shell (SSH) Protocol Architecture
+
+Status of This Memo
+
+ This document specifies an Internet standards track protocol for the
+ Internet community, and requests discussion and suggestions for
+ improvements. Please refer to the current edition of the "Internet
+ Official Protocol Standards" (STD 1) for the standardization state
+ and status of this protocol. Distribution of this memo is unlimited.
+
+Copyright Notice
+
+ Copyright (C) The Internet Society (2006).
+
+Abstract
+
+ The Secure Shell (SSH) Protocol is a protocol for secure remote login
+ and other secure network services over an insecure network. This
+ document describes the architecture of the SSH protocol, as well as
+ the notation and terminology used in SSH protocol documents. It also
+ discusses the SSH algorithm naming system that allows local
+ extensions. The SSH protocol consists of three major components: The
+ Transport Layer Protocol provides server authentication,
+ confidentiality, and integrity with perfect forward secrecy. The
+ User Authentication Protocol authenticates the client to the server.
+ The Connection Protocol multiplexes the encrypted tunnel into several
+ logical channels. Details of these protocols are described in
+ separate documents.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Ylonen & Lonvick Standards Track [Page 1]
+
+RFC 4251 SSH Protocol Architecture January 2006
+
+
+Table of Contents
+
+ 1. Introduction ....................................................3
+ 2. Contributors ....................................................3
+ 3. Conventions Used in This Document ...............................4
+ 4. Architecture ....................................................4
+ 4.1. Host Keys ..................................................4
+ 4.2. Extensibility ..............................................6
+ 4.3. Policy Issues ..............................................6
+ 4.4. Security Properties ........................................7
+ 4.5. Localization and Character Set Support .....................7
+ 5. Data Type Representations Used in the SSH Protocols .............8
+ 6. Algorithm and Method Naming ....................................10
+ 7. Message Numbers ................................................11
+ 8. IANA Considerations ............................................12
+ 9. Security Considerations ........................................13
+ 9.1. Pseudo-Random Number Generation ...........................13
+ 9.2. Control Character Filtering ...............................14
+ 9.3. Transport .................................................14
+ 9.3.1. Confidentiality ....................................14
+ 9.3.2. Data Integrity .....................................16
+ 9.3.3. Replay .............................................16
+ 9.3.4. Man-in-the-middle ..................................17
+ 9.3.5. Denial of Service ..................................19
+ 9.3.6. Covert Channels ....................................20
+ 9.3.7. Forward Secrecy ....................................20
+ 9.3.8. Ordering of Key Exchange Methods ...................20
+ 9.3.9. Traffic Analysis ...................................21
+ 9.4. Authentication Protocol ...................................21
+ 9.4.1. Weak Transport .....................................21
+ 9.4.2. Debug Messages .....................................22
+ 9.4.3. Local Security Policy ..............................22
+ 9.4.4. Public Key Authentication ..........................23
+ 9.4.5. Password Authentication ............................23
+ 9.4.6. Host-Based Authentication ..........................23
+ 9.5. Connection Protocol .......................................24
+ 9.5.1. End Point Security .................................24
+ 9.5.2. Proxy Forwarding ...................................24
+ 9.5.3. X11 Forwarding .....................................24
+ 10. References ....................................................26
+ 10.1. Normative References .....................................26
+ 10.2. Informative References ...................................26
+ Authors' Addresses ................................................29
+ Trademark Notice ..................................................29
+
+
+
+
+
+
+
+Ylonen & Lonvick Standards Track [Page 2]
+
+RFC 4251 SSH Protocol Architecture January 2006
+
+
+1. Introduction
+
+ Secure Shell (SSH) is a protocol for secure remote login and other
+ secure network services over an insecure network. It consists of
+ three major components:
+
+ o The Transport Layer Protocol [SSH-TRANS] provides server
+ authentication, confidentiality, and integrity. It may optionally
+ also provide compression. The transport layer will typically be
+ run over a TCP/IP connection, but might also be used on top of any
+ other reliable data stream.
+
+ o The User Authentication Protocol [SSH-USERAUTH] authenticates the
+ client-side user to the server. It runs over the transport layer
+ protocol.
+
+ o The Connection Protocol [SSH-CONNECT] multiplexes the encrypted
+ tunnel into several logical channels. It runs over the user
+ authentication protocol.
+
+ The client sends a service request once a secure transport layer
+ connection has been established. A second service request is sent
+ after user authentication is complete. This allows new protocols to
+ be defined and coexist with the protocols listed above.
+
+ The connection protocol provides channels that can be used for a wide
+ range of purposes. Standard methods are provided for setting up
+ secure interactive shell sessions and for forwarding ("tunneling")
+ arbitrary TCP/IP ports and X11 connections.
+
+2. Contributors
+
+ The major original contributors of this set of documents have been:
+ Tatu Ylonen, Tero Kivinen, Timo J. Rinne, Sami Lehtinen (all of SSH
+ Communications Security Corp), and Markku-Juhani O. Saarinen
+ (University of Jyvaskyla). Darren Moffat was the original editor of
+ this set of documents and also made very substantial contributions.
+
+ Many people contributed to the development of this document over the
+ years. People who should be acknowledged include Mats Andersson, Ben
+ Harris, Bill Sommerfeld, Brent McClure, Niels Moller, Damien Miller,
+ Derek Fawcus, Frank Cusack, Heikki Nousiainen, Jakob Schlyter, Jeff
+ Van Dyke, Jeffrey Altman, Jeffrey Hutzelman, Jon Bright, Joseph
+ Galbraith, Ken Hornstein, Markus Friedl, Martin Forssen, Nicolas
+ Williams, Niels Provos, Perry Metzger, Peter Gutmann, Simon
+ Josefsson, Simon Tatham, Wei Dai, Denis Bider, der Mouse, and
+ Tadayoshi Kohno. Listing their names here does not mean that they
+ endorse this document, but that they have contributed to it.
+
+
+
+Ylonen & Lonvick Standards Track [Page 3]
+
+RFC 4251 SSH Protocol Architecture January 2006
+
+
+3. Conventions Used in This Document
+
+ All documents related to the SSH protocols shall use the keywords
+ "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD",
+ "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" to describe
+ requirements. These keywords are to be interpreted as described in
+ [RFC2119].
+
+ The keywords "PRIVATE USE", "HIERARCHICAL ALLOCATION", "FIRST COME
+ FIRST SERVED", "EXPERT REVIEW", "SPECIFICATION REQUIRED", "IESG
+ APPROVAL", "IETF CONSENSUS", and "STANDARDS ACTION" that appear in
+ this document when used to describe namespace allocation are to be
+ interpreted as described in [RFC2434].
+
+ Protocol fields and possible values to fill them are defined in this
+ set of documents. Protocol fields will be defined in the message
+ definitions. As an example, SSH_MSG_CHANNEL_DATA is defined as
+ follows.
+
+ byte SSH_MSG_CHANNEL_DATA
+ uint32 recipient channel
+ string data
+
+ Throughout these documents, when the fields are referenced, they will
+ appear within single quotes. When values to fill those fields are
+ referenced, they will appear within double quotes. Using the above
+ example, possible values for 'data' are "foo" and "bar".
+
+4. Architecture
+
+4.1. Host Keys
+
+ Each server host SHOULD have a host key. Hosts MAY have multiple
+ host keys using multiple different algorithms. Multiple hosts MAY
+ share the same host key. If a host has keys at all, it MUST have at
+ least one key that uses each REQUIRED public key algorithm (DSS
+ [FIPS-186-2]).
+
+ The server host key is used during key exchange to verify that the
+ client is really talking to the correct server. For this to be
+ possible, the client must have a priori knowledge of the server's
+ public host key.
+
+ Two different trust models can be used:
+
+ o The client has a local database that associates each host name (as
+ typed by the user) with the corresponding public host key. This
+ method requires no centrally administered infrastructure, and no
+
+
+
+Ylonen & Lonvick Standards Track [Page 4]
+
+RFC 4251 SSH Protocol Architecture January 2006
+
+
+ third-party coordination. The downside is that the database of
+ name-to-key associations may become burdensome to maintain.
+
+ o The host name-to-key association is certified by a trusted
+ certification authority (CA). The client only knows the CA root
+ key, and can verify the validity of all host keys certified by
+ accepted CAs.
+
+ The second alternative eases the maintenance problem, since ideally
+ only a single CA key needs to be securely stored on the client. On
+ the other hand, each host key must be appropriately certified by a
+ central authority before authorization is possible. Also, a lot of
+ trust is placed on the central infrastructure.
+
+ The protocol provides the option that the server name - host key
+ association is not checked when connecting to the host for the first
+ time. This allows communication without prior communication of host
+ keys or certification. The connection still provides protection
+ against passive listening; however, it becomes vulnerable to active
+ man-in-the-middle attacks. Implementations SHOULD NOT normally allow
+ such connections by default, as they pose a potential security
+ problem. However, as there is no widely deployed key infrastructure
+ available on the Internet at the time of this writing, this option
+ makes the protocol much more usable during the transition time until
+ such an infrastructure emerges, while still providing a much higher
+ level of security than that offered by older solutions (e.g., telnet
+ [RFC0854] and rlogin [RFC1282]).
+
+ Implementations SHOULD try to make the best effort to check host
+ keys. An example of a possible strategy is to only accept a host key
+ without checking the first time a host is connected, save the key in
+ a local database, and compare against that key on all future
+ connections to that host.
+
+ Implementations MAY provide additional methods for verifying the
+ correctness of host keys, e.g., a hexadecimal fingerprint derived
+ from the SHA-1 hash [FIPS-180-2] of the public key. Such
+ fingerprints can easily be verified by using telephone or other
+ external communication channels.
+
+ All implementations SHOULD provide an option not to accept host keys
+ that cannot be verified.
+
+ The members of this Working Group believe that 'ease of use' is
+ critical to end-user acceptance of security solutions, and no
+ improvement in security is gained if the new solutions are not used.
+ Thus, providing the option not to check the server host key is
+
+
+
+
+Ylonen & Lonvick Standards Track [Page 5]
+
+RFC 4251 SSH Protocol Architecture January 2006
+
+
+ believed to improve the overall security of the Internet, even though
+ it reduces the security of the protocol in configurations where it is
+ allowed.
+
+4.2. Extensibility
+
+ We believe that the protocol will evolve over time, and some
+ organizations will want to use their own encryption, authentication,
+ and/or key exchange methods. Central registration of all extensions
+ is cumbersome, especially for experimental or classified features.
+ On the other hand, having no central registration leads to conflicts
+ in method identifiers, making interoperability difficult.
+
+ We have chosen to identify algorithms, methods, formats, and
+ extension protocols with textual names that are of a specific format.
+ DNS names are used to create local namespaces where experimental or
+ classified extensions can be defined without fear of conflicts with
+ other implementations.
+
+ One design goal has been to keep the base protocol as simple as
+ possible, and to require as few algorithms as possible. However, all
+ implementations MUST support a minimal set of algorithms to ensure
+ interoperability (this does not imply that the local policy on all
+ hosts would necessarily allow these algorithms). The mandatory
+ algorithms are specified in the relevant protocol documents.
+
+ Additional algorithms, methods, formats, and extension protocols can
+ be defined in separate documents. See Section 6, Algorithm Naming,
+ for more information.
+
+4.3. Policy Issues
+
+ The protocol allows full negotiation of encryption, integrity, key
+ exchange, compression, and public key algorithms and formats.
+ Encryption, integrity, public key, and compression algorithms can be
+ different for each direction.
+
+ The following policy issues SHOULD be addressed in the configuration
+ mechanisms of each implementation:
+
+ o Encryption, integrity, and compression algorithms, separately for
+ each direction. The policy MUST specify which is the preferred
+ algorithm (e.g., the first algorithm listed in each category).
+
+ o Public key algorithms and key exchange method to be used for host
+ authentication. The existence of trusted host keys for different
+ public key algorithms also affects this choice.
+
+
+
+
+Ylonen & Lonvick Standards Track [Page 6]
+
+RFC 4251 SSH Protocol Architecture January 2006
+
+
+ o The authentication methods that are to be required by the server
+ for each user. The server's policy MAY require multiple
+ authentication for some or all users. The required algorithms MAY
+ depend on the location from where the user is trying to gain
+ access.
+
+ o The operations that the user is allowed to perform using the
+ connection protocol. Some issues are related to security; for
+ example, the policy SHOULD NOT allow the server to start sessions
+ or run commands on the client machine, and MUST NOT allow
+ connections to the authentication agent unless forwarding such
+ connections has been requested. Other issues, such as which
+ TCP/IP ports can be forwarded and by whom, are clearly issues of
+ local policy. Many of these issues may involve traversing or
+ bypassing firewalls, and are interrelated with the local security
+ policy.
+
+4.4. Security Properties
+
+ The primary goal of the SSH protocol is to improve security on the
+ Internet. It attempts to do this in a way that is easy to deploy,
+ even at the cost of absolute security.
+
+ o All encryption, integrity, and public key algorithms used are
+ well-known, well-established algorithms.
+
+ o All algorithms are used with cryptographically sound key sizes
+ that are believed to provide protection against even the strongest
+ cryptanalytic attacks for decades.
+
+ o All algorithms are negotiated, and in case some algorithm is
+ broken, it is easy to switch to some other algorithm without
+ modifying the base protocol.
+
+ Specific concessions were made to make widespread, fast deployment
+ easier. The particular case where this comes up is verifying that
+ the server host key really belongs to the desired host; the protocol
+ allows the verification to be left out, but this is NOT RECOMMENDED.
+ This is believed to significantly improve usability in the short
+ term, until widespread Internet public key infrastructures emerge.
+
+4.5. Localization and Character Set Support
+
+ For the most part, the SSH protocols do not directly pass text that
+ would be displayed to the user. However, there are some places where
+ such data might be passed. When applicable, the character set for
+
+
+
+
+
+Ylonen & Lonvick Standards Track [Page 7]
+
+RFC 4251 SSH Protocol Architecture January 2006
+
+
+ the data MUST be explicitly specified. In most places, ISO-10646
+ UTF-8 encoding is used [RFC3629]. When applicable, a field is also
+ provided for a language tag [RFC3066].
+
+ One big issue is the character set of the interactive session. There
+ is no clear solution, as different applications may display data in
+ different formats. Different types of terminal emulation may also be
+ employed in the client, and the character set to be used is
+ effectively determined by the terminal emulation. Thus, no place is
+ provided for directly specifying the character set or encoding for
+ terminal session data. However, the terminal emulation type (e.g.,
+ "vt100") is transmitted to the remote site, and it implicitly
+ specifies the character set and encoding. Applications typically use
+ the terminal type to determine what character set they use, or the
+ character set is determined using some external means. The terminal
+ emulation may also allow configuring the default character set. In
+ any case, the character set for the terminal session is considered
+ primarily a client local issue.
+
+ Internal names used to identify algorithms or protocols are normally
+ never displayed to users, and must be in US-ASCII.
+
+ The client and server user names are inherently constrained by what
+ the server is prepared to accept. They might, however, occasionally
+ be displayed in logs, reports, etc. They MUST be encoded using ISO
+ 10646 UTF-8, but other encodings may be required in some cases. It
+ is up to the server to decide how to map user names to accepted user
+ names. Straight bit-wise, binary comparison is RECOMMENDED.
+
+ For localization purposes, the protocol attempts to minimize the
+ number of textual messages transmitted. When present, such messages
+ typically relate to errors, debugging information, or some externally
+ configured data. For data that is normally displayed, it SHOULD be
+ possible to fetch a localized message instead of the transmitted
+ message by using a numerical code. The remaining messages SHOULD be
+ configurable.
+
+5. Data Type Representations Used in the SSH Protocols
+
+ byte
+
+ A byte represents an arbitrary 8-bit value (octet). Fixed length
+ data is sometimes represented as an array of bytes, written
+ byte[n], where n is the number of bytes in the array.
+
+
+
+
+
+
+
+Ylonen & Lonvick Standards Track [Page 8]
+
+RFC 4251 SSH Protocol Architecture January 2006
+
+
+ boolean
+
+ A boolean value is stored as a single byte. The value 0
+ represents FALSE, and the value 1 represents TRUE. All non-zero
+ values MUST be interpreted as TRUE; however, applications MUST NOT
+ store values other than 0 and 1.
+
+ uint32
+
+ Represents a 32-bit unsigned integer. Stored as four bytes in the
+ order of decreasing significance (network byte order). For
+ example: the value 699921578 (0x29b7f4aa) is stored as 29 b7 f4
+ aa.
+
+ uint64
+
+ Represents a 64-bit unsigned integer. Stored as eight bytes in
+ the order of decreasing significance (network byte order).
+
+ string
+
+ Arbitrary length binary string. Strings are allowed to contain
+ arbitrary binary data, including null characters and 8-bit
+ characters. They are stored as a uint32 containing its length
+ (number of bytes that follow) and zero (= empty string) or more
+ bytes that are the value of the string. Terminating null
+ characters are not used.
+
+ Strings are also used to store text. In that case, US-ASCII is
+ used for internal names, and ISO-10646 UTF-8 for text that might
+ be displayed to the user. The terminating null character SHOULD
+ NOT normally be stored in the string. For example: the US-ASCII
+ string "testing" is represented as 00 00 00 07 t e s t i n g. The
+ UTF-8 mapping does not alter the encoding of US-ASCII characters.
+
+ mpint
+
+ Represents multiple precision integers in two's complement format,
+ stored as a string, 8 bits per byte, MSB first. Negative numbers
+ have the value 1 as the most significant bit of the first byte of
+ the data partition. If the most significant bit would be set for
+ a positive number, the number MUST be preceded by a zero byte.
+ Unnecessary leading bytes with the value 0 or 255 MUST NOT be
+ included. The value zero MUST be stored as a string with zero
+ bytes of data.
+
+ By convention, a number that is used in modular computations in
+ Z_n SHOULD be represented in the range 0 <= x < n.
+
+
+
+Ylonen & Lonvick Standards Track [Page 9]
+
+RFC 4251 SSH Protocol Architecture January 2006
+
+
+ Examples:
+
+ value (hex) representation (hex)
+ ----------- --------------------
+ 0 00 00 00 00
+ 9a378f9b2e332a7 00 00 00 08 09 a3 78 f9 b2 e3 32 a7
+ 80 00 00 00 02 00 80
+ -1234 00 00 00 02 ed cc
+ -deadbeef 00 00 00 05 ff 21 52 41 11
+
+ name-list
+
+ A string containing a comma-separated list of names. A name-list
+ is represented as a uint32 containing its length (number of bytes
+ that follow) followed by a comma-separated list of zero or more
+ names. A name MUST have a non-zero length, and it MUST NOT
+ contain a comma (","). As this is a list of names, all of the
+ elements contained are names and MUST be in US-ASCII. Context may
+ impose additional restrictions on the names. For example, the
+ names in a name-list may have to be a list of valid algorithm
+ identifiers (see Section 6 below), or a list of [RFC3066] language
+ tags. The order of the names in a name-list may or may not be
+ significant. Again, this depends on the context in which the list
+ is used. Terminating null characters MUST NOT be used, neither
+ for the individual names, nor for the list as a whole.
+
+ Examples:
+
+ value representation (hex)
+ ----- --------------------
+ (), the empty name-list 00 00 00 00
+ ("zlib") 00 00 00 04 7a 6c 69 62
+ ("zlib,none") 00 00 00 09 7a 6c 69 62 2c 6e 6f 6e 65
+
+6. Algorithm and Method Naming
+
+ The SSH protocols refer to particular hash, encryption, integrity,
+ compression, and key exchange algorithms or methods by name. There
+ are some standard algorithms and methods that all implementations
+ MUST support. There are also algorithms and methods that are defined
+ in the protocol specification, but are OPTIONAL. Furthermore, it is
+ expected that some organizations will want to use their own
+ algorithms or methods.
+
+ In this protocol, all algorithm and method identifiers MUST be
+ printable US-ASCII, non-empty strings no longer than 64 characters.
+ Names MUST be case-sensitive.
+
+
+
+
+Ylonen & Lonvick Standards Track [Page 10]
+
+RFC 4251 SSH Protocol Architecture January 2006
+
+
+ There are two formats for algorithm and method names:
+
+ o Names that do not contain an at-sign ("@") are reserved to be
+ assigned by IETF CONSENSUS. Examples include "3des-cbc", "sha-1",
+ "hmac-sha1", and "zlib" (the doublequotes are not part of the
+ name). Names of this format are only valid if they are first
+ registered with the IANA. Registered names MUST NOT contain an
+ at-sign ("@"), comma (","), whitespace, control characters (ASCII
+ codes 32 or less), or the ASCII code 127 (DEL). Names are case-
+ sensitive, and MUST NOT be longer than 64 characters.
+
+ o Anyone can define additional algorithms or methods by using names
+ in the format name@domainname, e.g., "our...@ex...".
+ The format of the part preceding the at-sign is not specified;
+ however, these names MUST be printable US-ASCII strings, and MUST
+ NOT contain the comma character (","), whitespace, control
+ characters (ASCII codes 32 or less), or the ASCII code 127 (DEL).
+ They MUST have only a single at-sign in them. The part following
+ the at-sign MUST be a valid, fully qualified domain name [RFC1034]
+ controlled by the person or organization defining the name. Names
+ are case-sensitive, and MUST NOT be longer than 64 characters. It
+ is up to each domain how it manages its local namespace. It
+ should be noted that these names resemble STD 11 [RFC0822] email
+ addresses. This is purely coincidental and has nothing to do with
+ STD 11 [RFC0822].
+
+7. Message Numbers
+
+ SSH packets have message numbers in the range 1 to 255. These
+ numbers have been allocated as follows:
+
+ Transport layer protocol:
+
+ 1 to 19 Transport layer generic (e.g., disconnect, ignore,
+ debug, etc.)
+ 20 to 29 Algorithm negotiation
+ 30 to 49 Key exchange method specific (numbers can be reused
+ for different authentication methods)
+
+ User authentication protocol:
+
+ 50 to 59 User authentication generic
+ 60 to 79 User authentication method specific (numbers can be
+ reused for different authentication methods)
+
+
+
+
+
+
+
+Ylonen & Lonvick Standards Track [Page 11]
+
+RFC 4251 SSH Protocol Architecture January 2006
+
+
+ Connection protocol:
+
+ 80 to 89 Connection protocol generic
+ 90 to 127 Channel related messages
+
+ Reserved for client protocols:
+
+ 128 to 191 Reserved
+
+ Local extensions:
+
+ 192 to 255 Local extensions
+
+8. IANA Considerations
+
+ This document is part of a set. The instructions for the IANA for
+ the SSH protocol, as defined in this document, [SSH-USERAUTH],
+ [SSH-TRANS], and [SSH-CONNECT], are detailed in [SSH-NUMBERS]. The
+ following is a brief summary for convenience, but note well that
+ [SSH-NUMBERS] contains the actual instructions to the IANA, which may
+ be superseded in the future.
+
+ Allocation of the following types of names in the SSH protocols is
+ assigned by IETF consensus:
+
+ o Service Names
+ * Authentication Methods
+ * Connection Protocol Channel Names
+ * Connection Protocol Global Request Names
+ * Connection Protocol Channel Request Names
+
+ o Key Exchange Method Names
+
+ o Assigned Algorithm Names
+ * Encryption Algorithm Names
+ * MAC Algorithm Names
+ * Public Key Algorithm Names
+ * Compression Algorithm Names
+
+ These names MUST be printable US-ASCII strings, and MUST NOT contain
+ the characters at-sign ("@"), comma (","), whitespace, control
+ characters (ASCII codes 32 or less), or the ASCII code 127 (DEL).
+ Names are case-sensitive, and MUST NOT be longer than 64 characters.
+
+ Names with the at-sign ("@") are locally defined extensions and are
+ not controlled by the IANA.
+
+
+
+
+
+Ylonen & Lonvick Standards Track [Page 12]
+
+RFC 4251 SSH Protocol Architecture January 2006
+
+
+ Each category of names listed above has a separate namespace.
+ However, using the same name in multiple categories SHOULD be avoided
+ to minimize confusion.
+
+ Message numbers (see Section 7) in the range of 0 to 191 are
+ allocated via IETF CONSENSUS, as described in [RFC2434]. Message
+ numbers in the 192 to 255 range (local extensions) are reserved for
+ PRIVATE USE, also as described in [RFC2434].
+
+9. Security Considerations
+
+ In order to make the entire body of Security Considerations more
+ accessible, Security Considerations for the transport,
+ authentication, and connection documents have been gathered here.
+
+ The transport protocol [SSH-TRANS] provides a confidential channel
+ over an insecure network. It performs server host authentication,
+ key exchange, encryption, and integrity protection. It also derives
+ a unique session id that may be used by higher-level protocols.
+
+ The authentication protocol [SSH-USERAUTH] provides a suite of
+ mechanisms that can be used to authenticate the client user to the
+ server. Individual mechanisms specified in the authentication
+ protocol use the session id provided by the transport protocol and/or
+ depend on the security and integrity guarantees of the transport
+ protocol.
+
+ The connection protocol [SSH-CONNECT] specifies a mechanism to
+ multiplex multiple streams (channels) of data over the confidential
+ and authenticated transport. It also specifies channels for
+ accessing an interactive shell, for proxy-forwarding various external
+ protocols over the secure transport (including arbitrary TCP/IP
+ protocols), and for accessing secure subsystems on the server host.
+
+9.1. Pseudo-Random Number Generation
+
+ This protocol binds each session key to the session by including
+ random, session specific data in the hash used to produce session
+ keys. Special care should be taken to ensure that all of the random
+ numbers are of good quality. If the random data here (e.g., Diffie-
+ Hellman (DH) parameters) are pseudo-random, then the pseudo-random
+ number generator should be cryptographically secure (i.e., its next
+ output not easily guessed even when knowing all previous outputs)
+ and, furthermore, proper entropy needs to be added to the pseudo-
+ random number generator. [RFC4086] offers suggestions for sources of
+ random numbers and entropy. Implementers should note the importance
+ of entropy and the well-meant, anecdotal warning about the difficulty
+ in properly implementing pseudo-random number generating functions.
+
+
+
+Ylonen & Lonvick Standards Track [Page 13]
+
+RFC 4251 SSH Protocol Architecture January 2006
+
+
+ The amount of entropy available to a given client or server may
+ sometimes be less than what is required. In this case, one must
+ either resort to pseudo-random number generation regardless of
+ insufficient entropy or refuse to run the protocol. The latter is
+ preferable.
+
+9.2. Control Character Filtering
+
+ When displaying text to a user, such as error or debug messages, the
+ client software SHOULD replace any control characters (except tab,
+ carriage return, and newline) with safe sequences to avoid attacks by
+ sending terminal control characters.
+
+9.3. Transport
+
+9.3.1. Confidentiality
+
+ It is beyond the scope of this document and the Secure Shell Working
+ Group to analyze or recommend specific ciphers other than the ones
+ that have been established and accepted within the industry. At the
+ time of this writing, commonly used ciphers include 3DES, ARCFOUR,
+ twofish, serpent, and blowfish. AES has been published by The US
+ Federal Information Processing Standards as [FIPS-197], and the
+ cryptographic community has accepted AES as well. As always,
+ implementers and users should check current literature to ensure that
+ no recent vulnerabilities have been found in ciphers used within
+ products. Implementers should also check to see which ciphers are
+ considered to be relatively stronger than others and should recommend
+ their use to users over relatively weaker ciphers. It would be
+ considered good form for an implementation to politely and
+ unobtrusively notify a user that a stronger cipher is available and
+ should be used when a weaker one is actively chosen.
+
+ The "none" cipher is provided for debugging and SHOULD NOT be used
+ except for that purpose. Its cryptographic properties are
+ sufficiently described in [RFC2410], which will show that its use
+ does not meet the intent of this protocol.
+
+ The relative merits of these and other ciphers may also be found in
+ current literature. Two references that may provide information on
+ the subject are [SCHNEIER] and [KAUFMAN]. Both of these describe the
+ CBC mode of operation of certain ciphers and the weakness of this
+ scheme. Essentially, this mode is theoretically vulnerable to chosen
+ cipher-text attacks because of the high predictability of the start
+ of packet sequence. However, this attack is deemed difficult and not
+ considered fully practicable, especially if relatively long block
+ sizes are used.
+
+
+
+
+Ylonen & Lonvick Standards Track [Page 14]
+
+RFC 4251 SSH Protocol Architecture January 2006
+
+
+ Additionally, another CBC mode attack may be mitigated through the
+ insertion of packets containing SSH_MSG_IGNORE. Without this
+ technique, a specific attack may be successful. For this attack
+ (commonly known as the Rogaway attack [ROGAWAY], [DAI], [BELLARE]) to
+ work, the attacker would need to know the Initialization Vector (IV)
+ of the next block that is going to be encrypted. In CBC mode that is
+ the output of the encryption of the previous block. If the attacker
+ does not have any way to see the packet yet (i.e., it is in the
+ internal buffers of the SSH implementation or even in the kernel),
+ then this attack will not work. If the last packet has been sent out
+ to the network (i.e., the attacker has access to it), then he can use
+ the attack.
+
+ In the optimal case, an implementer would need to add an extra packet
+ only if the packet has been sent out onto the network and there are
+ no other packets waiting for transmission. Implementers may wish to
+ check if there are any unsent packets awaiting transmission;
+ unfortunately, it is not normally easy to obtain this information
+ from the kernel or buffers. If there are no unsent packets, then a
+ packet containing SSH_MSG_IGNORE SHOULD be sent. If a new packet is
+ added to the stream every time the attacker knows the IV that is
+ supposed to be used for the next packet, then the attacker will not
+ be able to guess the correct IV, thus the attack will never be
+ successful.
+
+ As an example, consider the following case:
+
+ Client Server
+ ------ ------
+ TCP(seq=x, len=500) ---->
+ contains Record 1
+
+ [500 ms passes, no ACK]
+
+ TCP(seq=x, len=1000) ---->
+ contains Records 1,2
+
+ ACK
+
+ 1. The Nagle algorithm + TCP retransmits mean that the two records
+ get coalesced into a single TCP segment.
+
+ 2. Record 2 is not at the beginning of the TCP segment and never will
+ be because it gets ACKed.
+
+ 3. Yet, the attack is possible because Record 1 has already been
+ seen.
+
+
+
+
+Ylonen & Lonvick Standards Track [Page 15]
+
+RFC 4251 SSH Protocol Architecture January 2006
+
+
+ As this example indicates, it is unsafe to use the existence of
+ unflushed data in the TCP buffers proper as a guide to whether an
+ empty packet is needed, since when the second write() is performed
+ the buffers will contain the un-ACKed Record 1.
+
+ On the other hand, it is perfectly safe to have the following
+ situation:
+
+ Client Server
+ ------ ------
+ TCP(seq=x, len=500) ---->
+ contains SSH_MSG_IGNORE
+
+ TCP(seq=y, len=500) ---->
+ contains Data
+
+ Provided that the IV for the second SSH Record is fixed after the
+ data for the Data packet is determined, then the following should
+ be performed:
+
+ read from user
+ encrypt null packet
+ encrypt data packet
+
+9.3.2. Data Integrity
+
+ This protocol does allow the Data Integrity mechanism to be disabled.
+ Implementers SHOULD be wary of exposing this feature for any purpose
+ other than debugging. Users and administrators SHOULD be explicitly
+ warned anytime the "none" MAC is enabled.
+
+ So long as the "none" MAC is not used, this protocol provides data
+ integrity.
+
+ Because MACs use a 32-bit sequence number, they might start to leak
+ information after 2**32 packets have been sent. However, following
+ the rekeying recommendations should prevent this attack. The
+ transport protocol [SSH-TRANS] recommends rekeying after one gigabyte
+ of data, and the smallest possible packet is 16 bytes. Therefore,
+ rekeying SHOULD happen after 2**28 packets at the very most.
+
+9.3.3. Replay
+
+ The use of a MAC other than "none" provides integrity and
+ authentication. In addition, the transport protocol provides a
+ unique session identifier (bound in part to pseudo-random data that
+ is part of the algorithm and key exchange process) that can be used
+ by higher level protocols to bind data to a given session and prevent
+
+
+
+Ylonen & Lonvick Standards Track [Page 16]
+
+RFC 4251 SSH Protocol Architecture January 2006
+
+
+ replay of data from prior sessions. For example, the authentication
+ protocol ([SSH-USERAUTH]) uses this to prevent replay of signatures
+ from previous sessions. Because public key authentication exchanges
+ are cryptographically bound to the session (i.e., to the initial key
+ exchange), they cannot be successfully replayed in other sessions.
+ Note that the session id can be made public without harming the
+ security of the protocol.
+
+ If two sessions have the same session id (hash of key exchanges),
+ then packets from one can be replayed against the other. It must be
+ stressed that the chances of such an occurrence are, needless to say,
+ minimal when using modern cryptographic methods. This is all the
+ more true when specifying larger hash function outputs and DH
+ parameters.
+
+ Replay detection using monotonically increasing sequence numbers as
+ input to the MAC, or HMAC in some cases, is described in [RFC2085],
+ [RFC2246], [RFC2743], [RFC1964], [RFC2025], and [RFC4120]. The
+ underlying construct is discussed in [RFC2104]. Essentially, a
+ different sequence number in each packet ensures that at least this
+ one input to the MAC function will be unique and will provide a
+ nonrecurring MAC output that is not predictable to an attacker. If
+ the session stays active long enough, however, this sequence number
+ will wrap. This event may provide an attacker an opportunity to
+ replay a previously recorded packet with an identical sequence number
+ but only if the peers have not rekeyed since the transmission of the
+ first packet with that sequence number. If the peers have rekeyed,
+ then the replay will be detected since the MAC check will fail. For
+ this reason, it must be emphasized that peers MUST rekey before a
+ wrap of the sequence numbers. Naturally, if an attacker does attempt
+ to replay a captured packet before the peers have rekeyed, then the
+ receiver of the duplicate packet will not be able to validate the MAC
+ and it will be discarded. The reason that the MAC will fail is
+ because the receiver will formulate a MAC based upon the packet
+ contents, the shared secret, and the expected sequence number. Since
+ the replayed packet will not be using that expected sequence number
+ (the sequence number of the replayed packet will have already been
+ passed by the receiver), the calculated MAC will not match the MAC
+ received with the packet.
+
+9.3.4. Man-in-the-middle
+
+ This protocol makes no assumptions or provisions for an
+ infrastructure or means for distributing the public keys of hosts.
+ It is expected that this protocol will sometimes be used without
+ first verifying the association between the server host key and the
+ server host name. Such usage is vulnerable to man-in-the-middle
+ attacks. This section describes this and encourages administrators
+
+
+
+Ylonen & Lonvick Standards Track [Page 17]
+
+RFC 4251 SSH Protocol Architecture January 2006
+
+
+ and users to understand the importance of verifying this association
+ before any session is initiated.
+
+ There are three cases of man-in-the-middle attacks to consider. The
+ first is where an attacker places a device between the client and the
+ server before the session is initiated. In this case, the attack
+ device is trying to mimic the legitimate server and will offer its
+ public key to the client when the client initiates a session. If it
+ were to offer the public key of the server, then it would not be able
+ to decrypt or sign the transmissions between the legitimate server
+ and the client unless it also had access to the private key of the
+ host. The attack device will also, simultaneously to this, initiate
+ a session to the legitimate server, masquerading itself as the
+ client. If the public key of the server had been securely
+ distributed to the client prior to that session initiation, the key
+ offered to the client by the attack device will not match the key
+ stored on the client. In that case, the user SHOULD be given a
+ warning that the offered host key does not match the host key cached
+ on the client. As described in Section 4.1, the user may be free to
+ accept the new key and continue the session. It is RECOMMENDED that
+ the warning provide sufficient information to the user of the client
+ device so the user may make an informed decision. If the user
+ chooses to continue the session with the stored public key of the
+ server (not the public key offered at the start of the session), then
+ the session-specific data between the attacker and server will be
+ different between the client-to-attacker session and the attacker-
+ to-server sessions due to the randomness discussed above. From this,
+ the attacker will not be able to make this attack work since the
+ attacker will not be able to correctly sign packets containing this
+ session-specific data from the server, since he does not have the
+ private key of that server.
+
+ The second case that should be considered is similar to the first
+ case in that it also happens at the time of connection, but this case
+ points out the need for the secure distribution of server public
+ keys. If the server public keys are not securely distributed, then
+ the client cannot know if it is talking to the intended server. An
+ attacker may use social engineering techniques to pass off server
+ keys to unsuspecting users and may then place a man-in-the-middle
+ attack device between the legitimate server and the clients. If this
+ is allowed to happen, then the clients will form client-to-attacker
+ sessions, and the attacker will form attacker-to-server sessions and
+ will be able to monitor and manipulate all of the traffic between the
+ clients and the legitimate servers. Server administrators are
+ encouraged to make host key fingerprints available for checking by
+ some means whose security does not rely on the integrity of the
+ actual host keys. Possible mechanisms are discussed in Section 4.1
+ and may also include secured Web pages, physical pieces of paper,
+
+
+
+Ylonen & Lonvick Standards Track [Page 18]
+
+RFC 4251 SSH Protocol Architecture January 2006
+
+
+ etc. Implementers SHOULD provide recommendations on how best to do
+ this with their implementation. Because the protocol is extensible,
+ future extensions to the protocol may provide better mechanisms for
+ dealing with the need to know the server's host key before
+ connecting. For example, making the host key fingerprint available
+ through a secure DNS lookup, or using Kerberos ([RFC4120]) over
+ GSS-API ([RFC1964]) during key exchange to authenticate the server
+ are possibilities.
+
+ In the third man-in-the-middle case, attackers may attempt to
+ manipulate packets in transit between peers after the session has
+ been established. As described in Section 9.3.3, a successful attack
+ of this nature is very improbable. As in Section 9.3.3, this
+ reasoning does assume that the MAC is secure and that it is
+ infeasible to construct inputs to a MAC algorithm to give a known
+ output. This is discussed in much greater detail in Section 6 of
+ [RFC2104]. If the MAC algorithm has a vulnerability or is weak
+ enough, then the attacker may be able to specify certain inputs to
+ yield a known MAC. With that, they may be able to alter the contents
+ of a packet in transit. Alternatively, the attacker may be able to
+ exploit the algorithm vulnerability or weakness to find the shared
+ secret by reviewing the MACs from captured packets. In either of
+ those cases, an attacker could construct a packet or packets that
+ could be inserted into an SSH stream. To prevent this, implementers
+ are encouraged to utilize commonly accepted MAC algorithms, and
+ administrators are encouraged to watch current literature and
+ discussions of cryptography to ensure that they are not using a MAC
+ algorithm that has a recently found vulnerability or weakness.
+
+ In summary, the use of this protocol without a reliable association
+ of the binding between a host and its host keys is inherently
+ insecure and is NOT RECOMMENDED. However, it may be necessary in
+ non-security-critical environments, and will still provide protection
+ against passive attacks. Implementers of protocols and applications
+ running on top of this protocol should keep this possibility in mind.
+
+9.3.5. Denial of Service
+
+ This protocol is designed to be used over a reliable transport. If
+ transmission errors or message manipulation occur, the connection is
+ closed. The connection SHOULD be re-established if this occurs.
+ Denial of service attacks of this type (wire cutter) are almost
+ impossible to avoid.
+
+ In addition, this protocol is vulnerable to denial of service attacks
+ because an attacker can force the server to go through the CPU and
+ memory intensive tasks of connection setup and key exchange without
+ authenticating. Implementers SHOULD provide features that make this
+
+
+
+Ylonen & Lonvick Standards Track [Page 19]
+
+RFC 4251 SSH Protocol Architecture January 2006
+
+
+ more difficult, for example, only allowing connections from a subset
+ of clients known to have valid users.
+
+9.3.6. Covert Channels
+
+ The protocol was not designed to eliminate covert channels. For
+ example, the padding, SSH_MSG_IGNORE messages, and several other
+ places in the protocol can be used to pass covert information, and
+ the recipient has no reliable way of verifying whether such
+ information is being sent.
+
+9.3.7. Forward Secrecy
+
+ It should be noted that the Diffie-Hellman key exchanges may provide
+ perfect forward secrecy (PFS). PFS is essentially defined as the
+ cryptographic property of a key-establishment protocol in which the
+ compromise of a session key or long-term private key after a given
+ session does not cause the compromise of any earlier session
+ [ANSI-T1.523-2001]. SSH sessions resulting from a key exchange using
+ the diffie-hellman methods described in the section Diffie-Hellman
+ Key Exchange of [SSH-TRANS] (including "diffie-hellman-group1-sha1"
+ and "diffie-hellman-group14-sha1") are secure even if private
+ keying/authentication material is later revealed, but not if the
+ session keys are revealed. So, given this definition of PFS, SSH
+ does have PFS. However, this property is not commuted to any of the
+ applications or protocols using SSH as a transport. The transport
+ layer of SSH provides confidentiality for password authentication and
+ other methods that rely on secret data.
+
+ Of course, if the DH private parameters for the client and server are
+ revealed, then the session key is revealed, but these items can be
+ thrown away after the key exchange completes. It's worth pointing
+ out that these items should not be allowed to end up on swap space
+ and that they should be erased from memory as soon as the key
+ exchange completes.
+
+9.3.8. Ordering of Key Exchange Methods
+
+ As stated in the section on Algorithm Negotiation of [SSH-TRANS],
+ each device will send a list of preferred methods for key exchange.
+ The most-preferred method is the first in the list. It is
+ RECOMMENDED that the algorithms be sorted by cryptographic strength,
+ strongest first. Some additional guidance for this is given in
+ [RFC3766].
+
+
+
+
+
+
+
+Ylonen & Lonvick Standards Track [Page 20]
+
+RFC 4251 SSH Protocol Architecture January 2006
+
+
+9.3.9. Traffic Analysis
+
+ Passive monitoring of any protocol may give an attacker some
+ information about the session, the user, or protocol specific
+ information that they would otherwise not be able to garner. For
+ example, it has been shown that traffic analysis of an SSH session
+ can yield information about the length of the password - [Openwall]
+ and [USENIX]. Implementers should use the SSH_MSG_IGNORE packet,
+ along with the inclusion of random lengths of padding, to thwart
+ attempts at traffic analysis. Other methods may also be found and
+ implemented.
+
+9.4. Authentication Protocol
+
+ The purpose of this protocol is to perform client user
+ authentication. It assumes that this runs over a secure transport
+ layer protocol, which has already authenticated the server machine,
+ established an encrypted communications channel, and computed a
+ unique session identifier for this session.
+
+ Several authentication methods with different security
+ characteristics are allowed. It is up to the server's local policy
+ to decide which methods (or combinations of methods) it is willing to
+ accept for each user. Authentication is no stronger than the weakest
+ combination allowed.
+
+ The server may go into a sleep period after repeated unsuccessful
+ authentication attempts to make key search more difficult for
+ attackers. Care should be taken so that this doesn't become a self-
+ denial of service vector.
+
+9.4.1. Weak Transport
+
+ If the transport layer does not provide confidentiality,
+ authentication methods that rely on secret data SHOULD be disabled.
+ If it does not provide strong integrity protection, requests to
+ change authentication data (e.g., a password change) SHOULD be
+ disabled to prevent an attacker from modifying the ciphertext without
+ being noticed, or rendering the new authentication data unusable
+ (denial of service).
+
+ The assumption stated above, that the Authentication Protocol only
+ runs over a secure transport that has previously authenticated the
+ server, is very important to note. People deploying SSH are reminded
+ of the consequences of man-in-the-middle attacks if the client does
+ not have a very strong a priori association of the server with the
+ host key of that server. Specifically, for the case of the
+ Authentication Protocol, the client may form a session to a man-in-
+
+
+
+Ylonen & Lonvick Standards Track [Page 21]
+
+RFC 4251 SSH Protocol Architecture January 2006
+
+
+ the-middle attack device and divulge user credentials such as their
+ username and password. Even in the cases of authentication where no
+ user credentials are divulged, an attacker may still gain information
+ they shouldn't have by capturing key-strokes in much the same way
+ that a honeypot works.
+
+9.4.2. Debug Messages
+
+ Special care should be taken when designing debug messages. These
+ messages may reveal surprising amounts of information about the host
+ if not properly designed. Debug messages can be disabled (during
+ user authentication phase) if high security is required.
+ Administrators of host machines should make all attempts to
+ compartmentalize all event notification messages and protect them
+ from unwarranted observation. Developers should be aware of the
+ sensitive nature of some of the normal event and debug messages, and
+ may want to provide guidance to administrators on ways to keep this
+ information away from unauthorized people. Developers should
+ consider minimizing the amount of sensitive information obtainable by
+ users during the authentication phase, in accordance with the local
+ policies. For this reason, it is RECOMMENDED that debug messages be
+ initially disabled at the time of deployment and require an active
+ decision by an administrator to allow them to be enabled. It is also
+ RECOMMENDED that a message expressing this concern be presented to
+ the administrator of a system when the action is taken to enable
+ debugging messages.
+
+9.4.3. Local Security Policy
+
+ The implementer MUST ensure that the credentials provided validate
+ the professed user and also MUST ensure that the local policy of the
+ server permits the user the access requested. In particular, because
+ of the flexible nature of the SSH connection protocol, it may not be
+ possible to determine the local security policy, if any, that should
+ apply at the time of authentication because the kind of service being
+ requested is not clear at that instant. For example, local policy
+ might allow a user to access files on the server, but not start an
+ interactive shell. However, during the authentication protocol, it
+ is not known whether the user will be accessing files, attempting to
+ use an interactive shell, or even both. In any event, where local
+ security policy for the server host exists, it MUST be applied and
+ enforced correctly.
+
+ Implementers are encouraged to provide a default local policy and
+ make its parameters known to administrators and users. At the
+ discretion of the implementers, this default policy may be along the
+ lines of anything-goes where there are no restrictions placed upon
+ users, or it may be along the lines of excessively-restrictive, in
+
+
+
+Ylonen & Lonvick Standards Track [Page 22]
+
+RFC 4251 SSH Protocol Architecture January 2006
+
+
+ which case, the administrators will have to actively make changes to
+ the initial default parameters to meet their needs. Alternatively,
+ it may be some attempt at providing something practical and
+ immediately useful to the administrators of the system so they don't
+ have to put in much effort to get SSH working. Whatever choice is
+ made must be applied and enforced as required above.
+
+9.4.4 Public Key Authentication
+
+ The use of public key authentication assumes that the client host has
+ not been compromised. It also assumes that the private key of the
+ server host has not been compromised.
+
+ This risk can be mitigated by the use of passphrases on private keys;
+ however, this is not an enforceable policy. The use of smartcards,
+ or other technology to make passphrases an enforceable policy is
+ suggested.
+
+ The server could require both password and public key authentication;
+ however, this requires the client to expose its password to the
+ server (see the section on Password Authentication below.)
+
+9.4.5. Password Authentication
+
+ The password mechanism, as specified in the authentication protocol,
+ assumes that the server has not been compromised. If the server has
+ been compromised, using password authentication will reveal a valid
+ username/password combination to the attacker, which may lead to
+ further compromises.
+
+ This vulnerability can be mitigated by using an alternative form of
+ authentication. For example, public key authentication makes no
+ assumptions about security on the server.
+
+9.4.6. Host-Based Authentication
+
+ Host-based authentication assumes that the client has not been
+ compromised. There are no mitigating strategies, other than to use
+ host-based authentication in combination with another authentication
+ method.
+
+
+
+
+
+
+
+
+
+
+
+Ylonen & Lonvick Standards Track [Page 23]
+
+RFC 4251 SSH Protocol Architecture January 2006
+
+
+9.5. Connection Protocol
+
+9.5.1. End Point Security
+
+ End point security is assumed by the connection protocol. If the
+ server has been compromised, any terminal sessions, port forwarding,
+ or systems accessed on the host are compromised. There are no
+ mitigating factors for this.
+
+ If the client has been compromised, and the server fails to stop the
+ attacker at the authentication protocol, all services exposed (either
+ as subsystems or through forwarding) will be vulnerable to attack.
+ Implementers SHOULD provide mechanisms for administrators to control
+ which services are exposed to limit the vulnerability of other
+ ...
[truncated message content] |
|
From: <tmy...@us...> - 2007-01-02 12:53:36
|
Revision: 105
http://svn.sourceforge.net/nmailserver/?rev=105&view=rev
Author: tmyroadctfig
Date: 2007-01-02 04:53:33 -0800 (Tue, 02 Jan 2007)
Log Message:
-----------
Added some SMTP diagrams.
Added Paths:
-----------
NMail/trunk/doc/SMTP Overview.vsd
NMail/trunk/doc/SMTP Service State.vsd
Added: NMail/trunk/doc/SMTP Overview.vsd
===================================================================
(Binary files differ)
Property changes on: NMail/trunk/doc/SMTP Overview.vsd
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: NMail/trunk/doc/SMTP Service State.vsd
===================================================================
(Binary files differ)
Property changes on: NMail/trunk/doc/SMTP Service State.vsd
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tmy...@us...> - 2007-01-02 02:39:19
|
Revision: 104
http://svn.sourceforge.net/nmailserver/?rev=104&view=rev
Author: tmyroadctfig
Date: 2007-01-01 18:39:18 -0800 (Mon, 01 Jan 2007)
Log Message:
-----------
Added service directory.
Added Paths:
-----------
NMail/trunk/NMail/DataTypes/Service/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tmy...@us...> - 2006-12-13 13:34:51
|
Revision: 103
http://svn.sourceforge.net/nmailserver/?rev=103&view=rev
Author: tmyroadctfig
Date: 2006-12-13 05:34:51 -0800 (Wed, 13 Dec 2006)
Log Message:
-----------
Further work on remote access.
Modified Paths:
--------------
NMail/trunk/NMail.RemoteAccessService/Web.Config
NMail/trunk/NMail.sln
Added Paths:
-----------
NMail/trunk/NMail.RemoteAccessService/App_Code/
NMail/trunk/NMail.RemoteAccessService/App_Code/RemoteAccessService.cs
NMail/trunk/NMail.RemoteAccessService/App_Code/ServiceState.cs
NMail/trunk/NMail.RemoteAccessService/App_Data/
NMail/trunk/NMail.RemoteAccessService/Bin/
NMail/trunk/NMail.RemoteAccessService/Bin/NMail.RemoteAccessService.Serializers.dll.refresh
NMail/trunk/NMail.RemoteAccessService/Bin/NMail.Server.dll.refresh
NMail/trunk/NMail.RemoteAccessService/Bin/NMail.dll.refresh
NMail/trunk/NMail.RemoteAccessService/Bin/log4net.dll.refresh
NMail/trunk/NMail.RemoteAccessService.Serializers/Properties/
NMail/trunk/NMail.RemoteAccessService.Serializers/Properties/AssemblyInfo.cs
Property Changed:
----------------
NMail/trunk/NMail.Administration.Web/Bin/
NMail/trunk/NMail.RemoteAccessService.Serializers/
Property changes on: NMail/trunk/NMail.Administration.Web/Bin
___________________________________________________________________
Name: svn:ignore
- log4net.dll
NMail.dll
NMail.Server.dll
+ log4net.dll
NMail.dll
NMail.Server.dll
Mono.Security.dll
NMail.LocalStoreData.MySql.dll
Added: NMail/trunk/NMail.RemoteAccessService/App_Code/RemoteAccessService.cs
===================================================================
--- NMail/trunk/NMail.RemoteAccessService/App_Code/RemoteAccessService.cs (rev 0)
+++ NMail/trunk/NMail.RemoteAccessService/App_Code/RemoteAccessService.cs 2006-12-13 13:34:51 UTC (rev 103)
@@ -0,0 +1,89 @@
+using System;
+using System.Collections.Generic;
+using System.Web;
+using System.Web.Services;
+using System.Web.Services.Protocols;
+
+using NMail.Authentication;
+using NMail.DataTypes.LocalStore;
+using NMail.Server;
+using NMail.RemoteAccessService.Serializers.DataTypes.LocalStore;
+
+[WebService(Namespace = "http://nmailserver.sf.net/RemoteAccessService/1.0")]
+[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
+public class RemoteAccessService : System.Web.Services.WebService
+{
+ /// <summary>
+ /// Authenticates the current user.
+ /// </summary>
+ /// <param name="user">The username to check.</param>
+ /// <param name="password">The password to check.</param>
+ /// <returns>
+ /// A base 64 encoded guid token or an empty string if authentication fails.
+ /// </returns>
+ [WebMethod]
+ public string Authenticate(string user, string password)
+ {
+ // TODO: ensure secure
+
+ IAuthenticationToken token = ServiceState.remoteAdmin.NMailServer.AuthenticationProvider.Authenticate(user, password);
+
+ if (token != null)
+ {
+ Guid key = Guid.NewGuid();
+
+ if (ServiceState.authTokens.ContainsKey(key)) {
+ ServiceState.authTokens.Remove(key);
+ }
+
+ ServiceState.authTokens.Add(key, token);
+
+ return Convert.ToBase64String(key.ToByteArray());
+ }
+
+ return string.Empty;
+ }
+
+ /// <summary>
+ /// Gets the user's nominal folder.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <returns>The store folder.</returns>
+ [WebMethod]
+ public StoreFolderSerializer GetNominalFolder(string authToken)
+ {
+ IAuthenticationToken token = ValidateAuthenticationToken(authToken);
+ if (token != null)
+ {
+ StoreFolder storeFolder = ServiceState.remoteAdmin.NMailServer.LocalStore.GetNominalStoreFolder(token);
+ return new StoreFolderSerializer(storeFolder);
+ }
+
+ throw new InvalidOperationException("Authentication token is not valid.");
+ }
+
+ [WebMethod]
+ public void DoSomething(StoreFolderSerializer folder)
+ {
+ }
+
+ protected IAuthenticationToken ValidateAuthenticationToken(string authToken)
+ {
+ Guid key = new Guid(Convert.FromBase64String(authToken));
+
+ if (ServiceState.authTokens.ContainsKey(key))
+ {
+ IAuthenticationToken token = ServiceState.authTokens[key];
+ if (token.TokenExpiry > DateTime.Now)
+ {
+ return token;
+ }
+ else
+ {
+ ServiceState.authTokens.Remove(key);
+ }
+ }
+
+ return null;
+ }
+}
Added: NMail/trunk/NMail.RemoteAccessService/App_Code/ServiceState.cs
===================================================================
--- NMail/trunk/NMail.RemoteAccessService/App_Code/ServiceState.cs (rev 0)
+++ NMail/trunk/NMail.RemoteAccessService/App_Code/ServiceState.cs 2006-12-13 13:34:51 UTC (rev 103)
@@ -0,0 +1,42 @@
+using System;
+using System.Configuration;
+using System.Collections.Generic;
+using System.Data;
+using System.Runtime.Remoting.Lifetime;
+using System.Web;
+using System.Web.Security;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+using System.Web.UI.WebControls.WebParts;
+using System.Web.UI.HtmlControls;
+
+using NMail.Authentication;
+using NMail.Server;
+
+/// <summary>
+/// Summary description for ServiceState
+/// </summary>
+public static class ServiceState
+{
+ public static Dictionary<Guid, IAuthenticationToken> authTokens = new Dictionary<Guid, IAuthenticationToken>();
+
+ public static RemoteAdministration remoteAdmin;
+
+ static ServiceState()
+ {
+ remoteAdmin = (RemoteAdministration)Activator.GetObject(typeof(RemoteAdministration), "tcp://localhost:7877/RemoteAdministration.rem");
+ SetupSponsorship(remoteAdmin, TimeSpan.MaxValue);
+ }
+
+ static void SetupSponsorship(MarshalByRefObject o, TimeSpan timout)
+ {
+ ILease lease = o.InitializeLifetimeService() as ILease;
+
+ if (lease != null && lease.CurrentState == LeaseState.Initial)
+ {
+ lease.InitialLeaseTime = timout;
+ lease.SponsorshipTimeout = timout;
+ lease.RenewOnCallTime = timout;
+ }
+ }
+}
Property changes on: NMail/trunk/NMail.RemoteAccessService/Bin
___________________________________________________________________
Name: svn:ignore
+ Mono.Security.dll
NMail.dll
NMail.RemoteAccessService.Serializers.dll
NMail.RemoteAccessService.Serializers.pdb
NMail.Server.dll
log4net.dll
Added: NMail/trunk/NMail.RemoteAccessService/Bin/NMail.RemoteAccessService.Serializers.dll.refresh
===================================================================
(Binary files differ)
Property changes on: NMail/trunk/NMail.RemoteAccessService/Bin/NMail.RemoteAccessService.Serializers.dll.refresh
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: NMail/trunk/NMail.RemoteAccessService/Bin/NMail.Server.dll.refresh
===================================================================
(Binary files differ)
Property changes on: NMail/trunk/NMail.RemoteAccessService/Bin/NMail.Server.dll.refresh
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: NMail/trunk/NMail.RemoteAccessService/Bin/NMail.dll.refresh
===================================================================
(Binary files differ)
Property changes on: NMail/trunk/NMail.RemoteAccessService/Bin/NMail.dll.refresh
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: NMail/trunk/NMail.RemoteAccessService/Bin/log4net.dll.refresh
===================================================================
(Binary files differ)
Property changes on: NMail/trunk/NMail.RemoteAccessService/Bin/log4net.dll.refresh
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: NMail/trunk/NMail.RemoteAccessService/Web.Config
===================================================================
--- NMail/trunk/NMail.RemoteAccessService/Web.Config 2006-12-13 13:32:53 UTC (rev 102)
+++ NMail/trunk/NMail.RemoteAccessService/Web.Config 2006-12-13 13:34:51 UTC (rev 103)
@@ -19,7 +19,8 @@
-->
<compilation debug="true">
<assemblies>
- <add assembly="System.Runtime.Remoting, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/></assemblies></compilation>
+ <add assembly="System.Runtime.Remoting, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
+ <add assembly="System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/></assemblies></compilation>
<!--
The <authentication> section enables configuration
of the security authentication mode used by
Property changes on: NMail/trunk/NMail.RemoteAccessService.Serializers
___________________________________________________________________
Name: svn:ignore
+ bin
obj
Added: NMail/trunk/NMail.RemoteAccessService.Serializers/Properties/AssemblyInfo.cs
===================================================================
--- NMail/trunk/NMail.RemoteAccessService.Serializers/Properties/AssemblyInfo.cs (rev 0)
+++ NMail/trunk/NMail.RemoteAccessService.Serializers/Properties/AssemblyInfo.cs 2006-12-13 13:34:51 UTC (rev 103)
@@ -0,0 +1,35 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("NMail.RemoteAccessServiceSerializers")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("NMail.RemoteAccessServiceSerializers")]
+[assembly: AssemblyCopyright("Copyright © 2006")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("993fe48c-1f11-4884-b320-fdb2e300c663")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
Modified: NMail/trunk/NMail.sln
===================================================================
--- NMail/trunk/NMail.sln 2006-12-13 13:32:53 UTC (rev 102)
+++ NMail/trunk/NMail.sln 2006-12-13 13:34:51 UTC (rev 103)
@@ -46,7 +46,7 @@
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NMail.OutlookPlugin", "NMail.OutlookPlugin\NMail.OutlookPlugin.csproj", "{9080FAD0-0BD8-4CA2-A645-9F2198C38CFE}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NMail.RemoteAccessServiceSerializers", "NMail.RemoteAccessServiceSerializers\NMail.RemoteAccessServiceSerializers.csproj", "{A54F735E-454A-4C65-8A61-66330AA64678}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NMail.RemoteAccessService.Serializers", "NMail.RemoteAccessService.Serializers\NMail.RemoteAccessService.Serializers.csproj", "{A54F735E-454A-4C65-8A61-66330AA64678}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tmy...@us...> - 2006-12-13 13:32:53
|
Revision: 102
http://svn.sourceforge.net/nmailserver/?rev=102&view=rev
Author: tmyroadctfig
Date: 2006-12-13 05:32:53 -0800 (Wed, 13 Dec 2006)
Log Message:
-----------
Renamed project.
Added Paths:
-----------
NMail/trunk/NMail.RemoteAccessService.Serializers/
NMail/trunk/NMail.RemoteAccessService.Serializers/DataTypes/
NMail/trunk/NMail.RemoteAccessService.Serializers/DataTypes/LocalStore/
NMail/trunk/NMail.RemoteAccessService.Serializers/DataTypes/LocalStore/StoreFolderSerializer.cs
NMail/trunk/NMail.RemoteAccessService.Serializers/NMail.RemoteAccessService.Serializers.csproj
Added: NMail/trunk/NMail.RemoteAccessService.Serializers/DataTypes/LocalStore/StoreFolderSerializer.cs
===================================================================
--- NMail/trunk/NMail.RemoteAccessService.Serializers/DataTypes/LocalStore/StoreFolderSerializer.cs (rev 0)
+++ NMail/trunk/NMail.RemoteAccessService.Serializers/DataTypes/LocalStore/StoreFolderSerializer.cs 2006-12-13 13:32:53 UTC (rev 102)
@@ -0,0 +1,69 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+using System.Xml.Serialization;
+
+using NMail.DataTypes.LocalStore;
+
+namespace NMail.RemoteAccessService.Serializers.DataTypes.LocalStore {
+ /// <summary>
+ /// A simple XML serializer for the store folder type.
+ /// </summary>
+ [XmlRoot("StoreFolder")]
+ public class StoreFolderSerializer : IXmlSerializable {
+
+ public StoreFolderSerializer() { }
+
+ public StoreFolderSerializer(StoreFolder storeFolder) {
+ this.storeFolder = storeFolder;
+ }
+
+ private StoreFolder storeFolder;
+
+ public StoreFolder StoreFolder {
+ get { return storeFolder; }
+ set { storeFolder = value; }
+ }
+
+ #region IXmlSerializable Members
+
+ public System.Xml.Schema.XmlSchema GetSchema() {
+ return null;
+ }
+
+ public void ReadXml(XmlReader reader) {
+ //reader.ReadStartElement("StoreFolder");
+
+ reader.MoveToAttribute("FolderId");
+ int folderId = Int32.Parse(reader.Value);
+
+ reader.MoveToAttribute("Name");
+ string name = reader.Value;
+
+ reader.MoveToAttribute("NameSpace");
+ string nameSpace = reader.Value;
+
+ int? parentId = null;
+ if (reader.MoveToAttribute("ParentId")) {
+ parentId = Int32.Parse(reader.Value);
+ }
+
+ reader.MoveToAttribute("HasChildren");
+ bool hasChildren = Boolean.Parse(reader.Value);
+
+ this.storeFolder = new StoreFolder(nameSpace, name, folderId, parentId, hasChildren);
+ }
+
+ public void WriteXml(XmlWriter writer) {
+ writer.WriteAttributeString("FolderId", this.storeFolder.FolderId.ToString());
+ writer.WriteAttributeString("Name", this.storeFolder.FolderName);
+ writer.WriteAttributeString("NameSpace", this.storeFolder.NameSpace);
+ writer.WriteAttributeString("HasChildren", this.storeFolder.HasChildren.ToString());
+ if (this.storeFolder.ParentId.HasValue) {
+ writer.WriteAttributeString("ParentId", this.storeFolder.ParentId.Value.ToString());
+ }
+ }
+ #endregion
+ }
+}
Added: NMail/trunk/NMail.RemoteAccessService.Serializers/NMail.RemoteAccessService.Serializers.csproj
===================================================================
--- NMail/trunk/NMail.RemoteAccessService.Serializers/NMail.RemoteAccessService.Serializers.csproj (rev 0)
+++ NMail/trunk/NMail.RemoteAccessService.Serializers/NMail.RemoteAccessService.Serializers.csproj 2006-12-13 13:32:53 UTC (rev 102)
@@ -0,0 +1,53 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{A54F735E-454A-4C65-8A61-66330AA64678}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>NMail.RemoteAccessService.Serializers</RootNamespace>
+ <AssemblyName>NMail.RemoteAccessService.Serializers</AssemblyName>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>..\References\NMail\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>..\References\NMail\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="DataTypes\LocalStore\StoreFolderSerializer.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\NMail\NMail.csproj">
+ <Project>{5A5A5012-B157-49B1-A35F-67EC9680112A}</Project>
+ <Name>NMail</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tmy...@us...> - 2006-12-13 13:32:10
|
Revision: 101
http://svn.sourceforge.net/nmailserver/?rev=101&view=rev
Author: tmyroadctfig
Date: 2006-12-13 05:32:07 -0800 (Wed, 13 Dec 2006)
Log Message:
-----------
Renamed project.
Removed Paths:
-------------
NMail/trunk/NMail.RemoteAccessServiceSerializers/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tmy...@us...> - 2006-12-13 13:28:32
|
Revision: 100
http://svn.sourceforge.net/nmailserver/?rev=100&view=rev
Author: tmyroadctfig
Date: 2006-12-13 05:28:31 -0800 (Wed, 13 Dec 2006)
Log Message:
-----------
Added dlls to ignore list.
Property Changed:
----------------
NMail/trunk/NMail.WebAccess/Bin/
Property changes on: NMail/trunk/NMail.WebAccess/Bin
___________________________________________________________________
Name: svn:ignore
+ log4net.dll
NMail.dll
NMail.RemoteAccessService.Serializers.dll
NMail.RemoteAccessService.Serializers.pdb
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tmy...@us...> - 2006-12-13 13:27:45
|
Revision: 99
http://svn.sourceforge.net/nmailserver/?rev=99&view=rev
Author: tmyroadctfig
Date: 2006-12-13 05:27:45 -0800 (Wed, 13 Dec 2006)
Log Message:
-----------
Minor changes.
Modified Paths:
--------------
NMail/trunk/NMail.WebAccess/Calendar.aspx
NMail/trunk/NMail.WebAccess/Web.config
Added Paths:
-----------
NMail/trunk/NMail.WebAccess/Bin/
NMail/trunk/NMail.WebAccess/Bin/NMail.RemoteAccessService.Serializers.dll.refresh
Added: NMail/trunk/NMail.WebAccess/Bin/NMail.RemoteAccessService.Serializers.dll.refresh
===================================================================
(Binary files differ)
Property changes on: NMail/trunk/NMail.WebAccess/Bin/NMail.RemoteAccessService.Serializers.dll.refresh
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: NMail/trunk/NMail.WebAccess/Calendar.aspx
===================================================================
--- NMail/trunk/NMail.WebAccess/Calendar.aspx 2006-12-12 12:10:58 UTC (rev 98)
+++ NMail/trunk/NMail.WebAccess/Calendar.aspx 2006-12-13 13:27:45 UTC (rev 99)
@@ -1,4 +1,50 @@
-<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Calendar.aspx.cs" Inherits="Calendar" Title="Untitled Page" %>
-<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
-</asp:Content>
+<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
+<%@ Register Src="Controls/LinkButtonList.ascx" TagName="LinkButtonList" TagPrefix="uc1" %>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" >
+<head id="Head1" runat="server">
+ <title>Untitled Page</title>
+</head>
+<body>
+ <form id="form1" runat="server">
+ <asp:WebPartManager ID="WebPartManager" runat="server" />
+
+ <table width="100%" border="0">
+ <tr>
+ <td rowspan="3" valign="top">
+ <asp:WebPartZone ID="LeftZone" runat="server">
+ <ZoneTemplate>
+ <uc1:LinkButtonList ID="ViewList" runat="server" />
+ </ZoneTemplate>
+ </asp:WebPartZone>
+ </td>
+ <td valign="top">
+ <asp:WebPartZone ID="TopZone" runat="server" LayoutOrientation="Horizontal">
+ </asp:WebPartZone>
+ </td>
+ <td rowspan="3" valign="top">
+ <asp:WebPartZone ID="RightZone" runat="server">
+ <ZoneTemplate>
+ </ZoneTemplate>
+ </asp:WebPartZone>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <asp:WebPartZone ID="CenterZone" runat="server" LayoutOrientation="Horizontal">
+ </asp:WebPartZone>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <asp:WebPartZone ID="BottomZone" runat="server" LayoutOrientation="Horizontal">
+ </asp:WebPartZone>
+ </td>
+ </tr>
+ </table>
+ </form>
+</body>
+</html>
Modified: NMail/trunk/NMail.WebAccess/Web.config
===================================================================
--- NMail/trunk/NMail.WebAccess/Web.config 2006-12-12 12:10:58 UTC (rev 98)
+++ NMail/trunk/NMail.WebAccess/Web.config 2006-12-13 13:27:45 UTC (rev 99)
@@ -9,7 +9,7 @@
-->
<configuration>
<appSettings>
- <add key="RemoteAccessService.RemoteAccessService" value="http://localhost:1288/NMail.RemoteAccessService/RemoteAccessService.asmx"/>
+ <add key="RemoteAccessService.RemoteAccessService" value="http://localhost:1288/NMail.RemoteAccessService/RemoteAccessService.asmx"/>
</appSettings>
<connectionStrings/>
<system.web>
@@ -26,11 +26,9 @@
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
-
<authentication mode="Forms">
<forms loginUrl="Login.aspx" timeout="60" protection="All" slidingExpiration="true"/>
</authentication>
-
<webParts enableExport="true">
<personalization defaultProvider="XmlFileSharedPersonalizationProvider">
<providers>
@@ -38,7 +36,6 @@
</providers>
</personalization>
</webParts>
-
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tmy...@us...> - 2006-12-12 12:11:03
|
Revision: 98
http://svn.sourceforge.net/nmailserver/?rev=98&view=rev
Author: tmyroadctfig
Date: 2006-12-12 04:10:58 -0800 (Tue, 12 Dec 2006)
Log Message:
-----------
Added some initial remote access file.
Modified Paths:
--------------
NMail/trunk/NMail/NMail.csproj
NMail/trunk/NMail.LocalStore/LocalStore.cs
NMail/trunk/NMail.sln
Added Paths:
-----------
NMail/trunk/NMail.RemoteAccessService/Global.asax
NMail/trunk/NMail.RemoteAccessService/RemoteAccessService.asmx
NMail/trunk/NMail.RemoteAccessService/Web.Config
NMail/trunk/NMail.RemoteAccessServiceSerializers/Properties/
NMail/trunk/NMail.RemoteAccessServiceSerializers/Properties/AssemblyInfo.cs
NMail/trunk/NMail.WebAccess/App_Code/
NMail/trunk/NMail.WebAccess/App_Code/LinkButtonListItem.cs
NMail/trunk/NMail.WebAccess/App_Data/
NMail/trunk/NMail.WebAccess/App_Themes/
NMail/trunk/NMail.WebAccess/App_Themes/Default/
NMail/trunk/NMail.WebAccess/App_Themes/Default/Default.css
NMail/trunk/NMail.WebAccess/App_Themes/Default/Default.skin
NMail/trunk/NMail.WebAccess/App_WebReferences/
NMail/trunk/NMail.WebAccess/App_WebReferences/RemoteAccessService/
NMail/trunk/NMail.WebAccess/App_WebReferences/RemoteAccessService/RemoteAccessService.disco
NMail/trunk/NMail.WebAccess/App_WebReferences/RemoteAccessService/RemoteAccessService.discomap
NMail/trunk/NMail.WebAccess/App_WebReferences/RemoteAccessService/RemoteAccessService.wsdl
NMail/trunk/NMail.WebAccess/Calendar.aspx
NMail/trunk/NMail.WebAccess/Calendar.aspx.cs
NMail/trunk/NMail.WebAccess/Controls/
NMail/trunk/NMail.WebAccess/Controls/Contacts/
NMail/trunk/NMail.WebAccess/Controls/LinkButtonList.ascx
NMail/trunk/NMail.WebAccess/Controls/LinkButtonList.ascx.cs
NMail/trunk/NMail.WebAccess/Controls/Mail/
NMail/trunk/NMail.WebAccess/Controls/Mail/FolderTree.ascx
NMail/trunk/NMail.WebAccess/Controls/Mail/FolderTree.ascx.cs
NMail/trunk/NMail.WebAccess/Default.aspx
NMail/trunk/NMail.WebAccess/Default.aspx.cs
NMail/trunk/NMail.WebAccess/Images/
NMail/trunk/NMail.WebAccess/Images/Skins/
NMail/trunk/NMail.WebAccess/Images/Skins/Default/
NMail/trunk/NMail.WebAccess/Images/Skins/Default/LoginBanner.jpg
NMail/trunk/NMail.WebAccess/Images/Skins/Default/ViewBackground.png
NMail/trunk/NMail.WebAccess/Login.aspx
NMail/trunk/NMail.WebAccess/Login.aspx.cs
NMail/trunk/NMail.WebAccess/Mail.aspx
NMail/trunk/NMail.WebAccess/Mail.aspx.cs
NMail/trunk/NMail.WebAccess/Web.config
Property Changed:
----------------
NMail/trunk/NMail.Administration.Web/Images/Tango/
NMail/trunk/NMail.RemoteAccessServiceSerializers/
Modified: NMail/trunk/NMail/NMail.csproj
===================================================================
--- NMail/trunk/NMail/NMail.csproj 2006-12-12 12:06:59 UTC (rev 97)
+++ NMail/trunk/NMail/NMail.csproj 2006-12-12 12:10:58 UTC (rev 98)
@@ -264,6 +264,9 @@
</Compile>
<Content Include="NMail.build" />
</ItemGroup>
+ <ItemGroup>
+ <Folder Include="DataTypes\Authentication\" />
+ </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>
Property changes on: NMail/trunk/NMail.Administration.Web/Images/Tango
___________________________________________________________________
Name: svn:ignore
+ Thumbs.db
Modified: NMail/trunk/NMail.LocalStore/LocalStore.cs
===================================================================
--- NMail/trunk/NMail.LocalStore/LocalStore.cs 2006-12-12 12:06:59 UTC (rev 97)
+++ NMail/trunk/NMail.LocalStore/LocalStore.cs 2006-12-12 12:10:58 UTC (rev 98)
@@ -413,6 +413,7 @@
return LocalStoreFolderResult.NotPermitted;
}
}
+ #endregion
/// <summary>
/// Gets a list of all folders
@@ -424,7 +425,6 @@
return LocalStoreData.GetFolders();
}
- #endregion
#region Rename Folder
/// <summary>
Added: NMail/trunk/NMail.RemoteAccessService/Global.asax
===================================================================
--- NMail/trunk/NMail.RemoteAccessService/Global.asax (rev 0)
+++ NMail/trunk/NMail.RemoteAccessService/Global.asax 2006-12-12 12:10:58 UTC (rev 98)
@@ -0,0 +1,39 @@
+<%@ Application Language="C#" %>
+
+<script runat="server">
+
+ void Application_Start(object sender, EventArgs e)
+ {
+ Hashtable properties = new Hashtable();
+ properties.Add("secure", true);
+ System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(new System.Runtime.Remoting.Channels.Tcp.TcpClientChannel(properties, null), false);
+ }
+
+ void Application_End(object sender, EventArgs e)
+ {
+ // Code that runs on application shutdown
+
+ }
+
+ void Application_Error(object sender, EventArgs e)
+ {
+ // Code that runs when an unhandled error occurs
+
+ }
+
+ void Session_Start(object sender, EventArgs e)
+ {
+ // Code that runs when a new session is started
+
+ }
+
+ void Session_End(object sender, EventArgs e)
+ {
+ // Code that runs when a session ends.
+ // Note: The Session_End event is raised only when the sessionstate mode
+ // is set to InProc in the Web.config file. If session mode is set to StateServer
+ // or SQLServer, the event is not raised.
+
+ }
+
+</script>
Added: NMail/trunk/NMail.RemoteAccessService/RemoteAccessService.asmx
===================================================================
--- NMail/trunk/NMail.RemoteAccessService/RemoteAccessService.asmx (rev 0)
+++ NMail/trunk/NMail.RemoteAccessService/RemoteAccessService.asmx 2006-12-12 12:10:58 UTC (rev 98)
@@ -0,0 +1 @@
+<%@ WebService Language="C#" CodeBehind="~/App_Code/RemoteAccessService.cs" Class="RemoteAccessService" %>
Added: NMail/trunk/NMail.RemoteAccessService/Web.Config
===================================================================
--- NMail/trunk/NMail.RemoteAccessService/Web.Config (rev 0)
+++ NMail/trunk/NMail.RemoteAccessService/Web.Config 2006-12-12 12:10:58 UTC (rev 98)
@@ -0,0 +1,42 @@
+<?xml version="1.0"?>
+<!--
+ Note: As an alternative to hand editing this file you can use the
+ web admin tool to configure settings for your application. Use
+ the Website->Asp.Net Configuration option in Visual Studio.
+ A full list of settings and comments can be found in
+ machine.config.comments usually located in
+ \Windows\Microsoft.Net\Framework\v2.x\Config
+-->
+<configuration>
+ <appSettings/>
+ <connectionStrings/>
+ <system.web>
+ <!--
+ Set compilation debug="true" to insert debugging
+ symbols into the compiled page. Because this
+ affects performance, set this value to true only
+ during development.
+ -->
+ <compilation debug="true">
+ <assemblies>
+ <add assembly="System.Runtime.Remoting, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/></assemblies></compilation>
+ <!--
+ The <authentication> section enables configuration
+ of the security authentication mode used by
+ ASP.NET to identify an incoming user.
+ -->
+ <authentication mode="Windows"/>
+ <!--
+ The <customErrors> section enables configuration
+ of what to do if/when an unhandled error occurs
+ during the execution of a request. Specifically,
+ it enables developers to configure html error pages
+ to be displayed in place of a error stack trace.
+
+ <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
+ <error statusCode="403" redirect="NoAccess.htm" />
+ <error statusCode="404" redirect="FileNotFound.htm" />
+ </customErrors>
+ -->
+ </system.web>
+</configuration>
Property changes on: NMail/trunk/NMail.RemoteAccessServiceSerializers
___________________________________________________________________
Name: svn:ignore
+ bin
obj
Added: NMail/trunk/NMail.RemoteAccessServiceSerializers/Properties/AssemblyInfo.cs
===================================================================
--- NMail/trunk/NMail.RemoteAccessServiceSerializers/Properties/AssemblyInfo.cs (rev 0)
+++ NMail/trunk/NMail.RemoteAccessServiceSerializers/Properties/AssemblyInfo.cs 2006-12-12 12:10:58 UTC (rev 98)
@@ -0,0 +1,35 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("NMail.RemoteAccessServiceSerializers")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("NMail.RemoteAccessServiceSerializers")]
+[assembly: AssemblyCopyright("Copyright © 2006")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("993fe48c-1f11-4884-b320-fdb2e300c663")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
Added: NMail/trunk/NMail.WebAccess/App_Code/LinkButtonListItem.cs
===================================================================
--- NMail/trunk/NMail.WebAccess/App_Code/LinkButtonListItem.cs (rev 0)
+++ NMail/trunk/NMail.WebAccess/App_Code/LinkButtonListItem.cs 2006-12-12 12:10:58 UTC (rev 98)
@@ -0,0 +1,48 @@
+using System;
+using System.Data;
+using System.Configuration;
+using System.Web;
+using System.Web.Security;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+using System.Web.UI.WebControls.WebParts;
+using System.Web.UI.HtmlControls;
+
+public class LinkButtonListItem
+{
+ public LinkButtonListItem(string text, string itemStyleClass, EventHandler clickHandler)
+ {
+ this.text = text;
+ this.itemStyleClass = itemStyleClass;
+ this.clickHandler = clickHandler;
+ }
+
+ private string text;
+
+ public string Text
+ {
+ get
+ {
+ return this.text;
+ }
+ }
+
+ private string itemStyleClass;
+
+ public string ItemStyleClass
+ {
+ get { return itemStyleClass; }
+ set { itemStyleClass = value; }
+ }
+
+
+ private EventHandler clickHandler;
+
+ public EventHandler ClickHandler
+ {
+ get
+ {
+ return this.clickHandler;
+ }
+ }
+}
Added: NMail/trunk/NMail.WebAccess/App_Themes/Default/Default.css
===================================================================
--- NMail/trunk/NMail.WebAccess/App_Themes/Default/Default.css (rev 0)
+++ NMail/trunk/NMail.WebAccess/App_Themes/Default/Default.css 2006-12-12 12:10:58 UTC (rev 98)
@@ -0,0 +1,31 @@
+body
+{
+ font-family: Sans-Serif;
+}
+
+.LoginBox
+{
+ margin-top: 5em;
+ margin-left: auto;
+ margin-right: auto;
+ width: 600px;
+ border: solid 1px black;
+}
+
+.LoginTitle
+{
+ font-size: larger;
+ padding-bottom: 0.5em;
+}
+
+.ViewButton
+{
+ text-align: center;
+ background-image: url('../../Images/Skins/Default/ViewBackground.png');
+ background-repeat: repeat-x;
+ background-position: left top;
+ height: 30px;
+ vertical-align: middle;
+ padding-left: 0.5em;
+ padding-right: 0.5em;
+}
\ No newline at end of file
Added: NMail/trunk/NMail.WebAccess/App_Themes/Default/Default.skin
===================================================================
--- NMail/trunk/NMail.WebAccess/App_Themes/Default/Default.skin (rev 0)
+++ NMail/trunk/NMail.WebAccess/App_Themes/Default/Default.skin 2006-12-12 12:10:58 UTC (rev 98)
@@ -0,0 +1,17 @@
+<%--
+Default skin template. The following skins are provided as examples only.
+
+1. Named control skin. The SkinId should be uniquely defined because
+ duplicate SkinId's per control type are not allowed in the same theme.
+
+<asp:GridView runat="server" SkinId="gridviewSkin" BackColor="White" >
+ <AlternatingRowStyle BackColor="Blue" />
+</asp:GridView>
+
+2. Default skin. The SkinId is not defined. Only one default
+ control skin per control type is allowed in the same theme.
+
+<asp:Image runat="server" ImageUrl="~/images/image1.jpg" />
+--%>
+
+<asp:Image runat="server" SkinId="LoginBanner" ImageUrl="~/Images/Skins/Default/LoginBanner.jpg" />
Added: NMail/trunk/NMail.WebAccess/App_WebReferences/RemoteAccessService/RemoteAccessService.disco
===================================================================
--- NMail/trunk/NMail.WebAccess/App_WebReferences/RemoteAccessService/RemoteAccessService.disco (rev 0)
+++ NMail/trunk/NMail.WebAccess/App_WebReferences/RemoteAccessService/RemoteAccessService.disco 2006-12-12 12:10:58 UTC (rev 98)
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<discovery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/disco/">
+ <contractRef ref="http://localhost:1288/NMail.RemoteAccessService/RemoteAccessService.asmx?wsdl" docRef="http://localhost:1288/NMail.RemoteAccessService/RemoteAccessService.asmx" xmlns="http://schemas.xmlsoap.org/disco/scl/" />
+ <soap address="http://localhost:1288/NMail.RemoteAccessService/RemoteAccessService.asmx" xmlns:q1="http://nmailserver.sf.net/RemoteAccessService/1.0" binding="q1:RemoteAccessServiceSoap" xmlns="http://schemas.xmlsoap.org/disco/soap/" />
+ <soap address="http://localhost:1288/NMail.RemoteAccessService/RemoteAccessService.asmx" xmlns:q2="http://nmailserver.sf.net/RemoteAccessService/1.0" binding="q2:RemoteAccessServiceSoap12" xmlns="http://schemas.xmlsoap.org/disco/soap/" />
+</discovery>
\ No newline at end of file
Added: NMail/trunk/NMail.WebAccess/App_WebReferences/RemoteAccessService/RemoteAccessService.discomap
===================================================================
--- NMail/trunk/NMail.WebAccess/App_WebReferences/RemoteAccessService/RemoteAccessService.discomap (rev 0)
+++ NMail/trunk/NMail.WebAccess/App_WebReferences/RemoteAccessService/RemoteAccessService.discomap 2006-12-12 12:10:58 UTC (rev 98)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<DiscoveryClientResultsFile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <Results>
+ <DiscoveryClientResult referenceType="System.Web.Services.Discovery.ContractReference" url="http://localhost:1288/NMail.RemoteAccessService/RemoteAccessService.asmx?wsdl" filename="RemoteAccessService.wsdl" />
+ <DiscoveryClientResult referenceType="System.Web.Services.Discovery.DiscoveryDocumentReference" url="http://localhost:1288/NMail.RemoteAccessService/RemoteAccessService.asmx?disco" filename="RemoteAccessService.disco" />
+ </Results>
+</DiscoveryClientResultsFile>
\ No newline at end of file
Added: NMail/trunk/NMail.WebAccess/App_WebReferences/RemoteAccessService/RemoteAccessService.wsdl
===================================================================
--- NMail/trunk/NMail.WebAccess/App_WebReferences/RemoteAccessService/RemoteAccessService.wsdl (rev 0)
+++ NMail/trunk/NMail.WebAccess/App_WebReferences/RemoteAccessService/RemoteAccessService.wsdl 2006-12-12 12:10:58 UTC (rev 98)
@@ -0,0 +1,116 @@
+<?xml version="1.0" encoding="utf-8"?>
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://nmailserver.sf.net/RemoteAccessService/1.0" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://nmailserver.sf.net/RemoteAccessService/1.0" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsdl:types>
+ <s:schema elementFormDefault="qualified" targetNamespace="http://nmailserver.sf.net/RemoteAccessService/1.0">
+ <s:import namespace="http://www.w3.org/2001/XMLSchema" />
+ <s:element name="Authenticate">
+ <s:complexType>
+ <s:sequence>
+ <s:element minOccurs="0" maxOccurs="1" name="user" type="s:string" />
+ <s:element minOccurs="0" maxOccurs="1" name="password" type="s:string" />
+ </s:sequence>
+ </s:complexType>
+ </s:element>
+ <s:element name="AuthenticateResponse">
+ <s:complexType>
+ <s:sequence>
+ <s:element minOccurs="0" maxOccurs="1" name="AuthenticateResult" type="s:string" />
+ </s:sequence>
+ </s:complexType>
+ </s:element>
+ <s:element name="GetNominalFolder">
+ <s:complexType>
+ <s:sequence>
+ <s:element minOccurs="0" maxOccurs="1" name="authToken" type="s:string" />
+ </s:sequence>
+ </s:complexType>
+ </s:element>
+ <s:element name="GetNominalFolderResponse">
+ <s:complexType>
+ <s:sequence>
+ <s:element minOccurs="0" maxOccurs="1" name="GetNominalFolderResult">
+ <s:complexType>
+ <s:sequence>
+ <s:element ref="s:schema" />
+ <s:any />
+ </s:sequence>
+ </s:complexType>
+ </s:element>
+ </s:sequence>
+ </s:complexType>
+ </s:element>
+ </s:schema>
+ </wsdl:types>
+ <wsdl:message name="AuthenticateSoapIn">
+ <wsdl:part name="parameters" element="tns:Authenticate" />
+ </wsdl:message>
+ <wsdl:message name="AuthenticateSoapOut">
+ <wsdl:part name="parameters" element="tns:AuthenticateResponse" />
+ </wsdl:message>
+ <wsdl:message name="GetNominalFolderSoapIn">
+ <wsdl:part name="parameters" element="tns:GetNominalFolder" />
+ </wsdl:message>
+ <wsdl:message name="GetNominalFolderSoapOut">
+ <wsdl:part name="parameters" element="tns:GetNominalFolderResponse" />
+ </wsdl:message>
+ <wsdl:portType name="RemoteAccessServiceSoap">
+ <wsdl:operation name="Authenticate">
+ <wsdl:input message="tns:AuthenticateSoapIn" />
+ <wsdl:output message="tns:AuthenticateSoapOut" />
+ </wsdl:operation>
+ <wsdl:operation name="GetNominalFolder">
+ <wsdl:input message="tns:GetNominalFolderSoapIn" />
+ <wsdl:output message="tns:GetNominalFolderSoapOut" />
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="RemoteAccessServiceSoap" type="tns:RemoteAccessServiceSoap">
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="Authenticate">
+ <soap:operation soapAction="http://nmailserver.sf.net/RemoteAccessService/1.0/Authenticate" style="document" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="GetNominalFolder">
+ <soap:operation soapAction="http://nmailserver.sf.net/RemoteAccessService/1.0/GetNominalFolder" style="document" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="RemoteAccessServiceSoap12" type="tns:RemoteAccessServiceSoap">
+ <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="Authenticate">
+ <soap12:operation soapAction="http://nmailserver.sf.net/RemoteAccessService/1.0/Authenticate" style="document" />
+ <wsdl:input>
+ <soap12:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap12:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="GetNominalFolder">
+ <soap12:operation soapAction="http://nmailserver.sf.net/RemoteAccessService/1.0/GetNominalFolder" style="document" />
+ <wsdl:input>
+ <soap12:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap12:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="RemoteAccessService">
+ <wsdl:port name="RemoteAccessServiceSoap" binding="tns:RemoteAccessServiceSoap">
+ <soap:address location="http://localhost:1288/NMail.RemoteAccessService/RemoteAccessService.asmx" />
+ </wsdl:port>
+ <wsdl:port name="RemoteAccessServiceSoap12" binding="tns:RemoteAccessServiceSoap12">
+ <soap12:address location="http://localhost:1288/NMail.RemoteAccessService/RemoteAccessService.asmx" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
\ No newline at end of file
Added: NMail/trunk/NMail.WebAccess/Calendar.aspx
===================================================================
--- NMail/trunk/NMail.WebAccess/Calendar.aspx (rev 0)
+++ NMail/trunk/NMail.WebAccess/Calendar.aspx 2006-12-12 12:10:58 UTC (rev 98)
@@ -0,0 +1,4 @@
+<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Calendar.aspx.cs" Inherits="Calendar" Title="Untitled Page" %>
+<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
+</asp:Content>
+
Added: NMail/trunk/NMail.WebAccess/Calendar.aspx.cs
===================================================================
--- NMail/trunk/NMail.WebAccess/Calendar.aspx.cs (rev 0)
+++ NMail/trunk/NMail.WebAccess/Calendar.aspx.cs 2006-12-12 12:10:58 UTC (rev 98)
@@ -0,0 +1,18 @@
+using System;
+using System.Data;
+using System.Configuration;
+using System.Collections;
+using System.Web;
+using System.Web.Security;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+using System.Web.UI.WebControls.WebParts;
+using System.Web.UI.HtmlControls;
+
+public partial class Calendar : System.Web.UI.Page
+{
+ protected void Page_Load(object sender, EventArgs e)
+ {
+
+ }
+}
Added: NMail/trunk/NMail.WebAccess/Controls/LinkButtonList.ascx
===================================================================
--- NMail/trunk/NMail.WebAccess/Controls/LinkButtonList.ascx (rev 0)
+++ NMail/trunk/NMail.WebAccess/Controls/LinkButtonList.ascx 2006-12-12 12:10:58 UTC (rev 98)
@@ -0,0 +1,8 @@
+<%@ Control Language="C#" AutoEventWireup="true" CodeFile="LinkButtonList.ascx.cs" Inherits="Controls_LinkButtonList" %>
+<asp:Repeater ID="Repeater" runat="server">
+ <ItemTemplate>
+ <div class='<%# Eval("ItemStyleClass") %>'>
+ <asp:LinkButton runat="server" ID="LinkButton" Text='<%# Eval("Text") %>' />
+ </div>
+ </ItemTemplate>
+</asp:Repeater>
Added: NMail/trunk/NMail.WebAccess/Controls/LinkButtonList.ascx.cs
===================================================================
--- NMail/trunk/NMail.WebAccess/Controls/LinkButtonList.ascx.cs (rev 0)
+++ NMail/trunk/NMail.WebAccess/Controls/LinkButtonList.ascx.cs 2006-12-12 12:10:58 UTC (rev 98)
@@ -0,0 +1,41 @@
+using System;
+using System.Data;
+using System.Configuration;
+using System.Collections;
+using System.Collections.Generic;
+using System.Web;
+using System.Web.Security;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+using System.Web.UI.WebControls.WebParts;
+using System.Web.UI.HtmlControls;
+
+public partial class Controls_LinkButtonList : System.Web.UI.UserControl
+{
+ protected override void OnInit(EventArgs e)
+ {
+ base.OnInit(e);
+
+ this.Repeater.ItemDataBound += new RepeaterItemEventHandler(Repeater_ItemDataBound);
+ }
+
+ void Repeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
+ {
+ Control control = e.Item.FindControl("LinkButton");
+ LinkButtonListItem item = (LinkButtonListItem)e.Item.DataItem;
+
+ if (control != null && item != null && item.ClickHandler != null)
+ {
+ // Link this task's button with its click handler
+ LinkButton button = (LinkButton)control;
+ button.Click += item.ClickHandler;
+ }
+ }
+
+ public void SetListItems(List<LinkButtonListItem> items)
+ {
+ RepeaterItemCollection dataSource = new RepeaterItemCollection(new ArrayList(items));
+ this.Repeater.DataSource = dataSource;
+ this.Repeater.DataBind();
+ }
+}
\ No newline at end of file
Added: NMail/trunk/NMail.WebAccess/Controls/Mail/FolderTree.ascx
===================================================================
--- NMail/trunk/NMail.WebAccess/Controls/Mail/FolderTree.ascx (rev 0)
+++ NMail/trunk/NMail.WebAccess/Controls/Mail/FolderTree.ascx 2006-12-12 12:10:58 UTC (rev 98)
@@ -0,0 +1,3 @@
+<%@ Control Language="C#" AutoEventWireup="true" CodeFile="FolderTree.ascx.cs" Inherits="Controls_Mail_FolderTree" %>
+<asp:TreeView ID="FolderTreeView" runat="server">
+</asp:TreeView>
Added: NMail/trunk/NMail.WebAccess/Controls/Mail/FolderTree.ascx.cs
===================================================================
--- NMail/trunk/NMail.WebAccess/Controls/Mail/FolderTree.ascx.cs (rev 0)
+++ NMail/trunk/NMail.WebAccess/Controls/Mail/FolderTree.ascx.cs 2006-12-12 12:10:58 UTC (rev 98)
@@ -0,0 +1,21 @@
+using System;
+using System.Data;
+using System.Configuration;
+using System.Collections;
+using System.Web;
+using System.Web.Security;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+using System.Web.UI.WebControls.WebParts;
+using System.Web.UI.HtmlControls;
+
+public partial class Controls_Mail_FolderTree : System.Web.UI.UserControl
+{
+ protected void Page_Load(object sender, EventArgs e)
+ {
+ RemoteAccessService.RemoteAccessService ras = (RemoteAccessService.RemoteAccessService)Session["RAS"];
+ string authToken = Session["AuthToken"];
+
+ ras.Get
+ }
+}
Added: NMail/trunk/NMail.WebAccess/Default.aspx
===================================================================
--- NMail/trunk/NMail.WebAccess/Default.aspx (rev 0)
+++ NMail/trunk/NMail.WebAccess/Default.aspx 2006-12-12 12:10:58 UTC (rev 98)
@@ -0,0 +1,50 @@
+<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
+
+<%@ Register Src="Controls/LinkButtonList.ascx" TagName="LinkButtonList" TagPrefix="uc1" %>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" >
+<head id="Head1" runat="server">
+ <title>Untitled Page</title>
+</head>
+<body>
+ <form id="form1" runat="server">
+ <asp:WebPartManager ID="WebPartManager" runat="server" />
+
+ <table width="100%" border="0">
+ <tr>
+ <td rowspan="3" valign="top">
+ <asp:WebPartZone ID="LeftZone" runat="server">
+ <ZoneTemplate>
+ <uc1:LinkButtonList ID="ViewList" runat="server" />
+ </ZoneTemplate>
+ </asp:WebPartZone>
+ </td>
+ <td valign="top">
+ <asp:WebPartZone ID="TopZone" runat="server" LayoutOrientation="Horizontal">
+ </asp:WebPartZone>
+ </td>
+ <td rowspan="3" valign="top">
+ <asp:WebPartZone ID="RightZone" runat="server">
+ <ZoneTemplate>
+ </ZoneTemplate>
+ </asp:WebPartZone>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <asp:WebPartZone ID="CenterZone" runat="server" LayoutOrientation="Horizontal">
+ </asp:WebPartZone>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <asp:WebPartZone ID="BottomZone" runat="server" LayoutOrientation="Horizontal">
+ </asp:WebPartZone>
+ </td>
+ </tr>
+ </table>
+ </form>
+</body>
+</html>
Added: NMail/trunk/NMail.WebAccess/Default.aspx.cs
===================================================================
--- NMail/trunk/NMail.WebAccess/Default.aspx.cs (rev 0)
+++ NMail/trunk/NMail.WebAccess/Default.aspx.cs 2006-12-12 12:10:58 UTC (rev 98)
@@ -0,0 +1,36 @@
+using System;
+using System.Data;
+using System.Configuration;
+using System.Collections.Generic;
+using System.Web;
+using System.Web.Security;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+using System.Web.UI.WebControls.WebParts;
+using System.Web.UI.HtmlControls;
+
+using ASP;
+
+public partial class _Default : System.Web.UI.Page
+{
+ protected void Page_Load(object sender, EventArgs e)
+ {
+ this.WebPartManager.DisplayMode = WebPartManager.DesignDisplayMode;
+
+ // Setup the view list
+ List<LinkButtonListItem> viewItems = new List<LinkButtonListItem>();
+ viewItems.Add(new LinkButtonListItem("Mail", "ViewButton", new EventHandler(ShowMailView_Clicked)));
+ viewItems.Add(new LinkButtonListItem("Calendar", "ViewButton", new EventHandler(ShowCalendarView_Clicked)));
+
+ this.ViewList.SetListItems(viewItems);
+ }
+
+ protected void ShowMailView_Clicked(object sender, EventArgs ea)
+ {
+ Response.Redirect("Mail.aspx");
+ }
+
+ protected void ShowCalendarView_Clicked(object sender, EventArgs ea)
+ {
+ }
+}
Added: NMail/trunk/NMail.WebAccess/Images/Skins/Default/LoginBanner.jpg
===================================================================
(Binary files differ)
Property changes on: NMail/trunk/NMail.WebAccess/Images/Skins/Default/LoginBanner.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: NMail/trunk/NMail.WebAccess/Images/Skins/Default/ViewBackground.png
===================================================================
(Binary files differ)
Property changes on: NMail/trunk/NMail.WebAccess/Images/Skins/Default/ViewBackground.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: NMail/trunk/NMail.WebAccess/Login.aspx
===================================================================
--- NMail/trunk/NMail.WebAccess/Login.aspx (rev 0)
+++ NMail/trunk/NMail.WebAccess/Login.aspx 2006-12-12 12:10:58 UTC (rev 98)
@@ -0,0 +1,28 @@
+<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Login.aspx.cs" Inherits="Login" %>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" >
+<head runat="server">
+ <title>NMail Login</title>
+</head>
+<body>
+ <form id="form1" runat="server">
+ <div align="center" class="LoginBox">
+
+ <asp:Image ID="LoginBanner" runat="server" SkinID="LoginBanner" />
+ <asp:LoginView ID="LoginView" runat="server">
+ <LoggedInTemplate>
+ You are currently logged in as
+ <asp:LoginName ID="LoginName" runat="server" />.
+ </LoggedInTemplate>
+ <AnonymousTemplate>
+ <asp:Login ID="Login" runat="server" OnAuthenticate="Login_Authenticate" DestinationPageUrl="~/Default.aspx" TitleText="Log in to NMail web access">
+ <TitleTextStyle CssClass="LogonTitle" />
+ </asp:Login>
+ </AnonymousTemplate>
+ </asp:LoginView>
+ </div>
+ </form>
+</body>
+</html>
Added: NMail/trunk/NMail.WebAccess/Login.aspx.cs
===================================================================
--- NMail/trunk/NMail.WebAccess/Login.aspx.cs (rev 0)
+++ NMail/trunk/NMail.WebAccess/Login.aspx.cs 2006-12-12 12:10:58 UTC (rev 98)
@@ -0,0 +1,36 @@
+using System;
+using System.Data;
+using System.Configuration;
+using System.Collections;
+using System.Web;
+using System.Web.Security;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+using System.Web.UI.WebControls.WebParts;
+using System.Web.UI.HtmlControls;
+
+using RemoteAccessService;
+
+public partial class Login : System.Web.UI.Page
+{
+ protected void Page_Load(object sender, EventArgs e) { }
+
+ protected void Login_Authenticate(object sender, AuthenticateEventArgs e)
+ {
+ System.Web.UI.WebControls.Login login = (System.Web.UI.WebControls.Login)this.LoginView.FindControl("Login");
+
+ RemoteAccessService.RemoteAccessService ras = new RemoteAccessService.RemoteAccessService();
+ string authToken = ras.Authenticate(login.UserName, login.Password);
+
+ if (authToken != string.Empty)
+ {
+ Session["AuthToken"] = authToken;
+ Session["RAS"] = ras;
+ e.Authenticated = true;
+ }
+ else
+ {
+ // TODO: an error message
+ }
+ }
+}
Added: NMail/trunk/NMail.WebAccess/Mail.aspx
===================================================================
--- NMail/trunk/NMail.WebAccess/Mail.aspx (rev 0)
+++ NMail/trunk/NMail.WebAccess/Mail.aspx 2006-12-12 12:10:58 UTC (rev 98)
@@ -0,0 +1,53 @@
+<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Mail.aspx.cs" Inherits="Mail" %>
+
+<%@ Register Src="Controls/Mail/FolderTree.ascx" TagName="FolderTree" TagPrefix="uc2" %>
+
+<%@ Register Src="Controls/LinkButtonList.ascx" TagName="LinkButtonList" TagPrefix="uc1" %>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" >
+<head runat="server">
+ <title>Untitled Page</title>
+</head>
+<body>
+ <form id="form1" runat="server">
+ <asp:WebPartManager ID="WebPartManager" runat="server" />
+
+ <table width="100%" border="0">
+ <tr>
+ <td rowspan="3" valign="top">
+ <asp:WebPartZone ID="LeftZone" runat="server">
+ <ZoneTemplate>
+ <uc1:LinkButtonList ID="ViewList" runat="server" />
+ </ZoneTemplate>
+ </asp:WebPartZone>
+ </td>
+ <td valign="top">
+ <asp:WebPartZone ID="TopZone" runat="server" LayoutOrientation="Horizontal">
+ </asp:WebPartZone>
+ </td>
+ <td rowspan="3" valign="top">
+ <asp:WebPartZone ID="RightZone" runat="server">
+ <ZoneTemplate>
+ <uc2:FolderTree ID="FolderTree1" runat="server" />
+ </ZoneTemplate>
+ </asp:WebPartZone>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <asp:WebPartZone ID="CenterZone" runat="server" LayoutOrientation="Horizontal">
+ </asp:WebPartZone>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <asp:WebPartZone ID="BottomZone" runat="server" LayoutOrientation="Horizontal">
+ </asp:WebPartZone>
+ </td>
+ </tr>
+ </table>
+ </form>
+</body>
+</html>
Added: NMail/trunk/NMail.WebAccess/Mail.aspx.cs
===================================================================
--- NMail/trunk/NMail.WebAccess/Mail.aspx.cs (rev 0)
+++ NMail/trunk/NMail.WebAccess/Mail.aspx.cs 2006-12-12 12:10:58 UTC (rev 98)
@@ -0,0 +1,31 @@
+using System;
+using System.Data;
+using System.Configuration;
+using System.Collections;
+using System.Collections.Generic;
+using System.Web;
+using System.Web.Security;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+using System.Web.UI.WebControls.WebParts;
+using System.Web.UI.HtmlControls;
+
+using ASP;
+
+public partial class Mail : System.Web.UI.Page
+{
+ protected void Page_Load(object sender, EventArgs e)
+ {
+ this.WebPartManager.DisplayMode = WebPartManager.DesignDisplayMode;
+
+ // Setup the view list
+ List<LinkButtonListItem> viewItems = new List<LinkButtonListItem>();
+ viewItems.Add(new LinkButtonListItem("Calendar", "ViewButton", new EventHandler(ShowCalendarView_Clicked)));
+
+ this.ViewList.SetListItems(viewItems);
+ }
+
+ protected void ShowCalendarView_Clicked(object sender, EventArgs ea)
+ {
+ }
+}
Added: NMail/trunk/NMail.WebAccess/Web.config
===================================================================
--- NMail/trunk/NMail.WebAccess/Web.config (rev 0)
+++ NMail/trunk/NMail.WebAccess/Web.config 2006-12-12 12:10:58 UTC (rev 98)
@@ -0,0 +1,55 @@
+<?xml version="1.0"?>
+<!--
+ Note: As an alternative to hand editing this file you can use the
+ web admin tool to configure settings for your application. Use
+ the Website->Asp.Net Configuration option in Visual Studio.
+ A full list of settings and comments can be found in
+ machine.config.comments usually located in
+ \Windows\Microsoft.Net\Framework\v2.x\Config
+-->
+<configuration>
+ <appSettings>
+ <add key="RemoteAccessService.RemoteAccessService" value="http://localhost:1288/NMail.RemoteAccessService/RemoteAccessService.asmx"/>
+ </appSettings>
+ <connectionStrings/>
+ <system.web>
+ <pages theme="Default"/>
+ <!--
+ Set compilation debug="true" to insert debugging
+ symbols into the compiled page. Because this
+ affects performance, set this value to true only
+ during development.
+ -->
+ <compilation debug="true"/>
+ <!--
+ The <authentication> section enables configuration
+ of the security authentication mode used by
+ ASP.NET to identify an incoming user.
+ -->
+
+ <authentication mode="Forms">
+ <forms loginUrl="Login.aspx" timeout="60" protection="All" slidingExpiration="true"/>
+ </authentication>
+
+ <webParts enableExport="true">
+ <personalization defaultProvider="XmlFileSharedPersonalizationProvider">
+ <providers>
+ <add applicationName="/" name="XmlFileSharedPersonalizationProvider" type="MarkItUp.SingleUserBlog.Web.WebParts.XmlFileSharedPersonalizationProvider"/>
+ </providers>
+ </personalization>
+ </webParts>
+
+ <!--
+ The <customErrors> section enables configuration
+ of what to do if/when an unhandled error occurs
+ during the execution of a request. Specifically,
+ it enables developers to configure html error pages
+ to be displayed in place of a error stack trace.
+
+ <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
+ <error statusCode="403" redirect="NoAccess.htm" />
+ <error statusCode="404" redirect="FileNotFound.htm" />
+ </customErrors>
+ -->
+ </system.web>
+</configuration>
Modified: NMail/trunk/NMail.sln
===================================================================
--- NMail/trunk/NMail.sln 2006-12-12 12:06:59 UTC (rev 97)
+++ NMail/trunk/NMail.sln 2006-12-12 12:10:58 UTC (rev 98)
@@ -46,6 +46,8 @@
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NMail.OutlookPlugin", "NMail.OutlookPlugin\NMail.OutlookPlugin.csproj", "{9080FAD0-0BD8-4CA2-A645-9F2198C38CFE}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NMail.RemoteAccessServiceSerializers", "NMail.RemoteAccessServiceSerializers\NMail.RemoteAccessServiceSerializers.csproj", "{A54F735E-454A-4C65-8A61-66330AA64678}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -144,6 +146,10 @@
{9080FAD0-0BD8-4CA2-A645-9F2198C38CFE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9080FAD0-0BD8-4CA2-A645-9F2198C38CFE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9080FAD0-0BD8-4CA2-A645-9F2198C38CFE}.Release|Any CPU.Build.0 = Release|Any CPU
+ {A54F735E-454A-4C65-8A61-66330AA64678}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A54F735E-454A-4C65-8A61-66330AA64678}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A54F735E-454A-4C65-8A61-66330AA64678}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A54F735E-454A-4C65-8A61-66330AA64678}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tmy...@us...> - 2006-12-12 12:07:01
|
Revision: 97
http://svn.sourceforge.net/nmailserver/?rev=97&view=rev
Author: tmyroadctfig
Date: 2006-12-12 04:06:59 -0800 (Tue, 12 Dec 2006)
Log Message:
-----------
Added some directories.
Added Paths:
-----------
NMail/trunk/NMail/DataTypes/Authentication/
NMail/trunk/NMail.RemoteAccessService/
NMail/trunk/NMail.RemoteAccessServiceSerializers/
NMail/trunk/NMail.WebAccess/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tmy...@us...> - 2006-12-03 13:09:49
|
Revision: 96
http://svn.sourceforge.net/nmailserver/?rev=96&view=rev
Author: tmyroadctfig
Date: 2006-12-03 05:09:49 -0800 (Sun, 03 Dec 2006)
Log Message:
-----------
Fixed a defect in reporting mail delivery problems (Bug #1607846).
Modified Paths:
--------------
NMail/trunk/NMail.LocalStore/LocalStore.cs
Modified: NMail/trunk/NMail.LocalStore/LocalStore.cs
===================================================================
--- NMail/trunk/NMail.LocalStore/LocalStore.cs 2006-12-03 13:05:48 UTC (rev 95)
+++ NMail/trunk/NMail.LocalStore/LocalStore.cs 2006-12-03 13:09:49 UTC (rev 96)
@@ -186,8 +186,8 @@
// Save the message to the store data
LocalStoreData.DeliverMessage(lsd);
} catch (Exception) {
- result.Type = DeliveryResultType.TemporaryError;
- result.Message = "Internal error while delivering message.";
+ deliveryResult.Type = DeliveryResultType.TemporaryError;
+ deliveryResult.Message = "Internal error while delivering message.";
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tmy...@us...> - 2006-12-03 13:05:48
|
Revision: 95
http://svn.sourceforge.net/nmailserver/?rev=95&view=rev
Author: tmyroadctfig
Date: 2006-12-03 05:05:48 -0800 (Sun, 03 Dec 2006)
Log Message:
-----------
Fixed a defect parsing MIME messages (Bug #1607841).
Modified Paths:
--------------
NMail/trunk/NMail/Helper/MimeHelper.cs
Modified: NMail/trunk/NMail/Helper/MimeHelper.cs
===================================================================
--- NMail/trunk/NMail/Helper/MimeHelper.cs 2006-11-26 06:28:09 UTC (rev 94)
+++ NMail/trunk/NMail/Helper/MimeHelper.cs 2006-12-03 13:05:48 UTC (rev 95)
@@ -57,16 +57,17 @@
preamble = new MessageDataPart(data);
break;
- } else {
+ } else if (boundaryOffset > 0) {
// Extract the preamble
preamble = new MessageDataPart(data.SubString(0, boundaryOffset - Message.Terminator.Length));
+ }
- // Find the end of the boundary line and move to the next block
- int terminatorOffset =
- data.IndexOf(Message.Terminator, boundaryOffset + boundary.Length);
- blockStartOffset = terminatorOffset + Message.Terminator.Length;
- inPreamble = false;
- }
+ // Find the end of the boundary line and move to the next block
+ int terminatorOffset =
+ data.IndexOf(Message.Terminator, boundaryOffset + boundary.Length);
+ blockStartOffset = terminatorOffset + Message.Terminator.Length;
+ inPreamble = false;
+
} else {
boundaryOffset = data.IndexOf(boundary, blockStartOffset);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tmy...@us...> - 2006-11-26 06:28:10
|
Revision: 94
http://svn.sourceforge.net/nmailserver/?rev=94&view=rev
Author: tmyroadctfig
Date: 2006-11-25 22:28:09 -0800 (Sat, 25 Nov 2006)
Log Message:
-----------
Added partial support for BODYSTRUCTURE fetch item. Factored out some IMAP data types. Added RFC 2046.
Modified Paths:
--------------
NMail/trunk/NMail/DataTypes/IMessageBodyPart.cs
NMail/trunk/NMail/DataTypes/Message.cs
NMail/trunk/NMail/DataTypes/MultipartBodyPart.cs
NMail/trunk/NMail/DataTypes/SimpleBodyPart.cs
NMail/trunk/NMail/Helper/MimeHelper.cs
NMail/trunk/NMail/NMail.csproj
NMail/trunk/NMail.ImapService/Command/FetchCommand.cs
NMail/trunk/NMail.ImapService/State/ExamineState.cs
NMail/trunk/NMail.ImapService/State/SelectedState.cs
NMail/trunk/NMail.LocalStoreData.MySql/MySqlLocalStoreData.cs
Added Paths:
-----------
NMail/trunk/NMail/DataTypes/Imap/
NMail/trunk/NMail/DataTypes/Imap/BodyStructure.cs
NMail/trunk/NMail/DataTypes/Imap/FetchBodyItem.cs
NMail/trunk/NMail/DataTypes/Imap/FetchBodySectionType.cs
NMail/trunk/NMail/DataTypes/Imap/FetchDataItem.cs
NMail/trunk/NMail/DataTypes/Imap/FetchDataItemType.cs
NMail/trunk/NMail/DataTypes/Imap/FetchDataList.cs
NMail/trunk/doc/RFC/MIME/rfc2046_mime_part2.txt
Modified: NMail/trunk/NMail/DataTypes/IMessageBodyPart.cs
===================================================================
--- NMail/trunk/NMail/DataTypes/IMessageBodyPart.cs 2006-11-23 11:38:36 UTC (rev 93)
+++ NMail/trunk/NMail/DataTypes/IMessageBodyPart.cs 2006-11-26 06:28:09 UTC (rev 94)
@@ -16,6 +16,7 @@
*/
using System;
+using System.Collections.Generic;
namespace NMail.DataTypes {
/// <summary>
@@ -40,7 +41,7 @@
/// <summary>
/// Gets the mime parts of this message part, if any.
/// </summary>
- IMessagePart[] MimeParts { get; }
+ List<IMessageBodyPart> MimeParts { get; }
/// <summary>
/// Gets the preamble for the message body, if any.
Added: NMail/trunk/NMail/DataTypes/Imap/BodyStructure.cs
===================================================================
--- NMail/trunk/NMail/DataTypes/Imap/BodyStructure.cs (rev 0)
+++ NMail/trunk/NMail/DataTypes/Imap/BodyStructure.cs 2006-11-26 06:28:09 UTC (rev 94)
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2004-2006 Luke Quinane
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+using NMail.Helper;
+
+namespace NMail.DataTypes.Imap {
+ public class BodyStructure {
+
+ protected IMessageBodyPart bodyPart;
+
+ public BodyStructure(IMessageBodyPart bodyPart) {
+ this.bodyPart = bodyPart;
+ }
+
+ public override string ToString() {
+ if (this.bodyPart.MultipartBody) {
+ StringBuilder data = new StringBuilder();
+ data.Append("(");
+
+ foreach (IMessageBodyPart part in this.bodyPart.MimeParts) {
+ BodyStructure partStructure = new BodyStructure(part);
+ data.Append(partStructure.ToString());
+ }
+
+ data.Append("\"MIXED\")");
+ return data.ToString();
+
+ } else {
+ MimeContentTransferEncoding encoding = MimeHelper.GetTransferEncoding(this.bodyPart.Headers);
+ MimeContentType contentType = MimeHelper.GetContentType(this.bodyPart.Headers);
+ string charset = MimeHelper.GetCharacterSet(this.bodyPart.Headers);
+
+ // Count the number of lines in the message body
+ string bodyData = this.bodyPart.BodyData.ToString();
+ int lines = 0;
+ int index = bodyData.IndexOf(Message.Terminator);
+ while (index != -1) {
+ lines++;
+ index = bodyData.IndexOf(Message.Terminator, index + 1);
+ }
+
+ string encodingStr = encoding.ToString().ToUpper();
+ if (encoding == MimeContentTransferEncoding.EightBit) {
+ encodingStr = "8bit";
+ } else if (encoding == MimeContentTransferEncoding.SevenBit) {
+ encodingStr = "7bit";
+ }
+
+ return string.Format("(\"{0}\" \"{1}\" (\"charset\" \"{2}\") {3} {4} \"{5}\" {6} {7} NIL NIL NIL)",
+ contentType.ToString().ToLower(),
+ "plain",
+ charset,
+ "NIL", // body-fld-id
+ "NIL", // body-fld-desc
+ encodingStr,
+ this.bodyPart.BodyData.Length,
+ lines);
+ }
+ }
+ }
+}
Added: NMail/trunk/NMail/DataTypes/Imap/FetchBodyItem.cs
===================================================================
--- NMail/trunk/NMail/DataTypes/Imap/FetchBodyItem.cs (rev 0)
+++ NMail/trunk/NMail/DataTypes/Imap/FetchBodyItem.cs 2006-11-26 06:28:09 UTC (rev 94)
@@ -0,0 +1,166 @@
+/*
+ * Copyright 2004-2006 Luke Quinane and Daniel Frampton
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace NMail.DataTypes.Imap {
+ /// <summary>
+ /// A class to hold the details of a FETCH on a BODY item.
+ /// </summary>
+ public class FetchBodyItem : FetchDataItem {
+ /// <summary>
+ /// Creates a new fetch body item from the given string.
+ /// </summary>
+ /// <param name="bodyString">The string to parse.</param>
+ /// <param name="peek">True if the SEEN flag should not be set for this access.</param>
+ public FetchBodyItem(string bodyString, bool peek)
+ : base(peek ? FetchDataItemType.BodyPeek : FetchDataItemType.Body) {
+
+ // Check if the fetch is partial
+ if (bodyString.IndexOf('<') != -1) {
+ parsePartial(bodyString);
+ }
+
+ if (bodyString.IndexOf('[') != -1) {
+ // Extract the data out of "BODY[ ... ]"
+ bodyString = bodyString.Substring(bodyString.IndexOf('[') + 1, bodyString.Length - bodyString.IndexOf('[') - 1);
+ bodyString = bodyString.Substring(0, bodyString.IndexOf(']')).Trim();
+ this.sectionName = bodyString;
+
+ if (bodyString.StartsWith("HEADER")) {
+ if (bodyString.StartsWith("HEADER.FIELDS")) {
+ string headerArgs = bodyString.Substring(bodyString.IndexOf('(') + 1, bodyString.Length - bodyString.IndexOf('(') - 1);
+ headerArgs = headerArgs.Substring(0, headerArgs.IndexOf(')')).Trim();
+ this.headerFields = headerArgs.Split(' ');
+
+ if (bodyString.StartsWith("HEADER.FIELDS.NOT")) {
+ this.sectionType = FetchBodySectionType.HeaderFieldsNot;
+ this.sectionName = "HEADER.FIELDS.NOT";
+
+ } else {
+ this.sectionType = FetchBodySectionType.HeaderFields;
+ this.sectionName = "HEADER.FIELDS";
+ }
+
+ } else {
+ this.sectionType = FetchBodySectionType.Header;
+ }
+
+ } else if (bodyString == "MIME") {
+ this.sectionType = FetchBodySectionType.Mime;
+
+ } else if (bodyString == "TEXT") {
+ this.sectionType = FetchBodySectionType.Text;
+
+ } else if (bodyString == string.Empty) {
+ // No sections specified, default to all
+ this.sectionType = FetchBodySectionType.All;
+
+ } else {
+ this.sectionType = FetchBodySectionType.Section;
+ }
+
+ } else {
+ // No sections specified, default to all
+ this.sectionType = FetchBodySectionType.All;
+ this.sectionName = string.Empty;
+ }
+ }
+
+ private void parsePartial(string data) {
+ // Parse out the start and end. In the form: <start.end>
+ string start = data.Substring(data.IndexOf('<') + 1, data.IndexOf('.') - 1);
+ string length = data.Substring(data.IndexOf('.') + 1, data.IndexOf('>') - 1);
+
+ this.partial = true;
+ this.startOctet = Int32.Parse(start);
+ this.length = Int32.Parse(length);
+ }
+
+ private bool partial;
+
+ /// <summary>
+ /// Indicates if this is a partial fetch
+ /// </summary>
+ public bool Partial {
+ get {
+ return this.partial;
+ }
+ }
+
+ private int startOctet;
+
+ /// <summary>
+ /// The start of the partial fetch.
+ /// </summary>
+ public int StartOctet {
+ get {
+ if (!this.partial)
+ throw new ArgumentException("Not a partial fetch.");
+ return this.startOctet;
+ }
+ }
+
+ private int length;
+
+ /// <summary>
+ /// The length of the partial fetch.
+ /// </summary>
+ public int Length {
+ get {
+ if (!this.partial)
+ throw new ArgumentException("Not a partial fetch.");
+ return this.length;
+ }
+ }
+
+ private FetchBodySectionType sectionType;
+
+ /// <summary>
+ /// The type of body section fetch.
+ /// </summary>
+ public FetchBodySectionType SectionType {
+ get {
+ return this.sectionType;
+ }
+ }
+
+ string sectionName;
+
+ /// <summary>
+ /// The section name for this body section fetch.
+ /// </summary>
+ public string SectionName {
+ get {
+ return this.sectionName;
+ }
+ }
+
+ private string[] headerFields;
+
+ /// <summary>
+ /// The header fields associated with this section fetch.
+ /// </summary>
+ public string[] HeaderFields {
+ get {
+ return this.headerFields;
+ }
+ }
+ }
+}
Added: NMail/trunk/NMail/DataTypes/Imap/FetchBodySectionType.cs
===================================================================
--- NMail/trunk/NMail/DataTypes/Imap/FetchBodySectionType.cs (rev 0)
+++ NMail/trunk/NMail/DataTypes/Imap/FetchBodySectionType.cs 2006-11-26 06:28:09 UTC (rev 94)
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2004-2006 Luke Quinane and Daniel Frampton
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace NMail.DataTypes.Imap {
+ /// <summary>
+ /// The type of the body section to fetch.
+ /// </summary>
+ public enum FetchBodySectionType {
+ /// <summary>
+ /// Fetches the entire message including the header.
+ /// </summary>
+ All,
+
+ /// <summary>
+ /// Fetches the entire header.
+ /// </summary>
+ Header,
+
+ /// <summary>
+ /// Fetches only specified header fields.
+ /// </summary>
+ HeaderFields,
+
+ /// <summary>
+ /// Fetches all but the specified header fields.
+ /// </summary>
+ HeaderFieldsNot,
+
+ /// <summary>
+ /// Fetches MIME header for the given part.
+ /// </summary>
+ Mime,
+
+ /// <summary>
+ /// Fetches the body of the given part.
+ /// </summary>
+ Text,
+
+ /// <summary>
+ /// Fetches the section of the given part.
+ /// </summary>
+ Section
+ }
+}
Added: NMail/trunk/NMail/DataTypes/Imap/FetchDataItem.cs
===================================================================
--- NMail/trunk/NMail/DataTypes/Imap/FetchDataItem.cs (rev 0)
+++ NMail/trunk/NMail/DataTypes/Imap/FetchDataItem.cs 2006-11-26 06:28:09 UTC (rev 94)
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2004-2006 Luke Quinane and Daniel Frampton
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace NMail.DataTypes.Imap {
+ /// <summary>
+ /// Represents a single item in the fetch list.
+ /// </summary>
+ public class FetchDataItem {
+ /// <summary>
+ /// Creates a new item with the given type.
+ /// </summary>
+ /// <param name="dataType">The data type.</param>
+ public FetchDataItem(FetchDataItemType dataType) {
+ this.dataType = dataType;
+ }
+
+ private FetchDataItemType dataType;
+
+ /// <summary>
+ /// The type of item to fetch.
+ /// </summary>
+ public FetchDataItemType DataType {
+ get {
+ return this.dataType;
+ }
+ }
+ }
+}
Added: NMail/trunk/NMail/DataTypes/Imap/FetchDataItemType.cs
===================================================================
--- NMail/trunk/NMail/DataTypes/Imap/FetchDataItemType.cs (rev 0)
+++ NMail/trunk/NMail/DataTypes/Imap/FetchDataItemType.cs 2006-11-26 06:28:09 UTC (rev 94)
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2004-2006 Luke Quinane and Daniel Frampton
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace NMail.DataTypes.Imap {
+ /// <summary>
+ /// The type of the data item to fetch.
+ /// </summary>
+ public enum FetchDataItemType {
+ /// <summary>
+ /// Macro equivalent to: (FLAGS INTERNALDATE RFC822.SIZE ENVELOPE)
+ /// </summary>
+ All,
+
+ /// <summary>
+ /// Macro equivalent to: (FLAGS INTERNALDATE RFC822.SIZE)
+ /// </summary>
+ Fast,
+
+ /// <summary>
+ /// Macro equivalent to: (FLAGS INTERNALDATE RFC822.SIZE ENVELOPE BODY)
+ /// </summary>
+ Full,
+
+ /// <summary>
+ /// The text of a particular body section.
+ /// </summary>
+ Body,
+
+ /// <summary>
+ /// An alternate form of BODY[<section>] that does not implicitly set the \Seen flag.
+ /// </summary>
+ BodyPeek,
+
+ /// <summary>
+ /// The [MIME-IMB] body structure of the message.
+ /// </summary>
+ BodyStructure,
+
+ /// <summary>
+ /// The envelope structure of the message.
+ /// </summary>
+ Envelope,
+
+ /// <summary>
+ /// The flags that are set for this message.
+ /// </summary>
+ Flags,
+
+ /// <summary>
+ /// The internal date of the message.
+ /// </summary>
+ InternalDate,
+
+ /// <summary>
+ /// Functionally equivalent to BODY[] ... (RFC822 is returned).
+ /// </summary>
+ Rfc822,
+
+ /// <summary>
+ /// Functionally equivalent to BODY.PEEK[HEADER] ... (RFC822.HEADER is returned).
+ /// </summary>
+ Rfc822Header,
+
+ /// <summary>
+ /// The [RFC-2822] size of the message.
+ /// </summary>
+ Rfc822Size,
+
+ /// <summary>
+ /// Functionally equivalent to BODY[TEXT] ... (RFC822.TEXT is returned).
+ /// </summary>
+ Rfc822Text,
+
+ /// <summary>
+ /// The unique identifier for the message.
+ /// </summary>
+ Uid
+ }
+}
Added: NMail/trunk/NMail/DataTypes/Imap/FetchDataList.cs
===================================================================
--- NMail/trunk/NMail/DataTypes/Imap/FetchDataList.cs (rev 0)
+++ NMail/trunk/NMail/DataTypes/Imap/FetchDataList.cs 2006-11-26 06:28:09 UTC (rev 94)
@@ -0,0 +1,100 @@
+/*
+ * Copyright 2004-2006 Luke Quinane and Daniel Frampton
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+using NMail.Helper;
+
+namespace NMail.DataTypes.Imap {
+ /// <summary>
+ /// Represents a list of data items to fetch in a FETCH command.
+ /// </summary>
+ public class FetchDataList {
+ /// <summary>
+ /// Internal storage for the data list.
+ /// </summary>
+ private List<FetchDataItem> fetchDataList = new List<FetchDataItem>();
+
+ /// <summary>
+ /// Creates a new list from the given string.
+ /// </summary>
+ /// <param name="fetchList">The IMAP data list to parse.</param>
+ public FetchDataList(string dataList) {
+ // Clean up the list
+ dataList = dataList.Trim();
+ if (dataList.StartsWith("(") && dataList.EndsWith(")")) {
+ dataList = dataList.Substring(1, dataList.Length - 2).Trim();
+ }
+
+ string[] tokens = StringTokenizer.GetQuotedBracketTokens(dataList, " ".ToCharArray(), MaximumTokens);
+
+ foreach (string token in tokens) {
+ FetchDataItem currentItem = null;
+
+ if (token.StartsWith("BODY.PEEK")) {
+ // Handle the BODY.PEEK token
+ currentItem = new FetchBodyItem(token, true);
+
+ } else if (token.StartsWith("BODYSTRUCTURE")) {
+ // Handle the BODYSTRUCTURE token
+ currentItem = new FetchDataItem(FetchDataItemType.BodyStructure);
+
+ } else if (token.StartsWith("BODY")) {
+ // Handle the BODY token - note this needs to appear after BODY.PEEK and BODYSTRUCTURE
+ currentItem = new FetchBodyItem(token, false);
+
+ } else if (token.StartsWith("RFC822")) {
+ // Handle RFC822 tokens that might have a "." in them
+ if (token == "RFC822") {
+ currentItem = new FetchDataItem(FetchDataItemType.Rfc822);
+
+ } else if (token == "RFC822.HEADER") {
+ currentItem = new FetchDataItem(FetchDataItemType.Rfc822Header);
+
+ } else if (token == "RFC822.SIZE") {
+ currentItem = new FetchDataItem(FetchDataItemType.Rfc822Size);
+
+ } else if (token == "RFC822.TEXT") {
+ currentItem = new FetchDataItem(FetchDataItemType.Rfc822Text);
+
+ } else {
+ throw new ArgumentException("Invalid item in FETCH list.");
+ }
+ } else {
+ // Handle all other valid tokens
+ FetchDataItemType dataType = (FetchDataItemType) Enum.Parse(typeof(FetchDataItemType), token, true);
+ currentItem = new FetchDataItem(dataType);
+ }
+
+ this.fetchDataList.Add(currentItem);
+ }
+ }
+
+ /// <summary>
+ /// Returns the list of data items to retieve.
+ /// </summary>
+ public List<FetchDataItem> DataListItems {
+ get {
+ return this.fetchDataList;
+ }
+ }
+
+ private const int MaximumTokens = 100;
+ }
+}
Modified: NMail/trunk/NMail/DataTypes/Message.cs
===================================================================
--- NMail/trunk/NMail/DataTypes/Message.cs 2006-11-23 11:38:36 UTC (rev 93)
+++ NMail/trunk/NMail/DataTypes/Message.cs 2006-11-26 06:28:09 UTC (rev 94)
@@ -16,7 +16,7 @@
*/
using System;
-using System.Collections;
+using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
@@ -85,7 +85,7 @@
private void parseMime() {
if (this.parsed) return; // No need for parsing
- string mimeBoundary = MimeHelper.GetBoundary(this.data.Headers["Content-type"]);
+ string mimeBoundary = MimeHelper.GetBoundary(this.data.Headers);
MessageDataPart preamble;
IMessageBodyPart[] parsedParts;
MessageDataPart postamble;
@@ -106,14 +106,14 @@
/// </summary>
public bool MultipartBody {
get {
- return (MimeHelper.GetContentType(this.data.Headers["Content-Type"]) == MimeContentType.Multipart);
+ return (MimeHelper.GetContentType(this.data.Headers) == MimeContentType.Multipart);
}
}
/// <summary>
/// Gets the mime parts of this message part, if any.
/// </summary>
- public IMessagePart[] MimeParts {
+ public List<IMessageBodyPart> MimeParts {
get {
if (!this.parsed) parseMime();
return this.data.MimeParts;
Modified: NMail/trunk/NMail/DataTypes/MultipartBodyPart.cs
===================================================================
--- NMail/trunk/NMail/DataTypes/MultipartBodyPart.cs 2006-11-23 11:38:36 UTC (rev 93)
+++ NMail/trunk/NMail/DataTypes/MultipartBodyPart.cs 2006-11-26 06:28:09 UTC (rev 94)
@@ -16,7 +16,7 @@
*/
using System;
-using System.Collections;
+using System.Collections.Generic;
using System.Text;
using NMail.Helper;
@@ -45,7 +45,7 @@
/// <summary>
/// The list of MIME parts for this message body.
/// </summary>
- private ArrayList mimeParts;
+ private List<IMessageBodyPart> mimeParts;
/// <summary>
/// A string containing the mime boundary.
@@ -63,14 +63,14 @@
IMessageBodyPart[] mimeParts, MessageDataPart postamble) {
this.headers = headers;
this.preamble = preamble;
- this.mimeParts = new ArrayList(mimeParts);
+ this.mimeParts = new List<IMessageBodyPart>(mimeParts);
this.postamble = postamble;
if (this.headers == null) {
this.headers = new MessageHeaders();
}
- this.mimeBoundary = MimeHelper.GetBoundary(this.headers["Content-type"]);
+ this.mimeBoundary = MimeHelper.GetBoundary(this.headers);
}
/// <summary>
@@ -97,9 +97,9 @@
/// <summary>
/// Gets the mime parts for this body.
/// </summary>
- public IMessagePart[] MimeParts {
+ public List<IMessageBodyPart> MimeParts {
get {
- return (IMessagePart[]) this.mimeParts.ToArray(typeof(IMessagePart));
+ return this.mimeParts;
}
}
Modified: NMail/trunk/NMail/DataTypes/SimpleBodyPart.cs
===================================================================
--- NMail/trunk/NMail/DataTypes/SimpleBodyPart.cs 2006-11-23 11:38:36 UTC (rev 93)
+++ NMail/trunk/NMail/DataTypes/SimpleBodyPart.cs 2006-11-26 06:28:09 UTC (rev 94)
@@ -16,7 +16,7 @@
*/
using System;
-using System.Collections;
+using System.Collections.Generic;
using System.Text;
using NMail.Helper;
@@ -111,7 +111,7 @@
/// <summary>
/// Gets the mime parts of this message part. Always returns null.
/// </summary>
- public IMessagePart[] MimeParts {
+ public List<IMessageBodyPart> MimeParts {
get {
return null;
}
Modified: NMail/trunk/NMail/Helper/MimeHelper.cs
===================================================================
--- NMail/trunk/NMail/Helper/MimeHelper.cs 2006-11-23 11:38:36 UTC (rev 93)
+++ NMail/trunk/NMail/Helper/MimeHelper.cs 2006-11-26 06:28:09 UTC (rev 94)
@@ -26,7 +26,7 @@
/// <summary>
/// Provides methods for paring various mime parameters.
/// </summary>
- public class MimeHelper {
+ public static class MimeHelper {
#region ParseMime
/// <summary>
/// Parses the preamble, postamble and MIME parts from MIME data.
@@ -116,6 +116,16 @@
/// Gets the MIME content transfer encoding from the given MIME header line.
/// The default encoding type if seven bit ASCII.
/// </summary>
+ /// <param name="headers">The headers to get the transfer encoding from.</param>
+ /// <returns>The parsed encoding type.</returns>
+ public static MimeContentTransferEncoding GetTransferEncoding(MessageHeaders headers) {
+ return GetTransferEncoding(headers[ContentTransferEncodingHeader]);
+ }
+
+ /// <summary>
+ /// Gets the MIME content transfer encoding from the given MIME header line.
+ /// The default encoding type if seven bit ASCII.
+ /// </summary>
/// <remarks>
/// The MIME header line for this value is named "Content-Transfer-Encoding".
/// </remarks>
@@ -156,6 +166,16 @@
/// Gets the MIME content type from the given MIME header line. The default
/// content type is text.
/// </summary>
+ /// <param name="headers">The headers to get the content type from.</param>
+ /// <returns>The parsed content type.</returns>
+ public static MimeContentType GetContentType(MessageHeaders headers) {
+ return GetContentType(headers[ContentTypeHeader]);
+ }
+
+ /// <summary>
+ /// Gets the MIME content type from the given MIME header line. The default
+ /// content type is text.
+ /// </summary>
/// <remarks>
/// The MIME header line for this value is named "Content-Type".
/// </remarks>
@@ -206,6 +226,15 @@
/// <summary>
/// Extracts the MIME boundary string from the given header.
/// </summary>
+ /// <param name="headers">The headers to get the boundary from.</param>
+ /// <returns>The boundary or an empty string.</returns>
+ public static string GetBoundary(MessageHeaders headers) {
+ return GetBoundary(headers[ContentTypeHeader]);
+ }
+
+ /// <summary>
+ /// Extracts the MIME boundary string from the given header.
+ /// </summary>
/// <remarks>
/// The message header line for this value is named "Content-Type".
/// </remarks>
@@ -225,6 +254,15 @@
/// <summary>
/// Extracts the MIME character set string from the given header.
/// </summary>
+ /// <param name="headers">The headers to extract the character set from.</param>
+ /// <returns>The character set or an empty string.</returns>
+ public static string GetCharacterSet(MessageHeaders headers) {
+ return GetCharacterSet(headers[ContentTypeHeader]);
+ }
+
+ /// <summary>
+ /// Extracts the MIME character set string from the given header.
+ /// </summary>
/// <remarks>
/// The message header line for this value is named "Content-Type".
/// </remarks>
@@ -233,11 +271,15 @@
public static string GetCharacterSet(string contentType) {
Match m = Regex.Match(contentType, "charset=\"?(.+)\"?\\s*", RegexOptions.Compiled);
if (m.Success) {
- return m.Captures[0].Value.Replace("\"", string.Empty);
+ return m.Groups[1].Value.Replace("\"", string.Empty);
} else {
return string.Empty;
}
}
#endregion
+
+ public const string ContentTypeHeader = "Content-type";
+
+ public const string ContentTransferEncodingHeader = "Content-Transfer-Encoding";
}
}
Modified: NMail/trunk/NMail/NMail.csproj
===================================================================
--- NMail/trunk/NMail/NMail.csproj 2006-11-23 11:38:36 UTC (rev 93)
+++ NMail/trunk/NMail/NMail.csproj 2006-11-26 06:28:09 UTC (rev 94)
@@ -132,6 +132,12 @@
<Compile Include="DataTypes\ACLs\UserGroupAdminPrivilege.cs" />
<Compile Include="DataTypes\Envelope.cs" />
<Compile Include="DataTypes\IDnsClient.cs" />
+ <Compile Include="DataTypes\Imap\BodyStructure.cs" />
+ <Compile Include="DataTypes\Imap\FetchBodyItem.cs" />
+ <Compile Include="DataTypes\Imap\FetchBodySectionType.cs" />
+ <Compile Include="DataTypes\Imap\FetchDataItem.cs" />
+ <Compile Include="DataTypes\Imap\FetchDataItemType.cs" />
+ <Compile Include="DataTypes\Imap\FetchDataList.cs" />
<Compile Include="DataTypes\IService.cs" />
<Compile Include="DataTypes\ISmtpClient.cs" />
<Compile Include="DataTypes\ByteString.cs">
Modified: NMail/trunk/NMail.ImapService/Command/FetchCommand.cs
===================================================================
--- NMail/trunk/NMail.ImapService/Command/FetchCommand.cs 2006-11-23 11:38:36 UTC (rev 93)
+++ NMail/trunk/NMail.ImapService/Command/FetchCommand.cs 2006-11-26 06:28:09 UTC (rev 94)
@@ -18,7 +18,7 @@
using System;
using System.Collections;
-using NMail.Helper;
+using NMail.DataTypes.Imap;
namespace NMail.ImapService.Command {
/// <summary>
@@ -63,373 +63,4 @@
}
}
}
-
- #region Fetch Data
- #region FetchDataList
- /// <summary>
- /// Represents a list of data items to fetch in a FETCH command.
- /// </summary>
- public class FetchDataList {
- /// <summary>
- /// Internal storage for the data list.
- /// </summary>
- private ArrayList fetchDataList;
-
- /// <summary>
- /// Creates a new list from the given string.
- /// </summary>
- /// <param name="fetchList">The IMAP data list to parse.</param>
- public FetchDataList(string dataList) {
- this.fetchDataList = new ArrayList();
-
- // Clean up the list
- dataList = dataList.Trim();
- if (dataList.StartsWith("(") && dataList.EndsWith(")")) {
- dataList = dataList.Substring(1, dataList.Length - 2).Trim();
- }
-
- string[] tokens = StringTokenizer.GetQuotedBracketTokens(dataList, " ".ToCharArray(), MaximumTokens);
-
- foreach (string token in tokens) {
- FetchDataItem currentItem = null;
-
- if (token.StartsWith("BODY.PEEK")) {
- // Handle the BODY.PEEK token
- currentItem = new FetchBodyItem(token, true);
-
- } else if (token.StartsWith("BODY.PEEK")) {
- // Handle the BODY token
- currentItem = new FetchBodyItem(token, false);
-
- } else if (token.StartsWith("RFC822")) {
- // Handle RFC822 tokens that might have a "." in them
- if (token == "RFC822") {
- currentItem = new FetchDataItem(FetchDataItemType.Rfc822);
-
- } else if (token == "RFC822.HEADER") {
- currentItem = new FetchDataItem(FetchDataItemType.Rfc822Header);
-
- } else if (token == "RFC822.SIZE") {
- currentItem = new FetchDataItem(FetchDataItemType.Rfc822Size);
-
- } else if (token == "RFC822.TEXT") {
- currentItem = new FetchDataItem(FetchDataItemType.Rfc822Text);
-
- } else {
- throw new ArgumentException("Invalid item in FETCH list.");
- }
- } else {
- // Handle all other valid tokens
- FetchDataItemType dataType = (FetchDataItemType) Enum.Parse(typeof(FetchDataItemType), token, true);
- currentItem = new FetchDataItem(dataType);
- }
-
- this.fetchDataList.Add(currentItem);
- }
- }
-
- /// <summary>
- /// Returns the list of data items to retieve.
- /// </summary>
- public FetchDataItem[] DataListItems {
- get {
- return (FetchDataItem[]) this.fetchDataList.ToArray(typeof(FetchDataItem));
- }
- }
-
- private const int MaximumTokens = 100;
- }
- #endregion
-
- #region FetchDataItemType
- /// <summary>
- /// The type of the data item to fetch.
- /// </summary>
- public enum FetchDataItemType {
- /// <summary>
- /// Macro equivalent to: (FLAGS INTERNALDATE RFC822.SIZE ENVELOPE)
- /// </summary>
- All,
-
- /// <summary>
- /// Macro equivalent to: (FLAGS INTERNALDATE RFC822.SIZE)
- /// </summary>
- Fast,
-
- /// <summary>
- /// Macro equivalent to: (FLAGS INTERNALDATE RFC822.SIZE ENVELOPE BODY)
- /// </summary>
- Full,
-
- /// <summary>
- /// The text of a particular body section.
- /// </summary>
- Body,
-
- /// <summary>
- /// An alternate form of BODY[<section>] that does not implicitly set the \Seen flag.
- /// </summary>
- BodyPeek,
-
- /// <summary>
- /// The [MIME-IMB] body structure of the message.
- /// </summary>
- BodyStructure,
-
- /// <summary>
- /// The envelope structure of the message.
- /// </summary>
- Envelope,
-
- /// <summary>
- /// The flags that are set for this message.
- /// </summary>
- Flags,
-
- /// <summary>
- /// The internal date of the message.
- /// </summary>
- InternalDate,
-
- /// <summary>
- /// Functionally equivalent to BODY[] ... (RFC822 is returned).
- /// </summary>
- Rfc822,
-
- /// <summary>
- /// Functionally equivalent to BODY.PEEK[HEADER] ... (RFC822.HEADER is returned).
- /// </summary>
- Rfc822Header,
-
- /// <summary>
- /// The [RFC-2822] size of the message.
- /// </summary>
- Rfc822Size,
-
- /// <summary>
- /// Functionally equivalent to BODY[TEXT] ... (RFC822.TEXT is returned).
- /// </summary>
- Rfc822Text,
-
- /// <summary>
- /// The unique identifier for the message.
- /// </summary>
- Uid
- }
- #endregion
-
- #region FetchDataItem
- /// <summary>
- /// Represents a single item in the fetch list.
- /// </summary>
- public class FetchDataItem {
- /// <summary>
- /// Creates a new item with the given type.
- /// </summary>
- /// <param name="dataType">The data type.</param>
- public FetchDataItem(FetchDataItemType dataType) {
- this.dataType = dataType;
- }
-
- private FetchDataItemType dataType;
-
- /// <summary>
- /// The type of item to fetch.
- /// </summary>
- public FetchDataItemType DataType {
- get {
- return this.dataType;
- }
- }
- }
- #endregion
-
- #region Fetch Body
- #region FetchBodyItem
- /// <summary>
- /// A class to hold the details of a FETCH on a BODY item.
- /// </summary>
- public class FetchBodyItem : FetchDataItem {
- /// <summary>
- /// Creates a new fetch body item from the given string.
- /// </summary>
- /// <param name="bodyString">The string to parse.</param>
- /// <param name="peek">True if the SEEN flag should not be set for this access.</param>
- public FetchBodyItem(string bodyString, bool peek)
- : base(peek ? FetchDataItemType.BodyPeek : FetchDataItemType.Body) {
-
- // Check if the fetch is partial
- if (bodyString.IndexOf('<') != -1) {
- parsePartial(bodyString);
- }
-
- if (bodyString.IndexOf('[') != -1) {
- // Extract the data out of "BODY[ ... ]"
- bodyString = bodyString.Substring(bodyString.IndexOf('[') + 1, bodyString.Length - bodyString.IndexOf('[') - 1);
- bodyString = bodyString.Substring(0, bodyString.IndexOf(']')).Trim();
- this.sectionName = bodyString;
-
- if (bodyString.StartsWith("HEADER")) {
- if (bodyString.StartsWith("HEADER.FIELDS")) {
- string headerArgs = bodyString.Substring(bodyString.IndexOf('(') + 1, bodyString.Length - bodyString.IndexOf('(') - 1);
- headerArgs = headerArgs.Substring(0, headerArgs.IndexOf(')')).Trim();
- this.headerFields = headerArgs.Split(' ');
-
- if (bodyString.StartsWith("HEADER.FIELDS.NOT")) {
- this.sectionType = FetchBodySectionType.HeaderFieldsNot;
- this.sectionName = "HEADER.FIELDS.NOT";
-
- } else {
- this.sectionType = FetchBodySectionType.HeaderFields;
- this.sectionName = "HEADER.FIELDS";
- }
-
- } else {
- this.sectionType = FetchBodySectionType.Header;
- }
-
- } else if (bodyString == "MIME") {
- this.sectionType = FetchBodySectionType.Mime;
-
- } else if (bodyString == "TEXT") {
- this.sectionType = FetchBodySectionType.Text;
-
- } else if (bodyString == string.Empty) {
- // No sections specified, default to all
- this.sectionType = FetchBodySectionType.All;
-
- } else {
- this.sectionType = FetchBodySectionType.Section;
- }
-
- } else {
- // No sections specified, default to all
- this.sectionType = FetchBodySectionType.All;
- this.sectionName = string.Empty;
- }
- }
-
- private void parsePartial(string data) {
- // Parse out the start and end. In the form: <start.end>
- string start = data.Substring(data.IndexOf('<') + 1, data.IndexOf('.') - 1);
- string length = data.Substring(data.IndexOf('.') + 1, data.IndexOf('>') - 1);
-
- this.partial = true;
- this.startOctet = Int32.Parse(start);
- this.length = Int32.Parse(length);
- }
-
- private bool partial;
-
- /// <summary>
- /// Indicates if this is a partial fetch
- /// </summary>
- public bool Partial {
- get {
- return this.partial;
- }
- }
-
- private int startOctet;
-
- /// <summary>
- /// The start of the partial fetch.
- /// </summary>
- public int StartOctet {
- get {
- if (!this.partial) throw new ArgumentException("Not a partial fetch.");
- return this.startOctet;
- }
- }
-
- private int length;
-
- /// <summary>
- /// The length of the partial fetch.
- /// </summary>
- public int Length {
- get {
- if (!this.partial) throw new ArgumentException("Not a partial fetch.");
- return this.length;
- }
- }
-
- private FetchBodySectionType sectionType;
-
- /// <summary>
- /// The type of body section fetch.
- /// </summary>
- public FetchBodySectionType SectionType {
- get {
- return this.sectionType;
- }
- }
-
- string sectionName;
-
- /// <summary>
- /// The section name for this body section fetch.
- /// </summary>
- public string SectionName {
- get {
- return this.sectionName;
- }
- }
-
- private string[] headerFields;
-
- /// <summary>
- /// The header fields associated with this section fetch.
- /// </summary>
- public string[] HeaderFields {
- get {
- return this.headerFields;
- }
- }
- }
- #endregion
-
- #region FetchBodySectionType
- /// <summary>
- /// The type of the body section to fetch.
- /// </summary>
- public enum FetchBodySectionType {
- /// <summary>
- /// Fetches the entire message including the header.
- /// </summary>
- All,
-
- /// <summary>
- /// Fetches the entire header.
- /// </summary>
- Header,
-
- /// <summary>
- /// Fetches only specified header fields.
- /// </summary>
- HeaderFields,
-
- /// <summary>
- /// Fetches all but the specified header fields.
- /// </summary>
- HeaderFieldsNot,
-
- /// <summary>
- /// Fetches MIME header for the given part.
- /// </summary>
- Mime,
-
- /// <summary>
- /// Fetches the body of the given part.
- /// </summary>
- Text,
-
- /// <summary>
- /// Fetches the section of the given part.
- /// </summary>
- Section
- }
- #endregion
- #endregion
- #endregion
}
Modified: NMail/trunk/NMail.ImapService/State/ExamineState.cs
===================================================================
--- NMail/trunk/NMail.ImapService/State/ExamineState.cs 2006-11-23 11:38:36 UTC (rev 93)
+++ NMail/trunk/NMail.ImapService/State/ExamineState.cs 2006-11-26 06:28:09 UTC (rev 94)
@@ -20,6 +20,7 @@
using System.Text;
using NMail.DataTypes;
+using NMail.DataTypes.Imap;
using NMail.DataTypes.LocalStore;
using NMail.Helper;
using NMail.ImapService.Command;
@@ -331,6 +332,17 @@
}
#endregion
+ protected virtual void sendBodyStructure(FetchResponse response, int messageUid) {
+ StringBuilder data = new StringBuilder();
+ data.Append("BODYSTRUCTURE ");
+
+ Message message = LocalStore.GetMessage(Session.AuthenticationToken, messageUid, Session.SelectedFolder);
+ BodyStructure bodyStructure = new BodyStructure(message);
+ data.Append(bodyStructure.ToString());
+
+ response.AppendResponseItem(data.ToString());
+ }
+
#region processMessageFetch
protected virtual void processMessageFetch(int messageId, bool usingUid, FetchDataList dataList) {
MessageHeaders messageHeaders = null;
@@ -369,8 +381,8 @@
break;
case FetchDataItemType.BodyStructure:
- // TODO BodyStructure
- throw new NotImplementedException("BODYSTRUCTURE not implemented.");
+ sendBodyStructure(response, messageUid);
+ break;
case FetchDataItemType.Envelope:
ensureMessageHeaders(messageUid, ref messageHeaders);
Modified: NMail/trunk/NMail.ImapService/State/SelectedState.cs
===================================================================
--- NMail/trunk/NMail.ImapService/State/SelectedState.cs 2006-11-23 11:38:36 UTC (rev 93)
+++ NMail/trunk/NMail.ImapService/State/SelectedState.cs 2006-11-26 06:28:09 UTC (rev 94)
@@ -19,6 +19,7 @@
using System.Text;
using NMail.DataTypes;
+using NMail.DataTypes.Imap;
using NMail.DataTypes.LocalStore;
using NMail.Helper;
using NMail.ImapService.Command;
Modified: NMail/trunk/NMail.LocalStoreData.MySql/MySqlLocalStoreData.cs
===================================================================
--- NMail/trunk/NMail.LocalStoreData.MySql/MySqlLocalStoreData.cs 2006-11-23 11:38:36 UTC (rev 93)
+++ NMail/trunk/NMail.LocalStoreData.MySql/MySqlLocalStoreData.cs 2006-11-26 06:28:09 UTC (rev 94)
@@ -108,7 +108,7 @@
if (message.MultipartBody) {
// Insert each part of the message
- for (int i = 0; i < message.MimeParts.Length; i++) {
+ for (int i = 0; i < message.MimeParts.Count; i++) {
// Insert the current part
cmd = cnn.CreateCommand();
cmd.Transaction = transaction;
@@ -131,9 +131,8 @@
cmd.Transaction = transaction;
cmd.Connection = cnn;
- // Part 0 is not counted below in GetMessageMimePartCount
cmd.CommandText = "INSERT INTO MessageData (MessageId, Part, Data) " +
- "VALUES (?MessageId, 0, ?Data)";
+ "VALUES (?MessageId, 1, ?Data)";
cmd.Parameters.Add("?MessageId", messageId);
cmd.Parameters.Add("?Data", message.BodyData.Bytes);
count = cmd.ExecuteNonQuery();
@@ -756,7 +755,7 @@
}
} else {
- cmd.CommandText = "SELECT md.Data FROM Message m, MessageData md WHERE m.MessageId = md.MessageId AND m.FolderId = ?FolderId AND m.FolderMessageId = ?FolderMessageId AND md.Part = 0";
+ cmd.CommandText = "SELECT md.Data FROM Message m, MessageData md WHERE m.MessageId = md.MessageId AND m.FolderId = ?FolderId AND m.FolderMessageId = ?FolderMessageId AND md.Part = 1";
cmd.Parameters.Add("?FolderId", folder.FolderId);
cmd.Parameters.Add("?FolderMessageId", messageId);
byte[] data = (byte[]) cmd.ExecuteScalar();
Added: NMail/trunk/doc/RFC/MIME/rfc2046_mime_part2.txt
===================================================================
--- NMail/trunk/doc/RFC/MIME/rfc2046_mime_part2.txt (rev 0)
+++ NMail/trunk/doc/RFC/MIME/rfc2046_mime_part2.txt 2006-11-26 06:28:09 UTC (rev 94)
@@ -0,0 +1,2467 @@
+
+
+
+
+
+
+Network Working Group N. Freed
+Request for Comments: 2046 Innosoft
+Obsoletes: 1521, 1522, 1590 N. Borenstein
+Category: Standards Track First Virtual
+ November 1996
+
+
+ Multipurpose Internet Mail Extensions
+ (MIME) Part Two:
+ Media Types
+
+Status of this Memo
+
+ This document specifies an Internet standards track protocol for the
+ Internet community, and requests discussion and suggestions for
+ improvements. Please refer to the current edition of the "Internet
+ Official Protocol Standards" (STD 1) for the standardization state
+ and status of this protocol. Distribution of this memo is unlimited.
+
+Abstract
+
+ STD 11, RFC 822 defines a message representation protocol specifying
+ considerable detail about US-ASCII message headers, but which leaves
+ the message content, or message body, as flat US-ASCII text. This
+ set of documents, collectively called the Multipurpose Internet Mail
+ Extensions, or MIME, redefines the format of messages to allow for
+
+ (1) textual message bodies in character sets other than
+ US-ASCII,
+
+ (2) an extensible set of different formats for non-textual
+ message bodies,
+
+ (3) multi-part message bodies, and
+
+ (4) textual header information in character sets other than
+ US-ASCII.
+
+ These documents are based on earlier work documented in RFC 934, STD
+ 11, and RFC 1049, but extends and revises them. Because RFC 822 said
+ so little about message bodies, these documents are largely
+ orthogonal to (rather than a revision of) RFC 822.
+
+ The initial document in this set, RFC 2045, specifies the various
+ headers used to describe the structure of MIME messages. This second
+ document defines the general structure of the MIME media typing
+ system and defines an initial set of media types. The third document,
+ RFC 2047, describes extensions to RFC 822 to allow non-US-ASCII text
+
+
+
+Freed & Borenstein Standards Track [Page 1]
+
+RFC 2046 Media Types November 1996
+
+
+ data in Internet mail header fields. The fourth document, RFC 2048,
+ specifies various IANA registration procedures for MIME-related
+ facilities. The fifth and final document, RFC 2049, describes MIME
+ conformance criteria as well as providing some illustrative examples
+ of MIME message formats, acknowledgements, and the bibliography.
+
+ These documents are revisions of RFCs 1521 and 1522, which themselves
+ were revisions of RFCs 1341 and 1342. An appendix in RFC 2049
+ describes differences and changes from previous versions.
+
+Table of Contents
+
+ 1. Introduction ......................................... 3
+ 2. Definition of a Top-Level Media Type ................. 4
+ 3. Overview Of The Initial Top-Level Media Types ........ 4
+ 4. Discrete Media Type Values ........................... 6
+ 4.1 Text Media Type ..................................... 6
+ 4.1.1 Representation of Line Breaks ..................... 7
+ 4.1.2 Charset Parameter ................................. 7
+ 4.1.3 Plain Subtype ..................................... 11
+ 4.1.4 Unrecognized Subtypes ............................. 11
+ 4.2 Image Media Type .................................... 11
+ 4.3 Audio Media Type .................................... 11
+ 4.4 Video Media Type .................................... 12
+ 4.5 Application Media Type .............................. 12
+ 4.5.1 Octet-Stream Subtype .............................. 13
+ 4.5.2 PostScript Subtype ................................ 14
+ 4.5.3 Other Application Subtypes ........................ 17
+ 5. Composite Media Type Values .......................... 17
+ 5.1 Multipart Media Type ................................ 17
+ 5.1.1 Common Syntax ..................................... 19
+ 5.1.2 Handling Nested Messages and Multiparts ........... 24
+ 5.1.3 Mixed Subtype ..................................... 24
+ 5.1.4 Alternative Subtype ............................... 24
+ 5.1.5 Digest Subtype .................................... 26
+ 5.1.6 Parallel Subtype .................................. 27
+ 5.1.7 Other Multipart Subtypes .......................... 28
+ 5.2 Message Media Type .................................. 28
+ 5.2.1 RFC822 Subtype .................................... 28
+ 5.2.2 Partial Subtype ................................... 29
+ 5.2.2.1 Message Fragmentation and Reassembly ............ 30
+ 5.2.2.2 Fragmentation and Reassembly Example ............ 31
+ 5.2.3 External-Body Subtype ............................. 33
+ 5.2.4 Other Message Subtypes ............................ 40
+ 6. Experimental Media Type Values ....................... 40
+ 7. Summary .............................................. 41
+ 8. Security Considerations .............................. 41
+ 9. Authors' Addresses ................................... 42
+
+
+
+Freed & Borenstein Standards Track [Page 2]
+
+RFC 2046 Media Types November 1996
+
+
+ A. Collected Grammar .................................... 43
+
+1. Introduction
+
+ The first document in this set, RFC 2045, defines a number of header
+ fields, including Content-Type. The Content-Type field is used to
+ specify the nature of the data in the body of a MIME entity, by
+ giving media type and subtype identifiers, and by providing auxiliary
+ information that may be required for certain media types. After the
+ type and subtype names, the remainder of the header field is simply a
+ set of parameters, specified in an attribute/value notation. The
+ ordering of parameters is not significant.
+
+ In general, the top-level media type is used to declare the general
+ type of data, while the subtype specifies a specific format for that
+ type of data. Thus, a media type of "image/xyz" is enough to tell a
+ user agent that the data is an image, even if the user agent has no
+ knowledge of the specific image format "xyz". Such information can
+ be used, for example, to decide whether or not to show a user the raw
+ data from an unrecognized subtype -- such an action might be
+ reasonable for unrecognized subtypes of "text", but not for
+ unrecognized subtypes of "image" or "audio". For this reason,
+ registered subtypes of "text", "image", "audio", and "video" should
+ not contain embedded information that is really of a different type.
+ Such compound formats should be represented using the "multipart" or
+ "application" types.
+
+ Parameters are modifiers of the media subtype, and as such do not
+ fundamentally affect the nature of the content. The set of
+ meaningful parameters depends on the media type and subtype. Most
+ parameters are associated with a single specific subtype. However, a
+ given top-level media type may define parameters which are applicable
+ to any subtype of that type. Parameters may be required by their
+ defining media type or subtype or they may be optional. MIME
+ implementations must also ignore any parameters whose names they do
+ not recognize.
+
+ MIME's Content-Type header field and media type mechanism has been
+ carefully designed to be extensible, and it is expected that the set
+ of media type/subtype pairs and their associated parameters will grow
+ significantly over time. Several other MIME facilities, such as
+ transfer encodings and "message/external-body" access types, are
+ likely to have new values defined over time. In order to ensure that
+ the set of such values is developed in an orderly, well-specified,
+ and public manner, MIME sets up a registration process which uses the
+ Internet Assigned Numbers Authority (IANA) as a central registry for
+ MIME's various areas of extensibility. The registration process for
+ these areas is described in a companion document, RFC 2048.
+
+
+
+Freed & Borenstein Standards Track [Page 3]
+
+RFC 2046 Media Types November 1996
+
+
+ The initial seven standard top-level media type are defined and
+ described in the remainder of this document.
+
+2. Definition of a Top-Level Media Type
+
+ The definition of a top-level media type consists of:
+
+ (1) a name and a description of the type, including
+ criteria for whether a particular type would qualify
+ under that type,
+
+ (2) the names and definitions of parameters, if any, which
+ are defined for all subtypes of that type (including
+ whether such parameters are required or optional),
+
+ (3) how a user agent and/or gateway should handle unknown
+ subtypes of this type,
+
+ (4) general considerations on gatewaying entities of this
+ top-level type, if any, and
+
+ (5) any restrictions on content-transfer-encodings for
+ entities of this top-level type.
+
+3. Overview Of The Initial Top-Level Media Types
+
+ The five discrete top-level media types are:
+
+ (1) text -- textual information. The subtype "plain" in
+ particular indicates plain text containing no
+ formatting commands or directives of any sort. Plain
+ text is intended to be displayed "as-is". No special
+ software is required to get the full meaning of the
+ text, aside from support for the indicated character
+ set. Other subtypes are to be used for enriched text in
+ forms where application software may enhance the
+ appearance of the text, but such software must not be
+ required in order to get the general idea of the
+ content. Possible subtypes of "text" thus include any
+ word processor format that can be read without
+ resorting to software that understands the format. In
+ particular, formats that employ embeddded binary
+ formatting information are not considered directly
+ readable. A very simple and portable subtype,
+ "richtext", was defined in RFC 1341, with a further
+ revision in RFC 1896 under the name "enriched".
+
+
+
+
+
+Freed & Borenstein Standards Track [Page 4]
+
+RFC 2046 Media Types November 1996
+
+
+ (2) image -- image data. "Image" requires a display device
+ (such as a graphical display, a graphics printer, or a
+ FAX machine) to view the information. An initial
+ subtype is defined for the widely-used image format
+ JPEG. . subtypes are defined for two widely-used image
+ formats, jpeg and gif.
+
+ (3) audio -- audio data. "Audio" requires an audio output
+ device (such as a speaker or a telephone) to "display"
+ the contents. An initial subtype "basic" is defined in
+ this document.
+
+ (4) video -- video data. "Video" requires the capability
+ to display moving images, typically including
+ specialized hardware and software. An initial subtype
+ "mpeg" is defined in this document.
+
+ (5) application -- some other kind of data, typically
+ either uninterpreted binary data or information to be
+ processed by an application. The subtype "octet-
+ stream" is to be used in the case of uninterpreted
+ binary data, in which case the simplest recommended
+ action is to offer to write the information into a file
+ for the user. The "PostScript" subtype is also defined
+ for the transport of PostScript material. Other
+ expected uses for "application" include spreadsheets,
+ data for mail-based scheduling systems, and languages
+ for "active" (computational) messaging, and word
+ processing formats that are not directly readable.
+ Note that security considerations may exist for some
+ types of application data, most notably
+ "application/PostScript" and any form of active
+ messaging. These issues are discussed later in this
+ document.
+
+ The two composite top-level media types are:
+
+ (1) multipart -- data consisting of multiple entities of
+ independent data types. Four subtypes are initially
+ defined, including the basic "mixed" subtype specifying
+ a generic mixed set of parts, "alternative" for
+ representing the same data in multiple formats,
+ "parallel" for parts intended to be viewed
+ simultaneously, and "digest" for multipart entities in
+ which each part has a default type of "message/rfc822".
+
+
+
+
+
+
+Freed & Borenstein Standards Track [Page 5]
+
+RFC 2046 Media Types November 1996
+
+
+ (2) message -- an encapsulated message. A body of media
+ type "message" is itself all or a portion of some kind
+ of message object. Such objects may or may not in turn
+ contain other entities. The "rfc822" subtype is used
+ when the encapsulated content is itself an RFC 822
+ message. The "partial" subtype is defined for partial
+ RFC 822 messages, to permit the fragmented transmission
+ of bodies that are thought to be too large to be passed
+ through transport facilities in one piece. Another
+ subtype, "external-body", is defined for specifying
+ large bodies by reference to an external data source.
+
+ It should be noted that the list of media type values given here may
+ be augmented in time, via the mechanisms described above, and that
+ the set of subtypes is expected to grow substantially.
+
+4. Discrete Media Type Values
+
+ Five of the seven initial media type values refer to discrete bodies.
+ The content of these types must be handled by non-MIME mechanisms;
+ they are opaque to MIME processors.
+
+4.1. Text Media Type
+
+ The "text" media type is intended for sending material which is
+ principally textual in form. A "charset" parameter may be used to
+ indicate the character set of the body text for "text" subtypes,
+ notably including the subtype "text/plain", which is a generic
+ subtype for plain text. Plain text does not provide for or allow
+ formatting commands, font attribute specifications, processing
+ instructions, interpretation directives, or content markup. Plain
+ text is seen simply as a linear sequence of characters, possibly
+ interrupted by line breaks or page breaks. Plain text may allow the
+ stacking of several characters in the same position in the text.
+ Plain text in scripts like Arabic and Hebrew may also include
+ facilitites that allow the arbitrary mixing of text segments with
+ opposite writing directions.
+
+ Beyond plain text, there are many formats for representing what might
+ be known as "rich text". An interesting characteristic of many such
+ representations is that they are to some extent readable even without
+ the software that interprets them. It is useful, then, to
+ distinguish them, at the highest level, from such unreadable data as
+ images, audio, or text represented in an unreadable form. In the
+ absence of appropriate interpretation software, it is reasonable to
+ show subtypes of "text" to the user, while it is not reasonable to do
+ so with most nontextual data. Such formatted textual data should be
+ represented using subtypes of "text".
+
+
+
+Freed & Borenstein Standards Track [Page 6]
+
+RFC 2046 Media Types November 1996
+
+
+4.1.1. Representation of Line Breaks
+
+ The canonical form of any MIME "text" subtype MUST always represent a
+ line break as a CRLF sequence. Similarly, any occurrence of CRLF in
+ MIME "text" MUST represent a line break. Use of CR and LF outside of
+ line break sequences is also forbidden.
+
+ This rule applies regardless of format or character set or sets
+ involved.
+
+ NOTE: The proper interpretation of line breaks when a body is
+ displayed depends on the media type. In particular, while it is
+ appropriate to treat a line break as a transition to a new line when
+ displaying a "text/plain" body, this treatment is actually incorrect
+ for other subtypes of "text" like "text/enriched" [RFC-1896].
+ Similarly, whether or not line breaks should be added during display
+ operations is also a function of the media type. It should not be
+ necessary to add any line breaks to display "text/plain" correctly,
+ whereas proper display of "text/enriched" requires the appropriate
+ addition of line breaks.
+
+ NOTE: Some protocols defines a maximum line length. E.g. SMTP [RFC-
+ 821] allows a maximum of 998 octets before the next CRLF sequence.
+ To be transported by such protocols, data which includes too long
+ segments without CRLF sequences must be encoded with a suitable
+ content-transfer-encoding.
+
+4.1.2. Charset Parameter
+
+ A critical parameter that may be specified in the Content-Type field
+ for "text/plain" data is the character set. This is specified with a
+ "charset" parameter, as in:
+
+ Content-type: text/plain; charset=iso-8859-1
+
+ Unlike some other parameter values, the values of the charset
+ parameter are NOT case sensitive. The default character set, which
+ must be assumed in the absence of a charset parameter, is US-ASCII.
+
+ The specification for any future subtypes of "text" must specify
+ whether or not they will also utilize a "charset" parameter, and may
+ possibly restrict its values as well. For other subtypes of "text"
+ than "text/plain", the semantics of the "charset" parameter should be
+ defined to be identical to those specified here for "text/plain",
+ i.e., the body consists entirely of characters in the given charset.
+ In particular, definers of future "text" subtypes should pay close
+ attention to the implications of multioctet character sets for th...
[truncated message content] |
|
From: <tmy...@us...> - 2006-11-23 11:38:38
|
Revision: 93
http://svn.sourceforge.net/nmailserver/?rev=93&view=rev
Author: tmyroadctfig
Date: 2006-11-23 03:38:36 -0800 (Thu, 23 Nov 2006)
Log Message:
-----------
Added changelog and HMAC RFC.
Added Paths:
-----------
NMail/trunk/doc/ChangeLog.txt
NMail/trunk/doc/RFC/rfc2104.txt
Added: NMail/trunk/doc/ChangeLog.txt
===================================================================
--- NMail/trunk/doc/ChangeLog.txt (rev 0)
+++ NMail/trunk/doc/ChangeLog.txt 2006-11-23 11:38:36 UTC (rev 93)
@@ -0,0 +1,14 @@
+2006 - Version 1.1
+
+ Defects fixed or addressed
+ --------------------------
+
+ Bug #1601681 - Internal date reported as "publicdate". [fixed]
+ Bug #1601133 - No message body for non-MIME message. [fixed]
+ Bug #1601117 - No message body. [fixed]
+
+
+ Other features added
+ --------------------------
+
+ * Partially implemented IMAP search functionality.
\ No newline at end of file
Added: NMail/trunk/doc/RFC/rfc2104.txt
===================================================================
--- NMail/trunk/doc/RFC/rfc2104.txt (rev 0)
+++ NMail/trunk/doc/RFC/rfc2104.txt 2006-11-23 11:38:36 UTC (rev 93)
@@ -0,0 +1,619 @@
+
+
+
+
+
+
+Network Working Group H. Krawczyk
+Request for Comments: 2104 IBM
+Category: Informational M. Bellare
+ UCSD
+ R. Canetti
+ IBM
+ February 1997
+
+
+ HMAC: Keyed-Hashing for Message Authentication
+
+Status of This Memo
+
+ This memo provides information for the Internet community. This memo
+ does not specify an Internet standard of any kind. Distribution of
+ this memo is unlimited.
+
+Abstract
+
+ This document describes HMAC, a mechanism for message authentication
+ using cryptographic hash functions. HMAC can be used with any
+ iterative cryptographic hash function, e.g., MD5, SHA-1, in
+ combination with a secret shared key. The cryptographic strength of
+ HMAC depends on the properties of the underlying hash function.
+
+1. Introduction
+
+ Providing a way to check the integrity of information transmitted
+ over or stored in an unreliable medium is a prime necessity in the
+ world of open computing and communications. Mechanisms that provide
+ such integrity check based on a secret key are usually called
+ "message authentication codes" (MAC). Typically, message
+ authentication codes are used between two parties that share a secret
+ key in order to validate information transmitted between these
+ parties. In this document we present such a MAC mechanism based on
+ cryptographic hash functions. This mechanism, called HMAC, is based
+ on work by the authors [BCK1] where the construction is presented and
+ cryptographically analyzed. We refer to that work for the details on
+ the rationale and security analysis of HMAC, and its comparison to
+ other keyed-hash methods.
+
+
+
+
+
+
+
+
+
+
+
+Krawczyk, et. al. Informational [Page 1]
+
+RFC 2104 HMAC February 1997
+
+
+ HMAC can be used in combination with any iterated cryptographic hash
+ function. MD5 and SHA-1 are examples of such hash functions. HMAC
+ also uses a secret key for calculation and verification of the
+ message authentication values. The main goals behind this
+ construction are
+
+ * To use, without modifications, available hash functions.
+ In particular, hash functions that perform well in software,
+ and for which code is freely and widely available.
+
+ * To preserve the original performance of the hash function without
+ incurring a significant degradation.
+
+ * To use and handle keys in a simple way.
+
+ * To have a well understood cryptographic analysis of the strength of
+ the authentication mechanism based on reasonable assumptions on the
+ underlying hash function.
+
+ * To allow for easy replaceability of the underlying hash function in
+ case that faster or more secure hash functions are found or
+ required.
+
+ This document specifies HMAC using a generic cryptographic hash
+ function (denoted by H). Specific instantiations of HMAC need to
+ define a particular hash function. Current candidates for such hash
+ functions include SHA-1 [SHA], MD5 [MD5], RIPEMD-128/160 [RIPEMD].
+ These different realizations of HMAC will be denoted by HMAC-SHA1,
+ HMAC-MD5, HMAC-RIPEMD, etc.
+
+ Note: To the date of writing of this document MD5 and SHA-1 are the
+ most widely used cryptographic hash functions. MD5 has been recently
+ shown to be vulnerable to collision search attacks [Dobb]. This
+ attack and other currently known weaknesses of MD5 do not compromise
+ the use of MD5 within HMAC as specified in this document (see
+ [Dobb]); however, SHA-1 appears to be a cryptographically stronger
+ function. To this date, MD5 can be considered for use in HMAC for
+ applications where the superior performance of MD5 is critical. In
+ any case, implementers and users need to be aware of possible
+ cryptanalytic developments regarding any of these cryptographic hash
+ functions, and the eventual need to replace the underlying hash
+ function. (See section 6 for more information on the security of
+ HMAC.)
+
+
+
+
+
+
+
+
+Krawczyk, et. al. Informational [Page 2]
+
+RFC 2104 HMAC February 1997
+
+
+2. Definition of HMAC
+
+ The definition of HMAC requires a cryptographic hash function, which
+ we denote by H, and a secret key K. We assume H to be a cryptographic
+ hash function where data is hashed by iterating a basic compression
+ function on blocks of data. We denote by B the byte-length of such
+ blocks (B=64 for all the above mentioned examples of hash functions),
+ and by L the byte-length of hash outputs (L=16 for MD5, L=20 for
+ SHA-1). The authentication key K can be of any length up to B, the
+ block length of the hash function. Applications that use keys longer
+ than B bytes will first hash the key using H and then use the
+ resultant L byte string as the actual key to HMAC. In any case the
+ minimal recommended length for K is L bytes (as the hash output
+ length). See section 3 for more information on keys.
+
+ We define two fixed and different strings ipad and opad as follows
+ (the 'i' and 'o' are mnemonics for inner and outer):
+
+ ipad = the byte 0x36 repeated B times
+ opad = the byte 0x5C repeated B times.
+
+ To compute HMAC over the data `text' we perform
+
+ H(K XOR opad, H(K XOR ipad, text))
+
+ Namely,
+
+ (1) append zeros to the end of K to create a B byte string
+ (e.g., if K is of length 20 bytes and B=64, then K will be
+ appended with 44 zero bytes 0x00)
+ (2) XOR (bitwise exclusive-OR) the B byte string computed in step
+ (1) with ipad
+ (3) append the stream of data 'text' to the B byte string resulting
+ from step (2)
+ (4) apply H to the stream generated in step (3)
+ (5) XOR (bitwise exclusive-OR) the B byte string computed in
+ step (1) with opad
+ (6) append the H result from step (4) to the B byte string
+ resulting from step (5)
+ (7) apply H to the stream generated in step (6) and output
+ the result
+
+ For illustration purposes, sample code based on MD5 is provided as an
+ appendix.
+
+
+
+
+
+
+
+Krawczyk, et. al. Informational [Page 3]
+
+RFC 2104 HMAC February 1997
+
+
+3. Keys
+
+ The key for HMAC can be of any length (keys longer than B bytes are
+ first hashed using H). However, less than L bytes is strongly
+ discouraged as it would decrease the security strength of the
+ function. Keys longer than L bytes are acceptable but the extra
+ length would not significantly increase the function strength. (A
+ longer key may be advisable if the randomness of the key is
+ considered weak.)
+
+ Keys need to be chosen at random (or using a cryptographically strong
+ pseudo-random generator seeded with a random seed), and periodically
+ refreshed. (Current attacks do not indicate a specific recommended
+ frequency for key changes as these attacks are practically
+ infeasible. However, periodic key refreshment is a fundamental
+ security practice that helps against potential weaknesses of the
+ function and keys, and limits the damage of an exposed key.)
+
+4. Implementation Note
+
+ HMAC is defined in such a way that the underlying hash function H can
+ be used with no modification to its code. In particular, it uses the
+ function H with the pre-defined initial value IV (a fixed value
+ specified by each iterative hash function to initialize its
+ compression function). However, if desired, a performance
+ improvement can be achieved at the cost of (possibly) modifying the
+ code of H to support variable IVs.
+
+ The idea is that the intermediate results of the compression function
+ on the B-byte blocks (K XOR ipad) and (K XOR opad) can be precomputed
+ only once at the time of generation of the key K, or before its first
+ use. These intermediate results are stored and then used to
+ initialize the IV of H each time that a message needs to be
+ authenticated. This method saves, for each authenticated message,
+ the application of the compression function of H on two B-byte blocks
+ (i.e., on (K XOR ipad) and (K XOR opad)). Such a savings may be
+ significant when authenticating short streams of data. We stress
+ that the stored intermediate values need to be treated and protected
+ the same as secret keys.
+
+ Choosing to implement HMAC in the above way is a decision of the
+ local implementation and has no effect on inter-operability.
+
+
+
+
+
+
+
+
+
+Krawczyk, et. al. Informational [Page 4]
+
+RFC 2104 HMAC February 1997
+
+
+5. Truncated output
+
+ A well-known practice with message authentication codes is to
+ truncate the output of the MAC and output only part of the bits
+ (e.g., [MM, ANSI]). Preneel and van Oorschot [PV] show some
+ analytical advantages of truncating the output of hash-based MAC
+ functions. The results in this area are not absolute as for the
+ overall security advantages of truncation. It has advantages (less
+ information on the hash result available to an attacker) and
+ disadvantages (less bits to predict for the attacker). Applications
+ of HMAC can choose to truncate the output of HMAC by outputting the t
+ leftmost bits of the HMAC computation for some parameter t (namely,
+ the computation is carried in the normal way as defined in section 2
+ above but the end result is truncated to t bits). We recommend that
+ the output length t be not less than half the length of the hash
+ output (to match the birthday attack bound) and not less than 80 bits
+ (a suitable lower bound on the number of bits that need to be
+ predicted by an attacker). We propose denoting a realization of HMAC
+ that uses a hash function H with t bits of output as HMAC-H-t. For
+ example, HMAC-SHA1-80 denotes HMAC computed using the SHA-1 function
+ and with the output truncated to 80 bits. (If the parameter t is not
+ specified, e.g. HMAC-MD5, then it is assumed that all the bits of the
+ hash are output.)
+
+6. Security
+
+ The security of the message authentication mechanism presented here
+ depends on cryptographic properties of the hash function H: the
+ resistance to collision finding (limited to the case where the
+ initial value is secret and random, and where the output of the
+ function is not explicitly available to the attacker), and the
+ message authentication property of the compression function of H when
+ applied to single blocks (in HMAC these blocks are partially unknown
+ to an attacker as they contain the result of the inner H computation
+ and, in particular, cannot be fully chosen by the attacker).
+
+ These properties, and actually stronger ones, are commonly assumed
+ for hash functions of the kind used with HMAC. In particular, a hash
+ function for which the above properties do not hold would become
+ unsuitable for most (probably, all) cryptographic applications,
+ including alternative message authentication schemes based on such
+ functions. (For a complete analysis and rationale of the HMAC
+ function the reader is referred to [BCK1].)
+
+
+
+
+
+
+
+
+Krawczyk, et. al. Informational [Page 5]
+
+RFC 2104 HMAC February 1997
+
+
+ Given the limited confidence gained so far as for the cryptographic
+ strength of candidate hash functions, it is important to observe the
+ following two properties of the HMAC construction and its secure use
+ for message authentication:
+
+ 1. The construction is independent of the details of the particular
+ hash function H in use and then the latter can be replaced by any
+ other secure (iterative) cryptographic hash function.
+
+ 2. Message authentication, as opposed to encryption, has a
+ "transient" effect. A published breaking of a message authentication
+ scheme would lead to the replacement of that scheme, but would have
+ no adversarial effect on information authenticated in the past. This
+ is in sharp contrast with encryption, where information encrypted
+ today may suffer from exposure in the future if, and when, the
+ encryption algorithm is broken.
+
+ The strongest attack known against HMAC is based on the frequency of
+ collisions for the hash function H ("birthday attack") [PV,BCK2], and
+ is totally impractical for minimally reasonable hash functions.
+
+ As an example, if we consider a hash function like MD5 where the
+ output length equals L=16 bytes (128 bits) the attacker needs to
+ acquire the correct message authentication tags computed (with the
+ _same_ secret key K!) on about 2**64 known plaintexts. This would
+ require the processing of at least 2**64 blocks under H, an
+ impossible task in any realistic scenario (for a block length of 64
+ bytes this would take 250,000 years in a continuous 1Gbps link, and
+ without changing the secret key K during all this time). This attack
+ could become realistic only if serious flaws in the collision
+ behavior of the function H are discovered (e.g. collisions found
+ after 2**30 messages). Such a discovery would determine the immediate
+ replacement of the function H (the effects of such failure would be
+ far more severe for the traditional uses of H in the context of
+ digital signatures, public key certificates, etc.).
+
+ Note: this attack needs to be strongly contrasted with regular
+ collision attacks on cryptographic hash functions where no secret key
+ is involved and where 2**64 off-line parallelizable (!) operations
+ suffice to find collisions. The latter attack is approaching
+ feasibility [VW] while the birthday attack on HMAC is totally
+ impractical. (In the above examples, if one uses a hash function
+ with, say, 160 bit of output then 2**64 should be replaced by 2**80.)
+
+
+
+
+
+
+
+
+Krawczyk, et. al. Informational [Page 6]
+
+RFC 2104 HMAC February 1997
+
+
+ A correct implementation of the above construction, the choice of
+ random (or cryptographically pseudorandom) keys, a secure key
+ exchange mechanism, frequent key refreshments, and good secrecy
+ protection of keys are all essential ingredients for the security of
+ the integrity verification mechanism provided by HMAC.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Krawczyk, et. al. Informational [Page 7]
+
+RFC 2104 HMAC February 1997
+
+
+Appendix -- Sample Code
+
+ For the sake of illustration we provide the following sample code for
+ the implementation of HMAC-MD5 as well as some corresponding test
+ vectors (the code is based on MD5 code as described in [MD5]).
+
+/*
+** Function: hmac_md5
+*/
+
+void
+hmac_md5(text, text_len, key, key_len, digest)
+unsigned char* text; /* pointer to data stream */
+int text_len; /* length of data stream */
+unsigned char* key; /* pointer to authentication key */
+int key_len; /* length of authentication key */
+caddr_t digest; /* caller digest to be filled in */
+
+{
+ MD5_CTX context;
+ unsigned char k_ipad[65]; /* inner padding -
+ * key XORd with ipad
+ */
+ unsigned char k_opad[65]; /* outer padding -
+ * key XORd with opad
+ */
+ unsigned char tk[16];
+ int i;
+ /* if key is longer than 64 bytes reset it to key=MD5(key) */
+ if (key_len > 64) {
+
+ MD5_CTX tctx;
+
+ MD5Init(&tctx);
+ MD5Update(&tctx, key, key_len);
+ MD5Final(tk, &tctx);
+
+ key = tk;
+ key_len = 16;
+ }
+
+ /*
+ * the HMAC_MD5 transform looks like:
+ *
+ * MD5(K XOR opad, MD5(K XOR ipad, text))
+ *
+ * where K is an n byte key
+ * ipad is the byte 0x36 repeated 64 times
+
+
+
+Krawczyk, et. al. Informational [Page 8]
+
+RFC 2104 HMAC February 1997
+
+
+ * opad is the byte 0x5c repeated 64 times
+ * and text is the data being protected
+ */
+
+ /* start out by storing key in pads */
+ bzero( k_ipad, sizeof k_ipad);
+ bzero( k_opad, sizeof k_opad);
+ bcopy( key, k_ipad, key_len);
+ bcopy( key, k_opad, key_len);
+
+ /* XOR key with ipad and opad values */
+ for (i=0; i<64; i++) {
+ k_ipad[i] ^= 0x36;
+ k_opad[i] ^= 0x5c;
+ }
+ /*
+ * perform inner MD5
+ */
+ MD5Init(&context); /* init context for 1st
+ * pass */
+ MD5Update(&context, k_ipad, 64) /* start with inner pad */
+ MD5Update(&context, text, text_len); /* then text of datagram */
+ MD5Final(digest, &context); /* finish up 1st pass */
+ /*
+ * perform outer MD5
+ */
+ MD5Init(&context); /* init context for 2nd
+ * pass */
+ MD5Update(&context, k_opad, 64); /* start with outer pad */
+ MD5Update(&context, digest, 16); /* then results of 1st
+ * hash */
+ MD5Final(digest, &context); /* finish up 2nd pass */
+}
+
+Test Vectors (Trailing '\0' of a character string not included in test):
+
+ key = 0x0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b
+ key_len = 16 bytes
+ data = "Hi There"
+ data_len = 8 bytes
+ digest = 0x9294727a3638bb1c13f48ef8158bfc9d
+
+ key = "Jefe"
+ data = "what do ya want for nothing?"
+ data_len = 28 bytes
+ digest = 0x750c783e6ab0b503eaa86e310a5db738
+
+ key = 0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+
+
+
+Krawczyk, et. al. Informational [Page 9]
+
+RFC 2104 HMAC February 1997
+
+
+ key_len 16 bytes
+ data = 0xDDDDDDDDDDDDDDDDDDDD...
+ ..DDDDDDDDDDDDDDDDDDDD...
+ ..DDDDDDDDDDDDDDDDDDDD...
+ ..DDDDDDDDDDDDDDDDDDDD...
+ ..DDDDDDDDDDDDDDDDDDDD
+ data_len = 50 bytes
+ digest = 0x56be34521d144c88dbb8c733f0e8b3f6
+
+Acknowledgments
+
+ Pau-Chen Cheng, Jeff Kraemer, and Michael Oehler, have provided
+ useful comments on early drafts, and ran the first interoperability
+ tests of this specification. Jeff and Pau-Chen kindly provided the
+ sample code and test vectors that appear in the appendix. Burt
+ Kaliski, Bart Preneel, Matt Robshaw, Adi Shamir, and Paul van
+ Oorschot have provided useful comments and suggestions during the
+ investigation of the HMAC construction.
+
+References
+
+ [ANSI] ANSI X9.9, "American National Standard for Financial
+ Institution Message Authentication (Wholesale)," American
+ Bankers Association, 1981. Revised 1986.
+
+ [Atk] Atkinson, R., "IP Authentication Header", RFC 1826, August
+ 1995.
+
+ [BCK1] M. Bellare, R. Canetti, and H. Krawczyk,
+ "Keyed Hash Functions and Message Authentication",
+ Proceedings of Crypto'96, LNCS 1109, pp. 1-15.
+ (http://www.research.ibm.com/security/keyed-md5.html)
+
+ [BCK2] M. Bellare, R. Canetti, and H. Krawczyk,
+ "Pseudorandom Functions Revisited: The Cascade Construction",
+ Proceedings of FOCS'96.
+
+ [Dobb] H. Dobbertin, "The Status of MD5 After a Recent Attack",
+ RSA Labs' CryptoBytes, Vol. 2 No. 2, Summer 1996.
+ http://www.rsa.com/rsalabs/pubs/cryptobytes.html
+
+ [PV] B. Preneel and P. van Oorschot, "Building fast MACs from hash
+ functions", Advances in Cryptology -- CRYPTO'95 Proceedings,
+ Lecture Notes in Computer Science, Springer-Verlag Vol.963,
+ 1995, pp. 1-14.
+
+ [MD5] Rivest, R., "The MD5 Message-Digest Algorithm",
+ RFC 1321, April 1992.
+
+
+
+Krawczyk, et. al. Informational [Page 10]
+
+RFC 2104 HMAC February 1997
+
+
+ [MM] Meyer, S. and Matyas, S.M., Cryptography, New York Wiley,
+ 1982.
+
+ [RIPEMD] H. Dobbertin, A. Bosselaers, and B. Preneel, "RIPEMD-160: A
+ strengthened version of RIPEMD", Fast Software Encryption,
+ LNCS Vol 1039, pp. 71-82.
+ ftp://ftp.esat.kuleuven.ac.be/pub/COSIC/bosselae/ripemd/.
+
+ [SHA] NIST, FIPS PUB 180-1: Secure Hash Standard, April 1995.
+
+ [Tsu] G. Tsudik, "Message authentication with one-way hash
+ functions", In Proceedings of Infocom'92, May 1992.
+ (Also in "Access Control and Policy Enforcement in
+ Internetworks", Ph.D. Dissertation, Computer Science
+ Department, University of Southern California, April 1991.)
+
+ [VW] P. van Oorschot and M. Wiener, "Parallel Collision
+ Search with Applications to Hash Functions and Discrete
+ Logarithms", Proceedings of the 2nd ACM Conf. Computer and
+ Communications Security, Fairfax, VA, November 1994.
+
+Authors' Addresses
+
+ Hugo Krawczyk
+ IBM T.J. Watson Research Center
+ P.O.Box 704
+ Yorktown Heights, NY 10598
+
+ EMail: hu...@wa...
+
+ Mihir Bellare
+ Dept of Computer Science and Engineering
+ Mail Code 0114
+ University of California at San Diego
+ 9500 Gilman Drive
+ La Jolla, CA 92093
+
+ EMail: mi...@cs...
+
+ Ran Canetti
+ IBM T.J. Watson Research Center
+ P.O.Box 704
+ Yorktown Heights, NY 10598
+
+ EMail: ca...@wa...
+
+
+
+
+
+
+Krawczyk, et. al. Informational [Page 11]
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tmy...@us...> - 2006-11-23 11:34:44
|
Revision: 92
http://svn.sourceforge.net/nmailserver/?rev=92&view=rev
Author: tmyroadctfig
Date: 2006-11-23 03:34:41 -0800 (Thu, 23 Nov 2006)
Log Message:
-----------
Partially implemented search functionality. Fixed a defect with internal date (BUG 1601681).
Modified Paths:
--------------
NMail/trunk/NMail.ImapService/Command/ImapMessageList.cs
NMail/trunk/NMail.ImapService/Command/SearchCommand.cs
NMail/trunk/NMail.ImapService/Response/SearchResponse.cs
NMail/trunk/NMail.ImapService/State/ExamineState.cs
NMail/trunk/NMail.ImapService/State/SelectedState.cs
Modified: NMail/trunk/NMail.ImapService/Command/ImapMessageList.cs
===================================================================
--- NMail/trunk/NMail.ImapService/Command/ImapMessageList.cs 2006-11-23 11:09:39 UTC (rev 91)
+++ NMail/trunk/NMail.ImapService/Command/ImapMessageList.cs 2006-11-23 11:34:41 UTC (rev 92)
@@ -16,39 +16,23 @@
*/
using System;
-using System.Collections;
+using System.Collections.Generic;
namespace NMail.ImapService.Command {
/// <summary>
/// Represents a list of messages to process in an IMAP command.
/// </summary>
- public class ImapMessageList {
+ public class ImapMessageList : List<ImapMessageListItem> {
/// <summary>
- /// Internal storage for the message list.
- /// </summary>
- private ArrayList list;
-
- /// <summary>
/// Creates a new list from the given string.
/// </summary>
/// <param name="messageList">The IMAP message list to parse.</param>
public ImapMessageList(string messageList) {
- this.list = new ArrayList();
-
string[] listParts = messageList.Split(',');
foreach (string part in listParts) {
- this.list.Add(new ImapMessageListItem(part));
+ this.Add(new ImapMessageListItem(part));
}
}
-
- /// <summary>
- /// Returns the list of messages to retieve data for.
- /// </summary>
- public ImapMessageListItem[] ImapMessageListItem {
- get {
- return (ImapMessageListItem[]) this.list.ToArray(typeof(ImapMessageListItem));
- }
- }
}
#region ImapMessageListItemType
@@ -103,6 +87,27 @@
}
}
+ /// <summary>
+ /// Checks if an item number matches this list item.
+ /// </summary>
+ /// <param name="itemNumber">The number to check.</param>
+ /// <returns>True if the number matches.</returns>
+ public bool Matches(int itemNumber) {
+ switch (this.itemType) {
+ case ImapMessageListItemType.Single:
+ return (itemNumber == this.start);
+
+ case ImapMessageListItemType.BoundedRange:
+ return (itemNumber >= this.start && itemNumber <= this.end);
+
+ case ImapMessageListItemType.UnboundedRange:
+ return (itemNumber >= this.start);
+
+ default:
+ throw new ArgumentException("Invalid item list type.");
+ }
+ }
+
private ImapMessageListItemType itemType;
/// <summary>
Modified: NMail/trunk/NMail.ImapService/Command/SearchCommand.cs
===================================================================
--- NMail/trunk/NMail.ImapService/Command/SearchCommand.cs 2006-11-23 11:09:39 UTC (rev 91)
+++ NMail/trunk/NMail.ImapService/Command/SearchCommand.cs 2006-11-23 11:34:41 UTC (rev 92)
@@ -16,21 +16,57 @@
*/
using System;
+using System.Collections.Generic;
-namespace NMail.ImapService.Command
-{
+namespace NMail.ImapService.Command {
/// <summary>
/// Summary description for SearchCommand.
/// </summary>
[CommandToken("SEARCH")]
- public class SearchCommand : AbstractCommand
- {
+ public class SearchCommand : AbstractCommand, IUidCommand {
public override void Create(string tag, string data) {
base.Create(tag, data);
// Parse the arguments
- string[] tokens = GetDataTokens();
+ List<string> tokens = new List<string>(GetDataTokens());
+
+ // Check for charset
+
+ // Parse list of search items
+ while (tokens.Count > 0) {
+ switch (tokens[0].ToUpper()) {
+ case "UID":
+ if (tokens.Count == 1) {
+ throw new ArgumentException("UID search items requires a set of messages.");
+ }
+ this.searchItems.Add(new UidSearchItem(tokens[1]));
+ tokens.RemoveRange(0, 2);
+ break;
+
+ default:
+ throw new ArgumentException("Invalid item in SEARCH list.");
+ }
+ }
}
+
+ List<SearchItem> searchItems = new List<SearchItem>();
+
+ public SearchItem[] SearchItems {
+ get {
+ return this.searchItems.ToArray();
+ }
+ }
+
+ private bool uidCommand;
+
+ public bool UidCommand {
+ get {
+ return this.uidCommand;
+ }
+ set {
+ this.uidCommand = value;
+ }
+ }
}
#region SearchItemType
@@ -117,7 +153,7 @@
/// Messages that don't have the recent flag set.
/// </summary>
Old,
-
+
/// <summary>
/// The message is sent on the given date (ignoring time and timezone).
/// </summary>
@@ -192,7 +228,7 @@
/// Messages without the answered flag.
/// </summary>
Unanswered,
-
+
/// <summary>
/// Messages without the deleted flag.
/// </summary>
@@ -219,4 +255,32 @@
Unseen
}
#endregion
-}
+
+ public class SearchItem {
+
+ protected SearchItemType searchType;
+
+ /// <summary>
+ /// The search type for this item.
+ /// </summary>
+ public SearchItemType SearchType {
+ get { return searchType; }
+ }
+ }
+
+ public class UidSearchItem : SearchItem {
+ public UidSearchItem(string sequenceSet) {
+ this.searchType = SearchItemType.Uid;
+
+ this.messageList = new ImapMessageList(sequenceSet);
+ }
+
+ ImapMessageList messageList;
+
+ public ImapMessageList MessageList {
+ get {
+ return this.messageList;
+ }
+ }
+ }
+}
\ No newline at end of file
Modified: NMail/trunk/NMail.ImapService/Response/SearchResponse.cs
===================================================================
--- NMail/trunk/NMail.ImapService/Response/SearchResponse.cs 2006-11-23 11:09:39 UTC (rev 91)
+++ NMail/trunk/NMail.ImapService/Response/SearchResponse.cs 2006-11-23 11:34:41 UTC (rev 92)
@@ -16,19 +16,33 @@
*/
using System;
+using System.Collections.Generic;
+using System.Text;
-namespace NMail.ImapService.Response
-{
+namespace NMail.ImapService.Response {
/// <summary>
- /// Summary description for SearchResponse.
+ /// The response to a search command.
/// </summary>
- public class SearchResponse
- {
- public SearchResponse()
- {
- //
- // TODO: Add constructor logic here
- //
+ public class SearchResponse : AbstractResponse {
+ protected List<int> messageIds;
+
+ /// <summary>
+ /// Creates a new search response with the given list of message Ids.
+ /// </summary>
+ /// <param name="messageIds">The list of message Ids that match the search criteria.</param>
+ public SearchResponse(List<int> messageIds) {
+ this.messageIds = messageIds;
}
+
+ public override void WriteResponse(ImapServiceConnection cnn) {
+ StringBuilder messageList = new StringBuilder();
+
+ foreach (int messageId in this.messageIds) {
+ messageList.Append(messageId);
+ messageList.Append(" ");
+ }
+
+ cnn.WriteLine("* SEARCH {0}", messageList.ToString());
+ }
}
}
Modified: NMail/trunk/NMail.ImapService/State/ExamineState.cs
===================================================================
--- NMail/trunk/NMail.ImapService/State/ExamineState.cs 2006-11-23 11:09:39 UTC (rev 91)
+++ NMail/trunk/NMail.ImapService/State/ExamineState.cs 2006-11-23 11:34:41 UTC (rev 92)
@@ -16,6 +16,7 @@
*/
using System;
+using System.Collections.Generic;
using System.Text;
using NMail.DataTypes;
@@ -38,8 +39,6 @@
}
}
- // TODO: search command
-
#region Process Noop Command
public override void ProcessCommand(NoopCommand cmd) {
sendSelectResponses(this.selectedFolder);
@@ -71,7 +70,7 @@
if (dstFolder != null) {
// Process each list in the copy command
- foreach (ImapMessageListItem listItem in cmd.MessageList.ImapMessageListItem) {
+ foreach (ImapMessageListItem listItem in cmd.MessageList) {
if (listItem.ItemType == ImapMessageListItemType.Single) {
// Only a single message in this item
processMessageCopy(listItem.Start, cmd.UidCommand, dstFolder);
@@ -231,12 +230,12 @@
}
#endregion
- #region sendpublicDate
- protected virtual void sendpublicDate(FetchResponse response, int messageUid) {
- DateTime? publicDate = LocalStore.GetInternalDate(Session.AuthenticationToken, messageUid, this.selectedFolder);
+ #region sendInternalDate
+ protected virtual void sendInternalDate(FetchResponse response, int messageUid) {
+ DateTime? internalDate = LocalStore.GetInternalDate(Session.AuthenticationToken, messageUid, this.selectedFolder);
- if (publicDate.HasValue) {
- response.AppendResponseItem("publicDATE \"" + publicDate.Value.ToString("r") + "\"");
+ if (internalDate.HasValue) {
+ response.AppendResponseItem("INTERNALDATE \"" + internalDate.Value.ToString("r") + "\"");
}
}
#endregion
@@ -355,7 +354,7 @@
switch (dataItem.DataType) {
case FetchDataItemType.All:
sendMessageFlags(response, messageUid);
- sendpublicDate(response, messageUid);
+ sendInternalDate(response, messageUid);
sendMessageSize(response, messageUid);
ensureMessageHeaders(messageUid, ref messageHeaders);
sendEnvelope(response, messageHeaders);
@@ -380,7 +379,7 @@
case FetchDataItemType.Fast:
sendMessageFlags(response, messageUid);
- sendpublicDate(response, messageUid);
+ sendInternalDate(response, messageUid);
sendMessageSize(response, messageUid);
break;
@@ -390,14 +389,14 @@
case FetchDataItemType.Full:
sendMessageFlags(response, messageUid);
- sendpublicDate(response, messageUid);
+ sendInternalDate(response, messageUid);
sendMessageSize(response, messageUid);
ensureMessageHeaders(messageUid, ref messageHeaders);
sendEnvelope(response, messageHeaders);
break;
case FetchDataItemType.InternalDate:
- sendpublicDate(response, messageUid);
+ sendInternalDate(response, messageUid);
break;
case FetchDataItemType.Rfc822:
@@ -430,7 +429,7 @@
#region FetchCommand
public override void ProcessCommand(FetchCommand cmd) {
// Process each list in the fetch command
- foreach (ImapMessageListItem listItem in cmd.MessageList.ImapMessageListItem) {
+ foreach (ImapMessageListItem listItem in cmd.MessageList) {
if (listItem.ItemType == ImapMessageListItemType.Single) {
// Only a single message in this item
processMessageFetch(listItem.Start, cmd.UidCommand, cmd.DataList);
@@ -484,5 +483,70 @@
}
#endregion
#endregion
+
+ #region Process Search Command
+
+ void matchUidSearch(UidSearchItem searchItem, List<int> messageUids) {
+ List<int> removedIds = new List<int>();
+
+ foreach (int messageUid in messageUids) {
+ bool foundMatch = false;
+
+ foreach (ImapMessageListItem item in searchItem.MessageList) {
+ if (item.Matches(messageUid)) {
+ foundMatch = true;
+ break;
+ }
+ }
+
+ if (!foundMatch) {
+ removedIds.Add(messageUid);
+ }
+ }
+
+ // Remove any Ids that don't match
+ for (int i = 0; i < removedIds.Count; i++) {
+ messageUids.Remove(removedIds[i]);
+ }
+ }
+
+ #region Search Command
+ public override void ProcessCommand(SearchCommand cmd) {
+ // Get a list of Ids for the folder
+ List<int> messageUids = LocalStore.GetMessageIds(Session.AuthenticationToken, Session.SelectedFolder);
+
+ // Check if there was any messages in the folder
+ if (messageUids.Count > 0) {
+ // Process each list in the search command
+ foreach (SearchItem searchItem in cmd.SearchItems) {
+ switch (searchItem.SearchType) {
+ case SearchItemType.Uid:
+ matchUidSearch((UidSearchItem) searchItem, messageUids);
+ break;
+ }
+ }
+ }
+
+ // Check if any message Ids matched the search criteria
+ if (messageUids.Count > 0) {
+ if (!cmd.UidCommand) {
+ List<int> messageOffsets = new List<int>();
+
+ foreach (int messageUid in messageUids) {
+ int messageOffset = LocalStore.GetMessageOffset(Session.AuthenticationToken, messageUid, Session.SelectedFolder);
+ messageOffsets.Add(messageOffset);
+ }
+
+ // Replace the list of offset Ids with
+ messageUids = messageOffsets;
+ }
+
+ QueueResponse(new SearchResponse(messageUids));
+ }
+
+ QueueResponse(new SimpleResponse(cmd.Tag, ResponseType.Ok, "SEARCH completed."));
+ }
+ #endregion
+ #endregion
}
}
Modified: NMail/trunk/NMail.ImapService/State/SelectedState.cs
===================================================================
--- NMail/trunk/NMail.ImapService/State/SelectedState.cs 2006-11-23 11:09:39 UTC (rev 91)
+++ NMail/trunk/NMail.ImapService/State/SelectedState.cs 2006-11-23 11:34:41 UTC (rev 92)
@@ -91,7 +91,7 @@
public override void ProcessCommand(StoreCommand cmd) {
// Process each list in the store command
- foreach (ImapMessageListItem listItem in cmd.MessageList.ImapMessageListItem) {
+ foreach (ImapMessageListItem listItem in cmd.MessageList) {
if (listItem.ItemType == ImapMessageListItemType.Single) {
// Only a single message in this item
processMessageStore(listItem.Start, cmd.UidCommand, cmd.Command, cmd.Flags);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tmy...@us...> - 2006-11-23 11:09:42
|
Revision: 91
http://svn.sourceforge.net/nmailserver/?rev=91&view=rev
Author: tmyroadctfig
Date: 2006-11-23 03:09:39 -0800 (Thu, 23 Nov 2006)
Log Message:
-----------
Removed unused file.
Modified Paths:
--------------
NMail/trunk/NMail.ImapService/NMail.ImapService.csproj
Removed Paths:
-------------
NMail/trunk/NMail.ImapService/Response/ContinuationCompleteResponse.cs
Modified: NMail/trunk/NMail.ImapService/NMail.ImapService.csproj
===================================================================
--- NMail/trunk/NMail.ImapService/NMail.ImapService.csproj 2006-11-23 11:08:00 UTC (rev 90)
+++ NMail/trunk/NMail.ImapService/NMail.ImapService.csproj 2006-11-23 11:09:39 UTC (rev 91)
@@ -213,9 +213,6 @@
<SubType>Code</SubType>
</Compile>
<Compile Include="Response\AclResponse.cs" />
- <Compile Include="Response\ContinuationCompleteResponse.cs">
- <SubType>Code</SubType>
- </Compile>
<Compile Include="Response\ContinuationResponse.cs">
<SubType>Code</SubType>
</Compile>
Deleted: NMail/trunk/NMail.ImapService/Response/ContinuationCompleteResponse.cs
===================================================================
--- NMail/trunk/NMail.ImapService/Response/ContinuationCompleteResponse.cs 2006-11-23 11:08:00 UTC (rev 90)
+++ NMail/trunk/NMail.ImapService/Response/ContinuationCompleteResponse.cs 2006-11-23 11:09:39 UTC (rev 91)
@@ -1,29 +0,0 @@
-/*
- * Copyright 2004-2006 Luke Quinane and Daniel Frampton
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-using System;
-
-namespace NMail.ImapService.Response {
- /// <summary>
- /// This signals the end of interpreting data as raw data from the client.
- /// </summary>
- public class ContinuationCompleteResponse : AbstractResponse {
- public override void WriteResponse(ImapServiceConnection connection) {
- // Nothing to output: this is an internal control response
- }
- }
-}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tmy...@us...> - 2006-11-23 11:08:00
|
Revision: 90
http://svn.sourceforge.net/nmailserver/?rev=90&view=rev
Author: tmyroadctfig
Date: 2006-11-23 03:08:00 -0800 (Thu, 23 Nov 2006)
Log Message:
-----------
Added a get message Ids function to the localstore.
Modified Paths:
--------------
NMail/trunk/NMail/DataTypes/LocalStore/ILocalStore.cs
NMail/trunk/NMail/DataTypes/LocalStore/ILocalStoreData.cs
NMail/trunk/NMail.LocalStore/LocalStore.cs
NMail/trunk/NMail.LocalStoreData.MySql/MySqlLocalStoreData.cs
Modified: NMail/trunk/NMail/DataTypes/LocalStore/ILocalStore.cs
===================================================================
--- NMail/trunk/NMail/DataTypes/LocalStore/ILocalStore.cs 2006-11-22 13:26:03 UTC (rev 89)
+++ NMail/trunk/NMail/DataTypes/LocalStore/ILocalStore.cs 2006-11-23 11:08:00 UTC (rev 90)
@@ -16,6 +16,7 @@
*/
using System;
+using System.Collections.Generic;
using NMail.Authentication;
using NMail.DataTypes;
@@ -208,6 +209,14 @@
/// <param name="folder">The folder the message is in.</param>
/// <returns>The message offset or 0 if there is no such message.</returns>
int GetMessageOffset(IAuthenticationToken authToken, int messageId, StoreFolder folder);
+
+ /// <summary>
+ /// Gets a list of message Ids for a given folder.
+ /// </summary>
+ /// <param name="authToken">The authentication credentials.</param>
+ /// <param name="folder">The folder the message is in.</param>
+ /// <returns>The list of messages in the folder.</returns>
+ List<int> GetMessageIds(IAuthenticationToken authToken, StoreFolder folder);
#endregion
#region Message Flags
Modified: NMail/trunk/NMail/DataTypes/LocalStore/ILocalStoreData.cs
===================================================================
--- NMail/trunk/NMail/DataTypes/LocalStore/ILocalStoreData.cs 2006-11-22 13:26:03 UTC (rev 89)
+++ NMail/trunk/NMail/DataTypes/LocalStore/ILocalStoreData.cs 2006-11-23 11:08:00 UTC (rev 90)
@@ -16,6 +16,7 @@
*/
using System;
+using System.Collections.Generic;
using System.Data;
using NMail.DataTypes;
@@ -156,6 +157,13 @@
/// <param name="folder">The folder the message is in.</param>
/// <returns>The message offset or 0 if there is no such message.</returns>
int GetMessageOffset(int messageId, StoreFolder folder);
+
+ /// <summary>
+ /// Gets a list of message Ids for a given folder.
+ /// </summary>
+ /// <param name="folder">The folder the message is in.</param>
+ /// <returns>The list of messages in the folder.</returns>
+ List<int> GetMessageIds(StoreFolder folder);
#endregion
#region Message Flags
Modified: NMail/trunk/NMail.LocalStore/LocalStore.cs
===================================================================
--- NMail/trunk/NMail.LocalStore/LocalStore.cs 2006-11-22 13:26:03 UTC (rev 89)
+++ NMail/trunk/NMail.LocalStore/LocalStore.cs 2006-11-23 11:08:00 UTC (rev 90)
@@ -692,7 +692,23 @@
}
}
#endregion
+
+ #region Get Message Ids
+
+ public List<int> GetMessageIds(IAuthenticationToken authToken, StoreFolder folder) {
+
+ // Ensure the user has rights to get the message Id
+ if (hasFolderPrivilege(authToken.Username, folder.FolderId, StoreFolderPrivilege.Read)) {
+
+ // Return the message Id
+ return LocalStoreData.GetMessageIds(folder);
+
+ } else {
+ return new List<int>();
+ }
+ }
#endregion
+ #endregion
#region Message Flags
#region Get Message Flags
Modified: NMail/trunk/NMail.LocalStoreData.MySql/MySqlLocalStoreData.cs
===================================================================
--- NMail/trunk/NMail.LocalStoreData.MySql/MySqlLocalStoreData.cs 2006-11-22 13:26:03 UTC (rev 89)
+++ NMail/trunk/NMail.LocalStoreData.MySql/MySqlLocalStoreData.cs 2006-11-23 11:08:00 UTC (rev 90)
@@ -559,7 +559,28 @@
}
#endregion
+ #region GetMessageIds
+ public List<int> GetMessageIds(StoreFolder folder) {
+ List<int> result = new List<int>();
+
+ using (MySqlConnection cnn = MySqlHelper.GetConnection()) {
+ using (MySqlCommand cmd = cnn.CreateCommand()) {
+ cmd.CommandText = "SELECT FolderMessageId FROM Message WHERE FolderId = ?FolderId";
+ cmd.Parameters.Add("?FolderId", folder.FolderId);
+
+ MySqlDataReader reader = cmd.ExecuteReader();
+
+ while (reader.Read()) {
+ int id = (int) reader["FolderMessageId"];
+ result.Add(id);
+ }
+ }
+ }
+
+ return result;
+ }
#endregion
+ #endregion
#region Message Flags
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tmy...@us...> - 2006-11-22 13:26:18
|
Revision: 89
http://svn.sourceforge.net/nmailserver/?rev=89&view=rev
Author: tmyroadctfig
Date: 2006-11-22 05:26:03 -0800 (Wed, 22 Nov 2006)
Log Message:
-----------
Fixed a defect in the message delivery code (BUG 1601133).
Modified Paths:
--------------
NMail/trunk/NMail.LocalStoreData.MySql/MySqlLocalStoreData.cs
Modified: NMail/trunk/NMail.LocalStoreData.MySql/MySqlLocalStoreData.cs
===================================================================
--- NMail/trunk/NMail.LocalStoreData.MySql/MySqlLocalStoreData.cs 2006-11-22 12:54:03 UTC (rev 88)
+++ NMail/trunk/NMail.LocalStoreData.MySql/MySqlLocalStoreData.cs 2006-11-22 13:26:03 UTC (rev 89)
@@ -130,10 +130,11 @@
cmd = cnn.CreateCommand();
cmd.Transaction = transaction;
cmd.Connection = cnn;
+
+ // Part 0 is not counted below in GetMessageMimePartCount
cmd.CommandText = "INSERT INTO MessageData (MessageId, Part, Data) " +
- "VALUES (?MessageId, ?Part, ?Data)";
+ "VALUES (?MessageId, 0, ?Data)";
cmd.Parameters.Add("?MessageId", messageId);
- cmd.Parameters.Add("?Part", 0); // Part 0 is not counted below in GetMessageMimePartCount
cmd.Parameters.Add("?Data", message.BodyData.Bytes);
count = cmd.ExecuteNonQuery();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tmy...@us...> - 2006-11-22 12:54:06
|
Revision: 88
http://svn.sourceforge.net/nmailserver/?rev=88&view=rev
Author: tmyroadctfig
Date: 2006-11-22 04:54:03 -0800 (Wed, 22 Nov 2006)
Log Message:
-----------
Fixed a defect in the fetch command (BUG 1601117).
Modified Paths:
--------------
NMail/trunk/NMail.ImapService/Command/FetchCommand.cs
NMail/trunk/NMail.ImapService/State/ExamineState.cs
Modified: NMail/trunk/NMail.ImapService/Command/FetchCommand.cs
===================================================================
--- NMail/trunk/NMail.ImapService/Command/FetchCommand.cs 2006-11-11 13:00:13 UTC (rev 87)
+++ NMail/trunk/NMail.ImapService/Command/FetchCommand.cs 2006-11-22 12:54:03 UTC (rev 88)
@@ -294,7 +294,11 @@
} else if (bodyString == "TEXT") {
this.sectionType = FetchBodySectionType.Text;
- } else {
+ } else if (bodyString == string.Empty) {
+ // No sections specified, default to all
+ this.sectionType = FetchBodySectionType.All;
+
+ } else {
this.sectionType = FetchBodySectionType.Section;
}
Modified: NMail/trunk/NMail.ImapService/State/ExamineState.cs
===================================================================
--- NMail/trunk/NMail.ImapService/State/ExamineState.cs 2006-11-11 13:00:13 UTC (rev 87)
+++ NMail/trunk/NMail.ImapService/State/ExamineState.cs 2006-11-22 12:54:03 UTC (rev 88)
@@ -245,7 +245,14 @@
protected virtual void sendBody(FetchResponse response, int messageUid, ref MessageHeaders messageHeaders, FetchBodyItem bodyItem, bool peek) {
string data = "BODY";
- if (bodyItem.SectionType == FetchBodySectionType.HeaderFields) {
+ if (bodyItem.SectionType == FetchBodySectionType.All) {
+ // Get the entire message from the local store
+ Message message = LocalStore.GetMessage(Session.AuthenticationToken, messageUid, this.selectedFolder);
+
+ data += "[] {" + message.Size + "}" + this.Session.Connection.Terminator + message.Data.ToString();
+ response.AppendResponseItem(data);
+
+ } else if (bodyItem.SectionType == FetchBodySectionType.HeaderFields) {
ensureMessageHeaders(messageUid, ref messageHeaders);
sendHeaders(response, bodyItem.HeaderFields, messageHeaders, false);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|