int users_id, unix_uid, status;
char type[FILESYS_TYPE_SIZE];
char name[FILESYS_NAME_SIZE];
+ int fid;
EXEC SQL END DECLARE SECTION;
sprintf(foutf, "%s/winuser.db", winad_dir);
strtrim(login);
strtrim(mit_id);
- EXEC SQL SELECT type, name INTO :type, :name
- FROM filesys
- WHERE lockertype = 'HOMEDIR'
- AND owner = :users_id;
+ EXEC SQL SELECT filsys_id into :fid
+ FROM filesys
+ WHERE lockertype = 'HOMEDIR'
+ AND label = :login
+ AND type = 'FSGROUP';
if (sqlca.sqlcode == 0)
{
- strtrim(type);
- strtrim(name);
+ EXEC SQL DECLARE f_cursor CURSOR FOR
+ SELECT type, name
+ FROM filesys a, fsgroup b
+ WHERE a.filsys_id=b.filsys_id
+ AND b.group_id=:fid
+ ORDER by key;
+
+ EXEC SQL OPEN f_cursor;
+
+ EXEC SQL FETCH f_cursor INTO :type, :name;
+
+ if (sqlca.sqlcode == 0)
+ {
+ strtrim(type);
+ strtrim(name);
+ }
+ else
+ {
+ strcpy(type, "");
+ strcpy(name, "");
+ }
+
+ EXEC SQL CLOSE f_cursor;
}
+
+
else
{
- strcpy(type, "");
- strcpy(name, "");
+ EXEC SQL SELECT type, name into :type, :name
+ FROM filesys
+ WHERE lockertype = 'HOMEDIR'
+ AND label=:login;
+
+ if (sqlca.sqlcode == 0)
+ {
+ strtrim(type);
+ strtrim(name);
+ }
+ else
+ {
+ strcpy(type, "");
+ strcpy(name, "");
+ }
}
+
fprintf(fout, "%d %s %d %d %s %s %s\n",
- users_id, login, unix_uid, status, mit_id,
- type, name);
- }
-
+ users_id, login, unix_uid, status, mit_id,
+ type, name);
+ }
+
if (sqlca.sqlcode < 0)
db_error(sqlca.sqlcode);
EXEC SQL CLOSE u_cursor;
int n;
int rc;
int i;
+ int last_weight;
u_int userAccountControl = UF_NORMAL_ACCOUNT | UF_DONT_EXPIRE_PASSWD | UF_PASSWD_CANT_CHANGE;
char filter[128];
char *attr_array[3];
+ char cWeight[3];
char **hp;
char path[256];
+ char cPath[256];
char temp[256];
char winPath[256];
char winProfile[256];
n = 0;
if ((hp = hes_resolve(user_name, "filsys")) != NULL)
{
+ memset(cWeight, 0, sizeof(cWeight));
+ memset(cPath, 0, sizeof(cPath));
memset(path, 0, sizeof(path));
memset(winPath, 0, sizeof(winPath));
- sscanf(hp[0], "%*s %s", path);
- if (strlen(path) && strnicmp(path, AFS, strlen(AFS)) == 0)
- {
- AfsToWinAfs(path, winPath);
- homedir_v[0] = winPath;
- ADD_ATTR("homeDirectory", homedir_v, LDAP_MOD_REPLACE);
- strcpy(winProfile, winPath);
- strcat(winProfile, "\\.winprofile");
- winProfile_v[0] = winProfile;
- ADD_ATTR("profilePath", winProfile_v, LDAP_MOD_REPLACE);
- drives_v[0] = "H:";
- ADD_ATTR("homeDrive", drives_v, LDAP_MOD_REPLACE);
+ last_weight = 1000;
+ i = 0;
+ while (hp[i] != NULL)
+ {
+ sscanf(hp[i], "%*s %s", cPath);
+ if (strlen(cPath) && strnicmp(cPath, AFS, strlen(AFS)) == 0)
+ {
+ sscanf(hp[i], "%*s %*s %*s %*s %s", cWeight);
+ if (atoi(cWeight) < last_weight)
+ {
+ strcpy(path, cPath);
+ last_weight = (int)atoi(cWeight);
+ }
+ }
+ ++i;
+ }
+ if (strlen(path))
+ {
+ if (!strnicmp(path, AFS, strlen(AFS)))
+ {
+ AfsToWinAfs(path, winPath);
+ homedir_v[0] = winPath;
+ ADD_ATTR("homeDirectory", homedir_v, LDAP_MOD_REPLACE);
+ strcpy(winProfile, winPath);
+ strcat(winProfile, "\\.winprofile");
+ winProfile_v[0] = winProfile;
+ ADD_ATTR("profilePath", winProfile_v, LDAP_MOD_REPLACE);
+ drives_v[0] = "H:";
+ ADD_ATTR("homeDrive", drives_v, LDAP_MOD_REPLACE);
+ }
}
}
uid_v[0] = Uid;