Hi NXP team,
When root executes the "app1" program, app1 will execute "su ap -c app2" to run the "app2" program.
P.S. ap is a normal user.
Originally, app2 calls the connect function from the socket library.
Now, I want to set the LD_PRELOAD environment variable to point to a shared object file that contains a custom implementation of connect, and the custom implementation of connect will be called when the "app2" program is executed.
I create a file called ssl_winsock.c that provides a custom implementation of the connect function.
This implementation of connect simply outputs a message. (Just want to make sure this custom function will be called.)
Next, I compile ssl_winsock.c into a shared object file using the gcc compiler.
$ gcc -shared -fPIC -o libsock.so ssl_winsock.c
I use LD_PRELOAD to override the connect function in a program.
Preload libsock.so and run the "app1" program.
# LD_PRELOAD=~/libsock.so; ./app1
Ultimately, the custom implementation of connect provided in libsock.so was not called.
Is there anything wrong?