From: Volker Lendecke Date: Sun, 10 Apr 2005 14:44:56 +0000 (+0000) Subject: r6275: Implement RAP version of enumusers/enumgroups level 0. No, I've not gone mad, X-Git-Tag: samba-misc-tags/initial-v3-0-unstable~4955 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c73f2656fd89e227a8a3e2ab20f7393ff2c515c7;p=thirdparty%2Fsamba.git 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 --- diff --git a/source/libsmb/clirap2.c b/source/libsmb/clirap2.c index 12a3d63aff3..d8a85195502 100644 --- a/source/libsmb/clirap2.c +++ b/source/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