Menu

php crypt libnss-mysql user admin program?

Help
oliver
2005-04-02
2013-04-17
  • oliver

    oliver - 2005-04-02

    hey all.

    is there a php admin program for libnss-mysql?  does anybody know of such?  for instance, to add users, delete users, change user passwords, etc.  I would really dig one... i would be willing to pay $$ for one! ;) yea, wow huh?  not much tho, i'm poor ;(.  i can't get the crypt function to work like i would think it would in php and i really want to be able to have that kind of control.  feel free to email me at oliverpeek at gmail.com if you have such program or could talk to me a little about your findings.  or simply post a reply for all the see.

    thanks,
    oliver

     
    • Ben Goodwin

      Ben Goodwin - 2005-04-29

      Woops, I forgot to reply to this. Did anyone ever get back to you?

       
    • oliver

      oliver - 2005-05-30

      no, nobody has gotten back with me.  please do!  basically all i'm looking for is a function that will take a string password and convert it to the encrypted string to store in mysql database so i can authenticate against it and add users to the database via php.  i can't find it on the net anywhere and i've done every combo i could think of (with and without different salts etc) using this:

      <?php
      $password = "qwertyuiopasdfghjkl";
      // Not using any salts
      $encrypted = crypt($password);
      // Now do the comparison
      $shortPass = substr($password, 0, 8);
      if (crypt( $shortPass,  $encrypted ) == $encrypted )
        echo "The passwords match";
      else
        echo "The passwords do not match";
      ?>

      but, i can't come up with anything.  i'm using debian 3.0 sarge and mysql 4.0.24, and php 5.0.4

      i've gone over man crypt millions of times and i'm just not pulling what i need from what i can find or something is annoyingly wierd about it.

      thanks,
      oliver

       
      • Mike Noordermeer

        Just use the PHP crypt function with MD5.
        The example on the manual page is:
        crypt('rasmuslerdorf', '$1$rasmusle$')
        That should work. The 2nd argument should be the same as in your currently encrypted version if you want to compare them.

         
      • Andreas J Guelzow

        Encrypting  a password to use with libnss-mysql seems to be easy. We are using successfully:
        $cpassword = crypt($_POST['new_passwd']);

        To change passwords for use by Apache was trickier:
        $salt = substr($login,0,2);
        $cpassword = crypt($_POST['new_passwd'],$salt);
        since it is essential that the salt is only 2 characters long.

         

Log in to post a comment.