mirror of
https://github.com/samba-team/samba.git
synced 2025-10-22 07:33:16 +03:00
r4794: - disabled the ntacl command line utilities until they are rewritten to use the same
acl format as we use in pvfs (and hopefully use common code too) - removed a lot of old cruft from our autoconf tests. This may well break some builds, but then we can fix them properly instead of the "if solaris version 5.1.2" crap This was prompted by someone sending me solaris 10 patches that patched the configure script with if statements for several more versions of solaris to check for and do special stuff. That is just silly.
This commit is contained in:
committed by
Gerald (Jerry) Carter
parent
ad1af519eb
commit
1ea59d1146
@@ -23,96 +23,8 @@
|
||||
#include "includes.h"
|
||||
#include "system/filesys.h"
|
||||
|
||||
#if (defined(HAVE_NO_ACLS) || !defined(HAVE_XATTR_SUPPORT))
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
printf("ACL support not compiled in.");
|
||||
printf("This utility disabled until rewritten\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static void setntacl(char *filename, struct security_descriptor *sd)
|
||||
{
|
||||
NTSTATUS status;
|
||||
struct ndr_push *ndr;
|
||||
ssize_t result;
|
||||
|
||||
ndr = ndr_push_init();
|
||||
|
||||
status = ndr_push_security_descriptor(
|
||||
ndr, NDR_SCALARS|NDR_BUFFERS, sd);
|
||||
|
||||
result = setxattr(
|
||||
filename, "security.ntacl", ndr->data, ndr->offset, 0);
|
||||
|
||||
if (result == -1) {
|
||||
fprintf(stderr, "%s: %s\n", filename, strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char line[255];
|
||||
struct security_descriptor *sd;
|
||||
TALLOC_CTX *mem_ctx;
|
||||
struct security_acl *acl;
|
||||
|
||||
static_init_ntacl;
|
||||
|
||||
setup_logging("setntacl", DEBUG_STDOUT);
|
||||
|
||||
mem_ctx = talloc_init("setntacl");
|
||||
|
||||
sd = sd_initialise(mem_ctx);
|
||||
|
||||
fgets(line, sizeof(line), stdin);
|
||||
sd->owner_sid = dom_sid_parse_talloc(mem_ctx, line);
|
||||
|
||||
fgets(line, sizeof(line), stdin);
|
||||
sd->group_sid = dom_sid_parse_talloc(mem_ctx, line);
|
||||
|
||||
acl = talloc_p(mem_ctx, struct security_acl);
|
||||
|
||||
acl->revision = 2;
|
||||
acl->size = 0;
|
||||
acl->num_aces = 0;
|
||||
acl->aces = NULL;
|
||||
|
||||
while(fgets(line, sizeof(line), stdin)) {
|
||||
int ace_type, ace_flags;
|
||||
uint32 ace_mask;
|
||||
char sidstr[255];
|
||||
struct dom_sid *sid;
|
||||
|
||||
if (sscanf(line, "%d %d 0x%x %s", &ace_type, &ace_flags,
|
||||
&ace_mask, sidstr) != 4) {
|
||||
fprintf(stderr, "invalid ACL line\ndr");
|
||||
return 1;
|
||||
}
|
||||
|
||||
acl->aces = talloc_realloc(mem_ctx, acl->aces,
|
||||
(acl->num_aces + 1) * sizeof(struct security_ace));
|
||||
|
||||
acl->aces[acl->num_aces].type = ace_type;
|
||||
acl->aces[acl->num_aces].flags = ace_flags;
|
||||
acl->aces[acl->num_aces].access_mask = ace_mask;
|
||||
|
||||
sid = dom_sid_parse_talloc(mem_ctx, sidstr);
|
||||
|
||||
acl->aces[acl->num_aces].trustee = *sid;
|
||||
|
||||
acl->num_aces++;
|
||||
}
|
||||
|
||||
sd->dacl = acl;
|
||||
|
||||
setntacl(argv[1], sd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* HAVE_NO_ACLS */
|
||||
|
Reference in New Issue
Block a user