Date: Fri, 14 Nov 1997 16:38:08 -0500 (EST) From: Chris Dent To: pam-list@redhat.com Subject: pam_nislistfile (was Re: pam_regex ) This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. Send mail to mime@docserver.cac.washington.edu for more info. --1640893760-59190026-879543488=:1571 Content-Type: TEXT/PLAIN; charset=US-ASCII On Fri, 14 Nov 1997, Michael K. Johnson wrote: > People have asked for the pam_nislistfile module before, so I'm quite > sure that's welcome news. I've attached the c source. It uses basically the same Makefile as listfile. Hell, it basically is listfile. I can claim no real credit for this :) It is listfile with the group matching taken out and the file reading loop changed to a yp_matching routine. .......................... Chris Dent........SysAdmin ...........Kiva Networking --1640893760-59190026-879543488=:1571 Content-Type: TEXT/PLAIN; charset=US-ASCII; name="pam_nislistfile.c" Content-Transfer-Encoding: BASE64 Content-ID: Content-Description: pam listfile with nis instead LyoNCiAqIGJ5IENocmlzIERlbnQgPGNkZW50QGtpdmEubmV0PiBmb3IgS2l2 YSBOZXR3b3JraW5nDQogKiBKdWx5IDI1LCAxOTk2Lg0KICogVGhpcyBjb2Rl IHNoYW1lbGVzc2x5IHJpcHBlZCBmcm9tIHRoZSBwYW1fbGlzZmlsZSBtb2R1 bGUNCiAqIGFuZCBpdCB3YXMgcmlwcGVkIGZyb20gdGhlIHBhbV9yb290b2sg bW9kdWxlLg0KICogQW5kIHRoYXQgaXMgd2h5IExpbnV4IChhbmQgYXNzb2Np YXRlcykgaXMgYSBncmVhdCB0aGluZy4NCiAqLw0KDQojZGVmaW5lIF9TVklE X1NPVVJDRQ0KI2RlZmluZSBfQlNEX1NPVVJDRQ0KI2RlZmluZSBfX1VTRV9C U0QNCiNkZWZpbmUgX19VU0VfU1ZJRA0KI2RlZmluZSBfX1VTRV9NSVNDDQoj aW5jbHVkZSA8c3RkaW8uaD4NCiNpbmNsdWRlIDxzdGRsaWIuaD4NCiNpbmNs dWRlIDxzeXMvdHlwZXMuaD4NCiNpbmNsdWRlIDxzeXMvc3Rhd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893760-59190026-879543488=:1571-- -- To unsubscribe: mail -s unsubscribe pam-list-request@redhat.com < /dev/null