summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorviega1998-05-30 16:15:08 +0000
committerviega1998-05-30 16:15:08 +0000
commit28f8e182ad5ac9eabae4a9fb6aed6b8ec3db71e3 (patch)
treed585587983618c2552c4cbc24b2ef9b73115b44d
parent801e9a70e41c85b8e91fd074020166944e419363 (diff)
downloadmailman-28f8e182ad5ac9eabae4a9fb6aed6b8ec3db71e3.tar.gz
mailman-28f8e182ad5ac9eabae4a9fb6aed6b8ec3db71e3.tar.zst
mailman-28f8e182ad5ac9eabae4a9fb6aed6b8ec3db71e3.zip
-rw-r--r--Mailman/Crypt.py8
-rw-r--r--Mailman/Makefile.in2
-rw-r--r--Mailman/SecurityManager.py8
-rw-r--r--modules/Makefile.in2
-rw-r--r--modules/mm_crypt.py8
-rw-r--r--modules/mm_security.py8
6 files changed, 26 insertions, 10 deletions
diff --git a/Mailman/Crypt.py b/Mailman/Crypt.py
new file mode 100644
index 000000000..f495cdd2c
--- /dev/null
+++ b/Mailman/Crypt.py
@@ -0,0 +1,8 @@
+try:
+ from crypt import *
+except ImportError:
+ def crypt(string, seed):
+ import md5
+ m = md5.new()
+ m.update(string)
+ return m.digest() \ No newline at end of file
diff --git a/Mailman/Makefile.in b/Mailman/Makefile.in
index 49d69bd26..373f5a6c8 100644
--- a/Mailman/Makefile.in
+++ b/Mailman/Makefile.in
@@ -46,7 +46,7 @@ MODULES= __init__.py aliases.py htmlformat.py maillist.py \
mm_admin.py mm_archive.py mm_bouncer.py mm_defaults.py \
mm_deliver.py mm_digest.py mm_err.py mm_html.py mm_mailcmd.py \
mm_mbox.py mm_message.py mm_security.py mm_utils.py \
-mm_pending.py pipermail.py smtplib.py versions.py
+mm_pending.py mm_crypt.py pipermail.py smtplib.py versions.py
# Modes for directories and executables created by the install
# process. Default to group-writable directories but
diff --git a/Mailman/SecurityManager.py b/Mailman/SecurityManager.py
index f487f4c13..be7f75130 100644
--- a/Mailman/SecurityManager.py
+++ b/Mailman/SecurityManager.py
@@ -18,7 +18,7 @@
"""Handle passwords and sanitize approved messages."""
-import crypt, types, string, os
+import mm_crypt, types, string, os
import mm_err, mm_utils, mm_cfg
# TBD: is this the best location for the site password?
@@ -29,7 +29,7 @@ class SecurityManager:
def SetSiteAdminPassword(self, pw):
old = os.umask(0022)
f = open(SITE_PW_FILE, "w+")
- f.write(crypt.crypt(pw, mm_utils.GetRandomSeed()))
+ f.write(mm_crypt.crypt(pw, mm_utils.GetRandomSeed()))
f.close()
os.umask(old)
@@ -38,7 +38,7 @@ class SecurityManager:
f = open(SITE_PW_FILE, "r+")
pw = f.read()
f.close()
- return crypt.crypt(str, pw) == pw
+ return mm_crypt.crypt(str, pw) == pw
# There probably is no site admin password if there was an exception
except:
return 0
@@ -55,7 +55,7 @@ class SecurityManager:
if self.CheckSiteAdminPassword(pw):
return 1
return ((type(pw) == types.StringType) and
- (crypt.crypt(pw, self.password) == self.password))
+ (mm_crypt.crypt(pw, self.password) == self.password))
def ConfirmAdminPassword(self, pw):
if(not self.ValidAdminPassword(pw)):
diff --git a/modules/Makefile.in b/modules/Makefile.in
index 49d69bd26..373f5a6c8 100644
--- a/modules/Makefile.in
+++ b/modules/Makefile.in
@@ -46,7 +46,7 @@ MODULES= __init__.py aliases.py htmlformat.py maillist.py \
mm_admin.py mm_archive.py mm_bouncer.py mm_defaults.py \
mm_deliver.py mm_digest.py mm_err.py mm_html.py mm_mailcmd.py \
mm_mbox.py mm_message.py mm_security.py mm_utils.py \
-mm_pending.py pipermail.py smtplib.py versions.py
+mm_pending.py mm_crypt.py pipermail.py smtplib.py versions.py
# Modes for directories and executables created by the install
# process. Default to group-writable directories but
diff --git a/modules/mm_crypt.py b/modules/mm_crypt.py
new file mode 100644
index 000000000..f495cdd2c
--- /dev/null
+++ b/modules/mm_crypt.py
@@ -0,0 +1,8 @@
+try:
+ from crypt import *
+except ImportError:
+ def crypt(string, seed):
+ import md5
+ m = md5.new()
+ m.update(string)
+ return m.digest() \ No newline at end of file
diff --git a/modules/mm_security.py b/modules/mm_security.py
index f487f4c13..be7f75130 100644
--- a/modules/mm_security.py
+++ b/modules/mm_security.py
@@ -18,7 +18,7 @@
"""Handle passwords and sanitize approved messages."""
-import crypt, types, string, os
+import mm_crypt, types, string, os
import mm_err, mm_utils, mm_cfg
# TBD: is this the best location for the site password?
@@ -29,7 +29,7 @@ class SecurityManager:
def SetSiteAdminPassword(self, pw):
old = os.umask(0022)
f = open(SITE_PW_FILE, "w+")
- f.write(crypt.crypt(pw, mm_utils.GetRandomSeed()))
+ f.write(mm_crypt.crypt(pw, mm_utils.GetRandomSeed()))
f.close()
os.umask(old)
@@ -38,7 +38,7 @@ class SecurityManager:
f = open(SITE_PW_FILE, "r+")
pw = f.read()
f.close()
- return crypt.crypt(str, pw) == pw
+ return mm_crypt.crypt(str, pw) == pw
# There probably is no site admin password if there was an exception
except:
return 0
@@ -55,7 +55,7 @@ class SecurityManager:
if self.CheckSiteAdminPassword(pw):
return 1
return ((type(pw) == types.StringType) and
- (crypt.crypt(pw, self.password) == self.password))
+ (mm_crypt.crypt(pw, self.password) == self.password))
def ConfirmAdminPassword(self, pw):
if(not self.ValidAdminPassword(pw)):