httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "karim Bendadda" <kakib...@gmail.com>
Subject Problem with directives
Date Thu, 10 Jan 2008 13:46:49 GMT
Hi All,

I'm creating a custom module wish connects to an Ldap directory (openldap)
and  other operations...

1- I tried to add directives to the module on the httpd.conf file :

*<Location /name_module>
 url http:\\10.114.20.8\myopenldap
 port 389
 baseDn someone
</Location>*


2- in my module I have created a structure:

*typedef struct mod_name{
 apr_pool_t    *mpool;
  const char *url_LDAP;
** int num_port;
 const char *base_dn;
}mod_name_conf;

*3- After I have created the table:

*static const command_rec **name**_cmds[] = {

    AP_INIT_TAKE1("url**", ap_set_string_slot,
                  (void*)APR_OFFSETOF(mod_auth_conf, url_LDAP), OR_ALL,
                  "url of openldap"),

    AP_INIT_TAKE1("port", ap_set_int_slot,
                  (void*)APR_OFFSETOF(mod_auth_conf, num_port), OR_ALL,
                  "port of openldap"),

    AP_INIT_TAKE1("**baseDn**", ap_set_string_slot,
                  (void*)APR_OFFSETOF(mod_auth_conf, base_dn), OR_ALL,
                  "base DN of LDAP"),
    {NULL}
};

*4- then I initialize the configuration

*static void *auth_chorus_conf(apr_pool_t *pool, char *x)
{
    mod_auth_conf *mod_auth_conf_ptr;
    if (mod_auth_conf_ptr=apr_pcalloc(pool, sizeof(mod_auth_conf))){
    mod_auth_conf_ptr->mpool=pool;
    mod_auth_conf_ptr->url=NULL;
    mod_auth_conf_ptr->port=0;
    mod_auth_conf_ptr->baseDn=NULL;
    return mod_auth_conf_ptr;
    }
    else
    return NULL;
}*
*
*5- And finally to call the ldap initialization for example I use:

*ldap_init(mod_auth_conf_ptr->url, mod_auth_conf_ptr->port );

module AP_MODULE_DECLARE_DATA **name_**module = {
    STANDARD20_MODULE_STUFF,
    **name_**conf,
    NULL,
    NULL,
    NULL,
    name_cmds,
    name_hooks
};

*
And it doesn't work!! (it works using the url and the port number without
the directives directly in the module) I have somethig like this when using
apr_perror:

*[Thu Jan 10 10:17:23 2008] [notice] [client 10.75.197.168] url_ldap :
(null) , port : \xc0\x13\xe1\xb7\xc0\x13\xe1\xb7Pw\x18\bPw\x18\b

and finally my question:

*Did I forget something ??
-- 
Karim

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message