"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/osipparser2/osip_authentication_info.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_authentication_info.c  (libosip2-5.0.0):osip_authentication_info.c  (libosip2-5.1.0)
skipping to change at line 80 skipping to change at line 80
/* INPUT : char *hvalue | value of header. */ /* INPUT : char *hvalue | value of header. */
/* OUTPUT: osip_message_t *sip | structure to save results. */ /* OUTPUT: osip_message_t *sip | structure to save results. */
/* returns -1 on error. */ /* returns -1 on error. */
/* TODO: /* TODO:
digest-challenge tken has no order preference?? digest-challenge tken has no order preference??
verify many situations (extra SP....) verify many situations (extra SP....)
*/ */
int int
osip_authentication_info_parse (osip_authentication_info_t * ainfo, const char * hvalue) osip_authentication_info_parse (osip_authentication_info_t * ainfo, const char * hvalue)
{ {
const char *space, *hack; const char *space, *hack;
const char *next = NULL; const char *next = NULL;
int i; int i;
space = strchr (hvalue, ' '); space = strchr (hvalue, ' ');
hack = strchr( hvalue, '='); hack = strchr (hvalue, '=');
if(space && hack && hack > space) { if (space && hack && hack > space) {
ainfo->auth_type = (char *) osip_malloc (space - hvalue + 1); ainfo->auth_type = (char *) osip_malloc (space - hvalue + 1);
if (ainfo->auth_type==NULL) if (ainfo->auth_type == NULL)
return OSIP_NOMEM; return OSIP_NOMEM;
osip_strncpy (ainfo->auth_type, hvalue, space - hvalue); osip_strncpy (ainfo->auth_type, hvalue, space - hvalue);
} }
else else
space = hvalue; space = hvalue;
for (;;) { for (;;) {
int parse_ok = 0; int parse_ok = 0;
i = __osip_quoted_string_set ("nextnonce", space, &(ainfo->nextnonce), &next ); i = __osip_quoted_string_set ("nextnonce", space, &(ainfo->nextnonce), &next );
if (i != 0) if (i != 0)
return i; return i;
skipping to change at line 144 skipping to change at line 144
i = __osip_token_set ("qop", space, &(ainfo->qop_options), &next); i = __osip_token_set ("qop", space, &(ainfo->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_quoted_string_set ("snum", space, &(ainfo->snum), &next); i = __osip_quoted_string_set ("snum", space, &(ainfo->snum), &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 ("srand", space, &(ainfo->srand), &next); i = __osip_quoted_string_set ("srand", space, &(ainfo->srand), &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, &(ainfo->targetname), &ne xt); i = __osip_quoted_string_set ("targetname", space, &(ainfo->targetname), &ne xt);
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 ("realm", space, &(ainfo->realm), &next); i = __osip_quoted_string_set ("realm", space, &(ainfo->realm), &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 ("opaque", space, &(ainfo->opaque), &next); i = __osip_quoted_string_set ("opaque", space, &(ainfo->opaque), &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 */
skipping to change at line 238 skipping to change at line 238
if (osip_list_size (&sip->authentication_infos) <= pos) if (osip_list_size (&sip->authentication_infos) <= pos)
return OSIP_UNDEFINED_ERROR; /* does not exist */ return OSIP_UNDEFINED_ERROR; /* does not exist */
authentication_info = (osip_authentication_info_t *) osip_list_get (&sip->auth entication_infos, pos); authentication_info = (osip_authentication_info_t *) osip_list_get (&sip->auth entication_infos, pos);
*dest = authentication_info; *dest = authentication_info;
return pos; return pos;
} }
char * char *
osip_authentication_info_get_auth_type (osip_authentication_info_t *authenticati on_info) osip_authentication_info_get_auth_type (osip_authentication_info_t * authenticat ion_info)
{ {
return authentication_info->auth_type; return authentication_info->auth_type;
} }
void void
osip_authentication_info_set_auth_type (osip_authentication_info_t *authenticati on_info, char *auth_type) osip_authentication_info_set_auth_type (osip_authentication_info_t * authenticat ion_info, char *auth_type)
{ {
authentication_info->auth_type = (char *) auth_type; authentication_info->auth_type = (char *) auth_type;
} }
char * char *
osip_authentication_info_get_nextnonce (osip_authentication_info_t * authenticat ion_info) osip_authentication_info_get_nextnonce (osip_authentication_info_t * authenticat ion_info)
{ {
return authentication_info->nextnonce; return authentication_info->nextnonce;
} }
skipping to change at line 310 skipping to change at line 310
return authentication_info->qop_options; return authentication_info->qop_options;
} }
void void
osip_authentication_info_set_qop_options (osip_authentication_info_t * authentic ation_info, char *qop_options) osip_authentication_info_set_qop_options (osip_authentication_info_t * authentic ation_info, char *qop_options)
{ {
authentication_info->qop_options = (char *) qop_options; authentication_info->qop_options = (char *) qop_options;
} }
char * char *
osip_authentication_info_get_snum (osip_authentication_info_t * osip_authentication_info_get_snum (osip_authentication_info_t * authentication_i
authentication_info) nfo)
{ {
return authentication_info->snum; return authentication_info->snum;
} }
void void
osip_authentication_info_set_snum (osip_authentication_info_t * osip_authentication_info_set_snum (osip_authentication_info_t * authentication_i
authentication_info, char *snum) nfo, char *snum)
{ {
authentication_info->snum = (char *) snum; authentication_info->snum = (char *) snum;
} }
char * char *
osip_authentication_info_get_srand (osip_authentication_info_t * osip_authentication_info_get_srand (osip_authentication_info_t * authentication_
authentication_info) info)
{ {
return authentication_info->srand; return authentication_info->srand;
} }
void void
osip_authentication_info_set_srand (osip_authentication_info_t * osip_authentication_info_set_srand (osip_authentication_info_t * authentication_
authentication_info, char *srand) info, char *srand)
{ {
authentication_info->srand = (char *) srand; authentication_info->srand = (char *) srand;
} }
char * char *
osip_authentication_info_get_targetname (osip_authentication_info_t * osip_authentication_info_get_targetname (osip_authentication_info_t * authentica
authentication_info) tion_info)
{ {
return authentication_info->targetname; return authentication_info->targetname;
} }
void void
osip_authentication_info_set_targetname (osip_authentication_info_t * osip_authentication_info_set_targetname (osip_authentication_info_t * authentica
authentication_info, char *targetname) tion_info, char *targetname)
{ {
authentication_info->targetname = (char *) targetname; authentication_info->targetname = (char *) targetname;
} }
char * char *
osip_authentication_info_get_realm (osip_authentication_info_t * osip_authentication_info_get_realm (osip_authentication_info_t * authentication_
authentication_info) info)
{ {
return authentication_info->realm; return authentication_info->realm;
} }
void void
osip_authentication_info_set_realm (osip_authentication_info_t * osip_authentication_info_set_realm (osip_authentication_info_t * authentication_
authentication_info, char *realm) info, char *realm)
{ {
authentication_info->realm = (char *) realm; authentication_info->realm = (char *) realm;
} }
char * char *
osip_authentication_info_get_opaque (osip_authentication_info_t * osip_authentication_info_get_opaque (osip_authentication_info_t * authentication
authentication_info) _info)
{ {
return authentication_info->opaque; return authentication_info->opaque;
} }
void void
osip_authentication_info_set_opaque (osip_authentication_info_t * osip_authentication_info_set_opaque (osip_authentication_info_t * authentication
authentication_info, char *opaque) _info, char *opaque)
{ {
authentication_info->opaque = (char *) opaque; authentication_info->opaque = (char *) opaque;
} }
/* returns the authentication_info header as a string. */ /* returns the authentication_info header as a string. */
/* INPUT : osip_authentication_info_t *authentication_info | authentication_info header. */ /* INPUT : osip_authentication_info_t *authentication_info | authentication_info header. */
/* returns null on error. */ /* returns null on error. */
int int
osip_authentication_info_to_str (const osip_authentication_info_t * ainfo, char **dest) osip_authentication_info_to_str (const osip_authentication_info_t * ainfo, char **dest)
{ {
skipping to change at line 480 skipping to change at line 470
} }
tmp = osip_strn_append (tmp, "snum=", 5); tmp = osip_strn_append (tmp, "snum=", 5);
tmp = osip_str_append (tmp, ainfo->snum); tmp = osip_str_append (tmp, ainfo->snum);
} }
if (ainfo->srand != NULL) { if (ainfo->srand != NULL) {
if (tmp != start) { if (tmp != start) {
tmp = osip_strn_append (tmp, ", ", 2); tmp = osip_strn_append (tmp, ", ", 2);
} }
tmp = osip_strn_append (tmp, "srand=", 6); tmp = osip_strn_append (tmp, "srand=", 6);
tmp = osip_str_append (tmp, ainfo->srand); tmp = osip_str_append (tmp, ainfo->srand);
} }
if (ainfo->targetname != NULL) { if (ainfo->targetname != NULL) {
if (tmp != start) { if (tmp != start) {
tmp = osip_strn_append (tmp, ", ", 2); tmp = osip_strn_append (tmp, ", ", 2);
} }
tmp = osip_strn_append (tmp, "targetname=", 11); tmp = osip_strn_append (tmp, "targetname=", 11);
tmp = osip_str_append (tmp, ainfo->targetname); tmp = osip_str_append (tmp, ainfo->targetname);
} }
if (ainfo->realm != NULL) { if (ainfo->realm != NULL) {
if (tmp != start) { if (tmp != start) {
tmp = osip_strn_append (tmp, ", ", 2); tmp = osip_strn_append (tmp, ", ", 2);
 End of changes. 25 change blocks. 
40 lines changed or deleted 40 lines changed or added

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