首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用Java确定z/OS上哪个安全管理器处于活动状态?

如何使用Java确定z/OS上哪个安全管理器处于活动状态?
EN

Stack Overflow用户
提问于 2018-09-20 16:55:36
回答 1查看 181关注 0票数 4

我正在z/OS上编写Java代码,我需要找出哪个安全管理器(RACF、ACF2或TopSecret)在系统中处于活动状态。我该怎么做?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-09-20 16:55:36

您可以使用IBM包查看内存,如下所示。对于生产代码,我将为安全管理器创建一个枚举,而不是传递字符串,并且必须处理字符串比较。

代码语言:javascript
复制
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);
    }
}
票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52429890

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档