1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-10 12:58:35 +03:00

- Get rid of module_path_get_name()

- Use find backend function to find duplicates
- declare static function before using it
This commit is contained in:
Jelmer Vernooij -
parent 871cad7e9a
commit ad5ebd4f20

View File

@ -34,6 +34,8 @@ static void lazy_initialize_passdb(void)
initialized = True; initialized = True;
} }
static struct pdb_init_function_entry *pdb_find_backend_entry(const char *name);
BOOL smb_register_passdb(const char *name, pdb_init_function init, int version) BOOL smb_register_passdb(const char *name, pdb_init_function init, int version)
{ {
struct pdb_init_function_entry *entry = backends; struct pdb_init_function_entry *entry = backends;
@ -43,13 +45,9 @@ BOOL smb_register_passdb(const char *name, pdb_init_function init, int version)
DEBUG(5,("Attempting to register passdb backend %s\n", name)); DEBUG(5,("Attempting to register passdb backend %s\n", name));
/* Check for duplicates */ if (pdb_find_backend_entry(name)) {
while(entry) { DEBUG(0,("There already is a passdb backend registered with the name %s!\n", name));
if(strcasecmp(name, entry->name) == 0) { return False;
DEBUG(0,("There already is a passdb backend registered with the name %s!\n", name));
return False;
}
entry = entry->next;
} }
entry = smb_xmalloc(sizeof(struct pdb_init_function_entry)); entry = smb_xmalloc(sizeof(struct pdb_init_function_entry));
@ -64,12 +62,9 @@ BOOL smb_register_passdb(const char *name, pdb_init_function init, int version)
static struct pdb_init_function_entry *pdb_find_backend_entry(const char *name) static struct pdb_init_function_entry *pdb_find_backend_entry(const char *name)
{ {
struct pdb_init_function_entry *entry = backends; struct pdb_init_function_entry *entry = backends;
pstring stripped;
module_path_get_name(name, stripped);
while(entry) { while(entry) {
if (strequal(entry->name, stripped)) return entry; if (strcasecmp(entry->name, name) == 0) return entry;
entry = entry->next; entry = entry->next;
} }