I have a service program with a lot of miscellaneous functions. One of
these functions is an "ExecuteCommand" function using SQL. It uses SQL so
it can reach out to other systems to execute commands.
From SYSTEMA, it can do a CALL PGMA on SYSTEMB using the following logic.
EXEC SQL CONNECT TO SYSTEMB;
ExecuteCommand('CALL PGMA');
ExecuteCommand does
Build sqlString which then looks like this.CALL
QSYS2/QCMDEXC('CALL PGMA');
EXEC SQL EXECUTE IMMEDIATE :sqlString;
Return sqlcode = 0;
I have an RPGLE program (not SQLRPGLE) that is owned by a *SECOFR profile
and adopts *OWNER authority. When it calls the ExecuteCommand function in
the service program, it appears that it is not adopting any authority from
the calling program.
I do not want the service program to adopt *OWNER authority because then any
program could call ExecuteCommand and do major damage if they
want.ExecuteCommand('DLTLIB ProdLib').
Is there a way to have the service program adopt the authority of the
calling RPGLE program (Use adopted authority = *YES already) when it does
the ExecuteCommand? Is my problem because of the service program or the SQL
inside of it?
As an Amazon Associate we earn from qualifying purchases.