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
- SimpleRecyclingCache.cs
- NavigationPropertyEmitter.cs
- TextTreeObjectNode.cs
- LZCodec.cs
- SortedSetDebugView.cs
- _NegoState.cs
- DupHandleConnectionReader.cs
- DataGridViewHeaderCell.cs
- ObjectManager.cs
- CommentEmitter.cs
- ValidateNames.cs
- TripleDES.cs
- HtmlForm.cs
- OleDbException.cs
- ReferentialConstraint.cs
- Label.cs
- DynamicMetaObject.cs
- InkCanvasInnerCanvas.cs
- ExtensionFile.cs
- SQLRoleProvider.cs
- DefaultAssemblyResolver.cs
- WebReferenceOptions.cs
- LayoutTable.cs
- MapPathBasedVirtualPathProvider.cs
- ParenthesizePropertyNameAttribute.cs
- SqlDuplicator.cs
- SourceLineInfo.cs
- RowSpanVector.cs
- Memoizer.cs
- MetaTable.cs
- HotCommands.cs
- TextDecorationLocationValidation.cs
- CodeGeneratorOptions.cs
- TimeoutValidationAttribute.cs
- CheckBoxFlatAdapter.cs
- HatchBrush.cs
- ClientTargetCollection.cs
- MulticastNotSupportedException.cs
- KeyProperty.cs
- QueueTransferProtocol.cs
- DataObject.cs
- WinFormsSecurity.cs
- DataGridViewRowPostPaintEventArgs.cs
- EntityViewContainer.cs
- ThreadStartException.cs
- GiveFeedbackEventArgs.cs
- TypeLoadException.cs
- DBCSCodePageEncoding.cs
- SourceFileBuildProvider.cs
- KeyInterop.cs
- FigureParagraph.cs
- FixedSOMLineCollection.cs
- CookieParameter.cs
- BuilderInfo.cs
- KnownTypes.cs
- UInt32Storage.cs
- FamilyMap.cs
- MediaContext.cs
- CustomTypeDescriptor.cs
- DataGridViewCellStyle.cs
- Policy.cs
- ComboBoxItem.cs
- PageContentAsyncResult.cs
- StyleXamlTreeBuilder.cs
- ReverseInheritProperty.cs
- WorkflowRuntimeSection.cs
- StateManagedCollection.cs
- XmlName.cs
- MimeMapping.cs
- CollectionViewGroupRoot.cs
- ChtmlMobileTextWriter.cs
- ConnectionsZone.cs
- ViewStateChangedEventArgs.cs
- ControlCachePolicy.cs
- WorkflowInstance.cs
- HttpHandlerAction.cs
- XmlAggregates.cs
- PaginationProgressEventArgs.cs
- dtdvalidator.cs
- WorkflowValidationFailedException.cs
- HostSecurityManager.cs
- DataGridViewRowHeightInfoNeededEventArgs.cs
- WebPartConnectionsConfigureVerb.cs
- PointKeyFrameCollection.cs
- DataGridViewCellMouseEventArgs.cs
- Screen.cs
- RemotingSurrogateSelector.cs
- ReferenceSchema.cs
- SafeIUnknown.cs
- EntityDataSourceChangedEventArgs.cs
- ExceptionTrace.cs
- Matrix3D.cs
- PointHitTestParameters.cs
- ProcessProtocolHandler.cs
- COM2ComponentEditor.cs
- TraceListeners.cs
- Span.cs
- Task.cs
- NavigationProgressEventArgs.cs
- LayoutUtils.cs