summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2007-05-11 08:46:54 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:21:57 -0500
commit9e30a76c04d0da0bc14f7a0605db7ad51e5cfcd9 (patch)
tree06a301eb2d06b77577d9e2ccd4bf1c565f21cb8d
parent2383ffce6993a70abffcbabdf2e6ebb0d8ccd756 (diff)
downloadsamba-9e30a76c04d0da0bc14f7a0605db7ad51e5cfcd9.tar.gz
samba-9e30a76c04d0da0bc14f7a0605db7ad51e5cfcd9.tar.bz2
samba-9e30a76c04d0da0bc14f7a0605db7ad51e5cfcd9.zip
r22786: Some cleanup by Karolin Seeger: Remove unused pdb_find_alias, and change
return values of some alias-releated pdb functions from BOOL to NTSTATUS Thanks :-) (This used to be commit 590d2164b3a33250410338771e160f6ebd1aa89d)
-rw-r--r--source3/groupdb/mapping.c16
-rw-r--r--source3/include/passdb.h3
-rw-r--r--source3/passdb/pdb_interface.c20
-rw-r--r--source3/rpc_server/srv_samr_nt.c33
-rw-r--r--source3/utils/net_sam.c15
5 files changed, 29 insertions, 58 deletions
diff --git a/source3/groupdb/mapping.c b/source3/groupdb/mapping.c
index 46e27d4de6..a27aa30014 100644
--- a/source3/groupdb/mapping.c
+++ b/source3/groupdb/mapping.c
@@ -416,22 +416,6 @@ NTSTATUS pdb_default_enum_group_mapping(struct pdb_methods *methods,
NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL;
}
-NTSTATUS pdb_default_find_alias(struct pdb_methods *methods,
- const char *name, DOM_SID *sid)
-{
- GROUP_MAP map;
-
- if (!pdb_getgrnam(&map, name))
- return NT_STATUS_NO_SUCH_ALIAS;
-
- if ((map.sid_name_use != SID_NAME_WKN_GRP) &&
- (map.sid_name_use != SID_NAME_ALIAS))
- return NT_STATUS_OBJECT_TYPE_MISMATCH;
-
- sid_copy(sid, &map.sid);
- return NT_STATUS_OK;
-}
-
NTSTATUS pdb_default_create_alias(struct pdb_methods *methods,
const char *name, uint32 *rid)
{
diff --git a/source3/include/passdb.h b/source3/include/passdb.h
index cd80cd9fab..3604458b5a 100644
--- a/source3/include/passdb.h
+++ b/source3/include/passdb.h
@@ -328,9 +328,6 @@ struct pdb_methods
TALLOC_CTX *mem_ctx,
uint32 group_rid, uint32 member_rid);
- NTSTATUS (*find_alias)(struct pdb_methods *methods,
- const char *name, DOM_SID *sid);
-
NTSTATUS (*create_alias)(struct pdb_methods *methods,
const char *name, uint32 *rid);
diff --git a/source3/passdb/pdb_interface.c b/source3/passdb/pdb_interface.c
index 387e3fecde..819e98b38b 100644
--- a/source3/passdb/pdb_interface.c
+++ b/source3/passdb/pdb_interface.c
@@ -904,35 +904,28 @@ NTSTATUS pdb_del_groupmem(TALLOC_CTX *mem_ctx, uint32 group_rid,
return pdb->del_groupmem(pdb, mem_ctx, group_rid, member_rid);
}
-BOOL pdb_find_alias(const char *name, DOM_SID *sid)
-{
- struct pdb_methods *pdb = pdb_get_methods();
- return NT_STATUS_IS_OK(pdb->find_alias(pdb, name, sid));
-}
-
NTSTATUS pdb_create_alias(const char *name, uint32 *rid)
{
struct pdb_methods *pdb = pdb_get_methods();
return pdb->create_alias(pdb, name, rid);
}
-BOOL pdb_delete_alias(const DOM_SID *sid)
+NTSTATUS pdb_delete_alias(const DOM_SID *sid)
{
struct pdb_methods *pdb = pdb_get_methods();
- return NT_STATUS_IS_OK(pdb->delete_alias(pdb, sid));
-
+ return pdb->delete_alias(pdb, sid);
}
-BOOL pdb_get_aliasinfo(const DOM_SID *sid, struct acct_info *info)
+NTSTATUS pdb_get_aliasinfo(const DOM_SID *sid, struct acct_info *info)
{
struct pdb_methods *pdb = pdb_get_methods();
- return NT_STATUS_IS_OK(pdb->get_aliasinfo(pdb, sid, info));
+ return pdb->get_aliasinfo(pdb, sid, info);
}
-BOOL pdb_set_aliasinfo(const DOM_SID *sid, struct acct_info *info)
+NTSTATUS pdb_set_aliasinfo(const DOM_SID *sid, struct acct_info *info)
{
struct pdb_methods *pdb = pdb_get_methods();
- return NT_STATUS_IS_OK(pdb->set_aliasinfo(pdb, sid, info));
+ return pdb->set_aliasinfo(pdb, sid, info);
}
NTSTATUS pdb_add_aliasmem(const DOM_SID *alias, const DOM_SID *member)
@@ -2160,7 +2153,6 @@ NTSTATUS make_pdb_method( struct pdb_methods **methods )
(*methods)->set_unix_primary_group = pdb_default_set_unix_primary_group;
(*methods)->add_groupmem = pdb_default_add_groupmem;
(*methods)->del_groupmem = pdb_default_del_groupmem;
- (*methods)->find_alias = pdb_default_find_alias;
(*methods)->create_alias = pdb_default_create_alias;
(*methods)->delete_alias = pdb_default_delete_alias;
(*methods)->get_aliasinfo = pdb_default_get_aliasinfo;
diff --git a/source3/rpc_server/srv_samr_nt.c b/source3/rpc_server/srv_samr_nt.c
index 1b9a8c375b..b392f289a8 100644
--- a/source3/rpc_server/srv_samr_nt.c
+++ b/source3/rpc_server/srv_samr_nt.c
@@ -1354,7 +1354,7 @@ NTSTATUS _samr_query_aliasinfo(pipes_struct *p, SAMR_Q_QUERY_ALIASINFO *q_u, SAM
DOM_SID sid;
struct acct_info info;
uint32 acc_granted;
- BOOL ret;
+ NTSTATUS status;
r_u->status = NT_STATUS_OK;
@@ -1368,11 +1368,11 @@ NTSTATUS _samr_query_aliasinfo(pipes_struct *p, SAMR_Q_QUERY_ALIASINFO *q_u, SAM
}
become_root();
- ret = pdb_get_aliasinfo(&sid, &info);
+ status = pdb_get_aliasinfo(&sid, &info);
unbecome_root();
- if ( !ret )
- return NT_STATUS_NO_SUCH_ALIAS;
+ if ( !NT_STATUS_IS_OK(status))
+ return status;
if ( !(r_u->ctr = TALLOC_ZERO_P( p->mem_ctx, ALIAS_INFO_CTR )) )
return NT_STATUS_NO_MEMORY;
@@ -4301,7 +4301,7 @@ NTSTATUS _samr_delete_dom_alias(pipes_struct *p, SAMR_Q_DELETE_DOM_ALIAS *q_u, S
uint32 acc_granted;
SE_PRIV se_rights;
BOOL can_add_accounts;
- BOOL ret;
+ NTSTATUS status;
DISP_INFO *disp_info = NULL;
DEBUG(5, ("_samr_delete_dom_alias: %d\n", __LINE__));
@@ -4340,15 +4340,15 @@ NTSTATUS _samr_delete_dom_alias(pipes_struct *p, SAMR_Q_DELETE_DOM_ALIAS *q_u, S
become_root();
/* Have passdb delete the alias */
- ret = pdb_delete_alias(&alias_sid);
+ status = pdb_delete_alias(&alias_sid);
if ( can_add_accounts )
unbecome_root();
/******** END SeAddUsers BLOCK *********/
- if ( !ret )
- return NT_STATUS_ACCESS_DENIED;
+ if ( !NT_STATUS_IS_OK(status))
+ return status;
if (!close_policy_hnd(p, &q_u->alias_pol))
return NT_STATUS_OBJECT_NAME_INVALID;
@@ -4693,8 +4693,8 @@ NTSTATUS _samr_set_aliasinfo(pipes_struct *p, SAMR_Q_SET_ALIASINFO *q_u, SAMR_R_
struct acct_info info;
ALIAS_INFO_CTR *ctr;
uint32 acc_granted;
- BOOL ret;
BOOL can_mod_accounts;
+ NTSTATUS status;
DISP_INFO *disp_info = NULL;
if (!get_lsa_policy_samr_sid(p, &q_u->alias_pol, &group_sid, &acc_granted, &disp_info))
@@ -4709,18 +4709,16 @@ NTSTATUS _samr_set_aliasinfo(pipes_struct *p, SAMR_Q_SET_ALIASINFO *q_u, SAMR_R_
/* get the current group information */
become_root();
- ret = pdb_get_aliasinfo( &group_sid, &info );
+ status = pdb_get_aliasinfo( &group_sid, &info );
unbecome_root();
- if ( !ret ) {
- return NT_STATUS_NO_SUCH_ALIAS;
- }
+ if ( !NT_STATUS_IS_OK(status))
+ return status;
switch (ctr->level) {
case 2:
{
fstring group_name, acct_name;
- NTSTATUS status;
/* We currently do not support renaming groups in the
the BUILTIN domain. Refer to util_builtin.c to understand
@@ -4776,18 +4774,17 @@ NTSTATUS _samr_set_aliasinfo(pipes_struct *p, SAMR_Q_SET_ALIASINFO *q_u, SAMR_R_
if ( can_mod_accounts )
become_root();
- ret = pdb_set_aliasinfo( &group_sid, &info );
+ status = pdb_set_aliasinfo( &group_sid, &info );
if ( can_mod_accounts )
unbecome_root();
/******** End SeAddUsers BLOCK *********/
- if (ret) {
+ if (NT_STATUS_IS_OK(status))
force_flush_samr_cache(disp_info);
- }
- return ret ? NT_STATUS_OK : NT_STATUS_ACCESS_DENIED;
+ return status;
}
/*********************************************************************
diff --git a/source3/utils/net_sam.c b/source3/utils/net_sam.c
index 4d3102b51f..06fc73da4b 100644
--- a/source3/utils/net_sam.c
+++ b/source3/utils/net_sam.c
@@ -580,7 +580,7 @@ static int net_sam_deletelocalgroup(int argc, const char **argv)
DOM_SID sid;
enum lsa_SidType type;
const char *dom, *name;
- int ret;
+ NTSTATUS status;
if (argc != 1) {
d_fprintf(stderr, "usage: net sam deletelocalgroup <name>\n");
@@ -589,7 +589,7 @@ static int net_sam_deletelocalgroup(int argc, const char **argv)
if (!lookup_name(tmp_talloc_ctx(), argv[0], LOOKUP_NAME_ISOLATED,
&dom, &name, &sid, &type)) {
- d_fprintf(stderr, "Could not find name %s.\n", argv[0]);
+ d_fprintf(stderr, "Could not find %s.\n", argv[0]);
return -1;
}
@@ -599,12 +599,13 @@ static int net_sam_deletelocalgroup(int argc, const char **argv)
return -1;
}
- ret = pdb_delete_alias(&sid);
+ status = pdb_delete_alias(&sid);
- if ( !ret ) {
- d_fprintf(stderr, "Could not delete local group %s.\n", argv[0]);
- return -1;
- }
+ if (!NT_STATUS_IS_OK(status)) {
+ d_fprintf(stderr, "Deleting local group %s failed with %s\n",
+ argv[0], nt_errstr(status));
+ return -1;
+ }
d_printf("Deleted local group %s.\n", argv[0]);