summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-01-07 19:31:20 +0100
committerGünther Deschner <gd@samba.org>2008-01-07 19:39:35 +0100
commitd66118629cccf01799ecdbcd73a944903908a64c (patch)
tree0cd0b45910ac72af1de8367c31b8d32c9b0cc9ea
parent5b5f17a81d76b4675a4a0f09f92dddbc3a221673 (diff)
downloadsamba-d66118629cccf01799ecdbcd73a944903908a64c.tar.gz
samba-d66118629cccf01799ecdbcd73a944903908a64c.tar.bz2
samba-d66118629cccf01799ecdbcd73a944903908a64c.zip
Add libnet_join_find_machine_acct().
Guenther (This used to be commit f550ed02ff9e0546c63064ab9dac760eac7e1e16)
-rw-r--r--source3/libnet/libnet_join.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c
index 627558d4a9..bc775a9d40 100644
--- a/source3/libnet/libnet_join.c
+++ b/source3/libnet/libnet_join.c
@@ -206,6 +206,52 @@ static ADS_STATUS libnet_unjoin_remove_machine_acct(TALLOC_CTX *mem_ctx,
/****************************************************************
****************************************************************/
+static ADS_STATUS libnet_join_find_machine_acct(TALLOC_CTX *mem_ctx,
+ struct libnet_JoinCtx *r)
+{
+ ADS_STATUS status;
+ LDAPMessage *res = NULL;
+ char *dn = NULL;
+
+ if (!r->in.machine_name) {
+ return ADS_ERROR(LDAP_NO_MEMORY);
+ }
+
+ status = ads_find_machine_acct(r->in.ads,
+ &res,
+ r->in.machine_name);
+ if (!ADS_ERR_OK(status)) {
+ return status;
+ }
+
+ if (ads_count_replies(r->in.ads, res) != 1) {
+ status = ADS_ERROR_LDAP(LDAP_NO_MEMORY);
+ goto done;
+ }
+
+ dn = ads_get_dn(r->in.ads, res);
+ if (!dn) {
+ status = ADS_ERROR_LDAP(LDAP_NO_MEMORY);
+ goto done;
+ }
+
+ TALLOC_FREE(r->out.dn);
+ r->out.dn = talloc_strdup(mem_ctx, dn);
+ if (!r->out.dn) {
+ status = ADS_ERROR_LDAP(LDAP_NO_MEMORY);
+ goto done;
+ }
+
+ done:
+ ads_msgfree(r->in.ads, res);
+ ads_memfree(r->in.ads, dn);
+
+ return status;
+}
+
+/****************************************************************
+****************************************************************/
+
static bool libnet_join_joindomain_store_secrets(TALLOC_CTX *mem_ctx,
struct libnet_JoinCtx *r)
{