Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-daemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-daemon
Commits
7b2cf165
Commit
7b2cf165
authored
11 years ago
by
Tristan Matthews
Committed by
Gerrit Code Review
11 years ago
Browse files
Options
Downloads
Patches
Plain Diff
gnome: disable private key file chooser if certificate has key
Refs #44946 Change-Id: I85fb287831a8f143a1a6300af321e114b0dab842
parent
3c1e88dd
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
gnome/src/config/tlsadvanceddialog.c
+25
-5
25 additions, 5 deletions
gnome/src/config/tlsadvanceddialog.c
gnome/src/dbus/dbus.c
+11
-0
11 additions, 0 deletions
gnome/src/dbus/dbus.c
gnome/src/dbus/dbus.h
+1
-0
1 addition, 0 deletions
gnome/src/dbus/dbus.h
with
37 additions
and
5 deletions
gnome/src/config/tlsadvanceddialog.c
+
25
−
5
View file @
7b2cf165
...
@@ -76,15 +76,28 @@ confirm_certificate_use(GtkWidget *window)
...
@@ -76,15 +76,28 @@ confirm_certificate_use(GtkWidget *window)
}
}
static
void
static
void
certificate_set_cb
(
GtkFileChooserButton
*
widget
,
G_GNUC_UNUSED
gpointer
user_data
)
certificate_set_cb
(
GtkFileChooserButton
*
widget
,
gpointer
user_data
)
{
{
gchar
*
filename
=
get_filename
(
GTK_WIDGET
(
widget
));
gchar
*
filename
=
get_filename
(
GTK_WIDGET
(
widget
));
const
gboolean
is_valid
=
dbus_check_certificate
(
filename
);
const
gboolean
is_valid
=
dbus_check_certificate
(
filename
);
gboolean
contains_key
=
FALSE
;
GtkWidget
*
private_key_chooser
=
user_data
;
/* If certificate is invalid, check if user really wants to use it */
/* If certificate is invalid, check if user really wants to use it */
if
(
!
is_valid
&&
!
confirm_certificate_use
(
gtk_widget_get_toplevel
(
GTK_WIDGET
(
widget
))))
if
(
!
is_valid
&&
!
confirm_certificate_use
(
gtk_widget_get_toplevel
(
GTK_WIDGET
(
widget
))))
{
gtk_file_chooser_unselect_filename
(
GTK_FILE_CHOOSER
(
widget
),
filename
);
gtk_file_chooser_unselect_filename
(
GTK_FILE_CHOOSER
(
widget
),
filename
);
}
else
{
/* disable private key file chooser if certificate contains key */
contains_key
=
dbus_certificate_contains_private_key
(
filename
);
if
(
contains_key
)
gtk_file_chooser_unselect_all
(
GTK_FILE_CHOOSER
(
private_key_chooser
));
}
/* Defaults to sensitive if no key was found */
gtk_widget_set_sensitive
(
private_key_chooser
,
!
contains_key
);
g_free
(
filename
);
g_free
(
filename
);
}
}
...
@@ -182,9 +195,10 @@ void show_advanced_tls_options(account_t *account, SFLPhoneClient *client)
...
@@ -182,9 +195,10 @@ void show_advanced_tls_options(account_t *account, SFLPhoneClient *client)
gtk_misc_set_alignment
(
GTK_MISC
(
label
),
0
,
0
.
5
);
gtk_misc_set_alignment
(
GTK_MISC
(
label
),
0
,
0
.
5
);
gtk_grid_attach
(
GTK_GRID
(
grid
),
label
,
0
,
4
,
1
,
1
);
gtk_grid_attach
(
GTK_GRID
(
grid
),
label
,
0
,
4
,
1
,
1
);
GtkWidget
*
certificateFileChooser
=
gtk_file_chooser_button_new
(
_
(
"Choose a public endpoint certificate (optional)"
),
GTK_FILE_CHOOSER_ACTION_OPEN
);
GtkWidget
*
certificateFileChooser
=
gtk_file_chooser_button_new
(
_
(
"Choose a public endpoint certificate (optional)"
),
GTK_FILE_CHOOSER_ACTION_OPEN
);
g_signal_connect
(
GTK_FILE_CHOOSER
(
certificateFileChooser
),
"file-set"
,
G_CALLBACK
(
certificate_set_cb
),
NULL
);
gtk_grid_attach
(
GTK_GRID
(
grid
),
certificateFileChooser
,
1
,
4
,
1
,
1
);
gtk_grid_attach
(
GTK_GRID
(
grid
),
certificateFileChooser
,
1
,
4
,
1
,
1
);
gboolean
contains_key
=
FALSE
;
if
(
!
tls_certificate_file
)
{
if
(
!
tls_certificate_file
)
{
gtk_file_chooser_unselect_all
(
GTK_FILE_CHOOSER
(
caListFileChooser
));
gtk_file_chooser_unselect_all
(
GTK_FILE_CHOOSER
(
caListFileChooser
));
}
else
{
}
else
{
...
@@ -194,6 +208,7 @@ void show_advanced_tls_options(account_t *account, SFLPhoneClient *client)
...
@@ -194,6 +208,7 @@ void show_advanced_tls_options(account_t *account, SFLPhoneClient *client)
GFile
*
file
=
g_file_new_for_path
(
tls_certificate_file
);
GFile
*
file
=
g_file_new_for_path
(
tls_certificate_file
);
gtk_file_chooser_set_file
(
GTK_FILE_CHOOSER
(
certificateFileChooser
),
file
,
NULL
);
gtk_file_chooser_set_file
(
GTK_FILE_CHOOSER
(
certificateFileChooser
),
file
,
NULL
);
g_object_unref
(
file
);
g_object_unref
(
file
);
contains_key
=
dbus_certificate_contains_private_key
(
tls_certificate_file
);
}
}
}
}
...
@@ -203,10 +218,14 @@ void show_advanced_tls_options(account_t *account, SFLPhoneClient *client)
...
@@ -203,10 +218,14 @@ void show_advanced_tls_options(account_t *account, SFLPhoneClient *client)
GtkWidget
*
privateKeyFileChooser
=
gtk_file_chooser_button_new
(
_
(
"Choose a private key file (optional)"
),
GTK_FILE_CHOOSER_ACTION_OPEN
);
GtkWidget
*
privateKeyFileChooser
=
gtk_file_chooser_button_new
(
_
(
"Choose a private key file (optional)"
),
GTK_FILE_CHOOSER_ACTION_OPEN
);
gtk_grid_attach
(
GTK_GRID
(
grid
),
privateKeyFileChooser
,
1
,
5
,
1
,
1
);
gtk_grid_attach
(
GTK_GRID
(
grid
),
privateKeyFileChooser
,
1
,
5
,
1
,
1
);
if
(
!
tls_private_key_file
)
{
/* if certificate contains private key file, disallow private
* key file selection */
g_signal_connect
(
GTK_FILE_CHOOSER
(
certificateFileChooser
),
"file-set"
,
G_CALLBACK
(
certificate_set_cb
),
privateKeyFileChooser
);
if
(
!
tls_private_key_file
||
contains_key
)
{
gtk_file_chooser_unselect_all
(
GTK_FILE_CHOOSER
(
privateKeyFileChooser
));
gtk_file_chooser_unselect_all
(
GTK_FILE_CHOOSER
(
privateKeyFileChooser
));
}
else
{
}
else
{
if
(
!*
tls_private_key_file
)
{
if
(
!*
tls_private_key_file
||
contains_key
)
{
gtk_file_chooser_unselect_all
(
GTK_FILE_CHOOSER
(
privateKeyFileChooser
));
gtk_file_chooser_unselect_all
(
GTK_FILE_CHOOSER
(
privateKeyFileChooser
));
}
else
{
}
else
{
GFile
*
file
=
g_file_new_for_path
(
tls_private_key_file
);
GFile
*
file
=
g_file_new_for_path
(
tls_private_key_file
);
...
@@ -214,6 +233,7 @@ void show_advanced_tls_options(account_t *account, SFLPhoneClient *client)
...
@@ -214,6 +233,7 @@ void show_advanced_tls_options(account_t *account, SFLPhoneClient *client)
g_object_unref
(
file
);
g_object_unref
(
file
);
}
}
}
}
gtk_widget_set_sensitive
(
privateKeyFileChooser
,
!
contains_key
);
label
=
gtk_label_new_with_mnemonic
(
_
(
"Password for the private key"
));
label
=
gtk_label_new_with_mnemonic
(
_
(
"Password for the private key"
));
gtk_misc_set_alignment
(
GTK_MISC
(
label
),
0
,
0
.
5
);
gtk_misc_set_alignment
(
GTK_MISC
(
label
),
0
,
0
.
5
);
...
...
This diff is collapsed.
Click to expand it.
gnome/src/dbus/dbus.c
+
11
−
0
View file @
7b2cf165
...
@@ -2222,6 +2222,17 @@ dbus_check_certificate(const gchar *filepath)
...
@@ -2222,6 +2222,17 @@ dbus_check_certificate(const gchar *filepath)
return
result
;
return
result
;
}
}
gboolean
dbus_certificate_contains_private_key
(
const
gchar
*
filepath
)
{
GError
*
error
=
NULL
;
gboolean
result
;
org_sflphone_SFLphone_ConfigurationManager_check_for_private_key
(
config_proxy
,
filepath
,
&
result
,
&
error
);
check_error
(
error
);
return
result
;
}
gchar
*
gchar
*
dbus_get_address_from_interface_name
(
const
gchar
*
interface
)
dbus_get_address_from_interface_name
(
const
gchar
*
interface
)
{
{
...
...
This diff is collapsed.
Click to expand it.
gnome/src/dbus/dbus.h
+
1
−
0
View file @
7b2cf165
...
@@ -573,6 +573,7 @@ void dbus_set_confirm_go_clear(const callable_obj_t *c);
...
@@ -573,6 +573,7 @@ void dbus_set_confirm_go_clear(const callable_obj_t *c);
*/
*/
gchar
**
dbus_get_supported_tls_method
();
gchar
**
dbus_get_supported_tls_method
();
gboolean
dbus_certificate_contains_private_key
(
const
gchar
*
filepath
);
gboolean
dbus_check_certificate
(
const
gchar
*
filepath
);
gboolean
dbus_check_certificate
(
const
gchar
*
filepath
);
GHashTable
*
dbus_get_shortcuts
(
void
);
GHashTable
*
dbus_get_shortcuts
(
void
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment