[SCM] Samba Shared Repository - branch v3-2-test updated -
initial-v3-2-unstable-710-g92acc01
Jeremy Allison
jra at samba.org
Tue Dec 18 02:33:07 GMT 2007
The branch, v3-2-test has been updated
via 92acc0115d8d4111289c2ade1db7bb060ee908db (commit)
from b4dfec09e89428cac9b21a94ce4d24e60d4a54f4 (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test
- Log -----------------------------------------------------------------
commit 92acc0115d8d4111289c2ade1db7bb060ee908db
Author: Jeremy Allison <jra at samba.org>
Date: Mon Dec 17 18:32:27 2007 -0800
More static pstring elimination.
Jeremy.
-----------------------------------------------------------------------
Summary of changes:
source/lib/display_sec.c | 112 +++++++++++++++++++++++++++++++++++-----------
1 files changed, 86 insertions(+), 26 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source/lib/display_sec.c b/source/lib/display_sec.c
index f6a6bb6..67392e4 100644
--- a/source/lib/display_sec.c
+++ b/source/lib/display_sec.c
@@ -23,34 +23,92 @@
/****************************************************************************
convert a security permissions into a string
****************************************************************************/
-char *get_sec_mask_str(uint32 type)
+
+char *get_sec_mask_str(TALLOC_CTX *ctx, uint32 type)
{
- static fstring typestr="";
+ char *typestr = talloc_strdup(ctx, "");
- typestr[0] = 0;
+ if (!typestr) {
+ return NULL;
+ }
- if (type & GENERIC_ALL_ACCESS)
- fstrcat(typestr, "Generic all access ");
- if (type & GENERIC_EXECUTE_ACCESS)
- fstrcat(typestr, "Generic execute access ");
- if (type & GENERIC_WRITE_ACCESS)
- fstrcat(typestr, "Generic write access ");
- if (type & GENERIC_READ_ACCESS)
- fstrcat(typestr, "Generic read access ");
- if (type & MAXIMUM_ALLOWED_ACCESS)
- fstrcat(typestr, "MAXIMUM_ALLOWED_ACCESS ");
- if (type & SYSTEM_SECURITY_ACCESS)
- fstrcat(typestr, "SYSTEM_SECURITY_ACCESS ");
- if (type & SYNCHRONIZE_ACCESS)
- fstrcat(typestr, "SYNCHRONIZE_ACCESS ");
- if (type & WRITE_OWNER_ACCESS)
- fstrcat(typestr, "WRITE_OWNER_ACCESS ");
- if (type & WRITE_DAC_ACCESS)
- fstrcat(typestr, "WRITE_DAC_ACCESS ");
- if (type & READ_CONTROL_ACCESS)
- fstrcat(typestr, "READ_CONTROL_ACCESS ");
- if (type & DELETE_ACCESS)
- fstrcat(typestr, "DELETE_ACCESS ");
+ if (type & GENERIC_ALL_ACCESS) {
+ typestr = talloc_asprintf_append(typestr,
+ "Generic all access ");
+ if (!typestr) {
+ return NULL;
+ }
+ }
+ if (type & GENERIC_EXECUTE_ACCESS) {
+ typestr = talloc_asprintf_append(typestr,
+ "Generic execute access");
+ if (!typestr) {
+ return NULL;
+ }
+ }
+ if (type & GENERIC_WRITE_ACCESS) {
+ typestr = talloc_asprintf_append(typestr,
+ "Generic write access ");
+ if (!typestr) {
+ return NULL;
+ }
+ }
+ if (type & GENERIC_READ_ACCESS) {
+ typestr = talloc_asprintf_append(typestr,
+ "Generic read access ");
+ if (!typestr) {
+ return NULL;
+ }
+ }
+ if (type & MAXIMUM_ALLOWED_ACCESS) {
+ typestr = talloc_asprintf_append(typestr,
+ "MAXIMUM_ALLOWED_ACCESS ");
+ if (!typestr) {
+ return NULL;
+ }
+ }
+ if (type & SYSTEM_SECURITY_ACCESS) {
+ typestr = talloc_asprintf_append(typestr,
+ "SYSTEM_SECURITY_ACCESS ");
+ if (!typestr) {
+ return NULL;
+ }
+ }
+ if (type & SYNCHRONIZE_ACCESS) {
+ typestr = talloc_asprintf_append(typestr,
+ "SYNCHRONIZE_ACCESS ");
+ if (!typestr) {
+ return NULL;
+ }
+ }
+ if (type & WRITE_OWNER_ACCESS) {
+ typestr = talloc_asprintf_append(typestr,
+ "WRITE_OWNER_ACCESS ");
+ if (!typestr) {
+ return NULL;
+ }
+ }
+ if (type & WRITE_DAC_ACCESS) {
+ typestr = talloc_asprintf_append(typestr,
+ "WRITE_DAC_ACCESS ");
+ if (!typestr) {
+ return NULL;
+ }
+ }
+ if (type & READ_CONTROL_ACCESS) {
+ typestr = talloc_asprintf_append(typestr,
+ "READ_CONTROL_ACCESS ");
+ if (!typestr) {
+ return NULL;
+ }
+ }
+ if (type & DELETE_ACCESS) {
+ typestr = talloc_asprintf_append(typestr,
+ "DELETE_ACCESS ");
+ if (!typestr) {
+ return NULL;
+ }
+ }
printf("\t\tSpecific bits: 0x%lx\n", (unsigned long)type&SPECIFIC_RIGHTS_MASK);
@@ -62,7 +120,9 @@ char *get_sec_mask_str(uint32 type)
****************************************************************************/
void display_sec_access(SEC_ACCESS *info)
{
- printf("\t\tPermissions: 0x%x: %s\n", *info, get_sec_mask_str(*info));
+ char *mask_str = get_sec_mask_str(NULL, *info);
+ printf("\t\tPermissions: 0x%x: %s\n", *info, mask_str ? mask_str : "");
+ TALLOC_FREE(mask_str);
}
/****************************************************************************
--
Samba Shared Repository
More information about the samba-cvs
mailing list