summaryrefslogtreecommitdiffstats
path: root/src/lib-imap-urlauth/imap-urlauth.h
blob: 9c7c30f80ac644f7016e4fc22b315bbf7effee8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#ifndef IMAP_URLAUTH_H
#define IMAP_URLAUTH_H

#include "net.h"

#define IMAP_URLAUTH_SOCKET_NAME "imap-urlauth"

struct imap_url;
struct imap_msgpart_url;
struct imap_urlauth_context;

struct imap_urlauth_config {
	const char *url_host;
	in_port_t url_port;

	const char *socket_path;
	const char *session_id;

	/* the user who is requesting access to URLAUTHs */
	const char *access_user;
	/* ... is using this service (i.e. imap or submission) */
	const char *access_service;
	/* ... represents these applications */
	const char *const *access_applications;
	/* ... is anonymous? */
	bool access_anonymous;
};

struct imap_urlauth_context *
imap_urlauth_init(struct mail_user *user,
		  const struct imap_urlauth_config *config);
void imap_urlauth_deinit(struct imap_urlauth_context **_uctx);

int imap_urlauth_generate(struct imap_urlauth_context *uctx,
			  const char *mechanism, const char *rumpurl,
			  const char **urlauth_r, const char **client_error_r);

bool imap_urlauth_check(struct imap_urlauth_context *uctx,
			struct imap_url *url, bool ignore_unknown_access,
			const char **error_r);

int imap_urlauth_fetch_parsed(struct imap_urlauth_context *uctx,
			      struct imap_url *url,
			      struct imap_msgpart_url **mpurl_r,
			      enum mail_error *error_code_r,
			      const char **error_r);
int imap_urlauth_fetch(struct imap_urlauth_context *uctx,
		       const char *urlauth, struct imap_msgpart_url **mpurl_r,
		       enum mail_error *error_code_r, const char **error_r);

int imap_urlauth_reset_mailbox_key(struct imap_urlauth_context *uctx,
				   struct mailbox *box);
int imap_urlauth_reset_all_keys(struct imap_urlauth_context *uctx);

#endif