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
- WarningException.cs
- PropertyPathWorker.cs
- EntryPointNotFoundException.cs
- MappedMetaModel.cs
- TextRangeBase.cs
- ObjectAnimationBase.cs
- StorageAssociationSetMapping.cs
- DataGridrowEditEndingEventArgs.cs
- TextParaLineResult.cs
- WebPartVerbsEventArgs.cs
- ComponentDispatcherThread.cs
- RadioButtonAutomationPeer.cs
- SvcMapFileLoader.cs
- InOutArgumentConverter.cs
- PlatformCulture.cs
- GeneralTransformCollection.cs
- ClientApiGenerator.cs
- InternalConfigSettingsFactory.cs
- TargetConverter.cs
- XmlDataSourceView.cs
- SelectionProcessor.cs
- smtppermission.cs
- SafeNativeMethods.cs
- TypeDelegator.cs
- SharedDp.cs
- IUnknownConstantAttribute.cs
- Label.cs
- SqlMethodTransformer.cs
- FunctionDetailsReader.cs
- ProxyFragment.cs
- BeginEvent.cs
- ExpressionEvaluator.cs
- PropertyOverridesTypeEditor.cs
- ProjectionCamera.cs
- PeerTransportListenAddressValidator.cs
- SafeHandle.cs
- DataRelationPropertyDescriptor.cs
- SoapObjectWriter.cs
- Environment.cs
- EditorZoneAutoFormat.cs
- Geometry.cs
- TabControlCancelEvent.cs
- BuildResultCache.cs
- Point3DCollectionConverter.cs
- OdbcConnectionString.cs
- RegexCompilationInfo.cs
- WithParamAction.cs
- PageParser.cs
- HttpPostProtocolReflector.cs
- ResourceType.cs
- InfoCardUIAgent.cs
- LicFileLicenseProvider.cs
- EndpointBehaviorElement.cs
- UIElementAutomationPeer.cs
- BidPrivateBase.cs
- Codec.cs
- Container.cs
- TableStyle.cs
- QilPatternFactory.cs
- TraceListeners.cs
- DesignTimeSiteMapProvider.cs
- HtmlInputReset.cs
- CaseExpr.cs
- XamlWriterExtensions.cs
- SystemWebSectionGroup.cs
- DynamicHyperLink.cs
- PhysicalFontFamily.cs
- JsonXmlDataContract.cs
- CollectionViewGroup.cs
- SQLDecimal.cs
- LinqDataSourceView.cs
- StylusLogic.cs
- HotSpotCollection.cs
- ToolBar.cs
- ActiveXSite.cs
- BinaryConverter.cs
- AxImporter.cs
- TrackingProfileSerializer.cs
- SchemaTypeEmitter.cs
- SmiGettersStream.cs
- DataGridViewCheckBoxColumn.cs
- StrokeCollection2.cs
- ToggleProviderWrapper.cs
- SqlDataSource.cs
- MailMessageEventArgs.cs
- StringFreezingAttribute.cs
- TableColumn.cs
- HMACMD5.cs
- DataProviderNameConverter.cs
- TypeExtension.cs
- ProfileGroupSettingsCollection.cs
- SqlDependencyListener.cs
- TextBoxAutoCompleteSourceConverter.cs
- basevalidator.cs
- WebHttpSecurity.cs
- ContainerParaClient.cs
- EntityDescriptor.cs
- MessageFormatterConverter.cs
- HorizontalAlignConverter.cs
- SqlUserDefinedAggregateAttribute.cs