summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-06-05 19:00:05 +0200
committerGünther Deschner <gd@samba.org>2008-06-05 19:34:30 +0200
commite3e1172979522da0b80dab2d683ca48381b1cfa8 (patch)
tree24bf84c02453610804533e0caec04f98b38be3d9
parent387706a49dfdca539d0b1579703e6f96451ba040 (diff)
downloadsamba-e3e1172979522da0b80dab2d683ca48381b1cfa8.tar.gz
samba-e3e1172979522da0b80dab2d683ca48381b1cfa8.tar.bz2
samba-e3e1172979522da0b80dab2d683ca48381b1cfa8.zip
libnetjoin: add libnet_join_rollback().
This is required now if the join verify failed and we already modified the local configuration. Guenther (This used to be commit 2870fe50af5163e30330f5a3ef21d0b7eea85ee5)
-rw-r--r--source3/libnet/libnet_join.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c
index 16dcc61afe..3678ff9498 100644
--- a/source3/libnet/libnet_join.c
+++ b/source3/libnet/libnet_join.c
@@ -1733,6 +1733,35 @@ static WERROR libnet_DomainJoin(TALLOC_CTX *mem_ctx,
/****************************************************************
****************************************************************/
+WERROR libnet_join_rollback(TALLOC_CTX *mem_ctx,
+ struct libnet_JoinCtx *r)
+{
+ WERROR werr;
+ struct libnet_UnjoinCtx *u = NULL;
+
+ werr = libnet_init_UnjoinCtx(mem_ctx, &u);
+ if (!W_ERROR_IS_OK(werr)) {
+ return werr;
+ }
+
+ u->in.debug = r->in.debug;
+ u->in.dc_name = r->in.dc_name;
+ u->in.domain_name = r->in.domain_name;
+ u->in.admin_account = r->in.admin_account;
+ u->in.admin_password = r->in.admin_password;
+ u->in.modify_config = r->in.modify_config;
+ u->in.unjoin_flags = WKSSVC_JOIN_FLAGS_JOIN_TYPE |
+ WKSSVC_JOIN_FLAGS_ACCOUNT_DELETE;
+
+ werr = libnet_Unjoin(mem_ctx, u);
+ TALLOC_FREE(u);
+
+ return werr;
+}
+
+/****************************************************************
+****************************************************************/
+
WERROR libnet_Join(TALLOC_CTX *mem_ctx,
struct libnet_JoinCtx *r)
{
@@ -1762,7 +1791,7 @@ WERROR libnet_Join(TALLOC_CTX *mem_ctx,
if (r->in.join_flags & WKSSVC_JOIN_FLAGS_JOIN_TYPE) {
werr = libnet_join_post_verify(mem_ctx, r);
if (!W_ERROR_IS_OK(werr)) {
- goto done;
+ libnet_join_rollback(mem_ctx, r);
}
}