summaryrefslogtreecommitdiffstats
path: root/source/passdb/passdb.c
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-02-12 14:26:56 +0100
committerGünther Deschner <gd@samba.org>2008-02-12 14:52:25 +0100
commite1bcb7d82f22810e342a18aacbcfe49c3902bcb4 (patch)
treee7d22821eba93385f199adb61b9339ac08d94402 /source/passdb/passdb.c
parent8ee7dfad2e3a40e378398ea20158d3c7e7168cba (diff)
downloadsamba-e1bcb7d82f22810e342a18aacbcfe49c3902bcb4.tar.gz
samba-e1bcb7d82f22810e342a18aacbcfe49c3902bcb4.tar.xz
samba-e1bcb7d82f22810e342a18aacbcfe49c3902bcb4.zip
Add get_logon_hours_from_pdb() (inspired by samba4).
Guenther
Diffstat (limited to 'source/passdb/passdb.c')
-rw-r--r--source/passdb/passdb.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/source/passdb/passdb.c b/source/passdb/passdb.c
index b6a4126df1c..70b9dcd3b5d 100644
--- a/source/passdb/passdb.c
+++ b/source/passdb/passdb.c
@@ -1616,3 +1616,26 @@ bool get_trust_pw_hash(const char *domain, uint8 ret_pwd[16],
return False;
}
+struct samr_LogonHours get_logon_hours_from_pdb(TALLOC_CTX *mem_ctx,
+ struct samu *pw)
+{
+ struct samr_LogonHours hours;
+ const int units_per_week = 168;
+
+ ZERO_STRUCT(hours);
+ hours.bits = talloc_array(mem_ctx, uint8_t, units_per_week);
+ if (!hours.bits) {
+ return hours;
+ }
+
+ hours.units_per_week = units_per_week;
+ memset(hours.bits, 0xFF, units_per_week);
+
+ if (pdb_get_hours(pw)) {
+ memcpy(hours.bits, pdb_get_hours(pw),
+ MIN(pdb_get_hours_len(pw), units_per_week));
+ }
+
+ return hours;
+}
+