Operating System - HP-UX
1833875 Members
2641 Online
110063 Solutions
New Discussion

Setuid causing runtime link errror

 
Vineesh U S
Occasional Advisor

Setuid causing runtime link errror

Hi All,
I am building my binary with the following options:

**********************************************
/opt/aCC/bin/aCC \
\
\
\
HP-UXB.11.11_OPT.OBJ/pmdf.o \
\
\
\
-LHP-UXB.11.11_OPT.OBJ -L../../lib/imta/HP-UXB.11.11_OPT.OBJ -L../../lib
/imta-simsapi/HP-UXB.11.11_OPT.OBJ -L../../lib/imta-util/HP-UXB.11.11_OPT.OBJ -L
../../lib/pal/HP-UXB.11.11_OPT.OBJ -L../../lib/mee/HP-UXB.11.11_OPT.OBJ -L../../
lib/yasr/HP-UXB.11.11_OPT.OBJ -L../../lib/cyrus/HP-UXB.11.11_OPT.OBJ -L../../lib
/async/HP-UXB.11.11_OPT.OBJ -L../../lib/mtpcore/HP-UXB.11.11_OPT.OBJ -L../../lib
/mailwave/HP-UXB.11.11_OPT.OBJ -L../../lib/msgsrvu/HP-UXB.11.11_OPT.OBJ -L../../
lib/regexpu/HP-UXB.11.11_OPT.OBJ -L../../../external/security/HP-UXB.11.11_OPT.O
BJ/lib -L../../../external/security/HP-UXB.11.11_OPT.OBJ/lib/ -L../../../externa
l/icu/HP-UXB.11.11_OPT.OBJ/lib/ -L../../../external/sasl/HP-UXB.11.11_OPT.OBJ/li
b/ -L../../../external/ldap/HP-UXB.11.11_OPT.OBJ/lib/ -L../../../external/admins
dk/HP-UXB.11.11_OPT.OBJ/lib/ -L../../../external/db/HP-UXB.11.11_OPT.OBJ/lib \
-limta -lmsgsrvu -lmailwave -lcyrus -lasock -lmee -lyasr -lasync -ladmin
util53 -lsi18n -lmtpcore -ldb-4.2 -licui18n -licuuc -licudata -lregexpu -lsasl -
lnss3 -lssl3 -lsoftokn3 -lnspr4 -lplc4 -lplds4 -lldap50 -lssldap50 -lprldap50 \^
M
\
-AA -Wl,-a,shared_archive -Wl,+b,\$ORIGIN/../lib:.:../lib:/usr/lib:/lib
\
\
\
\
-lsec -lrt \
\
-ladminutil53 -lsi18n \
\
-o HP-UXB.11.11_OPT.OBJ/imtacli
========================================
/opt/aCC/bin/aCC \
\
\
\
HP-UXB.11.11_OPT.OBJ/improgram.o \
\
\
\
-LHP-UXB.11.11_OPT.OBJ -L../../lib/imta/HP-UXB.11.11_OPT.OBJ -L../../lib
/imta-simsapi/HP-UXB.11.11_OPT.OBJ -L../../lib/imta-util/HP-UXB.11.11_OPT.OBJ -L
../../lib/pal/HP-UXB.11.11_OPT.OBJ -L../../lib/mee/HP-UXB.11.11_OPT.OBJ -L../../
lib/yasr/HP-UXB.11.11_OPT.OBJ -L../../lib/cyrus/HP-UXB.11.11_OPT.OBJ -L../../lib
/async/HP-UXB.11.11_OPT.OBJ -L../../lib/mtpcore/HP-UXB.11.11_OPT.OBJ -L../../lib
/mailwave/HP-UXB.11.11_OPT.OBJ -L../../lib/msgsrvu/HP-UXB.11.11_OPT.OBJ -L../../
lib/regexpu/HP-UXB.11.11_OPT.OBJ -L../../../external/security/HP-UXB.11.11_OPT.O
BJ/lib -L../../../external/security/HP-UXB.11.11_OPT.OBJ/lib/ -L../../../externa
l/icu/HP-UXB.11.11_OPT.OBJ/lib/ -L../../../external/sasl/HP-UXB.11.11_OPT.OBJ/li
b/ -L../../../external/ldap/HP-UXB.11.11_OPT.OBJ/lib/ -L../../../external/admins
dk/HP-UXB.11.11_OPT.OBJ/lib/ -L../../../external/db/HP-UXB.11.11_OPT.OBJ/lib \
-limtautil -limsdk -lpal -limta -lmsgsrvu -lmailwave -lcyrus -lasock -lm
ee -lyasr -lasync -ladminutil53 -lsi18n -lmtpcore -ldb-4.2 -licui18n -licuuc -li
cudata -lregexpu -lsasl -lnss3 -lssl3 -lsoftokn3 -lnspr4 -lplc4 -lplds4 -lldap50
-lssldap\-lprldap50 \
-AA -Wl,-a,shared_archive -Wl,+b,\$ORIGIN/../lib:.:../lib:/usr/lib:/lib
\
\
\
\
-lsec -lrt \
\
\
\
-o HP-UXB.11.11_OPT.OBJ/imtaProgram

**********************************************


Now when I run the binary I get this error:

# ./imtacli program
/usr/lib/dld.sl: Can't find path for shared library: libprldap50.sl
/usr/lib/dld.sl: No such file or directory
ABORT instruction (core dumped)

Note: here program is an argument

When I run my program using truss I get to see that it is due to SETUID(). I have attached the logs for the truss session.

Can anybody tell me how I need to attack this issue.

Thanks
Vineesh
5 REPLIES 5

Re: Setuid causing runtime link errror

Maybe related to this (although this was on 11.23 a patch might have introduced similar functionality on 11.11 - check the man page for dlopen) :

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=542528

HTH

Duncan

I am an HPE Employee
Accept or Kudo
Vineesh U S
Occasional Advisor

Re: Setuid causing runtime link errror

Hi Duncun,
Thank you for the response.

I understand that SHLIB_PATH will be ignored. But why does my $ORIGIN is getting ignored? When I specify it to take from my directory(mentioned using Wl,+b,\$ORIGIN/../lib:.:../lib:/usr/lib:/lib) why is this getting ignored?

Any pointers?

thanks
vineesh
Stephen Keane
Honored Contributor

Re: Setuid causing runtime link errror

Do a chatr on your binary. If it doesn't have SHLIB_PATH enabled, then do

# chatr +s enable binary name

make sure that the environment variable SHLIB_PATH is set and exported in your shell. It should include the path to where the library libprldap50.sl exists.

Vineesh U S
Occasional Advisor

Re: Setuid causing runtime link errror

Hi Stephen,
Thank you for your response.

But I don't want to enable the SHLIB_PATH. I want it to always take from my directory( $ORIGIN/../lib:.:../lib)

Is there any way to take from the specified path without enabling SHLIB_PATH?

thanks
vineesh
Stephen Keane
Honored Contributor

Re: Setuid causing runtime link errror

If you don't want to use SHLIB_PATH, then when you link the library to the object code to create the binary, the path of the library is set. If you run chatr (with no options) on the binary you will see the path that has been set. You can either (a) change the makefile to change the path, or (b) create a symbolic link between where the library actually is and where your binary thinks it is.

I suspect your binary has a relative path set for the library, whereas (if you intend to run the binary from outside its own directory) you need an absolute path.