C Exit Not Executing

Greetings all,

I am using an enterprise utility for document archiving. This program calls a custom C exit to do data manipulation before loading data into the archive.

When the program is called via an automation script (Ran as ROOT), program successfully executes the C exit, and gives me an RC 0.

When I try to execute the same program, I get a return code 16. I suspect that this is because of the exit. When I remove the exit from the processing, the program runs fine.

My account on the server has full sudo access.

-rwxr-xr-x    1 root     system        12342 Feb 19 2010  CustomExit

Can't seem to figure this out but I have a sneaking suspicion that this is due to permissions somewhere, since ROOT can run it, but my SUDO ID cant.

I've engaged vendor support, and they haven't helped. Anyone have an idea?

I am assuming the LD_LIBRARY_PATH works in AIX as it does elsewhere. Please correct me if this is a bad assumption. EDIT: checked - 5.1 AIX and earlier uses LIBPATH, which may be brought forward to other newer releases. Newer releases use LD_LIBRARY_PATH as I expected.

See if you can successfully run the ldd command as yourself against the compiled program. Try it again as root user.

It could be that LD_LIBRARY_PATH needs to change for your user. The differences in output of the two ldd commands should give you a clue.

As an aside, subverting/reinventing system calls like exit() is generally a poor idea. And it is sometimes done by using replacement shared libraries and/or changing the LD_LIBRARY_PATH order of shared libraries.

When I do an ldd against the exit itself as my own user -

 
 user@server:/dir/to/exit> ldd CustomExit
 CustomEXIT: No such file or directory
 

toss in sudo-

user@server:/dir/to/exit> ldd CustomExit
CustomExit/usr/lib/libcrypt.a(shr.o)
/usr/lib/libc.a(shr.o)
user@server:/dir/to/exit> echo $LD_LIBRARY_PATH
/usr/lpp/psf/bin

Just because you have sudo does not mean your run as root all the time, which is what that ldd example shows. I'm not sure about the AIX syntax of the result - specifically the (shr.o)

It appears to be an object file file - somewhere - perhaps linked into the CustomExit code.

If an AIX person sees this it may help both of us. But IMO, you have some sort of permission issue. Example: the CustomExit code calls setuid()

Does nm CustomExit work for you (after sudo)? Please post the output.

And do you have a way of finding what exit code 16 - the error number - means for that app? Please post it if yes.