mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-26 07:38:09 +00:00
fix stack overflow when using linphonecsh in a case where authentication prompt is asked.
git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@342 3f6dc0c8-ddfe-455d-9043-3cd528dc4637
This commit is contained in:
parent
6c708223ba
commit
f1e91d7f37
3 changed files with 20 additions and 14 deletions
|
|
@ -1256,7 +1256,9 @@ static int lpc_cmd_register(LinphoneCore *lc, char *args){
|
|||
LinphoneAuthInfo *info;
|
||||
osip_from_init(&from);
|
||||
if (osip_from_parse(from,identity)==0){
|
||||
info=linphone_auth_info_new(from->url->username,NULL,passwd,NULL,from->url->host);
|
||||
char realm[128];
|
||||
snprintf(realm,sizeof(realm)-1,"\"%s\"",from->url->host);
|
||||
info=linphone_auth_info_new(from->url->username,NULL,passwd,NULL,realm);
|
||||
linphone_core_add_auth_info(lc,info);
|
||||
}
|
||||
osip_from_free(from);
|
||||
|
|
|
|||
|
|
@ -228,19 +228,23 @@ linphonec_call_received(LinphoneCore *lc, const char *from)
|
|||
static void
|
||||
linphonec_prompt_for_auth(LinphoneCore *lc, const char *realm, const char *username)
|
||||
{
|
||||
LinphoneAuthInfo *pending_auth;
|
||||
|
||||
if ( auth_stack.nitems+1 > MAX_PENDING_AUTH )
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Can't accept another authentication request.\n"
|
||||
"Consider incrementing MAX_PENDING_AUTH macro.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
pending_auth=linphone_auth_info_new(username,NULL,NULL,NULL,realm);
|
||||
auth_stack.elem[auth_stack.nitems++]=pending_auth;
|
||||
/* no prompt possible when using pipes or tcp mode*/
|
||||
if (unix_socket || tcp_port){
|
||||
linphone_core_abort_authentication(lc,NULL);
|
||||
}else{
|
||||
LinphoneAuthInfo *pending_auth;
|
||||
|
||||
if ( auth_stack.nitems+1 > MAX_PENDING_AUTH )
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Can't accept another authentication request.\n"
|
||||
"Consider incrementing MAX_PENDING_AUTH macro.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
pending_auth=linphone_auth_info_new(username,NULL,NULL,NULL,realm);
|
||||
auth_stack.elem[auth_stack.nitems++]=pending_auth;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ static int realm_match(const char *realm1, const char *realm2){
|
|||
char tmp2[128];
|
||||
char *p1,*p2;
|
||||
strncpy(tmp1,realm1,sizeof(tmp1)-1);
|
||||
strncpy(tmp2,realm2,sizeof(tmp1)-1);
|
||||
strncpy(tmp2,realm2,sizeof(tmp2)-1);
|
||||
p1=remove_quotes(tmp1);
|
||||
p2=remove_quotes(tmp2);
|
||||
return strcmp(p1,p2)==0;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue