char *whoami = "nfs.gen";
char *db = "moira/moira";
-char nfs_dir[64];
+char nfs_dir[MAXPATHLEN];
struct hash *users, *groups;
int do_nfs(void);
int do_nfs(void)
{
EXEC SQL BEGIN DECLARE SECTION;
- char machname[41], listname[33];
+ char machname[MACHINE_NAME_SIZE], listname[SERVERHOSTS_VALUE3_SIZE];
EXEC SQL END DECLARE SECTION;
struct save_queue *machs, *lists;
int changed;
int do_lists(struct save_queue *lists)
{
- char file[64], *u;
+ char file[MAXPATHLEN], *u;
FILE *fd;
EXEC SQL BEGIN DECLARE SECTION;
char *listname;
EXEC SQL END DECLARE SECTION;
sprintf(file, "%s/list-", nfs_dir);
-#if 0
- if (stat(file, &sb) == 0)
- {
- if ((ModDiff (&flag1, "users", sb.st_mtime)) ||
- (ModDiff (&flag2, "list", sb.st_mtime)) ||
- (ModDiff (&flag3, "imembers", sb.st_mtime)) ||
- (ModDiff (&flag4, "serverhosts", sb.st_mtime)))
- exit(MR_DATE);
- if (flag1 < 0 && flag2 < 0 && flag3 < 0 && flag4 < 0)
- {
- fprintf(stderr, "The lists do not need to be rebuilt.\n");
- return 0;
- }
- }
-#endif
/* build the list of everyone, and store it in a file whose name
* corresponds to the empty list.
struct grp *next;
char *lid;
};
+
struct user {
- char name[9];
+ char name[USERS_LOGIN_SIZE];
int uid;
struct grp *lists;
};
void do_everyone(void)
{
- char buf[BUFSIZ], *l;
+ const buflen = MAXPATHLEN;
+ char buf[MAXPATHLEN], *l;
struct user *u;
struct grp *g;
struct bucket *b, **p;
EXEC SQL BEGIN DECLARE SECTION;
- char name[33];
+ char name[USERS_LOGIN_SIZE];
int gid, id, lid, uid;
EXEC SQL END DECLARE SECTION;
FILE *fd;
EXEC SQL DECLARE l_cursor CURSOR FOR
SELECT gid, list_id
FROM list
- WHERE grouplist != 0 AND active != 0
+ WHERE nfsgroup != 0 AND grouplist != 0 AND active != 0
ORDER BY list_id;
EXEC SQL OPEN l_cursor;
while (1)
for (b = *p; b; b = b->next)
{
u = (struct user *)b->data;
- sprintf(buf, "%s:%d", u->name, u->uid);
+ sprintf(buf, "%s:%d:101", u->name, u->uid);
for (g = u->lists; g; g = g->next)
- strcat(buf, g->lid);
+ {
+ if ((strlen(buf) + strlen(g->lid)) <= buflen)
+ strcat(buf, g->lid);
+ else
+ {
+ com_err(whoami, 0, "truncated server-side grp list for %s",
+ u->name);
+ break;
+ }
+ }
b->data = strdup(buf);
fprintf(fd, "%s\n", buf);
}
}
fclose(fd);
+ return;
+
sqlerr:
db_error(sqlca.sqlcode);
exit(MR_DBMS_ERR);
int do_machs(struct save_queue *machs)
{
EXEC SQL BEGIN DECLARE SECTION;
- char *machname, listname[33], dev[33], dir[81], fstype[9];
+ char *machname, listname[SERVERHOSTS_VALUE3_SIZE];
+ char dev[NFSPHYS_DEVICE_SIZE], dir[FILESYS_NAME_SIZE];
+ char fstype[FILESYS_LOCKERTYPE_SIZE];
int uid, quota, id, gid, flag1, flag2, flag3;
EXEC SQL END DECLARE SECTION;
- char file[64], f1[64], f2[64], *cp;
+ char file[MAXPATHLEN], f1[MAXPATHLEN], f2[MAXPATHLEN], *cp;
int prevuid, quotasum, olddev, oldmach;
FILE *fd;
struct hash *machines;
db_error(sqlca.sqlcode);
exit(MR_DBMS_ERR);
}
+