From 9e5d392ccc21e1876e7f86656dab83afdfccbde4 Mon Sep 17 00:00:00 2001 From: short <> Date: Mon, 24 Mar 2003 00:14:01 +0000 Subject: [PATCH] +libcaptive/se/sd.c - +SeValidSecurityDescriptor() --- src/libcaptive/se/sd.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 src/libcaptive/se/sd.c diff --git a/src/libcaptive/se/sd.c b/src/libcaptive/se/sd.c new file mode 100644 index 0000000..e784f9d --- /dev/null +++ b/src/libcaptive/se/sd.c @@ -0,0 +1,52 @@ +/* $Id$ + * reactos SECURITY_DESCRIPTOR functions emulation of libcaptive + * Copyright (C) 2002 Jan Kratochvil + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; exactly version 2 of June 1991 is required + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + + +#include "config.h" + +#include "reactos/ddk/sefuncs.h" /* self */ +#include +#include "reactos/ntos/rtl.h" /* for RtlLengthSecurityDescriptor() */ + + +/** + * SeValidSecurityDescriptor: + * @Length: Available size for @SecurityDescriptor. + * @SecurityDescriptor: #SECURITY_DESCRIPTOR to check the size of. + * + * Functions checks whether @SecurityDescriptor fits to the are size @Length. + * RtlLengthSecurityDescriptor(@SecurityDescriptor) must be less or equal + * @Length to succeed. + * + * Returns: %TRUE if @SecurityDescriptor fits there. + */ +BOOLEAN SeValidSecurityDescriptor(IN ULONG Length,IN PSECURITY_DESCRIPTOR SecurityDescriptor) +{ +ULONG reallen; + + g_return_val_if_fail(SecurityDescriptor!=NULL,FALSE); + + reallen=RtlLengthSecurityDescriptor(SecurityDescriptor); + + /* Sanity check only: + * It may happen but it should IMO mean something rotten + */ + g_assert(reallen<=Length); + + return (reallen<=Length); +} -- 1.8.3.1