static struct pdb_init_function_entry *pdb_find_backend_entry(const char *name);
-NTSTATUS smb_register_passdb(uint16 version, const char *name, pdb_init_function init)
+NTSTATUS smb_register_passdb(int version, const char *name, pdb_init_function init)
{
struct pdb_init_function_entry *entry = backends;
struct pdb_init_function_entry *entry = backends;
while(entry) {
- if (strcasecmp(entry->name, name) == 0) return entry;
+ if (strcmp(entry->name, name)==0) return entry;
entry = entry->next;
}
}
static NTSTATUS context_getgrsid(struct pdb_context *context,
- GROUP_MAP *map, DOM_SID sid, BOOL with_priv)
+ GROUP_MAP *map, DOM_SID sid)
{
NTSTATUS ret = NT_STATUS_UNSUCCESSFUL;
}
curmethods = context->pdb_methods;
while (curmethods){
- ret = curmethods->getgrsid(curmethods, map, sid, with_priv);
+ ret = curmethods->getgrsid(curmethods, map, sid);
if (NT_STATUS_IS_OK(ret)) {
map->methods = curmethods;
return ret;
}
static NTSTATUS context_getgrgid(struct pdb_context *context,
- GROUP_MAP *map, gid_t gid, BOOL with_priv)
+ GROUP_MAP *map, gid_t gid)
{
NTSTATUS ret = NT_STATUS_UNSUCCESSFUL;
}
curmethods = context->pdb_methods;
while (curmethods){
- ret = curmethods->getgrgid(curmethods, map, gid, with_priv);
+ ret = curmethods->getgrgid(curmethods, map, gid);
if (NT_STATUS_IS_OK(ret)) {
map->methods = curmethods;
return ret;
}
static NTSTATUS context_getgrnam(struct pdb_context *context,
- GROUP_MAP *map, char *name, BOOL with_priv)
+ GROUP_MAP *map, const char *name)
{
NTSTATUS ret = NT_STATUS_UNSUCCESSFUL;
}
curmethods = context->pdb_methods;
while (curmethods){
- ret = curmethods->getgrnam(curmethods, map, name, with_priv);
+ ret = curmethods->getgrnam(curmethods, map, name);
if (NT_STATUS_IS_OK(ret)) {
map->methods = curmethods;
return ret;
static NTSTATUS context_enum_group_mapping(struct pdb_context *context,
enum SID_NAME_USE sid_name_use,
GROUP_MAP **rmap, int *num_entries,
- BOOL unix_only, BOOL with_priv)
+ BOOL unix_only)
{
NTSTATUS ret = NT_STATUS_UNSUCCESSFUL;
return context->pdb_methods->enum_group_mapping(context->pdb_methods,
sid_name_use, rmap,
- num_entries, unix_only,
- with_priv);
+ num_entries, unix_only);
}
/******************************************************************
if (p) {
*p = 0;
module_location = p+1;
- trim_string(module_location, " ", " ");
+ trim_char(module_location, ' ', ' ');
}
- trim_string(module_name, " ", " ");
+ trim_char(module_name, ' ', ' ');
DEBUG(5,("Attempting to find an passdb backend to match %s (%s)\n", selected, module_name));
int i = 0;
struct pdb_methods *curmethods, *tmpmethods;
NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
+ BOOL have_guest = False;
if (!NT_STATUS_IS_OK(nt_status = make_pdb_context(context))) {
return nt_status;
}
+ if (!selected) {
+ DEBUG(0, ("ERROR: empty passdb backend list!\n"));
+ return nt_status;
+ }
+
while (selected[i]){
+ if (strcmp(selected[i], "guest") == 0) {
+ have_guest = True;
+ }
/* Try to initialise pdb */
DEBUG(5,("Trying to load: %s\n", selected[i]));
if (!NT_STATUS_IS_OK(nt_status = make_pdb_methods_name(&curmethods, *context, selected[i]))) {
i++;
}
+ if (have_guest)
+ return NT_STATUS_OK;
+
+ if ( (lp_guestaccount() == NULL) ||
+ (*lp_guestaccount() == '\0') ) {
+ /* We explicitly don't want guest access. No idea what
+ else that breaks, but be it that way. */
+ return NT_STATUS_OK;
+ }
+
+ if (!NT_STATUS_IS_OK(nt_status = make_pdb_methods_name(&curmethods,
+ *context,
+ "guest"))) {
+ DEBUG(1, ("Loading guest module failed!\n"));
+ free_pdb_context(context);
+ return nt_status;
+ }
+
+ curmethods->parent = *context;
+ DLIST_ADD_END((*context)->pdb_methods, curmethods, tmpmethods);
+
return NT_STATUS_OK;
}
if ((pdb_context) && (reload)) {
pdb_context->free_fn(&pdb_context);
- if (NT_STATUS_IS_ERR(make_pdb_context_list(&pdb_context, lp_passdb_backend()))) {
+ if (!NT_STATUS_IS_OK(make_pdb_context_list(&pdb_context, lp_passdb_backend()))) {
return NULL;
}
}
if (!pdb_context) {
- if (NT_STATUS_IS_ERR(make_pdb_context_list(&pdb_context, lp_passdb_backend()))) {
+ if (!NT_STATUS_IS_OK(make_pdb_context_list(&pdb_context, lp_passdb_backend()))) {
return NULL;
}
}
return NT_STATUS_IS_OK(pdb_context->pdb_delete_sam_account(pdb_context, sam_acct));
}
-BOOL pdb_getgrsid(GROUP_MAP *map, DOM_SID sid, BOOL with_priv)
+BOOL pdb_getgrsid(GROUP_MAP *map, DOM_SID sid)
{
struct pdb_context *pdb_context = pdb_get_static_context(False);
}
return NT_STATUS_IS_OK(pdb_context->
- pdb_getgrsid(pdb_context, map, sid, with_priv));
+ pdb_getgrsid(pdb_context, map, sid));
}
-BOOL pdb_getgrgid(GROUP_MAP *map, gid_t gid, BOOL with_priv)
+BOOL pdb_getgrgid(GROUP_MAP *map, gid_t gid)
{
struct pdb_context *pdb_context = pdb_get_static_context(False);
}
return NT_STATUS_IS_OK(pdb_context->
- pdb_getgrgid(pdb_context, map, gid, with_priv));
+ pdb_getgrgid(pdb_context, map, gid));
}
-BOOL pdb_getgrnam(GROUP_MAP *map, char *name, BOOL with_priv)
+BOOL pdb_getgrnam(GROUP_MAP *map, char *name)
{
struct pdb_context *pdb_context = pdb_get_static_context(False);
}
return NT_STATUS_IS_OK(pdb_context->
- pdb_getgrnam(pdb_context, map, name, with_priv));
+ pdb_getgrnam(pdb_context, map, name));
}
BOOL pdb_add_group_mapping_entry(GROUP_MAP *map)
}
BOOL pdb_enum_group_mapping(enum SID_NAME_USE sid_name_use, GROUP_MAP **rmap,
- int *num_entries, BOOL unix_only, BOOL with_priv)
+ int *num_entries, BOOL unix_only)
{
struct pdb_context *pdb_context = pdb_get_static_context(False);
return NT_STATUS_IS_OK(pdb_context->
pdb_enum_group_mapping(pdb_context, sid_name_use,
- rmap, num_entries, unix_only,
- with_priv));
+ rmap, num_entries, unix_only));
}
/***************************************************************