mirror of
https://github.com/schwabe/ics-openvpn.git
synced 2024-09-20 03:52:27 +02:00
Only try to write minivpn once per program lifetime.
Remove debug logging
This commit is contained in:
parent
e2d3bfe01a
commit
e86d8b6769
@ -87,11 +87,11 @@ include $(BUILD_STATIC_LIBRARY)
|
||||
# dynamic library
|
||||
# =====================================================
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_SRC_FILES:= $(common_SRC_FILES)
|
||||
LOCAL_C_INCLUDES:= $(common_C_INCLUDES)
|
||||
LOCAL_MODULE := liblzo
|
||||
LOCAL_PRELINK_MODULE:= false
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
# include $(CLEAR_VARS)
|
||||
# LOCAL_SRC_FILES:= $(common_SRC_FILES)
|
||||
# LOCAL_C_INCLUDES:= $(common_C_INCLUDES)
|
||||
# LOCAL_MODULE := liblzo
|
||||
# LOCAL_PRELINK_MODULE:= false
|
||||
# LOCAL_MODULE_TAGS := optional
|
||||
# include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
|
@ -2475,7 +2475,7 @@ do_option_warnings (struct context *c)
|
||||
{
|
||||
const struct options *o = &c->options;
|
||||
|
||||
#if 1 /* JYFIXME -- port warning */
|
||||
#if 0 /* JYFIXME -- port warning */
|
||||
if (!o->ce.port_option_used && (o->ce.local_port == OPENVPN_PORT && o->ce.remote_port == OPENVPN_PORT))
|
||||
msg (M_WARN, "IMPORTANT: OpenVPN's default port number is now %d, based on an official port number assignment by IANA. OpenVPN 2.0-beta16 and earlier used 5000 as the default port.",
|
||||
OPENVPN_PORT);
|
||||
|
@ -18,13 +18,12 @@
|
||||
|
||||
<TextView
|
||||
style="@style/faqhead"
|
||||
android:text="@string/copying_log_entries" />
|
||||
android:text="@string/faq_shortcut" />
|
||||
|
||||
<TextView
|
||||
style="@style/faqitem"
|
||||
android:text="@string/faq_copying"/>
|
||||
|
||||
|
||||
android:text="@string/faq_howto_shortcut" />
|
||||
|
||||
<TextView
|
||||
style="@style/faqhead"
|
||||
android:text="@string/tap_mode" />
|
||||
@ -35,14 +34,12 @@
|
||||
|
||||
<TextView
|
||||
style="@style/faqhead"
|
||||
android:text="@string/faq_shortcut" />
|
||||
android:text="@string/copying_log_entries" />
|
||||
|
||||
<TextView
|
||||
style="@style/faqitem"
|
||||
android:text="@string/faq_howto_shortcut" />
|
||||
|
||||
|
||||
|
||||
android:text="@string/faq_copying" />
|
||||
|
||||
<TextView
|
||||
style="@style/faqhead"
|
||||
android:text="@string/tap_mode" />
|
||||
|
@ -184,4 +184,5 @@
|
||||
<string name="faq_copying">To copy a single log entry press and and hold on the log entry. To copy/send the whole log use the Send Log option. Use the hardware menu button if not visible in the gui.</string>
|
||||
<string name="faq_shortcut">Shortcut to start</string>
|
||||
<string name="faq_howto_shortcut">You can place a shortcut to start OpenVPN on your desktop. Depending on your homescreen program you have to add a shortcut or a widget.</string>
|
||||
<string name="no_vpn_support_image">Your image does not support the VPNService API,sorry :(</string>
|
||||
</resources>
|
||||
|
@ -78,6 +78,8 @@ public class LaunchVPN extends ListActivity implements OnItemClickListener {
|
||||
private ProfileManager mPM;
|
||||
private VpnProfile mSelectedProfile;
|
||||
|
||||
static boolean minivpnwritten=false;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
@ -210,6 +212,8 @@ public class LaunchVPN extends ListActivity implements OnItemClickListener {
|
||||
}
|
||||
|
||||
private boolean writeMiniVPN() {
|
||||
if(minivpnwritten)
|
||||
return true;
|
||||
try {
|
||||
InputStream mvpn = getAssets().open("minivpn");
|
||||
File mvpnout = new File(getCacheDir(),"minivpn");
|
||||
@ -227,7 +231,7 @@ public class LaunchVPN extends ListActivity implements OnItemClickListener {
|
||||
if(!mvpnout.setExecutable(true))
|
||||
return false;
|
||||
|
||||
|
||||
minivpnwritten=true;
|
||||
return true;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
@ -321,8 +325,10 @@ public class LaunchVPN extends ListActivity implements OnItemClickListener {
|
||||
// Start the query
|
||||
try {
|
||||
startActivityForResult(intent, START_VPN_PROFILE);
|
||||
} catch (ActivityNotFoundException ane){
|
||||
Toast.makeText(this, "Your image does not support the VPNService API,sorry :(", Toast.LENGTH_LONG).show();
|
||||
} catch (ActivityNotFoundException ane) {
|
||||
// Shame on you Sony! At least one user reported that
|
||||
// an official Sony Xperia Arc S image triggers this exception
|
||||
Toast.makeText(this, R.string.no_vpn_support_image, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
} else {
|
||||
onActivityResult(START_VPN_PROFILE, Activity.RESULT_OK, null);
|
||||
@ -341,7 +347,6 @@ public class LaunchVPN extends ListActivity implements OnItemClickListener {
|
||||
Intent startLW = new Intent(getBaseContext(),LogWindow.class);
|
||||
startActivity(startLW);
|
||||
|
||||
OpenVPN.logMessage(0, "", "Writing minivpn binary");
|
||||
if(!writeMiniVPN()) {
|
||||
OpenVPN.logMessage(0, "", "Error writing minivpn binary");
|
||||
return;
|
||||
|
@ -44,7 +44,7 @@ public class OpenVPNThread implements Runnable {
|
||||
|
||||
// Log argv
|
||||
|
||||
OpenVPN.logMessage(0, "argv:" , Arrays.toString(mArgv));
|
||||
//OpenVPN.logMessage(0, "argv:" , Arrays.toString(mArgv));
|
||||
|
||||
startOpenVPNThreadArgs(mArgv);
|
||||
|
||||
@ -77,7 +77,17 @@ public class OpenVPNThread implements Runnable {
|
||||
|
||||
ProcessBuilder pb = new ProcessBuilder(argvlist);
|
||||
// Hack O rama
|
||||
pb.environment().put("LD_LIBRARY_PATH", "/data/data/de.blinkt.openvpn/lib");
|
||||
|
||||
// Hack until I find a good way to get the real library path
|
||||
String applibpath = argv[0].replace("/cache/minivpn", "/lib");
|
||||
|
||||
String lbpath = pb.environment().get("LD_LIBRARY_PATH");
|
||||
if(lbpath==null)
|
||||
lbpath = applibpath;
|
||||
else
|
||||
lbpath = lbpath + ":" + applibpath;
|
||||
|
||||
pb.environment().put("LD_LIBRARY_PATH", lbpath);
|
||||
pb.redirectErrorStream(true);
|
||||
try {
|
||||
mProcess = pb.start();
|
||||
|
@ -33,7 +33,7 @@ public class OpenVpnManagementThread implements Runnable {
|
||||
}
|
||||
|
||||
public void managmentCommand(String cmd) {
|
||||
Log.d("openvpn", "mgmt cmd" + mSocket + " " +cmd + " " );
|
||||
//Log.d("openvpn", "mgmt cmd" + mSocket + " " +cmd + " " );
|
||||
try {
|
||||
mSocket.getOutputStream().write(cmd.getBytes());
|
||||
mSocket.getOutputStream().flush();
|
||||
@ -144,21 +144,24 @@ public class OpenVpnManagementThread implements Runnable {
|
||||
String argument = parts[1];
|
||||
|
||||
|
||||
if(cmd.equals("INFO"))
|
||||
logStatusMessage(command);
|
||||
else if (cmd.equals("PASSWORD")) {
|
||||
if(cmd.equals("INFO")) {
|
||||
// Ignore greeting from mgmt
|
||||
//logStatusMessage(command);
|
||||
}else if (cmd.equals("PASSWORD")) {
|
||||
processPWCommand(argument);
|
||||
} else if (cmd.equals("HOLD")) {
|
||||
managmentCommand("hold release\n");
|
||||
managmentCommand("log on\n");
|
||||
managmentCommand("bytecount 13\n");
|
||||
//managmentCommand("log on\n");
|
||||
} else if (cmd.equals("NEED-OK")) {
|
||||
processNeedCommand(argument);
|
||||
} else if (cmd.equals("LOG")) {
|
||||
OpenVPN.logMessage(0, "", command);
|
||||
String[] args = argument.split(",",3);
|
||||
// 0 unix time stamp
|
||||
// 1 log level N,I,E etc.
|
||||
// 2 log message
|
||||
OpenVPN.logMessage(0, "", args[2]);
|
||||
} else {
|
||||
OpenVPN.logMessage(0, "MGMT:", "Got unrecognized command" + command);
|
||||
managmentCommand("log 1\n");
|
||||
Log.i(TAG, "Got unrecognized command" + command);
|
||||
}
|
||||
} else if (command.startsWith("SUCCESS:")) {
|
||||
|
@ -137,8 +137,6 @@ public class VpnProfile implements Serializable{
|
||||
cfg+=cacheDir.getAbsolutePath();
|
||||
cfg+="\n\n";
|
||||
|
||||
cfg+="# Silences script security warning\n";
|
||||
cfg+="script-security 0\n\n";
|
||||
|
||||
|
||||
boolean useTLSClient = (mAuthenticationType != TYPE_STATICKEYS);
|
||||
@ -350,7 +348,11 @@ public class VpnProfile implements Serializable{
|
||||
|
||||
args.add("--config");
|
||||
args.add(cacheDir.getAbsolutePath() + "/" + OVPNCONFIGFILE);
|
||||
|
||||
// Silences script security warning
|
||||
|
||||
args.add("script-security");
|
||||
args.add("0");
|
||||
|
||||
|
||||
return (String[]) args.toArray(new String[args.size()]);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user