Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 2 > Tips/Tricks/Mods

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Thread Tools Display Modes
Old 14th January 2008, 20:35
catdude catdude is offline
Senior Member
Join Date: Jun 2007
Posts: 178
Thanks: 1
Thanked 12 Times in 11 Posts
Default pw2db.pl replacement script

I initially installed the pw2db.pl script that I found recommended on one of threads in this forum. For those who don't use it, it's a script that builds Courier's userdb table from the contents of the /etc/passwd and /etc/shadow files.

The stock version works well enough, but has some limitations that bit me: if you have some long domain names, pw2db.pl maps the system user to a trucated e-mail address, not the full e-mail address. And if you use a user prefix of WEBID instead of DOMAIN, it get's really confused

I wrote a replacement for this script. You can find it at http://www.iowatelecom.net/~mahoneyf/scripts. It's written in Python, so you'll need to have python installed. It also reads ISPConfig's database to build user e-mail addresses, so you also need to have the MySQLdb python module (http://sourceforge.net/projects/mysql-python) installed.

Falko and Till, I am querying isp_isp_web, isp_isp_user, and isp_dep to get the information I need. In my query I'm hard-coding "child_doctype_id = 1014" when I'm looking for isp_isp_user records and "parent_doctype_id = 1013" when I'm linking to isp_web records. Is it safe to do this, or should I actually go to the trouble of doing a lookup against "doctype" to determine the doctype_id for "isp_user" and "isp"web"?

Also, the query I use to determine the domain name for a given user is:
"SELECT web_domain FROM isp_isp_web, isp_dep, \
isp_isp_user WHERE user_username = <sys user name> AND \
isp_dep.child_doc_id = isp_isp_user.doc_id AND \
isp_dep.child_doctype_id = 1014 AND \
isp_dep.parent_doc_id = isp_isp_web.doc_id AND \
isp_dep.parent_doctype_id = 1013"
The query I use to determine the user name part of the e-mail address is:
"SELECT user_email FROM isp_isp_user \
WHERE user_username = '<sys user name>'"
Can you confirm that are indeed the proper queries to be using for these purposes?
Reply With Quote
Sponsored Links
Old 15th January 2008, 09:10
till till is offline
Super Moderator
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 37,022
Thanks: 840
Thanked 5,654 Times in 4,463 Posts

Is it safe to do this, or should I actually go to the trouble of doing a lookup against "doctype" to determine the doctype_id for "isp_user" and "isp"web"?
Thats safe, the docytpe ID's will not change in future. The queries look fine.
Till Brehm
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sql ledger using forum.. yurtboy1 General 19 25th December 2010 22:08
[SHELL] script in script mopsos Programming/Scripts 3 8th August 2007 14:42
apache2 problem laser144 Server Operation 8 15th March 2007 18:32
.flx script replacement teves Installation/Configuration 15 23rd January 2007 19:30
Executing ICON script lawson Programming/Scripts 3 28th December 2005 21:51

All times are GMT +2. The time now is 23:04.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.