]> diplodocus.org Git - nmh/blob - sbr/credentials.h
sendsbr.c: Move interface to own file.
[nmh] / sbr / credentials.h
1 /* credentials.h -- wrap configurable access to .netrc or similar files.
2 *
3 * This code is Copyright (c) 2017, by the authors of nmh. See the
4 * COPYRIGHT file in the root directory of the nmh distribution for
5 * complete copyright information. */
6
7 /*
8 * credentials management
9 */
10 void init_credentials_file(void);
11
12 /*
13 * Allocate and return a credentials structure. The credentials structure
14 * is now opaque; you need to use accessors to get inside of it. The
15 * accessors will only prompt the user for missing fields if they are
16 * needed.
17 *
18 * Arguments:
19 *
20 * host - Hostname we're connecting to (used to search credentials file)
21 * user - Username we are logging in as; can be NULL.
22 *
23 * Returns NULL on error, otherwise an allocated nmh_creds structure.
24 */
25 nmh_creds_t nmh_get_credentials(const char *, const char *);
26
27 /*
28 * Retrieve the user from a nmh_creds structure. May prompt the user
29 * if one is not defined.
30 *
31 * Arguments:
32 *
33 * creds - Structure from previous nmh_get_credentials() call
34 *
35 * Returns NULL on error, otherwise a NUL-terminated string containing
36 * the username. Points to allocated memory in the credentials structure
37 * that is free()d by nmh_free_credentials().
38 */
39 const char *nmh_cred_get_user(nmh_creds_t);
40
41 /*
42 * Retrieve the password from an nmh_creds structure. Otherwise identical
43 * to nmh_cred_get_user().
44 */
45 const char *nmh_cred_get_password(nmh_creds_t);
46
47 /*
48 * Free an allocated nmh_creds structure.
49 */
50 void nmh_credentials_free(nmh_creds_t);