]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
libsmb: Remove unused cli_ns_check_server_type()
authorVolker Lendecke <vl@samba.org>
Mon, 19 Aug 2024 12:16:40 +0000 (14:16 +0200)
committerMartin Schwenke <martins@samba.org>
Wed, 21 Aug 2024 11:33:31 +0000 (11:33 +0000)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
source3/utils/clirap2.c
source3/utils/clirap2.h

index b60cbfd4a70bab43babe18b0213c61830e7e835f..b612acf9203b6dd0518e26675275b2b9b7c1ea05 100644 (file)
@@ -1674,103 +1674,6 @@ bool cli_get_server_name(TALLOC_CTX *mem_ctx, struct cli_state *cli,
        return res;
 }
 
-/*************************************************************************
-*
-* Function Name:  cli_ns_check_server_type
-*
-* PURPOSE:  Remotes a NetServerEnum2 API call to the current server
-*           requesting server_info_0 level information of machines
-*           matching the given server type. If the returned server
-*           list contains the machine name contained in smbXcli_conn_remote_name(->conn)
-*           then we conclude the server type checks out. This routine
-*           is useful to retrieve list of server's of a certain
-*           type when all you have is a null session connection and
-*           can't remote API calls such as NetWkstaGetInfo or
-*           NetServerGetInfo.
-*
-* Dependencies: none
-*
-* Parameters:
-*             cli       - pointer to cli_state structure
-*             workgroup - pointer to string containing domain
-*             stype     - server type
-*
-* Returns:
-*             True      - success
-*             False     - failure
-*
-************************************************************************/
-
-bool cli_ns_check_server_type(struct cli_state *cli, char *workgroup, uint32_t stype)
-{
-       char *rparam = NULL;
-       char *rdata = NULL;
-       unsigned int rdrcnt,rprcnt;
-       char *p;
-       char param[WORDSIZE                       /* api number    */
-               +sizeof(RAP_NetServerEnum2_REQ) /* req string    */
-               +sizeof(RAP_SERVER_INFO_L0)     /* return string */
-               +WORDSIZE                       /* info level    */
-               +WORDSIZE                       /* buffer size   */
-               +DWORDSIZE                      /* server type   */
-               +RAP_MACHNAME_LEN];             /* workgroup     */
-       bool found_server = false;
-       int res = -1;
-       const char *remote_name = smbXcli_conn_remote_name(cli->conn);
-
-       /* send a SMBtrans command with api NetServerEnum */
-       p = make_header(param, RAP_NetServerEnum2,
-                       RAP_NetServerEnum2_REQ, RAP_SERVER_INFO_L0);
-       PUTWORD(p, 0); /* info level 0 */
-       PUTWORD(p, CLI_BUFFER_SIZE);
-       PUTDWORD(p, stype);
-       PUTSTRING(p, workgroup, RAP_MACHNAME_LEN);
-
-       if (cli_api(cli,
-                       param, PTR_DIFF(p,param), 8, /* params, length, max */
-                       NULL, 0, CLI_BUFFER_SIZE,  /* data, length, max */
-                       &rparam, &rprcnt,          /* return params, return size */
-                       &rdata, &rdrcnt            /* return data, return size */
-                       )) {
-               char *endp = rparam + rprcnt;
-               res = GETRES(rparam,endp);
-               cli->rap_error = res;
-
-               if (res == 0 || res == ERRmoredata) {
-                       int i, count = 0;
-
-                       p = rparam + WORDSIZE + WORDSIZE;
-                       GETWORD(p, count,endp);
-
-                       p = rdata;
-                       endp = rdata + rdrcnt;
-                       for (i = 0;i < count && p < endp;i++, p += 16) {
-                               char ret_server[RAP_MACHNAME_LEN];
-
-                               p += rap_getstringf(p,
-                                               ret_server,
-                                               RAP_MACHNAME_LEN,
-                                               RAP_MACHNAME_LEN,
-                                               endp);
-                               if (strequal(ret_server, remote_name)) {
-                                       found_server = true;
-                                       break;
-                               }
-                       }
-               } else {
-                       DEBUG(4, ("cli_ns_check_server_type: machine %s "
-                                 "failed the NetServerEnum call. Error was : "
-                                 "%s.\n", remote_name,
-                                 win_errstr(W_ERROR(cli->rap_error))));
-               }
-       }
-
-       SAFE_FREE(rparam);
-       SAFE_FREE(rdata);
-
-       return found_server;
-}
-
 /****************************************************************************
  Perform a NetWkstaUserLogoff.
 ****************************************************************************/
index 275d491d2cd4de9c4dc952979ca05c451cb6b61b..6427d3a448dc5f0f4372f54e84ddd9ae87db4a90 100644 (file)
@@ -58,7 +58,6 @@ int cli_NetShareDelete(struct cli_state *cli, const char * share_name );
 bool cli_get_pdc_name(struct cli_state *cli, const char *workgroup, char **pdc_name);
 bool cli_get_server_name(TALLOC_CTX *mem_ctx, struct cli_state *cli,
                         char **servername);
-bool cli_ns_check_server_type(struct cli_state *cli, char *workgroup, uint32_t stype);
 bool cli_NetWkstaUserLogoff(struct cli_state *cli, const char *user, const char *workstation);
 int cli_NetPrintQEnum(struct cli_state *cli,
                void (*qfn)(const char*,uint16_t,uint16_t,uint16_t,const char*,const char*,const char*,const char*,const char*,uint16_t,uint16_t),