[PATCH] Re: Plugable passdb (SAM) modules
Stefan (metze) Metzmacher
metze at metzemix.de
Tue Jan 22 04:14:03 GMT 2002
Re: Plugable passdb (SAM) modules
you wrote:
>The purpose of posting the patch is to get comments: Is this something people
>want, or something that people will object to?
This is what some people want!!
With witch version of samba the patches apply cleanly?
you wrote:
>+/** List of various built-in passdb modules */
>+
>+const struct pdb_init_function builtin_pdb_init_functions[] = {
>+ { "smbpasswd", pdb_init_smbpasswd },
>+ { "tdbsam", pdb_init_tdbsam },
>+#if 0
>+ { "ldap", pdb_init_ldap },
>+ { "nisplus", pdb_init_nisplus },
>+ { "unix", pdb_init_unix },
>+#endif
>+ { NULL, NULL}
>+};
To do builtin modules is quite nice for standart passdb modules, but if
anybody want to use other passdb backends like mysql or other databases, I
thing it's usefull to allow loading of new (extern) modules without
recompile your smbd. They should be load via dlopen(); They have there own
conf-file and there location is spezified by the "passdb module" parameter.
in smb.conf:
passdb backen = extern
passdb module = /usr/local/samba/passdb/pdb_extern.so
this is my approch:
/** List of various built-in passdb modules */
const struct pdb_init_function builtin_pdb_init_functions[] = {
{ "smbpasswd", pdb_init_smbpasswd },
{ "tdbsam", pdb_init_tdbsam },
{ "ldap", pdb_init_ldap },
{ "nisplus", pdb_init_nisplus },
{ "unix", pdb_init_unix },
/* to load an external passdb module via dlopen(), if you use a new module
without recompile your smbd. */
{ "extern", pdb_init_extern },
{ NULL, NULL}
};
NTSTATUS pdb_init_extern(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method)
{
void * dl_handle;
char *dl_error;
NTSTATUS (*extern_init)( PDB_CONTEXT *pdb_context, PDB_METHODS
**pdb_method);
dl_handle = dlopen( lp_passdb_module(), RTLD );
if (!dl_handle) return NT_STATUS_UNSUCCESSFUL;
extern_init = dlsym(dl_handle, "init");
if ((dl_error = dlerror()) != NULL) return NT_STATUS_UNSUCCESSFUL;
return extern_init(pdb_context,pdb_method);
}
MfG
metze
Stefan "metze" Metzmacher <metze at metzemix.de>
More information about the samba-technical
mailing list