Re: [vchkpw] Wrong reply-to in SqWebMail for virt domains

2003-07-09 Thread Kiril Todorov
That thingie can be controlled easier if you create the logindomainlist file in the 
sqwebmail directory,
just put the virt domains you want to be browsable trough sqwebmail there - one per 
line

not sure if it will fix your problem thou, first time I see such weird behaviour.
-- 

Kiril Todorov   < -+- > +359 2 9712013
Bulgaria Online < -+- > http://home.online.bg

/* waiting... dreaming... wishing... */



Re: [vchkpw] Wrong reply-to in SqWebMail for virt domains

2003-07-09 Thread gjohnson
So, I found the sqwebmail-config file and can edit it by hand.
Unfortunately, the patch fails on half of the files that it is supposed to
patch, with lines like this,
"Patching file vchkpw.c using Plan A...
Hunk #1 failed at 377."

This issue now appears to me as a SqWebMail bug, and I will report it as
such.

Kiril Todorov writes:

> That's controlled from the sqwebmail-config file, which is in the user's 
> Maildir/.
> Find attached a small patch written by Peter Penchev <[EMAIL PROTECTED]> which 
> creates that file in usercreate time with the proper FROM: setting there.
> 
> I think the patch was designed for vpopmail-5.3.20, not sure if it will need 
> adjusting for different versions.
> Hope that helps!
> -- 
> 
> Kiril Todorov   < -+- > +359 2 9712013
> Bulgaria Online < -+- > http://home.online.bg
> 
> /* waiting... dreaming... wishing... */






Re: [vchkpw] Wrong reply-to in SqWebMail for virt domains

2003-07-09 Thread gjohnson
Doug Clements writes:

> gjohnson wrote:
> > Thanks.  I presume I can apply this patch as I did those for qmail:
> > put in the source directory, use the patch command, and compile, etc.
> > 
> > I will try that after I get a reponse on my next email.  The
> > content of another reponse confused me, and I need some clarification.
> > 
> 
> I assume you mean my mail =)
> 
> I prefer to create wrappers around vpopmail commands instead of patching 
> the source like this. That makes it easier to upgrade when the time 
> comes, and I know exactly what's going on with my modifications.
> 
> Either way will work, I was just suggesting my preferredway.
> 
> --Doug
> 

Yeah. A mildly humorous exchange.
So, I understand your approach, and it appears to work.
I am still puzzled by the bizarre "[EMAIL PROTECTED]" at the
top of the SqWebMail page.




Re: [vchkpw] Wrong reply-to in SqWebMail for virt domains

2003-07-09 Thread Doug Clements
gjohnson wrote:
Thanks.  I presume I can apply this patch as I did those for qmail:
put in the source directory, use the patch command, and compile, etc.
I will try that after I get a reponse on my next email.  The
content of another reponse confused me, and I need some clarification.
I assume you mean my mail =)

I prefer to create wrappers around vpopmail commands instead of patching 
the source like this. That makes it easier to upgrade when the time 
comes, and I know exactly what's going on with my modifications.

Either way will work, I was just suggesting my preferredway.

--Doug




Re: [vchkpw] Wrong reply-to in SqWebMail for virt domains

2003-07-09 Thread Doug Clements
gjohnson wrote:
Doug Clements writes:
Set the sqwebmail prefs for the user when you create the account. They 
include the Reply-To address.

--Doug
Thanks for your reply.  I am working with sqwebmail-3_5_1, vpopmail-5_2_1,
and vqadmin-2_3_2.
When I create an account thus --
su - vpopmail
vadduser [EMAIL PROTECTED] password
exit
 -- I see no option for sqwebmail prefs.  I can not change reply-to with
vqadmin either.  Neither do I see any reply-to or "name-at-the-top" option
in the actual SqWebMail webpage itself.  Only when I send a mail from
the account in SqWebMail can I (permanently) change the reply-to address
(by simply changing the reply-to on that email).
What SqWebMail prefs were you referring to?  Can they be applied
domain-wide, or do I have to go to each virtual user after set up and
change
individually?
Check a user account that you have logged into with sqwebmail. There 
should be a sqwebmail-prefs file there that is a plain text file. You 
can generate this file automatically with the correct preferences at the 
time you create the user. Make a script to fill this file in, and run it 
after you create the user.

I have an elaborate wrapper system that sets up various aspects of each 
user after they get added, including setting initial sqwebmail prefs, 
creating extra folders, setting up Maildrop recipes, and some other fun 
stuff. You might consider creating the same sort of wrapper around 
vadduser so this becomes automatic to you.

Cheers!

--Doug




Re: [vchkpw] Wrong reply-to in SqWebMail for virt domains

2003-07-09 Thread gjohnson
Doug Clements writes:

> gjohnson wrote:
> > Hi.
> > 
> > I have vpopmail, courier-imap and sqwebmail running on OpenBSD 3.3 with
> > apache NOT chrooted.
> > 
> > I have two domains: real.domain and virtual.domain
> > In SqWebMail, virtuser with virtual.domain logs on to SqWebMail thus
> > virtuser%virtual.domain & pass
> > But once logged on they see themselves as
> > "[EMAIL PROTECTED]"
> > which also appears as their reply-to address (until/unless they change it).
> > Naturally, many will not change it.
> > 
> > Real users see [EMAIL PROTECTED] -- so they are fine.
> > I would just like virtusers to see [EMAIL PROTECTED] both at the top
> > of the page and for their reply-to.  Is this possible?  If so, how do I
> > change the virt.domain setting?
> 
> Set the sqwebmail prefs for the user when you create the account. They 
> include the Reply-To address.
> 
> --Doug
> 
Thanks for your reply.  I am working with sqwebmail-3_5_1, vpopmail-5_2_1,
and vqadmin-2_3_2.
When I create an account thus --
su - vpopmail
vadduser [EMAIL PROTECTED] password
exit
 -- I see no option for sqwebmail prefs.  I can not change reply-to with
vqadmin either.  Neither do I see any reply-to or "name-at-the-top" option
in the actual SqWebMail webpage itself.  Only when I send a mail from
the account in SqWebMail can I (permanently) change the reply-to address
(by simply changing the reply-to on that email).

What SqWebMail prefs were you referring to?  Can they be applied
domain-wide, or do I have to go to each virtual user after set up and
change
individually?





Re: [vchkpw] Wrong reply-to in SqWebMail for virt domains

2003-07-09 Thread gjohnson
Thanks.  I presume I can apply this patch as I did those for qmail:
put in the source directory, use the patch command, and compile, etc.

I will try that after I get a reponse on my next email.  The
content of another reponse confused me, and I need some clarification.


Kiril Todorov writes:

> That's controlled from the sqwebmail-config file, which is in the user's 
> Maildir/.
> Find attached a small patch written by Peter Penchev <[EMAIL PROTECTED]> which 
> creates that file in usercreate time with the proper FROM: setting there.
> 
> I think the patch was designed for vpopmail-5.3.20, not sure if it will need 
> adjusting for different versions.
> Hope that helps!
> -- 
> 
> Kiril Todorov   < -+- > +359 2 9712013
> Bulgaria Online < -+- > http://home.online.bg
> 
> /* waiting... dreaming... wishing... */






Re: [vchkpw] Wrong reply-to in SqWebMail for virt domains

2003-07-09 Thread Doug Clements
gjohnson wrote:
Hi.

I have vpopmail, courier-imap and sqwebmail running on OpenBSD 3.3 with
apache NOT chrooted.
I have two domains: real.domain and virtual.domain
In SqWebMail, virtuser with virtual.domain logs on to SqWebMail thus
virtuser%virtual.domain & pass
But once logged on they see themselves as
"[EMAIL PROTECTED]"
which also appears as their reply-to address (until/unless they change it).
Naturally, many will not change it.
Real users see [EMAIL PROTECTED] -- so they are fine.
I would just like virtusers to see [EMAIL PROTECTED] both at the top
of the page and for their reply-to.  Is this possible?  If so, how do I
change the virt.domain setting?
Set the sqwebmail prefs for the user when you create the account. They 
include the Reply-To address.

--Doug




Re: [vchkpw] Wrong reply-to in SqWebMail for virt domains

2003-07-09 Thread Kiril Todorov
That's controlled from the sqwebmail-config file, which is in the user's 
Maildir/.
Find attached a small patch written by Peter Penchev <[EMAIL PROTECTED]> which creates 
that file in usercreate time with the proper FROM: setting there.

I think the patch was designed for vpopmail-5.3.20, not sure if it will need adjusting 
for different versions.
Hope that helps!
-- 

Kiril Todorov   < -+- > +359 2 9712013
Bulgaria Online < -+- > http://home.online.bg

/* waiting... dreaming... wishing... */
--- vchkpw.c.orig   Tue Apr 29 14:24:51 2003
+++ vchkpw.cTue Apr 29 14:24:51 2003
@@ -377,7 +377,7 @@
   if ( vpw->pw_dir == NULL || vpw->pw_dir[0]==0 ) {
 
 /* if making a new directory failed log the error and exit */
-if ( make_user_dir(vpw->pw_name, TheDomain, pw_uid, pw_gid)==NULL){
+if ( make_user_dir(vpw->pw_name, TheDomain, vpw->pw_name, pw_uid, pw_gid)==NULL){
   snprintf(LogLine, LOG_LINE_SIZE, "%s: dir auto create failed [EMAIL 
PROTECTED]:%s", 
 VchkpwLogName, TheUser, TheDomain, IpAddr);
   vlog(VLOG_ERROR_INTERNAL, TheUser, TheDomain, ThePass, 
--- vdelivermail.c.orig Sat Nov  2 22:34:39 2002
+++ vdelivermail.c  Sat Nov  2 22:35:20 2002
@@ -946,7 +946,7 @@
 
 /* If thier directory path is empty make them a new one */
 if ( vpw->pw_dir == NULL || vpw->pw_dir[0]==0 ) {
-if ( make_user_dir(vpw->pw_name, TheDomain, 
+if ( make_user_dir(vpw->pw_name, TheDomain, vpw->pw_name,
TheDomainUid, TheDomainGid)==NULL){
 printf("Auto creation of maildir failed. vpopmail (#5.9.8)\n");
 vexit(100);
--- vpopmail.c.orig Tue Apr 29 14:17:56 2003
+++ vpopmail.c  Tue Apr 29 14:18:01 2003
@@ -328,7 +328,7 @@
 }
   }
 
-  if ( (dir=make_user_dir(username, domain, uid, gid)) == NULL ) {
+  if ( (dir=make_user_dir(username, domain, gecos, uid, gid)) == NULL ) {
 if (verrori != 0 ) return(verrori);
 else return(VA_BAD_U_DIR);
   }
@@ -1453,16 +1453,45 @@
 return &pwent;
 }
 
+char *escape_spaces(const char *s)
+{
+  size_t i, len;
+  char *newstr;
+  
+  /* Count the spaces */
+  for (i = len = 0; s[i]; i++, len++)
+if (s[i] == ' ')
+  len += 2;
+  /* Allocate */
+  newstr = malloc(len + 1);
+  if (newstr == NULL)
+return (NULL);
+  /* Fill */
+  for (i = len = 0; s[i]; i++)
+if (s[i] == ' ') {
+  newstr[len++] = '+';
+  newstr[len++] = '2';
+  newstr[len++] = '0';
+} else {
+  newstr[len++] = s[i];
+}
+  newstr[len] = '\0';
+  return (newstr);
+}
+
 /*
  * figure out where to put the user and
  * make the directories if needed
  */
-char *make_user_dir(char *username, char *domain, uid_t uid, gid_t gid)
+char *make_user_dir(char *username, char *domain, char *gecos,
+   uid_t uid, gid_t gid)
 {
  char *tmpstr;
  char *tmpbuf;
  char *tmpdir;
  struct vqpasswd *mypw;
+ char *fulladdr, *escaped;
+ FILE *cfg;
 
   verrori = 0;
   tmpbuf = malloc(MAX_BUFF);
@@ -1522,6 +1551,35 @@
 return(NULL);
   }
 
+  if ((cfg = fopen("sqwebmail-config", "wt")) == NULL) {
+chdir(tmpbuf); free(tmpbuf); free(tmpdir);
+printf("make_user_dir: error 8\n");
+return(NULL);
+  }
+  if ((escaped = escape_spaces(username)) == NULL) {
+fclose(cfg);
+chdir(tmpbuf); free(tmpbuf); free(tmpdir);
+printf("make_user_dir: error 9\n");
+return(NULL);
+  }
+  if ((fulladdr = malloc(strlen(gecos) + strlen(username) + strlen(domain) + 10)) == 
NULL) {
+fclose(cfg);
+chdir(tmpbuf); free(tmpbuf); free(tmpdir);
+printf("make_user_dir: error 9\n");
+return(NULL);
+  }
+  sprintf(fulladdr, "\"%s <[EMAIL PROTECTED]>\"", gecos, username, domain);
+  if ((escaped = escape_spaces(fulladdr)) == NULL) {
+fclose(cfg);
+chdir(tmpbuf); free(tmpbuf); free(tmpdir);
+printf("make_user_dir: error 10\n");
+return(NULL);
+  }
+  free(fulladdr);
+  fprintf(cfg, "FROM=%s\n", escaped);
+  free(escaped);
+  fclose(cfg);
+  
   chdir("../..");
   r_chown(username, uid, gid);
 
--- vpopmail.h.orig Tue Apr 29 14:21:06 2003
+++ vpopmail.h  Tue Apr 29 14:21:19 2003
@@ -128,7 +128,7 @@
 int update_file(char *, char *);
 int count_rcpthosts();
 int compile_morercpthosts();
-char *make_user_dir(char *username, char *domain, uid_t uid, gid_t gid);
+char *make_user_dir(char *username, char *domain, char *gecos, uid_t uid, gid_t gid);
 int r_mkdir(char *, uid_t uid, gid_t gid);
 struct vqpasswd *vgetent(FILE *);
 int pw_comp(char *, char *, char *, int);
--- vqmaillocal.c.orig  Tue Apr 29 14:24:51 2003
+++ vqmaillocal.c   Tue Apr 29 14:24:51 2003
@@ -895,7 +895,7 @@
   gid_t pw_gid;
 
vget_assign(TheDomain,NULL,0,&pw_uid,&pw_gid);
-if ( make_user_dir(vpw->pw_name, TheDomain, pw_uid, pw_gid)==NULL){
+if ( make_user_dir(vpw->pw_name, TheDomain, vpw->pw_name, pw_uid, 
pw_gid)==NULL){
 printf("Auto creation of maildir failed. vpopmail (#5.9.8)\n");
 vexit(100);
 }