3 messages in net.sourceforge.lists.courier-sqwebmailRe: [sqwebmail] [PATCH] Forbid rename...
FromSent OnAttachments
Marcin SemeniukSep 5, 2006 3:47 am.patch
Sam VarshavchikSep 5, 2006 5:03 pm 
Marcin SemeniukSep 6, 2006 12:49 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] [PATCH] Forbid rename folder if new name contain dotActions...
From:Marcin Semeniuk (m.se@net.icm.edu.pl)
Date:Sep 6, 2006 12:49:08 am
List:net.sourceforge.lists.courier-sqwebmail

On Tue, Sep 05, 2006 at 08:04:06PM -0400, Sam Varshavchik wrote:

Marcin Semeniuk writes:

Hello Sam,

I noticed that I can't create folder with dot in name, but I can change name to one with dot and webmail create tree of folders. I think it's inconsistency, so i made patch that forbid to rename folder if new name contain dot.

When you see my version of this patch you'll slap yourself on the head, for not seeing a much simpler fix.

You know courier sources better, anyway this looks simple to me (one simple check), rest of patch just do reformatting due whitespace changes.

As far as your other patch -- trimming off trailing colons in folder names on the mail filtering screen -- again, you need to kick things up a notch. For certain options, fieldname may be null, so you'll be freeing a NULL. Oops.

I was aware of that. According to "man 3 free"

"void free(void *ptr);" "If ptr is NULL, no operation is performed."

besides I assign to fieldname result of strdup of cgi("headername") cgi() always return string and strdup() always (ok, if there is enough memory) return new pointer. So You're right, there is some error when there will be no memory, strdup return NULL, and strlen(headername) will segfault, anyway i won't be freeing a NULL ;)

I'll do that myself, and you'll have to test my fix yourself. You need to be more careful in the future.

I'll try to get into the habit of always checking if memory allocation failed.