• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • Re-Adopt Authority Utility

    June 9, 2010 Patrick Botz

    Adopted authority is a great way to avoid giving users direct access to data. However, there are a couple of challenges with changing an existing application to rely on adopted authority. First, adopted authority is not propagated to submitted jobs. Second, adopted authority must be removed whenever a command line is provided for the end user. Third, in a production environment it is difficult to find which programs must adopt authority without breaking production users.

    Alternative public authority, as described in my previous tip, addresses the last issue. This tip addresses the first issue.

    To describe the tip, I’ll first set up an example. Assume we have a large application, MYAPP. We have changed all the data objects to PUBLIC *EXCLUDE with no private authorities. We changed the programs and data for the application to be owned by user profile MYAPPOWNUP and we changed the initial program (MYAPPPGMS/MYAPPINIT) to adopt MYAPPOWNUP. However, finding all the programs/commands that are submitted by the application is not realistic. Our end user, FRED, is running MYAPP and is four menus deep. He selects an option which, unbeknownst to us, executes the following command:

    SMBJOB CMD(MYAPPPGMX PARM(xyz))
    

    MYAPPPGMX must run with MYAPPOWNUP adopted authority to work properly, but since it is submitted, it only runs with FRED’s authority.

    Before continuing, let me warn you that describing “how” this works is more complicated than implementing the solution.

    You can solve this problem by building two programs:

    1. a small “wrapper” program (READOPTWP)
    2. a SBMJOB command change exit point program (READOPTEP)

    I also recommend creating a user profile with *ALLOBJ and *SECADM special authority (READPOTUP) for use with the utility. The profile should be *DISABLED and password should be *NONE. I refer to these programs as the READOPT utility.

    READOPTWP is owned by and adopts the application’s owning profile (MYAPPOWNUP). It accepts two parameters: USERID and CMDSTR. PUBLIC authority is *EXCLUDE with no private authorities. READOPTWP swaps to the user profile specified in the USERID parameter and then calls QCMDEXEC with the contents of the CMDSTR parameter.

    READOPTEP is just a little more complicated than the READOPTWP program. It determines if MYAPPOWNUP adopted authority is in effect for the job performing the SBMJOB command. If it is, it changes the value of the CMD and USER parameters of the SBMJOB command before returning to the system. All other SBMJOB parameters are left unchanged. If adopted authority is not in effect, it returns to the system without changing the command.

    To determine if adopted authority is in effect, READOPTEP retrieves the current job stack. Starting with the most current job, it checks the stack for a specified library and program (MYAPPPGMS/MYAPPINIT in our example).

    If found, READOPTEP checks if the SBMJOB USER() parameter is set to something other than the current job user profile. If so, it saves this value. Otherwise, the exit program saves the current user profile of the executing job (saved-usrprf). In either case the USER parameter of the SBMJOB command is changed to USER(READOPTUP).

    If MYAPPPGMS/MYAPPINIT is found, READOPTEP also saves the original value of the CMD parameter of the SBMJOB command (orig-cmd-str).

    READOPTEP changes the CMD parameter value to CMD( READOPTWP CMDSTR(orig-cmd-str) USERID(saved-usrprf) ). All other parameters to the SBMJOB program remain unchanged.

    READOPEP adopts the READOPTUP user profile. MYAPPOWNUP has *USE to READOPTWP and PUBLIC is *EXCLUDE. This solves any authority issues related to job queues, programs, user profiles, and swapping. It also prevents users from calling READOPTEP directly.

    Going back to our example above, READOPTEP would change the original SBMJOB command to the following:

    SBMJOB
     CMD(READOPTWP CMDSTR(MYAPPPGMX PARM(xyz) USERID(FRED) ) )
     USER(READOPTUP)
    

    MYAPPPGMX runs under user profile FRED, and also runs with adopted authority MYAPPOWNUP. Problem solved.

    Describing why the READOPT utility works is much more complicated than building the utility! READOPTEP is a relatively simple exit point program that checks for a specific library/program in the job stack. If found, it changes the CMD and USER parameter values. READOPTWP is even simpler. It swaps to a user profile provided in the USERID input parameter and calls QCMDEXEC with the string provided in the CMDSTR input parameter.

    I have a tool I use with my customers that automates the implementation of READOPT. In a setup utility, you specify library/program and the user profile it adopts. It creates a version of the READOPTWP program for you and adds the info to a table. A deployment utility registers READOPTEP program. Only one version of READOPTEP is needed. It reads the entries in the table and looks for them in the job stack. If an entry from the table is found in the job stack, it changes the CMD parameter to the call the appropriate version of READOPTWP.

    Patrick Botz is the principal consultant and founder of Botz & Associates Inc. He is also president of Valid Technologies, LLC, a biometric middleware ISV. Pat spent nearly 20 years working at IBM in various security roles including lead IBM i security architect, IBM eServer security team, and the head of IBM Lab Services Security Consulting practice. Check out his Website at www.botzandassociates.com. Send your questions or comments for Patrick to Ted Holt via the IT Jungle Contact page.

    RELATED STORY

    Low Risk Authority Changes



                         Post this story to del.icio.us
                   Post this story to Digg
        Post this story to Slashdot

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Tags:

    Sponsored by
    DRV Tech

    Get More Out of Your IBM i

    With soaring costs, operational data is more critical than ever. IBM shops need faster, easier ways to distribute IBM applications-based data to users more efficiently, no matter where they are.

    The Problem:

    For Users, IBM Data Can Be Difficult to Get To

    IBM Applications generate reports as spooled files, originally designed to be printed. Often those reports are packed together with so much data it makes them difficult to read. Add to that hardcopy is a pain to distribute. User-friendly formats like Excel and PDF are better, offering sorting, searching, and easy portability but getting IBM reports into these formats can be tricky without the right tools.

    The Solution:

    IBM i Reports can easily be converted to easy to read and share formats like Excel and PDF and Delivered by Email

    Converting IBM i, iSeries, and AS400 reports into Excel and PDF is now a lot easier with SpoolFlex software by DRV Tech.  If you or your users are still doing this manually, think how much time is wasted dragging and reformatting to make a report readable. How much time would be saved if they were automatically formatted correctly and delivered to one or multiple recipients.

    SpoolFlex converts spooled files to Excel and PDF, automatically emailing them, and saving copies to network shared folders. SpoolFlex converts complex reports to Excel, removing unwanted headers, splitting large reports out for individual recipients, and delivering to users whether they are at the office or working from home.

    Watch our 2-minute video and see DRV’s powerful SpoolFlex software can solve your file conversion challenges.

    Watch Video

    DRV Tech

    www.drvtech.com

    866.378.3366

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Sponsored Links

    Help/Systems:  Use Robot/SPACE for your IBM i disk storage management
    ManageEngine:  Who says iSeries systems monitoring software has to be expensive?
    COMMON:  Join us at the Fall 2010 Conference & Expo, Oct. 4 - 6, in San Antonio, Texas

    IT Jungle Store Top Book Picks

    Easy Steps to Internet Programming for AS/400, iSeries, and System i: List Price, $49.95
    The iSeries Express Web Implementer's Guide: List Price, $49.95
    The System i RPG & RPG IV Tutorial and Lab Exercises: List Price, $59.95
    The System i Pocket RPG & RPG IV Guide: List Price, $69.95
    The iSeries Pocket Database Guide: List Price, $59.00
    The iSeries Pocket SQL Guide: List Price, $59.00
    The iSeries Pocket Query Guide: List Price, $49.00
    The iSeries Pocket WebFacing Primer: List Price, $39.00
    Migrating to WebSphere Express for iSeries: List Price, $49.00
    Getting Started With WebSphere Development Studio Client for iSeries: List Price, $89.00
    Getting Started with WebSphere Express for iSeries: List Price, $49.00
    Can the AS/400 Survive IBM?: List Price, $49.00
    Chip Wars: List Price, $29.95

    Kronos Touts iSeries Central Customer Two Top i Concerns and a Bunch of Little Ones

    Leave a Reply Cancel reply

Volume 10, Number 18 -- June 9, 2010
THIS ISSUE SPONSORED BY:

SEQUEL Software
WorksRight Software
Botz & Associates, Inc.

Table of Contents

  • Re-Adopt Authority Utility
  • Date Field Odds and Ends
  • Admin Alert: How To Run NetServer from the Green Screen in 10 Minutes

Content archive

  • The Four Hundred
  • Four Hundred Stuff
  • Four Hundred Guru

Recent Posts

  • Meet The Next Gen Of IBMers Helping To Build IBM i
  • Looks Like IBM Is Building A Linux-Like PASE For IBM i After All
  • Will Independent IBM i Clouds Survive PowerVS?
  • Now, IBM Is Jacking Up Hardware Maintenance Prices
  • IBM i PTF Guide, Volume 27, Number 24
  • Big Blue Raises IBM i License Transfer Fees, Other Prices
  • Keep The IBM i Youth Movement Going With More Training, Better Tools
  • Remain Begins Migrating DevOps Tools To VS Code
  • IBM Readies LTO-10 Tape Drives And Libraries
  • IBM i PTF Guide, Volume 27, Number 23

Subscribe

To get news from IT Jungle sent to your inbox every week, subscribe to our newsletter.

Pages

  • About Us
  • Contact
  • Contributors
  • Four Hundred Monitor
  • IBM i PTF Guide
  • Media Kit
  • Subscribe

Search

Copyright © 2025 IT Jungle