[SCM] Samba Shared Repository - branch master updated
Martin Schwenke
martins at samba.org
Wed Aug 21 12:50:02 UTC 2024
The branch, master has been updated
via dd03cf8b4c8 libsmb: Remove cli_state->rap_error
via c3f73a905dc libsmb: Remove unused cli_NetWkstaUserLogoff()
via c831e21d88c libsmb: Remove unused cli_ns_check_server_type()
from 3790d0d3b98 WHATSNEW: add 'vfs mkdir use tmp name' option
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit dd03cf8b4c8b9c6e626c939564b718b02ba2cd36
Author: Volker Lendecke <vl at samba.org>
Date: Tue Aug 20 15:13:52 2024 +0200
libsmb: Remove cli_state->rap_error
I could not find any caller which uses rap_error outside of the
routine implementing the rap client call itself.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Martin Schwenke <martin at meltin.net>
Autobuild-User(master): Martin Schwenke <martins at samba.org>
Autobuild-Date(master): Wed Aug 21 12:49:45 UTC 2024 on atb-devel-224
commit c3f73a905dc9847b903c61da130b7bfba902fe0c
Author: Volker Lendecke <vl at samba.org>
Date: Mon Aug 19 14:17:42 2024 +0200
libsmb: Remove unused cli_NetWkstaUserLogoff()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Martin Schwenke <martin at meltin.net>
commit c831e21d88c0a2f1590d414d070f2e8124803023
Author: Volker Lendecke <vl at samba.org>
Date: Mon Aug 19 14:16:40 2024 +0200
libsmb: Remove unused cli_ns_check_server_type()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Martin Schwenke <martin at meltin.net>
-----------------------------------------------------------------------
Summary of changes:
source3/include/client.h | 1 -
source3/libsmb/clirap.c | 6 +-
source3/utils/clirap2.c | 209 ++++-------------------------------------------
source3/utils/clirap2.h | 2 -
4 files changed, 20 insertions(+), 198 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/include/client.h b/source3/include/client.h
index 2024cec8fbe..aaac2956f32 100644
--- a/source3/include/client.h
+++ b/source3/include/client.h
@@ -48,7 +48,6 @@ struct cli_state {
* A list of subsidiary connections for DFS.
*/
struct cli_state *prev, *next;
- int rap_error;
bool map_dos_errors;
/*
diff --git a/source3/libsmb/clirap.c b/source3/libsmb/clirap.c
index 256331f77c3..758d6ccbb1e 100644
--- a/source3/libsmb/clirap.c
+++ b/source3/libsmb/clirap.c
@@ -433,7 +433,7 @@ NTSTATUS cli_oem_change_password(struct cli_state *cli,
.data = old_pw_hash,
.size = sizeof(old_pw_hash),
};
- int rc;
+ int rc, res;
NTSTATUS status;
if (strlen(user) >= sizeof(fstring)-1) {
@@ -529,9 +529,9 @@ NTSTATUS cli_oem_change_password(struct cli_state *cli,
if (!NT_STATUS_IS_OK(status)) {
return status;
}
- cli->rap_error = PULL_LE_U16(rparam, 0);
+ res = PULL_LE_U16(rparam, 0);
- status = werror_to_ntstatus(W_ERROR(cli->rap_error));
+ status = werror_to_ntstatus(W_ERROR(res));
TALLOC_FREE(rparam);
diff --git a/source3/utils/clirap2.c b/source3/utils/clirap2.c
index b60cbfd4a70..dff54985e26 100644
--- a/source3/utils/clirap2.c
+++ b/source3/utils/clirap2.c
@@ -460,11 +460,10 @@ int cli_RNetGroupEnum(struct cli_state *cli, void (*fn)(const char *, const char
char *endp = rparam + rdrcnt;
res = GETRES(rparam, endp);
- cli->rap_error = res;
- if(cli->rap_error == 234) {
+ if(res == 234) {
DEBUG(1,("Not all group names were returned (such as those longer than 21 characters)\n"));
- } else if (cli->rap_error != 0) {
- DEBUG(1,("NetGroupEnum gave error %d\n", cli->rap_error));
+ } else if (res != 0) {
+ DEBUG(1,("NetGroupEnum gave error %d\n", res));
}
}
@@ -549,11 +548,10 @@ int cli_RNetGroupEnum0(struct cli_state *cli,
&rdata, &rdrcnt)) {
char *endp = rparam+rprcnt;
res = GETRES(rparam,endp);
- cli->rap_error = res;
- if(cli->rap_error == 234) {
+ if(res == 234) {
DEBUG(1,("Not all group names were returned (such as those longer than 21 characters)\n"));
- } else if (cli->rap_error != 0) {
- DEBUG(1,("NetGroupEnum gave error %d\n", cli->rap_error));
+ } else if (res != 0) {
+ DEBUG(1,("NetGroupEnum gave error %d\n", res));
}
}
@@ -740,7 +738,6 @@ int cli_NetGroupGetUsers(struct cli_state * cli, const char *group_name, void (*
&rdata, &rdrcnt)) {
char *endp = rparam + rprcnt;
res = GETRES(rparam,endp);
- cli->rap_error = res;
if (res != 0) {
DEBUG(1,("NetGroupGetUsers gave error %d\n", res));
}
@@ -809,7 +806,6 @@ int cli_NetUserGetGroups(struct cli_state * cli, const char *user_name, void (*f
&rdata, &rdrcnt)) {
char *endp = rparam + rprcnt;
res = GETRES(rparam,endp);
- cli->rap_error = res;
if (res != 0) {
DEBUG(1,("NetUserGetGroups gave error %d\n", res));
}
@@ -1013,9 +1009,8 @@ int cli_RNetUserEnum(struct cli_state *cli, void (*fn)(const char *, const char
&rdata, &rdrcnt)) {
char *endp = rparam + rprcnt;
res = GETRES(rparam,endp);
- cli->rap_error = res;
- if (cli->rap_error != 0) {
- DEBUG(1,("NetUserEnum gave error %d\n", cli->rap_error));
+ if (res != 0) {
+ DEBUG(1,("NetUserEnum gave error %d\n", res));
}
}
@@ -1121,9 +1116,8 @@ int cli_RNetUserEnum0(struct cli_state *cli,
&rdata, &rdrcnt)) {
char *endp = rparam + rprcnt;
res = GETRES(rparam,endp);
- cli->rap_error = res;
- if (cli->rap_error != 0) {
- DEBUG(1,("NetUserEnum gave error %d\n", cli->rap_error));
+ if (res != 0) {
+ DEBUG(1,("NetUserEnum gave error %d\n", res));
}
}
@@ -1577,13 +1571,12 @@ bool cli_get_pdc_name(struct cli_state *cli, const char *workgroup, char **pdc_n
char *endp = rparam + rprcnt;
res = GETRES(rparam, endp);
- cli->rap_error = res;
/*
* We only really care to copy a name if the
* API succeeded and we got back a name.
*/
- if (cli->rap_error == 0) {
+ if (res == 0) {
p = rparam + WORDSIZE + WORDSIZE; /* skip result and converter */
GETWORD(p, count, endp);
p = rdata;
@@ -1605,7 +1598,7 @@ bool cli_get_pdc_name(struct cli_state *cli, const char *workgroup, char **pdc_n
DEBUG(4, ("cli_get_pdc_name: machine %s failed the "
"NetServerEnum call. Error was : %s.\n",
smbXcli_conn_remote_name(cli->conn),
- win_errstr(W_ERROR(cli->rap_error))));
+ win_errstr(W_ERROR(res))));
}
}
@@ -1674,167 +1667,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.
-****************************************************************************/
-
-bool cli_NetWkstaUserLogoff(struct cli_state *cli, const char *user, const char *workstation)
-{
- char *rparam = NULL;
- char *rdata = NULL;
- char *p;
- unsigned int rdrcnt,rprcnt;
- char param[WORDSIZE /* api number */
- +sizeof(RAP_NetWkstaUserLogoff_REQ) /* req string */
- +sizeof(RAP_USER_LOGOFF_INFO_L1) /* return string */
- +RAP_USERNAME_LEN+1 /* user name+pad */
- +RAP_MACHNAME_LEN /* wksta name */
- +WORDSIZE /* buffer size */
- +WORDSIZE]; /* buffer size? */
- char upperbuf[MAX(RAP_USERNAME_LEN,RAP_MACHNAME_LEN)];
- int res = -1;
- char *tmp = NULL;
-
- memset(param, 0, sizeof(param));
-
- /* send a SMBtrans command with api NetWkstaUserLogoff */
- p = make_header(param, RAP_WWkstaUserLogoff,
- RAP_NetWkstaUserLogoff_REQ, RAP_USER_LOGOFF_INFO_L1);
- PUTDWORD(p, 0); /* Null pointer */
- PUTDWORD(p, 0); /* Null pointer */
- strlcpy(upperbuf, user, sizeof(upperbuf));
- if (!strupper_m(upperbuf)) {
- return false;
- }
- tmp = upperbuf;
- PUTSTRINGF(p, tmp, RAP_USERNAME_LEN);
- p++; /* strange format, but ok */
- strlcpy(upperbuf, workstation, sizeof(upperbuf));
- if (!strupper_m(upperbuf)) {
- return false;
- }
- tmp = upperbuf;
- PUTSTRINGF(p, tmp, RAP_MACHNAME_LEN);
- PUTWORD(p, CLI_BUFFER_SIZE);
- PUTWORD(p, CLI_BUFFER_SIZE);
-
- if (cli_api(cli,
- param, PTR_DIFF(p,param),1024, /* param, 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 (cli->rap_error != 0) {
- DEBUG(4,("NetwkstaUserLogoff gave error %d\n", cli->rap_error));
- }
- }
-
- SAFE_FREE(rparam);
- SAFE_FREE(rdata);
- return (cli->rap_error == 0);
-}
-
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),
void (*jfn)(uint16_t,const char*,const char*,const char*,const char*,uint16_t,uint16_t,const char*,unsigned int,unsigned int,const char*))
@@ -1865,7 +1697,6 @@ int cli_NetPrintQEnum(struct cli_state *cli,
&rdata, &rdrcnt)) {
char *endp = rparam + rprcnt;
res = GETRES(rparam, endp);
- cli->rap_error = res;
if (res != 0) {
DEBUG(1,("NetPrintQEnum gave error %d\n", res));
}
@@ -2043,7 +1874,6 @@ int cli_NetPrintQGetInfo(struct cli_state *cli, const char *printer,
&rdata, &rdrcnt)) {
char *endp = rparam + rprcnt;
res = GETRES(rparam, endp);
- cli->rap_error = res;
if (res != 0) {
DEBUG(1,("NetPrintQGetInfo gave error %d\n", res));
}
@@ -2216,11 +2046,10 @@ int cli_RNetServiceEnum(struct cli_state *cli, void (*fn)(const char *, const ch
&rdata, &rdrcnt)) {
char *endp = rparam + rprcnt;
res = GETRES(rparam, endp);
- cli->rap_error = res;
- if(cli->rap_error == 234) {
+ if(res == 234) {
DEBUG(1,("Not all service names were returned (such as those longer than 15 characters)\n"));
- } else if (cli->rap_error != 0) {
- DEBUG(1,("NetServiceEnum gave error %d\n", cli->rap_error));
+ } else if (res != 0) {
+ DEBUG(1,("NetServiceEnum gave error %d\n", res));
}
}
@@ -2299,7 +2128,6 @@ int cli_NetSessionEnum(struct cli_state *cli, void (*fn)(char *, char *, uint16_
&rdata, &rdrcnt)) {
char *endp = rparam + rprcnt;
res = GETRES(rparam, endp);
- cli->rap_error = res;
if (res != 0) {
DEBUG(1,("NetSessionEnum gave error %d\n", res));
}
@@ -2402,9 +2230,8 @@ int cli_NetSessionGetInfo(struct cli_state *cli, const char *workstation,
&rdata, &rdrcnt)) {
endp = rparam + rprcnt;
res = GETRES(rparam, endp);
- cli->rap_error = res;
- if (cli->rap_error != 0) {
- DEBUG(1,("NetSessionGetInfo gave error %d\n", cli->rap_error));
+ if (res != 0) {
+ DEBUG(1,("NetSessionGetInfo gave error %d\n", res));
}
}
@@ -2500,7 +2327,6 @@ int cli_NetSessionDel(struct cli_state *cli, const char *workstation)
{
char *endp = rparam + rprcnt;
res = GETRES(rparam, endp);
- cli->rap_error = res;
if (res == 0) {
/* nothing to do */
@@ -2550,7 +2376,6 @@ int cli_NetConnectionEnum(struct cli_state *cli, const char *qualifier,
&rdata, &rdrcnt)) {
char *endp = rparam + rprcnt;
res = GETRES(rparam, endp);
- cli->rap_error = res;
if (res != 0) {
DEBUG(1,("NetConnectionEnum gave error %d\n", res));
}
diff --git a/source3/utils/clirap2.h b/source3/utils/clirap2.h
index 275d491d2cd..bb8a23bfe36 100644
--- a/source3/utils/clirap2.h
+++ b/source3/utils/clirap2.h
@@ -58,8 +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),
void (*jfn)(uint16_t,const char*,const char*,const char*,const char*,uint16_t,uint16_t,const char*,unsigned int,unsigned int,const char*));
--
Samba Shared Repository
More information about the samba-cvs
mailing list