1 .\" Copyright (c) 2003 Andries Brouwer (aeb@cwi.nl) and
2 .\" Walter Harms (walter.harms@informatik.uni-oldenburg.de)
4 .\" Distributed under GPL
6 .\" Japanese Version Copyright (c) 2004 Yuichi SATO
7 .\" all rights reserved.
8 .\" Translated 2004-08-20, Yuichi SATO <ysato444@yahoo.co.jp>
10 .TH GETSPNAM 3 2010-02-25 "GNU" "Linux Programmer's Manual"
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 パスワードファイルのエントリを取得する
20 .\"O /* General shadow password file API */
21 /* 一般的な shadow パスワードファイル API */
23 .B #include <shadow.h>
25 .BI "struct spwd *getspnam(const char *" name );
27 .B struct spwd *getspent(void);
29 .B void setspent(void);
31 .B void endspent(void);
33 .BI "struct spwd *fgetspent(FILE *" fp );
35 .BI "struct spwd *sgetspent(const char *" s );
37 .BI "int putspent(struct spwd *" p ", FILE *" fp );
41 .B int ulckpwdf(void);
43 .\"O /* GNU extension */
46 .B #include <shadow.h>
48 .BI "int getspent_r(struct spwd *" spbuf ,
50 .BI " char *" buf ", size_t " buflen ", struct spwd **" spbufp );
52 .BI "int getspnam_r(const char *" name ", struct spwd *" spbuf ,
54 .BI " char *" buf ", size_t " buflen ", struct spwd **" spbufp );
56 .BI "int fgetspent_r(FILE *" fp ", struct spwd *" spbuf ,
58 .BI " char *" buf ", size_t " buflen ", struct spwd **" spbufp );
60 .BI "int sgetspent_r(const char *" s ", struct spwd *" spbuf ,
62 .BI " char *" buf ", size_t " buflen ", struct spwd **" spbufp );
66 .\"O Feature Test Macro Requirements for glibc (see
67 .\"O .BR feature_test_macros (7)):
69 .RB ( feature_test_macros (7)
79 _BSD_SOURCE || _SVID_SOURCE
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 ,
96 .\"O readable only by root.
97 Julianne Frances Haugh は shadow パスワード・スイートを実装した。
98 これは暗号化されたパスワードを、root のみが読むことができる
99 shadow パスワード・データベース (例えば、
100 ローカルの shadow パスワードファイル
105 .\"O The functions described below resemble those for
106 .\"O the traditional password database
108 .\"O .BR getpwnam (3)
110 .\"O .BR getpwent (3)).
111 以下で説明する関数は、伝統的なパスワード・データベースに対する
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)
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 .\" パスワードの関数についてのページから参照されるどこかにはっきりと
133 .\" この shadow パスワードの設定は
134 .\" PAM (pluggable authentication modules) で取り替えることができる。
135 .\" 現在のところ、どの情報源を使用するかは
136 .\" .I /etc/nsswitch.conf
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
148 にマッチする shadow パスワード・データベースのエントリを
149 要素毎に分解し、各要素を格納した構造体へのポインタを返す。
153 .\"O function returns a pointer to the next entry in the shadow password
156 関数は shadow パスワード・データベースにおける次のエントリへのポインタを返す。
157 .\"O The position in the input stream is initialized by
158 .\"O .BR setspent ().
162 .\"O When done reading, the program may call
164 .\"O so that resources can be deallocated.
168 .\"O .\" some systems require a call of setspent() before the first getspent()
169 .\"O .\" glibc does not
170 .\" 最初に getspent() を呼び出す前に、
171 .\" setspent() を呼び出さなければならないシステムもある。
175 .\"O .BR fgetspent ()
176 .\"O function is similar to
178 .\"O but uses the supplied stream instead of the one implicitly opened by
179 .\"O .BR setspent ().
185 で暗黙のうちにオープンされるストリームではなく、与えられたストリームを使う。
188 .\"O .BR sgetspent ()
189 .\"O function parses the supplied string
202 .\"O function writes the contents of the supplied struct
205 .\"O as a text line in the shadow password file format to the stream
211 の内容を shadow パスワードファイル形式のテキスト行でストリーム
214 .\"O String entries with value NULL and numerical entries with value \-1
215 .\"O are written as an empty string.
217 値が NULL の文字列エントリと値が \-1 の数値エントリが
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).
227 関数は、 shadow パスワード・データベースを
228 多重同時アクセスから守るためのものである。
231 失敗した場合 (15 秒以内にロックが取得できなかった場合) は \-1 を返す。
234 .\"O function releases the lock again.
237 .\"O Note that there is no protection against direct access of the shadow
239 .\"O Only programs that use
241 .\"O will notice the lock.
242 shadow パスワードファイルへの直接アクセスから
245 を使うプログラムだけがロックを通知できる。
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 を構成していた関数であり、
254 .\" SUN には sgetspent() がない。
255 .\"O .SS "Reentrant versions"
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 パスワードファイルに対してリエントラント版がある。
262 .\"O .BR getspnam_r ()
263 .\"O function is like
265 .\"O but stores the retrieved shadow password structure in the space pointed to by
270 と似ているが、取得した shadow パスワード構造体を
273 .\"O This shadow password structure contains pointers to strings, and these strings
274 .\"O are stored in the buffer
278 shadow パスワード構造体は文字列群へのポインタを含み、
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
288 には (成功した場合は) 結果へのポインタが格納され、
289 (エントリが見つからなかった場合またはエラーが起こった場合は)
293 .\"O .BR getspent_r (),
294 .\"O .BR fgetspent_r (),
296 .\"O .BR sgetspent_r ()
297 .\"O are similarly analogous to their nonreentrant counterparts.
302 はそれぞれリエントラントでないバージョンと同様の機能を持つ。
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 でないシステムにもこれらと同じ名前の関数があるが、
309 .\" SUN には sgetspent_r() がない。
312 .\"O The shadow password structure is defined in \fI<shadow.h>\fP as follows:
313 shadow パスワード構造体は \fI<shadow.h>\fP で以下のように定義されている:
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; /* パスワードが期限切れになる前に
339 long sp_inact; /* パスワードが期限切れになってから
341 long sp_expire; /* アカウントが無効になる日付
342 (1970-01-01 00:00:00 +0000 (UTC)) からの日数) */
343 unsigned long sp_flag; /* 予約フィールド */
347 .\"O .SH "RETURN VALUE"
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 を返す。
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 引き続いてこれらの関数を呼び出した場合に上書きされる可能性がある。
363 .\"O The reentrant functions return zero on success.
364 リエントラント版の関数は、成功した場合に 0 を返す。
365 .\"O In case of error, an error number is returned.
371 .\"O Supplied buffer is too small.
377 .\"O local shadow password database file
378 ローカルの shadow パスワード・データベースファイル
384 .\"O The include file
386 .\"O defines the constant
388 .\"O to the pathname of the shadow password file.
394 これは shadow パスワードファイルのパス名である。
395 .\"O .SH "CONFORMING TO"
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 には記載されていない。しかしながら、多くの他のシステムでも