18int rename(
const char *,
const char *);
22 logmsg(
WHO,100,USAGE,
"axfr-get zone fn fn.tmp");
26 logmsg(
WHO,111,FATAL,
"unable to generate AXFR query");
30 logmsg(
WHO,111,FATAL,
"unable to parse AXFR results");
32unsigned int x_copy(
char *
buf,
unsigned int len,
unsigned int pos,
char *out,
unsigned int outlen)
58 logmsg(
WHO,111,FATAL,
"unable to read from network");
62 logmsg(
WHO,111,FATAL,
"unable to write to network");
66 logmsg(
WHO,111,FATAL,B(
"unable to read: ",
fn));
70 logmsg(
WHO,111,FATAL,B(
"unable to write: ",
fntmp));
77 if (r == 0) { errno = EPROTO;
die_parse(); }
114 if (ch ==
'.')
return 1;
115 if ((ch >=
'a') && (ch <=
'z'))
return 1;
116 if ((ch >=
'0') && (ch <=
'9'))
return 1;
117 if ((ch >=
'A') && (ch <=
'Z'))
return 1;
118 if (ch ==
'-')
return 1;
131unsigned int doit(
char *
buf,
unsigned int len,
unsigned int pos)
142 uint16_unpack_big(
data,&typenum);
143 uint32_unpack_big(
data + 4,&ttl);
145 if (
len - pos <
dlen) { errno = EPROTO;
return 0; }
157 if (!stralloc_copys(&
line,
"#"))
return 0;
158 if (!stralloc_catulong0(&
line,
u32,0))
return 0;
159 if (!stralloc_cats(&
line,
" auto axfr-get\n"))
return 0;
160 if (!stralloc_cats(&
line,
"Z"))
return 0;
162 if (!stralloc_cats(&
line,
"|"))
return 0;
164 if (!stralloc_cats(&
line,
".|"))
return 0;
166 if (!stralloc_cats(&
line,
"."))
return 0;
167 for (i = 0; i < 5; ++i) {
168 uint32_unpack_big(
data + 4 * i,&
u32);
169 if (!stralloc_cats(&
line,
"|"))
return 0;
170 if (!stralloc_catulong0(&
line,
u32,0))
return 0;
174 if (!stralloc_copys(&
line,
"&"))
return 0;
175 if (byte_equal(d1,2,
"\1*")) { errno = EPROTO;
return 0; }
177 if (!stralloc_cats(&
line,
"||"))
return 0;
180 if (!stralloc_cats(&
line,
"."))
return 0;
183 if (!stralloc_copys(&
line,
"C"))
return 0;
185 if (!stralloc_cats(&
line,
"|"))
return 0;
188 if (!stralloc_cats(&
line,
"."))
return 0;
191 if (!stralloc_copys(&
line,
"^"))
return 0;
193 if (!stralloc_cats(&
line,
"|"))
return 0;
196 if (!stralloc_cats(&
line,
"."))
return 0;
200 if (!stralloc_copys(&
line,
"@"))
return 0;
202 if (!stralloc_cats(&
line,
"||"))
return 0;
204 uint16_unpack_big(
data,&dist);
207 if (!stralloc_cats(&
line,
".|"))
return 0;
208 if (!stralloc_catulong0(&
line,dist,0))
return 0;
212 if (!stralloc_copys(&
line,
"+"))
return 0;
214 if (!stralloc_cats(&
line,
"|"))
return 0;
220 if (!stralloc_copys(&
line,
":"))
return 0;
222 if (!stralloc_cats(&
line,
"|"))
return 0;
229 if (!stralloc_copys(&
line,
"|"))
return 0;
231 if (!stralloc_cats(&
line,
"|"))
return 0;
232 if (!stralloc_catulong0(&
line,typenum,0))
return 0;
233 if (!stralloc_cats(&
line,
"|"))
return 0;
234 for (i = 0; i <
dlen; ++i) {
238 if (!stralloc_catb(&
line,&ch,1))
return 0;
241 if (!stralloc_cats(&
line,
"\\"))
return 0;
242 ch2 =
'0' + ((ch >> 6) & 7);
243 if (!stralloc_catb(&
line,&ch2,1))
return 0;
244 ch2 =
'0' + ((ch >> 3) & 7);
245 if (!stralloc_catb(&
line,&ch2,1))
return 0;
246 ch2 =
'0' + (ch & 7);
247 if (!stralloc_catb(&
line,&ch2,1))
return 0;
251 if (!stralloc_cats(&
line,
"|"))
return 0;
252 if (!stralloc_catulong0(&
line,ttl,0))
return 0;
253 if (!stralloc_cats(&
line,
"\n"))
return 0;
267 uint32 oldserial = 0;
268 uint32 newserial = 0;
291 if (
line.s[0] ==
'#') {
292 scan_ulong(
line.s + 1,&
u);
314 uint16_unpack_big(
out + 6,&numanswers);
322 if (!numanswers) { errno = EPROTO;
die_parse(); }
331 uint32_unpack_big(
out,&newserial);
334 if (oldserial && newserial)
335 if (oldserial == newserial)
367 while (pos <
packet.len) {
377 logmsg(
WHO,111,FATAL,B(
"unable to move ",
fntmp,
" to: ",
fn));
void put(char *buf, unsigned int len)
unsigned int x_getname(char *buf, unsigned int len, unsigned int pos, char **out)
int rename(const char *, const char *)
unsigned int x_skipname(char *buf, unsigned int len, unsigned int pos)
unsigned int x_copy(char *buf, unsigned int len, unsigned int pos, char *out, unsigned int outlen)
ssize_t saferead(int fd, char *buf, unsigned int len)
ssize_t safewrite(int fd, char *buf, unsigned int len)
void netget(char *buf, unsigned int len)
unsigned int doit(char *buf, unsigned int len, unsigned int pos)
int dns_domain_fromdot(char **out, const char *buf, unsigned int n)
int dns_domain_equal(const char *dn1, const char *dn2)
unsigned int dns_domain_length(const char *dn)
int dns_domain_suffix(const char *big, const char *little)
int dns_domain_todot_cat(stralloc *out, const char *d)
unsigned int dns_packet_getname(const char *buf, unsigned int len, unsigned int pos, char **d)
unsigned int dns_packet_copy(const char *buf, unsigned int len, unsigned int pos, char *out, unsigned int outlen)
unsigned int dns_packet_skipname(const char *buf, unsigned int len, unsigned int pos)
void out(const char *s, unsigned int len)