From 1875e46d05c21f4ca0e1163ecfd41b470dbce09a Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 10 Apr 2005 14:44:56 +0000 Subject: r6275: Implement RAP version of enumusers/enumgroups level 0. No, I've not gone mad, this is to test future changes to enumeration functions... This can successfully list users from nt4 and w2k3sp1. Volker (This used to be commit c73f2656fd89e227a8a3e2ab20f7393ff2c515c7) --- source3/libsmb/clirap2.c | 124 +++++++++++++++++++++++++++++++++++++++++++++++ source3/utils/net_rap.c | 18 ++++--- 2 files changed, 135 insertions(+), 7 deletions(-) (limited to 'source3') diff --git a/source3/libsmb/clirap2.c b/source3/libsmb/clirap2.c index 12a3d63aff..d8a8519550 100644 --- a/source3/libsmb/clirap2.c +++ b/source3/libsmb/clirap2.c @@ -329,6 +329,70 @@ int cli_RNetGroupEnum(struct cli_state *cli, void (*fn)(const char *, const char return res; } +int cli_RNetGroupEnum0(struct cli_state *cli, + void (*fn)(const char *, void *), + void *state) +{ + char param[WORDSIZE /* api number */ + +sizeof(RAP_NetGroupEnum_REQ) /* parm string */ + +sizeof(RAP_GROUP_INFO_L0) /* return string */ + +WORDSIZE /* info level */ + +WORDSIZE]; /* buffer size */ + char *p; + char *rparam = NULL; + char *rdata = NULL; + unsigned int rprcnt, rdrcnt; + int res = -1; + + + memset(param, '\0', sizeof(param)); + p = make_header(param, RAP_WGroupEnum, + RAP_NetGroupEnum_REQ, RAP_GROUP_INFO_L0); + PUTWORD(p,0); /* Info level 0 */ /* Hmmm. I *very* much suspect this + is the resume count, at least + that's what smbd believes... */ + PUTWORD(p,0xFFE0); /* Return buffer size */ + + if (cli_api(cli, + param, PTR_DIFF(p,param),8, + NULL, 0, 0xFFE0 /* data area size */, + &rparam, &rprcnt, + &rdata, &rdrcnt)) { + res = GETRES(rparam); + cli->rap_error = res; + if(cli->rap_error == 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)); + } + } + + if (rdata) { + if (res == 0 || res == ERRmoredata) { + int i, converter, count; + + p = rparam + WORDSIZE; /* skip result */ + GETWORD(p, converter); + GETWORD(p, count); + + for (i=0,p=rdata;irap_error = res; + if (cli->rap_error != 0) { + DEBUG(1,("NetUserEnum gave error %d\n", cli->rap_error)); + } + } + if (rdata) { + if (res == 0 || res == ERRmoredata) { + int i, converter, count; + char username[RAP_USERNAME_LEN]; + + p = rparam + WORDSIZE; /* skip result */ + GETWORD(p, converter); + GETWORD(p, count); + + for (i=0,p=rdata;i