Title: Running fglrun as root Post by: Jos? V. on May 07, 2019, 06:26:46 pm I'm having an issue while running fglrun as root.
The program tries connecting to the database and fails immediately. The program I'm testing is the following: Quote main define oUser char(10) connect to 'db' user 'user' using 'pass' select @user into oUser from indica display "UTILIZADOR: ", oUser end main As root I get the following: Quote Program stopped at 'testeVersao.4gl', line number 4. SQL statement error number -6366 (0). Could not load database driver dbmdefault. Set FGLSQLDEBUG to get more details. As a regular user this is my result: Quote UTILIZADOR: jcv My question is why does this happen? is there a security block on fglrun that prevents it from being run as root? I now it sounds weird running it as root, but the program we are developing makes some system administration and needs root to access some files. Title: Re: Running fglrun as root Post by: Sebastien F. on May 07, 2019, 06:35:33 pm Hello,
What is the database? Informix? I suspect that your root user does not have all env settings (LD_LIBRARY_PATH) to load the database client library. Compare env settings with root and your regular user "jcv" ... Seb Title: Re: Running fglrun as root Post by: Jos? V. on May 07, 2019, 06:39:45 pm Quote from: Sebastien F. What is the database? Informix? I suspect that your root user does not have all env settings (LD_LIBRARY_PATH) to load the database client library. Compare env settings with root and your regular user "jcv" ... Thanks for the quick reply Sebastien, The database is informix. I'm doing the following steps on my test to ensure the same environment: 1 - run the program as "jcv" -> OK 2 - do "su -" to ensure root keeps the env 3 - run the program as root. Title: Re: Running fglrun as root Post by: Sebastien F. on May 07, 2019, 06:47:49 pm I really suspect that your env is wrong.
Assuming this is Linux, in the root env, try: ldd -r $FGLDIR/dbdrivers/dbmifx.so and check if all Informix shared libs are resolved. I tried to connect with a little program under root, and the Informix driver loads without problem when executing under root, but then I get an SQL error from the server because the root user has no privileges to connect to my db (as expected): fglrun ifx.42m Program stopped at 'ifx.4gl', line number 3. SQL statement error number -387. No connect permission. SYSTEM error number -111. ISAM error: no record found. I have really some doubts about executing programs as root ... What version of Informix IDS is this? You may at consider to create a database user with CREATE USER and connect as this user with CONNECT TO ... USER ... USING ... Seb Title: Re: Running fglrun as root Post by: Jos? V. on May 08, 2019, 01:14:59 pm Found the problem.
su logs in using the same env as the original user. except if you "su" to root. In this case the system takes precautionary security measures and blanks PATH and LIBPATH(aix version of LD_LIBRARY_PATH). So the problem was that LIBPATH was in fact diferent from the expected. Thank you for the help Title: Re: Running fglrun as root Post by: Sebastien F. on May 08, 2019, 06:08:22 pm Hello,
I am pleased to see that you have solved this issue. Tip: In such case, keep in mind that fglrun + the Informix ODI driver dbmifx act just like any other Informix ESQL/C program. So if you want to isolate the test to Informix software and configuration only, write a little ESQL/C program, compile it with esql and see if it works. Seb Title: Re: Running fglrun as root Post by: Reuben B. on May 09, 2019, 01:42:13 am Another tip is to build into your programs a way of dumping or viewing the actual environment that is inherited by the fglrun process when it launches.
So something like ... Code
GAS users will note that one of the first things in the uaproxy logs is a dump of the environment variables. Reuben |