diff options
author | Jeremy Allison <jra@samba.org> | 2004-08-13 18:02:58 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 10:52:21 -0500 |
commit | bdab948fcfee56871e7a21825c09a116b4274f37 (patch) | |
tree | 4564b8874806976e615210f456a2258c9090d952 /source3/passdb/pdb_ldap.c | |
parent | 7af12653687768ea08ca225914e6558ab74c95f0 (diff) | |
download | samba-bdab948fcfee56871e7a21825c09a116b4274f37.tar.gz samba-bdab948fcfee56871e7a21825c09a116b4274f37.tar.bz2 samba-bdab948fcfee56871e7a21825c09a116b4274f37.zip |
r1810: Patch from Richard Renard <rrenard@idealx.com> to store
logon hours attributes in an LDAP database.
Jeremy.
(This used to be commit dac72638fb3a05e805136698e0ad0612620ac8af)
Diffstat (limited to 'source3/passdb/pdb_ldap.c')
-rw-r--r-- | source3/passdb/pdb_ldap.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c index 37cc0c7902..9af34705df 100644 --- a/source3/passdb/pdb_ldap.c +++ b/source3/passdb/pdb_ldap.c @@ -782,7 +782,15 @@ static BOOL init_sam_from_ldap (struct ldapsam_privates *ldap_state, /* pdb_set_unknown_6(sampass, unknown6, PDB_SET); */ - pdb_set_hours(sampass, hours, PDB_SET); + if(!smbldap_get_single_pstring(ldap_state->smbldap_state->ldap_struct, entry, + get_userattr_key2string(ldap_state->schema_ver, LDAP_ATTR_LOGON_HOURS), temp)) { + /* leave as default */ + } else { + pdb_gethexhours(temp, hours); + memset((char *)temp, '\0', strlen(temp) +1); + pdb_set_hours(sampass, hours, PDB_SET); + ZERO_STRUCT(hours); + } /* check the timestamp of the cache vs ldap entry */ if (!(ldap_entry_time = ldapsam_get_entry_timestamp(ldap_state, @@ -1065,7 +1073,18 @@ static BOOL init_ldap_from_sam (struct ldapsam_privates *ldap_state, } } - /* FIXME: Hours stuff goes in LDAP */ + if (need_update(sampass, PDB_HOURS)) { + const char *hours = pdb_get_hours(sampass); + if (hours) { + pdb_sethexhours(temp, hours); + smbldap_make_mod(ldap_state->smbldap_state->ldap_struct, + existing, + mods, + get_userattr_key2string(ldap_state->schema_ver, + LDAP_ATTR_LOGON_HOURS), + temp); + } + } if (need_update(sampass, PDB_ACCTCTRL)) smbldap_make_mod(ldap_state->smbldap_state->ldap_struct, existing, mods, |