Quoting Jim Ramsay <[EMAIL PROTECTED]>:

> Stephen Warren wrote:
> 
> > I have a virtual domain setup, but it isn't using
> > vpopmail/whatever - it's basically a custom setup based off some
> > how-to-setup-a-popmail-toaster pages I found on the 'net
> > 
> > My virtual users are stored in e.g.:
> > 
> > /var/qmail/popboxes/wwwdotorg.org/swarren/
> > 
> 
> This seems like an excellent idea for TMDA 0.14!
> 
> > I don't know if the standard virtual user schemes print this information
> > from their script, but a wrapper around the vpopmail system couldn't be
> > that hard, or perhaps vpopmail is such that when calling the vuserinfo
> > script, you've already parsed the login ID into user/domain portions so
> > you can just return it directly? Certainly, the script I use as a
> > vpopmail1 VLOOKUP script accepts user_id and domain arguments, so the
> > information is already there. For the qmailuserassign, it could be
> > modified to search /var/qmail/control/virtualdomains to convert the name
> > in users/assign to domain name.
> 
> Sadly I don't know a lot about how people are implementing virtual users 
> with tmda-cgi... but I think the real problem is how to guess the domain 
> if the user logs in with just a username - no domain given.  If we put 
> that logic in a specific virtual-user-implementation stub instead of 
> within tmda-cgi itself, it would make things a lot more maintaintable. 
> I hate long ugly REs.
> 
> The best solution may be not touching the existing wrappers that exist, 
> but creating a new programs in the stubs directory:
> 
> getdomain-qmailuserassign.py
> getdomain-vmailmgr1.py
> getdomain-vpopmail1.py
> getdomain-xams1.py
> 
> Each of which will, for the virtual user organization in question, take 
> a username as the single argument, and return the domain name as the 
> only output.
> 

I too have a vuser setup just like Stephens  for example, [EMAIL PROTECTED] is
stored at /var/qmail/mailnames/utkalika.net/rtwick and
/var/qmail/control/virtualdomains contains 
utkalika.net:1 (all domains are represented by a numerical value) and
/var/qmail/users/assign has something like 1-rtwick:.....:..:...
I have written a small stub (based on the qmailuserassign stub)  which works
with this setup. If the username is given as [EMAIL PROTECTED] then it parses it into
user /domain and gets the home dir for it from qmail assing file else gets the
hostname from the web url. may be something in the same line can be done? 
 
Here's the stub that i use :

#!/usr/bin/env python
#
# Author  R'twick Niceorgaw <[EMAIL PROTECTED]>
#
"Stub for interfacing to /var/qmail/users/assign"
import sys
import os
import string

def GetPrepend(dom):
        if (dom == None):
                # Strip is used to remove portions from the url to tmda-cgi
                # to get the top level domain ( mine is like tmda.domain.dom 
                #and so i remove only tmda part)

                Strip=1
                HostNames=os.environ["HTTP_HOST"].split(".",Strip)
                myDomain=HostNames[1]
        else:
                myDomain=dom
        VirtualDomains="/var/qmail/control/virtualdomains"
        F=open(VirtualDomains,"r")
        domLine=F.read();
        domList=domLine.split("\n")
        F.close()
        for virtuals in domList:
                parts=virtuals.split(":",1)
                if myDomain == parts[0]:
                        break
        return parts[1]

def getuserparams(List):
  # Find correct item and convert a list returned by
  # "/bin/cat /var/qmail/users/assign" into a dictionary
  UserList=User.split("@")
  if (len(UserList) > 1):
    prepend=GetPrepend(UserList[1])
  else:
    prepend=GetPrepend(None)
  myUser = prepend+'-'+UserList[0]
  Dict = {}
  Proximity = -1
  for Line in List:
    Parts = Line[1:].split(":")
    if (Line[0] == "+") and (Parts[0] == myUser):
      return Parts[4], Parts[2], Parts[3]

  # User does not exist
  raise KeyError



-- 
This is a signature

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
_____________________________________________
tmda-users mailing list ([EMAIL PROTECTED])
http://tmda.net/lists/listinfo/tmda-users

Reply via email to