<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: How To: Write Custom Basic Authentication Plugin for Squid in Python</title>
	<atom:link href="http://gofedora.com/how-to-write-custom-basic-authentication-plugin-squid-python/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>How Tos, Tutorials, Tips and Tricks</description>
	<lastBuildDate>Wed, 01 Jun 2011 05:17:07 +0530</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: vimal</title>
		<link>http://gofedora.com/how-to-write-custom-basic-authentication-plugin-squid-python/comment-page-1/#comment-287</link>
		<dc:creator>vimal</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://172.17.8.64/gofedora/?p=217#comment-287</guid>
		<description>Hello sir
i have written following script
#!/usr/bin/python
import sys
import socket
import MySQLdb
#db = MySQLdb.connect(host=&quot;localhost&quot;, user=&quot;root&quot;, passwd=&quot;&quot;,db=&quot;squid&quot;)
#cursor = db.cursor()
#b=1
db = MySQLdb.connect(host=&quot;localhost&quot;, user=&quot;root&quot;, passwd=&quot;&quot;,db=&quot;squid&quot;)
cursor = db.cursor()

while True:
        line = sys.stdin.readline()
        line = line.strip()
        username = line[:line.find(&#039; &#039;)]
        password = line[line.find(&#039; &#039;)+1:]
        cursor.execute(&quot;&quot;&quot;select * from squid where uname=%s and pass=%s&quot;&quot;&quot;,(username,password))
        numrows = int(cursor.rowcount)
        if numrows &gt; 0:
                sys.stdout.write(&#039;OK\n&#039;)
        else:
                sys.stdout.write(&#039;ERR\n&#039;)
        sys.stdout.flush()

but it is prompting me for user name and password but it is not authanticating it

please help me
</description>
		<content:encoded><![CDATA[<p>Hello sir<br />
i have written following script<br />
#!/usr/bin/python<br />
import sys<br />
import socket<br />
import MySQLdb<br />
#db = MySQLdb.connect(host=&#8221;localhost&#8221;, user=&#8221;root&#8221;, passwd=&#8221;",db=&#8221;squid&#8221;)<br />
#cursor = db.cursor()<br />
#b=1<br />
db = MySQLdb.connect(host=&#8221;localhost&#8221;, user=&#8221;root&#8221;, passwd=&#8221;",db=&#8221;squid&#8221;)<br />
cursor = db.cursor()</p>
<p>while True:<br />
        line = sys.stdin.readline()<br />
        line = line.strip()<br />
        username = line[:line.find(' ')]<br />
        password = line[line.find(' ')+1:]<br />
        cursor.execute(&#8221;"&#8221;select * from squid where uname=%s and pass=%s&#8221;"&#8221;,(username,password))<br />
        numrows = int(cursor.rowcount)<br />
        if numrows > 0:<br />
                sys.stdout.write(&#8217;OK\n&#8217;)<br />
        else:<br />
                sys.stdout.write(&#8217;ERR\n&#8217;)<br />
        sys.stdout.flush()</p>
<p>but it is prompting me for user name and password but it is not authanticating it</p>
<p>please help me</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kulbirsaini</title>
		<link>http://gofedora.com/how-to-write-custom-basic-authentication-plugin-squid-python/comment-page-1/#comment-288</link>
		<dc:creator>kulbirsaini</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://172.17.8.64/gofedora/?p=217#comment-288</guid>
		<description>I think you have error in the mysql query .. it should be
cursor.execute(&quot;&quot;&quot;select * from squid where uname=&#039;%s&#039; and pass=&#039;%s&#039;&quot;&quot;&quot;,(username,password))
because uname and password are strings ...</description>
		<content:encoded><![CDATA[<p>I think you have error in the mysql query .. it should be<br />
cursor.execute(&#8221;"&#8221;select * from squid where uname=&#8217;%s&#8217; and pass=&#8217;%s&#8217;&#8221;"&#8221;,(username,password))<br />
because uname and password are strings &#8230;</p>
]]></content:encoded>
	</item>
</channel>
</rss>

