gqclient-commit Mailing List for GQ LDAP client (Page 17)
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-07-13 16:53:44
|
Update of /cvsroot/gqclient/gq/src In directory usw-pr-cvs1:/tmp/cvs-serv10006 Modified Files: search.c mainwin.h mainwin.c browse.h browse.c Log Message: * Added a new feature: The popup menu for a search/filter result allows to find the same object in the browser. If multiple browsers are available the browser used last is chosen. The best thing about this feature is that it allows to jump to objects in the browse tree that might not be found otherwise (eg. due to a size limit). This allows to explore parts of an LDAP server otherwise not available. * The base combo box on a search tab can now be changed. This allows to use gq for searches where the base must be different from the root objects of the server. For an example where this might be useful see http://www.ldap.research.netsol.com/ldapsearch.html Index: search.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/search.c,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** search.c 18 Jun 2002 22:07:14 -0000 1.22 --- search.c 13 Jul 2002 16:53:41 -0000 1.23 *************** *** 44,51 **** --- 44,54 ---- #include "encode.h" #include "i18n.h" + #include "browse.h" extern struct gq_config config; + void find_in_browser(GHashTable *hash); + static gboolean search_button_press_on_tree_item(GtkWidget *clist, GdkEventButton *event, *************** *** 123,127 **** gtk_signal_connect(GTK_OBJECT(GTK_COMBO(searchbase_combo)->button), "button_press_event", GTK_SIGNAL_FUNC(searchbase_button_pressed), hash); ! GTK_WIDGET_UNSET_FLAGS(GTK_ENTRY(GTK_COMBO(searchbase_combo)->entry), GTK_CAN_FOCUS); GTK_WIDGET_UNSET_FLAGS(GTK_BUTTON(GTK_COMBO(searchbase_combo)->button), GTK_CAN_FOCUS); gtk_widget_show(searchbase_combo); --- 126,130 ---- gtk_signal_connect(GTK_OBJECT(GTK_COMBO(searchbase_combo)->button), "button_press_event", GTK_SIGNAL_FUNC(searchbase_button_pressed), hash); ! /* GTK_WIDGET_UNSET_FLAGS(GTK_ENTRY(GTK_COMBO(searchbase_combo)->entry), GTK_CAN_FOCUS); */ GTK_WIDGET_UNSET_FLAGS(GTK_BUTTON(GTK_COMBO(searchbase_combo)->button), GTK_CAN_FOCUS); gtk_widget_show(searchbase_combo); *************** *** 456,459 **** --- 459,463 ---- searchbase_combo = g_hash_table_lookup(hash, "searchbase_combo"); cur_searchbase = gtk_editable_get_chars(GTK_EDITABLE(GTK_COMBO(searchbase_combo)->entry), 0, -1); + if(config.sort_search) msg = ldap_search_s(ld, cur_searchbase, LDAP_SCOPE_SUBTREE, *************** *** 521,525 **** gtk_clist_set_column_visibility(GTK_CLIST(new_main_clist), oc_col, 0); - row = 0; if(!config.sort_search) --- 525,528 ---- *************** *** 529,534 **** while(rc) { ! ! for(e = ldap_first_entry(ld, res); e != NULL; e = ldap_next_entry(ld, e)) { /* not every attribute necessarily comes back for every entry, --- 532,537 ---- while(rc) { ! for(e = ldap_first_entry(ld, res); e != NULL; ! e = ldap_next_entry(ld, e)) { /* not every attribute necessarily comes back for every entry, *************** *** 608,611 **** --- 611,615 ---- if(server->maxentries == 0 || row < server->maxentries) { ldap_msgfree(res); + res = NULL; rc = (ldap_result(ld, msg, 0, NULL, &res) == LDAP_RES_SEARCH_ENTRY); } *************** *** 625,629 **** gtk_clist_column_titles_passive(GTK_CLIST(new_main_clist)); free_attrlist(attrlist); ! ldap_msgfree(res); close_connection(server, FALSE); --- 629,633 ---- gtk_clist_column_titles_passive(GTK_CLIST(new_main_clist)); free_attrlist(attrlist); ! if (res) ldap_msgfree(res); close_connection(server, FALSE); *************** *** 668,671 **** --- 672,683 ---- gtk_widget_show(menu_item); + /* Find in Browser */ + menu_item = gtk_menu_item_new_with_label(_("Find in browser")); + gtk_menu_append(GTK_MENU(menu), menu_item); + gtk_signal_connect_object(GTK_OBJECT(menu_item), "activate", + GTK_SIGNAL_FUNC(find_in_browser), + (gpointer) hash); + gtk_widget_show(menu_item); + /* separator */ menu_item = gtk_menu_item_new(); *************** *** 681,687 **** --- 693,727 ---- gtk_widget_show(menu_item); + gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, event->button, event->time); + } + + void find_in_browser(GHashTable *hash) + { + struct ldapserver *server; + struct resultset *set; + GHashTable *browsehash; + GtkCTree *ctree; + + set = g_hash_table_lookup(hash, "set"); + g_hash_table_remove(hash, "set"); + if(set == NULL || set->dn == NULL) + return; + + if( (server = g_hash_table_lookup(hash, "cur_resultset_server")) == NULL) + return; + + /* find last used browser... */ + + browsehash = get_last_of_mode(BROWSE_MODE); + 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")); + } } Index: mainwin.h =================================================================== RCS file: /cvsroot/gqclient/gq/src/mainwin.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** mainwin.h 13 Jun 2002 10:03:33 -0000 1.10 --- mainwin.h 13 Jul 2002 16:53:41 -0000 1.11 *************** *** 46,49 **** --- 46,53 ---- extern GtkWidget *statusbar; + GHashTable *get_last_of_mode(int mode); + void go_to_page(GHashTable *hash); + void enter_last_of(int mode, GHashTable *hash); + void fill_serverlist_combo(GtkWidget *combo); void cleanup(void); Index: mainwin.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/mainwin.c,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** mainwin.c 18 Jun 2002 22:07:14 -0000 1.24 --- mainwin.c 13 Jul 2002 16:53:41 -0000 1.25 *************** *** 55,58 **** --- 55,82 ---- GList *tablist = NULL; + static GHashTable *lastofmode = NULL; + + GHashTable *get_last_of_mode(int mode) + { + if (!lastofmode) return NULL; + return g_hash_table_lookup(lastofmode, GINT_TO_POINTER(mode)); + } + + void go_to_page(GHashTable *hash) + { + gtk_notebook_set_page(GTK_NOTEBOOK(mainbook), + g_list_index(tablist, hash)); + } + + void enter_last_of(int mode, GHashTable *hash) + { + if (!lastofmode) { + lastofmode = g_hash_table_new(g_direct_hash, g_direct_equal); + } + + g_hash_table_insert(lastofmode, + (gpointer) mode, hash); + } + void fill_serverlist_combo(GtkWidget *combo) { *************** *** 382,385 **** --- 406,411 ---- g_hash_table_insert(hash, "mode", GINT_TO_POINTER(mode)); + enter_last_of(mode, hash); + switch(mode) { case SEARCH_MODE: *************** *** 423,426 **** --- 449,453 ---- GHashTable *hash; GtkWidget *focusbox; + int mode; hash = g_list_nth_data(tablist, pagenum); *************** *** 428,431 **** --- 455,463 ---- return; + /* retrieve mode, store this pane as the last one used for this mode */ + mode = GPOINTER_TO_INT(g_hash_table_lookup(hash, "mode")); + + enter_last_of(mode, hash); + focusbox = g_hash_table_lookup(hash, "focus"); if(focusbox) { *************** *** 461,468 **** { GHashTable *hash; ! int tab; tab = gtk_notebook_get_current_page(GTK_NOTEBOOK(mainbook)); hash = g_list_nth_data(tablist, tab); cleanup_tab(hash); g_hash_table_destroy(hash); --- 493,506 ---- { GHashTable *hash; ! int tab, thismode = -1; ! GList *tl; tab = gtk_notebook_get_current_page(GTK_NOTEBOOK(mainbook)); hash = g_list_nth_data(tablist, tab); + + if (hash) { + thismode = GPOINTER_TO_INT(g_hash_table_lookup(hash, "mode")); + } + cleanup_tab(hash); g_hash_table_destroy(hash); *************** *** 472,475 **** --- 510,526 ---- gtk_widget_destroy(mainwin); + enter_last_of(thismode, NULL); + + /* try to find another tab with the same mode so we can put that + one into lastofmode... */ + + for (tl = tablist ; tl ; tl = tl->next) { + if (GPOINTER_TO_INT(g_hash_table_lookup((GHashTable *) tl->data, + "mode")) == thismode) { + /* found one! */ + enter_last_of(thismode, tl->data); + break; + } + } } *************** *** 687,688 **** --- 738,745 ---- } + + /* + Local Variables: + c-basic-offset: 5 + End: + */ Index: browse.h =================================================================== RCS file: /cvsroot/gqclient/gq/src/browse.h,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** browse.h 21 Jun 2002 00:34:32 -0000 1.19 --- browse.h 13 Jul 2002 16:53:41 -0000 1.20 *************** *** 141,144 **** --- 141,145 ---- GtkCTreeNode *node); + void show_server_dn(GtkCTree *tree, struct ldapserver *server, char *dn); void show_dn(GtkCTree *tree, GtkCTreeNode *node, char *dn); Index: browse.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/browse.c,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** browse.c 13 Jul 2002 07:04:20 -0000 1.53 --- browse.c 13 Jul 2002 16:53:41 -0000 1.54 *************** *** 87,90 **** --- 87,137 ---- } + + 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 }; + 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]); + + new_entry = (dn_browse_entry *) new_dn_browse_entry(dn); + + added = gtk_ctree_insert_node(ctree, + node, NULL, + labels, + 0, + NULL, NULL, NULL, NULL, + FALSE, FALSE); + + gtk_ctree_node_set_row_data_full(ctree, + added, + new_entry, + (GtkDestroyNotify) destroy_browse_entry); + + /* add dummy node */ + new_item = gtk_ctree_insert_node(ctree, + added, NULL, + dummy, + 0, + NULL, NULL, NULL, NULL, + TRUE, FALSE); + + free(labels[0]); + gq_exploded_free(exploded_dn); + free(dn); + + return added; + } + + static void dn_browse_entry_expand(dn_browse_entry *entry, GtkCTree *ctree, *************** *** 95,106 **** LDAPMessage *res, *e; struct ldapserver *server; ! int msg, rc, num_children, update_counter; ! char *dn, message[MAX_DN_LEN + 21]; char *dummy[] = { "dummy", NULL }; - char *labels[] = { NULL, NULL }; char *c; ! dn_browse_entry *new_entry; ! GtkCTreeNode *new_item; ! char **exploded_dn = 0; if (!entry->seen) { --- 142,150 ---- LDAPMessage *res, *e; struct ldapserver *server; ! int msg, rc, num_children, update_counter, err; ! char message[MAX_DN_LEN + 21]; char *dummy[] = { "dummy", NULL }; char *c; ! int context = error_new_context(_("Expand entry")); if (!entry->seen) { *************** *** 111,114 **** --- 155,159 ---- if( (ld = open_connection(server)) == NULL) { + error_flush(context); return; } *************** *** 142,145 **** --- 187,192 ---- close_connection(server, FALSE); gtk_clist_thaw(GTK_CLIST(ctree)); + + error_flush(context); return; } *************** *** 150,185 **** NULL, &res)) == LDAP_RES_SEARCH_ENTRY) { for(e = ldap_first_entry(ld, res) ; e != NULL ; ! e=ldap_next_entry(ld, e)) { ! dn = ldap_get_dn(ld, e); ! ! /* explode DN */ ! exploded_dn = gq_ldap_explode_dn(dn, FALSE); ! labels[0] = decoded_string(exploded_dn[0]); ! ! new_entry = (dn_browse_entry *) new_dn_browse_entry(dn); ! ! new_item = gtk_ctree_insert_node(ctree, ! node, NULL, ! labels, ! 0, ! NULL, NULL, NULL, NULL, ! FALSE, FALSE); ! ! gtk_ctree_node_set_row_data_full(ctree, ! new_item, ! new_entry, ! (GtkDestroyNotify) destroy_browse_entry); ! /* add dummy node */ ! new_item = gtk_ctree_insert_node(ctree, ! new_item, NULL, ! dummy, ! 0, ! NULL, NULL, NULL, NULL, ! TRUE, FALSE); ! ! free(labels[0]); ! gq_exploded_free(exploded_dn); ! free(dn); num_children++; --- 197,203 ---- NULL, &res)) == LDAP_RES_SEARCH_ENTRY) { for(e = ldap_first_entry(ld, res) ; e != NULL ; ! e = ldap_next_entry(ld, e)) { ! dn_browse_single_add(ld, e, ctree, node); num_children++; *************** *** 195,205 **** ldap_msgfree(res); } - if (res) ldap_msgfree(res); entry->leaf = (num_children == 0); make_message(message, sizeof(message), num_children, _("entry"), _("entries"), _("found (finished)")); statusbar_msg(message); gtk_clist_thaw(GTK_CLIST(ctree)); --- 213,247 ---- ldap_msgfree(res); } entry->leaf = (num_children == 0); make_message(message, sizeof(message), num_children, _("entry"), _("entries"), _("found (finished)")); + + + rc = ldap_parse_result(ld, res, + &err, NULL, NULL, NULL, NULL, 0); + + if (rc != LDAP_SUCCESS) { + error_push(context, ldap_err2string(rc)); + push_ldap_addl_error(ld, context); + } else { + if (err == LDAP_SIZELIMIT_EXCEEDED) { + int l = strlen(message); + snprintf(message + l, sizeof(message) - l, + " - %s", _("size limit exceeded")); + } else if (err == LDAP_TIMELIMIT_EXCEEDED) { + int l = strlen(message); + snprintf(message + l, sizeof(message) - l, + " - %s", _("time limit exceeded")); + } else if (err != LDAP_SUCCESS) { + error_push(context, ldap_err2string(err)); + push_ldap_addl_error(ld, context); + } + } + statusbar_msg(message); + if (res) ldap_msgfree(res); + gtk_clist_thaw(GTK_CLIST(ctree)); *************** *** 219,223 **** } ! } --- 261,265 ---- } ! error_flush(context); } *************** *** 797,800 **** --- 839,845 ---- if (IS_SERVER_ENTRY(e)) { sd->currserver = ((server_browse_entry *)e)->server; + if (strlen(sd->dn) == 0 && sd->currserver == sd->server) { + sd->found = node; + } return; } *************** *** 974,977 **** --- 1019,1031 ---- } + 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) { *************** *** 979,982 **** --- 1033,1037 ---- int i; GString *s; + GtkCTreeNode *found = NULL; if (!dn) return; *************** *** 992,1001 **** g_string_insert(s, 0, dnparts[i]); ! node = node_from_dn(tree, ! node, ! s->str); ! if (node) gtk_ctree_expand(tree, node); ! else break; g_string_insert(s, 0, ","); --- 1047,1083 ---- g_string_insert(s, 0, dnparts[i]); ! /* printf("try %s at %08lx\n", s->str, node); */ if (node) gtk_ctree_expand(tree, node); ! ! found = node_from_dn(tree, node, s->str); ! ! if (found) { ! node = found; ! } else if (node) { ! /* check if the object with this dn actually exists. If ! 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; ! } ! ldap_msgfree(res); ! } ! ! close_connection(server, FALSE); ! } ! } ! ! /* else break; */ g_string_insert(s, 0, ","); *************** *** 1004,1007 **** --- 1086,1096 ---- gq_exploded_free(dnparts); g_string_free(s, TRUE); + + if (found) { + gtk_ctree_select(tree, found); + gtk_ctree_node_moveto(tree, node, + 0, + 0.5, 0); + } } |
From: <sta...@us...> - 2002-07-13 16:47:42
|
Update of /cvsroot/gqclient/gq/src In directory usw-pr-cvs1:/tmp/cvs-serv8759 Modified Files: dt_oc.c formfill.c formfill.h input.c tinput.c Log Message: * Made the popup menu for the attribute labels to change display type a submenu of a general purpose popup menu. This menu now contains a button to view schema information for the attribute. Index: dt_oc.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/dt_oc.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** dt_oc.c 9 Jul 2002 10:31:11 -0000 1.12 --- dt_oc.c 13 Jul 2002 16:47:38 -0000 1.13 *************** *** 364,367 **** --- 364,368 ---- return TRUE; /* ?? */ } + form->server = server; strncpy(form->attrname, oc->oc_at_oids_must[i], MAX_ATTR_LEN); *************** *** 387,390 **** --- 388,392 ---- return TRUE; /* ?? */ } + form->server = server; strncpy(form->attrname, oc->oc_at_oids_may[i], MAX_ATTR_LEN); Index: formfill.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/formfill.c,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** formfill.c 13 Jul 2002 07:04:20 -0000 1.29 --- formfill.c 13 Jul 2002 16:47:38 -0000 1.30 *************** *** 230,233 **** --- 230,234 ---- } + form->server = server; strncpy(form->attrname, c, MAX_ATTR_LEN); if (c) g_free(c); *************** *** 286,289 **** --- 287,291 ---- /* no problem with NUL bytes here - new_formfill returns a completly NUL inited object */ + newform->server = oldform->server; strncpy(newform->attrname, oldform->attrname, sizeof(newform->attrname)); Index: formfill.h =================================================================== RCS file: /cvsroot/gqclient/gq/src/formfill.h,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** formfill.h 13 Jul 2002 07:04:20 -0000 1.19 --- formfill.h 13 Jul 2002 16:47:38 -0000 1.20 *************** *** 82,85 **** --- 82,86 ---- struct formfill { char attrname[MAX_ATTR_LEN]; + struct ldapserver *server; int num_inputfields; int displaytype; Index: input.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/input.c,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** input.c 13 Jul 2002 07:07:37 -0000 1.41 --- input.c 13 Jul 2002 16:47:38 -0000 1.42 *************** *** 46,49 **** --- 46,51 ---- #include "syntax.h" #include "i18n.h" + #include "schema.h" + #include "schemabrowse.h" #include "../icons/line.xpm" *************** *** 282,285 **** --- 284,298 ---- } + void schema_show_attr(GtkMenuItem *menuitem, struct formfill *form) + { + struct server_schema *ss = NULL; + + if (form->server == NULL) return; + ss = get_schema(form->server); + + popup_detail(SCHEMA_TYPE_AT, form->server, + find_canonical_at_by_at(ss, form->attrname)); + } + static gboolean widget_button_press(GtkWidget *widget, GdkEventButton *event, *************** *** 287,293 **** { if (event->type == GDK_BUTTON_PRESS && event->button == 3) { ! GtkWidget *menu_item, *menu, *label; GtkWidget *root_menu; GList *dt_list; root_menu = gtk_menu_item_new_with_label("Root"); --- 300,307 ---- { if (event->type == GDK_BUTTON_PRESS && event->button == 3) { ! GtkWidget *menu_item, *menu, *label, *submenu; GtkWidget *root_menu; GList *dt_list; + char buf[40]; root_menu = gtk_menu_item_new_with_label("Root"); *************** *** 296,305 **** gtk_menu_item_set_submenu(GTK_MENU_ITEM(root_menu), menu); ! label = gtk_menu_item_new_with_label(_("Select display type")); gtk_widget_set_sensitive(label, FALSE); gtk_widget_show(label); gtk_menu_append(GTK_MENU(menu), label); ! gtk_menu_set_title(GTK_MENU(menu), _("Select display type")); menu_item = gtk_tearoff_menu_item_new(); --- 310,321 ---- gtk_menu_item_set_submenu(GTK_MENU_ITEM(root_menu), menu); ! snprintf(buf, sizeof(buf), _("Attribute %s"), form->attrname); ! ! label = gtk_menu_item_new_with_label(buf); gtk_widget_set_sensitive(label, FALSE); gtk_widget_show(label); gtk_menu_append(GTK_MENU(menu), label); ! gtk_menu_set_title(GTK_MENU(menu), buf); menu_item = gtk_tearoff_menu_item_new(); *************** *** 308,311 **** --- 324,352 ---- gtk_widget_show(menu_item); + menu_item = gtk_menu_item_new_with_label(_("Schema information")); + /* gtk_object_set_data(GTK_OBJECT(menu_item), "formfill", form); */ + gtk_menu_append(GTK_MENU(menu), menu_item); + gtk_signal_connect(GTK_OBJECT(menu_item), "activate", + GTK_SIGNAL_FUNC(schema_show_attr), + (gpointer) form); + gtk_widget_show(menu_item); + + /* Change display type submenu */ + menu_item = gtk_menu_item_new_with_label(_("Change display type")); + gtk_menu_append(GTK_MENU(menu), menu_item); + submenu = gtk_menu_new(); + gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item), submenu); + gtk_widget_show(menu_item); + + label = gtk_menu_item_new_with_label(_("Select display type")); + gtk_widget_set_sensitive(label, FALSE); + gtk_widget_show(label); + gtk_menu_append(GTK_MENU(submenu), label); + + menu_item = gtk_tearoff_menu_item_new(); + gtk_menu_append(GTK_MENU(submenu), menu_item); + gtk_widget_set_sensitive(menu_item, FALSE); + gtk_widget_show(menu_item); + dt_list = get_selectable_displaytypes(); while(dt_list) { *************** *** 316,320 **** gtk_object_set_data(GTK_OBJECT(menu_item), "formfill", form); /* gtk_object_set_data(GTK_OBJECT(menu_item), "entry", entry); */ ! gtk_menu_append(GTK_MENU(menu), menu_item); gtk_signal_connect(GTK_OBJECT(menu_item), "activate", GTK_SIGNAL_FUNC(change_dt), --- 357,361 ---- gtk_object_set_data(GTK_OBJECT(menu_item), "formfill", form); /* gtk_object_set_data(GTK_OBJECT(menu_item), "entry", entry); */ ! gtk_menu_append(GTK_MENU(submenu), menu_item); gtk_signal_connect(GTK_OBJECT(menu_item), "activate", GTK_SIGNAL_FUNC(change_dt), *************** *** 1003,1007 **** /* return; */ /* } */ ! res = ldap_modify_s(ld, dn, mods); if (res == LDAP_SERVER_DOWN) { --- 1044,1048 ---- /* return; */ /* } */ ! /* dump_mods(mods); */ res = ldap_modify_s(ld, dn, mods); if (res == LDAP_SERVER_DOWN) { Index: tinput.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/tinput.c,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** tinput.c 12 Jul 2002 20:27:52 -0000 1.38 --- tinput.c 13 Jul 2002 16:47:39 -0000 1.39 *************** *** 219,222 **** --- 219,223 ---- return(NULL); } + form->server = server; strcpy(form->attrname, "objectClass"); /* Flawfinder: ignore */ form->flags |= FLAG_MUST_IN_SCHEMA; *************** *** 251,254 **** --- 252,256 ---- return(NULL); } + form->server = server; strncpy(form->attrname, oc->oc_at_oids_must[i], MAX_ATTR_LEN); form->flags |= FLAG_MUST_IN_SCHEMA; *************** *** 276,279 **** --- 278,282 ---- return(NULL); } + form->server = server; strncpy(form->attrname, oc->oc_at_oids_may[i], MAX_ATTR_LEN); set_displaytype(server, form); *************** *** 365,368 **** --- 368,372 ---- /* attribute type not in schema */ newform = new_formfill(); + newform->server = server; strncpy(newform->attrname, form->attrname, sizeof(newform->attrname)); |
From: <sta...@us...> - 2002-07-13 16:42:35
|
Update of /cvsroot/gqclient/gq In directory usw-pr-cvs1:/tmp/cvs-serv8208 Modified Files: configure.in Log Message: * Fixed improper reporting of gdk_pixbuf usage Index: configure.in =================================================================== RCS file: /cvsroot/gqclient/gq/configure.in,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** configure.in 5 Jul 2002 06:49:19 -0000 1.34 --- configure.in 13 Jul 2002 16:42:31 -0000 1.35 *************** *** 187,192 **** --- 187,194 ---- AC_PATH_PROG(GDK_PIXBUF_CONFIG, gdk-pixbuf-config,,$PATH) + HAVE_PIXBUF= if test "x$GDK_PIXBUF_CONFIG" != x; then AC_DEFINE(HAVE_PIXBUF) + HAVE_PIXBUF=1 GDK_PIXBUF_LIBS=`$GDK_PIXBUF_CONFIG --libs` GDK_PIXBUF_CFLAGS=`$GDK_PIXBUF_CONFIG --cflags` *************** *** 335,343 **** echo ! echo -n "UTF-8 support.................. " ARG_YESNO(ac_cv_header_iconv_h) echo -n "LDAP Schema support............ " ARG_YESNO($ac_cv_func_ldap_str2objectclass) echo -n "TLS support.................... " ARG_YESNO($gq_have_tls) echo -n "Encrypted passwords............ " ARG_YESNO($ac_cv_lib_crypto_OpenSSL_add_all_digests) ! echo -n "Gdk-pixbuf support............. " ARG_YESNO(ac_cv_header_gdk_pixbuf_gdk_pixbuf_h) echo -n "SASL binds..................... " ARG_YESNO($ac_cv_header_sasl_h) echo -n "Kerberos binds................. " ARG_YESNO($HAVE_KERBEROS) --- 337,345 ---- echo ! echo -n "UTF-8 support.................. " ARG_YESNO($ac_cv_header_iconv_h) echo -n "LDAP Schema support............ " ARG_YESNO($ac_cv_func_ldap_str2objectclass) echo -n "TLS support.................... " ARG_YESNO($gq_have_tls) echo -n "Encrypted passwords............ " ARG_YESNO($ac_cv_lib_crypto_OpenSSL_add_all_digests) ! echo -n "Gdk-pixbuf support............. " ARG_YESNO($HAVE_PIXBUF) echo -n "SASL binds..................... " ARG_YESNO($ac_cv_header_sasl_h) echo -n "Kerberos binds................. " ARG_YESNO($HAVE_KERBEROS) |
From: <sta...@us...> - 2002-07-13 09:13:38
|
Update of /cvsroot/gqclient/gq/src In directory usw-pr-cvs1:/tmp/cvs-serv10442 Modified Files: dtutil.c Log Message: * Fixed yet-another bug: suddenly all empty GtkEditable based attribute data widgets returned zero length data instead of NULL when no data was present. Arghhhhh! Remember: think before checking in... Index: dtutil.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/dtutil.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** dtutil.c 13 Jul 2002 07:01:06 -0000 1.2 --- dtutil.c 13 Jul 2002 09:13:34 -0000 1.3 *************** *** 48,95 **** char nul[] = { 0 }; int pos = 0; ! GByteArray *copy, *encoded; ! gboolean del = FALSE, deldata = FALSE; ! ! if (data == NULL) { ! data = g_byte_array_new(); ! deldata = TRUE; ! } ! ! len = data->len; ! /* encode data */ ! if (encode) { ! encoded = encode(data->data, data->len); ! del = TRUE; ! } else { ! encoded = data; ! del = FALSE; ! } ! /* append a NUL byte, so we can be sure that we have a NUL ! terminated string (though there may be a NUL somewhere in the ! data already) */ ! g_byte_array_append(encoded, nul, 1); ! gtk_editable_delete_text(entry, 0, -1); ! gtk_editable_insert_text(entry, encoded->data, strlen(encoded->data), ! &pos); ! ! gtk_editable_set_position(entry, 0); ! /* strip the extra NUL byte again... */ ! g_byte_array_set_size(encoded, len); ! if (del) g_byte_array_free(encoded, TRUE); ! encoded = NULL; ! /* store a copy of the original data with the entry... */ ! copy = g_byte_array_new(); ! g_byte_array_append(copy, data->data, len); - gtk_object_set_data_full(GTK_OBJECT(entry), - "original_data", copy, - (GtkDestroyNotify) g_byte_array_free); gtk_object_set_data(GTK_OBJECT(entry), "decoder", decode); --- 48,95 ---- char nul[] = { 0 }; int pos = 0; ! GByteArray *copy = NULL, *encoded; ! gboolean del = FALSE; ! gtk_editable_delete_text(entry, 0, -1); ! if (data) { ! len = data->len; ! ! /* encode data */ ! if (encode) { ! encoded = encode(data->data, data->len); ! del = TRUE; ! } else { ! encoded = data; ! del = FALSE; ! } ! /* append a NUL byte, so we can be sure that we have a NUL ! terminated string (though there may be a NUL somewhere in the ! data already) */ ! ! g_byte_array_append(encoded, nul, 1); ! ! gtk_editable_insert_text(entry, encoded->data, ! strlen(encoded->data), &pos); ! ! gtk_editable_set_position(entry, 0); ! /* strip the extra NUL byte again... */ ! g_byte_array_set_size(encoded, len); ! if (del) g_byte_array_free(encoded, TRUE); ! encoded = NULL; ! /* store a copy of the original data with the entry... */ ! copy = g_byte_array_new(); ! g_byte_array_append(copy, data->data, len); ! } ! if (copy) ! gtk_object_set_data_full(GTK_OBJECT(entry), ! "original_data", copy, ! (GtkDestroyNotify) g_byte_array_free); gtk_object_set_data(GTK_OBJECT(entry), "decoder", decode); *************** *** 100,105 **** GTK_SIGNAL_FUNC(editable_changed_cb), (gpointer) NULL); - - if (deldata) g_byte_array_free(data, TRUE); } --- 100,103 ---- *************** *** 108,113 **** int changed = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(entry), "editable_changed_flag")); ! GByteArray *data; char *c; GByteArray* (*decode)(const char *val, int len); --- 106,112 ---- int changed = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(entry), "editable_changed_flag")); ! GByteArray *data = NULL; char *c; + int l; GByteArray* (*decode)(const char *val, int len); *************** *** 116,119 **** --- 115,127 ---- c = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1); + + if (!c) return NULL; + + l = strlen(c); + if (l == 0) { + g_free(c); + return NULL; + } + if (decode) { data = decode(c, strlen(c)); *************** *** 126,133 **** GByteArray *original = gtk_object_get_data(GTK_OBJECT(entry), "original_data"); - data = g_byte_array_new(); - - /* copy data */ if (original) { g_byte_array_append(data, original->data, original->len); } --- 134,140 ---- GByteArray *original = gtk_object_get_data(GTK_OBJECT(entry), "original_data"); if (original) { + /* copy data, if any */ + data = g_byte_array_new(); g_byte_array_append(data, original->data, original->len); } |
From: <sta...@us...> - 2002-07-13 07:07:43
|
Update of /cvsroot/gqclient/gq/src In directory usw-pr-cvs1:/tmp/cvs-serv18457 Modified Files: input.c Log Message: * Take care of FLAG_NO_USER_MOD when changing displaytypes * some cosmetic changes Index: input.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/input.c,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** input.c 12 Jul 2002 20:27:52 -0000 1.40 --- input.c 13 Jul 2002 07:07:37 -0000 1.41 *************** *** 263,266 **** --- 263,270 ---- w = new_h->get_widget(form, d, NULL, NULL); + if (form->flags & FLAG_NO_USER_MOD) { + gtk_widget_set_sensitive(w, 0); + } + gtk_widget_show(w); *************** *** 519,522 **** --- 523,530 ---- 2, 3, row_arrow, row_arrow + 1, 0, GTK_FILL, 5, 0); + + if (form->flags & FLAG_NO_USER_MOD) { + gtk_widget_set_sensitive(form->morebutton, 0); + } } formlist = formlist->next; *************** *** 736,740 **** /* don't bother adding in empty fields */ if(ndata) { - /* printf("%s: %s\n", form->attrname, ndata->data); */ form->values = g_list_append(form->values, ndata); } --- 744,747 ---- *************** *** 1156,1165 **** /* pass 1: deleted attributes, and deleted/added values */ ! while(oldlist) { oldform = (struct formfill *) oldlist->data; newform = lookup_attribute(newlist, oldform->attrname); ! /* oldform->values can come up NULL if the attribute was in the form ! only because add_attrs_by_oc() added it. Not a delete in this case... */ ! if(oldform->values != NULL && (newform == NULL || newform->values == NULL)) { /* attribute deleted */ mod = malloc(sizeof(LDAPMod)); --- 1163,1176 ---- /* pass 1: deleted attributes, and deleted/added values */ ! for( ; oldlist ; oldlist = oldlist->next ) { oldform = (struct formfill *) oldlist->data; + + /* if (oldform->flags & FLAG_NO_USER_MOD) continue; */ newform = lookup_attribute(newlist, oldform->attrname); ! /* oldform->values can come up NULL if the attribute was in ! the form only because add_attrs_by_oc() added it. Not a ! delete in this case... */ ! if(oldform->values != NULL && ! (newform == NULL || newform->values == NULL)) { /* attribute deleted */ mod = malloc(sizeof(LDAPMod)); *************** *** 1230,1235 **** } - - oldlist = oldlist->next; } oldlist = oldlist_tmp; --- 1241,1244 ---- |
From: <sta...@us...> - 2002-07-13 07:06:37
|
Update of /cvsroot/gqclient/gq/src In directory usw-pr-cvs1:/tmp/cvs-serv17962 Modified Files: ldapops.c browse-dnd.c Log Message: * Some optimizations wrt what attributes get requested with some LDAP search operations Index: ldapops.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/ldapops.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** ldapops.c 27 Jun 2002 08:16:24 -0000 1.13 --- ldapops.c 13 Jul 2002 07:06:32 -0000 1.14 *************** *** 135,138 **** --- 135,139 ---- gboolean ok = TRUE; char message[MAX_DN_LEN + 256]; + char *dn_only[] = { "dn", NULL }; sdn = gq_ldap_explode_dn(source_dn, 0); *************** *** 192,195 **** --- 193,197 ---- struct berval **bervals = ldap_get_values_len(sld, e, a); + #warning "FIXME: deal with ref when moving entries" mods[i] = calloc(sizeof(LDAPMod), 1); mods[i]->mod_op = LDAP_MOD_ADD | LDAP_MOD_BVALUES; *************** *** 239,243 **** rc = ldap_search_s(sld, source_dn, LDAP_SCOPE_ONELEVEL, ! "objectClass=*", NULL, 0, &res); if (rc == LDAP_SUCCESS) { --- 241,245 ---- rc = ldap_search_s(sld, source_dn, LDAP_SCOPE_ONELEVEL, ! "objectClass=*", dn_only, 0, &res); if (rc == LDAP_SUCCESS) { Index: browse-dnd.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/browse-dnd.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** browse-dnd.c 18 Jun 2002 22:07:14 -0000 1.6 --- browse-dnd.c 13 Jul 2002 07:06:32 -0000 1.7 *************** *** 829,832 **** --- 829,833 ---- GString *out = NULL; gboolean ok = FALSE; + char *attrs[] = { "*", "+", NULL }; #ifdef DEBUG_DND *************** *** 840,844 **** 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) { --- 841,845 ---- 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) { |
From: <sta...@us...> - 2002-07-13 07:04:23
|
Update of /cvsroot/gqclient/gq/src In directory usw-pr-cvs1:/tmp/cvs-serv16794 Modified Files: formfill.c formfill.h ldif.c browse.c Log Message: * Made LDIF exports work for referral objects Index: formfill.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/formfill.c,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** formfill.c 12 Jul 2002 20:27:52 -0000 1.28 --- formfill.c 13 Jul 2002 07:04:20 -0000 1.29 *************** *** 53,56 **** --- 53,70 ---- } + gboolean isInternalAttr(const char *attr) { + GList *filterout; + gboolean filtered = FALSE; + + for (filterout = internalAttrs ; filterout ; + filterout = filterout->next) { + if (strcasecmp(attr, filterout->data) == 0) { + filtered = TRUE; + break; + } + } + return filtered; + } + struct formfill *new_formfill(void) { *************** *** 200,216 **** /* filter out some internal attributes... */ - GList *filterout = NULL; - gboolean filtered = FALSE; c = attr_strip(attr); if (server->hide_internal) { ! for (filterout = internalAttrs ; filterout ; ! filterout = filterout->next) { ! if (strcasecmp(c, filterout->data) == 0) { ! filtered = TRUE; ! break; ! } ! } ! if (filtered) { ldap_memfree(attr); if (c) g_free(c); --- 214,221 ---- /* filter out some internal attributes... */ c = attr_strip(attr); if (server->hide_internal) { ! if (isInternalAttr(c)) { ldap_memfree(attr); if (c) g_free(c); *************** *** 437,441 **** if (at && at->at_no_user_mod) { - printf("no user mod\n"); form->flags |= FLAG_NO_USER_MOD; } --- 442,445 ---- Index: formfill.h =================================================================== RCS file: /cvsroot/gqclient/gq/src/formfill.h,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** formfill.h 12 Jul 2002 20:27:52 -0000 1.18 --- formfill.h 13 Jul 2002 07:04:20 -0000 1.19 *************** *** 96,99 **** --- 96,100 ---- void init_internalAttrs(); + gboolean isInternalAttr(const char *attr); struct formfill *new_formfill(void); Index: ldif.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/ldif.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ldif.c 8 Jun 2002 05:46:44 -0000 1.11 --- ldif.c 13 Jul 2002 07:04:20 -0000 1.12 *************** *** 22,25 **** --- 22,26 ---- */ + /* $Id$ */ #include <stdlib.h> *************** *** 37,40 **** --- 38,42 ---- #include "util.h" #include "ldif.h" + #include "formfill.h" /* isInternalAttr() */ *************** *** 81,93 **** attr = ldap_next_attribute(ld, msg, berptr)) { ! vals = ldap_get_values_len(ld, msg, attr); ! if(vals) { ! for(i = 0; vals[i]; i++) { ! /* 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"); } - ldap_value_free_len(vals); } ldap_memfree(attr); --- 83,98 ---- attr = ldap_next_attribute(ld, msg, berptr)) { ! if (!isInternalAttr(attr)) { ! vals = ldap_get_values_len(ld, msg, attr); ! if(vals) { ! for(i = 0; vals[i]; i++) { ! /* 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"); ! } ! ldap_value_free_len(vals); } } ldap_memfree(attr); *************** *** 286,287 **** --- 291,298 ---- } } + + /* + Local Variables: + c-basic-offset: 5 + End: + */ Index: browse.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/browse.c,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** browse.c 21 Jun 2002 00:34:32 -0000 1.52 --- browse.c 13 Jul 2002 07:04:20 -0000 1.53 *************** *** 1103,1106 **** --- 1103,1107 ---- int written; char message[128]; + char *attrs[] = { "*", "+", NULL }; entry = gtk_object_get_data(GTK_OBJECT(filesel), "entry"); *************** *** 1159,1163 **** 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)) { --- 1160,1164 ---- 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)) { |
From: <sta...@us...> - 2002-07-13 07:01:12
|
Update of /cvsroot/gqclient/gq/src In directory usw-pr-cvs1:/tmp/cvs-serv14892 Modified Files: dt_entry.c dt_password.c dt_text.c dt_time.c dtutil.c Log Message: * Fixed some nasty bugs that caused two consecutive "Apply" operations to delete all attributes of an object! * Fixed bugs denying the addition of new attributes Index: dt_entry.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/dt_entry.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** dt_entry.c 12 Jul 2002 20:21:14 -0000 1.7 --- dt_entry.c 13 Jul 2002 07:01:06 -0000 1.8 *************** *** 82,88 **** GTK_SIGNAL_FUNC(activatefunc), (gpointer) hash); ! if(data) { ! dt_entry_set_data(form, data, inputbox); ! } return inputbox; --- 82,86 ---- GTK_SIGNAL_FUNC(activatefunc), (gpointer) hash); ! dt_entry_set_data(form, data, inputbox); return inputbox; *************** *** 97,111 **** GtkWidget *widget) { ! if(data) { ! editable_set_text(GTK_EDITABLE(widget), data, ! DT_ENTRY(form->dt_handler)->encode, ! DT_ENTRY(form->dt_handler)->decode); ! } else { ! GByteArray *c = g_byte_array_new(); ! editable_set_text(GTK_EDITABLE(widget), c, ! DT_ENTRY(form->dt_handler)->encode, ! DT_ENTRY(form->dt_handler)->decode); ! g_byte_array_free(c, TRUE); ! } } --- 95,101 ---- GtkWidget *widget) { ! editable_set_text(GTK_EDITABLE(widget), data, ! DT_ENTRY(form->dt_handler)->encode, ! DT_ENTRY(form->dt_handler)->decode); } Index: dt_password.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/dt_password.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** dt_password.c 12 Jul 2002 20:21:14 -0000 1.9 --- dt_password.c 13 Jul 2002 07:01:06 -0000 1.10 *************** *** 321,338 **** combo = ((struct _GtkBoxChild *) boxchildren->next->data)->widget; ! if(data) { ! editable_set_text(GTK_EDITABLE(entry), data, ! DT_PASSWORD(form->dt_handler)->encode, ! DT_PASSWORD(form->dt_handler)->decode); ! ! if(data->data[0] == '{') { ! char crypt_prefix[12]; ! for(i = 1; data->data[i] && data->data[i] != '}' && i < 10; i++) ! crypt_prefix[i - 1] = data->data[i]; ! crypt_prefix[i - 1] = '\0'; ! crypt_type = detokenize(cryptmap, ! tokenize(cryptmap, crypt_prefix)); ! } } /* set the combo to the encoding type */ gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(combo)->entry), crypt_type); --- 321,337 ---- combo = ((struct _GtkBoxChild *) boxchildren->next->data)->widget; ! editable_set_text(GTK_EDITABLE(entry), data, ! DT_PASSWORD(form->dt_handler)->encode, ! DT_PASSWORD(form->dt_handler)->decode); ! ! if(data && data->data[0] == '{') { ! char crypt_prefix[12]; ! for(i = 1; data->data[i] && data->data[i] != '}' && i < 10; i++) ! crypt_prefix[i - 1] = data->data[i]; ! crypt_prefix[i - 1] = '\0'; ! crypt_type = detokenize(cryptmap, ! tokenize(cryptmap, crypt_prefix)); } + /* set the combo to the encoding type */ gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(combo)->entry), crypt_type); *************** *** 348,352 **** boxchildren = GTK_BOX(hbox)->children; ! data = editable_get_text(GTK_ENTRY(((struct _GtkBoxChild *) boxchildren->data)->widget)); if(boxchildren->next) { --- 347,351 ---- boxchildren = GTK_BOX(hbox)->children; ! data = editable_get_text(GTK_EDITABLE(((struct _GtkBoxChild *) boxchildren->data)->widget)); if(boxchildren->next) { Index: dt_text.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/dt_text.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** dt_text.c 12 Jul 2002 20:21:14 -0000 1.6 --- dt_text.c 13 Jul 2002 07:01:06 -0000 1.7 *************** *** 75,81 **** inputbox = gtk_text_new(NULL, NULL); gtk_text_set_editable(GTK_TEXT(inputbox), TRUE); ! if(data) { ! dt_entry_set_data(form, data, inputbox); ! } return inputbox; --- 75,79 ---- inputbox = gtk_text_new(NULL, NULL); gtk_text_set_editable(GTK_TEXT(inputbox), TRUE); ! dt_entry_set_data(form, data, inputbox); return inputbox; Index: dt_time.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/dt_time.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** dt_time.c 12 Jul 2002 20:21:14 -0000 1.2 --- dt_time.c 13 Jul 2002 07:01:06 -0000 1.3 *************** *** 446,453 **** GtkWidget *widget) { ! if (data) ! editable_set_text(GTK_EDITABLE(dt_time_retrieve_inputbox(widget)), ! data, ! NULL, NULL); } --- 446,452 ---- GtkWidget *widget) { ! editable_set_text(GTK_EDITABLE(dt_time_retrieve_inputbox(widget)), ! data, ! NULL, NULL); } Index: dtutil.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/dtutil.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** dtutil.c 12 Jul 2002 20:18:59 -0000 1.1 --- dtutil.c 13 Jul 2002 07:01:06 -0000 1.2 *************** *** 38,42 **** { gtk_object_set_data(GTK_OBJECT(editable), ! "entry_changed_flag", GINT_TO_POINTER(1)); } --- 38,42 ---- { gtk_object_set_data(GTK_OBJECT(editable), ! "editable_changed_flag", GINT_TO_POINTER(1)); } *************** *** 45,53 **** GByteArray* (*decode)(const char *val, int len)) { ! int len = data->len; char nul[] = { 0 }; int pos = 0; GByteArray *copy, *encoded; ! gboolean del = FALSE; /* encode data */ --- 45,60 ---- GByteArray* (*decode)(const char *val, int len)) { ! int len; char nul[] = { 0 }; int pos = 0; GByteArray *copy, *encoded; ! gboolean del = FALSE, deldata = FALSE; ! ! if (data == NULL) { ! data = g_byte_array_new(); ! deldata = TRUE; ! } ! ! len = data->len; /* encode data */ *************** *** 69,72 **** --- 76,81 ---- gtk_editable_insert_text(entry, encoded->data, strlen(encoded->data), &pos); + + gtk_editable_set_position(entry, 0); /* strip the extra NUL byte again... */ *************** *** 87,94 **** gtk_object_set_data(GTK_OBJECT(entry), ! "entry_changed_flag", GINT_TO_POINTER(0)); gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(editable_changed_cb), (gpointer) NULL); } --- 96,105 ---- gtk_object_set_data(GTK_OBJECT(entry), ! "editable_changed_flag", GINT_TO_POINTER(0)); gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(editable_changed_cb), (gpointer) NULL); + + if (deldata) g_byte_array_free(data, TRUE); } *************** *** 96,100 **** { int changed = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(entry), ! "entry_changed_flag")); GByteArray *data; char *c; --- 107,111 ---- { int changed = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(entry), ! "editable_changed_flag")); GByteArray *data; char *c; *************** *** 113,118 **** g_free(c); } else { ! data = gtk_object_get_data(GTK_OBJECT(entry), "original_data"); ! gtk_object_remove_no_notify(GTK_OBJECT(entry), "original_data"); } return data; --- 124,135 ---- g_free(c); } else { ! GByteArray *original = gtk_object_get_data(GTK_OBJECT(entry), ! "original_data"); ! data = g_byte_array_new(); ! ! /* copy data */ ! if (original) { ! g_byte_array_append(data, original->data, original->len); ! } } return data; |
From: <sta...@us...> - 2002-07-12 22:29:05
|
Update of /cvsroot/gqclient/gq/src In directory usw-pr-cvs1:/tmp/cvs-serv5136 Modified Files: dt_cert.c dt_crl.c Log Message: * Applied a patch by ken restivo <ke...@24...> fixing compile problems wrt openssh Index: dt_cert.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/dt_cert.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** dt_cert.c 9 Jul 2002 10:31:11 -0000 1.5 --- dt_cert.c 12 Jul 2002 22:29:02 -0000 1.6 *************** *** 48,51 **** --- 48,52 ---- #include <openssl/pem.h> #include <openssl/pkcs12.h> + #include <openssl/buffer.h> #include "common.h" Index: dt_crl.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/dt_crl.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** dt_crl.c 9 Jul 2002 10:31:11 -0000 1.3 --- dt_crl.c 12 Jul 2002 22:29:02 -0000 1.4 *************** *** 47,50 **** --- 47,51 ---- #include <openssl/asn1.h> #include <openssl/pem.h> + #include <openssl/buffer.h> #include "common.h" |
From: <sta...@us...> - 2002-07-12 20:31:30
|
Update of /cvsroot/gqclient/gq In directory usw-pr-cvs1:/tmp/cvs-serv4953 Modified Files: ChangeLog Log Message: * Changes from the last couple of days Index: ChangeLog =================================================================== RCS file: /cvsroot/gqclient/gq/ChangeLog,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** ChangeLog 5 Jul 2002 06:49:19 -0000 1.31 --- ChangeLog 12 Jul 2002 20:31:26 -0000 1.32 *************** *** 1,2 **** --- 1,12 ---- + 2002-07-12 Peter Stamfest <pe...@st...> + * Properly deal with binary data when switching to/from display + types based on widgets derived from GtkEditable + * Basic referral support - at least we see them now. + 2002-07-09 Peter Stamfest <pe...@st...> + * Added the dt_time displaytype to handle generalizedTime attributes. + * Added the change-displaytype-on-the-fly feature. Stability fixes + still required + * Added more error information when updating an object and something + goes wrong. 2002-07-05 Peter Stamfest <pe...@st...> * Bumped version to 0.6.0 |
Update of /cvsroot/gqclient/gq/src In directory usw-pr-cvs1:/tmp/cvs-serv2695 Modified Files: common.h configfile.c configfile.h formfill.c formfill.h gq.c input.c prefs.c tinput.c util.c Log Message: * Added two new configurations options regarding how gq deals with referrals + Show referrals This causes the LDAP connections to turn on the ManageDSAit option, thus retrieving LDAP referrals as normal objects. + Hide internal attributes In order to be able to show the "ref" attribute of referrals, we have to retrieve normally hidden attributes as well. When this option is set most such attributes will not be shown. Referral support currently is only there to be able to find out how to properly deal with referrals. This requires testing against many different LDAP servers to find out what is "right". Index: common.h =================================================================== RCS file: /cvsroot/gqclient/gq/src/common.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** common.h 13 Jun 2002 10:02:51 -0000 1.14 --- common.h 12 Jul 2002 20:27:52 -0000 1.15 *************** *** 81,84 **** --- 81,86 ---- long local_cache_timeout; int ask_pw; + int show_ref; + int hide_internal; LDAP *connection; Index: configfile.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/configfile.c,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** configfile.c 3 Jul 2002 18:49:45 -0000 1.23 --- configfile.c 12 Jul 2002 20:27:52 -0000 1.24 *************** *** 78,81 **** --- 78,83 ---- { "local-cache-timeout", T_LOCAL_CACHE_TIMEOUT, NEEDS_CLOSE|NEEDS_DATA }, { "ask-pw", T_ASK_PW, NEEDS_CLOSE|NEEDS_DATA }, + { "hide-internal", T_HIDE_INTERNAL, NEEDS_CLOSE|NEEDS_DATA }, + { "show-ref", T_SHOW_REF, NEEDS_CLOSE|NEEDS_DATA }, /* templates */ *************** *** 459,462 **** --- 461,470 ---- f->cur_ldapserver->ask_pw = config_get_bool(f); break; + case T_HIDE_INTERNAL: + f->cur_ldapserver->hide_internal = config_get_bool(f); + break; + case T_SHOW_REF: + f->cur_ldapserver->show_ref = config_get_bool(f); + break; } *************** *** 777,780 **** --- 785,792 ---- if(server->ask_pw != DEFAULT_ASK_PW) config_write_bool(wc, server->ask_pw, "ask-pw"); + if(server->hide_internal != DEFAULT_HIDE_INTERNAL) + config_write_bool(wc, server->hide_internal, "hide-internal"); + if(server->show_ref != DEFAULT_SHOW_REF) + config_write_bool(wc, server->show_ref, "show-ref"); wc->indent--; *************** *** 855,858 **** --- 867,872 ---- server->local_cache_timeout = DEFAULT_LOCAL_CACHE_TIMEOUT; server->ask_pw = DEFAULT_ASK_PW; + server->hide_internal = DEFAULT_HIDE_INTERNAL; + server->show_ref = DEFAULT_SHOW_REF; server->connection = NULL; server->missing_closes = 0; Index: configfile.h =================================================================== RCS file: /cvsroot/gqclient/gq/src/configfile.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** configfile.h 3 Jul 2002 18:49:45 -0000 1.14 --- configfile.h 12 Jul 2002 20:27:52 -0000 1.15 *************** *** 67,70 **** --- 67,72 ---- #define T_LOCAL_CACHE_TIMEOUT 33 #define T_ASK_PW 34 + #define T_HIDE_INTERNAL 35 + #define T_SHOW_REF 36 /* template tokens */ *************** *** 100,103 **** --- 102,107 ---- #define DEFAULT_LOCAL_CACHE_SIZE (512*1024) #define DEFAULT_ASK_PW 1 + #define DEFAULT_HIDE_INTERNAL 1 + #define DEFAULT_SHOW_REF 1 enum searchtype { Index: formfill.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/formfill.c,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** formfill.c 18 Jun 2002 22:07:14 -0000 1.27 --- formfill.c 12 Jul 2002 20:27:52 -0000 1.28 *************** *** 42,45 **** --- 42,56 ---- #include "i18n.h" + static GList *internalAttrs = NULL; + + void init_internalAttrs() { + internalAttrs = g_list_append(internalAttrs, "creatorsName"); + internalAttrs = g_list_append(internalAttrs, "creatorsName"); + internalAttrs = g_list_append(internalAttrs, "createTimestamp"); + internalAttrs = g_list_append(internalAttrs, "modifiersName"); + internalAttrs = g_list_append(internalAttrs, "modifyTimestamp"); + internalAttrs = g_list_append(internalAttrs, "subschemaSubentry"); + } + struct formfill *new_formfill(void) { *************** *** 149,152 **** --- 160,164 ---- struct berval **bervals; char *c = NULL; + char *attrs[] = { "+", "*", NULL }; formlist = NULL; *************** *** 167,171 **** msg = ldap_search_s(ld, dn, LDAP_SCOPE_BASE, "(objectclass=*)", ! NULL, 0, &res); if (msg == LDAP_SERVER_DOWN) { --- 179,183 ---- msg = ldap_search_s(ld, dn, LDAP_SCOPE_BASE, "(objectclass=*)", ! attrs, 0, &res); if (msg == LDAP_SERVER_DOWN) { *************** *** 186,194 **** for(attr = ldap_first_attribute(ld, entry, &ber); attr ; attr = ldap_next_attribute(ld, entry, ber)) { if( (form = new_formfill()) == NULL) { ldap_memfree(attr); break; } ! c = attr_strip(attr); strncpy(form->attrname, c, MAX_ATTR_LEN); if (c) g_free(c); --- 198,228 ---- for(attr = ldap_first_attribute(ld, entry, &ber); attr ; attr = ldap_next_attribute(ld, entry, ber)) { + + /* filter out some internal attributes... */ + GList *filterout = NULL; + gboolean filtered = FALSE; + + c = attr_strip(attr); + if (server->hide_internal) { + for (filterout = internalAttrs ; filterout ; + filterout = filterout->next) { + if (strcasecmp(c, filterout->data) == 0) { + filtered = TRUE; + break; + } + } + if (filtered) { + ldap_memfree(attr); + if (c) g_free(c); + continue; + } + } + if( (form = new_formfill()) == NULL) { ldap_memfree(attr); + if (c) g_free(c); break; } ! strncpy(form->attrname, c, MAX_ATTR_LEN); if (c) g_free(c); *************** *** 398,401 **** --- 432,444 ---- void set_displaytype(struct ldapserver *server, struct formfill *form) { + /* this is ugly... all of this needs a cleanup!!!! - FIXME */ + LDAPAttributeType *at = + find_canonical_at_by_at(server->ss, form->attrname); + + if (at && at->at_no_user_mod) { + printf("no user mod\n"); + form->flags |= FLAG_NO_USER_MOD; + } + form->syntax = get_syntax_handler_of_attr(server, form->attrname, NULL); form->displaytype = find_displaytype(server, form); Index: formfill.h =================================================================== RCS file: /cvsroot/gqclient/gq/src/formfill.h,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** formfill.h 9 Jul 2002 10:43:38 -0000 1.17 --- formfill.h 12 Jul 2002 20:27:52 -0000 1.18 *************** *** 63,66 **** --- 63,69 ---- #define FLAG_SINGLE_VALUE 0x08 + /* Used to disable widgets for attributes marked as no_user_mod */ + #define FLAG_NO_USER_MOD 0x80 + /* actually, we do not really need the following FLAG_* values, we only use them as tokens in dt_password.c right now */ *************** *** 92,95 **** --- 95,99 ---- }; + void init_internalAttrs(); struct formfill *new_formfill(void); Index: gq.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/gq.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** gq.c 27 Jun 2002 08:15:47 -0000 1.11 --- gq.c 12 Jul 2002 20:27:52 -0000 1.12 *************** *** 87,90 **** --- 87,92 ---- create_mainwin(); init_syntaxes(); + init_internalAttrs(); + g_log_set_always_fatal (G_LOG_LEVEL_CRITICAL); Index: input.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/input.c,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** input.c 9 Jul 2002 10:41:52 -0000 1.39 --- input.c 12 Jul 2002 20:27:52 -0000 1.40 *************** *** 486,489 **** --- 486,493 ---- form->widgetList = g_list_append(form->widgetList, widget); + + if (form->flags & FLAG_NO_USER_MOD) { + gtk_widget_set_sensitive(widget, 0); + } } else { widget = widgetList ? widgetList->data : NULL; *************** *** 865,868 **** --- 869,873 ---- if(res != LDAP_SUCCESS) { error_push(add_context, ldap_err2string(res)); + push_ldap_addl_error(ld, add_context); error_flush(add_context); set_normalcursor(); *************** *** 1006,1009 **** --- 1011,1015 ---- } else { error_push(mod_context, ldap_err2string(res)); + push_ldap_addl_error(ld, mod_context); } ldap_mods_free(mods, 1); *************** *** 1097,1100 **** --- 1103,1107 ---- #endif error_push(context, message->str); + push_ldap_addl_error(ld, context); error = 2; } Index: prefs.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/prefs.c,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** prefs.c 3 Jul 2002 20:53:16 -0000 1.23 --- prefs.c 12 Jul 2002 20:27:52 -0000 1.24 *************** *** 166,169 **** --- 166,177 ---- server->ask_pw = GTK_TOGGLE_BUTTON(field)->active ? 1 : 0; + /* Hide internal */ + field = get_widget(window, "hide_internal"); + server->hide_internal = GTK_TOGGLE_BUTTON(field)->active ? 1 : 0; + + /* Show ref */ + field = get_widget(window, "show_ref"); + server->show_ref = GTK_TOGGLE_BUTTON(field)->active ? 1 : 0; + /* Cache connection */ field = get_widget(window, "cacheconn"); *************** *** 267,275 **** GtkWidget *editwindow, *notebook; GtkWidget *main_vbox, *vbox1, *vbox2, *hbox; ! GtkWidget *table1, *table2; GtkWidget *label, *entry, *button; GtkWidget *okbutton, *cancelbutton; GtkWidget *bindpw, *bindpw2; ! int y, editing_new_server; char title[MAX_SERVERNAME_LEN + 8]; char tmp[16]; --- 275,283 ---- GtkWidget *editwindow, *notebook; GtkWidget *main_vbox, *vbox1, *vbox2, *hbox; ! GtkWidget *table1, *table2, *table3; GtkWidget *label, *entry, *button; GtkWidget *okbutton, *cancelbutton; GtkWidget *bindpw, *bindpw2; ! int y, z, editing_new_server; char title[MAX_SERVERNAME_LEN + 8]; char tmp[16]; *************** *** 416,419 **** --- 424,436 ---- y = 0; + table3 = gtk_table_new(3, 2, FALSE); + gtk_object_set_data(GTK_OBJECT(editwindow), "table3", table3); + gtk_widget_show(table3); + gtk_box_pack_start(GTK_BOX(vbox2), table3, TRUE, TRUE, 0); + gtk_container_border_width(GTK_CONTAINER(table3), 10); + gtk_table_set_row_spacings(GTK_TABLE(table3), 5); + gtk_table_set_col_spacings(GTK_TABLE(table3), 13); + z = 0; + /* Bind DN */ label = gtk_label_new(_("Bind DN")); *************** *** 556,559 **** --- 573,577 ---- gtk_table_attach(GTK_TABLE(table2), entry, 1, 2, y, y + 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + y++; #endif *************** *** 572,576 **** GTK_WIDGET_UNSET_FLAGS(GTK_CHECK_BUTTON(button), GTK_CAN_FOCUS); gtk_widget_show(button); ! gtk_box_pack_start(GTK_BOX(vbox2), button, FALSE, TRUE, 2); /* Cache connections */ --- 590,606 ---- GTK_WIDGET_UNSET_FLAGS(GTK_CHECK_BUTTON(button), GTK_CAN_FOCUS); gtk_widget_show(button); ! gtk_table_attach(GTK_TABLE(table3), button, 0, 1, z, z + 1, ! GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); ! ! /* Hide internal attributes */ ! button = gtk_check_button_new_with_label(_("Hide internal attributes")); ! gtk_object_set_data(GTK_OBJECT(editwindow), "hide_internal", button); ! if(server->hide_internal) ! gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), TRUE); ! GTK_WIDGET_UNSET_FLAGS(GTK_CHECK_BUTTON(button), GTK_CAN_FOCUS); ! gtk_widget_show(button); ! gtk_table_attach(GTK_TABLE(table3), button, 1, 2, z, z + 1, ! GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); ! z++; /* Cache connections */ *************** *** 581,585 **** GTK_WIDGET_UNSET_FLAGS(GTK_CHECK_BUTTON(button), GTK_CAN_FOCUS); gtk_widget_show(button); ! gtk_box_pack_start(GTK_BOX(vbox2), button, FALSE, TRUE, 2); /* Enable TLS */ --- 611,627 ---- GTK_WIDGET_UNSET_FLAGS(GTK_CHECK_BUTTON(button), GTK_CAN_FOCUS); gtk_widget_show(button); ! gtk_table_attach(GTK_TABLE(table3), button, 0, 1, z, z + 1, ! GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); ! ! /* Show ref */ ! button = gtk_check_button_new_with_label(_("Show referrals")); ! gtk_object_set_data(GTK_OBJECT(editwindow), "show_ref", button); ! if(server->show_ref) ! gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), TRUE); ! GTK_WIDGET_UNSET_FLAGS(GTK_CHECK_BUTTON(button), GTK_CAN_FOCUS); ! gtk_widget_show(button); ! gtk_table_attach(GTK_TABLE(table3), button, 1, 2, z, z + 1, ! GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); ! z++; /* Enable TLS */ *************** *** 590,594 **** GTK_WIDGET_UNSET_FLAGS(GTK_CHECK_BUTTON(button), GTK_CAN_FOCUS); gtk_widget_show(button); ! gtk_box_pack_start(GTK_BOX(vbox2), button, FALSE, TRUE, 0); /* OK and Cancel buttons */ --- 632,638 ---- GTK_WIDGET_UNSET_FLAGS(GTK_CHECK_BUTTON(button), GTK_CAN_FOCUS); gtk_widget_show(button); ! gtk_table_attach(GTK_TABLE(table3), button, 0, 1, z, z + 1, ! GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); ! z++; /* OK and Cancel buttons */ Index: tinput.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/tinput.c,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** tinput.c 18 Jun 2002 22:07:14 -0000 1.37 --- tinput.c 12 Jul 2002 20:27:52 -0000 1.38 *************** *** 256,259 **** --- 256,262 ---- form->flags |= FLAG_SINGLE_VALUE; } + if (at && at->at_no_user_mod) { + form->flags |= FLAG_NO_USER_MOD; + } set_displaytype(server, form); formlist = formlist_append(formlist, form); *************** *** 278,281 **** --- 281,287 ---- if (at && at->at_single_value) { form->flags |= FLAG_SINGLE_VALUE; + } + if (at && at->at_no_user_mod) { + form->flags |= FLAG_NO_USER_MOD; } } Index: util.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/util.c,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** util.c 3 Jul 2002 20:13:05 -0000 1.41 --- util.c 12 Jul 2002 20:27:52 -0000 1.42 *************** *** 220,223 **** --- 220,247 ---- } + + if (ld && server->show_ref) { + LDAPControl c; + LDAPControl *ctrls[2]; + ctrls[0] = &c; + ctrls[1] = NULL; + + c.ldctl_oid = LDAP_CONTROL_MANAGEDSAIT; + c.ldctl_value.bv_val = NULL; + c.ldctl_value.bv_len = 0; + c.ldctl_iscritical = 1; + + rc = ldap_set_option(ld, LDAP_OPT_SERVER_CONTROLS, ctrls); + + if (rc != LDAP_OPT_SUCCESS ) { + error_push(open_context, + _("Could not set critical ManageDSAit control")); + push_ldap_addl_error(ld, open_context); + + ldap_unbind(ld); + ld = NULL; + } + } + *ld_out = ld; return rc; |
From: <sta...@us...> - 2002-07-12 20:22:18
|
Update of /cvsroot/gqclient/gq/src In directory usw-pr-cvs1:/tmp/cvs-serv2516 Modified Files: Makefile.am Log Message: * Added dtutil.[ch] to the list of source files Index: Makefile.am =================================================================== RCS file: /cvsroot/gqclient/gq/src/Makefile.am,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** Makefile.am 9 Jul 2002 10:43:37 -0000 1.21 --- Makefile.am 12 Jul 2002 20:22:15 -0000 1.22 *************** *** 25,28 **** --- 25,29 ---- debug.c \ syntax.c \ + dtutil.c \ dt_entry.c \ dt_text.c \ *************** *** 61,64 **** --- 62,66 ---- debug.h \ syntax.h \ + dtutil.h \ dt_entry.h \ dt_text.h \ |
From: <sta...@us...> - 2002-07-12 20:21:17
|
Update of /cvsroot/gqclient/gq/src In directory usw-pr-cvs1:/tmp/cvs-serv1447 Modified Files: dt_entry.c dt_password.c dt_text.c dt_time.c Log Message: * Made GtkEditable based displaytype robust wrt binary data. Now the user can switch between any of the displaytypes available without loosing data. (NOTE: Using glibc 2.1 may lead to crashes during displaytype switches due to buggy iconv implementations) Index: dt_entry.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/dt_entry.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** dt_entry.c 9 Jul 2002 10:31:11 -0000 1.6 --- dt_entry.c 12 Jul 2002 20:21:14 -0000 1.7 *************** *** 50,53 **** --- 50,54 ---- #include "ldif.h" /* for b64_decode */ #include "syntax.h" + #include "dtutil.h" *************** *** 82,93 **** (gpointer) hash); if(data) { ! GByteArray *encoded = ! DT_ENTRY(form->dt_handler)->encode(data->data, data->len); ! /* printf("setting text '%s' orglen=%d len1=%d len2=%d\n", */ ! /* encoded->data, */ ! /* data->len, */ ! /* encoded->len, strlen(encoded->data)); */ ! gtk_entry_set_text(GTK_ENTRY(inputbox), encoded->data); ! g_byte_array_free(encoded, TRUE); } --- 83,87 ---- (gpointer) hash); if(data) { ! dt_entry_set_data(form, data, inputbox); } *************** *** 97,123 **** GByteArray *dt_entry_get_data(struct formfill *form, GtkWidget *widget) { ! GByteArray *copy; ! int l; ! ! gchar *content = gtk_editable_get_chars(GTK_EDITABLE(widget), 0, -1); ! if (!content) return NULL; ! ! l = strlen(content); ! if (l == 0) { ! g_free(content); ! return NULL; ! } ! ! copy = DT_ENTRY(form->dt_handler)->decode(content, strlen(content)); ! ! /* printf("getting orgtext '%s' text '%s' orglen=%d len1=%d len2=%d\n", */ ! /* content, */ ! /* copy->data, */ ! /* strlen(content), */ ! /* copy->len, strlen(copy->data)); */ ! ! g_free(content); ! ! return copy; } --- 91,95 ---- GByteArray *dt_entry_get_data(struct formfill *form, GtkWidget *widget) { ! return editable_get_text(GTK_EDITABLE(widget)); } *************** *** 126,140 **** { if(data) { ! GByteArray *encoded = ! DT_ENTRY(form->dt_handler)->encode(data->data, data->len); ! /* printf("setting text '%s' orglen=%d len1=%d len2=%d\n", */ ! /* encoded->data, */ ! /* data->len, */ ! /* encoded->len, strlen(encoded->data)); */ ! ! gtk_entry_set_text(GTK_ENTRY(widget), encoded->data); ! g_byte_array_free(encoded, TRUE); } else { ! gtk_entry_set_text(GTK_ENTRY(widget), ""); } } --- 98,110 ---- { if(data) { ! editable_set_text(GTK_EDITABLE(widget), data, ! DT_ENTRY(form->dt_handler)->encode, ! DT_ENTRY(form->dt_handler)->decode); } else { ! GByteArray *c = g_byte_array_new(); ! editable_set_text(GTK_EDITABLE(widget), c, ! DT_ENTRY(form->dt_handler)->encode, ! DT_ENTRY(form->dt_handler)->decode); ! g_byte_array_free(c, TRUE); } } *************** *** 148,152 **** memset(gb->data, 0, len + 1); decode_string(gb->data, val, len); ! /* trusting g_byte_array_set_size to keep that nul-byte */ g_byte_array_set_size(gb, strlen(gb->data)); } --- 118,122 ---- memset(gb->data, 0, len + 1); decode_string(gb->data, val, len); ! /* trusting g_byte_array_set_size to keep that nul-byte - FIXME */ g_byte_array_set_size(gb, strlen(gb->data)); } Index: dt_password.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/dt_password.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** dt_password.c 12 Jul 2002 17:59:47 -0000 1.8 --- dt_password.c 12 Jul 2002 20:21:14 -0000 1.9 *************** *** 55,58 **** --- 55,59 ---- #include "encode.h" #include "ldif.h" /* for b64_decode */ + #include "dtutil.h" #include "dt_password.h" *************** *** 321,328 **** if(data) { ! GByteArray *encoded = ! DT_PASSWORD(form->dt_handler)->encode(data->data, data->len); ! gtk_entry_set_text(GTK_ENTRY(entry), encoded->data); ! g_byte_array_free(encoded, TRUE); if(data->data[0] == '{') { --- 322,328 ---- if(data) { ! editable_set_text(GTK_EDITABLE(entry), data, ! DT_PASSWORD(form->dt_handler)->encode, ! DT_PASSWORD(form->dt_handler)->decode); if(data->data[0] == '{') { *************** *** 341,364 **** GByteArray *dt_password_get_data(struct formfill *form, GtkWidget *hbox) { ! GByteArray *copy; GtkWidget *combo; GList *boxchildren; - gchar *content; gchar *crypt_type; - int l; boxchildren = GTK_BOX(hbox)->children; - content = gtk_editable_get_chars(GTK_EDITABLE(((struct _GtkBoxChild *) boxchildren->data)->widget), 0, -1); - - if (!content) return NULL; - - l = strlen(content); - if (l == 0) { - g_free(content); - return NULL; - } ! copy = DT_PASSWORD(form->dt_handler)->decode(content, ! strlen(content)); if(boxchildren->next) { --- 341,352 ---- GByteArray *dt_password_get_data(struct formfill *form, GtkWidget *hbox) { ! GByteArray *data; GtkWidget *combo; GList *boxchildren; gchar *crypt_type; boxchildren = GTK_BOX(hbox)->children; ! data = editable_get_text(GTK_ENTRY(((struct _GtkBoxChild *) boxchildren->data)->widget)); if(boxchildren->next) { *************** *** 367,383 **** boxchildren = boxchildren->next; combo = ((struct _GtkBoxChild *) boxchildren->data)->widget; ! crypt_type = gtk_editable_get_chars(GTK_EDITABLE(GTK_COMBO(combo)->entry), 0, -1); ! cryptflag = tokenize(cryptmap, crypt_type); /* check to see if the content was already crypted.... */ ! if (copy && copy->data[0] != '{') { /* need to crypt the stuff */ CryptFunc *cryptfunc = detokenize_data(cryptmap, cryptflag); if (cryptfunc != NULL) { ! GByteArray *crypted = cryptfunc(copy->data, copy->len); ! g_byte_array_free(copy, TRUE); ! copy = crypted; } } --- 355,372 ---- boxchildren = boxchildren->next; combo = ((struct _GtkBoxChild *) boxchildren->data)->widget; ! crypt_type = ! gtk_editable_get_chars(GTK_EDITABLE(GTK_COMBO(combo)->entry), ! 0, -1); cryptflag = tokenize(cryptmap, crypt_type); /* check to see if the content was already crypted.... */ ! if (data && data->data[0] != '{') { /* need to crypt the stuff */ CryptFunc *cryptfunc = detokenize_data(cryptmap, cryptflag); if (cryptfunc != NULL) { ! GByteArray *crypted = cryptfunc(data->data, data->len); ! g_byte_array_free(data, TRUE); ! data = crypted; } } *************** *** 392,398 **** /* copy->len, strlen(copy->data)); */ ! g_free(content); ! ! return copy; } --- 381,385 ---- /* copy->len, strlen(copy->data)); */ ! return data; } Index: dt_text.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/dt_text.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** dt_text.c 9 Jul 2002 10:31:11 -0000 1.5 --- dt_text.c 12 Jul 2002 20:21:14 -0000 1.6 *************** *** 56,60 **** dt_text_get_widget, dt_entry_get_data, /* reuse method from dt_entry */ ! dt_text_set_data, bervalLDAPMod /* reuse method from dt_entry */ }, --- 56,60 ---- dt_text_get_widget, dt_entry_get_data, /* reuse method from dt_entry */ ! dt_entry_set_data, bervalLDAPMod /* reuse method from dt_entry */ }, *************** *** 76,87 **** gtk_text_set_editable(GTK_TEXT(inputbox), TRUE); if(data) { ! GByteArray *encoded = DT_TEXT(form->dt_handler)->encode(data->data, data->len); ! ! gtk_text_freeze(GTK_TEXT(inputbox)); ! gtk_text_set_point(GTK_TEXT(inputbox), 0); ! gtk_text_insert(GTK_TEXT(inputbox), NULL, NULL, NULL, encoded->data, -1); ! gtk_text_thaw(GTK_TEXT(inputbox)); ! ! g_byte_array_free(encoded, TRUE); } --- 76,80 ---- gtk_text_set_editable(GTK_TEXT(inputbox), TRUE); if(data) { ! dt_entry_set_data(form, data, inputbox); } *************** *** 89,92 **** --- 82,86 ---- } + #if 0 void dt_text_set_data(struct formfill *form, GByteArray *data, GtkWidget *widget) *************** *** 106,131 **** } gtk_text_thaw(GTK_TEXT(widget)); - } - - #if 0 - GByteArray *dt_text_get_data(struct formfill *form, GtkWidget *widget) - { - GByteArray *copy; - int l; - - gchar *content = gtk_editable_get_chars(GTK_EDITABLE(widget), 0, -1); - if (!content) return NULL; - - l = strlen(content); - if (l == 0) { - g_free(content); - return NULL; - } - - copy = DT_TEXT(form->dt_handler)->decode(content, strlen(content)); - - g_free(content); - - return copy; } #endif --- 100,103 ---- Index: dt_time.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/dt_time.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** dt_time.c 9 Jul 2002 10:43:37 -0000 1.1 --- dt_time.c 12 Jul 2002 20:21:14 -0000 1.2 *************** *** 45,48 **** --- 45,49 ---- #include "util.h" #include "formfill.h" + #include "dtutil.h" #include "dt_time.h" #include "i18n.h" *************** *** 438,466 **** GtkWidget *widget) { ! GtkWidget *inputbox = dt_time_retrieve_inputbox(widget); ! int l; ! GByteArray *gb; ! ! gchar *content = gtk_editable_get_chars(GTK_EDITABLE(inputbox), 0, -1); ! ! /* printf("content=%s\n", content); */ ! ! if (!content) return NULL; ! ! l = strlen(content); ! if (l == 0) { ! g_free(content); ! return NULL; ! } ! ! gb = g_byte_array_new(); ! ! if (gb) { ! g_byte_array_append(gb, content, l); ! } ! ! g_free(content); ! ! return gb; } --- 439,443 ---- GtkWidget *widget) { ! return editable_get_text(GTK_EDITABLE(dt_time_retrieve_inputbox(widget))); } *************** *** 469,484 **** GtkWidget *widget) { ! GtkWidget *inputbox; ! gchar *buf; ! ! if (!data) return; ! ! inputbox = dt_time_retrieve_inputbox(widget); ! buf= g_malloc0(data->len + 1); ! ! memcpy(buf, data->data, data->len); ! ! gtk_entry_set_text(GTK_ENTRY(inputbox), buf); ! g_free(buf); } --- 446,453 ---- GtkWidget *widget) { ! if (data) ! editable_set_text(GTK_EDITABLE(dt_time_retrieve_inputbox(widget)), ! data, ! NULL, NULL); } |
From: <sta...@us...> - 2002-07-12 20:19:03
|
Update of /cvsroot/gqclient/gq/src In directory usw-pr-cvs1:/tmp/cvs-serv973 Added Files: dtutil.c dtutil.h Log Message: * New files to hold displaytype related common utilities * Implemented some generic functions used to deal with binary data put into a GtkEditable due to user-induced switching of displaytypes --- NEW FILE: dtutil.c --- /* GQ -- a GTK-based LDAP client Copyright (C) 1998-2001 Bert Vermeulen This file (dtutil.c) is Copyright (C) 2002 by Peter Stamfest This program is released under the Gnu General Public License with the additional exemption that compiling, linking, and/or using OpenSSL is allowed. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id: dtutil.c,v 1.1 2002/07/12 20:18:59 stamfest Exp $ */ #include <glib.h> #include <gtk/gtk.h> #include <gdk/gdkkeysyms.h> #include <string.h> #include "dtutil.h" void editable_changed_cb(GtkEditable *editable, gpointer user_data) { gtk_object_set_data(GTK_OBJECT(editable), "entry_changed_flag", GINT_TO_POINTER(1)); } void editable_set_text(GtkEditable *entry, GByteArray *data, GByteArray* (*encode)(const char *val, int len), GByteArray* (*decode)(const char *val, int len)) { int len = data->len; char nul[] = { 0 }; int pos = 0; GByteArray *copy, *encoded; gboolean del = FALSE; /* encode data */ if (encode) { encoded = encode(data->data, data->len); del = TRUE; } else { encoded = data; del = FALSE; } /* append a NUL byte, so we can be sure that we have a NUL terminated string (though there may be a NUL somewhere in the data already) */ g_byte_array_append(encoded, nul, 1); gtk_editable_delete_text(entry, 0, -1); gtk_editable_insert_text(entry, encoded->data, strlen(encoded->data), &pos); /* strip the extra NUL byte again... */ g_byte_array_set_size(encoded, len); if (del) g_byte_array_free(encoded, TRUE); encoded = NULL; /* store a copy of the original data with the entry... */ copy = g_byte_array_new(); g_byte_array_append(copy, data->data, len); gtk_object_set_data_full(GTK_OBJECT(entry), "original_data", copy, (GtkDestroyNotify) g_byte_array_free); gtk_object_set_data(GTK_OBJECT(entry), "decoder", decode); gtk_object_set_data(GTK_OBJECT(entry), "entry_changed_flag", GINT_TO_POINTER(0)); gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(editable_changed_cb), (gpointer) NULL); } GByteArray *editable_get_text(GtkEditable *entry) { int changed = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(entry), "entry_changed_flag")); GByteArray *data; char *c; GByteArray* (*decode)(const char *val, int len); if (changed) { decode = gtk_object_get_data(GTK_OBJECT(entry), "decoder"); c = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1); if (decode) { data = decode(c, strlen(c)); } else { data = g_byte_array_new(); g_byte_array_append(data, c, strlen(c)); } g_free(c); } else { data = gtk_object_get_data(GTK_OBJECT(entry), "original_data"); gtk_object_remove_no_notify(GTK_OBJECT(entry), "original_data"); } return data; } /* Local Variables: c-basic-offset: 5 End: */ --- NEW FILE: dtutil.h --- /* GQ -- a GTK-based LDAP client Copyright (C) 1998-2001 Bert Vermeulen This file (dtutil.c) is Copyright (C) 2002 by Peter Stamfest and Bert Vermeulen This program is released under the Gnu General Public License with the additional exemption that compiling, linking, and/or using OpenSSL is allowed. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id: dtutil.h,v 1.1 2002/07/12 20:18:59 stamfest Exp $ */ #ifndef GQ_DTUTIL_H_INCLUDED #define GQ_DTUTIL_H_INCLUDED #include <gtk/gtk.h> #include "config.h" void editable_changed_cb(GtkEditable *editable, gpointer user_data); void editable_set_text(GtkEditable *entry, GByteArray *data, GByteArray* (*encode)(const char *val, int len), GByteArray* (*decode)(const char *val, int len)); GByteArray *editable_get_text(GtkEditable *entry); #endif /* Local Variables: c-basic-offset: 5 End: */ |
From: <sta...@us...> - 2002-07-12 17:59:52
|
Update of /cvsroot/gqclient/gq/src In directory usw-pr-cvs1:/tmp/cvs-serv25491 Modified Files: dt_password.c Log Message: * Got rid of all strcat and strcpy calls (TODO item) Index: dt_password.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/dt_password.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** dt_password.c 9 Jul 2002 10:31:11 -0000 1.7 --- dt_password.c 12 Jul 2002 17:59:47 -0000 1.8 *************** *** 106,112 **** GString *salt; GByteArray *gb = g_byte_array_new(); ! unsigned char *password, rand[16]; ! gb = g_byte_array_set_size(gb, 64); password = (char*) g_malloc((len + 1) * sizeof(char)); --- 106,112 ---- GString *salt; GByteArray *gb = g_byte_array_new(); ! unsigned char *password, rand[16], cryptbuf[32]; ! /* gb = g_byte_array_set_size(gb, 64); */ password = (char*) g_malloc((len + 1) * sizeof(char)); *************** *** 122,128 **** salt->str[2] = 0; ! strcpy(gb->data, "{crypt}"); ! des_fcrypt(password, salt->str, gb->data + strlen(gb->data)); ! g_byte_array_set_size(gb, strlen(gb->data)); g_string_free(salt, TRUE); --- 122,131 ---- salt->str[2] = 0; ! g_byte_array_append(gb, "{crypt}", 7); ! ! /* strcpy(gb->data, "{crypt}"); */ ! des_fcrypt(password, salt->str, cryptbuf); ! /* gb->data + strlen(gb->data)); */ ! g_byte_array_append(gb, cryptbuf, strlen(cryptbuf)); g_string_free(salt, TRUE); *************** *** 142,151 **** b64_encode(b64, md5_out, MD5_DIGEST_LENGTH); ! gb = g_byte_array_set_size(gb, MD5_DIGEST_LENGTH + 10); ! strcpy(gb->data, "{MD5}"); ! strcat(gb->data, b64->str); ! g_byte_array_set_size(gb, strlen(gb->data)); g_string_free(b64, TRUE); --- 145,157 ---- b64_encode(b64, md5_out, MD5_DIGEST_LENGTH); ! g_byte_array_append(gb, "{MD5}", 5); ! g_byte_array_append(gb, b64->str, strlen(b64->str)); ! ! /* gb = g_byte_array_set_size(gb, MD5_DIGEST_LENGTH + 10); */ ! /* strcpy(gb->data, "{MD5}"); */ ! /* strcat(gb->data, b64->str); */ ! /* g_byte_array_set_size(gb, strlen(gb->data)); */ g_string_free(b64, TRUE); *************** *** 164,173 **** b64_encode(b64, sha_out, SHA_DIGEST_LENGTH); ! gb = g_byte_array_set_size(gb, SHA_DIGEST_LENGTH + 10); ! ! strcpy(gb->data, "{SHA}"); ! strcat(gb->data, b64->str); ! g_byte_array_set_size(gb, strlen(gb->data)); g_string_free(b64, TRUE); --- 170,181 ---- b64_encode(b64, sha_out, SHA_DIGEST_LENGTH); ! /* gb = g_byte_array_set_size(gb, SHA_DIGEST_LENGTH + 10); */ ! ! /* strcpy(gb->data, "{SHA}"); */ ! /* strcat(gb->data, b64->str); */ ! /* g_byte_array_set_size(gb, strlen(gb->data)); */ ! g_byte_array_append(gb, "{SHA}", 5); ! g_byte_array_append(gb, b64->str, strlen(b64->str)); g_string_free(b64, TRUE); *************** *** 196,205 **** b64_encode(b64, sha_out, sizeof(sha_out)); ! gb = g_byte_array_set_size(gb, SHA_DIGEST_LENGTH + 16); ! strcpy(gb->data, "{SSHA}"); ! strcat(gb->data, b64->str); ! g_byte_array_set_size(gb, strlen(gb->data)); g_string_free(b64, TRUE); --- 204,216 ---- b64_encode(b64, sha_out, sizeof(sha_out)); ! /* gb = g_byte_array_set_size(gb, SHA_DIGEST_LENGTH + 16); */ ! /* strcpy(gb->data, "{SSHA}"); */ ! /* strcat(gb->data, b64->str); */ ! /* g_byte_array_set_size(gb, strlen(gb->data)); */ ! ! g_byte_array_append(gb, "{SSHA}", 6); ! g_byte_array_append(gb, b64->str, strlen(b64->str)); g_string_free(b64, TRUE); *************** *** 227,236 **** b64_encode(b64, md5_out, sizeof(md5_out)); ! gb = g_byte_array_set_size(gb, MD5_DIGEST_LENGTH + 16); ! strcpy(gb->data, "{SMD5}"); ! strcat(gb->data, b64->str); ! g_byte_array_set_size(gb, strlen(gb->data)); g_string_free(b64, TRUE); --- 238,249 ---- b64_encode(b64, md5_out, sizeof(md5_out)); ! /* gb = g_byte_array_set_size(gb, MD5_DIGEST_LENGTH + 16); */ ! /* strcpy(gb->data, "{SMD5}"); */ ! /* strcat(gb->data, b64->str); */ ! /* g_byte_array_set_size(gb, strlen(gb->data)); */ ! g_byte_array_append(gb, "{SMD5}", 6); ! g_byte_array_append(gb, b64->str, strlen(b64->str)); g_string_free(b64, TRUE); |
From: <sta...@us...> - 2002-07-09 10:43:42
|
Update of /cvsroot/gqclient/gq/src In directory usw-pr-cvs1:/tmp/cvs-serv21952 Modified Files: Makefile.am formfill.h syntax.c Added Files: dt_time.c dt_time.h Log Message: * Added a new displaytype: dt_time, used to deal with generalizedTime attributes - very convenient! --- NEW FILE: dt_time.c --- /* GQ -- a GTK-based LDAP client Copyright (C) 1998-2001 Bert Vermeulen This file (dt_time.c) is Copyright (C) 2002 by Peter Stamfest This program is released under the Gnu General Public License with the additional exemption that compiling, linking, and/or using OpenSSL is allowed. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id: dt_time.c,v 1.1 2002/07/09 10:43:37 stamfest Exp $ */ #include <config.h> #include <string.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include <stdio.h> #include <ctype.h> #include <time.h> #include <glib.h> #include <gdk/gdk.h> #include <gtk/gtk.h> #include "common.h" #include "util.h" #include "formfill.h" #include "dt_time.h" #include "i18n.h" static GtkWidget *dt_time_get_widget(struct formfill *form, GByteArray *data, GtkSignalFunc *activatefunc, GHashTable *hash); static GByteArray *dt_time_get_data(struct formfill *form, GtkWidget *widget); static void dt_time_set_data(struct formfill *form, GByteArray *data, GtkWidget *widget); static dt_time_handler dt_time_handler_vtab = { "Generalized Time", TRUE, dt_time_get_widget, dt_time_get_data, dt_time_set_data, bervalLDAPMod }; typedef struct _cbdata { struct formfill *form; GtkWidget *hbox; GtkWidget *editwindow; } cbdata; display_type_handler *dt_time_get_handler() { return (display_type_handler *) &dt_time_handler_vtab; } /* * parse a generalized time into a struct tm. Is there a better way to * do this?? I wish I could use regular expressions for this. */ static int parse_time(const char *data, struct tm *tm, int *offset) { int n = 0, i, N; const char *c; char fmt[20]; struct { char *fmt; int *ptr; int max; } parts[] = { { "%4u", &tm->tm_year, 9999 }, { "%2u", &tm->tm_mon, 12 }, { "%2u", &tm->tm_mday, 31 }, { "%2u", &tm->tm_hour, 23 }, { "%2u", &tm->tm_min, 59 }, { "%2u", &tm->tm_sec, 59 }, { NULL, NULL }, }; if (!data) return 0; if (!tm) return 0; memset(tm, 0, sizeof(struct tm)); for (i = 0, c = data ; parts[i].fmt ; i++) { if (!isdigit(*c)) break; /* construct format */ snprintf(fmt, sizeof(fmt), "%s%%n", parts[i].fmt); if (sscanf(c, fmt, parts[i].ptr, &N)) { if (N > 0) { if (*parts[i].ptr > parts[i].max) { *parts[i].ptr = parts[i].max; } if (*parts[i].ptr < 0) { *parts[i].ptr = 0; } c += N; n++; } else { break; } } } if (n >= 1) { tm->tm_year -= 1900; } if (n >= 2) { tm->tm_mon--; } if (offset && *c) { /* have timezone! */ /* special case: UTC (Zulu) */ if (c[0] == 'Z') { *offset = 0; n++; } else { if (sscanf(c, "%d", offset)) n++; } } return n; } static void tz_value_changed_callback(GtkAdjustment *adjustment, GtkSpinButton *spin) { int v = gtk_spin_button_get_value_as_int(spin); int sign = v > 0 ? 1 : -1; int h, m; v = ((v > 0) ? v : -v); h = v / 100; m = v % 100; if (m >= 60) { v = sign * (100 * h + 59); gtk_spin_button_set_value(spin, (gfloat) v); } } static void dt_time_ok_callback(GtkWidget *button, cbdata *cbd) { GtkWidget *editwindow = cbd->editwindow; GtkWidget *w; int y, m, d, H = 0, M = 0, S = 0, zone = 0; int sign; char buffer[60]; w = gtk_object_get_data(GTK_OBJECT(editwindow), "calendar"); if (w) { gtk_calendar_get_date(GTK_CALENDAR(w), &y, &m, &d); m++; } w = gtk_object_get_data(GTK_OBJECT(editwindow), "hour"); if (w) H = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(w)); w = gtk_object_get_data(GTK_OBJECT(editwindow), "minute"); if (w) M = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(w)); w = gtk_object_get_data(GTK_OBJECT(editwindow), "second"); if (w) S = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(w)); w = gtk_object_get_data(GTK_OBJECT(editwindow), "timezone"); if (w) zone = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(w)); if (S != 0) { snprintf(buffer, sizeof(buffer), "%04d%02d%02d%02d%02d%02d", y, m, d, H, M, S); } else { /* optimize zero seconds away */ snprintf(buffer, sizeof(buffer), "%04d%02d%02d%02d%02d", y, m, d, H, M); } if (zone == 0) { strcat(buffer, "Z"); } else { sign = zone > 0 ? '+' : '-'; zone = zone > 0 ? zone : -zone; snprintf(buffer + strlen(buffer), sizeof(buffer) - strlen(buffer), "%c%04d", sign, zone); } /* printf("%s\n", buffer); */ w = gtk_object_get_data(GTK_OBJECT(cbd->hbox), "inputbox"); gtk_entry_set_text(GTK_ENTRY(w), buffer); gtk_widget_destroy(editwindow); } static void dt_time_edit_window(GtkWidget *button, cbdata *cbd) { GtkWidget *hbox = cbd->hbox; GtkWidget *inputbox = dt_time_retrieve_inputbox(hbox); GtkWidget *editwindow, *main_vbox, *calendar, *w; GtkWidget *hbox2, *button2; GtkAdjustment *adj; char titlebuffer[1024]; struct tm tm; int y, m, d, offset; int ofs_h, ofs_m, ofs_sign; time_t t; struct tm *l; gchar *content; extern long timezone; time(&t); l = localtime(&t); /* implicitly calls tzset() for us */ y = l->tm_year + 1900; m = l->tm_mon + 1; d = l->tm_mday; ofs_sign = timezone > 0 ? 1 : -1; ofs_m = (timezone > 0 ? timezone : -timezone) / 60; /* printf("ofs_m=%d\n", ofs_m); */ ofs_h = ofs_m / 60; ofs_m = ofs_m % 60; /* printf("ofs_h=%d, ofs_m=%d, isdst=%d\n", ofs_h, ofs_m, l->tm_isdst); */ if (l->tm_isdst) { ofs_h++; } /* NOTE: generalizedTime includes offset relative to GMT while the timezone variable hold seconds west of GMT */ offset = -ofs_sign * (100 * ofs_h + ofs_m); editwindow = gtk_window_new(GTK_WINDOW_DIALOG); cbd->editwindow = editwindow; snprintf(titlebuffer, sizeof(titlebuffer), _("%s: choose date and time"), cbd->form->attrname); gtk_window_set_title(GTK_WINDOW(editwindow), titlebuffer); gtk_window_set_policy(GTK_WINDOW(editwindow), TRUE, TRUE, FALSE); 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); calendar = gtk_calendar_new(); gtk_box_pack_start(GTK_BOX(main_vbox), calendar, TRUE, TRUE, 0); gtk_widget_show(calendar); gtk_object_set_data(GTK_OBJECT(editwindow), "calendar", calendar); content = gtk_editable_get_chars(GTK_EDITABLE(inputbox), 0, -1); if (content) { int n = parse_time(content, &tm, &offset); /* printf("n=%d\n", n); */ if (n >= 1) y = tm.tm_year + 1900; if (n >= 2) m = tm.tm_mon + 1; if (n >= 3) d = tm.tm_mday; g_free(content); } gtk_calendar_select_month(GTK_CALENDAR(calendar), m - 1, y); gtk_calendar_select_day(GTK_CALENDAR(calendar), d); hbox2 = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(main_vbox), hbox2, TRUE, TRUE, 5); gtk_widget_show(hbox2); w = gtk_label_new(_("Time [hh:mm:ss]")); gtk_box_pack_start(GTK_BOX(hbox2), w, FALSE, TRUE, 0); gtk_widget_show(w); w = gtk_spin_button_new(GTK_ADJUSTMENT(gtk_adjustment_new(0.0, 0.0, 23.0, 1.0, 1.0, 1.0)), 1.0, 0); gtk_spin_button_set_value(GTK_SPIN_BUTTON(w), tm.tm_hour); gtk_box_pack_start(GTK_BOX(hbox2), w, FALSE, FALSE, 10); gtk_widget_show(w); gtk_object_set_data(GTK_OBJECT(editwindow), "hour", w); w = gtk_label_new(_(":")); gtk_box_pack_start(GTK_BOX(hbox2), w, FALSE, TRUE, 0); gtk_widget_show(w); w = gtk_spin_button_new(GTK_ADJUSTMENT(gtk_adjustment_new(0.0, 0.0, 59.0, 1.0, 1.0, 1.0)), 1.0, 0); gtk_spin_button_set_value(GTK_SPIN_BUTTON(w), tm.tm_min); gtk_box_pack_start(GTK_BOX(hbox2), w, FALSE, FALSE, 10); gtk_widget_show(w); gtk_object_set_data(GTK_OBJECT(editwindow), "minute", w); w = gtk_label_new(_(":")); gtk_box_pack_start(GTK_BOX(hbox2), w, FALSE, TRUE, 0); gtk_widget_show(w); w = gtk_spin_button_new(GTK_ADJUSTMENT(gtk_adjustment_new(0.0, 0.0, 59.0, 1.0, 1.0, 1.0)), 1.0, 0); gtk_spin_button_set_value(GTK_SPIN_BUTTON(w), tm.tm_sec); gtk_box_pack_start(GTK_BOX(hbox2), w, FALSE, FALSE, 10); gtk_widget_show(w); gtk_object_set_data(GTK_OBJECT(editwindow), "second", w); hbox2 = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(main_vbox), hbox2, TRUE, TRUE, 0); gtk_widget_show(hbox2); w = gtk_label_new(_("Timezone (Offset) [+-hhmm]")); gtk_box_pack_start(GTK_BOX(hbox2), w, FALSE, TRUE, 0); gtk_widget_show(w); adj = GTK_ADJUSTMENT(gtk_adjustment_new(0.0, -1259.0, 1259.0, 100.0, 100.0, 100.0)); w = gtk_spin_button_new(adj, 100.0, 0); gtk_spin_button_set_snap_to_ticks(GTK_SPIN_BUTTON(w), FALSE); gtk_spin_button_set_value(GTK_SPIN_BUTTON(w), offset); gtk_signal_connect(GTK_OBJECT(adj), "value-changed", GTK_SIGNAL_FUNC(tz_value_changed_callback), (gpointer) w); gtk_box_pack_start(GTK_BOX(hbox2), w, TRUE, TRUE, 10); gtk_widget_show(w); gtk_object_set_data(GTK_OBJECT(editwindow), "timezone", w); hbox2 = gtk_hbutton_box_new(); gtk_box_pack_start(GTK_BOX(main_vbox), hbox2, FALSE, TRUE, 10); gtk_widget_show(hbox2); button2 = gtk_button_new_with_label(_("OK")); gtk_widget_show(button2); gtk_signal_connect(GTK_OBJECT(button2), "clicked", 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), (gpointer) editwindow); gtk_widget_show(button2); gtk_widget_show(editwindow); } static GtkWidget *dt_time_get_widget(struct formfill *form, GByteArray *data, GtkSignalFunc *activatefunc, GHashTable *hash) { GtkWidget *hbox, *inputbox, *button; cbdata *cbd; hbox = gtk_hbox_new(FALSE, 5); inputbox = gtk_entry_new(); if(activatefunc) gtk_signal_connect_object(GTK_OBJECT(inputbox), "activate", GTK_SIGNAL_FUNC(activatefunc), (gpointer) hash); gtk_box_pack_start(GTK_BOX(hbox), inputbox, TRUE, TRUE, 0); gtk_widget_show(inputbox); button = gtk_button_new_with_label("..."); gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, TRUE, 0); cbd = g_malloc(sizeof(cbdata)); cbd->form = form; cbd->hbox = hbox; gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(dt_time_edit_window), (gpointer) cbd); gtk_object_set_data_full(GTK_OBJECT(hbox), "cbdata", cbd, g_free); gtk_widget_show(button); gtk_object_set_data(GTK_OBJECT(hbox), "inputbox", inputbox); gtk_object_set_data(GTK_OBJECT(hbox), "button", button); dt_time_set_data(form, data, hbox); return hbox; } static GByteArray *dt_time_get_data(struct formfill *form, GtkWidget *widget) { GtkWidget *inputbox = dt_time_retrieve_inputbox(widget); int l; GByteArray *gb; gchar *content = gtk_editable_get_chars(GTK_EDITABLE(inputbox), 0, -1); /* printf("content=%s\n", content); */ if (!content) return NULL; l = strlen(content); if (l == 0) { g_free(content); return NULL; } gb = g_byte_array_new(); if (gb) { g_byte_array_append(gb, content, l); } g_free(content); return gb; } static void dt_time_set_data(struct formfill *form, GByteArray *data, GtkWidget *widget) { GtkWidget *inputbox; gchar *buf; if (!data) return; inputbox = dt_time_retrieve_inputbox(widget); buf= g_malloc0(data->len + 1); memcpy(buf, data->data, data->len); gtk_entry_set_text(GTK_ENTRY(inputbox), buf); g_free(buf); } GtkWidget *dt_time_retrieve_inputbox(GtkWidget *hbox) { return gtk_object_get_data(GTK_OBJECT(hbox), "inputbox"); } /* Local Variables: c-basic-offset: 5 End: */ --- NEW FILE: dt_time.h --- /* GQ -- a GTK-based LDAP client Copyright (C) 1998-2001 Bert Vermeulen This file (dt_time.h) is Copyright (C) 2002 by Peter Stamfest This program is released under the Gnu General Public License with the additional exemption that compiling, linking, and/or using OpenSSL is allowed. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id: dt_time.h,v 1.1 2002/07/09 10:43:38 stamfest Exp $ */ #ifndef DT_TIME_H_INCLUDED #define DT_TIME_H_INCLUDED #include "config.h" #include "syntax.h" typedef display_type_handler dt_time_handler; #define DT_TIME(objpointer) ((dt_time_handler *)(objpointer)) display_type_handler *dt_time_get_handler(); GtkWidget *dt_time_retrieve_inputbox(GtkWidget *widget); #endif /* DT_TIME_H_INCLUDED */ /* Local Variables: c-basic-offset: 5 End: */ Index: Makefile.am =================================================================== RCS file: /cvsroot/gqclient/gq/src/Makefile.am,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** Makefile.am 3 Jul 2002 19:11:06 -0000 1.20 --- Makefile.am 9 Jul 2002 10:43:37 -0000 1.21 *************** *** 35,38 **** --- 35,39 ---- dt_cert.c \ dt_crl.c \ + dt_time.c \ ldapops.c \ tdefault.c \ *************** *** 70,73 **** --- 71,75 ---- dt_cert.h \ dt_crl.h \ + dt_time.h \ ldapops.h \ tdefault.h \ Index: formfill.h =================================================================== RCS file: /cvsroot/gqclient/gq/src/formfill.h,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** formfill.h 11 Jun 2002 21:15:25 -0000 1.16 --- formfill.h 9 Jul 2002 10:43:38 -0000 1.17 *************** *** 53,56 **** --- 53,58 ---- #endif + # define DISPLAYTYPE_TIME 10 + #define FLAG_NOT_IN_SCHEMA 0x01 #define FLAG_MUST_IN_SCHEMA 0x02 Index: syntax.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/syntax.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** syntax.c 9 Jul 2002 10:35:42 -0000 1.12 --- syntax.c 9 Jul 2002 10:43:38 -0000 1.13 *************** *** 52,55 **** --- 52,56 ---- #include "dt_cert.h" #include "dt_crl.h" + #include "dt_time.h" /* Syntaxes we recognize and may handle specially. This is a rather *************** *** 202,206 **** { "1.3.6.1.4.1.1466.115.121.1.24", "Generalized Time", ! DISPLAYTYPE_ENTRY, NULL, 0, --- 203,207 ---- { "1.3.6.1.4.1.1466.115.121.1.24", "Generalized Time", ! DISPLAYTYPE_TIME, NULL, 0, *************** *** 379,383 **** { "1.3.6.1.4.1.1466.115.121.1.53", "UTC Time", ! DISPLAYTYPE_ENTRY, NULL, 0, --- 380,384 ---- { "1.3.6.1.4.1.1466.115.121.1.53", "UTC Time", ! DISPLAYTYPE_TIME, NULL, 0, *************** *** 496,499 **** --- 497,501 ---- add_syntax(DISPLAYTYPE_CRL, dt_crl_get_handler()); #endif + add_syntax(DISPLAYTYPE_TIME, dt_time_get_handler()); } |
From: <sta...@us...> - 2002-07-09 10:41:56
|
Update of /cvsroot/gqclient/gq/src In directory usw-pr-cvs1:/tmp/cvs-serv21608 Modified Files: input.c Log Message: * Added the change-displaytype-on-the-fly feature. This is how it works: - Right click on the label of an attribute in the browser - select the new displaytype from the pop-up menu - Enjoy (Watch out: some combinations of old/new displaytypes currently cause gq to crash. This requires changes to existing displaytypes scheduled for the near future) Index: input.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/input.c,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** input.c 18 Jun 2002 22:07:14 -0000 1.38 --- input.c 9 Jul 2002 10:41:52 -0000 1.39 *************** *** 236,239 **** --- 236,332 ---- } + static void change_dt(GtkWidget *menu_item, display_type_handler *new_h) + { + struct formfill *form = gtk_object_get_data(GTK_OBJECT(menu_item), + "formfill"); + + if (form && new_h) { + GByteArray *d; + GList *l, *newlist = NULL; + display_type_handler *old_h = form->dt_handler; + + /* printf("change displaytype of %s to %s\n", */ + /* form->attrname, new_h->name); */ + + /* walk the list of widgets */ + for ( l = form->widgetList ; l ; l = l->next) { + GtkWidget *w = (GtkWidget *) l->data; + if (!w) continue; + + /* retrieve "old" data */ + form->dt_handler = old_h; + d = old_h->get_data(form, w); + gtk_widget_destroy(w); + + /* create new widget */ + form->dt_handler = new_h; + w = new_h->get_widget(form, d, NULL, NULL); + + gtk_widget_show(w); + + gtk_object_set_data(GTK_OBJECT(w), + "formfill", form); + + gtk_box_pack_start(GTK_BOX(form->vbox), w, TRUE, TRUE, 0); + + /* insert into browser */ + newlist = g_list_append(newlist, w); + } + g_list_free(form->widgetList); + form->widgetList = newlist; + } + } + + static gboolean widget_button_press(GtkWidget *widget, + GdkEventButton *event, + struct formfill *form) + { + if (event->type == GDK_BUTTON_PRESS && event->button == 3) { + GtkWidget *menu_item, *menu, *label; + GtkWidget *root_menu; + GList *dt_list; + + root_menu = gtk_menu_item_new_with_label("Root"); + gtk_widget_show(root_menu); + menu = gtk_menu_new(); + gtk_menu_item_set_submenu(GTK_MENU_ITEM(root_menu), menu); + + label = gtk_menu_item_new_with_label(_("Select display type")); + gtk_widget_set_sensitive(label, FALSE); + gtk_widget_show(label); + + gtk_menu_append(GTK_MENU(menu), label); + gtk_menu_set_title(GTK_MENU(menu), _("Select display type")); + + menu_item = gtk_tearoff_menu_item_new(); + gtk_menu_append(GTK_MENU(menu), menu_item); + gtk_widget_set_sensitive(menu_item, FALSE); + gtk_widget_show(menu_item); + + dt_list = get_selectable_displaytypes(); + while(dt_list) { + display_type_handler *h = + (display_type_handler *) dt_list->data; + + menu_item = gtk_menu_item_new_with_label(h->name); + gtk_object_set_data(GTK_OBJECT(menu_item), "formfill", form); + /* gtk_object_set_data(GTK_OBJECT(menu_item), "entry", entry); */ + gtk_menu_append(GTK_MENU(menu), menu_item); + gtk_signal_connect(GTK_OBJECT(menu_item), "activate", + GTK_SIGNAL_FUNC(change_dt), + (gpointer) h); + gtk_widget_show(menu_item); + + dt_list = dt_list->next; + } + + gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, + event->button, event->time); + + return(TRUE); + } + return FALSE; + } + void build_or_update_inputform(GHashTable *hash, gboolean build) *************** *** 286,290 **** inputbox = gtk_entry_new(); gtk_widget_show(inputbox); ! gtk_object_set_data(GTK_OBJECT(inputbox), "displaytype", GINT_TO_POINTER(DISPLAYTYPE_DN)); gtk_table_attach(GTK_TABLE(target_table), inputbox, 1, 2, 0, 1, GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 0, 0); --- 379,383 ---- inputbox = gtk_entry_new(); gtk_widget_show(inputbox); ! gtk_table_attach(GTK_TABLE(target_table), inputbox, 1, 2, 0, 1, GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 0, 0); *************** *** 312,322 **** if (build || form->label == NULL) { /* attribute name */ ! form->label = label = gtk_label_new(form->attrname); ! gtk_misc_set_alignment(GTK_MISC(label), LABEL_JUSTIFICATION, .5); gtk_widget_show(label); gtk_table_attach(GTK_TABLE(target_table), label, 0, 1, row, row + 1, ! GTK_FILL, 0, 0, 0); row_arrow = row; --- 405,433 ---- 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_EXPAND, ! GTK_FILL|GTK_EXPAND, ! 0, 0); row_arrow = row; *************** *** 363,372 **** hash); /* printf("creating widget %08x\n", widget); */ gtk_widget_show(widget); gtk_object_set_data(GTK_OBJECT(widget), "formfill", form); - gtk_object_set_data(GTK_OBJECT(widget), "displaytype", - GINT_TO_POINTER(form->displaytype)); gtk_box_pack_start(GTK_BOX(form->vbox), widget, TRUE, TRUE, 0); --- 474,482 ---- hash); /* printf("creating widget %08x\n", widget); */ + gtk_widget_show(widget); gtk_object_set_data(GTK_OBJECT(widget), "formfill", form); gtk_box_pack_start(GTK_BOX(form->vbox), widget, TRUE, TRUE, 0); |
From: <sta...@us...> - 2002-07-09 10:35:47
|
Update of /cvsroot/gqclient/gq/src In directory usw-pr-cvs1:/tmp/cvs-serv19435 Modified Files: syntax.c Log Message: * Added necessary code to collect "selectable" displaytypes in a separate list Index: syntax.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/syntax.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** syntax.c 13 Jun 2002 19:09:27 -0000 1.11 --- syntax.c 9 Jul 2002 10:35:42 -0000 1.12 *************** *** 444,449 **** static GHashTable *dt_handlers = NULL; ! void add_syntax(int type, display_type_handler *dt_handler) { int *p = (int *) g_malloc(sizeof(int)); /* leak memory */ *p = type; --- 444,451 ---- static GHashTable *dt_handlers = NULL; + static GList *selectable_dt_list = NULL; ! void add_syntax(int type, display_type_handler *dt_handler) ! { int *p = (int *) g_malloc(sizeof(int)); /* leak memory */ *p = type; *************** *** 452,456 **** --- 454,468 ---- dt_handlers = g_hash_table_new(g_int_hash, g_int_equal); } + g_hash_table_insert(dt_handlers, p, dt_handler); + + if (dt_handler->selectable) { + selectable_dt_list = g_list_append(selectable_dt_list, dt_handler); + } + } + + GList *get_selectable_displaytypes() + { + return selectable_dt_list; } |
Update of /cvsroot/gqclient/gq/src In directory usw-pr-cvs1:/tmp/cvs-serv18013 Modified Files: dt_binary.c dt_cert.c dt_clist.c dt_crl.c dt_entry.c dt_generic_binary.c dt_jpeg.c dt_oc.c dt_password.c dt_text.c Log Message: * Added "name" and "selectable" information Index: dt_binary.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/dt_binary.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** dt_binary.c 18 Jun 2002 22:07:14 -0000 1.8 --- dt_binary.c 9 Jul 2002 10:31:11 -0000 1.9 *************** *** 66,69 **** --- 66,70 ---- static dt_binary_handler dt_binary_handler_vtab = { { + "Binary", TRUE, dt_binary_get_widget, /* reused from dt_generic_binary */ dt_binary_get_data, Index: dt_cert.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/dt_cert.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** dt_cert.c 27 Jun 2002 20:01:26 -0000 1.4 --- dt_cert.c 9 Jul 2002 10:31:11 -0000 1.5 *************** *** 70,73 **** --- 70,74 ---- { { + "Certificate", TRUE, dt_clist_get_widget, dt_clist_get_data, Index: dt_clist.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/dt_clist.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** dt_clist.c 11 Jun 2002 21:15:25 -0000 1.1 --- dt_clist.c 9 Jul 2002 10:31:11 -0000 1.2 *************** *** 59,62 **** --- 59,63 ---- { { + "Column List", FALSE, dt_clist_get_widget, dt_clist_get_data, Index: dt_crl.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/dt_crl.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** dt_crl.c 27 Jun 2002 20:01:26 -0000 1.2 --- dt_crl.c 9 Jul 2002 10:31:11 -0000 1.3 *************** *** 69,72 **** --- 69,73 ---- { { + "Certificate Revocation List", TRUE, dt_clist_get_widget, dt_clist_get_data, Index: dt_entry.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/dt_entry.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** dt_entry.c 5 Jun 2002 15:14:52 -0000 1.5 --- dt_entry.c 9 Jul 2002 10:31:11 -0000 1.6 *************** *** 54,57 **** --- 54,58 ---- static dt_entry_handler dt_entry_handler_vtab = { { + "Entry", TRUE, dt_entry_get_widget, dt_entry_get_data, Index: dt_generic_binary.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/dt_generic_binary.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** dt_generic_binary.c 11 Jun 2002 20:30:57 -0000 1.6 --- dt_generic_binary.c 9 Jul 2002 10:31:11 -0000 1.7 *************** *** 64,67 **** --- 64,68 ---- static dt_generic_binary_handler dt_generic_binary_handler_vtab = { { + "Generic Binary", FALSE, dt_generic_binary_get_widget, NULL, Index: dt_jpeg.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/dt_jpeg.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** dt_jpeg.c 9 Jun 2002 13:26:28 -0000 1.6 --- dt_jpeg.c 9 Jul 2002 10:31:11 -0000 1.7 *************** *** 58,61 **** --- 58,62 ---- static dt_jpeg_handler dt_jpeg_handler_vtab = { { /* dt_handler */ + "JPEG", TRUE, dt_generic_binary_get_widget, /* reused from dt_generic_binary */ dt_jpeg_get_data, Index: dt_oc.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/dt_oc.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** dt_oc.c 18 Jun 2002 21:52:42 -0000 1.11 --- dt_oc.c 9 Jul 2002 10:31:11 -0000 1.12 *************** *** 60,63 **** --- 60,64 ---- static dt_oc_handler dt_oc_handler_vtab = { { + "Objectclass", FALSE, dt_oc_get_widget, dt_oc_get_data, Index: dt_password.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/dt_password.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** dt_password.c 16 Apr 2002 08:28:23 -0000 1.6 --- dt_password.c 9 Jul 2002 10:31:11 -0000 1.7 *************** *** 85,88 **** --- 85,89 ---- static dt_password_handler dt_password_handler_vtab = { { + "Password", TRUE, dt_password_get_widget, dt_password_get_data, Index: dt_text.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/dt_text.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** dt_text.c 8 Apr 2002 06:19:56 -0000 1.4 --- dt_text.c 9 Jul 2002 10:31:11 -0000 1.5 *************** *** 53,56 **** --- 53,57 ---- static dt_text_handler dt_text_handler_vtab = { { + "Multi-line Text", TRUE, dt_text_get_widget, dt_entry_get_data, /* reuse method from dt_entry */ |
From: <sta...@us...> - 2002-07-09 10:28:03
|
Update of /cvsroot/gqclient/gq/src In directory usw-pr-cvs1:/tmp/cvs-serv17254 Modified Files: syntax.h Log Message: * Preparation for the new "change display-type on-the-fly" feature. Every displaytype handler now has its own name (still need to think about I18N) and the information if it should be selectable or not (partially because it may be abstract). * Now all the "selectable" displaytypes are also kept in a GList accessible via get_selectable_displaytypes() Index: syntax.h =================================================================== RCS file: /cvsroot/gqclient/gq/src/syntax.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** syntax.h 8 Jun 2002 05:46:44 -0000 1.5 --- syntax.h 9 Jul 2002 10:27:58 -0000 1.6 *************** *** 44,47 **** --- 44,49 ---- typedef struct _display_type_handler { + char *name; + gboolean selectable; GtkWidget* (*get_widget)(struct formfill *form, GByteArray *data, *************** *** 70,73 **** --- 72,78 ---- void init_syntaxes(void); + + /* Return a list of _display_type_handler objects selectable by the user */ + GList *get_selectable_displaytypes(); /* Utility functions */ |
From: Peter S. <pe...@st...> - 2002-07-05 06:51:43
|
At least one commitinfo message was lost due to problems with mailing at sourceforge. Unfortunately it was the message containing Changelog changes and the bumping up of the version number to 0.6.0... peter |
From: <sta...@us...> - 2002-07-03 20:56:54
|
Update of /cvsroot/gqclient/gq/po In directory usw-pr-cvs1:/tmp/cvs-serv29509 Modified Files: de.po Log Message: * Updated message strings Index: de.po =================================================================== RCS file: /cvsroot/gqclient/gq/po/de.po,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** de.po 18 Jun 2002 22:16:17 -0000 1.7 --- de.po 3 Jul 2002 20:56:51 -0000 1.8 *************** *** 6,10 **** msgstr "" "Project-Id-Version: gq 0.5.0\n" ! "POT-Creation-Date: 2002-06-18 23:40+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-07-03 22:48+0200\n" "PO-Revision-Date: 2002-04-21 16:10+MEST\n" [...1054 lines suppressed...] --- 1082,1100 ---- msgstr "Seriennummer" ! #: src/dt_cert.c:226 src/dt_crl.c:208 msgid "Version" msgstr "Version" ! #: src/dt_crl.c:168 msgid "Last update" msgstr "Letzter Update" ! #: src/dt_crl.c:176 msgid "Next update" msgstr "Nächster Update" ! #. NOTE: we do _not_ have to free rev, it is part ! #. of the CRL itself ! #: src/dt_crl.c:185 ! msgid "Number of revoked certificates" ! msgstr "Anzahl zurückgezogener Zertifikate" |
From: <sta...@us...> - 2002-07-03 20:56:28
|
Update of /cvsroot/gqclient/gq In directory usw-pr-cvs1:/tmp/cvs-serv29042 Modified Files: TODO Log Message: * More TODOs, this is now also the roadmap, as I do not want to have the same information duplicated in some ROADMAP file. Index: TODO =================================================================== RCS file: /cvsroot/gqclient/gq/TODO,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** TODO 27 Jun 2002 08:27:24 -0000 1.24 --- TODO 3 Jul 2002 20:56:25 -0000 1.25 *************** *** 1,2 **** --- 1,6 ---- + TODO list and ROADMAP + + NOTE: [1.0] denotes features to be implemented for 1.0 + INTERESTING BUGS *************** *** 17,26 **** * Take care of possible buffer overflow situations. Pointed out by Bernhard Reiter <ber...@in...>. ! * Better error reporting of LDAP error situations. Currently we handle LDAP_SUCCESS and LDAP_SERVER_DOWN but ignore the rest. Pointed out indirectly by Bernhard Reiter <ber...@in...>. ! * Fix dt_password.c: handling of the construction of encoded passwords (get rid of any strcpy, strcat and only using GByteArray methods) ! * Think about the moving stuff in browse mode: Either - Should move deletion out of the moving business and delay --- 21,30 ---- * Take care of possible buffer overflow situations. Pointed out by Bernhard Reiter <ber...@in...>. ! * [1.0] Better error reporting of LDAP error situations. Currently we handle 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 - Should move deletion out of the moving business and delay *************** *** 41,45 **** ENHANCEMENTS ! * Follow referrals * put up rootDSE info in browse mode's server detail (cn=monitor?) * take schema from entry (done?) --- 45,51 ---- ENHANCEMENTS ! * [1.0] Follow referrals ! - 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?) *************** *** 47,53 **** * import from LDIF * Better keyboard support (at least for main menu) (peter) ! * never do ldap_add when moving trees. Use triangulation like with the towers of hanoi ! BLUE SKY --- 53,70 ---- * 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 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 ! allows to take care of hidden attributes implicitly ! * Rewrite the schema browser to also use the GtkCTree widget. ! * [1.0] Improve LDAP error reporting BLUE SKY |
From: <sta...@us...> - 2002-07-03 20:53:19
|
Update of /cvsroot/gqclient/gq/src In directory usw-pr-cvs1:/tmp/cvs-serv27814 Modified Files: prefs.c Log Message: * Added another password field to have the user enter the password twice * Added the code to require matching passwords Index: prefs.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/prefs.c,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** prefs.c 3 Jul 2002 20:13:05 -0000 1.22 --- prefs.c 3 Jul 2002 20:53:16 -0000 1.23 *************** *** 60,64 **** struct ldapserver *server, *servers; int server_name_changed; ! char *text, *passwdtext; #if HAVE_LDAP_CLIENT_CACHE char *ep; --- 60,65 ---- struct ldapserver *server, *servers; int server_name_changed; ! char *text, *passwdtext, *passwdtext2; ! gboolean passwdmatch; #if HAVE_LDAP_CLIENT_CACHE char *ep; *************** *** 74,82 **** passwdtext = gtk_entry_get_text(GTK_ENTRY(field)); if (passwdtext && strlen(passwdtext) > 0) { int rc = question_popup(_("Warning: Cleartext password"), _("The password you have entered will be stored as clear text in your\n" ! "HOME directory in the file " RCFILE ". This file will not be readable\n" "by anybody else (except the system administrator), but you may\n" "nevertheless prefer to not store your bind password as clear text.\n\n" --- 75,99 ---- passwdtext = gtk_entry_get_text(GTK_ENTRY(field)); + field = get_widget(window, "bindpw2"); + passwdtext2 = gtk_entry_get_text(GTK_ENTRY(field)); + + if (passwdtext == NULL && passwdtext2 == NULL) { + passwdmatch = TRUE; + } else if (passwdtext && passwdtext2) { + passwdmatch = strcmp(passwdtext, passwdtext2) == 0; + } else { /* one is missing */ + passwdmatch = FALSE; + } + + if (!passwdmatch) { + single_warning_popup(_("Passwords do not match")); + return; + } + if (passwdtext && strlen(passwdtext) > 0) { int rc = question_popup(_("Warning: Cleartext password"), _("The password you have entered will be stored as clear text in your\n" ! "HOME directory in the file .gq. This file will not be readable\n" "by anybody else (except the system administrator), but you may\n" "nevertheless prefer to not store your bind password as clear text.\n\n" *************** *** 236,242 **** } ! static void ask_pw_toggled(GtkToggleButton *button, GtkWidget *bindpw) { ! gtk_widget_set_sensitive(bindpw, !gtk_toggle_button_get_active(button)); } --- 253,263 ---- } ! static void ask_pw_toggled(GtkToggleButton *button, GtkWidget *window) { ! GtkWidget *field = get_widget(window, "bindpw"); ! gtk_widget_set_sensitive(field, !gtk_toggle_button_get_active(button)); ! ! field = get_widget(window, "bindpw2"); ! gtk_widget_set_sensitive(field, !gtk_toggle_button_get_active(button)); } *************** *** 249,253 **** GtkWidget *label, *entry, *button; GtkWidget *okbutton, *cancelbutton; ! GtkWidget *bindpw; int y, editing_new_server; char title[MAX_SERVERNAME_LEN + 8]; --- 270,274 ---- GtkWidget *label, *entry, *button; GtkWidget *okbutton, *cancelbutton; ! GtkWidget *bindpw, *bindpw2; int y, editing_new_server; char title[MAX_SERVERNAME_LEN + 8]; *************** *** 433,436 **** --- 454,478 ---- y++; + /* Bind Password (again)*/ + label = gtk_label_new(_("Bind Password (again)")); + gtk_misc_set_alignment(GTK_MISC(label), 0.0, .5); + gtk_widget_show(label); + gtk_table_attach(GTK_TABLE(table2), label, 0, 1, y, y + 1, + GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + + bindpw2 = entry = gtk_entry_new(); + /* Follow the suggestion of Jacek Konieczny <ja...@bn...>, + (even though Bert won't like it[?]) and do not show the password + in cleartext... */ + gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE); + gtk_object_set_data(GTK_OBJECT(editwindow), "bindpw2", entry); + gtk_entry_set_text(GTK_ENTRY(entry), server->bindpw); + gtk_widget_show(entry); + gtk_signal_connect(GTK_OBJECT(entry), "activate", + GTK_SIGNAL_FUNC(server_edit_callback), server); + gtk_table_attach(GTK_TABLE(table2), entry, 1, 2, y, y + 1, + GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + y++; + /* Bind type */ label = gtk_label_new(_("Bind type")); *************** *** 522,525 **** --- 564,568 ---- gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_set_sensitive(GTK_WIDGET(bindpw), FALSE); + gtk_widget_set_sensitive(GTK_WIDGET(bindpw2), FALSE); } |
From: <sta...@us...> - 2002-07-03 20:13:08
|
Update of /cvsroot/gqclient/gq/src In directory usw-pr-cvs1:/tmp/cvs-serv14628 Modified Files: prefs.c util.c util.h Log Message: * Passwort fields now do not show passwords in clear text - suggested by Jacek Konieczny <ja...@bn...> (followed by a discussion) This is against a former point-of-view to not create the impression that passwords are safe when given to gq (They are not!). This dilemma is solved by popping up a warning when a password is entered in the preferences window. There will be a (backwards compatible) change to the configfile in a future release: we eill encode the password to hide it from occasional glances on the config file. Index: prefs.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/prefs.c,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** prefs.c 18 Jun 2002 22:07:14 -0000 1.21 --- prefs.c 3 Jul 2002 20:13:05 -0000 1.22 *************** *** 60,72 **** struct ldapserver *server, *servers; int server_name_changed; ! char *text; #if HAVE_LDAP_CLIENT_CACHE char *ep; int tmp; #endif ! server = data; window = current_edit_server_window; /* Name */ field = get_widget(window, "servername"); --- 60,91 ---- struct ldapserver *server, *servers; int server_name_changed; ! char *text, *passwdtext; #if HAVE_LDAP_CLIENT_CACHE char *ep; int tmp; #endif ! server = data; window = current_edit_server_window; + /* Bind Password - retrieve asap, as we might pop up a warning + regarding cleartext passwords in .gq */ + field = get_widget(window, "bindpw"); + passwdtext = gtk_entry_get_text(GTK_ENTRY(field)); + + if (passwdtext && strlen(passwdtext) > 0) { + int rc = + question_popup(_("Warning: Cleartext password"), + _("The password you have entered will be stored as clear text in your\n" + "HOME directory in the file " RCFILE ". This file will not be readable\n" + "by anybody else (except the system administrator), but you may\n" + "nevertheless prefer to not store your bind password as clear text.\n\n" + "Do you want to store your bind password as clear text?")); + if (!rc) { + return; + } + } + + /* Name */ field = get_widget(window, "servername"); *************** *** 114,120 **** /* Bind Password */ ! field = get_widget(window, "bindpw"); ! text = gtk_entry_get_text(GTK_ENTRY(field)); ! strncpy(server->bindpw, text, MAX_BINDPW_LEN); /* Search attribute */ --- 133,137 ---- /* Bind Password */ ! strncpy(server->bindpw, passwdtext, MAX_BINDPW_LEN); /* Search attribute */ *************** *** 219,222 **** --- 236,244 ---- } + static void ask_pw_toggled(GtkToggleButton *button, GtkWidget *bindpw) + { + gtk_widget_set_sensitive(bindpw, !gtk_toggle_button_get_active(button)); + } + void create_edit_server_window(struct ldapserver *server) *************** *** 227,230 **** --- 249,253 ---- GtkWidget *label, *entry, *button; GtkWidget *okbutton, *cancelbutton; + GtkWidget *bindpw; int y, editing_new_server; char title[MAX_SERVERNAME_LEN + 8]; *************** *** 396,400 **** GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); ! entry = gtk_entry_new(); gtk_object_set_data(GTK_OBJECT(editwindow), "bindpw", entry); gtk_entry_set_text(GTK_ENTRY(entry), server->bindpw); --- 419,427 ---- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); ! bindpw = entry = gtk_entry_new(); ! /* Follow the suggestion of Jacek Konieczny <ja...@bn...>, ! (even though Bert won't like it[?]) and do not show the password ! in cleartext... */ ! gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE); gtk_object_set_data(GTK_OBJECT(editwindow), "bindpw", entry); gtk_entry_set_text(GTK_ENTRY(entry), server->bindpw); *************** *** 492,497 **** button = gtk_check_button_new_with_label(_("Ask password on first connect")); gtk_object_set_data(GTK_OBJECT(editwindow), "ask_pw", button); ! if(server->ask_pw) gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), TRUE); GTK_WIDGET_UNSET_FLAGS(GTK_CHECK_BUTTON(button), GTK_CAN_FOCUS); gtk_widget_show(button); --- 519,530 ---- button = gtk_check_button_new_with_label(_("Ask password on first connect")); gtk_object_set_data(GTK_OBJECT(editwindow), "ask_pw", button); ! if(server->ask_pw) { gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), TRUE); + gtk_widget_set_sensitive(GTK_WIDGET(bindpw), FALSE); + } + + gtk_signal_connect(GTK_OBJECT(button), "toggled", + GTK_SIGNAL_FUNC(ask_pw_toggled), bindpw); + GTK_WIDGET_UNSET_FLAGS(GTK_CHECK_BUTTON(button), GTK_CAN_FOCUS); gtk_widget_show(button); Index: util.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/util.c,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** util.c 27 Jun 2002 08:20:23 -0000 1.40 --- util.c 3 Jul 2002 20:13:05 -0000 1.41 *************** *** 255,259 **** if (server->ask_pw && server->binddn[0] != 0 && /* makes sense only if we bind as someone */ ! server->bindpw[0] == 0 && server->enteredpw[0] == 0) { char *ret; --- 255,259 ---- if (server->ask_pw && server->binddn[0] != 0 && /* makes sense only if we bind as someone */ ! /* server->bindpw[0] == 0 && */ server->enteredpw[0] == 0) { char *ret; *************** *** 261,265 **** _("Password for server %s"), server->ldaphost); ! if (query_popup(message, &ret)) { if (ret) { strncpy(server->enteredpw, ret, --- 261,265 ---- _("Password for server %s"), server->ldaphost); ! if (query_popup(message, &ret, TRUE /* is_password */)) { if (ret) { strncpy(server->enteredpw, ret, *************** *** 1151,1155 **** functions waits for the data and puts it into outbuf. */ ! int query_popup(const char *title, gchar **outbuf) { GtkWidget *window, *vbox1, *vbox2, *label, *inputbox, *button, *hbox0; --- 1151,1155 ---- functions waits for the data and puts it into outbuf. */ ! int query_popup(const char *title, gchar **outbuf, gboolean is_password) { GtkWidget *window, *vbox1, *vbox2, *label, *inputbox, *button, *hbox0; *************** *** 1195,1198 **** --- 1195,1201 ---- GTK_WIDGET_SET_FLAGS(inputbox, GTK_CAN_FOCUS); GTK_WIDGET_SET_FLAGS(inputbox, GTK_CAN_DEFAULT); + if (is_password) { + gtk_entry_set_visibility(GTK_ENTRY(inputbox), FALSE); + } gtk_widget_show(inputbox); gtk_signal_connect(GTK_OBJECT(inputbox), "activate", Index: util.h =================================================================== RCS file: /cvsroot/gqclient/gq/src/util.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** util.h 21 Jun 2002 00:34:32 -0000 1.15 --- util.h 3 Jul 2002 20:13:05 -0000 1.16 *************** *** 70,74 **** void dump_mods(LDAPMod **mods); const char *find_s_by_at_oid(struct ldapserver *server, const char *oid); ! int query_popup(const char *title, gchar **outbuf); int question_popup(const char *title, const char *question); --- 70,74 ---- void dump_mods(LDAPMod **mods); const char *find_s_by_at_oid(struct ldapserver *server, const char *oid); ! int query_popup(const char *title, gchar **outbuf, gboolean is_password); int question_popup(const char *title, const char *question); |