[PATCH] kdesu for FreeBSD non-wheel users

Dawit A. adawit at kde.org
Thu Nov 13 04:30:04 GMT 2003


On Wednesday 12 November 2003 23:01, Oswald Buddenhagen wrote:
> On Wed, Nov 12, 2003 at 10:45:47PM -0500, Dawit Alemayehu wrote:
> > > Btw, the comment in su.cpp says:
> > > 	// Match "Password: " with the regex ^[^:]+:[\w]*$.
> > >
> > > I actually fail to see how
> > > 	"su: you are not allowed to su root"
> > > would match that.
> >
> > Why would it not ? ? To me the regexp says match anything that starts
> > with one or more characters other than a colon, followed by a colon,
> > followed by zero or more
> >
> > words
>
> word characters
>
> > (letter, number or _)
> >
> > and ending with any character
>
> ???
>
> > including a \n,
>
> i'm not sure about that part and hope it's not; if it is, the regex
> engine can (and must) be taught not to accept a trailing newline.
>
> i think waldo (and quite probably the original author - whoever that
> was) confused \s with \w, unless there was some deeply hidden intention
> i don't see now ...
>
> i don't see a reason to not match colons within the prompt (but there is
> potential that it might actually hurt), so i think the string should
> simply read ":[ \t]*$" (\\s would indeed include \n, i think).

I think you are the one that is confusing things :) There is no way ":[ \t]*$" 
can match "su: you are not allowed to su root" which was what Waldo was 
talking about. Anyways, it does not matter. I just did not understand why 
Waldo thought that "^[^:]+:[\w]*$." would not match.... Oh wait! Maybe the 
"." was just a full stop and not part of the regexp. Never mind then...

-- 
Regards,
Dawit A.
"Preach what you practice, practice what you preach"




More information about the kde-core-devel mailing list