On 08.10.2010 18:27, Andrew Brunner wrote:
I'm needing help to take my Lazarus app, elevate process to root
(using GUI prompt like GKSU) and I want to drop back down to the
user's level after port binding and listening.

Ubuntu has port restrictions for low port numbers.  I'm developing a
platform that happens to use ports for HTTP, XMPP, etc.  Unfortunately
I find myself running Lazarus as root and that is messing up my units
as they are saved.

I need Lazarus to run my app with debugger, and have the desktop
system ask me for my password, attach that elevated id by way of that
security mechanism to my debugged app, so I can execute my Bind and
Listen socket calls, then detach/remove that elevated status to
normal.

Anyone with code to do this very thing?  I this to be cross-platform
so ppl with KDE instead of Gnome need to be considered.
Example Code:
procedure DebugServices;
begin
    ElevateToRootStatus; //<<  Gets Ubuntu to prompt for Desktop system
to elevate CurrentProcess
    StartServices;
    DropRootStatus;
end;

Under normal circumstances I could just launch gksu in front of my
app.  But I'm under Lazarus with debugger so I need this badly.

Developing ElevateToRootStatus and DropRootStatus is totally unknown
how to do this.

Any help would be greatly appreciated.

You might want to try PolicyKit.

Overview: http://www.freedesktop.org/wiki/Software/PolicyKit
Reference: http://hal.freedesktop.org/docs/PolicyKit/

I can't help you with it though, because I didn't have the need to do something like that yet.

Regards,
Sven
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to