This Question is Possibly Answered

1 "correct" answer available (4 pts) 2 "helpful" answers available (2 pts)
4 Replies Last post: Aug 31, 2009 6:57 PM by scott_klement  
Click to view debbief's profile   2 posts since
Aug 27, 2009

Aug 28, 2009 1:28 PM

MKDIR() for IFS - with inherit authorization list object authority from parent directory

I am on v5r4 am have written a small utility to create directries on the IFS in RPGLE. I am using the unix api: mkdir(). I want to inherit the authorization list from the parent directory. Is this possible with mkdir(? If it is can someone please proivde an example.

Example line of code:


If mkdir(%trim(BillPayDirectory) :S_IRWXU + S_IRWXG + S_IRWXO) < 0;


Thanks!!

Click to view ujes's profile   3 posts since
Apr 6, 2009
1. Aug 28, 2009 4:22 AM Up Image in response to: debbief
Re: MKDIR() for IFS - with inherit authorization list object authority from parent directory
Hi debbif
MKDIR will propageate settings from the parent directory bu default, so just by doing a MKDIR you get the same security settings as the parent directory. But be aware that the owner always will be the creator!

I tried with a test profile to add new subdirectories to my home directory. There I had no AUTL.
So the first directory just got the same user authority as my home. Then I added an AUTL to this newly created directory, and then the test user created another sub directory under the first subdirectory (the one with the AUTL just added). And voila: the new directory have both the user authority and the same AUTL as the previous directory!

Regards Uno
Click to view ujes's profile   3 posts since
Apr 6, 2009
3. Aug 31, 2009 2:52 AM Up Image in response to: debbief
Re: MKDIR() for IFS - with inherit authorization list object authority from parent directory

Hi Debbie. It is hard to see WHY this don't work in your situation, I tested very quick and it worked for me when I used the MKDIR command from a commandline.
You are right! MKDIR() behaves different then command MKDIR!

I tested with this code:

D mkdirtst2 PR
D link1_ 100A .

mkdirtst2(link1);

P mkdirtst2 B
D mkdirtst2 PI
D link1 100A
* Prototype for QCMDEXC
d runCommand pr extpgm( 'QCMDEXC' )
d command_ 999 const
d size_ 15p 5 const
d command s 999
d commandSize s 15p 5 inz( 999 )

/free
command = 'MKDIR DIR(''' + %trim(link1) + ''')';
commandSize = 80;
runCommand( command : commandSize);

/end-free
P E

This did set the AUTL and all the rest according to the previous directory!

I will check if there is a way to force inherit of top directory authority using MKDIR() as well!

Regards Uno


Click to view scott_klement's profile   47 posts since
Mar 27, 2009
4. Aug 31, 2009 6:57 PM Up Image in response to: ujes
Re: MKDIR() for IFS - with inherit authorization list object authority from parent directory
I think ujes is referring to the MKDIR CL command (which is an alias for the CRTDIR CL command).

It behaves differently than the mkdir() API. The API is much lower-level, it doesn't do as much for you. If you want to achieve the same thing, you'd have to write a routine that retrieves the parent directory's auth list, permissions, etc, and set them on the child directory you've just created.


There's also a 'mkdir' command in QShell, and another one in PASE. These work similarly to the API.


Indeed, using the term 'mkdir' is ambiguous -- the system comes with (at least) 4 different tools named MKDIR. :)

Bottom Banner