summaryrefslogtreecommitdiffstats
path: root/source/passdb
diff options
context:
space:
mode:
Diffstat (limited to 'source/passdb')
-rw-r--r--source/passdb/lookup_sid.c24
-rw-r--r--source/passdb/passdb.c2
-rw-r--r--source/passdb/pdb_interface.c23
-rw-r--r--source/passdb/pdb_plugin.c80
4 files changed, 35 insertions, 94 deletions
diff --git a/source/passdb/lookup_sid.c b/source/passdb/lookup_sid.c
index d76cc07ce1e..ca5970875d1 100644
--- a/source/passdb/lookup_sid.c
+++ b/source/passdb/lookup_sid.c
@@ -466,10 +466,10 @@ static BOOL lookup_rids(TALLOC_CTX *mem_ctx, const DOM_SID *domain_sid,
return False;
}
- become_root_uid_only();
+ become_root();
result = pdb_lookup_rids(domain_sid, num_rids, rids,
*names, *types);
- unbecome_root_uid_only();
+ unbecome_root();
return (NT_STATUS_IS_OK(result) ||
NT_STATUS_EQUAL(result, NT_STATUS_NONE_MAPPED) ||
@@ -1128,9 +1128,9 @@ static void legacy_uid_to_sid(DOM_SID *psid, uid_t uid)
ZERO_STRUCTP(psid);
- become_root_uid_only();
+ become_root();
ret = pdb_uid_to_rid(uid, &rid);
- unbecome_root_uid_only();
+ unbecome_root();
if (ret) {
/* This is a mapped user */
@@ -1161,9 +1161,9 @@ static void legacy_gid_to_sid(DOM_SID *psid, gid_t gid)
ZERO_STRUCTP(psid);
- become_root_uid_only();
+ become_root();
ret = pdb_gid_to_sid(gid, psid);
- unbecome_root_uid_only();
+ unbecome_root();
if (ret) {
/* This is a mapped group */
@@ -1201,9 +1201,9 @@ static BOOL legacy_sid_to_uid(const DOM_SID *psid, uid_t *puid)
union unid_t id;
BOOL ret;
- become_root_uid_only();
+ become_root();
ret = pdb_sid_to_id(psid, &id, &type);
- unbecome_root_uid_only();
+ unbecome_root();
if (ret) {
if (type != SID_NAME_USER) {
@@ -1252,9 +1252,9 @@ static BOOL legacy_sid_to_gid(const DOM_SID *psid, gid_t *pgid)
sid_check_is_in_wellknown_domain(psid))) {
BOOL ret;
- become_root_uid_only();
+ become_root();
ret = pdb_getgrsid(&map, *psid);
- unbecome_root_uid_only();
+ unbecome_root();
if (ret) {
*pgid = map.gid;
@@ -1267,9 +1267,9 @@ static BOOL legacy_sid_to_gid(const DOM_SID *psid, gid_t *pgid)
if (sid_peek_check_rid(get_global_sam_sid(), psid, &rid)) {
BOOL ret;
- become_root_uid_only();
+ become_root();
ret = pdb_sid_to_id(psid, &id, &type);
- unbecome_root_uid_only();
+ unbecome_root();
if (ret) {
if ((type != SID_NAME_DOM_GRP) &&
diff --git a/source/passdb/passdb.c b/source/passdb/passdb.c
index d354a485c2d..be5d8e4ca64 100644
--- a/source/passdb/passdb.c
+++ b/source/passdb/passdb.c
@@ -702,7 +702,7 @@ NTSTATUS local_password_change(const char *user_name, int local_flags,
}
/* the 'other' acb bits not being changed here */
- other_acb = (pdb_get_acct_ctrl(sam_pass) & (!(ACB_WSTRUST|ACB_DOMTRUST|ACB_SVRTRUST|ACB_NORMAL)));
+ other_acb = (pdb_get_acct_ctrl(sam_pass) & (~(ACB_WSTRUST|ACB_DOMTRUST|ACB_SVRTRUST|ACB_NORMAL)));
if (local_flags & LOCAL_TRUST_ACCOUNT) {
if (!pdb_set_acct_ctrl(sam_pass, ACB_WSTRUST | other_acb, PDB_CHANGED) ) {
slprintf(err_str, err_str_len - 1, "Failed to set 'trusted workstation account' flags for user %s.\n", user_name);
diff --git a/source/passdb/pdb_interface.c b/source/passdb/pdb_interface.c
index ba251bc4cfb..66eb87752b1 100644
--- a/source/passdb/pdb_interface.c
+++ b/source/passdb/pdb_interface.c
@@ -1287,6 +1287,27 @@ static BOOL pdb_default_sid_to_id(struct pdb_methods *methods,
goto done;
}
+ /* check for "Unix User" */
+
+ if ( sid_peek_check_rid(&global_sid_Unix_Users, sid, &rid) ) {
+ id->uid = rid;
+ *type = SID_NAME_USER;
+ ret = True;
+ goto done;
+ }
+
+ /* check for "Unix User" */
+
+ if ( sid_peek_check_rid(&global_sid_Unix_Groups, sid, &rid) ) {
+ id->gid = rid;
+ *type = SID_NAME_ALIAS;
+ ret = True;
+ goto done;
+ }
+
+
+ /* BUILTIN */
+
if (sid_peek_check_rid(&global_sid_Builtin, sid, &rid)) {
/* Here we only have aliases */
GROUP_MAP map;
@@ -1309,7 +1330,7 @@ static BOOL pdb_default_sid_to_id(struct pdb_methods *methods,
goto done;
}
- DEBUG(5, ("Sid %s is neither ours nor builtin, don't know it\n",
+ DEBUG(5, ("Sid %s is neither ours, a Unix SID, nor builtin\n",
sid_string_static(sid)));
done:
diff --git a/source/passdb/pdb_plugin.c b/source/passdb/pdb_plugin.c
deleted file mode 100644
index 9d835a48ad3..00000000000
--- a/source/passdb/pdb_plugin.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- Loadable passdb module interface.
- Copyright (C) Jelmer Vernooij 2002
- Copyright (C) Andrew Bartlett 2002
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include "includes.h"
-
-#undef DBGC_CLASS
-#define DBGC_CLASS DBGC_PASSDB
-
-NTSTATUS pdb_init_plugin(struct pdb_methods **pdb_method, const char *location)
-{
- void * dl_handle;
- char *plugin_location, *plugin_name, *p;
- pdb_init_function plugin_init;
- int (*plugin_version)(void);
-
- if (location == NULL) {
- DEBUG(0, ("The plugin module needs an argument!\n"));
- return NT_STATUS_UNSUCCESSFUL;
- }
-
- plugin_name = smb_xstrdup(location);
- p = strchr(plugin_name, ':');
- if (p) {
- *p = 0;
- plugin_location = p+1;
- trim_char(plugin_location, ' ', ' ');
- } else {
- plugin_location = NULL;
- }
- trim_char(plugin_name, ' ', ' ');
-
- DEBUG(5, ("Trying to load sam plugin %s\n", plugin_name));
- dl_handle = sys_dlopen(plugin_name, RTLD_NOW );
- if (!dl_handle) {
- DEBUG(0, ("Failed to load sam plugin %s using sys_dlopen (%s)\n", plugin_name, sys_dlerror()));
- return NT_STATUS_UNSUCCESSFUL;
- }
-
- plugin_version = sys_dlsym(dl_handle, "pdb_version");
- if (!plugin_version) {
- sys_dlclose(dl_handle);
- DEBUG(0, ("Failed to find function 'pdb_version' using sys_dlsym in sam plugin %s (%s)\n", plugin_name, sys_dlerror()));
- return NT_STATUS_UNSUCCESSFUL;
- }
-
- if (plugin_version() != PASSDB_INTERFACE_VERSION) {
- sys_dlclose(dl_handle);
- DEBUG(0, ("Wrong PASSDB_INTERFACE_VERSION! sam plugin has version %d and version %d is needed! Please update!\n",
- plugin_version(),PASSDB_INTERFACE_VERSION));
- return NT_STATUS_UNSUCCESSFUL;
- }
-
- plugin_init = sys_dlsym(dl_handle, "pdb_init");
- if (!plugin_init) {
- sys_dlclose(dl_handle);
- DEBUG(0, ("Failed to find function 'pdb_init' using sys_dlsym in sam plugin %s (%s)\n", plugin_name, sys_dlerror()));
- return NT_STATUS_UNSUCCESSFUL;
- }
-
- DEBUG(5, ("Starting sam plugin %s with location %s\n", plugin_name, plugin_location));
- return plugin_init(pdb_method, plugin_location);
-}