1 .\" Copyright (c) 2000 Andries Brouwer (aeb@cwi.nl)
3 .\" This is free documentation; you can redistribute it and/or
4 .\" modify it under the terms of the GNU General Public License as
5 .\" published by the Free Software Foundation; either version 2 of
6 .\" the License, or (at your option) any later version.
8 .\" The GNU General Public License's references to "object code"
9 .\" and "executables" are to be interpreted as the output of any
10 .\" document formatting or typesetting system, including
11 .\" intermediate and printed output.
13 .\" This manual is distributed in the hope that it will be useful,
14 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
15 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 .\" GNU General Public License for more details.
18 .\" You should have received a copy of the GNU General Public
19 .\" License along with this manual; if not, write to the Free
20 .\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
23 .\" Japanese Version Copyright (c) 1997 Hiroaki Nagoya
24 .\" all rights reserved.
25 .\" Translated Mon Sep 21 20:47:50 JST 1998 by Hiroaki Nagoya <nagoya@is.titech.ac.jp>
26 .\" Updated&Modified Fri 9 Feb 2001 by NAKANO Takeo <nakano@apm.seikei.ac.jp>
28 .TH GETPASS 3 2010-09-20 "Linux" "Linux Programmer's Manual"
30 .\"O getpass \- get a password
35 .B #include <unistd.h>
37 .BI "char *getpass( const char *" prompt );
40 .\"O Feature Test Macro Requirements for glibc (see
41 .\"O .BR feature_test_macros (7)):
43 .RB ( feature_test_macros (7)
52 .\"O Since glibc 2.2.2:
56 (_XOPEN_SOURCE\ >=\ 500 ||
57 _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED) &&
58 !(_POSIX_C_SOURCE\ >=\ 200112L || _XOPEN_SOURCE\ >=\ 600)
61 .\"O Before glibc 2.2.2: none
68 .\"O This function is obsolete.
70 この関数は obsolete である。用いないこと。
76 .\"O (the controlling terminal of the process), outputs the string
78 .\"O turns off echoing, reads one line (the "password"),
79 .\"O restores the terminal state and closes
85 (プロセスの制御端末) をオープンし、文字列
87 を出力する。そして echo をオフにし、一行 (「パスワード」)
91 .\"O .SH "RETURN VALUE"
95 .\"O returns a pointer to a static buffer containing (the first
97 .\"O bytes of) the password without the trailing
98 .\"O newline, terminated by a null byte (\(aq\\0\(aq).
99 .\"O This buffer may be overwritten by a following call.
100 .\"O On error, the terminal state is restored,
102 .\"O is set appropriately, and NULL is returned.
108 スタティックなバッファーへのポインターを返す。
109 末尾の改行は含まれない。この文字列は NULL バイト (\(aq\\0\(aq) で終端される。
110 このバッファーは、以降の関数コールで上書きされるかもしれない。
116 .\"O The function may fail if
120 .\"O The process does not have a controlling terminal.
128 .\"O .\" .BR getpass ()
129 .\"O .\" function appeared in Version 7 AT&T UNIX.
131 .\" 関数は Version 7 AT&T UNIX で登場した。
132 .\"O .SH "CONFORMING TO"
134 .\"O Present in SUSv2, but marked LEGACY.
135 .\"O Removed in POSIX.1-2001.
136 SUSv2 には存在するが、過去の名残 (LEGACY) と位置付けられている。
140 .\"O For libc4 and libc5, the prompt is not written to
146 .\"O cannot be opened, the password is read from
148 .\"O The static buffer has length 128 so that only the first 127
149 .\"O bytes of the password are returned.
150 .\"O While reading the password, signal generation
155 .\"O is disabled and the corresponding characters
156 .\"O (usually control-C, control-\e, control-Z and control-Y)
157 .\"O are transmitted as part of the password.
158 .\"O Since libc 5.4.19 also line editing is disabled, so that also
159 .\"O backspace and the like will be seen as part of the password.
171 スタティックなバッファーの長さは 128 バイトだったので、
172 パスワードの最初の 127 文字だけが返された。
173 パスワードを読んでいる途中には、シグナルの発行
179 それぞれに対応する文字 (通常は Ctrl-C, Ctrl-\e, Ctrl-Z, Ctrl-Y)
180 はそのままパスワードの一部として渡された。
181 libc 5.4.19 からは行編集が無効にされ、
182 したがってバックスペースなどもパスワードの一部とみなされるようになった。
186 .\"O cannot be opened, the prompt is written to
188 .\"O and the password is read from
190 .\"O There is no limit on the length of the password.
191 .\"O Line editing is not disabled.
204 .\"O According to the SUSv2, the value of
206 .\"O must be defined in
208 .\"O in case it is smaller than 8, and can in any case be obtained using
209 .\"O .IR sysconf(_SC_PASS_MAX) .
210 .\"O However, POSIX.2 withdraws the constants
213 .\"O .BR _SC_PASS_MAX ,
214 .\"O and the function
216 .\"O Libc4 and libc5 have never supported
219 .\"O .BR _SC_PASS_MAX .
231 .I sysconf(_SC_PASS_MAX)
251 .\"O The calling process should zero the password as soon as possible to avoid
252 .\"O leaving the cleartext password visible in the process's address space.
254 できる限り早くそのパスワードを消去 (ゼロクリア) し、
256 そのプロセスのアドレス空間で見えないようにすべきである。