gqclient-commit Mailing List for GQ LDAP client (Page 15)
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-10-11 13:47:27
|
Update of /cvsroot/gqclient/gq/src In directory usw-pr-cvs1:/tmp/cvs-serv25108 Modified Files: browse.c Log Message: * Resurrected the "Show relative DN" config setting for browse mode Index: browse.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/browse.c,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** browse.c 27 Sep 2002 00:22:14 -0000 1.61 --- browse.c 11 Oct 2002 13:47:23 -0000 1.62 *************** *** 91,95 **** GtkCTreeNode *node) { ! char **exploded_dn = 0; char *labels[] = { NULL, NULL }; char *dummy[] = { "dummy", NULL }; --- 91,95 ---- GtkCTreeNode *node) { ! char **exploded_dn = NULL; char *labels[] = { NULL, NULL }; char *dummy[] = { "dummy", NULL }; *************** *** 100,116 **** 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]); - new_entry = (dn_browse_entry *) new_dn_browse_entry(dn); --- 100,119 ---- ctx = error_new_context(_("Exploding DN")); ! if (config.show_rdn_only) { ! /* 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]); ! } else { ! labels[0] = decoded_string(dn); } new_entry = (dn_browse_entry *) new_dn_browse_entry(dn); *************** *** 137,141 **** fail: if (labels[0]) free(labels[0]); ! gq_exploded_free(exploded_dn); error_flush(ctx); --- 140,144 ---- fail: if (labels[0]) free(labels[0]); ! if (exploded_dn) gq_exploded_free(exploded_dn); error_flush(ctx); *************** *** 1064,1068 **** g_hash_table_destroy(browsehash); } - void new_browsemode(GHashTable *hash) --- 1067,1070 ---- |
From: <sta...@us...> - 2002-10-11 13:45:09
|
Update of /cvsroot/gqclient/gq/src In directory usw-pr-cvs1:/tmp/cvs-serv24256 Modified Files: browse-dnd.c Log Message: * Changed ulong to unsigned long as some systems don't have ulong Index: browse-dnd.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/browse-dnd.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** browse-dnd.c 26 Sep 2002 19:00:19 -0000 1.10 --- browse-dnd.c 11 Oct 2002 13:45:02 -0000 1.11 *************** *** 116,120 **** #ifdef DEBUG if (debug & GQ_DEBUG_BROWSE_DND) { ! printf("dropped %08lx at x=%d, y=%d\n", (ulong) drag_context, x, y); } #endif --- 116,120 ---- #ifdef DEBUG if (debug & GQ_DEBUG_BROWSE_DND) { ! printf("dropped %08lx at x=%d, y=%d\n", (unsigned long) drag_context, x, y); } #endif *************** *** 304,309 **** if (debug & GQ_DEBUG_BROWSER_DND) { printf("drag_begin start node=%08lx entry=%08lx\n", ! (ulong) ctree_node, ! (ulong) entry); } #endif --- 304,309 ---- if (debug & GQ_DEBUG_BROWSER_DND) { printf("drag_begin start node=%08lx entry=%08lx\n", ! (unsigned long) ctree_node, ! (unsigned long) entry); } #endif *************** *** 331,336 **** #ifdef DEBUG if (debug & GQ_DEBUG_BROWSER_DND) { ! printf("drag_begin %08lx %08lx\n", (ulong) ctreeroot, ! (ulong) seldata); } #endif --- 331,336 ---- #ifdef DEBUG if (debug & GQ_DEBUG_BROWSER_DND) { ! printf("drag_begin %08lx %08lx\n", (unsigned long) ctreeroot, ! (unsigned long) seldata); } #endif *************** *** 398,402 **** #ifdef DEBUG if (debug & GQ_DEBUG_BROWSER_DND) { ! printf("drag_end %08lx\n", (ulong) drag_context); } #endif --- 398,402 ---- #ifdef DEBUG if (debug & GQ_DEBUG_BROWSER_DND) { ! printf("drag_end %08lx\n", (unsigned long) drag_context); } #endif *************** *** 450,455 **** #ifdef DEBUG if (debug & GQ_DEBUG_BROWSER_DND) { ! printf("drag_data_get ctx=%08lx data=%08lx\n", (ulong) drag_context, ! (ulong) data); } #endif --- 450,455 ---- #ifdef DEBUG if (debug & GQ_DEBUG_BROWSER_DND) { ! printf("drag_data_get ctx=%08lx data=%08lx\n", (unsigned long) drag_context, ! (unsigned long) data); } #endif *************** *** 466,470 **** if (debug & GQ_DEBUG_BROWSER_DND) { printf("data->data=%08lx data=%08lxx\n", ! (ulong)(data->data), (ulong) data); } #endif --- 466,470 ---- if (debug & GQ_DEBUG_BROWSER_DND) { printf("data->data=%08lx data=%08lxx\n", ! (unsigned long)(data->data), (unsigned long) data); } #endif *************** *** 536,540 **** 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); } --- 536,540 ---- if (debug & GQ_DEBUG_BROWSER_DND) { printf("do_move_after_reception selhash=%08lx server=%s dn=%s\n", ! (unsigned long) selhash, (char*)g_hash_table_lookup(selhash, "nickname"), dn); } *************** *** 652,656 **** if (debug & GQ_DEBUG_BROWSER_DND) { printf("drag_data_received ctx=%08lx seldata=%08lx\n", ! (ulong) drag_context, (ulong) data); } #endif --- 652,656 ---- if (debug & GQ_DEBUG_BROWSER_DND) { printf("drag_data_received ctx=%08lx seldata=%08lx\n", ! (unsigned long) drag_context, (unsigned long) data); } #endif *************** *** 735,739 **** 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, --- 735,739 ---- if (debug & GQ_DEBUG_BROWSER_DND) { printf("drag_data_delete ctx=%08lx suggested=%d action=%d server=%s dn=%s\n", ! (unsigned long) drag_context, drag_context->suggested_action, drag_context->action, *************** *** 820,824 **** #ifdef DEBUG if (debug & GQ_DEBUG_BROWSER_DND) { ! printf("copy_entry %08lx %d\n", (ulong) ctree, have_sel); } #endif --- 820,824 ---- #ifdef DEBUG if (debug & GQ_DEBUG_BROWSER_DND) { ! printf("copy_entry %08lx %d\n", (unsigned long) ctree, have_sel); } #endif *************** *** 841,845 **** #ifdef DEBUG if (debug & GQ_DEBUG_BROWSER_DND) { ! printf("copy_entry_all %08lx\n", (ulong) widget); } #endif --- 841,845 ---- #ifdef DEBUG if (debug & GQ_DEBUG_BROWSER_DND) { ! printf("copy_entry_all %08lx\n", (unsigned long) widget); } #endif *************** *** 938,942 **** #ifdef DEBUG if (debug & GQ_DEBUG_BROWSER_DND) { ! printf("get_selection_gq data=%08lx\n", (ulong) data); } #endif --- 938,942 ---- #ifdef DEBUG if (debug & GQ_DEBUG_BROWSER_DND) { ! printf("get_selection_gq data=%08lx\n", (unsigned long) data); } #endif *************** *** 951,955 **** if (debug & GQ_DEBUG_BROWSER_DND) { printf("data->data=%08lx data=%08lxx\n", ! (ulong)(data->data), (ulong) data); } #endif --- 951,955 ---- if (debug & GQ_DEBUG_BROWSER_DND) { printf("data->data=%08lx data=%08lxx\n", ! (unsigned long)(data->data), (unsigned long) data); } #endif *************** *** 982,986 **** #ifdef DEBUG if (debug & GQ_DEBUG_BROWSER_DND) { ! printf("paste_entry %08lx\n", (ulong) ctree); } #endif --- 982,986 ---- #ifdef DEBUG if (debug & GQ_DEBUG_BROWSER_DND) { ! printf("paste_entry %08lx\n", (unsigned long) ctree); } #endif *************** *** 1009,1013 **** if (debug & GQ_DEBUG_BROWSER_DND) { printf("selection_received seldata=%08lx\n", ! (ulong) data); } #endif --- 1009,1013 ---- if (debug & GQ_DEBUG_BROWSER_DND) { printf("selection_received seldata=%08lx\n", ! (unsigned long) data); } #endif |
From: <sta...@us...> - 2002-10-11 13:44:23
|
Update of /cvsroot/gqclient/gq/src In directory usw-pr-cvs1:/tmp/cvs-serv23977 Modified Files: Makefile.am Log Message: * Added i18n.c (implementation of S_) to the list of C-files Index: Makefile.am =================================================================== RCS file: /cvsroot/gqclient/gq/src/Makefile.am,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** Makefile.am 12 Jul 2002 20:22:15 -0000 1.22 --- Makefile.am 11 Oct 2002 13:44:19 -0000 1.23 *************** *** 39,43 **** ldapops.c \ tdefault.c \ ! browse-dnd.c noinst_HEADERS = \ --- 39,44 ---- ldapops.c \ tdefault.c \ ! browse-dnd.c \ ! i18n.c noinst_HEADERS = \ |
From: <sta...@us...> - 2002-10-11 13:43:45
|
Update of /cvsroot/gqclient/gq/po In directory usw-pr-cvs1:/tmp/cvs-serv23639 Modified Files: Makefile.in.in Log Message: * Added the additional keyword S_ (a gettext that allows for prefix-tags ending in '|') Index: Makefile.in.in =================================================================== RCS file: /cvsroot/gqclient/gq/po/Makefile.in.in,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Makefile.in.in 24 Apr 2002 05:17:13 -0000 1.1 --- Makefile.in.in 11 Oct 2002 13:43:41 -0000 1.2 *************** *** 84,88 **** $(srcdir)/$(PACKAGE).pot: $(POTFILES) $(srcdir)/POTFILES.in $(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(top_srcdir) \ ! --add-comments --keyword=_ --keyword=N_ \ --files-from=$(srcdir)/POTFILES.in \ && test ! -f $(PACKAGE).po \ --- 84,88 ---- $(srcdir)/$(PACKAGE).pot: $(POTFILES) $(srcdir)/POTFILES.in $(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(top_srcdir) \ ! --add-comments --keyword=_ --keyword=N_ --keyword=S_ \ --files-from=$(srcdir)/POTFILES.in \ && test ! -f $(PACKAGE).po \ |
From: <sta...@us...> - 2002-10-11 13:42:37
|
Update of /cvsroot/gqclient/gq In directory usw-pr-cvs1:/tmp/cvs-serv23061 Modified Files: acconfig.h acinclude.m4 configure.in Log Message: * Checks to find out if we should use the global timezone variable or tm_gmtoff of struct tm in dt_time.c Index: acconfig.h =================================================================== RCS file: /cvsroot/gqclient/gq/acconfig.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** acconfig.h 15 Jul 2002 18:36:51 -0000 1.14 --- acconfig.h 11 Oct 2002 13:42:30 -0000 1.15 *************** *** 23,26 **** --- 23,33 ---- #undef LOCALEDIR + /* Define if your struct tm has tm_gmtoff. */ + #undef HAVE_TM_GMTOFF + #undef TM_GMTOFF + + /* Define if you don't have tm_gmtoff but do have the external timezone. */ + #undef HAVE_TIMEZONE + /* gettext related */ Index: acinclude.m4 =================================================================== RCS file: /cvsroot/gqclient/gq/acinclude.m4,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** acinclude.m4 21 Apr 2002 19:50:37 -0000 1.1 --- acinclude.m4 11 Oct 2002 13:42:31 -0000 1.2 *************** *** 7,8 **** --- 7,76 ---- ]) + + + dnl idea taken from the autoconf mailing list, posted by + dnl Timur I. Bakeyev ti...@gn..., + dnl http://mail.gnu.org/pipermail/autoconf/1999-October/008311.html + dnl partly rewritten by Peter Stamfest <pe...@st...> + + dnl This determines, if struct tm containes tm_gmtoff field + dnl or we should use extern long int timezone. + + dnl Add the following to your acconfig.h: + + dnl /* Define if your struct tm has tm_gmtoff. */ + dnl #undef HAVE_TM_GMTOFF + dnl #undef TM_GMTOFF + dnl + dnl /* Define if you don't have tm_gmtoff but do have the external timezone. */ + dnl #undef HAVE_TIMEZONE + + AC_DEFUN(GC_TIMEZONE, + [AC_REQUIRE([AC_STRUCT_TM])dnl + + AC_CACHE_CHECK([tm_gmtoff in struct tm], gq_cv_have_tm_gmtoff, + gq_cv_have_tm_gmtoff=no + AC_TRY_COMPILE([#include <time.h> + #include <$ac_cv_struct_tm> + ], + [struct tm t; + t.tm_gmtoff = 0; + exit(0); + ], + gq_cv_have_tm_gmtoff=yes + ) + ) + + AC_CACHE_CHECK([__tm_gmtoff in struct tm], gq_cv_have___tm_gmtoff, + gq_cv_have___tm_gmtoff=no + AC_TRY_COMPILE([#include <time.h> + #include <$ac_cv_struct_tm> + ], + [struct tm t; + t.__tm_gmtoff = 0; + exit(0); + ], + gq_cv_have___tm_gmtoff=yes + ) + ) + + if test "$gq_cv_have_tm_gmtoff" = yes ; then + AC_DEFINE(HAVE_TM_GMTOFF) + AC_DEFINE(TM_GMTOFF, tm_gmtoff) + elif test "$gq_cv_have___tm_gmtoff" = yes ; then + AC_DEFINE(HAVE_TM_GMTOFF) + AC_DEFINE(TM_GMTOFF, __tm_gmtoff) + else + AC_CACHE_CHECK(for timezone, ac_cv_var_timezone, + [AC_TRY_LINK([ + #include <time.h> + extern long int timezone; + ], + [long int l = timezone;], + ac_cv_var_timezone=yes, + ac_cv_var_timezone=no)]) + if test $ac_cv_var_timezone = yes; then + AC_DEFINE(HAVE_TIMEZONE) + fi + fi + ]) Index: configure.in =================================================================== RCS file: /cvsroot/gqclient/gq/configure.in,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** configure.in 29 Sep 2002 18:58:43 -0000 1.40 --- configure.in 11 Oct 2002 13:42:31 -0000 1.41 *************** *** 4,8 **** AC_INIT(src/gq.c) ! AM_INIT_AUTOMAKE(gq, 0.7.0beta1) AM_CONFIG_HEADER(config.h) --- 4,12 ---- AC_INIT(src/gq.c) ! AM_INIT_AUTOMAKE(gq, 0.7.0beta2) ! ! LANGPACK_VERSION=0 ! AC_SUBST(LANGPACK_VERSION) ! AM_CONFIG_HEADER(config.h) *************** *** 137,142 **** AC_CHECK_HEADERS([sasl.h], [AC_DEFINE(HAVE_SASL)]) ! AC_CHECK_HEADERS(iconv.h, HAVE_ICONV_H=yes) if test "x$HAVE_ICONV_H" = "xyes"; then --- 141,147 ---- AC_CHECK_HEADERS([sasl.h], [AC_DEFINE(HAVE_SASL)]) ! GC_TIMEZONE() + AC_CHECK_HEADERS(iconv.h, HAVE_ICONV_H=yes) if test "x$HAVE_ICONV_H" = "xyes"; then *************** *** 271,275 **** dnl gettext support ! ALL_LINGUAS="de ja" AM_GNU_GETTEXT dnl AM_WITH_NLS(,need-ngettext) --- 276,281 ---- dnl gettext support ! ALL_LINGUAS="cs de ja" ! AM_GNU_GETTEXT dnl AM_WITH_NLS(,need-ngettext) *************** *** 328,346 **** require_included_gettext=$nls_cv_force_use_gnu_gettext ! if test "$require_included_gettext" = "no" ; then ! AC_CHECK_FUNCS(ngettext, , ! require_included_gettext=yes ! echo ... using included gettext implementation ) fi ! dnl implement --with-included-gettext ! dnl Is this "legal"? It definitely is ugly... there must be a better ! dnl way ! if test "$require_included_gettext" != "no" ; then LIBS="-L`pwd`/intl -lintl $LIBS" ! CFLAGS="$CFLAGS -I`pwd`/intl" ! fi fi --- 334,352 ---- require_included_gettext=$nls_cv_force_use_gnu_gettext ! if test "$require_included_gettext" = "no" ; then ! AC_CHECK_FUNCS(ngettext, , ! echo No ngettext implementation available in system gettext implementation ! echo Try to use the --with-included-gettext configure option or ! echo disable national language support using --disable-nls ! exit 1; ) fi ! dnl implement --with-included-gettext for compilation/linking ! if test "$require_included_gettext" = "yes" ; then LIBS="-L`pwd`/intl -lintl $LIBS" ! CFLAGS="-I`pwd`/intl $CFLAGS" ! fi fi |
From: <sta...@us...> - 2002-09-28 21:18:31
|
Update of /cvsroot/gqclient/gq/src In directory usw-pr-cvs1:/tmp/cvs-serv15309 Modified Files: util.c Log Message: * Fix compilation problem Index: util.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/util.c,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** util.c 28 Sep 2002 20:06:43 -0000 1.49 --- util.c 28 Sep 2002 21:18:28 -0000 1.50 *************** *** 58,61 **** --- 58,62 ---- #include "i18n.h" #include "mainwin.h" + #include "input.h" #include "../icons/warning.xpm" |
From: <sta...@us...> - 2002-09-28 20:15:10
|
Update of /cvsroot/gqclient/gq In directory usw-pr-cvs1:/tmp/cvs-serv30341 Modified Files: TODO Log Message: * Still so much to do, yet: * So much done Index: TODO =================================================================== RCS file: /cvsroot/gqclient/gq/TODO,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** TODO 15 Jul 2002 18:44:21 -0000 1.26 --- TODO 28 Sep 2002 20:15:07 -0000 1.27 *************** *** 6,10 **** * update browse/schemabrowse ctree on serverlist update - * first startup: deleting default localhost server segfaults * search mode: - change in server config should initialize searchbase combo, too --- 6,9 ---- *************** *** 47,62 **** follow it, maybe through the context menu? * take schema from entry (done?) ! * templates: allow defaults? * import from LDIF * Better keyboard support (at least for main menu) (peter) * [1.0] never do ldap_add when moving trees. Use triangulation like with the 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 --- 46,66 ---- follow it, maybe through the context menu? * take schema from entry (done?) ! * templates: allow defaults? ! ! * ability to limit visible attributes for objectclasses (do not show ! empty attributes one never uses anyway) (suggested by Chris Jackson ! <cja...@gh...>) - partly done ! ! * Allow to "apply" a template to an already existing object + add ! default values from template as well (suggested by Chris Jackson ! <cja...@gh...>) * import from LDIF * Better keyboard support (at least for main menu) (peter) * [1.0] never do ldap_add when moving trees. Use triangulation like with the towers of hanoi ! * [1.0] More displaytypes + PKCS7 and PKCS12 browsers + * [1.0] Rewrite drag-and-drop: - _only_ use ldap_modrdn when moving trees within one server. This *************** *** 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 --- 68,71 ---- *************** *** 75,82 **** --- 78,103 ---- FIXED BUGS / IMPLEMENTED ENHANCEMENTS + * [1.0] Support for the extensibleObject object class + + * first startup: deleting default localhost server segfaults (FIXED??) + + * [1.0] More displaytypes + + Most notably a calendar to enter dates and times + + * [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] LDAP URI support in addition to server/port [check patches by + "Árpád, Magosányi" <ma...@bu...> and + Albrecht Dreß <ad...@id...>] + * 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. + UPDATE (2002-09-25): Now we actually take information directly + from the root DSE * [1.0] Fix dt_password.c: handling of the construction of encoded passwords |
From: <sta...@us...> - 2002-09-28 20:14:33
|
Update of /cvsroot/gqclient/gq In directory usw-pr-cvs1:/tmp/cvs-serv30186 Modified Files: ChangeLog Log Message: * Documenting what I did recently Index: ChangeLog =================================================================== RCS file: /cvsroot/gqclient/gq/ChangeLog,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** ChangeLog 18 Sep 2002 07:27:28 -0000 1.34 --- ChangeLog 28 Sep 2002 20:14:28 -0000 1.35 *************** *** 1,2 **** --- 1,18 ---- + 2002-09-27 Peter Stamfest <pe...@st...> + * Support for the extensibleObject object class. + * "Beautified" some dialogs + 2002-09-27 Peter Stamfest <pe...@st...> + * Add tooltips (this is just the beginning) + * Implemented the ability to hide empty attributes from the object + browser. + 2002-09-26 Peter Stamfest <pe...@st...> + * Fixed a bug reported by Stephan Duehr <du...@b4...> in + connection with a Novell eDirectory server (entries would not be + displayed). + * Added two new icons/buttons to the browse window to show/hide empty + attributes + 2002-09-19 Peter Stamfest <pe...@st...> + * Finally implement the "Add as new" Button in the object viewer to + add the current content of the viewer as a new object. 2002-09-18 Peter Stamfest <pe...@st...> * Added code for proper support of singular/plural translations *************** *** 8,11 **** --- 24,32 ---- Hatuka*nezumi <ne...@jc...>. This also provoked the changes to the singular/plural stuff outlined above. + * Allow for LDAP URI support a la the patches by "Árpád, + Magosányi" <ma...@bu...> and Szalay Ferenc and + previously by Albrecht Dreß <ad...@id...> + lots of + UI improvements in this matter by me. Includes necessary + configure test. 2002-07-15 Peter Stamfest <pe...@st...> * Added a work around for strange behaviour reported by |
From: <sta...@us...> - 2002-09-28 20:10:17
|
Update of /cvsroot/gqclient/gq/src In directory usw-pr-cvs1:/tmp/cvs-serv28832 Modified Files: formfill.h input.c Log Message: * Support for the 'extensibleObject' object class. This introduces a new icon in the browse window. Selecting it opens a dialog to select an attribute to be added to the object. Index: formfill.h =================================================================== RCS file: /cvsroot/gqclient/gq/src/formfill.h,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** formfill.h 27 Sep 2002 00:22:14 -0000 1.22 --- formfill.h 28 Sep 2002 20:10:14 -0000 1.23 *************** *** 62,65 **** --- 62,67 ---- /* Used to suppress the "more" button for single valued attributes */ #define FLAG_SINGLE_VALUE 0x08 + /* Used to temporarily mark attributes added for extensibleObject entries */ + #define FLAG_EXTENSIBLE_OBJECT_ATTR 0x10 /* Used to disable widgets for attributes marked as no_user_mod */ Index: input.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/input.c,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** input.c 27 Sep 2002 00:22:14 -0000 1.49 --- input.c 28 Sep 2002 20:10:14 -0000 1.50 *************** *** 61,64 **** --- 61,65 ---- static void hide_empty_attributes(GtkToggleButton *button, gpointer hash); + static void create_new_attr(GtkButton *button, GHashTable *hash); void create_form_window(GHashTable *hash) *************** *** 107,111 **** target_vbox = g_hash_table_lookup(hash, "target_vbox"); ! hbox1 = gtk_hbox_new(FALSE, 5); gtk_widget_show(hbox1); gtk_box_pack_start(GTK_BOX(target_vbox), hbox1, FALSE, FALSE, 5); --- 108,112 ---- target_vbox = g_hash_table_lookup(hash, "target_vbox"); ! hbox1 = gtk_hbox_new(FALSE, 0); gtk_widget_show(hbox1); gtk_box_pack_start(GTK_BOX(target_vbox), hbox1, FALSE, FALSE, 5); *************** *** 184,192 **** gtk_container_add(GTK_CONTAINER(newattrbutton), pixmap); gtk_widget_show(newattrbutton); ! gtk_widget_set_sensitive(newattrbutton, 0); /* not implemented */ gtk_box_pack_end(GTK_BOX(hbox1), newattrbutton, FALSE, FALSE, 5); ! /* gtk_signal_connect(GTK_OBJECT(newattrbutton), "clicked", */ ! /* GTK_SIGNAL_FUNC(change_displaytype), */ ! /* (gpointer) hash); */ gtk_tooltips_set_tip(tips, newattrbutton, --- 185,194 ---- gtk_container_add(GTK_CONTAINER(newattrbutton), pixmap); gtk_widget_show(newattrbutton); ! gtk_box_pack_end(GTK_BOX(hbox1), newattrbutton, FALSE, FALSE, 5); ! ! gtk_signal_connect(GTK_OBJECT(newattrbutton), "clicked", ! GTK_SIGNAL_FUNC(create_new_attr), ! (gpointer) hash); gtk_tooltips_set_tip(tips, newattrbutton, *************** *** 494,499 **** GdkColor mustcol = { 0, 0x5c00, 0x3800, 0xffff }; GdkColor delcol = { 0, 0xd600, 0xa000, 0x0000 }; ! GtkStyle *not_in_schema, *must_in_schema, *del_schema; GtkWidget *target_table, *inputbox, *arrowbutton, *vbox; GtkWidget *widget = NULL, *align; --- 496,502 ---- GdkColor mustcol = { 0, 0x5c00, 0x3800, 0xffff }; GdkColor delcol = { 0, 0xd600, 0xa000, 0x0000 }; + GdkColor extensible_col = { 0, 0xffff, 0x0000, 0xffff }; ! GtkStyle *not_in_schema, *must_in_schema, *del_schema, *extensible_attr; GtkWidget *target_table, *inputbox, *arrowbutton, *vbox; GtkWidget *widget = NULL, *align; *************** *** 518,521 **** --- 521,528 ---- del_schema->fg[GTK_STATE_NORMAL] = delcol; + + extensible_attr = gtk_style_copy(gtk_widget_get_default_style()); + extensible_attr->fg[GTK_STATE_NORMAL] = extensible_col; + /* mind form->num_inputfields and len(GList * values) may not be the same -- if adding a field with an arrowbutton */ *************** *** 612,615 **** --- 619,624 ---- if(form->flags & FLAG_DEL_ME) gtk_widget_set_style(form->label, del_schema); + if(form->flags & FLAG_EXTENSIBLE_OBJECT_ATTR) + gtk_widget_set_style(form->label, extensible_attr); currcnt = form->widgetList ? g_list_length(form->widgetList) : 0; *************** *** 1789,1792 **** --- 1798,2064 ---- } + /* Datastructure used to communicate between the functions making up the + add attribute dialog */ + + typedef struct { + int breakloop; + int rc; + int destroyed; + gchar **outbuf; + GtkWidget *combo; + GList *entries; + } attr_dialog_comm; + + + /* The set of functions implementing the dialog for the new attribute + button for extensibleObjects */ + + static void attr_destroy(GtkWidget *window, attr_dialog_comm *comm) { + comm->breakloop = 1; + comm->destroyed = 1; + } + + static void attr_ok(GtkWidget *button, attr_dialog_comm *comm) { + *(comm->outbuf) = gtk_editable_get_chars(GTK_EDITABLE(GTK_COMBO(comm->combo)->entry), 0, -1); + + if (g_list_find_custom(comm->entries, + *(comm->outbuf), + (GCompareFunc) strcmp)) { + comm->breakloop = 1; + comm->rc = 1; + } else { + *(comm->outbuf) = NULL; + } + + } + + static void attr_cancel(GtkWidget *button, attr_dialog_comm *comm) { + comm->breakloop = 1; + comm->rc = 0; + } + + /* pops up a dialog to select an attribute type via a GtkCombo. This + functions waits for the data and puts it into outbuf. */ + + int attr_popup(const char *title, + struct ldapserver *server, + gchar **outbuf) + { + GtkWidget *window, *vbox0, *vbox1, *vbox2, *label, *button, *hbox0; + GtkWidget *f = gtk_grab_get_current(); + GList *gl; + struct server_schema *ss = get_schema(server); + + attr_dialog_comm comm = { 0, 0, 0, NULL }; + comm.outbuf = outbuf; + *outbuf = NULL; + + if (!ss) { + error_popup(_("Oops!"), + _("Server schema not available.")); + return 0; + } + + /* This is a BAD hack - it solves a problem with the query popup + dialog that locks up focus handling with all the + window-managers I have been able to test this with. Actually, + it should be sufficient to let go of the focus, but + hiding/showing seems to work... (as I do not know how to + release the focus in gtk) - Any gtk Hackers around? */ + if (f != NULL) { + gtk_widget_hide(f); + gtk_widget_show(f); + } + + window = gtk_dialog_new(); + /* gtk_container_border_width(GTK_CONTAINER(window), 0); */ + gtk_window_set_title(GTK_WINDOW(window), title); + gtk_window_set_policy(GTK_WINDOW(window), FALSE, FALSE, FALSE); + gtk_signal_connect(GTK_OBJECT(window), "destroy", + (GtkSignalFunc) attr_destroy, + (gpointer) &comm); + gtk_signal_connect_object(GTK_OBJECT(window), "key_press_event", + GTK_SIGNAL_FUNC(close_on_esc), + (gpointer) window); + + vbox0 = GTK_DIALOG(window)->vbox; + gtk_widget_show(vbox0); + + vbox1 = gtk_vbox_new(FALSE, 0); + gtk_widget_show(vbox1); + gtk_container_border_width(GTK_CONTAINER(vbox1), CONTAINER_BORDER_WIDTH); + gtk_box_pack_start(GTK_BOX(vbox0), vbox1, TRUE, TRUE, 0); + + label = gtk_label_new(title); + gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0); + gtk_widget_show(label); + gtk_box_pack_start(GTK_BOX(vbox1), label, TRUE, TRUE, 0); + + comm.combo = gtk_combo_new(); + gtk_combo_set_value_in_list(GTK_COMBO(comm.combo), TRUE, TRUE); + + comm.entries = NULL; + + for (gl = ss->at ; gl ; gl = gl->next) { + LDAPAttributeType *at = (LDAPAttributeType *) gl->data; + + if (at && at->at_names) { + int i; + for (i = 0 ; at->at_names[i] ; i++) { + comm.entries = g_list_append(comm.entries, at->at_names[i]); + } + } + } + + comm.entries = g_list_sort(comm.entries, (GCompareFunc) strcmp); + comm.entries = g_list_insert(comm.entries, "", 0); + + gtk_combo_set_popdown_strings(GTK_COMBO(comm.combo), + comm.entries); + + GTK_WIDGET_SET_FLAGS(comm.combo, GTK_CAN_FOCUS); + GTK_WIDGET_SET_FLAGS(comm.combo, GTK_CAN_DEFAULT); + + + gtk_widget_set_sensitive(GTK_COMBO(comm.combo)->entry, FALSE); + + gtk_widget_show(comm.combo); + gtk_box_pack_end(GTK_BOX(vbox1), comm.combo, TRUE, TRUE, 0); + + vbox2 = GTK_DIALOG(window)->action_area; + /* gtk_container_border_width(GTK_CONTAINER(vbox2), CONTAINER_BORDER_WIDTH); */ + gtk_widget_show(vbox2); + + hbox0 = gtk_hbutton_box_new(); + gtk_widget_show(hbox0); + gtk_box_pack_start(GTK_BOX(vbox2), hbox0, TRUE, TRUE, 0); + + button = gtk_button_new_with_label(_("OK")); + gtk_signal_connect(GTK_OBJECT(button), "clicked", + GTK_SIGNAL_FUNC(attr_ok), &comm); + gtk_box_pack_start(GTK_BOX(hbox0), button, FALSE, FALSE, 0); + GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); + GTK_WIDGET_SET_FLAGS(button, GTK_RECEIVES_DEFAULT); + gtk_widget_grab_default(button); + gtk_widget_show(button); + + button = gtk_button_new_with_label(_("Cancel")); + gtk_signal_connect(GTK_OBJECT(button), "clicked", + GTK_SIGNAL_FUNC(attr_cancel), + &comm); + + gtk_box_pack_end(GTK_BOX(hbox0), button, FALSE, FALSE, 0); + gtk_widget_show(button); + + /* gtk_window_set_transient_for(GTK_WINDOW(window), */ + /* GTK_WINDOW(getMainWin())); */ + + + gtk_widget_grab_focus(GTK_WIDGET(window)); + gtk_window_set_modal(GTK_WINDOW(window), TRUE); + + gtk_widget_show(window); + gtk_widget_grab_focus(comm.combo); + + while (!comm.breakloop) { + gtk_main_iteration(); + } + + if (!comm.destroyed) { + gtk_widget_destroy(window); + } + + if (comm.entries) g_list_free(comm.entries); + comm.entries = NULL; + + return comm.rc; + } + + /* Checks if the objectClass attribute contains "extensibleObject" */ + + int is_extensible_object(GHashTable *hash) + { + GList *f, *wl; + GList *formlist = g_hash_table_lookup(hash, "formlist"); + GtkWidget *w; + GByteArray *ndata = NULL; + + if (!formlist) return 0; + + for (f = formlist ; f ; f = f->next) { + struct formfill *form = (struct formfill *) f->data; + + if (strcasecmp(form->attrname, "objectClass") == 0) { + for (wl = form->widgetList ; wl ; wl = wl->next) { + w = GTK_WIDGET(wl->data); + + if (form->dt_handler && form->dt_handler->get_data) { + ndata = form->dt_handler->get_data(form, w); + + if (ndata) { + if (strncasecmp(ndata->data, + "extensibleObject", + ndata->len) == 0) { + + g_byte_array_free(ndata, TRUE); + return 1; + } + g_byte_array_free(ndata, TRUE); + } + } + } + } + } + + return 0; + } + + static void create_new_attr(GtkButton *button, GHashTable *hash) + { + char *outbuf; + struct ldapserver *server = g_hash_table_lookup(hash, "server"); + int rc; + + if (!is_extensible_object(hash)) { + error_popup(_("Oops!"), + _("Not an 'extensibleObject'")); + return; + } + + rc = attr_popup(_("Select name of new attribute"), + server, + &outbuf); + + if (rc && strlen(outbuf) > 0) { + GList *formlist = g_hash_table_lookup(hash, "formlist"); + LDAPAttributeType *at = find_canonical_at_by_at(get_schema(server), + outbuf); + + if (at) { + struct formfill *form = new_formfill(); + + if (form) { + form->server = server; + strncpy(form->attrname, outbuf, + MAX_ATTR_LEN); + form->flags |= FLAG_EXTENSIBLE_OBJECT_ATTR; + if (at->at_single_value) { + form->flags |= FLAG_SINGLE_VALUE; + } + set_displaytype(server, form); + formlist = formlist_append(formlist, form); + + g_hash_table_insert(hash, "formlist", formlist); + + build_or_update_inputform(hash, FALSE); + } else { + error_popup(_("Oops!"), + _("Not enough memory to make form.")); + } + } + } + + if (outbuf) g_free(outbuf); + } |
From: <sta...@us...> - 2002-09-28 20:06:46
|
Update of /cvsroot/gqclient/gq/src In directory usw-pr-cvs1:/tmp/cvs-serv28345 Modified Files: util.c Log Message: * Use symbolic border constant introduced recently Index: util.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/util.c,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** util.c 26 Sep 2002 18:57:54 -0000 1.48 --- util.c 28 Sep 2002 20:06:43 -0000 1.49 *************** *** 885,889 **** window = gtk_dialog_new(); ! gtk_container_border_width(GTK_CONTAINER(window), 12); gtk_window_set_title(GTK_WINDOW(window), _("Warning")); gtk_window_set_policy(GTK_WINDOW(window), FALSE, FALSE, FALSE); --- 885,889 ---- window = gtk_dialog_new(); ! gtk_container_border_width(GTK_CONTAINER(window), CONTAINER_BORDER_WIDTH); gtk_window_set_title(GTK_WINDOW(window), _("Warning")); gtk_window_set_policy(GTK_WINDOW(window), FALSE, FALSE, FALSE); *************** *** 1247,1251 **** window = gtk_dialog_new(); ! gtk_container_border_width(GTK_CONTAINER(window), 12); gtk_window_set_title(GTK_WINDOW(window), title); gtk_window_set_policy(GTK_WINDOW(window), FALSE, FALSE, FALSE); --- 1247,1251 ---- window = gtk_dialog_new(); ! gtk_container_border_width(GTK_CONTAINER(window), CONTAINER_BORDER_WIDTH); gtk_window_set_title(GTK_WINDOW(window), title); gtk_window_set_policy(GTK_WINDOW(window), FALSE, FALSE, FALSE); *************** *** 1275,1281 **** gtk_signal_connect(GTK_OBJECT(inputbox), "activate", GTK_SIGNAL_FUNC(query_ok), GTK_OBJECT(comm)); ! gtk_box_pack_start(GTK_BOX(vbox1), inputbox, TRUE, TRUE, 0); vbox2 = GTK_DIALOG(window)->action_area; gtk_widget_show(vbox2); --- 1275,1282 ---- gtk_signal_connect(GTK_OBJECT(inputbox), "activate", GTK_SIGNAL_FUNC(query_ok), GTK_OBJECT(comm)); ! gtk_box_pack_end(GTK_BOX(vbox1), inputbox, TRUE, TRUE, 5); vbox2 = GTK_DIALOG(window)->action_area; + gtk_container_border_width(GTK_CONTAINER(vbox2), 0); gtk_widget_show(vbox2); *************** *** 1357,1361 **** window = gtk_dialog_new(); ! gtk_container_border_width(GTK_CONTAINER(window), 12); gtk_window_set_title(GTK_WINDOW(window), title); gtk_window_set_policy(GTK_WINDOW(window), FALSE, FALSE, FALSE); --- 1358,1362 ---- window = gtk_dialog_new(); ! gtk_container_border_width(GTK_CONTAINER(window), CONTAINER_BORDER_WIDTH); gtk_window_set_title(GTK_WINDOW(window), title); gtk_window_set_policy(GTK_WINDOW(window), FALSE, FALSE, FALSE); |
From: <sta...@us...> - 2002-09-28 20:05:28
|
Update of /cvsroot/gqclient/gq/src In directory usw-pr-cvs1:/tmp/cvs-serv28068 Modified Files: input.h Log Message: * Symbolic constant for dialog borders, well... Index: input.h =================================================================== RCS file: /cvsroot/gqclient/gq/src/input.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** input.h 27 Sep 2002 00:22:15 -0000 1.8 --- input.h 28 Sep 2002 20:05:26 -0000 1.9 *************** *** 32,35 **** --- 32,36 ---- /* Maybe we will align attribute labels differently in the future.. */ #define LABEL_JUSTIFICATION 0.5 + #define CONTAINER_BORDER_WIDTH 8 void create_form_window(GHashTable *hash); |
From: <sta...@us...> - 2002-09-28 20:04:19
|
Update of /cvsroot/gqclient/gq/src In directory usw-pr-cvs1:/tmp/cvs-serv27793 Modified Files: errorchain.c Log Message: * Beautify the error dialog. This is seems to be a never-ending story... Index: errorchain.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/errorchain.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** errorchain.c 15 Jul 2002 18:36:51 -0000 1.10 --- errorchain.c 28 Sep 2002 20:04:14 -0000 1.11 *************** *** 34,37 **** --- 34,38 ---- #include "debug.h" #include "i18n.h" + #include "input.h" #include "../icons/bomb.xpm" *************** *** 188,192 **** GdkPixmap *bomb; GdkBitmap *bomb_mask; ! GtkWidget *pixmap, *popupwin, *vbox, *vbox1, *hbox0, *hbox, *vbox2, *msg_label, *okbutton; struct errchain *chain; struct errmsgs *cur_msg, *old_msg; --- 189,193 ---- GdkPixmap *bomb; GdkBitmap *bomb_mask; ! GtkWidget *pixmap, *popupwin, *vbox, *vbox1, *hbox0, *hbox, *vbox2, *msg_label, *okbutton, *align; struct errchain *chain; struct errmsgs *cur_msg, *old_msg; *************** *** 197,206 **** popupwin = gtk_dialog_new(); gtk_widget_realize(popupwin); - gtk_container_border_width(GTK_CONTAINER(popupwin), 12); gtk_window_set_title(GTK_WINDOW(popupwin), chain->title); gtk_window_set_policy(GTK_WINDOW(popupwin), FALSE, FALSE, FALSE); vbox1 = GTK_DIALOG(popupwin)->vbox; gtk_widget_show(vbox1); hbox = gtk_hbox_new(FALSE, 0); gtk_widget_show(hbox); gtk_box_pack_start(GTK_BOX(vbox1), hbox, FALSE, FALSE, 0); --- 198,210 ---- popupwin = gtk_dialog_new(); gtk_widget_realize(popupwin); gtk_window_set_title(GTK_WINDOW(popupwin), chain->title); gtk_window_set_policy(GTK_WINDOW(popupwin), FALSE, FALSE, FALSE); vbox1 = GTK_DIALOG(popupwin)->vbox; + gtk_widget_show(vbox1); hbox = gtk_hbox_new(FALSE, 0); + gtk_container_border_width(GTK_CONTAINER(hbox), + CONTAINER_BORDER_WIDTH); + gtk_widget_show(hbox); gtk_box_pack_start(GTK_BOX(vbox1), hbox, FALSE, FALSE, 0); *************** *** 213,220 **** gtk_box_pack_start(GTK_BOX(hbox), pixmap, TRUE, TRUE, 10); vbox = gtk_vbox_new(FALSE, 0); gtk_widget_show(vbox); ! gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0); ! /* show messages, freeing them as we go */ cur_msg = chain->msgs; --- 217,230 ---- gtk_box_pack_start(GTK_BOX(hbox), pixmap, TRUE, TRUE, 10); + /* align messages with the error icon. One-line messages + look better that way... */ + align = gtk_alignment_new(0.0, 0.5, 0.0, 0.0); + gtk_widget_show(align); + gtk_box_pack_start(GTK_BOX(hbox), align, FALSE, FALSE, 0); + vbox = gtk_vbox_new(FALSE, 0); gtk_widget_show(vbox); ! gtk_container_add(GTK_CONTAINER(align), vbox); ! /* show messages, freeing them as we go */ cur_msg = chain->msgs; *************** *** 222,226 **** msg_label = gtk_label_new(cur_msg->msg); gtk_label_set_justify(GTK_LABEL(msg_label), GTK_JUSTIFY_LEFT); ! gtk_misc_set_alignment(GTK_MISC(msg_label), 0, 0); gtk_widget_show(msg_label); gtk_box_pack_start(GTK_BOX(vbox), msg_label, FALSE, FALSE, 0); --- 232,236 ---- msg_label = gtk_label_new(cur_msg->msg); gtk_label_set_justify(GTK_LABEL(msg_label), GTK_JUSTIFY_LEFT); ! gtk_misc_set_alignment(GTK_MISC(msg_label), 0, 0.5); gtk_widget_show(msg_label); gtk_box_pack_start(GTK_BOX(vbox), msg_label, FALSE, FALSE, 0); *************** *** 235,238 **** --- 245,249 ---- hbox0 = gtk_hbutton_box_new(); + gtk_container_border_width(GTK_CONTAINER(hbox0), 0); gtk_box_pack_end(GTK_BOX(vbox2), hbox0, TRUE, FALSE, 0); gtk_widget_show(hbox0); |
From: <sta...@us...> - 2002-09-27 00:22:18
|
Update of /cvsroot/gqclient/gq/src In directory usw-pr-cvs1:/tmp/cvs-serv16012 Modified Files: browse.c formfill.c formfill.h input.c input.h prefs.c Log Message: * Add tooltips (this is just the beginning) * Implemented the ability to hide empty attributes from the object browser. * The browser "Add as new" button now is only available if the DN was changed Index: browse.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/browse.c,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** browse.c 26 Sep 2002 19:03:01 -0000 1.60 --- browse.c 27 Sep 2002 00:22:14 -0000 1.61 *************** *** 330,333 **** --- 330,334 ---- struct ldapserver *server; char *dn; + int hidden = 0; if (ctreenode == NULL) *************** *** 347,350 **** --- 348,354 ---- browsehash = g_hash_table_lookup(hash, "browsehash"); if (browsehash) { + /* but first get current hide status */ + hidden = (int) (g_hash_table_lookup(browsehash, "hide-status")); + browsehash_free(browsehash); g_hash_table_remove(hash, "browsehash"); *************** *** 357,360 **** --- 361,367 ---- g_hash_table_insert(browsehash, "server", server); g_hash_table_insert(browsehash, "edit", GINT_TO_POINTER(1)); + + /* pass on "hide" status */ + g_hash_table_insert(browsehash, "hide-status", GINT_TO_POINTER(hidden)); tmplist = NULL; Index: formfill.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/formfill.c,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** formfill.c 26 Sep 2002 19:05:20 -0000 1.31 --- formfill.c 27 Sep 2002 00:22:14 -0000 1.32 *************** *** 195,199 **** msg = ldap_search_s(ld, dn, LDAP_SCOPE_BASE, "(objectclass=*)", ! server->hide_internal ? attrs : NULL, 0, &res); if (msg == LDAP_SERVER_DOWN) { --- 195,199 ---- msg = ldap_search_s(ld, dn, LDAP_SCOPE_BASE, "(objectclass=*)", ! server->hide_internal ? NULL : attrs, 0, &res); if (msg == LDAP_SERVER_DOWN) { Index: formfill.h =================================================================== RCS file: /cvsroot/gqclient/gq/src/formfill.h,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** formfill.h 2 Aug 2002 06:11:55 -0000 1.21 --- formfill.h 27 Sep 2002 00:22:14 -0000 1.22 *************** *** 89,93 **** GList *values; struct syntax_handler *syntax; ! GtkWidget *event_box; GtkWidget *label; --- 89,93 ---- GList *values; struct syntax_handler *syntax; ! GtkWidget *event_box; GtkWidget *label; Index: input.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/input.c,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** input.c 26 Sep 2002 19:09:21 -0000 1.48 --- input.c 27 Sep 2002 00:22:14 -0000 1.49 *************** *** 59,62 **** --- 59,63 ---- static void add_entry_from_formlist_and_select(GHashTable *hash); static int add_entry_from_formlist_no_close(GHashTable *hash); + static void hide_empty_attributes(GtkToggleButton *button, gpointer hash); *************** *** 99,104 **** --- 100,108 ---- GtkWidget *pixmap; int detail_context; + GtkTooltips *tips; detail_context = error_new_context(_("Error getting entry")); + tips = gtk_tooltips_new(); + target_vbox = g_hash_table_lookup(hash, "target_vbox"); *************** *** 132,135 **** --- 136,145 ---- (gpointer) hash); + gtk_tooltips_set_tip(tips, linebutton, + _("Turn into one-line entry field"), + _("Changes the display type of the current " + "attribute into 'Entry', thus makes the input " + "field a one-line text box.")); + /* textarea button */ textareabutton = gtk_button_new(); *************** *** 152,157 **** --- 162,174 ---- (gpointer) hash); + gtk_tooltips_set_tip(tips, textareabutton, + _("Turn into multi-line entry field"), + _("Changes the display type of the current " + "attribute into 'Multi-line text', thus makes " + "the input field a multi-line text box.")); + /* new attribute button */ newattrbutton = gtk_button_new(); + gtk_object_set_data(GTK_OBJECT(newattrbutton), "transform", "make text"); GTK_WIDGET_UNSET_FLAGS(newattrbutton, GTK_CAN_FOCUS); *************** *** 167,170 **** --- 184,188 ---- gtk_container_add(GTK_CONTAINER(newattrbutton), pixmap); gtk_widget_show(newattrbutton); + gtk_widget_set_sensitive(newattrbutton, 0); /* not implemented */ gtk_box_pack_end(GTK_BOX(hbox1), newattrbutton, FALSE, FALSE, 5); /* gtk_signal_connect(GTK_OBJECT(newattrbutton), "clicked", */ *************** *** 172,177 **** /* (gpointer) hash); */ /* hide empty attributes button */ ! hideattrbutton = gtk_button_new(); gtk_object_set_data(GTK_OBJECT(hideattrbutton), "transform", "make text"); GTK_WIDGET_UNSET_FLAGS(hideattrbutton, GTK_CAN_FOCUS); --- 190,200 ---- /* (gpointer) hash); */ + gtk_tooltips_set_tip(tips, newattrbutton, + _("Adds an attribute to an object of class 'extensibleObject'"), + _("Adds an attribute to an object of class 'extensibleObject'")); + /* hide empty attributes button */ ! hideattrbutton = gtk_toggle_button_new(); ! gtk_object_set_data(GTK_OBJECT(hideattrbutton), "transform", "make text"); GTK_WIDGET_UNSET_FLAGS(hideattrbutton, GTK_CAN_FOCUS); *************** *** 188,195 **** gtk_widget_show(hideattrbutton); gtk_box_pack_end(GTK_BOX(hbox1), hideattrbutton, FALSE, FALSE, 0); ! /* gtk_signal_connect(GTK_OBJECT(hideattrbutton), "clicked", */ ! /* GTK_SIGNAL_FUNC(change_displaytype), */ ! /* (gpointer) hash); */ /* scrolled window with vbox2 inside */ --- 211,225 ---- gtk_widget_show(hideattrbutton); gtk_box_pack_end(GTK_BOX(hbox1), hideattrbutton, FALSE, FALSE, 0); ! gtk_signal_connect(GTK_OBJECT(hideattrbutton), "clicked", ! GTK_SIGNAL_FUNC(hide_empty_attributes), ! (gpointer) hash); + g_hash_table_insert(hash, "hide_attr_button", hideattrbutton); + + gtk_tooltips_set_tip(tips, hideattrbutton, + _("Hide/show empty attributes"), + _("Hides or shows all attributes without values. " + "This is a good way to see immediately what " + "attributes the object really has.")); /* scrolled window with vbox2 inside */ *************** *** 204,213 **** gtk_widget_show(vbox2); gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scwin), vbox2); g_hash_table_insert(hash, "vbox_holding_table", vbox2); - /* table inside vbox2, will self-expand */ table = gtk_table_new(3, 2, FALSE); gtk_container_border_width(GTK_CONTAINER(table), 5); ! gtk_table_set_row_spacings(GTK_TABLE(table), 1); gtk_table_set_col_spacings(GTK_TABLE(table), 10); gtk_widget_show(table); --- 234,244 ---- gtk_widget_show(vbox2); gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scwin), vbox2); + g_hash_table_insert(hash, "scwin", scwin); g_hash_table_insert(hash, "vbox_holding_table", vbox2); /* table inside vbox2, will self-expand */ table = gtk_table_new(3, 2, FALSE); gtk_container_border_width(GTK_CONTAINER(table), 5); ! /* gtk_table_set_row_spacings(GTK_TABLE(table), 1); */ ! gtk_table_set_row_spacings(GTK_TABLE(table), 0); gtk_table_set_col_spacings(GTK_TABLE(table), 10); gtk_widget_show(table); *************** *** 234,237 **** --- 265,269 ---- button = gtk_button_new_with_label(_("Add as new")); + gtk_widget_set_sensitive(button, FALSE); gtk_widget_show(button); gtk_box_pack_start(GTK_BOX(hbox2), button, FALSE, FALSE, 0); *************** *** 240,243 **** --- 272,276 ---- (gpointer) hash); GTK_WIDGET_UNSET_FLAGS(button, GTK_CAN_FOCUS); + g_hash_table_insert(hash, "add_as_new", button); button = gtk_button_new_with_label(_("Refresh")); *************** *** 443,446 **** --- 476,490 ---- } + static void dn_changed(GtkEditable *editable, + GHashTable *hash) + { + GtkWidget *w = g_hash_table_lookup(hash, "add_as_new"); + char *dn = g_hash_table_lookup(hash, "dn"); + char *val = gtk_editable_get_chars(editable, 0, -1); + if (w) { + gtk_widget_set_sensitive(w, strcmp(dn, val) != 0); + } + g_free(val); + } void build_or_update_inputform(GHashTable *hash, gboolean build) *************** *** 503,506 **** --- 547,555 ---- gtk_entry_set_text(GTK_ENTRY(inputbox), decode_string(value, dn, strlen(dn))); + + gtk_signal_connect(GTK_OBJECT(inputbox), "changed", + GTK_SIGNAL_FUNC(dn_changed), + (gpointer) hash); + g_hash_table_insert(hash, "dn-widget", inputbox); *************** *** 646,649 **** --- 695,701 ---- gtk_style_unref(del_schema); + /* restore the hide-status from a previous LDAP object... */ + set_hide_empty_attributes((int) g_hash_table_lookup(hash, "hide-status"), + hash); } *************** *** 1656,1659 **** --- 1708,1793 ---- } + + static void do_hide_empty_attributes(int hidden, gpointer hash) + { + GList *formlist = g_hash_table_lookup(hash, "formlist"); + GList *children; + GtkWidget *child; + + struct formfill *form; + int i = 0; + int displaytype; + int hideme; + + for ( ; formlist ; formlist = formlist->next ) { + form = (struct formfill *) formlist->data; + hideme = 1; + i++; + + displaytype = form->displaytype; + + for (children = form->widgetList ; children ; + children = children->next) { + child = GTK_WIDGET(children->data); + + if (hidden) { + if (form && displaytype) { + GByteArray *ndata = NULL; + + if (form->dt_handler && form->dt_handler->get_data) { + ndata = form->dt_handler->get_data(form, child); + } + /* don't bother adding in empty fields */ + if (ndata) { + hideme = 0; + g_byte_array_free(ndata, 1); + } + } + } else { + if (child) gtk_widget_show(child); + } + } + + if (hidden && hideme) { + if (form->event_box) gtk_widget_hide(form->event_box); + if (form->label) gtk_widget_hide(form->label); + if (form->vbox) gtk_widget_hide(form->vbox); + if (form->morebutton) gtk_widget_hide(form->morebutton); + for (children = form->widgetList ; children ; + children = children->next) { + child = GTK_WIDGET(children->data); + if (child) gtk_widget_hide(child); + } + } else { + if (form->event_box) gtk_widget_show(form->event_box); + if (form->label) gtk_widget_show(form->label); + if (form->vbox) gtk_widget_show(form->vbox); + if (form->morebutton) gtk_widget_show(form->morebutton); + } + } + + gtk_container_queue_resize(GTK_CONTAINER(g_hash_table_lookup(hash, "scwin"))); + + } + + static void hide_empty_attributes(GtkToggleButton *button, gpointer hash) + { + int hidden = gtk_toggle_button_get_active(button); + do_hide_empty_attributes(hidden, hash); + /* store hide status is hash, to be able to keep this info for + the next LDAP object to be shown in this browser */ + + g_hash_table_insert(hash, "hide-status", GINT_TO_POINTER(hidden)); + } + + void set_hide_empty_attributes(int hidden, gpointer hash) + { + GtkWidget *button = g_hash_table_lookup(hash, "hide_attr_button"); + if (button) { + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), hidden); + } + } + + /* Index: input.h =================================================================== RCS file: /cvsroot/gqclient/gq/src/input.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** input.h 10 Aug 2002 06:06:38 -0000 1.7 --- input.h 27 Sep 2002 00:22:15 -0000 1.8 *************** *** 52,55 **** --- 52,56 ---- GtkWidget *find_focusbox(GList *formlist); void change_displaytype(GtkWidget *button, gpointer hash); + void set_hide_empty_attributes(int hidden, gpointer hash); #endif Index: prefs.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/prefs.c,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** prefs.c 26 Sep 2002 19:55:58 -0000 1.27 --- prefs.c 27 Sep 2002 00:22:15 -0000 1.28 *************** *** 314,317 **** --- 314,320 ---- GtkWidget *bindtype; GList *bindtypes; + GtkTooltips *tips; + + tips = gtk_tooltips_new(); if(current_edit_server_window) *************** *** 385,388 **** --- 388,396 ---- gtk_widget_grab_focus(entry); + gtk_tooltips_set_tip(tips, entry, + _("The nickname of the server definition"), + _("The nickname is used to refer to this server " + "definition throughout this application")); + /* LDAP host */ label = gtk_label_new(_("LDAP Host/URI")); *************** *** 401,404 **** --- 409,419 ---- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + gtk_tooltips_set_tip(tips, entry, + _("The host name or LDAP URI of the LDAP server"), + _("Either use the name or IP address of the server " + "or an LDAP URI (either ldap or ldaps). An URI " + "is recognized through the existance of a colon " + "in this field")); + /* Port */ label = gtk_label_new(_("LDAP Port")); *************** *** 422,425 **** --- 437,445 ---- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + gtk_tooltips_set_tip(tips, entry, + _("The port the LDAP server listens on"), + _("If empty, the well-known LDAP port (389) is " + "assumed. This field is not available if an LDAP " + "URI is used.")); /* Callback on HOST to enable/disable port if user enters a colon... */ *************** *** 447,450 **** --- 467,475 ---- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + gtk_tooltips_set_tip(tips, entry, + _("The base DN of the server"), + _("This base DN gets used in search mode, usually " + "though, this application queries the server " + "for its 'namingContexts'")); /* "Details" tab */ *************** *** 493,496 **** --- 518,526 ---- y++; + gtk_tooltips_set_tip(tips, entry, + _("The DN to bind with to the LDAP server"), + _("This is equivalent to a 'username'. Ask the " + "LDAP administrator for the DN to use.")); + /* Bind Password */ label = gtk_label_new(_("Bind Password")); *************** *** 514,517 **** --- 544,558 ---- y++; + gtk_tooltips_set_tip(tips, entry, + _("The password to bind with to the LDAP server"), + _("This is related to the bind DN. Note that the " + "password gets stored in a configuration file. " + "Recent versions of this application actually " + "scramble the password, but this scrambling can " + "easily be reverted. Do not use a valuable " + "password here.")); + + + /* Bind Password (again)*/ label = gtk_label_new(_("Bind Password (again)")); *************** *** 535,538 **** --- 576,583 ---- y++; + gtk_tooltips_set_tip(tips, entry, + _("The password to bind with to the LDAP server (again)"), + _("")); + /* Bind type */ label = gtk_label_new(_("Bind type")); *************** *** 564,567 **** --- 609,617 ---- y++; + gtk_tooltips_set_tip(tips, GTK_WIDGET(GTK_COMBO(bindtype)->entry), + _("How to bind to the LDAP server"), + _("gq supports several different bind types, " + "like Simple, Kerberos or SASL binds.")); + /* Search attribute */ label = gtk_label_new(_("Search Attribute")); *************** *** 581,584 **** --- 631,640 ---- y++; + gtk_tooltips_set_tip(tips, entry, + _("The attribute to 'search' in a search tab."), + _("Search mode in the search tab searches this " + "attribute. This alleviates the user to always " + "use a proper LDAP filter.")); + /* Maximum entries */ label = gtk_label_new(_("Maximum entries")); *************** *** 599,602 **** --- 655,662 ---- y++; + gtk_tooltips_set_tip(tips, entry, + _("The maximum number of entries to return in search mode."), + _("NOTE: A server might impose stricter limits")); + #if HAVE_LDAP_CLIENT_CACHE /* Use local cache */ *************** *** 617,620 **** --- 677,685 ---- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); y++; + + gtk_tooltips_set_tip(tips, entry, + _("Should the OpenLDAP client-side cache be used? And what is its timeout? Anything greater than -1 turns on the cache."), + _("Using this might speed up LDAP operations, but " + "it may also lead to slightly out-of-date data.")); #endif *************** *** 636,639 **** --- 701,709 ---- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + gtk_tooltips_set_tip(tips, button, + _("Should the application ask for a bind password?"), + _("This disables the password entered via the " + "preferences dialog. ")); + /* Hide internal attributes */ button = gtk_check_button_new_with_label(_("Hide internal attributes")); *************** *** 646,649 **** --- 716,724 ---- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); z++; + gtk_tooltips_set_tip(tips, button, + _("Do not show attributes internal to the LDAP server"), + _("At least OpenLDAP allows to view several " + "interesting attributes. Setting this option " + "turns them off.")); /* Cache connections */ *************** *** 657,660 **** --- 732,743 ---- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + gtk_tooltips_set_tip(tips, button, + _("If set: Do not close the connection between LDAP operations"), + _("Setting this may speed up LDAP operations, as " + "it does not require the overhead to open a new " + "connection to the server for every operation. " + "OTOH it might put additional stress on the " + "server (depends on what you call 'stress')")); + /* Show ref */ button = gtk_check_button_new_with_label(_("Show referrals")); *************** *** 668,671 **** --- 751,759 ---- z++; + + gtk_tooltips_set_tip(tips, button, + _("Try to show LDAP references."), + _("")); + /* Enable TLS */ button = gtk_check_button_new_with_label(_("Enable TLS")); *************** *** 678,681 **** --- 766,773 ---- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); z++; + + gtk_tooltips_set_tip(tips, button, + _("Should we use Transport Layer Security?"), + _("Almost but not quite entirely SSL.")); /* OK and Cancel buttons */ |
From: <sta...@us...> - 2002-09-26 19:56:03
|
Update of /cvsroot/gqclient/gq/src In directory usw-pr-cvs1:/tmp/cvs-serv29839 Modified Files: prefs.c Log Message: * Fixed a tiny, tiny bug causing compilation to fail if the client cache is enabled. Index: prefs.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/prefs.c,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** prefs.c 18 Sep 2002 09:49:24 -0000 1.26 --- prefs.c 26 Sep 2002 19:55:58 -0000 1.27 *************** *** 65,69 **** char *ep = NULL; #if HAVE_LDAP_CLIENT_CACHE - char *ep; int tmp; #endif --- 65,68 ---- |
From: <sta...@us...> - 2002-09-26 19:18:16
|
Update of /cvsroot/gqclient/gq/icons In directory usw-pr-cvs1:/tmp/cvs-serv17813 Modified Files: Makefile.am Added Files: hide.xpm new.xpm Log Message: * The xpm source for the new icons --- NEW FILE: hide.xpm --- /* XPM */ static char * hide_xpm[] = { "20 15 5 1", " c None", ". c #000000", "+ c #FFFF00", "@ c #FFFFFF", "# c #808080", " ", " ...... ", " ........ ", " .+@+@+@. #### ", " .@+@+@+. ", " ........ #### ", " ", " ...... ", " ", " #### ", " ", " #### ", " ", " ...... ", " "}; --- NEW FILE: new.xpm --- /* XPM */ static char * new_xpm[] = { "20 15 6 1", ". c None", "+ c #808080", "@ c #FFFFFF", "# c #FFFF00", "$ c #000000", "% c #C0C0C0", ".....+@.............", "..#..+#..+..........", "..+#.+@.+#..........", "...+#+#+#...........", "..@#+#@++++$$$$$$...", "..+++@+@#@#@#@#@$+..", "...+@+#+#@##@#@#$+..", "..+##+@#+#@@#@#@$+..", "..@$@+#@#@##@#@#$+..", "...$#@#@#@#@$$$$$+..", "...$@#@#@#@#$#%$$+..", "...$#@#@#@#@$%$@$+..", "...$@#@#@#@#$$@#$+..", "...$$$$$$$$$$$$$$+..", "....++++++++++++++.."}; Index: Makefile.am =================================================================== RCS file: /cvsroot/gqclient/gq/icons/Makefile.am,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Makefile.am 3 May 2000 19:52:52 -0000 1.4 --- Makefile.am 26 Sep 2002 19:18:11 -0000 1.5 *************** *** 5,8 **** --- 5,10 ---- line.xpm \ logo.xpm \ + new.xpm \ + hide.xpm \ textarea.xpm \ warning.xpm |
From: <sta...@us...> - 2002-09-26 19:09:26
|
Update of /cvsroot/gqclient/gq/src In directory usw-pr-cvs1:/tmp/cvs-serv15404 Modified Files: input.c Log Message: * Added two new icons to the right half of the browse tree. They are not operational yet, but are intended to switch on/off value-less attributes. * Fixed the "Add as new" button in the browse window. Index: input.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/input.c,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** input.c 18 Sep 2002 09:46:54 -0000 1.47 --- input.c 26 Sep 2002 19:09:21 -0000 1.48 *************** *** 51,54 **** --- 51,56 ---- #include "../icons/line.xpm" #include "../icons/textarea.xpm" + #include "../icons/new.xpm" + #include "../icons/hide.xpm" void refresh_inputform(GHashTable *browsehash); *************** *** 93,96 **** --- 95,99 ---- GtkWidget *target_vbox, *vbox2, *hbox1, *hbox2; GtkWidget *button, *linebutton, *textareabutton; + GtkWidget *newattrbutton, *hideattrbutton; GtkWidget *scwin, *table; GtkWidget *pixmap; *************** *** 149,152 **** --- 152,196 ---- (gpointer) hash); + /* new attribute button */ + newattrbutton = gtk_button_new(); + gtk_object_set_data(GTK_OBJECT(newattrbutton), "transform", "make text"); + GTK_WIDGET_UNSET_FLAGS(newattrbutton, GTK_CAN_FOCUS); + icon = gdk_pixmap_create_from_xpm_d(GTK_WIDGET(target_vbox)->window, + &icon_mask, + &target_vbox->style->white, + new_xpm); + pixmap = gtk_pixmap_new(icon, icon_mask); + gdk_pixmap_unref(icon); + gdk_bitmap_unref(icon_mask); + + gtk_widget_show(pixmap); + gtk_container_add(GTK_CONTAINER(newattrbutton), pixmap); + gtk_widget_show(newattrbutton); + gtk_box_pack_end(GTK_BOX(hbox1), newattrbutton, FALSE, FALSE, 5); + /* gtk_signal_connect(GTK_OBJECT(newattrbutton), "clicked", */ + /* GTK_SIGNAL_FUNC(change_displaytype), */ + /* (gpointer) hash); */ + + /* hide empty attributes button */ + hideattrbutton = gtk_button_new(); + gtk_object_set_data(GTK_OBJECT(hideattrbutton), "transform", "make text"); + GTK_WIDGET_UNSET_FLAGS(hideattrbutton, GTK_CAN_FOCUS); + icon = gdk_pixmap_create_from_xpm_d(GTK_WIDGET(target_vbox)->window, + &icon_mask, + &target_vbox->style->white, + hide_xpm); + pixmap = gtk_pixmap_new(icon, icon_mask); + gdk_pixmap_unref(icon); + gdk_bitmap_unref(icon_mask); + + gtk_widget_show(pixmap); + gtk_container_add(GTK_CONTAINER(hideattrbutton), pixmap); + gtk_widget_show(hideattrbutton); + gtk_box_pack_end(GTK_BOX(hbox1), hideattrbutton, FALSE, FALSE, 0); + /* gtk_signal_connect(GTK_OBJECT(hideattrbutton), "clicked", */ + /* GTK_SIGNAL_FUNC(change_displaytype), */ + /* (gpointer) hash); */ + + /* scrolled window with vbox2 inside */ scwin = gtk_scrolled_window_new(NULL, NULL); *************** *** 754,757 **** --- 798,813 ---- + char *get_new_dn(GHashTable *hash) + { + GtkWidget *child = g_hash_table_lookup(hash, "dn-widget"); + if (child) { + char *content = gtk_editable_get_chars(GTK_EDITABLE(child), 0, -1); + char *content_enc = encoded_string(content); + g_free(content); + return content_enc; + } + return NULL; + } + /* * update formlist from on-screen table *************** *** 875,888 **** 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); ! } } } --- 931,942 ---- static void add_entry_from_formlist_and_select(GHashTable *hash) { + char *dn = get_new_dn(hash); + GtkCTree *tree = g_hash_table_lookup(hash, "ctreeroot"); int rc = add_entry_from_formlist_no_close(hash); ! ! if (rc && dn && tree) { ! show_dn(tree, NULL, dn, TRUE); } + if (dn) free(dn); } |
From: <sta...@us...> - 2002-09-26 19:05:24
|
Update of /cvsroot/gqclient/gq/src In directory usw-pr-cvs1:/tmp/cvs-serv14393 Modified Files: formfill.c Log Message: * Fix a bug with Novell eDirectory servers reported by Stephan Duehr <du...@b4...>. That server does not understand the question for the "+" attributes (OpenLDAP's LDAP_ALL_OPERATIONAL_ATTRIBUTES). This totally broke the displaying of entries from such servers. * cosmetic changes Index: formfill.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/formfill.c,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** formfill.c 13 Jul 2002 16:47:38 -0000 1.30 --- formfill.c 26 Sep 2002 19:05:20 -0000 1.31 *************** *** 174,178 **** struct berval **bervals; char *c = NULL; ! char *attrs[] = { "+", "*", NULL }; formlist = NULL; --- 174,180 ---- struct berval **bervals; char *c = NULL; ! char *attrs[] = { LDAP_ALL_USER_ATTRIBUTES, ! LDAP_ALL_OPERATIONAL_ATTRIBUTES, ! NULL }; formlist = NULL; *************** *** 193,202 **** msg = ldap_search_s(ld, dn, LDAP_SCOPE_BASE, "(objectclass=*)", ! attrs, 0, &res); ! if (msg == LDAP_SERVER_DOWN) { server->server_down++; } ! if(msg != LDAP_SUCCESS) { statusbar_msg(ldap_err2string(msg)); --- 195,204 ---- msg = ldap_search_s(ld, dn, LDAP_SCOPE_BASE, "(objectclass=*)", ! server->hide_internal ? attrs : NULL, 0, &res); ! if (msg == LDAP_SERVER_DOWN) { server->server_down++; } ! if(msg != LDAP_SUCCESS) { statusbar_msg(ldap_err2string(msg)); *************** *** 205,216 **** return(NULL); } ! if (res) { entry = ldap_first_entry(ld, res); if(entry) { char *c; for(attr = ldap_first_attribute(ld, entry, &ber); attr ; attr = ldap_next_attribute(ld, entry, ber)) { - /* filter out some internal attributes... */ --- 207,218 ---- return(NULL); } ! if (res) { entry = ldap_first_entry(ld, res); if(entry) { char *c; + for(attr = ldap_first_attribute(ld, entry, &ber); attr ; attr = ldap_next_attribute(ld, entry, ber)) { /* filter out some internal attributes... */ |
From: <sta...@us...> - 2002-09-26 19:03:08
|
Update of /cvsroot/gqclient/gq/src In directory usw-pr-cvs1:/tmp/cvs-serv13767 Modified Files: browse.c Log Message: * Add information taken from the root DSE into the details for a server entry in the browse tree. This should finally close a TODO item introduced by Bert * Back out changes to search for user AND operational attributes, because + it is an openldap extension (?) [but works for other servers as well] + operational attributes should not be part of a selection anyway Index: browse.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/browse.c,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** browse.c 18 Sep 2002 07:29:10 -0000 1.59 --- browse.c 26 Sep 2002 19:03:01 -0000 1.60 *************** *** 708,711 **** --- 708,724 ---- int rc; /* void *optdata; */ + char *rootDSEattr[] = { + "vendorName", _("Vendor Name"), /* RFC 3045 */ + "vendorVersion", _("Vendor Version"), /* RFC 3045 */ + "altServer", _("Alternative Server(s)"), /* RFC 2251 */ + "supportedLDAPVersion", _("Supported LDAP Version"), /* RFC 2251 */ + "supportedSASLMechanisms", _("Supported SASL Mechanisms"), /* RFC 2251 */ + NULL + }; + LDAPMessage *res, *ee; + BerElement *berptr; + char *attr; + char **vals; + int i, msg; rc = ldap_get_option(ld, LDAP_OPT_PROTOCOL_VERSION, &intdata); *************** *** 735,738 **** --- 748,820 ---- row++; + /* read some Information from the root DSE */ + for (i = 0 ; rootDSEattr[i] && ld != NULL ; i += 2) { + char *attrs[2] = { rootDSEattr[i], NULL }; + + msg = ldap_search_s(ld, "", LDAP_SCOPE_BASE, "(objectclass=*)", + attrs, 0, &res); + if(msg != LDAP_SUCCESS) { + if (msg == LDAP_SERVER_DOWN) { + close_connection(entry->server, FALSE); + ld = open_connection(entry->server); + } + statusbar_msg(ldap_err2string(msg)); + } else { + if(res == NULL) continue; + ee = ldap_first_entry(ld, res); + + if (ee == NULL) { + ldap_msgfree(res); + continue; + } + attr = ldap_first_attribute(ld, res, &berptr); + + if (attr == NULL) { + ldap_msgfree(res); + #ifndef HAVE_OPENLDAP_12 + if(berptr) ber_free(berptr, 0); + #endif + continue; + } + vals = ldap_get_values(ld, res, attr); + if (vals) { + int j; + for (j = 0 ; vals[j] ; j++) ; + + label = gtk_label_new(rootDSEattr[i + 1]); + gtk_widget_show(label); + gtk_table_attach(GTK_TABLE(table), + label, + 0, 1, row, row+j, + GTK_SHRINK, + GTK_EXPAND | GTK_SHRINK | GTK_FILL, + 0, 0); + + for (j = 0 ; vals[j] ; j++) { + snprintf(buf, sizeof(buf), "%s", vals[j]); + 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++; + } + + + ldap_value_free(vals); + } + + ldap_memfree(attr); + #ifndef HAVE_OPENLDAP_12 + if(berptr) ber_free(berptr, 0); + #endif + ldap_msgfree(res); + } + } close_connection(entry->server, FALSE); } *************** *** 1471,1475 **** int written; char message[512]; - char *attrs[] = { "*", "+", NULL }; int ctx; --- 1553,1556 ---- *************** *** 1539,1543 **** msg = ldap_search_s(ld, (char *) I->data, LDAP_SCOPE_SUBTREE, ! "(objectclass=*)", attrs, 0, &res); if(msg == LDAP_SUCCESS) { for(e = ldap_first_entry(ld, res); e; e = ldap_next_entry(ld, e)) { --- 1620,1624 ---- msg = ldap_search_s(ld, (char *) I->data, LDAP_SCOPE_SUBTREE, ! "(objectclass=*)", NULL, 0, &res); if(msg == LDAP_SUCCESS) { for(e = ldap_first_entry(ld, res); e; e = ldap_next_entry(ld, e)) { |
From: <sta...@us...> - 2002-09-26 19:00:25
|
Update of /cvsroot/gqclient/gq/src In directory usw-pr-cvs1:/tmp/cvs-serv12840 Modified Files: browse-dnd.c Log Message: * Back out changes to search for user AND operational attributes, because + it is an openldap extension (?) [but works for other servers as well] + operational attributes should not be part of a selection anyway Index: browse-dnd.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/browse-dnd.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** browse-dnd.c 2 Aug 2002 06:08:00 -0000 1.9 --- browse-dnd.c 26 Sep 2002 19:00:19 -0000 1.10 *************** *** 860,864 **** GString *out = NULL; gboolean ok = FALSE; - char *attrs[] = { "*", "+", NULL }; int ctx = error_new_context(_("Getting selection string")); --- 860,863 ---- *************** *** 876,880 **** rc = ldap_search_s(ld, dn, g_hash_table_lookup(selhash, "recursively") ? LDAP_SCOPE_SUBTREE : LDAP_SCOPE_BASE, ! "objectClass=*", attrs, 0, &msg); if (rc == LDAP_SERVER_DOWN) { --- 875,879 ---- rc = ldap_search_s(ld, dn, g_hash_table_lookup(selhash, "recursively") ? LDAP_SCOPE_SUBTREE : LDAP_SCOPE_BASE, ! "objectClass=*", NULL, 0, &msg); if (rc == LDAP_SERVER_DOWN) { |
From: <sta...@us...> - 2002-09-26 18:57:57
|
Update of /cvsroot/gqclient/gq/src In directory usw-pr-cvs1:/tmp/cvs-serv11826 Modified Files: syntax.c util.c Log Message: * Some more provisions against dereferencing NULL pointers Index: syntax.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/syntax.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** syntax.c 9 Jul 2002 10:43:38 -0000 1.13 --- syntax.c 26 Sep 2002 18:57:54 -0000 1.14 *************** *** 619,623 **** if (mod->mod_bvalues[cval] == NULL) { struct berval **b; ! for (b = mod->mod_bvalues ; *b ; b++) { free(*b); } --- 619,623 ---- if (mod->mod_bvalues[cval] == NULL) { struct berval **b; ! for (b = mod->mod_bvalues ; b && *b ; b++) { free(*b); } Index: util.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/util.c,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** util.c 18 Sep 2002 09:49:23 -0000 1.47 --- util.c 26 Sep 2002 18:57:54 -0000 1.48 *************** *** 1503,1507 **** vals = ldap_get_values(ld, e, "database"); if (vals) { ! for (valptr = vals; *valptr; valptr++) { char *p = *valptr; --- 1503,1507 ---- vals = ldap_get_values(ld, e, "database"); if (vals) { ! for (valptr = vals; valptr && *valptr; valptr++) { char *p = *valptr; |
From: <sta...@us...> - 2002-09-18 20:05:13
|
Update of /cvsroot/gqclient/gq/src In directory usw-pr-cvs1:/tmp/cvs-serv7913 Modified Files: configfile.c Log Message: * Fixed a nasty bug that caused encoded secrets to be decoded incorrectly. Index: configfile.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/configfile.c,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** configfile.c 18 Sep 2002 09:42:13 -0000 1.27 --- configfile.c 18 Sep 2002 20:05:09 -0000 1.28 *************** *** 616,620 **** 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, --- 616,620 ---- memset(s->bindpw, 0, sizeof(s->bindpw)); ! strncpy(s->bindpw, o->data, MIN(o->len, sizeof(s->bindpw) - 1)); } else if (s->bindpw[0] && s->pwencoding[0]) { error_push(f->err_context, |
From: <sta...@us...> - 2002-09-18 09:49:26
|
Update of /cvsroot/gqclient/gq/src In directory usw-pr-cvs1:/tmp/cvs-serv4619/src Modified Files: util.c common.h configfile.h prefs.c Log Message: * Allow for ldap/ldaps URIs instead of an LDAP Host/Port combination * Add some timeout options to the LDAP connection Index: util.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/util.c,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** util.c 18 Sep 2002 07:22:04 -0000 1.46 --- util.c 18 Sep 2002 09:49:23 -0000 1.47 *************** *** 93,107 **** *ld_out = NULL; ! ld = ldap_init(server->ldaphost, server->ldapport); ! 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) { --- 93,111 ---- *ld_out = NULL; ! if (strchr(server->ldaphost, ':') != NULL) { ! #ifdef HAVE_LDAP_INITIALIZE ! rc = ldap_initialize(&ld, server->ldaphost); ! if (rc != LDAP_SUCCESS) { ! ld = NULL; ! } ! #else ! ld = NULL; ! snprintf(message, sizeof(message), ! _("Sorry. No URI support available. Your LDAP toolkit does not support LDAP URIs.")); ! error_push(open_context, message); #endif + } else { + ld = ldap_init(server->ldaphost, server->ldapport); + } if(!ld) { *************** *** 111,115 **** --- 115,130 ---- } else { + server->server_down = 0; server->version = LDAP_VERSION2; + + /* setup timeouts */ + i = DEFAULT_LDAP_TIMEOUT; + ldap_set_option(ld, LDAP_OPT_TIMELIMIT, &i); + + #ifdef LDAP_OPT_NETWORK_TIMEOUT + nettimeout.tv_sec = DEFAULT_NETWORK_TIMEOUT; + nettimeout.tv_usec = 0; + ldap_set_option(ld, LDAP_OPT_NETWORK_TIMEOUT, &nettimeout); + #endif #ifndef HAVE_OPENLDAP12 Index: common.h =================================================================== RCS file: /cvsroot/gqclient/gq/src/common.h,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** common.h 2 Aug 2002 06:10:11 -0000 1.18 --- common.h 18 Sep 2002 09:49:24 -0000 1.19 *************** *** 33,37 **** #define MAX_SERVERNAME_LEN 64 ! #define MAX_HOSTNAME_LEN 64 #define MAX_NUM_ATTRIBUTES 256 --- 33,37 ---- #define MAX_SERVERNAME_LEN 64 ! #define MAX_HOSTNAME_LEN 1024 #define MAX_NUM_ATTRIBUTES 256 Index: configfile.h =================================================================== RCS file: /cvsroot/gqclient/gq/src/configfile.h,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** configfile.h 23 Jul 2002 13:50:06 -0000 1.17 --- configfile.h 18 Sep 2002 09:49:24 -0000 1.18 *************** *** 115,118 **** --- 115,125 ---- #define DEFAULT_SHOW_REF 0 + /* The following do not _really_ belong in here right now... */ + /* LDAP Timeout in seconds */ + #define DEFAULT_LDAP_TIMEOUT 30 + + #ifdef LDAP_OPT_NETWORK_TIMEOUT + #define DEFAULT_NETWORK_TIMEOUT 15 + #endif enum searchtype { ST_SEARCH, *************** *** 200,204 **** int config_get_bool(struct configfile *f); void init_ldapserver(struct ldapserver *server); ! char *filename_config(int context); void load_config(void); void config_write(struct writeconfig *wc, char *string); --- 207,215 ---- int config_get_bool(struct configfile *f); void init_ldapserver(struct ldapserver *server); ! ! /* filename_config returns the name of the config file. The returned ! pointer must g_free'd. */ ! gchar *filename_config(int context); ! void load_config(void); void config_write(struct writeconfig *wc, char *string); Index: prefs.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/prefs.c,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** prefs.c 23 Jul 2002 13:50:06 -0000 1.25 --- prefs.c 18 Sep 2002 09:49:24 -0000 1.26 *************** *** 63,66 **** --- 63,67 ---- char *text, *passwdtext, *passwdtext2; gboolean passwdmatch; + char *ep = NULL; #if HAVE_LDAP_CLIENT_CACHE char *ep; *************** *** 138,142 **** field = get_widget(window, "ldapport"); text = gtk_entry_get_text(GTK_ENTRY(field)); ! server->ldapport = atoi(text); /* Base DN */ --- 139,153 ---- field = get_widget(window, "ldapport"); text = gtk_entry_get_text(GTK_ENTRY(field)); ! ep = NULL; ! server->ldapport = strtol(text, &ep, 10); ! if (ep && *ep) { ! if (*text) { ! single_warning_popup(_("Port must be numeric or empty")); ! return; ! } else { ! /* empty, might have LDAP URI */ ! server->ldapport = -1; ! } ! } /* Base DN */ *************** *** 161,165 **** field = get_widget(window, "maxentries"); text = gtk_entry_get_text(GTK_ENTRY(field)); ! server->maxentries = atoi(text); /* Ask password */ --- 172,185 ---- field = get_widget(window, "maxentries"); text = gtk_entry_get_text(GTK_ENTRY(field)); ! ep = NULL; ! server->maxentries = strtol(text, &ep, 10); ! if (ep && *ep) { ! if (*text) { ! single_warning_popup(_("Maximum number of entries must be numeric or empty")); ! } else { ! /* empty, might have LDAP URI */ ! server->maxentries = 0; ! } ! } /* Ask password */ *************** *** 214,217 **** --- 234,247 ---- } + void host_changed_callback(GtkEditable *host, GtkWidget *port) + { + gchar *s = gtk_editable_get_chars(host, 0, -1); + + if (s) { + gtk_widget_set_sensitive(GTK_WIDGET(port), + (strchr(s, ':') == NULL)); + g_free(s); + } + } void destroy_edit_server_window(GtkWidget *this, gpointer data) *************** *** 279,283 **** GtkWidget *label, *entry, *button; GtkWidget *okbutton, *cancelbutton; ! GtkWidget *bindpw, *bindpw2; int y, z, editing_new_server; char title[MAX_SERVERNAME_LEN + 8]; --- 309,313 ---- GtkWidget *label, *entry, *button; GtkWidget *okbutton, *cancelbutton; ! GtkWidget *bindpw, *bindpw2, *host; int y, z, editing_new_server; char title[MAX_SERVERNAME_LEN + 8]; *************** *** 357,361 **** /* LDAP host */ ! label = gtk_label_new(_("LDAP host")); gtk_misc_set_alignment(GTK_MISC(label), 0.0, .5); gtk_widget_show(label); --- 387,391 ---- /* LDAP host */ ! label = gtk_label_new(_("LDAP Host/URI")); gtk_misc_set_alignment(GTK_MISC(label), 0.0, .5); gtk_widget_show(label); *************** *** 363,367 **** GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); ! entry = gtk_entry_new(); gtk_object_set_data(GTK_OBJECT(editwindow), "ldaphost", entry); gtk_entry_set_text(GTK_ENTRY(entry), server->ldaphost); --- 393,397 ---- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); ! host = entry = gtk_entry_new(); gtk_object_set_data(GTK_OBJECT(editwindow), "ldaphost", entry); gtk_entry_set_text(GTK_ENTRY(entry), server->ldaphost); *************** *** 381,385 **** entry = gtk_entry_new(); gtk_object_set_data(GTK_OBJECT(editwindow), "ldapport", entry); ! snprintf(tmp, sizeof(tmp), "%d", server->ldapport); gtk_entry_set_text(GTK_ENTRY(entry), tmp); gtk_widget_show(entry); --- 411,419 ---- entry = gtk_entry_new(); gtk_object_set_data(GTK_OBJECT(editwindow), "ldapport", entry); ! if (server->ldapport != 0) { ! snprintf(tmp, sizeof(tmp), "%d", server->ldapport); ! } else { ! *tmp = 0; ! } gtk_entry_set_text(GTK_ENTRY(entry), tmp); gtk_widget_show(entry); *************** *** 388,391 **** --- 422,434 ---- gtk_table_attach(GTK_TABLE(table1), entry, 1, 2, 2, 3, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + + + /* Callback on HOST to enable/disable port if user enters a colon... */ + + gtk_signal_connect(GTK_OBJECT(host), "changed", + GTK_SIGNAL_FUNC(host_changed_callback), entry); + gtk_editable_changed(GTK_EDITABLE(host)); /* use callback to set + selectable state of + port entry */ /* Base DN */ |
From: <sta...@us...> - 2002-09-18 09:49:26
|
Update of /cvsroot/gqclient/gq In directory usw-pr-cvs1:/tmp/cvs-serv4619 Modified Files: configure.in Log Message: * Allow for ldap/ldaps URIs instead of an LDAP Host/Port combination * Add some timeout options to the LDAP connection Index: configure.in =================================================================== RCS file: /cvsroot/gqclient/gq/configure.in,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** configure.in 18 Sep 2002 07:22:04 -0000 1.37 --- configure.in 18 Sep 2002 09:49:23 -0000 1.38 *************** *** 124,127 **** --- 124,128 ---- AC_CHECK_FUNCS(ldap_str2objectclass ldap_memfree ldap_rename ldap_str2dn \ + ldap_initialize \ iswspace snprintf) |
From: <sta...@us...> - 2002-09-18 09:46:57
|
Update of /cvsroot/gqclient/gq/src In directory usw-pr-cvs1:/tmp/cvs-serv4052 Modified Files: input.c Log Message: * This should change the behaviour of the New | Use current entry popup menu entry to not add a leading comma to the proposed DN. This _might_ make more sense than to have that comma. It is a matter of taste though. I think this reverts the behaviour back to how it used to be... Index: input.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/input.c,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** input.c 10 Aug 2002 06:06:38 -0000 1.46 --- input.c 18 Sep 2002 09:46:54 -0000 1.47 *************** *** 736,742 **** gq_exploded_free(oldrdn); #else ! newdn = g_malloc(strlen(dn) + 2); ! strcpy(newdn, ","); /* Flawfinder: ignore */ ! strcat(newdn, dn); /* Flawfinder: ignore */ #endif --- 736,742 ---- gq_exploded_free(oldrdn); #else ! newdn = g_malloc(strlen(dn) + 1); ! /* strcpy(newdn, ","); */ /* Flawfinder: ignore */ ! strcpy(newdn, dn); /* Flawfinder: ignore */ #endif |
From: <sta...@us...> - 2002-09-18 09:42:16
|
Update of /cvsroot/gqclient/gq/src In directory usw-pr-cvs1:/tmp/cvs-serv2484 Modified Files: configfile.c Log Message: * Fixed a potential buffer overflow situation as indicated by an original source comment of Bert * Modified saving of the condiguration to be robust against problems during writing of the configuration (write to .gq.new, rename .gq.new to .gq). Might need add'l changes to catch all i/o related errors. Index: configfile.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/configfile.c,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** configfile.c 23 Jul 2002 13:50:06 -0000 1.26 --- configfile.c 18 Sep 2002 09:42:13 -0000 1.27 *************** *** 627,634 **** } ! ! char *filename_config(int context) { ! static char rcpath[128]; char *home; --- 627,636 ---- } ! /* filename_config returns the name of the config file. The returned ! pointer must g_free'd. */ ! gchar *filename_config(int context) { ! gchar *rcpath = NULL; ! /* static char rcpath[128]; */ char *home; *************** *** 639,643 **** } ! snprintf(rcpath, sizeof(rcpath), "%s/%s", home, RCFILE); free(home); --- 641,648 ---- } ! /* need add'l "/", thus add some extra chars */ ! rcpath = g_malloc(strlen(home) + strlen(RCFILE) + 3); ! ! sprintf(rcpath, "%s/%s", home, RCFILE); free(home); *************** *** 668,684 **** config.config_version = CURRENT_CONFIG_VERSION; config.asked_version = CURRENT_CONFIG_VERSION; return; } /* refuse to read config file if world readable (bind passwords) */ ! if( (sfile.st_mode & ~S_IFMT) != 00600 ) { snprintf(errstr, sizeof(errstr), ! _("%s is group and/or world readable.\n" "This file can contain passwords in cleartext,\n" ! "and should be mode 0600.\n\n" "Continuing with default settings...\n"), rcpath); error_push(load_context, errstr); error_flush(load_context); return; } --- 673,691 ---- config.config_version = CURRENT_CONFIG_VERSION; config.asked_version = CURRENT_CONFIG_VERSION; + g_free(rcpath); return; } /* refuse to read config file if world readable (bind passwords) */ ! if( ((sfile.st_mode & ~S_IFMT) & (S_IRWXG|S_IRWXO)) != 0 ) { snprintf(errstr, sizeof(errstr), ! _("%s is group and/or world readable or writeable.\n" "This file can contain passwords in cleartext,\n" ! "and is recommended to have mode 0600.\n\n" "Continuing with default settings...\n"), rcpath); error_push(load_context, errstr); error_flush(load_context); + g_free(rcpath); return; } *************** *** 691,694 **** --- 698,702 ---- fclose(rcfd); } + g_free(rcpath); process_rcfile(rcfile); *************** *** 737,759 **** void config_write_string(struct writeconfig *wc, char *value, char *entity) { ! int i, p; ! char outstr[1024]; ! ! snprintf(outstr, sizeof(outstr), "<%s>", entity); /* quick-and-dirty escape < and > */ for(i = 0; value[i]; i++) { if(value[i] == '<' || value[i] == '>') { ! strcat(outstr, "\\"); /* FIXME: Buffer overflow probs */ } ! p = strlen(outstr); ! outstr[p++] = value[i]; ! outstr[p] = '\0'; } ! strcat(outstr, "</"); ! strcat(outstr, entity); ! strcat(outstr, ">\n"); ! config_write(wc, outstr); } --- 745,764 ---- void config_write_string(struct writeconfig *wc, char *value, char *entity) { ! int i; ! GString *outstr = g_string_sized_new(1024); ! g_string_sprintf(outstr, "<%s>", entity); /* quick-and-dirty escape < and > */ for(i = 0; value[i]; i++) { if(value[i] == '<' || value[i] == '>') { ! g_string_append(outstr, "\\"); } ! g_string_append_c(outstr, value[i]); } ! g_string_append(outstr, "</"); ! g_string_append(outstr, entity); ! g_string_append(outstr, ">\n"); ! config_write(wc, outstr->str); } *************** *** 776,780 **** struct writeconfig *wc; int write_context; ! char *rcpath, errstr[256]; write_context = error_new_context(_("Error writing configfile")); --- 781,788 ---- struct writeconfig *wc; int write_context; ! char *rcpath, errstr[1024]; ! char *tmprcpath; ! struct stat sfile; ! int mode = S_IRUSR|S_IWUSR; write_context = error_new_context(_("Error writing configfile")); *************** *** 796,801 **** return; } ! wc->outfile = fopen(rcpath, "w"); if(!wc->outfile) { snprintf(errstr, sizeof(errstr), --- 804,819 ---- return; } + /* write to temp file... */ + tmprcpath = g_malloc(strlen(rcpath) + 10); + strcpy(tmprcpath, rcpath); + strcat(tmprcpath, ".new"); + + /* check mode of original file. Do not overwrite without write + permission. */ + if(stat(rcpath, &sfile) == 0) { + mode = sfile.st_mode & (S_IRUSR|S_IWUSR); + } ! wc->outfile = fopen(tmprcpath, "w"); if(!wc->outfile) { snprintf(errstr, sizeof(errstr), *************** *** 804,810 **** error_push(write_context, errstr); error_flush(write_context); return; } ! fchmod(fileno(wc->outfile), S_IRUSR|S_IWUSR); config_write(wc, "<?xml version=\"1.0\" standalone=\"yes\"?>\n"); --- 822,830 ---- error_push(write_context, errstr); error_flush(write_context); + g_free(tmprcpath); + g_free(rcpath); return; } ! fchmod(fileno(wc->outfile), mode); config_write(wc, "<?xml version=\"1.0\" standalone=\"yes\"?>\n"); *************** *** 927,932 **** --- 947,968 ---- FREE(wc, "struct writeconfig"); + /* rename temp to final config file */ + + if (rename(tmprcpath, rcpath) != 0) { + snprintf(errstr, sizeof(errstr), + _("Could not replace old configuration (%s) with the new one (%s):\n%s\n"), rcpath, tmprcpath, + strerror(errno)); + error_push(write_context, errstr); + error_flush(write_context); + + g_free(tmprcpath); + g_free(rcpath); + return; + } + error_flush(write_context); + g_free(tmprcpath); + g_free(rcpath); } |