incorrect comparison of ppg_service_name and msg->sms.service in smsbox.c:obey_request_thread()

Davy Chan <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
I've been looking at this off and on since Jan of this year.  It was
sparked by Shyam Kumar's problem with dlr-url
("Subject: dlr-url and dlr-mask").

Basically, if you have a sendsms-user group with a dlr-url defined _AND_
a PPG group defined within the same config file, the dlr-url will
not be instantiated since the call to urltrans_find_service()
is never called.

I'm looking at the following code in
gateway/gw/smsbox.c:obey_request_thread():

/*
 * no smsbox services when we are doing ppg dlr - so trans would be
 * NULL in this case.
 */
if (dreport) {
    if (msg->sms.service == NULL || (msg->sms.service != NULL &&
         ppg_service_name != NULL &&
         octstr_compare(msg->sms.service, ppg_service_name) != 0)) {
        trans = NULL;
    } else {
        trans = urltrans_find_service(translations, msg);
    }

    info(0, "Starting delivery report <%s> from <%s>",
	octstr_get_cstr(msg->sms.service),
	octstr_get_cstr(msg->sms.sender));

} else {

In my opinion, the comparison to determine if the DLR is for a PPG
initiated WAP Push is incorrect. The current logic is:
  IF the sms.service is not defined OR
    (when sms.service is defined and ppg_service_name is defined
     AND sms.service _NOT_EQUAL_ to ppg_service_name)
  THEN
    Don't find the translation structure associated with the service
  ELSE
    Do find the translation structure associated with the service

I assume that the _NOT_EQUAL_ should actually be EQUAL and the 'if'
comparision should be:
    if (msg->sms.service == NULL || (msg->sms.service != NULL &&
         ppg_service_name != NULL &&
         octstr_compare(msg->sms.service, ppg_service_name) == 0)) {

which implies:
  Don't find the translation structure associated with the service
   IF the sms.service is not defined OR
     (when both sms.service and ppg_service_name exists
      AND sms.service EQUALS ppg_service_name)

Am I correct in my assumptions that this is a bug?  I'm not sure since
I'm not too familar with the PPG side of Kannel just yet.  I'm not
sure there won't be a time when a PPG service name is the same as
the value inside the sms.service (since it seems that sms.service is
set by either the 'name =' or 'username =' declarations).

See ya...

d.c.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.