« Return to Thread: [PATCH] account field too long but not explicit.

Re: [PATCH] account field too long but not explicit.

by Vincent CHAVANIS-2 :: Rate this Message:

Reply to Author | View in Thread


yep, i omit the ";" after the returnerror line
due to a copy/paste error
Fixed on this version.

Vincent.


Alexander Malysh a écrit :

> Hi,
>
> unfortunately patch doesn't apply cleanly:
> patching file gw/smsbox.c
> Hunk #2 FAILED at 2142.
> 1 out of 2 hunks FAILED -- saving rejects to file gw/smsbox.c.rej
>
> Please resend...
>
> Thanks,
> Alex
>
> Vincent CHAVANIS schrieb:
>> Hi all,
>>
>>
>> Here is a small fix that warn the user that the account field
>> is too long. I've spend some time to find what's going on with this
>> field and i've noticed that the field was too long.
>> Also i've defined it as ACCOUNT_MAX_LEN.
>>
>> Any comments ?
>>
>> Vincent.
>>
>>
>> --- /gateway-cvs/gw/smsbox.c    2008-06-24 14:10:36.000000000 +0200
>> +++ /gateway/gw/smsbox.c        2008-09-23 11:52:07.000000000 +0200
>> @@ -88,6 +88,8 @@
>>
>>  #define O_DESTROY(a) { if(a) octstr_destroy(a); a = NULL; }
>>
>> +#define ACCOUNT_MAX_LEN 32
>> +
>>  /* Defaults for the HTTP request queueing inside http_queue_thread */
>>  #define HTTP_MAX_RETRIES    0
>>  #define HTTP_RETRY_DELAY    10 /* in sec. */
>> @@ -2140,11 +2142,11 @@
>>      msg->sms.sms_type = mt_push;
>>      msg->sms.sender = octstr_duplicate(newfrom);
>>      if(octstr_len(account)) {
>> -       if(octstr_len(account) <= 32 &&
>> +       if(octstr_len(account) <= ACCOUNT_MAX_LEN &&
>>            octstr_search_chars(account, octstr_imm("[]\n\r"), 0) == -1) {
>>             msg->sms.account = account ? octstr_duplicate(account) :
>> NULL;
>>         } else {
>> -           returnerror = octstr_create("Account field misformed,
>> rejected");
>> +           returnerror = octstr_create("Account field misformed or
>> too long, rejected")
>>             goto field_error;
>>         }
>>      }
>>
>>
>>
>>
>>
>
>
>
>
--
Telemaque - 06560 SOPHIA-ANTIPOLIS - (FR)
Service Technique/Reseau - NOC
Direction du Developpement xMS+
http://www.telemaque.fr/
v.chavanis@...
Tel : +33 4 92 90 99 84 (fax 9142)

diff -rauw /gateway-cvs/gw/smsbox.c /gateway/gw/smsbox.c
--- /gateway-cvs/gw/smsbox.c    2008-06-24 14:10:36.000000000 +0200
+++ /gateway/gw/smsbox.c        2008-09-23 11:58:46.000000000 +0200
@@ -88,6 +88,8 @@
 
 #define O_DESTROY(a) { if(a) octstr_destroy(a); a = NULL; }
 
+#define ACCOUNT_MAX_LEN 32
+
 /* Defaults for the HTTP request queueing inside http_queue_thread */
 #define HTTP_MAX_RETRIES    0
 #define HTTP_RETRY_DELAY    10 /* in sec. */
@@ -2140,11 +2142,11 @@
     msg->sms.sms_type = mt_push;
     msg->sms.sender = octstr_duplicate(newfrom);
     if(octstr_len(account)) {
-       if(octstr_len(account) <= 32 &&
+       if(octstr_len(account) <= ACCOUNT_MAX_LEN &&
           octstr_search_chars(account, octstr_imm("[]\n\r"), 0) == -1) {
            msg->sms.account = account ? octstr_duplicate(account) : NULL;
        } else {
-           returnerror = octstr_create("Account field misformed, rejected");
+           returnerror = octstr_create("Account field misformed or too long, rejected");
            goto field_error;
        }
     }

 « Return to Thread: [PATCH] account field too long but not explicit.