summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1999-11-27 21:50:11 +0000
committerLuke Leighton <lkcl@samba.org>1999-11-27 21:50:11 +0000
commita1ff7e8fc3129ba4a04722f977bc2d3725d13624 (patch)
tree3fa70d2774aa8e44463548ae83f23b937d36d904
parent2dad9d912dbc6c4a14af63715821a51c279584c6 (diff)
downloadsamba-a1ff7e8fc3129ba4a04722f977bc2d3725d13624.tar.gz
samba-a1ff7e8fc3129ba4a04722f977bc2d3725d13624.tar.xz
samba-a1ff7e8fc3129ba4a04722f977bc2d3725d13624.zip
further abstraction involving client states. main client-side code
is pretty much independent of SMB client states, which will make it easier to add other transports.
-rw-r--r--source/include/client.h2
-rw-r--r--source/include/proto.h37
-rw-r--r--source/include/rpcclient.h14
-rw-r--r--source/lib/util_hnd.c52
-rw-r--r--source/rpc_client/cli_connect.c162
-rw-r--r--source/rpc_client/cli_lsarpc.c34
-rw-r--r--source/rpc_client/cli_pipe.c22
-rw-r--r--source/rpc_client/cli_reg.c43
-rw-r--r--source/rpc_client/cli_samr.c40
-rw-r--r--source/rpc_client/cli_svcctl.c63
-rw-r--r--source/rpc_server/srv_lsa_hnd.c52
-rw-r--r--source/rpcclient/cmd_samr.c31
-rw-r--r--source/rpcclient/rpcclient.c9
13 files changed, 299 insertions, 262 deletions
diff --git a/source/include/client.h b/source/include/client.h
index 78c7d977c0d..066c5e73f33 100644
--- a/source/include/client.h
+++ b/source/include/client.h
@@ -160,4 +160,6 @@ struct cli_state
uint16 max_recv_frag;
};
+struct cli_connection;
+
#endif /* _CLIENT_H */
diff --git a/source/include/proto.h b/source/include/proto.h
index d9af7c5e4fe..28bc1bfa5f9 100644
--- a/source/include/proto.h
+++ b/source/include/proto.h
@@ -539,10 +539,9 @@ BOOL get_policy_samr_sid(POLICY_HND *hnd, DOM_SID *sid);
uint32 get_policy_samr_rid(POLICY_HND *hnd);
BOOL set_policy_reg_name(POLICY_HND *hnd, fstring name);
BOOL get_policy_reg_name(POLICY_HND *hnd, fstring name);
-BOOL set_policy_cli_state(POLICY_HND *hnd, struct cli_state *cli, uint16 fnum,
- void (*free_fn)(struct cli_state *, uint16));
-BOOL get_policy_cli_state(const POLICY_HND *hnd, struct cli_state **cli,
- uint16 *fnum);
+BOOL set_policy_con(POLICY_HND *hnd, struct cli_connection *con,
+ void (*free_fn)(struct cli_connection *));
+BOOL get_policy_con(const POLICY_HND *hnd, struct cli_connection **con);
BOOL close_policy_hnd(POLICY_HND *hnd);
/*The following definitions come from lib/util_pwdb.c */
@@ -1788,15 +1787,19 @@ BOOL do_brs_query_info(struct cli_state *cli, uint16 fnum,
/*The following definitions come from rpc_client/cli_connect.c */
-void cli_state_free(struct cli_state *cli, uint16 fnum);
-BOOL cli_state_init(const char* server_name, const char* pipe_name,
- struct cli_state **cli,
- uint16 *fnum);
-BOOL cli_state_get(const POLICY_HND *pol,
- struct cli_state **cli,
- uint16 *fnum);
+void cli_connection_free(struct cli_connection *con);
+void cli_connection_unlink(struct cli_connection *con);
+BOOL cli_connection_init_list(char* servers, const char* pipe_name,
+ struct cli_connection **con);
+BOOL cli_connection_init(const char* server_name, const char* pipe_name,
+ struct cli_connection **con);
+BOOL cli_connection_get(const POLICY_HND *pol, struct cli_connection **con);
BOOL cli_pol_link(POLICY_HND *to, const POLICY_HND *from);
BOOL cli_get_usr_sesskey(const POLICY_HND *pol, uchar sess_key[16]);
+BOOL rpc_hnd_pipe_req(const POLICY_HND *hnd, uint8 op_num,
+ prs_struct *data, prs_struct *rdata);
+BOOL rpc_con_pipe_req(struct cli_connection *con, uint8 op_num,
+ prs_struct *data, prs_struct *rdata);
/*The following definitions come from rpc_client/cli_eventlog.c */
@@ -1902,8 +1905,6 @@ BOOL create_rpc_bind_resp(struct pwd_info *pwd,
prs_struct *rhdr,
prs_struct *rhdr_autha,
prs_struct *auth_resp);
-BOOL rpc_hnd_pipe_req(const POLICY_HND *hnd, uint8 op_num,
- prs_struct *data, prs_struct *rdata);
BOOL rpc_api_pipe_req(struct cli_state *cli, uint16 fnum, uint8 op_num,
prs_struct *data, prs_struct *rdata);
void cli_nt_set_ntlmssp_flgs(struct cli_state *cli, uint32 ntlmssp_flgs);
@@ -1917,13 +1918,13 @@ BOOL reg_connect( const char* srv_name,
const char *full_keyname,
char *key_name,
POLICY_HND *reg_hnd);
-BOOL reg_open_hkcr( struct cli_state *cli, uint16 fnum,
+BOOL reg_open_hkcr( struct cli_connection *con,
uint16 unknown_0, uint32 level,
POLICY_HND *hnd);
-BOOL reg_open_hklm( struct cli_state *cli, uint16 fnum,
+BOOL reg_open_hklm( struct cli_connection *con,
uint16 unknown_0, uint32 level,
POLICY_HND *hnd);
-BOOL reg_open_hku( struct cli_state *cli, uint16 fnum,
+BOOL reg_open_hku( struct cli_connection *con,
uint16 unknown_0, uint32 level,
POLICY_HND *hnd);
BOOL reg_flush_key( POLICY_HND *hnd);
@@ -1968,11 +1969,11 @@ BOOL reg_shutdown(const char *srv_name,
/*The following definitions come from rpc_client/cli_samr.c */
-BOOL samr_chgpasswd_user( struct cli_state *cli, uint16 fnum,
+BOOL samr_chgpasswd_user( struct cli_connection *con,
char *srv_name, char *user_name,
char nt_newpass[516], uchar nt_oldhash[16],
char lm_newpass[516], uchar lm_oldhash[16]);
-BOOL samr_unknown_38(struct cli_state *cli, uint16 fnum, char *srv_name);
+BOOL samr_unknown_38(struct cli_connection *con, char *srv_name);
BOOL samr_query_dom_info( POLICY_HND *domain_pol, uint16 switch_value,
SAM_UNK_CTR *ctr);
uint32 samr_enum_domains( POLICY_HND *pol,
diff --git a/source/include/rpcclient.h b/source/include/rpcclient.h
index ba284e66f0c..210567c2ced 100644
--- a/source/include/rpcclient.h
+++ b/source/include/rpcclient.h
@@ -61,8 +61,6 @@ struct nt_client_info
/************** \PIPE\lsarpc stuff ********************/
- POLICY_HND lsa_info_pol;
-
/* domain member */
DOM_SID level3_sid;
DOM_SID level5_sid;
@@ -86,4 +84,16 @@ struct client_info
enum action_type {ACTION_HEADER, ACTION_ENUMERATE, ACTION_FOOTER};
+/****************************************************************************
+ This defines the commands supported by this client
+ ****************************************************************************/
+struct command_set
+{
+ char *name;
+ void (*fn)(struct client_info*, int, char*[]);
+ char *description;
+ char compl_args[2];
+
+};
+
#endif /* _RPCCLIENT_H */
diff --git a/source/lib/util_hnd.c b/source/lib/util_hnd.c
index add040aa3d1..b895fb31c0f 100644
--- a/source/lib/util_hnd.c
+++ b/source/lib/util_hnd.c
@@ -50,11 +50,10 @@ struct samr_info
uint32 status; /* some sort of flag. best to record it. comes from opnum 0x39 */
};
-struct cli_info
+struct con_info
{
- struct cli_state *cli;
- uint16 fnum;
- void (*free)(struct cli_state*, uint16 fnum);
+ struct cli_connection *con;
+ void (*free)(struct cli_connection*);
};
static struct policy
@@ -68,7 +67,7 @@ static struct policy
union {
struct samr_info *samr;
struct reg_info *reg;
- struct cli_info *cli;
+ struct con_info *con;
} dev;
@@ -368,56 +367,50 @@ BOOL get_policy_reg_name(POLICY_HND *hnd, fstring name)
}
/****************************************************************************
- set cli state
+ set con state
****************************************************************************/
-BOOL set_policy_cli_state(POLICY_HND *hnd, struct cli_state *cli, uint16 fnum,
- void (*free_fn)(struct cli_state *, uint16))
+BOOL set_policy_con(POLICY_HND *hnd, struct cli_connection *con,
+ void (*free_fn)(struct cli_connection *))
{
struct policy *p = find_policy(hnd);
if (p && p->open)
{
- DEBUG(3,("Setting policy cli state pnum=%x\n", p->pnum));
+ DEBUG(3,("Setting policy con state pnum=%x\n", p->pnum));
- if (p->dev.cli == NULL)
+ if (p->dev.con == NULL)
{
p->type = POL_CLI_INFO;
- p->dev.cli = (struct cli_info*)malloc(sizeof(*p->dev.cli));
+ p->dev.con = (struct con_info*)malloc(sizeof(*p->dev.con));
}
- if (p->dev.cli == NULL)
+ if (p->dev.con == NULL)
{
return False;
}
- p->dev.cli->cli = cli;
- p->dev.cli->free = free_fn;
- p->dev.cli->fnum = fnum;
+ p->dev.con->con = con;
+ p->dev.con->free = free_fn;
return True;
}
- DEBUG(3,("Error setting policy cli state\n"));
+ DEBUG(3,("Error setting policy con state\n"));
return False;
}
/****************************************************************************
- get cli state
+ get con state
****************************************************************************/
-BOOL get_policy_cli_state(const POLICY_HND *hnd, struct cli_state **cli,
- uint16 *fnum)
+BOOL get_policy_con(const POLICY_HND *hnd, struct cli_connection **con)
{
struct policy *p = find_policy(hnd);
if (p != NULL && p->open)
{
- DEBUG(3,("Getting cli state pnum=%x\n", p->pnum));
+ DEBUG(3,("Getting con state pnum=%x\n", p->pnum));
- if (cli != NULL)
+ if (con != NULL)
{
- (*cli ) = p->dev.cli->cli;
- }
- if (fnum != NULL)
- {
- (*fnum) = p->dev.cli->fnum;
+ (*con ) = p->dev.con->con;
}
return True;
@@ -463,12 +456,11 @@ BOOL close_policy_hnd(POLICY_HND *hnd)
}
case POL_CLI_INFO:
{
- if (p->dev.cli->free != NULL)
+ if (p->dev.con->free != NULL)
{
- p->dev.cli->free(p->dev.cli->cli,
- p->dev.cli->fnum);
+ p->dev.con->free(p->dev.con->con);
}
- free(p->dev.cli);
+ free(p->dev.con);
break;
}
}
diff --git a/source/rpc_client/cli_connect.c b/source/rpc_client/cli_connect.c
index 39a7e50bc52..0b5d20d913d 100644
--- a/source/rpc_client/cli_connect.c
+++ b/source/rpc_client/cli_connect.c
@@ -31,22 +31,92 @@ extern int DEBUGLEVEL;
extern pstring scope;
extern pstring global_myname;
+struct cli_connection
+{
+ struct cli_state *cli;
+ uint16 fnum;
+};
+
+
+/****************************************************************************
+terminate client connection
+****************************************************************************/
+void cli_connection_free(struct cli_connection *con)
+{
+ cli_nt_session_close(con->cli, con->fnum);
+ cli_shutdown(con->cli);
+ free(con->cli);
+ free(con);
+}
+
/****************************************************************************
terminate client state
****************************************************************************/
-void cli_state_free(struct cli_state *cli, uint16 fnum)
+void cli_connection_unlink(struct cli_connection *con)
{
- cli_nt_session_close(cli, fnum);
- cli_shutdown(cli);
- free(cli);
+ if (con != NULL)
+ {
+ cli_connection_free(con);
+ }
+ return;
+}
+
+/****************************************************************************
+init client state
+****************************************************************************/
+BOOL cli_connection_init_list(char* servers, const char* pipe_name,
+ struct cli_connection **con)
+{
+ BOOL res = True;
+
+ /*
+ * allocate
+ */
+
+ (*con) = (struct cli_connection*)malloc(sizeof(**con));
+
+ if ((*con) == NULL)
+ {
+ return False;
+ }
+
+ (*con)->cli = cli_initialise(NULL);
+ (*con)->fnum = 0xffff;
+
+ if ((*con)->cli == NULL)
+ {
+ return False;
+ }
+
+ /*
+ * initialise
+ */
+
+ (*con)->cli->capabilities |= CAP_NT_SMBS | CAP_STATUS32;
+ cli_init_creds((*con)->cli, usr_creds);
+
+ (*con)->cli->use_ntlmv2 = lp_client_ntlmv2();
+
+ if (!cli_connect_serverlist((*con)->cli, servers))
+ {
+ DEBUG(0,("cli_state_init: connection failed\n"));
+ cli_connection_free((*con));
+ return False;
+ }
+
+ (*con)->cli->ntlmssp_cli_flgs = 0x0;
+
+ res = res ? cli_nt_session_open((*con)->cli, pipe_name,
+ &(*con)->fnum) : False;
+
+ return res;
}
/****************************************************************************
init client state
****************************************************************************/
-BOOL cli_state_init(const char* server_name, const char* pipe_name,
- struct cli_state **cli,
- uint16 *fnum)
+BOOL cli_connection_init(const char* server_name, const char* pipe_name,
+ struct cli_connection **con)
{
struct nmb_name calling;
struct nmb_name called;
@@ -60,9 +130,17 @@ BOOL cli_state_init(const char* server_name, const char* pipe_name,
* allocate
*/
- *cli = cli_initialise(NULL);
+ (*con) = (struct cli_connection*)malloc(sizeof(**con));
- if ((*cli) == NULL)
+ if ((*con) == NULL)
+ {
+ return False;
+ }
+
+ (*con)->cli = cli_initialise(NULL);
+ (*con)->fnum = 0xffff;
+
+ if ((*con)->cli == NULL)
{
return False;
}
@@ -71,10 +149,10 @@ BOOL cli_state_init(const char* server_name, const char* pipe_name,
* initialise
*/
- (*cli)->capabilities |= CAP_NT_SMBS | CAP_STATUS32;
- cli_init_creds(*cli, usr_creds);
+ (*con)->cli->capabilities |= CAP_NT_SMBS | CAP_STATUS32;
+ cli_init_creds((*con)->cli, usr_creds);
- (*cli)->use_ntlmv2 = lp_client_ntlmv2();
+ (*con)->cli->use_ntlmv2 = lp_client_ntlmv2();
if (resolve_srv_name(server_name, dest_host, &ip))
{
@@ -92,21 +170,21 @@ BOOL cli_state_init(const char* server_name, const char* pipe_name,
* connect
*/
- if (!cli_establish_connection((*cli),
+ if (!cli_establish_connection((*con)->cli,
dest_host, dest_ip,
&calling, &called,
"IPC$", "IPC",
False, True))
{
DEBUG(0,("cli_state_init: connection failed\n"));
- cli_shutdown((*cli));
- free(*cli);
+ cli_connection_free((*con));
return False;
}
- (*cli)->ntlmssp_cli_flgs = 0x0;
+ (*con)->cli->ntlmssp_cli_flgs = 0x0;
- res = res ? cli_nt_session_open(*cli, pipe_name, fnum) : False;
+ res = res ? cli_nt_session_open((*con)->cli, pipe_name,
+ &(*con)->fnum) : False;
return res;
}
@@ -114,11 +192,9 @@ BOOL cli_state_init(const char* server_name, const char* pipe_name,
/****************************************************************************
obtain client state
****************************************************************************/
-BOOL cli_state_get(const POLICY_HND *pol,
- struct cli_state **cli,
- uint16 *fnum)
+BOOL cli_connection_get(const POLICY_HND *pol, struct cli_connection **con)
{
- return get_policy_cli_state(pol, cli, fnum);
+ return get_policy_con(pol, con);
}
/****************************************************************************
@@ -126,29 +202,55 @@ link a child policy handle to a parent one
****************************************************************************/
BOOL cli_pol_link(POLICY_HND *to, const POLICY_HND *from)
{
- struct cli_state *cli = NULL;
- uint16 fnum = 0xffff;
+ struct cli_connection *con = NULL;
- if (!cli_state_get(from, &cli, &fnum))
+ if (!cli_connection_get(from, &con))
{
return False;
}
- return register_policy_hnd(to) &&
- set_policy_cli_state(to, cli, fnum, NULL);
+ return register_policy_hnd(to) && set_policy_con(to, con, NULL);
}
+/****************************************************************************
+get a user session key associated with a connection associated with a
+policy handle.
+****************************************************************************/
BOOL cli_get_usr_sesskey(const POLICY_HND *pol, uchar sess_key[16])
{
- struct cli_state *cli = NULL;
- uint16 fnum = 0xffff;
+ struct cli_connection *con = NULL;
- if (!cli_state_get(pol, &cli, &fnum))
+ if (!cli_connection_get(pol, &con))
{
return False;
}
- memcpy(sess_key, cli->sess_key, sizeof(cli->sess_key));
+ memcpy(sess_key, con->cli->sess_key, sizeof(con->cli->sess_key));
return True;
}
+
+/****************************************************************************
+ send a request on an rpc pipe.
+ ****************************************************************************/
+BOOL rpc_hnd_pipe_req(const POLICY_HND *hnd, uint8 op_num,
+ prs_struct *data, prs_struct *rdata)
+{
+ struct cli_connection *con = NULL;
+
+ if (!cli_connection_get(hnd, &con))
+ {
+ return False;
+ }
+
+ return rpc_con_pipe_req(con, op_num, data, rdata);
+}
+
+/****************************************************************************
+ send a request on an rpc pipe.
+ ****************************************************************************/
+BOOL rpc_con_pipe_req(struct cli_connection *con, uint8 op_num,
+ prs_struct *data, prs_struct *rdata)
+{
+ return rpc_api_pipe_req(con->cli, con->fnum, op_num, data, rdata);
+}
diff --git a/source/rpc_client/cli_lsarpc.c b/source/rpc_client/cli_lsarpc.c
index 7706d0cd83f..c8240a32996 100644
--- a/source/rpc_client/cli_lsarpc.c
+++ b/source/rpc_client/cli_lsarpc.c
@@ -39,7 +39,7 @@ BOOL get_domain_sids(const char *myname,
{
POLICY_HND pol;
fstring srv_name;
- struct cli_state cli;
+ struct cli_connection *con = NULL;
BOOL res = True;
fstring dom3;
fstring dom5;
@@ -56,7 +56,7 @@ BOOL get_domain_sids(const char *myname,
return False;
}
- if (!cli_connect_serverlist(&cli, servers))
+ if (!cli_connection_init_list(servers, PIPE_LSARPC, &con))
{
DEBUG(0,("get_domain_sids: unable to initialise client connection.\n"));
return False;
@@ -101,8 +101,7 @@ BOOL get_domain_sids(const char *myname,
res = res ? lsa_close(&pol) : False;
/* close the session */
- cli_ulogoff(&cli);
- cli_shutdown(&cli);
+ cli_connection_unlink(con);
if (res)
{
@@ -136,7 +135,7 @@ BOOL get_trust_sid_and_domain(const char* myname, char *server,
{
POLICY_HND pol;
fstring srv_name;
- struct cli_state cli;
+ struct cli_connection *con = NULL;
BOOL res = True;
BOOL res1 = True;
DOM_SID sid3;
@@ -151,7 +150,7 @@ BOOL get_trust_sid_and_domain(const char* myname, char *server,
ZERO_STRUCT(usr);
pwd_set_nullpwd(&usr.pwd);
- if (!cli_connect_serverlist(&cli, server))
+ if (!cli_connection_init_list(server, PIPE_LSARPC, &con))
{
DEBUG(0,("get_trust_sid: unable to initialise client connection.\n"));
return False;
@@ -179,8 +178,7 @@ BOOL get_trust_sid_and_domain(const char* myname, char *server,
res = res ? lsa_close(&pol) : False;
/* close the session */
- cli_ulogoff(&cli);
- cli_shutdown(&cli);
+ cli_connection_unlink(con);
if (res1)
{
@@ -224,10 +222,9 @@ BOOL lsa_open_policy(const char *server_name, POLICY_HND *hnd,
LSA_Q_OPEN_POL q_o;
LSA_SEC_QOS qos;
BOOL valid_pol = False;
- struct cli_state *cli = NULL;
- uint16 fnum = 0xffff;
+ struct cli_connection *con = NULL;
- if (!cli_state_init(server_name, PIPE_LSARPC, &cli, &fnum))
+ if (!cli_connection_init(server_name, PIPE_LSARPC, &con))
{
return False;
}
@@ -256,7 +253,7 @@ BOOL lsa_open_policy(const char *server_name, POLICY_HND *hnd,
lsa_io_q_open_pol("", &q_o, &buf, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, fnum, LSA_OPENPOLICY, &buf, &rbuf))
+ if (rpc_con_pipe_req(con, LSA_OPENPOLICY, &buf, &rbuf))
{
LSA_R_OPEN_POL r_o;
BOOL p;
@@ -277,8 +274,8 @@ BOOL lsa_open_policy(const char *server_name, POLICY_HND *hnd,
memcpy(hnd, r_o.pol.data, sizeof(hnd->data));
valid_pol = register_policy_hnd(hnd) &&
- set_policy_cli_state(hnd, cli, fnum,
- cli_state_free);
+ set_policy_con(hnd, con,
+ cli_connection_unlink);
}
}
@@ -300,10 +297,9 @@ BOOL lsa_open_policy2( const char *server_name, POLICY_HND *hnd,
LSA_SEC_QOS qos;
BOOL valid_pol = False;
- struct cli_state *cli = NULL;
- uint16 fnum = 0xffff;
+ struct cli_connection *con = NULL;
- if (!cli_state_init(server_name, PIPE_LSARPC, &cli, &fnum))
+ if (!cli_connection_init(server_name, PIPE_LSARPC, &con))
{
return False;
}
@@ -352,8 +348,8 @@ BOOL lsa_open_policy2( const char *server_name, POLICY_HND *hnd,
/* ok, at last: we're happy. return the policy handle */
memcpy(hnd, r_o.pol.data, sizeof(hnd->data));
valid_pol = register_policy_hnd(hnd) &&
- set_policy_cli_state(hnd, cli, fnum,
- cli_state_free);
+ set_policy_con(hnd, con,
+ cli_connection_unlink);
}
}
diff --git a/source/rpc_client/cli_pipe.c b/source/rpc_client/cli_pipe.c
index 08d7e422707..8ca5255203c 100644
--- a/source/rpc_client/cli_pipe.c
+++ b/source/rpc_client/cli_pipe.c
@@ -628,23 +628,6 @@ static BOOL create_rpc_request(prs_struct *rhdr, uint8 op_num, int data_len,
/****************************************************************************
send a request on an rpc pipe.
****************************************************************************/
-BOOL rpc_hnd_pipe_req(const POLICY_HND *hnd, uint8 op_num,
- prs_struct *data, prs_struct *rdata)
-{
- struct cli_state *cli = NULL;
- uint16 fnum = 0xffff;
-
- if (!cli_state_get(hnd, &cli, &fnum))
- {
- return False;
- }
-
- return rpc_api_pipe_req(cli, fnum, op_num, data, rdata);
-}
-
-/****************************************************************************
- send a request on an rpc pipe.
- ****************************************************************************/
BOOL rpc_api_pipe_req(struct cli_state *cli, uint16 fnum, uint8 op_num,
prs_struct *data, prs_struct *rdata)
{
@@ -1163,5 +1146,8 @@ close the session
void cli_nt_session_close(struct cli_state *cli, uint16 fnum)
{
- cli_close(cli, fnum);
+ if (fnum != 0xffff)
+ {
+ cli_close(cli, fnum);
+ }
}
diff --git a/source/rpc_client/cli_reg.c b/source/rpc_client/cli_reg.c
index 9242d5587ce..4f1c28a7015 100644
--- a/source/rpc_client/cli_reg.c
+++ b/source/rpc_client/cli_reg.c
@@ -42,10 +42,9 @@ BOOL reg_connect( const char* srv_name,
BOOL res = True;
uint32 reg_type = 0;
- struct cli_state *cli = NULL;
- uint16 fnum = 0xffff;
+ struct cli_connection *con = NULL;
- if (!cli_state_init(srv_name, PIPE_WINREG, &cli, &fnum))
+ if (!cli_connection_init(srv_name, PIPE_WINREG, &con))
{
return False;
}
@@ -72,7 +71,7 @@ BOOL reg_connect( const char* srv_name,
{
case HKEY_CLASSES_ROOT:
{
- res = res ? reg_open_hkcr(cli, fnum,
+ res = res ? reg_open_hkcr(con,
0x5428, 0x02000000,
reg_hnd) : False;
break;
@@ -80,7 +79,7 @@ BOOL reg_connect( const char* srv_name,
case HKEY_LOCAL_MACHINE:
{
- res = res ? reg_open_hklm(cli, fnum,
+ res = res ? reg_open_hklm(con,
0x84E0, 0x02000000,
reg_hnd) : False;
break;
@@ -88,7 +87,7 @@ BOOL reg_connect( const char* srv_name,
case HKEY_USERS:
{
- res = res ? reg_open_hku(cli, fnum,
+ res = res ? reg_open_hku(con,
0x84E0, 0x02000000,
reg_hnd) : False;
break;
@@ -103,10 +102,10 @@ BOOL reg_connect( const char* srv_name,
if (res)
{
if (!register_policy_hnd(reg_hnd) ||
- !set_policy_cli_state(reg_hnd, cli, fnum,
- cli_state_free))
+ !set_policy_con(reg_hnd, con,
+ cli_connection_unlink))
{
- cli_state_free(cli, fnum);
+ cli_connection_unlink(con);
return False;
}
}
@@ -117,7 +116,7 @@ BOOL reg_connect( const char* srv_name,
/****************************************************************************
do a REG Open Policy
****************************************************************************/
-BOOL reg_open_hkcr( struct cli_state *cli, uint16 fnum,
+BOOL reg_open_hkcr( struct cli_connection *con,
uint16 unknown_0, uint32 level,
POLICY_HND *hnd)
{
@@ -141,7 +140,7 @@ BOOL reg_open_hkcr( struct cli_state *cli, uint16 fnum,
reg_io_q_open_hkcr("", &q_o, &buf, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, fnum, REG_OPEN_HKCR, &buf, &rbuf))
+ if (rpc_con_pipe_req(con, REG_OPEN_HKCR, &buf, &rbuf))
{
REG_R_OPEN_HKCR r_o;
BOOL p;
@@ -175,7 +174,7 @@ BOOL reg_open_hkcr( struct cli_state *cli, uint16 fnum,
/****************************************************************************
do a REG Open Policy
****************************************************************************/
-BOOL reg_open_hklm( struct cli_state *cli, uint16 fnum,
+BOOL reg_open_hklm( struct cli_connection *con,
uint16 unknown_0, uint32 level,
POLICY_HND *hnd)
{
@@ -199,7 +198,7 @@ BOOL reg_open_hklm( struct cli_state *cli, uint16 fnum,
reg_io_q_open_hklm("", &q_o, &buf, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, fnum, REG_OPEN_HKLM, &buf, &rbuf))
+ if (rpc_con_pipe_req(con, REG_OPEN_HKLM, &buf, &rbuf))
{
REG_R_OPEN_HKLM r_o;
BOOL p;
@@ -233,7 +232,7 @@ BOOL reg_open_hklm( struct cli_state *cli, uint16 fnum,
/****************************************************************************
do a REG Open HKU
****************************************************************************/
-BOOL reg_open_hku( struct cli_state *cli, uint16 fnum,
+BOOL reg_open_hku( struct cli_connection *con,
uint16 unknown_0, uint32 level,
POLICY_HND *hnd)
{
@@ -257,7 +256,7 @@ BOOL reg_open_hku( struct cli_state *cli, uint16 fnum,
reg_io_q_open_hku("", &q_o, &buf, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, fnum, REG_OPEN_HKU, &buf, &rbuf))
+ if (rpc_con_pipe_req(con, REG_OPEN_HKU, &buf, &rbuf))
{
REG_R_OPEN_HKU r_o;
BOOL p;
@@ -1053,10 +1052,9 @@ BOOL reg_open_entry( POLICY_HND *hnd,
if (p)
{
- struct cli_state *cli = NULL;
- uint16 fnum = 0xffff;
+ struct cli_connection *con = NULL;
- if (!cli_state_get(hnd, &cli, &fnum))
+ if (!cli_connection_get(hnd, &con))
{
return False;
}
@@ -1155,10 +1153,9 @@ BOOL reg_shutdown(const char *srv_name,
REG_Q_SHUTDOWN q_o;
BOOL valid_shutdown = False;
- struct cli_state *cli = NULL;
- uint16 fnum = 0xffff;
+ struct cli_connection *con = NULL;
- if (!cli_state_init(srv_name, PIPE_LSARPC, &cli, &fnum))
+ if (!cli_connection_init(srv_name, PIPE_LSARPC, &con))
{
return False;
}
@@ -1178,7 +1175,7 @@ BOOL reg_shutdown(const char *srv_name,
reg_io_q_shutdown("", &q_o, &buf, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, fnum, REG_SHUTDOWN, &buf, &rbuf))
+ if (rpc_con_pipe_req(con, REG_SHUTDOWN, &buf, &rbuf))
{
REG_R_SHUTDOWN r_o;
BOOL p;
@@ -1204,7 +1201,7 @@ BOOL reg_shutdown(const char *srv_name,
prs_mem_free(&rbuf);
prs_mem_free(&buf );
- cli_state_free(cli, fnum);
+ cli_connection_unlink(con);
return valid_shutdown;
}
diff --git a/source/rpc_client/cli_samr.c b/source/rpc_client/cli_samr.c
index 86f78d18168..f4308c21078 100644
--- a/source/rpc_client/cli_samr.c
+++ b/source/rpc_client/cli_samr.c
@@ -31,29 +31,10 @@
extern int DEBUGLEVEL;
-#if 0
- if (p)
- {
- /* ok, at last: we're happy. return the policy handle */
- memcpy(hnd, r_o.pol.data, sizeof(hnd->data));
- valid_pol = register_policy_hnd(hnd) &&
- set_policy_cli_state(hnd, cli, fnum,
- cli_state_free);
- }
-
- struct cli_state *cli = NULL;
- uint16 fnum = 0xffff;
-
- if (!cli_state_get(connect_pol, &cli, &fnum))
- {
- return False;
- }
-#endif
-
/****************************************************************************
do a SAMR change user password command
****************************************************************************/
-BOOL samr_chgpasswd_user( struct cli_state *cli, uint16 fnum,
+BOOL samr_chgpasswd_user( struct cli_connection *con,
char *srv_name, char *user_name,
char nt_newpass[516], uchar nt_oldhash[16],
char lm_newpass[516], uchar lm_oldhash[16])
@@ -80,7 +61,7 @@ BOOL samr_chgpasswd_user( struct cli_state *cli, uint16 fnum,
samr_io_q_chgpasswd_user("", &q_e, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, fnum, SAMR_CHGPASSWD_USER, &data, &rdata))
+ if (rpc_con_pipe_req(con, SAMR_CHGPASSWD_USER, &data, &rdata))
{
SAMR_R_CHGPASSWD_USER r_e;
BOOL p;
@@ -104,7 +85,7 @@ BOOL samr_chgpasswd_user( struct cli_state *cli, uint16 fnum,
prs_mem_free(&data );
prs_mem_free(&rdata );
- cli_state_free(cli, fnum);
+ cli_connection_unlink(con);
return valid_pwc;
}
@@ -113,7 +94,7 @@ BOOL samr_chgpasswd_user( struct cli_state *cli, uint16 fnum,
/****************************************************************************
do a SAMR unknown 0x38 command
****************************************************************************/
-BOOL samr_unknown_38(struct cli_state *cli, uint16 fnum, char *srv_name)
+BOOL samr_unknown_38(struct cli_connection *con, char *srv_name)
{
prs_struct data;
prs_struct rdata;
@@ -134,7 +115,7 @@ BOOL samr_unknown_38(struct cli_state *cli, uint16 fnum, char *srv_name)
samr_io_q_unknown_38("", &q_e, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, fnum, SAMR_GET_DOM_PWINFO, &data, &rdata))
+ if (rpc_con_pipe_req(con, SAMR_GET_DOM_PWINFO, &data, &rdata))
{
SAMR_R_UNKNOWN_38 r_e;
BOOL p;
@@ -639,10 +620,9 @@ BOOL samr_connect( const char *srv_name, uint32 unknown_0,
SAMR_Q_CONNECT q_o;
BOOL valid_pol = False;
- struct cli_state *cli = NULL;
- uint16 fnum = 0xffff;
+ struct cli_connection *con = NULL;
- if (!cli_state_init(srv_name, PIPE_SAMR, &cli, &fnum))
+ if (!cli_connection_init(srv_name, PIPE_SAMR, &con))
{
return False;
}
@@ -664,7 +644,7 @@ BOOL samr_connect( const char *srv_name, uint32 unknown_0,
samr_io_q_connect("", &q_o, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, fnum, SAMR_CONNECT, &data, &rdata))
+ if (rpc_con_pipe_req(con, SAMR_CONNECT, &data, &rdata))
{
SAMR_R_CONNECT r_o;
BOOL p;
@@ -683,8 +663,8 @@ BOOL samr_connect( const char *srv_name, uint32 unknown_0,
{
memcpy(connect_pol, &r_o.connect_pol, sizeof(r_o.connect_pol));
valid_pol = register_policy_hnd(connect_pol) &&
- set_policy_cli_state(connect_pol, cli, fnum,
- cli_state_free);
+ set_policy_con(connect_pol, con,
+ cli_connection_unlink);
}
}
diff --git a/source/rpc_client/cli_svcctl.c b/source/rpc_client/cli_svcctl.c
index ed470f57580..b284b2661e1 100644
--- a/source/rpc_client/cli_svcctl.c
+++ b/source/rpc_client/cli_svcctl.c
@@ -43,10 +43,9 @@ BOOL svc_open_sc_man( const char *srv_name, char *db_name,
SVC_Q_OPEN_SC_MAN q_o;
BOOL valid_pol = False;
- struct cli_state *cli = NULL;
- uint16 fnum = 0xffff;
+ struct cli_connection *con = NULL;
- if (!cli_state_init(srv_name, PIPE_SVCCTL, &cli, &fnum))
+ if (!cli_connection_init(srv_name, PIPE_SVCCTL, &con))
{
return False;
}
@@ -66,7 +65,7 @@ BOOL svc_open_sc_man( const char *srv_name, char *db_name,
svc_io_q_open_sc_man("", &q_o, &buf, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, fnum, SVC_OPEN_SC_MAN, &buf, &rbuf))
+ if (rpc_con_pipe_req(con, SVC_OPEN_SC_MAN, &buf, &rbuf))
{
SVC_R_OPEN_SC_MAN r_o;
BOOL p;
@@ -89,8 +88,8 @@ BOOL svc_open_sc_man( const char *srv_name, char *db_name,
memcpy(hnd, r_o.pol.data, sizeof(hnd->data));
valid_pol = True;
valid_pol = register_policy_hnd(hnd) &&
- set_policy_cli_state(hnd, cli, fnum,
- cli_state_free);
+ set_policy_con(hnd, con,
+ cli_connection_unlink);
}
}
@@ -114,10 +113,9 @@ BOOL svc_open_service( POLICY_HND *scm_hnd,
SVC_Q_OPEN_SERVICE q_o;
BOOL valid_pol = False;
- struct cli_state *cli = NULL;
- uint16 fnum = 0xffff;
+ struct cli_connection *con = NULL;
- if (!cli_state_get(scm_hnd, &cli, &fnum))
+ if (!cli_connection_get(scm_hnd, &con))
{
return False;
}
@@ -137,7 +135,7 @@ BOOL svc_open_service( POLICY_HND *scm_hnd,
svc_io_q_open_service("", &q_o, &buf, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, fnum, SVC_OPEN_SERVICE, &buf, &rbuf))
+ if (rpc_con_pipe_req(con, SVC_OPEN_SERVICE, &buf, &rbuf))
{
SVC_R_OPEN_SERVICE r_o;
BOOL p;
@@ -159,8 +157,7 @@ BOOL svc_open_service( POLICY_HND *scm_hnd,
/* ok, at last: we're happy. return the policy handle */
memcpy(hnd, r_o.pol.data, sizeof(hnd->data));
valid_pol = register_policy_hnd(hnd) &&
- set_policy_cli_state(hnd, cli, fnum,
- NULL);
+ set_policy_con(hnd, con, NULL);
}
}
@@ -185,10 +182,9 @@ BOOL svc_enum_svcs( POLICY_HND *hnd,
SVC_Q_ENUM_SVCS_STATUS q_o;
BOOL valid_pol = False;
- struct cli_state *cli = NULL;
- uint16 fnum = 0xffff;
+ struct cli_connection *con = NULL;
- if (!cli_state_get(hnd, &cli, &fnum))
+ if (!cli_connection_get(hnd, &con))
{
return False;
}
@@ -213,7 +209,7 @@ BOOL svc_enum_svcs( POLICY_HND *hnd,
svc_io_q_enum_svcs_status("", &q_o, &buf, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, fnum, SVC_ENUM_SVCS_STATUS, &buf, &rbuf))
+ if (rpc_con_pipe_req(con, SVC_ENUM_SVCS_STATUS, &buf, &rbuf))
{
SVC_R_ENUM_SVCS_STATUS r_o;
BOOL p;
@@ -266,10 +262,9 @@ BOOL svc_stop_service( POLICY_HND *hnd,
SVC_Q_STOP_SERVICE q_c;
BOOL valid_cfg = False;
- struct cli_state *cli = NULL;
- uint16 fnum = 0xffff;
+ struct cli_connection *con = NULL;
- if (!cli_state_get(hnd, &cli, &fnum))
+ if (!cli_connection_get(hnd, &con))
{
return False;
}
@@ -290,7 +285,7 @@ BOOL svc_stop_service( POLICY_HND *hnd,
svc_io_q_stop_service("", &q_c, &buf, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, fnum, SVC_STOP_SERVICE, &buf, &rbuf))
+ if (rpc_con_pipe_req(con, SVC_STOP_SERVICE, &buf, &rbuf))
{
SVC_R_STOP_SERVICE r_c;
BOOL p;
@@ -332,10 +327,9 @@ BOOL svc_start_service( POLICY_HND *hnd,
SVC_Q_START_SERVICE q_c;
BOOL valid_cfg = False;
- struct cli_state *cli = NULL;
- uint16 fnum = 0xffff;
+ struct cli_connection *con = NULL;
- if (!cli_state_get(hnd, &cli, &fnum))
+ if (!cli_connection_get(hnd, &con))
{
return False;
}
@@ -356,7 +350,7 @@ BOOL svc_start_service( POLICY_HND *hnd,
svc_io_q_start_service("", &q_c, &buf, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, fnum, SVC_START_SERVICE, &buf, &rbuf))
+ if (rpc_con_pipe_req(con, SVC_START_SERVICE, &buf, &rbuf))
{
SVC_R_START_SERVICE r_c;
BOOL p;
@@ -398,10 +392,9 @@ BOOL svc_query_svc_cfg( POLICY_HND *hnd,
SVC_Q_QUERY_SVC_CONFIG q_c;
BOOL valid_cfg = False;
- struct cli_state *cli = NULL;
- uint16 fnum = 0xffff;
+ struct cli_connection *con = NULL;
- if (!cli_state_get(hnd, &cli, &fnum))
+ if (!cli_connection_get(hnd, &con))
{
return False;
}
@@ -422,7 +415,7 @@ BOOL svc_query_svc_cfg( POLICY_HND *hnd,
svc_io_q_query_svc_config("", &q_c, &buf, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, fnum, SVC_QUERY_SVC_CONFIG, &buf, &rbuf))
+ if (rpc_con_pipe_req(con, SVC_QUERY_SVC_CONFIG, &buf, &rbuf))
{
SVC_R_QUERY_SVC_CONFIG r_c;
BOOL p;
@@ -465,10 +458,9 @@ BOOL svc_close(POLICY_HND *hnd)
SVC_Q_CLOSE q_c;
BOOL valid_close = False;
- struct cli_state *cli = NULL;
- uint16 fnum = 0xffff;
+ struct cli_connection *con = NULL;
- if (!cli_state_get(hnd, &cli, &fnum))
+ if (!cli_connection_get(hnd, &con))
{
return False;
}
@@ -489,7 +481,7 @@ BOOL svc_close(POLICY_HND *hnd)
svc_io_q_close("", &q_c, &buf, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, fnum, SVC_CLOSE, &buf, &rbuf))
+ if (rpc_con_pipe_req(con, SVC_CLOSE, &buf, &rbuf))
{
SVC_R_CLOSE r_c;
BOOL p;
@@ -553,10 +545,9 @@ BOOL svc_change_svc_cfg( POLICY_HND *hnd,
SVC_Q_CHANGE_SVC_CONFIG q_c;
BOOL valid_cfg = False;
- struct cli_state *cli = NULL;
- uint16 fnum = 0xffff;
+ struct cli_connection *con = NULL;
- if (!cli_state_get(hnd, &cli, &fnum))
+ if (!cli_connection_get(hnd, &con))
{
return False;
}
@@ -583,7 +574,7 @@ BOOL svc_change_svc_cfg( POLICY_HND *hnd,
svc_io_q_change_svc_config("", &q_c, &buf, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, fnum, SVC_CHANGE_SVC_CONFIG, &buf, &rbuf))
+ if (rpc_con_pipe_req(con, SVC_CHANGE_SVC_CONFIG, &buf, &rbuf))
{
SVC_R_CHANGE_SVC_CONFIG r_c;
BOOL p;
diff --git a/source/rpc_server/srv_lsa_hnd.c b/source/rpc_server/srv_lsa_hnd.c
index add040aa3d1..b895fb31c0f 100644
--- a/source/rpc_server/srv_lsa_hnd.c
+++ b/source/rpc_server/srv_lsa_hnd.c
@@ -50,11 +50,10 @@ struct samr_info
uint32 status; /* some sort of flag. best to record it. comes from opnum 0x39 */
};
-struct cli_info
+struct con_info
{
- struct cli_state *cli;
- uint16 fnum;
- void (*free)(struct cli_state*, uint16 fnum);
+ struct cli_connection *con;
+ void (*free)(struct cli_connection*);
};
static struct policy
@@ -68,7 +67,7 @@ static struct policy
union {
struct samr_info *samr;
struct reg_info *reg;
- struct cli_info *cli;
+ struct con_info *con;
} dev;
@@ -368,56 +367,50 @@ BOOL get_policy_reg_name(POLICY_HND *hnd, fstring name)
}
/****************************************************************************
- set cli state
+ set con state
****************************************************************************/
-BOOL set_policy_cli_state(POLICY_HND *hnd, struct cli_state *cli, uint16 fnum,
- void (*free_fn)(struct cli_state *, uint16))
+BOOL set_policy_con(POLICY_HND *hnd, struct cli_connection *con,
+ void (*free_fn)(struct cli_connection *))
{
struct policy *p = find_policy(hnd);
if (p && p->open)
{
- DEBUG(3,("Setting policy cli state pnum=%x\n", p->pnum));
+ DEBUG(3,("Setting policy con state pnum=%x\n", p->pnum));
- if (p->dev.cli == NULL)
+ if (p->dev.con == NULL)
{
p->type = POL_CLI_INFO;
- p->dev.cli = (struct cli_info*)malloc(sizeof(*p->dev.cli));
+ p->dev.con = (struct con_info*)malloc(sizeof(*p->dev.con));
}
- if (p->dev.cli == NULL)
+ if (p->dev.con == NULL)
{
return False;
}
- p->dev.cli->cli = cli;
- p->dev.cli->free = free_fn;
- p->dev.cli->fnum = fnum;
+ p->dev.con->con = con;
+ p->dev.con->free = free_fn;
return True;
}
- DEBUG(3,("Error setting policy cli state\n"));
+ DEBUG(3,("Error setting policy con state\n"));
return False;
}
/****************************************************************************
- get cli state
+ get con state
****************************************************************************/
-BOOL get_policy_cli_state(const POLICY_HND *hnd, struct cli_state **cli,
- uint16 *fnum)
+BOOL get_policy_con(const POLICY_HND *hnd, struct cli_connection **con)
{
struct policy *p = find_policy(hnd);
if (p != NULL && p->open)
{
- DEBUG(3,("Getting cli state pnum=%x\n", p->pnum));
+ DEBUG(3,("Getting con state pnum=%x\n", p->pnum));
- if (cli != NULL)
+ if (con != NULL)
{
- (*cli ) = p->dev.cli->cli;
- }
- if (fnum != NULL)
- {
- (*fnum) = p->dev.cli->fnum;
+ (*con ) = p->dev.con->con;
}
return True;
@@ -463,12 +456,11 @@ BOOL close_policy_hnd(POLICY_HND *hnd)
}
case POL_CLI_INFO:
{
- if (p->dev.cli->free != NULL)
+ if (p->dev.con->free != NULL)
{
- p->dev.cli->free(p->dev.cli->cli,
- p->dev.cli->fnum);
+ p->dev.con->free(p->dev.con->con);
}
- free(p->dev.cli);
+ free(p->dev.con);
break;
}
}
diff --git a/source/rpcclient/cmd_samr.c b/source/rpcclient/cmd_samr.c
index f436e1b22fc..9c0bb9ce7df 100644
--- a/source/rpcclient/cmd_samr.c
+++ b/source/rpcclient/cmd_samr.c
@@ -33,7 +33,6 @@ extern int DEBUGLEVEL;
#define DEBUG_TESTING
-extern struct cli_state *smb_cli;
extern struct user_credentials *usr_creds;
extern FILE* out_hnd;
@@ -121,7 +120,6 @@ SAM password change
****************************************************************************/
void cmd_sam_ntchange_pwd(struct client_info *info, int argc, char *argv[])
{
- uint16 fnum;
fstring srv_name;
fstring domain;
fstring sid;
@@ -136,6 +134,8 @@ void cmd_sam_ntchange_pwd(struct client_info *info, int argc, char *argv[])
uchar lm_hshhash[16];
uchar lm_oldhash[16];
+ struct cli_connection *con = NULL;
+
sid_to_string(sid, &info->dom.level5_sid);
fstrcpy(domain, info->dom.level5_dom);
@@ -158,8 +158,7 @@ void cmd_sam_ntchange_pwd(struct client_info *info, int argc, char *argv[])
E_old_pw_hash(lm_newhash, lm_oldhash, lm_hshhash);
E_old_pw_hash(lm_newhash, nt_oldhash, nt_hshhash);
- cli_nt_set_ntlmssp_flgs(smb_cli,
- NTLMSSP_NEGOTIATE_UNICODE |
+ usr_creds->ntlmssp_flags = NTLMSSP_NEGOTIATE_UNICODE |
NTLMSSP_NEGOTIATE_OEM |
NTLMSSP_NEGOTIATE_SIGN |
NTLMSSP_NEGOTIATE_SEAL |
@@ -167,21 +166,21 @@ void cmd_sam_ntchange_pwd(struct client_info *info, int argc, char *argv[])
NTLMSSP_NEGOTIATE_NTLM |
NTLMSSP_NEGOTIATE_ALWAYS_SIGN |
NTLMSSP_NEGOTIATE_00001000 |
- NTLMSSP_NEGOTIATE_00002000);
+ NTLMSSP_NEGOTIATE_00002000;
/* open SAMR session. */
- res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR, &fnum) : False;
+ res = res ? cli_connection_init(srv_name, PIPE_SAMR, &con) : False;
/* establish a connection. */
- res = res ? samr_unknown_38(smb_cli, fnum, srv_name) : False;
+ res = res ? samr_unknown_38(con, srv_name) : False;
/* establish a connection. */
- res = res ? samr_chgpasswd_user(smb_cli, fnum,
+ res = res ? samr_chgpasswd_user(con,
srv_name, usr_creds->user_name,
nt_newpass, nt_hshhash,
lm_newpass, lm_hshhash) : False;
/* close the session */
- cli_nt_session_close(smb_cli, fnum);
+ cli_connection_unlink(con);
if (res)
{
@@ -199,7 +198,7 @@ experimental SAM encryted rpc test connection
****************************************************************************/
void cmd_sam_test(struct client_info *info, int argc, char *argv[])
{
- uint16 fnum;
+ struct cli_connection *con = NULL;
fstring srv_name;
fstring domain;
fstring sid;
@@ -221,8 +220,7 @@ void cmd_sam_test(struct client_info *info, int argc, char *argv[])
report(out_hnd, "SAM Encryption Test\n");
- cli_nt_set_ntlmssp_flgs(smb_cli,
- NTLMSSP_NEGOTIATE_UNICODE |
+ usr_creds->ntlmssp_flags = NTLMSSP_NEGOTIATE_UNICODE |
NTLMSSP_NEGOTIATE_OEM |
NTLMSSP_NEGOTIATE_SIGN |
NTLMSSP_NEGOTIATE_SEAL |
@@ -230,16 +228,13 @@ void cmd_sam_test(struct client_info *info, int argc, char *argv[])
NTLMSSP_NEGOTIATE_NTLM |
NTLMSSP_NEGOTIATE_ALWAYS_SIGN |
NTLMSSP_NEGOTIATE_00001000 |
- NTLMSSP_NEGOTIATE_00002000);
+ NTLMSSP_NEGOTIATE_00002000;
/* open SAMR session. */
- res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR, &fnum) : False;
-
- /* establish a connection. */
- res = res ? samr_unknown_38(smb_cli, fnum, srv_name) : False;
+ res = res ? cli_connection_init(srv_name, PIPE_SAMR, &con) : False;
/* close the session */
- cli_nt_session_close(smb_cli, fnum);
+ cli_connection_unlink(con);
if (res)
{
diff --git a/source/rpcclient/rpcclient.c b/source/rpcclient/rpcclient.c
index 189f8fa7344..aaf872683af 100644
--- a/source/rpcclient/rpcclient.c
+++ b/source/rpcclient/rpcclient.c
@@ -70,14 +70,7 @@ FILE *out_hnd;
/****************************************************************************
This defines the commands supported by this client
****************************************************************************/
-struct
-{
- char *name;
- void (*fn)(struct client_info*, int, char*[]);
- char *description;
- char compl_args[2];
-}
-commands[] =
+struct command_set commands[] =
{
/*
* eventlog