head	1.12;
access;
symbols
	netbsd-11-0-RC3:1.12
	netbsd-11-0-RC2:1.12
	netbsd-11-0-RC1:1.12
	perseant-exfatfs-base-20250801:1.12
	netbsd-11:1.12.0.60
	netbsd-11-base:1.12
	netbsd-10-1-RELEASE:1.12
	perseant-exfatfs-base-20240630:1.12
	perseant-exfatfs:1.12.0.58
	perseant-exfatfs-base:1.12
	netbsd-8-3-RELEASE:1.12
	netbsd-9-4-RELEASE:1.12
	netbsd-10-0-RELEASE:1.12
	netbsd-10-0-RC6:1.12
	netbsd-10-0-RC5:1.12
	netbsd-10-0-RC4:1.12
	netbsd-10-0-RC3:1.12
	netbsd-10-0-RC2:1.12
	netbsd-10-0-RC1:1.12
	netbsd-10:1.12.0.56
	netbsd-10-base:1.12
	netbsd-9-3-RELEASE:1.12
	cjep_sun2x-base1:1.12
	cjep_sun2x:1.12.0.54
	cjep_sun2x-base:1.12
	cjep_staticlib_x-base1:1.12
	netbsd-9-2-RELEASE:1.12
	cjep_staticlib_x:1.12.0.52
	cjep_staticlib_x-base:1.12
	netbsd-9-1-RELEASE:1.12
	phil-wifi-20200421:1.12
	phil-wifi-20200411:1.12
	is-mlppp:1.12.0.50
	is-mlppp-base:1.12
	phil-wifi-20200406:1.12
	netbsd-8-2-RELEASE:1.12
	netbsd-9-0-RELEASE:1.12
	netbsd-9-0-RC2:1.12
	netbsd-9-0-RC1:1.12
	phil-wifi-20191119:1.12
	netbsd-9:1.12.0.48
	netbsd-9-base:1.12
	phil-wifi-20190609:1.12
	netbsd-8-1-RELEASE:1.12
	netbsd-8-1-RC1:1.12
	pgoyette-compat-merge-20190127:1.12
	pgoyette-compat-20190127:1.12
	pgoyette-compat-20190118:1.12
	pgoyette-compat-1226:1.12
	pgoyette-compat-1126:1.12
	pgoyette-compat-1020:1.12
	pgoyette-compat-0930:1.12
	pgoyette-compat-0906:1.12
	netbsd-7-2-RELEASE:1.12
	pgoyette-compat-0728:1.12
	netbsd-8-0-RELEASE:1.12
	phil-wifi:1.12.0.46
	phil-wifi-base:1.12
	pgoyette-compat-0625:1.12
	netbsd-8-0-RC2:1.12
	pgoyette-compat-0521:1.12
	pgoyette-compat-0502:1.12
	pgoyette-compat-0422:1.12
	netbsd-8-0-RC1:1.12
	pgoyette-compat-0415:1.12
	pgoyette-compat-0407:1.12
	pgoyette-compat-0330:1.12
	pgoyette-compat-0322:1.12
	pgoyette-compat-0315:1.12
	netbsd-7-1-2-RELEASE:1.12
	pgoyette-compat:1.12.0.44
	pgoyette-compat-base:1.12
	netbsd-7-1-1-RELEASE:1.12
	matt-nb8-mediatek:1.12.0.42
	matt-nb8-mediatek-base:1.12
	perseant-stdc-iso10646:1.12.0.40
	perseant-stdc-iso10646-base:1.12
	netbsd-8:1.12.0.38
	netbsd-8-base:1.12
	prg-localcount2-base3:1.12
	prg-localcount2-base2:1.12
	prg-localcount2-base1:1.12
	prg-localcount2:1.12.0.36
	prg-localcount2-base:1.12
	pgoyette-localcount-20170426:1.12
	bouyer-socketcan-base1:1.12
	pgoyette-localcount-20170320:1.12
	netbsd-7-1:1.12.0.34
	netbsd-7-1-RELEASE:1.12
	netbsd-7-1-RC2:1.12
	netbsd-7-nhusb-base-20170116:1.12
	bouyer-socketcan:1.12.0.32
	bouyer-socketcan-base:1.12
	pgoyette-localcount-20170107:1.12
	netbsd-7-1-RC1:1.12
	pgoyette-localcount-20161104:1.12
	netbsd-7-0-2-RELEASE:1.12
	localcount-20160914:1.12
	netbsd-7-nhusb:1.12.0.30
	netbsd-7-nhusb-base:1.12
	pgoyette-localcount-20160806:1.12
	pgoyette-localcount-20160726:1.12
	pgoyette-localcount:1.12.0.28
	pgoyette-localcount-base:1.12
	netbsd-7-0-1-RELEASE:1.12
	netbsd-7-0:1.12.0.26
	netbsd-7-0-RELEASE:1.12
	netbsd-7-0-RC3:1.12
	netbsd-7-0-RC2:1.12
	netbsd-7-0-RC1:1.12
	netbsd-5-2-3-RELEASE:1.11
	netbsd-5-1-5-RELEASE:1.11
	netbsd-6-0-6-RELEASE:1.12
	netbsd-6-1-5-RELEASE:1.12
	netbsd-7:1.12.0.24
	netbsd-7-base:1.12
	yamt-pagecache-base9:1.12
	yamt-pagecache-tag8:1.12
	netbsd-6-1-4-RELEASE:1.12
	netbsd-6-0-5-RELEASE:1.12
	tls-earlyentropy:1.12.0.22
	tls-earlyentropy-base:1.12
	riastradh-xf86-video-intel-2-7-1-pre-2-21-15:1.12
	riastradh-drm2-base3:1.12
	netbsd-6-1-3-RELEASE:1.12
	netbsd-6-0-4-RELEASE:1.12
	netbsd-5-2-2-RELEASE:1.11
	netbsd-5-1-4-RELEASE:1.11
	netbsd-6-1-2-RELEASE:1.12
	netbsd-6-0-3-RELEASE:1.12
	netbsd-5-2-1-RELEASE:1.11
	netbsd-5-1-3-RELEASE:1.11
	netbsd-6-1-1-RELEASE:1.12
	riastradh-drm2-base2:1.12
	riastradh-drm2-base1:1.12
	riastradh-drm2:1.12.0.16
	riastradh-drm2-base:1.12
	netbsd-6-1:1.12.0.20
	netbsd-6-0-2-RELEASE:1.12
	netbsd-6-1-RELEASE:1.12
	netbsd-6-1-RC4:1.12
	netbsd-6-1-RC3:1.12
	agc-symver:1.12.0.18
	agc-symver-base:1.12
	netbsd-6-1-RC2:1.12
	netbsd-6-1-RC1:1.12
	yamt-pagecache-base8:1.12
	netbsd-5-2:1.11.0.14
	netbsd-6-0-1-RELEASE:1.12
	yamt-pagecache-base7:1.12
	netbsd-5-2-RELEASE:1.11
	netbsd-5-2-RC1:1.11
	matt-nb6-plus-nbase:1.12
	yamt-pagecache-base6:1.12
	netbsd-6-0:1.12.0.14
	netbsd-6-0-RELEASE:1.12
	netbsd-6-0-RC2:1.12
	tls-maxphys:1.12.0.12
	tls-maxphys-base:1.12
	matt-nb6-plus:1.12.0.10
	matt-nb6-plus-base:1.12
	netbsd-6-0-RC1:1.12
	yamt-pagecache-base5:1.12
	yamt-pagecache-base4:1.12
	netbsd-6:1.12.0.8
	netbsd-6-base:1.12
	netbsd-5-1-2-RELEASE:1.11
	netbsd-5-1-1-RELEASE:1.11
	yamt-pagecache-base3:1.12
	yamt-pagecache-base2:1.12
	yamt-pagecache:1.12.0.6
	yamt-pagecache-base:1.12
	cherry-xenmp:1.12.0.4
	cherry-xenmp-base:1.12
	bouyer-quota2-nbase:1.12
	bouyer-quota2:1.12.0.2
	bouyer-quota2-base:1.12
	matt-mips64-premerge-20101231:1.12
	matt-nb5-mips64-premerge-20101231:1.11
	matt-nb5-pq3:1.11.0.12
	matt-nb5-pq3-base:1.11
	netbsd-5-1:1.11.0.10
	netbsd-5-1-RELEASE:1.11
	netbsd-5-1-RC4:1.11
	matt-nb5-mips64-k15:1.11
	netbsd-5-1-RC3:1.11
	netbsd-5-1-RC2:1.11
	netbsd-5-1-RC1:1.11
	netbsd-5-0-2-RELEASE:1.11
	matt-nb5-mips64-premerge-20091211:1.11
	matt-premerge-20091211:1.12
	matt-nb5-mips64-u2-k2-k4-k7-k8-k9:1.11
	matt-nb4-mips64-k7-u2a-k9b:1.11
	matt-nb5-mips64-u1-k1-k5:1.11
	matt-nb5-mips64:1.11.0.8
	netbsd-5-0-1-RELEASE:1.11
	jym-xensuspend-nbase:1.12
	netbsd-5-0:1.11.0.6
	netbsd-5-0-RELEASE:1.11
	netbsd-5-0-RC4:1.11
	netbsd-5-0-RC3:1.11
	netbsd-5-0-RC2:1.11
	jym-xensuspend:1.11.0.4
	jym-xensuspend-base:1.12
	netbsd-5-0-RC1:1.11
	netbsd-5:1.11.0.2
	netbsd-5-base:1.11
	matt-mips64-base2:1.11
	matt-mips64:1.10.0.36
	mjf-devfs2:1.10.0.34
	mjf-devfs2-base:1.10
	netbsd-4-0-1-RELEASE:1.10
	wrstuden-revivesa-base-3:1.10
	wrstuden-revivesa-base-2:1.10
	wrstuden-fixsa-newbase:1.10
	wrstuden-revivesa-base-1:1.10
	yamt-pf42-base4:1.10
	yamt-pf42-base3:1.10
	hpcarm-cleanup-nbase:1.10
	yamt-pf42-baseX:1.10
	yamt-pf42-base2:1.10
	wrstuden-revivesa:1.10.0.32
	wrstuden-revivesa-base:1.10
	yamt-pf42:1.10.0.30
	yamt-pf42-base:1.10
	keiichi-mipv6-nbase:1.10
	keiichi-mipv6:1.10.0.28
	keiichi-mipv6-base:1.10
	matt-armv6-nbase:1.10
	matt-armv6-prevmlocking:1.10
	wrstuden-fixsa-base-1:1.10
	netbsd-4-0:1.10.0.26
	netbsd-4-0-RELEASE:1.10
	cube-autoconf:1.10.0.24
	cube-autoconf-base:1.10
	netbsd-4-0-RC5:1.10
	netbsd-4-0-RC4:1.10
	netbsd-4-0-RC3:1.10
	netbsd-4-0-RC2:1.10
	netbsd-4-0-RC1:1.10
	matt-armv6:1.10.0.22
	matt-armv6-base:1.10
	matt-mips64-base:1.10
	hpcarm-cleanup:1.10.0.20
	hpcarm-cleanup-base:1.10
	netbsd-3-1-1-RELEASE:1.10
	netbsd-3-0-3-RELEASE:1.10
	wrstuden-fixsa:1.10.0.18
	wrstuden-fixsa-base:1.10
	abandoned-netbsd-4-base:1.10
	abandoned-netbsd-4:1.10.0.12
	netbsd-3-1:1.10.0.14
	netbsd-3-1-RELEASE:1.10
	netbsd-3-0-2-RELEASE:1.10
	netbsd-3-1-RC4:1.10
	netbsd-3-1-RC3:1.10
	netbsd-3-1-RC2:1.10
	netbsd-3-1-RC1:1.10
	netbsd-4:1.10.0.16
	netbsd-4-base:1.10
	netbsd-3-0-1-RELEASE:1.10
	netbsd-3-0:1.10.0.10
	netbsd-3-0-RELEASE:1.10
	netbsd-3-0-RC6:1.10
	netbsd-3-0-RC5:1.10
	netbsd-3-0-RC4:1.10
	netbsd-3-0-RC3:1.10
	netbsd-3-0-RC2:1.10
	netbsd-3-0-RC1:1.10
	netbsd-2-0-3-RELEASE:1.10
	netbsd-2-1:1.10.0.8
	netbsd-2-1-RELEASE:1.10
	netbsd-2-1-RC6:1.10
	netbsd-2-1-RC5:1.10
	netbsd-2-1-RC4:1.10
	netbsd-2-1-RC3:1.10
	netbsd-2-1-RC2:1.10
	netbsd-2-1-RC1:1.10
	netbsd-2-0-2-RELEASE:1.10
	netbsd-3:1.10.0.6
	netbsd-3-base:1.10
	netbsd-2-0-1-RELEASE:1.10
	netbsd-2:1.10.0.4
	netbsd-2-base:1.10
	netbsd-2-0-RELEASE:1.10
	netbsd-2-0-RC5:1.10
	netbsd-2-0-RC4:1.10
	netbsd-2-0-RC3:1.10
	netbsd-2-0-RC2:1.10
	netbsd-2-0-RC1:1.10
	netbsd-2-0:1.10.0.2
	netbsd-2-0-base:1.10
	netbsd-1-6-PATCH002-RELEASE:1.8.2.1
	netbsd-1-6-PATCH002:1.8.2.1
	netbsd-1-6-PATCH002-RC4:1.8.2.1
	netbsd-1-6-PATCH002-RC3:1.8.2.1
	netbsd-1-6-PATCH002-RC2:1.8.2.1
	netbsd-1-6-PATCH002-RC1:1.8.2.1
	netbsd-1-6-PATCH001:1.8.2.1
	netbsd-1-6-PATCH001-RELEASE:1.8.2.1
	netbsd-1-6-PATCH001-RC3:1.8.2.1
	netbsd-1-6-PATCH001-RC2:1.8.2.1
	netbsd-1-6-PATCH001-RC1:1.8.2.1
	fvdl_fs64_base:1.10
	netbsd-1-6-RELEASE:1.8.2.1
	netbsd-1-6-RC3:1.8.2.1
	netbsd-1-6-RC2:1.8.2.1
	netbsd-1-6-RC1:1.8.2.1
	netbsd-1-6:1.8.0.2
	netbsd-1-6-base:1.8
	netbsd-1-5-PATCH003:1.6.8.2
	netbsd-1-5-PATCH002:1.6.8.1
	netbsd-1-5-PATCH001:1.6.8.1
	netbsd-1-5-RELEASE:1.6.8.1
	netbsd-1-5-BETA2:1.6.8.1
	netbsd-1-5-BETA:1.6.8.1
	netbsd-1-4-PATCH003:1.6.4.3
	netbsd-1-5-ALPHA2:1.6
	netbsd-1-5:1.6.0.8
	netbsd-1-5-base:1.6
	minoura-xpg4dl-base:1.6
	minoura-xpg4dl:1.6.0.6
	netbsd-1-4-PATCH002:1.6.4.2
	wrstuden-devbsize-base:1.5
	netbsd-1-4:1.6.0.4
	wrstuden-devbsize:1.6.0.2
	wrstuden-devbsize-19991221:1.5;
locks; strict;
comment	@# @;


1.12
date	2009.04.22.15.23.09;	author lukem;	state Exp;
branches;
next	1.11;

1.11
date	2008.10.19.22.05.24;	author apb;	state Exp;
branches
	1.11.4.1;
next	1.10;

1.10
date	2002.07.08.22.17.47;	author agc;	state Exp;
branches;
next	1.9;

1.9
date	2002.06.01.06.28.06;	author grant;	state Exp;
branches;
next	1.8;

1.8
date	2001.10.22.11.00.05;	author agc;	state Exp;
branches
	1.8.2.1;
next	1.7;

1.7
date	2000.10.16.13.46.48;	author simonb;	state Exp;
branches;
next	1.6;

1.6
date	99.12.24.09.08.48;	author agc;	state Exp;
branches
	1.6.2.1
	1.6.4.1
	1.6.8.1;
next	1.5;

1.5
date	99.12.08.00.01.36;	author soren;	state Exp;
branches;
next	1.4;

1.4
date	99.12.06.22.52.18;	author simonb;	state Exp;
branches;
next	1.3;

1.3
date	99.12.06.22.44.47;	author simonb;	state Exp;
branches;
next	1.2;

1.2
date	99.12.06.22.28.12;	author simonb;	state Exp;
branches;
next	1.1;

1.1
date	99.12.06.21.31.42;	author agc;	state Exp;
branches;
next	;

1.11.4.1
date	2009.05.13.19.20.43;	author jym;	state Exp;
branches;
next	;

1.8.2.1
date	2002.06.04.12.10.00;	author lukem;	state Exp;
branches;
next	;

1.6.2.1
date	99.12.24.09.08.48;	author wrstuden;	state dead;
branches;
next	1.6.2.2;

1.6.2.2
date	99.12.27.18.38.16;	author wrstuden;	state Exp;
branches;
next	;

1.6.4.1
date	99.12.24.09.08.48;	author he;	state dead;
branches;
next	1.6.4.2;

1.6.4.2
date	2000.01.20.23.59.44;	author he;	state Exp;
branches;
next	1.6.4.3;

1.6.4.3
date	2000.10.25.17.04.53;	author he;	state Exp;
branches;
next	;

1.6.8.1
date	2000.10.20.17.03.54;	author tv;	state Exp;
branches;
next	1.6.8.2;

1.6.8.2
date	2002.06.26.17.22.26;	author he;	state Exp;
branches;
next	;


desc
@@


1.12
log
@Enable WARNS=4 by default, except for:
	cpuctl  dumplfs  hprop  ipf  iprop-log  kadmin  kcm  kdc  kdigest
	kimpersonate  kstash  ktutil  makefs  ndbootd  ntp  pppd  quot
	racoon  racoonctl  rtadvd  sntp  sup  tcpdchk  tcpdmatch  tcpdump
	traceroute  traceroute6  user  veriexecgen  wsmoused  zic
(Mostly third-party applications)
@
text
@# $NetBSD: Makefile,v 1.11 2008/10/19 22:05:24 apb Exp $
#

WARNS?=	1	# XXX: -Wsign-compare -Wcast-qual

.include <bsd.own.mk>

CPPFLAGS+= -DEXTENSIONS -DPW_MKDB_ARGC=2

PROG= user
SRCS+= user.c main.c
LINKS+=	${BINDIR}/user ${BINDIR}/useradd
LINKS+=	${BINDIR}/user ${BINDIR}/userdel
LINKS+=	${BINDIR}/user ${BINDIR}/usermod
LINKS+=	${BINDIR}/user ${BINDIR}/group
LINKS+=	${BINDIR}/user ${BINDIR}/groupadd
LINKS+=	${BINDIR}/user ${BINDIR}/groupdel
LINKS+=	${BINDIR}/user ${BINDIR}/groupmod
LINKS+=	${BINDIR}/user ${BINDIR}/userinfo
LINKS+=	${BINDIR}/user ${BINDIR}/groupinfo
LDADD+= -lutil 
DPADD+= ${LIBUTIL}
MAN= user.8 useradd.8 userdel.8 usermod.8 userinfo.8 usermgmt.conf.5
MAN+= group.8 groupadd.8 groupdel.8 groupmod.8 groupinfo.8
MLINKS=	useradd.8 adduser.8

# this target checks the built-in default group, and, if it doesn't exist,
# creates it
default-group:
	@@ln -fs ${.OBJDIR}/user ${.OBJDIR}/group;			\
	defgrp=`${.OBJDIR}/user add -D |				\
		${TOOL_AWK} '/^group/ { print $$2 }'`;			\
	if ${.OBJDIR}/group info -e $$defgrp; then			\
		defgid=`${.OBJDIR}/group info $$defgrp |		\
			${TOOL_AWK} '/^gid/ { print $$2 }'`;		\
	else								\
		defgid=99;						\
		while [ $$defgid -gt 0 ]; do				\
			${.OBJDIR}/group info -e $$defgid || break;	\
			defgid=`expr $$defgid - 1`;			\
		done;							\
		if [ $$defgid -eq 0 ]; then				\
			defgid=100;					\
			while [ $$defgid -lt 60000 ]; do		\
				${.OBJDIR}/group info -e $$defgid || break; \
				defgid=`expr $$defgid + 1`;		\
			done;						\
			if [ $$defgid -eq 60000 ]; then			\
				echo "No gids left";			\
				exit 1;					\
			fi;						\
		fi;							\
		${.OBJDIR}/group add -g $$defgid $$defgrp;		\
	fi;								\
	echo "Default group is $$defgrp ($$defgid):";			\
	${.OBJDIR}/group info $$defgrp

.include <bsd.prog.mk>

test: ${PROG}
	@@echo "No news is good news"
	@@echo "1. Adding new user"
	@@rm -f useradd
	@@ln -s user useradd
	-./useradd -m -g=uid test1.1
	@@echo "2. Modifying new user"
	-./${PROG} mod -l test1.2 test1.1
	@@echo "3. Deleting new user"
	-./${PROG} del -r test1.2
	@@echo "4. Attempting to add an invalid user name - IGNORE ANY ERROR"
	-./${PROG} add -m test1%1
	@@echo "5. Bad usage - IGNORE ANY ERROR"
	-./${PROG} add -m
	@@echo "6. Set range defaults"
	-./${PROG} add -D -r4000..6000
	-./${PROG} add -D
	@@echo "7. Get user information"
	-./${PROG} info root
	@@echo "8. Bad user name - IGNORE ANY ERROR"
	-./${PROG} info test1%1 || echo "User not found"
	@@echo "All tests completed"
@


1.11
log
@Use ${TOOL_AWK} instead of ${AWK} or plain "awk" in make commands.
Pass AWK=${TOOL_AWK:Q} to shell scripts that use awk.
@
text
@d1 1
a1 1
# $NetBSD: Makefile,v 1.10 2002/07/08 22:17:47 agc Exp $
d3 3
a8 1
WARNS= 3
@


1.11.4.1
log
@Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
@
text
@d1 1
a1 1
# $NetBSD: Makefile,v 1.12 2009/04/22 15:23:09 lukem Exp $
a2 3

WARNS?=	1	# XXX: -Wsign-compare -Wcast-qual

d6 1
@


1.10
log
@Remove user from supplementary groups when deleting a user and not
preserving information.

Remove BUGS section from userdel(8) accordingly.

Make this utility compile with WARNS=3 - add const-poisoning and
shadow variable name resolution.
@
text
@d1 1
a1 1
# $NetBSD: Makefile,v 1.9 2002/06/01 06:28:06 grant Exp $
d29 2
a30 1
	defgrp=`${.OBJDIR}/user add -D | awk '/^group/ { print $$2 }'`;	\
d32 2
a33 1
		defgid=`${.OBJDIR}/group info $$defgrp | awk '/^gid/ { print $$2 }'`; \
@


1.9
log
@add usermgmt.conf man page.
user -e and -f now accepts "month day year" (ala chpass(1)) and
seconds-since-epoch.
correct man pages accordingly.
@
text
@d1 1
a1 1
# $NetBSD: Makefile,v 1.8 2001/10/22 11:00:05 agc Exp $
d6 1
a6 1
WARNS= 1
@


1.8
log
@+ add backwards compatibility hook for old pw_mkdb() calls with no args

+ remove some unused code in a comment.

+ add F_SHELL flag in userdel

+ use a separate local declaration for a temporary variable, rather
than overloading a variable that's used for something else.
@
text
@d1 1
a1 1
# $NetBSD: Makefile,v 1.7 2000/10/16 13:46:48 simonb Exp $
d21 1
a21 1
MAN= user.8 useradd.8 userdel.8 usermod.8 userinfo.8
@


1.8.2.1
log
@Pull up revision 1.9 (requested by grant in ticket #134):
add usermgmt.conf man page.
user -e and -f now accepts "month day year" (ala chpass(1)) and
seconds-since-epoch.
correct man pages accordingly.
@
text
@d1 1
a1 1
# $NetBSD$
d21 1
a21 1
MAN= user.8 useradd.8 userdel.8 usermod.8 userinfo.8 usermgmt.conf.5
@


1.7
log
@Remove unneeded skel files.

Part of fix for PR bin/10985.
@
text
@d1 1
a1 1
# $NetBSD: Makefile,v 1.6 1999/12/24 09:08:48 agc Exp $
d5 1
a5 1
CPPFLAGS+= -DEXTENSIONS
@


1.6
log
@Add new functionality, and fix some bugs and oversights:

+ Moved all internal definitions from usermgmt.h to user.c
+ Added prototypes to usermgmt.h
+ Allow defaults to be set at build time
+ Check the effective uid is 0 if any data is to be modified
+ Check all numeric uids and gids really are numeric
+ Fix a bug (reported by lenb at sasquatch.com) where new ranges were
appended to old ranges, rather than replacing them
+ Add userinfo(8) and groupinfo(8) utilities (if EXTENSIONS is
defined), whereby user and group information can be displayed.  Add
manual pages for new utilities.  Add front-end calling from user(8)
and group(8) accordingly.
+ Make all functions visible outside the user.c file again.  User and
group manipulation may be split out into a separate shared lib in the
future
+ Split off main function into a separate main.c
+ Changed default group to be "users"
+ Changed despatch table for commands to work in a more sane manner
+ Added "default-group" target to Makefile, so that the default group
can be made easily.
@
text
@d1 1
a1 1
# $NetBSD$
a7 3
SKEL_DIR=	/etc/skel
EXAMPLE_DIR=	${DESTDIR}/usr/share/examples/usermgmt

a23 8

.if ${MKSHARE} != "no"
FILES=			dot.cshrc dot.login dot.profile
FILESNAME_dot.cshrc=	.cshrc
FILESNAME_dot.login=	.login
FILESNAME_dot.profile=	.profile
FILESDIR=		/usr/share/examples/usermgmt
.endif
@


1.6.4.1
log
@file Makefile was added on branch netbsd-1-4 on 2000-01-20 23:59:44 +0000
@
text
@d1 88
@


1.6.4.2
log
@Pull up revisions 1.1-1.6 (new) (requested by agc):
  Add tools to manage users and groups.
@
text
@a0 88
# $NetBSD: Makefile,v 1.6.4.1 2000/01/20 23:59:44 he Exp $
#
.include <bsd.own.mk>

CPPFLAGS+= -DEXTENSIONS
WARNS= 1

SKEL_DIR=	/etc/skel
EXAMPLE_DIR=	${DESTDIR}/usr/share/examples/usermgmt

PROG= user
SRCS+= user.c main.c
LINKS+=	${BINDIR}/user ${BINDIR}/useradd
LINKS+=	${BINDIR}/user ${BINDIR}/userdel
LINKS+=	${BINDIR}/user ${BINDIR}/usermod
LINKS+=	${BINDIR}/user ${BINDIR}/group
LINKS+=	${BINDIR}/user ${BINDIR}/groupadd
LINKS+=	${BINDIR}/user ${BINDIR}/groupdel
LINKS+=	${BINDIR}/user ${BINDIR}/groupmod
LINKS+=	${BINDIR}/user ${BINDIR}/userinfo
LINKS+=	${BINDIR}/user ${BINDIR}/groupinfo
LDADD+= -lutil 
DPADD+= ${LIBUTIL}
MAN= user.8 useradd.8 userdel.8 usermod.8 userinfo.8
MAN+= group.8 groupadd.8 groupdel.8 groupmod.8 groupinfo.8
MLINKS=	useradd.8 adduser.8

.if ${MKSHARE} != "no"
FILES=			dot.cshrc dot.login dot.profile
FILESNAME_dot.cshrc=	.cshrc
FILESNAME_dot.login=	.login
FILESNAME_dot.profile=	.profile
FILESDIR=		/usr/share/examples/usermgmt
.endif

# this target checks the built-in default group, and, if it doesn't exist,
# creates it
default-group:
	@@ln -fs ${.OBJDIR}/user ${.OBJDIR}/group;			\
	defgrp=`${.OBJDIR}/user add -D | awk '/^group/ { print $$2 }'`;	\
	if ${.OBJDIR}/group info -e $$defgrp; then			\
		defgid=`${.OBJDIR}/group info $$defgrp | awk '/^gid/ { print $$2 }'`; \
	else								\
		defgid=99;						\
		while [ $$defgid -gt 0 ]; do				\
			${.OBJDIR}/group info -e $$defgid || break;	\
			defgid=`expr $$defgid - 1`;			\
		done;							\
		if [ $$defgid -eq 0 ]; then				\
			defgid=100;					\
			while [ $$defgid -lt 60000 ]; do		\
				${.OBJDIR}/group info -e $$defgid || break; \
				defgid=`expr $$defgid + 1`;		\
			done;						\
			if [ $$defgid -eq 60000 ]; then			\
				echo "No gids left";			\
				exit 1;					\
			fi;						\
		fi;							\
		${.OBJDIR}/group add -g $$defgid $$defgrp;		\
	fi;								\
	echo "Default group is $$defgrp ($$defgid):";			\
	${.OBJDIR}/group info $$defgrp

.include <bsd.prog.mk>

test: ${PROG}
	@@echo "No news is good news"
	@@echo "1. Adding new user"
	@@rm -f useradd
	@@ln -s user useradd
	-./useradd -m -g=uid test1.1
	@@echo "2. Modifying new user"
	-./${PROG} mod -l test1.2 test1.1
	@@echo "3. Deleting new user"
	-./${PROG} del -r test1.2
	@@echo "4. Attempting to add an invalid user name - IGNORE ANY ERROR"
	-./${PROG} add -m test1%1
	@@echo "5. Bad usage - IGNORE ANY ERROR"
	-./${PROG} add -m
	@@echo "6. Set range defaults"
	-./${PROG} add -D -r4000..6000
	-./${PROG} add -D
	@@echo "7. Get user information"
	-./${PROG} info root
	@@echo "8. Bad user name - IGNORE ANY ERROR"
	-./${PROG} info test1%1 || echo "User not found"
	@@echo "All tests completed"
@


1.6.4.3
log
@Pull up revision 1.7 (requested by simonb):
  Synchronize to current versions of the user management tool.
  Fixes PR#11100, PR#11103, PR#11123 and PR#10985.
@
text
@d1 1
a1 1
# $NetBSD: Makefile,v 1.6.4.2 2000/10/25 17:04:53 he Exp $
d8 3
d28 8
@


1.6.2.1
log
@file Makefile was added on branch wrstuden-devbsize on 1999-12-27 18:38:16 +0000
@
text
@d1 88
@


1.6.2.2
log
@Pull up to last week's -current.
@
text
@a0 45
# $NetBSD: Makefile,v 1.6.2.1 1999/12/27 18:38:16 wrstuden Exp $
#
.include <bsd.own.mk>

CPPFLAGS+= -DEXTENSIONS

SKEL_DIR=	/etc/skel
EXAMPLE_DIR=	${DESTDIR}/usr/share/examples/usermgmt

PROG= user
LINKS+=	${BINDIR}/user ${BINDIR}/useradd
LINKS+=	${BINDIR}/user ${BINDIR}/userdel
LINKS+=	${BINDIR}/user ${BINDIR}/usermod
LINKS+=	${BINDIR}/user ${BINDIR}/group
LINKS+=	${BINDIR}/user ${BINDIR}/groupadd
LINKS+=	${BINDIR}/user ${BINDIR}/groupdel
LINKS+=	${BINDIR}/user ${BINDIR}/groupmod
LDADD+= -lutil 
DPADD+= ${LIBUTIL}
MAN= user.8 useradd.8 userdel.8 usermod.8 group.8 groupadd.8 groupdel.8 groupmod.8
MLINKS=	useradd.8 adduser.8

.if ${MKSHARE} != "no"
FILES=			dot.cshrc dot.login dot.profile
FILESNAME_dot.cshrc=	.cshrc
FILESNAME_dot.login=	.login
FILESNAME_dot.profile=	.profile
FILESDIR=		/usr/share/examples/usermgmt
.endif

.include <bsd.prog.mk>

test: ${PROG}
	@@echo "No news is good news"
	@@echo "1. Adding new user"
	./${PROG} add -m -g=uid test1.1
	@@echo "2. Modifying new user"
	./${PROG} mod -l test1.2 test1.1
	@@echo "3. Deleting new user"
	./${PROG} del -r test1.2
	@@echo "4. Attempting to add an invalid user name - IGNORE ANY ERROR"
	-./${PROG} add -m test1%1
	@@echo "5. Bad usage - IGNORE ANY ERROR"
	-./${PROG} add -m
	@@echo "All tests completed"
@


1.6.8.1
log
@Pullup 1.7 [simonb]:
Use /etc/skel only for skeleton files for useradd.
Fixes PR bin/10985.
@
text
@d1 1
a1 1
# $NetBSD: Makefile,v 1.7 2000/10/16 13:46:48 simonb Exp $
d8 3
d27 8
@


1.6.8.2
log
@Apply patch (requested by grant):
  Synchronize with recent developments:
   o add usermgmt.conf manual page
   o accept "month day year" for -e and -f option arguments of ``user''
   o support multiple uid ranges
   o fix skeleton directory changes
   o improve error handling
   o fix varargs usage
@
text
@d1 1
a1 1
# $NetBSD: Makefile,v 1.6.8.1 2000/10/20 17:03:54 tv Exp $
d21 1
a21 1
MAN= user.8 useradd.8 userdel.8 usermod.8 userinfo.8 usermgmt.conf.5
@


1.5
log
@Add adduser(8) for compatibility.
@
text
@d1 1
a1 1
# $NetBSD: Makefile,v 1.4 1999/12/06 22:52:18 simonb Exp $
d6 1
d12 1
d20 2
d24 2
a25 1
MAN= user.8 useradd.8 userdel.8 usermod.8 group.8 groupadd.8 groupdel.8 groupmod.8
d36 29
d70 3
a72 1
	./${PROG} add -m -g=uid test1.1
d74 1
a74 1
	./${PROG} mod -l test1.2 test1.1
d76 1
a76 1
	./${PROG} del -r test1.2
d81 7
@


1.4
log
@Use FILES= to install example files instead of home-grown install rule.
Fix DPADD usage.
@
text
@d1 1
a1 1
# $NetBSD: Makefile,v 1.3 1999/12/06 22:44:47 simonb Exp $
d21 1
@


1.3
log
@Make ./etc/skel and ./usr/share/examples/usermgmt with mtree, and don't
create the directory in the user(8) Makefile.
@
text
@d1 1
a1 1
# $NetBSD: Makefile,v 1.2 1999/12/06 22:28:12 simonb Exp $
d3 2
a9 2
INSTALL_DATA?= ${INSTALL} ${RENAME} ${PRESERVE} ${COPY} -m 0444

d19 1
a19 1
DPADD+= -lutil
d22 8
a30 10

install: ${PROG}
	${INSTALL_DATA} dot.cshrc ${EXAMPLE_DIR}/.cshrc
	${INSTALL_DATA} dot.login ${EXAMPLE_DIR}/.login
	${INSTALL_DATA} dot.profile ${EXAMPLE_DIR}/.profile
	@@echo "**********************************************************************"
	@@echo "Any files matching ${SKEL_DIR}/.[A-z]* will be copied"
	@@echo "to a new user's home directory."
	@@echo "Example dot files can be found in ${EXAMPLE_DIR}."
	@@echo "**********************************************************************"
@


1.2
log
@Use LINKS+= not LINKS=.
@
text
@d1 1
a1 1
# $NetBSD: Makefile,v 1.1 1999/12/06 21:31:42 agc Exp $
a24 1
	-mkdir -p ${EXAMPLE_DIR}
@


1.1
log
@Add SVR4/Solaris-like useradd/usermod/userdel functionality, and
groupadd/groupmod/groupdel functionality, along with two front-end
utilities, user(8) and group(8).

Based on the addnerd package, but most of the interface has been
completely rewritten, and suggestions from simonb and mrg have been
incorporated.
@
text
@d1 1
a1 1
# $NetBSD$
d11 7
a17 7
LINKS=	${BINDIR}/user ${BINDIR}/useradd
LINKS=	${BINDIR}/user ${BINDIR}/userdel
LINKS=	${BINDIR}/user ${BINDIR}/usermod
LINKS=	${BINDIR}/user ${BINDIR}/group
LINKS=	${BINDIR}/user ${BINDIR}/groupadd
LINKS=	${BINDIR}/user ${BINDIR}/groupdel
LINKS=	${BINDIR}/user ${BINDIR}/groupmod
@
