* Copyright (C) 1987 by the Massachusetts Institute of Technology
*
* $Log$
- * Revision 1.10 1987-08-25 15:56:54 mike
- * - Fixed bugs in get_groups_of_all_users
- * - Added tblstats updates to add_user_group
- * - Added routines: add_hostaccess (ashi), delete_hostaccess (dshi),
- * followup_ushp, and followup_usha
+ * Revision 1.12 1987-08-29 00:05:54 mike
+ * Fixed bug in check_nfs.
+ * Added code to upcasify machine names in validate_id.
*
+Revision 1.11 87/08/28 14:55:45 mike
+Modified delete_locker to require only one argument, the login name.
+Modified get_groups_of_all_users and get_all_poboxes to disable INGRES
+table locking.
+
+Revision 1.10 87/08/25 15:56:54 mike
+- Fixed bugs in get_groups_of_all_users
+- Added tblstats updates to add_user_group
+- Added routines: add_hostaccess (ashi), delete_hostaccess (dshi),
+ followup_ushp, and followup_usha
+
Revision 1.9 87/08/22 17:41:34 wesommer
More of Mike's changes.
## int rowcount;
## char dir[32];
char caccess;
+ register int status;
register char *cp1;
register char *cp2;
caccess = (isupper(*access)) ? tolower(*access) : *access;
if (caccess != 'r' && caccess != 'w') return(SMS_FILESYS_ACCESS);
+ status = SMS_NFS;
## range of np is nfsphys
## retrieve (dir = np.#dir) where np.#mach_id = mach_id
## {
if (*cp1++ != *cp2) break;
cp2++;
}
- if (*cp2 == 0) return(SMS_SUCCESS);
+ if (*cp2 == 0) {
+ status = SMS_SUCCESS;
+## endretrieve
+ }
## }
- return(SMS_NFS);
+ return(status);
##}
\f
/* Followup Routines */
**
** Inputs:
** argv[0] - users_id
- ** argv[1] - machine_id
- ** argv[2] - device
- ** argv[3] - quota
**
** Description:
+ ** - get login name from users_id
+ ** - get filesys entry from login
+ ** - use filesys.mach_id and filesys.name to determine machine/device
+ ** pair for nfsphys and nfsquota
** - delete filesys entry (label=<login>)
** - decrement allocated in nfsphys by quota
** - delete nfsquota entry
##{
## int users_id;
## int mach_id;
-## char *device;
## int quota;
## int rowcount;
## char login[9];
+## char lname[64];
+## char ndev[32];
+ register char *c;
/* copy arguments */
users_id = *(int *)argv[0];
- mach_id = *(int *)argv[1];
- device = argv[2];
- sscanf(argv[3], "%d", "a);
## range of u is users
## range of f is filesys
/* get login name */
## repeat retrieve (login = u.#login) where u.#users_id = @users_id
- /* delete the filesys entry */
-## repeat delete f where f.label = @login
+ /* get mach_id and locker name from filesys entry; then delete it */
+## repeat retrieve (mach_id = f.#mach_id, lname = f.#name)
+## where f.#label = @login
## inquire_equel (rowcount = "rowcount")
if (rowcount == 0) return(SMS_FILESYS);
+## repeat delete f where f.#label = @login
+
+ /* get prefix directory */
+ c = (char *)rindex(lname, '/');
+ *c = 0;
+
+ /* get nfs device */
+## repeat retrieve (ndev = np.device)
+## where np.#mach_id = @mach_id and np.dir = @lname
+
+ /* get quota from nfsquota entry; then delete entry */
+## repeat retrieve (quota = nq.#quota)
+## where nq.#mach_id = @mach_id and nq.#device = @ndev and
+## nq.#users_id = @users_id
+## repeat delete nq where nq.#mach_id = @mach_id and nq.#device = @ndev and
+## nq.#users_id = @users_id
+
+ /* decrement nfsphys.allocated */
+## repeat replace np (allocated = np.allocated - @quota)
+## where np.#mach_id = @mach_id and np.#device = @ndev
+
+ /* adjust table statistics */
## repeat replace tbs (deletes = tbs.deletes + 1, modtime = "now")
## where tbs.table = "filesys"
-
- /* decrement usage count in nfsphys table */
-## replace np (#allocated = np.#allocated - quota)
-## where np.#mach_id = mach_id and np.#device = device
## repeat replace tbs (updates = tbs.updates + 1, modtime = "now")
## where tbs.table = "nfsphys"
-
- /* delete nfsquota entry */
-## delete nq where nq.#users_id = users_id and nq.#mach_id = mach_id and
-## nq.#device = device
## repeat replace tbs (deletes = tbs.deletes + 1, modtime = "now")
## where tbs.table = "nfsquota"
## range of m is members
## range of g is groups
+## set lockmode session where readlock = nolock
+
## repeat retrieve (login = u.#login, group = l.name, gid = text(g.#gid))
## where m.member_type = "USER" and m.member_id = u.users_id and
## u.status != 0 and m.list_id = g.list_id and
## }
## inquire_equel (errorno = "errorno")
+## set lockmode session where readlock = system
return((errorno) ? SMS_INGRES_ERR : SMS_SUCCESS);
##}
targv[3] = box;
targv[1] = "LOCAL";
+
+## set lockmode session where readlock = nolock
## range of p is pobox
## repeat retrieve (login=users.#login, machine = #machine.name, box=p.#box)
## where p.type = "LOCAL" and p.users_id = users.users_id
## {
(*action)(4, targv, actarg);
## }
+## set lockmode session where readlock = system
return(SMS_SUCCESS);
##}
## char *idfield;
## int id;
## int rowcount;
+ register char *c;
name = argv[vo->index];
table = vo->table;
+ /* minor kludge to upcasify machine names */
+ if (!bcmp(table, "machine", 7))
+ for (c = name; *c; c++) if (islower(*c)) *c = toupper(*c);
namefield = vo->namefield;
idfield = vo->idfield;
## retrieve (id = table.idfield) where table.namefield = name