]> git.saurik.com Git - apple/system_cmds.git/blame - chpass.tproj/chpass.h
system_cmds-880.100.5.tar.gz
[apple/system_cmds.git] / chpass.tproj / chpass.h
CommitLineData
1815bff5 1/*
cf37c299 2 * Copyright (c) 1999-2016 Apple Inc. All rights reserved.
1815bff5
A
3 *
4 * @APPLE_LICENSE_HEADER_START@
cf37c299 5 *
34d340d7
A
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
cf37c299 12 *
1815bff5
A
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
34d340d7
A
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
cf37c299 20 *
1815bff5
A
21 * @APPLE_LICENSE_HEADER_END@
22 */
23/*
24 * Copyright (c) 1988, 1993, 1994
34d340d7
A
25 * The Regents of the University of California. All rights reserved.
26 * Copyright (c) 2002 Networks Associates Technology, Inc.
27 * All rights reserved.
28 *
29 * Portions of this software were developed for the FreeBSD Project by
30 * ThinkSec AS and NAI Labs, the Security Research Division of Network
31 * Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035
32 * ("CBOSS"), as part of the DARPA CHATS research program.
1815bff5
A
33 *
34 * Redistribution and use in source and binary forms, with or without
35 * modification, are permitted provided that the following conditions
36 * are met:
37 * 1. Redistributions of source code must retain the above copyright
38 * notice, this list of conditions and the following disclaimer.
39 * 2. Redistributions in binary form must reproduce the above copyright
40 * notice, this list of conditions and the following disclaimer in the
41 * documentation and/or other materials provided with the distribution.
42 * 3. All advertising materials mentioning features or use of this software
43 * must display the following acknowledgement:
34d340d7
A
44 * This product includes software developed by the University of
45 * California, Berkeley and its contributors.
1815bff5
A
46 * 4. Neither the name of the University nor the names of its contributors
47 * may be used to endorse or promote products derived from this software
48 * without specific prior written permission.
49 *
50 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
51 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
52 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
53 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
54 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
55 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
56 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
57 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
58 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
59 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
60 * SUCH DAMAGE.
61 *
34d340d7
A
62 * @(#)chpass.h 8.4 (Berkeley) 4/2/94
63 * $FreeBSD: src/usr.bin/chpass/chpass.h,v 1.7 2004/01/18 21:46:39 charnier Exp $
1815bff5
A
64 */
65
34d340d7
A
66#ifdef OPEN_DIRECTORY
67#include "open_directory.h"
2fc1e207 68
34d340d7
A
69extern char* progname;
70extern CFStringRef DSPath;
71#endif /* OPEN_DIRECTORY */
c3a08f59 72
1815bff5
A
73struct passwd;
74
75typedef struct _entry {
34d340d7
A
76 const char *prompt;
77#ifdef OPEN_DIRECTORY
c3a08f59 78 void (*display)();
34d340d7
A
79#endif
80 int (*func)(char *, struct passwd *, struct _entry *);
81 int restricted;
82 size_t len;
83#if OPEN_DIRECTORY
84 char *except;
ef8ad44b 85 const CFStringRef *attrName;
34d340d7 86#else /* OPEN_DIRECTORY */
1815bff5 87 char *except, *save;
34d340d7 88#endif /* OPEN_DIRECTORY */
1815bff5
A
89} ENTRY;
90
91/* Field numbers. */
92#define E_BPHONE 8
93#define E_HPHONE 9
94#define E_LOCATE 10
95#define E_NAME 7
34d340d7
A
96#define E_OTHER 11
97#define E_SHELL 13
1815bff5
A
98
99extern ENTRY list[];
34d340d7
A
100extern int master_mode;
101
102#ifdef OPEN_DIRECTORY
103/* edit.c */
104void display_time(CFDictionaryRef, CFStringRef, const char*, FILE *);
105void display_string(CFDictionaryRef, CFStringRef, const char*, FILE *);
106CFDictionaryRef edit(const char *tfn, CFDictionaryRef pw);
107
108/* util.c */
109int cfprintf(FILE* file, const char* format, ...);
110int editfile(const char* tfn);
111#endif /* OPEN_DIRECTORY */
1815bff5 112
34d340d7
A
113int atot(char *, time_t *);
114#ifndef OPEN_DIRECTORY
115struct passwd *edit(const char *, struct passwd *);
116#endif /* OPEN_DIRECTORY */
117int ok_shell(char *);
118char *dup_shell(char *);
119int p_change(char *, struct passwd *, ENTRY *);
120int p_class(char *, struct passwd *, ENTRY *);
121int p_expire(char *, struct passwd *, ENTRY *);
122int p_gecos(char *, struct passwd *, ENTRY *);
123int p_gid(char *, struct passwd *, ENTRY *);
124int p_hdir(char *, struct passwd *, ENTRY *);
125int p_login(char *, struct passwd *, ENTRY *);
126int p_passwd(char *, struct passwd *, ENTRY *);
127int p_shell(char *, struct passwd *, ENTRY *);
128int p_uid(char *, struct passwd *, ENTRY *);
129#ifdef OPEN_DIRECTORY
130int p_uuid(char *, struct passwd *, ENTRY *);
131#endif /* OPEN_DIRECTORY */
132char *ttoa(time_t);