All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jose Celestino <japc@co.sapo.pt>
To: "Mário Gamito" <gamito@gmail.com>
Cc: linux-admin@vger.kernel.org
Subject: Re: MySQL obnoxious question
Date: Tue, 19 Feb 2008 17:44:36 +0000	[thread overview]
Message-ID: <20080219174436.GD4470@co.sapo.pt> (raw)
In-Reply-To: <47BB75CE.7070701@gmail.com>

Words by Mário Gamito [Wed, Feb 20, 2008 at 12:35:26AM +0000]:
> Hi,
>
> Sorry for the little off-topic, but the vpoopmail list is kind of dead.
>

So is the diablo mailing list and I don't see any diablo nntp related
questions here.

> I'm running a qmail server with vpopmail with MySQL authentication.
>
> For obnoxious reasons, I'm running a web site in Windows/ASP.NET/C# that 
> once a user registers, it inserts in the MySQL qmail server the username, 
> password, etc.
>
> It's in the password that the problem lies.
> I need to hash it just before or after the MySQL INSERT statement.
> For that, I have to run a PHP shell script that follows my signature.
>
> Problem is MySQL doesn't run external commands.
>

All that does is generate a random md5 salt and do an md5 crypt of the
password. Why would you want to run that on an external command? I
guess you can easily do it on c#.

>
> <?php
>
> function randltr() {
>  $retval = 'a';
>  $rand = rand() % 64;
>  if ($rand < 26) $retval = $rand + 'a';
>  if ($rand > 25) $retval = $rand - 26 + 'A';
>  if ($rand > 51) $retval = $rand - 52 + '0';
>  if ($rand == 62) $retval = ';';
>  if ($rand == 63) $retval = '.';
>  return($retval);
> }
>
> function mkpasswd3(&$clearpass, &$crypted) {
>  srand ((double)microtime()*1000000);
>
>  $salt = '$1$';
>  for ($i = 0; $i < 5; $i++) $salt .= randltr();
>  $salt .= '0';
>  $crypted = crypt($clearpass, $salt);
>  if (strlen($crypted) > 0) return(true);
>  return(false);
> }
>
> $clearpass = 'yeshua';
> $crypted = '';
>
> if (mkpasswd3($clearpass, $crypted))
>  printf("%s -> %s\n", $clearpass, $crypted);
> else
> echo("Ohoh");
> -

-- 
Jose Celestino
----------------------------------------------------------------
http://www.msversus.org/     ; http://techp.org/petition/show/1
http://www.vinc17.org/noswpat.en.html
----------------------------------------------------------------
"If you would have your slaves remain docile, teach them hymns."
    -- Ed Weathers ("The Empty Box")
-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2008-02-19 17:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-20  0:35 MySQL obnoxious question Mário Gamito
2008-02-19 17:44 ` Jose Celestino [this message]
2008-02-19 22:22   ` Adam T. Bowen
2008-02-20  2:57     ` Atishay
2008-02-19 20:55 ` Jose Celestino
2008-02-19 21:01 ` Adam T. Bowen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080219174436.GD4470@co.sapo.pt \
    --to=japc@co.sapo.pt \
    --cc=gamito@gmail.com \
    --cc=linux-admin@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.