1libauth(3) InterNetNews Documentation libauth(3)
2
3
4
6 libauth - routines for writing nnrpd resolvers and authenticators
7
9 #include "libauth.h"
10
11 struct res_info {
12 struct sockaddr *client;
13 struct sockaddr *local;
14 char *clienthostname;
15 };
16
17 struct auth_info {
18 char *username;
19 char *password;
20 };
21
22 struct auth_info *get_auth_info(FILE *);
23 struct res_info *get_res_info (FILE *);
24
25 void free_auth_info(struct auth_info*);
26 void free_res_info (struct res_info*);
27
29 These functions provide a convenient C frontend to the nnrpd external
30 authentication interface documented in doc/external-auth. Use of this
31 library is not required; in particular, external resolvers and
32 authenticators written in languages other than C will need to implement
33 the necessary functionality themselves.
34
35 The get_auth_info() and get_res_info() functions allocate sufficient
36 memory for a struct auth_info or struct res_info and any necessary
37 fields, and return a pointer to the struct with the fields filled in
38 from information supplied by nnrpd (the FILE* parameter generally
39 should be "stdin"). Both functions return NULL on error. The caller
40 is responsible for deallocating the memory by using the functions
41 below.
42
43 The string fields of both structs are straightforward. The client and
44 local fields of struct res_info actually point to instances of struct
45 sockaddr_in (or struct sockaddr_in6 if IPv6 support is compiled in).
46
47 The free_auth_info() and free_res_info() functions free the struct
48 passed in as argument and all necessary fields.
49
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, libauth.h and its implementation are located in authprogs/;
60 perhaps they should be moved to include/ and lib/, respectively?
61
63 Written by Jeffrey M. Vinocur <jeff@litech.org> for InterNetNews.
64
66 nnrpd(8), readers.conf(5), doc/external-auth
67
68
69
70INN 2.6.5 2022-01-23 libauth(3)