Author: idra Date: 2006-02-27 16:26:19 +0000 (Mon, 27 Feb 2006) New Revision: 13719
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=13719 Log: Make it so that a brand new server does not need to migrate policies if you chose the ldapsam backend. Make it also easy to move to ldapsam by removing the account_policy.tdb file if you don't have any good policy set there. I think the right thing would be also to migrate automatically to ldap policies if an old file is found. Simo. Modified: trunk/source/lib/account_pol.c Changeset: Modified: trunk/source/lib/account_pol.c =================================================================== --- trunk/source/lib/account_pol.c 2006-02-27 16:18:32 UTC (rev 13718) +++ trunk/source/lib/account_pol.c 2006-02-27 16:26:19 UTC (rev 13719) @@ -262,10 +262,18 @@ return True; } - tdb = tdb_open_log(lock_path("account_policy.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600); - if (!tdb) { - DEBUG(0,("Failed to open account policy database\n")); - return False; + tdb = tdb_open_log(lock_path("account_policy.tdb"), 0, TDB_DEFAULT, O_RDWR, 0600); + if (!tdb) { /* the account policies files does not exist or open failed, try to create a new one */ + tdb = tdb_open_log(lock_path("account_policy.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600); + if (!tdb) { + DEBUG(0,("Failed to open account policy database\n")); + return False; + } + /* creation was successful */ + /* add AP_MIGRATED_TO_PASSDB speacial key */ + /* so that you do not need to migrate policies */ + /* on brand new servers as it does not make sense */ + account_policy_migrated(True); } /* handle a Samba upgrade */
