File: PamUserStore.php

package info (click to toggle)
bamboo 1.2-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 580 kB
  • ctags: 1,338
  • sloc: php: 4,061; makefile: 44; sh: 36
file content (35 lines) | stat: -rw-r--r-- 720 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php

/*****

PamUserStore

A very simple user storage backend which authenticates using
php4-auth-pam. 

Configure like so:
   userbackend = pam

Note that if pam is set to use the shadow password file, then the process
running bamboo must be able to read the file. The error generated when you
don't have permissions is simply "Authentication failure."

*****/

$base = dirname(dirname(__FILE__));
require_once("$base/UserStore.php");

class PamUserStore extends UserStore {
	function authenticate($user,$pass,&$error) {
		if (!function_exists("pam_auth")) {
			$error = "PAM authentication module is not loaded by PHP.";
			return false;
		}
		else {
			return pam_auth($user, $pass, &$error);
		}
	}
} 

return;
?>