COMPILATION LISTING OF SEGMENT read_password_ Compiled by: Multics PL/I Compiler, Release 28b, of April 11, 1983 Compiled at: Honeywell LCPD Phoenix, System M Compiled on: 08/26/83 0941.2 mst Fri Options: optimize map 1 /* *********************************************************** 2* * * 3* * Copyright, (C) Honeywell Information Systems Inc., 1982 * 4* * * 5* * Copyright (c) 1972 by Massachusetts Institute of * 6* * Technology and Honeywell Information Systems, Inc. * 7* * * 8* *********************************************************** */ 9 10 11 12 /* Read a password from the terminal */ 13 14 /* Modified: 9 November 1981 by G. Palter to add the switch entry and not assume the last character read is a newline */ 15 /* Modified: 1 August 1983 by Jim Lippard to use iox_signal_ rather than 16* (the not externally available) ios_signal_ */ 17 18 19 read_password_: 20 procedure (P_prompt, P_password); 21 22 23 /* Parameters */ 24 25 dcl P_prompt character (*) parameter; /* message to prompt user for the password */ 26 dcl P_password character (*) parameter; /* the returned password */ 27 28 dcl P_tty_id character (4) aligned parameter; /* get_password_: no longer used */ 29 dcl P_tty_type fixed binary parameter; /* get_password_: no longer used */ 30 31 dcl P_output_switch pointer parameter; /* switch: -> switch to write prompt */ 32 dcl P_input_switch pointer parameter; /* switch: -> switch to read password */ 33 dcl P_code fixed binary (35) parameter; /* switch: status code if read fails */ 34 35 dcl no_return_code bit (1) aligned; 36 37 dcl (input_switch, output_switch) pointer; 38 39 dcl (char_loc, indx, num_read) fixed binary (21); 40 dcl err_code fixed binary (35); 41 dcl line_buffer character (120); 42 dcl temp_buffer character (120) varying; 43 44 dcl (SP initial (" "), 45 HT initial (" "), 46 NL initial (" 47 ")) 48 character (1) static options (constant); 49 50 dcl (TWO_POWER_THIRTYFIVE initial (34359738368), 51 TWO_POWER_SIXTY initial (1152921504606846976)) 52 fixed binary (71) static options (constant); 53 54 dcl (iox_$user_input, iox_$user_output) pointer external; 55 56 dcl error_table_$long_record fixed binary (35) external; 57 58 dcl ioa_$ioa_switch entry () options (variable); 59 dcl ioa_$ioa_switch_nnl entry () options (variable); 60 dcl iox_signal_ entry (ptr, fixed binary (35)); 61 dcl iox_$control entry (pointer, character (*), pointer, fixed binary (35)); 62 dcl iox_$get_line entry (pointer, pointer, fixed binary (21), fixed binary (21), fixed binary (35)); 63 64 dcl (addr, binary, bit, clock, collate, length, ltrim, mod, null, rtrim, search, substr, translate) 65 builtin; 66 67 dcl cleanup condition; 68 69 /* */ 70 71 /* Read a password from the user's terminal */ 72 73 /* read_password_: entry (P_prompt, P_password); */ 74 75 get_password_: /* old now obsolete entry */ 76 entry (P_prompt, P_tty_id, P_tty_type, P_password); 77 78 no_return_code = "1"b; 79 80 input_switch = iox_$user_input; /* read from user_input ... */ 81 output_switch = iox_$user_output; /* ... and put prompt on user_output */ 82 83 go to READ_PASSWORD_COMMON; 84 85 86 /* Read a password from a specified switch */ 87 88 switch: 89 entry (P_output_switch, P_input_switch, P_prompt, P_password, P_code); 90 91 no_return_code = "0"b; /* have a return code */ 92 P_code = 0; /* ... so initialize it */ 93 94 input_switch = P_input_switch; 95 output_switch = P_output_switch; 96 97 98 READ_PASSWORD_COMMON: 99 call ioa_$ioa_switch (output_switch, "^a", P_prompt); 100 101 on condition (cleanup) 102 call iox_$control (input_switch, "printer_on", null (), (0)); 103 104 call iox_$control (input_switch, "printer_off", null (), err_code); 105 if err_code ^= 0 then /* can't turn off printer: print a mask */ 106 call print_garbage (); 107 108 err_code = -1; 109 do while (err_code ^= 0); 110 call iox_$get_line (input_switch, addr (line_buffer), length (line_buffer), num_read, err_code); 111 if err_code ^= 0 then do; /* something went wrong ... */ 112 if (err_code = error_table_$long_record) then 113 err_code = 0; /* ... use the first part of the line */ 114 else if no_return_code then /* ... no nice way to inform caller */ 115 call iox_signal_ (input_switch, err_code); 116 else do; /* ... tell the caller about it */ 117 P_code = err_code; 118 return; 119 end; 120 end; 121 end; 122 123 num_read = length (rtrim (substr (line_buffer, 1, num_read), NL)); 124 /* strip trailing newlines */ 125 126 substr (line_buffer, 1, num_read) = translate (substr (line_buffer, 1, num_read), SP, HT); 127 /* fudge the rest of canonicalization */ 128 129 temp_buffer = ltrim (substr (line_buffer, 1, num_read)); /* trim leading whitespace */ 130 char_loc = search (temp_buffer, SP); 131 if char_loc ^= 0 then /* remove anything after first whitespace in the string */ 132 temp_buffer = substr (temp_buffer, 1, char_loc - 1); 133 134 if length (temp_buffer) = 0 then 135 P_password = "*"; /* caller really wanted a blank password */ 136 else P_password = temp_buffer; 137 138 call iox_$control (input_switch, "printer_on", null (), (0)); 139 140 return; 141 142 /* */ 143 144 /* Print a password mask (including a line of garbage) */ 145 146 print_garbage: 147 procedure (); 148 149 dcl strange_number fixed binary (71); 150 dcl strange_bits bit (60); 151 dcl CR character (1); 152 dcl garbage character (12); 153 154 dcl MISC character (32) static options (constant) initial ("etaiosqwertyuioplkjhgfdsazxcvbnm"); 155 156 CR = substr (collate (), 14, 1); /* be legal now */ 157 158 strange_number = 1979339333 * mod (clock (), TWO_POWER_THIRTYFIVE); 159 strange_bits = bit (binary (mod (strange_number, TWO_POWER_SIXTY), 60)); 160 161 do indx = 1 by 1 to 12; 162 substr (garbage, indx, 1) = substr (MISC, 1 + binary (substr (strange_bits, 1 - 5 + (indx * 5), 5)), 1); 163 end; 164 165 call ioa_$ioa_switch_nnl (output_switch, "YourPassword^aXWXWXWXWXWXW^a986986986986^a^a^a", 166 CR, CR, CR, garbage, CR); 167 168 return; 169 170 end print_garbage; 171 172 end read_password_; SOURCE FILES USED IN THIS COMPILATION. LINE NUMBER DATE MODIFIED NAME PATHNAME 0 08/26/83 0941.0 read_password_.pl1 >special_ldd>on>08/26/83>read_password_.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. CR 000240 automatic char(1) unaligned dcl 151 set ref 156* 165* 165* 165* 165* HT constant char(1) initial unaligned dcl 44 ref 126 MISC 000000 constant char(32) initial unaligned dcl 154 ref 162 NL constant char(1) initial unaligned dcl 44 ref 123 P_code parameter fixed bin(35,0) dcl 33 set ref 88 92* 117* P_input_switch parameter pointer dcl 32 ref 88 94 P_output_switch parameter pointer dcl 31 ref 88 95 P_password parameter char unaligned dcl 26 set ref 19 75 88 134* 136* P_prompt parameter char unaligned dcl 25 set ref 19 75 88 98* P_tty_id parameter char(4) dcl 28 ref 75 P_tty_type parameter fixed bin(17,0) dcl 29 ref 75 SP constant char(1) initial unaligned dcl 44 ref 126 130 TWO_POWER_SIXTY 000010 constant fixed bin(71,0) initial dcl 50 ref 159 TWO_POWER_THIRTYFIVE 000012 constant fixed bin(71,0) initial dcl 50 ref 158 addr builtin function dcl 64 ref 110 110 binary builtin function dcl 64 ref 159 162 bit builtin function dcl 64 ref 159 char_loc 000106 automatic fixed bin(21,0) dcl 39 set ref 130* 131 131 cleanup 000210 stack reference condition dcl 67 ref 101 clock builtin function dcl 64 ref 158 collate builtin function dcl 64 ref 156 err_code 000111 automatic fixed bin(35,0) dcl 40 set ref 104* 105 108* 109 110* 111 112 112* 114* 117 error_table_$long_record 000014 external static fixed bin(35,0) dcl 56 ref 112 garbage 000241 automatic char(12) unaligned dcl 152 set ref 162* 165* indx 000107 automatic fixed bin(21,0) dcl 39 set ref 161* 162 162* input_switch 000102 automatic pointer dcl 37 set ref 80* 94* 101* 104* 110* 114* 138* ioa_$ioa_switch 000016 constant entry external dcl 58 ref 98 ioa_$ioa_switch_nnl 000020 constant entry external dcl 59 ref 165 iox_$control 000024 constant entry external dcl 61 ref 101 104 138 iox_$get_line 000026 constant entry external dcl 62 ref 110 iox_$user_input 000010 external static pointer dcl 54 ref 80 iox_$user_output 000012 external static pointer dcl 54 ref 81 iox_signal_ 000022 constant entry external dcl 60 ref 114 length builtin function dcl 64 ref 110 110 123 134 line_buffer 000112 automatic char(120) unaligned dcl 41 set ref 110 110 110 110 123 126* 126 129 ltrim builtin function dcl 64 ref 129 mod builtin function dcl 64 ref 158 159 no_return_code 000100 automatic bit(1) dcl 35 set ref 78* 91* 114 null builtin function dcl 64 ref 101 101 104 104 138 138 num_read 000110 automatic fixed bin(21,0) dcl 39 set ref 110* 123* 123 126 126 129 output_switch 000104 automatic pointer dcl 37 set ref 81* 95* 98* 165* rtrim builtin function dcl 64 ref 123 search builtin function dcl 64 ref 130 strange_bits 000236 automatic bit(60) unaligned dcl 150 set ref 159* 162 strange_number 000234 automatic fixed bin(71,0) dcl 149 set ref 158* 159 substr builtin function dcl 64 set ref 123 126* 126 129 131 156 162* 162 162 temp_buffer 000150 automatic varying char(120) dcl 42 set ref 129* 130 131* 131 134 136 translate builtin function dcl 64 ref 126 NAMES DECLARED BY EXPLICIT CONTEXT. READ_PASSWORD_COMMON 000234 constant label dcl 98 ref 83 get_password_ 000147 constant entry external dcl 75 print_garbage 000611 constant entry internal dcl 146 ref 105 read_password_ 000122 constant entry external dcl 19 switch 000204 constant entry external dcl 88 THERE WERE NO NAMES DECLARED BY CONTEXT OR IMPLICATION. STORAGE REQUIREMENTS FOR THIS PROGRAM. Object Text Link Symbol Defs Static Start 0 0 1460 1510 1320 1470 Length 1700 1320 30 153 137 0 BLOCK NAME STACK SIZE TYPE WHY NONQUICK/WHO SHARES STACK FRAME read_password_ 244 external procedure is an external procedure. on unit on line 101 88 on unit print_garbage internal procedure shares stack frame of external procedure read_password_. STORAGE FOR AUTOMATIC VARIABLES. STACK FRAME LOC IDENTIFIER BLOCK NAME read_password_ 000100 no_return_code read_password_ 000102 input_switch read_password_ 000104 output_switch read_password_ 000106 char_loc read_password_ 000107 indx read_password_ 000110 num_read read_password_ 000111 err_code read_password_ 000112 line_buffer read_password_ 000150 temp_buffer read_password_ 000234 strange_number print_garbage 000236 strange_bits print_garbage 000240 CR print_garbage 000241 garbage print_garbage THE FOLLOWING EXTERNAL OPERATORS ARE USED BY THIS PROGRAM. alloc_cs call_ext_out_desc call_ext_out return mpfx2 mod_fx4 enable shorten_stack ext_entry_desc int_entry clock THE FOLLOWING EXTERNAL ENTRIES ARE CALLED BY THIS PROGRAM. ioa_$ioa_switch ioa_$ioa_switch_nnl iox_$control iox_$get_line iox_signal_ THE FOLLOWING EXTERNAL VARIABLES ARE USED BY THIS PROGRAM. error_table_$long_record iox_$user_input iox_$user_output LINE LOC LINE LOC LINE LOC LINE LOC LINE LOC LINE LOC LINE LOC 19 000116 75 000141 78 000166 80 000170 81 000173 83 000176 88 000177 91 000223 92 000224 94 000226 95 000231 98 000234 101 000257 104 000327 105 000362 108 000365 109 000367 110 000372 111 000415 112 000417 114 000424 117 000437 118 000441 121 000442 123 000443 126 000455 129 000466 130 000510 131 000523 134 000531 136 000544 138 000555 140 000610 146 000611 156 000612 158 000616 159 000626 161 000634 162 000641 163 000655 165 000657 168 000716 ----------------------------------------------------------- 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