summaryrefslogtreecommitdiffabout
AgeCommit message (Collapse)AuthorFiles
2017-11-15BugfixesHEADmasterSergey Poznyakoff4
* grecs: Update. * src/cmdline.opt: New option --pidfile * src/nssync.c: Pidfile from command line overrides that from configuration. * src/config.c (config_parse): Fix coredump on empty synclist
2017-08-19Fix distcheckSergey Poznyakoff6
* Makefile.am (ACLOCAL_AMFLAGS): Add runcap. * configure.ac: Call RUNCAP_SETUP * doc/Makefile.am (TEXI2DVI): Pass include files directory * runcap: Update * src/Makefile.am: Fix AM_CPPFLAGS
2017-08-18Fix compilation without libmicrohttpd (again)Sergey Poznyakoff2
2017-08-18BugfixSergey Poznyakoff1
* src/timer.c (nssync_timer): Fix call to pthread_cond_timedwait.
2017-08-17Fix libwrap usageSergey Poznyakoff2
* src/server.c (nssync_mhd_acl): Don't use fromhost, since we don't have the connection descriptot. Instead set the socket methods explicitly
2017-08-17Implement asynchronous and periodic request handling in server mode.Sergey Poznyakoff10
In server mode, the server wakes up periodically to run synchronizations. The wake up interval is configured by the server.wakeup statement. By default, POST requests to /nssync endpoint are delayed for certain time. This avoids spurious wake-ups if several requests come one after another during a short time. The delay is configured by the server.quarantine statement. Finally, the GET request returns the latest wakeup status. * src/Makefile.am [COND_MICROHTTPD] (PTHREAD_L): Add -lrt [COND_MICROHTTPD] (nssync_SOURCES): Add timer.c * src/config.c (server_kw): New keywords: "wakeup" and "delay". * src/nssync.c (periodic_timeout) (delay_timeout): New globals. (nssync): Add timestamp to the response. * src/nssync.h (periodic_timeout) (delay_timeout): New externs. (nssync_reschedule,nssync_timer): (nssync_format_result): New protos. * src/server.c (do_sync): Parse POST body. If present, it must be a valid JSON object. Handle GET requests (return most recent status). (nssync_server): Start nssync_timer thread. * src/timer.c: New file. * NEWS: Update. * doc/nssync.texi: Update. * doc/nssync.8: Update.
2017-08-16Improve docs.Sergey Poznyakoff8
* NEWS: Document changes. * doc/nssync.8: Likewise. * doc/nssync.texi: Likewise. * src/Makefile.am (LOCALSTATEDIR): Change definition * src/cmdline.opt (--syslog): New option. * src/nssync.c (main): Honor --syslog in cron mode. * src/nssync.h (nssync_server): Return int. * src/server.c (nssync_server): Change to the user privs after opening the socket. Create the pidfile afterward.
2017-08-16Version 1.1.92; update copyright years; use contiguous year rangesSergey Poznyakoff18
2017-08-16Get rid of the select loop, use MHD internal polling thread insteadSergey Poznyakoff4
2017-08-16Implement daemon mode.Sergey Poznyakoff8
* configure.ac (GRECS_SETUP): Request tree-api. * src/Makefile.am: Pass LOCALSTATEDIR to preprocessor * src/cmdline.opt: New option --foreground. (parse_options): Set default values for pidfile and syslog_tag. * src/config.c: New block statement "syslog". * src/nssync.c (syslog_facility, syslog_tag) (foreground): New globals. (start_syslog,vdiag,info_printf): New functions. Rewrite diagnostics using vdiag. (check_pidfile): Don't attempt to create pidfile. (main): Add signal handling. Create pidfile after assuming user's identity. * src/nssync.h (syslog_facility,syslog_tag) (foreground): New externs. (debug): Use info_printf on level 1. (info_printf): New proto. * src/server.c (nssync_server): Switch to background unless --foreground has been given. Set up logging and create pidfile in child process.
2017-08-15BugfixesSergey Poznyakoff6
2017-08-15Switch to user's privileges, if requiredSergey Poznyakoff6
* src/runas.c: New file. * src/Makefile.am: Add runas.c * src/config.c: Move mysql configuration to a separate block. New configuration statements: "user" and "group". * src/nssync.c (main): Optionally switch to user privileges before starting operation. * src/nssync.h (runas_user, runas_group): New externs. (DEFAULT_NSSYNC_ADDR): Change to a safer value. (runas): New proto. * src/server.c (nssync_resources): Change endpoint. (nssync_mhd_handler): Remove debugging print.
2017-08-15Fix build without libmicrohttpdSergey Poznyakoff4
2017-08-14Minor fixSergey Poznyakoff1
2017-08-14Return detailed result in json in server mode.Sergey Poznyakoff5
* src/bindcf.c: Use dlz_error/dlz_success, as appropriate. * src/output.c: Likewise. * src/nssync.c (error_count): Remove. (error_list): New global. (changed_zones): Change types. All uses changed. (dlz_error,dlz_success): New functions. (nssync): Take (optional) argument. All uses changed * src/nssync.h (dlz_error,dlz_success): New protos.
2017-08-14Remove useless NLS markersSergey Poznyakoff2
I don't expect nssync to ever get internationalized.
2017-08-14Use runcap to run the external reload commandSergey Poznyakoff1
2017-08-14Start implementing server mode.Sergey Poznyakoff13
This commit adds a small HTTP server (using GNU libmicrohttpd), which can be used to trigger the synchronization on demand. * .gitmodules (runcap): New submodule. * Makefile.am (SUBDIRS): Add runcap. * configure.ac: Check for libmicrohttpd. * src/Makefile.am [COND_MICROHTTPD](nssync_SOURCES): Add server.c (LDADDD,AM_CPPFLAGS): Add runcap * src/server.c: New file. * src/nssync.h (DEFAULT_NSSYNC_ADDR): New define. (nssync) <new_nodes>: New member. Keeps a list of temporary nodes added to the tree during synchronization. The registered nodes (and their sub-trees) are unlinked and freed when the synch phase is finished. * src/bindcf.c (filetab_clear,nssync_node_bind): New functions. (new_zone,bindcf_lookup): Use nssync_node_bind to insert new nodes. This makes sure they can be cleaned up later. (flush_zone_list): Remove added nodes when done. * src/cmdline.opt: New option --server (-s) * src/config.c (cb_sync): Initialize new_nodes member. Set up the free_entry pointer to unlink and destroy the node it refers to. (nssync_kw): Remove compare-command. Add the "server" block statement. (config_init): Request the implicit quoted string concatenation feature. * src/nssync.c (compare_command): Remove. (compare): Rewrite without use of external command. (check_slave_status): Return status instead of exiting. (nssync): New function (main): Run as a server if requested from command line. * src/sqlop.c (sql_connect): Don't set sql_disconnect to be run at exit.
2017-08-12Update grecsSergey Poznyakoff1
2015-04-24Fix doc generation.Sergey Poznyakoff3
Default Config file applied to all output formats, which is wrong. Use a dedicated configuration file for html output formats, and defaults for the rest. * doc/Makefile.am (GENDOCS): Add html-specific configuration file. * doc/Config: Rename to doc/html.init (with changes). * doc/index.init: New file.
2015-03-01Switch to Texinfo 5.0Sergey Poznyakoff4
* doc/Config: Rewrite. * doc/Makefile.am: Use Makeinfo 5 instead of texi2htm * doc/gendocs_template: Ps is not built * imprimatur: Upgrade.
2014-12-02Version 1.1.91Sergey Poznyakoff2
2014-12-02Bugfixes.Sergey Poznyakoff2
* src/iflist.c: Don't consider EADDRNOTAVAIL an error * src/output.c (free_nsdef): fix coredump
2014-12-01Upgrade grecsSergey Poznyakoff1
2014-12-01Optionally select only zones which list the current machine as one of their NSs.Sergey Poznyakoff9
* src/iflist.c: New file. * src/Makefile.am (nssync_SOURCES): Add iflist.c * src/config.c: New configuration statement "check-ns". * src/nssync.c (main): Call get_host_addresses if check-ns is requested. * src/nssync.h (check_ns): New extern. (get_host_addresses, is_my_sockaddr): New protos. (nsdef): New struct. (nssync) <nsdef_head, nsdef_tail> <myzone>: New members. * src/output.c (format_ns_record): Remove. (save_ns_record): New function. Replaces format_ns_record. (format_soa_record): Don't create zone file if myzone is false. * NEWS: Document check-ns * doc/nssync.8: Likewise. * doc/nssync.texi: Likewise.
2014-06-27Raise version number (1.1.90)Sergey Poznyakoff7
* NEWS: Update version * configure.ac: Update version, set package home page. * THANKS: * src/Makefile.am: Update copyright years. * src/nssync.c: Likewise. * src/sqlop.c: Likewise. * doc/nssync.8: Update.
2014-06-27Fix coredump if mysql is not in slave mode and slave status is requested.Sergey Poznyakoff2
* src/nssync.c (check_slave_status): Return if no status file is defined, or if sql_get_slave_status returned 1 (main): Call check_slave_status unconditionally. It will take care of the rest. * src/sqlop.c (sql_get_slave_status): Fail if any of file or off is NULL.
2014-06-27Upgrade grecs, use recent AutomakeSergey Poznyakoff4
* grecs: Upgrade * src/Makefile.am: Use AM_CPPFLAGS instead of INCLUDES * src/bindcf.c (new_zone,bindcf_lookup): Update references to the members of grecs_locus_t * src/config.c: Update kw definitions.
2012-03-27Minor fix.Sergey Poznyakoff1
* doc/nssync.texi: Add missing @chapter.
2012-03-27Minor change.release-1.1Sergey Poznyakoff1
2012-03-27Provide documentation. Set version number 1.1Sergey Poznyakoff12
2011-05-28Provide a way to supply additional statements for the generated zones.Sergey Poznyakoff4
* grecs: Update. * src/nssync.h (nssync) <zone_add_stmt>: New field. * src/config.c (sync_kw)<add-statements>: New statement. * src/bindcf.c (output_zone): Output additional statements.
2011-05-27Updage grecsSergey Poznyakoff1
2011-05-23Improve error handling.Sergey Poznyakoff4
* src/bindcf.c (bind_working_dir): Remove static qualifier. (filetab): New static. (find_file): New static function. (bindcf_zone_name): New function. (bindcf_lookup): Rename existing zone file if zone_file_pattern has changed. (flush_zone_list): Handle file name clashes gratiously. Don't delete file if it is already used by another zone. * src/nssync.c (create_hierarchy,trycreate): New function. (copy_file): Call trycreate if open failed with ENOENT. (move_file): New function. (main): Print additional diagnostics before exiting on error. * src/nssync.h (bind_working_dir): New extern. (move_file): New proto.
2011-05-22Provide global zone-conf statement.Sergey Poznyakoff3
* src/bindcf.c (zone_conf_file): New variable. * src/config.c (nssync_kw)<zone-conf>: New statement. (synclist_fixup): If sync-specific zone-conf is not set, use the global one. (cb_sync): Don't check zone_conf_file right away, wait until synclist_fixup instead. * src/nssync.h (zone_conf_file): New extern.
2011-05-22Optionally check if there is a running instance alreadySergey Poznyakoff3
* src/config.c (nssync_kw) <pidfile>: New statement. * src/nssync.c (pidfile): New global. (create_pidfile, remove_pidfile, check_pidfile): New functions. (main): Call check_pidfile. * src/nssync.h (pidfile): New extern.
2011-05-20Use per-view file name patterns.Sergey Poznyakoff4
* src/bindcf.c (bind_zonefile_dir): Remove. (zone_file_pattern): Change default value. (bindcf_lookup): expand $synctag. * src/config.c (sync_kw) <zonefile-pattern>: New statement. (nssync_kw) <zonefile-dir>: Remove. (config_help): Update for the latest grecs. (synclist_fixup): New function. (config_parse): Call synclist_fixup. * src/nssync.h (bind_zonefile_dir): Remove. (nssync)<zone_file_pattern>: New field.
2011-05-18Create individual zone files.Sergey Poznyakoff13
* src/Makefile.am (EXTRA_DIST): Add cmdline.opt. * src/bindcf.c (bind_zonefile_dir) (zone_file_pattern): New variables. (source_named_conf): More checks. (bindcf_lookup): Rewrite. (flush_zone_list): New function. * cmdline.opt: New option: --force. * src/config.c (sync_kw)<path>: Remove keyword. All uses changed. <zone-conf>: New keyword. (nssync_kw) <slave-status-file> <zonefile-dir,zonefile-pattern> <reload-command>: New keyword. * src/nssync.c (copy_file): Increase changed_zones. Return immediately if in dry-run mode. (compare): Change signature. (synchronize): Rewrite. (check_slave_status): New function. (main): Check slave status. Update all changed zones. Reload bind, if needed. * src/nssync.h (slave_status_file) (reload_command, changed_zones): New externs (sql_get_slave_status): New proto. (nssync) <kwpath>: Remove. <zone_conf_file,zone_tree>: New members. (bindcf_lookup): Change signature. (flush_zone_list, compare): New protos. * src/output.c: Change logic to produce a single file per zone. * src/sqlop.c (sql_get_slave_status): New function. * configure.ac: Switch from foreign to gnu. * AUTHORS: New file. * COPYING: New file. * NEWS: New file. * README: New file.
2011-05-18Provide a default pp-setup file.Sergey Poznyakoff3
2011-05-18Implement compare and update loop.Sergey Poznyakoff6
* src/bindcf.c: New file. * src/Makefile.am (nssync_SOURCES): Add bindcf.c. * src/config.c (soa_query, rr_query) (rev_rr_query,ns_query): Remove globals. (synclist): New global. (sync_kw): New keywords (mostly moved from nssync_kw. (cb_sync): New callback. (nssync_kw): New statement "sync". New statements: tempdir, named-conf, bind-include-path, compare-command. (config_parse): More checks. * src/nssync.c (tempdir, compare_command) (error_count): New globals. (debug_printf): New function. (synchronize): New function. (main): Call synchronize for each element from synclist. * src/nssync.h (compare_command,tempdir) (named_conf_file,bind_include_path) (synclist, debug_level): New externs. (soa_query, rr_query) (rev_rr_query,ns_query): Remove. (debug): New macro. (debug_printf): New proto. (nssync): New struct. (format_soa): Remove. (format_zones) (source_named_conf,bindcf_lookup): New protos. * src/output.c: Rewrite using struct nssync as a closure.
2011-05-18Print to a specified output file.Sergey Poznyakoff3
2011-05-18Initial commitSergey Poznyakoff15

Return to:

Send suggestions and report system problems to the System administrator.