all: lib tools
-tools: $(PROG_TARGETS) confdrill tools-drill
+tools: $(PROG_TARGETS) drill
-confdrill: ./drill/configure
+./drill/config.log: ./drill/configure
( cd drill ; ./configure --with-ldns=../)
-drill: confdrill
+drill: ./drill/config.log
( cd drill ; make -f Makefile all)
lib: $(LIBDNS_OBJECTS) b64_pton$U.o b64_ntop$U.o
#include <openssl/hmac.h>
#include <openssl/md5.h>
+/* used only on the public key RR */
uint16_t
ldns_calc_keytag(ldns_rr *key)
{
return sigdata_rdf;
}
-/*
-ldns_rr *
-ldns_create_nsec(ldns_rr_list *before, ldns_rr_list *after)
-*/
ldns_rr *
ldns_create_nsec(ldns_rdf *cur_owner, ldns_rdf *next_owner, ldns_rr_list *rrs)
{
ldns_rr *ckey;
uint16_t i;
ldns_rr_type cur_rrset_type;
-ldns_status result;
+ ldns_status result;
signed_zone = ldns_zone_new();
* \param[in] tsig_cred credentials for TSIG-protected update messages
*/
ldns_status
-ldns_update_send_simple_A(const char *fqdn, const char *zone,
+ldns_update_send_simple_addr(const char *fqdn, const char *zone,
const char *ipaddr, u_int16_t ttl, ldns_tsig_credentials *tsig_cred)
{
ldns_resolver *res;
#include <ldns/dns.h>
+
+void
+usage(FILE *fp, char *prog) {
+ fprintf(fp, "%s domain [zone] ip [tsig_name tsig_alg tsig_hmac]\n", prog);
+ fprintf(fp, " send a dynamic update packet to <ip>\n\n");
+ fprintf(fp, " Use 'none' instead of ip to remove any previous address\n");
+ fprintf(fp, " If 'zone' is not specified, try to figure it out from the zone's SOA\n");
+ fprintf(fp, " Example: %s my.example.org 1.2.3.4\n", prog);
+}
+
+
int
main(int argc, char **argv)
{
- char *fqdn, *ipaddr, *zone;
- u_int16_t defttl = 300;
+ char *fqdn, *ipaddr, *zone, *prog;
ldns_status ret;
ldns_tsig_credentials tsig_cr, *tsig_cred;
int c = 2;
+ uint16_t defttl = 300;
+ prog = strdup(argv[0]);
+
switch (argc) {
case 3:
case 4:
case 7:
break;
default:
- fprintf(stderr, "usage: %s FQDN [zone] IP "
- "[tsig_name tsig_alg tsig_hmac]\n", argv[0]);
- fprintf(stderr, "Example: %s my.host.org 1.2.3.4\n", argv[0]);
- fprintf(stderr, "Use 'none' instead of IP to remove any "
- "previous address.\n");
- fprintf(stderr, "If 'zone' is not specified, "
- "try to figure it from SOA.\n");
- exit(1);
+ usage(stderr, prog);
+ exit(EXIT_FAILURE);
}
fqdn = argv[1];
c = 2;
- if (argc == 4 || argc == 7)
+ if (argc == 4 || argc == 7) {
zone = argv[c++];
- else
+ } else {
zone = NULL;
+ }
- if (strcmp(argv[c], "none") == 0)
+ if (strcmp(argv[c], "none") == 0) {
ipaddr = NULL;
- else
+ } else {
ipaddr = argv[c];
+ }
c++;
if (argc == 6 || argc == 7) {
tsig_cr.keyname = argv[c++];
- if (strncasecmp(argv[c], "hmac-sha1", 9) == 0)
- tsig_cr.algorithm = "hmac-sha1.";
- else if (strncasecmp(argv[c], "hmac-md5", 8) == 0)
- tsig_cr.algorithm = "hmac-md5.sig-alg.reg.int.";
- else {
+ if (strncasecmp(argv[c], "hmac-sha1", 9) == 0) {
+ tsig_cr.algorithm = (char*)"hmac-sha1.";
+ } else if (strncasecmp(argv[c], "hmac-md5", 8) == 0) {
+ tsig_cr.algorithm = (char*)"hmac-md5.sig-alg.reg.int.";
+ } else {
fprintf(stderr, "Unknown algorithm, try \"hmac-md5\" "
"or \"hmac-sha1\".\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
tsig_cr.keydata = argv[++c];
tsig_cred = &tsig_cr;
- } else
+ } else {
tsig_cred = NULL;
+ }
printf(";; trying UPDATE with FQDN \"%s\" and IP \"%s\"\n",
fqdn, ipaddr ? ipaddr : "<none>");
printf(";; tsig: \"%s\" \"%s\" \"%s\"\n", tsig_cr.keyname,
tsig_cr.algorithm, tsig_cr.keydata);
- ret = ldns_update_send_simple_A(fqdn, zone, ipaddr, defttl, tsig_cred);
+ ret = ldns_update_send_simple_addr(fqdn, zone, ipaddr, defttl, tsig_cred);
exit(ret);
}
* \param[in] ttl the update RR TTL
* \param[in] tsig_cred credentials for TSIG-protected update messages
*/
-ldns_status ldns_update_send_simple_A(const char *fqdn, const char *zone,
+ldns_status ldns_update_send_simple_addr(const char *fqdn, const char *zone,
const char *ipaddr, u_int16_t tll, ldns_tsig_credentials *tsig_cred);
#endif /* _LDNS_HIGHER_H */
ldns_rdf *orig_mac_rdf
)
{
- ldns_buffer *data_buffer = NULL;
char *wireformat;
int wiresize;
unsigned char *mac_bytes;
- unsigned int md_len = EVP_MAX_MD_SIZE;
unsigned char *key_bytes;
int key_size;
const EVP_MD *digester;
char *algorithm_name;
+ unsigned int md_len = EVP_MAX_MD_SIZE;
ldns_rdf *result = NULL;
+ ldns_buffer *data_buffer = NULL;
/*
* prepare the digestable information
*/
- data_buffer = ldns_buffer_new(LDNS_MAX_PACKETLEN);
+ data_buffer = ldns_buffer_new(LDNS_MIN_BUFLEN); /* we scale autom. */
/* if orig_mac is not NULL, add it too */
if (orig_mac_rdf) {
(void) ldns_rdf2buffer_wire(data_buffer, orig_mac_rdf);
}
ldns_buffer_write(data_buffer, pkt_wire, pkt_wire_size);
- (void) ldns_rdf2buffer_wire(data_buffer, key_name_rdf);
+ (void)ldns_rdf2buffer_wire(data_buffer, key_name_rdf);
ldns_buffer_write_u16(data_buffer, LDNS_RR_CLASS_ANY);
ldns_buffer_write_u32(data_buffer, 0);
- (void) ldns_rdf2buffer_wire(data_buffer, algorithm_rdf);
- (void) ldns_rdf2buffer_wire(data_buffer, time_signed_rdf);
- (void) ldns_rdf2buffer_wire(data_buffer, fudge_rdf);
- (void) ldns_rdf2buffer_wire(data_buffer, error_rdf);
- (void) ldns_rdf2buffer_wire(data_buffer, other_data_rdf);
+ (void)ldns_rdf2buffer_wire(data_buffer, algorithm_rdf);
+ (void)ldns_rdf2buffer_wire(data_buffer, time_signed_rdf);
+ (void)ldns_rdf2buffer_wire(data_buffer, fudge_rdf);
+ (void)ldns_rdf2buffer_wire(data_buffer, error_rdf);
+ (void)ldns_rdf2buffer_wire(data_buffer, other_data_rdf);
wireformat = (char *) data_buffer->_data;
wiresize = (int) ldns_buffer_position(data_buffer);
ldns_rdf_free(other_data_rdf);
return status;
}
-
-