diff options
author | Luke Leighton <lkcl@samba.org> | 1998-04-28 09:53:42 +0000 |
---|---|---|
committer | Luke Leighton <lkcl@samba.org> | 1998-04-28 09:53:42 +0000 |
commit | d7cecb7bd3cfcab48af07366e24b65b2bb8b09bb (patch) | |
tree | 37c10678cf788005a3a7746889f173f25d2538a5 /source3 | |
parent | 22abe47e29bf25a52e39026d03e38b49bab25ac9 (diff) | |
download | samba-d7cecb7bd3cfcab48af07366e24b65b2bb8b09bb.tar.gz samba-d7cecb7bd3cfcab48af07366e24b65b2bb8b09bb.tar.bz2 samba-d7cecb7bd3cfcab48af07366e24b65b2bb8b09bb.zip |
added NetShareEnum from Bartlomej Czardybon <czar@silesia.pik-net.pl>
(This used to be commit 37cbc356741055d0660b80594117fa312d252b85)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/libsmb/clientgen.c | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c index f23c846cf9..3f8c6e32cc 100644 --- a/source3/libsmb/clientgen.c +++ b/source3/libsmb/clientgen.c @@ -427,6 +427,65 @@ BOOL cli_NetWkstaUserLogon(struct cli_state *cli,char *user, char *workstation) return (cli->rap_error == 0); } +/**************************************************************************** +call a NetShareEnum - try and browse available connections on a host +****************************************************************************/ +BOOL cli_RNetShareEnum(struct cli_state *cli, void (*fn)(char *, uint32, char *)) +{ + char *rparam = NULL; + char *rdata = NULL; + char *p; + int rdrcnt,rprcnt; + pstring param; + int count = -1; + + /* now send a SMBtrans command with api RNetShareEnum */ + p = param; + SSVAL(p,0,0); /* api number */ + p += 2; + strcpy(p,"WrLeh"); + p = skip_string(p,1); + strcpy(p,"B13BWz"); + p = skip_string(p,1); + SSVAL(p,0,1); + SSVAL(p,2,BUFFER_SIZE); + p += 4; + + if (cli_api(cli, + PTR_DIFF(p,param), + 0, /* data count */ + 1024, /* mprcount */ + BUFFER_SIZE, /* mdrcount */ + &rprcnt, &rdrcnt, + param,NULL, + &rparam,&rdata)) + { + int res = SVAL(rparam,0); + int converter=SVAL(rparam,2); + int i; + BOOL long_share_name=False; + + if (res == 0) + { + count=SVAL(rparam,4); + p = rdata; + + for (i=0;i<count;i++,p+=20) + { + char *sname = p; + int type = SVAL(p,14); + int comment_offset = IVAL(p,16) & 0xFFFF; + char *cmnt = comment_offset?(rdata+comment_offset-converter):""; + fn(sname, type, cmnt); + } + } + } + + if (rparam) free(rparam); + if (rdata) free(rdata); + + return(count>0); +} /**************************************************************************** call a NetServerEnum for the specified workgroup and servertype mask. |