[nhin-d.net35] push by joeshook@gmail.com - Adding dns SRV record management for the Direct Responder.... on 2014-10-16 07:48 GMT

0 views
Skip to first unread message

nhi...@googlecode.com

unread,
Oct 16, 2014, 3:48:28 AM10/16/14
to nhindirec...@googlegroups.com
Revision: 60c6dcfda6a2
Branch: default
Author: joes...@gmail.com <>
Date: Thu Oct 16 07:47:02 2014 UTC
Log: Adding dns SRV record management for the Direct Responder.
https://code.google.com/p/nhin-d/issues/detail?id=247
https://code.google.com/p/nhin-d/source/detail?r=60c6dcfda6a2&repo=net35

Added:
/csharp/admin/AdminMvc/Models/SrvRecordModel.cs
/csharp/admin/AdminMvc/Views/DnsRecords/AddSRV.aspx
/csharp/admin/AdminMvc/Views/DnsRecords/EditSrv.aspx
/csharp/admin/AdminMvc/Views/DnsRecords/SrvDetails.ascx
/csharp/gateway/smtpAgent/IAuditorSmtpAgent.cs
Modified:
/csharp/GlobalAssemblyInfo.cs
/csharp/admin/AdminMvc.Tests/Models/DomainModelFacts.cs
/csharp/admin/AdminMvc/AdminMvc.VS2012.csproj
/csharp/admin/AdminMvc/AdminMvc.csproj
/csharp/admin/AdminMvc/Common/DomainNameAttribute.cs
/csharp/admin/AdminMvc/Controllers/DnsRecordsController.cs
/csharp/admin/AdminMvc/Views/DnsRecords/Index.aspx
/csharp/config/client/RecordRetrievalExtensions.cs
/csharp/config/console/Command/DnsRecordCommands.cs
/csharp/config/service/Web.config
/csharp/dnsResponder/DnsRecordStorageService .cs
/csharp/installer/Direct.iss

=======================================
--- /dev/null
+++ /csharp/admin/AdminMvc/Models/SrvRecordModel.cs Thu Oct 16 07:47:02
2014 UTC
@@ -0,0 +1,78 @@
+/*
+ Copyright (c) 2014, Direct Project
+ All rights reserved.
+
+ Authors:
+ Joseph Shook Joseph...@Surescripts.com
+
+Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
+
+Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
+Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
+Neither the name of The Direct Project (directproject.org) nor the names
of its contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+using System.ComponentModel.DataAnnotations;
+using Health.Direct.Common.DnsResolver;
+
+namespace Health.Direct.Admin.Console.Models
+{
+ [MetadataType(typeof(SrvRecordModel.Metadata))]
+ public class SrvRecordModel : DnsRecordModel
+ {
+ public ushort Weight { get; set; }
+ public ushort Port { get; set; }
+ public string Target { get; set; }
+ public ushort Priority { get; set; }
+ public int TTL { get; set; }
+
+ public override int TypeID
+ {
+ get { return (int)DnsStandard.RecordType.SRV; }
+ set { }
+ }
+
+ public override byte[] RecordData
+ {
+ get
+ {
+ DnsBuffer buffer = new DnsBuffer();
+ new SRVRecord(DomainName, Weight, Port, Target, Priority)
{ TTL = TTL }.Serialize(buffer);
+ return buffer.Buffer;
+ }
+ set
+ {
+ base.RecordData = value;
+ DnsBufferReader rdr = new DnsBufferReader(value, 0,
value.Length);
+ var record = DnsResourceRecord.Deserialize(ref rdr) as
SRVRecord;
+ if (record != null)
+ {
+ Weight = record.Weight;
+ Port = record.Port;
+ Target = record.Target;
+ Priority = record.Priority;
+ TTL = record.TTL;
+ }
+ }
+ }
+
+ public new class Metadata : DnsRecordModel.Metadata
+ {
+ [Required]
+ public ushort Weight { get; set; }
+
+ [Required]
+ public ushort Port { get; set; }
+
+ [Required]
+ public ushort Target { get; set; }
+
+ public ushort Priority { get; set; }
+
+ [Required, Range(0, int.MaxValue)]
+ public int TTL { get; set; }
+ }
+ }
+}
=======================================
--- /dev/null
+++ /csharp/admin/AdminMvc/Views/DnsRecords/AddSRV.aspx Thu Oct 16 07:47:02
2014 UTC
@@ -0,0 +1,76 @@
+<%@ Page Title="" Language="C#"
MasterPageFile="~/Views/Shared/Site.Master"
Inherits="System.Web.Mvc.ViewPage<Health.Direct.Admin.Console.Models.SrvRecordModel>" %>
+<%@ Import Namespace="Health.Direct.Admin.Console.Common"%>
+
+<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent"
runat="server">
+ Add SRV Record
+</asp:Content>
+
+<asp:Content ID="Content2" ContentPlaceHolderID="MainContent"
runat="server">
+
+ <h2>Add SRV Record</h2>
+
+ <% using (Html.BeginForm("AddSrv", "DnsRecords", FormMethod.Post)) {%>
+
+ <%= Html.ValidationSummary(true) %>
+
+ <fieldset>
+
+ <span class="display-label"><%= Html.LabelFor(model =>
model.DomainName) %></span>
+ <span class="display-field">
+ <%= Html.TextBoxWithMaxLengthFor(model =>
model.DomainName) %>
+ <%= Html.ValidationMessageFor(model => model.DomainName) %>
+ </span>
+ <br class="clear" />
+
+ <span class="display-label"><%= Html.LabelFor(model =>
model.Weight) %></span>
+ <span class="display-field">
+ <%= Html.TextBoxFor(model => model.Weight)%>
+ <%= Html.ValidationMessageFor(model => model.Weight)%>
+ </span>
+ <br class="clear" />
+
+ <span class="display-label"><%= Html.LabelFor(model =>
model.Port) %></span>
+ <span class="display-field">
+ <%= Html.TextBoxFor(model => model.Port)%>
+ <%= Html.ValidationMessageFor(model => model.Port)%>
+ </span>
+ <br class="clear" />
+
+ <span class="display-label"><%= Html.LabelFor(model =>
model.Target) %></span>
+ <span class="display-field">
+ <%= Html.TextBoxFor(model => model.Target)%>
+ <%= Html.ValidationMessageFor(model => model.Target)%>
+ </span>
+ <br class="clear" />
+
+ <span class="display-label"><%= Html.LabelFor(model =>
model.Priority) %></span>
+ <span class="display-field">
+ <%= Html.TextBoxFor(model => model.Priority)%>
+ <%= Html.ValidationMessageFor(model => model.Priority)%>
+ </span>
+ <br class="clear" />
+
+ <span class="display-label"><%= Html.LabelFor(model =>
model.TTL) %></span>
+ <span class="display-field">
+ <%= Html.TextBoxFor(model => model.TTL)%>
+ <%= Html.ValidationMessageFor(model => model.TTL)%>
+ </span>
+ <br class="clear" />
+
+ <span class="display-label"><%= Html.LabelFor(model =>
model.Notes) %></span>
+ <span class="display-field">
+ <%= Html.TextBoxFor(model => model.Notes) %>
+ <%= Html.ValidationMessageFor(model => model.Notes) %>
+ </span>
+ <br class="clear" />
+
+ <div class="action-buttons">
+ <input type="submit" value="Create" />
+ <%= Html.ActionLink("Cancel", "Index") %>
+ </div>
+ </fieldset>
+
+ <% } %>
+
+</asp:Content>
+
=======================================
--- /dev/null
+++ /csharp/admin/AdminMvc/Views/DnsRecords/EditSrv.aspx Thu Oct 16
07:47:02 2014 UTC
@@ -0,0 +1,78 @@
+<%@ Page Title="" Language="C#"
MasterPageFile="~/Views/Shared/Site.Master"
Inherits="System.Web.Mvc.ViewPage<Health.Direct.Admin.Console.Models.SrvRecordModel>" %>
+<%@ Import Namespace="Health.Direct.Admin.Console.Common"%>
+
+<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent"
runat="server">
+ Edit SRV Record
+</asp:Content>
+
+<asp:Content ID="Content2" ContentPlaceHolderID="MainContent"
runat="server">
+
+ <h2>Edit SRV Record</h2>
+
+ <% using (Html.BeginForm("EditSrv", "DnsRecords", FormMethod.Post)) {%>
+
+ <%= Html.ValidationSummary(true) %>
+
+ <fieldset>
+
+ <%= Html.HiddenFor(m => m.ID) %>
+
+ <span class="display-label"><%= Html.LabelFor(model =>
model.DomainName) %></span>
+ <span class="display-field">
+ <%= Html.TextBoxWithMaxLengthFor(model =>
model.DomainName) %>
+ <%= Html.ValidationMessageFor(model => model.DomainName) %>
+ </span>
+ <br class="clear" />
+
+ <span class="display-label"><%= Html.LabelFor(model =>
model.Weight) %></span>
+ <span class="display-field">
+ <%= Html.TextBoxFor(model => model.Weight)%>
+ <%= Html.ValidationMessageFor(model => model.Weight)%>
+ </span>
+ <br class="clear" />
+
+ <span class="display-label"><%= Html.LabelFor(model =>
model.Port) %></span>
+ <span class="display-field">
+ <%= Html.TextBoxFor(model => model.Port)%>
+ <%= Html.ValidationMessageFor(model => model.Port)%>
+ </span>
+ <br class="clear" />
+
+ <span class="display-label"><%= Html.LabelFor(model =>
model.Target) %></span>
+ <span class="display-field">
+ <%= Html.TextBoxFor(model => model.Target)%>
+ <%= Html.ValidationMessageFor(model => model.Target)%>
+ </span>
+ <br class="clear" />
+
+ <span class="display-label"><%= Html.LabelFor(model =>
model.Priority) %></span>
+ <span class="display-field">
+ <%= Html.TextBoxFor(model => model.Priority)%>
+ <%= Html.ValidationMessageFor(model => model.Priority)%>
+ </span>
+ <br class="clear" />
+
+ <span class="display-label"><%= Html.LabelFor(model =>
model.TTL) %></span>
+ <span class="display-field">
+ <%= Html.TextBoxFor(model => model.TTL)%>
+ <%= Html.ValidationMessageFor(model => model.TTL)%>
+ </span>
+ <br class="clear" />
+
+ <span class="display-label"><%= Html.LabelFor(model =>
model.Notes) %></span>
+ <span class="display-field">
+ <%= Html.TextBoxFor(model => model.Notes) %>
+ <%= Html.ValidationMessageFor(model => model.Notes) %>
+ </span>
+ <br class="clear" />
+
+ <div class="action-buttons">
+ <input type="submit" value="Save" />
+ <%= Html.ActionLink("Cancel", "Index") %>
+ </div>
+ </fieldset>
+
+ <% } %>
+
+</asp:Content>
+
=======================================
--- /dev/null
+++ /csharp/admin/AdminMvc/Views/DnsRecords/SrvDetails.ascx Thu Oct 16
07:47:02 2014 UTC
@@ -0,0 +1,46 @@
+<%@ Control Language="C#"
Inherits="System.Web.Mvc.ViewUserControl<Health.Direct.Admin.Console.Models.SrvRecordModel>" %>
+
+<div id="dnsrecord-details">
+ <span class="display-label"><%= Html.LabelFor(model =>
model.DomainName) %></span>
+ <span class="display-field">
+ <%= Html.DisplayTextFor(model => model.DomainName) %>
+ </span>
+ <br class="clear" />
+
+ <span class="display-label"><%= Html.LabelFor(model =>
model.Weight)%></span>
+ <span class="display-field">
+ <%= Html.DisplayTextFor(model => model.Weight)%>
+ </span>
+ <br class="clear" />
+
+ <span class="display-label"><%= Html.LabelFor(model =>
model.Port)%></span>
+ <span class="display-field">
+ <%= Html.DisplayTextFor(model => model.Port)%>
+ </span>
+ <br class="clear" />
+
+ <span class="display-label"><%= Html.LabelFor(model =>
model.Target)%></span>
+ <span class="display-field">
+ <%= Html.DisplayTextFor(model => model.Target)%>
+ </span>
+ <br class="clear" />
+
+ <span class="display-label"><%= Html.LabelFor(model =>
model.Priority)%></span>
+ <span class="display-field">
+ <%= Html.DisplayTextFor(model => model.Priority)%>
+ </span>
+ <br class="clear" />
+
+ <span class="display-label"><%= Html.LabelFor(model =>
model.TTL)%></span>
+ <span class="display-field">
+ <%= Html.DisplayTextFor(model => model.TTL)%>
+ </span>
+ <br class="clear" />
+
+ <span class="display-label"><%= Html.LabelFor(model =>
model.Notes) %></span>
+ <span class="display-field">
+ <%= Html.DisplayTextFor(model => model.Notes)%>
+ </span>
+ <br class="clear" />
+
+</div>
=======================================
--- /dev/null
+++ /csharp/gateway/smtpAgent/IAuditorSmtpAgent.cs Thu Oct 16 07:47:02 2014
UTC
@@ -0,0 +1,39 @@
+/*
+ Copyright (c) 2014, Direct Project
+ All rights reserved.
+
+ Authors:
+ Joseph Shook joseph...@surescripts.com
+
+Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
+
+Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
+Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
+Neither the name of The Direct Project (directproject.org) nor the names
of its contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+using Health.Direct.Common.Container;
+using Health.Direct.Common.Diagnostics;
+
+namespace Health.Direct.SmtpAgent
+{
+ ///<summary>
+ /// The full featured SmtpAgent interface that provides access to the
audit sub-system. Any implementation
+ /// should provide an implementation of this interface and register it
with your
+ /// own container <see cref="IoC"/>
+ /// IAuditorFull includes a <see cref="IBuildAuditLogMessage"/>
interface allowing injection of a
+ /// custom audit builder.
+ ///</summary>
+ public interface IAuditor<out T> : IAuditor where T :
IBuildAuditLogMessage
+ {
+ T BuildAuditLogMessage { get; }
+ void Log(string category, ISmtpMessage message, bool incoming);
+ }
+
+ public interface IBuildAuditLogMessage
+ {
+ string Build(ISmtpMessage message, bool? incoming);
+ }
+}
=======================================
--- /csharp/GlobalAssemblyInfo.cs Fri Dec 6 00:25:58 2013 UTC
+++ /csharp/GlobalAssemblyInfo.cs Thu Oct 16 07:47:02 2014 UTC
@@ -6,5 +6,5 @@
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

-[assembly: AssemblyVersion("1.2.0.8")]
-[assembly: AssemblyFileVersion("1.2.0.8")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
=======================================
--- /csharp/admin/AdminMvc.Tests/Models/DomainModelFacts.cs Sun Nov 21
03:37:26 2010 UTC
+++ /csharp/admin/AdminMvc.Tests/Models/DomainModelFacts.cs Thu Oct 16
07:47:02 2014 UTC
@@ -15,9 +15,10 @@
[InlineData("a...@b.com", false)]
[InlineData("somewhere.com", true)]
[InlineData("loud.co.uk", true)]
+ [InlineData("_ldap._tcp.joe2.com", true)]
public void Regex(string domain, bool expected)
{
- var regex = new
Regex(@"^([A-Za-z0-9\-]{1,63}\.)+[A-Za-z]{2,}$");
+ var regex = new
Regex(@"^([A-Za-z0-9\-_]{1,63}\.)+[A-Za-z]{2,}$");
Assert.Equal(expected, regex.Match(domain).Success);
}
}
=======================================
--- /csharp/admin/AdminMvc/AdminMvc.VS2012.csproj Fri Mar 28 01:19:04 2014
UTC
+++ /csharp/admin/AdminMvc/AdminMvc.VS2012.csproj Thu Oct 16 07:47:02 2014
UTC
@@ -145,18 +145,22 @@
<Compile Include="Models\Repositories\IRepository.cs" />
<Compile Include="Models\Repositories\RepositoryModule.cs" />
<Compile Include="Models\SoaRecordModel.cs" />
+ <Compile Include="Models\SrvRecordModel.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Common\HtmlHelperExtensions.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="Global.asax" />
+ <Content Include="Views\DnsRecords\AddSRV.aspx" />
<Content Include="Views\DnsRecords\AnameDetails.ascx" />
<Content Include="Views\DnsRecords\DnsRecordDetailsDialog.ascx" />
+ <Content Include="Views\DnsRecords\EditSrv.aspx" />
<Content Include="Views\DnsRecords\MxDetails.ascx" />
<Content Include="Views\DnsRecords\SoaDetails.ascx" />
<Content Include="Views\DnsRecords\EditAname.aspx" />
<Content Include="Views\DnsRecords\EditMx.aspx" />
<Content Include="Views\DnsRecords\EditSoa.aspx" />
+ <Content Include="Views\DnsRecords\SrvDetails.ascx" />
<Content Include="Views\Domains\NotFound.aspx" />
<Content Include="Views\MdnRecords\Index.aspx" />
<Content Include="Views\MdnRecords\MdnList.ascx" />
=======================================
--- /csharp/admin/AdminMvc/AdminMvc.csproj Sat Apr 5 00:49:21 2014 UTC
+++ /csharp/admin/AdminMvc/AdminMvc.csproj Thu Oct 16 07:47:02 2014 UTC
@@ -138,6 +138,7 @@
<Compile Include="Models\Repositories\IRepository.cs" />
<Compile Include="Models\Repositories\RepositoryModule.cs" />
<Compile Include="Models\SoaRecordModel.cs" />
+ <Compile Include="Models\SrvRecordModel.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Common\HtmlHelperExtensions.cs" />
</ItemGroup>
@@ -211,7 +212,10 @@
<Content Include="Views\DnsRecords\AddMx.aspx" />
<Content Include="Views\DnsRecords\AddAname.aspx" />
<Content Include="Views\DnsRecords\AddSoa.aspx" />
+ <Content Include="Views\DnsRecords\AddSRV.aspx" />
<Content Include="Views\DnsRecords\AnameDetails.ascx" />
+ <Content Include="Views\DnsRecords\SrvDetails.ascx" />
+ <Content Include="Views\DnsRecords\EditSrv.aspx" />
<Content Include="Views\DnsRecords\DnsRecordDetailsDialog.ascx" />
<Content Include="Views\DnsRecords\EditAname.aspx" />
<Content Include="Views\DnsRecords\EditMx.aspx" />
=======================================
--- /csharp/admin/AdminMvc/Common/DomainNameAttribute.cs Sun Nov 21
03:37:26 2010 UTC
+++ /csharp/admin/AdminMvc/Common/DomainNameAttribute.cs Thu Oct 16
07:47:02 2014 UTC
@@ -4,7 +4,7 @@
{
public class DomainNameAttribute : RegularExpressionAttribute
{
- private const string DomainPattern =
@"^([A-Za-z0-9\-]{1,63}\.)+[A-Za-z]{2,}$";
+ private const string DomainPattern =
@"^([A-Za-z0-9\-_]{1,63}\.)+[A-Za-z]{2,}$";

public DomainNameAttribute() : base(DomainPattern)
{
=======================================
--- /csharp/admin/AdminMvc/Controllers/DnsRecordsController.cs Fri Mar 28
01:19:04 2014 UTC
+++ /csharp/admin/AdminMvc/Controllers/DnsRecordsController.cs Thu Oct 16
07:47:02 2014 UTC
@@ -66,6 +66,19 @@
{
return Add<SoaRecordModel>();
}
+
+ [Authorize]
+ public ActionResult AddSrv()
+ {
+ return View(new SrvRecordModel());
+ }
+
+ [Authorize]
+ [HttpPost]
+ public ActionResult AddSrv(FormCollection formValues)
+ {
+ return Add<SrvRecordModel>();
+ }

private ActionResult Add<T>()
where T : DnsRecordModel, new()
@@ -99,6 +112,12 @@
{
return Details<SoaRecordModel>(id);
}
+
+ [Authorize]
+ public ActionResult SrvDetails(long id)
+ {
+ return Details<SrvRecordModel>(id);
+ }

private ActionResult Details<T>(long id)
where T : DnsRecordModel, new()
@@ -128,6 +147,12 @@
{
return Edit<SoaRecordModel>(id);
}
+
+ [Authorize]
+ public ActionResult EditSrv(long id)
+ {
+ return Edit<SrvRecordModel>(id);
+ }

private ActionResult Edit<T>(long id)
where T : DnsRecordModel, new()
@@ -160,6 +185,13 @@
{
return Edit<SoaRecordModel>(formValues);
}
+
+ [Authorize]
+ [HttpPost]
+ public ActionResult EditSrv(FormCollection formValues)
+ {
+ return Edit<SrvRecordModel>(formValues);
+ }

private ActionResult Edit<T>(FormCollection formValues)
where T : DnsRecordModel, new()
=======================================
--- /csharp/admin/AdminMvc/Views/DnsRecords/Index.aspx Fri Mar 28 01:19:04
2014 UTC
+++ /csharp/admin/AdminMvc/Views/DnsRecords/Index.aspx Thu Oct 16 07:47:02
2014 UTC
@@ -12,6 +12,7 @@
<%= Html.ActionLink("Add ANAME Record", "AddAname", null, new {
@class = "action ui-priority-primary"})%>
<%= Html.ActionLink("Add MX Record", "AddMx", null, new { @class
= "action ui-priority-primary"})%>
<%= Html.ActionLink("Add SOA Record", "AddSoa", null, new { @class
= "action ui-priority-primary"})%>
+ <%= Html.ActionLink("Add SRV Record", "AddSrv", null, new { @class
= "action ui-priority-primary"})%>
</div>

<%= Html.Partial("DnsRecordList", Model) %>
=======================================
--- /csharp/config/client/RecordRetrievalExtensions.cs Tue Jan 18 22:13:14
2011 UTC
+++ /csharp/config/client/RecordRetrievalExtensions.cs Thu Oct 16 07:47:02
2014 UTC
@@ -51,6 +51,11 @@
{
client.GetMatches(domain, recordCollection,
DnsStandard.RecordType.NS);
}
+
+ public static void GetSRVRecords(this RecordRetrievalServiceClient
client, string domain, DnsResourceRecordCollection recordCollection)
+ {
+ client.GetMatches(domain, recordCollection,
DnsStandard.RecordType.SRV);
+ }

public static void GetMatches(this RecordRetrievalServiceClient
client, string domain, DnsResourceRecordCollection resourceRecords,
DnsStandard.RecordType recordType)
{
=======================================
--- /csharp/config/console/Command/DnsRecordCommands.cs Tue Jan 18 22:13:14
2011 UTC
+++ /csharp/config/console/Command/DnsRecordCommands.cs Thu Oct 16 07:47:02
2014 UTC
@@ -17,6 +17,7 @@
using System;
using System.IO;
using System.Collections.Generic;
+using System.Reflection;
using Health.Direct.Common.Extensions;
using Health.Direct.Config.Client.DomainManager;
using Health.Direct.Config.Store;
@@ -82,6 +83,10 @@
= "Add a new NS dns record."
+ Constants.CRLF + DnsRecordParser.ParseCNAMEUsage;

+ private const string AddSRVUsage
+ = "Add a new SRV resource dns record."
+ + Constants.CRLF + DnsRecordParser.ParseSRVUsage;
+
private const string EnsureCNAMEUsage
= "Add a new NS dns record if an identical one does not exist."
+ Constants.CRLF + DnsRecordParser.ParseCNAMEUsage;
@@ -96,13 +101,11 @@
+ Constants.CRLF + " recordid"
+ Constants.CRLF + "\t recordid: record id to be retrieved
from the database";

-
private const string GetSOAUsage
= "Gets an existing SOA record by ID."
+ Constants.CRLF + " recordid"
+ Constants.CRLF + "\t recordid: record id to be retrieved
from the database";

-
private const string GetANAMEUsage
= "Gets an existing ANAME record by ID."
+ Constants.CRLF + " recordid"
@@ -117,6 +120,11 @@
= "Gets an existing CName record by ID."
+ Constants.CRLF + " recordid"
+ Constants.CRLF + "\t recordid: record id to be retrieved
from the database";
+
+ private const string GetSRVUsage
+ = "Gets an existing SRV record by ID."
+ + Constants.CRLF + " recordid"
+ + Constants.CRLF + "\t recordid: record id to be retrieved
from the database";

#endregion

@@ -322,6 +330,17 @@
DnsRecord record = m_parser.ParseCNAME(args);
Client.AddDnsRecord(record);
}
+
+ /// <summary>
+ /// Add a new NS DnsRecord entry to the db
+ /// </summary>
+ /// <param name="args"></param>
+ [Command(Name = "Dns_SRV_Add", Usage = AddSRVUsage)]
+ public void AddSRV(string[] args)
+ {
+ DnsRecord record = m_parser.ParseSRV(args);
+ Client.AddDnsRecord(record);
+ }

[Command(Name = "Dns_CNAME_Ensure", Usage = EnsureCNAMEUsage)]
public void EnsureCNAME(string[] args)
@@ -395,7 +414,17 @@
{
this.Get<CNameRecord>(args.GetRequiredValue<long>(0));
}
-
+
+ /// <summary>
+ /// Gets an existing SRV DnsRecord entry from the db
+ /// </summary>
+ /// <param name="args"></param>
+ [Command(Name = "Dns_SRV_Get", Usage = GetSRVUsage)]
+ public void GetSRV(string[] args)
+ {
+ this.Get<SRVRecord>(args.GetRequiredValue<long>(0));
+ }
+
void Get<T>(long recordID)
where T : DnsResourceRecord
{
@@ -452,7 +481,14 @@
{
this.Match(args.GetRequiredValue(0),
DnsStandard.RecordType.CNAME);
}
+
+ [Command(Name = "Dns_SRV_Match", Usage = "Resolve SRV records for
the given domain")]
+ public void MatchSRV(string[] args)
+ {
+ this.Match(args.GetRequiredValue(0),
DnsStandard.RecordType.SRV);
+ }

+
void Match(string domain, DnsStandard.RecordType type)
{
DnsRecord[] records = this.GetRecords(domain, type);
@@ -595,7 +631,17 @@
+ Constants.CRLF + "\t cname: alias for this domain"
+ Constants.CRLF + "\t [ttl]: time to live in seconds"
+ Constants.CRLF + "\t [notes]: description for the record";
-
+
+ public const string ParseSRVUsage =
+ " domainname weight port target [priority] [ttl] [notes]"
+ + Constants.CRLF + "\t domainname: The domain this RR refers
to. RFC2782"
+ + Constants.CRLF + "\t weight: A server selection mechanism.
RFC2782"
+ + Constants.CRLF + "\t port: The port on this target host of
this service. RFC2782"
+ + Constants.CRLF + "\t target: The domain name of the target
host. RFC2782"
+ + Constants.CRLF + "\t [priority]: The priority of this
target host. RFC2782"
+ + Constants.CRLF + "\t [ttl]: time to live in seconds, 32bit
int"
+ + Constants.CRLF + "\t [notes]: description for the record";
+
#endregion

public DnsRecordParser()
@@ -689,6 +735,21 @@
DnsRecord dnsRecord = new DnsRecord(domainName,
DnsStandard.RecordType.CNAME, cnameRecord.Serialize(), notes);
return dnsRecord;
}
+
+ public DnsRecord ParseSRV(string[] args)
+ {
+ string domainName = args.GetRequiredValue(0);
+ ushort weight = args.GetRequiredValue<ushort>(1);
+ ushort port = args.GetRequiredValue<ushort>(2);
+ string target = args.GetRequiredValue(3); //target
+ ushort priority = args.GetOptionalValue<ushort>(4, 0);
+ int ttl = this.ValidateTTL(args.GetOptionalValue<int>(5, 0));
+ string notes = args.GetOptionalValue(6, string.Empty);
+
+ SRVRecord srvRecord = new SRVRecord(domainName, weight, port,
target, priority) { TTL = ttl };
+ DnsRecord dnsRecord = new DnsRecord(domainName,
DnsStandard.RecordType.SRV, srvRecord.Serialize(), notes);
+ return dnsRecord;
+ }

int ValidateTTL(int ttl)
{
=======================================
--- /csharp/config/service/Web.config Fri Dec 28 05:53:30 2012 UTC
+++ /csharp/config/service/Web.config Thu Oct 16 07:47:02 2014 UTC
@@ -28,7 +28,7 @@
<add key="queryTimeout" value="00:00:10" />
</appSettings>
<logging>
- <file directory="~\Log" name="ConfigService" extension="log" />
+ <file directory="c:\Log" name="ConfigService" extension="log" />
<behavior rolloverFrequency="Day" loggingLevel="Debug" />
<eventLog threshold="Fatal" source="Health.Direct.Config.Service"
/>
</logging>
=======================================
--- /csharp/dnsResponder/DnsRecordStorageService .cs Tue Jan 18 22:13:14
2011 UTC
+++ /csharp/dnsResponder/DnsRecordStorageService .cs Thu Oct 16 07:47:02
2014 UTC
@@ -106,7 +106,10 @@
break;
case DnsStandard.RecordType.CNAME:
ProcessCNAMEQuestion(response);
- break;
+ break;
+ case DnsStandard.RecordType.SRV:
+ ProcessSRVQuestion(response);
+ break;
}

return response;
@@ -224,5 +227,18 @@
client.GetCNAMERecords(response.Question.Domain,
response.AnswerRecords);
}
}
+
+ /// <summary>
+ /// processes a SRV Question, populated the response with any
matching results pulled from the database store
+ /// </summary>
+ /// <param name="response">DnsResponse instance containing
information about the question that will
+ /// have any corresponding answer records populated upon
return</param>
+ protected void ProcessSRVQuestion(DnsResponse response)
+ {
+ using (RecordRetrievalServiceClient client =
m_recordRetrievalServiceSettings.CreateRecordRetrievalClient())
+ {
+ client.GetSRVRecords(response.Question.Domain,
response.AnswerRecords);
+ }
+ }
}
}
=======================================
--- /csharp/installer/Direct.iss Fri Dec 6 00:25:58 2013 UTC
+++ /csharp/installer/Direct.iss Thu Oct 16 07:47:02 2014 UTC
@@ -36,7 +36,7 @@
ArchitecturesInstallIn64BitMode=x64 ia64
AppId={{995D337A-5620-4537-9704-4B19EC628A39}
AppName=Direct Project .NET Gateway
-AppVerName=Direct Project .NET Gateway 1.2.0.8
+AppVerName=Direct Project .NET Gateway 1.0.0.0
AppPublisher=The Direct Project (nhindirect.org)
AppPublisherURL=http://nhindirect.org
AppSupportURL=http://nhindirect.org
@@ -45,10 +45,10 @@
DefaultGroupName=Direct Project .NET Gateway
AllowNoIcons=yes
OutputDir=.
-OutputBaseFilename=Direct-1.2.0.8-NET35
+OutputBaseFilename=Direct-1.0.0.0-NET35
Compression=lzma
SolidCompression=yes
-VersionInfoVersion=1.2.0.8
+VersionInfoVersion=1.0.0.0
SetupLogging=yes
PrivilegesRequired=admin

Reply all
Reply to author
Forward
0 new messages