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 2000-12-05 "Linux" "Linux Programmer's Manual"
30 .\"O getpass \- get a password
32 getpass \- ¥Ñ¥¹¥ï¡¼¥É¤ò¼èÆÀ¤¹¤ë
35 .B #include <unistd.h>
37 .BI "char *getpass( const char *" prompt );
40 .\"O This function is obsolete.
42 ¤³¤Î´Ø¿ô¤Ï obsolete ¤Ç¤¢¤ë¡£ÍѤ¤¤Ê¤¤¤³¤È¡£
48 .\"O (the controlling terminal of the process), outputs the string
50 .\"O turns off echoing, reads one line (the "password"),
51 .\"O restores the terminal state and closes
57 (¥×¥í¥»¥¹¤ÎÀ©¸æüËö) ¤ò¥ª¡¼¥×¥ó¤·¡¢Ê¸»úÎó
59 ¤ò½ÐÎϤ¹¤ë¡£¤½¤·¤Æ echo ¤ò¥ª¥Õ¤Ë¤·¡¢°ì¹Ô (¡Ö¥Ñ¥¹¥ï¡¼¥É¡×)
60 ¤òÆɤ߹þ¤ß¡¢Ã¼Ëö¤Î¾õÂÖ¤ò¸µ¤ËÌᤷ¤Æ¡¢ºÆ¤Ó
63 .\"O .SH "RETURN VALUE"
67 .\"O returns a pointer to a static buffer containing (the first
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,
74 .\"O is set appropriately, and NULL is returned.
76 ´Ø¿ô¤ÏÆþÎϤµ¤ì¤¿¥Ñ¥¹¥ï¡¼¥É
79 ¥Ð¥¤¥È¤Þ¤Ç) ¤¬½ñ¤¤³¤Þ¤ì¤¿¡¢
80 ¥¹¥¿¥Æ¥£¥Ã¥¯¤Ê¥Ð¥Ã¥Õ¥¡¡¼¤Ø¤Î¥Ý¥¤¥ó¥¿¡¼¤òÊÖ¤¹¡£
81 ËöÈø¤Î²þ¹Ô¤Ï´Þ¤Þ¤ì¤Ê¤¤¡£¤³¤Îʸ»úÎó¤Ï NULL ¥Ð¥¤¥È (\(aq\\0\(aq) ¤Ç½ªÃ¼¤µ¤ì¤ë¡£
82 ¤³¤Î¥Ð¥Ã¥Õ¥¡¡¼¤Ï¡¢°Ê¹ß¤Î´Ø¿ô¥³¡¼¥ë¤Ç¾å½ñ¤¤µ¤ì¤ë¤«¤â¤·¤ì¤Ê¤¤¡£
83 ¥¨¥é¡¼¤¬µ¯¤³¤ë¤È¡¢Ã¼Ëö¤Î¾õÂÖ¤òÉü¸µ¤·¡¢
85 ¤òŬÀÚ¤ÊÃͤËÀßÄꤷ¤Æ¡¢NULL ¤òÊÖ¤¹¡£
88 .\"O The function may fail if
89 ¤³¤Î´Ø¿ô¤Ï°Ê²¼¤Î¤è¤¦¤Ê¾ì¹ç¤Ë¼ºÇÔ¤·¤¦¤ë¡£
92 .\"O The process does not have a controlling terminal.
93 ¥×¥í¥»¥¹¤¬À©¸æüËö¤ò»ý¤Ã¤Æ¤¤¤Ê¤¤¡£
100 .\"O .\" .BR getpass ()
101 .\"O .\" function appeared in Version 7 AT&T UNIX.
103 .\" ´Ø¿ô¤Ï Version 7 AT&T UNIX ¤ÇÅо줷¤¿¡£
104 .\"O .SH "CONFORMING TO"
106 .\"O Present in SUSv2, but marked LEGACY.
107 .\"O Removed in POSIX.1-2001.
108 SUSv2 ¤Ë¤Ï¸ºß¤¹¤ë¤¬¡¢²áµî¤Î̾»Ä (LEGACY) ¤È°ÌÃÖÉÕ¤±¤é¤ì¤Æ¤¤¤ë¡£
109 POSIX.1-2001 ¤Çºï½ü¤µ¤ì¤¿¡£
112 .\"O For libc4 and libc5, the prompt is not written to
118 .\"O cannot be opened, the password is read from
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
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 ¤Ç¤Ï¡¢
138 ¤Ë½ÐÎϤµ¤ì¤¿¡£¤µ¤é¤Ë¡¢
140 ¤¬¥ª¡¼¥×¥ó¤Ç¤¤Ê¤¤¾ì¹ç¤Ï¡¢¥Ñ¥¹¥ï¡¼¥É¤Ï
143 ¥¹¥¿¥Æ¥£¥Ã¥¯¤Ê¥Ð¥Ã¥Õ¥¡¡¼¤ÎŤµ¤Ï 128 ¥Ð¥¤¥È¤À¤Ã¤¿¤Î¤Ç¡¢
144 ¥Ñ¥¹¥ï¡¼¥É¤ÎºÇ½é¤Î 127 ʸ»ú¤À¤±¤¬ÊÖ¤µ¤ì¤¿¡£
145 ¥Ñ¥¹¥ï¡¼¥É¤òÆɤó¤Ç¤¤¤ëÅÓÃæ¤Ë¤Ï¡¢¥·¥°¥Ê¥ë¤Îȯ¹Ô
151 ¤½¤ì¤¾¤ì¤ËÂбþ¤¹¤ëʸ»ú (Ä̾ï¤Ï Ctrl-C, Ctrl-\e, Ctrl-Z, Ctrl-Y)
152 ¤Ï¤½¤Î¤Þ¤Þ¥Ñ¥¹¥ï¡¼¥É¤Î°ìÉô¤È¤·¤ÆÅϤµ¤ì¤¿¡£
153 libc 5.4.19 ¤«¤é¤Ï¹ÔÊÔ½¸¤¬Ìµ¸ú¤Ë¤µ¤ì¡¢
154 ¤·¤¿¤¬¤Ã¤Æ¥Ð¥Ã¥¯¥¹¥Ú¡¼¥¹¤Ê¤É¤â¥Ñ¥¹¥ï¡¼¥É¤Î°ìÉô¤È¤ß¤Ê¤µ¤ì¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¡£
158 .\"O cannot be opened, the prompt is written to
160 .\"O and the password is read from
162 .\"O There is no limit on the length of the password.
163 .\"O Line editing is not disabled.
166 ¤¬¥ª¡¼¥×¥ó¤Ç¤¤Ê¤¤¾ì¹ç¤Ï
170 ¤Ë½ñ¤½Ð¤µ¤ì¡¢¥Ñ¥¹¥ï¡¼¥É¤Ï
173 ¥Ñ¥¹¥ï¡¼¥É¤ÎŤµ¤Ë¤ÏÀ©¸Â¤Ï¤Ê¤¯¡¢
174 ¹ÔÊÔ½¸¤â̵¸ú¤Ë¤Ï¤µ¤ì¤Ê¤«¤Ã¤¿¡£
176 .\"O According to the SUSv2, the value of
178 .\"O must be defined in
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
185 .\"O .BR _SC_PASS_MAX ,
186 .\"O and the function
188 .\"O Libc4 and libc5 have never supported
191 .\"O .BR _SC_PASS_MAX .
199 ¤ÎÃͤ¬ 8 °Ê²¼¤Î¾ì¹ç¤Ï¡¢¤³¤ÎÃͤÏ
201 ¤ÇÄêµÁ¤µ¤ì¤Æ¤¤¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
202 ¤¤¤º¤ì¤Î¾ì¹ç¤Ç¤â¤³¤ÎÃͤÏ
203 .I sysconf(_SC_PASS_MAX)
205 ¤·¤«¤·¡¢POSIX.2 ¤ÏÄê¿ô
211 libc4 ¤È libc5 ¤Ç¤Ï¡¢
215 ¤Ï°ìÅ٤⥵¥Ý¡¼¥È¤µ¤ì¤¿¤³¤È¤Ï¤Ê¤¤¡£
220 (Î㤨¤Ð 8192) ¤òÊÖ¤¹¡£
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 ¤½¤Î¥×¥í¥»¥¹¤Î¥¢¥É¥ì¥¹¶õ´Ö¤Ç¸«¤¨¤Ê¤¤¤è¤¦¤Ë¤¹¤Ù¤¤Ç¤¢¤ë¡£