aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)AuthorFiles
2017-01-02Happy GNU YearSergey Poznyakoff26
2016-08-20Fix environment modification codeSergey Poznyakoff1
Port fixes from GNU rush
2016-07-16Merge branch 'master' of ssh://git.gnu.org.ua/gitroot/piesSergey Poznyakoff2
2016-07-16Don't concatenate adjacent strings in configuration files.Sergey Poznyakoff2
* grecs: Upgrade. * src/pies.h: Fix include paths. * src/piesctl.c: Likewise. * NEWS: Document changes. * doc/pies.texi: Likewise.
2016-04-07Remove duplicate includesSergey Poznyakoff2
2016-03-19Add testsuteSergey Poznyakoff1
2016-03-19BugfixesSergey Poznyakoff2
* src/pies.c (main): Issue the start-up message after eventual changing to background and the corresponding reconfiguration of diagnostic output channel. * src/piesctl.c (parse_condition_to_uri, com_id): Fix checking for arguments.
2016-03-19Fix some compilation issues on SolarisSergey Poznyakoff4
* configure.ac: Check for libnsl * src/pies.c (string_to_syslog_facility): LOG_AUTHPRIV and LOG_FTP may be undefined. * src/piesctl.c (EX_NOTFOUND): Rename to EX_PIES_NOTFOUND. (com_list): Use default_cond. * src/sysvinit.c (console_stty): Make sure CBAUDEX is defined. * src/utmp.c (fill_utmp): Declare locals right before using them.
2016-03-07Improve docsSergey Poznyakoff1
* doc/pies.texi: Document piesctl and identity providers. * src/piesctl.c: Fix reference to the docs.
2016-03-07Fix pies -ESergey Poznyakoff1
* src/pies.c (main): Fix syntax type comparison.
2016-03-06Reimplement the telinit legacy interface.Sergey Poznyakoff6
pies -T is now fully compatible with the legacy telinit command * src/telinit.opt: New file. * src/Makefile.am: Add telinit.opt * src/cmdline.opt (-T): Remove explicit variable. Rest of command line is processed specially. * src/pies.h (telinit): Change prototype. * src/sysvinit.c (telinit): Rewrite. * src/.gitignore: Update. * doc/pies.texi: Document telinit.
2016-03-05ACL reference statements.Sergey Poznyakoff3
All ACL keywords can be used in simple statement as well as in block form. As simple statements, they take a name of an already defined named ACL. E.g.: defacl forbid { deny any; } component foo { list-acl forbid; } This commit also fixes some eventual double-frees. * doc/pies.texi: Update. * src/acl.c (pies_acl)<refcnt>: New member. (pies_acl_use): New function. (pies_acl_create): Initialize refcnt. (pies_acl_destroy): New function. (pies_acl_free): Rewrite as a wrapper over pies_acl_destroy. (_parse_sub_acl): Call pies_acl_use when installing a named ACL. (_acl_common_section_parser): Handle grecs_callback_set_value. * src/acl.h (pies_acl_destroy) (pies_acl_use): New function. * src/comp.c (component_free): Free acl.
2016-03-05Use pies_schedule_action instead of assigning action directly.Sergey Poznyakoff1
2016-03-02BugfixesSergey Poznyakoff2
* src/comp.c (component_verify): Fix stdout redirection check. * src/meta1parse.c (meta1_translate_node): Skip simple statements. (meta1_translate_node): Allocate comp->dir * doc/pies.texi: Use @example instead of @smallexample
2016-03-02Configurable pathname of the emergency shellSergey Poznyakoff2
* configure.ac (EMERGENCY_SHELL): New arg_var. * src/Makefile.am (AM_CPPFLAGS): Define EMERGENCY_SHELL. * src/sysvinit.c (emergency_shell): Initialize with the value of EMERGENCY_SHELL.
2016-03-01BugfixSergey Poznyakoff1
* src/sysvinit.c (sysvinit_environ_hint): Fix dimensions.
2016-02-28Synchronize changes in runlevel with configuration reloadsSergey Poznyakoff5
State transition algorithm used this far could cause spurious component wakeups in some cases. Consider the following scenario: being in runlevel N, the configuration is changed so that a component X is added at runlevel N. Then a change to runlevel N+1 is initiated. What happens then is that X is woken up (still being in runlevel N) and terminated shortly afterwards, upon entering runlevel N+1. To avoid this, configuration must be reloaded after runlevel changes. * src/ctl.c (res_runlevel): Don't initiate ACTION_RELOAD after setting the runlevel. * src/pies.c (main): Begin main event loop with call to pies_pause. * src/pies.h (pies_set_hook): New proto. (inittrans): Remove proto. * src/socket.c (pies_set_hook): New function. (pies_pause): Call pies_pause_hook if defined. * src/sysvinit.c (inittrans): Change to static. If transition was initiated by user (e.g. by invoking telinit), schedule ACTION_RELOAD. (sysvinit_begin): Set inittrans as pies_hook
2016-02-28Minor changeSergey Poznyakoff1
2016-02-26Minor fixSergey Poznyakoff1
2016-02-26piesctl: minor formatting changeSergey Poznyakoff1
2016-02-26Improve previous commit.Sergey Poznyakoff1
* comp.c (mark_prog): Instead of calling progman_gc, terminate the prog if it is a deactivated listener.
2016-02-26Fix reconfiguration codeSergey Poznyakoff1
* src/comp.c (component_config_commit): Run progman_gc right after mark stage, to ensure any eventual listener components are properly closed before being reopened by progman_create_sockets
2016-02-26Enable the use of redirectors in init modeSergey Poznyakoff1
2016-02-25Minor fixSergey Poznyakoff1
2016-02-25Implement "telinit environ" ctl commandSergey Poznyakoff5
* src/ctl.c: New endpoint "environ" * src/pies.h (sysvinit_envlocate) (sysvinit_envdelete) (sysvinit_envupdate): New protos. * src/piesctl.c: New subcommand "telinit environ". * src/sysvinit.c (sysvinit_envlocate) (sysvinit_envdelete) (sysvinit_envupdate): New functions. (sysvinit_begin): Create allocated copies of instance and pies_master_argv to avoid them being rewritten by calls to mf_proctitle_format
2016-02-24Improve parsing and handling of stop, start, and restart ctl commands.Sergey Poznyakoff2
* src/ctl.c (pcond_active): New type. (pcond_eval): Handle pcond_active. (pcond_conv): New op: active. (pcond_conv_find): Skip array elements with NULL term value. (object_to_cond): Permit empty argument if no handler function is defined. (fun_stop): Work on all prog types. (fun_start): Work only on components. (fun_restart): Work only on running components. * src/piesctl.c (cmdline_parser_state): New member: command. (pcond_parse_unary): Handle "active" keyword. (parse_condition): Change signature. (parse_condition_to_uri): Likewise. (default_cond): New function, (com_stop, com_start, com_restart): If no arguments supplied, assume default condition "type component". (ctlcom_t): Change signature. All uses changed. (main): Pass a pointer to cmdline_parser_state to the command handler.
2016-02-24Changes in prog structureSergey Poznyakoff6
* src/prog.h (prog): Remove .facility. Use facility from the component. (active,wait,stop): Move from union into the main struct. All uses changed.
2016-02-24Cleanup initialization codeSergey Poznyakoff2
* src/cmdline.opt (parse_options): Change signature. Handle sysvinit case. * src/pies.c (set_conf_file_names): Handle sysvinit case. (main): Move some parts of sysvinit-specific initialization to set_conf_file_names.
2016-02-24Remove spurious informational message on startupSergey Poznyakoff3
2016-02-24Minor stylistic changeSergey Poznyakoff5
2016-02-23BugfixesSergey Poznyakoff4
* lib/addrfmt.c: Include limits.h * src/ctl.c (fun_stop,fun_start): Ignore non-component progs. * src/pies.c (request_restart_components): Fix piesctl invocation. * src/pies.h (PIES_CHLD_RESCHEDULE_ALARM): New flag. (progman_wait_until): Remove. (progman_recompute_alarm): New proto. * src/progman.c (recompute_alarm): Remove. All uses raise PIES_CHLD_RESCHEDULE_ALARM instead. (progman_wake_sleeping): Handle status_stopping components independently on their activity flag. (prog_stop_all, progman_wait_until): Remove. (progman_stop): Rewrite using mark+sweep approach.
2016-02-23Improve loggingSergey Poznyakoff13
* po/POTFILES.in: Add missing source files. * grecs: Upgrade. * src/diag.c (pies_diag_printer): New function. (logfuncall): New function. * src/pies.h: Add new prototypes. * src/pies.c (main): Initialize grecs_print_diag_fun * src/acl.c: Uniformly use double-quotes in messages. Use logfuncall where applicable. * src/comp.c: Likewise. * src/ctl.c: Likewise. * src/inetd-bi.c: Likewise. * src/inetd.c: Likewise. * src/limits.c: Likewise. * src/piesctl.c: Likewise. * src/progman.c: Likewise. * src/socket.c: Likewise. * src/sysvinit.c: Likewise.
2016-02-22Get rid of progman_iterate_compSergey Poznyakoff3
* src/inetd-bi.c (tcpmux): Use component_foreach to handle help requests. * src/progman.c (progman_iterate_comp): Removed. * src/pies.h: Likewise.
2016-02-22Provide a default single-user entry in init modeSergey Poznyakoff3
This complements 6aac230c. The entry is created unless a component for runlevel S already exists. * src/comp.c (component_foreach): New function. * src/pies.h: Likewise. * src/sysvinit.c (inittab_parse): Provide default S entry unless one is already defined.
2016-02-21Fix dereferencing of freed memory.Sergey Poznyakoff2
Improper dereferencing occurred when trying to access master prog of a redirector. * src/prog.h (prog) <r.comp>: New member. * src/progman.c (destroy_prog) <TYPE_COMPONENT>: Clear master pointers in both redirectors. <TYPE_REDIRECTOR>: Check if master is NULL. (register_redir): Initialize r.comp.
2016-02-21Fix memory leaksSergey Poznyakoff1
2016-02-21Fix memory leaks when reconfiguringSergey Poznyakoff2
* grecs: Upgrade. * src/acl.c (_acl_common_section_parser): Free old value. * src/pies.c: Mark statically initialized keywords with GRECS_CONST.
2016-02-21Bugfixes.Sergey Poznyakoff1
* src/pies.c (_cb_command,_cb_env): Free wordsplit struct. (main): Allocate log_tag. Otherwise it might get overwritten by mf_proctitle_format.
2016-02-21Provide fall-back entry in init modeSergey Poznyakoff4
* src/sysvinit.c (inittab_parse): Provide default entry if inittab cannot be read or if it defined no components. * src/comp.c (component_list_is_empty): New function. * src/pies.c (pies_read_config): Always return 0 in init mode. (main): Use LOG_DAEMON in init mode. * src/pies.h (component_list_is_empty): New proto.
2016-02-21BugfixSergey Poznyakoff2
* src/comp.c (component_config_commit): Correctly handle empty list of components.
2016-02-20BugfixSergey Poznyakoff1
* src/pies.c (main): Use pies_master_argv when restarting.
2016-02-20Improve control interfaceSergey Poznyakoff4
This commit implements the following operations on the new /conf endpoints: GET /conf/runtime - List configuration PUT /conf/runtime - Reload configuration POST /conf/runtime - Post new configuration GET /conf/files - List configuration files DELETE /conf/files - Delete some or all configuration files from the list POST /conf/files - Install new configuration file Piesctl supports the following new commands: piesctl config reload piesctl config file clear piesctl config file add SYNTAX NAME piesctl config file del[ete] NAME [NAME...] piesctl config file list * src/ctl.c (res_conf): New function. (restab): New endpoint /conf * src/pies.c (config_file_add): Set free_entry. (config_file_remove, config_file_remove_all) (config_file_list_serialize): New functions. (pies_config_parse): Bail out if tree processing fails. (pies_reload): Remove unused function. (main): Redo ACTION_RELOAD handling. Handle ACTION_COMMIT. * src/pies.h (ACTION_COMMIT): New action. (config_file_remove, config_file_remove_all) (config_file_list_serialize) (pies_read_config, progman_gc): New protos. * src/piesctl.c (cmdline_parser_state): New struct (next_token, peek_token): Take ptr to cmdline_parser_state as argument. (parse_error, require_token, assert_eol) (piesctl_format): New functions. (parse_condition_to_uri): Rewrite using piesctl_format. New subcommand: config. Improve help output.
2016-02-19Revamp program termination after reconfiguring.Sergey Poznyakoff6
* src/pies.h (PIES_CHLD_GC): New op. (progman_stop_tag): Remove proto. * src/pies.c (main): Handle PIES_CHLD_GC: stop all programs marked for termination. * src/comp.c (component_config_commit): Mark leftover components for termination, instead of waiting for them to terminate. * src/sysvinit.c (runlevel_setup_prog): Skip prog if its active status didn't change. Mark inactivated progs for termination. (sysvinit_runlevel_setup): Schedule PIES_CHLD_GC. (inittrans): Don't wait for programs to terminate. That will be done in the main loop. * src/prog.h (prog)<stop>: New boolean member. * src/progman.c (progman_cleanup) (progman_stop_component): Clear the stop flag. (progman_gc): New function. (progman_stop_tag): Remove.
2016-02-18Preserve the order of progs when adding new ones.Sergey Poznyakoff1
* src/progman.c (link_prog): Take a pointer to the reference prog as the second argument. Link the first argument after that reference prog, or at the head of the list if the reference is NULL. (register_prog0): Make sure progs are linked exactly in the same order as the corresponding components. (prog_create_socket): Process only progs with status == status_listener (progman_start): Do the right thing depending on the prog type.
2016-02-18Fix activation/deactivation of network listeners.Sergey Poznyakoff6
* src/ctl.c (prog_active): New function. (prog_serialize): Use prog_active to report prog's activity state. For listener components, return also their service and tcpmux master names, if applicable. (fun_stop): Stop listeners as well. (fun_start): Start listeners. (ctlio_end): Don't close fd: this is done by deregister_socket * src/inetd-bi.c (tcpmux_help): Don't list inactive components. * src/prog.h (prog_activate_listener) (prog_deactivate_listener): New protos. * src/progman.c (prog_lookup_by_tag) (prog_lookup_by_service): Remove. (progman_cleanup): Fix coredump (premature free). (progman_stop_component): If component is a listener, deactivate it. (prog_activate_listener) (prog_deactivate_listener): New functions. * src/socket.c (delete_sockinst): Close the socket descriptor. * src/sysvinit.c (sysvinit_fifo_handler, create_fifo): Don't close fd, leave that to deregister_socket.
2016-02-18Improve loggingSergey Poznyakoff4
* src/diag.c: Rewrite. (vdiagmsg,diagmsg): New functions. * src/pies.c (main): Set DIAG_REOPEN_LOG for init process. * src/pies.h (DIAG_REOPEN_LOG): New flag (DIAG_TO_MASK,DIAG_ALL): New constants. (diagmsg): New proto. * src/sysvinit.c: Add log messages in important transition points (inittrans): Reinitialize logging to syslog upon transition to normal mode.
2016-02-17Fix state transitionsSergey Poznyakoff3
* src/pies.c (main): Move call to pies_schedule_children to inittrans. * src/progman.c (progman_cleanup): Minor change. * src/sysvinit.c (enablecomp): Change prog status to stopped when leaving its runlevel. (sysvinit_set_runlevel): Raise SIGALRM instead of calling inittrans directly. (inittrans): Fix wait logic.
2016-02-16Associate program's activity flag with prog, instead of with component.Sergey Poznyakoff7
The CF_DISABLED flag is still retained to indicate that the component is disabled administratively. * src/prog.h (prog.v.p) <active>: New member. (IS_ACTIVE_COMPONENT): Use active flag. * src/comp.c (component_finish): Don't modify component flags. * src/ctl.c (prog_serialize): Replace attribute "disabled" with "active". (fun_stop): Set prog->v.p.active * src/pies.c (main): Use pies_master_argv to check whether program name is absolute. * src/piesctl.c (print_comp): Check "active" attribute. * src/progman.c (register_prog0): Set prog->v.p.active. (progman_create_sockets): Remove components if their socket cannot be opened. (progman_lookup_tcpmux, prog_open_socket) (prog_start, progman_start) (prog_start_prerequisites, react): Operate on prog->v.p.active to test/change prog's activity state. * src/sysvinit.c (enablecomp, runlevel_setup_prog): Operate on prog->v.p.active to test/change prog's activity state. (demand_prog, IS_RUNNING_DISABLED_PROG): Likewise.
2016-02-15Implement emergency shell.Sergey Poznyakoff4
* src/pies.c (main): Move init-specific command line handling to sysvinit_parse_argv. * src/pies.h (dfl_level): Remove extern. (sysvinit_parse_argv): New proto. * src/sysvinit.c (sysvinit_parse_argv): New function. (sysvinit_begin): Start emergency shell, if requested.
2016-02-14Fix handling of wait componentsSergey Poznyakoff5
* src/pies.h (PIES_COMP_WAIT): Remove. (PIES_COMP_MASK): Save one bit. (PIES_CHLD_NONE, PIES_CHLD_CLEANUP) (PIES_CHLD_WAKEUP): New constants. (pies_schedule_children): New proto. (sysvinit_runlevel_setup): Change signature. * src/pies.c (children_cleanup, got_alarm): Merge into single static variable children_op. All uses updated. (pies_schedule_children): New function. (sig_handler): Update (main): Don't call ctl_open for init process. It is done by inittrans after transition from boot to normal state. Update to use pies_schedule_children. * src/prog.h (IS_ACTIVE_COMPONENT): New macro. * src/progman.c (prog_start): Don't modify prog->v.p.wait. (progman_wake_sleeping): Start usual components only after all "wait" components have terminated. (progman_cleanup): If a "wait" component has terminated, request PIES_CHLD_WAKEUP. * src/sysvinit.c (enstate) <wait>: Remove. (enablecomp): Update. (runlevel_setup_prog): Set prog->v.p.wait. (sysvinit_runlevel_setup): Take only one parameter. (inittrans): Remove "wait" and the related mess. Call ctl_open after transition boot -> normal.

Return to:

Send suggestions and report system problems to the System administrator.