mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
libsmbconf: Convert smbconf_transaction_*() to sbcErr.
Signed-off-by: Michael Adam <obnox@samba.org>
This commit is contained in:
parent
72d15f0c03
commit
e1f0b91c5f
@ -422,17 +422,17 @@ sbcErr smbconf_delete_global_includes(struct smbconf_ctx *ctx)
|
||||
return err;
|
||||
}
|
||||
|
||||
WERROR smbconf_transaction_start(struct smbconf_ctx *ctx)
|
||||
sbcErr smbconf_transaction_start(struct smbconf_ctx *ctx)
|
||||
{
|
||||
return ctx->ops->transaction_start(ctx);
|
||||
}
|
||||
|
||||
WERROR smbconf_transaction_commit(struct smbconf_ctx *ctx)
|
||||
sbcErr smbconf_transaction_commit(struct smbconf_ctx *ctx)
|
||||
{
|
||||
return ctx->ops->transaction_commit(ctx);
|
||||
}
|
||||
|
||||
WERROR smbconf_transaction_cancel(struct smbconf_ctx *ctx)
|
||||
sbcErr smbconf_transaction_cancel(struct smbconf_ctx *ctx)
|
||||
{
|
||||
return ctx->ops->transaction_cancel(ctx);
|
||||
}
|
||||
|
@ -127,8 +127,8 @@ sbcErr smbconf_set_global_includes(struct smbconf_ctx *ctx,
|
||||
sbcErr smbconf_delete_includes(struct smbconf_ctx *ctx, const char *service);
|
||||
sbcErr smbconf_delete_global_includes(struct smbconf_ctx *ctx);
|
||||
|
||||
WERROR smbconf_transaction_start(struct smbconf_ctx *ctx);
|
||||
WERROR smbconf_transaction_commit(struct smbconf_ctx *ctx);
|
||||
WERROR smbconf_transaction_cancel(struct smbconf_ctx *ctx);
|
||||
sbcErr smbconf_transaction_start(struct smbconf_ctx *ctx);
|
||||
sbcErr smbconf_transaction_commit(struct smbconf_ctx *ctx);
|
||||
sbcErr smbconf_transaction_cancel(struct smbconf_ctx *ctx);
|
||||
|
||||
#endif /* _LIBSMBCONF_H_ */
|
||||
|
@ -68,9 +68,9 @@ struct smbconf_ops {
|
||||
uint32_t num_includes, const char **includes);
|
||||
sbcErr (*delete_includes)(struct smbconf_ctx *ctx,
|
||||
const char *service);
|
||||
WERROR (*transaction_start)(struct smbconf_ctx *ctx);
|
||||
WERROR (*transaction_commit)(struct smbconf_ctx *ctx);
|
||||
WERROR (*transaction_cancel)(struct smbconf_ctx *ctx);
|
||||
sbcErr (*transaction_start)(struct smbconf_ctx *ctx);
|
||||
sbcErr (*transaction_commit)(struct smbconf_ctx *ctx);
|
||||
sbcErr (*transaction_cancel)(struct smbconf_ctx *ctx);
|
||||
};
|
||||
|
||||
struct smbconf_ctx {
|
||||
|
@ -608,19 +608,19 @@ static sbcErr smbconf_txt_delete_includes(struct smbconf_ctx *ctx,
|
||||
return SBC_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
static WERROR smbconf_txt_transaction_start(struct smbconf_ctx *ctx)
|
||||
static sbcErr smbconf_txt_transaction_start(struct smbconf_ctx *ctx)
|
||||
{
|
||||
return WERR_OK;
|
||||
return SBC_ERR_OK;
|
||||
}
|
||||
|
||||
static WERROR smbconf_txt_transaction_commit(struct smbconf_ctx *ctx)
|
||||
static sbcErr smbconf_txt_transaction_commit(struct smbconf_ctx *ctx)
|
||||
{
|
||||
return WERR_OK;
|
||||
return SBC_ERR_OK;
|
||||
}
|
||||
|
||||
static WERROR smbconf_txt_transaction_cancel(struct smbconf_ctx *ctx)
|
||||
static sbcErr smbconf_txt_transaction_cancel(struct smbconf_ctx *ctx)
|
||||
{
|
||||
return WERR_OK;
|
||||
return SBC_ERR_OK;
|
||||
}
|
||||
|
||||
static struct smbconf_ops smbconf_ops_txt = {
|
||||
|
@ -1167,19 +1167,40 @@ done:
|
||||
return err;
|
||||
}
|
||||
|
||||
static WERROR smbconf_reg_transaction_start(struct smbconf_ctx *ctx)
|
||||
static sbcErr smbconf_reg_transaction_start(struct smbconf_ctx *ctx)
|
||||
{
|
||||
return regdb_transaction_start();
|
||||
WERROR werr;
|
||||
|
||||
werr = regdb_transaction_start();
|
||||
if (!W_ERROR_IS_OK(werr)) {
|
||||
return SBC_ERR_IO_FAILURE;
|
||||
}
|
||||
|
||||
return SBC_ERR_OK;
|
||||
}
|
||||
|
||||
static WERROR smbconf_reg_transaction_commit(struct smbconf_ctx *ctx)
|
||||
static sbcErr smbconf_reg_transaction_commit(struct smbconf_ctx *ctx)
|
||||
{
|
||||
return regdb_transaction_commit();
|
||||
WERROR werr;
|
||||
|
||||
werr = regdb_transaction_commit();
|
||||
if (!W_ERROR_IS_OK(werr)) {
|
||||
return SBC_ERR_IO_FAILURE;
|
||||
}
|
||||
|
||||
return SBC_ERR_OK;
|
||||
}
|
||||
|
||||
static WERROR smbconf_reg_transaction_cancel(struct smbconf_ctx *ctx)
|
||||
static sbcErr smbconf_reg_transaction_cancel(struct smbconf_ctx *ctx)
|
||||
{
|
||||
return regdb_transaction_cancel();
|
||||
WERROR werr;
|
||||
|
||||
werr = regdb_transaction_cancel();
|
||||
if (!W_ERROR_IS_OK(werr)) {
|
||||
return SBC_ERR_IO_FAILURE;
|
||||
}
|
||||
|
||||
return SBC_ERR_OK;
|
||||
}
|
||||
|
||||
struct smbconf_ops smbconf_ops_reg = {
|
||||
|
@ -380,8 +380,8 @@ static int net_conf_import(struct net_context *c, struct smbconf_ctx *conf_ctx,
|
||||
goto cancel;
|
||||
}
|
||||
|
||||
werr = smbconf_transaction_start(conf_ctx);
|
||||
if (!W_ERROR_IS_OK(werr)) {
|
||||
err = smbconf_transaction_start(conf_ctx);
|
||||
if (!SBC_ERROR_IS_OK(err)) {
|
||||
d_printf(_("error starting transaction: %s\n"),
|
||||
win_errstr(werr));
|
||||
goto done;
|
||||
@ -415,10 +415,10 @@ static int net_conf_import(struct net_context *c, struct smbconf_ctx *conf_ctx,
|
||||
* imported shares, the MAX_TALLOC_SIZE of 256 MB
|
||||
* was exceeded.
|
||||
*/
|
||||
werr = smbconf_transaction_start(conf_ctx);
|
||||
if (!W_ERROR_IS_OK(werr)) {
|
||||
err = smbconf_transaction_start(conf_ctx);
|
||||
if (!SBC_ERROR_IS_OK(err)) {
|
||||
d_printf(_("error starting transaction: %s\n"),
|
||||
win_errstr(werr));
|
||||
sbcErrorString(err));
|
||||
goto done;
|
||||
}
|
||||
|
||||
@ -433,26 +433,26 @@ static int net_conf_import(struct net_context *c, struct smbconf_ctx *conf_ctx,
|
||||
continue;
|
||||
}
|
||||
|
||||
werr = smbconf_transaction_commit(conf_ctx);
|
||||
if (!W_ERROR_IS_OK(werr)) {
|
||||
err = smbconf_transaction_commit(conf_ctx);
|
||||
if (!SBC_ERROR_IS_OK(err)) {
|
||||
d_printf(_("error committing transaction: "
|
||||
"%s\n"),
|
||||
win_errstr(werr));
|
||||
sbcErrorString(err));
|
||||
goto done;
|
||||
}
|
||||
werr = smbconf_transaction_start(conf_ctx);
|
||||
if (!W_ERROR_IS_OK(werr)) {
|
||||
err = smbconf_transaction_start(conf_ctx);
|
||||
if (!SBC_ERROR_IS_OK(err)) {
|
||||
d_printf(_("error starting transaction: %s\n"),
|
||||
win_errstr(werr));
|
||||
sbcErrorString(err));
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
werr = smbconf_transaction_commit(conf_ctx);
|
||||
if (!W_ERROR_IS_OK(werr)) {
|
||||
err = smbconf_transaction_commit(conf_ctx);
|
||||
if (!SBC_ERROR_IS_OK(err)) {
|
||||
d_printf(_("error committing transaction: %s\n"),
|
||||
win_errstr(werr));
|
||||
sbcErrorString(err));
|
||||
} else {
|
||||
ret = 0;
|
||||
}
|
||||
@ -460,10 +460,10 @@ static int net_conf_import(struct net_context *c, struct smbconf_ctx *conf_ctx,
|
||||
goto done;
|
||||
|
||||
cancel:
|
||||
werr = smbconf_transaction_cancel(conf_ctx);
|
||||
if (!W_ERROR_IS_OK(werr)) {
|
||||
err = smbconf_transaction_cancel(conf_ctx);
|
||||
if (!SBC_ERROR_IS_OK(err)) {
|
||||
d_printf(_("error cancelling transaction: %s\n"),
|
||||
win_errstr(werr));
|
||||
sbcErrorString(err));
|
||||
}
|
||||
|
||||
done:
|
||||
@ -586,7 +586,6 @@ static int net_conf_addshare(struct net_context *c,
|
||||
const char **argv)
|
||||
{
|
||||
int ret = -1;
|
||||
WERROR werr = WERR_OK;
|
||||
sbcErr err;
|
||||
char *sharename = NULL;
|
||||
const char *path = NULL;
|
||||
@ -713,10 +712,10 @@ static int net_conf_addshare(struct net_context *c,
|
||||
* start a transaction
|
||||
*/
|
||||
|
||||
werr = smbconf_transaction_start(conf_ctx);
|
||||
if (!W_ERROR_IS_OK(werr)) {
|
||||
err = smbconf_transaction_start(conf_ctx);
|
||||
if (!SBC_ERROR_IS_OK(err)) {
|
||||
d_printf("error starting transaction: %s\n",
|
||||
win_errstr(werr));
|
||||
sbcErrorString(err));
|
||||
goto done;
|
||||
}
|
||||
|
||||
@ -771,10 +770,10 @@ static int net_conf_addshare(struct net_context *c,
|
||||
* commit the whole thing
|
||||
*/
|
||||
|
||||
werr = smbconf_transaction_commit(conf_ctx);
|
||||
if (!W_ERROR_IS_OK(werr)) {
|
||||
err = smbconf_transaction_commit(conf_ctx);
|
||||
if (!SBC_ERROR_IS_OK(err)) {
|
||||
d_printf("error committing transaction: %s\n",
|
||||
win_errstr(werr));
|
||||
sbcErrorString(err));
|
||||
} else {
|
||||
ret = 0;
|
||||
}
|
||||
@ -782,10 +781,10 @@ static int net_conf_addshare(struct net_context *c,
|
||||
goto done;
|
||||
|
||||
cancel:
|
||||
werr = smbconf_transaction_cancel(conf_ctx);
|
||||
if (!W_ERROR_IS_OK(werr)) {
|
||||
err = smbconf_transaction_cancel(conf_ctx);
|
||||
if (!SBC_ERROR_IS_OK(err)) {
|
||||
d_printf("error cancelling transaction: %s\n",
|
||||
win_errstr(werr));
|
||||
sbcErrorString(err));
|
||||
}
|
||||
|
||||
done:
|
||||
@ -829,7 +828,6 @@ static int net_conf_setparm(struct net_context *c, struct smbconf_ctx *conf_ctx,
|
||||
int argc, const char **argv)
|
||||
{
|
||||
int ret = -1;
|
||||
WERROR werr = WERR_OK;
|
||||
sbcErr err;
|
||||
char *service = NULL;
|
||||
char *param = NULL;
|
||||
@ -858,10 +856,10 @@ static int net_conf_setparm(struct net_context *c, struct smbconf_ctx *conf_ctx,
|
||||
}
|
||||
value_str = argv[2];
|
||||
|
||||
werr = smbconf_transaction_start(conf_ctx);
|
||||
if (!W_ERROR_IS_OK(werr)) {
|
||||
err = smbconf_transaction_start(conf_ctx);
|
||||
if (!SBC_ERROR_IS_OK(err)) {
|
||||
d_printf(_("error starting transaction: %s\n"),
|
||||
win_errstr(werr));
|
||||
sbcErrorString(err));
|
||||
goto done;
|
||||
}
|
||||
|
||||
@ -881,10 +879,10 @@ static int net_conf_setparm(struct net_context *c, struct smbconf_ctx *conf_ctx,
|
||||
goto cancel;
|
||||
}
|
||||
|
||||
werr = smbconf_transaction_commit(conf_ctx);
|
||||
if (!W_ERROR_IS_OK(werr)) {
|
||||
err = smbconf_transaction_commit(conf_ctx);
|
||||
if (!SBC_ERROR_IS_OK(err)) {
|
||||
d_printf(_("error committing transaction: %s\n"),
|
||||
win_errstr(werr));
|
||||
sbcErrorString(err));
|
||||
} else {
|
||||
ret = 0;
|
||||
}
|
||||
@ -892,10 +890,10 @@ static int net_conf_setparm(struct net_context *c, struct smbconf_ctx *conf_ctx,
|
||||
goto done;
|
||||
|
||||
cancel:
|
||||
werr = smbconf_transaction_cancel(conf_ctx);
|
||||
if (!W_ERROR_IS_OK(werr)) {
|
||||
err = smbconf_transaction_cancel(conf_ctx);
|
||||
if (!SBC_ERROR_IS_OK(err)) {
|
||||
d_printf(_("error cancelling transaction: %s\n"),
|
||||
win_errstr(werr));
|
||||
sbcErrorString(err));
|
||||
}
|
||||
|
||||
done:
|
||||
|
Loading…
Reference in New Issue
Block a user