ILIAS
release_4-3 Revision
◀ ilDoc Overview
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
Examples
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Groups
Pages
KADM5.php
Go to the documentation of this file.
1
<?php
2
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
3
29
require_once
'Auth/Container.php'
;
33
require_once
'PEAR.php'
;
34
55
class
Auth_Container_KADM5
extends
Auth_Container
{
56
57
// {{{ properties
58
63
var
$options
= array();
64
65
// }}}
66
// {{{ Auth_Container_KADM5()
67
81
function
Auth_Container_KADM5
(
$options
) {
82
if
(!extension_loaded(
'kadm5'
)) {
83
return
PEAR::raiseError
(
"Cannot use Kerberos V authentication, KADM5 extension not loaded!"
, 41,
PEAR_ERROR_DIE
);
84
}
85
86
$this->
_setDefaults
();
87
88
if
(isset(
$options
[
'hostname'
])) {
89
$this->options[
'hostname'
] =
$options
[
'hostname'
];
90
}
91
if
(isset(
$options
[
'realm'
])) {
92
$this->options[
'realm'
] =
$options
[
'realm'
];
93
}
94
if
(isset(
$options
[
'timeout'
])) {
95
$this->options[
'timeout'
] =
$options
[
'timeout'
];
96
}
97
if
(isset(
$options
[
'checkServer'
])) {
98
$this->options[
'checkServer'
] =
$options
[
'checkServer'
];
99
}
100
101
if
($this->options[
'checkServer'
]) {
102
$this->
_checkServer
();
103
}
104
}
105
106
// }}}
107
// {{{ fetchData()
108
116
function
fetchData
($username, $password) {
117
$this->
log
(
'Auth_Container_KADM5::fetchData() called.'
,
AUTH_LOG_DEBUG
);
118
if
( ($username == NULL) || ($password == NULL) ) {
119
return
false
;
120
}
121
122
$server
= $this->options[
'hostname'
];
123
$realm = $this->options[
'realm'
];
124
$check = @kadm5_init_with_password(
$server
, $realm, $username, $password);
125
126
if
($check ==
false
) {
127
return
false
;
128
}
else
{
129
return
true
;
130
}
131
}
132
133
// }}}
134
// {{{ _setDefaults()
135
141
function
_setDefaults
() {
142
$this->options[
'hostname'
] =
'localhost'
;
143
$this->options[
'realm'
] = NULL;
144
$this->options[
'timeout'
] = 10;
145
$this->options[
'checkServer'
] =
false
;
146
}
147
148
// }}}
149
// {{{ _checkServer()
150
156
function
_checkServer
() {
157
$fp = @fsockopen ($this->options[
'hostname'
], 88, $errno, $errstr, $this->options[
'timeout'
]);
158
if
(is_resource($fp)) {
159
@fclose($fp);
160
}
else
{
161
$message =
"Error connecting to Kerberos V server "
162
.$this->options[
'hostname'
].
":"
.$this->options[
'port'
];
163
return
PEAR::raiseError
($message, 41,
PEAR_ERROR_DIE
);
164
}
165
}
166
167
// }}}
168
169
}
170
171
?>
Services
PEAR
lib
Auth
Container
KADM5.php
Generated on Sat Apr 30 2016 19:01:09 for ILIAS by
1.8.1.2 (using
Doxyfile
)