From eac937b0d88583754b197e49eb1ead3c2122237b Mon Sep 17 00:00:00 2001 From: Paul Traina Date: Sat, 5 Jul 1997 19:12:45 +0000 Subject: Remove addgroup/rmgroup -- they are completely replaced by pw(1). Adduser/rmuser stay for now until we get a good user-friendly front-end for pw. --- adduser/Makefile | 6 +- adduser/addgroup.8 | 85 ----------------------- adduser/addgroup.tcl | 191 --------------------------------------------------- adduser/rmgroup.8 | 54 --------------- adduser/rmgroup.sh | 29 -------- 5 files changed, 3 insertions(+), 362 deletions(-) delete mode 100644 adduser/addgroup.8 delete mode 100644 adduser/addgroup.tcl delete mode 100644 adduser/rmgroup.8 delete mode 100644 adduser/rmgroup.sh diff --git a/adduser/Makefile b/adduser/Makefile index 044e6cb..c7908c9 100644 --- a/adduser/Makefile +++ b/adduser/Makefile @@ -1,7 +1,7 @@ -# $Id$ +# $Id: Makefile,v 1.11 1997/02/22 16:01:14 peter Exp $ -SCRIPTS= adduser.perl rmuser.perl addgroup.tcl rmgroup.sh -MAN8= adduser.8 rmuser.8 addgroup.8 rmgroup.8 +SCRIPTS= adduser.perl rmuser.perl +MAN8= adduser.8 rmuser.8 beforeinstall: .for script in ${SCRIPTS} diff --git a/adduser/addgroup.8 b/adduser/addgroup.8 deleted file mode 100644 index a114ddb..0000000 --- a/adduser/addgroup.8 +++ /dev/null @@ -1,85 +0,0 @@ -.\" Copyright (c) 1996 Wolfram Schneider . Berlin. -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" 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: addgroup.8,v 1.5 1997/02/22 16:01:15 peter Exp $ - -.Dd October 30, 1996 -.Dt ADDGROUP 8 -.Os FreeBSD 2.2 -.Sh NAME -.Nm addgroup -.Nd add a group or add users to a group -.Sh SYNOPSIS -.Nm -.Op Fl g Ar gid -.Ar group -.Op Ar user Ns , Ns Ar user,... -.Sh DESCRIPTION -The -.Nm -command adds a group to the -.Xr group 5 -database. -The optional -.Ar user -is added to the group membership list. -The -.Ar user -argument may be a comma separated list of user names. -If -.Ar group -already exists -.Nm -add -.Ar user -to the -.Ar group . -.Sh OPTIONS -.Bl -tag -width Ds -.It Sy -g gid -Create new group with group id -.Ar gid -if possible or the next higher id that is available. Default gid is 1000. -This option only applies to new groups. -.El -.Sh EXAMPLES -.Pp -$ addgroup -g 5000 cracau -.Pp -Add group `cracau' with group identification 5000 or higher. -.Pp -$ addgroup foo blech,bar -.Pp -Add user `blech' and user `bar' to group `foo'. Create group -`foo' if it does not exist. -.Sh SEE ALSO -.Xr group 5 , -.Xr adduser 8 , -.Xr rmgroup 8 , -.Xr rmuser 8 -.Sh HISTORY -The -.Nm -command appeared in -.Fx 2.2 . diff --git a/adduser/addgroup.tcl b/adduser/addgroup.tcl deleted file mode 100644 index 25aeab6..0000000 --- a/adduser/addgroup.tcl +++ /dev/null @@ -1,191 +0,0 @@ -#!/usr/bin/tclsh -# Copyright (c) 1996 Wolfram Schneider . Berlin. -# All rights reserved. -# -# addgroup - add a group or add users to a group -# -# addgroup [-g gid] group [user[,user,...]] -# -# -# addgroup -g 2000 foobar -# -# Add group `foobar' to group database. Group id is 2000 if -# possible or higher. Don't add group `foobar' if `foobar' is -# already in group database. -# -# -# addgroup foo blech,bar -# -# Add user `blech' and user `bar' to group `foo'. Create group -# `foo' with default gid if not exists. -# -# -# The option [-g gid] is only for new groups. -# -# see group(5) -# -# TODO: -# file locking -# signal handling -# add only users who exist -# -# $Id$ - -# set global variables -set etc_group "/etc/group"; #set etc_group "/usr/tmp/group" -set gid_start 1000 -set gid_max 65500 - -proc putsErr {string} { - if {[catch {open "/dev/stderr" w} stderr]} { - puts $stderr - } else { - puts $stderr $string - close $stderr - } -} - -proc usage {} { - putsErr {usage: addgroup group [user]} - putsErr { addgroup [-g gid] group [user[,user,...]]} - exit 1 -} - -# check double user names: foo,bla,foo -proc double_name {groupmembers} { - set l [split $groupmembers ","] - if {[llength $l] > 1} { - for {set i 0} {$i < [llength $l]} {incr i} { - if {[lsearch [lrange $l [expr $i + 1] end] \ - [lindex $l $i]] != -1} { - putsErr "Double user name: [lindex $l $i]" - return 1 - } - } - } - return 0 -} - -# cleanup and die -proc Err {string} { - upvar etc_group_new new - putsErr "$string" - exec rm -f $new - exit 1 -} - -if {$argc < 1} { usage } - -# check options -switch -glob -- [lindex $argv 0] { - -g* { - if {$argc < 2} { - putsErr "Missing group id" - usage - } - set g [lindex $argv 1] - if {$g < 100 || $g >= $gid_max} { - putsErr "Group id out of range 100 < $g < $gid_max" - usage - } - set gid_start $g - incr argc -2 - set argv [lrange $argv 2 end] - } - -* { usage } -} - -if {$argc < 1} { usage } - -# read group name -set groupname [lindex $argv 0] -if {[string match "*:*" $groupname] != 0} { - putsErr "Colon are not allowed in group name: ``$groupname''" - usage -} - -# read optional group members -if {$argc == 2} { - set groupmembers [lindex $argv 1] - if {[string match "*:*" $groupmembers] != 0} { - putsErr "Colon are not allowed in user names: ``$groupmembers''" - usage - } - if {[double_name $groupmembers] != 0} { - usage - } -} else { - set groupmembers "" -} - - -# open /etc/group database -if {[catch {open $etc_group r} db]} { - Err $db -} - -# open temporary database -set etc_group_new "$etc_group.new"; -if {[catch {open $etc_group_new w} db_new]} { - Err $db_new -} -set done 0 - -while {[gets $db line] >= 0 } { - if {$done > 0} { - puts $db_new $line - continue - } - - # ``group:passwd:gid:member'' - # 0 1 2 3 - set l [split $line ":"] - set group([lindex $l 0]) [lindex $l 2] - set gid([lindex $l 2]) [lindex $l 0] - set member([lindex $l 0]) [lindex $l 3] - - # found existing group - if {[string compare [lindex $l 0] $groupname] == 0} { - if {[string compare $groupmembers ""] == 0} { - Err "Group exists: ``$groupname''" - } - - # add new group members - set y [lindex $l 3] - - # group with no group members? - if {[string compare $y ""] == 0} { - puts $db_new "$line$groupmembers" - } else { - if {[double_name "$y,$groupmembers"] != 0} { - Err "\t$line,$groupmembers" - } else { - puts $db_new "$line,$groupmembers" - } - } - set done 1 - } else { - puts $db_new $line - } -} - -# add a new group -if {$done == 0} { - for {set i $gid_start} {$i < $gid_max} {incr i} { - if {[info exists gid($i)] == 0} { - puts $db_new "$groupname:*:$i:$groupmembers" - set done 1 - break - } - } - - # no free group id - if {$done == 0} { - Err "Cannot find free group id: ``$groupname''" - } -} - -close $db_new -close $db -exec cp -pf $etc_group "$etc_group.bak" -exec mv -f $etc_group_new $etc_group diff --git a/adduser/rmgroup.8 b/adduser/rmgroup.8 deleted file mode 100644 index 9d622d0..0000000 --- a/adduser/rmgroup.8 +++ /dev/null @@ -1,54 +0,0 @@ -.\" Copyright (c) 1996 Wolfram Schneider . Berlin. -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" 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: rmgroup.8,v 1.5 1997/02/22 16:01:19 peter Exp $ - -.Dd October 30, 1996 -.Dt RMGROUP 8 -.Os FreeBSD 2.2 -.Sh NAME -.Nm rmgroup -.Nd delete a Unix group -.Sh SYNOPSIS -.Nm -.Ar group -.Sh DESCRIPTION -.Nm -delete a Unix group from the -.Xr group 5 -database. -.Nm -will not delete the system groups wheel, daemon, kmem, sys, tty, -operator, bin, nogroup, nobody, -or groups with gid 0. -.Sh SEE ALSO -.Xr group 5 , -.Xr addgroup 8 , -.Xr adduser 8 , -.Xr rmuser 8 -.Sh HISTORY -The -.Nm -command appeared in -.Fx 2.2 . diff --git a/adduser/rmgroup.sh b/adduser/rmgroup.sh deleted file mode 100644 index 41303f2..0000000 --- a/adduser/rmgroup.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh -# Copyright (c) 1996 Wolfram Schneider . Berlin. -# All rights reserved. -# -# rmgroup - delete a Unix group -# -# $Id$ - -PATH=/bin:/usr/bin; export PATH -db=/etc/group - -case "$1" in - ""|-*) echo "usage: rmgroup group"; exit 1;; - wheel|daemon|kmem|sys|tty|operator|bin|nogroup|nobody) - echo "Do not remove system group: $1"; exit 2;; - *) group="$1";; -esac - -if egrep -q -- "^$group:" $db; then - if egrep -q -- "^$group:\*:0:" $db; then - echo "Do not remove group with gid 0: $group" - exit 2 - fi - egrep -v -- "^$group:" $db > $db.new && - cp -pf $db $db.bak && - mv -f $db.new $db -else - echo "Group \"$group\" does not exists in $db."; exit 1 -fi -- cgit v1.2.3-56-ge451