(no commit message)
[ikiwiki.git] / docs / developer / EnhanceDmaGSoC.mdwn
1 # enhance dma(8) during the SoC 2008 
2
3 A [Google Summer of Code 2008](http://code.google.com/soc/2008) project. <br>
4 Student: Max Lindner<br>
5 Mentor: Matthias Schmidt
6
7
8
9 ## Project Proposal Abstract 
10
11 dma - a minimalistic non-listening mta for dragonflybsd shall gain some more functionality regarding processing and delivering mail.
12
13
14
15 The project adresses two main subjects:
16
17
18
19 -smart delivery to smarthosts
20
21
22
23 -support for .forward local delivery
24
25
26
27 ## Status 
28
29
30
31 finished
32
33
34
35 ## Timeline 
36
37 Until May 25th - reading dma source, creating build environment, get to know the development cycle in dragonflybsd, refine timeline, more detail on this page ;-)
38
39
40
41 May 26th until Jul 06th - creating .forward handling and test it
42
43
44
45 Jul 07th until Jul 14th - Midterm Evaluation
46
47
48
49 Jul 15th until Aug 10th - improve smarthost handling
50
51
52
53  **Add .forward support** 
54
55
56
57 Any combination of the following entries should be valid in a .forward file:
58
59
60
61     
62
63     |/pipe/to/executable
64
65     mailbox@remote.host
66
67     !deliverdirekttomailbox
68
69
70
71 dma runs as root and splits itself up into 3 branches now:
72
73
74
75  1. the old codebase, which drops privileges to user nobody / group mail
76
77  1. a process for reading an users .forward (the function dotforwardhandler), which forks for every file to read and drops privileges to that user before reading.
78
79  1. a process for writing an users mailbox/executing the pipe for delivering the mail (the function write_to_local_user), which forks for every mail to deliver and drops privileges to that user before open the file/pipe
80
81
82
83 The communication between the 3 branches is done via two socketpairs, one socketpair for each new branch. In order to prevent concurring communication, it is synchronised with one semaphore each.
84
85
86
87 The new processes terminate themselves as soon as every mail which was enqeued was sent out or bounced. This is signaled by another semaphore which is incremented before delivery starts and decremented after the mail was successfully sent or written or the bounce was generated and delivered.
88
89
90
91  **Smarter smarthost-delivery** 
92
93
94
95 for implementing the new smarthost delivery, I use the new function deliver_smarthost. While the function deliver takes one qitem a time, the deliver_smarthost function takes a queue. This queue is generated during go_background and is the main queue with having removed the local receipients. This queue is given to the deliver_remote function, which sends one "RCPT TO: xy@foo.bar " for each qitem.
96
97
98
99 Depending on the returning status code (accept, temporary error, permanent error) the qitem is copied to one of 3 other queues. These 3 queues are processed again in deliver_smarthost after completing the deliver_remote function. Sent qitems are deleted, temporary failed items are tried again and permanent failed items are bounced.
100
101
102
103 For the cram-md5 authetification, I changed the read_remote() function to the possibility to give back the received buffer. Inside of this buffer, there is a challenge which must be used together with the username and password to create a appropriate response.
104