diff options
Diffstat (limited to 'source3/libgpo/gpo_parse.c')
-rw-r--r-- | source3/libgpo/gpo_parse.c | 222 |
1 files changed, 0 insertions, 222 deletions
diff --git a/source3/libgpo/gpo_parse.c b/source3/libgpo/gpo_parse.c index 5430fde01d..8118ed7213 100644 --- a/source3/libgpo/gpo_parse.c +++ b/source3/libgpo/gpo_parse.c @@ -74,225 +74,3 @@ NTSTATUS parse_gpt_ini(TALLOC_CTX *mem_ctx, const char *filename, uint32 *versio return result; } - -#if 0 /* not yet */ - -/**************************************************************** - parse the Version section from gpttmpl file -****************************************************************/ - -#define GPTTMPL_SECTION_VERSION "Version" -#define GPTTMPL_PARAMETER_REVISION "Revision" -#define GPTTMPL_PARAMETER_SIGNATURE "signature" -#define GPTTMPL_CHICAGO "$CHICAGO$" /* whatever this is good for... */ -#define GPTTMPL_SECTION_UNICODE "Unicode" -#define GPTTMPL_PARAMETER_UNICODE "Unicode" - -static NTSTATUS parse_gpttmpl(dictionary *d, uint32 *version_out) -{ - const char *signature = NULL; - uint32 version; - - if ((signature = iniparser_getstring(d, GPTTMPL_SECTION_VERSION - ":"GPTTMPL_PARAMETER_SIGNATURE, NULL)) == NULL) { - return NT_STATUS_INTERNAL_DB_CORRUPTION; - } - - if (!strequal(signature, GPTTMPL_CHICAGO)) { - return NT_STATUS_INTERNAL_DB_CORRUPTION; - } - - if ((version = iniparser_getint(d, GPTTMPL_SECTION_VERSION - ":"GPTTMPL_PARAMETER_REVISION, Undefined)) == Undefined) { - return NT_STATUS_INTERNAL_DB_CORRUPTION; - } - - if (version_out) { - *version_out = version; - } - - /* treat that as boolean */ - if ((!iniparser_getboolean(d, GPTTMPL_SECTION_UNICODE - ":"GPTTMPL_PARAMETER_UNICODE, Undefined)) == Undefined) { - return NT_STATUS_INTERNAL_DB_CORRUPTION; - } - - return NT_STATUS_OK; -} - -/**************************************************************** - parse the "System Access" section from gpttmpl file -****************************************************************/ - -#define GPTTMPL_SECTION_SYSTEM_ACCESS "System Access" -#define GPTTMPL_PARAMETER_MINPWDAGE "MinimumPasswordAge" -#define GPTTMPL_PARAMETER_MAXPWDAGE "MaximumPasswordAge" -#define GPTTMPL_PARAMETER_MINPWDLEN "MinimumPasswordLength" -#define GPTTMPL_PARAMETER_PWDCOMPLEX "PasswordComplexity" -#define GPTTMPL_PARAMETER_PWDHISTORY "PasswordHistorySize" -#define GPTTMPL_PARAMETER_LOCKOUTCOUNT "LockoutBadCount" - -static NTSTATUS parse_gpttmpl_system_access(const char *filename) -{ - NTSTATUS status; - dictionary *d = NULL; - uint32 pwd_min_age, pwd_max_age, pwd_min_len, pwd_history; - uint32 lockout_count; - BOOL pwd_complex; - uint32 version; - - d = iniparser_load(filename); - if (d == NULL) { - return NT_STATUS_NO_SUCH_FILE; - } - - status = parse_gpttmpl(d, &version); - if (!NT_STATUS_IS_OK(status)) { - goto out; - } - - status = NT_STATUS_INVALID_PARAMETER; - - if ((pwd_min_age = iniparser_getint(d, GPTTMPL_SECTION_SYSTEM_ACCESS - ":"GPTTMPL_PARAMETER_MINPWDAGE, Undefined)) == Undefined) { - goto out; - } - - if ((pwd_max_age = iniparser_getint(d, GPTTMPL_SECTION_SYSTEM_ACCESS - ":"GPTTMPL_PARAMETER_MINPWDAGE, Undefined)) == Undefined) { - goto out; - } - - if ((pwd_min_len = iniparser_getint(d, GPTTMPL_SECTION_SYSTEM_ACCESS - ":"GPTTMPL_PARAMETER_MINPWDLEN, Undefined)) == Undefined) { - goto out; - } - - if ((pwd_complex = iniparser_getboolean(d, GPTTMPL_SECTION_SYSTEM_ACCESS - ":"GPTTMPL_PARAMETER_PWDCOMPLEX, Undefined)) == Undefined) { - goto out; - } - - if ((pwd_history = iniparser_getint(d, GPTTMPL_SECTION_SYSTEM_ACCESS - ":"GPTTMPL_PARAMETER_PWDHISTORY, Undefined)) == Undefined) { - goto out; - } - - if ((lockout_count = iniparser_getint(d, GPTTMPL_SECTION_SYSTEM_ACCESS - ":"GPTTMPL_PARAMETER_LOCKOUTCOUNT, Undefined)) == Undefined) { - goto out; - } - - /* TODO ? - RequireLogonToChangePassword = 0 - ForceLogoffWhenHourExpire = 0 - ClearTextPassword = 0 - */ - - status = NT_STATUS_OK; - - out: - if (d) { - iniparser_freedict(d); - } - - return status; -} - -/**************************************************************** - parse the "Kerberos Policy" section from gpttmpl file -****************************************************************/ - -#define GPTTMPL_SECTION_KERBEROS_POLICY "Kerberos Policy" -#define GPTTMPL_PARAMETER_MAXTKTAGE "MaxTicketAge" -#define GPTTMPL_PARAMETER_MAXRENEWAGE "MaxRenewAge" -#define GPTTMPL_PARAMETER_MAXTGSAGE "MaxServiceAge" -#define GPTTMPL_PARAMETER_MAXCLOCKSKEW "MaxClockSkew" -#define GPTTMPL_PARAMETER_TKTVALIDATECLIENT "TicketValidateClient" - -static NTSTATUS parse_gpttmpl_kerberos_policy(const char *filename) -{ - NTSTATUS status; - dictionary *d = NULL; - uint32 tkt_max_age, tkt_max_renew, tgs_max_age, max_clock_skew; - BOOL tkt_validate; - uint32 version; - - d = iniparser_load(filename); - if (d == NULL) { - return NT_STATUS_NO_SUCH_FILE; - } - - status = parse_gpttmpl(d, &version); - if (!NT_STATUS_IS_OK(status)) { - goto out; - } - - status = NT_STATUS_INVALID_PARAMETER; - - if ((tkt_max_age = iniparser_getint(d, GPTTMPL_SECTION_KERBEROS_POLICY - ":"GPTTMPL_PARAMETER_MAXTKTAGE, Undefined)) != Undefined) { - goto out; - } - - if ((tkt_max_renew = iniparser_getint(d, GPTTMPL_SECTION_KERBEROS_POLICY - ":"GPTTMPL_PARAMETER_MAXRENEWAGE, Undefined)) != Undefined) { - goto out; - } - - if ((tgs_max_age = iniparser_getint(d, GPTTMPL_SECTION_KERBEROS_POLICY - ":"GPTTMPL_PARAMETER_MAXTGSAGE, Undefined)) != Undefined) { - goto out; - } - - if ((max_clock_skew = iniparser_getint(d, GPTTMPL_SECTION_KERBEROS_POLICY - ":"GPTTMPL_PARAMETER_MAXCLOCKSKEW, Undefined)) != Undefined) { - goto out; - } - - if ((tkt_validate = iniparser_getboolean(d, GPTTMPL_SECTION_KERBEROS_POLICY - ":"GPTTMPL_PARAMETER_TKTVALIDATECLIENT, Undefined)) != Undefined) { - goto out; - } - - status = NT_STATUS_OK; - - out: - if (d) { - iniparser_freedict(d); - } - - return status; -} - -#endif - -/* - -perfectly parseable with iniparser: - -{GUID}/Machine/Microsoft/Windows NT/SecEdit/GptTmpl.inf - - -[Unicode] -Unicode=yes -[System Access] -MinimumPasswordAge = 1 -MaximumPasswordAge = 42 -MinimumPasswordLength = 7 -PasswordComplexity = 1 -PasswordHistorySize = 24 -LockoutBadCount = 0 -RequireLogonToChangePassword = 0 -ForceLogoffWhenHourExpire = 0 -ClearTextPassword = 0 -[Kerberos Policy] -MaxTicketAge = 10 -MaxRenewAge = 7 -MaxServiceAge = 600 -MaxClockSkew = 5 -TicketValidateClient = 1 -[Version] -signature="$CHICAGO$" -Revision=1 -*/ |