clientgen - cli_RNetShareEnum

Luke Kenneth Casson Leighton lkcl at regent.push.net
Tue Apr 28 10:02:08 GMT 1998


i've incorporated the NetShareEnum call.  don't know about the find first
stuff.

lukes

On Tue, 28 Apr 1998, Bartlomiej Czardybon wrote:

> Hi.
> 
> As I was writing, some days ago, I have written function
> cli_RNetShareEnum for clientgen.c.
> 
> Here You have this function - it worked for me OK, although I'd like - 
> samba_teamer who (if) is going to incorporate it into clientgen.c - 
> to take a look at it, and just verify 'by one eye look'
> if it is OK for samba team.
> 
> Second thing: clientgen seems to lack a function: find_first and
> find_next ... (TRANSACT2_FINDFIRST, TRANSACT2_FINDNEXT).
> 
> I wanted to port client.c's do_long_dir to clientgen.c, but
> in clientgen.c function cli_api uses SMBTrans , while in 
> do_long_dir is used SMBTrans2...
> 
> So... the port would probably need some more modifications to
> clientgen.c than I would like to make, so I ask You dear
> samba developers - how to rewrite this function to clientgen.c ?
> 
> 
> -- 
> Bartlomiej Czardybon, System Administrator, PiK-Net ul. Toszecka 102 Gliwice
> voice: +48 32 279-96-00   fax: +48 32 279-96-01
> e-mail: czar at pik-net.pl     http://www.silesia.pik-net.pl/~czar BC374-RIPE
> 
> 
> ------------------- Function cli_RNetShareEnum -----------------------------
> --- cut here ---
> 
> /****************************************************************************
> 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);
> }
> 
> 
> --- cut here ---
> 




More information about the samba-technical mailing list