/* *********************************************************** * * * Copyright, (C) Honeywell Information Systems Inc., 1982 * * * * Copyright (c) 1972 by Massachusetts Institute of * * Technology and Honeywell Information Systems, Inc. * * * *********************************************************** */ get_raw_access_: proc (tptr, tlng, user_name, ring, dmode, emode, code); /* This procedure is given a pathname and returns the given user's access to the directory and entry. It calls chase_ to chase any links, imbedded or otherwise. The reason for using this procedure instead of hcs_$fs_get_path_name is to check a given user's access through a chain of links, and also to get the real directory even if the entry doesn't exist. */ /* initially coded by M. Weaver 18 November 1970 */ /* last modified by M. Weaver 8 January 1971 */ dcl (tdir, dir, retpn) char (168); dcl (ent, tent) char (32); dcl user_name char (*); dcl (ring, rl, rlev, lng, tlng, rlng) fixed bin; dcl code fixed bin (35); dcl (dmode, emode) fixed bin (5); dcl (dptr, eptr, pptr, tptr, bptr, nptr) ptr; dcl noent bit (1) aligned; dcl name1 char (tlng) based (tptr); dcl name2 char (lng) based (dptr); dcl name3 char (lng) based (pptr); dcl narea (0:959); /* area for names from status_; safer to put in stack */ dcl (addr, fixed, index, null, ptr, substr, unspec) builtin; dcl expand_pathname_ entry (char (*), char (*), char (*), fixed bin (35)); dcl absolute_pathname_ entry (char (*), char (*), fixed bin (35)); dcl hcs_$get_user_effmode entry (char (*), char (*), char (*), fixed bin, fixed bin (5), fixed bin (35)); dcl (error_table_$root, error_table_$noentry) ext fixed bin (35); dcl tarea (0:3); /* area for hcs_$status info */ rl, rlev = 0; /* initialize recursion level indicators */ bptr = addr (tarea); nptr = addr (narea); /* set up pointer to names area */ pptr = addr (tdir); /* will expand arg pathname into tdir */ call absolute_pathname_ (name1, tdir, code); if code ^= 0 then return; rlng = index (tdir, " ") - 1; /* get length of expanded path name */ call chase_ (pptr, rlng, retpn, code); /* if all goes well, retpn will contain the real absolute pathname of path */ if code ^= 0 then do; if code = error_table_$noentry then do; /* directory is still OK */ dir = retpn; /* only directory is returned in this case */ dptr = addr (dir); /* this would normally get set later */ noent = "1"b; /* return noentry code */ go to get_dmode; end; else return; /* other non_zero codes */ end; noent = "0"b; pptr = addr (retpn); dptr = addr (dir); eptr = addr (ent); lng = index (retpn, " ") - 1; /* get relevant length for expand_path_ */ call expand_pathname_ (name3, dir, ent, code); if code ^= 0 then go to ret; call hcs_$get_user_effmode (dir, ent, user_name, ring, emode, code); /* get user's access to entry */ if code ^= 0 then go to ret; /* the "extra" variable tent is used in case, at some future time, the above value of ent is to be kept intact as a return argument. */ get_dmode: pptr = addr (tdir); eptr = addr (tent); lng = index (dir, " ") - 1; /* get relevant length for expand_path_ */ call expand_pathname_ (name2, tdir, tent, code); if code ^= 0 then go to ret; call hcs_$get_user_effmode (tdir, tent, user_name, ring, dmode, code); /* get user's access to directory */ if code = 0 then if noent then code = error_table_$noentry; else; else if code = error_table_$root then do; code = 0; dmode = 0100b; /* All users have at least "re" access to root */ end; ret: return; chase_: proc (pptr, tlng, retpn, code) recursive; /* This procedure chases links. It is given a pathname, breaks it into a directory name and entry name and calls itself recursively in order to catch imbedded links. After returning from a recursive call, it checks the returned directory name and the given entry name to see if it has a link. If it does, it checks to see whether there have already been 10 links and if the given user has e access to the link's directory; if so, it gets the link pathname and "starts over". If it has a branch, it returns the branch name concatenated with the entry name. */ /* initially coded by M. Weaver 19 November 1970 */ dcl (path based (pptr), retpn, dir) char (168); dcl (ent, tent) char (32); dcl mode fixed bin (5); dcl (lng, tlng, trl, elng, i) fixed bin; dcl code fixed bin (35); dcl (pptr, dptr, eptr) ptr; dcl 1 link based aligned, 2 (type bit (2), nnames bit (16), nrp bit (18)) unaligned, 2 (dtem, dtd) bit (36) unaligned, 2 (pnl, pnrp) bit (18) unaligned; dcl lpname char (168) aligned based; dcl gt char (1) var; dcl (error_table_$noaccess, error_table_$linkmoderr, error_table_$toomanylinks, error_table_$pathlong) ext fixed bin; dcl area_ entry (fixed bin, ptr); dcl hcs_$status_ entry (char (*), char (*), fixed bin (1), ptr, ptr, fixed bin (35)); /* * * * * * * * * * * * * * * * * * * * */ dptr = addr (dir); process: do i = tlng to 1 by -1 while (substr (path, i, 1) ^= ">"); end; ent = substr (path, i+1, tlng-i); if i = 1 then do; /* at root */ retpn = ">"; go to havadir; end; dir = substr (path, 1, i-1); lng = i - 1; trl = rl; /* save rl; # of links at lower levels doesn't affect this level */ rlev = rlev + 1; /* go to deeper recursion level */ call chase_ (dptr, lng, retpn, code); /* make recursive call */ if code ^= 0 then return; rlev = rlev - 1; /* return from deeper recursion level */ havadir: call area_ (960, nptr); /* reinitialize each time; reuse same space */ /* can't call freen_ on nptr */ call hcs_$status_ (retpn, ent, 0, bptr, nptr, code); /* see if entry is a link or dir */ if code ^= 0 then do; noacc: if rlev > 0 & code = error_table_$noentry then code = error_table_$noaccess; return; end; rl = trl; /* restore this level's link record */ lng = index (retpn, " ") - 1; /* find no. of relevant characters in retpn */ if bptr -> link.type = "00"b then do; /* find out if user has access to use link */ do i = lng to 1 by -1 while (substr (retpn, i, 1) ^= ">"); end; /* break into directory, entry */ if i = 1 then dir = ">"; else dir = substr (retpn, 1, i-1); tent = substr (retpn, i+1, lng-i); if user_name ^= "" then do; /* don't need to check this for oneself */ call hcs_$get_user_effmode (dir, tent, user_name, ring, mode, code); if code ^= 0 then go to noacc; if ^substr (unspec (mode), 34, 1) then do; /* user doesn't have e access on dir */ code = error_table_$linkmoderr; return; end; end; if rl >= 10 then do; /* can't chase any more */ code = error_table_$toomanylinks; return; end; /* get link pathname and start over */ path = ptr (nptr, bptr -> link.pnrp) -> lpname; tlng = fixed (bptr -> link.pnl, 18); /* get length of link pathname */ rl = rl + 1; /* got another link */ go to process; end; /* have a branch */ /* check to be sure returned name isn't going to be too long */ elng = index (ent, " "); /* keep extra count; use for preceding ">" */ if elng = 0 then elng = 33; /* entry name is 32 characters or more */ if lng = -1 then go to too_long; /* directory name = 168 characters */ if lng + elng > 168 then do; /* name to be returned is too long */ too_long: code = error_table_$pathlong; return; end; rl = 0; if lng = 1 then gt = ""; else gt = ">"; /* a single char absolute pathname must be ">" */ retpn = substr (retpn, 1, lng) || gt || ent; return; end chase_; end get_raw_access_; */ ----------------------------------------------------------- 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 */