<?xml version="1.0" encoding="utf-8" ?>

<rss version="2.0" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/"
   xmlns:content="http://purl.org/rss/1.0/modules/content/"
   >
<channel>
    <title>JasonFried.info - Subversion</title>
    <link>http://jasonfried.info/</link>
    <description>My Technical Life</description>
    <dc:language>en</dc:language>
    <generator>Serendipity 1.5-beta1 - http://www.s9y.org/</generator>
    <pubDate>Wed, 16 Jun 2010 19:13:05 GMT</pubDate>

    <image>
        <url>http://jasonfried.info/templates/square/img/s9y_banner_small.png</url>
        <title>RSS: JasonFried.info - Subversion - My Technical Life</title>
        <link>http://jasonfried.info/</link>
        <width>100</width>
        <height>21</height>
    </image>

<item>
    <title>Active Directory and Subversion - Fixing the case-sensitive username problem </title>
    <link>http://jasonfried.info/archives/2-Active-Directory-and-Subversion-Fixing-the-case-sensitive-username-problem.html</link>
            <category>Perl</category>
            <category>Subversion</category>
    
    <comments>http://jasonfried.info/archives/2-Active-Directory-and-Subversion-Fixing-the-case-sensitive-username-problem.html#comments</comments>
    <wfw:comment>http://jasonfried.info/wfwcomment.php?cid=2</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://jasonfried.info/rss.php?version=2.0&amp;type=comments&amp;cid=2</wfw:commentRss>
    

    <author>nospam@example.com (Jason Fried)</author>
    <content:encoded>
    &lt;p&gt;&lt;img src=&quot;http://jasonfried.info/uploads/journal/svn-square.jpg&quot; border=&quot;0&quot; alt=&quot;svn-square&quot; title=&quot;svn-square&quot; width=&quot;80&quot; height=&quot;80&quot; /&gt;&lt;img src=&quot;http://jasonfried.info/uploads/journal/svn-name-banner.jpg&quot; border=&quot;0&quot; alt=&quot;svn-name-banner&quot; title=&quot;svn-name-banner&quot; width=&quot;320&quot; height=&quot;80&quot; /&gt;&lt;/p&gt;
&lt;p&gt;If you are running Subversion under Apache HTTPD and you are using the basic ldap provider to connect to Active Directory, then you know that Active Directory will let you authenticate using any case as long as the password matches. Normally this would not be a problem, as most of the time people do not add capitalization to their login names. Where this becomes a problem is when your using an &quot;sn authz&quot; file, which is case-sensitive.&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;joe.user = rw&lt;/p&gt;
&lt;p&gt;this will not match if he logs in with &quot;Joe.User&quot;. I became tired of telling people to use only lower-case that I decided to fix the problem for good. I had two possible solutions, patch Subversion or Make a custom authentication provider for Apache. The Apache route sounded easier and not prone to breaking next Subversion update. I already had mod_perl installed so it was quite easy to setup using &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/search.cpan.org/~geoff/Apache-AuthenHook-2.00_04/AuthenHook.pm&#039;);&quot;  href=&quot;http://search.cpan.org/~geoff/Apache-AuthenHook-2.00_04/AuthenHook.pm&quot; target=&quot;_blank&quot; title=&quot;Apache::AuthenHook&quot;&gt;Apache::AuthenHook&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;So first thing you need to do is create a lib folder somewhere to hold your basic provider pm file. I have a pretty organized subversion setup so i just created lib folder in my subversion root.&lt;/p&gt;
&lt;pre&gt;[jfried@svn01]:/&amp;gt; cat /infrastructure/source/lib/Fried/LDAPProvider.pm
package Fried::LDAPProvider;
use Net::LDAP;
use Apache2::RequestRec;
use Apache2::Const -compile =&amp;gt; qw(OK DECLINED HTTP_UNAUTHORIZED);
use strict;

sub handler {
    my ($r, $user, $password) = @_;
    my $ldap = Net::LDAP-&amp;gt;new (&#039;ldaps://DOMAIN&#039;) 
                                       or return Apache2::Const::DECLINED;
    my $mesg = $ldap-&amp;gt;bind(&quot;$user@DOMAIN&quot;, password =&amp;gt; $password );
    $mesg-&amp;gt;code &amp;amp;&amp;amp; return Apache2::Const::DECLINED;
    if ($mesg-&amp;gt;{resultCode} == 0) {
        $r-&amp;gt;user(lc $user);
        return Apache2::Const::OK;
    }
    $ldap-&amp;gt;unbind;

    return Apache2::Const::DECLINED;
}
1;
&lt;/pre&gt;
&lt;p&gt;Just Update DOMAIN with your Active Directory Domain name. The important part that fixes the problem is the $r-&amp;gt;user(lc $user) which tells Apache what the user name should be.&lt;/p&gt;
&lt;p&gt;Now to make Apache make use of this we put the following inside our Apache configuration. Inside your subversion virtual host.&lt;/p&gt;
&lt;pre&gt;PerlSwitches -I/infrastructure/source/lib
PerlLoadModule Apache::AuthenHook

&amp;lt;Location /repos/&amp;gt;
    DAV svn
    SVNParentPath /infrastructure/source/repos
    ...
    AuthType Basic
    AuthBasicProvider Fried::LDAPProvider
    AuthName &quot;Subversion Repositories&quot;
    Require valid-user
    ...
&amp;lt;/Location&amp;gt;
&lt;/pre&gt;
&lt;p&gt;Reload and authz works no mater what case they login with.&lt;/p&gt; 
    </content:encoded>

    <pubDate>Thu, 10 Jun 2010 16:11:44 -0500</pubDate>
    <guid isPermaLink="false">http://jasonfried.info/archives/2-guid.html</guid>
    
</item>
<item>
    <title></title>
    <link>http://jasonfried.info/archives/0-unknown.html</link>
            <category>Code</category>
            <category>Linux</category>
            <category>Networking</category>
            <category>Operating Systems</category>
            <category>Programming Contest</category>
    
    <comments>http://jasonfried.info/archives/0-unknown.html#comments</comments>
    <wfw:comment>http://jasonfried.info/wfwcomment.php?cid=</wfw:comment>

    <slash:comments></slash:comments>
    <wfw:commentRss>http://jasonfried.info/rss.php?version=2.0&amp;type=comments&amp;cid=</wfw:commentRss>
    

    <author>nospam@example.com ()</author>

    <pubDate>Mon, 06 Feb 2012 07:58:23 -0600</pubDate>
    <guid isPermaLink="false">http://jasonfried.info/archives/0-guid.html</guid>
    
</item>

</channel>
</rss>
