[PATCH] supp. groups with cvm-pwfile

Dale Woolridge <[email protected]> Tue, 16 Aug 2005 13:09:03 -0400
Newsgroups gmane.comp.sysutils.bgware
Message-ID <[email protected]>
The attached patch allows one to provide a comma-delimited list
of groups in the gid field, to be used later in a setgroups()
call (e.g. in twoftpd-xfer).
--
-dale


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
cvm-patch-0.71.dw.gids.1-freebsd (text/plain, 697 B)
Index: cvm-pwfile.c
===================================================================
--- cvm-pwfile.c	(revision 390)
+++ cvm-pwfile.c	(working copy)
@@ -42,11 +42,21 @@
 {
   /* Format: "UID:GID:NAME,other:DIR:SHELL" */
   char* tmp;
+  unsigned long gid = 0;
+
   cvm_fact_userid = strtoul(rest, &tmp, 10);
   if (*tmp != ':') return 0;
   rest = tmp + 1;
 
   cvm_fact_groupid = strtoul(rest, &tmp, 10);
+  while (*tmp == ',') {
+    if (!gid) {
+      cvm_module_fact_uint(CVM_FACT_SUPP_GROUPID, cvm_fact_groupid);
+    }
+    rest = tmp + 1;
+    gid = strtoul(rest, &tmp, 10);
+    cvm_module_fact_uint(CVM_FACT_SUPP_GROUPID, gid);
+  }
   if (*tmp != ':') return 0;
   rest = tmp + 1;