Le Lundi 28 Novembre 2005 21:32, Ola Lundqvist a écrit :
> Hello
>
> On Mon, Nov 28, 2005 at 08:19:23PM +0100, Manu Benoît wrote:
> > Package: wwwconfig-common
> > Version: 0.0.43
> >
> > wwwconfig will not be able to connect to a MySQL server if the root
> > password contains a quote.
> >
> > The problem comes from line 37 in /usr/share/wwwconfig-common/mysql.get :
> >
> >     passopt="--password='$dbadmpass'"
> >
> > It can be fixed by replacing this line with:
> >
> >     passopt="--password='"`echo "$dbadmpass" | sed -e
> > "s/'/'"'"'"'"'"'"'/"`"'"
>
> There are more caracters that are a problem...

Well, as long as they are within single quote, they shouldn't be a problem but 
I could be mistaken.

> I can understand this line in principle but how do this help really?

The original line produces something like --pasword='something' (if the 
password is "something"); therefore, if the password contains quotes, passopt 
will contain --pasword='some'thing', therefore the MySQL command will be 
invalid.

My replacement modifies this in order to produce --pasword='some'"'"'thing'; 
the password is still inside single quotes, except for the quotes themselves.

Now, I just noticed that there's a bug with my fix, I forgot a 'g' at the end 
of the sed command (the current one would only fix the first single quote).

passopt="--password='"`echo "$dbadmpass" | sed -e "s/'/'"'"'"'"'"'"'/g"`"'"

>
> Regards,
>
> // Ola

Best regards,

-- 
*** Manu Benoît (TSeeker) * I sense much beer in you. Beer leads to *
** [EMAIL PROTECTED] *   intoxication, intoxication leads to  **
* OpenPGP key: 0x591BF2C2 * hangover. Hangover leads to sobering. ***

Reply via email to