From: Lewis B. <lbe...@ab...> - 2001-02-04 20:11:18
|
OK, so I had a dream, but that wasn't a famous line. I was dreaming last night about the virtual hosting stuff on the last night. I was wondering about something like this. All the following is psuedo code since I just dreamed it up. 1. $domain in config.php would be set to "virtual()" if the admin wanted to enable this feature. 2. virtual() would be a class that used DNS to check a new set of vars in the config if someone sets up virtual. These new vars: $dns[0] = 'primary_name_server'; $dns[1] = 'secondary_name_server': 3. once gaining these vars we do something along the lines of the following to dynamically set the value of $domain and $mailserver in the session class virtual{ var function getdom($user){ //I don't remember the string function that I can // use to search for '@' in $string and save all after it // but I am sure there is one } function virtual($dns, $user) // open a socket to the name server foreach($dns as $key => $ns){ if (isset($ns)){ if($_virtsock = fopen($ns, 53)){ break 3; // I have never used break out of switch so I don't // know if this works. } } else { print _("No DNS servers available, how did you get here?"); exit; } } // get the vdom's mx // I don't know the actual form of the request $tempDom = getdom(&user); fwrites($_virtsock, "query MX $tempDom"); $_dnsquery = fgets($_virtsock); $mailserver = $_dnsquery; session_register('mailserver'); $domain = $tempDom; session_register('domain'); } I don't know about sm1 but I can't see why sm2 couldn't use something along these lines. The advantages to using DNS is that it means you don't have to set up sm for a new virtual domain. Once it is in your dns it is ready. The big hole here is that a way needs to be figured out so that the dns response from the server is only for domains you host. This shouldn't be to bad since there must be a command to tell or a response from the server based on the zone files it contains. I will have to look into this. If this isn't checked you would be providing anyone web based email who had an account on a public IP space since we would be asking dns to find a server no matter where it was. Like I said, I just dreameed this up last night and haven't really put it through the "plausability ringer" yet so your thoughts are welcome. |