chiark
/
gitweb
/
~ian
/
chiark-utils.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ef5b99a
)
defaultshell feature.
author
ian
<ian>
Sun, 3 Jan 1999 02:40:50 +0000
(
02:40
+0000)
committer
ian
<ian>
Sun, 3 Jan 1999 02:40:50 +0000
(
02:40
+0000)
sync-accounts/sync-accounts
patch
|
blob
|
history
diff --git
a/sync-accounts/sync-accounts
b/sync-accounts/sync-accounts
index 1cbb452ef88b9f614b67a1570b875d2c25b7d2a3..d162c89f8727ec8fcb248246dba6d4f5119605eb 100755
(executable)
--- a/
sync-accounts/sync-accounts
+++ b/
sync-accounts/sync-accounts
@@
-1,5
+1,5
@@
#!/usr/bin/perl
#!/usr/bin/perl
-# $Id: sync-accounts,v 1.1
1 1999-01-03 02:19:27
ian Exp $
+# $Id: sync-accounts,v 1.1
2 1999-01-03 02:40:50
ian Exp $
# usage: sync-accounts [-n] [-C<config-file>] [<host> ...]
# options:
# -n do not really do anything
# usage: sync-accounts [-n] [-C<config-file>] [<host> ...]
# options:
# -n do not really do anything
@@
-98,6
+98,11
@@
# glob-pattern for a particular group takes effect. The default
# is `nogroups *'.
#
# glob-pattern for a particular group takes effect. The default
# is `nogroups *'.
#
+# defaultshell <pathname>
+# 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:
#
# 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';
$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();
$defaultgid= -1; # -1 => usergroups; -2 => nousergroups
@groupglobs= [ '.*', 0 ];
regroupglobs();
@@
-409,7
+415,7
@@
sub syncuser ($$) {
}
@newpwent= ($lu,'x',$useuid,$usegid,$rempasswd{$ru}->[4],
}
@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) {
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,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) {
if (!$nogroups) {
for $e (@owngroup) {
@@
-577,7
+587,7
@@
while (<CF>) {
eval "\$ch_$1= \$2; 1;" or die $@;
} elsif (m/^(lockpasswd|lockgroup)\s+(\S+)$/) {
eval "\$ch_$1= \$2; 1;" or die $@;
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 $@;
eval "\$ch_$1= \$2; 1;" or die $@;
} elsif (m/^(uidmin|uidmax)\s+(\d+)$/ && $2>0) {
eval "\$ch_$1= \$2; 1;" or die $@;