Как определить, какой менеджер безопасности активен в z / OS с использованием Java? - PullRequest
0 голосов
/ 20 сентября 2018

Я пишу код Java в z / OS, и мне нужно выяснить, какой менеджер безопасности (RACF, ACF2 или TopSecret) активен в системе.Как я могу это сделать?

1 Ответ

0 голосов
/ 20 сентября 2018

Вы можете использовать пакет IBM JZOS для просмотра памяти следующим образом.Для производственного кода я бы создал перечисление для менеджеров безопасности, а не передавал строки и имел бы дело со сравнениями строк.

import com.ibm.jzos.ZUtil;

/**
 * This is a sample program that uses IBM JZOS to determine
 * the Enterprise Security Manager that is active on a z/OS
 * system.
 * <p>
 * @see com.ibm.jzos.ZUtil#peekOSMemory(long, int)
 * @see com.ibm.jzos.ZUtil#peekOSMemory(long, byte[])
 */
public class peek {

    public static void main(String[] args) throws Exception {

        byte[] rcvtIdBytes = new byte[4];
        long pPSA  = 0L;
        int psaOffsetCVT = 16;
        long pCVT  = ZUtil.peekOSMemory(pPSA + psaOffsetCVT, 4); // Get address of CVT from PSA+16

        int cvtOffsetCVTRAC = 0x3e0;                             // Offset of CVTRAC (@RCVT) in the CVT
        long pCVTRAC =
                ZUtil.peekOSMemory(pCVT + cvtOffsetCVTRAC, 4);   // Get the address of CVTRAC (Mapped by ICHPRCVT)

        // Now we can retrieve the 4 byte ID (in IBM-1047) of the active ESM.
        int cvtracOffsetRCVTID = 0x45;                                   // Offset of RCVTID in the RCVT
        ZUtil.peekOSMemory(pCVTRAC + cvtracOffsetRCVTID, rcvtIdBytes);   // Get the RCVTID

        String rcvtId = new String(rcvtIdBytes, "IBM-1047");

        System.out.println("The Security Manager is: "+rcvtId);
    }
}
...