Profile: fix set default exteranl profile authorize
PATCH 1/3 Profile: fix set default exteranl profile authorize
From: Martin <[email protected]>
authorize is always set as "true" in function ext_set_defaults().
the static variable authorize of default_settings will be 0(false), if it is not initialized. So item authorize needs to be initized if the value is true (non-0).
And then function ext_set_defaults() can set default authorize properly
--- src/profile.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
src/profile.c +13 -2
@@ -1907,12 +1907,14 @@ static struct default_settings { .uuid = SPP_UUID, .name = "Serial Port", .channel = SPP_DEFAULT_CHANNEL, + .authorize = true, .get_record = get_spp_record, .version = 0x0102, }, { .uuid = DUN_GW_UUID, .name = "Dial-Up Networking", .channel = DUN_DEFAULT_CHANNEL, + .authorize = true, .get_record = get_dun_record, .version = 0x0102, }, {
@@ -1921,6 +1923,7 @@ static struct default_settings { .priority = BTD_PROFILE_PRIORITY_HIGH, .remote_uuid = HFP_AG_UUID, .channel = HFP_HF_DEFAULT_CHANNEL, + .authorize = true, .auto_connect = true, .get_record = get_hfp_hf_record, .version = 0x0105,
@@ -1930,6 +1933,7 @@ static struct default_settings { .priority = BTD_PROFILE_PRIORITY_HIGH, .remote_uuid = HFP_HS_UUID, .channel = HFP_AG_DEFAULT_CHANNEL, + .authorize = true, .auto_connect = true, .get_record = get_hfp_ag_record, .version = 0x0105,
@@ -1939,6 +1943,7 @@ static struct default_settings { .priority = BTD_PROFILE_PRIORITY_HIGH, .remote_uuid = HSP_HS_UUID, .channel = HSP_AG_DEFAULT_CHANNEL, + .authorize = true, .auto_connect = true, }, { .uuid = OBEX_OPP_UUID,
@@ -1947,7 +1952,6 @@ static struct default_settings { .psm = BTD_PROFILE_PSM_AUTO, .mode = BT_IO_MODE_ERTM, .sec_level = BT_IO_SEC_LOW, - .authorize = false, .get_record = get_opp_record, .version = 0x0102, }, {
@@ -1956,30 +1960,35 @@ static struct default_settings { .channel = FTP_DEFAULT_CHANNEL, .psm = BTD_PROFILE_PSM_AUTO, .mode = BT_IO_MODE_ERTM, + .authorize = true, .get_record = get_ftp_record, .version = 0x0102, }, { .uuid = OBEX_SYNC_UUID, .name = "Synchronization", .channel = SYNC_DEFAULT_CHANNEL, + .authorize = true, .get_record = get_sync_record, .version = 0x0100, }, { .uuid = OBEX_PSE_UUID, .name = "Phone Book Access", .channel = PBAP_DEFAULT_CHANNEL, + .authorize = true, .get_record = get_pse_record, .version = 0x0101, }, { .uuid = OBEX_PCE_UUID, .name = "Phone Book Access Client", .remote_uuid = OBEX_PSE_UUID, + .authorize = true, .get_record = get_pce_record, .version = 0x0101, }, { .uuid = OBEX_MAS_UUID, .name = "Message Access", .channel = MAS_DEFAULT_CHANNEL, + .authorize = true, .get_record = get_mas_record, .version = 0x0100 }, {
@@ -1987,6 +1996,7 @@ static struct default_settings { .name = "Message Notification", .channel = MNS_DEFAULT_CHANNEL, .psm = BTD_PROFILE_PSM_AUTO, + .authorize = true, .get_record = get_mns_record, .version =0x0100 },
@@ -1998,7 +2008,6 @@ static void ext_set_defaults(struct ext_profile *ext) ext->mode =BT_IO_MODE_BASIC ; ext->sec_level =BT_IO_SEC_MEDIUM ; - ext->authorize = true; ext->enable_client = true; ext->enable_server = true; ext->remote_uuid =NULL ;
@@ -2029,6 +2038,8 @@ static void ext_set_defaults(struct ext_profile *ext)if (settings->mode) ext->mode = settings->mode; + ext->authorize = settings->authorize; +if (settings->auto_connect) ext->p.auto_connect = true;
Signature · 1 line
1.7.10.4
Hi Martin,
Quoted 9 lines · On Mon, Jul 15, 2013, [email protected] wrote:
authorize is always set as "true" in function
ext_set_defaults().the static variable authorize of
default_settingswill be 0(false), if it is not initialized. So item authorize needs to be initized if the value is true (non-0).
And then functionext_set_defaults()can set default authorize properly--- src/profile.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
The subject says "PATCH 1/3". Did you intend to send three patches? I can only see this one.
src/profile.c static void ext_set_defaults(struct ext_profile *ext) · line 2013
Quoted 8 lines
src/profile.c +0
-1@@ -1998,7 +2008,6 @@ static void ext_set_defaults(struct ext_profile *ext) ext->mode =BT_IO_MODE_BASIC ; ext->sec_level =BT_IO_SEC_MEDIUM ; - ext->authorize = true; ext->enable_client = true; ext->enable_server = true; ext->remote_uuid =NULL ;
The above change is still wrong. Not setting to true is the same as setting to false since g_new0 was used. Don't change that part at all.
Johan
Johan:
Quoted 8 lines
src/profile.c static void ext_set_defaults(struct ext_profile *ext) · line 2013
Quoted 5 lines
src/profile.c +0
-1ext->sec_level =BT_IO_SEC_MEDIUM ; - ext->authorize = true; ext->enable_client = true; ext->enable_server = true; ext->remote_uuid =NULL ;The above change is still wrong. Not setting to true is the same as setting to false since
g_new0was used. Don't change that part at a
I can't find issue here
I set the ext->authorize = settings->authorize so no matter the original value is, it will be just set as the same value with default setting.
Hi Martin,
Quoted 8 lines · Martin
Quoted 8 lines
src/profile.c static void ext_set_defaults(struct ext_profile *ext) · line 2013
Quoted 5 lines
src/profile.c +0
-1ext->sec_level =BT_IO_SEC_MEDIUM ; - ext->authorize = true; ext->enable_client = true; ext->enable_server = true; ext->remote_uuid =NULL ;The above change is still wrong. Not setting to true is the same as setting to false since
g_new0was used. Don't change that part at a
Quoted 4 lines
I can't find issue here
I set theext->authorize=settings->authorizeso no matter the original value is, it will be just set as the same value with default setting.
That's true, but what if the external profile is something that we don't have a settings entry for? In that case ext->authorize will never be explicitly set to anything.
Johan
Hi Johan:
Quoted 19 lines
-----Original Message-----
From: Johan Hedberg [mailto:[email protected]]
Sent: Monday, July 15, 2013 17:51
To: Xu, Martin
Cc: [email protected]; [email protected]
Subject: Re: [PATCH 1/3] Profile: fix set default exteranl profile authorizeHi Martin,
Quoted 8 lines · Martin
Quoted 8 lines
src/profile.c static void ext_set_defaults(struct ext_profile *ext) · line 2013
Quoted 5 lines
src/profile.c +0
-1ext->sec_level =BT_IO_SEC_MEDIUM ; - ext->authorize = true; ext->enable_client = true; ext->enable_server = true; ext->remote_uuid =NULL ;The above change is still wrong. Not setting to true is the same as setting to false since
g_new0was used. Don't change that part at a
Quoted 8 lines
Quoted 4 lines
I can't find issue here
I set theext->authorize=settings->authorizeso no matter the original value is, it will be just set as the same value with default setting.That's true, but what if the external profile is something that we don't have a settings entry for? In that case
ext->authorizewill never be explicitly set to anything.
You are right, I will resent the patch. :)