Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.ServiceModel.Discovery / System / ServiceModel / Discovery / UdpDiscoveryMessageFilter.cs / 1305376 / UdpDiscoveryMessageFilter.cs
//---------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. //--------------------------------------------------------------- namespace System.ServiceModel.Discovery { using System.ServiceModel.Channels; using System.ServiceModel.Dispatcher; // This class provides a mitigration to the DDOS threat when using Discovery APIs with // UDP multicast transport. // // The Probe and Resolve request are sent multicast and are not secure. An attacker can launch // a third party distributed DOS attack by setting the address of the third party in the ReplyTo // header of the Probe and Resolve requests. To mitigate this threat this behavior drops the // message that have ReplyTo set to a value that is not annonymous by setting appropriate // message filter. // class UdpDiscoveryMessageFilter : MessageFilter { MessageFilter innerFilter; public UdpDiscoveryMessageFilter(MessageFilter innerFilter) { if (innerFilter == null) { throw FxTrace.Exception.ArgumentNull("innerFilter"); } this.innerFilter = innerFilter; } public MessageFilter InnerFilter { get { return this.innerFilter; } } public override bool Match(Message message) { if (message == null) { throw FxTrace.Exception.ArgumentNull("message"); } if (InnerFilter.Match(message)) { bool isMatch = ((message.Headers.ReplyTo == null) || (message.Headers.ReplyTo.IsAnonymous)); if (!isMatch && TD.DiscoveryMessageWithInvalidReplyToIsEnabled()) { TD.DiscoveryMessageWithInvalidReplyTo(message.Headers.MessageId.ToString()); } return isMatch; } return false; } public override bool Match(MessageBuffer buffer) { if (buffer == null) { throw FxTrace.Exception.ArgumentNull("buffer"); } return this.Match(buffer.CreateMessage()); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SignedXml.cs
- PenLineCapValidation.cs
- DbProviderConfigurationHandler.cs
- DebugInfoGenerator.cs
- Certificate.cs
- MILUtilities.cs
- EditorZone.cs
- QueryStack.cs
- TerminatorSinks.cs
- InvalidWMPVersionException.cs
- CryptoKeySecurity.cs
- PointF.cs
- OleDbCommandBuilder.cs
- TimeSpanSecondsOrInfiniteConverter.cs
- ResumeStoryboard.cs
- CodeConditionStatement.cs
- CounterCreationData.cs
- FlowLayoutPanelDesigner.cs
- WaitHandle.cs
- CatalogPart.cs
- SequentialUshortCollection.cs
- Types.cs
- MtomMessageEncodingBindingElement.cs
- CellCreator.cs
- NativeMethods.cs
- XmlAnyElementAttributes.cs
- DataGridViewCellStyleConverter.cs
- ContractCodeDomInfo.cs
- CorrelationResolver.cs
- PrintController.cs
- ListBoxChrome.cs
- CompositeFontFamily.cs
- ItemDragEvent.cs
- ControlValuePropertyAttribute.cs
- GenerateTemporaryTargetAssembly.cs
- FlowDecisionDesigner.xaml.cs
- EntityDesignerUtils.cs
- ThreadLocal.cs
- DataGrid.cs
- ProtocolInformationReader.cs
- ProgressBarRenderer.cs
- GorillaCodec.cs
- SendKeys.cs
- ManagedFilter.cs
- _UncName.cs
- WindowsGraphicsWrapper.cs
- CustomCredentialPolicy.cs
- GAC.cs
- TimelineClockCollection.cs
- Literal.cs
- VerticalAlignConverter.cs
- DirectoryInfo.cs
- ExpressionList.cs
- ModifierKeysConverter.cs
- SafeRightsManagementHandle.cs
- DeflateStream.cs
- ListParagraph.cs
- SectionRecord.cs
- BitmapDecoder.cs
- EventBuilder.cs
- RelatedEnd.cs
- Int32Storage.cs
- XmlComment.cs
- fixedPageContentExtractor.cs
- DataServiceExpressionVisitor.cs
- InkCanvasSelection.cs
- HtmlElement.cs
- XamlClipboardData.cs
- TableItemPatternIdentifiers.cs
- SqlDelegatedTransaction.cs
- ThumbAutomationPeer.cs
- GridViewDeleteEventArgs.cs
- SQlBooleanStorage.cs
- CommandLineParser.cs
- ByteArrayHelperWithString.cs
- LicenseProviderAttribute.cs
- LocationInfo.cs
- ModifierKeysValueSerializer.cs
- Msec.cs
- DataGridViewAdvancedBorderStyle.cs
- ConnectionPoolManager.cs
- InputProcessorProfilesLoader.cs
- RoleService.cs
- TransformedBitmap.cs
- EnumerableCollectionView.cs
- PersonalizableAttribute.cs
- XmlNullResolver.cs
- UnauthorizedWebPart.cs
- VersionPair.cs
- BinaryKeyIdentifierClause.cs
- WSFederationHttpBinding.cs
- XmlSignificantWhitespace.cs
- SqlInternalConnectionTds.cs
- MultiSelectRootGridEntry.cs
- PartialCachingControl.cs
- ScriptBehaviorDescriptor.cs
- BindingGroup.cs
- ColorMatrix.cs
- ConstraintCollection.cs
- DesignerHelpers.cs