]> andersk Git - moira.git/commitdiff
pr_ChangeEntry is smart enough to know that the id's haven't changed.
authorprobe <probe>
Fri, 10 Jul 1992 20:06:20 +0000 (20:06 +0000)
committerprobe <probe>
Fri, 10 Jul 1992 20:06:20 +0000 (20:06 +0000)
Added routines to support changing a user's status (reactivation).

incremental/afs.c

index d8424cc4049e79b7117157f5c51224716f47b363..e1431e75ec4b4806422d180137514053d1df8a3b 100644 (file)
@@ -58,6 +58,7 @@ int argc;
          strcat(buf, ",");
        strcat(buf, after[i]);
     }
          strcat(buf, ",");
        strcat(buf, after[i]);
     }
+    strcat(buf, ")");
 #ifdef DEBUG
     printf("%s\n", buf);
 #endif
 #ifdef DEBUG
     printf("%s\n", buf);
 #endif
@@ -107,6 +108,18 @@ char *cmd;
 }
 
 
 }
 
 
+add_user_lists(ac, av, user)
+    int ac;
+    char *av[];
+    char *user;
+{
+    if (atoi(av[5])) {
+       sleep(1);                               /* give the ptserver room */
+       edit_group(1, av[0], "USER", user);
+    }
+}
+
+
 do_user(before, beforec, after, afterc)
 char **before;
 int beforec;
 do_user(before, beforec, after, afterc)
 char **before;
 int beforec;
@@ -114,6 +127,8 @@ char **after;
 int afterc;
 {
     int astate, bstate, auid, buid, code;
 int afterc;
 {
     int astate, bstate, auid, buid, code;
+    char hostname[64];
+    char *av[2];
 
     auid = buid = astate = bstate = 0;
     if (afterc > U_STATE) astate = atoi(after[U_STATE]);
 
     auid = buid = astate = bstate = 0;
     if (afterc > U_STATE) astate = atoi(after[U_STATE]);
@@ -168,6 +183,27 @@ int afterc;
                           "Couldn't create user %s (id %d): %s",
                           after[U_NAME], auid, error_message(code));
        }
                           "Couldn't create user %s (id %d): %s",
                           after[U_NAME], auid, error_message(code));
        }
+       if (beforec) {
+           /* Reactivating a user; get his group list */
+           gethostname(hostname, sizeof(hostname));
+           code = mr_connect(hostname);
+           if (!code) code = mr_auth("afs.incr");
+           if (code) {
+               critical_alert("incremental",
+                              "Error contacting Moira server to retrieve grouplist of user %s: %s",
+                              after[U_NAME], error_message(code));
+               return;
+           }
+           av[0] = "RUSER";
+           av[1] = after[U_NAME];
+           code = mr_query("get_lists_of_member", 2, av,
+                           add_user_lists, after[U_NAME]);
+           if (code)
+               critical_alert("incremental",
+                              "Couldn't retrieve membership of user %s: %s",
+                              after[U_NAME], error_message(code));
+           mr_disconnect();
+       }
        return;
     }
 }
        return;
     }
 }
@@ -214,7 +250,7 @@ int afterc;
            strcpy(g2, "system:");
            strcat(g1, before[L_NAME]);
            strcat(g2, after[L_NAME]);
            strcpy(g2, "system:");
            strcat(g1, before[L_NAME]);
            strcat(g2, after[L_NAME]);
-           code = pr_ChangeEntry(g1, g2, (agid==bgid) ? 0 : -agid, "");
+           code = pr_ChangeEntry(g1, g2, -agid, "");
            if (code) {
                critical_alert("incremental",
                               "Couldn't change group %s (id %d) to %s (id %d): %s",
            if (code) {
                critical_alert("incremental",
                               "Couldn't change group %s (id %d) to %s (id %d): %s",
This page took 0.042651 seconds and 5 git commands to generate.