summaryrefslogtreecommitdiff
path: root/source4/libcli/security
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2007-10-10 13:49:15 +0200
committerStefan Metzmacher <metze@samba.org>2007-12-21 05:42:52 +0100
commit4fb9aeb55650bdd10288870dd9c4e1567f73a3f8 (patch)
treee4f3974df781e3c8327815d5bdfb82723184d5fa /source4/libcli/security
parentbf1293e9f2330acf694034ce8e862404c405b056 (diff)
downloadsamba-4fb9aeb55650bdd10288870dd9c4e1567f73a3f8.tar.gz
samba-4fb9aeb55650bdd10288870dd9c4e1567f73a3f8.tar.bz2
samba-4fb9aeb55650bdd10288870dd9c4e1567f73a3f8.zip
r25610: Add security_descriptor_appendv() which takes va_list directly.
Guenther (This used to be commit 99408cf20c6feb745cd2dd56c37015cfa11e9b3d)
Diffstat (limited to 'source4/libcli/security')
-rw-r--r--source4/libcli/security/security_descriptor.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/source4/libcli/security/security_descriptor.c b/source4/libcli/security/security_descriptor.c
index d744f2cc8d..9454560c94 100644
--- a/source4/libcli/security/security_descriptor.c
+++ b/source4/libcli/security/security_descriptor.c
@@ -338,13 +338,11 @@ bool security_descriptor_mask_equal(const struct security_descriptor *sd1,
that would create a sd with one DACL ACE
*/
-struct security_descriptor *security_descriptor_append(struct security_descriptor *sd,
- ...)
+struct security_descriptor *security_descriptor_appendv(struct security_descriptor *sd,
+ va_list ap)
{
- va_list ap;
const char *sidstr;
- va_start(ap, sd);
while ((sidstr = va_arg(ap, const char *))) {
struct dom_sid *sid;
struct security_ace *ace = talloc(sd, struct security_ace);
@@ -352,7 +350,6 @@ struct security_descriptor *security_descriptor_append(struct security_descripto
if (ace == NULL) {
talloc_free(sd);
- va_end(ap);
return NULL;
}
ace->type = va_arg(ap, unsigned int);
@@ -360,7 +357,6 @@ struct security_descriptor *security_descriptor_append(struct security_descripto
ace->flags = va_arg(ap, unsigned int);
sid = dom_sid_parse_talloc(ace, sidstr);
if (sid == NULL) {
- va_end(ap);
talloc_free(sd);
return NULL;
}
@@ -368,15 +364,24 @@ struct security_descriptor *security_descriptor_append(struct security_descripto
status = security_descriptor_dacl_add(sd, ace);
/* TODO: check: would talloc_free(ace) here be correct? */
if (!NT_STATUS_IS_OK(status)) {
- va_end(ap);
talloc_free(sd);
return NULL;
}
}
- va_end(ap);
return sd;
+}
+struct security_descriptor *security_descriptor_append(struct security_descriptor *sd,
+ ...)
+{
+ va_list ap;
+
+ va_start(ap, sd);
+ sd = security_descriptor_appendv(sd, ap);
+ va_end(ap);
+
+ return sd;
}
struct security_descriptor *security_descriptor_create(TALLOC_CTX *mem_ctx,
@@ -409,7 +414,7 @@ struct security_descriptor *security_descriptor_create(TALLOC_CTX *mem_ctx,
}
va_start(ap, group_sid);
- sd = security_descriptor_append(sd, ap);
+ sd = security_descriptor_appendv(sd, ap);
va_end(ap);
return sd;