FreeBSD/contrib/subversion/subversion/svnserve/serve.c
/* Authenticate, once the client has chosen a mechanism and possibly
 * sent an initial mechanism token.  On success, set *success to true
 * and b->user to the authenticated username (or NULL for anonymous).
 * On authentication failure, report failure to the client and set
 * *success to FALSE.  On communications failure, return an error.
 * If NEEDS_USERNAME is TRUE, don't allow anonymous authentication. */
Authenticate, once the client has chosen a mechanism and possibly
sent an initial mechanism token.  On success, set *success to true
and b->user to the authenticated username (or NULL for anonymous).
On authentication failure, report failure to the client and set
*success to FALSE.  On communications failure, return an error.
If NEEDS_USERNAME is TRUE, don't allow anonymous authentication.
Authenticate once the client has chosen a mechanism and possibly sent an initial mechanism token . On success set * success to true and b - > user to the authenticated username ( or NULL for anonymous ) . On authentication failure report failure to the client and set * success to FALSE . On communications failure return an error . If NEEDS_USERNAME is TRUE don ' t allow anonymous authentication .
static svn_error_t *auth(svn_ra_svn_conn_t *conn, apr_pool_t *pool,
                         const char *mech, const char *mecharg,
                         server_baton_t *b, enum access_type required,
                         svn_boolean_t needs_username,
                         svn_boolean_t *success)
{
  const char *user;
  *success = FALSE;
  if (b->repository->auth_access >= required
      && b->client_info->tunnel_user && strcmp(mech, "EXTERNAL") == 0)
    {
      if (*mecharg && strcmp(mecharg, b->client_info->tunnel_user) != 0)
        return svn_ra_svn__write_tuple(conn, pool, "w(c)", "failure",
                                       "Requested username does not match");
      b->client_info->user = b->client_info->tunnel_user;
      SVN_ERR(svn_ra_svn__write_tuple(conn, pool, "w()", "success"));
      *success = TRUE;
      return SVN_NO_ERROR;
    }
  if (b->repository->anon_access >= required
      && strcmp(mech, "ANONYMOUS") == 0 && ! needs_username)
    {
      SVN_ERR(svn_ra_svn__write_tuple(conn, pool, "w()", "success"));
      *success = TRUE;
      return SVN_NO_ERROR;
    }
  if (b->repository->auth_access >= required
      && b->repository->pwdb && strcmp(mech, "CRAM-MD5") == 0)
    {
      SVN_ERR(svn_ra_svn_cram_server(conn, pool, b->repository->pwdb,
                                     &user, success));
      b->client_info->user = apr_pstrdup(b->pool, user);
      return SVN_NO_ERROR;
    }
  return svn_ra_svn__write_tuple(conn, pool, "w(c)", "failure",
                                "Must authenticate with listed mechanism");
}
static svn_error_t * auth ( svn_ra_svn_conn_t * conn , apr_pool_t * pool , const char * mech , const char * mecharg , server_baton_t * b , enum access_type required , svn_boolean_t needs_username , svn_boolean_t * success ) { const char * user ; * success = FALSE ; if ( b -> repository -> auth_access >= required && b -> client_info -> tunnel_user && strcmp ( mech , " " ) == 0 ) { if ( * mecharg && strcmp ( mecharg , b -> client_info -> tunnel_user ) != 0 ) return svn_ra_svn__write_tuple ( conn , pool , " " , " " , " " ) ; b -> client_info -> user = b -> client_info -> tunnel_user ; SVN_ERR ( svn_ra_svn__write_tuple ( conn , pool , " " , " " ) ) ; * success = TRUE ; return SVN_NO_ERROR ; } if ( b -> repository -> anon_access >= required && strcmp ( mech , " " ) == 0 && ! needs_username ) { SVN_ERR ( svn_ra_svn__write_tuple ( conn , pool , " " , " " ) ) ; * success = TRUE ; return SVN_NO_ERROR ; } if ( b -> repository -> auth_access >= required && b -> repository -> pwdb && strcmp ( mech , " " ) == 0 ) { SVN_ERR ( svn_ra_svn_cram_server ( conn , pool , b -> repository -> pwdb , & user , success ) ) ; b -> client_info -> user = apr_pstrdup ( b -> pool , user ) ; return SVN_NO_ERROR ; } return svn_ra_svn__write_tuple ( conn , pool , " " , " " , " " ) ; }
Authenticate, once the client has chosen a mechanism and possibly
 sent an initial mechanism token.
Authenticate once the client has chosen a mechanism and possibly sent an initial mechanism token .