OSDN Git Service

d0b7a6b8bda0232ca9773cfecf299652ff3a8ce7
[linuxjm/LDP_man-pages.git] / draft / man3 / getspnam.3
1 .\" Copyright (c) 2003 Andries Brouwer (aeb@cwi.nl) and
2 .\" Walter Harms (walter.harms@informatik.uni-oldenburg.de)
3 .\"
4 .\" Distributed under GPL
5 .\"
6 .\" Japanese Version Copyright (c) 2004 Yuichi SATO
7 .\"         all rights reserved.
8 .\" Translated 2004-08-20, Yuichi SATO <ysato444@yahoo.co.jp>
9 .\"
10 .TH GETSPNAM 3  2010-02-25 "GNU" "Linux Programmer's Manual"
11 .\"O .SH NAME
12 .SH 名前
13 .\"O getspnam, getspnam_r, getspent, getspent_r, setspent, endspent,
14 .\"O fgetspent, fgetspent_r, sgetspent, sgetspent_r, putspent,
15 .\"O lckpwdf, ulckpwdf \- get shadow password file entry
16 getspnam, getspnam_r, getspent, getspent_r, setspent, endspent,fgetspent, fgetspent_r, sgetspent, sgetspent_r, putspent, lckpwdf, ulckpwdf \- shadow パスワードファイルのエントリを取得する
17 .\"O .SH SYNOPSIS
18 .SH 書式
19 .nf
20 .\"O /* General shadow password file API */
21 /* 一般的な shadow パスワードファイル API */
22 .br
23 .B #include <shadow.h>
24 .sp
25 .BI "struct spwd *getspnam(const char *" name );
26 .sp
27 .B struct spwd *getspent(void);
28 .sp
29 .B void setspent(void);
30 .sp
31 .B void endspent(void);
32 .sp
33 .BI "struct spwd *fgetspent(FILE *" fp );
34 .sp
35 .BI "struct spwd *sgetspent(const char *" s );
36 .sp
37 .BI "int putspent(struct spwd *" p ", FILE *" fp );
38 .sp
39 .B int lckpwdf(void);
40 .sp
41 .B int ulckpwdf(void);
42 .sp
43 .\"O /* GNU extension */
44 /* GNU 版における拡張 */
45 .br
46 .B #include <shadow.h>
47 .sp
48 .BI "int getspent_r(struct spwd *" spbuf ,
49 .br
50 .BI "        char *" buf ", size_t " buflen ", struct spwd **" spbufp );
51 .sp
52 .BI "int getspnam_r(const char *" name ", struct spwd *" spbuf ,
53 .br
54 .BI "        char *" buf ", size_t " buflen ", struct spwd **" spbufp );
55 .sp
56 .BI "int fgetspent_r(FILE *" fp ", struct spwd *" spbuf ,
57 .br
58 .BI "        char *" buf ", size_t " buflen ", struct spwd **" spbufp );
59 .sp
60 .BI "int sgetspent_r(const char *" s ", struct spwd *" spbuf ,
61 .br
62 .BI "        char *" buf ", size_t " buflen ", struct spwd **" spbufp );
63 .fi
64 .sp
65 .in -4n
66 .\"O Feature Test Macro Requirements for glibc (see
67 .\"O .BR feature_test_macros (7)):
68 glibc 向けの機能検査マクロの要件
69 .RB ( feature_test_macros (7)
70 参照):
71 .in
72 .sp
73 .ad l
74 .BR getspent_r (),
75 .BR getspnam_r (),
76 .BR fgetspent_r (),
77 .BR sgetspent_r ():
78 .RS 4
79 _BSD_SOURCE || _SVID_SOURCE
80 .RE
81 .ad b
82 .\"O .SH DESCRIPTION
83 .SH 説明
84 .\"O Long ago it was considered safe to have encrypted passwords openly
85 .\"O visible in the password file.
86 .\"O When computers got faster and people
87 .\"O got more security-conscious, this was no longer acceptable.
88 昔は暗号化されたパスワードをパスワードファイルに
89 見えるように公開しておいても安全だと考えられていた。
90 .\"O Julianne Frances Haugh implemented the shadow password suite
91 .\"O that keeps the encrypted passwords in
92 .\"O the shadow password database
93 .\"O (e.g., the local shadow password file
94 .\"O .IR /etc/shadow ,
95 .\"O NIS, and LDAP),
96 .\"O readable only by root.
97 Julianne Frances Haugh は shadow パスワード・スイートを実装した。
98 これは暗号化されたパスワードを、root のみが読むことができる
99 shadow パスワード・データベース (例えば、
100 ローカルの shadow パスワードファイル
101 .IR /etc/shadow ,
102 NIS, LDAP)
103 に保持する。
104 .LP
105 .\"O The functions described below resemble those for
106 .\"O the traditional password database
107 .\"O (e.g., see
108 .\"O .BR getpwnam (3)
109 .\"O and
110 .\"O .BR getpwent (3)).
111 以下で説明する関数は、伝統的なパスワード・データベースに対する
112 関数に似ている (例えば
113 .BR getpwnam (3)
114
115 .BR getpwent (3)
116 を参照)。
117 .\"O .\" FIXME I've commented out the following for the
118 .\"O .\" moment.  The relationship between PAM and nsswitch.conf needs
119 .\"O .\" to be clearly documented in one place, which is pointed to by
120 .\"O .\" the pages for the user, group, and shadow password functions.
121 .\"O .\" (Jul 2005, mtk)
122 .\"O .\"
123 .\"O .\" This shadow password setup has been superseded by PAM
124 .\"O .\" (pluggable authentication modules), and the file
125 .\"O .\" .I /etc/nsswitch.conf
126 .\"O .\" now describes the sources to be used.
127 .\" FIXME 以下を一時的にコメントアウトした。
128 .\" PAM と nsswitch.conf の関係については、ユーザ、グループ、shadow
129 .\" パスワードの関数についてのページから参照されるどこかにはっきりと
130 .\" 記載しておく必要がある。
131 .\" (Jul 2005, mtk)
132 .\"
133 .\" この shadow パスワードの設定は
134 .\" PAM (pluggable authentication modules) で取り替えることができる。
135 .\" 現在のところ、どの情報源を使用するかは
136 .\" .I /etc/nsswitch.conf
137 .\" ファイルに記述される。
138 .LP
139 .\"O The
140 .\"O .BR getspnam ()
141 .\"O function returns a pointer to a structure containing
142 .\"O the broken-out fields of the record in the shadow password database
143 .\"O that matches the username
144 .\"O .IR name .
145 .BR getspnam ()
146 関数は、ユーザ名
147 .I name
148 にマッチする shadow パスワード・データベースのエントリを
149 要素毎に分解し、各要素を格納した構造体へのポインタを返す。
150 .LP
151 .\"O The
152 .\"O .BR getspent ()
153 .\"O function returns a pointer to the next entry in the shadow password
154 .\"O database.
155 .BR getspent ()
156 関数は shadow パスワード・データベースにおける次のエントリへのポインタを返す。
157 .\"O The position in the input stream is initialized by
158 .\"O .BR setspent ().
159 入力ストリームにおける位置は、
160 .BR setspent ()
161 で初期化される。
162 .\"O When done reading, the program may call
163 .\"O .BR endspent ()
164 .\"O so that resources can be deallocated.
165 読み込みが終わった後に、
166 .BR endspent ()
167 を呼び出すと、リソースを解放できる。
168 .\"O .\" some systems require a call of setspent() before the first getspent()
169 .\"O .\" glibc does not
170 .\" 最初に getspent() を呼び出す前に、
171 .\" setspent() を呼び出さなければならないシステムもある。
172 .\" glibc ではその必要がない。
173 .LP
174 .\"O The
175 .\"O .BR fgetspent ()
176 .\"O function is similar to
177 .\"O .BR getspent ()
178 .\"O but uses the supplied stream instead of the one implicitly opened by
179 .\"O .BR setspent ().
180 .BR fgetspent ()
181 関数は
182 .BR getspent ()
183 に似ているが、
184 .BR setspent ()
185 で暗黙のうちにオープンされるストリームではなく、与えられたストリームを使う。
186 .LP
187 .\"O The
188 .\"O .BR sgetspent ()
189 .\"O function parses the supplied string
190 .\"O .I s
191 .\"O into a struct
192 .\"O .IR spwd .
193 .BR sgetspent ()
194 関数は与えられた文字列
195 .I s
196 を解析し struct
197 .I spwd
198 に格納する。
199 .LP
200 .\"O The
201 .\"O .BR putspent ()
202 .\"O function writes the contents of the supplied struct
203 .\"O .I spwd
204 .\"O .I *p
205 .\"O as a text line in the shadow password file format to the stream
206 .\"O .IR fp .
207 .BR putspent ()
208 関数は与えられた struct
209 .I spwd
210 .I *p
211 の内容を shadow パスワードファイル形式のテキスト行でストリーム
212 .I fp
213 に書き出す。
214 .\"O String entries with value NULL and numerical entries with value \-1
215 .\"O are written as an empty string.
216 空文字列として、
217 値が NULL の文字列エントリと値が \-1 の数値エントリが
218 書き出される。
219 .LP
220 .\"O The
221 .\"O .BR lckpwdf ()
222 .\"O function is intended to protect against multiple simultaneous accesses
223 .\"O of the shadow password database.
224 .\"O It tries to acquire a lock, and returns 0 on success,
225 .\"O or \-1 on failure (lock not obtained within 15 seconds).
226 .BR lckpwdf ()
227 関数は、 shadow パスワード・データベースを
228 多重同時アクセスから守るためのものである。
229 この関数はロックの獲得を試み、
230 成功した場合は 0 を返す。
231 失敗した場合 (15 秒以内にロックが取得できなかった場合) は \-1 を返す。
232 .\"O The
233 .\"O .BR ulckpwdf ()
234 .\"O function releases the lock again.
235 .BR ulckpwdf ()
236 関数はロックを再び解放する。
237 .\"O Note that there is no protection against direct access of the shadow
238 .\"O password file.
239 .\"O Only programs that use
240 .\"O .BR lckpwdf ()
241 .\"O will notice the lock.
242 shadow パスワードファイルへの直接アクセスから
243 保護する手段がない点に注意すること。
244 .BR lckpwdf ()
245 を使うプログラムだけがロックを通知できる。
246 .LP
247 .\"O These were the functions that formed the original shadow API.
248 .\"O They are widely available.
249 .\"O .\" Also in libc5
250 .\"O .\" SUN doesn't have sgetspent()
251 これらの関数はオリジナルの shadow API を構成していた関数であり、
252 いろいろなシステムで広く利用可能である。
253 .\" libc5 でも利用可能である。
254 .\" SUN には sgetspent() がない。
255 .\"O .SS "Reentrant versions"
256 .SS リエントラント版
257 .\"O Analogous to the reentrant functions for the password database, glibc
258 .\"O also has reentrant functions for the shadow password database.
259 パスワード・データベースに対するリエントラント版と同じように、
260 glibc には shadow パスワードファイルに対してリエントラント版がある。
261 .\"O The
262 .\"O .BR getspnam_r ()
263 .\"O function is like
264 .\"O .BR getspnam ()
265 .\"O but stores the retrieved shadow password structure in the space pointed to by
266 .\"O .IR spbuf .
267 .BR getspnam_r ()
268 関数は
269 .BR getspnam ()
270 と似ているが、取得した shadow パスワード構造体を
271 .I spbuf
272 が指す領域に格納する。
273 .\"O This shadow password structure contains pointers to strings, and these strings
274 .\"O are stored in the buffer
275 .\"O .I buf
276 .\"O of size
277 .\"O .IR buflen .
278 shadow パスワード構造体は文字列群へのポインタを含み、
279 これらの文字列群はサイズ
280 .I buflen
281 のバッファ
282 .I buf
283 に格納される。
284 .\"O A pointer to the result (in case of success) or NULL (in case no entry
285 .\"O was found or an error occurred) is stored in
286 .\"O .IR *spbufp .
287 .I *spbufp
288 には (成功した場合は) 結果へのポインタが格納され、
289 (エントリが見つからなかった場合またはエラーが起こった場合は)
290 NULL が格納される。
291 .LP
292 .\"O The functions
293 .\"O .BR getspent_r (),
294 .\"O .BR fgetspent_r (),
295 .\"O and
296 .\"O .BR sgetspent_r ()
297 .\"O are similarly analogous to their nonreentrant counterparts.
298 関数
299 .BR getspent_r (),
300 .BR fgetspent_r (),
301 .BR sgetspent_r ()
302 はそれぞれリエントラントでないバージョンと同様の機能を持つ。
303 .LP
304 .\"O Some non-glibc systems also have functions with these names,
305 .\"O often with different prototypes.
306 .\"O .\" SUN doesn't have sgetspent_r()
307 glibc でないシステムにもこれらと同じ名前の関数があるが、
308 プロトタイプが異なることも多い。
309 .\" SUN には sgetspent_r() がない。
310 .\"O .SS Structure
311 .SS 構造体
312 .\"O The shadow password structure is defined in \fI<shadow.h>\fP as follows:
313 shadow パスワード構造体は \fI<shadow.h>\fP で以下のように定義されている:
314 .sp
315 .in +4n
316 .nf
317 struct spwd {
318 .\"O     char *sp_namp;     /* Login name */
319 .\"O     char *sp_pwdp;     /* Encrypted password */
320 .\"O     long  sp_lstchg;   /* Date of last change (measured
321 .\"O                           in days since 1970-01-01 00:00:00 +0000 (UTC)) */
322 .\"O     long  sp_min;      /* Min # of days between changes */
323 .\"O     long  sp_max;      /* Max # of days between changes */
324 .\"O     long  sp_warn;     /* # of days before password expires
325 .\"O                           to warn user to change it */
326 .\"O     long  sp_inact;    /* # of days after password expires
327 .\"O                           until account is disabled */
328 .\"O     long  sp_expire;   /* Date when account expires (measured
329 .\"O                           in days since 1970-01-01 00:00:00 +0000 (UTC)) */
330 .\"O     unsigned long sp_flag;  /* Reserved */
331     char *sp_namp;     /* ログイン名 */
332     char *sp_pwdp;     /* 暗号化されたパスワード */
333     long  sp_lstchg;   /* 最終更新日
334                           (1970-01-01 00:00:00 +0000 (UTC)) からの日数) */
335     long  sp_min;      /* 変更が出来るようになるまでの最短日数 */
336     long  sp_max;      /* 変更をしなくてもよい最長日数 */
337     long  sp_warn;     /* パスワードが期限切れになる前に
338                           ユーザに変更の警告を出す日数 */
339     long  sp_inact;    /* パスワードが期限切れになってから
340                           アカウントが無効になるまでの日数 */
341     long  sp_expire;   /* アカウントが無効になる日付
342                           (1970-01-01 00:00:00 +0000 (UTC)) からの日数) */
343     unsigned long sp_flag;  /* 予約フィールド */
344 };
345 .fi
346 .in
347 .\"O .SH "RETURN VALUE"
348 .SH 返り値
349 .\"O The functions that return a pointer return NULL if no more entries
350 .\"O are available or if an error occurs during processing.
351 ポインタを返す関数は、これ以上エントリがない場合や
352 処理中にエラーが発生した場合 NULL を返す。
353 .\"O The functions which have \fIint\fP as the return value return 0 for
354 .\"O success and \-1 for failure.
355 \fIint\fP を返り値として持つ関数は、
356 成功した場合 0 を返し、失敗した場合 \-1 を返す。
357 .LP
358 .\"O For the nonreentrant functions, the return value may point to static area,
359 .\"O and may be overwritten by subsequent calls to these functions.
360 リエントラント版でない関数では、返り値が静的な領域を指しており、
361 引き続いてこれらの関数を呼び出した場合に上書きされる可能性がある。
362 .LP
363 .\"O The reentrant functions return zero on success.
364 リエントラント版の関数は、成功した場合に 0 を返す。
365 .\"O In case of error, an error number is returned.
366 エラーの場合は、エラー番号が返される。
367 .\"O .SH ERRORS
368 .SH エラー
369 .TP
370 .B ERANGE
371 .\"O Supplied buffer is too small.
372 与えられたバッファが小さすぎる。
373 .\"O .SH FILES
374 .SH ファイル
375 .TP
376 .I /etc/shadow
377 .\"O local shadow password database file
378 ローカルの shadow パスワード・データベースファイル
379 .TP
380 .I /etc/.pwd.lock
381 .\"O lock file
382 ロックファイル
383 .LP
384 .\"O The include file
385 .\"O .I <paths.h>
386 .\"O defines the constant
387 .\"O .B _PATH_SHADOW
388 .\"O to the pathname of the shadow password file.
389 インクルードファイル
390 .I <paths.h>
391 は定数
392 .B _PATH_SHADOW
393 を定義している。
394 これは shadow パスワードファイルのパス名である。
395 .\"O .SH "CONFORMING TO"
396 .SH 準拠
397 .\"O The shadow password database and its associated API are
398 .\"O not specified in POSIX.1-2001.
399 .\"O However, many other systems provide a similar API.
400 shadow パスワード・データベースと関連 API は POSIX.1-2001
401 には記載されていない。しかしながら、多くの他のシステムでも
402 同様の API が提供されている。
403 .\"O .SH "SEE ALSO"
404 .SH 関連項目
405 .BR getgrnam (3),
406 .BR getpwnam (3),
407 .BR getpwnam_r (3),
408 .BR shadow (5)