summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim McDonough <jmcd@samba.org>2002-05-09 23:44:46 +0000
committerJim McDonough <jmcd@samba.org>2002-05-09 23:44:46 +0000
commit2503dc8eb80c35cbeef679a3d1b8d5579504cc47 (patch)
tree4787b821632ae36bdd1dbbdcc5504b7a979ad9f3
parent059da8fb3b7197bd6a9bfe57940a96a2546e63a5 (diff)
downloadsamba-2503dc8eb80c35cbeef679a3d1b8d5579504cc47.tar.gz
samba-2503dc8eb80c35cbeef679a3d1b8d5579504cc47.tar.bz2
samba-2503dc8eb80c35cbeef679a3d1b8d5579504cc47.zip
Add ads group account add function.
(This used to be commit 180311a48cfa808ea9edc9f32558554b243b10eb)
-rw-r--r--source3/libads/ldap_user.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/source3/libads/ldap_user.c b/source3/libads/ldap_user.c
index 13e68eb82e..c1a9a89e46 100644
--- a/source3/libads/ldap_user.c
+++ b/source3/libads/ldap_user.c
@@ -77,4 +77,37 @@ ADS_STATUS ads_add_user_acct(ADS_STRUCT *ads, const char *user,
talloc_destroy(ctx);
return status;
}
+
+ADS_STATUS ads_add_group_acct(ADS_STRUCT *ads, const char *group,
+ const char *comment)
+{
+ TALLOC_CTX *ctx;
+ ADS_MODLIST mods;
+ ADS_STATUS status;
+ char *new_dn;
+
+ if (!(ctx = talloc_init_named("ads_add_group_acct")))
+ return ADS_ERROR(LDAP_NO_MEMORY);
+
+ status = ADS_ERROR(LDAP_NO_MEMORY);
+
+ if (!(new_dn = talloc_asprintf(ctx, "cn=%s,cn=Users,%s", group,
+ ads->bind_path)))
+ goto done;
+ if (!(mods = ads_init_mods(ctx)))
+ goto done;
+
+ ads_mod_add(ctx, &mods, "cn", group);
+ ads_mod_add_var(ctx, &mods, LDAP_MOD_ADD, "objectClass", "top",
+ "group", NULL);
+ ads_mod_add(ctx, &mods, "name", group);
+ if (comment)
+ ads_mod_add(ctx, &mods, "description", comment);
+ ads_mod_add(ctx, &mods, "sAMAccountName", group);
+ status = ads_gen_add(ads, new_dn, mods);
+
+ done:
+ talloc_destroy(ctx);
+ return status;
+}
#endif