Ok, as i received no suggestions, i did some testing with mysql users.
 
It appears you can just add them to the database although be warned: mysql's SHA and james's SHA are different - mysql uses hex format, james appears to use base64 format. So i'm not sure how to deal with that easily.  I wrote a java prog much like DigestUtil (but clean) and have a shell script to create passwords, which i am using from a php admin tool i am writing.
 
As for using @ symbols in usernames, i am using the following:
1. Change line 524 of POP3Handler to: user = argument.replaceAll("@","..at.."); // replace @ with ..at..
2. When assigning users set them up as user..at..domain.com - could be easily programmed to replace @ automatically in admin tool.
 
This actually makes for very simple virtual hosting:
To add/delete a user, simply add/remove two entries in the mail database.
for VirtualUserTable table:
+--------+---------------------+---------------------------------+
| user   | domain              | target_address                  |
+--------+---------------------+---------------------------------+
| daniel | eddie.netcase.co.uk | daniel..at..eddie.netcase.co.uk |
+--------+---------------------+---------------------------------+
 
and a corresponding entry in users:
+---------------------------------+--------------------------+
| username                        | pwdHash                  |
+---------------------------------+--------------------------+
| daniel..at..eddie.netcase.co.uk | oyncbSjXj2twZQKlY0LNr21U |
+---------------------------------+--------------------------+
 
 
Overall, i am highly impressed with james.  I looked for a java alternative after not understanding anything of the configuration files for qmail, sendmail, etc.  I figured a java version would be easier for me to work with as i can understand/modify the source a lot easier and quicker than any C program!
 
I stumbled accross james, and after a bit of playing, i decided to go with it.
 
And, so far, so good!
 
Daniel.
 
-----Original Message-----
From: Daniel Perry [mailto:[EMAIL PROTECTED]
Sent: 01 March 2004 14:51
To: James Users List
Subject: updating users directly from database & @ in username

Firstly thanks to serge for answering my previous question!
 
Now onto my current questions:
 
1. If I want to add a user to James (note I'm using a MySQL database for users and virtual hosting), can I just add them to the database?
Or do I have to use the admin tool to do it?
My only concern is with caching, possible future changes, etc. (not sure if any are relevant).
 
2. On a totally different topic, the accounts moving to the James server are coming from qmail virtual hosts.  These hosts are set up so that an email address is used to log in.  I tried this with James virtual hosting, but it did not work.  From what I could figure, the address e.g. a @ b.com is rewritten to a @ b.com, so nothing is changed.  So after passing through the virtual hosting, James treats it either as local user "a" as "b.com" is a local address.
 
My solution to this is to use set up accounts with the address rewritten to "a..at..b.com" i.e. replace @ with "..at.." assuming that no one will be strange enough to have ..at.. in their address.  Then hack POP3Handler.java and change doUSER so that it looks for @ symbols in usernames and does the same substitution.
 
Can anyone see any problems with this?
Anyone have a better solution?
 
Thanks,
Daniel.

Reply via email to