--- Begin Message ---
Package: gq
Version: 1.0beta1-4
Severity: wishlist
When shadow informations are stored in ldap, the two fields
passwordLastChanged and shadowExpires are "days after 1970-01-01".
gq displays these seconds as an integer, so you need to use some
external means to to the conversion between days and a human readable
date.
The attached patch adds a hack to modify those two fields easily.
Please send upstream.
-- System Information:
Debian Release: testing/unstable
APT prefers unstable
APT policy: (989, 'unstable')
Architecture: i386 (i686)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.16.11-walker
Locale: LANG=de_DE.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Versions of packages gq depends on:
ii libatk1.0-0 1.11.4-1 The ATK accessibility toolkit
ii libc6 2.3.6-7 GNU C Library: Shared libraries
ii libglib2.0-0 2.10.2-1 The GLib library of C routines
ii libgtk2.0-0 2.8.17-1 The GTK+ graphical user interface
ii libldap2 2.1.30-13 OpenLDAP libraries
ii libpango1.0-0 1.12.1-2 Layout and rendering of internatio
ii libssl0.9.7 0.9.7i-1 SSL shared libraries
ii libxml2 2.6.23.dfsg.2-3 GNOME XML library
ii zlib1g 1:1.2.3-11 compression library - runtime
gq recommends no packages.
-- no debconf information
--- gq-1.0beta1.orig/src/formfill.h
+++ gq-1.0beta1/src/formfill.h
@@ -56,6 +56,7 @@
# define DISPLAYTYPE_TIME 10
# define DISPLAYTYPE_INT 11
# define DISPLAYTYPE_NUMSTR 12
+# define DISPLAYTYPE_DATE 13
#define FLAG_NOT_IN_SCHEMA 0x01
#define FLAG_MUST_IN_SCHEMA 0x02
--- gq-1.0beta1.orig/src/Makefile.am
+++ gq-1.0beta1/src/Makefile.am
@@ -65,6 +65,7 @@
dt_cert.c \
dt_crl.c \
dt_time.c \
+ dt_date.c \
dt_int.c \
dt_numstr.c \
ldapops.c \
@@ -116,6 +117,7 @@
dt_cert.h \
dt_crl.h \
dt_time.h \
+ dt_date.h \
dt_int.h \
dt_numstr.h \
ldapops.h \
--- gq-1.0beta1.orig/src/Makefile.in
+++ gq-1.0beta1/src/Makefile.in
@@ -180,6 +180,7 @@
dt_cert.c \
dt_crl.c \
dt_time.c \
+ dt_date.c \
dt_int.c \
dt_numstr.c \
ldapops.c \
@@ -232,6 +233,7 @@
dt_cert.h \
dt_crl.h \
dt_time.h \
+ dt_date.h \
dt_int.h \
dt_numstr.h \
ldapops.h \
@@ -275,7 +277,8 @@
dt_time.$(OBJEXT) dt_int.$(OBJEXT) dt_numstr.$(OBJEXT) \
ldapops.$(OBJEXT) tdefault.$(OBJEXT) browse-dnd.$(OBJEXT) \
i18n.$(OBJEXT) gq-xml.$(OBJEXT) xmlparse.$(OBJEXT) \
- xmlutil.$(OBJEXT) progress.$(OBJEXT) state.$(OBJEXT)
+ xmlutil.$(OBJEXT) progress.$(OBJEXT) state.$(OBJEXT) \
+ dt_date.$(OBJEXT)
gq_OBJECTS = $(am_gq_OBJECTS)
gq_DEPENDENCIES = COPYING.o
gq_LDFLAGS =
@@ -310,7 +313,8 @@
@AMDEP_TRUE@ ./$(DEPDIR)/state.Po ./$(DEPDIR)/syntax.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/tdefault.Po ./$(DEPDIR)/template.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/tinput.Po ./$(DEPDIR)/util.Po \
[EMAIL PROTECTED]@ ./$(DEPDIR)/xmlparse.Po ./$(DEPDIR)/xmlutil.Po
[EMAIL PROTECTED]@ ./$(DEPDIR)/xmlparse.Po ./$(DEPDIR)/xmlutil.Po \
[EMAIL PROTECTED]@ ./$(DEPDIR)/dt_date.Po
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
@@ -386,6 +390,7 @@
@AMDEP_TRUE@@am__include@ @[EMAIL PROTECTED]/$(DEPDIR)/[EMAIL PROTECTED]@
@AMDEP_TRUE@@am__include@ @[EMAIL PROTECTED]/$(DEPDIR)/[EMAIL PROTECTED]@
@AMDEP_TRUE@@am__include@ @[EMAIL PROTECTED]/$(DEPDIR)/[EMAIL PROTECTED]@
[EMAIL PROTECTED]@@am__include@ @[EMAIL PROTECTED]/$(DEPDIR)/[EMAIL PROTECTED]@
@AMDEP_TRUE@@am__include@ @[EMAIL PROTECTED]/$(DEPDIR)/[EMAIL PROTECTED]@
@AMDEP_TRUE@@am__include@ @[EMAIL PROTECTED]/$(DEPDIR)/[EMAIL PROTECTED]@
@AMDEP_TRUE@@am__include@ @[EMAIL PROTECTED]/$(DEPDIR)/[EMAIL PROTECTED]@
--- gq-1.0beta1.orig/src/syntax.c
+++ gq-1.0beta1/src/syntax.c
@@ -53,6 +53,7 @@
#include "dt_time.h"
#include "dt_int.h"
#include "dt_numstr.h"
+#include "dt_date.h"
/* Syntaxes we recognize and may handle specially. This is a rather
inefficient way to store oids (we search by string-comparison, but
@@ -61,6 +62,7 @@
static int octetString_attr(const char *attr, const char *syntax_oid);
static int oid_attr(const char *attr, const char *syntax_oid);
+static int int_attr(const char *attr, const char *syntax_oid);
static struct syntax_handler syntaxes[] = {
{ "1.3.6.1.4.1.1466.115.121.1.1",
@@ -222,7 +224,7 @@
{ "1.3.6.1.4.1.1466.115.121.1.27",
"INTEGER",
DISPLAYTYPE_INT,
- NULL,
+ int_attr,
0,
},
{ "1.3.6.1.4.1.1466.115.121.1.28",
@@ -444,6 +446,16 @@
return DISPLAYTYPE_ENTRY;
}
+static int int_attr(const char *attr, const char *syntax_oid) {
+ if(!strcasecmp(attr, "shadowLastChange")) {
+ return DISPLAYTYPE_DATE;
+ }
+ if(!strcasecmp(attr, "shadowExpire")) {
+ return DISPLAYTYPE_DATE;
+ }
+ return DISPLAYTYPE_INT;
+}
+
/* mapping of display types to handlers */
static GHashTable *dt_handlers = NULL;
@@ -520,6 +532,7 @@
add_syntax(DISPLAYTYPE_TIME, dt_time_get_handler());
add_syntax(DISPLAYTYPE_INT, dt_int_get_handler());
add_syntax(DISPLAYTYPE_NUMSTR, dt_numstr_get_handler());
+ add_syntax(DISPLAYTYPE_DATE, dt_date_get_handler());
}
struct syntax_handler *get_syntax_handler_of_attr(int error_context,
--- gq-1.0beta1.orig/src/dt_date.c
+++ gq-1.0beta1/src/dt_date.c
@@ -0,0 +1,271 @@
+/*
+ GQ -- a GTK-based LDAP client
+ Copyright (C) 2006 Philipp Hahn
+
+ 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$ */
+
+#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 "dtutil.h"
+#include "dt_date.h"
+#include "i18n.h"
+
+static GtkWidget *dt_date_get_widget(int error_context,
+ struct formfill *form,
+ GByteArray *data,
+ GtkSignalFunc *activatefunc,
+ gpointer funcdata);
+
+static GByteArray *dt_date_get_data(struct formfill *form,
+ GtkWidget *widget);
+
+static void dt_date_set_data(struct formfill *form,
+ GByteArray *data,
+ GtkWidget *widget);
+
+static dt_date_handler dt_date_handler_vtab = {
+ "Generalized Date",
+ TRUE,
+ TRUE,
+
+ dt_date_get_widget,
+ dt_date_get_data,
+ dt_date_set_data,
+ bervalLDAPMod
+};
+
+typedef struct _cbdata {
+ struct formfill *form;
+ GtkWidget *hbox;
+ GtkWidget *editwindow;
+} cbdata;
+
+display_type_handler *dt_date_get_handler()
+{
+ return (display_type_handler *) &dt_date_handler_vtab;
+}
+
+static void dt_date_ok_callback(GtkWidget *button, cbdata *cbd)
+{
+ GtkWidget *editwindow = cbd->editwindow;
+ GtkWidget *w;
+ int y, m, d;
+ int sign;
+ char buffer[10];
+ time_t t = 0;
+ struct tm tm;
+
+ w = gtk_object_get_data(GTK_OBJECT(editwindow), "calendar");
+ if (w) {
+ gtk_calendar_get_date(GTK_CALENDAR(w), &y, &m, &d);
+
+ memset(&tm, 0, sizeof(struct tm));
+ tm.tm_year = y - 1900;
+ tm.tm_mon = m;
+ tm.tm_mday = d;
+ t = mktime(&tm);
+ t /= 24*60*60;
+ }
+
+ snprintf(buffer, sizeof(buffer), "%ld", t);
+
+ 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_date_edit_window(GtkWidget *button, cbdata *cbd)
+{
+ GtkWidget *hbox = cbd->hbox;
+ GtkWidget *inputbox = dt_date_retrieve_inputbox(hbox);
+ GtkWidget *editwindow, *main_vbox, *calendar, *w;
+ GtkWidget *hbox2, *button2;
+ GtkAdjustment *adj;
+ char titlebuffer[1024]; /* FIXME: fixed buffer length */
+
+ struct tm tm;
+ int y, m, d;
+ time_t t;
+ struct tm *l;
+ gchar *content;
+
+ time(&t);
+ l = localtime(&t); /* implicitly calls tzset() for us */
+
+ y = l->tm_year;
+ m = l->tm_mon;
+ d = l->tm_mday;
+
+#ifdef GTK_WINDOW_DIALOG
+ editwindow = gtk_window_new(GTK_WINDOW_DIALOG);
+#else
+ editwindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+#endif
+ cbd->editwindow = editwindow;
+
+ snprintf(titlebuffer, sizeof(titlebuffer),
+ _("%s: choose date"), 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), 5);
+ 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) {
+ sscanf(content, "%ld", &t);
+ t *= 24*60*60;
+ gmtime_r(&t, &tm);
+ y = tm.tm_year;
+ m = tm.tm_mon;
+ d = tm.tm_mday;
+ g_free(content);
+ }
+
+ gtk_calendar_select_month(GTK_CALENDAR(calendar), m, y + 1900);
+ gtk_calendar_select_day(GTK_CALENDAR(calendar), d);
+
+ hbox2 = gtk_hbutton_box_new();
+ gtk_box_pack_start(GTK_BOX(main_vbox), hbox2, FALSE, TRUE, 5);
+ gtk_widget_show(hbox2);
+
+#if GTK_MAJOR >= 2
+ button2 = gtk_button_new_from_stock(GTK_STOCK_OK);
+#else
+ button2 = gq_button_new_with_label(_("_OK"));
+#endif
+ gtk_widget_show(button2);
+ gtk_signal_connect(GTK_OBJECT(button2), "clicked",
+ GTK_SIGNAL_FUNC(dt_date_ok_callback),
+ (gpointer) cbd);
+ gtk_box_pack_start(GTK_BOX(hbox2), button2, FALSE, TRUE, 0);
+ GTK_WIDGET_SET_FLAGS(button2, GTK_CAN_DEFAULT);
+ gtk_widget_grab_default(button2);
+
+#if GTK_MAJOR >= 2
+ button2 = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
+#else
+ button2 = gq_button_new_with_label(_("_Cancel"));
+#endif
+ gtk_box_pack_end(GTK_BOX(hbox2), button2, FALSE, TRUE, 0);
+ gtk_signal_connect_object(GTK_OBJECT(button2), "clicked",
+ GTK_SIGNAL_FUNC(gtk_widget_destroy),
+ (gpointer) editwindow);
+ gtk_widget_show(button2);
+
+ gtk_widget_show(editwindow);
+}
+
+static GtkWidget *dt_date_get_widget(int error_context,
+ struct formfill *form,
+ GByteArray *data,
+ GtkSignalFunc *activatefunc,
+ gpointer funcdata)
+{
+ 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) funcdata);
+
+ 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_date_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_date_set_data(form, data, hbox);
+
+ return hbox;
+}
+
+static GByteArray *dt_date_get_data(struct formfill *form,
+ GtkWidget *widget)
+{
+ return editable_get_text(GTK_EDITABLE(dt_date_retrieve_inputbox(widget)));
+}
+
+static void dt_date_set_data(struct formfill *form,
+ GByteArray *data,
+ GtkWidget *widget)
+{
+ editable_set_text(GTK_EDITABLE(dt_date_retrieve_inputbox(widget)),
+ data,
+ NULL, NULL);
+}
+
+GtkWidget *dt_date_retrieve_inputbox(GtkWidget *hbox)
+{
+ return gtk_object_get_data(GTK_OBJECT(hbox), "inputbox");
+}
+
+
+/*
+ Local Variables:
+ c-basic-offset: 5
+ End:
+ */
--- gq-1.0beta1.orig/src/dt_date.h
+++ gq-1.0beta1/src/dt_date.h
@@ -0,0 +1,49 @@
+/*
+ GQ -- a GTK-based LDAP client
+ Copyright (C) 1998-2001 Bert Vermeulen
+
+ This file (dt_date.h) is
+ Copyright (C) 2006 by Philipp Hahn
+
+ 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$ */
+
+#ifndef DT_DATE_H_INCLUDED
+#define DT_DATE_H_INCLUDED
+
+#include "config.h"
+
+#include "syntax.h"
+
+typedef display_type_handler dt_date_handler;
+#define DT_DATE(objpointer) ((dt_date_handler *)(objpointer))
+
+display_type_handler *dt_date_get_handler();
+
+GtkWidget *dt_date_retrieve_inputbox(GtkWidget *widget);
+
+#endif /* DT_DATE_H_INCLUDED */
+
+/*
+ Local Variables:
+ c-basic-offset: 5
+ End:
+ */
--- End Message ---