1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-28 01:58:17 +03:00

libsmb: Remove unused cli_ns_check_server_type()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
This commit is contained in:
Volker Lendecke 2024-08-19 14:16:40 +02:00 committed by Martin Schwenke
parent 3790d0d3b9
commit c831e21d88
2 changed files with 0 additions and 98 deletions

View 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.
****************************************************************************/

View 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),