EXEC SQL WHENEVER SQLERROR DO sqlerr();
/* Get print spoolers for allow lists. */
- EXEC SQL SELECT COUNT(service) INTO :alcount FROM serverhosts
- WHERE service = 'PRINT';
+ EXEC SQL SELECT COUNT(service) INTO :alcount FROM serverhosts sh, machine m
+ WHERE sh.service = 'PRINT' AND sh.mach_id = m.mach_id
+ AND m.status = 1 AND m.address != 'unassigned';
allowlist = malloc(alcount * sizeof(*allowlist));
EXEC SQL DECLARE csr_spool CURSOR FOR
SELECT m.address, sh.value3 FROM machine m, serverhosts sh
- WHERE m.mach_id = sh.mach_id AND sh.service = 'PRINT';
+ WHERE m.mach_id = sh.mach_id AND sh.service = 'PRINT'
+ AND m.status = 1 AND m.address != 'unassigned';
EXEC SQL OPEN csr_spool;
for (i = 0; i < alcount; i++)
{
FROM printers pr, machine m, machine m2
WHERE pr.type != 'ALIAS' AND pr.mach_id != 0
AND pr.mach_id = m.mach_id AND pr.loghost = m2.mach_id
- AND m.status = 1 AND m.address != 'unassigned'
ORDER BY m.hwaddr;
EXEC SQL OPEN csr_boot;
while (1)