]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
android: Don't require a password on Android 7 and newer
authorTobias Brunner <tobias@strongswan.org>
Fri, 27 Mar 2020 09:26:51 +0000 (10:26 +0100)
committerTobias Brunner <tobias@strongswan.org>
Fri, 30 Oct 2020 14:34:07 +0000 (15:34 +0100)
src/frontends/android/app/src/main/java/org/strongswan/android/logic/CharonVpnService.java
src/frontends/android/app/src/main/jni/libandroidbridge/backend/android_service.c

index c46605dfcbd8c9ac38a5455da14de9b573f0e021..71635123459d4443e65201e6f16ef9ef1fef768d 100644 (file)
@@ -307,7 +307,8 @@ public class CharonVpnService extends VpnService implements Runnable, VpnStateSe
                                                {
                                                        Log.i(TAG, "charon started");
 
-                                                       if (mCurrentProfile.getVpnType().has(VpnTypeFeature.USER_PASS) &&
+                                                       if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N &&
+                                                               mCurrentProfile.getVpnType().has(VpnTypeFeature.USER_PASS) &&
                                                                mCurrentProfile.getPassword() == null)
                                                        {       /* this can happen if Always-on VPN is enabled with an incomplete profile */
                                                                setError(ErrorState.PASSWORD_MISSING);
index c1c1e3acd5bcc4052191a111f789f578d887bedf..9c65768f19b1afb178c492447ddacf6b574c2046 100644 (file)
@@ -662,7 +662,10 @@ static void add_auth_cfg_pw(private_android_service_t *this,
        }
        auth->add(auth, AUTH_RULE_IDENTITY, id);
 
-       this->creds->add_username_password(this->creds, username, password);
+       if (password)
+       {
+               this->creds->add_username_password(this->creds, username, password);
+       }
        peer_cfg->add_auth_cfg(peer_cfg, auth, TRUE);
 }