Tom Collins wrote:
It might be possible to simply modify get_domain_entries() by adding a few lines (manually typed and not tested):
With a screwy users/assign file, you will get weird results. You need to be sure that all "real" domains are only aliased to themselves.
For example, this would be bad:
How about if I just do a vget_assign() on the incoming domain name (if not "") and always know I am working from the parent. That way there is no recursive call, and we always make exactly one full pass through the users/assign file.
The calling function will have to know it can't expect the parent domain to be the first one returned, and must watch for it. All alias domains will have all information filled in. That shouldn't be much of a problem. I plan to store all the alias domain names into an array as they are encountered then dump the data after get_domain_entries() stops returning results.
I agree that this is a preferred format. Also, if it doesn't already do so, vdominfo should exit non-zero if the domain doesn't exist. That way, shell script can run it, ignore the output and check the exit code to see if it's a valid domain for that server.
OK. Do you want different results for 'Domain is a parent' and 'Domain is an alias' as well as 'Domain does not exist'? Maybe return +1 for Domain is an Alias and -12 for Domain doesn't exist, and -37 for Cannot read assign file.
+They are actually sorted as if they were written like this: + +developersdesk.com.mail + +I bet for most people that tends to group customers together.
What about countries like Australia and England:
smh.com.au amazon.co.uk
There is already an ifdef that selects between this order and
com.developersdesk.mail
If you have mostly country codes, that would be your preferred sort. I suspect it should be fairly easy to select between these two sorts with a configure option. More than two sort options might be tricky.