From: zacheiss Date: Tue, 21 Sep 2004 06:08:17 +0000 (+0000) Subject: Properly set home directory at user creation time. X-Git-Url: http://andersk.mit.edu/gitweb/moira.git/commitdiff_plain/64ffea583a96258f408195e0f51c722add064032 Properly set home directory at user creation time. --- diff --git a/incremental/winad/winad.c b/incremental/winad/winad.c index d1f46f6a..cff3e54c 100755 --- a/incremental/winad/winad.c +++ b/incremental/winad/winad.c @@ -3120,14 +3120,8 @@ int filesys_process(LDAP *ldap_handle, char *dn_path, char *fs_name, char winProfile[256]; char filter[128]; char *attr_array[3]; - char *homedir_v[] = {NULL, NULL}; - char *winProfile_v[] = {NULL, NULL}; - char *drives_v[] = {NULL, NULL}; int group_count; - int n; int rc; - int i; - LDAPMod *mods[20]; LK_ENTRY *group_base; if (!check_string(fs_name)) @@ -3166,39 +3160,27 @@ int filesys_process(LDAP *ldap_handle, char *dn_path, char *fs_name, linklist_free(group_base); group_count = 0; - n = 0; if (operation == LDAP_MOD_ADD) { memset(winPath, 0, sizeof(winPath)); AfsToWinAfs(fs_pack, winPath); - homedir_v[0] = winPath; - drives_v[0] = "H:"; memset(winProfile, 0, sizeof(winProfile)); strcpy(winProfile, winPath); strcat(winProfile, "\\.winprofile"); - winProfile_v[0] = winProfile; + + rc = attribute_update(ldap_handle, distinguished_name, winProfile, "profilePath", fs_name); + rc = attribute_update(ldap_handle, distinguished_name, "H:", "homeDrive", fs_name); + rc = attribute_update(ldap_handle, distinguished_name, winPath, "homeDirectory", fs_name); + } else { - homedir_v[0] = NULL; - drives_v[0] = NULL; - winProfile_v[0] = NULL; + rc = attribute_update(ldap_handle, distinguished_name, "", "profilePath", fs_name); + rc = attribute_update(ldap_handle, distinguished_name, "", "homeDrive", fs_name); + rc = attribute_update(ldap_handle, distinguished_name, "", "homeDirectory", fs_name); } - ADD_ATTR("profilePath", winProfile_v, operation); - ADD_ATTR("homeDrive", drives_v, operation); - ADD_ATTR("homeDirectory", homedir_v, operation); - mods[n] = NULL; - rc = ldap_modify_s(ldap_handle, distinguished_name, mods); - if (rc != LDAP_SUCCESS) - { - com_err(whoami, 0, "Unable to modify user data for filesys %s : %s", - fs_name, ldap_err2string(rc)); - } - for (i = 0; i < n; i++) - free(mods[i]); - - return(rc); + return(0); } int user_create(int ac, char **av, void *ptr) @@ -5681,6 +5663,8 @@ int SetHomeDirectory(LDAP *ldap_handle, char *user_name, char *DistinguishedName } } } + else + return(n); } if (hp != NULL)