<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 foldmethod=marker: */

if (!isset($GLOBALS['DIRFUENTES'])) {
    trigger_error("Modulo llamador debe abrir auth/confcol.php");
}

/**
 * This function is used to authenticate users via an authentication
 * program configured in confcol.php.
 * @param login Username 
 * @param password password that the user gives
 * @return boolean whether the user is authenticated or not.
 * @package sigue
 * Public domain. No warranties. 2003. http://structio.sourceforge.net/sigue
 */
function autenticaUsuario($login,$password) {
  if (!isset($password)||strlen($password)==0) {
    return false;
  }
  else {
        /* Reference http://de.php.net/posix_getpwnam */
	if(($fh = popen($GLOBALS["AUTHPGM"], "w"))) 
        { 
        	fputs($fh, "$login $password"); 
                $r = pclose($fh); 
		if(!$r) {
                	return true; 
		}
	} 
  }
  
  return false;
}

?>
