[PATCH] kdesu on freebsd

Adriaan de Groot adridg at cs.kun.nl
Wed Sep 24 18:53:44 BST 2003


The attached patch (against kdelibs/kdesu in HEAD) tries to fix kdesu on 
FreeBSD and do a little cleanup at the same time.

First off, the problem: kdesu parses su's output and looks for a : in the 
output, assuming that is the : at the end of the password prompt. This fails 
in FreeBSD, where su can output 

	su: you are not in the correct group (wheel) to su root.

It can even just print "su:" and buffer the rest of the error message for the 
next read from the pipe/pty. Ugh.

The result is that lots of kdesu's while(1) loops can hang forever, in 
particular when su dies with an error exit and kdesu doesn't realize it.

The solution (bits): split out some of the wait and check process code into 
separate functions. I've added them to process.h, for want of a better place. 
Since that's a public header file, this may not be a good idea, but doing it 
differently would require adding a file.

kdesu should check that su: is still running when it expects it to. 

In su.{h,cpp}, I've replaced some integer constants by enums, in order to 
create some clarity in the forest of 0,1,2,-2,-1, etc. constants being thrown 
around.

Ugh, I see I've left in debugging statements. Well, consider this a patch for 
review then, and I'll clean it up for commit.





-- 
pub  1024D/FEA2A3FE 2002-06-18 Adriaan de Groot <groot at kde.org>
     Key fingerprint = 934E 31AA 80A7 723F 54F9  50ED 76AC EE01 FEA2 A3FE
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kdesu.diff
Type: text/x-diff
Size: 10153 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20030924/73e58886/attachment.diff>


More information about the kde-core-devel mailing list