NISPLUS/LDAP support should be runtime configureable

Roland Kaltefleiter rk at netuse.de
Mon Oct 15 10:07:15 GMT 2001


Hi !

There is the NIS+ and LDAP support for password etc. in Samba.
One needs to activate that in the 'configure'. But then that binary
is forced to that nameservice. I would be nice, that in case I 
enable NIS+ and/or LDAP, that I can use that option via the smb.conf.
Corrently that does not work, since the code is like this:
passdb/passgrp.c:
....
#ifdef WITH_NISPLUS
  pwgrp_ops =  nisplus_initialise_password_grp();
#elif defined(WITH_LDAP)
  pwgrp_ops = ldap_initialize_password_grp();
#else
  pwgrp_ops = file_initialise_password_grp();
#endif
....

The better way would be to have something like:
static struct enum_list enum_nameservice[] = {
        {NSS_FILES, "FILES"},
        {NSS_LDAP, "LDAP"},
        {NSS_NISPLUS, "NISPLUS"},
        {-1, NULL}
};

in param/loadparm.c,

create the corresponding lp_nameservice()
like:
include/proto.h:
	int lp_nameservice(void);
param/loadparm.c:
	int NameService;
...
	FN_GLOBAL_INTEGER(lp_nameservice, &Globals.NameService)
...
	{"name service", P_ENUM, P_GLOBAL, &Globals.NameService, NULL, enum_nameservice, NSS_FILES},

And in the passwd/* files put some code in like:

if (lp_nameservice() == NSS_NISPLUS) {
  #ifdef WITH_NISPLUS
        pdb_ops =  nisplus_initialize_password_db();
  #else
        DEBUG(0,("No support for nisplus on this system! Using files\n"));
        pdb_ops = file_initialize_password_db();
  #endif
}
else {
  if (lp_nameservice() == NSS_LDAP) {
    #ifdef WITH_LDAP
        pdb_ops =  ldap_initialize_password_db();
    #else
        DEBUG(0,("No support for ldap on this system! Using files\n"));
        pdb_ops = file_initialize_password_db();
    #endif
  }
  else {
    #ifdef WITH_TDBPWD
        pdb_ops =  tdb_initialize_password_db();
    #else
        pdb_ops = file_initialize_password_db();
    #endif
  }



So (if I compile with the --with-nisplus ...) I then can say
in the smb.conf:
	name service = NISPLUS
(or LDAP).
	The default should be files.


I do have patched 2.2.1a and it works, but now 2.2.2 is out and look a little
different. I will have to make my way through that source again.

In case that this extensions are from any interest, contact me
directly, since I may need some support to get that code properly into
the cvs-tree.

Regards, Roland

-- 
Dr. Roland Kaltefleiter
NetUSE AG
Dr.-Hell-Straße 6, D-24107 Kiel, Germany
Fon: +49 431 386435 00   --   Fax: +49 431 386435 99




More information about the samba-technical mailing list