#define MAXPARA 10
+static void handle_reload(int parc, char *parv[]);
static void handle_stat(int parc, char *parv[]);
rb_helper *authd_helper = NULL;
authd_cmd_handler authd_cmd_handlers[255] = {
+ ['C'] = handle_reload,
['D'] = resolve_dns,
['S'] = handle_stat,
};
['D'] = enumerate_nameservers,
};
+authd_reload_handler authd_reload_handlers[255] = {
+ ['D'] = reload_nameservers,
+};
+
static void
handle_stat(int parc, char *parv[])
{
handler(parv[1], parv[2][0]);
}
+static void
+handle_reload(int parc, char *parv[])
+{
+ authd_reload_handler handler;
+
+ if(parc < 2)
+ /* XXX Should log this somehow */
+ return;
+
+ if (!(handler = authd_reload_handlers[parv[1][0]]))
+ return;
+
+ handler(parv[1][0]);
+}
+
static void
parse_request(rb_helper *helper)
{
typedef void (*authd_cmd_handler)(int parc, char *parv[]);
typedef void (*authd_stat_handler)(const char *rid, const char letter);
+typedef void (*authd_reload_handler)(const char letter);
+
extern authd_cmd_handler authd_cmd_handlers[255];
extern authd_stat_handler authd_stat_handlers[255];
+extern authd_reload_handler authd_reload_handlers[255];
#endif
rb_helper_write(authd_helper, "Y %s %c %s", rid, letter, buf);
}
+
+void
+reload_nameservers(const char letter)
+{
+ /* Not a whole lot to it */
+ restart_resolver();
+}
extern void resolve_dns(int parc, char *parv[]);
extern void enumerate_nameservers(const char *rid, const char letter);
+extern void reload_nameservers(const char letter);
#endif
void dns_results_callback(const char *callid, const char *status, const char *aftype, const char *results);
void dns_stats_results_callback(const char *callid, const char *status, int resc, const char *resv[]);
void init_nameserver_cache(void);
+bool reload_nameservers(void);
#endif
(void)get_nameservers(get_nameservers_cb, NULL);
}
+bool
+reload_nameservers(void)
+{
+ if(authd_helper == NULL)
+ {
+ /* Shit */
+ return false;
+ }
+ rb_helper_write(authd_helper, "C D");
+ init_nameserver_cache();
+ return true;
+}
+
+
static void
submit_dns(uint16_t nid, char type, const char *addr)
{
if (!MyConnect(source_p))
remote_rehash_oper_p = source_p;
- /* reread /etc/resolv.conf and reopen res socket */
- restart_authd();
+ reload_nameservers();
}
static void