"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/osipparser2/osip_www_authenticate.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_www_authenticate.c  (libosip2-5.0.0):osip_www_authenticate.c  (libosip2-5.1.0)
skipping to change at line 107 skipping to change at line 107
quote2 = __osip_quote_find (quote1 + 1); quote2 = __osip_quote_find (quote1 + 1);
if (quote2 == NULL) if (quote2 == NULL)
return OSIP_SYNTAXERROR; /* bad header format... */ return OSIP_SYNTAXERROR; /* bad header format... */
if (quote2 - quote1 == 1) { if (quote2 - quote1 == 1) {
/* this is a special case! The quote contains nothing! */ /* this is a special case! The quote contains nothing! */
/* example: Digest opaque="",cnonce="" */ /* example: Digest opaque="",cnonce="" */
/* in this case, we just forget the parameter... this */ /* in this case, we just forget the parameter... this */
/* this should prevent from user manipulating empty */ /* this should prevent from user manipulating empty */
/* strings */ /* strings */
tmp = quote2 + 1; /* next element start here */ tmp = quote2 + 1; /* next element start here */
for (; *tmp == ' ' || *tmp == '\t'; tmp++) { tmp += strspn (tmp, " \t");
} tmp += strspn (tmp, "\n\r");
for (; *tmp == '\n' || *tmp == '\r'; tmp++) {
} /* skip LWS */
*next = NULL; *next = NULL;
if (*tmp == '\0') /* end of header detected */ if (*tmp == '\0') /* end of header detected */
return OSIP_SUCCESS; return OSIP_SUCCESS;
if (*tmp != '\t' && *tmp != ' ') if (*tmp != '\t' && *tmp != ' ')
/* LWS here ? */ /* LWS here ? */
*next = tmp; *next = tmp;
else { /* it is: skip it... */ else { /* it is: skip it... */
for (; *tmp == ' ' || *tmp == '\t'; tmp++) { tmp += strspn (tmp, " \t");
}
if (*tmp == '\0') /* end of header detected */ if (*tmp == '\0') /* end of header detected */
return OSIP_SUCCESS; return OSIP_SUCCESS;
*next = tmp; *next = tmp;
} }
return OSIP_SUCCESS; return OSIP_SUCCESS;
} }
*result = (char *) osip_malloc (quote2 - quote1 + 3); *result = (char *) osip_malloc (quote2 - quote1 + 3);
if (*result == NULL) if (*result == NULL)
return OSIP_NOMEM; return OSIP_NOMEM;
osip_strncpy (*result, quote1, quote2 - quote1 + 1); osip_strncpy (*result, quote1, quote2 - quote1 + 1);
tmp = quote2 + 1; /* next element start here */ tmp = quote2 + 1; /* next element start here */
for (; *tmp == ' ' || *tmp == '\t'; tmp++) { tmp += strspn (tmp, " \t");
} tmp += strspn (tmp, "\n\r");
for (; *tmp == '\n' || *tmp == '\r'; tmp++) {
} /* skip LWS */
*next = NULL; *next = NULL;
if (*tmp == '\0') /* end of header detected */ if (*tmp == '\0') /* end of header detected */
return OSIP_SUCCESS; return OSIP_SUCCESS;
if (*tmp != '\t' && *tmp != ' ') if (*tmp != '\t' && *tmp != ' ')
/* LWS here ? */ /* LWS here ? */
*next = tmp; *next = tmp;
else { /* it is: skip it... */ else { /* it is: skip it... */
for (; *tmp == ' ' || *tmp == '\t'; tmp++) { tmp += strspn (tmp, " \t");
}
if (*tmp == '\0') /* end of header detected */ if (*tmp == '\0') /* end of header detected */
return OSIP_SUCCESS; return OSIP_SUCCESS;
*next = tmp; *next = tmp;
} }
} }
else else
*next = str; /* wrong header asked! */ *next = str; /* wrong header asked! */
return OSIP_SUCCESS; return OSIP_SUCCESS;
} }
skipping to change at line 194 skipping to change at line 188
if (end - beg < 2) if (end - beg < 2)
return OSIP_SYNTAXERROR; return OSIP_SYNTAXERROR;
*result = (char *) osip_malloc (end - beg); *result = (char *) osip_malloc (end - beg);
if (*result == NULL) if (*result == NULL)
return OSIP_NOMEM; return OSIP_NOMEM;
osip_clrncpy (*result, beg + 1, end - beg - 1); osip_clrncpy (*result, beg + 1, end - beg - 1);
/* make sure the element does not contain more parameter */ /* make sure the element does not contain more parameter */
tmp = (*end) ? (end + 1) : end; tmp = (*end) ? (end + 1) : end;
for (; *tmp == ' ' || *tmp == '\t'; tmp++) { tmp += strspn (tmp, " \t");
} tmp += strspn (tmp, "\n\r");
for (; *tmp == '\n' || *tmp == '\r'; tmp++) {
} /* skip LWS */
*next = NULL; *next = NULL;
if (*tmp == '\0') /* end of header detected */ if (*tmp == '\0') /* end of header detected */
return OSIP_SUCCESS; return OSIP_SUCCESS;
if (*tmp != '\t' && *tmp != ' ') if (*tmp != '\t' && *tmp != ' ')
/* LWS here ? */ /* LWS here ? */
*next = tmp; *next = tmp;
else { /* it is: skip it... */ else { /* it is: skip it... */
for (; *tmp == ' ' || *tmp == '\t'; tmp++) { tmp += strspn (tmp, " \t");
}
if (*tmp == '\0') /* end of header detected */ if (*tmp == '\0') /* end of header detected */
return OSIP_SUCCESS; return OSIP_SUCCESS;
*next = tmp; *next = tmp;
} }
} }
else else
*next = str; /* next element start here */ *next = str; /* next element start here */
return OSIP_SUCCESS; return OSIP_SUCCESS;
} }
skipping to change at line 310 skipping to change at line 301
i = __osip_quoted_string_set ("qop", space, &(wwwa->qop_options), &next); i = __osip_quoted_string_set ("qop", space, &(wwwa->qop_options), &next);
if (i != 0) if (i != 0)
return i; return i;
if (next == NULL) if (next == NULL)
return OSIP_SUCCESS; /* end of header detected! */ return OSIP_SUCCESS; /* end of header detected! */
else if (next != space) { else if (next != space) {
space = next; space = next;
parse_ok++; parse_ok++;
} }
i = __osip_token_set ("version", space, &(wwwa->version), &next); i = __osip_token_set ("version", space, &(wwwa->version), &next);
if (i!=0) if (i != 0)
return i; return i;
if (next == NULL) if (next == NULL)
return OSIP_SUCCESS; /* end of header detected! */ return OSIP_SUCCESS; /* end of header detected! */
else if (next != space) else if (next != space) {
{ space = next;
space = next; parse_ok++;
parse_ok++; }
} i = __osip_quoted_string_set ("targetname", space, &(wwwa->targetname), &nex
i = __osip_quoted_string_set ("targetname", space, &(wwwa->targetname), & t);
next); if (i != 0)
if (i!=0)
return i; return i;
if (next == NULL) if (next == NULL)
return OSIP_SUCCESS; /* end of header detected! */ return OSIP_SUCCESS; /* end of header detected! */
else if (next != space) else if (next != space) {
{ space = next;
space = next; parse_ok++;
parse_ok++; }
} i = __osip_quoted_string_set ("gssapi-data", space, &(wwwa->gssapi_data), &n
i = __osip_quoted_string_set ("gssapi-data", space, &(wwwa->gssapi_data), ext);
&next); if (i != 0)
if (i!=0)
return i; return i;
if (next == NULL) if (next == NULL)
return OSIP_SUCCESS; /* end of header detected! */ return OSIP_SUCCESS; /* end of header detected! */
else if (next != space) else if (next != space) {
{ space = next;
space = next; parse_ok++;
parse_ok++; }
}
if (0 == parse_ok) { if (0 == parse_ok) {
const char *quote1, *quote2, *tmp; const char *quote1, *quote2, *tmp;
/* CAUTION */ /* CAUTION */
/* parameter not understood!!! I'm too lazy to handle IT */ /* parameter not understood!!! I'm too lazy to handle IT */
/* let's simply bypass it */ /* let's simply bypass it */
if (strlen (space) < 1) if (strlen (space) < 1)
return OSIP_SUCCESS; return OSIP_SUCCESS;
tmp = strchr (space + 1, ','); tmp = strchr (space + 1, ',');
if (tmp == NULL) /* it was the last header */ if (tmp == NULL) /* it was the last header */
skipping to change at line 493 skipping to change at line 481
www_authenticate->qop_options = (char *) qop_options; www_authenticate->qop_options = (char *) qop_options;
} }
char * char *
osip_www_authenticate_get_version (osip_www_authenticate_t * www_authenticate) osip_www_authenticate_get_version (osip_www_authenticate_t * www_authenticate)
{ {
return www_authenticate->version; return www_authenticate->version;
} }
void void
osip_www_authenticate_set_version (osip_www_authenticate_t * osip_www_authenticate_set_version (osip_www_authenticate_t * www_authenticate, c
www_authenticate, char *version) har *version)
{ {
www_authenticate->version = (char *) version; www_authenticate->version = (char *) version;
} }
char * char *
osip_www_authenticate_get_targetname (osip_www_authenticate_t * www_authenticate ) osip_www_authenticate_get_targetname (osip_www_authenticate_t * www_authenticate )
{ {
return www_authenticate->targetname; return www_authenticate->targetname;
} }
void void
osip_www_authenticate_set_targetname (osip_www_authenticate_t * osip_www_authenticate_set_targetname (osip_www_authenticate_t * www_authenticate
www_authenticate, char *targetname) , char *targetname)
{ {
www_authenticate->targetname = (char *) targetname; www_authenticate->targetname = (char *) targetname;
} }
char * char *
osip_www_authenticate_get_gssapi_data (osip_www_authenticate_t * www_authenticat e) osip_www_authenticate_get_gssapi_data (osip_www_authenticate_t * www_authenticat e)
{ {
return www_authenticate->gssapi_data; return www_authenticate->gssapi_data;
} }
void void
osip_www_authenticate_set_gssapi_data (osip_www_authenticate_t * osip_www_authenticate_set_gssapi_data (osip_www_authenticate_t * www_authenticat
www_authenticate, char *gssapi_data) e, char *gssapi_data)
{ {
www_authenticate->gssapi_data = (char *) gssapi_data; www_authenticate->gssapi_data = (char *) gssapi_data;
} }
/* returns the www_authenticate header as a string. */ /* returns the www_authenticate header as a string. */
/* INPUT : osip_www_authenticate_t *www_authenticate | www_authenticate header. */ /* INPUT : osip_www_authenticate_t *www_authenticate | www_authenticate header. */
/* returns null on error. */ /* returns null on error. */
int int
osip_www_authenticate_to_str (const osip_www_authenticate_t * wwwa, char **dest) osip_www_authenticate_to_str (const osip_www_authenticate_t * wwwa, char **dest)
{ {
skipping to change at line 598 skipping to change at line 583
} }
if (wwwa->algorithm != NULL) { if (wwwa->algorithm != NULL) {
tmp = osip_strn_append (tmp, ", algorithm=", 12); tmp = osip_strn_append (tmp, ", algorithm=", 12);
tmp = osip_str_append (tmp, wwwa->algorithm); tmp = osip_str_append (tmp, wwwa->algorithm);
} }
if (wwwa->qop_options != NULL) { if (wwwa->qop_options != NULL) {
tmp = osip_strn_append (tmp, ", qop=", 6); tmp = osip_strn_append (tmp, ", qop=", 6);
tmp = osip_str_append (tmp, wwwa->qop_options); tmp = osip_str_append (tmp, wwwa->qop_options);
} }
if (wwwa->version != NULL) { if (wwwa->version != NULL) {
tmp = osip_strn_append (tmp, ", version=", 10); tmp = osip_strn_append (tmp, ", version=", 10);
tmp = osip_str_append (tmp, wwwa->version); tmp = osip_str_append (tmp, wwwa->version);
} }
if (wwwa->targetname != NULL) { if (wwwa->targetname != NULL) {
tmp = osip_strn_append (tmp, ", targetname=", 13); tmp = osip_strn_append (tmp, ", targetname=", 13);
tmp = osip_str_append (tmp, wwwa->targetname); tmp = osip_str_append (tmp, wwwa->targetname);
} }
if (wwwa->gssapi_data != NULL) { if (wwwa->gssapi_data != NULL) {
tmp = osip_strn_append (tmp, ", gssapi-data=", 14); tmp = osip_strn_append (tmp, ", gssapi-data=", 14);
tmp = osip_str_append (tmp, wwwa->gssapi_data); tmp = osip_str_append (tmp, wwwa->gssapi_data);
} }
if (wwwa->realm == NULL) { if (wwwa->realm == NULL) {
/* remove comma */ /* remove comma */
len = strlen (wwwa->auth_type); len = strlen (wwwa->auth_type);
if ((*dest)[len] == ',') if ((*dest)[len] == ',')
(*dest)[len] = ' '; (*dest)[len] = ' ';
} }
return OSIP_SUCCESS; return OSIP_SUCCESS;
} }
skipping to change at line 706 skipping to change at line 691
return OSIP_NOMEM; return OSIP_NOMEM;
} }
if (wwwa->qop_options != NULL) if (wwwa->qop_options != NULL)
wa->qop_options = osip_strdup (wwwa->qop_options); wa->qop_options = osip_strdup (wwwa->qop_options);
if (wa->qop_options == NULL && wwwa->qop_options != NULL) { if (wa->qop_options == NULL && wwwa->qop_options != NULL) {
osip_www_authenticate_free (wa); osip_www_authenticate_free (wa);
return OSIP_NOMEM; return OSIP_NOMEM;
} }
if (wwwa->version != NULL) if (wwwa->version != NULL)
wa->version = osip_strdup (wwwa->version); wa->version = osip_strdup (wwwa->version);
if (wa->version==NULL && wwwa->version!=NULL) if (wa->version == NULL && wwwa->version != NULL) {
{ osip_www_authenticate_free (wa);
osip_www_authenticate_free (wa); return OSIP_NOMEM;
return OSIP_NOMEM;
} }
if (wwwa->targetname != NULL) if (wwwa->targetname != NULL)
wa->targetname = osip_strdup (wwwa->targetname); wa->targetname = osip_strdup (wwwa->targetname);
if (wa->targetname==NULL && wwwa->targetname!=NULL) if (wa->targetname == NULL && wwwa->targetname != NULL) {
{ osip_www_authenticate_free (wa);
osip_www_authenticate_free (wa); return OSIP_NOMEM;
return OSIP_NOMEM;
} }
if (wwwa->gssapi_data != NULL) if (wwwa->gssapi_data != NULL)
wa->gssapi_data = osip_strdup (wwwa->gssapi_data); wa->gssapi_data = osip_strdup (wwwa->gssapi_data);
if (wa->gssapi_data==NULL && wwwa->gssapi_data!=NULL) if (wa->gssapi_data == NULL && wwwa->gssapi_data != NULL) {
{ osip_www_authenticate_free (wa);
osip_www_authenticate_free (wa); return OSIP_NOMEM;
return OSIP_NOMEM;
} }
*dest = wa; *dest = wa;
return OSIP_SUCCESS; return OSIP_SUCCESS;
} }
 End of changes. 19 change blocks. 
67 lines changed or deleted 52 lines changed or added

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