Rev | Author | # | Line |
---|---|---|---|
1 | perry | 1 | GETPASS |
2 | !!!GETPASS | ||
3 | NAME | ||
4 | SYNOPSIS | ||
5 | DESCRIPTION | ||
6 | RETURN VALUE | ||
7 | ERRORS | ||
8 | NOTES | ||
9 | FILES | ||
10 | SEE ALSO | ||
11 | HISTORY | ||
12 | BUGS | ||
13 | ---- | ||
14 | !!NAME | ||
15 | |||
16 | |||
17 | getpass - get a password | ||
18 | !!SYNOPSIS | ||
19 | |||
20 | |||
21 | __#include __ | ||
22 | |||
23 | |||
24 | __char *getpass( const char * prompt );__ | ||
25 | !!DESCRIPTION | ||
26 | |||
27 | |||
28 | This function is obsolete. Do not use it. | ||
29 | |||
30 | |||
31 | The __getpass__() function opens ''/dev/tty'' (the | ||
32 | controlling terminal of the process), outputs the string | ||
33 | ''prompt'', turns off echoing, reads one line (the | ||
34 | ''/dev/tty'' again. | ||
35 | !!RETURN VALUE | ||
36 | |||
37 | |||
38 | The function __getpass__ returns a pointer to a static | ||
39 | buffer containing the (first PASS_MAX bytes of) the password | ||
40 | without the trailing newline, terminated by a NUL. This | ||
41 | buffer may be overwritten by a following call. On error, the | ||
42 | terminal state is restored, ''errno'' is set | ||
43 | appropriately, and NULL is returned. | ||
44 | !!ERRORS | ||
45 | |||
46 | |||
47 | The function may fail if | ||
48 | |||
49 | |||
50 | __ENXIO__ | ||
51 | |||
52 | |||
53 | The process does not have a controlling | ||
54 | terminal. | ||
55 | !!NOTES | ||
56 | |||
57 | |||
58 | For libc4 and libc5, the prompt is not written to | ||
59 | ''/dev/tty'' but to ''stderr''. Moreover, if | ||
60 | ''/dev/tty'' cannot be opened, the password is read from | ||
61 | ''stdin''. The static buffer has length 128 so that only | ||
62 | the first 127 bytes of the password are returned. While | ||
63 | reading the password, signal generation (SIGINT, SIGQUIT, | ||
64 | SIGSTOP, SIGTSTOP) is disabled and the corresponding | ||
65 | characters (usually control-C, control-, control-Z and | ||
66 | control-Y) are transmitted as part of the password. Since | ||
67 | libc 5.4.19 also line editing is disabled, so that also | ||
68 | backspace and the like will be seen as part of the | ||
69 | password. | ||
70 | |||
71 | |||
72 | For glibc2, if ''/dev/tty'' cannot be opened, the prompt | ||
73 | is written to ''stderr'' and the password is read from | ||
74 | ''stdin''. There is no limit on the length of the | ||
75 | password. Line editing is not disabled. | ||
76 | |||
77 | |||
78 | According to the SUSv2, the value of PASS_MAX must be | ||
79 | defined in '''' in case it is smaller | ||
80 | than 8, and can in any case be obtained using | ||
81 | ''sysconf(_SC_PASS_MAX)''. However, POSIX.2 withdraws the | ||
82 | constants PASS_MAX and _SC_PASS_MAX, and the function | ||
83 | __getpass ().__ Libc4 and libc5 have never supported | ||
84 | PASS_MAX or _SC_PASS_MAX. Glibc2 accepts _SC_PASS_MAX and | ||
85 | returns BUFSIZ (e.g., 8192). | ||
86 | !!FILES | ||
87 | |||
88 | |||
89 | ''/dev/tty'' | ||
90 | !!SEE ALSO | ||
91 | |||
92 | |||
93 | crypt(3) | ||
94 | !!HISTORY | ||
95 | |||
96 | |||
97 | A __getpass__ function appeared in Version 7 AT | ||
98 | __ | ||
99 | !!BUGS | ||
100 | |||
101 | |||
102 | The calling process should zero the password as soon as | ||
103 | possible to avoid leaving the cleartext password visible in | ||
104 | the process's address space. | ||
105 | ---- |