[debian-edu-commits] debian-edu/pkg-team/ 01/13: Imported Upstream version 0.1
Mike Gabriel
sunweaver at debian.org
Wed Oct 1 02:59:14 UTC 2014
This is an automated email from the git hooks/post-receive script.
sunweaver pushed a commit to branch master
in repository ldap2bind.
commit 0d657dc80f0d78bb97fff0681b81b5500625bc86
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date: Wed Oct 1 04:55:54 2014 +0200
Imported Upstream version 0.1
---
Makefile | 16 ++
debian/README.debian | 6 +
debian/changelog | 6 +
debian/compat | 1 +
debian/control | 18 ++
debian/copyright | 12 ++
debian/cron.d | 4 +
debian/default | 26 +++
debian/dirs | 3 +
debian/install | 5 +
debian/ldap2zone.lintian-overrides | 2 +
debian/ldap2zone.manpages | 2 +
debian/rules | 49 +++++
ldap2bind | 58 ++++++
ldap2zone.1 | 32 +++
ldap2zone.c | 401 +++++++++++++++++++++++++++++++++++++
16 files changed, 641 insertions(+)
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..ab06ab2
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,16 @@
+all: ldap2zone
+
+ldap2zone: ldap2zone.c
+ gcc -Wall ldap2zone.c -o ldap2zone -lldap
+
+install: ldap2zone
+ install -d ${DESTDIR}/usr/sbin
+ install -d ${DESTDIR}/usr/share/doc/ldap2zone
+ install ldap2zone ${DESTDIR}/usr/sbin/ldap2zone
+ install ldap2bind ${DESTDIR}/usr/sbin/ldap2bind
+ install -D -m 0644 debian/ldap2zone.lintian-overrides $(DESTDIR)/usr/share/lintian/overrides/ldap2zone
+ install -d $(CURDIR)/debian/tmp/etc/default
+ install -m 644 $(CURDIR)/debian/default $(CURDIR)/debian/tmp/etc/default/ldap2zone
+
+clean:
+ -rm ldap2zone
diff --git a/debian/README.debian b/debian/README.debian
new file mode 100644
index 0000000..1d2aebd
--- /dev/null
+++ b/debian/README.debian
@@ -0,0 +1,6 @@
+ldap2zone for Debian
+--------------------
+
+This program extract dns record from ldap and create zone files
+
+Cajus Pollmeier <cajus at debian.org>, Thu, 17 Mar 2005 09:05:17 +0100
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..e0909ab
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,6 @@
+ldap2zone (0.1-1) unstable; urgency=low
+
+ * Initial upload (Closes: #532665)
+ * Include cron script
+
+ -- Cajus Pollmeier <cajus at debian.org> Wed, 24 Jun 2009 10:02:00 +0200
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000..7ed6ff8
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+5
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..d7d4ddb
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,18 @@
+Source: ldap2zone
+Section: utils
+Priority: optional
+Maintainer: GOsa packages mainteners group <gosa-pkg at oss.gonicus.de>
+Uploaders: Cajus Pollmeier <cajus at debian.org>, Benoit Mortier <benoit.mortier at opensides.be>
+Standards-Version: 3.8.2
+Build-Depends: debhelper (>= 5.0.0), libldap2-dev
+Homepage: https://oss.gonicus.de/labs/gosa
+Vcs-Browser: https://oss.gonicus.de/repositories/goto/trunk/ldap2zone
+Vcs-Svn: https://oss.gonicus.de/repositories/goto/trunk/ldap2zone
+
+Package: ldap2zone
+Architecture: any
+Depends: ${shlibs:Depends}, bind9
+Conflicts: ldapdns, ldap2dns
+Description: Extract DNS zones from LDAP trees
+ This tool allows the extraction of GOsa edited DNS
+ zones and the creation of the Bind flat files.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..e6a5dd4
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,12 @@
+This package was debianized by Cajus Pollmeier <cajus at debian.org>
+Thu, 17 Mar 2005 09:05:17 +0100.
+
+It was downloaded from http://www.uninett.no
+
+Copyright:
+
+This software is copyright (C) 2004, 2005 Stig Venaas <venaas at uninett.no>
+
+Permission to use, copy, modify, and distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies.
diff --git a/debian/cron.d b/debian/cron.d
new file mode 100644
index 0000000..2984f81
--- /dev/null
+++ b/debian/cron.d
@@ -0,0 +1,4 @@
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+
+ at reboot bind /usr/sbin/ldap2bind
+ at hourly bind /usr/sbin/ldap2bind
diff --git a/debian/default b/debian/default
new file mode 100644
index 0000000..6bdf670
--- /dev/null
+++ b/debian/default
@@ -0,0 +1,26 @@
+# Configuration file for automatic deployment of ldap2zone generated zones to bind
+
+# Should we run the cronjob
+# DEFAULT: "false"
+RUN_DEPLOY="false"
+
+# How the LDAP server can be accessed
+# DEFAULT: "ldap://localhost"
+#LDAP_URI="ldap://localhost"
+
+# Where the zonefiles are located
+# DEFAULT: "/etc/bind"
+BIND_DIR="/etc/bind"
+
+# Time to live value for a and ptr records
+# DEFAULT: 500 Seconds
+TTL="500"
+
+# Prefix for zone definition files
+# DEFAULT: "db."
+# The zone definition file for 0.168.192.in-addr.arpa is stored as 'db.0.168.192.in-addr.arpa'
+PREFIX="db."
+
+# Allow Updates from these networks (semicolon separated and ended)
+# DEFAULT: Don't allow updates
+#ALLOW_UPDATE="192.168.0.0/24;"
diff --git a/debian/dirs b/debian/dirs
new file mode 100644
index 0000000..dc52318
--- /dev/null
+++ b/debian/dirs
@@ -0,0 +1,3 @@
+etc/default
+usr/sbin
+usr/share/doc/ldap2zone
diff --git a/debian/install b/debian/install
new file mode 100644
index 0000000..4973182
--- /dev/null
+++ b/debian/install
@@ -0,0 +1,5 @@
+usr/sbin/ldap2zone
+usr/sbin/ldap2bind
+etc/default/ldap2zone
+usr/share/lintian/overrides/ldap2zone
+
diff --git a/debian/ldap2zone.lintian-overrides b/debian/ldap2zone.lintian-overrides
new file mode 100644
index 0000000..7501fe3
--- /dev/null
+++ b/debian/ldap2zone.lintian-overrides
@@ -0,0 +1,2 @@
+ldap2zone: binary-without-manpage usr/sbin/ldap2bind
+
diff --git a/debian/ldap2zone.manpages b/debian/ldap2zone.manpages
new file mode 100644
index 0000000..b48c171
--- /dev/null
+++ b/debian/ldap2zone.manpages
@@ -0,0 +1,2 @@
+ldap2zone.1
+
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..dcd6652
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,49 @@
+#!/usr/bin/make -f
+
+PACKAGE=ldap2zone
+VERSION=$(shell dpkg-parsechangelog |grep "^Version:" | cut -f2 -d' ')
+
+build: build-stamp
+build-stamp:
+ dh_testdir
+ $(MAKE)
+ touch build-stamp
+
+clean:
+ dh_testdir
+ $(MAKE) clean
+ rm -f build-stamp
+ dh_clean
+
+install: build
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ dh_installdirs
+
+ $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
+# install -d $(CURDIR)/debian/tmp/etc/default
+# install -m 644 $(CURDIR)/debian/default $(CURDIR)/debian/tmp/etc/default/ldap2zone
+
+binary-indep: build install
+ dh_testdir
+ dh_testroot
+ dh_install --fail-missing --sourcedir=debian/tmp
+ dh_installman
+ dh_installchangelogs
+ dh_installdocs debian/copyright
+ dh_compress
+ dh_fixperms
+ dh_installcron
+ dh_shlibdeps
+ dh_strip
+ dh_installdeb
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+binary: binary-indep
+
+binary-arch:
+
+.PHONY: binary binary-indep clean checkroot
diff --git a/ldap2bind b/ldap2bind
new file mode 100755
index 0000000..4f84ce7
--- /dev/null
+++ b/ldap2bind
@@ -0,0 +1,58 @@
+#!/bin/sh
+
+[ -r /etc/default/ldap2zone ] && . /etc/default/ldap2zone
+
+[[ ${LDAP_URI} =~ 'ldap''s'?'://''.'* ]] || LDAP_URI="ldap://${LDAP_URI}"
+LDAPSEARCH=`which ldapsearch`
+LDAP_URI_PARAM=${LDAP_URI:+"-H $LDAP_URI"}
+ALLOW_UPDATE_PARAM=${ALLOW_UPDATE:+"allow-update {$ALLOW_UPDATE};"}
+
+ZONES=`ldapsearch -LLL $LDAP_HOST_PARAM -x "(objectClass=dNSZone)" zoneName | grep zoneName: | sort | uniq | awk '{print $2}'`
+ldap2zone=`which ldap2zone`
+rndc=`which rndc`
+
+if [ -z ${#ZONES} ]; then
+ echo "No domains configured. Exiting..."
+ exit 0
+fi
+
+if [ -z ${#rndc} ]; then
+ echo "rndc utilty not in $PATH. Exiting..."
+ exit 1
+fi
+
+if [ -z ${#ldap2zone} ]; then
+ echo "ldap2zone utilty not in $PATH. Exiting..."
+ exit 1
+fi
+
+if [ ! -d $BIND_DIR ]; then
+ echo "The directory specified as BIND_DIR does not exist. Exiting..."
+ exit 1
+fi
+
+if [ -w $BIND_DIR/named.conf.ldap2zone ]; then
+ >${BIND_DIR}/named.conf.ldap2zone
+ for domain in $ZONES; do
+ cat << EOF >> ${BIND_DIR}/named.conf.ldap2zone
+zone "${domain}" {
+ type master;
+ file "${BIND_DIR}/${PREFIX}${domain}";
+ $ALLOW_UPDATE_PARAM
+};
+EOF
+ done
+ $rndc reconfig
+fi
+
+for domain in $ZONES; do
+ if $ldap2zone $domain $LDAP_URI $TTL > /tmp/$domain; then
+ lines=$(cat /tmp/$domain | wc -l)
+ [ $lines -gt 1 ] && mv /tmp/$domain $BIND_DIR/${PREFIX}${domain}
+ fi
+
+ result=$($rndc reload $domain 2>&1)
+ if [ $? -ne 0 ]; then
+ echo -e "Reloading the zone '$domain' failed:\n$result" 1>&2
+ fi
+done
diff --git a/ldap2zone.1 b/ldap2zone.1
new file mode 100644
index 0000000..1084982
--- /dev/null
+++ b/ldap2zone.1
@@ -0,0 +1,32 @@
+.TH ldap2zone 1
+.SH NAME
+ldap2zone \- convert zones saved inside the LDAP to bind9 zone files
+.SH SYNOPSIS
+.PP
+.B ldap2zone
+zone-name LDAP-URL default-ttl [serial]
+.SH DESCRIPTION
+Convert zones saved in LDAP to ordinary zones files via
+.B ldap2zone
+in order to avoid dependencies from LDAP to bind.
+.SH OPTIONS
+.TP
+.BR zone-name
+name of the zone to be extracted from LDAP. This can be a forward or
+a reverse zone.
+.TP
+.BR LDAP-URL
+URL to access the LDAP server in the format ldap[s]://server-ip/base.
+.TP
+.BR default-ttl
+Zone TTL in seconds
+.TP
+.BR serial
+Zone serial number.
+.SH "RETURN VALUE"
+The script return zero values on success.
+.SH EXAMPLES
+.B ldap2zone
+example.net ldap://ldap.example.net/dc=example,dc=net 1200 200708291528
+.SH AUTHOR
+Cajus Pollmeier <cajus at debian.org>
diff --git a/ldap2zone.c b/ldap2zone.c
new file mode 100644
index 0000000..8b9fa6d
--- /dev/null
+++ b/ldap2zone.c
@@ -0,0 +1,401 @@
+/*
+ * Copyright (C) 2004, 2005 Stig Venaas <venaas at uninett.no>
+ * $Id: ldap2zone.c,v 0.1 2005/04/23 21:30:12 venaas Exp $
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ */
+
+#include <sys/types.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <libgen.h>
+#include <ctype.h>
+
+#include <ldap.h>
+
+struct string {
+ void *data;
+ size_t len;
+};
+
+struct assstack_entry {
+ struct string key;
+ struct string val;
+ struct assstack_entry *next;
+};
+
+struct assstack_entry *assstack_find(struct assstack_entry *stack, struct string *key) {
+ for (; stack; stack = stack->next)
+ if (stack->key.len == key->len && !memcmp(stack->key.data, key->data, key->len))
+ return stack;
+ return NULL;
+}
+
+void assstack_push(struct assstack_entry **stack, struct assstack_entry *item) {
+ item->next = *stack;
+ *stack = item;
+}
+
+void assstack_insertbottom(struct assstack_entry **stack, struct assstack_entry *item) {
+ struct assstack_entry *p;
+
+ item->next = NULL;
+ if (!*stack) {
+ *stack = item;
+ return;
+ }
+ /* find end, should keep track of end somewhere */
+ /* really a queue, not a stack */
+ p = *stack;
+ while (p->next)
+ p = p->next;
+ p->next = item;
+}
+
+void printsoa(struct string *soa) {
+ char *s;
+ int i;
+
+ s = (char *)soa->data;
+ i = 0;
+ while (i < soa->len) {
+ putchar(s[i]);
+ if (s[i++] == ' ')
+ break;
+ }
+ while (i < soa->len) {
+ putchar(s[i]);
+ if (s[i++] == ' ')
+ break;
+ }
+ printf("(\n\t\t\t\t");
+ while (i < soa->len) {
+ putchar(s[i]);
+ if (s[i++] == ' ')
+ break;
+ }
+ printf("; Serialnumber\n\t\t\t\t");
+ while (i < soa->len) {
+ if (s[i] == ' ')
+ break;
+ putchar(s[i++]);
+ }
+ i++;
+ printf("\t; Refresh\n\t\t\t\t");
+ while (i < soa->len) {
+ if (s[i] == ' ')
+ break;
+ putchar(s[i++]);
+ }
+ i++;
+ printf("\t; Retry\n\t\t\t\t");
+ while (i < soa->len) {
+ if (s[i] == ' ')
+ break;
+ putchar(s[i++]);
+ }
+ i++;
+ printf("\t; Expire\n\t\t\t\t");
+ while (i < soa->len) {
+ putchar(s[i++]);
+ }
+ printf(" )\t; Minimum TTL\n");
+}
+
+void printrrs(char *defaultttl, struct assstack_entry *item) {
+ struct assstack_entry *stack;
+ char *s;
+ int first;
+ int i;
+ char *ttl, *type;
+ int top;
+
+ s = (char *)item->key.data;
+
+ if (item->key.len == 1 && *s == '@') {
+ top = 1;
+ printf("@\t");
+ } else {
+ top = 0;
+ for (i = 0; i < item->key.len; i++)
+ putchar(s[i]);
+ if (item->key.len < 8)
+ putchar('\t');
+ putchar('\t');
+ }
+
+ first = 1;
+ for (stack = (struct assstack_entry *) item->val.data; stack; stack = stack->next) {
+ ttl = (char *)stack->key.data;
+ s = strchr(ttl, ' ');
+ *s++ = '\0';
+ type = s;
+
+ if (first)
+ first = 0;
+ else
+ printf("\t\t");
+
+ if (strcmp(defaultttl, ttl))
+ printf("%s", ttl);
+ putchar('\t');
+
+ if (top) {
+ top = 0;
+ printf("IN\t%s\t", type);
+ /* Should always be SOA here */
+ if (!strcmp(type, "SOA")) {
+ printsoa(&stack->val);
+ continue;
+ }
+ } else
+ printf("%s\t", type);
+
+ s = (char *)stack->val.data;
+ for (i = 0; i < stack->val.len; i++)
+ putchar(s[i]);
+ putchar('\n');
+ }
+}
+
+void print_zone(char *defaultttl, struct assstack_entry *stack) {
+ printf("$TTL %s\n", defaultttl);
+ for (; stack; stack = stack->next)
+ printrrs(defaultttl, stack);
+};
+
+void usage(char *name) {
+ fprintf(stderr, "Usage: %s zone-name LDAP-URL default-ttl [serial]\n", basename(name));
+ exit(1);
+};
+
+void err(char *name, char *msg) {
+ fprintf(stderr, "%s: %s\n", name, msg);
+ exit(1);
+};
+
+int putrr(struct assstack_entry **stack, struct berval *name, char *type, char *ttl, struct berval *val) {
+ struct string key;
+ struct assstack_entry *rr, *rrdata;
+
+ /* Do nothing if name or value have 0 length */
+ if (!name->bv_len || !val->bv_len)
+ return 0;
+
+ /* see if already have an entry for this name */
+ key.len = name->bv_len;
+ key.data = name->bv_val;
+
+ rr = assstack_find(*stack, &key);
+ if (!rr) {
+ /* Not found, create and push new entry */
+ rr = (struct assstack_entry *) malloc(sizeof(struct assstack_entry));
+ if (!rr)
+ return -1;
+ rr->key.len = name->bv_len;
+ rr->key.data = (void *) malloc(rr->key.len);
+ if (!rr->key.data) {
+ free(rr);
+ return -1;
+ }
+ memcpy(rr->key.data, name->bv_val, name->bv_len);
+ rr->val.len = sizeof(void *);
+ rr->val.data = NULL;
+ if (name->bv_len == 1 && *(char *)name->bv_val == '@')
+ assstack_push(stack, rr);
+ else
+ assstack_insertbottom(stack, rr);
+ }
+
+ rrdata = (struct assstack_entry *) malloc(sizeof(struct assstack_entry));
+ if (!rrdata) {
+ free(rr->key.data);
+ free(rr);
+ return -1;
+ }
+ rrdata->key.len = strlen(type) + strlen(ttl) + 1;
+ rrdata->key.data = (void *) malloc(rrdata->key.len);
+ if (!rrdata->key.data) {
+ free(rrdata);
+ free(rr->key.data);
+ free(rr);
+ return -1;
+ }
+ sprintf((char *)rrdata->key.data, "%s %s", ttl, type);
+
+ rrdata->val.len = val->bv_len;
+ rrdata->val.data = (void *) malloc(val->bv_len);
+ if (!rrdata->val.data) {
+ free(rrdata->key.data);
+ free(rrdata);
+ free(rr->key.data);
+ free(rr);
+ return -1;
+ }
+ memcpy(rrdata->val.data, val->bv_val, val->bv_len);
+
+ if (!strcmp(type, "SOA"))
+ assstack_push((struct assstack_entry **) &(rr->val.data), rrdata);
+ else
+ assstack_insertbottom((struct assstack_entry **) &(rr->val.data), rrdata);
+ return 0;
+}
+
+int main(int argc, char **argv) {
+ char *s, *hostporturl, *base = NULL;
+ char *ttl, *defaultttl;
+ LDAP *ld;
+ char *fltr = NULL;
+ LDAPMessage *res, *e;
+ char *a, **ttlvals, **soavals, *serial;
+ struct berval **vals, **names;
+ char type[64];
+ BerElement *ptr;
+ int i, j, rc, msgid;
+ struct assstack_entry *zone = NULL;
+
+ if (argc < 4 || argc > 5)
+ usage(argv[0]);
+
+ hostporturl = argv[2];
+
+ if (hostporturl != strstr( hostporturl, "ldap"))
+ err(argv[0], "Not an LDAP URL");
+
+ s = strchr(hostporturl, ':');
+
+ if (!s || strlen(s) < 3 || s[1] != '/' || s[2] != '/')
+ err(argv[0], "Not an LDAP URL");
+
+ s = strchr(s+3, '/');
+ if (s) {
+ *s++ = '\0';
+ base = s;
+ s = strchr(base, '?');
+ if (s)
+ err(argv[0], "LDAP URL can only contain host, port and base");
+ }
+
+ defaultttl = argv[3];
+
+ rc = ldap_initialize(&ld, hostporturl);
+ if (rc != LDAP_SUCCESS)
+ err(argv[0], "ldap_initialize() failed");
+
+ if (argc == 5) {
+ /* serial number specified, check if different from one in SOA */
+ fltr = (char *)malloc(strlen(argv[1]) + strlen("(&(relativeDomainName=@)(zoneName=))") + 1);
+ sprintf(fltr, "(&(relativeDomainName=@)(zoneName=%s))", argv[1]);
+ msgid = ldap_search(ld, base, LDAP_SCOPE_SUBTREE, fltr, NULL, 0);
+ if (msgid == -1)
+ err(argv[0], "ldap_search() failed");
+
+ while ((rc = ldap_result(ld, msgid, 0, NULL, &res)) != LDAP_RES_SEARCH_RESULT ) {
+ /* not supporting continuation references at present */
+ if (rc != LDAP_RES_SEARCH_ENTRY)
+ err(argv[0], "ldap_result() returned cont.ref? Exiting");
+
+ /* only one entry per result message */
+ e = ldap_first_entry(ld, res);
+ if (e == NULL) {
+ ldap_msgfree(res);
+ err(argv[0], "ldap_first_entry() failed");
+ }
+
+ soavals = ldap_get_values(ld, e, "SOARecord");
+ if (soavals)
+ break;
+ }
+
+ ldap_msgfree(res);
+ if (!soavals) {
+ err(argv[0], "No SOA Record found");
+ }
+
+ /* We have a SOA, compare serial numbers */
+ /* Only checkinf first value, should be only one */
+ s = strchr(soavals[0], ' ');
+ s++;
+ s = strchr(s, ' ');
+ s++;
+ serial = s;
+ s = strchr(s, ' ');
+ *s = '\0';
+ if (!strcmp(serial, argv[4])) {
+ ldap_value_free(soavals);
+ err(argv[0], "serial numbers match");
+ }
+ ldap_value_free(soavals);
+ }
+
+ if (!fltr)
+ fltr = (char *)malloc(strlen(argv[1]) + strlen("(zoneName=)") + 1);
+ if (!fltr)
+ err(argv[0], "Malloc failed");
+ sprintf(fltr, "(zoneName=%s)", argv[1]);
+
+ msgid = ldap_search(ld, base, LDAP_SCOPE_SUBTREE, fltr, NULL, 0);
+ if (msgid == -1)
+ err(argv[0], "ldap_search() failed");
+
+ while ((rc = ldap_result(ld, msgid, 0, NULL, &res)) != LDAP_RES_SEARCH_RESULT ) {
+ /* not supporting continuation references at present */
+ if (rc != LDAP_RES_SEARCH_ENTRY)
+ err(argv[0], "ldap_result() returned cont.ref? Exiting");
+
+ /* only one entry per result message */
+ e = ldap_first_entry(ld, res);
+ if (e == NULL) {
+ ldap_msgfree(res);
+ err(argv[0], "ldap_first_entry() failed");
+ }
+
+ names = ldap_get_values_len(ld, e, "relativeDomainName");
+ if (!names)
+ continue;
+
+ ttlvals = ldap_get_values(ld, e, "dNSTTL");
+ ttl = ttlvals ? ttlvals[0] : defaultttl;
+
+ for (a = ldap_first_attribute(ld, e, &ptr); a != NULL; a = ldap_next_attribute(ld, e, ptr)) {
+ char *s;
+
+ for (s = a; *s; s++)
+ *s = toupper(*s);
+ s = strstr(a, "RECORD");
+ if ((s == NULL) || (s == a) || (s - a >= (signed int)sizeof(type))) {
+ ldap_memfree(a);
+ continue;
+ }
+
+ strncpy(type, a, s - a);
+ type[s - a] = '\0';
+ vals = ldap_get_values_len(ld, e, a);
+ if (vals) {
+ for (i = 0; vals[i]; i++)
+ for (j = 0; names[j]; j++)
+ if (putrr(&zone, names[j], type, ttl, vals[i]))
+ err(argv[0], "malloc failed");
+ ldap_value_free_len(vals);
+ }
+ ldap_memfree(a);
+ }
+
+ if (ptr)
+ ber_free(ptr, 0);
+ if (ttlvals)
+ ldap_value_free(ttlvals);
+ ldap_value_free_len(names);
+ /* free this result */
+ ldap_msgfree(res);
+ }
+
+ /* free final result */
+ ldap_msgfree(res);
+
+ print_zone(defaultttl, zone);
+ return 0;
+}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-edu/pkg-team/ldap2bind.git
More information about the debian-edu-commits
mailing list