mirror of
https://github.com/bklang/ldap2dns.git
synced 2025-10-26 22:04:15 -04:00
Only print loccode header if we have actual records
Add whitespace to version banner in zone output git-svn-id: https://svn.alkaloid.net/gpl/ldap2dns/trunk@332 06cd67b6-e706-0410-b29e-9de616bca6e9
This commit is contained in:
17
ldap2dns.c
17
ldap2dns.c
@@ -780,7 +780,7 @@ static void write_zone(void)
|
||||
zone.domainname, zone.class, zone.domainname);
|
||||
}
|
||||
if (namedzone) {
|
||||
fprintf(namedzone, "; Automatically generated by ldap2dns v%s - DO NOT EDIT!\n", VERSION);
|
||||
fprintf(namedzone, ";\n; Automatically generated by ldap2dns v%s - DO NOT EDIT!\n;\n\n", VERSION);
|
||||
if (zone.ttl[0])
|
||||
fprintf(namedzone, "$TTL %s\n", zone.ttl);
|
||||
else
|
||||
@@ -839,9 +839,9 @@ static void read_dnszones(void)
|
||||
int ldaperr;
|
||||
|
||||
if (tinyfile)
|
||||
fprintf(tinyfile, "# Automatically generated by ldap2dns v%s - DO NOT EDIT!\n", VERSION);
|
||||
fprintf(tinyfile, "#\n# Automatically generated by ldap2dns v%s - DO NOT EDIT!\n#\n\n", VERSION);
|
||||
if (namedmaster)
|
||||
fprintf(namedmaster, "# Automatically generated by ldap2dns v%s - DO NOT EDIT!\n", VERSION);
|
||||
fprintf(namedmaster, "#\n# Automatically generated by ldap2dns v%s - DO NOT EDIT!\n#\n\n", VERSION);
|
||||
if ( (ldaperr = ldap_search_ext_s(ldap_con, options.searchbase[0] ? options.searchbase : NULL, LDAP_SCOPE_SUBTREE, "objectclass=DNSzone", NULL, 0, NULL, NULL, &options.searchtimeout, options.reclimit, &res))!=LDAP_SUCCESS )
|
||||
die_ldap(ldaperr);
|
||||
if (ldap_count_entries(ldap_con, res) < 1) {
|
||||
@@ -984,15 +984,18 @@ static void read_loccodes(void)
|
||||
LDAPMessage* m;
|
||||
int ldaperr;
|
||||
|
||||
if (tinyfile)
|
||||
fprintf(tinyfile, "# Location Codes (if any) - generated by ldap2dns v%s - DO NOT EDIT!\n", VERSION);
|
||||
|
||||
if ( (ldaperr = ldap_search_ext_s(ldap_con, options.searchbase[0] ? options.searchbase : NULL, LDAP_SCOPE_SUBTREE, "objectclass=DNSloccodes", NULL, 0, NULL, NULL, &options.searchtimeout, options.reclimit, &res))!=LDAP_SUCCESS )
|
||||
die_ldap(ldaperr);
|
||||
if (ldap_count_entries(ldap_con, res) < 1) {
|
||||
fprintf(stderr, "[**] Warning: No records returned from search. Check for correct credentials,\n[**] LDAP hostname, and search base DN.\n\n");
|
||||
|
||||
// We aren't going to warn for zero records here as many installs do
|
||||
// not use location codes at all
|
||||
if ((ldap_count_entries(ldap_con, res) > 0) && tinyfile) {
|
||||
fprintf(tinyfile, "#\n# Location Codes (if any) - generated by ldap2dns v%s - DO NOT EDIT!\n#\n\n", VERSION);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
for (m = ldap_first_entry(ldap_con, res); m; m = ldap_next_entry(ldap_con, m)) {
|
||||
BerElement* ber = NULL;
|
||||
char* attr;
|
||||
|
||||
Reference in New Issue
Block a user