mcde: dtlogin on NetBSD - PAM handle per attempt with syslog, xrdb path of the target, tradcpp CONFIG_OS from the unquoted ident
SvcPam.c: a fresh PAM handle per authenticate, pam_end on failure, the PAM_USER
check was inverted, the conv default case did not advance, failures go to
authlog (follows xsrc/external/mit/xdm greeter/greet.c).
pkgsrc/Makefile: ac_cv_path_XRDB=${X11BASE}/bin/xrdb - the cross build baked the
Linux host's /usr/bin/xrdb into dtlogin; /var/dt/Xerrors on an installed system
said 'sh: /usr/bin/xrdb: not found', so Xresources never loaded and the CDE logo
showed (measured in a VM 2026-11-17).
tradcpp/config.h: CONFIG_OS is the ident as given; the stringify macro turned the
quoted -DCONFIG_OS_IDENT into an invalid macro name and wm/mcde stopped in
lib/tt (tradcpp: Invalid macro name "__NetBSD__", build/logs/userland-2026-11-16-atomic.log)
so the sysroot kept the Nov 15 MCDE. t0436 t0438 t0217
This commit is contained in:
1 parent
8a802568c1
commit
4ca2833c9c
3 files changed
+48
-7
No files matched your search
@@ -27,6 +27,7 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <syslog.h>
|
||||
#include <security/pam_appl.h>
|
||||
|
||||
/*
|
||||
@@ -47,14 +48,16 @@ static pam_handle_t *pamh;
|
||||
static int PamStart(const char *service_name, const char *user,
|
||||
const char *display_name)
|
||||
{
|
||||
int status;
|
||||
int status = PAM_SUCCESS;
|
||||
char *colon, *hostname;
|
||||
|
||||
if (pamh) {
|
||||
if (service_name)
|
||||
status = pam_set_item(pamh, PAM_SERVICE, service_name);
|
||||
|
||||
if (status != PAM_SUCCESS && user) pam_set_item(pamh, PAM_USER, user);
|
||||
/* the check was inverted: the user was only set after a failure */
|
||||
if (status == PAM_SUCCESS && user)
|
||||
status = pam_set_item(pamh, PAM_USER, user);
|
||||
}
|
||||
else {
|
||||
status = pam_start(service_name, user, &pam_conv, &pamh);
|
||||
@@ -105,12 +108,42 @@ int _DtSvcPamAuthenticate(const char *service_name, const char *user,
|
||||
|
||||
if (!user_passwd) return PAM_AUTH_ERR;
|
||||
|
||||
if ((status = PamStart(service_name, user, display_name)) != PAM_SUCCESS)
|
||||
/*
|
||||
* Follows NetBSD's xdm (greeter/greet.c): every login attempt starts a
|
||||
* fresh PAM handle and a failed one ends it. A handle kept across
|
||||
* attempts keeps PAM_AUTHTOK, and the stacks say try_first_pass, so the
|
||||
* first wrong or stale password would be checked again for every user.
|
||||
*/
|
||||
if (pamh) {
|
||||
(void) pam_end(pamh, PAM_SUCCESS);
|
||||
pamh = NULL;
|
||||
}
|
||||
|
||||
if ((status = PamStart(service_name, user, display_name)) != PAM_SUCCESS) {
|
||||
syslog(LOG_AUTHPRIV | LOG_NOTICE, "%s: pam_start(%s) for %s: error %d",
|
||||
service_name ? service_name : "dtlogin",
|
||||
service_name ? service_name : "(null)", user ? user : "(null)",
|
||||
status);
|
||||
return status;
|
||||
}
|
||||
|
||||
saved_user_passwd = (char *) user_passwd;
|
||||
|
||||
return pam_authenticate(pamh, PAM_DISALLOW_NULL_AUTHTOK);
|
||||
status = pam_authenticate(pamh, PAM_DISALLOW_NULL_AUTHTOK);
|
||||
saved_user_passwd = NULL;
|
||||
|
||||
if (status != PAM_SUCCESS) {
|
||||
/* the reason, in /var/log/authlog: nothing else says why a login fails */
|
||||
syslog(LOG_AUTHPRIV | LOG_NOTICE,
|
||||
"%s: pam_authenticate for %s on %s failed: %s (%d)",
|
||||
service_name ? service_name : "dtlogin", user ? user : "(null)",
|
||||
display_name ? display_name : "(null)",
|
||||
pam_strerror(pamh, status), status);
|
||||
(void) pam_end(pamh, status);
|
||||
pamh = NULL;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -235,6 +268,9 @@ static int login_conv(int num_msg, const struct pam_message **msg,
|
||||
break;
|
||||
|
||||
default:
|
||||
/* PAM_PROMPT_ECHO_ON etc.: no answer, but stay in step */
|
||||
m++;
|
||||
r++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,13 @@ TOOL_DEPENDS+= gettext-m4-[0-9]*:../../devel/gettext-m4
|
||||
GNU_CONFIGURE= yes
|
||||
GNU_CONFIGURE_PREFIX= ${PREFIX}/dt
|
||||
CONFIGURE_ENV+= ac_cv_path_KSH=${PREFIX}/bin/ksh93
|
||||
# configure.ac: AC_PATH_PROG(XRDB, xrdb) finds the BUILD host's xrdb in a cross
|
||||
# build (config.log: ac_cv_path_XRDB='/usr/bin/xrdb') and dtlogin, dtsession and
|
||||
# dtimsstart run that path on the target. NetBSD has no /usr/bin/xrdb, so
|
||||
# dtlogin could not load its Xresources file: the CDE logo, colours and fonts
|
||||
# showed instead of Makronix's (Konrad, 2026-11-17). The target's xrdb is the
|
||||
# X11 base's.
|
||||
CONFIGURE_ENV+= ac_cv_path_XRDB=${X11BASE}/bin/xrdb
|
||||
CONFIGURE_ENV+= GZIP=${GZIP_CMD:Q}
|
||||
CONFIGURE_ARGS+= MAKE=${MAKE_PROGRAM:Q}
|
||||
CONFIGURE_ARGS+= --with-x
|
||||
|
||||
@@ -60,9 +60,7 @@
|
||||
* have, and no display was started (measured 2026-11-15). The name arrives
|
||||
* unquoted, so stringify it.
|
||||
*/
|
||||
#define MCDE_OS_STRING_(x) #x
|
||||
#define MCDE_OS_STRING(x) MCDE_OS_STRING_(x)
|
||||
#define CONFIG_OS MCDE_OS_STRING(CONFIG_OS_IDENT)
|
||||
#define CONFIG_OS CONFIG_OS_IDENT
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_OS
|
||||
|
||||
Reference in new issue
Block a user