gqclient-commit Mailing List for GQ LDAP client (Page 16)
Status: Beta
Brought to you by:
sur5r
You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
(4) |
May
|
Jun
(14) |
Jul
(38) |
Aug
(5) |
Sep
(29) |
Oct
(30) |
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(30) |
Oct
(217) |
Nov
(24) |
Dec
|
2006 |
Jan
|
Feb
|
Mar
|
Apr
(53) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <sta...@us...> - 2002-09-18 07:33:15
|
Update of /cvsroot/gqclient/gq/po In directory usw-pr-cvs1:/tmp/cvs-serv27225 Modified Files: de.po Log Message: * As always: updated translations Index: de.po =================================================================== RCS file: /cvsroot/gqclient/gq/po/de.po,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** de.po 3 Jul 2002 20:56:51 -0000 1.8 --- de.po 18 Sep 2002 07:33:11 -0000 1.9 *************** *** 6,10 **** msgstr "" "Project-Id-Version: gq 0.5.0\n" ! "POT-Creation-Date: 2002-07-03 22:48+0200\n" "PO-Revision-Date: 2002-04-21 16:10+MEST\n" "Last-Translator: Peter Stamfest <pe...@st...>\n" --- 6,10 ---- msgstr "" "Project-Id-Version: gq 0.5.0\n" ! "POT-Creation-Date: 2002-09-18 09:03+0200\n" "PO-Revision-Date: 2002-04-21 16:10+MEST\n" [...2217 lines suppressed...] + #~ msgid "%d entries found" + #~ msgstr "%d Einträge gefunden" + + #~ msgid "No suffixes found" + #~ msgstr "Keine Suffixe gefunden" + + #~ msgid "%d suffixes found" + #~ msgstr "%d Suffixe gefunden" + + #~ msgid "No entries found (running)" + #~ msgstr "Keine Einträge gefunden (Suche wird fortgesetzt)" + + #~ msgid "%d entries found (running)" + #~ msgstr "%1$d Einträge gefunden (Suche wird fortgesetzt)" + + #~ msgid "No entries found (finished)" + #~ msgstr "Keine Einträge gefunden (Suche abgeschlossen)" + + #~ msgid "%d entries found (finished)" + #~ msgstr "%d Einträge gefunden (Suche abgeschlossen)" |
From: <sta...@us...> - 2002-09-18 07:29:13
|
Update of /cvsroot/gqclient/gq/src In directory usw-pr-cvs1:/tmp/cvs-serv26218 Modified Files: browse.c Log Message: * Added support for singular/plural forms when translating messages including numbers. * Added support for the japanese Message catalog kindly provided by Hatuka*nezumi <ne...@jc...>. The original patch I received from Hatuka contained also some fogotten "_()"s. Thanks. * Minor fixes in browse-mode Index: browse.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/browse.c,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** browse.c 10 Aug 2002 06:06:38 -0000 1.58 --- browse.c 18 Sep 2002 07:29:10 -0000 1.59 *************** *** 150,156 **** GHashTable *hash) { ! LDAP *ld; ! LDAPMessage *res, *e; ! struct ldapserver *server; int msg, rc, num_children, update_counter, err; char message[MAX_DN_LEN + 21]; --- 150,156 ---- GHashTable *hash) { ! LDAP *ld = NULL; ! LDAPMessage *res = NULL, *e; ! struct ldapserver *server = NULL; int msg, rc, num_children, update_counter, err; char message[MAX_DN_LEN + 21]; *************** *** 217,223 **** update_counter++; if(update_counter >= 100) { ! make_message(message, sizeof(message), num_children, ! _("entry"), _("entries"), ! _("found (running)")); statusbar_msg(message); update_counter = 0; --- 217,230 ---- update_counter++; if(update_counter >= 100) { ! snprintf(message, sizeof(message), ! ngettext("One entry found (running)", ! "%d entries found (running)", ! num_children), num_children); ! ! /* make_message(message, sizeof(message), */ ! /* _("No entries found (running)"), */ ! /* _("One entry found (running)"), */ ! /* _("%d entries found (running)"), */ ! /* num_children); */ statusbar_msg(message); update_counter = 0; *************** *** 228,241 **** entry->leaf = (num_children == 0); ! make_message(message, sizeof(message), num_children, ! _("entry"), _("entries"), _("found (finished)")); ! rc = ldap_parse_result(ld, res, ! &err, &c, NULL, &refs, NULL, 0); if (rc != LDAP_SUCCESS) { error_push(context, ldap_err2string(rc)); push_ldap_addl_error(ld, context); } else { if (err == LDAP_SIZELIMIT_EXCEEDED) { --- 235,269 ---- entry->leaf = (num_children == 0); ! snprintf(message, sizeof(message), ! ngettext("One entry found (finished)", ! "%d entries found (finished)", num_children), ! num_children); ! ! /* make_message(message, sizeof(message), */ ! /* _("No entries found (finished)"), */ ! /* _("One entry found (finished)"), */ ! /* _("%d entries found (finished)"), */ ! /* num_children); */ ! ! ldap_get_option(ld, LDAP_OPT_ERROR_NUMBER, &rc); + if (rc == LDAP_SERVER_DOWN) { + server->server_down++; + gtk_clist_thaw(GTK_CLIST(ctree)); + goto done; + } ! if (res) { ! rc = ldap_parse_result(ld, res, ! &err, &c, NULL, &refs, NULL, 0); ! } if (rc != LDAP_SUCCESS) { error_push(context, ldap_err2string(rc)); push_ldap_addl_error(ld, context); + + if (rc == LDAP_SERVER_DOWN) { + server->server_down++; + } } else { if (err == LDAP_SIZELIMIT_EXCEEDED) { *************** *** 269,278 **** statusbar_msg(message); - if (res) ldap_msgfree(res); - gtk_clist_thaw(GTK_CLIST(ctree)); - close_connection(server, FALSE); - entry->seen = TRUE; } --- 297,302 ---- *************** *** 289,292 **** --- 313,320 ---- error_flush(context); + + done: + if (res) ldap_msgfree(res); + if (server && ld) close_connection(server, FALSE); } *************** *** 729,735 **** server_browse_entry_selected(entry, ctree, node, hash); ! /* /\* toggle expansion twice to fire the expand callback *\/ */ ! /* gtk_ctree_toggle_expansion(ctree, node); */ ! /* gtk_ctree_toggle_expansion(ctree, node); */ gtk_clist_thaw(GTK_CLIST(ctree)); --- 757,766 ---- server_browse_entry_selected(entry, ctree, node, hash); ! /* toggle expansion twice to fire the expand callback and to ! return to the current expansion state */ ! gtk_ctree_toggle_expansion(ctree, node); ! gtk_ctree_toggle_expansion(ctree, node); ! ! /* server_browse_entry_expand(entry, ctree, node, hash); */ gtk_clist_thaw(GTK_CLIST(ctree)); *************** *** 809,814 **** } ! make_message(message, sizeof(message), ! server_cnt, _("server"), _("servers"), _("found")); statusbar_msg(message); } --- 840,854 ---- } ! snprintf(message, sizeof(message), ! ngettext("One server found", ! "%d servers found", server_cnt), ! server_cnt); ! ! /* make_message(message, sizeof(message), */ ! /* _("No servers found"), */ ! /* _("One server found"), */ ! /* _("%d servers found"), */ ! /* server_cnt); */ ! /* _("server"), _("servers"), _("found")); */ statusbar_msg(message); } *************** *** 1428,1432 **** GString *out = NULL; GString *gmessage = NULL; ! GString *bigmessage = NULL; int written; char message[512]; --- 1468,1472 ---- GString *out = NULL; GString *gmessage = NULL; ! /* GString *bigmessage = NULL; */ int written; char message[512]; *************** *** 1539,1549 **** } ! make_message(message, sizeof(message), num_entries, ! _("entry"), _("entries"), _("exported")); ! bigmessage = g_string_new(""); ! g_string_sprintf(bigmessage, _("%s to %s"), message, filename); ! statusbar_msg(bigmessage->str); ! g_string_free(bigmessage, TRUE); } --- 1579,1600 ---- } ! /* make_message(message, sizeof(message), */ ! /* _("No entries exported to %2$s"), */ ! /* _("One entry exported to %2$s"), */ ! /* _("%1$d entries exported to %2$s"), */ ! /* num_entries, filename); */ ! snprintf(message, sizeof(message), ! ngettext("One entry exported to %2$s", ! "%1$d entries exported to %2$s", num_entries), ! num_entries, filename); ! ! /* _("entry"), _("entries"), _("exported")); */ ! ! /* bigmessage = g_string_new(""); */ ! /* g_string_sprintf(bigmessage, _("%s to %s"), message, filename); */ ! /* statusbar_msg(bigmessage->str); */ ! /* g_string_free(bigmessage, TRUE); */ ! statusbar_msg(message); } |
From: <sta...@us...> - 2002-09-18 07:27:31
|
Update of /cvsroot/gqclient/gq In directory usw-pr-cvs1:/tmp/cvs-serv25868 Modified Files: ChangeLog Log Message: * Changes: ngettext, japanese Index: ChangeLog =================================================================== RCS file: /cvsroot/gqclient/gq/ChangeLog,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** ChangeLog 15 Jul 2002 18:45:00 -0000 1.33 --- ChangeLog 18 Sep 2002 07:27:28 -0000 1.34 *************** *** 1,2 **** --- 1,11 ---- + 2002-09-18 Peter Stamfest <pe...@st...> + * Added code for proper support of singular/plural translations + involving numbers. This includes the replacement of the make_message + function. However, this probably requires the use of modern gettext + implementations. Use of --with-included-gettext during configure + time might be required. + * Added a japanese message catalog kindly provided by + Hatuka*nezumi <ne...@jc...>. This also provoked the + changes to the singular/plural stuff outlined above. 2002-07-15 Peter Stamfest <pe...@st...> * Added a work around for strange behaviour reported by |
From: <sta...@us...> - 2002-09-18 07:23:12
|
Update of /cvsroot/gqclient/gq/po In directory usw-pr-cvs1:/tmp/cvs-serv24941 Added Files: ja.po Log Message: * Added the japanese message catalog kinddly provided by Hatuka*nezumi <ne...@jc...>. And thanks for the other input you gave me. --- NEW FILE: ja.po --- # The japanese po file for gq. # Copyright (C) 2002 Hatuka*nezumi , redistributable under the GPL # Hatuka*nezumi <ne...@jc...>, 2002. # msgid "" msgstr "" "Project-Id-Version: gq 0.6.0\n" "POT-Creation-Date: 2002-09-18 09:03+0200\n" "PO-Revision-Date: 2002-08-23 21:47+0900\n" "Last-Translator: Hatuka*nezumi <ne...@jc...>\n" "Language-Team: Japanese - common <ja...@li...>\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=EUC-JP\n" "Content-Transfer-Encoding: 8bit\n" #: src/browse.c:100 msgid "Exploding DN" msgstr "¼±ÊÌ̾¤Îʬ²ò" [...1332 lines suppressed...] #~ msgid "exported" #~ msgstr "½ñ¤½Ð¤µ¤ì" #~ msgid "%s to %s" #~ msgstr "%s. %s ¤ËÊݸ¤·¤Þ¤·¤¿" #~ msgid "no %s %s" #~ msgstr "%s¤Ï%s¤Þ¤»¤ó¤Ç¤·¤¿" #~ msgid "1 %s %s" #~ msgstr "%s¤¬ 1 ¸Ä%s¤Þ¤·¤¿" #~ msgid "%d %s %s" #~ msgstr "%2$s¤¬ %1$d ¸Ä%3$s¤Þ¤·¤¿" #~ msgid "suffix" #~ msgstr "DNÀÜÈø¼" #~ msgid "suffixes" #~ msgstr "DNÀÜÈø¼" |
From: <sta...@us...> - 2002-09-18 07:22:07
|
Update of /cvsroot/gqclient/gq/src In directory usw-pr-cvs1:/tmp/cvs-serv24332/src Modified Files: util.c util.h search.c schemabrowse.c Log Message: * Added support for singular/plural forms when translating messages including numbers. * Added support for the japanese Message catalog kindly provided by Hatuka*nezumi <ne...@jc...>. The original patch I received from Hatuka contained also some fogotten "_()"s. Thanks. Index: util.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/util.c,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** util.c 10 Aug 2002 06:06:38 -0000 1.45 --- util.c 18 Sep 2002 07:22:04 -0000 1.46 *************** *** 566,588 **** } ! void make_message(char *buffer, int bufsize, ! int cnt, char *singular, char *plural, char *suffix) { switch(cnt) { case 0: ! snprintf(buffer, bufsize, _("no %s %s"), plural, suffix); break; case 1: ! snprintf(buffer, bufsize, _("1 %s %s"), singular, suffix); break; default: ! snprintf(buffer, bufsize, "%d %s %s", cnt, plural, suffix); break; } } ! /* --- 566,598 ---- } ! #if 0 void make_message(char *buffer, int bufsize, ! const char *none, const char *one, const char *many, ! ...) { + int cnt; + va_list ap; + + va_start (ap, many); + cnt = va_arg(ap, int); + va_end (ap); + + va_start (ap, many); switch(cnt) { case 0: ! vsnprintf(buffer, bufsize, none, ap); break; case 1: ! vsnprintf(buffer, bufsize, one, ap); break; default: ! vsnprintf(buffer, bufsize, many, ap); break; } + va_end (ap); } ! #endif /* *************** *** 1523,1528 **** close_connection(server, FALSE); ! make_message(message, sizeof(message), num_suffixes, ! _("suffix"), _("suffixes"), _("found")); statusbar_msg(message); --- 1533,1546 ---- close_connection(server, FALSE); ! snprintf(message, sizeof(message), ! ngettext("One suffix found", "%d suffixes found", num_suffixes), ! num_suffixes); ! ! /* make_message(message, sizeof(message), */ ! /* _("No suffixes found"), */ ! /* _("One suffix found"), */ ! /* _("%d suffixes found"), */ ! /* num_suffixes); */ ! /* _("suffix"), _("suffixes"), _("found")); */ statusbar_msg(message); Index: util.h =================================================================== RCS file: /cvsroot/gqclient/gq/src/util.h,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** util.h 3 Jul 2002 20:13:05 -0000 1.16 --- util.h 18 Sep 2002 07:22:04 -0000 1.17 *************** *** 44,48 **** void set_busycursor(void); void set_normalcursor(void); ! void make_message(char *buffer, int bufsize, int cnt, char *singular, char *plural, char *suffix); int close_on_esc(GtkWidget *widget, GdkEventKey *event, gpointer obj); int func_on_esc(GtkWidget *widget, GdkEventKey *event, GtkWidget *window); --- 44,59 ---- void set_busycursor(void); void set_normalcursor(void); ! ! #if 0 ! /* void make_message(char *buffer, int bufsize, int cnt, char *singular, char *plural, char *suffix); */ ! ! /* NOTE: The first variadic argument must be an "int" indication a ! count value used to select among the *none, *one and *many messages */ ! void make_message(char *buffer, int bufsize, ! const char *none, const char *one, const char *many, ! ...) ! __attribute__ ((format (printf, 5, 6))); ! #endif ! int close_on_esc(GtkWidget *widget, GdkEventKey *event, gpointer obj); int func_on_esc(GtkWidget *widget, GdkEventKey *event, GtkWidget *window); Index: search.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/search.c,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** search.c 15 Jul 2002 18:44:03 -0000 1.24 --- search.c 18 Sep 2002 07:22:04 -0000 1.25 *************** *** 455,459 **** free(querystring); ! snprintf(message, sizeof(message), "searching for %s", filter); statusbar_msg(message); --- 455,459 ---- free(querystring); ! snprintf(message, sizeof(message), _("searching for %s"), filter); statusbar_msg(message); *************** *** 623,628 **** statusbar_msg(ldap_err2string(msg)); else { ! make_message(message, sizeof(message), ! row, "entry", "entries", "found"); statusbar_msg(message); } --- 623,636 ---- statusbar_msg(ldap_err2string(msg)); else { ! snprintf(message, sizeof(message), ! ngettext("One entry found", "%d entries found", row), ! row); ! ! /* make_message(message, sizeof(message), */ ! /* _("No entries found"), */ ! /* _("One entry found"), */ ! /* _("%d entries found"), */ ! /* row); */ ! /* "entry", "entries", "found"); */ statusbar_msg(message); } Index: schemabrowse.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/schemabrowse.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** schemabrowse.c 18 Jun 2002 22:07:14 -0000 1.11 --- schemabrowse.c 18 Sep 2002 07:22:04 -0000 1.12 *************** *** 131,136 **** } ! make_message(message, sizeof(message), ! server_cnt, _("server"), _("servers"), _("found")); statusbar_msg(message); --- 131,144 ---- } ! snprintf(message, sizeof(message), ! ngettext("One server found", "%d servers found", server_cnt), ! server_cnt); ! ! /* make_message(message, sizeof(message), */ ! /* _("No servers found"), */ ! /* _("One server found"), */ ! /* _("%d servers found"), */ ! /* server_cnt); */ ! /* _("server"), _("servers"), _("found")); */ statusbar_msg(message); |
From: <sta...@us...> - 2002-09-18 07:22:07
|
Update of /cvsroot/gqclient/gq In directory usw-pr-cvs1:/tmp/cvs-serv24332 Modified Files: configure.in README.NLS Log Message: * Added support for singular/plural forms when translating messages including numbers. * Added support for the japanese Message catalog kindly provided by Hatuka*nezumi <ne...@jc...>. The original patch I received from Hatuka contained also some fogotten "_()"s. Thanks. Index: configure.in =================================================================== RCS file: /cvsroot/gqclient/gq/configure.in,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** configure.in 15 Jul 2002 18:36:51 -0000 1.36 --- configure.in 18 Sep 2002 07:22:04 -0000 1.37 *************** *** 235,240 **** dnl gettext support ! ALL_LINGUAS="de" AM_GNU_GETTEXT dnl we have no access to the information from AM_GNU_GETTEXT. Use a --- 235,241 ---- dnl gettext support ! ALL_LINGUAS="de ja" AM_GNU_GETTEXT + dnl AM_WITH_NLS(,need-ngettext) dnl we have no access to the information from AM_GNU_GETTEXT. Use a Index: README.NLS =================================================================== RCS file: /cvsroot/gqclient/gq/README.NLS,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** README.NLS 13 Jun 2002 10:11:26 -0000 1.1 --- README.NLS 18 Sep 2002 07:22:04 -0000 1.2 *************** *** 1,2 **** --- 1,18 ---- + Singular/plural + --------------- + + Support for singular/plural forms when translating messages containing + numbers has been added in Sept. 2002. This requires the use of a + sufficiently nuew gettext implementation. The implementation included + with gq is sufficient. You might need to use the + --with-included-gettext option if your gettext does not support the + ngettext function. + + Read the gettext ddocumentation to find out how to support ngettext + with your language. + + Regarding the introduction of new translations + ---------------------------------------------- + After discussions with Bert it was decided to add support for Internationalization (I18N). It was decided to require the following *************** *** 10,12 **** --- 26,29 ---- Changes to the CVS repository should be checked for required translation related activity and should lead to updated po files + |
From: <sta...@us...> - 2002-09-18 06:39:48
|
Update of /cvsroot/gqclient/gq/src In directory usw-pr-cvs1:/tmp/cvs-serv15120 Modified Files: ldapops.c Log Message: * Removed dduplicated code * cosmetic changes Index: ldapops.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/ldapops.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** ldapops.c 13 Jul 2002 07:06:32 -0000 1.14 --- ldapops.c 18 Sep 2002 06:39:45 -0000 1.15 *************** *** 277,287 **** res = NULL; } - if (res) { - ldap_msgfree(res); - res = NULL; - } } while (flags & MOVE_DELETE_MOVED && recheck); - - } --- 277,281 ---- |
From: <sta...@us...> - 2002-09-05 19:32:24
|
Update of /cvsroot/gqclient/gq/src In directory usw-pr-cvs1:/tmp/cvs-serv7087 Modified Files: dt_password.c Log Message: * Fixed an inconsistency wrt lower/upper case of the {CRYPT} for CRYPTed passwords reported by Simon Matter <sim...@ch...> Index: dt_password.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/dt_password.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** dt_password.c 13 Jul 2002 07:01:06 -0000 1.10 --- dt_password.c 5 Sep 2002 19:32:20 -0000 1.11 *************** *** 123,127 **** salt->str[2] = 0; ! g_byte_array_append(gb, "{crypt}", 7); /* strcpy(gb->data, "{crypt}"); */ --- 123,127 ---- salt->str[2] = 0; ! g_byte_array_append(gb, "{CRYPT}", 7); /* strcpy(gb->data, "{crypt}"); */ |
From: <sta...@us...> - 2002-09-05 19:27:48
|
Update of /cvsroot/gqclient/gq/src In directory usw-pr-cvs1:/tmp/cvs-serv6407 Modified Files: debug.h gq.c Log Message: * Some more debuging stuff - openldap 2.1 behaves differently wrt to server down problems than 2.0 Index: debug.h =================================================================== RCS file: /cvsroot/gqclient/gq/src/debug.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** debug.h 15 Jul 2002 18:36:51 -0000 1.4 --- debug.h 5 Sep 2002 19:27:42 -0000 1.5 *************** *** 39,42 **** --- 39,43 ---- #define GQ_DEBUG_BROWSER_DND 8 #define GQ_DEBUG_ENCODE 16 + #define GQ_DEBUG_SIGNALS 32 #endif Index: gq.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/gq.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** gq.c 15 Jul 2002 18:36:51 -0000 1.13 --- gq.c 5 Sep 2002 19:27:43 -0000 1.14 *************** *** 51,54 **** --- 51,56 ---- { int c; + void *p; + #ifdef DEBUG # ifdef HAVE_MCHECK *************** *** 129,133 **** not very clean IMHO (though it has been proposed on the OpenLDAP mailing list) */ ! signal(SIGPIPE, sigpipehandler); gtk_main (); --- 131,142 ---- not very clean IMHO (though it has been proposed on the OpenLDAP mailing list) */ ! ! p = signal(SIGPIPE, sigpipehandler); ! #ifdef DEBUG ! if (debug & GQ_DEBUG_SIGNALS) { ! fprintf(stderr, "SIGPIPE handler installation: %s\n", ! p == SIG_ERR ? "failed" : "ok"); ! } ! #endif /* DEBUG */ gtk_main (); *************** *** 140,144 **** struct ldapserver *server; ! /* printf("Catched sigpipe\n"); */ for(server = config.ldapservers ; server ; server = server->next) { server->server_down++; --- 149,158 ---- struct ldapserver *server; ! #ifdef DEBUG ! if (debug & GQ_DEBUG_SIGNALS) { ! fprintf(stderr, "Catched SIGPIPE\n"); ! } ! #endif /* DEBUG */ ! for(server = config.ldapservers ; server ; server = server->next) { server->server_down++; |
From: <sta...@us...> - 2002-08-10 06:06:41
|
Update of /cvsroot/gqclient/gq/src In directory usw-pr-cvs1:/tmp/cvs-serv25701 Modified Files: browse.c input.c input.h util.c Log Message: * Add a "Add as New" Button to the browser. Very convenient to copy entries to a new DN an changing values at the very same time. Started from a patch received by Árpád, Magosányi" <ma...@bu...>. Had to rewrite large portions of the patch, because it caused crashes. * Enhancements to the way DNs are exploded. Triggered by a SF bug report by Nalin Dahyabhai. Correct treatment of DNs must become a major TODO item, but unfortunately we use DNs all over the place... This may take a _long_ time. Index: browse.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/browse.c,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** browse.c 2 Aug 2002 06:08:00 -0000 1.57 --- browse.c 10 Aug 2002 06:06:38 -0000 1.58 *************** *** 95,102 **** char *dummy[] = { "dummy", NULL }; dn_browse_entry *new_entry; ! GtkCTreeNode *new_item, *added; ! /* explode DN */ exploded_dn = gq_ldap_explode_dn(dn, FALSE); labels[0] = decoded_string(exploded_dn[0]); --- 95,114 ---- char *dummy[] = { "dummy", NULL }; dn_browse_entry *new_entry; ! GtkCTreeNode *new_item, *added = NULL; ! int ctx; ! ! ctx = error_new_context(_("Exploding DN")); ! /* explode DN */ exploded_dn = gq_ldap_explode_dn(dn, FALSE); + + if (exploded_dn == NULL) { + /* problem with DN */ + /* printf("problem dn: %s\n", dn); */ + error_push(ctx, _("Cannot explode DN. Maybe problems with quoting or special characters. See RFC 2253 for details of DN syntax.")); + + goto fail; + } + labels[0] = decoded_string(exploded_dn[0]); *************** *** 122,129 **** NULL, NULL, NULL, NULL, TRUE, FALSE); ! ! free(labels[0]); gq_exploded_free(exploded_dn); return added; } --- 134,144 ---- NULL, NULL, NULL, NULL, TRUE, FALSE); ! ! fail: ! if (labels[0]) free(labels[0]); gq_exploded_free(exploded_dn); + error_flush(ctx); + return added; } *************** *** 1146,1149 **** --- 1161,1169 ---- exploded_dn = gq_ldap_explode_dn(e->dn, FALSE); + if (exploded_dn == NULL) { + /* parsing problem */ + } + + labels[0] = decoded_string(exploded_dn[0]); *************** *** 1257,1264 **** for(i = 0 ; dnparts[i] ; i++) { } ! for(i-- ; i >= 0 ; i--) { g_string_insert(s, 0, dnparts[i]); ! /* printf("try %s at %08lx\n", s->str, node); */ if (node) gtk_ctree_expand(tree, node); --- 1277,1285 ---- for(i = 0 ; dnparts[i] ; i++) { } ! for(i-- ; i >= 0 ; i--) { + if (*dnparts[i] == 0) continue; /* skip empty DN elements (ie always the last one???) - ah, forget to think about it. */ g_string_insert(s, 0, dnparts[i]); ! /* printf("try %s at %08lx\n", s->str, node); */ if (node) gtk_ctree_expand(tree, node); Index: input.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/input.c,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** input.c 2 Aug 2002 06:11:55 -0000 1.45 --- input.c 10 Aug 2002 06:06:38 -0000 1.46 *************** *** 54,57 **** --- 54,61 ---- void refresh_inputform(GHashTable *browsehash); + static void add_entry_from_formlist(GHashTable *hash); + static void add_entry_from_formlist_and_select(GHashTable *hash); + static int add_entry_from_formlist_no_close(GHashTable *hash); + void create_form_window(GHashTable *hash) *************** *** 185,188 **** --- 189,200 ---- gtk_widget_grab_default(button); + button = gtk_button_new_with_label(_("Add as new")); + gtk_widget_show(button); + gtk_box_pack_start(GTK_BOX(hbox2), button, FALSE, FALSE, 0); + gtk_signal_connect_object(GTK_OBJECT(button), "clicked", + GTK_SIGNAL_FUNC(add_entry_from_formlist_and_select), + (gpointer) hash); + GTK_WIDGET_UNSET_FLAGS(button, GTK_CAN_FOCUS); + button = gtk_button_new_with_label(_("Refresh")); /* gtk_widget_set_sensitive(button, FALSE); */ *************** *** 223,226 **** --- 235,251 ---- gtk_widget_grab_default(button); + /* PSt: Removed again, as the GUI is too confusing. What + does "OK" mean wrt "Apply"? Which Button does which? It + is not intuitive enough too keep this. AND it still has a + problem after Apply: The current DN does not get + changed. */ + + /* button = gtk_button_new_with_label(_("Apply")); */ + /* gtk_widget_show(button); */ + /* gtk_box_pack_start(GTK_BOX(hbox2), button, FALSE, FALSE, 0); */ + /* gtk_signal_connect_object(GTK_OBJECT(button), "clicked", */ + /* GTK_SIGNAL_FUNC(add_entry_from_formlist_no_close), */ + /* (gpointer) hash); */ + button = gtk_button_new_with_label(_("Cancel")); gtk_widget_show(button); *************** *** 842,846 **** ! void add_entry_from_formlist(GHashTable *hash) { LDAP *ld; --- 867,891 ---- ! static void add_entry_from_formlist(GHashTable *hash) ! { ! add_entry_from_formlist_no_close(hash); ! destroy_editwindow(hash); ! } ! ! static void add_entry_from_formlist_and_select(GHashTable *hash) ! { ! int rc = add_entry_from_formlist_no_close(hash); ! ! if (rc) { ! char *dn = g_hash_table_lookup(hash, "dn"); ! GtkCTree *tree = g_hash_table_lookup(hash, "ctreeroot"); ! ! if (dn && tree) { ! show_dn(tree, NULL, dn, TRUE); ! } ! } ! } ! ! static int add_entry_from_formlist_no_close(GHashTable *hash) { LDAP *ld; *************** *** 864,868 **** "Please notify be...@bi..."); error_flush(add_context); ! return; } server = g_hash_table_lookup(hash, "server"); --- 909,913 ---- "Please notify be...@bi..."); error_flush(add_context); ! return 0; } server = g_hash_table_lookup(hash, "server"); *************** *** 871,875 **** "Hmmm, no server! Please notify be...@bi..."); error_flush(add_context); ! return; } --- 916,920 ---- "Hmmm, no server! Please notify be...@bi..."); error_flush(add_context); ! return 0; } *************** *** 880,884 **** error_push(add_context, _("You must enter a DN for a new entry.")); error_flush(add_context); ! return; } --- 925,929 ---- error_push(add_context, _("You must enter a DN for a new entry.")); error_flush(add_context); ! return 0; } *************** *** 889,893 **** set_normalcursor(); error_flush(add_context); ! return; } --- 934,938 ---- set_normalcursor(); error_flush(add_context); ! return 0; } *************** *** 897,906 **** while(formlist) { form = (struct formfill *) formlist->data; ! ! if (g_list_length(form->values) > 0) { ! mod = form->dt_handler->buildLDAPMod(form, ! LDAP_MOD_ADD, ! form->values); ! mods[cmod++] = mod; } --- 942,953 ---- while(formlist) { form = (struct formfill *) formlist->data; ! ! if (! (form->flags & FLAG_NO_USER_MOD)) { ! if (g_list_length(form->values) > 0) { ! mod = form->dt_handler->buildLDAPMod(form, ! LDAP_MOD_ADD, ! form->values); ! mods[cmod++] = mod; ! } } *************** *** 913,916 **** --- 960,965 ---- if (res == LDAP_SERVER_DOWN) { + error_push(add_context, ldap_err2string(res)); + push_ldap_addl_error(ld, add_context); server->server_down++; } *************** *** 921,925 **** set_normalcursor(); close_connection(server, FALSE); ! return; } --- 970,974 ---- set_normalcursor(); close_connection(server, FALSE); ! return 0; } *************** *** 965,973 **** g_free(parentdn); - destroy_editwindow(hash); set_normalcursor(); close_connection(server, FALSE); } --- 1014,1023 ---- g_free(parentdn); set_normalcursor(); close_connection(server, FALSE); + + return 1; } *************** *** 985,988 **** --- 1035,1039 ---- GtkCTree *ctreeroot = NULL; int do_modrdn = 0; + int error = 0; update_formlist(hash); *************** *** 1031,1037 **** if((rc = change_rdn(hash, mod_context)) != 0) { /* printf("error %d\n", rc); */ ! error_flush(mod_context); ! g_string_free(message, TRUE); ! return; } statusbar_msg(message->str); --- 1082,1088 ---- if((rc = change_rdn(hash, mod_context)) != 0) { /* printf("error %d\n", rc); */ ! ! error = 1; ! goto done; } statusbar_msg(message->str); *************** *** 1074,1084 **** #endif error_flush(mod_context); close_connection(server, FALSE); ! g_string_free(message, TRUE); /* refresh visual if requested by browse mode */ ! if (do_modrdn && node) { refresh_subtree_new_dn(ctreeroot, node, dn, 0); } --- 1125,1136 ---- #endif + done: error_flush(mod_context); close_connection(server, FALSE); ! if (message) g_string_free(message, TRUE); /* refresh visual if requested by browse mode */ ! if (do_modrdn && node && !error) { refresh_subtree_new_dn(ctreeroot, node, dn, 0); } *************** *** 1088,1092 **** int change_rdn(GHashTable *hash, int context) { ! GString *message; LDAP *ld; struct ldapserver *server; --- 1140,1144 ---- int change_rdn(GHashTable *hash, int context) { ! GString *message = NULL; LDAP *ld; struct ldapserver *server; *************** *** 1108,1126 **** rdn = gq_ldap_explode_dn(dn, 0); ! message = g_string_sized_new(256); ! /* check if user really only attemps to change the RDN and not ! any other parts of the DN */ ! error = 0; ! for(i = 1; rdn[i]; i++) { ! if(oldrdn[i] == NULL || rdn[i] == NULL || ! (strcasecmp(oldrdn[i], rdn[i]) != 0)) { ! g_string_sprintf(message, ! _("You can only change the RDN of the DN (%s)"), ! c = decoded_string(oldrdn[0])); ! if (c) free(c); ! error_push(context, message->str); ! error = 1; ! break; } } --- 1160,1188 ---- rdn = gq_ldap_explode_dn(dn, 0); ! if (rdn == NULL) { ! /* parsing error */ ! error_push(context, _("Cannot explode DN. Maybe problems with quoting or special characters. See RFC 2253 for details of DN syntax.")); ! ! error = 1; ! } else { ! /* parsing OK */ ! ! message = g_string_sized_new(256); ! ! /* check if user really only attemps to change the RDN and not ! any other parts of the DN */ ! error = 0; ! for(i = 1; rdn[i]; i++) { ! if(oldrdn[i] == NULL || rdn[i] == NULL || ! (strcasecmp(oldrdn[i], rdn[i]) != 0)) { ! g_string_sprintf(message, ! _("You can only change the RDN of the DN (%s)"), ! c = decoded_string(oldrdn[0])); ! if (c) free(c); ! error_push(context, message->str); ! error = 1; ! break; ! } } } *************** *** 1176,1185 **** } ! gq_exploded_free(oldrdn); ! gq_exploded_free(rdn); ! ! g_string_free(message, TRUE); close_connection(server, FALSE); return(error); } --- 1238,1247 ---- } ! if (oldrdn) gq_exploded_free(oldrdn); ! if (rdn) gq_exploded_free(rdn); ! if (message) g_string_free(message, TRUE); close_connection(server, FALSE); + return(error); } Index: input.h =================================================================== RCS file: /cvsroot/gqclient/gq/src/input.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** input.h 4 Apr 2002 14:33:11 -0000 1.6 --- input.h 10 Aug 2002 06:06:38 -0000 1.7 *************** *** 41,45 **** void update_formlist(GHashTable *hash); void clear_table(GHashTable *hash); - void add_entry_from_formlist(GHashTable *hash); void mod_entry_from_formlist(GHashTable *hash); int change_rdn(GHashTable *hash, int context); --- 41,44 ---- Index: util.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/util.c,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** util.c 23 Jul 2002 13:47:57 -0000 1.44 --- util.c 10 Aug 2002 06:06:38 -0000 1.45 *************** *** 1541,1549 **** char **gq_ldap_explode_dn(const char *dn, int dummy) { ! int i; LDAPDN *parts; char **v = 0; ! ldap_str2dn(dn, &parts, LDAP_DN_FORMAT_LDAP); /* count DN elements */ for( i = 0 ; parts[i] ; i++ ) ; --- 1541,1552 ---- char **gq_ldap_explode_dn(const char *dn, int dummy) { ! int i, rc; LDAPDN *parts; char **v = 0; ! rc = ldap_str2dn(dn, &parts, LDAP_DN_FORMAT_LDAPV3); ! ! if (rc != LDAP_SUCCESS || parts == NULL) return NULL; ! /* count DN elements */ for( i = 0 ; parts[i] ; i++ ) ; *************** *** 1559,1563 **** void gq_exploded_free(char **exploded_dn) { ! free(exploded_dn); } --- 1562,1566 ---- void gq_exploded_free(char **exploded_dn) { ! if (exploded_dn) free(exploded_dn); } |
From: <sta...@us...> - 2002-08-02 06:17:21
|
Update of /cvsroot/gqclient/gq/src In directory usw-pr-cvs1:/tmp/cvs-serv9113 Modified Files: Tag: gq_0_6_0-patches browse-dnd.c browse.c ldif.c ldif.h Log Message: * Backported: Fixed a bug crashing gq when exporting form Netscape-Directory-Server to LDIF. Reported by Cord Beermann <cor...@me...>. Index: browse-dnd.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/browse-dnd.c,v retrieving revision 1.6 retrieving revision 1.6.2.1 diff -C2 -d -r1.6 -r1.6.2.1 *** browse-dnd.c 18 Jun 2002 22:07:14 -0000 1.6 --- browse-dnd.c 2 Aug 2002 06:17:18 -0000 1.6.2.1 *************** *** 830,833 **** --- 830,835 ---- gboolean ok = FALSE; + int ctx = error_new_context(_("Getting selection string")); + #ifdef DEBUG_DND printf("get_selection_string\n"); *************** *** 844,855 **** if (rc == LDAP_SERVER_DOWN) { server->server_down = 1; goto fail; } - if (rc != LDAP_SUCCESS) goto fail; - out = g_string_new(""); for(e = ldap_first_entry(ld, msg); e ; e = ldap_next_entry(ld, e)) { ! ldif_entry_out(out, ld, e); } --- 846,866 ---- if (rc == LDAP_SERVER_DOWN) { server->server_down = 1; + error_push(ctx, + _("Server down. Export may be incomplete!")); + push_ldap_addl_error(ld, ctx); + + goto fail; + } + if (rc != LDAP_SUCCESS) { + error_push(ctx, + _("LDAP error. Export may be incomplete!")); + push_ldap_addl_error(ld, ctx); + goto fail; } out = g_string_new(""); for(e = ldap_first_entry(ld, msg); e ; e = ldap_next_entry(ld, e)) { ! ldif_entry_out(out, ld, e, ctx); } *************** *** 877,880 **** --- 888,893 ---- if (msg) ldap_msgfree(msg); close_connection(server, FALSE); + + error_flush(ctx); return; } Index: browse.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/browse.c,v retrieving revision 1.52 retrieving revision 1.52.2.1 diff -C2 -d -r1.52 -r1.52.2.1 *** browse.c 21 Jun 2002 00:34:32 -0000 1.52 --- browse.c 2 Aug 2002 06:17:18 -0000 1.52.2.1 *************** *** 1102,1106 **** GString *bigmessage = NULL; int written; ! char message[128]; entry = gtk_object_get_data(GTK_OBJECT(filesel), "entry"); --- 1102,1109 ---- GString *bigmessage = NULL; int written; ! char message[512]; ! int ctx; ! ! ctx = error_new_context(_("Dump subtree")); entry = gtk_object_get_data(GTK_OBJECT(filesel), "entry"); *************** *** 1119,1123 **** if(g_list_length(bases) == 0) { ! return; } --- 1122,1127 ---- if(g_list_length(bases) == 0) { ! error_push(ctx, _("Nothing to dump!")); ! goto fail; } *************** *** 1128,1132 **** if( (outfile = fopen(filename, "w")) == NULL) { ! error_popup(_("Save failed"), strerror(errno)); } else { /* AFAIK, the UMich LDIF format doesn't take comments or a --- 1132,1142 ---- if( (outfile = fopen(filename, "w")) == NULL) { ! snprintf(message, sizeof(message), ! _("Could not open output file: %s"), ! strerror(errno)); ! error_push(ctx, message); ! ! goto fail; ! /* error_popup(_("Save failed"), strerror(errno)); */ } else { /* AFAIK, the UMich LDIF format doesn't take comments or a *************** *** 1135,1139 **** g_string_truncate(out, 0); - prepend_ldif_header(out, server, bases); --- 1145,1148 ---- *************** *** 1141,1147 **** if(written != out->len) { snprintf(message, sizeof(message), ! _("%d of %d bytes written"), written, out->len); ! error_popup(_("Save failed"), message); goto fail; /* sometimes goto is useful */ } --- 1150,1156 ---- if(written != out->len) { snprintf(message, sizeof(message), ! _("Save failed: Only %d of %d bytes written"), written, out->len); ! error_push(ctx, message); goto fail; /* sometimes goto is useful */ } *************** *** 1149,1152 **** --- 1158,1163 ---- if( (ld = open_connection(server)) == NULL) { + /* no extra error, open_connection does error reporting + itself... */ goto fail; } *************** *** 1163,1167 **** for(e = ldap_first_entry(ld, res); e; e = ldap_next_entry(ld, e)) { g_string_truncate(out, 0); ! ldif_entry_out(out, ld, e); num_entries++; --- 1174,1178 ---- for(e = ldap_first_entry(ld, res); e; e = ldap_next_entry(ld, e)) { g_string_truncate(out, 0); ! ldif_entry_out(out, ld, e, ctx); num_entries++; *************** *** 1183,1190 **** server->server_down++; ldap_msgfree(res); /* is this correct? */ } else { /* report error */ ! statusbar_msg(ldap_err2string(ldap_result2error(ld, ! res, 1))); goto fail; } --- 1194,1209 ---- server->server_down++; ldap_msgfree(res); /* is this correct? */ + + error_push(ctx, + _("Server down. Export may be incomplete!")); + push_ldap_addl_error(ld, ctx); + goto fail; } else { /* report error */ ! error_push(ctx, ! _("LDAP error. Export may be incomplete!")); ! push_ldap_addl_error(ld, ctx); ! /* statusbar_msg(ldap_err2string(ldap_result2error(ld, */ ! /* res, 1))); */ goto fail; } *************** *** 1200,1210 **** } ! fail: if (outfile) fclose(outfile); ! for (I = g_list_first(bases) ; I ; I = g_list_next(I)) { ! free(I->data); } - if (bases) g_list_free(bases); set_normalcursor(); --- 1219,1231 ---- } ! fail: /* labels are only good for cleaning up, really */ if (outfile) fclose(outfile); ! if (bases) { ! for (I = g_list_first(bases) ; I ; I = g_list_next(I)) { ! free(I->data); ! } ! g_list_free(bases); } set_normalcursor(); *************** *** 1214,1217 **** --- 1235,1240 ---- gtk_widget_destroy(filesel); + + error_flush(ctx); } Index: ldif.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/ldif.c,v retrieving revision 1.11 retrieving revision 1.11.2.1 diff -C2 -d -r1.11 -r1.11.2.1 *** ldif.c 8 Jun 2002 05:46:44 -0000 1.11 --- ldif.c 2 Aug 2002 06:17:18 -0000 1.11.2.1 *************** *** 25,28 **** --- 25,29 ---- #include <stdlib.h> #include <string.h> /* strlen */ + #include <stdio.h> /* snprintf */ #include <ctype.h> #include <time.h> *************** *** 37,41 **** #include "util.h" #include "ldif.h" ! void prepend_ldif_header(GString *out, struct ldapserver *server, GList *bases) --- 38,43 ---- #include "util.h" #include "ldif.h" ! #include "i18n.h" ! #include "errorchain.h" void prepend_ldif_header(GString *out, struct ldapserver *server, GList *bases) *************** *** 65,69 **** ! gboolean ldif_entry_out(GString *out, LDAP *ld, LDAPMessage *msg) { BerElement *berptr; --- 67,72 ---- ! gboolean ldif_entry_out(GString *out, LDAP *ld, LDAPMessage *msg, ! int error_context) { BerElement *berptr; *************** *** 74,78 **** dn = ldap_get_dn(ld, msg); ! ldif_line_out(out, "dn", dn, strlen(dn)); g_string_append(out, "\n"); free(dn); --- 77,90 ---- dn = ldap_get_dn(ld, msg); ! ! if (!dn) { ! /* an error occurred */ ! ! error_push(error_context, _("Cannot retrieve DN of entry.\n")); ! push_ldap_addl_error(ld, error_context); ! return FALSE; ! } ! ! ldif_line_out(out, "dn", dn, strlen(dn), error_context); g_string_append(out, "\n"); free(dn); *************** *** 86,90 **** /* should work for ;binary as-is */ value = vals[i]; ! ldif_line_out(out, attr, value->bv_val, value->bv_len); g_string_append(out, "\n"); } --- 98,104 ---- /* should work for ;binary as-is */ value = vals[i]; ! ldif_line_out(out, attr, ! value->bv_val, value->bv_len, ! error_context); g_string_append(out, "\n"); } *************** *** 103,110 **** ! gboolean ldif_line_out(GString *out, char *attr, char *value, int vlen) { GString *tmp; int i, w, do_base64; g_string_append(out, attr); --- 117,148 ---- ! gboolean ldif_line_out(GString *out, char *attr, char *value, int vlen, ! int error_context) { GString *tmp; int i, w, do_base64; + /* char message[256]; */ + + if (attr == NULL) { + /* NULL attributes make no sense */ + error_push(error_context, + _("NULL attribute name - cannot write such an attribute...")); + return FALSE; + } + + if (value == NULL) { + /* NULL seems to be normal, at least with Netscape LDAP + servers, tested with help from Cord Beermann + <cor...@me...> */ + + /* + snprintf(message, sizeof(message), + _("NULL value for attribute %s - writing empty string instead..."), + attr); + error_push(error_context, message); + */ + value = ""; + vlen = 0; + } g_string_append(out, attr); Index: ldif.h =================================================================== RCS file: /cvsroot/gqclient/gq/src/ldif.h,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -C2 -d -r1.4 -r1.4.2.1 *** ldif.h 5 Jun 2002 15:40:32 -0000 1.4 --- ldif.h 2 Aug 2002 06:17:18 -0000 1.4.2.1 *************** *** 27,32 **** void prepend_ldif_header(GString *out, struct ldapserver *server, GList *bases); ! gboolean ldif_entry_out(GString *out, LDAP *ld, LDAPMessage *msg); ! gboolean ldif_line_out(GString *out, char *attr, char *value, int vlen); void b64_encode(GString *out, char *value, int vlen); void b64_decode(GByteArray *out, const char *value, int vlen); --- 27,34 ---- void prepend_ldif_header(GString *out, struct ldapserver *server, GList *bases); ! gboolean ldif_entry_out(GString *out, LDAP *ld, LDAPMessage *msg, ! int error_context); ! gboolean ldif_line_out(GString *out, char *attr, char *value, int vlen, ! int error_context); void b64_encode(GString *out, char *value, int vlen); void b64_decode(GByteArray *out, const char *value, int vlen); |
From: <sta...@us...> - 2002-08-02 06:11:58
|
Update of /cvsroot/gqclient/gq/src In directory usw-pr-cvs1:/tmp/cvs-serv6031 Modified Files: formfill.h input.c Log Message: * Fixed colouring of attribute names in the browser. This broke when I introduced the Eventboxes to create the popup menues for these labels Index: formfill.h =================================================================== RCS file: /cvsroot/gqclient/gq/src/formfill.h,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** formfill.h 13 Jul 2002 16:47:38 -0000 1.20 --- formfill.h 2 Aug 2002 06:11:55 -0000 1.21 *************** *** 90,93 **** --- 90,94 ---- struct syntax_handler *syntax; + GtkWidget *event_box; GtkWidget *label; GtkWidget *vbox; Index: input.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/input.c,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** input.c 17 Jul 2002 21:46:22 -0000 1.44 --- input.c 2 Aug 2002 06:11:55 -0000 1.45 *************** *** 383,387 **** GtkStyle *not_in_schema, *must_in_schema, *del_schema; ! GtkWidget *target_table, *label, *inputbox, *arrowbutton, *vbox; GtkWidget *widget = NULL, *align; struct formfill *form, *focusform; --- 383,387 ---- GtkStyle *not_in_schema, *must_in_schema, *del_schema; ! GtkWidget *target_table, *inputbox, *arrowbutton, *vbox; GtkWidget *widget = NULL, *align; struct formfill *form, *focusform; *************** *** 415,419 **** if (build) { /* DN input box */ ! label = gtk_label_new("dn"); gtk_misc_set_alignment(GTK_MISC(label), LABEL_JUSTIFICATION, .5); gtk_widget_set_style(label, must_in_schema); --- 415,419 ---- if (build) { /* DN input box */ ! GtkWidget *label = gtk_label_new("dn"); gtk_misc_set_alignment(GTK_MISC(label), LABEL_JUSTIFICATION, .5); gtk_widget_set_style(label, must_in_schema); *************** *** 450,474 **** if (build || form->label == NULL) { - GtkWidget *l; /* attribute name */ ! l = gtk_label_new(form->attrname); ! gtk_misc_set_alignment(GTK_MISC(l), LABEL_JUSTIFICATION, .5); ! gtk_widget_show(l); ! form->label = label = gtk_event_box_new(); ! gtk_container_add(GTK_CONTAINER(label), l); if (form->dt_handler && form->dt_handler->selectable) { ! gtk_signal_connect(GTK_OBJECT(label), "button_press_event", GTK_SIGNAL_FUNC(widget_button_press), form); ! gtk_object_set_data(GTK_OBJECT(label), "row", GINT_TO_POINTER(row)); } ! gtk_widget_show(label); ! gtk_table_attach(GTK_TABLE(target_table), label, 0, 1, row, row + 1, /* GTK_FILL| */ GTK_SHRINK, --- 450,474 ---- if (build || form->label == NULL) { /* attribute name */ ! form->label = gtk_label_new(form->attrname); ! gtk_misc_set_alignment(GTK_MISC(form->label), ! LABEL_JUSTIFICATION, .5); ! gtk_widget_show(form->label); ! form->event_box = gtk_event_box_new(); ! gtk_container_add(GTK_CONTAINER(form->event_box), form->label); if (form->dt_handler && form->dt_handler->selectable) { ! gtk_signal_connect(GTK_OBJECT(form->event_box), "button_press_event", GTK_SIGNAL_FUNC(widget_button_press), form); ! gtk_object_set_data(GTK_OBJECT(form->event_box), "row", GINT_TO_POINTER(row)); } ! gtk_widget_show(form->event_box); ! gtk_table_attach(GTK_TABLE(target_table), form->event_box, 0, 1, row, row + 1, /* GTK_FILL| */ GTK_SHRINK, |
From: <sta...@us...> - 2002-08-02 06:10:15
|
Update of /cvsroot/gqclient/gq/src In directory usw-pr-cvs1:/tmp/cvs-serv5378 Modified Files: common.h Log Message: * Extended the password field in the struct ldapserver to be able to have longer passwords and to allow for ~/.gq encodings requiring more characters Index: common.h =================================================================== RCS file: /cvsroot/gqclient/gq/src/common.h,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** common.h 23 Jul 2002 13:50:06 -0000 1.17 --- common.h 2 Aug 2002 06:10:11 -0000 1.18 *************** *** 38,42 **** #define MAX_DN_LEN 1024 #define MAX_ATTR_LEN 64 ! #define MAX_BINDPW_LEN 32 #define DEFAULT_SHOWDN 1 --- 38,42 ---- #define MAX_DN_LEN 1024 #define MAX_ATTR_LEN 64 ! #define MAX_BINDPW_LEN 256 #define DEFAULT_SHOWDN 1 |
From: <sta...@us...> - 2002-08-02 06:08:17
|
Update of /cvsroot/gqclient/gq/src In directory usw-pr-cvs1:/tmp/cvs-serv3734 Modified Files: browse-dnd.c ldif.c ldif.h browse.c Log Message: * Fixed a bug crashing gq when exporting form Netscape-Directory-Server to LDIF. Reported by Cord Beermann <cor...@me...>. Index: browse-dnd.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/browse-dnd.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** browse-dnd.c 15 Jul 2002 18:36:51 -0000 1.8 --- browse-dnd.c 2 Aug 2002 06:08:00 -0000 1.9 *************** *** 862,865 **** --- 862,867 ---- char *attrs[] = { "*", "+", NULL }; + int ctx = error_new_context(_("Getting selection string")); + #ifdef DEBUG if (debug & GQ_DEBUG_BROWSER_DND) { *************** *** 878,889 **** if (rc == LDAP_SERVER_DOWN) { server->server_down = 1; goto fail; } - if (rc != LDAP_SUCCESS) goto fail; - out = g_string_new(""); for(e = ldap_first_entry(ld, msg); e ; e = ldap_next_entry(ld, e)) { ! ldif_entry_out(out, ld, e); } --- 880,900 ---- if (rc == LDAP_SERVER_DOWN) { server->server_down = 1; + error_push(ctx, + _("Server down. Export may be incomplete!")); + push_ldap_addl_error(ld, ctx); + + goto fail; + } + if (rc != LDAP_SUCCESS) { + error_push(ctx, + _("LDAP error. Export may be incomplete!")); + push_ldap_addl_error(ld, ctx); + goto fail; } out = g_string_new(""); for(e = ldap_first_entry(ld, msg); e ; e = ldap_next_entry(ld, e)) { ! ldif_entry_out(out, ld, e, ctx); } *************** *** 911,914 **** --- 922,927 ---- if (msg) ldap_msgfree(msg); close_connection(server, FALSE); + + error_flush(ctx); return; } Index: ldif.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/ldif.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** ldif.c 13 Jul 2002 07:04:20 -0000 1.12 --- ldif.c 2 Aug 2002 06:08:00 -0000 1.13 *************** *** 26,29 **** --- 26,30 ---- #include <stdlib.h> #include <string.h> /* strlen */ + #include <stdio.h> /* snprintf */ #include <ctype.h> #include <time.h> *************** *** 39,43 **** #include "ldif.h" #include "formfill.h" /* isInternalAttr() */ ! void prepend_ldif_header(GString *out, struct ldapserver *server, GList *bases) --- 40,45 ---- #include "ldif.h" #include "formfill.h" /* isInternalAttr() */ ! #include "i18n.h" ! #include "errorchain.h" void prepend_ldif_header(GString *out, struct ldapserver *server, GList *bases) *************** *** 67,71 **** ! gboolean ldif_entry_out(GString *out, LDAP *ld, LDAPMessage *msg) { BerElement *berptr; --- 69,74 ---- ! gboolean ldif_entry_out(GString *out, LDAP *ld, LDAPMessage *msg, ! int error_context) { BerElement *berptr; *************** *** 76,80 **** dn = ldap_get_dn(ld, msg); ! ldif_line_out(out, "dn", dn, strlen(dn)); g_string_append(out, "\n"); free(dn); --- 79,92 ---- dn = ldap_get_dn(ld, msg); ! ! if (!dn) { ! /* an error occurred */ ! ! error_push(error_context, _("Cannot retrieve DN of entry.\n")); ! push_ldap_addl_error(ld, error_context); ! return FALSE; ! } ! ! ldif_line_out(out, "dn", dn, strlen(dn), error_context); g_string_append(out, "\n"); free(dn); *************** *** 90,94 **** value = vals[i]; ldif_line_out(out, attr, ! value->bv_val, value->bv_len); g_string_append(out, "\n"); } --- 102,107 ---- value = vals[i]; ldif_line_out(out, attr, ! value->bv_val, value->bv_len, ! error_context); g_string_append(out, "\n"); } *************** *** 108,115 **** ! gboolean ldif_line_out(GString *out, char *attr, char *value, int vlen) { GString *tmp; int i, w, do_base64; g_string_append(out, attr); --- 121,152 ---- ! gboolean ldif_line_out(GString *out, char *attr, char *value, int vlen, ! int error_context) { GString *tmp; int i, w, do_base64; + /* char message[256]; */ + + if (attr == NULL) { + /* NULL attributes make no sense */ + error_push(error_context, + _("NULL attribute name - cannot write such an attribute...")); + return FALSE; + } + + if (value == NULL) { + /* NULL seems to be normal, at least with Netscape LDAP + servers, tested with help from Cord Beermann + <cor...@me...> */ + + /* + snprintf(message, sizeof(message), + _("NULL value for attribute %s - writing empty string instead..."), + attr); + error_push(error_context, message); + */ + value = ""; + vlen = 0; + } g_string_append(out, attr); Index: ldif.h =================================================================== RCS file: /cvsroot/gqclient/gq/src/ldif.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ldif.h 5 Jun 2002 15:40:32 -0000 1.4 --- ldif.h 2 Aug 2002 06:08:00 -0000 1.5 *************** *** 27,32 **** void prepend_ldif_header(GString *out, struct ldapserver *server, GList *bases); ! gboolean ldif_entry_out(GString *out, LDAP *ld, LDAPMessage *msg); ! gboolean ldif_line_out(GString *out, char *attr, char *value, int vlen); void b64_encode(GString *out, char *value, int vlen); void b64_decode(GByteArray *out, const char *value, int vlen); --- 27,34 ---- void prepend_ldif_header(GString *out, struct ldapserver *server, GList *bases); ! gboolean ldif_entry_out(GString *out, LDAP *ld, LDAPMessage *msg, ! int error_context); ! gboolean ldif_line_out(GString *out, char *attr, char *value, int vlen, ! int error_context); void b64_encode(GString *out, char *value, int vlen); void b64_decode(GByteArray *out, const char *value, int vlen); Index: browse.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/browse.c,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** browse.c 17 Jul 2002 21:43:43 -0000 1.56 --- browse.c 2 Aug 2002 06:08:00 -0000 1.57 *************** *** 1409,1414 **** GString *bigmessage = NULL; int written; ! char message[128]; char *attrs[] = { "*", "+", NULL }; entry = gtk_object_get_data(GTK_OBJECT(filesel), "entry"); --- 1409,1417 ---- GString *bigmessage = NULL; int written; ! char message[512]; char *attrs[] = { "*", "+", NULL }; + int ctx; + + ctx = error_new_context(_("Dump subtree")); entry = gtk_object_get_data(GTK_OBJECT(filesel), "entry"); *************** *** 1427,1431 **** if(g_list_length(bases) == 0) { ! return; } --- 1430,1435 ---- if(g_list_length(bases) == 0) { ! error_push(ctx, _("Nothing to dump!")); ! goto fail; } *************** *** 1436,1440 **** if( (outfile = fopen(filename, "w")) == NULL) { ! error_popup(_("Save failed"), strerror(errno)); } else { /* AFAIK, the UMich LDIF format doesn't take comments or a --- 1440,1450 ---- if( (outfile = fopen(filename, "w")) == NULL) { ! snprintf(message, sizeof(message), ! _("Could not open output file: %s"), ! strerror(errno)); ! error_push(ctx, message); ! ! goto fail; ! /* error_popup(_("Save failed"), strerror(errno)); */ } else { /* AFAIK, the UMich LDIF format doesn't take comments or a *************** *** 1443,1447 **** g_string_truncate(out, 0); - prepend_ldif_header(out, server, bases); --- 1453,1456 ---- *************** *** 1449,1455 **** if(written != out->len) { snprintf(message, sizeof(message), ! _("%d of %d bytes written"), written, out->len); ! error_popup(_("Save failed"), message); goto fail; /* sometimes goto is useful */ } --- 1458,1464 ---- if(written != out->len) { snprintf(message, sizeof(message), ! _("Save failed: Only %d of %d bytes written"), written, out->len); ! error_push(ctx, message); goto fail; /* sometimes goto is useful */ } *************** *** 1457,1460 **** --- 1466,1471 ---- if( (ld = open_connection(server)) == NULL) { + /* no extra error, open_connection does error reporting + itself... */ goto fail; } *************** *** 1471,1475 **** for(e = ldap_first_entry(ld, res); e; e = ldap_next_entry(ld, e)) { g_string_truncate(out, 0); ! ldif_entry_out(out, ld, e); num_entries++; --- 1482,1486 ---- for(e = ldap_first_entry(ld, res); e; e = ldap_next_entry(ld, e)) { g_string_truncate(out, 0); ! ldif_entry_out(out, ld, e, ctx); num_entries++; *************** *** 1491,1498 **** server->server_down++; ldap_msgfree(res); /* is this correct? */ } else { /* report error */ ! statusbar_msg(ldap_err2string(ldap_result2error(ld, ! res, 1))); goto fail; } --- 1502,1517 ---- server->server_down++; ldap_msgfree(res); /* is this correct? */ + + error_push(ctx, + _("Server down. Export may be incomplete!")); + push_ldap_addl_error(ld, ctx); + goto fail; } else { /* report error */ ! error_push(ctx, ! _("LDAP error. Export may be incomplete!")); ! push_ldap_addl_error(ld, ctx); ! /* statusbar_msg(ldap_err2string(ldap_result2error(ld, */ ! /* res, 1))); */ goto fail; } *************** *** 1508,1518 **** } ! fail: if (outfile) fclose(outfile); ! for (I = g_list_first(bases) ; I ; I = g_list_next(I)) { ! free(I->data); } - if (bases) g_list_free(bases); set_normalcursor(); --- 1527,1539 ---- } ! fail: /* labels are only good for cleaning up, really */ if (outfile) fclose(outfile); ! if (bases) { ! for (I = g_list_first(bases) ; I ; I = g_list_next(I)) { ! free(I->data); ! } ! g_list_free(bases); } set_normalcursor(); *************** *** 1522,1525 **** --- 1543,1548 ---- gtk_widget_destroy(filesel); + + error_flush(ctx); } |
From: <sta...@us...> - 2002-07-23 13:50:11
|
Update of /cvsroot/gqclient/gq/src In directory usw-pr-cvs1:/tmp/cvs-serv15276 Modified Files: common.h configfile.c configfile.h prefs.c Log Message: * Passwords will be now be encoded in the config file. gq askes if it should upgrade the configuration file to a new version (which will hold encoded passwords) Index: common.h =================================================================== RCS file: /cvsroot/gqclient/gq/src/common.h,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** common.h 15 Jul 2002 18:44:03 -0000 1.16 --- common.h 23 Jul 2002 13:50:06 -0000 1.17 *************** *** 70,73 **** --- 70,74 ---- char binddn[MAX_DN_LEN]; char bindpw[MAX_BINDPW_LEN]; + char pwencoding[32]; /* split the "configuration" password from the one entered by hand. This simplifies the handling of the configured password *************** *** 89,93 **** statistical number */ int missing_closes; /* incremented on every open_connection, ! decrementen on each close, close_connection really closes only if this drops to zero */ struct server_schema *ss; --- 90,94 ---- statistical number */ int missing_closes; /* incremented on every open_connection, ! decremented on each close, close_connection really closes only if this drops to zero */ struct server_schema *ss; Index: configfile.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/configfile.c,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** configfile.c 15 Jul 2002 18:44:03 -0000 1.25 --- configfile.c 23 Jul 2002 13:50:06 -0000 1.26 *************** *** 33,36 **** --- 33,37 ---- #include <ctype.h> #include <signal.h> + #include <time.h> #include <glib.h> *************** *** 44,47 **** --- 45,49 ---- #include "debug.h" #include "i18n.h" + #include "ldif.h" /* for b64_encode */ *************** *** 53,56 **** --- 55,61 ---- /* global options */ + { "config-version", T_CONFIG_VERSION, NEEDS_CLOSE }, + { "asked-config-version", T_ASKED_CONFIG_VERSION, NEEDS_CLOSE }, + { "last-asked", T_LAST_ASKED, NEEDS_CLOSE }, { "confirm-mod", T_CONFIRM_MOD, NEEDS_CLOSE }, { "search-argument", T_SEARCH_ARGUMENT, NEEDS_CLOSE }, *************** *** 70,73 **** --- 75,79 ---- { "binddn", T_BINDDN, NEEDS_CLOSE|NEEDS_DATA }, { "bindpw", T_BINDPW, NEEDS_CLOSE|NEEDS_DATA }, + { "pw-encoding", T_PWENCODING, NEEDS_CLOSE|NEEDS_DATA }, { "bindtype", T_BINDTYPE, NEEDS_CLOSE|NEEDS_DATA }, { "search-attribute",T_SEARCHATTR, NEEDS_CLOSE|NEEDS_DATA }, *************** *** 256,259 **** --- 262,283 ---- } + /* parses and returns an integer value from the configfile */ + long config_get_long(struct configfile *f) + { + char errstr[256]; + char *ep; + long l; + + l = strtol(f->cur_string, &ep, 0); + if (ep && *ep) { + snprintf(errstr, sizeof(errstr), + _("line %d: could not parse integer value '%s'. Should be decimal integer"), + f->line, f->cur_string); + error_push(f->err_context, errstr); + return 0; + } + + return l; + } void config_id_string(struct configfile *f) *************** *** 339,342 **** --- 363,367 ---- struct configfile *f; char errstr[256]; + struct ldapserver *s; /* DEBUG *************** *** 378,381 **** --- 403,415 ---- /* global settings */ switch(f->stack[f->sp - 1]) { + case T_CONFIG_VERSION: + config.config_version = config_get_long(f); + break; + case T_ASKED_CONFIG_VERSION: + config.asked_version = config_get_long(f); + break; + case T_LAST_ASKED: + config.last_asked = config_get_long(f); + break; case T_CONFIRM_MOD: config.confirm_mod = config_get_bool(f); *************** *** 427,431 **** break; case T_LDAPPORT: ! f->cur_ldapserver->ldapport = atoi(f->cur_string); break; case T_BASEDN: --- 461,465 ---- break; case T_LDAPPORT: ! f->cur_ldapserver->ldapport = config_get_long(f); break; case T_BASEDN: *************** *** 441,444 **** --- 475,483 ---- sizeof(f->cur_ldapserver->bindpw) - 1); break; + case T_PWENCODING: + strncpy(f->cur_ldapserver->pwencoding, + f->cur_string, + sizeof(f->cur_ldapserver->pwencoding) - 1); + break; case T_BINDTYPE: f->cur_ldapserver->bindtype = tokenize(token_bindtype, f->cur_string); *************** *** 448,452 **** break; case T_MAXENTRIES: ! f->cur_ldapserver->maxentries = atoi(f->cur_string); break; case T_CACHECONN: --- 487,491 ---- break; case T_MAXENTRIES: ! f->cur_ldapserver->maxentries = config_get_long(f); break; case T_CACHECONN: *************** *** 457,461 **** break; case T_LOCAL_CACHE_TIMEOUT: ! f->cur_ldapserver->local_cache_timeout = atoi(f->cur_string); break; case T_ASK_PW: --- 496,500 ---- break; case T_LOCAL_CACHE_TIMEOUT: ! f->cur_ldapserver->local_cache_timeout = config_get_long(f); break; case T_ASK_PW: *************** *** 569,575 **** } error_flush(f->err_context); FREE(f, "struct configfile"); - } --- 608,628 ---- } + /* walk the list of ldapservers and decode the passwords */ + + for ( s = config.ldapservers ; s ; s = s->next ) { + if (strcasecmp(s->pwencoding, "Base64") == 0 && s->bindpw[0]) { + GByteArray *o = g_byte_array_new(); + b64_decode(o, s->bindpw, strlen(s->bindpw)); + + memset(s->bindpw, 0, sizeof(s->bindpw)); + strncpy(s->bindpw, o->data, MAX(o->len, sizeof(s->bindpw) - 1)); + } else if (s->bindpw[0] && s->pwencoding[0]) { + error_push(f->err_context, + _("Unsupported password encoding")); + } + } + error_flush(f->err_context); FREE(f, "struct configfile"); } *************** *** 611,614 **** --- 664,671 ---- if(stat(rcpath, &sfile) == -1 || !sfile.st_size) { error_flush(load_context); + /* If there is no configuration file, we start with the + current configuration file version */ + config.config_version = CURRENT_CONFIG_VERSION; + config.asked_version = CURRENT_CONFIG_VERSION; return; } *************** *** 723,726 **** --- 780,790 ---- write_context = error_new_context(_("Error writing configfile")); + if (config.config_version > CURRENT_CONFIG_VERSION) { + error_push(write_context, + _("Configuration file version too high - saving the configuration is not possible")); + error_flush(write_context); + return; + } + server = config.ldapservers; wc = MALLOC(sizeof(struct writeconfig), "struct writeconfig"); *************** *** 749,752 **** --- 813,823 ---- /* global settings */ wc->indent++; + + if (config.config_version > 0) { + config_write_int(wc, config.config_version, "config-version"); + config_write_int(wc, config.config_version, "asked-config-version"); + config_write_int(wc, config.config_version, "last-asked"); + } + config_write_bool(wc, config.confirm_mod, "confirm-mod"); config_write_string(wc, detokenize(token_searchargument, config.search_argument), *************** *** 773,783 **** config_write_string_ne(wc, server->basedn, "basedn"); config_write_string_ne(wc, server->binddn, "binddn"); ! config_write_string_ne(wc, server->bindpw, "bindpw"); ! #if 0 ! b64_encode(pw, server->bindpw, strlen(server->bindpw)); ! config_write_string_ne(wc, pw->str, "bindpw"); ! config_write_string_ne(wc, "Base64", "pw-encoding"); ! g_string_free(pw); ! #endif if(server->bindtype != DEFAULT_BINDTYPE) --- 844,859 ---- config_write_string_ne(wc, server->basedn, "basedn"); config_write_string_ne(wc, server->binddn, "binddn"); ! ! if (config.config_version == 0) { ! config_write_string_ne(wc, server->bindpw, "bindpw"); ! } else { ! GString *pw = g_string_sized_new(32); ! ! b64_encode(pw, server->bindpw, strlen(server->bindpw)); ! config_write_string_ne(wc, pw->str, "bindpw"); ! config_write_string_ne(wc, "Base64", "pw-encoding"); ! ! g_string_free(pw, TRUE); ! } if(server->bindtype != DEFAULT_BINDTYPE) *************** *** 868,871 **** --- 944,948 ---- server->binddn[0] = '\0'; server->bindpw[0] = '\0'; + server->pwencoding[0] = '\0'; server->enteredpw[0] = '\0'; server->bindtype = DEFAULT_BINDTYPE; *************** *** 892,896 **** --- 969,977 ---- { struct ldapserver *default_server; + gboolean dosave = FALSE; + config.config_version = 0; + config.asked_version = 0; + config.last_asked = 0; config.ldapservers = NULL; config.templates = NULL; *************** *** 907,910 **** --- 988,1014 ---- load_config(); + + if (config.config_version > CURRENT_CONFIG_VERSION) { + /* incompatible configuration file version (version too high!) */ + + single_warning_popup(_("Incompatible configuration file version\n (version of configuration file is too high).\nTrying the best, but changing the configuration is not possible.")); + } + + if (config.config_version < CURRENT_CONFIG_VERSION + && (config.asked_version < CURRENT_CONFIG_VERSION || + (config.asked_version == CURRENT_CONFIG_VERSION && + (time(NULL) - config.last_asked) > 31*86400))) { + int rc = question_popup(_("Upgrade configuration?"), + _("Do you want to upgrade to the lastest configuration file version?\nIf you say no you may not be able to use all functionalities.\nIf you say yes you may not be able to use your configuration with older versions of gq.\n")); + + config.asked_version = CURRENT_CONFIG_VERSION; + config.last_asked = time(NULL); + + if (rc) { + config.config_version = CURRENT_CONFIG_VERSION; + dosave = TRUE; + } + } + if(!config.ldapservers) { /* no ldapserver defined in configfile */ *************** *** 920,923 **** --- 1024,1029 ---- } + /* actually do the upgrade if requested */ + if (dosave) save_config(); } Index: configfile.h =================================================================== RCS file: /cvsroot/gqclient/gq/src/configfile.h,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** configfile.h 17 Jul 2002 21:42:49 -0000 1.16 --- configfile.h 23 Jul 2002 13:50:06 -0000 1.17 *************** *** 31,34 **** --- 31,35 ---- #include <glib.h> + #define CURRENT_CONFIG_VERSION 1 #define CONFIG_INDENT_STRING " " *************** *** 36,39 **** --- 37,42 ---- #define RCFILE ".gq" + /* do not forget to set T_HIGHEST to the highest used token value below */ + /* tokens for config file */ #define T_UNKNOWN 0 *************** *** 51,54 **** --- 54,61 ---- #define T_SCHEMASERVER 18 + #define T_CONFIG_VERSION 51 + #define T_ASKED_CONFIG_VERSION 52 + #define T_LAST_ASKED 53 + /* per-server tokens */ #define T_LDAPSERVER 20 *************** *** 69,72 **** --- 76,80 ---- #define T_HIDE_INTERNAL 35 #define T_SHOW_REF 36 + #define T_PWENCODING 37 /* template tokens */ *************** *** 83,86 **** --- 91,96 ---- #define T_DATA 50 + #define T_HIGHEST 53 + /* bitwise flags used in keywordlist.flags */ #define NEEDS_CLOSE 1 *************** *** 114,117 **** --- 124,138 ---- struct gq_config { /* persistent */ + long config_version; /* 0 for old-style configuration file format + 1 introduces password encoding */ + long asked_version; /* holds the highest config file version for + which gq has already asked if it should + upgrade to. This is to avoid that on every + start of gq the used gets asked if he + wants to upgrade to a newer configfile + version */ + long last_asked; /* timestamp of lask asking for upgrade to a + newer confiig file. */ + struct ldapserver *ldapservers; GList *templates; Index: prefs.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/prefs.c,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** prefs.c 12 Jul 2002 20:27:52 -0000 1.24 --- prefs.c 23 Jul 2002 13:50:06 -0000 1.25 *************** *** 2,5 **** --- 2,6 ---- GQ -- a GTK-based LDAP client Copyright (C) 1998-2001 Bert Vermeulen + Parts: Copyright (C) 2002 Peter Stamfest and Bert Vermeulen This program is released under the Gnu General Public License with |
From: <sta...@us...> - 2002-07-23 13:48:02
|
Update of /cvsroot/gqclient/gq/src In directory usw-pr-cvs1:/tmp/cvs-serv15067 Modified Files: util.c Log Message: * Changed selection of bind password: Never use the password from the configuration if "ask password on first connect" is set for the server. Thanks to Tomas A. Maly <tom...@ya...> for causing me to check this area. * Changed construction of the question pixmap to not use the mainwin window. This allows us to use question_popup() even before the mainwin has been created. Index: util.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/util.c,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** util.c 15 Jul 2002 18:44:03 -0000 1.43 --- util.c 23 Jul 2002 13:47:57 -0000 1.44 *************** *** 169,183 **** #endif } ! if(server->binddn[0]) { binddn = server->binddn; - bindpw = server->bindpw; } ! else if (server->enteredpw[0]) { ! binddn = server->binddn; ! bindpw = server->enteredpw; } else { ! binddn = NULL; ! bindpw = NULL; } --- 169,192 ---- #endif } ! ! binddn = NULL; ! bindpw = NULL; ! if(server->binddn[0]) { binddn = server->binddn; } ! ! /* do not ever use the bindpw if we have turned on to ask ! for a password */ ! /* Thanks to Tomas A. Maly <tom...@ya...> for ! indirectly causing me to check this area */ ! if (server->ask_pw) { ! if (server->enteredpw[0]) { ! bindpw = server->enteredpw; ! } } else { ! if (server->bindpw[0]) { ! bindpw = server->bindpw; ! } } *************** *** 1333,1336 **** --- 1342,1347 ---- (gpointer) window); + gtk_widget_show(window); + vbox1 = GTK_DIALOG(window)->vbox; gtk_widget_show(vbox1); *************** *** 1339,1345 **** gtk_widget_show(hbox1); gtk_box_pack_start(GTK_BOX(vbox1), hbox1, FALSE, FALSE, 10); ! warning = gdk_pixmap_create_from_xpm_d(GTK_WIDGET(mainwin)->window, &warning_mask, ! &mainwin->style->white, warning_xpm); pixmap = gtk_pixmap_new(warning, warning_mask); --- 1350,1356 ---- gtk_widget_show(hbox1); gtk_box_pack_start(GTK_BOX(vbox1), hbox1, FALSE, FALSE, 10); ! warning = gdk_pixmap_create_from_xpm_d(GTK_WIDGET(window)->window, &warning_mask, ! &window->style->white, warning_xpm); pixmap = gtk_pixmap_new(warning, warning_mask); |
From: <sta...@us...> - 2002-07-17 21:46:26
|
Update of /cvsroot/gqclient/gq/src In directory usw-pr-cvs1:/tmp/cvs-serv9528 Modified Files: dt_time.c input.c Log Message: * Changed the layout (mostly container border widths) + of the right pane in the LDAP browser + of the dt_time window to look better (IMHO, that is) Index: dt_time.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/dt_time.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** dt_time.c 13 Jul 2002 07:01:06 -0000 1.3 --- dt_time.c 17 Jul 2002 21:46:22 -0000 1.4 *************** *** 271,275 **** main_vbox = gtk_vbox_new(FALSE, 0); ! gtk_container_border_width(GTK_CONTAINER(main_vbox), 10); gtk_widget_show(main_vbox); gtk_container_add(GTK_CONTAINER(editwindow), main_vbox); --- 271,275 ---- main_vbox = gtk_vbox_new(FALSE, 0); ! gtk_container_border_width(GTK_CONTAINER(main_vbox), 5); gtk_widget_show(main_vbox); gtk_container_add(GTK_CONTAINER(editwindow), main_vbox); *************** *** 372,376 **** hbox2 = gtk_hbutton_box_new(); ! gtk_box_pack_start(GTK_BOX(main_vbox), hbox2, FALSE, TRUE, 10); gtk_widget_show(hbox2); --- 372,376 ---- hbox2 = gtk_hbutton_box_new(); ! gtk_box_pack_start(GTK_BOX(main_vbox), hbox2, FALSE, TRUE, 5); gtk_widget_show(hbox2); *************** *** 380,389 **** GTK_SIGNAL_FUNC(dt_time_ok_callback), (gpointer) cbd); ! gtk_box_pack_start(GTK_BOX(hbox2), button2, FALSE, TRUE, 10); GTK_WIDGET_SET_FLAGS(button2, GTK_CAN_DEFAULT); gtk_widget_grab_default(button2); button2 = gtk_button_new_with_label(_("Cancel")); ! gtk_box_pack_end(GTK_BOX(hbox2), button2, FALSE, TRUE, 10); gtk_signal_connect_object(GTK_OBJECT(button2), "clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), --- 380,389 ---- GTK_SIGNAL_FUNC(dt_time_ok_callback), (gpointer) cbd); ! gtk_box_pack_start(GTK_BOX(hbox2), button2, FALSE, TRUE, 0); GTK_WIDGET_SET_FLAGS(button2, GTK_CAN_DEFAULT); gtk_widget_grab_default(button2); button2 = gtk_button_new_with_label(_("Cancel")); ! gtk_box_pack_end(GTK_BOX(hbox2), button2, FALSE, TRUE, 0); gtk_signal_connect_object(GTK_OBJECT(button2), "clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), Index: input.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/input.c,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** input.c 15 Jul 2002 18:12:30 -0000 1.43 --- input.c 17 Jul 2002 21:46:22 -0000 1.44 *************** *** 98,102 **** hbox1 = gtk_hbox_new(FALSE, 5); gtk_widget_show(hbox1); ! gtk_box_pack_start(GTK_BOX(target_vbox), hbox1, FALSE, FALSE, 0); /* line button */ --- 98,102 ---- hbox1 = gtk_hbox_new(FALSE, 5); gtk_widget_show(hbox1); ! gtk_box_pack_start(GTK_BOX(target_vbox), hbox1, FALSE, FALSE, 5); /* line button */ *************** *** 147,156 **** /* scrolled window with vbox2 inside */ scwin = gtk_scrolled_window_new(NULL, NULL); ! gtk_container_border_width(GTK_CONTAINER(scwin), 5); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scwin), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_widget_show(scwin); ! gtk_box_pack_start(GTK_BOX(target_vbox), scwin, TRUE, TRUE, 5); vbox2 = gtk_vbox_new(FALSE, 0); gtk_widget_show(vbox2); --- 147,156 ---- /* scrolled window with vbox2 inside */ scwin = gtk_scrolled_window_new(NULL, NULL); ! gtk_container_border_width(GTK_CONTAINER(scwin), 0); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scwin), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_widget_show(scwin); ! gtk_box_pack_start(GTK_BOX(target_vbox), scwin, TRUE, TRUE, 0); vbox2 = gtk_vbox_new(FALSE, 0); gtk_widget_show(vbox2); *************** *** 169,173 **** /* hbox2 = gtk_hbox_new(TRUE, 0); */ hbox2 = gtk_hbutton_box_new(); ! gtk_container_set_border_width(GTK_CONTAINER(hbox2), 10); gtk_widget_show(hbox2); gtk_box_pack_end(GTK_BOX(target_vbox), hbox2, FALSE, TRUE, 0); --- 169,173 ---- /* hbox2 = gtk_hbox_new(TRUE, 0); */ hbox2 = gtk_hbutton_box_new(); ! gtk_container_set_border_width(GTK_CONTAINER(hbox2), 5); gtk_widget_show(hbox2); gtk_box_pack_end(GTK_BOX(target_vbox), hbox2, FALSE, TRUE, 0); *************** *** 420,424 **** gtk_widget_show(label); gtk_table_attach(GTK_TABLE(target_table), label, 0, 1, 0, 1, ! GTK_FILL, 0, 0, 0); inputbox = gtk_entry_new(); --- 420,424 ---- gtk_widget_show(label); gtk_table_attach(GTK_TABLE(target_table), label, 0, 1, 0, 1, ! GTK_SHRINK, 0, 0, 0); inputbox = gtk_entry_new(); *************** *** 472,476 **** gtk_table_attach(GTK_TABLE(target_table), label, 0, 1, row, row + 1, ! GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 0, 0); --- 472,476 ---- gtk_table_attach(GTK_TABLE(target_table), label, 0, 1, row, row + 1, ! /* GTK_FILL| */ GTK_SHRINK, GTK_FILL|GTK_EXPAND, 0, 0); *************** *** 563,567 **** gtk_table_attach(GTK_TABLE(target_table), align, 2, 3, row_arrow, row_arrow + 1, ! 0, GTK_FILL, 5, 0); if (form->flags & FLAG_NO_USER_MOD) { --- 563,567 ---- gtk_table_attach(GTK_TABLE(target_table), align, 2, 3, row_arrow, row_arrow + 1, ! GTK_SHRINK, GTK_FILL, 0, 0); if (form->flags & FLAG_NO_USER_MOD) { |
From: <sta...@us...> - 2002-07-17 21:43:46
|
Update of /cvsroot/gqclient/gq/src In directory usw-pr-cvs1:/tmp/cvs-serv9036 Modified Files: browse.c Log Message: * Refreshing a server node now really refreshes the information presented Index: browse.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/browse.c,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** browse.c 15 Jul 2002 18:44:03 -0000 1.55 --- browse.c 17 Jul 2002 21:43:43 -0000 1.56 *************** *** 477,482 **** * a server was selected in the tree widget. * ! * FIXME: put up the server's editable info here? Easy to do, but ! * does it belong here? */ static void server_browse_entry_selected(server_browse_entry *entry, --- 477,481 ---- * a server was selected in the tree widget. * ! * put up some server info. */ static void server_browse_entry_selected(server_browse_entry *entry, *************** *** 491,655 **** int row = 0; char buf[128]; server_name = entry->server->name; /* dn_by_node(node); */ - cur_dn = g_hash_table_lookup(hash, "cur_dn"); ! if(strncmp(cur_dn->str, server_name, cur_dn->len)) { ! LDAP *ld = open_connection(entry->server); ! g_string_assign(cur_dn, server_name); ! g_hash_table_insert(hash, "cur_dn", cur_dn); ! pane2_scrwin = g_hash_table_lookup(hash, "pane2_scrwin"); ! pane2_vbox = gtk_object_get_data(GTK_OBJECT(pane2_scrwin), "vbox"); ! /* gtk_widget_destroy(pane2_vbox); */ ! /* remove the viewport of the scrolled window. This should ! _really_ destroy the widgets below it. The pane2_scrwin ! is a GtkBin Object and thus has only one child, use this ! to obtain the viewport */ ! gtk_container_remove(GTK_CONTAINER(pane2_scrwin), ! GTK_BIN(pane2_scrwin)->child); ! pane2_vbox = gtk_vbox_new(FALSE, 2); ! gtk_object_set_data(GTK_OBJECT(pane2_scrwin), "vbox", pane2_vbox); ! gtk_widget_show(pane2_vbox); ! gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(pane2_scrwin), ! pane2_vbox); ! table = gtk_table_new(5, 2, FALSE); ! gtk_container_border_width(GTK_CONTAINER(table), 5); ! gtk_widget_show(table); ! gtk_box_pack_start(GTK_BOX(pane2_vbox), table, FALSE, FALSE, 5); ! /* Nickname */ ! label = gtk_label_new(_("Nickname")); ! gtk_widget_show(label); ! gtk_table_attach(GTK_TABLE(table), ! label, ! 0, 1, row, row+1, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! 0, 0); ! e = gtk_entry_new(); ! gtk_entry_set_text(GTK_ENTRY(e), server_name); ! gtk_widget_set_sensitive(e, FALSE); ! gtk_widget_show(e); ! gtk_table_attach(GTK_TABLE(table), ! e, ! 1, 2, row, row+1, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! 0, 0); ! row++; ! /* Host name */ ! label = gtk_label_new(_("Hostname")); ! gtk_widget_show(label); ! gtk_table_attach(GTK_TABLE(table), ! label, ! 0, 1, row, row+1, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! 0, 0); ! e = gtk_entry_new(); ! gtk_entry_set_text(GTK_ENTRY(e), entry->server->ldaphost); ! gtk_widget_set_sensitive(e, FALSE); ! gtk_widget_show(e); ! gtk_table_attach(GTK_TABLE(table), ! e, ! 1, 2, row, row+1, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! 0, 0); ! row++; ! /* Port */ ! label = gtk_label_new(_("Port")); ! gtk_widget_show(label); ! gtk_table_attach(GTK_TABLE(table), ! label, ! 0, 1, row, row+1, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! 0, 0); ! snprintf(buf, sizeof(buf), "%d", entry->server->ldapport); ! e = gtk_entry_new(); ! gtk_entry_set_text(GTK_ENTRY(e), buf); ! gtk_widget_set_sensitive(e, FALSE); ! gtk_widget_show(e); ! gtk_table_attach(GTK_TABLE(table), ! e, ! 1, 2, row, row+1, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! 0, 0); ! row++; ! /* Connection caching */ ! label = gtk_label_new(_("Connection caching")); ! gtk_widget_show(label); ! gtk_table_attach(GTK_TABLE(table), ! label, ! 0, 1, row, row+1, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! 0, 0); ! snprintf(buf, sizeof(buf), "%s", ! entry->server->cacheconn ? _("on") : _("off")); ! e = gtk_entry_new(); ! gtk_entry_set_text(GTK_ENTRY(e), buf); ! gtk_widget_set_sensitive(e, FALSE); ! gtk_widget_show(e); ! gtk_table_attach(GTK_TABLE(table), ! e, ! 1, 2, row, row+1, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! 0, 0); ! row++; ! /* TLS */ ! label = gtk_label_new(_("TLS")); ! gtk_widget_show(label); ! gtk_table_attach(GTK_TABLE(table), ! label, ! 0, 1, row, row+1, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! 0, 0); ! snprintf(buf, sizeof(buf), "%s", ! entry->server->enabletls ? _("on") : _("off")); ! e = gtk_entry_new(); ! gtk_entry_set_text(GTK_ENTRY(e), buf); ! gtk_widget_set_sensitive(e, FALSE); ! gtk_widget_show(e); ! gtk_table_attach(GTK_TABLE(table), ! e, ! 1, 2, row, row+1, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! 0, 0); ! row++; ! /* Connections so far */ ! label = gtk_label_new(_("Connections so far")); gtk_widget_show(label); gtk_table_attach(GTK_TABLE(table), label, 0, 1, row, row+1, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0); ! ! snprintf(buf, sizeof(buf), "%d", ! entry->server->incarnation); e = gtk_entry_new(); gtk_entry_set_text(GTK_ENTRY(e), buf); --- 490,682 ---- int row = 0; char buf[128]; + LDAP *ld = open_connection(entry->server); server_name = entry->server->name; /* dn_by_node(node); */ cur_dn = g_hash_table_lookup(hash, "cur_dn"); ! g_string_assign(cur_dn, server_name); ! g_hash_table_insert(hash, "cur_dn", cur_dn); ! pane2_scrwin = g_hash_table_lookup(hash, "pane2_scrwin"); ! pane2_vbox = gtk_object_get_data(GTK_OBJECT(pane2_scrwin), "vbox"); ! /* gtk_widget_destroy(pane2_vbox); */ ! /* remove the viewport of the scrolled window. This should ! _really_ destroy the widgets below it. The pane2_scrwin ! is a GtkBin Object and thus has only one child, use this ! to obtain the viewport */ ! gtk_container_remove(GTK_CONTAINER(pane2_scrwin), ! GTK_BIN(pane2_scrwin)->child); ! pane2_vbox = gtk_vbox_new(FALSE, 2); ! gtk_object_set_data(GTK_OBJECT(pane2_scrwin), "vbox", pane2_vbox); ! gtk_widget_show(pane2_vbox); ! gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(pane2_scrwin), ! pane2_vbox); ! table = gtk_table_new(5, 2, FALSE); ! gtk_container_border_width(GTK_CONTAINER(table), 5); ! gtk_widget_show(table); ! gtk_box_pack_start(GTK_BOX(pane2_vbox), table, FALSE, FALSE, 5); ! /* Nickname */ ! label = gtk_label_new(_("Nickname")); ! gtk_widget_show(label); ! gtk_table_attach(GTK_TABLE(table), ! label, ! 0, 1, row, row+1, ! GTK_SHRINK, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! 0, 0); ! e = gtk_entry_new(); ! gtk_entry_set_text(GTK_ENTRY(e), server_name); ! gtk_widget_set_sensitive(e, FALSE); ! gtk_widget_show(e); ! gtk_table_attach(GTK_TABLE(table), ! e, ! 1, 2, row, row+1, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! 0, 0); ! row++; ! /* Host name */ ! label = gtk_label_new(_("Hostname")); ! gtk_widget_show(label); ! gtk_table_attach(GTK_TABLE(table), ! label, ! 0, 1, row, row+1, ! GTK_SHRINK, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! 0, 0); ! e = gtk_entry_new(); ! gtk_entry_set_text(GTK_ENTRY(e), entry->server->ldaphost); ! gtk_widget_set_sensitive(e, FALSE); ! gtk_widget_show(e); ! gtk_table_attach(GTK_TABLE(table), ! e, ! 1, 2, row, row+1, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! 0, 0); ! row++; ! /* Port */ ! label = gtk_label_new(_("Port")); ! gtk_widget_show(label); ! gtk_table_attach(GTK_TABLE(table), ! label, ! 0, 1, row, row+1, ! GTK_SHRINK, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! 0, 0); ! snprintf(buf, sizeof(buf), "%d", entry->server->ldapport); ! e = gtk_entry_new(); ! gtk_entry_set_text(GTK_ENTRY(e), buf); ! gtk_widget_set_sensitive(e, FALSE); ! gtk_widget_show(e); ! gtk_table_attach(GTK_TABLE(table), ! e, ! 1, 2, row, row+1, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! 0, 0); ! row++; ! /* Connection caching */ ! label = gtk_label_new(_("Connection caching")); ! gtk_widget_show(label); ! gtk_table_attach(GTK_TABLE(table), ! label, ! 0, 1, row, row+1, ! GTK_SHRINK, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! 0, 0); ! snprintf(buf, sizeof(buf), "%s", ! entry->server->cacheconn ? _("on") : _("off")); ! e = gtk_entry_new(); ! gtk_entry_set_text(GTK_ENTRY(e), buf); ! gtk_widget_set_sensitive(e, FALSE); ! gtk_widget_show(e); ! gtk_table_attach(GTK_TABLE(table), ! e, ! 1, 2, row, row+1, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! 0, 0); ! row++; ! /* TLS */ ! label = gtk_label_new(_("TLS")); ! gtk_widget_show(label); ! gtk_table_attach(GTK_TABLE(table), ! label, ! 0, 1, row, row+1, ! GTK_SHRINK, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! 0, 0); ! snprintf(buf, sizeof(buf), "%s", ! entry->server->enabletls ? _("on") : _("off")); ! e = gtk_entry_new(); ! gtk_entry_set_text(GTK_ENTRY(e), buf); ! gtk_widget_set_sensitive(e, FALSE); ! gtk_widget_show(e); ! gtk_table_attach(GTK_TABLE(table), ! e, ! 1, 2, row, row+1, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! 0, 0); ! row++; ! /* Connections so far */ ! label = gtk_label_new(_("Connections so far")); ! gtk_widget_show(label); ! gtk_table_attach(GTK_TABLE(table), ! label, ! 0, 1, row, row+1, ! GTK_SHRINK, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! 0, 0); ! snprintf(buf, sizeof(buf), "%d", ! entry->server->incarnation); ! e = gtk_entry_new(); ! gtk_entry_set_text(GTK_ENTRY(e), buf); ! gtk_widget_set_sensitive(e, FALSE); ! gtk_widget_show(e); ! gtk_table_attach(GTK_TABLE(table), ! e, ! 1, 2, row, row+1, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! 0, 0); ! ! row++; ! ! if (ld) { ! int intdata; ! int rc; ! /* void *optdata; */ ! ! rc = ldap_get_option(ld, LDAP_OPT_PROTOCOL_VERSION, &intdata); ! ! /* LDAP protocol version */ ! label = gtk_label_new(_("LDAP protocol version")); gtk_widget_show(label); gtk_table_attach(GTK_TABLE(table), label, 0, 1, row, row+1, ! GTK_SHRINK, GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0); ! ! snprintf(buf, sizeof(buf), "%d", intdata); e = gtk_entry_new(); gtk_entry_set_text(GTK_ENTRY(e), buf); *************** *** 662,704 **** GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0); - - row++; - - if (ld) { - int intdata; - int rc; - /* void *optdata; */ - - rc = ldap_get_option(ld, LDAP_OPT_PROTOCOL_VERSION, &intdata); - - /* LDAP protocol version */ - label = gtk_label_new(_("LDAP protocol version")); - gtk_widget_show(label); - gtk_table_attach(GTK_TABLE(table), - label, - 0, 1, row, row+1, - GTK_EXPAND | GTK_SHRINK | GTK_FILL, - GTK_EXPAND | GTK_SHRINK | GTK_FILL, - 0, 0); ! snprintf(buf, sizeof(buf), "%d", intdata); ! e = gtk_entry_new(); ! gtk_entry_set_text(GTK_ENTRY(e), buf); ! gtk_widget_set_sensitive(e, FALSE); ! gtk_widget_show(e); ! gtk_table_attach(GTK_TABLE(table), ! e, ! 1, 2, row, row+1, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! 0, 0); ! ! row++; ! ! close_connection(entry->server, FALSE); ! } ! /* gtk_box_pack_start(GTK_BOX(pane2_vbox), label, FALSE, FALSE, 0); */ } } --- 689,699 ---- GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0); ! row++; ! close_connection(entry->server, FALSE); } + + /* gtk_box_pack_start(GTK_BOX(pane2_vbox), label, FALSE, FALSE, 0); */ } *************** *** 717,723 **** gtk_clist_freeze(GTK_CLIST(ctree)); ! /* toggle expansion twice to fire the expand callback */ ! gtk_ctree_toggle_expansion(ctree, node); ! gtk_ctree_toggle_expansion(ctree, node); gtk_clist_thaw(GTK_CLIST(ctree)); --- 712,720 ---- gtk_clist_freeze(GTK_CLIST(ctree)); ! server_browse_entry_selected(entry, ctree, node, hash); ! ! /* /\* toggle expansion twice to fire the expand callback *\/ */ ! /* gtk_ctree_toggle_expansion(ctree, node); */ ! /* gtk_ctree_toggle_expansion(ctree, node); */ gtk_clist_thaw(GTK_CLIST(ctree)); |
From: <sta...@us...> - 2002-07-17 21:42:53
|
Update of /cvsroot/gqclient/gq/src In directory usw-pr-cvs1:/tmp/cvs-serv8414 Modified Files: configfile.h Log Message: * Default for "show referrals" is now turned off to have the old functionality be the default Index: configfile.h =================================================================== RCS file: /cvsroot/gqclient/gq/src/configfile.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** configfile.h 12 Jul 2002 20:27:52 -0000 1.15 --- configfile.h 17 Jul 2002 21:42:49 -0000 1.16 *************** *** 103,107 **** #define DEFAULT_ASK_PW 1 #define DEFAULT_HIDE_INTERNAL 1 ! #define DEFAULT_SHOW_REF 1 enum searchtype { --- 103,107 ---- #define DEFAULT_ASK_PW 1 #define DEFAULT_HIDE_INTERNAL 1 ! #define DEFAULT_SHOW_REF 0 enum searchtype { |
From: <sta...@us...> - 2002-07-15 18:45:02
|
Update of /cvsroot/gqclient/gq In directory usw-pr-cvs1:/tmp/cvs-serv21303 Modified Files: ChangeLog Log Message: * As always: Document changes from the last couple of days Index: ChangeLog =================================================================== RCS file: /cvsroot/gqclient/gq/ChangeLog,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** ChangeLog 12 Jul 2002 20:31:26 -0000 1.32 --- ChangeLog 15 Jul 2002 18:45:00 -0000 1.33 *************** *** 1,2 **** --- 1,20 ---- + 2002-07-15 Peter Stamfest <pe...@st...> + * Added a work around for strange behaviour reported by + gw...@ac... when changing the rdn of an object where the + attribute named in the rdn does not exist with the named + value. This caused the object itself to be deleted. + 2002-07-13 Peter Stamfest <pe...@st...> + * Added a couple of features: + + The attribute popup menu allows to view schema information + for the attribute now. + + A new entry in the popup menu of a search result allow to find + the object in a browser window. This allows to enter objects + into the browse tree that might not be found otherwise, eg. + because of a sizelimit. From that entry, the tree below it can + be browsed. + + The base DN combobox in search tabs can be changed now. This + is good for searches where one needs a different base. See + http://www.ldap.research.netsol.com/ldapsearch.html where this + can be useful. 2002-07-12 Peter Stamfest <pe...@st...> * Properly deal with binary data when switching to/from display |
From: <sta...@us...> - 2002-07-15 18:44:24
|
Update of /cvsroot/gqclient/gq In directory usw-pr-cvs1:/tmp/cvs-serv21093 Modified Files: TODO Log Message: * As always: document changes from the last couple of days Index: TODO =================================================================== RCS file: /cvsroot/gqclient/gq/TODO,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** TODO 3 Jul 2002 20:56:25 -0000 1.25 --- TODO 15 Jul 2002 18:44:21 -0000 1.26 *************** *** 24,29 **** LDAP_SUCCESS and LDAP_SERVER_DOWN but ignore the rest. Pointed out indirectly by Bernhard Reiter <ber...@in...>. - * [1.0] Fix dt_password.c: handling of the construction of encoded passwords - (get rid of any strcpy, strcat and only using GByteArray methods) * [1.0] Think about the moving stuff in browse mode: Either --- 24,27 ---- *************** *** 48,52 **** - somehow indicate a referral in the browse tree and allow to follow it, maybe through the context menu? - * put up rootDSE info in browse mode's server detail (cn=monitor?) * take schema from entry (done?) * templates: allow defaults? --- 46,49 ---- *************** *** 56,65 **** towers of hanoi * [1.0] encode passwords in .gq - this doesn't add any real security, but at ! least the password cannot be easily remembered if one you happens to glance at it. (This is similar to why HTTP basic authentication encodes the password). * [1.0] More displaytypes ! Most notably a calendar to enter dates and times ! * [1.0] Allow to change displaytypes on-the-fly * [1.0] Rewrite drag-and-drop: - _only_ use ldap_modrdn when moving trees within one server. This --- 53,62 ---- towers of hanoi * [1.0] encode passwords in .gq - this doesn't add any real security, but at ! least the password cannot be easily remembered if one happens to glance at it. (This is similar to why HTTP basic authentication encodes the password). * [1.0] More displaytypes ! + Most notably a calendar to enter dates and times ! + PKCS7 and PKCS12 browsers * [1.0] Rewrite drag-and-drop: - _only_ use ldap_modrdn when moving trees within one server. This *************** *** 67,70 **** --- 64,68 ---- * Rewrite the schema browser to also use the GtkCTree widget. * [1.0] Improve LDAP error reporting + * [1.0] Support for the extensibleObject object class BLUE SKY *************** *** 76,79 **** --- 74,87 ---- FIXED BUGS / IMPLEMENTED ENHANCEMENTS + + * put up rootDSE info in browse mode's server detail (cn=monitor?) + + -> well, we now have some interesting information there, but + probably not what Bert had in mind. + + * [1.0] Fix dt_password.c: handling of the construction of encoded passwords + (get rid of any strcpy, strcat and only using GByteArray methods) + + * [1.0] Allow to change displaytypes on-the-fly * mainwin: ^c makes a browse tab! |
From: <sta...@us...> - 2002-07-15 18:44:06
|
Update of /cvsroot/gqclient/gq/src In directory usw-pr-cvs1:/tmp/cvs-serv19315 Modified Files: browse.c browse.h common.h configfile.c search.c util.c Log Message: * Added code to show server related information when selecting a server node in browse mode. (including a connection count) * More error handling/information in browse mode. * Allow to explicitly close a server connection in browse mode. Should add similar stuff to the schema browser. * Allow to add _all_ objects found in a search to the browsing tree at once. * Some commented-out code to encode the password in the configuration file. Still have to think about migration to the new configuration file with encoded passwords... * Added a network timeout during connection to a server. Index: browse.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/browse.c,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** browse.c 13 Jul 2002 16:53:41 -0000 1.54 --- browse.c 15 Jul 2002 18:44:03 -0000 1.55 *************** *** 25,29 **** /* $Id$ */ - /* #define DEBUG_DND */ #include <glib.h> #include <gtk/gtk.h> --- 25,28 ---- *************** *** 88,97 **** ! static GtkCTreeNode *dn_browse_single_add(LDAP *ld, ! LDAPMessage *e, GtkCTree *ctree, GtkCTreeNode *node) { - char *dn = ldap_get_dn(ld, e); char **exploded_dn = 0; char *labels[] = { NULL, NULL }; --- 87,94 ---- ! static GtkCTreeNode *dn_browse_single_add(const char *dn, GtkCTree *ctree, GtkCTreeNode *node) { char **exploded_dn = 0; char *labels[] = { NULL, NULL }; *************** *** 128,132 **** free(labels[0]); gq_exploded_free(exploded_dn); - free(dn); return added; --- 125,128 ---- *************** *** 145,149 **** char message[MAX_DN_LEN + 21]; char *dummy[] = { "dummy", NULL }; ! char *c; int context = error_new_context(_("Expand entry")); --- 141,145 ---- char message[MAX_DN_LEN + 21]; char *dummy[] = { "dummy", NULL }; ! char *c, **refs; int context = error_new_context(_("Expand entry")); *************** *** 199,203 **** e = ldap_next_entry(ld, e)) { ! dn_browse_single_add(ld, e, ctree, node); num_children++; --- 195,201 ---- e = ldap_next_entry(ld, e)) { ! char *dn = ldap_get_dn(ld, e); ! dn_browse_single_add(dn, ctree, node); ! free(dn); num_children++; *************** *** 220,224 **** rc = ldap_parse_result(ld, res, ! &err, NULL, NULL, NULL, NULL, 0); if (rc != LDAP_SUCCESS) { --- 218,222 ---- rc = ldap_parse_result(ld, res, ! &err, &c, NULL, &refs, NULL, 0); if (rc != LDAP_SUCCESS) { *************** *** 235,240 **** --- 233,252 ---- " - %s", _("time limit exceeded")); } else if (err != LDAP_SUCCESS) { + char mdn[MAX_DN_LEN + 21]; error_push(context, ldap_err2string(err)); push_ldap_addl_error(ld, context); + if (c && strlen(c)) { + snprintf(mdn, sizeof(mdn), + _("Matched DN: %s"), c); + error_push(context, mdn); + } + if (refs) { + int i; + for (i = 0 ; refs[i] ; i++) { + snprintf(mdn, sizeof(mdn), + _("Referral to: %s"), refs[i]); + error_push(context, mdn); + } + } } } *************** *** 474,479 **** { GString *cur_dn; ! GtkWidget *pane2_scrwin, *pane2_vbox, *label; char *server_name; server_name = entry->server->name; /* dn_by_node(node); */ --- 486,494 ---- { GString *cur_dn; ! GtkWidget *pane2_scrwin, *pane2_vbox, *label, *e; ! GtkWidget *table; char *server_name; + int row = 0; + char buf[128]; server_name = entry->server->name; /* dn_by_node(node); */ *************** *** 481,484 **** --- 496,501 ---- cur_dn = g_hash_table_lookup(hash, "cur_dn"); if(strncmp(cur_dn->str, server_name, cur_dn->len)) { + LDAP *ld = open_connection(entry->server); + g_string_assign(cur_dn, server_name); g_hash_table_insert(hash, "cur_dn", cur_dn); *************** *** 501,507 **** pane2_vbox); ! label = gtk_label_new(server_name); gtk_widget_show(label); ! gtk_box_pack_start(GTK_BOX(pane2_vbox), label, FALSE, FALSE, 0); } } --- 518,703 ---- pane2_vbox); ! table = gtk_table_new(5, 2, FALSE); ! gtk_container_border_width(GTK_CONTAINER(table), 5); ! gtk_widget_show(table); ! gtk_box_pack_start(GTK_BOX(pane2_vbox), table, FALSE, FALSE, 5); ! ! /* Nickname */ ! label = gtk_label_new(_("Nickname")); gtk_widget_show(label); ! gtk_table_attach(GTK_TABLE(table), ! label, ! 0, 1, row, row+1, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! 0, 0); ! ! e = gtk_entry_new(); ! gtk_entry_set_text(GTK_ENTRY(e), server_name); ! gtk_widget_set_sensitive(e, FALSE); ! gtk_widget_show(e); ! gtk_table_attach(GTK_TABLE(table), ! e, ! 1, 2, row, row+1, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! 0, 0); ! row++; ! ! /* Host name */ ! label = gtk_label_new(_("Hostname")); ! gtk_widget_show(label); ! gtk_table_attach(GTK_TABLE(table), ! label, ! 0, 1, row, row+1, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! 0, 0); ! ! e = gtk_entry_new(); ! gtk_entry_set_text(GTK_ENTRY(e), entry->server->ldaphost); ! gtk_widget_set_sensitive(e, FALSE); ! gtk_widget_show(e); ! gtk_table_attach(GTK_TABLE(table), ! e, ! 1, 2, row, row+1, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! 0, 0); ! row++; ! ! /* Port */ ! label = gtk_label_new(_("Port")); ! gtk_widget_show(label); ! gtk_table_attach(GTK_TABLE(table), ! label, ! 0, 1, row, row+1, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! 0, 0); ! ! snprintf(buf, sizeof(buf), "%d", entry->server->ldapport); ! e = gtk_entry_new(); ! gtk_entry_set_text(GTK_ENTRY(e), buf); ! gtk_widget_set_sensitive(e, FALSE); ! gtk_widget_show(e); ! gtk_table_attach(GTK_TABLE(table), ! e, ! 1, 2, row, row+1, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! 0, 0); ! row++; ! ! /* Connection caching */ ! label = gtk_label_new(_("Connection caching")); ! gtk_widget_show(label); ! gtk_table_attach(GTK_TABLE(table), ! label, ! 0, 1, row, row+1, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! 0, 0); ! ! snprintf(buf, sizeof(buf), "%s", ! entry->server->cacheconn ? _("on") : _("off")); ! e = gtk_entry_new(); ! gtk_entry_set_text(GTK_ENTRY(e), buf); ! gtk_widget_set_sensitive(e, FALSE); ! gtk_widget_show(e); ! gtk_table_attach(GTK_TABLE(table), ! e, ! 1, 2, row, row+1, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! 0, 0); ! ! row++; ! ! /* TLS */ ! label = gtk_label_new(_("TLS")); ! gtk_widget_show(label); ! gtk_table_attach(GTK_TABLE(table), ! label, ! 0, 1, row, row+1, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! 0, 0); ! ! snprintf(buf, sizeof(buf), "%s", ! entry->server->enabletls ? _("on") : _("off")); ! e = gtk_entry_new(); ! gtk_entry_set_text(GTK_ENTRY(e), buf); ! gtk_widget_set_sensitive(e, FALSE); ! gtk_widget_show(e); ! gtk_table_attach(GTK_TABLE(table), ! e, ! 1, 2, row, row+1, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! 0, 0); ! ! row++; ! ! /* Connections so far */ ! label = gtk_label_new(_("Connections so far")); ! gtk_widget_show(label); ! gtk_table_attach(GTK_TABLE(table), ! label, ! 0, 1, row, row+1, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! 0, 0); ! ! snprintf(buf, sizeof(buf), "%d", ! entry->server->incarnation); ! e = gtk_entry_new(); ! gtk_entry_set_text(GTK_ENTRY(e), buf); ! gtk_widget_set_sensitive(e, FALSE); ! gtk_widget_show(e); ! gtk_table_attach(GTK_TABLE(table), ! e, ! 1, 2, row, row+1, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! 0, 0); ! ! row++; ! ! if (ld) { ! int intdata; ! int rc; ! /* void *optdata; */ ! ! rc = ldap_get_option(ld, LDAP_OPT_PROTOCOL_VERSION, &intdata); ! ! /* LDAP protocol version */ ! label = gtk_label_new(_("LDAP protocol version")); ! gtk_widget_show(label); ! gtk_table_attach(GTK_TABLE(table), ! label, ! 0, 1, row, row+1, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! 0, 0); ! ! snprintf(buf, sizeof(buf), "%d", intdata); ! e = gtk_entry_new(); ! gtk_entry_set_text(GTK_ENTRY(e), buf); ! gtk_widget_set_sensitive(e, FALSE); ! gtk_widget_show(e); ! gtk_table_attach(GTK_TABLE(table), ! e, ! 1, 2, row, row+1, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! GTK_EXPAND | GTK_SHRINK | GTK_FILL, ! 0, 0); ! ! row++; ! ! close_connection(entry->server, FALSE); ! } ! ! /* gtk_box_pack_start(GTK_BOX(pane2_vbox), label, FALSE, FALSE, 0); */ } } *************** *** 663,666 **** --- 859,879 ---- } + void tree_row_close_connection(GtkMenuItem *menuitem, + GHashTable *hash) + { + GtkCTree *ctree = g_hash_table_lookup(hash, "ctreeroot"); + GtkCTreeNode *node = g_hash_table_lookup(hash, "tree-row-popped-up"); + + struct ldapserver *server = server_from_node(ctree, node); + char msg[256]; + + close_connection(server, TRUE); + + snprintf(msg, sizeof(msg), _("Closed connection to server %s"), + server->name); + + statusbar_msg(msg); + } + void tree_row_expand_all(GtkMenuItem *menuitem, GHashTable *hash) *************** *** 999,1003 **** } ! show_dn(ctree, node, e->dn); --- 1212,1216 ---- } ! show_server_dn(ctree, server_from_node(ctree, node), e->dn, TRUE); *************** *** 1019,1032 **** } ! void show_server_dn(GtkCTree *tree, struct ldapserver *server, char *dn) { GtkCTreeNode *node = tree_node_from_server_dn(tree, server, ""); if (node) { gtk_ctree_expand(tree, node); ! show_dn(tree, node, dn); } } ! void show_dn(GtkCTree *tree, GtkCTreeNode *node, char *dn) { char **dnparts; --- 1232,1248 ---- } ! void show_server_dn(GtkCTree *tree, ! struct ldapserver *server, char *dn, ! gboolean select_node) { GtkCTreeNode *node = tree_node_from_server_dn(tree, server, ""); if (node) { gtk_ctree_expand(tree, node); ! show_dn(tree, node, dn, select_node); } } ! void show_dn(GtkCTree *tree, GtkCTreeNode *node, char *dn, ! gboolean select_node) { char **dnparts; *************** *** 1034,1037 **** --- 1250,1254 ---- GString *s; GtkCTreeNode *found = NULL; + char *attrs[] = { LDAP_NO_ATTRS, NULL }; if (!dn) return; *************** *** 1058,1073 **** it does, we add it to the tree by hand, as we probably cannot see it due to a size limit */ struct ldapserver *server = server_from_node(tree, node); LDAP *ld; ! if( (ld = open_connection(server)) != NULL) { LDAPMessage *res, *e; int rc = ldap_search_s(ld, s->str, LDAP_SCOPE_BASE, ! "(objectClass=*)", NULL, 0, &res); if (rc == LDAP_SUCCESS) { e = ldap_first_entry(ld, res); if (e) { /* have it!! */ ! found = dn_browse_single_add(ld, e, tree, node); node = found; } --- 1275,1294 ---- it does, we add it to the tree by hand, as we probably cannot see it due to a size limit */ + struct ldapserver *server = server_from_node(tree, node); LDAP *ld; ! if ((ld = open_connection(server)) != NULL) { LDAPMessage *res, *e; int rc = ldap_search_s(ld, s->str, LDAP_SCOPE_BASE, ! "(objectClass=*)", attrs, 0, &res); if (rc == LDAP_SUCCESS) { e = ldap_first_entry(ld, res); if (e) { /* have it!! */ ! char *dn = ldap_get_dn(ld, e); ! found = dn_browse_single_add(dn, tree, node); ! free(dn); ! node = found; } *************** *** 1087,1091 **** g_string_free(s, TRUE); ! if (found) { gtk_ctree_select(tree, found); gtk_ctree_node_moveto(tree, node, --- 1308,1312 ---- g_string_free(s, TRUE); ! if (found && select_node) { gtk_ctree_select(tree, found); gtk_ctree_node_moveto(tree, node, *************** *** 1548,1551 **** --- 1769,1782 ---- (gpointer) hash); #endif + + /* Close connection */ + menu_item = gtk_menu_item_new_with_label(_("Close Connection")); + gtk_menu_append(GTK_MENU(menu), menu_item); + gtk_widget_show(menu_item); + + gtk_signal_connect(GTK_OBJECT(menu_item), "activate", + GTK_SIGNAL_FUNC(tree_row_close_connection), + (gpointer) hash); + /* Export to LDIF */ Index: browse.h =================================================================== RCS file: /cvsroot/gqclient/gq/src/browse.h,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** browse.h 13 Jul 2002 16:53:41 -0000 1.20 --- browse.h 15 Jul 2002 18:44:03 -0000 1.21 *************** *** 141,146 **** GtkCTreeNode *node); ! void show_server_dn(GtkCTree *tree, struct ldapserver *server, char *dn); ! void show_dn(GtkCTree *tree, GtkCTreeNode *node, char *dn); GtkCTreeNode *node_from_dn(GtkCTree *ctreeroot, --- 141,149 ---- GtkCTreeNode *node); ! void show_server_dn(GtkCTree *tree, ! struct ldapserver *server, char *dn, ! gboolean select_node); ! void show_dn(GtkCTree *tree, GtkCTreeNode *node, char *dn, ! gboolean select_node); GtkCTreeNode *node_from_dn(GtkCTree *ctreeroot, Index: common.h =================================================================== RCS file: /cvsroot/gqclient/gq/src/common.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** common.h 12 Jul 2002 20:27:52 -0000 1.15 --- common.h 15 Jul 2002 18:44:03 -0000 1.16 *************** *** 85,88 **** --- 85,91 ---- LDAP *connection; + int incarnation; /* number of bind operations done so far, + never decremented - this is a purely + statistical number */ int missing_closes; /* incremented on every open_connection, decrementen on each close, close_connection Index: configfile.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/configfile.c,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** configfile.c 12 Jul 2002 20:27:52 -0000 1.24 --- configfile.c 15 Jul 2002 18:44:03 -0000 1.25 *************** *** 123,126 **** --- 123,127 ---- newserver = MALLOC(sizeof(struct ldapserver), "struct ldapserver"); + memset(newserver, 0, sizeof(struct ldapserver)); if(config.ldapservers) { *************** *** 763,766 **** --- 764,768 ---- /* ldapservers */ while(server) { + /* GString *pw = g_string_new(); */ config_write(wc, "<ldapserver>\n"); wc->indent++; *************** *** 772,775 **** --- 774,784 ---- config_write_string_ne(wc, server->binddn, "binddn"); config_write_string_ne(wc, server->bindpw, "bindpw"); + #if 0 + b64_encode(pw, server->bindpw, strlen(server->bindpw)); + config_write_string_ne(wc, pw->str, "bindpw"); + config_write_string_ne(wc, "Base64", "pw-encoding"); + g_string_free(pw); + #endif + if(server->bindtype != DEFAULT_BINDTYPE) config_write_string_ne(wc, detokenize(token_bindtype, server->bindtype), "bindtype"); *************** *** 870,873 **** --- 879,883 ---- server->show_ref = DEFAULT_SHOW_REF; server->connection = NULL; + server->incarnation = 0; server->missing_closes = 0; server->ss = NULL; Index: search.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/search.c,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** search.c 13 Jul 2002 16:53:41 -0000 1.23 --- search.c 15 Jul 2002 18:44:03 -0000 1.24 *************** *** 50,53 **** --- 50,54 ---- void find_in_browser(GHashTable *hash); + void add_all_to_browser(GHashTable *hash); static gboolean search_button_press_on_tree_item(GtkWidget *clist, *************** *** 680,683 **** --- 681,692 ---- gtk_widget_show(menu_item); + /* Add all to Browser */ + menu_item = gtk_menu_item_new_with_label(_("Add all to browser")); + gtk_menu_append(GTK_MENU(menu), menu_item); + gtk_signal_connect_object(GTK_OBJECT(menu_item), "activate", + GTK_SIGNAL_FUNC(add_all_to_browser), + (gpointer) hash); + gtk_widget_show(menu_item); + /* separator */ menu_item = gtk_menu_item_new(); *************** *** 719,726 **** if (browsehash) { ctree = g_hash_table_lookup(browsehash, "ctreeroot"); ! show_server_dn(ctree, server, set->dn); go_to_page(browsehash); } else { single_warning_popup(_("No browser available")); } } --- 728,772 ---- if (browsehash) { ctree = g_hash_table_lookup(browsehash, "ctreeroot"); ! show_server_dn(ctree, server, set->dn, TRUE); go_to_page(browsehash); } else { single_warning_popup(_("No browser available")); + } + } + + void add_all_to_browser(GHashTable *hash) + { + struct ldapserver *server; + struct resultset *set, *cur_resultset; + GHashTable *browsehash; + GtkCTree *ctree; + + set = g_hash_table_lookup(hash, "set"); + g_hash_table_remove(hash, "set"); + if(set == NULL || set->dn == NULL) + return; + + cur_resultset = g_hash_table_lookup(hash, "cur_resultset"); + if(cur_resultset != NULL) { + if( (server = g_hash_table_lookup(hash, + "cur_resultset_server")) == NULL) { + return; + } + + /* find last used browser... */ + + browsehash = get_last_of_mode(BROWSE_MODE); + ctree = g_hash_table_lookup(browsehash, "ctreeroot"); + if (browsehash) { + gtk_clist_freeze(GTK_CLIST(ctree)); + for (set = cur_resultset ; set ; set = set->next) { + gboolean select_node = (set->next == NULL); + show_server_dn(ctree, server, set->dn, select_node); + } + gtk_clist_thaw(GTK_CLIST(ctree)); + go_to_page(browsehash); + } else { + single_warning_popup(_("No browser available")); + } } } Index: util.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/util.c,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** util.c 12 Jul 2002 20:27:52 -0000 1.42 --- util.c 15 Jul 2002 18:44:03 -0000 1.43 *************** *** 44,47 **** --- 44,50 ---- #endif + #ifdef LDAP_OPT_NETWORK_TIMEOUT + #include <sys/time.h> + #endif #include "common.h" *************** *** 83,86 **** --- 86,93 ---- char *binddn = NULL, *bindpw = NULL; int rc = LDAP_SUCCESS; + int i; + #ifdef LDAP_OPT_NETWORK_TIMEOUT + struct timeval nettimeout; + #endif *ld_out = NULL; *************** *** 89,92 **** --- 96,108 ---- server->server_down = 0; + i = 30; + ldap_set_option(ld, LDAP_OPT_TIMELIMIT, &i); + + #ifdef LDAP_OPT_NETWORK_TIMEOUT + nettimeout.tv_sec = 15; + nettimeout.tv_usec = 0; + ldap_set_option(ld, LDAP_OPT_NETWORK_TIMEOUT, &nettimeout); + #endif + if(!ld) { snprintf(message, sizeof(message), *************** *** 210,215 **** ldap_unbind(ld); ld = NULL; ! } ! else { /* always store connection handle, regardless of connection caching -- call close_connection() after each operation --- 226,230 ---- ldap_unbind(ld); ld = NULL; ! } else { /* always store connection handle, regardless of connection caching -- call close_connection() after each operation *************** *** 217,220 **** --- 232,236 ---- server->connection = ld; server->missing_closes = 1; + server->incarnation++; } |
From: <sta...@us...> - 2002-07-15 18:36:54
|
Update of /cvsroot/gqclient/gq/src In directory usw-pr-cvs1:/tmp/cvs-serv18058/src Modified Files: browse-dnd.c debug.c debug.h encode.c errorchain.c errorchain.h gq.c mainwin.c Log Message: * New debugging code. Now there is a commandline option -d <flags> where flags is a bitmask to select various debugging information. The meaning of the bits is defined in src/debug.h. * Also introduced a way to get rid of all debugging related code by adding the --disable-debugging configure option. Index: browse-dnd.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/browse-dnd.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** browse-dnd.c 13 Jul 2002 07:06:32 -0000 1.7 --- browse-dnd.c 15 Jul 2002 18:36:51 -0000 1.8 *************** *** 27,31 **** /* $Id$ */ - /* #define DEBUG_DND */ /* typedef unsigned long ulong; */ --- 27,30 ---- *************** *** 46,49 **** --- 45,49 ---- #include "util.h" #include "i18n.h" + #include "debug.h" typedef struct _dnd_refresh { *************** *** 114,119 **** int answer; ! #ifdef DEBUG_DND ! printf("dropped %08lx at x=%d, y=%d\n", (ulong) drag_context, x, y); #endif --- 114,121 ---- int answer; ! #ifdef DEBUG ! if (debug & GQ_DEBUG_BROWSE_DND) { ! printf("dropped %08lx at x=%d, y=%d\n", (ulong) drag_context, x, y); ! } #endif *************** *** 299,306 **** ctree_node); ! #ifdef DEBUG_DND ! printf("drag_begin start node=%08lx entry=%08lx\n", ! (ulong) ctree_node, ! (ulong) entry); #endif --- 301,310 ---- ctree_node); ! #ifdef DEBUG ! if (debug & GQ_DEBUG_BROWSER_DND) { ! printf("drag_begin start node=%08lx entry=%08lx\n", ! (ulong) ctree_node, ! (ulong) entry); ! } #endif *************** *** 325,331 **** (GtkDestroyNotify) drag_and_select_data_free); ! #ifdef DEBUG_DND printf("drag_begin %08lx %08lx\n", (ulong) ctreeroot, (ulong) seldata); #endif } --- 329,337 ---- (GtkDestroyNotify) drag_and_select_data_free); ! #ifdef DEBUG ! if (debug & GQ_DEBUG_BROWSER_DND) { printf("drag_begin %08lx %08lx\n", (ulong) ctreeroot, (ulong) seldata); + } #endif } *************** *** 390,395 **** gpointer user_data) { ! #ifdef DEBUG_DND ! printf("drag_end %08lx\n", (ulong) drag_context); #endif /* kill any motion timer ... */ --- 396,403 ---- gpointer user_data) { ! #ifdef DEBUG ! if (debug & GQ_DEBUG_BROWSER_DND) { ! printf("drag_end %08lx\n", (ulong) drag_context); ! } #endif /* kill any motion timer ... */ *************** *** 440,446 **** g_byte_array_append(buf, &nul, 1); ! #ifdef DEBUG_DND ! printf("drag_data_get ctx=%08lx data=%08lx\n", (ulong) drag_context, ! (ulong) data); #endif --- 448,456 ---- g_byte_array_append(buf, &nul, 1); ! #ifdef DEBUG ! if (debug & GQ_DEBUG_BROWSER_DND) { ! printf("drag_data_get ctx=%08lx data=%08lx\n", (ulong) drag_context, ! (ulong) data); ! } #endif *************** *** 453,459 **** g_byte_array_free(buf, TRUE); ! #ifdef DEBUG_DND ! printf("data->data=%08lx data=%08lxx\n", ! (ulong)(data->data), (ulong) data); #endif } --- 463,471 ---- g_byte_array_free(buf, TRUE); ! #ifdef DEBUG ! if (debug & GQ_DEBUG_BROWSER_DND) { ! printf("data->data=%08lx data=%08lxx\n", ! (ulong)(data->data), (ulong) data); ! } #endif } *************** *** 497,502 **** value[n] = 0; ! #ifdef DEBUG_DND ! printf("key=%s value=%s\n", key, value); #endif g_hash_table_insert(selhash, key, value); --- 509,516 ---- value[n] = 0; ! #ifdef DEBUG ! if (debug & GQ_DEBUG_BROWSER_DND) { ! printf("key=%s value=%s\n", key, value); ! } #endif g_hash_table_insert(selhash, key, value); *************** *** 519,525 **** char *newdn = NULL; ! #ifdef DEBUG_DND ! printf("do_move_after_reception selhash=%08lx server=%s dn=%s\n", ! (ulong) selhash, (char*)g_hash_table_lookup(selhash, "nickname"), dn); #endif --- 533,542 ---- char *newdn = NULL; ! #ifdef DEBUG ! if (debug & GQ_DEBUG_BROWSER_DND) { ! printf("do_move_after_reception selhash=%08lx server=%s dn=%s\n", ! (ulong) selhash, ! (char*)g_hash_table_lookup(selhash, "nickname"), dn); ! } #endif *************** *** 597,605 **** ! #ifdef DEBUG_DND ! printf("moved %s below %s, became %s\n", ! dn, ! target_entry->dn, ! newdn); #endif g_free(newdn); --- 614,624 ---- ! #ifdef DEBUG ! if (debug & GQ_DEBUG_BROWSER_DND) { ! printf("moved %s below %s, became %s\n", ! dn, ! target_entry->dn, ! newdn); ! } #endif g_free(newdn); *************** *** 630,636 **** } ! #ifdef DEBUG_DND ! printf("drag_data_received ctx=%08lx seldata=%08lx\n", ! (ulong) drag_context, (ulong) data); #endif --- 649,657 ---- } ! #ifdef DEBUG ! if (debug & GQ_DEBUG_BROWSER_DND) { ! printf("drag_data_received ctx=%08lx seldata=%08lx\n", ! (ulong) drag_context, (ulong) data); ! } #endif *************** *** 679,684 **** } } ! #ifdef DEBUG_DND ! printf("dragged to %d/%d\n", x, y); #endif } --- 700,707 ---- } } ! #ifdef DEBUG ! if (debug & GQ_DEBUG_BROWSER_DND) { ! printf("dragged to %d/%d\n", x, y); ! } #endif } *************** *** 709,719 **** dn = g_hash_table_lookup(selhash, "dn"); ! #ifdef DEBUG_DND ! printf("drag_data_delete ctx=%08lx suggested=%d action=%d server=%s dn=%s\n", ! (ulong) drag_context, ! drag_context->suggested_action, ! drag_context->action, ! server, dn ! ); #endif --- 732,744 ---- dn = g_hash_table_lookup(selhash, "dn"); ! #ifdef DEBUG ! if (debug & GQ_DEBUG_BROWSER_DND) { ! printf("drag_data_delete ctx=%08lx suggested=%d action=%d server=%s dn=%s\n", ! (ulong) drag_context, ! drag_context->suggested_action, ! drag_context->action, ! server, dn ! ); ! } #endif *************** *** 734,739 **** } } ! #ifdef DEBUG_DND ! printf("drag_data_delete done\n"); #endif gtk_object_remove_data(GTK_OBJECT(widget), --- 759,766 ---- } } ! #ifdef DEBUG ! if (debug & GQ_DEBUG_BROWSER_DND) { ! printf("drag_data_delete done\n"); ! } #endif gtk_object_remove_data(GTK_OBJECT(widget), *************** *** 791,796 **** GDK_CURRENT_TIME); ! #ifdef DEBUG_DND ! printf("copy_entry %08lx %d\n", (ulong) ctree, have_sel); #endif } --- 818,825 ---- GDK_CURRENT_TIME); ! #ifdef DEBUG ! if (debug & GQ_DEBUG_BROWSER_DND) { ! printf("copy_entry %08lx %d\n", (ulong) ctree, have_sel); ! } #endif } *************** *** 810,815 **** g_hash_table_insert(selhash, g_strdup("recursively"), g_strdup("TRUE")); ! #ifdef DEBUG_DND ! printf("copy_entry_all %08lx\n", (ulong) widget); #endif } --- 839,846 ---- g_hash_table_insert(selhash, g_strdup("recursively"), g_strdup("TRUE")); ! #ifdef DEBUG ! if (debug & GQ_DEBUG_BROWSER_DND) { ! printf("copy_entry_all %08lx\n", (ulong) widget); ! } #endif } *************** *** 831,836 **** char *attrs[] = { "*", "+", NULL }; ! #ifdef DEBUG_DND ! printf("get_selection_string\n"); #endif --- 862,869 ---- char *attrs[] = { "*", "+", NULL }; ! #ifdef DEBUG ! if (debug & GQ_DEBUG_BROWSER_DND) { ! printf("get_selection_string\n"); ! } #endif *************** *** 891,896 **** g_byte_array_append(buf, &nul, 1); ! #ifdef DEBUG_DND ! printf("get_selection_gq data=%08lx\n", (ulong) data); #endif --- 924,931 ---- g_byte_array_append(buf, &nul, 1); ! #ifdef DEBUG ! if (debug & GQ_DEBUG_BROWSER_DND) { ! printf("get_selection_gq data=%08lx\n", (ulong) data); ! } #endif *************** *** 901,907 **** buf->len); ! #ifdef DEBUG_DND ! printf("data->data=%08lx data=%08lxx\n", ! (ulong)(data->data), (ulong) data); #endif --- 936,944 ---- buf->len); ! #ifdef DEBUG ! if (debug & GQ_DEBUG_BROWSER_DND) { ! printf("data->data=%08lx data=%08lxx\n", ! (ulong)(data->data), (ulong) data); ! } #endif *************** *** 931,936 **** GtkWidget *ctree = g_hash_table_lookup(hash, "ctreeroot"); ! #ifdef DEBUG_DND ! printf("paste_entry %08lx\n", (ulong) ctree); #endif gtk_selection_convert(ctree, --- 968,975 ---- GtkWidget *ctree = g_hash_table_lookup(hash, "ctreeroot"); ! #ifdef DEBUG ! if (debug & GQ_DEBUG_BROWSER_DND) { ! printf("paste_entry %08lx\n", (ulong) ctree); ! } #endif gtk_selection_convert(ctree, *************** *** 955,961 **** GHashTable *selhash = NULL; ! #ifdef DEBUG_DND ! printf("selection_received seldata=%08lx\n", ! (ulong) data); #endif --- 994,1002 ---- GHashTable *selhash = NULL; ! #ifdef DEBUG ! if (debug & GQ_DEBUG_BROWSER_DND) { ! printf("selection_received seldata=%08lx\n", ! (ulong) data); ! } #endif Index: debug.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/debug.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** debug.c 9 Jun 2002 15:24:20 -0000 1.4 --- debug.c 15 Jul 2002 18:36:51 -0000 1.5 *************** *** 32,48 **** int max_mallocs = 0; void *gq_malloc(size_t size, char *msg) { - void *newmem; ! newmem = malloc(size); ! printf("+ gq_malloc: %s (%d bytes @ 0x%x)\n", msg, size, ! (unsigned int) newmem); ! ! num_mallocs++; ! max_mallocs++; ! return(newmem); } --- 32,53 ---- int max_mallocs = 0; + #ifdef DEBUG + int debug = 0; + #endif void *gq_malloc(size_t size, char *msg) { void *newmem; ! newmem = malloc(size); ! #ifdef DEBUG ! if (debug & GQ_DEBUG_MALLOC) { ! printf("+ gq_malloc: %s (%d bytes @ 0x%x)\n", msg, size, ! (unsigned int) newmem); ! ! num_mallocs++; ! max_mallocs++; ! } ! #endif return(newmem); } *************** *** 51,60 **** void gq_free(void *mem, char *msg) { ! ! printf("- gq_free: %s (0x%x)\n", msg, (unsigned int) mem); ! num_mallocs--; ! free(mem); - } --- 56,66 ---- void gq_free(void *mem, char *msg) { ! #ifdef DEBUG ! if (debug & GQ_DEBUG_MALLOC) { ! printf("- gq_free: %s (0x%x)\n", msg, (unsigned int) mem); ! num_mallocs--; ! } ! #endif free(mem); } *************** *** 128,132 **** #endif ! #ifdef MEMDEBUG #ifdef HAVE_MALLINFO static int memstat_timeout_id = -1; --- 134,138 ---- #endif ! #ifdef DEBUG #ifdef HAVE_MALLINFO static int memstat_timeout_id = -1; *************** *** 154,156 **** } #endif /* HAVE_MALLINFO */ ! #endif /* MEMDEBUG */ --- 160,168 ---- } #endif /* HAVE_MALLINFO */ ! #endif /* DEBUG */ ! ! /* ! Local Variables: ! c-basic-offset: 5 ! End: ! */ Index: debug.h =================================================================== RCS file: /cvsroot/gqclient/gq/src/debug.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** debug.h 5 Jun 2002 15:49:49 -0000 1.3 --- debug.h 15 Jul 2002 18:36:51 -0000 1.4 *************** *** 32,35 **** --- 32,47 ---- #ifdef DEBUG + extern int debug; + + #define GQ_DEBUG_ERROR_LINE 1 + #define GQ_DEBUG_MALLOC 2 + #define GQ_DEBUG_MEM 4 + #define GQ_DEBUG_BROWSER_DND 8 + #define GQ_DEBUG_ENCODE 16 + + #endif + + #ifdef DEBUG + #define MALLOC(size, msg) gq_malloc(size, msg) #define FREE(mem, msg) gq_free(mem, msg) *************** *** 42,47 **** #endif ! ! #ifdef MEMDEBUG # ifdef HAVE_MALLINFO # include <malloc.h> --- 54,58 ---- #endif ! #ifdef DEBUG # ifdef HAVE_MALLINFO # include <malloc.h> *************** *** 51,55 **** # endif /* HAVE_MALLINFO */ ! #endif /* MEMDEBUG */ void *gq_malloc(size_t size, char *msg); --- 62,66 ---- # endif /* HAVE_MALLINFO */ ! #endif /* DEBUG */ void *gq_malloc(size_t size, char *msg); Index: encode.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/encode.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** encode.c 18 Jun 2002 22:02:17 -0000 1.18 --- encode.c 15 Jul 2002 18:36:51 -0000 1.19 *************** *** 46,49 **** --- 46,50 ---- #include "ldif.h" #include "encode.h" + #include "debug.h" char *gq_codeset = GQ_CODESET; *************** *** 83,90 **** #ifdef DEBUG ! fprintf(stderr, "decode_string \"%s\" (%d) -> \"%s\"\n", ! ldap_string, strlen(ldap_string), native_string); ! #endif /* DEBUG */ ! return native_string; } --- 84,92 ---- #ifdef DEBUG ! if (debug & GQ_DEBUG_ENCODE) { ! fprintf(stderr, "decode_string \"%s\" (%d) -> \"%s\"\n", ! ldap_string, strlen(ldap_string), native_string); ! } ! #endif return native_string; } *************** *** 125,131 **** #ifdef DEBUG ! fprintf(stderr, "encode_string \"%s\" -> \"%s\"\n", ! native_string, ldap_string); ! #endif /* DEBUG */ return ldap_string; --- 127,135 ---- #ifdef DEBUG ! if (debug & GQ_DEBUG_ENCODE) { ! fprintf(stderr, "encode_string \"%s\" -> \"%s\"\n", ! native_string, ldap_string); ! } ! #endif return ldap_string; Index: errorchain.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/errorchain.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** errorchain.c 27 Jun 2002 08:39:15 -0000 1.9 --- errorchain.c 15 Jul 2002 18:36:51 -0000 1.10 *************** *** 91,102 **** } ! #ifdef ERROR_SHOW_LINE void error_push_debug(int context, char *msg, char *file, int line) { ! int len = strlen(msg) + strlen(file) + 100; ! char *s = g_malloc(len); ! snprintf(s, len, "%s:%d %s", file, line, msg); ! error_push_production(context, s); ! g_free(s); } #endif --- 91,106 ---- } ! #ifdef DEBUG void error_push_debug(int context, char *msg, char *file, int line) { ! if (debug & GQ_DEBUG_ERROR_LINE) { ! int len = strlen(msg) + strlen(file) + 100; ! char *s = g_malloc(len); ! snprintf(s, len, "%s:%d %s", file, line, msg); ! error_push_production(context, s); ! g_free(s); ! } else { ! error_push_production(context, msg); ! } } #endif Index: errorchain.h =================================================================== RCS file: /cvsroot/gqclient/gq/src/errorchain.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** errorchain.h 27 Jun 2002 08:21:20 -0000 1.5 --- errorchain.h 15 Jul 2002 18:36:51 -0000 1.6 *************** *** 28,36 **** #include <ldap.h> /* LDAP */ int error_new_context(char *title); void error_push_production(int context, char *msg); ! #ifdef ERROR_SHOW_LINE void error_push_debug(int context, char *msg, char *file, int line); --- 28,37 ---- #include <ldap.h> /* LDAP */ + #include "config.h" int error_new_context(char *title); void error_push_production(int context, char *msg); ! #ifdef DEBUG void error_push_debug(int context, char *msg, char *file, int line); Index: gq.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/gq.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** gq.c 12 Jul 2002 20:27:52 -0000 1.12 --- gq.c 15 Jul 2002 18:36:51 -0000 1.13 *************** *** 22,37 **** */ #include <signal.h> ! #ifdef MEMDEBUG # include "debug.h" # ifdef HAVE_MCHECK # include <mcheck.h> # endif /* HAVE_MCHECK */ ! #endif /* MEMDEBUG */ ! ! #include <gtk/gtk.h> - #include <string.h> #include "gq.h" --- 22,39 ---- */ + #include <gtk/gtk.h> + #include <string.h> #include <signal.h> + #include <unistd.h> ! #include "config.h" ! ! #ifdef DEBUG # include "debug.h" # ifdef HAVE_MCHECK # include <mcheck.h> # endif /* HAVE_MCHECK */ ! #endif /* DEBUG */ #include "gq.h" *************** *** 41,44 **** --- 43,47 ---- #include "syntax.h" #include "encode.h" + #include "debug.h" GdkFont *big_fixed; *************** *** 47,55 **** int main(int argc, char *argv[]) { ! #ifdef MEMDEBUG # ifdef HAVE_MCHECK ! mcheck(NULL); # endif /* HAVE_MCHECK */ ! #endif /* MEMDEBUG */ #if ENABLE_NLS --- 50,61 ---- int main(int argc, char *argv[]) { ! int c; ! #ifdef DEBUG # ifdef HAVE_MCHECK ! if (debug & GQ_DEBUG_MEM) { ! mcheck(NULL); ! } # endif /* HAVE_MCHECK */ ! #endif /* DEBUG */ #if ENABLE_NLS *************** *** 82,85 **** --- 88,111 ---- gtk_init(&argc, &argv); + /* parse command line... */ + while ((c = getopt(argc, argv, "d:")) != EOF) { + switch (c) { + case 'd': { + #ifdef DEBUG + char *ep; + debug = strtoul(optarg, &ep, 0); + #else + fprintf(stderr, _("gq was build without debugging support\n")); + return 1; + #endif + break; + } + default: { + fprintf(stderr, _("Unknown option %c\n"), c); + return 2; + } + } + } + init_config(); *************** *** 91,99 **** g_log_set_always_fatal (G_LOG_LEVEL_CRITICAL); ! #ifdef MEMDEBUG # ifdef HAVE_MALLINFO ! init_memstat_timer(); # endif /* HAVE_MALLINFO */ ! #endif /* MEMDEBUG */ /* Avoids getting killed if an LDAP server we are connected to --- 117,127 ---- g_log_set_always_fatal (G_LOG_LEVEL_CRITICAL); ! #ifdef DEBUG # ifdef HAVE_MALLINFO ! if (debug & GQ_DEBUG_MEM) { ! init_memstat_timer(); ! } # endif /* HAVE_MALLINFO */ ! #endif /* DEBUG */ /* Avoids getting killed if an LDAP server we are connected to Index: mainwin.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/mainwin.c,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** mainwin.c 13 Jul 2002 16:53:41 -0000 1.25 --- mainwin.c 15 Jul 2002 18:36:51 -0000 1.26 *************** *** 156,162 **** #ifdef DEBUG ! report_num_mallocs(); #endif - } --- 156,163 ---- #ifdef DEBUG ! if (debug & GQ_DEBUG_MALLOC) { ! report_num_mallocs(); ! } #endif } |
From: <sta...@us...> - 2002-07-15 18:36:54
|
Update of /cvsroot/gqclient/gq In directory usw-pr-cvs1:/tmp/cvs-serv18058 Modified Files: configure.in acconfig.h Log Message: * New debugging code. Now there is a commandline option -d <flags> where flags is a bitmask to select various debugging information. The meaning of the bits is defined in src/debug.h. * Also introduced a way to get rid of all debugging related code by adding the --disable-debugging configure option. Index: configure.in =================================================================== RCS file: /cvsroot/gqclient/gq/configure.in,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** configure.in 13 Jul 2002 16:42:31 -0000 1.35 --- configure.in 15 Jul 2002 18:36:51 -0000 1.36 *************** *** 22,25 **** --- 22,36 ---- ) + DEBUG=1 + AC_ARG_ENABLE(debugging, + [ --disable-debugging Disables the -d commandline flag to set debug flags], + [ DEBUG= ] + ) + + if test "$DEBUG" = "1" ; then + AC_DEFINE(DEBUG) + fi + echo DEBUG=$DEBUG + AC_ARG_WITH(ldap-prefix, [ --with-ldap-prefix=PFX Prefix where LDAP libs and headers \ *************** *** 347,349 **** --- 358,361 ---- echo -n "OpenLDAP client-side caching... " ARG_YESNO($HAVE_OLCACHE) echo -n "Internationalization........... " ARG_YESNO($ENABLE_NLS) + echo -n "Debugging support ............. " ARG_YESNO($DEBUG) echo Index: acconfig.h =================================================================== RCS file: /cvsroot/gqclient/gq/acconfig.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** acconfig.h 18 Jun 2002 06:19:31 -0000 1.13 --- acconfig.h 15 Jul 2002 18:36:51 -0000 1.14 *************** *** 31,34 **** --- 31,38 ---- #undef HAVE_STPCPY + /* debugging */ + + #undef DEBUG + @BOTTOM@ |
From: <sta...@us...> - 2002-07-15 18:12:33
|
Update of /cvsroot/gqclient/gq/src In directory usw-pr-cvs1:/tmp/cvs-serv11050 Modified Files: input.c Log Message: * Added a test to deal with strange behaviour reported by <gw...@ac...>: When changing a dn where the rdn names an attribute value that does not exist in the object caused the object itself to be deleted. Now there is a test to check for the existence of the object to act accordingly. Index: input.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/input.c,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** input.c 13 Jul 2002 16:47:38 -0000 1.42 --- input.c 15 Jul 2002 18:12:30 -0000 1.43 *************** *** 1091,1098 **** LDAP *ld; struct ldapserver *server; ! int error, res, i; char *olddn, *dn; char **oldrdn, **rdn; char *c; server = g_hash_table_lookup(hash, "server"); --- 1091,1100 ---- LDAP *ld; struct ldapserver *server; ! int error, rc, i, remove_flag = 0; char *olddn, *dn; char **oldrdn, **rdn; char *c; + char *noattrs[] = { LDAP_NO_ATTRS, NULL }; + LDAPMessage *res; server = g_hash_table_lookup(hash, "server"); *************** *** 1130,1152 **** if (c) free(c); #if defined(HAVE_LDAP_RENAME) ! res = ldap_rename_s(ld, olddn, rdn[0], NULL, 1, NULL, NULL); #else ! res = ldap_modrdn2_s(ld, olddn, rdn[0], 1); #endif ! if(res == LDAP_SUCCESS) { /* get ready for subsequent DN changes */ g_free(olddn); g_hash_table_insert(hash, "olddn", g_strdup(dn)); } else { ! if (res == LDAP_SERVER_DOWN) { server->server_down++; } #if defined(HAVE_LDAP_RENAME) g_string_sprintf(message, "ldap_rename_s: %s", ! ldap_err2string(res)); #else g_string_sprintf(message, "ldap_modrdn2_s: %s", ! ldap_err2string(res)); #endif error_push(context, message->str); --- 1132,1172 ---- if (c) free(c); + /* check to see if the rdn exists as an attribute. If it + does set the remove flag. If it does not do not set the + remove flag. This is due to the fact that in the latter + case a set remove flag actually removes the object (at + least from openldap 2.0 servers. This strange behaviour + was pointed out by <gw...@ac...>. */ + + rc = ldap_search_s(ld, olddn, LDAP_SCOPE_BASE, + oldrdn[0], noattrs, 0, &res); + if (rc == LDAP_SUCCESS) { + LDAPMessage *e = ldap_first_entry(ld, res); + if (e) { + remove_flag = 1; + } + ldap_msgfree(res); + } + /* printf("oldrdn[0]=%s, remove=%d\n", oldrdn[0], remove_flag); */ + #if defined(HAVE_LDAP_RENAME) ! rc = ldap_rename_s(ld, olddn, rdn[0], NULL, remove_flag, NULL, NULL); #else ! rc = ldap_modrdn2_s(ld, olddn, rdn[0], remove_flag); #endif ! if(rc == LDAP_SUCCESS) { /* get ready for subsequent DN changes */ g_free(olddn); g_hash_table_insert(hash, "olddn", g_strdup(dn)); } else { ! if (rc == LDAP_SERVER_DOWN) { server->server_down++; } #if defined(HAVE_LDAP_RENAME) g_string_sprintf(message, "ldap_rename_s: %s", ! ldap_err2string(rc)); #else g_string_sprintf(message, "ldap_modrdn2_s: %s", ! ldap_err2string(rc)); #endif error_push(context, message->str); |