<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:st1="urn:schemas-microsoft-com:office:smarttags" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]--><o:SmartTagType
 namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="City"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="place"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="PersonName"/>
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:Arial;
        color:navy;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>

</head>

<body lang=EN-US link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>I would say, first, make sure the hashed
password is returned and not &#8216;x&#8217; (shadow). Then, check out this
page:<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><a
href="http://www-128.ibm.com/developerworks/linux/library/l-md5crypt/?ca=dgr-lnxwLinuxCrypt">http://www-128.ibm.com/developerworks/linux/library/l-md5crypt/?ca=dgr-lnxwLinuxCrypt</a><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Should have enough details.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Jess Balint<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<div>

<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>

<hr size=2 width="100%" align=center tabindex=-1>

</span></font></div>

<p class=MsoNormal><b><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>From:</span></font></b><font size=2
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>
chicago-talk-bounces+jbalint=gmail.com@pm.org
[mailto:chicago-talk-bounces+jbalint=gmail.com@pm.org] <b><span
style='font-weight:bold'>On Behalf Of </span></b>Richard Reina<br>
<b><span style='font-weight:bold'>Sent:</span></b> Friday, March 10, 2006 9:06
AM<br>
<b><span style='font-weight:bold'>To:</span></b> <st1:PersonName w:st="on">Chicago.pm
 chatter</st1:PersonName><br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [Chicago-talk]
accessing <st1:City w:st="on"><st1:place w:st="on">NIS</st1:place></st1:City> password</span></font><o:p></o:p></p>

</div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>Dear Darren,<br>
<br>
I still stumped and under increasing pressure to get this figured out.&nbsp; I
know it's not a lot of money, but for a $100 would it be worth your while to
help me out.<br>
<br>
Richard<br>
<br>
<b><i><span style='font-weight:bold;font-style:italic'>&quot;Young,
Darren&quot; &lt;Darren.Young@ChicagoGSB.edu&gt;</span></i></b> wrote:<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><br>
Use the getpw* (getpwnam) functions to return the user's password entry,<br>
if your name service switch is configured correctly it'll return the<br>
entry regardless of location.<br>
<br>
You MUST have the encrypted first to perform the comparision. This is<br>
also assuming you're password is in crypt format and not something else<br>
(MD5, etc). If it is crypt, take the first 2 characters to get the salt<br>
then re-crypt() the plain from the user with that salt. Once that's done<br>
just string compare the 2, if they match, the password was correct,<br>
else, it was wrong.<br>
<br>
&gt;&gt;&gt;<br>
<br>
my $username = 'foo';<br>
my $plainfromuser = 'hispass';<br>
my $currentsalt;<br>
<br>
my ($name, $passwd, $uid, $gid, $quota, $comment, <br>
$gcos, $dir, $shell) = getpwnam($username);<br>
<br>
$currentsalt = substr($passwd,0,2);<br>
<br>
my $tpass = crypt($plainfromuser, $currentsalt);<br>
<br>
if ( $tpass eq $passwd ) {<br>
print &quot;good\n&quot;;<br>
} else {<br>
print &quot;bad\n&quot;;<br>
}<br>
<br>
Just tried that on my <st1:City w:st="on"><st1:place w:st="on">NIS</st1:place></st1:City>
enabled Solaris 8 system and it worked.<br>
<br>
<br>
<br>
<br>
I am trying to write a script that prompts a user ( that is<br>
already logged in ) for his password when he runs certain perl<br>
applications. I am able to write the part that prompts the user for the<br>
password with &quot;no echo&quot; however I have no idea how to compare the
entry<br>
to his password especially since we use <st1:City w:st="on"><st1:place w:st="on">NIS</st1:place></st1:City>
and thus the passwords are<br>
not on the local machine but on the server ( on the same LAN). Can<br>
anyone provide any help on how I would compare the entry ag ainst the <st1:City
w:st="on"><st1:place w:st="on">NIS</st1:place></st1:City><br>
password?<br>
<br>
Thanks in advance,<br>
<br>
Richard<br>
<br>
<br>
A people that values its privileges above its principles soon<br>
loses both.<br>
-Dwight D. Eisenhower.<br>
<br>
_______________________________________________<br>
Chicago-talk mailing list<br>
Chicago-talk@pm.org<br>
http://mail.pm.org/mailman/listinfo/chicago-talk<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><br>
<br>
<br>
A people that values its privileges above its principles soon loses both.<br>
-Dwight D. Eisenhower.<o:p></o:p></span></font></p>

</div>

</body>

</html>