Go to the first, previous, next, last section, table of contents.


Examples of login verification functions

As an example, let's consider the function for analyzing a line line of output from a standard UNIX finger service. In each line of finger output the first field contains username, the third field --- tty number (Port ID), and the seventh field contains session ID. The function must return 1 if the three fields match the input user name, port and session IDs.

    integer
    check_unix(string str, string name, integer pid, string sid)
    {
        return field(str, 1) == name
               && field(str, 3) == pid
               && field(str, 7) == sid;
    }

Next example is a function to analyze a line of output from an SNMP query returning a user name. This function must return 1 if entire input line matches the user name.

    integer
    check_username(string str, string name, integer pid, string sid)
    {
        return str == name;
    }


Go to the first, previous, next, last section, table of contents.