uint32_t _fss_GetShareMapping(struct pipes_struct *p,
struct fss_GetShareMapping *r)
{
+ NTSTATUS status;
struct fss_sc_set *sc_set;
struct fss_sc *sc;
struct fss_sc_smap *sc_smap;
char *share;
struct fssagent_share_mapping_1 *sm_out;
+ TALLOC_CTX *tmp_ctx = talloc_new(p->mem_ctx);
+ if (tmp_ctx == NULL) {
+ return E_OUTOFMEMORY;
+ }
if (!fss_permitted(p)) {
+ talloc_free(tmp_ctx);
return E_ACCESSDENIED;
}
sc_set = sc_set_lookup(fss_global.sc_sets, &r->in.ShadowCopySetId);
if (sc_set == NULL) {
+ talloc_free(tmp_ctx);
return E_INVALIDARG;
}
sc = sc_lookup(sc_set->scs, &r->in.ShadowCopyId);
if (sc == NULL) {
+ talloc_free(tmp_ctx);
return E_INVALIDARG;
}
- share = strrchr(r->in.ShareName, '\\');
- if (share++ == NULL) {
- return E_INVALIDARG;
+ status = fss_unc_parse(tmp_ctx, r->in.ShareName, NULL, &share);
+ if (!NT_STATUS_IS_OK(status)) {
+ talloc_free(tmp_ctx);
+ return fss_ntstatus_map(status);
}
sc_smap = sc_smap_lookup(sc->smaps, share);
if (sc_smap == NULL) {
+ talloc_free(tmp_ctx);
return E_INVALIDARG;
}
if (r->in.Level != 1) {
+ talloc_free(tmp_ctx);
return E_INVALIDARG;
}
addr = tsocket_address_inet_addr_string(p->local_address, p->mem_ctx);
if (addr == NULL) {
+ talloc_free(tmp_ctx);
return E_OUTOFMEMORY;
}
sm_out->ShadowCopyShareName = sc_smap->sc_share_name;
unix_to_nt_time(&sm_out->tstamp, sc->create_ts);
r->out.ShareMapping->ShareMapping1 = sm_out;
+ talloc_free(tmp_ctx);
return 0;
}
delete_state->sc = sc;
delete_state->snum = sc->smaps->snum;
- share = strrchr(r->in.ShareName, '\\');
- if (share++ == NULL) {
- tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER);
+ status = fss_unc_parse(delete_state, r->in.ShareName, NULL, &share);
+ if (!NT_STATUS_IS_OK(status)) {
+ tevent_req_nterror(req, status);
return tevent_req_post(req, ev);
}