|
This is a multipart message in MIME format. -- [ Picked text/plain from multipart/alternative ] I know that some consider it a security breach - relying on security by obscurity, but I think you get a different error if you do not have access. Like 3401 - Permission denied. But, this test user profile, ROB, has *ALLOBJ. And option 9 on WRKLNK shows: Data --Object Authorities-- User Authority Exist Mgt Alter Ref ROB *RWX X X X X -------------Data Authorities------------- Objopr Read Add Update Delete Execute X X X X X X Good idea though. Rob Berendt -- "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." Benjamin Franklin Peter Connell <Peter.Connell@baycorpadvantage.com> Sent by: rpg400-l-admin@midrange.com 04/15/2002 04:18 PM Please respond to rpg400-l To: "'rpg400-l@midrange.com'" <rpg400-l@midrange.com> cc: Fax to: Subject: RE: ifs api's Are you certain that the user accesing the file has the explicit permissions required to read the file despite possibly being the owner. -----Original Message----- From: rob@dekko.com [mailto:rob@dekko.com] Sent: Tuesday, April 16, 2002 9:00 AM To: rpg400-l@midrange.com Subject: ifs api's This is a multipart message in MIME format. -- [ Picked text/plain from multipart/alternative ] I've read Scott's example at: http://archive.midrange.com/rpg400-l/200105/msg00320.html And I've read the Redbook 'Who knew...' for handling the errno part. I have a file which shows up with wrklnk '/rob/spool2.txt' However, my command STATTEST FILENAME('/rob/spool2.txt') Results in: DSPLY 3025No such path or directory. File attributes: Object . . . . . . : /rob/spool2.txt Type . . . . . . . . . . . . . . . . . : STMF Owner . . . . . . . . . . . . . . . . : ROB System object is on . . . . . . . . . : Local Auxiliary storage pool . . . . . . . . : 1 Object overflowed . . . . . . . . . : No Coded character set ID . . . . . . . . : 37 Hidden file . . . . . . . . . . . . . : No PC system file . . . . . . . . . . . . : No Read only . . . . . . . . . . . . . . : No Need to archive (PC) . . . . . . . . . : Yes Need to archive (AS/400) . . . . . . . : No Last access date/time . . . . . . . . : 01/07/02 17:50:5 Data change date/time . . . . . . . . : 06/01/01 15:08:5 Attribute change date/time . . . . . . : 10/21/01 11:11:5 Size of object data in bytes . . . . . : 2926 Allocated size of object . . . . . . . : 8192 File format . . . . . . . . . . . . . : *TYPE2 Size of extended attributes . . . . . : 0 Storage freed . . . . . . . . . . . . : No Auditing value . . . . . . . . . . . . : *NONE Object domain . . . . . . . . . . . . : *SYSTEM Number of hard links . . . . . . . . . : 1 Last used date . . . . . . . . . . . . : 01/07/02 Days used count . . . . . . . . . . . : 2 Reset date . . . . . . . . . . . . . : Allow write during save . . . . . . . : No Digitally signed . . . . . . . . . . . : No File ID . . . . . . . . . . . . . . . : X'0000000000000001833C09CE0000A3BF' Entire source: H Datfmt(*USA) H ExprOpts(*RESDECPOS) H Bnddir('ROUTINES/SRVPGM':'QC2LE') H ActGrp('QILE') H DftActGrp(*NO) D********************************************************************** D* File Information Structure (stat) D* D* struct stat { D* mode_t st_mode; /* File mode */ D* ino_t st_ino; /* File serial number */ D* nlink_t st_nlink; /* Number of links */ D* uid_t st_uid; /* User ID of the owner of file */ D* gid_t st_gid; /* Group ID of the group of file */ D* off_t st_size; /* For regular files, the file D* * size in bytes */ D* time_t st_atime; /* Time of last access */ D* time_t st_mtime; /* Time of last data modification */ D* time_t st_ctime; /* Time of last file status change */ D* dev_t st_dev; /* ID of device containing file */ D* size_t st_blksize; /* Size of a block of the file */ D* unsigned long st_allocsize; /* Allocation size of the file */ D* qp0l_objtype_t st_objtype; /* AS/400 object type */ D* unsigned short st_codepage; /* Object data codepage */ D* char st_reserved1[66]; /* Reserved */ D* }; ** times in statds are seconds from the "epoch" (Jan 1, 1970) ** and are in GMT (Greenwich Mean Time)... D* D p_statds S * D statds DS BASED(p_statds) D st_mode 10U 0 D st_ino 10U 0 D st_nlink 5U 0 D st_pad 2A D st_uid 10U 0 D st_gid 10U 0 D st_size 10I 0 D st_atime 10I 0 D st_mtime 10I 0 D st_ctime 10I 0 D st_dev 10U 0 D st_blksize 10U 0 D st_alctize 10U 0 D st_objtype 12A D st_codepag 5U 0 D st_resv11 62A D st_ino_gen_id 10U 0 D STATTEST PR EXTPGM('STATTEST') D FileName 100a const D STATTEST PI D FileName 100a const D*-------------------------------------------------------------------- D* Get File Information D* D* int stat(const char *path, struct stat *buf) D*-------------------------------------------------------------------- D stat PR 10I 0 ExtProc('stat') D path * value options(*string) D buf * value D GetTimeZone PR 5A D timezone DS D tzDir 1A D tzHour 2S 0 D tzFrac 2S 0 D statsize S 10I 0 d Msg S 50A D AccessTime S Z D ModifyTime S Z D ChgStsTime S Z D charTS S 26A D Epoch S Z INZ(z'1970-01-01-00.00.00') DGetErrNo PR * ExtProc('__errno') DStrError PR * ExtProc('strerror') D ErrorNo 10i 0 Value DpErrorNo s * inz DErrorNo s 10i 0 based(pErrorNo) DpErrorMsg s * inz DErrorMsg s 100a based(pErrorMsg) c eval *inlr = *on c eval statsize = %size(statds) c alloc statsize p_statds c if stat(FileName: p_statds) < 0 c eval pErrorNo = GetErrNo c eval pErrorMsg = StrError(ErrorNo) c eval Msg = %char(ErrorNo) + ErrorMsg c c dsply Msg c return c endif ** times in statds are seconds from the "epoch" (Jan 1, 1970) ** and are in GMT (Greenwich Mean Time)... ** Hey! Lets convert them to RPG timestamps! c Epoch adddur st_atime:*S AccessTime c Epoch adddur st_mtime:*S ModifyTime c Epoch adddur st_ctime:*S ChgStsTime ** adjust timestamps for timezone: c eval timezone = GetTimeZone c if tzDir = '-' c subdur tzHour:*H AccessTime c subdur tzHour:*H ModifyTime c subdur tzHour:*H ChgStsTime c else c adddur tzHour:*H AccessTime c adddur tzHour:*H ModifyTime c adddur tzHour:*H ChgStsTime c endif C* display the relevant times: c move AccessTime charTS c eval Msg = 'Last Access ' + charTS c dsply Msg c move ModifyTime charTS c eval Msg = 'Last Modified ' + charTS c dsply Msg c move ChgStsTime charTS c eval Msg = 'Status Changed ' + charTS c dsply Msg c dealloc p_statds c eval *inlr = *on P*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ P* This gets the offset from Universal Coordinated Time (UTC) P* from the system value QUTCOFFSET P*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ P GetTimeZone B D GetTimeZone PI 5A D peRcvVar S 1A DIM(100) D peRVarLen S 10I 0 D peNumVals S 10I 0 D peSysValNm S 10A D p_Offset S * D wkOffset S 10I 0 BASED(p_Offset) D p_SV S * D dsSV ds BASED(p_SV) D dsSVSysVal 10A D dsSVDtaTyp 1A D dsSVDtaSts 1A D dsSVDtaLen 10I 0 D dsSVData 5A D dsErrCode DS D dsBytesPrv 1 4B 0 INZ(256) D dsBytesAvl 5 8B 0 INZ(0) D dsExcpID 9 15 D dsReserved 16 16 D dsExcpData 17 256 C CALL 'QWCRSVAL' 99 C PARM peRcvVar C PARM 100 peRVarLen c PARM 1 peNumVals c PARM 'QUTCOFFSET' peSysValNm c PARM dsErrCode c if dsBytesAvl > 0 or *IN99 = *On c return *blanks c endif c eval p_Offset = %addr(peRcvVar(5)) c eval p_SV = %addr(peRcvVar(wkOffset+1)) c return dsSVData P E Rob Berendt -- "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." Benjamin Franklin _______________________________________________ This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l or email: RPG400-L-request@midrange.com Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l. This communication is confidential and may be legally privileged. If it is not addressed to you, you are on notice of its status. Please immediately contact us at our cost and destroy it. Please do not use, disclose, copy, distribute or retain any of it without our authority - to do so could be a breach of confidence. Thank you for your co-operation. If you need assistance, please contact Baycorp Advantage on either :- Australia 133124 or New Zealand +64 9 356 5800 All personnel email addresses must be in the format 'firstname.lastname@baycorpadvantage.com'. * Old Baycorp email addresses will cease to exist after June 1st 2002 * _______________________________________________ This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l or email: RPG400-L-request@midrange.com Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.