3 * login_sasl_client.php
9 define("SASL_LOGIN_STATE_START", 0);
10 define("SASL_LOGIN_STATE_IDENTIFY_USER", 1);
11 define("SASL_LOGIN_STATE_IDENTIFY_PASSWORD", 2);
12 define("SASL_LOGIN_STATE_DONE", 3);
14 class login_sasl_client_class
16 var $credentials=array();
17 var $state=SASL_LOGIN_STATE_START
;
19 Function Initialize(&$client)
24 Function Start(&$client, &$message, &$interactions)
26 if($this->state
!=SASL_LOGIN_STATE_START
)
28 $client->error
="LOGIN authentication state is not at the start";
31 $this->credentials
=array(
39 $status=$client->GetCredentials($this->credentials
,$defaults,$interactions);
40 if($status==SASL_CONTINUE
)
41 $this->state
=SASL_LOGIN_STATE_IDENTIFY_USER
;
46 Function Step(&$client, $response, &$message, &$interactions)
50 case SASL_LOGIN_STATE_IDENTIFY_USER
:
51 $message=$this->credentials
["user"].(strlen($this->credentials
["realm"]) ?
"@".$this->credentials
["realm"] : "");
52 $this->state
=SASL_LOGIN_STATE_IDENTIFY_PASSWORD
;
54 case SASL_LOGIN_STATE_IDENTIFY_PASSWORD
:
55 $message=$this->credentials
["password"];
56 $this->state
=SASL_LOGIN_STATE_DONE
;
58 case SASL_LOGIN_STATE_DONE
:
59 $client->error
="LOGIN authentication was finished without success";
62 $client->error
="invalid LOGIN authentication step state";
65 return(SASL_CONTINUE
);