allow inform to lie about your hostname using a spacial tuple in /lib/ndb/local. my hostname is sane, the one the IT dep give me is silly, they give me a cname back to sanity but I must register their silly name when using inform so their database is happy. Notes: Fri Jul 29 18:26:25 EDT 2011 geoff covered by inform-update Reference: /n/sources/patch/applied/inform-lie Date: Fri Jun 17 15:29:18 CES 2011 Signed-off-by: steve@quintile.net Reviewed-by: geoff --- /sys/src/cmd/ndb/inform.c Fri Jun 17 15:26:10 2011 +++ /sys/src/cmd/ndb/inform.c Fri Jun 17 15:26:06 2011 @@ -24,11 +24,6 @@ [10] "domain name not in zone", }; -char *dnsrch[] = { - "dnsdomain", - "dom", -}; - void usage(void) { @@ -98,12 +93,12 @@ { int debug, len, fd; uint err; - char *sysname, *dnsdomain, *dom, *ns, net[32]; + char *sysname, *dnsdomain, *dom, *inform, *ns, net[32]; uchar *p, buf[4096], addr[IPv4addrlen], v6addr[IPaddrlen]; ushort txid; Ndb *db; Ndbtuple *t, *tt; - static char *query[] = { "dom", "dnsdomain", "ns", }; + static char *query[] = { "dom", "dnsdomain", "ns", "inform" }; fmtinstall('I', eipfmt); fmtinstall('V', eipfmt); @@ -112,6 +107,7 @@ debug = 0; ns = nil; dom = nil; + inform = nil; dnsdomain = nil; ARGBEGIN{ case 'd': @@ -133,16 +129,22 @@ if((db = ndbopen(nil)) == nil) sysfatal("can't open ndb: %r"); tt = ndbipinfo(db, "sys", sysname, query, nelem(query)); - for(t = tt; t; t = t->entry) + for(t = tt; t; t = t->entry){ if(strcmp(t->attr, "ns") == 0) ns = t->val; else if(strcmp(t->attr, "dom") == 0) dom = t->val; else if(strcmp(t->attr, "dnsdomain") == 0) dnsdomain = t->val; + else if(strcmp(t->attr, "inform") == 0) + inform = t->val; + } + ndbfree(tt); ndbclose(db); + if(inform) + dom = inform; if(!ns) sysfatal("no relevant ns="); if(!dom)