Re: [vchkpw] vpopmaild - PHP object

2004-04-06 Thread Rick Widmer


Marcin Soltysiak wrote:

What is funny, [EMAIL PROTECTED] does not appear in UserList array amd
it

is only account that had quota set.
This may be a new bug.


It seems to be the firt entry on list_users..I've check od few domains and
everyoan behaved same way.


In the ListUsers() function try uncommenting the echos.  Then see if
your missing item appears in the 'extra read returned' entry.  The
'extra reads' are something that I need on my system to keep things in
sync, but I don't understand why they are there.
I have an extra blank line I need to remove, but I don't see it when I
telnet in.
We should probably move to the SourceForge vpopmail-devel list.

   http://lists.sourceforge.net/lists/listinfo/vpopmail-devel

Rick






Re: [vchkpw] vpopmaild - PHP object

2004-04-06 Thread Marcin Soltysiak

- Original Message - 
From: "Marcin Soltysiak" <[EMAIL PROTECTED]>
> > Marcin Soltysiak wrote:
> >
> > > Although I am sysadmin I cannot list users in other domains.
> >
> > I have already reported this to Ken.
> >
> >
> > > What is funny, [EMAIL PROTECTED] does not appear in UserList array
amd
> it
> > > is only account that had quota set.
> >
> > This may be a new bug.
>
> It seems to be the firt entry on list_users..I've check od few domains and
> everyoan behaved same way.

Ok, I've found... the class make unnecessary read from socket between
reading +OK and first entry from list. Same as for list_domains.

Solt



Re: [vchkpw] vpopmaild - PHP object

2004-04-06 Thread Marcin Soltysiak
> Marcin Soltysiak wrote:
>
> > Although I am sysadmin I cannot list users in other domains.
>
> I have already reported this to Ken.
>
>
> > What is funny, [EMAIL PROTECTED] does not appear in UserList array amd
it
> > is only account that had quota set.
>
> This may be a new bug.

It seems to be the firt entry on list_users..I've check od few domains and
everyoan behaved same way.
Solt



Re: [vchkpw] vpopmaild - PHP object

2004-04-06 Thread Rick Widmer


Marcin Soltysiak wrote:

Although I am sysadmin I cannot list users in other domains.
I have already reported this to Ken.


What is funny, [EMAIL PROTECTED] does not appear in UserList array amd it
is only account that had quota set.
This may be a new bug.



Re: [vchkpw] vpopmaild - PHP object

2004-04-06 Thread Marcin Soltysiak

- Original Message - 
From: "Rick Widmer" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, April 06, 2004 12:49 PM
Subject: [vchkpw] vpopmaild - PHP object


> I just uploaded a new PHP object to interface to the vpopmaild daemon.
>
> http://kimberly.developersdesk.com/vpopmaild-php.tar.gz
>
>
> vpopmail.pobj is the source code for the actual object.
>
> README lists all available methods in the object.
>
> example.php is a command line PHP program that tests the object, and
> gives examples of how to use it.
>

Did I miss something:

User info for logged in user: Array
(
[vpopmail_dir] => /home/vpopmail
[uid] => 399
[gid] => 399
[name] => office
[comment] => office
[quota] => NOQUOTA
[dir] => /home/vpopmail/domains/imedia.com.pl/office
[encrypted_password] => $1$L6UBr$.EzXzXSDy1PZiCiNT6Erm.
[clear_text_password] => 
[domain_admin_privileges] => 1
[system_admin_privileges] => 1
)

Domain List: (64)
Array
(

)

Command string: list_users dom1.pl

socket_write returned: 24
read returned: -ERR XXX not authorized for domain

User List: (0)
Command string: list_users dom2.pl

socket_write returned: 24
read returned: -ERR XXX not authorized for domain

User List: (0)
Command string: list_users imedia.com.pl

socket_write returned: 25
read returned: OK

extra read returned:
demo:$1$yUVUM$i4xHyCMsahaaOAAYViuQ81:0:0:0:demo:/home/vpopmail/domains/imedi
a.com.pl/demo:1048576.00:

User List: (12)
Array
(
...
)

Although I am sysadmin I cannot list users in other domains.

What is funny, [EMAIL PROTECTED] does not appear in UserList array amd it
is only account that had quota set.

Solt



[vchkpw] vpopmaild - PHP object

2004-04-06 Thread Rick Widmer
I just uploaded a new PHP object to interface to the vpopmaild daemon.

   http://kimberly.developersdesk.com/vpopmaild-php.tar.gz

vpopmail.pobj is the source code for the actual object.

README lists all available methods in the object.

example.php is a command line PHP program that tests the object, and 
gives examples of how to use it.

example.output is a cut down listing of the example program output on my 
server.  I have 3108 users and 1563 domains in the test data I am using.

The example program requires a CLI (Command Line) version of PHP that 
was ./configured with  enable-streams.  If you add a little HTML, it 
should run to a web browser too.

It now supports all the currently existing functions of vpopmaild that 
return data:

login, user_info, list_dir, read_file, list_domains, list_users, 
get_limits, get_lastauth, get_lastauthip, quit.

I will work on the functions that take action tomorrow:

add_user, del_user, mod_user, add_domain, mk_dir, rm_file, set_limits, 
del_limits.

You can expect them to take parameters like ( $Domain, $User, 
$Whatever... ), always in that order.  Where possible you will be able 
to retrieve an array of data from one of the data return functions, 
adjust the contents of that array and pass it to one of these functions 
to adjust things in the mail system.

There are other functions defined in vpopmaild that don't contain any 
code yet.  I will work on them as soon as I get a version of the daemon 
that actually supports them:

dom_info, write_file, list_lists, get_ip_map, add_ip_map, del_ip_map, 
show_ip_map, add_list, del_list, mod_list.



[vchkpw] vpopmaild -- PHP Object to access it

2004-04-06 Thread Rick Widmer
I have a bit of an object for vpopmaild working.  It will login and 
retrieve the list of users, and domains.  The tarball includes an 
example program.  On my system (a 500MHz PII) running both the daemon 
and this program it retrieved 3108 users from a single domain in 10.23 
seconds, and 1563 domains in 0.90 seconds.  I am using CDB.

You can download it here:

   http://kimberly.developersdesk.com/vpopmaild-php.tar.gz

Right now it is based on the initial distribution of vpopmaild, and 
works around the bug I found in list_users.  (Missing +)



The functions I have working so far are listed below:

===

The constructor:

function vpopmaild( $Domain, $User, $Password, $Host='localhost', 
$Port=89 )  {

$Domain, $User, $Password represent the user you want to login as.
$Host and $Port are optional, with defaults.  You should check for
an error message with the error_message() function after attempting
to create a vpopmaild object.  If there is an error present, you
can't do anything else.
===

function Quit() {

You should call this before exiting the program to give the server
a chance to clean up gracefully.  The world probably won't end if
you don't but it is possible that sessions will be closed faster
if you do.
===

function error_message() {

Return the most recent error message, if any, from vpopmaild
operations.  This message will be text, ready for display.
===

function GetLoginUser()  {

Retrive an array full of information about the currently logged in
user.
Array (
[vpopmail_dir] => /mail
[uid] => 77
[gid] => 72
[name] => postmaster
[comment] => Postmaster
[quota] => NOQUOTA
[dir] => /mail/domains/test.com/postmaster
[encrypted_password] => $1$zkJe.3SH$7HOl1RbwfKcibL67iXjsh/
[clear_text_password] => password
[domain_admin_privileges] => 1
[system_admin_privileges] => 1
)
===

function ListUsers( $Domain ) {

Retrieve an array full of information about a domain.  You must be
a system admin to list any domain, or the domain admin of the domain
you wish to list.  The users are in alpha order by Username.
Array (
[04wcyrti] => Array
(
[passwd] => $1$cBacCPRA$LxzczMu7dpn5KjZphYPKU0
[uid] => 1
[gid] => 0
[flags] => 0
[gecos] => Brigitte
[dir] => /mail/domains/test.com/9/04wcyrti
[shell] => NOQUOTA
[clear_pw] => Fisher
)
[095wvsp] => Array
(
[passwd] => $1$2lpyyZHz$XmcuvLSZDbOnIaDD9Yf93.
[uid] => 1
[gid] => 0
[flags] => 0
[gecos] => Antone
[dir] => /mail/domains/test.com/F/095wvsp
[shell] => NOQUOTA
[clear_pw] => Winn
)
)
There is a problem with the program I used to load the addresses which 
caused the last name to appear in the clear_pw field.  The program is 
reflecting what is stored in the files.  Spam is useful for something, I 
built all these test users and domains from the spam I got over a week 
or two.  :)

===

function ListDomains( $Sort = 'HDT' ) {

Retrieve an array full of information about a domain.  You must be
a system admin to use this call.
Order to display domains:

  TDH  = top-level, mid-level, host
  DTH  = mid-level, top-level, host
  HDT  = host, mid-level, top-level
where you usually see

   host.mid-level.top-level

   mail.developersdesk.com

Want all the .com together - use TDH
Want domain.com, domain.net, domain.org together - use DTH
Want them all mixed up in host name order - use HDT
If DomainOrder is not specified, you get HDT.

This example data uses DTH mode.  The data is DomainName => ParentName,
If they both match, the domain is real, if they are different it
is an alias of ParentName.
Array
(
[0-0-mydomain.com] => 0-0-mydomain.com
[0-0-mydomain.net] => 0-0-mydomain.com
[0-0-mydomain.org] => 0-0-mydomain.com
[0800commerce.nl] => 0800commerce.nl
[fun.21cn.com] => fun.21cn.com
[private.21cn.com] => private.21cn.com
[263.net] => 263.net
[2dayhealth.com] => 2dayhealth.com
)
===

The next two functions are used to create the login user information
block, and may get merged into the constructor, unless they are useful
parsing other incoming structures.
function ParseUser( $UserBlock ) {

function ReadBlock( &$List ) {