1.3 Utility Functions

Some utility functions provided by the Kerberos library are exported to the Python programmer. These functions allow the programmer to query certain aspects of the Kerberos configuration.

get_default_realm ()
Returns the realm used when no realm is specified in a principal name.

get_krbhst (realm)
Returns a list of host names which will be used to locate the Key Distribution Center.

The following functions may raise socket.error. They are not particularly tied to Kerberos other than being provided by the Kerberos library.

net_read (sock, length)
Low level read function on a connected socket. net_read() is not an attribute of TCPAthenticationContext objects because it involves no Kerberos interaction. sock is a socket object or an integer corresponding to sock.fileno(). length is the amount that should be read and returned as a string (in bytes).

net_write (sock, string)
Low level write function to correspond with net_write(). sock is a socket object or an integer corresponding to sock.fileno(). string is the data to be written. net_write() is not an attribute of TCPAthenticationContext objects because it involves no Kerberos interaction.