mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-25 15:18:11 +00:00
Option to store auth_info in linphonerc
Force value in user application after core creation in order to prevent the passwords to be stored.
This commit is contained in:
parent
d9e81266d5
commit
3a9e33feb0
7 changed files with 114 additions and 4 deletions
|
|
@ -131,7 +131,7 @@ void linphone_auth_info_write_config(LpConfig *config, LinphoneAuthInfo *obj, in
|
|||
sprintf(key,"auth_info_%i",pos);
|
||||
lp_config_clean_section(config,key);
|
||||
|
||||
if (obj==NULL){
|
||||
if (obj==NULL || lp_config_get_int(config, "sip", "store_auth_info", 1) == 0){
|
||||
return;
|
||||
}
|
||||
if (obj->username!=NULL){
|
||||
|
|
|
|||
|
|
@ -23,9 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "linphonecore_utils.h"
|
||||
#include <ortp/zrtp.h>
|
||||
|
||||
#ifdef TUNNEL_ENABLED
|
||||
#include "linphone_tunnel.h"
|
||||
#endif
|
||||
|
||||
extern "C" {
|
||||
#include "mediastreamer2/mediastream.h"
|
||||
|
|
@ -34,6 +31,8 @@ extern "C" {
|
|||
#include "private.h"
|
||||
#include <cpu-features.h>
|
||||
|
||||
#include "lpconfig.h"
|
||||
|
||||
#ifdef ANDROID
|
||||
#include <android/log.h>
|
||||
extern "C" void libmsilbc_init();
|
||||
|
|
@ -2225,3 +2224,17 @@ extern "C" jstring Java_org_linphone_core_LinphoneCoreImpl_getVersion(JNIEnv* e
|
|||
jstring jvalue =env->NewStringUTF(linphone_core_get_version());
|
||||
return jvalue;
|
||||
}
|
||||
|
||||
extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_getConfig(JNIEnv *env, jobject thiz, jlong lc) {
|
||||
return (jlong) linphone_core_get_config((LinphoneCore *)lc);
|
||||
}
|
||||
|
||||
extern "C" void Java_org_linphone_core_LpConfigImpl_setInt(JNIEnv *env, jobject thiz, jlong lpc,
|
||||
jstring section, jstring key, jint value) {
|
||||
const char *csection = env->GetStringUTFChars(section, NULL);
|
||||
const char *ckey = env->GetStringUTFChars(key, NULL);
|
||||
lp_config_set_int((LpConfig *)lpc, csection, ckey, (int) value);
|
||||
env->ReleaseStringUTFChars(section, csection);
|
||||
env->ReleaseStringUTFChars(key, ckey);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -237,6 +237,7 @@ static void linphone_gtk_init_liblinphone(const char *config_file,
|
|||
vtable.transfer_state_changed=linphone_gtk_transfer_state_changed;
|
||||
|
||||
the_core=linphone_core_new(&vtable,config_file,factory_config_file,NULL);
|
||||
//lp_config_set_int(linphone_core_get_config(the_core), "sip", "store_auth_info", 0);
|
||||
linphone_core_set_user_agent(the_core,"Linphone", LINPHONE_VERSION);
|
||||
linphone_core_set_waiting_callback(the_core,linphone_gtk_wait,NULL);
|
||||
linphone_core_set_zrtp_secrets_file(the_core,secrets_file);
|
||||
|
|
|
|||
|
|
@ -876,4 +876,10 @@ public interface LinphoneCore {
|
|||
* Enable/Disable the use of inband DTMFs
|
||||
*/
|
||||
void setUseRfc2833ForDtmfs(boolean use);
|
||||
|
||||
/**
|
||||
* @return returns LpConfig object to read/write to the config file: usefull if you wish to extend
|
||||
* the config file with your own sections
|
||||
*/
|
||||
LpConfig getConfig();
|
||||
}
|
||||
|
|
|
|||
48
java/common/org/linphone/core/LpConfig.java
Normal file
48
java/common/org/linphone/core/LpConfig.java
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
LPConfig.java
|
||||
Copyright (C) 2013 Belledonne Communications, Grenoble, France
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
package org.linphone.core;
|
||||
|
||||
|
||||
/**
|
||||
* The LpConfig object is used to manipulate a configuration file.
|
||||
*
|
||||
* <pre>
|
||||
* The format of the configuration file is a .ini like format:
|
||||
* - sections are defined in []
|
||||
* - each section contains a sequence of key=value pairs.
|
||||
*
|
||||
* Example:
|
||||
* [sound]
|
||||
* echocanceler=1
|
||||
* playback_dev=ALSA: Default device
|
||||
*
|
||||
* [video]
|
||||
* enabled=1
|
||||
* </pre>
|
||||
* }
|
||||
* @author Guillaume Beraudo
|
||||
*/
|
||||
public interface LpConfig {
|
||||
|
||||
/**
|
||||
* Sets an integer config item
|
||||
* @param key
|
||||
*/
|
||||
void setInt(String section, String key, int value);
|
||||
}
|
||||
|
|
@ -866,4 +866,10 @@ class LinphoneCoreImpl implements LinphoneCore {
|
|||
public void setUseRfc2833ForDtmfs(boolean use) {
|
||||
setUseRfc2833ForDtmfs(nativePtr, use);
|
||||
}
|
||||
|
||||
private native long getConfig(long ptr);
|
||||
public LpConfig getConfig() {
|
||||
long configPtr=getConfig(nativePtr);
|
||||
return new LpConfigImpl(configPtr);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
36
java/impl/org/linphone/core/LpConfigImpl.java
Normal file
36
java/impl/org/linphone/core/LpConfigImpl.java
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
LPConfigImpl.java
|
||||
Copyright (C) 2013 Belledonne Communications, Grenoble, France
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
package org.linphone.core;
|
||||
|
||||
|
||||
|
||||
class LpConfigImpl implements LpConfig {
|
||||
|
||||
private final long nativePtr;
|
||||
|
||||
public LpConfigImpl(long ptr) {
|
||||
nativePtr=ptr;
|
||||
}
|
||||
|
||||
private native void setInt(long ptr, String section, String key, int value);
|
||||
public void setInt(String section, String key, int value) {
|
||||
setInt(nativePtr, section, key, value);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue