From owner-freebsd-bugs@FreeBSD.ORG Mon Apr 28 13:30:21 2003 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3CC2A37B401 for ; Mon, 28 Apr 2003 13:30:21 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1C9E143FB1 for ; Mon, 28 Apr 2003 13:30:14 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.9/8.12.9) with ESMTP id h3SKUDUp002037 for ; Mon, 28 Apr 2003 13:30:13 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.9/8.12.9/Submit) id h3SKUDpe002036; Mon, 28 Apr 2003 13:30:13 -0700 (PDT) Resent-Date: Mon, 28 Apr 2003 13:30:13 -0700 (PDT) Resent-Message-Id: <200304282030.h3SKUDpe002036@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Peter Grimshaw Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 40CAE37B401 for ; Mon, 28 Apr 2003 13:20:23 -0700 (PDT) Received: from tesseract.demon.co.uk (tesseract.demon.co.uk [194.222.237.220]) by mx1.FreeBSD.org (Postfix) with SMTP id C03C543FBD for ; Mon, 28 Apr 2003 13:20:20 -0700 (PDT) (envelope-from peter@tesseract.demon.co.uk) Received: (qmail 1269 invoked by uid 1000); 28 Apr 2003 20:18:09 -0000 Message-Id: <20030428201809.1268.qmail@tesseract.demon.co.uk> Date: 28 Apr 2003 20:18:09 -0000 From: Peter Grimshaw To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: bin/51508: pam_unix.so problem with xdm/kdm X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Peter Grimshaw List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Apr 2003 20:30:21 -0000 >Number: 51508 >Category: bin >Synopsis: pam_unix.so problem with xdm/kdm >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Apr 28 13:30:13 PDT 2003 >Closed-Date: >Last-Modified: >Originator: Peter Grimshaw >Release: FreeBSD 5.0-RELEASE i386 >Organization: N/A >Environment: System: FreeBSD tesseract.demon.co.uk 5.0-RELEASE FreeBSD 5.0-RELEASE #0: Fri Mar 7 15:46:41 GMT 2003 peter@tesseract.demon.co.uk:/usr/obj/usr/src/sys/TESSERACT i386 >Description: Function pam_sm_acct_mgmt in /usr/src/lib/libpam/modules/pam_unix/pam_unix.c uses getaddrinfo to resolve the PAM_RHOST host name, if this is set to a non-NULL value. Unfortunately, xdm and kdm set PAM_RHOST to "" rather than NULL. Also, in the same function, char rhostip[MAXHOSTNAMELEN] is not always initialized before use. On my dial-up host, the name servers are not always accessible, so the attempt to resolve "" causes login delays when using xdm or kdm. This is how I became aware of the problem. >How-To-Repeat: The problem is clear from inspection of the source code. >Fix: I've patched my source as follows, and rebuilt pam_unix.so: *** pam_unix.c.orig Thu May 23 00:18:25 2002 --- pam_unix.c Mon Apr 28 20:34:57 2003 *************** *** 35,41 **** */ #include ! __FBSDID("$FreeBSD: src/lib/libpam/modules/pam_unix/pam_unix.c,v 1.40 2002/05/22 23:18:25 jmallett Exp $"); #include #include --- 35,41 ---- */ #include ! __FBSDID("$FreeBSD: src/lib/libpam/modules/pam_unix/pam_unix.c,unofficial fix 2003/04/28 by Peter Grimshaw$"); #include #include *************** *** 170,176 **** time_t warntime; int retval; const char *rhost, *tty, *user; ! char rhostip[MAXHOSTNAMELEN]; pam_std_option(&options, other_options, argc, argv); --- 170,176 ---- time_t warntime; int retval; const char *rhost, *tty, *user; ! char rhostip[MAXHOSTNAMELEN] = ""; pam_std_option(&options, other_options, argc, argv); *************** *** 246,252 **** * PAM_NEW_AUTHTOK_REQD. */ ! if (rhost) { memset(&hints, 0, sizeof(hints)); hints.ai_family = AF_UNSPEC; if (getaddrinfo(rhost, NULL, &hints, &res) == 0) { --- 246,252 ---- * PAM_NEW_AUTHTOK_REQD. */ ! if (rhost && rhost[0]) { memset(&hints, 0, sizeof(hints)); hints.ai_family = AF_UNSPEC; if (getaddrinfo(rhost, NULL, &hints, &res) == 0) { >Release-Note: >Audit-Trail: >Unformatted: