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: apollo.c /main/4 1995/10/27 16:11:14 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 /************************************<+>*************************************
31 ****************************************************************************
35 ** Project: HP Visual User Environment (DT)
37 ** Description: Dtlogin user setup routines for Domain/OS 10.4
39 ** These routines set up the user's state before starting
43 ** (c) Copyright 1987, 1988, 1989 by Hewlett-Packard Company
46 ** Conditional compiles:
48 ** __apollo Domain OS only
50 ****************************************************************************
51 ************************************<+>*************************************/
54 #include <stdio.h> /* just so file isn't empty */
58 /***************************************************************************
62 ***************************************************************************/
66 #include <apollo/base.h>
67 #include <apollo/error.h>
69 #include "apollo/passwd.h" /* copy of <apollo/sys/passwd.h> */
70 #include "apollo/login.h" /* copy of <apollo/sys/login.h> */
76 #define SCMPN(a, b) strncmp(a, b, sizeof(a))
77 #define SCPYN(a, b) strncpy(a, b, sizeof(a))
78 #define eq(a,b) !strcmp(a,b)
80 #define NMAX strlen(name)
81 #define HMAX strlen(host)
83 #define STRING(str) (str), (short) strlen(str)
84 #define STRNULL(s, l) ((s)[(l)] = '\0')
85 #define ISTRING(str) (str), (int) strlen(str)
89 /***************************************************************************
91 * External declarations
93 ***************************************************************************/
96 /***************************************************************************
98 * Procedure declarations
100 ***************************************************************************/
105 /***************************************************************************
109 ***************************************************************************/
114 /***************************************************************************
118 ***************************************************************************/
123 /***************************************************************************
127 * set up user environment
128 ***************************************************************************/
131 DoLogin( char *user, char *passwd, char *host )
134 login_$opt_set_t opts;
136 error_$string_t subsystem, module, error;
137 short sslen, modlen, errlen;
140 Debug("DoLogin(): for %s\n", user);
141 login_$set_host(host, strlen(host));
143 opts = login_$no_prompt_name_sm |
144 login_$no_prompt_pass_sm |
148 Debug("DoLogin(): before calling login_$chk_login()\n");
149 if ((!login_$chk_login(opts, STRING(user), STRING(passwd),
150 (login_$open_log_p) NULL, STRING(""),
152 && (status.all != status_$ok)) {
154 Debug("DoLogin(): login_$chk_login() failed\n");
155 error_$get_text(status, subsystem, &sslen, module, &modlen,
157 STRNULL(error, errlen);
158 STRNULL(module, modlen);
159 STRNULL(subsystem, sslen);
160 sprintf(buf,ReadCatalog(MC_LOG_SET,MC_LOG_DOMAIN,MC_DEF_LOG_DOMAIN),
161 error, subsystem, module);
164 bzero (passwd, strlen(passwd));
169 Debug("DoLogin(): login_$chk_login() succeeded\n");
174 bzero (passwd, strlen(passwd));