Commit Briefs

90fedfb730 Stefan Sperling

add support for backing up and restoring every user's ~/.nshenv (envconf)

Include data from users' ~/.nshenv in show running-config and write-config. Add nshenv and restoreenv commands which handle saving and restoring. These commands are not supposed to be user-facing. Their only purpose is to preserve data during write-config and restore it during nsh -i. During restore we take care not to overwrite existing ~/.nshenv files. The purpose of this feature is to restore ~/.nshenv files which were lost during a disaster. If the user has already saved new settings then we can just leave them as they are.


eb5d12f955 Stefan Sperling

fix sqlite API error handling

- call sqlite3_errmsg(db) before closing the db, not after - sqlite3_errmsg() can only be used when sqlite3_step() returns SQLITE_ERROR - check for errors from sqlite3_finalize() - close db handle even when an error occurred during sqlite3_open() with suggestions from chris testing + ok tom


dd054fead9 Stefan Sperling

Fix dhcpd handling with respect to rdoamins

Run dhcpd in the correct rdomain when rdomain is != 0 and start dhcpd with a list of interfaces on its command line. All interfaces must be in the same rdomain; dhcpd will then set its own rdomain accordingly. Use a separate DHCP lease database per rdomain just in case a given MAC and IP tuple appears in multiple rdomains. earlier version ok + testing by Tom


85c6a75007 Stefan Sperling

allow T_HANDLER to process any number of arguments between 0 and 6

This way we can write handlers that accept all arguments listed in their ctl table as actual arguments, rather than passing unused parameters which contain ununitialized garbage. The benefit is better clarity about the expected values of arguments passed on by handler functions. Adjust motd and crontab handlers accordingly which use T_HANDLER. All instances of call_editor() now use T_HANDLER_FILL1. ok chris


b99c9f3f17 Stefan Sperling

fix conversion of struct ctl2->table to struct ctl->table

The old code would only convert the first command table entry to a dummy struct ctl sitting on the stack. This confuses code which loops over the command table and requires a sentinel to break out of this loop. Segfault found by Tom


51640dae4f Stefan Sperling

detect ambiguous matches from genget on a ctl2 table

Cannot happen right now since the table has only one entry but better be prepared for a future where we would crash otherwise.


8f5b5e45a9 Stefan Sperling

repair "write-config" command which broke with introduction of struct ctl2

Writing any changes to dhcp config was causing "genget internal failure". Regression found by Tom.


0b2393c6d7 Stefan Sperling

always keep basic environment variables intact after 'enable' command

Make nshdoas preserve some important environment variables even when there is no rule in /etc/doas.conf. Without a matching rule in doas.conf we ended up running the privileged shell in an empty environment, which leads to tools such as vi(4) erroring out for lack of a terminal type. As before, the keepenv option in /etc/doas.conf can be used to preserve the entire user environment. We now preserve the following variables by default: DOAS_USER=nsh # added by nshdoas HOME=/root # overridden by nshdoas LOGNAME=root # overridden by nshdoas PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin SHELL=/usr/local/bin/nsh TERM=xterm USER=root # overridden by nshdoas Problem noticed by Tom.


df1b71b4ff Stefan Sperling

introduce struct ctl2 with backwards compat wrappers

The new struct avoids the necessity to cast configuration file test handler arguments from char ** to a char *, such that the char ** pointer can be stored in ctl->args[1]. Such shadowing of variable types results in code that is hard to follow. We can convert daemons one-by-one to fully replace struct ctl eventually. As an example, convert dhcpd handling to struct ctl2 already. Ok tom, chris


e05df6135a GitHub

Merge pull request #143 from smytht/master

Improve Readme by converting to markdown and adding a quick installation guide for nsh


46c96f53cc GitHub

Update README.md use email addresses proper

Update README.md use email addresses proper


5b66ac0b69 Stefan Sperling

backout previous dhcp rdomain commits

I forgot that these diffs only work correctly with the &fillargs patch which has been backed out. This needs more work before it can come back...


00e8db4656 GitHub

Update README.md fix typo

fix typo screen not scree


2d3516ed89 Stefan Sperling

use a separate DHCP lease database per rdomain

ok Tom


58ba5c9058 GitHub

Update README.md fix number formats

Update README.md fix number formats


0698bd5fd3 Stefan Sperling

run dhcpd in the correct rdomain when rdomain is != 0

test + ok Tom


a2ba468c56 GitHub

Update README.md fix typos in and after section 7

Update README.md fix typos in and after section 7


edd6dd9f2f GitHub

Update and rename nsh-openbsd-integration.sh to extensive-nsh-openbsd-integration.sh

Add in extensive warnings to indicate this is a more invasive installation script, (for users who mainly want to manage systems with nsh) (moving config files for import not copying to avoid confusion between which config files are the source of truth, added in a write configuration command at end of nsh configuration to capture the config before reboot.


c64231097b GitHub

Update README.md to include the detail of requirements

Update README.md to include the detail of requirements for nsh to control the system


689678529a GitHub

Update motd to explain how nsh has integrated with OpenBSD

add


740feb0c47 Stefan Sperling

back out "fix bogus pointer being passed to fill_tmpfile() for T_HANDLER_FILL1"

This backs out commit 1bb61b1da84f5690f3125d4f6595b833632622b4: The commit broke configuration file syntax checks. It triggeed errors from exec since we were trying to exec a list of garbage arguments. I misunderstood what the fillargs[1] pointer represents. Even though it is a char * the value stored in case of FILLARGS1 is in fact a char *[].


fda8e7566f GitHub

Create rc.local-nsh-openbsd-integration.sh

rc.local based integration script rc.local-nsh-openbsd-integration.sh


b89991056c GitHub

Update rc.local-nsh-openbsd-integrate.sh

Update script to copy config files not move them so that the user can return to using OpenBSD and standard config more easily.


624653db0d GitHub

Merge pull request #1 from smytht/smytht-README.md

Update and rename README to README.md