X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=blobdiff_plain;f=sync-accounts%2Fsync-accounts;fp=sync-accounts%2Fsync-accounts;h=d162c89f8727ec8fcb248246dba6d4f5119605eb;hb=b2412702b3b7a029dc8b169e1521e3e3810da75d;hp=1cbb452ef88b9f614b67a1570b875d2c25b7d2a3;hpb=ef5b99ae5d00d8695dcaa696101da7a0e7a81103;p=chiark-utils.git diff --git a/sync-accounts/sync-accounts b/sync-accounts/sync-accounts index 1cbb452..d162c89 100755 --- a/sync-accounts/sync-accounts +++ b/sync-accounts/sync-accounts @@ -1,5 +1,5 @@ #!/usr/bin/perl -# $Id: sync-accounts,v 1.11 1999-01-03 02:19:27 ian Exp $ +# $Id: sync-accounts,v 1.12 1999-01-03 02:40:50 ian Exp $ # usage: sync-accounts [-n] [-C] [ ...] # options: # -n do not really do anything @@ -98,6 +98,11 @@ # glob-pattern for a particular group takes effect. The default # is `nogroups *'. # +# defaultshell +# If, when creating an account, the remote account's shell is not +# available on the local system, this value will be used. The +# default is /bin/sh. +# # Some config file directives are per-host, and should appear before # any directives which actually modify accounts: # @@ -161,6 +166,7 @@ use POSIX; $configfile= '/etc/sync-accounts'; $def_createuser= 'sync-accounts-createuser'; $ch_homebase= '/home'; +$ch_defaultshell= '/bin/sh'; $defaultgid= -1; # -1 => usergroups; -2 => nousergroups @groupglobs= [ '.*', 0 ]; regroupglobs(); @@ -409,7 +415,7 @@ sub syncuser ($$) { } @newpwent= ($lu,'x',$useuid,$usegid,$rempasswd{$ru}->[4], - "$ch_homebase/$lu",$rempasswd{$ru}->[6]); + "$ch_homebase/$lu",$ch_defaultshell); defined($c= open CU,"-|") or die $!; if (!$c) { @@ -469,7 +475,11 @@ sub syncuser ($$) { copyfield('passwd',$lu,1, $rempasswd{$ru}->[1]); } copyfield('passwd',$lu,4, $rempasswd{$ru}->[4]); # comment - copyfield('passwd',$lu,6, $rempasswd{$ru}->[6]); # shell + + $newsh= $rempasswd{$ru}->[6]; + $oksh= $checkedshell{$newsh}; + if (!length $oksh) { $checkedshell{$newsh}= $oksh= (-x $newsh) ? 1 : 0; } + copyfield('passwd',$lu,6, $newsh) if $oksh; if (!$nogroups) { for $e (@owngroup) { @@ -577,7 +587,7 @@ while () { eval "\$ch_$1= \$2; 1;" or die $@; } elsif (m/^(lockpasswd|lockgroup)\s+(\S+)$/) { eval "\$ch_$1= \$2; 1;" or die $@; - } elsif (m,^(homebase)\s+(/\S+)$,) { + } elsif (m,^(homebase|defaultshell)\s+(/\S+)$,) { eval "\$ch_$1= \$2; 1;" or die $@; } elsif (m/^(uidmin|uidmax)\s+(\d+)$/ && $2>0) { eval "\$ch_$1= \$2; 1;" or die $@;