FILE *outfsf;
struct stat sb;
char *c;
- int flag;
initialize_sms_error_table();
sprintf(wkgrp, "%s/group~", www_dir);
sprintf(wkfs, "%s/filsys~", www_dir);
- flag = 0;
- if (stat(outfs, &sb) == 0)
+ fprintf(stderr, "%s: building fs database...\n", whoami);
+ if (!(outfsf = fopen(wkfs, "w")))
{
- if (ModDiff (&flag, "filesys", sb.st_mtime))
- exit(MR_DATE);
+ fprintf(stderr, "%s: cannot open %s for writing (%s)\n", whoami,
+ wkfs, strerror(errno));
+ exit(MR_OCONFIG);
}
- if (flag < 0)
- fprintf(stderr, "%s: %s does not need to be rebuilt.\n", whoami, outfs);
- else
+ filsys(outfsf);
+ if (fclose(outfsf))
{
- fprintf(stderr, "%s: building fs database...\n", whoami);
- if (!(outfsf = fopen(wkfs, "w")))
- {
- fprintf(stderr, "%s: cannot open %s for writing (%s)\n", whoami,
- wkfs, strerror(errno));
- exit(MR_OCONFIG);
- }
- filsys(outfsf);
- if (fclose(outfsf))
- {
- fprintf(stderr, "%s: close of %s failed (%s)", whoami,
- wkfs, strerror(errno));
- exit(MR_CCONFIG);
- }
- fix_file(outfs);
+ fprintf(stderr, "%s: close of %s failed (%s)", whoami,
+ wkfs, strerror(errno));
+ exit(MR_CCONFIG);
}
+ fix_file(outfs);
- flag = 0;
- if (stat(outgrp, &sb) == 0)
+ fprintf(stderr, "%s: building group database...\n", whoami);
+ if (!(outgrpf = fopen(wkgrp, "w")))
{
- if (ModDiff (&flag, "list", sb.st_mtime) ||
- ModDiff (&flag, "users", sb.st_mtime))
- exit(MR_DATE);
+ fprintf(stderr, "%s: cannot open %s for writing (%s)\n", whoami,
+ wkgrp, strerror(errno));
+ exit(MR_OCONFIG);
}
- if (flag < 0)
- fprintf(stderr, "%s: %s does not need to be rebuilt.\n", whoami, outgrp);
- else
+ group(outgrpf);
+ if (fclose(outgrpf))
{
- fprintf(stderr, "%s: building group database...\n", whoami);
- if (!(outgrpf = fopen(wkgrp, "w")))
- {
- fprintf(stderr, "%s: cannot open %s for writing (%s)\n", whoami,
- wkgrp, strerror(errno));
- exit(MR_OCONFIG);
- }
- group(outgrpf);
- if (fclose(outgrpf))
- {
- fprintf(stderr, "%s: close of %s failed (%s)", whoami, wkgrp,
- strerror(errno));
- exit(MR_CCONFIG);
- }
- fix_file(outgrp);
+ fprintf(stderr, "%s: close of %s failed (%s)", whoami, wkgrp,
+ strerror(errno));
+ exit(MR_CCONFIG);
}
-
+ fix_file(outgrp);
+
fprintf(stderr, "%s: building tar file...\n", whoami);
sprintf(cmd, "(cd %s; tar cf - . ) > %s.out", www_dir, www_dir);
if (system(cmd))
EXEC SQL BEGIN DECLARE SECTION;
char label[FILESYS_LABEL_SIZE], path[FILESYS_NAME_SIZE];
char type[FILESYS_TYPE_SIZE], key[FSGROUP_KEY_SIZE];
+ char alias[ALIAS_NAME_SIZE];
int status, fid;
EXEC SQL END DECLARE SECTION;
if (!strcmp(strtrim(type), "FSGROUP"))
{
+ *path = '\0';
EXEC SQL DECLARE group_cursor CURSOR FOR
SELECT f.name, g.key FROM filesys f, fsgroup g
WHERE f.filsys_id = g.filsys_id AND f.type='AFS'
EXEC SQL CLOSE group_cursor;
}
+ EXEC SQL DECLARE alias_cursor CURSOR FOR
+ SELECT name INTO :alias FROM alias
+ WHERE type='FILESYS' AND trans=:label;
+
if (!*strtrim(path))
continue;
+ for (c = label; *c; c++)
+ *c = tolower(*c);
fprintf(out, "%s:%s\n", label, path);
+
+ EXEC SQL OPEN alias_cursor;
+ while (1)
+ {
+ EXEC SQL FETCH alias_cursor INTO :alias;
+ if (sqlca.sqlcode)
+ break;
+
+ if (!*strtrim(alias))
+ continue;
+ for (c = alias; *c; c++)
+ *c = tolower(*c);
+ fprintf(out, "%s:%s\n", alias, path);
+ }
+ EXEC SQL CLOSE alias_cursor;
}
EXEC SQL CLOSE filsys_cursor;
EXEC SQL WHENEVER SQLERROR GOTO sqlerr;
EXEC SQL DECLARE user_cursor CURSOR FOR
- SELECT login FROM users WHERE status=1 ORDER by login;
+ SELECT login FROM users WHERE status=1 OR status=2 OR status=6 OR status=9
+ ORDER by login;
EXEC SQL OPEN user_cursor;
while (1)
if (sqlca.sqlcode)
break;
strtrim(user);
+ if (!isalpha(*user))
+ continue;
+
recsize = strlen(user) + 3;
first = 1;
+ fprintf(out, "%s:xjOhFdLKGK84w:", user);
EXEC SQL DECLARE member_cursor CURSOR FOR
SELECT DISTINCT l.name from list l, imembers i, users u
if (sqlca.sqlcode)
break;
strtrim(list);
- if (first)
- fprintf(out, "%s:xjOhFdLKGK84w:", user);
fprintf(out, "%s%s", first ? "" : ",", list);
recsize += strlen(list) + 1;
first = 0;
EXEC SQL CLOSE member_cursor;
EXEC SQL COMMIT;
- if (!first)
- fprintf(out, "\n");
+ fprintf(out, "\n");
}
EXEC SQL CLOSE user_cursor;