X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=blobdiff_plain;f=groupmanage%2Fgroupmanage;h=21a7327c76da7f544ab9daa3aec6cc476c1fd794;hb=564fbf9bcb4ff56ff2fcbc018fd5a85cdfeb4ea2;hp=90957fdd415ced1c7b3eb984bedefcf840873aa0;hpb=2af9fec9f20de481bafa2f03f86dc8421fc0fee2;p=userv-utils.git diff --git a/groupmanage/groupmanage b/groupmanage/groupmanage index 90957fd..21a7327 100755 --- a/groupmanage/groupmanage +++ b/groupmanage/groupmanage @@ -72,6 +72,7 @@ $callinguser= exists $ENV{'USERV_UID'} ? $ENV{'USERV_UID'} : $<; 'gtmp-file','gtmp', 'grouplist-file','grouplist', 'name-regexp','', + 'name-maxlen','8', 'admin-group','', 'finish-command',''); %ovalid= ('user-create','boolean', @@ -84,6 +85,7 @@ $callinguser= exists $ENV{'USERV_UID'} ? $ENV{'USERV_UID'} : $<; 'gtmp-file','string', 'grouplist-file','string', 'name-regexp','string', + 'name-maxlen','number', 'admin-group','string', 'finish-command','string'); @@ -148,7 +150,8 @@ END if ($ARGV[0] eq '--create') { $opt{'user-create'} || !$callinguser || &quit("group creation by users disabled by administrator"); - length($groupname) <= 8 || &quit("group names must be 8 chars or fewer"); + length($groupname) <= $opt{'name-maxlen'} || + &quit("group names must be $opt{'name-maxlen'} chars or fewer"); $!=0; (@pw= getpwuid($callinguser)) || &quit("cannot get your passwd entry: $!"); $createby= $pw[0]; @@ -227,7 +230,7 @@ while (@ARGV) { } elsif (m/^\w[-0-9A-Za-z]*$/) { y/\n//d; $chgu=$_; - getpwnam($chgu) || &quit("username $chgu does not exist"); + defined(getpwnam($chgu)) || &quit("username $chgu does not exist"); eval "\@l = \@$clist; 1" || &quit("internal error: $@"); $already= grep($_ eq $chgu, @l); if ($action eq 'add') {