From owner-freebsd-questions Mon Oct 21 13:21:34 1996 Return-Path: owner-questions Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id NAA09070 for questions-outgoing; Mon, 21 Oct 1996 13:21:34 -0700 (PDT) Received: from ftp.com (ftp.ampersand.com [192.156.188.2]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id NAA09053 for ; Mon, 21 Oct 1996 13:21:24 -0700 (PDT) Received: from dev.ampersand.com (tick [192.156.188.22]) by ftp.com with ESMTP id QAA09190 (8.6.11/IDA-1.6 for ); Mon, 21 Oct 1996 16:28:34 -0400 Received: from colon.dev.ampersand.com by dev.ampersand.com (SMI-8.6/SMI-SVR4) id QAA13536; Mon, 21 Oct 1996 16:14:00 -0400 Received: by colon.dev.ampersand.com (SMI-8.6/SMI-SVR4) id QAA02002; Mon, 21 Oct 1996 16:18:52 -0400 Date: Mon, 21 Oct 1996 16:18:52 -0400 From: jason@ampersand.com (Jason Brazile) Message-Id: <199610212018.QAA02002@colon.dev.ampersand.com> To: freebsd-questions@freebsd.org Subject: NIS client requires change to getpwent()? Sender: owner-questions@freebsd.org X-Loop: FreeBSD.org Precedence: bulk I was recently trying to setup a FreeBSD 2.1.5 machine as an NIS client to a Solaris 2.5 (NIS+) server. I ended up with the problem that I could "ypcat passwd" a certain entry and "import" it via vipw and it worked fine, but if I just left it in the yp map, then the login would fail. I eventually got it to work by making a 1 line change to getpwent() in the C library. Despite the small change, I have the nagging feeling that I only needed to do it because I misconfigured something or hacked away some intentional security feature. I would be grateful if some knowledgeable person could either: 1) Tell me what I did wrong OR 2) Confirm that this is a bug and submit it as a PR. The essential problem is that _pw_breakout_yp() wasn't filling in the pw_passwd, pw_uid, and pw_gid fields to the struct passwd entry because in __hashpw(), the data returned from the _pw_db->get filled in the pw_fields field in such a way (e.g. I think it was an 0xF) that it failed the tests against _PWF_PASSWD, _PWF_UID, and _PFW_GID). After the one line patch below, logins work fine. Jason ----------------------------------------------------------------------------- *** getpwent.c.orig Sun Oct 20 23:26:20 1996 --- getpwent.c Mon Oct 21 14:42:37 1996 *************** *** 306,311 **** --- 306,312 ---- p += sizeof(time_t); bcopy(p, (char *)&_pw_passwd.pw_fields, sizeof _pw_passwd.pw_fields); p += sizeof _pw_passwd.pw_fields; + _pw_passwd.pw_fields = 0; return(1); }