]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
cleaning up: removing those horrible references to server list
authorLuke Leighton <lkcl@samba.org>
Thu, 2 Dec 1999 19:03:23 +0000 (19:03 +0000)
committerLuke Leighton <lkcl@samba.org>
Thu, 2 Dec 1999 19:03:23 +0000 (19:03 +0000)
functions (cli_net_use_addlist()).  needed originally because
there was no get_dc_any_name() function.
(This used to be commit 3a2b920ea2e6704b2574f404e1e41c7cfc0f96b2)

source3/include/proto.h
source3/lib/sids.c
source3/libsmb/clienttrust.c
source3/rpc_client/cli_connect.c
source3/rpc_client/cli_login.c
source3/rpc_client/cli_lsarpc.c
source3/rpc_client/cli_use.c
source3/rpcclient/cmd_netlogon.c

index df1adedf70a0d58f6c104ad0deb130754002f78c..7100ee6526e1c2b2e85dabbb47a67988178f85b3 100644 (file)
@@ -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,
index 0f9b32f49dc14698e4ee9b24758c00335eb3a6be..efbd03fbf37dfd0df1ff185cf745e21b3e3f1389 100644 (file)
@@ -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());
 }
 
 
index d9d3392d0bf2be9e38c32703052b0255b15ab4ca..b223750529f90326e79b2010b4fbbdd3dee30b36 100644 (file)
@@ -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;
        } 
index 6faf7cc28b9526510646646bcd7434401fb3ba29..6f63d5356fe254683f0e3b0925ec88531b5bc9a9 100644 (file)
@@ -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)
 {
@@ -208,31 +174,6 @@ void cli_connection_unlink(struct cli_connection *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 = 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
 ****************************************************************************/
index a9244c886e5e1b89f98d0bb41709ea9bcae920c8..9b26ca60f4742d3f5b75010098761692fa7e7517 100644 (file)
@@ -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);
 
index e9bb175c83d48a8a5cba318f4011d955c56ffa5d..665383ca1030d7edb9a2944adf4da4cddac5a1c3 100644 (file)
@@ -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
index 69e46c081bd1d75801cea3a08cbbf0a0aa5a9b9b..5ae722d6adc77f123deaeac1048b34d0b30c44a3 100644 (file)
@@ -195,46 +195,6 @@ static struct cli_use *cli_use_get(const char* srv_name,
        return cli;
 }
 
-/****************************************************************************
-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
 ****************************************************************************/
index 910d75e1f70eb6bdbd7cd67dc0585081906ba190..9bd398643f1e84df541d955b9baf86b5cbbb162b 100644 (file)
@@ -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);