summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2004-12-24 00:08:15 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:53:45 -0500
commitb314cf95ce3cf809fd03af2b562e9a6dc156f746 (patch)
tree978fe025ee1f2ac994d15a1bd843565013459b8a
parent0b18a471bc8411f2248b2082f11633e4aa5cef71 (diff)
downloadsamba-b314cf95ce3cf809fd03af2b562e9a6dc156f746.tar.gz
samba-b314cf95ce3cf809fd03af2b562e9a6dc156f746.tar.bz2
samba-b314cf95ce3cf809fd03af2b562e9a6dc156f746.zip
r4351: Vampire Logon-Hours. Update Logon-Hours only when they have changed.
Guenther (This used to be commit 0930ad662770278cbe9fd4e3deaa523957b96697)
-rw-r--r--source3/rpc_server/srv_samr_util.c8
-rw-r--r--source3/utils/net_rpc_samsync.c21
2 files changed, 26 insertions, 3 deletions
diff --git a/source3/rpc_server/srv_samr_util.c b/source3/rpc_server/srv_samr_util.c
index 8cc44074ab..c1faede947 100644
--- a/source3/rpc_server/srv_samr_util.c
+++ b/source3/rpc_server/srv_samr_util.c
@@ -262,8 +262,12 @@ void copy_id21_to_sam_passwd(SAM_ACCOUNT *to, SAM_USER_INFO_21 *from)
}
DEBUG(15,("INFO_21 LOGON_HRS.HOURS: %s -> %s\n",pdb_get_hours(to),from->logon_hrs.hours));
- /* Fix me: only update if it changes --metze */
- pdb_set_hours(to, from->logon_hrs.hours, PDB_CHANGED);
+ pstring old, new;
+ pdb_sethexhours(old, pdb_get_hours(to));
+ pdb_sethexhours(new, (const char *)from->logon_hrs.hours);
+ if (!strequal(old, new)) {
+ pdb_set_hours(to, from->logon_hrs.hours, PDB_CHANGED);
+ }
/* This is max logon hours */
DEBUG(10,("INFO_21 UNKNOWN_6: %08X -> %08X\n",pdb_get_unknown_6(to),from->unknown_6));
diff --git a/source3/utils/net_rpc_samsync.c b/source3/utils/net_rpc_samsync.c
index e8a110d083..688944cf0b 100644
--- a/source3/utils/net_rpc_samsync.c
+++ b/source3/utils/net_rpc_samsync.c
@@ -408,10 +408,29 @@ sam_account_from_delta(SAM_ACCOUNT *account, SAM_ACCOUNT_INFO *delta)
pdb_set_logoff_time(account, unix_time,PDB_CHANGED);
}
+ /* Logon Divs */
if (pdb_get_logon_divs(account) != delta->logon_divs)
pdb_set_logon_divs(account, delta->logon_divs, PDB_CHANGED);
- /* TODO: logon hours */
+ /* Max Logon Hours */
+ if (delta->unknown1 != pdb_get_unknown_6(account)) {
+ pdb_set_unknown_6(account, delta->unknown1, PDB_CHANGED);
+ }
+
+ /* Logon Hours Len */
+ if (delta->buf_logon_hrs.buf_len != pdb_get_hours_len(account)) {
+ pdb_set_hours_len(account, delta->buf_logon_hrs.buf_len, PDB_CHANGED);
+ }
+
+ /* Logon Hours */
+ if (delta->buf_logon_hrs.buffer) {
+ pstring old, new;
+ pdb_sethexhours(old, pdb_get_hours(account));
+ pdb_sethexhours(new, (const char *)delta->buf_logon_hrs.buffer);
+ if (!strequal(old, new))
+ pdb_set_hours(account, (const char *)delta->buf_logon_hrs.buffer, PDB_CHANGED);
+ }
+
if (pdb_get_bad_password_count(account) != delta->bad_pwd_count)
pdb_set_bad_password_count(account, delta->bad_pwd_count, PDB_CHANGED);