[Chicago-talk] accessing NIS password

Richard Reina richard at rushlogistics.com
Sat Mar 11 10:12:51 PST 2006


Jess,
   
  Thank you for the reply.  Do you think I should be writing this in java instead of perl?  Can it not be done in perl?  Unfortunately, I know no java, but if that's what it's going to take I guess I'll have to look into it.

Jess Balint <jbalint at gmail.com> wrote:
        v\:* {behavior:url(#default#VML);}  o\:* {behavior:url(#default#VML);}  w\:* {behavior:url(#default#VML);}  .shape {behavior:url(#default#VML);}        st1\:*{behavior:url(#default#ieooui) }                I would say, first, make sure the hashed password is returned and not ‘x’ (shadow). Then, check out this page:
   
  http://www-128.ibm.com/developerworks/linux/library/l-md5crypt/?ca=dgr-lnxwLinuxCrypt
   
  Should have enough details.
   
  Jess Balint
   
      
---------------------------------
  
  From: chicago-talk-bounces+jbalint=gmail.com at pm.org [mailto:chicago-talk-bounces+jbalint=gmail.com at pm.org] On Behalf Of Richard Reina
Sent: Friday, March 10, 2006 9:06 AM
To: Chicago.pm chatter
Subject: Re: [Chicago-talk] accessing NIS password

   
  Dear Darren,

I still stumped and under increasing pressure to get this figured out.  I know it's not a lot of money, but for a $100 would it be worth your while to help me out.

Richard

"Young, Darren" <Darren.Young at ChicagoGSB.edu> wrote:
  
Use the getpw* (getpwnam) functions to return the user's password entry,
if your name service switch is configured correctly it'll return the
entry regardless of location.

You MUST have the encrypted first to perform the comparision. This is
also assuming you're password is in crypt format and not something else
(MD5, etc). If it is crypt, take the first 2 characters to get the salt
then re-crypt() the plain from the user with that salt. Once that's done
just string compare the 2, if they match, the password was correct,
else, it was wrong.

>>>

my $username = 'foo';
my $plainfromuser = 'hispass';
my $currentsalt;

my ($name, $passwd, $uid, $gid, $quota, $comment, 
$gcos, $dir, $shell) = getpwnam($username);

$currentsalt = substr($passwd,0,2);

my $tpass = crypt($plainfromuser, $currentsalt);

if ( $tpass eq $passwd ) {
print "good\n";
} else {
print "bad\n";
}

Just tried that on my NIS enabled Solaris 8 system and it worked.




I am trying to write a script that prompts a user ( that is
already logged in ) for his password when he runs certain perl
applications. I am able to write the part that prompts the user for the
password with "no echo" however I have no idea how to compare the entry
to his password especially since we use NIS and thus the passwords are
not on the local machine but on the server ( on the same LAN). Can
anyone provide any help on how I would compare the entry ag ainst the NIS
password?

Thanks in advance,

Richard


A people that values its privileges above its principles soon
loses both.
-Dwight D. Eisenhower.

_______________________________________________
Chicago-talk mailing list
Chicago-talk at pm.org
http://mail.pm.org/mailman/listinfo/chicago-talk
  


A people that values its privileges above its principles soon loses both.
-Dwight D. Eisenhower.

_______________________________________________
Chicago-talk mailing list
Chicago-talk at pm.org
http://mail.pm.org/mailman/listinfo/chicago-talk


A people that values its privileges above its principles soon loses both.
 -Dwight D. Eisenhower.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/chicago-talk/attachments/20060311/44d4f425/attachment.html


More information about the Chicago-talk mailing list