Operating System - OpenVMS
1828474 Members
3163 Online
109978 Solutions
New Discussion

Re: Tracking file/dir attribute (Set File xxx.dir/NODIR) in a prog.

 
SOLVED
Go to solution
Arch_Muthiah
Honored Contributor

Tracking file/dir attribute (Set File xxx.dir/NODIR) in a prog.

Hi,

Env:DS10/OpenVMS82/MACRO/C/C++
Appl: The MACRO prog checks all the files in the customer env. and creates the security reports.

My questions: Is there any MACRO symbols which will find when a "Directory's Attribute changed to /NODIR"?

Scenario:
The MACRO prog goes thru all users's dir/subdirs and checks for misowned files, hidden files, Home dir and .COM dir existances and its permissions etc.

I uses $PARSE and $SEARCH, $QIO services with FAB, NAM, XAB blocks to find any user has changed their directory's attr using as "$SET FILE xxx.dir/nodir".

After $PARSE FAB=(R10) calls, the prog checks various files attr (above mentioned). All the checks for other files went thru fine, except when it comes to xxx.dir. On this xxx.dir, it returns a error code in R0, which I equated with necessary $NAMDEF symbols, it does not fall under any of those NAM$_ESL, NAM$_ESA, NAM$_NMF, NAM$FNB, and few FAB$ symbols too.

I checked all $NAMDEF, $XABDEF, $FABDEF and $RMSDEF, but I don't find any symbol assigned to this conditions (xxx.dir set to /NODIR attr).

I send the $PARSE routine's return status code (R0) to C prog's strerror routine, it returned the following error message "ACP file or directory lookup failed". I don't want this message as it is common to few type of errors too.

If I can able to equate the $PARSE return status to any of MACRO DEF symbols defined for "DIR attr set to NODIR", I can print the my own message like "This directory has been hidden, it can be easily deleted whole as a directory even if it contains a important file" to the customer.

To HP Eng Team:
Is there any specific bit set in any MACRODEF to find this condition ?

Note: We have s/w support contract with HP, but whenever I call them, they have hard time to find the VMS experts in a specific area.

Thanks
Archunan
Regards
Archie
7 REPLIES 7
Steven Schweda
Honored Contributor

Re: Tracking file/dir attribute (Set File xxx.dir/NODIR) in a prog.

XABITMDEF.H mentions XAB$M_DIRECTORY and
similar things. Much to my surprise, I seem
to have done this.

http://antinode.org/ftp/bzip2/bzip2-1_0_3a_vms/vms.c

It's amazing what Google can find on a bad day.
Hein van den Heuvel
Honored Contributor
Solution

Re: Tracking file/dir attribute (Set File xxx.dir/NODIR) in a prog.

Hmm, this seems a NON-problem to me.
Just use ANAL/DISK ?

>>> My questions: Is there any MACRO symbols which will find when a "Directory's Attribute changed to /NODIR"?

When a file has lost its directory attribute then, get ready for this, it is no longer a directory. Amazing huh?

And there is no standard way back, allthough there are system calls to get there. See my example in:
http://h71000.www7.hp.com/freeware/freeware60/rms_tools/src/set_dir.c

You can ask RMS whether a file has a directory attribute through:
XABITM --> UCHAR --> XAB$_UCHAR_DIRECTORY

I suppose you could report a file that is NAMED .DIR and does not have a directory attribute. But why?

If you set a file/nodir and change the name not to be .dir, then you would have to look into the file to determine whether it 'looks' like a directory. No system service will help you with that.

>>> "This directory has been hidden, it can be easily deleted whole as a directory even if it contains a important file" to the customer.

NONSENSE!
There is no concept of hidden directories.
If a directoy file is marked /nodir, then it is no longer a directory and the file in it can no longer be found through that directory. ( This includes your program!)
The data files are still there though, even if that non-directory is then deleted.

If a user uses SET FILE/NODIR, then IMHO they deserve whatever trouble they get into.
The command required SYSPRV.
If you can not trust your SYSPRV users, then you might as well pack up and go home.
Check HELP SET FILE/NODIR

Hope this helps some.
Hein.
Arch_Muthiah
Honored Contributor

Re: Tracking file/dir attribute (Set File xxx.dir/NODIR) in a prog.

Steven,

I use XABITMDEF in my prog, but I did not see XAB$M_DIRECTORY. I will check this against the $parse return status code.

Hein:

> XABITM --> UCHAR --> XAB$_UCHAR_DIRECTORY
Steven also has mentioned about this, I will check tomorrow.

< NONSENSE!
< There is no concept of hidden directories.
< If a directoy file is marked /nodir, then < it is no longer a directory and the file < in it can no longer be found through that < directory.

I am sorry, I just simply said hidden dir.

Even after $set xxx.dir/nodir, it will be displayed as xxx.dir only, also we can do $set default [.xxx]
But we can't $DIR, $DELETE, or anything from that directory.

But we can delete that directory as whole even if it contains some unknown important files.

< If you can not trust your SYSPRV users,
< then you might as well pack up and go
< home

What can I do Hein?, We can not ask the customer to change their sysadmin env setup. I can report their problem what it may be. You knew that last time we were discussing about CMKRNL priv as def priv but not listed in their Auth priv. This case also like that only.

Steven/Hein: I am in the office now with heavy cold and fever, I will go thru both of your C.programs tomorrow or later. And I will update the status.

Thanks for your response to both you.

Archunan
Regards
Archie
Uwe Zessin
Honored Contributor

Re: Tracking file/dir attribute (Set File xxx.dir/NODIR) in a prog.

> $set default [.xxx]

VMS does not check if XXX is a valid directory - it just changes the process' memory cells. Try it - do a "SET DEFAULT" to a non-existent directory file.

> But we can't $DIR, $DELETE, or anything from that directory.

Of course not - it is no longer a directory.

>But we can delete that directory as whole even if it contains some unknown important files.

You can delete that file (XXX.DIR;1), but:
- it is no longer a directory
- the files in the former XXX directory are not being deleted
-- they become 'lost'
-- you need to recover them with ANALYZE/DISK_STRUCTURE/REPAIR
--- the utility will put them into [SYSLOST]
.
Wim Van den Wyngaert
Honored Contributor

Re: Tracking file/dir attribute (Set File xxx.dir/NODIR) in a prog.

This could be wrong but if you edit a direcytory file you see :

1-4 Mostly binary
5th character of each line is "printable" t.i. first chat of filename in the directory.
char
Lines end with NL

So it is possible to guess that it is/was a directory file.

Wim
Wim
Arch_Muthiah
Honored Contributor

Re: Tracking file/dir attribute (Set File xxx.dir/NODIR) in a prog.

Thanks Steven, Hein, Uwe, and Wim for your valuable time to analyze my problem and your responses.

Steven:
I thought of using $XABITM before I post this question, but Hein Idea of using $FCHDEF looks very easy for my MACRO programming knowledge.

Hein:
I use your suggestion of using $FCHDEF (VMS 7.3-2). This is the way I declared and used
in my MACRO programming....

ATRLST: .WORD ATR$S_UCHAR
.WORD ATR$C_UCHAR
.ADDRESS UCHAR
.LONG 0
UCHAR: .BLKB ATR$S_UCHAR
.
.
.
$PARSE FAB = (R10)
.
.
.
.
70$: CMPL #RMS$_FND,R0
BNEQ 80$
BBC #SUP_HDIR_ERR,GETFPD_FLAGS,100$
BBCS #HDIR_ERR,GETFPD_FLAGS,75$
75$: BRB 90$
80$: BITL #FCH$M_DIRECTORY,UCHAR
BEQL 90$
BRB 100$
90$: INCL R1 ;set suppression status
BBSS #errsup_set,getfpd_flags,100$ ;indicate a condition has been ; detected
100$: RSB

I looks working fine, but I will have to do more test, hopefully I will finish today, if not, I will be back to you for further assistance.

Uwe and Wim:
Thanks for your usefull informations.

Archunan
Regards
Archie
Arch_Muthiah
Honored Contributor

Re: Tracking file/dir attribute (Set File xxx.dir/NODIR) in a prog.

All:
I close this thread. My macro program works fine with Hein's suggestion of using FCHDEF.

Thanks to all
Archunan
Regards
Archie