1 message in net.sourceforge.lists.courier-sqwebmailRe: [sqwebmail] (no subject)
FromSent OnAttachments
Pawel TeczaAug 29, 2006 7:52 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [sqwebmail] (no subject)Actions...
From:Pawel Tecza (p.te@net.icm.edu.pl)
Date:Aug 29, 2006 7:52:26 am
List:net.sourceforge.lists.courier-sqwebmail

Hello Sam,

I'm back ;)

On Mon, 14 Aug 2006, Pawel Tecza wrote:

Hi Sam,

On Fri, 11 Aug 2006, Sam Varshavchik wrote:

Pawel Tecza writes:

Hi Sam,

We have discovered two little white spaces related bugs:

[...]

You have a number of problems here.

Thanks a lot for your full detailed comments! ;) Of course you're absolutely right.

Now I'm on holidays until the end of August, so I'll try to fix my patch when I come back.

Done! I hope you'll be satisfied now ;)

My best regards,

Pawel Tecza

Index: webmail/folder.c =================================================================== RCS file: /cvsroot/courier/courier/webmail/folder.c,v retrieving revision 1.171 diff -u -r1.171 folder.c --- webmail/folder.c 22 Jul 2006 21:53:59 -0000 1.171 +++ webmail/folder.c 29 Aug 2006 14:26:54 -0000 @@ -3516,8 +3516,8 @@

if (*cgi("do.create")) { - const char *newfoldername=cgi("foldername"); - const char *newdirname=cgi("dirname"); + const char *newfoldername=trim_spaces(cgi("foldername")); + const char *newdirname=trim_spaces(cgi("dirname")); const char *folderdir=cgi("folderdir");

/* @@ -3647,7 +3647,7 @@ char *pp=strdup(p); struct maildir_info mifrom, mito; const char *qutf7=cgi("renametofolder"); - const char *r=cgi("renametoname"); + const char *r=trim_spaces(cgi("renametoname")); char *s; char *rutf7;

Index: webmail/sqwebmail.c =================================================================== RCS file: /cvsroot/courier/courier/webmail/sqwebmail.c,v retrieving revision 1.138 diff -u -r1.138 sqwebmail.c --- webmail/sqwebmail.c 25 Jul 2006 01:21:17 -0000 1.138 +++ webmail/sqwebmail.c 29 Aug 2006 14:27:09 -0000 @@ -176,6 +176,7 @@

static struct template_stack *template_stack=NULL;

+char *trim_spaces(const char *s);

size_t get_timeoutsoft() { @@ -2892,7 +2893,7 @@ cgi_setup(); init_default_locale();

- if (*(u=cgi("username"))) + if (*(u=trim_spaces(cgi("username")))) /* Request to log in */ { const char *p=cgi("password"); @@ -3123,3 +3124,28 @@ abort(); } #endif + +/* Trim leading and trailing white spaces from string */ + +char *trim_spaces(const char *s) +{ + char *p, *q; + + p=strdup(s); + if (!p) + enomem(); + + if (*p) + { + for (q=p+strlen(p)-1; q >= p && isspace(*q); q--) + *q=0; + + for (q=p; *q && isspace(*q); q++) + ; + if (p != q) + p=q; + } + + return (p); +} + Index: webmail/sqwebmail.h =================================================================== RCS file: /cvsroot/courier/courier/webmail/sqwebmail.h,v retrieving revision 1.21 diff -u -r1.21 sqwebmail.h --- webmail/sqwebmail.h 17 May 2006 01:42:46 -0000 1.21 +++ webmail/sqwebmail.h 29 Aug 2006 14:27:15 -0000 @@ -130,4 +130,6 @@

#define MIMEGPGFILENAME "mimegpgfilename"

+char *trim_spaces(const char *s); + #endif