vote / opinions required on rpcclient
Luke Leighton
lkcl at samba.org
Sat Nov 27 20:57:10 GMT 1999
On 27 Nov 1999, Todd Sabin wrote:
> Luke Leighton <lkcl at samba.org> writes:
>
> > i need to know whether people think it would be a good idea to retire
> > rpcclient in favour of the following command suite:
> >
> > net
> > usrmgr
> > srvmgr
> > regedit
> > eventvwr
> > cmdat
> >
> > basically, a suite of programs that match nt's .EXE equivalents.
> >
>
> If you're going to be putting major effort into rpcclient, I'd love
> to see the following:
>
> Create a higher level libsmb (or maybe just add to libsmb?) which
> contains the rpc level commands that rpcclient will use, and then
already working on it.
what, you mean, like this? :-)
[extract from rpcclient/msrpc_sam.c]
/****************************************************************************
experimental SAM user query.
****************************************************************************/
BOOL msrpc_sam_query_user( const char* srv_name,
const char* domain,
const DOM_SID *sid,
char *user_name,
USER_FN(usr_fn),
USER_INFO_FN(usr_inf_fn),
USER_MEM_FN(usr_grp_fn),
USER_MEM_FN(usr_als_fn))
{
BOOL res = True;
BOOL res1 = True;
char *names[1];
uint32 num_rids;
uint32 rid[MAX_LOOKUP_SIDS];
uint32 type[MAX_LOOKUP_SIDS];
POLICY_HND sam_pol;
POLICY_HND pol_dom;
/* establish a connection. */
res = res ? samr_connect( srv_name, 0x02000000, &sam_pol) : False;
/* connect to the domain */
res = res ? samr_open_domain( &sam_pol, 0x304, sid, &pol_dom) : False;
/* look up user rid */
names[0] = user_name;
res1 = res ? samr_query_lookup_names( &pol_dom, 0x3e8,
1, names,
&num_rids, rid, type) : False;
/* send user info query */
if (res1 && num_rids == 1)
{
msrpc_sam_user( &pol_dom, NULL,
domain,
sid, NULL,
rid[0],
names[0],
usr_fn, usr_inf_fn,
usr_grp_fn, usr_als_fn);
}
else
{
res1 = False;
}
res = res ? samr_close( &sam_pol) : False;
res = res ? samr_close( &pol_dom) : False;
return res1;
}
> but doing that currently means getting involved in lots of lower level
> stuff that could be hidden in most cases. Basically, I'd like to be
> able to use the same set of RPC apis that are available on NT, with
> some minor flexibility improvements (primarily the ability to use
> multiple sets of credentials against the same host).
me too. which is why i have already done exactly this, starting on
wednesday. the registry, samr, svcctl and lsarpc APIs are already
completed.
i have srvsvc, wkssvc and the other non-handle-based APIs left to do, as
i need to "cache" credentials automatically (most unfortunate).
> This would also allow other people to write net, usrmgr, srvmgr,
> whatever else, much easier. A gnome regedit would be pretty
> straightforward to write, etc.
the api you are asking for is already done. you want to write a gnume
regedit? be my guest.
luke
More information about the samba-technical
mailing list