From 64b318a561ddc7ac9e73cc18ac5780a7837d7500 Mon Sep 17 00:00:00 2001 From: Raul Miller Date: Sun, 11 Oct 1998 14:54:25 -0400 Subject: [PATCH] Imported Debian patch 2.1-5 --- debian/changelog | 15 +++++++++- debian/control | 2 +- debian/postinst-new | 70 +++++++++++++++++++++++++++++++++++++++++++++ sash.c | 10 ++----- 4 files changed, 87 insertions(+), 10 deletions(-) create mode 100644 debian/postinst-new diff --git a/debian/changelog b/debian/changelog index 8b8a83a..04b06d7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,16 @@ +sash (2.1-5) unstable; urgency=low + + * New maintainer done properly + + -- Raul Miller Sun, 11 Oct 1998 14:54:25 -0400 + +sash (2.1-4) unstable; urgency=low + + * Use $PATH in exec [#25034] + * New maintainer + + -- Raul Miller Thu, 27 Aug 1998 12:19:33 -0400 + sash (2.1-3) frozen unstable; urgency=low * correct root shell if package is removed @@ -58,5 +71,5 @@ sash (1.0-1) unstable; urgency=low Local variables: mode: debian-changelog -add-log-mailing-address: "meskes@debian.org" +add-log-mailing-address: "moth@debian.org" End: diff --git a/debian/control b/debian/control index 431a201..0d52963 100644 --- a/debian/control +++ b/debian/control @@ -1,7 +1,7 @@ Source: sash Section: shells Priority: optional -Maintainer: Michael Meskes +Maintainer: Raul Miller Standards-Version: 2.4.0.0 Package: sash diff --git a/debian/postinst-new b/debian/postinst-new new file mode 100644 index 0000000..ec7aeed --- /dev/null +++ b/debian/postinst-new @@ -0,0 +1,70 @@ +#!/usr/bin/perl +# +# rewritten to favor creation of sashroot over modification of root + +$passwd="*"; +$home= "/root"; +$gid= 0; +$count= 0; +$gcos= ''; +$rootshell= '/bin/sh'; + +sub ask { + my ($prompt)= @_; + $prompt =~/\[(.*?)\]\s*$/; + my @options= split '/', $1; + while (1) { + print $prompt; + my $input= lc substr <>, 0, -1; + for (@options) { + return $input if $input eq lc $_; + return lc $_ if $input eq '' && ! /^[a-z]*$/; + } + my @opts= map {"`\U$_'"} @options; + print "Please answer ".(join ', ', @opts[0..$#opts-1])." or $opts[$#opts].\n"; + } +} + +while (@ent= getpwent) { + my ($Name, $Passwd, $Uid, $Gid, $Quota, $Comment, $Gcos, $Dir, $Shell)= @ent; + next if $Uid; + if ('/bin/sash' eq $Shell) { + if ($Passwd =~/[*]/) { + if ($Passwd eq '*LK*') { # explicitly ignore these entries + exit if $name eq "sashroot"; # presume this is intentional + next; + } + exec "/bin/passwd $Name"; # clean up after premature exit + } + exit; # presume this is intentional + } + $rootshell= $Shell if $Name eq 'root'; # in case we decide to change it + ($name, $passwd, $uid, $gid, $quota, $comment, $gcos, $dir, $shell)= @ent + if $Passwd !~/[*]/; # remember for later + warn "sashroot already exists, but shell is not /bin/sash\n" + if "sashroot" eq $Name; + $count++; +} + +print "The best way to use sash is to install it as a superuser login shell.\n"; +if (0 == $count) { + print "Currently, there is no root login shell!\n" +} elsif (1 == $count) { + print "Currently, ${name}'s login shell is set to $shell.\n" +} else { + print "Currently, there are $count superuser shells. For example,\n"; + print "${name}'s login shell is set to $shell.\n"; +} + +if ('y' eq ask "Shall I make a sashroot account with sash as its login shell? [Y/n] ") { + print "Creating sashroot account for superuser\n"; + exec "adduser --alias --home '$home' --uid 0 --gid '$gid' sashroot"; + die "can't add sashroot alias"; +} + +if ('y' eq ask "Shall I make sash the login shell for root? [y/N] ") { + open ROOTSHELL, ">/var/lib/sash/rootshell" or die "can't register root shell"; + print ROOTSHELL "$rootshell\n" or die "can't register root shell"; + exec 'chsh -s /bin/sash root'; + die "can't change root shell"; +} diff --git a/sash.c b/sash.c index dc13e12..f378c64 100644 --- a/sash.c +++ b/sash.c @@ -806,12 +806,6 @@ do_exec(argc, argv) name = argv[1]; - if (access(name, 4)) { - perror(name); - - return; - } - while (--sourcecount >= 0) { if (sourcefiles[sourcecount] != stdin) fclose(sourcefiles[sourcecount]); @@ -819,8 +813,8 @@ do_exec(argc, argv) argv[argc] = NULL; - execv(name, (char **) argv + 1); - exit(1); + execvp(name, (char **) argv + 1); + perror(name); } -- 2.39.5