The ident library interface

The following functions and structures are declared in the s6-networking/ident.h header, and implemented in the libs6net.a or library.

General information

ident provides a C IDENT client, following RFC 1413.

Please note that this protocol is of historical interest exclusively; this client, as well as the minidentd server, is only provided for convenience and interoperability with legacy systems. The IDENT protocol absolutely cannot be relied on for any kind of authentication or secure operation.


Check the s6-networking/ident.h header for the exact function prototypes.

Main interface

int s6net_ident_client (char *s, unsigned int max, ip46_t const *remoteip, uint16 remoteport, ip46_t const *localip, uint16 localport, tain_t const *deadline, tain_t *stamp)

Makes an IDENT request to a server listening on IP remoteip port 113 about the connection from IP remoteip port remoteport to IP localip port localport. Writes the answer into preallocated string s of max length max, and returns the number of bytes in the answer.

char const *s6net_ident_error_str (int e)

Maps an error code representing a negative answer (i.e. errno when s6net_ident_client returned 0) to a suitable string.

Low-level functions

int s6net_ident_reply_get (char *s, ip46_t const *ra, uint16 rp, ip46_t const *la, uint16 lp, tain_t const *deadline, tain_t *stamp)

The network part of s6net_ident_client. Connects to *ra:113 and asks the server about (*ra:rp, *la:lp), aborting if *deadline goes by. Writes the server answer into s; at least S6NET_IDENT_REPLY_SIZE bytes must be preallocated in s. Returns -1 if an error occurs, or the number of bytes written into s.

int s6net_ident_reply_parse (char const *s, uint16 rp, uint16 lp)

The local part of s6net_ident_client. Parses the server answer in s for the connection from port rp to port lp. Returns -1 EPROTO if the answer does not make sense, 0 if the answer is negative, or a positive number if the answer is positive. This number is an index where the ID can be found in s.