gqclient-commit Mailing List for GQ LDAP client (Page 11)
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...> - 2003-10-05 13:47:49
|
Update of /cvsroot/gqclient/gq/src In directory sc8-pr-cvs1:/tmp/cvs-serv6032 Modified Files: search.c Log Message: * Got rid of most hand-knit linked list implementations, replaced them with GLists (errorchains, config->ldapservers, etc.) * Got rid of many, many fixed size buffers. These might have been problematic with variable length characters (as in the standard UTF-8 encoding) * UTF-8 safety improvements Index: search.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/search.c,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** search.c 4 Oct 2003 10:12:02 -0000 1.39 --- search.c 5 Oct 2003 13:47:43 -0000 1.40 *************** *** 45,50 **** #include "i18n.h" #include "browse.h" ! ! void find_in_browser(struct tab *tab); --- 45,49 ---- #include "i18n.h" #include "browse.h" ! #include "utf8-compat.h" void find_in_browser(struct tab *tab); *************** *** 108,113 **** searchbase_combo = gtk_combo_new(); ! if(config->ldapservers) ! gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(searchbase_combo)->entry), config->ldapservers->basedn); gtk_box_pack_start(GTK_BOX(hbox1), searchbase_combo, FALSE, TRUE, 0); --- 107,113 ---- searchbase_combo = gtk_combo_new(); ! if(config->servers) ! gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(searchbase_combo)->entry), ! ((struct ldapserver *)config->servers->data)->basedn); gtk_box_pack_start(GTK_BOX(hbox1), searchbase_combo, FALSE, TRUE, 0); *************** *** 352,382 **** char *make_filter(struct ldapserver *server, char *querystring) { ! char *filter; ! ! filter = malloc(MAX_LDAPFILTER_LEN); ! if(querystring[0] == '(') { ! strncpy(filter, querystring, MAX_LDAPFILTER_LEN - 1); } ! else if(strchr(querystring, '=')) { ! snprintf(filter, MAX_LDAPFILTER_LEN - 1, "(%s)", querystring); } else { switch(config->search_argument) { case SEARCHARG_BEGINS_WITH: ! snprintf(filter, MAX_LDAPFILTER_LEN - 1, "(%s=%s*)", server->searchattr, querystring); break; case SEARCHARG_ENDS_WITH: ! snprintf(filter, MAX_LDAPFILTER_LEN - 1, "(%s=*%s)", server->searchattr, querystring); break; case SEARCHARG_CONTAINS: ! snprintf(filter, MAX_LDAPFILTER_LEN - 1, "(%s=*%s*)", server->searchattr, querystring); break; case SEARCHARG_EQUALS: ! snprintf(filter, MAX_LDAPFILTER_LEN - 1, "(%s=%s)", server->searchattr, querystring); break; }; } - filter[MAX_LDAPFILTER_LEN - 1] = 0; return(filter); --- 352,388 ---- char *make_filter(struct ldapserver *server, char *querystring) { ! char *filter = NULL; ! int l = strlen(querystring); ! if(querystring[0] == '(') { /* UTF-8 OK */ ! filter = g_strdup(querystring); } ! else if(g_utf8_strchr(querystring, -1, '=')) { ! filter = g_malloc(l); ! snprintf(filter, l, "(%s)", querystring); } else { + int sl = strlen(server->searchattr); + l += sl + 10; + filter = g_malloc(l + 1); + switch(config->search_argument) { case SEARCHARG_BEGINS_WITH: ! snprintf(filter, l, "(%s=%s*)", server->searchattr, querystring); break; case SEARCHARG_ENDS_WITH: ! snprintf(filter, l, "(%s=*%s)", server->searchattr, querystring); break; case SEARCHARG_CONTAINS: ! snprintf(filter, l, "(%s=*%s*)", server->searchattr, querystring); break; case SEARCHARG_EQUALS: ! snprintf(filter, l, "(%s=%s)", server->searchattr, querystring); ! break; ! default: ! filter[0] = 0; break; }; } return(filter); *************** *** 420,427 **** gchar *cur_servername, *cur_searchbase, *enc_searchbase, *querystring, *cl[MAX_NUM_ATTRIBUTES]; char tolist[MAX_NUM_ATTRIBUTES][128], message[MAX_LDAPFILTER_LEN + 128]; ! char *filter, *attr, *dn, **vals, *searchterm, *decoded_value; int msg, rc, i, row; int cur_col, oc_col, columns_done[MAX_NUM_ATTRIBUTES]; ! if(SEARCHTAB(tab)->search_lock) return; --- 426,435 ---- gchar *cur_servername, *cur_searchbase, *enc_searchbase, *querystring, *cl[MAX_NUM_ATTRIBUTES]; char tolist[MAX_NUM_ATTRIBUTES][128], message[MAX_LDAPFILTER_LEN + 128]; ! char *filter, *attr, *dn, **vals, *searchterm; int msg, rc, i, row; int cur_col, oc_col, columns_done[MAX_NUM_ATTRIBUTES]; ! #if GTK_MAJOR < 2 ! char *decoded_value; ! #endif if(SEARCHTAB(tab)->search_lock) return; |
From: <sta...@us...> - 2003-10-05 13:46:56
|
Update of /cvsroot/gqclient/gq/src In directory sc8-pr-cvs1:/tmp/cvs-serv6004 Modified Files: schemabrowse.c Log Message: * Got rid of most hand-knit linked list implementations, replaced them with GLists (errorchains, config->ldapservers, etc.) Index: schemabrowse.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/schemabrowse.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** schemabrowse.c 4 Oct 2003 10:09:39 -0000 1.17 --- schemabrowse.c 5 Oct 2003 13:46:50 -0000 1.18 *************** *** 111,119 **** { struct ldapserver *server; ! int server_cnt; char message[128]; ! ! server_cnt = 0; ! for (server = config->ldapservers ; server ; server = server->next) { add_single_schema_server(tab, server); server_cnt++; --- 111,120 ---- { struct ldapserver *server; ! int server_cnt = 0; char message[128]; ! GList *I; ! ! for (I = config->servers ; I ; I = g_list_next(I)) { ! server = (struct ldapserver *) I->data; add_single_schema_server(tab, server); server_cnt++; *************** *** 374,378 **** if(tree) { ! /* thi#s is a workaround -- lots of GTK warnings if I don't do this :-( */ sel = GTK_TREE_SELECTION(tree); while(sel) { --- 375,379 ---- if(tree) { ! /* this is a workaround -- lots of GTK warnings if I don't do this :-( */ sel = GTK_TREE_SELECTION(tree); while(sel) { |
From: <sta...@us...> - 2003-10-05 13:46:02
|
Update of /cvsroot/gqclient/gq/src In directory sc8-pr-cvs1:/tmp/cvs-serv5665 Modified Files: prefs.c Log Message: * Fixed a recently introduced bug in the server preferences wrt LDAP URI detection (stupid) * Many object types now have constructors and destructors of the form new_<type> and free_<type>. Use them instead of self-allocating and freeing memory as it was done before. Removed all such old style object handling * Got rid of most hand-knit linked list implementations, replaced them with GLists (errorchains, config->ldapservers, etc.) * UTF-8 safety improvements Index: prefs.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/prefs.c,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** prefs.c 4 Oct 2003 09:59:09 -0000 1.33 --- prefs.c 5 Oct 2003 13:45:58 -0000 1.34 *************** *** 47,50 **** --- 47,51 ---- #include "input.h" #include "browse.h" + #include "utf8-compat.h" struct ldapserver *current_selected_server = NULL; *************** *** 74,78 **** if (cb_data) { if (cb_data->edit_new_server) { ! if (cb_data->server) delete_ldapserver(cb_data->server); } g_free(cb_data); --- 75,82 ---- if (cb_data) { if (cb_data->edit_new_server) { ! if (cb_data->server) { ! config_remove_server(config, cb_data->server); ! free_ldapserver(cb_data->server); ! } } g_free(cb_data); *************** *** 91,94 **** --- 95,99 ---- int tmp; #endif + GList *I; server = cb_data->server; *************** *** 137,145 **** else server_name_changed = 0; ! strncpy(server->name, text, MAX_SERVERNAME_LEN); /* make sure server name is unique */ ! servers = config->ldapservers; ! while(servers->next) { if(server != servers) { if(!strcmp(servers->name, server->name)) { --- 142,153 ---- else server_name_changed = 0; ! ! g_free_and_dup(server->name, text); /* make sure server name is unique */ ! ! for (I = config->servers ; I ; I = g_list_next(I)) { ! servers = (struct ldapserver *) I->data; ! if(server != servers) { if(!strcmp(servers->name, server->name)) { *************** *** 151,155 **** } } - servers = servers->next; } --- 159,162 ---- *************** *** 157,161 **** field = get_widget(window, "ldaphost"); text = gtk_entry_get_text(GTK_ENTRY(field)); ! strncpy(server->ldaphost, text, MAX_HOSTNAME_LEN); /* LDAP port */ --- 164,168 ---- field = get_widget(window, "ldaphost"); text = gtk_entry_get_text(GTK_ENTRY(field)); ! g_free_and_dup(server->ldaphost, text); /* LDAP port */ *************** *** 177,194 **** field = get_widget(window, "basedn"); text = gtk_entry_get_text(GTK_ENTRY(field)); ! strncpy(server->basedn, text, MAX_DN_LEN); /* Bind DN */ field = get_widget(window, "binddn"); text = gtk_entry_get_text(GTK_ENTRY(field)); ! strncpy(server->binddn, text, MAX_DN_LEN); /* Bind Password */ ! strncpy(server->bindpw, passwdtext, MAX_BINDPW_LEN); /* Search attribute */ field = get_widget(window, "searchattr"); text = gtk_entry_get_text(GTK_ENTRY(field)); ! strncpy(server->searchattr, text, MAX_ATTR_LEN); /* Maximum entries */ --- 184,201 ---- field = get_widget(window, "basedn"); text = gtk_entry_get_text(GTK_ENTRY(field)); ! g_free_and_dup(server->basedn, text); /* Bind DN */ field = get_widget(window, "binddn"); text = gtk_entry_get_text(GTK_ENTRY(field)); ! g_free_and_dup(server->binddn, text); /* Bind Password */ ! g_free_and_dup(server->bindpw, passwdtext); /* Search attribute */ field = get_widget(window, "searchattr"); text = gtk_entry_get_text(GTK_ENTRY(field)); ! g_free_and_dup(server->searchattr, text); /* Maximum entries */ *************** *** 267,271 **** if (s) { gtk_widget_set_sensitive(GTK_WIDGET(port), ! (strchr(s, ':') == NULL)); g_free(s); } --- 274,278 ---- if (s) { gtk_widget_set_sensitive(GTK_WIDGET(port), ! (g_utf8_strchr(s, -1, ':') == NULL)); g_free(s); } *************** *** 335,340 **** if(server == NULL) { ! server = new_ldapserver(config); ! init_ldapserver(server); } --- 342,347 ---- if(server == NULL) { ! server = new_ldapserver(); ! config_add_server(config, server); } *************** *** 450,458 **** gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); #endif - /* Callback on HOST to enable/disable port if user enters a colon... */ - - gtk_signal_connect(GTK_OBJECT(host), "changed", - GTK_SIGNAL_FUNC(host_changed_callback), entry); - /* Port */ label = gq_label_new(_("LDAP _Port")); --- 457,460 ---- *************** *** 483,486 **** --- 485,493 ---- ); + /* Callback on HOST to enable/disable PORT if user enters a colon... */ + + gtk_signal_connect(GTK_OBJECT(host), "changed", + GTK_SIGNAL_FUNC(host_changed_callback), entry); + #if GTK_MAJOR >= 2 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); *************** *** 919,924 **** void serverstab_deletebutton_callback(GtkWidget *widget, GtkWidget *widget2) { ! if(current_selected_server) { ! delete_ldapserver(current_selected_server); current_selected_server = NULL; --- 926,931 ---- void serverstab_deletebutton_callback(GtkWidget *widget, GtkWidget *widget2) { ! if (current_selected_server) { ! config_remove_server(config, current_selected_server); current_selected_server = NULL; *************** *** 984,987 **** --- 991,995 ---- int row; char *serverlist[1]; + GList *I; clist = current_serverstab_serverclist; *************** *** 993,1007 **** row = 0; ! server = config->ldapservers; ! while(server) { serverlist[0] = server->name; gtk_clist_append(GTK_CLIST(clist), serverlist); gtk_clist_set_row_data(GTK_CLIST(clist), row, (gpointer) server); - server = server->next; row++; } gtk_clist_thaw(GTK_CLIST(clist)); - } --- 1001,1015 ---- row = 0; ! ! for (I = config->servers ; I ; I = g_list_next(I)) { ! server = (struct ldapserver *) I->data; ! serverlist[0] = server->name; gtk_clist_append(GTK_CLIST(clist), serverlist); gtk_clist_set_row_data(GTK_CLIST(clist), row, (gpointer) server); row++; } gtk_clist_thaw(GTK_CLIST(clist)); } *************** *** 1062,1072 **** combo = gtk_object_get_data(GTK_OBJECT(this), "schemaserver"); ! if(combo) ! strncpy(config->schemaserver, gtk_entry_get_text(GTK_ENTRY(combo->entry)), MAX_SERVERNAME_LEN); save_config(); gtk_widget_destroy(this); - } --- 1070,1081 ---- combo = gtk_object_get_data(GTK_OBJECT(this), "schemaserver"); ! if(combo) { ! g_free_and_dup(config->schemaserver, ! gtk_entry_get_text(GTK_ENTRY(combo->entry))); ! } save_config(); gtk_widget_destroy(this); } |
From: <sta...@us...> - 2003-10-05 13:44:31
|
Update of /cvsroot/gqclient/gq/src In directory sc8-pr-cvs1:/tmp/cvs-serv5614 Modified Files: mainwin.c Log Message: * Got rid of most hand-knit linked list implementations, replaced them with GLists (errorchains, config->ldapservers, etc.) Index: mainwin.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/mainwin.c,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** mainwin.c 4 Oct 2003 10:12:02 -0000 1.35 --- mainwin.c 5 Oct 2003 13:44:21 -0000 1.36 *************** *** 91,95 **** void fill_serverlist_combo(GtkWidget *combo) { ! GList *serverlist; struct ldapserver *server; --- 91,95 ---- void fill_serverlist_combo(GtkWidget *combo) { ! GList *serverlist, *I; struct ldapserver *server; *************** *** 98,105 **** serverlist = NULL; ! server = config->ldapservers; ! while(server) { serverlist = g_list_append(serverlist, server->name); - server = server->next; } --- 98,104 ---- serverlist = NULL; ! for (I = config->servers ; I ; I = I->next) { ! server = (struct ldapserver *) I->data; serverlist = g_list_append(serverlist, server->name); } |
From: <sta...@us...> - 2003-10-05 13:44:30
|
Update of /cvsroot/gqclient/gq/src In directory sc8-pr-cvs1:/tmp/cvs-serv5548 Modified Files: ldapops.c Log Message: * now error_push allows for printf-style variable argument lists, very convenient: no more dealing with an extra message buffer for variable messages. Got rid of many such buffers Index: ldapops.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/ldapops.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** ldapops.c 18 Sep 2002 06:39:45 -0000 1.15 --- ldapops.c 5 Oct 2003 13:43:51 -0000 1.16 *************** *** 134,138 **** LDAPMod **mods; gboolean ok = TRUE; - char message[MAX_DN_LEN + 256]; char *dn_only[] = { "dn", NULL }; --- 134,137 ---- *************** *** 267,273 **** source_server->server_down++; } else { ! snprintf(message, sizeof(message), ! "%s: %s", source_dn, ldap_err2string(rc)); ! error_push(error_context, message); push_ldap_addl_error(sld, error_context); } --- 266,271 ---- source_server->server_down++; } else { ! error_push(error_context, ! "%s: %s", source_dn, ldap_err2string(rc)); push_ldap_addl_error(sld, error_context); } *************** *** 297,303 **** source_server->server_down++; } ! snprintf(message, sizeof(message), ! "%s: %s", source_dn, ldap_err2string(rc)); ! error_push(error_context, message); push_ldap_addl_error(sld, error_context); goto done; --- 295,300 ---- source_server->server_down++; } ! error_push(error_context, ! "%s: %s", source_dn, ldap_err2string(rc)); push_ldap_addl_error(sld, error_context); goto done; |
From: <sta...@us...> - 2003-10-05 13:43:44
|
Update of /cvsroot/gqclient/gq/src In directory sc8-pr-cvs1:/tmp/cvs-serv5520 Modified Files: input.c Log Message: * now error_push allows for printf-style variable argument lists, very convenient: no more dealing with an extra message buffer for variable messages. Got rid of many such buffers * cosmetic changes and gtk1/2 conditionals Index: input.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/input.c,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** input.c 4 Oct 2003 09:56:54 -0000 1.59 --- input.c 5 Oct 2003 13:43:39 -0000 1.60 *************** *** 1234,1238 **** --- 1234,1240 ---- int mod_context, res; char *olddn, *dn; + #if GTK_MAJOR < 2 char *c; + #endif GtkCTreeNode *node = NULL; GtkCTree *ctreeroot = NULL; *************** *** 1254,1259 **** c = decoded_string(iform->olddn); g_string_sprintfa(message, _("modified %s"), c); ! if(c) ! free(c); #endif --- 1256,1260 ---- c = decoded_string(iform->olddn); g_string_sprintfa(message, _("modified %s"), c); ! if(c) free(c); #endif *************** *** 1355,1359 **** --- 1356,1362 ---- char *olddn, *dn; char **oldrdn, **rdn; + #if GTK_MAJOR < 2 char *c; + #endif char *noattrs[] = { LDAP_NO_ATTRS, NULL }; LDAPMessage *res; *************** *** 1386,1393 **** if(oldrdn[i] == NULL || rdn[i] == NULL || (strcasecmp(oldrdn[i], rdn[i]) != 0)) { ! g_string_sprintf(message, ! _("You can only change the RDN of the DN (%s)"), ! oldrdn[0]); ! error_push(context, message->str); error = 1; break; --- 1389,1395 ---- if(oldrdn[i] == NULL || rdn[i] == NULL || (strcasecmp(oldrdn[i], rdn[i]) != 0)) { ! error_push(context, ! _("You can only change the RDN of the DN (%s)"), ! oldrdn[0]); error = 1; break; *************** *** 1438,1448 **** } #if defined(HAVE_LDAP_RENAME) ! g_string_sprintf(message, "ldap_rename_s: %s", ! ldap_err2string(rc)); #else ! g_string_sprintf(message, "ldap_modrdn2_s: %s", ! ldap_err2string(rc)); #endif - error_push(context, message->str); push_ldap_addl_error(ld, context); error = 2; --- 1440,1449 ---- } #if defined(HAVE_LDAP_RENAME) ! error_push(context, "ldap_rename_s: %s", ! ldap_err2string(rc)); #else ! error_push(context, "ldap_modrdn2_s: %s", ! ldap_err2string(rc)); #endif push_ldap_addl_error(ld, context); error = 2; |
From: <sta...@us...> - 2003-10-05 13:42:47
|
Update of /cvsroot/gqclient/gq/src In directory sc8-pr-cvs1:/tmp/cvs-serv5268 Modified Files: gq.c Log Message: * Got rid of most hand-knit linked list implementations, replaced them with GLists (errorchains, config->ldapservers, etc.) * Many object types now have constructors and destructors of the form new_<type> and free_<type>. Use them instead of self-allocating and freeing memory as it was done before. Removed all such old style object handling Index: gq.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/gq.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** gq.c 4 Oct 2003 10:13:29 -0000 1.17 --- gq.c 5 Oct 2003 13:42:36 -0000 1.18 *************** *** 152,156 **** if (config->changed) save_config(); ! cleanup_config(config); gtk_exit(0); --- 152,157 ---- if (config->changed) save_config(); ! free_config(config); ! config = NULL; gtk_exit(0); *************** *** 168,171 **** --- 169,173 ---- { struct ldapserver *server; + GList *I; #ifdef DEBUG *************** *** 174,179 **** } #endif /* DEBUG */ ! ! for(server = config->ldapservers ; server ; server = server->next) { server->server_down++; } --- 176,182 ---- } #endif /* DEBUG */ ! ! for (I = config->servers ; I ; I = g_list_next(I)) { ! server = (struct ldapserver *) I->data; server->server_down++; } |
From: <sta...@us...> - 2003-10-05 13:42:16
|
Update of /cvsroot/gqclient/gq/src In directory sc8-pr-cvs1:/tmp/cvs-serv5246 Modified Files: gq-xml.c Log Message: * UTF-8 safety improvements * Moved the .gq upgrade hack from xmlparse.c to gq-xml.c * Many object types now have constructors and destructors of the form new_<type> and free_<type>. Use them instead of self-allocating and freeing memory as it was done before. Removed all such old style object handling Index: gq-xml.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/gq-xml.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** gq-xml.c 4 Oct 2003 09:45:45 -0000 1.2 --- gq-xml.c 5 Oct 2003 13:42:10 -0000 1.3 *************** *** 29,32 **** --- 29,39 ---- #include <gtk/gtk.h> + #include <sys/types.h> + #include <sys/stat.h> + #include <unistd.h> + #include <stdio.h> + #include <errno.h> + #include <fcntl.h> + #include "gq-xml.h" #include "xmlparse.h" *************** *** 39,43 **** #include "template.h" #include "errorchain.h" ! struct cf_comm { --- 46,50 ---- #include "template.h" #include "errorchain.h" ! #include "common.h" struct cf_comm { *************** *** 50,55 **** struct tagstack_entry *e) { ! e->data = calloc(1, sizeof(struct gq_config)); ! default_config(e->data); } --- 57,62 ---- struct tagstack_entry *e) { ! e->data = new_config(); ! e->free_data = (free_func) free_config; } *************** *** 64,68 **** --- 71,79 ---- } comm->config = e->data; + e->data = NULL; + e->free_data = NULL; + } else { + /* the free callback will clean up */ } } *************** *** 76,80 **** l = strtol(e->cdata, &ep, 10); if ((ep && *ep) || l < 0) { ! XMLhandleError(ctx, _("Non-negative integer CDATA expected ('%s')"), e->tag); return -1; } --- 87,93 ---- l = strtol(e->cdata, &ep, 10); if ((ep && *ep) || l < 0) { ! XMLhandleError(ctx, ! _("Non-negative integer CDATA expected ('%s')"), ! e->tag); return -1; } *************** *** 92,96 **** b = 0; } else { ! XMLhandleError(ctx, _("Boolean CDATA ('true' or 'false') expected ('%s')"), e->tag); return -1; } --- 105,111 ---- b = 0; } else { ! XMLhandleError(ctx, ! _("Boolean CDATA ('true' or 'false') expected ('%s')"), ! e->tag); return -1; } *************** *** 220,238 **** { struct gq_config *c = peek_tag(ctx->stack, 1)->data; ! ! /* FIXME - not UTF-8 safe */ ! strncpy(c->schemaserver, e->cdata, MAX_SERVERNAME_LEN - 1); } - - - - static void ldapserverS(struct parser_context *ctx, struct tagstack_entry *e) { ! struct ldapserver *server = calloc(1, sizeof(struct ldapserver)); ! init_ldapserver(server); e->data = server; } --- 235,247 ---- { struct gq_config *c = peek_tag(ctx->stack, 1)->data; ! g_free_and_dup(c->schemaserver, e->cdata); } static void ldapserverS(struct parser_context *ctx, struct tagstack_entry *e) { ! struct ldapserver *server = new_ldapserver(); e->data = server; + e->free_data = (free_func) free_ldapserver; } *************** *** 246,265 **** GByteArray *o = g_byte_array_new(); b64_decode(o, server->bindpw, strlen(server->bindpw)); ! ! memset(server->bindpw, 0, sizeof(server->bindpw)); ! strncpy(server->bindpw, o->data, MIN(o->len, sizeof(server->bindpw) - 1)); } else if (server->bindpw[0] && server->pwencoding[0]) { XMLhandleError(ctx, _("Unsupported password encoding")); } ! if(c->ldapservers) { ! server = c->ldapservers; ! while(server->next) ! server = server->next; ! server->next = e->data; ! } else { ! c->ldapservers = e->data; ! } e->data = NULL; } --- 255,270 ---- GByteArray *o = g_byte_array_new(); b64_decode(o, server->bindpw, strlen(server->bindpw)); ! ! server->bindpw = g_malloc(o->len + 1); ! strncpy(server->bindpw, o->data, o->len); /* UTF-8 OK */ ! server->bindpw[o->len] = 0; } else if (server->bindpw[0] && server->pwencoding[0]) { XMLhandleError(ctx, _("Unsupported password encoding")); } ! c->servers = g_list_append(c->servers, e->data); ! e->data = NULL; + e->free_data = NULL; } *************** *** 268,274 **** { struct ldapserver *server = peek_tag(ctx->stack, 1)->data; ! ! /* FIXME - not UTF8-safe */ ! strncpy(server->name, e->cdata, sizeof(server->name) - 1); } --- 273,277 ---- { struct ldapserver *server = peek_tag(ctx->stack, 1)->data; ! g_free_and_dup(server->name, e->cdata); } *************** *** 277,284 **** { struct ldapserver *server = peek_tag(ctx->stack, 1)->data; ! ! /* FIXME - not UTF8-safe */ ! strncpy(server->ldaphost, e->cdata, ! sizeof(server->ldaphost) - 1); } --- 280,284 ---- { struct ldapserver *server = peek_tag(ctx->stack, 1)->data; ! g_free_and_dup(server->ldaphost, e->cdata); } *************** *** 297,304 **** { struct ldapserver *server = peek_tag(ctx->stack, 1)->data; ! ! /* FIXME - not UTF8-safe */ ! strncpy(server->basedn, e->cdata, ! sizeof(server->basedn) - 1); } --- 297,301 ---- { struct ldapserver *server = peek_tag(ctx->stack, 1)->data; ! g_free_and_dup(server->basedn, e->cdata); } *************** *** 308,315 **** { struct ldapserver *server = peek_tag(ctx->stack, 1)->data; ! ! /* FIXME - not UTF8-safe */ ! strncpy(server->binddn, e->cdata, ! sizeof(server->binddn) - 1); } --- 305,309 ---- { struct ldapserver *server = peek_tag(ctx->stack, 1)->data; ! g_free_and_dup(server->binddn, e->cdata); } *************** *** 318,325 **** { struct ldapserver *server = peek_tag(ctx->stack, 1)->data; ! ! /* FIXME - not UTF8-safe */ ! strncpy(server->bindpw, e->cdata, ! sizeof(server->bindpw) - 1); } --- 312,316 ---- { struct ldapserver *server = peek_tag(ctx->stack, 1)->data; ! g_free_and_dup(server->bindpw, e->cdata); } *************** *** 329,336 **** { struct ldapserver *server = peek_tag(ctx->stack, 1)->data; ! ! /* FIXME - not UTF8-safe */ ! strncpy(server->pwencoding, e->cdata, ! sizeof(server->pwencoding) - 1); } --- 320,324 ---- { struct ldapserver *server = peek_tag(ctx->stack, 1)->data; ! g_free_and_dup(server->pwencoding, e->cdata); } *************** *** 349,356 **** { struct ldapserver *server = peek_tag(ctx->stack, 1)->data; ! ! /* FIXME - not UTF8-safe */ ! strncpy(server->searchattr, e->cdata, ! sizeof(server->searchattr) - 1); } --- 337,341 ---- { struct ldapserver *server = peek_tag(ctx->stack, 1)->data; ! g_free_and_dup(server->searchattr, e->cdata); } *************** *** 426,431 **** struct tagstack_entry *e) { ! e->data = calloc(1, sizeof(struct gq_filter)); ! e->free_data = free; } --- 411,416 ---- struct tagstack_entry *e) { ! e->data = new_filter(); ! e->free_data = (free_func) free_filter; } *************** *** 447,454 **** { struct gq_filter *filter = peek_tag(ctx->stack, 1)->data; ! ! /* FIXME - not UTF8-safe */ ! strncpy(filter->name, e->cdata, ! sizeof(filter->name) - 1); } --- 432,436 ---- { struct gq_filter *filter = peek_tag(ctx->stack, 1)->data; ! g_free_and_dup(filter->name, e->cdata); } *************** *** 457,464 **** { struct gq_filter *filter = peek_tag(ctx->stack, 1)->data; ! ! /* FIXME - not UTF8-safe */ ! strncpy(filter->ldapfilter, e->cdata, ! sizeof(filter->ldapfilter) - 1); } --- 439,443 ---- { struct gq_filter *filter = peek_tag(ctx->stack, 1)->data; ! g_free_and_dup(filter->ldapfilter, e->cdata); } *************** *** 467,474 **** { struct gq_filter *filter = peek_tag(ctx->stack, 1)->data; ! ! /* FIXME - not UTF8-safe */ ! strncpy(filter->servername, e->cdata, ! sizeof(filter->servername) - 1); } --- 446,450 ---- { struct gq_filter *filter = peek_tag(ctx->stack, 1)->data; ! g_free_and_dup(filter->servername, e->cdata); } *************** *** 477,484 **** { struct gq_filter *filter = peek_tag(ctx->stack, 1)->data; ! ! /* FIXME - not UTF8-safe */ ! strncpy(filter->basedn, e->cdata, ! sizeof(filter->basedn) - 1); } --- 453,457 ---- { struct gq_filter *filter = peek_tag(ctx->stack, 1)->data; ! g_free_and_dup(filter->basedn, e->cdata); } *************** *** 486,490 **** struct tagstack_entry *e) { ! e->data = calloc(1, sizeof(struct gq_template)); } --- 459,464 ---- struct tagstack_entry *e) { ! e->data = new_template(); ! e->free_data = (free_func) free_template; } *************** *** 494,497 **** --- 468,472 ---- struct gq_config *c = peek_tag(ctx->stack, 1)->data; c->templates = g_list_append(c->templates, e->data); + e->free_data = NULL; } *************** *** 502,509 **** { struct gq_template *t = peek_tag(ctx->stack, 1)->data; ! ! /* FIXME - not UTF8-safe */ ! strncpy(t->name, e->cdata, ! sizeof(t->name) - 1); } --- 477,481 ---- { struct gq_template *t = peek_tag(ctx->stack, 1)->data; ! g_free_and_dup(t->name, e->cdata); } *************** *** 839,843 **** } ! static void XMLwarningHandler(struct parser_context *ctx, const char *fmt, ...) { va_list args; --- 811,817 ---- } ! static void XMLwarningHandler(struct parser_context *ctx, ! const char *fmt, ...) ! { va_list args; *************** *** 847,851 **** } ! static void XMLerrorHandler(struct parser_context *ctx, const char *fmt, ...) { va_list args; --- 821,827 ---- } ! static void XMLerrorHandler(struct parser_context *ctx, ! const char *fmt, ...) ! { va_list args; *************** *** 855,859 **** } ! static void XMLfatalErrorHandler(struct parser_context *ctx, const char *fmt, ...) { va_list args; --- 831,837 ---- } ! static void XMLfatalErrorHandler(struct parser_context *ctx, ! const char *fmt, ...) ! { va_list args; *************** *** 863,867 **** } ! struct gq_config *process_rcfile_XML(int error_context, const char *filename) { xmlSAXHandler *handler = g_malloc0(sizeof(xmlSAXHandler)); int rc; --- 841,1005 ---- } ! static int dot_gq_upgrade_hack(int error_context, const char *filename) ! { ! FILE *fp = fopen(filename, "r"); ! extern int errno; ! int changed = 0; ! ! if (fp) { ! /* nasty heuristics to find out if .gq is "old" (written with ! a gq that does not yet use libxml) or "new". ! ! The way this is done is by checking for an "encoding" in ! the first line of .gq (should be: in the xml declaration, ! actually). This works because the encoding is only there in ! "new" versions of .gq. ! ! The situation does not allow to do it differently: We ! cannot just check for the config-version, because for ! this to work the parser would need to run. ! ! A better way would be to check the encoding when the parser ! sees the xml decl. But libxml seems not to allow for this. ! */ ! ! char firstline[255]; ! fgets(firstline, sizeof(firstline) - 1, fp); ! rewind(fp); ! ! if (strstr(firstline, "encoding=") != NULL ) { ! /* NEW version - everything is OK */ ! fclose(fp); ! return 0; ! } else { ! extern const char *gq_codeset; ! char *cfgbuf; ! GString *newbuf; ! int i; ! struct stat sfile; ! ! /* OLD version */ ! ! /* more nastiness... since this config file was written by a ! pre-UTF-8 version of GQ, it's not going to have <>&'" escaped ! properly... fudge this now: silently rewrite the config ! file on disk, then reopen it for the XML parser */ ! changed = 0; ! stat(filename, &sfile); ! cfgbuf = g_malloc(sfile.st_size + 1); ! fread(cfgbuf, 1, sfile.st_size, fp); ! ! cfgbuf[sfile.st_size] = 0; ! newbuf = g_string_sized_new(sfile.st_size + 128); ! ! /* take care of the XML declaration in the first line... */ ! ! g_string_sprintf(newbuf, ! "<?xml version=\"1.0\" encoding=\"%s\" standalone=\"yes\"?>", ! gq_codeset); ! ! /* skip line 1 in the input buffer */ ! for(i = 0 ; cfgbuf[i] && cfgbuf[i] != '\n' ; i++) ; ! for( ; cfgbuf[i] ; i++) { ! switch(cfgbuf[i]) { ! case '\\': ! /* < and > used to be escaped with a \ */ ! if(cfgbuf[i + 1] == '<') { ! g_string_append(newbuf, "<"); ! changed++; ! i++; ! } ! else if(cfgbuf[i + 1] == '>') { ! g_string_append(newbuf, ">"); ! changed++; ! i++; ! } ! else ! g_string_append_c(newbuf, cfgbuf[i]); ! break; ! ! #if 0 /* no need to escape ' and " at all */ ! case '"': ! /* this wasn't escaped at all */ ! g_string_append(newbuf, """); ! changed++; ! break; ! case '\'': ! /* neither was this */ ! g_string_append(newbuf, "'"); ! changed++; ! break; ! #endif ! case '&': ! #if 0 ! /* if it's not the start of an XML escape, it ! must be an illegal & */ ! if(strncmp(cfgbuf + i + 1, "amp;", 4) && ! strncmp(cfgbuf + i + 1, "lt;", 3) && ! strncmp(cfgbuf + i + 1, "gt;", 3) && ! strncmp(cfgbuf + i + 1, "apos;", 5) && ! strncmp(cfgbuf + i + 1, "quot;", 5)) { ! #endif ! g_string_append(newbuf, "&"); ! changed++; ! #if 0 ! } ! else ! g_string_append_c(newbuf, cfgbuf[i]); ! #endif ! break; ! default: ! g_string_append_c(newbuf, cfgbuf[i]); ! } ! } ! fclose(fp); ! ! if(changed) { ! int fd; ! int rc; ! ! int l = strlen(filename) + 20; ! char *tmp = g_malloc(l); ! snprintf(tmp, l, "%s.tmp", filename); ! ! unlink(tmp); /* provide very minor security */ ! fd = open(tmp, O_CREAT | O_WRONLY, ! sfile.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO) ! ); ! ! if (fd < 0) { ! error_push(error_context, ! _("Could not open temporary configuration file '%1$s': %2$s"), ! tmp, strerror(errno)); ! return -1; ! } ! ! rc = write(fd, newbuf->str, newbuf->len); ! if (rc == newbuf->len) { ! close(fd); ! rename(tmp, filename); ! return 1; ! } ! close(fd); ! error_push(error_context, ! _("Could not write silently upgraded configuration file")); ! return -1; /* fwrite error */ ! } ! ! g_free(cfgbuf); ! g_string_free(newbuf, TRUE); ! } ! return 1; /* silent upgrade done */ ! } ! if (errno != ENOENT) { ! error_push(error_context, ! _("Could not open configuration file '%1$s': %2$s"), ! filename, strerror(errno)); ! } ! return -1; /* failed (fopen) */ ! } ! ! struct gq_config *process_rcfile_XML(int error_context, const char *filename) ! { xmlSAXHandler *handler = g_malloc0(sizeof(xmlSAXHandler)); int rc; *************** *** 875,878 **** --- 1013,1017 ---- handler->warning = (warningSAXFunc) XMLwarningHandler; + dot_gq_upgrade_hack(error_context, filename); rc = XMLparse(config_tags, handler, &comm, filename); *************** *** 888,892 **** #ifdef TEST_MAIN ! int main_test(int argc, char **argv) { struct gq_config *config = NULL; int rc = 0; --- 1027,1032 ---- #ifdef TEST_MAIN ! int main_test(int argc, char **argv) ! { struct gq_config *config = NULL; int rc = 0; |
From: <sta...@us...> - 2003-10-05 13:41:07
|
Update of /cvsroot/gqclient/gq/src In directory sc8-pr-cvs1:/tmp/cvs-serv4956 Modified Files: formfill.c Log Message: * UTF-8 safety improvements Index: formfill.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/formfill.c,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** formfill.c 4 Oct 2003 10:14:03 -0000 1.36 --- formfill.c 5 Oct 2003 13:40:53 -0000 1.37 *************** *** 42,45 **** --- 42,46 ---- #include "encode.h" #include "i18n.h" + #include "utf8-compat.h" static GList *internalAttrs = NULL; *************** *** 155,159 **** { char *c = g_strdup(attr); ! char *d = strchr(c, ';'); if (d) { --- 156,160 ---- { char *c = g_strdup(attr); ! char *d = g_utf8_strchr(c, -1, ';'); /* UTF-8: doesn't hurt */ if (d) { |
From: <sta...@us...> - 2003-10-05 13:39:41
|
Update of /cvsroot/gqclient/gq/src In directory sc8-pr-cvs1:/tmp/cvs-serv4616 Modified Files: filter.c filter.h Log Message: * Got rid of many, many fixed size buffers. These might have been problematic with variable length characters (as in the standard UTF-8 encoding) * Many object types now have constructors and destructors of the form new_<type> and free_<type>. Use them instead of self-allocating and freeing memory as it was done before. Removed all such old style object handling Index: filter.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/filter.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** filter.c 4 Oct 2003 09:59:09 -0000 1.19 --- filter.c 5 Oct 2003 13:39:35 -0000 1.20 *************** *** 51,54 **** --- 51,78 ---- + struct gq_filter *new_filter() + { + struct gq_filter *filter; + + filter = g_malloc0(sizeof(struct gq_filter)); + + filter->name = g_strdup(""); + filter->ldapfilter = g_strdup(""); + filter->servername = g_strdup(""); + filter->basedn = g_strdup(""); + + return(filter); + } + + void free_filter(struct gq_filter *filter) + { + g_free_if(filter->name); + g_free_if(filter->ldapfilter); + g_free_if(filter->servername); + g_free_if(filter->basedn); + g_free(filter); + } + + struct gq_filter *check_filtername(const char *filtername) { *************** *** 136,141 **** /* populate the new filter */ filter = new_filter(); ! strncpy(filter->name, filtername, MAX_FILTERNAME_LEN - 1); ! strncpy(filter->ldapfilter, filterstring, MAX_LDAPFILTER_LEN - 1); free(filterstring); --- 160,165 ---- /* populate the new filter */ filter = new_filter(); ! g_free_and_dup(filter->name, filtername); ! g_free_and_dup(filter->ldapfilter, filterstring); free(filterstring); *************** *** 146,154 **** searchbase = gtk_editable_get_chars(GTK_EDITABLE(GTK_COMBO(searchbase_combo)->entry), 0, -1); ! strncpy(filter->servername, servername, MAX_SERVERNAME_LEN - 1); ! strncpy(filter->basedn, searchbase, MAX_DN_LEN - 1); ! g_free(servername); ! g_free(searchbase); } --- 170,178 ---- searchbase = gtk_editable_get_chars(GTK_EDITABLE(GTK_COMBO(searchbase_combo)->entry), 0, -1); ! g_free_if(filter->servername); ! filter->servername = servername; ! g_free_if(filter->basedn); ! filter->basedn = searchbase; } *************** *** 462,466 **** /* delete from internal filterlist */ config->filters = g_list_remove(config->filters, filter); ! FREE(filter, "struct gq_filter"); save_config(); --- 486,490 ---- /* delete from internal filterlist */ config->filters = g_list_remove(config->filters, filter); ! free_filter(filter); save_config(); *************** *** 785,789 **** single_warning_popup(msg); g_free(flattened); ! FREE(filter, "struct gq_filter"); return; } --- 809,813 ---- single_warning_popup(msg); g_free(flattened); ! free_filter(filter); return; } *************** *** 793,800 **** /* populate internal struct */ ! strncpy(filter->name, filtername, MAX_FILTERNAME_LEN - 1); ! strncpy(filter->servername, servername, MAX_SERVERNAME_LEN - 1); ! strncpy(filter->basedn, basedn, MAX_DN_LEN - 1); ! strncpy(filter->ldapfilter, flattened, MAX_LDAPFILTER_LEN - 1); /* there's no filter_clist if we got here through the menu */ --- 817,824 ---- /* populate internal struct */ ! g_free_and_dup(filter->name, filtername); ! g_free_and_dup(filter->servername, servername); ! g_free_and_dup(filter->basedn, basedn); ! g_free_and_dup(filter->ldapfilter, flattened); /* there's no filter_clist if we got here through the menu */ *************** *** 856,875 **** /* change filtername in internal struct, and in the filter clist window */ ! strncpy(filter->name, filtername, MAX_FILTERNAME_LEN - 1); gtk_clist_set_text(GTK_CLIST(filter_clist), row, 0, filtername); } if(strncasecmp(filter->servername, servername, MAX_SERVERNAME_LEN)) { ! strncpy(filter->servername, servername, MAX_SERVERNAME_LEN - 1); gtk_clist_set_text(GTK_CLIST(filter_clist), row, 1, servername); } if(strncasecmp(filter->basedn, basedn, MAX_DN_LEN)) { ! strncpy(filter->basedn, basedn, MAX_DN_LEN - 1); gtk_clist_set_text(GTK_CLIST(filter_clist), row, 2, basedn); } if(strncasecmp(filter->ldapfilter, flattened, MAX_LDAPFILTER_LEN)) { ! strncpy(filter->ldapfilter, flattened, MAX_LDAPFILTER_LEN - 1); gtk_clist_set_text(GTK_CLIST(filter_clist), row, 3, flattened); } --- 880,899 ---- /* change filtername in internal struct, and in the filter clist window */ ! g_free_and_dup(filter->name, filtername); gtk_clist_set_text(GTK_CLIST(filter_clist), row, 0, filtername); } if(strncasecmp(filter->servername, servername, MAX_SERVERNAME_LEN)) { ! g_free_and_dup(filter->servername, servername); gtk_clist_set_text(GTK_CLIST(filter_clist), row, 1, servername); } if(strncasecmp(filter->basedn, basedn, MAX_DN_LEN)) { ! g_free_and_dup(filter->basedn, basedn); gtk_clist_set_text(GTK_CLIST(filter_clist), row, 2, basedn); } if(strncasecmp(filter->ldapfilter, flattened, MAX_LDAPFILTER_LEN)) { ! g_free_and_dup(filter->ldapfilter, flattened); gtk_clist_set_text(GTK_CLIST(filter_clist), row, 3, flattened); } Index: filter.h =================================================================== RCS file: /cvsroot/gqclient/gq/src/filter.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** filter.h 29 Sep 2003 19:24:16 -0000 1.3 --- filter.h 5 Oct 2003 13:39:35 -0000 1.4 *************** *** 37,47 **** struct gq_filter { ! char name[MAX_FILTERNAME_LEN]; ! char ldapfilter[MAX_LDAPFILTER_LEN]; ! char servername[MAX_SERVERNAME_LEN]; ! char basedn[MAX_DN_LEN]; }; ! struct gq_filter *check_filtername(const char *filtername); --- 37,48 ---- struct gq_filter { ! char *name; ! char *ldapfilter; ! char *servername; ! char *basedn; }; ! struct gq_filter *new_filter(void); ! void free_filter(struct gq_filter *filter); struct gq_filter *check_filtername(const char *filtername); |
From: <sta...@us...> - 2003-10-05 13:38:12
|
Update of /cvsroot/gqclient/gq/src In directory sc8-pr-cvs1:/tmp/cvs-serv4105 Modified Files: errorchain.c errorchain.h Log Message: * Dropped the struct errmsgs altogether * now error_push allows for printf-style variable argument lists, very convenient: no more dealing with an extra message buffer for variable messages. Got rid of many such buffers * Many object types now have constructors and destructors of the form new_<type> and free_<type>. Use them instead of self-allocating and freeing memory as it was done before. Removed all such old style object handling * Got rid of most hand-knit linked list implementations, replaced them with GLists (errorchains, config->ldapservers, etc.) * Got rid of many, many fixed size buffers. These might have been problematic with variable length characters (as in the standard UTF-8 encoding) Index: errorchain.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/errorchain.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** errorchain.c 4 Oct 2003 09:54:33 -0000 1.13 --- errorchain.c 5 Oct 2003 13:38:06 -0000 1.14 *************** *** 35,107 **** #include "i18n.h" #include "input.h" #include "../icons/bomb.xpm" ! struct errchain *chains = NULL; ! int error_new_context(char *title) { ! struct errchain *chain, *new_chain; ! int context = 0; ! ! new_chain = MALLOC(sizeof(struct errchain), "struct errchain"); ! strncpy(new_chain->title, title, MAX_ERRTITLE_SIZE); ! new_chain->title[MAX_ERRTITLE_SIZE] = '\0'; ! new_chain->msgs = NULL; ! new_chain->next = NULL; ! if(!chains) ! chains = new_chain; ! else { ! chain = chains; ! while(chain->next) { ! context = chain->context; ! chain = chain->next; ! } ! chain->next = new_chain; ! context = chain->context + 1; } ! new_chain->context = context; ! return(context); } ! void error_push_production(int context, char *msg) { struct errchain *chain; ! struct errmsgs *new_msg, *cur_msg; ! new_msg = MALLOC(sizeof(struct errmsgs), "struct errmsgs"); ! strncpy(new_msg->msg, msg, MAX_ERRMSG_SIZE); ! new_msg->msg[MAX_ERRMSG_SIZE] = '\0'; ! new_msg->next = NULL; /* plug into messagechain */ chain = error_chain_by_context(context); ! if(!chain->msgs) ! chain->msgs = new_msg; ! else { ! cur_msg = chain->msgs; ! while(cur_msg->next) ! cur_msg = cur_msg->next; ! cur_msg->next = new_msg; ! } } #ifdef DEBUG ! void error_push_debug(int context, char *msg, char *file, int line) { if (debug & GQ_DEBUG_ERROR_LINE) { ! int len = strlen(msg) + strlen(file) + 100; char *s = g_malloc(len); ! snprintf(s, len, "%s:%d %s", file, line, msg); ! error_push_production(context, s); g_free(s); } else { ! error_push_production(context, msg); } } #endif --- 35,145 ---- #include "i18n.h" #include "input.h" + #include "utf8-compat.h" #include "../icons/bomb.xpm" + static struct errchain *error_chain_by_context(int q); ! static GList *chains = NULL; ! static int error_context = 0; ! static struct errchain *new_errchain() { ! struct errchain *new_chain; ! new_chain = g_malloc0(sizeof(struct errchain)); ! new_chain->title = g_strdup(""); ! new_chain->messages = NULL; ! return new_chain; ! } ! static void free_errchain(struct errchain *chain) ! { ! if (chain) { ! g_free_if(chain->title); ! g_list_foreach(chain->messages, (GFunc) g_free, NULL); ! g_list_free(chain->messages); ! g_free(chain); } + } ! int error_new_context(const char *title) ! { ! struct errchain *new_chain; ! new_chain = new_errchain(); ! g_free_and_dup(new_chain->title, title); ! ! chains = g_list_append(chains, new_chain); ! new_chain->context = error_context++; ! ! return new_chain->context; } ! ! ! static void error_push_production_v(int context, const char *fmt, va_list ap) { struct errchain *chain; ! GString *str; ! int n, a; ! a = strlen(fmt) + 50; ! str = g_string_sized_new(a); /* used for glib1 compatibility */ ! /* I hope it is ok to repeatadly use ap like this */ ! ! do { ! n = vsnprintf(str->str, a - 1, fmt, ap); ! ! #ifdef HAVE_C99_SNPRINTF ! if (n > a - 1) { ! g_string_free(str, TRUE); ! a = n + 2; ! str = g_string_sized_new(a); ! } ! #else ! if (n == -1) { ! g_string_free(str, TRUE); ! a *= 2; ! str = g_string_sized_new(a); ! } ! #endif ! } while (n > (a - 1) || n == -1); /* plug into messagechain */ chain = error_chain_by_context(context); ! chain->messages = g_list_append(chain->messages, str->str); + g_string_free(str, FALSE); + } + + void error_push_production(int context, const char *fmt, ...) + { + va_list ap; + va_start(ap, fmt); + error_push_production_v(context, fmt, ap); + va_end(ap); } #ifdef DEBUG ! void error_push_debug(const char *file, int line, ! int context, const char *fmt, ...) { + va_list ap; + va_start(ap, fmt); + if (debug & GQ_DEBUG_ERROR_LINE) { ! ! /* Is it allowed to change the fmt? */ ! ! int len = strlen(fmt) + strlen(file) + 100; char *s = g_malloc(len); ! snprintf(s, len, "%s:%d %s", file, line, fmt); ! error_push_production_v(context, s, ap); g_free(s); } else { ! error_push_production_v(context, fmt, ap); } + + va_end(ap); } #endif *************** *** 114,186 **** { char *error_msg; - char message[256]; ldap_get_option(ld, LDAP_OPT_ERROR_STRING, &error_msg); if (error_msg != NULL && *error_msg != 0) { ! snprintf(message, sizeof(message), ! _("Additional error: %s"), error_msg); ! error_push(context, message); } } /* returns chain for requested context */ ! struct errchain *error_chain_by_context(int q) { struct errchain *chain; ! chain = chains; ! while(chain && chain->context != q) ! chain = chain->next; ! ! if(!chain) { ! fprintf(stderr, _("Oops! errorchain lookup error. Exiting...\n")); ! abort(); } ! ! return(chain); } ! void error_clear(int context) { struct errchain *chain; ! struct errmsgs *cur_msg, *old_msg; chain = error_chain_by_context(context); ! cur_msg = chain->msgs; ! while(cur_msg) { ! old_msg = cur_msg; ! cur_msg = cur_msg->next; ! FREE(old_msg, "struct errmsgs"); ! } ! chain->msgs = NULL; } ! void error_free(int context) { ! struct errchain *chain, *cur_chain; ! ! chain = error_chain_by_context(context); ! ! error_clear(context); ! ! /* free chain */ ! if(chain == chains) ! chains = chain->next; ! else { ! cur_chain = chains; ! while(cur_chain && cur_chain->next != chain) ! cur_chain = cur_chain->next; ! if(cur_chain) ! cur_chain->next = cur_chain->next->next; ! else { ! fprintf(stderr, _("Oops! errorchain free error. Exiting...\n")); ! abort(); ! } ! ! } ! FREE(chain, "struct errchain"); } --- 152,199 ---- { char *error_msg; ldap_get_option(ld, LDAP_OPT_ERROR_STRING, &error_msg); if (error_msg != NULL && *error_msg != 0) { ! error_push(context, _("Additional error: %s"), error_msg); } } /* returns chain for requested context */ ! static struct errchain *error_chain_by_context(int q) { + GList *I; struct errchain *chain; ! for (I = chains ; I ; I = g_list_next(I)) { ! chain = I->data; ! if (chain->context == q) return chain; } ! fprintf(stderr, _("Oops! errorchain lookup error. Exiting...\n")); ! abort(); ! return NULL; /* make sure the compiler shuts up */ } ! static void error_free(int context) { struct errchain *chain; ! GList *I; chain = error_chain_by_context(context); + assert(chain); ! I = g_list_find(chains, chain); ! chains = g_list_remove(chains, I); + free_errchain(chain); } ! void error_clear(int context) { ! struct errchain *chain = error_chain_by_context(context); ! assert(chain); ! g_list_foreach(chain->messages, (GFunc) g_free, NULL); ! g_list_free(chain->messages); ! chain->messages = NULL; } *************** *** 191,199 **** GtkWidget *pixmap, *popupwin, *vbox, *vbox1, *hbox0, *hbox, *vbox2, *msg_label, *okbutton, *align; struct errchain *chain; ! struct errmsgs *cur_msg, *old_msg; chain = error_chain_by_context(context); ! if(chain->msgs) { popupwin = gtk_dialog_new(); gtk_widget_realize(popupwin); --- 204,213 ---- GtkWidget *pixmap, *popupwin, *vbox, *vbox1, *hbox0, *hbox, *vbox2, *msg_label, *okbutton, *align; struct errchain *chain; ! GList *msg; chain = error_chain_by_context(context); + assert(chain); ! if(chain->messages) { popupwin = gtk_dialog_new(); gtk_widget_realize(popupwin); *************** *** 228,237 **** /* show messages, freeing them as we go */ ! cur_msg = chain->msgs; ! while(cur_msg) { #if GTK_MAJOR >= 2 ! msg_label = gtk_label_new(cur_msg->msg); #else ! char *c = decoded_string(cur_msg->msg); msg_label = gtk_label_new(c); if (c) free(c); --- 242,252 ---- /* show messages, freeing them as we go */ ! for(msg = chain->messages ; msg ; msg = g_list_next(msg)) { ! char *m = msg->data; ! #if GTK_MAJOR >= 2 ! msg_label = gtk_label_new(m); #else ! char *c = decoded_string(m); msg_label = gtk_label_new(c); if (c) free(c); *************** *** 241,249 **** gtk_widget_show(msg_label); gtk_box_pack_start(GTK_BOX(vbox), msg_label, FALSE, FALSE, 0); ! old_msg = cur_msg; ! cur_msg = cur_msg->next; ! FREE(old_msg, "struct errmsgs"); } ! chain->msgs = NULL; vbox2 = GTK_DIALOG(popupwin)->action_area; --- 256,264 ---- gtk_widget_show(msg_label); gtk_box_pack_start(GTK_BOX(vbox), msg_label, FALSE, FALSE, 0); ! ! g_free(msg->data); } ! g_list_free(chain->messages); ! chain->messages = NULL; vbox2 = GTK_DIALOG(popupwin)->action_area; Index: errorchain.h =================================================================== RCS file: /cvsroot/gqclient/gq/src/errorchain.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** errorchain.h 15 Jul 2002 18:36:51 -0000 1.6 --- errorchain.h 5 Oct 2003 13:38:06 -0000 1.7 *************** *** 30,67 **** #include "config.h" ! int error_new_context(char *title); ! void error_push_production(int context, char *msg); #ifdef DEBUG ! void error_push_debug(int context, char *msg, char *file, int line); ! # define error_push(c, m) error_push_debug((c), (m), __FILE__, __LINE__) #else ! # define error_push(c, m) error_push_production((c), (m)) #endif - struct errchain *error_chain_by_context(int q); void error_flush(int context); void error_popup(char *title, char *message); void error_clear(int context); - void error_free(int context); void push_ldap_addl_error(LDAP *ld, int context); - #define MAX_ERRTITLE_SIZE 128 - #define MAX_ERRMSG_SIZE 256 - - struct errmsgs { - char msg[MAX_ERRMSG_SIZE]; - struct errmsgs *next; - }; - struct errchain { int context; ! char title[MAX_ERRTITLE_SIZE]; ! struct errmsgs *msgs; ! struct errchain *next; }; --- 30,57 ---- #include "config.h" ! int error_new_context(const char *title); ! void error_push_production(int context, const char *msg, ...) ! __attribute__ ((format (printf, 2, 3))); #ifdef DEBUG ! void error_push_debug(const char *file, int line, int context, const char *msg, ...); ! # define error_push(c, ...) error_push_debug(__FILE__, __LINE__, (c), __VA_ARGS__) #else ! # define error_push(c, ...) error_push_production((c), __VA_ARGS__) #endif void error_flush(int context); void error_popup(char *title, char *message); void error_clear(int context); void push_ldap_addl_error(LDAP *ld, int context); struct errchain { int context; ! char *title; ! GList *messages; }; |
From: <sta...@us...> - 2003-10-05 13:36:15
|
Update of /cvsroot/gqclient/gq/src In directory sc8-pr-cvs1:/tmp/cvs-serv4087 Modified Files: dt_oc.c Log Message: * Got rid of most hand-knit linked list implementations, replaced them with GLists (errorchains, config->ldapservers, etc.) * some malloc->g_malloc changes Index: dt_oc.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/dt_oc.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** dt_oc.c 28 Sep 2003 23:20:47 -0000 1.15 --- dt_oc.c 5 Oct 2003 13:36:11 -0000 1.16 *************** *** 160,164 **** char **atnames; ! for ( ; oclist ; oclist = oclist->next) { LDAPObjectClass *oc = (LDAPObjectClass *) oclist->data; --- 160,164 ---- char **atnames; ! for ( ; oclist ; oclist = g_list_next(oclist)) { LDAPObjectClass *oc = (LDAPObjectClass *) oclist->data; *************** *** 232,236 **** GList *t; int found = 0; ! for (t = form->values ; t ; t = t->next) { GByteArray *gb = t->data; if (!gb) continue; --- 232,236 ---- GList *t; int found = 0; ! for (t = form->values ; t ; t = g_list_next(t)) { GByteArray *gb = t->data; if (!gb) continue; *************** *** 282,286 **** if (form) { GList *t; ! for (t = form->values ; t ; t = t->next) { LDAPObjectClass *oc2; GByteArray *gb = t->data; --- 282,286 ---- if (form) { GList *t; ! for (t = form->values ; t ; t = g_list_next(t)) { LDAPObjectClass *oc2; GByteArray *gb = t->data; *************** *** 453,458 **** if (data) { ! octmp = calloc(1, data->len + 1); ! strncpy(octmp, data->data, data->len); } oclist = ss->oc; --- 453,458 ---- if (data) { ! octmp = g_malloc0( data->len + 1); ! strncpy(octmp, data->data, data->len); /* UTF-8 OK */ } oclist = ss->oc; *************** *** 474,481 **** } } ! oclist = oclist->next; } ! if (octmp) free(octmp); gtk_combo_set_popdown_strings(GTK_COMBO(combo), --- 474,481 ---- } } ! oclist = g_list_next(oclist); } ! if (octmp) g_free(octmp); gtk_combo_set_popdown_strings(GTK_COMBO(combo), |
From: <sta...@us...> - 2003-10-05 13:35:24
|
Update of /cvsroot/gqclient/gq/src In directory sc8-pr-cvs1:/tmp/cvs-serv3961 Modified Files: debug.c Log Message: * Got rid of most hand-knit linked list implementations, replaced them with GLists (errorchains, config->ldapservers, etc.) Index: debug.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/debug.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** debug.c 4 Oct 2003 09:59:09 -0000 1.6 --- debug.c 5 Oct 2003 13:35:20 -0000 1.7 *************** *** 83,96 **** { struct ldapserver *server; ! int i; ! ! i = 1; ! server = config->ldapservers; ! while(server) { printf("server %d: %s\n", i, server->name); - server = server->next; i++; } - } --- 83,94 ---- { struct ldapserver *server; ! int i = 1; ! GList *I; ! ! for (I = config->servers ; I ; I = g_list_next(I)) { ! server = (struct ldapserver *) I->data; printf("server %d: %s\n", i, server->name); i++; } } |
From: <sta...@us...> - 2003-10-05 13:34:53
|
Update of /cvsroot/gqclient/gq/src In directory sc8-pr-cvs1:/tmp/cvs-serv3733 Modified Files: configfile.c configfile.h Log Message: * Got rid of many, many fixed size buffers. These might have been problematic with variable length characters (as in the standard UTF-8 encoding) * now error_push allows for printf-style variable argument lists, very convenient: no more dealing with an extra message buffer for variable messages. Got rid of many such buffers * Got rid of most hand-knit linked list implementations, replaced them with GLists (errorchains, config->ldapservers, etc.) * Many object types now have constructors and destructors of the form new_<type> and free_<type>. Use them instead of self-allocating and freeing memory as it was done before. Removed all such old style object handling * removed unneeded prototypes * Removed the old parser entirely Index: configfile.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/configfile.c,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** configfile.c 5 Oct 2003 00:36:39 -0000 1.34 --- configfile.c 5 Oct 2003 13:34:49 -0000 1.35 *************** *** 48,112 **** #include "syntax.h" #include "gq-xml.h" struct gq_config *config; - #ifdef OLD_PARSER - struct keywordlist configwords[] = { - { "gq-config", T_GQ_CONFIG , NEEDS_CLOSE }, - - /* global options */ [...1185 lines suppressed...] ! g_list_foreach(cfg->templates, (GFunc) free_template, NULL); g_list_free(cfg->templates); /* free filters */ ! ! g_list_foreach(cfg->filters, (GFunc) free_filter, NULL); g_list_free(cfg->filters); + /* free default display type hash */ + g_hash_table_foreach_remove(cfg->defaultDT, default_dt_remove, NULL); g_hash_table_destroy(cfg->defaultDT); cfg->defaultDT = NULL; ! /* free object itself */ ! ! g_free(cfg); } /* Index: configfile.h =================================================================== RCS file: /cvsroot/gqclient/gq/src/configfile.h,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** configfile.h 4 Oct 2003 10:15:46 -0000 1.23 --- configfile.h 5 Oct 2003 13:34:49 -0000 1.24 *************** *** 28,34 **** #include <stdio.h> - #include <glib.h> #define CURRENT_CONFIG_VERSION 2 --- 28,35 ---- #include <stdio.h> #include <glib.h> + #include "common.h" + #define CURRENT_CONFIG_VERSION 2 *************** *** 37,40 **** --- 38,42 ---- #define RCFILE ".gq" + #if 0 /* do not forget to set T_HIGHEST to the highest used token value below */ *************** *** 105,108 **** --- 107,112 ---- #define NEEDS_CLOSE 1 #define NEEDS_DATA 2 + #endif + #define BINDTYPE_SIMPLE 0 *************** *** 147,151 **** newer config file. */ ! struct ldapserver *ldapservers; GList *templates; GList *filters; --- 151,155 ---- newer config file. */ ! GList *servers; GList *templates; GList *filters; *************** *** 158,162 **** int sort_browse; int show_rdn_only; ! char schemaserver[64]; GHashTable *defaultDT; --- 162,166 ---- int sort_browse; int show_rdn_only; ! char *schemaserver; GHashTable *defaultDT; *************** *** 170,173 **** --- 174,178 ---- }; + #if 0 enum parselevel { TOP, IN_TAG, END *************** *** 197,201 **** char *cur_dt_attr; }; ! /* handy for writing config file */ --- 202,206 ---- char *cur_dt_attr; }; ! #endif /* handy for writing config file */ *************** *** 206,215 **** ! struct ldapserver *new_ldapserver(struct gq_config *config); ! struct gq_template *new_template(void); ! struct gq_filter *new_filter(void); ! void delete_ldapserver(struct ldapserver *dserver); char *homedir(void); - void init_ldapserver(struct ldapserver *server); /* filename_config returns the name of the config file. The returned --- 211,223 ---- ! void config_add_server(struct gq_config *config, ! struct ldapserver *newserver); ! void config_remove_server(struct gq_config *config, ! struct ldapserver *server); ! ! struct ldapserver *new_ldapserver(void); ! void free_ldapserver(struct ldapserver *server); ! char *homedir(void); /* filename_config returns the name of the config file. The returned *************** *** 221,230 **** void init_config(void); ! void cleanup_config(struct gq_config *cfg); ! ! /* cleanup_config + free */ void free_config(struct gq_config *cfg); - - void default_config(struct gq_config *cfg); extern struct gq_config *config; --- 229,234 ---- void init_config(void); ! struct gq_config *new_config(void); void free_config(struct gq_config *cfg); extern struct gq_config *config; |
From: <sta...@us...> - 2003-10-05 13:33:06
|
Update of /cvsroot/gqclient/gq/src In directory sc8-pr-cvs1:/tmp/cvs-serv3624 Modified Files: common.h Log Message: * Got rid of many, many fixed size buffers. These might have been problematic with variable length characters (as in the standard UTF-8 encoding) * Added g_free_and_dup and g_free_if macros * Added support to fall back to g_snprintf if snprintf is not sufficient Index: common.h =================================================================== RCS file: /cvsroot/gqclient/gq/src/common.h,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** common.h 4 Oct 2003 00:58:44 -0000 1.23 --- common.h 5 Oct 2003 13:33:02 -0000 1.24 *************** *** 78,95 **** struct ldapserver { ! char name[MAX_SERVERNAME_LEN]; ! char ldaphost[MAX_HOSTNAME_LEN]; int ldapport; ! char basedn[MAX_DN_LEN]; ! char binddn[MAX_DN_LEN]; ! char bindpw[MAX_BINDPW_LEN]; ! char pwencoding[32]; /* split the "configuration" password from the one entered by hand. This simplifies the handling of the configured password considerably */ ! char enteredpw[MAX_BINDPW_LEN]; int bindtype; ! char saslmechanism[128]; ! char searchattr[MAX_ATTR_LEN]; int maxentries; int cacheconn; --- 78,95 ---- struct ldapserver { ! char *name; ! char *ldaphost; int ldapport; ! char *basedn; ! char *binddn; ! char *bindpw; ! char *pwencoding; /* split the "configuration" password from the one entered by hand. This simplifies the handling of the configured password considerably */ ! char *enteredpw; int bindtype; ! char *saslmechanism; ! char *searchattr; int maxentries; int cacheconn; *************** *** 110,114 **** int flags; - struct ldapserver *next; int version; /* server_down is a flag set by the SIGPIPE signal handler and in --- 110,113 ---- *************** *** 130,133 **** --- 129,146 ---- gpointer data; }; + + #ifdef USE_G_SNPRINTF + # include <stdio.h> + # ifdef HAVE_G_SNPRINTF + # define snprintf g_snprintf + # endif + #endif + + #define g_free_and_dup(target, source) \ + { if (target) g_free(target); (target) = g_strdup(source); } + + #define g_free_if(x) \ + { if (x) g_free(x); (x) = NULL; } + #endif |
From: <sta...@us...> - 2003-10-05 13:26:07
|
Update of /cvsroot/gqclient/gq/src In directory sc8-pr-cvs1:/tmp/cvs-serv2607 Modified Files: browse.c Log Message: * Got rid of many, many fixed size buffers. These might have been problematic with variable length characters (as in the standard UTF-8 encoding) * now error_push allows for printf-style variable argument lists, very convenient: no more dealing with an extra message buffer for variable messages. Got rid of many such buffers. * Got rid of most hand-knit linked list implementations, replaced them with GLists (errorchains, config->ldapservers, etc.) Index: browse.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/browse.c,v retrieving revision 1.71 retrieving revision 1.72 diff -C2 -d -r1.71 -r1.72 *** browse.c 4 Oct 2003 09:59:09 -0000 1.71 --- browse.c 5 Oct 2003 13:25:59 -0000 1.72 *************** *** 133,137 **** added = gtk_ctree_insert_node(ctree, node, NULL, ! labels, 0, NULL, NULL, NULL, NULL, --- 133,137 ---- added = gtk_ctree_insert_node(ctree, node, NULL, ! (char**) labels, /* bug in the GTK2 API: should be const */ 0, NULL, NULL, NULL, NULL, *************** *** 298,315 **** " - %s", _("time limit exceeded")); } else if (err != LDAP_SUCCESS) { - char mdn[MAX_DN_LEN + 21]; error_push(context, ldap_err2string(err)); push_ldap_addl_error(ld, context); if (c && strlen(c)) { ! snprintf(mdn, sizeof(mdn), ! _("Matched DN: %s"), c); ! error_push(context, mdn); } if (refs) { int i; for (i = 0 ; refs[i] ; i++) { ! snprintf(mdn, sizeof(mdn), ! _("Referral to: %s"), refs[i]); ! error_push(context, mdn); } } --- 298,311 ---- " - %s", _("time limit exceeded")); } else if (err != LDAP_SUCCESS) { error_push(context, ldap_err2string(err)); push_ldap_addl_error(ld, context); if (c && strlen(c)) { ! error_push(context, _("Matched DN: %s"), c); } if (refs) { int i; for (i = 0 ; refs[i] ; i++) { ! error_push(context, ! _("Referral to: %s"), refs[i]); } } *************** *** 1006,1011 **** int server_cnt = 0; char message[128]; ! ! for(server = config->ldapservers ; server ; server = server->next) { add_single_server_internal(ctree, server); server_cnt++; --- 1002,1009 ---- int server_cnt = 0; char message[128]; ! GList *I; ! ! for( I = config->servers ; I ; I = g_list_next(I)) { ! server = (struct ldapserver *) I->data; add_single_server_internal(ctree, server); server_cnt++; *************** *** 1767,1774 **** if( (outfile = fopen(filename, "w")) == NULL) { ! snprintf(message, sizeof(message), ! _("Could not open output file: %s"), ! strerror(errno)); ! error_push(ctx, message); goto fail; --- 1765,1770 ---- if( (outfile = fopen(filename, "w")) == NULL) { ! error_push(ctx, _("Could not open output file: %s"), ! strerror(errno)); goto fail; *************** *** 1784,1791 **** written = fwrite(out->str, 1, out->len, outfile); if(written != out->len) { ! snprintf(message, sizeof(message), ! _("Save failed: Only %1$d of %2$d bytes written"), ! written, out->len); ! error_push(ctx, message); goto fail; /* sometimes goto is useful */ } --- 1780,1786 ---- written = fwrite(out->str, 1, out->len, outfile); if(written != out->len) { ! error_push(ctx, ! _("Save failed: Only %1$d of %2$d bytes written"), ! written, out->len); goto fail; /* sometimes goto is useful */ } *************** *** 2251,2259 **** struct ldapserver *server; cb_server_list csl; ! GList *l; ctree = BROWSETAB(tab)->ctreeroot; /* walk the list of ldapservers, add any not yet in the show list */ ! for (server = config->ldapservers ; server ; server = server->next) { if (server_node_from_server(ctree, server) == NULL) add_single_server_internal(ctree, server); --- 2246,2256 ---- struct ldapserver *server; cb_server_list csl; ! GList *l, *I; ctree = BROWSETAB(tab)->ctreeroot; /* walk the list of ldapservers, add any not yet in the show list */ ! ! for (I = config->servers ; I ; I = g_list_next(I)) { ! server = (struct ldapserver *) I->data; if (server_node_from_server(ctree, server) == NULL) add_single_server_internal(ctree, server); *************** *** 2275,2279 **** /* is this server still in the list of configured servers? */ struct ldapserver *server; ! for (server = config->ldapservers ; server ; server = server->next) { if (thisserver == server) { found = 1; --- 2272,2279 ---- /* is this server still in the list of configured servers? */ struct ldapserver *server; ! GList *I; ! ! for (I = config->servers ; I ; I = g_list_next(I)) { ! server = (struct ldapserver *) I->data; if (thisserver == server) { found = 1; |
From: <bi...@us...> - 2003-10-05 02:14:04
|
Update of /cvsroot/gqclient/gq/src In directory sc8-pr-cvs1:/tmp/cvs-serv15400 Modified Files: xmlparse.c Log Message: when reading a pref-UTF-8 version of ~/.gq, convert previously badly or not at all) escaped special XML chars into their properly escaped versions before passing to the XML parser Index: xmlparse.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/xmlparse.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** xmlparse.c 4 Oct 2003 10:09:02 -0000 1.2 --- xmlparse.c 5 Oct 2003 02:13:59 -0000 1.3 *************** *** 27,30 **** --- 27,34 ---- #include <string.h> + #include <sys/types.h> + #include <sys/stat.h> + #include <unistd.h> + #include <gtk/gtk.h> *************** *** 306,310 **** struct parser_context ctx; struct tagstack *stack = new_tagstack(); ! int rc; int handler_is_local = 0; #if GTK_MAJOR >= 2 --- 310,317 ---- struct parser_context ctx; struct tagstack *stack = new_tagstack(); ! struct stat sfile; ! char *cfgbuf; ! GString *newbuf; ! int rc, i, changed; int handler_is_local = 0; #if GTK_MAJOR >= 2 *************** *** 341,344 **** --- 348,428 ---- rewind(fp); + + if (strstr(firstline, "encoding=") == NULL ) { + /* more nastiness... since this config file was written by a + pre-UTF-8 version of GQ, it's not going to have <>&'" escaped + properly... fudge this now: silently rewrite the config + file on disk, then reopen it for the XML parser */ + changed = 0; + stat(file, &sfile); + cfgbuf = g_malloc(sfile.st_size + 1); + fread(cfgbuf, 1, sfile.st_size, fp); + cfgbuf[sfile.st_size] = 0; + newbuf = g_string_sized_new(sfile.st_size + 128); + for(i = 0; cfgbuf[i]; i++) { + switch(cfgbuf[i]) { + case '\\': + /* < and > used to be escaped with a \ */ + if(cfgbuf[i + 1] == '<') { + g_string_append(newbuf, "<"); + changed++; + i++; + } + else if(cfgbuf[i + 1] == '>') { + g_string_append(newbuf, ">"); + changed++; + i++; + } + else + g_string_append_c(newbuf, cfgbuf[i]); + break; + case '"': + /* this wasn't escaped at all */ + if(i > strlen(firstline)) { + /* only escape it if it's not in the + first line *argh* */ + g_string_append(newbuf, """); + changed++; + } + else + g_string_append_c(newbuf, '"'); + break; + case '\'': + /* neither was this */ + g_string_append(newbuf, "'"); + changed++; + break; + case '&': + /* if it's not the start of an XML escape, it + must be an illegal & */ + if(strncmp(cfgbuf + i + 1, "amp;", 4) && + strncmp(cfgbuf + i + 1, "lt;", 3) && + strncmp(cfgbuf + i + 1, "gt;", 3) && + strncmp(cfgbuf + i + 1, "apos;", 5) && + strncmp(cfgbuf + i + 1, "quot;", 5)) { + g_string_append(newbuf, "&"); + changed++; + } + else + g_string_append_c(newbuf, cfgbuf[i]); + break; + default: + g_string_append_c(newbuf, cfgbuf[i]); + } + } + + if(changed) { + fclose(fp); + fp = fopen(file, "w"); + fwrite(newbuf->str, 1, newbuf->len, fp); + fclose(fp); + fp = fopen(file, "r"); + } + else + rewind(fp); + + g_free(cfgbuf); + g_string_free(newbuf, TRUE); + } xmlParserCtxtPtr parser = xmlCreateIOParserCtxt(handler, |
From: <bi...@us...> - 2003-10-05 00:36:43
|
Update of /cvsroot/gqclient/gq/src In directory sc8-pr-cvs1:/tmp/cvs-serv2751 Modified Files: configfile.c Log Message: properly escape & ' and " in the config file as well Index: configfile.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/configfile.c,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** configfile.c 4 Oct 2003 23:36:27 -0000 1.33 --- configfile.c 5 Oct 2003 00:36:39 -0000 1.34 *************** *** 841,844 **** --- 841,853 ---- g_string_append(outstr, ">"); break; + case '&': + g_string_append(outstr, "&"); + break; + case '\'': + g_string_append(outstr, "'"); + break; + case '"': + g_string_append(outstr, """); + break; default: g_string_append_c(outstr, c); |
From: <bi...@us...> - 2003-10-04 23:36:31
|
Update of /cvsroot/gqclient/gq/src In directory sc8-pr-cvs1:/tmp/cvs-serv26454 Modified Files: configfile.c Log Message: properly escape < and > when writing ~/.gq also handle this as unicode, not ASCII (peter can you check this please) Index: configfile.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/configfile.c,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** configfile.c 4 Oct 2003 10:15:46 -0000 1.32 --- configfile.c 4 Oct 2003 23:36:27 -0000 1.33 *************** *** 827,840 **** static void config_write_string(struct writeconfig *wc, const char *value, const char *entity) { ! int i; ! GString *outstr = g_string_sized_new(1024); g_string_sprintf(outstr, "<%s>", entity); ! /* quick-and-dirty escape < and > */ ! for(i = 0; value[i]; i++) { ! if(value[i] == '<' || value[i] == '>') { ! g_string_append(outstr, "\\"); } - g_string_append_c(outstr, value[i]); } --- 827,847 ---- static void config_write_string(struct writeconfig *wc, const char *value, const char *entity) { ! GString *outstr; ! gunichar c; ! ! outstr = g_string_sized_new(1024); g_string_sprintf(outstr, "<%s>", entity); ! for(c = g_utf8_get_char(value); c; value = g_utf8_next_char(value), c = *value) { ! switch(c) { ! case '<': ! g_string_append(outstr, "<"); ! break; ! case '>': ! g_string_append(outstr, ">"); ! break; ! default: ! g_string_append_c(outstr, c); } } *************** *** 843,846 **** --- 850,854 ---- g_string_append(outstr, ">\n"); config_write(wc, outstr->str); + } |
From: <sta...@us...> - 2003-10-04 10:19:05
|
Update of /cvsroot/gqclient/gq In directory sc8-pr-cvs1:/tmp/cvs-serv8879 Modified Files: ChangeLog Log Message: * New changes by me Index: ChangeLog =================================================================== RCS file: /cvsroot/gqclient/gq/ChangeLog,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** ChangeLog 30 Sep 2003 17:20:24 -0000 1.41 --- ChangeLog 4 Oct 2003 10:19:00 -0000 1.42 *************** *** 1,2 **** --- 1,15 ---- + 2003-10-03 Peter Stamfest <pe...@st...> + * Added a libxml/libxml2 based XML config file parser (SAX + based). It should be possible to switch to expat as well. It + cannot handle some of the encoding issues I have to deal with + right now. + * Got rid of the static gq_config. Turned it into a pointer mostly + for practical reasons. This might also reduce the on-disk + file-size of gq. + 2003-10-01 Peter Stamfest <pe...@st...> + * New japanese translations (including mnemonics) by Nezumi + (Hatuka*nezumi <ne...@jc...>) + * Transition to UTF-8 + * Added missing _()'s in search.c 2003-09-30 Peter Stamfest <pe...@st...> * Fixed many small bugs wrt gtk2, cleanups *************** *** 16,20 **** version. Afterward gtk 1.x support will be dropped. - Many changes to signal handlers due to new signal semantics in gtk2 ! * Many header files: Added $Id$, multiple inclusion protection and copyright notices * Most header files now are self-contained. There is a "test" --- 29,33 ---- version. Afterward gtk 1.x support will be dropped. - Many changes to signal handlers due to new signal semantics in gtk2 ! * Many header files: Added CVS Id-s copyright notices * Most header files now are self-contained. There is a "test" |
From: <sta...@us...> - 2003-10-04 10:18:38
|
Update of /cvsroot/gqclient/gq In directory sc8-pr-cvs1:/tmp/cvs-serv8814 Modified Files: configure.in Log Message: * Cleanups wrt glib detection * libxml/libxml2 detection * UTF-8 support detection * Detection for g_snprintf (might be used on some platforms to replace snprintf) - not yet functioning properly Index: configure.in =================================================================== RCS file: /cvsroot/gqclient/gq/configure.in,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** configure.in 29 Sep 2003 19:24:13 -0000 1.45 --- configure.in 4 Oct 2003 10:18:13 -0000 1.46 *************** *** 62,65 **** --- 62,68 ---- GLIB_MINOR= + GLIB_LIBS= + GLIB_CFLAGS= + AC_PATH_PROG(PKG_CONFIG, pkg-config,,$PATH) *************** *** 75,88 **** if test "x$GLIB_MAJOR" = x ; then AC_MSG_CHECKING(for GLIB) ! GLIB_CFLAGS=`$PKG_CONFIG --cflags glib` ! GLIB_LIBS=`$PKG_CONFIG --libs glib` ! if test "x$GLIB_LIBS" = "x" ; then ! AC_PATH_PROG(GLIB_CONFIG, glib-config,,$PATH) ! ! if test -x $GLIB_CONFIG ; then GLIB_CFLAGS=`$GLIB_CONFIG --cflags` GLIB_LIBS=`$GLIB_CONFIG --libs` --- 78,95 ---- if test "x$GLIB_MAJOR" = x ; then + AC_PATH_PROG(PKG_CONFIG, pkg-config,,$PATH) + AC_PATH_PROG(GLIB_CONFIG, glib-config,,$PATH) AC_MSG_CHECKING(for GLIB) ! if test -x $PKG_CONFIG ; then ! GLIB_CFLAGS=`$PKG_CONFIG --cflags glib` ! GLIB_LIBS=`$PKG_CONFIG --libs glib` ! fi + # strip whitespace + GLIB_LIBS=`echo $GLIB_LIBS` ! if test "x$GLIB_LIBS" = x ; then ! if test -x "$GLIB_CONFIG" ; then GLIB_CFLAGS=`$GLIB_CONFIG --cflags` GLIB_LIBS=`$GLIB_CONFIG --libs` *************** *** 90,94 **** fi ! if test "x$GLIB_LIBS" != "x" ; then AC_MSG_RESULT(yes) else --- 97,101 ---- fi ! if test "x$GLIB_LIBS" != x ; then AC_MSG_RESULT(yes) else *************** *** 96,105 **** fi ! LIBS="$LIBS $GLIB_LIBS" ! CFLAGS="$CFLAGS $GLIB_CFLAGS" ! CPPFLAGS="$CPPFLAGS $GLIB_CFLAGS" ! GLIB_MAJOR=1 ! GLIB_MINOR=2 fi --- 103,116 ---- fi + # strip whitespace + GLIB_LIBS=`echo $GLIB_LIBS` ! if test "x$GLIB_LIBS" != x ; then ! LIBS="$LIBS $GLIB_LIBS" ! CFLAGS="$CFLAGS $GLIB_CFLAGS" ! CPPFLAGS="$CPPFLAGS $GLIB_CFLAGS" ! GLIB_MAJOR=1 ! GLIB_MINOR=2 ! fi fi *************** *** 107,110 **** --- 118,123 ---- AC_DEFINE_UNQUOTED(GLIB_MAJOR,$GLIB_MAJOR,[The major version of GLIB as found by the configure script]) AC_DEFINE_UNQUOTED(GLIB_MINOR,$GLIB_MINOR,[The minor version of GLIB as found by the configure script]) + else + AC_MSG_ERROR([glib not found]) fi *************** *** 126,129 **** --- 139,144 ---- if test "x$GTK_MAJOR" = x ; then + AC_PATH_PROG(PKG_CONFIG, pkg-config,,$PATH) + AC_PATH_PROG(GTK_CONFIG, gtk-config,,$PATH) AC_MSG_CHECKING(for GTK+) *************** *** 132,139 **** GTK_LIBS=`$PKG_CONFIG --libs gtk+` if test "x$GTK_LIBS" = "x" ; then ! AC_PATH_PROG(GTK_CONFIG, gtk-config,,$PATH) ! ! if test -x $GTK_CONFIG ; then GTK_CFLAGS=`$GTK_CONFIG --cflags` GTK_LIBS=`$GTK_CONFIG --libs` --- 147,155 ---- GTK_LIBS=`$PKG_CONFIG --libs gtk+` + # strip whitespace + GTK_LIBS=`echo $GTK_LIBS` + if test "x$GTK_LIBS" = "x" ; then ! if test -x "$GTK_CONFIG" ; then GTK_CFLAGS=`$GTK_CONFIG --cflags` GTK_LIBS=`$GTK_CONFIG --libs` *************** *** 141,144 **** --- 157,162 ---- fi + # strip whitespace + GTK_LIBS=`echo $GTK_LIBS` if test "x$GTK_LIBS" != "x" ; then AC_MSG_RESULT(yes) *************** *** 147,156 **** fi ! ! LIBS="$LIBS $GTK_LIBS" ! CFLAGS="$CFLAGS $GTK_CFLAGS" ! CPPFLAGS="$CPPFLAGS $GTK_CFLAGS" ! GTK_MAJOR=1 ! GTK_MINOR=2 fi --- 165,175 ---- fi ! if test "x$GTK_LIBS" != x ; then ! LIBS="$LIBS $GTK_LIBS" ! CFLAGS="$CFLAGS $GTK_CFLAGS" ! CPPFLAGS="$CPPFLAGS $GTK_CFLAGS" ! GTK_MAJOR=1 ! GTK_MINOR=2 ! fi fi *************** *** 158,163 **** --- 177,227 ---- AC_DEFINE_UNQUOTED(GTK_MAJOR,$GTK_MAJOR,[The major version of GTK as found by the configure script]) AC_DEFINE_UNQUOTED(GTK_MINOR,$GTK_MINOR,[The minor version of GTK as found by the configure script]) + else + AC_MSG_ERROR([gtk not found]) fi + + + + AC_CHECK_TYPE(gunichar, + AC_DEFINE(HAVE_GUNICHAR,,[Define if the gunichar type is available through gunicode.h]), + ,[#include <glib/gunicode.h>]) + + AC_CHECK_FUNCS(g_unichar_isspace g_unichar_isdigit) + + + + AC_CHECK_LIB(xml2, xmlSAXUserParseFile, + [AC_DEFINE(HAVE_LIBXML2,,[Define if libxml2 is available on your system]) + XML_CFLAGS=`$PKG_CONFIG --cflags libxml-2.0` + XML_LIBS=`$PKG_CONFIG --libs libxml-2.0` + LIBS="$LIBS $XML_LIBS" + CFLAGS="$CFLAGS $XML_CFLAGS" + ]) + + AC_CHECK_LIB(xml, xmlSAXUserParseFile, + [AC_DEFINE(HAVE_LIBXML,,[Define if libxml is available on your system]) + LIBS="-lxml $LIBS"]) + + + + + + + + + + + + + + + + + + + + + DEBUG=1 AC_ARG_ENABLE(debugging, *************** *** 263,267 **** AC_CHECK_FUNCS(ldap_str2objectclass ldap_memfree ldap_rename ldap_str2dn \ ldap_initialize \ ! iswspace snprintf) AC_ARG_WITH(kerberos-prefix, --- 327,332 ---- AC_CHECK_FUNCS(ldap_str2objectclass ldap_memfree ldap_rename ldap_str2dn \ ldap_initialize \ ! iswspace snprintf \ ! g_snprintf) AC_ARG_WITH(kerberos-prefix, *************** *** 465,468 **** --- 530,544 ---- ] ) + + if test "$gq_cv_print_reordering" = no ; then + AC_CHECK_FUNC(g_snprintf, [HAVE_G_SNPRINTF=1]) + AC_CHECK_FUNCS(g_printf g_sprintf) + + if test "x$HAVE_G_SNPRINTF" != "x" ; then + gq_cv_print_reordering=yes + AC_DEFINE(USE_G_PRINTF,1,[Define if the standard C *printf functions should be replaced their glib versions]) + fi + + fi dnl Disable NLS if print reordering is not supported |
From: <sta...@us...> - 2003-10-04 10:15:57
|
Update of /cvsroot/gqclient/gq/src In directory sc8-pr-cvs1:/tmp/cvs-serv8119 Modified Files: configfile.c configfile.h Log Message: * Got rid of global struct gq_config object - use pointer now * IFDEF'd out the old parser * Changed many functions to support the new libxml-based parser * Files need further clean-ups Index: configfile.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/configfile.c,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** configfile.c 29 Sep 2003 19:24:15 -0000 1.31 --- configfile.c 4 Oct 2003 10:15:46 -0000 1.32 *************** *** 47,54 **** #include "ldif.h" /* for b64_encode */ #include "syntax.h" ! struct gq_config config; ! struct keywordlist configwords[] = { { "gq-config", T_GQ_CONFIG , NEEDS_CLOSE }, --- 47,55 ---- #include "ldif.h" /* for b64_encode */ [...1045 lines suppressed...] FREE(filterlist->data, "struct gq_filter"); filterlist = filterlist->next; } ! g_list_free(cfg->filters); ! g_hash_table_foreach_remove(cfg->defaultDT, default_dt_remove, NULL); ! g_hash_table_destroy(cfg->defaultDT); ! cfg->defaultDT = NULL; } + /* free *cfg itself */ + void free_config(struct gq_config *cfg) + { + if (cfg) { + cleanup_config(cfg); + g_free(cfg); + } + } Index: configfile.h =================================================================== RCS file: /cvsroot/gqclient/gq/src/configfile.h,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** configfile.h 29 Sep 2003 19:24:15 -0000 1.22 --- configfile.h 4 Oct 2003 10:15:46 -0000 1.23 *************** *** 31,35 **** #include <glib.h> ! #define CURRENT_CONFIG_VERSION 1 #define CONFIG_INDENT_STRING " " --- 31,35 ---- #include <glib.h> ! #define CURRENT_CONFIG_VERSION 2 #define CONFIG_INDENT_STRING " " *************** *** 145,149 **** version */ long last_asked; /* timestamp of lask asking for upgrade to a ! newer confiig file. */ struct ldapserver *ldapservers; --- 145,149 ---- version */ long last_asked; /* timestamp of lask asking for upgrade to a ! newer config file. */ struct ldapserver *ldapservers; *************** *** 206,218 **** ! struct ldapserver *new_ldapserver(void); struct gq_template *new_template(void); struct gq_filter *new_filter(void); void delete_ldapserver(struct ldapserver *dserver); char *homedir(void); - void config_id_string(struct configfile *f); - void config_get_token(struct configfile *f); - void config_skip_whitespace(struct configfile *f); - int config_get_bool(struct configfile *f); void init_ldapserver(struct ldapserver *server); --- 206,214 ---- ! struct ldapserver *new_ldapserver(struct gq_config *config); struct gq_template *new_template(void); struct gq_filter *new_filter(void); void delete_ldapserver(struct ldapserver *dserver); char *homedir(void); void init_ldapserver(struct ldapserver *server); *************** *** 222,236 **** void load_config(void); - void config_write(struct writeconfig *wc, const char *string); - void config_write_bool(struct writeconfig *wc, int value, const char *entity); - void config_write_int(struct writeconfig *wc, int value, const char *entity); - void config_write_string(struct writeconfig *wc, const char *value, const char *entity); - void config_write_string_ne(struct writeconfig *wc, const char *value, const char *entity); void save_config(void); void init_config(void); - void cleanup_config(void); ! extern struct gq_config config; extern struct tokenlist token_bindtype[]; #endif --- 218,235 ---- void load_config(void); void save_config(void); void init_config(void); ! void cleanup_config(struct gq_config *cfg); ! ! /* cleanup_config + free */ ! void free_config(struct gq_config *cfg); ! ! void default_config(struct gq_config *cfg); ! ! extern struct gq_config *config; extern struct tokenlist token_bindtype[]; + extern struct tokenlist token_ldifformat[]; + extern struct tokenlist token_searchargument[]; #endif |
From: <sta...@us...> - 2003-10-04 10:14:10
|
Update of /cvsroot/gqclient/gq/src In directory sc8-pr-cvs1:/tmp/cvs-serv8072 Modified Files: formfill.c Log Message: * Got rid of global struct gq_config object - use pointer now * Added more positional arguments for i18n'd string Index: formfill.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/formfill.c,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** formfill.c 2 Oct 2003 16:16:26 -0000 1.35 --- formfill.c 4 Oct 2003 10:14:03 -0000 1.36 *************** *** 184,193 **** message = g_string_sized_new(128); #if GTK_MAJOR >= 2 ! g_string_sprintf(message, _("fetching %s from %s"), dn, server->name); #else { char *c = NULL; ! g_string_sprintf(message, _("fetching %s from %s"), c = decoded_string(dn), server->name); if (c) free(c); --- 184,193 ---- message = g_string_sized_new(128); #if GTK_MAJOR >= 2 ! g_string_sprintf(message, _("fetching %1$s from %2$s"), dn, server->name); #else { char *c = NULL; ! g_string_sprintf(message, _("fetching %1$s from %2$s"), c = decoded_string(dn), server->name); if (c) free(c); *************** *** 442,447 **** form->syntax = get_syntax_handler_of_attr(server, form->attrname, NULL); ! if (config.defaultDT) { ! val = g_hash_table_lookup(config.defaultDT, form->attrname); } --- 442,447 ---- form->syntax = get_syntax_handler_of_attr(server, form->attrname, NULL); ! if (config->defaultDT) { ! val = g_hash_table_lookup(config->defaultDT, form->attrname); } |
From: <sta...@us...> - 2003-10-04 10:13:35
|
Update of /cvsroot/gqclient/gq/src In directory sc8-pr-cvs1:/tmp/cvs-serv8008 Modified Files: gq.c Log Message: * Got rid of global struct gq_config object - use pointer now * More codeset support wrt i18n Index: gq.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/gq.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** gq.c 1 Oct 2003 22:31:57 -0000 1.16 --- gq.c 4 Oct 2003 10:13:29 -0000 1.17 *************** *** 53,56 **** --- 53,59 ---- void *p; + /* return main_test(argc, argv); */ + + #ifdef DEBUG # ifdef HAVE_MCHECK *************** *** 83,89 **** bindtextdomain(PACKAGE, LOCALEDIR); ! #if GTK_MAJOR >= 2 bind_textdomain_codeset(PACKAGE, "UTF-8"); ! #endif gtk_set_locale(); --- 86,96 ---- bindtextdomain(PACKAGE, LOCALEDIR); ! #if ENABLE_NLS ! # if GTK_MAJOR >= 2 bind_textdomain_codeset(PACKAGE, "UTF-8"); ! # else ! bind_textdomain_codeset(PACKAGE, gq_codeset); ! # endif ! #endif gtk_set_locale(); *************** *** 144,149 **** gtk_main (); ! if (config.changed) save_config(); ! cleanup_config(); gtk_exit(0); --- 151,156 ---- gtk_main (); ! if (config->changed) save_config(); ! cleanup_config(config); gtk_exit(0); *************** *** 168,172 **** #endif /* DEBUG */ ! for(server = config.ldapservers ; server ; server = server->next) { server->server_down++; } --- 175,179 ---- #endif /* DEBUG */ ! for(server = config->ldapservers ; server ; server = server->next) { server->server_down++; } |
From: <sta...@us...> - 2003-10-04 10:12:34
|
Update of /cvsroot/gqclient/gq/src In directory sc8-pr-cvs1:/tmp/cvs-serv7865 Modified Files: util.c Log Message: * Got rid of global struct gq_config object - use pointer now * Added more positional arguments to i18n'd strings Index: util.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/util.c,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** util.c 2 Oct 2003 16:16:26 -0000 1.60 --- util.c 4 Oct 2003 10:12:27 -0000 1.61 *************** *** 357,361 **** } else { snprintf(message, sizeof(message), ! _("connecting to %s port %d"), server->ldaphost, server->ldapport); } --- 357,361 ---- } else { snprintf(message, sizeof(message), ! _("connecting to %1$s port %2$d"), server->ldaphost, server->ldapport); } *************** *** 780,784 **** return(NULL); ! server = config.ldapservers; while(server) { if(!strcmp(server->name, name)) --- 780,784 ---- return(NULL); ! server = config->ldapservers; while(server) { if(!strcmp(server->name, name)) *************** *** 1192,1196 **** template = NULL; ! templatelist = config.templates; while(templatelist) { template = (struct gq_template *) templatelist->data; --- 1192,1196 ---- template = NULL; ! templatelist = config->templates; while(templatelist) { template = (struct gq_template *) templatelist->data; *************** *** 1582,1586 **** snprintf(message, sizeof(message), ! ngettext("One suffix found", "%d suffixes found", num_suffixes), num_suffixes); statusbar_msg(message); --- 1582,1587 ---- snprintf(message, sizeof(message), ! ngettext("One suffix found", "%d suffixes found", ! num_suffixes), num_suffixes); statusbar_msg(message); |