ChinaUnix首页 > 精华文章 > IBM AS400应用论坛 > 正文

[原创] AS27学习笔记之CRTxxxPGM命令的USRPRF参数详解


http://www.chinaunix.net 作者:tomroom  发表于:2008-03-19 11:21:39
发表评论】 【查看原文】 【IBM AS400应用论坛讨论区】【关闭

在AS400 中编译程序CRTxxxPGM 命令中 USRPRF 参数 有两个值1)*USER, 2)*OWNER
按照IBM 帮助中说明
*USER 参数是程序运行时候访问OBJ的权限判断依据是调用该程序的用户
*OWNER参数是程序运行时候访问OBJ的权限判断依据是该程序OBJ 建立人的权限&调用该程序的用户权限(按IBM说法除了QSECOFR帐号其他用户都不能变更Obj的USRPRF参数)

下面用一个实验来验证下
修改WRKQRY 命令的*PUBLIC 为*EXCLUDE
[attach]239475[/attach]
此时用*USER普通帐号 调用该命令报无权限运行
[attach]239476[/attach]
CLP 中调用WRKQRY 命令
*************** Beginning of data *********************************************************
             PGM                                                                     060920
             WRKQRY                                                                  080318
                                                                                     060920
                                                                                   060920
             ENDPGM                                                                  060920
****************** End of data ************************************************************

如果在编译该CLP时候指定参数USRPRF *USER

[attach]239477[/attach]
普通帐号对新增的TEST01CL虽然有权限,但是在CLP调用WRKQRY命令时候报错如下
[attach]239478[/attach]
删除刚刚编译生成的TEST01CL该obj(按IBM说法除了QSECOFR帐号其他用户都不能变更Obj的USRPRF参数,顾要先删除该OBJ,否则单纯重新编译REPLACE *YES,无法修改该参数),再用有权限访问WRKQRY命令的*ALLOBJ权限帐号重新编译TEST01CL 修改USRPRF 参数为*OWNER (该OBJ的所有者)
[attach]239479[/attach]
运行该程序就能顺利调用本来,该clp程序调用是用TEST01CL该OBJ的建立者的权限去运行该WRKQRY命令
[attach]239480[/attach]

总结,可以用CRTxxxPGM 命令中 USRPRF 参数 来让普通用户调用些原本没有权限只执行的系统命令。

[ 本帖最后由 tomroom 于 2008-3-18 23:42 编辑 ]

































 fairyboy 回复于:2008-03-19 09:16:05

有文字有图片,非常直观,加为精华.


 qingzhou 回复于:2008-03-19 11:21:39

兄弟,误解IBM参数说明了吧?!
参数说明是说:只有程序的OWNER或具备QSECOFR特权用户可以修改USRPRF参数。
没说只允许具备QSECOFR特权用户才能修改USRPRF参数啊。

:emn31: :emn31: :emn31: 


                User profile (USRPRF) - Help                
                                                            
 Specifies whether the authority checking done while this program is running should include only the user who is running the program (*USER) or both the user who is running the program and the program owner (*OWNER).  The profiles of the program user or both the program user and the program owner are used to control which objects can be used by the program, including the authority the program has for each object. Only the program owner or a user with QSECOFR authority can change the user profile attribute.                                             
                                                        
    Note:  This parameter is ignored if REPLACE(*YES) is specified.                                          
                                                        
*USER                                                   
    The program runs under the user profile of the program's user.                                     
*OWNER                                                    
    The user profiles of both the program's owner and the program's user are used when the program is processed.
    The collective sets of object authority in both user profiles are used to find and access objects during   
    program processing.  Authority from the owning user profile's group profile is not included in the        
    authority for the running program.                    
 

总结,可以用CRTxxxPGM 命令中USRPRF 参数指定为*OWNER来让普通用户继承权限(比如:调用没有直接执行权限的系统命令)。

:emn27: :emn27: :emn27:




原文链接:http://bbs.chinaunix.net/viewthread.php?tid=1067313
转载请注明作者名及原文出处