diff options
| author | cotton | 1998-11-10 13:06:10 +0000 |
|---|---|---|
| committer | cotton | 1998-11-10 13:06:10 +0000 |
| commit | 81ca509d4e874250e23e88225d18b0dccd3898d9 (patch) | |
| tree | e497506650b41778b79c56c31edee7d46a32485a /Mailman/OutgoingQueue.py | |
| parent | ef7b98da0724c58806106d9f674b63d36e31d0ca (diff) | |
| download | mailman-81ca509d4e874250e23e88225d18b0dccd3898d9.tar.gz mailman-81ca509d4e874250e23e88225d18b0dccd3898d9.tar.zst mailman-81ca509d4e874250e23e88225d18b0dccd3898d9.zip | |
code cleanup:
enqueueMessage now uses Utils.open_ex to create queue files in
"active" mode. This saves the process of determining a file's active
vs deferred state the headache of looking at both the files size and
mode. now it can just look at the mode, since files are created in
the correct mode and not created then chmod'ed into the correct mode.
scott
Diffstat (limited to 'Mailman/OutgoingQueue.py')
| -rw-r--r-- | Mailman/OutgoingQueue.py | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/Mailman/OutgoingQueue.py b/Mailman/OutgoingQueue.py index 980fdf830..fbec37e78 100644 --- a/Mailman/OutgoingQueue.py +++ b/Mailman/OutgoingQueue.py @@ -37,6 +37,7 @@ # import os, stat, tempfile, marshal, errno, mm_cfg +import Utils TEMPLATE = "mm_q." # @@ -124,36 +125,34 @@ def enqueueMessage(the_sender, recip, text): tempfile.tempdir = mm_cfg.DATA_DIR tempfile.template = "%s%d." % (TEMPLATE, os.getpid()) fname = tempfile.mktemp() - f = open(fname, "a+") - os.chmod(fname, QF_MODE | stat.S_ISUID) # make sure this is set right off the bat + # + # open the file so that it is setuid upon creation + # + f = Utils.open_ex(fname, "a+", -1, QF_MODE | stat.S_ISUID) marshal.dump((recip,the_sender,text),f) f.close() - os.chmod(fname, QF_MODE | stat.S_ISUID) # just in case .close() changes the perms return fname - # # is this queue entry a deferred one? # def isDeferred(q_entry, st=None): if st is None: st = os.stat(q_entry) - size = st[stat.ST_SIZE] - mode = st[stat.ST_MODE] - if mode & stat.S_ISUID: - return 0 - elif not size: # the file was just opened, but not yet chmod'd + if st[stat.ST_MODE] & stat.S_ISUID: return 0 else: return 1 - + # # given the full path to a q_entry, set the # status to deferred if it is not # already in that state. this function must work # on entries already in a deferred state. +# this function may only be called by the process +# that called enqueueMessage(), since it uses chmod # def deferMessage(q_entry): if not isDeferred(q_entry): |
