From kde-bugs-dist Mon Jan 31 08:39:58 2000 From: jplatte () ptp ! e-technik ! uni-dortmund ! de Date: Mon, 31 Jan 2000 08:39:58 +0000 To: kde-bugs-dist Subject: Bug#2595: Kdm and PAM X-MARC-Message: https://marc.info/?l=kde-bugs-dist&m=94930859012390 Package: kdebase Version: 1.1.2 Hi! I wrote a small PAModule. This module adds all unknown users to /etc/passwd and /etc/shadow if username and password are ok (another server checks this). This works fine with /bin/login but not with kdm (kde 1.1.2). Kdm tries to find the user (which doesn't exist at this time) with getpwnam() without calling PAM before. So the module couldn't add the user to the password database. This small patch will fix this problem: diff -uNr kdebase-1.1.2.orig/kdm/verify.c kdebase-1.1.2/kdm/verify.c --- kdebase-1.1.2.orig/kdm/verify.c Wed Jan 26 17:59:07 2000 +++ kdebase-1.1.2/kdm/verify.c Wed Jan 26 17:50:46 2000 @@ -235,6 +235,7 @@ char *shell, *home; char **argv; +#ifndef USE_PAM Debug ("Verify %s ...\n", greet->name); p = getpwnam (greet->name); endpwent(); @@ -244,7 +245,6 @@ bzero(greet->password, strlen(greet->password)); return 0; } -#ifndef USE_PAM #ifdef USESHADOW sp = getspnam(greet->name); endspent(); @@ -293,7 +293,7 @@ } pamh = NULL; PAM_password = greet->password; - pam_error = pam_start(KDE_PAM, p->pw_name, &PAM_conversation, &pamh); + pam_error = pam_start(KDE_PAM, greet->name, &PAM_conversation, &pamh); PAM_BAIL; pam_error = pam_set_item(pamh, PAM_TTY, d->name); PAM_BAIL; @@ -309,6 +309,15 @@ be closed when the session is closed. */ bzero(greet->password, strlen(greet->password)); + Debug ("Verify %s ...\n", greet->name); + p = getpwnam (greet->name); + endpwent(); + + if (!p || strlen (greet->name) == 0) { + Debug ("getpwnam() failed.\n"); + bzero(greet->password, strlen(greet->password)); + return 0; + } #endif /* USE_PAM */ Debug ("verify succeeded\n"); Jörg -- Joerg Platte Hi! I'm a .signature virus! Copy me into your ~/.signature to help me spread! PGP Key: send mail with subject 'SEND PGP-KEY' PGP Key-ID: FD 4E 21 1D _ // ICQ : 17472145 \X/