  | |  | NIS/Apache/Password Synchronization Issue | NIS/Apache/Password Synchronization Issue 2005-04-19 - By Dozier, Jr., Ken
Back I have written a LAMP(PHP)-based web app for my employer, but I am having authentication problems that I think may be NIS and/or Apache related. Everyone with a valid account on our network should be able to auth with no problem; however, not everyone is able to do so. I was able to login with my old password; but after I changed it, the app won't authenticate me with the new one. The weird thing is that it will log me in if I use my previous password. Also, the web server is RHEL 3 and has no problem logging me in at the console with my new password. Our network runs Win2K and RHEL 3 with Samba. Authentication is via NIS, and the NIS master is a Win2K box. We are using the version of Apache that ships with RHEL 3, and PHP is version 4.3.2. MySQL is also the default RHEL 3 version; however, the app doesn't touch the db until after authenticating the user, so MySQL should not be an issue. The auth code snippet I am using is below. Thanks for your help. <snip> // Compare user input with NIS info. $nis_data = @(protected)(yp_get_default_domain(), "passwd.byname", $username); if (strlen($nis_data)) { $nis_data = explode(":", $nis_data); $salted = crypt($password, $nis_data[1]); if ($salted == $nis_data[1]) return true; } else return false; </snip> Ken Dozier Microcomputer Support Specialist. Barton College 400 ACC Drive Wilson, NC 27893 252.399.6437 kdozier@(protected) <mailto:kdozier@(protected)>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=Content-Type content="text/html; charset=us-ascii"> <META content="MSHTML 6.00.2800.1491" name=GENERATOR></HEAD> <BODY> <DIV><FONT face="Courier New" color=#000080 size=2><SPAN class=108360116-19042005>I have written a LAMP(PHP)-based web app for my employer, but I am having authentication problems that I think may be NIS and/or Apache related. Everyone with a valid account on our network should be able to auth with no problem; however, not everyone is able to do so. I was able to login with my old password; but after I changed it, the app won't authenticate me with the new one. The weird thing is that it will log me in if I use my previous password. Also, the web server is RHEL 3 and has no problem logging me in at the console with my new password.</SPAN></FONT></DIV> <DIV><FONT face="Courier New" color=#000080 size=2><SPAN class=108360116-19042005></SPAN></FONT> </DIV> <DIV><FONT face="Courier New" color=#000080 size=2><SPAN class=108360116-19042005>Our network runs Win2K and RHEL 3 with Samba. Authentication is via NIS, and the NIS master is a Win2K box. We are using the version of Apache that ships with RHEL 3, and PHP is version 4.3.2. MySQL is also the default RHEL 3 version; however, the app doesn't touch the db until after authenticating the user, so MySQL should not be an issue. The auth code snippet I am using is below. Thanks for your help.</SPAN></FONT></DIV> <DIV><FONT face="Courier New" color=#000080 size=2><SPAN class=108360116-19042005></SPAN></FONT> </DIV> <DIV><FONT face="Courier New" color=#000080 size=2><SPAN class=108360116-19042005><snip></SPAN></FONT></DIV> <DIV><FONT face="Courier New" color=#000080 size=2><SPAN class=108360116-19042005>// Compare user input with NIS info.</SPAN></FONT></DIV> <DIV><FONT face="Courier New" color=#000080 size=2><SPAN class=108360116-19042005>$nis_data = @(protected)(yp_get_default_domain(), "passwd.byname", $username);</SPAN></FONT></DIV> <DIV><FONT face="Courier New" color=#000080 size=2><SPAN class=108360116-19042005>if (strlen($nis_data))</SPAN></FONT></DIV> <DIV><FONT face="Courier New" color=#000080 size=2><SPAN class=108360116-19042005>{</SPAN></FONT></DIV> <DIV><FONT face="Courier New" color=#000080 size=2><SPAN class=108360116-19042005> $nis_data = explode(":", $nis_data);</SPAN></FONT></DIV> <DIV><FONT face="Courier New" color=#000080 size=2><SPAN class=108360116-19042005> $salted = crypt($password, $nis_data[1]);</SPAN></FONT></DIV> <DIV><FONT face="Courier New" color=#000080 size=2><SPAN class=108360116-19042005> if ($salted == $nis_data[1])</SPAN></FONT></DIV> <DIV><FONT face="Courier New" color=#000080 size=2><SPAN class=108360116-19042005> return true;</SPAN></FONT></DIV> <DIV><FONT face="Courier New" color=#000080 size=2><SPAN class=108360116-19042005>}</SPAN></FONT></DIV> <DIV><FONT face="Courier New" color=#000080 size=2><SPAN class=108360116-19042005>else</SPAN></FONT></DIV> <DIV><FONT face="Courier New" color=#000080 size=2><SPAN class=108360116-19042005> return false;</SPAN></FONT></DIV> <DIV><FONT face="Courier New" color=#000080 size=2><SPAN class=108360116-19042005></snip></SPAN></FONT></DIV> <DIV> </DIV> <DIV dir=ltr align=left><FONT face="Palatino Linotype" color=#000080><STRONG >Ken Dozier</STRONG></FONT></DIV> <DIV align=left><FONT face="Palatino Linotype" color=#0000ff size=2><EM>Microcomputer Support Specialist.</EM></FONT></DIV> <DIV align=left><FONT face="Palatino Linotype" color=#000080 size=2><STRONG>Barton College</STRONG></FONT></DIV> <DIV align=left><FONT face="Palatino Linotype" color=#000080 size=2>400 ACC Drive</FONT></DIV> <DIV align=left><FONT face="Palatino Linotype" color=#000080 size=2>Wilson, NC 27893</FONT></DIV> <DIV align=left><FONT face="Palatino Linotype" color=#0000ff size=2><EM>252.399.6437</EM></FONT></DIV> <DIV align=left><FONT face="Palatino Linotype" size=2><A href="mailto:kdozier@(protected)"><EM>kdozier@(protected)</EM></A></FONT></DIV> <DIV> </DIV></BODY></HTML>
-- Taroon-list mailing list Taroon-list@(protected) http://www.redhat.com/mailman/listinfo/taroon-list
Earn $52 per hosting referral at Lunarpages.
|
|
 |