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 | |
parent | 5988d0cdae19d014a5a011de83c48326e82860b6 (diff) | |
download | samba-98e28ee14ce7ffe93777315891a6626ac7a0828a.tar.gz samba-98e28ee14ce7ffe93777315891a6626ac7a0828a.tar.xz 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)
-rw-r--r-- | source3/include/proto.h | 15 | ||||
-rw-r--r-- | source3/lib/sids.c | 2 | ||||
-rw-r--r-- | source3/libsmb/clienttrust.c | 3 | ||||
-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 | ||||
-rw-r--r-- | source3/rpcclient/cmd_netlogon.c | 6 |
8 files changed, 23 insertions, 148 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h index df1adedf70a..7100ee6526e 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -486,7 +486,6 @@ void reg_get_subkey(char *full_keyname, char *key_name, char *subkey_name); BOOL reg_split_key(const char *full_keyname, uint32 *reg_type, char *key_name); BOOL become_user_permanently(uid_t uid, gid_t gid); char *get_trusted_serverlist(const char* domain); -BOOL get_any_dc_name(const char *domain, char *srv_name); /*The following definitions come from lib/util_array.c */ @@ -787,6 +786,7 @@ BOOL cli_message_start(struct cli_state *cli, char *host, char *username, BOOL cli_message_text(struct cli_state *cli, char *msg, int len, int grp); BOOL cli_message_end(struct cli_state *cli, int grp); BOOL cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail); +BOOL get_any_dc_name(const char *domain, char *srv_name); /*The following definitions come from libsmb/clienttrust.c */ @@ -1808,8 +1808,6 @@ void init_connections(void); void free_connections(void); 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* srv_name, const char* pipe_name, struct cli_connection **con); BOOL cli_connection_getsrv(const char* srv_name, const char* pipe_name, @@ -1846,11 +1844,10 @@ BOOL event_readeventlog(POLICY_HND *hnd, /*The following definitions come from rpc_client/cli_login.c */ -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); BOOL cli_nt_srv_pwset(const char* srv_name, const char* myhostname, const char* trust_acct, unsigned char *new_hashof_trust_pwd, @@ -1869,7 +1866,7 @@ BOOL cli_nt_login_network(const char* srv_name, const char* myhostname, NET_USER_INFO_3 *user_info3); BOOL cli_nt_logoff(const char* srv_name, const char* myhostname, NET_ID_INFO_CTR *ctr); -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], @@ -1879,7 +1876,7 @@ BOOL net_sam_sync(char* servers, const char* myhostname, /*The following definitions come from rpc_client/cli_lsarpc.c */ BOOL get_domain_sids(const char *myname, - DOM_SID *sid3, DOM_SID *sid5, char *servers); + DOM_SID *sid3, DOM_SID *sid5, char *domain); BOOL get_trust_sid_and_domain(const char* myname, char *server, DOM_SID *sid, char *domain, size_t len); @@ -2186,8 +2183,6 @@ BOOL svc_change_svc_cfg( POLICY_HND *hnd, void init_cli_use(void); void free_cli_use(void); -struct cli_state *cli_net_use_addlist(char* servers, - const struct user_credentials *usr_creds); struct cli_state *cli_net_use_add(const char* srv_name, const struct user_credentials *usr_creds); BOOL cli_net_use_del(const char* srv_name, diff --git a/source3/lib/sids.c b/source3/lib/sids.c index 0f9b32f49dc..efbd03fbf37 100644 --- a/source3/lib/sids.c +++ b/source3/lib/sids.c @@ -200,7 +200,7 @@ BOOL get_member_domain_sid(void) } return get_domain_sids(global_myname, NULL, - &global_member_sid, lp_passwordserver()); + &global_member_sid, lp_workgroup()); } diff --git a/source3/libsmb/clienttrust.c b/source3/libsmb/clienttrust.c index d9d3392d0bf..b223750529f 100644 --- a/source3/libsmb/clienttrust.c +++ b/source3/libsmb/clienttrust.c @@ -57,8 +57,7 @@ static BOOL modify_trust_password( char *domain, char *remote_machine, make_nmb_name(&called , remote_machine, 0x20, scope); if (cli_nt_setup_creds(srv_name, global_myname, trust_acct, - orig_trust_passwd_hash, sec_chan, - srv_name) != 0x0) + orig_trust_passwd_hash, sec_chan) != 0x0) { return False; } diff --git a/source3/rpc_client/cli_connect.c b/source3/rpc_client/cli_connect.c index 6faf7cc28b9..6f63d5356fe 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 a9244c886e5..9b26ca60f47 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 e9bb175c83d..665383ca103 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 69e46c081bd..5ae722d6adc 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) { diff --git a/source3/rpcclient/cmd_netlogon.c b/source3/rpcclient/cmd_netlogon.c index 910d75e1f70..9bd398643f1 100644 --- a/source3/rpcclient/cmd_netlogon.c +++ b/source3/rpcclient/cmd_netlogon.c @@ -140,8 +140,7 @@ void cmd_netlogon_login_test(struct client_info *info, int argc, char *argv[]) res = res ? cli_nt_setup_creds(srv_name, info->myhostname, trust_acct, - trust_passwd, SEC_CHAN_WKSTA, - srv_name) == 0x0 : False; + trust_passwd, SEC_CHAN_WKSTA) == 0x0 : False; #if 0 /* change the machine password? */ @@ -215,8 +214,7 @@ void cmd_netlogon_domain_test(struct client_info *info, int argc, char *argv[]) res = res ? cli_nt_setup_creds(srv_name, info->myhostname, inter_dom_acct, trust_passwd, - SEC_CHAN_DOMAIN, - srv_name) == 0x0 : False; + SEC_CHAN_DOMAIN) == 0x0 : False; memset(trust_passwd, 0, 16); |