The Samba-Bugzilla – Attachment 5555 Details for
Bug 7299
DNS: generated grants policy file should allow some static entries
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for fixing this bug
0003-s4-dns-update-allow-to-have-a-static-list-of-grants.patch (text/plain), 3.40 KB, created by
Matthieu Patou
on 2010-03-28 12:35:49 UTC
(
hide
)
Description:
Patch for fixing this bug
Filename:
MIME Type:
Creator:
Matthieu Patou
Created:
2010-03-28 12:35:49 UTC
Size:
3.40 KB
patch
obsolete
>From c72a86be1ba2995fe51a36fe579073ec2b32d90e Mon Sep 17 00:00:00 2001 >From: Matthieu Patou <mat@matws.net> >Date: Sun, 28 Mar 2010 21:25:26 +0400 >Subject: [PATCH 3/4] s4: dns update, allow to have a static list of grants > >--- > source4/dsdb/dns/dns_update.c | 61 +++++++++++++++++++++++++++++++++++++++-- > 1 files changed, 58 insertions(+), 3 deletions(-) > >diff --git a/source4/dsdb/dns/dns_update.c b/source4/dsdb/dns/dns_update.c >index 4e6ee83..142354a 100644 >--- a/source4/dsdb/dns/dns_update.c >+++ b/source4/dsdb/dns/dns_update.c >@@ -87,6 +87,48 @@ static void dnsupdate_rndc_done(struct tevent_req *subreq) > } > } > >+static char* get_static_entries(TALLOC_CTX *ctx ,const char *path) >+{ >+ int fd; >+ char* buffer; >+ ssize_t read_bytes; >+ const size_t increment = 8192; >+ size_t offset = 0; >+ size_t size = increment + 1; >+ >+ fd = open(path, O_RDONLY); >+ if ( fd == -1 ) >+ return NULL; >+ buffer = (char*) talloc_array(ctx, char*, size); >+ if( buffer == NULL ) { >+ DEBUG(0,(__location__ ": Unable to allocate buffer for reading static dns policy entries")); >+ close(fd); >+ return NULL; >+ } >+ >+ read_bytes = read(fd, buffer, increment); >+ while( read_bytes == increment) >+ { >+ size += increment; >+ offset += increment; >+ buffer = (char*) talloc_realloc(ctx, buffer, char *, size); >+ if( buffer == NULL ) { >+ DEBUG(0,(__location__ ": Unable to reallocate buffer for reading static dns policy entries")); >+ close(fd); >+ return NULL; >+ } >+ read_bytes = read(fd, buffer + offset, increment); >+ } >+ if( read_bytes < 0 ) { >+ DEBUG(0,(__location__ ": Error while reading %s: %s", path, strerror(errno))); >+ close(fd); >+ return NULL; >+ } >+ close(fd); >+ buffer[offset+read_bytes-1] = '\0'; >+ return buffer; >+} >+ > /* > called every 'dnsupdate:conf interval' seconds > */ >@@ -94,7 +136,8 @@ static void dnsupdate_rebuild(struct dnsupdate_service *service) > { > int ret; > struct ldb_result *res; >- const char *tmp_path, *path; >+ const char *tmp_path, *path, *path_static; >+ char *static_policies; > int fd; > unsigned int i; > const char *attrs[] = { "sAMAccountName", NULL }; >@@ -119,13 +162,20 @@ static void dnsupdate_rebuild(struct dnsupdate_service *service) > path = private_path(tmp_ctx, service->task->lp_ctx, "named.conf.update"); > } > >+ path_static = lp_parm_string(service->task->lp_ctx, NULL, "dnsupdate", "extra_static_grant_rules"); >+ if (path_static == NULL) { >+ path_static = private_path(tmp_ctx, service->task->lp_ctx, "named.conf.update.static"); >+ } >+ > tmp_path = talloc_asprintf(tmp_ctx, "%s.tmp", path); >- if (path == NULL || tmp_path == NULL) { >- DEBUG(0,(__location__ ": Unable to get paths")); >+ if (path == NULL || tmp_path == NULL || path_static == NULL ) { >+ DEBUG(0,(__location__ ": Unable to get paths\n")); > talloc_free(tmp_ctx); > return; > } > >+ static_policies = get_static_entries(tmp_ctx, path_static); >+ > unlink(tmp_path); > fd = open(tmp_path, O_CREAT|O_TRUNC|O_WRONLY, 0444); > if (fd == -1) { >@@ -136,6 +186,11 @@ static void dnsupdate_rebuild(struct dnsupdate_service *service) > > dprintf(fd, "/* this file is auto-generated - do not edit */\n"); > dprintf(fd, "update-policy {\n"); >+ if( static_policies != NULL ) { >+ dprintf(fd, "/* Start of static entries */\n"); >+ dprintf(fd, "%s\n",static_policies); >+ dprintf(fd, "/* End of static entries */\n"); >+ } > dprintf(fd, "\tgrant %s ms-self * A AAAA;\n", realm); > dprintf(fd, "\tgrant administrator@%s wildcard * A AAAA SRV CNAME TXT;\n", realm); > >-- >1.6.3.3 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 7299
:
5555
|
5658