the comment and a state pointer.
****************************************************************************/
-bool cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32_t stype,
- void (*fn)(const char *, uint32_t, const char *, void *),
- void *state)
+NTSTATUS cli_NetServerEnum(
+ struct cli_state *cli,
+ char *workgroup,
+ uint32_t stype,
+ void (*fn)(const char *, uint32_t, const char *, void *),
+ void *state)
{
uint8_t *rparam = NULL;
uint8_t *rdata = NULL;
if (len == 0) {
SAFE_FREE(last_entry);
- return false;
+ return NT_STATUS_INTERNAL_ERROR;
}
p += len;
if (len == 0) {
SAFE_FREE(last_entry);
- return false;
+ return NT_STATUS_INTERNAL_ERROR;
}
p += len;
}
}
}
- return(return_cnt > 0);
+ if (return_cnt == 0) {
+ return NT_STATUS_NO_MORE_ENTRIES;
+ }
+ return NT_STATUS_OK;
}
/****************************************************************************
struct cli_state *cli,
void (*fn)(const char *, uint32_t, const char *, void *),
void *state);
-bool cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32_t stype,
- void (*fn)(const char *, uint32_t, const char *, void *),
- void *state);
+NTSTATUS cli_NetServerEnum(
+ struct cli_state *cli,
+ char *workgroup,
+ uint32_t stype,
+ void (*fn)(const char *, uint32_t, const char *, void *),
+ void *state);
NTSTATUS cli_oem_change_password(struct cli_state *cli,
const char *user,
const char *new_password,
/* Now, list the stuff ... */
- if (!cli_NetServerEnum(srv->cli,
- workgroup,
- SV_TYPE_DOMAIN_ENUM,
- list_unique_wg_fn,
- (void *)dir)) {
+ status = cli_NetServerEnum(srv->cli,
+ workgroup,
+ SV_TYPE_DOMAIN_ENUM,
+ list_unique_wg_fn,
+ (void *)dir);
+ if (!NT_STATUS_IS_OK(status)) {
continue;
}
}
*/
char *wgroup = server;
fstring buserver;
+ NTSTATUS status;
dir->dir_type = SMBC_SERVER;
}
/* Now, list the servers ... */
- if (!cli_NetServerEnum(srv->cli, wgroup,
- 0x0000FFFE, list_fn,
- (void *)dir)) {
-
+ status = cli_NetServerEnum(srv->cli,
+ wgroup,
+ 0x0000FFFE,
+ list_fn,
+ (void *)dir);
+ if (!NT_STATUS_IS_OK(status)) {
if (dir) {
SAFE_FREE(dir->fname);
SAFE_FREE(dir);
const char **argv)
{
struct cli_state *cli;
- int ret;
+ NTSTATUS status;
if (c->display_usage) {
d_printf("%s\n%s",
"\tServer name Server description\n"
"\t------------- ----------------------------\n"));
- ret = cli_NetServerEnum(cli, cli->server_domain, SV_TYPE_ALL,
- display_server_func,NULL);
+ status = cli_NetServerEnum(cli,
+ cli->server_domain,
+ SV_TYPE_ALL,
+ display_server_func,
+ NULL);
cli_shutdown(cli);
- return ret;
+ return NT_STATUS_IS_OK(status) ? 0 : -1;
}
int net_rap_server(struct net_context *c, int argc, const char **argv)
int net_rap_domain(struct net_context *c, int argc, const char **argv)
{
struct cli_state *cli;
- int ret;
+ NTSTATUS status;
if (c->display_usage)
return net_rap_domain_usage(c, argc, argv);
"\tDomain name Server name of Browse Master\n"
"\t------------- ----------------------------\n"));
- ret = cli_NetServerEnum(cli, cli->server_domain, SV_TYPE_DOMAIN_ENUM,
- display_server_func,NULL);
+ status = cli_NetServerEnum(cli,
+ cli->server_domain,
+ SV_TYPE_DOMAIN_ENUM,
+ display_server_func,
+ NULL);
cli_shutdown(cli);
- return ret;
+ return NT_STATUS_IS_OK(status) ? 0 : -1;
}
int net_rap_printq_usage(struct net_context *c, int argc, const char **argv)