All pastes #46567 Raw Edit

Miscellany

public text v1 · immutable
#46567 ·published 2006-03-22 06:19 UTC
rendered paste body
there are these lines in chan_sip.c in function process_sdp

	if (pedanticsipchecking) {
		c = get_sdp_iterate(&destiterator, req, "c");
		if (!ast_strlen_zero(c)) {
			if (sscanf(c, "IN IP4 %256s", host) != 1) {
				ast_log(LOG_WARNING, "Invalid secondary host in c= line, '%s'\n", c);
			} else {
				/* XXX This could block for a long time, and block the main thread! XXX */
				hp = ast_gethostbyname(host, &ahp);
				if (!hp) {
					ast_log(LOG_WARNING, "Unable to lookup host in secondary c= line, '%s'\n", c);
				}
			}
		}
	}

I think they are unnecessary because a few lines before in the same function there are these lines:

	c = get_sdp_iterate(&destiterator, req, "c");
	if (ast_strlen_zero(m) || ast_strlen_zero(c)) {
		ast_log(LOG_WARNING, "Insufficient information for SDP (m = '%s', c = '%s')\n", m, c);
		add_to_list(p->cid_num, "Insufficient information for SDP (m = '%s', c = '%s')\n", m, c);
		return -1;
	}

	if (sscanf(c, "IN IP4 %256s", host) != 1) {
		ast_log(LOG_WARNING, "Invalid host in c= line, '%s'\n", c);
		add_to_list(p->cid_num, "Invalid host in c= line, '%s'\n", c);
		return -1;
	}
	/* XXX This could block for a long time, and block the main thread! XXX */
	hp = ast_gethostbyname(host, &ahp);
	if (!hp) {
		ast_log(LOG_WARNING, "Unable to lookup host in c= line, '%s'\n", c);
		add_to_list(p->cid_num, "Unable to lookup host in c= line, '%s'\n", c);
		return -1;
	}

Than means that all things that are checked in the "pedanticsipchecking block" have been checked already before.