Giter VIP home page Giter VIP logo

Comments (101)

ffyliu avatar ffyliu commented on July 1, 2024 9

I compile with below modify,openconnect can run on mate30、pixel2、android Q-emulator

update GNUTLS to version 3.6.8
update NETTLE to version 3.4.1
modify below files:(rootPath = ics-openconnect/external/openconnect/android/sources/)
./oath-toolkit-2.6.2/oathtool/gl/vasnprintf.c
./oath-toolkit-2.6.2/liboath/gl/vasnprintf.c
./oath-toolkit-2.6.2/libpskc/gl/tests/vasnprintf.c

the attachment is the modify of ./oath-toolkit-2.6.2/oathtool/gl/vasnprintf.c
do the same with other two files and compile

oath-toolkit-2.6.2_oathtool_gl_vasnprintf.zip

from ics-openconnect.

davemidd avatar davemidd commented on July 1, 2024 2

What's the chance of one you guys getting the fix into a Pull Request? :)

from ics-openconnect.

kiavash-at-work avatar kiavash-at-work commented on July 1, 2024

It also crashes on Android Studio Q emulator.

from ics-openconnect.

bukowski12 avatar bukowski12 commented on July 1, 2024

The app crashes when trying to connect on Android 10/Pixel

from ics-openconnect.

larionov avatar larionov commented on July 1, 2024

Crashes on pixel 3 xl with android 10

from ics-openconnect.

contemno avatar contemno commented on July 1, 2024

After figuring out how to crudely build and debug Android apps in Android Studio, I found this error on the debugging console on Android 10 that I didn't get on Android 9 (on which the app still works):

A/libc: FORTIFY: %n not allowed on Android

Apparently %n was used in exploits in older versions of sprintf, and Android 9 and below silently sanitizes it. Android 10 will not and refuse to accept it, causing the app to crash. The component responsible for this security feature is called FORTIFY.

https://android-developers.googleblog.com/2017/04/fortify-in-android.html

In the five vasnprintf.c files that contain:

#if USE_SNPRINTF
# if !(((__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) && !defined __UCLIBC__) || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
                fbp[1] = '%';
                fbp[2] = 'n';
                fbp[3] = '\0';
# else
                /* On glibc2 systems from glibc >= 2.3 - probably also older
                   ones - we know that snprintf's return value conforms to
                   ISO C 99: the tests gl_SNPRINTF_RETVAL_C99 and
                   gl_SNPRINTF_TRUNCATION_C99 pass.
                   Therefore we can avoid using %n in this situation.
                   On glibc2 systems from 2004-10-18 or newer, the use of %n
                   in format strings in writable memory may crash the program
                   (if compiled with _FORTIFY_SOURCE=2), so we should avoid it
                   in this situation.  */
                /* On native Windows systems (such as mingw), we can avoid using
                   %n because:
                     - Although the gl_SNPRINTF_TRUNCATION_C99 test fails,
                       snprintf does not write more than the specified number
                       of bytes. (snprintf (buf, 3, "%d %d", 4567, 89) writes
                       '4', '5', '6' into buf, not '4', '5', '\0'.)
                     - Although the gl_SNPRINTF_RETVAL_C99 test fails, snprintf
                       allows us to recognize the case of an insufficient
                       buffer size: it returns -1 in this case.
                   On native Windows systems (such as mingw) where the OS is
                   Windows Vista, the use of %n in format strings by default
                   crashes the program. See
                     <http://gcc.gnu.org/ml/gcc/2007-06/msg00122.html> and
                     <http://msdn2.microsoft.com/en-us/library/ms175782(VS.80).aspx>
                   So we should avoid %n in this situation.  */
                fbp[1] = '\0';
# endif
#else
                fbp[1] = '\0';
#endif

Based on these comments:

https://lists.gnu.org/archive/html/bug-gnulib/2018-12/msg00126.html
https://lists.gnu.org/archive/html/bug-gnulib/2019-01/msg00122.html
https://gitlab.com/gnutls/gnutls/issues/653

I tried patching the line:

# if !(((__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) && !defined __UCLIBC__) || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
to:
# if !(((__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) && !defined __UCLIBC__) || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) || defined __ANDROID__)

but that doesn't seem to work.

It's highly likely that that because I don't know what I'm doing, I'm not building the c libraries ( liboppenconnect, libgnutls, etc) with the NDK (20.0.5594570) correctly or I'm looking in the wrong place.

My next steps are to figure out how to print debugging messages or a stack trace to figure out where in the c libraries the app dies, and what is trying to pass %n.

from ics-openconnect.

cernekee avatar cernekee commented on July 1, 2024

https://gitlab.com/gnutls/gnutls/issues/653

IMO this is the most likely culprit, although you might want to check adb logcat for a stack trace to confirm. It's possible that updating $OPENCONNECT/android/ to the latest GnuTLS will cure it.

from ics-openconnect.

contemno avatar contemno commented on July 1, 2024

I tried updating GnuTLS to 3.6.9 and Nettle to 3.4.1 but still get A/libc: FORTIFY: %n not allowed on Android message.

I noticed that the oath-toolkit also had a copy of vasnprintf.c, and from what I could find, the latest version is 2.6.2 is from 2016. It may need to be updated to avoid using '%n' on Android.

from ics-openconnect.

astv25 avatar astv25 commented on July 1, 2024

2019-09-25 11:34:22.426 14776-14776/? A/DEBUG: Timestamp: 2019-09-25 11:34:22-0500 2019-09-25 11:34:22.426 14776-14776/? A/DEBUG: pid: 14646, tid: 14773, name: OpenVPNManageme >>> app.openconnect <<< 2019-09-25 11:34:22.427 14776-14776/? A/DEBUG: uid: 10135 2019-09-25 11:34:22.427 14776-14776/? A/DEBUG: signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr -------- 2019-09-25 11:34:22.427 14776-14776/? A/DEBUG: Abort message: 'FORTIFY: %n not allowed on Android' 2019-09-25 11:34:22.427 14776-14776/? A/DEBUG: eax 00000000 ebx 00003936 ecx 000039b5 edx 00000006 2019-09-25 11:34:22.427 14776-14776/? A/DEBUG: edi eaf0433e esi bf9752e0 2019-09-25 11:34:22.427 14776-14776/? A/DEBUG: ebp edca5ad0 esp bf975288 eip edca5ad9 2019-09-25 11:34:22.572 14776-14776/? A/DEBUG: backtrace: 2019-09-25 11:34:22.573 14776-14776/? A/DEBUG: #00 pc 00000ad9 [vdso] (__kernel_vsyscall+9) 2019-09-25 11:34:22.573 14776-14776/? A/DEBUG: #01 pc 00092328 /apex/com.android.runtime/lib/bionic/libc.so (syscall+40) (BuildId: 76290498408016ad14f4b98c3ab6c65c) 2019-09-25 11:34:22.573 14776-14776/? A/DEBUG: #02 pc 000ad651 /apex/com.android.runtime/lib/bionic/libc.so (abort+193) (BuildId: 76290498408016ad14f4b98c3ab6c65c) 2019-09-25 11:34:22.573 14776-14776/? A/DEBUG: #03 pc 000f46fa /apex/com.android.runtime/lib/bionic/libc.so (__fortify_fatal(char const*, ...)+58) (BuildId: 76290498408016ad14f4b98c3ab6c65c) 2019-09-25 11:34:22.573 14776-14776/? A/DEBUG: #04 pc 000f3dcb /apex/com.android.runtime/lib/bionic/libc.so (__vfprintf+11211) (BuildId: 76290498408016ad14f4b98c3ab6c65c) 2019-09-25 11:34:22.573 14776-14776/? A/DEBUG: #05 pc 001133aa /apex/com.android.runtime/lib/bionic/libc.so (snprintf+170) (BuildId: 76290498408016ad14f4b98c3ab6c65c) 2019-09-25 11:34:22.573 14776-14776/? A/DEBUG: #06 pc 000a1440 /data/app/app.openconnect-H8SZUkhIAU2jL7Oh7V1vuw==/lib/x86/libopenconnect.so (vasnprintf+3088)

I got the following trace from an (emulated) Pixel 2 running API 29. It looks like GnuTLS removed their implementation of vasprintf in favor of the gnulib one.

from ics-openconnect.

ffyliu avatar ffyliu commented on July 1, 2024

Whether anyone has solved this problem, I also encountered the same problem on pix2-androidQ。

from ics-openconnect.

aissat avatar aissat commented on July 1, 2024

emulator

Hi, @ffyliu updated my code like u but I have new error msg
I'm already using
GNUTLS to version 3.6.9
NETTLE to version 3.5.1
Got inappropriate HTTP CONNECT response: HTTP/1.1 401 Cookie is not acceptable Error establishing VPN link Error establishing VPN link

from ics-openconnect.

aryan549 avatar aryan549 commented on July 1, 2024

Hi @ffyliu ,

Thanks for the fix. its working perfectly

from ics-openconnect.

itfintech avatar itfintech commented on July 1, 2024

Hello to all,
Thx a lot @ffyliu for solution option, it's working but it affected the OPPO R9s.

12-04 09:17:34.837 9397-9397/com.hidemepls.vpn E/AndroidRuntime: FATAL EXCEPTION: main Process: com.hidemepls.vpn, PID: 9397 java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "in6addr_any" referenced by "/data/app/com.hidemepls.vpn-1/lib/arm64/libopenconnect.so"... at java.lang.Runtime.loadLibrary(Runtime.java:372) at java.lang.System.loadLibrary(System.java:988) at com.hidemepls.vpn.TheApplication.onCreate(TheApplication.java:93) at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1017) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5084) at android.app.ActivityThread.access$1700(ActivityThread.java:197) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1672) at android.os.Handler.dispatchMessage(Handler.java:111) at android.os.Looper.loop(Looper.java:224) at android.app.ActivityThread.main(ActivityThread.java:5958) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1113) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:879)

I will appreciate if someone can help me to identify what can be the reason.
Note the old version on OPPO works fine asap I apply the fix P30 works fine but OPPO no.

from ics-openconnect.

fariya12 avatar fariya12 commented on July 1, 2024

Whether anyone has solved this problem, any working solution ???, if anyone.... please help me ...

from ics-openconnect.

kmchmk avatar kmchmk commented on July 1, 2024

Whether anyone has solved this problem, any working solution ???, if anyone.... please help me ...

Try this.
https://play.google.com/store/apps/details?id=com.github.digitalsoftwaresolutions.openconnect

from ics-openconnect.

tnzil avatar tnzil commented on July 1, 2024

please help whenever I try to compile with nettle 3.4.1 and gnutls 3.6.8

checking for guile-snarf... /usr/bin/guile-snarf
checking for guild... /usr/bin/guild
checking for arm-linux-androideabi-pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
configure: checking for guile 2.2
configure: checking for guile 2.0
configure: checking for guile 1.8
configure: error:
No Guile development packages were found.

Please verify that you have Guile installed. If you installed Guile
from a binary distribution, please verify that you have also installed
the development packages. If you installed it yourself, you might need
to adjust your PKG_CONFIG_PATH; see the pkg-config man page for more.

from ics-openconnect.

farhananwar187 avatar farhananwar187 commented on July 1, 2024

I compile with below modify,openconnect can run on mate30、pixel2、android Q-emulator

update GNUTLS to version 3.6.8
update NETTLE to version 3.4.1
modify below files:(rootPath = ics-openconnect/external/openconnect/android/sources/)
./oath-toolkit-2.6.2/oathtool/gl/vasnprintf.c
./oath-toolkit-2.6.2/liboath/gl/vasnprintf.c
./oath-toolkit-2.6.2/libpskc/gl/tests/vasnprintf.c

the attachment is the modify of ./oath-toolkit-2.6.2/oathtool/gl/vasnprintf.c
do the same with other two files and compile

oath-toolkit-2.6.2_oathtool_gl_vasnprintf.zip

please help whenever I try to compile with nettle 3.4.1 and gnutls 3.6.8

checking for guile-snarf... /usr/bin/guile-snarf
checking for guild... /usr/bin/guild
checking for arm-linux-androideabi-pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
configure: checking for guile 2.2
configure: checking for guile 2.0
configure: checking for guile 1.8
configure: error:
No Guile development packages were found.

Please verify that you have Guile installed. If you installed Guile
from a binary distribution, please verify that you have also installed
the development packages. If you installed it yourself, you might need
to adjust your PKG_CONFIG_PATH; see the pkg-config man page for more.

from ics-openconnect.

manuelfleri avatar manuelfleri commented on July 1, 2024

I compile with below modify,openconnect can run on mate30、pixel2、android Q-emulator

update GNUTLS to version 3.6.8
update NETTLE to version 3.4.1
modify below files:(rootPath = ics-openconnect/external/openconnect/android/sources/)
./oath-toolkit-2.6.2/oathtool/gl/vasnprintf.c
./oath-toolkit-2.6.2/liboath/gl/vasnprintf.c
./oath-toolkit-2.6.2/libpskc/gl/tests/vasnprintf.c

the attachment is the modify of ./oath-toolkit-2.6.2/oathtool/gl/vasnprintf.c
do the same with other two files and compile

oath-toolkit-2.6.2_oathtool_gl_vasnprintf.zip

I haven't got this folder, my path terminates at " ics-openconnect/external/openconnect/android/", and there are just some files inside, but no "oath-toolkit-2.6.2", how can I overcome this?

from ics-openconnect.

itfintech avatar itfintech commented on July 1, 2024

Run make first, the script will download the dependency, after you will have these files.

from ics-openconnect.

manuelfleri avatar manuelfleri commented on July 1, 2024

Run make first, the script will download the dependency, after you will have these files.

Thank you very much for the quick reply!

I forgot to mention that I already tried, but it gives me this error :

/opt/android-sdk-linux_x86/android-ndk-r16b/build/tools/make-standalone-toolchain.sh --platform=android-14 --arch=arm --install-dir=/Users/[myFolder]/external/openconnect/android/arm-linux-androideabi/toolchain ||
/opt/android-sdk-linux_x86/android-ndk-r16b/build/tools/make-standalone-toolchain.sh
--platform=android-14 --arch=arm --install-dir=/Users/[myFolder]/external/openconnect/android/arm-linux-androideabi/toolchain --system=linux-x86_64
/bin/sh: /opt/android-sdk-linux_x86/android-ndk-r16b/build/tools/make-standalone-toolchain.sh: No such file or directory
/bin/sh: /opt/android-sdk-linux_x86/android-ndk-r16b/build/tools/make-standalone-toolchain.sh: No such file or directory
make: *** [/Users/[myFolder]/external/openconnect/android/arm-linux-androideabi/toolchain/.built] Error 127

Does anyone know how to deal with this? I tried to install the ndk following this guide: "https://gist.github.com/Tydus/11109634", and it seemed to work, but still I get that error.

Thanks in advance.

from ics-openconnect.

DenysFrasinich avatar DenysFrasinich commented on July 1, 2024

Hello! I applyed workaround from @ffyliu comment (#51 (comment)) and it works fine on my pixel 3.
Here are some pull requests:
cernekee/openconnect#3
#59

from ics-openconnect.

fariya12 avatar fariya12 commented on July 1, 2024

@ffyliu after i apply your workaround still my app is getting crashed. how to fix it any solution

from ics-openconnect.

davemidd avatar davemidd commented on July 1, 2024

@ffyliu after i apply your workaround still my app is getting crashed. how to fix it any solution

https://play.google.com/store/apps/details?id=com.github.digitalsoftwaresolutions.openconnect

from ics-openconnect.

farhananwar187 avatar farhananwar187 commented on July 1, 2024

@ffyliu after i apply your workaround still my app is getting crashed. how to fix it any solution

https://play.google.com/store/apps/details?id=com.github.digitalsoftwaresolutions.openconnect

I have found the solution, you can contact me at
[email protected]

from ics-openconnect.

noman720 avatar noman720 commented on July 1, 2024

Hello! I applyed workaround from @ffyliu comment (#51 (comment)) and it works fine on my pixel 3.
Here are some pull requests:
cernekee/openconnect#3
#59

@DenysFrasinich I have applied the changes according to your PR without updating NDK version (android-ndk-r16b), but still having the issue. Can you please help me to fix it?
Changes:

  • GNUTLS to version 3.6.12
  • NETTLE to version 3.4.1
  • Applied patch < oathtool.diff
  • Applied patch < liboath.diff
  • Applied patch < libpskc.diff

from ics-openconnect.

edmondscommerce avatar edmondscommerce commented on July 1, 2024

anyone else landing here from Google - I found that uninstalling completely and reinstalling fresh fixed a crash issue. Not sure if its this one exactly but it worked - affected at least 2 phones

from ics-openconnect.

astv25 avatar astv25 commented on July 1, 2024

@edmondscommerce this exact version was pulled from the Play Store until the build issues have been solved. Someone has, meanwhile, forked this, implemented a fix, and put their version on the store.

from ics-openconnect.

NgoHuy avatar NgoHuy commented on July 1, 2024

please help whenever I try to compile with nettle 3.4.1 and gnutls 3.6.8

checking for guile-snarf... /usr/bin/guile-snarf
checking for guild... /usr/bin/guild
checking for arm-linux-androideabi-pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
configure: checking for guile 2.2
configure: checking for guile 2.0
configure: checking for guile 1.8
configure: error:
No Guile development packages were found.

Please verify that you have Guile installed. If you installed Guile
from a binary distribution, please verify that you have also installed
the development packages. If you installed it yourself, you might need
to adjust your PKG_CONFIG_PATH; see the pkg-config man page for more.

You need build gnutls with option --disable-guile

from ics-openconnect.

NgoHuy avatar NgoHuy commented on July 1, 2024

Run make first, the script will download the dependency, after you will have these files.

Thank you very much for the quick reply!

I forgot to mention that I already tried, but it gives me this error :

/opt/android-sdk-linux_x86/android-ndk-r16b/build/tools/make-standalone-toolchain.sh --platform=android-14 --arch=arm --install-dir=/Users/[myFolder]/external/openconnect/android/arm-linux-androideabi/toolchain ||
/opt/android-sdk-linux_x86/android-ndk-r16b/build/tools/make-standalone-toolchain.sh
--platform=android-14 --arch=arm --install-dir=/Users/[myFolder]/external/openconnect/android/arm-linux-androideabi/toolchain --system=linux-x86_64
/bin/sh: /opt/android-sdk-linux_x86/android-ndk-r16b/build/tools/make-standalone-toolchain.sh: No such file or directory
/bin/sh: /opt/android-sdk-linux_x86/android-ndk-r16b/build/tools/make-standalone-toolchain.sh: No such file or directory
make: *** [/Users/[myFolder]/external/openconnect/android/arm-linux-androideabi/toolchain/.built] Error 127

Does anyone know how to deal with this? I tried to install the ndk following this guide: "https://gist.github.com/Tydus/11109634", and it seemed to work, but still I get that error.

Thanks in advance.

You must set NDK in Makefile to your NDK directory

from ics-openconnect.

NgoHuy avatar NgoHuy commented on July 1, 2024

I have built with latest all softwares (include NDK), it worked like a charm.

from ics-openconnect.

NgoHuy avatar NgoHuy commented on July 1, 2024

Anyone can test my apk with latest build from gnutls, nettle, lz4, libxml2, gmp
https://drive.google.com/file/d/1ynE77127QPLzoDSLCXOPI2HEMx3YXGXN/view?usp=sharing

from ics-openconnect.

NgoHuy avatar NgoHuy commented on July 1, 2024

Anyone can test my apk with latest build from gnutls, nettle, lz4, libxml2, gmp
https://drive.google.com/file/d/1ynE77127QPLzoDSLCXOPI2HEMx3YXGXN/view?usp=sharing

Please contact me at [email protected] or skype [email protected] i can pay you for source.

It's free software, man,
You can build with openconnect from my gitlab repository: https://gitlab.com/Severush1/openconnect and https://github.com/dlenski/ics-openconnect/pull/10/files.

from ics-openconnect.

AzaKhan045 avatar AzaKhan045 commented on July 1, 2024

@NgoHuy I did exact same to same as you mentioned in Latest curl dlenski#10
but getting same error in android 10 please help me to resolve this issue ,
I can pay you the fee if you want,
my email is ; [email protected]

from ics-openconnect.

AzaKhan045 avatar AzaKhan045 commented on July 1, 2024

I compile with below modify,openconnect can run on mate30、pixel2、android Q-emulator

update GNUTLS to version 3.6.8
update NETTLE to version 3.4.1
modify below files:(rootPath = ics-openconnect/external/openconnect/android/sources/)
./oath-toolkit-2.6.2/oathtool/gl/vasnprintf.c
./oath-toolkit-2.6.2/liboath/gl/vasnprintf.c
./oath-toolkit-2.6.2/libpskc/gl/tests/vasnprintf.c

the attachment is the modify of ./oath-toolkit-2.6.2/oathtool/gl/vasnprintf.c
do the same with other two files and compile

oath-toolkit-2.6.2_oathtool_gl_vasnprintf.zip

please let us know how to do this update as I am new to android studio!

from ics-openconnect.

NgoHuy avatar NgoHuy commented on July 1, 2024

I compile with below modify,openconnect can run on mate30、pixel2、android Q-emulator
update GNUTLS to version 3.6.8
update NETTLE to version 3.4.1
modify below files:(rootPath = ics-openconnect/external/openconnect/android/sources/)
./oath-toolkit-2.6.2/oathtool/gl/vasnprintf.c
./oath-toolkit-2.6.2/liboath/gl/vasnprintf.c
./oath-toolkit-2.6.2/libpskc/gl/tests/vasnprintf.c
the attachment is the modify of ./oath-toolkit-2.6.2/oathtool/gl/vasnprintf.c
do the same with other two files and compile
oath-toolkit-2.6.2_oathtool_gl_vasnprintf.zip

please let us know how to do this update as I am new to android studio!

Seem the bug at git submodule not pull with latest master branch on gitlab

from ics-openconnect.

AzaKhan045 avatar AzaKhan045 commented on July 1, 2024

from ics-openconnect.

davemidd avatar davemidd commented on July 1, 2024

@AzaKhan045 - have you not tried this version? https://play.google.com/store/apps/details?id=com.github.digitalsoftwaresolutions.openconnect

from ics-openconnect.

AzaKhan045 avatar AzaKhan045 commented on July 1, 2024

from ics-openconnect.

NgoHuy avatar NgoHuy commented on July 1, 2024

Yes I tried but i need source code of this file. Not apk

On Mon, Jun 29, 2020, 6:44 PM David Middleton @.***> wrote: @AzaKhan045 https://github.com/AzaKhan045 - have you not tried this version? https://play.google.com/store/apps/details?id=com.github.digitalsoftwaresolutions.openconnect — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#51 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQDTDAS4OSBF445AGLUOYQTRZCLDXANCNFSM4IUKI6DA .

here: https://drive.google.com/file/d/1Ka0YMSdDUU_doxufE9AtHD_V2HKpf7wp/view

from ics-openconnect.

AzaKhan045 avatar AzaKhan045 commented on July 1, 2024

from ics-openconnect.

NgoHuy avatar NgoHuy commented on July 1, 2024

Is this the full source code? Of android open connect client app?

On Mon, Jun 29, 2020, 6:47 PM Ngô Huy @.> wrote: Yes I tried but i need source code of this file. Not apk … <#m_-1603599709087997961_> On Mon, Jun 29, 2020, 6:44 PM David Middleton @.> wrote: @AzaKhan045 https://github.com/AzaKhan045 https://github.com/AzaKhan045 - have you not tried this version? https://play.google.com/store/apps/details?id=com.github.digitalsoftwaresolutions.openconnect — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#51 (comment) <#51 (comment)>>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQDTDAS4OSBF445AGLUOYQTRZCLDXANCNFSM4IUKI6DA . here: https://drive.google.com/file/d/1Ka0YMSdDUU_doxufE9AtHD_V2HKpf7wp/view — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#51 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQDTDAX6QK3OGXKVTKID3HLRZCLPNANCNFSM4IUKI6DA .

yes, I 'm checking why openconnect git submodule is not sync with latest changes on master.

from ics-openconnect.

AzaKhan045 avatar AzaKhan045 commented on July 1, 2024

from ics-openconnect.

AzaKhan045 avatar AzaKhan045 commented on July 1, 2024

from ics-openconnect.

NgoHuy avatar NgoHuy commented on July 1, 2024

The problem is submodule didnot pull latest master commit, it's not a branch then hardcode commit id with git submodule update --init

from ics-openconnect.

dimoxdba avatar dimoxdba commented on July 1, 2024

Hi All,
I'm searching for developer that can help me to fix the issue (of course for some reward/fee)
on Android 10 with an old APK that worked fine on Android 8 and 9.

There is an application for android which the developer has stopped supporting and which has stopped working after I upgraded my Samsung S10 to Android 10 due to the error ### FORTIFY:% n not allowed on Android since this syntax is not allowed in version 10 as I'm understand.

Exact Stack-trace errors attached

It is required to open the application "reverse engineering" (for example, via APKTOOL - I tried myself to extract it and seems it is doing it fully), fix the issue and compile again for support in Android 10

The reason why the old application is needed is a 3D maps (RealityMaps) which were replaced in the new application with 2D maps (Mapbox).

In PlayMarket, the application has been replaced with a new one (the same name, but completely changed), so the latest version of the old APK can be downloaded here:
https://apkpure.com/3d-superski/de.realitymaps.dolomitisuperski

I'll be glad if somebody can to help me, my e-mail is: [email protected]

Stack_trace

from ics-openconnect.

siromidz avatar siromidz commented on July 1, 2024

The problem is submodule didnot pull latest master commit, it's not a branch then hardcode commit id with git submodule update --init

is git submodule update --init the exact git command that should be used?
it should be used instead of git submodule update init?

from ics-openconnect.

siromidz avatar siromidz commented on July 1, 2024

The problem is submodule didnot pull latest master commit, it's not a branch then hardcode commit id with git submodule update --init

would you please help me???

from ics-openconnect.

NgoHuy avatar NgoHuy commented on July 1, 2024

The problem is submodule didnot pull latest master commit, it's not a branch then hardcode commit id with git submodule update --init

would you please help me???

just delete it and git clone from master branch.

from ics-openconnect.

siromidz avatar siromidz commented on July 1, 2024

The problem is submodule didnot pull latest master commit, it's not a branch then hardcode commit id with git submodule update --init

would you please help me???

just delete it and git clone from master branch.

i did so a few seconds ago but it seems it is not the last updates of the code.
the targetSdkVersion was 19

from ics-openconnect.

NgoHuy avatar NgoHuy commented on July 1, 2024

Hi
did you run ?
rm -rf external/openconnect then git clone https://gitlab.com/openconnect/openconnect external/

from ics-openconnect.

siromidz avatar siromidz commented on July 1, 2024

Hi
did you run ?
rm -rf external/openconnect then git clone https://gitlab.com/openconnect/openconnect external/

i exactly took these steps:
git clone https://github.com/cernekee/ics-openconnect
cd ics-openconnect
git submodule init
git submodule update
rm -rf external/openconnect
cd external
git clone https://gitlab.com/openconnect/openconnect openconnect/
make -C external
./misc/download-artifacts.sh

and finally got:
A/libc: FORTIFY: %n not allowed on Android
Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 6505 (OpenVPNManageme), pid 6435 (app.openconnect)

from ics-openconnect.

siromidz avatar siromidz commented on July 1, 2024

Hi
did you run ?
rm -rf external/openconnect then git clone https://gitlab.com/openconnect/openconnect external/

i exactly took these steps:
git clone https://github.com/cernekee/ics-openconnect
cd ics-openconnect
git submodule init
git submodule update
rm -rf external/openconnect
cd external
git clone https://gitlab.com/openconnect/openconnect openconnect/
make -C external
./misc/download-artifacts.sh

and finally got:
A/libc: FORTIFY: %n not allowed on Android
Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 6505 (OpenVPNManageme), pid 6435 (app.openconnect)

full log is:
D/OpenConnect: AssetExtractor: skipping /data/user/0/app.openconnect/files/android_csd.sh
I/OpenConnect: AssetExtractor: writing /data/user/0/app.openconnect/files_64/run_pie
E/OpenConnect: AssetExtractor: caught exception
java.io.FileNotFoundException: /data/user/0/app.openconnect/files_64/run_pie: open failed: ENOENT (No such file or directory)
at libcore.io.IoBridge.open(IoBridge.java:496)
at java.io.FileOutputStream.(FileOutputStream.java:235)
at java.io.FileOutputStream.(FileOutputStream.java:186)
at app.openconnect.core.AssetExtractor.writeStream(AssetExtractor.java:75)
at app.openconnect.core.AssetExtractor.extractAll(AssetExtractor.java:133)
at app.openconnect.core.AssetExtractor.extractAll(AssetExtractor.java:148)
at app.openconnect.core.OpenConnectManagementThread.extractBinaries(OpenConnectManagementThread.java:666)
at app.openconnect.core.OpenConnectManagementThread.runVPN(OpenConnectManagementThread.java:693)
at app.openconnect.core.OpenConnectManagementThread.run(OpenConnectManagementThread.java:282)
at java.lang.Thread.run(Thread.java:919)
Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory)
at libcore.io.Linux.open(Native Method)
at libcore.io.ForwardingOs.open(ForwardingOs.java:167)
at libcore.io.BlockGuardOs.open(BlockGuardOs.java:252)
at libcore.io.ForwardingOs.open(ForwardingOs.java:167)
at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:7255)
at libcore.io.IoBridge.open(IoBridge.java:482)
at java.io.FileOutputStream.(FileOutputStream.java:235) 
at java.io.FileOutputStream.(FileOutputStream.java:186) 
at app.openconnect.core.AssetExtractor.writeStream(AssetExtractor.java:75) 
at app.openconnect.core.AssetExtractor.extractAll(AssetExtractor.java:133) 
at app.openconnect.core.AssetExtractor.extractAll(AssetExtractor.java:148) 
at app.openconnect.core.OpenConnectManagementThread.extractBinaries(OpenConnectManagementThread.java:666) 
at app.openconnect.core.OpenConnectManagementThread.runVPN(OpenConnectManagementThread.java:693) 
at app.openconnect.core.OpenConnectManagementThread.run(OpenConnectManagementThread.java:282) 
at java.lang.Thread.run(Thread.java:919) 
A/libc: FORTIFY: %n not allowed on Android
Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 6505 (OpenVPNManageme), pid 6435 (app.openconnect)

from ics-openconnect.

NgoHuy avatar NgoHuy commented on July 1, 2024

can you try to build from my repo https://github.com/NgoHuy/ics-openconnect/tree/latest-curl?

from ics-openconnect.

siromidz avatar siromidz commented on July 1, 2024

can you try to build from my repo https://github.com/NgoHuy/ics-openconnect/tree/latest-curl?

hi and thank you very much for your help but my problem did not solve.

still i get this error:
--------- beginning of crash
2021-03-05 19:07:01.801 7139-7189/app.openconnect A/libc: FORTIFY: %n not allowed on Android
2021-03-05 19:07:01.801 7139-7189/app.openconnect A/libc: Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 7189 (OpenVPNManageme), pid 7139 (app.openconnect).

full log:

2021-03-05 19:07:01.489 7139-7139/app.openconnect W/ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy@df92bf4
2021-03-05 19:07:01.628 7139-7189/app.openconnect D/OpenConnect: AssetExtractor: skipping /data/user/0/app.openconnect/files/android_csd.sh
2021-03-05 19:07:01.636 7139-7189/app.openconnect I/OpenConnect: AssetExtractor: writing /data/user/0/app.openconnect/files_64/run_pie
2021-03-05 19:07:01.639 7139-7189/app.openconnect E/OpenConnect: AssetExtractor: caught exception
java.io.FileNotFoundException: /data/user/0/app.openconnect/files_64/run_pie: open failed: ENOENT (No such file or directory)
at libcore.io.IoBridge.open(IoBridge.java:496)
at java.io.FileOutputStream.(FileOutputStream.java:235)
at java.io.FileOutputStream.(FileOutputStream.java:186)
at app.openconnect.core.AssetExtractor.writeStream(AssetExtractor.java:75)
at app.openconnect.core.AssetExtractor.extractAll(AssetExtractor.java:133)
at app.openconnect.core.AssetExtractor.extractAll(AssetExtractor.java:148)
at app.openconnect.core.OpenConnectManagementThread.extractBinaries(OpenConnectManagementThread.java:666)
at app.openconnect.core.OpenConnectManagementThread.runVPN(OpenConnectManagementThread.java:693)
at app.openconnect.core.OpenConnectManagementThread.run(OpenConnectManagementThread.java:282)
at java.lang.Thread.run(Thread.java:919)
Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory)
at libcore.io.Linux.open(Native Method)
at libcore.io.ForwardingOs.open(ForwardingOs.java:167)
at libcore.io.BlockGuardOs.open(BlockGuardOs.java:252)
at libcore.io.ForwardingOs.open(ForwardingOs.java:167)
at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:7255)
at libcore.io.IoBridge.open(IoBridge.java:482)
at java.io.FileOutputStream.(FileOutputStream.java:235) 
at java.io.FileOutputStream.(FileOutputStream.java:186) 
at app.openconnect.core.AssetExtractor.writeStream(AssetExtractor.java:75) 
at app.openconnect.core.AssetExtractor.extractAll(AssetExtractor.java:133) 
at app.openconnect.core.AssetExtractor.extractAll(AssetExtractor.java:148) 
at app.openconnect.core.OpenConnectManagementThread.extractBinaries(OpenConnectManagementThread.java:666) 
at app.openconnect.core.OpenConnectManagementThread.runVPN(OpenConnectManagementThread.java:693) 
at app.openconnect.core.OpenConnectManagementThread.run(OpenConnectManagementThread.java:282) 
at java.lang.Thread.run(Thread.java:919) 

--------- beginning of crash

2021-03-05 19:07:01.801 7139-7189/app.openconnect A/libc: FORTIFY: %n not allowed on Android
2021-03-05 19:07:01.801 7139-7189/app.openconnect A/libc: Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 7189 (OpenVPNManageme), pid 7139 (app.openconnect)

from ics-openconnect.

siromidz avatar siromidz commented on July 1, 2024

in apps build.gradle i see this
targetSdkVersion 19.

from ics-openconnect.

tnzil avatar tnzil commented on July 1, 2024

in apps build.gradle i see this
targetSdkVersion 19.

Are you using linux for compiling ics-openconnect?

from ics-openconnect.

siromidz avatar siromidz commented on July 1, 2024

in apps build.gradle i see this
targetSdkVersion 19.

Are you using linux for compiling ics-openconnect?

Yes
I'm using kali

from ics-openconnect.

siromidz avatar siromidz commented on July 1, 2024

can you try to build from my repo https://github.com/NgoHuy/ics-openconnect/tree/latest-curl?

no other solutions my friend?

from ics-openconnect.

NgoHuy avatar NgoHuy commented on July 1, 2024

I built it successfully with my repo. Not sure with cernekee's repo

from ics-openconnect.

siromidz avatar siromidz commented on July 1, 2024

I built it successfully with my repo. Not sure with cernekee's repo

yes. build is successful. but it crashes on android API 29.

from ics-openconnect.

NgoHuy avatar NgoHuy commented on July 1, 2024

this is my apk, does it crash on your phone?
https://drive.google.com/file/d/1ynE77127QPLzoDSLCXOPI2HEMx3YXGXN/view?usp=sharing

from ics-openconnect.

siromidz avatar siromidz commented on July 1, 2024

this is my apk, does it crash on your phone?
https://drive.google.com/file/d/1ynE77127QPLzoDSLCXOPI2HEMx3YXGXN/view?usp=sharing

No! this apk was OK. then in your opinion why am I still having this problem?

from ics-openconnect.

tnzil avatar tnzil commented on July 1, 2024

this is my apk, does it crash on your phone?
https://drive.google.com/file/d/1ynE77127QPLzoDSLCXOPI2HEMx3YXGXN/view?usp=sharing

No! this apk was OK. then in your opinion why am I still having this problem?

Try to build with @NgoHuy repo where you need to add other 3 arch for lower Android models and it will work perfectly.

from ics-openconnect.

siromidz avatar siromidz commented on July 1, 2024

can you try to build from my repo https://github.com/NgoHuy/ics-openconnect/tree/latest-curl?

hello dear friend.
i tried these ways to connect to openconnect server on android 10+:

git clone https://github.com/cernekee/ics-openconnect
cd ics-openconnect
git submodule init
git submodule update
cd external/openconnect
git checkout master
git submodule update --init
cd ../..
make -C external

./misc/download-artifacts.sh

git clone https://github.com/NgoHuy/ics-openconnect.git
cd ics-openconnect
git submodule init
git submodule update
cd external/openconnect
git checkout master
git submodule update --init
cd ../..
make -C external

./misc/download-artifacts.sh

git clone https://github.com/NgoHuy/ics-openconnect.git
cd ics-openconnect
./misc/download-artifacts.sh

git clone https://github.com/NgoHuy/ics-openconnect.git
cd ics-openconnect
git submodule init
git submodule update
make -C external
./misc/download-artifacts.sh

none of them was successfull.

from ics-openconnect.

siromidz avatar siromidz commented on July 1, 2024

this is my apk, does it crash on your phone?
https://drive.google.com/file/d/1ynE77127QPLzoDSLCXOPI2HEMx3YXGXN/view?usp=sharing

No idea what i have done wrong?

from ics-openconnect.

siromidz avatar siromidz commented on July 1, 2024

this is my apk, does it crash on your phone?
https://drive.google.com/file/d/1ynE77127QPLzoDSLCXOPI2HEMx3YXGXN/view?usp=sharing

No! this apk was OK. then in your opinion why am I still having this problem?

Try to build with @NgoHuy repo where you need to add other 3 arch for lower Android models and it will work perfectly.

do you have any solutions for this problem?

from ics-openconnect.

NgoHuy avatar NgoHuy commented on July 1, 2024

this is my apk, does it crash on your phone?
https://drive.google.com/file/d/1ynE77127QPLzoDSLCXOPI2HEMx3YXGXN/view?usp=sharing

No! this apk was OK. then in your opinion why am I still having this problem?

Try to build with @NgoHuy repo where you need to add other 3 arch for lower Android models and it will work perfectly.

do you have any solutions for this problem?

did you use latest-curl branch?
https://github.com/NgoHuy/ics-openconnect/tree/latest-curl

from ics-openconnect.

siromidz avatar siromidz commented on July 1, 2024

this is my apk, does it crash on your phone?
https://drive.google.com/file/d/1ynE77127QPLzoDSLCXOPI2HEMx3YXGXN/view?usp=sharing

No! this apk was OK. then in your opinion why am I still having this problem?

Try to build with @NgoHuy repo where you need to add other 3 arch for lower Android models and it will work perfectly.

do you have any solutions for this problem?

did you use latest-curl branch?
https://github.com/NgoHuy/ics-openconnect/tree/latest-curl

i cloned the code in this url and then followed these steps:
cd ics-openconnect
git submodule init
git submodule update
cd external/openconnect
git checkout master
git submodule update --init
make -C external
./misc/download-artifacts.sh

from ics-openconnect.

NgoHuy avatar NgoHuy commented on July 1, 2024

please checkout latest-curl before building

from ics-openconnect.

siromidz avatar siromidz commented on July 1, 2024

please checkout latest-curl before building

you mean after these steps?

from ics-openconnect.

NgoHuy avatar NgoHuy commented on July 1, 2024

checkout before any step :D

from ics-openconnect.

siromidz avatar siromidz commented on July 1, 2024

checkout before any step :D
so I should clone, checkout, and then follow the steps. thank you

from ics-openconnect.

siromidz avatar siromidz commented on July 1, 2024

should i run git checkout master after git submodule update???

from ics-openconnect.

siromidz avatar siromidz commented on July 1, 2024

i tried these
git clone https://github.com/NgoHuy/ics-openconnect.git
cd ics-openconnect
git checkout latest-curl
git submodule init
git submodule update
cd external/openconnect
git submodule update --init
cd ../..
make -C external
./misc/download-artifacts.sh

but failed!!!!

from ics-openconnect.

NgoHuy avatar NgoHuy commented on July 1, 2024

git clone https://github.com/NgoHuy/ics-openconnect.git
cd ics-openconnect
git checkout latest-curl
git submodule init
git submodule update
cd external/openconnect
git checkout master
git pull
git submodule update --init
cd ../..
make -C external

from ics-openconnect.

tnzil avatar tnzil commented on July 1, 2024

i tried these
git clone https://github.com/NgoHuy/ics-openconnect.git
cd ics-openconnect
git checkout latest-curl
git submodule init
git submodule update
cd external/openconnect
git submodule update --init
cd ../..
make -C external
./misc/download-artifacts.sh

but failed!!!!

Kindly share output logs

from ics-openconnect.

NgoHuy avatar NgoHuy commented on July 1, 2024

I confirmed that I built with error from openconnect master branch.

from ics-openconnect.

NgoHuy avatar NgoHuy commented on July 1, 2024

I forgot mention that on archlinux or debian, in external/openconnect/android/Makefile must define -fuse-ld=gold in EXTRA_CFLAGS

from ics-openconnect.

siromidz avatar siromidz commented on July 1, 2024

I forgot mention that on archlinux or debian, in external/openconnect/android/Makefile must define -fuse-ld=gold in EXTRA_CFLAGS

where has to be changed in that file?
there are multiple places EXTRA_CFLAGS is used.

from ics-openconnect.

siromidz avatar siromidz commented on July 1, 2024

I forgot mention that on archlinux or debian, in external/openconnect/android/Makefile must define -fuse-ld=gold in EXTRA_CFLAGS

i added the -fuse-ld=gold at 2 positions where EXTRA_CFLAGS was used but got the same result

from ics-openconnect.

siromidz avatar siromidz commented on July 1, 2024

I forgot mention that on archlinux or debian, in external/openconnect/android/Makefile must define -fuse-ld=gold in EXTRA_CFLAGS

i changed the file you mentioned like this:

#
# This Makefile attempts to build OpenConnect and its dependencies for Android
#
# It doesn't do a stunning job of tracking changes in the dependencies and
# automatically rebuilding them, but it's good enough for getting them built
# and installed into its own local sysroot.
#
# As long as you have the Android NDK toolchain on your path, you should then
# be able to edit fairly much anything in place and rebuild it locally.
#
# It should also be fairly simple to extend this to cross-compile for any target

# Last tested with https://dl.google.com/android/repository/android-ndk-r21b-linux-x86_64.zip


NDK     := /opt/android-sdk-linux_x86/android-ndk-r21b
ARCH    := x86_64
API_LEVEL := 23

EXTRA_CFLAGS := -fuse-ld=gold

# You should be able to just 'make ARCH=x86' and it should DTRT.
ifeq ($(ARCH),arm)
TRIPLET := arm-linux-androideabi
EXTRA_CFLAGS := -march=armv7-a -mthumb -fuse-ld=gold
endif
ifeq ($(ARCH),arm64)
TRIPLET := aarch64-linux-android
API_LEVEL := 26
endif
ifeq ($(ARCH),x86)
TRIPLET := i686-linux-android
endif
ifeq ($(ARCH),x86_64)
TRIPLET := x86_64-linux-android
endif

TOPDIR := $(shell pwd)
DESTDIR := $(TOPDIR)/$(TRIPLET)/out

EXTRA_CFLAGS += -D__ANDROID_API__=$(API_LEVEL) -O2

TOOLCHAIN := $(TOPDIR)/$(TRIPLET)/toolchain
TOOLCHAIN_BUILT := $(TOOLCHAIN)/.built
TOOLCHAIN_OPTS := --platform=android-$(API_LEVEL) --arch=$(ARCH) \
		  --install-dir=$(TOOLCHAIN)
PATH := $(TOOLCHAIN)/bin:$(PATH)

OC_SYSROOT := $(TOOLCHAIN)/sysroot/usr
PKG_CONFIG_LIBDIR := $(OC_SYSROOT)/lib/pkgconfig

export PATH PKG_CONFIG_LIBDIR

# PKG_CONFIG_LIBDIR gets exported to sub-makes, but not to $(shell
PKG_CONFIG := PKG_CONFIG_LIBDIR=$(PKG_CONFIG_LIBDIR) pkg-config

MAKEINSTALL=$(MAKE) INSTALL=$(TOPDIR)/install_symlink.sh
FETCH=$(TOPDIR)/fetch.sh

CONFIGURE_ARGS := --host=$(TRIPLET) --prefix=$(OC_SYSROOT) \
		  --disable-shared --enable-static --with-pic \
		  CC=$(TRIPLET)-clang CFLAGS="$(EXTRA_CFLAGS)"

SOURCE_LIST = $(LIBXML2_SRC)/configure $(GMP_SRC)/configure \
	$(NETTLE_SRC)/configure $(GNUTLS_SRC)/configure \
	$(STOKEN_SRC)/configure $(OATH_SRC)/configure \
	$(LZ4_DIR)/Makefile

PKG_LIST := LIBXML2 GMP NETTLE GNUTLS STOKEN OATH LZ4

MIRROR_TEST_TARGETS := $(addprefix mirror-test-,$(PKG_LIST))

all: openconnect run_pie

#####################################################################
#
# Install a local cross toolchain + sysroot
#
# (The fallback logic is because NDK versions <= r8e can fail after trying to
# use 32-bit binaries on a 64-bit NDK installation.)
#
$(TOOLCHAIN_BUILT):
	$(NDK)/build/tools/make-standalone-toolchain.sh $(TOOLCHAIN_OPTS) || \
		$(NDK)/build/tools/make-standalone-toolchain.sh \
			$(TOOLCHAIN_OPTS) --system=linux-x86_64
	touch $@

#####################################################################
#
# Build libxml2 with minimal configuration for OpenConnect
#
# http://xmlsoft.org/news.html
LIBXML2_VER := 2.9.11
LIBXML2_TAR := libxml2-$(LIBXML2_VER).tar.gz
LIBXML2_SHA := 886f696d5d5b45d780b2880645edf9e0c62a4fd6841b853e824ada4e02b4d331
LIBXML2_SRC := sources/libxml2-$(LIBXML2_VER)
LIBXML2_BUILD := $(TRIPLET)/libxml2

$(LIBXML2_TAR):
	$(FETCH) $@ $(LIBXML2_SHA)

$(LIBXML2_SRC)/configure: $(LIBXML2_TAR)
	mkdir -p sources
	tar xfz $<  -C sources
	touch $@

$(LIBXML2_BUILD)/Makefile: $(TOOLCHAIN_BUILT) $(LIBXML2_SRC)/configure
	mkdir -p $(LIBXML2_BUILD)
	cd $(LIBXML2_BUILD) && ../../$(LIBXML2_SRC)/configure $(CONFIGURE_ARGS) \
	    --without-c14n -without-catalog --without-debug --without-docbook \
	    --without-fexceptions --without-ftp --without-history \
	    --without-http --without-iconv --without-iconv \
	    --without-iso8859x --without-legacy --without-pattern \
	    --without-push --without-regexps --without-run-debug \
	    --without-sax1 --without-schemas --without-schematron \
	    --without-threads --without-valid --without-xinclude \
	    --without-xpath --without-xptr --without-zlib --without-lzma \
	    --without-coverage --without-python

$(LIBXML2_BUILD)/libxml2.la: $(LIBXML2_BUILD)/Makefile
	$(MAKE) -C $(LIBXML2_BUILD) libxml2.la

$(LIBXML2_BUILD)/libxml-2.0.pc: $(LIBXML2_BUILD)/Makefile
	$(MAKE) -C $(LIBXML2_BUILD) libxml-2.0.pc

$(OC_SYSROOT)/lib/libxml2.la: $(LIBXML2_BUILD)/libxml2.la
	$(MAKEINSTALL) -C $(LIBXML2_BUILD) install-libLTLIBRARIES

$(OC_SYSROOT)/lib/pkgconfig/libxml-2.0.pc: $(LIBXML2_BUILD)/libxml-2.0.pc
	$(MAKEINSTALL) -C $(LIBXML2_BUILD) install-data

LIBXML_DEPS := $(OC_SYSROOT)/lib/libxml2.la $(OC_SYSROOT)/lib/pkgconfig/libxml-2.0.pc

libxml: $(LIBXML_DEPS)


#####################################################################
#
# Build GNU MP
#
# https://gmplib.org/
GMP_VER := 6.2.1
GMP_TAR := gmp-$(GMP_VER).tar.xz
GMP_SHA := fd4829912cddd12f84181c3451cc752be224643e87fac497b69edddadc49b4f2
GMP_SRC := sources/gmp-$(GMP_VER)
GMP_BUILD := $(TRIPLET)/gmp

$(GMP_TAR):
	$(FETCH) $@ $(GMP_SHA)

$(GMP_SRC)/configure: $(GMP_TAR)
	mkdir -p sources
	tar -xJf $< -C sources
	touch $@

$(GMP_BUILD)/Makefile: $(TOOLCHAIN_BUILT) $(GMP_SRC)/configure
	mkdir -p $(GMP_BUILD)
	cd $(GMP_BUILD) && ../../$(GMP_SRC)/configure $(CONFIGURE_ARGS) 


$(GMP_BUILD)/libgmp.la: $(GMP_BUILD)/Makefile
	$(MAKE) -C $(GMP_BUILD)

$(OC_SYSROOT)/lib/libgmp.la: $(GMP_BUILD)/libgmp.la
	$(MAKEINSTALL) -C $(GMP_BUILD) install

GMP_DEPS := $(OC_SYSROOT)/lib/libgmp.la

gmp: $(GMP_DEPS)


#####################################################################
#
# Build nettle
#
# https://ftp.gnu.org/gnu/nettle/
NETTLE_VER := 3.6
NETTLE_TAR := nettle-$(NETTLE_VER).tar.gz
NETTLE_SHA := d24c0d0f2abffbc8f4f34dcf114b0f131ec3774895f3555922fe2f40f3d5e3f1
NETTLE_SRC := sources/nettle-$(NETTLE_VER)
NETTLE_BUILD := $(TRIPLET)/nettle

$(NETTLE_TAR):
	$(FETCH) $@ $(NETTLE_SHA)

$(NETTLE_SRC)/configure: $(NETTLE_TAR)
	mkdir -p sources
	tar xfz $< -C sources
	touch $@

$(NETTLE_BUILD)/Makefile: $(TOOLCHAIN_BUILT) $(NETTLE_SRC)/configure $(GMP_DEPS)
	mkdir -p $(NETTLE_BUILD)
	cd $(NETTLE_BUILD) && ../../$(NETTLE_SRC)/configure $(CONFIGURE_ARGS)

$(NETTLE_BUILD)/libnettle.a: $(NETTLE_BUILD)/Makefile
	$(MAKE) -C $(NETTLE_BUILD) SUBDIRS=

$(OC_SYSROOT)/lib/libnettle.a: $(NETTLE_BUILD)/libnettle.a
	$(MAKEINSTALL) -C $(NETTLE_BUILD) SUBDIRS= install

NETTLE_DEPS := $(OC_SYSROOT)/lib/libnettle.a

nettle: $(NETTLE_DEPS)


#####################################################################
#
# Build GnuTLS
#
# https://www.gnutls.org/download.html
GNUTLS_VER := 3.6.16
GNUTLS_TAR := gnutls-$(GNUTLS_VER).tar.xz
GNUTLS_SHA := 1b79b381ac283d8b054368b335c408fedcb9b7144e0c07f531e3537d4328f3b3
GNUTLS_SRC := sources/gnutls-$(GNUTLS_VER)
GNUTLS_BUILD := $(TRIPLET)/gnutls

$(GNUTLS_TAR):
	$(FETCH) $@ $(GNUTLS_SHA)

$(GNUTLS_SRC)/configure: $(GNUTLS_TAR)
	mkdir -p sources
	xz -d < $< | tar xf - -C sources
	touch $@

#$(GNUTLS_SRC)/configure.ac:
#	mkdir -p sources
#	cd sources && git clone git://gitorious.org/gnutls/gnutls.git

#$(GNUTLS_SRC)/configure: $(GNUTLS_SRC)/configure.ac
#	touch $(GNUTLS_SRC)/ChangeLog
#	cd $(GNUTLS_SRC) && autoreconf -fvi

$(GNUTLS_BUILD)/Makefile: $(TOOLCHAIN_BUILT) $(GNUTLS_SRC)/configure $(NETTLE_DEPS)
	mkdir -p $(GNUTLS_BUILD)
	cd $(GNUTLS_BUILD) && ../../$(GNUTLS_SRC)/configure $(CONFIGURE_ARGS) \
		AUTOGEN=/bin/false \
		--disable-threads --disable-tests --disable-nls \
		--disable-doc --disable-openssl-compatibility --disable-cxx \
		--disable-openssl-compatibility --disable-ocsp --disable-tools \
		--disable-anon-authentication --with-included-libtasn1 \
		--enable-psk-authentication --disable-srp-authentication \
		--disable-dtls-srtp-support  --enable-dhe --enable-ecdhe \
		--with-included-unistring --without-p11-kit --disable-guile

$(GNUTLS_BUILD)/lib/libgnutls.la: $(GNUTLS_BUILD)/Makefile
	$(MAKE) -C $(GNUTLS_BUILD)

$(OC_SYSROOT)/lib/libgnutls.la: $(GNUTLS_BUILD)/lib/libgnutls.la
	$(MAKEINSTALL) -C $(GNUTLS_BUILD) install

GNUTLS_DEPS := $(OC_SYSROOT)/lib/libgnutls.la

gnutls: $(GNUTLS_DEPS)


#####################################################################
#
# Build libstoken
#
# https://sourceforge.net/projects/stoken/files/
STOKEN_VER := 0.92
STOKEN_TAR := stoken-$(STOKEN_VER).tar.gz
STOKEN_SHA := aa2b481b058e4caf068f7e747a2dcf5772bcbf278a4f89bc9efcbf82bcc9ef5a
STOKEN_SRC := sources/stoken-$(STOKEN_VER)
STOKEN_BUILD := $(TRIPLET)/stoken

$(STOKEN_TAR):
	$(FETCH) $@ $(STOKEN_SHA)

$(STOKEN_SRC)/configure: $(STOKEN_TAR)
	mkdir -p sources
	tar xfz $< -C sources
	touch $@

$(STOKEN_BUILD)/Makefile: $(TOOLCHAIN_BUILT) $(STOKEN_SRC)/configure $(NETTLE_DEPS)
	mkdir -p $(STOKEN_BUILD)
	cd $(STOKEN_BUILD) && ../../$(STOKEN_SRC)/configure $(CONFIGURE_ARGS) \
		--without-gtk

$(STOKEN_BUILD)/libstoken.la: $(STOKEN_BUILD)/Makefile
	$(MAKE) -C $(STOKEN_BUILD)

$(OC_SYSROOT)/lib/libstoken.la: $(STOKEN_BUILD)/libstoken.la
	$(MAKEINSTALL) -C $(STOKEN_BUILD) install

STOKEN_DEPS := $(OC_SYSROOT)/lib/libstoken.la

stoken: $(STOKEN_DEPS)


#####################################################################
#
# Build liboath
#
# https://download.savannah.nongnu.org/releases/oath-toolkit/
OATH_VER := 2.6.7
OATH_TAR := oath-toolkit-$(OATH_VER).tar.gz
OATH_SHA := 36eddfce8f2f36347fb257dbf878ba0303a2eaafe24eaa071d5cd302261046a9
OATH_SRC := sources/oath-toolkit-$(OATH_VER)
OATH_BUILD := $(TRIPLET)/oath

$(OATH_TAR):
	$(FETCH) $@ $(OATH_SHA)

$(OATH_SRC)/configure: $(OATH_TAR)
	mkdir -p sources
	tar xfz $< -C sources
	> $(OATH_SRC)/liboath/gl/freading.c
	touch $@

$(OATH_BUILD)/Makefile: $(TOOLCHAIN_BUILT) $(OATH_SRC)/configure
	mkdir -p $(OATH_BUILD)
	cd $(OATH_BUILD) && ../../$(OATH_SRC)/configure $(CONFIGURE_ARGS) \
		--disable-pskc --disable-pam \
		gl_cv_func_fflush_stdin=yes \
		gl_cv_func_fpurge_works=yes

$(OATH_BUILD)/liboath/liboath.la: $(OATH_BUILD)/Makefile
	$(MAKE) -C $(OATH_BUILD)/liboath

$(OC_SYSROOT)/lib/liboath.la: $(OATH_BUILD)/liboath/liboath.la
	$(MAKEINSTALL) -C $(OATH_BUILD)/liboath install

OATH_DEPS := $(OC_SYSROOT)/lib/liboath.la

oath: $(OATH_DEPS)


#####################################################################
#
# Build liblz4
#
# https://github.com/lz4/lz4/tags
LZ4_VER := 1.9.3
LZ4_TAR := lz4-v$(LZ4_VER).tar.gz
LZ4_SHA := 030644df4611007ff7dc962d981f390361e6c97a34e5cbc393ddfbe019ffe2c1
LZ4_DIR := $(TRIPLET)/lz4-$(LZ4_VER)

$(LZ4_TAR):
	$(FETCH) $@ $(LZ4_SHA)

$(LZ4_DIR)/Makefile: $(LZ4_TAR)
	mkdir -p $(TRIPLET)
	tar xzf $< -C $(TRIPLET)
	touch $@

$(OC_SYSROOT)/lib/liblz4.a: $(TOOLCHAIN_BUILT) $(LZ4_DIR)/Makefile
	$(MAKE) -C $(LZ4_DIR)/lib \
		CC="$(TRIPLET)-clang $(EXTRA_CFLAGS)" \
		AR="$(TRIPLET)-ar" \
		LIBDIR=$(OC_SYSROOT)/lib \
		INCLUDEDIR=$(OC_SYSROOT)/include \
		install
	rm -f $(OC_SYSROOT)/lib/liblz4.so*

LZ4_DEPS := $(OC_SYSROOT)/lib/liblz4.a

lz4: $(LZ4_DEPS)

#####################################################################
#
# Build OpenConnect for Android
#
OPENCONNECT_SRC := ..
OPENCONNECT_BUILD := $(TRIPLET)/openconnect

$(OPENCONNECT_SRC)/configure:
	cd $(OPENCONNECT_SRC) && ./autogen.sh

$(OPENCONNECT_BUILD)/Makefile: $(TOOLCHAIN_BUILT) $(GNUTLS_DEPS) $(LIBXML_DEPS) \
		$(STOKEN_DEPS) $(OATH_DEPS) $(LZ4_DEPS) $(OPENCONNECT_SRC)/configure
	mkdir -p $(OPENCONNECT_BUILD)
	cd $(OPENCONNECT_BUILD) && ../../../configure \
	--host=$(TRIPLET) --prefix=/ \
	CFLAGS="$(EXTRA_CFLAGS) -fvisibility=default -fPIE" \
	LDFLAGS="$(EXTRA_LDFLAGS) -rdynamic -pie" \
	GNUTLS_LIBS="$(shell $(PKG_CONFIG) --static --libs gnutls)" \
	LIBSTOKEN_LIBS="$(shell $(PKG_CONFIG) --static --libs stoken)" \
	--enable-shared --with-vpnc-script=/etc/vpnc/vpnc-script \
	--with-java=$(OC_SYSROOT)/include --enable-jni-standalone \
	--disable-symvers

openconnect: $(OPENCONNECT_BUILD)/Makefile
	make -C $(OPENCONNECT_BUILD)
	make -C $(OPENCONNECT_BUILD) install-strip DESTDIR=$(DESTDIR)


#####################################################################
#
# Build run_pie helper program
#
$(DESTDIR)/sbin/run_pie: run_pie.c $(TOOLCHAIN_BUILT)
	mkdir -p $(DESTDIR)/sbin
	$(TRIPLET)-clang $< -o $@ -ldl

.PHONY: run_pie
run_pie: $(DESTDIR)/sbin/run_pie


#####################################################################
#
# Special targets for maintainer use
#

# download + extract, but do not build
.PHONY: sources
sources: $(SOURCE_LIST)

.PHONY: $(MIRROR_TEST_TARGETS)
$(MIRROR_TEST_TARGETS) : mirror-test-% :
	$(FETCH) --mirror-test $($(*)_TAR) $($(*)_SHA)

# (re)test all mirrors for all packages. safe for use with "make -jN"
.PHONY: mirror-test
mirror-test: $(MIRROR_TEST_TARGETS)

from ics-openconnect.

NgoHuy avatar NgoHuy commented on July 1, 2024

you should edit this line
EXTRA_CFLAGS += -D__ANDROID_API__=$(API_LEVEL) -O2

from ics-openconnect.

siromidz avatar siromidz commented on July 1, 2024

EXTRA_CFLAGS += -D__ANDROID_API__=$(API_LEVEL) -O2

I changed that line to this:
EXTRA_CFLAGS += -D__ANDROID_API__=$(API_LEVEL) -O2 -fuse-ld=gold
but nothing changed. still crash

2021-07-15 07:52:13.965 24018-24216/app.openconnect A/libc: FORTIFY: %n not allowed on Android
2021-07-15 07:52:13.965 24018-24216/app.openconnect A/libc: Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 24216 (OpenVPNManageme), pid 24018 (app.openconnect)

from ics-openconnect.

siromidz avatar siromidz commented on July 1, 2024

EXTRA_CFLAGS += -D__ANDROID_API__=$(API_LEVEL) -O2

I changed that line to this:
EXTRA_CFLAGS += -D__ANDROID_API__=$(API_LEVEL) -O2 -fuse-ld=gold
but nothing changed. still crash

2021-07-15 07:52:13.965 24018-24216/app.openconnect A/libc: FORTIFY: %n not allowed on Android
2021-07-15 07:52:13.965 24018-24216/app.openconnect A/libc: Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 24216 (OpenVPNManageme), pid 24018 (app.openconnect)

did I edit that line correctly?

from ics-openconnect.

siromidz avatar siromidz commented on July 1, 2024

git clone https://github.com/NgoHuy/ics-openconnect.git
cd ics-openconnect
git checkout latest-curl
git submodule init
git submodule update
cd external/openconnect
git checkout master
git pull
git submodule update --init
cd ../..
make -C external

does this work on redhat?

from ics-openconnect.

siromidz avatar siromidz commented on July 1, 2024

EXTRA_CFLAGS += -D__ANDROID_API__=$(API_LEVEL) -O2

I changed that line to this:
EXTRA_CFLAGS += -D__ANDROID_API__=$(API_LEVEL) -O2 -fuse-ld=gold
but nothing changed. still crash

2021-07-15 07:52:13.965 24018-24216/app.openconnect A/libc: FORTIFY: %n not allowed on Android
2021-07-15 07:52:13.965 24018-24216/app.openconnect A/libc: Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 24216 (OpenVPNManageme), pid 24018 (app.openconnect)

@NgoHuy is this correct? or i have to edit this in another way?
I'm using kali linux

from ics-openconnect.

NgoHuy avatar NgoHuy commented on July 1, 2024

I'm not sure why it crashed, I use debian and archlinux to build it

from ics-openconnect.

siromidz avatar siromidz commented on July 1, 2024

I'm not sure why it crashed, I use debian and archlinux to build it

could you please tell me the exact distribution and version you are using so that I can compile the project?

from ics-openconnect.

NgoHuy avatar NgoHuy commented on July 1, 2024

I use debian and archlinux with latest update

from ics-openconnect.

daktak avatar daktak commented on July 1, 2024

this is my apk, does it crash on your phone? https://drive.google.com/file/d/1ynE77127QPLzoDSLCXOPI2HEMx3YXGXN/view?usp=sharing

This still works on Android 13. I had to rename by certs to .jpg as file permissions seemed to only work for "Media"

from ics-openconnect.

wolandtel avatar wolandtel commented on July 1, 2024

I've wasted all the day to build it. So that's the step-by-step instruction.

mkdir ics-openconnect
cd ics-openconnect

# download gnutls+nettle.patch
git clone https://github.com/cernekee/ics-openconnect ics-openconnect.github

cd ics-openconnect
# external/Makefile → check ANDROID_NDK path; remove anything except arm from ARCHS

git submodule init
git submodule update

cd external/openconnect
git apply ../../../gnutls+nettle.patch
cd ../..

make -C external

./gradlew assembleDebug

cd ..
mv ics-openconnect.github/app/build/outputs/apk/debug/app-debug.apk OpenConnect.apk

gnutls+nettle.patch.zip

And the result:
OpenConnect.apk.zip

from ics-openconnect.

ildar avatar ildar commented on July 1, 2024

from ics-openconnect.

ildar avatar ildar commented on July 1, 2024

from ics-openconnect.

ildar avatar ildar commented on July 1, 2024

from ics-openconnect.

DimitriPapadopoulos avatar DimitriPapadopoulos commented on July 1, 2024

It would be worth submitting a pull request to https://gitlab.com/openconnect/openconnect/. The above patch doesn't appear to apply cleanly to the current master branch, I'll have a look.

Indeed, https://gitlab.com/openconnect/ics-openconnect/ is more recent and the patch you refer to is obsolete as far as I can see.

from ics-openconnect.

wolandtel avatar wolandtel commented on July 1, 2024

The above patch doesn't appear to apply cleanly to the current master branch

Of course. When you do git submodule … you get the tag v8.03 of openconnect.

from ics-openconnect.

wolandtel avatar wolandtel commented on July 1, 2024

Mikhail, ppl, can anyone update the libopenconnect to the latest version?

What do you mean? Build ics-openconnect with the latest version of the lib? What for?

from ics-openconnect.

wolandtel avatar wolandtel commented on July 1, 2024

Found another repo, maybe worth moving. https://gitlab.com/openconnect/ics-openconnect/-/issues/8

Gitlab project has the same build problems as the current one. And maybe a little bit more. And all the difference is a new functionality (protocols added). I was need just an openconnect.

from ics-openconnect.

DimitriPapadopoulos avatar DimitriPapadopoulos commented on July 1, 2024

Oh, I see, I wasn't aware it uses submodule, sorry about it. Any way, the OpenConnect library has been maintained in https://gitlab.com/openconnect/openconnect/ for years and 8.0.3 has become obsolete, although I understand it works for you. What way forward would you suggest for the community?

from ics-openconnect.

wolandtel avatar wolandtel commented on July 1, 2024

Dimitri, I think only an openconnect's maintainer has enough knowledge to build android client with the actual version of libopenconnect. It hasn't been built for the x86 arch, for example (v8.0.3) and I've just skipped it. So I suppose there will be a lot of issues if you try to build with the libopenconnect's master.

from ics-openconnect.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.