Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Dec 2002 03:38:28 +0300
From:      "Vadim A. Shklyaev" <lexxmail@front.ru>
To:        freebsd-net@freebsd.org
Cc:        Archie Cobbs <archie@dellroad.org>
Subject:   mpd-3.10 and MySQL
Message-ID:  <1031006789359.20021224033828@front.ru>

next in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
Hi,

  Some time back we have faced necessity of mass
  authorization of our VPN-clients which were connected to our server
  using mpd, through a MySQL-database. Thus I have made patch for
  mpd-3.10 for the built-in support mysql authorizations.

  May be code is not very clean and well styled, but it works! It
  works on our servers for about 3 or 4 weeks without problems, so I
  decided to send it here, to hear what guru thinks about that, and
  also someone else can will find this thing useful to itself.

  Patch adds 5 new configuration directives:

  mysql_hostname defines a host, where mysqld is running

set bundle mysql_hostname localhost

  mysql_database defines a database to use

set bundle mysql_database users

  mysql_username and mysql_password defines a mysql user and
  password with enough privileges to make sql request, specified in mysql_sql

set bundle mysql_username someuser
set bundle mysql_password somepassword

  and mysql_sql defines an sql expression, which will be passed to
  mysql server to get credential for login, which is substituted
  instead of "%s". Expression should return one row with three fields:
  login, password and optionaly ip address (or NULL or empty string),
  just like a format for mpd.secret

set bundle mysql_sql "SELECT login, password, INET_NTOA(ip) FROM users WHERE login='%s' AND active=1 LIMIT 1"

  MySQL authentification is used when all these directives
  are defines, if one of them is missing - usual mpd.secret is used.

  That's all. I wait with impatience for comments.
  
-- 
Best regards,
 Vadim A. Shklyaev
 mailto:lexxmail@front.ru
[-- Attachment #2 --]
Ӧ>[SH__уMqSgojƢb eHIf	mU(v~u})sZ9ZRIJfo^(֫7"mKe^ވZC[UDZ{"ƵmT͟mR	](0a0P~@rIMYlVHc
T\kJTuTʠi;
?N{qهGٱ ,t/SȠԶgr.2
Mea~VS9ӈȃC,P*JR s4
yUu)F"5칇3TDѱB#
kʡHE?f
Vx@5
Q|
BMnf
˫!RpK=ڰTslFY63(Uwtq^z(TYYETAAIO`-&@!(!O#M)D<T!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