authenticate_.pl1 11/11/89 1105.0rew 11/11/89 0810.1 42219 /****^ *********************************************************** * * * Copyright, (C) Honeywell Bull Inc., 1987 * * * * Copyright, (C) Honeywell Information Systems Inc., 1982 * * * * Copyright (c) 1972 by Massachusetts Institute of * * Technology and Honeywell Information Systems, Inc. * * * *********************************************************** */ authenticate_: proc (resource_name) returns (char (3) aligned); /* AUTHENTICATE_ - Generates a three-letter code which is a function of a tape number. This code is placed on a sticker on each tape reel and disk pack. When the operator is requested to mount a tape or pack, he is told the reel number, and is required to type in the code from the sticker. Use of authentication codes permits us to check up on the operator to make sure that the correct tape or pack is mounted, and that a typing error or one-character garble in a printed message does not lead to incorrect mounting of a volume. The requirement for this feature is less severe if automatic volume recognition and access checking are performed by the operating system. The original program for generation authentication codes was written on CTSS. A later version was written in BAL for the 360/67, by Dave Anderson. This PL/I version by THVV, 5/72. Modified 03/79 by C. D. Tavares for new RCP Resource Management to work with volume names > 6 characters and to differentiate lower-case. */ dcl resource_name char (*) parameter; /* name of resource for which authentication required. */ dcl name_temp char (32) varying, (i, j) fixed bin, letter_val fixed bin, name_len fixed bin, (factor_up, factor_down) fixed bin (34), (hash_up, hash_down) fixed bin (71) init (0); /* Temporary hash sums */ dcl auth_code char (3) aligned init ("???"); /* Returned value */ dcl magic_constant fixed bin init (89); /* hashing divisor */ dcl label_alphabet char (68) aligned int static init ("0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ-----abcdefghijklmnopqrstuvwxyz"); /* the extra dashes hold slots for other punctuation we may later consider important */ dcl NUMERICS char (10) aligned int static options (constant) initial ("0123456789"); dcl auth_code_alphabet char (20) aligned int static options (constant) initial ("BCDFGHJKLMNPQRSTVWXY"); dcl (divide, mod, substr, index, length, verify) builtin; /* -------------------------------------- */ name_temp = rtrim (resource_name); /* for compatibility with old authentications, pad to six chars with spaces if it is at all alphabetic */ if length (name_temp) < 6 then if verify (name_temp, NUMERICS) > 0 then name_temp = name_temp || copy (" ", 6 - length (name_temp)); factor_up = 1; factor_down = 2 ** (length (name_temp) - 1); do i = 1 to length (name_temp); /* Loop on chars in input. */ letter_val = index (label_alphabet, substr (name_temp, i, 1)); /* Translate letter to number. */ if letter_val = 0 then letter_val = length (label_alphabet)+1; /* Treat all unknown punctuation alike. */ letter_val = letter_val - 1; /* normalize to zero origin for hash */ /* Perform hashing function. */ hash_up = hash_up + letter_val * factor_up; /* Shift each value left. */ hash_down = hash_down + letter_val * factor_down; /* ... another hash sum, shifting opposite. */ factor_up = factor_up + factor_up; /* Double factor_up, to shift another position. */ factor_down = divide (factor_down, 2, 34, 0); /* Halve factor_down to shift one less. */ end; hash_up = mod (hash_up, magic_constant) * magic_constant; /* Generate partial hash value. */ hash_up = hash_up + mod (hash_down, magic_constant); /* Generate rest of hash value. */ substr (auth_code, 3, 1) = substr (auth_code_alphabet, 1 + mod (hash_up, length (auth_code_alphabet)), 1); hash_up = divide (hash_up, length (auth_code_alphabet), 70, 0); /* Take it base 20. */ substr (auth_code, 2, 1) = substr (auth_code_alphabet, 1 + mod (hash_up, length (auth_code_alphabet)), 1); hash_up = divide (hash_up, length (auth_code_alphabet), 70, 0); /* .. and turn it into letters. */ substr (auth_code, 1, 1) = substr (auth_code_alphabet, 1 + mod (hash_up, length (auth_code_alphabet)), 1); return (auth_code); /* All through. */ end;  canon_for_volume_label_.pl1 11/11/89 1105.0r w 11/11/89 0810.1 34407 /****^ *********************************************************** * * * Copyright, (C) Honeywell Bull Inc., 1987 * * * * Copyright, (C) Honeywell Information Systems Inc., 1982 * * * * Copyright (c) 1972 by Massachusetts Institute of * * Technology and Honeywell Information Systems, Inc. * * * *********************************************************** */ canon_for_volume_label_: proc (resource_type, label_in, label_out, volume_format, code); /* This procedure performs canonicalization of labels for volumes (tapes, disks, etc.) It can perform a standard, site-settable pre-canonicalization of a user-typed label; or it will perform this and additionally add a canonicalization of a chosen type to satisfy some standard for internal labeling (e.g., create a six-character ANSI tape label from the given name.) These operations are performed in this subroutine rather than in the respective I/O modules so that RCP can perform the exact same translations when it is checking magnetic labels for authentication. Written 04/11/79 by C. D. Tavares */ dcl (resource_type char (*), label_in char (*), label_out char (*), volume_format fixed bin, code fixed bin (35)) parameter; dcl buffer char (32) varying, buffer_nonvar char (32) nonvarying; dcl (NUMERICS char (10) initial ("0123456789"), UPPERCASE char (26) initial ("ABCDEFGHIJKLMNOPQRSTUVWXYZ"), LOWERCASE char (26) initial ("abcdefghijklmnopqrstuvwxyz")) static options (constant); dcl (error_table_$smallarg, error_table_$bad_label) ext fixed bin (35) static; dcl (rtrim, ltrim, substr, length, verify, copy) builtin; dcl resource_info_$canonicalize_name entry (char (*), char (*), char (*), fixed bin (35)); %include rcp_volume_formats; %include rcp_resource_types; /* The first operation is to do the site-specifiable pre-canonicalization as defined in the RTDT. */ call resource_info_$canonicalize_name (resource_type, label_in, buffer_nonvar, code); if code ^= 0 then return; buffer = rtrim (buffer_nonvar); if length (buffer) = 0 then do; code = error_table_$bad_label; return; end; /* Now we handle extra desired canonicalization */ if resource_type = VOLUME_TYPE (TAPE_VOL_VTYPEX) then do; if volume_format = Volume_ibm_tape | volume_format = Volume_ansi_tape then do; if length (buffer) > 6 then buffer = substr (buffer, 1, 6); if verify (buffer, NUMERICS) = 0 then if length (buffer) < 6 then buffer = copy ("0", 6 - length (buffer)) || buffer; /* pad with leading zeroes */ else; else buffer = translate (buffer, UPPERCASE, LOWERCASE); end; else if volume_format = Volume_gcos_tape then do; if length (buffer) > 5 then buffer = substr (buffer, 1, 5); if verify (buffer, NUMERICS) = 0 then if length (buffer) < 5 then buffer = copy ("0", 5 - length (buffer)) || buffer; /* pad with leading zeroes */ else; else buffer = translate (buffer, UPPERCASE, LOWERCASE); end; else if volume_format = Volume_multics_tape then; /* none necessary */ else if volume_format = 0 then; /* none requested */ else do; code = error_table_$bad_label; return; end; end; else do; code = error_table_$bad_label; return; end; if length (label_out) < length (buffer) then do; code = error_table_$smallarg; return; end; label_out = buffer; code = 0; return; end canon_for_volume_label_;  canon_resource_name_.pl1 11/11/89 1105.0rew 11/11/89 0810.1 16974 /****^ *********************************************************** * * * Copyright, (C) Honeywell Bull Inc., 1987 * * * * Copyright, (C) Honeywell Information Systems Inc., 1982 * * * * Copyright (c) 1972 by Massachusetts Institute of * * Technology and Honeywell Information Systems, Inc. * * * *********************************************************** */ canon_resource_name_: proc; return; /* Every resource name that finds its way into ring 1 is canonicalized according to instructions found in the RTDT. This procedure implements "standard" canonicalizations for some resource types. Sites may code their own procedures and replace this one by installing references to them in the RTDT. This one, however, is a good start. /* Written 04/12/79 by C. D. Tavares */ dcl (input_name, output_name) char (*) parameter, info_ptr pointer parameter, code fixed bin parameter; dcl name_buffer char (32); dcl (error_table_$bad_resource_spec, error_table_$smallarg) ext fixed bin (35) static; dcl ltrim builtin; /* -------------------------------------------------- */ tape_vol: entry (input_name, output_name, info_ptr, code); name_buffer = input_name; if name_buffer = "" then do; code = error_table_$bad_resource_spec; return; end; name_buffer = ltrim (name_buffer, "0"); /* strip leading zeroes */ if name_buffer = "" then name_buffer = "0"; output_name = name_buffer; if output_name ^= name_buffer then code = error_table_$smallarg; else code = 0; return; end canon_resource_name_;  ebcdic8_to_ascii_.pl1 11/11/89 1105.0rew 11/11/89 0810.5 18360 /****^ *********************************************************** * * * Copyright, (C) Honeywell Bull Inc., 1987 * * * * Copyright, (C) Honeywell Information Systems Inc., 1982 * * * * Copyright (c) 1972 by Massachusetts Institute of * * Technology and Honeywell Information Systems, Inc. * * * *********************************************************** */ ebcdic8_to_ascii_: proc (input, output); /* This subroutine converts from packed 8 bit EBCDIC to 9 bit ASCII. Usage: dcl ebcdic8_to_ascii_ entry(bit(*),char(*)) call ebcdic8_to_ascii_(input bit string, output char string) Note: The input is converted in 8 bit groups, any leftover bits in the input string are ignored, the number of characters converted will be: divide(length(input), 8, 24). The conversion table defined in ebcdic_to_ascii is used for the tranlation. Written by: R.J.C. Kissel 11/09/76 */ /* Formal parameters */ dcl input bit (*); dcl output char (*); /* External variables */ dcl ebcdic_to_ascii_$ea_table char (256) external static; /* Automatic */ dcl char_code fixed bin; dcl char_limit fixed bin; dcl input_chars (1:divide (length (input), 8, 24)) bit (8) based (addr (input)); /* divide the input string into 8 bit chars */ dcl char_index fixed bin; dcl (addr, divide, fixed, hbound, lbound, length, substr, min) builtin; output = ""; char_limit = min (hbound (input_chars, 1), length (output)); /* only output as much as posible */ do char_index = lbound (input_chars, 1) to char_limit by 1; char_code = fixed (input_chars (char_index), 17); substr (output, char_index, 1) = substr (ebcdic_to_ascii_$ea_table, char_code+1, 1); end; end ebcdic8_to_ascii_;  ebcdic_to_ascii_.alm 11/11/89 1105.0rew 11/11/89 0810.5 42084 " *********************************************************** " * * " * Copyright, (C) Honeywell Bull Inc., 1987 * " * * " * Copyright, (C) Honeywell Information Systems Inc., 1982 * " * * " * Copyright (c) 1972 by Massachusetts Institute of * " * Technology and Honeywell Information Systems, Inc. * " * * " *********************************************************** "ALM subroutine to convert from 9 bit EBCDIC to 9 bit ASCII "Input bytes must be valid EBCDIC characters in the range "00 <_ hexadecimal_value <_ FF, or 000 <_ octal_value <_ 377. " "ARG 1: pointer to source string - data to be converted "ARG 2: pointer to target string - converted data " "PL/I Usage: " "dcl ebcdic_to_ascii_ ext entry (char (*), char (*)); " call ebcdic_to_ascii_ (input_string, output_string); " "Note: the EBCDIC to ASCII mapping used is defined in the text " of this procedure. It is available to the user program " through the following declaration. " "dcl ebcdic_to_ascii_$ea_table char (256) external static; " "The table consists of 256 ASCII characters which correspond to "the 256 EBCDIC characters. As only 128 of the EBCDIC characters "have ASCII mappings, the other 128 are mapped into the ASCII SUB "character, octal 032. (The EBCDIC SUB character is also mapped "into octal 032. " " 0) Created by Ross E. Klinger, 02/14/74 " 1) Modified by R.E. Klinger, 03/13/75 name ebcdic_to_ascii_ segdef ebcdic_to_ascii_ segdef ea_table ebcdic_to_ascii_: epp1 ap|2,* address of source string to pr1 epp3 ap|4,* address of target string to pr3 ldx3 0,du set x3 not to skip parent pointer if none lxl2 ap|0 load argument list code value canx2 =o000004,du check for code 4 - no parent pointer tnz *+2 transfer if no parent pointer ldx3 2,du parent pointer - set x3 to skip it lda ap|6,x3* load source string descriptor ldq ap|8,x3* load target string descriptor ana mask drop all but string size bits anq mask ditto even "EIS address must be even mvt (pr,rl),(pr,rl),fill(100) no, translate ebcdic to ascii desc9a 1|0,al source string desc9a 3|0,ql target string arg ea_table short_return "exit mask: oct 000077777777 even " ASCII OUTPUT ASCII GRAPHIC EBCDIC INPUT ea_table: oct 000001002003 NUL,SOH,STX,ETX 00-3 oct 032011032177 -,HT,-,DEL 04-7 oct 032032032013 -,-,-,VT 08-B oct 014015016017 FF,CR,SO,SI 0C-F oct 020021022023 DLE,DC1,DC2,DC3 10-3 oct 032032010032 -,-,BS,- 14-7 oct 030031032032 CAN,EM,-,- 18-B oct 034035036037 FS,GS,RS,US 1C-F oct 032032032032 -,-,-,- 20-3 oct 032012027033 -,LF,ETB,ESC 24-7 oct 032032032032 -,-,-,- 28-B oct 032005006007 -,ENQ,ACK,BEL 2C-F oct 032032026032 -,-,SYN,- 30-3 oct 032032032004 -,-,-,EOT 34-7 oct 032032032032 -,-,-,- 38-B oct 024025032032 DC4,NAK,-,SUB 3C-F oct 040032032032 (space),-,-,- 40-3 oct 032032032032 -,-,-,- 44-7 oct 032032032056 -,-,-,. 48-B oct 074050053174 <,(,+,| 4C|F oct 046032032032 &,-,-,- 50-3 oct 032032032032 -,-,-,- 54-7 oct 032032041044 -,-,!,$ 58-B oct 052051073136 *,),";",^ 5C-F oct 055057032032 "-",/,-,- 60-3 oct 032032032032 -,-,-,- 64-7 oct 032032032054 -,-,-,"," 68-B oct 045137076077 %,_,>,? 6C-F oct 032032032032 -,-,-,- 70-3 oct 032032032032 -,-,-,- 74-7 oct 032140072043 -,`,:,# 78-B oct 100047075042 @,',=," 7C-F oct 032141142143 -,a,b,c 80-3 oct 144145146147 d,e,f,g 84-7 oct 150151032032 h,i,-,- 88-B oct 032032032032 -,-,-,- 8C-F oct 032152153154 -,j,k,l 90-3 oct 155156157160 m,n,o,p 94-7 oct 161162032032 q,r,-,- 98-B oct 032032032032 -,-,-,- 9C-F oct 032176163164 -,~,s,t A0-3 oct 165166167170 u,v,w,x A4-7 oct 171172032032 y,z,-,- A8-B oct 032133032032 -,[,-,- AC-F oct 032032032032 -,-,-,- B0-3 oct 032032032032 -,-,-,- B4-7 oct 032032032032 -,-,-,- B8-B oct 032135032032 -,],-,- BC-F oct 173101102103 {,A,B,C C0-3 oct 104105106107 D,E,F,G C4-7 oct 110111032032 H,I,-,- C8-B oct 032032032032 -,-,-,- CC-F oct 175112113114 },J,K,L D0-3 oct 115116117120 M,N,O,P D4-7 oct 121122032032 Q,R,-,- D8-B oct 032032032032 -,-,-,- DC-F oct 134032123124 \,-,S,T E0-3 oct 125126127130 U,V,W,X E4-7 oct 131132032032 Y,Z,-,- E8-B oct 032032032032 -,-,-,- EC-F oct 060061062063 0,1,2,3 F0-3 oct 064065066067 4,5,6,7 F4-7 oct 070071032032 8,9,-,- F8-B oct 032032032032 -,-,-,- FC-F end bull_copyright_notice.txt 08/30/05 1008.4r 08/30/05 1007.3 00020025 ----------------------------------------------------------- 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