On Apr 25, 2004, at 4:13 PM, Rick Widmer wrote:
The 'could not open assign file' error is triggered by the fact that the
first call to get_domain_entries( "developersdesk.net" ) returned NULL.
I see two possible ways to solve this problem:


1:  Return just the information about the desired domain alias:
-------------------------------------------------------------------
vdominfo developersdesk.net
domain: developersdesk.net
...
realdomain: developersdesk.com
Note:   developersdesk.net is an alias for developersdesk.com
-------------------------------------------------------------------


2: Return a data block for the parent domain: -------------------------------------------------------------------
vdominfo developersdesk.net
domain: developersdesk.com
...
realdomain: developersdesk.com

domain: developersdesk.net
...
realdomain: developersdesk.com
Note:   developersdesk.net is an alias for developersdesk.com

domain: developersdesk.org
...
realdomain: developersdesk.com
Note:   developersdesk.org is an alias for developersdesk.com
-------------------------------------------------------------------

At first glance, 1 looks to be the right answer. After sleeping on it,
I think I like 2 better because it is the real answer to the question of
"what developersdesk.net really is." It is also easier to implement. I
can just use vget_assign() in vdominfo to retrieve the real domain name
before passing it to get_domain_entries(). 1 requires changing the code
in get_domain_entries().

I agree that two is the better solution.


It might be possible to simply modify get_domain_entries() by adding a few lines (manually typed and not tested):

   if (!*match_buffer || (strcmp (match_buffer, entry.realdomain) == 0))
     return &entry;
+  /* if alias domain matches our search criteria, re-run the search
+     using real domain instead */
+  if (strcmp (match_buffer, entry.domain) == 0)
+  return get_domain_entries (entry.realdomain);

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:

b.com:a.com
a.com:b.com

It should always be:

b.com:b.com
a.com:b.com

Searching for a.com will cancel the search at 'a.com:b.com' and re-run it for b.com. In the first example, it would match b.com:a.com and re-run it for a.com and get in an infinite loop.


-------------------------------------------------------------------
vdominfo developersdesk.com
domain: developersdesk.com
uid:    77
gid:    72
dir:    /mail/domains/developersdesk.com
users:  0
alias: developersdesk.net
alias: developersdesk.org
-------------------------------------------------------------------

-------------------------------------------------------------------
vdominfo developersdesk.net
domain: developersdesk.com
uid:    77
gid:    72
dir:    /mail/domains/developersdesk.com
users:  0
alias: developersdesk.net
alias: developersdesk.org
-------------------------------------------------------------------

Comments?

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.


--
Tom Collins  -  [EMAIL PROTECTED]
QmailAdmin: http://qmailadmin.sf.net/  Vpopmail: http://vpopmail.sf.net/
Info on the Sniffter hand-held Network Tester: http://sniffter.com/



Reply via email to