OSDN Git Service

cb6864857caece0c14c2a4d82e6e1b526246d556
[linuxjm/LDP_man-pages.git] / draft / man3 / getpw.3
1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
2 .\"
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
7 .\"
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
12 .\"
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein.  The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
19 .\" professionally.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" %%%LICENSE_END
24 .\"
25 .\" References consulted:
26 .\"     Linux libc source code
27 .\"     Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
28 .\"     386BSD man pages
29 .\" Modified Sat Jul 24 19:23:25 1993 by Rik Faith (faith@cs.unc.edu)
30 .\" Modified Mon May 27 21:37:47 1996 by Martin Schulze (joey@linux.de)
31 .\"
32 .\"*******************************************************************
33 .\"
34 .\" This file was generated with po4a. Translate the source file.
35 .\"
36 .\"*******************************************************************
37 .TH GETPW 3 2010\-10\-21 GNU "Linux Programmer's Manual"
38 .SH 名前
39 getpw \- パスワード行エントリを取得する
40 .SH 書式
41 .nf
42 \fB#define _GNU_SOURCE\fP             /* feature_test_macros(7) 参照 */
43 \fB#include <sys/types.h>\fP
44 \fB#include <pwd.h>\fP
45 .sp
46 \fBint getpw(uid_t \fP\fIuid\fP\fB, char *\fP\fIbuf\fP\fB);\fP
47 .fi
48 .SH 説明
49 \fBgetpw\fP()  関数は、バッファ \fIbuf\fP に指定ユーザ ID \fIuid\fP の パスワード行エントリを取得する。
50 返されるバッファは、以下の形式の行を含む。
51 .sp
52 .RS
53 \fBname:passwd:uid:gid:gecos:dir:shell\fP
54 .RE
55 .PP
56 \fIpasswd\fP 構造体は、\fI<pwd.h>\fP で以下のように定義されている:
57 .sp
58 .in +4n
59 .nf
60 struct passwd {
61     char   *pw_name;       /* ユーザ名 */
62     char   *pw_passwd;     /* ユーザのパスワード */
63     uid_t   pw_uid;        /* ユーザ ID */
64     gid_t   pw_gid;        /* グループ ID */
65     char   *pw_gecos;      /* ユーザ情報 */
66     char   *pw_dir;        /* ホームディレクトリ */
67     char   *pw_shell;      /* シェルプログラム */
68 };
69 .fi
70 .in
71 .PP
72 この構造体のフィールドの詳細は \fBpasswd\fP(5)  を参照のこと。
73 .SH 返り値
74 \fBgetpw\fP()  関数は、成功した場合 0 を返す; エラーが発生した場合 \-1 を返し、エラーを 示すために \fIerror\fP がセットされる。
75 .SH エラー
76 .TP 
77 \fBEINVAL\fP
78 \fIbuf\fP が NULL。
79 .TP 
80 \fBENOENT\fP
81 \fIuid\fP に対応するユーザがいない。
82 .TP 
83 \fBENOMEM\fP
84 \fIpasswd\fP 構造体に割り当てるメモリが十分なかった。
85 .SH ファイル
86 .TP 
87 \fI/etc/passwd\fP
88 パスワードデータベースファイル
89 .SH 準拠
90 SVr2
91 .SH バグ
92 \fBgetpw\fP()  関数は、与えられたバッファ \fIbuf\fP がオーバーフローするかもしれないので危険である。 この関数は
93 \fBgetpwuid\fP(3)  によって古いものとなった。
94 .SH 関連項目
95 \fBendpwent\fP(3), \fBfgetpwent\fP(3), \fBgetpwent\fP(3), \fBgetpwnam\fP(3),
96 \fBgetpwuid\fP(3), \fBputpwent\fP(3), \fBsetpwent\fP(3), \fBpasswd\fP(5)
97 .SH この文書について
98 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.52 の一部
99 である。プロジェクトの説明とバグ報告に関する情報は
100 http://www.kernel.org/doc/man\-pages/ に書かれている。