* 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[] =
+ "$FreeBSD$";
+#endif /* not lint */
+
#include <string.h>
#include <ctype.h>
#include <fcntl.h>
#include "pw.h"
-#include "pwupd.h"
#define debugging 0
_UC_DEFAULTPWD,
_UC_REUSEUID,
_UC_REUSEGID,
+ _UC_NISPASSWD,
_UC_DOTDIR,
_UC_NEWMAIL,
_UC_LOGFILE,
static char *system_shells[_UC_MAXSHELLS] =
{
bourne_shell,
- "csh"
+ "csh",
+ "tcsh"
};
static char const *booltrue[] =
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 */
1000, 32000, /* Allowed range of uids */
1000, 32000, /* Allowed range of gids */
0, /* Days until account expires */
- 0 /* Days until password expires */
+ 0, /* Days until password expires */
+ 0 /* size of default_group array */
};
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",
"\n# Root directory in which $HOME directory is created\n",
"\n# Colon separated list of directories containing valid shells\n",
- "\n# Space separated list of available shells (without paths)\n",
+ "\n# Comma separated list of available shells (without paths)\n",
"\n# Default shell (without path)\n",
"\n# Default group (leave blank for new group per user)\n",
"\n# Extra groups for new users\n",
"defaultpasswd",
"reuseuids",
"reusegids",
+ "nispasswd",
"skeleton",
"newmail",
"logfile",
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);
? (char *) bourne_shell : newstr(q);
break;
case _UC_DEFAULTGROUP:
- config.default_group = (q == NULL || !boolean_val(q, 1) || getgrnam(q) == NULL)
+ q = unquote(q);
+ config.default_group = (q == NULL || !boolean_val(q, 1) || GETGRNAM(q) == NULL)
? NULL : newstr(q);
break;
case _UC_EXTRAGROUPS:
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;
for (j = k = 0; j < _UC_MAXSHELLS && system_shells[j] != NULL; j++) {
char lbuf[64];
int l = snprintf(lbuf, sizeof lbuf, "%s\"%s\"", k ? "," : "", system_shells[j]);
+ if (l < 0)
+ l = 0;
if (l + k + 1 < len || extendline(&buf, &len, len + LNBUFSZ) != -1) {
strcpy(buf + k, lbuf);
k += l;
for (j = k = 0; j < config.numgroups && config.groups[j] != NULL; j++) {
char lbuf[64];
int l = snprintf(lbuf, sizeof lbuf, "%s\"%s\"", k ? "," : "", config.groups[j]);
+ if (l < 0)
+ l = 0;
if (l + k + 1 < len || extendline(&buf, &len, len + 1024) != -1) {
strcpy(buf + k, lbuf);
k += l;