Two-phase filtering for a firewall is disclosed. In the first, general
phase, a request is filtered to verify one or more of: that the request is pursuant
to a supported protocol, that a command of the request is allowed, that the length
of the request does not exceed the allowed maximum for the command, and that characters
of the request are of an allowable type. Upon first-phase verification, a second
phase is invoked that is particular to the protocol of the request. In the second,
specialized phase, the request is filtered to verify one or more of the source,
the destination, and the content of the request. Upon second-phase verification,
the request is allowed to pass. If either first-or second-phase verification fails,
then the request is denied.