X-Git-Url: https://git.cameronkatri.com/pw-darwin.git/blobdiff_plain/0c9f365da25caa3b04bcfe82b70ee49aab96e619..5f0c96f2a7b918363d6b3e34a1855ddc64f26a41:/pw/pw_conf.c diff --git a/pw/pw_conf.c b/pw/pw_conf.c index 8a0e644..63742a7 100644 --- a/pw/pw_conf.c +++ b/pw/pw_conf.c @@ -22,10 +22,13 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $Id: pw_conf.c,v 1.1.1.2 1996/12/10 23:59:00 joerg Exp $ */ +#ifndef lint +static const char rcsid[] = + "$Id$"; +#endif /* not lint */ + #include #include #include @@ -40,6 +43,7 @@ enum { _UC_DEFAULTPWD, _UC_REUSEUID, _UC_REUSEGID, + _UC_NISPASSWD, _UC_DOTDIR, _UC_NEWMAIL, _UC_LOGFILE, @@ -81,6 +85,7 @@ static struct userconf config = 0, /* Default password for new users? (nologin) */ 0, /* Reuse uids? */ 0, /* Reuse gids? */ + NULL, /* NIS version of the passwd file */ "/usr/share/skel", /* Where to obtain skeleton files */ NULL, /* Mail to send to new accounts */ "/var/log/userlog", /* Where to log changes */ @@ -103,6 +108,7 @@ static char const *comments[_UC_FIELDS] = "\n# Password for new users? no=nologin yes=loginid none=blank random=random\n", "\n# Reuse gaps in uid sequence? (yes or no)\n", "\n# Reuse gaps in gid sequence? (yes or no)\n", + "\n# Path to the NIS passwd file (blank or 'no' for none)\n", "\n# Obtain default dotfiles from this directory\n", "\n# Mail this file to new user (/etc/newuser.msg or no)\n", "\n# Log add/change/remove information in this file\n", @@ -127,6 +133,7 @@ static char const *kwds[] = "defaultpasswd", "reuseuids", "reusegids", + "nispasswd", "skeleton", "newmail", "logfile", @@ -266,6 +273,10 @@ read_userconfig(char const * file) case _UC_REUSEGID: config.reuse_gids = boolean_val(q, 0); break; + case _UC_NISPASSWD: + config.nispasswd = (q == NULL || !boolean_val(q, 1)) + ? NULL : newstr(q); + break; case _UC_DOTDIR: config.dotdir = (q == NULL || !boolean_val(q, 1)) ? NULL : newstr(q); @@ -298,6 +309,7 @@ read_userconfig(char const * file) ? (char *) bourne_shell : newstr(q); break; case _UC_DEFAULTGROUP: + q = unquote(q); config.default_group = (q == NULL || !boolean_val(q, 1) || getgrnam(q) == NULL) ? NULL : newstr(q); break; @@ -384,6 +396,10 @@ write_userconfig(char const * file) case _UC_REUSEGID: val = boolean_str(config.reuse_gids); break; + case _UC_NISPASSWD: + val = config.nispasswd ? config.nispasswd : ""; + quote = 0; + break; case _UC_DOTDIR: val = config.dotdir ? config.dotdir : boolean_str(0); break;