[pgpool-general: 6953] Re: Fix-condition-tok-is-always-true
Muhammad Usama
m.usama at gmail.com
Mon Apr 6 18:24:39 JST 2020
Hi
Thanks for catching the mistake and for the patch.
I have committed it to all affected branches.
Cheers
Best regards
Muhammad Usama
On Mon, Apr 6, 2020 at 1:29 PM sherlockcpp <sherlockcpp at foxmail.com> wrote:
> Hello,
>
> In pool_passwd.c:391
> I found the condition “if (tok)” is is always true, Because previous
> condition has already checked that.
>
> the code is as follows (the code following dose not seem to be used now,
> But for security, we'd better fix it)
> ---------------------------------
> 383 /* Get backend user */
> 384 t = getNextToken(t, &tok);
> 385 if (tok)
> 386 {
> 387 /* check if we also have the password */
> 388 char *pwd;
> 389
> 390 t = getNextToken(t, &pwd);
> 391 if (tok)
> 392 {
> 393 pwdMapping->backendUser.password = pwd;
> 394 pwdMapping->backendUser.userName = tok;
> 395 pwdMapping->backendUser.passwordType =
> get_password_type(pwdMapping->backendUser.password);
> 396 pwdMapping->mappedUser = true;
> 397 }
> 398 }
> 399 break;
> ---------------------------------
>
> I think the condition that really need to be checked here is ”if (pwd)“.
>
> Best regards
> _______________________________________________
> pgpool-general mailing list
> pgpool-general at pgpool.net
> http://www.pgpool.net/mailman/listinfo/pgpool-general
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pgpool.net/pipermail/pgpool-general/attachments/20200406/f8aafd8d/attachment.htm>
More information about the pgpool-general
mailing list