OSDN Git Service

Import translated manuals from JM CVS Repository.
[linuxjm/jm.git] / manual / LDP_man-pages / draft / man3 / getpass.3
1 .\" Copyright (c) 2000 Andries Brouwer (aeb@cwi.nl)
2 .\"
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.
7 .\"
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.
12 .\"
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.
17 .\"
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,
21 .\" USA.
22 .\"
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>
27 .\"
28 .TH GETPASS 3  2000-12-05 "Linux" "Linux Programmer's Manual"
29 .\"O .SH NAME
30 .\"O getpass \- get a password
31 .SH Ì¾Á°
32 getpass \- ¥Ñ¥¹¥ï¡¼¥É¤ò¼èÆÀ¤¹¤ë
33 .\"O .SH SYNOPSIS
34 .SH ½ñ¼°
35 .B #include <unistd.h>
36 .sp
37 .BI "char *getpass( const char *" prompt );
38 .\"O .SH DESCRIPTION
39 .SH ÀâÌÀ
40 .\"O This function is obsolete.
41 .\"O Do not use it.
42 ¤³¤Î´Ø¿ô¤Ï obsolete ¤Ç¤¢¤ë¡£ÍѤ¤¤Ê¤¤¤³¤È¡£
43 .PP
44 .\"O The
45 .\"O .BR getpass ()
46 .\"O function opens
47 .\"O .I /dev/tty
48 .\"O (the controlling terminal of the process), outputs the string
49 .\"O .IR prompt ,
50 .\"O turns off echoing, reads one line (the "password"),
51 .\"O restores the terminal state and closes
52 .\"O .I /dev/tty
53 .\"O again.
54 .BR getpass ()
55 ´Ø¿ô¤Ï
56 .I /dev/tty
57 (¥×¥í¥»¥¹¤ÎÀ©¸æüËö) ¤ò¥ª¡¼¥×¥ó¤·¡¢Ê¸»úÎó
58 .I prompt
59 ¤ò½ÐÎϤ¹¤ë¡£¤½¤·¤Æ echo ¤ò¥ª¥Õ¤Ë¤·¡¢°ì¹Ô (¡Ö¥Ñ¥¹¥ï¡¼¥É¡×)
60 ¤òÆɤ߹þ¤ß¡¢Ã¼Ëö¤Î¾õÂÖ¤ò¸µ¤ËÌᤷ¤Æ¡¢ºÆ¤Ó
61 .I /dev/tty
62 ¤ò¥¯¥í¡¼¥º¤¹¤ë¡£
63 .\"O .SH "RETURN VALUE"
64 .SH ÊÖ¤êÃÍ
65 .\"O The function
66 .\"O .BR getpass ()
67 .\"O returns a pointer to a static buffer containing (the first
68 .\"O .B PASS_MAX
69 .\"O bytes of) the password without the trailing
70 .\"O newline, terminated by a null byte (\(aq\\0\(aq).
71 .\"O This buffer may be overwritten by a following call.
72 .\"O On error, the terminal state is restored,
73 .\"O .I errno
74 .\"O is set appropriately, and NULL is returned.
75 .BR getpass ()
76 ´Ø¿ô¤ÏÆþÎϤµ¤ì¤¿¥Ñ¥¹¥ï¡¼¥É
77 (¤ÎºÇ½é¤Î
78 .B PASS_MAX
79 ¥Ð¥¤¥È¤Þ¤Ç) ¤¬½ñ¤­¤³¤Þ¤ì¤¿¡¢
80 ¥¹¥¿¥Æ¥£¥Ã¥¯¤Ê¥Ð¥Ã¥Õ¥¡¡¼¤Ø¤Î¥Ý¥¤¥ó¥¿¡¼¤òÊÖ¤¹¡£
81 ËöÈø¤Î²þ¹Ô¤Ï´Þ¤Þ¤ì¤Ê¤¤¡£¤³¤Îʸ»úÎó¤Ï NULL ¥Ð¥¤¥È (\(aq\\0\(aq) ¤Ç½ªÃ¼¤µ¤ì¤ë¡£
82 ¤³¤Î¥Ð¥Ã¥Õ¥¡¡¼¤Ï¡¢°Ê¹ß¤Î´Ø¿ô¥³¡¼¥ë¤Ç¾å½ñ¤­¤µ¤ì¤ë¤«¤â¤·¤ì¤Ê¤¤¡£
83 ¥¨¥é¡¼¤¬µ¯¤³¤ë¤È¡¢Ã¼Ëö¤Î¾õÂÖ¤òÉü¸µ¤·¡¢
84 .I errno
85 ¤òŬÀÚ¤ÊÃͤËÀßÄꤷ¤Æ¡¢NULL ¤òÊÖ¤¹¡£
86 .\"O .SH ERRORS
87 .SH ¥¨¥é¡¼
88 .\"O The function may fail if
89 ¤³¤Î´Ø¿ô¤Ï°Ê²¼¤Î¤è¤¦¤Ê¾ì¹ç¤Ë¼ºÇÔ¤·¤¦¤ë¡£
90 .TP
91 .B ENXIO
92 .\"O The process does not have a controlling terminal.
93 ¥×¥í¥»¥¹¤¬À©¸æüËö¤ò»ý¤Ã¤Æ¤¤¤Ê¤¤¡£
94 .\"O .SH FILES
95 .SH ¥Õ¥¡¥¤¥ë
96 .I /dev/tty
97 .\"O .\" .SH HISTORY
98 .\" .SH ÍúÎò
99 .\"O .\" A
100 .\"O .\" .BR getpass ()
101 .\"O .\" function appeared in Version 7 AT&T UNIX.
102 .\" .BR getpass ()
103 .\" ´Ø¿ô¤Ï Version 7 AT&T UNIX ¤ÇÅо줷¤¿¡£
104 .\"O .SH "CONFORMING TO"
105 .SH ½àµò
106 .\"O Present in SUSv2, but marked LEGACY.
107 .\"O Removed in POSIX.1-2001.
108 SUSv2 ¤Ë¤Ï¸ºß¤¹¤ë¤¬¡¢²áµî¤Î̾»Ä (LEGACY) ¤È°ÌÃÖÉÕ¤±¤é¤ì¤Æ¤¤¤ë¡£
109 POSIX.1-2001 ¤Çºï½ü¤µ¤ì¤¿¡£
110 .\"O .SH NOTES
111 .SH Ãí°Õ
112 .\"O For libc4 and libc5, the prompt is not written to
113 .\"O .I /dev/tty
114 .\"O but to
115 .\"O .IR stderr .
116 .\"O Moreover, if
117 .\"O .I /dev/tty
118 .\"O cannot be opened, the password is read from
119 .\"O .IR stdin .
120 .\"O The static buffer has length 128 so that only the first 127
121 .\"O bytes of the password are returned.
122 .\"O While reading the password, signal generation
123 .\"O .RB ( SIGINT ,
124 .\"O .BR SIGQUIT ,
125 .\"O .BR SIGSTOP ,
126 .\"O .BR SIGTSTOP )
127 .\"O is disabled and the corresponding characters
128 .\"O (usually control-C, control-\e, control-Z and control-Y)
129 .\"O are transmitted as part of the password.
130 .\"O Since libc 5.4.19 also line editing is disabled, so that also
131 .\"O backspace and the like will be seen as part of the password.
132 libc4 ¤È libc5 ¤Ç¤Ï¡¢
133 .I prompt
134 ¤Ï
135 .I /dev/tty
136 ¤Ë¤Ç¤Ï¤Ê¤¯
137 .I stderr
138 ¤Ë½ÐÎϤµ¤ì¤¿¡£¤µ¤é¤Ë¡¢
139 .I /dev/tty
140 ¤¬¥ª¡¼¥×¥ó¤Ç¤­¤Ê¤¤¾ì¹ç¤Ï¡¢¥Ñ¥¹¥ï¡¼¥É¤Ï
141 .I stdin
142 ¤«¤éÆɤ߹þ¤Þ¤ì¤¿¡£
143 ¥¹¥¿¥Æ¥£¥Ã¥¯¤Ê¥Ð¥Ã¥Õ¥¡¡¼¤ÎŤµ¤Ï 128 ¥Ð¥¤¥È¤À¤Ã¤¿¤Î¤Ç¡¢
144 ¥Ñ¥¹¥ï¡¼¥É¤ÎºÇ½é¤Î 127 Ê¸»ú¤À¤±¤¬ÊÖ¤µ¤ì¤¿¡£
145 ¥Ñ¥¹¥ï¡¼¥É¤òÆɤó¤Ç¤¤¤ëÅÓÃæ¤Ë¤Ï¡¢¥·¥°¥Ê¥ë¤Îȯ¹Ô
146 .RB ( SIGINT ,
147 .BR SIGQUIT ,
148 .BR SIGSTOP ,
149 .BR SIGTSTOP )
150 ¤Ï̵¸ú¤Ë¤µ¤ì¡¢
151 ¤½¤ì¤¾¤ì¤ËÂбþ¤¹¤ëʸ»ú (Ä̾ï¤Ï Ctrl-C, Ctrl-\e, Ctrl-Z, Ctrl-Y)
152 ¤Ï¤½¤Î¤Þ¤Þ¥Ñ¥¹¥ï¡¼¥É¤Î°ìÉô¤È¤·¤ÆÅϤµ¤ì¤¿¡£
153 libc 5.4.19 ¤«¤é¤Ï¹ÔÊÔ½¸¤¬Ìµ¸ú¤Ë¤µ¤ì¡¢
154 ¤·¤¿¤¬¤Ã¤Æ¥Ð¥Ã¥¯¥¹¥Ú¡¼¥¹¤Ê¤É¤â¥Ñ¥¹¥ï¡¼¥É¤Î°ìÉô¤È¤ß¤Ê¤µ¤ì¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¡£
155 .PP
156 .\"O For glibc2, if
157 .\"O .I /dev/tty
158 .\"O cannot be opened, the prompt is written to
159 .\"O .I stderr
160 .\"O and the password is read from
161 .\"O .IR stdin .
162 .\"O There is no limit on the length of the password.
163 .\"O Line editing is not disabled.
164 glibc2 ¤Ç¤Ï¡¢
165 .I /dev/tty
166 ¤¬¥ª¡¼¥×¥ó¤Ç¤­¤Ê¤¤¾ì¹ç¤Ï
167 .I prompt
168 ¤Ï
169 .I stderr
170 ¤Ë½ñ¤­½Ð¤µ¤ì¡¢¥Ñ¥¹¥ï¡¼¥É¤Ï
171 .I stdin
172 ¤«¤éÆɤ߹þ¤Þ¤ì¤¿¡£
173 ¥Ñ¥¹¥ï¡¼¥É¤ÎŤµ¤Ë¤ÏÀ©¸Â¤Ï¤Ê¤¯¡¢
174 ¹ÔÊÔ½¸¤â̵¸ú¤Ë¤Ï¤µ¤ì¤Ê¤«¤Ã¤¿¡£
175 .PP
176 .\"O According to the SUSv2, the value of
177 .\"O .B PASS_MAX
178 .\"O must be defined in
179 .\"O .I <limits.h>
180 .\"O in case it is smaller than 8, and can in any case be obtained using
181 .\"O .IR sysconf(_SC_PASS_MAX) .
182 .\"O However, POSIX.2 withdraws the constants
183 .\"O .B PASS_MAX
184 .\"O and
185 .\"O .BR _SC_PASS_MAX ,
186 .\"O and the function
187 .\"O .BR getpass ().
188 .\"O Libc4 and libc5 have never supported
189 .\"O .B PASS_MAX
190 .\"O or
191 .\"O .BR _SC_PASS_MAX .
192 .\"O Glibc2 accepts
193 .\"O .B _SC_PASS_MAX
194 .\"O and returns
195 .\"O .B BUFSIZ
196 .\"O (e.g., 8192).
197 SUSv2 ¤Ë¤è¤ì¤Ð¡¢
198 .B PASS_MAX
199 ¤ÎÃͤ¬ 8 °Ê²¼¤Î¾ì¹ç¤Ï¡¢¤³¤ÎÃͤÏ
200 .I <limits.h>
201 ¤ÇÄêµÁ¤µ¤ì¤Æ¤¤¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
202 ¤¤¤º¤ì¤Î¾ì¹ç¤Ç¤â¤³¤ÎÃͤÏ
203 .I sysconf(_SC_PASS_MAX)
204 ¤Ë¤è¤Ã¤Æ¼èÆÀ¤Ç¤­¤ë¡£
205 ¤·¤«¤·¡¢POSIX.2 ¤ÏÄê¿ô
206 .BR PASS_MAX ,
207 .B _SC_PASS_MAX
208 ¤È´Ø¿ô
209 .BR getpass ()
210 ¤ò¼è¤ê²¼¤²¤¿¡£
211 libc4 ¤È libc5 ¤Ç¤Ï¡¢
212 .B PASS_MAX
213 ¤È
214 .B _SC_PASS_MAX
215 ¤Ï°ìÅ٤⥵¥Ý¡¼¥È¤µ¤ì¤¿¤³¤È¤Ï¤Ê¤¤¡£
216 glibc2 ¤Ï
217 .B _SC_PASS_MAX
218 ¤ò¼õÉÕ¤±¡¢
219 .B BUFSIZE
220 (Î㤨¤Ð 8192) ¤òÊÖ¤¹¡£
221 .\"O .SH BUGS
222 .SH ¥Ð¥°
223 .\"O The calling process should zero the password as soon as possible to avoid
224 .\"O leaving the cleartext password visible in the process's address space.
225 ¤³¤Î´Ø¿ô¤ò¸Æ¤Ó½Ð¤·¤¿¥×¥í¥»¥¹¤Ï¡¢
226 ¤Ç¤­¤ë¸Â¤êÁ᤯¤½¤Î¥Ñ¥¹¥ï¡¼¥É¤ò¾Ãµî (¥¼¥í¥¯¥ê¥¢) ¤·¡¢
227 ¥¯¥ê¥¢¥Æ¥­¥¹¥È¤Î¥Ñ¥¹¥ï¡¼¥É¤¬
228 ¤½¤Î¥×¥í¥»¥¹¤Î¥¢¥É¥ì¥¹¶õ´Ö¤Ç¸«¤¨¤Ê¤¤¤è¤¦¤Ë¤¹¤Ù¤­¤Ç¤¢¤ë¡£
229 .\"O .SH "SEE ALSO"
230 .SH ´ØÏ¢¹àÌÜ
231 .BR crypt (3)