"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/osipparser2/osip_uri.c" between
libosip2-5.0.0.tar.gz and libosip2-5.1.0.tar.gz

About: The GNU oSIP library is an implementation of SIP (RFC3261).

osip_uri.c  (libosip2-5.0.0):osip_uri.c  (libosip2-5.1.0)
skipping to change at line 124 skipping to change at line 124
if (buf == NULL || buf[0] == '\0') if (buf == NULL || buf[0] == '\0')
return OSIP_BADPARAMETER; return OSIP_BADPARAMETER;
tmp = strchr (buf, ':'); tmp = strchr (buf, ':');
if (tmp == NULL) if (tmp == NULL)
return OSIP_SYNTAXERROR; return OSIP_SYNTAXERROR;
if (tmp - buf < 2) if (tmp - buf < 2)
return OSIP_SYNTAXERROR; return OSIP_SYNTAXERROR;
i=0; i = 0;
while (buf+i<tmp) { while (buf + i < tmp) {
if (!osip_is_alpha(buf[i])) if (!osip_is_alpha (buf[i]))
return OSIP_SYNTAXERROR; return OSIP_SYNTAXERROR;
i++; i++;
} }
url->scheme = (char *) osip_malloc (tmp - buf + 1); url->scheme = (char *) osip_malloc (tmp - buf + 1);
if (url->scheme == NULL) if (url->scheme == NULL)
return OSIP_NOMEM; return OSIP_NOMEM;
osip_strncpy (url->scheme, buf, tmp - buf); osip_strncpy (url->scheme, buf, tmp - buf);
if (strchr (url->scheme, ' ') != NULL) { if (strchr (url->scheme, ' ') != NULL) {
skipping to change at line 408 skipping to change at line 408
__osip_uri_unescape (hvalue); __osip_uri_unescape (hvalue);
} }
i = osip_uri_uheader_add (url, hname, hvalue); i = osip_uri_uheader_add (url, hname, hvalue);
if (i != OSIP_SUCCESS) { if (i != OSIP_SUCCESS) {
osip_free (hname); osip_free (hname);
osip_free (hvalue); osip_free (hvalue);
return i; return i;
} }
if (_and == NULL) /* we just set the last header */ if (_and == NULL) /* we just set the last header */
equal = NULL; equal = NULL;
else { /* continue on next header */ else { /* continue on next header */
headers = _and; headers = _and;
equal = strchr (headers, '='); equal = strchr (headers, '=');
_and = strchr (headers + 1, '&'); _and = strchr (headers + 1, '&');
if (equal == NULL) /* each header MUST have a value */ if (equal == NULL) /* each header MUST have a value */
return OSIP_SYNTAXERROR; return OSIP_SYNTAXERROR;
} }
} }
skipping to change at line 608 skipping to change at line 608
sprintf (tmp, "%s", url->host); sprintf (tmp, "%s", url->host);
tmp = tmp + strlen (tmp); tmp = tmp + strlen (tmp);
} }
if (url->port != NULL) { if (url->port != NULL) {
sprintf (tmp, ":%s", url->port); sprintf (tmp, ":%s", url->port);
tmp = tmp + strlen (tmp); tmp = tmp + strlen (tmp);
} }
{ {
osip_list_iterator_t it; osip_list_iterator_t it;
osip_uri_param_t *u_param = (osip_uri_param_t*) osip_list_get_first(&url->ur osip_uri_param_t *u_param = (osip_uri_param_t *) osip_list_get_first (&url->
l_params, &it); url_params, &it);
while (u_param != OSIP_SUCCESS) { while (u_param != OSIP_SUCCESS) {
char *tmp1; char *tmp1;
char *tmp2 = NULL; char *tmp2 = NULL;
char *previous_buf; char *previous_buf;
if (osip_strcasecmp(u_param->gname, "x-obr")==0 || osip_strcasecmp(u_param ->gname, "x-obp")==0) { if (osip_strcasecmp (u_param->gname, "x-obr") == 0 || osip_strcasecmp (u_p aram->gname, "x-obp") == 0) {
/* x-obr and x-obp are internal params used by exosip: they must not app ear in messages */ /* x-obr and x-obp are internal params used by exosip: they must not app ear in messages */
u_param = (osip_uri_param_t *) osip_list_get_next(&it); u_param = (osip_uri_param_t *) osip_list_get_next (&it);
continue; continue;
} }
tmp1 = __osip_uri_escape_uri_param (u_param->gname); tmp1 = __osip_uri_escape_uri_param (u_param->gname);
if (tmp1 == NULL) { if (tmp1 == NULL) {
osip_free (buf); osip_free (buf);
return OSIP_SYNTAXERROR; return OSIP_SYNTAXERROR;
} }
if (u_param->gvalue == NULL) if (u_param->gvalue == NULL)
plen = strlen (tmp1) + 2; plen = strlen (tmp1) + 2;
skipping to change at line 655 skipping to change at line 656
} }
tmp = buf; tmp = buf;
tmp = tmp + strlen (tmp); tmp = tmp + strlen (tmp);
if (u_param->gvalue == NULL) if (u_param->gvalue == NULL)
sprintf (tmp, ";%s", tmp1); sprintf (tmp, ";%s", tmp1);
else { else {
sprintf (tmp, ";%s=%s", tmp1, tmp2); sprintf (tmp, ";%s=%s", tmp1, tmp2);
osip_free (tmp2); osip_free (tmp2);
} }
osip_free (tmp1); osip_free (tmp1);
u_param = (osip_uri_param_t *) osip_list_get_next(&it); u_param = (osip_uri_param_t *) osip_list_get_next (&it);
} }
} }
{ {
osip_list_iterator_t it; osip_list_iterator_t it;
osip_uri_header_t *u_header = (osip_uri_header_t*) osip_list_get_first(&url- osip_uri_header_t *u_header = (osip_uri_header_t *) osip_list_get_first (&ur
>url_headers, &it); l->url_headers, &it);
while (u_header != OSIP_SUCCESS) { while (u_header != OSIP_SUCCESS) {
char *tmp1; char *tmp1;
char *tmp2; char *tmp2;
char *previous_buf; char *previous_buf;
tmp1 = __osip_uri_escape_header_param (u_header->gname); tmp1 = __osip_uri_escape_header_param (u_header->gname);
if (tmp1 == NULL) { if (tmp1 == NULL) {
osip_free (buf); osip_free (buf);
return OSIP_SYNTAXERROR; return OSIP_SYNTAXERROR;
skipping to change at line 700 skipping to change at line 702
return OSIP_NOMEM; return OSIP_NOMEM;
} }
tmp = buf; tmp = buf;
tmp = tmp + strlen (tmp); tmp = tmp + strlen (tmp);
if (it.pos == 0) if (it.pos == 0)
snprintf (tmp, len - (tmp - buf), "?%s=%s", tmp1, tmp2); snprintf (tmp, len - (tmp - buf), "?%s=%s", tmp1, tmp2);
else else
snprintf (tmp, len - (tmp - buf), "&%s=%s", tmp1, tmp2); snprintf (tmp, len - (tmp - buf), "&%s=%s", tmp1, tmp2);
osip_free (tmp1); osip_free (tmp1);
osip_free (tmp2); osip_free (tmp2);
u_header = (osip_uri_header_t *) osip_list_get_next(&it); u_header = (osip_uri_header_t *) osip_list_get_next (&it);
} }
} }
*dest = buf; *dest = buf;
return OSIP_SUCCESS; return OSIP_SUCCESS;
} }
void void
osip_uri_free (osip_uri_t * url) osip_uri_free (osip_uri_t * url)
{ {
skipping to change at line 853 skipping to change at line 855
osip_uri_param_t *u_param; osip_uri_param_t *u_param;
osip_list_iterator_t it; osip_list_iterator_t it;
*url_param = NULL; *url_param = NULL;
if (pname == NULL) if (pname == NULL)
return OSIP_BADPARAMETER; return OSIP_BADPARAMETER;
pname_len = strlen (pname); pname_len = strlen (pname);
if (pname_len <= 0) if (pname_len <= 0)
return OSIP_BADPARAMETER; return OSIP_BADPARAMETER;
u_param = (osip_uri_param_t*) osip_list_get_first(params, &it); u_param = (osip_uri_param_t *) osip_list_get_first (params, &it);
while (u_param != OSIP_SUCCESS) { while (u_param != OSIP_SUCCESS) {
size_t len; size_t len;
len = strlen (u_param->gname); len = strlen (u_param->gname);
if (pname_len == len && osip_strncasecmp (u_param->gname, pname, strlen (pna me)) == 0) { if (pname_len == len && osip_strncasecmp (u_param->gname, pname, strlen (pna me)) == 0) {
*url_param = u_param; *url_param = u_param;
return OSIP_SUCCESS; return OSIP_SUCCESS;
} }
u_param = (osip_uri_param_t *) osip_list_get_next(&it); u_param = (osip_uri_param_t *) osip_list_get_next (&it);
} }
return OSIP_UNDEFINED_ERROR; return OSIP_UNDEFINED_ERROR;
} }
int int
osip_uri_param_clone (const osip_uri_param_t * uparam, osip_uri_param_t ** dest) osip_uri_param_clone (const osip_uri_param_t * uparam, osip_uri_param_t ** dest)
{ {
int i; int i;
osip_uri_param_t *up; osip_uri_param_t *up;
 End of changes. 10 change blocks. 
14 lines changed or deleted 16 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)