|
Lines 194-200
ep_msg_send(EPassMsg *msg)
Link Here
|
| 194 |
/* the functions that actually do the work */ |
194 |
/* the functions that actually do the work */ |
| 195 |
#if WITH_GNOME_KEYRING |
195 |
#if WITH_GNOME_KEYRING |
| 196 |
static void |
196 |
static void |
| 197 |
ep_clear_passwords(EPassMsg *msg) |
197 |
ep_clear_passwords_keyring(EPassMsg *msg) |
| 198 |
{ |
198 |
{ |
| 199 |
GnomeKeyringAttributeList *attributes; |
199 |
GnomeKeyringAttributeList *attributes; |
| 200 |
GnomeKeyringAttribute attribute; |
200 |
GnomeKeyringAttribute attribute; |
|
Lines 234-240
ep_clear_passwords(EPassMsg *msg)
Link Here
|
| 234 |
} else { |
234 |
} else { |
| 235 |
for (tmp = matches; tmp; tmp = tmp->next) { |
235 |
for (tmp = matches; tmp; tmp = tmp->next) { |
| 236 |
result = gnome_keyring_item_delete_sync (default_keyring, ((GnomeKeyringFound *) tmp->data)->item_id); |
236 |
result = gnome_keyring_item_delete_sync (default_keyring, ((GnomeKeyringFound *) tmp->data)->item_id); |
| 237 |
d(g_printf("Delete Items %d\n", result)); |
237 |
d(g_print("Delete Items %d\n", result)); |
| 238 |
} |
238 |
} |
| 239 |
} |
239 |
} |
| 240 |
|
240 |
|
|
Lines 242-250
ep_clear_passwords(EPassMsg *msg)
Link Here
|
| 242 |
if (!msg->noreply) |
242 |
if (!msg->noreply) |
| 243 |
e_msgport_reply(&msg->msg); |
243 |
e_msgport_reply(&msg->msg); |
| 244 |
} |
244 |
} |
| 245 |
#else |
245 |
#endif |
| 246 |
static void |
246 |
static void |
| 247 |
ep_clear_passwords(EPassMsg *msg) |
247 |
ep_clear_passwords_file(EPassMsg *msg) |
| 248 |
{ |
248 |
{ |
| 249 |
char *path; |
249 |
char *path; |
| 250 |
|
250 |
|
|
Lines 258-264
ep_clear_passwords(EPassMsg *msg)
Link Here
|
| 258 |
if (!msg->noreply) |
258 |
if (!msg->noreply) |
| 259 |
e_msgport_reply(&msg->msg); |
259 |
e_msgport_reply(&msg->msg); |
| 260 |
} |
260 |
} |
| 261 |
#endif |
|
|
| 262 |
|
261 |
|
| 263 |
static gboolean |
262 |
static gboolean |
| 264 |
free_entry (gpointer key, gpointer value, gpointer user_data) |
263 |
free_entry (gpointer key, gpointer value, gpointer user_data) |
|
Lines 271-277
free_entry (gpointer key, gpointer value
Link Here
|
| 271 |
|
271 |
|
| 272 |
#if WITH_GNOME_KEYRING |
272 |
#if WITH_GNOME_KEYRING |
| 273 |
static void |
273 |
static void |
| 274 |
ep_forget_passwords(EPassMsg *msg) |
274 |
ep_forget_passwords_keyring(EPassMsg *msg) |
| 275 |
{ |
275 |
{ |
| 276 |
GnomeKeyringAttributeList *attributes; |
276 |
GnomeKeyringAttributeList *attributes; |
| 277 |
GnomeKeyringAttribute attribute; |
277 |
GnomeKeyringAttribute attribute; |
|
Lines 309-315
ep_forget_passwords(EPassMsg *msg)
Link Here
|
| 309 |
} else { |
309 |
} else { |
| 310 |
for (tmp = matches; tmp; tmp = tmp->next) { |
310 |
for (tmp = matches; tmp; tmp = tmp->next) { |
| 311 |
result = gnome_keyring_item_delete_sync (default_keyring, ((GnomeKeyringFound *) tmp->data)->item_id); |
311 |
result = gnome_keyring_item_delete_sync (default_keyring, ((GnomeKeyringFound *) tmp->data)->item_id); |
| 312 |
d(g_printf("Delete Items %d\n", result)); |
312 |
d(g_print("Delete Items %d\n", result)); |
| 313 |
} |
313 |
} |
| 314 |
} |
314 |
} |
| 315 |
|
315 |
|
|
Lines 321-329
ep_forget_passwords(EPassMsg *msg)
Link Here
|
| 321 |
if (!msg->noreply) |
321 |
if (!msg->noreply) |
| 322 |
e_msgport_reply(&msg->msg); |
322 |
e_msgport_reply(&msg->msg); |
| 323 |
} |
323 |
} |
| 324 |
#else |
324 |
#endif |
|
|
325 |
|
| 325 |
static void |
326 |
static void |
| 326 |
ep_forget_passwords(EPassMsg *msg) |
327 |
ep_forget_passwords_file(EPassMsg *msg) |
| 327 |
{ |
328 |
{ |
| 328 |
void *it; |
329 |
void *it; |
| 329 |
char *key; |
330 |
char *key; |
|
Lines 347-353
ep_forget_passwords(EPassMsg *msg)
Link Here
|
| 347 |
if (!msg->noreply) |
348 |
if (!msg->noreply) |
| 348 |
e_msgport_reply(&msg->msg); |
349 |
e_msgport_reply(&msg->msg); |
| 349 |
} |
350 |
} |
| 350 |
#endif |
|
|
| 351 |
|
351 |
|
| 352 |
static char * |
352 |
static char * |
| 353 |
password_path (const char *component_name, const char *key) |
353 |
password_path (const char *component_name, const char *key) |
|
Lines 369-387
password_path (const char *component_nam
Link Here
|
| 369 |
|
369 |
|
| 370 |
#if WITH_GNOME_KEYRING |
370 |
#if WITH_GNOME_KEYRING |
| 371 |
static void |
371 |
static void |
| 372 |
ep_remember_password(EPassMsg *msg) |
372 |
ep_remember_password_keyring(EPassMsg *msg) |
| 373 |
{ |
373 |
{ |
| 374 |
gpointer okey, value; |
374 |
gpointer okey, value; |
| 375 |
int len, state, save; |
|
|
| 376 |
|
375 |
|
| 377 |
if (g_hash_table_lookup_extended (passwords, msg->key, &okey, &value)) { |
376 |
if (g_hash_table_lookup_extended (passwords, msg->key, &okey, &value)) { |
| 378 |
/* add it to the on-disk cache of passwords */ |
377 |
/* add it to the on-disk cache of passwords */ |
| 379 |
GnomeKeyringAttributeList *attributes; |
378 |
GnomeKeyringAttributeList *attributes; |
| 380 |
GnomeKeyringAttribute attribute; |
379 |
GnomeKeyringAttribute attribute; |
| 381 |
GnomeKeyringResult result; |
380 |
GnomeKeyringResult result; |
| 382 |
GList *pass = NULL, *tmp; |
|
|
| 383 |
EUri *uri = e_uri_new (okey); |
381 |
EUri *uri = e_uri_new (okey); |
| 384 |
int item_id; |
382 |
guint32 item_id; |
| 385 |
|
383 |
|
| 386 |
if (!strcmp (uri->protocol, "ldap") && !uri->user) { |
384 |
if (!strcmp (uri->protocol, "ldap") && !uri->user) { |
| 387 |
/* LDAP doesnt use username in url. Let the url be the user key. So safe it */ |
385 |
/* LDAP doesnt use username in url. Let the url be the user key. So safe it */ |
|
Lines 431-439
ep_remember_password(EPassMsg *msg)
Link Here
|
| 431 |
if (!msg->noreply) |
429 |
if (!msg->noreply) |
| 432 |
e_msgport_reply(&msg->msg); |
430 |
e_msgport_reply(&msg->msg); |
| 433 |
} |
431 |
} |
| 434 |
#else |
432 |
#endif |
|
|
433 |
|
| 435 |
static void |
434 |
static void |
| 436 |
ep_remember_password(EPassMsg *msg) |
435 |
ep_remember_password_file(EPassMsg *msg) |
| 437 |
{ |
436 |
{ |
| 438 |
gpointer okey, value; |
437 |
gpointer okey, value; |
| 439 |
char *path, *pass64; |
438 |
char *path, *pass64; |
|
Lines 463-479
ep_remember_password(EPassMsg *msg)
Link Here
|
| 463 |
if (!msg->noreply) |
462 |
if (!msg->noreply) |
| 464 |
e_msgport_reply(&msg->msg); |
463 |
e_msgport_reply(&msg->msg); |
| 465 |
} |
464 |
} |
| 466 |
#endif |
|
|
| 467 |
|
465 |
|
| 468 |
#if WITH_GNOME_KEYRING |
466 |
#if WITH_GNOME_KEYRING |
| 469 |
static void |
467 |
static void |
| 470 |
ep_forget_password (EPassMsg *msg) |
468 |
ep_forget_password_keyring (EPassMsg *msg) |
| 471 |
{ |
469 |
{ |
| 472 |
GnomeKeyringAttributeList *attributes; |
470 |
GnomeKeyringAttributeList *attributes; |
| 473 |
GnomeKeyringAttribute attribute; |
471 |
GnomeKeyringAttribute attribute; |
| 474 |
GnomeKeyringResult result; |
472 |
GnomeKeyringResult result; |
| 475 |
GList *matches = NULL, *tmp; |
473 |
GList *matches = NULL, *tmp; |
| 476 |
char *path; |
|
|
| 477 |
char *default_keyring = NULL; |
474 |
char *default_keyring = NULL; |
| 478 |
gpointer okey, value; |
475 |
gpointer okey, value; |
| 479 |
EUri *uri = e_uri_new (msg->key); |
476 |
EUri *uri = e_uri_new (msg->key); |
|
Lines 563-569
ep_forget_password (EPassMsg *msg)
Link Here
|
| 563 |
} |
560 |
} |
| 564 |
if (present == 2 && accept) { |
561 |
if (present == 2 && accept) { |
| 565 |
result = gnome_keyring_item_delete_sync (default_keyring, ((GnomeKeyringFound *) tmp->data)->item_id); |
562 |
result = gnome_keyring_item_delete_sync (default_keyring, ((GnomeKeyringFound *) tmp->data)->item_id); |
| 566 |
d(g_printf("Delete Items %s %s %d\n", uri->host, uri->user, result)); |
563 |
d(g_print("Delete Items %s %s %d\n", uri->host, uri->user, result)); |
| 567 |
} |
564 |
} |
| 568 |
} |
565 |
} |
| 569 |
|
566 |
|
|
Lines 574-582
ep_forget_password (EPassMsg *msg)
Link Here
|
| 574 |
if (!msg->noreply) |
571 |
if (!msg->noreply) |
| 575 |
e_msgport_reply(&msg->msg); |
572 |
e_msgport_reply(&msg->msg); |
| 576 |
} |
573 |
} |
| 577 |
#else |
574 |
#endif |
|
|
575 |
|
| 578 |
static void |
576 |
static void |
| 579 |
ep_forget_password (EPassMsg *msg) |
577 |
ep_forget_password_file (EPassMsg *msg) |
| 580 |
{ |
578 |
{ |
| 581 |
gpointer okey, value; |
579 |
gpointer okey, value; |
| 582 |
char *path; |
580 |
char *path; |
|
Lines 595-608
ep_forget_password (EPassMsg *msg)
Link Here
|
| 595 |
if (!msg->noreply) |
597 |
if (!msg->noreply) |
| 596 |
e_msgport_reply(&msg->msg); |
598 |
e_msgport_reply(&msg->msg); |
| 597 |
} |
599 |
} |
| 598 |
#endif |
600 |
|
| 599 |
|
601 |
|
| 600 |
#if WITH_GNOME_KEYRING |
602 |
#if WITH_GNOME_KEYRING |
| 601 |
static void |
603 |
static void |
| 602 |
ep_get_password (EPassMsg *msg) |
604 |
ep_get_password_keyring (EPassMsg *msg) |
| 603 |
{ |
605 |
{ |
| 604 |
char *path, *passwd; |
606 |
char *passwd; |
| 605 |
char *encoded = NULL; |
|
|
| 606 |
GnomeKeyringAttributeList *attributes; |
607 |
GnomeKeyringAttributeList *attributes; |
| 607 |
GnomeKeyringAttribute attribute; |
608 |
GnomeKeyringAttribute attribute; |
| 608 |
GnomeKeyringResult result; |
609 |
GnomeKeyringResult result; |
|
Lines 688-698
ep_get_password (EPassMsg *msg)
Link Here
|
| 688 |
|
686 |
|
| 689 |
if (!msg->noreply) |
687 |
if (!msg->noreply) |
| 690 |
e_msgport_reply(&msg->msg); |
688 |
e_msgport_reply(&msg->msg); |
| 691 |
} |
689 |
} |
| 692 |
#else |
690 |
#endif |
|
|
691 |
|
| 693 |
static void |
692 |
static void |
| 694 |
ep_get_password (EPassMsg *msg) |
693 |
ep_get_password_file (EPassMsg *msg) |
| 695 |
{ |
694 |
{ |
| 696 |
char *path, *passwd; |
695 |
char *path, *passwd; |
| 697 |
char *encoded = NULL; |
696 |
char *encoded = NULL; |
| 698 |
|
697 |
|
|
Lines 713-719
ep_get_password (EPassMsg *msg)
Link Here
|
| 713 |
if (!msg->noreply) |
712 |
if (!msg->noreply) |
| 714 |
e_msgport_reply(&msg->msg); |
713 |
e_msgport_reply(&msg->msg); |
| 715 |
} |
714 |
} |
| 716 |
#endif |
|
|
| 717 |
|
715 |
|
| 718 |
static void |
716 |
static void |
| 719 |
ep_add_password (EPassMsg *msg) |
717 |
ep_add_password (EPassMsg *msg) |
|
Lines 756-764
pass_response(GtkDialog *dialog, int res
Link Here
|
| 756 |
msg->oldpass = msg->password; |
754 |
msg->oldpass = msg->password; |
| 757 |
ep_add_password(msg); |
755 |
ep_add_password(msg); |
| 758 |
} |
756 |
} |
| 759 |
|
757 |
#if WITH_GNOME_KEYRING |
|
|
758 |
if (*msg->remember && type == E_PASSWORDS_REMEMBER_FOREVER) { |
| 759 |
if (gnome_keyring_is_available()) |
| 760 |
ep_remember_password_keyring(msg); |
| 761 |
else |
| 762 |
ep_remember_password_file(msg); |
| 763 |
} |
| 764 |
#else |
| 760 |
if (*msg->remember && type == E_PASSWORDS_REMEMBER_FOREVER) |
765 |
if (*msg->remember && type == E_PASSWORDS_REMEMBER_FOREVER) |
| 761 |
ep_remember_password(msg); |
766 |
ep_remember_password_file(msg); |
|
|
767 |
#endif |
| 762 |
|
768 |
|
| 763 |
msg->noreply = noreply; |
769 |
msg->noreply = noreply; |
| 764 |
} |
770 |
} |
|
Lines 775-783
pass_response(GtkDialog *dialog, int res
Link Here
|
| 775 |
mw = (EPassMsg *)request_list.head; |
781 |
mw = (EPassMsg *)request_list.head; |
| 776 |
mn = (EPassMsg *)mw->msg.ln.next; |
782 |
mn = (EPassMsg *)mw->msg.ln.next; |
| 777 |
while (mn) { |
783 |
while (mn) { |
| 778 |
if ((mw->dispatch == ep_forget_password |
784 |
#if WITH_GNOME_KEYRING |
| 779 |
|| mw->dispatch == ep_get_password |
785 |
if ((mw->dispatch == (gnome_keyring_is_available() ? ep_forget_password_keyring : ep_forget_password_file) |
| 780 |
|| mw->dispatch == ep_ask_password) |
786 |
#else |
|
|
787 |
if ((mw->dispatch == ep_forget_password_file |
| 788 |
#endif |
| 789 |
#if WITH_GNOME_KEYRING |
| 790 |
|| mw->dispatch == (gnome_keyring_is_available() ? ep_get_password_keyring : ep_get_password_file) |
| 791 |
#else |
| 792 |
|| mw->dispatch == ep_get_password_file |
| 793 |
#endif |
| 794 |
|| mw->dispatch == ep_ask_password) |
| 781 |
&& (strcmp(mw->component, msg->component) == 0 |
795 |
&& (strcmp(mw->component, msg->component) == 0 |
| 782 |
&& strcmp(mw->key, msg->key) == 0)) { |
796 |
&& strcmp(mw->key, msg->key) == 0)) { |
| 783 |
e_dlist_remove((EDListNode *)mw); |
797 |
e_dlist_remove((EDListNode *)mw); |
|
Lines 838-844
ep_ask_password(EPassMsg *msg)
Link Here
|
| 838 |
gtk_widget_grab_focus (msg->entry); |
852 |
gtk_widget_grab_focus (msg->entry); |
| 839 |
|
853 |
|
| 840 |
if ((msg->flags & E_PASSWORDS_REPROMPT)) { |
854 |
if ((msg->flags & E_PASSWORDS_REPROMPT)) { |
| 841 |
ep_get_password(msg); |
855 |
#if WITH_GNOME_KEYRING |
|
|
856 |
if (gnome_keyring_is_available()) |
| 857 |
ep_get_password_keyring(msg); |
| 858 |
else |
| 859 |
ep_get_password_file(msg); |
| 860 |
#else |
| 861 |
ep_get_password_file(msg); |
| 862 |
#endif |
| 842 |
if (msg->password) { |
863 |
if (msg->password) { |
| 843 |
gtk_entry_set_text ((GtkEntry *) msg->entry, msg->password); |
864 |
gtk_entry_set_text ((GtkEntry *) msg->entry, msg->password); |
| 844 |
g_free (msg->password); |
865 |
g_free (msg->password); |
|
Lines 923-930
e_passwords_cancel(void)
Link Here
|
| 923 |
void |
944 |
void |
| 924 |
e_passwords_shutdown (void) |
945 |
e_passwords_shutdown (void) |
| 925 |
{ |
946 |
{ |
|
|
947 |
#ifdef WITH_GNOME_KEYRING |
| 926 |
/* shouldn't need this really - everything is synchronous */ |
948 |
/* shouldn't need this really - everything is synchronous */ |
| 927 |
#if !WITH_GNOME_KEYRING |
949 |
if (!gnome_keyring_is_available()) |
|
|
950 |
gnome_config_private_sync_file ("/Evolution"); |
| 951 |
#else |
| 928 |
gnome_config_private_sync_file ("/Evolution"); |
952 |
gnome_config_private_sync_file ("/Evolution"); |
| 929 |
#endif |
953 |
#endif |
| 930 |
e_passwords_cancel(); |
954 |
e_passwords_cancel(); |
|
Lines 962-969
e_passwords_set_online(int state)
Link Here
|
| 962 |
void |
986 |
void |
| 963 |
e_passwords_forget_passwords (void) |
987 |
e_passwords_forget_passwords (void) |
| 964 |
{ |
988 |
{ |
| 965 |
EPassMsg *msg = ep_msg_new(ep_forget_passwords); |
989 |
#if WITH_GNOME_KEYRING |
| 966 |
|
990 |
EPassMsg *msg = ep_msg_new(gnome_keyring_is_available() ? ep_forget_passwords_keyring : ep_forget_passwords_file); |
|
|
991 |
#else |
| 992 |
EPassMsg *msg = ep_msg_new(ep_forget_passwords_file); |
| 993 |
#endif |
| 994 |
|
| 967 |
ep_msg_send(msg); |
995 |
ep_msg_send(msg); |
| 968 |
ep_msg_free(msg); |
996 |
ep_msg_free(msg); |
| 969 |
} |
997 |
} |
|
Lines 976-982
e_passwords_forget_passwords (void)
Link Here
|
| 976 |
void |
1004 |
void |
| 977 |
e_passwords_clear_passwords (const char *component_name) |
1005 |
e_passwords_clear_passwords (const char *component_name) |
| 978 |
{ |
1006 |
{ |
| 979 |
EPassMsg *msg = ep_msg_new(ep_clear_passwords); |
1007 |
#if WITH_GNOME_KEYRING |
|
|
1008 |
EPassMsg *msg = ep_msg_new(gnome_keyring_is_available() ? ep_clear_passwords_keyring : ep_clear_passwords_file); |
| 1009 |
#else |
| 1010 |
EPassMsg *msg = ep_msg_new(ep_clear_passwords_file); |
| 1011 |
#endif |
| 980 |
|
1012 |
|
| 981 |
msg->component = component_name; |
1013 |
msg->component = component_name; |
| 982 |
ep_msg_send(msg); |
1014 |
ep_msg_send(msg); |
|
Lines 997-1004
e_passwords_remember_password (const cha
Link Here
|
| 997 |
g_return_if_fail(component_name != NULL); |
1029 |
g_return_if_fail(component_name != NULL); |
| 998 |
g_return_if_fail(key != NULL); |
1030 |
g_return_if_fail(key != NULL); |
| 999 |
|
1031 |
|
| 1000 |
msg = ep_msg_new(ep_remember_password); |
1032 |
#if WITH_GNOME_KEYRING |
| 1001 |
|
1033 |
msg = ep_msg_new(gnome_keyring_is_available() ? ep_remember_password_keyring : ep_remember_password_file); |
|
|
1034 |
#else |
| 1035 |
msg = ep_msg_new(ep_remember_password_file); |
| 1036 |
#endif |
| 1002 |
msg->component = component_name; |
1037 |
msg->component = component_name; |
| 1003 |
msg->key = key; |
1038 |
msg->key = key; |
| 1004 |
|
1039 |
|
|
Lines 1020-1027
e_passwords_forget_password (const char
Link Here
|
| 1020 |
g_return_if_fail(component_name != NULL); |
1055 |
g_return_if_fail(component_name != NULL); |
| 1021 |
g_return_if_fail(key != NULL); |
1056 |
g_return_if_fail(key != NULL); |
| 1022 |
|
1057 |
|
| 1023 |
msg = ep_msg_new(ep_forget_password); |
1058 |
#if WITH_GNOME_KEYRING |
| 1024 |
|
1059 |
msg = ep_msg_new(gnome_keyring_is_available() ? ep_forget_password_keyring : ep_forget_password_file); |
|
|
1060 |
#else |
| 1061 |
msg = ep_msg_new(ep_forget_password_file); |
| 1062 |
#endif |
| 1025 |
msg->component = component_name; |
1063 |
msg->component = component_name; |
| 1026 |
msg->key = key; |
1064 |
msg->key = key; |
| 1027 |
|
1065 |
|
|
Lines 1045-1051
e_passwords_get_password (const char *co
Link Here
|
| 1045 |
g_return_val_if_fail(component_name != NULL, NULL); |
1083 |
g_return_val_if_fail(component_name != NULL, NULL); |
| 1046 |
g_return_val_if_fail(key != NULL, NULL); |
1084 |
g_return_val_if_fail(key != NULL, NULL); |
| 1047 |
|
1085 |
|
| 1048 |
msg = ep_msg_new(ep_get_password); |
1086 |
#if WITH_GNOME_KEYRING |
|
|
1087 |
msg = ep_msg_new(gnome_keyring_is_available() ? ep_get_password_keyring : ep_get_password_file); |
| 1088 |
#else |
| 1089 |
msg = ep_msg_new(ep_get_password_file); |
| 1090 |
#endif |
| 1049 |
|
1091 |
|
| 1050 |
msg->component = component_name; |
1092 |
msg->component = component_name; |
| 1051 |
msg->key = key; |
1093 |
msg->key = key; |