From dd03cf8b4c8b9c6e626c939564b718b02ba2cd36 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 20 Aug 2024 15:13:52 +0200 Subject: [PATCH] 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 Reviewed-by: Martin Schwenke Autobuild-User(master): Martin Schwenke Autobuild-Date(master): Wed Aug 21 12:49:45 UTC 2024 on atb-devel-224 --- source3/include/client.h | 1 - source3/libsmb/clirap.c | 6 ++--- source3/utils/clirap2.c | 48 ++++++++++++++-------------------------- 3 files changed, 20 insertions(+), 35 deletions(-) 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 bae72efd664..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)))); } } @@ -1704,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)); } @@ -1882,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)); } @@ -2055,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)); } } @@ -2138,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)); } @@ -2241,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)); } } @@ -2339,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 */ @@ -2389,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)); } -- 2.47.3