[1687] in Moira
sidhistory in moira
daemon@ATHENA.MIT.EDU (Qing Dong)
Fri Oct 20 15:12:59 2000
Message-Id: <200010201912.PAA16399@melbourne-city-street.MIT.EDU>
Date: Fri, 20 Oct 2000 15:14:34 -0400
To: moiradev@mit.edu
From: Qing Dong <dongq@MIT.EDU>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
The pismere team would like to store user and group SIDs in
the NT/2000 environment into the moira database. It allows us
to grant the user/group the same access rights to resources
if we ever lose our domain and have to rebuild it from moira.
We want to add two tables: usersids stores a list of user SID
associated with a users_id, listsids stores a list of list SID associated
with a list_id.
We want to add the following four queries:
get_user_sids_by_login
args: login
returns: {users_id, sid, created}
acl: dbadmin
validate: users_id existing in users table
get_list_sids_by_name
args: name
returns: {list_id, sid, created}
acl: adadmin
validate: list_id existing in list table
add_user_sid_by_login
args: login, sid
acl: dbadmin
validate: no duplicate sids in table already
add_list_sid_by_name
args: name, sid
acl: dbadmin
validate: no duplicate sids in table already
The attached is the proposed changes to various files. I am still trying to
understand the server and db sides of moira and I would really appreciate
your help in looking at those changes. Since I would like only dbadmin to
execute the queries, do I have to modify the capacl table or is it automatic?
Thanks.
Index: schema.sql
===================================================================
RCS file:
\\dongq-afs\all\athena.mit.edu\astaff\project\moiradev\repository/moira/db/s
chema.sql,v
retrieving revision 1.19
diff -c -r1.19 schema.sql
*** schema.sql 2000/09/25 22:51:55 1.19
--- schema.sql 2000/10/20 17:41:39
***************
*** 380,382 ****
--- 380,397 ----
table_name VARCHAR(16) DEFAULT CHR(0) NOT NULL,
service VARCHAR(16) DEFAULT CHR(0) NOT NULL
);
+
+ create table usersids
+ (
+ users_id INTEGER DEFAULT 0 NOT NULL,
+ sid RAW(64) DEFAULT CHR(0) NOT NULL,
+ created DATE DEFAULT SYSDATE NOT NULL
+ );
+
+ create table listsids
+ (
+ list_id INTEGER DEFAULT 0 NOT NULL,
+ sid RAW(64) DEFAULT CHR(0) NOT NULL,
+ created DATE DEFAULT SYSDATE NOT NULL
+ );
+
Index: unschema.sql
===================================================================
RCS file:
\\dongq-afs\all\athena.mit.edu\astaff\project\moiradev\repository/moira/db/u
nschema.sql,v
retrieving revision 1.4
diff -c -r1.4 unschema.sql
*** unschema.sql 1999/07/29 00:09:15 1.4
--- unschema.sql 2000/10/19 20:59:54
***************
*** 26,28 ****
--- 26,30 ----
drop table numvalues;
drop table tblstats;
drop table incremental;
+ drop table usersids;
+ drop table listsids;
Index: dbopt.sql
===================================================================
RCS file:
\\dongq-afs\all\athena.mit.edu\astaff\project\moiradev\repository/moira/db/d
bopt.sql,v
retrieving revision 1.12
diff -c -r1.12 dbopt.sql
*** dbopt.sql 2000/08/10 02:20:54 1.12
--- dbopt.sql 2000/10/20 17:46:40
***************
*** 84,86 ****
--- 84,90 ----
create index i_prn_con on printers (contact);
create index i_cap_tag on capacls (tag);
+
+ create index i_usersids_usid on usersids (users_id);
+
+ create index i_listsids_lid on listsids (list_id);
Index: queries2.c
===================================================================
RCS file:
\\dongq-afs\all\athena.mit.edu\astaff\project\moiradev\repository/moira/serv
er/queries2.c,v
retrieving revision 2.78
diff -c -r2.78 queries2.c
*** queries2.c 2000/10/18 19:20:44 2.78
--- queries2.c 2000/10/20 18:17:04
***************
*** 2945,2952 ****
_sdl_followup,
};
!
!
/* Generalized Query Definitions */
/* Multiple versions of the same query MUST be listed in ascending
--- 2945,3025 ----
_sdl_followup,
};
! static char *gusl_fields[] = {
! "login",
! "users_id",
! "sid",
! "created"
! };
!
! static struct validate gusl_validate =
! {
! VOuser0,
! 1,
! NULL,
! NULL,
! 0,
! 0,
! 0,
! 0,
! 0,
! };
!
! static char *glsn_fields[] = {
! "name",
! "list_id",
! "sid",
! "created"
! };
!
! static struct validate glsn_validate =
! {
! VOlist0,
! 1,
! NULL,
! NULL,
! 0,
! 0,
! 0,
! 0,
! 0,
! };
!
! static char *ausl_fields[] = {
! "login",
! "sid"
! };
!
! static struct validate ausl_validate =
! {
! VOuser0,
! 1,
! "sid",
! "sid = '%s'",
! 1,
! 0,
! 0,
! 0,
! 0,
! };
!
! static char *alsn_fields[] = {
! "name",
! "sid"
! };
!
! static struct validate alsn_validate =
! {
! VOlist0,
! 1,
! "sid",
! "sid = '%s'",
! 1,
! 0,
! 0,
! 0,
! 0,
! };
/* Generalized Query Definitions */
/* Multiple versions of the same query MUST be listed in ascending
***************
*** 6110,6115 ****
--- 6183,6256 ----
NULL,
&_sdl_validate,
},
+
+ {
+ /* Q_GUSL - GET_USER_SIDS_BY_LOGIN, v4 */
+ "get_user_sids_by_login",
+ "gusl",
+ 4,
+ RETRIEVE,
+ "s",
+ USERSIDS_TABLE,
+ "users_id, sid, TO_CHAR(created, 'YYYY-MM-DD HH24:MI:SS') from
usersids",
+ gusl_field,
+ 3,
+ "users_id = %d",
+ 1,
+ "created",
+ &gusl_validate,
+ },
+
+ {
+ /* Q_AUSL - ADD_USER_SID_BY_LOGIN, v4 */
+ "add_user_sid_by_login",
+ "ausl",
+ 4,
+ APPEND,
+ "s",
+ USERSIDS_TABLE,
+ "into usersids (users_id, sid) values (%d, '%s')",
+ ausl_field,
+ 2,
+ NULL,
+ 0,
+ NULL,
+ &ausl_validate,
+ },
+
+ {
+ /* Q_GLSN - GET_LIST_SIDS_BY_NAME, v4 */
+ "get_list_sids_by_name",
+ "glsn",
+ 4,
+ RETRIEVE,
+ "s",
+ LISTSIDS_TABLE,
+ "list_id, sid, TO_CHAR(created, 'YYYY-MM-DD HH24:MI:SS') from
listsids",
+ glsn_field,
+ 3,
+ "list_id = %d",
+ 1,
+ "created",
+ &glsn_validate,
+ },
+
+ {
+ /* Q_ALSN - ADD_LIST_SID_BY_NAME, v4 */
+ "add_list_sid_by_name",
+ "alsn",
+ 4,
+ APPEND,
+ "s",
+ LISTSIDS_TABLE,
+ "into listsids (list_id, sid) values (%d, '%s')",
+ alsn_field,
+ 2,
+ NULL,
+ 0,
+ NULL,
+ &alsn_validate,
+ },
};