Skip to content
This repository has been archived by the owner on Sep 6, 2019. It is now read-only.

Commit

Permalink
Whitelist subnets
Browse files Browse the repository at this point in the history
Fixes #1501
  • Loading branch information
M66B committed Mar 4, 2014
1 parent f1ce219 commit 1726515
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Changelog

* Small layout fix (reported on XDA)
* Moved user defined dangerous functions to template
* Whitelist subnets ([issue](/../../issues/1501))

[Open issues](https://github.com/M66B/XPrivacy/issues?state=open)

Expand Down
14 changes: 10 additions & 4 deletions src/biz/bokhorst/xprivacy/PrivacyService.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.lang.reflect.Method;
import java.util.ArrayList;
Expand Down Expand Up @@ -44,6 +43,7 @@
import android.os.StrictMode.ThreadPolicy;
import android.text.TextUtils;
import android.util.Log;
import android.util.Patterns;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;
Expand Down Expand Up @@ -1519,9 +1519,15 @@ private String getXExtra(PRestriction restriction, Hook hook) {
if (!TextUtils.isEmpty(folder))
return folder + File.separatorChar + "*";
} else if (hook.whitelist().equals(Meta.cTypeIPAddress)) {
int dot = restriction.extra.indexOf('.');
if (dot > 0)
return '*' + restriction.extra.substring(dot);
if (Patterns.IP_ADDRESS.matcher(restriction.extra).matches()) {
int dot = restriction.extra.lastIndexOf('.');
if (dot > 0)
return restriction.extra.substring(0, dot + 1) + '*';
} else {
int dot = restriction.extra.indexOf('.');
if (dot > 0)
return '*' + restriction.extra.substring(dot);
}
}
return null;
}
Expand Down

0 comments on commit 1726515

Please sign in to comment.