New: Restrict ports that Sonarr will allow for its webserver

This commit is contained in:
Mark McDowall 2015-03-18 23:15:11 -07:00
parent 9dd66879a2
commit 06a2cb0de4
1 changed files with 15 additions and 1 deletions

View File

@ -30,7 +30,21 @@ namespace NzbDrone.Core.Validation
public static IRuleBuilderOptions<T, int> ValidPort<T>(this IRuleBuilder<T, int> ruleBuilder)
{
return ruleBuilder.SetValidator(new InclusiveBetweenValidator(1, 65535));
return ruleBuilder.SetValidator(new InclusiveBetweenValidator(1, 65535))
.Must(x =>
{
if (x <= 1024)
{
if (x == 80 || x == 443)
{
return true;
}
return false;
}
return true;
});
}
public static IRuleBuilderOptions<T, Language> ValidLanguage<T>(this IRuleBuilder<T, Language> ruleBuilder)