From 7eb828135bd7407851a10c32d57c404ecb030140 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 27 Jun 2007 11:42:17 +0000 Subject: r23627: Allow to pass down the lookup-level to rpccli_lsa_lookup_names(). Guenther (This used to be commit e9a7512a9f630340004913f1379452eea8a9b6ae) --- source3/libmsrpc/cac_lsarpc.c | 14 +++++++------- source3/libsmb/libsmbclient.c | 2 +- source3/nsswitch/winbindd_rpc.c | 2 +- source3/python/py_lsa.c | 2 +- source3/rpc_client/cli_lsarpc.c | 3 ++- source3/rpc_parse/parse_lsa.c | 5 +++-- source3/rpcclient/cmd_lsarpc.c | 4 ++-- source3/utils/net_rpc.c | 2 +- source3/utils/net_rpc_rights.c | 2 +- source3/utils/net_util.c | 2 +- source3/utils/netlookup.c | 4 ++-- source3/utils/smbcacls.c | 2 +- source3/utils/smbcquotas.c | 2 +- 13 files changed, 24 insertions(+), 22 deletions(-) diff --git a/source3/libmsrpc/cac_lsarpc.c b/source3/libmsrpc/cac_lsarpc.c index de53c0f483..d8813fc204 100644 --- a/source3/libmsrpc/cac_lsarpc.c +++ b/source3/libmsrpc/cac_lsarpc.c @@ -337,7 +337,7 @@ int cac_LsaGetSidsFromNames( CacServerHandle * hnd, TALLOC_CTX * mem_ctx, rpccli_lsa_lookup_names( pipe_hnd, mem_ctx, op->in.pol, num_names, ( const char ** ) op->in.names, NULL, - &sids, &types ); + 1, &sids, &types ); if ( NT_STATUS_IS_OK( hnd->status ) ) { /*this is the easy part, just make the out.sids array */ @@ -662,7 +662,7 @@ int cac_LsaEnumAccountRights( CacServerHandle * hnd, TALLOC_CTX * mem_ctx, op->in.pol, 1, ( const char ** ) &( op->in. name ), - NULL, &user_sid, &type ); + NULL, 1, &user_sid, &type ); if ( !NT_STATUS_IS_OK( hnd->status ) ) return CAC_FAILURE; @@ -928,7 +928,7 @@ int cac_LsaOpenAccount( CacServerHandle * hnd, TALLOC_CTX * mem_ctx, op->in.pol, 1, ( const char ** ) &( op->in. name ), - NULL, &user_sid, &type ); + NULL, 1, &user_sid, &type ); if ( !NT_STATUS_IS_OK( hnd->status ) ) return CAC_FAILURE; @@ -998,7 +998,7 @@ int cac_LsaAddPrivileges( CacServerHandle * hnd, TALLOC_CTX * mem_ctx, op->in.pol, 1, ( const char ** ) &( op->in. name ), - NULL, &user_sid, &type ); + NULL, 1, &user_sid, &type ); if ( !NT_STATUS_IS_OK( hnd->status ) ) return CAC_FAILURE; @@ -1060,7 +1060,7 @@ int cac_LsaRemovePrivileges( CacServerHandle * hnd, TALLOC_CTX * mem_ctx, op->in.pol, 1, ( const char ** ) &( op->in. name ), - NULL, &user_sid, &type ); + NULL, 1, &user_sid, &type ); if ( !NT_STATUS_IS_OK( hnd->status ) ) return CAC_FAILURE; @@ -1122,7 +1122,7 @@ int cac_LsaClearPrivileges( CacServerHandle * hnd, TALLOC_CTX * mem_ctx, op->in.pol, 1, ( const char ** ) &( op->in. name ), - NULL, &user_sid, &type ); + NULL, 1, &user_sid, &type ); if ( !NT_STATUS_IS_OK( hnd->status ) ) return CAC_FAILURE; @@ -1181,7 +1181,7 @@ int cac_LsaSetPrivileges( CacServerHandle * hnd, TALLOC_CTX * mem_ctx, op->in.pol, 1, ( const char ** ) &( op->in. name ), - NULL, &user_sid, &type ); + NULL, 1, &user_sid, &type ); if ( !NT_STATUS_IS_OK( hnd->status ) ) return CAC_FAILURE; diff --git a/source3/libsmb/libsmbclient.c b/source3/libsmb/libsmbclient.c index c36bb21ff4..550c691a8d 100644 --- a/source3/libsmb/libsmbclient.c +++ b/source3/libsmb/libsmbclient.c @@ -3849,7 +3849,7 @@ convert_string_to_sid(struct cli_state *ipc_cli, } if (!NT_STATUS_IS_OK(rpccli_lsa_lookup_names(pipe_hnd, ipc_cli->mem_ctx, - pol, 1, &str, NULL, &sids, + pol, 1, &str, NULL, 1, &sids, &types))) { result = False; goto done; diff --git a/source3/nsswitch/winbindd_rpc.c b/source3/nsswitch/winbindd_rpc.c index 03aa42012e..7899d62fea 100644 --- a/source3/nsswitch/winbindd_rpc.c +++ b/source3/nsswitch/winbindd_rpc.c @@ -290,7 +290,7 @@ NTSTATUS msrpc_name_to_sid(struct winbindd_domain *domain, return result; result = rpccli_lsa_lookup_names(cli, mem_ctx, &lsa_policy, 1, - (const char**) &full_name, NULL, &sids, &types); + (const char**) &full_name, NULL, 1, &sids, &types); if (!NT_STATUS_IS_OK(result)) return result; diff --git a/source3/python/py_lsa.c b/source3/python/py_lsa.c index 39abc60e25..7404700031 100644 --- a/source3/python/py_lsa.c +++ b/source3/python/py_lsa.c @@ -187,7 +187,7 @@ static PyObject *lsa_lookup_names(PyObject *self, PyObject *args) ntstatus = rpccli_lsa_lookup_names( hnd->cli, mem_ctx, &hnd->pol, num_names, names, - NULL, &sids, &name_types); + NULL, 1, &sids, &name_types); if (!NT_STATUS_IS_OK(ntstatus) && NT_STATUS_V(ntstatus) != 0x107) { PyErr_SetObject(lsa_ntstatus, py_ntstatus_tuple(ntstatus)); diff --git a/source3/rpc_client/cli_lsarpc.c b/source3/rpc_client/cli_lsarpc.c index ed70bc1752..00c65d15aa 100644 --- a/source3/rpc_client/cli_lsarpc.c +++ b/source3/rpc_client/cli_lsarpc.c @@ -448,6 +448,7 @@ NTSTATUS rpccli_lsa_lookup_names(struct rpc_pipe_client *cli, POLICY_HND *pol, int num_names, const char **names, const char ***dom_names, + int level, DOM_SID **sids, enum lsa_SidType **types) { @@ -464,7 +465,7 @@ NTSTATUS rpccli_lsa_lookup_names(struct rpc_pipe_client *cli, ZERO_STRUCT(ref); r.dom_ref = &ref; - init_q_lookup_names(mem_ctx, &q, pol, num_names, names); + init_q_lookup_names(mem_ctx, &q, pol, num_names, names, level); CLI_DO_RPC( cli, mem_ctx, PI_LSARPC, LSA_LOOKUPNAMES, q, r, diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 0c07e7fe22..09f0f835ec 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -1567,7 +1567,8 @@ makes a structure. ********************************************************************/ void init_q_lookup_names(TALLOC_CTX *mem_ctx, LSA_Q_LOOKUP_NAMES *q_l, - POLICY_HND *hnd, int num_names, const char **names) + POLICY_HND *hnd, int num_names, const char **names, + int level) { unsigned int i; @@ -1578,7 +1579,7 @@ void init_q_lookup_names(TALLOC_CTX *mem_ctx, LSA_Q_LOOKUP_NAMES *q_l, q_l->pol = *hnd; q_l->num_entries = num_names; q_l->num_entries2 = num_names; - q_l->lookup_level = 1; + q_l->lookup_level = level; if (num_names) { if ((q_l->uni_name = TALLOC_ZERO_ARRAY(mem_ctx, UNISTR2, num_names)) == NULL) { diff --git a/source3/rpcclient/cmd_lsarpc.c b/source3/rpcclient/cmd_lsarpc.c index 96642ed65b..e3fe57e127 100644 --- a/source3/rpcclient/cmd_lsarpc.c +++ b/source3/rpcclient/cmd_lsarpc.c @@ -47,7 +47,7 @@ static NTSTATUS name_to_sid(struct rpc_pipe_client *cli, if (!NT_STATUS_IS_OK(result)) goto done; - result = rpccli_lsa_lookup_names(cli, mem_ctx, &pol, 1, &name, NULL, &sids, &sid_types); + result = rpccli_lsa_lookup_names(cli, mem_ctx, &pol, 1, &name, NULL, 1, &sids, &sid_types); if (!NT_STATUS_IS_OK(result)) goto done; @@ -239,7 +239,7 @@ static NTSTATUS cmd_lsa_lookup_names(struct rpc_pipe_client *cli, goto done; result = rpccli_lsa_lookup_names(cli, mem_ctx, &pol, argc - 1, - (const char**)(argv + 1), NULL, &sids, &types); + (const char**)(argv + 1), NULL, 1, &sids, &types); if (!NT_STATUS_IS_OK(result) && NT_STATUS_V(result) != NT_STATUS_V(STATUS_SOME_UNMAPPED)) diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c index 315b56100f..844207bff2 100644 --- a/source3/utils/net_rpc.c +++ b/source3/utils/net_rpc.c @@ -2030,7 +2030,7 @@ static NTSTATUS get_sid_from_name(struct cli_state *cli, } result = rpccli_lsa_lookup_names(pipe_hnd, mem_ctx, &lsa_pol, 1, - &name, NULL, &sids, &types); + &name, NULL, 1, &sids, &types); if (NT_STATUS_IS_OK(result)) { sid_copy(sid, &sids[0]); diff --git a/source3/utils/net_rpc_rights.c b/source3/utils/net_rpc_rights.c index 5c999e4cb0..4189f20658 100644 --- a/source3/utils/net_rpc_rights.c +++ b/source3/utils/net_rpc_rights.c @@ -76,7 +76,7 @@ static NTSTATUS name_to_sid(struct rpc_pipe_client *pipe_hnd, return result; result = rpccli_lsa_lookup_names(pipe_hnd, mem_ctx, &pol, 1, &name, - NULL, &sids, &sid_types); + NULL, 1, &sids, &sid_types); if ( NT_STATUS_IS_OK(result) ) sid_copy( sid, &sids[0] ); diff --git a/source3/utils/net_util.c b/source3/utils/net_util.c index db6420d6b7..be12b0f866 100644 --- a/source3/utils/net_util.c +++ b/source3/utils/net_util.c @@ -59,7 +59,7 @@ NTSTATUS net_rpc_lookup_name(TALLOC_CTX *mem_ctx, struct cli_state *cli, } result = rpccli_lsa_lookup_names(lsa_pipe, mem_ctx, &pol, 1, - &name, &dom_names, &sids, &types); + &name, &dom_names, 1, &sids, &types); if (!NT_STATUS_IS_OK(result)) { /* This can happen easily, don't log an error */ diff --git a/source3/utils/netlookup.c b/source3/utils/netlookup.c index 33b6c4bb25..82e1b8af80 100644 --- a/source3/utils/netlookup.c +++ b/source3/utils/netlookup.c @@ -206,8 +206,8 @@ NTSTATUS net_lookup_sid_from_name(TALLOC_CTX *ctx, const char *full_name, DOM_SI &csp->pol, 1, &full_name, - NULL, &sids, - &types); + NULL, 1, + &sids, &types); if (!NT_STATUS_IS_OK(nt_status)) { return nt_status; diff --git a/source3/utils/smbcacls.c b/source3/utils/smbcacls.c index 5717df2dfa..4a74251090 100644 --- a/source3/utils/smbcacls.c +++ b/source3/utils/smbcacls.c @@ -145,7 +145,7 @@ static BOOL StringToSid(DOM_SID *sid, const char *str) if (!cacls_open_policy_hnd() || !NT_STATUS_IS_OK(rpccli_lsa_lookup_names(global_pipe_hnd, global_hack_cli->mem_ctx, - &pol, 1, &str, NULL, &sids, + &pol, 1, &str, NULL, 1, &sids, &types))) { result = False; goto done; diff --git a/source3/utils/smbcquotas.c b/source3/utils/smbcquotas.c index ae2e6a5956..bf05441c21 100644 --- a/source3/utils/smbcquotas.c +++ b/source3/utils/smbcquotas.c @@ -116,7 +116,7 @@ static BOOL StringToSid(DOM_SID *sid, const char *str) if (!cli_open_policy_hnd() || !NT_STATUS_IS_OK(rpccli_lsa_lookup_names(global_pipe_hnd, cli_ipc->mem_ctx, - &pol, 1, &str, NULL, &sids, + &pol, 1, &str, NULL, 1, &sids, &types))) { result = False; goto done; -- cgit