1 /* $XConsortium: apollo.c /main/4 1995/10/27 16:11:14 rswiston $ */
3 * (c) Copyright 1993, 1994 Hewlett-Packard Company *
4 * (c) Copyright 1993, 1994 International Business Machines Corp. *
5 * (c) Copyright 1993, 1994 Sun Microsystems, Inc. *
6 * (c) Copyright 1993, 1994 Novell, Inc. *
8 /************************************<+>*************************************
9 ****************************************************************************
13 ** Project: HP Visual User Environment (DT)
15 ** Description: Dtlogin user setup routines for Domain/OS 10.4
17 ** These routines set up the user's state before starting
21 ** (c) Copyright 1987, 1988, 1989 by Hewlett-Packard Company
24 ** Conditional compiles:
26 ** __apollo Domain OS only
28 ****************************************************************************
29 ************************************<+>*************************************/
32 #include <stdio.h> /* just so file isn't empty */
36 /***************************************************************************
40 ***************************************************************************/
44 #include <apollo/base.h>
45 #include <apollo/error.h>
47 #include "apollo/passwd.h" /* copy of <apollo/sys/passwd.h> */
48 #include "apollo/login.h" /* copy of <apollo/sys/login.h> */
54 #define SCMPN(a, b) strncmp(a, b, sizeof(a))
55 #define SCPYN(a, b) strncpy(a, b, sizeof(a))
56 #define eq(a,b) !strcmp(a,b)
58 #define NMAX strlen(name)
59 #define HMAX strlen(host)
61 #define STRING(str) (str), (short) strlen(str)
62 #define STRNULL(s, l) ((s)[(l)] = '\0')
63 #define ISTRING(str) (str), (int) strlen(str)
67 /***************************************************************************
69 * External declarations
71 ***************************************************************************/
74 /***************************************************************************
76 * Procedure declarations
78 ***************************************************************************/
83 /***************************************************************************
87 ***************************************************************************/
92 /***************************************************************************
96 ***************************************************************************/
101 /***************************************************************************
105 * set up user environment
106 ***************************************************************************/
109 DoLogin( char *user, char *passwd, char *host )
112 login_$opt_set_t opts;
114 error_$string_t subsystem, module, error;
115 short sslen, modlen, errlen;
118 Debug("DoLogin(): for %s\n", user);
119 login_$set_host(host, strlen(host));
121 opts = login_$no_prompt_name_sm |
122 login_$no_prompt_pass_sm |
126 Debug("DoLogin(): before calling login_$chk_login()\n");
127 if ((!login_$chk_login(opts, STRING(user), STRING(passwd),
128 (login_$open_log_p) NULL, STRING(""),
130 && (status.all != status_$ok)) {
132 Debug("DoLogin(): login_$chk_login() failed\n");
133 error_$get_text(status, subsystem, &sslen, module, &modlen,
135 STRNULL(error, errlen);
136 STRNULL(module, modlen);
137 STRNULL(subsystem, sslen);
138 sprintf(buf,ReadCatalog(MC_LOG_SET,MC_LOG_DOMAIN,MC_DEF_LOG_DOMAIN),
139 error, subsystem, module);
142 bzero (passwd, strlen(passwd));
147 Debug("DoLogin(): login_$chk_login() succeeded\n");
152 bzero (passwd, strlen(passwd));