ppg push - crashing bug trusted-pi/no user
"Bas A. Schulte" <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi, here are two patches that solve crashing bug http://bugs.kannel.org/view_bug_page.php?f_id=8 First is gw/wap_push_ppg.c, in pap_request_thread. When there's no user involved in the request (with a trusted-pi), wapbox gets a bus error upon handling a push request. pap_request_thread now checks for this and uses the default smsc-id for routing the message. Second is in gw/wap_push_ppg_pushuser.c, wap_push_ppg_pushuser_smsc_id_get references a NULL user when user_find_by_username returns NULL. Patches attached. Cheers, Bas.
wap_push_ppg.c.patch
(application/octet-stream, 2.5 KB)
*** wap_push_ppg.c Thu Mar 20 12:27:18 2003
--- wap_push_ppg.c.patched Thu Mar 20 12:31:17 2003
***************
*** 837,850 ****
/* check if we have an explicit routing information */
retos = http_cgi_variable(cgivars, "smsc");
if (retos == NULL) {
! /* get the push user specific smsc routing */
! smsc_id = wap_push_ppg_pushuser_smsc_id_get(username);
! /* if there was no user specific, then set the ppg global */
! smsc_id = smsc_id ?
smsc_id : (ppg_default_smsc ? octstr_duplicate(ppg_default_smsc) : NULL);
} else {
smsc_id = octstr_duplicate(retos);
}
ppg_event->u.Push_Message.push_headers =
http_header_duplicate(push_headers);
ppg_event->u.Push_Message.push_data = octstr_duplicate(push_data);
--- 837,869 ----
/* check if we have an explicit routing information */
retos = http_cgi_variable(cgivars, "smsc");
if (retos == NULL) {
!
! /* No explicit routing specified in request */
!
! /* If there's a user involved with this request, find smsc-id for this user, else */
! /* (no user involved) get the default smsc-id. */
!
! if (username == NULL || (octstr_str_compare(username,"") == 0)) {
! /* No user associated with request, use default smsc-id */
! smsc_id = smsc_id ?
smsc_id : (ppg_default_smsc ? octstr_duplicate(ppg_default_smsc) : NULL);
+
+ if (smsc_id == NULL) {
+ debug("wap.push.ppg", 0, "PPG: no user associated with request, no default smsc-id");
+ } else {
+ debug("wap.push.ppg", 0, "PPG: no user associated with request, using default smsc-id");
+ }
+ } else {
+ /* get the push user specific smsc routing */
+ smsc_id = wap_push_ppg_pushuser_smsc_id_get(username);
+ /* if there was no user specific, then set the ppg global */
+ smsc_id = smsc_id ?
+ smsc_id : (ppg_default_smsc ? octstr_duplicate(ppg_default_smsc) : NULL);
+ }
} else {
smsc_id = octstr_duplicate(retos);
}
+
ppg_event->u.Push_Message.push_headers =
http_header_duplicate(push_headers);
ppg_event->u.Push_Message.push_data = octstr_duplicate(push_data);
wap_push_ppg_pushuser.c.patch
(application/octet-stream, 486 B)
*** wap_push_ppg_pushuser.c Thu Mar 20 12:28:50 2003
--- wap_push_ppg_pushuser.c.patched Thu Mar 20 12:26:36 2003
***************
*** 316,325 ****
--- 316,332 ----
Octstr *smsc_id;
u = user_find_by_username(username);
+
+ if (u == NULL) {
+ /* No user found... */
+ return (NULL);
+ }
+
if ((smsc_id = forced_smsc(u)) != NULL)
return octstr_duplicate(smsc_id);
smsc_id = default_smsc(u);
+
return octstr_duplicate(smsc_id);
}