Update of /cvsroot/tmda/tmda/bin
In directory usw-pr-cvs1:/tmp/cvs-serv7728/bin

Modified Files:
        ChangeLog tmda-ofmipd 
Log Message:
Add support for APOP authentication over pop3.

Index: ChangeLog
===================================================================
RCS file: /cvsroot/tmda/tmda/bin/ChangeLog,v
retrieving revision 1.226
retrieving revision 1.227
diff -u -r1.226 -r1.227
--- ChangeLog   2 Sep 2002 01:23:53 -0000       1.226
+++ ChangeLog   4 Sep 2002 03:08:51 -0000       1.227
@@ -1,3 +1,8 @@
+2002-09-03  Jason R. Mastaler  <[EMAIL PROTECTED]>
+
+       * tmda-ofmipd (run_remoteauth): Add support for APOP
+       authentication over pop3.
+
 2002-09-01  Jason R. Mastaler  <[EMAIL PROTECTED]>
 
        * tmda-ofmipd: Add -R option for authentication against a pop3,

Index: tmda-ofmipd
===================================================================
RCS file: /cvsroot/tmda/tmda/bin/tmda-ofmipd,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- tmda-ofmipd 2 Sep 2002 01:23:53 -0000       1.14
+++ tmda-ofmipd 4 Sep 2002 03:08:51 -0000       1.15
@@ -58,9 +58,13 @@
     -R proto[://host[:port]]
     --remoteauth proto[://host[:port]]
         Host to connect to to check username and password.
-        - proto can be one of imap, imaps (ssl) or pop3
+        - proto can be one of the following:
+         `imap' (IMAP4 server)
+         'imaps' (IMAP4 server over SSL)
+         `pop3' (POP3 server)
+         `apop' (POP3 server with APOP authentication)
         - host defaults to localhost
-        - port defaults to 143 (imap), 993 (imaps) or 110 (pop3)
+        - port defaults to 143 (imap), 993 (imaps) or 110 (pop3/apop)
         Example: -R imaps://myimapserver.net
 
     -A <program>
@@ -127,6 +131,7 @@
                }
 defaultauthports = { 'imap':  143,
                      'imaps': 993,
+                     'apop': 110,
                      'pop3':  110,
                      #                     'pop3s': 995,
                      }
@@ -213,7 +218,7 @@
         remoteauth['proto'] = authproto
         remoteauth['port'] = defaultauthports[authproto]
         if authproto not in defaultauthports.keys():
-            raise ValueError, 'Protocole not supported: ' + authproto + \
+            raise ValueError, 'Protocol not supported: ' + authproto + \
                     '\nPlease pick one of ' + repr(defaultauthports.keys())
         if arg:
             try:
@@ -356,21 +361,7 @@
             return 1
         except:
             print >> DEBUGSTREAM, "imap connection to %s@%s failed" % \
-                    (username, remoteauth['host'])
-            return 0
-    elif remoteauth['proto'] == 'pop3':
-        import poplib
-        if remoteauth['port']:
-            port = int(remoteauth['port'])
-        M = poplib.POP3(remoteauth['host'], port)
-        try:
-            M.user(username)
-            M.pass_(password)
-            M.quit()
-            return 1
-        except:
-            print >> DEBUGSTREAM, "pop3 connection to %s@%s failed" % \
-                    (username, remoteauth['host'])
+                  (username, remoteauth['host'])
             return 0
     elif remoteauth['proto'] == 'imaps':
         import imaplib
@@ -383,7 +374,26 @@
             return 1
         except:
             print >> DEBUGSTREAM, "imaps connection to %s@%s failed" % \
-                    (username, remoteauth['host'])
+                  (username, remoteauth['host'])
+            return 0
+    elif remoteauth['proto'] in ('pop3', 'apop'):
+        import poplib
+        if remoteauth['port']:
+            port = int(remoteauth['port'])
+        M = poplib.POP3(remoteauth['host'], port)
+        try:
+            if remoteauth['proto'] == 'pop3':
+                M.user(username)
+                M.pass_(password)
+                M.quit()
+                return 1
+            else:
+                M.apop(username, password)
+                M.quit()
+                return 1
+        except:
+            print >> DEBUGSTREAM, "pop3 connection to %s@%s failed" % \
+                  (username, remoteauth['host'])
             return 0
     # proto not implemented
     print >> DEBUGSTREAM, "Error: protocole %s not implemented" % \

_______________________________________
tmda-cvs mailing list
http://tmda.net/lists/listinfo/tmda-cvs

Reply via email to