Am Samstag 12 Juli 2008 schrieb U Kuehn:
> Hi Martin,
Hi Ulrich,
> Martin Steigerwald wrote:
> > Recently I thought about user scriptlets in hibernate... it would be
> > nice to be able to store scriptlets in ~/.hibernate that do
> > communication with applications that run with the own user.
> >
> > I had this idea first as I got a new USB soundcard which likes
> > unloading of usb sound module so that it resumes nicely. Prior to
> > that I would like to stop Amarok and restart it on resume to avoid
> > any issue with Amarok / xine finding its sound device disappearing
> > suddenly.
>
> There is certainly a point in having a mechanism for this kind of
> flexibility.
>
> > What do you think?
> >
> > I think these should be executed before any system-related
> > scriptlets.
>
> Well, given that the hibernate script runs with root permissions, I
> strongly suggest that before executing a script that any user can fully
> control the hibernate script drops priviledges and regains them later.
>
> To illustrate the issue just think of a non-admin user having a
> scriptlet containing a line like
>
> if ! egrep -q "^myroot" ; then
> echo "myroot:x:0:0:root:/root:/bin/bash" >> /etc/passwd
> # plus something similar for /etc/shadow to insert a passwd
> fi
>
> Then this user would have effectively root rights. Not very desirable.
Certainly. I didn't mention it, I took it for granted that those scripts
are run as the user for whom they are executed. They ideally should also
have only his environment. They should have a valid $DISPLAY set and
maybe one additional variable for the hibernate action that is taking
place:
1) Hibernate: Hibernate is about to create a on disk snapshot
2) Suspend: Hibernate is about to enter suspend to RAM
3) Resume: Hibernate is about to leave suspend or hibernate (should these
be separated?
And maybe whether a failure occured aka action has been aborted by user or
by some script giving back an error.
Just as a rough idea... need to think a bit more about the which actions
such a script need to differentiate... and look into how it is done for
the system wide scriptlets... if they get information about the action
already. Had a quick glance at it, but didn't yet understand how it is
done. The scriptlets only contain functions and I didnot yet found how
hibernate determines which functions are to be called... well need to
have a closer look.
Ciao,
--
Martin 'Helios' Steigerwald - http://www.Lichtvoll.de
GPG: 03B0 0D6C 0040 0710 4AFA B82F 991B EAAC A599 84C7