Re: [Dbmail-dev] kmail and sieve scripts
On Tue, Feb 28, 2006, Oleg Lapshin [EMAIL PROTECTED] said: When I changed line 673 of timsieve.c from: {%u+}\r\n, to {%u}\r\n, kmail can get script to change it!!! They need to read the draft RFC: http://www.ietf.org/internet-drafts/draft-martin-managesieve-06.txt 2.9. GETSCRIPT Command Arguments: String - Script name This command gets the contents of the specified script. If the script does not exist the server MUST reply with a NO response. Upon success a string with the contents of the script is returned followed by a OK response. Example: C: Getscript myscript S: {48+} S: #this is my wonderful script S: reject I reject all; S: S: OK Because a literal is encoded like this: literal = { number +} CRLF *OCTET ;; The number represents the number of octets. ;; Sieve scripts MUST be sent as literal-utf8. ;; literal-utf8 is defined in ACAP. BUT! When I try to upload script, it's failed: kmail: HAVESPACE main 316 server: NO Command not implemented. So, HAVESPACE capability must be implemented. I'll add this command in a few hours. Aaron
Re: [Dbmail-dev] kmail and sieve scripts
Aaron Stone wrote: On Tue, Feb 28, 2006, Oleg Lapshin [EMAIL PROTECTED] said: When I changed line 673 of timsieve.c from: {%u+}\r\n, to {%u}\r\n, kmail can get script to change it!!! They need to read the draft RFC: http://www.ietf.org/internet-drafts/draft-martin-managesieve-06.txt 2.9. GETSCRIPT Command Yes, I read this. Nevertheless, both kmail and smartsieve don't like {size+} syntax They like {size} one... :) BUT! When I try to upload script, it's failed: kmail: HAVESPACE main 316 server: NO Command not implemented. So, HAVESPACE capability must be implemented. I'll add this command in a few hours. OK Please, add 2 more lines to db.c: --- orig/db.c 2006-02-26 21:16:40.0 +0300 +++ my/db.c 2006-03-01 02:49:19.0 +0300 @@ -636,6 +636,7 @@ return DM_EQUERY; } } + db_free_result(); snprintf(query, DEF_QUERYSIZE, UPDATE %ssievescripts SET name = '%s' @@ -689,6 +690,7 @@ return DM_EQUERY; } } + db_free_result(); snprintf(query, DEF_QUERYSIZE, INSERT into %ssievescripts And 1 more thing: when I try to upload _new_ script from kmail, small script is uploaded fine but large - don't dbmysql.c,db_query: executing query [BEGIN] dbmysql.c,db_query: executing query [SELECT COUNT(*) FROM dbmail_sievescripts WHERE owner_idnr = 2 AND name = '@!temp-script!@'] dbmysql.c,db_query: executing query [INSERT into dbmail_sievescripts (owner_idnr, name, script, active) values (2, '@!temp-script!@', ' skip large script ] dbmysql.c,db_query: executing query [COMMIT] sortsieve.c, sort_getscript: Getting default script named [EMAIL PROTECTED]@] dbmysql.c,db_query: executing query [SELECT script from dbmail_sievescripts where owner_idnr = '2' and name = '@!temp-script!@'] Error 12 when calling sieve2_validate: Sieve Error: script was not retrieved timsieve.c, tims: Error inserting script 2 I don't know, but script don't saved to dbmail_sievescripts table. -- Oleg Lapshin
Re: [Dbmail-dev] kmail and sieve scripts
And 1 more thing: when I try to upload _new_ script from kmail, small script is uploaded fine but large - don't 1st log (don't work): tims(): incoming buffer: [HAVESPACE 123 762] tims(): command issued: cmd [HAVESPACE], val [123 762] tims(): command looked up as commandtype 8 tims(): incoming buffer: [PUTSCRIPT 123 {762+}] tims(): command issued: cmd [PUTSCRIPT], val [123 {762+}] tims(): command looked up as commandtype 9 misc.c, find_bounded: Found [123] of length [3] between '' and '' so next skip [4] misc.c, find_bounded: Found [762] of length [3] between '{' and '+' so next skip [6] timsieve.c, tims: Client sending script of length [762] db.c,db_check_sievescript_quota: updating 2 sievescript quota with 762 dbmysql.c,db_query: executing query [BEGIN] dbmysql.c,db_query: executing query [SELECT COUNT(*) FROM dbmail_sievescripts WHERE owner_idnr = 2 AND name = '@!temp-script!@'] dbmysql.c,db_query: executing query [INSERT into dbmail_sievescripts (owner_idnr, name, script, active) values (2, '@!temp-script!@', 'require \fileinto\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\n', ] dbmysql.c,db_query: executing query [COMMIT] sortsieve.c, sort_getscript: Getting default script named [EMAIL PROTECTED]@] dbmysql.c,db_query: executing query [SELECT script from dbmail_sievescripts where owner_idnr = '2' and name = '@!temp-script!@'] Error 12 when calling sieve2_validate: Sieve Error: script was not retrieved timsieve.c, tims: Error inserting script 2 2nd log (work): tims(): incoming buffer: [HAVESPACE 123 743] tims(): command issued: cmd [HAVESPACE], val [123 743] tims(): command looked up as commandtype 8 tims(): incoming buffer: [PUTSCRIPT 123 {743+}] tims(): command issued: cmd [PUTSCRIPT], val [123 {743+}] tims(): command looked up as commandtype 9 misc.c, find_bounded: Found [123] of length [3] between '' and '' so next skip [4] misc.c, find_bounded: Found [743] of length [3] between '{' and '+' so next skip [6] timsieve.c, tims: Client sending script of length [743] db.c,db_check_sievescript_quota: updating 2 sievescript quota with 743 dbmysql.c,db_query: executing query [BEGIN] dbmysql.c,db_query: executing query [SELECT COUNT(*) FROM dbmail_sievescripts WHERE owner_idnr = 2 AND name = '@!temp-script!@'] dbmysql.c,db_query: executing query [INSERT into dbmail_sievescripts (owner_idnr, name, script, active) values (2, '@!temp-script!@', 'require \fileinto\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\nfileinto \INBOX\;\r\n', 0)] dbmysql.c,db_query: executing query [COMMIT] sortsieve.c, sort_getscript: Getting default script named [EMAIL PROTECTED]@] dbmysql.c,db_query: executing query [SELECT script from dbmail_sievescripts where owner_idnr = '2' and name = '@!temp-script!@'] dbmysql.c,db_query: executing query [BEGIN] dbmysql.c,db_query: executing query [SELECT COUNT(*) FROM dbmail_sievescripts WHERE owner_idnr = 2 AND name = '123'] dbmysql.c,db_query: executing query [UPDATE dbmail_sievescripts SET name = '123' WHERE owner_idnr = 2 AND name = '@!temp-script!@'] dbmysql.c,db_query: executing query [COMMIT] timsieve.c, tims: Script successfully received Length of 762 bytes - too large 743 bytes - good. -- Oleg Lapshin
Re: [Dbmail-dev] kmail and sieve scripts
On Tue, Feb 28, 2006, Oleg Lapshin [EMAIL PROTECTED] said: Aaron Stone wrote: On Tue, Feb 28, 2006, Oleg Lapshin [EMAIL PROTECTED] said: When I changed line 673 of timsieve.c from: {%u+}\r\n, to {%u}\r\n, kmail can get script to change it!!! They need to read the draft RFC: http://www.ietf.org/internet-drafts/draft-martin-managesieve-06.txt 2.9. GETSCRIPT Command Yes, I read this. Nevertheless, both kmail and smartsieve don't like {size+} syntax They like {size} one... :) There's a basic rule of these protocols that says you should speak the RFC as closely as possible, but understand as widely as possible. Reading the SmartSieve code, they use this regex to match the response: elseif (preg_match(/^\{(\d+)\+?\}\r\n$/, $line, $m)){ Appears to me that the + is optional and understood if there or not... I'm looking to see if that was added in a recent CVS update. SmartSieve hasn't had a formal release in a while, but there has been lots of CVS activity. Try a recent snapshot maybe? And 1 more thing: when I try to upload _new_ script from kmail, small script is uploaded fine but large - don't dbmysql.c,db_query: executing query [BEGIN] dbmysql.c,db_query: executing query [SELECT COUNT(*) FROM dbmail_sievescripts WHERE owner_idnr = 2 AND name = '@!temp-script!@'] dbmysql.c,db_query: executing query [INSERT into dbmail_sievescripts (owner_idnr, name, script, active) values (2, '@!temp-script!@', ' skip large script ] dbmysql.c,db_query: executing query [COMMIT] sortsieve.c, sort_getscript: Getting default script named [EMAIL PROTECTED]@] dbmysql.c,db_query: executing query [SELECT script from dbmail_sievescripts where owner_idnr = '2' and name = '@!temp-script!@'] Error 12 when calling sieve2_validate: Sieve Error: script was not retrieved timsieve.c, tims: Error inserting script 2 I don't know, but script don't saved to dbmail_sievescripts table. How big a script do you need to cause a failure? I'll try to reproduce it! Aaron
Re: [Dbmail-dev] kmail and sieve scripts
On Wed, 2006-03-01 at 03:32 +0300, Oleg Lapshin wrote: And 1 more thing: when I try to upload _new_ script from kmail, small script is uploaded fine but large - don't 1st log (don't work): [snip query] \INBOX\;\r\n', ] ^^^ The end of the query should be , 0) -- you've pinpointed the size where we hit the limit of the static query buffer. Good for us that we don't overrun the buffer! But bad that large scripts are not handled correctly. I'll get on it. Aaron
Re: [Dbmail-dev] kmail and sieve scripts
Hello As for db_add_sievescript function in db.c At the beginning: escaped_scriptname = dm_stresc(scriptname); escaped_script = dm_stresc(script); but dm_free(escaped_script); only once at the end of function. dm_free(escaped_scriptname); is called 3 times Is it write? -- Oleg Lapshin