THIS FILE IS DAMAGED COMPILATION LISTING OF SEGMENT fm_validate_ Compiled by: Multics PL/I Compiler, Release 28e, of February 14, 1985 Compiled at: Honeywell Multics Op. - System M Compiled on: 04/08/85 1138.7 mst Mon Options: optimize map 1 /* *********************************************************** 2* * * 3* * Copyright, (C) Honeywell Information Systems Inc., 1983 * 4* * * 5* *********************************************************** */ 6 7 8 /* DESCRIPTION: 9* 10* This module validates whether an entry is a data management file. 11* If the module is a DM file, a 0 code is returned. Otherwise, 12* the following codes are returned: 13* 14* error_table$noentry - File does not exist and user has "s" access to the 15* file's containing directory; 16* error_table_$no_info - User does not have "s" access to the file's 17* containing directory and does not have "r" access to the file's 18* first component; 19* error_table_$not_seg_type - File does not have the canonical add-name 20* on the first component which identifies it as a DM file, or, the 21* write-ring-bracket on the first component is not the DM ring (here 22* defined as the ring of execution of this module). 23**/ 24 25 /* HISTORY: 26* 27*Written by Lee Baldwin, 12/13/83. 28*Modified: 29*12/22/83 by Matthew Pierret: Changed to check for the special add-name on the 30* first component instead of a special link. 31*02/28/84 by Matthew Pierret: Changed contract to return non-not_seg_type 32* error codes in certain situations, specifically (a) if the file 33* does not exist, (b) the user does not have enough access to do the 34* validation. 35*03/08/84 by Matthew Pierret: Fixed call to pathname_ to first rtrim the 36* directory path argument. 37*03/12/84 by Matthew Pierret: Changed to rtrim the p_entry_name argument. 38*07/11/84 by Matthew C. Pierret: some changes. 39*11/01/84 by Matthew Pierret: Fixed expression which incorrectly diagnosed 40* caller_validation_level < read_bracket as an error, instead 41* of using >. 42*11/08/84 by Matthew C. Pierret: Removed an unnecessary rtrim and removed 43* declarations of un-used variables. 44**/ 45 /* format: style2 */ 46 47 fm_validate_: 48 proc (p_dir_path, p_entry_name, p_code); 49 50 /* START OF DECLARATIONS */ 51 /* Parameter */ 52 53 dcl p_dir_path char (*); /* the name of the directory containing the 54* DM file. */ 55 dcl p_entry_name char (*); /* the entry name of the DM file. */ 56 dcl p_code fixed bin (35); /* a standard system status code. */ 57 dcl p_ring_brackets (2) fixed bin (3); 58 59 /* Automatic */ 60 61 dcl (check_read, check_write, get_ring_brackets, no_status_permission) 62 bit (1) aligned init ("0"b); 63 64 dcl code fixed bin (35) init (0); 65 dcl containing_containing_dir_path 66 char (168); 67 dcl containing_dir_path char (168); 68 dcl containing_dir_name char (32); 69 dcl file_name char (32); 70 dcl file_path char (168); 71 dcl bit_count fixed bin (24); 72 dcl caller_validation_level 73 fixed bin; 74 dcl current_validation_level 75 fixed bin; 76 dcl mode fixed bin (5); 77 dcl ring_brackets (3) fixed bin (3); 78 dcl extended_ring_brackets (2) fixed bin (3); 79 dcl type fixed bin (2); 80 81 /* Based */ 82 /* Builtin */ 83 84 dcl (divide, mod, rtrim) builtin; 85 86 /* Condition */ 87 88 dcl cleanup condition; 89 90 /* Constant */ 91 92 dcl myname init ("fm_validate_") char (32) varying internal static options (constant); 93 dcl DONT_CHASE_LINK init (0) fixed bin (1) internal static options (constant); 94 dcl ( 95 WRITE_BRACKET init (1), 96 READ_BRACKET init (2) 97 ) fixed bin internal static options (constant); 98 dcl FIRST_COMPONENT_NAME init ("0") char (1) internal static options (constant); 99 100 /* Entry */ 101 102 dcl cu_$level_get entry (fixed bin); 103 dcl cu_$level_set entry (fixed bin); 104 dcl expand_pathname_ entry (char (*), char (*), char (*), fixed bin (35)); 105 dcl get_ring_ entry () returns (fixed bin); 106 dcl hcs_$get_ring_brackets entry (char (*), char (*), (3) fixed bin (3), fixed bin (35)); 107 dcl hcs_$get_user_effmode entry (char (*), char (*), char (*), fixed bin, fixed bin (5), fixed bin (35)); 108 dcl hcs_$status_minf entry (char (*), char (*), fixed bin (1), fixed bin (2), fixed bin (24), 109 fixed bin (35)); 110 dcl pathname_ entry (char (*), char (*)) returns (char (168)); 111 112 /* External */ 113 114 dcl error_table_$no_info ext fixed bin (35); 115 dcl error_table_$no_s_permission 116 ext fixed bin (35); 117 dcl error_table_$no_r_permission 118 ext fixed bin (35); 119 dcl error_table_$no_w_permission 120 ext fixed bin (35); 121 dcl error_table_$not_seg_type 122 ext fixed bin (35); 123 124 /* END OF DECLARATIONS */ 125 126 /* format: indcomtxt,^indblkcom */ 127 128 go to JOIN; 129 130 check_write_ring_bracket: 131 entry (p_dir_path, p_entry_name, p_code); 132 133 check_write = "1"b; 134 check_read = "1"b; 135 get_ring_brackets = "1"b; 136 go to JOIN; 137 138 check_read_ring_bracket: 139 entry (p_dir_path, p_entry_name, p_code); 140 141 check_write = "0"b; 142 check_read = "1"b; 143 get_ring_brackets = "1"b; 144 go to JOIN; 145 146 get_ring_brackets: 147 entry (p_dir_path, p_entry_name, p_ring_brackets, p_code); 148 149 check_write = "0"b; 150 check_read = "0"b; 151 get_ring_brackets = "1"b; 152 go to JOIN; 153 154 JOIN: 155 /**** Set the validation level to the ring of execution. */ 156 call cu_$level_get (caller_validation_level); 157 on cleanup call cu_$level_set (caller_validation_level); 158 current_validation_level = get_ring_ (); 159 call cu_$level_set (current_validation_level); 160 161 /**** Set up the file pathname */ 162 163 containing_dir_path = rtrim (p_dir_path); 164 file_name = rtrim (p_entry_name); 165 file_path = pathname_ (containing_dir_path, file_name); 166 167 /**** Verify that entry exists and process has at least minimal access. */ 168 169 call hcs_$status_minf (containing_dir_path, file_name, DONT_CHASE_LINK, type, (0), code); 170 if code ^= 0 & code ^= error_table_$no_s_permission 171 then call ERROR_RETURN (code); 172 173 /**** Verify that process has at least "s" permission on the containing 174* directory (containing_dir_path) or "r" permission on the first MSF component. */ 175 176 code = 0; 177 call expand_pathname_ (containing_dir_path, containing_containing_dir_path, containing_dir_name, code); 178 if code ^= 0 179 then call ERROR_RETURN (code); 180 call hcs_$get_user_effmode (containing_containing_dir_path, containing_dir_name, 181 "" /* defaults to calling process */, current_validation_level, mode, code); 182 if code ^= 0 | mode < S_ACCESS_BIN 183 then do; 184 no_status_permission = "1"b; 185 code = 0; 186 call hcs_$get_user_effmode (file_path, FIRST_COMPONENT_NAME, "", current_validation_level, mode, code) 187 ; 188 if code ^= 0 | mode < R_ACCESS_BIN 189 then call ERROR_RETURN (error_table_$no_info); 190 end; 191 192 /**** The process has sufficient access to validate that this is a DM file. 193* Do so by seeing if the first component has an add-name equal to the 194* value of DM_FILE_VALIDATION_NAME and has a value for its bit count that 195* is a valid encoding of the extended ring brackets of the file. 196* Also check that the first (real) ring bracket number is equal to the 197* ring of execution. */ 198 199 call hcs_$status_minf (file_path, DM_FILE_VALIDATION_NAME, DONT_CHASE_LINK, type, bit_count, code); 200 if code ^= 0 201 then call ERROR_RETURN (error_table_$not_seg_type); 202 203 call hcs_$get_ring_brackets (file_path, FIRST_COMPONENT_NAME, ring_brackets, code); 204 if code ^= 0 205 then call ERROR_RETURN (error_table_$not_seg_type); 206 if ring_brackets (1) ^= current_validation_level 207 then call ERROR_RETURN (error_table_$not_seg_type); 208 209 if get_ring_brackets 210 then do; 211 extended_ring_brackets (WRITE_BRACKET) = divide (bit_count, 8, 3, 0); 212 extended_ring_brackets (READ_BRACKET) = mod (bit_count, 8); 213 if check_write 214 then do; 215 if caller_validation_level > extended_ring_brackets (WRITE_BRACKET) 216 then if no_status_permission 217 then call ERROR_RETURN (error_table_$no_info); 218 else call ERROR_RETURN (error_table_$no_w_permission); 219 end; 220 else if check_read 221 then do; 222 if caller_validation_level > extended_ring_brackets (READ_BRACKET) 223 then if no_status_permission 224 then call ERROR_RETURN (error_table_$no_info); 225 else call ERROR_RETURN (error_table_$no_r_permission); 226 end; 227 else p_ring_brackets = extended_ring_brackets; 228 end; 229 230 /**** Restore validation level before returning. */ 231 232 p_code = 0; 233 MAIN_RETURN: 234 call cu_$level_set (caller_validation_level); 235 236 return; 237 238 ERROR_RETURN: 239 proc (er_p_code); 240 dcl er_p_code fixed bin (35); 241 242 p_code = er_p_code; 243 go to MAIN_RETURN; 244 245 end ERROR_RETURN; 246 247 1 1 /* BEGIN INCLUDE FILE ... access_mode_values.incl.pl1 1 2* 1 3* Values for the "access mode" argument so often used in hardcore 1 4* James R. Davis 26 Jan 81 MCR 4844 1 5* Added constants for SM access 4/28/82 Jay Pattin 1 6* Added text strings 03/19/85 Chris Jones 1 7**/ 1 8 1 9 1 10 /* format: style4,delnl,insnl,indattr,ifthen,dclind10 */ 1 11 dcl ( 1 12 N_ACCESS init ("000"b), 1 13 R_ACCESS init ("100"b), 1 14 E_ACCESS init ("010"b), 1 15 W_ACCESS init ("001"b), 1 16 RE_ACCESS init ("110"b), 1 17 REW_ACCESS init ("111"b), 1 18 RW_ACCESS init ("101"b), 1 19 S_ACCESS init ("100"b), 1 20 M_ACCESS init ("010"b), 1 21 A_ACCESS init ("001"b), 1 22 SA_ACCESS init ("101"b), 1 23 SM_ACCESS init ("110"b), 1 24 SMA_ACCESS init ("111"b) 1 25 ) bit (3) internal static options (constant); 1 26 1 27 /* The following arrays are meant to be accessed by doing either 1) bin (bit_value) or 1 28* 2) divide (bin_value, 2) to come up with an index into the array. */ 1 29 1 30 dcl SEG_ACCESS_MODE_NAMES (0:7) init ("null", "W", "E", "EW", "R", "RW", "RE", "REW") char (4) internal 1 31 static options (constant); 1 32 1 33 dcl DIR_ACCESS_MODE_NAMES (0:7) init ("null", "A", "M", "MA", "S", "SA", "SM", "SMA") char (4) internal 1 34 static options (constant); 1 35 1 36 dcl ( 1 37 N_ACCESS_BIN init (00000b), 1 38 R_ACCESS_BIN init (01000b), 1 39 E_ACCESS_BIN init (00100b), 1 40 W_ACCESS_BIN init (00010b), 1 41 RW_ACCESS_BIN init (01010b), 1 42 RE_ACCESS_BIN init (01100b), 1 43 REW_ACCESS_BIN init (01110b), 1 44 S_ACCESS_BIN init (01000b), 1 45 M_ACCESS_BIN init (00010b), 1 46 A_ACCESS_BIN init (00001b), 1 47 SA_ACCESS_BIN init (01001b), 1 48 SM_ACCESS_BIN init (01010b), 1 49 SMA_ACCESS_BIN init (01011b) 1 50 ) fixed bin (5) internal static options (constant); 1 51 1 52 /* END INCLUDE FILE ... access_mode_values.incl.pl1 */ 248 249 2 1 /* --------------- BEGIN include file status_structures.incl.pl1 --------------- */ 2 2 2 3 /* Revised from existing include files 09/26/78 by C. D. Tavares */ 2 4 2 5 /* This include file contains branch and link structures returned by 2 6* hcs_$status_ and hcs_$status_long. */ 2 7 2 8 dcl 1 status_branch aligned based (status_ptr), 2 9 2 short aligned, 2 10 3 type fixed bin (2) unaligned unsigned, /* seg, dir, or link */ 2 11 3 nnames fixed bin (16) unaligned unsigned, /* number of names */ 2 12 3 names_relp bit (18) unaligned, /* see entry_names dcl */ 2 13 3 dtcm bit (36) unaligned, /* date/time contents last modified */ 2 14 3 dtu bit (36) unaligned, /* date/time last used */ 2 15 3 mode bit (5) unaligned, /* caller's effective access */ 2 16 3 raw_mode bit (5) unaligned, /* caller's raw "rew" modes */ 2 17 3 pad1 bit (8) unaligned, 2 18 3 records_used fixed bin (18) unaligned unsigned, /* number of NONZERO pages used */ 2 19 2 20 /* Limit of information returned by hcs_$status_ */ 2 21 2 22 2 long aligned, 2 23 3 dtd bit (36) unaligned, /* date/time last dumped */ 2 24 3 dtem bit (36) unaligned, /* date/time branch last modified */ 2 25 3 lvid bit (36) unaligned, /* logical volume ID */ 2 26 3 current_length fixed bin (12) unaligned unsigned, /* number of last page used */ 2 27 3 bit_count fixed bin (24) unaligned unsigned, /* reported length in bits */ 2 28 3 pad2 bit (8) unaligned, 2 29 3 copy_switch bit (1) unaligned, /* copy switch */ 2 30 3 tpd_switch bit (1) unaligned, /* transparent to paging device switch */ 2 31 3 mdir_switch bit (1) unaligned, /* is a master dir */ 2 32 3 damaged_switch bit (1) unaligned, /* salvager warned of possible damage */ 2 33 3 synchronized_switch bit (1) unaligned, /* DM synchronized file */ 2 34 3 pad3 bit (5) unaligned, 2 35 3 ring_brackets (0:2) fixed bin (6) unaligned unsigned, 2 36 3 uid bit (36) unaligned; /* unique ID */ 2 37 2 38 dcl 1 status_link aligned based (status_ptr), 2 39 2 type fixed bin (2) unaligned unsigned, /* as above */ 2 40 2 nnames fixed bin (16) unaligned unsigned, 2 41 2 names_relp bit (18) unaligned, 2 42 2 dtem bit (36) unaligned, 2 43 2 dtd bit (36) unaligned, 2 44 2 pathname_length fixed bin (17) unaligned, /* see pathname */ 2 45 2 pathname_relp bit (18) unaligned; /* see pathname */ 2 46 2 47 dcl status_entry_names (status_branch.nnames) character (32) aligned 2 48 based (pointer (status_area_ptr, status_branch.names_relp)), 2 49 /* array of names returned */ 2 50 status_pathname character (status_link.pathname_length) aligned 2 51 based (pointer (status_area_ptr, status_link.pathname_relp)), 2 52 /* link target path */ 2 53 status_area_ptr pointer, 2 54 status_ptr pointer; 2 55 2 56 dcl (Link initial (0), 2 57 Segment initial (1), 2 58 Directory initial (2)) fixed bin internal static options (constant); 2 59 /* values for type fields declared above */ 2 60 2 61 /* ---------------- END include file status_structures.incl.pl1 ---------------- */ 250 251 3 1 /* BEGIN INCLUDE FILE dm_file_validation_name.incl.pl1 */ 3 2 3 3 /* DESCRIPTION: 3 4* 3 5* This include file contains the file validation name which is 3 6* added to the first component of each DM file and is used to 3 7* determine if an MSF is a DM file. 3 8**/ 3 9 3 10 /* HISTORY: 3 11*Written by Matthew Pierret, 11/07/84. 3 12*Modified: 3 13**/ 3 14 3 15 /* format: style2,ind3 */ 3 16 3 17 dcl DM_FILE_VALIDATION_NAME 3 18 init ("_Data_Management_file_._") char (24) internal static options (constant); 3 19 3 20 3 21 /* END INCLUDE FILE dm_file_validation_name.incl.pl1 */ 252 253 254 end fm_validate_; SOURCE FILES USED IN THIS COMPILATION. LINE NUMBER DATE MODIFIED NAME PATHNAME 0 04/08/85 1128.0 fm_validate_.pl1 >spec>on>41-15>fm_validate_.pl1 248 1 04/08/85 1113.3 access_mode_values.incl.pl1 >spec>on>41-15>access_mode_values.incl.pl1 250 2 11/22/82 0955.7 status_structures.incl.pl1 >ldd>include>status_structures.incl.pl1 252 3 01/07/85 0901.0 dm_file_validation_name.incl.pl1 >ldd>include>dm_file_validation_name.incl.pl1 NAMES DECLARED IN THIS COMPILATION. IDENTIFIER OFFSET LOC STORAGE CLASS DATA TYPE ATTRIBUTES AND REFERENCES (* indicates a set context) NAMES DECLARED BY DECLARE STATEMENT. DM_FILE_VALIDATION_NAME 000000 constant char(24) initial unaligned dcl 3-17 set ref 199* DONT_CHASE_LINK 000017 constant fixed bin(1,0) initial dcl 93 set ref 169* 199* FIRST_COMPONENT_NAME 000006 constant char(1) initial unaligned dcl 98 set ref 186* 203* READ_BRACKET constant fixed bin(17,0) initial dcl 94 ref 212 222 R_ACCESS_BIN constant fixed bin(5,0) initial dcl 1-36 ref 188 S_ACCESS_BIN constant fixed bin(5,0) initial dcl 1-36 ref 182 WRITE_BRACKET constant fixed bin(17,0) initial dcl 94 ref 211 215 bit_count 000323 automatic fixed bin(24,0) dcl 71 set ref 199* 211 212 caller_validation_level 000324 automatic fixed bin(17,0) dcl 72 set ref 154* 157* 215 222 233* check_read 000100 automatic bit(1) initial dcl 61 set ref 61* 134* 142* 150* 220 check_write 000101 automatic bit(1) initial dcl 61 set ref 61* 133* 141* 149* 213 cleanup 000336 stack reference condition dcl 88 ref 157 code 000104 automatic fixed bin(35,0) initial dcl 64 set ref 64* 169* 170 170 170* 176* 177* 178 178* 180* 182 185* 186* 188 199* 200 203* 204 containing_containing_dir_path 000105 automatic char(168) unaligned dcl 65 set ref 177* 180* containing_dir_name 000231 automatic char(32) Develnet ,>޶2 Develnet Develnet >K_COVO )noneVIP7400 3IO @$ XR IO SysDaemon JuRh6noneWY50_80C Strange Nt . P: Strange DEVM SQzRRHnQafo[noneWY50_80C Qj>WAAnderson H WAAnderson wa SysMaint ;R͏JT|dTCoEnoneSUN3 ----------------------------------------------------------- Historical Background This edition of the Multics software materials and documentation is provided and donated to Massachusetts Institute of Technology by Group BULL including BULL HN Information Systems Inc. as a contribution to computer science knowledge. This donation is made also to give evidence of the common contributions of Massachusetts Institute of Technology, Bell Laboratories, General Electric, Honeywell Information Systems Inc., Honeywell BULL Inc., Groupe BULL and BULL HN Information Systems Inc. to the development of this operating system. Multics development was initiated by Massachusetts Institute of Technology Project MAC (1963-1970), renamed the MIT Laboratory for Computer Science and Artificial Intelligence in the mid 1970s, under the leadership of Professor Fernando Jose Corbato. Users consider that Multics provided the best software architecture for managing computer hardware properly and for executing programs. Many subsequent operating systems incorporated Multics principles. Multics was distributed in 1975 to 2000 by Group Bull in Europe , and in the U.S. by Bull HN Information Systems Inc., as successor in interest by change in name only to Honeywell Bull Inc. and Honeywell Information Systems Inc. . ----------------------------------------------------------- Permission to use, copy, modify, and distribute these programs and their documentation for any purpose and without fee is hereby granted,provided that the below copyright notice and historical background appear in all copies and that both the copyright notice and historical background and this permission notice appear in supporting documentation, and that the names of MIT, HIS, BULL or BULL HN not be used in advertising or publicity pertaining to distribution of the programs without specific prior written permission. Copyright 1972 by Massachusetts Institute of Technology and Honeywell Information Systems Inc. Copyright 2006 by BULL HN Information Systems Inc. Copyright 2006 by Bull SAS All Rights Reserved