Page 1 of 1

fetch email address from nis authentication

Posted: Tue Jan 02, 2007 7:16 am
by vamsi_j
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


from an NIS authentication i would like to fetch the email address.
can anyone help me.

i have written a function to fetch the full name of the person associated with thatuser
similarly i need it for emailaddress.

Code: Select all

getUserByName($user)
{
 
   $fullname = yp_match (yp_get_default_domain(), "passwd.byname", $user);
   if ( ! empty ( $fullname ) ) {
       $fullname = explode ( ":", $fullname );
        return $fullname[4];
      } else {
         return $user;
    }
}

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Tue Jan 02, 2007 8:03 am
by volka
There are mail.aliases and mail.byaddr as maps for /etc/aliases