[2078] in Moira
changes to winad.gen
daemon@ATHENA.MIT.EDU (Qing Dong)
Mon Jul 26 15:08:49 2004
Message-Id: <5.1.0.14.2.20040726150542.02e90908@hesiod>
Date: Mon, 26 Jul 2004 15:08:46 -0400
To: moiradev@mit.edu
From: Qing Dong <dongq@MIT.EDU>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"; format=flowed
I made two changes to winad.pc:
1. get members of a list whose member type is MACHINE.
2. get the public and hidden flags of lists.
Let me know if you have any questions.
Thanks.
Qing
Index: winad.pc
===================================================================
RCS file:
\\dongq-afs\all\athena.mit.edu\astaff\project\moiradev\repository/moira/gen/winad.pc,v
retrieving revision 1.5
diff -c -r1.5 winad.pc
*** winad.pc 2003/08/14 02:43:09 1.5
--- winad.pc 2004/07/22 19:20:33
***************
*** 222,228 ****
char acltype[LIST_ACL_TYPE_SIZE];
int aclid;
char aclname[STRINGS_STRING_SIZE];
! int list_id, active, maillist, grouplist;
EXEC SQL END DECLARE SECTION;
sprintf(foutf, "%s/wingroup.db", winad_dir);
--- 222,228 ----
char acltype[LIST_ACL_TYPE_SIZE];
int aclid;
char aclname[STRINGS_STRING_SIZE];
! int list_id, active, publicflg, hidden, maillist, grouplist;
EXEC SQL END DECLARE SECTION;
sprintf(foutf, "%s/wingroup.db", winad_dir);
***************
*** 236,251 ****
}
EXEC SQL DECLARE l_cursor CURSOR FOR
! SELECT list_id, name, active, maillist, grouplist, description,
acl_type, acl_id
FROM list
ORDER BY list_id;
EXEC SQL OPEN l_cursor;
while (1)
{
! EXEC SQL FETCH l_cursor INTO :list_id, :listname, :active, :maillist,
! :grouplist,
! :description, :acltype, :aclid;
if (sqlca.sqlcode)
break;
--- 236,250 ----
}
EXEC SQL DECLARE l_cursor CURSOR FOR
! SELECT list_id, name, active, publicflg, hidden, maillist, grouplist,
description,
acl_type, acl_id
FROM list
ORDER BY list_id;
EXEC SQL OPEN l_cursor;
while (1)
{
! EXEC SQL FETCH l_cursor INTO :list_id, :listname, :active,
:publicflg, :hidden,
! :maillist,:grouplist,:description, :acltype, :aclid;
if (sqlca.sqlcode)
break;
***************
*** 277,284 ****
strtrim(aclname);
! fprintf(fout, "%d %s %d %d %d %s %s %s\n",
! list_id, listname, active, maillist, grouplist, acltype, aclname,
description);
}
--- 276,283 ----
strtrim(aclname);
! fprintf(fout, "%d %s %d %d %d %d %d %s %s %s\n",
! list_id, listname, active, publicflg, hidden, maillist, grouplist,
acltype, aclname,
description);
}
***************
*** 376,382 ****
--- 375,405 ----
db_error(sqlca.sqlcode);
EXEC SQL CLOSE csr002;
+
+ /* get all the machines */
+ EXEC SQL DECLARE csr003 CURSOR FOR
+ SELECT i.member_type, m.name
+ FROM machine m, imembers i
+ WHERE i.list_id = :list_id AND i.member_type = 'MACHINE'
+ AND i.member_id = m.mach_id
+ ORDER BY m.name;
+
+ EXEC SQL OPEN csr003;
+ while(1)
+ {
+ EXEC SQL FETCH csr003 into :member_type, :member_name;
+ if (sqlca.sqlcode)
+ break;
+ fprintf(fout, "%d %s %s\n",
+ list_id, member_type, member_name);
+ }
+
+ if (sqlca.sqlcode < 0)
+ db_error(sqlca.sqlcode);
+ EXEC SQL CLOSE csr003;
}
+
+
if (sqlca.sqlcode < 0)
db_error(sqlca.sqlcode);