+int UpdateUser(int argc, char **argv)
+{
+ struct qelem *elem;
+
+ elem = GetUserInfo(LOGIN, argv[1], NULL);
+ QueryLoop(elem, NullPrint, RealUpdateUser, "Update the user");
+
+ FreeQueue(elem);
+ return DM_NORMAL;
+}
+
+/* Function Name: RealDeactivateUser
+ * Description: sets the user's status to 3.
+ * Arguments: info - all current information for the user fields
+ * one_item - indicates the user hasn't been queried yet
+ * Returns: none.
+ */
+
+static void RealDeactivateUser(char **info, Bool one_item)
+{
+ int status;
+ char txt_buf[BUFSIZ];
+ char *qargs[2], **args;
+ struct qelem *elem = NULL;
+
+ if (one_item)
+ {
+ sprintf(txt_buf, "Deactivate user %s (y/n)", info[NAME]);
+ if (YesNoQuestion(txt_buf, FALSE) != TRUE)
+ return;
+ }
+
+ qargs[0] = info[NAME];
+ qargs[1] = "3";
+ if ((status = do_mr_query("update_user_status", 2, qargs, Scream, NULL)))
+ {
+ com_err(program_name, status, " in update_user_status");
+ sprintf(txt_buf, "User %s not deactivated due to errors.", info[NAME]);
+ Put_message(txt_buf);
+ }
+ else if (YesNoQuestion("Also deactivate matching list and filesystem (y/n)",
+ FALSE) == TRUE)
+ {
+ status = do_mr_query("get_list_info", 1, &(info[NAME]), StoreInfo,
+ (char *) &elem);
+ if (status == MR_SUCCESS)
+ {
+ args = (char **) (QueueTop(elem)->q_data);
+ free(args[L_ACTIVE]);
+ args[L_ACTIVE] = strsave("0");
+ FreeAndClear(&args[L_MODTIME], TRUE);
+ FreeAndClear(&args[L_MODBY], TRUE);
+ FreeAndClear(&args[L_MODWITH], TRUE);
+ SlipInNewName(args, args[L_NAME]);
+ if ((status = do_mr_query("update_list", CountArgs(args), args,
+ Scream, NULL)))
+ {
+ com_err(program_name, status, " updating list, "
+ "not deactivating list or filesystem");
+ FreeInfo(args);
+ FreeQueue(elem);
+ return;
+ }
+ FreeInfo(args);
+ FreeQueue(elem);
+ elem = NULL;
+ }
+ else if (status != MR_NO_MATCH)
+ {
+ com_err(program_name, status, " getting list info, "
+ "not deactivating list or filesystem");
+ return;
+ }
+
+ if ((status = do_mr_query("get_filesys_by_label", 1, &(info[NAME]),
+ StoreInfo, (char *) &elem)))
+ {
+ com_err(program_name, status, " getting filsys info, "
+ "not deactivating filesystem");
+ FreeInfo(args);
+ FreeQueue(elem);
+ return;
+ }
+ args = (char **) (QueueTop(elem)->q_data);
+ free(args[FS_TYPE]);
+ args[FS_TYPE] = strsave("ERR");
+ free(args[FS_COMMENTS]);
+ args[FS_COMMENTS] = strsave("Locker disabled; call 3-1325 for help");
+ FreeAndClear(&args[FS_MODTIME], TRUE);
+ FreeAndClear(&args[FS_MODBY], TRUE);
+ FreeAndClear(&args[FS_MODWITH], TRUE);
+ SlipInNewName(args, args[FS_NAME]);
+ if ((status = do_mr_query("update_filesys", CountArgs(args), args,
+ Scream, NULL)))
+ {
+ com_err(program_name, status, " updating filesystem, "
+ "not deactivating filesystem");
+ FreeInfo(args);
+ FreeQueue(elem);
+ return;
+ }
+ FreeInfo(args);
+ FreeQueue(elem);
+ }
+}
+
+
+/* Function Name: DeactivateUser
+ * Description: sets the user's status to 3.
+ * Arguments: argc, argv - login name of the user in argv[1].
+ * Returns: DM_NORMAL.
+ */
+
+int DeactivateUser(int argc, char **argv)