title: Authenticate remote user on linux with username/password credentials
body: <p>I'm planning a REST service for my own shutter control solution in a new house. The service should run on a linux server, and as this is something that really should be available, I want to do it without any runtime dependencies except the OS itself and very few standard libraries. So I'd prefer to do it in <a href="/questions/tagged/c" class="post-tag" title="show questions tagged &#39;c&#39;" rel="tag">c</a>.</p>
  
  <p>So far, I found <a href="http://wolkykim.github.io/libasyncd/" rel="nofollow">libasyncd</a> which should give me a nice HTTPS host to work with. My concern now is how to handle authentication. For simplicity, <em>HTTP basic auth</em> should do, but I'd like to authenticate against my system user store (which is an OpenLDAP directory at the moment). Ideally, I'd like to have a solution that abstracts from this store.</p>
  
  <p>I first thought <a href="/questions/tagged/pam" class="post-tag" title="show questions tagged &#39;pam&#39;" rel="tag">pam</a> might be the way to go, but all examples I could find so far let <a href="/questions/tagged/pam" class="post-tag" title="show questions tagged &#39;pam&#39;" rel="tag">pam</a> do the password prompt and what I need instead is a function that takes username and password and tells me authenticated or not. Is this even possible with <a href="/questions/tagged/pam" class="post-tag" title="show questions tagged &#39;pam&#39;" rel="tag">pam</a>? If so, where should I look for documentation? If not, could you suggest any alternatives?</p>