diff options
author | Jim McDonough <jmcd@samba.org> | 2002-05-09 23:44:46 +0000 |
---|---|---|
committer | Jim McDonough <jmcd@samba.org> | 2002-05-09 23:44:46 +0000 |
commit | 180311a48cfa808ea9edc9f32558554b243b10eb (patch) | |
tree | a8c5a8cf68f41f22bd56fa5e73beb61f7a94ce5e /source/libads | |
parent | 32fa089adead6ff3279172fd36560f4f9e2aeef0 (diff) | |
download | samba-180311a48cfa808ea9edc9f32558554b243b10eb.tar.gz samba-180311a48cfa808ea9edc9f32558554b243b10eb.tar.xz samba-180311a48cfa808ea9edc9f32558554b243b10eb.zip |
Add ads group account add function.
Diffstat (limited to 'source/libads')
-rw-r--r-- | source/libads/ldap_user.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/source/libads/ldap_user.c b/source/libads/ldap_user.c index 13e68eb82e0..c1a9a89e467 100644 --- a/source/libads/ldap_user.c +++ b/source/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 |