[gq-commit] gq/src browse-dnd.c,1.14,1.15 search.c,1.51,1.52 util.c,1.71,1.72
Status: Beta
Brought to you by:
sur5r
From: <sta...@us...> - 2003-10-17 05:29:49
|
Update of /cvsroot/gqclient/gq/src In directory sc8-pr-cvs1:/tmp/cvs-serv20193 Modified Files: browse-dnd.c search.c util.c Log Message: * Improved error messages. Many messages now contain the name of the server for which an operation failed * Implemented proper server_by_name return value handling outside of server_by_name Index: browse-dnd.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/browse-dnd.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** browse-dnd.c 8 Oct 2003 22:01:04 -0000 1.14 --- browse-dnd.c 17 Oct 2003 05:26:23 -0000 1.15 *************** *** 535,539 **** printf("do_move_after_reception selhash=%08lx server=%s dn=%s\n", (unsigned long) selhash, ! (char*)g_hash_table_lookup(selhash, "nickname"), dn); } #endif --- 535,539 ---- printf("do_move_after_reception selhash=%08lx server=%s dn=%s\n", (unsigned long) selhash, ! (const char*)g_hash_table_lookup(selhash, "nickname"), dn); } #endif *************** *** 541,545 **** source_server = server_by_name(g_hash_table_lookup(selhash, "nickname")); if (source_server == NULL) { ! statusbar_msg(_("Could not find source server by its nickname!")); return; } --- 541,546 ---- source_server = server_by_name(g_hash_table_lookup(selhash, "nickname")); if (source_server == NULL) { ! statusbar_msg(_("Could not find source server by its nickname ('%s')!"), ! (const char*)g_hash_table_lookup(selhash, "nickname")); return; } *************** *** 722,731 **** { GtkCTreeNode *ctree_node; ! char *server = NULL, *dn = NULL; GHashTable *selhash = gtk_object_get_data(GTK_OBJECT(widget), "drag-and-selection-data"); ! server = g_hash_table_lookup(selhash, "nickname"); dn = g_hash_table_lookup(selhash, "dn"); --- 723,733 ---- { GtkCTreeNode *ctree_node; ! char *s = NULL, *dn = NULL; ! struct ldapserver *server; GHashTable *selhash = gtk_object_get_data(GTK_OBJECT(widget), "drag-and-selection-data"); ! s = g_hash_table_lookup(selhash, "nickname"); dn = g_hash_table_lookup(selhash, "dn"); *************** *** 736,746 **** drag_context->suggested_action, drag_context->action, ! server, dn ); } #endif ctree_node = tree_node_from_server_dn(GTK_CTREE(widget), ! server_by_name(server), dn); if (ctree_node) { --- 738,752 ---- drag_context->suggested_action, drag_context->action, ! s, dn ); } #endif + server = server_by_name(s); + if (!server) { + return; + } ctree_node = tree_node_from_server_dn(GTK_CTREE(widget), ! server, dn); if (ctree_node) { *************** *** 869,872 **** --- 875,884 ---- #endif + if (server == NULL) { + error_push(ctx, + _("Cannot find server by its nickname ('%s')"), + g_hash_table_lookup(selhash, "nickname")); + goto done; + } /* retrieve from server ... */ *************** *** 921,925 **** if (msg) ldap_msgfree(msg); close_connection(server, FALSE); ! error_flush(ctx); return; --- 933,937 ---- if (msg) ldap_msgfree(msg); close_connection(server, FALSE); ! done: error_flush(ctx); return; Index: search.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/search.c,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** search.c 14 Oct 2003 22:36:26 -0000 1.51 --- search.c 17 Oct 2003 05:26:23 -0000 1.52 *************** *** 538,547 **** cur_servername = gtk_editable_get_chars(GTK_EDITABLE(GTK_COMBO(servcombo)->entry), 0, -1); server = server_by_name(cur_servername); - g_free(cur_servername); if(!server) { ! statusbar_msg(_("Oops! No server found!")); SEARCHTAB(tab)->search_lock = 0; return; } if( (ld = open_connection(server)) == NULL) { --- 538,548 ---- cur_servername = gtk_editable_get_chars(GTK_EDITABLE(GTK_COMBO(servcombo)->entry), 0, -1); server = server_by_name(cur_servername); if(!server) { ! statusbar_msg(_("Oops! Server '%s' not found!"), cur_servername); ! g_free(cur_servername); SEARCHTAB(tab)->search_lock = 0; return; } + g_free(cur_servername); if( (ld = open_connection(server)) == NULL) { *************** *** 553,557 **** free(querystring); ! statusbar_msg(_("searching for %s"), filter); searchbase_combo = SEARCHTAB(tab)->searchbase_combo; --- 554,558 ---- free(querystring); ! statusbar_msg(_("Searching for %s"), filter); searchbase_combo = SEARCHTAB(tab)->searchbase_combo; Index: util.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/util.c,v retrieving revision 1.71 retrieving revision 1.72 diff -C2 -d -r1.71 -r1.72 *** util.c 12 Oct 2003 11:10:41 -0000 1.71 --- util.c 17 Oct 2003 05:26:23 -0000 1.72 *************** *** 110,114 **** if(!ld) { error_push(open_context, ! _("Failed to initialize LDAP structure: %s."), ldap_err2string(rc)); } --- 110,115 ---- if(!ld) { error_push(open_context, ! _("Failed to initialize LDAP structure for server '%1$s': %2$s."), ! server->name, ldap_err2string(rc)); } *************** *** 116,120 **** ld = NULL; error_push(open_context, ! _("Sorry. No URI support available. Your LDAP toolkit does not support LDAP URIs.")); #endif } else { --- 117,122 ---- ld = NULL; error_push(open_context, ! _("Cannot connect to '%s'. No URI support available. Your LDAP toolkit does not support LDAP URIs."), ! server->name); #endif } else { *************** *** 122,126 **** if(!ld) { error_push(open_context, ! _("Failed to initialize LDAP structure: %s."), strerror(errno)); } --- 124,128 ---- if(!ld) { error_push(open_context, ! _("Failed to initialize LDAP structure for server %1$s: %2$s."), strerror(errno)); } *************** *** 161,165 **** if (server->version != LDAP_VERSION3) { error_push(open_context, ! _("Couldn't set protocol version to LDAPv3.")); } } --- 163,168 ---- if (server->version != LDAP_VERSION3) { error_push(open_context, ! _("Server '%s': Couldn't set protocol version to LDAPv3."), ! server->name); } } *************** *** 169,173 **** if(rc != LDAP_SUCCESS) { error_push(open_context, ! _("Couldn't enable TLS on the LDAP connection: %s"), ldap_err2string(rc)); push_ldap_addl_error(ld, open_context); --- 172,177 ---- if(rc != LDAP_SUCCESS) { error_push(open_context, ! _("Couldn't enable TLS on the LDAP connection to '%1$s': %2$s"), ! server->name, ldap_err2string(rc)); push_ldap_addl_error(ld, open_context); *************** *** 178,183 **** #else error_push(open_context, ! _("TLS was not found to be supported by your LDAP libraries.\n" ! "See README.TLS for more information.\n")); #endif /* defined(HAVE_TLS) */ } --- 182,188 ---- #else error_push(open_context, ! _("Cannot use TLS with server '%s'. TLS was not found to be supported by your LDAP libraries.\n" ! "See README.TLS for more information.\n"), ! server->name); #endif /* defined(HAVE_TLS) */ } *************** *** 189,194 **** #else error_push(open_context, ! _("OpenLDAP client-side caching was not enabled.\n" ! "See configure --help for more information.\n")); #endif } --- 194,201 ---- #else error_push(open_context, ! _("Cannot cache LDAP objects for server '%s'.\n" ! "OpenLDAP client-side caching was not enabled.\n" ! "See configure --help for more information.\n"), ! server->name); #endif } *************** *** 226,231 **** # else error_push(open_context, ! _("GQ was compiled without Kerberos support.\n" ! "Run 'configure --help' for more information\n")); statusbar_msg_clear(); ldap_unbind(ld); --- 233,240 ---- # else error_push(open_context, ! _("Cannot use Kerberos bind with '%s'.\n" ! "GQ was compiled without Kerberos support.\n" ! "Run 'configure --help' for more information\n"), ! server->name); statusbar_msg_clear(); ldap_unbind(ld); *************** *** 238,243 **** # else error_push(open_context, ! _("GQ was compiled without SASL support.\n" ! "Run 'configure --help' for more information\n")); statusbar_msg_clear(); ldap_unbind(ld); --- 247,254 ---- # else error_push(open_context, ! _("Cannot use SASL bind with '%s'.\n" ! "GQ was compiled without SASL support.\n" ! "Run 'configure --help' for more information\n"), ! server->name); statusbar_msg_clear(); ldap_unbind(ld); *************** *** 259,264 **** error_push(open_context, ! _("Couldn't bind LDAP connection: %s"), ! ldap_err2string(rc)); push_ldap_addl_error(ld, open_context); statusbar_msg_clear(); --- 270,275 ---- error_push(open_context, ! _("Couldn't bind LDAP connection to '%1$s': %2$s"), ! server->name, ldap_err2string(rc)); push_ldap_addl_error(ld, open_context); statusbar_msg_clear(); *************** *** 292,296 **** if (rc != LDAP_OPT_SUCCESS ) { error_push(open_context, ! _("Could not set critical ManageDSAit control")); push_ldap_addl_error(ld, open_context); --- 303,307 ---- if (rc != LDAP_OPT_SUCCESS ) { error_push(open_context, ! _("Could not set critical ManageDSAit control on connection to server '%s'."), server->name); push_ldap_addl_error(ld, open_context); *************** *** 340,344 **** message = g_string_sized_new(128); g_string_sprintf(message, ! _("Password for server %s"), server->ldaphost); if (query_popup(message->str, &ret, TRUE /* is_password */)) { --- 351,355 ---- message = g_string_sized_new(128); g_string_sprintf(message, ! _("Password for server %s"), server->name); if (query_popup(message->str, &ret, TRUE /* is_password */)) { *************** *** 358,364 **** if(server->ldapport == 389) { ! statusbar_msg(_("connecting to %s"), server->ldaphost); } else { ! statusbar_msg(_("connecting to %1$s port %2$d"), server->ldaphost, server->ldapport); } --- 369,375 ---- if(server->ldapport == 389) { ! statusbar_msg(_("Connecting to %s"), server->ldaphost); } else { ! statusbar_msg(_("Connecting to %1$s port %2$d"), server->ldaphost, server->ldapport); } *************** *** 533,537 **** } ! statusbar_msg(_("deleting: %s"), dn); msg = ldap_delete_s(ld, dn); --- 544,548 ---- } ! statusbar_msg(_("Deleting: %s"), dn); msg = ldap_delete_s(ld, dn); *************** *** 543,547 **** GString *message = g_string_sized_new(128); g_string_sprintf(message, ! "%s: %s", dn, ldap_err2string(msg)); error_popup(_("Error deleting entry"), message->str); g_string_free(message, TRUE); --- 554,559 ---- GString *message = g_string_sized_new(128); g_string_sprintf(message, ! "Error deleting DN '%1$s' on '%2$s': %3$s", ! dn, server->name, ldap_err2string(msg)); error_popup(_("Error deleting entry"), message->str); g_string_free(message, TRUE); *************** *** 549,553 **** } else { ! statusbar_msg(_("deleted %s"), dn); } --- 561,565 ---- } else { ! statusbar_msg(_("Deleted %s"), dn); } *************** *** 827,836 **** } - /* XXX - This needs to be gotten rid of, and instead have the appropriate - errors generated in the code that depends on server_by_name. - -- a7r - */ - error_popup(_("Error finding server"), _("Server not configured.")); - return(NULL); } --- 839,842 ---- *************** *** 855,859 **** } ! statusbar_msg(_("checking subtree for %s"), dn); msg = ldap_search(ld, dn, LDAP_SCOPE_ONELEVEL, "(objectclass=*)", --- 861,865 ---- } ! statusbar_msg(_("Checking subtree for %s"), dn); msg = ldap_search(ld, dn, LDAP_SCOPE_ONELEVEL, "(objectclass=*)", *************** *** 1548,1552 **** /* try LDAP V3 style config */ ! statusbar_msg(_("base search on NULL DN")); msg = ldap_search_s(ld, "", LDAP_SCOPE_BASE, "(objectclass=*)", ldapv3_config, 0, &res); --- 1554,1558 ---- /* try LDAP V3 style config */ ! statusbar_msg(_("Base search on NULL DN")); msg = ldap_search_s(ld, "", LDAP_SCOPE_BASE, "(objectclass=*)", ldapv3_config, 0, &res); *************** *** 1573,1577 **** if(num_suffixes == 0) { /* try Umich style config */ ! statusbar_msg(_("base search on cn=config")); msg = ldap_search_s(ld, "cn=config", LDAP_SCOPE_BASE, "(objectclass=*)", NULL, 0, &res); --- 1579,1583 ---- if(num_suffixes == 0) { /* try Umich style config */ ! statusbar_msg(_("Base search on cn=config")); msg = ldap_search_s(ld, "cn=config", LDAP_SCOPE_BASE, "(objectclass=*)", NULL, 0, &res); |