Date: Mon, 21 Oct 1996 16:18:52 -0400 From: jason@ampersand.com (Jason Brazile) To: freebsd-questions@freebsd.org Subject: NIS client requires change to getpwent()? Message-ID: <199610212018.QAA02002@colon.dev.ampersand.com>
next in thread | raw e-mail | index | archive | help
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); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199610212018.QAA02002>