ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Change a file's "Object Authorities"

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Change a file's "Object Authorities"

    Hello,

    I have a program that, as part of processing, uses open() to create a file.

    From what I understand I can set the "Data Authorities" via the MODE flag on this call but the "Object Authorities" are inherited from the directory owner. Therefore if someone has cocked up the dir permissions, which I'm encountering currently, I can't do anything about this on the open() as I (the file owner) inherit the crap object permissions.

    Am I understanding correctly here? If so, aside from using "GRTOBJAUT" or "CHGAUT", is there a way of altering "Object Authorities" with something else like chmod()? Or do I just have to use a QCMDEXC of CHGAUT?

    Example of what I mean (unable to rename, delete, etc. file after creating it);
    Code:
                       Data     --Object Authorities--    
    Opt  User        Authority  Exist  Mgt  Alter  Ref    
    
         *PUBLIC     *RWX         X     X     X     X     
         RDKELLS     *RWX
    Cheers,
    Ryan

  • #2
    Since the "object authorities" stuff is an IBM-specific feature, you won't be able to set it with the Unix/Posix standard APIs such as open() or chmod(). Since these APIs have to be compatable with the open standards, they can't have IBM-proprietary features in them.

    Is there any problem with simply creating the file with open() and then running CHGAUT to fix-up the authorities?

    Comment


    • #3
      Right-o, that explains that then - thanks Scott.


      No problem; I just wondered if I was missing something and it could be done via the APIs.

      Comment


      • #4
        Any reason why you can't make the change to the authority of the directory so that this doesn't continue to happen?

        Comment


        • #5
          Mainly because of the time (and therefore cost) to do that vs. just adding in the CHGAUT command.

          Comment

          Working...
          X