}
recv Authentication-Start {
- if (&User-Name == "tapioca") {
+ ok
+ }
+
+ authenticate PAP {
+ if (&User-Name == 'tapioca' && &User-Password == 'queijo') {
&reply.Server-Message := "Authentication-Start accepted"
+ ok
+ } else {
+ &reply.Server-Message := "Authentication-Start failed for %{User-Name}"
+ reject
+ }
+ }
- &control.Auth-Type := Accept
+ authenticate ASCII {
+ #
+ # If we don't have all the required data, request it.
+ #
+ if (!&User-Name) {
+ &reply.Packet-Type := Authentication-GetUser
+ handled
+ }
+ if (!&User-Password) {
+ &reply.Packet-Type := Authentication-GetPass
+ handled
+ }
- } else {
- &reply.Server-Message := "Authentication-Start failed for %{User-Name}"
+ #
+ # Now we have the data perform authentication
+ #
+ if (&User-Name == 'tapioca' && &User-Password == 'queijo') {
+ &reply.Server-Message := "ASCII authentication accepted"
+ ok
+ } else {
+ &reply.Server-Message := "ASCII authentication failed for %{User-Name}"
reject
- }
+ }
}
send Authentication-Pass {
}
recv Authentication-Continue {
- if (&User-Name == "tapioca") {
- &reply.Server-Message := "Authentication-Cont accepted"
-
- &control.Auth-Type := Accept
+ &control.Auth-Type := ASCII
- } else {
- &reply.Server-Message := "Authentication-Cont failed for %{User-Name}"
- reject
- }
+ #
+ # Fill the next missing attribute from User-Message
+ #
+ if (!&User-Name) {
+ &User-Name := &User-Message
+ handled
+ }
+ if (!&User-Password) {
+ &User-Password := &User-Message
+ handled
+ }
}
recv Authorization-Request {