srvsvc NetShareAdd and NetNameValidate RPCs ...
realrichardsharpe at gmail.com
Thu Oct 18 08:24:16 MDT 2012
On Wed, Oct 17, 2012 at 10:09 AM, Richard Sharpe
<realrichardsharpe at gmail.com> wrote:
> Hi folks,
> We were trying to enhance NetShareAdd so that an appropriate error is
> returned when adding the share fails for some reason, Eg, out of
> resources, etc. We did this by allowing the add script to write an
> error code to STDERR (or STDOUT, I forget.)
> We tried returning error codes like WERR_NERR_NOROOM,
> WERR_NERR_NONETWORKRESOURCE, WERR_CAN_NOT_COMPLETE and
> WERR_NERR_UNKNOWNDEVDIR, but none of these change the behavior of
> Computer Manager. It simply fails without telling you that it failed
> or why it failed, it seems. You simply do not get the new share added.
> In the trace I notice that there is a call to NetNameValidate before
> the call to NetShareAdd, and I wondered if this is the correct place
> to actually perform verification that you have the resources to create
> the share?
> There seem to be little documentation on NetNameValidate that I can
> find, however.
We have confirmed, with a little experimentation, that returning an
error from NetNameValidate gets Computer Manager to pop up a dialog
box saying that an error occurred.
To exploit that would require another script, or perhaps the net share
add script with a parameter saying validate vs one saying create for
the NetShareAdd step.
It's a bit racy though.
More information about the samba-technical