From 2c9fbcf2ef24de770ff087e3d515e4824426891d Mon Sep 17 00:00:00 2001 From: mpl Date: Thu, 26 Apr 2018 13:28:15 -0700 Subject: [PATCH] client/android: remove self-signed cert option Change-Id: I902b45cf7ac6e05d9085494a902a4554ac3a17af --- .../main/java/org/camlistore/Preferences.java | 5 ----- .../java/org/camlistore/SettingsActivity.java | 17 ----------------- .../main/java/org/camlistore/UploadService.java | 2 +- .../main/java/org/camlistore/UploadThread.java | 5 +---- .../android/app/src/main/res/values/strings.xml | 2 -- .../app/src/main/res/xml/preferences.xml | 6 ------ 6 files changed, 2 insertions(+), 35 deletions(-) diff --git a/clients/android/app/src/main/java/org/camlistore/Preferences.java b/clients/android/app/src/main/java/org/camlistore/Preferences.java index 00d70b785..e3dec7adb 100644 --- a/clients/android/app/src/main/java/org/camlistore/Preferences.java +++ b/clients/android/app/src/main/java/org/camlistore/Preferences.java @@ -34,7 +34,6 @@ public final class Preferences { public static final String HOST = "camli.host"; // TODO(mpl): list instead of single string later? seems overkill for now. - public static final String TRUSTED_CERT = "camli.trusted_cert"; public static final String USERNAME = "camli.username"; public static final String PASSWORD = "camli.password"; public static final String AUTO = "camli.auto"; @@ -126,10 +125,6 @@ public final class Preferences { return new HostPort(mSP.getString(Preferences.HOST, "")); } - public String trustedCert() { - return mSP.getString(TRUSTED_CERT, "").toLowerCase(); - } - public void setDevIP(String value) { mSP.edit().putString(DEV_IP, value).apply(); } diff --git a/clients/android/app/src/main/java/org/camlistore/SettingsActivity.java b/clients/android/app/src/main/java/org/camlistore/SettingsActivity.java index 1c146677f..7a869be1f 100644 --- a/clients/android/app/src/main/java/org/camlistore/SettingsActivity.java +++ b/clients/android/app/src/main/java/org/camlistore/SettingsActivity.java @@ -52,7 +52,6 @@ public class SettingsActivity extends PreferenceActivity { private IUploadService mServiceStub = null; private EditTextPreference hostPref; - private EditTextPreference trustedCertPref; private EditTextPreference usernamePref; private EditTextPreference passwordPref; private EditTextPreference devIPPref; @@ -83,7 +82,6 @@ public class SettingsActivity extends PreferenceActivity { Map m = new HashMap(); m.put(Preferences.HOST, "server"); - m.put(Preferences.TRUSTED_CERT, "certFingerprint"); m.put(Preferences.USERNAME, "username"); m.put(Preferences.PASSWORD, "password"); m.put(Preferences.AUTO, "autoUpload"); @@ -94,7 +92,6 @@ public class SettingsActivity extends PreferenceActivity { addPreferencesFromResource(R.xml.preferences); hostPref = (EditTextPreference) findPreference(Preferences.HOST); - trustedCertPref = (EditTextPreference) findPreference(Preferences.TRUSTED_CERT); usernamePref = (EditTextPreference) findPreference(Preferences.USERNAME); passwordPref = (EditTextPreference) findPreference(Preferences.PASSWORD); autoPref = (CheckBoxPreference) findPreference(Preferences.AUTO); @@ -121,8 +118,6 @@ public class SettingsActivity extends PreferenceActivity { : null; if (pref == hostPref) { updateHostSummary(newStr); - } else if (pref == trustedCertPref) { - updateTrustedCertSummary(newStr); } else if (pref == passwordPref) { updatePasswordSummary(newStr); } else if (pref == usernamePref) { @@ -137,7 +132,6 @@ public class SettingsActivity extends PreferenceActivity { } }; hostPref.setOnPreferenceChangeListener(onChange); - trustedCertPref.setOnPreferenceChangeListener(onChange); passwordPref.setOnPreferenceChangeListener(onChange); usernamePref.setOnPreferenceChangeListener(onChange); maxCacheSizePref.setOnPreferenceChangeListener(onChange); @@ -195,7 +189,6 @@ public class SettingsActivity extends PreferenceActivity { @Override public void onClick(DialogInterface dialog, int id) { hostPref.setText(uri.getQueryParameter("server")); - trustedCertPref.setText(uri.getQueryParameter("certFingerprint")); usernamePref.setText(uri.getQueryParameter("username")); String auto = uri.getQueryParameter("autoUpload"); autoPref.setChecked(auto != null && auto.equals("1")); @@ -256,7 +249,6 @@ public class SettingsActivity extends PreferenceActivity { private void updatePreferenceSummaries() { updateHostSummary(hostPref.getText()); - updateTrustedCertSummary(trustedCertPref.getText()); updatePasswordSummary(passwordPref.getText()); updateAutoOpts(autoPref.isChecked()); updateMaxCacheSizeSummary(maxCacheSizePref.getText()); @@ -282,7 +274,6 @@ public class SettingsActivity extends PreferenceActivity { } boolean enabled = TextUtils.isEmpty(value); hostPref.setEnabled(enabled); - trustedCertPref.setEnabled(enabled); usernamePref.setEnabled(enabled); passwordPref.setEnabled(enabled); if (!enabled) { @@ -317,14 +308,6 @@ public class SettingsActivity extends PreferenceActivity { } } - private void updateTrustedCertSummary(String value) { - if (value != null && value.length() > 0) { - trustedCertPref.setSummary(value); - } else { - trustedCertPref.setSummary(""); - } - } - private void updateAutoOpts(boolean checked) { autoOpts.setEnabled(checked); } diff --git a/clients/android/app/src/main/java/org/camlistore/UploadService.java b/clients/android/app/src/main/java/org/camlistore/UploadService.java index 97dcff6fd..3e72032df 100644 --- a/clients/android/app/src/main/java/org/camlistore/UploadService.java +++ b/clients/android/app/src/main/java/org/camlistore/UploadService.java @@ -752,7 +752,7 @@ public class UploadService extends Service { mLastNotificationProgress = -1; mUploading = true; - mUploadThread = new UploadThread(UploadService.this, hp, mPrefs.trustedCert(), mPrefs.username(), mPrefs.password()); + mUploadThread = new UploadThread(UploadService.this, hp, mPrefs.username(), mPrefs.password()); mUploadThread.start(); // Start a thread to release the wakelock... diff --git a/clients/android/app/src/main/java/org/camlistore/UploadThread.java b/clients/android/app/src/main/java/org/camlistore/UploadThread.java index 5cd9c3de5..ea9cadc59 100644 --- a/clients/android/app/src/main/java/org/camlistore/UploadThread.java +++ b/clients/android/app/src/main/java/org/camlistore/UploadThread.java @@ -39,7 +39,6 @@ public class UploadThread extends Thread { private final UploadService mService; private final HostPort mHostPort; - private final String mTrustedCert; private final String mUsername; private final String mPassword; private final LinkedBlockingQueue msgCh = new LinkedBlockingQueue(); @@ -54,10 +53,9 @@ public class UploadThread extends Thread { // to stdinWriter private BufferedWriter stdinWriter; - public UploadThread(UploadService uploadService, HostPort hp, String trustedCert, String username, String password) { + public UploadThread(UploadService uploadService, HostPort hp, String username, String password) { mService = uploadService; mHostPort = hp; - mTrustedCert = trustedCert != null ? trustedCert.toLowerCase().trim() : ""; mUsername = username; mPassword = password; } @@ -163,7 +161,6 @@ public class UploadThread extends Thread { pb.command(binaryPath("pk-put.bin"), "--server=" + mHostPort.urlPrefix(), "file", "-stdinargs", "-vivify"); pb.redirectErrorStream(false); pb.environment().put("CAMLI_AUTH", "userpass:" + mUsername + ":" + mPassword); - pb.environment().put("CAMLI_TRUSTED_CERT", mTrustedCert); pb.environment().put("CAMLI_CACHE_DIR", mService.getCacheDir().getAbsolutePath()); pb.environment().put("CAMPUT_ANDROID_OUTPUT", "1"); process = pb.start(); diff --git a/clients/android/app/src/main/res/values/strings.xml b/clients/android/app/src/main/res/values/strings.xml index a3e0db77d..64f398927 100644 --- a/clients/android/app/src/main/res/values/strings.xml +++ b/clients/android/app/src/main/res/values/strings.xml @@ -9,8 +9,6 @@ default QR Scan QR code from /ui/mobile.html - Self-signed cert fingerprint - The fingerprint of your self-signed certificate. Not needed for commercial certs. Username Password Maximum cache size diff --git a/clients/android/app/src/main/res/xml/preferences.xml b/clients/android/app/src/main/res/xml/preferences.xml index 5c0a342df..f93be38fb 100644 --- a/clients/android/app/src/main/res/xml/preferences.xml +++ b/clients/android/app/src/main/res/xml/preferences.xml @@ -67,12 +67,6 @@ android:singleLine="true" android:title="@string/settings_max_cache_size_title" /> - -