Change flags from db|data to bind|tinydns (yes, we are backward-compatible)

git-svn-id: https://svn.alkaloid.net/gpl/ldap2dns/trunk@515 06cd67b6-e706-0410-b29e-9de616bca6e9
This commit is contained in:
Ben Klang
2010-02-18 20:05:44 +00:00
parent d723e448bc
commit f8a79c72fe
2 changed files with 18 additions and 14 deletions

8
TODO
View File

@@ -6,14 +6,6 @@
* Print warning if running as root (2006/06/08 bklang) * Print warning if running as root (2006/06/08 bklang)
--- For ldap2dns 1.0beta --- WILL BREAK COMPATIBILITY ---
* Clean up DNS TXT support: text current requires a trailing '.', probably
should introduce a new attribute for DNS TXT so it is unambiguous
(2005/12/23 bklang)
* Change output formats of "data" and "db" to "tinydns" and "bind"
(2006/06/08 bklang)
--- Old TODOs from Jacob --- --- Old TODOs from Jacob ---
Version ?.?.? Version ?.?.?
+ Make ldap2dns behave like a secondary nameserver by storing + Make ldap2dns behave like a secondary nameserver by storing

View File

@@ -164,7 +164,7 @@ static void set_datadir(void)
static void print_usage(void) static void print_usage(void)
{ {
print_version(); print_version();
printf("usage: ldap2dns[d] [-df] [-o data|db] [-h host] [-p port] [-H hostURI] \\\n"); printf("usage: ldap2dns[d] [-df] [-o tinydns|bind] [-h host] [-p port] [-H hostURI] \\\n");
printf("\t\t[-D binddn] [-w password] [-L[filename]] [-u numsecs] \\\n"); printf("\t\t[-D binddn] [-w password] [-L[filename]] [-u numsecs] \\\n");
printf("\t\t[-b searchbase] [-v[v]] [-V] [-t timeout] [-M maxrecords]\n"); printf("\t\t[-b searchbase] [-v[v]] [-V] [-t timeout] [-M maxrecords]\n");
printf("\n"); printf("\n");
@@ -175,8 +175,8 @@ static void print_usage(void)
printf(" -D binddn\tUse the distinguished name binddn to bind to the LDAP directory\n"); printf(" -D binddn\tUse the distinguished name binddn to bind to the LDAP directory\n");
printf(" -w bindpasswd\tUse bindpasswd as the password for simple authentication\n"); printf(" -w bindpasswd\tUse bindpasswd as the password for simple authentication\n");
printf(" -b\t\tSearch base to use instead of default\n"); printf(" -b\t\tSearch base to use instead of default\n");
printf(" -o data\tGenerate a tinydns compatible \"data\" file\n"); printf(" -o tinydns\tGenerate a tinydns compatible \"data\" file\n");
printf(" -o db\t\tGenerate a BIND compatible zone files\n"); printf(" -o bind\t\tGenerate a BIND compatible zone files\n");
printf(" -L [filename]\tPrint output in LDIF format for reimport\n"); printf(" -L [filename]\tPrint output in LDIF format for reimport\n");
printf(" -h host\tHostname of LDAP server, defaults to localhost\n"); printf(" -h host\tHostname of LDAP server, defaults to localhost\n");
printf(" -p port\tPort number to connect to LDAP server, defaults to %d\n", LDAP_PORT); printf(" -p port\tPort number to connect to LDAP server, defaults to %d\n", LDAP_PORT);
@@ -344,10 +344,16 @@ static int parse_options()
options.reclimit = DEF_RECLIMIT; options.reclimit = DEF_RECLIMIT;
ev = getenv("LDAP2DNS_OUTPUT"); ev = getenv("LDAP2DNS_OUTPUT");
if (ev) { if (ev) {
if (strcmp(ev, "data")==0) if (strcmp(ev, "bind")==0)
options.output = OUTPUT_DB;
else if (strcmp(ev, "tinydns")==0)
options.output = OUTPUT_DATA; options.output = OUTPUT_DATA;
else if (strcmp(ev, "db")==0) else if (strcmp(ev, "db")==0)
// Backward compatibility
options.output = OUTPUT_DB; options.output = OUTPUT_DB;
else if (strcmp(ev, "data")==0)
// Backward compatibility
options.output = OUTPUT_DATA;
} }
ev = getenv("LDAP2DNS_VERBOSE"); ev = getenv("LDAP2DNS_VERBOSE");
if (ev && sscanf(ev, "%hd", (short *)&options.verbose) != 1) if (ev && sscanf(ev, "%hd", (short *)&options.verbose) != 1)
@@ -428,9 +434,15 @@ static int parse_options()
break; break;
case 'o': case 'o':
options.output = 0; options.output = 0;
if (strcmp(optarg, "data")==0) if (strcmp(optarg, "tinydns")==0)
options.output = OUTPUT_DATA;
else if (strcmp(optarg, "bind")==0)
options.output = OUTPUT_DB;
else if (strcmp(optarg, "data")==0)
// Backward compatibility
options.output = OUTPUT_DATA; options.output = OUTPUT_DATA;
else if (strcmp(optarg, "db")==0) else if (strcmp(optarg, "db")==0)
// Backward compatibility
options.output = OUTPUT_DB; options.output = OUTPUT_DB;
break; break;
case 'p': case 'p':
@@ -1246,7 +1258,7 @@ int main(int argc, char** argv)
parse_options(); parse_options();
if (!options.output) { if (!options.output) {
fprintf(stderr, "[!!]\tMust select an output type (\"db\" or \"data\")\n"); fprintf(stderr, "[!!]\tMust select an output type (\"bind\" or \"tinydns\")\n");
fprintf(stderr, "Use --help to see usage information\n"); fprintf(stderr, "Use --help to see usage information\n");
exit(1); exit(1);
} }