Fixes #266
I haven't been able to test this as the Windows machine we have
available decided to not behave today.
I may try again next week assuming I have time.
Simo.
--
Simo Sorce * Red Hat, Inc * New York
From c8044a8ba346c0b0e5858e327a8b6e949bea6dd1 Mon Sep 17 00:00:00 2001
From: Simo Sorce sso...@redhat.com
Date: Fri, 18 Feb 2011 10:54:31 -0500
Subject: [PATCH] Set the loginShell attribute on winsynced entries if configured
Fixes: https://fedorahosted.org/freeipa/ticket/266
---
.../ipa-winsync/ipa-winsync-conf.ldif |1 +
.../ipa-winsync/ipa-winsync-config.c | 53
.../ipa-slapi-plugins/ipa-winsync/ipa-winsync.c|6 ++
.../ipa-slapi-plugins/ipa-winsync/ipa-winsync.h|7 ++-
4 files changed, 66 insertions(+), 1 deletions(-)
diff --git a/daemons/ipa-slapi-plugins/ipa-winsync/ipa-winsync-conf.ldif b/daemons/ipa-slapi-plugins/ipa-winsync/ipa-winsync-conf.ldif
index 5b5c56acb311569ab76b37da8c9094d6cedf6fa8..e1e397f9054c6bef2ee295c314195a5249a6560e 100644
--- a/daemons/ipa-slapi-plugins/ipa-winsync/ipa-winsync-conf.ldif
+++ b/daemons/ipa-slapi-plugins/ipa-winsync/ipa-winsync-conf.ldif
@@ -19,6 +19,7 @@ ipaWinSyncNewEntryFilter: (cn=ipaConfig)
ipaWinSyncNewUserOCAttr: ipauserobjectclasses
ipaWinSyncUserFlatten: true
ipaWinsyncHomeDirAttr: ipaHomesRootDir
+ipaWinsyncLoginShellAttr: ipaDefaultLoginShell
ipaWinSyncDefaultGroupAttr: ipaDefaultPrimaryGroup
ipaWinSyncDefaultGroupFilter: (gidNumber=*)(objectclass=posixGroup)(objectclass=groupOfNames)
ipaWinSyncAcctDisable: both
diff --git a/daemons/ipa-slapi-plugins/ipa-winsync/ipa-winsync-config.c b/daemons/ipa-slapi-plugins/ipa-winsync/ipa-winsync-config.c
index a61cabb142a5e90f404fc563720bbdfa3f17ccfc..b089d3d1486e7d5420b204a8de3eb2118cf05af9 100644
--- a/daemons/ipa-slapi-plugins/ipa-winsync/ipa-winsync-config.c
+++ b/daemons/ipa-slapi-plugins/ipa-winsync/ipa-winsync-config.c
@@ -238,6 +238,15 @@ ipa_winsync_validate_config (Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_E
goto done2;
}
+/* get login_shell_attr */
+if (slapi_entry_attr_find(e, IPA_WINSYNC_LOGIN_SHELL_ATTR,
+ testattr) ||
+(NULL == testattr)) {
+PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE,
+Warning: no value given for %s,
+IPA_WINSYNC_LOGIN_SHELL_ATTR);
+}
+
/* get default_group_attr */
if (slapi_entry_attr_find(e, IPA_WINSYNC_DEFAULTGROUP_ATTR,
testattr) ||
@@ -372,6 +381,7 @@ ipa_winsync_apply_config (Slapi_PBlock *pb, Slapi_Entry* entryBefore,
char *new_entry_filter = NULL;
char *new_user_oc_attr = NULL; /* don't care about groups for now */
char *homedir_prefix_attr = NULL;
+char *login_shell_attr = NULL;
char *default_group_attr = NULL;
char *default_group_filter = NULL;
char *acct_disable = NULL;
@@ -436,6 +446,15 @@ ipa_winsync_apply_config (Slapi_PBlock *pb, Slapi_Entry* entryBefore,
goto done3;
}
+/* get login_shell_attr */
+login_shell_attr = slapi_entry_attr_get_charptr(e,
+IPA_WINSYNC_LOGIN_SHELL_ATTR);
+if (!login_shell_attr) {
+PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE,
+Warning: no value given for %s,
+IPA_WINSYNC_LOGIN_SHELL_ATTR);
+}
+
/* get default_group_attr */
if (!(default_group_attr = slapi_entry_attr_get_charptr(
e, IPA_WINSYNC_DEFAULTGROUP_ATTR))) {
@@ -567,6 +586,11 @@ ipa_winsync_apply_config (Slapi_PBlock *pb, Slapi_Entry* entryBefore,
slapi_ch_free_string(theConfig.homedir_prefix_attr);
theConfig.homedir_prefix_attr = homedir_prefix_attr;
homedir_prefix_attr = NULL;
+if (login_shell_attr) {
+slapi_ch_free_string(theConfig.login_shell_attr);
+theConfig.login_shell_attr = login_shell_attr;
+login_shell_attr = NULL;
+}
slapi_ch_free_string(theConfig.default_group_attr);
theConfig.default_group_attr = default_group_attr;
default_group_attr = NULL;
@@ -594,6 +618,7 @@ done3:
slapi_ch_free_string(new_entry_filter);
slapi_ch_free_string(new_user_oc_attr);
slapi_ch_free_string(homedir_prefix_attr);
+slapi_ch_free_string(login_shell_attr);
slapi_ch_free_string(default_group_attr);
slapi_ch_free_string(default_group_filter);
slapi_ch_array_free(attrsvals);
@@ -636,6 +661,7 @@ ipa_winsync_config_destroy_domain(
iwdc-domain_e = NULL;
slapi_ch_free_string(iwdc-realm_name);
slapi_ch_free_string(iwdc-homedir_prefix);
+slapi_ch_free_string(iwdc-login_shell);
slapi_ch_free_string(iwdc-inactivated_group_dn);
slapi_ch_free_string(iwdc-activated_group_dn);
slapi_ch_free((void **)iwdc);
@@ -752,6 +778,7 @@ ipa_winsync_config_refresh_domain(
char *new_entry_filter = NULL;
char *new_user_oc_attr = NULL; /* don't care