1 --- XFree86-3.3.2/xc/programs/xdm/greeter/verify.c.nopam Tue May 27 02:22:28 1997
2 +++ XFree86-3.3.2/xc/programs/xdm/greeter/verify.c Tue Mar 3 17:15:17 1998
8 +# include <security/pam_appl.h>
12 #if defined(SHADOWSUITE) && defined(linux)
26 +static char *PAM_password;
28 +static int PAM_conv (int num_msg,
29 + const struct pam_message **msg,
30 + struct pam_response **resp,
31 + void *appdata_ptr) {
33 + struct pam_response *reply = NULL;
35 + reply = malloc(sizeof(struct pam_response));
36 + if (!reply) return PAM_CONV_ERR;
37 + #define COPY_STRING(s) (s) ? strdup(s) : NULL
39 + for (replies = 0; replies < num_msg; replies++) {
40 + switch (msg[replies]->msg_style) {
41 + case PAM_PROMPT_ECHO_OFF:
42 + /* wants password */
43 + reply[replies].resp_retcode = PAM_SUCCESS;
44 + reply[replies].resp = COPY_STRING(PAM_password);
47 + /* ignore the informational mesage */
49 + case PAM_PROMPT_ECHO_ON:
50 + /* user name given to PAM already */
53 + /* unknown or PAM_ERROR_MSG */
55 + return PAM_CONV_ERR;
62 +static struct pam_conv PAM_conversation = {
69 Verify (d, greet, verify)
80 Debug ("Verify %s ...\n", greet->name);
81 p = getpwnam (greet->name);
84 user_pass = p->pw_passwd;
89 sp = getspnam(greet->name);
92 } /* else: null passwd okay */
95 + #define PAM_BAIL if (pam_error != PAM_SUCCESS) { \
96 + pam_end(pamh, 0); return 0; \
98 + PAM_password = greet->password;
99 + pam_error = pam_start("xdm", p->pw_name, &PAM_conversation, &pamh);
101 + pam_error = pam_set_item(pamh, PAM_TTY, d->name);
103 + pam_error = pam_authenticate(pamh, 0);
105 + pam_error = pam_acct_mgmt(pamh, 0);
106 + /* really should do password changing, but it doesn't fit well */
108 + pam_error = pam_setcred(pamh, 0);
110 + /* unfortunately, it's not clear at the moment how to do session
111 + * management; it's possible, since xdm hangs around, but I don't
112 + * see yet how to tear the sessions down.
114 + pam_end(pamh, PAM_SUCCESS);
115 +#endif /* USE_PAM */
116 Debug ("verify succeeded\n");
117 bzero(user_pass, strlen(user_pass)); /* in case shadow password */
118 /* The password is passed to StartClient() for use by user-based
119 --- XFree86-3.3.2/xc/programs/xdm/Imakefile.nopam Tue Mar 3 17:15:13 1998
120 +++ XFree86-3.3.2/xc/programs/xdm/Imakefile Wed Mar 4 10:14:36 1998
122 * but not all NetBSD/Alpha systems have shared libraries, and
123 * it can't be shared on those which do not.
126 +/* Don't use this with PAM
127 #ifndef SharedLibXdmGreet
128 #define SharedLibXdmGreet \
129 ((defined(AlphaArchitecture) && \
132 #define BuildBoth (defined(LinuxArchitecture) && !SharedLibXdmGreet && !UseElfFormat)
136 +/* this is a hack */
138 #ifndef LinuxShadowSuite
139 #define LinuxShadowSuite NO
147 +#ifdef SharedLibXdmGreet
148 +#undef SharedLibXdmGreet
152 XDMAUTH_DEFINES = -DHASXDMAUTH
153 XDMAUTHOBJS = xdmauth.o
156 INCLUDES = $(KRB5_INCLUDE)
157 DEPLIBS = $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB) $(DEPXAUTHLIB) $(DEPXDMCPLIB)
158 -LOCAL_LIBRARIES = $(XMULIB) $(XTOOLLIB) $(XLIB) $(XAUTHLIB) $(XDMCPLIB) $(RPCLIB) $(DLLIBRARY) $(CRYPT_LIBRARIES)
159 +LOCAL_LIBRARIES = $(XMULIB) $(XTOOLLIB) $(XLIB) $(XAUTHLIB) $(XDMCPLIB) $(RPCLIB) -lpam -ldl $(CRYPT_LIBRARIES)
161 SRCS1 = auth.c daemon.c server.c dpylist.c dm.c error.c file.c \
162 netaddr.c reset.c resource.c protodpy.c policy.c \
164 OSMAJORVERSION = OSMajorVersion
165 OSMINORVERSION = OSMinorVersion
166 CONN_DEFINES = $(CONNECTION_FLAGS)
167 + EXTRA_DEFINES = -DUSE_PAM
168 DEFINES = -DBINDIR=\"$(BINDIR)\" -DXDMDIR=\"$(XDMDIR)\" \
170 $(XDMAUTH_DEFINES) $(RPC_DEFINES) $(KRB5_DEFINES) \