Howdy Qpopper List --

I have a question that stems from my desire to integrate a Webmail system with my already up and running Qpopper 4.0.5 installation.

Basically my concern is in regards to the Webmail system, and Qpopper cooperating nicely if both access the mbox file at the same time. I want to make sure someone doesn't log in through the webmail system, and Qpopper at the same time. Based on my reading of the source code documentation, Qpopper locks the Mailbox, then copies it to a temporary file. For the sake of this e-mail, I assume that temporary file is : /var/mail/.user.pop, (though I could be wrong). Qpopper then releases the lock on the Mailbox, and uses the .pop file for the session. When the session is over, the .pop file is copied back into the Mailbox.

Is this correct? I have tried scanning the /proc/locks file for active locks, and I can't seem to find any. Perhaps because the files are copied, and released so quickly.

Now while the session is going on, qpopper uses flock() to lock the .pop file. That way if the session doesn't end normally, the lock still exists until the timeout period is over (120 seconds).

I presently use --keep-temp-drop, so every user does have a .pop file. Could I code my webmail client to lock the .pop file using flock, then flock the Mailbox file? Would this effectively keep the two from accessing the files at the same time?

What if I just flock'ed the mbox file? The problem I see with that scenario is when someone is using pop, they might have all the active messages in the temp file, and there would be nothing for webmail system to read.

Any suggestions? Any solutions?

L~

http://www.nerdshack.com/




Reply via email to