2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /* $XConsortium: login.h /main/3 1995/10/27 16:19:16 rswiston $ */
25 * (c) Copyright 1993, 1994 Hewlett-Packard Company *
26 * (c) Copyright 1993, 1994 International Business Machines Corp. *
27 * (c) Copyright 1993, 1994 Sun Microsystems, Inc. *
28 * (c) Copyright 1993, 1994 Novell, Inc. *
30 /* LOGIN.INS.C, /us/ins, rod, 12/09/88 */
33 12/21/88 gilbert Modifications for C++.
34 12/09/88 betsy add login_$logins_disabled
35 04/19/88 betsy cast values for login_$opt_set_t ( to be consistent )
36 03/30/88 betsy add login_$set_host
37 03/21/88 betsy add options login_$addut & login_$chown_tty
38 01/04/88 brian Fixed param decl of login_$chk_login
39 12/31/87 brian Converted to ANSII from /us/ins/login.ins.c/6
44 #define login_$err_shut 0x07020001 /*user wants to caller to shut down*/
45 #define login_$err_exit 0x07020002 /*user wants to caller to exit*/
46 #define login_$no_room 0x07020003 /*no room for rep at open */
47 #define login_$bad_passwd 0x07020004 /*passwd check failed */
48 #define login_$inv_acct 0x07020005 /* account expired */
49 #define login_$logins_disabled 0x07020006 /* logins disabled */
51 #define login_$log_stream_index 4 /* 4th stream in streams array is the open log */
54 typedef void *login_$ptr;
56 typedef short enum { login_$read, login_$update } login_$mode_t;
59 login_$log_events, /* log all events */
60 login_$log_inv_only, /* log only unsuccessful attempts to log in */
61 login_$no_passwd, /* don't require password (!) */
62 login_$no_setsid, /* implies no_setpm, but allows set of wd/nd */
63 login_$no_setpm, /* not done unless setsid successfully done */
64 login_$no_setwd, /* not done if setsid attempted and failed */
65 login_$fail_ret, /* return if failure logged */
66 login_$no_prompt_name, /* no prompt for name */
67 login_$no_prompt_pass, /* no prompt for password */
68 login_$preserve_sub, /* preserve subsystem */
69 login_$leave_log_open, /* leave log file open on return */
70 login_$addut, /* add utmp/wtmp/lastlog entry */
71 login_$chown_tty, /* chown the login device */
72 login_$extra14, /* pad to 32-bit set */
75 login_$extra17 /* just over the border */
78 typedef long login_$opt_set_t;
79 #define login_$log_events_sm ((login_$opt_set_t) (1 << (int) login_$log_events))
80 #define login_$log_inv_only_sm ((login_$opt_set_t) (1 << (int) login_$log_inv_only))
81 #define login_$no_passwd_sm ((login_$opt_set_t) (1 << (int) login_$no_passwd))
82 #define login_$no_setsid_sm ((login_$opt_set_t) (1 << (int) login_$no_setsid))
83 #define login_$no_setpm_sm ((login_$opt_set_t) (1 << (int) login_$no_setpm))
84 #define login_$no_setwd_sm ((login_$opt_set_t) (1 << (int) login_$no_setwd))
85 #define login_$fail_ret_sm ((login_$opt_set_t) (1 << (int) login_$fail_ret))
86 #define login_$no_prompt_name_sm ((login_$opt_set_t) (1 << (int) login_$no_prompt_name))
87 #define login_$no_prompt_pass_sm ((login_$opt_set_t) (1 << (int) login_$no_prompt_pass))
88 #define login_$preserve_sub_sm ((login_$opt_set_t) (1 << (int) login_$preserve_sub))
89 #define login_$leave_log_open_sm ((login_$opt_set_t) (1 << (int) login_$leave_log_open))
90 #define login_$addut_sm ((login_$opt_set_t) (1 << (int) login_$addut))
91 #define login_$chown_tty_sm ((login_$opt_set_t) (1 << (int) login_$chown_tty))
93 typedef char login_$string_t[256];
94 typedef ios_$id_t login_$streams_t[4];
96 typedef char (*login_$open_log_p)(
103 int (*help)(stream_$id_t & stream);
104 login_$open_log_p open_log;
105 /* A note to you: aug-87
106 These next two routines are here only for callers that cannot provide streams
107 for their i/o (i.e. the dm. It was just too hard, esp since he is 'going away'.)
108 To have them used, pass the number -2 as your first stream in login_$streams_t.
109 A bit of a hack, true, but as long as we all understand each other, it will work.
110 Login_$login promises NOT to ref these routines if you pass real streams. (Note
111 that the fillbuf stuff is gone (since changing home dir is no longer supported.)
114 stream_$id_t & stream,
120 char * fillbuf, /* pre-fill buffer with string */
124 stream_$id_t & stream,
131 /* Required for C++ V2.0 */
136 /* FULL_LOGIN --- performs the login function with prompting, implementing system policy,
137 setting wd, nd, pm_$sid_text, pm_$home_txt and default shell (unless
138 already set), prints /etc/dmmsg if exists. Supports 'shut, 'exit' and
139 'help' and all options EXCEPT login_$no_setsid. Takes optional strings
140 for pre-read user name [passwd]. */
143 login_$opt_set_t & opts,
144 login_$streams_t * streams, /* in, out, err, log_stream */
145 char * login_name, /* login string - iff login_$no_prompt_name */
147 char * pass, /* passwd string - iff login_$no_prompt_pass */
149 login_$proc_rec_t & ioprocs, /* procedure vectors */
150 char * log_file, /* used iff login_$log_events/inv in opts */
155 /* CHK_LOGIN --- performs the login function based on the strings passed in with no
156 prompting. DOES NOT fully implement system policy. i.e. does nothing
157 if passwd needs to be changed, but returns bad status if expired or
158 invalid accounts. Gives no error msgs. */
161 login_$opt_set_t & opts,
162 char * login_name, /* login string - iff login_$no_prompt_name */
164 char * pass, /* passwd string - iff login_$no_prompt_pass */
166 login_$open_log_p & open_log, /* used iff login_$log_events/inv in opts */
167 char * log_file, /* used iff login_$log_events/inv in opts */
168 short & log_flen, /* used iff login_$log_events/inv in opts */
169 ios_$id_t * log_stream, /* stream for open log file iff login_$leave_log_open */
173 /*-----------------------------------------------------------------------------
174 LOGIN_$SET_HOST - sets the host name to be used in the addut on a subsequent
175 login_$full_login or login_$chk_login call */
178 char * host_name, /* max len is 64 */
182 /* O P E N --- prepare to do login type stuff */
185 login_$mode_t & lmode,
190 /* S E T _ P P O -- set the PPO to operate on
191 if ppo length is zero, use currently logged in user's PPO
192 if set_ppo not call before chpass, ckpass or chhdir called, one
193 will automatically be done (for current user)
203 /* C K P A S S -- check password
204 checks the supplied password against that of the set PPO
214 /* C H P A S S --- change password in the registry */
223 /* C H H D I R --- change home directory in the registry */
232 /* E R R _ C O N T E X T --- file name that had problems */
242 /* C L O S E --- release all acquired resources */
243 /* NOTE --- call even if open FAILS! */