~ubuntu-branches/ubuntu/raring/shadow/raring-proposed

« back to all changes in this revision

Viewing changes to lib/prototypes.h

  • Committer: Bazaar Package Importer
  • Author(s): Kees Cook
  • Date: 2009-05-05 09:45:21 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20090505094521-wpk2wn3q7957tlah
Tags: 1:4.1.3.1-1ubuntu1
* Merge from debian unstable, remaining changes:
  - Ubuntu specific:
    + debian/login.defs: use SHA512 by default for password crypt routine.
  - debian/patches/stdout-encrypted-password.patch: chpasswd can report
    password hashes on stdout (debian bug 505640).
  - debian/login.pam: Enable SELinux support (debian bug 527106).
  - debian/securetty.linux: support Freescale MX-series (debian bug 527095).
* Add debian/patches/300_lastlog_failure: fixed upstream (debian bug 524873).
* Drop debian/patches/593_omit_lastchange_field_if_clock_is_misset: fixed
  upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
 
2
 * Copyright (c) 1990 - 1994, Julianne Frances Haugh
 
3
 * Copyright (c) 1996 - 2000, Marek Michałkiewicz
 
4
 * Copyright (c) 2003 - 2006, Tomasz Kłoczko
 
5
 * Copyright (c) 2007 - 2009, Nicolas François
 
6
 * All rights reserved.
 
7
 *
 
8
 * Redistribution and use in source and binary forms, with or without
 
9
 * modification, are permitted provided that the following conditions
 
10
 * are met:
 
11
 * 1. Redistributions of source code must retain the above copyright
 
12
 *    notice, this list of conditions and the following disclaimer.
 
13
 * 2. Redistributions in binary form must reproduce the above copyright
 
14
 *    notice, this list of conditions and the following disclaimer in the
 
15
 *    documentation and/or other materials provided with the distribution.
 
16
 * 3. The name of the copyright holders or contributors may not be used to
 
17
 *    endorse or promote products derived from this software without
 
18
 *    specific prior written permission.
 
19
 *
 
20
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 
21
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 
22
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
 
23
 * PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT
 
24
 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 
25
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 
26
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 
27
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 
28
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 
29
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 
30
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
31
 */
 
32
 
 
33
/*
2
34
 * prototypes.h
3
35
 *
4
36
 * prototypes of libmisc functions, and private lib functions.
5
37
 *
6
 
 * $Id: prototypes.h 1902 2008-03-17 23:04:46Z nekral-guest $
 
38
 * $Id: prototypes.h 2650 2009-04-11 18:37:08Z nekral-guest $
7
39
 *
8
40
 */
9
41
 
16
48
#else
17
49
#include <utmp.h>
18
50
#endif
 
51
#include <sys/types.h>
19
52
#include <pwd.h>
20
53
#include <grp.h>
21
54
#include <shadow.h>
24
57
#include "defines.h"
25
58
#include "commonio.h"
26
59
 
 
60
extern char *Prog;
 
61
 
27
62
/* addgrps.c */
 
63
#if defined (HAVE_SETGROUPS) && ! defined (USE_PAM)
28
64
extern int add_groups (const char *);
29
 
extern void add_cons_grps (void);
 
65
#endif
30
66
 
31
67
/* age.c */
32
 
extern void agecheck (const struct passwd *, const struct spwd *);
 
68
extern void agecheck (const struct spwd *);
33
69
extern int expire (const struct passwd *, const struct spwd *);
34
70
extern int isexpired (const struct passwd *, const struct spwd *);
35
71
 
41
77
extern int chown_tree (const char *, uid_t, uid_t, gid_t, gid_t);
42
78
 
43
79
/* chowntty.c */
44
 
extern void chown_tty (const char *, const struct passwd *);
 
80
extern void chown_tty (const struct passwd *);
 
81
 
 
82
/* cleanup.c */
 
83
typedef void (*cleanup_function) (void *arg);
 
84
void add_cleanup (cleanup_function pcf, void *arg);
 
85
void del_cleanup (cleanup_function pcf);
 
86
void do_cleanups (void);
 
87
 
 
88
/* cleanup_group.c */
 
89
struct cleanup_info_mod {
 
90
        char *audit_msg;
 
91
        char *action;
 
92
        char *name;
 
93
};
 
94
void cleanup_report_add_group (void *group_name);
 
95
void cleanup_report_add_group_group (void *group_name);
 
96
#ifdef SHADOWGRP
 
97
void cleanup_report_add_group_gshadow (void *group_name);
 
98
#endif
 
99
void cleanup_report_del_group (void *group_name);
 
100
void cleanup_report_del_group_group (void *group_name);
 
101
#ifdef SHADOWGRP
 
102
void cleanup_report_del_group_gshadow (void *group_name);
 
103
#endif
 
104
void cleanup_report_mod_passwd (void *cleanup_info);
 
105
void cleanup_report_mod_group (void *cleanup_info);
 
106
void cleanup_report_mod_gshadow (void *cleanup_info);
 
107
void cleanup_unlock_group (void *unused);
 
108
#ifdef SHADOWGRP
 
109
void cleanup_unlock_gshadow (void *unused);
 
110
#endif
 
111
void cleanup_unlock_passwd (void *unused);
45
112
 
46
113
/* console.c */
47
 
extern int console (const char *);
 
114
extern bool console (const char *);
48
115
 
49
116
/* copydir.c */
50
117
extern int copy_tree (const char *src_root, const char *dst_root,
51
118
                      long int uid, long int gid);
52
119
extern int remove_tree (const char *root);
53
120
 
 
121
#ifdef WITH_SELINUX
 
122
extern int selinux_file_context (const char *dst_name);
 
123
#endif
 
124
 
54
125
/* encrypt.c */
55
126
extern char *pw_encrypt (const char *, const char *);
56
127
 
67
138
extern void change_field (char *, size_t, const char *);
68
139
extern int valid_field (const char *, const char *);
69
140
 
70
 
/* find_new_ids.c */
71
 
extern int find_new_uid (int sys_user, uid_t *uid, uid_t const *preferred_uid);
72
 
extern int find_new_gid (int sys_group, gid_t *gid, gid_t const *preferred_gid);
 
141
/* find_new_gid.c */
 
142
extern int find_new_gid (bool sys_group, gid_t *gid, gid_t const *preferred_gid);
 
143
 
 
144
/* find_new_uid.c */
 
145
extern int find_new_uid (bool sys_user, uid_t *uid, uid_t const *preferred_uid);
 
146
 
 
147
/* get_gid.c */
 
148
extern int get_gid (const char *gidstr, gid_t *gid);
 
149
 
 
150
/* getgr_nam_gid.c */
 
151
extern struct group *getgr_nam_gid (const char *grname);
73
152
 
74
153
/* getlong.c */
75
 
extern int getlong(const char *numstr, long int *result);
 
154
extern int getlong (const char *numstr, long int *result);
 
155
 
 
156
/* getrange */
 
157
extern int getrange (char *range,
 
158
                     unsigned long *min, bool *has_min,
 
159
                     unsigned long *max, bool *has_max);
 
160
 
 
161
/* get_uid.c */
 
162
extern int get_uid (const char *uidstr, uid_t *uid);
76
163
 
77
164
/* fputsx.c */
78
165
extern char *fgetsx (char *, int, FILE *);
88
175
extern struct group *__gr_dup (const struct group *grent);
89
176
 
90
177
/* hushed.c */
91
 
extern int hushed (const struct passwd *);
 
178
extern bool hushed (const struct passwd *pw);
92
179
 
93
180
/* audit_help.c */
94
181
#ifdef WITH_AUDIT
95
182
extern int audit_fd;
96
183
extern void audit_help_open (void);
 
184
/* Use AUDIT_NO_ID when a name is provided to audit_logger instead of an ID */
 
185
#define AUDIT_NO_ID     ((unsigned int) -1)
 
186
typedef enum {
 
187
        SHADOW_AUDIT_FAILURE = 0,
 
188
        SHADOW_AUDIT_SUCCESS = 1} shadow_audit_result;
97
189
extern void audit_logger (int type, const char *pgname, const char *op,
98
 
                          const char *name, unsigned int id, int result);
 
190
                          const char *name, unsigned int id,
 
191
                          shadow_audit_result result);
 
192
void audit_logger_message (const char *message, shadow_audit_result result);
99
193
#endif
100
194
 
101
195
/* limits.c */
 
196
#ifndef USE_PAM
102
197
extern void setup_limits (const struct passwd *);
 
198
#endif
103
199
 
104
200
/* list.c */
105
201
extern char **add_list (char **, const char *);
106
202
extern char **del_list (char **, const char *);
107
203
extern char **dup_list (char *const *);
108
 
extern int is_on_list (char *const *, const char *);
 
204
extern bool is_on_list (char *const *list, const char *member);
109
205
extern char **comma_to_list (const char *);
110
206
 
111
207
/* log.c */
130
226
extern struct passwd *get_my_pwent (void);
131
227
 
132
228
/* obscure.c */
 
229
#ifndef USE_PAM
133
230
extern int obscure (const char *, const char *, const struct passwd *);
 
231
#endif
134
232
 
135
233
/* pam_pass.c */
136
 
extern void do_pam_passwd (const char *, int, int);
 
234
#ifdef USE_PAM
 
235
extern void do_pam_passwd (const char *user, bool silent, bool change_expired);
 
236
#endif
137
237
 
138
238
/* port.c */
139
 
extern int isttytime (const char *, const char *, time_t);
 
239
extern bool isttytime (const char *, const char *, time_t);
140
240
 
141
241
/* pwd2spwd.c */
 
242
#ifndef USE_PAM
142
243
extern struct spwd *pwd_to_spwd (const struct passwd *);
 
244
#endif
143
245
 
144
246
/* pwdcheck.c */
 
247
#ifndef USE_PAM
145
248
extern void passwd_check (const char *, const char *, const char *);
 
249
#endif
146
250
 
147
251
/* pwd_init.c */
148
252
extern void pwd_init (void);
156
260
extern struct passwd *__pw_dup (const struct passwd *pwent);
157
261
 
158
262
/* rlogin.c */
159
 
extern int do_rlogin (const char *, char *, int, char *, int);
 
263
extern int do_rlogin (const char *remote_host, char *name, size_t namelen,
 
264
                      char *term, size_t termlen);
160
265
 
161
266
/* salt.c */
162
267
extern char *crypt_make_salt (const char *meth, void *arg);
163
268
 
164
269
/* setugid.c */
165
 
extern int setup_groups (const struct passwd *);
166
 
extern int change_uid (const struct passwd *);
167
 
extern int setup_uid_gid (const struct passwd *, int);
 
270
extern int setup_groups (const struct passwd *info);
 
271
extern int change_uid (const struct passwd *info);
 
272
#if (defined HAVE_INITGROUPS) && (! defined USE_PAM)
 
273
extern int setup_uid_gid (const struct passwd *info, bool is_console);
 
274
#else
 
275
extern int setup_uid_gid (const struct passwd *info);
 
276
#endif
168
277
 
169
278
/* setup.c */
170
279
extern void setup (struct passwd *);
178
287
/* sgetpwent.c */
179
288
extern struct passwd *sgetpwent (const char *buf);
180
289
 
 
290
/* sgetspent.c */
 
291
#ifndef HAVE_SGETSPENT
 
292
extern struct spwd *sgetspent (const char *string)
 
293
#endif
 
294
 
181
295
/* sgroupio.c */
182
296
extern void __sgr_del_entry (const struct commonio_entry *ent);
183
297
extern struct sgrp *__sgr_dup (const struct sgrp *sgent);
194
308
/* shell.c */
195
309
extern int shell (const char *, const char *, char *const *);
196
310
 
 
311
/* system.c */
 
312
extern int safe_system (const char *command,
 
313
                        const char *argv[],
 
314
                        const char *env[],
 
315
                        int ignore_stderr);
 
316
 
197
317
/* strtoday.c */
198
318
extern long strtoday (const char *);
199
319
 
201
321
extern int check_su_auth (const char *actual_id, const char *wanted_id);
202
322
 
203
323
/* sulog.c */
204
 
extern void sulog (const char *, int, const char *, const char *);
 
324
extern void sulog (const char *tty,
 
325
                   bool success,
 
326
                   const char *oldname,
 
327
                   const char *name);
205
328
 
206
329
/* sub.c */
207
330
extern void subsystem (const struct passwd *);
210
333
extern void ttytype (const char *);
211
334
 
212
335
/* tz.c */
 
336
#ifndef USE_PAM
213
337
extern char *tz (const char *);
 
338
#endif
214
339
 
215
340
/* ulimit.c */
216
 
extern void set_filesize_limit (int);
 
341
extern int set_filesize_limit (int blocks);
217
342
 
218
343
/* utmp.c */
219
 
extern void checkutmp (int);
220
 
extern void setutmp (const char *, const char *, const char *);
 
344
extern void checkutmp (bool picky);
 
345
extern int setutmp (const char *, const char *, const char *);
221
346
 
222
347
/* valid.c */
223
 
extern int valid (const char *, const struct passwd *);
 
348
extern bool valid (const char *, const struct passwd *);
224
349
 
225
350
/* xmalloc.c */
226
351
extern char *xmalloc (size_t);
238
363
extern struct spwd *xgetspnam(const char *);
239
364
 
240
365
/* yesno.c */
241
 
extern int yes_or_no (int read_only);
 
366
extern bool yes_or_no (bool read_only);
242
367
 
243
368
#endif                          /* _PROTOTYPES_H */