[icecast-dev] Client auth with mysql

Mathieu Arnold mat at mat.cc
Fri May 14 22:09:08 PDT 2004



+-Le 14/05/2004 23:10 -0400, Amy Beam a dit :
| I now understand your code much better after taking a day to look at it. I
| am going to try and implement this over the weekend.
| 
| I do have 1 question now that I hope you can point me in the correct
| direction to. Maybe I overlooked it. But where would I determine if I
| should open a new stream when someone logs in with the same user name if
| the user name is already in use? What I am trying to avoid is someone
| passing around the user name/password to all their friends so that
| multiple people can log in with 1 user name. That is what I saw the
| downfall of the flat text file authentication was. Do you handle this?
| Where?

Well, the example select statement is just an example, what you should do
is generate a ticket (based on whatever hash you want) with a timestamp as
a second column, and check in the select statement that the timestamp is
less than say a minute.
It won't help much if users all have the same password but...
Now, you can modify the code to make an update after the select to say
"radio = 1" for instance, then you must do a "radio = 0" when the user
disconnect from the stream (that part I don't know how to do"

| ----- Original Message ----- 
| From: "Mathieu Arnold" <mat at mat.cc>
| To: "Amy Beam" <beamae at email.uc.edu>
| Cc: <icecast-dev at xiph.org>
| Sent: Friday, May 14, 2004 4:37 PM
| Subject: Re: [icecast-dev] Client auth with mysql
| 
| 
|> +-Le 14/05/2004 15:40 -0400, Amy Beam a dit :
|> | Hello Mathieu,
|> | 
|> | This is a great idea! So great that I have been trying to do it for a
|> | while now. However my knowledge of all the ins and outs of Icecast are
|> | lacking. I would love to implement your solution here hopefully you can
|> | answer a few questions for me!
|> | 
|> | 1. What version of Icecast should I make these changes to? It looks
|> | like 2.0.0
|> 
|> Yes, 2.0.0
|> 
|> | 2. Can I see your database schema? What are the tables called, what
| fields
|> | in each table?
|> 
|> Well, you can specify your queries so...
|> 
|> | 3. What happens when User1 is logged in and User2 tries to log in with
|> | User1's information. Does it lock User2 out or does it serve him a
| stream?
|> 
|> Depends on how you do your things.
|> 
|> | 4. Do you have this code already implemented and in a .tar.gz file that
| I
|> | can download?
|> 
|> No, but you can take 2.0.0 sources and apply the patch :-)
|> 
|> | Thank you so much!!
|> | Amy Beam
|> | 
|> | ----- Original Message ----- 
|> | From: "Mathieu Arnold" <mat at mat.cc>
|> | To: <icecast-dev at xiph.org>
|> | SeWednesdaysday, May 12, 2004 1:24 PM
|> | Subject: [icecast-dev] Client auth with mysql
|> | 
|> | 
|> |> Hi,
|> |> 
|> |> I have a customer (a small french music producer) who's putting up a
|> | "paid"
|> |> radio, it's not really paid, because you don't buy an access, you just
| by
|> | a
|> |> cd, and you get radio access.
|> |> So, I needed to check access to the radio, in an intelligent manner
|> |> :-) A collegue of mine started doing things, he ended up with scripts
| adding
|> | ip's
|> |> to the server's firewall...
|> |> 
|> |> I though better of it and I told myself that it should not be that
|> | difficult
|> |> to add mysql support in icecast (no, no, don't run, please).
|> |> 
|> |> So, that's what I did :-)
|> |> <http://mat.cc/distfiles/icecast-mysql.diff>
|> |> 
|> |> it adds some config params to a <mount> section :
|> |> 
|> |> <sql_server>sql-server</sql_server>
|> |> <sql_login>login</sql_login>
|> |> <sql_password>password</sql_password>
|> |> <sql_dbname>database</sql_dbname>
|> |> <sql_field>url-field</sql_field>
|> |> <sql_query>select cle from client where radio = 1 and cle =
|> | '%s'</sql_query>
|> |> 
|> |> which are passed to the source it correspond to.
|> |> 
|> |> and when you call a source say, /foo.mp3?url-field=something
|> |> It'll put the something in the sql query.
|> |> 
|> |> It should be connection loss tolerant, but I'm not sure about it :-)
|> |> 
|> |> For those wanting to try it, you'll have to have mysql/mysql.h in your
|> |> include path, and to add -llibmysqlclient -Lpath to have it compile
|> |> :-) If I had known a bit of autoconf & Co, I'd have added a
|> |> --with-mysql
| with
|> |> proper #ifdef things to comment out my mess, but I don't, if you have
|> |> a
|> | hint
|> |> on that, I'll happily do it :-)
|> |> 
|> |> ps: all and every comment welcome ;-)
|> |> -- 
|> |> Mathieu Arnold
|> |> --- >8 ----
|> |> List archives:  http://www.xiph.org/archives/
|> |> icecast project homepage: http://www.icecast.org/
|> |> To unsubscribe from this list, send a message to
|> | 'icecast-dev-request at xiph.org'
|> |> containing only the word 'unsubscribe' in the body.  No subject is
|> |> needed. Unsubscribe messages sent to the list will be
|> |> ignored/filtered.
|> | 
|> 
|> 
|> 
|> -- 
|> Mathieu Arnold
| 

<p><p>
-- 
Mathieu Arnold
--- >8 ----
List archives:  http://www.xiph.org/archives/
icecast project homepage: http://www.icecast.org/
To unsubscribe from this list, send a message to 'icecast-dev-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.




More information about the Icecast-dev mailing list