NTSTATUS status;
TALLOC_CTX *tmp_ctx = talloc_new(p->mem_ctx);
if (tmp_ctx == NULL) {
- return E_OUTOFMEMORY;
+ ret = E_OUTOFMEMORY;
+ goto err_out;
}
if (!fss_permitted(p)) {
- talloc_free(tmp_ctx);
- return E_ACCESSDENIED;
+ ret = E_ACCESSDENIED;
+ goto err_tmp_free;
}
sc_set = sc_set_lookup(fss_global.sc_sets, &r->in.ShadowCopySetId);
if (sc_set == NULL) {
- talloc_free(tmp_ctx);
- return E_INVALIDARG;
+ ret = E_INVALIDARG;
+ goto err_tmp_free;
}
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);
+ ret = fss_ntstatus_map(status);
+ goto err_tmp_free;
}
snum = find_service(tmp_ctx, share, &service);
if ((snum == -1) || (service == NULL)) {
DEBUG(0, ("share at %s not found\n", r->in.ShareName));
- talloc_free(tmp_ctx);
- return E_INVALIDARG;
+ ret = E_INVALIDARG;
+ goto err_tmp_free;
}
path_name = lp_pathname(tmp_ctx, snum);
if (path_name == NULL) {
- talloc_free(tmp_ctx);
- return E_OUTOFMEMORY;
+ ret = E_OUTOFMEMORY;
+ goto err_tmp_free;
}
status = fss_vfs_conn_create(tmp_ctx, server_event_context(),
p->msg_ctx, p->session_info, snum, &conn);
if (!NT_STATUS_IS_OK(status)) {
- talloc_free(tmp_ctx);
- return E_ACCESSDENIED;
+ ret = E_ACCESSDENIED;
+ goto err_tmp_free;
}
if (!become_user_by_session(conn, p->session_info)) {
DEBUG(0, ("failed to become user\n"));
fss_vfs_conn_destroy(conn);
- talloc_free(tmp_ctx);
- return E_ACCESSDENIED;
+ ret = E_ACCESSDENIED;
+ goto err_tmp_free;
}
status = SMB_VFS_SNAP_CHECK_PATH(conn, tmp_ctx, path_name, &base_vol);
unbecome_user();
fss_vfs_conn_destroy(conn);
if (!NT_STATUS_IS_OK(status)) {
- talloc_free(tmp_ctx);
- return FSRVP_E_NOT_SUPPORTED;
+ /* FIXME ret = fss_ntstatus_map(status); */
+ ret = FSRVP_E_NOT_SUPPORTED;
+ goto err_tmp_free;
}
if ((sc_set->state != FSS_SC_STARTED)
&& (sc_set->state != FSS_SC_ADDED)) {
- talloc_free(tmp_ctx);
- return FSRVP_E_BAD_STATE;
+ ret = FSRVP_E_BAD_STATE;
+ goto err_tmp_free;
}
/* TODO stop msg seq timer */
*/
sc = sc_lookup_volname(sc_set->scs, base_vol);
if (sc != NULL) {
- talloc_free(tmp_ctx);
- return FSRVP_E_OBJECT_ALREADY_EXISTS;
+ ret = FSRVP_E_OBJECT_ALREADY_EXISTS;
+ goto err_tmp_free;
}
sc = talloc_zero(sc_set, struct fss_sc);
if (sc == NULL) {
- talloc_free(tmp_ctx);
- return E_OUTOFMEMORY;
+ ret = E_OUTOFMEMORY;
+ goto err_tmp_free;
}
talloc_steal(sc, base_vol);
sc->volume_name = base_vol;
sc->id = GUID_random(); /* Windows servers ignore client ids */
sc->id_str = GUID_string(sc, &sc->id);
if (sc->id_str == NULL) {
- talloc_free(sc);
- talloc_free(tmp_ctx);
- return E_OUTOFMEMORY;
+ ret = E_OUTOFMEMORY;
+ goto err_sc_free;
}
sc_smap = talloc_zero(sc, struct fss_sc_smap);
if (sc_smap == NULL) {
- talloc_free(sc);
- talloc_free(tmp_ctx);
- return E_OUTOFMEMORY;
+ ret = E_OUTOFMEMORY;
+ goto err_sc_free;
}
sc_smap->snum = snum;
*/
ret = map_share_name(sc_smap, sc);
if (ret) {
- talloc_free(sc);
- talloc_free(tmp_ctx);
- return ret;
+ goto err_sc_free;
}
/* add share map to shadow-copy */
/* TODO start the Message Sequence Timer with timeout of 180 seconds */
talloc_free(tmp_ctx);
return 0;
+
+err_sc_free:
+ talloc_free(sc);
+err_tmp_free:
+ talloc_free(tmp_ctx);
+err_out:
+ return ret;
}
struct fss_sc_commit_state {