Commit a4326d64 a4326d64f6a2259a94643f31e7428753979bcdbc by Alain Magloire

Update.

1 parent 75526aa3
1 2001-11-01 Alain Magloire
2
3 There were confusion, about the authority_t and the ticket_t.
4 An authority_t is an object that implementes an authentication
5 mechanism i.e. APOP, SASL, User/Passwd. To retrieve or get
6 information from the client/user, authority_t will use the
7 ticket_t, it will call ticket_pop (). For example, on an
8 authority_t object that implements the user/passwd mechanism
9 ticket_pop () will be call two times once for the user and
10 the other for the passwd, by the authority_t object.
11
12 So far so good, but the problem here was we had
13 mailbox_{g,s}et_ticket(), folder_{g,s}et_ticket() and
14 mailbox_{g,s}et_authority() and folder_{g,s}_authority().
15 For example for a ticket , depending on when xx_set_ticket ()
16 was done, a ticket_t could have been set on the mailbox_t structure
17 or on the folder_t structure. This was leading to use the wrong one,
18 folder->ticket or mailbox->ticket. Same problem occurs for
19 authority_t. To clear this up, ticket_t can only be set on the
20 authority_t and autority_t can only be on a folder. Having only one
21 way to get at the authority or at the ticket fix the race conditions:
22 {
23 // No error checking is done.
24 mailbox_t mbox;
25 folder_t folder;
26 authority_t auth;
27 ticket_t ticket; ..
28 ..
29 // Setting the ticket
30 mailbox_create (&mbox, where);
31 mailbox_get_folder (mbox, &folder);
32 folder_get_authority (folder, &auth)
33 authority_set_ticket (auth, ticket);
34 ....
35 }
36
37 * include/mailutils/mailbox.h: Remove mailbox_{g,s}et_ticket().
38 mailbox_{gs}et_authority ().
39 * include/mailutils/folder.h: Remove folder_{gs}et_authority().
40 * mailbox/mailbox.c (mailbox_get_folder): New function.
41 (mailbox_get_ticket): Removed.
42 (mailbox_set_ticket): Removed.
43 (mailbox_set_authority): Removed.
44 (mailbox_get_authority): Removed.
45 * mailbox/folder.c (folder_get_ticket): Removed.
46 (folder_set_ticket): Removed.
47 (folder_destroy): Removed destruction of ticket.
48 * mailbox/folder_imap.c (folder_imap_get_authority): New function.
49 (_folder_imap_init): Create authority.
50 * mailbox/folder_pop.c (folder_pop_get_authority): New function.
51 (folder_pop_open): New function.
52 (folder_pop_close): New function.
53 (_folder_pop_init): Create authority.
54 * mailbox/mbx_imap.c (_mailbox_imap_init): Remove the creation
55 of authority here, moved to _folder_imap_init().
56 * mailbox/mbx_pop.c (_mailbox_pop_init): Remove the creation
57 of authority here, moved to _folder_imap_init().
58
1 2001-11-01 Sergey Poznyakoff 59 2001-11-01 Sergey Poznyakoff
2 60
3 * configure.in: Added check for utmp.h & utmpx.h 61 * configure.in: Added check for utmp.h & utmpx.h
......
...@@ -50,6 +50,8 @@ static int folder_pop_close __P ((folder_t)); ...@@ -50,6 +50,8 @@ static int folder_pop_close __P ((folder_t));
50 static int folder_pop_get_authority __P ((folder_t, authority_t *)); 50 static int folder_pop_get_authority __P ((folder_t, authority_t *));
51 extern int _pop_user __P ((authority_t)); 51 extern int _pop_user __P ((authority_t));
52 52
53 /* XXX: The way, the POP folder is handle is not clean at all.
54 the I/O functions should have been here on folder, not in mbx_pop.c */
53 int 55 int
54 _folder_pop_init (folder_t folder) 56 _folder_pop_init (folder_t folder)
55 { 57 {
......