mirror of
https://github.com/samba-team/samba.git
synced 2025-01-27 14:04:05 +03:00
Add get_logon_hours_from_pdb() (inspired by samba4).
Guenther (This used to be commit e1bcb7d82f22810e342a18aacbcfe49c3902bcb4)
This commit is contained in:
parent
4867e1ff93
commit
e4501b0913
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user