]> andersk Git - moira.git/blobdiff - afssync/sync.qc
Preserve hidden status of groups
[moira.git] / afssync / sync.qc
index ed6606d215a20a0a044c8801fc7e19f82e2dd3db..f443c34003227a59268a92e6c74cc217b1dd06f4 100644 (file)
@@ -9,16 +9,16 @@
 #include <mit-copyright.h>
 #include <stdio.h>
 #include <sys/file.h>
+
 #include <rx/xdr.h>
-#include <afs/ptint.h>
-#include <afs/ptserver.h>
-#include <afs/pterror.h>
+#include "ptint.h"
+#include "ptserver.h"
+#include "pterror.h"
+
 #include <moira.h>
 #include <moira_site.h>
 #include <ctype.h>
 
-#define USERSMS 14487
-
 #define min(x,y)       ((x) < (y) ? (x) : (y))
 struct hash *users = NULL;
 char *whoami = "sync";
@@ -52,10 +52,13 @@ char **argv;
 ##  begin transaction
 
     do_passwd();
+#if 0
+#define USERSMS 14487
     status = PR_AddToGroup(NULL, USERSMS, SYSADMINID);
     if (status) {
        prserror(status, "adding MR to system:administrators", 0, 0);
     }
+#endif
     do_groups();
 
 ##  end transaction
@@ -164,7 +167,7 @@ do_groups()
     struct hash *groups;
     long u, g, status;
 ##  char name[33], namebuf[128];
-##  int gid, id, lid;
+##  int gid, id, lid, hide;
 
     fprintf(stderr, "Doing groups\n");
 
@@ -178,14 +181,25 @@ do_groups()
 ##  retrieve (name = l.modtime) where l.list_id = 0
 ##  retrieve (name = users.modtime) where users.users_id = 0
 
-##  retrieve (name = l.#name, gid = l.#gid, lid = l.list_id)
+##  retrieve (name = l.#name, gid = l.#gid, lid = l.list_id, hide = l.hidden)
 ##     where l.group != 0 and l.active != 0 {
            strtrim(name);
            sprintf(namebuf, "system:%s", name);
            hash_store(groups, lid, -gid);
            status = PR_INewEntry(NULL, namebuf, -gid, SYSADMINID);
            if (status)
-             prserror(status, "adding list %s gid %d", namebuf, -gid);
+               prserror(status, "adding list %s gid %d", namebuf, -gid);
+           else {
+               if (hide) {
+                   status = PR_SetFieldsEntry
+                       (NULL/*call*/, -gid,
+                        PR_SF_ALLBITS/*mask*/,
+                        PRP_STATUS_MEM >> PRIVATE_SHIFT /*flags*/,
+                        0/*ngroups*/, 0/*nusers*/, 0/*spare1*/, 0/*spare2*/);
+               }
+               if (status)
+                   prserror(status, "setting flags on list %s", namebuf);
+           }
 ##  }
 
 
This page took 0.032195 seconds and 4 git commands to generate.