[Fedora-directory-commits] ldapserver/ldap/servers/slapd/back-ldbm import-threads.c, 1.18, 1.19
Noriko Hosoi
nhosoi at fedoraproject.org
Tue Nov 4 23:12:42 UTC 2008
- Previous message (by thread): [Fedora-directory-commits] ldapserver Makefile.am, 1.77, 1.78 configure.ac, 1.56, 1.57 aclocal.m4, 1.77, 1.78 configure, 1.97, 1.98 missing, 1.58, 1.59 install-sh, 1.58, 1.59 depcomp, 1.58, 1.59 compile, 1.51, 1.52 config.sub, 1.57, 1.58 config.guess, 1.57, 1.58 Makefile.in, 1.101, 1.102
- Next message (by thread): [Fedora-directory-commits] ldapserver/ldap/servers/slapd saslbind.c, 1.27, 1.28
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: nhosoi
Update of /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv28179
Modified Files:
import-threads.c
Log Message:
Resolves: #462922
Summary: Import of data does not record timestamps
Description: Added a static function import_add_created_attrs to add
ModifiersName, CreateTimestamp, ModifyTimestamp to each imported entry. I
also added a check if nsslapd-lastmod is on or off. It adds the created info
only if the lastmod is on.
Index: import-threads.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm/import-threads.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- import-threads.c 17 Oct 2008 16:54:47 -0000 1.18
+++ import-threads.c 4 Nov 2008 23:12:39 -0000 1.19
@@ -301,6 +301,47 @@
return my_version;
}
+/*
+ * add CreatorsName, ModifiersName, CreateTimestamp, ModifyTimestamp to entry
+ */
+static void
+import_add_created_attrs(Slapi_Entry *e)
+{
+ char buf[20];
+ struct berval bv;
+ struct berval *bvals[2];
+ time_t curtime;
+ struct tm ltm;
+
+ bvals[0] = &bv;
+ bvals[1] = NULL;
+
+ bv.bv_val = "";
+ bv.bv_len = 0;
+ slapi_entry_attr_replace(e, "creatorsname", bvals);
+ slapi_entry_attr_replace(e, "modifiersname", bvals);
+
+ curtime = current_time();
+#ifdef _WIN32
+{
+ struct tm *pt;
+ pt = gmtime(&curtime);
+ memcpy(<m, pt, sizeof(struct tm));
+}
+#else
+ gmtime_r(&curtime, <m);
+#endif
+ strftime(buf, sizeof(buf), "%Y%m%d%H%M%SZ", <m);
+
+ bv.bv_val = buf;
+ bv.bv_len = strlen(bv.bv_val);
+ slapi_entry_attr_replace(e, "createtimestamp", bvals);
+
+ bv.bv_val = buf;
+ bv.bv_len = strlen(bv.bv_val);
+ slapi_entry_attr_replace(e, "modifytimestamp", bvals);
+}
+
/* producer thread:
* read through the given file list, parsing entries (str2entry), assigning
* them IDs and queueing them on the entry FIFO. other threads will do
@@ -501,6 +542,9 @@
/* generate uniqueid if necessary */
import_generate_uniqueid(job, e);
+ if (g_get_global_lastmod()) {
+ import_add_created_attrs(e);
+ }
ep = import_make_backentry(e, id);
if (!ep)
- Previous message (by thread): [Fedora-directory-commits] ldapserver Makefile.am, 1.77, 1.78 configure.ac, 1.56, 1.57 aclocal.m4, 1.77, 1.78 configure, 1.97, 1.98 missing, 1.58, 1.59 install-sh, 1.58, 1.59 depcomp, 1.58, 1.59 compile, 1.51, 1.52 config.sub, 1.57, 1.58 config.guess, 1.57, 1.58 Makefile.in, 1.101, 1.102
- Next message (by thread): [Fedora-directory-commits] ldapserver/ldap/servers/slapd saslbind.c, 1.27, 1.28
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Fedora-directory-commits
mailing list