chiark / gitweb /
Fix memory management of argument to open_input_file
[inn-innduct.git] / doc / pod / libauth.pod
1 =head1 NAME
2
3 libauth - routines for writing nnrpd resolvers and authenticators
4
5 =head1 SYNOPSIS
6
7     #include "libauth.h"
8
9     struct res_info {
10         struct sockaddr *client;
11         struct sockaddr *local;
12         char *clienthostname;
13     };
14
15     struct auth_info {
16         char *username;
17         char *password;
18     };
19
20     struct auth_info *get_auth_info(FILE *);
21     struct res_info  *get_res_info (FILE *);
22
23     void free_auth_info(struct auth_info*);
24     void free_res_info (struct res_info*);
25
26 =head1 DESCRIPTION
27
28 These functions provide a convenient C frontend to the nnrpd external
29 authentication interface documented in F<doc/external-auth>.  Use of
30 this library is B<not> required; in particular, external resolvers and
31 authenticators written in languages other than C will need to implement
32 the necessary functionality themselves.
33
34 The get_auth_info() and get_res_info() functions allocate sufficient
35 memory for a B<struct auth_info> or B<struct res_info> and any necessary
36 fields, and return a pointer to the struct with the fields filled in
37 from information supplied by nnrpd (the B<FILE*> parameter generally
38 should be C<stdin>).  Both functions return NULL on error.  The caller
39 is responsible for deallocating the memory by using the functions below.
40
41 The string fields of both structs are straightforward.  The B<client>
42 and B<local> fields of B<struct res_info> actually point to instances of
43 B<struct sockaddr_in> (or B<struct sockaddr_in6> if IPv6 support is
44 compiled in).
45
46 The free_auth_info() and free_res_info() functions free the struct
47 passed in as argument and all necessary fields.
48
49 =head1 BUGS
50
51 In many cases, nnrpd provides more information than is normally useful
52 (for example, even when calling an authenticator, the resolver
53 information is often provided.)  On the other hand, in certain cases it
54 provides less information than might be expected (for example, if nnrpd
55 is reading from stdin rather than a socket).  The implementation is
56 capable of handling at least the first of these issues, but that
57 functionality is not exposed in the interface.
58
59 At present, F<libauth.h> and its implementation are located in
60 F<authprogs/>; perhaps they should be moved to F<include/> and F<lib/>,
61 respectively?
62
63 =head1 HISTORY
64
65 Written by Jeffrey M. Vinocur <jeff@litech.org> for InterNetNews.
66
67 $Id: libauth.pod 5988 2002-12-12 23:02:14Z vinocur $
68
69 =head1 SEE ALSO
70
71 nnrpd(8), readers.conf(5), F<doc/external-auth>
72
73 =cut