summaryrefslogtreecommitdiff
path: root/source3/rpc_client/cli_connect.c
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1999-11-29 21:47:14 +0000
committerLuke Leighton <lkcl@samba.org>1999-11-29 21:47:14 +0000
commit0d44ff9a765f2e89be8b0ee99ec7c907e7c225c3 (patch)
treed0c87722e19013a188c29096d35205ba675c7d89 /source3/rpc_client/cli_connect.c
parent44334ace985b55295dfc1c93e92d46e01d39fb97 (diff)
downloadsamba-0d44ff9a765f2e89be8b0ee99ec7c907e7c225c3.tar.gz
samba-0d44ff9a765f2e89be8b0ee99ec7c907e7c225c3.tar.bz2
samba-0d44ff9a765f2e89be8b0ee99ec7c907e7c225c3.zip
attempting to resolve the issue that multiple servers often specified in
parameters to connect to \PIPE\NETLOGON. (This used to be commit d1986ade30bdcac1f49707221a3e5a5ae597ce62)
Diffstat (limited to 'source3/rpc_client/cli_connect.c')
-rw-r--r--source3/rpc_client/cli_connect.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/source3/rpc_client/cli_connect.c b/source3/rpc_client/cli_connect.c
index fc6f5c8c44..6b7fba41c5 100644
--- a/source3/rpc_client/cli_connect.c
+++ b/source3/rpc_client/cli_connect.c
@@ -50,6 +50,20 @@ void init_connections(void)
num_cons = 0;
}
+static void free_con_array(uint32 num_entries, struct cli_connection **entries)
+{
+ void(*fn)(void*) = (void(*)(void*))&cli_connection_free;
+ free_void_array(num_entries, (void**)entries, *fn);
+}
+
+static struct cli_connection* add_con_to_array(uint32 *len,
+ struct cli_connection ***array,
+ struct cli_connection *con)
+{
+ return (struct cli_connection*)add_item_to_array(len,
+ (void***)array, (void*)con);
+
+}
void free_connections(void)
{
free_con_array(num_cons, con_list);
@@ -286,6 +300,10 @@ policy handle.
****************************************************************************/
BOOL cli_get_con_sesskey(struct cli_connection *con, uchar sess_key[16])
{
+ if (con == NULL)
+ {
+ return False;
+ }
memcpy(sess_key, con->cli->sess_key, sizeof(con->cli->sess_key));
return True;
@@ -295,6 +313,30 @@ BOOL cli_get_con_sesskey(struct cli_connection *con, uchar sess_key[16])
get a user session key associated with a connection associated with a
policy handle.
****************************************************************************/
+BOOL cli_con_get_srvname(struct cli_connection *con, char *srv_name)
+{
+ if (con == NULL)
+ {
+ return False;
+ }
+
+ if (strnequal("\\\\", con->cli->desthost, 2))
+ {
+ fstrcpy(srv_name, con->cli->desthost);
+ }
+ else
+ {
+ fstrcpy(srv_name, "\\\\");
+ fstrcat(srv_name, con->cli->desthost);
+ }
+
+ return True;
+}
+
+/****************************************************************************
+get a user session key associated with a connection associated with a
+policy handle.
+****************************************************************************/
BOOL cli_get_sesskey(const POLICY_HND *pol, uchar sess_key[16])
{
struct cli_connection *con = NULL;