<div class="synopsis">
B<pts membership> S<<< B<-nameorid> <I<user or group name or id>>+ >>>
+ [B<-supergroups>]
S<<< [B<-cell> <I<cell name>>] >>> [B<-localauth>] [B<-noauth>]
[B<-force>] [B<-help>]
-B<pts m> S<<< B<-na> <I<user or group name or id>>+ >>> S<<< [B<-c> <I<cell name>>] >>>
+B<pts m> S<<< B<-na> <I<user or group name or id>>+ >>>
+ [B<-s>] S<<< [B<-c> <I<cell name>>] >>>
[B<-no>] [B<-l>] [B<-f>] [B<-h>]
-B<pts groups> S<<< B<-na> <I<user or group name or id>>+ >>> [-c <I<cell name>>]
+B<pts groups> S<<< B<-na> <I<user or group name or id>>+ >>>
+ [B<-s>] S<<< [B<-c> <I<cell name>>] >>>
[B<-no>] [B<-l>] [B<-f>] [B<-h>]
-B<pts g> S<<< B<-na> <I<user or group name or id>>+ >>> S<<< [B<-c> <I<cell name>>] >>>
+B<pts g> S<<< B<-na> <I<user or group name or id>>+ >>>
+ [B<-s>] S<<< [B<-c> <I<cell name>>] >>>
[B<-no>] [B<-l>] [B<-f>] [B<-h>]
=for html
and IDs. Precede the GID of each group with a hyphen to indicate that it
is negative.
+=item B<-supergroups>
+
+List the groups to which each group specified by the B<-nameorid>
+argument belongs, in addition to user and machine members. Group
+membership may be nested when B<ptserver> is compilied with the
+SUPERGROUPS option enabled.
+
=item B<-cell> <I<cell name>>
Names the cell in which to run the command. For more details, see
printf(" %s\n", list.namelist_val[j]);
if (list.namelist_val)
free(list.namelist_val);
+ if (as->parms[1].items && id < 0) { /* -supergroups */
+ list.namelist_val = 0;
+ list.namelist_len = 0;
+ code = pr_ListSuperGroups(ids.idlist_val[i], &list);
+ if (code == RXGEN_OPCODE) {
+ continue; /* server does not support supergroups */
+ } else if (code != 0) {
+ afs_com_err(whoami, code,
+ "; unable to get supergroups of %s (id: %d)",
+ name, id);
+ continue;
+ }
+ printf("Groups %s (id: %d) is a member of:\n", name, id);
+ for (j = 0; j < list.namelist_len; j++)
+ printf(" %s\n", list.namelist_val[j]);
+ if (list.namelist_val)
+ free(list.namelist_val);
+ }
}
if (ids.idlist_val)
free(ids.idlist_val);
ts = cmd_CreateSyntax("membership", ListMembership, NULL,
"list membership of a user or group");
cmd_AddParm(ts, "-nameorid", CMD_LIST, 0, "user or group name or id");
+ cmd_AddParm(ts, "-supergroups", CMD_FLAG, CMD_OPTIONAL, "show supergroups");
add_std_args(ts);
cmd_CreateAlias(ts, "groups");
nusers, 0, 0);
return code;
}
+
+int
+pr_ListSuperGroups(afs_int32 gid, namelist * lnames)
+{
+ afs_int32 code;
+ prlist alist;
+ idlist *lids;
+ afs_int32 over;
+
+ alist.prlist_len = 0;
+ alist.prlist_val = 0;
+ code = ubik_PR_ListSuperGroups(pruclient, 0, gid, &alist, &over);
+ if (code)
+ return code;
+ if (over) {
+ fprintf(stderr, "supergroup list for id %d exceeds display limit\n",
+ gid);
+ }
+ lids = (idlist *) & alist;
+ code = pr_IdToName(lids, lnames);
+
+ xdr_free((xdrproc_t) xdr_prlist, &alist);
+ return code;
+}
extern afs_int32 pr_SetFieldsEntry(afs_int32 id, afs_int32 mask,
afs_int32 flags, afs_int32 ngroups,
afs_int32 nusers);
+extern int pr_ListSuperGroups(afs_int32 gid, namelist *lnames);
#endif /* PTUSER_H */