#620: wildcards in option AuthorizedIP

This commit is contained in:
Andrey Prygunkov
2019-03-10 21:52:08 +01:00
parent aac98b53ee
commit 15f4955f38
3 changed files with 14 additions and 7 deletions

View File

@@ -301,9 +301,10 @@ bool WebProcessor::IsAuthorizedIp(const char* remoteAddr)
// split option AuthorizedIP into tokens and check each token
bool authorized = false;
Tokenizer tok(g_Options->GetAuthorizedIp(), ",;");
while (const char* iP = tok.Next())
while (const char* ip = tok.Next())
{
if (!strcmp(iP, remoteIp))
WildMask mask(ip);
if (mask.Match(remoteIp))
{
authorized = true;
break;

View File

@@ -397,11 +397,13 @@ SecureKey=
# IP-addresses allowed to connect without authorization.
#
# Comma separated list of privileged IPs for easy access to NZBGet
# built-in web-server (web-interface and RPC). The connected clients
# have full unrestricted access.
# List of privileged IPs for easy access to NZBGet built-in web-server
# (web-interface and RPC). The connected clients have full unrestricted access.
#
# Example: 127.0.0.1,192.168.178.2.
# Separate entries with commas or semicolons. Use wildcard characters
# * and ? for pattern matching.
#
# Example: 127.0.0.1, 192.168.178.*
#
# NOTE: Do not use this option if the program works behind another
# web-server because all requests will have the address of this server.

View File

@@ -829,7 +829,6 @@ var Config = (new function($)
else if (option.caption.toLowerCase().indexOf('password') > -1 &&
option.name.toLowerCase() !== '*unpack:password')
{
console.log(option.caption);
option.type = 'password';
html += '<div class="password-field input-append">' +
'<input type="password" id="' + option.formId + '" value="' + Util.textToAttr(value) + '" class="editsmall">'+
@@ -879,6 +878,11 @@ var Config = (new function($)
htmldescr = htmldescr.replace(/&/g, '&amp;');
// add extra new line after Examples not ended with dot
htmldescr = htmldescr.replace(/Example:.*/g, function (match) {
return match + (Util.endsWith(match, '.') ? '' : '\n');
});
// replace URLs
exp = /(http:\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
htmldescr = htmldescr.replace(exp, "<a href='$1'>$1</a>");