2 # save_group_shadow.cgi
3 # Create, update or delete a group
5 require './nis-lib.pl';
8 ($t, $lnums, $group, $shadow) =
9 &table_edit_setup($in{'table'}, $in{'line'}, '\s+');
11 # Just delete the group
12 &table_delete($t, $lnums);
15 # Validate inputs and save the group
16 &error_setup($text{'group_err'});
17 $in{'name'} =~ /^[^:\s]+$/ || &error($text{'group_ename'});
18 $in{'gid'} =~ /^\d+$/ || &error($text{'group_egid'});
19 $salt = chr(int(rand(26))+65) . chr(int(rand(26))+65);
20 @group = ( $in{'name'}, "x", $in{'gid'},
21 join(",", split(/\s+/, $in{'members'})) );
22 @shadow = ( $in{'name'},
23 $in{'passmode'} == 0 ? "" :
24 $in{'passmode'} == 1 ? $in{'encpass'} :
25 &unix_crypt($in{'pass'}, $salt),
26 "", join(",", split(/\s+/, $in{'members'})) );
27 if ($in{'line'} eq '') {
28 &table_add($t, ":", \@group, \@shadow);
31 &table_update($t, $lnums, ":", \@group, \@shadow);
34 &apply_table_changes() if (!$config{'manual_build'});
35 &redirect("edit_tables.cgi?table=$in{'table'}");