pwupd.h revision 20253
1/*- 2 * Copyright (c) 1996 by David L. Nugent <davidn@blaze.net.au>. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer as 10 * the first lines of this file unmodified. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 3. All advertising materials mentioning features or use of this software 15 * must display the following acknowledgement: 16 * This product includes software developed by David L. Nugent. 17 * 4. The name of the author may not be used to endorse or promote products 18 * derived from this software without specific prior written permission. 19 * 20 * THIS SOFTWARE IS PROVIDED BY THE DAVID L. NUGENT ``AS IS'' AND 21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 * ARE DISCLAIMED. IN NO EVENT SHALL DAVID L. NUGENT BE LIABLE 24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 * SUCH DAMAGE. 31 * 32 * $Id$ 33 */ 34 35#ifndef _PWUPD_H_ 36#define _PWUPD_H_ 37 38#include <sys/types.h> 39#include <pwd.h> 40#include <grp.h> 41 42#include <sys/cdefs.h> 43 44enum updtype 45{ 46 UPD_DELETE = -1, 47 UPD_CREATE = 0, 48 UPD_REPLACE = 1 49}; 50 51__BEGIN_DECLS 52int fileupdate __P((char const * fname, mode_t fm, char const * nline, char const * pfx, int pfxlen, int updmode)); 53__END_DECLS 54 55enum pwdfmttype 56{ 57 PWF_STANDARD, /* MASTER format but with '*' as password */ 58 PWF_PASSWD, /* V7 format */ 59 PWF_GROUP = PWF_PASSWD, 60 PWF_MASTER /* MASTER format with password */ 61}; 62 63__BEGIN_DECLS 64int addpwent __P((struct passwd * pwd)); 65int delpwent __P((struct passwd * pwd)); 66int chgpwent __P((char const * login, struct passwd * pwd)); 67int fmtpwent __P((char *buf, struct passwd * pwd)); 68int fmtpwentry __P((char *buf, struct passwd * pwd, int type)); 69int addgrent __P((struct group * grp)); 70int delgrent __P((struct group * grp)); 71int chggrent __P((char const * name, struct group * grp)); 72int fmtgrent __P((char *buf, struct group * grp)); 73int fmtgrentry __P((char *buf, struct group * grp, int type)); 74int editgroups __P((char *name, char **groups)); 75__END_DECLS 76 77#define MAXGROUPS 200 78#define MAXPWLINE 1024 79 80__BEGIN_DECLS 81void copymkdir __P((char const * dir, char const * skel, mode_t mode, uid_t uid, gid_t gid)); 82void rm_r __P((char const * dir, uid_t uid)); 83__END_DECLS 84 85#endif /* !_PWUPD_H */ 86