summaryrefslogtreecommitdiff
path: root/source3/libads/ldap_user.c
diff options
context:
space:
mode:
authorJim McDonough <jmcd@samba.org>2002-06-24 17:50:02 +0000
committerJim McDonough <jmcd@samba.org>2002-06-24 17:50:02 +0000
commit24b67730bf7bbf4414df99129a3cc20aa93dc0da (patch)
treee550e73477dd26cf8316ec369efbcc0526c079ee /source3/libads/ldap_user.c
parent8361295ae799582e33c16beedf5f171bd8434a64 (diff)
downloadsamba-24b67730bf7bbf4414df99129a3cc20aa93dc0da.tar.gz
samba-24b67730bf7bbf4414df99129a3cc20aa93dc0da.tar.bz2
samba-24b67730bf7bbf4414df99129a3cc20aa93dc0da.zip
Support utf8 on the wire for ads ldap. DN's are converted, as well as strings,
though it is up to the calling function to decide whether values are strings or not. Attributes are not converted at this point, though support for it would be simple. I have tested it with users and groups using non-ascii chars, and if the check for alphanumeric user/domain names is removed form sesssetup.c, even a user with accented chars can connect, or even login (via winbind). I have also simplified the interfaces to ads_mod_*, though we will probably want to expand this by a few functions in the near future. We just had too many ways to do the same thing... (This used to be commit f924cb53580bc081ff34e45abba57629018c68d6)
Diffstat (limited to 'source3/libads/ldap_user.c')
-rw-r--r--source3/libads/ldap_user.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/source3/libads/ldap_user.c b/source3/libads/ldap_user.c
index c1a9a89e46..d0b6c2ca8c 100644
--- a/source3/libads/ldap_user.c
+++ b/source3/libads/ldap_user.c
@@ -44,6 +44,8 @@ ADS_STATUS ads_add_user_acct(ADS_STRUCT *ads, const char *user,
ADS_MODLIST mods;
ADS_STATUS status;
char *upn, *new_dn, *name, *controlstr;
+ const char *objectClass[] = {"top", "person", "organizationalPerson",
+ "user", NULL};
if (fullname && *fullname) name = fullname;
else name = user;
@@ -63,14 +65,13 @@ ADS_STATUS ads_add_user_acct(ADS_STRUCT *ads, const char *user,
if (!(mods = ads_init_mods(ctx)))
goto done;
- ads_mod_add(ctx, &mods, "cn", name);
- ads_mod_add_var(ctx, &mods, LDAP_MOD_ADD, "objectClass", "top",
- "person", "organizationalPerson", "user", NULL);
- ads_mod_add(ctx, &mods, "userPrincipalName", upn);
- ads_mod_add(ctx, &mods, "name", name);
- ads_mod_add(ctx, &mods, "displayName", name);
- ads_mod_add(ctx, &mods, "sAMAccountName", user);
- ads_mod_add(ctx, &mods, "userAccountControl", controlstr);
+ ads_mod_str(ctx, &mods, "cn", name);
+ ads_mod_strlist(ctx, &mods, "objectClass", objectClass);
+ ads_mod_str(ctx, &mods, "userPrincipalName", upn);
+ ads_mod_str(ctx, &mods, "name", name);
+ ads_mod_str(ctx, &mods, "displayName", name);
+ ads_mod_str(ctx, &mods, "sAMAccountName", user);
+ ads_mod_str(ctx, &mods, "userAccountControl", controlstr);
status = ads_gen_add(ads, new_dn, mods);
done:
@@ -85,6 +86,7 @@ ADS_STATUS ads_add_group_acct(ADS_STRUCT *ads, const char *group,
ADS_MODLIST mods;
ADS_STATUS status;
char *new_dn;
+ const char *objectClass[] = {"top", "group", NULL};
if (!(ctx = talloc_init_named("ads_add_group_acct")))
return ADS_ERROR(LDAP_NO_MEMORY);
@@ -97,13 +99,12 @@ ADS_STATUS ads_add_group_acct(ADS_STRUCT *ads, const char *group,
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);
+ ads_mod_str(ctx, &mods, "cn", group);
+ ads_mod_strlist(ctx, &mods, "objectClass",objectClass);
+ ads_mod_str(ctx, &mods, "name", group);
if (comment)
- ads_mod_add(ctx, &mods, "description", comment);
- ads_mod_add(ctx, &mods, "sAMAccountName", group);
+ ads_mod_str(ctx, &mods, "description", comment);
+ ads_mod_str(ctx, &mods, "sAMAccountName", group);
status = ads_gen_add(ads, new_dn, mods);
done: