Navigation Menu

Skip to content

Commit

Permalink
Accept multiple priviledged IP ranges correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Aug 2, 2012
1 parent c9f0d16 commit 171618b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/api/2011-02-01/configuration.js
Expand Up @@ -330,14 +330,15 @@ function getClientIp(request) {


exports.createHandler = function(context, config) {
var privilegedRanges = config && config.privilegedRanges;
privilegedRanges = privilegedRanges.split(/[,\| ]/);
var privilegedRanges = config &&
config.privilegedRanges &&
config.privilegedRanges.split(/[,\| ]/);
return function(request, response, next) {
var message, body;

// GCS specific behaviour: prevent to access this API from specific IP
// range.
if (privilegedRange) {
if (privilegedRanges && privilegedRanges.length) {
if (!privilegedRanges.some(function(privilegedRange) {
return ipv4.isInRange(getClientIp(request), privilegedRange);
})) {
Expand Down

0 comments on commit 171618b

Please sign in to comment.