RE: adding users via script

2002-03-10 Thread Jeff Bert

Birger, the script worked after I changed the method of how I installed the
Cyrus IMAP server.  Sadly, I was only able to connect to it once and after
that locked out.  Dunno what to do other than start a new thread.

Jeff

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED]]On Behalf Of Birger
 Toedtmann
 Sent: Saturday, March 09, 2002 6:27 AM
 To: Jeff Bert
 Cc: [EMAIL PROTECTED]
 Subject: Re: adding users via script


 Jeff Bert schrieb am Fri, Mar 08, 2002 at 11:04:43AM -0800:
  Thanks all but it looks like the perl stuff is somewhat broken,
 cyradm works
  from the command line but everytime I run any of the scripts
 I've been sent
  I get this error:
 
  Use of uninitialized value in subroutine entry at
  /usr/lib/perl5/site_perl/5.6.1/i386-linux/Cyrus/IMAP/Admin.pm line 78.
 
  One thing to note, when I compiled and installed
 cyrus-imapd-2.0.16 the perl
  modules Cyrus:IMAP ended up in /usr/local/lib/ but my perl is
  /usr/lib/perl5/... and cyradm didn't work until I copied the
 Cyrus folder
  with IMAP.pm etc. over to my perl install.
 
  so after I manually moved the modules then i could get cyradm
 to work. but
  the perl scripts trying to access the Cyrus::IMAP modules don't seem to.

 Are you sure?  The

   Use of uninitialized value in subroutine entry

 is just a warning and may (!) not say anything about the work done by
 the script.  Did you try to add a user and have a look at the cyrus
 structures afterwards?


 Regards,

 Birger





RE: adding users via script

2002-03-10 Thread Jeff Bert

Ok, i figured this out, i'm such a bonehead!!!  The big problem was that I
had commented out the non-TLS pop and imap lines in cyrus.conf.  when I do
that and don't specify a working port it gets a connection refused.  DOH!
now that I know what has been going on.  I was thinking this was an install
problem (as I kept using my first cyrus.conf that I editted and never copied
over it) and re-installed cyrus about 20 times.  too d*** funny... i guess i
deserver that pain but now i've learned.  phew!

your script works fine.  thanks!

Jeff

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED]]On Behalf Of Jeff Bert
 Sent: Sunday, March 10, 2002 4:39 AM
 To: [EMAIL PROTECTED]
 Subject: RE: adding users via script


 Birger, the script worked after I changed the method of how I
 installed the
 Cyrus IMAP server.  Sadly, I was only able to connect to it once and after
 that locked out.  Dunno what to do other than start a new thread.

 Jeff

  -Original Message-
  From: [EMAIL PROTECTED]
  [mailto:[EMAIL PROTECTED]]On Behalf Of Birger
  Toedtmann
  Sent: Saturday, March 09, 2002 6:27 AM
  To: Jeff Bert
  Cc: [EMAIL PROTECTED]
  Subject: Re: adding users via script
 
 
  Jeff Bert schrieb am Fri, Mar 08, 2002 at 11:04:43AM -0800:
   Thanks all but it looks like the perl stuff is somewhat broken,
  cyradm works
   from the command line but everytime I run any of the scripts
  I've been sent
   I get this error:
  
   Use of uninitialized value in subroutine entry at
   /usr/lib/perl5/site_perl/5.6.1/i386-linux/Cyrus/IMAP/Admin.pm
 line 78.
  
   One thing to note, when I compiled and installed
  cyrus-imapd-2.0.16 the perl
   modules Cyrus:IMAP ended up in /usr/local/lib/ but my perl is
   /usr/lib/perl5/... and cyradm didn't work until I copied the
  Cyrus folder
   with IMAP.pm etc. over to my perl install.
  
   so after I manually moved the modules then i could get cyradm
  to work. but
   the perl scripts trying to access the Cyrus::IMAP modules
 don't seem to.
 
  Are you sure?  The
 
Use of uninitialized value in subroutine entry
 
  is just a warning and may (!) not say anything about the work done by
  the script.  Did you try to add a user and have a look at the cyrus
  structures afterwards?
 
 
  Regards,
 
  Birger
 






Re: adding users via script

2002-03-09 Thread Birger Toedtmann

Jeff Bert schrieb am Fri, Mar 08, 2002 at 11:04:43AM -0800:
 Thanks all but it looks like the perl stuff is somewhat broken, cyradm works
 from the command line but everytime I run any of the scripts I've been sent
 I get this error:
 
 Use of uninitialized value in subroutine entry at
 /usr/lib/perl5/site_perl/5.6.1/i386-linux/Cyrus/IMAP/Admin.pm line 78.
 
 One thing to note, when I compiled and installed cyrus-imapd-2.0.16 the perl
 modules Cyrus:IMAP ended up in /usr/local/lib/ but my perl is
 /usr/lib/perl5/... and cyradm didn't work until I copied the Cyrus folder
 with IMAP.pm etc. over to my perl install.
 
 so after I manually moved the modules then i could get cyradm to work. but
 the perl scripts trying to access the Cyrus::IMAP modules don't seem to.

Are you sure?  The 

  Use of uninitialized value in subroutine entry

is just a warning and may (!) not say anything about the work done by
the script.  Did you try to add a user and have a look at the cyrus 
structures afterwards?


Regards,

Birger



Re: adding users via script

2002-03-08 Thread Birger Toedtmann

Jeff Bert schrieb am Fri, Mar 08, 2002 at 08:02:44AM -0800:
 I'm trying to find a script that will allow me to add users via a single
 command line entry.
 
 I found imapcreate.pl at sourceforge but it seems to choke on every call
 to the Cyrus::IMAP libraries.
 
 Has anyone done something like this or modified this perl script to work?

I had this tiny one for testing, maybe you find it useful (but is perl as
well and uses Cyrus::IMAP, so if they are broken, you're lost)


Regards,

Birger


#!/usr/bin/perl

# creates new cyrus users with admin account of dummy (change this!)
# usage: echo user | ./cyrus-adduser.pl
#or: cat file with userlist | ./cyrus-adduser.pl

use Cyrus::IMAP::Admin;
use Getopt::Std;
our($opt_h, $opt_p);

$admin = dummy;
$adminpass = dummypass;

my $client = Cyrus::IMAP::Admin-new('localhost');
$client-authenticate(-mechanism, login, -user, $admin, -password, 
$adminpass);
while () {
  chop;
  $client-create(user.$_);
}




Re: adding users via script

2002-03-08 Thread Steven M Bloomfield

here's something really simple i threw together, hope it helps.

#!/usr/local/bin/perl -w
# Really simple create mailbox script
# by Steven Bloomfield - [EMAIL PROTECTED]
#
# This script only creates a new mailbox, I use MySQL for authentication
# to execute from command line
# perl /path/to/adduser.pl username
# to execute within a PHP script
# ?exec (perl /path/to/adduser.pl .$login);?
# I used $login as a variable passed from a form
# To see this script in action visit http://mail.manchester.com
# Thanks to david eitzinger for help with authenticating pam-mysql database

use Cyrus::IMAP::Admin;

# hostname of IMAP server
$server = localhost;

# user and password for cyradm
$user = cyrususername;
$pass = cyruspassword;

# Authenticate
my $cyrus = Cyrus::IMAP::Admin-new($server);
$cyrus-authenticate(-mechanism = 'login', -user = $user, -password =
$pass);
die $cyrus-error if $cyrus-error;

$adduser = $ARGV[0];
$quota = 2000;
my $mbox = 'user.' . $adduser;

# Create the account
print STDERR Creating $mbox on \n if $debug;
$cyrus-createmailbox($mbox);
warn $cyrus-error if $cyrus-error;
# Set the quota
if ($quota)
 {
  print STDERR Setting quota for $mbox to $quota\n if $debug;
  $cyrus-setquota($mbox, 'STORAGE', $quota);
  warn $cyrus-error if $cyrus-error;
}


- Original Message -
From: Birger Toedtmann [EMAIL PROTECTED]
To: Jeff Bert [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Friday, March 08, 2002 4:30 PM
Subject: Re: adding users via script


Jeff Bert schrieb am Fri, Mar 08, 2002 at 08:02:44AM -0800:
 I'm trying to find a script that will allow me to add users via a single
 command line entry.

 I found imapcreate.pl at sourceforge but it seems to choke on every call
 to the Cyrus::IMAP libraries.

 Has anyone done something like this or modified this perl script to work?

I had this tiny one for testing, maybe you find it useful (but is perl as
well and uses Cyrus::IMAP, so if they are broken, you're lost)


Regards,

Birger






RE: adding users via script

2002-03-08 Thread Jeff Bert

Thanks all but it looks like the perl stuff is somewhat broken, cyradm works
from the command line but everytime I run any of the scripts I've been sent
I get this error:

Use of uninitialized value in subroutine entry at
/usr/lib/perl5/site_perl/5.6.1/i386-linux/Cyrus/IMAP/Admin.pm line 78.

One thing to note, when I compiled and installed cyrus-imapd-2.0.16 the perl
modules Cyrus:IMAP ended up in /usr/local/lib/ but my perl is
/usr/lib/perl5/... and cyradm didn't work until I copied the Cyrus folder
with IMAP.pm etc. over to my perl install.

so after I manually moved the modules then i could get cyradm to work. but
the perl scripts trying to access the Cyrus::IMAP modules don't seem to.

Jeff

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED]]On Behalf Of Steven M
 Bloomfield
 Sent: Friday, March 08, 2002 8:49 AM
 To: Birger Toedtmann; Jeff Bert
 Cc: [EMAIL PROTECTED]
 Subject: Re: adding users via script


 here's something really simple i threw together, hope it helps.

 #!/usr/local/bin/perl -w
 # Really simple create mailbox script
 # by Steven Bloomfield - [EMAIL PROTECTED]
 #
 # This script only creates a new mailbox, I use MySQL for authentication
 # to execute from command line
 # perl /path/to/adduser.pl username
 # to execute within a PHP script
 # ?exec (perl /path/to/adduser.pl .$login);?
 # I used $login as a variable passed from a form
 # To see this script in action visit http://mail.manchester.com
 # Thanks to david eitzinger for help with authenticating
 pam-mysql database

 use Cyrus::IMAP::Admin;

 # hostname of IMAP server
 $server = localhost;

 # user and password for cyradm
 $user = cyrususername;
 $pass = cyruspassword;

 # Authenticate
 my $cyrus = Cyrus::IMAP::Admin-new($server);
 $cyrus-authenticate(-mechanism = 'login', -user = $user, -password =
 $pass);
 die $cyrus-error if $cyrus-error;

 $adduser = $ARGV[0];
 $quota = 2000;
 my $mbox = 'user.' . $adduser;

 # Create the account
 print STDERR Creating $mbox on \n if $debug;
 $cyrus-createmailbox($mbox);
 warn $cyrus-error if $cyrus-error;
 # Set the quota
 if ($quota)
  {
   print STDERR Setting quota for $mbox to $quota\n if $debug;
   $cyrus-setquota($mbox, 'STORAGE', $quota);
   warn $cyrus-error if $cyrus-error;
 }


 - Original Message -
 From: Birger Toedtmann [EMAIL PROTECTED]
 To: Jeff Bert [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Sent: Friday, March 08, 2002 4:30 PM
 Subject: Re: adding users via script


 Jeff Bert schrieb am Fri, Mar 08, 2002 at 08:02:44AM -0800:
  I'm trying to find a script that will allow me to add users via a single
  command line entry.
 
  I found imapcreate.pl at sourceforge but it seems to choke on
 every call
  to the Cyrus::IMAP libraries.
 
  Has anyone done something like this or modified this perl
 script to work?

 I had this tiny one for testing, maybe you find it useful (but is perl as
 well and uses Cyrus::IMAP, so if they are broken, you're lost)


 Regards,

 Birger