summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1999-11-24 20:24:33 +0000
committerLuke Leighton <lkcl@samba.org>1999-11-24 20:24:33 +0000
commitf8b82a7b9507e11595bc924def179dc1d7d79a54 (patch)
tree1dab991fc42fecce86a98d45cb47fcb0dd087c38 /source3/lib
parent2752e372b64337de24edef52575ddc7da0ed8d04 (diff)
downloadsamba-f8b82a7b9507e11595bc924def179dc1d7d79a54.tar.gz
samba-f8b82a7b9507e11595bc924def179dc1d7d79a54.tar.bz2
samba-f8b82a7b9507e11595bc924def179dc1d7d79a54.zip
first stages of removing struct cli_state* and uint16 fnum from all
msrpc client code. the intent is to hide / abstract / associate connection info behind policy handles. this makes the msrpc functions look more and more like their nt equivalents. who-hou! (This used to be commit c01b18e632aede6fce7264ef6971d7ddba945cfb)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/domain_namemap.c17
-rw-r--r--source3/lib/util_hnd.c24
2 files changed, 23 insertions, 18 deletions
diff --git a/source3/lib/domain_namemap.c b/source3/lib/domain_namemap.c
index 05b67632a2..51fcd2467a 100644
--- a/source3/lib/domain_namemap.c
+++ b/source3/lib/domain_namemap.c
@@ -881,8 +881,8 @@ static BOOL lookup_remote_ntname(const char *ntname, DOM_SID *sid, uint8 *type)
{
struct cli_state cli;
POLICY_HND lsa_pol;
- uint16 fnum_lsa;
fstring srv_name;
+ extern struct cli_state *rpc_smb_cli;
BOOL res3 = True;
BOOL res4 = True;
@@ -891,6 +891,8 @@ static BOOL lookup_remote_ntname(const char *ntname, DOM_SID *sid, uint8 *type)
uint8 *types;
char *names[1];
+ rpc_smb_cli = &cli;
+
DEBUG(5,("lookup_remote_ntname: %s\n", ntname));
if (!cli_connect_serverlist(&cli, lp_passwordserver()))
@@ -904,23 +906,16 @@ static BOOL lookup_remote_ntname(const char *ntname, DOM_SID *sid, uint8 *type)
fstrcat(srv_name, cli.desthost);
strupper(srv_name);
- /* open LSARPC session. */
- res3 = res3 ? cli_nt_session_open(&cli, PIPE_LSARPC, &fnum_lsa) : False;
-
/* lookup domain controller; receive a policy handle */
- res3 = res3 ? lsa_open_policy(&cli, fnum_lsa,
- srv_name,
+ res3 = res3 ? lsa_open_policy( srv_name,
&lsa_pol, True) : False;
/* send lsa lookup sids call */
- res4 = res3 ? lsa_lookup_names(&cli, fnum_lsa,
- &lsa_pol,
+ res4 = res3 ? lsa_lookup_names( &lsa_pol,
1, names,
&sids, &types, &num_sids) : False;
- res3 = res3 ? lsa_close(&cli, fnum_lsa, &lsa_pol) : False;
-
- cli_nt_session_close(&cli, fnum_lsa);
+ res3 = res3 ? lsa_close(&lsa_pol) : False;
if (res4 && res3 && sids != NULL && types != NULL)
{
diff --git a/source3/lib/util_hnd.c b/source3/lib/util_hnd.c
index 36bacad59b..8e4620f8dc 100644
--- a/source3/lib/util_hnd.c
+++ b/source3/lib/util_hnd.c
@@ -111,7 +111,7 @@ BOOL init_policy_hnd(int num_pol_hnds)
/****************************************************************************
find first available policy slot. creates a policy handle for you.
****************************************************************************/
-BOOL open_policy_hnd(POLICY_HND *hnd)
+BOOL register_policy_hnd(POLICY_HND *hnd)
{
int i;
struct policy *p;
@@ -135,7 +135,6 @@ BOOL open_policy_hnd(POLICY_HND *hnd)
p->pnum = i;
p->type = POL_NO_INFO;
- create_pol_hnd(hnd);
memcpy(&p->pol_hnd, hnd, sizeof(*hnd));
bitmap_set(bmap, i);
@@ -149,22 +148,32 @@ BOOL open_policy_hnd(POLICY_HND *hnd)
}
/****************************************************************************
+ find first available policy slot. creates a policy handle for you.
+****************************************************************************/
+BOOL open_policy_hnd(POLICY_HND *hnd)
+{
+ create_pol_hnd(hnd);
+ return register_policy_hnd(hnd);
+}
+
+/****************************************************************************
find policy by handle
****************************************************************************/
-static struct policy *find_policy(POLICY_HND *hnd)
+static struct policy *find_policy(const POLICY_HND *hnd)
{
struct policy *p;
for (p=Policy;p;p=p->next) {
if (memcmp(&p->pol_hnd, hnd, sizeof(*hnd)) == 0) {
DEBUG(4,("Found policy hnd[%x] ", p->pnum));
- dump_data(4, (char *)hnd->data, sizeof(hnd->data));
+ dump_data(4, (const char *)hnd->data,
+ sizeof(hnd->data));
return p;
}
}
DEBUG(4,("Policy not found: "));
- dump_data(4, (char *)hnd->data, sizeof(hnd->data));
+ dump_data(4, (const char *)hnd->data, sizeof(hnd->data));
return NULL;
}
@@ -172,7 +181,7 @@ static struct policy *find_policy(POLICY_HND *hnd)
/****************************************************************************
find policy index by handle
****************************************************************************/
-int find_policy_by_hnd(POLICY_HND *hnd)
+int find_policy_by_hnd(const POLICY_HND *hnd)
{
struct policy *p = find_policy(hnd);
@@ -393,7 +402,8 @@ BOOL set_policy_cli_state(POLICY_HND *hnd, struct cli_state *cli, uint16 fnum,
/****************************************************************************
get cli state
****************************************************************************/
-BOOL get_policy_cli_state(POLICY_HND *hnd, struct cli_state **cli, uint16 *fnum)
+BOOL get_policy_cli_state(const POLICY_HND *hnd, struct cli_state **cli,
+ uint16 *fnum)
{
struct policy *p = find_policy(hnd);