diff options
author | Luke Leighton <lkcl@samba.org> | 1999-12-02 19:03:23 +0000 |
---|---|---|
committer | Luke Leighton <lkcl@samba.org> | 1999-12-02 19:03:23 +0000 |
commit | 98e28ee14ce7ffe93777315891a6626ac7a0828a (patch) | |
tree | aa4849a6d751ae5a978ed31e125d06c8e4e561c0 /source3/rpc_client | |
parent | 5988d0cdae19d014a5a011de83c48326e82860b6 (diff) | |
download | samba-98e28ee14ce7ffe93777315891a6626ac7a0828a.tar.gz samba-98e28ee14ce7ffe93777315891a6626ac7a0828a.tar.bz2 samba-98e28ee14ce7ffe93777315891a6626ac7a0828a.zip |
cleaning up: removing those horrible references to server list
functions (cli_net_use_addlist()). needed originally because
there was no get_dc_any_name() function.
(This used to be commit 3a2b920ea2e6704b2574f404e1e41c7cfc0f96b2)
Diffstat (limited to 'source3/rpc_client')
-rw-r--r-- | source3/rpc_client/cli_connect.c | 59 | ||||
-rw-r--r-- | source3/rpc_client/cli_login.c | 28 | ||||
-rw-r--r-- | source3/rpc_client/cli_lsarpc.c | 18 | ||||
-rw-r--r-- | source3/rpc_client/cli_use.c | 40 |
4 files changed, 14 insertions, 131 deletions
diff --git a/source3/rpc_client/cli_connect.c b/source3/rpc_client/cli_connect.c index 6faf7cc28b..6f63d5356f 100644 --- a/source3/rpc_client/cli_connect.c +++ b/source3/rpc_client/cli_connect.c @@ -73,40 +73,6 @@ void free_connections(void) init_connections(); } -static struct cli_connection *cli_con_getlist(char* servers, - const char* pipe_name) -{ - struct cli_connection *con = NULL; - - con = (struct cli_connection*)malloc(sizeof(*con)); - - if (con == NULL) - { - return NULL; - } - - memset(con, 0, sizeof(*con)); - - if (servers != NULL) - { - con->srv_name = strdup(servers); - } - if (pipe_name != NULL) - { - con->pipe_name = strdup(pipe_name); - } - - con->cli = cli_net_use_addlist(servers, usr_creds); - - if (con->cli == NULL) - { - cli_connection_free(con); - return NULL; - } - add_con_to_array(&num_cons, &con_list, con); - return con; -} - static struct cli_connection *cli_con_get(const char* srv_name, const char* pipe_name) { @@ -211,31 +177,6 @@ void cli_connection_unlink(struct cli_connection *con) /**************************************************************************** init client state ****************************************************************************/ -BOOL cli_connection_init_list(char* servers, const char* pipe_name, - struct cli_connection **con) -{ - BOOL res = True; - - /* - * allocate - */ - - *con = cli_con_getlist(servers, pipe_name); - - if ((*con) == NULL) - { - return False; - } - - res = res ? cli_nt_session_open((*con)->cli, pipe_name, - &(*con)->fnum) : False; - - return res; -} - -/**************************************************************************** -init client state -****************************************************************************/ BOOL cli_connection_init(const char* srv_name, const char* pipe_name, struct cli_connection **con) { diff --git a/source3/rpc_client/cli_login.c b/source3/rpc_client/cli_login.c index a9244c886e..9b26ca60f4 100644 --- a/source3/rpc_client/cli_login.c +++ b/source3/rpc_client/cli_login.c @@ -29,11 +29,10 @@ extern int DEBUGLEVEL; Initialize domain session credentials. ****************************************************************************/ -uint32 cli_nt_setup_creds( char* servers, const char* myhostname, +uint32 cli_nt_setup_creds( const char* srv_name, const char* myhostname, const char* trust_acct, unsigned char trust_pwd[16], - uint16 sec_chan, - char *srv_name) + uint16 sec_chan) { DOM_CHAL clnt_chal; DOM_CHAL srv_chal; @@ -42,25 +41,12 @@ uint32 cli_nt_setup_creds( char* servers, const char* myhostname, uint8 sess_key[16]; DOM_CRED clnt_cred; - /******************* make connection **********************/ - struct cli_connection *con = NULL; - - if (!cli_connection_init_list(servers, PIPE_NETLOGON, &con)) - { - return False; - } - - if (!cli_con_get_srvname(con, srv_name)) - { - return False; - } - /******************* Request Challenge ********************/ generate_random_buffer( clnt_chal.data, 8, False); /* send a client challenge; receive a server challenge */ - ret = cli_net_req_chal(servers, myhostname, &clnt_chal, &srv_chal); + ret = cli_net_req_chal(srv_name, myhostname, &clnt_chal, &srv_chal); if (ret != 0) { DEBUG(1,("cli_nt_setup_creds: request challenge failed\n")); @@ -247,7 +233,7 @@ BOOL cli_nt_logoff(const char* srv_name, const char* myhostname, /**************************************************************************** NT SAM database sync ****************************************************************************/ -BOOL net_sam_sync(char* servers, const char* myhostname, +BOOL net_sam_sync(const char* srv_name, const char* myhostname, const char* trust_acct, uchar trust_passwd[16], SAM_DELTA_HDR hdr_deltas[MAX_SAM_DELTAS], @@ -255,17 +241,15 @@ BOOL net_sam_sync(char* servers, const char* myhostname, uint32 *num_deltas) { BOOL res = True; - fstring srv_name; *num_deltas = 0; DEBUG(5,("Attempting SAM sync with PDC: %s\n", srv_name)); - res = res ? cli_nt_setup_creds( servers, myhostname, + res = res ? cli_nt_setup_creds( srv_name, myhostname, trust_acct, - trust_passwd, SEC_CHAN_BDC, - srv_name) == 0x0 : False; + trust_passwd, SEC_CHAN_BDC) == 0x0 : False; memset(trust_passwd, 0, 16); diff --git a/source3/rpc_client/cli_lsarpc.c b/source3/rpc_client/cli_lsarpc.c index e9bb175c83..665383ca10 100644 --- a/source3/rpc_client/cli_lsarpc.c +++ b/source3/rpc_client/cli_lsarpc.c @@ -35,12 +35,13 @@ extern int DEBUGLEVEL; obtain the sid from the PDC. do some verification along the way... ****************************************************************************/ BOOL get_domain_sids(const char *myname, - DOM_SID *sid3, DOM_SID *sid5, char *servers) + DOM_SID *sid3, DOM_SID *sid5, char *domain) { POLICY_HND pol; fstring srv_name; struct cli_connection *con = NULL; BOOL res = True; + BOOL res1 = True; fstring dom3; fstring dom5; extern struct user_credentials *usr_creds; @@ -56,9 +57,8 @@ BOOL get_domain_sids(const char *myname, return False; } - if (!cli_connection_init_list(servers, PIPE_LSARPC, &con)) + if (!get_any_dc_name(domain, srv_name)) { - DEBUG(0,("get_domain_sids: unable to initialise client connection.\n")); return False; } @@ -78,23 +78,19 @@ BOOL get_domain_sids(const char *myname, ZERO_STRUCTP(sid5); } - fstrcpy(srv_name, "\\\\"); - fstrcat(srv_name, myname); - strupper(srv_name); - /* lookup domain controller; receive a policy handle */ res = res ? lsa_open_policy(srv_name, &pol, False) : False; if (sid3 != NULL) { /* send client info query, level 3. receive domain name and sid */ - res = res ? lsa_query_info_pol(&pol, 3, dom3, sid3) : False; + res1 = res ? lsa_query_info_pol(&pol, 3, dom3, sid3) : False; } if (sid5 != NULL) { /* send client info query, level 5. receive domain name and sid */ - res = res ? lsa_query_info_pol(&pol, 5, dom5, sid5) : False; + res1 = res1 ? lsa_query_info_pol(&pol, 5, dom5, sid5) : False; } /* close policy handle */ @@ -103,7 +99,7 @@ BOOL get_domain_sids(const char *myname, /* close the session */ cli_connection_unlink(con); - if (res) + if (res1) { pstring sid; DEBUG(2,("LSA Query Info Policy\n")); @@ -126,6 +122,7 @@ BOOL get_domain_sids(const char *myname, return res; } +#if 0 /**************************************************************************** obtain a sid and domain name from a Domain Controller. ****************************************************************************/ @@ -210,6 +207,7 @@ BOOL get_trust_sid_and_domain(const char* myname, char *server, return res1; } +#endif /**************************************************************************** do a LSA Open Policy diff --git a/source3/rpc_client/cli_use.c b/source3/rpc_client/cli_use.c index 69e46c081b..5ae722d6ad 100644 --- a/source3/rpc_client/cli_use.c +++ b/source3/rpc_client/cli_use.c @@ -198,46 +198,6 @@ static struct cli_use *cli_use_get(const char* srv_name, /**************************************************************************** init client state ****************************************************************************/ -struct cli_state *cli_net_use_addlist(char* servers, - const struct user_credentials *usr_creds) -{ - struct cli_use *cli = cli_find(servers, usr_creds); - - if (cli != NULL) - { - cli->num_users++; - return cli->cli; - } - - /* - * allocate - */ - - cli = cli_use_get(servers, usr_creds); - - if (cli == NULL) - { - return NULL; - } - - if (!cli_connect_serverlist(cli->cli, servers)) - { - DEBUG(0,("cli_net_use_addlist: connection failed\n")); - cli_use_free(cli); - return NULL; - } - - cli->cli->ntlmssp_cli_flgs = 0x0; - - add_cli_to_array(&num_clis, &clis, cli); - cli->num_users++; - - return cli->cli; -} - -/**************************************************************************** -init client state -****************************************************************************/ struct cli_state *cli_net_use_add(const char* srv_name, const struct user_credentials *usr_creds) { |