Review Board 1.7.16


rfc4235 - Section 4.1: Versions MUST be representable using a non-negative 32 bit integer.

Review Request #1694 - Created Jan. 25, 2012 and submitted

Alec Davis
Asterisk 1.8 and above
Reviewers
asterisk-dev
Asterisk
printf %d may print negative version numbers, if a subscription exists for long enough.

I'm not confortable with %u on 32 or 64 bit systems.

Should I perhaps use a type cast, printf("%lu\n", (unsigned long)dialogver);
Compiles

Diff revision 1 (Latest)

  1. trunk/channels/chan_sip.c: Loading...
  2. trunk/channels/sip/include/sip.h: Loading...
trunk/channels/chan_sip.c
Revision 350022 New Change
[20] 12734 lines
[+20] [+] static void state_notify_build_xml(int state, int full, const char *exten, const char *context, struct ast_str **tmp, struct sip_pvt *p, int subscribed, const char *mfrom, const char *mto)
12735
			ast_str_append(tmp, 0, "<status><basic>%s</basic></status>\n", (local_state != NOTIFY_CLOSED) ? "open" : "closed");
12735
			ast_str_append(tmp, 0, "<status><basic>%s</basic></status>\n", (local_state != NOTIFY_CLOSED) ? "open" : "closed");
12736
		ast_str_append(tmp, 0, "</tuple>\n</presence>\n");
12736
		ast_str_append(tmp, 0, "</tuple>\n</presence>\n");
12737
		break;
12737
		break;
12738
	case DIALOG_INFO_XML: /* SNOM subscribes in this format */
12738
	case DIALOG_INFO_XML: /* SNOM subscribes in this format */
12739
		ast_str_append(tmp, 0, "<?xml version=\"1.0\"?>");
12739
		ast_str_append(tmp, 0, "<?xml version=\"1.0\"?>");
12740
		ast_str_append(tmp, 0, "<dialog-info xmlns=\"urn:ietf:params:xml:ns:dialog-info\" version=\"%d\" state=\"%s\" entity=\"%s\">", p->dialogver, full ? "full" : "partial", mto);
12740
		ast_str_append(tmp, 0, "<dialog-info xmlns=\"urn:ietf:params:xml:ns:dialog-info\" version=\"%u\" state=\"%s\" entity=\"%s\">", p->dialogver, full ? "full" : "partial", mto);
12741
		if ((state & AST_EXTENSION_RINGING) && sip_cfg.notifyringing) {
12741
		if ((state & AST_EXTENSION_RINGING) && sip_cfg.notifyringing) {
12742
			const char *local_display = exten;
12742
			const char *local_display = exten;
12743
			char *local_target = ast_strdupa(mto);
12743
			char *local_target = ast_strdupa(mto);
12744

    
   
12744

   
12745
			/* There are some limitations to how this works.  The primary one is that the
12745
			/* There are some limitations to how this works.  The primary one is that the
[+20] [20] 12520 lines
[+20] [+] static int handle_request_subscribe(struct sip_pvt *p, struct sip_request *req, struct ast_sockaddr *addr, int seqno, const char *e)
25266

    
   
25266

   
25267
		if (!start) {
25267
		if (!start) {
25268
			if (p->subscribed == NONE) { /* if the subscribed field is not already set, and there is no accept header... */
25268
			if (p->subscribed == NONE) { /* if the subscribed field is not already set, and there is no accept header... */
25269
				transmit_response(p, "489 Bad Event", req);
25269
				transmit_response(p, "489 Bad Event", req);
25270
				ast_log(LOG_WARNING,"SUBSCRIBE failure: no Accept header: pvt: "
25270
				ast_log(LOG_WARNING,"SUBSCRIBE failure: no Accept header: pvt: "
25271
					"stateid: %d, laststate: %d, dialogver: %d, subscribecont: "
25271
					"stateid: %d, laststate: %d, dialogver: %u, subscribecont: "
25272
					"'%s', subscribeuri: '%s'\n",
25272
					"'%s', subscribeuri: '%s'\n",
25273
					p->stateid,
25273
					p->stateid,
25274
					p->laststate,
25274
					p->laststate,
25275
					p->dialogver,
25275
					p->dialogver,
25276
					p->subscribecontext,
25276
					p->subscribecontext,
[+20] [20] 15 lines
[+20] static int handle_request_subscribe(struct sip_pvt *p, struct sip_request *req, struct ast_sockaddr *addr, int seqno, const char *e)
25292
				snprintf(mybuf, sizeof(mybuf), "489 Bad Event");
25292
				snprintf(mybuf, sizeof(mybuf), "489 Bad Event");
25293
			}
25293
			}
25294
			transmit_response(p, mybuf, req);
25294
			transmit_response(p, mybuf, req);
25295
			ast_log(LOG_WARNING,"SUBSCRIBE failure: unrecognized format:"
25295
			ast_log(LOG_WARNING,"SUBSCRIBE failure: unrecognized format:"
25296
				"'%s' pvt: subscribed: %d, stateid: %d, laststate: %d,"
25296
				"'%s' pvt: subscribed: %d, stateid: %d, laststate: %d,"
25297
				"dialogver: %d, subscribecont: '%s', subscribeuri: '%s'\n",
25297
				"dialogver: %u, subscribecont: '%s', subscribeuri: '%s'\n",
25298
				unknown_acceptheader,
25298
				unknown_acceptheader,
25299
				(int)p->subscribed,
25299
				(int)p->subscribed,
25300
				p->stateid,
25300
				p->stateid,
25301
				p->laststate,
25301
				p->laststate,
25302
				p->dialogver,
25302
				p->dialogver,
[+20] [20] 5959 lines
trunk/channels/sip/include/sip.h
Revision 350022 New Change
 
  1. trunk/channels/chan_sip.c: Loading...
  2. trunk/channels/sip/include/sip.h: Loading...

https://reviewboard.asterisk.org/ runs on a server provided by Digium, Inc. and uses bandwidth donated to the open source Asterisk community by API Digital Communications in Huntsville, AL USA.
Please report problems with this site to asteriskteam@digium.com.