mirror of
https://github.com/samba-team/samba.git
synced 2025-12-03 04:23:50 +03:00
r16644: Fix bug #3887 reported by jason@ncac.gwu.edu
by converting the lookup_XX functions to correctly return SID_NAME_TYPE enums. Jeremy.
This commit is contained in:
committed by
Gerald (Jerry) Carter
parent
d354b430ff
commit
ee2b2d96b6
@@ -144,7 +144,7 @@ int cac_LsaGetNamesFromSids(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct Ls
|
|||||||
/*buffers for outputs*/
|
/*buffers for outputs*/
|
||||||
char **domains = NULL;
|
char **domains = NULL;
|
||||||
char **names = NULL;
|
char **names = NULL;
|
||||||
uint32 *types = NULL;
|
enum SID_NAME_USE *types = NULL;
|
||||||
|
|
||||||
CacSidInfo *sids_out = NULL;
|
CacSidInfo *sids_out = NULL;
|
||||||
DOM_SID *unknown_out = NULL;
|
DOM_SID *unknown_out = NULL;
|
||||||
@@ -267,7 +267,7 @@ int cac_LsaGetSidsFromNames(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct Ls
|
|||||||
|
|
||||||
/*buffers for outputs*/
|
/*buffers for outputs*/
|
||||||
DOM_SID *sids = NULL;
|
DOM_SID *sids = NULL;
|
||||||
uint32 *types = NULL;
|
enum SID_NAME_USE *types = NULL;
|
||||||
|
|
||||||
CacSidInfo *sids_out = NULL;
|
CacSidInfo *sids_out = NULL;
|
||||||
char **unknown_out = NULL;
|
char **unknown_out = NULL;
|
||||||
@@ -579,7 +579,7 @@ int cac_LsaEnumAccountRights(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct L
|
|||||||
|
|
||||||
if(op->in.name && !op->in.sid) {
|
if(op->in.name && !op->in.sid) {
|
||||||
DOM_SID *user_sid = NULL;
|
DOM_SID *user_sid = NULL;
|
||||||
uint32 *type;
|
enum SID_NAME_USE *type;
|
||||||
|
|
||||||
/*lookup the SID*/
|
/*lookup the SID*/
|
||||||
hnd->status = rpccli_lsa_lookup_names( pipe_hnd, mem_ctx, op->in.pol, 1, (const char **)&(op->in.name), NULL, &user_sid, &type);
|
hnd->status = rpccli_lsa_lookup_names( pipe_hnd, mem_ctx, op->in.pol, 1, (const char **)&(op->in.name), NULL, &user_sid, &type);
|
||||||
@@ -806,7 +806,7 @@ int cac_LsaOpenAccount(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct LsaOpen
|
|||||||
/*look up the user's SID if we have to*/
|
/*look up the user's SID if we have to*/
|
||||||
if(op->in.name && !op->in.sid) {
|
if(op->in.name && !op->in.sid) {
|
||||||
DOM_SID *user_sid = NULL;
|
DOM_SID *user_sid = NULL;
|
||||||
uint32 *type;
|
enum SID_NAME_USE *type;
|
||||||
|
|
||||||
/*lookup the SID*/
|
/*lookup the SID*/
|
||||||
hnd->status = rpccli_lsa_lookup_names( pipe_hnd, mem_ctx, op->in.pol, 1, (const char **)&(op->in.name), NULL, &user_sid, &type);
|
hnd->status = rpccli_lsa_lookup_names( pipe_hnd, mem_ctx, op->in.pol, 1, (const char **)&(op->in.name), NULL, &user_sid, &type);
|
||||||
@@ -840,7 +840,7 @@ int cac_LsaAddPrivileges(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct LsaAd
|
|||||||
struct rpc_pipe_client *pipe_hnd = NULL;
|
struct rpc_pipe_client *pipe_hnd = NULL;
|
||||||
|
|
||||||
DOM_SID *user_sid = NULL;
|
DOM_SID *user_sid = NULL;
|
||||||
uint32 *type = NULL;
|
enum SID_NAME_USE *type = NULL;
|
||||||
|
|
||||||
if(!hnd) {
|
if(!hnd) {
|
||||||
return CAC_FAILURE;
|
return CAC_FAILURE;
|
||||||
@@ -890,7 +890,7 @@ int cac_LsaRemovePrivileges(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct Ls
|
|||||||
struct rpc_pipe_client *pipe_hnd = NULL;
|
struct rpc_pipe_client *pipe_hnd = NULL;
|
||||||
|
|
||||||
DOM_SID *user_sid = NULL;
|
DOM_SID *user_sid = NULL;
|
||||||
uint32 *type = NULL;
|
enum SID_NAME_USE *type = NULL;
|
||||||
|
|
||||||
if(!hnd) {
|
if(!hnd) {
|
||||||
return CAC_FAILURE;
|
return CAC_FAILURE;
|
||||||
@@ -940,7 +940,7 @@ int cac_LsaClearPrivileges(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct Lsa
|
|||||||
struct rpc_pipe_client *pipe_hnd = NULL;
|
struct rpc_pipe_client *pipe_hnd = NULL;
|
||||||
|
|
||||||
DOM_SID *user_sid = NULL;
|
DOM_SID *user_sid = NULL;
|
||||||
uint32 *type = NULL;
|
enum SID_NAME_USE *type = NULL;
|
||||||
|
|
||||||
if(!hnd) {
|
if(!hnd) {
|
||||||
return CAC_FAILURE;
|
return CAC_FAILURE;
|
||||||
@@ -990,7 +990,7 @@ int cac_LsaSetPrivileges(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct LsaAd
|
|||||||
struct rpc_pipe_client *pipe_hnd = NULL;
|
struct rpc_pipe_client *pipe_hnd = NULL;
|
||||||
|
|
||||||
DOM_SID *user_sid = NULL;
|
DOM_SID *user_sid = NULL;
|
||||||
uint32 *type = NULL;
|
enum SID_NAME_USE *type = NULL;
|
||||||
|
|
||||||
if(!hnd) {
|
if(!hnd) {
|
||||||
return CAC_FAILURE;
|
return CAC_FAILURE;
|
||||||
|
|||||||
@@ -3727,7 +3727,7 @@ convert_sid_to_string(struct cli_state *ipc_cli,
|
|||||||
{
|
{
|
||||||
char **domains = NULL;
|
char **domains = NULL;
|
||||||
char **names = NULL;
|
char **names = NULL;
|
||||||
uint32 *types = NULL;
|
enum SID_NAME_USE *types = NULL;
|
||||||
struct rpc_pipe_client *pipe_hnd = find_lsa_pipe_hnd(ipc_cli);
|
struct rpc_pipe_client *pipe_hnd = find_lsa_pipe_hnd(ipc_cli);
|
||||||
sid_to_string(str, sid);
|
sid_to_string(str, sid);
|
||||||
|
|
||||||
@@ -3763,7 +3763,7 @@ convert_string_to_sid(struct cli_state *ipc_cli,
|
|||||||
DOM_SID *sid,
|
DOM_SID *sid,
|
||||||
const char *str)
|
const char *str)
|
||||||
{
|
{
|
||||||
uint32 *types = NULL;
|
enum SID_NAME_USE *types = NULL;
|
||||||
DOM_SID *sids = NULL;
|
DOM_SID *sids = NULL;
|
||||||
BOOL result = True;
|
BOOL result = True;
|
||||||
struct rpc_pipe_client *pipe_hnd = find_lsa_pipe_hnd(ipc_cli);
|
struct rpc_pipe_client *pipe_hnd = find_lsa_pipe_hnd(ipc_cli);
|
||||||
|
|||||||
@@ -245,7 +245,7 @@ NTSTATUS msrpc_name_to_sid(struct winbindd_domain *domain,
|
|||||||
{
|
{
|
||||||
NTSTATUS result;
|
NTSTATUS result;
|
||||||
DOM_SID *sids = NULL;
|
DOM_SID *sids = NULL;
|
||||||
uint32 *types = NULL;
|
enum SID_NAME_USE *types = NULL;
|
||||||
const char *full_name;
|
const char *full_name;
|
||||||
struct rpc_pipe_client *cli;
|
struct rpc_pipe_client *cli;
|
||||||
POLICY_HND lsa_policy;
|
POLICY_HND lsa_policy;
|
||||||
@@ -277,7 +277,7 @@ NTSTATUS msrpc_name_to_sid(struct winbindd_domain *domain,
|
|||||||
/* Return rid and type if lookup successful */
|
/* Return rid and type if lookup successful */
|
||||||
|
|
||||||
sid_copy(sid, &sids[0]);
|
sid_copy(sid, &sids[0]);
|
||||||
*type = (enum SID_NAME_USE)types[0];
|
*type = types[0];
|
||||||
|
|
||||||
return NT_STATUS_OK;
|
return NT_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ static PyObject *lsa_lookup_names(PyObject *self, PyObject *args)
|
|||||||
const char **names;
|
const char **names;
|
||||||
DOM_SID *sids;
|
DOM_SID *sids;
|
||||||
TALLOC_CTX *mem_ctx = NULL;
|
TALLOC_CTX *mem_ctx = NULL;
|
||||||
uint32 *name_types;
|
enum SID_NAME_USE *name_types;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "O", &py_names))
|
if (!PyArg_ParseTuple(args, "O", &py_names))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
@@ -175,7 +175,9 @@ NTSTATUS rpccli_lsa_lookup_sids(struct rpc_pipe_client *cli,
|
|||||||
TALLOC_CTX *mem_ctx,
|
TALLOC_CTX *mem_ctx,
|
||||||
POLICY_HND *pol, int num_sids,
|
POLICY_HND *pol, int num_sids,
|
||||||
const DOM_SID *sids,
|
const DOM_SID *sids,
|
||||||
char ***domains, char ***names, uint32 **types)
|
char ***domains,
|
||||||
|
char ***names,
|
||||||
|
enum SID_NAME_USE **types)
|
||||||
{
|
{
|
||||||
prs_struct qbuf, rbuf;
|
prs_struct qbuf, rbuf;
|
||||||
LSA_Q_LOOKUP_SIDS q;
|
LSA_Q_LOOKUP_SIDS q;
|
||||||
@@ -231,7 +233,7 @@ NTSTATUS rpccli_lsa_lookup_sids(struct rpc_pipe_client *cli,
|
|||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!((*types) = TALLOC_ARRAY(mem_ctx, uint32, num_sids))) {
|
if (!((*types) = TALLOC_ARRAY(mem_ctx, enum SID_NAME_USE, num_sids))) {
|
||||||
DEBUG(0, ("cli_lsa_lookup_sids(): out of memory\n"));
|
DEBUG(0, ("cli_lsa_lookup_sids(): out of memory\n"));
|
||||||
result = NT_STATUS_NO_MEMORY;
|
result = NT_STATUS_NO_MEMORY;
|
||||||
goto done;
|
goto done;
|
||||||
@@ -252,7 +254,7 @@ NTSTATUS rpccli_lsa_lookup_sids(struct rpc_pipe_client *cli,
|
|||||||
|
|
||||||
(*names)[i] = talloc_strdup(mem_ctx, name);
|
(*names)[i] = talloc_strdup(mem_ctx, name);
|
||||||
(*domains)[i] = talloc_strdup(mem_ctx, dom_name);
|
(*domains)[i] = talloc_strdup(mem_ctx, dom_name);
|
||||||
(*types)[i] = t_names.name[i].sid_name_use;
|
(*types)[i] = (enum SID_NAME_USE)t_names.name[i].sid_name_use;
|
||||||
|
|
||||||
if (((*names)[i] == NULL) || ((*domains)[i] == NULL)) {
|
if (((*names)[i] == NULL) || ((*domains)[i] == NULL)) {
|
||||||
DEBUG(0, ("cli_lsa_lookup_sids(): out of memory\n"));
|
DEBUG(0, ("cli_lsa_lookup_sids(): out of memory\n"));
|
||||||
@@ -280,7 +282,7 @@ NTSTATUS rpccli_lsa_lookup_names(struct rpc_pipe_client *cli,
|
|||||||
const char **names,
|
const char **names,
|
||||||
const char ***dom_names,
|
const char ***dom_names,
|
||||||
DOM_SID **sids,
|
DOM_SID **sids,
|
||||||
uint32 **types)
|
enum SID_NAME_USE **types)
|
||||||
{
|
{
|
||||||
prs_struct qbuf, rbuf;
|
prs_struct qbuf, rbuf;
|
||||||
LSA_Q_LOOKUP_NAMES q;
|
LSA_Q_LOOKUP_NAMES q;
|
||||||
@@ -327,7 +329,7 @@ NTSTATUS rpccli_lsa_lookup_names(struct rpc_pipe_client *cli,
|
|||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!((*types = TALLOC_ARRAY(mem_ctx, uint32, num_names)))) {
|
if (!((*types = TALLOC_ARRAY(mem_ctx, enum SID_NAME_USE, num_names)))) {
|
||||||
DEBUG(0, ("cli_lsa_lookup_sids(): out of memory\n"));
|
DEBUG(0, ("cli_lsa_lookup_sids(): out of memory\n"));
|
||||||
result = NT_STATUS_NO_MEMORY;
|
result = NT_STATUS_NO_MEMORY;
|
||||||
goto done;
|
goto done;
|
||||||
@@ -363,7 +365,7 @@ NTSTATUS rpccli_lsa_lookup_names(struct rpc_pipe_client *cli,
|
|||||||
sid_append_rid(sid, dom_rid);
|
sid_append_rid(sid, dom_rid);
|
||||||
}
|
}
|
||||||
|
|
||||||
(*types)[i] = t_rids[i].type;
|
(*types)[i] = (enum SID_NAME_USE)t_rids[i].type;
|
||||||
|
|
||||||
if (dom_names == NULL) {
|
if (dom_names == NULL) {
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ static NTSTATUS name_to_sid(struct rpc_pipe_client *cli,
|
|||||||
DOM_SID *sid, const char *name)
|
DOM_SID *sid, const char *name)
|
||||||
{
|
{
|
||||||
POLICY_HND pol;
|
POLICY_HND pol;
|
||||||
uint32 *sid_types;
|
enum SID_NAME_USE *sid_types;
|
||||||
NTSTATUS result;
|
NTSTATUS result;
|
||||||
DOM_SID *sids;
|
DOM_SID *sids;
|
||||||
|
|
||||||
@@ -223,7 +223,7 @@ static NTSTATUS cmd_lsa_lookup_names(struct rpc_pipe_client *cli,
|
|||||||
POLICY_HND pol;
|
POLICY_HND pol;
|
||||||
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
|
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
|
||||||
DOM_SID *sids;
|
DOM_SID *sids;
|
||||||
uint32 *types;
|
enum SID_NAME_USE *types;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (argc == 1) {
|
if (argc == 1) {
|
||||||
@@ -272,7 +272,7 @@ static NTSTATUS cmd_lsa_lookup_sids(struct rpc_pipe_client *cli, TALLOC_CTX *mem
|
|||||||
DOM_SID *sids;
|
DOM_SID *sids;
|
||||||
char **domains;
|
char **domains;
|
||||||
char **names;
|
char **names;
|
||||||
uint32 *types;
|
enum SID_NAME_USE *types;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (argc == 1) {
|
if (argc == 1) {
|
||||||
|
|||||||
@@ -2011,7 +2011,7 @@ static NTSTATUS get_sid_from_name(struct cli_state *cli,
|
|||||||
enum SID_NAME_USE *type)
|
enum SID_NAME_USE *type)
|
||||||
{
|
{
|
||||||
DOM_SID *sids = NULL;
|
DOM_SID *sids = NULL;
|
||||||
uint32 *types = NULL;
|
enum SID_NAME_USE *types = NULL;
|
||||||
struct rpc_pipe_client *pipe_hnd;
|
struct rpc_pipe_client *pipe_hnd;
|
||||||
POLICY_HND lsa_pol;
|
POLICY_HND lsa_pol;
|
||||||
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
|
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
|
||||||
@@ -2717,7 +2717,7 @@ static NTSTATUS rpc_list_alias_members(struct rpc_pipe_client *pipe_hnd,
|
|||||||
DOM_SID *alias_sids;
|
DOM_SID *alias_sids;
|
||||||
char **domains;
|
char **domains;
|
||||||
char **names;
|
char **names;
|
||||||
uint32 *types;
|
enum SID_NAME_USE *types;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
result = rpccli_samr_open_alias(pipe_hnd, mem_ctx, domain_pol,
|
result = rpccli_samr_open_alias(pipe_hnd, mem_ctx, domain_pol,
|
||||||
@@ -4075,7 +4075,7 @@ static NTSTATUS rpc_aliaslist_dump(const DOM_SID *domain_sid,
|
|||||||
for (i=0; i<num_server_aliases; i++) {
|
for (i=0; i<num_server_aliases; i++) {
|
||||||
char **names;
|
char **names;
|
||||||
char **domains;
|
char **domains;
|
||||||
uint32 *types;
|
enum SID_NAME_USE *types;
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
struct full_alias *alias = &server_aliases[i];
|
struct full_alias *alias = &server_aliases[i];
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ static NTSTATUS sid_to_name(struct rpc_pipe_client *pipe_hnd,
|
|||||||
fstring name)
|
fstring name)
|
||||||
{
|
{
|
||||||
POLICY_HND pol;
|
POLICY_HND pol;
|
||||||
uint32 *sid_types;
|
enum SID_NAME_USE *sid_types;
|
||||||
NTSTATUS result;
|
NTSTATUS result;
|
||||||
char **domains, **names;
|
char **domains, **names;
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ static NTSTATUS name_to_sid(struct rpc_pipe_client *pipe_hnd,
|
|||||||
DOM_SID *sid, const char *name)
|
DOM_SID *sid, const char *name)
|
||||||
{
|
{
|
||||||
POLICY_HND pol;
|
POLICY_HND pol;
|
||||||
uint32 *sid_types;
|
enum SID_NAME_USE *sid_types;
|
||||||
NTSTATUS result;
|
NTSTATUS result;
|
||||||
DOM_SID *sids;
|
DOM_SID *sids;
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ NTSTATUS net_rpc_lookup_name(TALLOC_CTX *mem_ctx, struct cli_state *cli,
|
|||||||
NTSTATUS result = NT_STATUS_OK;
|
NTSTATUS result = NT_STATUS_OK;
|
||||||
const char **dom_names;
|
const char **dom_names;
|
||||||
DOM_SID *sids;
|
DOM_SID *sids;
|
||||||
uint32_t *types;
|
enum SID_NAME_USE *types;
|
||||||
|
|
||||||
ZERO_STRUCT(pol);
|
ZERO_STRUCT(pol);
|
||||||
|
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ NTSTATUS net_lookup_name_from_sid(TALLOC_CTX *ctx,
|
|||||||
struct con_struct *csp = NULL;
|
struct con_struct *csp = NULL;
|
||||||
char **domains;
|
char **domains;
|
||||||
char **names;
|
char **names;
|
||||||
uint32 *types;
|
enum SID_NAME_USE *types;
|
||||||
|
|
||||||
*ppdomain = NULL;
|
*ppdomain = NULL;
|
||||||
*ppname = NULL;
|
*ppname = NULL;
|
||||||
@@ -195,7 +195,7 @@ NTSTATUS net_lookup_sid_from_name(TALLOC_CTX *ctx, const char *full_name, DOM_SI
|
|||||||
NTSTATUS nt_status;
|
NTSTATUS nt_status;
|
||||||
struct con_struct *csp = NULL;
|
struct con_struct *csp = NULL;
|
||||||
DOM_SID *sids = NULL;
|
DOM_SID *sids = NULL;
|
||||||
uint32 *types = NULL;
|
enum SID_NAME_USE *types = NULL;
|
||||||
|
|
||||||
csp = create_cs(ctx, &nt_status);
|
csp = create_cs(ctx, &nt_status);
|
||||||
if (csp == NULL) {
|
if (csp == NULL) {
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ static void SidToString(fstring str, DOM_SID *sid)
|
|||||||
{
|
{
|
||||||
char **domains = NULL;
|
char **domains = NULL;
|
||||||
char **names = NULL;
|
char **names = NULL;
|
||||||
uint32 *types = NULL;
|
enum SID_NAME_USE *types = NULL;
|
||||||
|
|
||||||
sid_to_string(str, sid);
|
sid_to_string(str, sid);
|
||||||
|
|
||||||
@@ -135,7 +135,7 @@ static void SidToString(fstring str, DOM_SID *sid)
|
|||||||
/* convert a string to a SID, either numeric or username/group */
|
/* convert a string to a SID, either numeric or username/group */
|
||||||
static BOOL StringToSid(DOM_SID *sid, const char *str)
|
static BOOL StringToSid(DOM_SID *sid, const char *str)
|
||||||
{
|
{
|
||||||
uint32 *types = NULL;
|
enum SID_NAME_USE *types = NULL;
|
||||||
DOM_SID *sids = NULL;
|
DOM_SID *sids = NULL;
|
||||||
BOOL result = True;
|
BOOL result = True;
|
||||||
|
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ static void SidToString(fstring str, DOM_SID *sid, BOOL _numeric)
|
|||||||
{
|
{
|
||||||
char **domains = NULL;
|
char **domains = NULL;
|
||||||
char **names = NULL;
|
char **names = NULL;
|
||||||
uint32 *types = NULL;
|
enum SID_NAME_USE *types = NULL;
|
||||||
|
|
||||||
sid_to_string(str, sid);
|
sid_to_string(str, sid);
|
||||||
|
|
||||||
@@ -106,7 +106,7 @@ static void SidToString(fstring str, DOM_SID *sid, BOOL _numeric)
|
|||||||
/* convert a string to a SID, either numeric or username/group */
|
/* convert a string to a SID, either numeric or username/group */
|
||||||
static BOOL StringToSid(DOM_SID *sid, const char *str)
|
static BOOL StringToSid(DOM_SID *sid, const char *str)
|
||||||
{
|
{
|
||||||
uint32 *types = NULL;
|
enum SID_NAME_USE *types = NULL;
|
||||||
DOM_SID *sids = NULL;
|
DOM_SID *sids = NULL;
|
||||||
BOOL result = True;
|
BOOL result = True;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user