From f6f3bb1813b5f030616e422ed420b938244be84e Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 18 May 2010 18:54:56 +0200 Subject: s3-passdb: move get_logon_hours_from_pdb() into samr server. Guenther --- source3/include/proto.h | 3 +-- source3/passdb/passdb.c | 23 ----------------------- source3/rpc_server/srv_samr_nt.c | 26 ++++++++++++++++++++++++++ 3 files changed, 27 insertions(+), 25 deletions(-) (limited to 'source3') diff --git a/source3/include/proto.h b/source3/include/proto.h index 6072f07fe9..154efeb43b 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -4387,8 +4387,7 @@ bool get_trust_pw_clear(const char *domain, char **ret_pwd, bool get_trust_pw_hash(const char *domain, uint8 ret_pwd[16], const char **account_name, enum netr_SchannelType *channel); -struct samr_LogonHours get_logon_hours_from_pdb(TALLOC_CTX *mem_ctx, - struct samu *pw); + /* The following definitions come from passdb/pdb_compat.c */ uint32 pdb_get_user_rid (const struct samu *sampass); diff --git a/source3/passdb/passdb.c b/source3/passdb/passdb.c index 9514e05254..08488f13c9 100644 --- a/source3/passdb/passdb.c +++ b/source3/passdb/passdb.c @@ -2397,26 +2397,3 @@ bool get_trust_pw_hash(const char *domain, uint8 ret_pwd[16], "password for domain %s\n", domain)); 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; -} diff --git a/source3/rpc_server/srv_samr_nt.c b/source3/rpc_server/srv_samr_nt.c index 1dd0088f9c..b5200af819 100644 --- a/source3/rpc_server/srv_samr_nt.c +++ b/source3/rpc_server/srv_samr_nt.c @@ -2399,6 +2399,32 @@ static NTSTATUS init_samr_parameters_string(TALLOC_CTX *mem_ctx, return NT_STATUS_OK; } +/************************************************************************* + *************************************************************************/ + +static 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; +} + /************************************************************************* get_user_info_1. *************************************************************************/ -- cgit