1 | .\" $Id: al_acct_create.3,v 1.6 1998-07-16 13:00:58 danw Exp $ |
---|
2 | .\" |
---|
3 | .\" Copyright 1997 by the Massachusetts Institute of Technology. |
---|
4 | .\" |
---|
5 | .\" Permission to use, copy, modify, and distribute this |
---|
6 | .\" software and its documentation for any purpose and without |
---|
7 | .\" fee is hereby granted, provided that the above copyright |
---|
8 | .\" notice appear in all copies and that both that copyright |
---|
9 | .\" notice and this permission notice appear in supporting |
---|
10 | .\" documentation, and that the name of M.I.T. not be used in |
---|
11 | .\" advertising or publicity pertaining to distribution of the |
---|
12 | .\" software without specific, written prior permission. |
---|
13 | .\" M.I.T. makes no representations about the suitability of |
---|
14 | .\" this software for any purpose. It is provided "as is" |
---|
15 | .\" without express or implied warranty. |
---|
16 | .\" |
---|
17 | .TH AL_ACCT_CREATE 3 "18 September 1997" |
---|
18 | .SH NAME |
---|
19 | al_acct_create \- Set up a local account for a user |
---|
20 | .SH SYNOPSIS |
---|
21 | .nf |
---|
22 | .B #include <al.h> |
---|
23 | .PP |
---|
24 | .B |
---|
25 | int al_acct_create(const char *\fIusername\fP, const char *\fIcryptpw\fP, |
---|
26 | .B pid_t \fIsessionpid\fP, int \fIhavecred\fP, int \fItmphomedir\fP, |
---|
27 | .B int **\fIwarnings\fP) |
---|
28 | .PP |
---|
29 | .B cc file.c -lal -lhesiod |
---|
30 | .fi |
---|
31 | .SH DESCRIPTION |
---|
32 | This function ensures that local account information is set up for |
---|
33 | .IR username . |
---|
34 | After successful completion, the user will have information in the |
---|
35 | local passwd and group databases and will have a home directory |
---|
36 | accessible by the current process. Changes to local system databases |
---|
37 | are recorded in the sessions database (see sessions(5)) so that they |
---|
38 | may be reverted later by |
---|
39 | .I al_acct_revert |
---|
40 | or |
---|
41 | .IR al_acct_cleanup . |
---|
42 | .PP |
---|
43 | The meanings of the arguments to |
---|
44 | .I al_acct_create |
---|
45 | are as follows: |
---|
46 | .TP 15 |
---|
47 | .I username |
---|
48 | Gives the name of the user whose local account is to be created. |
---|
49 | .TP 15 |
---|
50 | .I cryptpw |
---|
51 | If an entry is added to the local passwd database, it will use the |
---|
52 | value of |
---|
53 | .I cryptpw |
---|
54 | as the encrypted passwd field if |
---|
55 | .I cryptpw |
---|
56 | is not NULL and if |
---|
57 | .I /etc/nocrack |
---|
58 | is not present. |
---|
59 | .TP 15 |
---|
60 | .I sessionpid |
---|
61 | Gives the pid of the login session (which should generally always be |
---|
62 | the current process pid) to be recorded in the sessions database. |
---|
63 | .TP 15 |
---|
64 | .I havecred |
---|
65 | Should be nonzero if the user has cached Kerberos credentials. If |
---|
66 | .I havecred |
---|
67 | is zero, |
---|
68 | .I al_acct_create |
---|
69 | does not attempt to get authorization to access the user's home |
---|
70 | directory. |
---|
71 | .TP 15 |
---|
72 | .I tmphomedir |
---|
73 | Specifies whether to create a temporary home directory if the user's |
---|
74 | home directory cannot be attached. |
---|
75 | .TP 15 |
---|
76 | .I warnings |
---|
77 | Points to a variable which may be set to an allocated array (which the |
---|
78 | caller must free) of warning codes giving a list of possible non-fatal |
---|
79 | error codes. The variable will otherwise be set to NULL. The caller |
---|
80 | may pass a NULL pointer if it does not want warning codes. |
---|
81 | .PP |
---|
82 | The caller may invoke |
---|
83 | .I al_acct_create |
---|
84 | multiple times with the same |
---|
85 | .I username |
---|
86 | and |
---|
87 | .IR sessionpid , |
---|
88 | e.g. once before credentials are acquired and once afterwards. |
---|
89 | Generally, |
---|
90 | .I tmphomedir |
---|
91 | should be set to false for all but the last invocation, or warning |
---|
92 | values may become confused. |
---|
93 | .SH RETURN VALUES |
---|
94 | .I al_acct_create |
---|
95 | may return the following values: |
---|
96 | .TP 15 |
---|
97 | .I AL_SUCCESS |
---|
98 | Account creation succeeded. |
---|
99 | .TP 15 |
---|
100 | .I AL_ENOUSER |
---|
101 | No local or Hesiod passwd entry is available for |
---|
102 | .IR username . |
---|
103 | .TP 15 |
---|
104 | .I AL_EPASSWD |
---|
105 | The user could not be added to the local passwd database. |
---|
106 | .TP 15 |
---|
107 | .I AL_ESESSION |
---|
108 | The user's session record could not be modified. |
---|
109 | .TP 15 |
---|
110 | .I AL_ENOMEM |
---|
111 | Memory was exhausted. |
---|
112 | .TP 15 |
---|
113 | .I AL_WARNINGS |
---|
114 | Account creation succeeded but some suboptimal condition occurred. |
---|
115 | If |
---|
116 | .I warnings |
---|
117 | is non-NULL, the variable it points to is set to an allocated array of |
---|
118 | warning codes terminated by |
---|
119 | .IR AL_SUCCESS . |
---|
120 | The caller must free this array. |
---|
121 | .SH WARNINGS |
---|
122 | Possible warning codes are: |
---|
123 | .TP 15 |
---|
124 | .I AL_WBADSESSION |
---|
125 | The user's session record was corrupt and treated as if it did not |
---|
126 | exist. |
---|
127 | .TP 15 |
---|
128 | .I AL_WGROUP |
---|
129 | The user could not be added to the group file. |
---|
130 | .TP 15 |
---|
131 | .I AL_WXTMPDIR |
---|
132 | The user has a temporary home directory from a currently existing |
---|
133 | login session. |
---|
134 | .TP 15 |
---|
135 | .I AL_WTMPDIR |
---|
136 | The user's home directory could not be attached; a temporary home |
---|
137 | directory was created instead. |
---|
138 | .TP 15 |
---|
139 | .I AL_WNOHOMEDIR |
---|
140 | The user's home directory could not be attached and a temporary home |
---|
141 | directory was not created. The user has no home directory. |
---|
142 | .TP 15 |
---|
143 | .I AL_WNOATTACH |
---|
144 | The user's home directory was not attached because |
---|
145 | .I /etc/noattach |
---|
146 | is present. |
---|
147 | .PP |
---|
148 | If the user has a local passwd entry with a home directory which is |
---|
149 | different from the user's Hesiod passwd entry, no home directory |
---|
150 | attach is attempted and no homedir-related warning codes can occur. |
---|
151 | Thus, the login application may assume that homedir-related warning |
---|
152 | codes refer to an Athena home directory, but the application must be |
---|
153 | handle possible errors when changing to the user's home directory. |
---|
154 | .SH SEE ALSO |
---|
155 | al_acct_revert(3), al_login_allowed(3), al_strerror(3), sessions(5) |
---|
156 | .SH AUTHOR |
---|
157 | Greg Hudson, MIT Information Systems |
---|
158 | .br |
---|
159 | Copyright 1997 by the Massachusetts Institute of Technology. |
---|