imap admin access with python's imaplib
Posted: Fri Jun 08, 2012 10:40 am
google search 'imap admin access' returns this post.
at first, I think python's imaplib.proxyauth is the intuitive way.
so here is the demo code:
hostname, username, password = get_config()
conn = imaplib.IMAP4_SSL(hostname)
typ, cap = conn.login(username, password) # username is a admin
conn.proxyauth("user1")
however, proxyauth raise a error "imaplib.error: PROXYAUTH command error: BAD ['parse error: command not implemented']
after some debuging, it seems the line "conn.login(username, password)" will translated to send the tcp string 'PALI1 LOGIN username "password"
', this works. and the line "conn.proxyauth("user1")" will translated to 'PALI2 PROXYAUTH user1
', and it failed.
so I wonder how imapsync, as this post said, knows to do this delegated authentication.
imapsync's "imapsync --host1 source.server.com --user1 username --authuser1 adminusername --password1 adminpassword " will translated to what TCP protocal string?
at first, I think python's imaplib.proxyauth is the intuitive way.
so here is the demo code:
hostname, username, password = get_config()
conn = imaplib.IMAP4_SSL(hostname)
typ, cap = conn.login(username, password) # username is a admin
conn.proxyauth("user1")
however, proxyauth raise a error "imaplib.error: PROXYAUTH command error: BAD ['parse error: command not implemented']
after some debuging, it seems the line "conn.login(username, password)" will translated to send the tcp string 'PALI1 LOGIN username "password"
', this works. and the line "conn.proxyauth("user1")" will translated to 'PALI2 PROXYAUTH user1
', and it failed.
so I wonder how imapsync, as this post said, knows to do this delegated authentication.
imapsync's "imapsync --host1 source.server.com --user1 username --authuser1 adminusername --password1 adminpassword " will translated to what TCP protocal string?