svn commit: samba r1807 - in trunk/source: include passdb

mimir at samba.org mimir at samba.org
Fri Aug 13 17:38:03 GMT 2004


Author: mimir
Date: 2004-08-13 17:38:03 +0000 (Fri, 13 Aug 2004)
New Revision: 1807
WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/trunk/source&rev=1807&nolog=1
Log:
Part of trust passwords migration code. Function checking whether
it's already been done and at once can mark it has.


rafal


Modified:
   trunk/source/include/secrets.h
   trunk/source/passdb/secrets.c

Changeset:
Modified: trunk/source/include/secrets.h
===================================================================
--- trunk/source/include/secrets.h	2004-08-13 17:36:24 UTC (rev 1806)
+++ trunk/source/include/secrets.h	2004-08-13 17:38:03 UTC (rev 1807)
@@ -63,6 +63,8 @@
 #define PASS_MACHINE_TRUST_ADS      (PASS_TRUST_ADS | PASS_TRUST_MACHINE)
 #define PASS_DOMAIN_TRUST_ADS       (PASS_TRUST_ADS | PASS_TRUST_DOMAIN)
 
+#define SECRETS_PASSWORDS_MIGRATED  "SECRETS/PASS_MIGRATED"
+
 /* structure for storing machine account password
    (ie. when samba server is member of a domain */
 struct machine_acct_pass {

Modified: trunk/source/passdb/secrets.c
===================================================================
--- trunk/source/passdb/secrets.c	2004-08-13 17:36:24 UTC (rev 1806)
+++ trunk/source/passdb/secrets.c	2004-08-13 17:38:03 UTC (rev 1807)
@@ -842,3 +842,32 @@
 	}
 }
 
+
+/**
+ * Simple function to check whether or not trust passwords have already
+ * been migrated to a passdb backend and, on request, sets the sign
+ * that says it's been done.
+ *
+ * @param set_migrated force to store the sign in secrets.tdb
+ * @return true, if migration has been done
+ */
+
+BOOL secrets_passwords_migrated(BOOL set_migrated)
+{
+	BOOL migrated, *mig, stored;
+	const char *key = SECRETS_PASSWORDS_MIGRATED;
+	size_t keylen;
+
+	/* tdb key to fetch (and maybe store) */
+	keylen = strlen(key);
+	mig = secrets_fetch(key, &keylen);
+	migrated = *mig;
+
+	if (set_migrated) {
+		/* set "migrated" sign in secrets.tdb */
+		stored = secrets_store(key, (void*)set_migrated, sizeof(set_migrated));
+		return stored;
+	}
+
+	return migrated;
+}



More information about the samba-cvs mailing list