nsss
Software
skarnet.org

The nsssd library interface

General information

libnsssd is a library that can be used by external applications to implement extra nsss backends, in the style of nsssd-unix and nsssd-nslcd, without learning the details of the nsss protocol or having to perform IO themselves.

Compiling

Linking

Programming

The rest of your program should implement the functions needed by nsssd_main(). Here is what those functions are:

void *nsssd_handle_init (void)

This function must return a pointer to an uninitialized handle. The handle can be whatever you need to implement your backend; the pointer to your handle will be passed to every subsequent function. The function must not return NULL.

int nsssd_handle_start (void *handle, char const *const *argv, char const *const *envp)

This function must initialize the handle. The arguments it receives are the argv and envp that have been passed to nsssd_main(). This allows you to write daemons that can be somewhat configured via the command line: it is how nsssd-nslcd takes an argument telling it where the nslcd socket is, and uses that argument in its own nsssd_handle_start to actually connect to the nslcd daemon.
The function must return nonzero if it succeeds, and 0 if it fails, setting errno appropriately.

void nsssd_handle_end (void *handle)

This function must deinitialize the handle and free all related resources: close connections to external processes, etc.

TODO: to be completed.