[ Index ]
 

Code source de eGroupWare 1.2.106-2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/phpgwapi/inc/ -> class.auth_nis.inc.php (source)

   1  <?php
   2      /**************************************************************************\
   3      * eGroupWare API - Auth from NIS                                           *
   4      * Authentication based on NIS maps                                         *
   5      * by Dylan Adams <dadams@jhu.edu>                                          *
   6      * Copyright (C) 2001 Dylan Adams                                           *
   7      * ------------------------------------------------------------------------ *
   8      * This library is part of the eGroupWare API                               *
   9      * http://www.egroupware.org/api                                            *  
  10      * ------------------------------------------------------------------------ *
  11      * This library is free software; you can redistribute it and/or modify it  *
  12      * under the terms of the GNU Lesser General Public License as published by *
  13      * the Free Software Foundation; either version 2.1 of the License,         *
  14      * or any later version.                                                    *
  15      * This library is distributed in the hope that it will be useful, but      *
  16      * WITHOUT ANY WARRANTY; without even the implied warranty of               *
  17      * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                     *
  18      * See the GNU Lesser General Public License for more details.              *
  19      * You should have received a copy of the GNU Lesser General Public License *
  20      * along with this library; if not, write to the Free Software Foundation,  *
  21      * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA            *
  22      \**************************************************************************/
  23  
  24      /* $Id: class.auth_nis.inc.php 20295 2006-02-15 12:31:25Z  $ */
  25  
  26      class auth_
  27      {
  28  		function authenticate($username, $passwd)
  29          {
  30              $domain = yp_get_default_domain();
  31              if(!empty($GLOBALS['egw_info']['server']['nis_domain']))
  32              {
  33                  $domain = $GLOBALS['egw_info']['server']['nis_domain'];
  34              }
  35  
  36              $map = "passwd.byname";
  37              if(!empty($GLOBALS['egw_info']['server']['nis_map']))
  38              {
  39                  $map = $GLOBALS['egw_info']['server']['nis_map'];
  40              }
  41              $entry = yp_match( $domain, $map, $username );
  42  
  43              /*
  44               * we assume that the map is structured in the usual
  45               * unix passwd flavor
  46               */
  47              $entry_array = explode(':', $entry);
  48              $stored_passwd = $entry_array[1];
  49  
  50              $encrypted_passwd = crypt($passwd, $stored_passwd);
  51  
  52              return($encrypted_passwd == $stored_passwd);
  53          }
  54  
  55  		function change_password($old_passwd, $new_passwd, $account_id='')
  56          {
  57              // can't change passwords unless server runs as root (bad idea)
  58              return( False );
  59          }
  60      }


Généré le : Sun Feb 25 17:20:01 2007 par Balluche grâce à PHPXref 0.7